From: Nikita Kitaev Date: Mon, 29 Mar 2010 21:32:03 +0000 (-0700) Subject: Change actions when clicking a color in the palette X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=d86ffd46be8329ee900cc140fff056dcc68fca1b;p=synfig.git Change actions when clicking a color in the palette Left click sets fill color and middle click sets outline color --- diff --git a/synfig-studio/src/gtkmm/mod_palette/dock_paledit.cpp b/synfig-studio/src/gtkmm/mod_palette/dock_paledit.cpp index 03553e0..718bdee 100644 --- a/synfig-studio/src/gtkmm/mod_palette/dock_paledit.cpp +++ b/synfig-studio/src/gtkmm/mod_palette/dock_paledit.cpp @@ -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)); } diff --git a/synfig-studio/src/gtkmm/mod_palette/dock_paledit.h b/synfig-studio/src/gtkmm/mod_palette/dock_paledit.h index 4c1ef2e..cd825ee 100644 --- a/synfig-studio/src/gtkmm/mod_palette/dock_paledit.h +++ b/synfig-studio/src/gtkmm/mod_palette/dock_paledit.h @@ -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: diff --git a/synfig-studio/src/gtkmm/widget_color.cpp b/synfig-studio/src/gtkmm/widget_color.cpp index 2e009b1..1c53b5e 100644 --- a/synfig-studio/src/gtkmm/widget_color.cpp +++ b/synfig-studio/src/gtkmm/widget_color.cpp @@ -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; diff --git a/synfig-studio/src/gtkmm/widget_color.h b/synfig-studio/src/gtkmm/widget_color.h index 5763bc0..14e3db1 100644 --- a/synfig-studio/src/gtkmm/widget_color.h +++ b/synfig-studio/src/gtkmm/widget_color.h @@ -52,14 +52,16 @@ class Widget_Color : public Gtk::DrawingArea synfig::Color color; sigc::signal signal_activate_; - sigc::signal signal_secondary_; + sigc::signal signal_middle_click_; + sigc::signal signal_right_click_; protected: public: sigc::signal& signal_activate() { return signal_activate_; } sigc::signal& signal_clicked() { return signal_activate_; } - sigc::signal& signal_secondary() { return signal_secondary_; } + sigc::signal& signal_middle_click() { return signal_middle_click_; } + sigc::signal& signal_right_click() { return signal_right_click_; } void set_value(const synfig::Color &data); const synfig::Color &get_value();