2005-09-25 14:42:24 -04:00
|
|
|
/*
|
2009-10-14 12:10:01 -04:00
|
|
|
Copyright (C) 2003 Paul Davis
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <cmath>
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include <list>
|
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "pbd/error.h"
|
2012-04-12 07:45:40 -04:00
|
|
|
#include "pbd/convert.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-09-25 16:33:00 -04:00
|
|
|
#include <gtkmm2ext/utils.h>
|
|
|
|
#include <gtkmm2ext/selector.h>
|
|
|
|
#include <gtkmm2ext/gtk_ui.h>
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/session.h"
|
|
|
|
#include "ardour/utils.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#include "public_editor.h"
|
2011-07-06 20:37:13 -04:00
|
|
|
#include "ardour_ui.h"
|
|
|
|
#include "gui_object.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "axis_view.h"
|
2011-08-30 05:48:53 -04:00
|
|
|
#include "utils.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "i18n.h"
|
|
|
|
|
2009-05-12 13:03:42 -04:00
|
|
|
using namespace std;
|
2005-09-25 14:42:24 -04:00
|
|
|
using namespace Gtk;
|
2005-09-25 16:33:00 -04:00
|
|
|
using namespace Gtkmm2ext;
|
2009-12-17 13:24:23 -05:00
|
|
|
using namespace ARDOUR;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-10-05 09:48:09 -04:00
|
|
|
list<Gdk::Color> AxisView::used_colors;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2011-06-01 13:00:29 -04:00
|
|
|
AxisView::AxisView (ARDOUR::Session* sess)
|
2009-12-17 13:24:23 -05:00
|
|
|
: SessionHandlePtr (sess)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
_selected = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
AxisView::~AxisView()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2005-10-05 09:48:09 -04:00
|
|
|
Gdk::Color
|
2005-09-25 14:42:24 -04:00
|
|
|
AxisView::unique_random_color()
|
|
|
|
{
|
2011-08-30 05:48:53 -04:00
|
|
|
return ::unique_random_color (used_colors);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2011-07-06 20:37:13 -04:00
|
|
|
|
|
|
|
string
|
|
|
|
AxisView::gui_property (const string& property_name) const
|
|
|
|
{
|
2011-07-11 16:32:33 -04:00
|
|
|
return gui_object_state().get_string (state_id(), property_name);
|
2011-07-06 20:37:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
AxisView::marked_for_display () const
|
|
|
|
{
|
2011-07-19 13:14:45 -04:00
|
|
|
string const v = gui_property ("visible");
|
2012-04-12 07:45:40 -04:00
|
|
|
return (v == "" || PBD::string_is_affirmative (v));
|
2011-07-06 20:37:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
AxisView::set_marked_for_display (bool yn)
|
|
|
|
{
|
2011-10-07 15:30:44 -04:00
|
|
|
string const v = gui_property ("visible");
|
2012-04-12 07:45:40 -04:00
|
|
|
if (v == "" || yn != PBD::string_is_affirmative (v)) {
|
2011-10-07 15:30:44 -04:00
|
|
|
set_gui_property ("visible", yn);
|
2011-07-06 20:37:13 -04:00
|
|
|
return true; // things changed
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-07-11 16:32:33 -04:00
|
|
|
GUIObjectState&
|
|
|
|
AxisView::gui_object_state()
|
|
|
|
{
|
|
|
|
return *ARDOUR_UI::instance()->gui_object_state;
|
|
|
|
}
|