/[svn]/gigedit/trunk/src/gigedit/regionchooser.cpp
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/regionchooser.cpp

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

revision 3226 by schoenebeck, Fri May 26 22:15:06 2017 UTC revision 3460 by persson, Sat Feb 2 07:48:50 2019 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (C) 2006-2017 Andreas Persson   * Copyright (C) 2006-2019 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 17  Line 17 
17   * 02110-1301 USA.   * 02110-1301 USA.
18   */   */
19    
20    #include "compat.h"
21  #include "global.h"  #include "global.h"
22  #include "regionchooser.h"  #include "regionchooser.h"
23    
# Line 25  Line 26 
26    
27  #include <cairomm/context.h>  #include <cairomm/context.h>
28  #include <gdkmm/general.h>  #include <gdkmm/general.h>
29    #if HAS_GDKMM_SEAT
30    # include <gdkmm/seat.h>
31    #endif
32  #include <gdkmm/cursor.h>  #include <gdkmm/cursor.h>
33  #include <gtkmm/stock.h>  #if HAS_GTKMM_STOCK
34    # include <gtkmm/stock.h>
35    #endif
36  #include <gdkmm/pixbuf.h>  #include <gdkmm/pixbuf.h>
37  #include <gtkmm/spinbutton.h>  #include <gtkmm/spinbutton.h>
38  #include <gtkmm/dialog.h>  #include <gtkmm/dialog.h>
# Line 40  Line 46 
46  struct RegionFeatures {  struct RegionFeatures {
47      int sampleRefs;      int sampleRefs;
48      int loops;      int loops;
49        int validDimRegs;
50    
51      RegionFeatures() {      RegionFeatures() {
52          sampleRefs = loops = 0;          sampleRefs = loops = validDimRegs = 0;
53      }      }
54  };  };
55    
# Line 50  static RegionFeatures regionFeatures(gig Line 57  static RegionFeatures regionFeatures(gig
57      RegionFeatures f;      RegionFeatures f;
58      for (int i = 0; i < rgn->DimensionRegions; ++i) {      for (int i = 0; i < rgn->DimensionRegions; ++i) {
59          gig::DimensionRegion* dr = rgn->pDimensionRegions[i];          gig::DimensionRegion* dr = rgn->pDimensionRegions[i];
60            DimensionCase c = dimensionCaseOf(dr);
61            if (!isUsedCase(c, rgn)) continue;
62            f.validDimRegs++;
63          if (dr->pSample) f.sampleRefs++;          if (dr->pSample) f.sampleRefs++;
64          // the user doesn't care about loop if there is no valid sample reference          // the user doesn't care about loop if there is no valid sample reference
65          if (dr->pSample && dr->SampleLoops) f.loops++;          if (dr->pSample && dr->SampleLoops) f.loops++;
# Line 98  RegionChooser::RegionChooser() : Line 108  RegionChooser::RegionChooser() :
108    
109      loadBuiltInPix();      loadBuiltInPix();
110    
111      // create gray blue hatched pattern      // create blue hatched pattern
112      {      {
113          const int width = grayBlueHatchedPattern->get_width();          const int width = blueHatchedPattern->get_width();
114          const int height = grayBlueHatchedPattern->get_height();          const int height = blueHatchedPattern->get_height();
115          const int stride = grayBlueHatchedPattern->get_rowstride();          const int stride = blueHatchedPattern->get_rowstride();
116    
117          // manually convert from RGBA to ARGB          // manually convert from RGBA to ARGB
118          this->grayBlueHatchedPatternARGB = grayBlueHatchedPattern->copy();          this->blueHatchedPatternARGB = blueHatchedPattern->copy();
119          const int pixelSize = stride / width;          const int pixelSize = stride / width;
120          const int totalPixels = width * height;          const int totalPixels = width * height;
121          assert(pixelSize == 4);          assert(pixelSize == 4);
122          unsigned char* ptr = this->grayBlueHatchedPatternARGB->get_pixels();          unsigned char* ptr = this->blueHatchedPatternARGB->get_pixels();
123          for (int iPixel = 0; iPixel < totalPixels; ++iPixel, ptr += pixelSize) {          for (int iPixel = 0; iPixel < totalPixels; ++iPixel, ptr += pixelSize) {
124              const unsigned char r = ptr[0];              const unsigned char r = ptr[0];
125              const unsigned char g = ptr[1];              const unsigned char g = ptr[1];
# Line 122  RegionChooser::RegionChooser() : Line 132  RegionChooser::RegionChooser() :
132          }          }
133    
134          Cairo::RefPtr<Cairo::ImageSurface> imageSurface = Cairo::ImageSurface::create(          Cairo::RefPtr<Cairo::ImageSurface> imageSurface = Cairo::ImageSurface::create(
135              this->grayBlueHatchedPatternARGB->get_pixels(), Cairo::FORMAT_ARGB32, width, height, stride  #if HAS_CAIROMM_CPP11_ENUMS
136                this->blueHatchedPatternARGB->get_pixels(), Cairo::Surface::Format::ARGB32, width, height, stride
137    #else
138                this->blueHatchedPatternARGB->get_pixels(), Cairo::FORMAT_ARGB32, width, height, stride
139    #endif
140          );          );
141          this->grayBlueHatchedSurfacePattern = Cairo::SurfacePattern::create(imageSurface);          this->blueHatchedSurfacePattern = Cairo::SurfacePattern::create(imageSurface);
142          this->grayBlueHatchedSurfacePattern->set_extend(Cairo::EXTEND_REPEAT);  #if HAS_CAIROMM_CPP11_ENUMS
143            this->blueHatchedSurfacePattern->set_extend(Cairo::Pattern::Extend::REPEAT);
144    #else
145            this->blueHatchedSurfacePattern->set_extend(Cairo::EXTEND_REPEAT);
146    #endif
147      }      }
148    
149      instrument = 0;      instrument = 0;
# Line 159  RegionChooser::RegionChooser() : Line 177  RegionChooser::RegionChooser() :
177      m_VirtKeybPropsBox.show();      m_VirtKeybPropsBox.show();
178      for (int i = 0 ; i < 128 ; i++) key_pressed[i] = false;      for (int i = 0 ; i < 128 ; i++) key_pressed[i] = false;
179    
180      actionGroup = Gtk::ActionGroup::create();      actionGroup = ActionGroup::create();
181    #if USE_GLIB_ACTION
182        actionGroup->add_action(
183            "Properties", sigc::mem_fun(*this, &RegionChooser::show_region_properties)
184        );
185        actionGroup->add_action(
186            "Remove", sigc::mem_fun(*this, &RegionChooser::delete_region)
187        );
188        actionGroup->add_action(
189            "Add", sigc::mem_fun(*this, &RegionChooser::add_region)
190        );
191        actionGroup->add_action(
192            "Dimensions", sigc::mem_fun(*this, &RegionChooser::manage_dimensions)
193        );
194        insert_action_group("PopupMenuInsideRegion", actionGroup);
195    #else
196      actionGroup->add(Gtk::Action::create("Properties",      actionGroup->add(Gtk::Action::create("Properties",
197                                           Gtk::Stock::PROPERTIES),                                           Gtk::Stock::PROPERTIES),
198                       sigc::mem_fun(*this,                       sigc::mem_fun(*this,
# Line 170  RegionChooser::RegionChooser() : Line 203  RegionChooser::RegionChooser() :
203                       sigc::mem_fun(*this, &RegionChooser::add_region));                       sigc::mem_fun(*this, &RegionChooser::add_region));
204      actionGroup->add(Gtk::Action::create("Dimensions", _("Dimensions...")),      actionGroup->add(Gtk::Action::create("Dimensions", _("Dimensions...")),
205                       sigc::mem_fun(*this, &RegionChooser::manage_dimensions));                       sigc::mem_fun(*this, &RegionChooser::manage_dimensions));
206    #endif
207    
208    #if USE_GTKMM_BUILDER
209        uiManager = Gtk::Builder::create();
210        Glib::ustring ui_info =
211            "<interface>"
212            "  <menu id='menu-PopupMenuInsideRegion'>"
213            "    <section>"
214            "      <item>"
215            "        <attribute name='label' translatable='yes'>Properties</attribute>"
216            "        <attribute name='action'>PopupMenuInsideRegion.Properties</attribute>"
217            "      </item>"
218            "      <item>"
219            "        <attribute name='label' translatable='yes'>Dimensions</attribute>"
220            "        <attribute name='action'>PopupMenuInsideRegion.Dimensions</attribute>"
221            "      </item>"
222            "      <item>"
223            "        <attribute name='label' translatable='yes'>Remove</attribute>"
224            "        <attribute name='action'>PopupMenuInsideRegion.Remove</attribute>"
225            "      </item>"
226            "    </section>"
227            "  </menu>"
228            "  <menu id='menu-PopupMenuOutsideRegion'>"
229            "    <section>"
230            "      <item>"
231            "        <attribute name='label' translatable='yes'>Add</attribute>"
232            "        <attribute name='action'>PopupMenuInsideRegion.Add</attribute>"
233            "      </item>"
234            "    </section>"
235            "  </menu>"
236            "</interface>";
237        uiManager->add_from_string(ui_info);
238        
239        popup_menu_inside_region = new Gtk::Menu(
240             Glib::RefPtr<Gio::Menu>::cast_dynamic(
241                 uiManager->get_object("menu-PopupMenuInsideRegion")
242             )
243        );
244        popup_menu_outside_region = new Gtk::Menu(
245             Glib::RefPtr<Gio::Menu>::cast_dynamic(
246                 uiManager->get_object("menu-PopupMenuOutsideRegion")
247             )
248        );
249    #else
250      uiManager = Gtk::UIManager::create();      uiManager = Gtk::UIManager::create();
251      uiManager->insert_action_group(actionGroup);      uiManager->insert_action_group(actionGroup);
252      Glib::ustring ui_info =      Glib::ustring ui_info =
# Line 191  RegionChooser::RegionChooser() : Line 267  RegionChooser::RegionChooser() :
267      popup_menu_outside_region = dynamic_cast<Gtk::Menu*>(      popup_menu_outside_region = dynamic_cast<Gtk::Menu*>(
268          uiManager->get_widget("/PopupMenuOutsideRegion"));          uiManager->get_widget("/PopupMenuOutsideRegion"));
269    
270    #endif // USE_GTKMM_BUILDER
271    
272    #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24)
273    # warning GTKMM4 event registration code missing for regionchooser!
274        //add_events(Gdk::EventMask::BUTTON_PRESS_MASK);
275    #else
276      add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK |      add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK |
277                 Gdk::POINTER_MOTION_MASK | Gdk::POINTER_MOTION_HINT_MASK);                 Gdk::POINTER_MOTION_MASK | Gdk::POINTER_MOTION_HINT_MASK);
278    #endif
279    
280      dimensionManager.region_to_be_changed_signal.connect(      dimensionManager.region_to_be_changed_signal.connect(
281          region_to_be_changed_signal.make_slot()          region_to_be_changed_signal.make_slot()
# Line 212  RegionChooser::RegionChooser() : Line 295  RegionChooser::RegionChooser() :
295          sigc::mem_fun(*this, &RegionChooser::on_note_off_event)          sigc::mem_fun(*this, &RegionChooser::on_note_off_event)
296      );      );
297      set_tooltip_text(_("Right click here for adding new region. Use mouse pointer for moving (dragging) or resizing existing regions (by pointing at region's boundary). Right click on an existing region for more actions."));      set_tooltip_text(_("Right click here for adding new region. Use mouse pointer for moving (dragging) or resizing existing regions (by pointing at region's boundary). Right click on an existing region for more actions."));
298    
299        Settings::singleton()->showTooltips.get_proxy().signal_changed().connect(
300            sigc::mem_fun(*this, &RegionChooser::on_show_tooltips_changed)
301        );
302    
303        on_show_tooltips_changed();
304  }  }
305    
306  RegionChooser::~RegionChooser()  RegionChooser::~RegionChooser()
307  {  {
308  }  }
309    
310    void RegionChooser::on_show_tooltips_changed() {
311        const bool b = Settings::singleton()->showTooltips;
312    
313        set_has_tooltip(b);
314    }
315    
316  void RegionChooser::setModifyAllRegions(bool b) {  void RegionChooser::setModifyAllRegions(bool b) {
317      modifyallregions = b;      modifyallregions = b;
318      // redraw required parts      // redraw required parts
# Line 271  bool RegionChooser::on_draw(const Cairo: Line 366  bool RegionChooser::on_draw(const Cairo:
366  #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
367      const Gdk::Color bg = get_style()->get_bg(Gtk::STATE_NORMAL);      const Gdk::Color bg = get_style()->get_bg(Gtk::STATE_NORMAL);
368  #else  #else
369    #if GTKMM_MAJOR_VERSION > 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION > 24)
370        GdkRGBA gdkBgRGBA;
371        gtk_style_context_get_background_color(get_style_context()->gobj(), &gdkBgRGBA);
372        const Gdk::RGBA bg = Glib::wrap(&gdkBgRGBA, true);
373    # else
374      const Gdk::RGBA bg = get_style_context()->get_background_color();      const Gdk::RGBA bg = get_style_context()->get_background_color();
375    # endif
376  #endif  #endif
377      Gdk::Cairo::set_source_rgba(cr, bg);      Gdk::Cairo::set_source_rgba(cr, bg);
378      cr->paint();      cr->paint();
# Line 377  void RegionChooser::draw_regions(const C Line 478  void RegionChooser::draw_regions(const C
478                  if (region == r)                  if (region == r)
479                      Gdk::Cairo::set_source_rgba(cr, blue);                      Gdk::Cairo::set_source_rgba(cr, blue);
480                  else if (modifyallregions)                  else if (modifyallregions)
481                      cr->set_source(grayBlueHatchedSurfacePattern);                      cr->set_source(blueHatchedSurfacePattern);
482                  else                  else
483                      Gdk::Cairo::set_source_rgba(cr, white);                      Gdk::Cairo::set_source_rgba(cr, white);
484    
# Line 396  void RegionChooser::draw_regions(const C Line 497  void RegionChooser::draw_regions(const C
497          RegionFeatures features = regionFeatures(r);          RegionFeatures features = regionFeatures(r);
498    
499          const bool bShowLoopSymbol = features.loops > 0;          const bool bShowLoopSymbol = features.loops > 0;
500          const bool bShowSampleRefSymbol = features.sampleRefs < r->DimensionRegions;          const bool bShowSampleRefSymbol = features.sampleRefs < features.validDimRegs;
501          if (bShowLoopSymbol || bShowSampleRefSymbol) {          if (bShowLoopSymbol || bShowSampleRefSymbol) {
502              const int margin = 2;              const int margin = 2;
503              const int wRgn = x2 - x;              const int wRgn = x2 - x;
# Line 420  void RegionChooser::draw_regions(const C Line 521  void RegionChooser::draw_regions(const C
521                  const int wPic = 12;                  const int wPic = 12;
522                  const int hPic = 14;                  const int hPic = 14;
523                  Gdk::Cairo::set_source_pixbuf(                  Gdk::Cairo::set_source_pixbuf(
524                      cr, (features.loops == r->DimensionRegions) ? blackLoop : grayLoop,                      cr, (features.loops == features.validDimRegs) ? blackLoop : grayLoop,
525                      x + (wRgn-wPic)/2.f,                      x + (wRgn-wPic)/2.f,
526                      (bShowSampleRefSymbol) ? h1 - hPic - margin : (h1-hPic)/2.f                      (bShowSampleRefSymbol) ? h1 - hPic - margin : (h1-hPic)/2.f
527                  );                  );
# Line 570  bool RegionChooser::on_button_release_ev Line 671  bool RegionChooser::on_button_release_ev
671  #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
672          get_window()->pointer_ungrab(event->time);          get_window()->pointer_ungrab(event->time);
673  #else  #else
674    # if GTKMM_MAJOR_VERSION < 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION < 20)
675          Glib::wrap(event->device, true)->ungrab(event->time);          Glib::wrap(event->device, true)->ungrab(event->time);
676    # else
677            Glib::wrap(event->device, true)->get_seat()->ungrab();
678    # endif
679  #endif  #endif
680          resize.active = false;          resize.active = false;
681    
# Line 582  bool RegionChooser::on_button_release_ev Line 687  bool RegionChooser::on_button_release_ev
687  #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
688          get_window()->pointer_ungrab(event->time);          get_window()->pointer_ungrab(event->time);
689  #else  #else
690    # if GTKMM_MAJOR_VERSION < 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION < 20)
691          Glib::wrap(event->device, true)->ungrab(event->time);          Glib::wrap(event->device, true)->ungrab(event->time);
692    # else
693            Glib::wrap(event->device, true)->get_seat()->ungrab();
694    # endif
695  #endif  #endif
696          move.active = false;          move.active = false;
697    
# Line 590  bool RegionChooser::on_button_release_ev Line 699  bool RegionChooser::on_button_release_ev
699  #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
700              get_window()->set_cursor(Gdk::Cursor(Gdk::SB_H_DOUBLE_ARROW));              get_window()->set_cursor(Gdk::Cursor(Gdk::SB_H_DOUBLE_ARROW));
701  #else  #else
702              get_window()->set_cursor(Gdk::Cursor::create(Gdk::SB_H_DOUBLE_ARROW));              get_window()->set_cursor(
703    # if GTKMM_MAJOR_VERSION < 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION < 20)
704                    Gdk::Cursor::create(Gdk::SB_H_DOUBLE_ARROW)
705    # else
706                    Gdk::Cursor::create(
707                        Glib::wrap(event->device, true)->get_seat()->get_display(),
708                        Gdk::SB_H_DOUBLE_ARROW
709                    )
710    # endif
711                );
712  #endif  #endif
713              cursor_is_resize = true;              cursor_is_resize = true;
714          }          }
# Line 686  bool RegionChooser::on_button_press_even Line 804  bool RegionChooser::on_button_press_even
804                                         Gdk::Cursor(Gdk::SB_H_DOUBLE_ARROW),                                         Gdk::Cursor(Gdk::SB_H_DOUBLE_ARROW),
805                                         event->time);                                         event->time);
806  #else  #else
807    # if GTKMM_MAJOR_VERSION < 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION < 20)
808              Glib::wrap(event->device, true)->grab(get_window(),              Glib::wrap(event->device, true)->grab(get_window(),
809                                                    Gdk::OWNERSHIP_NONE,                                                    Gdk::OWNERSHIP_NONE,
810                                                    false,                                                    false,
# Line 694  bool RegionChooser::on_button_press_even Line 813  bool RegionChooser::on_button_press_even
813                                                    Gdk::POINTER_MOTION_HINT_MASK,                                                    Gdk::POINTER_MOTION_HINT_MASK,
814                                                    Gdk::Cursor::create(Gdk::SB_H_DOUBLE_ARROW),                                                    Gdk::Cursor::create(Gdk::SB_H_DOUBLE_ARROW),
815                                                    event->time);                                                    event->time);
816    # else
817                Glib::wrap(event->device, true)->get_seat()->grab(
818                    get_window(),
819                    Gdk::SeatCapabilities::SEAT_CAPABILITY_ALL_POINTING,
820                    false,
821                    Gdk::Cursor::create(
822                        Glib::wrap(event->device, true)->get_seat()->get_display(),
823                        Gdk::SB_H_DOUBLE_ARROW
824                    ),
825                    reinterpret_cast<GdkEvent*>(event)
826                );
827    # endif
828  #endif  #endif
829              resize.active = true;              resize.active = true;
830          } else {          } else {
# Line 712  bool RegionChooser::on_button_press_even Line 843  bool RegionChooser::on_button_press_even
843                                             Gdk::Cursor(Gdk::FLEUR),                                             Gdk::Cursor(Gdk::FLEUR),
844                                             event->time);                                             event->time);
845  #else  #else
846                  Glib::wrap(event->device, true)->grab(get_window(),  # if GTKMM_MAJOR_VERSION < 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION < 20)
847                                                        Gdk::OWNERSHIP_NONE,              Glib::wrap(event->device, true)->grab(get_window(),
848                                                        false,                                                    Gdk::OWNERSHIP_NONE,
849                                                        Gdk::BUTTON_RELEASE_MASK |                                                    false,
850                                                        Gdk::POINTER_MOTION_MASK |                                                    Gdk::BUTTON_RELEASE_MASK |
851                                                        Gdk::POINTER_MOTION_HINT_MASK,                                                    Gdk::POINTER_MOTION_MASK |
852                                                        Gdk::Cursor::create(Gdk::FLEUR),                                                    Gdk::POINTER_MOTION_HINT_MASK,
853                                                        event->time);                                                    Gdk::Cursor::create(Gdk::FLEUR),
854                                                      event->time);
855    # else
856                Glib::wrap(event->device, true)->get_seat()->grab(
857                    get_window(),
858                    Gdk::SeatCapabilities::SEAT_CAPABILITY_ALL_POINTING,
859                    false,
860                    Gdk::Cursor::create(
861                        Glib::wrap(event->device, true)->get_seat()->get_display(),
862                        Gdk::FLEUR
863                    ),
864                    reinterpret_cast<GdkEvent*>(event)
865                );
866    # endif
867  #endif  #endif
868                  move.active = true;                  move.active = true;
869                  move.offset = event->x - key_to_x(region->KeyRange.low, w);                  move.offset = event->x - key_to_x(region->KeyRange.low, w);
# Line 937  bool RegionChooser::on_motion_notify_eve Line 1081  bool RegionChooser::on_motion_notify_eve
1081  {  {
1082      Glib::RefPtr<Gdk::Window> window = get_window();      Glib::RefPtr<Gdk::Window> window = get_window();
1083      int x, y;      int x, y;
1084    #if HAS_GDKMM_SEAT
1085        x = event->x;
1086        y = event->y;
1087        Gdk::ModifierType state = Gdk::ModifierType(event->state);
1088    #else
1089      Gdk::ModifierType state = Gdk::ModifierType(0);      Gdk::ModifierType state = Gdk::ModifierType(0);
1090      window->get_pointer(x, y, state);      window->get_pointer(x, y, state);
1091    #endif
1092    
1093      // handle virtual MIDI keyboard      // handle virtual MIDI keyboard
1094      if (m_VirtKeybModeChoice.get_value() != VIRT_KEYBOARD_MODE_CHORD &&      if (m_VirtKeybModeChoice.get_value() != VIRT_KEYBOARD_MODE_CHORD &&
# Line 969  bool RegionChooser::on_motion_notify_eve Line 1119  bool RegionChooser::on_motion_notify_eve
1119  #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
1120                  window->set_cursor(Gdk::Cursor(Gdk::SB_H_DOUBLE_ARROW));                  window->set_cursor(Gdk::Cursor(Gdk::SB_H_DOUBLE_ARROW));
1121  #else  #else
1122                  window->set_cursor(Gdk::Cursor::create(Gdk::SB_H_DOUBLE_ARROW));                  window->set_cursor(
1123    # if GTKMM_MAJOR_VERSION < 3 || (GTKMM_MAJOR_VERSION == 3 && GTKMM_MINOR_VERSION < 20)
1124                        Gdk::Cursor::create(Gdk::SB_H_DOUBLE_ARROW)
1125    # else
1126                        Gdk::Cursor::create(
1127                            Glib::wrap(event->device, true)->get_seat()->get_display(),
1128                            Gdk::SB_H_DOUBLE_ARROW
1129                        )
1130    # endif
1131                    );
1132  #endif  #endif
1133                  cursor_is_resize = true;                  cursor_is_resize = true;
1134              }              }
# Line 1049  void RegionChooser::show_region_properti Line 1208  void RegionChooser::show_region_properti
1208      // add "Keygroup" checkbox      // add "Keygroup" checkbox
1209      Gtk::CheckButton checkBoxKeygroup(_("Member of a Keygroup (Exclusive Group)"));      Gtk::CheckButton checkBoxKeygroup(_("Member of a Keygroup (Exclusive Group)"));
1210      checkBoxKeygroup.set_active(region->KeyGroup);      checkBoxKeygroup.set_active(region->KeyGroup);
1211    #if USE_GTKMM_BOX
1212        dialog.get_content_area()->pack_start(checkBoxKeygroup);
1213    #else
1214      dialog.get_vbox()->pack_start(checkBoxKeygroup);      dialog.get_vbox()->pack_start(checkBoxKeygroup);
1215    #endif
1216      checkBoxKeygroup.show();      checkBoxKeygroup.show();
1217      // add "Keygroup" spinbox      // add "Keygroup" spinbox
1218  #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 1059  void RegionChooser::show_region_properti Line 1222  void RegionChooser::show_region_properti
1222      Gtk::SpinButton spinBox(Gtk::Adjustment::create(1, 1, 999));      Gtk::SpinButton spinBox(Gtk::Adjustment::create(1, 1, 999));
1223  #endif  #endif
1224      if (region->KeyGroup) spinBox.set_value(region->KeyGroup);      if (region->KeyGroup) spinBox.set_value(region->KeyGroup);
1225    #if USE_GTKMM_BOX
1226        dialog.get_content_area()->pack_start(spinBox);
1227    #else
1228      dialog.get_vbox()->pack_start(spinBox);      dialog.get_vbox()->pack_start(spinBox);
1229    #endif
1230      spinBox.show();      spinBox.show();
1231      // add OK and CANCEL buttons to the dialog      // add OK and CANCEL buttons to the dialog
1232    #if HAS_GTKMM_STOCK
1233      dialog.add_button(Gtk::Stock::OK, 0);      dialog.add_button(Gtk::Stock::OK, 0);
1234      dialog.add_button(Gtk::Stock::CANCEL, 1);      dialog.add_button(Gtk::Stock::CANCEL, 1);
1235    #else
1236        dialog.add_button(_("_OK"), 0);
1237        dialog.add_button(_("_Cancel"), 1);
1238    #endif
1239      dialog.set_position(Gtk::WIN_POS_MOUSE);      dialog.set_position(Gtk::WIN_POS_MOUSE);
1240    #if HAS_GTKMM_SHOW_ALL_CHILDREN
1241      dialog.show_all_children();      dialog.show_all_children();
1242    #endif
1243      if (!dialog.run()) { // OK selected ...      if (!dialog.run()) { // OK selected ...
1244          region->KeyGroup =          region->KeyGroup =
1245              (checkBoxKeygroup.get_active()) ? spinBox.get_value_as_int() : 0;              (checkBoxKeygroup.get_active()) ? spinBox.get_value_as_int() : 0;

Legend:
Removed from v.3226  
changed lines
  Added in v.3460

  ViewVC Help
Powered by ViewVC