more NSD madness curing; fix up canvas range rects and marker line height mgmt
authorPaul Davis <paul@linuxaudiosystems.com>
Sat, 12 Jan 2008 03:56:43 +0000 (03:56 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Sat, 12 Jan 2008 03:56:43 +0000 (03:56 +0000)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2902 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/ardour_ui.cc
gtk2_ardour/editor.cc
gtk2_ardour/editor_canvas.cc
gtk2_ardour/editor_markers.cc
gtk2_ardour/marker.cc
gtk2_ardour/marker.h
gtk2_ardour/new_session_dialog.cc

index 1367204b654f5b1933beace68e721e359622f299..9e496afad91397dbffefec89c427e4b962b92600 100644 (file)
@@ -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()) {
index ff49af5c614703a1972bdb619c3fff141850c4d5..3056ebb8e0ee99acf9edd4a46e18100477a26c82 100644 (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
 Editor::instant_save ()
 {
index 4e8858b84cbb2eb2b9640d777283d8d359db3753..c89c196a88370a1b45b3d6885a74f4e7ebe95808 100644 (file)
@@ -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 ()
index ce9c94082c1956a01de94c1224d14689ea8ff6c0..c36cb5bf0683c4a139f61013e572ba30c6cb5dd1 100644 (file)
@@ -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 ();
        }
 
index df62af90ec10099d5223f707d9940557e68128a5..7dd45499e7fdf914c0dc61cf706ddeafbe10dd7a 100644 (file)
@@ -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;
        }
 }
 
index fa252571fb95796116e7fa7b988818e1b147c229..d494af839fedaad9af6ba238840c16427f8a1ab3 100644 (file)
@@ -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;
index f0df59cacac0a10e0acb5d882f22ee3f0655286f..81b1aafa627888560dcdb3ede062298833844871 100644 (file)
@@ -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;
        }