Debian Codegraph @

Qt/Qt_MyQCheckBox.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 #ifndef QT_MYQCHECKBOX_H
18 #define QT_MYQCHECKBOX_Hcxx . . $ `Qt/Qt_MyQCheckBox.h:18:9`!
19
20 #include <QCheckBox>
21 #include <QMouseEvent>
22 #include <QString>
23
24 #include "../Qt/EditorWidget.h"cxx . . $ `<file>/Qt/EditorWidget.h`/
25
26 #include "../audio/undo_audio_effect_proc.h"cxx . . $ `<file>/audio/undo_audio_effect_proc.h`/
27 #include "../common/undo_patchvoice_proc.h"cxx . . $ `<file>/common/undo_patchvoice_proc.h`/
28
29 #ifdef COMPILING_RADIUM
30 extern struct Root *root;
31 #else
32 extern QColorcxx . . $ QColor# *g_colorscxx . . $ g_colors.;
33 #endif
34
35 static QColorcxx . . $ QColor# mix_colorscxx . . $ mix_colors(79a36d4b1e5ae7b0).(const QColorcxx . . $ QColor# &c1, const QColorcxx . . $ QColor# &c2, float how_much){
36
37 float a1 = how_much;
38 float a2 = 1.0f-a1;
39
40 if(c1.redcxx . . $ QColor#red(ea6fe5115c70a13f).()==0 && c1.greencxx . . $ QColor#green(ea6fe5115c70a13f).()==0 && c1.bluecxx . . $ QColor#blue(ea6fe5115c70a13f).()==0){ // some of the black lines doesn't look look very good.
41 int r = 74*a1 + c2.redcxx . . $ QColor#red(ea6fe5115c70a13f).()*a2;
42 int g = 74*a1 + c2.greencxx . . $ QColor#green(ea6fe5115c70a13f).()*a2;
43 int b = 74*a1 + c2.bluecxx . . $ QColor#blue(ea6fe5115c70a13f).()*a2;
44
45 return QColorcxx . . $ QColor#QColor(2261ffe5112eab06).(r,g,b);
46 }else{
47
48 int r = c1.redcxx . . $ QColor#red(ea6fe5115c70a13f).()*a1 + c2.redcxx . . $ QColor#red(ea6fe5115c70a13f).()*a2;
49 int g = c1.greencxx . . $ QColor#green(ea6fe5115c70a13f).()*a1 + c2.greencxx . . $ QColor#green(ea6fe5115c70a13f).()*a2;
50 int b = c1.bluecxx . . $ QColor#blue(ea6fe5115c70a13f).()*a1 + c2.bluecxx . . $ QColor#blue(ea6fe5115c70a13f).()*a2;
51
52 return QColorcxx . . $ QColor#QColor(2261ffe5112eab06).(r,g,b);
53 }
54 }
55
56 static int get_text_widthcxx . . $ get_text_width(87a9b7c6fe1ccdba).(QStringcxx . . $ QString# text){
57 const QFontMetricscxx . . $ QFontMetrics# fn = QFontMetricscxx . . $ QFontMetrics#QFontMetrics(d0a4bd0c8524b912).(QFontcxx . . $ QFont#QFont(49f6e7a06ebc5aa8).());
58 return fn.widthcxx . . $ QFontMetrics#width(91f46685ef4c12b5).(text);
59 }
60
61 inline static void CHECKBOX_paintcxx . . $ CHECKBOX_paint(467930e9b863030a).(QPaintercxx . . $ QPainter# *painter, bool is_checked, bool is_enabled, int width, int height, QStringcxx . . $ QString# text){
62 #ifdef COMPILING_RADIUM
63 QColor *colors = static_cast<EditorWidget*>(root->song->tracker_windows->os_visual.widget)->colors;
64 #else
65 QColorcxx . . $ QColor# *colors = g_colorscxx . . $ g_colors.;
66 #endif
67
68 QColorcxx . . $ QColor# colcxx . . $ QColor#QColor(ced63f7c635d850d).; // on
69
70 if(text!=cxx . . $ QString#`operator!=`(7d4bdb1abc417636).""){
71 col =cxx . . $ QColor#`operator=`(a3db1be773b26671). colors[13];
72 col =cxx . . $ QColor#`operator=`(fd1b853fb77c9003). mix_colorscxx . . $ mix_colors(79a36d4b1e5ae7b0).(col.lightcxx . . $ QColor#light(a312dab4e0811e0).(70),QColorcxx . . $ QColor#QColor(2261ffe5112eab06).(98,59,33),0.55);//editor->colors[colnum].light(52);
73 col.setAlphacxx . . $ QColor#setAlpha(d4f767463ce0a6b3).(76);
74 }else{
75 col =cxx . . $ QColor#`operator=`(fd1b853fb77c9003). colors[9].lightcxx . . $ QColor#light(a312dab4e0811e0).(52);
76 }
77
78
79 if(is_enabled==false)
80 col.setAlphacxx . . $ QColor#setAlpha(d4f767463ce0a6b3).(col.alphacxx . . $ QColor#alpha(ea6fe5115c70a13f).()/3);
81
82 //col = QColor(106, 104, 100, 255);
83 //col = QColor(0, 107, 156, 255);
84
85 if(is_checked==true){
86 painter->fillRectcxx . . $ QPainter#fillRect(b6f7dd7f1bbb6c84).(1,1,width-2,height-1,col);
87 //painter->setPen(editor->colors[1]);
88 //p.drawRect(0,0,width()-1,height()-1);
89 //p.drawRect(1,1,width()-3,height()-3);
90 }else{
91 painter->setPencxx . . $ QPainter#setPen(129a55e114526ad3).(col);
92 painter->drawRectcxx . . $ QPainter#drawRect(748afa4755bc9595).(1,1,width-3,height-2);
93 painter->drawRectcxx . . $ QPainter#drawRect(748afa4755bc9595).(2,2,width-5,height-4);
94 }
95
96
97 if(text!=cxx . . $ QString#`operator!=`(7d4bdb1abc417636).""){
98 painter->setPencxx . . $ QPainter#setPen(129a55e114526ad3).(colors[15]);
99 painter->drawRectcxx . . $ QPainter#drawRect(748afa4755bc9595).(0,0,width,height);
100
101 //QRect rect(5,3,width-5,height-3);
102 QRectcxx . . $ QRect# rectcxx . . $ QRect#QRect(2261ffe5112eab06).(1,1,width-2,height-1);//5,3,width-5,height-3);
103 QColorcxx . . $ QColor# blackcxx . . $ QColor#QColor(2261ffe5112eab06).(0,0,0);
104 if(is_checked==true)
105 black.setAlphacxx . . $ QColor#setAlpha(d4f767463ce0a6b3).(190);
106 else
107 black.setAlphacxx . . $ QColor#setAlpha(d4f767463ce0a6b3).(120);
108 painter->setPencxx . . $ QPainter#setPen(129a55e114526ad3).(black);
109
110 if(text==cxx . . $ QString#`operator==`(7d4bdb1abc417636)."Loop")
111 text =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). text +cxx . . $ operator+(3d22f08efddf8107). " " +cxx . . $ operator+(eab1ea5b6c36e9b2). QCharcxx . . $ QChar#(8634);
112
113 if(height>width){
114 painter->savecxx . . $ QPainter#save(49f6e7a06ebc5aa8).();
115 painter->translatecxx . . $ QPainter#translate(bc12c9ec15586e6a).(0,0);
116 painter->rotatecxx . . $ QPainter#rotate(ba8836b59fb42830).(90);
117 int text_width = get_text_widthcxx . . $ get_text_width(87a9b7c6fe1ccdba).(textcxx . . $ QString#QString(132dd6869045752b).);
118 int pos = (height-text_width)/2;
119 painter->drawTextcxx . . $ QPainter#drawText(c89d651b24440698).(pos,-5, text);
120 painter->restorecxx . . $ QPainter#restore(49f6e7a06ebc5aa8).();
121 }else{
122 painter->drawTextcxx . . $ QPainter#drawText(5e6899f7fbe08e9d).(rect, Qtcxx . . $ Qt/::AlignCentercxx . . $ Qt/AlignCenter., text);
123 }
124
125 }
126 }
127
128 struct MyQCheckBoxcxx . . $ MyQCheckBox# : public QCheckBoxcxx . . $ QCheckBox#{
129 bool _has_mousecxx . . $ MyQCheckBox#_has_mouse.;
130 struct Patchcxx . . $ Patch# *_patchcxx . . $ MyQCheckBox#_patch.;
131 int _effect_numcxx . . $ MyQCheckBox#_effect_num.;
132 bool _undo_patchvoicecxx . . $ MyQCheckBox#_undo_patchvoice.;
133
134 QStringcxx . . $ QString# vertical_textcxx . . $ MyQCheckBox#vertical_text.;
135
136 void initcxx . . $ MyQCheckBox#init(49f6e7a06ebc5aa8).(){
137 _has_mousecxx . . $ MyQCheckBox#_has_mouse.=false;
138 _patchcxx . . $ MyQCheckBox#_patch. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
139 _effect_numcxx . . $ MyQCheckBox#_effect_num. = 0;
140 _undo_patchvoicecxx . . $ MyQCheckBox#_undo_patchvoice. = false;
141 }
142
143 MyQCheckBoxcxx . . $ MyQCheckBox#MyQCheckBox(108f35f7aa7f3cf9). ( QWidgetcxx . . $ QWidget# * parent = 0 ) : QCheckBoxcxx . . $ QCheckBox#(parent) {initcxx . . $ MyQCheckBox#init(49f6e7a06ebc5aa8).();}
144 MyQCheckBoxcxx . . $ MyQCheckBox#MyQCheckBox(90d5708627041e22). ( const QStringcxx . . $ QString# & text, QWidgetcxx . . $ QWidget# * parent = 0) : QCheckBoxcxx . . $ QCheckBox#(text,parent) {initcxx . . $ MyQCheckBox#init(49f6e7a06ebc5aa8).();}
145
146 void mousePressEventcxx . . $ MyQCheckBox#mousePressEvent(702858a82d06265c). ( QMouseEventcxx . . $ QMouseEvent# * event )
147 {
148 if (event->buttoncxx . . $ QMouseEvent#button(4a2598559eeedfc9).() == Qtcxx . . $ Qt/::LeftButtoncxx . . $ Qt/LeftButton.){
149 //setSliderDown(true);
150 #ifdef COMPILING_RADIUM
151 if(_undo_patchvoice==true)
152 Undo_PatchVoice_CurrPos(_patch,_effect_num);
153 else if(_patch!=NULL)
154 Undo_AudioEffect_CurrPos(_patch, _effect_num);
155 #endif
156 //handle_mouse_event(event);
157 _has_mousecxx . . $ MyQCheckBox#_has_mouse. = true;
158 printf("Got it %p %d. Checked: %d\n",_patchcxx . . $ MyQCheckBox#_patch.,_effect_numcxx . . $ MyQCheckBox#_effect_num.,!isCheckedcxx . . $ QAbstractButton#isChecked(50ce9a9e25b4a850).());
159 setCheckedcxx . . $ QAbstractButton#setChecked(b45ddcbc8423892c).(!isCheckedcxx . . $ QAbstractButton#isChecked(50ce9a9e25b4a850).());
160 }else
161 QCheckBoxcxx . . $ QCheckBox#::mousePressEventcxx . . $ QAbstractButton#mousePressEvent(702858a82d06265c).(event);
162 }
163
164
165 void paintEventcxx . . $ MyQCheckBox#paintEvent(f239c9e85d61a220). ( QPaintEventcxx . . $ QPaintEvent# * ev ){
166 QPaintercxx . . $ QPainter# pcxx . . $ QPainter#QPainter(dd2eedc069b0ab5f).(this);
167
168 if(textcxx . . $ QAbstractButton#text(6ef7b6c27b00b43d).().startsWithcxx . . $ QString#startsWith(8cce4688c16f48f3).("V "cxx . . $ QString#QString(85c52e162fed56f9).)){
169 vertical_textcxx . . $ MyQCheckBox#vertical_text. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). textcxx . . $ QAbstractButton#text(6ef7b6c27b00b43d).().rightcxx . . $ QString#right(3f3c3d0e9c0eb37f).(textcxx . . $ QAbstractButton#text(6ef7b6c27b00b43d).().sizecxx . . $ QString#size(455f465bc33b4cdf).()-2);
170 setTextcxx . . $ QAbstractButton#setText(3520e46b33348bf6).(""cxx . . $ QString#QString(85c52e162fed56f9).);
171 }
172
173 CHECKBOX_paintcxx . . $ CHECKBOX_paint(467930e9b863030a).(&p, isCheckedcxx . . $ QAbstractButton#isChecked(50ce9a9e25b4a850).(), isEnabledcxx . . $ QWidget#isEnabled(50ce9a9e25b4a850).(), widthcxx . . $ QWidget#width(455f465bc33b4cdf).(), heightcxx . . $ QWidget#height(455f465bc33b4cdf).(), vertical_textcxx . . $ MyQCheckBox#vertical_text.!=cxx . . $ QString#`operator!=`(7d4bdb1abc417636)."" ? vertical_textcxx . . $ QString#QString(132dd6869045752b). : textcxx . . $ QAbstractButton#text(6ef7b6c27b00b43d).());
174 }
175 };
176
177
178 #endif // QT_MYQCHECKBOX_H