mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
use RAII for cursor mgmt around thread-waits
This commit is contained in:
parent
98c9c03e9f
commit
15c86492fa
3 changed files with 16 additions and 7 deletions
|
|
@ -342,6 +342,15 @@ class EditingContext : public ARDOUR::SessionHandlePtr, public AxisViewProvider
|
|||
/** Push the appropriate enter/cursor context on item entry. */
|
||||
void choose_canvas_cursor_on_entry (ItemType);
|
||||
|
||||
struct CursorRAII {
|
||||
CursorRAII (EditingContext& e, Gdk::Cursor* new_cursor)
|
||||
: ec (e), old_cursor (ec.get_canvas_cursor ()) { ec.set_canvas_cursor (new_cursor); }
|
||||
~CursorRAII () { ec.set_canvas_cursor (old_cursor); }
|
||||
|
||||
EditingContext& ec;
|
||||
Gdk::Cursor* old_cursor;
|
||||
};
|
||||
|
||||
virtual Gdk::Cursor* get_canvas_cursor () const;
|
||||
static MouseCursors const* cursors () {
|
||||
return _cursors;
|
||||
|
|
|
|||
|
|
@ -574,7 +574,7 @@ Editor::import_sndfiles (vector<string> paths,
|
|||
import_status.track = track;
|
||||
import_status.replace = replace;
|
||||
|
||||
set_canvas_cursor (_cursors->wait);
|
||||
CursorRAII cr (*this, _cursors->wait);
|
||||
|
||||
/* start import thread for this spec. this will ultimately call Session::import_files()
|
||||
which, if successful, will add the files as regions to the region list. its up to us
|
||||
|
|
@ -636,7 +636,7 @@ Editor::embed_sndfiles (vector<string> paths,
|
|||
/* skip periodic saves while importing */
|
||||
Session::StateProtector sp (_session);
|
||||
|
||||
set_canvas_cursor (_cursors->wait);
|
||||
CursorRAII cr (*this, _cursors->wait);
|
||||
|
||||
for (vector<string>::iterator p = paths.begin(); p != paths.end(); ++p) {
|
||||
|
||||
|
|
|
|||
|
|
@ -4379,7 +4379,7 @@ Editor::freeze_route ()
|
|||
|
||||
pthread_create_and_store (X_("freezer"), &itt.thread, _freeze_thread, this, 0);
|
||||
|
||||
set_canvas_cursor (_cursors->wait);
|
||||
CursorRAII cr (*this, _cursors->wait);
|
||||
|
||||
while (!itt.done && !itt.cancel) {
|
||||
gtk_main_iteration ();
|
||||
|
|
@ -5921,7 +5921,7 @@ Editor::normalize_region ()
|
|||
return;
|
||||
}
|
||||
|
||||
set_canvas_cursor (_cursors->wait);
|
||||
CursorRAII cr (*this, _cursors->wait);
|
||||
|
||||
/* XXX: should really only count audio regions here */
|
||||
int const regions = rs.size ();
|
||||
|
|
@ -6200,7 +6200,7 @@ Editor::fork_regions_from_unselected ()
|
|||
return;
|
||||
}
|
||||
|
||||
set_canvas_cursor (_cursors->wait);
|
||||
CursorRAII cr (*this, _cursors->wait);
|
||||
bool in_command = false;
|
||||
|
||||
/* find the set of all MidiSources associated with the selected regions */
|
||||
|
|
@ -6278,7 +6278,7 @@ Editor::fork_selected_regions ()
|
|||
return;
|
||||
}
|
||||
|
||||
set_canvas_cursor (_cursors->wait);
|
||||
CursorRAII cr (*this, _cursors->wait);
|
||||
bool in_command = false;
|
||||
|
||||
for (RegionSelection::iterator r = rs.begin(); r != rs.end(); ) {
|
||||
|
|
@ -6360,7 +6360,7 @@ Editor::apply_filter (Filter& filter, string command, ProgressReporter* progress
|
|||
return;
|
||||
}
|
||||
|
||||
set_canvas_cursor (_cursors->wait);
|
||||
CursorRAII cr (*this, _cursors->wait);
|
||||
bool in_command = false;
|
||||
|
||||
int n = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue