diff --git a/src/gui/panels/panel.cpp b/src/gui/panels/panel.cpp index 81dbf9092..814845113 100644 --- a/src/gui/panels/panel.cpp +++ b/src/gui/panels/panel.cpp @@ -21,27 +21,38 @@ * *****************************************************/ #include "panel.hpp" +#include "../gtk-lumiera.hpp" namespace lumiera { namespace gui { namespace panels { -Panel::Panel(const gchar *name, const gchar *long_name, GdlDockItemBehavior behavior) +Panel::Panel(const gchar *name, const gchar *long_name, + GdlDockItemBehavior behavior) { - dock_item = (GdlDockItem*)gdl_dock_item_new (name, long_name, behavior); + dock_item = (GdlDockItem*)gdl_dock_item_new ( + name, long_name, behavior); internal_setup(); + + ENSURE(dock_item != NULL); } Panel::Panel(const gchar *name, const gchar *long_name, const gchar *stock_id, GdlDockItemBehavior behavior) { - dock_item = (GdlDockItem*)gdl_dock_item_new_with_stock (name, long_name, stock_id, behavior); + dock_item = (GdlDockItem*)gdl_dock_item_new_with_stock ( + name, long_name, stock_id, behavior); + g_object_ref(dock_item); internal_setup(); + + ENSURE(dock_item != NULL); } Panel::~Panel() { - #warning Im not sure that dock_item is freed - is it self deleting? + REQUIRE(dock_item != NULL); + g_object_unref(dock_item); + dock_item = NULL; } GdlDockItem* @@ -53,6 +64,7 @@ Panel::get_dock_item() const void Panel::show(bool show) { + REQUIRE(dock_item != NULL); if(show) gdl_dock_item_show_item (dock_item); else gdl_dock_item_hide_item (dock_item); } @@ -60,12 +72,17 @@ Panel::show(bool show) bool Panel::is_shown() const { + REQUIRE(dock_item != NULL); return GTK_WIDGET_VISIBLE((GtkWidget*)dock_item); } void Panel::internal_setup() { + REQUIRE(dock_item != NULL); + REQUIRE(gobj() != NULL); + + gdl_dock_item_hide_grip(dock_item); gtk_container_add ((GtkContainer*)dock_item, (GtkWidget*)gobj()); gtk_widget_show ((GtkWidget*)dock_item); } diff --git a/src/gui/panels/timeline-panel.cpp b/src/gui/panels/timeline-panel.cpp index fc4e7387e..afb8b2d5c 100644 --- a/src/gui/panels/timeline-panel.cpp +++ b/src/gui/panels/timeline-panel.cpp @@ -30,8 +30,17 @@ namespace gui { namespace panels { TimelinePanel::TimelinePanel() : - Panel("timeline", _("Timeline"), "timeline_panel") + Panel("timeline", _("Timeline"), "timeline_panel"), + button(Stock::OK) { + // Setup the toolbar + toolbar.append(button); + + toolbar.set_icon_size(IconSize(ICON_SIZE_MENU)); + toolbar.set_toolbar_style(TOOLBAR_ICONS); + + // Add the toolbar + pack_start(toolbar, PACK_SHRINK); pack_start(timeline_widget, PACK_EXPAND_WIDGET); } diff --git a/src/gui/panels/timeline-panel.hpp b/src/gui/panels/timeline-panel.hpp index bc1fbff08..b76a99622 100644 --- a/src/gui/panels/timeline-panel.hpp +++ b/src/gui/panels/timeline-panel.hpp @@ -41,7 +41,13 @@ namespace panels { TimelinePanel(); protected: + + // Widgets + Gtk::Toolbar toolbar; TimelineWidget timeline_widget; + + // Toolbar Widgets + Gtk::ToolButton button; }; } // namespace panels diff --git a/src/gui/widgets/timeline-widget.cpp b/src/gui/widgets/timeline-widget.cpp index 38210a29d..f7b5db81b 100644 --- a/src/gui/widgets/timeline-widget.cpp +++ b/src/gui/widgets/timeline-widget.cpp @@ -210,7 +210,7 @@ TimelineWidget::zoom_view(int point, int zoom_size) void TimelineWidget::on_mouse_move_in_body(int x, int y) { - ruler.set_mouse_chevron_time(x * timeScale + timeOffset); + ruler.set_mouse_chevron_offset(x); } } // namespace widgets diff --git a/src/gui/widgets/timeline/timeline-body.cpp b/src/gui/widgets/timeline/timeline-body.cpp index d7ec9b4b4..cab944d5f 100644 --- a/src/gui/widgets/timeline/timeline-body.cpp +++ b/src/gui/widgets/timeline/timeline-body.cpp @@ -66,7 +66,7 @@ TimelineBody::on_realize() Widget::on_realize(); // We wish to receive all event notifications - add_events(Gdk::POINTER_MOTION_MASK); + add_events(Gdk::POINTER_MOTION_MASK | Gdk::SCROLL_MASK); } void @@ -140,7 +140,7 @@ TimelineBody::on_expose_event(GdkEventExpose* event) // Prepare to render via cairo Glib::RefPtr