summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-11-12 20:39:53 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-11-12 20:39:53 +0000
commitff9ddf510065305e13d169d35f9b4e6b88ce76d7 (patch)
tree0e41589d7332ce31499c9f02ca59f9b799487b03 /gtk2_ardour
parentab565167ff36eb473340e950d93d46c3dfaa9616 (diff)
tidy up (a bit) locations editing widget ; use pixbuf/string code from 2.0;remove edit point clock
git-svn-id: svn://localhost/ardour2/branches/3.0@6074 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/ardour3_ui_dark.rc.in4
-rw-r--r--gtk2_ardour/audio_clock.cc28
-rw-r--r--gtk2_ardour/audio_clock.h2
-rw-r--r--gtk2_ardour/editor.cc37
-rw-r--r--gtk2_ardour/editor.h5
-rw-r--r--gtk2_ardour/editor_drag.cc2
-rw-r--r--gtk2_ardour/editor_markers.cc24
-rw-r--r--gtk2_ardour/editor_mixer.cc4
-rw-r--r--gtk2_ardour/keyboard.cc2
-rw-r--r--gtk2_ardour/location_ui.cc120
-rw-r--r--gtk2_ardour/location_ui.h2
-rw-r--r--gtk2_ardour/marker.cc35
-rw-r--r--gtk2_ardour/time_axis_view_item.cc81
-rw-r--r--gtk2_ardour/time_axis_view_item.h3
-rw-r--r--gtk2_ardour/utils.cc37
-rw-r--r--gtk2_ardour/utils.h5
16 files changed, 175 insertions, 216 deletions
diff --git a/gtk2_ardour/ardour3_ui_dark.rc.in b/gtk2_ardour/ardour3_ui_dark.rc.in
index a0643cd7bb..6ed014a9f5 100644
--- a/gtk2_ardour/ardour3_ui_dark.rc.in
+++ b/gtk2_ardour/ardour3_ui_dark.rc.in
@@ -1217,12 +1217,12 @@ style "tearoff_arrow" = "medium_bold_entry"
style "location_row_button" = "default_button"
{
- font_name = "@FONT_BIG@"
+ font_name = "@FONT_NORMAL@"
}
style "location_rows_clock" = "default_clock_display"
{
- font_name = "@FONT_BIG@"
+ font_name = "@FONT_NORMAL@"
}
style "pan_slider"
diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc
index be387a2874..76d29aa23e 100644
--- a/gtk2_ardour/audio_clock.cc
+++ b/gtk2_ardour/audio_clock.cc
@@ -1108,6 +1108,7 @@ bool
AudioClock::field_button_release_event (GdkEventButton *ev, Field field)
{
if (dragging) {
+ cerr << "button event on clock but we are dragging\n";
gdk_pointer_ungrab (GDK_CURRENT_TIME);
dragging = false;
if (ev->y > drag_start_y+1 || ev->y < drag_start_y-1 || Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)){
@@ -1125,6 +1126,7 @@ AudioClock::field_button_release_event (GdkEventButton *ev, Field field)
}
if (Keyboard::is_context_menu_event (ev)) {
+ cerr << "Context menu event on clock\n";
if (ops_menu == 0) {
build_ops_menu ();
}
@@ -1954,6 +1956,32 @@ AudioClock::build_ops_menu ()
ops_items.push_back (MenuElem (_("Minutes:Seconds"), bind (mem_fun(*this, &AudioClock::set_mode), MinSec)));
ops_items.push_back (MenuElem (_("Samples"), bind (mem_fun(*this, &AudioClock::set_mode), Frames)));
ops_items.push_back (MenuElem (_("Off"), bind (mem_fun(*this, &AudioClock::set_mode), Off)));
+
+ if (editable && !is_duration) {
+ ops_items.push_back (SeparatorElem());
+ ops_items.push_back (MenuElem (_("Set From Playhead"), mem_fun(*this, &AudioClock::set_from_playhead)));
+ ops_items.push_back (MenuElem (_("Locate to this time"), mem_fun(*this, &AudioClock::locate)));
+ }
+}
+
+void
+AudioClock::set_from_playhead ()
+{
+ if (!session) {
+ return;
+ }
+
+ set (session->transport_frame());
+}
+
+void
+AudioClock::locate ()
+{
+ if (!session || is_duration) {
+ return;
+ }
+
+ session->request_locate (current_time(), false);
}
void
diff --git a/gtk2_ardour/audio_clock.h b/gtk2_ardour/audio_clock.h
index d8083e1c73..67d137d377 100644
--- a/gtk2_ardour/audio_clock.h
+++ b/gtk2_ardour/audio_clock.h
@@ -49,6 +49,8 @@ class AudioClock : public Gtk::HBox
void focus ();
void set (nframes_t, bool force = false, nframes_t offset = 0, char which = 0);
+ void set_from_playhead ();
+ void locate ();
void set_mode (Mode);
void set_bbt_reference (nframes64_t);
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 8c5d93e749..3bc2980e15 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -234,7 +234,6 @@ Editor::Editor ()
/* tool bar related */
- , edit_point_clock (X_("editpoint"), false, X_("EditPointClock"), true)
, zoom_range_clock (X_("zoomrange"), false, X_("ZoomRangeClock"), true, true)
, toolbar_selection_clock_table (2,3)
@@ -471,8 +470,6 @@ Editor::Editor ()
build_cursors ();
- edit_point_clock.ValueChanged.connect (mem_fun(*this, &Editor::edit_point_clock_changed));
-
ArdourCanvas::Canvas* time_pad = manage(new ArdourCanvas::Canvas());
ArdourCanvas::SimpleLine* pad_line_1 = manage(new ArdourCanvas::SimpleLine(*time_pad->root(),
0.0, 1.0, 100.0, 1.0));
@@ -547,10 +544,10 @@ Editor::Editor ()
the_notebook.set_show_tabs (true);
the_notebook.set_scrollable (true);
- the_notebook.popup_enable ();
+ the_notebook.popup_disable ();
the_notebook.set_tab_pos (Gtk::POS_RIGHT);
the_notebook.show_all ();
-
+
post_maximal_editor_width = 0;
post_maximal_pane_position = 0;
@@ -786,27 +783,6 @@ Editor::instant_save ()
}
void
-Editor::edit_point_clock_changed()
-{
- if (_dragging_edit_point) {
- return;
- }
-
- if (selection->markers.empty()) {
- return;
- }
-
- bool ignored;
- Location* loc = find_location_from_marker (selection->markers.front(), ignored);
-
- if (!loc) {
- return;
- }
-
- loc->move_to (edit_point_clock.current_time());
-}
-
-void
Editor::zoom_adjustment_changed ()
{
if (session == 0) {
@@ -1074,8 +1050,6 @@ Editor::connect_to_session (Session *t)
session_connections.push_back (session->Located.connect (mem_fun (*this, &Editor::located)));
session_connections.push_back (session->config.ParameterChanged.connect (mem_fun (*this, &Editor::parameter_changed)));
- edit_point_clock.set_mode(AudioClock::BBT);
- edit_point_clock.set_session (session);
zoom_range_clock.set_session (session);
_playlist_selector->set_session (session);
nudge_clock.set_session (session);
@@ -2852,17 +2826,17 @@ Editor::setup_toolbar ()
zoom_box.set_border_width (0);
zoom_in_button.set_name ("EditorTimeButton");
- zoom_in_button.add (*(manage (new Image (::get_icon("zoom_in")))));
+ zoom_in_button.set_image (*(manage (new Image (Stock::ZOOM_IN, Gtk::ICON_SIZE_BUTTON))));
zoom_in_button.signal_clicked().connect (bind (mem_fun(*this, &Editor::temporal_zoom_step), false));
ARDOUR_UI::instance()->tooltips().set_tip (zoom_in_button, _("Zoom In"));
zoom_out_button.set_name ("EditorTimeButton");
- zoom_out_button.add (*(manage (new Image (::get_icon("zoom_out")))));
+ zoom_out_button.set_image (*(manage (new Image (Stock::ZOOM_OUT, Gtk::ICON_SIZE_BUTTON))));
zoom_out_button.signal_clicked().connect (bind (mem_fun(*this, &Editor::temporal_zoom_step), true));
ARDOUR_UI::instance()->tooltips().set_tip (zoom_out_button, _("Zoom Out"));
zoom_out_full_button.set_name ("EditorTimeButton");
- zoom_out_full_button.add (*(manage (new Image (::get_icon("zoom_full")))));
+ zoom_out_full_button.set_image (*(manage (new Image (Stock::ZOOM_100, Gtk::ICON_SIZE_BUTTON))));
zoom_out_full_button.signal_clicked().connect (mem_fun(*this, &Editor::temporal_zoom_session));
ARDOUR_UI::instance()->tooltips().set_tip (zoom_out_full_button, _("Zoom to Session"));
@@ -2918,7 +2892,6 @@ Editor::setup_toolbar ()
edit_point_selector.signal_changed().connect (mem_fun(*this, &Editor::edit_point_selection_done));
ARDOUR_UI::instance()->tooltips().set_tip (edit_point_selector, _("Edit point"));
- snap_box.pack_start (edit_point_clock, false, false);
snap_box.pack_start (snap_mode_selector, false, false);
snap_box.pack_start (snap_type_selector, false, false);
snap_box.pack_start (edit_point_selector, false, false);
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 3a41fd735a..0ecef0b60a 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -1484,7 +1484,6 @@ public:
void editor_mixer_button_toggled ();
void editor_list_button_toggled ();
- AudioClock edit_point_clock;
AudioClock zoom_range_clock;
Gtk::Button zoom_in_button;
Gtk::Button zoom_out_button;
@@ -1558,8 +1557,6 @@ public:
void zoom_adjustment_changed();
- void edit_point_clock_changed();
-
void setup_toolbar ();
Gtkmm2ext::TearOff* tools_tearoff;
@@ -1957,8 +1954,6 @@ public:
std::vector<std::string> edit_point_strings;
void selected_marker_moved (ARDOUR::Location*);
- sigc::connection edit_point_clock_connection_a;
- sigc::connection edit_point_clock_connection_b;
bool get_edit_op_range (nframes64_t& start, nframes64_t& end) const;
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index 62810615d4..f24463ef45 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -2378,13 +2378,11 @@ MarkerDrag::motion (GdkEvent* event, bool)
assert (!_copied_locations.empty());
- _editor->edit_point_clock.set (_copied_locations.front()->start());
_editor->show_verbose_time_cursor (newframe, 10);
#ifdef GTKOSX
_editor->update_canvas_now ();
#endif
- _editor->edit_point_clock.set (copy_location->start());
}
void
diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc
index 7989b83e2d..c6a75015b5 100644
--- a/gtk2_ardour/editor_markers.cc
+++ b/gtk2_ardour/editor_markers.cc
@@ -1177,34 +1177,10 @@ Editor::marker_selection_changed ()
}
}
- edit_point_clock_connection_a.disconnect();
- edit_point_clock_connection_b.disconnect();
-
- if (selection->markers.empty()) {
- edit_point_clock.set (0);
- return;
- }
-
for (MarkerSelection::iterator x = selection->markers.begin(); x != selection->markers.end(); ++x) {
(*x)->add_line (cursor_group, 0, _canvas_height);
(*x)->show_line ();
}
-
- edit_point_clock.set (selection->markers.front()->position());
-
- bool ignored;
- Location* loc = find_location_from_marker (selection->markers.front(), ignored);
-
- if (loc) {
- edit_point_clock_connection_a = loc->changed.connect (mem_fun (*this, &Editor::selected_marker_moved));
- edit_point_clock_connection_b = loc->start_changed.connect (mem_fun (*this, &Editor::selected_marker_moved));
- }
-}
-
-void
-Editor::selected_marker_moved (Location* loc)
-{
- edit_point_clock.set (loc->start());
}
struct SortLocationsByPosition {
diff --git a/gtk2_ardour/editor_mixer.cc b/gtk2_ardour/editor_mixer.cc
index 28d21f63b6..862047109a 100644
--- a/gtk2_ardour/editor_mixer.cc
+++ b/gtk2_ardour/editor_mixer.cc
@@ -360,10 +360,6 @@ Editor::session_going_away ()
_routes->clear ();
_route_groups->clear ();
- edit_point_clock_connection_a.disconnect();
- edit_point_clock_connection_b.disconnect();
-
- edit_point_clock.set_session (0);
zoom_range_clock.set_session (0);
nudge_clock.set_session (0);
diff --git a/gtk2_ardour/keyboard.cc b/gtk2_ardour/keyboard.cc
index 200a666fea..6094e3502e 100644
--- a/gtk2_ardour/keyboard.cc
+++ b/gtk2_ardour/keyboard.cc
@@ -197,7 +197,7 @@ Keyboard::snooper (GtkWidget *widget, GdkEventKey *event)
uint32_t keyval;
bool ret = false;
-#if 0
+#if 1
cerr << "snoop widget " << widget << " key " << event->keyval << " type: " << event->type
<< " state " << std::hex << event->state << std::dec
<< endl;
diff --git a/gtk2_ardour/location_ui.cc b/gtk2_ardour/location_ui.cc
index 6c886b0b74..94d7fd0f1c 100644
--- a/gtk2_ardour/location_ui.cc
+++ b/gtk2_ardour/location_ui.cc
@@ -45,30 +45,26 @@ using namespace Gtkmm2ext;
LocationEditRow::LocationEditRow(Session * sess, Location * loc, int32_t num)
: location(0), session(0),
- item_table (1, 7, false),
- start_set_button (_("Use PH")),
- start_go_button (_("Go")),
+ item_table (1, 6, false),
start_clock (X_("locationstart"), true, X_("LocationEditRowClock"), true),
- end_set_button (_("Use PH")),
- end_go_button (_("Go")),
end_clock (X_("locationend"), true, X_("LocationEditRowClock"), true),
length_clock (X_("locationlength"), true, X_("LocationEditRowClock"), true, true),
cd_check_button (_("CD")),
- hide_check_button (_("Hidden")),
- remove_button (_("Remove")),
+ hide_check_button (_("Hide")),
scms_check_button (_("SCMS")),
preemph_check_button (_("Pre-Emphasis"))
{
-
i_am_the_modifier = 0;
+ start_go_button.set_image (*manage (new Image (Stock::JUMP_TO, Gtk::ICON_SIZE_SMALL_TOOLBAR)));
+ end_go_button.set_image (*manage (new Image (Stock::JUMP_TO, Gtk::ICON_SIZE_SMALL_TOOLBAR)));
+ remove_button.set_image (*manage (new Image (Stock::REMOVE, Gtk::ICON_SIZE_SMALL_TOOLBAR)));
+
number_label.set_name ("LocationEditNumberLabel");
name_label.set_name ("LocationEditNameLabel");
name_entry.set_name ("LocationEditNameEntry");
- start_set_button.set_name ("LocationEditSetButton");
start_go_button.set_name ("LocationEditGoButton");
- end_set_button.set_name ("LocationEditSetButton");
end_go_button.set_name ("LocationEditGoButton");
cd_check_button.set_name ("LocationEditCdButton");
hide_check_button.set_name ("LocationEditHideButton");
@@ -82,9 +78,6 @@ LocationEditRow::LocationEditRow(Session * sess, Location * loc, int32_t num)
composer_label.set_name ("LocationEditNumberLabel");
composer_entry.set_name ("LocationEditNameEntry");
- ARDOUR_UI::instance()->tooltips().set_tip(start_set_button, _("Set value to Playhead"));
- ARDOUR_UI::instance()->tooltips().set_tip(end_set_button, _("Set value to Playhead"));
-
isrc_label.set_text ("ISRC: ");
isrc_label.set_size_request (30, -1);
performer_label.set_text ("Performer: ");
@@ -117,44 +110,29 @@ LocationEditRow::LocationEditRow(Session * sess, Location * loc, int32_t num)
scms_check_button.signal_toggled().connect(mem_fun(*this, &LocationEditRow::scms_toggled));
preemph_check_button.signal_toggled().connect(mem_fun(*this, &LocationEditRow::preemph_toggled));
-
set_session (sess);
-
- item_table.attach (number_label, 0, 1, 0, 1, FILL, FILL, 3, 0);
-
- start_hbox.pack_start (start_go_button, false, false);
+ // start_hbox.pack_start (start_go_button, false, false);
start_hbox.pack_start (start_clock, false, false);
- start_hbox.pack_start (start_set_button, false, false);
- item_table.attach (start_hbox, 2, 3, 0, 1, FILL, FILL, 4, 0);
+ /* this is always in this location, no matter what the location is */
+ item_table.attach (start_hbox, 1, 2, 0, 1, FILL, FILL, 4, 0);
- start_set_button.signal_clicked().connect(bind (mem_fun (*this, &LocationEditRow::set_button_pressed), LocStart));
start_go_button.signal_clicked().connect(bind (mem_fun (*this, &LocationEditRow::go_button_pressed), LocStart));
start_clock.ValueChanged.connect (bind (mem_fun (*this, &LocationEditRow::clock_changed), LocStart));
start_clock.ChangeAborted.connect (bind (mem_fun (*this, &LocationEditRow::change_aborted), LocStart));
-
- end_hbox.pack_start (end_go_button, false, false);
+ // end_hbox.pack_start (end_go_button, false, false);
end_hbox.pack_start (end_clock, false, false);
- end_hbox.pack_start (end_set_button, false, false);
- //item_table.attach (end_hbox, 2, 3, 0, 1, 0, 0, 4, 0);
-
- end_set_button.signal_clicked().connect(bind (mem_fun (*this, &LocationEditRow::set_button_pressed), LocEnd));
end_go_button.signal_clicked().connect(bind (mem_fun (*this, &LocationEditRow::go_button_pressed), LocEnd));
end_clock.ValueChanged.connect (bind (mem_fun (*this, &LocationEditRow::clock_changed), LocEnd));
end_clock.ChangeAborted.connect (bind (mem_fun (*this, &LocationEditRow::change_aborted), LocEnd));
-// item_table.attach (length_clock, 3, 4, 0, 1, 0, 0, 4, 0);
length_clock.ValueChanged.connect (bind ( mem_fun(*this, &LocationEditRow::clock_changed), LocLength));
length_clock.ChangeAborted.connect (bind (mem_fun (*this, &LocationEditRow::change_aborted), LocLength));
-// item_table.attach (cd_check_button, 4, 5, 0, 1, 0, Gtk::FILL, 4, 0);
-// item_table.attach (hide_check_button, 5, 6, 0, 1, 0, Gtk::FILL, 4, 0);
-// item_table.attach (remove_button, 7, 8, 0, 1, 0, Gtk::FILL, 4, 0);
-
cd_check_button.signal_toggled().connect(mem_fun(*this, &LocationEditRow::cd_toggled));
hide_check_button.signal_toggled().connect(mem_fun(*this, &LocationEditRow::hide_toggled));
@@ -216,7 +194,7 @@ LocationEditRow::set_location (Location *loc)
if (!location) return;
if (!hide_check_button.get_parent()) {
- item_table.attach (hide_check_button, 6, 7, 0, 1, FILL, Gtk::FILL, 4, 0);
+ item_table.attach (hide_check_button, 5, 6, 0, 1, FILL, Gtk::FILL, 4, 0);
}
hide_check_button.set_active (location->is_hidden());
@@ -227,7 +205,7 @@ LocationEditRow::set_location (Location *loc)
name_label.set_size_request (80, -1);
if (!name_label.get_parent()) {
- item_table.attach (name_label, 1, 2, 0, 1, FILL, FILL, 4, 0);
+ item_table.attach (name_label, 0, 1, 0, 1, FILL, FILL, 4, 0);
}
name_label.show();
@@ -240,21 +218,17 @@ LocationEditRow::set_location (Location *loc)
name_entry.signal_changed().connect (mem_fun(*this, &LocationEditRow::name_entry_changed));
if (!name_entry.get_parent()) {
- item_table.attach (name_entry, 1, 2, 0, 1, FILL | EXPAND, FILL, 4, 0);
+ item_table.attach (name_entry, 0, 1, 0, 1, FILL | EXPAND, FILL, 4, 0);
}
name_entry.show();
if (!cd_check_button.get_parent()) {
- item_table.attach (cd_check_button, 5, 6, 0, 1, FILL, FILL, 4, 0);
+ item_table.attach (cd_check_button, 4, 5, 0, 1, FILL, FILL, 4, 0);
}
if (!remove_button.get_parent()) {
- item_table.attach (remove_button, 7, 8, 0, 1, FILL, FILL, 4, 0);
+ item_table.attach (remove_button, 6, 7, 0, 1, FILL, FILL, 4, 0);
}
- /* XXX i can't find a way to hide the button without messing up
- the row spacing, so make it insensitive (paul).
- */
-
if (location->is_end() || location->is_start()) {
remove_button.set_sensitive (false);
}
@@ -276,27 +250,35 @@ LocationEditRow::set_location (Location *loc)
if (!location->is_mark()) {
if (!end_hbox.get_parent()) {
- item_table.attach (end_hbox, 3, 4, 0, 1, FILL, FILL, 4, 0);
+ item_table.attach (end_hbox, 2, 3, 0, 1, FILL, FILL, 4, 0);
}
if (!length_clock.get_parent()) {
- item_table.attach (length_clock, 4, 5, 0, 1, FILL, FILL, 4, 0);
+ item_table.attach (length_clock, 3, 4, 0, 1, FILL, FILL, 4, 0);
}
end_clock.set (location->end(), true);
length_clock.set (location->length(), true);
- end_set_button.show();
end_go_button.show();
end_clock.show();
length_clock.show();
+ ARDOUR_UI::instance()->tooltips().set_tip (end_go_button, _("Jump to the end of this range"));
+ ARDOUR_UI::instance()->tooltips().set_tip (start_go_button, _("Jump to the start of this range"));
+ ARDOUR_UI::instance()->tooltips().set_tip (remove_button, _("Forget this range"));
+ ARDOUR_UI::instance()->tooltips().set_tip (start_clock, _("Start time"));
+ ARDOUR_UI::instance()->tooltips().set_tip (end_clock, _("End time"));
+ ARDOUR_UI::instance()->tooltips().set_tip (length_clock, _("Length"));
+
} else {
- end_set_button.hide();
+ ARDOUR_UI::instance()->tooltips().set_tip (start_go_button, _("Jump to this marker"));
+ ARDOUR_UI::instance()->tooltips().set_tip (remove_button, _("Forget this marker"));
+ ARDOUR_UI::instance()->tooltips().set_tip (start_clock, _("Position"));
+
end_go_button.hide();
end_clock.hide();
length_clock.hide();
-
}
start_clock.set_sensitive (!location->locked());
@@ -366,23 +348,6 @@ LocationEditRow::composer_entry_changed ()
void
-LocationEditRow::set_button_pressed (LocationPart part)
-{
- if (!location) return;
-
- switch (part) {
- case LocStart:
- location->set_start (session->transport_frame ());
- break;
- case LocEnd:
- location->set_end (session->transport_frame ());
- break;
- default:
- break;
- }
-}
-
-void
LocationEditRow::go_button_pressed (LocationPart part)
{
if (!location) return;
@@ -467,7 +432,7 @@ LocationEditRow::cd_toggled ()
}
if (!cd_track_details_hbox.get_parent()) {
- item_table.attach (cd_track_details_hbox, 1, 8, 1, 2, FILL | EXPAND, FILL, 4, 0);
+ item_table.attach (cd_track_details_hbox, 0, 7, 1, 2, FILL | EXPAND, FILL, 4, 0);
}
// item_table.resize(2, 7);
cd_track_details_hbox.show_all();
@@ -621,13 +586,16 @@ LocationEditRow::focus_name() {
LocationUI::LocationUI ()
: session (0)
- , add_location_button (_("Add New Location"))
- , add_range_button (_("Add New Range"))
+ , add_location_button (_("New Location"))
+ , add_range_button (_("New Range"))
{
i_am_the_modifier = 0;
location_vpacker.set_spacing (5);
+ add_location_button.set_image (*Gtk::manage (new Gtk::Image (Gtk::Stock::ADD, Gtk::ICON_SIZE_BUTTON)));
+ add_range_button.set_image (*Gtk::manage (new Gtk::Image (Gtk::Stock::ADD, Gtk::ICON_SIZE_BUTTON)));
+
location_vpacker.pack_start (loop_edit_row, false, false);
location_vpacker.pack_start (punch_edit_row, false, false);
@@ -646,10 +614,14 @@ LocationUI::LocationUI ()
loc_frame_box.pack_start (location_rows_scroller, true, true);
add_location_button.set_name ("LocationAddLocationButton");
- loc_frame_box.pack_start (add_location_button, false, false);
+
+ HBox* add_button_box = manage (new HBox);
+
+ // loc_frame_box.pack_start (add_location_button, false, false);
+ add_button_box->pack_start (add_location_button, true, true);
loc_frame.set_name ("LocationLocEditorFrame");
- loc_frame.set_label (_("Location (CD index) markers"));
+ loc_frame.set_label (_("Markers (including CD index)"));
loc_frame.add (loc_frame_box);
loc_range_panes.pack1(loc_frame, true, false);
@@ -666,13 +638,16 @@ LocationUI::LocationUI ()
range_frame_box.pack_start (range_rows_scroller, true, true);
add_range_button.set_name ("LocationAddRangeButton");
- range_frame_box.pack_start (add_range_button, false, false);
+ //range_frame_box.pack_start (add_range_button, false, false);
+
+ add_button_box->pack_start (add_range_button, true, true);
range_frame.set_name ("LocationRangeEditorFrame");
- range_frame.set_label (_("Range (CD track) markers"));
+ range_frame.set_label (_("Ranges (including CD track ranges)"));
range_frame.add (range_frame_box);
loc_range_panes.pack2(range_frame, true, false);
location_vpacker.pack_start (loc_range_panes, true, true);
+ location_vpacker.pack_start (*add_button_box, false, false);
pack_start (location_vpacker, true, true);
@@ -880,8 +855,6 @@ LocationUI::refresh_location_list ()
loc_children.clear();
range_children.clear();
- cerr << "about to map locations with session = " << session << endl;
-
if (session) {
session->locations()->apply (*this, &LocationUI::map_locations);
}
@@ -941,7 +914,6 @@ LocationUIWindow::~LocationUIWindow()
void
LocationUIWindow::on_show()
{
- cerr << "Show loc list\n";
_ui.refresh_location_list();
ArdourDialog::on_show();
}
@@ -956,8 +928,6 @@ LocationUIWindow::on_delete_event (GdkEventAny*)
void
LocationUIWindow::set_session (Session *s)
{
- cerr << "Setting session in LUW, with s = " << s << "\n";
-
ArdourDialog::set_session (s);
_ui.set_session (s);
diff --git a/gtk2_ardour/location_ui.h b/gtk2_ardour/location_ui.h
index 56d6505434..a17724f5ba 100644
--- a/gtk2_ardour/location_ui.h
+++ b/gtk2_ardour/location_ui.h
@@ -77,12 +77,10 @@ class LocationEditRow : public Gtk::HBox
Gtk::Label number_label;
Gtk::HBox start_hbox;
- Gtk::Button start_set_button;
Gtk::Button start_go_button;
AudioClock start_clock;
Gtk::HBox end_hbox;
- Gtk::Button end_set_button;
Gtk::Button end_go_button;
AudioClock end_clock;
diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc
index 9cf5969fd7..75a96ef5a4 100644
--- a/gtk2_ardour/marker.cc
+++ b/gtk2_ardour/marker.cc
@@ -356,40 +356,13 @@ Marker::the_item() const
void
Marker::set_name (const string& new_name)
{
- uint32_t pb_width;
- double font_size;
+ int name_width = pixel_width (new_name, *name_font) + 2;
- if (new_name.empty()) {
- return;
- }
-
- font_size = name_font->get_size() / Pango::SCALE;
- pb_width = new_name.length() * font_size;
-
- Glib::RefPtr<Gdk::Pixbuf> buf = Gdk::Pixbuf::create(Gdk::COLORSPACE_RGB, true, 8, pb_width, name_height);
-
- cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, pb_width, name_height);
- cairo_t *cr = cairo_create (surface);
- cairo_text_extents_t te;
- cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0);
- cairo_select_font_face (cr, name_font->get_family().c_str(),
- CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
- cairo_set_font_size (cr, font_size);
- cairo_text_extents (cr, new_name.c_str(), &te);
-
- cairo_move_to (cr, 0.5,
- 0.5 - te.height / 2 - te.y_bearing + name_height / 2);
- cairo_show_text (cr, new_name.c_str());
-
- unsigned char* src = cairo_image_surface_get_data (surface);
- convert_bgra_to_rgba(src, buf->get_pixels(), pb_width, name_height);
-
- cairo_destroy(cr);
- name_pixbuf->property_pixbuf() = buf;
+ name_pixbuf->property_pixbuf() = pixbuf_from_ustring(new_name, name_font, name_width, name_height);
if (_type == End || _type == LoopEnd || _type == PunchOut) {
- name_pixbuf->property_x() = -(te.width);
- }
+ name_pixbuf->property_x() = - (name_width);
+ }
}
void
diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc
index cb114f4f3d..1d8fc2aca7 100644
--- a/gtk2_ardour/time_axis_view_item.cc
+++ b/gtk2_ardour/time_axis_view_item.cc
@@ -56,6 +56,7 @@ bool TimeAxisViewItem::have_name_font = false;
const double TimeAxisViewItem::NAME_X_OFFSET = 15.0;
const double TimeAxisViewItem::GRAB_HANDLE_LENGTH = 6 ;
+int TimeAxisViewItem::NAME_HEIGHT;
double TimeAxisViewItem::NAME_Y_OFFSET;
double TimeAxisViewItem::NAME_HIGHLIGHT_SIZE;
double TimeAxisViewItem::NAME_HIGHLIGHT_THRESH;
@@ -96,6 +97,7 @@ TimeAxisViewItem::TimeAxisViewItem(const string & it_name, ArdourCanvas::Group&
layout->set_font_description (*NAME_FONT);
Gtkmm2ext::get_ink_pixel_size (layout, width, height);
+ NAME_HEIGHT = height;
NAME_Y_OFFSET = height + 3;
NAME_HIGHLIGHT_SIZE = height + 2;
NAME_HIGHLIGHT_THRESH = NAME_HIGHLIGHT_SIZE * 3;
@@ -145,6 +147,8 @@ TimeAxisViewItem::init (const string& it_name, double spu, Gdk::Color const & ba
show_vestigial = true;
visibility = vis;
_sensitive = true;
+ name_pixbuf_width = 0;
+ last_item_width = 0;
if (duration == 0) {
warning << "Time Axis Item Duration == 0" << endl ;
@@ -525,48 +529,16 @@ TimeAxisViewItem::get_time_axis_view()
void
TimeAxisViewItem::set_name_text(const ustring& new_name)
{
- uint32_t pb_width, it_width;
- double font_size;
-
- font_size = NAME_FONT->get_size() / Pango::SCALE;
- it_width = trackview.editor().frame_to_pixel(item_duration);
- pb_width = new_name.length() * font_size;
-
- if (pb_width > it_width - NAME_X_OFFSET) {
- pb_width = it_width - NAME_X_OFFSET;
- }
-
- if (pb_width <= 0 || it_width < NAME_X_OFFSET) {
- if (name_pixbuf) {
- name_pixbuf->hide();
- }
+ if (!name_pixbuf) {
return;
- } else {
- name_pixbuf->show();
}
- Glib::RefPtr<Gdk::Pixbuf> buf = Gdk::Pixbuf::create(Gdk::COLORSPACE_RGB, true, 8, pb_width, NAME_HIGHLIGHT_SIZE);
-
- cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, pb_width, NAME_HIGHLIGHT_SIZE );
- cairo_t *cr = cairo_create (surface);
- cairo_text_extents_t te;
- cairo_set_source_rgba (cr, 0.2, 0.2, 0.2, 1.0);
- cairo_select_font_face (cr, NAME_FONT->get_family().c_str(),
- CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
- cairo_set_font_size (cr, 10);
- cairo_text_extents (cr, new_name.c_str(), &te);
-
- cairo_move_to (cr, 0.5,
- 0.5 - te.height / 2 - te.y_bearing + NAME_HIGHLIGHT_SIZE / 2);
- cairo_show_text (cr, new_name.c_str());
-
- unsigned char* src = cairo_image_surface_get_data (surface);
- convert_bgra_to_rgba(src, buf->get_pixels(), pb_width, NAME_HIGHLIGHT_SIZE);
-
- cairo_destroy(cr);
- name_pixbuf->property_pixbuf() = buf;
+ last_item_width = trackview.editor().frame_to_pixel(item_duration);
+ name_pixbuf_width = pixel_width (new_name, *NAME_FONT) + 2;
+ name_pixbuf->property_pixbuf() = pixbuf_from_ustring(new_name, NAME_FONT, name_pixbuf_width, NAME_HEIGHT);
}
+
/**
* Set the height of this item
*
@@ -897,7 +869,40 @@ TimeAxisViewItem::reset_width_dependent_items (double pixel_width)
void
TimeAxisViewItem::reset_name_width (double /*pixel_width*/)
{
- set_name_text (item_name);
+ uint32_t it_width;
+ int pb_width;
+ bool pixbuf_holds_full_name;
+
+ if (!name_pixbuf) {
+ return;
+ }
+
+ it_width = trackview.editor().frame_to_pixel(item_duration);
+ pb_width = name_pixbuf_width;
+
+ pixbuf_holds_full_name = last_item_width > pb_width + NAME_X_OFFSET;
+ last_item_width = it_width;
+
+ if (pixbuf_holds_full_name && (it_width >= pb_width + NAME_X_OFFSET)) {
+ /*
+ we've previously had the full name length showing
+ and its still showing.
+ */
+ return;
+ }
+
+ if (pb_width > it_width - NAME_X_OFFSET) {
+ pb_width = it_width - NAME_X_OFFSET;
+ }
+
+ if (pb_width <= 0 || it_width <= NAME_X_OFFSET) {
+ name_pixbuf->hide();
+ return;
+ } else {
+ name_pixbuf->show();
+ }
+
+ name_pixbuf->property_pixbuf() = pixbuf_from_ustring(item_name, NAME_FONT, pb_width, NAME_HEIGHT);
}
diff --git a/gtk2_ardour/time_axis_view_item.h b/gtk2_ardour/time_axis_view_item.h
index be475c65d6..ece4b0b214 100644
--- a/gtk2_ardour/time_axis_view_item.h
+++ b/gtk2_ardour/time_axis_view_item.h
@@ -275,6 +275,7 @@ class TimeAxisViewItem : public Selectable
/* these are not constant, but vary with the pixel size
of the font used to display the item name.
*/
+ static int NAME_HEIGHT;
static double NAME_Y_OFFSET ;
static double NAME_HIGHLIGHT_SIZE ;
static double NAME_HIGHLIGHT_THRESH ;
@@ -453,6 +454,8 @@ class TimeAxisViewItem : public Selectable
uint32_t lock_handle_color_r ;
uint32_t lock_handle_color_g ;
uint32_t lock_handle_color_b ;
+ uint32_t last_item_width;
+ int name_pixbuf_width;
ArdourCanvas::Group* group;
ArdourCanvas::SimpleRect* vestigial_frame;
diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc
index 4c4bcf69ec..0f53b0912f 100644
--- a/gtk2_ardour/utils.cc
+++ b/gtk2_ardour/utils.cc
@@ -936,3 +936,40 @@ resize_window_to_proportion_of_monitor (Gtk::Window* window, int max_width, int
window->resize (w, h);
}
+
+Glib::RefPtr<Gdk::Pixbuf>
+pixbuf_from_ustring(const ustring& name, Pango::FontDescription* font, int clip_width, int clip_height)
+{
+ static Glib::RefPtr<Gdk::Pixbuf>* empty_pixbuf = 0;
+
+ if (name.empty()) {
+ if (empty_pixbuf == 0) {
+ empty_pixbuf = new Glib::RefPtr<Gdk::Pixbuf>;
+ *empty_pixbuf = Gdk::Pixbuf::create(Gdk::COLORSPACE_RGB, true, 8, clip_width, clip_height);
+ }
+ cerr << "\n\nUSE EMPTY PIXBUF\n";
+ return *empty_pixbuf;
+ }
+
+ Glib::RefPtr<Gdk::Pixbuf> buf = Gdk::Pixbuf::create(Gdk::COLORSPACE_RGB, true, 8, clip_width, clip_height);
+
+ cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, clip_width, clip_height);
+ cairo_t* cr = cairo_create (surface);
+ cairo_text_extents_t te;
+
+ cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0);
+ cairo_select_font_face (cr, font->get_family().c_str(),
+ CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
+ cairo_set_font_size (cr, font->get_size() / Pango::SCALE);
+ cairo_text_extents (cr, name.c_str(), &te);
+
+ cairo_move_to (cr, 0.5, 0.5 - te.height / 2 - te.y_bearing + clip_height / 2);
+ cairo_show_text (cr, name.c_str());
+
+ convert_bgra_to_rgba(cairo_image_surface_get_data (surface), buf->get_pixels(), clip_width, clip_height);
+
+ cairo_destroy(cr);
+ cairo_surface_destroy(surface);
+
+ return buf;
+}
diff --git a/gtk2_ardour/utils.h b/gtk2_ardour/utils.h
index dfcd4c8469..18c4e860b8 100644
--- a/gtk2_ardour/utils.h
+++ b/gtk2_ardour/utils.h
@@ -102,6 +102,11 @@ void convert_bgra_to_rgba (guint8 const* src,
int width,
int height);
+Glib::RefPtr<Gdk::Pixbuf> pixbuf_from_ustring (const Glib::ustring& name,
+ Pango::FontDescription* font,
+ int clip_width,
+ int clip_height);
+
void resize_window_to_proportion_of_monitor (Gtk::Window*, int, int);
#endif /* __ardour_gtk_utils_h__ */