diff options
-rw-r--r-- | gtk2_ardour/analysis_window.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/ardour.menus | 3 | ||||
-rw-r--r-- | gtk2_ardour/ardour2_ui.rc | 2 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_ed.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/automation_time_axis.cc | 5 | ||||
-rw-r--r-- | gtk2_ardour/draginfo.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor_canvas.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor_mouse.cc | 31 | ||||
-rw-r--r-- | gtk2_ardour/editor_tempodisplay.cc | 5 | ||||
-rw-r--r-- | gtk2_ardour/keyboard.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/main.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/regionview.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/time_axis_view_item.cc | 45 | ||||
-rw-r--r-- | gtk2_ardour/time_axis_view_item.h | 9 | ||||
-rw-r--r-- | libs/ardour/ardour/audioregion.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/coreaudio_source.h | 1 | ||||
-rw-r--r-- | libs/ardour/ardour/filesource.h | 7 | ||||
-rw-r--r-- | libs/ardour/ardour/sndfilesource.h | 4 | ||||
-rw-r--r-- | libs/ardour/ardour/source.h | 2 | ||||
-rw-r--r-- | libs/ardour/audioregion.cc | 13 | ||||
-rw-r--r-- | libs/ardour/coreaudio_source.cc | 7 | ||||
-rw-r--r-- | libs/ardour/filesource.cc | 14 | ||||
-rw-r--r-- | libs/ardour/sndfilesource.cc | 6 |
23 files changed, 126 insertions, 49 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 diff --git a/libs/ardour/ardour/audioregion.h b/libs/ardour/ardour/audioregion.h index c716bf9707..a146a20417 100644 --- a/libs/ardour/ardour/audioregion.h +++ b/libs/ardour/ardour/audioregion.h @@ -80,6 +80,8 @@ class AudioRegion : public Region bool equivalent (const AudioRegion&); bool size_equivalent (const AudioRegion&); + bool speed_mismatch (float) const; + void lock_sources (); void unlock_sources (); Source& source (uint32_t n=0) const { if (n < sources.size()) return *sources[n]; else return *sources[0]; } diff --git a/libs/ardour/ardour/coreaudio_source.h b/libs/ardour/ardour/coreaudio_source.h index 6ae74b7304..4193623006 100644 --- a/libs/ardour/ardour/coreaudio_source.h +++ b/libs/ardour/ardour/coreaudio_source.h @@ -32,6 +32,7 @@ class CoreAudioSource : public ExternalSource { ~CoreAudioSource (); jack_nframes_t read (Sample *dst, jack_nframes_t start, jack_nframes_t cnt, char * workbuf) const; + float sample_rate() const; private: ExtAudioFileRef af; diff --git a/libs/ardour/ardour/filesource.h b/libs/ardour/ardour/filesource.h index df9cc46b91..28a01f0a78 100644 --- a/libs/ardour/ardour/filesource.h +++ b/libs/ardour/ardour/filesource.h @@ -58,6 +58,7 @@ class FileSource : public Source { void mark_for_remove(); string peak_path(string audio_path); string path() const { return _path; } + float sample_rate () const; virtual int seek (jack_nframes_t frame) {return 0; } virtual jack_nframes_t last_capture_start_frame() const { return 0; } @@ -129,9 +130,9 @@ class FileSource : public Source { }; struct ChunkInfo { - string name; - uint32_t size; - off64_t offset; + std::string name; + uint32_t size; + off64_t offset; ChunkInfo (string s, uint32_t sz, off64_t o) : name (s), size (sz), offset (o) {} diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h index 37167e6a9a..2bd6042ec2 100644 --- a/libs/ardour/ardour/sndfilesource.h +++ b/libs/ardour/ardour/sndfilesource.h @@ -33,9 +33,9 @@ class SndFileSource : public ExternalSource { SndFileSource (const XMLNode&); ~SndFileSource (); - jack_nframes_t length() const { return _info.frames; } - + jack_nframes_t length() const { return _info.frames; } jack_nframes_t read (Sample *dst, jack_nframes_t start, jack_nframes_t cnt, char * workbuf) const; + float sample_rate () const; private: SNDFILE *sf; diff --git a/libs/ardour/ardour/source.h b/libs/ardour/ardour/source.h index 88a478a420..2eee7a7634 100644 --- a/libs/ardour/ardour/source.h +++ b/libs/ardour/ardour/source.h @@ -75,6 +75,8 @@ class Source : public Stateful, public sigc::trackable return 0; } + virtual float sample_rate () const { return 0; } + uint32_t use_cnt() const { return _use_cnt; } void use (); void release (); diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index c63c231f86..95201ab6f7 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -1392,6 +1392,19 @@ AudioRegion::resume_fade_out () } } +bool +AudioRegion::speed_mismatch (float sr) const +{ + if (sources.empty()) { + /* impossible, but ... */ + return false; + } + + float fsr = sources.front()->sample_rate(); + + return fsr == sr; +} + extern "C" { int region_read_peaks_from_c (void *arg, uint32_t npeaks, uint32_t start, uint32_t cnt, intptr_t data, uint32_t n_chan, double samples_per_unit) diff --git a/libs/ardour/coreaudio_source.cc b/libs/ardour/coreaudio_source.cc index 3f786a2b14..d81630d6b7 100644 --- a/libs/ardour/coreaudio_source.cc +++ b/libs/ardour/coreaudio_source.cc @@ -204,3 +204,10 @@ CoreAudioSource::read (Sample *dst, jack_nframes_t start, jack_nframes_t cnt, ch return real_cnt; } +float +CoreAudioSource::sample_rate() const +{ + /* XXX taybin fill me in please */ + + return 44100.0f; +} diff --git a/libs/ardour/filesource.cc b/libs/ardour/filesource.cc index d4f728c13b..568ce46bd1 100644 --- a/libs/ardour/filesource.cc +++ b/libs/ardour/filesource.cc @@ -907,14 +907,20 @@ FileSource::check_header (jack_nframes_t rate, bool silent) _path, header.data.size, _length * sizeof (Sample)) << endmsg; } - if ((jack_nframes_t) header.format.nSamplesPerSec != rate) { - warning << string_compose(_("\"%1\" has a sample rate of %2 instead of %3 as used by this session"), - _path, header.format.nSamplesPerSec, rate) << endmsg; - } +// if ((jack_nframes_t) header.format.nSamplesPerSec != rate) { +// warning << string_compose(_("\"%1\" has a sample rate of %2 instead of %3 as used by this session"), +// _path, header.format.nSamplesPerSec, rate) << endmsg; +// } return 0; } +float +FileSource::sample_rate () const +{ + return header.format.nSamplesPerSec; +} + int FileSource::write_header() { diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc index 522f94b5c2..e547b212a0 100644 --- a/libs/ardour/sndfilesource.cc +++ b/libs/ardour/sndfilesource.cc @@ -109,6 +109,12 @@ SndFileSource::~SndFileSource () } } +float +SndFileSource::sample_rate () const +{ + return _info.samplerate; +} + jack_nframes_t SndFileSource::read (Sample *dst, jack_nframes_t start, jack_nframes_t cnt, char * workbuf) const { |