2007-04-26 16:54:31 -04:00
|
|
|
/*
|
|
|
|
Copyright (C) 2000-2007 Paul Davis
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2005-10-17 11:12:50 -04:00
|
|
|
#ifndef __ardour_gtk_actions_h__
|
|
|
|
#define __ardour_gtk_actions_h__
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <gtkmm/action.h>
|
|
|
|
#include <gtkmm/radioaction.h>
|
|
|
|
#include <gtkmm/toggleaction.h>
|
|
|
|
#include <gtkmm/actiongroup.h>
|
2005-11-22 23:13:32 -05:00
|
|
|
#include <gtkmm/accelkey.h>
|
2005-10-17 11:12:50 -04:00
|
|
|
|
2009-05-13 20:13:27 -04:00
|
|
|
#include "ardour/rc_configuration.h"
|
2007-10-11 21:54:35 -04:00
|
|
|
|
2005-10-17 11:12:50 -04:00
|
|
|
namespace Gtk {
|
|
|
|
class UIManager;
|
|
|
|
}
|
|
|
|
|
2005-11-22 23:13:32 -05:00
|
|
|
class ActionManager
|
2005-10-17 11:12:50 -04:00
|
|
|
{
|
2005-11-22 23:13:32 -05:00
|
|
|
public:
|
|
|
|
ActionManager() {}
|
|
|
|
virtual ~ActionManager () {}
|
2005-10-17 11:12:50 -04:00
|
|
|
|
2005-11-25 19:06:46 -05:00
|
|
|
static void init ();
|
|
|
|
|
2005-11-22 23:13:32 -05:00
|
|
|
static std::vector<Glib::RefPtr<Gtk::Action> > session_sensitive_actions;
|
|
|
|
static std::vector<Glib::RefPtr<Gtk::Action> > region_list_selection_sensitive_actions;
|
2006-03-05 14:39:16 -05:00
|
|
|
static std::vector<Glib::RefPtr<Gtk::Action> > plugin_selection_sensitive_actions;
|
|
|
|
|
2005-11-22 23:13:32 -05:00
|
|
|
static std::vector<Glib::RefPtr<Gtk::Action> > region_selection_sensitive_actions;
|
|
|
|
static std::vector<Glib::RefPtr<Gtk::Action> > track_selection_sensitive_actions;
|
2006-03-05 14:39:16 -05:00
|
|
|
static std::vector<Glib::RefPtr<Gtk::Action> > point_selection_sensitive_actions;
|
|
|
|
static std::vector<Glib::RefPtr<Gtk::Action> > time_selection_sensitive_actions;
|
|
|
|
static std::vector<Glib::RefPtr<Gtk::Action> > line_selection_sensitive_actions;
|
|
|
|
static std::vector<Glib::RefPtr<Gtk::Action> > playlist_selection_sensitive_actions;
|
2008-04-11 10:06:50 -04:00
|
|
|
static std::vector<Glib::RefPtr<Gtk::Action> > mouse_edit_point_requires_canvas_actions;
|
2006-03-05 14:39:16 -05:00
|
|
|
|
2005-11-22 23:13:32 -05:00
|
|
|
static std::vector<Glib::RefPtr<Gtk::Action> > range_sensitive_actions;
|
2005-12-21 16:37:18 -05:00
|
|
|
static std::vector<Glib::RefPtr<Gtk::Action> > transport_sensitive_actions;
|
2005-11-22 23:13:32 -05:00
|
|
|
static std::vector<Glib::RefPtr<Gtk::Action> > jack_sensitive_actions;
|
2005-11-28 10:29:49 -05:00
|
|
|
static std::vector<Glib::RefPtr<Gtk::Action> > jack_opposite_sensitive_actions;
|
2007-11-12 17:23:01 -05:00
|
|
|
static std::vector<Glib::RefPtr<Gtk::Action> > edit_point_in_region_sensitive_actions;
|
2005-11-28 10:29:49 -05:00
|
|
|
|
2009-05-13 20:13:27 -04:00
|
|
|
static void map_some_state (const char* group, const char* action, bool (ARDOUR::RCConfiguration::*get)() const);
|
|
|
|
static void map_some_state (const char* group, const char* action, sigc::slot<bool>);
|
|
|
|
static void toggle_config_state (const char* group, const char* action, bool (ARDOUR::RCConfiguration::*set)(bool), bool (ARDOUR::RCConfiguration::*get)(void) const);
|
|
|
|
static void toggle_config_state_foo (const char* group, const char* action, sigc::slot<bool, bool>, sigc::slot<bool>);
|
2006-09-29 17:39:39 -04:00
|
|
|
|
2005-11-28 10:29:49 -05:00
|
|
|
static void set_sensitive (std::vector<Glib::RefPtr<Gtk::Action> >& actions, bool);
|
2005-11-17 16:31:37 -05:00
|
|
|
|
2005-11-22 23:13:32 -05:00
|
|
|
static std::string unbound_string; /* the key string returned if an action is not bound */
|
2005-11-25 19:06:46 -05:00
|
|
|
static Glib::RefPtr<Gtk::UIManager> ui_manager;
|
2005-10-17 11:12:50 -04:00
|
|
|
|
2005-12-22 08:01:39 -05:00
|
|
|
static Gtk::Widget* get_widget (const char * name);
|
2005-12-29 19:34:21 -05:00
|
|
|
static Glib::RefPtr<Gtk::Action> get_action (const char* group, const char* name);
|
2008-09-10 11:03:30 -04:00
|
|
|
static Glib::RefPtr<Gtk::Action> get_action (const char* path);
|
2005-11-24 09:59:36 -05:00
|
|
|
|
2005-11-22 23:13:32 -05:00
|
|
|
static void add_action_group (Glib::RefPtr<Gtk::ActionGroup>);
|
|
|
|
|
|
|
|
static Glib::RefPtr<Gtk::Action> register_action (Glib::RefPtr<Gtk::ActionGroup> group,
|
2005-12-22 08:01:39 -05:00
|
|
|
const char * name, const char * label);
|
2005-11-22 23:13:32 -05:00
|
|
|
static Glib::RefPtr<Gtk::Action> register_action (Glib::RefPtr<Gtk::ActionGroup> group,
|
2005-12-22 08:01:39 -05:00
|
|
|
const char * name, const char * label, sigc::slot<void> sl,
|
2005-10-17 11:12:50 -04:00
|
|
|
guint key, Gdk::ModifierType mods);
|
2005-11-22 23:13:32 -05:00
|
|
|
static Glib::RefPtr<Gtk::Action> register_action (Glib::RefPtr<Gtk::ActionGroup> group,
|
2005-12-22 08:01:39 -05:00
|
|
|
const char * name, const char * label, sigc::slot<void> sl);
|
2005-10-17 11:12:50 -04:00
|
|
|
|
2006-01-02 13:10:29 -05:00
|
|
|
static Glib::RefPtr<Gtk::Action> register_radio_action (Glib::RefPtr<Gtk::ActionGroup> group, Gtk::RadioAction::Group&,
|
2005-12-22 08:01:39 -05:00
|
|
|
const char * name, const char * label, sigc::slot<void> sl,
|
2005-10-17 11:12:50 -04:00
|
|
|
guint key, Gdk::ModifierType mods);
|
2006-01-02 13:10:29 -05:00
|
|
|
static Glib::RefPtr<Gtk::Action> register_radio_action (Glib::RefPtr<Gtk::ActionGroup> group, Gtk::RadioAction::Group&,
|
2005-12-22 08:01:39 -05:00
|
|
|
const char * name, const char * label, sigc::slot<void> sl);
|
2005-10-17 11:12:50 -04:00
|
|
|
|
2005-11-22 23:13:32 -05:00
|
|
|
static Glib::RefPtr<Gtk::Action> register_toggle_action (Glib::RefPtr<Gtk::ActionGroup> group,
|
2005-12-22 08:01:39 -05:00
|
|
|
const char * name, const char * label, sigc::slot<void> sl,
|
2005-10-17 11:12:50 -04:00
|
|
|
guint key, Gdk::ModifierType mods);
|
2005-11-22 23:13:32 -05:00
|
|
|
static Glib::RefPtr<Gtk::Action> register_toggle_action (Glib::RefPtr<Gtk::ActionGroup> group,
|
2005-12-22 08:01:39 -05:00
|
|
|
const char * name, const char * label, sigc::slot<void> sl);
|
2005-11-17 16:31:37 -05:00
|
|
|
|
2005-11-22 23:13:32 -05:00
|
|
|
static bool lookup_entry (const Glib::ustring accel_path, Gtk::AccelKey& key);
|
2005-11-17 16:31:37 -05:00
|
|
|
|
2005-11-22 23:13:32 -05:00
|
|
|
static void get_all_actions (std::vector<std::string>& names,
|
|
|
|
std::vector<std::string>& paths,
|
|
|
|
std::vector<std::string>& keys,
|
|
|
|
std::vector<Gtk::AccelKey>& bindings);
|
2005-12-02 17:12:56 -05:00
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
static void get_all_actions (std::vector<std::string>& groups,
|
|
|
|
std::vector<std::string>& paths,
|
|
|
|
std::vector<Gtk::AccelKey>& bindings);
|
|
|
|
|
2005-12-22 08:01:39 -05:00
|
|
|
static void uncheck_toggleaction (const char * actionname);
|
2005-10-17 11:12:50 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __ardour_gtk_actions_h__ */
|