/[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 2507 by persson, Sun Jan 12 19:37:55 2014 UTC revision 3364 by schoenebeck, Tue Nov 14 18:07:25 2017 UTC
# Line 1  Line 1 
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
# 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 "compat.h"
32    
33  #include <glibmm/convert.h>  #include <glibmm/convert.h>
 #include <gtkmm/adjustment.h>  
 #include <gtkmm/alignment.h>  
34  #include <gtkmm/box.h>  #include <gtkmm/box.h>
35    #include <gtkmm/adjustment.h>
36    #if HAS_GTKMM_ALIGNMENT
37    # include <gtkmm/alignment.h>
38    #endif
39  #include <gtkmm/checkbutton.h>  #include <gtkmm/checkbutton.h>
40  #include <gtkmm/comboboxtext.h>  #include <gtkmm/comboboxtext.h>
41  #include <gtkmm/frame.h>  #include <gtkmm/frame.h>
42  #include <gtkmm/label.h>  #include <gtkmm/label.h>
43  #include <gtkmm/scale.h>  #include <gtkmm/scale.h>
44  #include <gtkmm/spinbutton.h>  #include <gtkmm/spinbutton.h>
45  #include <gtkmm/table.h>  #if USE_GTKMM_GRID
46    # include <gtkmm/grid.h>
47    #else
48    # include <gtkmm/table.h>
49    #endif
50  #include <gtkmm/textview.h>  #include <gtkmm/textview.h>
51    
52  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 12) || GTKMM_MAJOR_VERSION < 2  #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 12) || GTKMM_MAJOR_VERSION < 2
# Line 42  Line 54 
54  #include <gtkmm/tooltips.h>  #include <gtkmm/tooltips.h>
55  #endif  #endif
56    
   
 Glib::ustring gig_to_utf8(const gig::String& gig_string);  
 gig::String gig_from_utf8(const Glib::ustring& utf8_string);  
   
57  int note_value(const Glib::ustring& note);  int note_value(const Glib::ustring& note);
58  Glib::ustring note_str(int note);  Glib::ustring note_str(int note);
59    
# Line 68  protected: Line 76  protected:
76      sigc::signal<void> sig_changed;      sigc::signal<void> sig_changed;
77  };  };
78    
79    class ReadOnlyLabelWidget : public LabelWidget {
80    public:
81        Gtk::Label text;
82    
83        ReadOnlyLabelWidget(const char* leftHandText);
84        ReadOnlyLabelWidget(const char* leftHandText, const char* rightHandText);
85    };
86    
87  class NumEntry : public LabelWidget {  class NumEntry : public LabelWidget {
88  protected:  protected:
89  #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 75  protected: Line 91  protected:
91  #else  #else
92      Glib::RefPtr<Gtk::Adjustment> adjust;      Glib::RefPtr<Gtk::Adjustment> adjust;
93  #endif  #endif
94      Gtk::HScale scale;      HScale scale;
95      Gtk::SpinButton spinbutton;      Gtk::SpinButton spinbutton;
96      Gtk::HBox box;      HBox box;
97    
98      int round_to_int(double x) {      static int round_to_int(double x) {
99          return int(x < 0.0 ? x - 0.5 : x + 0.5);          return int(x < 0.0 ? x - 0.5 : x + 0.5);
100      }      }
101  public:  public:
# Line 191  template<typename T> Line 207  template<typename T>
207  class ChoiceEntry : public LabelWidget {  class ChoiceEntry : public LabelWidget {
208  private:  private:
209      Gtk::ComboBoxText combobox;      Gtk::ComboBoxText combobox;
210    #if HAS_GTKMM_ALIGNMENT
211      Gtk::Alignment align;      Gtk::Alignment align;
212    #endif
213      const T* values;      const T* values;
214  public:  public:
215      ChoiceEntry(const char* labelText);      ChoiceEntry(const char* labelText);
# Line 210  public: Line 228  public:
228    
229  template<typename T>  template<typename T>
230  ChoiceEntry<T>::ChoiceEntry(const char* labelText) :  ChoiceEntry<T>::ChoiceEntry(const char* labelText) :
231    #if HAS_GTKMM_ALIGNMENT
232      LabelWidget(labelText, align),      LabelWidget(labelText, align),
233      align(0, 0, 0, 0),      align(0, 0, 0, 0),
234    #else
235        LabelWidget(labelText, combobox),
236    #endif
237      values(0)      values(0)
238  {  {
239      combobox.signal_changed().connect(sig_changed.make_slot());      combobox.signal_changed().connect(sig_changed.make_slot());
240    #if HAS_GTKMM_ALIGNMENT
241      align.add(combobox);      align.add(combobox);
242    #endif
243  }  }
244    
245  template<typename T>  template<typename T>
# Line 254  class ChoiceEntryLeverageCtrl : public L Line 278  class ChoiceEntryLeverageCtrl : public L
278  private:  private:
279      gig::leverage_ctrl_t value;      gig::leverage_ctrl_t value;
280      Gtk::ComboBoxText combobox;      Gtk::ComboBoxText combobox;
281    #if HAS_GTKMM_ALIGNMENT
282      Gtk::Alignment align;      Gtk::Alignment align;
283    #endif
284      void value_changed();      void value_changed();
285  public:  public:
286      ChoiceEntryLeverageCtrl(const char* labelText);      ChoiceEntryLeverageCtrl(const char* labelText);
287      gig::leverage_ctrl_t get_value() const { return value; }      gig::leverage_ctrl_t get_value() const { return value; }
288      void set_value(gig::leverage_ctrl_t value);      void set_value(gig::leverage_ctrl_t value);
289        void set_tip(const Glib::ustring& tip_text) {
290            combobox.set_tooltip_text(tip_text);
291        }
292  };  };
293    
294    
# Line 280  public: Line 309  public:
309      }      }
310  };  };
311    
312    class BoolBox : public Gtk::CheckButton {
313    public:
314        BoolBox(const char* labelText) : Gtk::CheckButton(labelText) {
315            signal_toggled().connect(sig_changed.make_slot());
316        }
317        bool get_value() const { return get_active(); }
318        void set_value(bool value) { set_active(value); }
319        sigc::signal<void>& signal_value_changed() { return sig_changed; }
320    protected:
321        sigc::signal<void> sig_changed;
322    };
323    
324    
325  class BoolEntryPlus6 : public LabelWidget {  class BoolEntryPlus6 : public LabelWidget {
326  private:  private:
# Line 319  public: Line 360  public:
360  /**  /**
361   * Container widget for LabelWidgets.   * Container widget for LabelWidgets.
362   */   */
363  class Table : public Gtk::Table  class Table :
364    #if USE_GTKMM_GRID
365        public Gtk::Grid
366    #else
367        public Gtk::Table
368    #endif
369  {  {
370  public:  public:
371      Table(int x, int y);      Table(int x, int y);
# Line 327  public: Line 373  public:
373      void add(BoolEntryPlus6& boolentry);      void add(BoolEntryPlus6& boolentry);
374      void add(LabelWidget& labelwidget);      void add(LabelWidget& labelwidget);
375  private:  private:
376    #if USE_GTKMM_GRID
377        int cols;
378    #endif
379      int rowno;      int rowno;
380  };  };
381    
# Line 438  private: Line 487  private:
487    
488      void get_key_range(NoteEntry* eKeyRangeLow,      void get_key_range(NoteEntry* eKeyRangeLow,
489                         NoteEntry* eKeyRangeHigh,                         NoteEntry* eKeyRangeHigh,
490                         gig::range_t M::* range) {                         gig::range_t M::* range) const {
491          eKeyRangeLow->set_value((m->*range).low);          eKeyRangeLow->set_value((m->*range).low);
492          eKeyRangeHigh->set_value((m->*range).high);          eKeyRangeHigh->set_value((m->*range).high);
493      }      }

Legend:
Removed from v.2507  
changed lines
  Added in v.3364

  ViewVC Help
Powered by ViewVC