From: Carlos Lopez Date: Mon, 29 Jun 2009 10:38:24 +0000 (+0200) Subject: Add snap grid toggle button with proper icon. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=d845287cb7b04975efb055cbebcd94074b9b42ca;p=synfig.git Add snap grid toggle button with proper icon. Add proper show grid icon. --- diff --git a/synfig-studio/trunk/images/Makefile.am b/synfig-studio/trunk/images/Makefile.am index 3053ca9..ed22bb7 100644 --- a/synfig-studio/trunk/images/Makefile.am +++ b/synfig-studio/trunk/images/Makefile.am @@ -80,7 +80,9 @@ EXTRA_DIST = \ duck_tangent_icon.sif \ duck_radius_icon.sif \ duck_width_icon.sif \ - duck_angle_icon.sif + duck_angle_icon.sif \ + show_grid_icon.sif \ + snap_grid_icon.sif IMAGES = \ @@ -158,7 +160,9 @@ IMAGES = \ duck_tangent_icon.$(EXT) \ duck_radius_icon.$(EXT) \ duck_width_icon.$(EXT) \ - duck_angle_icon.$(EXT) + duck_angle_icon.$(EXT) \ + show_grid_icon.$(EXT) \ + snap_grid_icon.$(EXT) MAINTAINERCLEANFILES = \ diff --git a/synfig-studio/trunk/images/show_grid_icon.sif b/synfig-studio/trunk/images/show_grid_icon.sif new file mode 100644 index 0000000..8799241 --- /dev/null +++ b/synfig-studio/trunk/images/show_grid_icon.sif @@ -0,0 +1,1155 @@ + + + Show Grig Icon + Copyright 2009 Carlos López. Released under GNU Public License published by the Free Software Foundation version 2.0 of the License or any later version. + + + + + + + + + + + + + + + + + + + 0.000000 + 0.000000 + 0.000000 + 1.000000 + + + + + 0.0000000000 + 0.0000000000 + + + + + + + + + + + + + + + + + + + + + + + + -3.1952149868 + 0.7988043427 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3.1952171326 + 0.7988043427 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.000000 + 0.000000 + 0.000000 + 1.000000 + + + + + 0.0000000000 + 0.0000000000 + + + + + + + + + + + + + + + + + + + + + + + + -3.1952161789 + -0.7988040447 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3.1952159405 + -0.7988040447 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.000000 + 0.000000 + 0.000000 + 1.000000 + + + + + 0.0000000000 + 0.0000000000 + + + + + + + + + + + + + + + + + + + + + + + + -3.1952161789 + -2.3964121342 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3.1952159405 + -2.3964121342 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.000000 + 0.000000 + 0.000000 + 1.000000 + + + + + 0.0000000000 + 0.0000000000 + + + + + + + + + + + + + + + + + + + + + + + + -2.3964121342 + 3.1952161789 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -2.3964121342 + -3.1952161789 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.000000 + 0.000000 + 0.000000 + 1.000000 + + + + + 0.0000000000 + 0.0000000000 + + + + + + + + + + + + + + + + + + + + + + + + -0.7988041639 + 3.1952161789 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -0.7988041639 + -3.1952161789 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.000000 + 0.000000 + 0.000000 + 1.000000 + + + + + 0.0000000000 + 0.0000000000 + + + + + + + + + + + + + + + + + + + + + + + + 0.7988039255 + 3.1952161789 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.7988039255 + -3.1952161789 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.000000 + 0.000000 + 0.000000 + 1.000000 + + + + + 0.0000000000 + 0.0000000000 + + + + + + + + + + + + + + + + + + + + + + + + 2.3964118958 + 3.1952161789 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2.3964118958 + -3.1952161789 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.000000 + 0.000000 + 0.000000 + 1.000000 + + + + + 0.0000000000 + 0.0000000000 + + + + + + + + + + + + + + + + + + + + + + + + -3.1952161789 + 2.3964121342 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3.1952159405 + 2.3964121342 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/synfig-studio/trunk/images/snap_grid_icon.sif b/synfig-studio/trunk/images/snap_grid_icon.sif new file mode 100644 index 0000000..96c5613 --- /dev/null +++ b/synfig-studio/trunk/images/snap_grid_icon.sif @@ -0,0 +1,1155 @@ + + + Snap Grig Icon + Copyright 2009 Carlos López. Released under GNU Public License published by the Free Software Foundation version 2.0 of the License or any later version. + + + + + + + + + + + + + + + + + + + 0.100000 + 0.100000 + 0.100000 + 1.000000 + + + + + 0.0000000000 + 0.0000000000 + + + + + + + + + + + + + + + + + + + + + + + + -3.1952149868 + 0.7988043427 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3.1952171326 + 0.7988043427 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.100000 + 0.100000 + 0.100000 + 1.000000 + + + + + 0.0000000000 + 0.0000000000 + + + + + + + + + + + + + + + + + + + + + + + + -3.1952161789 + -2.3964121342 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3.1952159405 + -2.3964121342 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.100000 + 0.100000 + 0.100000 + 1.000000 + + + + + 0.0000000000 + 0.0000000000 + + + + + + + + + + + + + + + + + + + + + + + + -2.3964121342 + 3.1952161789 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -2.3964121342 + -3.1952161789 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.100000 + 0.100000 + 0.100000 + 1.000000 + + + + + 0.0000000000 + 0.0000000000 + + + + + + + + + + + + + + + + + + + + + + + + -0.7988041639 + 3.1952161789 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -0.7988041639 + -3.1952161789 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.100000 + 0.100000 + 0.100000 + 1.000000 + + + + + 0.0000000000 + 0.0000000000 + + + + + + + + + + + + + + + + + + + + + + + + 2.3964118958 + 3.1952161789 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2.3964118958 + -3.1952161789 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.100000 + 0.100000 + 0.100000 + 1.000000 + + + + + 0.0000000000 + 0.0000000000 + + + + + + + + + + + + + + + + + + + + + + + + -3.1952161789 + 2.3964121342 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3.1952159405 + 2.3964121342 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1.000000 + 0.000000 + 0.000000 + 1.000000 + + + + + 0.0000000000 + 0.0000000000 + + + + + + + + + + + + + + + + + + + + + + + + -3.1952161789 + -0.7988040447 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3.1952159405 + -0.7988040447 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1.000000 + 0.000000 + 0.000000 + 1.000000 + + + + + 0.0000000000 + 0.0000000000 + + + + + + + + + + + + + + + + + + + + + + + + 0.7988039255 + 3.1952161789 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.7988039255 + -3.1952161789 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/synfig-studio/trunk/src/gtkmm/canvasview.cpp b/synfig-studio/trunk/src/gtkmm/canvasview.cpp index ab500e4..6fbf6d5 100644 --- a/synfig-studio/trunk/src/gtkmm/canvasview.cpp +++ b/synfig-studio/trunk/src/gtkmm/canvasview.cpp @@ -710,6 +710,7 @@ CanvasView::CanvasView(etl::loose_handle instance,etl::handleshow(); - // Set up the show grid check button - show_grid = Gtk::manage(new class Gtk::CheckButton()); + // Set up the show grid toggle button + show_grid = Gtk::manage(new class Gtk::ToggleButton()); show_grid->set_active(work_area->grid_status()); - Gtk::Image *icon = manage(new Gtk::Image(Gtk::Stock::REMOVE, Gtk::IconSize::from_name("synfig-small_icon"))); + Gtk::Image *icon = manage(new Gtk::Image(Gtk::StockID("synfig-toggle_show_grid"), Gtk::IconSize::from_name("synfig-small_icon"))); icon->set_padding(0, 0); icon->show(); show_grid->add(*icon); show_grid->signal_toggled().connect( sigc::mem_fun(*this, &studio::CanvasView::toggle_show_grid)); tooltips.set_tip(*show_grid, _("Show grid when enabled")); + show_grid->set_relief(Gtk::RELIEF_NONE); show_grid->show(); + // Set up the snap to grid toggle button + snap_grid = Gtk::manage(new class Gtk::ToggleButton()); + snap_grid->set_active(work_area->grid_status()); + Gtk::Image *icon2 = manage(new Gtk::Image(Gtk::StockID("synfig-toggle_snap_grid"), Gtk::IconSize::from_name("synfig-small_icon"))); + icon2->set_padding(0, 0); + icon2->show(); + snap_grid->add(*icon2); + snap_grid->signal_toggled().connect( + sigc::mem_fun(*this, &studio::CanvasView::toggle_snap_grid)); + tooltips.set_tip(*snap_grid, _("snap grid when enabled")); + snap_grid->set_relief(Gtk::RELIEF_NONE); + snap_grid->show(); + + displaybar->attach(*toggleducksdial, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK); displaybar->attach(*separator1, 1, 2, 0, 1, Gtk::FILL, Gtk::FILL); displaybar->attach(*resolutiondial, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK); displaybar->attach(*separator2, 3, 4, 0, 1, Gtk::FILL, Gtk::FILL); displaybar->attach(*quality_spin, 4, 5, 0, 1, Gtk::SHRINK, Gtk::SHRINK); displaybar->attach(*show_grid, 5, 6, 0, 1, Gtk::SHRINK, Gtk::SHRINK); + displaybar->attach(*snap_grid, 6, 7, 0, 1, Gtk::SHRINK, Gtk::SHRINK); displaybar->show(); @@ -1493,7 +1510,7 @@ CanvasView::init_menus() grid_snap_toggle = Gtk::ToggleAction::create("toggle-grid-snap", _("Snap to Grid")); grid_snap_toggle->set_active(work_area->get_grid_snap()); - action_group->add(grid_snap_toggle, sigc::mem_fun(*work_area, &studio::WorkArea::toggle_grid_snap)); + action_group->add(grid_snap_toggle, sigc::mem_fun(*this, &studio::CanvasView::toggle_snap_grid)); action = Gtk::ToggleAction::create("toggle-guide-show", _("Show Guides")); action->set_active(work_area->get_show_guides()); @@ -3241,6 +3258,21 @@ CanvasView::toggle_show_grid() toggling_show_grid=false; } +void +CanvasView::toggle_snap_grid() +{ + if(toggling_snap_grid) + return; + toggling_snap_grid=true; + work_area->toggle_grid_snap(); + // Update the toggle grid snap action + set_grid_snap_toggle(work_area->get_grid_snap()); + // Update the toggle grid snap check button + snap_grid->set_active(work_area->get_grid_snap()); + toggling_snap_grid=false; +} + + void CanvasView::on_dirty_preview() diff --git a/synfig-studio/trunk/src/gtkmm/canvasview.h b/synfig-studio/trunk/src/gtkmm/canvasview.h index 27cc89f..1ac0991 100644 --- a/synfig-studio/trunk/src/gtkmm/canvasview.h +++ b/synfig-studio/trunk/src/gtkmm/canvasview.h @@ -276,8 +276,10 @@ private: Gtk::Adjustment quality_adjustment_; Gtk::SpinButton *quality_spin; bool updating_quality_; - Gtk::CheckButton *show_grid; + Gtk::ToggleButton *show_grid; + Gtk::ToggleButton *snap_grid; bool toggling_show_grid; + bool toggling_snap_grid; //! Shows current time and allows edition Widget_Time *current_time_widget; void on_current_time_widget_changed(); @@ -441,6 +443,7 @@ private: void toggle_low_res_pixel_flag(); void set_quality(int x); void toggle_show_grid(); + void toggle_snap_grid(); /* -- ** -- P U B L I C M E T H O D S ----------------------------------------- diff --git a/synfig-studio/trunk/src/gtkmm/iconcontroller.cpp b/synfig-studio/trunk/src/gtkmm/iconcontroller.cpp index b63db43..1ee965d 100644 --- a/synfig-studio/trunk/src/gtkmm/iconcontroller.cpp +++ b/synfig-studio/trunk/src/gtkmm/iconcontroller.cpp @@ -200,6 +200,9 @@ IconController::IconController(const synfig::String& /*basepath*/) INIT_STOCK_ICON(toggle_duck_width,"duck_width_icon."IMAGE_EXT,_("Toogle width ducks")); INIT_STOCK_ICON(toggle_duck_angle,"duck_angle_icon."IMAGE_EXT,_("Toogle angle ducks")); + INIT_STOCK_ICON(toggle_show_grid,"show_grid_icon."IMAGE_EXT,_("Toggle show grid")); + INIT_STOCK_ICON(toggle_snap_grid,"snap_grid_icon."IMAGE_EXT,_("Toggle snap grid")); + 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"));