packaging tweaks for OS X
[ardour.git] / gtk2_ardour / axis_view.cc
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 "ardour/session.h"
36 #include "ardour/utils.h"
37
38 #include "public_editor.h"
39 #include "ardour_ui.h"
40 #include "gui_object.h"
41 #include "axis_view.h"
42 #include "utils.h"
43 #include "i18n.h"
44
45 using namespace std;
46 using namespace Gtk;
47 using namespace Gtkmm2ext;
48 using namespace ARDOUR;
49
50 list<Gdk::Color> AxisView::used_colors;
51
52 AxisView::AxisView (ARDOUR::Session* sess)
53         : SessionHandlePtr (sess)
54 {
55         _selected = false;
56 }
57
58 AxisView::~AxisView()
59 {
60 }
61
62 Gdk::Color
63 AxisView::unique_random_color()
64 {
65         return ::unique_random_color (used_colors);
66 }
67
68 string
69 AxisView::gui_property (const string& property_name) const
70 {
71         return gui_object_state().get_string (state_id(), property_name);
72 }
73
74 bool
75 AxisView::marked_for_display () const
76 {
77         string const v = gui_property ("visible");
78         return (v == "" || PBD::string_is_affirmative (v));
79 }
80
81 bool
82 AxisView::set_marked_for_display (bool yn)
83 {
84         string const v = gui_property ("visible");
85         if (v == "" || yn != PBD::string_is_affirmative (v)) {
86                 set_gui_property ("visible", yn);
87                 return true; // things changed
88         }
89
90         return false;
91 }
92
93 GUIObjectState&
94 AxisView::gui_object_state() 
95 {
96         return *ARDOUR_UI::instance()->gui_object_state;
97 }