]> git.tdb.fi Git - r2c2.git/blobdiff - source/designer/designer.cpp
Give tools access to the keyboard
[r2c2.git] / source / designer / designer.cpp
index 292d5a9cb12a3e43c6b952b9306d8588644987b2..cfe3938a91d3c6258d631467f14d1bd0ad7ae5ac 100644 (file)
@@ -398,14 +398,9 @@ void Designer::key_press(unsigned key)
                use_tool_with_selected_objects<ElevateTool>();
        else if(key==Msp::Input::KEY_ESC)
        {
-               if(cur_tool)
-               {
-                       delete cur_tool;
-                       cur_tool = 0;
-               }
-               else if(mode==CATALOGUE)
+               if(mode==CATALOGUE)
                        mode = SELECT;
-               else
+               else if(mode==SELECT)
                        selection.clear();
        }
        else if(key==Msp::Input::KEY_X)
@@ -449,7 +444,7 @@ void Designer::key_press(unsigned key)
 template<typename T>
 T *Designer::use_tool_with_selected_objects()
 {
-       T *tool = new T(*this, mouse, selection.get_objects());
+       T *tool = new T(*this, keyboard, mouse, selection.get_objects());
        use_tool(tool);
        return tool;
 }
@@ -457,7 +452,7 @@ T *Designer::use_tool_with_selected_objects()
 template<typename T>
 T *Designer::use_tool()
 {
-       T *tool = new T(*this, mouse);
+       T *tool = new T(*this, keyboard, mouse);
        use_tool(tool);
        return tool;
 }