diff --git a/configure.ac b/configure.ac index 0cf1d61bb..f23585298 100644 --- a/configure.ac +++ b/configure.ac @@ -142,7 +142,7 @@ PKG_CHECK_MODULES(LUMIERA_COMMON_LIBS, [sigc++-2.0 >= 2.0.17]) PKG_CHECK_MODULES(LUMIERA_GUI, [ gtk+-2.0 >= 2.8 - gtkmm-2.4 >= 2.8 + gtkmm-2.4 >= 2.14 cairomm-1.0 >= 0.6.0 librsvg-2.0 >= 2.18.1 gdl-1.0 >= 0.6.1 diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index ef8ca979b..2cd04544e 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -82,6 +82,8 @@ gtk_gui_la_SOURCES = \ $(lumigui_srcdir)/widgets/button-bar.hpp \ $(lumigui_srcdir)/widgets/menu-button.cpp \ $(lumigui_srcdir)/widgets/menu-button.hpp \ + $(lumigui_srcdir)/widgets/mini-button.cpp \ + $(lumigui_srcdir)/widgets/mini-button.hpp \ $(lumigui_srcdir)/widgets/video-display-widget.cpp \ $(lumigui_srcdir)/widgets/video-display-widget.hpp \ $(lumigui_srcdir)/widgets/timeline-widget.cpp \ diff --git a/src/gui/widgets/button-bar.cpp b/src/gui/widgets/button-bar.cpp index a97bbe041..d29f4e466 100644 --- a/src/gui/widgets/button-bar.cpp +++ b/src/gui/widgets/button-bar.cpp @@ -30,25 +30,14 @@ using namespace sigc; namespace gui { namespace widgets { -ButtonBar::ButtonBar() : - exposeEvent(NULL) +ButtonBar::ButtonBar() { } -bool -ButtonBar::on_expose_event(GdkEventExpose* event) -{ - exposeEvent = event; - foreach(sigc::mem_fun(this, &ButtonBar::expose_each)); - exposeEvent = NULL; - return false; -} - void -ButtonBar::expose_each(Gtk::Widget& widget) +ButtonBar::append(MiniButton& button) { - REQUIRE(exposeEvent); - propagate_expose(widget, exposeEvent); + pack_start(button, PACK_SHRINK); } } // widgets diff --git a/src/gui/widgets/button-bar.hpp b/src/gui/widgets/button-bar.hpp index 7f7560329..40519eb95 100644 --- a/src/gui/widgets/button-bar.hpp +++ b/src/gui/widgets/button-bar.hpp @@ -26,7 +26,7 @@ #ifndef BUTTON_BAR_HPP #define BUTTON_BAR_HPP -#include +#include "mini-button.hpp" namespace gui { namespace widgets { @@ -34,36 +34,15 @@ namespace widgets { /** * A modified toolbar widget for use in dialogs. **/ -class ButtonBar : public Gtk::Toolbar +class ButtonBar : public Gtk::HBox { public: /** * Constructor **/ ButtonBar(); - -private: - /** - * The expose event handler. - * @remarks This event handler bypasses the Toolbar expose handler - * so that the toolbar background is not drawn. - **/ - bool on_expose_event(GdkEventExpose* event); - /** - * A helper function that calles Container::propagate_expose on a - * widget. - * @param widget The widget to call propagate_expose on. - * @remarks This function should be used with Container::foreach. - **/ - void expose_each(Gtk::Widget& widget); - - /** - * A pointer to the expose event received in on_expose_event. - * @remarks This value is used by expose_each, and is only value - * during on_expose_event's foreach call. - **/ - GdkEventExpose* exposeEvent; + void append(MiniButton& button); }; } // gui diff --git a/src/gui/widgets/mini-button.cpp b/src/gui/widgets/mini-button.cpp new file mode 100644 index 000000000..912eae2b5 --- /dev/null +++ b/src/gui/widgets/mini-button.cpp @@ -0,0 +1,43 @@ +/* + mini-button.cpp - Implementation of the mini button widget + + Copyright (C) Lumiera.org + 2009, 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 "mini-button.hpp" + +#include + +using namespace Gtk; +using namespace sigc; + +namespace gui { +namespace widgets { + +MiniButton::MiniButton(const StockID& stock_id, + const IconSize icon_size) : + image(stock_id, icon_size) +{ + add(image); + set_relief(RELIEF_NONE); + set_focus_on_click(false); +} + +} // widgets +} // gui diff --git a/src/gui/widgets/mini-button.hpp b/src/gui/widgets/mini-button.hpp new file mode 100644 index 000000000..84e554ea1 --- /dev/null +++ b/src/gui/widgets/mini-button.hpp @@ -0,0 +1,59 @@ +/* + mini-button.hpp - Declaration of the mini button widget + + Copyright (C) Lumiera.org + 2009, 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 mini-button.hpp + ** This file contains the definition of mini button widget + */ + +#ifndef MINI_BUTTON_HPP +#define MINI_BUTTON_HPP + +#include + +namespace gui { +namespace widgets { + +/** + * A ToolButton-like widget + **/ +class MiniButton : public Gtk::Button +{ +public: + + /** + * Creates a new Button containing the image and text from a stock + * item. + * @remarks Stock ids have identifiers like Gtk::Stock::OK and + * Gtk::Stock::APPLY. + **/ + MiniButton(const Gtk::StockID& stock_id, + const Gtk::IconSize icon_size); + +private: + + Gtk::Image image; +}; + +} // gui +} // widgets + +#endif // MINI_BUTTON_HPP + diff --git a/src/gui/widgets/timeline/timeline-track.cpp b/src/gui/widgets/timeline/timeline-track.cpp index b16833637..36ccd5de0 100644 --- a/src/gui/widgets/timeline/timeline-track.cpp +++ b/src/gui/widgets/timeline/timeline-track.cpp @@ -46,29 +46,21 @@ Track::Track(TimelineWidget &timeline_widget, expanded(true), expandDirection(None), headerWidget(*this), - enableButton(Gtk::StockID("track_enabled")), - lockButton(Gtk::StockID("track_unlocked")) + enableButton(Gtk::StockID("track_enabled"), WindowManager::MenuIconSize), + lockButton(Gtk::StockID("track_unlocked"), WindowManager::MenuIconSize) { REQUIRE(model_track); titleMenuButton.set_relief(RELIEF_HALF); titleMenuButton.unset_flags(CAN_FOCUS); + buttonBar.set_icon_size(WindowManager::MenuIconSize); + buttonBar.append(enableButton); buttonBar.append(lockButton); - - buttonBar.set_toolbar_style(TOOLBAR_ICONS); - -#if 0 - buttonBar.set_icon_size(WindowManager::MenuIconSize); -#else - TODO("This code soon be removed when we drop Etch compatibility"); - - // Temporary bodge for etch compatibility - will be removed soon - gtk_toolbar_set_icon_size (buttonBar.gobj(), - (GtkIconSize)(int)WindowManager::MenuIconSize); -#endif - + + //buttonBar.set_toolbar_style(TOOLBAR_ICONS); + headerWidget.set_child_widget(headerBox); headerBox.pack_start(titleMenuButton, PACK_SHRINK); diff --git a/src/gui/widgets/timeline/timeline-track.hpp b/src/gui/widgets/timeline/timeline-track.hpp index 5d6feb9aa..e0cba3de1 100644 --- a/src/gui/widgets/timeline/timeline-track.hpp +++ b/src/gui/widgets/timeline/timeline-track.hpp @@ -26,6 +26,7 @@ #include "../../gtk-lumiera.hpp" #include "../../model/track.hpp" #include "../menu-button.hpp" +#include "../mini-button.hpp" #include "../button-bar.hpp" #include "timeline-header-container.hpp" #include "timeline-header-widget.hpp" @@ -189,8 +190,8 @@ private: MenuButton titleMenuButton; - Gtk::ToolButton enableButton; - Gtk::ToolButton lockButton; + MiniButton enableButton; + MiniButton lockButton; Gtk::Entry titleBox; ButtonBar buttonBar;