From 368f3595b407b5f85db393eb20f36f7734010630 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Mon, 14 Apr 2008 22:51:59 +0100 Subject: [PATCH] Renamed mainwindow.* -> main-window.*, and added the base of video viewer widget --- gui/src/Makefile.am | 8 +- gui/src/gtk-lumiera.cpp | 2 +- gui/src/panels/timeline.hpp | 4 +- gui/src/panels/viewer.cpp | 7 +- gui/src/panels/viewer.hpp | 5 +- gui/src/widgets/video-display.cpp | 77 +++++++++++++++++++ gui/src/widgets/video-display.hpp | 50 ++++++++++++ gui/src/workspace/actions.cpp | 2 +- .../{mainwindow.cpp => main-window.cpp} | 4 +- .../{mainwindow.hpp => main-window.hpp} | 8 +- 10 files changed, 150 insertions(+), 17 deletions(-) create mode 100644 gui/src/widgets/video-display.cpp create mode 100644 gui/src/widgets/video-display.hpp rename gui/src/workspace/{mainwindow.cpp => main-window.cpp} (97%) rename gui/src/workspace/{mainwindow.hpp => main-window.hpp} (93%) diff --git a/gui/src/Makefile.am b/gui/src/Makefile.am index 0d149d8de..eda59746e 100644 --- a/gui/src/Makefile.am +++ b/gui/src/Makefile.am @@ -20,8 +20,8 @@ gtk_lumiera_SOURCES = \ gtk-lumiera.hpp \ workspace/actions.cpp \ workspace/actions.hpp \ - workspace/mainwindow.cpp \ - workspace/mainwindow.hpp \ + workspace/main-window.cpp \ + workspace/main-window.hpp \ dialogs/render.cpp \ dialogs/render.hpp \ panels/panel.cpp \ @@ -31,7 +31,9 @@ gtk_lumiera_SOURCES = \ panels/viewer.cpp \ panels/viewer.hpp \ panels/assets.cpp \ - panels/assets.hpp + panels/assets.hpp \ + widgets/video-display.cpp \ + widgets/video-display.hpp gtk_lumiera_LDFLAGS = diff --git a/gui/src/gtk-lumiera.cpp b/gui/src/gtk-lumiera.cpp index 146a6de00..1a6dfacc5 100644 --- a/gui/src/gtk-lumiera.cpp +++ b/gui/src/gtk-lumiera.cpp @@ -28,7 +28,7 @@ #endif #include "gtk-lumiera.hpp" -#include "workspace/mainwindow.hpp" +#include "workspace/main-window.hpp" using namespace lumiera::gui; using namespace lumiera::gui::workspace; diff --git a/gui/src/panels/timeline.hpp b/gui/src/panels/timeline.hpp index 54c6afe1e..b219b3f55 100644 --- a/gui/src/panels/timeline.hpp +++ b/gui/src/panels/timeline.hpp @@ -23,8 +23,8 @@ ** This file contains the definition of the timeline panel */ -#ifndef TIMELINE_H -#define TIMELINE_H +#ifndef TIMELINE_HPP +#define TIMELINE_HPP #include "panel.hpp" diff --git a/gui/src/panels/viewer.cpp b/gui/src/panels/viewer.cpp index 991bb7457..d10ca7929 100644 --- a/gui/src/panels/viewer.cpp +++ b/gui/src/panels/viewer.cpp @@ -22,15 +22,16 @@ #include "viewer.hpp" +using namespace lumiera::gui::widgets; + namespace lumiera { namespace gui { namespace panels { Viewer::Viewer() : - Panel("viewer", "Viewer"), - placeholder("Placeholder: XVideo in here!!!") + Panel("viewer", "Viewer") { - pack_start(placeholder); + pack_start(display); } } // namespace panels diff --git a/gui/src/panels/viewer.hpp b/gui/src/panels/viewer.hpp index 8090f01c4..5d7038961 100644 --- a/gui/src/panels/viewer.hpp +++ b/gui/src/panels/viewer.hpp @@ -27,6 +27,9 @@ #define VIEWER_H #include "panel.hpp" +#include "../widgets/video-display.hpp" + +using namespace lumiera::gui::widgets; namespace lumiera { namespace gui { @@ -38,7 +41,7 @@ namespace panels { Viewer(); protected: - Gtk::Button placeholder; + VideoDisplay display; }; } // namespace panels diff --git a/gui/src/widgets/video-display.cpp b/gui/src/widgets/video-display.cpp new file mode 100644 index 000000000..4ec1eada5 --- /dev/null +++ b/gui/src/widgets/video-display.cpp @@ -0,0 +1,77 @@ +/* + video-display.cpp - Implementation of the video viewer 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 "video-display.hpp" + +namespace lumiera { +namespace gui { +namespace widgets { + +VideoDisplay::VideoDisplay() + { + set_flags(Gtk::NO_WINDOW); + } + +void +VideoDisplay::on_realize() + { + //Call base class: + Gtk::Widget::on_realize(); + + } + +bool +VideoDisplay::on_expose_event(GdkEventExpose* event) + { + // This is where we draw on the window + Glib::RefPtr window = get_window(); + if(window) + { + double scale_x = 1; + double scale_y = 1; + + 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/video-display.hpp b/gui/src/widgets/video-display.hpp new file mode 100644 index 000000000..34fbce81c --- /dev/null +++ b/gui/src/widgets/video-display.hpp @@ -0,0 +1,50 @@ +/* + video-display.hpp - Declaration of the video viewer 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 viewer.hpp + ** This file contains the definition of video viewer widget + */ + +#ifndef VIDEO_DISPLAY_HPP +#define VIDEO_DISPLAY_HPP + +#include + +namespace lumiera { +namespace gui { +namespace widgets { + + class VideoDisplay : public Gtk::Widget + { + public: + VideoDisplay(); + + /* ===== Overrides ===== */ + protected: + virtual void on_realize(); + virtual bool on_expose_event(GdkEventExpose* event); + }; + +} // namespace widgets +} // namespace gui +} // namespace lumiera + +#endif // VIDEO_DISPLAY_H diff --git a/gui/src/workspace/actions.cpp b/gui/src/workspace/actions.cpp index 7a735be96..a6633b4aa 100644 --- a/gui/src/workspace/actions.cpp +++ b/gui/src/workspace/actions.cpp @@ -22,7 +22,7 @@ #include "../gtk-lumiera.hpp" #include "actions.hpp" -#include "mainwindow.hpp" +#include "main-window.hpp" namespace lumiera { namespace gui { diff --git a/gui/src/workspace/mainwindow.cpp b/gui/src/workspace/main-window.cpp similarity index 97% rename from gui/src/workspace/mainwindow.cpp rename to gui/src/workspace/main-window.cpp index bbff0aa6d..d51dd554b 100644 --- a/gui/src/workspace/mainwindow.cpp +++ b/gui/src/workspace/main-window.cpp @@ -1,5 +1,5 @@ /* - MainWindow.cpp - Definition of the main workspace window object + main-window.cpp - Definition of the main workspace window object Copyright (C) Lumiera.org 2008, Joel Holdsworth @@ -36,7 +36,7 @@ #include #include "gtk-lumiera.hpp" -#include "mainwindow.hpp" +#include "main-window.hpp" using namespace Gtk; diff --git a/gui/src/workspace/mainwindow.hpp b/gui/src/workspace/main-window.hpp similarity index 93% rename from gui/src/workspace/mainwindow.hpp rename to gui/src/workspace/main-window.hpp index 3913533cc..1b997623a 100644 --- a/gui/src/workspace/mainwindow.hpp +++ b/gui/src/workspace/main-window.hpp @@ -1,5 +1,5 @@ /* - mainwindow.hpp - Definition of the main workspace window object + main-window.hpp - Definition of the main workspace window object Copyright (C) Lumiera.org 2008, Joel Holdsworth @@ -26,8 +26,8 @@ ** @see actions.hpp */ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H +#ifndef MAIN_WINDOW_HPP +#define MAIN_WINDOW_HPP #include #include @@ -84,4 +84,4 @@ namespace workspace { } // namespace gui } // namespace lumiera -#endif // MAIN_WINDOW_H +#endif // MAIN_WINDOW_HPP