Source
930
930
std::cout << "PlotFlagAllTool::handleMouseEvent" << std::endl;
931
931
m_lastEventHandled = false;
932
932
if(m_canvas == NULL) return;
933
933
934
934
const PlotClickEvent *c = dynamic_cast<const PlotClickEvent*>(&event);
935
935
if(c != NULL) {
936
936
std::cout << "PlotFlagAllTool::handleMouseEvent mouse clicked" << std::endl;
937
937
}
938
938
}
939
939
940
+
/////////////////////////////////
941
+
// PLOTUNFLAGALLTOOL DEFINITIONS //
942
+
/////////////////////////////////
943
+
944
+
PlotUnflagAllTool::PlotUnflagAllTool(PlotCoordinate::System sys) :
945
+
PlotMouseTool(sys)
946
+
{ }
947
+
948
+
PlotUnflagAllTool::PlotUnflagAllTool(PlotAxis xAxis, PlotAxis yAxis,
949
+
PlotCoordinate::System sys) : PlotMouseTool(xAxis, yAxis, sys)
950
+
{ }
951
+
952
+
PlotUnflagAllTool::~PlotUnflagAllTool() { }
953
+
954
+
void PlotUnflagAllTool::handleMouseEvent(const PlotEvent& event) {
955
+
std::cout << "PlotUnflagAllTool::handleMouseEvent" << std::endl;
956
+
m_lastEventHandled = false;
957
+
if(m_canvas == NULL) return;
958
+
959
+
const PlotClickEvent *c = dynamic_cast<const PlotClickEvent*>(&event);
960
+
if(c != NULL) {
961
+
std::cout << "PlotUnflagAllTool::handleMouseEvent mouse clicked" << std::endl;
962
+
}
963
+
}
964
+
940
965
////////////////////////////////////
941
966
// PLOTMOUSETOOLGROUP DEFINITIONS //
942
967
////////////////////////////////////
943
968
944
969
// Public Methods //
945
970
946
971
PlotMouseToolGroup::PlotMouseToolGroup() { }
947
972
948
973
949
974
PlotMouseToolGroup::~PlotMouseToolGroup() { }
1174
1199
////////////////////////////////////////////
1175
1200
1176
1201
1177
1202
PlotStandardMouseToolGroup::PlotStandardMouseToolGroup(ToolCode activeTool,
1178
1203
PlotCoordinate::System system) {
1179
1204
1180
1205
addTool(new PlotSelectTool(system));
1181
1206
addTool(new PlotZoomTool(system));
1182
1207
addTool(new PlotPanTool(system));
1183
1208
addTool(new PlotFlagAllTool(system));
1209
+
addTool(new PlotUnflagAllTool(system));
1184
1210
setActiveTool(activeTool);
1185
1211
m_tracker = new PlotTrackerTool(system);
1186
1212
m_tracker->setBlocking(false);
1187
1213
m_coordSystem = system;
1188
1214
}
1189
1215
1190
1216
1191
1217
1192
1218
PlotStandardMouseToolGroup::PlotStandardMouseToolGroup(PlotAxis xAxis,
1193
1219
PlotAxis yAxis,
1194
1220
ToolCode activeTool,
1195
1221
PlotCoordinate::System system) {
1196
1222
1197
1223
addTool(new PlotSelectTool(xAxis, yAxis, system));
1198
1224
addTool(new PlotZoomTool(xAxis, yAxis, system));
1199
1225
addTool(new PlotPanTool(xAxis, yAxis, system));
1200
1226
addTool(new PlotFlagAllTool(xAxis, yAxis, system));
1227
+
addTool(new PlotUnflagAllTool(xAxis, yAxis, system));
1201
1228
setActiveTool(activeTool);
1202
1229
m_tracker = new PlotTrackerTool(xAxis, yAxis, system);
1203
1230
m_tracker->setBlocking(false);
1204
1231
m_xAxis = xAxis;
1205
1232
m_yAxis = yAxis;
1206
1233
m_coordSystem = system;
1207
1234
}
1208
1235
1209
1236
1210
1237
1211
1238
PlotStandardMouseToolGroup::PlotStandardMouseToolGroup(
1212
1239
PlotSelectToolPtr selectTool,
1213
1240
PlotZoomToolPtr zoomTool,
1214
1241
PlotPanToolPtr panTool,
1215
1242
PlotFlagAllToolPtr flagAllTool,
1243
+
PlotUnflagAllToolPtr unflagAllTool,
1216
1244
PlotTrackerToolPtr trackerTool,
1217
1245
ToolCode activeTool) {
1218
1246
1219
1247
addTool(!selectTool.null() ? selectTool : new PlotSelectTool());
1220
1248
addTool(!zoomTool.null() ? zoomTool : new PlotZoomTool());
1221
1249
addTool(!panTool.null() ? panTool : new PlotPanTool());
1222
1250
addTool(!flagAllTool.null() ? flagAllTool : new PlotFlagAllTool());
1251
+
addTool(!unflagAllTool.null() ? unflagAllTool : new PlotUnflagAllTool());
1223
1252
setActiveTool(activeTool);
1224
1253
m_tracker = !trackerTool.null() ? trackerTool : new PlotTrackerTool();
1225
1254
m_tracker->setBlocking(false);
1226
1255
}
1227
1256
1228
1257
1229
1258
1230
1259
PlotStandardMouseToolGroup::~PlotStandardMouseToolGroup() { }
1231
1260
1232
1261
1236
1265
1237
1266
if(toolcode == NONE_TOOL) {
1238
1267
PlotMouseToolGroup::setActiveTool(PlotMouseToolPtr());
1239
1268
return;
1240
1269
}
1241
1270
for(unsigned int i = 0; i < m_tools.size(); i++) {
1242
1271
if (((dynamic_cast<PlotSelectTool*>(&*m_tools[i]) != NULL && toolcode==SELECT_TOOL))
1243
1272
|| ((dynamic_cast<PlotSelectTool*>(&*m_tools[i]) != NULL && toolcode==SUBTRACT_TOOL))
1244
1273
|| ((dynamic_cast<PlotZoomTool*>(&*m_tools[i]) != NULL && toolcode==ZOOM_TOOL))
1245
1274
|| ((dynamic_cast<PlotPanTool*>(&*m_tools[i]) != NULL) && toolcode==PAN_TOOL)
1246
-
|| ((dynamic_cast<PlotFlagAllTool*>(&*m_tools[i]) != NULL) && toolcode == FLAGALL_TOOL))
1275
+
|| ((dynamic_cast<PlotFlagAllTool*>(&*m_tools[i]) != NULL) && toolcode == FLAGALL_TOOL)
1276
+
|| ((dynamic_cast<PlotUnflagAllTool*>(&*m_tools[i]) != NULL) && toolcode == UNFLAGALL_TOOL))
1247
1277
{
1248
1278
std::cout << "toolcode = " << (Int)toolcode << std::endl;
1249
1279
PlotMouseToolGroup::setActiveTool(i, toolcode);
1250
1280
return;
1251
1281
}
1252
1282
}
1253
1283
}
1254
1284
1255
1285
1256
1286
1341
1371
if(dynamic_cast<PlotFlagAllTool*>(&*m_tools[i]) != NULL)
1342
1372
return PlotFlagAllToolPtr(m_tools[i]);
1343
1373
1344
1374
// shouldn't happen!
1345
1375
PlotFlagAllToolPtr t = new PlotFlagAllTool();
1346
1376
m_tools.push_back(t);
1347
1377
return t;
1348
1378
}
1349
1379
1350
1380
1381
+
PlotUnflagAllToolPtr PlotStandardMouseToolGroup::unflagAllTool() {
1382
+
for(unsigned int i = 0; i < m_tools.size(); i++)
1383
+
if(dynamic_cast<PlotUnflagAllTool*>(&*m_tools[i]) != NULL)
1384
+
return PlotUnflagAllToolPtr(m_tools[i]);
1385
+
1386
+
// shouldn't happen!
1387
+
PlotUnflagAllToolPtr t = new PlotUnflagAllTool();
1388
+
m_tools.push_back(t);
1389
+
return t;
1390
+
}
1391
+
1392
+
1393
+
1351
1394
PlotTrackerToolPtr PlotStandardMouseToolGroup::trackerTool() {
1352
1395
return m_tracker;
1353
1396
}
1354
1397
1355
1398
1356
1399
1357
1400
1358
1401
// Protected Methods //
1359
1402
1360
1403
void PlotStandardMouseToolGroup::attach(PlotCanvas* canvas) {