Bootstrap RTA Window

This commit is contained in:
Robin Gareus
2025-03-24 20:51:13 +01:00
parent 6609ea1564
commit 76ba840be0
8 changed files with 232 additions and 2 deletions

View File

@@ -689,6 +689,9 @@
</menu>
<!-- Common Ardour Widows (all toggle) !-->
<menuitem action='toggle-meterbridge'/>
#ifndef NDEBUG
<menuitem action='toggle-rtawindow'/>
#endif
<menuitem action='toggle-locations'/>
<menuitem action='toggle-big-clock'/>
<menuitem action='toggle-big-transport'/>

View File

@@ -169,6 +169,7 @@
#include "recorder_ui.h"
#include "route_time_axis.h"
#include "route_params_ui.h"
#include "rta_window.h"
#include "save_as_dialog.h"
#include "save_template_dialog.h"
#include "script_selector.h"
@@ -328,6 +329,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
, midi_port_matrix (X_("midi-connection-manager"), _("MIDI Connections"), std::bind (&ARDOUR_UI::create_global_port_matrix, this, ARDOUR::DataType::MIDI))
, key_editor (X_("key-editor"), _("Keyboard Shortcuts"), std::bind (&ARDOUR_UI::create_key_editor, this))
, luawindow (X_("luawindow"), S_("Window|Scripting"), std::bind (&ARDOUR_UI::create_luawindow, this))
, rtawindow (X_("rtawindow"), S_("Window|Realtime Analyzer"), std::bind (&ARDOUR_UI::create_rtawindow, this))
, video_server_process (0)
, have_configure_timeout (false)
, last_configure_time (0)
@@ -485,6 +487,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
audio_port_matrix.set_state (*ui_xml, 0);
midi_port_matrix.set_state (*ui_xml, 0);
luawindow.set_state (*ui_xml, 0);
rtawindow.set_state (*ui_xml, 0);
export_video_dialog.set_state (*ui_xml, 0);
lua_script_window.set_state (*ui_xml, 0);
idleometer.set_state (*ui_xml, 0);
@@ -519,6 +522,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
WM::Manager::instance().register_window (&audio_port_matrix);
WM::Manager::instance().register_window (&midi_port_matrix);
WM::Manager::instance().register_window (&luawindow);
WM::Manager::instance().register_window (&rtawindow);
WM::Manager::instance().register_window (&idleometer);
WM::Manager::instance().register_window (&io_plugin_window);
WM::Manager::instance().register_window (&plugin_manager_ui);

View File

@@ -117,6 +117,7 @@
#include "rc_option_editor.h"
#include "route_dialogs.h"
#include "route_params_ui.h"
#include "rta_window.h"
#include "session_option_editor.h"
#include "speaker_dialog.h"
#include "transport_masters_dialog.h"
@@ -144,6 +145,7 @@ class IdleOMeter;
class IOPluginWindow;
class PluginDSPLoadWindow;
class PluginManagerUI;
class RTAWindow;
class DspStatisticsWindow;
class TransportMastersWindow;
class VirtualKeyboardWindow;
@@ -286,6 +288,7 @@ public:
void toggle_keep_tearoffs();
void show_plugin_manager();
void show_lua_window();
void show_realtime_analyzer();
void reset_focus (Gtk::Widget*);
@@ -701,6 +704,7 @@ private:
WM::ProxyWithConstructor<GlobalPortMatrixWindow> midi_port_matrix;
WM::ProxyWithConstructor<KeyEditor> key_editor;
WM::ProxyWithConstructor<LuaWindow> luawindow;
WM::ProxyWithConstructor<RTAWindow> rtawindow;
/* creator methods */
@@ -714,6 +718,7 @@ private:
GlobalPortMatrixWindow* create_global_port_matrix (ARDOUR::DataType);
KeyEditor* create_key_editor ();
LuaWindow* create_luawindow ();
RTAWindow* create_rtawindow ();
ARDOUR::SystemExec *video_server_process;

View File

@@ -79,6 +79,7 @@
#include "rc_option_editor.h"
#include "recorder_ui.h"
#include "route_params_ui.h"
#include "rta_window.h"
#include "shuttle_control.h"
#include "session_option_editor.h"
#include "speaker_dialog.h"
@@ -980,6 +981,13 @@ ARDOUR_UI::create_luawindow ()
return luawindow;
}
RTAWindow*
ARDOUR_UI::create_rtawindow ()
{
RTAWindow* rtawindow = new RTAWindow ();
return rtawindow;
}
void
ARDOUR_UI::handle_locations_change (Location *)
{
@@ -1055,6 +1063,13 @@ ARDOUR_UI::show_plugin_manager ()
tact->set_active();
}
void
ARDOUR_UI::show_realtime_analyzer ()
{
Glib::RefPtr<ToggleAction> tact = ActionManager::get_toggle_action ("Window", "toggle-rtawindow");
tact->set_active();
}
bool
ARDOUR_UI::timecode_button_press (GdkEventButton* ev)
{

View File

@@ -76,6 +76,7 @@
#include "location_ui.h"
#include "main_clock.h"
#include "rc_option_editor.h"
#include "rta_window.h"
#include "virtual_keyboard_window.h"
#include <gtkmm2ext/application.h>
@@ -1047,6 +1048,9 @@ ARDOUR_UI::save_ardour_state ()
if (location_ui) {
_session->add_instant_xml (location_ui->ui().get_state ());
}
if (rtawindow) {
_session->add_instant_xml (rtawindow->get_state ());
}
if (virtual_keyboard_window) {
XMLNode& vkstate (virtual_keyboard_window->get_state());
vkstate.add_child_nocopy (virtual_keyboard_window.get_state ());
@@ -1067,6 +1071,9 @@ ARDOUR_UI::save_ardour_state ()
if (location_ui) {
Config->add_instant_xml (location_ui->ui().get_state ());
}
if (rtawindow) {
Config->add_instant_xml (rtawindow->get_state ());
}
if (virtual_keyboard_window) {
XMLNode& vkstate (virtual_keyboard_window->get_state());
vkstate.add_child_nocopy (virtual_keyboard_window.get_state ());

141
gtk2_ardour/rta_window.cc Normal file
View File

@@ -0,0 +1,141 @@
/*
* Copyright (C) 2025 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 "ardour/session.h"
#include "gtkmm2ext/window_title.h"
#include "gui_thread.h"
#include "rta_window.h"
#include "timers.h"
#include "utils.h"
#include "pbd/i18n.h"
using namespace ARDOUR;
RTAWindow::RTAWindow ()
: ArdourWindow (_("Realtime Perceptual Analyzer"))
{
_darea.add_events (Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::POINTER_MOTION_MASK);
_darea.signal_size_request ().connect (sigc::mem_fun (*this, &RTAWindow::darea_size_request));
_darea.signal_size_allocate ().connect (sigc::mem_fun (*this, &RTAWindow::darea_size_allocate));
_darea.signal_expose_event ().connect (sigc::mem_fun (*this, &RTAWindow::darea_expose_event));
#if 0
_darea.signal_button_press_event ().connect (sigc::mem_fun (*this, &RTAWindow::darea_button_press_event));
_darea.signal_button_release_event ().connect (sigc::mem_fun (*this, &RTAWindow::darea_button_release_event));
_darea.signal_motion_notify_event ().connect (sigc::mem_fun (*this, &RTAWindow::darea_motion_notify_event));
#endif
_vpacker.pack_start (_darea, true, true);
add (_vpacker);
set_border_width (4);
_vpacker.show_all ();
}
XMLNode&
RTAWindow::get_state () const
{
XMLNode* node = new XMLNode ("RTAWindow");
return *node;
}
void
RTAWindow::set_session (ARDOUR::Session* s)
{
if (!s) {
return;
}
/* only call SessionHandlePtr::set_session if session is not NULL,
* otherwise RTAWindow::session_going_away will never be invoked.
*/
ArdourWindow::set_session (s);
update_title ();
_session->DirtyChanged.connect (_session_connections, invalidator (*this), std::bind (&RTAWindow::update_title, this), gui_context ());
}
void
RTAWindow::session_going_away ()
{
ENSURE_GUI_THREAD (*this, &RTAWindow::session_going_away);
ArdourWindow::session_going_away ();
_session = 0;
update_title ();
}
void
RTAWindow::update_title ()
{
if (_session) {
std::string n;
if (_session->snap_name () != _session->name ()) {
n = _session->snap_name ();
} else {
n = _session->name ();
}
if (_session->dirty ()) {
n = "*" + n;
}
Gtkmm2ext::WindowTitle title (n);
title += _("Realtime Perceptual Analyzer");
title += Glib::get_application_name ();
set_title (title.get_string ());
} else {
Gtkmm2ext::WindowTitle title (_("Realtime Perceptual Analyzer"));
title += Glib::get_application_name ();
set_title (title.get_string ());
}
}
void
RTAWindow::darea_size_allocate (Gtk::Allocation&)
{
}
void
RTAWindow::darea_size_request (Gtk::Requisition* req)
{
req->width = 300;
req->height = 300;
}
bool
RTAWindow::darea_expose_event (GdkEventExpose* ev)
{
Gtk::Allocation a = _darea.get_allocation ();
double const width = a.get_width ();
double const height = a.get_height ();
Cairo::RefPtr<Cairo::Context> cr = _darea.get_window()->create_cairo_context ();
cr->rectangle (ev->area.x, ev->area.y, ev->area.width, ev->area.height);
cr->clip ();
return true;
}

51
gtk2_ardour/rta_window.h Normal file
View File

@@ -0,0 +1,51 @@
/*
* Copyright (C) 2025 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.
*/
#pragma once
#include <glibmm/thread.h>
#include <ytkmm/box.h>
#include <ytkmm/drawingarea.h>
#include "ardour/ardour.h"
#include "ardour/session_handle.h"
#include "ardour/types.h"
#include "ardour_window.h"
class RTAWindow
: public ArdourWindow
{
public:
RTAWindow ();
void set_session (ARDOUR::Session*);
XMLNode& get_state () const;
private:
void session_going_away ();
void update_title ();
void on_theme_changed ();
void darea_size_request (Gtk::Requisition*);
void darea_size_allocate (Gtk::Allocation&);
bool darea_expose_event (GdkEventExpose*);
Gtk::VBox _vpacker;
Gtk::DrawingArea _darea;
};

View File

@@ -268,6 +268,7 @@ gtk2_ardour_sources = [
'route_processor_selection.cc',
'route_time_axis.cc',
'route_ui.cc',
'rta_window.cc',
'ruler_dialog.cc',
'save_as_dialog.cc',
'save_template_dialog.cc',
@@ -863,9 +864,12 @@ def build(bld):
if bld.is_defined('PTFORMAT'):
menus_argv += [ '-DPTFORMAT' ]
if bld.is_defined('MIXBUS') or Options.options.debug:
if bld.is_defined('MIXBUS') or bld.env['DEBUG']:
menus_argv += [ '-DVAPOR' ]
if not not bld.env['DEBUG']:
menus_argv += [ '-DNDEBUG' ]
# always build all versions of the menu definitions
# so that we can try them out with different program builds.
@@ -874,7 +878,7 @@ def build(bld):
obj.command_is_external = True
obj.no_inputs = True
obj.argv = menus_argv
obj.dep_vars = ['PTFORMAT', 'MIXBUS', 'WINDOWS', 'debug']
obj.dep_vars = ['PTFORMAT', 'MIXBUS', 'WINDOWS', 'DEBUG']
if bld.is_defined('LIVETRAX'):
obj.stdin = 'livetrax.menus.in'
else: