Fix track height menu.
git-svn-id: svn://localhost/ardour2/branches/3.0@7093 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
@@ -284,8 +284,8 @@
|
||||
<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'/>
|
||||
|
||||
@@ -153,9 +153,9 @@ AutomationLine::control_point_box_size ()
|
||||
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;
|
||||
|
||||
@@ -381,10 +381,9 @@ AutomationTimeAxisView::clear_clicked ()
|
||||
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);
|
||||
@@ -411,7 +410,7 @@ AutomationTimeAxisView::set_height (uint32_t h)
|
||||
|
||||
first_call_to_set_height = false;
|
||||
|
||||
if (h >= hNormal) {
|
||||
if (h >= preset_height (HeightNormal)) {
|
||||
controls_table.remove (name_hbox);
|
||||
|
||||
if (plugname) {
|
||||
@@ -432,7 +431,7 @@ AutomationTimeAxisView::set_height (uint32_t h)
|
||||
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) {
|
||||
@@ -449,7 +448,7 @@ AutomationTimeAxisView::set_height (uint32_t h)
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ CrossfadeView::reset_width_dependent_items (double pixel_width)
|
||||
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;
|
||||
|
||||
@@ -4698,8 +4698,8 @@ Editor::add_to_idle_resize (TimeAxisView* view, int32_t h)
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1973,7 +1973,7 @@ public:
|
||||
|
||||
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 ();
|
||||
|
||||
@@ -579,28 +579,28 @@ Editor::register_actions ()
|
||||
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);
|
||||
|
||||
|
||||
@@ -6016,7 +6016,7 @@ Editor::playhead_backward_to_grid ()
|
||||
}
|
||||
|
||||
void
|
||||
Editor::set_track_height (uint32_t h)
|
||||
Editor::set_track_height (Height h)
|
||||
{
|
||||
TrackSelection& ts (selection->tracks);
|
||||
|
||||
@@ -6325,7 +6325,7 @@ Editor::fit_tracks (TrackViewList & 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;
|
||||
|
||||
@@ -45,6 +45,15 @@ struct SelectionRect {
|
||||
uint32_t id;
|
||||
};
|
||||
|
||||
enum Height {
|
||||
HeightLargest,
|
||||
HeightLarger,
|
||||
HeightLarge,
|
||||
HeightNormal,
|
||||
HeightSmall,
|
||||
HeightSmaller
|
||||
};
|
||||
|
||||
extern void setup_gtk_ardour_enums ();
|
||||
|
||||
#endif /* __ardour_gtk_enums_h__ */
|
||||
|
||||
@@ -756,7 +756,7 @@ RouteTimeAxisView::set_height (uint32_t 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 ();
|
||||
@@ -778,7 +778,7 @@ RouteTimeAxisView::set_height (uint32_t h)
|
||||
playlist_button.show();
|
||||
}
|
||||
|
||||
} else if (height >= hSmaller) {
|
||||
} else if (height >= preset_height (HeightSmaller)) {
|
||||
|
||||
reset_meter();
|
||||
show_name_entry ();
|
||||
|
||||
@@ -66,14 +66,8 @@ using namespace ArdourCanvas;
|
||||
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;
|
||||
|
||||
@@ -84,10 +78,10 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
|
||||
_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
|
||||
@@ -395,9 +389,9 @@ TimeAxisView::step_height (bool bigger)
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -412,6 +406,12 @@ TimeAxisView::set_heights (uint32_t h)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TimeAxisView::set_height (Height h)
|
||||
{
|
||||
set_height (preset_height (h));
|
||||
}
|
||||
|
||||
void
|
||||
TimeAxisView::set_height(uint32_t h)
|
||||
{
|
||||
@@ -474,8 +474,8 @@ TimeAxisView::name_entry_key_release (GdkEventKey* ev)
|
||||
|
||||
/* 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();
|
||||
@@ -990,20 +990,20 @@ TimeAxisView::set_state (const XMLNode& node, int /*version*/)
|
||||
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) {
|
||||
@@ -1012,7 +1012,7 @@ TimeAxisView::set_state (const XMLNode& node, int /*version*/)
|
||||
|
||||
} else {
|
||||
|
||||
set_height (hNormal);
|
||||
set_height (HeightNormal);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1029,14 +1029,14 @@ TimeAxisView::reset_height()
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
@@ -1062,36 +1062,9 @@ TimeAxisView::compute_controls_size_info ()
|
||||
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
|
||||
@@ -1338,3 +1311,25 @@ TimeAxisView::set_visibility (bool yn)
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -83,12 +83,6 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful
|
||||
};
|
||||
|
||||
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 ();
|
||||
@@ -155,6 +149,7 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful
|
||||
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);
|
||||
@@ -222,6 +217,8 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful
|
||||
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 */
|
||||
@@ -310,9 +307,6 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful
|
||||
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 ();
|
||||
|
||||
@@ -335,6 +329,10 @@ private:
|
||||
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 */
|
||||
|
||||
Reference in New Issue
Block a user