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