fix deadlock in playlist::partition(); new first idle model, including message about loading visual data; make h-faders use scroll up/down and be scalable-clickable; new track menu stuff (waveform scaling/shape); fix up ordering of ruler menus; fix initial sensitivity of region menu operations

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3097 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2008-02-21 18:37:00 +00:00
parent 280ade047c
commit cdf37e613b
25 changed files with 354 additions and 192 deletions

View file

@ -11,7 +11,6 @@
<menuitem action='Snapshot'/>
<menuitem action='SaveTemplate'/>
<separator/>
<menuitem action='AddTrackBus'/>
<menu name='Files' action='Files'>
<menuitem action='addExistingAudioFiles'/>
@ -171,6 +170,7 @@
</menu>
<menu action='TrackMenu'>
<menuitem action='AddTrackBus'/>
<menu action='TrackHeightMenu'>
<menuitem action='track-height-largest'/>
<menuitem action='track-height-large'/>
@ -179,11 +179,16 @@
<menuitem action='track-height-smaller'/>
<menuitem action='track-height-small'/>
</menu>
<menu action='WaveformMenu'>
<menuitem action='toggle-waveform-visible'/>
<menuitem action='linear-waveforms'/>
<menuitem action='logarithmic-waveforms'/>
</menu>
<menuitem action='toggle-track-active'/>
<menuitem action='remove-track'/>
</menu>
<menu action='Regions'>
<menu action='RegionMenu'>
<menuitem action='insert-region'/>
<menuitem action='rename-region'/>
<menuitem action='auto-rename-region'/>
@ -225,16 +230,15 @@
<menuitem action="secondary-clock-off"/>
</menu>
<menu action="RulerMenu">
<menuitem action="toggle-bbt-ruler"/>
<menuitem action="toggle-minsec-ruler"/>
<menuitem action="toggle-samples-ruler"/>
<menuitem action="toggle-bbt-ruler"/>
<separator/>
<menuitem action="toggle-meter-ruler"/>
<menuitem action="toggle-tempo-ruler"/>
<menuitem action="toggle-range-ruler"/>
<menuitem action="toggle-marker-ruler"/>
<menuitem action="toggle-cd-marker-ruler"/>
<menuitem action="toggle-loop-punch-ruler"/>
<menuitem action="toggle-cd-marker-ruler"/>
<menuitem action="toggle-marker-ruler"/>
</menu>
<menu action="ZoomMenu">
<menuitem action='temporal-zoom-in'/>
@ -250,17 +254,18 @@
<menuitem action='scroll-backward'/>
</menu>
<separator/>
<menu action="Windows">
<menuitem action='goto-editor'/>
<menuitem action='goto-mixer'/>
<menuitem action='ToggleLocations'/>
<menuitem action='ToggleKeyEditor'/>
<menuitem action='ToggleThemeManager'/>
<menuitem action='ToggleBigClock'/>
<menuitem action='toggle-rhythm-ferret'/>
</menu>
</menu>
<menu action="WindowMenu">
<menuitem action='goto-editor'/>
<menuitem action='goto-mixer'/>
<menuitem action='ToggleLocations'/>
<menuitem action='ToggleKeyEditor'/>
<menuitem action='ToggleThemeManager'/>
<menuitem action='ToggleBigClock'/>
<menuitem action='toggle-rhythm-ferret'/>
</menu>
<menu name='Options' action='Options'>
<menu action='Monitoring'>
<menuitem action='UseSoftwareMonitoring'/>
@ -312,16 +317,15 @@
</menubar>
<popup action="RulerMenuPopup">
<menuitem action="toggle-bbt-ruler"/>
<menuitem action="toggle-minsec-ruler"/>
<menuitem action="toggle-samples-ruler"/>
<menuitem action="toggle-bbt-ruler"/>
<separator/>
<menuitem action="toggle-meter-ruler"/>
<menuitem action="toggle-tempo-ruler"/>
<menuitem action="toggle-range-ruler"/>
<menuitem action="toggle-marker-ruler"/>
<menuitem action="toggle-cd-marker-ruler"/>
<menuitem action="toggle-loop-punch-ruler"/>
<menuitem action="toggle-cd-marker-ruler"/>
<menuitem action="toggle-marker-ruler"/>
</popup>
<popup name='redirectmenu'>

View file

@ -168,7 +168,7 @@
<menuitem action='select-next-route'/>
<menuitem action='select-prev-route'/>
</menu>
<menu name='Regions' action='Regions'>
<menu action='RegionMenu'>
<menuitem action='split-region-at-transients'/>
<menuitem action='crop'/>
<menuitem action='duplicate-region'/>
@ -274,7 +274,7 @@
<menuitem action='scroll-playhead-forward'/>
<menuitem action='scroll-playhead-backward'/>
<separator/>
<menuitem action='ToggleWaveformVisibility'/>
<menuitem action='toggle-waveform-visible'/>
<menuitem action='ToggleWaveformsWhileRecording'/>
<menuitem action='ToggleMeasureVisibility'/>
<separator/>
@ -296,7 +296,7 @@
<menuitem action='JACKLatency8192'/>
</menu>
</menu>
<menu name='Windows' action = 'Windows'>
<menu action = 'WindowMenu'>
<menuitem action='ToggleMaximalEditor'/>
<separator/>
<menuitem action='goto-editor'/>

View file

@ -3171,6 +3171,11 @@ ARDOUR_UI::first_idle ()
if (session) {
session->allow_auto_play (true);
}
if (editor) {
editor->first_idle();
}
Keyboard::set_can_save_keybindings (true);
return false;
}

View file

@ -79,7 +79,6 @@ ARDOUR_UI::connect_to_session (Session *s)
/* there are never any selections on startup */
ActionManager::set_sensitive (ActionManager::region_selection_sensitive_actions, false);
ActionManager::set_sensitive (ActionManager::time_selection_sensitive_actions, false);
ActionManager::set_sensitive (ActionManager::track_selection_sensitive_actions, false);
ActionManager::set_sensitive (ActionManager::line_selection_sensitive_actions, false);

View file

@ -86,7 +86,6 @@ ARDOUR_UI::install_actions ()
ActionManager::register_action (main_actions, X_("Session"), _("Session"));
ActionManager::register_action (main_actions, X_("Files"), _("Import/Export"));
ActionManager::register_action (main_actions, X_("Regions"), _("Regions"));
ActionManager::register_action (main_actions, X_("Cleanup"), _("Cleanup"));
ActionManager::register_action (main_actions, X_("Sync"), _("Sync"));
ActionManager::register_action (main_actions, X_("Options"), _("Options"));
@ -192,7 +191,7 @@ ARDOUR_UI::install_actions ()
/* these actions are intended to be shared across all windows */
common_actions = ActionGroup::create (X_("Common"));
ActionManager::register_action (main_actions, X_("Windows"), _("Windows"));
ActionManager::register_action (main_actions, X_("WindowMenu"), _("Window"));
ActionManager::register_action (common_actions, X_("Quit"), _("Quit"), (mem_fun(*this, &ARDOUR_UI::finish)));
/* windows visibility actions */

View file

@ -72,8 +72,8 @@ class AudioRegionView : public RegionView
void set_envelope_visible (bool);
void set_waveform_visible (bool yn);
void set_waveform_shape (WaveformShape);
void set_waveform_scale (WaveformScale);
void set_waveform_shape (Editing::WaveformShape);
void set_waveform_scale (Editing::WaveformScale);
bool waveform_rectified() const { return _flags & WaveformRectified; }
bool waveform_logscaled() const { return _flags & WaveformLogScaled; }

View file

@ -26,7 +26,7 @@
#include <boost/weak_ptr.hpp>
#include <ardour/location.h>
#include "enums.h"
#include "editing.h"
#include "simplerect.h"
#include "streamview.h"
@ -57,10 +57,10 @@ class AudioStreamView : public StreamView
AudioStreamView (AudioTimeAxisView&);
~AudioStreamView ();
void set_waveform_shape (WaveformShape);
WaveformShape get_waveform_shape () const { return _waveform_shape; }
void set_waveform_scale (WaveformScale);
WaveformScale get_waveform_scale () const { return _waveform_scale; }
void set_waveform_shape (Editing::WaveformShape);
Editing::WaveformShape get_waveform_shape () const { return _waveform_shape; }
void set_waveform_scale (Editing::WaveformScale);
Editing::WaveformScale get_waveform_scale () const { return _waveform_scale; }
int set_height (gdouble h);
int set_samples_per_unit (gdouble spp);
@ -109,8 +109,8 @@ class AudioStreamView : public StreamView
nframes_t last_rec_peak_frame;
map<boost::shared_ptr<ARDOUR::Source>, bool> rec_peak_ready_map;
WaveformShape _waveform_shape;
WaveformScale _waveform_scale;
Editing::WaveformShape _waveform_shape;
Editing::WaveformScale _waveform_scale;
};
#endif /* __ardour_audio_streamview_h__ */

View file

@ -75,12 +75,6 @@ using namespace PBD;
using namespace Gtk;
using namespace Editing;
static gboolean __idler (gpointer arg)
{
((AudioTimeAxisView*)arg)->first_idle ();
return FALSE;
}
AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, boost::shared_ptr<Route> rt, Canvas& canvas)
: AxisView(sess)
, RouteTimeAxisView(ed, sess, rt, canvas)
@ -119,7 +113,8 @@ AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
/* ask for notifications of any new RegionViews */
_view->RegionViewAdded.connect (mem_fun(*this, &AudioTimeAxisView::region_view_added));
g_idle_add (__idler, this);
/* first idle will do the rest */
} else {
post_construct ();
}

View file

@ -36,6 +36,7 @@
#include "ardour_dialog.h"
#include "route_ui.h"
#include "enums.h"
#include "editing.h"
#include "route_time_axis.h"
#include "canvas.h"
@ -86,6 +87,9 @@ class AudioTimeAxisView : public RouteTimeAxisView
void first_idle ();
void set_waveform_shape (Editing::WaveformShape);
void set_waveform_scale (Editing::WaveformScale);
private:
friend class AudioStreamView;
friend class AudioRegionView;
@ -96,9 +100,7 @@ class AudioTimeAxisView : public RouteTimeAxisView
void append_extra_display_menu_items ();
void toggle_show_waveforms ();
void set_waveform_shape (WaveformShape);
void toggle_waveforms ();
void set_waveform_scale (WaveformScale);
void show_all_automation ();
void show_existing_automation ();

View file

@ -36,6 +36,8 @@
#define IMPORTPOSITION(a) /*empty*/
#define IMPORTDISPOSITION(a) /*empty*/
#define EDITPOINT(a) /*empty*/
#define WAVEFORMSCALE(a) /*empty*/
#define WAVEFORMSHAPE(a) /*empty*/
namespace Editing {
@ -163,6 +165,27 @@ enum EditPoint {
#undef EDITPOINT
#define EDITPOINT(a) /*empty*/
// WAVEFORMSCALE
#undef WAVEFORMSCALE
#define WAVEFORMSCALE(a) a,
enum WaveformScale {
#include "editing_syms.h"
};
#undef WAVEFORMSCALE
#define WAVEFORMSCALE(a) /*empty*/
// WAVEFORMSHAPE
#undef WAVEFORMSHAPE
#define WAVEFORMSHAPE(a) a,
enum WaveformShape {
#include "editing_syms.h"
};
#undef WAVEFORMSHAPE
#define WAVEFORMSHAPE(a) /*empty*/
/////////////////////
// These don't need their state saved. yet...
enum CutCopyOp {

View file

@ -94,3 +94,11 @@ IMPORTDISPOSITION(ImportDistinctChannels=3)
EDITPOINT(EditAtPlayhead)
EDITPOINT(EditAtSelectedMarker)
EDITPOINT(EditAtMouse)
WAVEFORMSCALE(LinearWaveform)
WAVEFORMSCALE(LogWaveform)
WAVEFORMSHAPE(Traditional)
WAVEFORMSHAPE(Rectified)

View file

@ -1120,6 +1120,10 @@ Editor::connect_to_session (Session *t)
{
session = t;
/* there are never any selected regions at startup */
sensitize_the_right_region_actions (false);
XMLNode* node = ARDOUR_UI::instance()->editor_settings();
set_state (*node);
@ -2277,7 +2281,7 @@ Editor::set_state (const XMLNode& node)
if ((prop = node.property ("show-waveforms"))) {
bool yn = (prop->value() == "yes");
_show_waveforms = !yn;
RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleWaveformVisibility"));
RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-waveform-visible"));
if (act) {
RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic(act);
/* do it twice to force the change */
@ -4489,3 +4493,27 @@ Editor::show_rhythm_ferret ()
rhythm_ferret->show ();
rhythm_ferret->present ();
}
void
Editor::first_idle ()
{
MessageDialog* dialog = 0;
if (track_views.size() > 1) {
dialog = new MessageDialog (*this,
_("Please wait while Ardour loads visual data"),
true,
Gtk::MESSAGE_INFO,
Gtk::BUTTONS_NONE);
dialog->present ();
ARDOUR_UI::instance()->flush_pending ();
}
for (TrackViewList::iterator t = track_views.begin(); t != track_views.end(); ++t) {
(*t)->first_idle();
}
if (dialog) {
delete dialog;
}
}

View file

@ -130,6 +130,7 @@ class Editor : public PublicEditor
void connect_to_session (ARDOUR::Session *);
ARDOUR::Session* current_session() const { return session; }
void first_idle ();
nframes_t leftmost_position() const { return leftmost_frame; }
nframes_t current_page_frames() const {
@ -171,6 +172,8 @@ class Editor : public PublicEditor
void set_show_waveforms (bool yn);
bool show_waveforms() const { return _show_waveforms; }
void set_waveform_scale (Editing::WaveformScale);
void set_show_waveforms_recording (bool yn);
bool show_waveforms_recording() const { return _show_waveforms_recording; }
@ -1541,6 +1544,7 @@ public:
void time_selection_changed ();
void track_selection_changed ();
void region_selection_changed ();
void sensitize_the_right_region_actions (bool have_selected_regions);
void point_selection_changed ();
void marker_selection_changed ();
@ -2105,6 +2109,7 @@ public:
void remove_tracks ();
void toggle_tracks_active ();
void waveform_scale_chosen (Editing::WaveformScale);
};
#endif /* __ardour_editor_h__ */

View file

@ -68,6 +68,7 @@ Editor::register_actions ()
ActionManager::register_action (editor_actions, X_("PlayMenu"), _("Play"));
ActionManager::register_action (editor_actions, X_("PrimaryClockMenu"), _("Primary Clock"));
ActionManager::register_action (editor_actions, X_("Pullup"), _("Pullup / Pulldown"));
ActionManager::register_action (editor_actions, X_("RegionMenu"), _("Region"));
ActionManager::register_action (editor_actions, X_("RegionEditOps"), _("Region operations"));
ActionManager::register_action (editor_actions, X_("RegionGainMenu"), _("Gain"));
ActionManager::register_action (editor_actions, X_("RulerMenu"), _("Rulers"));
@ -83,10 +84,11 @@ Editor::register_actions ()
ActionManager::register_action (editor_actions, X_("TempoMenu"), _("Tempo"));
ActionManager::register_action (editor_actions, X_("Timecode"), _("Timecode fps"));
ActionManager::register_action (editor_actions, X_("TrackHeightMenu"), _("Height"));
ActionManager::register_action (editor_actions, X_("TrackMenu"), _("Tracks"));
ActionManager::register_action (editor_actions, X_("TrackMenu"), _("Track"));
ActionManager::register_action (editor_actions, X_("Tools"), _("Tools"));
ActionManager::register_action (editor_actions, X_("TrimMenu"), _("Trim"));
ActionManager::register_action (editor_actions, X_("View"), _("View"));
ActionManager::register_action (editor_actions, X_("WaveformMenu"), _("Waveforms"));
ActionManager::register_action (editor_actions, X_("ZoomFocus"), _("Zoom"));
ActionManager::register_action (editor_actions, X_("ZoomMenu"), _("Zoom"));
ActionManager::register_action (editor_actions, X_("ZoomFocusMenu"), _("Zoom Focus"));
@ -504,21 +506,30 @@ Editor::register_actions ()
act = ActionManager::register_action (editor_actions, "toggle-track-active", _("Toggle Active"), (mem_fun(*this, &Editor::toggle_tracks_active)));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::track_selection_sensitive_actions.push_back (act);
act = ActionManager::register_action (editor_actions, "remove-track", _("Remove"), (mem_fun(*this, &Editor::remove_tracks)));
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"), (mem_fun(*this, &Editor::set_track_height_largest)));
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"), (mem_fun(*this, &Editor::set_track_height_large)));
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"), (mem_fun(*this, &Editor::set_track_height_larger)));
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"), (mem_fun(*this, &Editor::set_track_height_normal)));
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"), (mem_fun(*this, &Editor::set_track_height_smaller)));
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"), (mem_fun(*this, &Editor::set_track_height_small)));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::track_selection_sensitive_actions.push_back (act);
Glib::RefPtr<ActionGroup> zoom_actions = ActionGroup::create (X_("Zoom"));
RadioAction::Group zoom_group;
@ -680,10 +691,18 @@ Editor::register_actions ()
act = ActionManager::register_action (editor_actions, X_("addExternalAudioToRegionList"), _("Add External Audio"), bind (mem_fun(*this, &Editor::add_external_audio_action), ImportAsRegion));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::register_toggle_action (editor_actions, X_("ToggleWaveformVisibility"), _("Show Waveforms"), mem_fun (*this, &Editor::toggle_waveform_visibility));
ActionManager::register_toggle_action (editor_actions, X_("toggle-waveform-visible"), _("Show Waveforms"), mem_fun (*this, &Editor::toggle_waveform_visibility));
ActionManager::track_selection_sensitive_actions.push_back (act);
ActionManager::register_toggle_action (editor_actions, X_("ToggleWaveformsWhileRecording"), _("Show Waveforms While Recording"), mem_fun (*this, &Editor::toggle_waveforms_while_recording));
ActionManager::register_toggle_action (editor_actions, X_("ToggleMeasureVisibility"), _("Show Measures"), mem_fun (*this, &Editor::toggle_measure_visibility));
RadioAction::Group waveform_scale_group;
act = ActionManager::register_radio_action (editor_actions, waveform_scale_group, X_("linear-waveforms"), _("Linear"), bind (mem_fun (*this, &Editor::waveform_scale_chosen), Editing::LinearWaveform));
ActionManager::track_selection_sensitive_actions.push_back (act);
act = ActionManager::register_radio_action (editor_actions, waveform_scale_group, X_("logarithmic-waveforms"), _("Logarithmic"), bind (mem_fun (*this, &Editor::waveform_scale_chosen), Editing::LogWaveform));
ActionManager::track_selection_sensitive_actions.push_back (act);
/* if there is a logo in the editor canvas, its always visible at startup */
act = ActionManager::register_toggle_action (editor_actions, X_("ToggleLogoVisibility"), _("Show Logo"), mem_fun (*this, &Editor::toggle_logo_visibility));
@ -789,7 +808,7 @@ Editor::toggle_ruler_visibility (RulerType rt)
void
Editor::toggle_waveform_visibility ()
{
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("ToggleWaveformVisibility"));
Glib::RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-waveform-visible"));
if (act) {
Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
set_show_waveforms (tact->get_active());
@ -833,6 +852,33 @@ Editor::toggle_logo_visibility ()
}
}
void
Editor::waveform_scale_chosen (Editing::WaveformScale ws)
{
RefPtr<Action> act;
/* this is driven by a toggle on a radio group, and so is invoked twice,
once for the item that became inactive and once for the one that became
active.
*/
switch (ws) {
case LinearWaveform:
act = ActionManager::get_action (X_("Editor"), X_("linear-waveforms"));
break;
case LogWaveform:
act = ActionManager::get_action (X_("Editor"), X_("logarithmic-waveforms"));
break;
}
if (act) {
RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
if (ract && ract->get_active()) {
set_waveform_scale (ws);
}
}
}
void
Editor::set_crossfade_model (CrossfadeModel model)
{

View file

@ -5610,3 +5610,21 @@ Editor::remove_tracks ()
session->remove_route (*x);
}
}
void
Editor::set_waveform_scale (WaveformScale ws)
{
TrackSelection& ts (selection->tracks);
if (ts.empty()) {
return;
}
for (TrackSelection::iterator x = ts.begin(); x != ts.end(); ++x) {
AudioTimeAxisView* atv = dynamic_cast<AudioTimeAxisView*> (*x);
if (atv) {
atv->set_waveform_scale (ws);
}
}
}

View file

@ -415,21 +415,21 @@ Editor::popup_ruler_menu (nframes_t where, ItemType t)
if (action) {
ruler_items.push_back (MenuElem (*action->create_menu_item()));
}
action = ActionManager::get_action ("Rulers", "toggle-marker-ruler");
if (action) {
ruler_items.push_back (MenuElem (*action->create_menu_item()));
}
if (!Profile->get_sae()) {
action = ActionManager::get_action ("Rulers", "toggle-range-ruler");
if (action) {
ruler_items.push_back (MenuElem (*action->create_menu_item()));
}
}
action = ActionManager::get_action ("Rulers", "toggle-loop-punch-ruler");
if (action) {
ruler_items.push_back (MenuElem (*action->create_menu_item()));
}
action = ActionManager::get_action ("Rulers", "toggle-cd-marker-ruler");
if (action) {
ruler_items.push_back (MenuElem (*action->create_menu_item()));
}
action = ActionManager::get_action ("Rulers", "toggle-loop-punch-ruler");
action = ActionManager::get_action ("Rulers", "toggle-marker-ruler");
if (action) {
ruler_items.push_back (MenuElem (*action->create_menu_item()));
}

View file

@ -764,6 +764,8 @@ Editor::track_selection_changed ()
(*i)->set_selected (false);
}
}
ActionManager::set_sensitive (ActionManager::track_selection_sensitive_actions, !selection->tracks.empty());
}
void
@ -796,14 +798,8 @@ Editor::time_selection_changed ()
}
void
Editor::region_selection_changed ()
Editor::sensitize_the_right_region_actions (bool have_selected_regions)
{
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
(*i)->set_selected_regionviews (selection->regions);
}
bool have_selected_regions = !selection->regions.empty();
for (vector<Glib::RefPtr<Action> >::iterator x = ActionManager::region_selection_sensitive_actions.begin();
x != ActionManager::region_selection_sensitive_actions.end(); ++x) {
@ -822,6 +818,17 @@ Editor::region_selection_changed ()
(*x)->set_sensitive (have_selected_regions);
}
}
}
void
Editor::region_selection_changed ()
{
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
(*i)->set_selected_regionviews (selection->regions);
}
sensitize_the_right_region_actions (!selection->regions.empty());
zoomed_to_region = false;
}

View file

@ -39,6 +39,8 @@ setup_gtk_ardour_enums ()
Width width;
ImportMode import_mode;
EditPoint edit_point;
WaveformScale waveform_scale;
WaveformShape waveform_shape;
#define REGISTER(e) enum_writer.register_distinct (typeid(e).name(), i, s); i.clear(); s.clear()
#define REGISTER_BITS(e) enum_writer.register_bits (typeid(e).name(), i, s); i.clear(); s.clear()
@ -66,4 +68,12 @@ setup_gtk_ardour_enums ()
REGISTER_ENUM (EditAtMouse);
REGISTER_ENUM (EditAtSelectedMarker);
REGISTER (edit_point);
REGISTER_ENUM (LinearWaveform);
REGISTER_ENUM (LogWaveform);
REGISTER (waveform_scale);
REGISTER_ENUM (Traditional);
REGISTER_ENUM (Rectified);
REGISTER (waveform_shape);
}

View file

@ -22,17 +22,6 @@
#include <ardour/types.h>
enum WaveformShape {
Traditional,
Rectified
};
enum WaveformScale {
LinearWaveform=0,
LogWaveform,
};
enum Width {
Wide,
Narrow,

View file

@ -117,7 +117,7 @@ class GainMeter : public Gtk::VBox
std::string short_astyle_string (ARDOUR::AutoStyle);
std::string _astyle_string (ARDOUR::AutoStyle, bool);
Width _width;
Width _width;
static std::map<std::string,Glib::RefPtr<Gdk::Pixmap> > metric_pixmaps;
static Glib::RefPtr<Gdk::Pixmap> render_metrics (Gtk::Widget&);

View file

@ -73,7 +73,7 @@ class LevelMeter : public Gtk::HBox
boost::shared_ptr<ARDOUR::IO> _io;
ARDOUR::Session& _session;
Width _width;
Width _width;
struct MeterInfo {
Gtkmm2ext::FastMeter *meter;

View file

@ -84,6 +84,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway
virtual void connect_to_session (ARDOUR::Session*) = 0;
virtual ARDOUR::Session* current_session() const = 0;
virtual void first_idle() = 0;
virtual void set_snap_to (Editing::SnapType) = 0;
virtual void set_snap_mode (Editing::SnapMode) = 0;
virtual void set_snap_threshold (double) = 0;

View file

@ -206,6 +206,12 @@ class TimeAxisView : public virtual AxisView
virtual void get_selectables (nframes_t start, nframes_t end, double top, double bot, list<Selectable*>& results);
virtual void get_inverted_selectables (Selection&, list<Selectable *>& results);
/* called at load time when first GUI idle occurs. put
expensive data loading/redisplay code in here.
*/
virtual void first_idle () {}
/* state/serialization management */
void set_parent (TimeAxisView& p);

View file

@ -669,53 +669,55 @@ Playlist::partition (nframes_t start, nframes_t end, bool just_top_level)
void
Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, RegionList& thawlist)
{
RegionLock rlock (this);
boost::shared_ptr<Region> region;
boost::shared_ptr<Region> current;
string new_name;
RegionList::iterator tmp;
OverlapType overlap;
nframes_t pos1, pos2, pos3, pos4;
RegionList new_regions;
in_partition = true;
/* need to work from a copy, because otherwise the regions we add during the process
get operated on as well.
*/
RegionList copy = regions;
for (RegionList::iterator i = copy.begin(); i != copy.end(); i = tmp) {
{
RegionLock rlock (this);
boost::shared_ptr<Region> region;
boost::shared_ptr<Region> current;
string new_name;
RegionList::iterator tmp;
OverlapType overlap;
nframes_t pos1, pos2, pos3, pos4;
tmp = i;
++tmp;
current = *i;
in_partition = true;
if (current->first_frame() == start && current->last_frame() == end) {
if (cutting) {
remove_region_internal (current);
/* need to work from a copy, because otherwise the regions we add during the process
get operated on as well.
*/
RegionList copy = regions;
for (RegionList::iterator i = copy.begin(); i != copy.end(); i = tmp) {
tmp = i;
++tmp;
current = *i;
if (current->first_frame() == start && current->last_frame() == end) {
if (cutting) {
remove_region_internal (current);
}
continue;
}
continue;
}
if ((overlap = current->coverage (start, end)) == OverlapNone) {
continue;
}
pos1 = current->position();
pos2 = start;
pos3 = end;
pos4 = current->last_frame();
if (overlap == OverlapInternal) {
if ((overlap = current->coverage (start, end)) == OverlapNone) {
continue;
}
/* split: we need 3 new regions, the front, middle and end.
cut: we need 2 regions, the front and end.
*/
pos1 = current->position();
pos2 = start;
pos3 = end;
pos4 = current->last_frame();
/*
if (overlap == OverlapInternal) {
/* split: we need 3 new regions, the front, middle and end.
cut: we need 2 regions, the front and end.
*/
/*
start end
---------------*************************------------
P1 P2 P3 P4
@ -724,37 +726,37 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi
CUT
---------------*****----------------====------------
*/
*/
if (!cutting) {
if (!cutting) {
/* "middle" ++++++ */
/* "middle" ++++++ */
_session.region_name (new_name, current->name(), false);
region = RegionFactory::create (current, pos2 - pos1, pos3 - pos2, new_name,
regions.size(), Region::Flag(current->flags()|Region::Automatic|Region::LeftOfSplit|Region::RightOfSplit));
add_region_internal (region, start);
new_regions.push_back (region);
}
/* "end" ====== */
_session.region_name (new_name, current->name(), false);
region = RegionFactory::create (current, pos2 - pos1, pos3 - pos2, new_name,
regions.size(), Region::Flag(current->flags()|Region::Automatic|Region::LeftOfSplit|Region::RightOfSplit));
add_region_internal (region, start);
new_regions.push_back (region);
}
/* "end" ====== */
_session.region_name (new_name, current->name(), false);
region = RegionFactory::create (current, pos3 - pos1, pos4 - pos3, new_name,
regions.size(), Region::Flag(current->flags()|Region::Automatic|Region::RightOfSplit));
add_region_internal (region, end);
new_regions.push_back (region);
/* "front" ***** */
region = RegionFactory::create (current, pos3 - pos1, pos4 - pos3, new_name,
regions.size(), Region::Flag(current->flags()|Region::Automatic|Region::RightOfSplit));
current->freeze ();
thawlist.push_back (current);
current->trim_end (pos2, this);
} else if (overlap == OverlapEnd) {
/*
add_region_internal (region, end);
new_regions.push_back (region);
/* "front" ***** */
current->freeze ();
thawlist.push_back (current);
current->trim_end (pos2, this);
} else if (overlap == OverlapEnd) {
/*
start end
---------------*************************------------
P1 P2 P4 P3
@ -762,33 +764,32 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi
---------------**************+++++++++++------------
CUT:
---------------**************-----------------------
*/
if (!cutting) {
*/
/* end +++++ */
if (!cutting) {
/* end +++++ */
_session.region_name (new_name, current->name(), false);
region = RegionFactory::create (current, pos2 - pos1, pos4 - pos2, new_name, (layer_t) regions.size(),
Region::Flag(current->flags()|Region::Automatic|Region::LeftOfSplit));
add_region_internal (region, start);
new_regions.push_back (region);
}
_session.region_name (new_name, current->name(), false);
region = RegionFactory::create (current, pos2 - pos1, pos4 - pos2, new_name, (layer_t) regions.size(),
Region::Flag(current->flags()|Region::Automatic|Region::LeftOfSplit));
add_region_internal (region, start);
new_regions.push_back (region);
}
/* front ****** */
current->freeze ();
thawlist.push_back (current);
current->trim_end (pos2, this);
} else if (overlap == OverlapStart) {
/* split: we need 2 regions: the front and the end.
cut: just trim current to skip the cut area
*/
/* front ****** */
/*
current->freeze ();
thawlist.push_back (current);
current->trim_end (pos2, this);
} else if (overlap == OverlapStart) {
/* split: we need 2 regions: the front and the end.
cut: just trim current to skip the cut area
*/
/*
start end
---------------*************************------------
P2 P1 P3 P4
@ -798,31 +799,31 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi
CUT:
-------------------*********************------------
*/
*/
if (!cutting) {
if (!cutting) {
/* front **** */
_session.region_name (new_name, current->name(), false);
region = RegionFactory::create (current, 0, pos3 - pos1, new_name,
regions.size(), Region::Flag(current->flags()|Region::Automatic|Region::RightOfSplit));
add_region_internal (region, pos1);
new_regions.push_back (region);
}
/* end */
current->freeze ();
thawlist.push_back (current);
current->trim_front (pos3, this);
} else if (overlap == OverlapExternal) {
/* split: no split required.
cut: remove the region.
*/
/* front **** */
_session.region_name (new_name, current->name(), false);
region = RegionFactory::create (current, 0, pos3 - pos1, new_name,
regions.size(), Region::Flag(current->flags()|Region::Automatic|Region::RightOfSplit));
add_region_internal (region, pos1);
new_regions.push_back (region);
}
/*
/* end */
current->freeze ();
thawlist.push_back (current);
current->trim_front (pos3, this);
} else if (overlap == OverlapExternal) {
/* split: no split required.
cut: remove the region.
*/
/*
start end
---------------*************************------------
P2 P1 P3 P4
@ -832,16 +833,17 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi
CUT:
----------------------------------------------------
*/
if (cutting) {
remove_region_internal (current);
*/
if (cutting) {
remove_region_internal (current);
}
new_regions.push_back (current);
}
new_regions.push_back (current);
}
}
in_partition = false;
in_partition = false;
}
for (RegionList::iterator i = new_regions.begin(); i != new_regions.end(); ++i) {
check_dependents (*i, false);

View file

@ -138,7 +138,7 @@ PixFader::on_button_release_event (GdkEventButton* ev)
{
double fract, ev_pos;
ev_pos = (_orien == VERT) ? ev->y : 0; // Don't step if we are horizontal
ev_pos = (_orien == VERT) ? ev->y : ev->x;
switch (ev->button) {
case 1:
@ -190,6 +190,7 @@ bool
PixFader::on_scroll_event (GdkEventScroll* ev)
{
double scale;
bool ret = false;
if (ev->state & fine_scale_modifier) {
if (ev->state & extra_fine_scale_modifier) {
@ -202,35 +203,49 @@ PixFader::on_scroll_event (GdkEventScroll* ev)
}
if (_orien == VERT) {
/* should left/right scroll affect vertical faders ? */
switch (ev->direction) {
case GDK_SCROLL_UP:
/* wheel up */
adjustment.set_value (adjustment.get_value() + (adjustment.get_page_increment() * scale));
ret = true;
break;
case GDK_SCROLL_DOWN:
/* wheel down */
adjustment.set_value (adjustment.get_value() - (adjustment.get_page_increment() * scale));
ret = true;
break;
default:
break;
}
} else {
/* up/down scrolls should definitely affect horizontal faders
because they are so much easier to use
*/
switch (ev->direction) {
case GDK_SCROLL_RIGHT:
case GDK_SCROLL_UP:
/* wheel right */
adjustment.set_value (adjustment.get_value() + (adjustment.get_page_increment() * scale));
ret = true;
break;
case GDK_SCROLL_LEFT:
case GDK_SCROLL_DOWN:
/* wheel left */
adjustment.set_value (adjustment.get_value() - (adjustment.get_page_increment() * scale));
ret = true;
break;
default:
break;
}
}
return false;
return ret;
}
bool