Change actions when clicking a color in the palette
authorNikita Kitaev <nikitakit@gmail.com>
Mon, 29 Mar 2010 21:32:03 +0000 (14:32 -0700)
committerCarlos Lopez <genetita@gmail.com>
Wed, 14 Apr 2010 16:36:42 +0000 (18:36 +0200)
Left click sets fill color and middle click sets outline color

synfig-studio/src/gtkmm/mod_palette/dock_paledit.cpp
synfig-studio/src/gtkmm/mod_palette/dock_paledit.h
synfig-studio/src/gtkmm/widget_color.cpp
synfig-studio/src/gtkmm/widget_color.h

index 03553e0..718bdee 100644 (file)
@@ -261,11 +261,17 @@ Dock_PalEdit::refresh()
                widget_color->set_size_request(12,12);
                widget_color->signal_activate().connect(
                        sigc::bind(
-                               sigc::mem_fun(*this,&studio::Dock_PalEdit::select_color),
+                               sigc::mem_fun(*this,&studio::Dock_PalEdit::select_fill_color),
                                i
                        )
                );
-               widget_color->signal_secondary().connect(
+               widget_color->signal_middle_click().connect(
+                       sigc::bind(
+                               sigc::mem_fun(*this,&studio::Dock_PalEdit::select_outline_color),
+                               i
+                       )
+               );
+               widget_color->signal_right_click().connect(
                        sigc::bind(
                                sigc::mem_fun(*this,&studio::Dock_PalEdit::show_menu),
                                i
@@ -294,7 +300,13 @@ Dock_PalEdit::edit_color(int i)
 }
 
 void
-Dock_PalEdit::select_color(int i)
+Dock_PalEdit::select_fill_color(int i)
+{
+       synfigapp::Main::set_fill_color(get_color(i));
+}
+
+void
+Dock_PalEdit::select_outline_color(int i)
 {
        synfigapp::Main::set_outline_color(get_color(i));
 }
index 4c1ef2e..cd825ee 100644 (file)
@@ -87,7 +87,8 @@ private:
        void set_color(synfig::Color x, int i);
        void erase_color(int i);
 
-       void select_color(int i);
+       void select_fill_color(int i);
+       void select_outline_color(int i);
        synfig::Color get_color(int i)const;
        void edit_color(int i);
 public:
index 2e009b1..1c53b5e 100644 (file)
@@ -168,9 +168,14 @@ Widget_Color::on_event(GdkEvent *event)
                        signal_activate_();
                        return true;
                }
+               if(event->button.button==2)
+               {
+                       signal_middle_click_();
+                       return true;
+               }
                if(event->button.button==3)
                {
-                       signal_secondary_();
+                       signal_right_click_();
                        return true;
                }
                break;
index 5763bc0..14e3db1 100644 (file)
@@ -52,14 +52,16 @@ class Widget_Color : public Gtk::DrawingArea
        synfig::Color color;
 
        sigc::signal<void> signal_activate_;
-       sigc::signal<void> signal_secondary_;
+       sigc::signal<void> signal_middle_click_;
+       sigc::signal<void> signal_right_click_;
 
 protected:
 
 public:
        sigc::signal<void>& signal_activate() { return signal_activate_; }
        sigc::signal<void>& signal_clicked() { return signal_activate_; }
-       sigc::signal<void>& signal_secondary() { return signal_secondary_; }
+       sigc::signal<void>& signal_middle_click() { return signal_middle_click_; }
+       sigc::signal<void>& signal_right_click() { return signal_right_click_; }
 
        void set_value(const synfig::Color &data);
        const synfig::Color &get_value();