diff options
-rw-r--r-- | gtk2_ardour/ardour_dialog.cc | 7 | ||||
-rw-r--r-- | gtk2_ardour/ardour_window.cc | 75 | ||||
-rw-r--r-- | gtk2_ardour/ardour_window.h | 50 | ||||
-rw-r--r-- | gtk2_ardour/io_selector.cc | 7 | ||||
-rw-r--r-- | gtk2_ardour/io_selector.h | 4 | ||||
-rw-r--r-- | gtk2_ardour/route_params_ui.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/wscript | 1 |
7 files changed, 135 insertions, 11 deletions
diff --git a/gtk2_ardour/ardour_dialog.cc b/gtk2_ardour/ardour_dialog.cc index 278433c7ef..b8c755de10 100644 --- a/gtk2_ardour/ardour_dialog.cc +++ b/gtk2_ardour/ardour_dialog.cc @@ -24,10 +24,7 @@ #include "ardour_dialog.h" #include "keyboard.h" -#include "ardour_ui.h" #include "splash.h" -#include "public_editor.h" -#include "utils.h" using namespace std; using namespace Gtk; @@ -92,5 +89,7 @@ ArdourDialog::init () { set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG); set_border_width (10); - CloseAllDialogs.connect (sigc::bind (sigc::mem_fun (*this, &ArdourDialog::response), RESPONSE_CANCEL)); + CloseAllDialogs.connect ( + sigc::bind (sigc::mem_fun (*this, &ArdourDialog::response), + RESPONSE_CANCEL)); } diff --git a/gtk2_ardour/ardour_window.cc b/gtk2_ardour/ardour_window.cc new file mode 100644 index 0000000000..0e9294cc3f --- /dev/null +++ b/gtk2_ardour/ardour_window.cc @@ -0,0 +1,75 @@ +/* + Copyright (C) 2002-2011 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include <iostream> +#include <sigc++/bind.h> + +#include <gtkmm2ext/doi.h> + +#include "ardour_window.h" +#include "keyboard.h" + +using namespace std; +using namespace Gtk; +using namespace Gtkmm2ext; + +ArdourWindow::ArdourWindow (string title) + : Window () +{ + set_title (title); + init (); +} + +ArdourWindow::ArdourWindow (Gtk::Window& parent, string title) + : Window () +{ + init (); + set_position (Gtk::WIN_POS_CENTER_ON_PARENT); +} + +ArdourWindow::~ArdourWindow () +{ +} + +bool +ArdourWindow::on_enter_notify_event (GdkEventCrossing *ev) +{ + Keyboard::the_keyboard().enter_window (ev, this); + return Window::on_enter_notify_event (ev); +} + +bool +ArdourWindow::on_leave_notify_event (GdkEventCrossing *ev) +{ + Keyboard::the_keyboard().leave_window (ev, this); + return Window::on_leave_notify_event (ev); +} + +void +ArdourWindow::on_unmap () +{ + Keyboard::the_keyboard().leave_window (0, this); + Window::on_unmap (); +} + +void +ArdourWindow::init () +{ + set_border_width (10); +} diff --git a/gtk2_ardour/ardour_window.h b/gtk2_ardour/ardour_window.h new file mode 100644 index 0000000000..0590234140 --- /dev/null +++ b/gtk2_ardour/ardour_window.h @@ -0,0 +1,50 @@ +/* + Copyright (C) 2002-2011 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __ardour_window_h__ +#define __ardour_window_h__ + +#include <gtkmm/window.h> +#include <gtkmm/window.h> + +#include "ardour/session_handle.h" + +/** + * This virtual parent class is so that each window uses the + * same mechanism to declare its closing. It shares a common + * method of connecting and disconnecting from a Session with + * all other objects that have a handle on a Session. + */ +class ArdourWindow : public Gtk::Window, public ARDOUR::SessionHandlePtr +{ + public: + ArdourWindow (std::string title); + ArdourWindow (Gtk::Window& parent, std::string title); + ~ArdourWindow(); + + bool on_enter_notify_event (GdkEventCrossing*); + bool on_leave_notify_event (GdkEventCrossing*); + void on_unmap (); + + private: + void init (); +}; + +#endif // __ardour_window_h__ + diff --git a/gtk2_ardour/io_selector.cc b/gtk2_ardour/io_selector.cc index f77123a684..d7b65dc58b 100644 --- a/gtk2_ardour/io_selector.cc +++ b/gtk2_ardour/io_selector.cc @@ -17,7 +17,6 @@ */ -#include <gtkmm/messagedialog.h> #include <glibmm/objectbase.h> #include <gtkmm2ext/doi.h> @@ -221,12 +220,12 @@ IOSelector::channel_noun () const } IOSelectorWindow::IOSelectorWindow (ARDOUR::Session* session, boost::shared_ptr<ARDOUR::IO> io, bool /*can_cancel*/) - : ArdourDialog (_("I/O selector")) - , _selector (this, session, io) + : ArdourWindow (_("I/O selector")) + , _selector (this, session, io) { set_name ("IOSelectorWindow2"); - get_vbox()->pack_start (_selector); + add (_selector); set_position (Gtk::WIN_POS_MOUSE); diff --git a/gtk2_ardour/io_selector.h b/gtk2_ardour/io_selector.h index e44fd8aa83..bba42e919d 100644 --- a/gtk2_ardour/io_selector.h +++ b/gtk2_ardour/io_selector.h @@ -21,7 +21,7 @@ #define __gtkardour_io_selector_h__ #include "port_matrix.h" -#include "ardour_dialog.h" +#include "ardour_window.h" class IOSelector : public PortMatrix { @@ -67,7 +67,7 @@ class IOSelector : public PortMatrix PBD::ScopedConnection _io_connection; }; -class IOSelectorWindow : public ArdourDialog +class IOSelectorWindow : public ArdourWindow { public: IOSelectorWindow (ARDOUR::Session *, boost::shared_ptr<ARDOUR::IO>, bool can_cancel = false); diff --git a/gtk2_ardour/route_params_ui.h b/gtk2_ardour/route_params_ui.h index 0da47bd4d4..96cc6f0595 100644 --- a/gtk2_ardour/route_params_ui.h +++ b/gtk2_ardour/route_params_ui.h @@ -37,7 +37,6 @@ #include "ardour/ardour.h" -#include "io_selector.h" #include "ardour_dialog.h" #include "processor_box.h" #include "route_processor_selection.h" @@ -54,6 +53,7 @@ namespace ARDOUR { } class PluginSelector; +class IOSelector; class RouteParams_UI : public ArdourDialog, public PBD::ScopedConnectionList { diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript index 1c1f06ce20..50d617290a 100644 --- a/gtk2_ardour/wscript +++ b/gtk2_ardour/wscript @@ -40,6 +40,7 @@ gtk2_ardour_sources = [ 'ardour_ui_ed.cc', 'ardour_ui_mixer.cc', 'ardour_ui_options.cc', + 'ardour_window.cc', 'audio_clock.cc', 'audio_region_editor.cc', 'audio_region_view.cc', |