#include <viewmenu.h>
Inheritance diagram for ViewContextMenu:
Public Member Functions | |
BOOL | BuildOverView (Spread *pSpread, DocCoord ClickPos, ClickModifiers ClickMods) |
To build the View pop-up menu. This function is complicated by the fact that it offers the current tool a chance to build menu items for any section of the view pop-up menu. | |
Private Member Functions | |
CC_DECLARE_MEMDUMP (ViewContextMenu) | |
BOOL | AskBlobsForItems (Spread *pSpread, DocCoord ClickPos, ClickModifiers ClickMods) |
Ask the selected nodes whether they want the menu to appear and if so to add some menu items. | |
NodeRenderableInk * | FindNodeAtPoint (Spread *pSpread, DocCoord ClickPos) |
This copes with finding which node is under a click. It uses SelectorTool::FindPreProcessClickNode() to see if there is a node that would not get detected by a straight call to NodeRenderableInk::FindSimpleAtPoint(). |
Definition at line 119 of file viewmenu.h.
|
Ask the selected nodes whether they want the menu to appear and if so to add some menu items.
Definition at line 352 of file viewmenu.cpp. 00356 { 00357 // Test for a click on a fill attribute first, as they aren't NodeRenderableInks, and so 00358 // won't be included in the tests below. 00359 // if (AttrFillGeometry::CheckAttrClick(ClickStart, TypeOfClick, ClickMods, StartSpread)) 00360 // { 00361 // return TRUE; 00362 // } 00363 00364 // Look for a selected object to pass the click to. 00365 SelRange* pSel = GetApplication()->FindSelection(); 00366 if (pSel==NULL) 00367 return FALSE; 00368 00369 Node* pNode = pSel->FindFirst(); 00370 if (pNode == NULL) 00371 return FALSE; 00372 00373 // Providing we are displaying object blobs, try passing the click on to each object 00374 // in the selection. 00375 BlobManager* pBlobs = GetApplication()->GetBlobManager(); 00376 if (pBlobs && pBlobs->GetCurrentInterest().Object) 00377 { 00378 // For all selected objects . . . 00379 while (pNode != NULL) 00380 { 00381 // Is this node ink-renderable? 00382 if (pNode->IsKindOf(CC_RUNTIME_CLASS(NodeRenderableInk))) 00383 { 00384 // Yes. Does it want the click? 00385 if (((NodeRenderableInk*) pNode)->OnBlobPopUp(pSpread, ClickPos, this)) 00386 { 00387 // An object processed the click, so indicate that there's no more to do. 00388 return TRUE; 00389 } 00390 } 00391 00392 // Try the next object in the selection. 00393 pNode = pSel->FindNext(pNode); 00394 } 00395 } 00396 00397 return FALSE; 00398 }
|
|
To build the View pop-up menu. This function is complicated by the fact that it offers the current tool a chance to build menu items for any section of the view pop-up menu.
Reimplemented from ContextMenu. Definition at line 159 of file viewmenu.cpp. 00160 { 00161 ERROR2IF(pSpread==NULL,FALSE,"BuildOverView passed NULL spread pointer"); 00162 00163 BOOL ok = TRUE; 00164 00165 //---------------------------------------------// 00166 // First ask selected nodes if they want to supply items and if so show the blob menu... 00167 if (AskBlobsForItems(pSpread, ClickPos, ClickMods)) 00168 { 00169 // If they supply items then we won't add the normal items about the selection 00170 return TRUE; 00171 } 00172 00173 //---------------------------------------------// 00174 // Find what the click was on and show the object menu... 00175 // NodeRenderableInk* pHitNode = NodeRenderableInk::FindSimpleAtPoint(pSpread, ClickPos); 00176 00177 NodeRenderableInk* pHitNode = FindNodeAtPoint(pSpread,ClickPos); 00178 if (pHitNode) 00179 { 00180 BOOL HitNodeIsGuideline = IS_A(pHitNode,NodeGuideline); 00181 00182 if (!HitNodeIsGuideline) // BODGE so that guidelines (which can't be selected) can have a pop-up menu 00183 { 00184 // Now find out if there's just one node selected and if so ask it for some items... 00185 SelRange* pSel = GetApplication()->FindSelection(); 00186 if (pSel!=NULL) 00187 { 00188 Node* pNode = pSel->FindFirst(); 00189 if (pNode && pSel->FindNext(pNode) == NULL) 00190 { 00191 // There's only one object selected so let's ask it about itself... 00192 ((NodeRenderableInk*) pNode)->OnNodePopUp(pSpread, ClickPos, this); 00193 } 00194 } 00195 } 00196 else 00197 pHitNode->OnNodePopUp(pSpread, ClickPos, this); 00198 00199 if (!HitNodeIsGuideline) // BODGE to stop guideline pop-up menus having irrelevant menu items 00200 { 00201 // Build the rest of the standard object menu... 00202 // Effect commands 00203 ok = ok && BuildEffectCommands(); 00204 // Edit commands 00205 ok = ok && BuildTransferCommands(TRUE); 00206 // Arrange commands 00207 // WEBSTER-ranbirr-13/11/96 00208 // #ifndef WEBSTER 00209 ok = ok && BuildCommand(OPTOKEN_MAKE_SHAPES); 00210 // #endif //webster 00211 ok = ok && BuildCommand(OPTOKEN_CONVERTTOBITMAP); 00212 // WEBSTER-ranbirr-13/11/96 00213 // Now Taken out by vector stroking code Neville 2/10/97 00214 #ifdef VECTOR_STROKING 00215 // ok = ok && BuildCommand(OPTOKEN_MAKE_STROKE); 00216 #endif // VECTOR_STROKING 00217 ok = ok && BuildCommand(OPTOKEN_COMBINESHAPES,TRUE); 00218 MenuItem* pCombineRoot = GetLastItem(); 00219 // WEBSTER-ranbirr-13/11/96 00220 // #ifndef WEBSTER 00221 ok = ok && BuildCommand(OPTOKEN_ADDSHAPES, FALSE, pCombineRoot); 00222 ok = ok && BuildCommand(OPTOKEN_SUBTRACTSHAPES, FALSE, pCombineRoot); 00223 ok = ok && BuildCommand(OPTOKEN_INTERSECTSHAPES, FALSE, pCombineRoot); 00224 ok = ok && BuildCommand(OPTOKEN_SLICESHAPES, FALSE, pCombineRoot); 00225 // #endif //webster 00226 00227 #ifndef WEBSTER 00228 // Imagesetting submenu 00229 ok = ok && BuildCommand(OPTOKEN_IMAGESETTING, TRUE); 00230 pCombineRoot = GetLastItem(); 00231 ok = ok && BuildCommand(OPTOKEN_OVERPRINTFILL, FALSE, pCombineRoot); 00232 ok = ok && BuildCommand(OPTOKEN_OVERPRINTLINE, TRUE, pCombineRoot); 00233 ok = ok && BuildCommand(OPTOKEN_PRINTONALLPLATES, FALSE, pCombineRoot); 00234 #endif //webster 00235 // Utils commands 00236 ok = ok && BuildCommand(OPTOKEN_WEBADDRESSDLG); 00237 ok = ok && BuildCommand(OPTOKEN_COLOUREDITDLG, TRUE); 00238 PORTNOTE("other", "Removed brush edit dialog from popup menu") 00239 #ifndef EXCLUDE_FROM_XARALX 00240 ok = ok && BuildCommand(OPTOKEN_BRUSHEDIT_DLG); 00241 #endif 00242 ok = ok && BuildCommand(OPTOKEN_SELECTBRUSH); 00243 } 00244 00245 return ok; 00246 } 00247 00248 //---------------------------------------------// 00249 // If on white space then show the white space menu... 00250 // Window commands 00251 // MENUITEM OPTOKEN_TOOLBARDLG 00252 // MENUITEM OPTOKEN_VIEWCOLOURBAR 00253 // MENUITEM OPTOKEN_VIEWSTATUSBAR 00254 // MENUITEM OPTOKEN_VIEWSCROLLBARS 00255 // WEBSTER-ranbirr-13/11/96 00256 #ifndef WEBSTER 00257 ok = ok && BuildCommand(OPTOKEN_WINDOWNEWVIEW); 00258 ok = ok && BuildCommand(OPTOKEN_VIEWFULLSCREEN,TRUE); 00259 #else 00260 ok = ok && BuildCommand(OPTOKEN_WINDOWNEWVIEW,TRUE); 00261 #endif //webster 00262 00263 // Paste option - we don't need to do the 00264 // BuildTransferCommands as the Cut and Copy operations 00265 // are never applicable here... matt-23/08/2000 00266 ok = ok && BuildCommand(OPTOKEN_PASTE, TRUE); 00267 00268 // View quality 00269 ok = ok && BuildCommand(OPTOKEN_WINDOWQUALITY,FALSE); 00270 MenuItem* pQualityRoot = GetLastItem(); 00271 ok = ok && BuildCommand(OPTOKEN_QUALITYANTIALIASED, FALSE, pQualityRoot); 00272 ok = ok && BuildCommand(OPTOKEN_QUALITYNORMAL, FALSE, pQualityRoot); 00273 ok = ok && BuildCommand(OPTOKEN_QUALITYSIMPLE, FALSE, pQualityRoot); 00274 ok = ok && BuildCommand(OPTOKEN_QUALITYOUTLINE, FALSE, pQualityRoot); 00275 // View commands 00276 // WEBSTER-ranbirr-13/11/96 00277 #ifndef WEBSTER 00278 ok = ok && BuildCommand(OPTOKEN_SHOWGRID); 00279 ok = ok && BuildCommand(OPTOKEN_SHOWGUIDES,TRUE); 00280 #else 00281 ok = ok && BuildCommand(OPTOKEN_SHOWGRID,TRUE); 00282 #endif //webster 00283 // WEBSTER-ranbirr-13/11/96 00284 #ifndef WEBSTER 00285 ok = ok && BuildCommand(OPTOKEN_SNAPTOGRID); 00286 ok = ok && BuildCommand(OPTOKEN_SNAPTOGUIDES); 00287 ok = ok && BuildCommand(OPTOKEN_SNAPTOOBJECTS,TRUE); 00288 #else 00289 ok = ok && BuildCommand(OPTOKEN_SNAPTOGRID,TRUE); 00290 #endif //webster 00291 ok = ok && BuildCommand(OPTOKEN_DELETEPAGEBACKGROUND); 00292 // Page commands (almost "Properties...") 00293 ok = ok && BuildCommand(OPTOKEN_PAGESIZEDLG); 00294 00295 return ok; 00296 }
|
|
|
|
This copes with finding which node is under a click. It uses SelectorTool::FindPreProcessClickNode() to see if there is a node that would not get detected by a straight call to NodeRenderableInk::FindSimpleAtPoint().
Definition at line 321 of file viewmenu.cpp. 00322 { 00323 #ifndef STANDALONE 00324 // selector tool not present in stand alone version 00325 NodeRenderableInk* pNode = SelectorTool::FindPreProcessClickNode(pSpread,ClickPos); 00326 #else 00327 NodeRenderableInk* pNode = NULL; 00328 #endif 00329 00330 if (pNode == NULL) 00331 pNode = NodeRenderableInk::FindSimpleAtPoint(pSpread,ClickPos); 00332 00333 return pNode; 00334 }
|