Merge branch 'chaot4-fix_click_gain_entry_enter'

This commit is contained in:
Paul Davis 2015-11-04 17:49:24 -05:00
commit c034ad26f8
2 changed files with 27 additions and 2 deletions

View File

@ -31,9 +31,10 @@
#include "pbd/configuration.h"
#include "pbd/replace_all.h"
#include "public_editor.h"
#include "option_editor.h"
#include "gui_thread.h"
#include "option_editor.h"
#include "public_editor.h"
#include "utils.h"
#include "i18n.h"
using namespace std;
@ -289,6 +290,8 @@ FaderOption::FaderOption (string const & i, string const & n, sigc::slot<gain_t>
set_size_request_to_display_given_text (_db_display, "-99.00", 12, 12);
_db_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &FaderOption::db_changed));
_db_display.signal_activate().connect (sigc::mem_fun (*this, &FaderOption::on_activate));
_db_display.signal_key_press_event().connect (sigc::mem_fun (*this, &FaderOption::on_key_press), false);
}
void
@ -314,6 +317,26 @@ FaderOption::db_changed ()
_set (slider_position_to_gain_with_max (_db_adjustment.get_value (), Config->get_max_gain()));
}
void
FaderOption::on_activate ()
{
float db_val = atof (_db_display.get_text ().c_str ());
gain_t coeff_val = dB_to_coefficient (db_val);
_db_adjustment.set_value (gain_to_slider_position_with_max (coeff_val, Config->get_max_gain ()));
}
bool
FaderOption::on_key_press (GdkEventKey* ev)
{
if (ARDOUR_UI_UTILS::key_is_legal_for_numeric_entry (ev->keyval)) {
/* drop through to normal handling */
return false;
}
/* illegal key for gain entry */
return true;
}
void
FaderOption::add_to_page (OptionEditorPage* p)
{

View File

@ -582,6 +582,8 @@ public:
private:
void db_changed ();
void on_activate ();
bool on_key_press (GdkEventKey* ev);
Gtk::Adjustment _db_adjustment;
Gtkmm2ext::HSliderController* _db_slider;