[33] | 1 |
|
---|
| 2 | /***********************************************************************
|
---|
| 3 |
|
---|
| 4 | $Id: mainwnd.c 101 2004-05-21 16:37:29Z root $
|
---|
| 5 |
|
---|
| 6 | Main window
|
---|
| 7 |
|
---|
| 8 | Copyright (c) 1993-98 M. Kimes
|
---|
| 9 | Copyright (c) 2001, 2002 Steven H.Levine
|
---|
| 10 |
|
---|
| 11 | Revisions 11 Jun 02 SHL - Drop obsolete xor code
|
---|
[36] | 12 | 16 Oct 02 SHL - Handle large partitions
|
---|
[33] | 13 |
|
---|
| 14 | ***********************************************************************/
|
---|
| 15 |
|
---|
[2] | 16 | #define INCL_DOS
|
---|
| 17 | #define INCL_WIN
|
---|
| 18 | #define INCL_WINHELP
|
---|
| 19 | #define INCL_GPI
|
---|
| 20 |
|
---|
| 21 | #include <os2.h>
|
---|
| 22 | #include <stdarg.h>
|
---|
| 23 | #include <stdio.h>
|
---|
| 24 | #include <stdlib.h>
|
---|
| 25 | #include <string.h>
|
---|
| 26 | #include <ctype.h>
|
---|
| 27 | #include <share.h>
|
---|
| 28 | #include "fm3dll.h"
|
---|
| 29 | #include "fm3dlg.h"
|
---|
| 30 | #include "fm3str.h"
|
---|
| 31 | #include "tools.h"
|
---|
[33] | 32 | // #include "xor.h" // SHL
|
---|
[2] | 33 |
|
---|
| 34 | #pragma data_seg(DATA1)
|
---|
| 35 | #pragma alloc_text(MISC8,SetToggleChecks,FindDirCnrByName,TopWindow)
|
---|
| 36 | #pragma alloc_text(MISC8,TopWindowName,CountDirCnrs)
|
---|
| 37 | #pragma alloc_text(MAINWND,AdjustSizeOfClient,FillClient,ChildButtonProc)
|
---|
| 38 | #pragma alloc_text(MAINWND,ToolBackProc,StatusProc)
|
---|
| 39 | #pragma alloc_text(MAINWND,MoveChildrenAwayFromTree,ArrangeIcons,NextChild)
|
---|
| 40 | #pragma alloc_text(MAINWND,ChildFrameButtonProc)
|
---|
| 41 | #pragma alloc_text(MAINWND2,CloseChildren,CountChildren,GetNextWindowPos)
|
---|
| 42 | #pragma alloc_text(MAINWND2,CascadeChildren,TileChildren,ResizeChildren)
|
---|
| 43 | #pragma alloc_text(MAINWND2,MinResChildren,MainFrameWndProc,MainWndProc)
|
---|
| 44 | #pragma alloc_text(MAINWND2,DropDownListProc)
|
---|
| 45 | #pragma alloc_text(MAINWND3,RestoreDirCnrState,SaveDirCnrState)
|
---|
| 46 | #pragma alloc_text(MAINWND3,CloseDirCnrChildren,TransformSwp)
|
---|
| 47 | #pragma alloc_text(MAINWND3,ResizeTools,BuildTools,CommandLineProc)
|
---|
| 48 | #pragma alloc_text(MAINWND4,DriveProc,DriveBackProc,BuildDrives,ResizeDrives)
|
---|
| 49 | #pragma alloc_text(MAINWND4,LEDProc,IdealButtonProc)
|
---|
| 50 | #pragma alloc_text(MAINWND5,MainWMOnce)
|
---|
| 51 | #pragma alloc_text(MAINWND6,MainWMCommand)
|
---|
| 52 | #pragma alloc_text(BUBBLE,MakeBubble,BubbleProc,BubbleHelp)
|
---|
| 53 | #pragma alloc_text(MAINOBJ,MainObjectWndProc,MakeMainObjWin)
|
---|
| 54 |
|
---|
| 55 | extern TOOL *toolhead;
|
---|
| 56 |
|
---|
[33] | 57 | USHORT firsttool = 0;
|
---|
[2] | 58 |
|
---|
[33] | 59 |
|
---|
[36] | 60 | MRESULT EXPENTRY MainObjectWndProc (HWND hwnd,ULONG msg,MPARAM mp1, MPARAM mp2) {
|
---|
[2] | 61 |
|
---|
| 62 | switch(msg) {
|
---|
| 63 | case UM_SETUP:
|
---|
| 64 | case UM_SETUP2:
|
---|
| 65 | case UM_SETUP3:
|
---|
| 66 | case UM_SETUP4:
|
---|
| 67 | case UM_SETUP5:
|
---|
| 68 | /*
|
---|
| 69 | * feed setup messages to main window
|
---|
| 70 | */
|
---|
| 71 | PostMsg(hwndMain,msg,mp1,mp2);
|
---|
| 72 | return 0;
|
---|
| 73 |
|
---|
| 74 | case UM_SETUP6:
|
---|
| 75 | /*
|
---|
| 76 | * handle bubble help requests from drive bar buttons
|
---|
| 77 | */
|
---|
| 78 | {
|
---|
| 79 | char dv[3],d;
|
---|
| 80 | HWND hwndB = (HWND)mp1;
|
---|
| 81 | USHORT id;
|
---|
| 82 |
|
---|
| 83 | id = WinQueryWindowUShort(hwndB,QWS_ID);
|
---|
| 84 | *dv = 0;
|
---|
| 85 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwndB,QW_PARENT),
|
---|
| 86 | id + 50),
|
---|
| 87 | sizeof(dv),
|
---|
| 88 | dv);
|
---|
| 89 | d = toupper(*dv);
|
---|
| 90 | if(isalpha(d) && d > 'B' &&
|
---|
| 91 | !(driveflags[d - 'A'] & (DRIVE_CDROM | DRIVE_INVALID |
|
---|
| 92 | DRIVE_SLOW)) &&
|
---|
| 93 | (!hwndBubble ||
|
---|
| 94 | WinQueryWindowULong(hwndBubble,0) != hwndB) &&
|
---|
| 95 | !WinQueryCapture(HWND_DESKTOP)) {
|
---|
| 96 |
|
---|
| 97 | FSALLOCATE fsa;
|
---|
[36] | 98 | CHAR s[90],szQty[38],*pszUM;
|
---|
| 99 | ULONG ulPctFree;
|
---|
| 100 | float fltFreeQty;
|
---|
[2] | 101 |
|
---|
| 102 | if(!DosQueryFSInfo((d - 'A') + 1,
|
---|
| 103 | FSIL_ALLOC,
|
---|
| 104 | &fsa,
|
---|
| 105 | sizeof(FSALLOCATE))) {
|
---|
[36] | 106 | fltFreeQty = (float)fsa.cUnitAvail *
|
---|
| 107 | (fsa.cSectorUnit * fsa.cbSector);
|
---|
| 108 | if(fltFreeQty >= (1024 * 1024)) {
|
---|
| 109 | fltFreeQty /= (1024 * 1024);
|
---|
| 110 | pszUM = "mb";
|
---|
[2] | 111 | }
|
---|
[36] | 112 | else if(fltFreeQty >= 1024) {
|
---|
| 113 | fltFreeQty /= 1024;
|
---|
| 114 | pszUM = "kb";
|
---|
[2] | 115 | }
|
---|
| 116 | else
|
---|
[36] | 117 | pszUM = "b";
|
---|
| 118 | ulPctFree = (fsa.cUnit && fsa.cUnitAvail) ?
|
---|
| 119 | (fsa.cUnitAvail * 100) / fsa.cUnit : 0;
|
---|
| 120 | commafmt(szQty,
|
---|
| 121 | sizeof(szQty),
|
---|
| 122 | (ULONG)fltFreeQty);
|
---|
[2] | 123 | sprintf(s,
|
---|
| 124 | "%s%s (%lu%%) free",
|
---|
[36] | 125 | szQty,
|
---|
| 126 | pszUM,
|
---|
| 127 | ulPctFree);
|
---|
[2] | 128 | }
|
---|
| 129 | if((!hwndBubble ||
|
---|
| 130 | WinQueryWindowULong(hwndBubble,0) != hwndB) &&
|
---|
| 131 | !WinQueryCapture(HWND_DESKTOP))
|
---|
| 132 | WinSendMsg(hwndB,
|
---|
| 133 | UM_SETUP6,
|
---|
| 134 | MPFROMP(s),
|
---|
| 135 | MPVOID);
|
---|
| 136 | }
|
---|
| 137 | }
|
---|
| 138 | return 0;
|
---|
| 139 |
|
---|
| 140 | case UM_SETDIR:
|
---|
| 141 | {
|
---|
| 142 | CHAR s[8] = " :\\OS2";
|
---|
| 143 | ULONG bd;
|
---|
| 144 |
|
---|
[69] | 145 | if(DosQuerySysInfo(QSV_BOOT_DRIVE,
|
---|
| 146 | QSV_BOOT_DRIVE,
|
---|
| 147 | (PVOID)&bd,
|
---|
| 148 | (ULONG)sizeof(ULONG)))
|
---|
| 149 | bd = 3L;
|
---|
| 150 | *s = (CHAR)bd + '@';
|
---|
| 151 | WinSendMsg(hwndMain,
|
---|
| 152 | UM_SETDIR,
|
---|
| 153 | MPFROMP(s),
|
---|
| 154 | MPFROMLONG(1L));
|
---|
| 155 | if(!mp1) {
|
---|
| 156 | s[3] = 0;
|
---|
| 157 | WinSendMsg(hwndMain,
|
---|
| 158 | UM_SETDIR,
|
---|
| 159 | MPFROMP(s),
|
---|
| 160 | MPVOID);
|
---|
| 161 | }
|
---|
| 162 | PostMsg(MainObjectHwnd,
|
---|
| 163 | UM_RESTORE,
|
---|
| 164 | MPFROMLONG(1L),
|
---|
| 165 | MPFROMLONG(1L));
|
---|
[2] | 166 | }
|
---|
| 167 | return 0;
|
---|
| 168 |
|
---|
| 169 | case UM_RESTORE:
|
---|
| 170 | if(mp2) {
|
---|
| 171 | switch((ULONG)mp2) {
|
---|
| 172 | case 1:
|
---|
| 173 | TileChildren(hwndMain,TRUE);
|
---|
| 174 | break;
|
---|
| 175 | case 2:
|
---|
| 176 | CloseDirCnrChildren(hwndMain);
|
---|
| 177 | break;
|
---|
| 178 | }
|
---|
| 179 | }
|
---|
| 180 | else {
|
---|
| 181 | fNoTileUpdate = TRUE;
|
---|
| 182 | WinEnableWindow(WinQueryWindow(hwndMain,QW_PARENT),FALSE);
|
---|
| 183 | RestoreDirCnrState(hwndMain,(char *)mp1,FALSE);
|
---|
| 184 | WinEnableWindow(WinQueryWindow(hwndMain,QW_PARENT),TRUE);
|
---|
| 185 | fNoTileUpdate = FALSE;
|
---|
| 186 | if(mp1)
|
---|
| 187 | free((char *)mp1);
|
---|
| 188 | if(fAutoTile)
|
---|
| 189 | TileChildren(hwndMain,TRUE);
|
---|
| 190 | }
|
---|
| 191 | return 0;
|
---|
| 192 |
|
---|
| 193 | case UM_NOTIFY:
|
---|
| 194 | /*
|
---|
| 195 | * bring up notify messages for various windows
|
---|
| 196 | */
|
---|
| 197 | if(mp1)
|
---|
| 198 | return MRFROMLONG(DoNotify((char *)mp1));
|
---|
| 199 | return 0;
|
---|
| 200 |
|
---|
| 201 | case WM_DESTROY:
|
---|
| 202 | if(!PostMsg((HWND)0,WM_QUIT,MPVOID,MPVOID))
|
---|
| 203 | WinSendMsg((HWND)0,WM_QUIT,MPVOID,MPVOID);
|
---|
| 204 | break;
|
---|
| 205 | }
|
---|
| 206 | return WinDefWindowProc(hwnd,msg,mp1,mp2);
|
---|
| 207 | }
|
---|
| 208 |
|
---|
| 209 |
|
---|
| 210 | VOID MakeMainObjWin (VOID *args) {
|
---|
| 211 |
|
---|
[36] | 212 | HAB hab2;
|
---|
| 213 | HMQ hmq2;
|
---|
[2] | 214 | QMSG qmsg2;
|
---|
| 215 |
|
---|
| 216 | priority_bumped();
|
---|
| 217 | hab2 = WinInitialize(0);
|
---|
| 218 | if(hab2) {
|
---|
| 219 | hmq2 = WinCreateMsgQueue(hab2,128);
|
---|
| 220 | if(hmq2) {
|
---|
| 221 | DosError(FERR_DISABLEHARDERR);
|
---|
[69] | 222 | WinRegisterClass(hab2,
|
---|
| 223 | GetPString(IDS_WCOBJECTWINDOW),
|
---|
| 224 | MainObjectWndProc,
|
---|
| 225 | 0,
|
---|
| 226 | sizeof(PVOID));
|
---|
[2] | 227 | MainObjectHwnd = WinCreateWindow(HWND_OBJECT,
|
---|
| 228 | GetPString(IDS_WCOBJECTWINDOW),
|
---|
| 229 | (PSZ)NULL,
|
---|
| 230 | 0,
|
---|
| 231 | 0L,
|
---|
| 232 | 0L,
|
---|
| 233 | 0L,
|
---|
| 234 | 0L,
|
---|
| 235 | 0L,
|
---|
[69] | 236 | HWND_TOP,
|
---|
| 237 | OBJ_FRAME,
|
---|
[2] | 238 | NULL,
|
---|
| 239 | NULL);
|
---|
| 240 | if(MainObjectHwnd) {
|
---|
| 241 | WinSetWindowPtr(MainObjectHwnd,0,args);
|
---|
| 242 | while(WinGetMsg(hab2,&qmsg2,(HWND)0,0,0))
|
---|
| 243 | WinDispatchMsg(hab2,&qmsg2);
|
---|
| 244 | WinDestroyWindow(MainObjectHwnd);
|
---|
| 245 | }
|
---|
| 246 | WinDestroyMsgQueue(hmq2);
|
---|
| 247 | }
|
---|
| 248 | WinTerminate(hab2);
|
---|
| 249 | }
|
---|
| 250 | }
|
---|
| 251 |
|
---|
| 252 |
|
---|
| 253 | MRESULT EXPENTRY IdealButtonProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
| 254 |
|
---|
| 255 | switch(msg) {
|
---|
| 256 | case WM_MOUSEMOVE:
|
---|
| 257 | BubbleHelp(hwnd,
|
---|
| 258 | TRUE,
|
---|
| 259 | FALSE,
|
---|
| 260 | FALSE,
|
---|
| 261 | GetPString(IDS_IDEALBUTTONHELP));
|
---|
| 262 | break;
|
---|
| 263 | }
|
---|
| 264 | return PFNWPButton(hwnd,msg,mp1,mp2);
|
---|
| 265 | }
|
---|
| 266 |
|
---|
| 267 |
|
---|
| 268 | HWND TopWindow (HWND hwndParent,HWND exclude) {
|
---|
| 269 |
|
---|
| 270 | HENUM henum;
|
---|
| 271 | HWND hwndC = (HWND)0;
|
---|
| 272 | USHORT id;
|
---|
| 273 |
|
---|
| 274 | if(hwndParent) {
|
---|
| 275 | henum = WinBeginEnumWindows(hwndMain);
|
---|
| 276 | while((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
| 277 | if(hwndC != exclude) {
|
---|
| 278 | id = WinQueryWindowUShort(hwndC,QWS_ID);
|
---|
| 279 | if(id)
|
---|
| 280 | break;
|
---|
| 281 | }
|
---|
| 282 | }
|
---|
| 283 | WinEndEnumWindows(henum);
|
---|
| 284 | }
|
---|
| 285 | return hwndC;
|
---|
| 286 | }
|
---|
| 287 |
|
---|
| 288 |
|
---|
| 289 | HWND TopWindowName (HWND hwndParent,HWND exclude,CHAR *ret) {
|
---|
| 290 |
|
---|
[36] | 291 | HENUM henum;
|
---|
| 292 | HWND hwndC = (HWND)0,hwndDir,hwndClient;
|
---|
[2] | 293 | USHORT id;
|
---|
| 294 | PCNRITEM pci = NULL;
|
---|
| 295 |
|
---|
| 296 | if(ret) {
|
---|
| 297 | *ret = 0;
|
---|
| 298 | if(hwndParent) {
|
---|
| 299 | henum = WinBeginEnumWindows(hwndMain);
|
---|
| 300 | while((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
| 301 | // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu",hwndTree,exclude,hwndC);
|
---|
| 302 | if(hwndC != exclude &&
|
---|
| 303 | hwndC != hwndTree) {
|
---|
| 304 | id = WinQueryWindowUShort(hwndC,QWS_ID);
|
---|
| 305 | if(id) {
|
---|
| 306 | hwndClient = WinWindowFromID(hwndC,FID_CLIENT);
|
---|
| 307 | if(hwndClient) {
|
---|
| 308 | hwndDir = WinWindowFromID(hwndClient,DIR_CNR);
|
---|
| 309 | if(hwndDir) {
|
---|
| 310 | if(fLookInDir) {
|
---|
| 311 | pci = (PCNRITEM)WinSendMsg(hwndDir,
|
---|
| 312 | CM_QUERYRECORDEMPHASIS,
|
---|
| 313 | MPFROMLONG(CMA_FIRST),
|
---|
| 314 | MPFROMSHORT(CRA_CURSORED));
|
---|
| 315 | if(pci &&
|
---|
| 316 | (INT)pci != -1)
|
---|
| 317 | break;
|
---|
| 318 | }
|
---|
| 319 | if(WinSendMsg(hwndClient,
|
---|
| 320 | UM_CONTAINERDIR,
|
---|
| 321 | MPFROMP(ret),
|
---|
| 322 | MPVOID)) {
|
---|
| 323 | MakeValidDir(ret);
|
---|
| 324 | // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu\r\"%s\"",hwndTree,exclude,hwndC,ret);
|
---|
| 325 | WinEndEnumWindows(henum);
|
---|
| 326 | return hwndC;
|
---|
| 327 | }
|
---|
| 328 | }
|
---|
| 329 | }
|
---|
| 330 | }
|
---|
| 331 | }
|
---|
| 332 | }
|
---|
| 333 | WinEndEnumWindows(henum);
|
---|
| 334 | if(!pci ||
|
---|
| 335 | (INT)pci == -1) {
|
---|
| 336 | hwndC = hwndTree;
|
---|
| 337 | pci = (PCNRITEM)WinSendMsg(WinWindowFromID(WinWindowFromID(
|
---|
[69] | 338 | hwndTree,
|
---|
| 339 | FID_CLIENT),
|
---|
| 340 | TREE_CNR),
|
---|
| 341 | CM_QUERYRECORDEMPHASIS,
|
---|
| 342 | MPFROMLONG(CMA_FIRST),
|
---|
| 343 | MPFROMSHORT(CRA_CURSORED));
|
---|
[2] | 344 | }
|
---|
| 345 | if(pci &&
|
---|
| 346 | (INT)pci != -1) {
|
---|
| 347 | strcpy(ret,pci->szFileName);
|
---|
| 348 | MakeValidDir(ret);
|
---|
| 349 | }
|
---|
| 350 | else
|
---|
| 351 | save_dir2(ret);
|
---|
| 352 | }
|
---|
| 353 | }
|
---|
| 354 | return hwndC;
|
---|
| 355 | }
|
---|
| 356 |
|
---|
| 357 |
|
---|
| 358 | ULONG CountDirCnrs (HWND hwndParent) {
|
---|
| 359 |
|
---|
| 360 | HENUM henum;
|
---|
| 361 | HWND hwndF = (HWND)0,hwndC,hwndDir;
|
---|
| 362 | ULONG ret = 0;
|
---|
| 363 |
|
---|
| 364 | henum = WinBeginEnumWindows(hwndParent);
|
---|
| 365 | while((hwndF = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
| 366 | hwndC = WinWindowFromID(hwndF,FID_CLIENT);
|
---|
| 367 | if(hwndC) {
|
---|
| 368 | hwndDir = WinWindowFromID(hwndC,DIR_CNR);
|
---|
| 369 | if(hwndDir)
|
---|
| 370 | ret++;
|
---|
| 371 | }
|
---|
| 372 | }
|
---|
| 373 | WinEndEnumWindows(henum);
|
---|
| 374 | return ret;
|
---|
| 375 | }
|
---|
| 376 |
|
---|
| 377 |
|
---|
| 378 | HWND FindDirCnrByName (CHAR *directory,BOOL restore) {
|
---|
| 379 |
|
---|
[69] | 380 | HENUM henum;
|
---|
| 381 | HWND hwndF = (HWND)0,hwndC,hwndDir;
|
---|
| 382 | CHAR retstr[CCHMAXPATH];
|
---|
[2] | 383 |
|
---|
[69] | 384 | if(hwndMain)
|
---|
| 385 | {
|
---|
| 386 | henum = WinBeginEnumWindows(hwndMain);
|
---|
| 387 | while((hwndF = WinGetNextWindow(henum)) != NULLHANDLE)
|
---|
| 388 | {
|
---|
| 389 | hwndC = WinWindowFromID(hwndF,FID_CLIENT);
|
---|
| 390 | if(hwndC)
|
---|
| 391 | {
|
---|
| 392 | hwndDir = WinWindowFromID(hwndC,DIR_CNR);
|
---|
| 393 | if(hwndDir)
|
---|
| 394 | {
|
---|
| 395 | *retstr = 0;
|
---|
[2] | 396 | WinSendMsg(hwndC,
|
---|
[69] | 397 | UM_CONTAINERDIR,
|
---|
[2] | 398 | MPFROMP(retstr),
|
---|
| 399 | MPVOID);
|
---|
| 400 | if(*retstr &&
|
---|
[69] | 401 | !stricmp(retstr,directory))
|
---|
| 402 | {
|
---|
| 403 | if(restore)
|
---|
[2] | 404 | WinSetWindowPos(hwndF,
|
---|
[69] | 405 | HWND_TOP,
|
---|
| 406 | 0,
|
---|
| 407 | 0,
|
---|
| 408 | 0,
|
---|
| 409 | 0,
|
---|
| 410 | SWP_RESTORE | SWP_SHOW |
|
---|
| 411 | SWP_ACTIVATE | SWP_ZORDER);
|
---|
| 412 | break;
|
---|
| 413 | }
|
---|
| 414 | }
|
---|
| 415 | }
|
---|
| 416 | }
|
---|
| 417 | WinEndEnumWindows(henum);
|
---|
| 418 | }
|
---|
| 419 | return hwndF;
|
---|
[2] | 420 | }
|
---|
| 421 |
|
---|
| 422 |
|
---|
| 423 | VOID SetToggleChecks (HWND hwndMenu) {
|
---|
| 424 |
|
---|
| 425 | WinCheckMenuItem(hwndMenu,
|
---|
| 426 | IDM_TEXTTOOLS,
|
---|
| 427 | fTextTools);
|
---|
| 428 | WinCheckMenuItem(hwndMenu,
|
---|
| 429 | IDM_TOOLTITLES,
|
---|
| 430 | fToolTitles);
|
---|
| 431 | WinCheckMenuItem(hwndMenu,
|
---|
| 432 | IDM_USERLIST,
|
---|
| 433 | fUserComboBox);
|
---|
| 434 | WinCheckMenuItem(hwndMenu,
|
---|
| 435 | IDM_TOOLSUBMENU,
|
---|
| 436 | fToolbar);
|
---|
| 437 | WinCheckMenuItem(hwndMenu,
|
---|
| 438 | IDM_AUTOVIEWSUBMENU,
|
---|
| 439 | fAutoView);
|
---|
| 440 | WinCheckMenuItem(hwndMenu,
|
---|
| 441 | IDM_AUTOVIEWFILE,
|
---|
| 442 | !fComments);
|
---|
| 443 | WinCheckMenuItem(hwndMenu,
|
---|
| 444 | IDM_AUTOVIEWCOMMENTS,
|
---|
| 445 | fComments);
|
---|
| 446 | WinCheckMenuItem(hwndMenu,
|
---|
| 447 | IDM_MOREBUTTONS,
|
---|
| 448 | fMoreButtons);
|
---|
| 449 | WinCheckMenuItem(hwndMenu,
|
---|
| 450 | IDM_DRIVEBAR,
|
---|
| 451 | fDrivebar);
|
---|
| 452 | WinCheckMenuItem(hwndMenu,
|
---|
| 453 | IDM_AUTOTILE,
|
---|
| 454 | fAutoTile);
|
---|
| 455 | WinCheckMenuItem(hwndMenu,
|
---|
| 456 | IDM_TILEBACKWARDS,
|
---|
| 457 | fTileBackwards);
|
---|
| 458 | }
|
---|
| 459 |
|
---|
| 460 |
|
---|
| 461 | VOID ResizeTools (HWND hwnd) {
|
---|
| 462 |
|
---|
[36] | 463 | register ULONG butx = 18L;
|
---|
| 464 | INT attrib = SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER | SWP_NOREDRAW,
|
---|
| 465 | noattrib;
|
---|
| 466 | register TOOL *tool,*starttool;
|
---|
| 467 | SWP *swp;
|
---|
| 468 | register ULONG numtools,x;
|
---|
[2] | 469 |
|
---|
| 470 | if(!fToolbar)
|
---|
| 471 | return;
|
---|
| 472 | noattrib = attrib;
|
---|
| 473 | noattrib &= (~(SWP_SHOW | SWP_ZORDER));
|
---|
| 474 | noattrib |= SWP_HIDE;
|
---|
| 475 | /* count tools */
|
---|
| 476 | tool = toolhead;
|
---|
| 477 | for(numtools = 0L;tool;numtools++)
|
---|
| 478 | tool = tool->next;
|
---|
| 479 | /* allocate swp array for WinSetMultWindowPos */
|
---|
| 480 | swp = malloc(sizeof(SWP) * (numtools + 2));
|
---|
| 481 | if(swp) {
|
---|
| 482 | memset(swp,0,sizeof(SWP) * (numtools + 2));
|
---|
| 483 | for(x = 0;x < numtools + 2L;x++) {
|
---|
| 484 | swp[x].hwndInsertBehind = HWND_TOP;
|
---|
| 485 | swp[x].fl = attrib;
|
---|
| 486 | swp[x].y = (fToolTitles) ? 14L : 3L;
|
---|
| 487 | swp[x].cx = 32L;
|
---|
| 488 | swp[x].cy = 32L;
|
---|
| 489 | }
|
---|
| 490 | swp[0].x = swp[1].x = 2L;
|
---|
| 491 | swp[0].y = (fTextTools) ? 14L : 18L;
|
---|
| 492 | swp[1].y = (fTextTools) ? 1L : 2L;
|
---|
| 493 | swp[0].cx = swp[1].cx = 14L;
|
---|
| 494 | swp[0].cy = swp[1].cy = 14L;
|
---|
| 495 | swp[0].hwnd = WinWindowFromID(hwnd,IDM_TOOLLEFT);
|
---|
| 496 | swp[1].hwnd = WinWindowFromID(hwnd,IDM_TOOLRIGHT);
|
---|
| 497 | x = 2L;
|
---|
| 498 | tool = find_tool(firsttool);
|
---|
| 499 | if(!tool)
|
---|
| 500 | tool = toolhead;
|
---|
| 501 | starttool = tool;
|
---|
| 502 | while(tool) {
|
---|
| 503 | if(!(tool->flags & T_INVISIBLE)) {
|
---|
| 504 | swp[x].x = butx;
|
---|
| 505 | if(fTextTools || (tool->flags & T_TEXT)) {
|
---|
| 506 | butx += 55L;
|
---|
| 507 | swp[x].cx = 54L;
|
---|
| 508 | swp[x].cy = 24L;
|
---|
| 509 | swp[x].y = 3L;
|
---|
| 510 | }
|
---|
| 511 | else
|
---|
| 512 | butx += 33L;
|
---|
| 513 | if(tool->flags & T_SEPARATOR)
|
---|
| 514 | butx += 12;
|
---|
| 515 | }
|
---|
| 516 | else
|
---|
| 517 | swp[x].fl = noattrib;
|
---|
| 518 | swp[x].hwnd = WinWindowFromID(hwnd,tool->id);
|
---|
| 519 | x++;
|
---|
| 520 | tool = tool->next;
|
---|
| 521 | }
|
---|
| 522 | tool = toolhead;
|
---|
| 523 | while(tool && tool != starttool) {
|
---|
| 524 | swp[x].x = butx;
|
---|
| 525 | if(!(tool->flags & T_INVISIBLE)) {
|
---|
| 526 | if(fTextTools || (tool->flags & T_TEXT)) {
|
---|
| 527 | butx += 55L;
|
---|
| 528 | swp[x].cx = 54L;
|
---|
| 529 | swp[x].cy = 24L;
|
---|
| 530 | swp[x].y = 3L;
|
---|
| 531 | }
|
---|
| 532 | else
|
---|
| 533 | butx += 33L;
|
---|
| 534 | if(tool->flags & T_SEPARATOR)
|
---|
| 535 | butx += 12;
|
---|
| 536 | }
|
---|
| 537 | else
|
---|
| 538 | swp[x].fl = noattrib;
|
---|
| 539 | swp[x].hwnd = WinWindowFromID(hwnd,tool->id);
|
---|
| 540 | x++;
|
---|
| 541 | tool = tool->next;
|
---|
| 542 | }
|
---|
| 543 | WinSetMultWindowPos(WinQueryAnchorBlock(hwnd),swp,numtools + 2L);
|
---|
| 544 | if(!fTextTools && fToolTitles) {
|
---|
| 545 | for(x = 2L;x < numtools + 2L;x++) {
|
---|
| 546 | if(fTextTools || !fToolTitles)
|
---|
| 547 | swp[x].fl = noattrib;
|
---|
| 548 | else {
|
---|
| 549 | tool = find_tool(WinQueryWindowUShort(swp[x].hwnd,QWS_ID));
|
---|
| 550 | if(tool && (tool->flags & T_TEXT))
|
---|
| 551 | swp[x].fl = noattrib;
|
---|
| 552 | else {
|
---|
| 553 | swp[x].hwndInsertBehind = HWND_TOP;
|
---|
| 554 | swp[x].y = 1L;
|
---|
| 555 | swp[x].cy = 10L;
|
---|
| 556 | }
|
---|
| 557 | }
|
---|
| 558 | swp[x].hwnd = WinWindowFromID(hwnd,
|
---|
| 559 | WinQueryWindowUShort(swp[x].hwnd,QWS_ID) +
|
---|
| 560 | 25000);
|
---|
| 561 | }
|
---|
| 562 | WinSetMultWindowPos(WinQueryAnchorBlock(hwnd),&swp[2],numtools);
|
---|
| 563 | }
|
---|
| 564 | free(swp);
|
---|
| 565 | }
|
---|
| 566 | WinInvalidateRect(hwnd,NULL,TRUE);
|
---|
| 567 | }
|
---|
| 568 |
|
---|
| 569 |
|
---|
| 570 | MRESULT EXPENTRY DropDownListProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
| 571 |
|
---|
[36] | 572 | PFNWP oldproc = (PFNWP)INSTDATA(hwnd);
|
---|
| 573 | static HWND hwndMenu = (HWND)0;
|
---|
| 574 | USHORT id;
|
---|
| 575 | static BOOL emphasized = FALSE;
|
---|
[2] | 576 |
|
---|
| 577 | switch(msg) {
|
---|
| 578 | case WM_MOUSEMOVE:
|
---|
| 579 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 580 | break;
|
---|
| 581 |
|
---|
| 582 | case WM_CHAR:
|
---|
| 583 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
| 584 | break;
|
---|
| 585 |
|
---|
| 586 | case WM_MENUEND:
|
---|
| 587 | if(hwndMenu == (HWND)mp2) {
|
---|
| 588 | WinDestroyWindow(hwndMenu);
|
---|
| 589 | hwndMenu = (HWND)0;
|
---|
| 590 | }
|
---|
| 591 | break;
|
---|
| 592 |
|
---|
| 593 | case WM_CONTEXTMENU:
|
---|
| 594 | {
|
---|
| 595 | MRESULT ret = MRFROMSHORT(TRUE);
|
---|
| 596 |
|
---|
| 597 | if(hwndMenu)
|
---|
| 598 | WinDestroyWindow(hwndMenu);
|
---|
| 599 | hwndMenu = (HWND)0;
|
---|
| 600 | id = WinQueryWindowUShort(WinQueryWindow(hwnd,QW_PARENT),QWS_ID);
|
---|
| 601 | switch(id) {
|
---|
| 602 | case MAIN_CMDLIST:
|
---|
| 603 | WinPostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
---|
[69] | 604 | QW_PARENT),
|
---|
| 605 | QW_PARENT),
|
---|
| 606 | FID_CLIENT),
|
---|
| 607 | WM_COMMAND,
|
---|
| 608 | MPFROM2SHORT(IDM_EDITCOMMANDS,0),
|
---|
| 609 | MPVOID);
|
---|
[2] | 610 | break;
|
---|
| 611 | case MAIN_USERLIST:
|
---|
| 612 | case MAIN_SETUPLIST:
|
---|
| 613 | hwndMenu = WinLoadMenu(HWND_DESKTOP,FM3ModHandle,id);
|
---|
| 614 | if(hwndMenu)
|
---|
| 615 | PopupMenu(hwnd,
|
---|
[69] | 616 | WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
---|
| 617 | QW_PARENT),
|
---|
| 618 | QW_PARENT),
|
---|
| 619 | FID_CLIENT),
|
---|
| 620 | hwndMenu);
|
---|
[2] | 621 | break;
|
---|
| 622 | default:
|
---|
| 623 | ret = FALSE;
|
---|
| 624 | break;
|
---|
| 625 | }
|
---|
| 626 | return ret;
|
---|
| 627 | }
|
---|
| 628 |
|
---|
| 629 | case WM_CONTROL:
|
---|
| 630 | if(hwndStatus2) {
|
---|
| 631 | switch(SHORT1FROMMP(mp1)) {
|
---|
| 632 | case CBID_EDIT:
|
---|
| 633 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 634 | switch(SHORT2FROMMP(mp1)) {
|
---|
| 635 | case EN_SETFOCUS:
|
---|
| 636 | switch(id) {
|
---|
| 637 | case MAIN_CMDLIST:
|
---|
| 638 | WinSetWindowText(hwndStatus2,
|
---|
| 639 | GetPString(IDS_CMDLISTHELP));
|
---|
| 640 | break;
|
---|
| 641 | case MAIN_SETUPLIST:
|
---|
| 642 | WinSetWindowText(hwndStatus2,
|
---|
| 643 | GetPString(IDS_SETUPLISTHELP));
|
---|
| 644 | break;
|
---|
| 645 | case MAIN_USERLIST:
|
---|
| 646 | WinSetWindowText(hwndStatus2,
|
---|
| 647 | GetPString(IDS_USERLISTHELP));
|
---|
| 648 | break;
|
---|
| 649 | case MAIN_DRIVELIST:
|
---|
| 650 | WinSetWindowText(hwndStatus2,
|
---|
| 651 | GetPString(IDS_DRIVELISTHELP));
|
---|
| 652 | break;
|
---|
| 653 | case MAIN_BUTTONLIST:
|
---|
| 654 | WinSetWindowText(hwndStatus2,
|
---|
| 655 | GetPString(IDS_BUTTONLISTHELP));
|
---|
| 656 | break;
|
---|
| 657 | default:
|
---|
| 658 | break;
|
---|
| 659 | }
|
---|
| 660 | break;
|
---|
| 661 |
|
---|
| 662 | default:
|
---|
| 663 | break;
|
---|
| 664 | }
|
---|
| 665 | }
|
---|
| 666 | break;
|
---|
| 667 |
|
---|
| 668 | default:
|
---|
| 669 | break;
|
---|
| 670 | }
|
---|
| 671 | break;
|
---|
| 672 |
|
---|
| 673 | case WM_BEGINDRAG:
|
---|
| 674 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 675 | // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"%u %s %u",id,(id == CBID_EDIT) ? "TRUE" : "FALSE",WinQueryWindowUShort(WinQueryWindow(hwnd,QW_PARENT),QWS_ID) == MAIN_USERLIST);
|
---|
| 676 | if(id == CBID_EDIT &&
|
---|
| 677 | WinQueryWindowUShort(WinQueryWindow(hwnd,QW_PARENT),QWS_ID) ==
|
---|
| 678 | MAIN_USERLIST) {
|
---|
| 679 |
|
---|
| 680 | CHAR path[CCHMAXPATH];
|
---|
| 681 |
|
---|
| 682 | *path = 0;
|
---|
| 683 | WinQueryWindowText(hwnd,CCHMAXPATH,path);
|
---|
| 684 | lstrip(rstrip(path));
|
---|
| 685 | // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Dragging: %s",path);
|
---|
| 686 | if(*path && !IsRoot(path))
|
---|
| 687 | DragOne(hwnd,(HWND)0,path,FALSE);
|
---|
| 688 | return 0;
|
---|
| 689 | }
|
---|
| 690 | break;
|
---|
| 691 |
|
---|
| 692 | case DM_DRAGOVER:
|
---|
| 693 | id = WinQueryWindowUShort(WinQueryWindow(hwnd,QW_PARENT),QWS_ID);
|
---|
| 694 | if(id == MAIN_USERLIST) {
|
---|
| 695 | if(!emphasized) {
|
---|
| 696 | emphasized = TRUE;
|
---|
| 697 | DrawTargetEmphasis(hwnd,emphasized);
|
---|
| 698 | }
|
---|
| 699 | if(AcceptOneDrop(mp1,mp2))
|
---|
| 700 | return MRFROM2SHORT(DOR_DROP,
|
---|
| 701 | DO_MOVE);
|
---|
| 702 | return MRFROM2SHORT(DOR_NEVERDROP,0);
|
---|
| 703 | }
|
---|
| 704 | break;
|
---|
| 705 |
|
---|
| 706 | case DM_DRAGLEAVE:
|
---|
| 707 | id = WinQueryWindowUShort(WinQueryWindow(hwnd,QW_PARENT),QWS_ID);
|
---|
| 708 | if(id == MAIN_USERLIST) {
|
---|
| 709 | if(emphasized) {
|
---|
| 710 | emphasized = FALSE;
|
---|
| 711 | DrawTargetEmphasis(hwnd,emphasized);
|
---|
| 712 | }
|
---|
| 713 | }
|
---|
| 714 | break;
|
---|
| 715 |
|
---|
| 716 | case DM_DROPHELP:
|
---|
| 717 | id = WinQueryWindowUShort(WinQueryWindow(hwnd,QW_PARENT),QWS_ID);
|
---|
| 718 | if(id == MAIN_USERLIST) {
|
---|
| 719 | DropHelp(mp1,mp2,hwnd,GetPString(IDS_USERLISTDROPHELP));
|
---|
| 720 | return 0;
|
---|
| 721 | }
|
---|
| 722 | break;
|
---|
| 723 |
|
---|
| 724 | case DM_DROP:
|
---|
| 725 | id = WinQueryWindowUShort(WinQueryWindow(hwnd,QW_PARENT),QWS_ID);
|
---|
| 726 | if(id == MAIN_USERLIST) {
|
---|
| 727 |
|
---|
| 728 | char szFrom[CCHMAXPATH + 2];
|
---|
| 729 |
|
---|
| 730 | if(emphasized) {
|
---|
| 731 | emphasized = FALSE;
|
---|
| 732 | DrawTargetEmphasis(hwnd,emphasized);
|
---|
| 733 | }
|
---|
| 734 | if(GetOneDrop(mp1,
|
---|
| 735 | mp2,
|
---|
| 736 | szFrom,
|
---|
| 737 | sizeof(szFrom))) {
|
---|
| 738 | MakeValidDir(szFrom);
|
---|
| 739 | WinSetWindowText(hwnd,
|
---|
| 740 | szFrom);
|
---|
| 741 | PostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
---|
| 742 | QW_PARENT),
|
---|
| 743 | QW_PARENT),
|
---|
| 744 | FID_CLIENT),
|
---|
| 745 | UM_COMMAND,
|
---|
| 746 | MPFROM2SHORT(IDM_ADDTOUSERLIST,0),
|
---|
| 747 | MPVOID);
|
---|
| 748 | return 0;
|
---|
| 749 | }
|
---|
| 750 | }
|
---|
| 751 | break;
|
---|
| 752 |
|
---|
| 753 | case WM_DESTROY:
|
---|
| 754 | if(hwndMenu)
|
---|
| 755 | WinDestroyWindow(hwndMenu);
|
---|
| 756 | hwndMenu = (HWND)0;
|
---|
| 757 | break;
|
---|
| 758 | }
|
---|
| 759 |
|
---|
| 760 | return oldproc(hwnd,msg,mp1,mp2);
|
---|
| 761 | }
|
---|
| 762 |
|
---|
| 763 |
|
---|
| 764 | void BubbleHelp (HWND hwnd,BOOL other,BOOL drive,BOOL above,char *help) {
|
---|
| 765 |
|
---|
| 766 | if(help && *help &&
|
---|
| 767 | ((drive && fDrivebarHelp) ||
|
---|
| 768 | (other && fOtherHelp) ||
|
---|
| 769 | (!other && !drive && fToolbarHelp))) {
|
---|
| 770 | if((!hwndBubble ||
|
---|
| 771 | WinQueryWindowULong(hwndBubble,0) != hwnd) &&
|
---|
| 772 | !WinQueryCapture(HWND_DESKTOP))
|
---|
| 773 | MakeBubble(hwnd,
|
---|
| 774 | above,
|
---|
| 775 | help);
|
---|
| 776 | }
|
---|
| 777 | }
|
---|
| 778 |
|
---|
| 779 |
|
---|
| 780 | VOID MakeBubble (HWND hwnd,BOOL above,CHAR *help) {
|
---|
| 781 |
|
---|
| 782 | if(!hwnd || !help || !*help)
|
---|
| 783 | return;
|
---|
| 784 |
|
---|
| 785 | if(hwndBubble)
|
---|
| 786 | WinDestroyWindow(hwndBubble);
|
---|
| 787 |
|
---|
| 788 | {
|
---|
| 789 | HWND hwndActive;
|
---|
| 790 | char ucClassname[8];
|
---|
| 791 |
|
---|
| 792 | hwndActive = WinQueryActiveWindow(HWND_DESKTOP);
|
---|
| 793 | if(hwndActive) {
|
---|
| 794 | /* don't bring up help if window isn't active */
|
---|
| 795 | if(!WinIsChild(hwnd,hwndActive))
|
---|
| 796 | return;
|
---|
| 797 | }
|
---|
| 798 | hwndActive = WinQueryFocus(HWND_DESKTOP);
|
---|
| 799 | if(WinQueryClassName(hwndActive,sizeof(ucClassname),ucClassname)) {
|
---|
| 800 | /* don't bring up help if a menu is active */
|
---|
| 801 | if(!strcmp(ucClassname,"#4"))
|
---|
| 802 | return;
|
---|
| 803 | }
|
---|
| 804 | }
|
---|
| 805 |
|
---|
| 806 | hwndBubble = WinCreateWindow(HWND_DESKTOP,
|
---|
| 807 | GetPString(IDS_WCBUBBLE),
|
---|
| 808 | help,
|
---|
| 809 | WS_CLIPSIBLINGS | SS_TEXT |
|
---|
| 810 | DT_CENTER | DT_VCENTER,
|
---|
| 811 | 0,
|
---|
| 812 | 0,
|
---|
| 813 | 0,
|
---|
| 814 | 0,
|
---|
| 815 | HWND_DESKTOP,
|
---|
| 816 | HWND_TOP,
|
---|
| 817 | MAIN_HELP,
|
---|
| 818 | NULL,
|
---|
| 819 | NULL);
|
---|
| 820 | if(hwndBubble) {
|
---|
| 821 |
|
---|
[36] | 822 | HPS hps;
|
---|
| 823 | POINTL aptl[TXTBOX_COUNT],ptl,tptl;
|
---|
| 824 | LONG lxScreen,sx,sy,extra = 0,lyScreen;
|
---|
| 825 | char *p,*pp,*wp;
|
---|
| 826 | SWP swp;
|
---|
[2] | 827 |
|
---|
| 828 | WinQueryWindowPos(hwnd,&swp);
|
---|
| 829 | lyScreen = WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN);
|
---|
| 830 | lxScreen = WinQuerySysValue(HWND_DESKTOP,SV_CXSCREEN);
|
---|
| 831 | WinSetWindowULong(hwndBubble,0,hwnd);
|
---|
| 832 | SetPresParams(hwndBubble,
|
---|
| 833 | NULL,
|
---|
| 834 | NULL,
|
---|
| 835 | NULL,
|
---|
| 836 | GetPString(IDS_8HELVTEXT));
|
---|
| 837 | hps = WinGetPS(hwndBubble);
|
---|
| 838 | p = help;
|
---|
| 839 | tptl.x = tptl.y = 0;
|
---|
| 840 | while(p && *p) {
|
---|
| 841 | wp = NULL;
|
---|
| 842 | pp = strchr(p,'\r');
|
---|
| 843 | if(pp) {
|
---|
| 844 | wp = pp;
|
---|
| 845 | *pp = 0;
|
---|
| 846 | pp++;
|
---|
| 847 | }
|
---|
| 848 | GpiQueryTextBox(hps,strlen(p),p,TXTBOX_COUNT,aptl);
|
---|
| 849 | tptl.x = max(aptl[TXTBOX_TOPRIGHT].x,tptl.x);
|
---|
| 850 | if(tptl.y)
|
---|
| 851 | tptl.y += extra;
|
---|
| 852 | else
|
---|
| 853 | extra = aptl[TXTBOX_TOPLEFT].y / 4;
|
---|
| 854 | tptl.y += aptl[TXTBOX_TOPLEFT].y;
|
---|
| 855 | if(wp)
|
---|
| 856 | *wp = '\r';
|
---|
| 857 | p = pp;
|
---|
| 858 | }
|
---|
| 859 | WinSetWindowULong(hwndBubble,4,extra);
|
---|
| 860 | WinReleasePS(hps);
|
---|
| 861 | ptl.x = ptl.y = 0;
|
---|
| 862 | WinMapWindowPoints(hwnd,HWND_DESKTOP,&ptl,1);
|
---|
| 863 | if(above) {
|
---|
| 864 | sy = ptl.y + swp.cy + 4;
|
---|
| 865 | if(sy + tptl.y + 12 > lyScreen) {
|
---|
| 866 | above = FALSE;
|
---|
| 867 | sy = ptl.y - (tptl.y + 14);
|
---|
| 868 | }
|
---|
| 869 | }
|
---|
| 870 | else
|
---|
| 871 | sy = ptl.y - (tptl.y + 14);
|
---|
| 872 | if(ptl.x > (lxScreen / 2))
|
---|
| 873 | sx = (ptl.x - tptl.x) - 16;
|
---|
| 874 | else
|
---|
| 875 | sx = ptl.x + (54 * (above == FALSE)) + 2;
|
---|
| 876 | if(sx < 0)
|
---|
| 877 | sx = 0;
|
---|
| 878 | if(sx + tptl.x + 14 > lxScreen)
|
---|
| 879 | sx = lxScreen - (tptl.x + 14);
|
---|
| 880 | if(sy < 0) {
|
---|
| 881 | sy = ptl.y + swp.cy + 4;
|
---|
| 882 | if(sy + tptl.y + 12 > lyScreen)
|
---|
| 883 | sy = 0;
|
---|
| 884 | }
|
---|
| 885 | WinSetWindowPos(hwndBubble,HWND_TOP,sx,sy,
|
---|
[101] | 886 | tptl.x + 14,
|
---|
| 887 | tptl.y + 12,
|
---|
| 888 | SWP_DEACTIVATE | SWP_SHOW | SWP_ZORDER |
|
---|
| 889 | SWP_MOVE | SWP_SIZE);
|
---|
[2] | 890 | }
|
---|
| 891 | }
|
---|
| 892 |
|
---|
| 893 |
|
---|
| 894 | MRESULT EXPENTRY BubbleProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
| 895 |
|
---|
| 896 | switch(msg) {
|
---|
| 897 | case WM_SETFOCUS:
|
---|
| 898 | if(mp2)
|
---|
| 899 | PostMsg(hwnd,
|
---|
| 900 | UM_FOCUSME,
|
---|
| 901 | mp1,
|
---|
| 902 | MPVOID);
|
---|
| 903 | break;
|
---|
| 904 |
|
---|
| 905 | case UM_FOCUSME:
|
---|
| 906 | WinSetFocus(HWND_DESKTOP,
|
---|
| 907 | (HWND)mp1);
|
---|
| 908 | return 0;
|
---|
| 909 |
|
---|
| 910 | case WM_MOUSEMOVE:
|
---|
| 911 | WinShowWindow(hwnd,FALSE);
|
---|
| 912 | break;
|
---|
| 913 |
|
---|
| 914 | case UM_TIMER:
|
---|
| 915 | {
|
---|
| 916 | POINTL ptl;
|
---|
| 917 |
|
---|
| 918 | WinQueryPointerPos(HWND_DESKTOP,&ptl);
|
---|
| 919 | if(WinWindowFromPoint(HWND_DESKTOP,&ptl,TRUE) !=
|
---|
| 920 | WinQueryWindowULong(hwnd,0) ||
|
---|
| 921 | !WinIsWindowVisible(hwnd))
|
---|
| 922 | WinDestroyWindow(hwnd);
|
---|
| 923 | }
|
---|
| 924 | return 0;
|
---|
| 925 |
|
---|
| 926 | case WM_PAINT:
|
---|
| 927 | {
|
---|
[36] | 928 | HPS hps;
|
---|
| 929 | SWP swp;
|
---|
[2] | 930 | POINTL ptl,aptl[TXTBOX_COUNT];
|
---|
[36] | 931 | CHAR *s,*p,*pp,*wp;
|
---|
| 932 | ULONG extra,tlen,y;
|
---|
[2] | 933 |
|
---|
| 934 | hps = WinBeginPaint(hwnd,(HPS)0,NULL);
|
---|
| 935 | if(hps) {
|
---|
| 936 | WinQueryWindowPos(hwnd,&swp);
|
---|
| 937 | GpiCreateLogColorTable(hps,0,LCOLF_RGB,0,0,0);
|
---|
| 938 | GpiSetColor(hps,((255 << 16) | (255 << 8) | 198));
|
---|
| 939 | GpiSetBackMix(hps,BM_LEAVEALONE);
|
---|
| 940 | GpiSetMix(hps,FM_OVERPAINT);
|
---|
| 941 | ptl.x = ptl.y = 0;
|
---|
| 942 | GpiMove(hps,&ptl);
|
---|
| 943 | ptl.x = swp.cx - 1;
|
---|
| 944 | ptl.y = swp.cy - 1;
|
---|
| 945 | GpiBox(hps,DRO_OUTLINEFILL,&ptl,0,0);
|
---|
| 946 | tlen = WinQueryWindowTextLength(hwnd);
|
---|
| 947 | if(tlen) {
|
---|
| 948 | s = malloc(tlen + 2);
|
---|
| 949 | if(s) {
|
---|
| 950 | WinQueryWindowText(hwnd,tlen + 1,s);
|
---|
| 951 | if(*s) {
|
---|
| 952 | p = s;
|
---|
| 953 | y = swp.cy - 3;
|
---|
| 954 | extra = WinQueryWindowULong(hwnd,4);
|
---|
| 955 | GpiSetColor(hps,0);
|
---|
| 956 | GpiSetMix(hps,FM_OVERPAINT);
|
---|
| 957 | while(p && *p) {
|
---|
| 958 | wp = NULL;
|
---|
| 959 | pp = strchr(p,'\r');
|
---|
| 960 | if(pp) {
|
---|
| 961 | wp = pp;
|
---|
| 962 | *pp = 0;
|
---|
| 963 | pp++;
|
---|
| 964 | }
|
---|
| 965 | GpiQueryTextBox(hps,strlen(p),p,TXTBOX_COUNT,aptl);
|
---|
| 966 | ptl.x = 7;
|
---|
| 967 | y -= aptl[TXTBOX_TOPLEFT].y;
|
---|
| 968 | if(p != s)
|
---|
| 969 | y -= extra;
|
---|
| 970 | ptl.y = y;
|
---|
| 971 | GpiCharStringAt(hps,&ptl,strlen(p),p);
|
---|
| 972 | if(wp)
|
---|
| 973 | *wp = '\r';
|
---|
| 974 | p = pp;
|
---|
| 975 | }
|
---|
| 976 | }
|
---|
| 977 | free(s);
|
---|
| 978 | }
|
---|
| 979 | }
|
---|
| 980 | if(!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)) &&
|
---|
| 981 | swp.cx > 6 && swp.cy > 6) {
|
---|
| 982 | GpiSetColor(hps,CLR_WHITE);
|
---|
| 983 | ptl.x = 1;
|
---|
| 984 | ptl.y = 1;
|
---|
| 985 | GpiMove(hps,&ptl);
|
---|
| 986 | ptl.y = swp.cy - 2;
|
---|
| 987 | GpiLine(hps,&ptl);
|
---|
| 988 | ptl.x = swp.cx - 2;
|
---|
| 989 | GpiLine(hps,&ptl);
|
---|
| 990 | ptl.x = 2;
|
---|
| 991 | ptl.y = 2;
|
---|
| 992 | GpiMove(hps,&ptl);
|
---|
| 993 | ptl.y = swp.cy - 3;
|
---|
| 994 | GpiLine(hps,&ptl);
|
---|
| 995 | ptl.x = swp.cx - 3;
|
---|
| 996 | GpiLine(hps,&ptl);
|
---|
| 997 | GpiSetColor(hps,CLR_BROWN);
|
---|
| 998 | ptl.x = 1;
|
---|
| 999 | ptl.y = 1;
|
---|
| 1000 | GpiMove(hps,&ptl);
|
---|
| 1001 | ptl.x = swp.cx - 2;
|
---|
| 1002 | GpiLine(hps,&ptl);
|
---|
| 1003 | ptl.y = swp.cy - 2;
|
---|
| 1004 | GpiLine(hps,&ptl);
|
---|
| 1005 | ptl.x = 2;
|
---|
| 1006 | ptl.y = 2;
|
---|
| 1007 | GpiMove(hps,&ptl);
|
---|
| 1008 | ptl.x = swp.cx - 3;
|
---|
| 1009 | GpiLine(hps,&ptl);
|
---|
| 1010 | ptl.y = swp.cy - 3;
|
---|
| 1011 | GpiLine(hps,&ptl);
|
---|
| 1012 | }
|
---|
| 1013 | WinEndPaint(hps);
|
---|
| 1014 | }
|
---|
| 1015 | }
|
---|
| 1016 | return 0;
|
---|
| 1017 |
|
---|
| 1018 | case WM_CLOSE:
|
---|
| 1019 | WinDestroyWindow(hwnd);
|
---|
| 1020 | return 0;
|
---|
| 1021 |
|
---|
| 1022 | case WM_DESTROY:
|
---|
| 1023 | hwndBubble = (HWND)0;
|
---|
| 1024 | break;
|
---|
| 1025 | }
|
---|
| 1026 | return PFNWPStatic(hwnd,msg,mp1,mp2);
|
---|
| 1027 | }
|
---|
| 1028 |
|
---|
| 1029 |
|
---|
| 1030 | MRESULT EXPENTRY LEDProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
| 1031 |
|
---|
| 1032 | switch(msg) {
|
---|
| 1033 | case WM_CREATE:
|
---|
| 1034 | {
|
---|
| 1035 | MRESULT mr = PFNWPStatic(hwnd,msg,mp1,mp2);
|
---|
| 1036 | HBITMAP hbmold = (HBITMAP)0;
|
---|
| 1037 | HPS hps = (HPS)0;
|
---|
| 1038 |
|
---|
| 1039 | switch(WinQueryWindowUShort(hwnd,QWS_ID)) {
|
---|
| 1040 | case MAIN_LED:
|
---|
| 1041 | hps = WinGetPS(hwnd);
|
---|
| 1042 | hbmold = (HBITMAP)WinSendMsg(hwnd,
|
---|
| 1043 | SM_QUERYHANDLE,
|
---|
| 1044 | MPVOID,
|
---|
| 1045 | MPVOID);
|
---|
| 1046 | if(!fBlueLED) {
|
---|
| 1047 | hbmLEDon = GpiLoadBitmap(hps,
|
---|
| 1048 | 0,
|
---|
| 1049 | LEDON_BMP,
|
---|
| 1050 | 12,
|
---|
| 1051 | 12);
|
---|
| 1052 | hbmLEDoff = GpiLoadBitmap(hps,
|
---|
| 1053 | 0,
|
---|
| 1054 | LEDOFF_BMP,
|
---|
| 1055 | 12,
|
---|
| 1056 | 12);
|
---|
| 1057 | }
|
---|
| 1058 | else {
|
---|
| 1059 | hbmLEDon = GpiLoadBitmap(hps,
|
---|
| 1060 | 0,
|
---|
| 1061 | LEDON2_BMP,
|
---|
| 1062 | 12,
|
---|
| 1063 | 12);
|
---|
| 1064 | hbmLEDoff = GpiLoadBitmap(hps,
|
---|
| 1065 | 0,
|
---|
| 1066 | LEDOFF2_BMP,
|
---|
| 1067 | 12,
|
---|
| 1068 | 12);
|
---|
| 1069 | }
|
---|
| 1070 | if(hbmLEDoff &&
|
---|
| 1071 | hbmLEDon)
|
---|
| 1072 | WinSendMsg(hwnd,
|
---|
| 1073 | SM_SETHANDLE,
|
---|
| 1074 | MPFROMLONG(hbmLEDoff),
|
---|
| 1075 | MPVOID);
|
---|
| 1076 | else {
|
---|
| 1077 | if(hbmLEDoff)
|
---|
| 1078 | GpiDeleteBitmap(hbmLEDoff);
|
---|
| 1079 | if(hbmLEDon)
|
---|
| 1080 | GpiDeleteBitmap(hbmLEDon);
|
---|
| 1081 | }
|
---|
| 1082 | if(hbmold &&
|
---|
| 1083 | hbmLEDon &&
|
---|
| 1084 | hbmLEDoff &&
|
---|
| 1085 | hbmold != hbmLEDon &&
|
---|
| 1086 | hbmold != hbmLEDoff)
|
---|
| 1087 | GpiDeleteBitmap(hbmold);
|
---|
| 1088 | if(hps)
|
---|
| 1089 | WinReleasePS(hps);
|
---|
| 1090 | break;
|
---|
| 1091 | default:
|
---|
| 1092 | SetPresParams(hwnd,
|
---|
| 1093 | &RGBGREY,
|
---|
| 1094 | &RGBBLACK,
|
---|
| 1095 | &RGBGREY,
|
---|
| 1096 | GetPString(IDS_6HELVTEXT));
|
---|
| 1097 | break;
|
---|
| 1098 | }
|
---|
| 1099 | return mr;
|
---|
| 1100 | }
|
---|
| 1101 |
|
---|
| 1102 | case WM_SETFOCUS:
|
---|
| 1103 | if(mp2)
|
---|
| 1104 | PostMsg(hwnd,
|
---|
| 1105 | UM_FOCUSME,
|
---|
| 1106 | mp1,
|
---|
| 1107 | MPVOID);
|
---|
| 1108 | break;
|
---|
| 1109 |
|
---|
| 1110 | case UM_FOCUSME:
|
---|
| 1111 | WinSetFocus(HWND_DESKTOP,
|
---|
| 1112 | (HWND)mp1);
|
---|
| 1113 | return 0;
|
---|
| 1114 |
|
---|
| 1115 | case WM_MOUSEMOVE:
|
---|
| 1116 | BubbleHelp(hwnd,
|
---|
| 1117 | TRUE,
|
---|
| 1118 | FALSE,
|
---|
| 1119 | FALSE,
|
---|
| 1120 | GetPString(IDS_LEDHELP));
|
---|
| 1121 | if(!fNoFinger) {
|
---|
| 1122 | WinSetPointer(HWND_DESKTOP,hptrFinger);
|
---|
| 1123 | return MRFROMLONG(TRUE);
|
---|
| 1124 | }
|
---|
| 1125 | break;
|
---|
| 1126 |
|
---|
| 1127 | case WM_BUTTON1CLICK:
|
---|
| 1128 | PostMsg(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 1129 | WM_COMMAND,
|
---|
| 1130 | MPFROM2SHORT(IDM_SHOWNOTEWND,0),
|
---|
| 1131 | MPVOID);
|
---|
| 1132 | break;
|
---|
| 1133 |
|
---|
| 1134 | case WM_BUTTON2CLICK:
|
---|
| 1135 | PostMsg(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 1136 | WM_COMMAND,
|
---|
| 1137 | MPFROM2SHORT(IDM_HIDENOTEWND,0),
|
---|
| 1138 | MPVOID);
|
---|
| 1139 | break;
|
---|
| 1140 |
|
---|
| 1141 | case WM_CHORD:
|
---|
| 1142 | case WM_BUTTON3CLICK:
|
---|
| 1143 | PostMsg(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 1144 | WM_COMMAND,
|
---|
| 1145 | MPFROM2SHORT(IDM_WINDOWDLG,0),
|
---|
| 1146 | MPVOID);
|
---|
| 1147 | break;
|
---|
| 1148 | }
|
---|
| 1149 | return PFNWPStatic(hwnd,msg,mp1,mp2);
|
---|
| 1150 | }
|
---|
| 1151 |
|
---|
| 1152 |
|
---|
| 1153 | MRESULT EXPENTRY ChildButtonProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
| 1154 |
|
---|
[36] | 1155 | USHORT id;
|
---|
| 1156 | register TOOL *tool;
|
---|
| 1157 | static HWND hwndMenu = (HWND)0;
|
---|
[2] | 1158 |
|
---|
| 1159 | switch(msg) {
|
---|
| 1160 | case WM_BUTTON1DOWN:
|
---|
| 1161 | case WM_BUTTON2DOWN:
|
---|
| 1162 | case WM_BUTTON3DOWN:
|
---|
| 1163 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 1164 | break;
|
---|
| 1165 |
|
---|
| 1166 | case WM_MOUSEMOVE:
|
---|
| 1167 | if(fToolbarHelp) {
|
---|
| 1168 | if((!hwndBubble || WinQueryWindowULong(hwndBubble,0) != hwnd) &&
|
---|
| 1169 | !WinQueryCapture(HWND_DESKTOP)) {
|
---|
| 1170 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 1171 | tool = find_tool(id);
|
---|
| 1172 | if(tool && tool->help && *tool->help) {
|
---|
| 1173 |
|
---|
| 1174 | char s[128];
|
---|
| 1175 |
|
---|
| 1176 | strcpy(s,tool->help);
|
---|
| 1177 | if(tool->flags & T_DROPABLE)
|
---|
[69] | 1178 | strcat(s,GetPString(IDS_DROPONMETEXT));
|
---|
[2] | 1179 | MakeBubble(hwnd,FALSE,s);
|
---|
| 1180 | }
|
---|
| 1181 | }
|
---|
| 1182 | }
|
---|
| 1183 | break;
|
---|
| 1184 |
|
---|
| 1185 | case WM_COMMAND:
|
---|
| 1186 | switch(SHORT1FROMMP(mp1)) {
|
---|
| 1187 | case IDM_HELP:
|
---|
| 1188 | if(hwndHelp)
|
---|
| 1189 | WinSendMsg(hwndHelp,
|
---|
| 1190 | HM_DISPLAY_HELP,
|
---|
[69] | 1191 | MPFROM2SHORT(HELP_TOOLBAR,0),
|
---|
| 1192 | MPFROMSHORT(HM_RESOURCEID));
|
---|
[2] | 1193 | break;
|
---|
| 1194 |
|
---|
[36] | 1195 | case IDM_HIDEANYTOOL: /* hide any tool */
|
---|
| 1196 | case IDM_HIDETOOL: /* hide tool */
|
---|
[2] | 1197 | if(SHORT1FROMMP(mp1) == IDM_HIDETOOL)
|
---|
| 1198 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 1199 | else
|
---|
| 1200 | id = (USHORT)WinDlgBox(HWND_DESKTOP,hwnd,
|
---|
| 1201 | PickToolProc,FM3ModHandle,
|
---|
| 1202 | PICKBTN_FRAME,
|
---|
| 1203 | GetPString(IDS_HIDETEXT));
|
---|
| 1204 | if(id) {
|
---|
| 1205 | tool = find_tool(id);
|
---|
| 1206 | if(tool) {
|
---|
| 1207 | tool->flags |= T_INVISIBLE;
|
---|
| 1208 | fToolsChanged = TRUE;
|
---|
| 1209 | }
|
---|
| 1210 | }
|
---|
| 1211 | break;
|
---|
| 1212 |
|
---|
[36] | 1213 | case IDM_SHOWTOOLS: /* show all tools */
|
---|
[2] | 1214 | tool = toolhead;
|
---|
| 1215 | while(tool) {
|
---|
| 1216 | tool->flags &= (~T_INVISIBLE);
|
---|
| 1217 | tool = tool->next;
|
---|
| 1218 | fToolsChanged = TRUE;
|
---|
| 1219 | }
|
---|
| 1220 | break;
|
---|
| 1221 |
|
---|
[36] | 1222 | case IDM_DELETEANYTOOL: /* delete any button */
|
---|
| 1223 | case IDM_DELETETOOL: /* delete button */
|
---|
[2] | 1224 | if(SHORT1FROMMP(mp1) == IDM_DELETETOOL)
|
---|
| 1225 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 1226 | else
|
---|
| 1227 | id = (USHORT)WinDlgBox(HWND_DESKTOP,hwnd,PickToolProc,FM3ModHandle,
|
---|
| 1228 | PICKBTN_FRAME,
|
---|
| 1229 | GetPString(IDS_DELETETEXT));
|
---|
| 1230 | if(id)
|
---|
| 1231 | PostMsg(WinQueryWindow(hwnd,QW_PARENT),UM_SETUP,
|
---|
| 1232 | MPFROM2SHORT(id,0),MPVOID);
|
---|
| 1233 | return 0;
|
---|
| 1234 |
|
---|
[36] | 1235 | case IDM_EDITANYTOOL: /* edit any button */
|
---|
| 1236 | case IDM_EDITTOOL: /* edit button */
|
---|
[2] | 1237 | if(SHORT1FROMMP(mp1) == IDM_EDITTOOL)
|
---|
| 1238 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 1239 | else
|
---|
| 1240 | id = (USHORT)WinDlgBox(HWND_DESKTOP,hwnd,PickToolProc,FM3ModHandle,
|
---|
| 1241 | PICKBTN_FRAME,
|
---|
| 1242 | GetPString(IDS_EDITTEXT));
|
---|
| 1243 | if(id) {
|
---|
| 1244 | tool = find_tool(id);
|
---|
| 1245 | if(tool) {
|
---|
| 1246 | if(WinDlgBox(HWND_DESKTOP,hwnd,AddToolProc,FM3ModHandle,
|
---|
| 1247 | ADDBTN_FRAME,(PVOID)tool))
|
---|
| 1248 | WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
---|
| 1249 | QW_PARENT),QW_PARENT),FID_CLIENT),
|
---|
| 1250 | WM_COMMAND,MPFROM2SHORT(IDM_CREATETOOL,0),
|
---|
| 1251 | MPFROM2SHORT(id,0));
|
---|
| 1252 | }
|
---|
| 1253 | }
|
---|
| 1254 | break;
|
---|
| 1255 |
|
---|
[36] | 1256 | case IDM_ADDTOOL: /* add tool */
|
---|
[2] | 1257 | id = (USHORT)WinDlgBox(HWND_DESKTOP,hwnd,AddToolProc,FM3ModHandle,
|
---|
| 1258 | ADDBTN_FRAME,MPVOID);
|
---|
| 1259 | if(id && id != (USHORT)-1)
|
---|
| 1260 | WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
|
---|
| 1261 | QW_PARENT),QW_PARENT),FID_CLIENT),
|
---|
| 1262 | WM_COMMAND,MPFROM2SHORT(IDM_CREATETOOL,0),
|
---|
| 1263 | MPFROM2SHORT(id,0));
|
---|
| 1264 | break;
|
---|
| 1265 |
|
---|
| 1266 | case IDM_REORDERTOOLS: /* reorder tools */
|
---|
| 1267 | WinDlgBox(HWND_DESKTOP,
|
---|
| 1268 | hwnd,
|
---|
| 1269 | ReOrderToolsProc,
|
---|
| 1270 | FM3ModHandle,
|
---|
| 1271 | RE_FRAME,
|
---|
| 1272 | MPVOID);
|
---|
| 1273 | break;
|
---|
| 1274 |
|
---|
| 1275 | case IDM_SAVETOOLS:
|
---|
| 1276 | case IDM_LOADTOOLS:
|
---|
| 1277 | if(WinDlgBox(HWND_DESKTOP,
|
---|
| 1278 | hwnd,
|
---|
| 1279 | ToolIODlgProc,
|
---|
| 1280 | FM3ModHandle,
|
---|
| 1281 | SVBTN_FRAME,
|
---|
| 1282 | (PVOID)(SHORT1FROMMP(mp1) == IDM_SAVETOOLS) ?
|
---|
| 1283 | "TRUE" : NULL))
|
---|
| 1284 | BuildTools(hwndToolback,TRUE);
|
---|
| 1285 | break;
|
---|
| 1286 | }
|
---|
| 1287 | ResizeTools(WinQueryWindow(hwnd,QW_PARENT));
|
---|
| 1288 | return 0;
|
---|
| 1289 |
|
---|
| 1290 | case WM_MENUEND:
|
---|
| 1291 | if(hwndMenu == (HWND)mp2) {
|
---|
| 1292 | WinDestroyWindow(hwndMenu);
|
---|
| 1293 | hwndMenu = (HWND)0;
|
---|
| 1294 | }
|
---|
| 1295 | break;
|
---|
| 1296 |
|
---|
| 1297 | case WM_CONTEXTMENU:
|
---|
| 1298 | DosEnterCritSec();
|
---|
| 1299 | if(!hwndMenu)
|
---|
| 1300 | hwndMenu = WinLoadMenu(hwnd,FM3ModHandle,ID_BUTTONMENU);
|
---|
| 1301 | DosExitCritSec();
|
---|
| 1302 | SetPresParams(hwndMenu,
|
---|
| 1303 | NULL,
|
---|
| 1304 | NULL,
|
---|
| 1305 | NULL,
|
---|
| 1306 | GetPString(IDS_10SYSPROTEXT));
|
---|
| 1307 | if(PopupMenu(hwnd,hwnd,hwndMenu))
|
---|
| 1308 | WinShowWindow(hwndMenu,TRUE);
|
---|
| 1309 | return MRFROMSHORT(TRUE);
|
---|
| 1310 |
|
---|
| 1311 | case DM_DRAGOVER:
|
---|
| 1312 | {
|
---|
[36] | 1313 | PDRAGINFO pDInfo; /* Pointer to DRAGINFO */
|
---|
[2] | 1314 |
|
---|
[36] | 1315 | pDInfo = (PDRAGINFO)mp1; /* Get DRAGINFO pointer */
|
---|
| 1316 | DrgAccessDraginfo(pDInfo); /* Access DRAGINFO */
|
---|
[2] | 1317 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 1318 | tool = find_tool(id);
|
---|
| 1319 | if(!tool) {
|
---|
| 1320 | DrgFreeDraginfo(pDInfo);
|
---|
[36] | 1321 | return(MRFROM2SHORT(DOR_NEVERDROP,0)); /* Drop not valid */
|
---|
[2] | 1322 | }
|
---|
| 1323 | if(!(tool->flags & T_DROPABLE)) {
|
---|
| 1324 | DrgFreeDraginfo(pDInfo);
|
---|
[36] | 1325 | return(MRFROM2SHORT(DOR_NEVERDROP,0)); /* Drop not valid */
|
---|
[2] | 1326 | }
|
---|
| 1327 | {
|
---|
[36] | 1328 | PDRAGITEM pDItem; /* Pointer to DRAGITEM */
|
---|
[2] | 1329 |
|
---|
[36] | 1330 | pDItem = DrgQueryDragitemPtr(pDInfo, /* Access DRAGITEM */
|
---|
| 1331 | 0); /* Index to DRAGITEM */
|
---|
| 1332 | if(DrgVerifyRMF(pDItem, /* Check valid rendering */
|
---|
| 1333 | DRM_OS2FILE, /* mechanisms and data */
|
---|
| 1334 | NULL)) { /* formats */
|
---|
[2] | 1335 | if(!(tool->flags & T_EMPHASIZED)) {
|
---|
| 1336 | tool->flags |= T_EMPHASIZED;
|
---|
| 1337 | DrawTargetEmphasis(hwnd,((tool->flags & T_EMPHASIZED) != 0));
|
---|
| 1338 | DrgFreeDraginfo(pDInfo);
|
---|
| 1339 | }
|
---|
[36] | 1340 | return(MRFROM2SHORT(DOR_DROP, /* Return okay to drop */
|
---|
| 1341 | DO_MOVE)); /* Move operation valid */
|
---|
[2] | 1342 | }
|
---|
| 1343 | DrgFreeDraginfo(pDInfo);
|
---|
| 1344 | }
|
---|
| 1345 | }
|
---|
| 1346 | return(MRFROM2SHORT(DOR_NEVERDROP,0)); /* Drop not valid */
|
---|
| 1347 |
|
---|
| 1348 | case DM_DROPHELP:
|
---|
| 1349 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 1350 | tool = find_tool(id);
|
---|
| 1351 | PFNWPButton(hwnd,msg,mp1,mp2);
|
---|
| 1352 | DropHelp(mp1,mp2,hwnd,GetPString(IDS_TOOLDROPHELP));
|
---|
| 1353 | return 0;
|
---|
| 1354 |
|
---|
| 1355 | case DM_DRAGLEAVE:
|
---|
| 1356 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 1357 | tool = find_tool(id);
|
---|
| 1358 | if(tool && (tool->flags & T_DROPABLE)) {
|
---|
| 1359 | if(tool->flags & T_EMPHASIZED) {
|
---|
| 1360 | tool->flags &= (~T_EMPHASIZED);
|
---|
| 1361 | DrawTargetEmphasis(hwnd,((tool->flags & T_EMPHASIZED) != 0));
|
---|
| 1362 | }
|
---|
| 1363 | }
|
---|
| 1364 | break;
|
---|
| 1365 |
|
---|
| 1366 | case DM_DROP:
|
---|
| 1367 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 1368 | tool = find_tool(id);
|
---|
| 1369 | if(tool && (tool->flags & T_DROPABLE) != 0) {
|
---|
| 1370 |
|
---|
| 1371 | LISTINFO *li;
|
---|
| 1372 | CNRDRAGINFO cdi;
|
---|
| 1373 |
|
---|
| 1374 | if(tool->flags & T_EMPHASIZED) {
|
---|
| 1375 | DrawTargetEmphasis(hwnd,((tool->flags & T_EMPHASIZED) != 0));
|
---|
| 1376 | tool->flags &= (~T_EMPHASIZED);
|
---|
| 1377 | }
|
---|
| 1378 | memset(&cdi,0,sizeof(cdi));
|
---|
| 1379 | cdi.pRecord = NULL;
|
---|
| 1380 | cdi.pDragInfo = mp1;
|
---|
| 1381 | li = DoFileDrop(hwnd,
|
---|
| 1382 | NULL,
|
---|
| 1383 | FALSE,
|
---|
| 1384 | mp1,
|
---|
| 1385 | MPFROMP(&cdi));
|
---|
| 1386 | if(li) {
|
---|
| 1387 | li->type = id;
|
---|
| 1388 | if(!li->list || !li->list[0])
|
---|
| 1389 | FreeListInfo(li);
|
---|
| 1390 | else {
|
---|
| 1391 |
|
---|
| 1392 | HWND hwndActive;
|
---|
| 1393 |
|
---|
| 1394 | hwndActive = TopWindow(hwndMain,(HWND)0);
|
---|
| 1395 | if(hwndActive) {
|
---|
| 1396 | if(!WinSendMsg(hwndActive,UM_COMMAND,MPFROMP(li),MPVOID))
|
---|
| 1397 | FreeListInfo(li);
|
---|
| 1398 | }
|
---|
| 1399 | else
|
---|
| 1400 | FreeListInfo(li);
|
---|
| 1401 | }
|
---|
| 1402 | }
|
---|
| 1403 | }
|
---|
| 1404 | return 0;
|
---|
| 1405 |
|
---|
| 1406 | case WM_CLOSE:
|
---|
| 1407 | WinDestroyWindow(hwnd);
|
---|
| 1408 | return 0;
|
---|
| 1409 | }
|
---|
| 1410 | return PFNWPButton(hwnd,msg,mp1,mp2);
|
---|
| 1411 | }
|
---|
| 1412 |
|
---|
| 1413 |
|
---|
| 1414 | VOID BuildTools (HWND hwndT,BOOL resize) {
|
---|
| 1415 |
|
---|
[36] | 1416 | register TOOL *tool;
|
---|
| 1417 | register ULONG ctrlxpos = 18L;
|
---|
| 1418 | CHAR s[33];
|
---|
| 1419 | HENUM henum;
|
---|
| 1420 | HWND hwndTool;
|
---|
[2] | 1421 |
|
---|
| 1422 | henum = WinBeginEnumWindows(hwndT);
|
---|
| 1423 | while((hwndTool = WinGetNextWindow(henum)) != NULLHANDLE)
|
---|
| 1424 | WinDestroyWindow(hwndTool);
|
---|
| 1425 | WinEndEnumWindows(henum);
|
---|
| 1426 | if(!fToolbar) {
|
---|
| 1427 | load_quicktools();
|
---|
| 1428 | load_tools(NULL);
|
---|
| 1429 | return;
|
---|
| 1430 | }
|
---|
| 1431 | if(!toolhead)
|
---|
| 1432 | load_tools(NULL);
|
---|
| 1433 | tool = toolhead;
|
---|
| 1434 | while(tool) {
|
---|
| 1435 | sprintf(s,"#%u",tool->id);
|
---|
| 1436 | hwndTool = (HWND)0;
|
---|
| 1437 | if(!fTextTools) {
|
---|
| 1438 | if(!(tool->flags & T_MYICON))
|
---|
| 1439 | hwndTool = WinCreateWindow(hwndT,
|
---|
| 1440 | GetPString(IDS_WCTOOLBUTTONS),
|
---|
| 1441 | s,
|
---|
[69] | 1442 | BS_NOPOINTERFOCUS |
|
---|
| 1443 | BS_BITMAP | BS_PUSHBUTTON,
|
---|
[2] | 1444 | ctrlxpos,
|
---|
| 1445 | 14,
|
---|
| 1446 | 32,
|
---|
| 1447 | 32,
|
---|
| 1448 | hwndT,
|
---|
| 1449 | HWND_TOP,
|
---|
| 1450 | tool->id,
|
---|
| 1451 | NULL,
|
---|
| 1452 | NULL);
|
---|
| 1453 | if(!hwndTool) {
|
---|
| 1454 |
|
---|
[36] | 1455 | HBITMAP hbm;
|
---|
[2] | 1456 |
|
---|
| 1457 | hbm = LoadBitmapFromFileNum(tool->id);
|
---|
| 1458 | if(hbm) {
|
---|
| 1459 |
|
---|
| 1460 | BTNCDATA btc;
|
---|
| 1461 |
|
---|
| 1462 | memset(&btc,0,sizeof(btc));
|
---|
| 1463 | btc.cb = sizeof(btc);
|
---|
| 1464 | btc.hImage = hbm;
|
---|
| 1465 | hwndTool = WinCreateWindow(hwndT,
|
---|
| 1466 | GetPString(IDS_WCTOOLBUTTONS),
|
---|
| 1467 | NullStr,
|
---|
[69] | 1468 | BS_NOPOINTERFOCUS |
|
---|
| 1469 | BS_BITMAP | BS_PUSHBUTTON,
|
---|
[2] | 1470 | ctrlxpos,
|
---|
| 1471 | 14,
|
---|
| 1472 | 32,
|
---|
| 1473 | 32,
|
---|
| 1474 | hwndT,
|
---|
| 1475 | HWND_TOP,
|
---|
| 1476 | tool->id,
|
---|
| 1477 | &btc,
|
---|
| 1478 | NULL);
|
---|
| 1479 | if(!hwndTool)
|
---|
| 1480 | GpiDeleteBitmap(hbm);
|
---|
| 1481 | }
|
---|
| 1482 | }
|
---|
| 1483 | if(hwndTool)
|
---|
| 1484 | tool->flags &= (~T_TEXT);
|
---|
| 1485 | }
|
---|
| 1486 | if(!hwndTool) {
|
---|
| 1487 | WinCreateWindow(hwndT,
|
---|
| 1488 | GetPString(IDS_WCTOOLBUTTONS),
|
---|
[69] | 1489 | (!tool->text && tool->id >= IDM_COMMANDSTART &&
|
---|
| 1490 | tool->id < IDM_QUICKTOOLSTART) ?
|
---|
| 1491 | command_title(tool->id - IDM_COMMANDSTART) :
|
---|
[2] | 1492 | tool->text,
|
---|
| 1493 | BS_NOPOINTERFOCUS | BS_PUSHBUTTON,
|
---|
| 1494 | ctrlxpos,
|
---|
| 1495 | 2,
|
---|
| 1496 | 54,
|
---|
| 1497 | 24,
|
---|
| 1498 | hwndT,
|
---|
| 1499 | HWND_TOP,
|
---|
| 1500 | tool->id,
|
---|
| 1501 | NULL,
|
---|
| 1502 | NULL);
|
---|
| 1503 | tool->flags |= T_TEXT;
|
---|
| 1504 | }
|
---|
| 1505 | if(fToolTitles && !fTextTools) {
|
---|
| 1506 | WinCreateWindow(hwndT,
|
---|
| 1507 | WC_STATIC,
|
---|
| 1508 | tool->text,
|
---|
| 1509 | SS_TEXT | DT_LEFT | DT_VCENTER,
|
---|
| 1510 | ctrlxpos,
|
---|
| 1511 | 1,
|
---|
| 1512 | 32,
|
---|
| 1513 | 10,
|
---|
| 1514 | hwndT,
|
---|
| 1515 | HWND_TOP,
|
---|
| 1516 | tool->id + 25000,
|
---|
| 1517 | NULL,
|
---|
| 1518 | NULL);
|
---|
| 1519 | SetPresParams(WinWindowFromID(hwndT,tool->id + 25000),
|
---|
| 1520 | &RGBGREY,
|
---|
| 1521 | &RGBBLACK,
|
---|
| 1522 | &RGBGREY,
|
---|
| 1523 | GetPString(IDS_2SYSTEMVIOTEXT));
|
---|
| 1524 | }
|
---|
| 1525 | ctrlxpos += ((tool->flags & T_TEXT) ? 55L : 33L);
|
---|
| 1526 | SetPresParams(WinWindowFromID(hwndT,tool->id),
|
---|
| 1527 | NULL,
|
---|
| 1528 | NULL,
|
---|
| 1529 | NULL,
|
---|
| 1530 | GetPString(IDS_8HELVTEXT));
|
---|
| 1531 | tool = tool->next;
|
---|
| 1532 | }
|
---|
| 1533 | WinCreateWindow(hwndT,
|
---|
| 1534 | WC_BUTTON,
|
---|
| 1535 | "#6010",
|
---|
| 1536 | BS_NOPOINTERFOCUS |
|
---|
| 1537 | BS_BITMAP | BS_PUSHBUTTON,
|
---|
| 1538 | 1,
|
---|
| 1539 | 19,
|
---|
| 1540 | 14,
|
---|
| 1541 | 13,
|
---|
| 1542 | hwndT,
|
---|
| 1543 | HWND_TOP,
|
---|
| 1544 | IDM_TOOLLEFT,
|
---|
| 1545 | NULL,
|
---|
| 1546 | NULL);
|
---|
| 1547 | WinCreateWindow(hwndT,
|
---|
| 1548 | WC_BUTTON,
|
---|
| 1549 | "#6011",
|
---|
| 1550 | BS_NOPOINTERFOCUS |
|
---|
| 1551 | BS_BITMAP | BS_PUSHBUTTON,
|
---|
| 1552 | 1,
|
---|
| 1553 | 4,
|
---|
| 1554 | 14,
|
---|
| 1555 | 13,
|
---|
| 1556 | hwndT,
|
---|
| 1557 | HWND_TOP,
|
---|
| 1558 | IDM_TOOLRIGHT,
|
---|
| 1559 | NULL,
|
---|
| 1560 | NULL);
|
---|
| 1561 | if(resize)
|
---|
| 1562 | ResizeTools(hwndT);
|
---|
| 1563 | }
|
---|
| 1564 |
|
---|
| 1565 |
|
---|
| 1566 | MRESULT EXPENTRY CommandLineProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
| 1567 |
|
---|
[36] | 1568 | PFNWP oldproc = (PFNWP)WinQueryWindowPtr(hwnd,0);
|
---|
| 1569 | static BOOL lbup = FALSE;
|
---|
[2] | 1570 |
|
---|
| 1571 | switch(msg) {
|
---|
| 1572 | case UM_FOCUSME:
|
---|
| 1573 | WinSetFocus(HWND_DESKTOP,
|
---|
| 1574 | hwnd);
|
---|
| 1575 | return 0;
|
---|
| 1576 |
|
---|
| 1577 | case WM_SETFOCUS:
|
---|
| 1578 | if(!mp2 && !lbup) {
|
---|
| 1579 |
|
---|
| 1580 | PID pid;
|
---|
| 1581 | TID tid;
|
---|
| 1582 |
|
---|
| 1583 | if(WinQueryWindowUShort((HWND)mp1,QWS_ID) == COMMAND_BUTTON)
|
---|
| 1584 | break;
|
---|
| 1585 | if(!WinQueryWindowProcess((HWND)mp1,&pid,&tid) ||
|
---|
| 1586 | pid == mypid)
|
---|
| 1587 | WinDestroyWindow(hwnd);
|
---|
| 1588 | }
|
---|
| 1589 | break;
|
---|
| 1590 |
|
---|
| 1591 | case UM_RESCAN:
|
---|
| 1592 | {
|
---|
| 1593 | CHAR cl[1024];
|
---|
| 1594 |
|
---|
| 1595 | *cl = 0;
|
---|
| 1596 | lbup = TRUE;
|
---|
| 1597 | if(WinDlgBox(HWND_DESKTOP,
|
---|
| 1598 | hwnd,
|
---|
| 1599 | CmdLine2DlgProc,
|
---|
| 1600 | FM3ModHandle,
|
---|
| 1601 | EXEC2_FRAME,
|
---|
| 1602 | MPFROMP(cl))) {
|
---|
| 1603 | lstrip(cl);
|
---|
| 1604 | WinSetWindowText(hwnd,cl);
|
---|
| 1605 | }
|
---|
| 1606 | PostMsg(hwnd,
|
---|
| 1607 | UM_FOCUSME,
|
---|
| 1608 | MPVOID,
|
---|
| 1609 | MPVOID);
|
---|
| 1610 | PostMsg(hwnd,
|
---|
| 1611 | UM_SETUP,
|
---|
| 1612 | MPVOID,
|
---|
| 1613 | MPVOID);
|
---|
| 1614 | }
|
---|
| 1615 | return 0;
|
---|
| 1616 |
|
---|
| 1617 | case UM_SETUP:
|
---|
| 1618 | lbup = FALSE;
|
---|
| 1619 | return 0;
|
---|
| 1620 |
|
---|
| 1621 | case WM_BUTTON1DBLCLK:
|
---|
| 1622 | PostMsg(hwnd,
|
---|
| 1623 | UM_OPENWINDOWFORME,
|
---|
| 1624 | MPVOID,
|
---|
| 1625 | MPVOID);
|
---|
| 1626 | return 0;
|
---|
| 1627 |
|
---|
| 1628 | case WM_COMMAND:
|
---|
| 1629 | switch(SHORT1FROMMP(mp1)) {
|
---|
| 1630 | case COMMAND_BUTTON:
|
---|
| 1631 | if(!lbup)
|
---|
| 1632 | PostMsg(hwnd,
|
---|
| 1633 | UM_RESCAN,
|
---|
| 1634 | MPVOID,
|
---|
| 1635 | MPVOID);
|
---|
| 1636 | break;
|
---|
| 1637 | }
|
---|
| 1638 | return 0;
|
---|
| 1639 |
|
---|
| 1640 | case UM_OPENWINDOWFORME:
|
---|
| 1641 | {
|
---|
| 1642 | static char directory[CCHMAXPATH],cl[1000];
|
---|
[36] | 1643 | char **list = NULL;
|
---|
| 1644 | ULONG len;
|
---|
| 1645 | HWND hwndCnr;
|
---|
[2] | 1646 |
|
---|
| 1647 | *directory = *cl = 0;
|
---|
[36] | 1648 | strcpy(cl,GetCmdSpec(FALSE));
|
---|
[2] | 1649 | strcat(cl," /C ");
|
---|
| 1650 | len = strlen(cl);
|
---|
| 1651 | WinQueryWindowText(hwnd,1000 - len,cl + len);
|
---|
| 1652 | lstrip(rstrip(cl + len));
|
---|
| 1653 | if(strlen(cl) > len) {
|
---|
| 1654 | WinSendMsg(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 1655 | UM_SETUP,
|
---|
| 1656 | MPFROMP(cl + len),
|
---|
| 1657 | MPVOID);
|
---|
| 1658 | WinQueryWindowText(hwndStatus,
|
---|
| 1659 | CCHMAXPATH,
|
---|
| 1660 | directory);
|
---|
| 1661 | lstrip(rstrip(directory));
|
---|
| 1662 | if(*directory && (IsRoot(directory) || !IsFile(directory))) {
|
---|
| 1663 | if(!FM2Command(directory,cl + len)) {
|
---|
| 1664 | hwndCnr = TopWindow(hwndMain,(HWND)0);
|
---|
| 1665 | if(hwndCnr) {
|
---|
| 1666 | hwndCnr = WinWindowFromID(hwndCnr,FID_CLIENT);
|
---|
| 1667 | if(hwndCnr) {
|
---|
| 1668 | hwndCnr = WinWindowFromID(hwndCnr,DIR_CNR);
|
---|
| 1669 | if(hwndCnr)
|
---|
| 1670 | list = BuildList(hwndCnr);
|
---|
| 1671 | }
|
---|
| 1672 | }
|
---|
| 1673 | WinSetActiveWindow(HWND_DESKTOP,hwndCnr);
|
---|
| 1674 | if(add_cmdline(cl + len,FALSE) && fSaveMiniCmds)
|
---|
| 1675 | save_cmdlines(FALSE);
|
---|
| 1676 | ExecOnList(hwndCnr,
|
---|
| 1677 | cl,
|
---|
| 1678 | WINDOWED | ((fKeepCmdLine) ?
|
---|
| 1679 | SEPARATEKEEP : SEPARATE),
|
---|
| 1680 | directory,
|
---|
| 1681 | list,
|
---|
| 1682 | NULL);
|
---|
| 1683 | if(list)
|
---|
| 1684 | free(list);
|
---|
| 1685 | WinDestroyWindow(hwnd);
|
---|
| 1686 | break;
|
---|
| 1687 | }
|
---|
| 1688 | }
|
---|
| 1689 | }
|
---|
| 1690 | WinSendMsg(hwnd,EM_SETSEL,MPFROM2SHORT(0,1024),MPVOID);
|
---|
| 1691 | }
|
---|
| 1692 | return 0;
|
---|
| 1693 |
|
---|
| 1694 | case WM_CHAR:
|
---|
| 1695 | if(!lbup && !(SHORT1FROMMP(mp1) & KC_KEYUP)) {
|
---|
| 1696 | if(SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {
|
---|
| 1697 | if((SHORT1FROMMP(mp2) & 255) == '\r')
|
---|
| 1698 | PostMsg(hwnd,UM_OPENWINDOWFORME,MPVOID,MPVOID);
|
---|
| 1699 | else if((SHORT1FROMMP(mp2) & 0xff) == 0x1b)
|
---|
| 1700 | WinDestroyWindow(hwnd);
|
---|
| 1701 | else if(SHORT2FROMMP(mp2) == VK_UP ||
|
---|
| 1702 | SHORT2FROMMP(mp2) == VK_DOWN)
|
---|
| 1703 | PostMsg(hwnd,UM_RESCAN,MPVOID,MPVOID);
|
---|
| 1704 | }
|
---|
| 1705 | }
|
---|
| 1706 | else if((SHORT1FROMMP(mp1) & KC_VIRTUALKEY) &&
|
---|
| 1707 | ((SHORT2FROMMP(mp2) == VK_UP ||
|
---|
| 1708 | SHORT2FROMMP(mp2) == VK_DOWN) ||
|
---|
| 1709 | (SHORT1FROMMP(mp2) == '\x1b') ||
|
---|
| 1710 | (SHORT1FROMMP(mp2) == '\r')))
|
---|
| 1711 | return 0;
|
---|
| 1712 | break;
|
---|
| 1713 |
|
---|
| 1714 | case WM_DESTROY:
|
---|
| 1715 | PostMsg(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 1716 | UM_RESCAN,
|
---|
| 1717 | MPVOID,
|
---|
| 1718 | MPVOID);
|
---|
| 1719 | lbup = FALSE;
|
---|
| 1720 | break;
|
---|
| 1721 | }
|
---|
| 1722 | return oldproc(hwnd,msg,mp1,mp2);
|
---|
| 1723 | }
|
---|
| 1724 |
|
---|
| 1725 |
|
---|
| 1726 | MRESULT EXPENTRY DriveBackProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
| 1727 |
|
---|
| 1728 | switch(msg) {
|
---|
| 1729 | case WM_CREATE:
|
---|
| 1730 | PostMsg(hwnd,
|
---|
| 1731 | UM_SETUP,
|
---|
| 1732 | MPVOID,
|
---|
| 1733 | MPVOID);
|
---|
| 1734 | break;
|
---|
| 1735 |
|
---|
| 1736 | case UM_SETUP:
|
---|
| 1737 | {
|
---|
| 1738 | RGB2 rgb;
|
---|
| 1739 |
|
---|
| 1740 | memset(&rgb,0,sizeof(rgb));
|
---|
| 1741 | rgb.bRed = 128;
|
---|
| 1742 | SetPresParams(hwnd,
|
---|
| 1743 | &RGBGREY,
|
---|
| 1744 | &rgb,
|
---|
| 1745 | &RGBGREY,
|
---|
| 1746 | GetPString(IDS_8HELVTEXT));
|
---|
| 1747 | SetTargetDir(hwnd,TRUE);
|
---|
| 1748 | }
|
---|
| 1749 | return 0;
|
---|
| 1750 |
|
---|
| 1751 | case WM_SETFOCUS:
|
---|
| 1752 | case UM_FOCUSME:
|
---|
| 1753 | case WM_BUTTON1DOWN:
|
---|
| 1754 | case WM_BUTTON1UP:
|
---|
| 1755 | case WM_BUTTON2DOWN:
|
---|
| 1756 | case WM_BUTTON2UP:
|
---|
| 1757 | case WM_BUTTON3DOWN:
|
---|
| 1758 | case WM_BUTTON3UP:
|
---|
| 1759 | return CommonTextButton(hwnd,msg,mp1,mp2);
|
---|
| 1760 |
|
---|
| 1761 | case WM_MOUSEMOVE:
|
---|
| 1762 | shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
| 1763 | break;
|
---|
| 1764 |
|
---|
| 1765 | case UM_CLICKED:
|
---|
| 1766 | case UM_CLICKED3:
|
---|
| 1767 | PostMsg(hwndMain,
|
---|
| 1768 | WM_COMMAND,
|
---|
| 1769 | MPFROM2SHORT(IDM_SETTARGET,0),
|
---|
| 1770 | MPVOID);
|
---|
| 1771 | return 0;
|
---|
| 1772 |
|
---|
| 1773 | case WM_CHAR:
|
---|
| 1774 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
| 1775 | break;
|
---|
| 1776 |
|
---|
| 1777 | case WM_CONTROLPOINTER:
|
---|
| 1778 | if(!fNoFinger &&
|
---|
| 1779 | (SHORT1FROMMP(mp1) >= IDM_DRIVEA &&
|
---|
| 1780 | SHORT1FROMMP(mp1) < IDM_DRIVEA + 26))
|
---|
| 1781 | return MRFROMLONG(hptrFinger);
|
---|
| 1782 | break;
|
---|
| 1783 |
|
---|
| 1784 | case WM_COMMAND:
|
---|
| 1785 | {
|
---|
| 1786 | CHAR dv[4];
|
---|
| 1787 |
|
---|
| 1788 | *dv = 0;
|
---|
| 1789 | WinQueryWindowText(WinWindowFromID(hwnd,SHORT1FROMMP(mp1) + 50),
|
---|
| 1790 | 2,
|
---|
| 1791 | dv);
|
---|
| 1792 | if(isalpha(*dv)) {
|
---|
| 1793 |
|
---|
| 1794 | HWND hwndActive;
|
---|
| 1795 |
|
---|
| 1796 | dv[1] = ':';
|
---|
| 1797 | dv[2] = '\\';
|
---|
| 1798 | dv[3] = 0;
|
---|
| 1799 | hwndActive = TopWindow(hwnd,(HWND)0);
|
---|
| 1800 | if(hwndActive)
|
---|
| 1801 | WinSendMsg(WinWindowFromID(hwndActive,FID_CLIENT),
|
---|
| 1802 | UM_DRIVECMD,
|
---|
| 1803 | MPFROMP(dv),
|
---|
| 1804 | MPVOID);
|
---|
| 1805 | }
|
---|
| 1806 | }
|
---|
| 1807 | return 0;
|
---|
| 1808 |
|
---|
| 1809 | case WM_PAINT:
|
---|
| 1810 | PaintRecessedWindow(hwnd,
|
---|
| 1811 | (HPS)0,
|
---|
| 1812 | TRUE,
|
---|
| 1813 | FALSE);
|
---|
| 1814 | break;
|
---|
| 1815 |
|
---|
| 1816 | case WM_CLOSE:
|
---|
| 1817 | WinDestroyWindow(hwnd);
|
---|
| 1818 | return 0;
|
---|
| 1819 | }
|
---|
| 1820 | return PFNWPStatic(hwnd,msg,mp1,mp2);
|
---|
| 1821 | }
|
---|
| 1822 |
|
---|
| 1823 |
|
---|
| 1824 | MRESULT EXPENTRY DriveProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
| 1825 |
|
---|
| 1826 | USHORT id;
|
---|
| 1827 | static CHAR dv[4];
|
---|
| 1828 | static BOOL emphasized = FALSE;
|
---|
| 1829 | static HWND hwndMenu = (HWND)0;
|
---|
| 1830 | static USHORT helpid = 0;
|
---|
| 1831 |
|
---|
| 1832 | switch(msg) {
|
---|
| 1833 | case WM_MOUSEMOVE:
|
---|
| 1834 | if(fDrivebarHelp &&
|
---|
| 1835 | (!hwndBubble ||
|
---|
| 1836 | WinQueryWindowULong(hwndBubble,0) != hwnd) &&
|
---|
| 1837 | !WinQueryCapture(HWND_DESKTOP)) {
|
---|
| 1838 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 1839 | if(helpid != id) {
|
---|
| 1840 | helpid = id;
|
---|
| 1841 | PostMsg(MainObjectHwnd,
|
---|
| 1842 | UM_SETUP6,
|
---|
| 1843 | MPFROMLONG((ULONG)hwnd),
|
---|
| 1844 | MPVOID);
|
---|
| 1845 | }
|
---|
| 1846 | else
|
---|
| 1847 | helpid = 0;
|
---|
| 1848 | }
|
---|
| 1849 | break;
|
---|
| 1850 |
|
---|
| 1851 | case UM_SETUP6:
|
---|
| 1852 | if(helpid == WinQueryWindowUShort(hwnd,QWS_ID)) {
|
---|
| 1853 | if((char *)mp1 &&
|
---|
| 1854 | (!hwndBubble ||
|
---|
| 1855 | WinQueryWindowULong(hwndBubble,0) != hwnd) &&
|
---|
| 1856 | !WinQueryCapture(HWND_DESKTOP)) {
|
---|
| 1857 |
|
---|
| 1858 | RECTL rcl;
|
---|
| 1859 | POINTL ptl;
|
---|
| 1860 |
|
---|
| 1861 | WinQueryPointerPos(HWND_DESKTOP,
|
---|
| 1862 | &ptl);
|
---|
| 1863 | WinMapWindowPoints(HWND_DESKTOP,
|
---|
| 1864 | hwnd,
|
---|
| 1865 | &ptl,
|
---|
| 1866 | 1);
|
---|
| 1867 | WinQueryWindowRect(hwnd,&rcl);
|
---|
| 1868 | if(WinPtInRect(WinQueryAnchorBlock(hwnd),
|
---|
| 1869 | &rcl,
|
---|
| 1870 | &ptl))
|
---|
| 1871 | BubbleHelp(hwnd,
|
---|
| 1872 | FALSE,
|
---|
| 1873 | TRUE,
|
---|
| 1874 | FALSE,
|
---|
| 1875 | (char *)mp1);
|
---|
| 1876 | }
|
---|
| 1877 | }
|
---|
| 1878 | return 0;
|
---|
| 1879 |
|
---|
| 1880 | case WM_MENUEND:
|
---|
| 1881 | if(hwndMenu == (HWND)mp2) {
|
---|
| 1882 | WinDestroyWindow(hwndMenu);
|
---|
| 1883 | hwndMenu = (HWND)0;
|
---|
| 1884 | }
|
---|
| 1885 | break;
|
---|
| 1886 |
|
---|
| 1887 | case WM_CONTEXTMENU:
|
---|
| 1888 | if(hwndMenu)
|
---|
| 1889 | WinDestroyWindow(hwndMenu);
|
---|
| 1890 | hwndMenu = (HWND)0;
|
---|
| 1891 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 1892 | *dv = 0;
|
---|
| 1893 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 1894 | id + 50),
|
---|
| 1895 | sizeof(dv),
|
---|
| 1896 | dv);
|
---|
| 1897 | if(isalpha(*dv)) {
|
---|
| 1898 | hwndMenu = WinLoadMenu(HWND_DESKTOP,
|
---|
| 1899 | FM3ModHandle,
|
---|
| 1900 | MAIN_DRIVES);
|
---|
| 1901 | if(hwndMenu) {
|
---|
| 1902 | if(!(driveflags[toupper(*dv) - 'A'] & DRIVE_REMOTE))
|
---|
| 1903 | WinEnableMenuItem(hwndMenu,
|
---|
| 1904 | IDM_DETACH,
|
---|
| 1905 | FALSE);
|
---|
| 1906 | if(driveflags[toupper(*dv) - 'A'] & DRIVE_NOTWRITEABLE) {
|
---|
| 1907 | WinEnableMenuItem(hwndMenu,
|
---|
| 1908 | IDM_MKDIR,
|
---|
| 1909 | FALSE);
|
---|
| 1910 | WinEnableMenuItem(hwndMenu,
|
---|
| 1911 | IDM_FORMAT,
|
---|
| 1912 | FALSE);
|
---|
| 1913 | WinEnableMenuItem(hwndMenu,
|
---|
| 1914 | IDM_OPTIMIZE,
|
---|
| 1915 | FALSE);
|
---|
| 1916 | WinEnableMenuItem(hwndMenu,
|
---|
| 1917 | IDM_UNDELETE,
|
---|
| 1918 | FALSE);
|
---|
| 1919 | }
|
---|
| 1920 | if(!(driveflags[toupper(*dv) - 'A'] & DRIVE_REMOVABLE)) {
|
---|
| 1921 | WinEnableMenuItem(hwndMenu,
|
---|
| 1922 | IDM_EJECT,
|
---|
| 1923 | FALSE);
|
---|
| 1924 | WinEnableMenuItem(hwndMenu,
|
---|
| 1925 | IDM_LOCK,
|
---|
| 1926 | FALSE);
|
---|
| 1927 | WinEnableMenuItem(hwndMenu,
|
---|
| 1928 | IDM_UNLOCK,
|
---|
| 1929 | FALSE);
|
---|
| 1930 | }
|
---|
| 1931 | /*
|
---|
| 1932 | if(!(driveflags[toupper(*dv) - 'A'] & DRIVE_CDROM)) {
|
---|
| 1933 | WinEnableMenuItem(hwndMenu,
|
---|
| 1934 | IDM_CLOSETRAY,
|
---|
| 1935 | FALSE);
|
---|
| 1936 | }
|
---|
| 1937 | */
|
---|
| 1938 | PopupMenu(hwnd,
|
---|
| 1939 | hwnd,
|
---|
| 1940 | hwndMenu);
|
---|
| 1941 | }
|
---|
| 1942 | }
|
---|
| 1943 | return MRFROMSHORT(TRUE);
|
---|
| 1944 |
|
---|
| 1945 | case WM_BUTTON2CLICK:
|
---|
| 1946 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 1947 | if(!(shiftstate & KC_CTRL))
|
---|
| 1948 | break;
|
---|
| 1949 | case WM_CHORD:
|
---|
| 1950 | case WM_BUTTON3CLICK:
|
---|
| 1951 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 1952 | *dv = 0;
|
---|
| 1953 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 1954 | id + 50),
|
---|
| 1955 | sizeof(dv),
|
---|
| 1956 | dv);
|
---|
| 1957 | if(isalpha(*dv)) {
|
---|
| 1958 | strcat(dv,"\\");
|
---|
| 1959 | if(!FindDirCnrByName(dv,TRUE))
|
---|
| 1960 | OpenDirCnr((HWND)0,
|
---|
| 1961 | hwndMain,
|
---|
| 1962 | hwndTree,
|
---|
| 1963 | FALSE,
|
---|
| 1964 | dv);
|
---|
| 1965 | }
|
---|
| 1966 | break;
|
---|
| 1967 |
|
---|
| 1968 | case WM_COMMAND:
|
---|
| 1969 | PostMsg(hwnd,UM_COMMAND,mp1,mp2);
|
---|
| 1970 | return 0;
|
---|
| 1971 |
|
---|
| 1972 | case UM_COMMAND:
|
---|
| 1973 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 1974 | *dv = 0;
|
---|
| 1975 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 1976 | id + 50),
|
---|
| 1977 | sizeof(dv),
|
---|
| 1978 | dv);
|
---|
| 1979 | if(isalpha(*dv)) {
|
---|
| 1980 | strcat(dv,"\\");
|
---|
| 1981 | CommonDriveCmd(hwnd,dv,SHORT1FROMMP(mp1));
|
---|
| 1982 | }
|
---|
| 1983 | return 0;
|
---|
| 1984 |
|
---|
| 1985 | case DM_DRAGOVER:
|
---|
| 1986 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 1987 | *dv = 0;
|
---|
| 1988 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 1989 | id + 50),
|
---|
| 1990 | sizeof(dv),
|
---|
| 1991 | dv);
|
---|
| 1992 | if(isalpha(*dv) &&
|
---|
| 1993 | !(driveflags[toupper(*dv) - 'A'] & DRIVE_NOTWRITEABLE)) {
|
---|
| 1994 | if(!emphasized) {
|
---|
| 1995 | emphasized = TRUE;
|
---|
| 1996 | DrawTargetEmphasis(hwnd,emphasized);
|
---|
| 1997 | }
|
---|
| 1998 | if(AcceptOneDrop(mp1,mp2))
|
---|
| 1999 | return MRFROM2SHORT(DOR_DROP,
|
---|
| 2000 | DO_MOVE);
|
---|
| 2001 | return MRFROM2SHORT(DOR_NEVERDROP,0);
|
---|
| 2002 | }
|
---|
| 2003 | break;
|
---|
| 2004 |
|
---|
| 2005 | case DM_DRAGLEAVE:
|
---|
| 2006 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 2007 | *dv = 0;
|
---|
| 2008 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 2009 | id + 50),
|
---|
| 2010 | sizeof(dv),
|
---|
| 2011 | dv);
|
---|
| 2012 | if(isalpha(*dv) &&
|
---|
| 2013 | !(driveflags[toupper(*dv) - 'A'] & DRIVE_NOTWRITEABLE)) {
|
---|
| 2014 | if(emphasized) {
|
---|
| 2015 | emphasized = FALSE;
|
---|
| 2016 | DrawTargetEmphasis(hwnd,emphasized);
|
---|
| 2017 | }
|
---|
| 2018 | }
|
---|
| 2019 | break;
|
---|
| 2020 |
|
---|
| 2021 | case DM_DROPHELP:
|
---|
| 2022 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 2023 | *dv = 0;
|
---|
| 2024 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 2025 | id + 50),sizeof(dv),dv);
|
---|
| 2026 | if(isalpha(*dv) &&
|
---|
| 2027 | !(driveflags[toupper(*dv) - 'A'] & DRIVE_NOTWRITEABLE)) {
|
---|
| 2028 | DropHelp(mp1,mp2,hwnd,GetPString(IDS_DRIVEDROPHELP));
|
---|
| 2029 | return 0;
|
---|
| 2030 | }
|
---|
| 2031 | break;
|
---|
| 2032 |
|
---|
| 2033 | case DM_DROP:
|
---|
| 2034 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 2035 | *dv = 0;
|
---|
| 2036 | WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 2037 | id + 50),
|
---|
| 2038 | sizeof(dv),
|
---|
| 2039 | dv);
|
---|
| 2040 | if(isalpha(*dv) &&
|
---|
| 2041 | !(driveflags[toupper(*dv) - 'A'] & DRIVE_NOTWRITEABLE)) {
|
---|
| 2042 |
|
---|
| 2043 | CNRDRAGINFO cnd;
|
---|
| 2044 | LISTINFO *li;
|
---|
[36] | 2045 | ULONG action = UM_ACTION;
|
---|
[2] | 2046 |
|
---|
| 2047 |
|
---|
| 2048 | if(emphasized) {
|
---|
| 2049 | emphasized = FALSE;
|
---|
| 2050 | DrawTargetEmphasis(hwnd,emphasized);
|
---|
| 2051 | }
|
---|
| 2052 | memset(&cnd,0,sizeof(cnd));
|
---|
| 2053 | cnd.pDragInfo = (PDRAGINFO)mp1;
|
---|
| 2054 | cnd.pRecord = NULL;
|
---|
| 2055 | li = DoFileDrop(hwnd,
|
---|
| 2056 | NULL,
|
---|
| 2057 | TRUE,
|
---|
| 2058 | MPFROM2SHORT(TREE_CNR,CN_DROP),
|
---|
| 2059 | MPFROMP(&cnd));
|
---|
| 2060 | if(li) {
|
---|
| 2061 | strcpy(li->targetpath,dv);
|
---|
| 2062 | strcat(li->targetpath,"\\");
|
---|
| 2063 | if(li->list &&
|
---|
| 2064 | li->list[0] &&
|
---|
| 2065 | IsRoot(li->list[0]))
|
---|
| 2066 | li->type = DO_LINK;
|
---|
| 2067 | else if(fDragndropDlg &&
|
---|
| 2068 | (!*li->arcname || !li->info)) {
|
---|
| 2069 |
|
---|
| 2070 | CHECKLIST cl;
|
---|
| 2071 |
|
---|
| 2072 | memset(&cl,0,sizeof(cl));
|
---|
| 2073 | cl.size = sizeof(cl);
|
---|
| 2074 | cl.flags = li->type;
|
---|
| 2075 | cl.list = li->list;
|
---|
| 2076 | cl.cmd = li->type;
|
---|
| 2077 | cl.prompt = li->targetpath;
|
---|
| 2078 | li->type = WinDlgBox(HWND_DESKTOP,
|
---|
| 2079 | hwndMain,
|
---|
| 2080 | DropListProc,
|
---|
| 2081 | FM3ModHandle,
|
---|
| 2082 | DND_FRAME,
|
---|
| 2083 | MPFROMP(&cl));
|
---|
| 2084 | if(!li->type) {
|
---|
| 2085 | FreeListInfo(li);
|
---|
| 2086 | return 0;
|
---|
| 2087 | }
|
---|
| 2088 | li->list = cl.list;
|
---|
| 2089 | if(!li->list || !li->list[0]) {
|
---|
| 2090 | FreeListInfo(li);
|
---|
| 2091 | return 0;
|
---|
| 2092 | }
|
---|
| 2093 | }
|
---|
| 2094 | else {
|
---|
| 2095 | if(!WinDlgBox(HWND_DESKTOP,
|
---|
| 2096 | hwndMain,
|
---|
| 2097 | WalkDlgProc,
|
---|
| 2098 | FM3ModHandle,
|
---|
| 2099 | WALK_FRAME,
|
---|
| 2100 | MPFROMP(li->targetpath)) ||
|
---|
| 2101 | !*li->targetpath) {
|
---|
| 2102 | FreeListInfo(li);
|
---|
| 2103 | return 0;
|
---|
| 2104 | }
|
---|
| 2105 | }
|
---|
| 2106 | switch(li->type) {
|
---|
| 2107 | case DND_LAUNCH:
|
---|
| 2108 | strcat(li->targetpath," %a");
|
---|
| 2109 | ExecOnList(hwndMain,
|
---|
| 2110 | li->targetpath,
|
---|
| 2111 | PROMPT | WINDOWED,
|
---|
| 2112 | NULL,
|
---|
| 2113 | li->list,
|
---|
| 2114 | NULL);
|
---|
| 2115 | FreeList(li->list);
|
---|
| 2116 | li->list = NULL;
|
---|
| 2117 | break;
|
---|
| 2118 | case DO_LINK:
|
---|
| 2119 | if(fLinkSetsIcon) {
|
---|
| 2120 | li->type = IDM_SETICON;
|
---|
| 2121 | action = UM_MASSACTION;
|
---|
| 2122 | }
|
---|
| 2123 | else
|
---|
| 2124 | li->type = IDM_COMPARE;
|
---|
| 2125 | break;
|
---|
| 2126 | case DND_EXTRACT:
|
---|
| 2127 | if(*li->targetpath &&
|
---|
| 2128 | !IsFile(li->targetpath))
|
---|
| 2129 | li->type = IDM_EXTRACT;
|
---|
| 2130 | break;
|
---|
| 2131 | case DND_MOVE:
|
---|
| 2132 | li->type = IDM_MOVE;
|
---|
| 2133 | if(*li->targetpath &&
|
---|
| 2134 | IsFile(li->targetpath) == 1) {
|
---|
| 2135 | action = UM_MASSACTION;
|
---|
| 2136 | li->type = IDM_ARCHIVEM;
|
---|
| 2137 | }
|
---|
| 2138 | break;
|
---|
| 2139 | case DND_WILDMOVE:
|
---|
| 2140 | li->type = IDM_WILDMOVE;
|
---|
| 2141 | if(*li->targetpath &&
|
---|
| 2142 | IsFile(li->targetpath) == 1) {
|
---|
| 2143 | action = UM_MASSACTION;
|
---|
| 2144 | li->type = IDM_ARCHIVEM;
|
---|
| 2145 | }
|
---|
| 2146 | break;
|
---|
| 2147 | case DND_OBJECT:
|
---|
| 2148 | li->type = IDM_OBJECT;
|
---|
| 2149 | action = UM_MASSACTION;
|
---|
| 2150 | break;
|
---|
| 2151 | case DND_SHADOW:
|
---|
| 2152 | li->type = IDM_SHADOW;
|
---|
| 2153 | action = UM_MASSACTION;
|
---|
| 2154 | break;
|
---|
| 2155 | case DND_COMPARE:
|
---|
| 2156 | li->type = IDM_COMPARE;
|
---|
| 2157 | break;
|
---|
| 2158 | case DND_SETICON:
|
---|
| 2159 | action = UM_MASSACTION;
|
---|
| 2160 | li->type = IDM_SETICON;
|
---|
| 2161 | break;
|
---|
| 2162 | case DND_COPY:
|
---|
| 2163 | li->type = IDM_COPY;
|
---|
| 2164 | if(*li->targetpath &&
|
---|
| 2165 | IsFile(li->targetpath) == 1) {
|
---|
| 2166 | action = UM_MASSACTION;
|
---|
| 2167 | li->type = IDM_ARCHIVE;
|
---|
| 2168 | }
|
---|
| 2169 | break;
|
---|
| 2170 | case DND_WILDCOPY:
|
---|
| 2171 | li->type = IDM_WILDCOPY;
|
---|
| 2172 | if(*li->targetpath &&
|
---|
| 2173 | IsFile(li->targetpath) == 1) {
|
---|
| 2174 | action = UM_MASSACTION;
|
---|
| 2175 | li->type = IDM_ARCHIVE;
|
---|
| 2176 | }
|
---|
| 2177 | break;
|
---|
| 2178 | default:
|
---|
| 2179 | if(*li->arcname && li->info) {
|
---|
| 2180 | action = UM_MASSACTION;
|
---|
| 2181 | li->type = (li->type == DO_MOVE) ? IDM_FAKEEXTRACTM :
|
---|
| 2182 | IDM_FAKEEXTRACT;
|
---|
| 2183 | }
|
---|
| 2184 | else if(*li->targetpath && IsFile(li->targetpath) == 1) {
|
---|
| 2185 | action = UM_MASSACTION;
|
---|
| 2186 | li->type = (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE;
|
---|
| 2187 | }
|
---|
| 2188 | else
|
---|
| 2189 | li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY;
|
---|
| 2190 | break;
|
---|
| 2191 | }
|
---|
| 2192 | if(!li->list || !li->list[0])
|
---|
| 2193 | FreeListInfo(li);
|
---|
| 2194 | else
|
---|
| 2195 | WinSendMsg(hwndTree,
|
---|
| 2196 | UM_ACTION,
|
---|
| 2197 | MPFROMP(li),
|
---|
| 2198 | MPFROMLONG(action));
|
---|
| 2199 | }
|
---|
| 2200 | return 0;
|
---|
| 2201 | }
|
---|
| 2202 | break;
|
---|
| 2203 |
|
---|
| 2204 | case WM_DESTROY:
|
---|
| 2205 | if(hwndMenu)
|
---|
| 2206 | WinDestroyWindow(hwndMenu);
|
---|
| 2207 | hwndMenu = (HWND)0;
|
---|
| 2208 | break;
|
---|
| 2209 | }
|
---|
| 2210 | return PFNWPButton(hwnd,msg,mp1,mp2);
|
---|
| 2211 | }
|
---|
| 2212 |
|
---|
| 2213 |
|
---|
| 2214 | VOID BuildDrives (HWND hwndT) {
|
---|
| 2215 |
|
---|
| 2216 | register ULONG x,y = 0;
|
---|
| 2217 | ULONG ulDriveNum,ulDriveMap,iconid;
|
---|
| 2218 | CHAR s[8];
|
---|
| 2219 | HENUM henum;
|
---|
| 2220 | HWND hwndB;
|
---|
| 2221 |
|
---|
| 2222 | henum = WinBeginEnumWindows(hwndT);
|
---|
| 2223 | while((hwndB = WinGetNextWindow(henum)) != NULLHANDLE)
|
---|
| 2224 | WinDestroyWindow(hwndB);
|
---|
| 2225 | WinEndEnumWindows(henum);
|
---|
| 2226 | if(fDrivebar) {
|
---|
| 2227 | DosError(FERR_DISABLEHARDERR);
|
---|
| 2228 | DosQCurDisk(&ulDriveNum,&ulDriveMap);
|
---|
| 2229 | for(x = 0;x < 26;x++) {
|
---|
| 2230 | if((ulDriveMap & (1L << x)) &&
|
---|
| 2231 | !(driveflags[x] & DRIVE_IGNORE)) {
|
---|
| 2232 | if(x > 1) {
|
---|
| 2233 | if(driveflags[x] & DRIVE_CDROM)
|
---|
| 2234 | iconid = CDROM_ICON;
|
---|
| 2235 | else
|
---|
| 2236 | iconid = (driveflags[x] & DRIVE_REMOVABLE) ?
|
---|
| 2237 | REMOVABLE_ICON :
|
---|
| 2238 | (driveflags[x] & DRIVE_REMOTE) ?
|
---|
| 2239 | REMOTE_ICON :
|
---|
| 2240 | (driveflags[x] & DRIVE_ZIPSTREAM) ?
|
---|
| 2241 | DRIVE_ICON :
|
---|
| 2242 | DRIVE_ICON;
|
---|
| 2243 | }
|
---|
| 2244 | else
|
---|
| 2245 | iconid = FLOPPY_ICON;
|
---|
| 2246 | sprintf(s,"#%lu",iconid);
|
---|
| 2247 | hwndB = WinCreateWindow(hwndT,
|
---|
| 2248 | GetPString(IDS_WCDRIVEBUTTONS),
|
---|
| 2249 | s,
|
---|
| 2250 | BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON,
|
---|
| 2251 | 0,
|
---|
| 2252 | 0,
|
---|
| 2253 | 28,
|
---|
| 2254 | 18,
|
---|
| 2255 | hwndT,
|
---|
| 2256 | HWND_TOP,
|
---|
| 2257 | y + IDM_DRIVEA,
|
---|
| 2258 | NULL,
|
---|
| 2259 | NULL);
|
---|
| 2260 | if(hwndB) {
|
---|
| 2261 | WinSetWindowPos(hwndB,
|
---|
| 2262 | HWND_BOTTOM,
|
---|
| 2263 | 0,
|
---|
| 2264 | 0,
|
---|
| 2265 | 0,
|
---|
| 2266 | 0,
|
---|
| 2267 | SWP_ZORDER);
|
---|
| 2268 | sprintf(s,"%c:",(CHAR)x + 'A');
|
---|
| 2269 | hwndB = WinCreateWindow(hwndT,
|
---|
| 2270 | WC_STATIC,
|
---|
| 2271 | s,
|
---|
| 2272 | SS_TEXT | DT_LEFT | DT_VCENTER,
|
---|
| 2273 | 0,
|
---|
| 2274 | 0,
|
---|
| 2275 | 10,
|
---|
| 2276 | 18,
|
---|
| 2277 | hwndT,
|
---|
| 2278 | HWND_TOP,
|
---|
| 2279 | y + IDM_DRIVEATEXT,
|
---|
| 2280 | NULL,
|
---|
| 2281 | NULL);
|
---|
| 2282 | if(hwndB) {
|
---|
| 2283 | SetPresParams(hwndB,
|
---|
| 2284 | &RGBGREY,
|
---|
| 2285 | &RGBBLACK,
|
---|
| 2286 | &RGBGREY,
|
---|
| 2287 | GetPString(IDS_6HELVTEXT));
|
---|
| 2288 | WinSetWindowPos(hwndB,
|
---|
| 2289 | HWND_BOTTOM,
|
---|
| 2290 | 0,
|
---|
| 2291 | 0,
|
---|
| 2292 | 0,
|
---|
| 2293 | 0,
|
---|
| 2294 | SWP_ZORDER);
|
---|
| 2295 | }
|
---|
| 2296 | y++;
|
---|
| 2297 | }
|
---|
| 2298 | }
|
---|
| 2299 | }
|
---|
| 2300 | }
|
---|
| 2301 | PostMsg(WinQueryWindow(hwndT,QW_PARENT),
|
---|
| 2302 | WM_UPDATEFRAME,
|
---|
| 2303 | MPFROMLONG(FCF_SIZEBORDER),
|
---|
| 2304 | MPVOID);
|
---|
| 2305 | }
|
---|
| 2306 |
|
---|
| 2307 |
|
---|
| 2308 | VOID ResizeDrives (HWND hwndT,long xwidth) {
|
---|
| 2309 |
|
---|
| 2310 | register ULONG ctrlxpos = 2,ctrlypos = 0,ctrlxsize;
|
---|
| 2311 | HENUM henum;
|
---|
| 2312 | HWND hwndB;
|
---|
| 2313 | RECTL rcl;
|
---|
| 2314 |
|
---|
| 2315 | DriveLines = 0;
|
---|
| 2316 | if(!fDrivebar)
|
---|
| 2317 | return;
|
---|
| 2318 | if(!xwidth) {
|
---|
| 2319 | WinQueryWindowRect(hwndT,&rcl);
|
---|
| 2320 | xwidth = rcl.xRight - ((WinQuerySysValue(HWND_DESKTOP,
|
---|
| 2321 | SV_CYSIZEBORDER) * 2) + 2);
|
---|
| 2322 | }
|
---|
| 2323 | henum = WinBeginEnumWindows(hwndT);
|
---|
| 2324 | while((hwndB = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
| 2325 | if(WinQueryWindowUShort(hwndB,QWS_ID) > IDM_DRIVEA + 27)
|
---|
| 2326 | ctrlxsize = 10;
|
---|
| 2327 | else
|
---|
| 2328 | ctrlxsize = 28;
|
---|
| 2329 | WinSetWindowPos(hwndB,
|
---|
| 2330 | HWND_TOP,
|
---|
| 2331 | ctrlxpos,
|
---|
| 2332 | ctrlypos,
|
---|
| 2333 | ctrlxsize,
|
---|
| 2334 | 18,
|
---|
| 2335 | SWP_MOVE | SWP_SHOW);
|
---|
| 2336 | ctrlxpos += (ctrlxsize + 2);
|
---|
| 2337 | if(ctrlxsize == 10) {
|
---|
| 2338 | if(ctrlxpos + (42 + ((fShowTarget && DriveLines == 0) ?
|
---|
| 2339 | 256 :
|
---|
| 2340 | 0)) > xwidth) {
|
---|
| 2341 | ctrlxpos = 2;
|
---|
| 2342 | ctrlypos += 18;
|
---|
| 2343 | DriveLines++;
|
---|
| 2344 | }
|
---|
| 2345 | }
|
---|
| 2346 | }
|
---|
| 2347 | if(ctrlxpos == 2 && DriveLines)
|
---|
| 2348 | DriveLines--;
|
---|
| 2349 | }
|
---|
| 2350 |
|
---|
| 2351 |
|
---|
| 2352 | MRESULT EXPENTRY StatusProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
| 2353 |
|
---|
| 2354 | static HWND hwndE = (HWND)0,hwndB = (HWND)0;
|
---|
| 2355 | static CHAR lastcmd[1024] = "";
|
---|
| 2356 |
|
---|
| 2357 | switch(msg) {
|
---|
| 2358 | case WM_CREATE:
|
---|
| 2359 | {
|
---|
| 2360 | MRESULT mr = PFNWPStatic(hwnd,msg,mp1,mp2);
|
---|
| 2361 |
|
---|
| 2362 | SetPresParams(hwnd,
|
---|
| 2363 | &RGBGREY,
|
---|
| 2364 | &RGBBLACK,
|
---|
| 2365 | &RGBGREY,
|
---|
| 2366 | GetPString(IDS_8HELVBOLDTEXT));
|
---|
| 2367 | return mr;
|
---|
| 2368 | }
|
---|
| 2369 |
|
---|
| 2370 | case WM_PRESPARAMCHANGED:
|
---|
| 2371 | if(fRunning) {
|
---|
| 2372 |
|
---|
| 2373 | ULONG AttrFound,AttrValue[64],cbRetLen;
|
---|
| 2374 |
|
---|
| 2375 | cbRetLen = WinQueryPresParam(hwnd,
|
---|
| 2376 | (ULONG)mp1,
|
---|
| 2377 | 0,
|
---|
| 2378 | &AttrFound,
|
---|
| 2379 | (ULONG)sizeof(AttrValue),
|
---|
| 2380 | &AttrValue,0);
|
---|
| 2381 | if(cbRetLen) {
|
---|
| 2382 | switch(AttrFound) {
|
---|
| 2383 | case PP_FONTNAMESIZE:
|
---|
| 2384 | PostMsg(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 2385 | WM_UPDATEFRAME,
|
---|
| 2386 | MPFROMLONG(FCF_SIZEBORDER),
|
---|
| 2387 | MPVOID);
|
---|
| 2388 | break;
|
---|
| 2389 | }
|
---|
| 2390 | }
|
---|
| 2391 | }
|
---|
| 2392 | break;
|
---|
| 2393 |
|
---|
| 2394 | case WM_CONTEXTMENU:
|
---|
| 2395 | PostMsg(hwndMain,
|
---|
| 2396 | UM_CONTEXTMENU,
|
---|
| 2397 | MPVOID,
|
---|
| 2398 | MPVOID);
|
---|
| 2399 | return MRFROMSHORT(TRUE);
|
---|
| 2400 |
|
---|
| 2401 | case WM_BEGINDRAG:
|
---|
| 2402 | if(hwndTree) {
|
---|
| 2403 |
|
---|
| 2404 | SWP swp;
|
---|
| 2405 | ULONG fl = SWP_ACTIVATE | SWP_SHOW | SWP_ZORDER;
|
---|
| 2406 |
|
---|
| 2407 | WinQueryWindowPos(hwndTree,&swp);
|
---|
| 2408 | if(!(swp.fl & SWP_MAXIMIZE))
|
---|
| 2409 | fl |= SWP_RESTORE;
|
---|
| 2410 | WinSetWindowPos(hwndTree,HWND_TOP,0,0,0,0,fl);
|
---|
| 2411 | }
|
---|
| 2412 | break;
|
---|
| 2413 |
|
---|
| 2414 | case UM_SETUP:
|
---|
| 2415 | if(mp1)
|
---|
| 2416 | strcpy(lastcmd,(CHAR *)mp1);
|
---|
| 2417 | return 0;
|
---|
| 2418 |
|
---|
| 2419 | case UM_RESCAN:
|
---|
| 2420 | if(hwndE &&
|
---|
| 2421 | WinIsWindow(WinQueryAnchorBlock(hwnd),hwndE))
|
---|
| 2422 | WinDestroyWindow(hwndE);
|
---|
| 2423 | if(hwndB &&
|
---|
| 2424 | WinIsWindow(WinQueryAnchorBlock(hwnd),hwndB))
|
---|
| 2425 | WinDestroyWindow(hwndB);
|
---|
| 2426 | hwndE = hwndB = (HWND)0;
|
---|
| 2427 | return 0;
|
---|
| 2428 |
|
---|
| 2429 | case WM_COMMAND:
|
---|
| 2430 | switch(SHORT1FROMMP(mp1)) {
|
---|
| 2431 | case COMMAND_BUTTON:
|
---|
| 2432 | PostMsg(hwndE,msg,mp1,mp2);
|
---|
| 2433 | break;
|
---|
| 2434 | }
|
---|
| 2435 | return 0;
|
---|
| 2436 |
|
---|
| 2437 | case WM_MOUSEMOVE:
|
---|
| 2438 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 2439 | {
|
---|
| 2440 | USHORT id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 2441 | char *s = NULL;
|
---|
| 2442 |
|
---|
| 2443 | if(fOtherHelp) {
|
---|
| 2444 | if((!hwndBubble || WinQueryWindowULong(hwndBubble,0) != hwnd) &&
|
---|
| 2445 | !WinQueryCapture(HWND_DESKTOP)) {
|
---|
| 2446 | switch(id) {
|
---|
| 2447 | case IDM_ATTRS:
|
---|
| 2448 | if(WinQueryWindowTextLength(hwnd))
|
---|
| 2449 | s = GetPString(IDS_ATTRSBUTTONHELP);
|
---|
| 2450 | break;
|
---|
| 2451 | case IDM_INFO:
|
---|
| 2452 | if(WinQueryWindowTextLength(hwnd))
|
---|
| 2453 | s = GetPString(IDS_INFOBUTTONHELP);
|
---|
| 2454 | break;
|
---|
| 2455 | case IDM_RENAME:
|
---|
| 2456 | if(WinQueryWindowTextLength(hwnd))
|
---|
| 2457 | s = GetPString(IDS_NAMEBUTTONHELP);
|
---|
| 2458 | break;
|
---|
| 2459 | case MAIN_STATUS2:
|
---|
| 2460 | if(!hwndE)
|
---|
| 2461 | s = GetPString(IDS_STATUS2HELP);
|
---|
| 2462 | break;
|
---|
| 2463 | default:
|
---|
| 2464 | break;
|
---|
| 2465 | }
|
---|
| 2466 | if(s)
|
---|
| 2467 | MakeBubble(hwnd,FALSE,s);
|
---|
| 2468 | else if(hwndBubble)
|
---|
| 2469 | WinDestroyWindow(hwndBubble);
|
---|
| 2470 | }
|
---|
| 2471 | }
|
---|
| 2472 | switch(id) {
|
---|
| 2473 | case IDM_ATTRS:
|
---|
| 2474 | case IDM_INFO:
|
---|
| 2475 | case IDM_RENAME:
|
---|
| 2476 | case MAIN_STATUS2:
|
---|
| 2477 | return CommonTextProc(hwnd,msg,mp1,mp2);
|
---|
| 2478 | default:
|
---|
| 2479 | break;
|
---|
| 2480 | }
|
---|
| 2481 | }
|
---|
| 2482 | break;
|
---|
| 2483 |
|
---|
| 2484 | case WM_BUTTON2DOWN:
|
---|
| 2485 | case WM_BUTTON2UP:
|
---|
| 2486 | case UM_FOCUSME:
|
---|
| 2487 | return CommonTextButton(hwnd,msg,mp1,mp2);
|
---|
| 2488 |
|
---|
| 2489 | case WM_BUTTON1DOWN:
|
---|
| 2490 | case WM_BUTTON1UP:
|
---|
| 2491 | case WM_BUTTON3DOWN:
|
---|
| 2492 | case WM_BUTTON3UP:
|
---|
| 2493 | {
|
---|
| 2494 | USHORT id;
|
---|
| 2495 |
|
---|
| 2496 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 2497 | switch(id) {
|
---|
| 2498 | case IDM_ATTRS:
|
---|
| 2499 | case IDM_INFO:
|
---|
| 2500 | case IDM_RENAME:
|
---|
| 2501 | case MAIN_STATUS2:
|
---|
| 2502 | return CommonTextButton(hwnd,msg,mp1,mp2);
|
---|
| 2503 | default:
|
---|
| 2504 | PostMsg(hwnd,
|
---|
| 2505 | UM_FOCUSME,
|
---|
| 2506 | MPVOID,
|
---|
| 2507 | MPVOID);
|
---|
| 2508 | break;
|
---|
| 2509 | }
|
---|
| 2510 | }
|
---|
| 2511 | break;
|
---|
| 2512 |
|
---|
| 2513 | case WM_SETFOCUS:
|
---|
| 2514 | if(mp2) {
|
---|
| 2515 |
|
---|
| 2516 | USHORT id;
|
---|
| 2517 |
|
---|
| 2518 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 2519 | if(id == MAIN_STATUS2 &&
|
---|
| 2520 | hwndE)
|
---|
| 2521 | WinSendMsg(hwnd,
|
---|
| 2522 | UM_RESCAN,
|
---|
| 2523 | MPVOID,
|
---|
| 2524 | MPVOID);
|
---|
| 2525 | else
|
---|
| 2526 | return CommonTextButton(hwnd,msg,mp1,mp2);
|
---|
| 2527 | }
|
---|
| 2528 | break;
|
---|
| 2529 |
|
---|
| 2530 | case WM_BUTTON1CLICK:
|
---|
| 2531 | {
|
---|
| 2532 | USHORT id;
|
---|
| 2533 |
|
---|
| 2534 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 2535 | if(id == MAIN_STATUS) {
|
---|
| 2536 | if(SHORT2FROMMP(mp2) & KC_CTRL)
|
---|
| 2537 | PostMsg(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 2538 | FID_CLIENT),
|
---|
| 2539 | WM_COMMAND,
|
---|
| 2540 | MPFROM2SHORT(IDM_WINDOWDLG,0),
|
---|
| 2541 | MPVOID);
|
---|
| 2542 | else if(hwndTree)
|
---|
| 2543 | PostMsg(hwndTree,
|
---|
| 2544 | UM_TIMER,
|
---|
| 2545 | MPVOID,
|
---|
| 2546 | MPVOID);
|
---|
| 2547 | }
|
---|
| 2548 | }
|
---|
| 2549 | break;
|
---|
| 2550 |
|
---|
| 2551 | case UM_CLICKED:
|
---|
| 2552 | case UM_CLICKED3:
|
---|
| 2553 | {
|
---|
| 2554 | USHORT id;
|
---|
| 2555 |
|
---|
| 2556 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 2557 | if(id == MAIN_STATUS2 &&
|
---|
| 2558 | !hwndE) {
|
---|
| 2559 |
|
---|
| 2560 | SWP swp;
|
---|
| 2561 | CHAR directory[CCHMAXPATH];
|
---|
| 2562 | PFNWP oldproce;
|
---|
| 2563 |
|
---|
| 2564 | *directory = 0;
|
---|
| 2565 | TopWindowName(hwndMain,(HWND)0,directory);
|
---|
| 2566 | WinQueryWindowPos(hwnd,&swp);
|
---|
| 2567 | hwndB = WinCreateWindow(hwnd,
|
---|
| 2568 | WC_BUTTON,
|
---|
| 2569 | "+",
|
---|
| 2570 | WS_VISIBLE | BS_PUSHBUTTON |
|
---|
| 2571 | BS_NOPOINTERFOCUS,
|
---|
| 2572 | swp.cx - swp.cy,
|
---|
| 2573 | 0,
|
---|
| 2574 | swp.cy,
|
---|
| 2575 | swp.cy,
|
---|
| 2576 | hwnd,
|
---|
| 2577 | HWND_TOP,
|
---|
| 2578 | COMMAND_BUTTON,
|
---|
| 2579 | NULL,
|
---|
| 2580 | NULL);
|
---|
| 2581 | hwndE = WinCreateWindow(hwnd,
|
---|
| 2582 | WC_ENTRYFIELD,
|
---|
| 2583 | NULL,
|
---|
| 2584 | WS_VISIBLE | ES_AUTOSCROLL,
|
---|
| 2585 | 0,
|
---|
| 2586 | 0,
|
---|
| 2587 | swp.cx - swp.cy,
|
---|
| 2588 | swp.cy,
|
---|
| 2589 | hwnd,
|
---|
| 2590 | HWND_TOP,
|
---|
| 2591 | COMMAND_LINE,
|
---|
| 2592 | NULL,
|
---|
| 2593 | NULL);
|
---|
| 2594 | if(!hwndE || !hwndB) {
|
---|
| 2595 | PostMsg(hwnd,
|
---|
| 2596 | UM_RESCAN,
|
---|
| 2597 | MPVOID,
|
---|
| 2598 | MPVOID);
|
---|
| 2599 | return 0;
|
---|
| 2600 | }
|
---|
| 2601 | WinSendMsg(hwndE,
|
---|
| 2602 | EM_SETTEXTLIMIT,
|
---|
| 2603 | MPFROM2SHORT(1024,0),
|
---|
| 2604 | MPVOID);
|
---|
| 2605 | WinSetWindowText(hwndStatus,
|
---|
| 2606 | directory);
|
---|
| 2607 | if(*lastcmd)
|
---|
| 2608 | WinSetWindowText(hwndE,
|
---|
| 2609 | lastcmd);
|
---|
| 2610 | else
|
---|
| 2611 | WinSetWindowText(hwndE,
|
---|
| 2612 | GetPString(IDS_HELPCMDTEXT));
|
---|
| 2613 | oldproce = WinSubclassWindow(hwndE,
|
---|
| 2614 | (PFNWP)CommandLineProc);
|
---|
| 2615 | if(oldproce)
|
---|
| 2616 | WinSetWindowPtr(hwndE,
|
---|
| 2617 | 0,
|
---|
| 2618 | (PVOID)oldproce);
|
---|
| 2619 | PostMsg(hwndE,
|
---|
| 2620 | UM_FOCUSME,
|
---|
| 2621 | MPVOID,
|
---|
| 2622 | MPVOID);
|
---|
| 2623 | PostMsg(hwndE,
|
---|
| 2624 | EM_SETSEL,
|
---|
| 2625 | MPFROM2SHORT(0,1024),
|
---|
| 2626 | MPVOID);
|
---|
| 2627 | return 0;
|
---|
| 2628 | }
|
---|
| 2629 | if(msg == UM_CLICKED3 ||
|
---|
| 2630 | (SHORT2FROMMP(mp2) & KC_CTRL)) {
|
---|
| 2631 | switch(id) {
|
---|
| 2632 | case IDM_ATTRS:
|
---|
| 2633 | id = IDM_SORTSIZE;
|
---|
| 2634 | break;
|
---|
| 2635 | case IDM_INFO:
|
---|
| 2636 | id = IDM_SORTLWDATE;
|
---|
| 2637 | break;
|
---|
| 2638 | case IDM_RENAME:
|
---|
| 2639 | id = IDM_SORTFILENAME;
|
---|
| 2640 | break;
|
---|
| 2641 | }
|
---|
| 2642 | }
|
---|
| 2643 | PostMsg(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 2644 | WM_COMMAND,
|
---|
| 2645 | MPFROM2SHORT(id,0),
|
---|
| 2646 | MPVOID);
|
---|
| 2647 | }
|
---|
| 2648 | return 0;
|
---|
| 2649 |
|
---|
| 2650 | case WM_PAINT:
|
---|
| 2651 | {
|
---|
| 2652 | USHORT id;
|
---|
| 2653 |
|
---|
| 2654 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 2655 | switch(id) {
|
---|
| 2656 | case IDM_ATTRS:
|
---|
| 2657 | case IDM_INFO:
|
---|
| 2658 | case IDM_RENAME:
|
---|
| 2659 | case MAIN_STATUS2:
|
---|
| 2660 | PaintRecessedWindow(hwnd,(HPS)0,TRUE,FALSE);
|
---|
| 2661 | break;
|
---|
| 2662 | default:
|
---|
| 2663 | PaintRecessedWindow(hwnd,(HPS)0,FALSE,TRUE);
|
---|
| 2664 | break;
|
---|
| 2665 | }
|
---|
| 2666 | if(id == IDM_RENAME) {
|
---|
| 2667 |
|
---|
| 2668 | HPS hps;
|
---|
| 2669 |
|
---|
| 2670 | hps = WinBeginPaint(hwnd,(HPS)0,NULL);
|
---|
| 2671 | if(hps) {
|
---|
| 2672 | PaintSTextWindow(hwnd,hps);
|
---|
| 2673 | WinEndPaint(hps);
|
---|
| 2674 | }
|
---|
| 2675 | return 0;
|
---|
| 2676 | }
|
---|
| 2677 | }
|
---|
| 2678 | break;
|
---|
| 2679 |
|
---|
| 2680 | }
|
---|
| 2681 | return PFNWPStatic(hwnd,msg,mp1,mp2);
|
---|
| 2682 | }
|
---|
| 2683 |
|
---|
| 2684 |
|
---|
| 2685 | MRESULT EXPENTRY ToolBackProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
| 2686 |
|
---|
| 2687 | switch(msg) {
|
---|
| 2688 | case WM_CREATE:
|
---|
| 2689 | hwndToolback = hwnd;
|
---|
| 2690 | SetPresParams(hwnd,
|
---|
| 2691 | &RGBGREY,
|
---|
| 2692 | &RGBBLACK,
|
---|
| 2693 | &RGBGREY,
|
---|
| 2694 | GetPString(IDS_8HELVTEXT));
|
---|
| 2695 | break;
|
---|
| 2696 |
|
---|
| 2697 | case WM_MOUSEMOVE:
|
---|
| 2698 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 2699 | break;
|
---|
| 2700 |
|
---|
| 2701 | case WM_CONTROLPOINTER:
|
---|
| 2702 | if(!fNoFinger &&
|
---|
| 2703 | SHORT1FROMMP(mp1) < 25000)
|
---|
| 2704 | return MRFROMLONG(hptrFinger);
|
---|
| 2705 | break;
|
---|
| 2706 |
|
---|
| 2707 | case WM_CHAR:
|
---|
| 2708 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
| 2709 | break;
|
---|
| 2710 |
|
---|
| 2711 | case WM_COMMAND:
|
---|
| 2712 | case UM_COMMAND:
|
---|
| 2713 | return WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 2714 | FID_CLIENT),
|
---|
| 2715 | msg,
|
---|
| 2716 | mp1,
|
---|
| 2717 | mp2);
|
---|
| 2718 |
|
---|
| 2719 | case WM_PAINT:
|
---|
| 2720 | {
|
---|
| 2721 | HPS hps;
|
---|
| 2722 | RECTL rcl;
|
---|
| 2723 |
|
---|
| 2724 | hps = WinBeginPaint(hwnd,(HPS)0,NULL);
|
---|
| 2725 | if(hps) {
|
---|
| 2726 | WinQueryWindowRect(hwnd,&rcl);
|
---|
| 2727 | WinFillRect(hps,&rcl,CLR_PALEGRAY);
|
---|
| 2728 | WinEndPaint(hps);
|
---|
| 2729 | }
|
---|
| 2730 | PaintRecessedWindow(hwnd,
|
---|
| 2731 | (HPS)0,
|
---|
| 2732 | TRUE,
|
---|
| 2733 | FALSE);
|
---|
| 2734 | }
|
---|
| 2735 | break;
|
---|
| 2736 |
|
---|
| 2737 | case UM_SETUP:
|
---|
| 2738 | {
|
---|
| 2739 | USHORT id;
|
---|
| 2740 | TOOL *tool;
|
---|
| 2741 |
|
---|
| 2742 | id = SHORT1FROMMP(mp1);
|
---|
| 2743 | tool = find_tool(id);
|
---|
| 2744 | if(tool) {
|
---|
| 2745 | del_tool(tool);
|
---|
| 2746 | WinShowWindow(WinWindowFromID(hwnd,id),FALSE);
|
---|
| 2747 | if(fToolTitles)
|
---|
| 2748 | WinShowWindow(WinWindowFromID(hwnd,id + 25000),FALSE);
|
---|
| 2749 | ResizeTools(hwnd);
|
---|
| 2750 | }
|
---|
| 2751 | }
|
---|
| 2752 | return 0;
|
---|
| 2753 |
|
---|
| 2754 | case WM_CHORD:
|
---|
| 2755 | {
|
---|
| 2756 | USHORT id;
|
---|
| 2757 |
|
---|
| 2758 | id = (USHORT)WinDlgBox(HWND_DESKTOP,
|
---|
| 2759 | hwnd,
|
---|
| 2760 | AddToolProc,
|
---|
| 2761 | FM3ModHandle,
|
---|
| 2762 | ADDBTN_FRAME,
|
---|
| 2763 | MPVOID);
|
---|
| 2764 | if(id && id != (USHORT)-1)
|
---|
| 2765 | WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 2766 | FID_CLIENT),
|
---|
| 2767 | WM_COMMAND,
|
---|
| 2768 | MPFROM2SHORT(IDM_CREATETOOL,0),
|
---|
| 2769 | MPFROM2SHORT(id,0));
|
---|
| 2770 | }
|
---|
| 2771 | break;
|
---|
| 2772 |
|
---|
| 2773 | case WM_CONTEXTMENU:
|
---|
| 2774 | if(WinDlgBox(HWND_DESKTOP,
|
---|
| 2775 | hwnd,
|
---|
| 2776 | ToolIODlgProc,
|
---|
| 2777 | FM3ModHandle,
|
---|
| 2778 | SVBTN_FRAME,
|
---|
| 2779 | MPVOID))
|
---|
| 2780 | BuildTools(hwnd,TRUE);
|
---|
| 2781 | return MRFROMSHORT(TRUE);
|
---|
| 2782 |
|
---|
| 2783 | case WM_CLOSE:
|
---|
| 2784 | WinDestroyWindow(hwnd);
|
---|
| 2785 | return 0;
|
---|
| 2786 |
|
---|
| 2787 | case WM_DESTROY:
|
---|
| 2788 | break;
|
---|
| 2789 | }
|
---|
| 2790 | return WinDefWindowProc(hwnd,msg,mp1,mp2);
|
---|
| 2791 | }
|
---|
| 2792 |
|
---|
| 2793 |
|
---|
| 2794 | VOID AdjustSizeOfClient (PSWP pswp,PRECTL prectl) {
|
---|
| 2795 |
|
---|
| 2796 | SWP swp;
|
---|
| 2797 | RECTL rectl;
|
---|
| 2798 |
|
---|
| 2799 | if(fFreeTree)
|
---|
| 2800 | return;
|
---|
| 2801 | if(pswp) {
|
---|
| 2802 | if(WinQueryWindowPos(hwndTree,&swp) &&
|
---|
| 2803 | !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE))) {
|
---|
| 2804 | pswp->x = swp.cx;
|
---|
| 2805 | pswp->cx -= swp.cx;
|
---|
| 2806 | }
|
---|
| 2807 | }
|
---|
| 2808 | if(prectl) {
|
---|
| 2809 | if(WinQueryWindowPos(hwndTree,&swp) &&
|
---|
| 2810 | !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE)) &&
|
---|
| 2811 | WinQueryWindowRect(hwndTree,&rectl)) {
|
---|
| 2812 | prectl->xLeft = rectl.xRight;
|
---|
| 2813 | prectl->xRight -= rectl.xRight;
|
---|
| 2814 | }
|
---|
| 2815 | }
|
---|
| 2816 | }
|
---|
| 2817 |
|
---|
| 2818 |
|
---|
| 2819 | VOID FillClient (HWND hwndClient,PSWP pswp,PRECTL prectl,BOOL avoidtree) {
|
---|
| 2820 |
|
---|
| 2821 | ULONG adjust;
|
---|
| 2822 |
|
---|
| 2823 | adjust = WinQuerySysValue(HWND_DESKTOP,SV_CYICON);
|
---|
| 2824 | if(pswp)
|
---|
| 2825 | WinQueryWindowPos(hwndClient,pswp);
|
---|
| 2826 | if(prectl)
|
---|
| 2827 | WinQueryWindowRect(hwndClient,prectl);
|
---|
| 2828 | if(avoidtree && !fFreeTree)
|
---|
| 2829 | AdjustSizeOfClient(pswp,prectl);
|
---|
| 2830 | if(prectl)
|
---|
| 2831 | prectl->yBottom += adjust;
|
---|
| 2832 | if(pswp) {
|
---|
| 2833 | if(!avoidtree || fFreeTree)
|
---|
| 2834 | pswp->x = 0;
|
---|
| 2835 | pswp->y = adjust;
|
---|
| 2836 | if(pswp->cy >= adjust)
|
---|
| 2837 | pswp->cy -= adjust;
|
---|
| 2838 | else
|
---|
| 2839 | pswp->cy = 0;
|
---|
| 2840 | }
|
---|
| 2841 | }
|
---|
| 2842 |
|
---|
| 2843 |
|
---|
| 2844 | VOID MoveChildrenAwayFromTree (HWND hwndClient) {
|
---|
| 2845 |
|
---|
| 2846 | SWP swpC,swpT,swp;
|
---|
| 2847 | USHORT id;
|
---|
| 2848 | HWND hwndChild;
|
---|
| 2849 | HENUM henum;
|
---|
| 2850 |
|
---|
| 2851 | if(fFreeTree)
|
---|
| 2852 | return;
|
---|
| 2853 | WinQueryWindowPos(hwndClient,&swpC);
|
---|
| 2854 | if(swpC.fl & (SWP_MINIMIZE | SWP_HIDE))
|
---|
| 2855 | return;
|
---|
| 2856 | WinQueryWindowPos(hwndTree,&swpT);
|
---|
| 2857 | henum = WinBeginEnumWindows(hwndClient);
|
---|
| 2858 | while((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
| 2859 | id = WinQueryWindowUShort(hwndChild,QWS_ID);
|
---|
| 2860 | if(!id || id == TREE_FRAME)
|
---|
| 2861 | continue;
|
---|
| 2862 | WinQueryWindowPos(hwndChild,&swp);
|
---|
| 2863 | if(!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
|
---|
| 2864 | if(swp.x < swpT.cx) {
|
---|
| 2865 | swp.x = swpT.cx;
|
---|
| 2866 | if(swp.x + swp.cx > swpC.cx)
|
---|
| 2867 | swp.cx = swpC.cx - swp.x;
|
---|
| 2868 | if(swp.cx > 24)
|
---|
| 2869 | WinSetWindowPos(hwndChild,HWND_TOP,swp.x,swp.y,swp.cx,swp.cy,
|
---|
| 2870 | SWP_SIZE | SWP_MOVE | SWP_SHOW);
|
---|
| 2871 | }
|
---|
| 2872 | }
|
---|
| 2873 | }
|
---|
| 2874 | WinEndEnumWindows(henum);
|
---|
| 2875 | }
|
---|
| 2876 |
|
---|
| 2877 |
|
---|
| 2878 | VOID ArrangeIcons (HWND hwndClient) {
|
---|
| 2879 |
|
---|
| 2880 | HENUM henum;
|
---|
| 2881 | HWND hwndChild;
|
---|
| 2882 | SWP swp;
|
---|
| 2883 |
|
---|
| 2884 | henum = WinBeginEnumWindows(hwndClient);
|
---|
| 2885 | while((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
| 2886 | WinQueryWindowPos(hwndChild,&swp);
|
---|
| 2887 | if(swp.fl & (SWP_MINIMIZE | SWP_HIDE)) {
|
---|
| 2888 | WinSetWindowUShort(hwndChild,QWS_XMINIMIZE,(USHORT)-1);
|
---|
| 2889 | WinSetWindowUShort(hwndChild,QWS_YMINIMIZE,(USHORT)-1);
|
---|
| 2890 | WinSetWindowPos(hwndChild,HWND_TOP,0,0,0,0,
|
---|
| 2891 | SWP_MOVE | SWP_SHOW | SWP_FOCUSDEACTIVATE);
|
---|
| 2892 | }
|
---|
| 2893 | }
|
---|
| 2894 | WinEndEnumWindows(henum);
|
---|
| 2895 | }
|
---|
| 2896 |
|
---|
| 2897 |
|
---|
| 2898 | VOID NextChild (HWND hwndClient,BOOL previous) {
|
---|
| 2899 |
|
---|
| 2900 | HENUM henum;
|
---|
| 2901 | HWND hwndActive,hwndNext,hwndPrev = (HWND)0;
|
---|
| 2902 | BOOL next = FALSE,once = FALSE;
|
---|
| 2903 |
|
---|
| 2904 | previous = !previous;
|
---|
| 2905 |
|
---|
| 2906 | hwndActive = WinQueryActiveWindow(hwndClient);
|
---|
| 2907 | if(!hwndActive)
|
---|
| 2908 | next = TRUE;
|
---|
| 2909 | henum = WinBeginEnumWindows(hwndClient);
|
---|
| 2910 | for(;;) {
|
---|
| 2911 | hwndNext = WinGetNextWindow(henum);
|
---|
| 2912 | if(hwndNext) {
|
---|
| 2913 | if(!WinQueryWindowUShort(hwndNext,QWS_ID))
|
---|
| 2914 | continue;
|
---|
| 2915 | if(next)
|
---|
| 2916 | break;
|
---|
| 2917 | if(hwndNext == hwndActive) {
|
---|
| 2918 | if(!previous && hwndPrev) {
|
---|
| 2919 | hwndNext = hwndPrev;
|
---|
| 2920 | break;
|
---|
| 2921 | }
|
---|
| 2922 | else if(previous)
|
---|
| 2923 | next = TRUE;
|
---|
| 2924 | }
|
---|
| 2925 | hwndPrev = hwndNext;
|
---|
| 2926 | }
|
---|
| 2927 | else {
|
---|
| 2928 | if((!next && previous) || once)
|
---|
| 2929 | break;
|
---|
| 2930 | else if(!previous) {
|
---|
| 2931 | hwndNext = hwndPrev;
|
---|
| 2932 | break;
|
---|
| 2933 | }
|
---|
| 2934 | else
|
---|
| 2935 | once = next = TRUE;
|
---|
| 2936 | }
|
---|
| 2937 | }
|
---|
| 2938 | WinEndEnumWindows(henum);
|
---|
| 2939 |
|
---|
| 2940 | if(hwndNext && hwndNext != hwndActive) {
|
---|
| 2941 | WinSetWindowPos(hwndNext,HWND_TOP,0,0,0,0,SWP_ZORDER | SWP_ACTIVATE);
|
---|
| 2942 | WinSetWindowPos(hwndActive,((previous) ? HWND_BOTTOM : hwndNext),
|
---|
| 2943 | 0,0,0,0,SWP_ZORDER);
|
---|
| 2944 | }
|
---|
| 2945 | }
|
---|
| 2946 |
|
---|
| 2947 |
|
---|
| 2948 | BOOL CloseChildren (HWND hwndClient) {
|
---|
| 2949 |
|
---|
| 2950 | HENUM henum;
|
---|
| 2951 | HWND hwndChild;
|
---|
| 2952 | BOOL ret = FALSE;
|
---|
| 2953 |
|
---|
| 2954 | fNoTileUpdate = TRUE;
|
---|
| 2955 | henum = WinBeginEnumWindows(hwndClient);
|
---|
| 2956 | while((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
| 2957 | if(hwndChild != hwndTree) {
|
---|
| 2958 | WinSendMsg(WinWindowFromID(hwndChild,FID_CLIENT),
|
---|
| 2959 | WM_SAVEAPPLICATION,
|
---|
| 2960 | MPVOID,
|
---|
| 2961 | MPVOID);
|
---|
| 2962 | if(WinSendMsg(WinWindowFromID(hwndChild,FID_CLIENT),
|
---|
| 2963 | WM_CLOSE,
|
---|
| 2964 | MPVOID,
|
---|
| 2965 | MPVOID)) {
|
---|
| 2966 | ret = TRUE;
|
---|
| 2967 | break;
|
---|
| 2968 | }
|
---|
| 2969 | }
|
---|
| 2970 | }
|
---|
| 2971 | WinEndEnumWindows(henum);
|
---|
| 2972 | fNoTileUpdate = FALSE;
|
---|
| 2973 | return ret;
|
---|
| 2974 | }
|
---|
| 2975 |
|
---|
| 2976 |
|
---|
| 2977 | BOOL CloseDirCnrChildren (HWND hwndClient) {
|
---|
| 2978 |
|
---|
| 2979 | /* returns TRUE if a directory container window was told to close */
|
---|
| 2980 |
|
---|
| 2981 | HENUM henum;
|
---|
| 2982 | HWND hwndChild,hwndDir,hwndTemp;
|
---|
| 2983 | BOOL ret = FALSE;
|
---|
| 2984 |
|
---|
| 2985 | fNoTileUpdate = TRUE;
|
---|
| 2986 | henum = WinBeginEnumWindows(hwndClient);
|
---|
| 2987 | while((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
| 2988 | if(hwndChild != hwndTree) {
|
---|
| 2989 | hwndTemp = WinWindowFromID(hwndChild,FID_CLIENT);
|
---|
| 2990 | if(hwndTemp) {
|
---|
| 2991 | hwndDir = WinWindowFromID(hwndTemp,DIR_CNR);
|
---|
| 2992 | if(hwndDir) {
|
---|
| 2993 | WinSendMsg(WinWindowFromID(hwndChild,FID_CLIENT),
|
---|
| 2994 | WM_CLOSE,
|
---|
| 2995 | MPVOID,
|
---|
| 2996 | MPVOID);
|
---|
| 2997 | ret = TRUE;
|
---|
| 2998 | }
|
---|
| 2999 | }
|
---|
| 3000 | }
|
---|
| 3001 | }
|
---|
| 3002 | WinEndEnumWindows(henum);
|
---|
| 3003 | fNoTileUpdate = FALSE;
|
---|
| 3004 | return ret;
|
---|
| 3005 | }
|
---|
| 3006 |
|
---|
| 3007 |
|
---|
| 3008 | BOOL SaveDirCnrState (HWND hwndClient,CHAR *name) {
|
---|
| 3009 |
|
---|
| 3010 | /* returns TRUE if any directory container windows existed */
|
---|
| 3011 |
|
---|
| 3012 | HENUM henum;
|
---|
| 3013 | HWND hwndChild,hwndDir,hwndC;
|
---|
| 3014 | ULONG numsaves = 0,flWindowAttr;
|
---|
| 3015 | CHAR s[120],directory[CCHMAXPATH];
|
---|
| 3016 | SWP swp;
|
---|
| 3017 | BOOL ret = FALSE;
|
---|
| 3018 | DIRCNRDATA *dcd;
|
---|
| 3019 |
|
---|
| 3020 | henum = WinBeginEnumWindows(hwndClient);
|
---|
| 3021 | while((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
| 3022 | if(hwndChild != hwndTree) {
|
---|
| 3023 | hwndC = WinWindowFromID(hwndChild,FID_CLIENT);
|
---|
| 3024 | if(hwndC) {
|
---|
| 3025 | hwndDir = WinWindowFromID(hwndC,DIR_CNR);
|
---|
| 3026 | if(hwndDir) {
|
---|
| 3027 | WinQueryWindowPos(hwndChild,&swp);
|
---|
| 3028 | *directory = 0;
|
---|
| 3029 | WinSendMsg(hwndC,UM_CONTAINERDIR,MPFROMP(directory),MPVOID);
|
---|
| 3030 | if(*directory) {
|
---|
| 3031 | sprintf(s,"%s%sDirCnrPos.%lu",(name) ? name : NullStr,(name) ? "." : NullStr,
|
---|
| 3032 | numsaves);
|
---|
| 3033 | PrfWriteProfileData(fmprof,
|
---|
| 3034 | FM3Str,
|
---|
| 3035 | s,
|
---|
| 3036 | (PVOID)&swp,
|
---|
| 3037 | sizeof(SWP));
|
---|
| 3038 | dcd = WinQueryWindowPtr(WinWindowFromID(hwndC,DIR_CNR),0);
|
---|
| 3039 | if(dcd) {
|
---|
| 3040 | sprintf(s,"%s%sDirCnrSort.%lu",(name) ? name : NullStr,(name) ? "." : NullStr,
|
---|
| 3041 | numsaves);
|
---|
| 3042 | PrfWriteProfileData(fmprof,FM3Str,s,(PVOID)&dcd->sortFlags,
|
---|
| 3043 | sizeof(INT));
|
---|
| 3044 | sprintf(s,"%s%sDirCnrFilter.%lu",(name) ? name : NullStr,(name) ? "." : NullStr,
|
---|
| 3045 | numsaves);
|
---|
| 3046 | PrfWriteProfileData(fmprof,FM3Str,s,(PVOID)&dcd->mask,
|
---|
| 3047 | sizeof(MASK));
|
---|
| 3048 | sprintf(s,"%s%sDirCnrView.%lu",(name) ? name : NullStr,(name) ? "." : NullStr,
|
---|
| 3049 | numsaves);
|
---|
| 3050 | flWindowAttr = dcd->flWindowAttr;
|
---|
| 3051 | if(!fLeaveTree && (flWindowAttr & CV_TREE)) {
|
---|
| 3052 | flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT));
|
---|
| 3053 | if(dcd->lastattr) {
|
---|
| 3054 | if(dcd->lastattr & CV_TEXT)
|
---|
| 3055 | flWindowAttr |= CV_TEXT;
|
---|
| 3056 | else if(dcd->lastattr & CV_DETAIL)
|
---|
| 3057 | flWindowAttr |= CV_DETAIL;
|
---|
| 3058 | else if(dcd->lastattr & CV_ICON)
|
---|
| 3059 | flWindowAttr |= CV_ICON;
|
---|
| 3060 | else
|
---|
| 3061 | flWindowAttr |= CV_NAME;
|
---|
| 3062 | }
|
---|
| 3063 | else
|
---|
| 3064 | flWindowAttr |= CV_NAME;
|
---|
| 3065 | }
|
---|
| 3066 | PrfWriteProfileData(fmprof,FM3Str,s,(PVOID)&flWindowAttr,
|
---|
| 3067 | sizeof(ULONG));
|
---|
| 3068 | }
|
---|
| 3069 | sprintf(s,"%s%sDirCnrDir.%lu",(name) ? name : NullStr,(name) ? "." : NullStr,
|
---|
| 3070 | numsaves++);
|
---|
| 3071 | PrfWriteProfileString(fmprof,FM3Str,s,directory);
|
---|
| 3072 | ret = TRUE;
|
---|
| 3073 | }
|
---|
| 3074 | }
|
---|
| 3075 | }
|
---|
| 3076 | }
|
---|
| 3077 | }
|
---|
| 3078 | WinEndEnumWindows(henum);
|
---|
| 3079 | if(ret) {
|
---|
| 3080 | if(WinQueryWindowPos(hwndTree,&swp)) {
|
---|
| 3081 | sprintf(s,"%s%sLastTreePos",(name) ? name : NullStr,(name) ? "." : NullStr);
|
---|
| 3082 | PrfWriteProfileData(fmprof,FM3Str,s,(PVOID)&swp,sizeof(SWP));
|
---|
| 3083 | }
|
---|
| 3084 | sprintf(s,"%s%sNumDirsLastTime",(name) ? name : NullStr,(name) ? "." : NullStr);
|
---|
| 3085 | PrfWriteProfileData(fmprof,FM3Str,s,(PVOID)&numsaves,sizeof(ULONG));
|
---|
| 3086 | WinQueryWindowPos(WinQueryWindow(hwndClient,QW_PARENT),&swp);
|
---|
| 3087 | sprintf(s,"%s%sMySizeLastTime",(name) ? name : NullStr,(name) ? "." : NullStr);
|
---|
| 3088 | PrfWriteProfileData(fmprof,FM3Str,s,(PVOID)&swp,sizeof(SWP));
|
---|
| 3089 | }
|
---|
| 3090 | return ret;
|
---|
| 3091 | }
|
---|
| 3092 |
|
---|
| 3093 |
|
---|
| 3094 | VOID TransformSwp (PSWP pswp,double xtrans,double ytrans) {
|
---|
| 3095 |
|
---|
| 3096 | SWP swp;
|
---|
| 3097 | HWND hwnd;
|
---|
| 3098 |
|
---|
| 3099 | if((LONG)pswp->x < 0L) {
|
---|
| 3100 | pswp->cx -= abs(pswp->x);
|
---|
| 3101 | pswp->x = 0;
|
---|
| 3102 | }
|
---|
| 3103 | if((LONG)pswp->y < 0L) {
|
---|
| 3104 | pswp->cy -= abs(pswp->y);
|
---|
| 3105 | pswp->y = 0;
|
---|
| 3106 | }
|
---|
| 3107 | pswp->x = (LONG)(((double)pswp->x * 100.0) / xtrans);
|
---|
| 3108 | pswp->cx = (LONG)(((double)pswp->cx * 100.0) / xtrans);
|
---|
| 3109 | pswp->y = (LONG)(((double)pswp->y * 100.0) / ytrans);
|
---|
| 3110 | pswp->cy = (LONG)(((double)pswp->cy * 100.0) / ytrans);
|
---|
| 3111 | if(pswp->hwnd) {
|
---|
| 3112 | hwnd = WinQueryWindow(pswp->hwnd,QW_PARENT);
|
---|
| 3113 | if(hwnd) {
|
---|
| 3114 | if(WinQueryWindowPos(hwnd,&swp)) {
|
---|
| 3115 | if(pswp->x > swp.cx)
|
---|
| 3116 | pswp->x = (swp.cx > 24) ? swp.cx - 24 : swp.cx;
|
---|
| 3117 | if(pswp->y > swp.cy)
|
---|
| 3118 | pswp->y = (swp.cy > 24) ? swp.cy - 24 : swp.cy;
|
---|
| 3119 | if(pswp->x + pswp->cx > swp.cx)
|
---|
| 3120 | pswp->cx = swp.cx - pswp->x;
|
---|
| 3121 | if(pswp->y + pswp->cy > swp.cy)
|
---|
| 3122 | pswp->cy = swp.cy - pswp->y;
|
---|
| 3123 | }
|
---|
| 3124 | }
|
---|
| 3125 | }
|
---|
| 3126 | }
|
---|
| 3127 |
|
---|
| 3128 |
|
---|
| 3129 | BOOL RestoreDirCnrState (HWND hwndClient,CHAR *name,BOOL noview) {
|
---|
| 3130 |
|
---|
| 3131 | /* returns TRUE if a directory container was opened */
|
---|
| 3132 |
|
---|
| 3133 | CHAR s[120],tdir[CCHMAXPATH];
|
---|
| 3134 | HWND hwndDir,hwndC;
|
---|
| 3135 | SWP swp,swpO,swpN;
|
---|
| 3136 | ULONG size,numsaves = 0L,x;
|
---|
| 3137 | double xtrans,ytrans;
|
---|
| 3138 | BOOL ret = FALSE;
|
---|
| 3139 | DIRCNRDATA *dcd;
|
---|
| 3140 |
|
---|
| 3141 | size = sizeof(SWP);
|
---|
| 3142 | sprintf(s,
|
---|
| 3143 | "%s%sMySizeLastTime",
|
---|
| 3144 | (name) ? name : NullStr,
|
---|
| 3145 | (name) ? "." : NullStr);
|
---|
| 3146 | if(!PrfQueryProfileData(fmprof,
|
---|
| 3147 | FM3Str,
|
---|
| 3148 | s,
|
---|
| 3149 | (PVOID)&swpO,
|
---|
| 3150 | &size) ||
|
---|
| 3151 | size != sizeof(SWP) || !swp.cx || !swp.cy)
|
---|
| 3152 | WinQueryWindowPos(WinQueryWindow(hwndClient,QW_PARENT),&swpO);
|
---|
| 3153 | if(!name ||
|
---|
| 3154 | !strcmp(name,GetPString(IDS_FM2TEMPTEXT)))
|
---|
| 3155 | PrfWriteProfileData(fmprof,
|
---|
| 3156 | FM3Str,
|
---|
| 3157 | s,
|
---|
| 3158 | NULL,
|
---|
| 3159 | 0L);
|
---|
| 3160 | WinQueryWindowPos(WinQueryWindow(hwndClient,QW_PARENT),&swpN);
|
---|
| 3161 | if(swpN.fl & (SWP_MINIMIZE | SWP_HIDE))
|
---|
| 3162 | swpN = swpO;
|
---|
| 3163 | xtrans = ((double)swpO.cx * 100.0) / (double)swpN.cx;
|
---|
| 3164 | ytrans = ((double)swpO.cy * 100.0) / (double)swpN.cy;
|
---|
| 3165 | size = sizeof(SWP);
|
---|
| 3166 | sprintf(s,
|
---|
| 3167 | "%s%sLastTreePos",
|
---|
| 3168 | (name) ? (name) : NullStr,
|
---|
| 3169 | (name) ? "." : NullStr);
|
---|
| 3170 | if(PrfQueryProfileData(fmprof,
|
---|
| 3171 | FM3Str,
|
---|
| 3172 | s,
|
---|
| 3173 | (PVOID)&swp,
|
---|
| 3174 | &size)) {
|
---|
| 3175 | if(!name ||
|
---|
| 3176 | !strcmp(name,GetPString(IDS_FM2TEMPTEXT)))
|
---|
| 3177 | PrfWriteProfileData(fmprof,
|
---|
| 3178 | FM3Str,
|
---|
| 3179 | s,
|
---|
| 3180 | NULL,
|
---|
| 3181 | 0L);
|
---|
| 3182 | swp.hwnd = hwndTree;
|
---|
| 3183 | TransformSwp(&swp,
|
---|
| 3184 | xtrans,
|
---|
| 3185 | ytrans);
|
---|
| 3186 | if(!fFreeTree) {
|
---|
| 3187 | WinQueryWindowPos(hwndClient,&swpN);
|
---|
| 3188 | swp.x = 0;
|
---|
| 3189 | swp.y = (swpN.cy - swp.cy);
|
---|
| 3190 | }
|
---|
| 3191 | if(!(swp.fl & (SWP_MINIMIZE | SWP_HIDE))) {
|
---|
| 3192 | swp.fl &= (~SWP_ACTIVATE);
|
---|
| 3193 | WinSetWindowPos(hwndTree,
|
---|
| 3194 | HWND_TOP,
|
---|
| 3195 | swp.x,
|
---|
| 3196 | swp.y,
|
---|
| 3197 | swp.cx,
|
---|
| 3198 | swp.cy,
|
---|
| 3199 | swp.fl | SWP_MOVE |
|
---|
| 3200 | SWP_SIZE | SWP_SHOW | SWP_ZORDER);
|
---|
| 3201 | }
|
---|
| 3202 | else {
|
---|
| 3203 | WinSetWindowPos(hwndTree,
|
---|
| 3204 | HWND_TOP,
|
---|
| 3205 | 0,
|
---|
| 3206 | 0,
|
---|
| 3207 | 0,
|
---|
| 3208 | 0,
|
---|
| 3209 | SWP_MINIMIZE | SWP_SHOW);
|
---|
| 3210 | WinSetWindowUShort(hwndTree,
|
---|
| 3211 | QWS_XRESTORE,
|
---|
| 3212 | (USHORT)swp.x);
|
---|
| 3213 | WinSetWindowUShort(hwndTree,
|
---|
| 3214 | QWS_CXRESTORE,
|
---|
| 3215 | (USHORT)swp.cx);
|
---|
| 3216 | WinSetWindowUShort(hwndTree,
|
---|
| 3217 | QWS_YRESTORE,
|
---|
| 3218 | (USHORT)swp.y);
|
---|
| 3219 | WinSetWindowUShort(hwndTree,
|
---|
| 3220 | QWS_CYRESTORE,
|
---|
| 3221 | (USHORT)swp.cy);
|
---|
| 3222 | }
|
---|
| 3223 | }
|
---|
| 3224 | size = sizeof(ULONG);
|
---|
| 3225 | sprintf(s,
|
---|
| 3226 | "%s%sNumDirsLastTime",
|
---|
| 3227 | (name) ? name : NullStr,
|
---|
| 3228 | (name) ? "." : NullStr);
|
---|
| 3229 | if(PrfQueryProfileData(fmprof,
|
---|
| 3230 | FM3Str,
|
---|
| 3231 | s,
|
---|
| 3232 | (PVOID)&numsaves,
|
---|
| 3233 | &size) &&
|
---|
| 3234 | numsaves) {
|
---|
| 3235 | if(!name ||
|
---|
| 3236 | !strcmp(name,GetPString(IDS_FM2TEMPTEXT)))
|
---|
| 3237 | PrfWriteProfileData(fmprof,
|
---|
| 3238 | FM3Str,
|
---|
| 3239 | s,
|
---|
| 3240 | NULL,
|
---|
| 3241 | 0L);
|
---|
| 3242 | for(x = 0;x < numsaves;x++) {
|
---|
| 3243 | sprintf(s,
|
---|
| 3244 | "%s%sDirCnrPos.%lu",
|
---|
| 3245 | (name) ? name : NullStr,
|
---|
| 3246 | (name) ? "." : NullStr,
|
---|
| 3247 | x);
|
---|
| 3248 | size = sizeof(SWP);
|
---|
| 3249 | if(PrfQueryProfileData(fmprof,
|
---|
| 3250 | FM3Str,
|
---|
| 3251 | s,
|
---|
| 3252 | (PVOID)&swp,
|
---|
| 3253 | &size)) {
|
---|
| 3254 | if(!name ||
|
---|
| 3255 | !strcmp(name,GetPString(IDS_FM2TEMPTEXT)))
|
---|
| 3256 | PrfWriteProfileData(fmprof,
|
---|
| 3257 | FM3Str,
|
---|
| 3258 | s,
|
---|
| 3259 | NULL,
|
---|
| 3260 | 0L);
|
---|
| 3261 | sprintf(s,
|
---|
| 3262 | "%s%sDirCnrDir.%lu",
|
---|
| 3263 | (name) ? name : NullStr,
|
---|
| 3264 | (name) ? "." : NullStr,
|
---|
| 3265 | x);
|
---|
| 3266 | size = sizeof(tdir);
|
---|
| 3267 | if(PrfQueryProfileData(fmprof,
|
---|
| 3268 | FM3Str,
|
---|
| 3269 | s,
|
---|
| 3270 | (PVOID)tdir,
|
---|
| 3271 | &size)) {
|
---|
| 3272 | if(!name ||
|
---|
| 3273 | !strcmp(name,GetPString(IDS_FM2TEMPTEXT)))
|
---|
| 3274 | PrfWriteProfileData(fmprof,
|
---|
| 3275 | FM3Str,
|
---|
| 3276 | s,
|
---|
| 3277 | NULL,
|
---|
| 3278 | 0L);
|
---|
| 3279 | hwndDir = (HWND)WinSendMsg(hwndClient,
|
---|
| 3280 | UM_SETDIR,
|
---|
| 3281 | MPFROMP(tdir),
|
---|
| 3282 | MPFROMLONG(1L));
|
---|
| 3283 | if(hwndDir) {
|
---|
| 3284 | hwndC = WinWindowFromID(hwndDir,
|
---|
| 3285 | FID_CLIENT);
|
---|
| 3286 | if(hwndC) {
|
---|
| 3287 | dcd = WinQueryWindowPtr(WinWindowFromID(hwndC,DIR_CNR),
|
---|
| 3288 | 0);
|
---|
| 3289 | if(dcd) {
|
---|
| 3290 | size = sizeof(INT);
|
---|
| 3291 | sprintf(s,
|
---|
| 3292 | "%s%sDirCnrSort.%lu",
|
---|
| 3293 | (name) ? name : NullStr,
|
---|
| 3294 | (name) ? "." : NullStr,
|
---|
| 3295 | x);
|
---|
| 3296 | if(PrfQueryProfileData(fmprof,
|
---|
| 3297 | FM3Str,
|
---|
| 3298 | s,
|
---|
| 3299 | (PVOID)&dcd->sortFlags,
|
---|
| 3300 | &size) &&
|
---|
| 3301 | size == sizeof(INT)) {
|
---|
| 3302 | if(!dcd->sortFlags)
|
---|
| 3303 | dcd->sortFlags = SORT_PATHNAME;
|
---|
| 3304 | }
|
---|
| 3305 | if(!name ||
|
---|
| 3306 | !strcmp(name,GetPString(IDS_FM2TEMPTEXT)))
|
---|
| 3307 | PrfWriteProfileData(fmprof,
|
---|
| 3308 | FM3Str,
|
---|
| 3309 | s,
|
---|
| 3310 | NULL,
|
---|
| 3311 | 0L);
|
---|
| 3312 | size = sizeof(MASK);
|
---|
| 3313 | sprintf(s,
|
---|
| 3314 | "%s%sDirCnrFilter.%lu",
|
---|
| 3315 | (name) ? name : NullStr,
|
---|
| 3316 | (name) ? "." : NullStr,
|
---|
| 3317 | x);
|
---|
| 3318 | if(PrfQueryProfileData(fmprof,
|
---|
| 3319 | FM3Str,
|
---|
| 3320 | s,
|
---|
| 3321 | (PVOID)&dcd->mask,
|
---|
| 3322 | &size) &&
|
---|
| 3323 | size) {
|
---|
| 3324 | if(*dcd->mask.szMask)
|
---|
| 3325 | WinSendMsg(WinWindowFromID(hwndC,DIR_CNR),
|
---|
| 3326 | UM_FILTER,
|
---|
| 3327 | MPFROMP(dcd->mask.szMask),
|
---|
| 3328 | MPVOID);
|
---|
| 3329 | }
|
---|
| 3330 | *(dcd->mask.prompt) = 0;
|
---|
| 3331 | if(!name ||
|
---|
| 3332 | !strcmp(name,GetPString(IDS_FM2TEMPTEXT)))
|
---|
| 3333 | PrfWriteProfileData(fmprof,
|
---|
| 3334 | FM3Str,
|
---|
| 3335 | s,
|
---|
| 3336 | NULL,
|
---|
| 3337 | 0L);
|
---|
| 3338 | size = sizeof(ULONG);
|
---|
| 3339 | sprintf(s,
|
---|
| 3340 | "%s%sDirCnrView.%lu",
|
---|
| 3341 | (name) ? name : NullStr,
|
---|
| 3342 | (name) ? "." : NullStr,
|
---|
| 3343 | x);
|
---|
| 3344 | if(!noview) {
|
---|
| 3345 | if(PrfQueryProfileData(fmprof,
|
---|
| 3346 | FM3Str,
|
---|
| 3347 | s,
|
---|
| 3348 | (PVOID)&dcd->flWindowAttr,
|
---|
| 3349 | &size) &&
|
---|
| 3350 | size == sizeof(ULONG)) {
|
---|
| 3351 |
|
---|
| 3352 | CNRINFO cnri;
|
---|
| 3353 |
|
---|
| 3354 | memset(&cnri,0,sizeof(CNRINFO));
|
---|
| 3355 | cnri.cb = sizeof(CNRINFO);
|
---|
| 3356 | if(WinSendMsg(WinWindowFromID(hwndC,DIR_CNR),
|
---|
| 3357 | CM_QUERYCNRINFO,
|
---|
| 3358 | MPFROMP(&cnri),
|
---|
| 3359 | MPFROMLONG(sizeof(CNRINFO)))) {
|
---|
| 3360 | cnri.flWindowAttr = dcd->flWindowAttr;
|
---|
| 3361 | WinSendMsg(WinWindowFromID(hwndC,DIR_CNR),
|
---|
| 3362 | CM_SETCNRINFO,
|
---|
| 3363 | MPFROMP(&cnri),
|
---|
| 3364 | MPFROMLONG(CMA_FLWINDOWATTR));
|
---|
| 3365 | }
|
---|
| 3366 | }
|
---|
| 3367 | }
|
---|
| 3368 | if(!name ||
|
---|
| 3369 | !strcmp(name,GetPString(IDS_FM2TEMPTEXT)))
|
---|
| 3370 | PrfWriteProfileData(fmprof,
|
---|
| 3371 | FM3Str,
|
---|
| 3372 | s,
|
---|
| 3373 | NULL,
|
---|
| 3374 | 0L);
|
---|
| 3375 | }
|
---|
| 3376 | }
|
---|
| 3377 | ret = TRUE;
|
---|
| 3378 | swp.hwnd = hwndDir;
|
---|
| 3379 | TransformSwp(&swp,
|
---|
| 3380 | xtrans,
|
---|
| 3381 | ytrans);
|
---|
| 3382 | if(!fAutoTile &&
|
---|
| 3383 | !(swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
|
---|
| 3384 | WinSetWindowPos(hwndDir,
|
---|
| 3385 | HWND_TOP,
|
---|
| 3386 | swp.x,
|
---|
| 3387 | swp.y,
|
---|
| 3388 | swp.cx,
|
---|
| 3389 | swp.cy,
|
---|
| 3390 | swp.fl | SWP_MOVE |
|
---|
| 3391 | SWP_SIZE | SWP_SHOW | SWP_ZORDER | SWP_ACTIVATE);
|
---|
| 3392 | else if(swp.fl & (SWP_HIDE | SWP_MINIMIZE)) {
|
---|
| 3393 | WinSetWindowPos(hwndDir,
|
---|
| 3394 | HWND_TOP,
|
---|
| 3395 | 0,
|
---|
| 3396 | 0,
|
---|
| 3397 | 0,
|
---|
| 3398 | 0,
|
---|
| 3399 | SWP_MINIMIZE | SWP_SHOW);
|
---|
| 3400 | WinSetWindowUShort(hwndDir,
|
---|
| 3401 | QWS_XRESTORE,
|
---|
| 3402 | (USHORT)swp.x);
|
---|
| 3403 | WinSetWindowUShort(hwndDir,
|
---|
| 3404 | QWS_CXRESTORE,
|
---|
| 3405 | (USHORT)swp.cx);
|
---|
| 3406 | WinSetWindowUShort(hwndDir,
|
---|
| 3407 | QWS_YRESTORE,
|
---|
| 3408 | (USHORT)swp.y);
|
---|
| 3409 | WinSetWindowUShort(hwndDir,
|
---|
| 3410 | QWS_CYRESTORE,
|
---|
| 3411 | (USHORT)swp.cy);
|
---|
| 3412 | }
|
---|
| 3413 | else
|
---|
| 3414 | WinSetWindowPos(hwndDir,
|
---|
| 3415 | HWND_TOP,
|
---|
| 3416 | 0,
|
---|
| 3417 | 0,
|
---|
| 3418 | 0,
|
---|
| 3419 | 0,
|
---|
| 3420 | SWP_ZORDER | SWP_ACTIVATE);
|
---|
| 3421 | }
|
---|
| 3422 | }
|
---|
| 3423 | }
|
---|
| 3424 | }
|
---|
| 3425 | }
|
---|
| 3426 | return ret;
|
---|
| 3427 | }
|
---|
| 3428 |
|
---|
| 3429 |
|
---|
| 3430 | ULONG CountChildren (HWND hwndClient,ULONG *ulNumMinChildren) {
|
---|
| 3431 |
|
---|
| 3432 | HENUM henum;
|
---|
| 3433 | HWND hwndChild;
|
---|
| 3434 | SWP swp;
|
---|
| 3435 | register ULONG ulCnt = 0L;
|
---|
| 3436 | USHORT id;
|
---|
| 3437 |
|
---|
| 3438 | if(ulNumMinChildren)
|
---|
| 3439 | *ulNumMinChildren = 0L;
|
---|
| 3440 | henum = WinBeginEnumWindows(hwndClient);
|
---|
| 3441 | while((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
| 3442 | id = WinQueryWindowUShort(hwndChild,QWS_ID);
|
---|
| 3443 | if(!id || (!fFreeTree && id == TREE_FRAME))
|
---|
| 3444 | continue;
|
---|
| 3445 | ulCnt++;
|
---|
| 3446 | if(ulNumMinChildren) {
|
---|
| 3447 | if(WinQueryWindowPos(hwndChild,&swp) &&
|
---|
| 3448 | (swp.fl & SWP_MINIMIZE))
|
---|
| 3449 | (*ulNumMinChildren)++;
|
---|
| 3450 | }
|
---|
| 3451 | }
|
---|
| 3452 | WinEndEnumWindows(henum);
|
---|
| 3453 | return ulCnt;
|
---|
| 3454 | }
|
---|
| 3455 |
|
---|
| 3456 |
|
---|
| 3457 | VOID GetNextWindowPos (HWND hwndClient,PSWP pswp,ULONG *ulCntR,
|
---|
| 3458 | ULONG *ulNumMinChildrenR) {
|
---|
| 3459 |
|
---|
| 3460 | register ULONG ulCnt;
|
---|
| 3461 | ULONG ulNumMinChildren;
|
---|
| 3462 | RECTL Rectl;
|
---|
| 3463 | register ULONG ulXDiff,ulYDiff,ulWindowsPerStack;
|
---|
| 3464 |
|
---|
| 3465 | if(!ulCntR || !ulNumMinChildrenR)
|
---|
| 3466 | ulCnt = CountChildren(hwndClient,&ulNumMinChildren);
|
---|
| 3467 | else {
|
---|
| 3468 | ulCnt = *ulCntR;
|
---|
| 3469 | ulNumMinChildren = *ulNumMinChildrenR;
|
---|
| 3470 | if(ulCnt == (ULONG)-1L) {
|
---|
| 3471 | ulCnt = CountChildren(hwndClient,&ulNumMinChildren);
|
---|
| 3472 | /* return these values to the caller for later use */
|
---|
| 3473 | *ulCntR = ulCnt;
|
---|
| 3474 | *ulNumMinChildrenR = ulNumMinChildren;
|
---|
| 3475 | }
|
---|
| 3476 | }
|
---|
| 3477 | WinQueryWindowRect(hwndClient,&Rectl);
|
---|
| 3478 | AdjustSizeOfClient(NULL,&Rectl);
|
---|
| 3479 | if(!fFreeTree) {
|
---|
| 3480 |
|
---|
| 3481 | SWP swp;
|
---|
| 3482 |
|
---|
| 3483 | WinQueryWindowPos(hwndTree,&swp);
|
---|
| 3484 | if(ulNumMinChildren || (swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
|
---|
| 3485 | Rectl.yBottom += WinQuerySysValue(HWND_DESKTOP,SV_CYICON) * 2;
|
---|
| 3486 | }
|
---|
| 3487 | else if(ulNumMinChildren)
|
---|
| 3488 | Rectl.yBottom += WinQuerySysValue(HWND_DESKTOP,SV_CYICON) * 2;
|
---|
| 3489 |
|
---|
| 3490 | ulXDiff = WinQuerySysValue(HWND_DESKTOP,SV_CXSIZEBORDER) +
|
---|
| 3491 | WinQuerySysValue(HWND_DESKTOP,SV_CXMINMAXBUTTON) / 2;
|
---|
| 3492 | ulYDiff = WinQuerySysValue(HWND_DESKTOP,SV_CYSIZEBORDER) +
|
---|
| 3493 | WinQuerySysValue(HWND_DESKTOP,SV_CYMINMAXBUTTON);
|
---|
| 3494 | ulWindowsPerStack = (Rectl.yTop - Rectl.yBottom) / (3 * ulYDiff);
|
---|
| 3495 | pswp->cx = Rectl.xRight - (ulWindowsPerStack * ulXDiff);
|
---|
| 3496 | pswp->cy = (Rectl.yTop - Rectl.yBottom) - (ulWindowsPerStack * ulYDiff);
|
---|
| 3497 | ulWindowsPerStack++;
|
---|
| 3498 | pswp->x = Rectl.xLeft + ((ulCnt % ulWindowsPerStack) * ulXDiff);
|
---|
| 3499 | pswp->y = (Rectl.yTop - pswp->cy - ((ulCnt % ulWindowsPerStack) * ulYDiff));
|
---|
| 3500 | }
|
---|
| 3501 |
|
---|
| 3502 |
|
---|
| 3503 | VOID CascadeChildren (HWND hwndClient) {
|
---|
| 3504 |
|
---|
| 3505 | ULONG ulCnt = 0L,ulNumMinChildren;
|
---|
| 3506 | HWND hwndChild;
|
---|
| 3507 | HENUM henum;
|
---|
| 3508 | SWP swp;
|
---|
| 3509 | USHORT id;
|
---|
| 3510 | RECTL Rectl;
|
---|
| 3511 |
|
---|
| 3512 | WinQueryWindowPos(hwndClient,&swp);
|
---|
| 3513 | if(swp.fl & (SWP_HIDE | SWP_MINIMIZE))
|
---|
| 3514 | return;
|
---|
| 3515 |
|
---|
| 3516 | CountChildren(hwndClient,&ulNumMinChildren);
|
---|
| 3517 | if(!fFreeTree) {
|
---|
| 3518 | WinQueryWindowRect(hwndClient,&Rectl);
|
---|
| 3519 | AdjustSizeOfClient(NULL,&Rectl);
|
---|
| 3520 | WinQueryWindowPos(hwndTree,&swp);
|
---|
| 3521 | if(!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
|
---|
| 3522 | if(swp.y + swp.cy < Rectl.yTop - Rectl.yBottom)
|
---|
| 3523 | swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;
|
---|
| 3524 | if(swp.x != 0)
|
---|
| 3525 | swp.x = 0;
|
---|
| 3526 | if(swp.y < 0)
|
---|
| 3527 | swp.y = 0;
|
---|
| 3528 | if(swp.x + swp.cx > Rectl.xRight - Rectl.xLeft)
|
---|
| 3529 | swp.cx = Rectl.xRight - Rectl.xLeft;
|
---|
| 3530 | WinSetWindowPos(hwndTree,HWND_TOP,swp.x,swp.y,swp.cx,swp.cy,
|
---|
| 3531 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
|
---|
| 3532 | }
|
---|
| 3533 | }
|
---|
| 3534 | henum = WinBeginEnumWindows(hwndClient);
|
---|
| 3535 | while((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
| 3536 | id = WinQueryWindowUShort(hwndChild,QWS_ID);
|
---|
| 3537 | if(!id || (!fFreeTree && id == TREE_FRAME))
|
---|
| 3538 | continue;
|
---|
| 3539 | WinQueryWindowPos(hwndChild,&swp);
|
---|
| 3540 | if(!(swp.fl & (SWP_MINIMIZE | SWP_HIDE))) {
|
---|
| 3541 | GetNextWindowPos(hwndClient,&swp,&ulCnt,&ulNumMinChildren);
|
---|
| 3542 | WinSetWindowPos(hwndChild,HWND_TOP,swp.x,swp.y,swp.cx,swp.cy,
|
---|
| 3543 | SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_RESTORE |
|
---|
| 3544 | SWP_ZORDER | SWP_ACTIVATE);
|
---|
| 3545 | ulCnt++;
|
---|
| 3546 | }
|
---|
| 3547 | }
|
---|
| 3548 | WinEndEnumWindows(henum);
|
---|
| 3549 | }
|
---|
| 3550 |
|
---|
| 3551 |
|
---|
| 3552 | VOID TileChildren (HWND hwndClient,BOOL absolute) {
|
---|
| 3553 |
|
---|
| 3554 | register ULONG ulChildCnt,ulSquare,ulNumRows,ulNumCols,
|
---|
| 3555 | ulExtraCols,ulWidth,ulHeight;
|
---|
| 3556 | ULONG ulNumMinChildren;
|
---|
| 3557 | RECTL Rectl;
|
---|
| 3558 | HWND hwndChild;
|
---|
| 3559 |
|
---|
| 3560 | if(fNoTileUpdate || hwndClient == HWND_DESKTOP)
|
---|
| 3561 | return;
|
---|
| 3562 | {
|
---|
| 3563 | SWP swp;
|
---|
| 3564 |
|
---|
| 3565 | WinQueryWindowPos(hwndClient,&swp);
|
---|
| 3566 | if(swp.fl & (SWP_HIDE | SWP_MINIMIZE))
|
---|
| 3567 | return;
|
---|
| 3568 | }
|
---|
| 3569 | ulChildCnt = CountChildren(hwndClient,
|
---|
| 3570 | &ulNumMinChildren);
|
---|
| 3571 | ulChildCnt -= ulNumMinChildren;
|
---|
| 3572 | if(!ulChildCnt)
|
---|
| 3573 | return;
|
---|
| 3574 |
|
---|
| 3575 | fNoTileUpdate = TRUE;
|
---|
| 3576 |
|
---|
| 3577 | for(ulSquare = 2;
|
---|
| 3578 | ulSquare * ulSquare <= ulChildCnt;
|
---|
| 3579 | ulSquare++)
|
---|
| 3580 | ;
|
---|
| 3581 | if(!fTileBackwards) {
|
---|
| 3582 | ulNumCols = ulSquare - 1L;
|
---|
| 3583 | ulNumRows = ulChildCnt / ulNumCols;
|
---|
| 3584 | }
|
---|
| 3585 | else {
|
---|
| 3586 | ulNumRows = ulSquare - 1L;
|
---|
| 3587 | ulNumCols = ulChildCnt / ulNumRows;
|
---|
| 3588 | }
|
---|
| 3589 | ulExtraCols = ulChildCnt % ulNumCols;
|
---|
| 3590 |
|
---|
| 3591 | WinQueryWindowRect(hwndClient,
|
---|
| 3592 | &Rectl);
|
---|
| 3593 |
|
---|
| 3594 | if(!fFreeTree) {
|
---|
| 3595 |
|
---|
| 3596 | SWP swp;
|
---|
| 3597 |
|
---|
| 3598 | WinQueryWindowPos(hwndTree,&swp);
|
---|
| 3599 | if(!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
|
---|
| 3600 | if(swp.y < 0)
|
---|
| 3601 | swp.y = 0;
|
---|
| 3602 | if(swp.y + swp.cy < Rectl.yTop - Rectl.yBottom)
|
---|
| 3603 | swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;
|
---|
| 3604 | if(swp.x != 0)
|
---|
| 3605 | swp.x = 0;
|
---|
| 3606 | if(swp.x + swp.cx > Rectl.xRight - Rectl.xLeft)
|
---|
| 3607 | swp.cx = Rectl.xRight - Rectl.xLeft;
|
---|
| 3608 | WinSetWindowPos(hwndTree,
|
---|
| 3609 | HWND_TOP,
|
---|
| 3610 | swp.x,
|
---|
| 3611 | swp.y,
|
---|
| 3612 | swp.cx,
|
---|
| 3613 | swp.cy,
|
---|
| 3614 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
|
---|
| 3615 | WinQueryWindowPos(hwndTree,&swp);
|
---|
| 3616 | }
|
---|
| 3617 | if(ulNumMinChildren ||
|
---|
| 3618 | (swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
|
---|
| 3619 | Rectl.yBottom += WinQuerySysValue(HWND_DESKTOP,SV_CYICON) * 2;
|
---|
| 3620 | }
|
---|
| 3621 | else if(ulNumMinChildren)
|
---|
| 3622 | Rectl.yBottom += WinQuerySysValue(HWND_DESKTOP,SV_CYICON) * 2;
|
---|
| 3623 |
|
---|
| 3624 | AdjustSizeOfClient(NULL,
|
---|
| 3625 | &Rectl);
|
---|
| 3626 |
|
---|
| 3627 | if(Rectl.xRight > 0L &&
|
---|
| 3628 | (Rectl.yBottom < Rectl.yTop)) {
|
---|
| 3629 |
|
---|
| 3630 | HENUM henum;
|
---|
| 3631 |
|
---|
| 3632 | henum = WinBeginEnumWindows(hwndClient);
|
---|
| 3633 | if((hwndChild = WinGetNextWindow(henum)) != (HWND)0) {
|
---|
| 3634 |
|
---|
| 3635 | ULONG ulCurRow,ulCurCol;
|
---|
| 3636 | SWP swp;
|
---|
| 3637 | USHORT id;
|
---|
| 3638 |
|
---|
| 3639 | ulHeight = (Rectl.yTop - Rectl.yBottom) / ulNumRows;
|
---|
| 3640 |
|
---|
| 3641 | for(ulCurRow = 0;
|
---|
| 3642 | ulCurRow < ulNumRows;
|
---|
| 3643 | ulCurRow++) {
|
---|
| 3644 | if((ulNumRows - ulCurRow) <= ulExtraCols)
|
---|
| 3645 | ulNumCols++;
|
---|
| 3646 | for(ulCurCol = 0;
|
---|
| 3647 | ulCurCol < ulNumCols;
|
---|
| 3648 | ulCurCol++) {
|
---|
| 3649 | ulWidth = Rectl.xRight / ulNumCols;
|
---|
| 3650 |
|
---|
| 3651 | while(hwndChild) {
|
---|
| 3652 | id = WinQueryWindowUShort(hwndChild,QWS_ID);
|
---|
| 3653 | if(id &&
|
---|
| 3654 | (id != TREE_FRAME || fFreeTree)) {
|
---|
| 3655 | WinQueryWindowPos(hwndChild,&swp);
|
---|
| 3656 | if(!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
|
---|
| 3657 | break;
|
---|
| 3658 | }
|
---|
| 3659 | hwndChild = WinGetNextWindow(henum);
|
---|
| 3660 | }
|
---|
| 3661 |
|
---|
| 3662 | if(hwndChild) {
|
---|
| 3663 | if(!absolute &&
|
---|
| 3664 | (swp.fl & SWP_MAXIMIZE)) {
|
---|
| 3665 | WinGetMaxPosition(hwndChild,&swp);
|
---|
| 3666 | WinSetWindowPos(hwndChild,
|
---|
| 3667 | HWND_TOP,
|
---|
| 3668 | swp.x,
|
---|
| 3669 | swp.y,
|
---|
| 3670 | swp.cx,
|
---|
| 3671 | swp.cy,
|
---|
| 3672 | SWP_MOVE | SWP_SIZE | SWP_SHOW);
|
---|
| 3673 | WinSetWindowUShort(hwndChild,
|
---|
| 3674 | QWS_XRESTORE,
|
---|
| 3675 | (USHORT)(ulWidth * ulCurCol) + Rectl.xLeft);
|
---|
| 3676 | WinSetWindowUShort(hwndChild,
|
---|
| 3677 | QWS_YRESTORE,
|
---|
| 3678 | (USHORT)(Rectl.yTop -
|
---|
| 3679 | (ulHeight * (ulCurRow + 1L))));
|
---|
| 3680 | WinSetWindowUShort(hwndChild,
|
---|
| 3681 | QWS_CXRESTORE,
|
---|
| 3682 | (USHORT)ulWidth);
|
---|
| 3683 | WinSetWindowUShort(hwndChild,
|
---|
| 3684 | QWS_CYRESTORE,
|
---|
| 3685 | (USHORT)ulHeight);
|
---|
| 3686 | }
|
---|
| 3687 | else
|
---|
| 3688 | WinSetWindowPos(hwndChild,
|
---|
| 3689 | HWND_TOP,
|
---|
| 3690 | (ulWidth * ulCurCol) + Rectl.xLeft,
|
---|
| 3691 | Rectl.yTop - (ulHeight * (ulCurRow + 1L)),
|
---|
| 3692 | ulWidth,
|
---|
| 3693 | ulHeight,
|
---|
| 3694 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
|
---|
| 3695 | hwndChild = WinGetNextWindow(henum);
|
---|
| 3696 | }
|
---|
| 3697 | }
|
---|
| 3698 | if((ulNumRows - ulCurRow) <= ulExtraCols) {
|
---|
| 3699 | ulNumCols--;
|
---|
| 3700 | ulExtraCols--;
|
---|
| 3701 | }
|
---|
| 3702 | }
|
---|
| 3703 | }
|
---|
| 3704 | WinEndEnumWindows(henum);
|
---|
| 3705 | }
|
---|
| 3706 |
|
---|
| 3707 | fNoTileUpdate = FALSE;
|
---|
| 3708 | }
|
---|
| 3709 |
|
---|
| 3710 |
|
---|
| 3711 | VOID ResizeChildren (HWND hwndClient,SHORT oldcx,SHORT oldcy,SHORT newcx,
|
---|
| 3712 | SHORT newcy) {
|
---|
| 3713 | /*
|
---|
| 3714 | * resize all children of the client to maintain their proportional
|
---|
| 3715 | * sizes and positions
|
---|
| 3716 | */
|
---|
| 3717 |
|
---|
| 3718 | if(!newcx ||
|
---|
| 3719 | !newcy ||
|
---|
| 3720 | !oldcx ||
|
---|
| 3721 | !oldcy)
|
---|
| 3722 | return;
|
---|
| 3723 | {
|
---|
| 3724 | HENUM henum;
|
---|
| 3725 | HWND hwndChild;
|
---|
| 3726 | register LONG x,y,cx,cy,ucx,ucy,ux,uy;
|
---|
| 3727 | SWP swp;
|
---|
| 3728 |
|
---|
| 3729 | henum = WinBeginEnumWindows(hwndClient);
|
---|
| 3730 | while((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
| 3731 | if(!WinQueryWindowUShort(hwndChild,QWS_ID))
|
---|
| 3732 | continue;
|
---|
| 3733 | if(WinQueryWindowPos(hwndChild,&swp)) {
|
---|
| 3734 | if(swp.fl & (SWP_MINIMIZE | SWP_HIDE)) {
|
---|
| 3735 | swp.x = WinQueryWindowUShort(hwndChild,QWS_XRESTORE);
|
---|
| 3736 | swp.y = WinQueryWindowUShort(hwndChild,QWS_YRESTORE);
|
---|
| 3737 | swp.cx = WinQueryWindowUShort(hwndChild,QWS_CXRESTORE);
|
---|
| 3738 | swp.cy = WinQueryWindowUShort(hwndChild,QWS_CYRESTORE);
|
---|
| 3739 | }
|
---|
| 3740 | else if(swp.fl & SWP_MAXIMIZE) {
|
---|
| 3741 | swp.x = WinQueryWindowUShort(hwndChild,QWS_XRESTORE);
|
---|
| 3742 | swp.y = WinQueryWindowUShort(hwndChild,QWS_YRESTORE);
|
---|
| 3743 | swp.cx = WinQueryWindowUShort(hwndChild,QWS_CXRESTORE);
|
---|
| 3744 | swp.cy = WinQueryWindowUShort(hwndChild,QWS_CYRESTORE);
|
---|
| 3745 | }
|
---|
| 3746 | cx = (swp.cx) ? (LONG)(((double)oldcx * 100.0) / (double)swp.cx) : 0;
|
---|
| 3747 | cy = (swp.cy) ? (LONG)(((double)oldcy * 100.0) / (double)swp.cy) : 0;
|
---|
| 3748 | x = (swp.x) ? (LONG)(((double)oldcx * 100.0) / (double)swp.x) : 0;
|
---|
| 3749 | y = (swp.y) ? (LONG)(((double)oldcy * 100.0) / (double)swp.y) : 0;
|
---|
| 3750 | if(x < 0)
|
---|
| 3751 | x = 0;
|
---|
| 3752 | if(y < 0)
|
---|
| 3753 | y = 0;
|
---|
| 3754 | ux = (x) ? (LONG)(((double)newcx * 100.0) / (double)x) : 0;
|
---|
| 3755 | uy = (y) ? (LONG)(((double)newcy * 100.0) / (double)y) : 0;
|
---|
| 3756 | ucx = (cx) ? (LONG)(((double)newcx * 100.0) / (double)cx) : 0;
|
---|
| 3757 | ucy = (cy) ? (LONG)(((double)newcy * 100.0) / (double)cy) : 0;
|
---|
| 3758 | if(ux + ucx > newcx)
|
---|
| 3759 | ucx = newcx - ux;
|
---|
| 3760 | if(uy + ucy > newcy)
|
---|
| 3761 | ucy = newcy - uy;
|
---|
| 3762 |
|
---|
| 3763 | if(!(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE)))
|
---|
| 3764 | WinSetWindowPos(hwndChild,HWND_TOP,ux,uy,ucx,ucy,
|
---|
| 3765 | SWP_MOVE | SWP_SIZE | SWP_SHOW);
|
---|
| 3766 | else if(swp.fl & (SWP_HIDE | SWP_MINIMIZE)) {
|
---|
| 3767 | WinSetWindowUShort(hwndChild,QWS_XMINIMIZE,(USHORT)-1);
|
---|
| 3768 | WinSetWindowUShort(hwndChild,QWS_YMINIMIZE,(USHORT)-1);
|
---|
| 3769 | WinSetWindowPos(hwndChild,HWND_TOP,0,0,0,0,
|
---|
| 3770 | SWP_SIZE | SWP_MOVE | SWP_FOCUSDEACTIVATE);
|
---|
| 3771 | WinSetWindowUShort(hwndChild,QWS_XRESTORE,ux);
|
---|
| 3772 | WinSetWindowUShort(hwndChild,QWS_YRESTORE,uy);
|
---|
| 3773 | WinSetWindowUShort(hwndChild,QWS_CXRESTORE,ucx);
|
---|
| 3774 | WinSetWindowUShort(hwndChild,QWS_CYRESTORE,ucy);
|
---|
| 3775 | }
|
---|
| 3776 | else {
|
---|
| 3777 | WinGetMaxPosition(hwndChild,&swp);
|
---|
| 3778 | WinSetWindowPos(hwndChild,HWND_TOP,swp.x,swp.y,swp.cx,swp.cy,
|
---|
| 3779 | SWP_MOVE | SWP_SIZE | SWP_SHOW);
|
---|
| 3780 | WinSetWindowUShort(hwndChild,QWS_XRESTORE,ux);
|
---|
| 3781 | WinSetWindowUShort(hwndChild,QWS_YRESTORE,uy);
|
---|
| 3782 | WinSetWindowUShort(hwndChild,QWS_CXRESTORE,ucx);
|
---|
| 3783 | WinSetWindowUShort(hwndChild,QWS_CYRESTORE,ucy);
|
---|
| 3784 | }
|
---|
| 3785 | }
|
---|
| 3786 | }
|
---|
| 3787 | WinEndEnumWindows(henum);
|
---|
| 3788 | }
|
---|
| 3789 | if(!fFreeTree) {
|
---|
| 3790 |
|
---|
| 3791 | RECTL Rectl;
|
---|
| 3792 | SWP swp;
|
---|
| 3793 |
|
---|
| 3794 | WinQueryWindowRect(hwndClient,&Rectl);
|
---|
| 3795 | AdjustSizeOfClient(NULL,&Rectl);
|
---|
| 3796 | WinQueryWindowPos(hwndTree,&swp);
|
---|
| 3797 | if(!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
|
---|
| 3798 | if(swp.y + swp.cy < Rectl.yTop - Rectl.yBottom)
|
---|
| 3799 | swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;
|
---|
| 3800 | if(swp.x != 0)
|
---|
| 3801 | swp.x = 0;
|
---|
| 3802 | if(swp.y < 0)
|
---|
| 3803 | swp.y = 0;
|
---|
| 3804 | if(swp.x + swp.cx > Rectl.xRight - Rectl.xLeft)
|
---|
| 3805 | swp.cx = Rectl.xRight - Rectl.xLeft;
|
---|
| 3806 | WinSetWindowPos(hwndTree,HWND_TOP,swp.x,swp.y,swp.cx,swp.cy,
|
---|
| 3807 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
|
---|
| 3808 | }
|
---|
| 3809 | }
|
---|
| 3810 | }
|
---|
| 3811 |
|
---|
| 3812 |
|
---|
| 3813 | VOID MinResChildren (HWND hwndClient,ULONG cmd) {
|
---|
| 3814 |
|
---|
| 3815 | HENUM henum;
|
---|
| 3816 | HWND hwndChild;
|
---|
| 3817 |
|
---|
| 3818 | {
|
---|
| 3819 | SWP swp;
|
---|
| 3820 |
|
---|
| 3821 | WinQueryWindowPos(hwndClient,&swp);
|
---|
| 3822 | if(swp.fl & (SWP_HIDE | SWP_MINIMIZE))
|
---|
| 3823 | return;
|
---|
| 3824 | }
|
---|
| 3825 | henum = WinBeginEnumWindows(hwndClient);
|
---|
| 3826 | while((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
| 3827 | if(!WinQueryWindowUShort(hwndChild,QWS_ID))
|
---|
| 3828 | continue;
|
---|
| 3829 | WinSetWindowPos(hwndChild,HWND_TOP,0,0,0,0,cmd);
|
---|
| 3830 | }
|
---|
| 3831 | }
|
---|
| 3832 |
|
---|
| 3833 |
|
---|
| 3834 | MRESULT EXPENTRY ChildFrameButtonProc (HWND hwnd,ULONG msg,MPARAM mp1,
|
---|
| 3835 | MPARAM mp2) {
|
---|
| 3836 |
|
---|
| 3837 | USHORT id;
|
---|
| 3838 | static BOOL emphasized = FALSE;
|
---|
| 3839 |
|
---|
| 3840 | switch(msg) {
|
---|
| 3841 | case WM_BUTTON1CLICK:
|
---|
| 3842 | case WM_CHORD:
|
---|
| 3843 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 3844 | break;
|
---|
| 3845 |
|
---|
| 3846 | case WM_MOUSEMOVE:
|
---|
| 3847 | if(fOtherHelp) {
|
---|
| 3848 | if((!hwndBubble || WinQueryWindowULong(hwndBubble,0) != hwnd) &&
|
---|
| 3849 | !WinQueryCapture(HWND_DESKTOP)) {
|
---|
| 3850 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 3851 | switch(id) {
|
---|
| 3852 | case IDM_OPENWALK:
|
---|
| 3853 | MakeBubble(hwnd,
|
---|
| 3854 | FALSE,
|
---|
| 3855 | GetPString(IDS_WALKBUTTONHELP));
|
---|
| 3856 | break;
|
---|
| 3857 | case IDM_USERLIST:
|
---|
| 3858 | MakeBubble(hwnd,
|
---|
| 3859 | FALSE,
|
---|
| 3860 | GetPString(IDS_QUICKBUTTONHELP));
|
---|
| 3861 | break;
|
---|
| 3862 | }
|
---|
| 3863 | }
|
---|
| 3864 | }
|
---|
| 3865 | break;
|
---|
| 3866 |
|
---|
| 3867 | case WM_BUTTON3CLICK:
|
---|
| 3868 | case WM_BUTTON2CLICK:
|
---|
| 3869 | {
|
---|
| 3870 | USHORT cmd = 0;
|
---|
| 3871 |
|
---|
| 3872 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 3873 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 3874 | switch(id) {
|
---|
| 3875 | case IDM_OPENWALK:
|
---|
| 3876 | switch(msg) {
|
---|
| 3877 | case WM_BUTTON2CLICK:
|
---|
| 3878 | if((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) ==
|
---|
| 3879 | (KC_ALT | KC_SHIFT | KC_CTRL))
|
---|
| 3880 | cmd = IDM_GREP;
|
---|
| 3881 | else if((shiftstate & (KC_ALT | KC_CTRL)) ==
|
---|
| 3882 | (KC_ALT | KC_CTRL))
|
---|
| 3883 | CascadeChildren(hwndMain);
|
---|
| 3884 | #ifdef NEVER
|
---|
| 3885 | else if((shiftstate & (KC_ALT | KC_SHIFT)) ==
|
---|
| 3886 | (KC_ALT | KC_SHIFT))
|
---|
| 3887 | cmd = IDM_SYSINFO;
|
---|
| 3888 | #endif
|
---|
| 3889 | else if(shiftstate & KC_SHIFT)
|
---|
| 3890 | cmd = IDM_WINDOWDLG;
|
---|
| 3891 | else if(shiftstate & KC_CTRL)
|
---|
| 3892 | cmd = IDM_SEEALL;
|
---|
| 3893 | else if(shiftstate & KC_ALT)
|
---|
| 3894 | TileChildren(hwndMain,TRUE);
|
---|
| 3895 | else
|
---|
| 3896 | cmd = IDM_WALKDIR;
|
---|
| 3897 | break;
|
---|
| 3898 | case WM_BUTTON3CLICK:
|
---|
| 3899 | TileChildren(hwndMain,TRUE);
|
---|
| 3900 | break;
|
---|
| 3901 | }
|
---|
| 3902 | break;
|
---|
| 3903 | case IDM_USERLIST:
|
---|
| 3904 | switch(msg) {
|
---|
| 3905 | case WM_BUTTON2CLICK:
|
---|
| 3906 | if((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) ==
|
---|
| 3907 | (KC_ALT | KC_SHIFT | KC_CTRL))
|
---|
| 3908 | cmd = IDM_COLORPALETTE;
|
---|
| 3909 | else if((shiftstate & (KC_ALT | KC_CTRL)) ==
|
---|
| 3910 | (KC_ALT | KC_CTRL))
|
---|
| 3911 | cmd = IDM_HIDEMENU;
|
---|
| 3912 | else if((shiftstate & (KC_ALT | KC_SHIFT)) ==
|
---|
| 3913 | (KC_ALT | KC_SHIFT))
|
---|
| 3914 | cmd = IDM_NOTEBOOK;
|
---|
| 3915 | else if(shiftstate & KC_SHIFT)
|
---|
| 3916 | cmd = IDM_TOOLTITLES;
|
---|
| 3917 | else if(shiftstate & KC_CTRL)
|
---|
| 3918 | cmd = IDM_TEXTTOOLS;
|
---|
| 3919 | else if(shiftstate & KC_ALT)
|
---|
| 3920 | cmd = IDM_FONTPALETTE;
|
---|
| 3921 | else
|
---|
| 3922 | cmd = IDM_TOOLBAR;
|
---|
| 3923 | break;
|
---|
| 3924 | case WM_BUTTON3CLICK:
|
---|
| 3925 | cmd = IDM_DRIVEBAR;
|
---|
| 3926 | break;
|
---|
| 3927 | }
|
---|
| 3928 | break;
|
---|
| 3929 | }
|
---|
| 3930 | if(cmd)
|
---|
| 3931 | PostMsg(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),FID_CLIENT),
|
---|
| 3932 | WM_COMMAND,
|
---|
| 3933 | MPFROM2SHORT(cmd,0),
|
---|
| 3934 | MPVOID);
|
---|
| 3935 | }
|
---|
| 3936 | break;
|
---|
| 3937 |
|
---|
| 3938 | case DM_DRAGOVER:
|
---|
| 3939 | id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
| 3940 | if(id == IDM_OPENWALK) {
|
---|
| 3941 | if(!emphasized) {
|
---|
| 3942 | emphasized = TRUE;
|
---|
| 3943 | DrawTargetEmphasis(hwnd,emphasized);
|
---|
| 3944 | }
|
---|
| 3945 | if(AcceptOneDrop(mp1,mp2))
|
---|
| 3946 | return MRFROM2SHORT(DOR_DROP,
|
---|
| 3947 | DO_MOVE);
|
---|
| 3948 | }
|
---|
| 3949 | return MRFROM2SHORT(DOR_NEVERDROP,0);
|
---|
| 3950 |
|
---|
| 3951 | case DM_DRAGLEAVE:
|
---|
| 3952 | if(emphasized) {
|
---|
| 3953 | emphasized = FALSE;
|
---|
| 3954 | DrawTargetEmphasis(hwnd,emphasized);
|
---|
| 3955 | }
|
---|
| 3956 | break;
|
---|
| 3957 |
|
---|
| 3958 | case DM_DROPHELP:
|
---|
| 3959 | DropHelp(mp1,mp2,hwnd,GetPString(IDS_OPENDROPHELP));
|
---|
| 3960 | return 0;
|
---|
| 3961 |
|
---|
| 3962 | case DM_DROP:
|
---|
| 3963 | {
|
---|
| 3964 | char szFrom[CCHMAXPATH + 2];
|
---|
| 3965 |
|
---|
| 3966 | if(emphasized) {
|
---|
| 3967 | emphasized = FALSE;
|
---|
| 3968 | DrawTargetEmphasis(hwnd,
|
---|
| 3969 | emphasized);
|
---|
| 3970 | }
|
---|
| 3971 | if(GetOneDrop(mp1,
|
---|
| 3972 | mp2,
|
---|
| 3973 | szFrom,
|
---|
| 3974 | sizeof(szFrom))) {
|
---|
| 3975 | if(MakeValidDir(szFrom) &&
|
---|
| 3976 | !FindDirCnrByName(szFrom,TRUE)) {
|
---|
| 3977 | OpenDirCnr((HWND)0,
|
---|
| 3978 | hwndMain,
|
---|
| 3979 | hwndTree,
|
---|
| 3980 | FALSE,
|
---|
| 3981 | szFrom);
|
---|
| 3982 | }
|
---|
| 3983 | }
|
---|
| 3984 | }
|
---|
| 3985 | return 0;
|
---|
| 3986 |
|
---|
| 3987 | case WM_CLOSE:
|
---|
| 3988 | WinDestroyWindow(hwnd);
|
---|
| 3989 | return 0;
|
---|
| 3990 | }
|
---|
| 3991 | return PFNWPButton(hwnd,msg,mp1,mp2);
|
---|
| 3992 | }
|
---|
| 3993 |
|
---|
| 3994 |
|
---|
| 3995 | MRESULT EXPENTRY MainFrameWndProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
| 3996 |
|
---|
| 3997 | PFNWP oldproc = (PFNWP)WinQueryWindowPtr(hwnd,0);
|
---|
| 3998 | static ULONG aheight = 0L;
|
---|
| 3999 |
|
---|
| 4000 | switch(msg) {
|
---|
| 4001 | case WM_ADJUSTWINDOWPOS:
|
---|
| 4002 | {
|
---|
| 4003 | SWP *pswp;
|
---|
| 4004 |
|
---|
| 4005 | pswp = (SWP *)mp1;
|
---|
| 4006 | if(fDataMin && !fAmClosing) {
|
---|
| 4007 | if(pswp->fl & (SWP_HIDE | SWP_MINIMIZE)) {
|
---|
| 4008 |
|
---|
| 4009 | SWP swp;
|
---|
| 4010 |
|
---|
| 4011 | WinQueryWindowPos(hwnd,&swp);
|
---|
| 4012 | PostMsg(hwnd,
|
---|
| 4013 | UM_FOCUSME,
|
---|
| 4014 | MPFROMLONG(swp.fl),
|
---|
| 4015 | MPVOID);
|
---|
| 4016 | HideNote();
|
---|
| 4017 | }
|
---|
| 4018 | else if(pswp->fl & (SWP_SHOW | SWP_RESTORE)) {
|
---|
| 4019 | if(DataHwnd)
|
---|
| 4020 | PostMsg(DataHwnd,
|
---|
| 4021 | WM_CLOSE,
|
---|
| 4022 | MPVOID,
|
---|
| 4023 | MPVOID);
|
---|
| 4024 | }
|
---|
| 4025 | }
|
---|
| 4026 | if(!fAmClosing) {
|
---|
| 4027 | if(pswp->fl & (SWP_HIDE | SWP_MINIMIZE))
|
---|
| 4028 | HideNote();
|
---|
| 4029 | }
|
---|
| 4030 | }
|
---|
| 4031 | break;
|
---|
| 4032 |
|
---|
| 4033 | case UM_FOCUSME:
|
---|
| 4034 | CreateDataBar(HWND_DESKTOP,(ULONG)mp1);
|
---|
| 4035 | return 0;
|
---|
| 4036 |
|
---|
| 4037 | case WM_BUTTON1UP:
|
---|
| 4038 | case WM_BUTTON2UP:
|
---|
| 4039 | case WM_BUTTON3UP:
|
---|
| 4040 | case WM_MOUSEMOVE:
|
---|
| 4041 | case WM_CHORD:
|
---|
| 4042 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 4043 | break;
|
---|
| 4044 |
|
---|
| 4045 | case WM_CHAR:
|
---|
| 4046 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
| 4047 | break;
|
---|
| 4048 |
|
---|
| 4049 | case WM_CONTROL:
|
---|
| 4050 | return WinSendMsg(WinWindowFromID(hwnd,FID_CLIENT),UM_CONTROL,mp1,mp2);
|
---|
| 4051 |
|
---|
| 4052 | case WM_COMMAND:
|
---|
| 4053 | return WinSendMsg(WinWindowFromID(hwnd,FID_CLIENT),msg,mp1,mp2);
|
---|
| 4054 |
|
---|
| 4055 | case WM_CALCFRAMERECT:
|
---|
| 4056 | {
|
---|
| 4057 | MRESULT mr;
|
---|
| 4058 | PRECTL prectl;
|
---|
| 4059 | LONG sheight = 20,bheight = 20;
|
---|
| 4060 |
|
---|
| 4061 | mr = oldproc(hwnd,msg,mp1,mp2);
|
---|
| 4062 |
|
---|
| 4063 | /*
|
---|
| 4064 | * Calculate the position of the client rectangle.
|
---|
| 4065 | * Otherwise, we'll see a lot of redraw when we move the
|
---|
| 4066 | * client during WM_FORMATFRAME.
|
---|
| 4067 | */
|
---|
| 4068 |
|
---|
| 4069 | if(mr && mp2) {
|
---|
| 4070 | prectl = (PRECTL)mp1;
|
---|
| 4071 | if(prectl->yBottom != prectl->yTop) {
|
---|
| 4072 | {
|
---|
| 4073 | HPS hps;
|
---|
| 4074 | POINTL aptl[TXTBOX_COUNT];
|
---|
| 4075 |
|
---|
| 4076 | hps = WinGetPS(hwndStatus);
|
---|
| 4077 | if(hps) {
|
---|
| 4078 | GpiQueryTextBox(hps,6,"$`WjgT",TXTBOX_COUNT,aptl);
|
---|
| 4079 | bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
---|
| 4080 | WinReleasePS(hps);
|
---|
| 4081 | }
|
---|
| 4082 | }
|
---|
| 4083 | prectl->yBottom += (sheight + 4);
|
---|
| 4084 | prectl->yTop -= (sheight + 4);
|
---|
| 4085 | if(fMoreButtons) {
|
---|
| 4086 |
|
---|
| 4087 | HPS hps;
|
---|
| 4088 | POINTL aptl[TXTBOX_COUNT];
|
---|
| 4089 |
|
---|
| 4090 | hps = WinGetPS(hwndName);
|
---|
| 4091 | if(hps) {
|
---|
| 4092 | GpiQueryTextBox(hps,
|
---|
| 4093 | 6,
|
---|
| 4094 | "$`WjgT",
|
---|
| 4095 | TXTBOX_COUNT,
|
---|
| 4096 | aptl);
|
---|
| 4097 | bheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
---|
| 4098 | WinReleasePS(hps);
|
---|
| 4099 | }
|
---|
| 4100 | prectl->yBottom += (bheight + 4);
|
---|
| 4101 | prectl->yTop -= (bheight + 4);
|
---|
| 4102 | }
|
---|
| 4103 | if(fToolbar) {
|
---|
| 4104 | if(!fTextTools)
|
---|
| 4105 | prectl->yTop -= ((fToolTitles) ? 50 : 40);
|
---|
| 4106 | else
|
---|
| 4107 | prectl->yTop -= 32;
|
---|
| 4108 | }
|
---|
| 4109 | if(fDrivebar) {
|
---|
| 4110 | ResizeDrives(WinWindowFromID(hwnd,MAIN_DRIVES),
|
---|
| 4111 | ((prectl->xRight -
|
---|
| 4112 | (WinQuerySysValue(HWND_DESKTOP,
|
---|
| 4113 | SV_CYSIZEBORDER) * 2)) - 4));
|
---|
| 4114 | prectl->yTop -= (16 * (DriveLines * 18));
|
---|
| 4115 | }
|
---|
| 4116 | if(fUserComboBox) {
|
---|
| 4117 | if(!aheight) {
|
---|
| 4118 |
|
---|
| 4119 | SWP swpTemp;
|
---|
| 4120 |
|
---|
| 4121 | WinQueryWindowPos(WinWindowFromID(hwndDrivelist,CBID_EDIT),
|
---|
| 4122 | &swpTemp);
|
---|
| 4123 | aheight = swpTemp.cy;
|
---|
| 4124 | }
|
---|
| 4125 | prectl->yTop -= (aheight + 6L);
|
---|
| 4126 | }
|
---|
| 4127 | if(fAutoView) {
|
---|
| 4128 | AutoviewHeight = min(AutoviewHeight,
|
---|
| 4129 | (prectl->yTop - prectl->yBottom) - 116);
|
---|
| 4130 | AutoviewHeight = max(AutoviewHeight,36);
|
---|
| 4131 | prectl->yBottom += (AutoviewHeight + 6);
|
---|
| 4132 | }
|
---|
| 4133 | }
|
---|
| 4134 | }
|
---|
| 4135 | return mr;
|
---|
| 4136 | }
|
---|
| 4137 |
|
---|
| 4138 | case WM_FORMATFRAME:
|
---|
| 4139 | {
|
---|
| 4140 | SHORT sCount,soldCount;
|
---|
| 4141 | PSWP pswp,pswpClient,pswpNew;
|
---|
| 4142 | SWP swpClient;
|
---|
| 4143 | LONG theight = 48L,dheight = 20L,width,sheight = 20,bheight = 20;
|
---|
| 4144 |
|
---|
| 4145 | sCount = (SHORT)oldproc(hwnd,msg,mp1,mp2);
|
---|
| 4146 | soldCount = sCount;
|
---|
| 4147 |
|
---|
| 4148 | /*
|
---|
| 4149 | * Reformat the frame to "squeeze" the client
|
---|
| 4150 | * and make room for status window sibling beneath
|
---|
| 4151 | * and toolbar above (if toolbar's on) and userlists
|
---|
| 4152 | * (if userlists are on).
|
---|
| 4153 | */
|
---|
| 4154 |
|
---|
| 4155 | pswp = (PSWP)mp1;
|
---|
| 4156 | {
|
---|
| 4157 | SHORT x;
|
---|
| 4158 |
|
---|
| 4159 | for(x = 0;x < soldCount;x++) {
|
---|
| 4160 | if(WinQueryWindowUShort(pswp->hwnd,QWS_ID) == FID_CLIENT) {
|
---|
| 4161 | pswpClient = pswp;
|
---|
| 4162 | break;
|
---|
| 4163 | }
|
---|
| 4164 | pswp++;
|
---|
| 4165 | }
|
---|
| 4166 | }
|
---|
| 4167 |
|
---|
| 4168 | {
|
---|
| 4169 | HPS hps;
|
---|
| 4170 | POINTL aptl[TXTBOX_COUNT];
|
---|
| 4171 |
|
---|
| 4172 | hps = WinGetPS(hwndStatus);
|
---|
| 4173 | if(hps) {
|
---|
| 4174 | GpiQueryTextBox(hps,
|
---|
| 4175 | 6,
|
---|
| 4176 | "$`WjgT",
|
---|
| 4177 | TXTBOX_COUNT,
|
---|
| 4178 | aptl);
|
---|
| 4179 | bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
---|
| 4180 | WinReleasePS(hps);
|
---|
| 4181 | }
|
---|
| 4182 | if(fMoreButtons) {
|
---|
| 4183 | hps = WinGetPS(hwndName);
|
---|
| 4184 | if(hps) {
|
---|
| 4185 | GpiQueryTextBox(hps,
|
---|
| 4186 | 6,
|
---|
| 4187 | "$`WjgT",
|
---|
| 4188 | TXTBOX_COUNT,
|
---|
| 4189 | aptl);
|
---|
| 4190 | bheight = aptl[TXTBOX_TOPLEFT].y + 6;
|
---|
| 4191 | WinReleasePS(hps);
|
---|
| 4192 | }
|
---|
| 4193 | }
|
---|
| 4194 | }
|
---|
| 4195 | pswpNew = (PSWP)mp1 + soldCount;
|
---|
| 4196 | *pswpNew = *pswpClient;
|
---|
| 4197 | swpClient = *pswpClient;
|
---|
| 4198 | pswpNew->hwnd = hwndStatus;
|
---|
| 4199 | pswpNew->hwndInsertBehind = HWND_BOTTOM;
|
---|
| 4200 | pswpNew->x = swpClient.x + 3;
|
---|
| 4201 | pswpNew->y = swpClient.y + 2;
|
---|
| 4202 | if(!fSplitStatus)
|
---|
| 4203 | width = swpClient.cx - (16 + (sheight * 2) + 4);
|
---|
| 4204 | else
|
---|
| 4205 | width = (swpClient.cx - (16 + (sheight * 2) + 4)) / 2;
|
---|
| 4206 | width = max(width,10);
|
---|
| 4207 | if(fSplitStatus)
|
---|
| 4208 | pswpNew->cx = width - 6;
|
---|
| 4209 | else
|
---|
| 4210 | pswpNew->cx = width - 8;
|
---|
| 4211 | pswpNew->cy = sheight;
|
---|
| 4212 | pswpClient->y = pswpNew->y + pswpNew->cy + 3;
|
---|
| 4213 | pswpClient->cy = (swpClient.cy - pswpNew->cy) - 3;
|
---|
| 4214 | sCount++;
|
---|
| 4215 |
|
---|
| 4216 | if(fSplitStatus) {
|
---|
| 4217 | pswpNew = (PSWP)mp1 + (soldCount + 1);
|
---|
| 4218 | *pswpNew = *pswpClient;
|
---|
| 4219 | pswpNew->hwnd = hwndStatus2;
|
---|
| 4220 | pswpNew->hwndInsertBehind = HWND_BOTTOM;
|
---|
| 4221 | pswpNew->x = width + 8;
|
---|
| 4222 | pswpNew->y = swpClient.y + 2;
|
---|
| 4223 | pswpNew->cx = width - 6;
|
---|
| 4224 | pswpNew->cy = sheight;
|
---|
| 4225 | sCount++;
|
---|
| 4226 | }
|
---|
| 4227 | else {
|
---|
| 4228 | WinShowWindow(hwndStatus2,FALSE);
|
---|
| 4229 | WinSetWindowText(hwndStatus2,
|
---|
| 4230 | NullStr);
|
---|
| 4231 | }
|
---|
| 4232 |
|
---|
| 4233 | if(fToolbar) {
|
---|
| 4234 | if(fTextTools)
|
---|
| 4235 | theight = 32L;
|
---|
| 4236 | else if(!fToolTitles)
|
---|
| 4237 | theight = 40L;
|
---|
| 4238 | pswpNew = (PSWP)mp1 + (soldCount + 1 +
|
---|
| 4239 | (fSplitStatus != FALSE));
|
---|
| 4240 | *pswpNew = *pswpClient;
|
---|
| 4241 | pswpNew->hwnd = WinWindowFromID(hwnd,MAIN_TOOLS);
|
---|
| 4242 | pswpNew->hwndInsertBehind = HWND_BOTTOM;
|
---|
| 4243 | pswpNew->x = swpClient.x + 2;
|
---|
| 4244 | pswpNew->y = (swpClient.y + swpClient.cy) - (theight - 2);
|
---|
| 4245 | pswpNew->cx = swpClient.cx - 4;
|
---|
| 4246 | pswpNew->cy = theight - 4;
|
---|
| 4247 | pswpClient->cy -= theight;
|
---|
| 4248 | sCount++;
|
---|
| 4249 | }
|
---|
| 4250 | else
|
---|
| 4251 | WinShowWindow(WinWindowFromID(hwnd,MAIN_TOOLS),FALSE);
|
---|
| 4252 |
|
---|
| 4253 | if(fDrivebar) {
|
---|
| 4254 | ResizeDrives(WinWindowFromID(hwnd,MAIN_DRIVES),
|
---|
| 4255 | pswpClient->cx - 4);
|
---|
| 4256 | pswpNew = (PSWP)mp1 + (soldCount + 1 +
|
---|
| 4257 | (fSplitStatus != FALSE) +
|
---|
| 4258 | (fToolbar != FALSE));
|
---|
| 4259 | *pswpNew = *pswpClient;
|
---|
| 4260 | pswpNew->hwnd = WinWindowFromID(hwnd,MAIN_DRIVES);
|
---|
| 4261 | pswpNew->hwndInsertBehind = HWND_BOTTOM;
|
---|
| 4262 | pswpNew->x = swpClient.x + 2;
|
---|
| 4263 | dheight += ((dheight - 2) * DriveLines);
|
---|
| 4264 | pswpNew->y = (swpClient.y + swpClient.cy) - (dheight - 2);
|
---|
| 4265 | if(fToolbar)
|
---|
| 4266 | pswpNew->y -= theight;
|
---|
| 4267 | pswpNew->cx = swpClient.cx - 4;
|
---|
| 4268 | pswpNew->cy = dheight - 4;
|
---|
| 4269 | pswpClient->cy -= dheight;
|
---|
| 4270 | sCount++;
|
---|
| 4271 | }
|
---|
| 4272 | else
|
---|
| 4273 | WinShowWindow(WinWindowFromID(hwnd,MAIN_DRIVES),FALSE);
|
---|
| 4274 |
|
---|
| 4275 | if(fAutoView) {
|
---|
| 4276 | pswpNew = (PSWP)mp1 + (soldCount + 1 +
|
---|
| 4277 | (fToolbar != FALSE) +
|
---|
| 4278 | (fDrivebar != FALSE) +
|
---|
| 4279 | (fSplitStatus != FALSE));
|
---|
| 4280 | *pswpNew = *pswpClient;
|
---|
| 4281 | pswpNew->hwnd = (fComments) ? hwndAutoMLE : hwndAutoview;
|
---|
| 4282 | pswpNew->x = pswpClient->x + 3;
|
---|
| 4283 | pswpNew->y = pswpClient->y + 3;
|
---|
| 4284 | if(fMoreButtons)
|
---|
| 4285 | pswpNew->y += (bheight + 4);
|
---|
| 4286 | pswpNew->cx = pswpClient->cx - 6;
|
---|
| 4287 | AutoviewHeight = min(AutoviewHeight,
|
---|
| 4288 | pswpClient->cy - 116);
|
---|
| 4289 | AutoviewHeight = max(AutoviewHeight,36);
|
---|
| 4290 | pswpNew->cy = AutoviewHeight;
|
---|
| 4291 | pswpClient->y += (AutoviewHeight + 6);
|
---|
| 4292 | pswpClient->cy -= (AutoviewHeight + 6);
|
---|
| 4293 | sCount++;
|
---|
| 4294 | WinShowWindow((fComments) ? hwndAutoview : hwndAutoMLE,FALSE);
|
---|
| 4295 | }
|
---|
| 4296 | else {
|
---|
| 4297 | WinShowWindow(hwndAutoview,FALSE);
|
---|
| 4298 | WinShowWindow(hwndAutoMLE,FALSE);
|
---|
| 4299 | }
|
---|
| 4300 |
|
---|
| 4301 | pswpNew = (PSWP)mp1 + (soldCount + 1 +
|
---|
| 4302 | (fToolbar != FALSE) +
|
---|
| 4303 | (fDrivebar != FALSE) +
|
---|
| 4304 | (fSplitStatus != FALSE) +
|
---|
| 4305 | (fAutoView != FALSE));
|
---|
| 4306 | *pswpNew = *pswpClient;
|
---|
| 4307 | pswpNew->hwnd = WinWindowFromID(hwnd,IDM_OPENWALK);
|
---|
| 4308 | pswpNew->x = swpClient.cx - ((sheight * 2) + 4);
|
---|
| 4309 | pswpNew->y = swpClient.y;
|
---|
| 4310 | pswpNew->cx = sheight + 4;
|
---|
| 4311 | pswpNew->cy = sheight + 4;
|
---|
| 4312 | sCount++;
|
---|
| 4313 | pswpNew = (PSWP)mp1 + (soldCount + 2 +
|
---|
| 4314 | (fToolbar != FALSE) +
|
---|
| 4315 | (fDrivebar != FALSE) +
|
---|
| 4316 | (fSplitStatus != FALSE) +
|
---|
| 4317 | (fAutoView != FALSE));
|
---|
| 4318 | *pswpNew = *pswpClient;
|
---|
| 4319 | pswpNew->hwnd = WinWindowFromID(hwnd,IDM_USERLIST);
|
---|
| 4320 | pswpNew->x = swpClient.cx - (sheight + 2);
|
---|
| 4321 | pswpNew->y = swpClient.y;
|
---|
| 4322 | pswpNew->cx = sheight + 4;
|
---|
| 4323 | pswpNew->cy = sheight + 4;
|
---|
| 4324 | sCount++;
|
---|
| 4325 | pswpNew = (PSWP)mp1 + (soldCount + 3 +
|
---|
| 4326 | (fToolbar != FALSE) +
|
---|
| 4327 | (fDrivebar != FALSE) +
|
---|
| 4328 | (fSplitStatus != FALSE) +
|
---|
| 4329 | (fAutoView != FALSE));
|
---|
| 4330 | *pswpNew = *pswpClient;
|
---|
| 4331 | pswpNew->hwnd = WinWindowFromID(hwnd,MAIN_LED);
|
---|
| 4332 | pswpNew->x = swpClient.cx - ((sheight * 2) + 16);
|
---|
| 4333 | pswpNew->y = swpClient.y;
|
---|
| 4334 | pswpNew->cx = 12;
|
---|
| 4335 | pswpNew->cy = 12;
|
---|
| 4336 | sCount++;
|
---|
| 4337 | pswpNew = (PSWP)mp1 + (soldCount + 4 +
|
---|
| 4338 | (fToolbar != FALSE) +
|
---|
| 4339 | (fDrivebar != FALSE) +
|
---|
| 4340 | (fSplitStatus != FALSE) +
|
---|
| 4341 | (fAutoView != FALSE));
|
---|
| 4342 | *pswpNew = *pswpClient;
|
---|
| 4343 | pswpNew->hwnd = WinWindowFromID(hwnd,MAIN_LEDHDR);
|
---|
| 4344 | pswpNew->x = swpClient.cx - ((sheight * 2) + 16);
|
---|
| 4345 | pswpNew->y = swpClient.y + 12;
|
---|
| 4346 | pswpNew->cx = 12;
|
---|
| 4347 | pswpNew->cy = sheight - 8;
|
---|
| 4348 | sCount++;
|
---|
| 4349 | if(fUserComboBox) {
|
---|
| 4350 | if(!aheight) {
|
---|
| 4351 |
|
---|
| 4352 | SWP swpTemp;
|
---|
| 4353 |
|
---|
| 4354 | WinQueryWindowPos(WinWindowFromID(hwndDrivelist,CBID_EDIT),
|
---|
| 4355 | &swpTemp);
|
---|
| 4356 | aheight = swpTemp.cy;
|
---|
| 4357 | }
|
---|
| 4358 | pswpNew = (PSWP)mp1 + (soldCount + 5 +
|
---|
| 4359 | (fToolbar != FALSE) +
|
---|
| 4360 | (fSplitStatus != FALSE) +
|
---|
| 4361 | (fDrivebar != FALSE) +
|
---|
| 4362 | (fAutoView != FALSE));
|
---|
| 4363 | *pswpNew = *pswpClient;
|
---|
| 4364 | pswpNew->hwnd = hwndDrivelist;
|
---|
| 4365 | pswpNew->x = swpClient.x;
|
---|
| 4366 | pswpNew->cx = 48;
|
---|
| 4367 | pswpClient->cy -= (aheight + 6L);
|
---|
| 4368 | pswpNew->y = pswpClient->y;
|
---|
| 4369 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
---|
| 4370 | sCount++;
|
---|
| 4371 | pswpNew = (PSWP)mp1 + (soldCount + 6 +
|
---|
| 4372 | (fToolbar != FALSE) +
|
---|
| 4373 | (fDrivebar != FALSE) +
|
---|
| 4374 | (fSplitStatus != FALSE) +
|
---|
| 4375 | (fAutoView != FALSE));
|
---|
| 4376 | *pswpNew = *pswpClient;
|
---|
| 4377 | pswpNew->hwnd = hwndStatelist;
|
---|
| 4378 | pswpNew->x = swpClient.x + 48;
|
---|
| 4379 | pswpNew->cx = (swpClient.cx - 48) / 7;
|
---|
| 4380 | pswpNew->y = pswpClient->y;
|
---|
| 4381 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
---|
| 4382 | sCount++;
|
---|
| 4383 | pswpNew = (PSWP)mp1 + (soldCount + 7 +
|
---|
| 4384 | (fToolbar != FALSE) +
|
---|
| 4385 | (fDrivebar != FALSE) +
|
---|
| 4386 | (fSplitStatus != FALSE) +
|
---|
| 4387 | (fAutoView != FALSE));
|
---|
| 4388 | *pswpNew = *pswpClient;
|
---|
| 4389 | pswpNew->hwnd = hwndCmdlist;
|
---|
| 4390 | pswpNew->x = swpClient.x + 48 + ((swpClient.cx - 48) / 7);
|
---|
| 4391 | pswpNew->cx = (swpClient.cx - 48) / 5 +
|
---|
| 4392 | ((swpClient.cx - 48) / 5) - ((swpClient.cx - 48) / 7);
|
---|
| 4393 | pswpNew->y = pswpClient->y;
|
---|
| 4394 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
---|
| 4395 | sCount++;
|
---|
| 4396 | pswpNew = (PSWP)mp1 + (soldCount + 8 +
|
---|
| 4397 | (fToolbar != FALSE) +
|
---|
| 4398 | (fDrivebar != FALSE) +
|
---|
| 4399 | (fSplitStatus != FALSE) +
|
---|
| 4400 | (fAutoView != FALSE));
|
---|
| 4401 | *pswpNew = *pswpClient;
|
---|
| 4402 | pswpNew->hwnd = hwndUserlist;
|
---|
| 4403 | pswpNew->x = swpClient.x + 48 + (((swpClient.cx - 48) / 5) * 2);
|
---|
| 4404 | pswpNew->cx = ((swpClient.x + swpClient.cx) - pswpNew->x) -
|
---|
| 4405 | ((fToolbar) ?
|
---|
| 4406 | ((swpClient.cx - 48) / 7) : 0);
|
---|
| 4407 | pswpNew->y = pswpClient->y;
|
---|
| 4408 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
---|
| 4409 | sCount++;
|
---|
| 4410 | if(fToolbar) {
|
---|
| 4411 | pswpNew = (PSWP)mp1 + (soldCount + 9 +
|
---|
| 4412 | (fToolbar != FALSE) +
|
---|
| 4413 | (fDrivebar != FALSE) +
|
---|
| 4414 | (fSplitStatus != FALSE) +
|
---|
| 4415 | (fAutoView != FALSE));
|
---|
| 4416 | *pswpNew = *pswpClient;
|
---|
| 4417 | pswpNew->hwnd = hwndButtonlist;
|
---|
| 4418 | pswpNew->x = swpClient.cx - ((swpClient.cx - 48) / 7) + 4;
|
---|
| 4419 | pswpNew->cx = (swpClient.x + swpClient.cx) - pswpNew->x;
|
---|
| 4420 | pswpNew->y = pswpClient->y;
|
---|
| 4421 | pswpNew->cy = pswpClient->cy + (aheight + 5L);
|
---|
| 4422 | sCount++;
|
---|
| 4423 | }
|
---|
| 4424 | else
|
---|
| 4425 | WinShowWindow(hwndButtonlist,FALSE);
|
---|
| 4426 | }
|
---|
| 4427 | else {
|
---|
| 4428 | WinShowWindow(hwndUserlist,FALSE);
|
---|
| 4429 | WinShowWindow(hwndDrivelist,FALSE);
|
---|
| 4430 | WinShowWindow(hwndStatelist,FALSE);
|
---|
| 4431 | WinShowWindow(hwndButtonlist,FALSE);
|
---|
| 4432 | WinShowWindow(hwndCmdlist,FALSE);
|
---|
| 4433 | }
|
---|
| 4434 | {
|
---|
| 4435 | PSWP pswpTitlebar = (PSWP)0,pswpMinbutton = (PSWP)0;
|
---|
| 4436 | SHORT x;
|
---|
| 4437 |
|
---|
| 4438 | pswpNew = (PSWP)mp1 + (soldCount + 5 +
|
---|
| 4439 | (fToolbar != FALSE) +
|
---|
| 4440 | (fDrivebar != FALSE) +
|
---|
| 4441 | (fSplitStatus != FALSE) +
|
---|
| 4442 | (fAutoView != FALSE) +
|
---|
| 4443 | ((fUserComboBox != FALSE) * 4) +
|
---|
| 4444 | (fUserComboBox != FALSE &&
|
---|
| 4445 | fToolbar != FALSE));
|
---|
| 4446 | pswp = (PSWP)mp1;
|
---|
| 4447 | for(x = 0;x < soldCount;x++) {
|
---|
| 4448 | if(!pswpTitlebar &&
|
---|
| 4449 | WinQueryWindowUShort(pswp->hwnd,QWS_ID) == FID_TITLEBAR)
|
---|
| 4450 | pswpTitlebar = pswp;
|
---|
| 4451 | else if(!pswpMinbutton &&
|
---|
| 4452 | WinQueryWindowUShort(pswp->hwnd,QWS_ID) == FID_MINMAX)
|
---|
| 4453 | pswpMinbutton = pswp;
|
---|
| 4454 | if(pswpTitlebar &&
|
---|
| 4455 | pswpMinbutton)
|
---|
| 4456 | break;
|
---|
| 4457 | pswp++;
|
---|
| 4458 | }
|
---|
| 4459 | if(pswpMinbutton &&
|
---|
| 4460 | pswpTitlebar) {
|
---|
| 4461 | *pswpNew = *pswpMinbutton;
|
---|
| 4462 | pswpNew->hwnd = WinWindowFromID(hwnd,IDM_IDEALSIZE);
|
---|
| 4463 | pswpNew->cy = pswpMinbutton->cy + 3;
|
---|
| 4464 | pswpNew->cx = min(pswpNew->cy,(pswpMinbutton->cx / 2) + 3);
|
---|
| 4465 | pswpTitlebar->cx -= (pswpNew->cx - 1);
|
---|
| 4466 | pswpNew->x = pswpTitlebar->x + (pswpTitlebar->cx);
|
---|
| 4467 | pswpNew->y = pswpMinbutton->y - 1;
|
---|
| 4468 | sCount++;
|
---|
| 4469 | }
|
---|
| 4470 | else
|
---|
| 4471 | WinShowWindow(WinWindowFromID(hwnd,IDM_IDEALSIZE),FALSE);
|
---|
| 4472 | }
|
---|
| 4473 |
|
---|
| 4474 | if(fMoreButtons) {
|
---|
| 4475 |
|
---|
| 4476 | LONG lastx;
|
---|
| 4477 |
|
---|
| 4478 | pswpNew = (PSWP)mp1 + (soldCount + 6 +
|
---|
| 4479 | (fToolbar != FALSE) +
|
---|
| 4480 | (fDrivebar != FALSE) +
|
---|
| 4481 | (fSplitStatus != FALSE) +
|
---|
| 4482 | (fAutoView != FALSE) +
|
---|
| 4483 | ((fUserComboBox != FALSE) * 4) +
|
---|
| 4484 | (fUserComboBox != FALSE &&
|
---|
| 4485 | fToolbar != FALSE));
|
---|
| 4486 | *pswpNew = *pswpClient;
|
---|
| 4487 | pswpNew->hwnd = hwndName;
|
---|
| 4488 | pswpNew->x = swpClient.x + 3;
|
---|
| 4489 | pswpNew->y = swpClient.y + (sheight + 6);
|
---|
| 4490 | pswpNew->cx = ((swpClient.cx / 2) + (swpClient.cx / 5)) - 3;
|
---|
| 4491 | lastx = pswpNew->x + pswpNew->cx;
|
---|
| 4492 | pswpNew->cy = bheight;
|
---|
| 4493 | pswpClient->y += (bheight + 4);
|
---|
| 4494 | pswpClient->cy -= (bheight + 4);
|
---|
| 4495 | sCount++;
|
---|
| 4496 | pswpNew = (PSWP)mp1 + (soldCount + 7 +
|
---|
| 4497 | (fToolbar != FALSE) +
|
---|
| 4498 | (fDrivebar != FALSE) +
|
---|
| 4499 | (fSplitStatus != FALSE) +
|
---|
| 4500 | (fAutoView != FALSE) +
|
---|
| 4501 | ((fUserComboBox != FALSE) * 4) +
|
---|
| 4502 | (fUserComboBox != FALSE &&
|
---|
| 4503 | fToolbar != FALSE));
|
---|
| 4504 | *pswpNew = *pswpClient;
|
---|
| 4505 | pswpNew->hwnd = hwndDate;
|
---|
| 4506 | pswpNew->x = lastx + 3;
|
---|
| 4507 | pswpNew->y = swpClient.y + (sheight + 6);
|
---|
| 4508 | pswpNew->cx = (swpClient.cx / 6) + (swpClient.cx / 16) - 3;
|
---|
| 4509 | lastx = pswpNew->x + pswpNew->cx;
|
---|
| 4510 | pswpNew->cy = bheight;
|
---|
| 4511 | sCount++;
|
---|
| 4512 | pswpNew = (PSWP)mp1 + (soldCount + 8 +
|
---|
| 4513 | (fToolbar != FALSE) +
|
---|
| 4514 | (fDrivebar != FALSE) +
|
---|
| 4515 | (fSplitStatus != FALSE) +
|
---|
| 4516 | (fAutoView != FALSE) +
|
---|
| 4517 | ((fUserComboBox != FALSE) * 4) +
|
---|
| 4518 | (fUserComboBox != FALSE &&
|
---|
| 4519 | fToolbar != FALSE));
|
---|
| 4520 | *pswpNew = *pswpClient;
|
---|
| 4521 | pswpNew->hwnd = hwndAttr;
|
---|
| 4522 | pswpNew->x = lastx + 3;
|
---|
| 4523 | pswpNew->y = swpClient.y + (sheight + 6);
|
---|
| 4524 | pswpNew->cx = (swpClient.cx - pswpNew->x) - 1;
|
---|
| 4525 | pswpNew->cy = bheight;
|
---|
| 4526 | sCount++;
|
---|
| 4527 | }
|
---|
| 4528 | else {
|
---|
| 4529 | WinShowWindow(hwndAttr,FALSE);
|
---|
| 4530 | WinShowWindow(hwndName,FALSE);
|
---|
| 4531 | WinShowWindow(hwndDate,FALSE);
|
---|
| 4532 | }
|
---|
| 4533 | return MRFROMSHORT(sCount);
|
---|
| 4534 | }
|
---|
| 4535 |
|
---|
| 4536 | case WM_QUERYFRAMECTLCOUNT:
|
---|
| 4537 | {
|
---|
| 4538 | SHORT sCount;
|
---|
| 4539 |
|
---|
| 4540 | sCount = (SHORT)oldproc(hwnd,msg,mp1,mp2);
|
---|
| 4541 |
|
---|
| 4542 | sCount += 6;
|
---|
| 4543 | if(fSplitStatus)
|
---|
| 4544 | sCount++;
|
---|
| 4545 | if(fToolbar)
|
---|
| 4546 | sCount++;
|
---|
| 4547 | if(fUserComboBox) {
|
---|
| 4548 | sCount += 4;
|
---|
| 4549 | if(fToolbar)
|
---|
| 4550 | sCount++;
|
---|
| 4551 | }
|
---|
| 4552 | if(fDrivebar)
|
---|
| 4553 | sCount++;
|
---|
| 4554 | if(fAutoView)
|
---|
| 4555 | sCount++;
|
---|
| 4556 | if(fMoreButtons)
|
---|
| 4557 | sCount += 3;
|
---|
| 4558 | return MRFROMSHORT(sCount);
|
---|
| 4559 | }
|
---|
| 4560 |
|
---|
| 4561 | case WM_CLOSE:
|
---|
| 4562 | WinSendMsg(WinWindowFromID(hwnd,FID_CLIENT),msg,mp1,mp2);
|
---|
| 4563 | return 0;
|
---|
| 4564 | }
|
---|
| 4565 | return oldproc(hwnd,msg,mp1,mp2);
|
---|
| 4566 | }
|
---|
| 4567 |
|
---|
| 4568 |
|
---|
| 4569 | MRESULT EXPENTRY MainWMCommand (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
| 4570 |
|
---|
| 4571 | SetShiftState();
|
---|
| 4572 | switch(SHORT1FROMMP(mp1)) {
|
---|
| 4573 | case IDM_SETTARGET:
|
---|
| 4574 | SetTargetDir(hwnd,FALSE);
|
---|
| 4575 | break;
|
---|
| 4576 |
|
---|
| 4577 | case IDM_TOAUTOMLE:
|
---|
| 4578 | if(fComments && fAutoView)
|
---|
| 4579 | WinSetFocus(HWND_DESKTOP,
|
---|
| 4580 | hwndAutoMLE);
|
---|
| 4581 | break;
|
---|
| 4582 |
|
---|
| 4583 | case IDM_HIDENOTEWND:
|
---|
| 4584 | HideNote();
|
---|
| 4585 | break;
|
---|
| 4586 | case IDM_SHOWNOTEWND:
|
---|
| 4587 | ShowNote();
|
---|
| 4588 | break;
|
---|
| 4589 |
|
---|
| 4590 | case IDM_COMPARE:
|
---|
| 4591 | {
|
---|
| 4592 | WALK2 wa;
|
---|
| 4593 | PCNRITEM pci;
|
---|
| 4594 |
|
---|
| 4595 | memset(&wa,0,sizeof(wa));
|
---|
| 4596 | wa.size = sizeof(wa);
|
---|
| 4597 | pci = (PCNRITEM)WinSendMsg(WinWindowFromID(WinWindowFromID(
|
---|
| 4598 | hwndTree,FID_CLIENT),TREE_CNR),
|
---|
| 4599 | CM_QUERYRECORDEMPHASIS,
|
---|
| 4600 | MPFROMLONG(CMA_FIRST),
|
---|
| 4601 | MPFROMSHORT(CRA_CURSORED));
|
---|
| 4602 | if(pci && (INT)pci != -1) {
|
---|
| 4603 | strcpy(wa.szCurrentPath1,pci->szFileName);
|
---|
| 4604 | MakeValidDir(wa.szCurrentPath1);
|
---|
| 4605 | }
|
---|
| 4606 | else
|
---|
| 4607 | save_dir2(wa.szCurrentPath1);
|
---|
| 4608 | TopWindowName(hwndMain,(HWND)0,wa.szCurrentPath2);
|
---|
| 4609 | if(!*wa.szCurrentPath2)
|
---|
| 4610 | strcpy(wa.szCurrentPath2,wa.szCurrentPath1);
|
---|
| 4611 | MakeValidDir(wa.szCurrentPath2);
|
---|
| 4612 | if(WinDlgBox(HWND_DESKTOP,
|
---|
| 4613 | hwnd,
|
---|
| 4614 | WalkTwoCmpDlgProc,
|
---|
| 4615 | FM3ModHandle,
|
---|
| 4616 | WALK2_FRAME,
|
---|
| 4617 | MPFROMP(&wa)) &&
|
---|
| 4618 | !IsFile(wa.szCurrentPath1) &&
|
---|
| 4619 | !IsFile(wa.szCurrentPath2)) {
|
---|
| 4620 | if(!*dircompare) {
|
---|
| 4621 |
|
---|
| 4622 | COMPARE *cmp;
|
---|
| 4623 |
|
---|
| 4624 | cmp = malloc(sizeof(COMPARE));
|
---|
| 4625 | if(cmp) {
|
---|
| 4626 | memset(cmp,0,sizeof(COMPARE));
|
---|
| 4627 | cmp->size = sizeof(COMPARE);
|
---|
| 4628 | strcpy(cmp->leftdir,wa.szCurrentPath1);
|
---|
| 4629 | strcpy(cmp->rightdir,wa.szCurrentPath2);
|
---|
| 4630 | cmp->hwndParent = hwnd;
|
---|
| 4631 | cmp->dcd.hwndParent = hwnd;
|
---|
| 4632 | WinDlgBox(HWND_DESKTOP,
|
---|
| 4633 | HWND_DESKTOP,
|
---|
| 4634 | CompareDlgProc,
|
---|
| 4635 | FM3ModHandle,
|
---|
| 4636 | COMP_FRAME,
|
---|
| 4637 | MPFROMP(cmp));
|
---|
| 4638 | }
|
---|
| 4639 | }
|
---|
| 4640 | else {
|
---|
| 4641 |
|
---|
| 4642 | CHAR *d1 = "\"",*d2 = "\"";
|
---|
| 4643 |
|
---|
| 4644 | if(!needs_quoting(wa.szCurrentPath1))
|
---|
| 4645 | *d1 = 0;
|
---|
| 4646 | if(!needs_quoting(wa.szCurrentPath2))
|
---|
| 4647 | *d2 = 0;
|
---|
| 4648 | runemf2(SEPARATE,
|
---|
| 4649 | HWND_DESKTOP,
|
---|
| 4650 | NULL,
|
---|
| 4651 | NULL,
|
---|
| 4652 | "%s %s%s%s %s%s%s",
|
---|
| 4653 | dircompare,
|
---|
| 4654 | d1,
|
---|
| 4655 | wa.szCurrentPath1,
|
---|
| 4656 | d1,
|
---|
| 4657 | d2,
|
---|
| 4658 | wa.szCurrentPath2,
|
---|
| 4659 | d2);
|
---|
| 4660 | }
|
---|
| 4661 | }
|
---|
| 4662 | }
|
---|
| 4663 | break;
|
---|
| 4664 |
|
---|
| 4665 | case IDM_EXIT:
|
---|
| 4666 | case IDM_KILLME:
|
---|
| 4667 | PostMsg(hwnd,
|
---|
| 4668 | WM_CLOSE,
|
---|
| 4669 | MPVOID,
|
---|
| 4670 | MPVOID);
|
---|
| 4671 | break;
|
---|
| 4672 |
|
---|
| 4673 | case IDM_CLI:
|
---|
| 4674 | if(fSplitStatus &&
|
---|
| 4675 | hwndStatus2 &&
|
---|
| 4676 | !WinIsWindow(WinQueryAnchorBlock(hwnd),
|
---|
| 4677 | WinWindowFromID(hwndStatus2,COMMAND_LINE)))
|
---|
| 4678 | PostMsg(hwndStatus2,
|
---|
| 4679 | UM_CLICKED,
|
---|
| 4680 | MPVOID,
|
---|
| 4681 | MPVOID);
|
---|
| 4682 | break;
|
---|
| 4683 |
|
---|
| 4684 | case IDM_ADDTOUSERLIST:
|
---|
| 4685 | case IDM_DELETEFROMUSERLIST:
|
---|
| 4686 | {
|
---|
| 4687 | CHAR temp[CCHMAXPATH],path[CCHMAXPATH];
|
---|
| 4688 |
|
---|
| 4689 | *temp = 0;
|
---|
| 4690 | WinQueryWindowText(hwndUserlist,
|
---|
| 4691 | CCHMAXPATH,
|
---|
| 4692 | temp);
|
---|
| 4693 | lstrip(rstrip(temp));
|
---|
| 4694 | if(*temp &&
|
---|
| 4695 | !DosQueryPathInfo(temp,
|
---|
| 4696 | FIL_QUERYFULLNAME,
|
---|
| 4697 | path,
|
---|
| 4698 | sizeof(path))) {
|
---|
| 4699 | if(SHORT1FROMMP(mp1) == IDM_ADDTOUSERLIST) {
|
---|
| 4700 | if(add_udir(TRUE,path)) {
|
---|
| 4701 | if(fUdirsChanged)
|
---|
| 4702 | save_udirs();
|
---|
| 4703 | WinSendMsg(hwnd,
|
---|
| 4704 | UM_FILLUSERLIST,
|
---|
| 4705 | MPVOID,
|
---|
| 4706 | MPVOID);
|
---|
| 4707 | }
|
---|
| 4708 | else
|
---|
| 4709 | DosBeep(50,50);
|
---|
| 4710 | }
|
---|
| 4711 | else {
|
---|
| 4712 | if(remove_udir(path)) {
|
---|
| 4713 | if(fUdirsChanged)
|
---|
| 4714 | save_udirs();
|
---|
| 4715 | WinSendMsg(hwnd,UM_FILLUSERLIST,MPVOID,MPVOID);
|
---|
| 4716 | }
|
---|
| 4717 | else
|
---|
| 4718 | DosBeep(50,50);
|
---|
| 4719 | }
|
---|
| 4720 | }
|
---|
| 4721 | }
|
---|
| 4722 | break;
|
---|
| 4723 |
|
---|
| 4724 | case IDM_SAVEDIRCNRSTATE:
|
---|
| 4725 | case IDM_DELETEDIRCNRSTATE:
|
---|
| 4726 | {
|
---|
| 4727 | CHAR name[14];
|
---|
| 4728 |
|
---|
| 4729 | *name = 0;
|
---|
| 4730 | WinQueryWindowText(hwndStatelist,13,name);
|
---|
| 4731 | lstrip(rstrip(name));
|
---|
| 4732 | if(*name) {
|
---|
| 4733 | if(SHORT1FROMMP(mp1) == IDM_SAVEDIRCNRSTATE) {
|
---|
| 4734 | if(SaveDirCnrState(hwnd,name)) {
|
---|
| 4735 | if(add_setup(name)) {
|
---|
| 4736 | WinSendMsg(hwndStatelist,LM_INSERTITEM,
|
---|
| 4737 | MPFROM2SHORT(LIT_SORTASCENDING,0),
|
---|
| 4738 | MPFROMP(name));
|
---|
| 4739 | save_setups();
|
---|
| 4740 | }
|
---|
| 4741 | }
|
---|
| 4742 | WinSetWindowText(hwndStatelist,
|
---|
| 4743 | GetPString(IDS_STATETEXT));
|
---|
| 4744 | }
|
---|
| 4745 | else {
|
---|
| 4746 |
|
---|
| 4747 | ULONG numsaves = 0,size,x;
|
---|
| 4748 | CHAR s[120];
|
---|
| 4749 |
|
---|
| 4750 | if(remove_setup(name))
|
---|
| 4751 | save_setups();
|
---|
| 4752 | sprintf(s,"%s.NumDirsLastTime",name);
|
---|
| 4753 | size = sizeof(ULONG);
|
---|
| 4754 | if(PrfQueryProfileData(fmprof,FM3Str,s,(PVOID)&numsaves,
|
---|
| 4755 | &size) && size) {
|
---|
| 4756 | PrfWriteProfileData(fmprof,FM3Str,s,NULL,0L);
|
---|
| 4757 | for(x = 0;x < numsaves;x++) {
|
---|
| 4758 | sprintf(s,"%s.DirCnrPos.%lu",name,x);
|
---|
| 4759 | PrfWriteProfileData(fmprof,FM3Str,s,NULL,0);
|
---|
| 4760 | sprintf(s,"%s.DirCnrDir.%lu",name,x);
|
---|
| 4761 | PrfWriteProfileData(fmprof,FM3Str,s,NULL,0);
|
---|
| 4762 | sprintf(s,"%s.DirCnrSort.%lu",name,x);
|
---|
| 4763 | PrfWriteProfileData(fmprof,FM3Str,s,NULL,0);
|
---|
| 4764 | sprintf(s,"%s.DirCnrFilter.%lu",name,x);
|
---|
| 4765 | PrfWriteProfileData(fmprof,FM3Str,s,NULL,0);
|
---|
| 4766 | sprintf(s,"%s.DirCnrView.%lu",name,x);
|
---|
| 4767 | PrfWriteProfileData(fmprof,FM3Str,s,NULL,0);
|
---|
| 4768 | }
|
---|
| 4769 | sprintf(s,"%s.LastTreePos",name);
|
---|
| 4770 | PrfWriteProfileData(fmprof,FM3Str,s,NULL,0);
|
---|
| 4771 | sprintf(s,"%s.MySizeLastTime",name);
|
---|
| 4772 | PrfWriteProfileData(fmprof,FM3Str,s,NULL,0);
|
---|
| 4773 | }
|
---|
| 4774 | else
|
---|
| 4775 | DosBeep(50,100);
|
---|
| 4776 | PostMsg(hwnd,UM_FILLSETUPLIST,MPVOID,MPVOID);
|
---|
| 4777 | }
|
---|
| 4778 | }
|
---|
| 4779 | }
|
---|
| 4780 | break;
|
---|
| 4781 |
|
---|
| 4782 | case IDM_IDEALSIZE:
|
---|
| 4783 | {
|
---|
| 4784 | SWP swp,swpD;
|
---|
| 4785 | ULONG icz = WinQuerySysValue(HWND_DESKTOP,SV_CYICON) * 2L;
|
---|
| 4786 | ULONG bsz = WinQuerySysValue(HWND_DESKTOP,SV_CYSIZEBORDER);
|
---|
| 4787 |
|
---|
| 4788 | WinQueryWindowPos(WinQueryWindow(hwnd,QW_PARENT),&swp);
|
---|
| 4789 | if(swp.fl & SWP_MAXIMIZE) {
|
---|
| 4790 | WinSendMsg(WinQueryWindow(hwnd,QW_PARENT),WM_SYSCOMMAND,
|
---|
| 4791 | MPFROM2SHORT(SC_RESTORE,0),MPVOID);
|
---|
| 4792 | WinQueryWindowPos(WinQueryWindow(hwnd,QW_PARENT),&swp);
|
---|
| 4793 | }
|
---|
| 4794 | WinGetMaxPosition(WinQueryWindow(hwnd,QW_PARENT),&swpD);
|
---|
| 4795 | swpD.x += bsz;
|
---|
| 4796 | swpD.cx -= (bsz * 2);
|
---|
| 4797 | swpD.y += icz;
|
---|
| 4798 | swpD.cy -= (icz + bsz);
|
---|
| 4799 | if(swp.x == swpD.x && swp.y == swpD.y &&
|
---|
| 4800 | swp.cx == swpD.cx &&
|
---|
| 4801 | swp.cy == swpD.cy &&
|
---|
| 4802 | WinQueryWindowUShort(hwnd,10) &&
|
---|
| 4803 | WinQueryWindowUShort(hwnd,14)) {
|
---|
| 4804 | swpD.x = WinQueryWindowUShort(hwnd,8);
|
---|
| 4805 | swpD.cx = WinQueryWindowUShort(hwnd,10);
|
---|
| 4806 | swpD.y = WinQueryWindowUShort(hwnd,12);
|
---|
| 4807 | swpD.cy = WinQueryWindowUShort(hwnd,14);
|
---|
| 4808 | }
|
---|
| 4809 | else {
|
---|
| 4810 | WinSetWindowUShort(hwnd,8,(USHORT)swp.x);
|
---|
| 4811 | WinSetWindowUShort(hwnd,10,(USHORT)swp.cx);
|
---|
| 4812 | WinSetWindowUShort(hwnd,12,(USHORT)swp.y);
|
---|
| 4813 | WinSetWindowUShort(hwnd,14,(USHORT)swp.cy);
|
---|
| 4814 | }
|
---|
| 4815 | WinSetWindowPos(WinQueryWindow(hwnd,QW_PARENT),HWND_TOP,
|
---|
| 4816 | swpD.x,swpD.y,swpD.cx,
|
---|
| 4817 | swpD.cy,SWP_MOVE | SWP_SIZE);
|
---|
| 4818 | }
|
---|
| 4819 | break;
|
---|
| 4820 |
|
---|
| 4821 | case IDM_BLINK:
|
---|
| 4822 | WinSetWindowPos(WinQueryWindow(hwnd,QW_PARENT),HWND_TOP,0,0,0,0,
|
---|
| 4823 | SWP_MINIMIZE);
|
---|
| 4824 | WinSetWindowPos(WinQueryWindow(hwnd,QW_PARENT),HWND_TOP,0,0,0,0,
|
---|
| 4825 | SWP_RESTORE | SWP_ZORDER);
|
---|
| 4826 | break;
|
---|
| 4827 |
|
---|
| 4828 |
|
---|
| 4829 | case DID_CANCEL:
|
---|
| 4830 | {
|
---|
| 4831 | HWND hwndTop = TopWindow(hwndMain,(HWND)0);
|
---|
| 4832 |
|
---|
| 4833 | if(hwndTop)
|
---|
| 4834 | WinSetFocus(HWND_DESKTOP,
|
---|
| 4835 | hwndTop);
|
---|
| 4836 | }
|
---|
| 4837 | break;
|
---|
| 4838 |
|
---|
| 4839 | case IDM_NOTEBOOK:
|
---|
| 4840 | WinDlgBox(HWND_DESKTOP,
|
---|
| 4841 | hwnd,
|
---|
| 4842 | CfgDlgProc,
|
---|
| 4843 | FM3ModHandle,
|
---|
| 4844 | CFG_FRAME,
|
---|
| 4845 | MPVOID);
|
---|
| 4846 | break;
|
---|
| 4847 |
|
---|
| 4848 | case IDM_VIEWHELPS:
|
---|
| 4849 | case IDM_VIEWINFS:
|
---|
| 4850 | WinDlgBox(HWND_DESKTOP,
|
---|
| 4851 | HWND_DESKTOP,
|
---|
| 4852 | ViewInfProc,
|
---|
| 4853 | FM3ModHandle,
|
---|
| 4854 | VINF_FRAME,
|
---|
| 4855 | ((SHORT1FROMMP(mp1) == IDM_VIEWHELPS) ?
|
---|
| 4856 | MPFROMP(NullStr) :
|
---|
| 4857 | MPVOID));
|
---|
| 4858 | break;
|
---|
| 4859 |
|
---|
| 4860 | case IDM_OPENWALK:
|
---|
| 4861 | {
|
---|
| 4862 | char newpath[CCHMAXPATH];
|
---|
| 4863 |
|
---|
| 4864 | *newpath = 0;
|
---|
| 4865 | TopWindowName(hwnd,(HWND)0,newpath);
|
---|
| 4866 | if(WinDlgBox(HWND_DESKTOP,
|
---|
| 4867 | hwnd,
|
---|
| 4868 | WalkAllDlgProc,
|
---|
| 4869 | FM3ModHandle,
|
---|
| 4870 | WALK_FRAME,
|
---|
| 4871 | MPFROMP(newpath)) &&
|
---|
| 4872 | *newpath)
|
---|
| 4873 | OpenDirCnr((HWND)0,
|
---|
| 4874 | hwndMain,
|
---|
| 4875 | hwndTree,
|
---|
| 4876 | FALSE,
|
---|
| 4877 | newpath);
|
---|
| 4878 | }
|
---|
| 4879 | break;
|
---|
| 4880 |
|
---|
| 4881 | case IDM_WINDOWDLG:
|
---|
| 4882 | WindowList(hwnd);
|
---|
| 4883 | break;
|
---|
| 4884 |
|
---|
| 4885 | case IDM_HELPMOUSE:
|
---|
| 4886 | case IDM_HELPCONTEXT:
|
---|
| 4887 | case IDM_HELPHINTS:
|
---|
| 4888 | case IDM_HELPPIX:
|
---|
| 4889 | case IDM_HELPTUTOR:
|
---|
| 4890 | case IDM_HELPUSERLIST:
|
---|
| 4891 | case IDM_HELP:
|
---|
| 4892 | case IDM_HELPCONTENTS:
|
---|
| 4893 | case IDM_HELPKEYS:
|
---|
| 4894 | case IDM_HELPGENERAL:
|
---|
| 4895 | if(hwndHelp) {
|
---|
| 4896 | if(SHORT1FROMMP(mp2) == CMDSRC_MENU) {
|
---|
| 4897 |
|
---|
| 4898 | RECTL rcl;
|
---|
| 4899 | ULONG icz = WinQuerySysValue(HWND_DESKTOP,SV_CYICON) * 2L;
|
---|
| 4900 |
|
---|
| 4901 | WinQueryWindowRect(HWND_DESKTOP,&rcl);
|
---|
| 4902 | rcl.yBottom += icz;
|
---|
| 4903 | rcl.yTop -= icz;
|
---|
| 4904 | rcl.xLeft += icz;
|
---|
| 4905 | rcl.xRight -= icz;
|
---|
| 4906 | WinSendMsg(hwndHelp,HM_SET_COVERPAGE_SIZE,
|
---|
| 4907 | MPFROMP(&rcl),MPVOID);
|
---|
| 4908 | }
|
---|
| 4909 | else {
|
---|
| 4910 |
|
---|
| 4911 | RECTL rcl;
|
---|
| 4912 |
|
---|
| 4913 | WinQueryWindowRect(HWND_DESKTOP,&rcl);
|
---|
| 4914 | rcl.yBottom += 8;
|
---|
| 4915 | rcl.yTop = (rcl.yTop / 2) + (rcl.yTop / 7);
|
---|
| 4916 | rcl.xLeft = (rcl.xRight / 2) - (rcl.xRight / 7);
|
---|
| 4917 | rcl.xRight -= 8;
|
---|
| 4918 | WinSendMsg(hwndHelp,HM_SET_COVERPAGE_SIZE,
|
---|
| 4919 | MPFROMP(&rcl),MPVOID);
|
---|
| 4920 | }
|
---|
| 4921 | switch(SHORT1FROMMP(mp1)) {
|
---|
| 4922 | case IDM_HELPCONTEXT:
|
---|
| 4923 | WinSendMsg(hwndHelp,HM_DISPLAY_HELP,
|
---|
| 4924 | MPFROM2SHORT(HELP_CONTEXT,0),
|
---|
| 4925 | MPFROMSHORT(HM_RESOURCEID));
|
---|
| 4926 | break;
|
---|
| 4927 |
|
---|
| 4928 | case IDM_HELPMOUSE:
|
---|
| 4929 | if(hwndHelp)
|
---|
| 4930 | WinSendMsg(hwndHelp,HM_DISPLAY_HELP,
|
---|
| 4931 | MPFROM2SHORT(HELP_MOUSE,0),
|
---|
| 4932 | MPFROMSHORT(HM_RESOURCEID));
|
---|
| 4933 | break;
|
---|
| 4934 |
|
---|
| 4935 | case IDM_HELPPIX:
|
---|
| 4936 | WinSendMsg(hwndHelp,HM_DISPLAY_HELP,
|
---|
| 4937 | MPFROM2SHORT(HELP_BITMAP1,0),
|
---|
| 4938 | MPFROMSHORT(HM_RESOURCEID));
|
---|
| 4939 | break;
|
---|
| 4940 |
|
---|
| 4941 | case IDM_HELPTUTOR:
|
---|
| 4942 | WinSendMsg(hwndHelp,HM_DISPLAY_HELP,
|
---|
| 4943 | MPFROM2SHORT(HELP_TUTORIAL,0),
|
---|
| 4944 | MPFROMSHORT(HM_RESOURCEID));
|
---|
| 4945 | break;
|
---|
| 4946 |
|
---|
| 4947 | case IDM_HELPHINTS:
|
---|
| 4948 | WinSendMsg(hwndHelp,HM_DISPLAY_HELP,
|
---|
| 4949 | MPFROM2SHORT(HELP_HINTS,0),
|
---|
| 4950 | MPFROMSHORT(HM_RESOURCEID));
|
---|
| 4951 | break;
|
---|
| 4952 |
|
---|
| 4953 | case IDM_HELPGENERAL:
|
---|
| 4954 | WinSendMsg(hwndHelp,HM_DISPLAY_HELP,
|
---|
| 4955 | MPFROM2SHORT(HELP_MAIN,0),
|
---|
| 4956 | MPFROMSHORT(HM_RESOURCEID));
|
---|
| 4957 | break;
|
---|
| 4958 | case IDM_HELPKEYS:
|
---|
| 4959 | WinSendMsg(hwndHelp,HM_DISPLAY_HELP,
|
---|
| 4960 | MPFROM2SHORT(HELP_KEYS,0),
|
---|
| 4961 | MPFROMSHORT(HM_RESOURCEID));
|
---|
| 4962 | break;
|
---|
| 4963 |
|
---|
| 4964 | case IDM_HELP:
|
---|
| 4965 | case IDM_HELPCONTENTS:
|
---|
| 4966 | WinSendMsg(hwndHelp,HM_HELP_CONTENTS,MPVOID,MPVOID);
|
---|
| 4967 | break;
|
---|
| 4968 |
|
---|
| 4969 | case IDM_HELPUSERLIST:
|
---|
| 4970 | WinSendMsg(hwndHelp,HM_DISPLAY_HELP,
|
---|
| 4971 | MPFROM2SHORT(HELP_USERLISTS,0),
|
---|
| 4972 | MPFROMSHORT(HM_RESOURCEID));
|
---|
| 4973 | break;
|
---|
| 4974 | }
|
---|
| 4975 | }
|
---|
| 4976 | break;
|
---|
| 4977 |
|
---|
| 4978 | case IDM_EDITANYARCHIVER:
|
---|
| 4979 | {
|
---|
| 4980 | DIRCNRDATA arc;
|
---|
| 4981 |
|
---|
| 4982 | memset(&arc,0,sizeof(DIRCNRDATA));
|
---|
| 4983 | EditArchiverData(hwnd,&arc);
|
---|
| 4984 | }
|
---|
| 4985 | break;
|
---|
| 4986 |
|
---|
| 4987 | case IDM_ABOUT:
|
---|
| 4988 | WinDlgBox(HWND_DESKTOP,hwnd,AboutDlgProc,FM3ModHandle,
|
---|
| 4989 | ABT_FRAME,MPVOID);
|
---|
| 4990 | break;
|
---|
| 4991 |
|
---|
| 4992 | case IDM_FONTPALETTE:
|
---|
| 4993 | OpenObject("<WP_FNTPAL>",Default,hwnd);
|
---|
| 4994 | break;
|
---|
| 4995 |
|
---|
| 4996 | case IDM_HICOLORPALETTE:
|
---|
| 4997 | case IDM_COLORPALETTE:
|
---|
| 4998 | {
|
---|
| 4999 | CHAR *palette = "<WP_CLRPAL>";
|
---|
| 5000 | ULONG version[2];
|
---|
| 5001 |
|
---|
| 5002 | if(!DosQuerySysInfo(QSV_VERSION_MAJOR,QSV_VERSION_MINOR,
|
---|
| 5003 | (PVOID)&version,(ULONG)sizeof(version))) {
|
---|
| 5004 | if(version[0] > 20L || (version[0] == 20L && version[1] > 29L)) {
|
---|
| 5005 | if(SHORT1FROMMP(mp1) == IDM_HICOLORPALETTE)
|
---|
| 5006 | palette = "<WP_HIRESCLRPAL>";
|
---|
| 5007 | else
|
---|
| 5008 | palette = "<WP_LORESCLRPAL>";
|
---|
| 5009 | }
|
---|
| 5010 | }
|
---|
| 5011 | OpenObject(palette,Default,hwnd);
|
---|
| 5012 | }
|
---|
| 5013 | break;
|
---|
| 5014 |
|
---|
| 5015 | case IDM_SYSTEMSETUP:
|
---|
| 5016 | OpenObject("<WP_CONFIG>",Default,hwnd);
|
---|
| 5017 | break;
|
---|
| 5018 |
|
---|
| 5019 |
|
---|
| 5020 | case IDM_SCHEMEPALETTE:
|
---|
| 5021 | {
|
---|
| 5022 | HOBJECT hWPSObject;
|
---|
| 5023 |
|
---|
| 5024 | hWPSObject = WinQueryObject("<WP_SCHPAL>");
|
---|
| 5025 | if(hWPSObject != NULLHANDLE)
|
---|
| 5026 | WinSetObjectData(hWPSObject,"SCHEMES=Winter:PM_Winter,"
|
---|
| 5027 | "Spring:PM_Spring,Summer:PM_Summer,"
|
---|
| 5028 | "System:PM_System,Windows:PM_Windows;"
|
---|
| 5029 | "OPEN=DEFAULT");
|
---|
| 5030 | }
|
---|
| 5031 | break;
|
---|
| 5032 |
|
---|
| 5033 |
|
---|
| 5034 | case IDM_SYSTEMCLOCK:
|
---|
| 5035 | OpenObject("<WP_CLOCK>",Default,hwnd);
|
---|
| 5036 | break;
|
---|
| 5037 |
|
---|
| 5038 | #ifdef NEVER
|
---|
| 5039 | case IDM_SYSINFO:
|
---|
| 5040 | WinDlgBox(HWND_DESKTOP,HWND_DESKTOP,SysInfoDlgProc,FM3ModHandle,
|
---|
| 5041 | SYS_FRAME,NULL);
|
---|
| 5042 | break;
|
---|
| 5043 | #endif
|
---|
| 5044 |
|
---|
| 5045 | case IDM_INSTANT:
|
---|
| 5046 | {
|
---|
| 5047 | CHAR path[CCHMAXPATH];
|
---|
| 5048 | PCNRITEM pci = (PCNRITEM)0;
|
---|
| 5049 |
|
---|
| 5050 | if(hwndTree)
|
---|
| 5051 | pci = (PCNRITEM)WinSendMsg(hwndTree,CM_QUERYRECORDEMPHASIS,
|
---|
| 5052 | MPFROMLONG(CMA_FIRST),
|
---|
| 5053 | MPFROMSHORT(CRA_CURSORED));
|
---|
| 5054 | if(pci && (INT)pci != -1) {
|
---|
| 5055 | strcpy(path,pci->szFileName);
|
---|
| 5056 | MakeValidDir(path);
|
---|
| 5057 | }
|
---|
| 5058 | else
|
---|
| 5059 | save_dir2(path);
|
---|
| 5060 | WinDlgBox(HWND_DESKTOP,hwnd,InstantDlgProc,FM3ModHandle,
|
---|
| 5061 | BAT_FRAME,MPFROMP(path));
|
---|
| 5062 | }
|
---|
| 5063 | break;
|
---|
| 5064 |
|
---|
| 5065 | case IDM_WINFULLSCREEN:
|
---|
| 5066 | case IDM_DOSCOMMANDLINE:
|
---|
| 5067 | case IDM_COMMANDLINE:
|
---|
| 5068 | {
|
---|
| 5069 | CHAR *env = GetCmdSpec(FALSE),path[CCHMAXPATH];
|
---|
| 5070 | INT type = SEPARATE | WINDOWED;
|
---|
| 5071 |
|
---|
| 5072 | *path = 0;
|
---|
| 5073 | TopWindowName(hwnd,(HWND)0,path);
|
---|
| 5074 | if(SHORT1FROMMP(mp1) == IDM_DOSCOMMANDLINE)
|
---|
| 5075 | env = GetCmdSpec(TRUE);
|
---|
| 5076 | else if(SHORT1FROMMP(mp1) != IDM_COMMANDLINE) {
|
---|
| 5077 | env = "WINOS2.COM";
|
---|
| 5078 | type = SEPARATE | FULLSCREEN;
|
---|
| 5079 | }
|
---|
| 5080 | runemf2(type,hwnd,path,NULL,"%s",env);
|
---|
| 5081 | }
|
---|
| 5082 | break;
|
---|
| 5083 |
|
---|
| 5084 | case IDM_KILLPROC:
|
---|
| 5085 | WinDlgBox(HWND_DESKTOP,hwnd,KillDlgProc,FM3ModHandle,
|
---|
| 5086 | KILL_FRAME,NULL);
|
---|
| 5087 | break;
|
---|
| 5088 |
|
---|
| 5089 | case IDM_AUTOVIEWCOMMENTS:
|
---|
| 5090 | case IDM_AUTOVIEWFILE:
|
---|
| 5091 | if(SHORT1FROMMP(mp1) == IDM_AUTOVIEWFILE)
|
---|
| 5092 | fComments = FALSE;
|
---|
| 5093 | else
|
---|
| 5094 | fComments = TRUE;
|
---|
| 5095 | PrfWriteProfileData(fmprof,FM3Str,"Comments",&fComments,
|
---|
| 5096 | sizeof(BOOL));
|
---|
| 5097 | WinSetWindowText((fComments) ? hwndAutoview : hwndAutoMLE,NullStr);
|
---|
| 5098 | goto AutoChange;
|
---|
| 5099 |
|
---|
| 5100 | case IDM_AUTOVIEW:
|
---|
| 5101 | SetMenuCheck(WinQueryWindowULong(hwnd,0),SHORT1FROMMP(mp1),
|
---|
| 5102 | &fAutoView,TRUE,"AutoView");
|
---|
| 5103 | AutoChange:
|
---|
| 5104 | PostMsg(WinQueryWindow(hwnd,QW_PARENT),WM_UPDATEFRAME,
|
---|
| 5105 | MPFROMLONG(FCF_SIZEBORDER),MPVOID);
|
---|
| 5106 | if(fAutoView) {
|
---|
| 5107 |
|
---|
| 5108 | CHAR s[CCHMAXPATH];
|
---|
| 5109 | HWND hwndDir;
|
---|
| 5110 | PCNRITEM pci;
|
---|
| 5111 |
|
---|
| 5112 | hwndDir = TopWindowName(hwnd,(HWND)0,s);
|
---|
| 5113 | if(hwndDir) {
|
---|
| 5114 | hwndDir = WinWindowFromID(hwndDir,FID_CLIENT);
|
---|
| 5115 | if(hwndDir) {
|
---|
| 5116 | hwndDir = WinWindowFromID(hwndDir,DIR_CNR);
|
---|
| 5117 | if(hwndDir) {
|
---|
| 5118 | pci = (PCNRITEM)WinSendMsg(hwndDir,CM_QUERYRECORDEMPHASIS,
|
---|
| 5119 | MPFROMLONG(CMA_FIRST),
|
---|
| 5120 | MPFROMSHORT(CRA_CURSORED));
|
---|
| 5121 | if(pci && (INT)pci != -1 &&
|
---|
| 5122 | (!(driveflags[toupper(*pci->szFileName) - 'A'] & DRIVE_SLOW)))
|
---|
| 5123 | WinSendMsg(hwnd,
|
---|
| 5124 | UM_LOADFILE,
|
---|
| 5125 | MPFROMP(pci->szFileName),
|
---|
| 5126 | (SHORT1FROMMP(mp1) == IDM_AUTOVIEW) ?
|
---|
| 5127 | MPVOID :
|
---|
| 5128 | MPFROMLONG(1L));
|
---|
| 5129 | }
|
---|
| 5130 | }
|
---|
| 5131 | }
|
---|
| 5132 | }
|
---|
| 5133 | break;
|
---|
| 5134 |
|
---|
| 5135 | case IDM_TEXTTOOLS:
|
---|
| 5136 | SetMenuCheck(WinQueryWindowULong(hwnd,0),SHORT1FROMMP(mp1),
|
---|
| 5137 | &fTextTools,TRUE,"TextTools");
|
---|
| 5138 | BuildTools(hwndToolback,TRUE);
|
---|
| 5139 | PostMsg(WinQueryWindow(hwnd,QW_PARENT),WM_UPDATEFRAME,
|
---|
| 5140 | MPFROMLONG(FCF_SIZEBORDER),MPVOID);
|
---|
| 5141 | break;
|
---|
| 5142 |
|
---|
| 5143 | case IDM_TOOLTITLES:
|
---|
| 5144 | SetMenuCheck(WinQueryWindowULong(hwnd,0),SHORT1FROMMP(mp1),
|
---|
| 5145 | &fToolTitles,TRUE,"ToolTitles");
|
---|
| 5146 | BuildTools(hwndToolback,TRUE);
|
---|
| 5147 | PostMsg(WinQueryWindow(hwnd,QW_PARENT),WM_UPDATEFRAME,
|
---|
| 5148 | MPFROMLONG(FCF_SIZEBORDER),MPVOID);
|
---|
| 5149 | break;
|
---|
| 5150 |
|
---|
| 5151 | case IDM_HIDEMENU:
|
---|
| 5152 | {
|
---|
| 5153 | HWND hwndMenu;
|
---|
| 5154 |
|
---|
| 5155 | hwndMenu = WinQueryWindowULong(hwnd,0);
|
---|
| 5156 | MenuInvisible = (MenuInvisible) ? FALSE : TRUE;
|
---|
| 5157 | if(MenuInvisible) {
|
---|
| 5158 | WinSetParent(hwndMenu,HWND_OBJECT,FALSE);
|
---|
| 5159 | WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5160 | FID_SYSMENU),IDM_HIDEMENU,
|
---|
| 5161 | GetPString(IDS_UNHIDEMENUTEXT));
|
---|
| 5162 | }
|
---|
| 5163 | else {
|
---|
| 5164 | WinSetParent(hwndMenu,WinQueryWindow(hwnd,QW_PARENT),FALSE);
|
---|
| 5165 | WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5166 | FID_SYSMENU),IDM_HIDEMENU,
|
---|
| 5167 | GetPString(IDS_HIDEMENUTEXT));
|
---|
| 5168 | }
|
---|
| 5169 | PostMsg(WinQueryWindow(hwnd,QW_PARENT),WM_UPDATEFRAME,
|
---|
| 5170 | MPFROMLONG(FCF_MENU),MPVOID);
|
---|
| 5171 | PrfWriteProfileData(fmprof,FM3Str,"MenuInvisible",
|
---|
| 5172 | &MenuInvisible,sizeof(BOOL));
|
---|
| 5173 | }
|
---|
| 5174 | break;
|
---|
| 5175 |
|
---|
| 5176 | case IDM_SEEALL:
|
---|
| 5177 | case IDM_GREP:
|
---|
| 5178 | case IDM_COLLECTOR:
|
---|
| 5179 | {
|
---|
| 5180 | HWND hwndC;
|
---|
| 5181 | SWP swp;
|
---|
| 5182 | BOOL already = FALSE;
|
---|
| 5183 |
|
---|
| 5184 | if(Collector)
|
---|
| 5185 | already = TRUE;
|
---|
| 5186 | if(!already && !fAutoTile && !fExternalCollector)
|
---|
| 5187 | GetNextWindowPos(hwnd,&swp,NULL,NULL);
|
---|
| 5188 | hwndC = StartCollector((fExternalCollector) ? HWND_DESKTOP :
|
---|
| 5189 | hwnd,4);
|
---|
| 5190 | if(hwndC) {
|
---|
| 5191 | if(!already && !fAutoTile && !fExternalCollector)
|
---|
| 5192 | WinSetWindowPos(hwndC,HWND_TOP,swp.x,swp.y,
|
---|
| 5193 | swp.cx,swp.cy,SWP_MOVE | SWP_SIZE |
|
---|
| 5194 | SWP_SHOW | SWP_ZORDER);
|
---|
| 5195 | else if(fAutoTile && !already)
|
---|
| 5196 | TileChildren(hwnd,TRUE);
|
---|
| 5197 | WinSetWindowPos(hwndC,HWND_TOP,0,0,0,0,SWP_SHOW | SWP_RESTORE |
|
---|
| 5198 | SWP_ACTIVATE);
|
---|
| 5199 | if(SHORT1FROMMP(mp1) == IDM_GREP)
|
---|
| 5200 | PostMsg(WinWindowFromID(hwndC,FID_CLIENT),WM_COMMAND,
|
---|
| 5201 | MPFROM2SHORT(IDM_GREP,0),MPVOID);
|
---|
| 5202 | if(SHORT1FROMMP(mp1) == IDM_SEEALL)
|
---|
| 5203 | PostMsg(WinWindowFromID(hwndC,FID_CLIENT),WM_COMMAND,
|
---|
| 5204 | MPFROM2SHORT(IDM_SEEALL,0),MPVOID);
|
---|
| 5205 | }
|
---|
| 5206 | }
|
---|
| 5207 | break;
|
---|
| 5208 |
|
---|
| 5209 | case IDM_TOOLLEFT:
|
---|
| 5210 | case IDM_TOOLRIGHT:
|
---|
| 5211 | {
|
---|
| 5212 | TOOL *tool;
|
---|
| 5213 |
|
---|
| 5214 | if(!toolhead || !toolhead->next) {
|
---|
| 5215 | firsttool = (toolhead) ? toolhead->id : 0;
|
---|
| 5216 | break;
|
---|
| 5217 | }
|
---|
| 5218 | tool = find_tool(firsttool);
|
---|
| 5219 | if(!tool)
|
---|
| 5220 | tool = toolhead;
|
---|
| 5221 | if(SHORT1FROMMP(mp1) == IDM_TOOLRIGHT) {
|
---|
| 5222 | tool = prev_tool(tool,TRUE);
|
---|
| 5223 | firsttool = tool->id;
|
---|
| 5224 | }
|
---|
| 5225 | else {
|
---|
| 5226 | tool = next_tool(tool,TRUE);
|
---|
| 5227 | firsttool = tool->id;
|
---|
| 5228 | }
|
---|
| 5229 | ResizeTools(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5230 | MAIN_TOOLS));
|
---|
| 5231 | }
|
---|
| 5232 | break;
|
---|
| 5233 |
|
---|
| 5234 | case IDM_CREATETOOL:
|
---|
| 5235 | BuildTools(hwndToolback,
|
---|
| 5236 | TRUE);
|
---|
| 5237 | break;
|
---|
| 5238 |
|
---|
| 5239 | case IDM_TOOLBAR:
|
---|
| 5240 | SetMenuCheck(WinQueryWindowULong(hwnd,0),
|
---|
| 5241 | IDM_TOOLSUBMENU,
|
---|
| 5242 | &fToolbar,
|
---|
| 5243 | TRUE,
|
---|
| 5244 | "Toolbar");
|
---|
| 5245 | BuildTools(hwndToolback,
|
---|
| 5246 | TRUE);
|
---|
| 5247 | WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5248 | MAIN_TOOLS),
|
---|
| 5249 | fToolbar);
|
---|
| 5250 | WinSendMsg(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5251 | WM_UPDATEFRAME,
|
---|
| 5252 | MPFROMLONG(FCF_SIZEBORDER),
|
---|
| 5253 | MPVOID);
|
---|
| 5254 | if(fDrivebar)
|
---|
| 5255 | WinInvalidateRect(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5256 | MAIN_DRIVES),
|
---|
| 5257 | NULL,
|
---|
| 5258 | TRUE);
|
---|
| 5259 | break;
|
---|
| 5260 |
|
---|
| 5261 | case IDM_DRIVEBAR:
|
---|
| 5262 | SetMenuCheck(WinQueryWindowULong(hwnd,0),
|
---|
| 5263 | IDM_DRIVEBAR,
|
---|
| 5264 | &fDrivebar,
|
---|
| 5265 | TRUE,
|
---|
| 5266 | "Drivebar");
|
---|
| 5267 | WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5268 | MAIN_DRIVES),
|
---|
| 5269 | fDrivebar);
|
---|
| 5270 | PostMsg(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5271 | WM_UPDATEFRAME,
|
---|
| 5272 | MPFROMLONG(FCF_SIZEBORDER),
|
---|
| 5273 | MPVOID);
|
---|
| 5274 | PostMsg(hwnd,
|
---|
| 5275 | UM_BUILDDRIVES,
|
---|
| 5276 | MPVOID,
|
---|
| 5277 | MPVOID);
|
---|
| 5278 | break;
|
---|
| 5279 |
|
---|
| 5280 | case IDM_USERLIST:
|
---|
| 5281 | SetMenuCheck(WinQueryWindowULong(hwnd,0),
|
---|
| 5282 | SHORT1FROMMP(mp1),
|
---|
| 5283 | &fUserComboBox,
|
---|
| 5284 | TRUE,
|
---|
| 5285 | "UserComboBox");
|
---|
| 5286 | WinShowWindow(hwndUserlist,fUserComboBox);
|
---|
| 5287 | PostMsg(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5288 | WM_UPDATEFRAME,
|
---|
| 5289 | MPFROMLONG(FCF_SIZEBORDER),
|
---|
| 5290 | MPVOID);
|
---|
| 5291 | PostMsg(hwnd,
|
---|
| 5292 | UM_FILLUSERLIST,
|
---|
| 5293 | MPVOID,
|
---|
| 5294 | MPVOID);
|
---|
| 5295 | PostMsg(hwnd,
|
---|
| 5296 | UM_FILLSETUPLIST,
|
---|
| 5297 | MPVOID,
|
---|
| 5298 | MPVOID);
|
---|
| 5299 | PostMsg(hwnd,
|
---|
| 5300 | UM_FILLCMDLIST,
|
---|
| 5301 | MPVOID,
|
---|
| 5302 | MPVOID);
|
---|
| 5303 | PostMsg(hwnd,
|
---|
| 5304 | UM_FILLBUTTONLIST,
|
---|
| 5305 | MPVOID,
|
---|
| 5306 | MPVOID);
|
---|
| 5307 | break;
|
---|
| 5308 |
|
---|
| 5309 | case IDM_MOREBUTTONS:
|
---|
| 5310 | WinSetWindowText(hwndName,NullStr);
|
---|
| 5311 | WinSetWindowText(hwndDate,NullStr);
|
---|
| 5312 | WinSetWindowText(hwndAttr,NullStr);
|
---|
| 5313 | SetMenuCheck(WinQueryWindowULong(hwnd,0),
|
---|
| 5314 | SHORT1FROMMP(mp1),
|
---|
| 5315 | &fMoreButtons,
|
---|
| 5316 | TRUE,
|
---|
| 5317 | "MoreButtons");
|
---|
| 5318 | if(fMoreButtons) {
|
---|
| 5319 |
|
---|
| 5320 | HWND hwndTemp;
|
---|
| 5321 |
|
---|
| 5322 | hwndTemp = TopWindow(hwnd,(HWND)0);
|
---|
| 5323 |
|
---|
| 5324 | if(hwndTemp) {
|
---|
| 5325 | WinSetFocus(HWND_DESKTOP,
|
---|
| 5326 | hwnd);
|
---|
| 5327 | WinSetFocus(HWND_DESKTOP,
|
---|
| 5328 | hwndTemp);
|
---|
| 5329 | }
|
---|
| 5330 | }
|
---|
| 5331 | PostMsg(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5332 | WM_UPDATEFRAME,
|
---|
| 5333 | MPFROMLONG(FCF_SIZEBORDER),
|
---|
| 5334 | MPVOID);
|
---|
| 5335 | break;
|
---|
| 5336 |
|
---|
| 5337 | case IDM_FREETREE:
|
---|
| 5338 | if(fFreeTree) {
|
---|
| 5339 |
|
---|
| 5340 | SWP swp,swpT;
|
---|
| 5341 |
|
---|
| 5342 | WinQueryWindowPos(hwndTree,&swpT);
|
---|
| 5343 | WinQueryWindowPos(hwnd,&swp);
|
---|
| 5344 | WinSetWindowPos(hwndTree,HWND_TOP,0,swp.cy - swpT.cy,0,0,SWP_MOVE);
|
---|
| 5345 | }
|
---|
| 5346 | SetMenuCheck(WinQueryWindowULong(hwnd,0),SHORT1FROMMP(mp1),
|
---|
| 5347 | &fFreeTree,TRUE,"FreeTree");
|
---|
| 5348 | if(fAutoTile)
|
---|
| 5349 | TileChildren(hwnd,TRUE);
|
---|
| 5350 | break;
|
---|
| 5351 |
|
---|
| 5352 | case IDM_AUTOTILE:
|
---|
| 5353 | SetMenuCheck(WinQueryWindowULong(hwnd,0),
|
---|
| 5354 | SHORT1FROMMP(mp1),
|
---|
| 5355 | &fAutoTile,
|
---|
| 5356 | TRUE,
|
---|
| 5357 | "AutoTile");
|
---|
| 5358 | if(fAutoTile)
|
---|
| 5359 | TileChildren(hwnd,TRUE);
|
---|
| 5360 | break;
|
---|
| 5361 |
|
---|
| 5362 | case IDM_TILEBACKWARDS:
|
---|
| 5363 | SetMenuCheck(WinQueryWindowULong(hwnd,0),
|
---|
| 5364 | SHORT1FROMMP(mp1),
|
---|
| 5365 | &fTileBackwards,
|
---|
| 5366 | TRUE,
|
---|
| 5367 | "TileBackwards");
|
---|
| 5368 | if(fAutoTile)
|
---|
| 5369 | TileChildren(hwnd,TRUE);
|
---|
| 5370 | break;
|
---|
| 5371 |
|
---|
| 5372 | case IDM_NEXTWINDOW:
|
---|
| 5373 | case IDM_PREVWINDOW:
|
---|
| 5374 | NextChild(hwnd,
|
---|
| 5375 | (SHORT1FROMMP(mp1) == IDM_PREVWINDOW));
|
---|
| 5376 | break;
|
---|
| 5377 |
|
---|
| 5378 | case IDM_CASCADE:
|
---|
| 5379 | CascadeChildren(hwnd);
|
---|
| 5380 | break;
|
---|
| 5381 |
|
---|
| 5382 | case IDM_TILE:
|
---|
| 5383 | TileChildren(hwnd,TRUE);
|
---|
| 5384 | break;
|
---|
| 5385 |
|
---|
| 5386 | case IDM_RESTORE:
|
---|
| 5387 | MinResChildren(hwnd,
|
---|
| 5388 | SWP_RESTORE);
|
---|
| 5389 | break;
|
---|
| 5390 |
|
---|
| 5391 | case IDM_MINIMIZE:
|
---|
| 5392 | MinResChildren(hwnd,
|
---|
| 5393 | SWP_MINIMIZE);
|
---|
| 5394 | break;
|
---|
| 5395 |
|
---|
| 5396 | case IDM_ARRANGEICONS:
|
---|
| 5397 | ArrangeIcons(hwnd);
|
---|
| 5398 | break;
|
---|
| 5399 |
|
---|
| 5400 | case IDM_INIVIEWER:
|
---|
| 5401 | StartIniEditor(hwnd,NULL,4);
|
---|
| 5402 | break;
|
---|
| 5403 |
|
---|
| 5404 | case IDM_EDITASSOC:
|
---|
| 5405 | EditAssociations(hwnd);
|
---|
| 5406 | break;
|
---|
| 5407 |
|
---|
| 5408 | case IDM_EDITCOMMANDS:
|
---|
| 5409 | EditCommands(hwnd);
|
---|
| 5410 | PostMsg(hwnd,
|
---|
| 5411 | UM_FILLCMDLIST,
|
---|
| 5412 | MPVOID,
|
---|
| 5413 | MPVOID);
|
---|
| 5414 | break;
|
---|
| 5415 |
|
---|
| 5416 | default:
|
---|
| 5417 | if(!SwitchCommand((HWND)WinQueryWindowULong(hwnd,0),
|
---|
| 5418 | SHORT1FROMMP(mp1))) {
|
---|
| 5419 | if(SHORT1FROMMP(mp1) >= IDM_COMMANDSTART &&
|
---|
| 5420 | SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) {
|
---|
| 5421 |
|
---|
| 5422 | INT x;
|
---|
| 5423 | HWND hwndCnr;
|
---|
| 5424 |
|
---|
| 5425 | if(!cmdloaded)
|
---|
| 5426 | load_commands();
|
---|
| 5427 | hwndCnr = TopWindow(hwnd,(HWND)0);
|
---|
| 5428 | hwndCnr = (HWND)WinSendMsg(WinWindowFromID(hwndCnr,FID_CLIENT),
|
---|
| 5429 | UM_CONTAINERHWND,
|
---|
| 5430 | MPVOID,
|
---|
| 5431 | MPVOID);
|
---|
| 5432 | if(!hwndCnr) {
|
---|
| 5433 | DosBeep(50,100);
|
---|
| 5434 | break;
|
---|
| 5435 | }
|
---|
| 5436 | x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART;
|
---|
| 5437 | if(x >= 0) {
|
---|
| 5438 | x++;
|
---|
| 5439 | RunCommand(hwndCnr,x);
|
---|
| 5440 | if(fUnHilite) {
|
---|
| 5441 |
|
---|
| 5442 | PCNRITEM pci;
|
---|
| 5443 | DIRCNRDATA *dcd = NULL;
|
---|
| 5444 |
|
---|
| 5445 | if(WinQueryWindowUShort(hwndCnr,QWS_ID) != TREE_CNR)
|
---|
| 5446 | dcd = INSTDATA(hwndCnr);
|
---|
| 5447 | pci = (PCNRITEM)WinSendMsg(hwndCnr,
|
---|
| 5448 | CM_QUERYRECORDEMPHASIS,
|
---|
| 5449 | MPFROMLONG(CMA_FIRST),
|
---|
| 5450 | MPFROMSHORT(CRA_CURSORED));
|
---|
| 5451 | if(pci && (INT)pci != -1 &&
|
---|
| 5452 | (pci->rc.flRecordAttr & CRA_SELECTED))
|
---|
| 5453 | UnHilite(hwnd,
|
---|
| 5454 | TRUE,
|
---|
| 5455 | ((dcd) ? &dcd->lastselection : NULL));
|
---|
| 5456 | }
|
---|
| 5457 | }
|
---|
| 5458 | }
|
---|
| 5459 | else if(SHORT1FROMMP(mp1) >= IDM_QUICKTOOLSTART &&
|
---|
| 5460 | SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART + 50) {
|
---|
| 5461 | if(!qtloaded)
|
---|
| 5462 | load_quicktools();
|
---|
| 5463 | if(quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]) {
|
---|
| 5464 | if(fToolsChanged)
|
---|
| 5465 | save_tools(NULL);
|
---|
| 5466 | if(!load_tools(quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]))
|
---|
| 5467 | load_tools(NULL);
|
---|
| 5468 | else {
|
---|
| 5469 | strcpy(lasttoolbox,
|
---|
| 5470 | quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]);
|
---|
| 5471 | PrfWriteProfileString(fmprof,
|
---|
| 5472 | FM3Str,
|
---|
| 5473 | "LastToolBox",
|
---|
| 5474 | lasttoolbox);
|
---|
| 5475 | }
|
---|
| 5476 | BuildTools(hwndToolback,
|
---|
| 5477 | TRUE);
|
---|
| 5478 | }
|
---|
| 5479 | }
|
---|
| 5480 | else {
|
---|
| 5481 |
|
---|
| 5482 | HWND hwndActive;
|
---|
| 5483 |
|
---|
| 5484 | hwndActive = TopWindow(hwnd,
|
---|
| 5485 | (HWND)0);
|
---|
| 5486 | if(hwndActive)
|
---|
| 5487 | PostMsg(WinWindowFromID(hwndActive,FID_CLIENT),
|
---|
| 5488 | WM_COMMAND,
|
---|
| 5489 | mp1,
|
---|
| 5490 | mp2);
|
---|
| 5491 | }
|
---|
| 5492 | }
|
---|
| 5493 | break;
|
---|
| 5494 | }
|
---|
| 5495 | return 0;
|
---|
| 5496 | }
|
---|
| 5497 |
|
---|
| 5498 |
|
---|
| 5499 | MRESULT EXPENTRY MainWMOnce (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
| 5500 |
|
---|
| 5501 | switch(msg) {
|
---|
| 5502 | case WM_CREATE:
|
---|
| 5503 | {
|
---|
| 5504 | TID tid;
|
---|
| 5505 |
|
---|
| 5506 | WinQueryWindowProcess(hwnd,
|
---|
| 5507 | &mypid,
|
---|
| 5508 | &tid);
|
---|
| 5509 | }
|
---|
| 5510 | hwndMain = hwnd;
|
---|
| 5511 | WinSetWindowUShort(hwnd,8,0);
|
---|
| 5512 | WinSetWindowUShort(hwnd,10,0);
|
---|
| 5513 | WinSetWindowUShort(hwnd,12,0);
|
---|
| 5514 | WinSetWindowUShort(hwnd,16,0);
|
---|
| 5515 | if(_beginthread(MakeMainObjWin,
|
---|
| 5516 | NULL,
|
---|
| 5517 | 245760,
|
---|
| 5518 | MPVOID) == -1) {
|
---|
| 5519 | PostMsg(hwnd,
|
---|
| 5520 | WM_CLOSE,
|
---|
| 5521 | MPVOID,
|
---|
| 5522 | MPVOID);
|
---|
| 5523 | return 0;
|
---|
| 5524 | }
|
---|
| 5525 | else
|
---|
| 5526 | DosSleep(64);
|
---|
| 5527 | {
|
---|
| 5528 | SWP swp;
|
---|
| 5529 | PFNWP oldproc;
|
---|
| 5530 |
|
---|
| 5531 | /*
|
---|
| 5532 | * create frame children (not client children, frame children)
|
---|
| 5533 | */
|
---|
| 5534 | DosSleep(1L);
|
---|
| 5535 | WinQueryWindowPos(WinQueryWindow(hwnd,QW_PARENT),&swp);
|
---|
| 5536 | oldproc = WinSubclassWindow(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5537 | (PFNWP)MainFrameWndProc);
|
---|
| 5538 | if(oldproc)
|
---|
| 5539 | WinSetWindowPtr(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5540 | 0,
|
---|
| 5541 | (PVOID)oldproc);
|
---|
| 5542 | CommonCreateMainChildren(hwnd,&swp);
|
---|
| 5543 |
|
---|
| 5544 | if(WinCreateWindow(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5545 | WC_BUTTON,
|
---|
| 5546 | "I",
|
---|
| 5547 | WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS,
|
---|
| 5548 | ((swp.cx -
|
---|
| 5549 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5550 | SV_CXMINMAXBUTTON)) -
|
---|
| 5551 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5552 | SV_CXMINMAXBUTTON) / 2) -
|
---|
| 5553 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5554 | SV_CXSIZEBORDER),
|
---|
| 5555 | (swp.cy - WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5556 | SV_CYMINMAXBUTTON)) -
|
---|
| 5557 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5558 | SV_CYSIZEBORDER),
|
---|
| 5559 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5560 | SV_CXMINMAXBUTTON) / 2,
|
---|
| 5561 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5562 | SV_CYMINMAXBUTTON),
|
---|
| 5563 | hwnd,
|
---|
| 5564 | HWND_TOP,
|
---|
| 5565 | IDM_IDEALSIZE,
|
---|
| 5566 | NULL,
|
---|
| 5567 | NULL)) {
|
---|
| 5568 | WinSubclassWindow(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5569 | IDM_IDEALSIZE),
|
---|
| 5570 | (PFNWP)IdealButtonProc);
|
---|
| 5571 | SetPresParams(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5572 | IDM_IDEALSIZE),
|
---|
| 5573 | NULL,
|
---|
| 5574 | NULL,
|
---|
| 5575 | NULL,
|
---|
| 5576 | GetPString(IDS_10SYSTEMVIOTEXT));
|
---|
| 5577 | }
|
---|
| 5578 |
|
---|
| 5579 |
|
---|
| 5580 | WinCreateWindow(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5581 | WC_BUTTON,
|
---|
| 5582 | "#1019",
|
---|
| 5583 | WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS |
|
---|
| 5584 | BS_BITMAP,
|
---|
| 5585 | swp.cx - 46,
|
---|
| 5586 | swp.y + 2,
|
---|
| 5587 | 24,
|
---|
| 5588 | 22,
|
---|
| 5589 | hwnd,
|
---|
| 5590 | HWND_TOP,
|
---|
| 5591 | IDM_OPENWALK,
|
---|
| 5592 | NULL,
|
---|
| 5593 | NULL);
|
---|
| 5594 | WinCreateWindow(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5595 | WC_BUTTON,
|
---|
| 5596 | "#3062",
|
---|
| 5597 | WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS |
|
---|
| 5598 | BS_BITMAP,
|
---|
| 5599 | swp.cx - 22,
|
---|
| 5600 | swp.y + 2,
|
---|
| 5601 | 24,
|
---|
| 5602 | 22,
|
---|
| 5603 | hwnd,
|
---|
| 5604 | HWND_TOP,
|
---|
| 5605 | IDM_USERLIST,
|
---|
| 5606 | NULL,
|
---|
| 5607 | NULL);
|
---|
| 5608 |
|
---|
| 5609 | hwndUserlist = WinCreateWindow(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5610 | WC_COMBOBOX,
|
---|
| 5611 | (PSZ)NULL,
|
---|
| 5612 | WS_VISIBLE | CBS_DROPDOWN |
|
---|
| 5613 | LS_HORZSCROLL,
|
---|
| 5614 | (swp.x +
|
---|
| 5615 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5616 | SV_CXSIZEBORDER) + 48L),
|
---|
| 5617 | (swp.cy -
|
---|
| 5618 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5619 | SV_CYSIZEBORDER)) - 60,
|
---|
| 5620 | ((swp.cx -
|
---|
| 5621 | (WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5622 | SV_CXSIZEBORDER) * 2)) - 64L),
|
---|
| 5623 | 60L,
|
---|
| 5624 | WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5625 | HWND_TOP,
|
---|
| 5626 | MAIN_USERLIST,
|
---|
| 5627 | NULL,
|
---|
| 5628 | NULL);
|
---|
| 5629 | hwndCmdlist = WinCreateWindow(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5630 | WC_COMBOBOX,
|
---|
| 5631 | (PSZ)NULL,
|
---|
| 5632 | WS_VISIBLE | CBS_DROPDOWN |
|
---|
| 5633 | LS_HORZSCROLL,
|
---|
| 5634 | (swp.x +
|
---|
| 5635 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5636 | SV_CXSIZEBORDER) + 48L),
|
---|
| 5637 | (swp.cy -
|
---|
| 5638 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5639 | SV_CYSIZEBORDER)) - 60,
|
---|
| 5640 | ((swp.cx -
|
---|
| 5641 | (WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5642 | SV_CXSIZEBORDER) * 2)) - 64L),
|
---|
| 5643 | 60L,
|
---|
| 5644 | WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5645 | HWND_TOP,
|
---|
| 5646 | MAIN_CMDLIST,
|
---|
| 5647 | NULL,
|
---|
| 5648 | NULL);
|
---|
| 5649 | WinSetWindowText(hwndCmdlist,
|
---|
| 5650 | GetPString(IDS_COMMANDSTEXT));
|
---|
| 5651 | hwndStatelist = WinCreateWindow(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5652 | WC_COMBOBOX,
|
---|
| 5653 | (PSZ)NULL,
|
---|
| 5654 | WS_VISIBLE | CBS_DROPDOWN |
|
---|
| 5655 | LS_HORZSCROLL,
|
---|
| 5656 | (swp.x +
|
---|
| 5657 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5658 | SV_CXSIZEBORDER) + 48L),
|
---|
| 5659 | (swp.cy -
|
---|
| 5660 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5661 | SV_CYSIZEBORDER)) - 60,
|
---|
| 5662 | ((swp.cx -
|
---|
| 5663 | (WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5664 | SV_CXSIZEBORDER) * 2)) - 64L),
|
---|
| 5665 | 60L,
|
---|
| 5666 | WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5667 | HWND_TOP,
|
---|
| 5668 | MAIN_SETUPLIST,
|
---|
| 5669 | NULL,
|
---|
| 5670 | NULL);
|
---|
| 5671 | hwndDrivelist = WinCreateWindow(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5672 | WC_COMBOBOX,
|
---|
| 5673 | (PSZ)NULL,
|
---|
| 5674 | WS_VISIBLE | CBS_DROPDOWN,
|
---|
| 5675 | (swp.x +
|
---|
| 5676 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5677 | SV_CXSIZEBORDER)),
|
---|
| 5678 | (swp.cy -
|
---|
| 5679 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5680 | SV_CYSIZEBORDER)) - 60,
|
---|
| 5681 | 48L,
|
---|
| 5682 | 60L,
|
---|
| 5683 | WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5684 | HWND_TOP,
|
---|
| 5685 | MAIN_DRIVELIST,
|
---|
| 5686 | NULL,
|
---|
| 5687 | NULL);
|
---|
| 5688 | SetPresParams(hwndDrivelist,
|
---|
| 5689 | NULL,
|
---|
| 5690 | NULL,
|
---|
| 5691 | NULL,
|
---|
| 5692 | GetPString(IDS_10SYSTEMMONOTEXT));
|
---|
| 5693 | hwndButtonlist = WinCreateWindow(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5694 | WC_COMBOBOX,
|
---|
| 5695 | (PSZ)NULL,
|
---|
| 5696 | WS_VISIBLE | CBS_DROPDOWN |
|
---|
| 5697 | LS_HORZSCROLL,
|
---|
| 5698 | (swp.cx -
|
---|
| 5699 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5700 | SV_CXSIZEBORDER)) - 164L,
|
---|
| 5701 | (swp.cy -
|
---|
| 5702 | WinQuerySysValue(HWND_DESKTOP,
|
---|
| 5703 | SV_CYSIZEBORDER)) - 60,
|
---|
| 5704 | 164L,
|
---|
| 5705 | 60L,
|
---|
| 5706 | WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5707 | HWND_TOP,
|
---|
| 5708 | MAIN_BUTTONLIST,
|
---|
| 5709 | NULL,
|
---|
| 5710 | NULL);
|
---|
| 5711 | WinSendMsg(WinWindowFromID(hwndUserlist,CBID_EDIT),
|
---|
| 5712 | EM_SETTEXTLIMIT,
|
---|
| 5713 | MPFROM2SHORT(CCHMAXPATH,0),
|
---|
| 5714 | MPVOID);
|
---|
| 5715 | WinSendMsg(WinWindowFromID(hwndStatelist,CBID_EDIT),
|
---|
| 5716 | EM_SETTEXTLIMIT,
|
---|
| 5717 | MPFROM2SHORT(13,0),
|
---|
| 5718 | MPVOID);
|
---|
| 5719 | WinSendMsg(WinWindowFromID(hwndDrivelist,CBID_EDIT),
|
---|
| 5720 | EM_SETREADONLY,
|
---|
| 5721 | MPFROM2SHORT(TRUE,0),
|
---|
| 5722 | MPVOID);
|
---|
| 5723 | WinSendMsg(WinWindowFromID(hwndButtonlist,CBID_EDIT),
|
---|
| 5724 | EM_SETREADONLY,
|
---|
| 5725 | MPFROM2SHORT(TRUE,0),
|
---|
| 5726 | MPVOID);
|
---|
| 5727 | WinSendMsg(WinWindowFromID(hwndCmdlist,CBID_EDIT),
|
---|
| 5728 | EM_SETREADONLY,
|
---|
| 5729 | MPFROM2SHORT(TRUE,0),
|
---|
| 5730 | MPVOID);
|
---|
| 5731 | oldproc = WinSubclassWindow(WinWindowFromID(hwndUserlist,CBID_EDIT),
|
---|
| 5732 | (PFNWP)DropDownListProc);
|
---|
| 5733 | if(oldproc)
|
---|
| 5734 | WinSetWindowPtr(WinWindowFromID(hwndUserlist,CBID_EDIT),
|
---|
| 5735 | 0,
|
---|
| 5736 | (PVOID)oldproc);
|
---|
| 5737 | oldproc = WinSubclassWindow(WinWindowFromID(hwndCmdlist,CBID_EDIT),
|
---|
| 5738 | (PFNWP)DropDownListProc);
|
---|
| 5739 | if(oldproc)
|
---|
| 5740 | WinSetWindowPtr(WinWindowFromID(hwndCmdlist,CBID_EDIT),
|
---|
| 5741 | 0,
|
---|
| 5742 | (PVOID)oldproc);
|
---|
| 5743 | oldproc = WinSubclassWindow(WinWindowFromID(hwndButtonlist,CBID_EDIT),
|
---|
| 5744 | (PFNWP)DropDownListProc);
|
---|
| 5745 | if(oldproc)
|
---|
| 5746 | WinSetWindowPtr(WinWindowFromID(hwndButtonlist,CBID_EDIT),
|
---|
| 5747 | 0,
|
---|
| 5748 | (PVOID)oldproc);
|
---|
| 5749 | oldproc = WinSubclassWindow(WinWindowFromID(hwndStatelist,CBID_EDIT),
|
---|
| 5750 | (PFNWP)DropDownListProc);
|
---|
| 5751 | if(oldproc)
|
---|
| 5752 | WinSetWindowPtr(WinWindowFromID(hwndStatelist,CBID_EDIT),
|
---|
| 5753 | 0,
|
---|
| 5754 | (PVOID)oldproc);
|
---|
| 5755 | oldproc = WinSubclassWindow(WinWindowFromID(hwndDrivelist,CBID_EDIT),
|
---|
| 5756 | (PFNWP)DropDownListProc);
|
---|
| 5757 | if(oldproc)
|
---|
| 5758 | WinSetWindowPtr(WinWindowFromID(hwndDrivelist,CBID_EDIT),
|
---|
| 5759 | 0,
|
---|
| 5760 | (PVOID)oldproc);
|
---|
| 5761 | oldproc = WinSubclassWindow(hwndUserlist,
|
---|
| 5762 | (PFNWP)DropDownListProc);
|
---|
| 5763 | if(oldproc)
|
---|
| 5764 | WinSetWindowPtr(hwndUserlist,
|
---|
| 5765 | 0,
|
---|
| 5766 | (PVOID)oldproc);
|
---|
| 5767 | oldproc = WinSubclassWindow(hwndCmdlist,
|
---|
| 5768 | (PFNWP)DropDownListProc);
|
---|
| 5769 | if(oldproc)
|
---|
| 5770 | WinSetWindowPtr(hwndCmdlist,
|
---|
| 5771 | 0,
|
---|
| 5772 | (PVOID)oldproc);
|
---|
| 5773 | oldproc = WinSubclassWindow(hwndStatelist,
|
---|
| 5774 | (PFNWP)DropDownListProc);
|
---|
| 5775 | if(oldproc)
|
---|
| 5776 | WinSetWindowPtr(hwndStatelist,
|
---|
| 5777 | 0,
|
---|
| 5778 | (PVOID)oldproc);
|
---|
| 5779 | oldproc = WinSubclassWindow(hwndDrivelist,
|
---|
| 5780 | (PFNWP)DropDownListProc);
|
---|
| 5781 | if(oldproc)
|
---|
| 5782 | WinSetWindowPtr(hwndDrivelist,0,(PVOID)oldproc);
|
---|
| 5783 | oldproc = WinSubclassWindow(hwndButtonlist,
|
---|
| 5784 | (PFNWP)DropDownListProc);
|
---|
| 5785 | if(oldproc)
|
---|
| 5786 | WinSetWindowPtr(hwndButtonlist,
|
---|
| 5787 | 0,
|
---|
| 5788 | (PVOID)oldproc);
|
---|
| 5789 | oldproc = WinSubclassWindow(WinWindowFromID(WinQueryWindow(hwnd,
|
---|
| 5790 | QW_PARENT),
|
---|
| 5791 | IDM_USERLIST),
|
---|
| 5792 | (PFNWP)ChildFrameButtonProc);
|
---|
| 5793 | if(oldproc)
|
---|
| 5794 | WinSetWindowPtr(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5795 | IDM_USERLIST),
|
---|
| 5796 | 0,
|
---|
| 5797 | (PVOID)oldproc);
|
---|
| 5798 | oldproc = WinSubclassWindow(WinWindowFromID(WinQueryWindow(hwnd,
|
---|
| 5799 | QW_PARENT),
|
---|
| 5800 | IDM_OPENWALK),
|
---|
| 5801 | (PFNWP)ChildFrameButtonProc);
|
---|
| 5802 | if(oldproc)
|
---|
| 5803 | WinSetWindowPtr(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5804 | IDM_OPENWALK),
|
---|
| 5805 | 0,
|
---|
| 5806 | (PVOID)oldproc);
|
---|
| 5807 | {
|
---|
| 5808 | HWND hwndSysMenu,hwndSysSubMenu,hwndMenu;
|
---|
| 5809 | USHORT idSysMenu;
|
---|
| 5810 | MENUITEM mi,mit;
|
---|
| 5811 |
|
---|
| 5812 | hwndMenu = WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5813 | FID_MENU);
|
---|
| 5814 | WinSendMsg(hwnd,
|
---|
| 5815 | UM_ADDTOMENU,
|
---|
| 5816 | MPVOID,
|
---|
| 5817 | MPVOID);
|
---|
| 5818 | SetToggleChecks(hwndMenu);
|
---|
| 5819 | SetConditionalCascade(hwndMenu,
|
---|
| 5820 | IDM_TOOLSUBMENU,
|
---|
| 5821 | IDM_TOOLBAR);
|
---|
| 5822 | SetConditionalCascade(hwndMenu,
|
---|
| 5823 | IDM_AUTOVIEWSUBMENU,
|
---|
| 5824 | IDM_AUTOVIEW);
|
---|
| 5825 | SetConditionalCascade(hwndMenu,
|
---|
| 5826 | IDM_TILEMENU,
|
---|
| 5827 | IDM_TILE);
|
---|
| 5828 | WinSetWindowULong(hwnd,
|
---|
| 5829 | 0,
|
---|
| 5830 | (ULONG)hwndMenu);
|
---|
| 5831 | memset(&mi,0,sizeof(mi));
|
---|
| 5832 | memset(&mit,0,sizeof(mit));
|
---|
| 5833 | hwndSysMenu = WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5834 | FID_SYSMENU);
|
---|
| 5835 | idSysMenu = SHORT1FROMMR(WinSendMsg(hwndSysMenu,
|
---|
| 5836 | MM_ITEMIDFROMPOSITION,
|
---|
| 5837 | MPVOID,
|
---|
| 5838 | MPVOID));
|
---|
| 5839 | WinSendMsg(hwndSysMenu,
|
---|
| 5840 | MM_QUERYITEM,
|
---|
| 5841 | MPFROM2SHORT(idSysMenu, 0),
|
---|
| 5842 | MPFROMP(&mit));
|
---|
| 5843 | hwndSysSubMenu = mit.hwndSubMenu;
|
---|
| 5844 | mi.iPosition = MIT_END;
|
---|
| 5845 | mi.afStyle = MIS_SEPARATOR;
|
---|
| 5846 | mi.id = -1;
|
---|
| 5847 | WinSendMsg(hwndSysSubMenu,
|
---|
| 5848 | MM_INSERTITEM,
|
---|
| 5849 | MPFROMP(&mi),
|
---|
| 5850 | MPFROMP(NULL));
|
---|
| 5851 | mi.afStyle = MIS_TEXT;
|
---|
| 5852 | mi.id = IDM_IDEALSIZE;
|
---|
| 5853 | WinSendMsg(hwndSysSubMenu,
|
---|
| 5854 | MM_INSERTITEM,
|
---|
| 5855 | MPFROMP(&mi),
|
---|
| 5856 | MPFROMP(GetPString(IDS_IDEALMENUTEXT)));
|
---|
| 5857 | mi.afStyle = MIS_TEXT;
|
---|
| 5858 | mi.id = IDM_HIDEMENU;
|
---|
| 5859 | WinSendMsg(hwndSysSubMenu,
|
---|
| 5860 | MM_INSERTITEM,
|
---|
| 5861 | MPFROMP(&mi),
|
---|
| 5862 | MPFROMP(GetPString(IDS_HIDEMENUTEXT)));
|
---|
| 5863 | SetSysMenu(hwndSysMenu);
|
---|
| 5864 | }
|
---|
| 5865 | }
|
---|
| 5866 | {
|
---|
| 5867 | ULONG size;
|
---|
| 5868 | BOOL temp = FALSE;
|
---|
| 5869 |
|
---|
| 5870 | size = sizeof(BOOL);
|
---|
| 5871 | if(PrfQueryProfileData(fmprof,
|
---|
| 5872 | FM3Str,
|
---|
| 5873 | "MenuInvisible",
|
---|
| 5874 | (PVOID)&temp,
|
---|
| 5875 | &size) &&
|
---|
| 5876 | size &&
|
---|
| 5877 | temp)
|
---|
| 5878 | WinSendMsg(hwnd,
|
---|
| 5879 | WM_COMMAND,
|
---|
| 5880 | MPFROM2SHORT(IDM_HIDEMENU,0),
|
---|
| 5881 | MPVOID);
|
---|
| 5882 | size = sizeof(BOOL);
|
---|
| 5883 | if(PrfQueryProfileData(fmprof,
|
---|
| 5884 | FM3Str,
|
---|
| 5885 | "FreeTree",
|
---|
| 5886 | (PVOID)&temp,
|
---|
| 5887 | &size) &&
|
---|
| 5888 | size &&
|
---|
| 5889 | temp)
|
---|
| 5890 | WinSendMsg(hwnd,
|
---|
| 5891 | WM_COMMAND,
|
---|
| 5892 | MPFROM2SHORT(IDM_FREETREE,0),
|
---|
| 5893 | MPVOID);
|
---|
| 5894 | size = sizeof(BOOL);
|
---|
| 5895 | if(PrfQueryProfileData(fmprof,
|
---|
| 5896 | FM3Str,
|
---|
| 5897 | "AutoTile",
|
---|
| 5898 | (PVOID)&temp,
|
---|
| 5899 | &size) &&
|
---|
| 5900 | size &&
|
---|
| 5901 | !temp)
|
---|
| 5902 | WinSendMsg(hwnd,
|
---|
| 5903 | WM_COMMAND,
|
---|
| 5904 | MPFROM2SHORT(IDM_AUTOTILE,0),
|
---|
| 5905 | MPVOID);
|
---|
| 5906 | size = sizeof(BOOL);
|
---|
| 5907 | if(PrfQueryProfileData(fmprof,
|
---|
| 5908 | FM3Str,
|
---|
| 5909 | "Toolbar",
|
---|
| 5910 | &temp,
|
---|
| 5911 | &size) &&
|
---|
| 5912 | size &&
|
---|
| 5913 | !temp)
|
---|
| 5914 | WinSendMsg(hwnd,
|
---|
| 5915 | WM_COMMAND,
|
---|
| 5916 | MPFROM2SHORT(IDM_TOOLBAR,0),
|
---|
| 5917 | MPVOID);
|
---|
| 5918 | }
|
---|
| 5919 | WinSetWindowText(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5920 | FID_TITLEBAR),
|
---|
| 5921 | "FM/2");
|
---|
| 5922 | FixSwitchList(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5923 | NULL);
|
---|
| 5924 | break;
|
---|
| 5925 |
|
---|
| 5926 | case UM_SETUP:
|
---|
| 5927 | /*
|
---|
| 5928 | * start up some initial children
|
---|
| 5929 | */
|
---|
| 5930 | load_tools(NULL);
|
---|
| 5931 | BuildTools(hwndToolback,
|
---|
| 5932 | TRUE);
|
---|
| 5933 | WinShowWindow(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5934 | TRUE);
|
---|
| 5935 | PostMsg(MainObjectHwnd,
|
---|
| 5936 | UM_SETUP2,
|
---|
| 5937 | mp1,
|
---|
| 5938 | mp2);
|
---|
| 5939 | return 0;
|
---|
| 5940 |
|
---|
| 5941 | case UM_SETUP2:
|
---|
| 5942 | {
|
---|
| 5943 | SWP swp;
|
---|
| 5944 | ULONG size = sizeof(SWP);
|
---|
| 5945 |
|
---|
| 5946 | WinQueryWindowPos(hwnd,&swp);
|
---|
| 5947 | hwndTree = StartTreeCnr(hwnd,0);
|
---|
| 5948 | if(!hwndTree)
|
---|
| 5949 | WinDestroyWindow(WinQueryWindow(hwnd,QW_PARENT));
|
---|
| 5950 | else {
|
---|
| 5951 | if(!fSaveState ||
|
---|
| 5952 | !PrfQueryProfileData(fmprof,
|
---|
| 5953 | FM3Str,
|
---|
| 5954 | "LastTreePos",
|
---|
| 5955 | &swp,
|
---|
| 5956 | &size) ||
|
---|
| 5957 | size != sizeof(SWP)) {
|
---|
| 5958 |
|
---|
| 5959 | INT ratio,height = 0;
|
---|
| 5960 |
|
---|
| 5961 | if(!fNoTreeGap)
|
---|
| 5962 | height = WinQuerySysValue(HWND_DESKTOP,SV_CYICON) * 2;
|
---|
| 5963 | size = sizeof(ratio);
|
---|
| 5964 | if(!PrfQueryProfileData(fmprof,
|
---|
| 5965 | FM3Str,
|
---|
| 5966 | "TreeWindowRatio",
|
---|
| 5967 | (PVOID)&ratio,
|
---|
| 5968 | &size) ||
|
---|
| 5969 | size < sizeof(ratio))
|
---|
| 5970 | ratio = 400;
|
---|
| 5971 | WinSetWindowPos(hwndTree,
|
---|
| 5972 | HWND_TOP,
|
---|
| 5973 | 0,
|
---|
| 5974 | height,
|
---|
| 5975 | (swp.cx * 100) / ratio,
|
---|
| 5976 | swp.cy - height,
|
---|
| 5977 | SWP_SHOW | SWP_SIZE | SWP_MOVE |
|
---|
| 5978 | SWP_ACTIVATE | SWP_ZORDER);
|
---|
| 5979 | }
|
---|
| 5980 | else
|
---|
| 5981 | WinSetWindowPos(hwndTree,
|
---|
| 5982 | HWND_TOP,
|
---|
| 5983 | swp.x,
|
---|
| 5984 | swp.y,
|
---|
| 5985 | swp.cx,
|
---|
| 5986 | swp.cy,
|
---|
| 5987 | swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW |
|
---|
| 5988 | SWP_ZORDER | SWP_ACTIVATE);
|
---|
| 5989 | }
|
---|
| 5990 | ResizeTools(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 5991 | MAIN_TOOLS));
|
---|
| 5992 | }
|
---|
| 5993 | PostMsg(MainObjectHwnd,
|
---|
| 5994 | UM_SETUP3,
|
---|
| 5995 | mp1,
|
---|
| 5996 | mp2);
|
---|
| 5997 | return 0;
|
---|
| 5998 |
|
---|
| 5999 | case UM_SETUP3:
|
---|
| 6000 | /* start remaining child windows */
|
---|
| 6001 | {
|
---|
| 6002 | if(!fNoSaveState &&
|
---|
| 6003 | fSaveState)
|
---|
| 6004 | PostMsg(MainObjectHwnd,
|
---|
| 6005 | UM_RESTORE,
|
---|
| 6006 | MPVOID,
|
---|
| 6007 | MPVOID);
|
---|
| 6008 | PostMsg(MainObjectHwnd,
|
---|
| 6009 | UM_SETUP4,
|
---|
| 6010 | mp1,
|
---|
| 6011 | mp2);
|
---|
| 6012 | }
|
---|
| 6013 | return 0;
|
---|
| 6014 |
|
---|
| 6015 | case UM_SETUP4:
|
---|
| 6016 | {
|
---|
| 6017 | INT argc = (INT)mp1,x;
|
---|
| 6018 | CHAR **argv = (CHAR **)mp2;
|
---|
| 6019 |
|
---|
| 6020 | for(x = 1;x < argc;x++) {
|
---|
| 6021 | if(*argv[x] == '/' || *argv[x] == ';')
|
---|
| 6022 | continue;
|
---|
| 6023 | if(!IsFile(argv[x]) &&
|
---|
| 6024 | !FindDirCnrByName(argv[x],FALSE))
|
---|
| 6025 | OpenDirCnr((HWND)0,
|
---|
| 6026 | hwndMain,
|
---|
| 6027 | hwndTree,
|
---|
| 6028 | TRUE,
|
---|
| 6029 | argv[x]);
|
---|
| 6030 | }
|
---|
| 6031 | }
|
---|
| 6032 | PostMsg(MainObjectHwnd,
|
---|
| 6033 | UM_SETUP5,
|
---|
| 6034 | MPVOID,
|
---|
| 6035 | MPVOID);
|
---|
| 6036 | return 0;
|
---|
| 6037 |
|
---|
| 6038 | case UM_SETUP5:
|
---|
| 6039 | if(fAutoTile)
|
---|
| 6040 | TileChildren(hwnd,TRUE);
|
---|
| 6041 | PostMsg(hwnd,
|
---|
| 6042 | UM_FILLUSERLIST,
|
---|
| 6043 | MPVOID,
|
---|
| 6044 | MPVOID);
|
---|
| 6045 | PostMsg(hwnd,
|
---|
| 6046 | UM_FILLSETUPLIST,
|
---|
| 6047 | MPVOID,
|
---|
| 6048 | MPVOID);
|
---|
| 6049 | PostMsg(hwnd,
|
---|
| 6050 | UM_FILLCMDLIST,
|
---|
| 6051 | MPVOID,
|
---|
| 6052 | MPVOID);
|
---|
| 6053 | PostMsg(hwnd,
|
---|
| 6054 | UM_FILLBUTTONLIST,
|
---|
| 6055 | MPVOID,
|
---|
| 6056 | MPVOID);
|
---|
| 6057 | {
|
---|
| 6058 | HWND hwndActive;
|
---|
| 6059 |
|
---|
| 6060 | hwndActive = TopWindow(hwnd,hwndTree);
|
---|
| 6061 | if(hwndActive)
|
---|
| 6062 | WinSetWindowPos(hwndActive,
|
---|
| 6063 | HWND_TOP,
|
---|
| 6064 | 0,
|
---|
| 6065 | 0,
|
---|
| 6066 | 0,
|
---|
| 6067 | 0,
|
---|
| 6068 | SWP_ACTIVATE);
|
---|
| 6069 | }
|
---|
| 6070 | if(fStartMinimized ||
|
---|
| 6071 | fReminimize)
|
---|
| 6072 | PostMsg(hwndTree,
|
---|
| 6073 | UM_MINIMIZE,
|
---|
| 6074 | MPVOID,
|
---|
| 6075 | MPVOID);
|
---|
| 6076 | else if(fStartMaximized)
|
---|
| 6077 | PostMsg(hwndTree,
|
---|
| 6078 | UM_MAXIMIZE,
|
---|
| 6079 | MPVOID,
|
---|
| 6080 | MPVOID);
|
---|
| 6081 | fRunning = TRUE;
|
---|
| 6082 | return 0;
|
---|
| 6083 | }
|
---|
| 6084 |
|
---|
| 6085 | return WinDefWindowProc(hwnd,msg,mp1,mp2);
|
---|
| 6086 | }
|
---|
| 6087 |
|
---|
| 6088 |
|
---|
| 6089 | MRESULT EXPENTRY MainWndProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
| 6090 |
|
---|
| 6091 | switch(msg) {
|
---|
| 6092 | case WM_CREATE:
|
---|
| 6093 | case UM_SETUP:
|
---|
| 6094 | case UM_SETUP2:
|
---|
| 6095 | case UM_SETUP3:
|
---|
| 6096 | case UM_SETUP4:
|
---|
| 6097 | case UM_SETUP5:
|
---|
| 6098 | return MainWMOnce(hwnd,msg,mp1,mp2);
|
---|
| 6099 |
|
---|
| 6100 | case WM_CONTROLPOINTER:
|
---|
| 6101 | if(!fNoFinger &&
|
---|
| 6102 | (SHORT1FROMMP(mp1) == IDM_OPENWALK ||
|
---|
| 6103 | SHORT1FROMMP(mp1) == IDM_USERLIST))
|
---|
| 6104 | return MRFROMLONG(hptrFinger);
|
---|
| 6105 | break;
|
---|
| 6106 |
|
---|
| 6107 | case UM_LOADFILE:
|
---|
| 6108 | case UM_THREADUSE:
|
---|
| 6109 | case UM_BUILDDRIVES:
|
---|
| 6110 | return CommonMainWndProc(hwnd,msg,mp1,mp2);
|
---|
| 6111 |
|
---|
| 6112 | case WM_BUTTON1UP:
|
---|
| 6113 | case WM_BUTTON2UP:
|
---|
| 6114 | case WM_BUTTON3UP:
|
---|
| 6115 | case WM_MOUSEMOVE:
|
---|
| 6116 | shiftstate = (SHORT2FROMMP(mp2) & (KC_ALT | KC_SHIFT | KC_CTRL));
|
---|
| 6117 | break;
|
---|
| 6118 |
|
---|
| 6119 | case WM_CHAR:
|
---|
| 6120 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
| 6121 | break;
|
---|
| 6122 |
|
---|
| 6123 | case WM_MENUEND:
|
---|
| 6124 | if((HWND)mp2 == MainPopupMenu) {
|
---|
| 6125 | WinDestroyWindow(MainPopupMenu);
|
---|
| 6126 | MainPopupMenu = (HWND)0;
|
---|
| 6127 | }
|
---|
| 6128 | break;
|
---|
| 6129 |
|
---|
| 6130 | case UM_CONTEXTMENU:
|
---|
| 6131 | case WM_CONTEXTMENU:
|
---|
| 6132 | if(CheckMenu(&MainPopupMenu,MAIN_POPUP)) {
|
---|
| 6133 | SetToggleChecks(MainPopupMenu);
|
---|
| 6134 | PopupMenu(hwnd,hwnd,MainPopupMenu);
|
---|
| 6135 | }
|
---|
| 6136 | if(msg == UM_CONTEXTMENU)
|
---|
| 6137 | return 0;
|
---|
| 6138 | return MRFROMSHORT(TRUE);
|
---|
| 6139 |
|
---|
| 6140 | case UM_SETUSERLISTNAME:
|
---|
| 6141 | if(mp1) {
|
---|
| 6142 | if(fUserComboBox)
|
---|
| 6143 | WinSetWindowText(WinWindowFromID(hwndUserlist,CBID_EDIT),
|
---|
| 6144 | (CHAR *)mp1);
|
---|
| 6145 | if(add_udir(FALSE,(CHAR *)mp1)) {
|
---|
| 6146 | if(fUserComboBox) {
|
---|
| 6147 | if(fAutoAddDirs)
|
---|
| 6148 | WinSendMsg(hwndUserlist,LM_INSERTITEM,
|
---|
| 6149 | MPFROM2SHORT(LIT_SORTASCENDING,0),
|
---|
| 6150 | MPFROMP((CHAR *)mp1));
|
---|
| 6151 | }
|
---|
| 6152 | }
|
---|
| 6153 | }
|
---|
| 6154 | return 0;
|
---|
| 6155 |
|
---|
| 6156 | case UM_ARRANGEICONS:
|
---|
| 6157 | ArrangeIcons(hwnd);
|
---|
| 6158 | return 0;
|
---|
| 6159 |
|
---|
| 6160 | case WM_CHORD:
|
---|
| 6161 | PostMsg(hwnd,
|
---|
| 6162 | WM_COMMAND,
|
---|
| 6163 | MPFROM2SHORT(IDM_WINDOWDLG,0),
|
---|
| 6164 | MPVOID);
|
---|
| 6165 | break;
|
---|
| 6166 |
|
---|
| 6167 | case WM_SETFOCUS:
|
---|
| 6168 | if(mp2)
|
---|
| 6169 | PostMsg(hwnd,
|
---|
| 6170 | UM_FOCUSME,
|
---|
| 6171 | MPVOID,
|
---|
| 6172 | MPVOID);
|
---|
| 6173 | break;
|
---|
| 6174 |
|
---|
| 6175 | case UM_FOCUSME:
|
---|
| 6176 | WinSetFocus(hwndTree,
|
---|
| 6177 | TRUE);
|
---|
| 6178 | return 0;
|
---|
| 6179 |
|
---|
| 6180 | case UM_RESCAN:
|
---|
| 6181 | TileChildren(hwnd,TRUE);
|
---|
| 6182 | return 0;
|
---|
| 6183 |
|
---|
| 6184 | case WM_SAVEAPPLICATION:
|
---|
| 6185 | {
|
---|
| 6186 | SWP swp;
|
---|
| 6187 |
|
---|
| 6188 | WinQueryWindowPos(WinQueryWindow(hwnd,QW_PARENT),&swp);
|
---|
| 6189 | if(!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) {
|
---|
| 6190 | WinStoreWindowPos(FM2Str,
|
---|
| 6191 | "MainWindowPos",
|
---|
| 6192 | WinQueryWindow(hwnd,QW_PARENT));
|
---|
| 6193 | if(!fNoSaveState && fSaveState)
|
---|
| 6194 | SaveDirCnrState(hwnd,NULL);
|
---|
| 6195 | }
|
---|
| 6196 | }
|
---|
| 6197 | break;
|
---|
| 6198 |
|
---|
| 6199 | case MM_PORTHOLEINIT:
|
---|
| 6200 | switch(SHORT1FROMMP(mp1)) {
|
---|
| 6201 | case 0:
|
---|
| 6202 | case 1:
|
---|
| 6203 | {
|
---|
| 6204 | HWND hwndCurrent;
|
---|
| 6205 | ULONG wmsg;
|
---|
| 6206 |
|
---|
| 6207 | wmsg = (SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU;
|
---|
| 6208 | hwndCurrent = TopWindow(hwnd,(HWND)0);
|
---|
| 6209 | PortholeInit((HWND)WinSendMsg(WinWindowFromID(hwndCurrent,
|
---|
| 6210 | FID_CLIENT),wmsg,MPVOID,
|
---|
| 6211 | MPVOID),mp1,mp2);
|
---|
| 6212 | }
|
---|
| 6213 | break;
|
---|
| 6214 | }
|
---|
| 6215 | break;
|
---|
| 6216 |
|
---|
| 6217 | case WM_INITMENU:
|
---|
| 6218 | switch(SHORT1FROMMP(mp1)) {
|
---|
| 6219 | case IDM_CONFIGMENU:
|
---|
| 6220 | SetToggleChecks((HWND)WinQueryWindowULong(hwnd,0));
|
---|
| 6221 | break;
|
---|
| 6222 |
|
---|
| 6223 | case IDM_WINDOWSMENU:
|
---|
| 6224 | /*
|
---|
| 6225 | * add child windows of client
|
---|
| 6226 | * and switchlist entries to end of pulldown menu
|
---|
| 6227 | */
|
---|
| 6228 | {
|
---|
| 6229 | HWND hwndMenu,hwndSubMenu;
|
---|
| 6230 | MENUITEM mi;
|
---|
| 6231 |
|
---|
| 6232 | hwndMenu = WinQueryWindowULong(hwnd,0);
|
---|
| 6233 | memset(&mi,0,sizeof(mi));
|
---|
| 6234 | mi.iPosition = MIT_END;
|
---|
| 6235 | mi.afStyle = MIS_TEXT;
|
---|
| 6236 | if(!WinSendMsg(hwndMenu,MM_QUERYITEM,
|
---|
| 6237 | MPFROM2SHORT(IDM_WINDOWSMENU,TRUE),
|
---|
| 6238 | MPFROMP(&mi)))
|
---|
| 6239 | break;
|
---|
| 6240 | hwndSubMenu = mi.hwndSubMenu;
|
---|
| 6241 | SetupWinList(hwndSubMenu,
|
---|
| 6242 | hwnd,
|
---|
| 6243 | WinQueryWindow(hwnd,QW_PARENT));
|
---|
| 6244 | }
|
---|
| 6245 | break;
|
---|
| 6246 |
|
---|
| 6247 | default:
|
---|
| 6248 | {
|
---|
| 6249 | HWND hwndCurrent;
|
---|
| 6250 |
|
---|
| 6251 | hwndCurrent = TopWindow(hwnd,(HWND)0);
|
---|
| 6252 | if(hwndCurrent)
|
---|
| 6253 | WinSendMsg(hwndCurrent,UM_INITMENU,mp1,mp2);
|
---|
| 6254 | }
|
---|
| 6255 | break;
|
---|
| 6256 | }
|
---|
| 6257 | break;
|
---|
| 6258 |
|
---|
| 6259 | case UM_ADDTOMENU:
|
---|
| 6260 | AddToMenu((CHAR *)mp1,WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 6261 | FID_MENU));
|
---|
| 6262 | return 0;
|
---|
| 6263 |
|
---|
| 6264 | case UM_FILLCMDLIST:
|
---|
| 6265 | WinSendMsg(hwndCmdlist,LM_DELETEALL,MPVOID,MPVOID);
|
---|
| 6266 | if(!cmdloaded)
|
---|
| 6267 | load_commands();
|
---|
| 6268 | if(cmdhead) {
|
---|
| 6269 |
|
---|
| 6270 | LINKCMDS *info;
|
---|
| 6271 |
|
---|
| 6272 | info = cmdhead;
|
---|
| 6273 | while(info) {
|
---|
| 6274 | WinSendMsg(hwndCmdlist,LM_INSERTITEM,
|
---|
| 6275 | MPFROM2SHORT(LIT_END,0),
|
---|
| 6276 | MPFROMP(info->title));
|
---|
| 6277 | info = info->next;
|
---|
| 6278 | }
|
---|
| 6279 | }
|
---|
| 6280 | return 0;
|
---|
| 6281 |
|
---|
| 6282 | case UM_FILLSETUPLIST:
|
---|
| 6283 | WinSendMsg(hwndStatelist,LM_DELETEALL,MPVOID,MPVOID);
|
---|
| 6284 | if(fUserComboBox) {
|
---|
| 6285 |
|
---|
| 6286 | INT x;
|
---|
| 6287 |
|
---|
| 6288 | if(!loadedsetups)
|
---|
| 6289 | load_setups();
|
---|
| 6290 | for(x = 0;x < MAXNUMSETUPS;x++) {
|
---|
| 6291 | if(*lastsetups[x])
|
---|
| 6292 | WinSendMsg(hwndStatelist,LM_INSERTITEM,
|
---|
| 6293 | MPFROM2SHORT(LIT_SORTASCENDING,0),
|
---|
| 6294 | MPFROMP(lastsetups[x]));
|
---|
| 6295 | }
|
---|
| 6296 | WinSetWindowText(hwndStatelist,GetPString(IDS_STATETEXT));
|
---|
| 6297 | }
|
---|
| 6298 | return 0;
|
---|
| 6299 |
|
---|
| 6300 | case UM_FILLBUTTONLIST:
|
---|
| 6301 | WinSendMsg(hwndButtonlist,LM_DELETEALL,MPVOID,MPVOID);
|
---|
| 6302 | if(fUserComboBox) {
|
---|
| 6303 |
|
---|
| 6304 | BOOL foundit = FALSE,thisone;
|
---|
| 6305 | ULONG ulSearchCount;
|
---|
| 6306 | SHORT sSelect;
|
---|
| 6307 | FILEFINDBUF3 findbuf;
|
---|
| 6308 | HDIR hDir;
|
---|
| 6309 | CHAR *p;
|
---|
| 6310 |
|
---|
| 6311 | DosError(FERR_DISABLEHARDERR);
|
---|
| 6312 | hDir = HDIR_CREATE;
|
---|
| 6313 | ulSearchCount = 1L;
|
---|
| 6314 | if(!DosFindFirst("*.TLS",&hDir,FILE_READONLY | FILE_ARCHIVED,
|
---|
| 6315 | &findbuf,sizeof(FILEFINDBUF3),
|
---|
| 6316 | &ulSearchCount, FIL_STANDARD)) {
|
---|
| 6317 | do {
|
---|
| 6318 | priority_bumped();
|
---|
| 6319 | if(!foundit) {
|
---|
| 6320 | thisone = FALSE;
|
---|
| 6321 | p = strrchr(lasttoolbox,'\\');
|
---|
| 6322 | if(!p)
|
---|
| 6323 | p = lasttoolbox;
|
---|
| 6324 | else
|
---|
| 6325 | p++;
|
---|
| 6326 | if(!stricmp(findbuf.achName,p))
|
---|
| 6327 | thisone = TRUE;
|
---|
| 6328 | }
|
---|
| 6329 | p = strrchr(findbuf.achName,'.');
|
---|
| 6330 | if(p)
|
---|
| 6331 | *p = 0;
|
---|
| 6332 | sSelect = (SHORT)WinSendMsg(hwndButtonlist,LM_INSERTITEM,
|
---|
| 6333 | MPFROM2SHORT(LIT_SORTASCENDING,0),
|
---|
| 6334 | MPFROMP(findbuf.achName));
|
---|
| 6335 | if(!foundit && thisone && sSelect >= 0) {
|
---|
| 6336 | WinSendMsg(hwndButtonlist,LM_SELECTITEM,MPFROM2SHORT(sSelect,0),
|
---|
| 6337 | MPFROMLONG(TRUE));
|
---|
| 6338 | foundit = TRUE;
|
---|
| 6339 | }
|
---|
| 6340 | } while(!DosFindNext(hDir,&findbuf,sizeof(FILEFINDBUF3),
|
---|
| 6341 | &ulSearchCount));
|
---|
| 6342 | DosFindClose(hDir);
|
---|
| 6343 | priority_bumped();
|
---|
| 6344 | }
|
---|
| 6345 | WinSetWindowText(hwndButtonlist,GetPString(IDS_TOOLBOXTEXT));
|
---|
| 6346 | }
|
---|
| 6347 | return 0;
|
---|
| 6348 |
|
---|
| 6349 | case UM_FILLUSERLIST:
|
---|
| 6350 | WinSendMsg(hwndUserlist,LM_DELETEALL,MPVOID,MPVOID);
|
---|
| 6351 | if(fUserComboBox) {
|
---|
| 6352 |
|
---|
| 6353 | ULONG ulDriveNum,ulDriveMap;
|
---|
| 6354 | ULONG ulSearchCount;
|
---|
| 6355 | FILEFINDBUF3 findbuf;
|
---|
| 6356 | HDIR hDir;
|
---|
| 6357 | APIRET rc;
|
---|
| 6358 | LINKDIRS *info,*temp;
|
---|
| 6359 |
|
---|
| 6360 | if(!loadedudirs)
|
---|
| 6361 | load_udirs();
|
---|
| 6362 | DosError(FERR_DISABLEHARDERR);
|
---|
| 6363 | DosQCurDisk(&ulDriveNum,&ulDriveMap);
|
---|
| 6364 | info = udirhead;
|
---|
| 6365 | while(info) {
|
---|
| 6366 | if(IsFullName(info->path) &&
|
---|
| 6367 | !(driveflags[toupper(*info->path) - 'A'] &
|
---|
| 6368 | (DRIVE_IGNORE | DRIVE_INVALID))) {
|
---|
| 6369 | DosError(FERR_DISABLEHARDERR);
|
---|
| 6370 | hDir = HDIR_CREATE;
|
---|
| 6371 | ulSearchCount = 1L;
|
---|
| 6372 | if(!IsRoot(info->path))
|
---|
| 6373 | rc = DosFindFirst(info->path,&hDir,FILE_DIRECTORY |
|
---|
| 6374 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
---|
| 6375 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
---|
| 6376 | &findbuf,sizeof(FILEFINDBUF3),
|
---|
| 6377 | &ulSearchCount, FIL_STANDARD);
|
---|
| 6378 | else {
|
---|
| 6379 | rc = 0;
|
---|
| 6380 | findbuf.attrFile = FILE_DIRECTORY;
|
---|
| 6381 | }
|
---|
| 6382 | priority_bumped();
|
---|
| 6383 | if(!rc) {
|
---|
| 6384 | if(!IsRoot(info->path))
|
---|
| 6385 | DosFindClose(hDir);
|
---|
| 6386 | if(findbuf.attrFile & FILE_DIRECTORY)
|
---|
| 6387 | WinSendMsg(hwndUserlist,LM_INSERTITEM,
|
---|
| 6388 | MPFROM2SHORT(LIT_SORTASCENDING,0),
|
---|
| 6389 | MPFROMP(info->path));
|
---|
| 6390 | else {
|
---|
| 6391 | temp = info->next;
|
---|
| 6392 | remove_udir(info->path);
|
---|
| 6393 | info = temp;
|
---|
| 6394 | continue;
|
---|
| 6395 | }
|
---|
| 6396 | }
|
---|
| 6397 | else if(!(ulDriveMap & (1L << (toupper(*info->path) - 'A')))) {
|
---|
| 6398 | temp = info->next;
|
---|
| 6399 | remove_udir(info->path);
|
---|
| 6400 | info = temp;
|
---|
| 6401 | continue;
|
---|
| 6402 | }
|
---|
| 6403 | }
|
---|
| 6404 | info = info->next;
|
---|
| 6405 | }
|
---|
| 6406 | info = ldirhead;
|
---|
| 6407 | while(info) {
|
---|
| 6408 | if(IsFullName(info->path) &&
|
---|
| 6409 | !(driveflags[toupper(*info->path) - 'A'] &
|
---|
| 6410 | (DRIVE_IGNORE | DRIVE_INVALID))) {
|
---|
| 6411 | DosError(FERR_DISABLEHARDERR);
|
---|
| 6412 | hDir = HDIR_CREATE;
|
---|
| 6413 | ulSearchCount = 1L;
|
---|
| 6414 | if(!IsRoot(info->path))
|
---|
| 6415 | rc = DosFindFirst(info->path,&hDir,FILE_DIRECTORY |
|
---|
| 6416 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
---|
| 6417 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
---|
| 6418 | &findbuf,sizeof(FILEFINDBUF3),
|
---|
| 6419 | &ulSearchCount, FIL_STANDARD);
|
---|
| 6420 | else {
|
---|
| 6421 | rc = 0;
|
---|
| 6422 | findbuf.attrFile = FILE_DIRECTORY;
|
---|
| 6423 | }
|
---|
| 6424 | priority_bumped();
|
---|
| 6425 | if(!rc) {
|
---|
| 6426 | if(!IsRoot(info->path))
|
---|
| 6427 | DosFindClose(hDir);
|
---|
| 6428 | if(findbuf.attrFile & FILE_DIRECTORY)
|
---|
| 6429 | WinSendMsg(hwndUserlist,LM_INSERTITEM,
|
---|
| 6430 | MPFROM2SHORT(LIT_SORTASCENDING,0),
|
---|
| 6431 | MPFROMP(info->path));
|
---|
| 6432 | else {
|
---|
| 6433 | temp = info->next;
|
---|
| 6434 | remove_udir(info->path);
|
---|
| 6435 | info = temp;
|
---|
| 6436 | continue;
|
---|
| 6437 | }
|
---|
| 6438 | }
|
---|
| 6439 | else if(!(ulDriveMap & (1L << (toupper(*info->path) - 'A')))) {
|
---|
| 6440 | temp = info->next;
|
---|
| 6441 | remove_udir(info->path);
|
---|
| 6442 | info = temp;
|
---|
| 6443 | continue;
|
---|
| 6444 | }
|
---|
| 6445 | }
|
---|
| 6446 | info = info->next;
|
---|
| 6447 | }
|
---|
| 6448 | WinSendMsg(hwndUserlist,LM_INSERTITEM,
|
---|
| 6449 | MPFROM2SHORT(0,0),
|
---|
| 6450 | MPFROMP(GetPString(IDS_NEWDIRECTORYTEXT)));
|
---|
| 6451 | WinSetWindowText(hwndUserlist,GetPString(IDS_COMMONDIRTEXT));
|
---|
| 6452 | }
|
---|
| 6453 | return 0;
|
---|
| 6454 |
|
---|
| 6455 | case UM_SIZE:
|
---|
| 6456 | if(fAutoTile)
|
---|
| 6457 | TileChildren(hwnd,FALSE);
|
---|
| 6458 | else
|
---|
| 6459 | MoveChildrenAwayFromTree(hwnd);
|
---|
| 6460 | return 0;
|
---|
| 6461 |
|
---|
| 6462 | case WM_SIZE:
|
---|
| 6463 | ResizeChildren(hwnd,SHORT1FROMMP(mp1),SHORT2FROMMP(mp1),
|
---|
| 6464 | SHORT1FROMMP(mp2),SHORT2FROMMP(mp2));
|
---|
| 6465 | break;
|
---|
| 6466 |
|
---|
| 6467 | case WM_ERASEBACKGROUND:
|
---|
| 6468 | WinFillRect((HPS)mp1,(PRECTL)mp2,0x00d0d0d0);
|
---|
| 6469 | return 0;
|
---|
| 6470 |
|
---|
| 6471 | case WM_PAINT:
|
---|
| 6472 | {
|
---|
| 6473 | HPS hps;
|
---|
| 6474 | RECTL rcl;
|
---|
| 6475 |
|
---|
| 6476 | hps = WinBeginPaint(hwnd,(HPS)0,NULL);
|
---|
| 6477 | if(hps) {
|
---|
| 6478 | WinQueryWindowRect(hwnd,&rcl);
|
---|
| 6479 | WinFillRect(hps,&rcl,CLR_PALEGRAY);
|
---|
| 6480 | WinEndPaint(hps);
|
---|
| 6481 | }
|
---|
| 6482 | }
|
---|
| 6483 | break;
|
---|
| 6484 |
|
---|
| 6485 | case UM_CONTROL:
|
---|
| 6486 | switch(SHORT1FROMMP(mp1)) {
|
---|
| 6487 | case MAIN_CMDLIST:
|
---|
| 6488 | case MAIN_SETUPLIST:
|
---|
| 6489 | case MAIN_DRIVELIST:
|
---|
| 6490 | case MAIN_USERLIST:
|
---|
| 6491 | case MAIN_BUTTONLIST:
|
---|
| 6492 | switch(SHORT2FROMMP(mp1)) {
|
---|
| 6493 | case CBN_ENTER:
|
---|
| 6494 | {
|
---|
| 6495 | HWND hwndUL = WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 6496 | SHORT1FROMMP(mp1));
|
---|
| 6497 | CHAR path[CCHMAXPATH];
|
---|
| 6498 |
|
---|
| 6499 | SetShiftState();
|
---|
| 6500 | WinQueryWindowText(WinWindowFromID(hwndUL,CBID_EDIT),
|
---|
| 6501 | ((SHORT1FROMMP(mp1) == MAIN_USERLIST) ?
|
---|
| 6502 | CCHMAXPATH : 13),path);
|
---|
| 6503 | lstrip(rstrip(path));
|
---|
| 6504 | if(*path) {
|
---|
| 6505 | if(SHORT1FROMMP(mp1) == MAIN_USERLIST) {
|
---|
| 6506 | if(!strcmp(path,GetPString(IDS_NEWDIRECTORYTEXT))) {
|
---|
| 6507 | if(!LastDir ||
|
---|
| 6508 | !WinSendMsg(WinQueryWindow(LastDir,QW_PARENT),
|
---|
| 6509 | UM_CONTAINERDIR,
|
---|
| 6510 | MPFROMP(path),
|
---|
| 6511 | MPVOID))
|
---|
| 6512 | save_dir2(path);
|
---|
| 6513 | if(!PMMkDir(hwnd,
|
---|
| 6514 | path,
|
---|
| 6515 | TRUE)) {
|
---|
| 6516 | WinSetWindowText(hwndUL,
|
---|
| 6517 | GetPString(IDS_COMMONDIRTEXT));
|
---|
| 6518 | break;
|
---|
| 6519 | }
|
---|
| 6520 | }
|
---|
| 6521 | if(!IsFile(path) &&
|
---|
| 6522 | !FindDirCnrByName(path,TRUE)) {
|
---|
| 6523 |
|
---|
| 6524 | HWND hwndDir;
|
---|
| 6525 |
|
---|
| 6526 | if((fUserListSwitches &&
|
---|
| 6527 | !(shiftstate & KC_SHIFT)) ||
|
---|
| 6528 | (!fUserListSwitches &&
|
---|
| 6529 | (shiftstate & KC_SHIFT))) {
|
---|
| 6530 | hwndDir = FindDirCnr(hwnd);
|
---|
| 6531 | if(hwndDir) {
|
---|
| 6532 | WinSendMsg(LastDir,
|
---|
| 6533 | UM_SETDIR,
|
---|
| 6534 | MPFROMP(path),
|
---|
| 6535 | MPVOID);
|
---|
| 6536 | break;
|
---|
| 6537 | }
|
---|
| 6538 | }
|
---|
| 6539 | OpenDirCnr((HWND)0,
|
---|
| 6540 | hwndMain,
|
---|
| 6541 | hwndTree,
|
---|
| 6542 | FALSE,
|
---|
| 6543 | path);
|
---|
| 6544 | }
|
---|
| 6545 | }
|
---|
| 6546 | else if(SHORT1FROMMP(mp1) == MAIN_DRIVELIST) {
|
---|
| 6547 | ShowTreeRec(WinWindowFromID(WinWindowFromID(hwndTree,
|
---|
| 6548 | FID_CLIENT),
|
---|
| 6549 | TREE_CNR),
|
---|
| 6550 | path,
|
---|
| 6551 | FALSE,
|
---|
| 6552 | TRUE);
|
---|
| 6553 | WinSetFocus(HWND_DESKTOP,
|
---|
| 6554 | hwndTree);
|
---|
| 6555 | }
|
---|
| 6556 | else if(SHORT1FROMMP(mp1) == MAIN_BUTTONLIST) {
|
---|
| 6557 | strcat(path,".TLS");
|
---|
| 6558 | load_tools(path);
|
---|
| 6559 | PrfWriteProfileString(fmprof,
|
---|
| 6560 | FM3Str,
|
---|
| 6561 | "LastToolBox",
|
---|
| 6562 | lasttoolbox);
|
---|
| 6563 | BuildTools(hwndToolback,
|
---|
| 6564 | TRUE);
|
---|
| 6565 | WinSetWindowText(hwndButtonlist,
|
---|
| 6566 | GetPString(IDS_TOOLBOXTEXT));
|
---|
| 6567 | }
|
---|
| 6568 | else if(SHORT1FROMMP(mp1) == MAIN_SETUPLIST) {
|
---|
| 6569 |
|
---|
| 6570 | CHAR s[120];
|
---|
| 6571 | ULONG size,numsaves = 0;
|
---|
| 6572 |
|
---|
| 6573 | SetShiftState();
|
---|
| 6574 | size = sizeof(ULONG);
|
---|
| 6575 | sprintf(s,
|
---|
| 6576 | "%s.NumDirsLastTime",
|
---|
| 6577 | path);
|
---|
| 6578 | if(PrfQueryProfileData(fmprof,
|
---|
| 6579 | FM3Str,
|
---|
| 6580 | s,
|
---|
| 6581 | (PVOID)&numsaves,
|
---|
| 6582 | &size) &&
|
---|
| 6583 | numsaves) {
|
---|
| 6584 | if((shiftstate & KC_SHIFT) == 0)
|
---|
| 6585 | PostMsg(MainObjectHwnd,
|
---|
| 6586 | UM_RESTORE,
|
---|
| 6587 | MPVOID,
|
---|
| 6588 | MPFROMLONG(2L));
|
---|
| 6589 | {
|
---|
| 6590 | char *temp;
|
---|
| 6591 |
|
---|
| 6592 | temp = strdup(path);
|
---|
| 6593 | if(temp) {
|
---|
| 6594 | if(!PostMsg(MainObjectHwnd,
|
---|
| 6595 | UM_RESTORE,
|
---|
| 6596 | MPFROMP(temp),
|
---|
| 6597 | MPVOID))
|
---|
| 6598 | free(temp);
|
---|
| 6599 | }
|
---|
| 6600 | else {
|
---|
| 6601 | if((shiftstate & KC_SHIFT) != 0 ||
|
---|
| 6602 | fAutoTile)
|
---|
| 6603 | PostMsg(MainObjectHwnd,
|
---|
| 6604 | UM_RESTORE,
|
---|
| 6605 | MPVOID,
|
---|
| 6606 | MPFROMLONG(1L));
|
---|
| 6607 | }
|
---|
| 6608 | }
|
---|
| 6609 | }
|
---|
| 6610 | else
|
---|
| 6611 | DosBeep(50,100);
|
---|
| 6612 | WinSetWindowText(hwndStatelist,
|
---|
| 6613 | GetPString(IDS_STATETEXT));
|
---|
| 6614 | }
|
---|
| 6615 | else if(SHORT1FROMMP(mp1) == MAIN_CMDLIST) {
|
---|
| 6616 |
|
---|
| 6617 | SHORT sSelect;
|
---|
| 6618 |
|
---|
| 6619 | sSelect = (SHORT)WinSendMsg(hwndCmdlist,
|
---|
| 6620 | LM_QUERYSELECTION,
|
---|
| 6621 | MPFROMSHORT(LIT_FIRST),
|
---|
| 6622 | MPVOID);
|
---|
| 6623 | if(sSelect >= 0)
|
---|
| 6624 | WinPostMsg(hwnd,
|
---|
| 6625 | WM_COMMAND,
|
---|
| 6626 | MPFROM2SHORT(IDM_COMMANDSTART + sSelect,0),
|
---|
| 6627 | MPVOID);
|
---|
| 6628 | WinSetWindowText(hwndCmdlist,
|
---|
| 6629 | GetPString(IDS_COMMANDSTEXT));
|
---|
| 6630 | }
|
---|
| 6631 | }
|
---|
| 6632 | }
|
---|
| 6633 | break;
|
---|
| 6634 |
|
---|
| 6635 | default:
|
---|
| 6636 | break;
|
---|
| 6637 | }
|
---|
| 6638 | break;
|
---|
| 6639 |
|
---|
| 6640 | default:
|
---|
| 6641 | break;
|
---|
| 6642 | }
|
---|
| 6643 | return 0;
|
---|
| 6644 |
|
---|
| 6645 | case WM_HELP:
|
---|
| 6646 | WinSendMsg(hwndHelp,
|
---|
| 6647 | HM_HELP_CONTENTS,
|
---|
| 6648 | MPVOID,
|
---|
| 6649 | MPVOID);
|
---|
| 6650 | break;
|
---|
| 6651 |
|
---|
| 6652 | case UM_COMMAND:
|
---|
| 6653 | case WM_COMMAND:
|
---|
| 6654 |
|
---|
| 6655 | return MainWMCommand(hwnd,msg,mp1,mp2);
|
---|
| 6656 |
|
---|
| 6657 | case WM_CLOSE:
|
---|
| 6658 | WinSendMsg(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 6659 | WM_SYSCOMMAND,
|
---|
| 6660 | MPFROM2SHORT(SC_RESTORE,0),
|
---|
| 6661 | MPVOID);
|
---|
| 6662 | WinSendMsg(hwnd,
|
---|
| 6663 | WM_SAVEAPPLICATION,
|
---|
| 6664 | MPVOID,
|
---|
| 6665 | MPVOID);
|
---|
| 6666 | fAmClosing = TRUE;
|
---|
| 6667 | WinSendMsg(WinQueryWindow(hwnd,QW_PARENT),
|
---|
| 6668 | WM_SYSCOMMAND,
|
---|
| 6669 | MPFROM2SHORT(SC_MINIMIZE,0),
|
---|
| 6670 | MPVOID);
|
---|
| 6671 | if(CloseChildren(hwnd)) {
|
---|
| 6672 | fAmClosing = FALSE;
|
---|
| 6673 | if(fAutoTile)
|
---|
| 6674 | PostMsg(hwnd,
|
---|
| 6675 | WM_COMMAND,
|
---|
| 6676 | MPFROM2SHORT(IDM_TILE,0),
|
---|
| 6677 | MPVOID);
|
---|
| 6678 | return 0;
|
---|
| 6679 | }
|
---|
| 6680 | if(hwndTree) {
|
---|
| 6681 | if(!PostMsg(hwndTree,
|
---|
| 6682 | WM_CLOSE,
|
---|
| 6683 | MPVOID,
|
---|
| 6684 | MPVOID))
|
---|
| 6685 | WinSendMsg(hwndTree,
|
---|
| 6686 | WM_CLOSE,
|
---|
| 6687 | MPVOID,
|
---|
| 6688 | MPVOID);
|
---|
| 6689 | }
|
---|
| 6690 | DosSleep(1L);
|
---|
| 6691 | return 0;
|
---|
| 6692 |
|
---|
| 6693 | case UM_CLOSE:
|
---|
| 6694 | HideNote();
|
---|
| 6695 | WinDestroyWindow(WinQueryWindow(hwnd,QW_PARENT));
|
---|
| 6696 | return 0;
|
---|
| 6697 |
|
---|
| 6698 | case UM_RESTORE:
|
---|
| 6699 | {
|
---|
| 6700 | char *temp;
|
---|
| 6701 |
|
---|
| 6702 | temp = strdup(GetPString(IDS_FM2TEMPTEXT));
|
---|
| 6703 | if(temp) {
|
---|
| 6704 | if(!PostMsg(MainObjectHwnd,
|
---|
| 6705 | UM_RESTORE,
|
---|
| 6706 | MPFROMP(temp),
|
---|
| 6707 | MPVOID))
|
---|
| 6708 | free(temp);
|
---|
| 6709 | }
|
---|
| 6710 | }
|
---|
| 6711 | return 0;
|
---|
| 6712 |
|
---|
| 6713 | case UM_SETDIR:
|
---|
| 6714 | if(mp1) /* mp1 == name of directory to open */
|
---|
| 6715 | return MRFROMLONG(OpenDirCnr((HWND)0,
|
---|
| 6716 | hwndMain,
|
---|
| 6717 | hwndTree,
|
---|
| 6718 | (BOOL)mp2,
|
---|
| 6719 | (char *)mp1));
|
---|
| 6720 | return 0;
|
---|
| 6721 |
|
---|
| 6722 | case WM_DESTROY:
|
---|
| 6723 | hwndMain = (HWND)0;
|
---|
| 6724 | if(!PostMsg((HWND)0,
|
---|
| 6725 | WM_QUIT,
|
---|
| 6726 | MPVOID,
|
---|
| 6727 | MPVOID))
|
---|
| 6728 | WinSendMsg((HWND)0,
|
---|
| 6729 | WM_QUIT,
|
---|
| 6730 | MPVOID,
|
---|
| 6731 | MPVOID);
|
---|
| 6732 | break;
|
---|
| 6733 | }
|
---|
| 6734 |
|
---|
| 6735 | return WinDefWindowProc(hwnd,msg,mp1,mp2);
|
---|
| 6736 | }
|
---|
| 6737 |
|
---|