Add "select all layers" (S-C-a) and "unselect all ducks" (C-d). Move "unselect all...
[synfig.git] / synfig-studio / trunk / src / gtkmm / app.cpp
index feb0c02..591d7eb 100644 (file)
@@ -54,6 +54,7 @@
 #include <gtkmm/inputdialog.h>
 #include <gtkmm/accelmap.h>
 #include <gtkmm/uimanager.h>
+#include <gtkmm/textview.h>
 
 #include <gtk/gtk.h>
 
@@ -88,6 +89,8 @@
 #include "state_rectangle.h"
 #include "state_smoothmove.h"
 #include "state_scale.h"
+#include "state_star.h"
+#include "state_text.h"
 #include "state_width.h"
 #include "state_rotate.h"
 #include "state_zoom.h"
@@ -667,6 +670,8 @@ init_ui_manager()
        DEFINE_ACTION("copy", Gtk::StockID("gtk-copy"));
        DEFINE_ACTION("paste", Gtk::StockID("gtk-paste"));
        DEFINE_ACTION("select-all-ducks", _("Select All Ducks"));
+       DEFINE_ACTION("unselect-all-ducks", _("Unselect All Ducks"));
+       DEFINE_ACTION("select-all-layers", _("Select All Layers"));
        DEFINE_ACTION("unselect-all-layers", _("Unselect All Layers"));
        DEFINE_ACTION("properties", _("Properties"));
 
@@ -795,8 +800,10 @@ init_ui_manager()
 "              <menuitem action='copy'/>"
 "              <menuitem action='paste'/>"
 "              <separator name='bleh06'/>"
-"              <menuitem action='select-all-ducks'/>"
+"              <menuitem action='select-all-layers'/>"
 "              <menuitem action='unselect-all-layers'/>"
+"              <menuitem action='select-all-ducks'/>"
+"              <menuitem action='unselect-all-ducks'/>"
 "              <separator name='bleh07'/>"
 "              <menuitem action='properties'/>"
 "      </menu>"
@@ -935,7 +942,9 @@ init_ui_manager()
        }
 
        ACCEL("<Actions>//select-all-ducks","<Control>a");
-       ACCEL("<Actions>//unselect-all-layers","<Control>d");
+       ACCEL("<Actions>//unselect-all-ducks","<Control>d");
+       ACCEL("<Actions>//select-all-layers","<Control><Shift>a");
+       ACCEL("<Actions>//unselect-all-layers","<Control><Shift>d");
        ACCEL("<Actions>//render","F9");
        ACCEL("<Actions>//preview","F11");
        ACCEL("<Actions>//properties","F8");
@@ -999,23 +1008,25 @@ init_ui_manager()
 
        ACCEL("<Actions>//state-normal",      "<Mod1>a");
        ACCEL("<Actions>//state-smooth_move", "<Mod1>v");
-       ACCEL("<Actions>//state-scale",       "<Mod1>d");
-       ACCEL("<Actions>//state-rotate",      "<Mod1>s");
+       ACCEL("<Actions>//state-scale",       "<Mod1>s");
+       ACCEL("<Actions>//state-rotate",      "<Mod1>t");
+       ACCEL("<Actions>//state-mirror",      "<Mod1>m");
 
-       ACCEL("<Actions>//state-bline",       "<Mod1>b");
        ACCEL("<Actions>//state-circle",      "<Mod1>c");
        ACCEL("<Actions>//state-rectangle",   "<Mod1>r");
+       ACCEL("<Actions>//state-star",        "<Mod1>q");
        ACCEL("<Actions>//state-gradient",    "<Mod1>g");
+       ACCEL("<Actions>//state-polygon",     "<Mod1>p");
 
-       ACCEL("<Actions>//state-eyedrop",     "<Mod1>e");
+       ACCEL("<Actions>//state-bline",       "<Mod1>b");
+       ACCEL("<Actions>//state-text",        "<Mod1>x");
        ACCEL("<Actions>//state-fill",        "<Mod1>f");
+       ACCEL("<Actions>//state-eyedrop",     "<Mod1>e");
        ACCEL("<Actions>//state-zoom",        "<Mod1>z");
-       ACCEL("<Actions>//state-polygon",     "<Mod1>p");
 
-       ACCEL("<Actions>//state-draw",        "<Mod1>w");
+       ACCEL("<Actions>//state-draw",        "<Mod1>d");
        ACCEL("<Actions>//state-sketch",      "<Mod1>k");
-       ACCEL("<Actions>//state-width",       "<Mod1>t");
-       ACCEL("<Actions>//state-mirror",      "<Mod1>m");
+       ACCEL("<Actions>//state-width",       "<Mod1>w");
 
        ACCEL("<Actions>//canvas-zoom-fit","<Control><Shift>z");
 
@@ -1181,19 +1192,22 @@ App::App(int *argc, char ***argv):
                studio_init_cb.task(_("Init ModMirror...")); module_list_.push_back(new ModMirror()); module_list_.back()->start();
 
                /* row 2 */
-               state_manager->add_state(&state_bline);
                state_manager->add_state(&state_circle);
                state_manager->add_state(&state_rectangle);
+               state_manager->add_state(&state_star);
                state_manager->add_state(&state_gradient);
                if(!getenv("SYNFIG_DISABLE_POLYGON")) state_manager->add_state(&state_polygon); // Enabled - for working without ducks
 
                /* row 3 */
-               if(!getenv("SYNFIG_DISABLE_DRAW"   )) state_manager->add_state(&state_draw); // Enabled for now.  Let's see whether they're good enough yet.
-               if(!getenv("SYNFIG_DISABLE_SKETCH" )) state_manager->add_state(&state_sketch);
+               state_manager->add_state(&state_bline);
+               state_manager->add_state(&state_text);
                state_manager->add_state(&state_fill);
                state_manager->add_state(&state_eyedrop);
                state_manager->add_state(&state_zoom);
 
+               if(!getenv("SYNFIG_DISABLE_DRAW"   )) state_manager->add_state(&state_draw); // Enabled for now.  Let's see whether they're good enough yet.
+               if(!getenv("SYNFIG_DISABLE_SKETCH" )) state_manager->add_state(&state_sketch);
+
                // Disabled by default - it doesn't work properly?
                if(getenv("SYNFIG_ENABLE_WIDTH"    )) state_manager->add_state(&state_width);
 
@@ -1778,7 +1792,7 @@ static OPENFILENAME ofn={};
 bool
 App::dialog_open_file(const std::string &title, std::string &filename, std::string preference)
 {
-       info("App::dialog_open_file('%s', '%s', '%s')", title.c_str(), filename.c_str(), preference.c_str());
+       // info("App::dialog_open_file('%s', '%s', '%s')", title.c_str(), filename.c_str(), preference.c_str());
 
 #ifdef USE_WIN32_FILE_DIALOGS
        static TCHAR szFilter[] = TEXT ("All Files (*.*)\0*.*\0\0") ;
@@ -1904,7 +1918,7 @@ App::dialog_open_file(const std::string &title, std::string &filename, std::stri
 bool
 App::dialog_save_file(const std::string &title, std::string &filename, std::string preference)
 {
-       info("App::dialog_save_file('%s', '%s', '%s')", title.c_str(), filename.c_str(), preference.c_str());
+       // info("App::dialog_save_file('%s', '%s', '%s')", title.c_str(), filename.c_str(), preference.c_str());
 
 #if USE_WIN32_FILE_DIALOGS
        static TCHAR szFilter[] = TEXT ("All Files (*.*)\0*.*\0\0") ;
@@ -2184,8 +2198,8 @@ App::dialog_entry(const std::string &title, const std::string &message,std::stri
        Gtk::Dialog dialog(
                title,          // Title
                true,           // Modal
-               true            // use_separator
-       );
+               true);          // use_separator
+
        Gtk::Label label(message);
        label.show();
        dialog.get_vbox()->pack_start(label);
@@ -2194,11 +2208,13 @@ App::dialog_entry(const std::string &title, const std::string &message,std::stri
        entry.set_text(text);
        entry.show();
        entry.set_activates_default(true);
+
        dialog.get_vbox()->pack_start(entry);
 
        dialog.add_button(Gtk::StockID("gtk-ok"),Gtk::RESPONSE_OK);
        dialog.add_button(Gtk::StockID("gtk-cancel"),Gtk::RESPONSE_CANCEL);
        dialog.set_default_response(Gtk::RESPONSE_OK);
+
        entry.signal_activate().connect(sigc::bind(sigc::mem_fun(dialog,&Gtk::Dialog::response),Gtk::RESPONSE_OK));
        dialog.show();
 
@@ -2210,8 +2226,39 @@ App::dialog_entry(const std::string &title, const std::string &message,std::stri
        return true;
 }
 
+bool
+App::dialog_paragraph(const std::string &title, const std::string &message,std::string &text)
+{
+       Gtk::Dialog dialog(
+               title,          // Title
+               true,           // Modal
+               true);          // use_separator
+
+       Gtk::Label label(message);
+       label.show();
+       dialog.get_vbox()->pack_start(label);
+
+       Glib::RefPtr<Gtk::TextBuffer> text_buffer(Gtk::TextBuffer::create());
+       text_buffer->set_text(text);
+       Gtk::TextView text_view(text_buffer);
+       text_view.show();
+
+       dialog.get_vbox()->pack_start(text_view);
 
+       dialog.add_button(Gtk::StockID("gtk-ok"),Gtk::RESPONSE_OK);
+       dialog.add_button(Gtk::StockID("gtk-cancel"),Gtk::RESPONSE_CANCEL);
+       dialog.set_default_response(Gtk::RESPONSE_OK);
 
+       //text_entry.signal_activate().connect(sigc::bind(sigc::mem_fun(dialog,&Gtk::Dialog::response),Gtk::RESPONSE_OK));
+       dialog.show();
+
+       if(dialog.run()!=Gtk::RESPONSE_OK)
+               return false;
+
+       text=text_buffer->get_text();
+
+       return true;
+}
 
 bool
 App::open(std::string filename)