1 |
/* -*- c++ -*- |
/* -*- c++ -*- |
2 |
* Copyright (C) 2006-2013 Andreas Persson |
* Copyright (C) 2006-2014 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 |
24 |
|
|
25 |
#include <cmath> |
#include <cmath> |
26 |
|
|
27 |
|
#include <glibmm/convert.h> |
28 |
#include <gtkmm/adjustment.h> |
#include <gtkmm/adjustment.h> |
29 |
#include <gtkmm/alignment.h> |
#include <gtkmm/alignment.h> |
30 |
#include <gtkmm/box.h> |
#include <gtkmm/box.h> |
42 |
#include <gtkmm/tooltips.h> |
#include <gtkmm/tooltips.h> |
43 |
#endif |
#endif |
44 |
|
|
45 |
|
|
46 |
|
Glib::ustring gig_to_utf8(const gig::String& gig_string); |
47 |
|
gig::String gig_from_utf8(const Glib::ustring& utf8_string); |
48 |
|
|
49 |
|
int note_value(const Glib::ustring& note); |
50 |
|
Glib::ustring note_str(int note); |
51 |
|
|
52 |
|
void spin_button_show_notes(Gtk::SpinButton& spin_button); |
53 |
|
|
54 |
class LabelWidget { |
class LabelWidget { |
55 |
public: |
public: |
56 |
Gtk::Label label; |
Gtk::Label label; |
211 |
template<typename T> |
template<typename T> |
212 |
ChoiceEntry<T>::ChoiceEntry(const char* labelText) : |
ChoiceEntry<T>::ChoiceEntry(const char* labelText) : |
213 |
LabelWidget(labelText, align), |
LabelWidget(labelText, align), |
214 |
align(0, 0, 0, 0) |
align(0, 0, 0, 0), |
215 |
|
values(0) |
216 |
{ |
{ |
217 |
combobox.signal_changed().connect(sig_changed.make_slot()); |
combobox.signal_changed().connect(sig_changed.make_slot()); |
218 |
align.add(combobox); |
align.add(combobox); |
222 |
void ChoiceEntry<T>::set_choices(const char** texts, const T* values) |
void ChoiceEntry<T>::set_choices(const char** texts, const T* values) |
223 |
{ |
{ |
224 |
for (int i = 0 ; texts[i] ; i++) { |
for (int i = 0 ; texts[i] ; i++) { |
225 |
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2 |
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 24) || GTKMM_MAJOR_VERSION < 2 |
226 |
combobox.append_text(texts[i]); |
combobox.append_text(texts[i]); |
227 |
#else |
#else |
228 |
combobox.append(texts[i]); |
combobox.append(texts[i]); |
260 |
ChoiceEntryLeverageCtrl(const char* labelText); |
ChoiceEntryLeverageCtrl(const char* labelText); |
261 |
gig::leverage_ctrl_t get_value() const { return value; } |
gig::leverage_ctrl_t get_value() const { return value; } |
262 |
void set_value(gig::leverage_ctrl_t value); |
void set_value(gig::leverage_ctrl_t value); |
263 |
|
void set_tip(const Glib::ustring& tip_text) { |
264 |
|
combobox.set_tooltip_text(tip_text); |
265 |
|
} |
266 |
}; |
}; |
267 |
|
|
268 |
|
|
296 |
void set_value(int32_t value); |
void set_value(int32_t value); |
297 |
}; |
}; |
298 |
|
|
299 |
|
|
300 |
class StringEntry : public LabelWidget { |
class StringEntry : public LabelWidget { |
301 |
private: |
private: |
302 |
Gtk::Entry entry; |
Gtk::Entry entry; |
303 |
public: |
public: |
304 |
StringEntry(const char* labelText); |
StringEntry(const char* labelText); |
305 |
gig::String get_value() const { return entry.get_text(); } |
gig::String get_value() const; |
306 |
void set_value(gig::String value) { entry.set_text(value); } |
void set_value(const gig::String& value); |
307 |
void set_width_chars(int n_chars) { entry.set_width_chars(n_chars); } |
void set_width_chars(int n_chars) { entry.set_width_chars(n_chars); } |
308 |
}; |
}; |
309 |
|
|
315 |
public: |
public: |
316 |
StringEntryMultiLine(const char* labelText); |
StringEntryMultiLine(const char* labelText); |
317 |
gig::String get_value() const; |
gig::String get_value() const; |
318 |
void set_value(gig::String value); |
void set_value(const gig::String& value); |
319 |
}; |
}; |
320 |
|
|
321 |
|
|
349 |
protected: |
protected: |
350 |
M* m; |
M* m; |
351 |
int update_model; // to prevent infinite update loops |
int update_model; // to prevent infinite update loops |
352 |
PropEditor() : update_model(0) { } |
PropEditor() : m(0), update_model(0) { } |
353 |
sigc::signal<void> sig_changed; |
sigc::signal<void> sig_changed; |
354 |
|
|
355 |
template<class C, typename T> |
template<class C, typename T> |