Fix tool crash; try to fix linked scrolling.
authorCarl Hetherington <cth@carlh.net>
Wed, 4 Jul 2018 10:18:21 +0000 (11:18 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 4 Jul 2018 10:18:21 +0000 (11:18 +0100)
src/wx/timeline.cc
src/wx/timeline_dialog.cc
src/wx/timeline_dialog.h

index 017d27dfb4812fc1c6bb7c582e714bbe8daf8d01..ba528c007a12a0db4acd59e547bdf7ec4f41e71c 100644 (file)
@@ -808,7 +808,9 @@ void
 Timeline::scrolled (wxScrollWinEvent& ev)
 {
        if (ev.GetOrientation() == wxVERTICAL) {
-               _labels_canvas->Scroll (0, ev.GetPosition ());
+               int x, y;
+               _main_canvas->GetViewState (&x, &y);
+               _labels_canvas->Scroll (0, y);
        }
        ev.Skip ();
 }
index 6f3fbae37f3e2e730f3fbfecfed68f4692b608c2..d2194f5c750b16e09bbd7680c97809bfc3940fbd 100644 (file)
@@ -61,7 +61,7 @@ TimelineDialog::TimelineDialog (ContentPanel* cp, shared_ptr<Film> film)
        wxBitmap snap (bitmap_path("snap"), wxBITMAP_TYPE_PNG);
        wxBitmap sequence (bitmap_path("sequence"), wxBITMAP_TYPE_PNG);
 
-       _toolbar = new wxToolBar (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_HORIZONTAL | wxTB_TEXT);
+       _toolbar = new wxToolBar (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_HORIZONTAL);
        _toolbar->SetMargins (4, 4);
        _toolbar->AddRadioTool ((int) Timeline::SELECT, _("Select"), select, wxNullBitmap, _("Select and move content"));
        _toolbar->AddRadioTool ((int) Timeline::ZOOM, _("Zoom"), zoom, wxNullBitmap, _("Zoom in / out"));
@@ -96,7 +96,6 @@ wxString
 TimelineDialog::bitmap_path (string name)
 {
        boost::filesystem::path p = shared_path() / String::compose("%1.png", name);
-       cout << "Loading " << p.string() << "\n";
        return std_to_wx (p.string());
 }
 
@@ -125,11 +124,11 @@ TimelineDialog::tool_clicked (wxCommandEvent& ev)
        Timeline::Tool t = (Timeline::Tool) ev.GetId();
        _timeline.tool_clicked (t);
        if (t == Timeline::SNAP) {
-               _timeline.set_snap (_snap->IsToggled());
+               _timeline.set_snap (_toolbar->GetToolState ((int) t));
        } else if (t == Timeline::SEQUENCE) {
                shared_ptr<Film> film = _film.lock ();
                if (film) {
-                       film->set_sequence (_sequence->IsToggled());
+                       film->set_sequence (_toolbar->GetToolState ((int) t));
                }
        }
 }
index e9156b89edba0656b7b16422a46efc78f3bc1c54..b7aaba14d92e16839968d4e20c386e637ec63597 100644 (file)
@@ -40,7 +40,5 @@ private:
        boost::weak_ptr<Film> _film;
        Timeline _timeline;
        wxToolBar* _toolbar;
-       wxToolBarToolBase* _snap;
-       wxToolBarToolBase* _sequence;
        boost::signals2::scoped_connection _film_changed_connection;
 };