2005-05-13 16:47:18 -04:00
|
|
|
/*
|
|
|
|
Copyright (C) 1998-99 Paul Davis
|
|
|
|
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.
|
|
|
|
|
|
|
|
$Id$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include <gtkmm2ext/gtk_ui.h>
|
2006-03-14 21:04:30 -05:00
|
|
|
#include <gtkmm2ext/pixscroller.h>
|
2006-07-07 19:51:30 -04:00
|
|
|
#include <gtkmm2ext/slider_controller.h>
|
2005-05-13 16:47:18 -04:00
|
|
|
|
|
|
|
#include "i18n.h"
|
|
|
|
|
|
|
|
using namespace Gtkmm2ext;
|
2006-07-07 19:51:30 -04:00
|
|
|
using namespace PBD;
|
2005-05-13 16:47:18 -04:00
|
|
|
|
2006-03-14 21:04:30 -05:00
|
|
|
SliderController::SliderController (Glib::RefPtr<Gdk::Pixbuf> slide,
|
|
|
|
Glib::RefPtr<Gdk::Pixbuf> rail,
|
2005-05-13 16:47:18 -04:00
|
|
|
Gtk::Adjustment *adj,
|
2006-07-07 19:51:30 -04:00
|
|
|
Controllable& c,
|
2005-05-13 16:47:18 -04:00
|
|
|
bool with_numeric)
|
|
|
|
|
2006-03-14 21:04:30 -05:00
|
|
|
: PixScroller (*adj, slide, rail),
|
2006-07-07 19:51:30 -04:00
|
|
|
binding_proxy (c),
|
|
|
|
spin (*adj, 0, 2)
|
2005-05-13 16:47:18 -04:00
|
|
|
{
|
|
|
|
spin.set_name ("SliderControllerValue");
|
|
|
|
spin.set_size_request (70,-1); // should be based on font size somehow
|
|
|
|
spin.set_numeric (true);
|
|
|
|
spin.set_snap_to_ticks (false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SliderController::set_value (float v)
|
|
|
|
{
|
|
|
|
adj.set_value (v);
|
|
|
|
}
|
|
|
|
|
2006-07-11 10:15:55 -04:00
|
|
|
bool
|
|
|
|
SliderController::on_button_press_event (GdkEventButton *ev)
|
|
|
|
{
|
|
|
|
if (binding_proxy.button_press_handler (ev)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return PixScroller::on_button_press_event (ev);
|
|
|
|
}
|
|
|
|
|
2006-03-14 21:04:30 -05:00
|
|
|
VSliderController::VSliderController (Glib::RefPtr<Gdk::Pixbuf> slide,
|
|
|
|
Glib::RefPtr<Gdk::Pixbuf> rail,
|
2005-05-13 16:47:18 -04:00
|
|
|
Gtk::Adjustment *adj,
|
2006-07-07 19:51:30 -04:00
|
|
|
Controllable& control,
|
2005-05-13 16:47:18 -04:00
|
|
|
bool with_numeric)
|
|
|
|
|
2006-07-07 19:51:30 -04:00
|
|
|
: SliderController (slide, rail, adj, control, with_numeric)
|
2005-05-13 16:47:18 -04:00
|
|
|
{
|
|
|
|
if (with_numeric) {
|
|
|
|
spin_frame.add (spin);
|
|
|
|
spin_frame.set_shadow_type (Gtk::SHADOW_IN);
|
|
|
|
spin_frame.set_name ("BaseFrame");
|
|
|
|
spin_hbox.pack_start (spin_frame, false, true);
|
|
|
|
// pack_start (spin_hbox, false, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-14 21:04:30 -05:00
|
|
|
HSliderController::HSliderController (Glib::RefPtr<Gdk::Pixbuf> slide,
|
|
|
|
Glib::RefPtr<Gdk::Pixbuf> rail,
|
2005-05-13 16:47:18 -04:00
|
|
|
Gtk::Adjustment *adj,
|
2006-07-07 19:51:30 -04:00
|
|
|
Controllable& control,
|
2005-05-13 16:47:18 -04:00
|
|
|
bool with_numeric)
|
|
|
|
|
2006-07-07 19:51:30 -04:00
|
|
|
: SliderController (slide, rail, adj, control, with_numeric)
|
2005-05-13 16:47:18 -04:00
|
|
|
{
|
|
|
|
if (with_numeric) {
|
|
|
|
spin_frame.add (spin);
|
|
|
|
//spin_frame.set_shadow_type (Gtk::SHADOW_IN);
|
|
|
|
spin_frame.set_name ("BaseFrame");
|
|
|
|
spin_hbox.pack_start (spin_frame, false, true);
|
|
|
|
// pack_start (spin_hbox, false, false);
|
|
|
|
}
|
|
|
|
}
|