From da0cb818f7649e78e6f610a25240e5b8129f00d8 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 2 Apr 2014 23:12:55 +0300 Subject: [PATCH] Improve tool status display If a tool finishes instantly and displays a status (such as SlopeTool or ExtendTool when they encounter an error during construction), do not replace it with the selection tool status. --- source/designer/designer.cpp | 10 ++++++++-- source/designer/designer.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/source/designer/designer.cpp b/source/designer/designer.cpp index ac870a4..3d068d0 100644 --- a/source/designer/designer.cpp +++ b/source/designer/designer.cpp @@ -56,7 +56,8 @@ Designer::Designer(int argc, char **argv): cur_zone(0), mode(TOOL), sel_wrap(selection), - cur_tool(0) + cur_tool(0), + keep_status(0) { window.set_title("Railway Designer"); window.signal_close.connect(sigc::bind(sigc::mem_fun(this, &Designer::exit), 0)); @@ -346,6 +347,7 @@ void Designer::tick() cur_tool->update_selection(selection); use_select_tool(); } + keep_status = 0; window.tick(); root.tick(); @@ -465,8 +467,10 @@ void Designer::use_tool(Tool *tool) cur_tool = tool; cur_tool->signal_status.connect(sigc::mem_fun(this, &Designer::tool_status)); - tool_status(cur_tool->get_status()); + if(keep_status<2) + tool_status(tool->get_status()); mode = TOOL; + keep_status = 1; } void Designer::use_select_tool() @@ -557,6 +561,8 @@ void Designer::update_object_icon(Object &obj) void Designer::tool_status(const string &status) { lbl_status->set_text(status); + if(keep_status==1) + keep_status = 2; } void Designer::object_properties_response(int) diff --git a/source/designer/designer.h b/source/designer/designer.h index 499c06c..a132b47 100644 --- a/source/designer/designer.h +++ b/source/designer/designer.h @@ -66,6 +66,7 @@ private: Selection selection; SelectionWrap sel_wrap; Tool *cur_tool; + unsigned keep_status; CameraController *camera_ctl; Msp::Time::TimeStamp last_tick; -- 2.45.2