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

Annotation of /gigedit/trunk/src/gigedit/dimregionchooser.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2246 - (hide annotations) (download) (as text)
Fri Aug 19 10:55:41 2011 UTC (12 years, 7 months ago) by persson
File MIME type: text/x-c++hdr
File size: 2715 byte(s)
* gtkmm 3 fix: rewrote the custom widgets (regionchooser and
  dimregionchooser) so they only draw pixels in the on_draw
  method. This should make them work again in newer gtkmm 3
  environments.

1 schoenebeck 1225 /* -*- c++ -*-
2 persson 2169 * Copyright (C) 2006-2011 Andreas Persson
3 schoenebeck 1225 *
4     * This program is free software; you can redistribute it and/or
5     * modify it under the terms of the GNU General Public License as
6     * published by the Free Software Foundation; either version 2, or (at
7     * your option) any later version.
8     *
9     * This program is distributed in the hope that it will be useful, but
10     * WITHOUT ANY WARRANTY; without even the implied warranty of
11     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12     * General Public License for more details.
13     *
14     * You should have received a copy of the GNU General Public License
15     * along with program; see the file COPYING. If not, write to the Free
16     * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17     * 02110-1301 USA.
18     */
19    
20     #ifndef GIGEDIT_DIMREGIONCHOOSER_H
21     #define GIGEDIT_DIMREGIONCHOOSER_H
22    
23     #include <gtkmm/drawingarea.h>
24     #include <gdkmm/window.h>
25    
26 persson 2169 #include "compat.h"
27    
28 schoenebeck 1225 #include <gig.h>
29    
30 persson 1533 #include <set>
31    
32 schoenebeck 1225 class DimRegionChooser : public Gtk::DrawingArea
33     {
34     public:
35     DimRegionChooser();
36     virtual ~DimRegionChooser();
37    
38     void set_region(gig::Region* region);
39    
40 schoenebeck 1339 sigc::signal<void>& signal_dimregion_selected();
41     sigc::signal<void>& signal_region_changed();
42 schoenebeck 1225
43 persson 1533 gig::DimensionRegion* get_dimregion() const { return dimreg; }
44     void get_dimregions(const gig::Region* region, bool stereo,
45     std::set<gig::DimensionRegion*>& dimregs) const;
46 schoenebeck 1225
47     protected:
48 persson 2169 #if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 90) || GTKMM_MAJOR_VERSION < 2
49 schoenebeck 1225 virtual bool on_expose_event(GdkEventExpose* e);
50 persson 2246 #else
51     virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr);
52 persson 2169 #endif
53 schoenebeck 1225 virtual bool on_button_press_event(GdkEventButton* event);
54     virtual bool on_button_release_event(GdkEventButton* event);
55     virtual bool on_motion_notify_event(GdkEventMotion* event);
56     virtual bool on_focus(Gtk::DirectionType direction);
57    
58 persson 2169 Gdk::RGBA red, black, white;
59 schoenebeck 1225
60     gig::Instrument* instrument;
61     gig::Region* region;
62     int dimregno;
63    
64 persson 1261 sigc::signal<void> dimregion_selected;
65     sigc::signal<void> region_changed;
66 schoenebeck 1225
67     gig::DimensionRegion* dimreg;
68     int focus_line;
69 persson 1303 int dimvalue[256];
70 schoenebeck 1225 int label_width;
71 persson 2246 bool labels_changed;
72 schoenebeck 1225 int nbDimensions;
73    
74     // information needed during a resize
75     struct {
76     bool active;
77     enum {
78     none,
79     left,
80     right
81     } selected;
82     int pos;
83     int min;
84     int max;
85     int dimension;
86     int offset;
87     } resize;
88    
89     bool cursor_is_resize;
90     bool is_in_resize_zone(double x, double y);
91 persson 2246 void update_after_resize();
92 schoenebeck 1225
93     int h;
94     };
95    
96     #endif

  ViewVC Help
Powered by ViewVC