Changeset 191 for trunk/desktop/class_c/wpobject.c
- Timestamp:
- Jan 14, 2007, 1:54:49 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/desktop/class_c/wpobject.c
r189 r191 149 149 specify the namespace. We query it here because getting a GQuark from a string 150 150 is rather time consuming. The result is saved in a var for later use. */ 151 WPObjectNomId= g_quark_from_string("WPObject");151 WPObjectNomId=nomIdFromString("WPObject"); //g_quark_from_string("WPObject"); 152 152 153 153 /* Make sure a title exists (even if it's an empty string */ … … 186 186 187 187 NOM_Scope gpointer NOMLINK impl_WPObject_wpOpen(WPObject* nomSelf, const PWPFolderWindow nomFolder, 188 const gulong ulView, const gpointer pParam, CORBA_Environment *ev) 189 { 190 /* WPObjectData* nomThis=WPObjectGetData(nomSelf); */ 191 192 switch(ulView) 188 const gulong ulView, const nomId nameSpaceId, 189 const gpointer pParam, CORBA_Environment *ev) 190 { 191 /* WPObjectData* nomThis=WPObjectGetData(nomSelf); */ 192 nomId nSpaceId=nameSpaceId; 193 gulong ulV=ulView; 194 195 /* Special parameter representing a double click or "I just don't know" ;-) */ 196 if(OPEN_DEFAULT==ulView) 197 ulV=WPObject_wpQueryDefaultView(nomSelf, &nSpaceId, NULLHANDLE); 198 199 /* We only handle items with in own name space */ 200 if(WPObjectNomId==nSpaceId) 193 201 { 194 case OPEN_SETTINGS: 195 { 196 PUSEITEM pui; 197 gulong ulError; 198 199 WPNoteBook* wpNoteBook; 200 wpNoteBook=WPNoteBookNew(); 201 WPNoteBook_wpSetWPObject(wpNoteBook, nomSelf, NULLHANDLE); 202 203 _wpAddSettingsPages(nomSelf, wpNoteBook, ev); 204 205 /* Add a view item to inuse list */ 206 pui=(PUSEITEM)WPObject_wpAllocMem(nomSelf, sizeof(USEITEM)+sizeof(VIEWITEM), &ulError, ev); 207 /* Fill the structures */ 208 209 pui->type=(gulong)USAGE_OPENVIEW; 210 pui->wpObject=nomSelf; 211 pui++; 212 ((VIEWITEM*)pui)->ulView=VIEW_SETTINGS; 213 ((VIEWITEM*)pui)->nomWindow=(NOMWindow*)wpNoteBook; 214 pui--; 215 //g_message(" in %s wpNoteBook: %lx pui %lx", __FUNCTION__, wpNoteBook, pui); 216 /* Make sure the view item is removed when the window is closed */ 217 g_signal_connect(G_OBJECT(NOMWindow_queryWindowHandle((NOMWindow*)wpNoteBook, NULLHANDLE)),"delete-event", 218 G_CALLBACK(defaultWPWindowDeleteHandler), (gpointer) pui); 219 WPObject_wpAddToObjUseList(nomSelf, pui, ev); 220 WPNoteBook_show(wpNoteBook, ev); 221 return (gpointer) wpNoteBook; 222 } 223 default: 224 /* We are the very last in the chain of classes being called */ 225 g_return_val_if_reached(NULLHANDLE); 226 break; 202 switch(ulV) 203 { 204 case OPEN_SETTINGS: 205 { 206 PUSEITEM pui; 207 gulong ulError; 208 WPNoteBook* wpNoteBook; 209 210 if(CCVIEW_ON==WPObject_wpQueryConcurrentView(nomSelf, NULLHANDLE)){ 211 /* Concurrent view is ignored for the settings. */ 212 if((wpNoteBook=WPObject_wpSwitchTo(nomSelf, ulV, nSpaceId, NULLHANDLE))!=NULLHANDLE) 213 return wpNoteBook; 214 } 215 wpNoteBook=WPNoteBookNew(); 216 WPNoteBook_wpSetWPObject(wpNoteBook, nomSelf, NULLHANDLE); 217 218 _wpAddSettingsPages(nomSelf, wpNoteBook, ev); 219 220 /* Add a view item to inuse list */ 221 pui=(PUSEITEM)WPObject_wpAllocMem(nomSelf, sizeof(USEITEM)+sizeof(VIEWITEM), &ulError, ev); 222 /* Fill the structures */ 223 224 pui->type=(gulong)USAGE_OPENVIEW; 225 pui->wpObject=nomSelf; 226 pui++; 227 ((VIEWITEM*)pui)->ulView=OPEN_SETTINGS; 228 ((VIEWITEM*)pui)->nomWindow=(NOMWindow*)wpNoteBook; 229 ((VIEWITEM*)pui)->nameSpaceId=WPObjectNomId; 230 pui--; 231 //g_message(" in %s wpNoteBook: %lx pui %lx", __FUNCTION__, wpNoteBook, pui); 232 /* Make sure the view item is removed when the window is closed */ 233 g_signal_connect(G_OBJECT(NOMWindow_queryWindowHandle((NOMWindow*)wpNoteBook, NULLHANDLE)),"delete-event", 234 G_CALLBACK(defaultWPWindowDeleteHandler), (gpointer) pui); 235 WPObject_wpAddToObjUseList(nomSelf, pui, ev); 236 WPNoteBook_show(wpNoteBook, ev); 237 return (gpointer) wpNoteBook; 238 } 239 default: 240 /* We are the very last in the chain of classes being called */ 241 g_return_val_if_reached(NULLHANDLE); 242 break; 243 } 227 244 } 228 245 return NULLHANDLE; … … 230 247 231 248 NOM_Scope gpointer NOMLINK impl_WPObject_wpViewObject(WPObject* nomSelf, const PWPFolderWindow nomFolder, 232 const gulong ulView, const gpointer pParam,233 CORBA_Environment *ev)249 const gulong ulView, const nomId nameSpaceId, 250 const gpointer pParam, CORBA_Environment *ev) 234 251 { 235 252 /* WPObjectData* nomThis=WPObjectGetData(nomSelf); */ 236 253 gpointer nomRetval=NULLHANDLE; 237 238 239 if((nomRetval=WPObject_wpSwitchTo(nomSelf, ulView, ev))!=NULLHANDLE) 254 nomId nSpaceId=nameSpaceId; 255 gulong ulV=ulView; 256 257 /* Special parameter representing a double click or "I just don't know" ;-) */ 258 if(OPEN_DEFAULT==ulView) 259 ulV=WPObject_wpQueryDefaultView(nomSelf, &nSpaceId, NULLHANDLE); 260 261 if(CCVIEW_ON==WPObject_wpQueryConcurrentView(nomSelf, NULLHANDLE)) 262 return WPObject_wpOpen(nomSelf, nomFolder, ulV, nSpaceId, pParam, NULLHANDLE); 263 264 if((nomRetval=WPObject_wpSwitchTo(nomSelf, ulV, nSpaceId, NULLHANDLE))!=NULLHANDLE) 240 265 return nomRetval; 241 266 242 return WPObject_wpOpen(nomSelf, nomFolder, ulView, pParam, ev); 243 } 244 245 NOM_Scope gpointer NOMLINK impl_WPObject_wpSwitchTo(WPObject* nomSelf, const gulong ulView, CORBA_Environment *ev) 246 { 247 /* WPObjectData* nomThis=WPObjectGetData(nomSelf); */ 267 return WPObject_wpOpen(nomSelf, nomFolder, ulV, nSpaceId, pParam, NULLHANDLE); 268 } 269 270 NOM_Scope gpointer NOMLINK impl_WPObject_wpSwitchTo(WPObject* nomSelf, const gulong ulView, const nomId nameSpaceId, 271 CORBA_Environment *ev) 272 { 273 /* WPObjectData* nomThis=WPObjectGetData(nomSelf); */ 248 274 PVIEWITEM pViewItem; 249 275 250 switch(ulView) 251 { 252 case OPEN_SETTINGS: 253 { 254 pViewItem=WPObject_wpFindViewItem(nomSelf, VIEW_SETTINGS, NULLHANDLE, ev); 255 if(pViewItem){ 256 //g_message(" in %s : OPEN_SETTINGS returning %x %x ...", __FUNCTION__, pViewItem, pViewItem->nomWindow); 257 /* Bring the window to the foreground */ 258 NOMWindow_present(pViewItem->nomWindow, ev); 259 return (gpointer)pViewItem->nomWindow; 260 } 261 break; 262 } 263 case OPEN_CONTENTS: 264 { 265 #warning !!!!! This belongs into WPFolder !!!!! 266 pViewItem=WPObject_wpFindViewItem(nomSelf, VIEW_CONTENTS, NULLHANDLE, ev); 267 if(pViewItem){ 268 //g_message(" in %s : OPEN_SETTINGS returning %x %x ...", __FUNCTION__, pViewItem, pViewItem->nomWindow); 269 /* Bring the window to the foreground */ 270 NOMWindow_present(pViewItem->nomWindow, ev); 271 return (gpointer)pViewItem->nomWindow; 272 } 273 break; 274 } 275 default: 276 break; 277 } 276 pViewItem=WPObject_wpFindViewItem(nomSelf, ulView, nameSpaceId, NULLHANDLE, NULLHANDLE); 277 278 if(pViewItem){ 279 /* Bring the window to the foreground */ 280 NOMWindow_present(pViewItem->nomWindow, ev); 281 return (gpointer)pViewItem->nomWindow; 282 }/* if() */ 278 283 279 284 return NULLHANDLE; … … 363 368 364 369 365 NOM_Scope PVIEWITEM NOMLINK impl_WPObject_wpFindViewItem(WPObject* nomSelf, const gulong flViews, 370 NOM_Scope PVIEWITEM NOMLINK impl_WPObject_wpFindViewItem(WPObject* nomSelf, const gulong ulView, 371 const nomId nameSpaceId, 366 372 const PVIEWITEM pCurrentItem, CORBA_Environment *ev) 367 373 { … … 370 376 PVIEWITEM pViewItem=NULLHANDLE; 371 377 372 if(!flViews) 378 379 if(!ulView) 373 380 return NULLHANDLE; 374 381 … … 380 387 pUseItem=WPObject_wpFindUseItem(nomSelf, USAGE_OPENVIEW, pUseItem, ev); 381 388 } 389 382 390 while(pUseItem) 383 391 { … … 386 394 pUseItem--; 387 395 //g_message(" a in %s %d", __FUNCTION__, flViews); 388 if( pViewItem->ulView & flViews)396 if((pViewItem->ulView == ulView) && (pViewItem->nameSpaceId==nameSpaceId)) 389 397 break; 390 398 … … 396 404 } 397 405 406 NOM_Scope gulong NOMLINK impl_WPObject_wpQueryDefaultView(WPObject* nomSelf, const pnomId pNameSpaceId, 407 CORBA_Environment *ev) 408 { 409 /* WPObjectData* nomThis=WPObjectGetData(nomSelf); */ 410 411 *pNameSpaceId=WPObjectNomId; 412 413 return OPEN_SETTINGS; 414 } 415 416 NOM_Scope CORBA_boolean NOMLINK impl_WPObject_wpSetDefaultView(WPObject* nomSelf, const gulong ulView, 417 const nomId nameSpaceId, CORBA_Environment *ev) 418 { 419 /* WPObjectData* nomThis=WPObjectGetData(nomSelf); */ 420 CORBA_boolean nomRetval=FALSE; 421 422 g_message("%d %s not implemented", __LINE__, __FUNCTION__); 423 return nomRetval; 424 } 425 426 NOM_Scope void NOMLINK impl_WPObject_wpSetConcurrentView(WPObject* nomSelf, const gulong ulCCView, 427 CORBA_Environment *ev) 428 { 429 /* WPObjectData* nomThis=WPObjectGetData(nomSelf); */ 430 431 g_message("%d %s not implemented", __LINE__, __FUNCTION__); 432 433 } 434 435 NOM_Scope gulong NOMLINK impl_WPObject_wpQueryConcurrentView(WPObject* nomSelf, CORBA_Environment *ev) 436 { 437 /* WPObjectData* nomThis=WPObjectGetData(nomSelf); */ 438 439 return CCVIEW_ON; 440 } 398 441 399 442 NOM_Scope void NOMLINK impl_WPObject_wpLockObject(WPObject* nomSelf, CORBA_Environment *ev) … … 623 666 /* WPObjectData* nomThis=WPObjectGetData(nomSelf); */ 624 667 625 /* We only handle items with 668 /* We only handle items within own name space */ 626 669 if(WPObjectNomId==NOMMenuItem_queryNameSpaceId(nomMenuItem, ev)) 627 670 { … … 631 674 { 632 675 WPObject_wpViewObject(nomSelf, nomFolder, 633 OPEN_SETTINGS, NULLHANDLE, ev);676 OPEN_SETTINGS, WPObjectNomId, NULLHANDLE, NULLHANDLE); 634 677 return TRUE; /* We always return TRUE to show, we handled the menu item. It doesn't 635 678 matter if we actually succeeded with creating the settings notebook. */ … … 714 757 } 715 758 759 760 761
Note:
See TracChangeset
for help on using the changeset viewer.