Refactored widget mouse movement handling, removed some Glib::RefPtrs, and tidied a few things
This commit is contained in:
parent
063a22fcd5
commit
8689d0dced
6 changed files with 179 additions and 163 deletions
|
|
@ -52,10 +52,12 @@ TimelineWidget::TimelineWidget() :
|
||||||
headerContainer = new HeaderContainer(this);
|
headerContainer = new HeaderContainer(this);
|
||||||
ENSURE(headerContainer != NULL);
|
ENSURE(headerContainer != NULL);
|
||||||
|
|
||||||
horizontalAdjustment.signal_value_changed().connect(
|
horizontalAdjustment.signal_value_changed().connect( sigc::mem_fun(
|
||||||
sigc::mem_fun(this, &TimelineWidget::on_scroll) );
|
this, &TimelineWidget::on_scroll) );
|
||||||
verticalAdjustment.signal_value_changed().connect(
|
verticalAdjustment.signal_value_changed().connect( sigc::mem_fun(
|
||||||
sigc::mem_fun(this, &TimelineWidget::on_scroll) );
|
this, &TimelineWidget::on_scroll) );
|
||||||
|
body->signal_motion_notify_event().connect( sigc::mem_fun(
|
||||||
|
this, &TimelineWidget::on_motion_in_body_notify_event) );
|
||||||
|
|
||||||
set_time_scale(GAVL_TIME_SCALE / 200);
|
set_time_scale(GAVL_TIME_SCALE / 200);
|
||||||
|
|
||||||
|
|
@ -214,10 +216,12 @@ TimelineWidget::get_y_scroll_offset() const
|
||||||
return (int)verticalAdjustment.get_value();
|
return (int)verticalAdjustment.get_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
bool
|
||||||
TimelineWidget::on_mouse_move_in_body(int x, int y)
|
TimelineWidget::on_motion_in_body_notify_event(GdkEventMotion *event)
|
||||||
{
|
{
|
||||||
ruler.set_mouse_chevron_offset(x);
|
REQUIRE(event != NULL);
|
||||||
|
ruler.set_mouse_chevron_offset(event->x);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace widgets
|
} // namespace widgets
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ protected:
|
||||||
|
|
||||||
int get_y_scroll_offset() const;
|
int get_y_scroll_offset() const;
|
||||||
|
|
||||||
void on_mouse_move_in_body(int x, int y);
|
bool on_motion_in_body_notify_event(GdkEventMotion *event);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
gavl_time_t timeOffset;
|
gavl_time_t timeOffset;
|
||||||
|
|
|
||||||
|
|
@ -150,9 +150,6 @@ bool
|
||||||
TimelineBody::on_motion_notify_event(GdkEventMotion *event)
|
TimelineBody::on_motion_notify_event(GdkEventMotion *event)
|
||||||
{
|
{
|
||||||
REQUIRE(event != NULL);
|
REQUIRE(event != NULL);
|
||||||
REQUIRE(timelineWidget != NULL);
|
|
||||||
|
|
||||||
timelineWidget->on_mouse_move_in_body(event->x, event->y);
|
|
||||||
|
|
||||||
switch(dragType)
|
switch(dragType)
|
||||||
{
|
{
|
||||||
|
|
@ -169,7 +166,8 @@ TimelineBody::on_motion_notify_event(GdkEventMotion *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
// false so that the message is passed up to the owner TimelineWidget
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
||||||
|
|
@ -131,9 +131,9 @@ Actions::add_stock_item(const Glib::RefPtr<IconFactory>& factory,
|
||||||
void
|
void
|
||||||
Actions::update_action_state()
|
Actions::update_action_state()
|
||||||
{
|
{
|
||||||
REQUIRE(workspaceWindow.assets_panel);
|
REQUIRE(workspaceWindow.assets_panel != NULL);
|
||||||
REQUIRE(workspaceWindow.timeline_panel);
|
REQUIRE(workspaceWindow.timeline_panel != NULL);
|
||||||
REQUIRE(workspaceWindow.viewer_panel);
|
REQUIRE(workspaceWindow.viewer_panel != NULL);
|
||||||
|
|
||||||
is_updating_action_state = true;
|
is_updating_action_state = true;
|
||||||
assetsPanelAction->set_active(workspaceWindow.assets_panel->is_shown());
|
assetsPanelAction->set_active(workspaceWindow.assets_panel->is_shown());
|
||||||
|
|
|
||||||
|
|
@ -45,22 +45,33 @@ namespace workspace {
|
||||||
WorkspaceWindow::WorkspaceWindow(Project *source_project) :
|
WorkspaceWindow::WorkspaceWindow(Project *source_project) :
|
||||||
project(source_project),
|
project(source_project),
|
||||||
actions(*this)
|
actions(*this)
|
||||||
{
|
{
|
||||||
REQUIRE(source_project != NULL);
|
REQUIRE(source_project != NULL);
|
||||||
|
|
||||||
layout = NULL;
|
layout = NULL;
|
||||||
|
assets_panel = NULL;
|
||||||
|
viewer_panel = NULL;
|
||||||
|
timeline_panel = NULL;
|
||||||
|
|
||||||
create_ui();
|
create_ui();
|
||||||
}
|
}
|
||||||
|
|
||||||
WorkspaceWindow::~WorkspaceWindow()
|
WorkspaceWindow::~WorkspaceWindow()
|
||||||
{
|
{
|
||||||
if(layout != NULL) g_object_unref(layout);
|
REQUIRE(layout != NULL);
|
||||||
}
|
g_object_unref(layout);
|
||||||
|
|
||||||
|
REQUIRE(assets_panel != NULL);
|
||||||
|
assets_panel->unreference();
|
||||||
|
REQUIRE(viewer_panel != NULL);
|
||||||
|
viewer_panel->unreference();
|
||||||
|
REQUIRE(timeline_panel != NULL);
|
||||||
|
timeline_panel->unreference();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
WorkspaceWindow::create_ui()
|
WorkspaceWindow::create_ui()
|
||||||
{
|
{
|
||||||
//----- Configure the Window -----//
|
//----- Configure the Window -----//
|
||||||
set_title(AppTitle);
|
set_title(AppTitle);
|
||||||
set_default_size(1024, 768);
|
set_default_size(1024, 768);
|
||||||
|
|
@ -129,9 +140,12 @@ WorkspaceWindow::create_ui()
|
||||||
base_container.pack_start(*toolbar, Gtk::PACK_SHRINK);
|
base_container.pack_start(*toolbar, Gtk::PACK_SHRINK);
|
||||||
|
|
||||||
//----- Create the Panels -----//
|
//----- Create the Panels -----//
|
||||||
assets_panel = Glib::RefPtr<AssetsPanel>(new AssetsPanel());
|
assets_panel = new AssetsPanel();
|
||||||
viewer_panel = Glib::RefPtr<ViewerPanel>(new ViewerPanel());
|
ENSURE(assets_panel != NULL);
|
||||||
timeline_panel = Glib::RefPtr<TimelinePanel>(new TimelinePanel());
|
viewer_panel = new ViewerPanel();
|
||||||
|
ENSURE(viewer_panel != NULL);
|
||||||
|
timeline_panel = new TimelinePanel();
|
||||||
|
ENSURE(timeline_panel != NULL);
|
||||||
|
|
||||||
//----- Create the Dock -----//
|
//----- Create the Dock -----//
|
||||||
dock = Glib::wrap(gdl_dock_new());
|
dock = Glib::wrap(gdl_dock_new());
|
||||||
|
|
@ -164,7 +178,7 @@ WorkspaceWindow::create_ui()
|
||||||
gdl_dock_placeholder_new (ph3, (GdlDockObject*)dock->gobj(), GDL_DOCK_LEFT, FALSE);
|
gdl_dock_placeholder_new (ph3, (GdlDockObject*)dock->gobj(), GDL_DOCK_LEFT, FALSE);
|
||||||
gchar ph4[] = "ph4";
|
gchar ph4[] = "ph4";
|
||||||
gdl_dock_placeholder_new (ph4, (GdlDockObject*)dock->gobj(), GDL_DOCK_RIGHT, FALSE);
|
gdl_dock_placeholder_new (ph4, (GdlDockObject*)dock->gobj(), GDL_DOCK_RIGHT, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace workspace
|
} // namespace workspace
|
||||||
} // namespace gui
|
} // namespace gui
|
||||||
|
|
|
||||||
|
|
@ -49,24 +49,24 @@ namespace model {
|
||||||
|
|
||||||
namespace workspace {
|
namespace workspace {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main lumiera workspace window
|
* The main lumiera workspace window
|
||||||
*/
|
*/
|
||||||
class WorkspaceWindow : public Gtk::Window
|
class WorkspaceWindow : public Gtk::Window
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WorkspaceWindow(lumiera::gui::model::Project *source_project);
|
WorkspaceWindow(lumiera::gui::model::Project *source_project);
|
||||||
virtual ~WorkspaceWindow();
|
virtual ~WorkspaceWindow();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void create_ui();
|
void create_ui();
|
||||||
|
|
||||||
/* ===== Model ===== */
|
/* ===== Model ===== */
|
||||||
private:
|
private:
|
||||||
lumiera::gui::model::Project *project;
|
lumiera::gui::model::Project *project;
|
||||||
|
|
||||||
/* ===== UI ===== */
|
/* ===== UI ===== */
|
||||||
private:
|
private:
|
||||||
Glib::RefPtr<Gtk::UIManager> uiManager;
|
Glib::RefPtr<Gtk::UIManager> uiManager;
|
||||||
Gtk::VBox base_container;
|
Gtk::VBox base_container;
|
||||||
Gtk::HBox dock_container;
|
Gtk::HBox dock_container;
|
||||||
|
|
@ -76,20 +76,20 @@ namespace workspace {
|
||||||
GdlDockLayout *layout;
|
GdlDockLayout *layout;
|
||||||
|
|
||||||
/* ===== Panels ===== */
|
/* ===== Panels ===== */
|
||||||
private:
|
private:
|
||||||
Glib::RefPtr<AssetsPanel> assets_panel;
|
AssetsPanel *assets_panel;
|
||||||
Glib::RefPtr<ViewerPanel> viewer_panel;
|
ViewerPanel *viewer_panel;
|
||||||
Glib::RefPtr<TimelinePanel> timeline_panel;
|
TimelinePanel *timeline_panel;
|
||||||
|
|
||||||
/* ===== Helpers ===== */
|
/* ===== Helpers ===== */
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* The instantiation of the actions helper class, which
|
* The instantiation of the actions helper class, which
|
||||||
* registers and handles user action events */
|
* registers and handles user action events */
|
||||||
Actions actions;
|
Actions actions;
|
||||||
|
|
||||||
friend class Actions;
|
friend class Actions;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace workspace
|
} // namespace workspace
|
||||||
} // namespace gui
|
} // namespace gui
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue