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
));
42 Gtk::HBox
* b
= Gtk::manage (new Gtk::HBox ());
44 b
->pack_start (*Gtk::manage (new Gtk::Label (_("Value"))));
45 b
->pack_start (value_
);
47 if (p
->line ().get_uses_gain_mapping ()) {
48 b
->pack_start (*Gtk::manage (new Gtk::Label (_("dB"))));
51 get_vbox ()->pack_end (*b
);
54 add_button (Gtk::Stock::CANCEL
, Gtk::RESPONSE_CANCEL
);
55 add_button (Gtk::Stock::APPLY
, Gtk::RESPONSE_ACCEPT
);
56 set_default_response (Gtk::RESPONSE_ACCEPT
);
60 ControlPointDialog::get_y_fraction () const
62 return point_
->line().string_to_fraction (value_
.get_text ());