1 |
/* -*- c++ -*- |
/* -*- c++ -*- |
2 |
* Copyright (C) 2006-2014 Andreas Persson |
* Copyright (C) 2006-2017 Andreas Persson |
3 |
* |
* |
4 |
* This program is free software; you can redistribute it and/or |
* This program is free software; you can redistribute it and/or |
5 |
* modify it under the terms of the GNU General Public License as |
* modify it under the terms of the GNU General Public License as |
20 |
#ifndef GIGEDIT_PARAMEDIT_H |
#ifndef GIGEDIT_PARAMEDIT_H |
21 |
#define GIGEDIT_PARAMEDIT_H |
#define GIGEDIT_PARAMEDIT_H |
22 |
|
|
23 |
#include <gig.h> |
#ifdef LIBGIG_HEADER_FILE |
24 |
|
# include LIBGIG_HEADER_FILE(gig.h) |
25 |
|
#else |
26 |
|
# include <gig.h> |
27 |
|
#endif |
28 |
|
|
29 |
#include <cmath> |
#include <cmath> |
30 |
|
|
31 |
#include <glibmm/convert.h> |
#include <glibmm/convert.h> |
32 |
|
#include <gtkmm/box.h> |
33 |
#include <gtkmm/adjustment.h> |
#include <gtkmm/adjustment.h> |
34 |
#include <gtkmm/alignment.h> |
#include <gtkmm/alignment.h> |
|
#include <gtkmm/box.h> |
|
35 |
#include <gtkmm/checkbutton.h> |
#include <gtkmm/checkbutton.h> |
36 |
#include <gtkmm/comboboxtext.h> |
#include <gtkmm/comboboxtext.h> |
37 |
#include <gtkmm/frame.h> |
#include <gtkmm/frame.h> |
46 |
#include <gtkmm/tooltips.h> |
#include <gtkmm/tooltips.h> |
47 |
#endif |
#endif |
48 |
|
|
|
|
|
|
Glib::ustring gig_to_utf8(const gig::String& gig_string); |
|
|
gig::String gig_from_utf8(const Glib::ustring& utf8_string); |
|
|
|
|
49 |
int note_value(const Glib::ustring& note); |
int note_value(const Glib::ustring& note); |
50 |
Glib::ustring note_str(int note); |
Glib::ustring note_str(int note); |
51 |
|
|
68 |
sigc::signal<void> sig_changed; |
sigc::signal<void> sig_changed; |
69 |
}; |
}; |
70 |
|
|
71 |
|
class ReadOnlyLabelWidget : public LabelWidget { |
72 |
|
public: |
73 |
|
Gtk::Label text; |
74 |
|
|
75 |
|
ReadOnlyLabelWidget(const char* leftHandText); |
76 |
|
ReadOnlyLabelWidget(const char* leftHandText, const char* rightHandText); |
77 |
|
}; |
78 |
|
|
79 |
class NumEntry : public LabelWidget { |
class NumEntry : public LabelWidget { |
80 |
protected: |
protected: |
81 |
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
87 |
Gtk::SpinButton spinbutton; |
Gtk::SpinButton spinbutton; |
88 |
Gtk::HBox box; |
Gtk::HBox box; |
89 |
|
|
90 |
int round_to_int(double x) { |
static int round_to_int(double x) { |
91 |
return int(x < 0.0 ? x - 0.5 : x + 0.5); |
return int(x < 0.0 ? x - 0.5 : x + 0.5); |
92 |
} |
} |
93 |
public: |
public: |
268 |
ChoiceEntryLeverageCtrl(const char* labelText); |
ChoiceEntryLeverageCtrl(const char* labelText); |
269 |
gig::leverage_ctrl_t get_value() const { return value; } |
gig::leverage_ctrl_t get_value() const { return value; } |
270 |
void set_value(gig::leverage_ctrl_t value); |
void set_value(gig::leverage_ctrl_t value); |
271 |
|
void set_tip(const Glib::ustring& tip_text) { |
272 |
|
combobox.set_tooltip_text(tip_text); |
273 |
|
} |
274 |
}; |
}; |
275 |
|
|
276 |
|
|
291 |
} |
} |
292 |
}; |
}; |
293 |
|
|
294 |
|
class BoolBox : public Gtk::CheckButton { |
295 |
|
public: |
296 |
|
BoolBox(const char* labelText) : Gtk::CheckButton(labelText) { |
297 |
|
signal_toggled().connect(sig_changed.make_slot()); |
298 |
|
} |
299 |
|
bool get_value() const { return get_active(); } |
300 |
|
void set_value(bool value) { set_active(value); } |
301 |
|
sigc::signal<void>& signal_value_changed() { return sig_changed; } |
302 |
|
protected: |
303 |
|
sigc::signal<void> sig_changed; |
304 |
|
}; |
305 |
|
|
306 |
|
|
307 |
class BoolEntryPlus6 : public LabelWidget { |
class BoolEntryPlus6 : public LabelWidget { |
308 |
private: |
private: |
461 |
|
|
462 |
void get_key_range(NoteEntry* eKeyRangeLow, |
void get_key_range(NoteEntry* eKeyRangeLow, |
463 |
NoteEntry* eKeyRangeHigh, |
NoteEntry* eKeyRangeHigh, |
464 |
gig::range_t M::* range) { |
gig::range_t M::* range) const { |
465 |
eKeyRangeLow->set_value((m->*range).low); |
eKeyRangeLow->set_value((m->*range).low); |
466 |
eKeyRangeHigh->set_value((m->*range).high); |
eKeyRangeHigh->set_value((m->*range).high); |
467 |
} |
} |