Changeset 2539 in Sophya for trunk/SophyaPI
- Timestamp:
- May 25, 2004, 12:45:08 AM (21 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/pi3dwdg.cc
r2528 r2539 35 35 // * <Alt>G : Affichage d'une fenêtre de changement des attributs graphiques 36 36 // * <Alt>O : Action identique a <Alt>G 37 // * <Alt>D : Affichage du menu de manipulation des traceurs (drawers) 37 38 // * <Alt>V : Copier/*Coller* Ajout du texte du buffer copier/coller 38 39 // sur l'objet à la position courante de la souris … … 89 90 cTeta = cPhi = 0.; cUlen = 1.; 90 91 92 // Menu pour la manipulation des drawers 93 mDrwMen = NULL; 94 91 95 ActivateKeyboard(); 92 96 ActivateButton(2); // Pour pouvoir tourner la camera … … 106 110 delete mBDrw; 107 111 delete mGr3d; 112 if (mDrwMen) delete mDrwMen; 108 113 } 109 114 … … 256 261 else if (key == 'G' || key == 'g') // Fenetre des options graphiques de trace 257 262 PIDrwTools::ShowPIDrwTools(this); 263 else if (key == 'D' || key == 'd') { // Menu de manipulation des drawers 264 if (mDrwMen) delete mDrwMen; 265 mDrwMen = new PIDrwMgrMenu(this, true); 266 mDrwMen->Show(); 267 } 258 268 259 269 else if (key == 'A' || key == 'a') { // On affiche ou on enleve les axes -
trunk/SophyaPI/PI/pi3dwdg.h
r2528 r2539 16 16 17 17 //------------------------------ Classe PIDrawer3D -------------------- 18 class PIDrwMgrMenu; 18 19 19 20 class PIDraw3DWdg : public PIBaseWdg { … … 84 85 bool axfg; // si Vrai on trace les axes 85 86 bool skcfg; // si Vrai click-2 au centre -> rotation objet 87 88 // Menu pour la manipulation des drawers 89 PIDrwMgrMenu* mDrwMen; 86 90 }; 87 91 -
trunk/SophyaPI/PI/pidrwtools.cc
r2529 r2539 947 947 948 948 PIGraphic* gr = mBWdg->WindowGraphic(); 949 949 mBWdg->GetActiveDrawer()->HighLight(true); 950 950 PIGOMode gmod = gr->GetGOMode(); 951 951 PILineAtt gline = gr->GetLineAtt(); … … 976 976 void PIDrwPosSizeEvH::CheckBeforeDelete() 977 977 { 978 if (!_rmok) 978 if (!_rmok) { 979 PIDrawer* adrw = mBWdg->GetActiveDrawer(); 980 if (adrw) adrw->HighLight(true); 979 981 mBWdg->RemoveEventHandler(this); 982 } 980 983 _rmok = true; 981 984 } … … 1120 1123 // On enleve le handler 1121 1124 // cout << " DBG- mBWdg->RemoveEventHandler(this); " << endl; 1125 PIDrawer* adrw = mBWdg->GetActiveDrawer(); 1126 if (adrw) adrw->HighLight(false); 1122 1127 mBWdg->RemoveEventHandler(this); 1123 1128 _rmok = true; … … 1181 1186 } 1182 1187 1188 //----------------------------------------------------------------- 1189 //------- Classe Event handler pour Mouse Select de l'active Drawer 1190 class PIDrwSelectEvH : public PIEventHandler { 1191 public: 1192 PIDrwSelectEvH(PIBaseWdg* bwdg); 1193 void CheckBeforeDelete(); 1194 virtual void ProcessEvent(); 1195 1196 protected: 1197 // void ComputeResizeZone(); 1198 void ComputeOKZone(); 1199 // inline void ComputeDrawerZone() 1200 // { x1 = _x1; y1 = _y1; x2 = _x2-_x1; y2 = _y2-_y1; } 1201 1202 1203 PIBaseWdg* mBWdg; 1204 int _caid; 1205 int _x1, _y1, _x2, _y2; 1206 PIGrCoord x1, y1, x2, y2; 1207 PIGrCoord xc, yc, rc; 1208 bool _okend; 1209 bool _rmok; 1210 }; 1211 1212 /* --Methode-- */ 1213 PIDrwSelectEvH::PIDrwSelectEvH(PIBaseWdg* bwdg) 1214 { 1215 mBWdg = bwdg; 1216 _x1 = _y1 = _x2 = _y2 = -1; 1217 x1 = y1 = x2 = y2 = xc = yc = rc = -1; 1218 _okend = false; 1219 _rmok = false; 1220 if (bwdg == NULL) return; 1221 1222 int aid = bwdg->GetActiveDrawerId(); 1223 if (aid < 0) return; 1224 1225 mBWdg->GetActiveDrawer()->HighLight(true); 1226 _caid = aid; 1227 1228 PIGraphic* gr = mBWdg->WindowGraphic(); 1229 1230 PIGOMode gmod = gr->GetGOMode(); 1231 PILineAtt gline = gr->GetLineAtt(); 1232 PIColors gcol = gr->GetForeground(); 1233 1234 gr->SelForeground(PI_Magenta); 1235 gr->SelGOMode(PI_GOXOR); 1236 gr->SelLine(PI_ThinLine); 1237 1238 ComputeOKZone(); 1239 gr->DrawBox(x1,y1, x2, y2); 1240 gr->DrawFCircle(xc,yc,rc); 1241 1242 gr->SelGOMode(gmod); 1243 gr->SelLine(gline); 1244 gr->SelForeground(gcol); 1245 1246 // cout << "DBG- Adding Event-Handler " << endl; 1247 mBWdg->AddEventHandler(this, PIEvent_But1Press); 1248 } 1249 /* --Methode-- */ 1250 void PIDrwSelectEvH::CheckBeforeDelete() 1251 { 1252 if (!_rmok) { 1253 PIDrawer* adrw = mBWdg->GetActiveDrawer(); 1254 if (adrw) adrw->HighLight(true); 1255 mBWdg->RemoveEventHandler(this); 1256 } 1257 _rmok = true; 1258 } 1259 1260 1261 /* --Methode-- */ 1262 void PIDrwSelectEvH::ComputeOKZone() 1263 { 1264 bool _elastic = false; 1265 int aid = mBWdg->GetActiveDrawerId(); 1266 if (mBWdg->IsDrawerAutoSizePos(aid)) { 1267 mBWdg->GetDefaultDrawRectangle(x1, y1, x2, y2, _elastic); 1268 } 1269 else { 1270 mBWdg->GetDrawerPosition(aid, x1, y1, x2, y2, _elastic); 1271 } 1272 1273 if (_elastic) { 1274 _x1 = (double)x1*(double)mBWdg->XSize(); 1275 _x2 = (double)x2*(double)mBWdg->XSize(); 1276 _y1 = (double)y1*(double)mBWdg->YSize(); 1277 _y2 = (double)y2*(double)mBWdg->YSize(); 1278 } 1279 else { 1280 _x1 = x1; _x2 = x2; 1281 _y1 = y1; _y2 = y2; 1282 } 1283 1284 int dx = (int)(0.06*(_x2-_x1)); 1285 int dy = (int)(0.06*(_y2-_y1)); 1286 if (dx < 20) dx = 20; 1287 if (dy < 20) dx = 20; 1288 int dxy = (dx < dy) ? dx : dy ; 1289 if (dxy%2 != 0) dxy++; 1290 _x1 = _x2-dxy; 1291 _y1 = _y2-dxy; 1292 x1 = _x1; 1293 y1 = _y1; 1294 x2 = y2 = dxy; 1295 xc = _x1+dxy/2; 1296 yc = _y1+dxy/2; 1297 rc = dxy/2-2; 1298 } 1299 1300 /* --Methode-- */ 1301 void PIDrwSelectEvH::ProcessEvent() 1302 { 1303 1304 bool chgadrw = false; 1305 int nid = -1; 1306 1307 PIGraphic* gr = mBWdg->WindowGraphic(); 1308 1309 PIGOMode gmod = gr->GetGOMode(); 1310 PILineAtt gline = gr->GetLineAtt(); 1311 PIColors gcol = gr->GetForeground(); 1312 1313 1314 switch (EventType()) { 1315 case PIEvent_But1Press : 1316 // Zone OK=Fin 1317 if ( (GetPosX() >= _x1) && (GetPosX() <= _x2) && 1318 (GetPosY() >= _y1) && ((GetPosY() <= _y2) ) ) _okend = true; 1319 else { 1320 nid = mBWdg->FindNearestDrawerId(GetPosX(), GetPosY()); 1321 if (nid != _caid) chgadrw = true; 1322 } 1323 break; 1324 1325 default : 1326 break; 1327 } 1328 if ( _okend || chgadrw ) { 1329 gr->SelForeground(PI_Magenta); 1330 gr->SelGOMode(PI_GOXOR); 1331 gr->SelLine(PI_ThinLine); 1332 1333 gr->DrawBox(x1,y1, x2, y2); 1334 gr->DrawFCircle(xc,yc,rc); 1335 1336 gr->SelGOMode(gmod); 1337 gr->SelLine(gline); 1338 gr->SelForeground(gcol); 1339 1340 PIDrawer* adrw = mBWdg->GetActiveDrawer(); 1341 if (adrw) adrw->HighLight(false); 1342 1343 if (_okend) { 1344 mBWdg->RemoveEventHandler(this); 1345 _rmok = true; 1346 return; 1347 } 1348 else { 1349 mBWdg->SetActiveDrawerId(nid); 1350 _caid = nid; 1351 adrw = mBWdg->GetActiveDrawer(); 1352 if (adrw) adrw->HighLight(true); 1353 1354 gr->SelForeground(PI_Magenta); 1355 gr->SelGOMode(PI_GOXOR); 1356 gr->SelLine(PI_ThinLine); 1357 1358 ComputeOKZone(); 1359 1360 gr->DrawBox(x1,y1, x2, y2); 1361 gr->DrawFCircle(xc,yc,rc); 1362 1363 gr->SelGOMode(gmod); 1364 gr->SelLine(gline); 1365 gr->SelForeground(gcol); 1366 } 1367 } 1368 } 1369 1370 1371 1183 1372 //------------------------------------------------------------ 1184 1373 /* --Methode-- */ … … 1190 1379 mFgxor = fgxor; 1191 1380 mEvH = NULL; 1381 mSEvH = NULL; 1192 1382 1193 1383 if (bwdg == NULL) return; … … 1199 1389 AppendSeparator(); 1200 1390 AppendItem("Detach", 405); 1201 AppendItem(" Highlight", 406);1391 AppendItem("MouseSelect", 406); 1202 1392 AppendItem("Refresh", 407); 1203 1393 int aid = bwdg->GetActiveDrawerId(); … … 1221 1411 mit += bwdg->GetDrawer(k)->Name(); 1222 1412 mListDrw->AppendItem(mit.c_str(), 1000+k); 1413 if (bwdg->GetDrawerIdFromNum(k) == aid) 1414 mListDrw->SetSensitivityMsg(1000+k, false); 1223 1415 } 1224 1416 AppendPDMenu(mListDrw); 1225 1417 } 1226 PIDrawer* actdr = mBWdg->GetActiveDrawer();1227 if (actdr) actdr->HighLight(true);1418 //SUP PIDrawer* actdr = mBWdg->GetActiveDrawer(); 1419 //SUP if (actdr) actdr->HighLight(true); 1228 1420 } 1229 1421 … … 1235 1427 mEvH->CheckBeforeDelete(); 1236 1428 delete mEvH; 1429 } 1430 if (mSEvH) { 1431 mSEvH->CheckBeforeDelete(); 1432 delete mSEvH; 1237 1433 } 1238 1434 } … … 1249 1445 case 401 : 1250 1446 if (aid >= 0) PIDrwTools::ShowPIDrwTools(mBWdg); 1251 if (actdrw != NULL) actdrw->HighLight(false);1252 1447 break; 1253 1448 case 402 : … … 1260 1455 if (actdrw != NULL) { 1261 1456 actdrw->ShowControlWindow(mBWdg); 1262 actdrw->HighLight(false);1263 1457 } 1264 1458 break; 1265 1459 case 404 : 1266 if (mEvH) delete mEvH; 1267 if (actdrw != NULL) actdrw->HighLight(false); 1460 if (mEvH) { 1461 mEvH->CheckBeforeDelete(); 1462 delete mEvH; 1463 } 1268 1464 mEvH = new PIDrwPosSizeEvH(mBWdg, mFgxor); 1269 1465 break; … … 1275 1471 break; 1276 1472 case 406 : 1277 if (actdrw != NULL) actdrw->HighLight(true); 1473 if (mSEvH) { 1474 mSEvH->CheckBeforeDelete(); 1475 delete mSEvH; 1476 } 1477 mSEvH = new PIDrwSelectEvH(mBWdg); 1278 1478 break; 1279 1479 case 407 : -
trunk/SophyaPI/PI/pidrwtools.h
r2529 r2539 85 85 //------------------------------------------------------------------------------------------- 86 86 class PIDrwPosSizeEvH; // Event Handler pour le deplacement/resize des drawers 87 class PIDrwSelectEvH; // Event Handler pour la selection interactive des drawers 87 88 88 89 class PIDrwMgrMenu : public PIMenu { … … 96 97 bool mFgxor; 97 98 PIDrwPosSizeEvH* mEvH; 99 PIDrwSelectEvH* mSEvH; 98 100 }; 99 101 -
trunk/SophyaPI/PI/piimage.cc
r2528 r2539 41 41 // * <Alt>O : Affichage de la fenêtre de contrôle des paramètres de visualisation. 42 42 // * <Alt>G : Affichage de la fenêtre de changement des attributs graphiques 43 // * <Alt>D : Affichage du menu de manipulation des traceurs (drawers) 43 44 // * <Alt>R : Rafraîchit l'affichage. 44 45 // * <Alt>V : Copier/*Coller* Ajout du texte du buffer copier/coller … … 151 152 cpbuflen = 0; 152 153 154 // Menu pour la manipulation des drawers 155 mDrwMen = NULL; 156 153 157 SetBackgroundColor(PI_Black); 154 158 … … 190 194 delete trtw; 191 195 if (cpbuffer) delete[] cpbuffer; 196 if (mDrwMen) delete mDrwMen; 192 197 if (this == cur_piimage) cur_piimage = NULL; 193 198 } … … 738 743 PIDrwTools::ShowPIDrwTools(); // Fentre axes et options de trace 739 744 } 745 else if (key == 'D' || key == 'd') { // Menu de manipulation des drawers 746 if (mDrwMen) delete mDrwMen; 747 mDrwMen = new PIDrwMgrMenu(this, true); 748 mDrwMen->Show(); 749 } 740 750 else if (key == 'P' || key == 'p') { // Activation/desactivation affichage curseur 741 751 bool sc = !curshow; -
trunk/SophyaPI/PI/piimage.h
r1914 r2539 18 18 19 19 class PIScDrawWdg; 20 class PIDrwMgrMenu; 20 21 21 22 class PIImage : public PIPixmap … … 198 199 // PIImage courante 199 200 static PIImage* cur_piimage; 201 202 // Menu pour la manipulation des drawers 203 PIDrwMgrMenu* mDrwMen; 200 204 }; 201 205 -
trunk/SophyaPI/PI/piscdrawwdg.cc
r2530 r2539 32 32 // (Par défaut, action identique à <Alt>G) 33 33 // * <Alt>G : Affichage de la fenêtre de changement des attributs graphiques 34 // * <Alt>D : Affichage du menu de manipulation des traceurs (drawers) 34 35 // * <Alt>R : Rafraîchit l'affichage. 35 36 // * <Alt>M : Active/Désactive l'affichage d'une réticule de mesure (Bouton-1) … … 80 81 { 81 82 mFgReticule = false; 82 mFgShiftBut = false;83 83 mCPosX = mCPosY = 0; 84 84 mPPos[0] = mPPos[1] = 0.; … … 156 156 PIAxesTools::ShowPIAxesTools(); // Fenetre de gestion des axes 157 157 } 158 else if (key == 'D' || key == 'd') { 158 else if (key == 'D' || key == 'd') { // Menu de manipulation des drawers 159 159 if (mDrwMen) delete mDrwMen; 160 160 mDrwMen = new PIDrwMgrMenu(this, true); … … 424 424 unsigned long tm; 425 425 GetLastEventInfo(kmod, tm); 426 if (kmod == PIKM_Shift) { //SetActive Drawer on Shift-Button-1427 mFgShiftBut = true;428 int nid = FindNearestDrawerId(x,y);429 SetActiveDrawerId(nid);430 PIDrawer* actdr = GetActiveDrawer();431 if (actdr) {432 actdr->HighLight(true);433 if (mDrwMen) delete mDrwMen;434 mDrwMen = new PIDrwMgrMenu(this);435 mDrwMen->Show(this, x, y);436 }437 return;438 }439 426 UpdateText(x, y); 440 427 if (mTrW) … … 467 454 PIScDrawWdg::Ptr1Move(int x, int y) 468 455 { 469 if (mFgShiftBut) return; //SetActive Drawer on Shift-Button-1470 456 UpdateText(x, y); // Met a jour mPPos 471 457 if (mFgReticule) DrawReticule(x,y,1); … … 474 460 void 475 461 PIScDrawWdg::But1Release(int x, int y) 476 { 477 if (mFgShiftBut) { //SetActive Drawer on Shift-Button-1 478 mFgShiftBut = false; 479 /* 480 PIDrawer* actdr = GetActiveDrawer(); 481 if (actdr) { 482 // actdr->HighLight(false); 483 if (mDrwMen) delete mDrwMen; 484 mDrwMen = new PIDrwMgrMenu(this); 485 mDrwMen->Show(); 486 } 487 */ 488 return; 489 } 490 462 { 491 463 UpdateText(x, y); 492 464 if (mFgReticule) DrawReticule(x,y,2); -
trunk/SophyaPI/PI/piscdrawwdg.h
r2528 r2539 102 102 int mPosFDX, mPosFDY; // Position (coord fenetre memorise) 103 103 bool mFgReticule; // Controle l'affiche d'une réticule (Bouton-1) 104 bool mFgShiftBut; // true -> shift-Button105 104 string mFormatOpt[2]; // Format optimal d'impression des textes 106 105
Note:
See TracChangeset
for help on using the changeset viewer.