From 11017eeacd3277773707d53093725c01f2301772 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 16 Mar 2011 05:09:19 +0000 Subject: Font-based sizing (implement ticket #374). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3099 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/PatchWindow.cpp | 31 ++++++++++++++++++++++++++ src/gui/PatchWindow.hpp | 6 +++++ src/gui/ingen_gui.glade | 59 ++++++++++++++++++++++++++++++++++++++++--------- wscript | 2 +- 4 files changed, 87 insertions(+), 11 deletions(-) diff --git a/src/gui/PatchWindow.cpp b/src/gui/PatchWindow.cpp index a928b315..adbfc933 100644 --- a/src/gui/PatchWindow.cpp +++ b/src/gui/PatchWindow.cpp @@ -87,6 +87,9 @@ PatchWindow::PatchWindow(BaseObjectType* cobject, const Glib::RefPtrget_widget("patch_fullscreen_menuitem", _menu_fullscreen); xml->get_widget("patch_human_names_menuitem", _menu_human_names); xml->get_widget("patch_show_port_names_menuitem", _menu_show_port_names); + xml->get_widget("patch_zoom_in_menuitem", _menu_zoom_in); + xml->get_widget("patch_zoom_out_menuitem", _menu_zoom_out); + xml->get_widget("patch_zoom_normal_menuitem", _menu_zoom_normal); xml->get_widget("patch_status_bar_menuitem", _menu_show_status_bar); xml->get_widget("patch_arrange_menuitem", _menu_arrange); xml->get_widget("patch_view_messages_window_menuitem", _menu_view_messages_window); @@ -135,6 +138,14 @@ PatchWindow::PatchWindow(BaseObjectType* cobject, const Glib::RefPtrsignal_activate().connect( sigc::mem_fun(this, &PatchWindow::event_arrange)); + _menu_quit->signal_activate().connect( + sigc::mem_fun(this, &PatchWindow::event_quit)); + _menu_zoom_in->signal_activate().connect( + sigc::mem_fun(this, &PatchWindow::event_zoom_in)); + _menu_zoom_out->signal_activate().connect( + sigc::mem_fun(this, &PatchWindow::event_zoom_out)); + _menu_zoom_normal->signal_activate().connect( + sigc::mem_fun(this, &PatchWindow::event_zoom_normal)); _menu_view_engine_window->signal_activate().connect( sigc::mem_fun(this, &PatchWindow::event_show_engine)); _menu_view_control_window->signal_activate().connect( @@ -642,6 +653,26 @@ PatchWindow::event_quit() } +void +PatchWindow::event_zoom_in() +{ + _view->canvas()->set_font_size(_view->canvas()->get_font_size() + 1.0); +} + +void +PatchWindow::event_zoom_out() +{ + _view->canvas()->set_font_size(_view->canvas()->get_font_size() - 1.0); +} + + +void +PatchWindow::event_zoom_normal() +{ + _view->canvas()->set_zoom_and_font_size(1.0, _view->canvas()->get_default_font_size()); +} + + void PatchWindow::event_arrange() { diff --git a/src/gui/PatchWindow.hpp b/src/gui/PatchWindow.hpp index 28abdc57..aafb9d2c 100644 --- a/src/gui/PatchWindow.hpp +++ b/src/gui/PatchWindow.hpp @@ -96,6 +96,9 @@ private: void event_status_bar_toggled(); void event_human_names_toggled(); void event_port_names_toggled(); + void event_zoom_in(); + void event_zoom_out(); + void event_zoom_normal(); void event_arrange(); void event_show_properties(); void event_show_controls(); @@ -131,6 +134,9 @@ private: Gtk::CheckMenuItem* _menu_human_names; Gtk::CheckMenuItem* _menu_show_port_names; Gtk::CheckMenuItem* _menu_show_status_bar; + Gtk::MenuItem* _menu_zoom_in; + Gtk::MenuItem* _menu_zoom_out; + Gtk::MenuItem* _menu_zoom_normal; Gtk::MenuItem* _menu_fullscreen; Gtk::MenuItem* _menu_arrange; Gtk::MenuItem* _menu_view_engine_window; diff --git a/src/gui/ingen_gui.glade b/src/gui/ingen_gui.glade index 10dd355c..15e38061 100644 --- a/src/gui/ingen_gui.glade +++ b/src/gui/ingen_gui.glade @@ -265,16 +265,6 @@ True - - - gtk-fullscreen - True - True - True - - - - True @@ -304,6 +294,55 @@ + + + True + + + + + gtk-zoom-in + True + Increase font size + True + True + + + + + + gtk-zoom-out + True + Decrease font size + True + True + + + + + + gtk-zoom-100 + True + True + True + + + + + + True + + + + + True + gtk-fullscreen + True + True + + + + diff --git a/wscript b/wscript index 1017af0b..c706b359 100644 --- a/wscript +++ b/wscript @@ -55,7 +55,7 @@ def configure(conf): autowaf.check_pkg(conf, 'raul', uselib_store='RAUL', atleast_version='0.8.0', mandatory=True) autowaf.check_pkg(conf, 'flowcanvas', uselib_store='FLOWCANVAS', - atleast_version='0.7.0', mandatory=False) + atleast_version='0.8.0', mandatory=False) autowaf.check_pkg(conf, 'libglademm-2.4', uselib_store='GLADEMM', atleast_version='2.6.0', mandatory=False) autowaf.check_pkg(conf, 'sord', uselib_store='SORD', -- cgit v1.2.1