ardour
axis_view.cc
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 #include <cstdlib>
21 #include <cmath>
22 
23 #include <algorithm>
24 #include <string>
25 
26 #include <list>
27 
28 #include "pbd/error.h"
29 #include "pbd/convert.h"
30 
31 #include <gtkmm2ext/utils.h>
32 #include <gtkmm2ext/selector.h>
33 #include <gtkmm2ext/gtk_ui.h>
34 
35 #include "public_editor.h"
36 #include "ardour_ui.h"
37 #include "gui_object.h"
38 #include "axis_view.h"
39 #include "utils.h"
40 #include "i18n.h"
41 
42 using namespace std;
43 using namespace Gtk;
44 using namespace Gtkmm2ext;
45 using namespace ARDOUR;
46 using namespace ARDOUR_UI_UTILS;
47 
48 list<Gdk::Color> AxisView::used_colors;
49 
51  : SessionHandlePtr (sess)
52 {
53  _selected = false;
54 }
55 
57 {
58 }
59 
60 Gdk::Color
62 {
64 }
65 
66 string
67 AxisView::gui_property (const string& property_name) const
68 {
69  if (property_hashtable.count(property_name)) {
70  return property_hashtable[property_name];
71  } else {
72  string rv = gui_object_state().get_string (state_id(), property_name);
73  property_hashtable.erase(property_name);
74  property_hashtable.emplace(property_name, rv);
75  return rv;
76  }
77 }
78 
79 bool
81 {
82  string const v = gui_property ("visible");
83  return (v == "" || PBD::string_is_affirmative (v));
84 }
85 
86 bool
88 {
89  string const v = gui_property ("visible");
90  if (v == "" || yn != PBD::string_is_affirmative (v)) {
91  set_gui_property ("visible", yn);
92  return true; // things changed
93  }
94  return false;
95 }
96 
99 {
101 }
Gdk::Color unique_random_color(std::list< Gdk::Color > &)
Definition: utils.cc:873
std::string get_string(const std::string &id, const std::string &prop_name, bool *empty=0)
Definition: gui_object.cc:92
std::string gui_property(const std::string &property_name) const
Definition: axis_view.cc:67
Definition: ardour_ui.h:130
static ARDOUR_UI * instance()
Definition: ardour_ui.h:187
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
Definition: Beats.hpp:239
virtual bool set_marked_for_display(bool)
Definition: axis_view.cc:87
GUIObjectState * gui_object_state
Definition: ardour_ui.h:227
AxisView(ARDOUR::Session *sess)
Definition: axis_view.cc:50
virtual std::string state_id() const =0
static std::list< Gdk::Color > used_colors
Definition: axis_view.h:100
bool string_is_affirmative(const std::string &str)
Definition: convert.cc:282
Definition: amp.h:29
static GUIObjectState & gui_object_state()
Definition: axis_view.cc:98
bool _selected
Definition: selectable.h:45
void set_gui_property(const std::string &property_name, const T &value)
Definition: axis_view.h:66
bool marked_for_display() const
Definition: axis_view.cc:80