first pass of dynamically resizable track heights

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3298 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2008-04-30 02:37:05 +00:00
parent 4ec4eb2463
commit 53199152fd
18 changed files with 255 additions and 279 deletions

View file

@ -488,7 +488,7 @@ AudioTimeAxisView::toggle_gain_track ()
/* now trigger a redisplay */
if (!no_redraw) {
_route->gui_changed (X_("track_height"), (void *) 0); /* EMIT_SIGNAL */
_route->gui_changed (X_("visible_tracks"), (void *) 0); /* EMIT_SIGNAL */
}
}
}
@ -502,7 +502,7 @@ AudioTimeAxisView::gain_hidden ()
gain_automation_item->set_active (false);
}
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
_route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
}
void
@ -524,7 +524,7 @@ AudioTimeAxisView::toggle_pan_track ()
/* now trigger a redisplay */
if (!no_redraw) {
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
_route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
}
}
}
@ -538,7 +538,7 @@ AudioTimeAxisView::pan_hidden ()
pan_automation_item->set_active (false);
}
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
_route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
}
void
@ -553,7 +553,7 @@ AudioTimeAxisView::show_all_automation ()
no_redraw = false;
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
_route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
}
void
@ -568,7 +568,7 @@ AudioTimeAxisView::show_existing_automation ()
no_redraw = false;
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
_route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
}
void
@ -582,7 +582,7 @@ AudioTimeAxisView::hide_all_automation ()
RouteTimeAxisView::hide_all_automation();
no_redraw = false;
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
_route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
}
void

View file

@ -299,17 +299,15 @@ AutomationTimeAxisView::clear_clicked ()
}
void
AutomationTimeAxisView::set_height (TrackHeight ht)
AutomationTimeAxisView::set_height (uint32_t h)
{
uint32_t h = height_to_pixels (ht);
bool changed = (height != (uint32_t) h);
bool changed_between_small_and_normal = ( (ht == Small || ht == Smaller) ^ (height_style == Small || height_style == Smaller) );
bool changed_between_small_and_normal = ( (h == hSmall || h == hSmaller) ^ (height == hSmall || height == hSmaller) );
TimeAxisView* state_parent = get_parent_with_state ();
XMLNode* xml_node = state_parent->get_child_xml_node (_state_name);
TimeAxisView::set_height (ht);
TimeAxisView::set_height (h);
base_rect->property_y2() = h;
for (vector<AutomationLine*>::iterator i = lines.begin(); i != lines.end(); ++i) {
@ -320,91 +318,60 @@ AutomationTimeAxisView::set_height (TrackHeight ht)
(*i)->set_height ();
}
switch (ht) {
case Largest:
xml_node->add_property ("track_height", "largest");
break;
case Large:
xml_node->add_property ("track_height", "large");
break;
case Larger:
xml_node->add_property ("track_height", "larger");
break;
case Normal:
xml_node->add_property ("track_height", "normal");
break;
case Smaller:
xml_node->add_property ("track_height", "smaller");
break;
case Small:
xml_node->add_property ("track_height", "small");
break;
}
char buf[32];
snprintf (buf, sizeof (buf), "%u", height);
xml_node->add_property ("height", buf);
if (changed_between_small_and_normal || first_call_to_set_height) {
first_call_to_set_height = false;
switch (ht) {
case Largest:
case Large:
case Larger:
case Normal:
controls_table.remove (name_hbox);
if (plugname) {
if (plugname_packed) {
controls_table.remove (*plugname);
plugname_packed = false;
}
controls_table.attach (*plugname, 1, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
plugname_packed = true;
controls_table.attach (name_hbox, 1, 5, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
} else {
controls_table.attach (name_hbox, 1, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
}
hide_name_entry ();
show_name_label ();
name_hbox.show_all ();
auto_button.show();
height_button.show();
clear_button.show();
hide_button.show_all();
break;
case Smaller:
case Small:
controls_table.remove (name_hbox);
if (plugname) {
if (plugname_packed) {
controls_table.remove (*plugname);
plugname_packed = false;
}
if (h >= hNormal) {
controls_table.remove (name_hbox);
if (plugname) {
if (plugname_packed) {
controls_table.remove (*plugname);
plugname_packed = false;
}
controls_table.attach (*plugname, 1, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
plugname_packed = true;
controls_table.attach (name_hbox, 1, 5, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
} else {
controls_table.attach (name_hbox, 1, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
controls_table.hide_all ();
hide_name_entry ();
show_name_label ();
name_hbox.show_all ();
}
hide_name_entry ();
show_name_label ();
name_hbox.show_all ();
auto_button.show();
height_button.show();
clear_button.show();
hide_button.show_all();
auto_button.hide();
height_button.hide();
clear_button.hide();
hide_button.hide();
break;
} else if (h >= hSmall) {
controls_table.remove (name_hbox);
if (plugname) {
if (plugname_packed) {
controls_table.remove (*plugname);
plugname_packed = false;
}
}
controls_table.attach (name_hbox, 1, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
controls_table.hide_all ();
hide_name_entry ();
show_name_label ();
name_hbox.show_all ();
auto_button.hide();
height_button.hide();
clear_button.hide();
hide_button.hide();
}
}
if (changed) {
/* only emit the signal if the height really changed */
route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
}
}

View file

@ -63,7 +63,7 @@ class AutomationTimeAxisView : public TimeAxisView {
~AutomationTimeAxisView();
virtual void set_height (TimeAxisView::TrackHeight);
virtual void set_height (uint32_t);
void set_samples_per_unit (double);
std::string name() const { return _name; }

View file

@ -2117,7 +2117,7 @@ public:
RhythmFerret* rhythm_ferret;
void set_track_height (TimeAxisView::TrackHeight h);
void set_track_height (uint32_t h);
void set_track_height_largest ();
void set_track_height_large ();
void set_track_height_larger ();

View file

@ -5521,7 +5521,7 @@ Editor::playhead_backward_to_grid ()
}
void
Editor::set_track_height (TimeAxisView::TrackHeight h)
Editor::set_track_height (uint32_t h)
{
TrackSelection& ts (selection->tracks);
@ -5537,32 +5537,32 @@ Editor::set_track_height (TimeAxisView::TrackHeight h)
void
Editor::set_track_height_largest ()
{
set_track_height (TimeAxisView::Largest);
set_track_height (TimeAxisView::hLargest);
}
void
Editor::set_track_height_large ()
{
set_track_height (TimeAxisView::Large);
set_track_height (TimeAxisView::hLarge);
}
void
Editor::set_track_height_larger ()
{
set_track_height (TimeAxisView::Larger);
set_track_height (TimeAxisView::hLarger);
}
void
Editor::set_track_height_normal ()
{
set_track_height (TimeAxisView::Normal);
set_track_height (TimeAxisView::hNormal);
}
void
Editor::set_track_height_smaller ()
{
set_track_height (TimeAxisView::Smaller);
set_track_height (TimeAxisView::hSmaller);
}
void
Editor::set_track_height_small ()
{
set_track_height (TimeAxisView::Small);
set_track_height (TimeAxisView::hSmall);
}
void

View file

@ -104,6 +104,14 @@ Editor::handle_gui_changes (const string & what, void *src)
ENSURE_GUI_THREAD(bind (mem_fun(*this, &Editor::handle_gui_changes), what, src));
if (what == "track_height") {
/* make tracks change height while it happens, instead
of on first-idle
*/
track_canvas->update_now ();
redisplay_route_list ();
}
if (what == "visible_tracks") {
redisplay_route_list ();
}
}

View file

@ -81,7 +81,7 @@ ImageFrameTimeAxis::ImageFrameTimeAxis(const string & track_id, PublicEditor& ed
label_view() ;
// set the initial height of this time axis
set_height(Normal) ;
set_height(hNormal) ;
}
/**
@ -133,10 +133,10 @@ ImageFrameTimeAxis::~ImageFrameTimeAxis ()
/**
* Sets the height of this TrackView to one of ths TrackHeghts
*
* @param h the TrackHeight value to set
* @param h
*/
void
ImageFrameTimeAxis::set_height (TrackHeight h)
ImageFrameTimeAxis::set_height (uint32_t h)
{
VisualTimeAxis::set_height(h) ;

View file

@ -76,9 +76,9 @@ class ImageFrameTimeAxis : public VisualTimeAxis
/**
* Sets the height of this TrackView to one of ths TrackHeghts
*
* @param h the TrackHeight value to set
* @param h the number of pixels to set the height too
*/
virtual void set_height(TimeAxisView::TrackHeight) ;
virtual void set_height(uint32_t h) ;
/**
* Sets the number of samples per unit that are used.

View file

@ -82,7 +82,7 @@ MarkerTimeAxis::MarkerTimeAxis (PublicEditor& ed, ARDOUR::Session& sess, Canvas&
label_view() ;
// set the initial height of this time axis
set_height(Small) ;
set_height(hSmall) ;
}
/**
@ -106,13 +106,8 @@ MarkerTimeAxis::~MarkerTimeAxis()
//---------------------------------------------------------------------------------------//
// ui methods & data
/**
* Sets the height of this TrackView to one of the defined TrackHeights
*
* @param h the TrackHeight value to set
*/
void
MarkerTimeAxis::set_height (TrackHeight h)
MarkerTimeAxis::set_height (uint32_t h)
{
VisualTimeAxis::set_height(h) ;

View file

@ -80,9 +80,9 @@ class MarkerTimeAxis : public VisualTimeAxis
/**
* Sets the height of this TrackView to one of the defined TrackHeights
*
* @param h the TrackHeight value to set
* @param h the number of pixels to set the height to
*/
virtual void set_height(TimeAxisView::TrackHeight h) ;
virtual void set_height(uint32_t h) ;
/**
* Sets the number of samples per unit that are used.

View file

@ -114,7 +114,7 @@ PanAutomationTimeAxisView::add_line (AutomationLine& line)
multiline_selector.set_active(0);
}
if (lines.size() + 1 > 1 && (height_style != Small && height_style != Smaller)) {
if (lines.size() + 1 > 1 && (height > hSmall)) {
multiline_selector.show();
} else {
multiline_selector.hide();
@ -125,21 +125,16 @@ PanAutomationTimeAxisView::add_line (AutomationLine& line)
}
void
PanAutomationTimeAxisView::set_height (TimeAxisView::TrackHeight th)
PanAutomationTimeAxisView::set_height (uint32_t h)
{
AutomationTimeAxisView::set_height(th);
AutomationTimeAxisView::set_height(h);
switch (th) {
case Largest:
case Large:
case Larger:
case Normal:
if (lines.size() > 1) {
multiline_selector.show();
break;
}
default:
multiline_selector.hide();
if (h >= hNormal) {
if (lines.size() > 1) {
multiline_selector.show();
}
} else {
multiline_selector.hide();
}
}

View file

@ -45,7 +45,7 @@ class PanAutomationTimeAxisView : public AutomationTimeAxisView
void clear_lines ();
void add_line (AutomationLine&);
void set_height (TimeAxisView::TrackHeight);
void set_height (uint32_t h);
protected:
Gtk::ComboBoxText multiline_selector;

View file

@ -692,10 +692,10 @@ RouteTimeAxisView::show_selection (TimeSelection& ts)
}
void
RouteTimeAxisView::set_height (TrackHeight h)
RouteTimeAxisView::set_height (uint32_t h)
{
int gmlen = (height_to_pixels (h)) - 5;
bool height_changed = (height == 0) || (h != height_style);
int gmlen = h - 5;
bool height_changed = (height == 0) || (h != height);
lm.setup_meters (gmlen);
TimeAxisView::set_height (h);
@ -705,37 +705,11 @@ RouteTimeAxisView::set_height (TrackHeight h)
_view->set_height ((double) height);
}
switch (height_style) {
case Largest:
xml_node->add_property ("track_height", "largest");
break;
char buf[32];
snprintf (buf, sizeof (buf), "%u", height);
xml_node->add_property ("height", buf);
case Large:
xml_node->add_property ("track_height", "large");
break;
case Larger:
xml_node->add_property ("track_height", "larger");
break;
case Normal:
xml_node->add_property ("track_height", "normal");
break;
case Smaller:
xml_node->add_property ("track_height", "smaller");
break;
case Small:
xml_node->add_property ("track_height", "small");
break;
}
switch (height_style) {
case Largest:
case Large:
case Larger:
case Normal:
if (height >= hNormal) {
reset_meter();
show_name_entry ();
hide_name_label ();
@ -755,9 +729,9 @@ RouteTimeAxisView::set_height (TrackHeight h)
if (is_track() && track()->mode() == ARDOUR::Normal) {
playlist_button.show();
}
break;
case Smaller:
} else if (height >= hSmaller) {
reset_meter();
show_name_entry ();
hide_name_label ();
@ -777,13 +751,13 @@ RouteTimeAxisView::set_height (TrackHeight h)
if (is_track() && track()->mode() == ARDOUR::Normal) {
playlist_button.hide ();
}
break;
case Small:
} else if (height >= hSmall) {
hide_meter ();
hide_name_entry ();
show_name_label ();
gain_slider->hide();
mute_button->hide();
solo_button->hide();
@ -797,7 +771,6 @@ RouteTimeAxisView::set_height (TrackHeight h)
automation_button.hide ();
playlist_button.hide ();
name_label.set_text (_route->name());
break;
}
if (height_changed) {
@ -1459,7 +1432,7 @@ RouteTimeAxisView::show_all_automation ()
no_redraw = false;
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
_route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
}
void
@ -1476,8 +1449,8 @@ RouteTimeAxisView::show_existing_automation ()
}
no_redraw = false;
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
_route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
}
void
@ -1492,7 +1465,7 @@ RouteTimeAxisView::hide_all_automation ()
}
no_redraw = false;
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
_route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
}
@ -1641,7 +1614,7 @@ RouteTimeAxisView::redirect_automation_track_hidden (RouteTimeAxisView::Redirect
r->mark_automation_visible (ran->what, false);
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
_route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
}
void
@ -1777,7 +1750,7 @@ RouteTimeAxisView::redirect_menu_item_toggled (RouteTimeAxisView::RedirectAutoma
/* now trigger a redisplay */
_route->gui_changed ("track_height", (void *) 0); /* EMIT_SIGNAL */
_route->gui_changed ("visible_tracks", (void *) 0); /* EMIT_SIGNAL */
}
}
@ -1815,7 +1788,7 @@ RouteTimeAxisView::redirects_changed (void *src)
/* change in visibility was possible */
_route->gui_changed ("track_height", this);
_route->gui_changed ("visible_tracks", this);
}
RedirectAutomationLine *

View file

@ -74,7 +74,7 @@ public:
void show_selection (TimeSelection&);
void set_samples_per_unit (double);
void set_height (TimeAxisView::TrackHeight);
void set_height (uint32_t h);
void show_timestretch (nframes_t start, nframes_t end);
void hide_timestretch ();
void selection_click (GdkEventButton*);

View file

@ -95,6 +95,8 @@ TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisVie
_has_state = false;
last_name_entry_key_press_event = 0;
name_packing = NamePackingBits (0);
resize_drag_start = -1;
resize_idle_id = -1;
/*
Create the standard LHS Controls
@ -130,7 +132,22 @@ TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisVie
controls_table.show_all ();
controls_table.set_no_show_all ();
resizer.set_size_request (5, 5);
resizer.signal_expose_event().connect (mem_fun (*this, &TimeAxisView::resizer_expose));
resizer.signal_button_press_event().connect (mem_fun (*this, &TimeAxisView::resizer_button_press));
resizer.signal_button_release_event().connect (mem_fun (*this, &TimeAxisView::resizer_button_release));
resizer.signal_motion_notify_event().connect (mem_fun (*this, &TimeAxisView::resizer_motion));
resizer.set_events (Gdk::BUTTON_PRESS_MASK|
Gdk::BUTTON_RELEASE_MASK|
Gdk::POINTER_MOTION_MASK|
Gdk::SCROLL_MASK);
resizer_box.pack_start (resizer, false, false);
resizer.show ();
resizer_box.show();
controls_vbox.pack_start (controls_table, false, false);
controls_vbox.pack_end (resizer_box, false, true);
controls_vbox.show ();
controls_ebox.set_name ("TimeAxisViewControlsBaseUnselected");
@ -226,7 +243,7 @@ TimeAxisView::show_at (double y, int& nth, VBox *parent)
_hidden = false;
/* height in pixels depends on _order, so update it now we've changed _order */
set_height (height_style);
set_height (height);
effective_height = height;
@ -326,39 +343,38 @@ TimeAxisView::hide ()
void
TimeAxisView::step_height (bool bigger)
{
if (height == hLargest) {
if (!bigger) set_height (Large);
if (!bigger) set_height (hLarge);
return;
}
if (height == hLarge) {
if (bigger) set_height (Largest);
else set_height (Larger);
if (bigger) set_height (hLargest);
else set_height (hLarger);
return;
}
if (height == hLarger) {
if (bigger) set_height (Large);
else set_height (Normal);
if (bigger) set_height (hLarge);
else set_height (hNormal);
return;
}
if (height == hNormal) {
if (bigger) set_height (Larger);
else set_height (Smaller);
if (bigger) set_height (hLarger);
else set_height (hSmaller);
return;
}
if (height == hSmaller) {
if (bigger) set_height (Normal);
else set_height (Small);
if (bigger) set_height (hNormal);
else set_height (hSmall);
return;
}
if (height == hSmall) {
if (bigger) set_height (Smaller);
if (bigger) set_height (hSmaller);
return;
}
}
void
TimeAxisView::set_heights (TrackHeight h)
TimeAxisView::set_heights (uint32_t h)
{
TrackSelection& ts (editor.get_selection().tracks);
@ -368,14 +384,7 @@ TimeAxisView::set_heights (TrackHeight h)
}
void
TimeAxisView::set_height (TrackHeight h)
{
height_style = h;
set_height_pixels (height_to_pixels (h));
}
void
TimeAxisView::set_height_pixels (uint32_t h)
TimeAxisView::set_height(uint32_t h)
{
height = h;
controls_frame.set_size_request (-1, height + ((order == 0) ? 1 : 0));
@ -423,9 +432,9 @@ TimeAxisView::name_entry_key_release (GdkEventKey* ev)
} while ((*i)->hidden());
}
}
if ((*i)->height_style == Small) {
(*i)->set_height(Smaller);
if ((*i)->height >= hSmall && (*i)->height < hNormal) {
(*i)->set_height(hSmaller);
}
(*i)->name_entry.grab_focus();
@ -612,12 +621,12 @@ TimeAxisView::build_size_menu ()
size_menu->set_name ("ArdourContextMenu");
MenuList& items = size_menu->items();
items.push_back (MenuElem (_("Largest"), bind (mem_fun (*this, &TimeAxisView::set_heights), Largest)));
items.push_back (MenuElem (_("Large"), bind (mem_fun (*this, &TimeAxisView::set_heights), Large)));
items.push_back (MenuElem (_("Larger"), bind (mem_fun (*this, &TimeAxisView::set_heights), Larger)));
items.push_back (MenuElem (_("Normal"), bind (mem_fun (*this, &TimeAxisView::set_heights), Normal)));
items.push_back (MenuElem (_("Smaller"), bind (mem_fun (*this, &TimeAxisView::set_heights),Smaller)));
items.push_back (MenuElem (_("Small"), bind (mem_fun (*this, &TimeAxisView::set_heights), Small)));
items.push_back (MenuElem (_("Largest"), bind (mem_fun (*this, &TimeAxisView::set_heights), hLargest)));
items.push_back (MenuElem (_("Large"), bind (mem_fun (*this, &TimeAxisView::set_heights), hLarge)));
items.push_back (MenuElem (_("Larger"), bind (mem_fun (*this, &TimeAxisView::set_heights), hLarger)));
items.push_back (MenuElem (_("Normal"), bind (mem_fun (*this, &TimeAxisView::set_heights), hNormal)));
items.push_back (MenuElem (_("Smaller"), bind (mem_fun (*this, &TimeAxisView::set_heights),hSmaller)));
items.push_back (MenuElem (_("Small"), bind (mem_fun (*this, &TimeAxisView::set_heights), hSmall)));
}
void
@ -928,60 +937,42 @@ TimeAxisView::set_state (const XMLNode& node)
if ((prop = node.property ("track_height")) != 0) {
if (prop->value() == "largest") {
set_height (Largest);
set_height (hLargest);
} else if (prop->value() == "large") {
set_height (Large);
set_height (hLarge);
} else if (prop->value() == "larger") {
set_height (Larger);
set_height (hLarger);
} else if (prop->value() == "normal") {
set_height (Normal);
set_height (hNormal);
} else if (prop->value() == "smaller") {
set_height (Smaller);
set_height (hSmaller);
} else if (prop->value() == "small") {
set_height (Small);
set_height (hSmall);
} else {
error << string_compose(_("unknown track height name \"%1\" in XML GUI information"), prop->value()) << endmsg;
set_height (Normal);
}
} else if ((prop = node.property ("height")) != 0) {
uint32_t h = atoi (prop->value());
set_height (h);
} else {
set_height (Normal);
set_height (hNormal);
}
}
void
TimeAxisView::reset_height()
{
set_height_pixels (height);
set_height(height);
for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) {
(*i)->set_height_pixels ((TrackHeight)(*i)->height);
(*i)->set_height ((*i)->height);
}
}
uint32_t
TimeAxisView::height_to_pixels (TrackHeight h)
{
switch (h) {
case Largest:
return hLargest;
case Large:
return hLarge;
case Larger:
return hLarger;
case Normal:
return hNormal;
case Smaller:
return hSmaller;
case Small:
return hSmall;
}
// what is wrong with gcc ?
return hNormal;
}
void
TimeAxisView::compute_controls_size_info ()
{
@ -1181,3 +1172,65 @@ TimeAxisView::reshow_feature_lines ()
}
}
bool
TimeAxisView::resizer_button_press (GdkEventButton* event)
{
resize_drag_start = event->y_root;
resize_idle_target = height;
return true;
}
bool
TimeAxisView::resizer_button_release (GdkEventButton* ev)
{
resize_drag_start = -1;
return true;
}
static gboolean
_idle_resizer (gpointer arg)
{
return ((TimeAxisView*)arg)->idle_resize ();
}
bool
TimeAxisView::idle_resize ()
{
set_height (resize_idle_target);
resize_idle_id = -1;
return false;
}
bool
TimeAxisView::resizer_motion (GdkEventMotion* ev)
{
if (resize_drag_start < 0) {
return true;
}
int32_t delta = (int32_t) floor (resize_drag_start - ev->y_root);
resize_idle_target = std::max (resize_idle_target - delta, (int) hSmall);
if (resize_idle_id < 0) {
resize_idle_id = g_idle_add (_idle_resizer, this);
}
resize_drag_start = ev->y_root;
return true;
}
bool
TimeAxisView::resizer_expose (GdkEventExpose* event)
{
resizer.get_window()->draw_rectangle (resizer.get_style()->get_bg_gc(resizer.get_state()),
true,
event->area.x,
event->area.y,
event->area.width,
event->area.height);
return true;
}

View file

@ -77,15 +77,6 @@ class TimeAxisView : public virtual AxisView
};
public:
enum TrackHeight {
Largest,
Large,
Larger,
Normal,
Smaller,
Small
};
static uint32_t hLargest;
static uint32_t hLarge;
static uint32_t hLarger;
@ -93,8 +84,6 @@ class TimeAxisView : public virtual AxisView
static uint32_t hSmaller;
static uint32_t hSmall;
static uint32_t height_to_pixels (TrackHeight);
TimeAxisView(ARDOUR::Session& sess, PublicEditor& ed, TimeAxisView* parent, ArdourCanvas::Canvas& canvas);
virtual ~TimeAxisView ();
@ -102,7 +91,6 @@ class TimeAxisView : public virtual AxisView
PublicEditor& editor;
TrackHeight height_style;
uint32_t height; /* in canvas units */
uint32_t effective_height; /* in canvas units */
double y_position;
@ -118,9 +106,21 @@ class TimeAxisView : public virtual AxisView
Gtk::Table controls_table;
Gtk::EventBox controls_ebox;
Gtk::VBox controls_vbox;
Gtk::EventBox resizer;
Gtk::HBox resizer_box;
Gtk::HBox name_hbox;
Gtk::Frame name_frame;
Gtkmm2ext::FocusEntry name_entry;
bool resizer_button_press (GdkEventButton*);
bool resizer_button_release (GdkEventButton*);
bool resizer_motion (GdkEventMotion*);
bool resizer_expose (GdkEventExpose*);
double resize_drag_start;
int32_t resize_idle_target;
int32_t resize_idle_id;
bool idle_resize();
void hide_name_label ();
void hide_name_entry ();
@ -154,7 +154,7 @@ class TimeAxisView : public virtual AxisView
virtual void entered () {}
virtual void exited () {}
virtual void set_height (TrackHeight h);
virtual void set_height (uint32_t h);
void reset_height();
/**
@ -328,8 +328,7 @@ class TimeAxisView : public virtual AxisView
static void compute_controls_size_info ();
static bool need_size_info;
void set_heights (TrackHeight);
void set_height_pixels (uint32_t h);
void set_heights (uint32_t h);
void color_handler ();
list<ArdourCanvas::SimpleLine*> feature_lines;

View file

@ -101,7 +101,7 @@ VisualTimeAxis::VisualTimeAxis(const string & name, PublicEditor& ed, ARDOUR::Se
hide_button.unset_flags(Gtk::CAN_FOCUS) ;
visual_button.unset_flags(Gtk::CAN_FOCUS) ;
set_height(Normal) ;
set_height (hNormal) ;
}
/**
@ -144,39 +144,25 @@ VisualTimeAxis::name() const
/**
* Sets the height of this TrackView to one of the defined TrackHeghts
*
* @param h the TrackHeight value to set
* @param h
*/
void
VisualTimeAxis::set_height(TrackHeight h)
VisualTimeAxis::set_height(uint32_t h)
{
TimeAxisView::set_height(h) ;
TimeAxisView::set_height(h);
switch (height)
{
case Largest:
case Large:
case Larger:
case Normal:
{
hide_name_label ();
show_name_entry ();
other_button_hbox.show_all() ;
break;
}
case Smaller:
{
hide_name_label ();
show_name_entry ();
other_button_hbox.hide_all() ;
break;
}
case Small:
{
hide_name_entry ();
show_name_label ();
other_button_hbox.hide_all() ;
}
break;
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() ;
}
}

View file

@ -93,9 +93,9 @@ class VisualTimeAxis : public TimeAxisView
/**
* Sets the height of this TrackView to one of the defined TrackHeghts
*
* @param h the TrackHeight value to set
* @param h the number of pixels to set the height to
*/
virtual void set_height (TrackHeight h);
virtual void set_height (uint32_t);
//---------------------------------------------------------------------------------------//
// Selection Methods