diff options
-rw-r--r-- | src/gui/MachinaGUI.cpp | 41 | ||||
-rw-r--r-- | src/gui/MachinaGUI.hpp | 9 | ||||
-rw-r--r-- | src/gui/machina.ui | 90 |
3 files changed, 81 insertions, 59 deletions
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<machina::Engine> 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<machina::Engine> 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<machina::Engine> 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<machina::Engine> 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<machina::Machine> machine); void mutate(SPtr<machina::Machine> 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 @@ <interface> <requires lib="gtk+" version="2.16"/> <!-- interface-naming-policy toplevel-contextual --> - <object class="GtkAdjustment" id="bpm_adjustment"> - <property name="lower">1</property> - <property name="upper">480</property> - <property name="value">120</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> - </object> <object class="GtkRadioAction" id="record_action"> <property name="stock_id">gtk-media-record</property> <property name="draw_as_radio">True</property> @@ -72,6 +65,13 @@ along with Machina; if not, write to the Free Software Foundation, Inc., </object> </child> </object> + <object class="GtkAdjustment" id="bpm_adjustment"> + <property name="lower">1</property> + <property name="upper">480</property> + <property name="value">120</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> <object class="GtkDialog" id="help_dialog"> <property name="can_focus">False</property> <property name="border_width">8</property> @@ -343,6 +343,47 @@ selection to many nodes.</property> </object> </child> <child> + <object class="GtkSeparatorMenuItem" id="separatormenuitem3"> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="zoom_in_menuitem"> + <property name="label">gtk-zoom-in</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="use_underline">True</property> + <property name="use_stock">True</property> + <accelerator key="plus" signal="activate" modifiers="GDK_CONTROL_MASK"/> + <accelerator key="equal" signal="activate" modifiers="GDK_CONTROL_MASK"/> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="zoom_out_menuitem"> + <property name="label">gtk-zoom-out</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="use_underline">True</property> + <property name="use_stock">True</property> + <accelerator key="minus" signal="activate" modifiers="GDK_CONTROL_MASK"/> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="zoom_normal_menuitem"> + <property name="label">gtk-zoom-100</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="use_underline">True</property> + <property name="use_stock">True</property> + <accelerator key="0" signal="activate" modifiers="GDK_CONTROL_MASK"/> + </object> + </child> + <child> <object class="GtkSeparatorMenuItem" id="separatormenuitem1"> <property name="use_action_appearance">False</property> <property name="visible">True</property> @@ -600,41 +641,6 @@ selection to many nodes.</property> </packing> </child> <child> - <object class="GtkToolButton" id="zoom_normal_but"> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="tooltip_text" translatable="yes">Normal size</property> - <property name="stock_id">gtk-zoom-100</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="zoom_full_but"> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="tooltip_text" translatable="yes">Zoom to contents</property> - <property name="stock_id">gtk-zoom-fit</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkSeparatorToolItem" id="separatortoolitem5"> - <property name="visible">True</property> - <property name="can_focus">False</property> - </object> - <packing> - <property name="expand">False</property> - </packing> - </child> - <child> <object class="GtkToolItem" id="toolitem2"> <property name="use_action_appearance">False</property> <property name="visible">True</property> |