summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2006-04-27 09:04:24 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2006-04-27 09:04:24 +0000
commit982d639d44f23ac46aa19ddb08055fa8cec9b0fd (patch)
tree2acfb1920e1bf4b8eb0390a34db131302c85a71e /gtk2_ardour
parentd2ff9e40e3d1990eba4024b945bdf0a6bb1625cf (diff)
"The In-Flight Hack, 2006"
a) measure lines extend the full height of the canvas b) region name color bars and text positioning now adjusted to match font size for different display resolutions c) vertical scrollbar limited to cover visible tracks only git-svn-id: svn://localhost/trunk/ardour2@486 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/analysis_window.cc4
-rw-r--r--gtk2_ardour/ardour.menus3
-rw-r--r--gtk2_ardour/ardour2_ui.rc2
-rw-r--r--gtk2_ardour/ardour_ui_ed.cc2
-rw-r--r--gtk2_ardour/automation_time_axis.cc5
-rw-r--r--gtk2_ardour/draginfo.h1
-rw-r--r--gtk2_ardour/editor_canvas.cc2
-rw-r--r--gtk2_ardour/editor_mouse.cc31
-rw-r--r--gtk2_ardour/editor_tempodisplay.cc5
-rw-r--r--gtk2_ardour/keyboard.cc2
-rw-r--r--gtk2_ardour/main.cc2
-rw-r--r--gtk2_ardour/regionview.cc6
-rw-r--r--gtk2_ardour/time_axis_view_item.cc45
-rw-r--r--gtk2_ardour/time_axis_view_item.h9
14 files changed, 79 insertions, 40 deletions
diff --git a/gtk2_ardour/analysis_window.cc b/gtk2_ardour/analysis_window.cc
index 6c8e569822..014aeaaabc 100644
--- a/gtk2_ardour/analysis_window.cc
+++ b/gtk2_ardour/analysis_window.cc
@@ -1,5 +1,6 @@
/*
Copyright (C) 2006 Paul Davis
+ Written by Sampo Savolainen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -15,9 +16,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ $Id$
*/
-
#include <gtkmm2ext/gtk_ui.h>
#include <gtkmm/stock.h>
#include <gtkmm/label.h>
@@ -54,7 +55,6 @@ AnalysisWindow::AnalysisWindow()
display_model_composite_all_tracks_rb (_("Composite graph of all tracks"))
{
-
track_list_ready = false;
// Left side: track list + controls
diff --git a/gtk2_ardour/ardour.menus b/gtk2_ardour/ardour.menus
index b8f6b10f78..3abb0d4219 100644
--- a/gtk2_ardour/ardour.menus
+++ b/gtk2_ardour/ardour.menus
@@ -207,8 +207,9 @@
</menu>
<menu action='Autoconnect'>
<menuitem action='AutoConnectNewTrackInputsToHardware'/>
+ <separator/>
<menuitem action='AutoConnectNewTrackOutputsToHardware'/>
- <menuitem action='AutoConnectNewTrackOutputsToHardware'/>
+ <menuitem action='AutoConnectNewTrackOutputsToMaster'/>
<menuitem action='ManuallyConnectNewTrackOutputs'/>
</menu>
<menu action='ControlSurfaces'/>
diff --git a/gtk2_ardour/ardour2_ui.rc b/gtk2_ardour/ardour2_ui.rc
index acf3fabe17..a17521193e 100644
--- a/gtk2_ardour/ardour2_ui.rc
+++ b/gtk2_ardour/ardour2_ui.rc
@@ -75,7 +75,7 @@ style "marker_text"
style "time_axis_view_item_name"
{
- font_name = "sans medium 10"
+ font_name = "sans medium 8"
}
style "default_base" = "medium_text"
diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc
index 3944d3180a..70031b102a 100644
--- a/gtk2_ardour/ardour_ui_ed.cc
+++ b/gtk2_ardour/ardour_ui_ed.cc
@@ -371,7 +371,7 @@ ARDOUR_UI::install_actions ()
act = ActionManager::register_toggle_action (option_actions, X_("UseMIDIcontrol"), _("Use MIDI control"), mem_fun (*this, &ARDOUR_UI::toggle_use_midi_control));
ActionManager::session_sensitive_actions.push_back (act);
- act = ActionManager::register_toggle_action (option_actions, X_("AutoConnectNewTrackInputsToHardware"), _("Connect newtrack inputs to hardware"), mem_fun (*this, &ARDOUR_UI::toggle_AutoConnectNewTrackInputsToHardware));
+ act = ActionManager::register_toggle_action (option_actions, X_("AutoConnectNewTrackInputsToHardware"), _("Connect new track inputs to hardware"), mem_fun (*this, &ARDOUR_UI::toggle_AutoConnectNewTrackInputsToHardware));
ActionManager::session_sensitive_actions.push_back (act);
RadioAction::Group file_header_group;
diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc
index 3831e253b4..fbe1568011 100644
--- a/gtk2_ardour/automation_time_axis.cc
+++ b/gtk2_ardour/automation_time_axis.cc
@@ -275,8 +275,9 @@ AutomationTimeAxisView::clear_clicked ()
}
void
-AutomationTimeAxisView::set_height (TrackHeight h)
+AutomationTimeAxisView::set_height (TrackHeight ht)
{
+ uint32_t h = height_to_pixels (ht);
bool changed = (height != (uint32_t) h);
TimeAxisView* state_parent = get_parent_with_state ();
@@ -284,7 +285,7 @@ AutomationTimeAxisView::set_height (TrackHeight h)
controls_table.show_all ();
- TimeAxisView::set_height (h);
+ TimeAxisView::set_height (ht);
base_rect->property_y2() = h;
for (vector<AutomationLine*>::iterator i = lines.begin(); i != lines.end(); ++i) {
diff --git a/gtk2_ardour/draginfo.h b/gtk2_ardour/draginfo.h
index 8b9213ea40..3db8bab1e8 100644
--- a/gtk2_ardour/draginfo.h
+++ b/gtk2_ardour/draginfo.h
@@ -31,6 +31,7 @@ struct DragInfo {
void (Editor::*finished_callback)(ArdourCanvas::Item*, GdkEvent*);
TimeAxisView* last_trackview;
bool x_constrained;
+ bool y_constrained;
bool copy;
bool was_rolling;
bool first_move;
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc
index bd6c1c99ab..744de49c94 100644
--- a/gtk2_ardour/editor_canvas.cc
+++ b/gtk2_ardour/editor_canvas.cc
@@ -368,7 +368,7 @@ Editor::reset_scrolling_region (Gtk::Allocation* alloc)
for (pos = 0, i = rows.begin(); i != rows.end(); ++i) {
TimeAxisView *tv = (*i)[route_display_columns.tv];
- if (tv != 0) {
+ if (tv != 0 && !tv->hidden()) {
pos += tv->effective_height;
pos += track_spacing;
}
diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc
index 8eb97f2165..79053a2e52 100644
--- a/gtk2_ardour/editor_mouse.cc
+++ b/gtk2_ardour/editor_mouse.cc
@@ -942,9 +942,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
break;
case MarkerItem:
-
remove_marker (*item, event);
-
break;
case RegionItem:
@@ -1598,9 +1596,16 @@ Editor::start_grab (GdkEvent* event, Gdk::Cursor *cursor)
// if dragging with button2, the motion is x constrained, with Alt-button2 it is y constrained
if (event->button.button == 2) {
- drag_info.x_constrained = true;
+ if (Keyboard::modifier_state_equals (event->button.state, Keyboard::Alt)) {
+ drag_info.y_constrained = true;
+ drag_info.x_constrained = false;
+ } else {
+ drag_info.y_constrained = false;
+ drag_info.x_constrained = true;
+ }
} else {
drag_info.x_constrained = false;
+ drag_info.y_constrained = false;
}
drag_info.grab_frame = event_frame(event, &drag_info.grab_x, &drag_info.grab_y);
@@ -2455,18 +2460,12 @@ Editor::control_point_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent*
drag_info.cumulative_x_drag = cx - drag_info.grab_x ;
drag_info.cumulative_y_drag = cy - drag_info.grab_y ;
- bool x_constrained = false;
-
if (drag_info.x_constrained) {
- if (fabs(drag_info.cumulative_x_drag) < fabs(drag_info.cumulative_y_drag)) {
- cx = drag_info.grab_x;
- x_constrained = true;
-
- } else {
- cy = drag_info.grab_y;
- }
-
- }
+ cx = drag_info.grab_x;
+ }
+ if (drag_info.y_constrained) {
+ cy = drag_info.grab_y;
+ }
cp->line.parent_group().w2i (cx, cy);
@@ -2475,9 +2474,9 @@ Editor::control_point_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent*
cy = min ((double) cp->line.height(), cy);
//translate cx to frames
- jack_nframes_t cx_frames = (jack_nframes_t) floor (cx * frames_per_unit);
+ jack_nframes_t cx_frames = unit_to_frame (cx);
- if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier()) && !x_constrained) {
+ if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier()) && !drag_info.x_constrained) {
snap_to (cx_frames);
}
diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc
index 3b70286bcc..3aa95d022f 100644
--- a/gtk2_ardour/editor_tempodisplay.cc
+++ b/gtk2_ardour/editor_tempodisplay.cc
@@ -190,6 +190,9 @@ Editor::draw_measures ()
}
}
+ double x1, x2, y1, y2;
+ track_canvas.get_scroll_region (x1, y1, x2, y2);
+
for (i = all_bbt_points->begin(); i != all_bbt_points->end(); ++i) {
TempoMap::BBTPoint& p = (*i);
@@ -219,7 +222,7 @@ Editor::draw_measures ()
line = get_time_line ();
line->property_x1() = xpos;
line->property_x2() = xpos;
- line->property_y2() = 1000;
+ line->property_y2() = y2;
line->property_color_rgba() = color;
line->raise_to_top();
line->show();
diff --git a/gtk2_ardour/keyboard.cc b/gtk2_ardour/keyboard.cc
index c0bbea798a..92dce01bb6 100644
--- a/gtk2_ardour/keyboard.cc
+++ b/gtk2_ardour/keyboard.cc
@@ -54,7 +54,7 @@ Keyboard* Keyboard::_the_keyboard = 0;
/* set this to initially contain the modifiers we care about, then track changes in ::set_edit_modifier() etc. */
GdkModifierType Keyboard::RelevantModifierKeyMask =
- GdkModifierType (GDK_SHIFT_MASK|GDK_CONTROL_MASK|GDK_MOD3_MASK);
+ GdkModifierType (GDK_SHIFT_MASK|GDK_CONTROL_MASK|GDK_MOD1_MASK|GDK_MOD3_MASK);
Keyboard::Keyboard ()
diff --git a/gtk2_ardour/main.cc b/gtk2_ardour/main.cc
index 00b91e00e7..76ec0f3da3 100644
--- a/gtk2_ardour/main.cc
+++ b/gtk2_ardour/main.cc
@@ -342,7 +342,7 @@ main (int argc, char *argv[])
}
if (no_splash) {
- cerr << _("Copyright (C) 1999-2005 Paul Davis") << endl
+ cerr << _("Copyright (C) 1999-2006 Paul Davis") << endl
<< _("Some portions Copyright (C) Steve Harris, Ari Johnson, Brett Viren, Joel Baker") << endl
<< endl
<< _("Ardour comes with ABSOLUTELY NO WARRANTY") << endl
diff --git a/gtk2_ardour/regionview.cc b/gtk2_ardour/regionview.cc
index 2ae5699b4b..dbca103239 100644
--- a/gtk2_ardour/regionview.cc
+++ b/gtk2_ardour/regionview.cc
@@ -865,11 +865,15 @@ AudioRegionView::region_renamed ()
str = region.name();
}
+ if (region.speed_mismatch (trackview.session().frame_rate())) {
+ str = string ("*") + str;
+ }
+
if (region.muted()) {
str = string ("!") + str;
}
- set_item_name (region.name(), this);
+ set_item_name (str, this);
set_name_text (str);
}
diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc
index 270cbde0b8..f54688ddfb 100644
--- a/gtk2_ardour/time_axis_view_item.cc
+++ b/gtk2_ardour/time_axis_view_item.cc
@@ -23,6 +23,8 @@
#include <ardour/types.h>
#include <ardour/ardour.h>
+#include <gtkmm2ext/utils.h>
+
#include "public_editor.h"
#include "time_axis_view_item.h"
#include "time_axis_view.h"
@@ -38,15 +40,17 @@ using namespace Editing;
using namespace Glib;
//------------------------------------------------------------------------------
-/** Initialize static memeber data */
+/** Initialize const static memeber data */
+
Pango::FontDescription TimeAxisViewItem::NAME_FONT;
bool TimeAxisViewItem::have_name_font = false;
const double TimeAxisViewItem::NAME_X_OFFSET = 15.0;
-const double TimeAxisViewItem::NAME_Y_OFFSET = 15.0 ; /* XXX depends a lot on the font size, sigh. */
-const double TimeAxisViewItem::NAME_HIGHLIGHT_SIZE = 15.0 ; /* ditto */
-const double TimeAxisViewItem::NAME_HIGHLIGHT_THRESH = 32.0 ; /* ditto */
const double TimeAxisViewItem::GRAB_HANDLE_LENGTH = 6 ;
+double TimeAxisViewItem::NAME_Y_OFFSET;
+double TimeAxisViewItem::NAME_HIGHLIGHT_SIZE;
+double TimeAxisViewItem::NAME_HIGHLIGHT_THRESH;
+
//---------------------------------------------------------------------------------------//
// Constructor / Desctructor
@@ -68,7 +72,26 @@ TimeAxisViewItem::TimeAxisViewItem(const string & it_name, ArdourCanvas::Group&
: trackview (tv)
{
if (!have_name_font) {
+
+ /* first constructed item sets up font info */
+
NAME_FONT = get_font_for_style (N_("TimeAxisViewItemName"));
+
+ Gtk::Window win;
+ Gtk::Label foo;
+ win.add (foo);
+
+ Glib::RefPtr<Pango::Layout> layout = foo.create_pango_layout (X_("Hg")); /* ascender + descender */
+ int width;
+ int height;
+
+ layout->set_font_description (NAME_FONT);
+ Gtkmm2ext::get_ink_pixel_size (layout, width, height);
+
+ NAME_Y_OFFSET = height + 4;
+ NAME_HIGHLIGHT_SIZE = height + 6;
+ NAME_HIGHLIGHT_THRESH = NAME_HIGHLIGHT_SIZE * 2;
+
have_name_font = true;
}
@@ -150,7 +173,10 @@ TimeAxisViewItem::TimeAxisViewItem(const string & it_name, ArdourCanvas::Group&
if (visibility & ShowNameText) {
name_text = new ArdourCanvas::Text (*group);
name_text->property_x() = (double) TimeAxisViewItem::NAME_X_OFFSET;
- name_text->property_y() = (double) trackview.height + 1.0 - TimeAxisViewItem::NAME_Y_OFFSET;
+ /* trackview.height is the bottom of the trackview. subtract 1 to get back to the bottom of the highlight,
+ then NAME_Y_OFFSET to position the text in the vertical center of the highlight
+ */
+ name_text->property_y() = (double) trackview.height - 1.0 - TimeAxisViewItem::NAME_Y_OFFSET;
name_text->property_font_desc() = NAME_FONT;
name_text->property_anchor() = Gtk::ANCHOR_NW;
@@ -872,6 +898,7 @@ TimeAxisViewItem::reset_name_width (double pixel_width)
}
int width;
+
ustring ustr = fit_to_pixels (item_name, (int) floor (pixel_width - NAME_X_OFFSET), NAME_FONT, width);
if (ustr.empty()) {
@@ -934,8 +961,8 @@ TimeAxisViewItem::remove_this_item(void* src)
gint
TimeAxisViewItem::idle_remove_this_item(TimeAxisViewItem* item, void* src)
{
- item->ItemRemoved(item->get_item_name(), src) ; /* EMIT_SIGNAL */
- delete item ;
- item = 0 ;
- return(false) ;
+ item->ItemRemoved (item->get_item_name(), src) ; /* EMIT_SIGNAL */
+ delete item;
+ item = 0;
+ return false;
}
diff --git a/gtk2_ardour/time_axis_view_item.h b/gtk2_ardour/time_axis_view_item.h
index b1e9939449..c9e4fd5dd5 100644
--- a/gtk2_ardour/time_axis_view_item.h
+++ b/gtk2_ardour/time_axis_view_item.h
@@ -272,10 +272,13 @@ class TimeAxisViewItem : public sigc::trackable, public Selectable
static Pango::FontDescription NAME_FONT ;
static bool have_name_font;
static const double NAME_X_OFFSET ;
- static const double NAME_Y_OFFSET ;
- static const double NAME_HIGHLIGHT_SIZE ;
- static const double NAME_HIGHLIGHT_THRESH ;
static const double GRAB_HANDLE_LENGTH ;
+ /* these are not constant, but vary with the pixel size
+ of the font used to display the item name.
+ */
+ static double NAME_Y_OFFSET ;
+ static double NAME_HIGHLIGHT_SIZE ;
+ static double NAME_HIGHLIGHT_THRESH ;
/**
* Handles the Removal of this time axis item