Enhancement undo show tooltips option (fix #1827)

This commit is contained in:
Gaspar Capello 2018-09-03 11:50:32 -03:00 committed by David Capello
parent 3035820d39
commit 336407fab6
4 changed files with 13 additions and 5 deletions

View File

@ -121,6 +121,7 @@
<option id="size_limit" type="int" default="0" />
<option id="goto_modified" type="bool" default="true" />
<option id="allow_nonlinear_history" type="bool" default="false" />
<option id="show_tooltip" type="bool" default="true" />
</section>
<section id="editor" text="Editor">
<option id="zoom_with_wheel" type="bool" default="true" migrate="Options.ZoomWithMouseWheel" />

View File

@ -1001,6 +1001,7 @@ layer_edges_color = Layer Edges Color:
auto_guides_color = Auto Guides Color:
default_slice_color = Default Color:
undo = Undo
undo_show_tooltip = Show Undo Tooltip
undo_size_limit = Undo Limit:
undo_size_limit_tooltip = <<<END
Limit of memory to be used

View File

@ -305,6 +305,8 @@
tooltip="@.undo_goto_modified_tooltip" />
<check id="undo_allow_nonlinear_history"
text="@.undo_allow_nonlinear_history" />
<check text="@.undo_show_tooltip" id="undo_show_tooltip"
pref="undo.show_tooltip" />
</vbox>
</vbox>

View File

@ -108,11 +108,15 @@ void UndoCommand::onExecute(Context* context)
StatusBar* statusbar = StatusBar::instance();
if (statusbar) {
statusbar->showTip(1000, "%s %s",
(m_type == Undo ? "Undid": "Redid"),
(m_type == Undo ?
undo->nextUndoLabel().c_str():
undo->nextRedoLabel().c_str()));
std::string msg;
if (m_type == Undo)
msg = "Undid " + undo->nextUndoLabel();
else
msg = "Redid " + undo->nextRedoLabel();
if (Preferences::instance().undo.showTooltip())
statusbar->showTip(1000, msg.c_str());
else
statusbar->setStatusText(0, msg.c_str());
}
#endif // ENABLE_UI