]> git.tdb.fi Git - r2c2.git/commitdiff
Improve tool status display
authorMikko Rasa <tdb@tdb.fi>
Wed, 2 Apr 2014 20:12:55 +0000 (23:12 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 2 Apr 2014 20:12:55 +0000 (23:12 +0300)
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
source/designer/designer.h

index ac870a469f4e01d72f7efedfc34782cf5d666134..3d068d0ad42d4252adb1561f45874e46bb6790ee 100644 (file)
@@ -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)
index 499c06cee81f446a7253c4be3e1aa0a9c05ee4fd..a132b4791b4bcfdcca33e945430d8763a30d7b48 100644 (file)
@@ -66,6 +66,7 @@ private:
        Selection selection;
        SelectionWrap sel_wrap;
        Tool *cur_tool;
+       unsigned keep_status;
        CameraController *camera_ctl;
 
        Msp::Time::TimeStamp last_tick;