From b8fd3885f4087582d81bbcbde9efa91f935c02b3 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Sat, 19 Apr 2008 20:31:27 +0100 Subject: [PATCH] Added the base of a timeline widget --- gui/src/Makefile.am | 6 +- .../{timeline.cpp => timeline-panel.cpp} | 11 ++- .../{timeline.hpp => timeline-panel.hpp} | 19 +++-- gui/src/widgets/timeline-widget.cpp | 75 +++++++++++++++++++ gui/src/widgets/timeline-widget.hpp | 50 +++++++++++++ gui/src/widgets/video-display.hpp | 2 +- gui/src/workspace/workspace-window.hpp | 4 +- 7 files changed, 148 insertions(+), 19 deletions(-) rename gui/src/panels/{timeline.cpp => timeline-panel.cpp} (80%) rename gui/src/panels/{timeline.hpp => timeline-panel.hpp} (74%) create mode 100644 gui/src/widgets/timeline-widget.cpp create mode 100644 gui/src/widgets/timeline-widget.hpp diff --git a/gui/src/Makefile.am b/gui/src/Makefile.am index 59ca02604..056cad6ce 100644 --- a/gui/src/Makefile.am +++ b/gui/src/Makefile.am @@ -23,14 +23,16 @@ gtk_lumiera_SOURCES = \ dialogs/render.hpp \ panels/panel.cpp \ panels/panel.hpp \ - panels/timeline.cpp \ - panels/timeline.hpp \ + panels/timeline-panel.cpp \ + panels/timeline-panel.hpp \ panels/viewer.cpp \ panels/viewer.hpp \ panels/assets.cpp \ panels/assets.hpp \ widgets/video-display.cpp \ widgets/video-display.hpp \ + widgets/timeline-widget.cpp \ + widgets/timeline-widget.hpp \ model/project.cpp \ model/project.hpp diff --git a/gui/src/panels/timeline.cpp b/gui/src/panels/timeline-panel.cpp similarity index 80% rename from gui/src/panels/timeline.cpp rename to gui/src/panels/timeline-panel.cpp index 1e5086fd7..7d1de24ea 100644 --- a/gui/src/panels/timeline.cpp +++ b/gui/src/panels/timeline-panel.cpp @@ -1,5 +1,5 @@ /* - timeline.cpp - Implementation of the timeline panel + timeline-panel.cpp - Implementation of the timeline panel Copyright (C) Lumiera.org 2008, Joel Holdsworth @@ -20,17 +20,16 @@ * *****************************************************/ -#include "timeline.hpp" +#include "timeline-panel.hpp" namespace lumiera { namespace gui { namespace panels { -Timeline::Timeline() : - Panel("timeline", "Timeline"), - placeholder("Placeholder label. Is Timeline the correct title for this panel?") +TimelinePanel::TimelinePanel() : + Panel("timeline", "Timeline") { - pack_start(placeholder); + pack_start(timeline_widget); } } // namespace panels diff --git a/gui/src/panels/timeline.hpp b/gui/src/panels/timeline-panel.hpp similarity index 74% rename from gui/src/panels/timeline.hpp rename to gui/src/panels/timeline-panel.hpp index b219b3f55..bc1fbff08 100644 --- a/gui/src/panels/timeline.hpp +++ b/gui/src/panels/timeline-panel.hpp @@ -1,5 +1,5 @@ /* - timeline.hpp - Definition of the timeline panel + timeline-panel.hpp - Definition of the timeline panel Copyright (C) Lumiera.org 2008, Joel Holdsworth @@ -19,30 +19,33 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/** @file timeline.hpp +/** @file timeline-panel.hpp ** This file contains the definition of the timeline panel */ -#ifndef TIMELINE_HPP -#define TIMELINE_HPP +#ifndef TIMELINE_PANEL_HPP +#define TIMELINE_PANEL_HPP #include "panel.hpp" +#include "../widgets/timeline-widget.hpp" + +using namespace lumiera::gui::widgets; namespace lumiera { namespace gui { namespace panels { - class Timeline : public Panel + class TimelinePanel : public Panel { public: - Timeline(); + TimelinePanel(); protected: - Gtk::Label placeholder; + TimelineWidget timeline_widget; }; } // namespace panels } // namespace gui } // namespace lumiera -#endif // TIMELINE_H +#endif // TIMELINE_PANEL_H diff --git a/gui/src/widgets/timeline-widget.cpp b/gui/src/widgets/timeline-widget.cpp new file mode 100644 index 000000000..10eaa3fb0 --- /dev/null +++ b/gui/src/widgets/timeline-widget.cpp @@ -0,0 +1,75 @@ +/* + timeline.cpp - Implementation of the timeline widget + + Copyright (C) Lumiera.org + 2008, Joel Holdsworth + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +* *****************************************************/ + +#include +#include +#include + +#include "timeline-widget.hpp" + +namespace lumiera { +namespace gui { +namespace widgets { + +TimelineWidget::TimelineWidget() + { + set_flags(Gtk::NO_WINDOW); + } + +void +TimelineWidget::on_realize() + { + //Call base class: + Gtk::Widget::on_realize(); + + } + +bool +TimelineWidget::on_expose_event(GdkEventExpose* event) + { + // This is where we draw on the window + Glib::RefPtr window = get_window(); + if(window) + { + /*Cairo::RefPtr cr = window->create_cairo_context(); + if(event) + { + // clip to the area that needs to be re-exposed so we don't draw any + // more than we need to. + cr->rectangle(event->area.x, event->area.y, + event->area.width, event->area.height); + cr->clip(); + } + + // Paint the background + cr->set_source_rgb(0.0, 0.0, 0.0); + cr->paint();*/ + } + return true; + } + + + +} // namespace widgets +} // namespace gui +} // namespace lumiera + diff --git a/gui/src/widgets/timeline-widget.hpp b/gui/src/widgets/timeline-widget.hpp new file mode 100644 index 000000000..a080d34b2 --- /dev/null +++ b/gui/src/widgets/timeline-widget.hpp @@ -0,0 +1,50 @@ +/* + timeline.hpp - Declaration of the timeline widget + + Copyright (C) Lumiera.org + 2008, Joel Holdsworth + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ +/** @file timeline.hpp + ** This file contains the definition of timeline widget + */ + +#ifndef TIMELINE_WIDGET_HPP +#define TIMELINE_WIDGET_HPP + +#include + +namespace lumiera { +namespace gui { +namespace widgets { + + class TimelineWidget : public Gtk::Widget + { + public: + TimelineWidget(); + + /* ===== Overrides ===== */ + protected: + virtual void on_realize(); + virtual bool on_expose_event(GdkEventExpose* event); + }; + +} // namespace widgets +} // namespace gui +} // namespace lumiera + +#endif // TIMELINE_WIDGET_HPP diff --git a/gui/src/widgets/video-display.hpp b/gui/src/widgets/video-display.hpp index 34fbce81c..6fdd73958 100644 --- a/gui/src/widgets/video-display.hpp +++ b/gui/src/widgets/video-display.hpp @@ -47,4 +47,4 @@ namespace widgets { } // namespace gui } // namespace lumiera -#endif // VIDEO_DISPLAY_H +#endif // VIDEO_DISPLAY_HPP diff --git a/gui/src/workspace/workspace-window.hpp b/gui/src/workspace/workspace-window.hpp index 5718ddc25..a111cafeb 100644 --- a/gui/src/workspace/workspace-window.hpp +++ b/gui/src/workspace/workspace-window.hpp @@ -36,7 +36,7 @@ #include "../panels/assets.hpp" #include "../panels/viewer.hpp" -#include "../panels/timeline.hpp" +#include "../panels/timeline-panel.hpp" using namespace lumiera::gui::panels; @@ -79,7 +79,7 @@ namespace workspace { private: Assets assets; Viewer viewer; - Timeline timeline; + TimelinePanel timeline; /* ===== Helpers ===== */ private: