Debian Codegraph @

Qt/Qt_MyQSlider.h

raw symbols SCIP
1 /* Copyright 2012 Kjetil S. Matheussen
2
3 This program is free software; you can redistribute it and/or
4 modify it under the terms of the GNU General Public License
5 as published by the Free Software Foundation; either version 2
6 of the License, or (at your option) any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
16
17
18 #ifndef QT_MYQSLIDER_H
19 #define QT_MYQSLIDER_Hcxx . . $ `Qt/Qt_MyQSlider.h:19:9`!
20
21 #include <QSlider>
22 #include <QMouseEvent>
23 #include <QPainter>
24 #include <QTimer>
25 #include <QVector>
26 #include <QApplication>
27 #include <QFont>
28
29 #include "EditorWidget.h"cxx . . $ `<file>/Qt/EditorWidget.h`/
30
31 #include "../common/instruments_proc.h"cxx . . $ `<file>/common/instruments_proc.h`/
32 #include "../common/vector_proc.h"cxx . . $ `<file>/common/vector_proc.h`/
33 #include "../common/settings_proc.h"cxx . . $ `<file>/common/settings_proc.h`/
34
35 #include "../audio/undo_audio_effect_proc.h"cxx . . $ `<file>/audio/undo_audio_effect_proc.h`/
36 #include "../audio/SoundPlugin.h"cxx . . $ `<file>/audio/SoundPlugin.h`/
37 #include "../audio/SoundPlugin_proc.h"cxx . . $ `<file>/audio/SoundPlugin_proc.h`/
38
39 #include "Qt_instruments_proc.h"cxx . . $ `<file>/Qt/Qt_instruments_proc.h`/
40
41 #include "Qt_SliderPainter_proc.h"cxx . . $ `<file>/Qt/Qt_SliderPainter_proc.h`/
42
43 static int scale_intcxx . . $ scale_int(ea6ae529d4ec1c7a).(int x, int x1, int x2, int y1, int y2){
44 return (int)scalecxx . . $ scale(a4708ef16e45b76e).((float)x,(float)x1,(float)x2,(float)y1,(float)y2);
45 }
46
47 struct MyQSlidercxx . . $ MyQSlider#;
48
49 #ifdef COMPILING_RADIUM
50 extern QVector<MyQSlider*> g_all_myqsliders;
51 extern struct Root *root;
52 #else
53 QVectorcxx . . $ QVector#<MyQSlidercxx . . $ MyQSlider#*> g_all_myqsliderscxx . . $ g_all_myqsliders.;
54 #endif
55
56 static int g_minimum_heightcxx . . $ g_minimum_height. = 0;
57
58 struct MyQSlidercxx . . $ MyQSlider# : public QSlidercxx . . $ QSlider#{
59
60 public:
61 struct Patchcxx . . $ Patch# *_patchcxx . . $ MyQSlider#_patch.;
62 int _effect_numcxx . . $ MyQSlider#_effect_num.;
63
64 SliderPaintercxx . . $ SliderPainter# *_paintercxx . . $ MyQSlider#_painter.;
65
66 bool _minimum_size_setcxx . . $ MyQSlider#_minimum_size_set.;
67
68 void initcxx . . $ MyQSlider#init(49f6e7a06ebc5aa8).(){
69 _has_mousecxx . . $ MyQSlider#_has_mouse.=false;
70
71 _patchcxx . . $ MyQSlider#_patch. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
72 _effect_numcxx . . $ MyQSlider#_effect_num. = 0;
73
74 if(g_minimum_heightcxx . . $ g_minimum_height.==0){
75 QFontMetricscxx . . $ QFontMetrics# fmcxx . . $ QFontMetrics#QFontMetrics(d0a4bd0c8524b912).(QApplicationcxx . . $ QApplication#::fontcxx . . $ QApplication#font(a5342c57202bca31).());
76 QRectcxx . . $ QRect# r =fm.boundingRectcxx . . $ QFontMetrics#boundingRect(d8b0a2d97d69e4b8).("In Out 234234 dB"cxx . . $ QString#QString(85c52e162fed56f9).);
77 g_minimum_heightcxx . . $ g_minimum_height. = r.heightcxx . . $ QRect#height(ea6fe5115c70a13f).()+4;
78 printf("Minimum height: %d, family: %s, font pixelsize: %d, font pointsize: %d\n",g_minimum_heightcxx . . $ g_minimum_height.,QApplicationcxx . . $ QApplication#::fontcxx . . $ QApplication#font(a5342c57202bca31).().familycxx . . $ QFont#family(6ef7b6c27b00b43d).().toUtf8cxx . . $ QString#toUtf8(7c2073558a834e49).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).(),QApplicationcxx . . $ QApplication#::fontcxx . . $ QApplication#font(a5342c57202bca31).().pixelSizecxx . . $ QFont#pixelSize(455f465bc33b4cdf).(),QApplicationcxx . . $ QApplication#::fontcxx . . $ QApplication#font(a5342c57202bca31).().pointSizecxx . . $ QFont#pointSize(455f465bc33b4cdf).());
79 }
80
81 _minimum_size_setcxx . . $ MyQSlider#_minimum_size_set. = false; // minimumSize must be set later. I think ui generated code overwrites it when set here.
82
83 _paintercxx . . $ MyQSlider#_painter. = SLIDERPAINTER_createcxx . . $ SLIDERPAINTER_create(aa4da35da68ce0c2).(this);
84
85 g_all_myqsliderscxx . . $ g_all_myqsliders..push_backcxx . . $ QVector#push_back(fe7a8a4d1eddb70).(this);
86 }
87
88 MyQSlidercxx . . $ MyQSlider#MyQSlider(108f35f7aa7f3cf9). ( QWidgetcxx . . $ QWidget# * parent = 0 ) : QSlidercxx . . $ QSlider#(parent) {initcxx . . $ MyQSlider#init(49f6e7a06ebc5aa8).();}
89 MyQSlidercxx . . $ MyQSlider#MyQSlider(370ffd1f04771b4e). ( Qtcxx . . $ Qt/::Orientationcxx . . $ Qt/Orientation# orientation, QWidgetcxx . . $ QWidget# * parent = 0 ) : QSlidercxx . . $ QSlider#(orientation,parent) { initcxx . . $ MyQSlider#init(49f6e7a06ebc5aa8).();}
90
91 ~cxx . . $ MyQSlider#`~MyQSlider`(ced63f7c635d850d).MyQSlidercxx . . $ MyQSlider#(){
92 g_all_myqsliderscxx . . $ g_all_myqsliders..removecxx . . $ QVector#remove(d4f767463ce0a6b3).(g_all_myqsliderscxx . . $ g_all_myqsliders..indexOfcxx . . $ QVector#indexOf(fc79640c865a6596).(this));
93 SLIDERPAINTER_deletecxx . . $ SLIDERPAINTER_delete(8b7a4a0b4199d9a1).(_paintercxx . . $ MyQSlider#_painter.);
94 }
95
96 #if 0
97 void handle_system_delay(bool down){
98 SoundPlugin *plugin = (SoundPlugin*)_patch->patchdata;
99 const SoundPluginType *type = plugin->type;
100
101 if(_effect_num==type->num_effects+EFFNUM_DELAY_TIME){
102 if(down==true)
103 plugin->delay.is_on = false;
104 else
105 plugin->delay.is_on = true;
106 }
107 }
108 #endif
109
110 bool _has_mousecxx . . $ MyQSlider#_has_mouse.;
111
112 void handle_mouse_eventcxx . . $ MyQSlider#handle_mouse_event(702858a82d06265c). ( QMouseEventcxx . . $ QMouseEvent# * event ){
113 //printf("Got mouse press event %d / %d\n",(int)event->x(),(int)event->y());
114 if (orientationcxx . . $ QAbstractSlider#orientation(4cb85ee07ca33cb).() == Qtcxx . . $ Qt/::Verticalcxx . . $ Qt/Vertical.)
115 setValuecxx . . $ QAbstractSlider#setValue(d4f767463ce0a6b3).(scale_intcxx . . $ scale_int(ea6ae529d4ec1c7a).(event->ycxx . . $ QMouseEvent#y(455f465bc33b4cdf).(),heightcxx . . $ QWidget#height(455f465bc33b4cdf).(),0,minimumcxx . . $ QAbstractSlider#minimum(455f465bc33b4cdf).(),maximumcxx . . $ QAbstractSlider#maximum(455f465bc33b4cdf).()));
116 else
117 setValuecxx . . $ QAbstractSlider#setValue(d4f767463ce0a6b3).(scale_intcxx . . $ scale_int(ea6ae529d4ec1c7a).(event->xcxx . . $ QMouseEvent#x(455f465bc33b4cdf).(),0,widthcxx . . $ QWidget#width(455f465bc33b4cdf).(),minimumcxx . . $ QAbstractSlider#minimum(455f465bc33b4cdf).(),maximumcxx . . $ QAbstractSlider#maximum(455f465bc33b4cdf).()));
118
119 event->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).();
120 }
121
122 // mousePressEvent
123 void mousePressEventcxx . . $ MyQSlider#mousePressEvent(702858a82d06265c). ( QMouseEventcxx . . $ QMouseEvent# * event )
124 {
125 //printf("Got mouse pres event %d / %d\n",(int)event->x(),(int)event->y());
126 if (event->buttoncxx . . $ QMouseEvent#button(4a2598559eeedfc9).() == Qtcxx . . $ Qt/::LeftButtoncxx . . $ Qt/LeftButton.){
127
128 #ifdef COMPILING_RADIUM
129 if(_patch!=NULL && _patch->instrument==get_audio_instrument()){
130 Undo_AudioEffect_CurrPos(_patch, _effect_num);
131 //handle_system_delay(true);
132 }
133 #endif
134
135 handle_mouse_eventcxx . . $ MyQSlider#handle_mouse_event(702858a82d06265c).(event);
136 _has_mousecxx . . $ MyQSlider#_has_mouse. = true;
137
138 }else{
139
140 #ifdef COMPILING_RADIUM
141 vector_t options = {0};
142 VECTOR_push_back(&options, "Reset");
143 //VECTOR_push_back(&options, "Set Value");
144
145 int command = GFX_Menu(root->song->tracker_windows, NULL, "", &options);
146
147 if(command==0 && _patch!=NULL && _patch->instrument==get_audio_instrument()){
148 SoundPlugin *plugin = (SoundPlugin*)_patch->patchdata;
149 PLUGIN_reset_one_effect(plugin,_effect_num);
150 GFX_update_instrument_widget(_patch);
151 }
152 #endif
153
154 #if 0
155 else if(command==1 && _patch!=NULL && _patch->instrument==get_audio_instrument()){
156 SoundPlugin *plugin = (SoundPlugin*)_patch->patchdata;
157 char *s = GFX_GetString(root->song->tracker_windows,NULL, (char*)"new value");
158 if(s!=NULL){
159 float value = OS_get_double_from_string(s);
160 Undo_AudioEffect_CurrPos(_patch, _effect_num);
161 PLUGIN_set_effect_value(plugin,-1,_effect_num,value,PLUGIN_STORED_TYPE,PLUGIN_STORE_VALUE);
162 GFX_update_instrument_widget(_patch);
163 }
164 }
165 #endif
166
167 event->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).();
168 }
169 }
170
171 void mouseMoveEventcxx . . $ MyQSlider#mouseMoveEvent(702858a82d06265c). ( QMouseEventcxx . . $ QMouseEvent# * event )
172 {
173 if (_has_mousecxx . . $ MyQSlider#_has_mouse.){
174 handle_mouse_eventcxx . . $ MyQSlider#handle_mouse_event(702858a82d06265c).(event);
175 }else
176 QSlidercxx . . $ QSlider#::mouseMoveEventcxx . . $ QSlider#mouseMoveEvent(702858a82d06265c).(event);
177 }
178
179 void mouseReleaseEventcxx . . $ MyQSlider#mouseReleaseEvent(702858a82d06265c). ( QMouseEventcxx . . $ QMouseEvent# * event )
180 {
181 //printf("Got mouse release event %d / %d\n",(int)event->x(),(int)event->y());
182 if (_has_mousecxx . . $ MyQSlider#_has_mouse.){
183 #if 0
184 if(_patch!=NULL && _patch->instrument==get_audio_instrument()){
185 handle_system_delay(false);
186 }
187 #endif
188 handle_mouse_eventcxx . . $ MyQSlider#handle_mouse_event(702858a82d06265c).(event);
189 _has_mousecxx . . $ MyQSlider#_has_mouse.=false;
190 }else
191 QSlidercxx . . $ QSlider#::mouseReleaseEventcxx . . $ QSlider#mouseReleaseEvent(702858a82d06265c).(event);
192 }
193
194 void paintEventcxx . . $ MyQSlider#paintEvent(f239c9e85d61a220). ( QPaintEventcxx . . $ QPaintEvent# * ev ){
195 if(_minimum_size_setcxx . . $ MyQSlider#_minimum_size_set.==false){
196 _minimum_size_setcxx . . $ MyQSlider#_minimum_size_set.=true;
197 setMinimumHeightcxx . . $ QWidget#setMinimumHeight(d4f767463ce0a6b3).(g_minimum_heightcxx . . $ g_minimum_height.);
198 }
199
200 #if 0
201 {
202 QFontMetrics fm(QApplication::font());
203 //QRect r =fm.boundingRect(SLIDERPAINTER_get_string(_painter));
204 int width = fm.width(SLIDERPAINTER_get_string(_painter)) + 20;
205 if(minimumWidth() < width)
206 setMinimumWidth(width);
207 }
208
209 #endif
210
211 QPaintercxx . . $ QPainter# pcxx . . $ QPainter#QPainter(dd2eedc069b0ab5f).(this);
212 SLIDERPAINTER_paintcxx . . $ SLIDERPAINTER_paint(cc527f67641552e1).(_paintercxx . . $ MyQSlider#_painter.,&p);
213 }
214
215 };
216
217 #endif // QT_MYQSLIDER_H