aboutsummaryrefslogtreecommitdiffstats
path: root/src/gui/MachinaGUI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/MachinaGUI.cpp')
-rw-r--r--src/gui/MachinaGUI.cpp41
1 files changed, 27 insertions, 14 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)
{