13
0

New Tabbable: Trigger-Page skeleton

This commit is contained in:
Robin Gareus 2021-11-09 02:27:38 +01:00
parent 229a8aea13
commit 9ce604bc03
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
11 changed files with 382 additions and 6 deletions

View File

@ -610,6 +610,12 @@
<menuitem action='attach-recorder'/>
<menuitem action='detach-recorder'/>
</menu>
<menu action='TriggerMenu'>
<menuitem action='show-trigger'/>
<menuitem action='hide-trigger'/>
<menuitem action='attach-trigger'/>
<menuitem action='detach-trigger'/>
</menu>
<menu action='PrefsMenu'>
<menuitem action='show-preferences'/>
<menuitem action='hide-preferences'/>

View File

@ -206,6 +206,7 @@
#include "time_info_box.h"
#include "timers.h"
#include "transport_masters_dialog.h"
#include "trigger_page.h"
#include "triggerbox_ui.h"
#include "utils.h"
#include "utils_videotl.h"
@ -305,6 +306,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
, editor (0)
, mixer (0)
, recorder (0)
, trigger_page (0)
, nsm (0)
, _was_dirty (false)
, _mixer_on_top (false)
@ -366,6 +368,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
, mixer_visibility_button (S_("Window|Mix"))
, prefs_visibility_button (S_("Window|Prefs"))
, recorder_visibility_button (S_("Window|Rec"))
, trigger_page_visibility_button (S_("Window|Trig"))
{
Gtkmm2ext::init (localedir);
@ -860,6 +863,7 @@ ARDOUR_UI::~ARDOUR_UI ()
delete _process_thread; _process_thread = 0;
delete time_info_box; time_info_box = 0;
delete meterbridge; meterbridge = 0;
delete trigger_page; trigger_page = 0;
delete recorder; recorder = 0;
delete editor; editor = 0;
delete mixer; mixer = 0;

View File

@ -157,6 +157,7 @@ class MainClock;
class Mixer_UI;
class PublicEditor;
class RecorderUI;
class TriggerPage;
class SaveAsDialog;
class SaveTemplateDialog;
class SessionDialog;
@ -280,6 +281,7 @@ public:
XMLNode* editor_settings() const;
XMLNode* preferences_settings() const;
XMLNode* mixer_settings () const;
XMLNode* trigger_page_settings () const;
XMLNode* recorder_settings () const;
XMLNode* keyboard_settings () const;
XMLNode* tearoff_settings (const char*) const;
@ -420,6 +422,7 @@ private:
PublicEditor* editor;
Mixer_UI* mixer;
RecorderUI* recorder;
TriggerPage* trigger_page;
Gtk::Tooltips _tooltips;
NSM_Client* nsm;
bool _was_dirty;
@ -711,6 +714,7 @@ private:
int create_meterbridge ();
int create_masters ();
int create_recorder ();
int create_trigger_page ();
Meterbridge *meterbridge;
@ -903,6 +907,7 @@ private:
ArdourWidgets::ArdourButton mixer_visibility_button;
ArdourWidgets::ArdourButton prefs_visibility_button;
ArdourWidgets::ArdourButton recorder_visibility_button;
ArdourWidgets::ArdourButton trigger_page_visibility_button;
bool key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev, Gtkmm2ext::Bindings*);
bool try_gtk_accel_binding (GtkWindow* win, GdkEventKey* ev, bool translate, GdkModifierType modifier);

View File

@ -65,6 +65,7 @@
#include "main_clock.h"
#include "mixer_ui.h"
#include "recorder_ui.h"
#include "trigger_page.h"
#include "utils.h"
#include "time_info_box.h"
#include "midi_tracer.h"
@ -306,6 +307,7 @@ ARDOUR_UI::setup_transport ()
mixer_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-mixer-visibility")));
prefs_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-preferences-visibility")));
recorder_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-recorder-visibility")));
trigger_page_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-trigger-visibility")));
act = ActionManager::get_action ("Transport", "ToggleAutoReturn");
auto_return_button.set_related_action (act);
@ -342,6 +344,7 @@ ARDOUR_UI::setup_transport ()
mixer_visibility_button.signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), mixer));
prefs_visibility_button.signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), rc_option_editor));
recorder_visibility_button.signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), recorder));
trigger_page_visibility_button.signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), trigger_page));
/* catch context clicks so that we can show a menu on these buttons */
@ -349,6 +352,7 @@ ARDOUR_UI::setup_transport ()
mixer_visibility_button.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_visibility_button_press), X_("mixer")), false);
prefs_visibility_button.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_visibility_button_press), X_("preferences")), false);
recorder_visibility_button.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_visibility_button_press), X_("recorder")), false);
trigger_page_visibility_button.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_visibility_button_press), X_("trigger")), false);
/* setup widget style/name */
@ -374,6 +378,7 @@ ARDOUR_UI::setup_transport ()
mixer_visibility_button.set_name (X_("page switch button"));
prefs_visibility_button.set_name (X_("page switch button"));
recorder_visibility_button.set_name (X_("page switch button"));
trigger_page_visibility_button.set_name (X_("page switch button"));
punch_in_button.set_name ("punch button");
punch_out_button.set_name ("punch button");
@ -430,6 +435,10 @@ ARDOUR_UI::setup_transport ()
string_compose (_("Drag this tab to the desktop to show %1 in its own window\n\n"
"To re-attach the window, use the Window > %1 > Attach menu action"), recorder->name()));
Gtkmm2ext::UI::instance()->set_tip (trigger_page_visibility_button,
string_compose (_("Drag this tab to the desktop to show %1 in its own window\n\n"
"To re-attach the window, use the Window > %1 > Attach menu action"), trigger_page->name()));
Gtkmm2ext::UI::instance()->set_tip (punch_in_button, _("Start recording at auto-punch start"));
Gtkmm2ext::UI::instance()->set_tip (punch_out_button, _("Stop recording at auto-punch end"));
@ -502,6 +511,7 @@ ARDOUR_UI::setup_transport ()
button_height_size_group->add_widget (auto_return_button);
//tab selections
button_height_size_group->add_widget (trigger_page_visibility_button);
button_height_size_group->add_widget (recorder_visibility_button);
button_height_size_group->add_widget (editor_visibility_button);
button_height_size_group->add_widget (mixer_visibility_button);
@ -628,10 +638,11 @@ ARDOUR_UI::setup_transport ()
transport_table.attach (scripts_spacer, TCOL, 0, 2 , SHRINK, EXPAND|FILL, 3, 0);
++col;
transport_table.attach (recorder_visibility_button, TCOL, 0, 1 , FILL, SHRINK, hpadding, vpadding);
transport_table.attach (mixer_visibility_button, col, col + 2, 1, 2 , FILL, SHRINK, hpadding, vpadding);
transport_table.attach (recorder_visibility_button, TCOL, 0, 1 , FILL, SHRINK, hpadding, vpadding);
transport_table.attach (trigger_page_visibility_button, TCOL, 1, 2 , FILL, SHRINK, hpadding, vpadding);
++col;
transport_table.attach (editor_visibility_button, TCOL, 0, 1 , FILL, SHRINK, hpadding, vpadding);
transport_table.attach (editor_visibility_button, TCOL, 0, 1 , FILL, SHRINK, hpadding, vpadding);
transport_table.attach (mixer_visibility_button, TCOL, 1, 2 , FILL, SHRINK, hpadding, vpadding);
++col;
/* initialize */

View File

@ -48,6 +48,7 @@
#include "luawindow.h"
#include "mixer_ui.h"
#include "recorder_ui.h"
#include "trigger_page.h"
#include "keyboard.h"
#include "keyeditor.h"
#include "splash.h"
@ -134,6 +135,7 @@ ARDOUR_UI::connect_dependents_to_session (ARDOUR::Session *s)
BootMessage (_("Setup Mixer"));
mixer->set_session (s);
recorder->set_session (s);
trigger_page->set_session (s);
meterbridge->set_session (s);
/* its safe to do this now */
@ -178,6 +180,8 @@ ARDOUR_UI::tab_window_root_drop (GtkNotebook* src,
tabbable = rc_option_editor;
} else if (w == GTK_WIDGET(recorder->contents().gobj())) {
tabbable = recorder;
} else if (w == GTK_WIDGET(trigger_page->contents().gobj())) {
tabbable = trigger_page;
} else {
return 0;
}
@ -269,6 +273,12 @@ ARDOUR_UI::setup_windows ()
return -1;
}
if (create_trigger_page ()) {
error << _("UI: cannot setup recorder") << endmsg;
return -1;
}
if (create_meterbridge ()) {
error << _("UI: cannot setup meterbridge") << endmsg;
return -1;
@ -285,6 +295,7 @@ ARDOUR_UI::setup_windows ()
mixer->add_to_notebook (_tabs);
editor->add_to_notebook (_tabs);
recorder->add_to_notebook (_tabs);
trigger_page->add_to_notebook (_tabs);
top_packer.pack_start (menu_bar_base, false, false);
@ -381,6 +392,8 @@ ARDOUR_UI::setup_windows ()
_tabs.set_current_page (_tabs.page_num (rc_option_editor->contents()));
} else if (recorder && current_tab == "recorder") {
_tabs.set_current_page (_tabs.page_num (recorder->contents()));
} else if (recorder && current_tab == "trigger") {
_tabs.set_current_page (_tabs.page_num (trigger_page->contents()));
} else if (editor) {
_tabs.set_current_page (_tabs.page_num (editor->contents()));
}

View File

@ -85,6 +85,7 @@
#include "time_info_box.h"
#include "timers.h"
#include "transport_masters_dialog.h"
#include "trigger_page.h"
#include "virtual_keyboard_window.h"
#include "pbd/i18n.h"
@ -470,6 +471,10 @@ ARDOUR_UI::step_up_through_tabs ()
candidates.push_back (mixer);
}
if (trigger_page->tabbed()) {
candidates.push_back (trigger_page);
}
if (rc_option_editor->tabbed()) {
candidates.push_back (rc_option_editor);
}
@ -515,6 +520,10 @@ ARDOUR_UI::step_down_through_tabs ()
candidates.push_back (mixer);
}
if (trigger_page->tabbed()) {
candidates.push_back (trigger_page);
}
if (rc_option_editor->tabbed()) {
candidates.push_back (rc_option_editor);
}
@ -635,6 +644,7 @@ ARDOUR_UI::tabs_page_added (Widget*,guint)
mixer_visibility_button.drag_source_set (drag_target_entries);
prefs_visibility_button.drag_source_set (drag_target_entries);
recorder_visibility_button.drag_source_set (drag_target_entries);
trigger_page_visibility_button.drag_source_set (drag_target_entries);
editor_visibility_button.drag_source_set_icon (Gtkmm2ext::pixbuf_from_string (editor->name(),
Pango::FontDescription ("Sans 24"),
@ -649,9 +659,13 @@ ARDOUR_UI::tabs_page_added (Widget*,guint)
0, 0,
Gdk::Color ("red")));
recorder_visibility_button.drag_source_set_icon (Gtkmm2ext::pixbuf_from_string (recorder->name(),
Pango::FontDescription ("Sans 24"),
0, 0,
Gdk::Color ("red")));
Pango::FontDescription ("Sans 24"),
0, 0,
Gdk::Color ("red")));
trigger_page_visibility_button.drag_source_set_icon (Gtkmm2ext::pixbuf_from_string (recorder->name(),
Pango::FontDescription ("Sans 24"),
0, 0,
Gdk::Color ("red")));
}
}
@ -663,6 +677,7 @@ ARDOUR_UI::tabs_page_removed (Widget*, guint)
mixer_visibility_button.drag_source_unset ();
prefs_visibility_button.drag_source_unset ();
recorder_visibility_button.drag_source_unset ();
trigger_page_visibility_button.drag_source_unset ();
}
}
@ -685,6 +700,10 @@ ARDOUR_UI::tabs_switch (GtkNotebookPage*, guint page)
recorder_visibility_button.set_active_state (Gtkmm2ext::Off);
}
if (trigger_page && (trigger_page->tabbed() || trigger_page->tabbed_by_default())) {
trigger_page_visibility_button.set_active_state (Gtkmm2ext::Off);
}
} else if (mixer && (page == (guint) _tabs.page_num (mixer->contents()))) {
if (editor && (editor->tabbed() || editor->tabbed_by_default())) {
@ -701,6 +720,10 @@ ARDOUR_UI::tabs_switch (GtkNotebookPage*, guint page)
recorder_visibility_button.set_active_state (Gtkmm2ext::Off);
}
if (trigger_page && (trigger_page->tabbed() || trigger_page->tabbed_by_default())) {
trigger_page_visibility_button.set_active_state (Gtkmm2ext::Off);
}
} else if (page == (guint) _tabs.page_num (rc_option_editor->contents())) {
if (editor && (editor->tabbed() || editor->tabbed_by_default())) {
@ -717,6 +740,10 @@ ARDOUR_UI::tabs_switch (GtkNotebookPage*, guint page)
recorder_visibility_button.set_active_state (Gtkmm2ext::Off);
}
if (trigger_page && (trigger_page->tabbed() || trigger_page->tabbed_by_default())) {
trigger_page_visibility_button.set_active_state (Gtkmm2ext::Off);
}
} else if (page == (guint) _tabs.page_num (recorder->contents())) {
if (editor && (editor->tabbed() || editor->tabbed_by_default())) {
@ -733,6 +760,30 @@ ARDOUR_UI::tabs_switch (GtkNotebookPage*, guint page)
recorder_visibility_button.set_active_state (Gtkmm2ext::ImplicitActive);
if (trigger_page && (trigger_page->tabbed() || trigger_page->tabbed_by_default())) {
trigger_page_visibility_button.set_active_state (Gtkmm2ext::Off);
}
} else if (page == (guint) _tabs.page_num (trigger_page->contents())) {
if (editor && (editor->tabbed() || editor->tabbed_by_default())) {
editor_visibility_button.set_active_state (Gtkmm2ext::Off);
}
if (mixer && (mixer->tabbed() || mixer->tabbed_by_default())) {
mixer_visibility_button.set_active_state (Gtkmm2ext::Off);
}
if (rc_option_editor && (rc_option_editor->tabbed() || rc_option_editor->tabbed_by_default())) {
prefs_visibility_button.set_active_state (Gtkmm2ext::Off);
}
if (recorder && (recorder->tabbed() || recorder->tabbed_by_default())) {
recorder_visibility_button.set_active_state (Gtkmm2ext::Off);
}
trigger_page_visibility_button.set_active_state (Gtkmm2ext::ImplicitActive);
}
}
@ -823,6 +874,8 @@ ARDOUR_UI::tabbable_state_change (Tabbable& t)
vis_button = &prefs_visibility_button;
} else if (&t == recorder) {
vis_button = &recorder_visibility_button;
} else if (&t == trigger_page) {
vis_button = &trigger_page_visibility_button;
}
if (!vis_button) {

View File

@ -66,6 +66,7 @@
#include "luawindow.h"
#include "mixer_ui.h"
#include "recorder_ui.h"
#include "trigger_page.h"
#include "window_manager.h"
#include "global_port_matrix.h"
#include "location_ui.h"
@ -120,6 +121,18 @@ ARDOUR_UI::create_recorder ()
return 0;
}
int
ARDOUR_UI::create_trigger_page ()
{
try {
trigger_page = new TriggerPage ();
trigger_page->StateChange.connect (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_state_change));
} catch (failed_constructor& err) {
return -1;
}
return 0;
}
void
ARDOUR_UI::escape ()
{
@ -158,6 +171,7 @@ ARDOUR_UI::install_actions ()
ActionManager::register_action (main_menu_actions, X_("EditorMenu"), _("Editor"));
ActionManager::register_action (main_menu_actions, X_("PrefsMenu"), _("Preferences"));
ActionManager::register_action (main_menu_actions, X_("RecorderMenu"), _("Recorder"));
ActionManager::register_action (main_menu_actions, X_("TriggerMenu"), _("Trigger Drom"));
ActionManager::register_action (main_menu_actions, X_("DetachMenu"), _("Detach"));
ActionManager::register_action (main_menu_actions, X_("Help"), _("Help"));
ActionManager::register_action (main_menu_actions, X_("KeyMouseActions"), _("Misc. Shortcuts"));
@ -673,21 +687,25 @@ ARDOUR_UI::install_dependent_actions ()
ActionManager::register_action (common_actions, X_("hide-mixer"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), mixer));
ActionManager::register_action (common_actions, X_("hide-preferences"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), rc_option_editor));
ActionManager::register_action (common_actions, X_("hide-recorder"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), recorder));
ActionManager::register_action (common_actions, X_("hide-trigger"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), trigger_page));
ActionManager::register_action (common_actions, X_("attach-editor"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), editor));
ActionManager::register_action (common_actions, X_("attach-mixer"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), mixer));
ActionManager::register_action (common_actions, X_("attach-preferences"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), rc_option_editor));
ActionManager::register_action (common_actions, X_("attach-recorder"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), recorder));
ActionManager::register_action (common_actions, X_("attach-trigger"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), trigger_page));
ActionManager::register_action (common_actions, X_("detach-editor"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), editor));
ActionManager::register_action (common_actions, X_("detach-mixer"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), mixer));
ActionManager::register_action (common_actions, X_("detach-preferences"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), rc_option_editor));
ActionManager::register_action (common_actions, X_("detach-recorder"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), recorder));
ActionManager::register_action (common_actions, X_("detach-trigger"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), trigger_page));
ActionManager::register_action (common_actions, X_("show-editor"), _("Show Editor"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), editor));
ActionManager::register_action (common_actions, X_("show-mixer"), _("Show Mixer"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), mixer));
ActionManager::register_action (common_actions, X_("show-preferences"), _("Show"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), rc_option_editor));
ActionManager::register_action (common_actions, X_("show-recorder"), _("Show Recorder"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), recorder));
ActionManager::register_action (common_actions, X_("show-trigger"), _("Show Trigger Drom"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), trigger_page));
/* These "change" actions are not intended to be used inside menus, but
are for the tab/window control buttons, which have somewhat odd
@ -697,6 +715,7 @@ ARDOUR_UI::install_dependent_actions ()
ActionManager::register_action (common_actions, X_("change-mixer-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::button_change_tabbable_visibility), mixer));
ActionManager::register_action (common_actions, X_("change-preferences-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::button_change_tabbable_visibility), rc_option_editor));
ActionManager::register_action (common_actions, X_("change-recorder-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::button_change_tabbable_visibility), recorder));
ActionManager::register_action (common_actions, X_("change-trigger-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::button_change_tabbable_visibility), trigger_page));
/* These "change" actions are not intended to be used inside menus, but
are for the tab/window control key bindings, which have somewhat odd
@ -706,6 +725,7 @@ ARDOUR_UI::install_dependent_actions ()
ActionManager::register_action (common_actions, X_("key-change-mixer-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::key_change_tabbable_visibility), mixer));
ActionManager::register_action (common_actions, X_("key-change-preferences-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::key_change_tabbable_visibility), rc_option_editor));
ActionManager::register_action (common_actions, X_("key-change-recorder-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::key_change_tabbable_visibility), recorder));
ActionManager::register_action (common_actions, X_("key-change-trigger-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::key_change_tabbable_visibility), trigger_page));
ActionManager::register_action (common_actions, X_("previous-tab"), _("Previous Tab"), sigc::mem_fun (*this, &ARDOUR_UI::step_up_through_tabs));
ActionManager::register_action (common_actions, X_("next-tab"), _("Next Tab"), sigc::mem_fun (*this, &ARDOUR_UI::step_down_through_tabs));
@ -895,6 +915,8 @@ ARDOUR_UI::save_ardour_state ()
current_tab = "mixer";
} else if (current_page_number == _tabs.page_num (recorder->contents())) {
current_tab = "recorder";
} else if (current_page_number == _tabs.page_num (trigger_page->contents())) {
current_tab = "trigger";
} else if (current_page_number == _tabs.page_num (rc_option_editor->contents())) {
current_tab = "preferences";
}
@ -918,6 +940,7 @@ ARDOUR_UI::save_ardour_state ()
XMLNode& bnode (meterbridge->get_state());
XMLNode& pnode (rc_option_editor->get_state());
XMLNode& rnode (recorder->get_state());
XMLNode& tnode (trigger_page->get_state());
Config->add_extra_xml (*window_node);
Config->add_extra_xml (audio_midi_setup->get_state());
@ -935,6 +958,7 @@ ARDOUR_UI::save_ardour_state ()
_session->add_instant_xml (pnode);
_session->add_instant_xml (bnode);
_session->add_instant_xml (rnode);
_session->add_instant_xml (tnode);
if (location_ui) {
_session->add_instant_xml (location_ui->ui().get_state ());
}
@ -950,6 +974,7 @@ ARDOUR_UI::save_ardour_state ()
Config->add_instant_xml (pnode);
Config->add_instant_xml (bnode);
Config->add_instant_xml (rnode);
Config->add_instant_xml (tnode);
if (location_ui) {
Config->add_instant_xml (location_ui->ui().get_state ());
}
@ -965,6 +990,7 @@ ARDOUR_UI::save_ardour_state ()
delete &bnode;
delete &pnode;
delete &rnode;
delete &tnode;
Keyboard::save_keybindings ();
}

View File

@ -328,6 +328,24 @@ ARDOUR_UI::recorder_settings () const
return node;
}
XMLNode*
ARDOUR_UI::trigger_page_settings () const
{
XMLNode* node = 0;
if (_session) {
node = _session->instant_xml(X_("TriggerPage"));
} else {
node = Config->instant_xml(X_("TriggerPage"));
}
if (!node) {
node = new XMLNode (X_("TriggerPage"));
}
return node;
}
XMLNode*
ARDOUR_UI::keyboard_settings () const
{

183
gtk2_ardour/trigger_page.cc Normal file
View File

@ -0,0 +1,183 @@
/*
* Copyright (C) 2021 Robin Gareus <robin@gareus.org>
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifdef WAF_BUILD
#include "gtk2ardour-config.h"
#endif
#include <gtkmm/label.h>
#include "gtkmm2ext/gtk_ui.h"
#include "gtkmm2ext/keyboard.h"
#include "gtkmm2ext/window_title.h"
#include "actions.h"
#include "ardour_ui.h"
#include "gui_thread.h"
#include "public_editor.h"
#include "trigger_page.h"
#include "ui_config.h"
#include "utils.h"
#include "pbd/i18n.h"
using namespace ARDOUR;
using namespace Gtkmm2ext;
using namespace Gtk;
using namespace std;
TriggerPage::TriggerPage ()
: Tabbable (_content, _("Trigger Drom"), X_("trigger"))
{
load_bindings ();
register_actions ();
/* Top-level VBox */
Label* l = manage (new Label ("Hello World!"));
_content.pack_start (*l, true, true);
_content.show ();
/* setup keybidings */
_content.set_data ("ardour-bindings", bindings);
/* subscribe to signals */
Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&TriggerPage::parameter_changed, this, _1), gui_context ());
/* init */
update_title ();
}
TriggerPage::~TriggerPage ()
{
}
Gtk::Window*
TriggerPage::use_own_window (bool and_fill_it)
{
bool new_window = !own_window ();
Gtk::Window* win = Tabbable::use_own_window (and_fill_it);
if (win && new_window) {
win->set_name ("TriggerWindow");
ARDOUR_UI::instance ()->setup_toplevel_window (*win, _("Trigger Drom"), this);
win->signal_event ().connect (sigc::bind (sigc::ptr_fun (&Keyboard::catch_user_event_for_pre_dialog_focus), win));
win->set_data ("ardour-bindings", bindings);
update_title ();
#if 0 // TODO
if (!win->get_focus()) {
win->set_focus (scroller);
}
#endif
}
contents ().show ();
return win;
}
XMLNode&
TriggerPage::get_state ()
{
XMLNode* node = new XMLNode (X_("TriggerPage"));
node->add_child_nocopy (Tabbable::get_state ());
return *node;
}
int
TriggerPage::set_state (const XMLNode& node, int version)
{
return Tabbable::set_state (node, version);
}
void
TriggerPage::load_bindings ()
{
bindings = Bindings::get_bindings (X_("TriggerPage"));
}
void
TriggerPage::register_actions ()
{
Glib::RefPtr<ActionGroup> group = ActionManager::create_action_group (bindings, X_("TriggerPage"));
}
void
TriggerPage::set_session (Session* s)
{
SessionHandlePtr::set_session (s);
if (!_session) {
return;
}
XMLNode* node = ARDOUR_UI::instance()->trigger_page_settings ();
set_state (*node, Stateful::loading_state_version);
_session->DirtyChanged.connect (_session_connections, invalidator (*this), boost::bind (&TriggerPage::update_title, this), gui_context ());
_session->StateSaved.connect (_session_connections, invalidator (*this), boost::bind (&TriggerPage::update_title, this), gui_context ());
_session->config.ParameterChanged.connect (_session_connections, invalidator (*this), boost::bind (&TriggerPage::parameter_changed, this, _1), gui_context ());
update_title ();
}
void
TriggerPage::session_going_away ()
{
ENSURE_GUI_THREAD (*this, &TriggerPage::session_going_away);
SessionHandlePtr::session_going_away ();
update_title ();
}
void
TriggerPage::update_title ()
{
if (!own_window ()) {
return;
}
if (_session) {
string n;
if (_session->snap_name () != _session->name ()) {
n = _session->snap_name ();
} else {
n = _session->name ();
}
if (_session->dirty ()) {
n = "*" + n;
}
WindowTitle title (n);
title += S_("Window|Trigger");
title += Glib::get_application_name ();
own_window ()->set_title (title.get_string ());
} else {
WindowTitle title (S_("Window|Trigger"));
title += Glib::get_application_name ();
own_window ()->set_title (title.get_string ());
}
}
void
TriggerPage::parameter_changed (string const& p)
{
}

View File

@ -0,0 +1,56 @@
/*
* Copyright (C) 2021 Robin Gareus <robin@gareus.org>
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __gtk_ardour_trigger_page_h__
#define __gtk_ardour_trigger_page_h__
#include <gtkmm/box.h>
#include "ardour/session_handle.h"
#include "gtkmm2ext/bindings.h"
#include "gtkmm2ext/cairo_widget.h"
#include "widgets/pane.h"
#include "widgets/tabbable.h"
class TriggerPage : public ArdourWidgets::Tabbable, public ARDOUR::SessionHandlePtr, public PBD::ScopedConnectionList
{
public:
TriggerPage ();
~TriggerPage ();
void set_session (ARDOUR::Session*);
XMLNode& get_state ();
int set_state (const XMLNode&, int /* version */);
Gtk::Window* use_own_window (bool and_fill_it);
private:
void load_bindings ();
void register_actions ();
void update_title ();
void session_going_away ();
void parameter_changed (std::string const&);
Gtkmm2ext::Bindings* bindings;
Gtk::VBox _content;
};
#endif /* __gtk_ardour_trigger_page_h__ */

View File

@ -297,6 +297,7 @@ gtk2_ardour_sources = [
'transport_control_ui.cc',
'transport_masters_dialog.cc',
'transpose_dialog.cc',
'trigger_page.cc',
'trigger_ui.cc',
'triggerbox_ui.cc',
'ui_config.cc',