diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-06-07 15:23:06 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-06-07 15:23:06 +0000 |
commit | 0a53bb1d42361eeb6552af03a1d3578535d948d0 (patch) | |
tree | 16bf99df67b4e4fe6e5a68805056b51f740e8598 /gtk2_ardour | |
parent | e77b5261d2811a1ad139afc29250e3a3337c455d (diff) |
lots of clock tweaks, but still, STILL! not done, really
git-svn-id: svn://localhost/ardour2/branches/3.0@9678 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/ardour3_ui_dark.rc.in | 6 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui2.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/audio_clock.cc | 50 | ||||
-rw-r--r-- | gtk2_ardour/audio_clock.h | 4 | ||||
-rw-r--r-- | gtk2_ardour/time_info_box.cc | 39 |
5 files changed, 54 insertions, 47 deletions
diff --git a/gtk2_ardour/ardour3_ui_dark.rc.in b/gtk2_ardour/ardour3_ui_dark.rc.in index ce5512b36e..c33782dad3 100644 --- a/gtk2_ardour/ardour3_ui_dark.rc.in +++ b/gtk2_ardour/ardour3_ui_dark.rc.in @@ -942,7 +942,7 @@ style "recording_big_clock_display" = "non_recording_big_clock_display" style "transport_clock_display" { - font_name = "monospace @FONT_BOLD_BIG@" + font_name = "@FONT_BOLD_BIG@" fg[ACTIVE] = darker(@@COLPREFIX@_bright_indicator) fg[SELECTED] = darker(@@COLPREFIX@_bright_indicator) @@ -991,7 +991,7 @@ style "default_clock_display" = "medium_text" style "selection_clock_display" { - font_name = "monospace @FONT_SMALLER@" + font_name = "@FONT_SMALLER@" text[NORMAL] = @@COLPREFIX@_contrasting_indicator text[ACTIVE] = @@COLPREFIX@_bright_indicator @@ -1006,7 +1006,7 @@ style "selection_clock_display" style "punch_clock_display" = "very_small_text" { - font_name = "monospace @FONT_SMALLER@" + font_name = "@FONT_SMALLER@" text[NORMAL] = @@COLPREFIX@_contrasting_indicator text[ACTIVE] = @@COLPREFIX@_bright_indicator diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index 70962befd6..c74db60def 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -388,12 +388,10 @@ ARDOUR_UI::setup_transport () HBox* clock_box = manage (new HBox); clock_box->set_border_width (2); - primary_clock->main_display().set_ypad (2); primary_clock->set_border_width (2); clock_box->pack_start (*primary_clock, false, false); if (!ARDOUR::Profile->get_small_screen()) { secondary_clock->set_border_width (2); - secondary_clock->main_display().set_ypad (2); clock_box->pack_start (*secondary_clock, false, false); } diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index 15b3131b4c..e6684e3c23 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -108,14 +108,14 @@ AudioClock::AudioClock (const string& clock_name, bool transient, const string& display = new CairoEditableText (); - _fixed_cells[Colon1] = new CairoColonCell (Colon1); - _fixed_cells[Colon2] = new CairoColonCell (Colon2); - _fixed_cells[Colon3] = new CairoColonCell (Colon3); - _fixed_cells[Bar1] = new CairoBarCell (Bar1); - _fixed_cells[Bar2] = new CairoBarCell (Bar2); + _fixed_cells[Colon1] = new CairoCharCell (Colon1, ':'); + _fixed_cells[Colon2] = new CairoCharCell (Colon2, ':'); + _fixed_cells[Colon3] = new CairoCharCell (Colon3, ':'); + _fixed_cells[Bar1] = new CairoCharCell (Bar1, '|'); + _fixed_cells[Bar2] = new CairoCharCell (Bar2, '|'); - // add an extra 0.6 "average char width" for the negative sign - _text_cells[Timecode_Hours] = new CairoTextCell (Timecode_Hours, field_length[Timecode_Hours] + 0.6); + // add an extra character for the negative sign + _text_cells[Timecode_Hours] = new CairoTextCell (Timecode_Hours, field_length[Timecode_Hours] + 1); _text_cells[Timecode_Minutes] = new CairoTextCell (Timecode_Minutes, field_length[Timecode_Minutes]); _text_cells[Timecode_Seconds] = new CairoTextCell (Timecode_Seconds, field_length[Timecode_Seconds]); _text_cells[Timecode_Frames] = new CairoTextCell (Timecode_Frames, field_length[Timecode_Frames]); @@ -137,7 +137,7 @@ AudioClock::AudioClock (const string& clock_name, bool transient, const string& _text_cells[AudioFrames] = new CairoTextCell (AudioFrames, field_length[AudioFrames]); - packer.set_homogeneous (false); + set_homogeneous (false); if (with_info) { @@ -159,14 +159,14 @@ AudioClock::AudioClock (const string& clock_name, bool transient, const string& top.pack_start (*display, true, true); - packer.set_spacing (1); - packer.pack_start (top, true, true); - packer.pack_start (bottom, false, false); + set_spacing (1); + + pack_start (top, true, true); + pack_start (bottom, true, true); } else { - packer.pack_start (*display, true, true); + pack_start (*display, true, true); } - add (packer); show_all (); set_widget_name (widget_name); @@ -192,13 +192,6 @@ AudioClock::~AudioClock () } void -AudioClock::set_font (const string& font) -{ - display->set_font (font); - /* XXX supplemental ... */ -} - -void AudioClock::set_widget_name (const string& name) { Widget::set_name (name); @@ -226,9 +219,10 @@ AudioClock::set_theme () display->set_font (font); - if (supplemental_right) { - Pango::FontDescription smaller_font ("Sans 8"); - + /* propagate font style,but smaller, into supplemental text */ + if (supplemental_left) { + boost::shared_ptr<CairoFontDescription> smaller_font (new CairoFontDescription (*display->font().get())); + smaller_font->set_size (12); supplemental_right->set_font (smaller_font); supplemental_left->set_font (smaller_font); } @@ -303,7 +297,7 @@ AudioClock::end_edit () void AudioClock::on_realize () { - Alignment::on_realize (); + VBox::on_realize (); /* styles are not available until the widgets are bound to a window */ @@ -1859,6 +1853,12 @@ AudioClock::set_mode (Mode m) /* clear information cells */ supplemental_left->set_text (_text_cells[LowerLeft2], _("")); supplemental_right->set_text (_text_cells[LowerRight2], _("")); + + /* propagate font style,but smaller, into cells */ + boost::shared_ptr<CairoFontDescription> smaller_font (new CairoFontDescription (*display->font().get())); + smaller_font->set_size (12); + supplemental_right->set_font (smaller_font); + supplemental_left->set_font (smaller_font); } if (_mode != Off) { @@ -1885,7 +1885,7 @@ AudioClock::set_bbt_reference (framepos_t pos) void AudioClock::on_style_changed (const Glib::RefPtr<Gtk::Style>& old_style) { - Alignment::on_style_changed (old_style); + VBox::on_style_changed (old_style); set_theme (); } diff --git a/gtk2_ardour/audio_clock.h b/gtk2_ardour/audio_clock.h index df6def4f39..8e0ab53a9d 100644 --- a/gtk2_ardour/audio_clock.h +++ b/gtk2_ardour/audio_clock.h @@ -38,7 +38,7 @@ namespace ARDOUR { class Session; } -class AudioClock : public Gtk::Alignment, public ARDOUR::SessionHandlePtr +class AudioClock : public Gtk::VBox, public ARDOUR::SessionHandlePtr { public: enum Mode { @@ -65,7 +65,6 @@ class AudioClock : public Gtk::Alignment, public ARDOUR::SessionHandlePtr void set_is_duration (bool); void set_widget_name (const std::string&); - void set_font (const std::string&); std::string name() const { return _name; } @@ -137,7 +136,6 @@ class AudioClock : public Gtk::Alignment, public ARDOUR::SessionHandlePtr CairoEditableText* supplemental_left; CairoEditableText* supplemental_right; - Gtk::VBox packer; Gtk::HBox top; Gtk::HBox bottom; diff --git a/gtk2_ardour/time_info_box.cc b/gtk2_ardour/time_info_box.cc index a343277b18..a58aa071c0 100644 --- a/gtk2_ardour/time_info_box.cc +++ b/gtk2_ardour/time_info_box.cc @@ -45,35 +45,37 @@ TimeInfoBox::TimeInfoBox () punch_start = new AudioClock ("punch-start", false, "PunchClockDisplay", false, false, false, false); punch_end = new AudioClock ("punch-end", false, "PunchClockDisplay", false, false, false, false); + bool bg = true; + CairoEditableText& ss (selection_start->main_display()); ss.set_ypad (1); ss.set_xpad (1); ss.set_corner_radius (0); - ss.set_draw_background (false); + ss.set_draw_background (bg); CairoEditableText& se (selection_end->main_display()); se.set_ypad (1); se.set_xpad (1); se.set_corner_radius (0); - se.set_draw_background (false); + se.set_draw_background (bg); CairoEditableText& sl (selection_length->main_display()); sl.set_ypad (1); sl.set_xpad (2); sl.set_corner_radius (0); - sl.set_draw_background (false); + sl.set_draw_background (bg); CairoEditableText& ps (punch_start->main_display()); ps.set_ypad (1); ps.set_xpad (2); ps.set_corner_radius (0); - ps.set_draw_background (false); + ps.set_draw_background (bg); CairoEditableText& pe (punch_end->main_display()); pe.set_ypad (1); pe.set_xpad (2); pe.set_corner_radius (0); - pe.set_draw_background (false); + pe.set_draw_background (bg); selection_title.set_markup (string_compose ("<span size=\"x-small\">%1</span>", _("Selection"))); punch_title.set_markup (string_compose ("<span size=\"x-small\">%1</span>", _("Punch"))); @@ -189,18 +191,27 @@ TimeInfoBox::punch_changed (Location* loc) bool TimeInfoBox::on_expose_event (GdkEventExpose* ev) { - Table::on_expose_event (ev); - { - Cairo::RefPtr<Cairo::Context> context = get_window()->create_cairo_context(); - - context->rectangle (ev->area.x, ev->area.y, ev->area.width, ev->area.height); - context->clip (); + int x, y; + Gtk::Widget* window_parent; + Glib::RefPtr<Gdk::Window> win = Gtkmm2ext::window_to_draw_on (*this, &window_parent); + + if (win) { - context->set_source_rgba (0.01, 0.02, 0.21, 1.0); - Gtkmm2ext::rounded_rectangle (context, 0, 0, get_allocation().get_width(), get_allocation().get_height(), 5); - context->fill (); + Cairo::RefPtr<Cairo::Context> context = win->create_cairo_context(); + + translate_coordinates (*window_parent, 0, 0, x, y); + + context->rectangle (x, y, ev->area.width, ev->area.height); + context->clip (); + + context->set_source_rgba (0.149, 0.149, 0.149, 1.0); + Gtkmm2ext::rounded_rectangle (context, x, y, get_allocation().get_width(), get_allocation().get_height(), 5); + context->fill (); + } } + Table::on_expose_event (ev); + return false; } |