summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2008-01-12 03:56:43 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2008-01-12 03:56:43 +0000
commit51c333a7b3abe11dbe5c20234d92eb1ff16a30bb (patch)
tree0b4e8cf6ea570db44250151e1345714ecd790b03
parent11faee330755fea81e051d064ca2d345db9eaf42 (diff)
more NSD madness curing; fix up canvas range rects and marker line height mgmt
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2902 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/ardour_ui.cc11
-rw-r--r--gtk2_ardour/editor.cc13
-rw-r--r--gtk2_ardour/editor_canvas.cc56
-rw-r--r--gtk2_ardour/editor_markers.cc2
-rw-r--r--gtk2_ardour/marker.cc37
-rw-r--r--gtk2_ardour/marker.h4
-rw-r--r--gtk2_ardour/new_session_dialog.cc9
7 files changed, 82 insertions, 50 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index 1367204b65..9e496afad9 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -2067,6 +2067,8 @@ ARDOUR_UI::get_session_parameters (Glib::ustring predetermined_path, bool have_e
session_name = basename_nosuffix (string (predetermined_path));
+ cerr << "set name to " << session_name << " path to " << session_path << endl;
+
new_session_dialog->set_session_name (session_name);
new_session_dialog->set_session_folder (session_path);
new_session_dialog->set_modal (true);
@@ -2227,6 +2229,9 @@ ARDOUR_UI::get_session_parameters (Glib::ustring predetermined_path, bool have_e
if (session_name[0] == '/' ||
(session_name.length() > 2 && session_name[0] == '.' && session_name[1] == '/') ||
(session_name.length() > 3 && session_name[0] == '.' && session_name[1] == '.' && session_name[2] == '/')) {
+
+ cerr << "A\n";
+
if (load_session (Glib::path_get_dirname (session_name), session_name)) {
response = Gtk::RESPONSE_NONE;
goto try_again;
@@ -2234,6 +2239,7 @@ ARDOUR_UI::get_session_parameters (Glib::ustring predetermined_path, bool have_e
} else {
session_path = new_session_dialog->session_folder();
+ cerr << "B\n";
if (load_session (session_path, session_name)) {
response = Gtk::RESPONSE_NONE;
goto try_again;
@@ -2271,6 +2277,7 @@ ARDOUR_UI::get_session_parameters (Glib::ustring predetermined_path, bool have_e
if (!should_be_new) {
+ cerr << "C\n";
if (load_session (session_path, session_name)) {
response = Gtk::RESPONSE_NONE;
goto try_again;
@@ -2298,6 +2305,7 @@ ARDOUR_UI::get_session_parameters (Glib::ustring predetermined_path, bool have_e
new_session_dialog->hide ();
goto_editor_window ();
flush_pending ();
+ cerr << "D\n";
if (load_session (session_path, session_name)) {
response = Gtk::RESPONSE_NONE;
goto try_again;
@@ -2323,6 +2331,7 @@ ARDOUR_UI::get_session_parameters (Glib::ustring predetermined_path, bool have_e
goto_editor_window ();
flush_pending ();
+ cerr << "F\n";
if (load_session (session_path, session_name, template_name)) {
response = Gtk::RESPONSE_NONE;
goto try_again;
@@ -2443,6 +2452,8 @@ ARDOUR_UI::load_session (const Glib::ustring& path, const Glib::ustring& snap_na
int unload_status;
int retval = -1;
+ cerr << "load session with path = " << path << " name = " << snap_name << endl;
+
session_loaded = false;
if (!check_audioengine()) {
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index ff49af5c61..3056ebb8e0 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -873,19 +873,6 @@ Editor::show_window ()
}
void
-Editor::tie_vertical_scrolling ()
-{
- double y1 = vertical_adjustment.get_value();
-
- playhead_cursor->set_y_axis (y1);
- if (logo_item) {
- logo_item->property_y() = y1;
- }
-
- controls_layout.get_vadjustment()->set_value (y1);
-}
-
-void
Editor::instant_save ()
{
if (!constructed || !ARDOUR_UI::instance()->session_loaded) {
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc
index 4e8858b84c..c89c196a88 100644
--- a/gtk2_ardour/editor_canvas.cc
+++ b/gtk2_ardour/editor_canvas.cc
@@ -317,25 +317,27 @@ Editor::track_canvas_size_allocated ()
reset_scrolling_region ();
if (playhead_cursor) playhead_cursor->set_length (canvas_height);
+
+ double y1 = vertical_adjustment.get_value ();
for (MarkerSelection::iterator x = selection->markers.begin(); x != selection->markers.end(); ++x) {
- (*x)->set_line_length (full_canvas_height);
+ (*x)->set_line_vpos (y1, canvas_height);
}
- range_marker_drag_rect->property_y2() = full_canvas_height;
- transport_loop_range_rect->property_y2() = full_canvas_height;
- transport_punch_range_rect->property_y2() = full_canvas_height;
- transport_punchin_line->property_y2() = full_canvas_height;
- transport_punchout_line->property_y2() = full_canvas_height;
+ range_marker_drag_rect->property_y1() = y1;
+ range_marker_drag_rect->property_y2() = y1 + canvas_height;
+ transport_loop_range_rect->property_y1() = y1;
+ transport_loop_range_rect->property_y2() = y1 + canvas_height;
+ transport_punch_range_rect->property_y1() = y1;
+ transport_punch_range_rect->property_y2() = y1 + canvas_height;
+ transport_punchin_line->property_y1() = y1;
+ transport_punchin_line->property_y2() = y1 + canvas_height;
+ transport_punchout_line->property_y1() = y1;
+ transport_punchout_line->property_y2() = y1 + canvas_height;
update_fixed_rulers();
redisplay_tempo (true);
- if (logo_item) {
- // logo_item->property_height() = full_canvas_height;
- // logo_item->property_width() = canvas_width;
- }
-
Resized (); /* EMIT_SIGNAL */
return false;
@@ -682,6 +684,38 @@ Editor::left_track_canvas (GdkEventCrossing *ev)
return FALSE;
}
+void
+Editor::tie_vertical_scrolling ()
+{
+ double y1 = vertical_adjustment.get_value();
+
+ playhead_cursor->set_y_axis (y1);
+
+ range_marker_drag_rect->property_y1() = y1;
+ range_marker_drag_rect->property_y2() = y1 + canvas_height;
+ transport_loop_range_rect->property_y1() = y1;
+ transport_loop_range_rect->property_y2() = y1 + canvas_height;
+ transport_punch_range_rect->property_y1() = y1;
+ transport_punch_range_rect->property_y2() = y1 + canvas_height;
+ transport_punchin_line->property_y1() = y1;
+ transport_punchin_line->property_y2() = y1 + canvas_height;
+ transport_punchout_line->property_y1() = y1;
+ transport_punchout_line->property_y2() = y1 + canvas_height;
+
+ if (!selection->markers.empty()) {
+ for (MarkerSelection::iterator x = selection->markers.begin(); x != selection->markers.end(); ++x) {
+ (*x)->set_line_vpos (y1, canvas_height);
+ }
+ }
+
+ if (logo_item) {
+ logo_item->property_y() = y1;
+ }
+
+ /* this will do an immediate redraw */
+
+ controls_layout.get_vadjustment()->set_value (y1);
+}
void
Editor::canvas_horizontally_scrolled ()
diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc
index ce9c94082c..c36cb5bf06 100644
--- a/gtk2_ardour/editor_markers.cc
+++ b/gtk2_ardour/editor_markers.cc
@@ -1172,7 +1172,7 @@ Editor::marker_selection_changed ()
}
for (MarkerSelection::iterator x = selection->markers.begin(); x != selection->markers.end(); ++x) {
- (*x)->add_line (cursor_group, full_canvas_height);
+ (*x)->add_line (cursor_group, canvas_height);
(*x)->show_line ();
}
diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc
index df62af90ec..7dd45499e7 100644
--- a/gtk2_ardour/marker.cc
+++ b/gtk2_ardour/marker.cc
@@ -25,6 +25,7 @@
#include "utils.h"
#include "canvas_impl.h"
#include "ardour_ui.h"
+#include "simpleline.h"
#include "i18n.h"
@@ -267,7 +268,6 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
}
line = 0;
- line_points = 0;
}
@@ -283,7 +283,6 @@ Marker::~Marker ()
if (line) {
delete line;
- delete line_points;
}
}
@@ -293,12 +292,13 @@ void Marker::reparent(ArdourCanvas::Group & parent)
_parent = &parent;
}
+
void
-Marker::set_line_length (double len)
+Marker::set_line_vpos (double pos, double height)
{
if (line) {
- line_points->back().set_y (len);
- line->property_points() = *line_points;
+ line->property_y1() = pos;
+ line->property_y2() = pos + height;
}
}
@@ -307,21 +307,13 @@ Marker::add_line (ArdourCanvas::Group* group, double initial_height)
{
if (!line) {
- line_points = new ArdourCanvas::Points ();
- line_points->push_back (Gnome::Art::Point (unit_position + shift, 0.0));
- line_points->push_back (Gnome::Art::Point (unit_position + shift, initial_height));
-
- line = new ArdourCanvas::Line (*group);
- line->property_width_pixels() = 1;
- line->property_points() = *line_points;
- line->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_EditPoint.get();
-#if 0
- line->property_first_arrowhead() = TRUE;
- line->property_last_arrowhead() = TRUE;
- line->property_arrow_shape_a() = 11.0;
- line->property_arrow_shape_b() = 0.0;
- line->property_arrow_shape_c() = 9.0;
-#endif
+ line = new ArdourCanvas::SimpleLine (*group);
+ line->property_color_rgba() = ARDOUR_UI::config()->canvasvar_EditPoint.get();
+ line->property_x1() = unit_position + shift;
+ line->property_y1() = 0.0;
+ line->property_x2() = unit_position + shift;
+ line->property_y2() = initial_height;
+
line->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_marker_event), mark, this));
}
@@ -370,9 +362,8 @@ Marker::set_position (nframes_t frame)
unit_position = new_unit_position;
if (line) {
- (*line_points)[0].set_x (unit_position + shift);
- (*line_points)[1].set_x (unit_position + shift);
- line->property_points() = *line_points;
+ line->property_x1() = unit_position + shift;
+ line->property_x2() = unit_position + shift;
}
}
diff --git a/gtk2_ardour/marker.h b/gtk2_ardour/marker.h
index fa252571fb..d494af839f 100644
--- a/gtk2_ardour/marker.h
+++ b/gtk2_ardour/marker.h
@@ -60,7 +60,7 @@ class Marker : public PBD::Destructible
void add_line (ArdourCanvas::Group*, double initial_height);
void show_line ();
void hide_line ();
- void set_line_length (double);
+ void set_line_vpos (double y_origin, double height);
void set_position (nframes_t);
void set_name (const string&);
@@ -84,7 +84,7 @@ class Marker : public PBD::Destructible
ArdourCanvas::Polygon *mark;
ArdourCanvas::Text *text;
ArdourCanvas::Points *points;
- ArdourCanvas::Line *line;
+ ArdourCanvas::SimpleLine *line;
ArdourCanvas::Points *line_points;
double unit_position;
diff --git a/gtk2_ardour/new_session_dialog.cc b/gtk2_ardour/new_session_dialog.cc
index f0df59caca..81b1aafa62 100644
--- a/gtk2_ardour/new_session_dialog.cc
+++ b/gtk2_ardour/new_session_dialog.cc
@@ -571,9 +571,11 @@ NewSessionDialog::set_session_folder(const Glib::ustring& dir)
#else
if (!Glib::file_test (dir, Glib::FILE_TEST_IS_DIR)) {
realdir = Glib::path_get_dirname (realdir);
+ cerr << "didn't exist, use " << realdir << endl;
}
if ((res = canonicalize_file_name (realdir.c_str())) != 0) {
+ cerr << "canonical, use " << res << endl;
m_folder->set_current_folder (res);
free (res);
}
@@ -623,6 +625,13 @@ NewSessionDialog::session_folder() const
case NewPage:
return Glib::filename_from_utf8(m_folder->get_filename());
+ case EnginePage:
+ if (page_set == EnginePage) {
+ /* just engine page, nothing else : use m_folder since it should be set */
+ return Glib::filename_from_utf8(m_folder->get_filename());
+ }
+ break;
+
default:
break;
}