Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::MessageStack Class Referencefinal

A class which holds a stack of displayed messages. More...

#include <message-stack.h>

Classes

struct  Message
 

Public Member Functions

 MessageStack ()
 
 ~MessageStack ()
 
 MessageStack (MessageStack const &)=delete
 
void operator= (MessageStack const &)=delete
 
MessageType currentMessageType ()
 returns the type of message currently at the top of the stack
 
char const * currentMessage ()
 returns the text of the message currently at the top of the stack
 
sigc::connection connectChanged (sigc::slot< void(MessageType, char const *)> slot)
 connects to the "changed" signal which is emitted whenever the topmost message on the stack changes.
 
MessageId push (MessageType type, char const *message)
 pushes a message onto the stack
 
MessageId pushF (MessageType type, char const *format,...) G_GNUC_PRINTF(3
 pushes a message onto the stack using printf-like formatting
 
MessageId MessageId pushVF (MessageType type, char const *format, va_list args)
 pushes a message onto the stack using printf-like formatting, using a stdarg argument list
 
void cancel (MessageId id)
 removes a message from the stack, given its id
 
MessageId flash (MessageType type, char const *message)
 Temporarily pushes a message onto the stack.
 
MessageId flash (MessageType type, Glib::ustring const &message)
 Temporarily pushes a message onto the stack.
 
MessageId flashF (MessageType type, char const *format,...) G_GNUC_PRINTF(3
 temporarily pushes a message onto the stack using printf-like formatting
 
MessageId MessageId flashVF (MessageType type, char const *format, va_list args)
 temporarily pushes a message onto the stack using printf-like formatting, using a stdarg argument list
 

Private Member Functions

MessageId _push (MessageType type, unsigned int lifetime, char const *message)
 pushes a message onto the stack with an optional timeout
 
Message_discard (Message *m)
 frees a message struct and returns the next such struct in the list
 
void _emitChanged ()
 emits the "changed" signal
 

Static Private Member Functions

static int _timeout (void *data)
 callback to expire flashed messages
 

Private Attributes

sigc::signal< void(MessageType, char const *)> _changed_signal
 
Message_messages
 the stack of messages as a linked list
 
MessageId _next_id
 the next message id to assign
 

Detailed Description

A class which holds a stack of displayed messages.


Messages can be pushed onto the top of the stack, and removed from any point in the stack by their id.

Messages may also be "flashed", meaning that they will be automatically removed from the stack a fixed period of time after they are pushed.

"Flashed" warnings and errors will persist longer than normal messages.

There is no simple "pop" operation provided, since these stacks are intended to be shared by many different clients; assuming that the message you pushed is still on top is an invalid and unsafe assumption.

Definition at line 48 of file message-stack.h.

Constructor & Destructor Documentation

◆ MessageStack() [1/2]

Inkscape::MessageStack::MessageStack ( )

Definition at line 20 of file message-stack.cpp.

◆ ~MessageStack()

Inkscape::MessageStack::~MessageStack ( )

Definition at line 25 of file message-stack.cpp.

References _discard(), and _messages.

◆ MessageStack() [2/2]

Inkscape::MessageStack::MessageStack ( MessageStack const &  )
delete

Member Function Documentation

◆ _discard()

MessageStack::Message * Inkscape::MessageStack::_discard ( MessageStack::Message m)
private

frees a message struct and returns the next such struct in the list

Definition at line 132 of file message-stack.cpp.

References Inkscape::MessageStack::Message::message, Inkscape::MessageStack::Message::next, Inkscape::MessageStack::Message::stack, and Inkscape::MessageStack::Message::timeout_id.

Referenced by cancel(), and ~MessageStack().

◆ _emitChanged()

void Inkscape::MessageStack::_emitChanged ( )
private

◆ _push()

MessageId Inkscape::MessageStack::_push ( MessageType  type,
unsigned int  lifetime,
char const *  message 
)
private

◆ _timeout()

gboolean Inkscape::MessageStack::_timeout ( void *  data)
staticprivate

callback to expire flashed messages

Definition at line 154 of file message-stack.cpp.

References cancel(), data, Inkscape::MessageStack::Message::id, Inkscape::MessageStack::Message::stack, and Inkscape::MessageStack::Message::timeout_id.

Referenced by _push().

◆ cancel()

void Inkscape::MessageStack::cancel ( MessageId  id)

removes a message from the stack, given its id

This method will remove a message from the stack if it has not already been removed. It may be removed from any part of the stack.

Parameters
idthe message id to remove

Definition at line 54 of file message-stack.cpp.

References _discard(), _emitChanged(), _messages, Inkscape::MessageStack::Message::next, and ref.

Referenced by Inkscape::LivePathEffect::LPEEllipse5Pts::_clearWarning(), _timeout(), Inkscape::MessageContext::clear(), Inkscape::MessageContext::flash(), Inkscape::UI::Dialog::ObjectsPanel::on_motion_leave(), and Inkscape::MessageContext::set().

◆ connectChanged()

sigc::connection Inkscape::MessageStack::connectChanged ( sigc::slot< void(MessageType, char const *)>  slot)
inline

connects to the "changed" signal which is emitted whenever the topmost message on the stack changes.

Definition at line 71 of file message-stack.h.

References _changed_signal.

◆ currentMessage()

char const * Inkscape::MessageStack::currentMessage ( )
inline

returns the text of the message currently at the top of the stack

Definition at line 64 of file message-stack.h.

References _messages, and Inkscape::MessageStack::Message::message.

◆ currentMessageType()

MessageType Inkscape::MessageStack::currentMessageType ( )
inline

returns the type of message currently at the top of the stack

Definition at line 58 of file message-stack.h.

References _messages, Inkscape::NORMAL_MESSAGE, and Inkscape::MessageStack::Message::type.

◆ flash() [1/2]

MessageId Inkscape::MessageStack::flash ( MessageType  type,
char const *  message 
)

Temporarily pushes a message onto the stack.

Parameters
typethe message type
messagethe message text
Returns
the id of the pushed message

Referenced by Inkscape::UI::Dialog::LayerPropertiesDialog::_doCreate(), Inkscape::UI::Dialog::LayerPropertiesDialog::_doRename(), Inkscape::UI::Tools::PenTool::_finish(), Inkscape::LivePathEffect::LPEEllipse5Pts::_flashWarning(), Inkscape::UI::Tools::PenTool::_handleButtonPress(), Inkscape::UI::Tools::PencilTool::_handleButtonPress(), Inkscape::UI::Tools::PencilTool::_handleButtonRelease(), Inkscape::UI::Tools::PencilTool::_handleKeyPress(), Inkscape::UI::Tools::PencilTool::_handleKeyRelease(), Inkscape::UI::Tools::TextTool::_insertUnichar(), Inkscape::ObjectSet::_pathBoolOp(), Inkscape::UI::Dialog::CloneTiler::apply(), Inkscape::ObjectSet::applyAffine(), Inkscape::UI::Dialog::Transformation::applyPageSkew(), Inkscape::UI::Dialog::Transformation::applyPageTransform(), Inkscape::ObjectSet::breakApart(), Inkscape::UI::Tools::cc_selection_set_avoid(), Inkscape::UI::Dialog::Export::checkOrCreateDirectory(), Inkscape::ObjectSet::clone(), Inkscape::ObjectSet::cloneOriginal(), Inkscape::ObjectSet::cloneOriginalPathLPE(), Inkscape::ObjectSet::combine(), Inkscape::UI::Tools::MeasureTool::copyToClipboard(), Inkscape::ObjectSet::createBitmapCopy(), Inkscape::UI::Tools::do_trace(), document_cleanup(), Inkscape::LivePathEffect::Effect::editNextParamOncanvas(), SPKnot::eventHandler(), Inkscape::UI::Dialog::Export::exportRaster(), Inkscape::UI::Dialog::Export::exportVector(), Inkscape::ObjectSet::fillBetweenMany(), Inkscape::ObjectSet::fitCanvas(), Inkscape::MessageContext::flash(), flash(), flashVF(), flowtext_to_text(), Inkscape::have_viable_layer(), layer_bottom(), layer_delete(), layer_duplicate(), layer_from_group(), layer_hide_toggle(), layer_hide_toggle_others(), layer_lock_toggle(), layer_lock_toggle_others(), layer_lower(), layer_new_above(), layer_next(), layer_previous(), layer_raise(), layer_to_group(), layer_top(), Inkscape::UI::Dialog::SvgFontsDialog::missing_glyph_description_from_selected_path(), SPDesktop::next_transform(), Inkscape::UI::Dialog::Find::onAction(), Inkscape::UI::Dialog::BatchExport::onExport(), Inkscape::ObjectSet::pathReverse(), SPDesktop::prev_transform(), Inkscape::ObjectSet::relink(), Inkscape::UI::Dialog::CloneTiler::remove(), Inkscape::ObjectSet::removeFilter(), Inkscape::ObjectSet::removeLPE(), Inkscape::UI::Tools::TextTool::root_handler(), Inkscape::UI::Tools::ObjectPickerTool::root_handler(), selection_display_message(), Inkscape::UI::Dialog::SvgFontsDialog::set_glyph_description_from_selected_path(), Inkscape::ObjectSet::setClipGroup(), Inkscape::ObjectSet::setMask(), Inkscape::ObjectSet::simplifyPaths(), sp_file_revert_dialog(), Inkscape::UI::Tools::sp_flood_do_flood_fill(), Inkscape::UI::Tools::SelectTool::sp_select_context_abort(), sp_selected_path_create_offset_object(), sp_selected_path_do_offset(), sp_selection_next_patheffect_param(), sp_te_delete(), sp_te_insert(), sp_te_insert_line(), Inkscape::UI::Tools::spdc_concat_colors_and_flush(), Inkscape::UI::Tools::spdc_create_single_dot(), Inkscape::ObjectSet::strokesToPaths(), Inkscape::UI::Dialog::StyleFromSelectionToTool(), text_flow_into_shape(), text_flow_shape_subtract(), text_put_on_path(), text_remove_all_kerns(), text_remove_from_path(), text_to_glyphs(), text_unflow(), Inkscape::ObjectSet::tile(), Inkscape::ObjectSet::toCurves(), Inkscape::UI::Toolbar::MeasureToolbar::toggle_all_layers(), Inkscape::UI::Toolbar::SelectToolbar::toggle_corners(), Inkscape::UI::Toolbar::SelectToolbar::toggle_gradient(), Inkscape::UI::Toolbar::MeasureToolbar::toggle_ignore_1st_and_last(), Inkscape::UI::Toolbar::MeasureToolbar::toggle_only_selected(), Inkscape::UI::Toolbar::SelectToolbar::toggle_pattern(), Inkscape::UI::Toolbar::MeasureToolbar::toggle_show_hidden(), Inkscape::UI::Toolbar::MeasureToolbar::toggle_show_in_between(), Inkscape::UI::Toolbar::SelectToolbar::toggle_stroke(), Inkscape::ObjectSet::toGuides(), Inkscape::ObjectSet::toLayer(), Inkscape::ObjectSet::toMarker(), Inkscape::ObjectSet::toNextLayer(), Inkscape::ObjectSet::toPrevLayer(), Inkscape::ObjectSet::toSymbol(), Inkscape::UI::Dialog::CloneTiler::unclump(), Inkscape::ObjectSet::unlink(), Inkscape::ObjectSet::unlinkRecursive(), Inkscape::ObjectSet::unsetMask(), and Inkscape::ObjectSet::untile().

◆ flash() [2/2]

MessageId Inkscape::MessageStack::flash ( MessageType  type,
Glib::ustring const &  message 
)

Temporarily pushes a message onto the stack.

Parameters
typethe message type
messagethe message text
Returns
the id of the pushed message

Definition at line 65 of file message-stack.cpp.

References flash().

◆ flashF()

MessageId Inkscape::MessageStack::flashF ( MessageType  type,
char const *  format,
  ... 
)

temporarily pushes a message onto the stack using printf-like formatting

Parameters
typethe message type
formata printf-style format string
Returns
the id of the pushed message

Definition at line 92 of file message-stack.cpp.

References flashVF(), va_end(), and va_start().

Referenced by Inkscape::UI::Tools::do_trace(), document_cleanup(), Inkscape::UI::Dialog::Export::exportRaster(), Inkscape::UI::Dialog::Export::exportVector(), Inkscape::UI::Dialog::Find::onAction(), and Inkscape::ObjectSet::simplifyPaths().

◆ flashVF()

MessageId Inkscape::MessageStack::flashVF ( MessageType  type,
char const *  format,
va_list  args 
)

temporarily pushes a message onto the stack using printf-like formatting, using a stdarg argument list

Parameters
typethe message type
formata printf-style format string
argsthe printf-style arguments
Returns
the id of the pushed message

Definition at line 100 of file message-stack.cpp.

References flash().

Referenced by flashF().

◆ operator=()

void Inkscape::MessageStack::operator= ( MessageStack const &  )
delete

◆ push()

MessageId Inkscape::MessageStack::push ( MessageType  type,
char const *  message 
)

pushes a message onto the stack

Parameters
typethe message type
messagethe message text
Returns
the id of the pushed message

Definition at line 32 of file message-stack.cpp.

References _push().

Referenced by Inkscape::UI::Dialog::ObjectsPanel::on_motion_enter(), pushVF(), and Inkscape::MessageContext::set().

◆ pushF()

MessageId Inkscape::MessageStack::pushF ( MessageType  type,
char const *  format,
  ... 
)

pushes a message onto the stack using printf-like formatting

Parameters
typethe message type
formata printf-style format string
Returns
the id of the pushed message

Definition at line 36 of file message-stack.cpp.

References pushVF(), va_end(), and va_start().

◆ pushVF()

MessageId Inkscape::MessageStack::pushVF ( MessageType  type,
char const *  format,
va_list  args 
)

pushes a message onto the stack using printf-like formatting, using a stdarg argument list

Parameters
typethe message type
formata printf-style format string
argsthe subsequent printf-style arguments
Returns
the id of the pushed message

Definition at line 45 of file message-stack.cpp.

References push().

Referenced by pushF().

Member Data Documentation

◆ _changed_signal

sigc::signal<void (MessageType, char const *)> Inkscape::MessageStack::_changed_signal
private

Definition at line 173 of file message-stack.h.

Referenced by _emitChanged(), and connectChanged().

◆ _messages

Message* Inkscape::MessageStack::_messages
private

the stack of messages as a linked list

Definition at line 174 of file message-stack.h.

Referenced by _emitChanged(), _push(), cancel(), currentMessage(), currentMessageType(), and ~MessageStack().

◆ _next_id

MessageId Inkscape::MessageStack::_next_id
private

the next message id to assign

Definition at line 175 of file message-stack.h.

Referenced by _push().


The documentation for this class was generated from the following files: