| 1 | /* | 
|---|
| 2 | * This file is (C) Chris Wohlgemuth 2001 | 
|---|
| 3 | */ | 
|---|
| 4 | /* | 
|---|
| 5 | * This program is free software; you can redistribute it and/or modify | 
|---|
| 6 | * it under the terms of the GNU General Public License as published by | 
|---|
| 7 | * the Free Software Foundation; either version 2, or (at your option) | 
|---|
| 8 | * any later version. | 
|---|
| 9 | * | 
|---|
| 10 | * This program is distributed in the hope that it will be useful, | 
|---|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 13 | * GNU General Public License for more details. | 
|---|
| 14 | * | 
|---|
| 15 | * You should have received a copy of the GNU General Public License | 
|---|
| 16 | * along with this program; see the file COPYING.  If not, write to | 
|---|
| 17 | * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | 
|---|
| 18 | */ | 
|---|
| 19 |  | 
|---|
| 20 | #define INCL_WIN | 
|---|
| 21 | #define INCL_GPILCIDS | 
|---|
| 22 | #define INCL_GPIPRIMITIVES | 
|---|
| 23 | #define INCL_GPIBITMAPS | 
|---|
| 24 |  | 
|---|
| 25 |  | 
|---|
| 26 | #include "mediafolder.hh" | 
|---|
| 27 | #include "launchpad.hh" | 
|---|
| 28 |  | 
|---|
| 29 | #include <os2.h> | 
|---|
| 30 | #include "stdio.h" | 
|---|
| 31 | #include "stdlib.h" | 
|---|
| 32 |  | 
|---|
| 33 | #include "sys_funcs.h" | 
|---|
| 34 |  | 
|---|
| 35 | extern HWND hwndShadow;// The handle of the help window | 
|---|
| 36 | extern PFNWP  oldProc;  //place for original button-procedure | 
|---|
| 37 | extern HWND hwndBubbleWindow;// The handle of the help window | 
|---|
| 38 | #define  WM_NEWBUBBLE   WM_USER+100 //Use ATOM later | 
|---|
| 39 | #define xVal  12      //x-distance of Bubble | 
|---|
| 40 | #define yVal  8      //y-distance of Bubble | 
|---|
| 41 | extern char chrTBFlyFontName[CCHMAXPATH];/* Font for toolbar fly over help */ | 
|---|
| 42 | extern RGB rgbTBFlyForeground; | 
|---|
| 43 | extern RGB rgbTBFlyBackground; | 
|---|
| 44 | extern BOOL bTBFlyOverEnabled; | 
|---|
| 45 | extern int iTBFlyOverDelay; | 
|---|
| 46 |  | 
|---|
| 47 |  | 
|---|
| 48 | #define xButtonDelta 2 | 
|---|
| 49 | #define xButtonOffset 6 | 
|---|
| 50 |  | 
|---|
| 51 | PFNWP pfnwpOldLPProc; | 
|---|
| 52 | LPList* lplAllLPads=NULL; | 
|---|
| 53 |  | 
|---|
| 54 | extern PFNWP  oldButtonProc2;  //place for original button-procedure | 
|---|
| 55 |  | 
|---|
| 56 | MRESULT EXPENTRY newButtonProc(HWND hwnd, ULONG msg,MPARAM mp1,MPARAM mp2 ); | 
|---|
| 57 | MRESULT EXPENTRY shadowProc(HWND hwnd, ULONG msg,MPARAM mp1,MPARAM mp2 ); | 
|---|
| 58 |  | 
|---|
| 59 | /******************************************************************************/ | 
|---|
| 60 | /*  New button procedure which handles the context menu stuff for the objects */ | 
|---|
| 61 | /* The fly over help is managed by the standard button replacement proc.      */ | 
|---|
| 62 | /******************************************************************************/ | 
|---|
| 63 | static MRESULT EXPENTRY newLaunchPadButtonProc(HWND hwnd, ULONG msg,MPARAM mp1,MPARAM mp2 ) | 
|---|
| 64 | { | 
|---|
| 65 | POINTL ptl; | 
|---|
| 66 | HWND hwndMenu; | 
|---|
| 67 | WPObject * wpObject; | 
|---|
| 68 | LPObject* lpo; | 
|---|
| 69 | PDRAGINFO pDragInfo; | 
|---|
| 70 | static BOOL bDrawn=FALSE; | 
|---|
| 71 | static DRAGITEM DragItem; | 
|---|
| 72 | static DRAGIMAGE DragImage; | 
|---|
| 73 | static DRAGINFO *DragInfo; | 
|---|
| 74 |  | 
|---|
| 75 | switch (msg) | 
|---|
| 76 | { | 
|---|
| 77 | #if 0 | 
|---|
| 78 | case WM_BEGINDRAG: | 
|---|
| 79 | if(SHORT1FROMMP(mp2)||1) { | 
|---|
| 80 | //  DosBeep(5000,130); | 
|---|
| 81 | lpo=(LPObject*)WinQueryWindowULong(hwnd,QWL_USER); | 
|---|
| 82 | if(lpo) { | 
|---|
| 83 | wpObject=lpo->wpObject; | 
|---|
| 84 | if(somIsObj(wpObject)) { | 
|---|
| 85 | #if 0 | 
|---|
| 86 | DragItem.hwndItem=hwnd; | 
|---|
| 87 | DragItem.ulItemID=(ULONG)wpObject; | 
|---|
| 88 | DragItem.hstrType=DrgAddStrHandle("DRT_UNKNOWN"); | 
|---|
| 89 | DragItem.hstrRMF=DrgAddStrHandle("DRM_OBJECT"); | 
|---|
| 90 | DragItem.hstrContainerName=DrgAddStrHandle("E:\\CD-Brenner\\ADC_050\\!AUDIOCD_TOOLBAR!"); | 
|---|
| 91 | DragItem.hstrSourceName=DrgAddStrHandle("E:\\CD-Brenner\\ADC_050\\"); | 
|---|
| 92 | #endif | 
|---|
| 93 | wpObject->wpFormatDragItem(&DragItem); | 
|---|
| 94 | //            DragItem.fsSupportedOps=DO_LINKABLE; | 
|---|
| 95 | DragInfo=DrgAllocDraginfo(1); | 
|---|
| 96 |  | 
|---|
| 97 | DrgSetDragitem(DragInfo, &DragItem,(ULONG)sizeof(DragItem),0); | 
|---|
| 98 | memset(&DragImage, 0, sizeof(DragImage)); | 
|---|
| 99 | DragImage.cb=sizeof(DragImage); | 
|---|
| 100 | DragImage.fl=DRG_ICON; | 
|---|
| 101 | DragImage.hImage=wpObject->wpQueryIcon(); | 
|---|
| 102 |  | 
|---|
| 103 |  | 
|---|
| 104 | if(DrgDrag(hwnd, DragInfo, &DragImage, 1, VK_ENDDRAG, NULL)) { | 
|---|
| 105 | lpo->lpParent->lpRefreshLaunchPad(); | 
|---|
| 106 | } | 
|---|
| 107 |  | 
|---|
| 108 | /* Free DragInfo here!!!!!!!!!!! */ | 
|---|
| 109 | //DrgDeleteDraginfoStrHandles(pDragInfo); | 
|---|
| 110 | // ????? DrgFreeDraginfo(DragInfo); | 
|---|
| 111 | return (MRESULT)TRUE; | 
|---|
| 112 | }/* somIsObj() */ | 
|---|
| 113 | }/* lpo */ | 
|---|
| 114 | } | 
|---|
| 115 | break; | 
|---|
| 116 |  | 
|---|
| 117 | case DM_ENDCONVERSATION: | 
|---|
| 118 | case DM_DRAGFILECOMPLETE: | 
|---|
| 119 | case DM_DROPNOTIFY: | 
|---|
| 120 | case DM_FILERENDERED: | 
|---|
| 121 | case DM_RENDERCOMPLETE: | 
|---|
| 122 | DosBeep(500,500); | 
|---|
| 123 | break; | 
|---|
| 124 | return (MRESULT)FALSE; | 
|---|
| 125 | case WM_ENDDRAG: | 
|---|
| 126 | DosBeep(500,500); | 
|---|
| 127 | return (MRESULT)TRUE; | 
|---|
| 128 | break; | 
|---|
| 129 | #endif | 
|---|
| 130 | case WM_PAINT: | 
|---|
| 131 | lpo=(LPObject*)WinQueryWindowULong(hwnd,QWL_USER); | 
|---|
| 132 | if(lpo) { | 
|---|
| 133 | BTNCDATA btCtrl={0}; | 
|---|
| 134 | WNDPARAMS wndParams={0}; | 
|---|
| 135 |  | 
|---|
| 136 | // memset(&btCtrl,0,sizeof(btCtrl)); | 
|---|
| 137 | btCtrl.cb=sizeof(btCtrl); | 
|---|
| 138 | if(somIsObj(lpo->wpObject)) { | 
|---|
| 139 | btCtrl.hImage=lpo->wpObject->wpQueryIcon(); | 
|---|
| 140 | // memset(&wndParams,0,sizeof(wndParams)); | 
|---|
| 141 | wndParams.fsStatus=WPM_CTLDATA; | 
|---|
| 142 | wndParams.cbCtlData=btCtrl.cb; | 
|---|
| 143 | wndParams.pCtlData=&btCtrl; | 
|---|
| 144 | WinSendMsg(hwnd,WM_SETWINDOWPARAMS, | 
|---|
| 145 | MPFROMP(&wndParams),0); | 
|---|
| 146 | } | 
|---|
| 147 | } | 
|---|
| 148 | break; | 
|---|
| 149 | case WM_CONTEXTMENU: | 
|---|
| 150 | if(!SHORT2FROMMP(mp2)) { | 
|---|
| 151 |  | 
|---|
| 152 | lpo=(LPObject*)WinQueryWindowULong(hwnd,QWL_USER); | 
|---|
| 153 | if(lpo) { | 
|---|
| 154 | wpObject=lpo->wpObject; | 
|---|
| 155 | if(somIsObj(wpObject)) { | 
|---|
| 156 | ptl.y=0; | 
|---|
| 157 | ptl.x=0; | 
|---|
| 158 | hwndMenu=wpObject->wpDisplayMenu(hwnd,hwnd,&ptl,MENU_OBJECTPOPUP,0); | 
|---|
| 159 | } | 
|---|
| 160 | return (MRESULT) TRUE; | 
|---|
| 161 | } | 
|---|
| 162 |  | 
|---|
| 163 | }/* end of if(!SHORT2FROMMP(mp2)) */ | 
|---|
| 164 | break; | 
|---|
| 165 | case DM_DRAGOVER: | 
|---|
| 166 | { | 
|---|
| 167 | BOOL bReturn=FALSE; | 
|---|
| 168 |  | 
|---|
| 169 | TRY_LOUD(LP_DRAGOVER) { | 
|---|
| 170 | lpo=(LPObject*)WinQueryWindowULong(hwnd,QWL_USER); | 
|---|
| 171 | if(lpo) { | 
|---|
| 172 | wpObject=lpo->wpObject; | 
|---|
| 173 | if(somIsObj(wpObject)) { | 
|---|
| 174 | char chrClassName[10]; | 
|---|
| 175 | LONG lLength; | 
|---|
| 176 |  | 
|---|
| 177 | pDragInfo=(PDRAGINFO) mp1; | 
|---|
| 178 | hwndMenu=pDragInfo->hwndSource; | 
|---|
| 179 | lLength=sizeof(chrClassName); | 
|---|
| 180 | WinQueryClassName(hwndMenu, lLength, chrClassName); | 
|---|
| 181 | if(strcmp(chrClassName,"#37")) | 
|---|
| 182 | hwndMenu=NULL;/* Source isn't a container */ | 
|---|
| 183 | if(!bDrawn) { | 
|---|
| 184 | HPS hps; | 
|---|
| 185 | RECTL rectl; | 
|---|
| 186 | SWP swp; | 
|---|
| 187 |  | 
|---|
| 188 | /* Draw the rect */ | 
|---|
| 189 | hps=DrgGetPS(hwnd); | 
|---|
| 190 | WinQueryWindowPos(hwnd,&swp); | 
|---|
| 191 | rectl.xLeft=1; | 
|---|
| 192 | rectl.yBottom=1; | 
|---|
| 193 | rectl.xRight=swp.cx-1; | 
|---|
| 194 | rectl.yTop=swp.cy-1; | 
|---|
| 195 | //WinDrawBorder(hps,&rectl, 3, 3, 0, 0, DB_STANDARD|DB_PATINVERT); | 
|---|
| 196 | DrgReleasePS(hps); | 
|---|
| 197 | //bDrawn=TRUE; | 
|---|
| 198 | } | 
|---|
| 199 | bReturn=TRUE; | 
|---|
| 200 | } | 
|---|
| 201 | } | 
|---|
| 202 | } | 
|---|
| 203 | CATCH(LP_DRAGOVER) | 
|---|
| 204 | { | 
|---|
| 205 | } END_CATCH; | 
|---|
| 206 | if(bReturn) | 
|---|
| 207 | return wpObject->wpDragOver(hwndMenu,(PDRAGINFO) mp1); | 
|---|
| 208 | break; | 
|---|
| 209 | } | 
|---|
| 210 | case DM_DRAGLEAVE: | 
|---|
| 211 | { | 
|---|
| 212 | RECTL rectl; | 
|---|
| 213 | SWP swp; | 
|---|
| 214 | HPS hps; | 
|---|
| 215 |  | 
|---|
| 216 | /* Remove target emphasis here */ | 
|---|
| 217 | hps=DrgGetPS(hwnd); | 
|---|
| 218 | WinQueryWindowPos(hwnd,&swp); | 
|---|
| 219 | rectl.xLeft=1; | 
|---|
| 220 | rectl.yBottom=1; | 
|---|
| 221 | rectl.xRight=swp.cx-1; | 
|---|
| 222 | rectl.yTop=swp.cy-1; | 
|---|
| 223 | // WinDrawBorder(hps,&rectl,3, 3, 0, 0, DB_STANDARD|DB_PATINVERT); | 
|---|
| 224 | bDrawn=FALSE; | 
|---|
| 225 | DrgReleasePS(hps); | 
|---|
| 226 | return (MRESULT) FALSE; | 
|---|
| 227 | } | 
|---|
| 228 | case DM_DROP: | 
|---|
| 229 | { | 
|---|
| 230 | BOOL bReturn=FALSE; | 
|---|
| 231 | char chrClassName[10]; | 
|---|
| 232 | LONG lLength; | 
|---|
| 233 | PDRAGITEM pDragItem; | 
|---|
| 234 |  | 
|---|
| 235 | TRY_LOUD(LP_DROP) { | 
|---|
| 236 | /* A drop on a toolbar button */ | 
|---|
| 237 | lpo=(LPObject*)WinQueryWindowULong(hwnd,QWL_USER); | 
|---|
| 238 | if(lpo) { | 
|---|
| 239 | wpObject=lpo->wpObject; | 
|---|
| 240 | if(somIsObj(wpObject)) { | 
|---|
| 241 | pDragInfo=(PDRAGINFO) mp1; | 
|---|
| 242 | pDragItem=DrgQueryDragitemPtr(pDragInfo, 0); | 
|---|
| 243 | hwndMenu=pDragInfo->hwndSource; | 
|---|
| 244 | lLength=sizeof(chrClassName); | 
|---|
| 245 | WinQueryClassName(hwndMenu, lLength, chrClassName); | 
|---|
| 246 | if(strcmp(chrClassName,"#37")) | 
|---|
| 247 | hwndMenu=NULL;/* Source isn't a container */ | 
|---|
| 248 | bReturn=TRUE; | 
|---|
| 249 | } | 
|---|
| 250 | } | 
|---|
| 251 | } | 
|---|
| 252 | CATCH(LP_DROP) | 
|---|
| 253 | { | 
|---|
| 254 | } END_CATCH; | 
|---|
| 255 | if(bReturn) | 
|---|
| 256 | return wpObject->wpDrop(hwndMenu,(PDRAGINFO) mp1, pDragItem); | 
|---|
| 257 | break; | 
|---|
| 258 | } | 
|---|
| 259 | case WM_COMMAND: | 
|---|
| 260 | TRY_LOUD(LP_COMMAND) { | 
|---|
| 261 | lpo=(LPObject*)WinQueryWindowULong(hwnd,QWL_USER); | 
|---|
| 262 | if(lpo) { | 
|---|
| 263 | wpObject=lpo->wpObject; | 
|---|
| 264 | if(somIsObj(wpObject)) { | 
|---|
| 265 | if((SHORT)0x6d==SHORT1FROMMP(mp1)) { | 
|---|
| 266 | /* Delete menu item */ | 
|---|
| 267 | if(wpObject->wpDelete(CONFIRM_DELETE|CONFIRM_DELETEFOLDER ) == OK_DELETE) | 
|---|
| 268 | lpo->lpParent->lpRemoveButton(lpo); | 
|---|
| 269 | } | 
|---|
| 270 | else | 
|---|
| 271 | wpObject->wpMenuItemSelected(NULL, SHORT1FROMMP(mp1)); | 
|---|
| 272 | }/* end of if(somIsObj(wpObject)) */ | 
|---|
| 273 | } | 
|---|
| 274 | } | 
|---|
| 275 | CATCH(LP_COMMAND) | 
|---|
| 276 | { | 
|---|
| 277 | } END_CATCH; | 
|---|
| 278 | return (MRESULT) FALSE; | 
|---|
| 279 | default: | 
|---|
| 280 | break; | 
|---|
| 281 | } | 
|---|
| 282 | // call the standard flyover button procedure to handle the rest of the messages | 
|---|
| 283 | return (newButtonProc)(hwnd,msg,mp1,mp2); | 
|---|
| 284 | }; | 
|---|
| 285 |  | 
|---|
| 286 | static BOOL bDrawn=FALSE; | 
|---|
| 287 | static RECTL rclDrawn; | 
|---|
| 288 | static MRESULT handleDragOver(HWND hwnd, MPARAM mp1, MPARAM mp2) | 
|---|
| 289 | { | 
|---|
| 290 | MRESULT mResult; | 
|---|
| 291 | ULONG ulNumberOfObjects; | 
|---|
| 292 | PDRAGINFO pDragInfo; | 
|---|
| 293 | HPS hps; | 
|---|
| 294 | RECTL rectl; | 
|---|
| 295 | SWP swp; | 
|---|
| 296 |  | 
|---|
| 297 | mResult = MRFROM2SHORT( DOR_NODROPOP, DO_LINK); | 
|---|
| 298 |  | 
|---|
| 299 | /* Get access to the dragInfo */ | 
|---|
| 300 | pDragInfo=(PDRAGINFO)mp1; | 
|---|
| 301 | DrgAccessDraginfo(pDragInfo); | 
|---|
| 302 | /* Get number of items */ | 
|---|
| 303 | ulNumberOfObjects = DrgQueryDragitemCount( pDragInfo); | 
|---|
| 304 |  | 
|---|
| 305 | if(ulNumberOfObjects>1) { | 
|---|
| 306 | /* Free the draginfo */ | 
|---|
| 307 | DrgFreeDraginfo(pDragInfo); | 
|---|
| 308 | return MRFROM2SHORT( DOR_NODROPOP, DO_LINK); | 
|---|
| 309 | } | 
|---|
| 310 |  | 
|---|
| 311 | switch(pDragInfo->usOperation) | 
|---|
| 312 | { | 
|---|
| 313 | case DO_DEFAULT: | 
|---|
| 314 | case DO_LINK: | 
|---|
| 315 | if(!bDrawn) { | 
|---|
| 316 | POINTL ptl; | 
|---|
| 317 | launchPad * lp; | 
|---|
| 318 |  | 
|---|
| 319 | ptl.x=SHORT1FROMMP(mp2); | 
|---|
| 320 | ptl.y=SHORT2FROMMP(mp2); | 
|---|
| 321 | /* Pos in window coords */ | 
|---|
| 322 | WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1); | 
|---|
| 323 |  | 
|---|
| 324 | hps=DrgGetPS(hwnd); | 
|---|
| 325 | WinQueryWindowPos(hwnd,&swp); | 
|---|
| 326 |  | 
|---|
| 327 | rectl.xLeft=swp.cx;//-swp.cy; | 
|---|
| 328 |  | 
|---|
| 329 | lp=(launchPad*)WinQueryWindowULong(hwnd,QWL_USER); | 
|---|
| 330 | if(lp) { | 
|---|
| 331 | if(lp->lpQueryNumObjects()==0) { | 
|---|
| 332 | rectl.xLeft=0; | 
|---|
| 333 | } | 
|---|
| 334 | } | 
|---|
| 335 |  | 
|---|
| 336 | rectl.yTop=swp.cy-1; | 
|---|
| 337 | rectl.yBottom=1; | 
|---|
| 338 | if(ptl.x<rectl.xLeft) { | 
|---|
| 339 | int numB; | 
|---|
| 340 |  | 
|---|
| 341 | numB=(ptl.x-xButtonOffset)/(swp.cy+xButtonDelta); | 
|---|
| 342 | rectl.xLeft=((ptl.x-numB*swp.cy) > swp.cy/2 ? numB+1: numB); | 
|---|
| 343 | rectl.xLeft*=(swp.cy+xButtonDelta); | 
|---|
| 344 | rectl.xLeft-=(xButtonDelta)-xButtonOffset+xButtonDelta; | 
|---|
| 345 | rectl.xRight=rectl.xLeft+(xButtonDelta*2); | 
|---|
| 346 | } | 
|---|
| 347 | else { | 
|---|
| 348 | rectl.xRight=swp.cx-1; | 
|---|
| 349 | } | 
|---|
| 350 | rclDrawn=rectl; | 
|---|
| 351 | WinDrawBorder(hps,&rectl, 2, 2, 0, 0, DB_STANDARD|DB_PATINVERT); | 
|---|
| 352 | bDrawn=TRUE; | 
|---|
| 353 |  | 
|---|
| 354 | DrgReleasePS(hps); | 
|---|
| 355 | } | 
|---|
| 356 | mResult = MRFROM2SHORT( DOR_DROP, DO_LINK); | 
|---|
| 357 | break; | 
|---|
| 358 | default: | 
|---|
| 359 | break; | 
|---|
| 360 | } | 
|---|
| 361 |  | 
|---|
| 362 | /* Free the draginfo */ | 
|---|
| 363 | DrgFreeDraginfo(pDragInfo); | 
|---|
| 364 |  | 
|---|
| 365 | return mResult; | 
|---|
| 366 | } | 
|---|
| 367 |  | 
|---|
| 368 |  | 
|---|
| 369 | static MRESULT handleDragLeave(HWND hwnd, MPARAM mp1, MPARAM mp2) | 
|---|
| 370 | { | 
|---|
| 371 | RECTL rectl; | 
|---|
| 372 | SWP swp; | 
|---|
| 373 | HPS hps; | 
|---|
| 374 |  | 
|---|
| 375 | /* Remove target emphasis here */ | 
|---|
| 376 | hps=DrgGetPS(hwnd); | 
|---|
| 377 | WinDrawBorder(hps,&rclDrawn, 2, 2, 0, 0, DB_STANDARD|DB_PATINVERT); | 
|---|
| 378 | DrgReleasePS(hps); | 
|---|
| 379 | bDrawn=FALSE; | 
|---|
| 380 | return (MRESULT) FALSE; | 
|---|
| 381 | } | 
|---|
| 382 |  | 
|---|
| 383 |  | 
|---|
| 384 | static MRESULT EXPENTRY launchPadWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 
|---|
| 385 | { | 
|---|
| 386 | WPFolder* thisPtr; | 
|---|
| 387 | launchPad * lp; | 
|---|
| 388 | LPObject *lpo; | 
|---|
| 389 | static USHORT id=0;//Initialisation new in V1.00a | 
|---|
| 390 |  | 
|---|
| 391 | switch(msg) | 
|---|
| 392 | { | 
|---|
| 393 | #if 0 | 
|---|
| 394 | case DM_ENDCONVERSATION: | 
|---|
| 395 | case DM_DRAGFILECOMPLETE: | 
|---|
| 396 | case DM_DROPNOTIFY: | 
|---|
| 397 | case DM_FILERENDERED: | 
|---|
| 398 | case DM_RENDERCOMPLETE: | 
|---|
| 399 | DosBeep(500,500); | 
|---|
| 400 | break; | 
|---|
| 401 | return (MRESULT)FALSE; | 
|---|
| 402 | case WM_ENDDRAG: | 
|---|
| 403 | DosBeep(500,500); | 
|---|
| 404 | break; | 
|---|
| 405 | return (MRESULT)TRUE; | 
|---|
| 406 | #endif | 
|---|
| 407 | case WM_PAINT: | 
|---|
| 408 | { | 
|---|
| 409 | RECTL rcl; | 
|---|
| 410 | launchPad * lp; | 
|---|
| 411 |  | 
|---|
| 412 | HPS hps=WinBeginPaint(hwnd,NULLHANDLE, &rcl); | 
|---|
| 413 | WinFillRect(hps, &rcl, SYSCLR_DIALOGBACKGROUND); | 
|---|
| 414 | lp=(launchPad*)WinQueryWindowULong(hwnd,QWL_USER); | 
|---|
| 415 | if(lp) { | 
|---|
| 416 | if(lp->lpQueryNumObjects()==0) { | 
|---|
| 417 | WinQueryWindowRect(hwnd,&rcl); | 
|---|
| 418 | WinDrawBorder(hps,&rcl,1,1,SYSCLR_WINDOWFRAME,SYSCLR_DIALOGBACKGROUND, DB_STANDARD); | 
|---|
| 419 | } | 
|---|
| 420 | } | 
|---|
| 421 | WinEndPaint(hps); | 
|---|
| 422 | return (MRESULT) 0; | 
|---|
| 423 | } | 
|---|
| 424 | case DM_DRAGOVER: | 
|---|
| 425 | return handleDragOver(hwnd, mp1, mp2); | 
|---|
| 426 | case DM_DROP: | 
|---|
| 427 | { | 
|---|
| 428 | ULONG ulCount; | 
|---|
| 429 | ULONG ulNumberOfObjects; | 
|---|
| 430 | PDRAGITEM pDragItem; | 
|---|
| 431 | SOMClass *folderClass; | 
|---|
| 432 | WPObject * wpObject; | 
|---|
| 433 | PDRAGINFO pDragInfo; | 
|---|
| 434 |  | 
|---|
| 435 | TRY_LOUD(LP_FRAMEDROP) { | 
|---|
| 436 | /* A new object dropped on the launchpad */ | 
|---|
| 437 | pDragInfo=(PDRAGINFO)mp1; | 
|---|
| 438 | if(DrgAccessDraginfo(pDragInfo)) { | 
|---|
| 439 | /* Get number of items */ | 
|---|
| 440 | ulNumberOfObjects = DrgQueryDragitemCount( pDragInfo); | 
|---|
| 441 | if(ulNumberOfObjects>1){ | 
|---|
| 442 | /* Free the draginfo */ | 
|---|
| 443 | DrgDeleteDraginfoStrHandles(pDragInfo); | 
|---|
| 444 | DrgFreeDraginfo(pDragInfo); | 
|---|
| 445 | } | 
|---|
| 446 | else { | 
|---|
| 447 | ulCount=0; | 
|---|
| 448 |  | 
|---|
| 449 | pDragItem=DrgQueryDragitemPtr( pDragInfo, ulCount); | 
|---|
| 450 | wpObject=(WPObject*)OBJECT_FROM_PREC(DrgQueryDragitemPtr( pDragInfo, ulCount)->ulItemID); | 
|---|
| 451 | lp=(launchPad*)WinQueryWindowULong(hwnd,QWL_USER); | 
|---|
| 452 | if(lp) { | 
|---|
| 453 | if(somIsObj(wpObject)) { | 
|---|
| 454 |  | 
|---|
| 455 | POINTL ptl; | 
|---|
| 456 | int numB; | 
|---|
| 457 | SWP swp; | 
|---|
| 458 |  | 
|---|
| 459 | WinQueryWindowPos(hwnd,&swp); | 
|---|
| 460 | ptl.x=pDragInfo->xDrop; | 
|---|
| 461 | ptl.y=pDragInfo->yDrop; | 
|---|
| 462 | /* Pos in window coords */ | 
|---|
| 463 | WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1); | 
|---|
| 464 | numB=(ptl.x-xButtonOffset)/(swp.cy+xButtonDelta); | 
|---|
| 465 | numB=((ptl.x-numB*swp.cy) > swp.cy/2 ? numB+1: numB); | 
|---|
| 466 |  | 
|---|
| 467 | /* Do a link */ | 
|---|
| 468 | lp->lpAddButton(wpObject, numB); | 
|---|
| 469 | handleDragLeave(hwnd, mp1, mp2); | 
|---|
| 470 | } | 
|---|
| 471 | } | 
|---|
| 472 | DrgDeleteDraginfoStrHandles(pDragInfo); | 
|---|
| 473 | DrgFreeDraginfo(pDragInfo); | 
|---|
| 474 | } | 
|---|
| 475 | } | 
|---|
| 476 | handleDragLeave(hwnd, mp1, mp2); | 
|---|
| 477 | } | 
|---|
| 478 | CATCH(LP_FRAMEDROP) | 
|---|
| 479 | { | 
|---|
| 480 | } END_CATCH; | 
|---|
| 481 |  | 
|---|
| 482 | break; | 
|---|
| 483 | } | 
|---|
| 484 | case DM_DRAGLEAVE: | 
|---|
| 485 | return handleDragLeave(hwnd, mp1, mp2); | 
|---|
| 486 | break; | 
|---|
| 487 | case WM_COMMAND: | 
|---|
| 488 | if(SHORT1FROMMP(mp2)==CMDSRC_PUSHBUTTON) { | 
|---|
| 489 | /* It's a push button */ | 
|---|
| 490 | lpo=(LPObject*)WinQueryWindowULong(WinWindowFromID(hwnd,SHORT1FROMMP(mp1)),QWL_USER); | 
|---|
| 491 | if(lpo) { | 
|---|
| 492 | if(somIsObj(lpo->wpObject)) | 
|---|
| 493 | lpo->wpObject->wpViewObject(NULLHANDLE, OPEN_DEFAULT,0); | 
|---|
| 494 | } | 
|---|
| 495 | } | 
|---|
| 496 | return (MRESULT)FALSE; | 
|---|
| 497 | /***********************************************/ | 
|---|
| 498 | /* Stuff for fly over help                     */ | 
|---|
| 499 | case WM_MOUSEMOVE: | 
|---|
| 500 | launchPad * lp; | 
|---|
| 501 |  | 
|---|
| 502 | lp=(launchPad*)WinQueryWindowULong(hwnd,QWL_USER); | 
|---|
| 503 | if(lp) { | 
|---|
| 504 | if(lp->lpQueryNumObjects()!=0) { | 
|---|
| 505 | break; | 
|---|
| 506 | } | 
|---|
| 507 | } | 
|---|
| 508 |  | 
|---|
| 509 | #if 0 | 
|---|
| 510 | tempID=WinQueryWindowUShort(hwnd,QWS_ID);/*  get the id of the window under the pointer  */ | 
|---|
| 511 | if(id!=tempID) {  // New Button? | 
|---|
| 512 | WinStartTimer(WinQueryAnchorBlock(hwnd),hwnd,tempID,(ULONG)iTBFlyOverDelay); // New timer for delay | 
|---|
| 513 | id=tempID;  // Save ID | 
|---|
| 514 | } | 
|---|
| 515 | else { | 
|---|
| 516 | if(!hwndBubbleWindow) | 
|---|
| 517 | WinStartTimer(WinQueryAnchorBlock(hwnd),hwnd,tempID,(ULONG)iTBFlyOverDelay); // New timer for delay | 
|---|
| 518 | } | 
|---|
| 519 | #endif | 
|---|
| 520 | if(!hwndBubbleWindow) | 
|---|
| 521 | WinStartTimer(WinQueryAnchorBlock(hwnd), hwnd, 2,(ULONG)iTBFlyOverDelay); // New timer for delay | 
|---|
| 522 |  | 
|---|
| 523 | break; | 
|---|
| 524 | case WM_DESTROY: | 
|---|
| 525 | WinStopTimer(WinQueryAnchorBlock(hwnd),hwnd,1);//Stop timer if running | 
|---|
| 526 | if(hwndBubbleWindow) | 
|---|
| 527 | WinDestroyWindow(hwndBubbleWindow);/*  close the bubblewindow  */ | 
|---|
| 528 | hwndBubbleWindow=0; | 
|---|
| 529 | /* Stop delay timer if running */ | 
|---|
| 530 | WinStopTimer(WinQueryAnchorBlock(hwnd),hwnd, 2); | 
|---|
| 531 | break; | 
|---|
| 532 |  | 
|---|
| 533 | case WM_NEWBUBBLE: | 
|---|
| 534 | ULONG bubbleEnabled; | 
|---|
| 535 | HWND hwndStore; | 
|---|
| 536 | POINTL ptl; | 
|---|
| 537 | RECTL  rclWork; | 
|---|
| 538 | LONG  ulWinTextLen; | 
|---|
| 539 | POINTL aptlPoints[TXTBOX_COUNT]; | 
|---|
| 540 | LONG   deltaX,deltaY; | 
|---|
| 541 | HPS  hps; | 
|---|
| 542 | RECTL   rcl; | 
|---|
| 543 |  | 
|---|
| 544 | /*  we have to build a new information window  */ | 
|---|
| 545 | if(hwndBubbleWindow){// if(){...} new in V1.00a | 
|---|
| 546 | WinDestroyWindow(hwndBubbleWindow);/*  close the bubblewindow  */ | 
|---|
| 547 | hwndBubbleWindow=NULL; | 
|---|
| 548 | } | 
|---|
| 549 | // Query the pointer position | 
|---|
| 550 | WinQueryPointerPos(HWND_DESKTOP,&ptl); | 
|---|
| 551 | WinMapWindowPoints(HWND_DESKTOP,hwnd,&ptl,1); | 
|---|
| 552 | WinQueryWindowRect(hwnd,&rclWork); | 
|---|
| 553 | if(!hwndBubbleWindow | 
|---|
| 554 | && WinPtInRect(WinQueryAnchorBlock(hwnd),&rclWork,&ptl) | 
|---|
| 555 | && bTBFlyOverEnabled) { | 
|---|
| 556 |  | 
|---|
| 557 | static HWND hwndBubbleClient; | 
|---|
| 558 | ULONG style=FCF_BORDER|FCF_NOBYTEALIGN; | 
|---|
| 559 | char winText[255] = {0}; | 
|---|
| 560 |  | 
|---|
| 561 | /* Get window text for size calculating */ | 
|---|
| 562 | lp=(launchPad*)WinQueryWindowULong(hwnd,QWL_USER); | 
|---|
| 563 | if(lp) { | 
|---|
| 564 | strncpy(winText, lp->lpQueryFlyOverText(), sizeof(winText)); | 
|---|
| 565 | winText[sizeof(winText)-1]=0; | 
|---|
| 566 | } | 
|---|
| 567 |  | 
|---|
| 568 | ulWinTextLen=(LONG)strlen(winText); // Query text length | 
|---|
| 569 |  | 
|---|
| 570 | /* Delete 'Returns' in object title */ | 
|---|
| 571 | char *pBuchst; | 
|---|
| 572 | char *pRest; | 
|---|
| 573 | pRest=winText; | 
|---|
| 574 | while((pBuchst=strchr(pRest,13))!=NULL) { | 
|---|
| 575 | *pBuchst=' '; | 
|---|
| 576 | pBuchst++; | 
|---|
| 577 | if(*pBuchst==10) | 
|---|
| 578 | *pBuchst=' '; | 
|---|
| 579 | pRest=pBuchst; | 
|---|
| 580 | } | 
|---|
| 581 |  | 
|---|
| 582 | /* Create help window */ | 
|---|
| 583 | hwndBubbleWindow=WinCreateStdWindow(HWND_DESKTOP, | 
|---|
| 584 | 0, | 
|---|
| 585 | &style, | 
|---|
| 586 | WC_STATIC, | 
|---|
| 587 | "", | 
|---|
| 588 | SS_TEXT|DT_CENTER|DT_VCENTER, | 
|---|
| 589 | NULLHANDLE, | 
|---|
| 590 | 400, | 
|---|
| 591 | &hwndBubbleClient); | 
|---|
| 592 |  | 
|---|
| 593 | hwndShadow=WinCreateWindow(HWND_DESKTOP, | 
|---|
| 594 | WC_STATIC, | 
|---|
| 595 | "", | 
|---|
| 596 | SS_TEXT|DT_CENTER|DT_VCENTER, | 
|---|
| 597 | 0, 0, | 
|---|
| 598 | 0, 0, | 
|---|
| 599 | hwndBubbleWindow, | 
|---|
| 600 | hwndBubbleWindow, | 
|---|
| 601 | 401, | 
|---|
| 602 | NULLHANDLE, | 
|---|
| 603 | NULLHANDLE); | 
|---|
| 604 | oldProc=WinSubclassWindow(hwndShadow, shadowProc); | 
|---|
| 605 |  | 
|---|
| 606 | // Set the font for the help | 
|---|
| 607 | WinSetPresParam(hwndBubbleClient,PP_FONTNAMESIZE, | 
|---|
| 608 | sizeof(chrTBFlyFontName), | 
|---|
| 609 | chrTBFlyFontName); | 
|---|
| 610 | /* Calculate text size in pixel */ | 
|---|
| 611 | hps=WinBeginPaint(hwndBubbleClient,(HPS)NULL,(PRECTL)NULL); | 
|---|
| 612 | GpiQueryTextBox(hps,ulWinTextLen,winText,TXTBOX_COUNT,aptlPoints); | 
|---|
| 613 | WinEndPaint(hps); | 
|---|
| 614 |  | 
|---|
| 615 | /* Set colors */ | 
|---|
| 616 | WinSetPresParam(hwndBubbleClient, | 
|---|
| 617 | PP_BACKGROUNDCOLOR,sizeof(rgbTBFlyBackground) , | 
|---|
| 618 | &rgbTBFlyBackground ); | 
|---|
| 619 | WinSetPresParam(hwndBubbleClient, | 
|---|
| 620 | PP_FOREGROUNDCOLOR,sizeof(rgbTBFlyForeground) , | 
|---|
| 621 | &rgbTBFlyForeground ); | 
|---|
| 622 |  | 
|---|
| 623 | /* Calculate bubble positon and show bubble */ | 
|---|
| 624 | WinQueryPointerPos(HWND_DESKTOP,&ptl);//Query pointer position in the desktop window | 
|---|
| 625 | WinQueryWindowRect(HWND_DESKTOP,&rcl);//Query desktop size | 
|---|
| 626 | aptlPoints[TXTBOX_BOTTOMRIGHT].x-aptlPoints[TXTBOX_BOTTOMLEFT].x+7+xVal+ptl.x | 
|---|
| 627 | > rcl.xRight | 
|---|
| 628 | ? deltaX=-aptlPoints[TXTBOX_BOTTOMRIGHT].x-aptlPoints[TXTBOX_BOTTOMLEFT].x-xVal-xVal-7 | 
|---|
| 629 | : deltaX=0 ; | 
|---|
| 630 |  | 
|---|
| 631 | aptlPoints[TXTBOX_TOPLEFT].y-aptlPoints[TXTBOX_BOTTOMLEFT].y+2+yVal+ptl.y | 
|---|
| 632 | > rcl.yTop | 
|---|
| 633 | ? deltaY=-aptlPoints[TXTBOX_TOPLEFT].y-aptlPoints[TXTBOX_BOTTOMLEFT].y-2*yVal-7 | 
|---|
| 634 | : deltaY=0 ; | 
|---|
| 635 | WinSetWindowPos(hwndBubbleWindow, | 
|---|
| 636 | HWND_TOP, | 
|---|
| 637 | ptl.x+xVal+deltaX,ptl.y+yVal+deltaY, | 
|---|
| 638 | aptlPoints[TXTBOX_BOTTOMRIGHT].x-aptlPoints[TXTBOX_BOTTOMLEFT].x+8, | 
|---|
| 639 | aptlPoints[TXTBOX_TOPLEFT].y-aptlPoints[TXTBOX_BOTTOMLEFT].y+2, | 
|---|
| 640 | SWP_ZORDER|SWP_SIZE|SWP_MOVE|SWP_SHOW); | 
|---|
| 641 |  | 
|---|
| 642 | WinSetWindowPos(hwndShadow, | 
|---|
| 643 | hwndBubbleWindow, | 
|---|
| 644 | ptl.x+xVal+deltaX+5 | 
|---|
| 645 | ,ptl.y+yVal+deltaY-5, | 
|---|
| 646 | aptlPoints[TXTBOX_BOTTOMRIGHT].x-aptlPoints[TXTBOX_BOTTOMLEFT].x+8, | 
|---|
| 647 | aptlPoints[TXTBOX_TOPLEFT].y-aptlPoints[TXTBOX_BOTTOMLEFT].y+2, | 
|---|
| 648 | SWP_ZORDER|SWP_SIZE|SWP_MOVE|SWP_SHOW); | 
|---|
| 649 |  | 
|---|
| 650 | /* Set bubble text */ | 
|---|
| 651 | WinSetWindowText(hwndBubbleClient,winText); | 
|---|
| 652 | WinStartTimer(WinQueryAnchorBlock(hwnd),hwnd,1,35); | 
|---|
| 653 | } // end if(!hwndBubbleWindow) | 
|---|
| 654 | break; | 
|---|
| 655 | case WM_TIMER: | 
|---|
| 656 | switch (SHORT1FROMMP(mp1)) | 
|---|
| 657 | { | 
|---|
| 658 | case 1: //Intervall timer | 
|---|
| 659 | { | 
|---|
| 660 | POINTL ptl; | 
|---|
| 661 | RECTL  rclWork; | 
|---|
| 662 |  | 
|---|
| 663 | /* Test pointer position */ | 
|---|
| 664 | WinQueryPointerPos(HWND_DESKTOP, &ptl); | 
|---|
| 665 | WinMapWindowPoints(HWND_DESKTOP, hwnd,&ptl, 1); | 
|---|
| 666 | WinQueryWindowRect(hwnd, &rclWork); | 
|---|
| 667 | if(!WinPtInRect(WinQueryAnchorBlock(hwnd),&rclWork,&ptl)) | 
|---|
| 668 | { // Window has changed | 
|---|
| 669 | WinStopTimer(WinQueryAnchorBlock(hwnd), hwnd, 1);  // stop the running timer | 
|---|
| 670 | if(hwndBubbleWindow) | 
|---|
| 671 | WinDestroyWindow(hwndBubbleWindow);/*  close the bubblewindow  */ | 
|---|
| 672 | hwndBubbleWindow=0; | 
|---|
| 673 | id=0; | 
|---|
| 674 | } | 
|---|
| 675 | break; | 
|---|
| 676 | } | 
|---|
| 677 | case 2:// delay over | 
|---|
| 678 | {//our own timer. | 
|---|
| 679 | POINTL ptl; | 
|---|
| 680 | RECTL  rclWork; | 
|---|
| 681 |  | 
|---|
| 682 | WinStopTimer(WinQueryAnchorBlock(hwnd), hwnd, 2);//Stop the delay timer | 
|---|
| 683 | /* Check the pointer position */ | 
|---|
| 684 | WinQueryPointerPos(HWND_DESKTOP,&ptl); | 
|---|
| 685 | WinMapWindowPoints(HWND_DESKTOP,hwnd,&ptl,1); | 
|---|
| 686 | WinQueryWindowRect(hwnd,&rclWork); | 
|---|
| 687 | if(WinPtInRect(WinQueryAnchorBlock(hwnd),&rclWork,&ptl)) | 
|---|
| 688 | WinPostMsg(hwnd,WM_NEWBUBBLE,NULL,NULL);//Request a help window | 
|---|
| 689 | return (MRESULT)FALSE; | 
|---|
| 690 | } | 
|---|
| 691 | default: | 
|---|
| 692 | break; | 
|---|
| 693 | } | 
|---|
| 694 | break; | 
|---|
| 695 | default: | 
|---|
| 696 | break; | 
|---|
| 697 | } | 
|---|
| 698 | return pfnwpOldLPProc(hwnd, msg, mp1, mp2); | 
|---|
| 699 | } | 
|---|
| 700 |  | 
|---|
| 701 | void LPList::lplRefreshAllPads() | 
|---|
| 702 | { | 
|---|
| 703 |  | 
|---|
| 704 | } | 
|---|
| 705 |  | 
|---|
| 706 | LPObject::LPObject(HPOINTER hptr) | 
|---|
| 707 | { | 
|---|
| 708 | hPtr=hptr; | 
|---|
| 709 | } | 
|---|
| 710 |  | 
|---|
| 711 | LPObject::~LPObject(void) | 
|---|
| 712 | { | 
|---|
| 713 | #if 0 | 
|---|
| 714 | if(hPtr) { | 
|---|
| 715 | if(!WinDestroyPointer(hPtr)) | 
|---|
| 716 | DosBeep(100,200); | 
|---|
| 717 | } | 
|---|
| 718 | #endif | 
|---|
| 719 | } | 
|---|
| 720 |  | 
|---|
| 721 | launchPad::launchPad(HWND hwndParent,HWND hwndOwner, BOOL bVisible, WPFolder *wpParent, LPList** lpadList, HWND hwndPrev, ULONG ulFl) | 
|---|
| 722 | { | 
|---|
| 723 | LPList *lplTemp; | 
|---|
| 724 |  | 
|---|
| 725 | wpParentFolder=wpParent; | 
|---|
| 726 | hwndPrevious=hwndPrev; | 
|---|
| 727 | fl=ulFl; | 
|---|
| 728 | lpList=lpadList; | 
|---|
| 729 |  | 
|---|
| 730 | /* Reset text */ | 
|---|
| 731 | chrFlyOverText[0]=0; | 
|---|
| 732 |  | 
|---|
| 733 | if((hwndLaunchPad=WinCreateWindow(hwndParent ,WC_FRAME, "Toolbar", FS_BORDER| (bVisible ? WS_VISIBLE: 0), | 
|---|
| 734 | 0, 0, 0, 0, hwndOwner, HWND_TOP, 1234, NULLHANDLE, NULLHANDLE))!=NULLHANDLE) { | 
|---|
| 735 | WinSetWindowULong(hwndLaunchPad, QWL_USER,(ULONG) this);//Save object ptr. | 
|---|
| 736 | pfnwpOldLPProc=WinSubclassWindow(hwndLaunchPad, launchPadWindowProc); | 
|---|
| 737 | } | 
|---|
| 738 |  | 
|---|
| 739 | ulNumObjects=0; | 
|---|
| 740 | lpoObjectList=NULL; | 
|---|
| 741 |  | 
|---|
| 742 | /* Add this pad to the list of pads */ | 
|---|
| 743 | if(!lplAllLPads) { | 
|---|
| 744 | /* It's the first one */ | 
|---|
| 745 | if((lplAllLPads=new LPList)!=NULL) { | 
|---|
| 746 | lplAllLPads->lpPad=this; | 
|---|
| 747 | lplAllLPads->lplNext=NULL; | 
|---|
| 748 | } | 
|---|
| 749 | } | 
|---|
| 750 | else { | 
|---|
| 751 | if((lplTemp=new LPList)!=NULL) { | 
|---|
| 752 | lplTemp->lpPad=this; | 
|---|
| 753 | lplTemp->lplNext=lplAllLPads; | 
|---|
| 754 | lplAllLPads=lplTemp; | 
|---|
| 755 | } | 
|---|
| 756 | } | 
|---|
| 757 | } | 
|---|
| 758 |  | 
|---|
| 759 | launchPad::~launchPad() | 
|---|
| 760 | { | 
|---|
| 761 | LPList *lplTemp, *lplTemp2; | 
|---|
| 762 |  | 
|---|
| 763 | lpSaveObjectList(); | 
|---|
| 764 | lpFreeObjectList(); | 
|---|
| 765 |  | 
|---|
| 766 | if(hwndLaunchPad) | 
|---|
| 767 | WinDestroyWindow(hwndLaunchPad); | 
|---|
| 768 |  | 
|---|
| 769 | /* Remove this pad from the list of pads */ | 
|---|
| 770 | lplTemp=lplAllLPads; | 
|---|
| 771 |  | 
|---|
| 772 | if(lplTemp->lpPad==this) { | 
|---|
| 773 | lplAllLPads=lplTemp->lplNext; | 
|---|
| 774 | delete(lplTemp); | 
|---|
| 775 | } | 
|---|
| 776 | else { | 
|---|
| 777 | while(lplTemp->lplNext) | 
|---|
| 778 | { | 
|---|
| 779 | if(lplTemp->lplNext->lpPad==this) { | 
|---|
| 780 | lplTemp2=lplTemp->lplNext; | 
|---|
| 781 | lplTemp->lplNext=lplTemp->lplNext->lplNext; | 
|---|
| 782 | delete(lplTemp2); | 
|---|
| 783 | break; | 
|---|
| 784 | } | 
|---|
| 785 | lplTemp=lplTemp->lplNext; | 
|---|
| 786 | } | 
|---|
| 787 | } | 
|---|
| 788 | } | 
|---|
| 789 |  | 
|---|
| 790 | BOOL launchPad::lpSetFlyOverText(char* chrText) | 
|---|
| 791 | { | 
|---|
| 792 | strncpy(chrFlyOverText, chrText, sizeof(chrFlyOverText)); | 
|---|
| 793 | chrFlyOverText[sizeof(chrFlyOverText)-1]=0; | 
|---|
| 794 |  | 
|---|
| 795 | return TRUE; | 
|---|
| 796 | } | 
|---|
| 797 |  | 
|---|
| 798 | PSZ  launchPad::lpQueryFlyOverText(void) | 
|---|
| 799 | { | 
|---|
| 800 | return chrFlyOverText; | 
|---|
| 801 | } | 
|---|
| 802 |  | 
|---|
| 803 | BOOL launchPad::lpSetLaunchPadPos(HWND hwndInsertBehind, LONG x, LONG y, LONG cx, LONG cy, ULONG fl) | 
|---|
| 804 | { | 
|---|
| 805 | if(WinIsWindow(WinQueryAnchorBlock(hwndLaunchPad), hwndPrevious)) { | 
|---|
| 806 | SWP swp; | 
|---|
| 807 | WinQueryWindowPos(hwndPrevious,&swp); | 
|---|
| 808 | return WinSetWindowPos(hwndLaunchPad, hwndInsertBehind, swp.x+swp.cx+x, y, cx, cy, fl); | 
|---|
| 809 | } | 
|---|
| 810 | else | 
|---|
| 811 | return WinSetWindowPos(hwndLaunchPad, hwndInsertBehind, x, y, cx, cy, fl); | 
|---|
| 812 | } | 
|---|
| 813 |  | 
|---|
| 814 |  | 
|---|
| 815 | BOOL launchPad::lpSetConfiguration(char * chrTarget, char * chrConfigID_) | 
|---|
| 816 | { | 
|---|
| 817 | HOBJECT hObject; | 
|---|
| 818 | char chrSetup[CCHMAXPATH]; | 
|---|
| 819 |  | 
|---|
| 820 | /* Destination of toolbar folder */ | 
|---|
| 821 | strncpy(chrConfigTarget, chrTarget,sizeof(chrConfigTarget)); | 
|---|
| 822 | chrConfigTarget[sizeof(chrConfigTarget)-1]=0; | 
|---|
| 823 | /* The ID of the toolbar folder */ | 
|---|
| 824 | strncpy(chrConfigID, chrConfigID_,sizeof(chrConfigID)); | 
|---|
| 825 | chrConfigID[sizeof(chrConfigID)-1]=0; | 
|---|
| 826 |  | 
|---|
| 827 | /* First check the config folder */ | 
|---|
| 828 | if((hObject=WinQueryObject(chrConfigID))==NULLHANDLE) | 
|---|
| 829 | { | 
|---|
| 830 | /* Toolbar folder lost recreate it */ | 
|---|
| 831 | if(!SysCheckFileExists(chrConfigTarget)) | 
|---|
| 832 | return FALSE; /* No install dir defined */ | 
|---|
| 833 |  | 
|---|
| 834 | if(fl & LP_USEOBJECTASPARAM) { | 
|---|
| 835 | /* This isn't used yet */ | 
|---|
| 836 | sprintf(chrSetup, "HIDECLASSPAGE=1;OBJECTID=%s",chrConfigID); | 
|---|
| 837 | if((hObject=WinCreateObject("CWMenuFolder", chrConfigID, chrSetup, chrConfigTarget,CO_FAILIFEXISTS))==NULLHANDLE) | 
|---|
| 838 | return FALSE; /* Can't create new toolbar folder */ | 
|---|
| 839 | } | 
|---|
| 840 | else { | 
|---|
| 841 | sprintf(chrSetup, "OBJECTID=%s", chrConfigID); | 
|---|
| 842 | if((hObject=WinCreateObject("WPFolder", chrConfigID, chrSetup, chrConfigTarget,CO_FAILIFEXISTS))==NULLHANDLE) | 
|---|
| 843 | return FALSE; /* Can't create new toolbar folder */ | 
|---|
| 844 | } | 
|---|
| 845 | } | 
|---|
| 846 |  | 
|---|
| 847 | lpBuildObjectList(chrConfigID); | 
|---|
| 848 |  | 
|---|
| 849 | return TRUE; | 
|---|
| 850 | } | 
|---|
| 851 |  | 
|---|
| 852 | WPFolder* launchPad::lpQueryParentFolder() | 
|---|
| 853 | { | 
|---|
| 854 | return wpParentFolder; | 
|---|
| 855 | } | 
|---|
| 856 |  | 
|---|
| 857 | void launchPad::lpRefreshLaunchPad() | 
|---|
| 858 | { | 
|---|
| 859 | /* Refresh all launchpads */ | 
|---|
| 860 | LPList *lplTemp; | 
|---|
| 861 |  | 
|---|
| 862 | //lplTemp=lplAllLPads; | 
|---|
| 863 | lplTemp=*lpList; | 
|---|
| 864 |  | 
|---|
| 865 | while(lplTemp) | 
|---|
| 866 | { | 
|---|
| 867 | if(lplTemp->lpPad) { | 
|---|
| 868 | lplTemp->lpPad->lpFreeObjectList(); | 
|---|
| 869 | lplTemp->lpPad->lpReBuildObjectList(); | 
|---|
| 870 | lplTemp->lpPad->lpFillPad(); | 
|---|
| 871 | } | 
|---|
| 872 | lplTemp=lplTemp->lplNext; | 
|---|
| 873 | } | 
|---|
| 874 | return; | 
|---|
| 875 | } | 
|---|
| 876 |  | 
|---|
| 877 | BOOL launchPad::lpRemoveButton(LPObject *lpObject) | 
|---|
| 878 | { | 
|---|
| 879 | int a; | 
|---|
| 880 | LPObject* lpoTemp, *lpoTemp2; | 
|---|
| 881 |  | 
|---|
| 882 | /* Find object in list */ | 
|---|
| 883 | lpoTemp=lpoObjectList; | 
|---|
| 884 |  | 
|---|
| 885 | if(lpoTemp==lpObject) { | 
|---|
| 886 | lpoObjectList=lpoTemp->lpoNext; | 
|---|
| 887 |  | 
|---|
| 888 | delete(lpObject); | 
|---|
| 889 | ulNumObjects--; | 
|---|
| 890 | } | 
|---|
| 891 | else { | 
|---|
| 892 | while(lpoTemp->lpoNext) | 
|---|
| 893 | { | 
|---|
| 894 | if(lpoTemp->lpoNext==lpObject) { | 
|---|
| 895 | lpoTemp->lpoNext=lpObject->lpoNext; | 
|---|
| 896 |  | 
|---|
| 897 | delete(lpObject); | 
|---|
| 898 | ulNumObjects--; | 
|---|
| 899 | break; | 
|---|
| 900 | } | 
|---|
| 901 | lpoTemp=lpoTemp->lpoNext; | 
|---|
| 902 | } | 
|---|
| 903 | } | 
|---|
| 904 |  | 
|---|
| 905 | lpSaveObjectList(); | 
|---|
| 906 | lpRefreshLaunchPad(); | 
|---|
| 907 |  | 
|---|
| 908 | return TRUE; | 
|---|
| 909 | } | 
|---|
| 910 |  | 
|---|
| 911 |  | 
|---|
| 912 | BOOL launchPad::lpAddButton(WPObject* wpObject, int iPos) | 
|---|
| 913 | { | 
|---|
| 914 | HOBJECT hObject; | 
|---|
| 915 | SOMClass *folderClass; | 
|---|
| 916 | char chrSetup[CCHMAXPATH]; | 
|---|
| 917 | WPObject *wpTempObject; | 
|---|
| 918 | LPObject *lpoTemp, *lpoTemp2, *lpoTempNew; | 
|---|
| 919 | int a; | 
|---|
| 920 |  | 
|---|
| 921 |  | 
|---|
| 922 | /* First check the config folder */ | 
|---|
| 923 | if((hObject=WinQueryObject(chrConfigID))==NULLHANDLE) | 
|---|
| 924 | { | 
|---|
| 925 | /* Toolbar folder lost recreate it */ | 
|---|
| 926 | if(!SysCheckFileExists(chrConfigTarget)) | 
|---|
| 927 | return FALSE; /* No install dir defined */ | 
|---|
| 928 |  | 
|---|
| 929 | if(fl & LP_USEOBJECTASPARAM) { | 
|---|
| 930 | sprintf(chrSetup, "HIDECLASSPAGE=1;OBJECTID=%s", chrConfigID); | 
|---|
| 931 | if((hObject=WinCreateObject("CWMenuFolder", chrConfigID, chrSetup, chrConfigTarget,CO_FAILIFEXISTS))==NULLHANDLE) | 
|---|
| 932 | return FALSE; /* Can't create new toolbar folder */ | 
|---|
| 933 | } | 
|---|
| 934 | else { | 
|---|
| 935 | sprintf(chrSetup,  "OBJECTID=%s", chrConfigID); | 
|---|
| 936 | if((hObject=WinCreateObject("WPFolder", chrConfigID, chrSetup, chrConfigTarget,CO_FAILIFEXISTS))==NULLHANDLE) | 
|---|
| 937 | return FALSE; /* Can't create new toolbar folder */ | 
|---|
| 938 | } | 
|---|
| 939 | } | 
|---|
| 940 |  | 
|---|
| 941 | if(somIsObj(wpObject) && somIsObj(wpParentFolder)) { | 
|---|
| 942 | folderClass=wpParentFolder->somGetClass(); | 
|---|
| 943 | if(somIsObj(folderClass)) { | 
|---|
| 944 | /* Create a shadow in our toolbar folder */ | 
|---|
| 945 | wpTempObject=wpObject->wpCreateShadowObject((WPFolder*)((M_WPFolder*)folderClass)->wpclsQueryFolder(chrConfigID, FALSE), FALSE); | 
|---|
| 946 | if(somIsObj(wpTempObject)) { | 
|---|
| 947 | /* Get the persistent object handle */ | 
|---|
| 948 | hObject=wpTempObject->wpQueryHandle(); | 
|---|
| 949 |  | 
|---|
| 950 | /* Find the insertion point */ | 
|---|
| 951 | /* iPos is the button after which we insert the new one. The list of objects is in reverse order. */ | 
|---|
| 952 | lpoTemp2=lpoObjectList; | 
|---|
| 953 | if(iPos<ulNumObjects) { | 
|---|
| 954 | lpoTemp=lpoTemp2; | 
|---|
| 955 | for(a=ulNumObjects;a>iPos && lpoTemp; a--) | 
|---|
| 956 | { | 
|---|
| 957 | lpoTemp=lpoTemp2; | 
|---|
| 958 | lpoTemp2=lpoTemp2->lpoNext; | 
|---|
| 959 | } | 
|---|
| 960 | } | 
|---|
| 961 | else | 
|---|
| 962 | lpoTemp=NULLHANDLE; | 
|---|
| 963 |  | 
|---|
| 964 | /* lpoTemp contains object */ | 
|---|
| 965 | /* Alloc a struct for this object to insert it on the toolbar */ | 
|---|
| 966 |  | 
|---|
| 967 | if((lpoTempNew=new LPObject(wpTempObject->wpQueryIcon()))!=NULL) { | 
|---|
| 968 | ULONG ulRC; | 
|---|
| 969 |  | 
|---|
| 970 | lpoTempNew->wpObject=wpTempObject; | 
|---|
| 971 | lpoTempNew->wpObject->wpLockObject(); | 
|---|
| 972 | lpoTempNew->hObject=hObject; | 
|---|
| 973 | //  lpoTempNew->hPtr=wpTempObject->wpQueryIcon(); | 
|---|
| 974 |  | 
|---|
| 975 | /* Title of the object */ | 
|---|
| 976 | strncpy(lpoTempNew->chrName, wpTempObject->wpQueryTitle(),sizeof(lpoTempNew->chrName)); | 
|---|
| 977 | lpoTempNew->lpParent=this; | 
|---|
| 978 |  | 
|---|
| 979 | if(lpoTemp) { | 
|---|
| 980 | lpoTempNew->lpoNext=lpoTemp->lpoNext; | 
|---|
| 981 | lpoTemp->lpoNext=lpoTempNew; | 
|---|
| 982 | } | 
|---|
| 983 | else { | 
|---|
| 984 | lpoTempNew->lpoNext=lpoObjectList; | 
|---|
| 985 | lpoObjectList=lpoTempNew; | 
|---|
| 986 | } | 
|---|
| 987 | ulNumObjects++; | 
|---|
| 988 | } | 
|---|
| 989 | } | 
|---|
| 990 | } | 
|---|
| 991 | } | 
|---|
| 992 |  | 
|---|
| 993 | lpSaveObjectList(); | 
|---|
| 994 | lpRefreshLaunchPad(); | 
|---|
| 995 |  | 
|---|
| 996 | return TRUE; | 
|---|
| 997 | } | 
|---|
| 998 |  | 
|---|
| 999 |  | 
|---|
| 1000 | BOOL launchPad::lpSaveObjectList() | 
|---|
| 1001 | { | 
|---|
| 1002 | SOMClass *folderClass; | 
|---|
| 1003 | WPFolder *wpFolder; | 
|---|
| 1004 | char chrPath[CCHMAXPATH]; | 
|---|
| 1005 | ULONG ulBufferSize; | 
|---|
| 1006 | HINI hIni; | 
|---|
| 1007 | char * memPtr; | 
|---|
| 1008 | HOBJECT *hObject; | 
|---|
| 1009 | HOBJECT hObject2; | 
|---|
| 1010 | int a; | 
|---|
| 1011 | LPObject *lpoTemp; | 
|---|
| 1012 |  | 
|---|
| 1013 | /* First check the config folder */ | 
|---|
| 1014 | if((hObject2=WinQueryObject(chrConfigID))==NULLHANDLE) | 
|---|
| 1015 | { | 
|---|
| 1016 | /* Toolbar folder lost recreate it */ | 
|---|
| 1017 | if(!SysCheckFileExists(chrConfigTarget)) | 
|---|
| 1018 | return FALSE; /* No install dir defined */ | 
|---|
| 1019 |  | 
|---|
| 1020 | sprintf(chrPath,"OBJECTID=%s",chrConfigID); | 
|---|
| 1021 | if((hObject2=WinCreateObject("WPFolder", chrConfigID, chrPath,chrConfigTarget,CO_FAILIFEXISTS))==NULLHANDLE) | 
|---|
| 1022 | return FALSE; /* Can't create new toolbar folder */ | 
|---|
| 1023 | } | 
|---|
| 1024 |  | 
|---|
| 1025 | /* Get toolbar folder */ | 
|---|
| 1026 | if(somIsObj(wpParentFolder)) { | 
|---|
| 1027 | folderClass=wpParentFolder->somGetClass(); | 
|---|
| 1028 | if(somIsObj(folderClass)) | 
|---|
| 1029 | wpFolder=(WPFolder*)((M_WPFolder*)folderClass)->wpclsQueryFolder(chrConfigID, FALSE); | 
|---|
| 1030 | if(!somIsObj(wpFolder)) | 
|---|
| 1031 | return FALSE; | 
|---|
| 1032 | } | 
|---|
| 1033 | else | 
|---|
| 1034 | return FALSE; | 
|---|
| 1035 |  | 
|---|
| 1036 | // Fixme see line 1106 | 
|---|
| 1037 | ulBufferSize=sizeof(chrPath); | 
|---|
| 1038 | wpFolder->wpQueryRealName(chrPath, &ulBufferSize, TRUE); | 
|---|
| 1039 | strcat(chrPath,"\\objects.ini");/* Ini-File containing the hobjects */ | 
|---|
| 1040 |  | 
|---|
| 1041 | //  WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, chrPath, "~launchPad", 123, MB_OK| MB_MOVEABLE); | 
|---|
| 1042 | do{ | 
|---|
| 1043 | /* Open the ini-file */ | 
|---|
| 1044 | if((hIni=PrfOpenProfile(WinQueryAnchorBlock(HWND_DESKTOP),chrPath))==NULLHANDLE) | 
|---|
| 1045 | break; | 
|---|
| 1046 |  | 
|---|
| 1047 | if((memPtr=(char*)malloc(ulNumObjects*sizeof(HOBJECT)))==NULL) | 
|---|
| 1048 | break; | 
|---|
| 1049 |  | 
|---|
| 1050 |  | 
|---|
| 1051 | hObject=(HOBJECT*)memPtr; | 
|---|
| 1052 |  | 
|---|
| 1053 | lpoTemp=lpoObjectList; | 
|---|
| 1054 | for(a=ulNumObjects;a>0 && lpoTemp; a--) | 
|---|
| 1055 | { | 
|---|
| 1056 | hObject[a-1]=lpoTemp->hObject; | 
|---|
| 1057 | lpoTemp=lpoTemp->lpoNext; | 
|---|
| 1058 | } | 
|---|
| 1059 |  | 
|---|
| 1060 | if(!PrfWriteProfileData(hIni,"objects","handles", hObject, ulNumObjects*sizeof(HOBJECT))) { | 
|---|
| 1061 | free(hObject); | 
|---|
| 1062 | break; | 
|---|
| 1063 | } | 
|---|
| 1064 |  | 
|---|
| 1065 | free(hObject); | 
|---|
| 1066 |  | 
|---|
| 1067 | PrfCloseProfile(hIni); | 
|---|
| 1068 | return TRUE; | 
|---|
| 1069 | }while(TRUE); | 
|---|
| 1070 |  | 
|---|
| 1071 | if(hIni) | 
|---|
| 1072 | PrfCloseProfile(hIni); | 
|---|
| 1073 | return FALSE; | 
|---|
| 1074 | } | 
|---|
| 1075 |  | 
|---|
| 1076 | BOOL launchPad::lpReBuildObjectList() | 
|---|
| 1077 | { | 
|---|
| 1078 | return lpBuildObjectList( chrConfigID); | 
|---|
| 1079 | } | 
|---|
| 1080 |  | 
|---|
| 1081 | BOOL launchPad::lpBuildObjectList(char * chrFolderID) | 
|---|
| 1082 | { | 
|---|
| 1083 | WPObject* wpObject; | 
|---|
| 1084 |  | 
|---|
| 1085 | char chrText[200]; | 
|---|
| 1086 | ULONG ul; | 
|---|
| 1087 |  | 
|---|
| 1088 | SOMClass *folderClass; | 
|---|
| 1089 | WPFolder *wpFolder; | 
|---|
| 1090 | char chrPath[CCHMAXPATH]; | 
|---|
| 1091 | ULONG ulBufferSize; | 
|---|
| 1092 | HINI hIni; | 
|---|
| 1093 | char * memPtr; | 
|---|
| 1094 | HOBJECT *hObjectArray; | 
|---|
| 1095 | int a; | 
|---|
| 1096 | LPObject *lpoTemp; | 
|---|
| 1097 | WPObject * wpTempObject; | 
|---|
| 1098 |  | 
|---|
| 1099 |  | 
|---|
| 1100 | /* Get toolbar folder */ | 
|---|
| 1101 | if(somIsObj(wpParentFolder)) { | 
|---|
| 1102 | folderClass=wpParentFolder->somGetClass(); | 
|---|
| 1103 | if(somIsObj(folderClass)) | 
|---|
| 1104 | wpFolder=(WPFolder*)((M_WPFolder*)folderClass)->wpclsQueryFolder(chrFolderID, FALSE); | 
|---|
| 1105 | if(!somIsObj(wpFolder)) | 
|---|
| 1106 | return FALSE; | 
|---|
| 1107 | } | 
|---|
| 1108 | else | 
|---|
| 1109 | return FALSE; | 
|---|
| 1110 | // Fixme wpFolder can be uninittailized if(somIsObj(wpParentFolder)) is false sould we return FALSE | 
|---|
| 1111 | /* Build ini name */ | 
|---|
| 1112 | ulBufferSize=sizeof(chrPath); | 
|---|
| 1113 | wpFolder->wpQueryRealName(chrPath, &ulBufferSize, TRUE); | 
|---|
| 1114 | strcat(chrPath,"\\objects.ini");/* Ini-File containing the hobjects */ | 
|---|
| 1115 |  | 
|---|
| 1116 | do{ | 
|---|
| 1117 | /* Open the ini-file */ | 
|---|
| 1118 | if((hIni=PrfOpenProfile(WinQueryAnchorBlock(HWND_DESKTOP),chrPath))==NULLHANDLE) | 
|---|
| 1119 | break; | 
|---|
| 1120 |  | 
|---|
| 1121 | if(!PrfQueryProfileSize(hIni,"objects","handles", &ulBufferSize)) | 
|---|
| 1122 | break; | 
|---|
| 1123 |  | 
|---|
| 1124 | if(ulBufferSize==0) | 
|---|
| 1125 | break;/* No entries yet */ | 
|---|
| 1126 |  | 
|---|
| 1127 | if((memPtr=(char*)malloc(ulBufferSize))==NULL) | 
|---|
| 1128 | break; | 
|---|
| 1129 |  | 
|---|
| 1130 | ulNumObjects=ulBufferSize/sizeof(HOBJECT); | 
|---|
| 1131 |  | 
|---|
| 1132 | if(!PrfQueryProfileData(hIni,"objects","handles", memPtr, &ulBufferSize)){ | 
|---|
| 1133 | free(memPtr); | 
|---|
| 1134 | break; | 
|---|
| 1135 | } | 
|---|
| 1136 |  | 
|---|
| 1137 | hObjectArray=(HOBJECT*)memPtr; | 
|---|
| 1138 | ulBufferSize=ulNumObjects; | 
|---|
| 1139 | for(a=0;a<ulBufferSize && lpoTemp; a++) | 
|---|
| 1140 | { | 
|---|
| 1141 | wpTempObject=((M_WPObject*)folderClass)->wpclsQueryObject(hObjectArray[a]); | 
|---|
| 1142 | if(somIsObj(wpTempObject)) { | 
|---|
| 1143 | if((lpoTemp=new LPObject(wpTempObject->wpQueryIcon()))!=NULL) { | 
|---|
| 1144 | lpoTemp->wpObject=wpTempObject; | 
|---|
| 1145 | wpTempObject->wpLockObject(); | 
|---|
| 1146 | lpoTemp->hObject=hObjectArray[a]; | 
|---|
| 1147 | //            lpoTemp->hPtr=wpTempObject->wpQueryIcon(); | 
|---|
| 1148 | /* Title of the object */ | 
|---|
| 1149 | strncpy(lpoTemp->chrName, wpTempObject->wpQueryTitle(),sizeof(lpoTemp->chrName)); | 
|---|
| 1150 | lpoTemp->lpParent=this; | 
|---|
| 1151 |  | 
|---|
| 1152 | lpoTemp->lpoNext=lpoObjectList; | 
|---|
| 1153 | lpoObjectList=lpoTemp; | 
|---|
| 1154 | } | 
|---|
| 1155 | } | 
|---|
| 1156 | else { | 
|---|
| 1157 | ulNumObjects--; | 
|---|
| 1158 | } | 
|---|
| 1159 | }/* for */ | 
|---|
| 1160 |  | 
|---|
| 1161 | free(hObjectArray); | 
|---|
| 1162 |  | 
|---|
| 1163 | PrfCloseProfile(hIni); | 
|---|
| 1164 | return TRUE; | 
|---|
| 1165 | }while(TRUE); | 
|---|
| 1166 |  | 
|---|
| 1167 | if(hIni) | 
|---|
| 1168 | PrfCloseProfile(hIni); | 
|---|
| 1169 | return FALSE; | 
|---|
| 1170 |  | 
|---|
| 1171 | } | 
|---|
| 1172 |  | 
|---|
| 1173 | void launchPad::lpFreeObjectList() | 
|---|
| 1174 | { | 
|---|
| 1175 | LPObject *lpoTemp, *lpoTemp2; | 
|---|
| 1176 |  | 
|---|
| 1177 | /* Free our object list */ | 
|---|
| 1178 | lpoTemp=lpoObjectList; | 
|---|
| 1179 | while(lpoTemp) { | 
|---|
| 1180 | lpoTemp2=lpoTemp->lpoNext; | 
|---|
| 1181 | lpoTemp->wpObject->wpUnlockObject(); | 
|---|
| 1182 | delete (lpoTemp); | 
|---|
| 1183 | lpoTemp=lpoTemp2; | 
|---|
| 1184 | } | 
|---|
| 1185 | lpoObjectList=NULL; | 
|---|
| 1186 | } | 
|---|
| 1187 |  | 
|---|
| 1188 | BOOL launchPad::lpClearPad() | 
|---|
| 1189 | { | 
|---|
| 1190 | LPObject *lpoTemp, *lpoTemp2; | 
|---|
| 1191 | int a; | 
|---|
| 1192 | HENUM hEnum; | 
|---|
| 1193 | HWND hwnd; | 
|---|
| 1194 |  | 
|---|
| 1195 | /* Destroy all Buttons */ | 
|---|
| 1196 | hEnum=WinBeginEnumWindows(hwndLaunchPad); | 
|---|
| 1197 | while((hwnd=WinGetNextWindow(hEnum))!=NULLHANDLE) | 
|---|
| 1198 | WinDestroyWindow(hwnd); | 
|---|
| 1199 | WinEndEnumWindows(hEnum); | 
|---|
| 1200 |  | 
|---|
| 1201 | return TRUE; | 
|---|
| 1202 | } | 
|---|
| 1203 |  | 
|---|
| 1204 |  | 
|---|
| 1205 | BOOL launchPad::lpFillPad() | 
|---|
| 1206 | { | 
|---|
| 1207 | HOBJECT hObject; | 
|---|
| 1208 | char chrSetup[CCHMAXPATH]; | 
|---|
| 1209 | WPFolder* wpFolder; | 
|---|
| 1210 | LPObject *lpoTemp; | 
|---|
| 1211 |  | 
|---|
| 1212 | SWP swp; | 
|---|
| 1213 | HWND hwndTemp; | 
|---|
| 1214 | BTNCDATA btCtrl; | 
|---|
| 1215 | WNDPARAMS wndParams; | 
|---|
| 1216 | ULONG ulStyle; | 
|---|
| 1217 | int a; | 
|---|
| 1218 | LONG lXSize; | 
|---|
| 1219 | HENUM hEnum; | 
|---|
| 1220 | HWND hwndClient; | 
|---|
| 1221 | LONG lCxSave; | 
|---|
| 1222 |  | 
|---|
| 1223 | /* Remove Buttons from pad */ | 
|---|
| 1224 | lpClearPad(); | 
|---|
| 1225 |  | 
|---|
| 1226 | /* Resize the pad for all objects */ | 
|---|
| 1227 | if(!WinQueryWindowPos(hwndLaunchPad, &swp)) | 
|---|
| 1228 | return FALSE; | 
|---|
| 1229 |  | 
|---|
| 1230 |  | 
|---|
| 1231 | lCxSave=swp.cx; | 
|---|
| 1232 |  | 
|---|
| 1233 | lXSize=(ulNumObjects == 0 ? swp.cy : (ulNumObjects) * (swp.cy+xButtonDelta) +2*xButtonOffset); | 
|---|
| 1234 | lpSetLaunchPadPos( NULLHANDLE,0,0, lXSize , swp.cy, SWP_SIZE); | 
|---|
| 1235 |  | 
|---|
| 1236 | /* Move all controls on the right */ | 
|---|
| 1237 | /* Move all client windows so they keep their distance to the left border */ | 
|---|
| 1238 | hEnum=WinBeginEnumWindows(WinQueryWindow(hwndLaunchPad,QW_PARENT)); | 
|---|
| 1239 | while((hwndClient=WinGetNextWindow(hEnum))!=NULLHANDLE) { | 
|---|
| 1240 | SWP swpClient; | 
|---|
| 1241 |  | 
|---|
| 1242 | WinQueryWindowPos(hwndClient,&swpClient); | 
|---|
| 1243 | if(swpClient.x > swp.x) | 
|---|
| 1244 | WinSetWindowPos(hwndClient, NULLHANDLE, swpClient.x+(lXSize-lCxSave), swpClient.y, 0, 0, SWP_MOVE); | 
|---|
| 1245 | }/* while */ | 
|---|
| 1246 | WinEndEnumWindows(hEnum); | 
|---|
| 1247 |  | 
|---|
| 1248 | lpoTemp=lpoObjectList; | 
|---|
| 1249 | for(a=ulNumObjects;a>0 && lpoTemp; a--) | 
|---|
| 1250 | { | 
|---|
| 1251 | /* Create Buttons */ | 
|---|
| 1252 | if((hwndTemp=WinCreateWindow(hwndLaunchPad, WC_BUTTON, lpoTemp->chrName, WS_VISIBLE, xButtonOffset+(a-1)*(swp.cy+xButtonDelta), 1, swp.cy-2, swp.cy-2, | 
|---|
| 1253 | hwndLaunchPad, HWND_TOP, a*100, | 
|---|
| 1254 | NULLHANDLE, NULLHANDLE))!=NULLHANDLE) | 
|---|
| 1255 | { | 
|---|
| 1256 | /* Change Style to mini icon */ | 
|---|
| 1257 | ulStyle=WinQueryWindowULong(hwndTemp,QWL_STYLE); | 
|---|
| 1258 | ulStyle|=(BS_MINIICON); | 
|---|
| 1259 | ulStyle&=~BS_TEXT; | 
|---|
| 1260 | if(WinSetWindowULong(hwndTemp,QWL_STYLE,ulStyle)) { | 
|---|
| 1261 | memset(&btCtrl,0,sizeof(btCtrl)); | 
|---|
| 1262 | btCtrl.cb=sizeof(btCtrl); | 
|---|
| 1263 | btCtrl.hImage=lpoTemp->hPtr; | 
|---|
| 1264 | memset(&wndParams,0,sizeof(wndParams)); | 
|---|
| 1265 | wndParams.fsStatus=WPM_CTLDATA; | 
|---|
| 1266 | wndParams.cbCtlData=btCtrl.cb; | 
|---|
| 1267 | wndParams.pCtlData=&btCtrl; | 
|---|
| 1268 | WinSendMsg(hwndTemp,WM_SETWINDOWPARAMS, | 
|---|
| 1269 | MPFROMP(&wndParams),0); | 
|---|
| 1270 | /* Subclass button for flyover help */ | 
|---|
| 1271 | oldButtonProc2=WinSubclassWindow(hwndTemp, newLaunchPadButtonProc); | 
|---|
| 1272 | /* Set the class pointer into the window words */ | 
|---|
| 1273 | WinSetWindowULong(hwndTemp,QWL_USER,(ULONG)lpoTemp);//Save object ptr. | 
|---|
| 1274 | } | 
|---|
| 1275 | } | 
|---|
| 1276 | lpoTemp=lpoTemp->lpoNext; | 
|---|
| 1277 | } | 
|---|
| 1278 | return TRUE; | 
|---|
| 1279 | } | 
|---|
| 1280 |  | 
|---|
| 1281 |  | 
|---|
| 1282 |  | 
|---|