<menu action='TrackHeightMenu'>
<menuitem action='fit-tracks'/>
<menuitem action='track-height-largest'/>
- <menuitem action='track-height-large'/>
<menuitem action='track-height-larger'/>
+ <menuitem action='track-height-large'/>
<menuitem action='track-height-normal'/>
<menuitem action='track-height-smaller'/>
<menuitem action='track-height-small'/>
4.0);
}
- if (_height > TimeAxisView::hLarger) {
+ if (_height > TimeAxisView::preset_height (HeightLarger)) {
return 8.0;
- } else if (_height > (guint32) TimeAxisView::hNormal) {
+ } else if (_height > (guint32) TimeAxisView::preset_height (HeightNormal)) {
return 6.0;
}
return 4.0;
void
AutomationTimeAxisView::set_height (uint32_t h)
{
- bool changed = (height != (uint32_t) h) || first_call_to_set_height;
- bool changed_between_small_and_normal = (
- (height < hNormal && h >= hNormal)
- || (height >= hNormal || h < hNormal) );
+ bool const changed = (height != (uint32_t) h) || first_call_to_set_height;
+ uint32_t const normal = preset_height (HeightNormal);
+ bool const changed_between_small_and_normal = ( (height < normal && h >= normal) || (height >= normal || h < normal) );
TimeAxisView* state_parent = get_parent_with_state ();
assert(state_parent);
first_call_to_set_height = false;
- if (h >= hNormal) {
+ if (h >= preset_height (HeightNormal)) {
controls_table.remove (name_hbox);
if (plugname) {
auto_button.show();
hide_button.show_all();
- } else if (h >= hSmall) {
+ } else if (h >= preset_height (HeightSmall)) {
controls_table.remove (name_hbox);
if (plugname) {
if (plugname_packed) {
auto_button.hide();
hide_button.hide();
}
- } else if (h >= hNormal){
+ } else if (h >= preset_height (HeightNormal)) {
cerr << "track grown, but neither changed_between_small_and_normal nor first_call_to_set_height set!" << endl;
}
void
CrossfadeView::set_height (double h)
{
- if (h <= TimeAxisView::hSmall) {
+ if (h <= TimeAxisView::preset_height (HeightSmall)) {
h -= 3.0;
} else {
h -= NAME_HIGHLIGHT_SIZE + 3.0;
}
/* clamp */
- if (uint32_t (min_resulting) < TimeAxisView::hSmall) {
- _pending_resize_amount += TimeAxisView::hSmall - min_resulting;
+ if (uint32_t (min_resulting) < TimeAxisView::preset_height (HeightSmall)) {
+ _pending_resize_amount += TimeAxisView::preset_height (HeightSmall) - min_resulting;
}
}
void fit_tracks (TrackViewList &);
void fit_selected_tracks ();
- void set_track_height (uint32_t h);
+ void set_track_height (Height);
void remove_tracks ();
void toggle_tracks_active ();
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::track_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "track-height-largest", _("Largest"), sigc::bind (
- sigc::mem_fun(*this, &Editor::set_track_height), TimeAxisView::hLargest));
+ sigc::mem_fun(*this, &Editor::set_track_height), HeightLargest));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::track_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "track-height-larger", _("Larger"), sigc::bind (
- sigc::mem_fun(*this, &Editor::set_track_height), TimeAxisView::hLarger));
+ sigc::mem_fun(*this, &Editor::set_track_height), HeightLarger));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::track_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "track-height-large", _("Large"), sigc::bind (
- sigc::mem_fun(*this, &Editor::set_track_height), TimeAxisView::hLarge));
+ sigc::mem_fun(*this, &Editor::set_track_height), HeightLarge));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::track_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "track-height-normal", _("Normal"), sigc::bind (
- sigc::mem_fun(*this, &Editor::set_track_height), TimeAxisView::hNormal));
+ sigc::mem_fun(*this, &Editor::set_track_height), HeightNormal));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::track_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "track-height-small", _("Small"), sigc::bind (
- sigc::mem_fun(*this, &Editor::set_track_height), TimeAxisView::hSmall));
+ sigc::mem_fun(*this, &Editor::set_track_height), HeightSmall));
ActionManager::track_selection_sensitive_actions.push_back (act);
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::track_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "track-height-smaller", _("Smaller"), sigc::bind (
- sigc::mem_fun(*this, &Editor::set_track_height), TimeAxisView::hSmaller));
+ sigc::mem_fun(*this, &Editor::set_track_height), HeightSmaller));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::track_selection_sensitive_actions.push_back (act);
}
void
-Editor::set_track_height (uint32_t h)
+Editor::set_track_height (Height h)
{
TrackSelection& ts (selection->tracks);
uint32_t h = (uint32_t) floor ((_canvas_height - child_heights - canvas_timebars_vsize) / tracks.size());
double first_y_pos = DBL_MAX;
- if (h < TimeAxisView::hSmall) {
+ if (h < TimeAxisView::preset_height (HeightSmall)) {
MessageDialog msg (*this, _("There are too many tracks to fit in the current window"));
/* too small to be displayed */
return;
uint32_t id;
};
+enum Height {
+ HeightLargest,
+ HeightLarger,
+ HeightLarge,
+ HeightNormal,
+ HeightSmall,
+ HeightSmaller
+};
+
extern void setup_gtk_ardour_enums ();
#endif /* __ardour_gtk_enums_h__ */
snprintf (buf, sizeof (buf), "%u", height);
xml_node->add_property ("height", buf);
- if (height >= hNormal) {
+ if (height >= preset_height (HeightNormal)) {
reset_meter();
show_name_entry ();
hide_name_label ();
playlist_button.show();
}
- } else if (height >= hSmaller) {
+ } else if (height >= preset_height (HeightSmaller)) {
reset_meter();
show_name_entry ();
using Gtkmm2ext::Keyboard;
const double trim_handle_size = 6.0; /* pixels */
-
-uint32_t TimeAxisView::hLargest = 0;
-uint32_t TimeAxisView::hLarge = 0;
-uint32_t TimeAxisView::hLarger = 0;
-uint32_t TimeAxisView::hNormal = 0;
-uint32_t TimeAxisView::hSmaller = 0;
-uint32_t TimeAxisView::hSmall = 0;
-bool TimeAxisView::need_size_info = true;
+uint32_t TimeAxisView::extra_height;
+uint32_t TimeAxisView::smaller_height;
int const TimeAxisView::_max_order = 512;
PBD::Signal1<void,TimeAxisView*> TimeAxisView::CatchDeletion;
_editor (ed),
_order (0)
{
- if (need_size_info) {
- compute_controls_size_info ();
- need_size_info = false;
+ if (extra_height == 0) {
+ compute_heights ();
}
+
_canvas_background = new Group (*ed.get_background_group (), 0.0, 0.0);
_canvas_display = new Group (*ed.get_trackview_group (), 0.0, 0.0);
_canvas_display->hide(); // reveal as needed
set_height (height + step);
} else {
if (height > step) {
- set_height (std::max (height - step, hSmall));
- } else if (height != hSmall) {
- set_height (hSmall);
+ set_height (std::max (height - step, preset_height (HeightSmall)));
+ } else if (height != preset_height (HeightSmall)) {
+ set_height (HeightSmall);
}
}
}
}
}
+void
+TimeAxisView::set_height (Height h)
+{
+ set_height (preset_height (h));
+}
+
void
TimeAxisView::set_height(uint32_t h)
{
/* resize to show editable name display */
- if ((*i)->current_height() <= hSmaller) {
- (*i)->set_height (hSmaller);
+ if ((*i)->current_height() <= preset_height (HeightSmaller)) {
+ (*i)->set_height (HeightSmaller);
}
(*i)->name_entry.grab_focus();
if ((prop = node.property ("track-height")) != 0) {
if (prop->value() == "largest") {
- set_height (hLargest);
+ set_height (HeightLargest);
} else if (prop->value() == "large") {
- set_height (hLarge);
+ set_height (HeightLarge);
} else if (prop->value() == "larger") {
- set_height (hLarger);
+ set_height (HeightLarger);
} else if (prop->value() == "normal") {
- set_height (hNormal);
+ set_height (HeightNormal);
} else if (prop->value() == "smaller") {
- set_height (hSmaller);
+ set_height (HeightSmaller);
} else if (prop->value() == "small") {
- set_height (hSmall);
+ set_height (HeightSmall);
} else {
error << string_compose(_("unknown track height name \"%1\" in XML GUI information"), prop->value()) << endmsg;
- set_height (Normal);
+ set_height (HeightNormal);
}
} else if ((prop = node.property ("height")) != 0) {
} else {
- set_height (hNormal);
+ set_height (HeightNormal);
}
return 0;
}
void
-TimeAxisView::compute_controls_size_info ()
+TimeAxisView::compute_heights ()
{
Gtk::Window window (Gtk::WINDOW_TOPLEVEL);
Gtk::Table two_row_table (2, 8);
Gtk::Table one_row_table (1, 8);
Button* buttons[5];
const int border_width = 2;
- const int extra_height = (2 * border_width)
+ extra_height = (2 * border_width)
//+ 2 // 2 pixels for the hseparator between TimeAxisView control areas
+ 10; // resizer button (3 x 2 pixel elements + 2 x 2 pixel gaps)
one_row_table.show_all ();
Gtk::Requisition req(one_row_table.size_request ());
-
// height required to show 1 row of buttons
- hSmaller = req.height + extra_height;
-
- window.remove ();
- window.add (two_row_table);
-
- two_row_table.attach (*buttons[1], 5, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
- two_row_table.attach (*buttons[2], 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
- two_row_table.attach (*buttons[3], 7, 8, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
- two_row_table.attach (*buttons[4], 8, 9, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
-
- two_row_table.show_all ();
- req = two_row_table.size_request ();
-
- // height required to show all normal buttons
-
- hNormal = /*req.height*/ 48 + extra_height;
-
- // these heights are all just larger than normal. no more
- // elements are visible (yet).
-
- hLarger = hNormal + 50;
- hLarge = hNormal + 150;
- hLargest = hNormal + 250;
-
- // height required to show track name
-
- hSmall = 27;
+ smaller_height = req.height + extra_height;
}
void
return false;
}
+
+uint32_t
+TimeAxisView::preset_height (Height h)
+{
+ switch (h) {
+ case HeightLargest:
+ return extra_height + 48 + 250;
+ case HeightLarger:
+ return extra_height + 48 + 150;
+ case HeightLarge:
+ return extra_height + 48 + 50;
+ case HeightNormal:
+ return extra_height + 48;
+ case HeightSmall:
+ return 27;
+ case HeightSmaller:
+ return smaller_height;
+ }
+
+ /* NOTREACHED */
+ return 0;
+}
};
public:
- static uint32_t hLargest;
- static uint32_t hLarge;
- static uint32_t hLarger;
- static uint32_t hNormal;
- static uint32_t hSmaller;
- static uint32_t hSmall;
TimeAxisView(ARDOUR::Session* sess, PublicEditor& ed, TimeAxisView* parent, ArdourCanvas::Canvas& canvas);
virtual ~TimeAxisView ();
virtual void exited () {}
virtual void set_height (uint32_t h);
+ void set_height (Height);
void reset_height();
std::pair<TimeAxisView*, ARDOUR::layer_t> covers_y_position (double);
typedef std::vector<boost::shared_ptr<TimeAxisView> > Children;
SelectionRect* get_selection_rect(uint32_t id);
+
+ static uint32_t preset_height (Height);
protected:
/* The Standard LHS Controls */
bool in_destructor;
NamePackingBits name_packing;
- static void compute_controls_size_info ();
- static bool need_size_info;
-
void set_heights (uint32_t h);
void color_handler ();
double _resize_drag_start;
ArdourCanvas::Group* _ghost_group;
+ void compute_heights ();
+ static uint32_t extra_height;
+ static uint32_t smaller_height;
+
static int const _max_order;
}; /* class TimeAxisView */