/* Note: public Editor methods are documented in public_editor.h */
+#define __STDC_LIMIT_MACROS 1
+#include <stdint.h>
#include <unistd.h>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
+#include <map>
#include <boost/none.hpp>
#include <sigc++/bind.h>
-#include <pbd/convert.h>
-#include <pbd/error.h>
-#include <pbd/enumwriter.h>
-#include <pbd/memento_command.h>
+#include "pbd/convert.h"
+#include "pbd/error.h"
+#include "pbd/enumwriter.h"
+#include "pbd/memento_command.h"
#include <glibmm/miscutils.h>
#include <gtkmm/image.h>
#include <gtkmm2ext/utils.h>
#include <gtkmm2ext/window_title.h>
#include <gtkmm2ext/choice.h>
-
-#include <ardour/audio_track.h>
-#include <ardour/audio_diskstream.h>
-#include <ardour/plugin_manager.h>
-#include <ardour/location.h>
-#include <ardour/audioplaylist.h>
-#include <ardour/audioregion.h>
-#include <ardour/midi_region.h>
-#include <ardour/session_route.h>
-#include <ardour/session_directory.h>
-#include <ardour/session_state_utils.h>
-#include <ardour/tempo.h>
-#include <ardour/utils.h>
-#include <ardour/profile.h>
-
-#include <control_protocol/control_protocol.h>
+#include <gtkmm2ext/cell_renderer_pixbuf_toggle.h>
+
+#include "ardour/audio_diskstream.h"
+#include "ardour/audio_track.h"
+#include "ardour/audioplaylist.h"
+#include "ardour/audioregion.h"
+#include "ardour/location.h"
+#include "ardour/midi_region.h"
+#include "ardour/plugin_manager.h"
+#include "ardour/profile.h"
+#include "ardour/route_group.h"
+#include "ardour/session_directory.h"
+#include "ardour/session_route.h"
+#include "ardour/session_state_utils.h"
+#include "ardour/tempo.h"
+#include "ardour/utils.h"
+
+#include "control_protocol/control_protocol.h"
#include "ardour_ui.h"
#include "editor.h"
#include "actions.h"
#include "tempo_lines.h"
#include "analysis_window.h"
+#include "bundle_manager.h"
+#include "global_port_matrix.h"
+#include "editor_drag.h"
+#include "editor_group_tabs.h"
#include "i18n.h"
cerr << "size of " << what << " = " << r->width << " x " << r->height << endl;
}
-void
-DragInfo::clear_copied_locations ()
-{
- for (list<Location*>::iterator i = copied_locations.begin(); i != copied_locations.end(); ++i) {
- delete *i;
- }
- copied_locations.clear ();
-}
-
Editor::Editor ()
:
/* time display buttons */
range_mark_label (_("Range Markers")),
transport_mark_label (_("Loop/Punch Ranges")),
cd_mark_label (_("CD Markers")),
- edit_packer (3, 4, true),
+ edit_packer (4, 4, true),
/* the values here don't matter: layout widgets
reset them as needed.
/* nudge */
nudge_clock (X_("nudge"), false, X_("NudgeClock"), true, true),
- meters_running(false)
+ meters_running(false),
+ _pending_locate_request (false)
{
constructed = false;
clicked_crossfadeview = 0;
clicked_control_point = 0;
last_update_frame = 0;
- drag_info.item = 0;
+ _drag = 0;
current_mixer_strip = 0;
current_bbt_points = 0;
tempo_lines = 0;
snap_threshold = 5.0;
bbt_beat_subdivision = 4;
- canvas_width = 0;
- canvas_height = 0;
+ _canvas_width = 0;
+ _canvas_height = 0;
last_autoscroll_x = 0;
last_autoscroll_y = 0;
autoscroll_active = false;
current_interthread_info = 0;
_show_measures = true;
- _show_waveforms = true;
_show_waveforms_recording = true;
- first_action_message = 0;
show_gain_after_trim = false;
- ignore_route_list_reorder = false;
+ route_redisplay_does_not_sync_order_keys = false;
+ route_redisplay_does_not_reset_order_keys = false;
no_route_list_redisplay = false;
verbose_cursor_on = true;
route_removal = false;
select_new_marker = false;
zoomed_to_region = false;
rhythm_ferret = 0;
+ _bundle_manager = 0;
+ for (ARDOUR::DataType::iterator i = ARDOUR::DataType::begin(); i != ARDOUR::DataType::end(); ++i) {
+ _global_port_matrix[*i] = 0;
+ }
allow_vertical_scroll = false;
no_save_visual = false;
- need_resize_line = false;
- resize_line_y = 0;
- old_resize_line_y = -1;
no_region_list_redisplay = false;
resize_idle_id = -1;
- _scrubbing = false;
scrubbing_direction = 0;
sfbrowser = 0;
- ignore_route_order_sync = false;
location_marker_color = ARDOUR_UI::config()->canvasvar_LocationMarker.get();
location_range_color = ARDOUR_UI::config()->canvasvar_LocationRange.get();
location_loop_color = ARDOUR_UI::config()->canvasvar_LocationLoop.get();
location_punch_color = ARDOUR_UI::config()->canvasvar_LocationPunch.get();
- range_marker_drag_rect = 0;
- marker_drag_line = 0;
set_midi_edit_mode (MidiEditPencil, true);
+ _edit_point = EditAtMouse;
set_mouse_mode (MouseObject, true);
frames_per_unit = 2048; /* too early to use reset_zoom () */
transport_mark_label.set_no_show_all();
initialize_rulers ();
+ _summary = new EditorSummary (this);
initialize_canvas ();
selection->TimeChanged.connect (mem_fun(*this, &Editor::time_selection_changed));
selection->TracksChanged.connect (mem_fun(*this, &Editor::track_selection_changed));
- selection->RegionsChanged.connect (mem_fun(*this, &Editor::region_selection_changed));
+ editor_regions_selection_changed_connection = selection->RegionsChanged.connect (mem_fun(*this, &Editor::region_selection_changed));
selection->PointsChanged.connect (mem_fun(*this, &Editor::point_selection_changed));
selection->MarkersChanged.connect (mem_fun(*this, &Editor::marker_selection_changed));
vertical_adjustment.signal_value_changed().connect (mem_fun(*this, &Editor::tie_vertical_scrolling), true);
track_canvas->signal_map_event().connect (mem_fun (*this, &Editor::track_canvas_map_handler));
- controls_layout.add (edit_controls_vbox);
+ HBox* h = manage (new HBox);
+ _group_tabs = new EditorGroupTabs (this);
+ h->pack_start (*_group_tabs, PACK_SHRINK);
+ h->pack_start (edit_controls_vbox);
+ controls_layout.add (*h);
+
controls_layout.set_name ("EditControlsBase");
controls_layout.add_events (Gdk::SCROLL_MASK);
controls_layout.signal_scroll_event().connect (mem_fun(*this, &Editor::control_layout_scroll), false);
pad_line_1->show();
time_pad->show();
- //time_canvas_vbox.set_size_request (-1, (int)(timebar_height * visible_timebars) + 2);
- //time_canvas_vbox.set_size_request (-1, -1);
+ time_canvas_vbox.set_size_request (-1, (int)(timebar_height * visible_timebars) + 2);
+ time_canvas_vbox.set_size_request (-1, -1);
ruler_label_event_box.add (ruler_label_vbox);
ruler_label_event_box.set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
- ruler_label_event_box.set_name ("TimebarLabelBase");
ruler_label_event_box.signal_button_release_event().connect (mem_fun(*this, &Editor::ruler_label_button_release));
time_button_event_box.add (time_button_vbox);
- time_button_event_box.set_name ("TimebarLabelBase");
time_button_event_box.set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
time_button_event_box.signal_button_release_event().connect (mem_fun(*this, &Editor::ruler_label_button_release));
time_canvas_event_box.add (time_canvas_vbox);
time_canvas_event_box.set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::POINTER_MOTION_MASK);
-
+
edit_packer.set_col_spacings (0);
edit_packer.set_row_spacings (0);
edit_packer.set_homogeneous (false);
edit_packer.set_border_width (0);
edit_packer.set_name ("EditorWindow");
-#ifndef THE_OLD_WAY
-
- edit_packer.attach (ruler_label_event_box, 0, 1, 0, 1, FILL, SHRINK, 0, 0);
-
- edit_packer.attach (time_button_event_box, 0, 1, 1, 2, FILL, SHRINK, 0, 0);
- edit_packer.attach (time_canvas_event_box, 1, 2, 0, 1, FILL|EXPAND, FILL, 0, 0);
-
- edit_packer.attach (controls_layout, 0, 1, 2, 3, FILL, FILL|EXPAND, 0, 0);
- edit_packer.attach (track_canvas_event_box, 1, 2, 1, 3, FILL|EXPAND, FILL|EXPAND, 0, 0);
-
- edit_packer.attach (zoom_box, 0, 1, 3, 4, FILL, FILL, 0, 0);
- edit_packer.attach (edit_hscrollbar, 1, 2, 3, 4, FILL|EXPAND, FILL, 0, 0);
-
- edit_packer.attach (edit_vscrollbar, 3, 4, 2, 3, FILL, FILL|EXPAND, 0, 0);
-
-#else
-
- edit_packer.attach (edit_vscrollbar, 0, 1, 0, 4, FILL, FILL|EXPAND, 0, 0);
-
+ edit_packer.attach (zoom_vbox, 0, 1, 0, 2, SHRINK, FILL, 0, 0);
+ /* labels for the rulers */
edit_packer.attach (ruler_label_event_box, 1, 2, 0, 1, FILL, SHRINK, 0, 0);
+ /* labels for the marker "tracks" */
edit_packer.attach (time_button_event_box, 1, 2, 1, 2, FILL, SHRINK, 0, 0);
+ /* the rulers */
edit_packer.attach (time_canvas_event_box, 2, 3, 0, 1, FILL|EXPAND, FILL, 0, 0);
-
- edit_packer.attach (controls_layout, 1, 2, 2, 3, FILL, FILL|EXPAND, 0, 0);
+ /* track controls */
+ edit_packer.attach (controls_layout, 0, 2, 2, 3, FILL, FILL|EXPAND, 0, 0);
+ /* main canvas */
edit_packer.attach (track_canvas_event_box, 2, 3, 1, 3, FILL|EXPAND, FILL|EXPAND, 0, 0);
- edit_packer.attach (zoom_box, 1, 2, 3, 4, FILL, FILL, 0, 0);
- edit_packer.attach (edit_hscrollbar, 2, 3, 3, 4, FILL|EXPAND, FILL, 0, 0);
-#endif
-
bottom_hbox.set_border_width (2);
bottom_hbox.set_spacing (3);
+
+ CellRendererPixbufToggle* rec_col_renderer = Gtk::manage( new CellRendererPixbufToggle() );
+
+ rec_col_renderer->set_active_pixbuf(::get_icon("record_normal_red"));
+ rec_col_renderer->set_inactive_pixbuf(::get_icon("record_disabled_grey"));
+
+ rec_col_renderer->signal_toggled().connect(mem_fun(*this, &Editor::on_tv_rec_enable_toggled));
+
+ Gtk::TreeViewColumn* rec_state_column = Gtk::manage(new Gtk::TreeViewColumn("Rec", *rec_col_renderer));
+ rec_state_column->add_attribute(rec_col_renderer->property_active(), route_display_columns.rec_enabled);
+ rec_state_column->add_attribute(rec_col_renderer->property_visible(), route_display_columns.is_track);
+
route_display_model = ListStore::create(route_display_columns);
route_list_display.set_model (route_display_model);
+
+ route_list_display.append_column (*rec_state_column);
route_list_display.append_column (_("Show"), route_display_columns.visible);
route_list_display.append_column (_("Name"), route_display_columns.text);
+
route_list_display.get_column (0)->set_data (X_("colnum"), GUINT_TO_POINTER(0));
route_list_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1));
+ route_list_display.get_column (2)->set_data (X_("colnum"), GUINT_TO_POINTER(2));
+
route_list_display.set_headers_visible (true);
route_list_display.set_name ("TrackListDisplay");
- route_list_display.get_selection()->set_mode (SELECTION_SINGLE);
+ route_list_display.get_selection()->set_mode (SELECTION_NONE);
route_list_display.set_reorderable (true);
route_list_display.set_size_request (100,-1);
route_list_display.add_object_drag (route_display_columns.route.index(), "routes");
- CellRendererToggle* route_list_visible_cell = dynamic_cast<CellRendererToggle*>(route_list_display.get_column_cell_renderer (0));
+ CellRendererToggle* route_list_visible_cell = dynamic_cast<CellRendererToggle*>(route_list_display.get_column_cell_renderer (1));
+
route_list_visible_cell->property_activatable() = true;
route_list_visible_cell->property_radio() = false;
route_display_model->signal_row_deleted().connect (mem_fun (*this, &Editor::route_list_delete));
route_display_model->signal_row_changed().connect (mem_fun (*this, &Editor::route_list_change));
+ route_display_model->signal_rows_reordered().connect (mem_fun (*this, &Editor::route_list_reordered));
route_list_display.signal_button_press_event().connect (mem_fun (*this, &Editor::route_list_display_button_press), false);
region_list_display.append_column (_("Used"), region_list_columns.used);
region_list_display.append_column (_("Path"), region_list_columns.path);
region_list_display.set_headers_visible (true);
- region_list_display.set_grid_lines (TREE_VIEW_GRID_LINES_BOTH);
+ //region_list_display.set_grid_lines (TREE_VIEW_GRID_LINES_BOTH);
CellRendererText* region_name_cell = dynamic_cast<CellRendererText*>(region_list_display.get_column_cell_renderer (0));
region_name_cell->property_editable() = true;
region_list_display.signal_key_release_event().connect (mem_fun(*this, &Editor::region_list_display_key_release));
region_list_display.signal_button_press_event().connect (mem_fun(*this, &Editor::region_list_display_button_press), false);
region_list_display.signal_button_release_event().connect (mem_fun(*this, &Editor::region_list_display_button_release));
- region_list_display.get_selection()->signal_changed().connect (mem_fun(*this, &Editor::region_list_selection_changed));
+ region_list_change_connection = region_list_display.get_selection()->signal_changed().connect (mem_fun(*this, &Editor::region_list_selection_changed));
// region_list_display.signal_popup_menu().connect (bind (mem_fun (*this, &Editor::show_region_list_display_context_menu), 1, 0));
//ARDOUR_UI::instance()->secondary_clock.mode_changed.connect (mem_fun(*this, &Editor::redisplay_regions));
post_maximal_editor_width = 0;
post_maximal_pane_position = 0;
- edit_pane.pack1 (edit_packer, true, true);
+
+ VPaned *editor_summary_pane = manage(new VPaned());
+ editor_summary_pane->pack1(edit_packer);
+ editor_summary_pane->pack2(*_summary);
+
+ edit_pane.pack1 (*editor_summary_pane, true, true);
edit_pane.pack2 (the_notebook, false, true);
edit_pane.signal_size_allocate().connect (bind (mem_fun(*this, &Editor::pane_allocation_handler), static_cast<Paned*> (&edit_pane)));
}
#endif
- if (track_canvas) {
- delete track_canvas;
- track_canvas = 0;
+ delete track_canvas;
+ delete _drag;
+}
+
+void
+Editor::on_tv_rec_enable_toggled(const Glib::ustring& path_string){
+
+ // Get the model row that has been toggled.
+ Gtk::TreeModel::Row row = *route_display_model->get_iter(Gtk::TreeModel::Path(path_string));
+
+ TimeAxisView *tv = row[route_display_columns.tv];
+ AudioTimeAxisView *atv = dynamic_cast<AudioTimeAxisView*> (tv);
+
+ if(atv != 0 && atv->is_audio_track()){
+ atv->get_diskstream()->set_record_enabled(!atv->get_diskstream()->record_enabled());
}
}
+
void
Editor::add_toplevel_controls (Container& cont)
{
audioregionview by itself.
*/
+ if (_drag && rv->get_canvas_group() == _drag->item() && !_drag->ending()) {
+ _drag->end_grab (0);
+ delete _drag;
+ _drag = 0;
+ }
+
if (clicked_regionview == rv) {
clicked_regionview = 0;
}
void
Editor::show_window ()
{
- show_all_children ();
+ if (! is_visible ()) {
+ show_all ();
- /* re-hide editor list if necessary */
- editor_list_button_toggled ();
-
- /* now reset all audio_time_axis heights, because widgets might need
- to be re-hidden
- */
-
- TimeAxisView *tv;
+ /* re-hide editor list if necessary */
+ editor_list_button_toggled ();
+
+ /* re-hide summary widget if necessary */
+ parameter_changed ("show-summary");
+
+ parameter_changed ("show-edit-group-tabs");
+
+ /* now reset all audio_time_axis heights, because widgets might need
+ to be re-hidden
+ */
+
+ TimeAxisView *tv;
- for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
- tv = (static_cast<TimeAxisView*>(*i));
- tv->reset_height ();
+ for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
+ tv = (static_cast<TimeAxisView*>(*i));
+ tv->reset_height ();
+ }
}
-
+
present ();
}
return;
}
- double fpu = zoom_range_clock.current_duration() / canvas_width;
+ double fpu = zoom_range_clock.current_duration() / _canvas_width;
if (fpu < 1.0) {
fpu = 1.0;
- zoom_range_clock.set ((nframes64_t) floor (fpu * canvas_width));
- } else if (fpu > session->current_end_frame() / canvas_width) {
- fpu = session->current_end_frame() / canvas_width;
- zoom_range_clock.set ((nframes64_t) floor (fpu * canvas_width));
+ zoom_range_clock.set ((nframes64_t) floor (fpu * _canvas_width));
+ } else if (fpu > session->current_end_frame() / _canvas_width) {
+ fpu = session->current_end_frame() / _canvas_width;
+ zoom_range_clock.set ((nframes64_t) floor (fpu * _canvas_width));
}
temporal_zoom (fpu);
ENSURE_GUI_THREAD (bind (mem_fun (*this, &Editor::access_action), action_group, action_item));
- cout<< "OSC: Recieved: "<< action_item << endl;
-
RefPtr<Action> act;
act = ActionManager::get_action( action_group.c_str(), action_item.c_str() );
void
Editor::center_screen (nframes64_t frame)
{
- double page = canvas_width * frames_per_unit;
+ double page = _canvas_width * frames_per_unit;
/* if we're off the page, then scroll.
*/
horizontal_adjustment.set_upper (new_end / frames_per_unit);
horizontal_adjustment.set_page_size (current_page_frames()/frames_per_unit);
- if (horizontal_adjustment.get_value() + canvas_width > horizontal_adjustment.get_upper()) {
- horizontal_adjustment.set_value (horizontal_adjustment.get_upper() - canvas_width);
+ if (horizontal_adjustment.get_value() + _canvas_width > horizontal_adjustment.get_upper()) {
+ horizontal_adjustment.set_value (horizontal_adjustment.get_upper() - _canvas_width);
}
//cerr << "Editor::handle_new_duration () called ha v:l:u:ps:lcf = " << horizontal_adjustment.get_value() << ":" << horizontal_adjustment.get_lower() << ":" << horizontal_adjustment.get_upper() << ":" << horizontal_adjustment.get_page_size() << ":" << endl;//DEBUG
}
{
session = t;
+ compute_fixed_ruler_scale ();
+
/* there are never any selected regions at startup */
sensitize_the_right_region_actions (false);
session->request_locate (playhead_cursor->current_frame);
- if (first_action_message) {
- first_action_message->hide();
- }
-
update_title ();
session->GoingAway.connect (mem_fun(*this, &Editor::session_going_away));
session_connections.push_back (session->tempo_map().StateChanged.connect (mem_fun(*this, &Editor::tempo_map_changed)));
+ session_connections.push_back (session->Located.connect (mem_fun (*this, &Editor::located)));
+ session_connections.push_back (session->config.ParameterChanged.connect (mem_fun (*this, &Editor::parameter_changed)));
+
edit_groups_changed ();
+ edit_point_clock.set_mode(AudioClock::BBT);
edit_point_clock.set_session (session);
zoom_range_clock.set_session (session);
_playlist_selector->set_session (session);
nudge_clock.set_session (session);
- nudge_clock.set (session->frame_rate() * 5); // default of 5 seconds
+ if (Profile->get_sae()) {
+ BBT_Time bbt;
+ bbt.bars = 0;
+ bbt.beats = 0;
+ bbt.ticks = 120;
+ nframes_t pos = session->tempo_map().bbt_duration_at (0, bbt, 1);
+ nudge_clock.set_mode(AudioClock::BBT);
+ nudge_clock.set (pos, true, 0, AudioClock::BBT);
+
+ } else {
+ nudge_clock.set (session->frame_rate() * 5, true, 0, AudioClock::SMPTE); // default of 5 seconds
+ }
playhead_cursor->canvas_item.show ();
}
Config->map_parameters (mem_fun (*this, &Editor::parameter_changed));
+ session->config.map_parameters (mem_fun (*this, &Editor::parameter_changed));
session->StateSaved.connect (mem_fun(*this, &Editor::session_state_saved));
redisplay_named_selections ();
redisplay_snapshots ();
+ restore_ruler_visibility ();
+ //tempo_map_changed (Change (0));
+ session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
+
initial_route_list_display ();
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
(static_cast<TimeAxisView*>(*i))->set_samples_per_unit (frames_per_unit);
}
- restore_ruler_visibility ();
- //tempo_map_changed (Change (0));
- session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks);
-
start_scrolling ();
/* don't show master bus in a new session */
/* register for undo history */
session->register_with_memento_command_factory(_id, this);
+ _summary->set_session (session);
+ _group_tabs->set_session (session);
+
start_updating ();
}
Editor::add_region_context_items (StreamView* sv, boost::shared_ptr<Region> region, Menu_Helpers::MenuList& edit_items)
{
using namespace Menu_Helpers;
+ Gtk::MenuItem* foo_item;
Menu *region_menu = manage (new Menu);
MenuList& items = region_menu->items();
region_menu->set_name ("ArdourContextMenu");
-
+
boost::shared_ptr<AudioRegion> ar;
boost::shared_ptr<MidiRegion> mr;
items.push_back (SeparatorElem());
}
+ items.push_back (MenuElem (_("Strip silence..."), mem_fun (*this, &Editor::strip_region_silence)));
items.push_back (MenuElem (_("Reverse"), mem_fun(*this, &Editor::reverse_region)));
items.push_back (SeparatorElem());
/* range related stuff */
- items.push_back (MenuElem (_("Add Range Markers"), mem_fun (*this, &Editor::add_location_from_audio_region)));
+ items.push_back (MenuElem (_("Add Single Range"), mem_fun (*this, &Editor::add_location_from_audio_region)));
+ items.push_back (MenuElem (_("Add Range Markers"), mem_fun (*this, &Editor::add_locations_from_audio_region)));
+ if (selection->regions.size() < 2) {
+ items.back().set_sensitive (false);
+ }
+
items.push_back (MenuElem (_("Set Range Selection"), mem_fun (*this, &Editor::set_selection_from_region)));
items.push_back (SeparatorElem());
trim_menu->set_name ("ArdourContextMenu");
trim_items.push_back (MenuElem (_("Start to edit point"), mem_fun(*this, &Editor::trim_region_from_edit_point)));
+ foo_item = &trim_items.back();
+ if (_edit_point == EditAtMouse) {
+ foo_item->set_sensitive (false);
+ }
trim_items.push_back (MenuElem (_("Edit point to end"), mem_fun(*this, &Editor::trim_region_to_edit_point)));
+ foo_item = &trim_items.back();
+ if (_edit_point == EditAtMouse) {
+ foo_item->set_sensitive (false);
+ }
trim_items.push_back (MenuElem (_("Trim To Loop"), mem_fun(*this, &Editor::trim_region_to_loop)));
trim_items.push_back (MenuElem (_("Trim To Punch"), mem_fun(*this, &Editor::trim_region_to_punch)));
items.push_back (MenuElem (_("Split"), (mem_fun(*this, &Editor::split_region))));
region_edit_menu_split_item = &items.back();
+
+ if (_edit_point == EditAtMouse) {
+ region_edit_menu_split_item->set_sensitive (false);
+ }
items.push_back (MenuElem (_("Make mono regions"), (mem_fun(*this, &Editor::split_multichannel_region))));
region_edit_menu_split_multichannel_item = &items.back();
Editor::add_selection_context_items (Menu_Helpers::MenuList& edit_items)
{
using namespace Menu_Helpers;
- Menu *selection_menu = manage (new Menu);
- MenuList& items = selection_menu->items();
- selection_menu->set_name ("ArdourContextMenu");
- items.push_back (MenuElem (_("Play range"), mem_fun(*this, &Editor::play_selection)));
- items.push_back (MenuElem (_("Loop range"), bind (mem_fun(*this, &Editor::set_loop_from_selection), true)));
+ edit_items.push_back (MenuElem (_("Play range"), mem_fun(*this, &Editor::play_selection)));
+ edit_items.push_back (MenuElem (_("Loop range"), bind (mem_fun(*this, &Editor::set_loop_from_selection), true)));
- items.push_back (SeparatorElem());
- items.push_back (MenuElem (_("Spectral Analysis"), mem_fun(*this, &Editor::analyze_range_selection)));
+ edit_items.push_back (SeparatorElem());
+ edit_items.push_back (MenuElem (_("Spectral Analysis"), mem_fun(*this, &Editor::analyze_range_selection)));
- items.push_back (SeparatorElem());
- items.push_back (MenuElem (_("Extend Range to End of Region"), bind (mem_fun(*this, &Editor::extend_selection_to_end_of_region), false)));
- items.push_back (MenuElem (_("Extend Range to Start of Region"), bind (mem_fun(*this, &Editor::extend_selection_to_start_of_region), false)));
+ edit_items.push_back (SeparatorElem());
+ edit_items.push_back (MenuElem (_("Extend Range to End of Region"), bind (mem_fun(*this, &Editor::extend_selection_to_end_of_region), false)));
+ edit_items.push_back (MenuElem (_("Extend Range to Start of Region"), bind (mem_fun(*this, &Editor::extend_selection_to_start_of_region), false)));
- items.push_back (SeparatorElem());
- items.push_back (MenuElem (_("Convert to region in-place"), mem_fun(*this, &Editor::separate_region_from_selection)));
- items.push_back (MenuElem (_("Convert to region in region list"), mem_fun(*this, &Editor::new_region_from_selection)));
+ edit_items.push_back (SeparatorElem());
+ edit_items.push_back (MenuElem (_("Convert to region in-place"), mem_fun(*this, &Editor::separate_region_from_selection)));
+ edit_items.push_back (MenuElem (_("Convert to region in region list"), mem_fun(*this, &Editor::new_region_from_selection)));
- items.push_back (SeparatorElem());
- items.push_back (MenuElem (_("Select all in range"), mem_fun(*this, &Editor::select_all_selectables_using_time_selection)));
+ edit_items.push_back (SeparatorElem());
+ edit_items.push_back (MenuElem (_("Select all in range"), mem_fun(*this, &Editor::select_all_selectables_using_time_selection)));
- items.push_back (SeparatorElem());
- items.push_back (MenuElem (_("Set loop from selection"), bind (mem_fun(*this, &Editor::set_loop_from_selection), false)));
- items.push_back (MenuElem (_("Set punch from selection"), mem_fun(*this, &Editor::set_punch_from_selection)));
+ edit_items.push_back (SeparatorElem());
+ edit_items.push_back (MenuElem (_("Set loop from selection"), bind (mem_fun(*this, &Editor::set_loop_from_selection), false)));
+ edit_items.push_back (MenuElem (_("Set punch from selection"), mem_fun(*this, &Editor::set_punch_from_selection)));
- items.push_back (SeparatorElem());
- items.push_back (MenuElem (_("Add Range Markers"), mem_fun (*this, &Editor::add_location_from_selection)));
- items.push_back (SeparatorElem());
- items.push_back (MenuElem (_("Crop region to range"), mem_fun(*this, &Editor::crop_region_to_selection)));
- items.push_back (MenuElem (_("Fill range with region"), mem_fun(*this, &Editor::region_fill_selection)));
- items.push_back (MenuElem (_("Duplicate range"), bind (mem_fun(*this, &Editor::duplicate_dialog), false)));
- items.push_back (MenuElem (_("Create chunk from range"), mem_fun(*this, &Editor::create_named_selection)));
- items.push_back (SeparatorElem());
- items.push_back (MenuElem (_("Consolidate range"), bind (mem_fun(*this, &Editor::bounce_range_selection), true)));
- items.push_back (MenuElem (_("Bounce range to region list"), bind (mem_fun(*this, &Editor::bounce_range_selection), false)));
- items.push_back (MenuElem (_("Export range"), mem_fun(*this, &Editor::export_range)));
+ edit_items.push_back (SeparatorElem());
+ edit_items.push_back (MenuElem (_("Add Range Markers"), mem_fun (*this, &Editor::add_location_from_selection)));
+ edit_items.push_back (SeparatorElem());
+ edit_items.push_back (MenuElem (_("Crop region to range"), mem_fun(*this, &Editor::crop_region_to_selection)));
+ edit_items.push_back (MenuElem (_("Fill range with region"), mem_fun(*this, &Editor::region_fill_selection)));
+ edit_items.push_back (MenuElem (_("Duplicate range"), bind (mem_fun(*this, &Editor::duplicate_dialog), false)));
+ edit_items.push_back (MenuElem (_("Create chunk from range"), mem_fun(*this, &Editor::create_named_selection)));
+ edit_items.push_back (SeparatorElem());
+ edit_items.push_back (MenuElem (_("Consolidate range"), bind (mem_fun(*this, &Editor::bounce_range_selection), true, false)));
+ edit_items.push_back (MenuElem (_("Consolidate range with processing"), bind (mem_fun(*this, &Editor::bounce_range_selection), true, true)));
+ edit_items.push_back (MenuElem (_("Bounce range to region list"), bind (mem_fun(*this, &Editor::bounce_range_selection), false, false)));
+ edit_items.push_back (MenuElem (_("Bounce range to region list with processing"), bind (mem_fun(*this, &Editor::bounce_range_selection), false, true)));
+ edit_items.push_back (MenuElem (_("Export range"), mem_fun(*this, &Editor::export_range)));
}
_id = prop->value ();
}
- if ((geometry = find_named_node (node, "geometry")) == 0) {
+ g.base_width = default_width;
+ g.base_height = default_height;
+ x = 1;
+ y = 1;
+ xoff = 0;
+ yoff = 21;
- g.base_width = default_width;
- g.base_height = default_height;
- x = 1;
- y = 1;
- xoff = 0;
- yoff = 21;
+ if ((geometry = find_named_node (node, "geometry")) != 0) {
- } else {
+ XMLProperty* prop;
+
+ if ((prop = geometry->property("x_size")) == 0) {
+ prop = geometry->property ("x-size");
+ }
+ if (prop) {
+ g.base_width = atoi(prop->value());
+ }
+ if ((prop = geometry->property("y_size")) == 0) {
+ prop = geometry->property ("y-size");
+ }
+ if (prop) {
+ g.base_height = atoi(prop->value());
+ }
+
+ if ((prop = geometry->property ("x_pos")) == 0) {
+ prop = geometry->property ("x-pos");
+ }
+ if (prop) {
+ x = atoi (prop->value());
- g.base_width = atoi(geometry->property("x-size")->value());
- g.base_height = atoi(geometry->property("y-size")->value());
- x = atoi(geometry->property("x-pos")->value());
- y = atoi(geometry->property("y-pos")->value());
- xoff = atoi(geometry->property("x-off")->value());
- yoff = atoi(geometry->property("y-off")->value());
+ }
+ if ((prop = geometry->property ("y_pos")) == 0) {
+ prop = geometry->property ("y-pos");
+ }
+ if (prop) {
+ y = atoi (prop->value());
+ }
+
+ if ((prop = geometry->property ("x_off")) == 0) {
+ prop = geometry->property ("x-off");
+ }
+ if (prop) {
+ xoff = atoi (prop->value());
+ }
+ if ((prop = geometry->property ("y_off")) == 0) {
+ prop = geometry->property ("y-off");
+ }
+ if (prop) {
+ yoff = atoi (prop->value());
+ }
}
set_default_size (g.base_width, g.base_height);
set_mouse_mode (MouseObject, true);
}
- if ((prop = node.property ("show-waveforms"))) {
- bool yn = (prop->value() == "yes");
- _show_waveforms = !yn;
- 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 */
- tact->set_active (!yn);
- tact->set_active (yn);
- }
- }
-
if ((prop = node.property ("show-waveforms-recording"))) {
bool yn = (prop->value() == "yes");
_show_waveforms_recording = !yn;
snprintf (buf, sizeof (buf), "%" PRIi64, playhead_cursor->current_frame);
node->add_property ("playhead", buf);
- node->add_property ("show-waveforms", _show_waveforms ? "yes" : "no");
node->add_property ("show-waveforms-recording", _show_waveforms_recording ? "yes" : "no");
node->add_property ("show-measures", _show_measures ? "yes" : "no");
node->add_property ("follow-playhead", _follow_playhead ? "yes" : "no");
-TimeAxisView *
+/** @param y y offset from the top of all trackviews.
+ * @return pair: TimeAxisView that y is over, layer index.
+ * TimeAxisView may be 0. Layer index is the layer number if the TimeAxisView is valid and is
+ * in stacked region display mode, otherwise 0.
+ */
+std::pair<TimeAxisView *, layer_t>
Editor::trackview_by_y_position (double y)
{
for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) {
- TimeAxisView *tv;
-
- if ((tv = (*iter)->covers_y_position (y)) != 0) {
- return tv;
+ std::pair<TimeAxisView*, int> const r = (*iter)->covers_y_position (y);
+ if (r.first) {
+ return r;
}
}
- return 0;
+ return std::make_pair ( (TimeAxisView *) 0, 0);
}
void
break;
case SnapToSMPTEFrame:
- if (((direction == 0) && (fmod((double)start, (double)session->frames_per_smpte_frame()) > (session->frames_per_smpte_frame() / 2))) || (direction > 0)) {
+ if (((direction == 0) && (fmod((double)start, (double)session->frames_per_smpte_frame()) > (session->frames_per_smpte_frame() / 2))) || (direction > 0)) {
start = (nframes64_t) (ceil ((double) start / session->frames_per_smpte_frame()) * session->frames_per_smpte_frame());
} else {
start = (nframes64_t) (floor ((double) start / session->frames_per_smpte_frame()) * session->frames_per_smpte_frame());
{
string pixmap_path;
-#ifdef GTKOSX
- const guint32 FUDGE = 38; // Combo's are stupid - they steal space from the entry for the button
-#else
- const guint32 FUDGE = 18; // Combo's are stupid - they steal space from the entry for the button
-#endif
-
/* Mode Buttons (tool selection) */
vector<ToggleButton *> mouse_mode_buttons;
vector<string> edit_mode_strings;
edit_mode_strings.push_back (edit_mode_to_string (Slide));
- edit_mode_strings.push_back (edit_mode_to_string (Splice));
+ if (!Profile->get_sae()) {
+ edit_mode_strings.push_back (edit_mode_to_string (Splice));
+ }
edit_mode_strings.push_back (edit_mode_to_string (Lock));
edit_mode_selector.set_name ("EditModeSelector");
- Gtkmm2ext::set_size_request_to_display_given_text (edit_mode_selector, longest (edit_mode_strings).c_str(), 2+FUDGE, 10);
- set_popdown_strings (edit_mode_selector, edit_mode_strings);
+ set_popdown_strings (edit_mode_selector, edit_mode_strings, true);
edit_mode_selector.signal_changed().connect (mem_fun(*this, &Editor::edit_mode_selection_done));
mode_box->pack_start(edit_mode_selector);
mouse_mode_tearoff = manage (new TearOff (*mode_box));
mouse_mode_tearoff->set_name ("MouseModeBase");
+ if (Profile->get_sae()) {
+ mouse_mode_tearoff->set_can_be_torn_off (false);
+ }
+
mouse_mode_tearoff->Detach.connect (bind (mem_fun(*this, &Editor::detach_tearoff), static_cast<Box*>(&toolbar_hbox),
&mouse_mode_tearoff->tearoff_window()));
mouse_mode_tearoff->Attach.connect (bind (mem_fun(*this, &Editor::reattach_tearoff), static_cast<Box*> (&toolbar_hbox),
ARDOUR_UI::instance()->tooltips().set_tip (zoom_out_full_button, _("Zoom to Session"));
zoom_focus_selector.set_name ("ZoomFocusSelector");
- Gtkmm2ext::set_size_request_to_display_given_text (zoom_focus_selector, _("Playhead"), FUDGE, 0);
- set_popdown_strings (zoom_focus_selector, zoom_focus_strings);
+ set_popdown_strings (zoom_focus_selector, zoom_focus_strings, true);
zoom_focus_selector.signal_changed().connect (mem_fun(*this, &Editor::zoom_focus_selection_done));
ARDOUR_UI::instance()->tooltips().set_tip (zoom_focus_selector, _("Zoom focus"));
- zoom_box.pack_start (zoom_focus_selector, true, true);
zoom_box.pack_start (zoom_out_button, false, false);
zoom_box.pack_start (zoom_in_button, false, false);
zoom_box.pack_start (zoom_out_full_button, false, false);
+ HBox* zbc = manage (new HBox);
+ zbc->pack_start (zoom_focus_selector, PACK_SHRINK);
+ zoom_vbox.pack_start (*zbc, PACK_SHRINK);
+ zoom_vbox.pack_start (zoom_box, PACK_SHRINK);
+
snap_box.set_spacing (1);
snap_box.set_border_width (2);
snap_type_selector.set_name ("SnapTypeSelector");
- Gtkmm2ext::set_size_request_to_display_given_text (snap_type_selector, _("SMPTE Seconds"), 2+FUDGE, 10);
- set_popdown_strings (snap_type_selector, snap_type_strings);
+ set_popdown_strings (snap_type_selector, snap_type_strings, true);
snap_type_selector.signal_changed().connect (mem_fun(*this, &Editor::snap_type_selection_done));
ARDOUR_UI::instance()->tooltips().set_tip (snap_type_selector, _("Snap/Grid Units"));
snap_mode_selector.set_name ("SnapModeSelector");
- Gtkmm2ext::set_size_request_to_display_given_text (snap_mode_selector, _("Magnetic Snap"), 2+FUDGE, 10);
- set_popdown_strings (snap_mode_selector, snap_mode_strings);
+ set_popdown_strings (snap_mode_selector, snap_mode_strings, true);
snap_mode_selector.signal_changed().connect (mem_fun(*this, &Editor::snap_mode_selection_done));
ARDOUR_UI::instance()->tooltips().set_tip (snap_mode_selector, _("Snap/Grid Mode"));
- edit_point_selector.set_name ("SnapModeSelector");
- Gtkmm2ext::set_size_request_to_display_given_text (edit_point_selector, _("Playhead"), 2+FUDGE, 10);
- set_popdown_strings (edit_point_selector, edit_point_strings);
+ edit_point_selector.set_name ("EditPointSelector");
+ set_popdown_strings (edit_point_selector, edit_point_strings, true);
edit_point_selector.signal_changed().connect (mem_fun(*this, &Editor::edit_point_selection_done));
ARDOUR_UI::instance()->tooltips().set_tip (edit_point_selector, _("Edit point"));
tools_tearoff = manage (new TearOff (*hbox));
tools_tearoff->set_name ("MouseModeBase");
+ if (Profile->get_sae()) {
+ tools_tearoff->set_can_be_torn_off (false);
+ }
+
tools_tearoff->Detach.connect (bind (mem_fun(*this, &Editor::detach_tearoff), static_cast<Box*>(&toolbar_hbox),
&tools_tearoff->tearoff_window()));
tools_tearoff->Attach.connect (bind (mem_fun(*this, &Editor::reattach_tearoff), static_cast<Box*> (&toolbar_hbox),
}
void
-Editor::midi_panic_toggle ()
+Editor::midi_panic_button_pressed ()
{
if (session) {
session->midi_panic();
- midi_panic_button.set_active (false);
- midi_panic_button.set_state (STATE_NORMAL);
}
}
midi_tool_button_box.pack_start(midi_tool_pencil_button, true, true);
midi_tool_button_box.pack_start(midi_tool_select_button, true, true);
midi_tool_button_box.pack_start(midi_tool_resize_button, true, true);
- midi_tool_button_box.pack_start(midi_tool_erase_button, true, true);
+ midi_tool_button_box.pack_start(midi_tool_erase_button , true, true);
midi_tool_button_box.set_homogeneous(true);
midi_tool_pencil_button.set_name ("MouseModeButton");
midi_tool_select_button.set_name ("MouseModeButton");
midi_tool_resize_button.set_name ("MouseModeButton");
- midi_tool_erase_button.set_name ("MouseModeButton");
+ midi_tool_erase_button .set_name ("MouseModeButton");
ARDOUR_UI::instance()->tooltips().set_tip (midi_tool_pencil_button, _("Add/Move/Stretch Notes"));
ARDOUR_UI::instance()->tooltips().set_tip (midi_tool_select_button, _("Select/Move Notes"));
ARDOUR_UI::instance()->tooltips().set_tip (midi_tool_resize_button, _("Resize Notes"));
- ARDOUR_UI::instance()->tooltips().set_tip (midi_tool_erase_button, _("Erase Notes"));
+ ARDOUR_UI::instance()->tooltips().set_tip (midi_tool_erase_button, _("Erase Notes"));
midi_tool_pencil_button.unset_flags (CAN_FOCUS);
midi_tool_select_button.unset_flags (CAN_FOCUS);
midi_tool_erase_button.signal_toggled().connect (bind (mem_fun(*this,
&Editor::midi_edit_mode_toggled), Editing::MidiEditErase));
+
+ /* Midi sound notes */
+ midi_sound_notes.add (*(manage (new Image (::get_icon("midi_sound_notes")))));
+ midi_sound_notes.set_relief(Gtk::RELIEF_NONE);
+ ARDOUR_UI::instance()->tooltips().set_tip (midi_sound_notes, _("Sound Notes"));
+ midi_sound_notes.unset_flags (CAN_FOCUS);
+
/* Panic */
- VBox* panic_box = manage (new VBox);
+ HBox* panic_box = manage (new HBox);
midi_panic_button.set_name("MidiPanicButton");
midi_panic_button.signal_pressed().connect (
- mem_fun(this, &Editor::midi_panic_toggle));
+ mem_fun(this, &Editor::midi_panic_button_pressed));
+ panic_box->pack_start (midi_sound_notes , true, true);
panic_box->pack_start (midi_panic_button, true, true);
/* Pack everything in... */
}
int
-Editor::convert_drop_to_paths (vector<ustring>& paths,
- const RefPtr<Gdk::DragContext>& context,
- gint x,
- gint y,
- const SelectionData& data,
- guint info,
- guint time)
-
+Editor::convert_drop_to_paths (
+ vector<ustring>& paths,
+ const RefPtr<Gdk::DragContext>& context,
+ gint x,
+ gint y,
+ const SelectionData& data,
+ guint info,
+ guint time)
{
if (session == 0) {
return -1;
}
/* Parse the "uri-list" format that Nautilus provides,
- where each pathname is delimited by \r\n
+ where each pathname is delimited by \r\n.
+
+ THERE MAY BE NO NULL TERMINATING CHAR!!!
*/
-
- const char* p = data.get_text().c_str();
+
+ ustring txt = data.get_text();
+ const char* p;
const char* q;
+ p = (const char *) malloc (txt.length() + 1);
+ txt.copy ((char *) p, txt.length(), 0);
+ ((char*)p)[txt.length()] = '\0';
+
while (p)
{
if (*p != '#')
p++;
q = p;
- while (*q && (*q != '\n') && (*q != '\r'))
+ while (*q && (*q != '\n') && (*q != '\r')) {
q++;
+ }
if (q > p)
{
p++;
}
+ free ((void*)p);
+
if (uris.empty()) {
return -1;
}
if ((*i).substr (0,7) == "file://") {
ustring p = *i;
- PBD::url_decode (p);
+ PBD::url_decode (p);
// scan forward past three slashes
delete selection;
}
-UndoAction
-Editor::get_memento () const
-{
- State *state = new State (this);
-
- store_state (*state);
- return bind (mem_fun (*(const_cast<Editor*>(this)), &Editor::restore_state), state);
-}
-
void
Editor::store_state (State& state) const
{
*selection = *state->selection;
time_selection_changed ();
- region_selection_changed ();
+ region_selection_changed ();
/* XXX other selection change handlers? */
}
Editor::begin_reversible_command (string name)
{
if (session) {
- before = &get_state();
+ before = &get_state();
session->begin_reversible_command (name);
}
}
if (x < 0) {
x = 0;
} else {
- x = min (canvas_width - 200.0, x);
+ x = min (_canvas_width - 200.0, x);
}
return x;
}
if (y < canvas_timebars_vsize) {
y = canvas_timebars_vsize;
} else {
- y = min (canvas_height - 50, y);
+ y = min (_canvas_height - 50, y);
}
return y;
}
{
switch (Config->get_edit_mode()) {
case Slide:
- Config->set_edit_mode (Splice);
+ if (Profile->get_sae()) {
+ Config->set_edit_mode (Lock);
+ } else {
+ Config->set_edit_mode (Splice);
+ }
break;
case Splice:
Config->set_edit_mode (Lock);
static int32_t done;
XMLNode* geometry;
- if ((geometry = find_named_node (*node, "geometry")) == 0) {
- width = default_width;
- height = default_height;
- } else {
- width = atoi(geometry->property("x-size")->value());
- height = atoi(geometry->property("y-size")->value());
+ width = default_width;
+ height = default_height;
+
+ if ((geometry = find_named_node (*node, "geometry")) != 0) {
+
+ if ((prop = geometry->property ("x_size")) == 0) {
+ prop = geometry->property ("x-size");
+ }
+ if (prop) {
+ width = atoi (prop->value());
+ }
+ if ((prop = geometry->property ("y_size")) == 0) {
+ prop = geometry->property ("y-size");
+ }
+ if (prop) {
+ height = atoi (prop->value());
+ }
}
if (which == static_cast<Paned*> (&edit_pane)) {
prompter.get_result (new_name);
if (new_name.length()) {
session->rename_state (old_name, new_name);
- redisplay_snapshots ();
+ redisplay_snapshots ();
}
}
}
queue_visual_change (frame);
}
+void
+Editor::reset_y_origin (double y)
+{
+ queue_visual_change_y (y);
+}
+
void
Editor::reset_zoom (double fpu)
{
set_zoom_focus (vs.zoom_focus);
reposition_and_zoom (vs.leftmost_frame, vs.frames_per_unit);
+ zoomed_to_region = vs.zoomed_to_region;
for (list<TAVState>::iterator i = vs.track_states.begin(); i != vs.track_states.end(); ++i) {
TrackViewList::iterator t;
void
Editor::post_zoom ()
{
+ nframes64_t cef = 0;
+
// convert fpu to frame count
- nframes64_t frames = (nframes64_t) floor (frames_per_unit * canvas_width);
+ nframes64_t frames = (nframes64_t) floor (frames_per_unit * _canvas_width);
if (frames_per_unit != zoom_range_clock.current_duration()) {
zoom_range_clock.set (frames);
}
}
+ leftmost_frame = (nframes64_t) floor (horizontal_adjustment.get_value() * frames_per_unit);
+
ZoomChanged (); /* EMIT_SIGNAL */
reset_hscrollbar_stepping ();
+
+ if (session) {
+ cef = session->current_end_frame() + (current_page_frames() / 10);// Add a little extra so we can see the end marker
+ }
+ horizontal_adjustment.set_upper (cef / frames_per_unit);
+
//reset_scrolling_region ();
if (playhead_cursor) {
playhead_cursor->set_position (playhead_cursor->current_frame);
}
+ _summary->set_overlays_dirty ();
+
instant_save ();
}
void
Editor::queue_visual_change (nframes64_t where)
{
-// pending_visual_change.pending = VisualChange::Type (pending_visual_change.pending | VisualChange::TimeOrigin);
-// pending_visual_change.time_origin = where;
-
- if (pending_visual_change.idle_handler_id < 0) {
- pending_visual_change.pending = VisualChange::Type (pending_visual_change.pending | VisualChange::TimeOrigin);
- pending_visual_change.time_origin = where;
- pending_visual_change.idle_handler_id = g_idle_add (_idle_visual_changer, this);
+ pending_visual_change.add (VisualChange::TimeOrigin);
+
+ /* if we're moving beyond the end, make sure the upper limit of the horizontal adjustment
+ can reach.
+ */
+
+ if (where > session->current_end_frame()) {
+ horizontal_adjustment.set_upper ((where + current_page_frames()) / frames_per_unit);
}
+
+ pending_visual_change.time_origin = where;
+
+ ensure_visual_change_idle_handler ();
}
void
Editor::queue_visual_change (double fpu)
{
- pending_visual_change.pending = VisualChange::Type (pending_visual_change.pending | VisualChange::ZoomLevel);
+ pending_visual_change.add (VisualChange::ZoomLevel);
pending_visual_change.frames_per_unit = fpu;
+ ensure_visual_change_idle_handler ();
+
+}
+
+void
+Editor::queue_visual_change_y (double y)
+{
+ pending_visual_change.add (VisualChange::YOrigin);
+ pending_visual_change.y_origin = y;
+
+ ensure_visual_change_idle_handler ();
+}
+
+void
+Editor::ensure_visual_change_idle_handler ()
+{
if (pending_visual_change.idle_handler_id < 0) {
- pending_visual_change.idle_handler_id = g_idle_add ( _idle_visual_changer, this);
+ pending_visual_change.idle_handler_id = g_idle_add (_idle_visual_changer, this);
}
-
}
int
VisualChange::Type p = pending_visual_change.pending;
pending_visual_change.pending = (VisualChange::Type) 0;
+#ifdef FIX_THIS_FOR_V3
+ double last_time_origin = horizontal_adjustment.get_value();
+#endif
+
if (p & VisualChange::ZoomLevel) {
set_frames_per_unit (pending_visual_change.frames_per_unit);
update_tempo_based_rulers ();
}
if (p & VisualChange::TimeOrigin) {
+ horizontal_adjustment.set_value (pending_visual_change.time_origin / frames_per_unit);
+ }
+ if (p & VisualChange::YOrigin) {
+ vertical_adjustment.set_value (pending_visual_change.y_origin);
+ }
+
+ nframes64_t csf=0, cef=0;
+ nframes64_t current_time_origin = (nframes64_t) floor (horizontal_adjustment.get_value() * frames_per_unit);
+
+ if (session) {
+ csf = session->current_start_frame();
+ cef = session->current_end_frame();
+ }
+
+ /* if we seek beyond the current end of the canvas, move the end */
- nframes64_t csf=0, cef=0;
- nframes64_t current_time_origin = (nframes64_t) floor (horizontal_adjustment.get_value() * frames_per_unit);
-
- if (session) {
- csf = session->current_start_frame();
- cef = session->current_end_frame();
- }
-
- /* if we seek beyond the current end of the canvas, move the end */
-
- if (current_time_origin != pending_visual_change.time_origin) {
- cef += current_page_frames() / 10; // Add a little extra so we can see the end marker
- horizontal_adjustment.set_upper (cef / frames_per_unit);
- horizontal_adjustment.set_value (pending_visual_change.time_origin / frames_per_unit);
- } else {
- update_fixed_rulers();
- redisplay_tempo (true);
- }
+#ifdef FIX_THIS_FOR_V3
+ if (last_time_origin == horizontal_adjustment.get_value() ) {
+ /* changed signal not emitted */
+ update_fixed_rulers ();
+ redisplay_tempo (true);
}
+#endif
+
+ if (current_time_origin != pending_visual_change.time_origin) {
+ cef += current_page_frames() / 10; // Add a little extra so we can see the end marker
+ horizontal_adjustment.set_upper (cef / frames_per_unit);
+ horizontal_adjustment.set_value (pending_visual_change.time_origin / frames_per_unit);
+ } else {
+ update_fixed_rulers();
+ redisplay_tempo (true);
+ }
+
+ _summary->set_overlays_dirty ();
+
//cerr << "Editor::idle_visual_changer () called ha v:l:u:ps:fpu = " << horizontal_adjustment.get_value() << ":" << horizontal_adjustment.get_lower() << ":" << horizontal_adjustment.get_upper() << ":" << horizontal_adjustment.get_page_size() << ":" << frames_per_unit << endl;//DEBUG
pending_visual_change.idle_handler_id = -1;
return 0; /* this is always a one-shot call */
struct EditorOrderTimeAxisSorter {
bool operator() (const TimeAxisView* a, const TimeAxisView* b) const {
- return a->order < b->order;
+ return a->order () < b->order ();
}
};
if ((tll = transport_loop_location()) == 0) {
Location* loc = new Location (start, end, _("Loop"), Location::IsAutoLoop);
- XMLNode &before = session->locations()->get_state();
+ XMLNode &before = session->locations()->get_state();
session->locations()->add (loc, true);
session->set_auto_loop_location (loc);
- XMLNode &after = session->locations()->get_state();
+ XMLNode &after = session->locations()->get_state();
session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
} else {
- XMLNode &before = tll->get_state();
+ XMLNode &before = tll->get_state();
tll->set_hidden (false, this);
tll->set (start, end);
- XMLNode &after = tll->get_state();
- session->add_command (new MementoCommand<Location>(*tll, &before, &after));
+ XMLNode &after = tll->get_state();
+ session->add_command (new MementoCommand<Location>(*tll, &before, &after));
}
commit_reversible_command ();
if ((tpl = transport_punch_location()) == 0) {
Location* loc = new Location (start, end, _("Loop"), Location::IsAutoPunch);
- XMLNode &before = session->locations()->get_state();
+ XMLNode &before = session->locations()->get_state();
session->locations()->add (loc, true);
session->set_auto_loop_location (loc);
- XMLNode &after = session->locations()->get_state();
+ XMLNode &after = session->locations()->get_state();
session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
}
else {
- XMLNode &before = tpl->get_state();
+ XMLNode &before = tpl->get_state();
tpl->set_hidden (false, this);
tpl->set (start, end);
- XMLNode &after = tpl->get_state();
- session->add_command (new MementoCommand<Location>(*tpl, &before, &after));
+ XMLNode &after = tpl->get_state();
+ session->add_command (new MementoCommand<Location>(*tpl, &before, &after));
}
commit_reversible_command ();
}
for (TrackSelection::const_iterator t = tracks->begin(); t != tracks->end(); ++t) {
-
- AudioTimeAxisView* atv = dynamic_cast<AudioTimeAxisView*>(*t);
-
- if (atv) {
+ RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(*t);
+ if (rtv) {
boost::shared_ptr<Diskstream> ds;
boost::shared_ptr<Playlist> pl;
- if ((ds = atv->get_diskstream()) && ((pl = ds->playlist()))) {
+ if ((ds = rtv->get_diskstream()) && ((pl = ds->playlist()))) {
- Playlist::RegionList* regions = pl->regions_at ((nframes64_t) floor ( (double)where * ds->speed()));
+ Playlist::RegionList* regions = pl->regions_at (
+ (nframes64_t) floor ( (double)where * ds->speed()));
for (Playlist::RegionList::iterator i = regions->begin(); i != regions->end(); ++i) {
-
- RegionView* rv = atv->audio_view()->find_view (*i);
-
+ RegionView* rv = rtv->view()->find_view (*i);
if (rv) {
rs.add (rv);
}
}
for (TrackSelection::const_iterator t = tracks->begin(); t != tracks->end(); ++t) {
-
- AudioTimeAxisView* atv = dynamic_cast<AudioTimeAxisView*>(*t);
-
- if (atv) {
+ RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(*t);
+ if (rtv) {
boost::shared_ptr<Diskstream> ds;
boost::shared_ptr<Playlist> pl;
- if ((ds = atv->get_diskstream()) && ((pl = ds->playlist()))) {
+ if ((ds = rtv->get_diskstream()) && ((pl = ds->playlist()))) {
- Playlist::RegionList* regions = pl->regions_touched ((nframes64_t) floor ( (double)where * ds->speed()), max_frames);
+ Playlist::RegionList* regions = pl->regions_touched (
+ (nframes64_t) floor ( (double)where * ds->speed()), max_frames);
for (Playlist::RegionList::iterator i = regions->begin(); i != regions->end(); ++i) {
- RegionView* rv = atv->audio_view()->find_view (*i);
+ RegionView* rv = rtv->view()->find_view (*i);
if (rv) {
rs.push_back (rv);
rhythm_ferret->present ();
}
+void
+Editor::show_bundle_manager ()
+{
+ if (_bundle_manager == 0) {
+ _bundle_manager = new BundleManager (*session);
+ }
+
+ _bundle_manager->show ();
+}
+
+void
+Editor::show_global_port_matrix (ARDOUR::DataType t)
+{
+ if (_global_port_matrix[t] == 0) {
+ _global_port_matrix[t] = new GlobalPortMatrixWindow (*session, t);
+ }
+
+ _global_port_matrix[t]->show ();
+}
+
void
Editor::first_idle ()
{
for (TrackViewList::iterator t = track_views.begin(); t != track_views.end(); ++t) {
(*t)->first_idle();
}
+
+ // first idle adds route children (automation tracks), so we need to redisplay here
+ redisplay_route_list();
- if (dialog) {
- delete dialog;
- }
+ delete dialog;
_have_idled = true;
}
-void
-Editor::start_resize_line_ops ()
+static gboolean
+_idle_resizer (gpointer arg)
{
-#if 0
- old_resize_line_y = -1;
- resize_line_y = -1;
- need_resize_line = true;
-#endif
+ return ((Editor*)arg)->idle_resize ();
}
void
-Editor::end_resize_line_ops ()
+Editor::add_to_idle_resize (TimeAxisView* view, int32_t h)
{
-#if 0
- need_resize_line = false;
-
- if (old_resize_line_y >= 0) {
- Gdk::Rectangle r (0, old_resize_line_y, (int) canvas_width, 3);
- Glib::RefPtr<Gdk::Window> win = get_window();
- cerr << "Final invalidation at " << old_resize_line_y << endl;
- win->invalidate_rect (r, false);
+ if (resize_idle_id < 0) {
+ resize_idle_id = g_idle_add (_idle_resizer, this);
+ _pending_resize_amount = 0;
}
-#endif
-}
-void
-Editor::queue_draw_resize_line (int at)
-{
-#if 0
- Glib::RefPtr<Gdk::Window> win = get_window();
+ /* make a note of the smallest resulting height, so that we can clamp the
+ lower limit at TimeAxisView::hSmall */
- resize_line_y = at;
+ int32_t min_resulting = INT32_MAX;
- if (win && canvas_width) {
+ _pending_resize_amount += h;
+ _pending_resize_view = view;
- int controls_width = controls_layout.get_width();
- int xroot, discard;
-
- controls_layout.get_window()->get_origin (xroot, discard);
+ min_resulting = min (min_resulting, int32_t (_pending_resize_view->current_height()) + _pending_resize_amount);
- if (old_resize_line_y >= 0) {
-
- /* redraw where it used to be */
-
-
- Gdk::Rectangle r (0, old_resize_line_y - 1, controls_width + (int) canvas_width, 3);
- win->invalidate_rect (r, true);
- cerr << "invalidate " << xroot << "," << old_resize_line_y - 1 << ' '
- << controls_width + canvas_width << " x 3\n";
- }
+ for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
+ min_resulting = min (min_resulting, int32_t ((*i)->current_height()) + _pending_resize_amount);
+ }
- /* draw where it is */
+ if (min_resulting < 0) {
+ min_resulting = 0;
+ }
- Gdk::Rectangle r (0, at - 1, controls_width + (int) canvas_width, 3);
- win->invalidate_rect (r, true);
+ /* clamp */
+ if (uint32_t (min_resulting) < TimeAxisView::hSmall) {
+ _pending_resize_amount += TimeAxisView::hSmall - min_resulting;
}
-#endif
}
+/** Handle pending resizing of tracks */
bool
-Editor::on_expose_event (GdkEventExpose* ev)
-{
- /* cerr << "+++ editor expose "
- << ev->area.x << ',' << ev->area.y
- << ' '
- << ev->area.width << " x " << ev->area.height
- << " need reize ? " << need_resize_line
- << endl;
- */
- bool ret = Window::on_expose_event (ev);
-
-#if 0
- if (need_resize_line) {
-
- int xroot, yroot, discard;
- int controls_width;
-
- /* Our root coordinates for drawing the line will be the left edge
- of the track controls, and the upper left edge of our own window.
- */
-
- get_window()->get_origin (discard, yroot);
- controls_layout.get_window()->get_origin (xroot, discard);
- controls_width = controls_layout.get_width();
-
- GdkRectangle lr;
- GdkRectangle intersection;
-
- lr.x = 0;
- lr.y = resize_line_y;
- lr.width = controls_width + (int) canvas_width;
- lr.height = 3;
-
- if (gdk_rectangle_intersect (&lr, &ev->area, &intersection)) {
-
- Glib::RefPtr<Gtk::Style> style (get_style());
- Glib::RefPtr<Gdk::GC> black_gc (style->get_black_gc ());
- Glib::RefPtr<Gdk::GC> gc = wrap (black_gc->gobj_copy(), false);
-
- /* draw on root window */
-
- GdkWindow* win = gdk_get_default_root_window();
-
- gc->set_subwindow (Gdk::INCLUDE_INFERIORS);
- gc->set_line_attributes (3, Gdk::LINE_SOLID,
- Gdk::CAP_NOT_LAST,
- Gdk::JOIN_MITER);
-
- gdk_draw_line (win, gc->gobj(),
- 0,
- resize_line_y,
- (int) canvas_width + controls_width,
- resize_line_y);
-#if 0
- cerr << "drew line @ " << xroot << ", " << yroot + resize_line_y
- << " to " << xroot + (int) canvas_width + controls_width
- << ", " << yroot + resize_line_y
- << endl;
-#endif
- old_resize_line_y = resize_line_y;
- cerr << "NEXT EXPOSE SHOULD BE AT " << old_resize_line_y << endl;
- } else {
- cerr << "no intersect with "
- << lr.x << ',' << lr.y
- << ' '
- << lr.width << " x " << lr.height
- << endl;
+Editor::idle_resize ()
+{
+ _pending_resize_view->idle_resize (_pending_resize_view->current_height() + _pending_resize_amount);
+ for (TrackSelection::iterator i = selection->tracks.begin(); i != selection->tracks.end(); ++i) {
+ if (*i != _pending_resize_view) {
+ (*i)->idle_resize ((*i)->current_height() + _pending_resize_amount);
}
+
}
-
- //cerr << "--- editor expose\n";
-#endif
-
- return ret;
+ flush_canvas ();
+ resize_idle_id = -1;
+ return false;
}
-static gboolean
-_idle_resizer (gpointer arg)
+void
+Editor::located ()
{
- return ((Editor*)arg)->idle_resize ();
+ ENSURE_GUI_THREAD (mem_fun (*this, &Editor::located));
+
+ _pending_locate_request = false;
}
void
-Editor::add_to_idle_resize (TimeAxisView* view, uint32_t h)
+Editor::region_view_added (RegionView *)
{
- if (resize_idle_id < 0) {
- resize_idle_id = g_idle_add (_idle_resizer, this);
- }
-
- resize_idle_target = h;
-
- pending_resizes.push_back (view);
-
- if (selection->selected (view) && !selection->tracks.empty()) {
- pending_resizes.insert (pending_resizes.end(), selection->tracks.begin(), selection->tracks.end());
- }
+ _summary->set_dirty ();
}
-bool
-Editor::idle_resize ()
+void
+Editor::streamview_height_changed ()
{
- for (vector<TimeAxisView*>::iterator i = pending_resizes.begin(); i != pending_resizes.end(); ++i) {
- (*i)->idle_resize (resize_idle_target);
- }
- pending_resizes.clear();
- resize_idle_id = -1;
- return false;
+ _summary->set_dirty ();
}