ardour
axis_view.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 Paul Davis
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 
18 */
19 
20 #ifndef __ardour_gtk_axis_view_h__
21 #define __ardour_gtk_axis_view_h__
22 
23 #include <list>
24 #include <boost/unordered_map.hpp>
25 
26 #include <gtkmm/label.h>
27 #include <gdkmm/color.h>
28 
29 #include "pbd/xml++.h"
30 #include "pbd/signals.h"
31 
32 #include "ardour/session_handle.h"
33 
34 #include "gui_object.h"
35 #include "prompter.h"
36 #include "selectable.h"
37 
38 namespace ARDOUR {
39  class Session;
40 }
41 
47 {
48  public:
50  Gdk::Color color () const { return _color; }
51 
52  ARDOUR::Session* session() const { return _session; }
53 
54  virtual std::string name() const = 0;
55 
56  sigc::signal<void> Hiding;
57 
58  void set_old_order_key (uint32_t ok) { _old_order_key = ok; }
59  uint32_t old_order_key() const { return _old_order_key; }
60 
61  virtual std::string state_id() const = 0;
62  /* for now, we always return properties in string form.
63  */
64  std::string gui_property (const std::string& property_name) const;
65 
66  template<typename T> void set_gui_property (const std::string& property_name, const T& value) {
67  std::stringstream s;
68  s << value;
69  property_hashtable.erase(property_name);
70  property_hashtable.emplace(property_name, s.str());
71  gui_object_state().set_property<T> (state_id(), property_name, value);
72  }
73 
75  /* remove related property node from the GUI state */
77  property_hashtable.clear ();
78  }
79 
80  bool marked_for_display () const;
81  virtual bool set_marked_for_display (bool);
82 
85 
86  protected:
87 
88  AxisView (ARDOUR::Session* sess);
89  virtual ~AxisView();
90 
96  static Gdk::Color unique_random_color();
97 
98  Gdk::Color _color;
99 
100  static std::list<Gdk::Color> used_colors;
101 
102  Gtk::Label name_label;
103 
104  mutable boost::unordered_map<std::string, std::string> property_hashtable;
105  uint32_t _old_order_key;
106 }; /* class AxisView */
107 
108 #endif /* __ardour_gtk_axis_view_h__ */
109 
void set_old_order_key(uint32_t ok)
Definition: axis_view.h:58
std::string gui_property(const std::string &property_name) const
Definition: axis_view.cc:67
uint32_t _old_order_key
Definition: axis_view.h:105
virtual std::string name() const =0
static Gdk::Color unique_random_color()
Definition: axis_view.cc:61
boost::unordered_map< std::string, std::string > property_hashtable
Definition: axis_view.h:104
virtual ~AxisView()
Definition: axis_view.cc:56
virtual bool set_marked_for_display(bool)
Definition: axis_view.cc:87
AxisView(ARDOUR::Session *sess)
Definition: axis_view.cc:50
virtual std::string state_id() const =0
void clear_property_cache()
Definition: axis_view.h:84
static std::list< Gdk::Color > used_colors
Definition: axis_view.h:100
Definition: amp.h:29
Gtk::Label name_label
Definition: axis_view.h:102
ARDOUR::Session * session() const
Definition: axis_view.h:52
void remove_node(const std::string &id)
Definition: gui_object.cc:79
static GUIObjectState & gui_object_state()
Definition: axis_view.cc:98
Gdk::Color _color
Definition: axis_view.h:98
uint32_t old_order_key() const
Definition: axis_view.h:59
void set_property(const std::string &id, const std::string &prop_name, const T &val)
Definition: gui_object.h:44
void set_gui_property(const std::string &property_name, const T &value)
Definition: axis_view.h:66
Gdk::Color color() const
Definition: axis_view.h:50
bool marked_for_display() const
Definition: axis_view.cc:80
ARDOUR::Session * _session
sigc::signal< void > Hiding
Definition: axis_view.h:56
void cleanup_gui_properties()
Definition: axis_view.h:74