From f111891cfbc183339e3119d5ff3718184cdedd21 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 14 Jan 2013 00:08:07 +0000 Subject: Move zoom stuff to menu. git-svn-id: http://svn.drobilla.net/lad/trunk/machina@4973 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/MachinaGUI.cpp | 41 +++++++++++++++-------- src/gui/MachinaGUI.hpp | 9 +++-- src/gui/machina.ui | 90 +++++++++++++++++++++++++++----------------------- 3 files changed, 81 insertions(+), 59 deletions(-) (limited to 'src/gui') diff --git a/src/gui/MachinaGUI.cpp b/src/gui/MachinaGUI.cpp index 6272807..5057f5a 100644 --- a/src/gui/MachinaGUI.cpp +++ b/src/gui/MachinaGUI.cpp @@ -62,6 +62,9 @@ MachinaGUI::MachinaGUI(SPtr engine) xml->get_widget("save_menuitem", _menu_file_save); xml->get_widget("save_as_menuitem", _menu_file_save_as); xml->get_widget("quit_menuitem", _menu_file_quit); + xml->get_widget("zoom_in_menuitem", _menu_zoom_in); + xml->get_widget("zoom_out_menuitem", _menu_zoom_out); + xml->get_widget("zoom_normal_menuitem", _menu_zoom_normal); xml->get_widget("arrange_menuitem", _menu_view_arrange); xml->get_widget("import_midi_menuitem", _menu_import_midi); xml->get_widget("export_midi_menuitem", _menu_export_midi); @@ -78,8 +81,6 @@ MachinaGUI::MachinaGUI(SPtr engine) xml->get_widget("play_but", _play_button); xml->get_widget("record_but", _record_button); xml->get_widget("step_record_but", _step_record_button); - xml->get_widget("zoom_normal_but", _zoom_normal_button); - xml->get_widget("zoom_full_but", _zoom_full_button); xml->get_widget("chain_but", _chain_button); xml->get_widget("fan_but", _fan_button); xml->get_widget("load_target_but", _load_target_button); @@ -110,12 +111,6 @@ MachinaGUI::MachinaGUI(SPtr engine) _step_record_button->signal_toggled().connect( sigc::mem_fun(this, &MachinaGUI::step_record_toggled)); - _zoom_normal_button->signal_clicked().connect(sigc::bind( - sigc::mem_fun(this, &MachinaGUI::zoom), 1.0)); - - _zoom_full_button->signal_clicked().connect( - sigc::mem_fun(_canvas.get(), &MachinaCanvas::zoom_full)); - _chain_button->signal_toggled().connect( sigc::mem_fun(this, &MachinaGUI::chain_toggled)); _fan_button->signal_toggled().connect( @@ -129,6 +124,12 @@ MachinaGUI::MachinaGUI(SPtr engine) sigc::mem_fun(this, &MachinaGUI::menu_file_save_as)); _menu_file_quit->signal_activate().connect( sigc::mem_fun(this, &MachinaGUI::menu_file_quit)); + _menu_zoom_in->signal_activate().connect( + sigc::mem_fun(this, &MachinaGUI::on_zoom_in)); + _menu_zoom_out->signal_activate().connect( + sigc::mem_fun(this, &MachinaGUI::on_zoom_out)); + _menu_zoom_normal->signal_activate().connect( + sigc::mem_fun(this, &MachinaGUI::on_zoom_normal)); _menu_view_arrange->signal_activate().connect( sigc::mem_fun(this, &MachinaGUI::arrange)); _menu_import_midi->signal_activate().connect( @@ -401,12 +402,6 @@ MachinaGUI::tempo_changed() _engine->set_bpm(_bpm_spinbutton->get_value_as_int()); } -void -MachinaGUI::zoom(double z) -{ - _canvas->set_zoom(z); -} - /** Update the sensitivity status of menus to reflect the present. */ void @@ -616,6 +611,24 @@ MachinaGUI::show_toolbar_toggled() _toolbar->hide(); } +void +MachinaGUI::on_zoom_in() +{ + _canvas->set_font_size(_canvas->get_font_size() + 1.0); +} + +void +MachinaGUI::on_zoom_out() +{ + _canvas->set_font_size(_canvas->get_font_size() - 1.0); +} + +void +MachinaGUI::on_zoom_normal() +{ + _canvas->set_scale(1.0, _canvas->get_default_font_size()); +} + static void show_node_label(GanvNode* node, void* data) { diff --git a/src/gui/MachinaGUI.hpp b/src/gui/MachinaGUI.hpp index d794fbb..e917ff8 100644 --- a/src/gui/MachinaGUI.hpp +++ b/src/gui/MachinaGUI.hpp @@ -85,6 +85,9 @@ protected: void menu_import_midi(); void menu_export_midi(); void menu_export_graphviz(); + void on_zoom_in(); + void on_zoom_out(); + void on_zoom_normal(); void show_toolbar_toggled(); void show_labels_toggled(); void menu_help_about(); @@ -94,7 +97,6 @@ protected: void random_mutation(SPtr machine); void mutate(SPtr machine, unsigned mutation); - void zoom(double z); void update_toolbar(); void rebuild_canvas(); @@ -142,6 +144,9 @@ protected: Gtk::MenuItem* _menu_file_save; Gtk::MenuItem* _menu_file_save_as; Gtk::MenuItem* _menu_file_quit; + Gtk::MenuItem* _menu_zoom_in; + Gtk::MenuItem* _menu_zoom_out; + Gtk::MenuItem* _menu_zoom_normal; Gtk::MenuItem* _menu_view_arrange; Gtk::MenuItem* _menu_import_midi; Gtk::MenuItem* _menu_export_midi; @@ -160,8 +165,6 @@ protected: Gtk::ToggleToolButton* _play_button; Gtk::ToggleToolButton* _record_button; Gtk::ToggleToolButton* _step_record_button; - Gtk::ToolButton* _zoom_normal_button; - Gtk::ToolButton* _zoom_full_button; Gtk::RadioButton* _chain_button; Gtk::RadioButton* _fan_button; Gtk::ToolButton* _load_target_button; diff --git a/src/gui/machina.ui b/src/gui/machina.ui index f84bd7c..62d3459 100644 --- a/src/gui/machina.ui +++ b/src/gui/machina.ui @@ -2,13 +2,6 @@ - - 1 - 480 - 120 - 1 - 10 - gtk-media-record True @@ -72,6 +65,13 @@ along with Machina; if not, write to the Free Software Foundation, Inc., + + 1 + 480 + 120 + 1 + 10 + False 8 @@ -342,6 +342,47 @@ selection to many nodes. + + + False + True + False + + + + + gtk-zoom-in + False + True + False + True + True + + + + + + + gtk-zoom-out + False + True + False + True + True + + + + + + gtk-zoom-100 + False + True + False + True + True + + + False @@ -599,41 +640,6 @@ selection to many nodes. False - - - False - True - False - Normal size - gtk-zoom-100 - - - False - True - - - - - False - True - False - Zoom to contents - gtk-zoom-fit - - - False - True - - - - - True - False - - - False - - False -- cgit v1.2.1