From 4a2e5c276236b3f6e6cb0d22ed7fbbfcb40536cc Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Mon, 26 Jan 2009 22:34:09 +0000 Subject: [PATCH 1/9] Fixed the resources menu item --- src/gui/workspace/actions.cpp | 8 ++++---- src/gui/workspace/actions.hpp | 2 +- src/gui/workspace/workspace-window.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/workspace/actions.cpp b/src/gui/workspace/actions.cpp index 88a440103..4ed0a18a3 100644 --- a/src/gui/workspace/actions.cpp +++ b/src/gui/workspace/actions.cpp @@ -70,10 +70,10 @@ Actions::Actions(WorkspaceWindow &workspace_window) : // View Menu actionGroup->add(Action::create("ViewMenu", _("_View"))); - assetsPanelAction = ToggleAction::create("ViewAssets", - Gtk::StockID("panel_assets")); + assetsPanelAction = ToggleAction::create("ViewResources", + Gtk::StockID("panel_resources")); assetsPanelAction->signal_toggled().connect( - sigc::mem_fun(*this, &Actions::on_menu_view_assets)); + sigc::mem_fun(*this, &Actions::on_menu_view_resources)); actionGroup->add(assetsPanelAction); timelinePanelAction = ToggleAction::create("ViewTimeline", @@ -160,7 +160,7 @@ Actions::on_menu_edit_preferences() /* ===== View Menu Event Handlers ===== */ void -Actions::on_menu_view_assets() +Actions::on_menu_view_resources() { if(!is_updating_action_state) workspaceWindow.resourcesPanel->show( diff --git a/src/gui/workspace/actions.hpp b/src/gui/workspace/actions.hpp index 76034ac6e..a11b58cfd 100644 --- a/src/gui/workspace/actions.hpp +++ b/src/gui/workspace/actions.hpp @@ -66,7 +66,7 @@ private: void on_menu_edit_preferences(); - void on_menu_view_assets(); + void on_menu_view_resources(); void on_menu_view_timeline(); void on_menu_view_viewer(); diff --git a/src/gui/workspace/workspace-window.cpp b/src/gui/workspace/workspace-window.cpp index 76a67a4d8..0fe2d8377 100644 --- a/src/gui/workspace/workspace-window.cpp +++ b/src/gui/workspace/workspace-window.cpp @@ -117,7 +117,7 @@ WorkspaceWindow::create_ui() " " " " " " - " " + " " " " " " " " From 1084a12e8a204f87b02aca0d21aad2054656f917 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Sat, 31 Jan 2009 16:31:15 +0000 Subject: [PATCH 2/9] Added theme icons support, and a New Window menu command --- src/gui/window-manager.cpp | 73 +++++++++++++++++++------- src/gui/window-manager.hpp | 28 +++++++++- src/gui/workspace/actions.cpp | 10 ++++ src/gui/workspace/actions.hpp | 1 + src/gui/workspace/workspace-window.cpp | 2 + 5 files changed, 94 insertions(+), 20 deletions(-) diff --git a/src/gui/window-manager.cpp b/src/gui/window-manager.cpp index c227d4b5d..663ac3002 100644 --- a/src/gui/window-manager.cpp +++ b/src/gui/window-manager.cpp @@ -93,6 +93,8 @@ WindowManager::register_stock_items() add_stock_icon_set(factory, "panel-timeline", "panel_timeline", _("_Timeline")); add_stock_icon_set(factory, "panel-viewer", "panel_viewer", _("_Viewer")); + add_stock_icon_set(factory, "window-new", "new_window", _("New _Window")); + add_stock_icon_set(factory, "tool-arrow", "tool_arrow", _("_Arrow")); add_stock_icon_set(factory, "tool-i-beam", "tool_i_beam", _("_I-Beam")); @@ -144,14 +146,19 @@ WindowManager::add_stock_icon_set( bool WindowManager::add_stock_icon(Gtk::IconSet &icon_set, const Glib::ustring& icon_name, Gtk::IconSize size, bool wildcard) -{ +{ + // Try the icon theme + if(add_theme_icon_source(icon_set, icon_name, size, wildcard)) + return true; + // Try the ~/.lumiera/icons folder - if(add_stock_icon_source(icon_set, ustring::compose("%1/%2", + if(add_non_theme_icon_source(icon_set, ustring::compose("%1/%2", GtkLumiera::get_home_data_path(), ustring("icons")), icon_name, size, wildcard)) return true; - if(add_stock_icon_source( + // Try the local directory + if(add_non_theme_icon_source( icon_set, get_current_dir(), icon_name, size, wildcard)) return true; @@ -159,38 +166,68 @@ WindowManager::add_stock_icon(Gtk::IconSet &icon_set, } bool -WindowManager::add_stock_icon_source(Gtk::IconSet &icon_set, - const Glib::ustring& base_dir, const Glib::ustring& icon_name, - Gtk::IconSize size, bool wildcard) +WindowManager::add_theme_icon_source(Gtk::IconSet &icon_set, + const Glib::ustring& icon_name, Gtk::IconSize size, bool wildcard) { - ustring path; - Gtk::IconSource source; - + // Get the size int width = 0, height = 0; if(!IconSize::lookup(size, width, height)) return false; + REQUIRE(width > 0); + + // Try to load the icon + RefPtr theme = Gtk::IconTheme::get_default(); + REQUIRE(theme); + const IconInfo info = theme->lookup_icon(icon_name, width, + (IconLookupFlags)0); + if(info) + { + const ustring path(info.get_filename()); + if(add_stock_icon_from_path(path, icon_set, size, wildcard)) + return true; + } + + return false; +} + +bool +WindowManager::add_non_theme_icon_source(Gtk::IconSet &icon_set, + const Glib::ustring& base_dir, const Glib::ustring& icon_name, + Gtk::IconSize size, bool wildcard) +{ + // Get the size + int width = 0, height = 0; + if(!IconSize::lookup(size, width, height)) + return false; + REQUIRE(width > 0); + + // Try to load the icon + const ustring path(ustring::compose("%1/%2x%3/%4.png", + base_dir, width, height, icon_name)); + return add_stock_icon_from_path(path, icon_set, size, wildcard); +} + +bool +WindowManager::add_stock_icon_from_path(Glib::ustring path, + Gtk::IconSet &icon_set, Gtk::IconSize size, bool wildcard) +{ + Gtk::IconSource source; try - { - ustring path = ustring::compose("%1/%2x%3/%4.png", - base_dir, width, height, icon_name); - - INFO(gui, "Attempting to load icon: %s", path.c_str()); - + { // This throws an exception if the file is not found: source.set_pixbuf(Gdk::Pixbuf::create_from_file(path)); } catch(const Glib::Exception& ex) { - INFO(gui, "Failed to load icon: %s", path.c_str()); return false; } - + source.set_size(size); source.set_size_wildcarded(wildcard); icon_set.add_source(source); - + return true; } diff --git a/src/gui/window-manager.hpp b/src/gui/window-manager.hpp index 64783d250..66fd4b71f 100644 --- a/src/gui/window-manager.hpp +++ b/src/gui/window-manager.hpp @@ -103,9 +103,21 @@ private: **/ static bool add_stock_icon(Gtk::IconSet &icon_set, const Glib::ustring& icon_name, Gtk::IconSize size, bool wildcard); + + /** + * Loads an icon from a the icon theme + * @param icon_set The icon set to add the icon to. + * @param icon_name The name of the icon to load. + * @param size The size of the icon to load. + * @param wildcard This value is set to true if this icon is + * wildcarded. + * @return Returns true if the icon was loaded successfully. + **/ + static bool add_theme_icon_source(Gtk::IconSet &icon_set, + const Glib::ustring& icon_name, Gtk::IconSize size, bool wildcard); /** - * Loads an icon from a specific path and adds it to an icon set. + * Loads an icon from a non theme set. * @param icon_set The icon set to add the icon to. * @param base_dir The root icons directory to load from. * @param icon_name The file name of the icon to load. @@ -114,9 +126,21 @@ private: * wildcarded. * @return Returns true if the icon was loaded successfully. **/ - static bool add_stock_icon_source(Gtk::IconSet &icon_set, + static bool add_non_theme_icon_source(Gtk::IconSet &icon_set, const Glib::ustring& base_dir, const Glib::ustring& icon_name, Gtk::IconSize size, bool wildcard); + + /** + * Loads an icon from a specific path and adds it to an icon set. + * @param path The path to load from. + * @param icon_set The icon set to add the icon to. + * @param size The size of the icon to load. + * @param wildcard This value is set to true if this icon is + * wildcarded. + * @return Returns true if the icon was loaded successfully. + **/ + static bool add_stock_icon_from_path(Glib::ustring path, + Gtk::IconSet &icon_set, Gtk::IconSize size, bool wildcard); public: diff --git a/src/gui/workspace/actions.cpp b/src/gui/workspace/actions.cpp index 4ed0a18a3..fa89310d5 100644 --- a/src/gui/workspace/actions.cpp +++ b/src/gui/workspace/actions.cpp @@ -88,6 +88,10 @@ Actions::Actions(WorkspaceWindow &workspace_window) : sigc::mem_fun(*this, &Actions::on_menu_view_viewer)); actionGroup->add(viewerPanelAction); + actionGroup->add(Action::create("ViewNewWindow", + Gtk::StockID("new_window")), + sigc::mem_fun(*this, &Actions::on_menu_view_new_window)); + // Sequence Menu actionGroup->add(Action::create("SequenceMenu", _("_Sequence"))); actionGroup->add(Action::create("SequenceAdd", _("_Add...")), @@ -181,6 +185,12 @@ Actions::on_menu_view_viewer() workspaceWindow.viewerPanel->show(viewerPanelAction->get_active()); } +void +Actions::on_menu_view_new_window() +{ + g_message("New Window"); +} + /* ===== Sequence Menu Event Handlers ===== */ void diff --git a/src/gui/workspace/actions.hpp b/src/gui/workspace/actions.hpp index a11b58cfd..eb995fc02 100644 --- a/src/gui/workspace/actions.hpp +++ b/src/gui/workspace/actions.hpp @@ -69,6 +69,7 @@ private: void on_menu_view_resources(); void on_menu_view_timeline(); void on_menu_view_viewer(); + void on_menu_view_new_window(); void on_menu_sequence_add(); diff --git a/src/gui/workspace/workspace-window.cpp b/src/gui/workspace/workspace-window.cpp index 0fe2d8377..d79008367 100644 --- a/src/gui/workspace/workspace-window.cpp +++ b/src/gui/workspace/workspace-window.cpp @@ -120,6 +120,8 @@ WorkspaceWindow::create_ui() " " " " " " + " " + " " " " " " " " From cef0e0e0744d05f58507a8292734845fdc624d76 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Sat, 31 Jan 2009 18:12:04 +0000 Subject: [PATCH 3/9] Added WindowManager::new_window, and used it as the standard way of creaing the workspaces --- src/gui/gtk-lumiera.cpp | 6 ++--- src/gui/window-manager.cpp | 50 ++++++++++++++++++++++++++++++++++++++ src/gui/window-manager.hpp | 36 ++++++++++++++++++++++++--- 3 files changed, 85 insertions(+), 7 deletions(-) diff --git a/src/gui/gtk-lumiera.cpp b/src/gui/gtk-lumiera.cpp index fd53d31f7..f112c613c 100644 --- a/src/gui/gtk-lumiera.cpp +++ b/src/gui/gtk-lumiera.cpp @@ -68,11 +68,9 @@ GtkLumiera::main(int argc, char *argv[]) WindowManager window_manager; window_manager.set_theme("lumiera_ui.rc"); + window_manager.new_window(project, controller); - WorkspaceWindow main_window(project, controller); - - kit.run(main_window); - + kit.run(); } diff --git a/src/gui/window-manager.cpp b/src/gui/window-manager.cpp index 663ac3002..b077b45dd 100644 --- a/src/gui/window-manager.cpp +++ b/src/gui/window-manager.cpp @@ -25,6 +25,9 @@ using namespace Gtk; using namespace Glib; +using namespace boost; +using namespace std; +using namespace gui::workspace; namespace gui { @@ -37,6 +40,22 @@ WindowManager::WindowManager() register_stock_items(); } +void +WindowManager::new_window(gui::model::Project &source_project, + gui::controller::Controller &source_controller) +{ + shared_ptr window( + new WorkspaceWindow(source_project, source_controller)); + REQUIRE(window); + + window->signal_delete_event().connect(sigc::mem_fun( + this, &WindowManager::on_window_closed)); + + windowList.push_back(window); + + window->show(); +} + bool WindowManager::set_theme(Glib::ustring path) { @@ -53,7 +72,38 @@ WindowManager::set_theme(Glib::ustring path) return true; } + +bool +WindowManager::on_window_closed(GdkEventAny*) +{ + list< shared_ptr >::iterator iterator = + windowList.begin(); + while(iterator != windowList.end()) + { + shared_ptr window(*iterator); + REQUIRE(window); + + if(!window->get_frame()) + { + // This window has been closed + iterator = windowList.erase(iterator); + } + else + iterator++; + } + if(windowList.empty()) + { + // All windows have been closed - we should exit + Main *main = Main::instance(); + REQUIRE(main); + main->quit(); + } + + // Unless this is false, the window won't close + return false; +} + GdkColor WindowManager::read_style_colour_property( Gtk::Widget &widget, const gchar *property_name, diff --git a/src/gui/window-manager.hpp b/src/gui/window-manager.hpp index 66fd4b71f..8599f7bd9 100644 --- a/src/gui/window-manager.hpp +++ b/src/gui/window-manager.hpp @@ -25,13 +25,22 @@ ** @see gtk-lumiera.hpp */ +#include "gtk-lumiera.hpp" +#include "workspace/workspace-window.hpp" + #ifndef WINDOW_MANAGER_HPP #define WINDOW_MANAGER_HPP -#include "gtk-lumiera.hpp" - namespace gui { +namespace model { + class Project; +} // model + +namespace controller { + class Controller; +} // model + /** * The centralised manager of all lumiera-gui's windows. **/ @@ -42,6 +51,15 @@ public: * Default constructor **/ WindowManager(); + + /** + * Creates a new window connected to a specified project and + * controller + * @param source_project The project to connect the window to. + * @param source_controller The controller to connect the window to. + **/ + void new_window(gui::model::Project &source_project, + gui::controller::Controller &source_controller); /** * Sets the theme of the lumiera-gui's. @@ -49,7 +67,8 @@ public: * will be found. **/ bool set_theme(Glib::ustring path); - + +public: /** * A utility function which reads a colour style from the GTK Style. * @param widget The widget to load the style out of. @@ -62,6 +81,13 @@ public: static GdkColor read_style_colour_property( Gtk::Widget &widget, const gchar *property_name, guint16 red, guint16 green, guint16 blue); + +private: + + /** + * An event handler for when a window has been closed. + **/ + bool on_window_closed(GdkEventAny*); private: @@ -142,6 +168,10 @@ private: static bool add_stock_icon_from_path(Glib::ustring path, Gtk::IconSet &icon_set, Gtk::IconSize size, bool wildcard); +private: + + std::list< boost::shared_ptr > windowList; + public: /** From 852377c1f1b3d0375363295bebb7e55fc3feff57 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Sat, 31 Jan 2009 18:49:44 +0000 Subject: [PATCH 4/9] Implemented New Window command --- src/gui/gtk-lumiera.cpp | 7 ++++--- src/gui/window-manager.cpp | 24 +++++++++++++++++++----- src/gui/window-manager.hpp | 5 ++++- src/gui/workspace/actions.cpp | 5 ++++- 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/src/gui/gtk-lumiera.cpp b/src/gui/gtk-lumiera.cpp index f112c613c..31d319b47 100644 --- a/src/gui/gtk-lumiera.cpp +++ b/src/gui/gtk-lumiera.cpp @@ -65,10 +65,11 @@ GtkLumiera::main(int argc, char *argv[]) Project project; Controller controller(project); - WindowManager window_manager; - window_manager.set_theme("lumiera_ui.rc"); - window_manager.new_window(project, controller); + WindowManager *manager = WindowManager::instance(); + REQUIRE(manager); + manager->set_theme("lumiera_ui.rc"); + manager->new_window(project, controller); kit.run(); } diff --git a/src/gui/window-manager.cpp b/src/gui/window-manager.cpp index b077b45dd..ec8596563 100644 --- a/src/gui/window-manager.cpp +++ b/src/gui/window-manager.cpp @@ -73,17 +73,31 @@ WindowManager::set_theme(Glib::ustring path) return true; } +WindowManager* +WindowManager::instance() +{ + // Initialized during first access + static WindowManager manager; + return &manager; +} + bool -WindowManager::on_window_closed(GdkEventAny*) -{ +WindowManager::on_window_closed(GdkEventAny* event) +{ + REQUIRE(event); + REQUIRE(event->window); + list< shared_ptr >::iterator iterator = windowList.begin(); + while(iterator != windowList.end()) { - shared_ptr window(*iterator); - REQUIRE(window); + shared_ptr workspace_window(*iterator); + REQUIRE(workspace_window); - if(!window->get_frame()) + RefPtr window = workspace_window->get_window(); + REQUIRE(window); + if(window->gobj() == event->window) { // This window has been closed iterator = windowList.erase(iterator); diff --git a/src/gui/window-manager.hpp b/src/gui/window-manager.hpp index 8599f7bd9..0f2f9c0e2 100644 --- a/src/gui/window-manager.hpp +++ b/src/gui/window-manager.hpp @@ -69,6 +69,9 @@ public: bool set_theme(Glib::ustring path); public: + + static WindowManager* instance(); + /** * A utility function which reads a colour style from the GTK Style. * @param widget The widget to load the style out of. @@ -87,7 +90,7 @@ private: /** * An event handler for when a window has been closed. **/ - bool on_window_closed(GdkEventAny*); + bool on_window_closed(GdkEventAny* event); private: diff --git a/src/gui/workspace/actions.cpp b/src/gui/workspace/actions.cpp index fa89310d5..f226775be 100644 --- a/src/gui/workspace/actions.cpp +++ b/src/gui/workspace/actions.cpp @@ -23,6 +23,8 @@ #include "actions.hpp" #include "workspace-window.hpp" +#include "../window-manager.hpp" + #include "../dialogs/render.hpp" #include "../dialogs/preferences-dialog.hpp" #include "../dialogs/name-chooser.hpp" @@ -188,7 +190,8 @@ Actions::on_menu_view_viewer() void Actions::on_menu_view_new_window() { - g_message("New Window"); + WindowManager::instance()->new_window(workspaceWindow.project, + workspaceWindow.controller); } /* ===== Sequence Menu Event Handlers ===== */ From 9e585ab5915f16c17b47bff094b2f8191ba7ef9b Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Sat, 31 Jan 2009 19:30:58 +0000 Subject: [PATCH 5/9] Removed stupid WindowManager singleton --- src/gui/gtk-lumiera.cpp | 12 ++++++++---- src/gui/gtk-lumiera.hpp | 10 ++++++++++ src/gui/window-manager.cpp | 12 +++--------- src/gui/window-manager.hpp | 14 +++++++------- src/gui/workspace/actions.cpp | 2 +- 5 files changed, 29 insertions(+), 21 deletions(-) diff --git a/src/gui/gtk-lumiera.cpp b/src/gui/gtk-lumiera.cpp index 31d319b47..87e2c34a7 100644 --- a/src/gui/gtk-lumiera.cpp +++ b/src/gui/gtk-lumiera.cpp @@ -66,14 +66,18 @@ GtkLumiera::main(int argc, char *argv[]) Project project; Controller controller(project); - WindowManager *manager = WindowManager::instance(); - REQUIRE(manager); - manager->set_theme("lumiera_ui.rc"); - manager->new_window(project, controller); + windowManager.init(); + windowManager.set_theme("lumiera_ui.rc"); + windowManager.new_window(project, controller); kit.run(); } +WindowManager& +GtkLumiera::get_window_manager() +{ + return windowManager; +} Glib::ustring GtkLumiera::get_home_data_path() diff --git a/src/gui/gtk-lumiera.hpp b/src/gui/gtk-lumiera.hpp index 9536f348b..07b36b290 100644 --- a/src/gui/gtk-lumiera.hpp +++ b/src/gui/gtk-lumiera.hpp @@ -39,6 +39,8 @@ #include #include "lib/util.hpp" +#include "window-manager.hpp" + extern "C" { #include } @@ -72,6 +74,8 @@ class GtkLumiera : private boost::noncopyable public: void main(int argc, char *argv[]); + WindowManager& get_window_manager(); + static Glib::ustring get_home_data_path(); /** @@ -98,6 +102,12 @@ public: * Returns tn alphabetical list of the application's authors **/ static const std::vector get_app_authors(); + +protected: + /** + * The application window manager object + **/ + WindowManager windowManager; }; /** diff --git a/src/gui/window-manager.cpp b/src/gui/window-manager.cpp index ec8596563..04f9ffdc9 100644 --- a/src/gui/window-manager.cpp +++ b/src/gui/window-manager.cpp @@ -22,6 +22,7 @@ #include "window-manager.hpp" #include "include/logging.h" +#include "workspace/workspace-window.hpp" using namespace Gtk; using namespace Glib; @@ -34,7 +35,8 @@ namespace gui { IconSize WindowManager::GiantIconSize = ICON_SIZE_INVALID; IconSize WindowManager::MenuIconSize = ICON_SIZE_INVALID; -WindowManager::WindowManager() +void +WindowManager::init() { register_app_icon_sizes(); register_stock_items(); @@ -73,14 +75,6 @@ WindowManager::set_theme(Glib::ustring path) return true; } -WindowManager* -WindowManager::instance() -{ - // Initialized during first access - static WindowManager manager; - return &manager; -} - bool WindowManager::on_window_closed(GdkEventAny* event) { diff --git a/src/gui/window-manager.hpp b/src/gui/window-manager.hpp index 0f2f9c0e2..341c25fcb 100644 --- a/src/gui/window-manager.hpp +++ b/src/gui/window-manager.hpp @@ -26,7 +26,7 @@ */ #include "gtk-lumiera.hpp" -#include "workspace/workspace-window.hpp" +//#include "workspace/workspace-window.hpp" #ifndef WINDOW_MANAGER_HPP #define WINDOW_MANAGER_HPP @@ -41,6 +41,10 @@ namespace controller { class Controller; } // model +namespace workspace { + class WorkspaceWindow; +} + /** * The centralised manager of all lumiera-gui's windows. **/ @@ -48,9 +52,9 @@ class WindowManager : private boost::noncopyable { public: /** - * Default constructor + * Initializes the window manager object **/ - WindowManager(); + void init(); /** * Creates a new window connected to a specified project and @@ -68,10 +72,6 @@ public: **/ bool set_theme(Glib::ustring path); -public: - - static WindowManager* instance(); - /** * A utility function which reads a colour style from the GTK Style. * @param widget The widget to load the style out of. diff --git a/src/gui/workspace/actions.cpp b/src/gui/workspace/actions.cpp index f226775be..e2679b7f1 100644 --- a/src/gui/workspace/actions.cpp +++ b/src/gui/workspace/actions.cpp @@ -190,7 +190,7 @@ Actions::on_menu_view_viewer() void Actions::on_menu_view_new_window() { - WindowManager::instance()->new_window(workspaceWindow.project, + application().get_window_manager().new_window(workspaceWindow.project, workspaceWindow.controller); } From 3ad22308643e531c46e74211d11510590b1dd468 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Sat, 31 Jan 2009 23:45:32 +0000 Subject: [PATCH 6/9] Added synchronisation between multiple views of the track title --- src/gui/model/track.cpp | 7 +++++++ src/gui/model/track.hpp | 17 ++++++++++++++++- src/gui/widgets/timeline/timeline-track.cpp | 12 ++++++++++++ src/gui/widgets/timeline/timeline-track.hpp | 5 +++++ 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/gui/model/track.cpp b/src/gui/model/track.cpp index 7e9a3992b..d94926229 100644 --- a/src/gui/model/track.cpp +++ b/src/gui/model/track.cpp @@ -53,6 +53,7 @@ void Track::set_name(const string &name) { this->name = name; + nameChangedSignal.emit(name); } bool @@ -74,6 +75,12 @@ Track::find_descendant_track_parent( return shared_ptr(); } +sigc::signal +Track::signal_name_changed() const +{ + return nameChangedSignal; +} + string Track::print_branch_recursive(const unsigned int indentation) { diff --git a/src/gui/model/track.hpp b/src/gui/model/track.hpp index ac137d451..c59d06875 100644 --- a/src/gui/model/track.hpp +++ b/src/gui/model/track.hpp @@ -79,7 +79,17 @@ public: **/ virtual boost::shared_ptr find_descendant_track_parent(boost::shared_ptr child); - + +public: + + /** + * A signal which fires when the name changes. + * @return Returns the signal. The signal sends the new name for the + * track. + **/ + sigc::signal signal_name_changed() const; + +public: /** * A debugging helper function that prints this track, and all it's * child tracks in a human-readable form. @@ -109,6 +119,11 @@ private: * The name of this track. **/ std::string name; + + /** + * A signal which fires when the name changes. + **/ + sigc::signal nameChangedSignal; protected: /** diff --git a/src/gui/widgets/timeline/timeline-track.cpp b/src/gui/widgets/timeline/timeline-track.cpp index 6a8f4f023..1dc00cc8f 100644 --- a/src/gui/widgets/timeline/timeline-track.cpp +++ b/src/gui/widgets/timeline/timeline-track.cpp @@ -89,6 +89,11 @@ Track::Track(TimelineWidget &timeline_widget, mem_fun(timelineWidget, &TimelineWidget::on_add_track_command) ) ); context_list.push_back( Menu_Helpers::MenuElem(_("_Remove Track"), mem_fun(this, &Track::on_remove_track) ) ); + + // Connect to the model + model_track->signal_name_changed().connect(sigc::mem_fun(this, + &Track::on_name_changed)); + } Gtk::Widget& @@ -247,6 +252,13 @@ Track::on_set_name() } } +void +Track::on_name_changed(std::string new_name) +{ + if(new_name != titleMenuButton.get_label()) + update_name(); +} + void Track::on_remove_track() { diff --git a/src/gui/widgets/timeline/timeline-track.hpp b/src/gui/widgets/timeline/timeline-track.hpp index 3c7e4ee6b..97a3dcf1c 100644 --- a/src/gui/widgets/timeline/timeline-track.hpp +++ b/src/gui/widgets/timeline/timeline-track.hpp @@ -135,6 +135,11 @@ private: //----- Event Handlers -----// void on_set_name(); + + /** + * Event handler for when the track name changes + **/ + void on_name_changed(std::string new_name); void on_remove_track(); From 17c1942c68074507f5d82fa0d78a89d9f73f3534 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Sun, 1 Feb 2009 00:05:15 +0000 Subject: [PATCH 7/9] Removed some redundant name setting code --- src/gui/widgets/timeline/timeline-track.cpp | 10 +++------- src/gui/widgets/timeline/timeline-track.hpp | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/gui/widgets/timeline/timeline-track.cpp b/src/gui/widgets/timeline/timeline-track.cpp index 1dc00cc8f..4dd938184 100644 --- a/src/gui/widgets/timeline/timeline-track.cpp +++ b/src/gui/widgets/timeline/timeline-track.cpp @@ -246,17 +246,13 @@ Track::on_set_name() _("Set Track Name"), model_track->get_name()); if(dialog.run() == RESPONSE_OK) - { - model_track->set_name(dialog.get_name()); - update_name(); - } + model_track->set_name(dialog.get_name()); } void -Track::on_name_changed(std::string new_name) +Track::on_name_changed(std::string) { - if(new_name != titleMenuButton.get_label()) - update_name(); + update_name(); } void diff --git a/src/gui/widgets/timeline/timeline-track.hpp b/src/gui/widgets/timeline/timeline-track.hpp index 97a3dcf1c..43f9db39f 100644 --- a/src/gui/widgets/timeline/timeline-track.hpp +++ b/src/gui/widgets/timeline/timeline-track.hpp @@ -139,7 +139,7 @@ private: /** * Event handler for when the track name changes **/ - void on_name_changed(std::string new_name); + void on_name_changed(std::string); void on_remove_track(); From 2cae8d8ccc67a4df2e050ebe6cc911b238c478d2 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sun, 1 Feb 2009 19:56:49 +0100 Subject: [PATCH 8/9] fix to circumvent a problem with Iconinfo::operator bool() not being const seemingly this has been fixed in recent gtkmm, but is still present on lenny (and etch) --- src/gui/window-manager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/window-manager.cpp b/src/gui/window-manager.cpp index 04f9ffdc9..0e6319816 100644 --- a/src/gui/window-manager.cpp +++ b/src/gui/window-manager.cpp @@ -236,7 +236,9 @@ WindowManager::add_theme_icon_source(Gtk::IconSet &icon_set, // Try to load the icon RefPtr theme = Gtk::IconTheme::get_default(); REQUIRE(theme); - const IconInfo info = theme->lookup_icon(icon_name, width, + + TODO ("find out how IconInfo could be made const. For example, GTKmm 2.10.10 is missing the const on operator bool() in iconinfo.h"); + IconInfo info = theme->lookup_icon(icon_name, width, (IconLookupFlags)0); if(info) { From ec2f362c3acd6456b330442a19204805d5a80a4d Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sun, 1 Feb 2009 20:43:23 +0100 Subject: [PATCH 9/9] During alpha: build .libs into the LUMIERA_PLUGIN_PATH to ease developent --- SConstruct | 8 ++++---- src/common/Makefile.am | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/SConstruct b/SConstruct index 7a1aa2592..3c49573da 100644 --- a/SConstruct +++ b/SConstruct @@ -93,10 +93,10 @@ def setupBasicEnvironment(): appendVal(env,'DEBUG', 'CCFLAGS', val=' -ggdb') # setup search path for Lumiera plugins - appendCppDefine(env,'PKGLIBDIR','LUMIERA_PLUGIN_PATH=\\"$PKGLIBDIR\\"' - ,'LUMIERA_PLUGIN_PATH=\\"$DESTDIR/lib/lumiera\\"') - appendCppDefine(env,'PKGDATADIR','LUMIERA_CONFIG_PATH=\\"$PKGLIBDIR\\"' - ,'LUMIERA_CONFIG_PATH=\\"$DESTDIR/share/lumiera\\"') + appendCppDefine(env,'PKGLIBDIR','LUMIERA_PLUGIN_PATH=\\"$PKGLIBDIR/:./.libs\\"' + ,'LUMIERA_PLUGIN_PATH=\\"$DESTDIR/lib/lumiera/:./.libs\\"') + appendCppDefine(env,'PKGDATADIR','LUMIERA_CONFIG_PATH=\\"$PKGLIBDIR/:.\\"' + ,'LUMIERA_CONFIG_PATH=\\"$DESTDIR/share/lumiera/:.\\"') prepareOptionsHelp(opts,env) opts.Save(OPTIONSCACHEFILE, env) diff --git a/src/common/Makefile.am b/src/common/Makefile.am index 661c92f64..451b0a982 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -18,7 +18,7 @@ liblumieracommon_la_srcdir = $(top_srcdir)/src/common lib_LTLIBRARIES += liblumieracommon.la -liblumieracommon_la_CPPFLAGS = $(AM_CPPFLAGS) -DLUMIERA_CONFIG_PATH="\"$(pkgdatadir)/config\"" -DLUMIERA_PLUGIN_PATH="\"$(pkglibdir)/\"" +liblumieracommon_la_CPPFLAGS = $(AM_CPPFLAGS) -DLUMIERA_CONFIG_PATH="\"$(pkgdatadir)/config:.\"" -DLUMIERA_PLUGIN_PATH="\"$(pkglibdir)/:./.libs\"" liblumieracommon_la_CFLAGS = $(AM_CFLAGS) -std=gnu99 -Wextra -Wall -Werror liblumieracommon_la_CXXFLAGS = $(AM_CXXFLAGS) -Wextra -Wall liblumieracommon_la_LIBADD = liblumiera.la