From: gballintijn Date: Tue, 3 Feb 2009 00:50:23 +0000 (+0000) Subject: Allow the user to set the default foreground and background color X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=67b41b7fefe54700fa382d715ac94ab0c7f383e4;p=synfig.git Allow the user to set the default foreground and background color from the color dialog. git-svn-id: https://synfig.svn.sourceforge.net/svnroot/synfig@2340 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-studio/trunk/images/Makefile.am b/synfig-studio/trunk/images/Makefile.am index c108414..d15d25d 100644 --- a/synfig-studio/trunk/images/Makefile.am +++ b/synfig-studio/trunk/images/Makefile.am @@ -2,8 +2,8 @@ SYNFIG=synfig EXT=@imageext@ -EXTRA_DIST=installer_logo.sif installer_logo_osx.sif splash_screen.sifz splash_screen-0.61.08.sif splash_screen-0.61.07.sif about_icon.sif angle_icon.sif bline_icon.sif blinepoint_icon.sif bool_icon.sif canvas_icon.sif canvas_pointer_icon.sif children_icon.sif circle_icon.sif clear_redo_icon.sif clear_undo_icon.sif color_icon.sif curves_icon.sif draw_icon.sif duplicate_icon.sif encapsulate_icon.sif eyedrop_icon.sif fill_icon.sif gradient_icon.sif group_icon.sif info_icon.sif integer_icon.sif keyframe_icon.sif keyframe_lock_icon.sif layer_icon.sif list_icon.sif logo.sif meta_data_icon.sif mirror_icon.sif navigator_icon.sif normal_icon.sif pastecanvas_icon.sif polygon_icon.sif real_icon.sif rectangle_icon.sif rotate_icon.sif saveall_icon.sif scale_icon.sif segment_icon.sif select_all_child_layers_icon.sif sif_icon.sif sketch_icon.sif smooth_move_icon.sif string_icon.sif reset_colors_icon.sif swap_colors_icon.sif synfig_icon.sif synfig_icon.svg time_icon.sif time_track_icon.sif valuenode_icon.sif vector_icon.sif wallpaper.sif width_icon.sif zoom_icon.sif rename_icon.sif plant_icon.sif text_icon.sif polyline_icon.sif star_icon.sif -IMAGES=installer_logo.$(EXT) installer_logo_osx.$(EXT) mirror_icon.$(EXT) time_icon.$(EXT) time_track_icon.$(EXT) curves_icon.$(EXT) pastecanvas_icon.$(EXT) group_icon.$(EXT) clear_redo_icon.$(EXT) clear_undo_icon.$(EXT) navigator_icon.$(EXT) info_icon.$(EXT) zoom_icon.$(EXT) meta_data_icon.$(EXT) children_icon.$(EXT) keyframe_icon.$(EXT) reset_colors_icon.$(EXT) swap_colors_icon.$(EXT) rotate_icon.$(EXT) scale_icon.$(EXT) smooth_move_icon.$(EXT) width_icon.$(EXT) rectangle_icon.$(EXT) circle_icon.$(EXT) draw_icon.$(EXT) sketch_icon.$(EXT) fill_icon.$(EXT) normal_icon.$(EXT) select_all_child_layers_icon.$(EXT) sif_icon.$(EXT) synfig_icon.$(EXT) saveall_icon.$(EXT) bool_icon.$(EXT) integer_icon.$(EXT) angle_icon.$(EXT) segment_icon.$(EXT) blinepoint_icon.$(EXT) list_icon.$(EXT) canvas_pointer_icon.$(EXT) string_icon.$(EXT) eyedrop_icon.$(EXT) about_icon.$(EXT) splash_screen.$(EXT) canvas_icon.$(EXT) vector_icon.$(EXT) real_icon.$(EXT) color_icon.$(EXT) valuenode_icon.$(EXT) polygon_icon.$(EXT) bline_icon.$(EXT) layer_icon.$(EXT) duplicate_icon.$(EXT) encapsulate_icon.$(EXT) gradient_icon.$(EXT) keyframe_lock_all.$(EXT) keyframe_lock_past.$(EXT) keyframe_lock_future.$(EXT) keyframe_lock_none.$(EXT) rename_icon.$(EXT) plant_icon.$(EXT) text_icon.$(EXT) polyline_icon.$(EXT) star_icon.$(EXT) +EXTRA_DIST=installer_logo.sif installer_logo_osx.sif splash_screen.sifz splash_screen-0.61.08.sif splash_screen-0.61.07.sif about_icon.sif angle_icon.sif bline_icon.sif blinepoint_icon.sif bool_icon.sif canvas_icon.sif canvas_pointer_icon.sif children_icon.sif circle_icon.sif clear_redo_icon.sif clear_undo_icon.sif color_icon.sif curves_icon.sif draw_icon.sif duplicate_icon.sif encapsulate_icon.sif eyedrop_icon.sif fill_icon.sif gradient_icon.sif group_icon.sif info_icon.sif integer_icon.sif keyframe_icon.sif keyframe_lock_icon.sif layer_icon.sif list_icon.sif logo.sif meta_data_icon.sif mirror_icon.sif navigator_icon.sif normal_icon.sif pastecanvas_icon.sif polygon_icon.sif real_icon.sif rectangle_icon.sif rotate_icon.sif saveall_icon.sif scale_icon.sif segment_icon.sif select_all_child_layers_icon.sif sif_icon.sif sketch_icon.sif smooth_move_icon.sif string_icon.sif reset_colors_icon.sif swap_colors_icon.sif synfig_icon.sif synfig_icon.svg time_icon.sif time_track_icon.sif valuenode_icon.sif vector_icon.sif wallpaper.sif width_icon.sif zoom_icon.sif rename_icon.sif plant_icon.sif text_icon.sif polyline_icon.sif star_icon.sif set_bg_color.sif set_fg_color.sif +IMAGES=installer_logo.$(EXT) installer_logo_osx.$(EXT) mirror_icon.$(EXT) time_icon.$(EXT) time_track_icon.$(EXT) curves_icon.$(EXT) pastecanvas_icon.$(EXT) group_icon.$(EXT) clear_redo_icon.$(EXT) clear_undo_icon.$(EXT) navigator_icon.$(EXT) info_icon.$(EXT) zoom_icon.$(EXT) meta_data_icon.$(EXT) children_icon.$(EXT) keyframe_icon.$(EXT) reset_colors_icon.$(EXT) swap_colors_icon.$(EXT) rotate_icon.$(EXT) scale_icon.$(EXT) smooth_move_icon.$(EXT) width_icon.$(EXT) rectangle_icon.$(EXT) circle_icon.$(EXT) draw_icon.$(EXT) sketch_icon.$(EXT) fill_icon.$(EXT) normal_icon.$(EXT) select_all_child_layers_icon.$(EXT) sif_icon.$(EXT) synfig_icon.$(EXT) saveall_icon.$(EXT) bool_icon.$(EXT) integer_icon.$(EXT) angle_icon.$(EXT) segment_icon.$(EXT) blinepoint_icon.$(EXT) list_icon.$(EXT) canvas_pointer_icon.$(EXT) string_icon.$(EXT) eyedrop_icon.$(EXT) about_icon.$(EXT) splash_screen.$(EXT) canvas_icon.$(EXT) vector_icon.$(EXT) real_icon.$(EXT) color_icon.$(EXT) valuenode_icon.$(EXT) polygon_icon.$(EXT) bline_icon.$(EXT) layer_icon.$(EXT) duplicate_icon.$(EXT) encapsulate_icon.$(EXT) gradient_icon.$(EXT) keyframe_lock_all.$(EXT) keyframe_lock_past.$(EXT) keyframe_lock_future.$(EXT) keyframe_lock_none.$(EXT) rename_icon.$(EXT) plant_icon.$(EXT) text_icon.$(EXT) polyline_icon.$(EXT) star_icon.$(EXT) set_bg_color.$(EXT) set_fg_color.$(EXT) MAINTAINERCLEANFILES=Makefile.in CLEANFILES=$(IMAGES) images.nsh unimages.nsh installer_logo.bmp sif_icon.ico synfig_icon.ico icons.nsh unicons.nsh diff --git a/synfig-studio/trunk/images/set_bg_color.sif b/synfig-studio/trunk/images/set_bg_color.sif new file mode 100644 index 0000000..82eab68 --- /dev/null +++ b/synfig-studio/trunk/images/set_bg_color.sif @@ -0,0 +1,306 @@ + + + Synfig Studio Save as Default Foreground Color + Placed in the Public Domain in 2009 by Carlos López (genete) + + + + + + + + + + + + + + + + + + + 0.000000 + 0.000000 + 0.000000 + 1.000000 + + + + + 0.0000000000 + 0.0000000000 + + + + + + + + + + + + + + + + + + + + + + + + -2.5000000000 + -1.0000000000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1.0000000000 + -1.0000000000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1.0000000000 + 2.5000000000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -2.5000000000 + 2.5000000000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.960827 + 0.960701 + 0.960701 + 1.000000 + + + + + -1.0000000000 + 1.0000000000 + + + + + 2.5000000000 + -2.5000000000 + + + + + + + + + + + + + + + + + + + + + + 0.000000 + 0.000000 + 0.000000 + 1.000000 + + + + + 0.2000000030 + -0.2000000030 + + + + + 0.1000000015 + 0.1000000015 + + + + + + + + + + diff --git a/synfig-studio/trunk/images/set_fg_color.sif b/synfig-studio/trunk/images/set_fg_color.sif new file mode 100644 index 0000000..8694f4e --- /dev/null +++ b/synfig-studio/trunk/images/set_fg_color.sif @@ -0,0 +1,306 @@ + + + Synfig Studio Save as Default Foreground Color + Placed in the Public Domain in 2009 by Carlos López (genete) + + + + + + + + + + + + + + + + + + + 1.000000 + 1.000000 + 1.000000 + 1.000000 + + + + + 0.0000000000 + 0.0000000000 + + + + + + + + + + + + + + + + + + + + + + + + -1.0000000000 + -2.5000000000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2.5000000000 + -2.5000000000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2.5000000000 + 1.0000000000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -1.0000000000 + 1.0000000000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.000000 + 0.000000 + 0.000000 + 1.000000 + + + + + -2.5000000000 + 2.5000000000 + + + + + 1.0000000000 + -1.0000000000 + + + + + + + + + + + + + + + + + + + + + + 0.000000 + 0.000000 + 0.000000 + 1.000000 + + + + + 0.2000000030 + -0.2000000030 + + + + + 0.1000000015 + 0.1000000015 + + + + + + + + + + diff --git a/synfig-studio/trunk/src/gtkmm/dialog_color.cpp b/synfig-studio/trunk/src/gtkmm/dialog_color.cpp index 1903ec8..4d98e83 100644 --- a/synfig-studio/trunk/src/gtkmm/dialog_color.cpp +++ b/synfig-studio/trunk/src/gtkmm/dialog_color.cpp @@ -72,6 +72,27 @@ Dialog_Color::Dialog_Color(): { set_type_hint(Gdk::WINDOW_TYPE_HINT_UTILITY); // Setup the buttons + + Gtk::Image *icon; + + Gtk::Button *set_fg_color(manage(new class Gtk::Button())); + icon = manage(new Gtk::Image(Gtk::StockID("synfig-set_fg_color"), Gtk::IconSize::IconSize(Gtk::ICON_SIZE_BUTTON))); + set_fg_color->add(*icon); + icon->show(); + tooltips.set_tip(*set_fg_color, _("Set as Foreground")); + set_fg_color->show(); + add_action_widget(*set_fg_color, 4); + set_fg_color->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Color::on_set_fg_pressed)); + + Gtk::Button *set_bg_color(manage(new class Gtk::Button())); + icon = manage(new Gtk::Image(Gtk::StockID("synfig-set_bg_color"), Gtk::IconSize::IconSize(Gtk::ICON_SIZE_BUTTON))); + set_bg_color->add(*icon); + icon->show(); + tooltips.set_tip(*set_bg_color, _("Set as Background")); + set_bg_color->show(); + add_action_widget(*set_bg_color, 3); + set_bg_color->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Color::on_set_bg_pressed)); + //Gtk::Button *ok_button(manage(new class Gtk::Button(Gtk::StockID("gtk-ok")))); //ok_button->show(); //add_action_widget(*ok_button,2); @@ -131,6 +152,22 @@ Dialog_Color::on_apply_pressed() } void +Dialog_Color::on_set_fg_pressed() +{ + busy_=true; + synfigapp::Main::set_foreground_color(get_color()); + busy_=false; +} + +void +Dialog_Color::on_set_bg_pressed() +{ + busy_=true; + synfigapp::Main::set_background_color(get_color()); + busy_=false; +} + +void Dialog_Color::on_color_changed() { busy_=true; diff --git a/synfig-studio/trunk/src/gtkmm/dialog_color.h b/synfig-studio/trunk/src/gtkmm/dialog_color.h index 3d0025a..960f414 100644 --- a/synfig-studio/trunk/src/gtkmm/dialog_color.h +++ b/synfig-studio/trunk/src/gtkmm/dialog_color.h @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -65,12 +66,15 @@ class Widget_Color; class Dialog_Color : public Gtk::Dialog { DialogSettings dialog_settings; + Gtk::Tooltips tooltips; sigc::signal signal_edited_; //sigc::signal signal_apply_; bool on_close_pressed(); void on_apply_pressed(); + void on_set_fg_pressed(); + void on_set_bg_pressed(); void on_color_changed(); Widget_ColorEdit* widget_color; diff --git a/synfig-studio/trunk/src/gtkmm/iconcontroller.cpp b/synfig-studio/trunk/src/gtkmm/iconcontroller.cpp index 58b8d89..6fa4e69 100644 --- a/synfig-studio/trunk/src/gtkmm/iconcontroller.cpp +++ b/synfig-studio/trunk/src/gtkmm/iconcontroller.cpp @@ -185,6 +185,9 @@ IconController::IconController(const synfig::String& /*basepath*/) INIT_STOCK_ICON(keyframe_lock_future,"keyframe_lock_future."IMAGE_EXT,_("Future Keyframes Locked")); INIT_STOCK_ICON(keyframe_lock_none,"keyframe_lock_none."IMAGE_EXT,_("No Keyframes Locked")); + INIT_STOCK_ICON(set_fg_color,"set_fg_color."IMAGE_EXT,_("Set as Foreground")); + INIT_STOCK_ICON(set_bg_color,"set_bg_color."IMAGE_EXT,_("Set as Background")); + INIT_STOCK_ICON_CLONE(cvs_add,"gtk-add",_("CVS Add")); INIT_STOCK_ICON_CLONE(cvs_update,"gtk-open",_("CVS Update")); INIT_STOCK_ICON_CLONE(cvs_commit,"gtk-save",_("CVS Commit"));