fix up meter thread management when JACK client starts/stops/is halted ; put focus in plugin search entry when plugin selector is shown ; add WINDOWS_KEY option to gtk2_ardour/SConscript, controlling what X modifier is used for LEVEL4 modifier/bindings ; fix up Keyboard object to properly support LEVEL4 bindings ; fix Playlist::partition_internal() to avoid acting on regions that should not be operated on given the range provided ; fix up more stuff relating to get_regions_for(), including cut/delete ops on edit range vs. regions

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3115 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2008-02-23 14:13:25 +00:00
parent 33690d3e72
commit 770c39dce1
14 changed files with 90 additions and 33 deletions

View file

@ -27,6 +27,7 @@ subst_dict = { }
opts = Options('scache.conf')
opts.AddOptions(
('ARCH', 'Set architecture-specific compilation flags by hand (all flags as 1 argument)',''),
('WINDOWS_KEY', 'Set X Modifier (Mod1,Mod2,Mod3,Mod4,Mod5) for "Windows" key', 'Mod4'),
BoolOption('AUDIOUNITS', 'Compile with Apple\'s AudioUnit library. (experimental)', 0),
BoolOption('COREAUDIO', 'Compile with Apple\'s CoreAudio library', 0),
BoolOption('GTKOSX', 'Compile for use with GTK-OSX, not GTK-X11', 0),

View file

@ -409,12 +409,12 @@ if gtkardour['GTKOSX'] and gtkardour['NATIVE_OSX_KEYS']:
keybindings_dict['%WINDOW%'] = 'Mod1'
else:
#
# Ctrl, Alt, Shift, Mod3(Meta)
# Ctrl, Alt, Shift, Mod4(Super/Windows/Hyper)
#
keybindings_dict['%PRIMARY%'] = 'Ctrl'
keybindings_dict['%SECONDARY%'] = 'Alt'
keybindings_dict['%TERTIARY%'] = 'Shift'
keybindings_dict['%LEVEL4%'] = 'Mod2'
keybindings_dict['%LEVEL4%'] = env['WINDOWS_KEY']
keybindings_dict['%WINDOW%'] = 'Alt'
for b in [ 'SAE-de', 'mnemonic-us', 'ergonomic-us' ]:

View file

@ -4403,15 +4403,20 @@ Editor::get_regions_for_action (RegionSelection& rs, bool allow_entered)
if (selection->tracks.empty()) {
/* no regions or tracks selected, but entered regionview is valid
and we're in object mode - just use entered regionview
/* no regions or tracks selected
*/
if (entered_regionview && (mouse_mode == Editing::MouseObject)) {
if (entered_regionview && mouse_mode == Editing::MouseObject) {
/* entered regionview is valid and we're in object mode -
just use entered regionview
*/
rs.add (entered_regionview);
return;
}
return;
} else {
/* no regions selected, so get all regions at the edit point across

View file

@ -963,7 +963,7 @@ class Editor : public PublicEditor
void cut_copy (Editing::CutCopyOp);
void cut_copy_points (Editing::CutCopyOp);
void cut_copy_regions (Editing::CutCopyOp);
void cut_copy_regions (Editing::CutCopyOp, RegionSelection&);
void cut_copy_ranges (Editing::CutCopyOp);
void mouse_paste ();

View file

@ -2273,14 +2273,20 @@ Editor::play_from_edit_point_and_return ()
nframes64_t start_frame;
nframes64_t return_frame;
start_frame = get_preferred_edit_position (true);
if (session->transport_rolling()) {
/* go to edit point and stop */
session->request_locate (start_frame, false);
return;
}
/* don't reset the return frame if its already set */
if ((return_frame = session->requested_return_frame()) < 0) {
return_frame = session->audible_frame();
}
start_frame = get_preferred_edit_position (true);
if (start_frame >= 0) {
session->request_roll_at_and_return (start_frame, return_frame);
}
@ -2675,8 +2681,8 @@ Editor::separate_regions_between (const TimeSelection& ts)
}
if (tmptracks.empty()) {
/* no regions selected: use all tracks */
tmptracks = track_views;
/* no regions selected: do nothing */
return;
}
} else {
@ -3084,7 +3090,7 @@ Editor::align (RegionPoint what)
{
RegionSelection rs;
get_regions_for_action (rs, false);
get_regions_for_action (rs);
nframes64_t where = get_preferred_edit_position();
if (!rs.empty()) {
@ -3103,7 +3109,7 @@ Editor::align_relative (RegionPoint what)
nframes64_t where = get_preferred_edit_position();
RegionSelection rs;
get_regions_for_action (rs, false);
get_regions_for_action (rs);
if (!rs.empty()) {
align_selection_relative (what, where, rs);
@ -3588,7 +3594,11 @@ Editor::cut_copy (CutCopyOp op)
RegionSelection rs;
get_regions_for_action (rs);
/* we only want to cut regions if some are selected */
if (!selection->regions.empty()) {
get_regions_for_action (rs);
}
switch (current_mouse_mode()) {
case MouseObject:
@ -3597,7 +3607,7 @@ Editor::cut_copy (CutCopyOp op)
begin_reversible_command (opname + _(" objects"));
if (!rs.empty()) {
cut_copy_regions (op);
cut_copy_regions (op, rs);
if (op == Cut) {
selection->clear_regions ();
@ -3677,7 +3687,7 @@ struct PlaylistMapping {
};
void
Editor::cut_copy_regions (CutCopyOp op)
Editor::cut_copy_regions (CutCopyOp op, RegionSelection& rs)
{
/* we can't use a std::map here because the ordering is important, and we can't trivially sort
a map when we want ordered access to both elements. i think.
@ -3692,9 +3702,6 @@ Editor::cut_copy_regions (CutCopyOp op)
/* get ordering correct before we cut/copy */
RegionSelection rs;
get_regions_for_action (rs);
rs.sort_by_position_and_track ();
for (RegionSelection::iterator x = rs.begin(); x != rs.end(); ++x) {
@ -3817,9 +3824,14 @@ void
Editor::cut_copy_ranges (CutCopyOp op)
{
TrackSelection* ts;
TrackSelection entered;
if (selection->tracks.empty()) {
ts = &track_views;
if (!entered_track) {
return;
}
entered.push_back (entered_track);
ts = &entered;
} else {
ts = &selection->tracks;
}

View file

@ -1347,6 +1347,12 @@ Editor::get_edit_op_range (nframes64_t& start, nframes64_t& end) const
swap (start, end);
}
/* turn range into one delimited by start...end,
not start...end-1
*/
end++;
return true;
}

View file

@ -54,12 +54,14 @@ guint Keyboard::snap_mod = GDK_MOD3_MASK;
guint Keyboard::PrimaryModifier = GDK_META_MASK; // Command
guint Keyboard::SecondaryModifier = GDK_MOD1_MASK; // Alt/Option
guint Keyboard::TertiaryModifier = GDK_SHIFT_MASK; // Shift
guint Keyboard::Level4Modifier = GDK_CONTROL_MASK; // Control
guint Keyboard::CopyModifier = GDK_MOD1_MASK; // Alt/Option
guint Keyboard::RangeSelectModifier = GDK_SHIFT_MASK;
#else
guint Keyboard::PrimaryModifier = GDK_CONTROL_MASK; // Control
guint Keyboard::SecondaryModifier = GDK_MOD1_MASK; // Alt/Option
guint Keyboard::TertiaryModifier = GDK_SHIFT_MASK; // Shift
guint Keyboard::Level4Modifier = GDK_MOD4_MASK; // Mod4/Windows
guint Keyboard::CopyModifier = GDK_CONTROL_MASK;
guint Keyboard::RangeSelectModifier = GDK_SHIFT_MASK;
#endif
@ -106,9 +108,12 @@ Keyboard::Keyboard ()
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask | PrimaryModifier);
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask | SecondaryModifier);
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask | TertiaryModifier);
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask | Level4Modifier);
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask | CopyModifier);
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask | RangeSelectModifier);
gtk_accelerator_set_default_mod_mask (RelevantModifierKeyMask);
snooper_id = gtk_key_snooper_install (_snooper, (gpointer) this);
XMLNode* node = ARDOUR_UI::instance()->keyboard_settings();

View file

@ -50,6 +50,7 @@ class Keyboard : public sigc::trackable, Stateful
static uint32_t PrimaryModifier;
static uint32_t SecondaryModifier;
static uint32_t TertiaryModifier;
static uint32_t Level4Modifier;
static uint32_t CopyModifier;
static uint32_t RangeSelectModifier;
@ -62,6 +63,9 @@ class Keyboard : public sigc::trackable, Stateful
static void set_tertiary_modifier (uint32_t newval) {
set_modifier (newval, TertiaryModifier);
}
static void set_level4_modifier (uint32_t newval) {
set_modifier (newval, Level4Modifier);
}
static void set_copy_modifier (uint32_t newval) {
set_modifier (newval, CopyModifier);
}

View file

@ -427,3 +427,9 @@ PluginSelector::filter_mode_changed ()
refill ();
}
void
PluginSelector::on_show ()
{
ArdourDialog::on_show ();
filter_entry.grab_focus ();
}

View file

@ -41,6 +41,7 @@ class PluginSelector : public ArdourDialog
int run (); // XXX should we try not to overload the non-virtual Gtk::Dialog::run() ?
void set_session (ARDOUR::Session*);
void on_show ();
private:
ARDOUR::Session* session;

View file

@ -77,9 +77,6 @@ AudioEngine::AudioEngine (string client_name)
if (connect_to_jack (client_name)) {
throw NoBackendAvailable ();
}
start_metering_thread();
}
AudioEngine::~AudioEngine ()
@ -157,6 +154,8 @@ AudioEngine::start ()
} else {
// error << _("cannot activate JACK client") << endmsg;
}
start_metering_thread();
}
return _running ? 0 : -1;
@ -167,11 +166,11 @@ AudioEngine::stop (bool forever)
{
if (_running) {
_running = false;
stop_metering_thread ();
if (forever) {
jack_client_t* foo = _jack;
_jack = 0;
jack_client_close (foo);
stop_metering_thread ();
} else {
jack_deactivate (_jack);
}
@ -421,8 +420,9 @@ void
AudioEngine::start_metering_thread ()
{
if (m_meter_thread == 0) {
g_atomic_int_set (&m_meter_exit, 0);
m_meter_thread = Glib::Thread::create (sigc::mem_fun(this, &AudioEngine::meter_thread),
500000, true, true, Glib::THREAD_PRIORITY_NORMAL);
500000, true, true, Glib::THREAD_PRIORITY_NORMAL);
}
}
@ -801,6 +801,8 @@ AudioEngine::halted (void *arg)
AudioEngine* ae = static_cast<AudioEngine *> (arg);
bool was_running = ae->_running;
ae->stop_metering_thread ();
ae->_running = false;
ae->_buffer_size = 0;
ae->_frame_rate = 0;
@ -1110,6 +1112,7 @@ AudioEngine::disconnect_from_jack ()
_frame_rate = 0;
if (_running) {
stop_metering_thread ();
_running = false;
Stopped(); /* EMIT SIGNAL */
}
@ -1214,6 +1217,8 @@ AudioEngine::reconnect_to_jack ()
Running (); /* EMIT SIGNAL*/
start_metering_thread ();
return 0;
}

View file

@ -81,7 +81,7 @@ Crossfade::Crossfade (boost::shared_ptr<AudioRegion> in, boost::shared_ptr<Audio
{
_in = in;
_out = out;
_length = length;
_position = position;
_anchor_point = ap;

View file

@ -2446,9 +2446,8 @@ IO::setup_peak_meters ()
void
IO::update_meters()
{
Glib::Mutex::Lock guard (m_meter_signal_lock);
Meter();
Glib::Mutex::Lock guard (m_meter_signal_lock);
Meter();
}
void

View file

@ -694,18 +694,27 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi
++tmp;
current = *i;
if (current->first_frame() == start && current->last_frame() == end) {
if (current->first_frame() >= start && current->last_frame() < end) {
if (cutting) {
remove_region_internal (current);
}
continue;
}
/* coverage will return OverlapStart if the start coincides
with the end point. we do not partition such a region,
so catch this special case.
*/
if (current->first_frame() >= end) {
continue;
}
if ((overlap = current->coverage (start, end)) == OverlapNone) {
continue;
}
pos1 = current->position();
pos2 = start;
pos3 = end;
@ -841,6 +850,10 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi
new_regions.push_back (current);
}
}
if (current->first_frame() >= current->last_frame()) {
PBD::stacktrace (cerr);
}
in_partition = false;
}