13
0

Add ArdourWindow class for non-dialog windows.

Make IOSelector an ArdourWindow.

It's debatable whether this one should actually be a window, cancel buttons
might actually be useful on the IO selector.


git-svn-id: svn://localhost/ardour2/branches/3.0@10691 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2011-11-18 21:56:01 +00:00
parent cd4e803f60
commit 5770f26bc9
7 changed files with 135 additions and 11 deletions

View File

@ -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));
}

View File

@ -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);
}

View File

@ -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__

View File

@ -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);

View File

@ -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);

View File

@ -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
{

View File

@ -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',