diff ../bdecheckout080209/bde/src/graphobject.cc src > graphobject.cc080217.dif --------------------------------------- 638a639,646 > //graphobject.cc:645 Ggroup::findbyindex(hcg_key id) > //loops over subobjects and exits when either > // (current->object->findbyindex(id)) or current == NULL. > // and returns obj = current->object > // with post-cond: (obj == NULL || obj->getid() == id) > // RJL)80217: fixed typo to return obj not findbyindex. > // THis is a client of non-looping class methods in graph.h > // E.g., node::findbyindex returns ((cHN->HNid == id)?this:0); 649,650c657,658 < if ((obj = current->object->findbyindex(id)) < != (graphobject *) NULL) //<-- recursion! --- > if ((obj = current->object->findbyindex(id)) //override not recursion! > != (graphobject *) NULL) 655c663 < DP; printf("findbyindex(id = %lx) returns obj=%p\n", id, obj); --- > DP; printf("findbyindex(id = %lux) returns obj=%p\n", id, obj); 659c667 < DP; dprintd("findbyindex(id=%lx) returns NULL obj ref\n", id); --- > DP; dprintd("findbyindex(id=%lux) returns NULL obj ref\n", id); 795c803,804 < * here, the hcg_ptr is cHN (or cCG or cHL) so client can do cs = cHN; --- > * here, the hcg_ptr is cHN (or cCG or cHL); > * client can do HNcurr = cs->getcurr() which returns cHN ; 799c808,812 < // TBD: Make sure world coords are passd by client - RJL-060628 --- > // TBD: Make sure float world coords are passd by client - RJL-060628 > // (anticipate WC scale is normalized not same as DC scale.) > // TBD: consider tightening bounding box criterion used here > // E.g., call generic bbox test in graphobject superclass from below > // iff geometry were inherited or delegated; option to override? 801c814,815 < {EP; --- > {int halfwidth, halfheight; > EP; 803,806c817,822 < if (tx >= cHN->centerx - (cHN->width/2) < && tx <= cHN->centerx + (cHN->width/2) && < ty >= cHN->centery - (cHN->height/2) < && ty <= cHN->centery + (cHN->height/2)) --- > halfwidth = (int) cHN->width/2; // added - RJL080217 > halfheight= (int) cHN->height/2; > if (tx >= cHN->centerx - halfwidth > && tx <= cHN->centerx + halfwidth && > ty >= cHN->centery - halfheight) > && ty <= cHN->centery + halfheight) 886c902 < // It might maks sense for the HG-table widget selected HG-row??? --- > // It might maks sense for the HG-table widget-selected HG-row??? 1030,1033c1046,1050 < /* A polymorphic method would support doselection(x,y,ttabbr) < * which only looks at elements whose cXX is a DB row of type ttabbr. < * Note that selected.getstate value is partitioned using (TBD) bdeState approach < * into sub-intervals for each table type. --- > /* A class-specific method e.g. node::select could be called in > * subsets of states as doselection(x,y,ttabbr) > * to skip elements whose cXX is not a DB row of type ttabbr. > * Note that selected.getstate value will be partitioned using > * (TBD) bdeState approach into sub-intervals for each table type. 1036,1037c1053,1056 < void Ggroup::doselection (int absx, int absy) //:1012-1115: < {EP;dprintdd("With cursor at x=%d,y=%d)\n", absx, absy); --- > void Ggroup::doselection (int absx, int absy) //:1050-1154: > { > float sx, sy; // world coordinates WC for DC absx,absy > EP;dprintdd("With cursor at x=%d,y=%d)\n", absx, absy); 1078c1097,1098 < --- > // Rev 080217: insert DCtoWC before this loop > // for calls ito class-specific ::select(fx,fy) inside the loop 1079a1100,1103 > // polymorphic objext=node,caption,hlink [or text?] select(): > // which does DCtoWC outside of loop? - RJL080217 > DCtoWC(absx, absy, &sx, &sy); > DP;dprintdd("Calling DCtoWC(<%5.1d,%5.1d>,&sx,&sy)\n", absx, absy); 1081c1105 < ((graphobject *) currents->object)->select(absx,absy) == 0; --- > currents->object)->select(sx,sy) == 0; // no cast-RJL080217 1085c1109,1110 < dprintd("pkey=%lux\n", (hcg_key)(currents->object->getcurr())); --- > dprintd("DBaddr==%px\n", > (hcg_ptr)(currents->object->getcurr())); //RJL080217 1126,1127c1151,1152 < //selectcurrentgraphobject(); // #define as scgo < ((graphobject*)(currents->object))->selectObject(); --- > //selectcurrentgraphobject(); // #define as scgo: > (currents->object)->selectObject(); 1130c1155 < DP; printf("Selected object id %lux at <%d,%d>\n", --- > DP; printf("Selected object id %lux at DC=<%d,%d>\n", 1139c1164 < LP;} // end Ggroup::doselection: 1012-1115 --- > LP;} // end Ggroup::doselection: 1050-1154 1202c1227 < // WC and DC have the same values for scale factor == 1.0 --- > // WC and DC have the 'same' values for scale factor == 1.0 1213a1239,1240 > if (obj->select(mx,my)) //node/caption/link [or text?] method > { 1225a1253 > } //end if select() 1227c1255 < } // end-loop: post-cond ((HNcurr->HNid == cs->getid()) XOR current == NULL) --- > } // end-loop: post-cond ( current == NULL || (HNcurr->HNid == cs->getid()) 1230a1259 > (current->object)->selectObject();//set cs, selected, highlight(1); 1270a1300 > float fx,fy; // WC not DC 1277c1307 < --- > DCtoWC(x,y,&fx,%fy); //convert int to float, possibly scaled, before looping. 1280c1310 < (((graphobject*)current->object)->select(x, y) == 0)); --- > (((graphobject*)current->object)->select(fx, fy) == 0)); 1282,1283c1312,1313 < { //IFF mouse is inside HN, HL or CG, current!=NULL and select(x,y)!= 0 < assert(HNorHLorCGisSelected); // Invariant: #define'd line 454 as: --- > { //IFF mouse is inside HN, HL or CG, current!=NULL and select(sx,sy)!= 0 > //assert(HNorHLorCGisSelected); // Invariant: #define'd line 483 as: 1293c1323 < ((graphobject *)current->object)->selectObject(); --- > ((graphobject *)(current->object)->selectObject()); 1337,1338c1367,1368 < void Ggroup::select_HL(Widget w, int x, int y) //:1485-1520: < // w: drawing canvas, x: x coordinate and y: y coordinate --- > void Ggroup::select_HL(Widget w, int x, int y) //:1356-1390: > // w: drawing canvas, x,y : DC int coordinates 1343a1374 > float sx, sy; 1348c1379 < --- > DCtoWC(x,y,&sx,&sy); // convert mouse DC to world WC coords-added 080217-RJL 1353c1384 < if ((((graphobject *) current->object)->select(x, y) != 0) && --- > if ((((graphobject *) current->object)->select(sx, sy) != 0) && 1356c1387 < (current->object)->selectObject();//crash060628 --- > ((graphobject *)current->object)->selectObject();//crash060628 1359c1390 < assert(cs == currentselection); // from select(x,y) --- > assert(cs == currentselection); // from select(sx,sy) 1371c1402 < } // end void Ggroup::select_HL() (1485-1520) --- > } // end void Ggroup::select_HL() (1356-1390) 1739,1742c1770,1775 < if (tx >= cCG->CGcenterx - (cCG->CGwidth/2) < && tx <= cCG->CGcenterx + (cCG->CGwidth/2) && < ty >= cCG->CGcentery - (cCG->CGheight/2) < && ty <= cCG->CGcentery + (cCG->CGheight/2)) --- > int halfwidth = cCG->width/2; <<< These corrected to CGnames - RJL080217.2342 > int halfheight= cCG->height/2; > if (tx >= cCG->centerx - halfwidth > && tx <= cCG->centerx + halfwidth > && ty >= cCG->centery - halfheight > && ty <= cCG->centery + halfheight)