#include "sfdb_ui.h"
#include "editing.h"
#include "gtk-custom-hruler.h"
+#include "gui_thread.h"
#include "i18n.h"
cnt = (int) floor (prefix);
}
- vertical_adjustment.set_value (vertical_adjustment.get_value() + (cnt * vertical_adjustment.get_page_size()));
+ double vert_value = vertical_adjustment.get_value() + (cnt *
+ vertical_adjustment.get_page_size());
+ if (vert_value > vertical_adjustment.get_upper() - canvas_height) {
+ vert_value = vertical_adjustment.get_upper() - canvas_height;
+ }
+ vertical_adjustment.set_value (vert_value);
}
void
void
Editor::scroll_tracks_down_line ()
{
+
Gtk::Adjustment* adj = edit_vscrollbar.get_adjustment();
- adj->set_value (adj->get_value() + 10);
+ double vert_value = adj->get_value() + 20;
+
+ if (vert_value>adj->get_upper() - canvas_height) {
+ vert_value = adj->get_upper() - canvas_height;
+ }
+ adj->set_value (vert_value);
}
void
Editor::scroll_tracks_up_line ()
{
Gtk::Adjustment* adj = edit_vscrollbar.get_adjustment();
- adj->set_value (adj->get_value() - 10);
+ adj->set_value (adj->get_value() - 20);
}
/* ZOOM */
void
Editor::temporal_zoom_step (bool coarser)
{
+ ENSURE_GUI_THREAD (bind (mem_fun (*this, &Editor::temporal_zoom_step), coarser));
+
double nfpu;
nfpu = frames_per_unit;
void
Editor::temporal_zoom_session ()
{
+ ENSURE_GUI_THREAD (mem_fun (*this, &Editor::temporal_zoom_session));
+
if (session) {
temporal_zoom_by_frame (session->current_start_frame(), session->current_end_frame(), "zoom to session");
}
void
Editor::set_selection_from_range (Location& loc)
{
- if (clicked_trackview == 0) {
- return;
- }
-
begin_reversible_command (_("set selection from range"));
selection->set (0, loc.start(), loc.end());
commit_reversible_command ();
void
Editor::select_all_selectables_using_time_selection ()
{
-
list<Selectable *> touched;
- if (clicked_trackview == 0) {
- return;
- }
-
if (selection->time.empty()) {
return;
}
}
(*iter)->get_selectables (start, end - 1, 0, DBL_MAX, touched);
}
+
begin_reversible_command (_("select all from range"));
selection->set (touched);
commit_reversible_command ();
-
}
list<Selectable *> touched;
if (after) {
- begin_reversible_command (_("select all after cursor"));
- start = cursor->current_frame ;
- end = session->current_end_frame();
+ begin_reversible_command (_("select all after cursor"));
+ start = cursor->current_frame ;
+ end = session->current_end_frame();
+ } else {
+ if (cursor->current_frame > 0) {
+ begin_reversible_command (_("select all before cursor"));
+ start = 0;
+ end = cursor->current_frame - 1;
+ } else {
+ return;
+ }
+ }
+
+ for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) {
+ if ((*iter)->hidden()) {
+ continue;
+ }
+ (*iter)->get_selectables (start, end, 0, DBL_MAX, touched);
+ }
+ selection->set (touched);
+ commit_reversible_command ();
+}
+
+void
+Editor::select_all_selectables_between_cursors (Cursor *cursor, Cursor *other_cursor)
+{
+ jack_nframes_t start;
+ jack_nframes_t end;
+ list<Selectable *> touched;
+ bool other_cursor_is_first = cursor->current_frame > other_cursor->current_frame;
+
+ if (cursor->current_frame == other_cursor->current_frame) {
+ return;
+ }
+
+ begin_reversible_command (_("select all between cursors"));
+ if (other_cursor_is_first) {
+ start = other_cursor->current_frame;
+ end = cursor->current_frame - 1;
+
} else {
- if (cursor->current_frame > 0) {
- begin_reversible_command (_("select all before cursor"));
- start = 0;
- end = cursor->current_frame - 1;
- } else {
- return;
- }
+ start = cursor->current_frame;
+ end = other_cursor->current_frame - 1;
}
+
for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) {
if ((*iter)->hidden()) {
continue;
if (doing_undo) commit_reversible_command ();
}
+void
+Editor::separate_regions_using_location (Location& loc)
+{
+ bool doing_undo = false;
+
+ if (loc.is_mark()) {
+ return;
+ }
+
+ Playlist *playlist;
+
+ /* XXX i'm unsure as to whether this should operate on selected tracks only
+ or the entire enchillada. uncomment the below line to correct the behaviour
+ (currently set for all tracks)
+ */
+
+ for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
+ //for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
+
+ AudioTimeAxisView* atv;
+
+ if ((atv = dynamic_cast<AudioTimeAxisView*> ((*i))) != 0) {
+
+ if (atv->is_audio_track()) {
+
+ if ((playlist = atv->playlist()) != 0) {
+ if (!doing_undo) {
+ begin_reversible_command (_("separate"));
+ doing_undo = true;
+ }
+ if (doing_undo) session->add_undo ((playlist)->get_memento());
+
+ /* XXX need to consider musical time selections here at some point */
+
+ double speed = atv->get_diskstream()->speed();
+
+
+ playlist->partition ((jack_nframes_t)(loc.start() * speed), (jack_nframes_t)(loc.end() * speed), true);
+ if (doing_undo) session->add_redo_no_execute (playlist->get_memento());
+ }
+ }
+ }
+ }
+
+ if (doing_undo) commit_reversible_command ();
+}
+
void
Editor::crop_region_to_selection ()
{