mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 00:04:56 +01:00
toolbar creation from text files
This commit is contained in:
parent
61138a9ef8
commit
c20ed6b9f6
2 changed files with 57 additions and 20 deletions
|
|
@ -1,9 +1,12 @@
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
#include <glibmm.h>
|
#include <glibmm.h>
|
||||||
#include <gtkmm/main.h>
|
#include <gtkmm/main.h>
|
||||||
#include <gtkmm/box.h>
|
#include <gtkmm/box.h>
|
||||||
#include <gtkmm/window.h>
|
#include <gtkmm/window.h>
|
||||||
|
|
||||||
#include "pbd/debug.h"
|
#include "pbd/debug.h"
|
||||||
|
#include "pbd/enumwriter.h"
|
||||||
#include "pbd/error.h"
|
#include "pbd/error.h"
|
||||||
#include "pbd/failed_constructor.h"
|
#include "pbd/failed_constructor.h"
|
||||||
#include "pbd/pthread_utils.h"
|
#include "pbd/pthread_utils.h"
|
||||||
|
|
@ -31,6 +34,7 @@
|
||||||
#include "canvas/widget.h"
|
#include "canvas/widget.h"
|
||||||
|
|
||||||
#include "ardour_button.h"
|
#include "ardour_button.h"
|
||||||
|
#include "enums.h"
|
||||||
#include "ui_config.h"
|
#include "ui_config.h"
|
||||||
|
|
||||||
#include "pbd/i18n.h"
|
#include "pbd/i18n.h"
|
||||||
|
|
@ -95,15 +99,21 @@ LogReceiver::receive (Transmitter::Channel chn, const char * str)
|
||||||
/* ***************************************************************************/
|
/* ***************************************************************************/
|
||||||
/* ***************************************************************************/
|
/* ***************************************************************************/
|
||||||
|
|
||||||
ArdourButton*
|
void
|
||||||
make_transport_button (std::string const & action, Gtkmm2ext::ArdourIcon::Icon icon)
|
setup_action_button (ArdourButton& button, std::string const & action, Gtkmm2ext::ArdourIcon::Icon icon, std::string const & button_theme_name)
|
||||||
{
|
{
|
||||||
ArdourButton* button = new ArdourButton;
|
button.set_name (button_theme_name + string (" button"));
|
||||||
button->set_name ("transport button");
|
|
||||||
Glib::RefPtr<Gtk::Action> act;
|
Glib::RefPtr<Gtk::Action> act;
|
||||||
act = ActionManager::get_action (action.c_str());
|
act = ActionManager::get_action (action.c_str());
|
||||||
button->set_related_action (act);
|
button.set_related_action (act);
|
||||||
button->set_icon (icon);
|
button.set_icon (icon);
|
||||||
|
}
|
||||||
|
|
||||||
|
ArdourButton*
|
||||||
|
make_action_button (std::string const & action, Gtkmm2ext::ArdourIcon::Icon icon, std::string const & button_theme_name)
|
||||||
|
{
|
||||||
|
ArdourButton* button = new ArdourButton;
|
||||||
|
setup_action_button (*button, action, icon, button_theme_name);
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -178,23 +188,48 @@ CANVAS_UI::initialize_canvas (ArdourCanvas::Canvas& canvas)
|
||||||
grid = new ArdourCanvas::Grid (scroll_group);
|
grid = new ArdourCanvas::Grid (scroll_group);
|
||||||
|
|
||||||
grid->set_padding (3.0);
|
grid->set_padding (3.0);
|
||||||
|
|
||||||
grid->set_row_spacing (3.0);
|
grid->set_row_spacing (3.0);
|
||||||
grid->set_col_spacing (3.0);
|
grid->set_col_spacing (3.0);
|
||||||
grid->set_homogenous (true);
|
grid->set_homogenous (true);
|
||||||
|
|
||||||
ArdourCanvas::Widget* w1 = new ArdourCanvas::Widget (&canvas, *make_transport_button ("Transport/Roll", ArdourIcon::TransportPlay));
|
std::ifstream toolbar_spec;
|
||||||
CANVAS_DEBUG_NAME (w1, "w1");
|
double col = 0;
|
||||||
grid->place (w1, 0, 0);
|
double row = 0;
|
||||||
ArdourCanvas::Widget* w2 = new ArdourCanvas::Widget (&canvas, *make_transport_button ("Transport/Stop", ArdourIcon::TransportStop));
|
|
||||||
CANVAS_DEBUG_NAME (w2, "w2");
|
toolbar_spec.open ("/tmp/t1", ios::in);
|
||||||
grid->place (w2, 1, 0);
|
|
||||||
ArdourCanvas::Widget* w3 = new ArdourCanvas::Widget (&canvas, *make_transport_button ("Transport/Record", ArdourIcon::RecButton));
|
if (!toolbar_spec) {
|
||||||
CANVAS_DEBUG_NAME (w3, "w3");
|
return;
|
||||||
grid->place (w3, 2, 0);
|
}
|
||||||
ArdourCanvas::Widget* w4 = new ArdourCanvas::Widget (&canvas, *make_transport_button ("Transport/Loop", ArdourIcon::TransportLoop));
|
|
||||||
CANVAS_DEBUG_NAME (w4, "w4");
|
while (toolbar_spec) {
|
||||||
grid->place (w4, 3, 0);
|
string action;
|
||||||
|
string icon;
|
||||||
|
string theme_name;
|
||||||
|
|
||||||
|
toolbar_spec >> action;
|
||||||
|
if (action.empty()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
toolbar_spec >> icon;
|
||||||
|
if (icon.empty()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
toolbar_spec >> theme_name;
|
||||||
|
if (theme_name.empty()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Gtkmm2ext::ArdourIcon::Icon i = (ArdourIcon::Icon) string_2_enum (string ("ArdourIcon::") + icon, i);
|
||||||
|
|
||||||
|
ArdourCanvas::Widget* w = new ArdourCanvas::Widget
|
||||||
|
(&canvas, *make_action_button (action, i, theme_name));
|
||||||
|
grid->place (w, col, row);
|
||||||
|
col++;
|
||||||
|
}
|
||||||
|
|
||||||
|
toolbar_spec.close ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -240,6 +275,8 @@ int main (int argc, char **argv)
|
||||||
log_receiver.listen_to (fatal);
|
log_receiver.listen_to (fatal);
|
||||||
log_receiver.listen_to (warning);
|
log_receiver.listen_to (warning);
|
||||||
|
|
||||||
|
setup_gtk_ardour_enums ();
|
||||||
|
|
||||||
if (UIConfiguration::instance().pre_gui_init ()) {
|
if (UIConfiguration::instance().pre_gui_init ()) {
|
||||||
error << _("Could not complete pre-GUI initialization") << endmsg;
|
error << _("Could not complete pre-GUI initialization") << endmsg;
|
||||||
exit (1);
|
exit (1);
|
||||||
|
|
|
||||||
|
|
@ -519,7 +519,7 @@ def build(bld):
|
||||||
obj.linkflags = ''
|
obj.linkflags = ''
|
||||||
obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG CURL DL GTKMM CANVAS FFTW3F LO TAGLIB XML '
|
obj.uselib = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG CURL DL GTKMM CANVAS FFTW3F LO TAGLIB XML '
|
||||||
# obj.source += [ 'canvas_test.cc', ]
|
# obj.source += [ 'canvas_test.cc', ]
|
||||||
obj.source += [ 'toolbar_test.cc', ]
|
obj.source += [ 'toolbar_test.cc', 'enums.cc']
|
||||||
|
|
||||||
|
|
||||||
if bld.is_defined('WINDOWS_VST_SUPPORT') and bld.env['build_target'] != 'mingw':
|
if bld.is_defined('WINDOWS_VST_SUPPORT') and bld.env['build_target'] != 'mingw':
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue