Changeset 175
- Timestamp:
- Jan 6, 2007, 12:47:40 AM (18 years ago)
- Location:
- trunk/desktop
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/desktop/class_c/wpobject.c ¶
r172 r175 49 49 #include <gtk/gtk.h> 50 50 #include <nomguitk.h> 51 #include "desktoptypes.h"52 51 53 52 /* We have to declare this here to make PNOMFolderWindow known … … 62 61 #endif 63 62 63 #ifndef WPObject 64 typedef struct WPObject_struct { 65 struct nomMethodTabStruct *mtab; 66 gulong body[1]; 67 } WPObjectObj; 68 #define WPObject WPObjectObj 69 typedef WPObject *PWPObject; 70 #endif 71 72 #include "nomwindow.h" 73 #include "desktoptypes.h" 74 64 75 #include "wpobject.ih" 65 76 #include "nomfolderwindow.h" 66 77 #include "wpnotebook.h" 67 78 79 80 68 81 /*************** Local vars ************************************/ 69 82 … … 72 85 /***************************************************************/ 73 86 74 NOM_Scope gpointer NOMLINK impl_WPObject_wpAllocMem(WPObject* nomSelf, const CORBA_unsigned_long cbBytes,75 CORBA_unsigned_long* prc, CORBA_Environment *ev)87 NOM_Scope gpointer NOMLINK impl_WPObject_wpAllocMem(WPObject* nomSelf, const gulong cbBytes, 88 gulong* prc, CORBA_Environment *ev) 76 89 { 77 90 … … 92 105 pui=(PUSEITEM)ptrMem; 93 106 pui->type=(ULONG)USAGE_MEMORY; 107 pui->wpObject=nomSelf; 94 108 pui++; 95 109 ((MEMORYITEM*)pui)->cbBuffer=cbBytes; 96 110 97 #warning !!!!! Memory is not in inuse list !!!!!98 111 /* Add memory to in use list */ 99 //_wpAddToObjUseList(somSelf, (PUSEITEM)pMem);112 WPObject_wpAddToObjUseList(nomSelf, (PUSEITEM)ptrMem, ev); 100 113 101 return ptrMem+sizeof(USEITEM)+sizeof(MEMORYITEM);114 return (gpointer)((PBYTE)ptrMem+sizeof(USEITEM)+sizeof(MEMORYITEM)); 102 115 } 103 116 104 117 NOM_Scope CORBA_boolean NOMLINK impl_WPObject_wpFreeMem(WPObject* nomSelf, const gpointer pByte, CORBA_Environment *ev) 105 118 { 106 /* WPObjectData* nomThis=WPObjectGetData(nomSelf); */ 119 gpointer ptrMem=NULLHANDLE; 107 120 108 121 if(!pByte) 109 122 return FALSE; 110 123 124 ptrMem=(gpointer)((PBYTE)pByte-sizeof(USEITEM)-sizeof(MEMORYITEM)); 125 111 126 /* remove from inuse list */ 112 #warning !!!!! Memory not removed from inuse list !!!!! 113 //_wpDeleteFromObjUseList(somSelf, (PUSEITEM)(pByte-sizeof(USEITEM)-sizeof(MEMORYITEM)) ); 114 115 NOMFree(pByte-sizeof(USEITEM)-sizeof(MEMORYITEM)); 127 WPObject_wpDeleteFromObjUseList(nomSelf, (PUSEITEM)ptrMem, ev ); 128 129 NOMFree(ptrMem); 116 130 return TRUE; /* free can't fail */; 117 131 } … … 177 191 case OPEN_SETTINGS: 178 192 { 193 PUSEITEM pui; 194 gulong ulError; 195 179 196 WPNoteBook* wpNoteBook; 180 197 wpNoteBook=WPNoteBookNew(); 181 198 _wpAddSettingsPages(nomSelf, wpNoteBook, ev); 199 200 /* Add a view item to inuse list */ 201 pui=(PUSEITEM)WPObject_wpAllocMem(nomSelf, sizeof(USEITEM)+sizeof(VIEWITEM), &ulError, ev); 202 /* Fill the structures */ 203 204 pui->type=(gulong)USAGE_OPENVIEW; 205 pui->wpObject=nomSelf; 206 pui++; 207 ((VIEWITEM*)pui)->ulView=VIEW_SETTINGS; 208 ((VIEWITEM*)pui)->nomWindow=(NOMWindow*)wpNoteBook; 209 g_message(" in %s viewItem: %x wpNoteBook 0x%04X", __FUNCTION__, pui, wpNoteBook); 210 pui--; 211 212 WPObject_wpAddToObjUseList(nomSelf, pui, ev); 182 213 WPNoteBook_show(wpNoteBook, ev); 183 214 return (gpointer) wpNoteBook; … … 197 228 198 229 199 if((nomRetval=WPObject_wpSwitchTo(nomSelf, ulView, ev))!=NULLHANDLE) 230 if((nomRetval=WPObject_wpSwitchTo(nomSelf, ulView, ev))!=NULLHANDLE){ 231 /* Bring the window to the foreground */ 232 // NOMWindow_show((NOMWindow*)nomRetval , ev); 200 233 return nomRetval; 201 234 } 235 236 g_message(" in %s with ulViev 0x%04X", __FUNCTION__, ulView); 202 237 return WPObject_wpOpen(nomSelf, nomFolder, ulView, pParam, ev); 203 238 } … … 206 241 { 207 242 /* WPObjectData* nomThis=WPObjectGetData(nomSelf); */ 208 209 g_message("Method wpSwitchTo() not implemented."); 243 PVIEWITEM pViewItem; 244 245 g_message(" in %s with ulViev 0x%04X", __FUNCTION__, ulView); 246 247 switch(ulView) 248 { 249 case OPEN_SETTINGS: 250 { 251 g_message(" in %s : OPEN_SETTINGS", __FUNCTION__); 252 pViewItem=WPObject_wpFindViewItem(nomSelf, VIEW_SETTINGS, NULLHANDLE, ev); 253 if(pViewItem){ 254 g_message(" in %s : OPEN_SETTINGS returning %x %x ...", __FUNCTION__, pViewItem, pViewItem->nomWindow); 255 NOMWindow_show(pViewItem->nomWindow, ev); 256 return (gpointer)pViewItem->nomWindow; 257 } 258 break; 259 } 260 default: 261 break; 262 } 210 263 211 264 return NULLHANDLE; 265 } 266 267 NOM_Scope CORBA_boolean NOMLINK impl_WPObject_wpRegisterView(WPObject* nomSelf, const PNOMWindow pWindow, 268 const PNOMString nomStrViewTitle, CORBA_Environment *ev) 269 { 270 /* WPObjectData* nomThis=WPObjectGetData(nomSelf); */ 271 272 g_message("Method %s not implemented.", __FUNCTION__); 273 return FALSE; 274 } 275 276 NOM_Scope CORBA_boolean NOMLINK impl_WPObject_wpAddToObjUseList(WPObject* nomSelf, const PUSEITEM pUseItem, 277 CORBA_Environment *ev) 278 { 279 WPObjectData* nomThis=WPObjectGetData(nomSelf); 280 281 if(!pUseItem) 282 return FALSE; 283 284 g_message(" in %s : %x", __FUNCTION__, pUseItem); 285 286 WPObject_wpRequestObjectMutexSem(nomSelf, 0,ev); 287 288 _glstObjectInUse=g_slist_append( _glstObjectInUse, (gpointer)pUseItem); 289 290 WPObject_wpReleaseObjectMutexSem(nomSelf,ev); 291 292 return TRUE; 293 } 294 295 NOM_Scope CORBA_boolean NOMLINK impl_WPObject_wpDeleteFromObjUseList(WPObject* nomSelf, const PUSEITEM pUseItem, 296 CORBA_Environment *ev) 297 { 298 WPObjectData* nomThis=WPObjectGetData(nomSelf); 299 300 if(!pUseItem) 301 return FALSE; 302 303 WPObject_wpRequestObjectMutexSem(nomSelf, 0,ev); 304 305 _glstObjectInUse=g_slist_remove( _glstObjectInUse, (gpointer)pUseItem); 306 307 WPObject_wpReleaseObjectMutexSem(nomSelf,ev); 308 309 return TRUE; 310 } 311 312 313 NOM_Scope PUSEITEM NOMLINK impl_WPObject_wpFindUseItem(WPObject* nomSelf, const gulong ulType, 314 const PUSEITEM pCurrentUseItem, CORBA_Environment *ev) 315 { 316 WPObjectData* nomThis=WPObjectGetData(nomSelf); 317 PUSEITEM pUseItem=NULLHANDLE; 318 GSList* tmpList; 319 320 if(NULLHANDLE==_glstObjectInUse) 321 return NULLHANDLE; 322 323 WPObject_wpRequestObjectMutexSem(nomSelf, 0,ev); 324 g_message(" in %s %d", __FUNCTION__, ulType); 325 if(NULLHANDLE==pCurrentUseItem) 326 tmpList=_glstObjectInUse; 327 else{ 328 tmpList=g_slist_find(_glstObjectInUse, pCurrentUseItem); 329 tmpList=g_slist_next(tmpList); 330 } 331 332 while(tmpList) 333 { 334 pUseItem=(PUSEITEM)tmpList->data; 335 336 g_message(" a in %s type: %d", __FUNCTION__, pUseItem->type); 337 338 if(pUseItem && ulType==pUseItem->type) 339 break; 340 g_message(" b in %s type: %d", __FUNCTION__, pUseItem->type); 341 tmpList=g_slist_next(tmpList); 342 pUseItem=NULLHANDLE; 343 }; 344 345 WPObject_wpReleaseObjectMutexSem(nomSelf,ev); 346 347 return pUseItem; 348 } 349 350 351 NOM_Scope PVIEWITEM NOMLINK impl_WPObject_wpFindViewItem(WPObject* nomSelf, const gulong flViews, 352 const PVIEWITEM pCurrentItem, CORBA_Environment *ev) 353 { 354 /* WPObjectData* nomThis=WPObjectGetData(nomSelf); */ 355 PUSEITEM pUseItem; 356 PVIEWITEM pViewItem=NULLHANDLE; 357 358 if(!flViews) 359 return NULLHANDLE; 360 g_message(" in %s %d", __FUNCTION__, flViews); 361 if(NULLHANDLE==pCurrentItem) 362 pUseItem=WPObject_wpFindUseItem(nomSelf, USAGE_OPENVIEW, NULLHANDLE, ev); 363 else{ 364 pUseItem=(PUSEITEM)pCurrentItem; 365 pUseItem--; 366 pUseItem=WPObject_wpFindUseItem(nomSelf, USAGE_OPENVIEW, pUseItem, ev); 367 } 368 while(pUseItem) 369 { 370 ++pUseItem; 371 pViewItem=(PVIEWITEM)pUseItem; 372 pUseItem--; 373 g_message(" a in %s %d", __FUNCTION__, flViews); 374 if(pViewItem->ulView & flViews) 375 break; 376 g_message(" b in %s %d", __FUNCTION__, flViews); 377 pUseItem=WPObject_wpFindUseItem(nomSelf, USAGE_OPENVIEW, pUseItem, ev); 378 pViewItem=NULLHANDLE; 379 } 380 381 return pViewItem; 212 382 } 213 383 … … 248 418 249 419 NOM_Scope CORBA_unsigned_long NOMLINK impl_WPObject_wpRequestObjectMutexSem(WPObject* nomSelf, 250 const CORBA_unsigned_long ulReserved, CORBA_Environment *ev) 420 const CORBA_unsigned_long ulReserved, 421 CORBA_Environment *ev) 251 422 { 252 423 WPObjectData* nomThis=WPObjectGetData(nomSelf); -
TabularUnified trunk/desktop/idl/wpnativetypes.idl ¶
r172 r175 38 38 native PPRIVFOLDERDATA; 39 39 /*native gint;*/ 40 native PGMutex; /* For the object mutex */ 41 native HMUX; /* This one will be removed when a threaded glib is avail */ 42 native PGSList; /* For inuse list */ 40 native PGMutex; /* For the object mutex */ 41 native HMUX; /* This one will be removed when a threaded glib is avail */ 42 native PGSList; /* For inuse list */ 43 native PUSEITEM; /* For inuse list */ 44 native PVIEWITEM; /* For inuse list */ 43 45 44 46 #endif /* WPFOLDERTYPES_IDL_INCLUDED */ -
TabularUnified trunk/desktop/idl/wpobject.idl ¶
r172 r175 43 43 #include "nommenuitem.idl" 44 44 #include "wpnotebook.idl" 45 #include "nomwindow.idl" 45 46 46 47 #ifndef NOMFolderWindow_defined … … 56 57 57 58 /* Memory allocation */ 58 gpointer wpAllocMem(in unsignedlong cbBytes,59 in out unsignedlong prc);59 gpointer wpAllocMem(in gulong cbBytes, 60 in pgulong prc); 60 61 boolean wpFreeMem(in gpointer pByte); 61 62 void wpInitData(); … … 85 86 unsigned long wpInsertSettingsPage(in PWPNoteBook wpNoteBook, in gpointer ppageinfo); 86 87 unsigned long wpAddObjectGeneralPage(in PWPNoteBook wpNoteBook); 88 87 89 gpointer wpViewObject(in PNOMFolderWindow nomFolder, in gulong ulView, in gpointer pParam); 88 90 gpointer wpSwitchTo(in gulong ulView); 91 boolean wpRegisterView(in PNOMWindow pWindow, in PNOMString nomStrViewTitle); 92 93 /* Inuse list methods */ 94 boolean wpAddToObjUseList(in PUSEITEM pUseItem); 95 boolean wpDeleteFromObjUseList(in PUSEITEM pUseItem); 96 PUSEITEM wpFindUseItem( in gulong ulType, in PUSEITEM pCurrentUseItem); 97 PVIEWITEM wpFindViewItem(in gulong flViews,in PVIEWITEM pCurrentItem); 89 98 90 99 /* Methods overriden by this class */ -
TabularUnified trunk/desktop/include/desktoptypes.h ¶
r165 r175 16 16 typedef struct _USEITEM 17 17 { 18 gulong type;/* Item type */19 struct _USEITEM *pNext; /* Next item*/18 gulong type; /* Item type */ 19 PWPObject wpObject; /* Remark: this is different to OS/2 */ 20 20 } USEITEM, *PUSEITEM; 21 21 … … 26 26 } MEMORYITEM, *PMEMORYITEM; 27 27 28 /* USAGE_OPENVIEW */ 29 typedef struct _VIEWITEM { 30 gulong ulView; 31 NOMWindow* nomWindow; 32 gulong ulViewState; /* */ 33 gpointer pReserved; 34 } VIEWITEM, *PVIEWITEM; 35 36 28 37 #define USAGE_MEMORY 1 38 #define USAGE_OPENVIEW 5 29 39 30 40 #define OPEN_DEFAULT 0 31 41 #define OPEN_CONTENTS 1 32 42 #define OPEN_SETTINGS 2 43 44 /* Views for wpFindViewItem() */ 45 #define VIEW_CONTENTS 0x00000001 46 #define VIEW_SETTINGS 0x00000002 47 #define VIEW_HELP 0x00000004 48 #define VIEW_RUNNING 0x00000008 49 #define VIEW_DETAILS 0x00000010 50 #define VIEW_TREE 0x00000020 51 #define VIEW_ANY 0xFFFFFFFF 33 52 34 53 /* Flags for menu methods */
Note:
See TracChangeset
for help on using the changeset viewer.