fix track controls height allocation to be font sensitive; fix core dump related to ownership of size menu; add nudge to keybindings; and more

git-svn-id: svn://localhost/trunk/ardour2@275 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2006-01-18 02:56:51 +00:00
parent 67467c92e1
commit fe49c8de18
12 changed files with 283 additions and 106 deletions

View file

@ -17,6 +17,14 @@
(gtk_accel_path "<Actions>/Editor/set-playhead" "p")
(gtk_accel_path "<Actions>/Transport/Record" "<shift>r")
(gtk_accel_path "<Actions>/Editor/nudge-forward" "KP_Add")
(gtk_accel_path "<Actions>/Editor/nudge-next-forward" "<control>KP_Add")
(gtk_accel_path "<Actions>/Editor/nudge-backward" "KP_Subtract")
(gtk_accel_path "<Actions>/Editor/nudge-next-backward" "<control>KP_Subtract")
(gtk-accel_path "<Actions>/Common/GotoEditor" "<Alt>e")
(gtk-accel_path "<Actions>/Common/GotoMixer" "<Alt>m")
(gtk_accel_path "<Actions>/Editor/editor-copy" "<Control>c")
(gtk_accel_path "<Actions>/Common/Quit" "<Control>q")
(gtk_accel_path "<Actions>/Editor/redo" "<Control>r")
@ -25,7 +33,6 @@
(gtk_accel_path "<Actions>/Editor/editor-cut" "<Control>x")
(gtk_accel_path "<Actions>/Editor/undo" "<Control>z")
(gtk_accel_path "<Actions>/Editor/scroll-tracks-down" "Page_Down")
(gtk_accel_path "<Actions>/Editor/scroll-tracks-up" "Page_Up")
(gtk_accel_path "<Actions>/Editor/step-tracks-down" "Down")

View file

@ -93,6 +93,11 @@
<menuitem action='duplicate-region'/>
<menuitem action='insert-region'/>
<menuitem action='normalize-region'/>
<separator/>
<menuitem action="nudge-forward"/>
<menuitem action="nudge-next-forward"/>
<menuitem action="nudge-backward"/>
<menuitem action="nudge-next-backward"/>
</menu>
<menu name='View' action = 'View'>
<menu name='ZoomFocus' action='ZoomFocus'>

View file

@ -126,10 +126,9 @@ style "black_mackie_menu_bar" = "medium_bold_text"
bg[NORMAL] = { 0, 0, 0 }
}
style "default_buttons_menus" = "default_base"
style "default_buttons_menus" = "small_button"
{
font_name = "sans 8"
fg[ACTIVE] = { 0, 0, 0 }
bg[NORMAL] = { 0.35, 0.35, 0.35 }
@ -146,7 +145,6 @@ style "very_small_button" = "default_buttons_menus"
style "small_button" = "default_buttons_menus"
{
font_name = "sans 8"
}
style "very_small_red_active_and_selected_button" = "very_small_button"

View file

@ -80,7 +80,6 @@
#include "i18n.h"
using namespace ARDOUR;
//using namespace sigc;
using namespace LADSPA;
using namespace Gtk;
using namespace Editing;
@ -587,7 +586,7 @@ AudioTimeAxisView::set_state (const XMLNode& node)
void
AudioTimeAxisView::set_height (TrackHeight h)
{
bool height_changed = (h != (TrackHeight)height);
bool height_changed = (h != height_style);
TimeAxisView::set_height (h);
@ -595,31 +594,36 @@ AudioTimeAxisView::set_height (TrackHeight h)
view->set_height ((double) height);
switch (height) {
switch (height_style) {
case Largest:
xml_node->add_property ("track_height", "largest");
controls_table.show_all ();
name_label.hide ();
show_name_entry ();
hide_name_label ();
controls_table.show_all();
break;
case Large:
xml_node->add_property ("track_height", "large");
controls_table.show_all ();
name_label.hide ();
show_name_entry ();
hide_name_label ();
controls_table.show_all();
break;
case Larger:
xml_node->add_property ("track_height", "larger");
controls_table.show_all ();
name_label.hide ();
show_name_entry ();
hide_name_label ();
controls_table.show_all();
break;
case Normal:
xml_node->add_property ("track_height", "normal");
controls_table.show_all ();
name_label.hide ();
show_name_entry ();
hide_name_label ();
controls_table.show_all();
break;
case Smaller:
xml_node->add_property ("track_height", "smaller");
controls_table.show_all ();
name_label.hide ();
show_name_entry ();
hide_name_label ();
edit_group_button.hide ();
hide_button.hide ();
visual_button.hide ();
@ -631,9 +635,9 @@ AudioTimeAxisView::set_height (TrackHeight h)
xml_node->add_property ("track_height", "small");
controls_table.hide_all ();
controls_table.show ();
hide_name_entry ();
show_name_label ();
name_label.set_text (_route.name());
name_label.show ();
name_hbox.show ();
break;
}

View file

@ -97,7 +97,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, Route& r, PublicEdit
life easier and remove them.
*/
name_hbox.remove (name_entry);
hide_name_entry();
/* move the name label over a bit */
@ -326,7 +326,8 @@ AutomationTimeAxisView::set_height (TrackHeight h)
controls_table.attach (name_hbox, 1, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
}
controls_table.show_all ();
name_label.show ();
hide_name_entry ();
show_name_label ();
break;
case Large:
@ -343,7 +344,8 @@ AutomationTimeAxisView::set_height (TrackHeight h)
controls_table.attach (name_hbox, 1, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
}
controls_table.show_all ();
name_label.show ();
hide_name_entry ();
show_name_label ();
break;
case Larger:
@ -360,7 +362,8 @@ AutomationTimeAxisView::set_height (TrackHeight h)
controls_table.attach (name_hbox, 1, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
}
controls_table.show_all ();
name_label.show ();
hide_name_entry ();
show_name_label ();
break;
case Normal:
@ -378,7 +381,8 @@ AutomationTimeAxisView::set_height (TrackHeight h)
controls_table.attach (name_hbox, 1, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
}
controls_table.show_all ();
name_label.show ();
hide_name_entry ();
show_name_label ();
break;
case Smaller:
@ -392,6 +396,8 @@ AutomationTimeAxisView::set_height (TrackHeight h)
}
controls_table.attach (name_hbox, 1, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
controls_table.hide_all ();
hide_name_entry ();
show_name_label ();
name_hbox.show_all ();
controls_table.show ();
break;
@ -407,6 +413,8 @@ AutomationTimeAxisView::set_height (TrackHeight h)
}
controls_table.attach (name_hbox, 1, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
controls_table.hide_all ();
hide_name_entry ();
show_name_label ();
name_hbox.show_all ();
controls_table.show ();
break;

View file

@ -317,17 +317,21 @@ main (int argc, char *argv[])
return curvetest (curvetest_file);
}
/* desktop standard themes: just say no! */
if (!use_gtk_theme) {
if (getenv("GTK_RC_FILES")) {
unsetenv("GTK_RC_FILES");
/* desktop standard themes: just say no! */
if (getenv("GTK_RC_FILES")) {
unsetenv("GTK_RC_FILES");
}
if (getenv("GTK2_RC_FILES")) {
unsetenv("GTK_RC_FILES");
}
RC::set_default_files (null_file_list);
}
if (getenv("GTK2_RC_FILES")) {
unsetenv("GTK_RC_FILES");
}
RC::set_default_files (null_file_list);
cout << _("Ardour/GTK ")
<< VERSIONSTRING

View file

@ -37,6 +37,7 @@ bool GTK_ARDOUR::use_vst = true;
bool GTK_ARDOUR::new_session = false;
char* GTK_ARDOUR::curvetest_file = 0;
bool GTK_ARDOUR::try_hw_optimization = false;
bool GTK_ARDOUR::use_gtk_theme = false;
using namespace GTK_ARDOUR;
@ -56,6 +57,7 @@ print_help (const char *execname)
#endif
<< _(" [session-name] Name of session to load\n")
<< _(" -C, --curvetest filename Curve algorithm debugger\n")
<< _(" -g, --gtktheme Allow GTK to load a theme\n")
;
return 1;
@ -65,7 +67,7 @@ int
GTK_ARDOUR::parse_opts (int argc, char *argv[])
{
const char *optstring = "U:hbvVnoc:C:N:";
const char *optstring = "U:hbvVnoc:C:N:g";
const char *execname = strrchr (argv[0], '/');
if (execname == 0) {
@ -84,6 +86,7 @@ GTK_ARDOUR::parse_opts (int argc, char *argv[])
{ "new", 1, 0, 'N' },
{ "use-hw-optimizations", 0, 0, 'o' },
{ "curvetest", 1, 0, 'C' },
{ "gtktheme", 0, 0, 'g' },
{ 0, 0, 0, 0 }
};
@ -113,6 +116,10 @@ GTK_ARDOUR::parse_opts (int argc, char *argv[])
show_key_actions = true;
break;
case 'g':
use_gtk_theme = true;
break;
case 'n':
no_splash = false;
break;

View file

@ -36,6 +36,7 @@ extern bool use_vst;
extern bool new_session;
extern char* curvetest_file;
extern bool try_hw_optimization;
extern bool use_gtk_theme;
extern int32_t parse_opts (int argc, char *argv[]);

View file

@ -111,8 +111,6 @@ class PluginUI : public PlugUIBase, public Gtk::VBox
Gtk::Viewport scroller_view;
Gtk::Menu* automation_menu;
bool setting_name_status;
gint prefheight;
bool is_scrollable;

View file

@ -60,11 +60,24 @@ using namespace ArdourCanvas;
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;
TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisView* rent, Canvas& canvas)
: AxisView (sess),
editor (ed),
controls_table (2, 9)
{
if (need_size_info) {
compute_controls_size_info ();
need_size_info = false;
}
canvas_display = new Group (*canvas.root(), 0.0, 0.0);
selection_group = new Group (*canvas_display);
@ -80,6 +93,7 @@ TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisVie
parent = rent;
_has_state = false;
last_name_entry_key_press_event = 0;
name_packing = NamePackingBits (0);
/*
Create the standard LHS Controls
@ -99,27 +113,20 @@ TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisVie
name_label.set_name ("TrackLabel");
name_label.set_alignment (0.0, 0.5);
// name_hbox.set_border_width (2);
// name_hbox.set_spacing (5);
/* typically, either name_label OR name_entry are visible,
but not both. its up to derived classes to show/hide them as they
wish.
*/
name_hbox.pack_start (name_label, true, true);
name_hbox.pack_start (name_entry, true, true);
name_hbox.show ();
controls_table.set_border_width (2);
controls_table.set_row_spacings (0);
controls_table.set_col_spacings (0);
controls_table.set_homogeneous (true);
controls_table.show ();
controls_table.attach (name_hbox, 0, 5, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
controls_table.show ();
controls_table.show_all ();
controls_vbox.pack_start (controls_table, false, false);
controls_vbox.show ();
@ -140,7 +147,6 @@ TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisVie
controls_frame.add (controls_hbox);
controls_frame.set_name ("TimeAxisViewControlsBaseUnselected");
controls_frame.set_shadow_type (Gtk::SHADOW_OUT);
}
TimeAxisView::~TimeAxisView()
@ -176,11 +182,6 @@ TimeAxisView::~TimeAxisView()
delete display_menu;
display_menu = 0;
}
if (size_menu) {
delete size_menu;
size_menu = 0;
}
}
guint32
@ -325,36 +326,43 @@ TimeAxisView::hide ()
void
TimeAxisView::step_height (bool bigger)
{
switch (height) {
case Largest:
if (!bigger) set_height (Large);
break;
case Large:
if (bigger) set_height (Largest);
else set_height (Larger);
break;
case Larger:
if (bigger) set_height (Large);
else set_height (Normal);
break;
case Normal:
if (bigger) set_height (Larger);
else set_height (Smaller);
break;
case Smaller:
if (bigger) set_height (Normal);
else set_height (Small);
break;
case Small:
if (bigger) set_height (Smaller);
break;
}
switch (height) {
case Largest:
if (!bigger) set_height (Large);
break;
case Large:
if (bigger) set_height (Largest);
else set_height (Larger);
break;
case Larger:
if (bigger) set_height (Large);
else set_height (Normal);
break;
case Normal:
if (bigger) set_height (Larger);
else set_height (Smaller);
break;
case Smaller:
if (bigger) set_height (Normal);
else set_height (Small);
break;
case Small:
if (bigger) set_height (Smaller);
break;
}
}
void
TimeAxisView::set_height (TrackHeight h)
{
height = (gint32) h;
height_style = h;
set_height_pixels (height_to_pixels (h));
}
void
TimeAxisView::set_height_pixels (uint32_t h)
{
height = h;
controls_frame.set_size_request (-1, height);
if (canvas_item_visible (selection_group)) {
@ -534,7 +542,7 @@ TimeAxisView::build_size_menu ()
items.push_back (MenuElem (_("Large"), bind (mem_fun (*this, &TimeAxisView::set_height), Large)));
items.push_back (MenuElem (_("Larger"), bind (mem_fun (*this, &TimeAxisView::set_height), Larger)));
items.push_back (MenuElem (_("Normal"), bind (mem_fun (*this, &TimeAxisView::set_height), Normal)));
items.push_back (MenuElem (_("Smaller"), bind (mem_fun (*this, &TimeAxisView::set_height), Smaller)));
items.push_back (MenuElem (_("Smaller"), bind (mem_fun (*this, &TimeAxisView::set_height),Smaller)));
items.push_back (MenuElem (_("Small"), bind (mem_fun (*this, &TimeAxisView::set_height), Small)));
}
@ -861,14 +869,135 @@ TimeAxisView::set_state (const XMLNode& node)
void
TimeAxisView::reset_height()
{
set_height ((TrackHeight) height);
set_height_pixels (height);
for (vector<TimeAxisView*>::iterator i = children.begin(); i != children.end(); ++i) {
(*i)->set_height ((TrackHeight)(*i)->height);
}
}
void
TimeAxisView::check_height (Gdk::Rectangle& r)
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 ()
{
Gtk::Window window (Gtk::WINDOW_TOPLEVEL);
Gtk::Table two_row_table (2, 9);
Gtk::Table one_row_table (1, 9);
Button* buttons[5];
window.add (one_row_table);
one_row_table.set_border_width (2);
one_row_table.set_row_spacings (0);
one_row_table.set_col_spacings (0);
one_row_table.set_homogeneous (true);
two_row_table.set_border_width (2);
two_row_table.set_row_spacings (0);
two_row_table.set_col_spacings (0);
two_row_table.set_homogeneous (true);
for (int i = 0; i < 5; ++i) {
buttons[i] = manage (new Button (X_("f")));
buttons[i]->set_name ("TrackMuteButton");
}
Gtk::Requisition req;
one_row_table.attach (*buttons[0], 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
one_row_table.show_all ();
one_row_table.size_request (req);
// height required to show 1 row of buttons
hSmaller = req.height + 3;
window.remove ();
window.add (two_row_table);
two_row_table.attach (*buttons[1], 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
two_row_table.attach (*buttons[2], 7, 8, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
two_row_table.attach (*buttons[3], 8, 9, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
two_row_table.attach (*buttons[4], 6, 7, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
two_row_table.show_all ();
two_row_table.size_request (req);
// height required to show all normal buttons
hNormal = req.height + 3;
// 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;
}
void
TimeAxisView::show_name_label ()
{
if (!(name_packing & NameLabelPacked)) {
name_hbox.pack_start (name_label, true, true);
name_packing = NamePackingBits (name_packing | NameLabelPacked);
name_hbox.show ();
name_label.show ();
}
}
void
TimeAxisView::show_name_entry ()
{
if (!(name_packing & NameEntryPacked)) {
name_hbox.pack_start (name_entry, true, true);
name_packing = NamePackingBits (name_packing | NameEntryPacked);
name_hbox.show ();
name_entry.show ();
}
}
void
TimeAxisView::hide_name_label ()
{
if (name_packing & NameLabelPacked) {
name_hbox.remove (name_label);
name_packing = NamePackingBits (name_packing & ~NameLabelPacked);
}
}
void
TimeAxisView::hide_name_entry ()
{
if (name_packing & NameEntryPacked) {
name_hbox.remove (name_entry);
name_packing = NamePackingBits (name_packing & ~NameEntryPacked);
}
}

View file

@ -69,19 +69,30 @@ class Selectable;
*/
class TimeAxisView : public virtual AxisView
{
private:
enum NamePackingBits {
NameLabelPacked = 0x1,
NameEntryPacked = 0x2
};
public:
enum TrackHeight {
/* canvas units. they need to be odd
valued so that there is a precise
middle.
*/
Largest = 307,
Large = 207,
Larger = 107,
Normal = 57,
Smaller = 37,
Small = 27
Largest,
Large,
Larger,
Normal,
Smaller,
Small
};
static uint32_t hLargest;
static uint32_t hLarge;
static uint32_t hLarger;
static uint32_t hNormal;
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 ();
@ -90,11 +101,11 @@ class TimeAxisView : public virtual AxisView
PublicEditor& editor;
guint32 height; /* in canvas units */
guint32 effective_height; /* in canvas units */
TrackHeight height_style;
uint32_t height; /* in canvas units */
uint32_t effective_height; /* in canvas units */
double y_position;
int order;
ArdourCanvas::Group *canvas_display;
Gtk::VBox *control_parent;
@ -110,6 +121,11 @@ class TimeAxisView : public virtual AxisView
Gtk::Frame name_frame;
Gtk::Entry name_entry;
void hide_name_label ();
void hide_name_entry ();
void show_name_label ();
void show_name_entry ();
/**
* Display this TrackView as the nth component of the parent box, at y.
*
@ -137,15 +153,11 @@ class TimeAxisView : public virtual AxisView
virtual void entered () {}
virtual void exited () {}
/**
* Sets the height of this TrackView to one of ths TrackHeghts
*
* @param h the TrackHeight value to set
*/
virtual void set_height (TrackHeight h);
void reset_height();
/**
* Steps through the defined TrackHeights for this TrackView.
* Steps through the defined heights for this TrackView.
* Sets bigger to true to step up in size, set to fals eot step smaller.
*
* @param bigger true if stepping should increase in size, false otherwise
@ -242,13 +254,13 @@ class TimeAxisView : public virtual AxisView
virtual bool handle_display_menu_map_event (GdkEventAny *ev) { return false; }
/**
* Build the standard LHS control size menu for the default TrackHeight options.
* Build the standard LHS control size menu for the default heights options.
*
*/
virtual void build_size_menu();
/**
* Displays the standard LHS controls size menu for the TrackHeight.
* Displays the standard LHS controls size menu for the track heights
*
* @parem when the popup activation time
*/
@ -293,8 +305,12 @@ class TimeAxisView : public virtual AxisView
bool _hidden;
bool _has_state;
NamePackingBits name_packing;
void check_height (Gdk::Rectangle&);
static void compute_controls_size_info ();
static bool need_size_info;
void set_height_pixels (uint32_t h);
}; /* class TimeAxisView */

View file

@ -177,22 +177,22 @@ VisualTimeAxis::set_height(TrackHeight h)
case Larger:
case Normal:
{
name_label.hide() ;
name_entry.show() ;
hide_name_label ();
show_name_entry ();
other_button_hbox.show_all() ;
break;
}
case Smaller:
{
name_label.hide() ;
name_entry.show() ;
hide_name_label ();
show_name_entry ();
other_button_hbox.hide_all() ;
break;
}
case Small:
{
name_label.show() ;
name_entry.hide() ;
hide_name_entry ();
show_name_label ();
other_button_hbox.hide_all() ;
}
break;