1 | #define INCL_DOS
|
---|
2 | #define INCL_WIN
|
---|
3 | #define INCL_GPI
|
---|
4 |
|
---|
5 | #include <os2.h>
|
---|
6 | #include <stdarg.h>
|
---|
7 | #include <stdio.h>
|
---|
8 | #include <stdlib.h>
|
---|
9 | #include <string.h>
|
---|
10 | #include <ctype.h>
|
---|
11 | #include <share.h>
|
---|
12 | #include "fm3dll.h"
|
---|
13 | #include "fm3dlg.h"
|
---|
14 | #include "fm3str.h"
|
---|
15 | #include "version.h"
|
---|
16 |
|
---|
17 | #pragma data_seg(DATA1)
|
---|
18 | #pragma alloc_text(ONCE,SetSysMenu)
|
---|
19 | #pragma alloc_text(MISC1,BoxWindow,PaintRecessedWindow,PostMsg,PaintSTextWindow)
|
---|
20 | #pragma alloc_text(MISC1,FixSwitchList,FindDirCnr,CurrentRecord,SetShiftState,AddToListboxBottom)
|
---|
21 | #pragma alloc_text(CNR_MISC1,AdjustCnrColVis,AdjustCnrColsForFSType)
|
---|
22 | #pragma alloc_text(CNR_MISC1,AdjustCnrColsForPref,SetCnrCols)
|
---|
23 | #pragma alloc_text(CNR_MISC2,CnrDirectEdit,EmptyCnr,OpenEdit)
|
---|
24 | #pragma alloc_text(MISC2,SetMenuCheck,disable_menuitem,SetSortChecks)
|
---|
25 | #pragma alloc_text(MISC2,SetDetailsSwitches,SetViewMenu)
|
---|
26 | #pragma alloc_text(MISC3,SetupCommandMenu,AdjustDetailsSwitches)
|
---|
27 | #pragma alloc_text(MISC3,ViewHelp,GetCmdSpec)
|
---|
28 | #pragma alloc_text(MISC3,ExecFile,SetConditionalCascade,LoadDetailsSwitches)
|
---|
29 | #pragma alloc_text(MISC3,FreeMallocedMem,FcloseFile)
|
---|
30 | #pragma alloc_text(MISC4,PortholeInit,CheckMenu,Broadcast,SetupWinList,SwitchCommand)
|
---|
31 | #pragma alloc_text(MISC6,DrawTargetEmphasis,EmphasizeButton)
|
---|
32 | #pragma alloc_text(MISC_LIBPATH,LoadLibPath)
|
---|
33 | #pragma alloc_text(MISC_SAY,SayView,SaySort,SayFilter)
|
---|
34 |
|
---|
35 | #ifndef BEGIN_LIBPATH
|
---|
36 | #define BEGIN_LIBPATH 1
|
---|
37 | #endif
|
---|
38 | #ifndef END_LIBPATH
|
---|
39 | #define END_LIBPATH 2
|
---|
40 | #endif
|
---|
41 | #ifndef ORD_DOS32QUERYEXTLIBPATH
|
---|
42 | #define ORD_DOS32QUERYEXTLIBPATH 874
|
---|
43 | #endif
|
---|
44 |
|
---|
45 |
|
---|
46 | VOID SetShiftState (VOID) {
|
---|
47 |
|
---|
48 | shiftstate = 0;
|
---|
49 | if(WinGetKeyState(HWND_DESKTOP, VK_CTRL) & 0x8000)
|
---|
50 | shiftstate |= KC_CTRL;
|
---|
51 | if(WinGetKeyState(HWND_DESKTOP, VK_SHIFT) & 0x8000)
|
---|
52 | shiftstate |= KC_SHIFT;
|
---|
53 | if(WinGetKeyState(HWND_DESKTOP, VK_ALT) & 0x8000)
|
---|
54 | shiftstate |= KC_ALT;
|
---|
55 | }
|
---|
56 |
|
---|
57 |
|
---|
58 | void EmphasizeButton (HWND hwnd,BOOL on) {
|
---|
59 |
|
---|
60 | HPS hps;
|
---|
61 |
|
---|
62 | hps = DrgGetPS(hwnd);
|
---|
63 | if(hps) {
|
---|
64 |
|
---|
65 | POINTL ptl;
|
---|
66 | SWP swp;
|
---|
67 |
|
---|
68 | WinQueryWindowPos(hwnd,&swp);
|
---|
69 | ptl.x = 1;
|
---|
70 | ptl.y = 1;
|
---|
71 | GpiMove(hps,&ptl);
|
---|
72 | GpiSetColor(hps,((on) ? CLR_BLACK : CLR_PALEGRAY));
|
---|
73 | ptl.x = swp.cx - 2;
|
---|
74 | ptl.y = swp.cy - 2;
|
---|
75 | GpiBox(hps,DRO_OUTLINE,&ptl,0,0);
|
---|
76 | DrgReleasePS(hps);
|
---|
77 | if(remove)
|
---|
78 | WinInvalidateRect(hwnd,NULL,FALSE);
|
---|
79 | }
|
---|
80 | }
|
---|
81 |
|
---|
82 |
|
---|
83 | void DrawTargetEmphasis (HWND hwnd,BOOL on) {
|
---|
84 |
|
---|
85 | HPS hps;
|
---|
86 |
|
---|
87 | hps = DrgGetPS(WinQueryWindow(hwnd,QW_PARENT));
|
---|
88 | if(hps) {
|
---|
89 | BoxWindow(hwnd,hps,((on) ? CLR_BLACK : CLR_PALEGRAY));
|
---|
90 | DrgReleasePS(hps);
|
---|
91 | }
|
---|
92 | }
|
---|
93 |
|
---|
94 |
|
---|
95 | void BoxWindow (HWND hwnd,HPS hps,LONG color) {
|
---|
96 |
|
---|
97 | POINTL ptl;
|
---|
98 | SWP swp;
|
---|
99 | BOOL releaseme = FALSE;
|
---|
100 |
|
---|
101 | if(!hps) {
|
---|
102 | hps = WinGetPS(WinQueryWindow(hwnd,QW_PARENT));
|
---|
103 | releaseme = TRUE;
|
---|
104 | }
|
---|
105 | if(hps && WinQueryWindowPos(hwnd,&swp)) {
|
---|
106 | ptl.x = swp.x - 2;
|
---|
107 | ptl.y = swp.y - 2;
|
---|
108 | GpiMove(hps,&ptl);
|
---|
109 | GpiSetColor(hps,color);
|
---|
110 | ptl.x = swp.x + swp.cx + 1;
|
---|
111 | ptl.y = swp.y + swp.cy + 1;
|
---|
112 | GpiBox(hps,DRO_OUTLINE,&ptl,0,0);
|
---|
113 | }
|
---|
114 | if(releaseme && hps)
|
---|
115 | WinReleasePS(hps);
|
---|
116 | }
|
---|
117 |
|
---|
118 |
|
---|
119 | void PaintSTextWindow (HWND hwnd,HPS hps) {
|
---|
120 |
|
---|
121 | /*
|
---|
122 | * paint a text window such that the rightmost part of the text is
|
---|
123 | * always visible even if the text length exceeds the length of the
|
---|
124 | * window -- otherwise, paint the window so that it is left-justified
|
---|
125 | * and vertically centered.
|
---|
126 | */
|
---|
127 |
|
---|
128 | char *s = NULL;
|
---|
129 | long len;
|
---|
130 | POINTL aptl[TXTBOX_COUNT],ptl;
|
---|
131 | RECTL rcl;
|
---|
132 | char *p;
|
---|
133 | BOOL releaseme = FALSE;
|
---|
134 |
|
---|
135 | if(!hps) {
|
---|
136 | releaseme = TRUE;
|
---|
137 | hps = WinGetPS(hwnd);
|
---|
138 | }
|
---|
139 | if(hps) {
|
---|
140 | WinQueryWindowRect(hwnd,&rcl);
|
---|
141 | WinFillRect(hps,
|
---|
142 | &rcl,
|
---|
143 | CLR_PALEGRAY);
|
---|
144 | len = WinQueryWindowTextLength(hwnd);
|
---|
145 | if(len)
|
---|
146 | s = malloc(len + 1);
|
---|
147 | if(s) {
|
---|
148 | *s = 0;
|
---|
149 | WinQueryWindowText(hwnd,CCHMAXPATH,s);
|
---|
150 | if(*s) {
|
---|
151 | rcl.xRight -= 3;
|
---|
152 | p = s;
|
---|
153 | GpiQueryTextBox(hps,
|
---|
154 | 3,
|
---|
155 | "...",
|
---|
156 | TXTBOX_COUNT,
|
---|
157 | aptl);
|
---|
158 | len = aptl[TXTBOX_TOPRIGHT].x;
|
---|
159 | do {
|
---|
160 | GpiQueryTextBox(hps,
|
---|
161 | strlen(p),
|
---|
162 | p,
|
---|
163 | TXTBOX_COUNT,
|
---|
164 | aptl);
|
---|
165 | if(aptl[TXTBOX_TOPRIGHT].x >
|
---|
166 | (rcl.xRight - ((p != s) ? len : 0)))
|
---|
167 | p++;
|
---|
168 | else
|
---|
169 | break;
|
---|
170 | } while(*p);
|
---|
171 | if(*p) {
|
---|
172 | GpiSetMix(hps,FM_OVERPAINT);
|
---|
173 | GpiSetColor(hps,CLR_BLACK);
|
---|
174 | ptl.x = 3;
|
---|
175 | ptl.y = ((rcl.yTop / 2) -
|
---|
176 | ((aptl[TXTBOX_TOPRIGHT].y +
|
---|
177 | aptl[TXTBOX_BOTTOMLEFT].y) / 2));
|
---|
178 | GpiMove(hps,&ptl);
|
---|
179 | if(p != s)
|
---|
180 | GpiCharString(hps,
|
---|
181 | 3,
|
---|
182 | "...");
|
---|
183 | GpiCharString(hps,
|
---|
184 | strlen(p),
|
---|
185 | p);
|
---|
186 | }
|
---|
187 | }
|
---|
188 | free(s);
|
---|
189 | }
|
---|
190 | if(releaseme)
|
---|
191 | WinReleasePS(hps);
|
---|
192 | }
|
---|
193 | }
|
---|
194 |
|
---|
195 |
|
---|
196 | VOID PaintRecessedWindow (HWND hwnd,HPS hps,BOOL outtie, BOOL dbl) {
|
---|
197 |
|
---|
198 | /*
|
---|
199 | * paint a recessed box around the window
|
---|
200 | * two pixels width required around window for painting...
|
---|
201 | */
|
---|
202 | BOOL releaseme = FALSE;
|
---|
203 |
|
---|
204 | if(!hps) {
|
---|
205 | hps = WinGetPS(WinQueryWindow(hwnd,QW_PARENT));
|
---|
206 | releaseme = TRUE;
|
---|
207 | }
|
---|
208 | if(hps) {
|
---|
209 |
|
---|
210 | POINTL ptl;
|
---|
211 | SWP swp;
|
---|
212 |
|
---|
213 | WinQueryWindowPos(hwnd,&swp);
|
---|
214 | ptl.x = swp.x - 1;
|
---|
215 | ptl.y = swp.y - 1;
|
---|
216 | GpiMove(hps,&ptl);
|
---|
217 | if(!outtie)
|
---|
218 | GpiSetColor(hps,CLR_WHITE);
|
---|
219 | else
|
---|
220 | GpiSetColor(hps,CLR_DARKGRAY);
|
---|
221 | ptl.x = swp.x + swp.cx;
|
---|
222 | GpiLine(hps,&ptl);
|
---|
223 | ptl.y = swp.y + swp.cy;
|
---|
224 | GpiLine(hps,&ptl);
|
---|
225 | if(dbl) {
|
---|
226 | ptl.x = swp.x - 2;
|
---|
227 | ptl.y = swp.y - 2;
|
---|
228 | GpiMove(hps,&ptl);
|
---|
229 | ptl.x = swp.x + swp.cx + 1;
|
---|
230 | GpiLine(hps,&ptl);
|
---|
231 | ptl.y = swp.y + swp.cy + 1;
|
---|
232 | GpiLine(hps,&ptl);
|
---|
233 | }
|
---|
234 | if(!outtie)
|
---|
235 | GpiSetColor(hps,CLR_DARKGRAY);
|
---|
236 | else
|
---|
237 | GpiSetColor(hps,CLR_WHITE);
|
---|
238 | if(dbl) {
|
---|
239 | ptl.x = swp.x - 2;
|
---|
240 | GpiLine(hps,&ptl);
|
---|
241 | ptl.y = swp.y - 2;
|
---|
242 | GpiLine(hps,&ptl);
|
---|
243 | ptl.x = swp.x + swp.cx;
|
---|
244 | ptl.y = swp.y + swp.cy;
|
---|
245 | GpiMove(hps,&ptl);
|
---|
246 | }
|
---|
247 | ptl.x = swp.x - 1;
|
---|
248 | GpiLine(hps,&ptl);
|
---|
249 | ptl.y = swp.y - 1;
|
---|
250 | GpiLine(hps,&ptl);
|
---|
251 | GpiSetColor(hps,CLR_PALEGRAY);
|
---|
252 | ptl.x = swp.x - (2 + (dbl != FALSE));
|
---|
253 | ptl.y = swp.y - (2 + (dbl != FALSE));
|
---|
254 | GpiMove(hps,&ptl);
|
---|
255 | ptl.x = swp.x + swp.cx + (1 + (dbl != FALSE));
|
---|
256 | GpiLine(hps,&ptl);
|
---|
257 | ptl.y = swp.y + swp.cy + (1 + (dbl != FALSE));
|
---|
258 | GpiLine(hps,&ptl);
|
---|
259 | ptl.x = swp.x - (2 + (dbl != FALSE));
|
---|
260 | GpiLine(hps,&ptl);
|
---|
261 | ptl.y = swp.y - (2 + (dbl != FALSE));
|
---|
262 | GpiLine(hps,&ptl);
|
---|
263 | if(releaseme)
|
---|
264 | WinReleasePS(hps);
|
---|
265 | }
|
---|
266 | }
|
---|
267 |
|
---|
268 |
|
---|
269 | BOOL AdjustCnrColVis (HWND hwndCnr,CHAR *title,BOOL visible,BOOL toggle) {
|
---|
270 |
|
---|
271 | PFIELDINFO pfi;
|
---|
272 |
|
---|
273 | pfi = (PFIELDINFO)WinSendMsg(hwndCnr,
|
---|
274 | CM_QUERYDETAILFIELDINFO,
|
---|
275 | MPVOID,
|
---|
276 | MPFROMSHORT(CMA_FIRST));
|
---|
277 | while(pfi) {
|
---|
278 | if(!strcmp(pfi->pTitleData,title)) {
|
---|
279 | if(toggle) {
|
---|
280 | if(pfi->flData & CFA_INVISIBLE)
|
---|
281 | pfi->flData &= (~CFA_INVISIBLE);
|
---|
282 | else
|
---|
283 | pfi->flData |= CFA_INVISIBLE;
|
---|
284 | return !(pfi->flData & CFA_INVISIBLE);
|
---|
285 | }
|
---|
286 | else {
|
---|
287 | if(visible)
|
---|
288 | pfi->flData &= (~CFA_INVISIBLE);
|
---|
289 | else
|
---|
290 | pfi->flData |= CFA_INVISIBLE;
|
---|
291 | }
|
---|
292 | return TRUE;
|
---|
293 | }
|
---|
294 | pfi = pfi->pNextFieldInfo;
|
---|
295 | }
|
---|
296 | return FALSE;
|
---|
297 | }
|
---|
298 |
|
---|
299 |
|
---|
300 | BOOL AdjustCnrColRO (HWND hwndCnr,CHAR *title,BOOL readonly,BOOL toggle) {
|
---|
301 |
|
---|
302 | PFIELDINFO pfi;
|
---|
303 |
|
---|
304 | pfi = (PFIELDINFO)WinSendMsg(hwndCnr,
|
---|
305 | CM_QUERYDETAILFIELDINFO,
|
---|
306 | MPVOID,
|
---|
307 | MPFROMSHORT(CMA_FIRST));
|
---|
308 | while(pfi) {
|
---|
309 | if(!strcmp(pfi->pTitleData,title)) {
|
---|
310 | if(toggle) {
|
---|
311 | if(pfi->flData & CFA_FIREADONLY)
|
---|
312 | pfi->flData &= (~CFA_FIREADONLY);
|
---|
313 | else
|
---|
314 | pfi->flData |= CFA_FIREADONLY;
|
---|
315 | return (pfi->flData & CFA_FIREADONLY);
|
---|
316 | }
|
---|
317 | else {
|
---|
318 | if(!readonly)
|
---|
319 | pfi->flData &= (~CFA_FIREADONLY);
|
---|
320 | else
|
---|
321 | pfi->flData |= CFA_FIREADONLY;
|
---|
322 | }
|
---|
323 | return TRUE;
|
---|
324 | }
|
---|
325 | pfi = pfi->pNextFieldInfo;
|
---|
326 | }
|
---|
327 | return FALSE;
|
---|
328 | }
|
---|
329 |
|
---|
330 |
|
---|
331 | VOID AdjustCnrColsForFSType (HWND hwndCnr,CHAR *directory,
|
---|
332 | DIRCNRDATA *dcd) {
|
---|
333 |
|
---|
334 | CHAR FileSystem[CCHMAXPATH];
|
---|
335 | INT x;
|
---|
336 | BOOL showem,showemA,*bool;
|
---|
337 |
|
---|
338 | if(!directory || !*directory)
|
---|
339 | return;
|
---|
340 | x = CheckDrive(toupper(*directory),FileSystem,NULL);
|
---|
341 | if(x != -1) {
|
---|
342 | if(!stricmp(FileSystem,HPFS) || !stricmp(FileSystem,HPFS386)) {
|
---|
343 | showem = TRUE;
|
---|
344 | showemA = TRUE;
|
---|
345 | }
|
---|
346 | else if(!strcmp(FileSystem,CDFS)) {
|
---|
347 | showem = TRUE;
|
---|
348 | showemA = FALSE;
|
---|
349 | }
|
---|
350 | else
|
---|
351 | showem = showemA = FALSE;
|
---|
352 | }
|
---|
353 | else /* assume FAT */
|
---|
354 | showem = showemA = FALSE;
|
---|
355 | bool = (dcd) ? &dcd->detailsladate : &detailsladate;
|
---|
356 | AdjustCnrColVis(hwndCnr,GetPString(IDS_LADATE),
|
---|
357 | (*bool) ? showemA : FALSE,FALSE);
|
---|
358 | bool = (dcd) ? &dcd->detailslatime : &detailslatime;
|
---|
359 | AdjustCnrColVis(hwndCnr,GetPString(IDS_LATIME),
|
---|
360 | (*bool) ? showemA : FALSE,FALSE);
|
---|
361 | bool = (dcd) ? &dcd->detailscrdate : &detailscrdate;
|
---|
362 | AdjustCnrColVis(hwndCnr,GetPString(IDS_CRDATE),
|
---|
363 | (*bool) ? showem : FALSE,FALSE);
|
---|
364 | bool = (dcd) ? &dcd->detailscrtime : &detailscrtime;
|
---|
365 | AdjustCnrColVis(hwndCnr,GetPString(IDS_CRTIME),
|
---|
366 | (*bool) ? showem : FALSE,FALSE);
|
---|
367 | bool = (dcd) ? &dcd->detailslongname : &detailslongname;
|
---|
368 | AdjustCnrColVis(hwndCnr,GetPString(IDS_LNAME),
|
---|
369 | (*bool) ? !showem : FALSE,FALSE);
|
---|
370 | WinSendMsg(hwndCnr,
|
---|
371 | CM_INVALIDATEDETAILFIELDINFO,
|
---|
372 | MPVOID,
|
---|
373 | MPVOID);
|
---|
374 | }
|
---|
375 |
|
---|
376 |
|
---|
377 | VOID AdjustCnrColsForPref (HWND hwndCnr,CHAR *directory,DIRCNRDATA *dcd,
|
---|
378 | BOOL compare) {
|
---|
379 |
|
---|
380 | BOOL *bool;
|
---|
381 |
|
---|
382 | bool = (dcd) ? &dcd->detailssubject : &detailssubject;
|
---|
383 | AdjustCnrColVis(hwndCnr,((compare) ? GetPString(IDS_STATUS) :
|
---|
384 | GetPString(IDS_SUBJ)),
|
---|
385 | *bool,FALSE);
|
---|
386 | bool = (dcd) ? &dcd->detailsattr : &detailsattr;
|
---|
387 | AdjustCnrColVis(hwndCnr,GetPString(IDS_ATTR),
|
---|
388 | *bool,FALSE);
|
---|
389 | bool = (dcd) ? &dcd->detailsicon : &detailsicon;
|
---|
390 | AdjustCnrColVis(hwndCnr,GetPString(IDS_ICON),
|
---|
391 | *bool,FALSE);
|
---|
392 | bool = (dcd) ? &dcd->detailslwdate : &detailslwdate;
|
---|
393 | AdjustCnrColVis(hwndCnr,GetPString(IDS_LWDATE),
|
---|
394 | *bool,FALSE);
|
---|
395 | bool = (dcd) ? &dcd->detailslwtime : &detailslwtime;
|
---|
396 | AdjustCnrColVis(hwndCnr,GetPString(IDS_LWTIME),
|
---|
397 | *bool,FALSE);
|
---|
398 | bool = (dcd) ? &dcd->detailsea : &detailsea;
|
---|
399 | AdjustCnrColVis(hwndCnr,GetPString(IDS_EA),
|
---|
400 | *bool,FALSE);
|
---|
401 | bool = (dcd) ? &dcd->detailssize : &detailssize;
|
---|
402 | AdjustCnrColVis(hwndCnr,GetPString(IDS_SIZE),
|
---|
403 | *bool,FALSE);
|
---|
404 | if(!directory) {
|
---|
405 | bool = (dcd) ? &dcd->detailsladate : &detailsladate;
|
---|
406 | AdjustCnrColVis(hwndCnr,GetPString(IDS_LADATE),
|
---|
407 | *bool,FALSE);
|
---|
408 | bool = (dcd) ? &dcd->detailslatime : &detailslatime;
|
---|
409 | AdjustCnrColVis(hwndCnr,GetPString(IDS_LATIME),
|
---|
410 | *bool,FALSE);
|
---|
411 | bool = (dcd) ? &dcd->detailscrdate : &detailscrdate;
|
---|
412 | AdjustCnrColVis(hwndCnr,GetPString(IDS_CRDATE),
|
---|
413 | *bool,FALSE);
|
---|
414 | bool = (dcd) ? &dcd->detailscrtime : &detailscrtime;
|
---|
415 | AdjustCnrColVis(hwndCnr,GetPString(IDS_CRTIME),
|
---|
416 | *bool,FALSE);
|
---|
417 | bool = (dcd) ? &dcd->detailslongname : &detailslongname;
|
---|
418 | AdjustCnrColVis(hwndCnr,GetPString(IDS_LNAME),
|
---|
419 | *bool,FALSE);
|
---|
420 | WinSendMsg(hwndCnr,
|
---|
421 | CM_INVALIDATEDETAILFIELDINFO,
|
---|
422 | MPVOID,
|
---|
423 | MPVOID);
|
---|
424 | }
|
---|
425 | else
|
---|
426 | AdjustCnrColsForFSType(hwndCnr,
|
---|
427 | directory,
|
---|
428 | dcd);
|
---|
429 | }
|
---|
430 |
|
---|
431 |
|
---|
432 | BOOL SetCnrCols (HWND hwndCnr,BOOL compare) {
|
---|
433 |
|
---|
434 | BOOL fSuccess = TRUE;
|
---|
435 | PFIELDINFO pfi, pfiLastLeftCol, pfiIconCol;
|
---|
436 |
|
---|
437 | // Allocate storage for container column data
|
---|
438 |
|
---|
439 | pfi = WinSendMsg(hwndCnr, CM_ALLOCDETAILFIELDINFO,
|
---|
440 | MPFROMLONG(CONTAINER_COLUMNS),NULL);
|
---|
441 |
|
---|
442 | if(pfi) {
|
---|
443 |
|
---|
444 | PFIELDINFO pfiFirst;
|
---|
445 | FIELDINFOINSERT fii;
|
---|
446 |
|
---|
447 | // Store original value of pfi so we won't lose it when it changes.
|
---|
448 | // This will be needed on the CM_INSERTDETAILFIELDINFO message.
|
---|
449 |
|
---|
450 | pfiFirst = pfi;
|
---|
451 |
|
---|
452 | // Fill in column information for the icon column
|
---|
453 |
|
---|
454 | pfi->flData = CFA_BITMAPORICON | CFA_CENTER | CFA_FIREADONLY;
|
---|
455 | pfi->flTitle = CFA_CENTER | CFA_FITITLEREADONLY;
|
---|
456 | pfi->pTitleData = GetPString(IDS_ICON);
|
---|
457 | pfi->offStruct = FIELDOFFSET(MINIRECORDCORE, hptrIcon);
|
---|
458 |
|
---|
459 | pfiIconCol = pfi;
|
---|
460 |
|
---|
461 | // Fill in column information for the file name. Note that we are
|
---|
462 | // using the pszFileName variable rather than szFileName. We do this
|
---|
463 | // because the container needs a pointer to the file name. If we used
|
---|
464 | // szFileName (a character array, not a pointer), the container would
|
---|
465 | // take the first 4 bytes of szFileName and think it was a pointer,
|
---|
466 | // which of course it is not. Later in the FillInRecord* functions we set
|
---|
467 | // pszFileName to point to szFileName.
|
---|
468 |
|
---|
469 | pfi = pfi->pNextFieldInfo;
|
---|
470 | pfi->flData = CFA_STRING | CFA_LEFT | CFA_SEPARATOR;
|
---|
471 | pfi->flTitle = CFA_CENTER;
|
---|
472 | pfi->pTitleData = GetPString(IDS_FILENAME);
|
---|
473 | pfi->offStruct = FIELDOFFSET( CNRITEM, pszFileName );
|
---|
474 |
|
---|
475 | // Fill in column information for the longname.
|
---|
476 |
|
---|
477 | pfi = pfi->pNextFieldInfo;
|
---|
478 | pfi->flData = CFA_STRING | CFA_LEFT;
|
---|
479 | pfi->flTitle = CFA_CENTER | CFA_FITITLEREADONLY;
|
---|
480 | pfi->pTitleData = GetPString(IDS_LNAME);
|
---|
481 | pfi->offStruct = FIELDOFFSET( CNRITEM, pszLongname );
|
---|
482 |
|
---|
483 | // Store the current pfi value as that will be used to indicate the
|
---|
484 | // last column in the lefthand container window (we have a splitbar)
|
---|
485 |
|
---|
486 | pfiLastLeftCol = pfi;
|
---|
487 |
|
---|
488 | // Fill in column info for subjects
|
---|
489 |
|
---|
490 | pfi = pfi->pNextFieldInfo;
|
---|
491 | pfi->flData = CFA_STRING | CFA_LEFT | CFA_SEPARATOR;
|
---|
492 | if(compare)
|
---|
493 | pfi->flData |= CFA_FIREADONLY;
|
---|
494 | pfi->flTitle = CFA_CENTER | CFA_FITITLEREADONLY;
|
---|
495 | pfi->pTitleData = (compare) ? GetPString(IDS_STATUS) :
|
---|
496 | GetPString(IDS_SUBJ);
|
---|
497 | pfi->offStruct = FIELDOFFSET( CNRITEM, pszSubject );
|
---|
498 |
|
---|
499 | // Fill in column information for the file size
|
---|
500 |
|
---|
501 | pfi = pfi->pNextFieldInfo;
|
---|
502 | pfi->flData = CFA_ULONG | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY;
|
---|
503 | pfi->flTitle = CFA_CENTER;
|
---|
504 | pfi->pTitleData = GetPString(IDS_SIZE);
|
---|
505 | pfi->offStruct = FIELDOFFSET( CNRITEM, cbFile );
|
---|
506 |
|
---|
507 | // Fill in the column information for the file's ea size
|
---|
508 |
|
---|
509 | pfi = pfi->pNextFieldInfo;
|
---|
510 | pfi->flData = CFA_ULONG | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY;
|
---|
511 | pfi->flTitle = CFA_CENTER;
|
---|
512 | pfi->pTitleData = GetPString(IDS_EA);
|
---|
513 | pfi->offStruct = FIELDOFFSET( CNRITEM, easize );
|
---|
514 |
|
---|
515 | // Fill in the column information for the file attribute
|
---|
516 |
|
---|
517 | pfi = pfi->pNextFieldInfo;
|
---|
518 | pfi->flData = CFA_STRING | CFA_CENTER | CFA_SEPARATOR | CFA_FIREADONLY;
|
---|
519 | pfi->flTitle = CFA_CENTER | CFA_FITITLEREADONLY;
|
---|
520 | pfi->pTitleData = GetPString(IDS_ATTR);
|
---|
521 | pfi->offStruct = FIELDOFFSET(CNRITEM, pszDispAttr);
|
---|
522 |
|
---|
523 | // Fill in column information for last write file date
|
---|
524 |
|
---|
525 | pfi = pfi->pNextFieldInfo;
|
---|
526 | pfi->flData = CFA_DATE | CFA_RIGHT | CFA_FIREADONLY;
|
---|
527 | pfi->flTitle = CFA_CENTER;
|
---|
528 | pfi->pTitleData = GetPString(IDS_LWDATE);
|
---|
529 | pfi->offStruct = FIELDOFFSET(CNRITEM,date);
|
---|
530 |
|
---|
531 | // Fill in column information for the last write file time
|
---|
532 |
|
---|
533 | pfi = pfi->pNextFieldInfo;
|
---|
534 | pfi->flData = CFA_TIME | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY;
|
---|
535 | pfi->flTitle = CFA_CENTER;
|
---|
536 | pfi->pTitleData = GetPString(IDS_LWTIME);
|
---|
537 | pfi->offStruct = FIELDOFFSET( CNRITEM, time );
|
---|
538 |
|
---|
539 | // Fill in column information for last access file date
|
---|
540 |
|
---|
541 | pfi = pfi->pNextFieldInfo;
|
---|
542 | pfi->flData = CFA_DATE | CFA_RIGHT | CFA_FIREADONLY;
|
---|
543 | pfi->flTitle = CFA_CENTER;
|
---|
544 | pfi->pTitleData = GetPString(IDS_LADATE);
|
---|
545 | pfi->offStruct = FIELDOFFSET( CNRITEM, ladate );
|
---|
546 |
|
---|
547 | // Fill in column information for the last access file time
|
---|
548 |
|
---|
549 | pfi = pfi->pNextFieldInfo;
|
---|
550 | pfi->flData = CFA_TIME | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY;
|
---|
551 | pfi->flTitle = CFA_CENTER;
|
---|
552 | pfi->pTitleData = GetPString(IDS_LATIME);
|
---|
553 | pfi->offStruct = FIELDOFFSET( CNRITEM, latime );
|
---|
554 |
|
---|
555 | // Fill in column information for create file date
|
---|
556 |
|
---|
557 | pfi = pfi->pNextFieldInfo;
|
---|
558 | pfi->flData = CFA_DATE | CFA_RIGHT | CFA_FIREADONLY;
|
---|
559 | pfi->flTitle = CFA_CENTER;
|
---|
560 | pfi->pTitleData = GetPString(IDS_CRDATE);
|
---|
561 | pfi->offStruct = FIELDOFFSET( CNRITEM, crdate );
|
---|
562 |
|
---|
563 | // Fill in column information for the create file time
|
---|
564 |
|
---|
565 | pfi = pfi->pNextFieldInfo;
|
---|
566 | pfi->flData = CFA_TIME | CFA_RIGHT | CFA_FIREADONLY;
|
---|
567 | pfi->flTitle = CFA_CENTER;
|
---|
568 | pfi->pTitleData = GetPString(IDS_CRTIME);
|
---|
569 | pfi->offStruct = FIELDOFFSET( CNRITEM, crtime );
|
---|
570 |
|
---|
571 | // Use the CM_INSERTDETAILFIELDINFO message to tell the container
|
---|
572 | // all the column information it needs to function properly. Place
|
---|
573 | // this column info first in the column list and update the display
|
---|
574 | // after they are inserted (fInvalidateFieldInfo = TRUE)
|
---|
575 |
|
---|
576 | (void) memset( &fii, 0, sizeof( FIELDINFOINSERT ) );
|
---|
577 |
|
---|
578 | fii.cb = sizeof( FIELDINFOINSERT );
|
---|
579 | fii.pFieldInfoOrder = (PFIELDINFO) CMA_FIRST;
|
---|
580 | fii.cFieldInfoInsert = (SHORT) CONTAINER_COLUMNS;
|
---|
581 | fii.fInvalidateFieldInfo = TRUE;
|
---|
582 |
|
---|
583 | if(!WinSendMsg(hwndCnr,CM_INSERTDETAILFIELDINFO,MPFROMP(pfiFirst),
|
---|
584 | MPFROMP(&fii)))
|
---|
585 | fSuccess = FALSE;
|
---|
586 | }
|
---|
587 | else
|
---|
588 | fSuccess = FALSE;
|
---|
589 |
|
---|
590 | if( fSuccess ) {
|
---|
591 |
|
---|
592 | CNRINFO cnri;
|
---|
593 | ULONG size;
|
---|
594 |
|
---|
595 | // Tell the container about the splitbar and where it goes
|
---|
596 |
|
---|
597 | cnri.cb = sizeof( CNRINFO );
|
---|
598 | cnri.pFieldInfoLast = pfiLastLeftCol;
|
---|
599 | cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 32;
|
---|
600 | cnri.pFieldInfoObject = pfiIconCol;
|
---|
601 | size = sizeof(LONG);
|
---|
602 | PrfQueryProfileData(fmprof,
|
---|
603 | appname,
|
---|
604 | "CnrSplitBar",
|
---|
605 | &cnri.xVertSplitbar,
|
---|
606 | &size);
|
---|
607 | if(cnri.xVertSplitbar <= 0)
|
---|
608 | cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 32;
|
---|
609 | if(!WinSendMsg(hwndCnr, CM_SETCNRINFO, MPFROMP(&cnri),
|
---|
610 | MPFROMLONG(CMA_PFIELDINFOLAST | CMA_PFIELDINFOOBJECT |
|
---|
611 | CMA_XVERTSPLITBAR)))
|
---|
612 | fSuccess = FALSE;
|
---|
613 | }
|
---|
614 |
|
---|
615 | return fSuccess;
|
---|
616 | }
|
---|
617 |
|
---|
618 |
|
---|
619 | MRESULT CnrDirectEdit (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
620 |
|
---|
621 | switch(SHORT2FROMMP(mp1)) {
|
---|
622 | case CN_BEGINEDIT:
|
---|
623 | if(mp2) {
|
---|
624 |
|
---|
625 | PFIELDINFO pfi = ((PCNREDITDATA)mp2)->pFieldInfo;
|
---|
626 | PCNRITEM pci = (PCNRITEM)((PCNREDITDATA)mp2)->pRecord;
|
---|
627 |
|
---|
628 | if(pci &&
|
---|
629 | (INT)pci != -1 &&
|
---|
630 | !IsRoot(pci->szFileName) &&
|
---|
631 | !(pci->flags & RECFLAGS_ENV) &&
|
---|
632 | !(pci->flags & RECFLAGS_UNDERENV)) {
|
---|
633 | if(!pfi ||
|
---|
634 | pfi->offStruct == FIELDOFFSET(CNRITEM,pszFileName)) {
|
---|
635 | PostMsg(hwnd,
|
---|
636 | UM_FIXEDITNAME,
|
---|
637 | MPFROMP(pci->szFileName),
|
---|
638 | MPVOID);
|
---|
639 | }
|
---|
640 | else if(pfi->offStruct == FIELDOFFSET(CNRITEM,pszSubject))
|
---|
641 | PostMsg(hwnd,
|
---|
642 | UM_FIXCNRMLE,
|
---|
643 | MPFROMLONG(40),
|
---|
644 | MPVOID);
|
---|
645 | else
|
---|
646 | PostMsg(hwnd,
|
---|
647 | UM_FIXCNRMLE,
|
---|
648 | MPFROMLONG(CCHMAXPATH),
|
---|
649 | MPVOID);
|
---|
650 | }
|
---|
651 | else
|
---|
652 | PostMsg(hwnd,
|
---|
653 | CM_CLOSEEDIT,
|
---|
654 | MPVOID,
|
---|
655 | MPVOID);
|
---|
656 | }
|
---|
657 | break;
|
---|
658 |
|
---|
659 | case CN_REALLOCPSZ:
|
---|
660 | if(mp2) {
|
---|
661 |
|
---|
662 | PFIELDINFO pfi = ((PCNREDITDATA)mp2)->pFieldInfo;
|
---|
663 | PCNRITEM pci = (PCNRITEM)((PCNREDITDATA)mp2)->pRecord;
|
---|
664 | CHAR szData[CCHMAXPATH],testname[CCHMAXPATH],*p;
|
---|
665 | HWND hwndMLE = WinWindowFromID(hwnd,CID_MLE);
|
---|
666 |
|
---|
667 | if(pci &&
|
---|
668 | (INT)pci != -1 &&
|
---|
669 | !IsRoot(pci->szFileName)) {
|
---|
670 | if(pfi &&
|
---|
671 | pfi->offStruct == FIELDOFFSET(CNRITEM,pszSubject)) {
|
---|
672 |
|
---|
673 | APIRET rc;
|
---|
674 | EAOP2 eaop;
|
---|
675 | PFEA2LIST pfealist = NULL;
|
---|
676 | CHAR subject[256];
|
---|
677 | ULONG ealen;
|
---|
678 | USHORT len;
|
---|
679 | CHAR *eaval;
|
---|
680 |
|
---|
681 | WinQueryWindowText(hwndMLE,40,subject);
|
---|
682 | subject[39] = 0;
|
---|
683 | p = strchr(subject,'\n');
|
---|
684 | if(p)
|
---|
685 | *p = 0;
|
---|
686 | p = strchr(subject,'\r');
|
---|
687 | if(p)
|
---|
688 | *p = 0;
|
---|
689 | lstrip(rstrip(subject));
|
---|
690 | WinSetWindowText(hwndMLE,subject);
|
---|
691 | len = strlen(subject);
|
---|
692 | if(len)
|
---|
693 | ealen = sizeof(FEA2LIST) + 9 + len + 4;
|
---|
694 | else
|
---|
695 | ealen = sizeof(FEALIST) + 9;
|
---|
696 | if(!DosAllocMem((PPVOID)&pfealist,
|
---|
697 | ealen + 64L,
|
---|
698 | OBJ_TILE | PAG_COMMIT | PAG_READ | PAG_WRITE)) {
|
---|
699 | memset(pfealist,0,ealen + 1);
|
---|
700 | pfealist->cbList = ealen;
|
---|
701 | pfealist->list[0].oNextEntryOffset = 0L;
|
---|
702 | pfealist->list[0].fEA = 0;
|
---|
703 | pfealist->list[0].cbName = 8;
|
---|
704 | strcpy(pfealist->list[0].szName,SUBJECT);
|
---|
705 | if(len) {
|
---|
706 | eaval = pfealist->list[0].szName + 9;
|
---|
707 | *(USHORT *)eaval = (USHORT)EAT_ASCII;
|
---|
708 | eaval += sizeof(USHORT);
|
---|
709 | *(USHORT *)eaval = (USHORT)len;
|
---|
710 | eaval += sizeof(USHORT);
|
---|
711 | memcpy(eaval,subject,len);
|
---|
712 | pfealist->list[0].cbValue = len + (sizeof(USHORT) * 2);
|
---|
713 | }
|
---|
714 | else
|
---|
715 | pfealist->list[0].cbValue = 0;
|
---|
716 | eaop.fpGEA2List = (PGEA2LIST)0;
|
---|
717 | eaop.fpFEA2List = pfealist;
|
---|
718 | eaop.oError = 0L;
|
---|
719 | rc = DosSetPathInfo(pci->szFileName,
|
---|
720 | FIL_QUERYEASIZE,
|
---|
721 | (PVOID)&eaop,
|
---|
722 | sizeof(EAOP2),
|
---|
723 | DSPI_WRTTHRU);
|
---|
724 | DosFreeMem(pfealist);
|
---|
725 | if(rc)
|
---|
726 | return FALSE;
|
---|
727 | }
|
---|
728 | return (MRESULT)TRUE;
|
---|
729 | }
|
---|
730 | else if(pfi &&
|
---|
731 | pfi->offStruct == FIELDOFFSET(CNRITEM,pszLongname)) {
|
---|
732 |
|
---|
733 | CHAR longname[CCHMAXPATHCOMP];
|
---|
734 |
|
---|
735 | *longname = 0;
|
---|
736 | WinQueryWindowText(hwndMLE,
|
---|
737 | sizeof(longname),
|
---|
738 | longname);
|
---|
739 | longname[CCHMAXPATHCOMP - 1] = 0;
|
---|
740 | p = strchr(longname,'\n');
|
---|
741 | if(p)
|
---|
742 | *p = 0;
|
---|
743 | p = strchr(longname,'\r');
|
---|
744 | if(p)
|
---|
745 | *p = 0;
|
---|
746 | WinSetWindowText(hwndMLE,
|
---|
747 | longname);
|
---|
748 | return (MRESULT)WriteLongName(pci->szFileName,
|
---|
749 | longname);
|
---|
750 | }
|
---|
751 | else {
|
---|
752 | WinQueryWindowText(hwndMLE,
|
---|
753 | sizeof(szData),
|
---|
754 | szData);
|
---|
755 | if(strchr(szData,'?') ||
|
---|
756 | strchr(szData,'*') ||
|
---|
757 | IsRoot(pci->szFileName))
|
---|
758 | return (MRESULT)FALSE;
|
---|
759 | /* If the text changed, rename the file system object. */
|
---|
760 | p = strchr(szData,'\n');
|
---|
761 | if(p)
|
---|
762 | *p = 0;
|
---|
763 | p = strchr(szData,'\r');
|
---|
764 | if(p)
|
---|
765 | *p = 0;
|
---|
766 | lstrip(rstrip(szData));
|
---|
767 | if(IsFullName(szData)) {
|
---|
768 | if(DosQueryPathInfo(szData,
|
---|
769 | FIL_QUERYFULLNAME,
|
---|
770 | testname,
|
---|
771 | sizeof(testname)))
|
---|
772 | return FALSE;
|
---|
773 | if(DosQueryPathInfo(pci->szFileName,
|
---|
774 | FIL_QUERYFULLNAME,
|
---|
775 | szData,
|
---|
776 | sizeof(szData)))
|
---|
777 | strcpy(szData,pci->szFileName);
|
---|
778 | WinSetWindowText(hwndMLE,
|
---|
779 | szData);
|
---|
780 | if(strcmp(szData,testname)) {
|
---|
781 | if(stricmp(szData,testname) &&
|
---|
782 | IsFile(testname) != -1) {
|
---|
783 | DosBeep(50,100); /* exists; disallow */
|
---|
784 | return (MRESULT)FALSE;
|
---|
785 | }
|
---|
786 | if(!docopyf(MOVE,
|
---|
787 | szData,
|
---|
788 | "%s",
|
---|
789 | testname)) {
|
---|
790 |
|
---|
791 | CHAR *filename;
|
---|
792 |
|
---|
793 | filename = strdup(testname);
|
---|
794 | if(filename) {
|
---|
795 | if(!PostMsg(hwnd,
|
---|
796 | UM_FIXEDITNAME,
|
---|
797 | MPVOID,
|
---|
798 | MPFROMP(filename)))
|
---|
799 | free(filename);
|
---|
800 | }
|
---|
801 | if(stricmp(testname,pci->szFileName)) {
|
---|
802 | PostMsg(hwnd,
|
---|
803 | UM_FIXEDITNAME,
|
---|
804 | MPFROMLONG(-1),
|
---|
805 | MPFROMP(pci));
|
---|
806 | filename = strdup(pci->szFileName);
|
---|
807 | if(filename) {
|
---|
808 | if(!PostMsg(hwnd,
|
---|
809 | UM_FIXEDITNAME,
|
---|
810 | MPVOID,
|
---|
811 | MPFROMP(filename)))
|
---|
812 | free(filename);
|
---|
813 | }
|
---|
814 | }
|
---|
815 | }
|
---|
816 | else
|
---|
817 | DosBeep(100,100);
|
---|
818 | }
|
---|
819 | }
|
---|
820 | else
|
---|
821 | DosBeep(250,100);
|
---|
822 | }
|
---|
823 | }
|
---|
824 | }
|
---|
825 | return FALSE;
|
---|
826 |
|
---|
827 | case CN_ENDEDIT:
|
---|
828 | if(mp2) {
|
---|
829 |
|
---|
830 | PFIELDINFO pfi = ((PCNREDITDATA)mp2)->pFieldInfo;
|
---|
831 | PCNRITEM pci = (PCNRITEM)((PCNREDITDATA)mp2)->pRecord;
|
---|
832 |
|
---|
833 | if(pci &&
|
---|
834 | (INT)pci != -1 &&
|
---|
835 | !IsRoot(pci->szFileName)) {
|
---|
836 | WinSendMsg(hwnd,
|
---|
837 | CM_INVALIDATERECORD,
|
---|
838 | MPFROMP(&pci),
|
---|
839 | MPFROM2SHORT(1,CMA_ERASE | CMA_TEXTCHANGED));
|
---|
840 | if(pfi &&
|
---|
841 | pfi->offStruct == FIELDOFFSET(CNRITEM,pszFileName))
|
---|
842 | PostMsg(hwnd,
|
---|
843 | UM_SORTRECORD,
|
---|
844 | MPVOID,
|
---|
845 | MPVOID);
|
---|
846 | }
|
---|
847 | else {
|
---|
848 |
|
---|
849 | USHORT cmd = 0;
|
---|
850 |
|
---|
851 | if(!pfi ||
|
---|
852 | pfi->offStruct == FIELDOFFSET(CNRITEM,pszFileName))
|
---|
853 | cmd = IDM_SORTSMARTNAME;
|
---|
854 | else if(pfi->offStruct == FIELDOFFSET(CNRITEM,cbFile))
|
---|
855 | cmd = IDM_SORTSIZE;
|
---|
856 | else if(pfi->offStruct == FIELDOFFSET(CNRITEM,easize))
|
---|
857 | cmd = IDM_SORTEASIZE;
|
---|
858 | else if(pfi->offStruct == FIELDOFFSET(CNRITEM,date))
|
---|
859 | cmd = IDM_SORTLWDATE;
|
---|
860 | else if(pfi->offStruct == FIELDOFFSET(CNRITEM,time))
|
---|
861 | cmd = IDM_SORTLWDATE;
|
---|
862 | else if(pfi->offStruct == FIELDOFFSET(CNRITEM,ladate))
|
---|
863 | cmd = IDM_SORTLADATE;
|
---|
864 | else if(pfi->offStruct == FIELDOFFSET(CNRITEM,latime))
|
---|
865 | cmd = IDM_SORTLADATE;
|
---|
866 | else if(pfi->offStruct == FIELDOFFSET(CNRITEM,crdate))
|
---|
867 | cmd = IDM_SORTCRDATE;
|
---|
868 | else if(pfi->offStruct == FIELDOFFSET(CNRITEM,crtime))
|
---|
869 | cmd = IDM_SORTCRDATE;
|
---|
870 | if(cmd)
|
---|
871 | PostMsg(hwnd,
|
---|
872 | WM_COMMAND,
|
---|
873 | MPFROM2SHORT(cmd,0),
|
---|
874 | MPVOID);
|
---|
875 | }
|
---|
876 | }
|
---|
877 | break;
|
---|
878 | }
|
---|
879 | return (MRESULT)-1;
|
---|
880 | }
|
---|
881 |
|
---|
882 |
|
---|
883 | BOOL SetMenuCheck (HWND hwndMenu, USHORT id, BOOL *bool,BOOL toggle,
|
---|
884 | CHAR *savename) {
|
---|
885 |
|
---|
886 | if(toggle) {
|
---|
887 | *bool = (*bool) ? FALSE : TRUE;
|
---|
888 | if(savename && *savename)
|
---|
889 | PrfWriteProfileData(fmprof,
|
---|
890 | appname,
|
---|
891 | savename,
|
---|
892 | bool,
|
---|
893 | sizeof(BOOL));
|
---|
894 | }
|
---|
895 | WinSendMsg(hwndMenu,MM_SETITEMATTR,
|
---|
896 | MPFROM2SHORT(id,1),
|
---|
897 | MPFROM2SHORT(MIA_CHECKED,
|
---|
898 | MIA_CHECKED * (*bool != 0)));
|
---|
899 | return *bool;
|
---|
900 | }
|
---|
901 |
|
---|
902 |
|
---|
903 | VOID disable_menuitem (HWND hwndMenu,USHORT id,BOOL enable) {
|
---|
904 |
|
---|
905 | WinSendMsg(hwndMenu,MM_SETITEMATTR,
|
---|
906 | MPFROM2SHORT(id,TRUE),
|
---|
907 | MPFROM2SHORT(MIA_DISABLED,((enable == FALSE) * MIA_DISABLED)));
|
---|
908 | }
|
---|
909 |
|
---|
910 |
|
---|
911 | BOOL ViewHelp (CHAR *filename) {
|
---|
912 |
|
---|
913 | CHAR s[CCHMAXPATH + 81];
|
---|
914 | FILE *fp;
|
---|
915 | INT ret = -1;
|
---|
916 |
|
---|
917 | fp = _fsopen(filename,"rb",SH_DENYNO);
|
---|
918 | if(fp) {
|
---|
919 | *s = 0;
|
---|
920 | fread(s,1,3,fp);
|
---|
921 | if(*s != 'H' || s[1] != 'S' || s[2] != 'P') {
|
---|
922 | fclose(fp);
|
---|
923 | return FALSE;
|
---|
924 | }
|
---|
925 | fclose(fp);
|
---|
926 | ret = runemf2(SEPARATE | WINDOWED,HWND_DESKTOP,NULL,NULL,
|
---|
927 | "VIEW.EXE \"%s\"",
|
---|
928 | filename);
|
---|
929 | }
|
---|
930 |
|
---|
931 | return (ret != -1);
|
---|
932 | }
|
---|
933 |
|
---|
934 |
|
---|
935 | INT ExecFile (HWND hwnd,CHAR *filename) {
|
---|
936 |
|
---|
937 | EXECARGS ex;
|
---|
938 | CHAR cl[1001],path[CCHMAXPATH],*p;
|
---|
939 | APIRET ret;
|
---|
940 | static INT lastflags = 0;
|
---|
941 |
|
---|
942 | strcpy(path,filename);
|
---|
943 | p = strrchr(path,'\\');
|
---|
944 | if(!p)
|
---|
945 | p = strrchr(path,':');
|
---|
946 | if(p) {
|
---|
947 | if(*p == ':') {
|
---|
948 | p++;
|
---|
949 | *p = '\\';
|
---|
950 | p++;
|
---|
951 | }
|
---|
952 | *p = 0;
|
---|
953 | }
|
---|
954 | else
|
---|
955 | *path = 0;
|
---|
956 | *cl = 0;
|
---|
957 | if(needs_quoting(filename))
|
---|
958 | strcat(cl,"\"");
|
---|
959 | strcat(cl,filename);
|
---|
960 | if(needs_quoting(filename))
|
---|
961 | strcat(cl,"\"");
|
---|
962 | memset(&ex,0,sizeof(ex));
|
---|
963 | ex.flags = lastflags;
|
---|
964 | ex.commandline = cl;
|
---|
965 | *ex.path = 0;
|
---|
966 | *ex.environment = 0;
|
---|
967 | ret = WinDlgBox(HWND_DESKTOP,hwnd,CmdLineDlgProc,FM3ModHandle,
|
---|
968 | EXEC_FRAME,&ex);
|
---|
969 | if(ret == 1) {
|
---|
970 | lastflags = ex.flags;
|
---|
971 | return (runemf2(ex.flags,hwnd,path,
|
---|
972 | (*ex.environment) ? ex.environment : NULL,
|
---|
973 | "%s",cl) != -1);
|
---|
974 | }
|
---|
975 | else if(ret != 0)
|
---|
976 | return -1;
|
---|
977 | return 0;
|
---|
978 | }
|
---|
979 |
|
---|
980 |
|
---|
981 | VOID EmptyCnr (HWND hwnd) {
|
---|
982 |
|
---|
983 | /* Empty out a container in preparation to it dying */
|
---|
984 |
|
---|
985 | PCNRITEM pci;
|
---|
986 | PFIELDINFO pfi;
|
---|
987 |
|
---|
988 | pci = (PCNRITEM)WinSendMsg(hwnd,CM_QUERYRECORD,MPVOID,
|
---|
989 | MPFROMSHORT(CMA_FIRST));
|
---|
990 | if(pci && (INT)pci != -1)
|
---|
991 | WinSendMsg(hwnd,CM_REMOVERECORD,MPVOID,MPFROM2SHORT(0,CMA_FREE));
|
---|
992 | pfi = (PFIELDINFO)WinSendMsg(hwnd,CM_QUERYDETAILFIELDINFO,MPVOID,
|
---|
993 | MPFROMSHORT(CMA_FIRST));
|
---|
994 | if(pfi)
|
---|
995 | WinSendMsg(hwnd,CM_REMOVEDETAILFIELDINFO,MPVOID,
|
---|
996 | MPFROM2SHORT(0,CMA_FREE));
|
---|
997 | }
|
---|
998 |
|
---|
999 |
|
---|
1000 | VOID SetDetailsSwitches (HWND hwnd,DIRCNRDATA *dcd) {
|
---|
1001 |
|
---|
1002 | WinCheckMenuItem(hwnd,IDM_SHOWLNAMES,(dcd) ? dcd->detailslongname : detailslongname);
|
---|
1003 | WinCheckMenuItem(hwnd,IDM_SHOWSUBJECT,(dcd) ? dcd->detailssubject : detailssubject);
|
---|
1004 | WinCheckMenuItem(hwnd,IDM_SHOWEAS,(dcd) ? dcd->detailsea : detailsea);
|
---|
1005 | WinCheckMenuItem(hwnd,IDM_SHOWSIZE,(dcd) ? dcd->detailssize : detailssize);
|
---|
1006 | WinCheckMenuItem(hwnd,IDM_SHOWICON,(dcd) ? dcd->detailsicon : detailsicon);
|
---|
1007 | WinCheckMenuItem(hwnd,IDM_SHOWLWDATE,(dcd) ? dcd->detailslwdate : detailslwdate);
|
---|
1008 | WinCheckMenuItem(hwnd,IDM_SHOWLWTIME,(dcd) ? dcd->detailslwtime : detailslwtime);
|
---|
1009 | WinCheckMenuItem(hwnd,IDM_SHOWLADATE,(dcd) ? dcd->detailsladate : detailsladate);
|
---|
1010 | WinCheckMenuItem(hwnd,IDM_SHOWLATIME,(dcd) ? dcd->detailslatime : detailslatime);
|
---|
1011 | WinCheckMenuItem(hwnd,IDM_SHOWCRDATE,(dcd) ? dcd->detailscrdate : detailscrdate);
|
---|
1012 | WinCheckMenuItem(hwnd,IDM_SHOWCRTIME,(dcd) ? dcd->detailscrtime : detailscrtime);
|
---|
1013 | WinCheckMenuItem(hwnd,IDM_SHOWATTR,(dcd) ? dcd->detailsattr : detailsattr);
|
---|
1014 | }
|
---|
1015 |
|
---|
1016 |
|
---|
1017 | VOID AdjustDetailsSwitches (HWND hwnd,HWND hwndMenu,USHORT cmd,
|
---|
1018 | CHAR *directory,CHAR *keyroot,
|
---|
1019 | DIRCNRDATA *dcd,BOOL compare) {
|
---|
1020 |
|
---|
1021 | CHAR s[CCHMAXPATH],*eos = s;
|
---|
1022 | BOOL *bool = NULL;
|
---|
1023 |
|
---|
1024 | *s = 0;
|
---|
1025 | if(keyroot) {
|
---|
1026 | strcpy(s,keyroot);
|
---|
1027 | strcat(s,".");
|
---|
1028 | eos = &s[strlen(s)];
|
---|
1029 | }
|
---|
1030 | switch(cmd) {
|
---|
1031 | case IDM_SHOWLNAMES:
|
---|
1032 | bool = (dcd) ? &dcd->detailslongname : &detailslongname;
|
---|
1033 | strcpy(eos,"DetailsLongname");
|
---|
1034 | break;
|
---|
1035 | case IDM_SHOWSUBJECT:
|
---|
1036 | bool = (dcd) ? &dcd->detailssubject : &detailssubject;
|
---|
1037 | strcpy(eos,"DetailsSubject");
|
---|
1038 | break;
|
---|
1039 | case IDM_SHOWEAS:
|
---|
1040 | bool = (dcd) ? &dcd->detailsea : &detailsea;
|
---|
1041 | strcpy(eos,"DetailsEA");
|
---|
1042 | break;
|
---|
1043 | case IDM_SHOWSIZE:
|
---|
1044 | bool = (dcd) ? &dcd->detailssize : &detailssize;
|
---|
1045 | strcpy(eos,"DetailsSize");
|
---|
1046 | break;
|
---|
1047 | case IDM_SHOWICON:
|
---|
1048 | bool = (dcd) ? &dcd->detailsicon : &detailsicon;
|
---|
1049 | strcpy(eos,"DetailsIcon");
|
---|
1050 | break;
|
---|
1051 | case IDM_SHOWLWDATE:
|
---|
1052 | bool = (dcd) ? &dcd->detailslwdate : &detailslwdate;
|
---|
1053 | strcpy(eos,"DetailsLWDate");
|
---|
1054 | break;
|
---|
1055 | case IDM_SHOWLWTIME:
|
---|
1056 | bool = (dcd) ? &dcd->detailslwtime : &detailslwtime;
|
---|
1057 | strcpy(eos,"DetailsLWTime");
|
---|
1058 | break;
|
---|
1059 | case IDM_SHOWLADATE:
|
---|
1060 | bool = (dcd) ? &dcd->detailsladate : &detailsladate;
|
---|
1061 | strcpy(eos,"DetailsLADate");
|
---|
1062 | break;
|
---|
1063 | case IDM_SHOWLATIME:
|
---|
1064 | bool = (dcd) ? &dcd->detailslatime : &detailslatime;
|
---|
1065 | strcpy(eos,"DetailsLATime");
|
---|
1066 | break;
|
---|
1067 | case IDM_SHOWCRDATE:
|
---|
1068 | bool = (dcd) ? &dcd->detailscrdate : &detailscrdate;
|
---|
1069 | strcpy(eos,"DetailsCRDate");
|
---|
1070 | break;
|
---|
1071 | case IDM_SHOWCRTIME:
|
---|
1072 | bool = (dcd) ? &dcd->detailscrtime : &detailscrtime;
|
---|
1073 | strcpy(eos,"DetailsCRTime");
|
---|
1074 | break;
|
---|
1075 | case IDM_SHOWATTR:
|
---|
1076 | bool = (dcd) ? &dcd->detailsattr : &detailsattr;
|
---|
1077 | strcpy(eos,"DetailsAttr");
|
---|
1078 | break;
|
---|
1079 | default:
|
---|
1080 | if(hwndMenu)
|
---|
1081 | SetDetailsSwitches(hwndMenu,dcd);
|
---|
1082 | return;
|
---|
1083 | }
|
---|
1084 | if(bool)
|
---|
1085 | *bool = (*bool) ? FALSE : TRUE;
|
---|
1086 | if(*s && bool)
|
---|
1087 | PrfWriteProfileData(fmprof,appname,s,bool,sizeof(BOOL));
|
---|
1088 | if(hwnd)
|
---|
1089 | AdjustCnrColsForPref(hwnd,directory,dcd,compare);
|
---|
1090 | if(hwndMenu)
|
---|
1091 | SetDetailsSwitches(hwndMenu,dcd);
|
---|
1092 | }
|
---|
1093 |
|
---|
1094 |
|
---|
1095 | VOID SetConditionalCascade (HWND hwndMenu,USHORT id,USHORT def) {
|
---|
1096 |
|
---|
1097 | MENUITEM mi;
|
---|
1098 |
|
---|
1099 | mi.iPosition = MIT_END;
|
---|
1100 | mi.hItem = 0L;
|
---|
1101 | mi.hwndSubMenu = (HWND)0;
|
---|
1102 | mi.afAttribute = 0;
|
---|
1103 | mi.afStyle = MIS_TEXT;
|
---|
1104 | if(WinSendMsg(hwndMenu,MM_QUERYITEM,MPFROM2SHORT(id,TRUE),MPFROMP(&mi))) {
|
---|
1105 | WinSetWindowBits(mi.hwndSubMenu,QWL_STYLE,
|
---|
1106 | MS_CONDITIONALCASCADE,
|
---|
1107 | MS_CONDITIONALCASCADE);
|
---|
1108 | WinSendMsg(mi.hwndSubMenu,MM_SETDEFAULTITEMID,MPFROMSHORT(def),MPVOID);
|
---|
1109 | WinCheckMenuItem(mi.hwndSubMenu,def,TRUE);
|
---|
1110 | }
|
---|
1111 | }
|
---|
1112 |
|
---|
1113 |
|
---|
1114 | VOID SetSortChecks (HWND hwndMenu,INT sortflags) {
|
---|
1115 |
|
---|
1116 | WinCheckMenuItem(hwndMenu,IDM_SORTNONE,FALSE);
|
---|
1117 | WinCheckMenuItem(hwndMenu,IDM_SORTFIRST,FALSE);
|
---|
1118 | WinCheckMenuItem(hwndMenu,IDM_SORTLAST,FALSE);
|
---|
1119 | WinCheckMenuItem(hwndMenu,IDM_SORTSIZE,FALSE);
|
---|
1120 | WinCheckMenuItem(hwndMenu,IDM_SORTEASIZE,FALSE);
|
---|
1121 | WinCheckMenuItem(hwndMenu,IDM_SORTLWDATE,FALSE);
|
---|
1122 | WinCheckMenuItem(hwndMenu,IDM_SORTLADATE,FALSE);
|
---|
1123 | WinCheckMenuItem(hwndMenu,IDM_SORTCRDATE,FALSE);
|
---|
1124 | WinCheckMenuItem(hwndMenu,IDM_SORTFILENAME,FALSE);
|
---|
1125 | WinCheckMenuItem(hwndMenu,IDM_SORTNAME,FALSE);
|
---|
1126 | WinCheckMenuItem(hwndMenu,IDM_SORTSUBJECT,FALSE);
|
---|
1127 | WinCheckMenuItem(hwndMenu,IDM_SORTDIRSFIRST,FALSE);
|
---|
1128 | WinCheckMenuItem(hwndMenu,IDM_SORTDIRSLAST,FALSE);
|
---|
1129 | WinCheckMenuItem(hwndMenu,IDM_SORTREVERSE,FALSE);
|
---|
1130 | if(sortflags & SORT_FIRSTEXTENSION)
|
---|
1131 | WinCheckMenuItem(hwndMenu,IDM_SORTFIRST,TRUE);
|
---|
1132 | else if(sortflags & SORT_LASTEXTENSION)
|
---|
1133 | WinCheckMenuItem(hwndMenu,IDM_SORTLAST,TRUE);
|
---|
1134 | else if(sortflags & SORT_SIZE)
|
---|
1135 | WinCheckMenuItem(hwndMenu,IDM_SORTSIZE,TRUE);
|
---|
1136 | else if(sortflags & SORT_EASIZE)
|
---|
1137 | WinCheckMenuItem(hwndMenu,IDM_SORTEASIZE,TRUE);
|
---|
1138 | else if(sortflags & SORT_LWDATE)
|
---|
1139 | WinCheckMenuItem(hwndMenu,IDM_SORTLWDATE,TRUE);
|
---|
1140 | else if(sortflags & SORT_LADATE)
|
---|
1141 | WinCheckMenuItem(hwndMenu,IDM_SORTLADATE,TRUE);
|
---|
1142 | else if(sortflags & SORT_CRDATE)
|
---|
1143 | WinCheckMenuItem(hwndMenu,IDM_SORTCRDATE,TRUE);
|
---|
1144 | else if(sortflags & SORT_FILENAME)
|
---|
1145 | WinCheckMenuItem(hwndMenu,IDM_SORTFILENAME,TRUE);
|
---|
1146 | else if(sortflags & SORT_NOSORT)
|
---|
1147 | WinCheckMenuItem(hwndMenu,IDM_SORTNONE,TRUE);
|
---|
1148 | else if(sortflags & SORT_SUBJECT)
|
---|
1149 | WinCheckMenuItem(hwndMenu,IDM_SORTSUBJECT,TRUE);
|
---|
1150 | else
|
---|
1151 | WinCheckMenuItem(hwndMenu,IDM_SORTNAME,TRUE);
|
---|
1152 | if(sortflags & SORT_DIRSFIRST)
|
---|
1153 | WinCheckMenuItem(hwndMenu,IDM_SORTDIRSFIRST,TRUE);
|
---|
1154 | else if(sortflags & SORT_DIRSLAST)
|
---|
1155 | WinCheckMenuItem(hwndMenu,IDM_SORTDIRSLAST,TRUE);
|
---|
1156 | if(sortflags & SORT_REVERSE)
|
---|
1157 | WinCheckMenuItem(hwndMenu,IDM_SORTREVERSE,TRUE);
|
---|
1158 | }
|
---|
1159 |
|
---|
1160 |
|
---|
1161 | VOID FreeMallocedMem (VOID *mem) {
|
---|
1162 |
|
---|
1163 | /* for use by apps that don't use the DLLs runtime library */
|
---|
1164 |
|
---|
1165 | free(mem);
|
---|
1166 | }
|
---|
1167 |
|
---|
1168 | VOID FcloseFile (FILE *fp) {
|
---|
1169 |
|
---|
1170 | /* for use by apps that don't use the DLLs runtime library */
|
---|
1171 |
|
---|
1172 | fclose(fp);
|
---|
1173 | }
|
---|
1174 |
|
---|
1175 |
|
---|
1176 | VOID SetupCommandMenu (HWND hwndMenu,HWND hwndCnr) {
|
---|
1177 |
|
---|
1178 | MENUITEM mi,mit;
|
---|
1179 | INT x;
|
---|
1180 | SHORT numitems;
|
---|
1181 | LINKCMDS *info;
|
---|
1182 |
|
---|
1183 | if(!cmdloaded)
|
---|
1184 | load_commands();
|
---|
1185 | mi.iPosition = MIT_END;
|
---|
1186 | mi.hwndSubMenu = (HWND)0;
|
---|
1187 | mi.hItem = 0L;
|
---|
1188 | mi.afAttribute = 0;
|
---|
1189 | mi.afStyle = MIS_TEXT;
|
---|
1190 | memset(&mit,0,sizeof(MENUITEM));
|
---|
1191 | if(WinQueryWindowUShort(hwndMenu,QWS_ID) == IDM_COMMANDSMENU)
|
---|
1192 | mit.hwndSubMenu = hwndMenu;
|
---|
1193 | else
|
---|
1194 | WinSendMsg(hwndMenu,MM_QUERYITEM,
|
---|
1195 | MPFROM2SHORT(IDM_COMMANDSMENU,TRUE),
|
---|
1196 | MPFROMP(&mit));
|
---|
1197 | if(mit.hwndSubMenu) {
|
---|
1198 | numitems = (SHORT)WinSendMsg(mit.hwndSubMenu,MM_QUERYITEMCOUNT,
|
---|
1199 | MPVOID,MPVOID);
|
---|
1200 | WinSendMsg(mit.hwndSubMenu,MM_DELETEITEM,MPFROMSHORT(-1),MPVOID);
|
---|
1201 | for(x = 0;x < numitems;x++)
|
---|
1202 | WinSendMsg(mit.hwndSubMenu,MM_DELETEITEM,
|
---|
1203 | MPFROMSHORT((SHORT)(x + IDM_COMMANDSTART)),
|
---|
1204 | MPVOID);
|
---|
1205 | if(hwndCnr && cmdhead) {
|
---|
1206 | x = 0;
|
---|
1207 | info = cmdhead;
|
---|
1208 | while(info) {
|
---|
1209 |
|
---|
1210 | CHAR s[CCHMAXPATH + 24];
|
---|
1211 |
|
---|
1212 | sprintf(s,
|
---|
1213 | "%s%s%s",
|
---|
1214 | info->title,
|
---|
1215 | (x < 20) ? "\tCtrl + " : NullStr,
|
---|
1216 | (x < 20 && x > 9) ? "Shift + " : NullStr);
|
---|
1217 | if(x < 20)
|
---|
1218 | sprintf(&s[strlen(s)],"%d",(((x % 10) + 1) == 10) ? 0 : (x % 10) + 1);
|
---|
1219 | mi.id = IDM_COMMANDSTART + x;
|
---|
1220 | mi.afAttribute = (((info->flags & ONCE) != 0) ?
|
---|
1221 | MIA_CHECKED : 0) |
|
---|
1222 | (((info->flags & PROMPT) != 0) ?
|
---|
1223 | MIA_FRAMED : 0);
|
---|
1224 | mi.afStyle = MIS_TEXT;
|
---|
1225 | if(!(x % 24) && x && info->next)
|
---|
1226 | mi.afStyle |= MIS_BREAK;
|
---|
1227 | WinSendMsg(mit.hwndSubMenu, MM_INSERTITEM, MPFROMP(&mi),
|
---|
1228 | MPFROMP(s));
|
---|
1229 | x++;
|
---|
1230 | info = info->next;
|
---|
1231 | }
|
---|
1232 | }
|
---|
1233 | }
|
---|
1234 | }
|
---|
1235 |
|
---|
1236 |
|
---|
1237 | VOID LoadDetailsSwitches (CHAR *keyroot,DIRCNRDATA *dcd) {
|
---|
1238 |
|
---|
1239 | ULONG size;
|
---|
1240 | CHAR s[CCHMAXPATH],*eos = s;
|
---|
1241 | BOOL *bool;
|
---|
1242 |
|
---|
1243 | *s = 0;
|
---|
1244 | if(keyroot) {
|
---|
1245 | strcpy(s,keyroot);
|
---|
1246 | strcat(s,".");
|
---|
1247 | eos = &s[strlen(s)];
|
---|
1248 | }
|
---|
1249 | strcpy(eos,"DetailsLongname");
|
---|
1250 | if(dcd)
|
---|
1251 | bool = &dcd->detailslongname;
|
---|
1252 | else
|
---|
1253 | bool = &detailslongname;
|
---|
1254 | *bool = detailslongname;
|
---|
1255 | size = sizeof(BOOL);
|
---|
1256 | PrfQueryProfileData(fmprof,appname,s,(PVOID)bool,&size);
|
---|
1257 | strcpy(eos,"DetailsSubject");
|
---|
1258 | if(dcd)
|
---|
1259 | bool = &dcd->detailssubject;
|
---|
1260 | else
|
---|
1261 | bool = &detailssubject;
|
---|
1262 | *bool = detailssubject;
|
---|
1263 | size = sizeof(BOOL);
|
---|
1264 | PrfQueryProfileData(fmprof,appname,s,(PVOID)bool,&size);
|
---|
1265 | strcpy(eos,"DetailsEA");
|
---|
1266 | if(dcd)
|
---|
1267 | bool = &dcd->detailsea;
|
---|
1268 | else
|
---|
1269 | bool = &detailsea;
|
---|
1270 | *bool = detailsea;
|
---|
1271 | size = sizeof(BOOL);
|
---|
1272 | PrfQueryProfileData(fmprof,appname,s,(PVOID)bool,&size);
|
---|
1273 | strcpy(eos,"DetailsSize");
|
---|
1274 | if(dcd)
|
---|
1275 | bool = &dcd->detailssize;
|
---|
1276 | else
|
---|
1277 | bool = &detailssize;
|
---|
1278 | *bool = detailssize;
|
---|
1279 | size = sizeof(BOOL);
|
---|
1280 | PrfQueryProfileData(fmprof,appname,s,(PVOID)bool,&size);
|
---|
1281 | strcpy(eos,"DetailsIcon");
|
---|
1282 | if(dcd)
|
---|
1283 | bool = &dcd->detailsicon;
|
---|
1284 | else
|
---|
1285 | bool = &detailsicon;
|
---|
1286 | *bool = detailsicon;
|
---|
1287 | size = sizeof(BOOL);
|
---|
1288 | PrfQueryProfileData(fmprof,appname,s,(PVOID)bool,&size);
|
---|
1289 | strcpy(eos,"DetailsAttr");
|
---|
1290 | if(dcd)
|
---|
1291 | bool = &dcd->detailsattr;
|
---|
1292 | else
|
---|
1293 | bool = &detailsattr;
|
---|
1294 | *bool = detailsattr;
|
---|
1295 | size = sizeof(BOOL);
|
---|
1296 | PrfQueryProfileData(fmprof,appname,s,(PVOID)bool,&size);
|
---|
1297 | strcpy(eos,"DetailsCRDate");
|
---|
1298 | if(dcd)
|
---|
1299 | bool = &dcd->detailscrdate;
|
---|
1300 | else
|
---|
1301 | bool = &detailscrdate;
|
---|
1302 | *bool = detailscrdate;
|
---|
1303 | size = sizeof(BOOL);
|
---|
1304 | PrfQueryProfileData(fmprof,appname,s,(PVOID)bool,&size);
|
---|
1305 | strcpy(eos,"DetailsCRTime");
|
---|
1306 | if(dcd)
|
---|
1307 | bool = &dcd->detailscrtime;
|
---|
1308 | else
|
---|
1309 | bool = &detailscrtime;
|
---|
1310 | *bool = detailscrtime;
|
---|
1311 | size = sizeof(BOOL);
|
---|
1312 | PrfQueryProfileData(fmprof,appname,s,(PVOID)bool,&size);
|
---|
1313 | strcpy(eos,"DetailsLWDate");
|
---|
1314 | if(dcd)
|
---|
1315 | bool = &dcd->detailslwdate;
|
---|
1316 | else
|
---|
1317 | bool = &detailslwdate;
|
---|
1318 | *bool = detailslwdate;
|
---|
1319 | size = sizeof(BOOL);
|
---|
1320 | PrfQueryProfileData(fmprof,appname,s,(PVOID)bool,&size);
|
---|
1321 | strcpy(eos,"DetailsLWTime");
|
---|
1322 | if(dcd)
|
---|
1323 | bool = &dcd->detailslwtime;
|
---|
1324 | else
|
---|
1325 | bool = &detailslwtime;
|
---|
1326 | *bool = detailslwtime;
|
---|
1327 | size = sizeof(BOOL);
|
---|
1328 | PrfQueryProfileData(fmprof,appname,s,(PVOID)bool,&size);
|
---|
1329 | strcpy(eos,"DetailsLADate");
|
---|
1330 | if(dcd)
|
---|
1331 | bool = &dcd->detailsladate;
|
---|
1332 | else
|
---|
1333 | bool = &detailsladate;
|
---|
1334 | *bool = detailsladate;
|
---|
1335 | size = sizeof(BOOL);
|
---|
1336 | PrfQueryProfileData(fmprof,appname,s,(PVOID)bool,&size);
|
---|
1337 | strcpy(eos,"DetailsLATime");
|
---|
1338 | if(dcd)
|
---|
1339 | bool = &dcd->detailslatime;
|
---|
1340 | else
|
---|
1341 | bool = &detailslatime;
|
---|
1342 | *bool = detailslatime;
|
---|
1343 | size = sizeof(BOOL);
|
---|
1344 | PrfQueryProfileData(fmprof,appname,s,(PVOID)bool,&size);
|
---|
1345 | }
|
---|
1346 |
|
---|
1347 |
|
---|
1348 | HWND FindDirCnr (HWND hwndParent) {
|
---|
1349 |
|
---|
1350 | HWND found,hwndDir = (HWND)0;
|
---|
1351 | HENUM henum;
|
---|
1352 |
|
---|
1353 | henum = WinBeginEnumWindows(hwndParent);
|
---|
1354 | while((found = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
1355 | hwndDir = WinWindowFromID(found,FID_CLIENT);
|
---|
1356 | if(hwndDir) {
|
---|
1357 | hwndDir = WinWindowFromID(hwndDir,DIR_CNR);
|
---|
1358 | if(hwndDir)
|
---|
1359 | break;
|
---|
1360 | hwndDir = (HWND)0;
|
---|
1361 | }
|
---|
1362 | }
|
---|
1363 | WinEndEnumWindows(henum);
|
---|
1364 |
|
---|
1365 | return hwndDir;
|
---|
1366 | }
|
---|
1367 |
|
---|
1368 |
|
---|
1369 | VOID HeapThread (VOID *dummy) {
|
---|
1370 |
|
---|
1371 | ULONG postcount;
|
---|
1372 |
|
---|
1373 | if(!DosCreateEventSem(NULL,&CompactSem,0L,FALSE)) {
|
---|
1374 | priority_normal();
|
---|
1375 | for(;;) {
|
---|
1376 | if(DosWaitEventSem(CompactSem,SEM_INDEFINITE_WAIT))
|
---|
1377 | break;
|
---|
1378 | _heapmin();
|
---|
1379 | DosResetEventSem(CompactSem,&postcount);
|
---|
1380 | }
|
---|
1381 | }
|
---|
1382 | else {
|
---|
1383 | DosBeep(250,100);
|
---|
1384 | DosBeep(1000,100);
|
---|
1385 | DosBeep(500,100);
|
---|
1386 | // DosExit(EXIT_PROCESS,1);
|
---|
1387 | }
|
---|
1388 | }
|
---|
1389 |
|
---|
1390 |
|
---|
1391 | VOID FixSwitchList (HWND hwnd,CHAR *text) {
|
---|
1392 |
|
---|
1393 | HSWITCH hswitch;
|
---|
1394 | SWCNTRL swctl;
|
---|
1395 |
|
---|
1396 | hswitch = WinQuerySwitchHandle(hwnd,0);
|
---|
1397 | if(hswitch) {
|
---|
1398 | if(!WinQuerySwitchEntry(hswitch,&swctl)) {
|
---|
1399 | strcpy(swctl.szSwtitle,"FM/2");
|
---|
1400 | WinChangeSwitchEntry(hswitch,&swctl);
|
---|
1401 | }
|
---|
1402 | }
|
---|
1403 | }
|
---|
1404 |
|
---|
1405 |
|
---|
1406 | VOID QuickPopup (HWND hwnd,DIRCNRDATA *dcd,HWND hwndMenu,USHORT id) {
|
---|
1407 |
|
---|
1408 | dcd->hwndLastMenu = hwndMenu;
|
---|
1409 | if(dcd->hwndLastMenu && !dcd->cnremphasized) {
|
---|
1410 | WinSendMsg(hwnd,CM_SETRECORDEMPHASIS,MPVOID,
|
---|
1411 | MPFROM2SHORT(TRUE,CRA_SOURCE));
|
---|
1412 | dcd->cnremphasized = TRUE;
|
---|
1413 | }
|
---|
1414 | if(dcd->flWindowAttr & CV_MINI)
|
---|
1415 | WinCheckMenuItem(dcd->hwndLastMenu,IDM_MINIICONS,TRUE);
|
---|
1416 | if(!WinPopupMenu(hwnd,hwnd,dcd->hwndLastMenu,
|
---|
1417 | 8, 8, 0,
|
---|
1418 | PU_HCONSTRAIN | PU_VCONSTRAIN |
|
---|
1419 | PU_KEYBOARD | PU_MOUSEBUTTON1)) {
|
---|
1420 | if(dcd->cnremphasized) {
|
---|
1421 | WinSendMsg(hwnd,CM_SETRECORDEMPHASIS,MPVOID,
|
---|
1422 | MPFROM2SHORT(FALSE,CRA_SOURCE));
|
---|
1423 | dcd->cnremphasized = FALSE;
|
---|
1424 | }
|
---|
1425 | }
|
---|
1426 | else
|
---|
1427 | WinSendMsg(dcd->hwndLastMenu,MM_SELECTITEM,
|
---|
1428 | MPFROM2SHORT(id,TRUE),
|
---|
1429 | MPFROM2SHORT(0,FALSE));
|
---|
1430 | }
|
---|
1431 |
|
---|
1432 |
|
---|
1433 | PMINIRECORDCORE CurrentRecord (HWND hwndCnr) {
|
---|
1434 |
|
---|
1435 | SHORT attrib = (fSelectedAlways) ? CRA_SELECTED : CRA_CURSORED;
|
---|
1436 | PMINIRECORDCORE pmi;
|
---|
1437 |
|
---|
1438 | for(;;) {
|
---|
1439 | pmi = (PMINIRECORDCORE)WinSendMsg(hwndCnr,CM_QUERYRECORDEMPHASIS,
|
---|
1440 | MPFROMLONG(CMA_FIRST),
|
---|
1441 | MPFROMSHORT(attrib));
|
---|
1442 | if((!pmi || (INT)pmi == -1) && attrib == CRA_SELECTED) /* punt */
|
---|
1443 | attrib = CRA_CURSORED;
|
---|
1444 | else
|
---|
1445 | break;
|
---|
1446 | }
|
---|
1447 | return ((INT)pmi == -1) ? NULL : pmi;
|
---|
1448 | }
|
---|
1449 |
|
---|
1450 |
|
---|
1451 | BOOL PostMsg (HWND h, ULONG msg, MPARAM mp1, MPARAM mp2) {
|
---|
1452 |
|
---|
1453 | BOOL rc = WinPostMsg(h,msg,mp1,mp2);
|
---|
1454 |
|
---|
1455 | if(!rc) {
|
---|
1456 |
|
---|
1457 | PIB *ppib;
|
---|
1458 | TIB *ptib;
|
---|
1459 |
|
---|
1460 | if(!DosGetInfoBlocks(&ptib,&ppib)) {
|
---|
1461 |
|
---|
1462 | PID pid;
|
---|
1463 | TID tid;
|
---|
1464 | QMSG qmsg;
|
---|
1465 |
|
---|
1466 | if(WinQueryWindowProcess(h,&pid,&tid)) {
|
---|
1467 | if(pid != ppib->pib_ulpid || tid != ptib->tib_ptib2->tib2_ultid) {
|
---|
1468 | for(;;) {
|
---|
1469 | DosSleep(1L);
|
---|
1470 | rc = WinPostMsg(h,msg,mp1,mp2);
|
---|
1471 | if(!rc) {
|
---|
1472 | if(!WinIsWindow((HAB)0,h))
|
---|
1473 | break;
|
---|
1474 | if(WinPeekMsg((HAB)0,&qmsg,(HWND)0,0,0,PM_NOREMOVE))
|
---|
1475 | break;
|
---|
1476 | }
|
---|
1477 | else
|
---|
1478 | break;
|
---|
1479 | }
|
---|
1480 | }
|
---|
1481 | }
|
---|
1482 | }
|
---|
1483 | }
|
---|
1484 | return rc;
|
---|
1485 | }
|
---|
1486 |
|
---|
1487 |
|
---|
1488 | VOID OpenEdit (HWND hwnd) {
|
---|
1489 |
|
---|
1490 | CNREDITDATA ced;
|
---|
1491 | PCNRITEM pci;
|
---|
1492 | PFIELDINFO pfi;
|
---|
1493 |
|
---|
1494 | pci = (PCNRITEM)WinSendMsg(hwnd,
|
---|
1495 | CM_QUERYRECORDEMPHASIS,
|
---|
1496 | MPFROMLONG(CMA_FIRST),
|
---|
1497 | MPFROMSHORT(CRA_CURSORED));
|
---|
1498 | if(pci && (INT)pci != -1) {
|
---|
1499 | memset(&ced,0,sizeof(ced));
|
---|
1500 | ced.cb = sizeof(ced);
|
---|
1501 | ced.hwndCnr = hwnd;
|
---|
1502 | ced.id = WinQueryWindowUShort(hwnd,QWS_ID);
|
---|
1503 | ced.pRecord = (PRECORDCORE)pci;
|
---|
1504 | pfi = (PFIELDINFO)WinSendMsg(hwnd,
|
---|
1505 | CM_QUERYDETAILFIELDINFO,
|
---|
1506 | MPVOID,
|
---|
1507 | MPFROMSHORT(CMA_FIRST));
|
---|
1508 | if(!pfi)
|
---|
1509 | WinSendMsg(hwnd,
|
---|
1510 | CM_OPENEDIT,
|
---|
1511 | MPFROMP(&ced),
|
---|
1512 | MPVOID);
|
---|
1513 | else {
|
---|
1514 | while(pfi && (INT)pfi != -1 &&
|
---|
1515 | pfi->offStruct != FIELDOFFSET(CNRITEM,pszFileName))
|
---|
1516 | pfi = (PFIELDINFO)WinSendMsg(hwnd,
|
---|
1517 | CM_QUERYDETAILFIELDINFO,
|
---|
1518 | MPFROMP(pfi),
|
---|
1519 | MPFROMSHORT(CMA_NEXT));
|
---|
1520 | if(pfi && (INT)pfi != -1) {
|
---|
1521 | ced.pFieldInfo = pfi;
|
---|
1522 | {
|
---|
1523 | CNRINFO cnri;
|
---|
1524 |
|
---|
1525 | memset(&cnri,0,sizeof(CNRINFO));
|
---|
1526 | cnri.cb = sizeof(CNRINFO);
|
---|
1527 | WinSendMsg(hwnd,
|
---|
1528 | CM_QUERYCNRINFO,
|
---|
1529 | MPFROMP(&cnri),
|
---|
1530 | MPFROMLONG(sizeof(CNRINFO)));
|
---|
1531 | if(cnri.flWindowAttr & CV_DETAIL)
|
---|
1532 | ced.id = CID_LEFTDVWND;
|
---|
1533 | }
|
---|
1534 | WinSendMsg(hwnd,
|
---|
1535 | CM_OPENEDIT,
|
---|
1536 | MPFROMP(&ced),
|
---|
1537 | MPVOID);
|
---|
1538 | }
|
---|
1539 | }
|
---|
1540 | }
|
---|
1541 | }
|
---|
1542 |
|
---|
1543 |
|
---|
1544 | #ifdef NEVER
|
---|
1545 |
|
---|
1546 | VOID QuickView (HWND hwnd,CHAR *filename) {
|
---|
1547 |
|
---|
1548 | if(filename && IsFile(filename) == 1) {
|
---|
1549 | if(TestBinary(filename) && *binview) {
|
---|
1550 |
|
---|
1551 | CHAR *list[2];
|
---|
1552 |
|
---|
1553 | list[0] = filename;
|
---|
1554 | list[1] = NULL;
|
---|
1555 | ExecOnList(hwnd,binview,WINDOWED | SEPARATE,NULL,list,NULL);
|
---|
1556 | return;
|
---|
1557 | }
|
---|
1558 | else if(*viewer) {
|
---|
1559 |
|
---|
1560 | CHAR *list[2];
|
---|
1561 |
|
---|
1562 | list[0] = filename;
|
---|
1563 | list[1] = NULL;
|
---|
1564 | ExecOnList(hwnd,viewer,WINDOWED | SEPARATE |
|
---|
1565 | ((fViewChild) ? CHILD : 0),
|
---|
1566 | NULL,list,NULL);
|
---|
1567 | return;
|
---|
1568 | }
|
---|
1569 | StartMLEEditor(HWND_DESKTOP,5,filename,(HWND)0);
|
---|
1570 | }
|
---|
1571 | }
|
---|
1572 |
|
---|
1573 |
|
---|
1574 | VOID QuickEdit (HWND hwnd,CHAR *filename) {
|
---|
1575 |
|
---|
1576 | if(filename && IsFile(filename) == 1) {
|
---|
1577 | if(TestBinary(filename) && *bined) {
|
---|
1578 |
|
---|
1579 | CHAR *list[2];
|
---|
1580 |
|
---|
1581 | list[0] = filename;
|
---|
1582 | list[1] = NULL;
|
---|
1583 | ExecOnList(hwnd,bined,WINDOWED | SEPARATE,NULL,list,NULL);
|
---|
1584 | return;
|
---|
1585 | }
|
---|
1586 | else if(*editor) {
|
---|
1587 |
|
---|
1588 | CHAR *list[2];
|
---|
1589 |
|
---|
1590 | list[0] = filename;
|
---|
1591 | list[1] = NULL;
|
---|
1592 | ExecOnList(hwnd,editor,WINDOWED | SEPARATE,NULL,list,NULL);
|
---|
1593 | return;
|
---|
1594 | }
|
---|
1595 | StartMLEEditor(HWND_DESKTOP,4,filename,(HWND)0);
|
---|
1596 | }
|
---|
1597 | }
|
---|
1598 |
|
---|
1599 | #endif
|
---|
1600 |
|
---|
1601 |
|
---|
1602 | VOID PortholeInit (HWND hwndNew,MPARAM mp1,MPARAM mp2) {
|
---|
1603 |
|
---|
1604 | static HWND DefMenu = (HWND)0;
|
---|
1605 | HWND hwndMenu = (HWND)mp2;
|
---|
1606 |
|
---|
1607 | {
|
---|
1608 | ULONG style;
|
---|
1609 |
|
---|
1610 | style = WinQueryWindowULong(hwndMenu,QWL_STYLE);
|
---|
1611 | if(!(style & MS_ACTIONBAR))
|
---|
1612 | return;
|
---|
1613 | }
|
---|
1614 |
|
---|
1615 | switch(SHORT1FROMMP(mp1)) {
|
---|
1616 | case 0:
|
---|
1617 | {
|
---|
1618 | HWND hwndNow;
|
---|
1619 | MENUITEM mi;
|
---|
1620 | ULONG ulStyle;
|
---|
1621 |
|
---|
1622 | memset(&mi,0,sizeof(mi));
|
---|
1623 | mi.iPosition = MIT_END;
|
---|
1624 | mi.afStyle = MIS_TEXT;
|
---|
1625 | WinSendMsg(hwndMenu,MM_QUERYITEM,
|
---|
1626 | MPFROM2SHORT(IDM_FILESMENU,TRUE),MPFROMP(&mi));
|
---|
1627 | if(!DefMenu)
|
---|
1628 | DefMenu = WinLoadMenu(HWND_DESKTOP,FM3ModHandle,DEFMENU);
|
---|
1629 | hwndNow = mi.hwndSubMenu;
|
---|
1630 | mi.hwndSubMenu = hwndNew;
|
---|
1631 | if(!mi.hwndSubMenu)
|
---|
1632 | mi.hwndSubMenu = DefMenu;
|
---|
1633 | WinSetParent(hwndNow,WinQueryObjectWindow(HWND_DESKTOP),FALSE);
|
---|
1634 | WinSetOwner(hwndNow,WinQueryObjectWindow(HWND_DESKTOP));
|
---|
1635 | WinSetOwner(mi.hwndSubMenu,hwndMenu);
|
---|
1636 | WinSetParent(mi.hwndSubMenu,hwndMenu,FALSE);
|
---|
1637 | WinSetWindowUShort(mi.hwndSubMenu,QWS_ID,IDM_FILESMENU);
|
---|
1638 | mi.afStyle = MIS_SUBMENU;
|
---|
1639 | ulStyle = WinQueryWindowULong(mi.hwndSubMenu,QWL_STYLE);
|
---|
1640 | ulStyle &= -WS_SAVEBITS;
|
---|
1641 | ulStyle |= MS_POPUP | WS_CLIPSIBLINGS | WS_SAVEBITS;
|
---|
1642 | WinSetWindowULong(mi.hwndSubMenu,QWL_STYLE,ulStyle);
|
---|
1643 | WinSendMsg(hwndMenu,MM_SETITEM,MPFROM2SHORT(0,TRUE),MPFROMP(&mi));
|
---|
1644 | }
|
---|
1645 | break;
|
---|
1646 |
|
---|
1647 | case 1:
|
---|
1648 | {
|
---|
1649 | HWND hwndNow;
|
---|
1650 | MENUITEM mi;
|
---|
1651 | ULONG ulStyle;
|
---|
1652 |
|
---|
1653 | memset(&mi,0,sizeof(mi));
|
---|
1654 | mi.iPosition = MIT_END;
|
---|
1655 | mi.afStyle = MIS_TEXT;
|
---|
1656 | WinSendMsg(hwndMenu,MM_QUERYITEM,
|
---|
1657 | MPFROM2SHORT(IDM_VIEWSMENU,TRUE),MPFROMP(&mi));
|
---|
1658 | if(!DefMenu)
|
---|
1659 | DefMenu = WinLoadMenu(HWND_DESKTOP,FM3ModHandle,DEFMENU);
|
---|
1660 | hwndNow = mi.hwndSubMenu;
|
---|
1661 | mi.hwndSubMenu = hwndNew;
|
---|
1662 | if(!mi.hwndSubMenu)
|
---|
1663 | mi.hwndSubMenu = DefMenu;
|
---|
1664 | WinSetParent(hwndNow,WinQueryObjectWindow(HWND_DESKTOP),FALSE);
|
---|
1665 | WinSetOwner(hwndNow,WinQueryObjectWindow(HWND_DESKTOP));
|
---|
1666 | WinSetOwner(mi.hwndSubMenu,hwndMenu);
|
---|
1667 | WinSetParent(mi.hwndSubMenu,hwndMenu,FALSE);
|
---|
1668 | WinSetWindowUShort(mi.hwndSubMenu,QWS_ID,IDM_VIEWSMENU);
|
---|
1669 | mi.afStyle = MIS_SUBMENU;
|
---|
1670 | ulStyle = WinQueryWindowULong(mi.hwndSubMenu,QWL_STYLE);
|
---|
1671 | ulStyle &= -WS_SAVEBITS;
|
---|
1672 | ulStyle |= MS_POPUP | WS_CLIPSIBLINGS | WS_SAVEBITS;
|
---|
1673 | WinSetWindowULong(mi.hwndSubMenu,QWL_STYLE,ulStyle);
|
---|
1674 | WinSendMsg(hwndMenu,MM_SETITEM,MPFROM2SHORT(0,TRUE),MPFROMP(&mi));
|
---|
1675 | }
|
---|
1676 | break;
|
---|
1677 | }
|
---|
1678 | }
|
---|
1679 |
|
---|
1680 |
|
---|
1681 | HWND CheckMenu (HWND *hwndMenu,USHORT id) {
|
---|
1682 |
|
---|
1683 | /* load and adjust menus as required */
|
---|
1684 |
|
---|
1685 | if(!*hwndMenu || !WinIsWindow((HAB)0,*hwndMenu)) {
|
---|
1686 | *hwndMenu = WinLoadMenu(HWND_DESKTOP,FM3ModHandle,id);
|
---|
1687 | if(hwndMenu == &DirMenu) {
|
---|
1688 | WinSetWindowUShort(DirMenu,QWS_ID,IDM_FILESMENU);
|
---|
1689 | SetConditionalCascade(DirMenu,IDM_COMMANDSMENU,IDM_DOITYOURSELF);
|
---|
1690 | SetConditionalCascade(DirMenu,IDM_COPYMENU,IDM_COPY);
|
---|
1691 | SetConditionalCascade(DirMenu,IDM_MOVEMENU,IDM_MOVE);
|
---|
1692 | SetConditionalCascade(DirMenu,IDM_SAVESUBMENU,IDM_SAVETOCLIP);
|
---|
1693 | SetConditionalCascade(DirMenu,IDM_VIEWSUBMENU,IDM_INFO);
|
---|
1694 | SetConditionalCascade(DirMenu,IDM_EDITSUBMENU,IDM_ATTRS);
|
---|
1695 | SetConditionalCascade(DirMenu,IDM_DELETESUBMENU,(fDefaultDeletePerm) ?
|
---|
1696 | IDM_PERMDELETE :
|
---|
1697 | IDM_DELETE);
|
---|
1698 | SetConditionalCascade(DirMenu,IDM_MISCSUBMENU,IDM_SIZES);
|
---|
1699 | SetConditionalCascade(DirMenu,IDM_OPENSUBMENU,IDM_OPENWINDOW);
|
---|
1700 | if(fWorkPlace) {
|
---|
1701 | WinSendMsg(DirMenu,MM_DELETEITEM,
|
---|
1702 | MPFROM2SHORT(IDM_OPENSUBMENU,TRUE),MPVOID);
|
---|
1703 | WinSendMsg(DirMenu,MM_DELETEITEM,
|
---|
1704 | MPFROM2SHORT(IDM_OBJECTSUBMENU,TRUE),MPVOID);
|
---|
1705 | }
|
---|
1706 | }
|
---|
1707 | else if(hwndMenu == &TreeMenu) {
|
---|
1708 | WinSetWindowUShort(TreeMenu,QWS_ID,IDM_FILESMENU);
|
---|
1709 | SetConditionalCascade(TreeMenu,IDM_COMMANDSMENU,IDM_DOITYOURSELF);
|
---|
1710 | SetConditionalCascade(TreeMenu,IDM_SAVESUBMENU,IDM_SAVETOCLIP);
|
---|
1711 | SetConditionalCascade(TreeMenu,IDM_EDITSUBMENU,IDM_ATTRS);
|
---|
1712 | SetConditionalCascade(TreeMenu,IDM_EXPANDSUBMENU,IDM_EXPAND);
|
---|
1713 | SetConditionalCascade(TreeMenu,IDM_MISCSUBMENU,IDM_SIZES);
|
---|
1714 | SetConditionalCascade(TreeMenu,IDM_OPENSUBMENU,IDM_OPENWINDOW);
|
---|
1715 | if(fWorkPlace) {
|
---|
1716 | WinSendMsg(TreeMenu,MM_DELETEITEM,
|
---|
1717 | MPFROM2SHORT(IDM_OPENSUBMENU,TRUE),MPVOID);
|
---|
1718 | WinSendMsg(TreeMenu,MM_DELETEITEM,
|
---|
1719 | MPFROM2SHORT(IDM_OBJECTSUBMENU,TRUE),MPVOID);
|
---|
1720 | }
|
---|
1721 | }
|
---|
1722 | else if(hwndMenu == &ArcMenu) {
|
---|
1723 | WinSetWindowUShort(ArcMenu,QWS_ID,IDM_FILESMENU);
|
---|
1724 | SetConditionalCascade(ArcMenu,IDM_EXTRACTSUBMENU,IDM_EXTRACT);
|
---|
1725 | SetConditionalCascade(ArcMenu,IDM_EDITSUBMENU,IDM_EDIT);
|
---|
1726 | SetConditionalCascade(ArcMenu,IDM_VIEWSUBMENU,IDM_VIEW);
|
---|
1727 | if(fWorkPlace)
|
---|
1728 | WinSendMsg(ArcMenu,MM_DELETEITEM,
|
---|
1729 | MPFROM2SHORT(IDM_FOLDERAFTEREXTRACT,TRUE),MPVOID);
|
---|
1730 | }
|
---|
1731 | else if(hwndMenu == &FileMenu) {
|
---|
1732 | WinSetWindowUShort(FileMenu,QWS_ID,IDM_FILESMENU);
|
---|
1733 | SetConditionalCascade(FileMenu,IDM_COMMANDSMENU,IDM_DOITYOURSELF);
|
---|
1734 | SetConditionalCascade(FileMenu,IDM_COPYMENU,IDM_COPY);
|
---|
1735 | SetConditionalCascade(FileMenu,IDM_MOVEMENU,IDM_MOVE);
|
---|
1736 | SetConditionalCascade(FileMenu,IDM_SAVESUBMENU,IDM_SAVETOCLIP);
|
---|
1737 | SetConditionalCascade(FileMenu,IDM_VIEWSUBMENU,IDM_VIEW);
|
---|
1738 | SetConditionalCascade(FileMenu,IDM_EDITSUBMENU,IDM_EDIT);
|
---|
1739 | SetConditionalCascade(FileMenu,IDM_COLLECTMENU,IDM_COLLECT);
|
---|
1740 | SetConditionalCascade(FileMenu,IDM_DELETESUBMENU,(fDefaultDeletePerm) ?
|
---|
1741 | IDM_PERMDELETE :
|
---|
1742 | IDM_DELETE);
|
---|
1743 | SetConditionalCascade(FileMenu,IDM_OPENSUBMENU,IDM_OPENDEFAULT);
|
---|
1744 | SetConditionalCascade(FileMenu,IDM_OBJECTSUBMENU,IDM_SHADOW);
|
---|
1745 | if(fWorkPlace) {
|
---|
1746 | WinSendMsg(FileMenu,MM_DELETEITEM,
|
---|
1747 | MPFROM2SHORT(IDM_OPENSUBMENU,TRUE),MPVOID);
|
---|
1748 | WinSendMsg(FileMenu,MM_DELETEITEM,
|
---|
1749 | MPFROM2SHORT(IDM_OBJECTSUBMENU,TRUE),MPVOID);
|
---|
1750 | }
|
---|
1751 | }
|
---|
1752 | else if(hwndMenu == &DirCnrMenu) {
|
---|
1753 | WinSetWindowUShort(DirCnrMenu,QWS_ID,IDM_VIEWSMENU);
|
---|
1754 | SetConditionalCascade(DirCnrMenu,IDM_MISCSUBMENU,IDM_SIZES);
|
---|
1755 | SetConditionalCascade(DirCnrMenu,IDM_OPENSUBMENU,IDM_OPENSETTINGSME);
|
---|
1756 | if(fWorkPlace)
|
---|
1757 | WinSendMsg(DirCnrMenu,MM_DELETEITEM,
|
---|
1758 | MPFROM2SHORT(IDM_OPENSUBMENU,TRUE),MPVOID);
|
---|
1759 | }
|
---|
1760 | else if(hwndMenu == &TreeCnrMenu)
|
---|
1761 | WinSetWindowUShort(TreeCnrMenu,QWS_ID,IDM_VIEWSMENU);
|
---|
1762 | else if(hwndMenu == &ArcCnrMenu) {
|
---|
1763 | WinSetWindowUShort(ArcCnrMenu,QWS_ID,IDM_VIEWSMENU);
|
---|
1764 | SetConditionalCascade(ArcCnrMenu,IDM_EXTRACTSUBMENU,IDM_ARCEXTRACT);
|
---|
1765 | if(fWorkPlace)
|
---|
1766 | WinSendMsg(ArcCnrMenu,MM_DELETEITEM,
|
---|
1767 | MPFROM2SHORT(IDM_FOLDERAFTEREXTRACT,TRUE),MPVOID);
|
---|
1768 | }
|
---|
1769 | else if(hwndMenu == &CollectorCnrMenu) {
|
---|
1770 | WinSetWindowUShort(CollectorCnrMenu,QWS_ID,IDM_VIEWSMENU);
|
---|
1771 | SetConditionalCascade(CollectorCnrMenu,IDM_COLLECTMENU,
|
---|
1772 | IDM_COLLECTFROMCLIP);
|
---|
1773 | }
|
---|
1774 | else if(hwndMenu == &CollectorFileMenu) {
|
---|
1775 | WinSetWindowUShort(CollectorFileMenu,QWS_ID,IDM_FILESMENU);
|
---|
1776 | SetConditionalCascade(CollectorFileMenu,IDM_COMMANDSMENU,
|
---|
1777 | IDM_DOITYOURSELF);
|
---|
1778 | SetConditionalCascade(CollectorFileMenu,IDM_COPYMENU,IDM_COPY);
|
---|
1779 | SetConditionalCascade(CollectorFileMenu,IDM_MOVEMENU,IDM_MOVE);
|
---|
1780 | SetConditionalCascade(CollectorFileMenu,IDM_SAVESUBMENU,IDM_SAVETOCLIP);
|
---|
1781 | SetConditionalCascade(CollectorFileMenu,IDM_VIEWSUBMENU,IDM_VIEW);
|
---|
1782 | SetConditionalCascade(CollectorFileMenu,IDM_EDITSUBMENU,IDM_EDIT);
|
---|
1783 | SetConditionalCascade(CollectorFileMenu,IDM_DELETESUBMENU,(fDefaultDeletePerm) ?
|
---|
1784 | IDM_PERMDELETE :
|
---|
1785 | IDM_DELETE);
|
---|
1786 | SetConditionalCascade(CollectorFileMenu,IDM_OPENSUBMENU,IDM_OPENDEFAULT);
|
---|
1787 | SetConditionalCascade(CollectorFileMenu,IDM_OBJECTSUBMENU,IDM_SHADOW);
|
---|
1788 | if(fWorkPlace) {
|
---|
1789 | WinSendMsg(CollectorFileMenu,MM_DELETEITEM,
|
---|
1790 | MPFROM2SHORT(IDM_OPENSUBMENU,TRUE),MPVOID);
|
---|
1791 | WinSendMsg(CollectorFileMenu,MM_DELETEITEM,
|
---|
1792 | MPFROM2SHORT(IDM_OBJECTSUBMENU,TRUE),MPVOID);
|
---|
1793 | }
|
---|
1794 | }
|
---|
1795 | else if(hwndMenu == &CollectorDirMenu) {
|
---|
1796 | WinSetWindowUShort(CollectorDirMenu,QWS_ID,IDM_FILESMENU);
|
---|
1797 | SetConditionalCascade(CollectorDirMenu,IDM_COMMANDSMENU,
|
---|
1798 | IDM_DOITYOURSELF);
|
---|
1799 | SetConditionalCascade(CollectorDirMenu,IDM_COPYMENU,IDM_COPY);
|
---|
1800 | SetConditionalCascade(CollectorDirMenu,IDM_MOVEMENU,IDM_MOVE);
|
---|
1801 | SetConditionalCascade(CollectorDirMenu,IDM_SAVESUBMENU,IDM_SAVETOCLIP);
|
---|
1802 | SetConditionalCascade(CollectorDirMenu,IDM_VIEWSUBMENU,IDM_INFO);
|
---|
1803 | SetConditionalCascade(CollectorDirMenu,IDM_EDITSUBMENU,IDM_ATTRS);
|
---|
1804 | SetConditionalCascade(CollectorDirMenu,IDM_DELETESUBMENU,(fDefaultDeletePerm) ?
|
---|
1805 | IDM_PERMDELETE :
|
---|
1806 | IDM_DELETE);
|
---|
1807 | SetConditionalCascade(CollectorDirMenu,IDM_MISCSUBMENU,IDM_SIZES);
|
---|
1808 | SetConditionalCascade(CollectorDirMenu,IDM_OPENSUBMENU,IDM_OPENWINDOW);
|
---|
1809 | if(fWorkPlace) {
|
---|
1810 | WinSendMsg(CollectorDirMenu,MM_DELETEITEM,
|
---|
1811 | MPFROM2SHORT(IDM_OPENSUBMENU,TRUE),MPVOID);
|
---|
1812 | WinSendMsg(CollectorDirMenu,MM_DELETEITEM,
|
---|
1813 | MPFROM2SHORT(IDM_OBJECTSUBMENU,TRUE),MPVOID);
|
---|
1814 | }
|
---|
1815 | }
|
---|
1816 | else if(hwndMenu == &MainPopupMenu) {
|
---|
1817 | WinSetWindowUShort(MainPopupMenu,QWS_ID,IDM_MAINPOPUP);
|
---|
1818 | SetConditionalCascade(MainPopupMenu,IDM_TOOLSUBMENU,IDM_TOOLBAR);
|
---|
1819 | SetConditionalCascade(MainPopupMenu,IDM_AUTOVIEWSUBMENU,IDM_AUTOVIEW);
|
---|
1820 | }
|
---|
1821 | }
|
---|
1822 | return *hwndMenu;
|
---|
1823 | }
|
---|
1824 |
|
---|
1825 |
|
---|
1826 | SHORT AddToListboxBottom (HWND hwnd,CHAR *str) {
|
---|
1827 |
|
---|
1828 | SHORT ln;
|
---|
1829 |
|
---|
1830 | ln = (SHORT)WinSendMsg(hwnd,LM_INSERTITEM,MPFROM2SHORT(LIT_END,0),
|
---|
1831 | MPFROMP(str));
|
---|
1832 | if(ln)
|
---|
1833 | WinSendMsg(hwnd,LM_SELECTITEM,MPFROM2SHORT(ln,0),MPVOID);
|
---|
1834 | return ln;
|
---|
1835 | }
|
---|
1836 |
|
---|
1837 |
|
---|
1838 | VOID SetSysMenu (HWND hwndSysMenu) {
|
---|
1839 |
|
---|
1840 | CHAR s[128],*p;
|
---|
1841 |
|
---|
1842 | if(WinSendMsg(hwndSysMenu,MM_QUERYITEMTEXT,
|
---|
1843 | MPFROM2SHORT(SC_RESTORE,128),
|
---|
1844 | MPFROMP(s))) {
|
---|
1845 | p = strchr(s,'\t');
|
---|
1846 | if(p) {
|
---|
1847 | p++;
|
---|
1848 | strcpy(p,"Ctrl+Alt+F5");
|
---|
1849 | WinSetMenuItemText(hwndSysMenu,SC_RESTORE,s);
|
---|
1850 | }
|
---|
1851 | }
|
---|
1852 | if(WinSendMsg(hwndSysMenu,MM_QUERYITEMTEXT,
|
---|
1853 | MPFROM2SHORT(SC_CLOSE,128),
|
---|
1854 | MPFROMP(s))) {
|
---|
1855 | p = strchr(s,'\t');
|
---|
1856 | if(p) {
|
---|
1857 | p++;
|
---|
1858 | strcpy(p,"Ctrl+Alt+F4");
|
---|
1859 | WinSetMenuItemText(hwndSysMenu,SC_CLOSE,s);
|
---|
1860 | }
|
---|
1861 | }
|
---|
1862 | if(WinSendMsg(hwndSysMenu,MM_QUERYITEMTEXT,
|
---|
1863 | MPFROM2SHORT(SC_MOVE,128),
|
---|
1864 | MPFROMP(s))) {
|
---|
1865 | p = strchr(s,'\t');
|
---|
1866 | if(p) {
|
---|
1867 | p++;
|
---|
1868 | strcpy(p,"Ctrl+Alt+F7");
|
---|
1869 | WinSetMenuItemText(hwndSysMenu,SC_MOVE,s);
|
---|
1870 | }
|
---|
1871 | }
|
---|
1872 | if(WinSendMsg(hwndSysMenu,MM_QUERYITEMTEXT,
|
---|
1873 | MPFROM2SHORT(SC_SIZE,128),
|
---|
1874 | MPFROMP(s))) {
|
---|
1875 | p = strchr(s,'\t');
|
---|
1876 | if(p) {
|
---|
1877 | p++;
|
---|
1878 | strcpy(p,"Ctrl+Alt+F8");
|
---|
1879 | WinSetMenuItemText(hwndSysMenu,SC_SIZE,s);
|
---|
1880 | }
|
---|
1881 | }
|
---|
1882 | if(WinSendMsg(hwndSysMenu,MM_QUERYITEMTEXT,
|
---|
1883 | MPFROM2SHORT(SC_MINIMIZE,128),
|
---|
1884 | MPFROMP(s))) {
|
---|
1885 | p = strchr(s,'\t');
|
---|
1886 | if(p) {
|
---|
1887 | p++;
|
---|
1888 | strcpy(p,"Ctrl+Alt+F9");
|
---|
1889 | WinSetMenuItemText(hwndSysMenu,SC_MINIMIZE,s);
|
---|
1890 | }
|
---|
1891 | }
|
---|
1892 | if(WinSendMsg(hwndSysMenu,
|
---|
1893 | MM_QUERYITEMTEXT,
|
---|
1894 | MPFROM2SHORT(SC_MAXIMIZE,128),
|
---|
1895 | MPFROMP(s))) {
|
---|
1896 | p = strchr(s,'\t');
|
---|
1897 | if(p) {
|
---|
1898 | p++;
|
---|
1899 | strcpy(p,"Ctrl+Alt+F10");
|
---|
1900 | WinSetMenuItemText(hwndSysMenu,
|
---|
1901 | SC_MAXIMIZE,
|
---|
1902 | s);
|
---|
1903 | }
|
---|
1904 | }
|
---|
1905 | if(WinSendMsg(hwndSysMenu,
|
---|
1906 | MM_QUERYITEMTEXT,
|
---|
1907 | MPFROM2SHORT(SC_HIDE,128),
|
---|
1908 | MPFROMP(s))) {
|
---|
1909 | p = strchr(s,'\t');
|
---|
1910 | if(p) {
|
---|
1911 | p++;
|
---|
1912 | strcpy(p,"Ctrl+Alt+F11");
|
---|
1913 | WinSetMenuItemText(hwndSysMenu,SC_HIDE,s);
|
---|
1914 | }
|
---|
1915 | }
|
---|
1916 | }
|
---|
1917 |
|
---|
1918 |
|
---|
1919 | VOID LoadLibPath (CHAR *str,LONG len) {
|
---|
1920 |
|
---|
1921 | ULONG ver[2];
|
---|
1922 | CHAR configsys[] = "C:\\CONFIG.SYS";
|
---|
1923 | static CHAR var[8192],beg[16384],end[16384];
|
---|
1924 | BOOL warp;
|
---|
1925 | FILE *fp;
|
---|
1926 | PFN DQELIBPATH = NULL;
|
---|
1927 | HMODULE hmod;
|
---|
1928 |
|
---|
1929 | if(str && len) {
|
---|
1930 | *str = 0;
|
---|
1931 | if(DosQuerySysInfo(QSV_BOOT_DRIVE,
|
---|
1932 | QSV_BOOT_DRIVE,
|
---|
1933 | (PVOID)ver,
|
---|
1934 | (ULONG)sizeof(ULONG)))
|
---|
1935 | ver[0] = 3L;
|
---|
1936 | *configsys = (CHAR)ver[0] + '@';
|
---|
1937 | if(!DosQuerySysInfo(QSV_VERSION_MAJOR,
|
---|
1938 | QSV_VERSION_MINOR,
|
---|
1939 | (PVOID)ver,(ULONG)sizeof(ver)) &&
|
---|
1940 | ver[1] >= 30)
|
---|
1941 | warp = TRUE;
|
---|
1942 | *var = *beg = *end = 0;
|
---|
1943 | if(warp) {
|
---|
1944 | if(!DosLoadModule(var,
|
---|
1945 | sizeof(var),
|
---|
1946 | "DOSCALL1.DLL",&hmod)) {
|
---|
1947 | if(!DosQueryProcAddr(hmod,
|
---|
1948 | ORD_DOS32QUERYEXTLIBPATH,
|
---|
1949 | NULL,
|
---|
1950 | (PFN *)&DQELIBPATH)) {
|
---|
1951 | DQELIBPATH(beg,BEGIN_LIBPATH);
|
---|
1952 | DQELIBPATH(end,END_LIBPATH);
|
---|
1953 | }
|
---|
1954 | DosFreeModule(hmod);
|
---|
1955 | }
|
---|
1956 | *var = 0;
|
---|
1957 | }
|
---|
1958 | fp = fopen(configsys,"r");
|
---|
1959 | if(fp) {
|
---|
1960 | while(!feof(fp)) {
|
---|
1961 | if(!fgets(var,8192,fp))
|
---|
1962 | break;
|
---|
1963 | var[8192] = 0;
|
---|
1964 | stripcr(var);
|
---|
1965 | lstrip(rstrip(var));
|
---|
1966 | if(!strnicmp(var,"LIBPATH=",8)) {
|
---|
1967 | memmove(var,var + 8,strlen(var + 8) + 1);
|
---|
1968 | lstrip(var);
|
---|
1969 | break;
|
---|
1970 | }
|
---|
1971 | }
|
---|
1972 | fclose(fp);
|
---|
1973 | }
|
---|
1974 | strncpy(str,beg,len);
|
---|
1975 | strncat(str,var,len - strlen(str));
|
---|
1976 | strncat(str,end,len - strlen(str));
|
---|
1977 | str[len - 1] = 0;
|
---|
1978 | }
|
---|
1979 | }
|
---|
1980 |
|
---|
1981 |
|
---|
1982 | void SetViewMenu (HWND hwndMenu, ULONG flWindowAttr) {
|
---|
1983 |
|
---|
1984 | WinCheckMenuItem(hwndMenu,IDM_MINIICONS,((flWindowAttr & CV_MINI)));
|
---|
1985 | WinCheckMenuItem(hwndMenu,IDM_TEXT,((flWindowAttr & CV_TEXT)));
|
---|
1986 | WinCheckMenuItem(hwndMenu,IDM_ICON,((flWindowAttr & CV_ICON) &&
|
---|
1987 | !(flWindowAttr & CV_TREE)));
|
---|
1988 | WinCheckMenuItem(hwndMenu,IDM_TREEVIEW,((flWindowAttr & CV_TREE)));
|
---|
1989 | WinCheckMenuItem(hwndMenu,IDM_DETAILS,((flWindowAttr & CV_DETAIL)));
|
---|
1990 | WinCheckMenuItem(hwndMenu,IDM_NAME,((flWindowAttr & CV_NAME)));
|
---|
1991 | }
|
---|
1992 |
|
---|
1993 |
|
---|
1994 | void SaySort (HWND hwnd, INT sortflags, BOOL archive) {
|
---|
1995 |
|
---|
1996 | char *s = NULL;
|
---|
1997 |
|
---|
1998 | s = malloc(CCHMAXPATH);
|
---|
1999 | if(s) {
|
---|
2000 | sprintf(s,"S:%s%s",
|
---|
2001 | (sortflags & SORT_REVERSE) ? "^" : NullStr,
|
---|
2002 | (sortflags & SORT_FIRSTEXTENSION) ? GetPString(IDS_FIRSTX) :
|
---|
2003 | (sortflags & SORT_LASTEXTENSION) ? GetPString(IDS_LASTX) :
|
---|
2004 | (sortflags & SORT_SIZE) ? "Size" :
|
---|
2005 | (sortflags & SORT_EASIZE) ? (archive == 0) ? GetPString(IDS_EASIZE) : GetPString(IDS_CSIZE) :
|
---|
2006 | (sortflags & SORT_LWDATE) ? (archive == 0) ? GetPString(IDS_LWDATE) : GetPString(IDS_DATE) :
|
---|
2007 | (sortflags & SORT_LADATE) ? GetPString(IDS_LADATE) :
|
---|
2008 | (sortflags & SORT_CRDATE) ? GetPString(IDS_CRDATE) :
|
---|
2009 | (sortflags & SORT_PATHNAME) ? GetPString(IDS_PATH) :
|
---|
2010 | (sortflags & SORT_NOSORT) ? GetPString(IDS_NONE) :
|
---|
2011 | (sortflags & SORT_SUBJECT) ? GetPString(IDS_SUBJ) :
|
---|
2012 | GetPString(IDS_NAME));
|
---|
2013 | WinSetWindowText(hwnd,s);
|
---|
2014 | free(s);
|
---|
2015 | }
|
---|
2016 | }
|
---|
2017 |
|
---|
2018 | void SayView (HWND hwnd,ULONG flWindowAttr) {
|
---|
2019 |
|
---|
2020 | char *s = NULL;
|
---|
2021 |
|
---|
2022 | s = malloc(CCHMAXPATH);
|
---|
2023 | if(s) {
|
---|
2024 | sprintf(s,"V:%s%s",
|
---|
2025 | (flWindowAttr & CV_TREE) ? GetPString(IDS_TREE) :
|
---|
2026 | (flWindowAttr & CV_NAME) ? GetPString(IDS_NAME) :
|
---|
2027 | (flWindowAttr & CV_DETAIL) ? GetPString(IDS_DETAIL) :
|
---|
2028 | (flWindowAttr & CV_TEXT) ? GetPString(IDS_TEXT) :
|
---|
2029 | GetPString(IDS_ICON),
|
---|
2030 | ((flWindowAttr & CV_MINI) &&
|
---|
2031 | !(flWindowAttr & CV_TEXT)) ? GetPString(IDS_MINI) : NullStr);
|
---|
2032 | WinSetWindowText(hwnd,s);
|
---|
2033 | free(s);
|
---|
2034 | }
|
---|
2035 | }
|
---|
2036 |
|
---|
2037 | void SayFilter (HWND hwnd, MASK *mask, BOOL archive) {
|
---|
2038 |
|
---|
2039 | char *s = NULL;
|
---|
2040 |
|
---|
2041 | s = malloc(CCHMAXPATH * 2);
|
---|
2042 | if(s) {
|
---|
2043 | sprintf(s,"F:%s%s",
|
---|
2044 | mask->szMask,
|
---|
2045 | (!archive && (mask->attrFile != ALLATTRS ||
|
---|
2046 | mask->antiattr != 0)) ? " " : NullStr,
|
---|
2047 | (!archive && (mask->attrFile != ALLATTRS ||
|
---|
2048 | mask->antiattr != 0)) ? GetPString(IDS_ATTRTEXT) : NullStr);
|
---|
2049 | if(!s[2])
|
---|
2050 | sprintf(s,"F:%s",GetPString(IDS_ALLTEXT));
|
---|
2051 | WinSetWindowText(hwnd,s);
|
---|
2052 | free(s);
|
---|
2053 | }
|
---|
2054 | }
|
---|
2055 |
|
---|
2056 |
|
---|
2057 | char *GetCmdSpec (BOOL dos) {
|
---|
2058 |
|
---|
2059 | char *cmspec;
|
---|
2060 |
|
---|
2061 | if(!dos) {
|
---|
2062 | cmspec = getenv("OS2_SHELL");
|
---|
2063 | if(!cmspec)
|
---|
2064 | cmspec = getenv("COMSPEC");
|
---|
2065 | if(!cmspec)
|
---|
2066 | cmspec = "CMD.EXE";
|
---|
2067 | }
|
---|
2068 | else {
|
---|
2069 | cmspec = getenv("DOS_SHELL");
|
---|
2070 | if(!cmspec)
|
---|
2071 | cmspec = "COMMAND.COM";
|
---|
2072 | }
|
---|
2073 | return cmspec;
|
---|
2074 | }
|
---|
2075 |
|
---|
2076 |
|
---|
2077 | void Broadcast (HAB hab,HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
2078 |
|
---|
2079 | if(hwndMain)
|
---|
2080 | WinBroadcastMsg(hwndMain,
|
---|
2081 | msg,
|
---|
2082 | mp1,
|
---|
2083 | mp2,
|
---|
2084 | BMSG_SEND | BMSG_FRAMEONLY);
|
---|
2085 | if(hwnd &&
|
---|
2086 | hwnd != HWND_DESKTOP &&
|
---|
2087 | hwnd != hwndMain &&
|
---|
2088 | hwnd != WinQueryDesktopWindow(hab,NULLHANDLE) &&
|
---|
2089 | WinIsWindow(hab,hwnd) &&
|
---|
2090 | (!hwndMain ||
|
---|
2091 | !WinIsChild(hwnd,hwndMain)))
|
---|
2092 | WinSendMsg(hwnd,
|
---|
2093 | msg,
|
---|
2094 | mp1,
|
---|
2095 | mp2);
|
---|
2096 | }
|
---|
2097 |
|
---|
2098 |
|
---|
2099 | void SetupWinList (HWND hwndMenu,HWND hwndTop,HWND hwndFrame) {
|
---|
2100 |
|
---|
2101 | /*
|
---|
2102 | * add switchlist entries to end of pulldown menu
|
---|
2103 | */
|
---|
2104 |
|
---|
2105 | SHORT sItemCount,x = 0,y = 0;
|
---|
2106 | MENUITEM mi;
|
---|
2107 |
|
---|
2108 | sItemCount = (SHORT)WinSendMsg(hwndMenu,
|
---|
2109 | MM_QUERYITEMCOUNT,
|
---|
2110 | MPVOID,
|
---|
2111 | MPVOID);
|
---|
2112 |
|
---|
2113 | /* clean out old additions */
|
---|
2114 | while((SHORT)WinSendMsg(hwndMenu,
|
---|
2115 | MM_DELETEITEM,
|
---|
2116 | MPFROM2SHORT(IDM_SWITCHSTART + x++,
|
---|
2117 | TRUE),
|
---|
2118 | MPVOID) < sItemCount)
|
---|
2119 | sItemCount--;
|
---|
2120 | x = 0;
|
---|
2121 | while((SHORT)WinSendMsg(hwndMenu,
|
---|
2122 | MM_DELETEITEM,
|
---|
2123 | MPFROM2SHORT(IDM_WINDOWSTART + x++,
|
---|
2124 | TRUE),
|
---|
2125 | MPVOID) < sItemCount)
|
---|
2126 | sItemCount--;
|
---|
2127 |
|
---|
2128 | x = 0;
|
---|
2129 | if(hwndTop) {
|
---|
2130 |
|
---|
2131 | char wtext[CCHMAXPATH + 8];
|
---|
2132 | HENUM henum;
|
---|
2133 | HWND hwndChild;
|
---|
2134 |
|
---|
2135 | /* add children of the main FM/2 client */
|
---|
2136 | henum = WinBeginEnumWindows(hwndTop);
|
---|
2137 | memset(&mi,0,sizeof(mi));
|
---|
2138 | while((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
2139 | if(WinQueryWindowUShort(hwndChild,QWS_ID) &&
|
---|
2140 | hwndChild != hwndFrame) {
|
---|
2141 | *wtext = 0;
|
---|
2142 | WinQueryWindowText(hwndChild,
|
---|
2143 | CCHMAXPATH + 8,
|
---|
2144 | wtext);
|
---|
2145 | if(*wtext) {
|
---|
2146 | wtext[CCHMAXPATH + 7] = 0;
|
---|
2147 | mi.afStyle = MIS_TEXT;
|
---|
2148 | if(!((x + sItemCount) % 28))
|
---|
2149 | mi.afStyle |= MIS_BREAK;
|
---|
2150 | mi.id = IDM_WINDOWSTART + x;
|
---|
2151 | mi.iPosition = MIT_END;
|
---|
2152 | if((SHORT)WinSendMsg(hwndMenu,
|
---|
2153 | MM_INSERTITEM,
|
---|
2154 | MPFROMP(&mi),
|
---|
2155 | MPFROMP(wtext)) >= 0)
|
---|
2156 | x++;
|
---|
2157 | }
|
---|
2158 | }
|
---|
2159 | }
|
---|
2160 | WinEndEnumWindows(henum);
|
---|
2161 | }
|
---|
2162 |
|
---|
2163 | /* add external FM/2 windows */
|
---|
2164 | {
|
---|
2165 | PSWBLOCK pswb;
|
---|
2166 | ULONG ulSize,ulcEntries;
|
---|
2167 | HWND hwndTopFrame;
|
---|
2168 | register INT i;
|
---|
2169 |
|
---|
2170 | hwndTopFrame = (hwndTop) ? WinQueryWindow(hwndTop,QW_PARENT) : (HWND)0;
|
---|
2171 | /* Get the switch list information */
|
---|
2172 | x = 0;
|
---|
2173 | ulcEntries = WinQuerySwitchList(0,NULL,0);
|
---|
2174 | ulSize = sizeof(SWBLOCK) + sizeof(HSWITCH) + (ulcEntries + 4L) *
|
---|
2175 | (LONG)sizeof(SWENTRY);
|
---|
2176 | /* Allocate memory for list */
|
---|
2177 | if((pswb = malloc((unsigned)ulSize)) != NULL) {
|
---|
2178 | /* Put the info in the list */
|
---|
2179 | ulcEntries = WinQuerySwitchList(0,pswb,
|
---|
2180 | ulSize - sizeof(SWENTRY));
|
---|
2181 | /* do the dirty deed */
|
---|
2182 | memset(&mi,0,sizeof(mi));
|
---|
2183 | for(i = 0;i < pswb->cswentry;i++) {
|
---|
2184 | if(pswb->aswentry[i].swctl.uchVisibility == SWL_VISIBLE &&
|
---|
2185 | pswb->aswentry[i].swctl.fbJump == SWL_JUMPABLE &&
|
---|
2186 | (pswb->aswentry[i].swctl.idProcess != mypid ||
|
---|
2187 | !hwndFrame ||
|
---|
2188 | pswb->aswentry[i].swctl.hwnd != hwndFrame) &&
|
---|
2189 | (pswb->aswentry[i].swctl.idProcess != mypid ||
|
---|
2190 | !hwndTopFrame ||
|
---|
2191 | pswb->aswentry[i].swctl.hwnd != hwndTopFrame ||
|
---|
2192 | !WinIsChild(hwndFrame,hwndTop))) {
|
---|
2193 | if(!strnicmp(pswb->aswentry[i].swctl.szSwtitle,"AV/2",4) ||
|
---|
2194 | !stricmp(pswb->aswentry[i].swctl.szSwtitle,"File Manager/2") ||
|
---|
2195 | !stricmp(pswb->aswentry[i].swctl.szSwtitle,"Collector") ||
|
---|
2196 | !strnicmp(pswb->aswentry[i].swctl.szSwtitle,"VTree",5) ||
|
---|
2197 | !strnicmp(pswb->aswentry[i].swctl.szSwtitle,"VDir",4) ||
|
---|
2198 | !strnicmp(pswb->aswentry[i].swctl.szSwtitle,FM2Str,4)) {
|
---|
2199 | mi.afStyle = MIS_TEXT;
|
---|
2200 | if(x && !(x % 28))
|
---|
2201 | mi.afStyle |= MIS_BREAK;
|
---|
2202 | mi.id = IDM_SWITCHSTART + y;
|
---|
2203 | mi.iPosition = MIT_END;
|
---|
2204 | switches[y] = pswb->aswentry[i].hswitch;
|
---|
2205 | if((SHORT)WinSendMsg(hwndMenu,
|
---|
2206 | MM_INSERTITEM,
|
---|
2207 | MPFROMP(&mi),
|
---|
2208 | MPFROMP(pswb->aswentry[i].swctl.szSwtitle)) >= 0) {
|
---|
2209 | y++;
|
---|
2210 | x++;
|
---|
2211 | }
|
---|
2212 | }
|
---|
2213 | }
|
---|
2214 | }
|
---|
2215 | numswitches = y;
|
---|
2216 | free(pswb);
|
---|
2217 | DosPostEventSem(CompactSem);
|
---|
2218 | }
|
---|
2219 | }
|
---|
2220 | }
|
---|
2221 |
|
---|
2222 |
|
---|
2223 | BOOL SwitchCommand (HWND hwndMenu,USHORT cmd) {
|
---|
2224 |
|
---|
2225 | BOOL ret = FALSE;
|
---|
2226 |
|
---|
2227 | if(hwndMain && hwndMenu &&
|
---|
2228 | cmd >= IDM_WINDOWSTART &&
|
---|
2229 | cmd < IDM_SWITCHSTART) {
|
---|
2230 | /*
|
---|
2231 | * select a child window (of client)
|
---|
2232 | */
|
---|
2233 |
|
---|
2234 | MENUITEM mi;
|
---|
2235 | HWND hwndSubMenu = (HWND)0,hwndChild;
|
---|
2236 | CHAR s[CCHMAXPATH + 8];
|
---|
2237 |
|
---|
2238 | if(WinQueryWindowUShort(hwndMenu,QWS_ID) != IDM_WINDOWSMENU) {
|
---|
2239 | memset(&mi,0,sizeof(mi));
|
---|
2240 | mi.iPosition = MIT_END;
|
---|
2241 | mi.afStyle = MIS_TEXT;
|
---|
2242 | if(WinSendMsg(hwndMenu,
|
---|
2243 | MM_QUERYITEM,
|
---|
2244 | MPFROM2SHORT(IDM_WINDOWSMENU,
|
---|
2245 | TRUE),
|
---|
2246 | MPFROMP(&mi)))
|
---|
2247 | hwndSubMenu = mi.hwndSubMenu;
|
---|
2248 | }
|
---|
2249 | else
|
---|
2250 | hwndSubMenu = hwndMenu;
|
---|
2251 | if(hwndSubMenu) {
|
---|
2252 | *s = 0;
|
---|
2253 | if(WinSendMsg(hwndSubMenu,
|
---|
2254 | MM_QUERYITEMTEXT,
|
---|
2255 | MPFROM2SHORT(cmd,
|
---|
2256 | CCHMAXPATH + 8),
|
---|
2257 | MPFROMP(s)) &&
|
---|
2258 | *s) {
|
---|
2259 |
|
---|
2260 | HENUM henum;
|
---|
2261 | CHAR checkText[CCHMAXPATH + 8];
|
---|
2262 | SWP swp;
|
---|
2263 |
|
---|
2264 | s[CCHMAXPATH + 7] = 0;
|
---|
2265 | henum = WinBeginEnumWindows(hwndMain);
|
---|
2266 | while((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
|
---|
2267 | if(WinQueryWindowUShort(hwndChild,QWS_ID)) {
|
---|
2268 | *checkText = 0;
|
---|
2269 | WinQueryWindowText(hwndChild,
|
---|
2270 | CCHMAXPATH + 8,
|
---|
2271 | checkText);
|
---|
2272 | checkText[CCHMAXPATH + 7] = 0;
|
---|
2273 | if(!stricmp(checkText,s)) {
|
---|
2274 | if(WinQueryWindowPos(hwndChild,
|
---|
2275 | &swp)) {
|
---|
2276 | if(swp.fl & (SWP_MINIMIZE | SWP_HIDE))
|
---|
2277 | WinSetWindowPos(hwndChild,
|
---|
2278 | HWND_TOP,
|
---|
2279 | 0,
|
---|
2280 | 0,
|
---|
2281 | 0,
|
---|
2282 | 0,
|
---|
2283 | SWP_RESTORE | SWP_ZORDER);
|
---|
2284 | }
|
---|
2285 | WinSetActiveWindow(HWND_DESKTOP,
|
---|
2286 | hwndChild);
|
---|
2287 | ret = TRUE;
|
---|
2288 | break;
|
---|
2289 | }
|
---|
2290 | }
|
---|
2291 | }
|
---|
2292 | WinEndEnumWindows(henum);
|
---|
2293 | }
|
---|
2294 | }
|
---|
2295 | }
|
---|
2296 | else if(cmd >= IDM_SWITCHSTART &&
|
---|
2297 | cmd < IDM_SWITCHSTART + 499) {
|
---|
2298 | if(cmd - IDM_SWITCHSTART < numswitches) {
|
---|
2299 | WinSwitchToProgram(switches[cmd - IDM_SWITCHSTART]);
|
---|
2300 | ret = TRUE;
|
---|
2301 | }
|
---|
2302 | }
|
---|
2303 |
|
---|
2304 | return ret;
|
---|
2305 | }
|
---|
2306 |
|
---|