Skip to content

Commit

Permalink
Enhancement undo show tooltips option (fix #1827)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gasparoken authored and dacap committed Sep 6, 2018
1 parent 3035820 commit 336407f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions data/pref.xml
Expand Up @@ -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" />
Expand Down
1 change: 1 addition & 0 deletions data/strings/en.ini
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions data/widgets/options.xml
Expand Up @@ -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>

Expand Down
14 changes: 9 additions & 5 deletions src/app/commands/cmd_undo.cpp
Expand Up @@ -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

Expand Down

0 comments on commit 336407f

Please sign in to comment.