more clock & time info box tweaking

git-svn-id: svn://localhost/ardour2/branches/3.0@9689 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-06-08 17:27:26 +00:00
parent 0311b782c8
commit b6b24d353b
5 changed files with 110 additions and 74 deletions

View File

@ -772,15 +772,26 @@ style "option_entry" = "default"
}
style "red_when_active" = "medium_text"
style "very_small_bright_when_active" = "very_small_text"
{
fg[NORMAL] = @@COLPREFIX@_fg
bg[NORMAL] = @@COLPREFIX@_bg
bg[PRELIGHT] = @@COLPREFIX@_bg
bg[PRELIGHT] = @@COLPREFIX@_bg
fg[ACTIVE] = @@COLPREFIX@_fg
bg[ACTIVE] = @@COLPREFIX@_bright_indicator
bg[PRELIGHT] = @@COLPREFIX@_bright_indicator
bg[PRELIGHT] = @@COLPREFIX@_bright_indicator
}
style "bright_when_active" = "medium_text"
{
fg[NORMAL] = @@COLPREFIX@_fg
bg[NORMAL] = @@COLPREFIX@_bg
bg[PRELIGHT] = @@COLPREFIX@_bg
fg[ACTIVE] = @@COLPREFIX@_fg
bg[ACTIVE] = @@COLPREFIX@_bright_indicator
bg[PRELIGHT] = @@COLPREFIX@_bright_indicator
}
style "xrun_warn" = "larger_bold_text"
@ -1366,7 +1377,7 @@ style "pan_zone" = "default"
fg[ACTIVE] = darker(@@COLPREFIX@_bright_color)
}
style "paler_red_when_active" = "medium_text"
style "paler_bright_when_active" = "medium_text"
{
fg[NORMAL] = @@COLPREFIX@_fg
fg[PRELIGHT] = @@COLPREFIX@_fg
@ -1690,10 +1701,10 @@ widget "*EditorTrackNameDisplay" style:highest "track_name_display"
widget "*EditorTrackNameDisplay*" style:highest "track_name_display"
widget "*EditorActiveTrackNameDisplay" style:highest "active_track_name_display"
widget "*EditorActiveTrackNameDisplay*" style:highest "active_track_name_display"
widget "*CrossfadeEditAuditionButton" style:highest "red_when_active"
widget "*CrossfadeEditAuditionButton*" style:highest "red_when_active"
widget "*CrossfadeEditCurveButton" style:highest "red_when_active"
widget "*CrossfadeEditCurveButton*" style:highest "red_when_active"
widget "*CrossfadeEditAuditionButton" style:highest "bright_when_active"
widget "*CrossfadeEditAuditionButton*" style:highest "bright_when_active"
widget "*CrossfadeEditCurveButton" style:highest "bright_when_active"
widget "*CrossfadeEditCurveButton*" style:highest "bright_when_active"
widget "*CrossfadeEditLabel" style:highest "medium_text"
widget "*CrossfadeEditFrame" style:highest "base_frame"
widget "*MouseModeButton" style:highest "mouse_mode_button"
@ -1737,8 +1748,8 @@ widget "*RegionEditorLabel" style:highest "medium_text"
widget "*RegionEditorSmallLabel" style:highest "small_text"
widget "*RegionEditorEntry" style:highest "medium_entry"
widget "*RegionEditorClock" style:highest "default_clock_display"
widget "*RegionEditorToggleButton" style:highest "paler_red_when_active"
widget "*RegionEditorToggleButton*" style:highest "paler_red_when_active"
widget "*RegionEditorToggleButton" style:highest "paler_bright_when_active"
widget "*RegionEditorToggleButton*" style:highest "paler_bright_when_active"
widget "*MixerStripSpeedBase" style:highest "small_entry"
widget "*MixerStripSpeedBase*" style:highest "small_entry"
widget "*MixerStripSpeedBaseNotOne" style:highest "small_red_on_black_entry"
@ -1754,8 +1765,8 @@ widget "*MixerStripPeakDisplay*" style:highest "red_active_small_entry"
widget "*MixerStripPeakDisplayPeak*" style:highest "peak_display_peaked_entry"
widget "*MixerStripSelectedFrame" style:highest "selected_strip_frame"
widget "*MixerStripFrame" style:highest "base_frame"
widget "*HWMonitorButton" style:highest "red_when_active"
widget "*HWMonitorButton*" style:highest "red_when_active"
widget "*HWMonitorButton" style:highest "bright_when_active"
widget "*HWMonitorButton*" style:highest "bright_when_active"
widget "*MonitorInvertButton" style:highest "monitor_invert_button"
widget "*MonitorInvertButton*" style:highest "monitor_invert_button"
widget "*MonitorMuteButton" style:highest "monitor_mute_button"
@ -1770,8 +1781,8 @@ widget "*MonitorOptButton" style:highest "monitor_opt_button"
widget "*MonitorOptButton*" style:highest "monitor_opt_button"
widget "*MonitorIsoAlert" style:highest "monitor_iso_button"
widget "*MonitorIsoAlert*" style:highest "monitor_iso_button"
widget "*BypassButton" style:highest "red_when_active"
widget "*BypassButton*" style:highest "red_when_active"
widget "*BypassButton" style:highest "bright_when_active"
widget "*BypassButton*" style:highest "bright_when_active"
widget "*TransportSoloAlert" style:highest "flashing_alert"
widget "*TransportSoloAlert.*" style:highest "flashing_alert"
widget "*TransportSoloAlert-active" style:highest "flashing_alert"
@ -1819,7 +1830,7 @@ widget "*AddRouteDialog.GtkLabel" style:highest "medium_text"
widget "*AddRouteDialogChannelChoice" style:highest "medium_bold_entry"
widget "*AddRouteDialogSpinner" style:highest "medium_bold_entry"
widget "*AddRouteDialogSpinner*" style:highest "medium_bold_entry"
widget "*AddRouteDialogRadioButton" style:highest "red_when_active"
widget "*AddRouteDialogRadioButton" style:highest "bright_when_active"
widget "*AddRouteDialogButton" style:highest "default_button"
widget "*AddRouteDialogNameTemplateEntry" style:highest "medium_bold_entry"
widget "*NewSessionIOLabel" style:highest "large_bold_text"
@ -1873,6 +1884,10 @@ widget "*SoloLEDLabel" style:highest "very_small_text"
widget "*ContrastingPopup" style:highest "contrasting_popup"
widget "*ContrastingPopup*" style:highest "contrasting_popup"
widget "*MidiChannelSelectorButton" style:highest "midi_channel_selector_button"
widget "*TimeInfoSelectionTitle" style:highest "very_small_bright_when_active"
widget "*TimeInfoSelectionLabel" style:highest "very_small_bright_when_active"
widget "*TimeInfoPunchTitle" style:highest "very_small_bright_when_active"
widget "*TimeInfoPunchLabel" style:highest "very_small_bright_when_active"
widget "*RouteNameEditorEntry" style:highest "text_cell_entry"
widget "*RegionNameEditorEntry" style:highest "text_cell_entry"

View File

@ -231,10 +231,12 @@ AudioClock::set_theme ()
display->set_font (font);
/* propagate font style,but smaller, into supplemental text */
if (supplemental_left) {
/* propagate font style, sort of, into supplemental text */
boost::shared_ptr<CairoFontDescription> smaller_font (new CairoFontDescription (*display->font().get()));
smaller_font->set_size (12);
smaller_font->set_weight (Cairo::FONT_WEIGHT_NORMAL);
supplemental_right->set_font (smaller_font);
supplemental_left->set_font (smaller_font);
}
@ -405,7 +407,7 @@ AudioClock::set_frames (framepos_t when, bool /*force*/)
snprintf (buf, sizeof (buf), "%" PRId64, when);
if (_off) {
display->set_text (_text_cells[AudioFrames], "--");
display->set_text (_text_cells[AudioFrames], "-----------");
if (supplemental_left) {
supplemental_left->set_text (_text_cells[LowerLeft2], "");
@ -1862,14 +1864,14 @@ AudioClock::set_mode (Mode m)
supplemental_right->add_cell (_text_cells[LowerRight1]);
supplemental_right->add_cell (_text_cells[LowerRight2]);
supplemental_left->set_width_chars (_text_cells[LowerLeft1], 1.5); // why not 1? M must be wider than 8, i suppose
supplemental_left->set_width_chars (_text_cells[LowerLeft1], 1);
supplemental_left->set_width_chars (_text_cells[LowerLeft2], 5.25);
supplemental_right->set_width_chars (_text_cells[LowerRight1], 1);
supplemental_right->set_width_chars (_text_cells[LowerRight1], 2); // why not 1? M is too wide
supplemental_right->set_width_chars (_text_cells[LowerRight2], 5);
supplemental_left->set_text (_text_cells[LowerLeft1], _("M"));
supplemental_right->set_text (_text_cells[LowerRight1], _("T"));
supplemental_left->set_text (_text_cells[LowerLeft1], _("T"));
supplemental_right->set_text (_text_cells[LowerRight1], _("M"));
}
break;
@ -1881,6 +1883,23 @@ AudioClock::set_mode (Mode m)
display->add_cell (_text_cells[MS_Seconds]);
display->add_cell (_fixed_cells[Colon3]);
display->add_cell (_text_cells[MS_Milliseconds]);
if (supplemental_left) {
supplemental_left->add_cell (_text_cells[LowerLeft1]);
supplemental_left->add_cell (_text_cells[LowerLeft2]);
supplemental_right->add_cell (_text_cells[LowerRight1]);
supplemental_right->add_cell (_text_cells[LowerRight2]);
/* These are going to remain empty */
supplemental_left->set_width_chars (_text_cells[LowerLeft1], 1);
supplemental_left->set_width_chars (_text_cells[LowerLeft2], 5);
supplemental_right->set_width_chars (_text_cells[LowerRight1], 1);
supplemental_right->set_width_chars (_text_cells[LowerRight2], 1);
supplemental_left->set_text (_text_cells[LowerLeft1], _(" "));
supplemental_right->set_text (_text_cells[LowerRight1], _(" "));
}
break;
case Frames:
@ -1907,15 +1926,8 @@ 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);
}
set_off (false);
set (last_when, true);
if (!is_transient) {

View File

@ -50,40 +50,23 @@ 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 (bg);
CairoEditableText& se (selection_end->main_display());
se.set_ypad (1);
se.set_xpad (1);
se.set_corner_radius (0);
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 (bg);
CairoEditableText& ps (punch_start->main_display());
ps.set_ypad (1);
ps.set_xpad (2);
ps.set_corner_radius (0);
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 (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")));
selection_title.set_text (_("Selection"));
punch_title.set_text (_("Punch"));
set_homogeneous (false);
set_spacings (0);
@ -95,28 +78,43 @@ TimeInfoBox::TimeInfoBox ()
Gtk::Label* l;
selection_title.set_name ("TimeInfoSelectionTitle");
attach (selection_title, 0, 2, 0, 1);
l = manage (new Label);
l->set_markup (string_compose ("<span size=\"x-small\">%1</span>", _("Start")));
attach (*l, 0, 1, 1, 2);
l->set_text (_("Start"));
l->set_alignment (1.0, 0.5);
l->set_name (X_("TimeInfoSelectionLabel"));
attach (*l, 0, 1, 1, 2, FILL);
attach (*selection_start, 1, 2, 1, 2);
l = manage (new Label);
l->set_markup (string_compose ("<span size=\"x-small\">%1</span>", _("End")));
attach (*l, 0, 1, 2, 3);
l->set_text (_("End"));
l->set_alignment (1.0, 0.5);
l->set_name (X_("TimeInfoSelectionLabel"));
attach (*l, 0, 1, 2, 3, FILL);
attach (*selection_end, 1, 2, 2, 3);
l = manage (new Label);
l->set_markup (string_compose ("<span size=\"x-small\">%1</span>", _("Length")));
attach (*l, 0, 1, 3, 4);
l->set_text (_("Length"));
l->set_alignment (1.0, 0.5);
l->set_name (X_("TimeInfoSelectionLabel"));
attach (*l, 0, 1, 3, 4, FILL);
attach (*selection_length, 1, 2, 3, 4);
punch_title.set_name ("TimeInfoSelectionTitle");
attach (punch_title, 2, 4, 0, 1);
l = manage (new Label);
l->set_markup (string_compose ("<span size=\"x-small\">%1</span>", _("In")));
attach (*l, 2, 3, 1, 2);
l->set_alignment (1.0, 0.5);
l->set_text (_("In"));
l->set_name (X_("TimeInfoPunchLabel"));
attach (*l, 2, 3, 1, 2, FILL);
attach (*punch_start, 3, 4, 1, 2);
l = manage (new Label);
l->set_markup (string_compose ("<span size=\"x-small\">%1</span>", _("Out")));
attach (*l, 2, 3, 2, 3);
l->set_alignment (1.0, 0.5);
l->set_text (_("Out"));
l->set_name (X_("TimeInfoPunchLabel"));
attach (*l, 2, 3, 2, 3, FILL);
attach (*punch_end, 3, 4, 2, 3);
show_all ();
@ -214,6 +212,8 @@ TimeInfoBox::set_session (Session* s)
watch_punch (punch);
}
punch_changed (punch);
_session->auto_punch_location_changed.connect (_session_connections, MISSING_INVALIDATOR,
boost::bind (&TimeInfoBox::punch_location_changed, this, _1), gui_context());
}
@ -314,11 +314,14 @@ void
TimeInfoBox::punch_changed (Location* loc)
{
if (!loc) {
punch_start->set (99999999);
punch_end->set (999999999);
punch_start->set_off (true);
punch_end->set_off (true);
return;
}
punch_start->set_off (false);
punch_end->set_off (false);
punch_start->set (loc->start());
punch_end->set (loc->end());
}

View File

@ -39,43 +39,43 @@ CairoFontDescription::CairoFontDescription (Pango::FontDescription& fd)
switch (fd.get_style()) {
case Pango::STYLE_NORMAL:
slant = Cairo::FONT_SLANT_NORMAL;
_slant = Cairo::FONT_SLANT_NORMAL;
break;
case Pango::STYLE_OBLIQUE:
slant = Cairo::FONT_SLANT_OBLIQUE;
_slant = Cairo::FONT_SLANT_OBLIQUE;
break;
case Pango::STYLE_ITALIC:
slant = Cairo::FONT_SLANT_ITALIC;
_slant = Cairo::FONT_SLANT_ITALIC;
break;
}
switch (fd.get_weight()) {
case Pango::WEIGHT_ULTRALIGHT:
weight = Cairo::FONT_WEIGHT_NORMAL;
_weight = Cairo::FONT_WEIGHT_NORMAL;
break;
case Pango::WEIGHT_LIGHT:
weight = Cairo::FONT_WEIGHT_NORMAL;
_weight = Cairo::FONT_WEIGHT_NORMAL;
break;
case Pango::WEIGHT_NORMAL:
weight = Cairo::FONT_WEIGHT_NORMAL;
_weight = Cairo::FONT_WEIGHT_NORMAL;
break;
case Pango::WEIGHT_SEMIBOLD:
weight = Cairo::FONT_WEIGHT_BOLD;
_weight = Cairo::FONT_WEIGHT_BOLD;
break;
case Pango::WEIGHT_BOLD:
weight = Cairo::FONT_WEIGHT_BOLD;
_weight = Cairo::FONT_WEIGHT_BOLD;
break;
case Pango::WEIGHT_ULTRABOLD:
weight = Cairo::FONT_WEIGHT_BOLD;
_weight = Cairo::FONT_WEIGHT_BOLD;
break;
case Pango::WEIGHT_HEAVY:
weight = Cairo::FONT_WEIGHT_BOLD;
_weight = Cairo::FONT_WEIGHT_BOLD;
break;
}

View File

@ -79,24 +79,30 @@ class CairoFontDescription {
Cairo::FontWeight w,
double sz)
: face (f)
, slant (s)
, weight (w)
, _slant (s)
, _weight (w)
, _size (sz)
{}
CairoFontDescription (Pango::FontDescription&);
void apply (Cairo::RefPtr<Cairo::Context> context) {
context->select_font_face (face, slant, weight);
context->select_font_face (face, _slant, _weight);
context->set_font_size (_size);
}
void set_size (double sz) { _size = sz; }
double size() const { return _size; }
Cairo::FontSlant slant() const { return _slant; }
void set_slant (Cairo::FontSlant sl) { _slant = sl; }
Cairo::FontWeight weight() const { return _weight; }
void set_weight (Cairo::FontWeight w) { _weight = w; }
private:
std::string face;
Cairo::FontSlant slant;
Cairo::FontWeight weight;
Cairo::FontSlant _slant;
Cairo::FontWeight _weight;
double _size;
};