various tweaks to get 80% Of the way to proper use of TimeAxisView::name_label and TimeAxisView::name_entry. Not done yet, since the entry sometimes loses focus and cannot be hidden.
git-svn-id: svn://localhost/ardour2/branches/3.0@13836 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
e40a8b384b
commit
f269d7c56e
@ -154,8 +154,9 @@ AutomationTimeAxisView::AutomationTimeAxisView (
|
||||
}
|
||||
|
||||
/* for automation tracks, the label does not swap with an entry box. remove all that stuff */
|
||||
if ( name_label.get_parent() )
|
||||
name_hbox.remove(name_label);
|
||||
if (name_label.get_parent()) {
|
||||
hide_name_label ();
|
||||
}
|
||||
|
||||
name_label.set_text (_name);
|
||||
name_label.set_alignment (Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
|
||||
@ -421,14 +422,15 @@ AutomationTimeAxisView::set_height (uint32_t h)
|
||||
first_call_to_set_height = false;
|
||||
|
||||
if (h >= preset_height (HeightNormal)) {
|
||||
name_label.show();
|
||||
show_name_label ();
|
||||
hide_name_entry ();
|
||||
auto_button.show();
|
||||
hide_button.show_all();
|
||||
|
||||
} else if (h >= preset_height (HeightSmall)) {
|
||||
controls_table.hide_all ();
|
||||
hide_name_entry ();
|
||||
name_label.hide();
|
||||
hide_name_label ();
|
||||
auto_button.hide();
|
||||
}
|
||||
}
|
||||
|
@ -1286,6 +1286,8 @@ RouteTimeAxisView::playlist () const
|
||||
void
|
||||
RouteTimeAxisView::name_entry_changed ()
|
||||
{
|
||||
TimeAxisView::name_entry_changed ();
|
||||
|
||||
string x = name_entry.get_text ();
|
||||
|
||||
if (x == _route->name()) {
|
||||
@ -2168,14 +2170,6 @@ void
|
||||
RouteTimeAxisView::update_rec_display ()
|
||||
{
|
||||
RouteUI::update_rec_display ();
|
||||
|
||||
if (_route->record_enabled()) {
|
||||
hide_name_entry ();
|
||||
show_name_label ();
|
||||
} else {
|
||||
hide_name_label ();
|
||||
show_name_entry ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -70,10 +70,22 @@ PBD::Signal1<void,TimeAxisView*> TimeAxisView::CatchDeletion;
|
||||
TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisView* rent, Canvas& /*canvas*/)
|
||||
: AxisView (sess)
|
||||
, controls_table (2, 8)
|
||||
, height (0)
|
||||
, last_name_entry_key_press_event (0)
|
||||
, display_menu (0)
|
||||
, parent (rent)
|
||||
, selection_group (0)
|
||||
, _hidden (false)
|
||||
, in_destructor (false)
|
||||
, name_packing (NamePackingBits (0))
|
||||
, _size_menu (0)
|
||||
, _canvas_display (0)
|
||||
, _y_position (0)
|
||||
, _editor (ed)
|
||||
, control_parent (0)
|
||||
, _order (0)
|
||||
, _effective_height (0)
|
||||
, _resize_drag_start (-1)
|
||||
, _preresize_cursor (0)
|
||||
, _have_preresize_cursor (false)
|
||||
, _ghost_group (0)
|
||||
@ -94,17 +106,6 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
|
||||
_ghost_group->lower_to_bottom();
|
||||
_ghost_group->show();
|
||||
|
||||
control_parent = 0;
|
||||
display_menu = 0;
|
||||
_hidden = false;
|
||||
in_destructor = false;
|
||||
height = 0;
|
||||
_effective_height = 0;
|
||||
parent = rent;
|
||||
last_name_entry_key_press_event = 0;
|
||||
name_packing = NamePackingBits (0);
|
||||
_resize_drag_start = -1;
|
||||
|
||||
/*
|
||||
Create the standard LHS Controls
|
||||
We create the top-level container and name add the name label here,
|
||||
@ -357,6 +358,28 @@ TimeAxisView::controls_ebox_scroll (GdkEventScroll* ev)
|
||||
bool
|
||||
TimeAxisView::controls_ebox_button_press (GdkEventButton* event)
|
||||
{
|
||||
if (event->button == 1) {
|
||||
if (event->type == GDK_2BUTTON_PRESS) {
|
||||
/* see if it is inside the name label */
|
||||
if (name_label.is_ancestor (controls_ebox)) {
|
||||
int nlx;
|
||||
int nly;
|
||||
controls_ebox.translate_coordinates (name_label, event->x, event->y, nlx, nly);
|
||||
Gtk::Allocation a = name_label.get_allocation ();
|
||||
if (nlx > 0 && nlx < a.get_width() &&
|
||||
nly > 0 && nly < a.get_height()) {
|
||||
hide_name_label ();
|
||||
show_name_entry ();
|
||||
if (can_edit_name()) {
|
||||
name_entry.grab_focus ();
|
||||
name_entry.start_editing ((GdkEvent*) event);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (maybe_set_cursor (event->y) > 0) {
|
||||
_resize_drag_start = event->y_root;
|
||||
}
|
||||
@ -532,6 +555,8 @@ TimeAxisView::set_height (uint32_t h)
|
||||
/* resize the selection rect */
|
||||
show_selection (_editor.get_selection().time);
|
||||
}
|
||||
|
||||
show_name_label ();
|
||||
}
|
||||
|
||||
bool
|
||||
@ -650,6 +675,8 @@ TimeAxisView::name_entry_focus_in (GdkEventFocus*)
|
||||
bool
|
||||
TimeAxisView::name_entry_focus_out (GdkEventFocus*)
|
||||
{
|
||||
cerr << "NEFO\n";
|
||||
|
||||
/* clean up */
|
||||
|
||||
last_name_entry_key_press_event = 0;
|
||||
@ -680,6 +707,9 @@ TimeAxisView::name_entry_activated ()
|
||||
void
|
||||
TimeAxisView::name_entry_changed ()
|
||||
{
|
||||
cerr << "swithcing back to name labnel\n";
|
||||
hide_name_entry ();
|
||||
show_name_label ();
|
||||
}
|
||||
|
||||
bool
|
||||
@ -696,12 +726,7 @@ TimeAxisView::name_entry_button_press (GdkEventButton *ev)
|
||||
}
|
||||
|
||||
if (ev->button == 1) {
|
||||
if (ev->type == GDK_2BUTTON_PRESS) {
|
||||
if (can_edit_name()) {
|
||||
name_entry.grab_focus ();
|
||||
name_entry.start_editing ((GdkEvent*) ev);
|
||||
}
|
||||
} else {
|
||||
if (ev->type != GDK_2BUTTON_PRESS) {
|
||||
conditionally_add_to_selection ();
|
||||
}
|
||||
}
|
||||
@ -1135,7 +1160,7 @@ TimeAxisView::compute_heights ()
|
||||
void
|
||||
TimeAxisView::show_name_label ()
|
||||
{
|
||||
if (!(name_packing & NameLabelPacked)) {
|
||||
if (!(name_packing & NameLabelPacked) && name_label.get_parent() == 0) {
|
||||
name_hbox.pack_start (name_label, true, true);
|
||||
name_packing = NamePackingBits (name_packing | NameLabelPacked);
|
||||
name_hbox.show ();
|
||||
|
@ -281,7 +281,6 @@ class TimeAxisView : public virtual AxisView
|
||||
virtual void selection_click (GdkEventButton*);
|
||||
|
||||
bool _hidden;
|
||||
bool _has_state;
|
||||
bool in_destructor;
|
||||
NamePackingBits name_packing;
|
||||
|
||||
|
@ -148,17 +148,13 @@ VisualTimeAxis::set_height(uint32_t h)
|
||||
{
|
||||
TimeAxisView::set_height(h);
|
||||
|
||||
show_name_label ();
|
||||
|
||||
if (h >= hNormal) {
|
||||
hide_name_label ();
|
||||
show_name_entry ();
|
||||
other_button_hbox.show_all() ;
|
||||
} else if (h >= hSmaller) {
|
||||
hide_name_label ();
|
||||
show_name_entry ();
|
||||
other_button_hbox.hide_all() ;
|
||||
} else if (h >= hSmall) {
|
||||
hide_name_entry ();
|
||||
show_name_label ();
|
||||
other_button_hbox.hide_all() ;
|
||||
}
|
||||
}
|
||||
@ -339,9 +335,9 @@ VisualTimeAxis::start_time_axis_rename()
|
||||
void
|
||||
VisualTimeAxis::label_view()
|
||||
{
|
||||
name_label.set_text(time_axis_name) ;
|
||||
name_entry.set_text(time_axis_name) ;
|
||||
ARDOUR_UI::instance()->set_tip(name_entry, time_axis_name) ;
|
||||
name_label.set_text (time_axis_name);
|
||||
name_entry.set_text (time_axis_name);
|
||||
ARDOUR_UI::instance()->set_tip (name_entry, Glib::Markup::escape_text (time_axis_name));
|
||||
}
|
||||
|
||||
|
||||
@ -351,6 +347,8 @@ VisualTimeAxis::label_view()
|
||||
void
|
||||
VisualTimeAxis::name_entry_changed()
|
||||
{
|
||||
TimeAxisView::name_entry_changed ();
|
||||
|
||||
string x = name_entry.get_text ();
|
||||
|
||||
if (x == time_axis_name) {
|
||||
@ -365,7 +363,7 @@ VisualTimeAxis::name_entry_changed()
|
||||
}
|
||||
|
||||
if (!editor.get_named_time_axis(x)) {
|
||||
set_time_axis_name(x, this);
|
||||
set_time_axis_name (x, this);
|
||||
} else {
|
||||
ARDOUR_UI::instance()->popup_error (_("A track already exists with that name"));
|
||||
name_entry.set_text(time_axis_name);
|
||||
|
Loading…
Reference in New Issue
Block a user