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
This commit is contained in:
Paul Davis 2008-01-12 03:56:43 +00:00
parent 11faee3307
commit 51c333a7b3
7 changed files with 82 additions and 50 deletions

View file

@ -2067,6 +2067,8 @@ ARDOUR_UI::get_session_parameters (Glib::ustring predetermined_path, bool have_e
session_name = basename_nosuffix (string (predetermined_path)); 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_name (session_name);
new_session_dialog->set_session_folder (session_path); new_session_dialog->set_session_folder (session_path);
new_session_dialog->set_modal (true); 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] == '/' || if (session_name[0] == '/' ||
(session_name.length() > 2 && session_name[0] == '.' && session_name[1] == '/') || (session_name.length() > 2 && session_name[0] == '.' && session_name[1] == '/') ||
(session_name.length() > 3 && session_name[0] == '.' && session_name[1] == '.' && session_name[2] == '/')) { (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)) { if (load_session (Glib::path_get_dirname (session_name), session_name)) {
response = Gtk::RESPONSE_NONE; response = Gtk::RESPONSE_NONE;
goto try_again; goto try_again;
@ -2234,6 +2239,7 @@ ARDOUR_UI::get_session_parameters (Glib::ustring predetermined_path, bool have_e
} else { } else {
session_path = new_session_dialog->session_folder(); session_path = new_session_dialog->session_folder();
cerr << "B\n";
if (load_session (session_path, session_name)) { if (load_session (session_path, session_name)) {
response = Gtk::RESPONSE_NONE; response = Gtk::RESPONSE_NONE;
goto try_again; goto try_again;
@ -2271,6 +2277,7 @@ ARDOUR_UI::get_session_parameters (Glib::ustring predetermined_path, bool have_e
if (!should_be_new) { if (!should_be_new) {
cerr << "C\n";
if (load_session (session_path, session_name)) { if (load_session (session_path, session_name)) {
response = Gtk::RESPONSE_NONE; response = Gtk::RESPONSE_NONE;
goto try_again; goto try_again;
@ -2298,6 +2305,7 @@ ARDOUR_UI::get_session_parameters (Glib::ustring predetermined_path, bool have_e
new_session_dialog->hide (); new_session_dialog->hide ();
goto_editor_window (); goto_editor_window ();
flush_pending (); flush_pending ();
cerr << "D\n";
if (load_session (session_path, session_name)) { if (load_session (session_path, session_name)) {
response = Gtk::RESPONSE_NONE; response = Gtk::RESPONSE_NONE;
goto try_again; goto try_again;
@ -2323,6 +2331,7 @@ ARDOUR_UI::get_session_parameters (Glib::ustring predetermined_path, bool have_e
goto_editor_window (); goto_editor_window ();
flush_pending (); flush_pending ();
cerr << "F\n";
if (load_session (session_path, session_name, template_name)) { if (load_session (session_path, session_name, template_name)) {
response = Gtk::RESPONSE_NONE; response = Gtk::RESPONSE_NONE;
goto try_again; goto try_again;
@ -2443,6 +2452,8 @@ ARDOUR_UI::load_session (const Glib::ustring& path, const Glib::ustring& snap_na
int unload_status; int unload_status;
int retval = -1; int retval = -1;
cerr << "load session with path = " << path << " name = " << snap_name << endl;
session_loaded = false; session_loaded = false;
if (!check_audioengine()) { if (!check_audioengine()) {

View file

@ -872,19 +872,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 void
Editor::instant_save () Editor::instant_save ()
{ {

View file

@ -318,24 +318,26 @@ Editor::track_canvas_size_allocated ()
if (playhead_cursor) playhead_cursor->set_length (canvas_height); 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) { 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; range_marker_drag_rect->property_y1() = y1;
transport_loop_range_rect->property_y2() = full_canvas_height; range_marker_drag_rect->property_y2() = y1 + canvas_height;
transport_punch_range_rect->property_y2() = full_canvas_height; transport_loop_range_rect->property_y1() = y1;
transport_punchin_line->property_y2() = full_canvas_height; transport_loop_range_rect->property_y2() = y1 + canvas_height;
transport_punchout_line->property_y2() = full_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(); update_fixed_rulers();
redisplay_tempo (true); redisplay_tempo (true);
if (logo_item) {
// logo_item->property_height() = full_canvas_height;
// logo_item->property_width() = canvas_width;
}
Resized (); /* EMIT_SIGNAL */ Resized (); /* EMIT_SIGNAL */
return false; return false;
@ -682,6 +684,38 @@ Editor::left_track_canvas (GdkEventCrossing *ev)
return FALSE; 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 void
Editor::canvas_horizontally_scrolled () Editor::canvas_horizontally_scrolled ()

View file

@ -1172,7 +1172,7 @@ Editor::marker_selection_changed ()
} }
for (MarkerSelection::iterator x = selection->markers.begin(); x != selection->markers.end(); ++x) { 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 (); (*x)->show_line ();
} }

View file

@ -25,6 +25,7 @@
#include "utils.h" #include "utils.h"
#include "canvas_impl.h" #include "canvas_impl.h"
#include "ardour_ui.h" #include "ardour_ui.h"
#include "simpleline.h"
#include "i18n.h" #include "i18n.h"
@ -267,7 +268,6 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
} }
line = 0; line = 0;
line_points = 0;
} }
@ -283,7 +283,6 @@ Marker::~Marker ()
if (line) { if (line) {
delete line; delete line;
delete line_points;
} }
} }
@ -293,12 +292,13 @@ void Marker::reparent(ArdourCanvas::Group & parent)
_parent = &parent; _parent = &parent;
} }
void void
Marker::set_line_length (double len) Marker::set_line_vpos (double pos, double height)
{ {
if (line) { if (line) {
line_points->back().set_y (len); line->property_y1() = pos;
line->property_points() = *line_points; line->property_y2() = pos + height;
} }
} }
@ -307,21 +307,13 @@ Marker::add_line (ArdourCanvas::Group* group, double initial_height)
{ {
if (!line) { if (!line) {
line_points = new ArdourCanvas::Points (); line = new ArdourCanvas::SimpleLine (*group);
line_points->push_back (Gnome::Art::Point (unit_position + shift, 0.0)); line->property_color_rgba() = ARDOUR_UI::config()->canvasvar_EditPoint.get();
line_points->push_back (Gnome::Art::Point (unit_position + shift, initial_height)); line->property_x1() = unit_position + shift;
line->property_y1() = 0.0;
line->property_x2() = unit_position + shift;
line->property_y2() = 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->signal_event().connect (bind (mem_fun (editor, &PublicEditor::canvas_marker_event), mark, this)); 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; unit_position = new_unit_position;
if (line) { if (line) {
(*line_points)[0].set_x (unit_position + shift); line->property_x1() = unit_position + shift;
(*line_points)[1].set_x (unit_position + shift); line->property_x2() = unit_position + shift;
line->property_points() = *line_points;
} }
} }

View file

@ -60,7 +60,7 @@ class Marker : public PBD::Destructible
void add_line (ArdourCanvas::Group*, double initial_height); void add_line (ArdourCanvas::Group*, double initial_height);
void show_line (); void show_line ();
void hide_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_position (nframes_t);
void set_name (const string&); void set_name (const string&);
@ -84,7 +84,7 @@ class Marker : public PBD::Destructible
ArdourCanvas::Polygon *mark; ArdourCanvas::Polygon *mark;
ArdourCanvas::Text *text; ArdourCanvas::Text *text;
ArdourCanvas::Points *points; ArdourCanvas::Points *points;
ArdourCanvas::Line *line; ArdourCanvas::SimpleLine *line;
ArdourCanvas::Points *line_points; ArdourCanvas::Points *line_points;
double unit_position; double unit_position;

View file

@ -571,9 +571,11 @@ NewSessionDialog::set_session_folder(const Glib::ustring& dir)
#else #else
if (!Glib::file_test (dir, Glib::FILE_TEST_IS_DIR)) { if (!Glib::file_test (dir, Glib::FILE_TEST_IS_DIR)) {
realdir = Glib::path_get_dirname (realdir); realdir = Glib::path_get_dirname (realdir);
cerr << "didn't exist, use " << realdir << endl;
} }
if ((res = canonicalize_file_name (realdir.c_str())) != 0) { if ((res = canonicalize_file_name (realdir.c_str())) != 0) {
cerr << "canonical, use " << res << endl;
m_folder->set_current_folder (res); m_folder->set_current_folder (res);
free (res); free (res);
} }
@ -623,6 +625,13 @@ NewSessionDialog::session_folder() const
case NewPage: case NewPage:
return Glib::filename_from_utf8(m_folder->get_filename()); 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: default:
break; break;
} }