[Summary] Making namespace WavesUI a class.

[git-p4: depot-paths = "//Abdaw/dev_main/tracks/": change = 466991]
This commit is contained in:
Valeriy Kamyshniy 2014-06-11 06:00:48 -05:00 committed by Paul Davis
parent 250fd20658
commit 706f89993a
21 changed files with 205 additions and 264 deletions

View file

@ -108,7 +108,7 @@ ARDOUR_UI::setup_windows ()
editor->get_status_bar_packer().pack_start (*status_bar_packer, true, true); editor->get_status_bar_packer().pack_start (*status_bar_packer, true, true);
editor->get_status_bar_packer().pack_start (menu_bar_base, false, false, 6); editor->get_status_bar_packer().pack_start (menu_bar_base, false, false, 6);
#else #else
editor->get_hbox ("menu_bar_base").pack_start (menu_bar_base, false, false); editor->get_h_box ("menu_bar_base").pack_start (menu_bar_base, false, false);
#endif #endif
if (ARDOUR::Profile->get_trx()) { if (ARDOUR::Profile->get_trx()) {
top_packer.pack_start (tracks_tools_packer, false, false); top_packer.pack_start (tracks_tools_packer, false, false);

View file

@ -24,7 +24,8 @@ const char * DeviceConnectionControl::id_name = "_id_name";
DeviceConnectionControl::DeviceConnectionControl (const std::string& device_capture_name, bool active, uint16_t capture_number, const std::string& track_name) DeviceConnectionControl::DeviceConnectionControl (const std::string& device_capture_name, bool active, uint16_t capture_number, const std::string& track_name)
: Gtk::Layout() : Gtk::Layout(),
WavesUI("device_capture_control.xml", *this)
, _active(false) , _active(false)
, _active_on_button (NULL) , _active_on_button (NULL)
, _active_off_button (NULL) , _active_off_button (NULL)
@ -32,18 +33,22 @@ DeviceConnectionControl::DeviceConnectionControl (const std::string& device_capt
, _track_name_label (NULL) , _track_name_label (NULL)
, _number_label (NULL) , _number_label (NULL)
{ {
build_layout("device_capture_control.xml"); XMLNode* root = xml_tree()->root();
_active_on_button = &_children.get_waves_button ("capture_on_button"); WavesUI::set_attributes(*this, *root, XMLNodeMap());
_active_off_button = &_children.get_waves_button ("capture_off_button");
_name_label = &_children.get_label ("capture_name_label"); _active_on_button = &get_waves_button ("capture_on_button");
_number_label = &_children.get_label ("capture_number_label"); _active_off_button = &get_waves_button ("capture_off_button");
_track_name_label = &_children.get_label ("track_name_label"); _name_label = &get_label ("capture_name_label");
_number_label = &get_label ("capture_number_label");
_track_name_label = &get_label ("track_name_label");
init(device_capture_name, active, capture_number, track_name); init(device_capture_name, active, capture_number, track_name);
} }
DeviceConnectionControl::DeviceConnectionControl (const std::string& device_playback_name, bool active, uint16_t playback_number) DeviceConnectionControl::DeviceConnectionControl (const std::string& device_playback_name, bool active, uint16_t playback_number)
: Gtk::Layout() : Gtk::Layout()
, WavesUI("device_playback_control.xml", *this)
, _active(false) , _active(false)
, _active_on_button (NULL) , _active_on_button (NULL)
, _active_off_button (NULL) , _active_off_button (NULL)
@ -51,11 +56,14 @@ DeviceConnectionControl::DeviceConnectionControl (const std::string& device_play
, _track_name_label (NULL) , _track_name_label (NULL)
, _number_label (NULL) , _number_label (NULL)
{ {
build_layout("device_playback_control.xml"); XMLNode* root = xml_tree()->root();
_active_on_button = &_children.get_waves_button ("playback_on_button"); WavesUI::set_attributes(*this, *root, XMLNodeMap());
_active_off_button = &_children.get_waves_button ("playback_off_button");
_name_label = &_children.get_label ("playback_name_label"); _active_on_button = &get_waves_button ("playback_on_button");
_number_label = &_children.get_label ("playback_number_label"); _active_off_button = &get_waves_button ("playback_off_button");
_name_label = &get_label ("playback_name_label");
_number_label = &get_label ("playback_number_label");
init(device_playback_name, active, playback_number); init(device_playback_name, active, playback_number);
} }
@ -85,22 +93,6 @@ void DeviceConnectionControl::init(const std::string& name, bool active, uint16_
set_active(active); set_active(active);
} }
bool
DeviceConnectionControl::build_layout (const std::string& file_name)
{
const XMLTree* layout = WavesUI::load_layout(file_name);
if (layout == NULL) {
return false;
}
XMLNode* root = layout->root();
if ((root == NULL) || strcasecmp(root->name().c_str(), "layout")) {
return false;
}
WavesUI::set_attributes(*this, *root, XMLNodeMap());
WavesUI::create_ui(layout, *this, _children);
return true;
}
void void
DeviceConnectionControl::set_number (uint16_t number) DeviceConnectionControl::set_number (uint16_t number)

View file

@ -25,7 +25,7 @@
#include "waves_ui.h" #include "waves_ui.h"
class DeviceConnectionControl : public Gtk::Layout class DeviceConnectionControl : public Gtk::Layout, public WavesUI
{ {
public: public:
enum ConnectionNumber { enum ConnectionNumber {
@ -37,7 +37,6 @@ class DeviceConnectionControl : public Gtk::Layout
DeviceConnectionControl (const std::string& device_capture_name, bool active, uint16_t capture_number, const std::string& track_name); DeviceConnectionControl (const std::string& device_capture_name, bool active, uint16_t capture_number, const std::string& track_name);
DeviceConnectionControl (const std::string& device_playback_name, bool active, uint16_t playback_number); DeviceConnectionControl (const std::string& device_playback_name, bool active, uint16_t playback_number);
bool build_layout (const std::string& file_name);
void set_number (uint16_t number); void set_number (uint16_t number);
void set_active (bool active); void set_active (bool active);
void set_track_name (const std::string& new_track_name); void set_track_name (const std::string& new_track_name);
@ -52,7 +51,6 @@ class DeviceConnectionControl : public Gtk::Layout
// flag which reflects control "active" state // flag which reflects control "active" state
bool _active; bool _active;
WavesUI::WidgetMap _children;
WavesButton* _active_on_button; WavesButton* _active_on_button;
WavesButton* _active_off_button; WavesButton* _active_off_button;
Gtk::Label* _name_label; Gtk::Label* _name_label;

View file

@ -246,7 +246,7 @@ Editor::Editor ()
, cd_mark_label (_("CD Markers")) , cd_mark_label (_("CD Markers"))
, videotl_label (_("Video Timeline")) , videotl_label (_("Video Timeline"))
, edit_packer (4, 4, true) , edit_packer (4, 4, true)
, vpacker (get_vbox ("vpacker")) , vpacker (get_v_box ("vpacker"))
, _tool_marker_button (get_waves_button ("tool_marker_button")) , _tool_marker_button (get_waves_button ("tool_marker_button"))
, _tool_zoom_button (get_waves_button ("tool_zoom_button")) , _tool_zoom_button (get_waves_button ("tool_zoom_button"))
, _tool_arrow_button (get_waves_button ("tool_arrow_button")) , _tool_arrow_button (get_waves_button ("tool_arrow_button"))
@ -258,7 +258,7 @@ Editor::Editor ()
* but also any other OS that uses a single * but also any other OS that uses a single
* top menubar instead of per window menus * top menubar instead of per window menus
*/ */
, _status_bar_hpacker (get_hbox ("menu_bar_base")) , _status_bar_hpacker (get_h_box ("menu_bar_base"))
#endif #endif
/* the values here don't matter: layout widgets /* the values here don't matter: layout widgets
@ -5104,7 +5104,7 @@ Editor::timeaxisview_deleted (TimeAxisView *tv)
TrackViewList::iterator i; TrackViewList::iterator i;
if ((i = find (track_views.begin(), track_views.end(), tv)) != track_views.end()) { if ((i = std::find (track_views.begin(), track_views.end(), tv)) != track_views.end()) {
i = track_views.erase (i); i = track_views.erase (i);
} }

View file

@ -232,7 +232,7 @@ Editor::check_marker_label (Marker* m)
/* Get a time-ordered list of markers from the last time anything changed */ /* Get a time-ordered list of markers from the last time anything changed */
std::list<Marker*>& sorted = _sorted_marker_lists[m->get_parent()]; std::list<Marker*>& sorted = _sorted_marker_lists[m->get_parent()];
list<Marker*>::iterator i = find (sorted.begin(), sorted.end(), m); list<Marker*>::iterator i = std::find (sorted.begin(), sorted.end(), m);
list<Marker*>::iterator prev = sorted.end (); list<Marker*>::iterator prev = sorted.end ();
list<Marker*>::iterator next = i; list<Marker*>::iterator next = i;

View file

@ -1640,7 +1640,7 @@ Editor::temporal_zoom_region (bool both_axes)
_routes->suspend_redisplay (); _routes->suspend_redisplay ();
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
if (find (tracks.begin(), tracks.end(), (*i)) == tracks.end()) { if (std::find (tracks.begin(), tracks.end(), (*i)) == tracks.end()) {
hide_track_in_display (*i); hide_track_in_display (*i);
} }
} }

View file

@ -813,7 +813,7 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op)
int okey = closest->route()->order_key (); int okey = closest->route()->order_key ();
if (okey > key) { if (okey > key) {
swap (okey, key); std::swap (okey, key);
} }
for (TrackViewList::iterator x = track_views.begin(); x != track_views.end(); ++x) { for (TrackViewList::iterator x = track_views.begin(); x != track_views.end(); ++x) {
@ -830,7 +830,7 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op)
behaviour that feels wrong. behaviour that feels wrong.
*/ */
if (find (already_in_selection.begin(), if (std::find (already_in_selection.begin(),
already_in_selection.end(), already_in_selection.end(),
artv) == already_in_selection.end()) { artv) == already_in_selection.end()) {
@ -953,13 +953,13 @@ Editor::track_selection_changed ()
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
bool yn = (find (selection->tracks.begin(), selection->tracks.end(), *i) != selection->tracks.end()); bool yn = (std::find (selection->tracks.begin(), selection->tracks.end(), *i) != selection->tracks.end());
(*i)->set_selected (yn); (*i)->set_selected (yn);
TimeAxisView::Children c = (*i)->get_child_list (); TimeAxisView::Children c = (*i)->get_child_list ();
for (TimeAxisView::Children::iterator j = c.begin(); j != c.end(); ++j) { for (TimeAxisView::Children::iterator j = c.begin(); j != c.end(); ++j) {
(*j)->set_selected (find (selection->tracks.begin(), selection->tracks.end(), j->get()) != selection->tracks.end()); (*j)->set_selected (std::find (selection->tracks.begin(), selection->tracks.end(), j->get()) != selection->tracks.end());
} }
if (yn) { if (yn) {
@ -1915,7 +1915,7 @@ Editor::get_edit_op_range (framepos_t& start, framepos_t& end) const
} }
if (start > end) { if (start > end) {
swap (start, end); std::swap (start, end);
} }
/* turn range into one delimited by start...end, /* turn range into one delimited by start...end,

View file

@ -27,32 +27,34 @@ const char * MidiDeviceConnectionControl::playback_id_name = "_playback_id_name"
MidiDeviceConnectionControl::MidiDeviceConnectionControl (const std::string& midi_device_name, MidiDeviceConnectionControl::MidiDeviceConnectionControl (const std::string& midi_device_name,
bool has_capture, bool capture_active, bool has_capture, bool capture_active,
bool has_playback, bool playback_active) bool has_playback, bool playback_active)
: Gtk::Layout() : Gtk::Layout ()
, _has_capture(has_capture) , WavesUI ("midi_device_control.xml", *this)
, _capture_active(capture_active) , _has_capture (has_capture)
, _has_playback(has_playback) , _capture_active (capture_active)
, _playback_active(playback_active) , _has_playback (has_playback)
, _playback_active (playback_active)
{ {
build_layout("midi_device_control.xml"); XMLNode* root = xml_tree()->root();
WavesUI::set_attributes(*this, *root, XMLNodeMap());
_capture_on_button = &_children.get_waves_button ("capture_on_button"); _capture_on_button = &get_waves_button ("capture_on_button");
_capture_off_button = &_children.get_waves_button ("capture_off_button"); _capture_off_button = &get_waves_button ("capture_off_button");
if (!_has_capture) { if (!_has_capture) {
_capture_on_button->hide(); _capture_on_button->hide();
_capture_off_button->hide(); _capture_off_button->hide();
} }
_playback_on_button = &_children.get_waves_button ("playback_on_button"); _playback_on_button = &get_waves_button ("playback_on_button");
_playback_off_button = &_children.get_waves_button ("playback_off_button"); _playback_off_button = &get_waves_button ("playback_off_button");
if (!_has_playback) { if (!_has_playback) {
_playback_on_button->hide(); _playback_on_button->hide();
_playback_off_button->hide(); _playback_off_button->hide();
} }
_name_label = &_children.get_label ("midi_device_name_label"); _name_label = &get_label ("midi_device_name_label");
init(midi_device_name, capture_active, playback_active); init(midi_device_name, capture_active, playback_active);
} }
@ -77,25 +79,6 @@ void MidiDeviceConnectionControl::init(const std::string& name, bool capture_act
} }
bool
MidiDeviceConnectionControl::build_layout (const std::string& file_name)
{
const XMLTree* layout = WavesUI::load_layout(file_name);
if (layout == NULL) {
return false;
}
XMLNode* root = layout->root();
if ((root == NULL) || strcasecmp(root->name().c_str(), "layout")) {
return false;
}
WavesUI::set_attributes(*this, *root, XMLNodeMap());
WavesUI::create_ui(layout, *this, _children);
return true;
}
void void
MidiDeviceConnectionControl::set_capture_active (bool active) MidiDeviceConnectionControl::set_capture_active (bool active)
{ {

View file

@ -25,7 +25,7 @@
#include "waves_ui.h" #include "waves_ui.h"
class MidiDeviceConnectionControl : public Gtk::Layout class MidiDeviceConnectionControl : public Gtk::Layout, public WavesUI
{ {
public: public:
@ -46,7 +46,6 @@ public:
private: private:
void init(const std::string& name, bool capture_active, bool playback_active ); void init(const std::string& name, bool capture_active, bool playback_active );
bool build_layout (const std::string& file_name);
void on_capture_active_on(WavesButton*); void on_capture_active_on(WavesButton*);
void on_capture_active_off(WavesButton*); void on_capture_active_off(WavesButton*);
@ -59,7 +58,6 @@ private:
bool _has_playback; bool _has_playback;
bool _playback_active; bool _playback_active;
WavesUI::WidgetMap _children;
WavesButton* _capture_on_button; WavesButton* _capture_on_button;
WavesButton* _capture_off_button; WavesButton* _capture_off_button;
WavesButton* _playback_on_button; WavesButton* _playback_on_button;

View file

@ -28,14 +28,9 @@ const int PublicEditor::horizontal_spacing = 6;
sigc::signal<void> PublicEditor::DropDownKeys; sigc::signal<void> PublicEditor::DropDownKeys;
PublicEditor::PublicEditor ()
: WavesWindow (Gtk::WINDOW_TOPLEVEL)
, VisibilityTracker (*((Gtk::Window*)this))
{
}
PublicEditor::PublicEditor (std::string layout_script) PublicEditor::PublicEditor (std::string layout_script)
: WavesWindow (Gtk::WINDOW_TOPLEVEL, layout_script) : Window (Gtk::WINDOW_TOPLEVEL)
, WavesUI (layout_script, *this)
, VisibilityTracker (*((Gtk::Window*)this)) , VisibilityTracker (*((Gtk::Window*)this))
{ {
} }

View file

@ -30,10 +30,11 @@
#include <glib.h> #include <glib.h>
#include <gdk/gdktypes.h> #include <gdk/gdktypes.h>
#include <gtkmm/box.h> #include <gtkmm/box.h>
#include <gtkmm/window.h>
#include <gtkmm/actiongroup.h> #include <gtkmm/actiongroup.h>
#include <sigc++/signal.h> #include <sigc++/signal.h>
#include "waves_window.h" #include "waves_ui.h"
#include "evoral/types.hpp" #include "evoral/types.hpp"
@ -95,9 +96,8 @@ using ARDOUR::framecnt_t;
* of PublicEditor need not be recompiled if private methods or member variables * of PublicEditor need not be recompiled if private methods or member variables
* change. * change.
*/ */
class PublicEditor : public WavesWindow, public PBD::StatefulDestructible, public Gtkmm2ext::VisibilityTracker { class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, public Gtkmm2ext::VisibilityTracker, public WavesUI {
public: public:
PublicEditor ();
PublicEditor (std::string layout_script); PublicEditor (std::string layout_script);
virtual ~PublicEditor (); virtual ~PublicEditor ();

View file

@ -66,28 +66,28 @@ SessionDialog::SessionDialog (WM::Proxy<TracksControlPanel>& system_configuratio
const std::string& template_name, const std::string& template_name,
bool cancel_not_quit) bool cancel_not_quit)
: WavesDialog (_("session_dialog.xml"), true, false) : WavesDialog (_("session_dialog.xml"), true, false)
, _quit_button (named_children ().get_waves_button ("quit_button")) , _quit_button (get_waves_button ("quit_button"))
, _system_configuration_button (named_children ().get_waves_button ("system_configuration_button")) , _system_configuration_button (get_waves_button ("system_configuration_button"))
, _new_session_button (named_children ().get_waves_button ("new_session_button")) , _new_session_button (get_waves_button ("new_session_button"))
, _open_selected_button (named_children ().get_waves_button ("open_selected_button")) , _open_selected_button (get_waves_button ("open_selected_button"))
, _open_saved_session_button (named_children ().get_waves_button ("open_saved_session_button")) , _open_saved_session_button (get_waves_button ("open_saved_session_button"))
, _session_details_label(named_children ().get_label("session_details_label")) , _session_details_label(get_label("session_details_label"))
, _new_only (require_new) , _new_only (require_new)
, _provided_session_name (session_name) , _provided_session_name (session_name)
, _provided_session_path (session_path) , _provided_session_path (session_path)
, _existing_session_chooser_used (false) , _existing_session_chooser_used (false)
, _system_configuration_dialog(system_configuration_dialog) , _system_configuration_dialog(system_configuration_dialog)
{ {
_recent_session_button[0] = &named_children ().get_waves_button ("recent_session_button_0"); _recent_session_button[0] = &get_waves_button ("recent_session_button_0");
_recent_session_button[1] = &named_children ().get_waves_button ("recent_session_button_1"); _recent_session_button[1] = &get_waves_button ("recent_session_button_1");
_recent_session_button[2] = &named_children ().get_waves_button ("recent_session_button_2"); _recent_session_button[2] = &get_waves_button ("recent_session_button_2");
_recent_session_button[3] = &named_children ().get_waves_button ("recent_session_button_3"); _recent_session_button[3] = &get_waves_button ("recent_session_button_3");
_recent_session_button[4] = &named_children ().get_waves_button ("recent_session_button_4"); _recent_session_button[4] = &get_waves_button ("recent_session_button_4");
_recent_session_button[5] = &named_children ().get_waves_button ("recent_session_button_5"); _recent_session_button[5] = &get_waves_button ("recent_session_button_5");
_recent_session_button[6] = &named_children ().get_waves_button ("recent_session_button_6"); _recent_session_button[6] = &get_waves_button ("recent_session_button_6");
_recent_session_button[7] = &named_children ().get_waves_button ("recent_session_button_7"); _recent_session_button[7] = &get_waves_button ("recent_session_button_7");
_recent_session_button[8] = &named_children ().get_waves_button ("recent_session_button_8"); _recent_session_button[8] = &get_waves_button ("recent_session_button_8");
_recent_session_button[9] = &named_children ().get_waves_button ("recent_session_button_9"); _recent_session_button[9] = &get_waves_button ("recent_session_button_9");
init(); init();
} }

View file

@ -43,7 +43,7 @@ using namespace ARDOUR;
SessionLockDialog::SessionLockDialog () SessionLockDialog::SessionLockDialog ()
: WavesDialog (_("session_lock_dialog.xml"), true, false) : WavesDialog (_("session_lock_dialog.xml"), true, false)
, _ok_button (named_children ().get_waves_button ("ok_button")) , _ok_button (get_waves_button ("ok_button"))
{ {
set_keep_above (true); set_keep_above (true);
set_position (WIN_POS_CENTER); set_position (WIN_POS_CENTER);

View file

@ -60,36 +60,36 @@ using namespace Glib;
TracksControlPanel::TracksControlPanel () TracksControlPanel::TracksControlPanel ()
: WavesDialog ("tracks_preferences.xml") : WavesDialog ("tracks_preferences.xml")
, _device_capture_list (named_children ().get_vbox("device_capture_list")) , _device_capture_list (get_v_box("device_capture_list"))
, _device_playback_list (named_children ().get_vbox("device_playback_list")) , _device_playback_list (get_v_box("device_playback_list"))
, _midi_device_list (named_children ().get_vbox("midi_device_list")) , _midi_device_list (get_v_box("midi_device_list"))
, _all_inputs_on_button (named_children ().get_waves_button("all_inputs_on_button")) , _all_inputs_on_button (get_waves_button("all_inputs_on_button"))
, _all_inputs_off_button (named_children ().get_waves_button("all_inputs_off_button")) , _all_inputs_off_button (get_waves_button("all_inputs_off_button"))
, _all_outputs_on_button (named_children ().get_waves_button("all_outputs_on_button")) , _all_outputs_on_button (get_waves_button("all_outputs_on_button"))
, _all_outputs_off_button (named_children ().get_waves_button("all_outputs_off_button")) , _all_outputs_off_button (get_waves_button("all_outputs_off_button"))
, _audio_settings_layout (named_children ().get_layout ("audio_settings_layout")) , _audio_settings_layout (get_layout ("audio_settings_layout"))
, _midi_settings_layout (named_children ().get_layout ("midi_settings_layout")) , _midi_settings_layout (get_layout ("midi_settings_layout"))
, _session_settings_layout (named_children ().get_layout ("session_settings_layout")) , _session_settings_layout (get_layout ("session_settings_layout"))
, _audio_settings_tab_button (named_children ().get_waves_button ("audio_settings_tab_button")) , _audio_settings_tab_button (get_waves_button ("audio_settings_tab_button"))
, _midi_settings_tab_button (named_children ().get_waves_button ("midi_settings_tab_button")) , _midi_settings_tab_button (get_waves_button ("midi_settings_tab_button"))
, _session_settings_tab_button (named_children ().get_waves_button ("session_settings_tab_button")) , _session_settings_tab_button (get_waves_button ("session_settings_tab_button"))
, _ok_button (named_children ().get_waves_button ("ok_button")) , _ok_button (get_waves_button ("ok_button"))
, _cancel_button (named_children ().get_waves_button ("cancel_button")) , _cancel_button (get_waves_button ("cancel_button"))
, _apply_button (named_children ().get_waves_button ("apply_button")) , _apply_button (get_waves_button ("apply_button"))
, _control_panel_button (named_children ().get_waves_button ("control_panel_button")) , _control_panel_button (get_waves_button ("control_panel_button"))
, _no_button (named_children ().get_waves_button ("no_button")) , _no_button (get_waves_button ("no_button"))
, _yes_button (named_children ().get_waves_button ("yes_button")) , _yes_button (get_waves_button ("yes_button"))
, _engine_combo (named_children ().get_combo_box_text ("engine_combo")) , _engine_combo (get_combo_box_text ("engine_combo"))
, _device_combo (named_children ().get_combo_box_text ("device_combo")) , _device_combo (get_combo_box_text ("device_combo"))
, _sample_rate_combo (named_children ().get_combo_box_text ("sample_rate_combo")) , _sample_rate_combo (get_combo_box_text ("sample_rate_combo"))
, _buffer_size_combo (named_children ().get_combo_box_text ("buffer_size_combo")) , _buffer_size_combo (get_combo_box_text ("buffer_size_combo"))
, _latency_label (named_children ().get_label("latency_label")) , _latency_label (get_label("latency_label"))
, _default_open_path (named_children ().get_label("default_open_path")) , _default_open_path (get_label("default_open_path"))
, _multi_out_button(named_children ().get_waves_button ("multi_out_button")) , _multi_out_button(get_waves_button ("multi_out_button"))
, _stereo_out_button(named_children ().get_waves_button ("stereo_out_button")) , _stereo_out_button(get_waves_button ("stereo_out_button"))
, _name_tracks_after_driver(named_children ().get_waves_button ("name_tracks_after_driver_button")) , _name_tracks_after_driver(get_waves_button ("name_tracks_after_driver_button"))
, _reset_tracks_name_to_default(named_children ().get_waves_button ("reset_tracks_name_to_default_button")) , _reset_tracks_name_to_default(get_waves_button ("reset_tracks_name_to_default_button"))
, _browse_button(named_children ().get_waves_button("browse_default_folder")) , _browse_button(get_waves_button("browse_default_folder"))
, _have_control (false) , _have_control (false)
, _ignore_changes (0) , _ignore_changes (0)
{ {

View file

@ -37,13 +37,13 @@
#include "utils.h" #include "utils.h"
#include "window_manager.h" #include "window_manager.h"
using namespace Gtk;
using namespace Gtkmm2ext; using namespace Gtkmm2ext;
using namespace PBD; using namespace PBD;
using namespace ARDOUR; using namespace ARDOUR;
WavesDialog::WavesDialog (std::string layout_script_file, bool modal, bool use_seperator) WavesDialog::WavesDialog (std::string layout_script_file, bool modal, bool use_seperator)
: Dialog ("", modal, use_seperator) : Gtk::Dialog ("", modal, use_seperator)
, WavesUI (layout_script_file, *get_vbox())
, _proxy (0) , _proxy (0)
, _splash_pushed (false) , _splash_pushed (false)
{ {
@ -76,7 +76,7 @@ WavesDialog::WavesDialog (std::string layout_script_file, bool modal, bool use_s
set_transient_for (*parent_window); set_transient_for (*parent_window);
} }
ARDOUR_UI::CloseAllDialogs.connect (sigc::bind (sigc::mem_fun (*this, &WavesDialog::response), RESPONSE_CANCEL)); ARDOUR_UI::CloseAllDialogs.connect (sigc::bind (sigc::mem_fun (*this, &WavesDialog::response), Gtk::RESPONSE_CANCEL));
_proxy = new WM::ProxyTemporary (get_title(), this); _proxy = new WM::ProxyTemporary (get_title(), this);
WM::Manager::instance().register_window (_proxy); WM::Manager::instance().register_window (_proxy);
@ -84,7 +84,13 @@ WavesDialog::WavesDialog (std::string layout_script_file, bool modal, bool use_s
get_vbox()->set_spacing (0); get_vbox()->set_spacing (0);
get_vbox()->set_border_width (0); get_vbox()->set_border_width (0);
read_layout(layout_script_file); XMLNode* root = xml_tree()->root();
std::string title = xml_property (*root, "title", "");
set_title(title);
bool resizeable = xml_property (*root, "resizeable", false);
property_allow_grow().set_value(resizeable);
set_position (Gtk::WIN_POS_MOUSE); set_position (Gtk::WIN_POS_MOUSE);
} }
@ -148,29 +154,3 @@ WavesDialog::on_delete_event (GdkEventAny*)
hide (); hide ();
return false; return false;
} }
// Layout
bool
WavesDialog::read_layout (std::string file_name)
{
const XMLTree* layout = WavesUI::load_layout(file_name);
if (layout == NULL) {
return false;
}
XMLNode* root = layout->root();
if ((root == NULL) || strcasecmp(root->name().c_str(), "dialog")) {
return false;
}
std::string title = xml_property (*root, "title", "");
set_title(title);
bool resizeable = xml_property (*root, "resizeable", false);
property_allow_grow().set_value(resizeable);
set_border_width(0);
WavesUI::create_ui(layout, *get_vbox(), _children);
return true;
}

View file

@ -41,7 +41,7 @@ class XMLNode;
* method of connecting and disconnecting from a Session with * method of connecting and disconnecting from a Session with
* all other objects that have a handle on a Session. * all other objects that have a handle on a Session.
*/ */
class WavesDialog : public Gtk::Dialog, public ARDOUR::SessionHandlePtr class WavesDialog : public Gtk::Dialog, public ARDOUR::SessionHandlePtr, public WavesUI
{ {
public: public:
@ -55,18 +55,11 @@ class WavesDialog : public Gtk::Dialog, public ARDOUR::SessionHandlePtr
void on_unmap (); void on_unmap ();
void on_show (); void on_show ();
protected:
bool read_layout (std::string file_name);
WavesUI::WidgetMap& named_children() { return _children; }
private: private:
WM::ProxyTemporary* _proxy; WM::ProxyTemporary* _proxy;
bool _splash_pushed; bool _splash_pushed;
WavesUI::WidgetMap _children;
static sigc::signal<void> CloseAllDialogs; static sigc::signal<void> CloseAllDialogs;
}; };

View file

@ -21,6 +21,7 @@
#include "waves_ui.h" #include "waves_ui.h"
#include "pbd/file_utils.h" #include "pbd/file_utils.h"
#include "pbd/failed_constructor.h"
#include "ardour/filesystem_paths.h" #include "ardour/filesystem_paths.h"
#include "utils.h" #include "utils.h"
@ -30,8 +31,34 @@
using namespace PBD; using namespace PBD;
using namespace ARDOUR; using namespace ARDOUR;
std::map<std::string, const XMLTree*> WavesUI::__xml_tree_cache;
WavesUI::WavesUI (std::string layout_script_file, Gtk::Container& root)
: _xml_tree (NULL)
{
// To avoid a need of reading the same file many times:
std::map<std::string, const XMLTree*>::const_iterator it = __xml_tree_cache.find(layout_script_file);
if (it != __xml_tree_cache.end()) {
_xml_tree = (*it).second;
} else {
std::string layout_file;
Searchpath spath (ardour_data_search_path());
spath.add_subdirectory_to_paths("ui");
if (!find_file_in_search_path (spath, layout_script_file, layout_file)) {
dbg_msg("File not found: " + layout_script_file);
throw failed_constructor ();
}
_xml_tree = new XMLTree (layout_file, false);
__xml_tree_cache[layout_script_file] = _xml_tree;
}
create_ui(_xml_tree, root);
}
Gtk::Widget* Gtk::Widget*
WavesUI::create_widget (const XMLNode& definition, const XMLNodeMap& styles, WidgetMap& named_widgets) WavesUI::create_widget (const XMLNode& definition, const XMLNodeMap& styles)
{ {
Gtk::Object* child = NULL; Gtk::Object* child = NULL;
std::string widget_type = definition.name(); std::string widget_type = definition.name();
@ -102,7 +129,7 @@ WavesUI::create_widget (const XMLNode& definition, const XMLNodeMap& styles, Wid
int minposy = xml_property (definition, "minposy", styles, -1); int minposy = xml_property (definition, "minposy", styles, -1);
int maxposx = xml_property (definition, "maxposx", styles, minposx); int maxposx = xml_property (definition, "maxposx", styles, minposx);
int maxposy = xml_property (definition, "maxposy", styles, minposy); int maxposy = xml_property (definition, "maxposy", styles, minposy);
Gtk::Adjustment& adjustment = named_widgets.get_adjustment(adjustment_id.c_str()); Gtk::Adjustment& adjustment = get_adjustment(adjustment_id.c_str());
child = manage (new Gtkmm2ext::Fader(adjustment, face_image, handle_image, active_handle_image, minposx, minposy, maxposx, maxposy)); child = manage (new Gtkmm2ext::Fader(adjustment, face_image, handle_image, active_handle_image, minposx, minposy, maxposx, maxposy));
} else if (widget_type == "ADJUSTMENT") { } else if (widget_type == "ADJUSTMENT") {
//dbg_msg("Creating ADJUSTMENT"); //dbg_msg("Creating ADJUSTMENT");
@ -121,7 +148,7 @@ WavesUI::create_widget (const XMLNode& definition, const XMLNodeMap& styles, Wid
if (child != NULL) { if (child != NULL) {
if (!widget_id.empty()) { if (!widget_id.empty()) {
named_widgets[widget_id] = child; (*this)[widget_id] = child;
} }
if (dynamic_cast<Gtk::Widget*>(child)) { if (dynamic_cast<Gtk::Widget*>(child)) {
set_attributes(*dynamic_cast<Gtk::Widget*>(child), definition, styles); set_attributes(*dynamic_cast<Gtk::Widget*>(child), definition, styles);
@ -132,9 +159,9 @@ WavesUI::create_widget (const XMLNode& definition, const XMLNodeMap& styles, Wid
Gtk::Widget* Gtk::Widget*
WavesUI::add_widget (Gtk::Box& parent, const XMLNode& definition, const XMLNodeMap& styles, WidgetMap& named_widgets) WavesUI::add_widget (Gtk::Box& parent, const XMLNode& definition, const XMLNodeMap& styles)
{ {
Gtk::Widget* child = create_widget(definition, styles, named_widgets); Gtk::Widget* child = create_widget(definition, styles);
if (child != NULL) if (child != NULL)
{ {
@ -155,9 +182,9 @@ WavesUI::add_widget (Gtk::Box& parent, const XMLNode& definition, const XMLNodeM
Gtk::Widget* Gtk::Widget*
WavesUI::add_widget (Gtk::ScrolledWindow& parent, const XMLNode& definition, const XMLNodeMap& styles, WidgetMap& named_widgets) WavesUI::add_widget (Gtk::ScrolledWindow& parent, const XMLNode& definition, const XMLNodeMap& styles)
{ {
Gtk::Widget* child = create_widget(definition, styles, named_widgets); Gtk::Widget* child = create_widget(definition, styles);
if (child != NULL) if (child != NULL)
{ {
@ -168,9 +195,9 @@ WavesUI::add_widget (Gtk::ScrolledWindow& parent, const XMLNode& definition, con
Gtk::Widget* Gtk::Widget*
WavesUI::add_widget (Gtk::Window& parent, const XMLNode& definition, const XMLNodeMap& styles, WidgetMap& named_widgets) WavesUI::add_widget (Gtk::Window& parent, const XMLNode& definition, const XMLNodeMap& styles)
{ {
Gtk::Widget* child = create_widget(definition, styles, named_widgets); Gtk::Widget* child = create_widget(definition, styles);
if (child != NULL) if (child != NULL)
{ {
@ -181,9 +208,9 @@ WavesUI::add_widget (Gtk::Window& parent, const XMLNode& definition, const XMLNo
Gtk::Widget* Gtk::Widget*
WavesUI::add_widget (Gtk::EventBox& parent, const XMLNode& definition, const XMLNodeMap& styles, WidgetMap& named_widgets) WavesUI::add_widget (Gtk::EventBox& parent, const XMLNode& definition, const XMLNodeMap& styles)
{ {
Gtk::Widget* child = create_widget(definition, styles, named_widgets); Gtk::Widget* child = create_widget(definition, styles);
if (child != NULL) if (child != NULL)
{ {
@ -194,9 +221,9 @@ WavesUI::add_widget (Gtk::EventBox& parent, const XMLNode& definition, const XML
Gtk::Widget* Gtk::Widget*
WavesUI::add_widget (Gtk::Layout& parent, const XMLNode& definition, const XMLNodeMap& styles, WidgetMap& named_widgets) WavesUI::add_widget (Gtk::Layout& parent, const XMLNode& definition, const XMLNodeMap& styles)
{ {
Gtk::Widget* child = create_widget(definition, styles, named_widgets); Gtk::Widget* child = create_widget(definition, styles);
if (child != NULL) if (child != NULL)
{ {
@ -209,25 +236,25 @@ WavesUI::add_widget (Gtk::Layout& parent, const XMLNode& definition, const XMLNo
Gtk::Widget* Gtk::Widget*
WavesUI::add_widget (Gtk::Container& parent, const XMLNode& definition, const XMLNodeMap& styles, WidgetMap& named_widgets) WavesUI::add_widget (Gtk::Container& parent, const XMLNode& definition, const XMLNodeMap& styles)
{ {
Gtk::Widget* child = NULL; Gtk::Widget* child = NULL;
if(dynamic_cast<Gtk::Layout*> (&parent)) { if(dynamic_cast<Gtk::Layout*> (&parent)) {
child = WavesUI::add_widget (*dynamic_cast<Gtk::Layout*> (&parent), definition, styles, named_widgets); child = WavesUI::add_widget (*dynamic_cast<Gtk::Layout*> (&parent), definition, styles);
} else if(dynamic_cast<Gtk::Box*> (&parent)) { } else if(dynamic_cast<Gtk::Box*> (&parent)) {
child = WavesUI::add_widget (*dynamic_cast<Gtk::Box*> (&parent), definition, styles, named_widgets); child = WavesUI::add_widget (*dynamic_cast<Gtk::Box*> (&parent), definition, styles);
} else if(dynamic_cast<Gtk::ScrolledWindow*> (&parent)) { } else if(dynamic_cast<Gtk::ScrolledWindow*> (&parent)) {
child = WavesUI::add_widget (*dynamic_cast<Gtk::ScrolledWindow*> (&parent), definition, styles, named_widgets); child = WavesUI::add_widget (*dynamic_cast<Gtk::ScrolledWindow*> (&parent), definition, styles);
} else if(dynamic_cast<Gtk::Window*> (&parent)) { } else if(dynamic_cast<Gtk::Window*> (&parent)) {
child = WavesUI::add_widget (*dynamic_cast<Gtk::Window*> (&parent), definition, styles, named_widgets); child = WavesUI::add_widget (*dynamic_cast<Gtk::Window*> (&parent), definition, styles);
} else if(dynamic_cast<Gtk::EventBox*> (&parent)) { } else if(dynamic_cast<Gtk::EventBox*> (&parent)) {
child = WavesUI::add_widget (*dynamic_cast<Gtk::EventBox*> (&parent), definition, styles, named_widgets); child = WavesUI::add_widget (*dynamic_cast<Gtk::EventBox*> (&parent), definition, styles);
} }
Gtk::Container* container = dynamic_cast<Gtk::Container*>(child); Gtk::Container* container = dynamic_cast<Gtk::Container*>(child);
if (container != NULL) { if (container != NULL) {
WavesUI::create_ui (definition.children(), styles, *container, named_widgets); WavesUI::create_ui (definition.children(), styles, *container);
Gtk::ScrolledWindow* sw = dynamic_cast<Gtk::ScrolledWindow*>(child); Gtk::ScrolledWindow* sw = dynamic_cast<Gtk::ScrolledWindow*>(child);
if (sw != NULL) { if (sw != NULL) {
Gtk::Viewport* vp = (Gtk::Viewport*)sw->get_child(); Gtk::Viewport* vp = (Gtk::Viewport*)sw->get_child();
@ -241,29 +268,27 @@ WavesUI::add_widget (Gtk::Container& parent, const XMLNode& definition, const XM
} }
void void
WavesUI::create_ui (const XMLNodeList& definition, const XMLNodeMap& styles, Gtk::Container& root, WidgetMap& named_widgets) WavesUI::create_ui (const XMLNodeList& definition, const XMLNodeMap& styles, Gtk::Container& root)
{ {
for (XMLNodeList::const_iterator i = definition.begin(); i != definition.end(); ++i) { for (XMLNodeList::const_iterator i = definition.begin(); i != definition.end(); ++i) {
WavesUI::add_widget (root, **i, styles, named_widgets); WavesUI::add_widget (root, **i, styles);
} }
} }
void void
WavesUI::create_ui (const XMLTree& layout, Gtk::Container& root, WidgetMap& named_widgets) WavesUI::create_ui (const XMLTree& layout, Gtk::Container& root)
{ {
XMLNodeMap styles; XMLNodeMap styles;
get_styles(layout, styles); get_styles(layout, styles);
const XMLNodeList& definition = layout.root()->children(); const XMLNodeList& definition = layout.root()->children();
WavesUI::create_ui (definition, styles, root, named_widgets); WavesUI::create_ui (definition, styles, root);
} }
static std::map<std::string, const XMLTree*> xml_tree_cache;
const XMLTree* const XMLTree*
WavesUI::load_layout (const std::string xml_file_name) WavesUI::load_layout (const std::string xml_file_name)
{ {
std::map<std::string, const XMLTree*>::const_iterator it = xml_tree_cache.find(xml_file_name); std::map<std::string, const XMLTree*>::const_iterator it = __xml_tree_cache.find(xml_file_name);
if (it != xml_tree_cache.end()) { if (it != __xml_tree_cache.end()) {
return (*it).second; return (*it).second;
} }
@ -277,7 +302,7 @@ WavesUI::load_layout (const std::string xml_file_name)
} }
const XMLTree* tree = new XMLTree (layout_file, false); const XMLTree* tree = new XMLTree (layout_file, false);
xml_tree_cache[xml_file_name] = tree; __xml_tree_cache[xml_file_name] = tree;
return tree; return tree;
} }
@ -412,10 +437,10 @@ WavesUI::set_attributes (Gtk::Widget& widget, const XMLNode& definition, const X
} }
Gtk::Object* Gtk::Object*
WavesUI::WidgetMap::get_object(const char *id) WavesUI::get_object(const char *id)
{ {
Gtk::Object* object = NULL; Gtk::Object* object = NULL;
WidgetMap::iterator it = find(id); WavesUI::iterator it = find(id);
if(it != end()) if(it != end())
object = it->second; object = it->second;
@ -423,7 +448,7 @@ WavesUI::WidgetMap::get_object(const char *id)
} }
Gtk::Adjustment& Gtk::Adjustment&
WavesUI::WidgetMap::get_adjustment(const char* id) WavesUI::get_adjustment(const char* id)
{ {
Gtk::Adjustment* child = dynamic_cast<Gtk::Adjustment*> (get_object(id)); Gtk::Adjustment* child = dynamic_cast<Gtk::Adjustment*> (get_object(id));
if (child == NULL ) { if (child == NULL ) {
@ -434,7 +459,7 @@ WavesUI::WidgetMap::get_adjustment(const char* id)
} }
Gtk::VBox& Gtk::VBox&
WavesUI::WidgetMap::get_vbox (const char* id) WavesUI::get_v_box (const char* id)
{ {
Gtk::VBox* child = dynamic_cast<Gtk::VBox*> (get_object(id)); Gtk::VBox* child = dynamic_cast<Gtk::VBox*> (get_object(id));
if (child == NULL ) { if (child == NULL ) {
@ -446,7 +471,7 @@ WavesUI::WidgetMap::get_vbox (const char* id)
Gtk::HBox& Gtk::HBox&
WavesUI::WidgetMap::get_hbox (const char* id) WavesUI::get_h_box (const char* id)
{ {
Gtk::HBox* child = dynamic_cast<Gtk::HBox*> (get_object(id)); Gtk::HBox* child = dynamic_cast<Gtk::HBox*> (get_object(id));
if (child == NULL ) { if (child == NULL ) {
@ -458,7 +483,7 @@ WavesUI::WidgetMap::get_hbox (const char* id)
Gtk::Layout& Gtk::Layout&
WavesUI::WidgetMap::get_layout (const char* id) WavesUI::get_layout (const char* id)
{ {
Gtk::Layout* child = dynamic_cast<Gtk::Layout*> (get_object(id)); Gtk::Layout* child = dynamic_cast<Gtk::Layout*> (get_object(id));
if (child == NULL ) { if (child == NULL ) {
@ -470,7 +495,7 @@ WavesUI::WidgetMap::get_layout (const char* id)
Gtk::Label& Gtk::Label&
WavesUI::WidgetMap::get_label (const char* id) WavesUI::get_label (const char* id)
{ {
Gtk::Label* child = dynamic_cast<Gtk::Label*> (get_object(id)); Gtk::Label* child = dynamic_cast<Gtk::Label*> (get_object(id));
if (child == NULL ) { if (child == NULL ) {
@ -482,7 +507,7 @@ WavesUI::WidgetMap::get_label (const char* id)
Gtk::ComboBoxText& Gtk::ComboBoxText&
WavesUI::WidgetMap::get_combo_box_text (const char* id) WavesUI::get_combo_box_text (const char* id)
{ {
Gtk::ComboBoxText* child = dynamic_cast<Gtk::ComboBoxText*> (get_object(id)); Gtk::ComboBoxText* child = dynamic_cast<Gtk::ComboBoxText*> (get_object(id));
if (child == NULL ) { if (child == NULL ) {
@ -494,7 +519,7 @@ WavesUI::WidgetMap::get_combo_box_text (const char* id)
WavesButton& WavesButton&
WavesUI::WidgetMap::get_waves_button (const char* id) WavesUI::get_waves_button (const char* id)
{ {
WavesButton* child = dynamic_cast<WavesButton*> (get_object(id)); WavesButton* child = dynamic_cast<WavesButton*> (get_object(id));
if (child == NULL ) { if (child == NULL ) {
@ -505,7 +530,7 @@ WavesUI::WidgetMap::get_waves_button (const char* id)
} }
Gtkmm2ext::Fader& Gtkmm2ext::Fader&
WavesUI::WidgetMap::get_fader (const char* id) WavesUI::get_fader (const char* id)
{ {
Gtkmm2ext::Fader* child = dynamic_cast<Gtkmm2ext::Fader*> (get_object(id)); Gtkmm2ext::Fader* child = dynamic_cast<Gtkmm2ext::Fader*> (get_object(id));
if (child == NULL ) { if (child == NULL ) {

View file

@ -36,36 +36,40 @@
#include "waves_icon_button.h" #include "waves_icon_button.h"
using namespace ArdourCanvas::XMLUI; using namespace ArdourCanvas::XMLUI;
namespace WavesUI { class WavesUI : public std::map<std::string, Gtk::Object*> {
class WidgetMap : public std::map<std::string, Gtk::Object*>
{
public: public:
WavesUI (std::string layout_script_file, Gtk::Container& root);
Gtk::Adjustment& get_adjustment (const char* id); Gtk::Adjustment& get_adjustment (const char* id);
Gtk::VBox& get_vbox (const char* id); Gtk::VBox& get_v_box (const char* id);
Gtk::HBox& get_hbox (const char* id); Gtk::HBox& get_h_box (const char* id);
Gtk::Layout& get_layout (const char* id); Gtk::Layout& get_layout (const char* id);
Gtk::Label& get_label (const char* id); Gtk::Label& get_label (const char* id);
Gtk::Image& get_image (const char* id); Gtk::Image& get_image (const char* id);
Gtk::ComboBoxText& get_combo_box_text (const char* id); Gtk::ComboBoxText& get_combo_box_text (const char* id);
WavesButton& get_waves_button (const char* id); WavesButton& get_waves_button (const char* id);
Gtkmm2ext::Fader& get_fader (const char* id); Gtkmm2ext::Fader& get_fader (const char* id);
private: const XMLTree* xml_tree() { return _xml_tree; }
Gtk::Object* get_object(const char *id);
};
const XMLTree* load_layout (const std::string xml_file_name); protected:
void create_ui (const XMLTree& layout, Gtk::Container& root, WidgetMap& named_widgets);
void create_ui (const XMLNodeList& definition, const XMLNodeMap& styles, Gtk::Container& root, WidgetMap& named_widgets);
Gtk::Widget* create_widget (const XMLNode& definition, const XMLNodeMap& styles, WidgetMap& named_widgets);
Gtk::Widget* add_widget (Gtk::Box& parent, const XMLNode& definition, const XMLNodeMap& styles, WidgetMap& named_widgets);
Gtk::Widget* add_widget (Gtk::ScrolledWindow& parent, const XMLNode& definition, const XMLNodeMap& styles, WidgetMap& named_widgets);
Gtk::Widget* add_widget (Gtk::Window& parent, const XMLNode& definition, const XMLNodeMap& styles, WidgetMap& named_widgets);
Gtk::Widget* add_widget (Gtk::Layout& parent, const XMLNode& definition, const XMLNodeMap& styles, WidgetMap& named_widgets);
Gtk::Widget* add_widget (Gtk::Container& parent, const XMLNode& definition, const XMLNodeMap& styles, WidgetMap& named_widgets);
Gtk::Widget* add_widget (Gtk::EventBox& parent, const XMLNode& definition, const XMLNodeMap& styles, WidgetMap& named_widgets);
void set_attributes (Gtk::Widget& widget, const XMLNode& definition, const XMLNodeMap& styles); void set_attributes (Gtk::Widget& widget, const XMLNode& definition, const XMLNodeMap& styles);
} private:
static std::map<std::string, const XMLTree*> __xml_tree_cache;
const XMLTree* _xml_tree;
Gtk::Object* get_object(const char *id);
const XMLTree* load_layout (const std::string xml_file_name);
void create_ui (const XMLTree& layout, Gtk::Container& root);
void create_ui (const XMLNodeList& definition, const XMLNodeMap& styles, Gtk::Container& root);
Gtk::Widget* create_widget (const XMLNode& definition, const XMLNodeMap& styles);
Gtk::Widget* add_widget (Gtk::Box& parent, const XMLNode& definition, const XMLNodeMap& styles);
Gtk::Widget* add_widget (Gtk::ScrolledWindow& parent, const XMLNode& definition, const XMLNodeMap& styles);
Gtk::Widget* add_widget (Gtk::Window& parent, const XMLNode& definition, const XMLNodeMap& styles);
Gtk::Widget* add_widget (Gtk::Layout& parent, const XMLNode& definition, const XMLNodeMap& styles);
Gtk::Widget* add_widget (Gtk::Container& parent, const XMLNode& definition, const XMLNodeMap& styles);
Gtk::Widget* add_widget (Gtk::EventBox& parent, const XMLNode& definition, const XMLNodeMap& styles);
};
#endif //__WAVES_UI_H__ #endif //__WAVES_UI_H__

View file

@ -1,9 +0,0 @@
/* Copyright (C) 2014 Waves Audio Ltd.
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 "waves_window.h" #include "dbg_msg.h"
WavesWindow::WavesWindow (Gtk::WindowType window_type) : Gtk::Window (window_type) { }
WavesWindow::WavesWindow (Gtk::WindowType window_type, std::string layout_script) : Gtk::Window (window_type) { const XMLTree* layout = WavesUI::load_layout(layout_script); if (layout == NULL) { return; }
XMLNode* root = layout->root(); if ((root == NULL) || strcasecmp(root->name().c_str(), "Window")) { return; }
WavesUI::create_ui(layout, *this, _children); }

View file

@ -1,17 +0,0 @@
/* Copyright (C) 2014 Waves Audio Ltd.
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 __waves_window_h__ #define __waves_window_h__ #include <string>
#include <gtkmm.h>
#include "waves_ui.h"
class WavesWindow : public Gtk::Window { public: WavesWindow (Gtk::WindowType window_type); WavesWindow (Gtk::WindowType window_type, std::string layout_script); Gtk::VBox& get_vbox (const char* id) { return _children.get_vbox (id); }
Gtk::HBox& get_hbox (const char* id) { return _children.get_hbox (id); }
Gtk::Layout& get_layout (const char* id) { return _children.get_layout (id); }
Gtk::Label& get_label (const char* id) { return _children.get_label (id); }
Gtk::ComboBoxText& get_combo_box_text (const char* id) { return _children.get_combo_box_text (id); }
WavesButton& get_waves_button (const char* id) { return _children.get_waves_button (id); }
Gtk::Adjustment& get_adjustment (const char* id) { return _children.get_adjustment (id); }
private: WavesUI::WidgetMap _children; };
#endif // __waves_window_h__

View file

@ -38,7 +38,6 @@ gtk2_ardour_sources = [
'waves_icon_button.cc', 'waves_icon_button.cc',
'ardour_dialog.cc', 'ardour_dialog.cc',
'waves_dialog.cc', 'waves_dialog.cc',
'waves_window.cc',
'ardour_ui.cc', 'ardour_ui.cc',
'ardour_ui2.cc', 'ardour_ui2.cc',
'ardour_ui_dependents.cc', 'ardour_ui_dependents.cc',