Debian Codegraph @

src/board/board.cpp

raw symbols SCIP
1 /***************************************************************************
2 * Copyright (C) 2009 by The qGo Project *
3 * *
4 * This file is part of qGo. *
5 * *
6 * qGo is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, see <http://www.gnu.org/licenses/> *
18 * or write to the Free Software Foundation, Inc., *
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
20 ***************************************************************************/
21
22
23 /*
24 * board.cpp
25 * This 'board' class handles graphics (wooden and table background,
26 * gatter, coordinates,
27 * specific cursor, stones and variaton marks.
28 * It does not know about the game tree or the matrix,
29 * and takes its orders only from boardhandler
30 */
31 #include "board.h"cxx . . $ `<file>/src/board/board.h`/
32 #include "stone.h"cxx . . $ `<file>/src/board/stone.h`/
33 #include "gatter.h"cxx . . $ `<file>/src/board/gatter.h`/
34 #include "mark.h"cxx . . $ `<file>/src/board/mark.h`/
35 #include "imagehandler.h"cxx . . $ `<file>/src/board/imagehandler.h`/
36 #include "move.h"cxx . . $ `<file>/src/game_tree/move.h`/ //for updateLastMove, cleaner and yet not FIXME
37 #include "graphicsitemstypes.h"cxx . . $ `<file>/src/board/graphicsitemstypes.h`/
38 #include "matrix.h"cxx . . $ `<file>/src/game_tree/matrix.h`/
39
40 #include <QMouseEvent>
41 #include <QApplication>
42 #include <QMessageBox>
43 #include <QClipboard>
44
45 class ImageHandlercxx . . $ ImageHandler#;
46
47
48 /*
49 * This initialises everything on the board : background, gatter, cursor, etc ....
50 */
51 Boardcxx . . $ Board#::Boardcxx . . $ Board#Board(569870a2e0b0fd5d).(QWidgetcxx . . $ QWidget# *parent, QGraphicsScenecxx . . $ QGraphicsScene# *c)
52 : QGraphicsViewcxx . . $ QGraphicsView#QGraphicsView(ee53af431a88de61).(c,parent), oneColorGocxx . . $ Board#oneColorGo.(false)
53 {
54 QSettingscxx . . $ QSettings# settingscxx . . $ QSettings#QSettings(749de1b6ae65bddd).;
55
56 setHorizontalScrollBarPolicycxx . . $ QAbstractScrollArea#setHorizontalScrollBarPolicy(ec1b3becc657ee30).(Qtcxx . . $ Qt/::ScrollBarAlwaysOffcxx . . $ Qt/ScrollBarAlwaysOff.);
57 setVerticalScrollBarPolicycxx . . $ QAbstractScrollArea#setVerticalScrollBarPolicy(ec1b3becc657ee30).(Qtcxx . . $ Qt/::ScrollBarAlwaysOffcxx . . $ Qt/ScrollBarAlwaysOff.);
58 isDisplayBoardcxx . . $ Board#isDisplayBoard. = false;
59 lockResizecxx . . $ Board#lockResize. = false;
60 showCoordscxx . . $ Board#showCoords. = true;//TODO setting->readBoolEntry("BOARD_COORDS");
61 showSGFCoordscxx . . $ Board#showSGFCoords. = false;//TODO setting->readBoolEntry("SGF_BOARD_COORDS");
62 //antiClicko = setting->readBoolEntry("ANTICLICKO");
63
64 curXcxx . . $ Board#curX. = curYcxx . . $ Board#curY. = -1;
65 downXcxx . . $ Board#downX. = downYcxx . . $ Board#downY. = -1;
66
67 coordTypecxx . . $ Board#coordType. = uninitcxx . . $ uninit.;
68 markscxx . . $ Board#marks. = new QListcxx . . $ QList#<Markcxx . . $ Mark#*>;
69 stonescxx . . $ Board#stones. = new QHashcxx . . $ QHash#<int,Stonecxx . . $ Stone# *>();
70 ghostscxx . . $ Board#ghosts. = new QListcxx . . $ QList#<Stonecxx . . $ Stone#*>;
71 lastMoveMarkcxx . . $ Board#lastMoveMark. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
72 gattercxx . . $ Board#gatter. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
73
74 vCoords1cxx . . $ Board#vCoords1. = new QListcxx . . $ QList#<QGraphicsSimpleTextItemcxx . . $ QGraphicsSimpleTextItem#*>;
75 hCoords1cxx . . $ Board#hCoords1. = new QListcxx . . $ QList#<QGraphicsSimpleTextItemcxx . . $ QGraphicsSimpleTextItem#*>;
76 vCoords2cxx . . $ Board#vCoords2. = new QListcxx . . $ QList#<QGraphicsSimpleTextItemcxx . . $ QGraphicsSimpleTextItem#*>;
77 hCoords2cxx . . $ Board#hCoords2. = new QListcxx . . $ QList#<QGraphicsSimpleTextItemcxx . . $ QGraphicsSimpleTextItem#*>;
78
79 imageHandlercxx . . $ Board#imageHandler. = new ImageHandlercxx . . $ ImageHandler#ImageHandler(49f6e7a06ebc5aa8).();
80 Q_CHECK_PTRcxx . . $ `<external>/15045578679651060896/qglobal.h:890:11`!(imageHandler);
81
82 // Init the canvas
83 canvascxx . . $ Board#canvas. = new QGraphicsScenecxx . . $ QGraphicsScene#QGraphicsScene(5b2c4b4492317ea0).(0,0, BOARD_Xcxx . . $ `src/defines.h:36:9`!, BOARD_Ycxx . . $ `src/defines.h:37:9`!,this);
84 Q_CHECK_PTRcxx . . $ `<external>/15045578679651060896/qglobal.h:890:11`!(canvas);
85 // Set background texture
86 canvascxx . . $ Board#canvas.->setBackgroundBrushcxx . . $ QGraphicsScene#setBackgroundBrush(ffc9f5d0bda78261).(QBrushcxx . . $ QBrush#QBrush(8887f7d25b86c3f4).(*(ImageHandlercxx . . $ ImageHandler#::getTablePixmapcxx . . $ ImageHandler#getTablePixmap(238698adec9265ce).( settings.valuecxx . . $ QSettings#value(12a1b1749da49362).("SKIN_TABLE"cxx . . $ QString#QString(85c52e162fed56f9).).toStringcxx . . $ QVariant#toString(6ef7b6c27b00b43d).()))));
87 tablecxx . . $ Board#table. = canvascxx . . $ Board#canvas.->addRectcxx . . $ QGraphicsScene#addRect(4cc5bcb628929ca5).(QRectFcxx . . $ QRectF#QRectF(ced63f7c635d850d).(),
88 QPencxx . . $ QPen#QPen(de7d79e7246fa26d).(Qtcxx . . $ Qt/::NoPencxx . . $ Qt/NoPen.),
89 QBrushcxx . . $ QBrush#QBrush(8887f7d25b86c3f4).(* (ImageHandlercxx . . $ ImageHandler#::getBoardPixmapcxx . . $ ImageHandler#getBoardPixmap(238698adec9265ce).(settings.valuecxx . . $ QSettings#value(12a1b1749da49362).("SKIN"cxx . . $ QString#QString(85c52e162fed56f9).).toStringcxx . . $ QVariant#toString(6ef7b6c27b00b43d).()))));
90
91 //setRenderHints(QPainter::SmoothPixmapTransform);
92 setScenecxx . . $ QGraphicsView#setScene(36f1b6a6c9a93129).(canvascxx . . $ Board#canvas.);
93 viewportcxx . . $ QAbstractScrollArea#viewport(27f420ad5cce8994).()->setMouseTrackingcxx . . $ QWidget#setMouseTracking(b45ddcbc8423892c).(true);
94
95 initcxx . . $ Board#init(d4f767463ce0a6b3).(DEFAULT_BOARD_SIZEcxx . . $ `src/defines.h:35:9`!);
96
97 // Init the ghost cursor stone
98 cursorcxx . . $ Board#cursor. = cursorIdlecxx . . $ cursorIdle.;
99 curStonecxx . . $ Board#curStone. = new Stonecxx . . $ Stone#Stone(72804590282d8142).(imageHandlercxx . . $ Board#imageHandler.->getGhostPixmapscxx . . $ ImageHandler#getGhostPixmaps(4d7a006e8cda1ecc).(), canvascxx . . $ Board#canvas., stoneBlackcxx . . $ stoneBlack., 0, 0);
100 curStonecxx . . $ Board#curStone.->setZValuecxx . . $ QGraphicsItem#setZValue(ba8836b59fb42830).(4);
101 curStonecxx . . $ Board#curStone.->hidecxx . . $ Stone#hide(49f6e7a06ebc5aa8).();
102 showCursorcxx . . $ Board#showCursor. = false;
103
104 setUpdatesEnabledcxx . . $ QWidget#setUpdatesEnabled(b45ddcbc8423892c).(true);
105 }
106
107 Boardcxx . . $ Board#::~cxx . . $ Board#`~Board`(ced63f7c635d850d).Boardcxx . . $ Board#()
108 {
109 setUpdatesEnabledcxx . . $ QWidget#setUpdatesEnabled(b45ddcbc8423892c).(false);
110
111 delete stonescxx . . $ Board#stones.;
112 delete ghostscxx . . $ Board#ghosts.;
113 delete markscxx . . $ Board#marks.;
114
115 delete hCoords1cxx . . $ Board#hCoords1.;
116 delete hCoords2cxx . . $ Board#hCoords2.;
117 delete vCoords1cxx . . $ Board#vCoords1.;
118 delete vCoords2cxx . . $ Board#vCoords2.;
119 delete gattercxx . . $ Board#gatter.;
120 delete imageHandlercxx . . $ Board#imageHandler.;
121
122 delete canvascxx . . $ Board#canvas.; // Also deletes all remaining QGraphicsItem's
123 }
124
125 void Boardcxx . . $ Board#::initcxx . . $ Board#init(d4f767463ce0a6b3).(int size)
126 {
127 board_sizecxx . . $ Board#board_size. = size;
128 if (gattercxx . . $ Board#gatter. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
129 delete gattercxx . . $ Board#gatter.;
130 gattercxx . . $ Board#gatter. = new Gattercxx . . $ Gatter#Gatter(32be5b8e64b3b51b).(canvascxx . . $ Board#canvas., board_sizecxx . . $ Board#board_size.);
131 setupCoordscxx . . $ Board#setupCoords(49f6e7a06ebc5aa8).();
132 resizeBoardcxx . . $ Board#resizeBoard(49f6e7a06ebc5aa8).();
133 }
134
135 void Boardcxx . . $ Board#::setupCoordscxx . . $ Board#setupCoords(49f6e7a06ebc5aa8).(void)
136 {
137 qDeleteAllcxx . . $ qDeleteAll(77d9f17553126ecb).(*hCoords1cxx . . $ Board#hCoords1.);
138 qDeleteAllcxx . . $ qDeleteAll(77d9f17553126ecb).(*hCoords2cxx . . $ Board#hCoords2.);
139 qDeleteAllcxx . . $ qDeleteAll(77d9f17553126ecb).(*vCoords1cxx . . $ Board#vCoords1.);
140 qDeleteAllcxx . . $ qDeleteAll(77d9f17553126ecb).(*vCoords2cxx . . $ Board#vCoords2.);
141 hCoords1cxx . . $ Board#hCoords1.->clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).();
142 hCoords2cxx . . $ Board#hCoords2.->clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).();
143 vCoords1cxx . . $ Board#vCoords1.->clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).();
144 vCoords2cxx . . $ Board#vCoords2.->clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).();
145 QStringcxx . . $ QString# hTxtcxx . . $ QString#QString(ced63f7c635d850d).,vTxtcxx . . $ QString#QString(ced63f7c635d850d).;
146
147 // Init the coordinates
148 QGraphicsSimpleTextItemcxx . . $ QGraphicsSimpleTextItem# *tmp;
149 for (int i=0; i<board_sizecxx . . $ Board#board_size.; i++)
150 {
151 switch(coordTypecxx . . $ Board#coordType.)
152 {
153 case sgfcxx . . $ sgf.:
154 vTxt =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(f2c90172ce699d92).(QCharcxx . . $ QChar#(static_cast<const char>('a' + i)));
155 hTxt =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(f2c90172ce699d92).(QCharcxx . . $ QChar#(static_cast<const char>('a' + i)));
156 break;
157 case numberbottomicxx . . $ numberbottomi.:
158 vTxt =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(i + 1);
159 hTxt =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(f2c90172ce699d92).(QCharcxx . . $ QChar#(static_cast<const char>('A' + i)));
160 break;
161 case numbertopnoicxx . . $ numbertopnoi.:
162 default:
163 vTxt =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(board_sizecxx . . $ Board#board_size. - i);
164 hTxt =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(f2c90172ce699d92).(QCharcxx . . $ QChar#(static_cast<const char>('A' + (i<8?i:i+1))));
165 break;
166 }
167
168 tmp = new QGraphicsSimpleTextItemcxx . . $ QGraphicsSimpleTextItem#QGraphicsSimpleTextItem(916db686a46811b8).(vTxt, 0);
169 vCoords1cxx . . $ Board#vCoords1.->appendcxx . . $ QList#append(77d9f17553126ecb).(tmp);
170 canvascxx . . $ Board#canvas.->addItemcxx . . $ QGraphicsScene#addItem(af50d9c5bfd58279).(tmp);
171 tmp = new QGraphicsSimpleTextItemcxx . . $ QGraphicsSimpleTextItem#QGraphicsSimpleTextItem(916db686a46811b8).(hTxt, 0);
172 hCoords1cxx . . $ Board#hCoords1.->appendcxx . . $ QList#append(77d9f17553126ecb).(tmp);
173 canvascxx . . $ Board#canvas.->addItemcxx . . $ QGraphicsScene#addItem(af50d9c5bfd58279).(tmp);
174 tmp = new QGraphicsSimpleTextItemcxx . . $ QGraphicsSimpleTextItem#QGraphicsSimpleTextItem(916db686a46811b8).(vTxt, 0);
175 vCoords2cxx . . $ Board#vCoords2.->appendcxx . . $ QList#append(77d9f17553126ecb).(tmp);
176 canvascxx . . $ Board#canvas.->addItemcxx . . $ QGraphicsScene#addItem(af50d9c5bfd58279).(tmp);
177 tmp = new QGraphicsSimpleTextItemcxx . . $ QGraphicsSimpleTextItem#QGraphicsSimpleTextItem(916db686a46811b8).(hTxt, 0);
178 hCoords2cxx . . $ Board#hCoords2.->appendcxx . . $ QList#append(77d9f17553126ecb).(tmp);
179 canvascxx . . $ Board#canvas.->addItemcxx . . $ QGraphicsScene#addItem(af50d9c5bfd58279).(tmp);
180 }
181 }
182
183 /*
184 * cleans up the board
185 */
186 void Boardcxx . . $ Board#::clearDatacxx . . $ Board#clearData(49f6e7a06ebc5aa8).()
187 {
188 qDeleteAllcxx . . $ qDeleteAll(77d9f17553126ecb).(*stonescxx . . $ Board#stones.);
189 stonescxx . . $ Board#stones.->clearcxx . . $ QHash#clear(49f6e7a06ebc5aa8).();
190 qDeleteAllcxx . . $ qDeleteAll(77d9f17553126ecb).(*ghostscxx . . $ Board#ghosts.);
191 ghostscxx . . $ Board#ghosts.->clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).();
192 qDeleteAllcxx . . $ qDeleteAll(77d9f17553126ecb).(*markscxx . . $ Board#marks.);
193 markscxx . . $ Board#marks.->clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).();
194
195 updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).();
196 }
197
198 /*
199 * Calculates the size of the goban
200 */
201 void Boardcxx . . $ Board#::calculateSizecxx . . $ Board#calculateSize(49f6e7a06ebc5aa8).()
202 {
203 // Calculate the size values
204
205 // distance from table edge to wooden board edge
206 const int margin = 1,
207 w = (int)canvascxx . . $ Board#canvas.->widthcxx . . $ QGraphicsScene#width(21b6c25e127938e2).() - margin * 2,
208 h = (int)canvascxx . . $ Board#canvas.->heightcxx . . $ QGraphicsScene#height(21b6c25e127938e2).() - margin * 2;
209
210 int table_size = (w < h ? w : h );
211
212 // distance from edge of wooden board to playing area (grids + space for stones on 1st & last line)
213 offsetcxx . . $ Board#offset. = table_size * 2/100 ;
214
215
216 QGraphicsSimpleTextItemcxx . . $ QGraphicsSimpleTextItem# *coordV = new QGraphicsSimpleTextItemcxx . . $ QGraphicsSimpleTextItem#QGraphicsSimpleTextItem(916db686a46811b8).(QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(board_sizecxx . . $ Board#board_size.),0);
217 QGraphicsSimpleTextItemcxx . . $ QGraphicsSimpleTextItem# *coordH = new QGraphicsSimpleTextItemcxx . . $ QGraphicsSimpleTextItem#QGraphicsSimpleTextItem(916db686a46811b8).("A"cxx . . $ QString#QString(85c52e162fed56f9).,0);
218 canvascxx . . $ Board#canvas.->addItemcxx . . $ QGraphicsScene#addItem(af50d9c5bfd58279).(coordV);
219 canvascxx . . $ Board#canvas.->addItemcxx . . $ QGraphicsScene#addItem(af50d9c5bfd58279).(coordH);
220 int coord_width = (int)coordV->boundingRectcxx . . $ QGraphicsSimpleTextItem#boundingRect(19f9350443f914b1).().widthcxx . . $ QRectF#width(d8440c0a87ad7443).();
221 int coord_height = (int)coordH->boundingRectcxx . . $ QGraphicsSimpleTextItem#boundingRect(19f9350443f914b1).().heightcxx . . $ QRectF#height(d8440c0a87ad7443).();
222
223 // space for coodinates if shown
224 int coord_offset = (coord_width < coord_height ? coord_height : coord_width);
225
226 if (showCoordscxx . . $ Board#showCoords.)
227 offsetcxx . . $ Board#offset. = coord_offset + 2 ;
228
229 //we need 1 more virtual 'square' for the stones on 1st and last line getting off the grid
230 square_sizecxx . . $ Board#square_size. = (table_size - 2*offsetcxx . . $ Board#offset.) / (board_sizecxx . . $ Board#board_size.);
231
232 // Should not happen, but safe is safe.
233 if (square_sizecxx . . $ Board#square_size. == 0)
234 square_sizecxx . . $ Board#square_size. = 1;
235
236 // grid size
237 board_pixel_sizecxx . . $ Board#board_pixel_size. = square_sizecxx . . $ Board#square_size. * (board_sizecxx . . $ Board#board_size.-1) + 1 ;
238 offsetcxx . . $ Board#offset. = (table_size - board_pixel_sizecxx . . $ Board#board_pixel_size.)/2;
239
240 // Center the board in canvas
241
242 offsetXcxx . . $ Board#offsetX. = margin + (w - board_pixel_sizecxx . . $ Board#board_pixel_size.) / 2;
243 offsetYcxx . . $ Board#offsetY. = margin + (h - board_pixel_sizecxx . . $ Board#board_pixel_size.) / 2;
244
245 //deletes the samples
246 delete coordV;
247 delete coordH;
248 }
249
250 /*
251 * actually draws the gatter lines
252 */
253 void Boardcxx . . $ Board#::drawGattercxx . . $ Board#drawGatter(49f6e7a06ebc5aa8).()
254 {
255 gattercxx . . $ Board#gatter.->resizecxx . . $ Gatter#resize(b1146eedae1e1d0b).(offsetXcxx . . $ Board#offsetX.,offsetYcxx . . $ Board#offsetY.,square_sizecxx . . $ Board#square_size.);
256 }
257
258 /*
259 * draws the goban wood texture
260 */
261 void Boardcxx . . $ Board#::drawBackcxx . . $ Board#drawBack(49f6e7a06ebc5aa8).()
262 {
263 tablecxx . . $ Board#table.->setRectcxx . . $ QGraphicsRectItem#setRect(52a61fa14d44b641).(offsetXcxx . . $ Board#offsetX. - offsetcxx . . $ Board#offset.,
264 offsetYcxx . . $ Board#offsetY. - offsetcxx . . $ Board#offset.,
265 board_pixel_sizecxx . . $ Board#board_pixel_size. + offsetcxx . . $ Board#offset.*2,
266 board_pixel_sizecxx . . $ Board#board_pixel_size. + offsetcxx . . $ Board#offset.*2);
267 }
268
269 /*
270 * Draws the coordinates around the goban grid
271 */
272 void Boardcxx . . $ Board#::drawCoordinatescxx . . $ Board#drawCoordinates(49f6e7a06ebc5aa8).()
273 {
274 QGraphicsSimpleTextItemcxx . . $ QGraphicsSimpleTextItem# *coord;
275
276 // centres the coordinates text within the remaining space at table edge
277 const int coord_centre = (offsetcxx . . $ Board#offset. - square_sizecxx . . $ Board#square_size./2 )/2;
278
279 for (int i=0; i<board_sizecxx . . $ Board#board_size.; i++)
280 {
281 // Left side
282 coord = vCoords1cxx . . $ Board#vCoords1.->atcxx . . $ QList#at(e2681f9bb6b2f357).(i);
283 coord->setPoscxx . . $ QGraphicsItem#setPos(bc12c9ec15586e6a).(offsetXcxx . . $ Board#offsetX. - offsetcxx . . $ Board#offset. + coord_centre - coord->boundingRectcxx . . $ QGraphicsSimpleTextItem#boundingRect(19f9350443f914b1).().widthcxx . . $ QRectF#width(d8440c0a87ad7443).()/2 , offsetYcxx . . $ Board#offsetY. + square_sizecxx . . $ Board#square_size. * i - coord->boundingRectcxx . . $ QGraphicsSimpleTextItem#boundingRect(19f9350443f914b1).().heightcxx . . $ QRectF#height(d8440c0a87ad7443).()/2);
284 coord->setVisiblecxx . . $ QGraphicsItem#setVisible(b45ddcbc8423892c).(showCoordscxx . . $ Board#showCoords.);
285
286 // Right side
287 coord = vCoords2cxx . . $ Board#vCoords2.->atcxx . . $ QList#at(e2681f9bb6b2f357).(i);
288 coord->setPoscxx . . $ QGraphicsItem#setPos(bc12c9ec15586e6a).(offsetXcxx . . $ Board#offsetX. + board_pixel_sizecxx . . $ Board#board_pixel_size. + offsetcxx . . $ Board#offset. - coord_centre - coord->boundingRectcxx . . $ QGraphicsSimpleTextItem#boundingRect(19f9350443f914b1).().widthcxx . . $ QRectF#width(d8440c0a87ad7443).()/2 , offsetYcxx . . $ Board#offsetY. + square_sizecxx . . $ Board#square_size. * i - coord->boundingRectcxx . . $ QGraphicsSimpleTextItem#boundingRect(19f9350443f914b1).().heightcxx . . $ QRectF#height(d8440c0a87ad7443).()/2);
289 coord->setVisiblecxx . . $ QGraphicsItem#setVisible(b45ddcbc8423892c).(showCoordscxx . . $ Board#showCoords.);
290
291 // Top
292 coord = hCoords1cxx . . $ Board#hCoords1.->atcxx . . $ QList#at(e2681f9bb6b2f357).(i);
293 coord->setPoscxx . . $ QGraphicsItem#setPos(bc12c9ec15586e6a).(offsetXcxx . . $ Board#offsetX. + square_sizecxx . . $ Board#square_size. * i - coord->boundingRectcxx . . $ QGraphicsSimpleTextItem#boundingRect(19f9350443f914b1).().widthcxx . . $ QRectF#width(d8440c0a87ad7443).()/2 , offsetYcxx . . $ Board#offsetY. - offsetcxx . . $ Board#offset. + coord_centre - coord->boundingRectcxx . . $ QGraphicsSimpleTextItem#boundingRect(19f9350443f914b1).().heightcxx . . $ QRectF#height(d8440c0a87ad7443).()/2 );
294 coord->setVisiblecxx . . $ QGraphicsItem#setVisible(b45ddcbc8423892c).(showCoordscxx . . $ Board#showCoords.);
295
296 // Bottom
297 coord = hCoords2cxx . . $ Board#hCoords2.->atcxx . . $ QList#at(e2681f9bb6b2f357).(i);
298 coord->setPoscxx . . $ QGraphicsItem#setPos(bc12c9ec15586e6a).(offsetXcxx . . $ Board#offsetX. + square_sizecxx . . $ Board#square_size. * i - coord->boundingRectcxx . . $ QGraphicsSimpleTextItem#boundingRect(19f9350443f914b1).().widthcxx . . $ QRectF#width(d8440c0a87ad7443).()/2 ,offsetYcxx . . $ Board#offsetY. + offsetcxx . . $ Board#offset. + board_pixel_sizecxx . . $ Board#board_pixel_size. - coord_centre - coord->boundingRectcxx . . $ QGraphicsSimpleTextItem#boundingRect(19f9350443f914b1).().heightcxx . . $ QRectF#height(d8440c0a87ad7443).()/2 );
299 coord->setVisiblecxx . . $ QGraphicsItem#setVisible(b45ddcbc8423892c).(showCoordscxx . . $ Board#showCoords.);
300 }
301 }
302
303 /*
304 * called by 'boardwindow' when the toolbar button is toggled
305 */
306 void Boardcxx . . $ Board#::setShowCoordscxx . . $ Board#setShowCoords(b45ddcbc8423892c).(bool b)
307 {
308 if (b != showCoordscxx . . $ Board#showCoords.)
309 {
310 showCoordscxx . . $ Board#showCoords. = b;
311 resizeBoardcxx . . $ Board#resizeBoard(49f6e7a06ebc5aa8).(); // Redraw the board if the value changed.
312 }
313 }
314
315 /*
316 * the viewport is resized
317 */
318 void Boardcxx . . $ Board#::resizeEventcxx . . $ Board#resizeEvent(eeeec21cf8dc0387).(QResizeEventcxx . . $ QResizeEvent#*)
319 {
320 #ifdef _WS_WIN_x
321 if (!resizeDelayFlag)
322 {
323 resizeDelayFlag = true;
324 // not necessary?
325 QTimer::singleShot(50, this, resizeBoard()));
326 }
327 #else
328 if (!lockResizecxx . . $ Board#lockResize.)
329 resizeBoardcxx . . $ Board#resizeBoard(49f6e7a06ebc5aa8).();
330 #endif
331 }
332
333 /*
334 * does the resizing work
335 */
336 void Boardcxx . . $ Board#::resizeBoardcxx . . $ Board#resizeBoard(49f6e7a06ebc5aa8).()
337 {
338 if (widthcxx . . $ QWidget#width(455f465bc33b4cdf).() < 30 || heightcxx . . $ QWidget#height(455f465bc33b4cdf).() < 30)
339 return;
340
341 // Resize canvas
342 canvascxx . . $ Board#canvas.->setSceneRectcxx . . $ QGraphicsScene#setSceneRect(52a61fa14d44b641).(0,0,widthcxx . . $ QWidget#width(455f465bc33b4cdf).(),heightcxx . . $ QWidget#height(455f465bc33b4cdf).());
343
344 // Recalculate the size values
345 calculateSizecxx . . $ Board#calculateSize(49f6e7a06ebc5aa8).();
346
347 // Rescale the pixmaps in the ImageHandler
348 imageHandlercxx . . $ Board#imageHandler.->setSquareSizecxx . . $ ImageHandler#setSquareSize(d4f767463ce0a6b3).(square_sizecxx . . $ Board#square_size.);
349
350 // Delete gatter lines and update stones positions
351 QListcxx . . $ QList#<QGraphicsItemcxx . . $ QGraphicsItem# *> list = canvascxx . . $ Board#canvas.->itemscxx . . $ QGraphicsScene#items(a99ce31f1cf2503f).();
352 QGraphicsItemcxx . . $ QGraphicsItem# *item;
353
354 QListIteratorcxx . . $ QListIterator#<QGraphicsItemcxx . . $ QGraphicsItem# *> itcxx . . $ QListIterator#QListIterator(742a15f66a895bc5).( list );
355
356
357 for (; it.hasNextcxx . . $ QListIterator#hasNext(50ce9a9e25b4a850).();)
358 {
359 item = it.nextcxx . . $ QListIterator#next(1306adbac230aeaa).();
360 /*
361 * Coordinates : type = 9
362 */
363 // if (item->type() == 9)// || item->type() == 3)// || item->rtti() == 7)
364 // {
365 // item->hide();
366 // delete item;
367 // }
368 /*else*/ if (item->typecxx . . $ QGraphicsItem#type(455f465bc33b4cdf).() == RTTI_STONEcxx . . $ `board/graphicsitemstypes.h:25:9`!)
369 {
370 Stonecxx . . $ Stone# *s = (Stonecxx . . $ Stone#*)item;
371 s->setColorcxx . . $ Stone#setColor(42096433316d3db3).(s->getColorcxx . . $ Stone#getColor(6680c74b05d375a4).());
372 s->setPoscxx . . $ Stone#setPos(bc12c9ec15586e6a).(offsetXcxx . . $ Board#offsetX. + square_sizecxx . . $ Board#square_size. * (s->posXcxx . . $ Stone#posX(455f465bc33b4cdf).() - 1) - s->pixmapcxx . . $ QGraphicsPixmapItem#pixmap(3b2d5b7187256452).().widthcxx . . $ QPixmap#width(455f465bc33b4cdf).()/2,
373 offsetYcxx . . $ Board#offsetY. + square_sizecxx . . $ Board#square_size. * (s->posYcxx . . $ Stone#posY(455f465bc33b4cdf).() - 1) - s->pixmapcxx . . $ QGraphicsPixmapItem#pixmap(3b2d5b7187256452).().heightcxx . . $ QPixmap#height(455f465bc33b4cdf).()/2 );
374
375 //TODO introduce a ghost list in the stone class so that this becomes redundant code
376 if (s->isDeadcxx . . $ Stone#isDead(50ce9a9e25b4a850).())
377 s->togglePixmapcxx . . $ Stone#togglePixmap(45848267e7fc80b8).(imageHandlercxx . . $ Board#imageHandler.->getGhostPixmapscxx . . $ ImageHandler#getGhostPixmaps(4d7a006e8cda1ecc).(), false);
378
379
380
381 }
382 else if (item->typecxx . . $ QGraphicsItem#type(455f465bc33b4cdf).() >= RTTI_MARK_SQUAREcxx . . $ `board/graphicsitemstypes.h:26:9`! &&
383 item->typecxx . . $ QGraphicsItem#type(455f465bc33b4cdf).() <= RTTI_MARK_TERRcxx . . $ `board/graphicsitemstypes.h:32:9`!)
384 {
385 Markcxx . . $ Mark# *m;
386 switch(item->typecxx . . $ QGraphicsItem#type(455f465bc33b4cdf).())
387 {
388 case RTTI_MARK_SQUAREcxx . . $ `board/graphicsitemstypes.h:26:9`!: m = (MarkSquarecxx . . $ MarkSquare#*)item; break;
389 case RTTI_MARK_CIRCLEcxx . . $ `board/graphicsitemstypes.h:27:9`!: m = (MarkCirclecxx . . $ MarkCircle#*)item;/* m->setSmall(setting->readBoolEntry("SMALL_MARKS")); */break;
390 case RTTI_MARK_TRIANGLEcxx . . $ `board/graphicsitemstypes.h:28:9`!: m = (MarkTrianglecxx . . $ MarkTriangle#*)item; break;
391 case RTTI_MARK_CROSScxx . . $ `board/graphicsitemstypes.h:29:9`!: m = (MarkCrosscxx . . $ MarkCross#*)item; break;
392 case RTTI_MARK_TEXTcxx . . $ `board/graphicsitemstypes.h:30:9`!: m = (MarkTextcxx . . $ MarkText#*)item; break;
393 case RTTI_MARK_NUMBERcxx . . $ `board/graphicsitemstypes.h:31:9`!: m = (MarkNumbercxx . . $ MarkNumber#*)item; break;
394 case RTTI_MARK_TERRcxx . . $ `board/graphicsitemstypes.h:32:9`!: m = (MarkTerrcxx . . $ MarkTerr#*)item; break;
395 default: continue;
396 }
397 if(item->typecxx . . $ QGraphicsItem#type(455f465bc33b4cdf).() == RTTI_MARK_TERRcxx . . $ `board/graphicsitemstypes.h:32:9`! && preferencescxx . . $ preferences..terr_stone_markcxx . . $ _preferences#terr_stone_mark.)
398 {
399 m = (MarkSmallStoneTerrcxx . . $ MarkSmallStoneTerr# *)item;
400 static_cast<MarkSmallStoneTerrcxx . . $ MarkSmallStoneTerr# *>(item)->setSizecxx . . $ MarkSmallStoneTerr#setSize(bc12c9ec15586e6a).(square_sizecxx . . $ Board#square_size. / SMALL_STONE_TERR_DIVISORcxx . . $ `src/defines.h:45:9`!, square_sizecxx . . $ Board#square_size. / SMALL_STONE_TERR_DIVISORcxx . . $ `src/defines.h:45:9`!);
401 static_cast<MarkSmallStoneTerrcxx . . $ MarkSmallStoneTerr# *>(item)->setPixmapcxx . . $ MarkSmallStoneTerr#setPixmap(8dabbab4471f424).(imageHandlercxx . . $ Board#imageHandler.->getSmallStonePixmapscxx . . $ ImageHandler#getSmallStonePixmaps(4d7a006e8cda1ecc).());
402 }
403 else
404 m->setSizecxx . . $ Mark#setSize(bc12c9ec15586e6a).(square_sizecxx . . $ Board#square_size., square_sizecxx . . $ Board#square_size.);
405 m->setPoscxx . . $ Mark#setPos(bc12c9ec15586e6a).(offsetXcxx . . $ Board#offsetX. + square_sizecxx . . $ Board#square_size. * (m->posXcxx . . $ Mark#posX(455f465bc33b4cdf).() - 1) - m->getSizeXcxx . . $ Mark#getSizeX(21b6c25e127938e2).()/2.0,
406 offsetYcxx . . $ Board#offsetY. + square_sizecxx . . $ Board#square_size. * (m->posYcxx . . $ Mark#posY(455f465bc33b4cdf).() - 1) - m->getSizeYcxx . . $ Mark#getSizeY(21b6c25e127938e2).()/2.0);
407 }
408 }
409
410 // boardHandler->gotoMove(m_save);
411
412 /* FIXME sometimes this draws the lines after/on top of the marks.
413 * moving it earlier doesn't fix anything */
414
415 // Redraw the board
416 drawBackcxx . . $ Board#drawBack(49f6e7a06ebc5aa8).();
417 drawGattercxx . . $ Board#drawGatter(49f6e7a06ebc5aa8).();
418 // if (showCoords && !isDisplayBoard)
419 drawCoordinatescxx . . $ Board#drawCoordinates(49f6e7a06ebc5aa8).();
420
421 // Redraw the mark on the last played stone
422 // updateLastMove(m_save->getColor(), m_save->getX(), m_save->getY());
423 }
424
425 /*
426 * sets the cursor shape over the goban,
427 * this is called by boardhandler and qgoboard proxy depending on the game mode and phase
428 */
429 void Boardcxx . . $ Board#::setCursorTypecxx . . $ Board#setCursorType(926e1983f0360a22).(CursorTypecxx . . $ CursorType# cur)
430 {
431 if (cursorcxx . . $ Board#cursor. == cur)
432 return;
433
434 switch (cur)
435 {
436 case cursorIdlecxx . . $ cursorIdle. :
437 {
438 if (cursorcxx . . $ Board#cursor. == cursorNavTocxx . . $ cursorNavTo. || cursorcxx . . $ Board#cursor. == cursorWaitcxx . . $ cursorWait.)
439 setCursorcxx . . $ QWidget#setCursor(abdcfda6ee8376ea).(Qtcxx . . $ QCursor#QCursor(1a9232e7b845eb22).::ArrowCursorcxx . . $ Qt/ArrowCursor.);
440
441 showCursorcxx . . $ Board#showCursor. = false;
442 curStonecxx . . $ Board#curStone.->hidecxx . . $ Stone#hide(49f6e7a06ebc5aa8).();
443 break;
444 }
445
446 case cursorGhostBlackcxx . . $ cursorGhostBlack. :
447 {
448 if (cursorcxx . . $ Board#cursor. == cursorNavTocxx . . $ cursorNavTo. || cursorcxx . . $ Board#cursor. == cursorWaitcxx . . $ cursorWait.)
449 setCursorcxx . . $ QWidget#setCursor(abdcfda6ee8376ea).(Qtcxx . . $ QCursor#QCursor(1a9232e7b845eb22).::ArrowCursorcxx . . $ Qt/ArrowCursor.);
450
451 curStonecxx . . $ Board#curStone.->setColorcxx . . $ Stone#setColor(42096433316d3db3).(stoneBlackcxx . . $ stoneBlack.);
452 showCursorcxx . . $ Board#showCursor. = true;
453 break;
454 }
455
456 case cursorGhostWhitecxx . . $ cursorGhostWhite. :
457 {
458 if (cursorcxx . . $ Board#cursor. == cursorNavTocxx . . $ cursorNavTo. || cursorcxx . . $ Board#cursor. == cursorWaitcxx . . $ cursorWait.)
459 setCursorcxx . . $ QWidget#setCursor(abdcfda6ee8376ea).(Qtcxx . . $ QCursor#QCursor(1a9232e7b845eb22).::ArrowCursorcxx . . $ Qt/ArrowCursor.);
460
461 curStonecxx . . $ Board#curStone.->setColorcxx . . $ Stone#setColor(42096433316d3db3).(stoneWhitecxx . . $ stoneWhite.);
462 showCursorcxx . . $ Board#showCursor. = true;
463 break;
464 }
465
466 case cursorNavTocxx . . $ cursorNavTo. :
467 {
468 setCursorcxx . . $ QWidget#setCursor(abdcfda6ee8376ea).(Qtcxx . . $ QCursor#QCursor(1a9232e7b845eb22).::PointingHandCursorcxx . . $ Qt/PointingHandCursor.);
469 showCursorcxx . . $ Board#showCursor. = false;
470 curStonecxx . . $ Board#curStone.->hidecxx . . $ Stone#hide(49f6e7a06ebc5aa8).();
471 break;
472 }
473
474 case cursorWaitcxx . . $ cursorWait. :
475 {
476 setCursorcxx . . $ QWidget#setCursor(abdcfda6ee8376ea).(Qtcxx . . $ QCursor#QCursor(1a9232e7b845eb22).::WaitCursorcxx . . $ Qt/WaitCursor.);
477 showCursorcxx . . $ Board#showCursor. = false;
478 curStonecxx . . $ Board#curStone.->hidecxx . . $ Stone#hide(49f6e7a06ebc5aa8).();
479 break;
480 }
481 }
482
483 cursorcxx . . $ Board#cursor. = cur;
484 }
485
486 /*
487 * 0 : no stone
488 * -1 : hidden
489 * 1 : shown
490 */
491 int Boardcxx . . $ Board#::hasStonecxx . . $ Board#hasStone(9b79fb6aee4c0440).(int x, int y)
492 {
493 if (!stonescxx . . $ Board#stones.->containscxx . . $ QHash#contains(8877ebe272b9620d).(coordsToKeycxx . . $ Board#coordsToKey(c65f66d6a6d971ba).(x, y)))
494 return 0;
495
496 if (stonescxx . . $ Board#stones.->findcxx . . $ QHash#find(1cadc8f6e24105ba).(coordsToKeycxx . . $ Board#coordsToKey(c65f66d6a6d971ba).(x, y)).valuecxx . . $ QHash#iterator#value(51f62fb05f27f6a2).()->isVisiblecxx . . $ QGraphicsItem#isVisible(50ce9a9e25b4a850).())
497 return 1;
498
499 return -1;
500 }
501
502 /*
503 * Used for setting the mark color in case a mark is set over the var mark
504 */
505 bool Boardcxx . . $ Board#::hasVarGhostcxx . . $ Board#hasVarGhost(d30022d4f7f7716f).(StoneColorcxx . . $ StoneColor# c, int x, int y)
506 {
507 Stonecxx . . $ Stone# *s;
508
509 for (int i=0; i<ghostscxx . . $ Board#ghosts.->countcxx . . $ QList#count(455f465bc33b4cdf).(); i++)
510 {
511 s=ghostscxx . . $ Board#ghosts.->atcxx . . $ QList#at(e2681f9bb6b2f357).(i);
512 if (s->posXcxx . . $ Stone#posX(455f465bc33b4cdf).() == x && s->posYcxx . . $ Stone#posY(455f465bc33b4cdf).() == y && s->getColorcxx . . $ Stone#getColor(6680c74b05d375a4).() == c)
513 return true;
514 }
515
516 return false;
517 }
518
519 /*
520 * Synchronize the board with the given stone color and coordinates
521 * This is usually called by boardhandler when scanning a matrix.
522 */
523 void Boardcxx . . $ Board#::updateStonecxx . . $ Board#updateStone(615937dc839e801b).(StoneColorcxx . . $ StoneColor# c, int x, int y, bool dead)
524 {
525 Stonecxx . . $ Stone# *stone = stonescxx . . $ Board#stones.->valuecxx . . $ QHash#value(866b0a4e5fb46e14).(coordsToKeycxx . . $ Board#coordsToKey(c65f66d6a6d971ba).(x, y),NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
526 //if ((stone == NULL) & ((c == stoneBlack) || (c == stoneWhite)))
527
528 switch (c)
529 {
530 case stoneBlackcxx . . $ stoneBlack.:
531 case stoneWhitecxx . . $ stoneWhite.:
532 if (stone == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
533 {
534 stone = new Stonecxx . . $ Stone#Stone(72804590282d8142).(imageHandlercxx . . $ Board#imageHandler.->getStonePixmapscxx . . $ ImageHandler#getStonePixmaps(4d7a006e8cda1ecc).(), canvascxx . . $ Board#canvas., c, x, y,true);
535 stone->setPoscxx . . $ Stone#setPos(bc12c9ec15586e6a).(offsetXcxx . . $ Board#offsetX. + square_sizecxx . . $ Board#square_size. * (x - 1) - stone->pixmapcxx . . $ QGraphicsPixmapItem#pixmap(3b2d5b7187256452).().widthcxx . . $ QPixmap#width(455f465bc33b4cdf).()/2,
536 offsetYcxx . . $ Board#offsetY. + square_sizecxx . . $ Board#square_size. * (y - 1) - stone->pixmapcxx . . $ QGraphicsPixmapItem#pixmap(3b2d5b7187256452).().heightcxx . . $ QPixmap#height(455f465bc33b4cdf).()/2 );
537 stonescxx . . $ Board#stones.->insertcxx . . $ QHash#insert(d77b19c31d2eb147).(coordsToKeycxx . . $ Board#coordsToKey(c65f66d6a6d971ba).(x,y) , stone);
538 break;
539 }
540
541 if (stone->getColorcxx . . $ Stone#getColor(6680c74b05d375a4).() != c)
542 stone->setColorcxx . . $ Stone#setColor(42096433316d3db3).(c);
543
544 // We need to check wether the stones have been toggled dead or seki before (scoring mode)
545 if ((stone->isDeadcxx . . $ Stone#isDead(50ce9a9e25b4a850).() || stone->isSekicxx . . $ Stone#isSeki(50ce9a9e25b4a850).()) && !dead)
546 {
547 stone->togglePixmapcxx . . $ Stone#togglePixmap(45848267e7fc80b8).(imageHandlercxx . . $ Board#imageHandler.->getStonePixmapscxx . . $ ImageHandler#getStonePixmaps(4d7a006e8cda1ecc).(), true);
548 stone->setDeadcxx . . $ Stone#setDead(b45ddcbc8423892c).(false);
549 }
550
551 if ((!stone->isDeadcxx . . $ Stone#isDead(50ce9a9e25b4a850).()) && dead)
552 {
553 stone->togglePixmapcxx . . $ Stone#togglePixmap(45848267e7fc80b8).(imageHandlercxx . . $ Board#imageHandler.->getGhostPixmapscxx . . $ ImageHandler#getGhostPixmaps(4d7a006e8cda1ecc).(), false);
554 stone->setDeadcxx . . $ Stone#setDead(b45ddcbc8423892c).();
555 }
556
557 if (!stone->isVisiblecxx . . $ QGraphicsItem#isVisible(50ce9a9e25b4a850).())
558 stone->showcxx . . $ Stone#show(49f6e7a06ebc5aa8).();
559
560 break;
561
562
563 case stoneNonecxx . . $ stoneNone.:
564 case stoneErasecxx . . $ stoneErase.:
565 if (stone && stone->isVisiblecxx . . $ QGraphicsItem#isVisible(50ce9a9e25b4a850).())
566 {
567 stone->hidecxx . . $ Stone#hide(49f6e7a06ebc5aa8).();
568 }
569 break;
570
571 default:
572 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!("Bad data <%d> at %d/%d in board::updateStone !",
573 c, x, y);
574 }
575 }
576
577 /*
578 * Sets a variation mark of color 'c' at positon 'x,y'
579 */
580 void Boardcxx . . $ Board#::setVarGhostcxx . . $ Board#setVarGhost(e6b2860cd25699f2).(StoneColorcxx . . $ StoneColor# c, int x, int y)
581 {
582 Stonecxx . . $ Stone# *s = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
583
584 // if (setting->readIntEntry("VAR_GHOSTS") == vardisplayGhost) TODO
585 // s = new Stone(imageHandler->getGhostPixmaps(), canvas, c, x, y);
586 // else if (setting->readIntEntry("VAR_GHOSTS") == vardisplaySmallStone)
587 s = new Stonecxx . . $ Stone#Stone(72804590282d8142).(imageHandlercxx . . $ Board#imageHandler.->getAlternateGhostPixmapscxx . . $ ImageHandler#getAlternateGhostPixmaps(ce0b25172eea24ae).(), canvascxx . . $ Board#canvas., c, x, y, false);
588 // else
589 // return;
590
591 s->setZValuecxx . . $ QGraphicsItem#setZValue(ba8836b59fb42830).(3);//FIXME : this should not be here, but in the 'stone' code
592 /* FIXME Variation ghosts on handicap stones for some weird reason */
593 ghostscxx . . $ Board#ghosts.->appendcxx . . $ QList#append(77d9f17553126ecb).(s);
594
595 if (x == PASS_XYcxx . . $ `src/defines.h:38:9`! && y == PASS_XYcxx . . $ `src/defines.h:38:9`!) // Pass
596 {
597 s->setPoscxx . . $ Stone#setPos(bc12c9ec15586e6a).( offsetXcxx . . $ Board#offsetX. + square_sizecxx . . $ Board#square_size. * (board_sizecxx . . $ Board#board_size.+1),
598 offsetYcxx . . $ Board#offsetY. + square_sizecxx . . $ Board#square_size. * board_sizecxx . . $ Board#board_size.);
599 // setMark(board_size+2, board_size+1, markText, false, tr("Pass"), false);
600 }
601 else
602 {
603 s->setPoscxx . . $ Stone#setPos(bc12c9ec15586e6a).(offsetXcxx . . $ Board#offsetX. + square_sizecxx . . $ Board#square_size. * (x-1) - s->boundingRectcxx . . $ QGraphicsPixmapItem#boundingRect(19f9350443f914b1).().widthcxx . . $ QRectF#width(d8440c0a87ad7443).()/2,
604 offsetYcxx . . $ Board#offsetY. + square_sizecxx . . $ Board#square_size. * (y-1) - s->boundingRectcxx . . $ QGraphicsPixmapItem#boundingRect(19f9350443f914b1).().heightcxx . . $ QRectF#height(d8440c0a87ad7443).()/2);
605 }
606 }
607
608 /*
609 * Removes all the variation marks (when navigating into the tree)
610 */
611 void Boardcxx . . $ Board#::removeGhostscxx . . $ Board#removeGhosts(49f6e7a06ebc5aa8).()
612 {
613 qDeleteAllcxx . . $ qDeleteAll(77d9f17553126ecb).(*ghostscxx . . $ Board#ghosts.);
614 ghostscxx . . $ Board#ghosts.->clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).();
615 }
616
617 /*
618 * Sets a mark of type 't' at positon 'x,y'. If a text mark : 'txt'
619 */
620 void Boardcxx . . $ Board#::setMarkcxx . . $ Board#setMark(18adccc0109412ba).(int x, int y, MarkTypecxx . . $ MarkType# t, bool /*update*/, QStringcxx . . $ QString# txt, bool overlay)
621 {
622 if (x == -1 || y == -1)
623 return;
624
625 Markcxx . . $ Mark# *m;
626
627 // We already have a mark on this spot? If it is of the same type,
628 // do nothing, else overwrite with the new mark.
629 if ((m = hasMarkcxx . . $ Board#hasMark(9649d5d3ce79ba50).(x, y)) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
630 {
631 if (m->getTypecxx . . $ Mark#getType(8661d96d9560796a).() == t && m->getTypecxx . . $ Mark#getType(8661d96d9560796a).() != markTextcxx . . $ markText.) // Text labels are overwritten
632 return;
633 removeMarkcxx . . $ Board#removeMark(6908015b96d379c0).(x, y);
634 }
635
636 if (lastMoveMarkcxx . . $ Board#lastMoveMark. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! &&
637 lastMoveMarkcxx . . $ Board#lastMoveMark.->posXcxx . . $ Mark#posX(455f465bc33b4cdf).() == x &&
638 lastMoveMarkcxx . . $ Board#lastMoveMark.->posYcxx . . $ Mark#posY(455f465bc33b4cdf).() == y)
639 removeLastMoveMarkcxx . . $ Board#removeLastMoveMark(49f6e7a06ebc5aa8).();
640
641 QColorcxx . . $ QColor# col = Qtcxx . . $ QColor#QColor(408ec4d5924bfb00).::blackcxx . . $ Qt/black.;
642
643 // Black stone or black ghost underlying? Then we need a white mark.
644 if (( hasStonecxx . . $ Board#hasStone(9b79fb6aee4c0440).(x, y) == 1 && getStoneAtcxx . . $ Board#getStoneAt(3c393f7b43a68738).(x, y)->getColorcxx . . $ Stone#getColor(6680c74b05d375a4).() == stoneBlackcxx . . $ stoneBlack.) || hasVarGhostcxx . . $ Board#hasVarGhost(d30022d4f7f7716f).(stoneBlackcxx . . $ stoneBlack., x, y))//||
645 //TODO (settings->readIntEntry("VAR_GHOSTS") && hasVarGhost(stoneBlack, x, y)))
646 col =cxx . . $ QColor#`operator=`(7dc25a5504d99c29). Qtcxx . . $ Qt/::whitecxx . . $ Qt/white.;
647
648 short n = -1;
649
650 switch(t)
651 {
652 case markSquarecxx . . $ markSquare.:
653 m = new MarkSquarecxx . . $ MarkSquare#(x, y, square_sizecxx . . $ Board#square_size., canvascxx . . $ Board#canvas., colcxx . . $ QColor#QColor(c396aab421781ee8).);
654 break;
655
656 case markCirclecxx . . $ markCircle.:
657 m = new MarkCirclecxx . . $ MarkCircle#(x, y, square_sizecxx . . $ Board#square_size., canvascxx . . $ Board#canvas., colcxx . . $ QColor#QColor(c396aab421781ee8)., true);//setting->readBoolEntry("SMALL_STONES"));
658 break;
659
660 case markTrianglecxx . . $ markTriangle.:
661 m = new MarkTrianglecxx . . $ MarkTriangle#(x, y, square_sizecxx . . $ Board#square_size., canvascxx . . $ Board#canvas., colcxx . . $ QColor#QColor(c396aab421781ee8).);
662 break;
663
664 case markCrosscxx . . $ markCross.:
665 m = new MarkCrosscxx . . $ MarkCross#(x, y, square_sizecxx . . $ Board#square_size., canvascxx . . $ Board#canvas., colcxx . . $ QColor#QColor(c396aab421781ee8).);
666 break;
667
668 case markTextcxx . . $ markText.:
669 // if (txt == NULL)
670 // {
671 // n = 0;
672 // while (letterPool[n] && n < 51)
673 // n++;
674 // letterPool[n] = true;
675
676 // txt = QString(QChar(static_cast<const char>('A' + (n>=26 ? n+6 : n))));
677
678 // Update matrix with this letter
679 // boardHandler->getTree()->getCurrent()->getMatrix()->setMarkText(x, y, txt);
680 // }
681 /*else*/ if (txt.lengthcxx . . $ QString#length(455f465bc33b4cdf).() == 1)
682 {
683 // Text was given as argument, check if it can converted to a single letter
684 n = -1;
685 if (txt[cxx . . $ QString#`operator[]`(57436120916eb52c).0] >=cxx . . $ `operator>=`(a468b2f18a3afe8). 'A'cxx . . $ QChar#QChar(f349c77f591a7878). && txt[cxx . . $ QString#`operator[]`(57436120916eb52c).0] <=cxx . . $ `operator<=`(a468b2f18a3afe8). 'Z'cxx . . $ QChar#QChar(f349c77f591a7878).)
686 n = txt[cxx . . $ QString#`operator[]`(57436120916eb52c).0].toLatin1cxx . . $ QCharRef#toLatin1(1b8b762cbef9c2c9).() - 'A';
687 else if (txt[cxx . . $ QString#`operator[]`(57436120916eb52c).0] >=cxx . . $ `operator>=`(a468b2f18a3afe8). 'a'cxx . . $ QChar#QChar(f349c77f591a7878). && txt[cxx . . $ QString#`operator[]`(57436120916eb52c).0] <=cxx . . $ `operator<=`(a468b2f18a3afe8). 'a'cxx . . $ QChar#QChar(f349c77f591a7878).)
688 n = txt[cxx . . $ QString#`operator[]`(57436120916eb52c).0].toLatin1cxx . . $ QCharRef#toLatin1(1b8b762cbef9c2c9).() - 'a' + 26;
689
690 if (n > -1)
691 letterPoolcxx . . $ Board#letterPool.[n] = true;
692 }
693 m = new MarkTextcxx . . $ MarkText#(x, y, square_sizecxx . . $ Board#square_size., txt, canvascxx . . $ Board#canvas., colcxx . . $ QColor#QColor(c396aab421781ee8)., n, false, overlay);
694 gattercxx . . $ Board#gatter.->hidecxx . . $ Gatter#hide(3e454b8ccf442868).(x,y);//setMarkText(x, y, txt);
695 break;
696
697 case markNumbercxx . . $ markNumber.:
698 // if (txt == NULL)
699 // {
700 // n = 0;
701 // while (numberPool[n] && n < 399)
702 // n++;
703 //
704 // txt = QString::number(n+1);
705 //
706 // // Update matrix with this letter
707 // boardHandler->getTree()->getCurrent()->getMatrix()->setMarkText(x, y, txt);
708 // }
709 // else
710 n = txt.toIntcxx . . $ QString#toInt(d7972accae11ee1f).() - 1;
711 numberPoolcxx . . $ Board#numberPool.[n] = true;
712 m = new MarkNumbercxx . . $ MarkNumber#(x, y, square_sizecxx . . $ Board#square_size., n, canvascxx . . $ Board#canvas., colcxx . . $ QColor#QColor(c396aab421781ee8)., false);
713 //FIXME why do we call "setMarkText" here and not in markText case above??
714 //I'm commenting it out, doesn't seem to change anything
715 //setMarkText(x, y, txt);
716 gattercxx . . $ Board#gatter.->hidecxx . . $ Gatter#hide(3e454b8ccf442868).(x,y);
717 break;
718
719 case markTerrBlackcxx . . $ markTerrBlack.:
720 if(!preferencescxx . . $ preferences..terr_stone_markcxx . . $ _preferences#terr_stone_mark.)
721 m = new MarkTerrcxx . . $ MarkTerr#(x, y, square_sizecxx . . $ Board#square_size., stoneBlackcxx . . $ stoneBlack., canvascxx . . $ Board#canvas.);
722 else
723 m = new MarkSmallStoneTerrcxx . . $ MarkSmallStoneTerr#(x, y, square_sizecxx . . $ Board#square_size. / SMALL_STONE_TERR_DIVISORcxx . . $ `src/defines.h:45:9`!, stoneBlackcxx . . $ stoneBlack., imageHandlercxx . . $ Board#imageHandler.->getSmallStonePixmapscxx . . $ ImageHandler#getSmallStonePixmaps(4d7a006e8cda1ecc).(), canvascxx . . $ Board#canvas.);
724 if (hasStonecxx . . $ Board#hasStone(9b79fb6aee4c0440).(x, y) == 1)
725 {
726 //getStoneAt(x, y)->setDead(true);
727 //getStoneAt(x, y)->togglePixmap(imageHandler->getGhostPixmaps(), false);
728 // getStoneAt(x, y)->shadow->hide();
729 // boardHandler->markedDead = true;
730 updateStonecxx . . $ Board#updateStone(615937dc839e801b).(stoneWhitecxx . . $ stoneWhite., x, y, true);
731 }
732 // boardHandler->getTree()->getCurrent()->setScored(true);
733 break;
734
735 case markTerrWhitecxx . . $ markTerrWhite.:
736 if(!preferencescxx . . $ preferences..terr_stone_markcxx . . $ _preferences#terr_stone_mark.)
737 m = new MarkTerrcxx . . $ MarkTerr#(x, y, square_sizecxx . . $ Board#square_size., stoneWhitecxx . . $ stoneWhite., canvascxx . . $ Board#canvas.);
738 else
739 m = new MarkSmallStoneTerrcxx . . $ MarkSmallStoneTerr#(x, y, square_sizecxx . . $ Board#square_size. / SMALL_STONE_TERR_DIVISORcxx . . $ `src/defines.h:45:9`!, stoneWhitecxx . . $ stoneWhite., imageHandlercxx . . $ Board#imageHandler.->getSmallStonePixmapscxx . . $ ImageHandler#getSmallStonePixmaps(4d7a006e8cda1ecc).(), canvascxx . . $ Board#canvas.);
740 if (hasStonecxx . . $ Board#hasStone(9b79fb6aee4c0440).(x, y) == 1)
741 {
742 //getStoneAt(x, y)->setDead(true);
743 //getStoneAt(x, y)->togglePixmap(imageHandler->getGhostPixmaps(), false);
744 // boardHandler->getStoneHandler()->getStoneAt(x, y)->shadow->hide();
745 // boardHandler->markedDead = true;
746 updateStonecxx . . $ Board#updateStone(615937dc839e801b).(stoneBlackcxx . . $ stoneBlack., x, y, true);
747 }
748 // boardHandler->getTree()->getCurrent()->setScored(true);
749 break;
750
751 default:
752 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!(" *** Board::setMark() - Bad mark type! ***");
753 return;
754 }
755
756 Q_CHECK_PTRcxx . . $ `<external>/15045578679651060896/qglobal.h:890:11`!(m);
757 m->setPoscxx . . $ Mark#setPos(bc12c9ec15586e6a).(offsetXcxx . . $ Board#offsetX. + square_sizecxx . . $ Board#square_size. * (x-1) - m->getSizeXcxx . . $ Mark#getSizeX(21b6c25e127938e2).()/2 , offsetYcxx . . $ Board#offsetY. + square_sizecxx . . $ Board#square_size. * (y-1) - m->getSizeYcxx . . $ Mark#getSizeY(21b6c25e127938e2).()/2);
758 m->showcxx . . $ Mark#show(49f6e7a06ebc5aa8).();
759
760 markscxx . . $ Board#marks.->appendcxx . . $ QList#append(77d9f17553126ecb).(m);
761 // if (update)
762 // boardHandler->editMark(x, y, t, txt);
763 }
764
765 /*
766 * Sets a text in 'text' mark at positon 'x,y'.
767 */
768 void Boardcxx . . $ Board#::setMarkTextcxx . . $ Board#setMarkText(c89d651b24440698).(int x, int y, const QStringcxx . . $ QString# &txt)
769 {
770 Markcxx . . $ Mark# *m;
771
772 // Oops, no mark here, or no text mark
773 if (txt.isNullcxx . . $ QString#isNull(50ce9a9e25b4a850).() || txt.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).() ||
774 (m = hasMarkcxx . . $ Board#hasMark(9649d5d3ce79ba50).(x, y)) == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! || m->getTypecxx . . $ Mark#getType(8661d96d9560796a).() != markTextcxx . . $ markText.)
775 return;
776
777 m->setTextcxx . . $ Mark#setText(3520e46b33348bf6).(txt);
778 // Adjust the position on the board, if the text size has changed.
779 m->setSizecxx . . $ Mark#setSize(bc12c9ec15586e6a).((double)square_sizecxx . . $ Board#square_size., (double)square_sizecxx . . $ Board#square_size.);
780 m->setPoscxx . . $ Mark#setPos(bc12c9ec15586e6a).(offsetXcxx . . $ Board#offsetX. + square_sizecxx . . $ Board#square_size. * (x-1) - m->getSizeXcxx . . $ Mark#getSizeX(21b6c25e127938e2).()/2 , offsetYcxx . . $ Board#offsetY. + square_sizecxx . . $ Board#square_size. * (y-1) - m->getSizeYcxx . . $ Mark#getSizeY(21b6c25e127938e2).()/2);
781 }
782
783 /*
784 * Queries wether there is a mark at position 'x,y'
785 */
786 Markcxx . . $ Mark#* Boardcxx . . $ Board#::hasMarkcxx . . $ Board#hasMark(9649d5d3ce79ba50).(int x, int y)
787 {
788 Markcxx . . $ Mark# *m = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
789
790 // for (m=marks->first(); m != NULL; m=marks->next())
791 for (int i=0; i<markscxx . . $ Board#marks.->countcxx . . $ QList#count(455f465bc33b4cdf).(); i++)
792 {
793 m=markscxx . . $ Board#marks.->atcxx . . $ QList#at(e2681f9bb6b2f357).(i);
794 if (m->posXcxx . . $ Mark#posX(455f465bc33b4cdf).() == x && m->posYcxx . . $ Mark#posY(455f465bc33b4cdf).() == y)
795 return m;
796 }
797
798 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
799 }
800
801 /*
802 * Removes the mark at position 'x,y'
803 */
804 void Boardcxx . . $ Board#::removeMarkcxx . . $ Board#removeMark(6908015b96d379c0).(int x, int y, bool /*update*/)
805 {
806 Markcxx . . $ Mark# *m = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
807
808 if (lastMoveMarkcxx . . $ Board#lastMoveMark. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! &&
809 lastMoveMarkcxx . . $ Board#lastMoveMark.->posXcxx . . $ Mark#posX(455f465bc33b4cdf).() == x &&
810 lastMoveMarkcxx . . $ Board#lastMoveMark.->posYcxx . . $ Mark#posY(455f465bc33b4cdf).() == y)
811 removeLastMoveMarkcxx . . $ Board#removeLastMoveMark(49f6e7a06ebc5aa8).();
812
813 // for (m=marks->first(); m != NULL; m=marks->next())
814 for (int i=0; i<markscxx . . $ Board#marks.->countcxx . . $ QList#count(455f465bc33b4cdf).(); i++)
815 {
816 m=markscxx . . $ Board#marks.->atcxx . . $ QList#at(e2681f9bb6b2f357).(i);
817 if (m->posXcxx . . $ Mark#posX(455f465bc33b4cdf).() == x && m->posYcxx . . $ Mark#posY(455f465bc33b4cdf).() == y)
818 {
819 if (m->getCountercxx . . $ Mark#getCounter(4c3706f7850cf040).() != -1)
820 {
821 if (m->getTypecxx . . $ Mark#getType(8661d96d9560796a).() == markTextcxx . . $ markText.)
822 letterPoolcxx . . $ Board#letterPool.[m->getCountercxx . . $ Mark#getCounter(4c3706f7850cf040).()] = false;
823 else if (m->getTypecxx . . $ Mark#getType(8661d96d9560796a).() == markNumbercxx . . $ markNumber.)
824 numberPoolcxx . . $ Board#numberPool.[m->getCountercxx . . $ Mark#getCounter(4c3706f7850cf040).()] = false;
825 }
826 delete markscxx . . $ Board#marks.->takeAtcxx . . $ QList#takeAt(767fea59dce4185d).(i);
827 gattercxx . . $ Board#gatter.->showcxx . . $ Gatter#show(3e454b8ccf442868).(x,y);
828 // if (update)
829 // boardHandler->editMark(x, y, markNone);
830 return;
831 }
832 }
833 }
834
835 /*
836 * Removes the mark on the last stone played
837 */
838 void Boardcxx . . $ Board#::removeLastMoveMarkcxx . . $ Board#removeLastMoveMark(49f6e7a06ebc5aa8).()
839 {
840 if (lastMoveMarkcxx . . $ Board#lastMoveMark. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
841 {
842 // lastMoveMark->hide();
843 delete lastMoveMarkcxx . . $ Board#lastMoveMark.;
844 lastMoveMarkcxx . . $ Board#lastMoveMark. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
845 }
846 }
847
848 /*
849 * Updates the mark on the last stone played
850 */
851 void Boardcxx . . $ Board#::updateLastMovecxx . . $ Board#updateLastMove(490cd2a4f5caa810).(Movecxx . . $ Move# * move)
852 {
853 StoneColorcxx . . $ StoneColor# c = move->getColorcxx . . $ Move#getColor(6680c74b05d375a4).();
854 int x = move->getXcxx . . $ Move#getX(455f465bc33b4cdf).();
855 int y = move->getYcxx . . $ Move#getY(455f465bc33b4cdf).();
856
857 delete lastMoveMarkcxx . . $ Board#lastMoveMark.;
858 lastMoveMarkcxx . . $ Board#lastMoveMark. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!;
859
860 if (x == PASS_XYcxx . . $ `src/defines.h:38:9`! && y == PASS_XYcxx . . $ `src/defines.h:38:9`!) // Passing (FIXME don't think we use this anymore)
861 removeLastMoveMarkcxx . . $ Board#removeLastMoveMark(49f6e7a06ebc5aa8).();
862 else if(move->isHandicapMovecxx . . $ Move#isHandicapMove(c9857a73d68e59ba).()) {} // no last move marks on handicaps
863 else if (c != stoneNonecxx . . $ stoneNone. && x != -1 && y != -1 && x <= board_sizecxx . . $ Board#board_size. && y <= board_sizecxx . . $ Board#board_size.)
864 {
865
866 if(preferencescxx . . $ preferences..number_current_movecxx . . $ _preferences#number_current_move.)
867 {
868 //possible FIXME, MarkNumber adds 1 in mark.h to the move number ?!
869 lastMoveMarkcxx . . $ Board#lastMoveMark. = new MarkNumbercxx . . $ MarkNumber#(x, y, square_sizecxx . . $ Board#square_size., move->getMoveNumbercxx . . $ Move#getMoveNumber(455f465bc33b4cdf).() - 1, canvascxx . . $ Board#canvas.,
870 ccxx . . $ QColor#QColor(408ec4d5924bfb00). == stoneBlackcxx . . $ stoneBlack. ? Qtcxx . . $ Qt/::whitecxx . . $ Qt/white. : Qtcxx . . $ Qt/::blackcxx . . $ Qt/black., false);
871 }
872 else
873 {
874 lastMoveMarkcxx . . $ Board#lastMoveMark. = new MarkCrosscxx . . $ MarkCross#(x, y, square_sizecxx . . $ Board#square_size., canvascxx . . $ Board#canvas.,
875 ccxx . . $ QColor#QColor(408ec4d5924bfb00). == stoneBlackcxx . . $ stoneBlack. ? Qtcxx . . $ Qt/::whitecxx . . $ Qt/white. : Qtcxx . . $ Qt/::blackcxx . . $ Qt/black., true);
876 }
877 Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!(lastMoveMark);
878 // lastMoveMark = new MarkCircle(x, y, square_size, canvas,
879 // c == stoneBlack ? white : black, setting->readBoolEntry("SMALL_STONES"));
880 lastMoveMarkcxx . . $ Board#lastMoveMark.->setPoscxx . . $ Mark#setPos(bc12c9ec15586e6a).(offsetXcxx . . $ Board#offsetX. + square_sizecxx . . $ Board#square_size. * (x-1) - lastMoveMarkcxx . . $ Board#lastMoveMark.->getSizeXcxx . . $ Mark#getSizeX(21b6c25e127938e2).()/2,
881 offsetYcxx . . $ Board#offsetY. + square_sizecxx . . $ Board#square_size. * (y-1) - lastMoveMarkcxx . . $ Board#lastMoveMark.->getSizeYcxx . . $ Mark#getSizeY(21b6c25e127938e2).()/2);
882 lastMoveMarkcxx . . $ Board#lastMoveMark.->showcxx . . $ Mark#show(49f6e7a06ebc5aa8).();
883 }
884
885 // setCurStoneColor();
886 }
887
888 /*
889 * Used to know where the mouse is over the goban
890 */
891 int Boardcxx . . $ Board#::convertCoordsToPointcxx . . $ Board#convertCoordsToPoint(9b79fb6aee4c0440).(int c, int o)
892 {
893 int p = c - o + square_sizecxx . . $ Board#square_size./2;
894 if (p >= 0)
895 return p / square_sizecxx . . $ Board#square_size. + 1;
896 else
897 return -1;
898 }
899
900 /*
901 * Called when the mouse pointer leaves the goban
902 */
903 void Boardcxx . . $ Board#::leaveEventcxx . . $ Board#leaveEvent(c2473e2e70986fd7).(QEventcxx . . $ QEvent#*)
904 {
905 curStonecxx . . $ Board#curStone.->hidecxx . . $ Stone#hide(49f6e7a06ebc5aa8).();
906 }
907
908 /*
909 * Sets the ghost cursor depending on the arrow position
910 */
911 void Boardcxx . . $ Board#::mouseMoveEventcxx . . $ Board#mouseMoveEvent(702858a82d06265c). ( QMouseEventcxx . . $ QMouseEvent# * e )
912 {
913
914 if (!showCursorcxx . . $ Board#showCursor.)
915 return;
916
917 int x = convertCoordsToPointcxx . . $ Board#convertCoordsToPoint(9b79fb6aee4c0440).(e->xcxx . . $ QMouseEvent#x(455f465bc33b4cdf).(), offsetXcxx . . $ Board#offsetX.),
918 y = convertCoordsToPointcxx . . $ Board#convertCoordsToPoint(9b79fb6aee4c0440).(e->ycxx . . $ QMouseEvent#y(455f465bc33b4cdf).(), offsetYcxx . . $ Board#offsetY.);
919
920 /* FIXME, maybe don't draw cursor if x/y changes from downX downY?? */
921 if(downXcxx . . $ Board#downX. > 0 && (downXcxx . . $ Board#downX. != x || downYcxx . . $ Board#downY. != y))
922 {
923 curStonecxx . . $ Board#curStone.->hidecxx . . $ Stone#hide(49f6e7a06ebc5aa8).();
924 curXcxx . . $ Board#curX. = curYcxx . . $ Board#curY. = -1;
925 return;
926 }
927 // Outside the valid board?
928 if ((x < 1) || x > board_sizecxx . . $ Board#board_size. || y < 1 || y > board_sizecxx . . $ Board#board_size.)
929 {
930 curStonecxx . . $ Board#curStone.->hidecxx . . $ Stone#hide(49f6e7a06ebc5aa8).();
931 curXcxx . . $ Board#curX. = curYcxx . . $ Board#curY. = -1;
932 return;
933 }
934
935 // Nothing changed
936 if (curXcxx . . $ Board#curX. == (short)x && curYcxx . . $ Board#curY. == (short)y)
937 return;
938
939 // Update the statusbar coords tip
940 // emit coordsChanged(x, y, board_size,showSGFCoords);
941
942 // Remember if the cursor was hidden meanwhile.
943 // If yes, we need to repaint it at the old position.
944 // bool flag = curX == -1;
945
946 curXcxx . . $ Board#curX. = (short)x;
947 curYcxx . . $ Board#curY. = (short)y;
948
949 // if (// !showCursor || setting->readBoolEntry("CURSOR") ||
950 // (gamePhase == phaseEdit /*&& boardHandler->getMarkType() != markNone*/) ||
951 // gamePhase == phaseScore ||
952 // (curStone->posX() == x && curStone->posY() == y && !flag))
953 // return;
954
955 curStonecxx . . $ Board#curStone.->setPoscxx . . $ Stone#setPos(bc12c9ec15586e6a).(offsetXcxx . . $ Board#offsetX. + square_sizecxx . . $ Board#square_size. * (x - 1) - curStonecxx . . $ Board#curStone.->pixmapcxx . . $ QGraphicsPixmapItem#pixmap(3b2d5b7187256452).().widthcxx . . $ QPixmap#width(455f465bc33b4cdf).()/2,
956 offsetYcxx . . $ Board#offsetY. + square_sizecxx . . $ Board#square_size. * (y - 1) - curStonecxx . . $ Board#curStone.->pixmapcxx . . $ QGraphicsPixmapItem#pixmap(3b2d5b7187256452).().heightcxx . . $ QPixmap#height(455f465bc33b4cdf).()/2 );
957 // curStone->setX(offsetX + square_size * (x-1));
958 // curStone->setY(offsetY + square_size * (y-1));
959 curStonecxx . . $ Board#curStone.->setCoordcxx . . $ Stone#setCoord(3e454b8ccf442868).(x, y);
960 /*
961 bool notMyTurn = (curStone->getColor() == stoneBlack && !myColorIsBlack ||
962 curStone->getColor() == stoneWhite && myColorIsBlack);
963
964 if (navIntersectionStatus ||
965 boardHandler->getGameMode() == modeObserve ||
966 ( boardHandler->getGameMode() == modeMatch && notMyTurn) ||
967 ( boardHandler->getGameMode() == modeComputer && notMyTurn))
968
969 curStone->hide();
970 else
971 */
972 curStonecxx . . $ Board#curStone.->showcxx . . $ Stone#show(49f6e7a06ebc5aa8).();
973 }
974
975 /*
976 * mouse wheel has been turned
977 */
978 void Boardcxx . . $ Board#::wheelEventcxx . . $ Board#wheelEvent(92d40974398e4832).(QWheelEventcxx . . $ QWheelEvent# *e)
979 {
980 emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! signalWheelEventcxx . . $ Board#signalWheelEvent(92d40974398e4832).( e);
981 }
982
983 /*
984 * starts the counter for anticlivko moves
985 */
986 void Boardcxx . . $ Board#::mousePressEventcxx . . $ Board#mousePressEvent(702858a82d06265c).(QMouseEventcxx . . $ QMouseEvent# * e)
987 {
988 downXcxx . . $ Board#downX. = convertCoordsToPointcxx . . $ Board#convertCoordsToPoint(9b79fb6aee4c0440).(e->xcxx . . $ QMouseEvent#x(455f465bc33b4cdf).(), offsetXcxx . . $ Board#offsetX.),
989 downYcxx . . $ Board#downY. = convertCoordsToPointcxx . . $ Board#convertCoordsToPoint(9b79fb6aee4c0440).(e->ycxx . . $ QMouseEvent#y(455f465bc33b4cdf).(), offsetYcxx . . $ Board#offsetY.);
990
991 // Button gesture outside the board?
992 if ((downXcxx . . $ Board#downX. < 1) || downXcxx . . $ Board#downX. > board_sizecxx . . $ Board#board_size. || downYcxx . . $ Board#downY. < 1 || downYcxx . . $ Board#downY. > board_sizecxx . . $ Board#board_size.)
993 {
994 downXcxx . . $ Board#downX. = downYcxx . . $ Board#downY. = -1;
995 //return //??
996 }
997 clickTimecxx . . $ Board#clickTime. =cxx . . $ QTime#`operator=`(370b645f04941e62). QTimecxx . . $ QTime#::currentTimecxx . . $ QTime#currentTime(bd2fc2b92108c576).();
998 clickTimecxx . . $ Board#clickTime. =cxx . . $ QTime#`operator=`(370b645f04941e62). clickTimecxx . . $ Board#clickTime..addMSecscxx . . $ QTime#addMSecs(902e6118dfa1a226).(250);
999 }
1000
1001 void Boardcxx . . $ Board#::mouseReleaseEventcxx . . $ Board#mouseReleaseEvent(702858a82d06265c).(QMouseEventcxx . . $ QMouseEvent#* e)
1002 {
1003 mouseStatecxx . . $ Board#mouseState. = e->buttoncxx . . $ QMouseEvent#button(4a2598559eeedfc9).();
1004
1005 int x = convertCoordsToPointcxx . . $ Board#convertCoordsToPoint(9b79fb6aee4c0440).(e->xcxx . . $ QMouseEvent#x(455f465bc33b4cdf).(), offsetXcxx . . $ Board#offsetX.),
1006 y = convertCoordsToPointcxx . . $ Board#convertCoordsToPoint(9b79fb6aee4c0440).(e->ycxx . . $ QMouseEvent#y(455f465bc33b4cdf).(), offsetYcxx . . $ Board#offsetY.);
1007
1008 /* FIXME click protection... if we don't like, we should change it */
1009 if(downXcxx . . $ Board#downX. != x || downYcxx . . $ Board#downY. != y)
1010 {
1011 downXcxx . . $ Board#downX. = downYcxx . . $ Board#downY. = -1;
1012 return;
1013 }
1014 downXcxx . . $ Board#downX. = downYcxx . . $ Board#downY. = -1;
1015 // Button gesture outside the board?
1016 if ((x < 1) || x > board_sizecxx . . $ Board#board_size. || y < 1 || y > board_sizecxx . . $ Board#board_size.)
1017 /* {
1018 if (e->button() == LeftButton &&
1019 e->state() == RightButton)
1020 previousMove();
1021 else if (e->button() == RightButton &&
1022 e->state() == LeftButton)
1023 nextMove();
1024 else if (e->button() == LeftButton &&
1025 e->state() == MidButton)
1026 gotoVarStart();
1027 else if (e->button() == RightButton &&
1028 e->state() == MidButton)
1029 gotoNextBranch();
1030 */
1031 return;
1032 // }
1033 /*
1034 // Lock accidental gesture over board
1035 if ((e->button() == Qt::LeftButton && e->state() == Qt::RightButton) ||
1036 (e->button() == Qt::RightButton && e->state() == Qt::LeftButton) ||
1037 (e->button() == Qt::LeftButton && e->state() == Qt::MidButton) ||
1038 (e->button() == Qt::RightButton && e->state() == Qt::MidButton))
1039 return;
1040 */
1041 // Check delay
1042 bool delay = (QTimecxx . . $ QTime#::currentTimecxx . . $ QTime#currentTime(bd2fc2b92108c576).() >cxx . . $ QTime#`operator>`(1610574c25194847). clickTimecxx . . $ Board#clickTime.);
1043 //note that apparently nothing uses delay at the moment
1044 emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! signalClickedcxx . . $ Board#signalClicked(916cfd9b6aad83bf).(delay, x , y , mouseStatecxx . . $ Board#mouseState.);
1045 }
1046
1047 /*
1048 * called when using a button menu 'export'
1049 * saves the board image and puts it to clipboard or file
1050 */
1051 void Boardcxx . . $ Board#::exportPicturecxx . . $ Board#exportPicture(9753f68407e56b8c).(const QStringcxx . . $ QString# &fileName, QStringcxx . . $ QString# *filter, bool toClipboard)
1052 {
1053
1054 QPixmapcxx . . $ QPixmap# pix = this->grabcxx . . $ QWidget#grab(da70d904fbfe238a).(tablecxx . . $ Board#table.->boundingRectcxx . . $ QGraphicsRectItem#boundingRect(19f9350443f914b1).().toAlignedRectcxx . . $ QRectF#toAlignedRect(e6cdfbae3abc21e7).());
1055
1056 if (toClipboard)
1057 {
1058 QApplicationcxx . . $ QApplication#::clipboardcxx . . $ QGuiApplication#clipboard(a5a00f8d44f5ac9e).()->setPixmapcxx . . $ QClipboard#setPixmap(c0b2b2a0a34b05e5).(pix);
1059 return;
1060 }
1061
1062
1063 if (!pix.savecxx . . $ QPixmap#save(a8460a5471764038).(fileName, filter->toLatin1cxx . . $ QString#toLatin1(ef52b713090bc85a).()))
1064 QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(a9e3742e6f7b4147).(this, PACKAGEcxx . . $ `src/defines.h:32:9`!, trcxx . . $ Board#tr(75d9f1c324b4579d).("Failed to save image!"));
1065 }
1066
1067 bool Boardcxx . . $ Board#::updateAllcxx . . $ Board#updateAll(2b3560a733ced049).(Movecxx . . $ Move# * move)
1068 {
1069 Matrixcxx . . $ Matrix# * m = move->getMatrixcxx . . $ Move#getMatrix(a22259058712982).();
1070 Q_CHECK_PTRcxx . . $ `<external>/15045578679651060896/qglobal.h:890:11`!(m);
1071
1072 bool modified = false;//, fake = false;
1073 StoneColorcxx . . $ StoneColor# color;
1074 bool dead;
1075 /*
1076 * Synchronize the matrix with the stonehandler data and
1077 * update the canvas.
1078 * This is usually called when navigating through the tree.
1079 */
1080 for (int y=1; y<=board_sizecxx . . $ Board#board_size.; y++)
1081 {
1082 for (int x=1; x<=board_sizecxx . . $ Board#board_size.; x++)
1083 {
1084 /* FIXME apparently matrix uses negative values for
1085 * both dead and edited stones. I think the
1086 * assumption is that we won't be editing during
1087 * a score phase which is the only time things will
1088 * be marked dead whereas other ghosts are used
1089 * for variations.
1090 * I'm not sure what the consequences on editing
1091 * will be for this, but for now, I just want to
1092 * make sure the handicap stones can't be ghosted.
1093 * We could say that the handicap stones aren't
1094 * edits, but this is what they've been set up
1095 * as so that's more tricky. */
1096 dead = (m->isStoneDeadcxx . . $ Matrix#isStoneDead(cf9ef193275fa6d8).(x, y)) & (move->getMoveNumbercxx . . $ Move#getMoveNumber(455f465bc33b4cdf).() != 0);
1097 color = m->getStoneAtcxx . . $ Matrix#getStoneAt(876dc10d7c60d8).(x, y);
1098
1099 if (oneColorGocxx . . $ Board#oneColorGo. && color == stoneBlackcxx . . $ stoneBlack.)
1100 color = stoneWhitecxx . . $ stoneWhite.;
1101 updateStonecxx . . $ Board#updateStone(615937dc839e801b).(color,x,y, dead);
1102
1103 switch (m->getMarkAtcxx . . $ Matrix#getMarkAt(cd452d1956ab952a).(x, y))
1104 {
1105 case markKoMarkercxx . . $ markKoMarker.:
1106 case markSquarecxx . . $ markSquare.:
1107 modified = true;
1108 setMarkcxx . . $ Board#setMark(18adccc0109412ba).(x, y, markSquarecxx . . $ markSquare., false);
1109 break;
1110
1111 case markCirclecxx . . $ markCircle.:
1112 modified = true;
1113 setMarkcxx . . $ Board#setMark(18adccc0109412ba).(x, y, markCirclecxx . . $ markCircle., false);
1114 break;
1115
1116 case markTrianglecxx . . $ markTriangle.:
1117 modified = true;
1118 setMarkcxx . . $ Board#setMark(18adccc0109412ba).(x, y, markTrianglecxx . . $ markTriangle., false);
1119 break;
1120
1121 case markCrosscxx . . $ markCross.:
1122 modified = true;
1123 setMarkcxx . . $ Board#setMark(18adccc0109412ba).(x, y, markCrosscxx . . $ markCross., false);
1124 break;
1125
1126 case markTextcxx . . $ markText.:
1127 modified = true;
1128 setMarkcxx . . $ Board#setMark(18adccc0109412ba).(x, y, markTextcxx . . $ markText., false, m->getMarkTextcxx . . $ Matrix#getMarkText(ff5dcb9213a676d0).(x, y));
1129 break;
1130
1131 case markNumbercxx . . $ markNumber.:
1132 modified = true;
1133 setMarkcxx . . $ Board#setMark(18adccc0109412ba).(x, y, markNumbercxx . . $ markNumber., false, m->getMarkTextcxx . . $ Matrix#getMarkText(ff5dcb9213a676d0).(x, y));
1134 break;
1135
1136 case markTerrBlackcxx . . $ markTerrBlack.:
1137 modified = true;
1138 setMarkcxx . . $ Board#setMark(18adccc0109412ba).(x, y, markTerrBlackcxx . . $ markTerrBlack., false);
1139 break;
1140
1141 case markTerrWhitecxx . . $ markTerrWhite.:
1142 modified = true;
1143 setMarkcxx . . $ Board#setMark(18adccc0109412ba).(x, y, markTerrWhitecxx . . $ markTerrWhite., false);
1144 break;
1145
1146 case markNonecxx . . $ markNone.:
1147 case markTerrDamecxx . . $ markTerrDame.:
1148 if (hasMarkcxx . . $ Board#hasMark(9649d5d3ce79ba50).(x, y))
1149 {
1150 modified = true;
1151 removeMarkcxx . . $ Board#removeMark(6908015b96d379c0).(x, y, false);
1152 }
1153 default:
1154 break;
1155 }
1156 }
1157 }
1158 return modified;
1159 }
1160
1161 /*
1162 * Update the variation marks on the board if any
1163 */
1164 void Boardcxx . . $ Board#::updateVariationGhostscxx . . $ Board#updateVariationGhosts(490cd2a4f5caa810).(Movecxx . . $ Move# *move)
1165 {
1166 // qDebug("BoardHandler::updateVariationGhosts()");
1167 Movecxx . . $ Move# *m = move->parentcxx . . $ Move#parent.->soncxx . . $ Move#son.;
1168 Q_CHECK_PTRcxx . . $ `<external>/15045578679651060896/qglobal.h:890:11`!(m);
1169
1170 do
1171 {
1172 setVarGhostcxx . . $ Board#setVarGhost(e6b2860cd25699f2).(m->getColorcxx . . $ Move#getColor(6680c74b05d375a4).(), m->getXcxx . . $ Move#getX(455f465bc33b4cdf).(), m->getYcxx . . $ Move#getY(455f465bc33b4cdf).());
1173 } while ((m = m->brothercxx . . $ Move#brother.) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
1174 }