timecode clock info patch from oofus, big clock mods from oofus, rec-sensitive color in big clock, update all transport clocks when changing playhead, bounds check for automation bug

git-svn-id: svn://localhost/ardour2/trunk@1173 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis
2006-11-30 16:43:11 +00:00
parent 9cca1464a8
commit 9f2164b4f3
12 changed files with 228 additions and 117 deletions

View File

@@ -127,13 +127,6 @@ style "base_frame"
bg[NORMAL] = { 0.35, 0.35, 0.40 }
}
style "red_frame"
{
fg[NORMAL] = { 1.0, 0.0, 0.0 }
bg[NORMAL] = { 1.0, 0.0, 0.0 }
}
style "transport_base" = "medium_bold_text"
{
bg[NORMAL] = { 0.10, 0.10, 0.10 }
@@ -498,9 +491,25 @@ style "small_red_on_black_entry" = "small_bold_text"
bg[ACTIVE] = { 0.0, 0.0, 0.0 }
}
style "big_clock_display" = "medium_entry"
style "non_recording_big_clock_display" = "medium_entry"
{
font_name = "courier bold 34"
font_name = "sans 60"
fg[NORMAL] = { 0.50, 1.0, 0.50 }
fg[ACTIVE] = { 1.0, 0, 0.0 }
fg[SELECTED] = { 1.0, 0, 0 }
fg[PRELIGHT] = { 1.0, 0, 0.0 }
fg[INSENSITIVE] = { 1.0, 0, 0.0 }
base[NORMAL] = { 0.0, 0.0, 0.0 }
base[ACTIVE] = { 0.0, 0.0, 0.0 }
bg[NORMAL] = { 0.0, 0.0, 0.0 }
bg[ACTIVE] = { 0.7, 0.0, 0.0 }
}
style "recording_big_clock_display" = "non_recording_big_clock_display"
{
fg[NORMAL] = { 1.0, 0, 0 }
}
style "transport_clock_display"
@@ -521,7 +530,7 @@ style "transport_clock_display"
style "tempo_meter_clock_display"
{
font_name = "sans 8"
font_name = "sans 7"
fg[NORMAL] = { 1.0, 1.0, 1.0 }
fg[ACTIVE] = { 1.0, 1.0, 0.0 }
fg[SELECTED] = { 1.0, 0, 0 }
@@ -1075,11 +1084,16 @@ widget "*ErrorMessage" style "error_message"
widget "*FatalMessage" style "fatal_message"
widget "*InfoMessage" style "info_message"
widget "*WarningMessage" style "warning_message"
widget "*BigClockDisplay" style "big_clock_display"
widget "*BigClockNonRecording" style "non_recording_big_clock_display"
widget "*BigClockRecording" style "recording_big_clock_display"
widget "*TransportClockDisplay" style "transport_clock_display"
widget "*SecondaryClockDisplay" style "transport_clock_display"
widget "*BBTTempoLabel" style "tempo_meter_clock_display"
widget "*BBTMeterLabel" style "tempo_meter_clock_display"
widget "*AudioClockFramesUpperInfo" style "tempo_meter_clock_display"
widget "*AudioClockFramesLowerInfo" style "tempo_meter_clock_display"
widget "*AudioClockSMPTEUpperInfo" style "tempo_meter_clock_display"
widget "*AudioClockSMPTELowerInfo" style "tempo_meter_clock_display"
widget "*AudioClockBBTUpperInfo" style "tempo_meter_clock_display"
widget "*AudioClockBBTLowerInfo" style "tempo_meter_clock_display"
widget "*SelectionStartClock" style "default_clock_display"
widget "*SelectionEndClock" style "default_clock_display"
widget "*EditCursorClock" style "default_clock_display"
@@ -1110,7 +1124,6 @@ widget "*BBTRuler" style "editor_time_ruler"
widget "*FramesRuler" style "editor_time_ruler"
widget "*MinSecRuler" style "editor_time_ruler"
widget "*BaseFrame" style "base_frame"
widget "*RedFrame" style "red_frame"
widget "*AudioTrackStripBase" style "audio_track_base"
widget "*TimeAxisViewControlsBaseUnselected" style "audio_track_base"
widget "*AudioTrackControlsBaseUnselected" style "audio_track_base"

View File

@@ -108,7 +108,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile)
/* big clock */
big_clock ("BigClockDisplay", true, false, true),
big_clock ("BigClockNonRecording", true, false, true),
/* transport */
@@ -2401,3 +2401,32 @@ ARDOUR_UI::use_config ()
ract->set_active ();
}
}
void
ARDOUR_UI::update_transport_clocks (nframes_t pos)
{
primary_clock.set (pos);
secondary_clock.set (pos);
if (big_clock_window) {
big_clock.set (pos);
}
}
void
ARDOUR_UI::record_state_changed ()
{
if (!session || !big_clock_window) {
/* why bother - the clock isn't visible */
return;
}
switch (session->record_status()) {
case Session::Recording:
big_clock.set_name ("BigClockRecording");
break;
default:
big_clock.set_name ("BigClockNonRecording");
break;
}
}

View File

@@ -325,6 +325,9 @@ class ARDOUR_UI : public Gtkmm2ext::UI
Gtk::Frame big_clock_frame;
Gtk::Window* big_clock_window;
void update_transport_clocks (nframes_t pos);
void record_state_changed ();
/* Transport Control */
void detach_tearoff (Gtk::Box* parent, Gtk::Widget* contents);

View File

@@ -57,6 +57,7 @@ void
ARDOUR_UI::we_have_dependents ()
{
setup_keybindings ();
editor->UpdateAllTransportClocks.connect (mem_fun (*this, &ARDOUR_UI::update_transport_clocks));
}
void

View File

@@ -50,6 +50,7 @@ ARDOUR_UI::connect_to_session (Session *s)
session = s;
session->HaltOnXrun.connect (mem_fun(*this, &ARDOUR_UI::halt_on_xrun_message));
session->RecordStateChanged.connect (mem_fun (*this, &ARDOUR_UI::record_state_changed));
/* sensitize menu bar options that are now valid */

View File

@@ -58,7 +58,7 @@ const uint32_t AudioClock::field_length[(int) AudioClock::AudioFrames+1] = {
10 /* Audio Frame */
};
AudioClock::AudioClock (const string& name, bool allow_edit, bool duration, bool with_extras)
AudioClock::AudioClock (std::string name, bool allow_edit, bool duration, bool with_info)
: is_duration (duration),
editable (allow_edit),
colon1 (":"),
@@ -75,9 +75,48 @@ AudioClock::AudioClock (const string& name, bool allow_edit, bool duration, bool
ops_menu = 0;
dragging = false;
if (with_info) {
frames_upper_info_label = manage (new Label);
frames_lower_info_label = manage (new Label);
smpte_upper_info_label = manage (new Label);
smpte_lower_info_label = manage (new Label);
bbt_upper_info_label = manage (new Label);
bbt_lower_info_label = manage (new Label);
frames_upper_info_label->set_name ("AudioClockFramesUpperInfo");
frames_lower_info_label->set_name ("AudioClockFramesLowerInfo");
smpte_upper_info_label->set_name ("AudioClockSMPTEUpperInfo");
smpte_lower_info_label->set_name ("AudioClockSMPTELowerInfo");
bbt_upper_info_label->set_name ("AudioClockBBTUpperInfo");
bbt_lower_info_label->set_name ("AudioClockBBTLowerInfo");
frames_info_box.pack_start (*frames_upper_info_label, true, true);
frames_info_box.pack_start (*frames_lower_info_label, true, true);
smpte_info_box.pack_start (*smpte_upper_info_label, true, true);
smpte_info_box.pack_start (*smpte_lower_info_label, true, true);
bbt_info_box.pack_start (*bbt_upper_info_label, true, true);
bbt_info_box.pack_start (*bbt_lower_info_label, true, true);
} else {
frames_upper_info_label = 0;
frames_lower_info_label = 0;
smpte_upper_info_label = 0;
smpte_lower_info_label = 0;
bbt_upper_info_label = 0;
bbt_lower_info_label = 0;
}
audio_frames_ebox.add (audio_frames_label);
frames_packer_hbox.set_border_width (2);
frames_packer_hbox.pack_start (audio_frames_ebox, false, false);
frames_packer.set_homogeneous (false);
frames_packer.set_border_width (2);
frames_packer.pack_start (audio_frames_ebox, false, false);
if (with_info) {
frames_packer.pack_start (frames_info_box, false, false, 5);
}
frames_packer_hbox.pack_start (frames_packer, true, false);
hours_ebox.add (hours_label);
minutes_ebox.add (minutes_label);
@@ -100,6 +139,10 @@ AudioClock::AudioClock (const string& name, bool allow_edit, bool duration, bool
smpte_packer.pack_start (colon3, false, false);
smpte_packer.pack_start (frames_ebox, false, false);
if (with_info) {
smpte_packer.pack_start (smpte_info_box, false, false, 5);
}
smpte_packer_hbox.pack_start (smpte_packer, true, false);
bbt_packer.set_homogeneous (false);
@@ -110,34 +153,8 @@ AudioClock::AudioClock (const string& name, bool allow_edit, bool duration, bool
bbt_packer.pack_start (b2, false, false);
bbt_packer.pack_start (ticks_ebox, false, false);
if (with_extras) {
framerate_label = manage (new Label);
pullup_label = manage (new Label);
framerate_label->set_name ("BBTMeterLabel");
pullup_label->set_name ("BBTTempoLabel");
rate_pullup_box.pack_start (*framerate_label, true, true);
rate_pullup_box.pack_start (*pullup_label, true, true);
smpte_packer.pack_start (rate_pullup_box, false,false, 5);
meter_label = manage (new Label);
tempo_label = manage (new Label);
meter_label->set_name ("BBTMeterLabel");
tempo_label->set_name ("BBTTempoLabel");
tempo_meter_box.pack_start (*meter_label, true, true);
tempo_meter_box.pack_start (*tempo_label, true, true);
bbt_packer.pack_start (tempo_meter_box, false, false, 5);
} else {
framerate_label = 0;
pullup_label = 0;
meter_label = 0;
tempo_label = 0;
if (with_info) {
bbt_packer.pack_start (bbt_info_box, false, false, 5);
}
bbt_packer_hbox.pack_start (bbt_packer, true, false);
@@ -152,7 +169,46 @@ AudioClock::AudioClock (const string& name, bool allow_edit, bool duration, bool
minsec_packer_hbox.pack_start (minsec_packer, true, false);
clock_frame.set_shadow_type (Gtk::SHADOW_IN);
clock_frame.set_name ("BaseFrame");
clock_frame.add (clock_base);
set_name (name);
_mode = BBT; /* lie to force mode switch */
set_mode (SMPTE);
pack_start (clock_frame, true, true);
/* the clock base handles button releases for menu popup regardless of
editable status. if the clock is editable, the clock base is where
we pass focus to after leaving the last editable "field", which
will then shutdown editing till the user starts it up again.
it does this because the focus out event on the field disables
keyboard event handling, and we don't connect anything up to
notice focus in on the clock base. hence, keyboard event handling
stays disabled.
*/
clock_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::SCROLL_MASK);
clock_base.signal_button_release_event().connect (bind (mem_fun (*this, &AudioClock::field_button_release_event), SMPTE_Hours));
Session::SMPTEOffsetChanged.connect (mem_fun (*this, &AudioClock::smpte_offset_changed));
if (editable) {
setup_events ();
}
set (last_when, true);
}
void
AudioClock::set_name (string name)
{
Widget::set_name (name);
clock_base.set_name (name);
audio_frames_label.set_name (name);
@@ -186,37 +242,7 @@ AudioClock::AudioClock (const string& name, bool allow_edit, bool duration, bool
b1.set_name (name);
b2.set_name (name);
clock_frame.set_shadow_type (Gtk::SHADOW_IN);
clock_frame.set_name ("BaseFrame");
clock_frame.add (clock_base);
_mode = BBT; /* lie to force mode switch */
set_mode (SMPTE);
pack_start (clock_frame, true, true);
/* the clock base handles button releases for menu popup regardless of
editable status. if the clock is editable, the clock base is where
we pass focus to after leaving the last editable "field", which
will then shutdown editing till the user starts it up again.
it does this because the focus out event on the field disables
keyboard event handling, and we don't connect anything up to
notice focus in on the clock base. hence, keyboard event handling
stays disabled.
*/
clock_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::SCROLL_MASK);
clock_base.signal_button_release_event().connect (bind (mem_fun (*this, &AudioClock::field_button_release_event), SMPTE_Hours));
Session::SMPTEOffsetChanged.connect (mem_fun (*this, &AudioClock::smpte_offset_changed));
if (editable) {
setup_events ();
}
set (last_when, true);
queue_draw ();
}
void
@@ -404,6 +430,27 @@ AudioClock::set_frames (nframes_t when, bool force)
char buf[32];
snprintf (buf, sizeof (buf), "%u", when);
audio_frames_label.set_text (buf);
if (frames_upper_info_label) {
nframes_t rate = session->frame_rate();
if (fmod (rate, 1000.0) == 0.000) {
sprintf (buf, "%uK", rate/1000);
} else {
sprintf (buf, "%.3fK", rate/1000.0f);
}
frames_upper_info_label->set_text (buf);
float vid_pullup = Config->get_video_pullup();
if (vid_pullup == 0.0) {
frames_lower_info_label->set_text(_("none"));
} else {
sprintf (buf, "%-6.4f", vid_pullup);
frames_lower_info_label->set_text (buf);
}
}
}
void
@@ -481,19 +528,25 @@ AudioClock::set_smpte (nframes_t when, bool force)
frames_label.set_text (buf);
last_frames = smpte.frames;
}
if (framerate_label) {
sprintf (buf, "%-5.2f", Config->get_smpte_frames_per_second());
framerate_label->set_text (buf);
float x = Config->get_video_pullup();
if (x == 0.0) {
pullup_label->set_text (_("none"));
if (smpte_upper_info_label) {
float smpte_frames = Config->get_smpte_frames_per_second();
if ( fmod(smpte_frames, 1.0) == 0.0) {
sprintf (buf, "%u", int (smpte_frames));
} else {
sprintf (buf, "%-6.4f", x);
pullup_label->set_text (buf);
sprintf (buf, "%.2f", smpte_frames);
}
smpte_upper_info_label->set_text (buf);
if (Config->get_smpte_drop_frames()) {
sprintf (buf, "DF");
} else {
sprintf (buf, "NDF");
}
smpte_lower_info_label->set_text (buf);
}
}
@@ -511,12 +564,12 @@ AudioClock::set_bbt (nframes_t when, bool force)
sprintf (buf, "%04" PRIu32, bbt.ticks);
ticks_label.set_text (buf);
if (meter_label) {
if (bbt_upper_info_label) {
TempoMap::Metric m (session->tempo_map().metric_at (when));
sprintf (buf, "%-5.2f", m.tempo().beats_per_minute());
tempo_label->set_text (buf);
bbt_lower_info_label->set_text (buf);
sprintf (buf, "%g|%g", m.meter().beats_per_bar(), m.meter().note_divisor());
meter_label->set_text (buf);
bbt_upper_info_label->set_text (buf);
}
}
@@ -1812,26 +1865,26 @@ AudioClock::set_size_requests ()
switch (_mode) {
case SMPTE:
Gtkmm2ext::set_size_request_to_display_given_text (hours_label, "-88", 2, 2);
Gtkmm2ext::set_size_request_to_display_given_text (minutes_label, "88", 2, 2);
Gtkmm2ext::set_size_request_to_display_given_text (seconds_label, "88", 2, 2);
Gtkmm2ext::set_size_request_to_display_given_text (frames_label, "88", 2, 2);
Gtkmm2ext::set_size_request_to_display_given_text (hours_label, "-00", 5, 5);
Gtkmm2ext::set_size_request_to_display_given_text (minutes_label, "00", 5, 5);
Gtkmm2ext::set_size_request_to_display_given_text (seconds_label, "00", 5, 5);
Gtkmm2ext::set_size_request_to_display_given_text (frames_label, "00", 5, 5);
break;
case BBT:
Gtkmm2ext::set_size_request_to_display_given_text (bars_label, "-888", 2, 2);
Gtkmm2ext::set_size_request_to_display_given_text (beats_label, "88", 2, 2);
Gtkmm2ext::set_size_request_to_display_given_text (ticks_label, "8888", 2, 2);
Gtkmm2ext::set_size_request_to_display_given_text (bars_label, "-000", 5, 5);
Gtkmm2ext::set_size_request_to_display_given_text (beats_label, "00", 5, 5);
Gtkmm2ext::set_size_request_to_display_given_text (ticks_label, "0000", 5, 5);
break;
case MinSec:
Gtkmm2ext::set_size_request_to_display_given_text (ms_hours_label, "99", 2, 2);
Gtkmm2ext::set_size_request_to_display_given_text (ms_minutes_label, "99", 2, 2);
Gtkmm2ext::set_size_request_to_display_given_text (ms_seconds_label, "99.999", 2, 2);
Gtkmm2ext::set_size_request_to_display_given_text (ms_hours_label, "00", 5, 5);
Gtkmm2ext::set_size_request_to_display_given_text (ms_minutes_label, "00", 5, 5);
Gtkmm2ext::set_size_request_to_display_given_text (ms_seconds_label, "00.000", 5, 5);
break;
case Frames:
Gtkmm2ext::set_size_request_to_display_given_text (audio_frames_label, "4294967296", 2, 2);
Gtkmm2ext::set_size_request_to_display_given_text (audio_frames_label, "0000000000", 5, 5);
break;
case Off:

View File

@@ -43,19 +43,21 @@ class AudioClock : public Gtk::HBox
Off
};
AudioClock (const string& name, bool editable, bool is_duration = false, bool with_tempo_meter = false);
AudioClock (std::string name, bool editable, bool is_duration = false, bool with_info = false);
Mode mode() const { return _mode; }
void set (nframes_t, bool force = false);
void set_mode (Mode);
void set_name (std::string);
nframes_t current_time (nframes_t position = 0) const;
nframes_t current_duration (nframes_t position = 0) const;
void set_session (ARDOUR::Session *s);
sigc::signal<void> ValueChanged;
private:
ARDOUR::Session *session;
Mode _mode;
@@ -75,6 +77,7 @@ class AudioClock : public Gtk::HBox
Gtk::HBox bbt_packer;
Gtk::HBox frames_packer_hbox;
Gtk::HBox frames_packer;
enum Field {
SMPTE_Hours,
@@ -112,11 +115,6 @@ class AudioClock : public Gtk::HBox
Gtk::Label frames_label;
Gtk::Label colon1, colon2, colon3;
Gtk::Label* framerate_label;
Gtk::Label* pullup_label;
Gtk::VBox rate_pullup_box;
Gtk::Label ms_hours_label;
Gtk::Label ms_minutes_label;
Gtk::Label ms_seconds_label;
@@ -128,10 +126,18 @@ class AudioClock : public Gtk::HBox
Gtk::Label b1;
Gtk::Label b2;
Gtk::Label* tempo_label;
Gtk::Label* meter_label;
Gtk::Label* frames_upper_info_label;
Gtk::Label* frames_lower_info_label;
Gtk::VBox tempo_meter_box;
Gtk::Label* smpte_upper_info_label;
Gtk::Label* smpte_lower_info_label;
Gtk::Label* bbt_upper_info_label;
Gtk::Label* bbt_lower_info_label;
Gtk::VBox frames_info_box;
Gtk::VBox smpte_info_box;
Gtk::VBox bbt_info_box;
Gtk::EventBox clock_base;
Gtk::Frame clock_frame;

View File

@@ -128,8 +128,6 @@ AudioRegionEditor::AudioRegionEditor (Session& s, boost::shared_ptr<AudioRegion>
name_changed ();
bounds_changed (Change (StartChanged|LengthChanged|PositionChanged));
XMLNode *node = _region->extra_xml ("GUI");
_region->StateChanged.connect (mem_fun(*this, &AudioRegionEditor::region_changed));
spin_arrow_grab = false;

View File

@@ -465,8 +465,10 @@ AutomationLine::modify_view_point (ControlPoint& cp, double x, double y, bool wi
void
AutomationLine::reset_line_coords (ControlPoint& cp)
{
line_points[cp.view_index].set_x (cp.get_x());
line_points[cp.view_index].set_y (cp.get_y());
if (cp.view_index < line_points.size()) {
line_points[cp.view_index].set_x (cp.get_x());
line_points[cp.view_index].set_y (cp.get_y());
}
}
void

View File

@@ -1978,6 +1978,8 @@ Editor::cursor_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
if (cursor == edit_cursor) {
edit_cursor_clock.set (cursor->current_frame);
} else {
UpdateAllTransportClocks (cursor->current_frame);
}
show_verbose_time_cursor (cursor->current_frame, 10);

View File

@@ -138,6 +138,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway
sigc::signal<void> Resized;
sigc::signal<void> Realized;
sigc::signal<void> GoingAway;
sigc::signal<void,nframes_t> UpdateAllTransportClocks;
Glib::RefPtr<Gtk::ActionGroup> editor_actions;

View File

@@ -31,6 +31,8 @@
#include <gtkmm/entry.h>
#include <gtkmm/label.h>
#include <gtkmm2ext/focus_entry.h>
#include <ardour/types.h>
#include <ardour/region.h>
@@ -120,7 +122,7 @@ class TimeAxisView : public virtual AxisView
Gtk::VBox controls_vbox;
Gtk::HBox name_hbox;
Gtk::Frame name_frame;
Gtk::Entry name_entry;
Gtkmm2ext::FocusEntry name_entry;
void hide_name_label ();
void hide_name_entry ();