/[svn]/gigedit/trunk/src/gigedit/paramedit.h
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/paramedit.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2423 by persson, Sun Feb 24 15:19:39 2013 UTC revision 3329 by schoenebeck, Sun Jul 23 18:31:53 2017 UTC
# Line 1  Line 1 
1  /*                                                         -*- c++ -*-  /*                                                         -*- c++ -*-
2   * Copyright (C) 2006-2013 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
# Line 20  Line 20 
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>
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>
# Line 41  Line 46 
46  #include <gtkmm/tooltips.h>  #include <gtkmm/tooltips.h>
47  #endif  #endif
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;
# Line 58  protected: Line 68  protected:
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
# Line 69  protected: Line 87  protected:
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:
# Line 201  public: Line 219  public:
219  template<typename T>  template<typename T>
220  ChoiceEntry<T>::ChoiceEntry(const char* labelText) :  ChoiceEntry<T>::ChoiceEntry(const char* labelText) :
221      LabelWidget(labelText, align),      LabelWidget(labelText, align),
222      align(0, 0, 0, 0)      align(0, 0, 0, 0),
223        values(0)
224  {  {
225      combobox.signal_changed().connect(sig_changed.make_slot());      combobox.signal_changed().connect(sig_changed.make_slot());
226      align.add(combobox);      align.add(combobox);
# Line 211  template<typename T> Line 230  template<typename T>
230  void ChoiceEntry<T>::set_choices(const char** texts, const T* values)  void ChoiceEntry<T>::set_choices(const char** texts, const T* values)
231  {  {
232      for (int i = 0 ; texts[i] ; i++) {      for (int i = 0 ; texts[i] ; i++) {
233  #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
234          combobox.append_text(texts[i]);          combobox.append_text(texts[i]);
235  #else  #else
236          combobox.append(texts[i]);          combobox.append(texts[i]);
# Line 249  public: Line 268  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    
# Line 269  public: Line 291  public:
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:
# Line 282  public: Line 316  public:
316      void set_value(int32_t value);      void set_value(int32_t value);
317  };  };
318    
319    
320  class StringEntry : public LabelWidget {  class StringEntry : public LabelWidget {
321  private:  private:
322      Gtk::Entry entry;      Gtk::Entry entry;
323  public:  public:
324      StringEntry(const char* labelText);      StringEntry(const char* labelText);
325      gig::String get_value() const { return entry.get_text(); }      gig::String get_value() const;
326      void set_value(gig::String value) { entry.set_text(value); }      void set_value(const gig::String& value);
327      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); }
328  };  };
329    
# Line 300  private: Line 335  private:
335  public:  public:
336      StringEntryMultiLine(const char* labelText);      StringEntryMultiLine(const char* labelText);
337      gig::String get_value() const;      gig::String get_value() const;
338      void set_value(gig::String value);      void set_value(const gig::String& value);
339  };  };
340    
341    
# Line 334  public: Line 369  public:
369  protected:  protected:
370      M* m;      M* m;
371      int update_model; // to prevent infinite update loops      int update_model; // to prevent infinite update loops
372      PropEditor() : update_model(0) { }      PropEditor() : m(0), update_model(0) { }
373      sigc::signal<void> sig_changed;      sigc::signal<void> sig_changed;
374    
375      template<class C, typename T>      template<class C, typename T>
# Line 426  private: Line 461  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      }      }

Legend:
Removed from v.2423  
changed lines
  Added in v.3329

  ViewVC Help
Powered by ViewVC