2
Copyright (C) 2000-2008 Paul Davis
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.
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.
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.
20
#include "control_point_dialog.h"
21
#include "control_point.h"
22
#include "automation_line.h"
24
#include <gtkmm/stock.h>
27
* ControlPointDialog constructor.
29
* @param p ControlPoint to edit.
32
ControlPointDialog::ControlPointDialog (ControlPoint* p)
33
: ArdourDialog (_("Control point")),
38
double const y_fraction = 1.0 - (p->get_y () / p->line().height ());
40
value_.set_text (p->line().fraction_to_string (y_fraction));
41
value_.set_activates_default ();
43
Gtk::HBox* b = Gtk::manage (new Gtk::HBox ());
45
b->pack_start (*Gtk::manage (new Gtk::Label (_("Value"))));
46
b->pack_start (value_);
48
if (p->line ().get_uses_gain_mapping ()) {
49
b->pack_start (*Gtk::manage (new Gtk::Label (_("dB"))));
52
get_vbox ()->pack_end (*b);
55
add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
56
add_button (Gtk::Stock::APPLY, Gtk::RESPONSE_ACCEPT);
57
set_default_response (Gtk::RESPONSE_ACCEPT);
61
ControlPointDialog::get_y_fraction () const
63
return point_->line().string_to_fraction (value_.get_text ());