audio clock switchover part2: remove most egregious include-time dependency on audio_clock.h, and alter API for a few utilities along the way

git-svn-id: svn://localhost/ardour2/branches/3.0@9673 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-06-02 17:50:37 +00:00
parent add91aa2d7
commit 83f385d263
25 changed files with 161 additions and 148 deletions

View file

@ -944,12 +944,14 @@ style "transport_clock_display"
{ {
font_name = "@FONT_BOLD_BIGGER@" font_name = "@FONT_BOLD_BIGGER@"
fg[NORMAL] = darker (@@COLPREFIX@_contrasting_indicator)
fg[ACTIVE] = darker(@@COLPREFIX@_bright_indicator) fg[ACTIVE] = darker(@@COLPREFIX@_bright_indicator)
fg[SELECTED] = darker(@@COLPREFIX@_bright_indicator) fg[SELECTED] = darker(@@COLPREFIX@_bright_indicator)
fg[PRELIGHT] = darker(@@COLPREFIX@_bright_indicator) fg[PRELIGHT] = darker(@@COLPREFIX@_bright_indicator)
fg[INSENSITIVE] = darker(@@COLPREFIX@_bright_indicator) fg[INSENSITIVE] = darker(@@COLPREFIX@_bright_indicator)
text[NORMAL] = darker (@@COLPREFIX@_contrasting_indicator)
text[ACTIVE] = darker (@@COLPREFIX@_bright_indicator)
base[NORMAL] = @@COLPREFIX@_darkest base[NORMAL] = @@COLPREFIX@_darkest
base[ACTIVE] = @@COLPREFIX@_darkest base[ACTIVE] = @@COLPREFIX@_darkest
bg[NORMAL] = @@COLPREFIX@_darkest bg[NORMAL] = @@COLPREFIX@_darkest
@ -963,6 +965,8 @@ style "transport_clock_display_delta" = "transport_clock_display"
style "tempo_meter_clock_display" = "very_small_text" style "tempo_meter_clock_display" = "very_small_text"
{ {
text[NORMAL] = @@COLPREFIX@_fg
text[ACTIVE] = @@COLPREFIX@_somewhat_bright_indicator
fg[NORMAL] = @@COLPREFIX@_fg fg[NORMAL] = @@COLPREFIX@_fg
fg[ACTIVE] = @@COLPREFIX@_somewhat_bright_indicator fg[ACTIVE] = @@COLPREFIX@_somewhat_bright_indicator
fg[SELECTED] = @@COLPREFIX@_bright_indicator fg[SELECTED] = @@COLPREFIX@_bright_indicator
@ -974,6 +978,8 @@ style "tempo_meter_clock_display" = "very_small_text"
style "default_clock_display" = "medium_text" style "default_clock_display" = "medium_text"
{ {
text[NORMAL] = @@COLPREFIX@_contrasting_indicator
text[ACTIVE] = @@COLPREFIX@_bright_indicator
fg[NORMAL] = @@COLPREFIX@_contrasting_indicator fg[NORMAL] = @@COLPREFIX@_contrasting_indicator
fg[ACTIVE] = @@COLPREFIX@_bright_indicator fg[ACTIVE] = @@COLPREFIX@_bright_indicator
fg[SELECTED] = @@COLPREFIX@_bright_indicator fg[SELECTED] = @@COLPREFIX@_bright_indicator
@ -986,6 +992,8 @@ style "default_clock_display" = "medium_text"
style "white_on_black_clock_display" = "medium_text" style "white_on_black_clock_display" = "medium_text"
{ {
text[NORMAL] = @@COLPREFIX@_fg
text[ACTIVE] = @@COLPREFIX@_bright_indicator
fg[NORMAL] = @@COLPREFIX@_fg fg[NORMAL] = @@COLPREFIX@_fg
fg[ACTIVE] = @@COLPREFIX@_bright_indicator fg[ACTIVE] = @@COLPREFIX@_bright_indicator
fg[SELECTED] = @@COLPREFIX@_bright_indicator fg[SELECTED] = @@COLPREFIX@_bright_indicator

View file

@ -131,52 +131,52 @@ bool could_be_a_valid_path (const string& path);
ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[]) ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
: Gtkmm2ext::UI (PROGRAM_NAME, argcp, argvp), : Gtkmm2ext::UI (PROGRAM_NAME, argcp, argvp)
primary_clock (X_("primary"), false, X_("TransportClockDisplay"), true, true, false, true), , primary_clock (new AudioClock (X_("primary"), false, X_("TransportClockDisplay"), true, true, false, true))
secondary_clock (X_("secondary"), false, X_("SecondaryClockDisplay"), true, true, false, true), , secondary_clock (new AudioClock (X_("secondary"), false, X_("SecondaryClockDisplay"), true, true, false, true))
preroll_clock (X_("preroll"), false, X_("PreRollClock"), true, false, true), , preroll_clock (new AudioClock (X_("preroll"), false, X_("PreRollClock"), true, false, true))
postroll_clock (X_("postroll"), false, X_("PostRollClock"), true, false, true), , postroll_clock (new AudioClock (X_("postroll"), false, X_("PostRollClock"), true, false, true))
/* preroll stuff */ /* preroll stuff */
preroll_button (_("pre\nroll")), , preroll_button (_("pre\nroll"))
postroll_button (_("post\nroll")), , postroll_button (_("post\nroll"))
/* big clock */ /* big clock */
big_clock (X_("bigclock"), false, "BigClockNonRecording", true, true, false, false), , big_clock (new AudioClock (X_("bigclock"), false, "BigClockNonRecording", true, true, false, false))
/* transport */ /* transport */
roll_controllable (new TransportControllable ("transport roll", *this, TransportControllable::Roll)), , roll_controllable (new TransportControllable ("transport roll", *this, TransportControllable::Roll))
stop_controllable (new TransportControllable ("transport stop", *this, TransportControllable::Stop)), , stop_controllable (new TransportControllable ("transport stop", *this, TransportControllable::Stop))
goto_start_controllable (new TransportControllable ("transport goto start", *this, TransportControllable::GotoStart)), , goto_start_controllable (new TransportControllable ("transport goto start", *this, TransportControllable::GotoStart))
goto_end_controllable (new TransportControllable ("transport goto end", *this, TransportControllable::GotoEnd)), , goto_end_controllable (new TransportControllable ("transport goto end", *this, TransportControllable::GotoEnd))
auto_loop_controllable (new TransportControllable ("transport auto loop", *this, TransportControllable::AutoLoop)), , auto_loop_controllable (new TransportControllable ("transport auto loop", *this, TransportControllable::AutoLoop))
play_selection_controllable (new TransportControllable ("transport play selection", *this, TransportControllable::PlaySelection)), , play_selection_controllable (new TransportControllable ("transport play selection", *this, TransportControllable::PlaySelection))
rec_controllable (new TransportControllable ("transport rec-enable", *this, TransportControllable::RecordEnable)), , rec_controllable (new TransportControllable ("transport rec-enable", *this, TransportControllable::RecordEnable))
roll_button (roll_controllable), , roll_button (roll_controllable)
stop_button (stop_controllable), , stop_button (stop_controllable)
goto_start_button (goto_start_controllable), , goto_start_button (goto_start_controllable)
goto_end_button (goto_end_controllable), , goto_end_button (goto_end_controllable)
auto_loop_button (auto_loop_controllable), , auto_loop_button (auto_loop_controllable)
play_selection_button (play_selection_controllable), , play_selection_button (play_selection_controllable)
rec_button (rec_controllable), , rec_button (rec_controllable)
punch_in_button (_("Punch In")), , punch_in_button (_("Punch In"))
punch_out_button (_("Punch Out")), , punch_out_button (_("Punch Out"))
auto_return_button (_("Auto Return")), , auto_return_button (_("Auto Return"))
auto_play_button (_("Auto Play")), , auto_play_button (_("Auto Play"))
auto_input_button (_("Auto Input")), , auto_input_button (_("Auto Input"))
click_button (_("Click")), , click_button (_("Click"))
time_master_button (_("time\nmaster")), , time_master_button (_("time\nmaster"))
auditioning_alert_button (_("AUDITION")), , auditioning_alert_button (_("AUDITION"))
solo_alert_button (_("SOLO")), , solo_alert_button (_("SOLO"))
error_log_button (_("Errors")) , error_log_button (_("Errors"))
{ {
using namespace Gtk::Menu_Helpers; using namespace Gtk::Menu_Helpers;
@ -442,11 +442,11 @@ ARDOUR_UI::post_engine ()
/* set default clock modes */ /* set default clock modes */
if (Profile->get_sae()) { if (Profile->get_sae()) {
primary_clock.set_mode (AudioClock::BBT); primary_clock->set_mode (AudioClock::BBT);
secondary_clock.set_mode (AudioClock::MinSec); secondary_clock->set_mode (AudioClock::MinSec);
} else { } else {
primary_clock.set_mode (AudioClock::Timecode); primary_clock->set_mode (AudioClock::Timecode);
secondary_clock.set_mode (AudioClock::BBT); secondary_clock->set_mode (AudioClock::BBT);
} }
/* start the time-of-day-clock */ /* start the time-of-day-clock */
@ -2178,7 +2178,7 @@ void
ARDOUR_UI::primary_clock_value_changed () ARDOUR_UI::primary_clock_value_changed ()
{ {
if (_session) { if (_session) {
_session->request_locate (primary_clock.current_time ()); _session->request_locate (primary_clock->current_time ());
} }
} }
@ -2186,7 +2186,7 @@ void
ARDOUR_UI::big_clock_value_changed () ARDOUR_UI::big_clock_value_changed ()
{ {
if (_session) { if (_session) {
_session->request_locate (big_clock.current_time ()); _session->request_locate (big_clock->current_time ());
} }
} }
@ -2194,7 +2194,7 @@ void
ARDOUR_UI::secondary_clock_value_changed () ARDOUR_UI::secondary_clock_value_changed ()
{ {
if (_session) { if (_session) {
_session->request_locate (secondary_clock.current_time ()); _session->request_locate (secondary_clock->current_time ());
} }
} }
@ -3409,19 +3409,19 @@ void
ARDOUR_UI::update_transport_clocks (framepos_t pos) ARDOUR_UI::update_transport_clocks (framepos_t pos)
{ {
if (Config->get_primary_clock_delta_edit_cursor()) { if (Config->get_primary_clock_delta_edit_cursor()) {
primary_clock.set (pos, false, editor->get_preferred_edit_position(), 1); primary_clock->set (pos, false, editor->get_preferred_edit_position(), 1);
} else { } else {
primary_clock.set (pos, 0, true); primary_clock->set (pos, 0, true);
} }
if (Config->get_secondary_clock_delta_edit_cursor()) { if (Config->get_secondary_clock_delta_edit_cursor()) {
secondary_clock.set (pos, false, editor->get_preferred_edit_position(), 2); secondary_clock->set (pos, false, editor->get_preferred_edit_position(), 2);
} else { } else {
secondary_clock.set (pos); secondary_clock->set (pos);
} }
if (big_clock_window->get()) { if (big_clock_window->get()) {
big_clock.set (pos); big_clock->set (pos);
} }
} }
@ -3455,9 +3455,9 @@ ARDOUR_UI::record_state_changed ()
bool const h = _session->have_rec_enabled_track (); bool const h = _session->have_rec_enabled_track ();
if (r == Session::Recording && h) { if (r == Session::Recording && h) {
big_clock.set_widget_name ("BigClockRecording"); big_clock->set_widget_name ("BigClockRecording");
} else { } else {
big_clock.set_widget_name ("BigClockNonRecording"); big_clock->set_widget_name ("BigClockNonRecording");
} }
} }

View file

@ -63,7 +63,6 @@
#include "ardour/utils.h" #include "ardour/utils.h"
#include "ardour/session_handle.h" #include "ardour/session_handle.h"
#include "audio_clock.h"
#include "ardour_dialog.h" #include "ardour_dialog.h"
#include "editing.h" #include "editing.h"
#include "ui_config.h" #include "ui_config.h"
@ -193,10 +192,10 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
void xrun_handler (framepos_t); void xrun_handler (framepos_t);
void create_xrun_marker (framepos_t); void create_xrun_marker (framepos_t);
AudioClock primary_clock; AudioClock* primary_clock;
AudioClock secondary_clock; AudioClock* secondary_clock;
AudioClock preroll_clock; AudioClock* preroll_clock;
AudioClock postroll_clock; AudioClock* postroll_clock;
void store_clock_modes (); void store_clock_modes ();
void restore_clock_modes (); void restore_clock_modes ();
@ -337,7 +336,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
void manage_window (Gtk::Window&); void manage_window (Gtk::Window&);
AudioClock big_clock; AudioClock* big_clock;
ActionWindowProxy<Gtk::Window>* big_clock_window; ActionWindowProxy<Gtk::Window>* big_clock_window;
int original_big_clock_width; int original_big_clock_width;
int original_big_clock_height; int original_big_clock_height;

View file

@ -318,9 +318,9 @@ ARDOUR_UI::setup_transport ()
ARDOUR_UI::Clock.connect (sigc::bind (sigc::mem_fun (primary_clock, &AudioClock::set), 'p')); ARDOUR_UI::Clock.connect (sigc::bind (sigc::mem_fun (primary_clock, &AudioClock::set), 'p'));
ARDOUR_UI::Clock.connect (sigc::bind (sigc::mem_fun (secondary_clock, &AudioClock::set), 's')); ARDOUR_UI::Clock.connect (sigc::bind (sigc::mem_fun (secondary_clock, &AudioClock::set), 's'));
primary_clock.ValueChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::primary_clock_value_changed)); primary_clock->ValueChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::primary_clock_value_changed));
secondary_clock.ValueChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::secondary_clock_value_changed)); secondary_clock->ValueChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::secondary_clock_value_changed));
big_clock.ValueChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::big_clock_value_changed)); big_clock->ValueChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::big_clock_value_changed));
ActionManager::get_action ("Transport", "ToggleAutoReturn")->connect_proxy (auto_return_button); ActionManager::get_action ("Transport", "ToggleAutoReturn")->connect_proxy (auto_return_button);
ActionManager::get_action ("Transport", "ToggleAutoPlay")->connect_proxy (auto_play_button); ActionManager::get_action ("Transport", "ToggleAutoPlay")->connect_proxy (auto_play_button);
@ -334,10 +334,10 @@ ARDOUR_UI::setup_transport ()
preroll_button.set_name ("TransportButton"); preroll_button.set_name ("TransportButton");
postroll_button.set_name ("TransportButton"); postroll_button.set_name ("TransportButton");
preroll_clock.set_mode (AudioClock::MinSec); preroll_clock->set_mode (AudioClock::MinSec);
preroll_clock.set_name ("TransportClockDisplay"); preroll_clock->set_name ("TransportClockDisplay");
postroll_clock.set_mode (AudioClock::MinSec); postroll_clock->set_mode (AudioClock::MinSec);
postroll_clock.set_name ("TransportClockDisplay"); postroll_clock->set_name ("TransportClockDisplay");
/* alerts */ /* alerts */
@ -385,9 +385,9 @@ ARDOUR_UI::setup_transport ()
transport_hbox->pack_start (rec_button, false, false, 6); transport_hbox->pack_start (rec_button, false, false, 6);
HBox* clock_box = manage (new HBox); HBox* clock_box = manage (new HBox);
clock_box->pack_start (primary_clock, false, false); clock_box->pack_start (*primary_clock, false, false);
if (!ARDOUR::Profile->get_small_screen()) { if (!ARDOUR::Profile->get_small_screen()) {
clock_box->pack_start (secondary_clock, false, false); clock_box->pack_start (*secondary_clock, false, false);
} }
if (!Profile->get_sae()) { if (!Profile->get_sae()) {

View file

@ -92,11 +92,11 @@ ARDOUR_UI::set_session (Session *s)
} }
} }
primary_clock.set_session (s); primary_clock->set_session (s);
secondary_clock.set_session (s); secondary_clock->set_session (s);
big_clock.set_session (s); big_clock->set_session (s);
preroll_clock.set_session (s); preroll_clock->set_session (s);
postroll_clock.set_session (s); postroll_clock->set_session (s);
/* sensitize menu bar options that are now valid */ /* sensitize menu bar options that are now valid */

View file

@ -591,7 +591,7 @@ ARDOUR_UI::setup_clock ()
big_clock_window->get()->set_keep_above (true); big_clock_window->get()->set_keep_above (true);
big_clock_window->get()->set_border_width (0); big_clock_window->get()->set_border_width (0);
big_clock_window->get()->add (big_clock); big_clock_window->get()->add (*big_clock);
big_clock_window->get()->set_title (_("Big Clock")); big_clock_window->get()->set_title (_("Big Clock"));
big_clock_window->get()->set_type_hint (Gdk::WINDOW_TYPE_HINT_UTILITY); big_clock_window->get()->set_type_hint (Gdk::WINDOW_TYPE_HINT_UTILITY);
@ -614,7 +614,7 @@ ARDOUR_UI::big_clock_realized ()
original_big_clock_height = big_clock_height; original_big_clock_height = big_clock_height;
original_big_clock_width = w; original_big_clock_width = w;
Pango::FontDescription fd (big_clock.get_style()->get_font()); Pango::FontDescription fd (big_clock->get_style()->get_font());
original_big_clock_font_size = fd.get_size (); original_big_clock_font_size = fd.get_size ();
if (!fd.get_size_is_absolute ()) { if (!fd.get_size_is_absolute ()) {
@ -651,7 +651,7 @@ ARDOUR_UI::idle_big_clock_text_resizer (int, int)
big_clock_resize_in_progress = false; big_clock_resize_in_progress = false;
Glib::RefPtr<Gdk::Window> win = big_clock_window->get()->get_window(); Glib::RefPtr<Gdk::Window> win = big_clock_window->get()->get_window();
Pango::FontDescription fd (big_clock.get_style()->get_font()); Pango::FontDescription fd (big_clock->get_style()->get_font());
int current_size = fd.get_size (); int current_size = fd.get_size ();
int x, y, w, h, d; int x, y, w, h, d;
@ -674,9 +674,9 @@ ARDOUR_UI::idle_big_clock_text_resizer (int, int)
try { try {
Pango::FontDescription fd (buf); Pango::FontDescription fd (buf);
Glib::RefPtr<Gtk::RcStyle> rcstyle = big_clock.get_modifier_style (); Glib::RefPtr<Gtk::RcStyle> rcstyle = big_clock->get_modifier_style ();
rcstyle->set_font (fd); rcstyle->set_font (fd);
big_clock.modify_style (rcstyle); big_clock->modify_style (rcstyle);
} }
catch (...) { catch (...) {

View file

@ -35,6 +35,7 @@
#include "ardour/osc.h" #include "ardour/osc.h"
#endif #endif
#include "audio_clock.h"
#include "ardour_ui.h" #include "ardour_ui.h"
#include "actions.h" #include "actions.h"
#include "gui_thread.h" #include "gui_thread.h"
@ -395,9 +396,9 @@ ARDOUR_UI::parameter_changed (std::string p)
} else if (p == "show-track-meters") { } else if (p == "show-track-meters") {
editor->toggle_meter_updating(); editor->toggle_meter_updating();
} else if (p == "primary-clock-delta-edit-cursor") { } else if (p == "primary-clock-delta-edit-cursor") {
primary_clock.set_is_duration (Config->get_primary_clock_delta_edit_cursor()); primary_clock->set_is_duration (Config->get_primary_clock_delta_edit_cursor());
} else if (p == "secondary-clock-delta-edit-cursor") { } else if (p == "secondary-clock-delta-edit-cursor") {
secondary_clock.set_is_duration (Config->get_secondary_clock_delta_edit_cursor()); secondary_clock->set_is_duration (Config->get_secondary_clock_delta_edit_cursor());
} }
} }
@ -407,11 +408,11 @@ ARDOUR_UI::reset_main_clocks ()
ENSURE_GUI_THREAD (*this, &ARDOUR_UI::reset_main_clocks) ENSURE_GUI_THREAD (*this, &ARDOUR_UI::reset_main_clocks)
if (_session) { if (_session) {
primary_clock.set (_session->audible_frame(), true); primary_clock->set (_session->audible_frame(), true);
secondary_clock.set (_session->audible_frame(), true); secondary_clock->set (_session->audible_frame(), true);
} else { } else {
primary_clock.set (0, true); primary_clock->set (0, true);
secondary_clock.set (0, true); secondary_clock->set (0, true);
} }
} }

View file

@ -49,7 +49,7 @@ using namespace Gtk;
using namespace Gtkmm2ext; using namespace Gtkmm2ext;
using namespace Editing; using namespace Editing;
Pango::FontDescription* AutomationTimeAxisView::name_font = 0; Pango::FontDescription AutomationTimeAxisView::name_font;
bool AutomationTimeAxisView::have_name_font = false; bool AutomationTimeAxisView::have_name_font = false;
const string AutomationTimeAxisView::state_node_name = "AutomationChild"; const string AutomationTimeAxisView::state_node_name = "AutomationChild";
@ -153,7 +153,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (
bool shortened = false; bool shortened = false;
int ignore_width; int ignore_width;
shortpname = fit_to_pixels (_name, 60, *name_font, ignore_width, true); shortpname = fit_to_pixels (_name, 60, name_font, ignore_width, true);
if (shortpname != _name ){ if (shortpname != _name ){
shortened = true; shortened = true;
@ -167,7 +167,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (
/* limit the plug name string */ /* limit the plug name string */
string pname = fit_to_pixels (nomparent, 60, *name_font, ignore_width, true); string pname = fit_to_pixels (nomparent, 60, name_font, ignore_width, true);
if (pname != nomparent) { if (pname != nomparent) {
shortened = true; shortened = true;
} }

View file

@ -189,7 +189,7 @@ class AutomationTimeAxisView : public TimeAxisView {
//void set_colors (); //void set_colors ();
void color_handler (); void color_handler ();
static Pango::FontDescription* name_font; static Pango::FontDescription name_font;
static bool have_name_font; static bool have_name_font;
private: private:

View file

@ -77,6 +77,7 @@
#include "control_protocol/control_protocol.h" #include "control_protocol/control_protocol.h"
#include "audio_clock.h"
#include "editor.h" #include "editor.h"
#include "debug.h" #include "debug.h"
#include "keyboard.h" #include "keyboard.h"
@ -260,7 +261,7 @@ Editor::Editor ()
/* tool bar related */ /* tool bar related */
, zoom_range_clock (X_("zoomrange"), false, X_("ZoomRangeClock"), true, false, true) , zoom_range_clock (new AudioClock (X_("zoomrange"), false, X_("ZoomRangeClock"), true, false, true))
, toolbar_selection_clock_table (2,3) , toolbar_selection_clock_table (2,3)
@ -276,7 +277,7 @@ Editor::Editor ()
/* nudge */ /* nudge */
, nudge_clock (X_("nudge"), false, X_("NudgeClock"), true, false, true) , nudge_clock (new AudioClock (X_("nudge"), false, X_("NudgeClock"), true, false, true))
, meters_running(false) , meters_running(false)
, _pending_locate_request (false) , _pending_locate_request (false)
, _pending_initial_locate (false) , _pending_initial_locate (false)
@ -387,7 +388,7 @@ Editor::Editor ()
zoom_focus = ZoomFocusLeft; zoom_focus = ZoomFocusLeft;
set_zoom_focus (ZoomFocusLeft); set_zoom_focus (ZoomFocusLeft);
zoom_range_clock.ValueChanged.connect (sigc::mem_fun(*this, &Editor::zoom_adjustment_changed)); zoom_range_clock->ValueChanged.connect (sigc::mem_fun(*this, &Editor::zoom_adjustment_changed));
bbt_label.set_name ("EditorTimeButton"); bbt_label.set_name ("EditorTimeButton");
bbt_label.set_size_request (-1, (int)timebar_height); bbt_label.set_size_request (-1, (int)timebar_height);
@ -896,14 +897,14 @@ Editor::zoom_adjustment_changed ()
return; return;
} }
double fpu = zoom_range_clock.current_duration() / _canvas_width; double fpu = zoom_range_clock->current_duration() / _canvas_width;
if (fpu < 1.0) { if (fpu < 1.0) {
fpu = 1.0; fpu = 1.0;
zoom_range_clock.set ((framepos_t) floor (fpu * _canvas_width)); zoom_range_clock->set ((framepos_t) floor (fpu * _canvas_width));
} else if (fpu > _session->current_end_frame() / _canvas_width) { } else if (fpu > _session->current_end_frame() / _canvas_width) {
fpu = _session->current_end_frame() / _canvas_width; fpu = _session->current_end_frame() / _canvas_width;
zoom_range_clock.set ((framepos_t) floor (fpu * _canvas_width)); zoom_range_clock->set ((framepos_t) floor (fpu * _canvas_width));
} }
temporal_zoom (fpu); temporal_zoom (fpu);
@ -1084,9 +1085,9 @@ Editor::set_session (Session *t)
return; return;
} }
zoom_range_clock.set_session (_session); zoom_range_clock->set_session (_session);
_playlist_selector->set_session (_session); _playlist_selector->set_session (_session);
nudge_clock.set_session (_session); nudge_clock->set_session (_session);
_summary->set_session (_session); _summary->set_session (_session);
_group_tabs->set_session (_session); _group_tabs->set_session (_session);
_route_groups->set_session (_session); _route_groups->set_session (_session);
@ -1145,11 +1146,11 @@ Editor::set_session (Session *t)
bbt.beats = 0; bbt.beats = 0;
bbt.ticks = 120; bbt.ticks = 120;
framepos_t pos = _session->tempo_map().bbt_duration_at (0, bbt, 1); framepos_t pos = _session->tempo_map().bbt_duration_at (0, bbt, 1);
nudge_clock.set_mode(AudioClock::BBT); nudge_clock->set_mode(AudioClock::BBT);
nudge_clock.set (pos, true, 0, AudioClock::BBT); nudge_clock->set (pos, true, 0, AudioClock::BBT);
} else { } else {
nudge_clock.set (_session->frame_rate() * 5, true, 0, AudioClock::Timecode); // default of 5 seconds nudge_clock->set (_session->frame_rate() * 5, true, 0, AudioClock::Timecode); // default of 5 seconds
} }
playhead_cursor->canvas_item.show (); playhead_cursor->canvas_item.show ();
@ -2907,7 +2908,7 @@ Editor::setup_toolbar ()
nudge_box->pack_start (nudge_backward_button, false, false); nudge_box->pack_start (nudge_backward_button, false, false);
nudge_box->pack_start (nudge_forward_button, false, false); nudge_box->pack_start (nudge_forward_button, false, false);
nudge_box->pack_start (nudge_clock, false, false); nudge_box->pack_start (*nudge_clock, false, false);
/* Pack everything in... */ /* Pack everything in... */
@ -3821,7 +3822,7 @@ Editor::get_nudge_distance (framepos_t pos, framecnt_t& next)
{ {
framecnt_t ret; framecnt_t ret;
ret = nudge_clock.current_duration (pos); ret = nudge_clock->current_duration (pos);
next = ret + 1; /* XXXX fix me */ next = ret + 1; /* XXXX fix me */
return ret; return ret;
@ -4254,8 +4255,8 @@ Editor::post_zoom ()
framepos_t frames = (framepos_t) floor (frames_per_unit * _canvas_width); framepos_t frames = (framepos_t) floor (frames_per_unit * _canvas_width);
if (frames_per_unit != zoom_range_clock.current_duration()) { if (frames_per_unit != zoom_range_clock->current_duration()) {
zoom_range_clock.set (frames); zoom_range_clock->set (frames);
} }
if (mouse_mode == MouseRange && selection->time.start () != selection->time.end_frame ()) { if (mouse_mode == MouseRange && selection->time.start () != selection->time.end_frame ()) {
@ -5349,8 +5350,8 @@ Editor::session_going_away ()
} }
track_views.clear (); track_views.clear ();
zoom_range_clock.set_session (0); zoom_range_clock->set_session (0);
nudge_clock.set_session (0); nudge_clock->set_session (0);
editor_list_button.set_active(false); editor_list_button.set_active(false);
editor_list_button.set_sensitive(false); editor_list_button.set_sensitive(false);

View file

@ -51,7 +51,6 @@
#include "ardour/location.h" #include "ardour/location.h"
#include "ardour/types.h" #include "ardour/types.h"
#include "audio_clock.h"
#include "gtk-custom-ruler.h" #include "gtk-custom-ruler.h"
#include "ardour_dialog.h" #include "ardour_dialog.h"
#include "public_editor.h" #include "public_editor.h"
@ -95,6 +94,7 @@ namespace LADSPA {
} }
class AnalysisWindow; class AnalysisWindow;
class AudioClock;
class AudioRegionView; class AudioRegionView;
class AudioStreamView; class AudioStreamView;
class AudioTimeAxisView; class AudioTimeAxisView;
@ -1501,7 +1501,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void editor_mixer_button_toggled (); void editor_mixer_button_toggled ();
void editor_list_button_toggled (); void editor_list_button_toggled ();
AudioClock zoom_range_clock; AudioClock* zoom_range_clock;
Gtk::Button zoom_in_button; Gtk::Button zoom_in_button;
Gtk::Button zoom_out_button; Gtk::Button zoom_out_button;
Gtk::Button zoom_out_full_button; Gtk::Button zoom_out_full_button;
@ -1887,7 +1887,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
Gtk::Button nudge_backward_button; Gtk::Button nudge_backward_button;
Gtk::HBox nudge_hbox; Gtk::HBox nudge_hbox;
Gtk::VBox nudge_vbox; Gtk::VBox nudge_vbox;
AudioClock nudge_clock; AudioClock* nudge_clock;
bool nudge_forward_release (GdkEventButton*); bool nudge_forward_release (GdkEventButton*);
bool nudge_backward_release (GdkEventButton*); bool nudge_backward_release (GdkEventButton*);

View file

@ -37,6 +37,7 @@
#include "gtkmm2ext/choice.h" #include "gtkmm2ext/choice.h"
#include "gtkmm2ext/treeutils.h" #include "gtkmm2ext/treeutils.h"
#include "audio_clock.h"
#include "editor.h" #include "editor.h"
#include "editing.h" #include "editing.h"
#include "keyboard.h" #include "keyboard.h"
@ -174,7 +175,7 @@ EditorRegions::EditorRegions (Editor* e)
// _display.signal_popup_menu().connect (sigc::bind (sigc::mem_fun (*this, &Editor::show__display_context_menu), 1, 0)); // _display.signal_popup_menu().connect (sigc::bind (sigc::mem_fun (*this, &Editor::show__display_context_menu), 1, 0));
//ARDOUR_UI::instance()->secondary_clock.mode_changed.connect (sigc::mem_fun(*this, &Editor::redisplay_regions)); //ARDOUR_UI::instance()->secondary_clock.mode_changed.connect (sigc::mem_fun(*this, &Editor::redisplay_regions));
ARDOUR_UI::instance()->secondary_clock.mode_changed.connect (sigc::mem_fun(*this, &EditorRegions::update_all_rows)); ARDOUR_UI::instance()->secondary_clock->mode_changed.connect (sigc::mem_fun(*this, &EditorRegions::update_all_rows));
ARDOUR::Region::RegionPropertyChanged.connect (region_property_connection, MISSING_INVALIDATOR, ui_bind (&EditorRegions::region_changed, this, _1, _2), gui_context()); ARDOUR::Region::RegionPropertyChanged.connect (region_property_connection, MISSING_INVALIDATOR, ui_bind (&EditorRegions::region_changed, this, _1, _2), gui_context());
ARDOUR::RegionFactory::CheckNewRegion.connect (check_new_region_connection, MISSING_INVALIDATOR, ui_bind (&EditorRegions::add_region, this, _1), gui_context()); ARDOUR::RegionFactory::CheckNewRegion.connect (check_new_region_connection, MISSING_INVALIDATOR, ui_bind (&EditorRegions::add_region, this, _1), gui_context());
@ -660,7 +661,7 @@ EditorRegions::format_position (framepos_t pos, char* buf, size_t bufsize)
Timecode::BBT_Time bbt; Timecode::BBT_Time bbt;
Timecode::Time timecode; Timecode::Time timecode;
switch (ARDOUR_UI::instance()->secondary_clock.mode ()) { switch (ARDOUR_UI::instance()->secondary_clock->mode ()) {
case AudioClock::BBT: case AudioClock::BBT:
_session->tempo_map().bbt_time (pos, bbt); _session->tempo_map().bbt_time (pos, bbt);
snprintf (buf, bufsize, "%03d|%02d|%04d" , bbt.bars, bbt.beats, bbt.ticks); snprintf (buf, bufsize, "%03d|%02d|%04d" , bbt.bars, bbt.beats, bbt.ticks);

View file

@ -255,7 +255,7 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
Glib::RefPtr<Pango::Layout> layout = foo.create_pango_layout (X_("Hg")); /* ascender + descender */ Glib::RefPtr<Pango::Layout> layout = foo.create_pango_layout (X_("Hg")); /* ascender + descender */
int width; int width;
layout->set_font_description (*name_font); layout->set_font_description (name_font);
Gtkmm2ext::get_ink_pixel_size (layout, width, name_height); Gtkmm2ext::get_ink_pixel_size (layout, width, name_height);
name_pixbuf = new ArdourCanvas::Pixbuf(*group); name_pixbuf = new ArdourCanvas::Pixbuf(*group);
@ -380,7 +380,7 @@ Marker::setup_name_display ()
} }
/* Work out how wide the name can be */ /* Work out how wide the name can be */
int name_width = min ((double) pixel_width (_name, *name_font) + 2, limit); int name_width = min ((double) pixel_width (_name, name_font) + 2, limit);
if (name_width == 0) { if (name_width == 0) {
name_width = 1; name_width = 1;
} }

View file

@ -96,7 +96,7 @@ class Marker : public sigc::trackable
protected: protected:
PublicEditor& editor; PublicEditor& editor;
Pango::FontDescription* name_font; Pango::FontDescription name_font;
ArdourCanvas::Group* _parent; ArdourCanvas::Group* _parent;
ArdourCanvas::Group *group; ArdourCanvas::Group *group;

View file

@ -269,7 +269,7 @@ RegionView::set_silent_frames (const AudioIntervalResult& silences, double thres
} }
_silence_text = new ArdourCanvas::NoEventText (*group); _silence_text = new ArdourCanvas::NoEventText (*group);
_silence_text->property_font_desc() = *(get_font_for_style (N_("SilenceText"))); _silence_text->property_font_desc() = get_font_for_style (N_("SilenceText"));
_silence_text->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SilenceText.get(); _silence_text->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SilenceText.get();
_silence_text->property_anchor() = ANCHOR_NW; _silence_text->property_anchor() = ANCHOR_NW;

View file

@ -171,7 +171,7 @@ SoundFileBox::SoundFileBox (bool persistent)
table.attach (length_clock, 1, 2, 4, 5, FILL, FILL); table.attach (length_clock, 1, 2, 4, 5, FILL, FILL);
table.attach (timecode_clock, 1, 2, 5, 6, FILL, FILL); table.attach (timecode_clock, 1, 2, 5, 6, FILL, FILL);
length_clock.set_mode (ARDOUR_UI::instance()->secondary_clock.mode()); length_clock.set_mode (ARDOUR_UI::instance()->secondary_clock->mode());
timecode_clock.set_mode (AudioClock::Timecode); timecode_clock.set_mode (AudioClock::Timecode);
main_box.pack_start (table, false, false); main_box.pack_start (table, false, false);

View file

@ -29,6 +29,7 @@
#include "ardour_ui.h" #include "ardour_ui.h"
#include "ardour/session.h" #include "ardour/session.h"
#include "audio_clock.h"
#include "gui_thread.h" #include "gui_thread.h"
#include "strip_silence_dialog.h" #include "strip_silence_dialog.h"
#include "canvas_impl.h" #include "canvas_impl.h"
@ -48,8 +49,8 @@ using namespace ArdourCanvas;
StripSilenceDialog::StripSilenceDialog (Session* s, list<RegionView*> const & v) StripSilenceDialog::StripSilenceDialog (Session* s, list<RegionView*> const & v)
: ArdourDialog (_("Strip Silence")) : ArdourDialog (_("Strip Silence"))
, ProgressReporter () , ProgressReporter ()
, _minimum_length (X_("silence duration"), true, "SilenceDurationClock", true, false, true, false) , _minimum_length (new AudioClock (X_("silence duration"), true, "SilenceDurationClock", true, false, true, false))
, _fade_length (X_("silence duration"), true, "SilenceDurationClock", true, false, true, false) , _fade_length (new AudioClock (X_("silence duration"), true, "SilenceDurationClock", true, false, true, false))
, _peaks_ready_connection (0) , _peaks_ready_connection (0)
, _destroying (false) , _destroying (false)
{ {
@ -77,20 +78,20 @@ StripSilenceDialog::StripSilenceDialog (Session* s, list<RegionView*> const & v)
_threshold.set_value (-60); _threshold.set_value (-60);
table->attach (*Gtk::manage (new Gtk::Label (_("Minimum length"), 1, 0.5)), 0, 1, n, n + 1, Gtk::FILL); table->attach (*Gtk::manage (new Gtk::Label (_("Minimum length"), 1, 0.5)), 0, 1, n, n + 1, Gtk::FILL);
table->attach (_minimum_length, 1, 2, n, n + 1, Gtk::FILL); table->attach (*_minimum_length, 1, 2, n, n + 1, Gtk::FILL);
++n; ++n;
_minimum_length.set_session (s); _minimum_length->set_session (s);
_minimum_length.set_mode (AudioClock::Frames); _minimum_length->set_mode (AudioClock::Frames);
_minimum_length.set (1000, true); _minimum_length->set (1000, true);
table->attach (*Gtk::manage (new Gtk::Label (_("Fade length"), 1, 0.5)), 0, 1, n, n + 1, Gtk::FILL); table->attach (*Gtk::manage (new Gtk::Label (_("Fade length"), 1, 0.5)), 0, 1, n, n + 1, Gtk::FILL);
table->attach (_fade_length, 1, 2, n, n + 1, Gtk::FILL); table->attach (*_fade_length, 1, 2, n, n + 1, Gtk::FILL);
++n; ++n;
_fade_length.set_session (s); _fade_length->set_session (s);
_fade_length.set_mode (AudioClock::Frames); _fade_length->set_mode (AudioClock::Frames);
_fade_length.set (64, true); _fade_length->set (64, true);
hbox->pack_start (*table); hbox->pack_start (*table);
@ -104,7 +105,7 @@ StripSilenceDialog::StripSilenceDialog (Session* s, list<RegionView*> const & v)
show_all (); show_all ();
_threshold.get_adjustment()->signal_value_changed().connect (sigc::mem_fun (*this, &StripSilenceDialog::threshold_changed)); _threshold.get_adjustment()->signal_value_changed().connect (sigc::mem_fun (*this, &StripSilenceDialog::threshold_changed));
_minimum_length.ValueChanged.connect (sigc::mem_fun (*this, &StripSilenceDialog::restart_thread)); _minimum_length->ValueChanged.connect (sigc::mem_fun (*this, &StripSilenceDialog::restart_thread));
update_silence_rects (); update_silence_rects ();
update_threshold_line (); update_threshold_line ();
@ -130,6 +131,9 @@ StripSilenceDialog::~StripSilenceDialog ()
_run_cond.signal (); _run_cond.signal ();
pthread_join (_thread, 0); pthread_join (_thread, 0);
delete _minimum_length;
delete _fade_length;
delete _peaks_ready_connection; delete _peaks_ready_connection;
} }
@ -273,13 +277,13 @@ StripSilenceDialog::threshold_changed ()
framecnt_t framecnt_t
StripSilenceDialog::minimum_length () const StripSilenceDialog::minimum_length () const
{ {
return _minimum_length.current_duration (views.front().view->region()->position()); return _minimum_length->current_duration (views.front().view->region()->position());
} }
framecnt_t framecnt_t
StripSilenceDialog::fade_length () const StripSilenceDialog::fade_length () const
{ {
return _fade_length.current_duration (views.front().view->region()->position()); return _fade_length->current_duration (views.front().view->region()->position());
} }
void void

View file

@ -29,6 +29,7 @@ namespace ARDOUR {
class Session; class Session;
} }
class AudioClock;
class RegionView; class RegionView;
/// Dialog box to set options for the `strip silence' filter /// Dialog box to set options for the `strip silence' filter
@ -63,8 +64,8 @@ private:
void restart_thread (); void restart_thread ();
Gtk::SpinButton _threshold; Gtk::SpinButton _threshold;
AudioClock _minimum_length; AudioClock* _minimum_length;
AudioClock _fade_length; AudioClock* _fade_length;
Gtk::ProgressBar _progress_bar; Gtk::ProgressBar _progress_bar;
struct ViewInterval { struct ViewInterval {

View file

@ -50,7 +50,7 @@ using namespace PBD;
using namespace ARDOUR; using namespace ARDOUR;
using namespace Gtkmm2ext; using namespace Gtkmm2ext;
Pango::FontDescription* TimeAxisViewItem::NAME_FONT = 0; Pango::FontDescription TimeAxisViewItem::NAME_FONT;
const double TimeAxisViewItem::NAME_X_OFFSET = 15.0; const double TimeAxisViewItem::NAME_X_OFFSET = 15.0;
const double TimeAxisViewItem::GRAB_HANDLE_LENGTH = 6; const double TimeAxisViewItem::GRAB_HANDLE_LENGTH = 6;
@ -72,7 +72,7 @@ TimeAxisViewItem::set_constant_heights ()
int width = 0; int width = 0;
int height = 0; int height = 0;
layout->set_font_description (*NAME_FONT); layout->set_font_description (NAME_FONT);
Gtkmm2ext::get_ink_pixel_size (layout, width, height); Gtkmm2ext::get_ink_pixel_size (layout, width, height);
NAME_HEIGHT = height; NAME_HEIGHT = height;
@ -508,7 +508,7 @@ TimeAxisViewItem::set_name_text(const string& new_name)
} }
last_item_width = trackview.editor().frame_to_pixel(item_duration); last_item_width = trackview.editor().frame_to_pixel(item_duration);
name_pixbuf_width = pixel_width (new_name, *NAME_FONT) + 2; name_pixbuf_width = pixel_width (new_name, NAME_FONT) + 2;
name_pixbuf->property_pixbuf() = pixbuf_from_string(new_name, NAME_FONT, name_pixbuf_width, NAME_HEIGHT, Gdk::Color ("#000000")); name_pixbuf->property_pixbuf() = pixbuf_from_string(new_name, NAME_FONT, name_pixbuf_width, NAME_HEIGHT, Gdk::Color ("#000000"));
} }

View file

@ -90,7 +90,7 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
bool name_active() const { return name_connected; } bool name_active() const { return name_connected; }
// Default sizes, font and spacing // Default sizes, font and spacing
static Pango::FontDescription* NAME_FONT; static Pango::FontDescription NAME_FONT;
static void set_constant_heights (); static void set_constant_heights ();
static const double NAME_X_OFFSET; static const double NAME_X_OFFSET;
static const double GRAB_HANDLE_LENGTH; static const double GRAB_HANDLE_LENGTH;

View file

@ -303,7 +303,7 @@ get_canvas_points (string /*who*/, uint32_t npoints)
return new ArdourCanvas::Points (npoints); return new ArdourCanvas::Points (npoints);
} }
Pango::FontDescription* Pango::FontDescription
get_font_for_style (string widgetname) get_font_for_style (string widgetname)
{ {
Gtk::Window window (WINDOW_TOPLEVEL); Gtk::Window window (WINDOW_TOPLEVEL);
@ -326,10 +326,10 @@ get_font_for_style (string widgetname)
PangoContext* ctxt = (PangoContext*) pango_layout_get_context ((PangoLayout*) layout->gobj()); PangoContext* ctxt = (PangoContext*) pango_layout_get_context ((PangoLayout*) layout->gobj());
pfd = pango_context_get_font_description (ctxt); pfd = pango_context_get_font_description (ctxt);
return new Pango::FontDescription (pfd, true); /* make a copy */ return Pango::FontDescription (pfd); /* make a copy */
} }
return new Pango::FontDescription (pfd, true); /* make a copy */ return Pango::FontDescription (pfd); /* make a copy */
} }
uint32_t uint32_t

View file

@ -59,7 +59,7 @@ unsigned char* xpm2rgba (const char** xpm, uint32_t& w, uint32_t& h);
ArdourCanvas::Points* get_canvas_points (std::string who, uint32_t npoints); ArdourCanvas::Points* get_canvas_points (std::string who, uint32_t npoints);
Pango::FontDescription* get_font_for_style (std::string widgetname); Pango::FontDescription get_font_for_style (std::string widgetname);
uint32_t rgba_from_style (std::string, uint32_t, uint32_t, uint32_t, uint32_t, std::string = "fg", int = Gtk::STATE_NORMAL, bool = true); uint32_t rgba_from_style (std::string, uint32_t, uint32_t, uint32_t, uint32_t, std::string = "fg", int = Gtk::STATE_NORMAL, bool = true);

View file

@ -21,11 +21,13 @@
#include <gtkmm/enums.h> #include <gtkmm/enums.h>
#include "pbd/stacktrace.h" #include "pbd/stacktrace.h"
#include "ardour/profile.h" #include "ardour/profile.h"
#include "editor.h"
#include "ardour_ui.h" #include "ardour_ui.h"
#include "verbose_cursor.h" #include "audio_clock.h"
#include "utils.h" #include "editor.h"
#include "editor_drag.h" #include "editor_drag.h"
#include "utils.h"
#include "verbose_cursor.h"
#include "i18n.h" #include "i18n.h"
@ -38,13 +40,9 @@ VerboseCursor::VerboseCursor (Editor* editor)
, _xoffset (0) , _xoffset (0)
, _yoffset (0) , _yoffset (0)
{ {
Pango::FontDescription* font = get_font_for_style (N_("VerboseCanvasCursor"));
_canvas_item = new ArdourCanvas::NoEventText (*_editor->track_canvas->root()); _canvas_item = new ArdourCanvas::NoEventText (*_editor->track_canvas->root());
_canvas_item->property_font_desc() = *font; _canvas_item->property_font_desc() = get_font_for_style (N_("VerboseCanvasCursor"));
_canvas_item->property_anchor() = Gtk::ANCHOR_NW; _canvas_item->property_anchor() = Gtk::ANCHOR_NW;
delete font;
} }
ArdourCanvas::Item * ArdourCanvas::Item *
@ -131,9 +129,9 @@ VerboseCursor::set_time (framepos_t frame, double x, double y)
AudioClock::Mode m; AudioClock::Mode m;
if (Profile->get_sae() || Profile->get_small_screen()) { if (Profile->get_sae() || Profile->get_small_screen()) {
m = ARDOUR_UI::instance()->primary_clock.mode(); m = ARDOUR_UI::instance()->primary_clock->mode();
} else { } else {
m = ARDOUR_UI::instance()->secondary_clock.mode(); m = ARDOUR_UI::instance()->secondary_clock->mode();
} }
switch (m) { switch (m) {
@ -185,9 +183,9 @@ VerboseCursor::set_duration (framepos_t start, framepos_t end, double x, double
AudioClock::Mode m; AudioClock::Mode m;
if (Profile->get_sae() || Profile->get_small_screen()) { if (Profile->get_sae() || Profile->get_small_screen()) {
m = ARDOUR_UI::instance()->primary_clock.mode (); m = ARDOUR_UI::instance()->primary_clock->mode ();
} else { } else {
m = ARDOUR_UI::instance()->secondary_clock.mode (); m = ARDOUR_UI::instance()->secondary_clock->mode ();
} }
switch (m) { switch (m) {

View file

@ -61,7 +61,7 @@ namespace Gtkmm2ext {
gint vpadding); gint vpadding);
Glib::RefPtr<Gdk::Pixbuf> pixbuf_from_string (const std::string& name, Glib::RefPtr<Gdk::Pixbuf> pixbuf_from_string (const std::string& name,
Pango::FontDescription* font, const Pango::FontDescription& font,
int clip_width, int clip_width,
int clip_height, int clip_height,
Gdk::Color fg); Gdk::Color fg);

View file

@ -184,7 +184,7 @@ convert_bgra_to_rgba (guint8 const* src,
} }
Glib::RefPtr<Gdk::Pixbuf> Glib::RefPtr<Gdk::Pixbuf>
Gtkmm2ext::pixbuf_from_string(const string& name, Pango::FontDescription* font, int clip_width, int clip_height, Gdk::Color fg) Gtkmm2ext::pixbuf_from_string(const string& name, const Pango::FontDescription& font, int clip_width, int clip_height, Gdk::Color fg)
{ {
static Glib::RefPtr<Gdk::Pixbuf>* empty_pixbuf = 0; static Glib::RefPtr<Gdk::Pixbuf>* empty_pixbuf = 0;
@ -203,9 +203,9 @@ Gtkmm2ext::pixbuf_from_string(const string& name, Pango::FontDescription* font,
cairo_text_extents_t te; cairo_text_extents_t te;
cairo_set_source_rgba (cr, fg.get_red_p(), fg.get_green_p(), fg.get_blue_p(), 1.0); cairo_set_source_rgba (cr, fg.get_red_p(), fg.get_green_p(), fg.get_blue_p(), 1.0);
cairo_select_font_face (cr, font->get_family().c_str(), cairo_select_font_face (cr, font.get_family().c_str(),
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, font->get_size() / Pango::SCALE); cairo_set_font_size (cr, font.get_size() / Pango::SCALE);
cairo_text_extents (cr, name.c_str(), &te); cairo_text_extents (cr, name.c_str(), &te);
cairo_move_to (cr, 0.5, int (0.5 - te.height / 2 - te.y_bearing + clip_height / 2)); cairo_move_to (cr, 0.5, int (0.5 - te.height / 2 - te.y_bearing + clip_height / 2));