fixup auto-connection of new MIDI tracks and MIDI tracks with newly-added audio ports
[ardour2.git] / gtk2_ardour / control_point_dialog.cc
blob178b2f5feb0128f00520a015205f262953c1829e
1 /*
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"
23 #include "i18n.h"
24 #include <gtkmm/stock.h>
26 /**
27 * ControlPointDialog constructor.
29 * @param p ControlPoint to edit.
32 ControlPointDialog::ControlPointDialog (ControlPoint* p)
33 : ArdourDialog (_("Control point")),
34 point_ (p)
36 assert (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);
52 b->show_all ();
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);
59 double
60 ControlPointDialog::get_y_fraction () const
62 return point_->line().string_to_fraction (value_.get_text ());