source: trunk/dll/treecnr.c@ 1340

Last change on this file since 1340 was 1340, checked in by Gregg Young, 17 years ago

Fix trap caused by close of DIRCNR after eject of drive it pointed to (Ticket 317)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 85.9 KB
RevLine 
[1335]1
[36]2/***********************************************************************
3
4 $Id: treecnr.c 1340 2008-12-14 02:56:55Z gyoung $
5
6 Tree containers
7
8 Copyright (c) 1993-98 M. Kimes
[907]9 Copyright (c) 2001, 2008 Steven H. Levine
[36]10
[156]11 16 Oct 02 SHL Handle large partitions
12 11 Jun 03 SHL Add JFS and FAT32 support
13 25 May 05 SHL Rename comnam to szCommonName and fix typo
14 25 May 05 SHL Use ULONGLONG and CommaFmtULL
[176]15 26 May 05 SHL More large file formatting updates
[186]16 05 Jun 05 SHL Use QWL_USER
[246]17 06 Aug 05 SHL Renames
[305]18 08 Dec 05 SHL TreeCnrWndProc: disable menu items if drive not ready
[352]19 17 Jul 06 SHL Use Runtime_Error
[443]20 15 Aug 06 SHL Rework SetMask args
[472]21 31 Aug 06 JS Add more partitioning menu items
[787]22 22 Oct 06 GKY Add NDFS32 support
[549]23 29 Dec 06 GKY Fixed menu gray out for remote drives (added variable "remote")
24 29 Dec 06 GKY Enabled edit of drive flags on "not ready" drives
[555]25 18 Feb 07 GKY More drive type and icon support
[557]26 08 Mar 07 SHL Ensure drive icon updates after drive flags change
27 09 Mar 07 GKY Use SelectDriveIcon
[593]28 30 Mar 07 GKY Remove GetPString for window class names
[603]29 06 Apr 07 GKY Work around PM DragInfo and DrgFreeDISH limits
30 06 Apr 07 GKY Add some error checking in drag/drop
[618]31 19 Apr 07 SHL Sync with AcceptOneDrop GetOneDrop mods
32 19 Apr 07 SHL Add more drag/drop error checking
[672]33 12 May 07 SHL Use dcd->ulItemsToUnHilite; sync with UnHilite arg mods
[688]34 10 Jun 07 GKY Add CheckPmDrgLimit including IsFm2Window as part of work around PM drag limit
35 10 Jun 07 GKY Mouse button 3 white space click to fail silently
[726]36 05 Jul 07 SHL Disable leftover debug code
[751]37 02 Aug 07 SHL Sync with CNRITEM mods
[775]38 06 Aug 07 GKY Reduce DosSleep times (ticket 148)
[787]39 14 Aug 07 SHL Revert ShowTreeRec DosSleep to 0
40 14 Aug 07 SHL Optimze ShowTreeRec collapse - was really slow
[793]41 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
[802]42 22 Aug 07 SHL Disable DbgMsgs shipped with 3.0.8beta1
[809]43 26 Aug 07 SHL Revert to DosSleep(0)
[872]44 22 Nov 07 GKY Use CopyPresParams to fix presparam inconsistencies in menus
[917]45 10 Jan 08 SHL Sync with CfgDlgProc mods
[953]46 15 Feb 08 SHL Sync with settings menu rework
[954]47 15 Feb 08 SHL Avoid death if tree container 0 width
[1102]48 19 Jul 08 GKY Replace save_dir2(dir) with pFM2SaveDirectory
49 02 Aug 08 GKY Always pass temp variable point to UM_SHOWME to avoid freeing pci->pszFileName early
[1251]50 19 Oct 08 GKY Fixed logic for greying menu items (Format etc) on remote and virtual drives (it was reversed)
51 19 Oct 08 GKY Fixed context menu to be "drives" menu on unformatted drives
[1303]52 28 Nov 08 GKY Remove unneeded DosEnterCriSec calls
[1335]53 10 Dec 08 SHL Integrate exception handler support
[36]54
55***********************************************************************/
56
[2]57#include <stdlib.h>
58#include <string.h>
59#include <ctype.h>
[1335]60// #include <process.h> // _beginthread
[156]61
[907]62#define INCL_DOS
63#define INCL_WIN
64#define INCL_LONGLONG
[1251]65#define INCL_DOSERRORS
[907]66
[1178]67#include "fm3dll.h"
[1227]68#include "fm3dll2.h" // #define's for UM_*, control id's, etc.
69#include "treecnr.h"
[1213]70#include "mainwnd2.h" // Data declaration(s)
71#include "grep.h" // Data declaration(s)
72#include "dircnrs.h" // Data declaration(s)
73#include "info.h" // Data declaration(s)
[2]74#include "fm3dlg.h"
75#include "fm3str.h"
76#include "mle.h"
[907]77#include "comp.h" // COMPARE
78#include "filldir.h" // RemoveCnrItems...
79#include "errutil.h" // Dos_Error...
80#include "strutil.h" // GetPString
[953]81#include "notebook.h" // CfgDlgProc
[1077]82#include "command.h" // RunCommand
[1335]83#include "worker.h" // Action, MassAction
[1178]84#include "mainwnd.h" // BubbleHelp, FindDirCnrByName, GetNextWindowPos
[1157]85#include "misc.h" // CnrDirectEdit, EmphasizeButton, FindDirCnr
[1335]86 // FindDirCnr, FixSwitchList, OpenEdit, QuickPopup
87 // SetSortChecks, SwitchCommand, CheckMenu
88 // CurrentRecord, IsFm2Window
[1157]89#include "common.h" // CommonCnrProc, CommonDriveCmd, CommonFrameWndProc
[1335]90 // CommonTextProc
[1178]91#include "valid.h" // CheckDrive, DriveFlagsOne, IsValidDrive
[1157]92#include "chklist.h" // DropListProc
93#include "select.h" // ExpandAll
[1178]94#include "findrec.h" // FindCnrRecord, FindParentRecord, ShowCnrRecord
[1157]95#include "flesh.h" // Flesh, UnFlesh
96#include "notify.h" // HideNote
97#include "objwin.h" // MakeObjWin
98#include "notify.h" // NotifyError
99#include "remap.h" // RemapDlgProc
100#include "saveclip.h" // SaveListDlgProc
101#include "update.h" // SelectDriveIcon, UpdateCnrList, UpdateCnrRecord
102#include "sortcnr.h" // SortTreeCnr
[1178]103#include "droplist.h" // AcceptOneDrop, CheckPmDrgLimit, DropHelp, GetOneDrop
104#include "presparm.h" // CopyPresParams
105#include "defview.h" // DefaultViewKeys
106#include "draglist.h" // DoFileDrag
107#include "filter.h" // Filter
108#include "shadow.h" // OpenObject
109#include "mkdir.h" // PMMkDir
110#include "collect.h" // StartCollector
111#include "viewer.h" // StartMLEEditor
112#include "newview.h" // StartViewer
113#include "walkem.h" // WalkAllDlgProc
114#include "commafmt.h" // CommaFmtULL
115#include "wrappers.h" // xDosFindFirst
116#include "systemf.h" // runemf2
117#include "dirs.h" // save_dir2
[1017]118#include "fortify.h"
[1213]119#include "init.h" // GetTidForWindow
[1335]120#include "excputil.h" // xbeginthread
[1017]121
[1213]122// Data definitions
123
124#pragma data_seg(GLOBAL1)
125HWND LastDir;
126HWND TreeCnrMenu;
127INT driveserial[26];
128BOOL fDCOpens;
129BOOL fDummy;
130BOOL fFollowTree;
131BOOL fTopDir;
132HPOINTER hptrDunno;
133HWND hwndMainMenu;
134
135#pragma data_seg(GLOBAL2)
136ULONG FM3UL;
137INT TreesortFlags;
138
[2]139#pragma data_seg(DATA1)
[352]140
141static PSZ pszSrcFile = __FILE__;
[1213]142static BOOL fOkayMinimize;
[352]143
[551]144APIRET16 APIENTRY16 Dos16MemAvail(PULONG pulAvailMem);
[2]145
[551]146typedef struct APPNOTIFY
147{
148 HAPP happ;
149 CHAR device;
[2]150 struct APPNOTIFY *next;
151 struct APPNOTIFY *prev;
[551]152}
153APPNOTIFY;
[2]154
[551]155MRESULT EXPENTRY OpenButtonProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
[352]156{
[2]157 static BOOL emphasized = FALSE;
158
[551]159 switch (msg) {
160 case WM_CREATE:
161 {
162 MRESULT rc;
[2]163
[551]164 rc = PFNWPButton(hwnd, msg, mp1, mp2);
165 WinSetPresParam(hwnd, PP_FONTNAMESIZE,
166 strlen(GetPString(IDS_8TIMESNEWROMANTEXT)) + 1,
167 (PVOID) GetPString(IDS_8TIMESNEWROMANTEXT));
168 return rc;
169 }
[2]170
[551]171 case WM_MOUSEMOVE:
172 BubbleHelp(hwnd, TRUE, FALSE, TRUE, GetPString(IDS_OPENBUTTONHELP));
173 break;
[2]174
[551]175 case WM_CONTEXTMENU:
176 PostMsg(WinQueryWindow(hwnd, QW_PARENT),
177 WM_COMMAND, MPFROM2SHORT(IDM_OPENWALK, 0), MPVOID);
178 return 0;
[2]179
[551]180 case DM_DRAGOVER:
181 if (!emphasized) {
182 emphasized = TRUE;
183 EmphasizeButton(hwnd, emphasized);
184 }
[618]185 if (AcceptOneDrop(hwnd, mp1, mp2))
[551]186 return MRFROM2SHORT(DOR_DROP, DO_MOVE);
187 return MRFROM2SHORT(DOR_NEVERDROP, 0);
[2]188
[551]189 case DM_DRAGLEAVE:
190 if (emphasized) {
191 emphasized = FALSE;
192 EmphasizeButton(hwnd, emphasized);
193 }
194 break;
[2]195
[551]196 case DM_DROPHELP:
197 DropHelp(mp1, mp2, hwnd, GetPString(IDS_OPENDROPHELP));
198 return 0;
[2]199
[551]200 case DM_DROP:
201 {
202 char szFrom[CCHMAXPATH + 2];
[2]203
[551]204 if (emphasized) {
205 emphasized = FALSE;
206 EmphasizeButton(hwnd, emphasized);
[2]207 }
[618]208 if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) {
[551]209 MakeValidDir(szFrom);
210 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
211 UM_OPENWINDOWFORME, MPFROMP(szFrom), MPVOID);
212 }
213 }
214 return 0;
[2]215
216 }
[551]217 return PFNWPButton(hwnd, msg, mp1, mp2);
[2]218}
219
[787]220VOID ShowTreeRec(HWND hwndCnr,
221 CHAR *dirname,
222 BOOL collapsefirst,
[551]223 BOOL maketop)
[352]224{
[2]225 /* Find a record in tree view, move it so it shows in container and
226 make it the current record */
227
[551]228 PCNRITEM pci, pciToSelect, pciP;
229 BOOL quickbail = FALSE;
230 CHAR szDir[CCHMAXPATH], *p;
[2]231
[787]232 // already positioned to requested record?
[2]233 pci = WinSendMsg(hwndCnr,
[176]234 CM_QUERYRECORDEMPHASIS,
[551]235 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
[730]236 if (pci && (INT) pci != -1 && !stricmp(pci->pszFileName, dirname)) {
[787]237 // DbgMsg(pszSrcFile, __LINE__, "already at %s collapse %u maketop %u", dirname, collapsefirst, maketop); // 14 Aug 07 SHL fixme
238 quickbail = TRUE; // Bypass repositioning
239 goto MakeTop;
[2]240 }
[551]241 WinEnableWindowUpdate(hwndCnr, FALSE);
[802]242 // DbgMsg(pszSrcFile, __LINE__, "finding %s collapse %u maketop %u", dirname, collapsefirst, maketop); // 14 Aug 07 SHL fixme
[551]243 pci = FindCnrRecord(hwndCnr, dirname, NULL, TRUE, FALSE, TRUE);
244 if (!pci || (INT) pci == -1) {
245 *szDir = *dirname;
[2]246 szDir[1] = ':';
247 szDir[2] = '\\';
248 szDir[3] = 0;
[787]249 p = szDir + 3; // Point after root backslash
[551]250 for (;;) {
251 pciP = FindCnrRecord(hwndCnr, szDir, NULL, TRUE, FALSE, TRUE);
252 if (pciP && (INT) pciP != -1) {
[730]253 if (!stricmp(dirname, pciP->pszFileName))
[787]254 break; // Found it
255 if (~pciP->rc.flRecordAttr & CRA_EXPANDED)
[551]256 WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciP), MPVOID);
257 strcpy(szDir, dirname);
258 if (p - szDir >= strlen(szDir))
[787]259 break; // Not root dir
[551]260 p = strchr(p, '\\');
261 if (p) {
[787]262 *p = 0; // fixme?
[176]263 p++;
264 }
265 else
266 break;
[2]267 }
268 else
[176]269 break;
[787]270 DosSleep(0);
271 } // for
[551]272 pci = FindCnrRecord(hwndCnr, dirname, NULL, TRUE, FALSE, TRUE);
[2]273 }
[802]274 // DbgMsg(pszSrcFile, __LINE__, "found"); // 14 Aug 07 SHL fixme
[551]275 if (pci && (INT) pci != -1) {
[787]276 if (~pci->rc.flRecordAttr & CRA_CURSORED) {
[551]277 if (collapsefirst) {
[907]278 // DbgMsg(pszSrcFile, __LINE__, "collapsing"); // 14 Aug 07 SHL fixme
[176]279 pciP = WinSendMsg(hwndCnr,
280 CM_QUERYRECORD,
[551]281 MPVOID, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
282 while (pciP && (INT) pciP != -1) {
[907]283#if 1 // // 05 Jan 08 SHL fixme to be sure this is correct code
[787]284 if (pciP->rc.flRecordAttr & CRA_EXPANDED) {
285 // collapse top level of all branches
[551]286 WinSendMsg(hwndCnr, CM_COLLAPSETREE, MPFROMP(pciP), MPVOID);
[787]287 }
288#else // fixme to be gone
289 if (toupper(*pciP->pszFileName) == toupper(*dirname)) {
290 // collapse all levels if branch is our drive
291 if (pciP->rc.flRecordAttr & CRA_EXPANDED)
292 ExpandAll(hwndCnr, FALSE, pciP);
293 }
294 else if (pciP->rc.flRecordAttr & CRA_EXPANDED) {
295 // collapse top level of all branches
296 WinSendMsg(hwndCnr, CM_COLLAPSETREE, MPFROMP(pciP), MPVOID);
297 }
298#endif
[176]299 pciP = WinSendMsg(hwndCnr,
300 CM_QUERYRECORD,
301 MPFROMP(pciP),
[551]302 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
[787]303 } // while
[2]304 }
305 /* expand all parent branches */
[802]306 // DbgMsg(pszSrcFile, __LINE__, "expanding parents"); // 14 Aug 07 SHL fixme
[2]307 pciToSelect = pci;
[551]308 for (;;) {
[176]309 pciP = WinSendMsg(hwndCnr,
310 CM_QUERYRECORD,
311 MPFROMP(pciToSelect),
[551]312 MPFROM2SHORT(CMA_PARENT, CMA_ITEMORDER));
313 if (pciP && (INT) pciP != -1) {
314 if (!(pciP->rc.flRecordAttr & CRA_EXPANDED))
315 WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciP), MPVOID);
[176]316 pciToSelect = pciP;
317 }
318 else
319 break;
[809]320 DosSleep(0); // Let GUI update
[787]321 } // for
[2]322 }
323 /* make record visible */
[551]324 MakeTop:
[802]325 // DbgMsg(pszSrcFile, __LINE__, "moving into view"); // 14 Aug 07 SHL fixme
[2]326 pciToSelect = pci;
[551]327 if (pciToSelect && (INT) pciToSelect != -1) {
[787]328 if (fTopDir || maketop) {
[551]329 ShowCnrRecord(hwndCnr, (PMINIRECORDCORE) pciToSelect);
[787]330 }
331 if (fSwitchTreeExpand && ~pciToSelect->rc.flRecordAttr & CRA_EXPANDED) {
[907]332 // DbgMsg(pszSrcFile, __LINE__, "expanding current"); // 14 Aug 07 SHL fixme
[551]333 WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciToSelect), MPVOID);
[907]334 // DbgMsg(pszSrcFile, __LINE__, "expanded"); // 14 Aug 07 SHL fixme
[2]335 }
[787]336 if (!quickbail) {
[907]337 WinSendMsg(hwndCnr,
[787]338 CM_SETRECORDEMPHASIS,
339 MPFROMP(pciToSelect),
340 MPFROM2SHORT(TRUE, CRA_SELECTED | CRA_CURSORED));
341 }
[2]342 }
343 }
[802]344 // DbgMsg(pszSrcFile, __LINE__, "done"); // 14 Aug 07 SHL fixme
[551]345 WinEnableWindowUpdate(hwndCnr, TRUE);
[809]346 // DosSleep(1); // Let GUI update
[2]347}
348
[551]349MRESULT EXPENTRY TreeTitleWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
350 MPARAM mp2)
[352]351{
[551]352 PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER);
[2]353
[551]354 switch (msg) {
355 case WM_CONTEXTMENU:
356 return WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
357 UM_CONTEXTMENU, mp1, mp2);
[2]358 }
[551]359 return oldproc(hwnd, msg, mp1, mp2);
[2]360}
361
[551]362MRESULT EXPENTRY TreeStatProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
[352]363{
[551]364 switch (msg) {
365 case WM_CREATE:
366 return CommonTextProc(hwnd, msg, mp1, mp2);
[2]367
[551]368 case WM_CONTEXTMENU:
369 PostMsg(WinQueryWindow(hwnd, QW_PARENT), msg, mp1, mp2);
370 return 0;
[2]371
[551]372 case WM_PAINT:
373 {
374 MRESULT mr = PFNWPStatic(hwnd, msg, mp1, mp2);
[2]375
[551]376 PaintRecessedWindow(hwnd, (HPS) 0, FALSE, FALSE);
377 return mr;
378 }
[2]379
[551]380 case WM_SETFOCUS:
381 if (mp2)
382 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
383 break;
[2]384
[551]385 case UM_FOCUSME:
386 WinSetFocus(HWND_DESKTOP, WinQueryWindow(hwnd, QW_PARENT));
387 return 0;
[2]388 }
[551]389 return PFNWPStatic(hwnd, msg, mp1, mp2);
[2]390}
391
[551]392MRESULT EXPENTRY TreeFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
393 MPARAM mp2)
[352]394{
[551]395 switch (msg) {
396 case UM_RESCAN:
397 PostMsg(WinQueryWindow(hwnd, QW_PARENT), msg, mp1, mp2);
398 return 0;
[2]399
[551]400 case WM_ADJUSTWINDOWPOS:
401 {
402 SWP *pswp;
[2]403
[551]404 pswp = (SWP *) mp1;
405 if (ParentIsDesktop(hwnd, (HWND) 0)) {
406 if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE))
407 HideNote();
[2]408 }
[551]409 }
410 break;
[2]411
[551]412 case WM_TRACKFRAME:
413 if (!fFreeTree && !ParentIsDesktop(hwnd, (HWND) 0)) {
414 switch (SHORT1FROMMP(mp1) & TF_MOVE) {
415 case TF_MOVE:
416 case TF_LEFT:
417 case TF_TOP:
418 case (TF_LEFT | TF_BOTTOM):
419 case (TF_LEFT | TF_TOP):
420 {
421 SWP swp;
[2]422
[551]423 WinQueryWindowPos(hwnd, &swp);
424 if (!(swp.fl & SWP_ACTIVATE))
425 WinSetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0,
426 SWP_ZORDER | SWP_ACTIVATE);
[176]427 }
[551]428 return 0;
[2]429 }
[551]430 }
431 break;
[2]432
[551]433 case WM_CALCFRAMERECT:
434 if (*(ULONG *) realappname != FM3UL) {
[2]435
[551]436 MRESULT mr;
437 PRECTL prectl;
[2]438
[551]439 mr = CommonFrameWndProc(TREE_CNR, hwnd, msg, mp1, mp2);
[2]440
[551]441 /*
442 * Calculate the position of the client rectangle.
443 * Otherwise, we'll see a lot of redraw when we move the
444 * client during WM_FORMATFRAME.
445 */
[2]446
[551]447 if (mr && mp2) {
448 prectl = (PRECTL) mp1;
449 prectl->yTop -= 22;
[2]450 }
[551]451 return mr;
452 }
453 break;
[2]454
[551]455 case WM_FORMATFRAME:
456 {
457 SHORT sCount;
458 PSWP pswp, pswpClient, pswpNew;
[2]459
[551]460 sCount = (SHORT) CommonFrameWndProc(TREE_CNR, hwnd, msg, mp1, mp2);
[2]461
[551]462 /*
463 * Reformat the frame to "squeeze" the client
464 */
[2]465
[551]466 pswp = (PSWP) mp1;
467 {
468 SHORT x;
[2]469
[551]470 for (x = 0; x < sCount; x++) {
471 if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_CLIENT) {
472 pswpClient = pswp;
473 break;
[176]474 }
[551]475 pswp++;
[176]476 }
[551]477 }
478 pswpNew = (PSWP) mp1 + sCount;
479 *pswpNew = *pswpClient;
480 pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_STATUS);
481 if (*(ULONG *) realappname == FM3UL) {
[2]482
[551]483 PSWP pswpTitlebar = (PSWP) 0, pswpMinbutton = (PSWP) 0;
484 SHORT x;
[2]485
[551]486 pswpNew->hwnd = WinWindowFromID(hwnd, IDM_OPENWINDOW);
487 pswp = (PSWP) mp1;
488 for (x = 0; x < sCount; x++) {
489 if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_TITLEBAR)
490 pswpTitlebar = pswp;
491 else if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_MINMAX)
492 pswpMinbutton = pswp;
493 if (pswpTitlebar && pswpMinbutton)
494 break;
495 pswp++;
[176]496 }
[551]497 pswpNew->cy = pswpMinbutton->cy + 3;
498 pswpNew->cx = min(pswpNew->cy, (pswpMinbutton->cx / 2) + 3);
499 pswpTitlebar->cx -= (pswpNew->cx + 1);
500 pswpNew->x = pswpTitlebar->x + pswpTitlebar->cx;
501 pswpNew->y = pswpMinbutton->y - 1;
[2]502 }
[551]503 else {
504 pswpNew->x = pswpClient->x + 3;
505 pswpNew->y = (pswpClient->y + pswpClient->cy) - 20;
506 pswpNew->cx = pswpClient->cx - 6;
507 pswpNew->cy = 18;
508 pswpClient->cy -= 22;
509 }
510 sCount++;
511 return MRFROMSHORT(sCount);
512 }
[2]513
[551]514 case WM_QUERYFRAMECTLCOUNT:
515 {
516 SHORT sCount;
[2]517
[551]518 sCount = (SHORT) CommonFrameWndProc(TREE_CNR, hwnd, msg, mp1, mp2);
519 sCount++;
520 return MRFROMSHORT(sCount);
521 }
[2]522 }
[551]523 return CommonFrameWndProc(TREE_CNR, hwnd, msg, mp1, mp2);
[2]524}
525
[551]526MRESULT EXPENTRY TreeClientWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
527 MPARAM mp2)
528{
[2]529
[551]530 switch (msg) {
531 case UM_CONTAINERHWND:
532 return MRFROMLONG(WinWindowFromID(hwnd, TREE_CNR));
[2]533
[551]534 case UM_VIEWSMENU:
[875]535 return MRFROMLONG(CheckMenu(hwndMainMenu, &TreeCnrMenu, TREECNR_POPUP));
[2]536
[551]537 case UM_TIMER:
538 case UM_ACTION:
539 case UM_SHOWME:
540 case UM_OPENWINDOWFORME:
541 case UM_MINIMIZE:
542 case UM_MAXIMIZE:
543 case WM_INITMENU:
544 case UM_INITMENU:
545 case UM_FILTER:
546 case UM_FILESMENU:
547 case UM_UPDATERECORD:
548 case UM_UPDATERECORDLIST:
549 case MM_PORTHOLEINIT:
550 case UM_DRIVECMD:
551 case WM_CLOSE:
552 case WM_CONTROL:
553 case UM_COMMAND:
554 case WM_COMMAND:
555 return WinSendMsg(WinWindowFromID(hwnd, TREE_CNR), msg, mp1, mp2);
[2]556
[551]557 case WM_PSETFOCUS:
558 case WM_SETFOCUS:
559 if (mp2)
560 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
561 break;
[2]562
[551]563 case UM_FOCUSME:
564 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, TREE_CNR));
565 break;
[2]566
[551]567 case WM_ERASEBACKGROUND:
568 WinFillRect((HPS) mp1, (PRECTL) mp2, 0x00d0d0d0);
569 return 0;
[2]570
[551]571 case WM_PAINT:
572 {
573 HPS hps;
574 RECTL rcl;
[2]575
[551]576 hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
577 if (hps) {
578 WinQueryWindowRect(hwnd, &rcl);
579 WinFillRect(hps, &rcl, CLR_PALEGRAY);
580 PaintRecessedWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
581 MAIN_STATUS), hps, FALSE, FALSE);
582 WinEndPaint(hps);
[2]583 }
[551]584 }
585 break;
[2]586
[551]587 case WM_SIZE:
588 WinSetWindowPos(WinWindowFromID(hwnd, TREE_CNR),
589 HWND_TOP,
590 0,
591 0,
592 SHORT1FROMMP(mp2),
593 SHORT2FROMMP(mp2), SWP_SHOW | SWP_MOVE | SWP_SIZE);
594 if (hwndMain)
595 PostMsg(hwndMain, UM_SIZE, MPVOID, MPVOID);
596 break;
[2]597
[551]598 case WM_CONTEXTMENU:
599 case UM_CONTEXTMENU:
600 PostMsg(WinWindowFromID(hwnd, TREE_CNR),
601 WM_CONTROL, MPFROM2SHORT(TREE_CNR, CN_CONTEXTMENU), MPVOID);
602 return 0;
[2]603 }
[551]604 return WinDefWindowProc(hwnd, msg, mp1, mp2);
[2]605}
606
[551]607MRESULT EXPENTRY TreeObjWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
[156]608{
[2]609 DIRCNRDATA *dcd;
610
[551]611 switch (msg) {
612 case WM_CREATE:
[1077]613 DbgMsg(pszSrcFile, __LINE__, "WM_CREATE mp1 %p mp2 %p", mp1, mp2); // 18 Jul 08 SHL fixme
[551]614 break;
[2]615
[551]616 case UM_SHOWME:
[787]617 // DbgMsg(pszSrcFile, __LINE__, "UM_SHOWME mp1 %p mp2 %p", mp1, mp2); // 14 Aug 07 SHL fixme
[551]618 if (mp1) {
[1335]619# ifdef FORTIFY
620 Fortify_BecomeOwner(mp1);
621# endif
[551]622 dcd = INSTDATA(hwnd);
[787]623 // DbgMsg(pszSrcFile, __LINE__, "UM_SHOWME dcd %p", dcd); // 14 Aug 07 SHL fixme
[551]624 if (dcd) {
625 BOOL tempsusp, tempfollow, temptop;
[2]626
[551]627 tempsusp = dcd->suspendview;
628 dcd->suspendview = TRUE;
629 tempfollow = fFollowTree;
630 fFollowTree = FALSE;
631 if (mp2) {
632 temptop = fTopDir;
633 fTopDir = TRUE;
[176]634 }
[1009]635 ShowTreeRec(dcd->hwndCnr, (CHAR *)mp1, fCollapseFirst, TRUE);
[551]636 dcd->suspendview = tempsusp;
637 fFollowTree = tempfollow;
638 if (mp2)
639 fTopDir = temptop;
[2]640 }
[1039]641 free((CHAR *)mp1);
[551]642 }
643 return 0;
[2]644
[551]645 case DM_PRINTOBJECT:
646 return MRFROMLONG(DRR_TARGET);
[2]647
[551]648 case DM_DISCARDOBJECT:
649 dcd = INSTDATA(hwnd);
650 if (fFM2Deletes && dcd) {
[2]651
[551]652 LISTINFO *li;
653 CNRDRAGINFO cni;
[2]654
[551]655 cni.pRecord = NULL;
656 cni.pDragInfo = (PDRAGINFO) mp1;
657 li = DoFileDrop(dcd->hwndCnr,
[726]658 dcd->directory, FALSE, MPVOID, MPFROMP(&cni));
[687]659 CheckPmDrgLimit(cni.pDragInfo);
[551]660 if (li) {
661 li->type = ((fDefaultDeletePerm) ? IDM_PERMDELETE : IDM_DELETE);
662 if (!PostMsg(hwnd, UM_MASSACTION, MPFROMP(li), MPVOID))
663 FreeListInfo(li);
664 else
665 return MRFROMLONG(DRR_SOURCE);
[2]666 }
[551]667 }
668 return MRFROMLONG(DRR_TARGET);
[2]669
[551]670 case UM_EXPAND:
671 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
672 if (!dcd)
673 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
674 else {
675 BOOL tempsusp = dcd->suspendview;
[2]676
[551]677 dcd->suspendview = TRUE;
678 ExpandAll(dcd->hwndCnr,
679 (SHORT1FROMMP(mp1) == IDM_EXPAND), (PCNRITEM) mp2);
680 dcd->suspendview = tempsusp;
681 PostMsg(dcd->hwndCnr, UM_FILTER, MPVOID, MPVOID);
682 }
683 return 0;
[2]684
[551]685 case UM_UPDATERECORDLIST:
686 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
687 if (!dcd || !mp1)
688 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
689 else {
690 INT numentries = 0;
691 CHAR **list = (CHAR **) mp1;
[2]692
[551]693 while (list[numentries])
694 numentries++;
695 if (numentries)
696 UpdateCnrList(dcd->hwndCnr, list, numentries, TRUE, dcd);
697 }
698 return 0;
[2]699
[551]700 case UM_SETUP:
[1077]701# ifdef FORTIFY
702 Fortify_EnterScope();
703# endif
[551]704 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
705 if (!dcd)
706 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
707 else {
[1077]708# ifdef FORTIFY
[1078]709 Fortify_BecomeOwner(dcd);
[1077]710# endif
[551]711 dcd->hwndObject = hwnd;
712 if (ParentIsDesktop(hwnd, dcd->hwndParent))
[771]713 DosSleep(100); //05 Aug 07 GKY 250
[551]714 }
715 return 0;
716
717 case UM_RESCAN2:
718 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
719 if (!dcd)
720 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
721 // Bypass if not running integrated (i.e if vtree)
722 else if (hwndStatus &&
723 dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
724 CHAR s[CCHMAXPATH * 2];
725 PCNRITEM pci = (PCNRITEM) mp1;
726 FSALLOCATE fsa;
727 struct
728 {
729 ULONG serial;
730 CHAR volumelength;
731 CHAR volumelabel[CCHMAXPATH];
[2]732 }
[551]733 volser;
734 CHAR tb[64];
735 CHAR szFree[64];
736 CNRINFO cnri;
[2]737
[551]738 strcpy(s, GetPString(IDS_TREETEXT));
739 memset(&cnri, 0, sizeof(CNRINFO));
740 cnri.cb = sizeof(CNRINFO);
741 WinSendMsg(dcd->hwndCnr,
742 CM_QUERYCNRINFO,
743 MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
744 if (cnri.cRecords) {
745 sprintf(s, GetPString(IDS_NUMDRIVESTEXT), cnri.cRecords);
[1102]746 if (pci && pci->pszFileName) {
[730]747 if (!(driveflags[toupper(*pci->pszFileName) - 'A'] &
[551]748 DRIVE_REMOVABLE) ||
[730]749 driveserial[toupper(*pci->pszFileName) - 'A'] != -1) {
[551]750 memset(&volser, 0, sizeof(volser));
751 DosError(FERR_DISABLEHARDERR);
[730]752 if (!DosQueryFSInfo(toupper(*pci->pszFileName) - '@',
[551]753 FSIL_VOLSER,
754 &volser,
755 (ULONG) sizeof(volser)) &&
756 dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
[176]757 DosError(FERR_DISABLEHARDERR);
[730]758 if (!DosQueryFSInfo(toupper(*pci->pszFileName) - '@',
[551]759 FSIL_ALLOC, &fsa, sizeof(FSALLOCATE))) {
760 CommaFmtULL(tb, sizeof(tb),
761 (ULONGLONG) fsa.cUnitAvail * (fsa.cSectorUnit *
762 fsa.cbSector), 'M');
763 sprintf(szFree, " %s %s", tb, GetPString(IDS_FREETEXT));
764 }
765 else
766 *szFree = 0;
[730]767 driveserial[toupper(*pci->pszFileName) - 'A'] = volser.serial;
[551]768 sprintf(&s[strlen(s)],
769 GetPString(IDS_TREESTATUSSTARTTEXT),
[730]770 toupper(*pci->pszFileName),
[551]771 volser.volumelabel, volser.serial, szFree);
772 if (!fMoreButtons) {
773 if (*dcd->mask.szMask ||
774 (dcd->mask.attrFile != ALLATTRS ||
775 ((fFilesInTree ||
[730]776 (driveflags[toupper(*pci->pszFileName)] &
[551]777 DRIVE_INCLUDEFILES)) ?
778 dcd->mask.antiattr :
779 (dcd->mask.antiattr &&
780 dcd->mask.antiattr != FILE_DIRECTORY)))) {
781 sprintf(&s[strlen(s)],
782 " (%s)",
783 (*dcd->mask.szMask) ?
784 dcd->mask.szMask : GetPString(IDS_ATTRTEXT));
[176]785 }
786 }
787 }
788 }
[551]789 else {
790 /* find root record and strip it */
791 pci = FindParentRecord(dcd->hwndCnr, pci);
[730]792 driveserial[toupper(*pci->pszFileName) - 'A'] = -1;
[551]793 UnFlesh(dcd->hwndCnr, pci);
794 }
[176]795 }
[2]796 }
[551]797 if (dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent))
798 WinSetWindowText(hwndStatus, s);
799 }
800 return 0;
[2]801
[551]802 case UM_RESCAN:
803 /*
804 * populate container
805 */
806 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
807 if (!dcd)
808 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
809 else {
[1326]810 //PULONG pulPostCt;
[1320]811
[751]812 RemoveCnrItems(dcd->hwndCnr, NULL, 0, CMA_FREE | CMA_INVALIDATE | CMA_ERASE);
[551]813 WinSendMsg(dcd->hwndCnr,
814 CM_SCROLLWINDOW, MPFROMSHORT(CMA_VERTICAL), MPFROMLONG(-1));
815 WinSendMsg(dcd->hwndCnr,
816 CM_SCROLLWINDOW,
[1335]817 MPFROMSHORT(CMA_HORIZONTAL), MPFROMLONG(-1));
[1326]818 //if (!fInitialDriveScan) {
[1335]819 //DosWaitEventSem(DriveScanStart, 20000);
820 while (StubbyScanCount != 0)
821 DosSleep(50);
822 /*pulPostCt = xmallocz(sizeof(ULONG), pszSrcFile, __LINE__);
823 if (pulPostCt) {
824 DosResetEventSem(DriveScanStart, pulPostCt);
825 free(pulPostCt);
826 } */
[1326]827 //}
828 //else
829 // fInitialDriveScan = FALSE;
[551]830 FillTreeCnr(dcd->hwndCnr, dcd->hwndParent);
831 if (fOkayMinimize) {
832 PostMsg(dcd->hwndCnr, UM_MINIMIZE, MPVOID, MPVOID);
833 fOkayMinimize = FALSE;
[2]834 }
[551]835 WinSendMsg(dcd->hwndCnr,
836 CM_INVALIDATERECORD,
837 MPVOID, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
838 PostMsg(dcd->hwndCnr, UM_RESCAN, MPVOID, MPVOID);
839 }
840 return 0;
[2]841
[551]842 case UM_COMMAND:
843 if (mp1) {
[2]844
[551]845 LISTINFO *li = (LISTINFO *) mp1;
[2]846
[551]847 switch (li->type) {
848 case IDM_DOITYOURSELF:
849 case IDM_APPENDTOCLIP:
850 case IDM_SAVETOCLIP:
851 case IDM_ARCHIVE:
852 case IDM_VIEW:
853 case IDM_EDIT:
854 case IDM_OBJECT:
855 case IDM_SHADOW:
856 case IDM_SHADOW2:
857 case IDM_PRINT:
858 case IDM_ATTRS:
859 case IDM_DELETE:
860 case IDM_PERMDELETE:
861 if (PostMsg(hwnd, UM_MASSACTION, mp1, mp2))
862 return (MRESULT) TRUE;
863 default:
864 if (PostMsg(hwnd, UM_ACTION, mp1, mp2))
865 return (MRESULT) TRUE;
[2]866 }
[551]867 }
868 return 0;
[2]869
[551]870 case UM_MASSACTION:
871 if (mp1) {
[2]872
[551]873 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
874 if (!dcd)
875 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
876 else {
877 WORKER *wk;
[1077]878# ifdef FORTIFY
879 Fortify_EnterScope();
880# endif
[551]881 wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__);
882 if (!wk)
883 FreeListInfo((LISTINFO *) mp1);
[352]884 else {
[551]885 wk->size = sizeof(WORKER);
886 wk->hwndCnr = dcd->hwndCnr;
887 wk->hwndParent = dcd->hwndParent;
888 wk->hwndFrame = dcd->hwndFrame;
889 wk->hwndClient = dcd->hwndClient;
890 wk->li = (LISTINFO *) mp1;
891 strcpy(wk->directory, dcd->directory);
[1335]892 if (xbeginthread(MassAction,
893 122880,
894 wk,
895 pszSrcFile,
896 __LINE__) == -1)
897 {
[1077]898 free(wk);
[551]899 FreeListInfo((LISTINFO *) mp1);
[176]900 }
901 }
[1077]902# ifdef FORTIFY
903 Fortify_LeaveScope();
904# endif
[2]905 }
[551]906 }
907 return 0;
[2]908
[551]909 case UM_ACTION:
[1077]910# ifdef FORTIFY
911 Fortify_EnterScope();
912# endif
[551]913 if (mp1) {
[1077]914# ifdef FORTIFY
[1078]915 Fortify_BecomeOwner(mp1);
[1077]916# endif
[551]917 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
918 if (!dcd)
919 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
920 else {
921 WORKER *wk;
922 wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__);
923 if (!wk)
924 FreeListInfo((LISTINFO *) mp1);
[352]925 else {
[551]926 wk->size = sizeof(WORKER);
927 wk->hwndCnr = dcd->hwndCnr;
928 wk->hwndParent = dcd->hwndParent;
929 wk->hwndFrame = dcd->hwndFrame;
930 wk->hwndClient = dcd->hwndClient;
931 wk->li = (LISTINFO *) mp1;
932 strcpy(wk->directory, dcd->directory);
[1335]933 if (xbeginthread(Action,
934 122880,
935 wk,
936 pszSrcFile,
937 __LINE__) == -1)
938 {
[1077]939 free(wk);
[551]940 FreeListInfo((LISTINFO *) mp1);
[176]941 }
942 }
[2]943 }
[551]944 }
[1077]945# ifdef FORTIFY
946 Fortify_LeaveScope();
947# endif
[551]948 return 0;
[2]949
[551]950 case WM_CLOSE:
951 WinDestroyWindow(hwnd);
952 break;
[2]953
[551]954 case WM_DESTROY:
955 hwndTree = (HWND) 0;
956 dcd = WinQueryWindowPtr(hwnd, QWL_USER);
957 if (dcd) {
958 WinSendMsg(dcd->hwndCnr,
959 UM_CLOSE, MPFROMLONG(dcd->dontclose != FALSE), MPVOID);
[1039]960 free(dcd);
[1063]961# ifdef FORTIFY
962 Fortify_LeaveScope();
[1077]963# endif
[1017]964 WinSetWindowPtr(dcd->hwndCnr, QWL_USER, NULL);
[551]965 }
966 DosPostEventSem(CompactSem);
967 if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
968 WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
969 break;
[2]970 }
[551]971 return WinDefWindowProc(hwnd, msg, mp1, mp2);
[2]972}
973
[551]974MRESULT EXPENTRY TreeCnrWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
[305]975{
[551]976 static APPNOTIFY *apphead = NULL, *apptail = NULL;
[672]977 DIRCNRDATA *dcd = INSTDATA(hwnd);
[2]978
[551]979 switch (msg) {
[1077]980 case WM_CREATE:
981 DbgMsg(pszSrcFile, __LINE__, "WM_CREATE mp1 %p mp2 %p", mp1, mp2); // 18 Jul 08 SHL fixme
982 break;
983
[551]984 case DM_PRINTOBJECT:
985 return MRFROMLONG(DRR_TARGET);
986
987 case DM_DISCARDOBJECT:
988 if (dcd)
989 return WinSendMsg(dcd->hwndObject, msg, mp1, mp2);
990 else
[2]991 return MRFROMLONG(DRR_TARGET);
992
[551]993 case WM_CHAR:
994 shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
995 if (SHORT1FROMMP(mp1) & KC_KEYUP)
996 return (MRESULT) TRUE;
997 if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {
998 switch (SHORT2FROMMP(mp2)) {
999 case VK_INSERT:
1000 if ((shiftstate & KC_CTRL) == KC_CTRL)
1001 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_MKDIR, 0), MPVOID);
1002 break;
1003 case VK_DELETE:
1004 if ((shiftstate & KC_CTRL) == KC_CTRL)
1005 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_PERMDELETE, 0), MPVOID);
1006 else if ((shiftstate & KC_SHIFT) == KC_SHIFT)
1007 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_SAVETOCLIP, 0), MPVOID);
1008 else
1009 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_DELETE, 0), MPVOID);
1010 break;
[2]1011 }
[551]1012 }
1013 if (shiftstate || fNoSearch)
1014 break;
1015 if (SHORT1FROMMP(mp1) & KC_CHAR) {
[2]1016
[551]1017 ULONG thistime, len;
1018 SEARCHSTRING srch;
1019 PCNRITEM pci;
[2]1020
[551]1021 if (!dcd)
1022 break;
1023 switch (SHORT1FROMMP(mp2)) {
1024 case '\x1b':
1025 case '\r':
1026 case '\n':
1027 dcd->lasttime = 0;
1028 *dcd->szCommonName = 0;
1029 break;
1030 default:
1031 thistime = WinQueryMsgTime(WinQueryAnchorBlock(hwnd));
1032 if (thistime > dcd->lasttime + 1250)
1033 *dcd->szCommonName = 0;
1034 dcd->lasttime = thistime;
1035 if (SHORT1FROMMP(mp2) == ' ' && !*dcd->szCommonName)
[176]1036 break;
[551]1037 KbdRetry:
1038 len = strlen(dcd->szCommonName);
1039 if (len >= CCHMAXPATH - 1) {
1040 *dcd->szCommonName = 0;
1041 len = 0;
1042 }
1043 dcd->szCommonName[len] = toupper(SHORT1FROMMP(mp2));
1044 dcd->szCommonName[len + 1] = 0;
1045 memset(&srch, 0, sizeof(SEARCHSTRING));
1046 srch.cb = (ULONG) sizeof(SEARCHSTRING);
1047 srch.pszSearch = (PSZ) dcd->szCommonName;
1048 srch.fsPrefix = TRUE;
1049 srch.fsCaseSensitive = FALSE;
1050 srch.usView = CV_ICON;
1051 pci = WinSendMsg(hwnd,
1052 CM_SEARCHSTRING,
1053 MPFROMP(&srch), MPFROMLONG(CMA_FIRST));
1054 if (pci && (INT) pci != -1) {
1055 /* make found item current item */
1056 WinSendMsg(hwnd,
1057 CM_SETRECORDEMPHASIS,
1058 MPFROMP(pci), MPFROM2SHORT(TRUE, CRA_CURSORED));
1059 /* make sure that record shows in viewport */
1060 ShowCnrRecord(hwnd, (PMINIRECORDCORE) pci);
1061 return (MRESULT) TRUE;
1062 }
1063 else {
1064 if (SHORT1FROMMP(mp2) == ' ') {
1065 dcd->szCommonName[len] = 0;
[176]1066 break;
[551]1067 }
1068 *dcd->szCommonName = 0;
1069 dcd->lasttime = 0;
1070 if (len) // retry as first letter if no match
1071 goto KbdRetry;
[176]1072 }
[551]1073 break;
[2]1074 }
[551]1075 }
1076 break;
[2]1077
[551]1078 case WM_MOUSEMOVE:
1079 case WM_BUTTON1UP:
1080 case WM_BUTTON2UP:
1081 case WM_BUTTON3UP:
1082 shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL));
1083 break;
[2]1084
[551]1085 case UM_TIMER:
1086 if (dcd && dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent) &&
1087 hwndStatus2) {
[841]1088 FILEFINDBUF3L ffb;
[761]1089 ULONG nm = 1;
[551]1090 HDIR hdir = HDIR_CREATE;
[2]1091
[551]1092 if (*SwapperDat) {
[838]1093 if (!xDosFindFirst(SwapperDat,
1094 &hdir,
1095 FILE_NORMAL | FILE_HIDDEN |
1096 FILE_SYSTEM | FILE_ARCHIVED | FILE_READONLY,
[841]1097 &ffb, sizeof(ffb), &nm, FIL_STANDARDL)) {
[551]1098 CHAR tb[39], tm[39], tpm[39], s[163];
1099 ULONG amem;
[2]1100
[551]1101 priority_bumped();
1102 DosFindClose(hdir);
1103 if (!DosQuerySysInfo(QSV_TOTAVAILMEM,
1104 QSV_TOTAVAILMEM,
1105 (PVOID) & amem, sizeof(amem))) {
1106 CommaFmtULL(tpm, sizeof(tpm), amem, 'M');
[176]1107 }
1108 else
[551]1109 *tpm = 0;
1110 if (!Dos16MemAvail(&amem))
1111 CommaFmtULL(tm, sizeof(tm), amem, 'M');
1112 else
1113 *tm = 0;
1114 CommaFmtULL(tb, sizeof(tb), ffb.cbFile, 'M');
1115 sprintf(s, " %s %s%s%s%s%s",
1116 GetPString(IDS_SWAPFILETEXT),
1117 tb,
1118 *tm ? GetPString(IDS_TREEMEMTEXT) : NullStr,
1119 tm, *tpm ? "/" : NullStr, tpm);
1120 WinSetWindowText(hwndStatus2, s);
[176]1121 }
1122 else
[551]1123 WinSetWindowText(hwndStatus2, NullStr);
[2]1124 }
[551]1125 else
1126 WinSetWindowText(hwndStatus2, NullStr);
1127 }
1128 if (msg == UM_TIMER)
1129 return 0;
1130 break;
[2]1131
[551]1132 case WM_PRESPARAMCHANGED:
1133 PresParamChanged(hwnd, "TreeCnr", mp1, mp2);
1134 break;
[2]1135
[551]1136 case UM_FILESMENU:
1137 {
1138 PCNRITEM pci;
1139 HWND menuHwnd = (HWND) 0;
[1251]1140 FSALLOCATE fsa;
[2]1141
[551]1142 pci = (PCNRITEM) CurrentRecord(hwnd);
1143 if (pci && (INT) pci != -1) {
[1335]1144 if (IsRoot(pci->pszFileName) || !DosQueryFSInfo(toupper(*pci->pszFileName) - '@',
1145 FSIL_ALLOC, &fsa,
1146 sizeof(FSALLOCATE)))
[875]1147 menuHwnd = CheckMenu(hwndMainMenu, &TreeMenu, TREE_POPUP);
[551]1148 else {
[875]1149 menuHwnd = CheckMenu(hwndMainMenu, &DirMenu, DIR_POPUP);
[2]1150// WinEnableMenuItem(DirMenu,
1151// IDM_TREE,
1152// FALSE);
[176]1153 }
[551]1154 if (!(pci->attrFile & FILE_DIRECTORY))
[875]1155 menuHwnd = CheckMenu(hwndMainMenu, &FileMenu, FILE_POPUP);
[2]1156 }
[551]1157 return MRFROMLONG(menuHwnd);
1158 }
[2]1159
[551]1160 case UM_COMPARE:
1161 if (dcd && mp1 && mp2) {
[2]1162
[551]1163 COMPARE *cmp;
[1009]1164 CHAR *leftdir = (CHAR *)mp1, *rightdir = (CHAR *)mp2;
[2]1165
[551]1166 if (!IsFile(leftdir) && !IsFile(rightdir)) {
1167 cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__);
1168 if (cmp) {
1169 cmp->size = sizeof(COMPARE);
1170 strcpy(cmp->leftdir, leftdir);
1171 strcpy(cmp->rightdir, rightdir);
1172 cmp->hwndParent = dcd->hwndParent;
1173 cmp->dcd.hwndParent = dcd->hwndParent;
1174 WinDlgBox(HWND_DESKTOP,
1175 HWND_DESKTOP,
1176 CompareDlgProc, FM3ModHandle, COMP_FRAME, MPFROMP(cmp));
[176]1177 }
[2]1178 }
[551]1179 }
1180 return 0;
[2]1181
[551]1182 case UM_UPDATERECORDLIST:
1183 if (dcd && mp1)
1184 WinSendMsg(dcd->hwndObject, msg, mp1, mp2);
1185 return 0;
[2]1186
[551]1187 case UM_UPDATERECORD:
1188 if (dcd && mp1) {
[2]1189
[551]1190 CHAR *filename;
[2]1191
[551]1192 filename = mp1;
1193 if (filename)
1194 UpdateCnrRecord(hwnd, filename, TRUE, dcd);
1195 }
1196 return 0;
[2]1197
[551]1198 case WM_SETFOCUS:
1199 if (dcd && hwndStatus && mp2) {
1200 WinSendMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
1201 if (hwndMain)
1202 PostMsg(hwndMain, UM_ADVISEFOCUS, MPFROMLONG(dcd->hwndFrame), MPVOID);
1203 }
1204 break;
[2]1205
[551]1206 case UM_RESCAN:
1207 if (dcd && dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
1208 /*
1209 * put name of our window on status line
1210 */
[2]1211
[551]1212 PCNRITEM pci = NULL;
1213 CHAR str[CCHMAXPATH + 6];
[2]1214
[551]1215 if (fAutoView && hwndMain) {
1216 pci = WinSendMsg(hwnd,
1217 CM_QUERYRECORDEMPHASIS,
1218 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
1219 if (pci && (INT) pci != -1 && fComments &&
[730]1220 !(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW))
1221 WinSendMsg(hwndMain, UM_LOADFILE, MPFROMP(pci->pszFileName), MPVOID);
[551]1222 else
1223 WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
1224 }
1225 if (!fAutoView || !hwndMain)
1226 pci = (PCNRITEM) WinSendMsg(hwnd,
1227 CM_QUERYRECORDEMPHASIS,
1228 MPFROMLONG(CMA_FIRST),
1229 MPFROMSHORT(CRA_CURSORED));
1230 if ((INT) pci == -1)
1231 pci = NULL;
1232 if (pci) {
1233 if (*(ULONG *) realappname == FM3UL) {
[730]1234 sprintf(str, "%s %s", GetPString(IDS_DTTEXT), pci->pszFileName);
[551]1235 WinSetWindowText(dcd->hwndFrame, str);
1236 WinSetWindowText(WinWindowFromID(dcd->hwndFrame, FID_TITLEBAR),
1237 str);
[176]1238 }
[551]1239 else
1240 WinSetWindowText(WinWindowFromID(dcd->hwndFrame,
[730]1241 MAIN_STATUS), pci->pszFileName);
[551]1242 if (fMoreButtons && hwndName) {
[730]1243 WinSetWindowText(hwndName, pci->pszFileName);
[551]1244 sprintf(str,
1245 "%04u/%02u/%02u %02u:%02u:%02u",
1246 pci->date.year,
1247 pci->date.month,
1248 pci->date.day,
1249 pci->time.hours, pci->time.minutes, pci->time.seconds);
1250 WinSetWindowText(hwndDate, str);
1251 WinSetWindowText(hwndAttr, pci->pszDispAttr);
[176]1252 }
[2]1253 }
[551]1254 PostMsg(dcd->hwndObject, UM_RESCAN2, MPFROMP(pci), MPVOID);
1255 if (hwndStatus2)
1256 PostMsg(hwnd, UM_TIMER, MPVOID, MPVOID);
1257 }
1258 return 0;
[2]1259
[551]1260 case UM_SETUP2:
1261 {
1262 PCNRITEM pci = (PCNRITEM) mp1;
[2]1263
[551]1264 if (pci)
[730]1265 NotifyError(pci->pszFileName, (ULONG) mp2);
[551]1266 }
1267 return 0;
1268
1269 case UM_SETUP:
[1335]1270# ifdef FORTIFY
1271 // Balance WM_DESTROY
1272 Fortify_EnterScope();
1273# endif
1274
[551]1275 if (!dcd) {
1276 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
1277 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
[2]1278 return 0;
[551]1279 }
1280 else {
1281 if (!dcd->hwndObject) {
1282 /*
1283 * first time through -- set things up
1284 */
1285 CNRINFO cnri;
[2]1286
[1077]1287# ifdef FORTIFY
1288 Fortify_EnterScope();
1289# endif
1290
[551]1291 RestorePresParams(hwnd, "TreeCnr");
1292 memset(&cnri, 0, sizeof(CNRINFO));
1293 cnri.cb = sizeof(CNRINFO);
1294 WinSendMsg(hwnd,
1295 CM_QUERYCNRINFO,
1296 MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
1297 cnri.cyLineSpacing = 0;
[766]1298 cnri.cxTreeIndent = 12;
[551]1299 cnri.pSortRecord = (PVOID) SortTreeCnr;
1300 cnri.flWindowAttr &= (~(CV_NAME | CV_DETAIL | CV_TEXT));
1301 cnri.flWindowAttr |= (CV_TREE | CA_TREELINE | CV_ICON | CV_MINI);
1302 {
1303 ULONG size = sizeof(ULONG);
[2]1304
[551]1305 PrfQueryProfileData(fmprof,
1306 appname,
1307 "TreeflWindowAttr",
1308 (PVOID) & cnri.flWindowAttr, &size);
1309 size = sizeof(MASK);
1310 *dcd->mask.prompt = 0;
1311 if (!*dcd->mask.szMask && !dcd->mask.attrFile) {
1312 if (PrfQueryProfileSize(fmprof,
1313 appname, "TreeFilter", &size) && size) {
1314 PrfQueryProfileData(fmprof,
1315 appname, "TreeFilter", &dcd->mask, &size);
1316 SetMask(NULL, &dcd->mask);
[176]1317 }
[551]1318 else
1319 dcd->mask.attrFile = (FILE_READONLY | FILE_NORMAL |
1320 FILE_ARCHIVED | FILE_DIRECTORY |
1321 FILE_HIDDEN | FILE_SYSTEM);
[176]1322 }
[551]1323 dcd->mask.attrFile |= FILE_DIRECTORY;
[176]1324 }
[551]1325 cnri.flWindowAttr &= (~(CA_MIXEDTARGETEMPH | CA_ORDEREDTARGETEMPH));
1326 cnri.flWindowAttr |= CV_FLOW;
1327 dcd->flWindowAttr = cnri.flWindowAttr;
1328 WinSendMsg(hwnd,
1329 CM_SETCNRINFO,
1330 MPFROMP(&cnri),
1331 MPFROMLONG(CMA_FLWINDOWATTR | CMA_LINESPACING |
1332 CMA_CXTREEINDENT | CMA_PSORTRECORD));
[1335]1333 if (xbeginthread(MakeObjWin,
1334 327680,
1335 dcd,
1336 pszSrcFile,
1337 __LINE__) == -1)
1338 {
[551]1339 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
1340 }
1341 else
[766]1342 DosSleep(1);
[1079]1343# ifdef FORTIFY
1344 Fortify_LeaveScope();
1345# endif
[2]1346 }
[551]1347 }
1348 return 0;
[2]1349
[551]1350 case WM_BUTTON3CLICK:
1351 case WM_CHORD:
1352 {
1353 PCNRITEM pci = NULL;
1354 QUERYRECFROMRECT pqr;
1355 NOTIFYRECORDENTER nr;
1356 BOOL tbool = fDCOpens;
1357 RECTL rectl;
1358 POINTL ptl;
[2]1359
[551]1360 shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL));
1361 if (msg == WM_CHORD) {
1362 if (!WinQueryPointerPos(HWND_DESKTOP, &ptl))
1363 break;
[766]1364 WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1);
[2]1365 }
[551]1366 else {
1367 ptl.x = SHORT1FROMMP(mp1);
1368 ptl.y = SHORT2FROMMP(mp1);
1369 }
1370 memset(&rectl, 0, sizeof(rectl));
1371 memset(&pqr, 0, sizeof(pqr));
1372 pqr.cb = sizeof(pqr);
1373 pqr.rect.xLeft = ptl.x - 1;
1374 pqr.rect.xRight = ptl.x + 1;
1375 pqr.rect.yTop = ptl.y + 1;
1376 pqr.rect.yBottom = ptl.y - 1;
1377 pqr.fsSearch = CMA_PARTIAL;
1378 pci = (PCNRITEM) WinSendMsg(hwnd,
1379 CM_QUERYRECORDFROMRECT,
1380 MPFROMLONG(CMA_FIRST), MPFROMP(&pqr));
1381 if (!pci || (INT) pci == -1)
[687]1382 break; //Probable B3 click on white space Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
[551]1383 else {
1384 memset(&nr, 0, sizeof(nr));
1385 nr.hwndCnr = hwnd;
1386 nr.pRecord = (PRECORDCORE) pci;
1387 fDCOpens = TRUE;
1388 WinSendMsg(hwnd,
1389 WM_CONTROL,
1390 MPFROM2SHORT(WinQueryWindowUShort(hwnd,
1391 QWS_ID),
1392 CN_ENTER), MPFROMP(&nr));
1393 PostMsg(hwnd, UM_RESTOREDC, MPFROMLONG(tbool), MPVOID);
1394 }
1395 }
1396 break;
[2]1397
[551]1398 case UM_RESTOREDC:
1399 fDCOpens = (BOOL) mp1;
1400 return 0;
[2]1401
[551]1402 case WM_CONTROL:
1403 DosError(FERR_DISABLEHARDERR);
1404 if (dcd) {
1405 switch (SHORT2FROMMP(mp1)) {
1406 case CN_BEGINEDIT:
1407 case CN_REALLOCPSZ:
1408 case CN_ENDEDIT:
1409 {
1410 MRESULT mre;
[2]1411
[551]1412 mre = CnrDirectEdit(hwnd, msg, mp1, mp2);
1413 if (mre != (MRESULT) - 1)
1414 return mre;
1415 }
1416 break;
[2]1417
[551]1418 case CN_DRAGLEAVE:
1419 if (mp2) {
[2]1420
[551]1421 PDRAGINFO pDInfo;
[2]1422
[618]1423 // fixme to know why - seems superfluous
[551]1424 pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
1425 DrgAccessDraginfo(pDInfo);
1426 DrgFreeDraginfo(pDInfo);
1427 }
1428 return 0;
[2]1429
[551]1430 case CN_DRAGAFTER:
1431 case CN_DRAGOVER:
1432 if (mp2) {
[2]1433
[551]1434 PDRAGITEM pDItem;
1435 PDRAGINFO pDInfo;
1436 PCNRITEM pci;
1437 USHORT uso;
[2]1438
[551]1439 pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
[618]1440 if (!DrgAccessDraginfo(pDInfo)) {
1441 Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
1442 "DrgAccessDraginfo");
1443 return (MRFROM2SHORT(DOR_NODROP, 0)); /* Drop not valid */
1444 }
[551]1445 pci = (PCNRITEM) ((PCNRDRAGINFO) mp2)->pRecord;
1446 if ((INT) pci == -1)
1447 pci = NULL;
1448 if (pci && (pci->flags & (RECFLAGS_ENV | RECFLAGS_NODROP))) {
1449 DrgFreeDraginfo(pDInfo);
1450 return MRFROM2SHORT(DOR_NODROP, 0);
1451 }
1452 if (!WinIsWindowEnabled(dcd->hwndFrame)) {
1453 DrgFreeDraginfo(pDInfo);
1454 return MRFROM2SHORT(DOR_NODROP, 0);
1455 }
1456 if (pci) {
1457 uso = pDInfo->usOperation;
1458 if (uso == DO_DEFAULT)
1459 uso = (fCopyDefault) ? DO_COPY : DO_MOVE;
1460 if (!(pci->attrFile & FILE_DIRECTORY)) {
1461 if (uso != DO_LINK && uso != DO_COPY && uso != DO_MOVE) {
[176]1462 DrgFreeDraginfo(pDInfo);
[551]1463 return (MRFROM2SHORT(DOR_NODROP, 0));
[176]1464 }
[551]1465 if (uso != DO_LINK &&
[730]1466 !(driveflags[toupper(*pci->pszFileName) - 'A'] &
[551]1467 DRIVE_NOTWRITEABLE)) {
[2]1468
[551]1469 ARC_TYPE *info;
[2]1470
[551]1471 if (!fQuickArcFind &&
[730]1472 !(driveflags[toupper(*pci->pszFileName) - 'A'] &
[551]1473 DRIVE_SLOW))
[730]1474 info = find_type(pci->pszFileName, NULL);
[551]1475 else
[730]1476 info = quick_find_type(pci->pszFileName, NULL);
[551]1477 if (!info || ((uso == DO_MOVE && !info->move) ||
1478 (uso == DO_COPY && !info->create))) {
1479 DrgFreeDraginfo(pDInfo);
1480 return (MRFROM2SHORT(DOR_NODROP, 0));
[176]1481 }
1482 }
1483 }
[551]1484 }
[618]1485 pDItem = DrgQueryDragitemPtr(pDInfo, /* Access DRAGITEM */
1486 0); /* Index to DRAGITEM */
[551]1487 if (DrgVerifyRMF(pDItem, /* Check valid rendering */
[618]1488 DRM_OS2FILE, /* mechanisms and data */
1489 NULL) || DrgVerifyRMF(pDItem, DRM_FM2ARCMEMBER, DRF_FM2ARCHIVE)) { /* formats */
1490 DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
[551]1491 if (!pci || (INT) pci == -1)
1492 return MRFROM2SHORT(DOR_DROP, DO_MOVE);
[730]1493 if (driveflags[toupper(*pci->pszFileName) - 'A'] &
[551]1494 DRIVE_NOTWRITEABLE)
1495 return MRFROM2SHORT(DOR_DROP, DO_LINK);
[730]1496 if (toupper(*pci->pszFileName) < 'C')
[551]1497 return MRFROM2SHORT(DOR_DROP, DO_COPY);
[618]1498 return MRFROM2SHORT(DOR_DROP, /* Return okay to drop */
[551]1499 ((fCopyDefault) ? DO_COPY : DO_MOVE));
1500 }
[618]1501 DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
[551]1502 }
[618]1503 return MRFROM2SHORT(DOR_NODROP, 0); /* Drop not valid */
[2]1504
[551]1505 case CN_INITDRAG:
1506 {
1507 PCNRDRAGINIT pcd = (PCNRDRAGINIT) mp2;
1508 PCNRITEM pci;
[2]1509
[551]1510 if (!pcd) {
1511 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
1512 break;
1513 }
1514 else {
1515 pci = (PCNRITEM) pcd->pRecord;
1516 if (!pci || (INT) pci == -1) {
1517 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
1518 break;
[176]1519 }
[551]1520 if (pci->flags & (RECFLAGS_ENV | RECFLAGS_NODRAG)) {
1521 Runtime_Error(pszSrcFile, __LINE__, "drag not allowed");
1522 break;
1523 }
1524 if (hwndStatus2) {
[730]1525 WinSetWindowText(hwndStatus2, (IsRoot(pci->pszFileName)) ?
[551]1526 GetPString(IDS_DRAGROOTTEXT) :
1527 (pci->attrFile & FILE_DIRECTORY) ?
1528 GetPString(IDS_DRAGDIRTEXT) :
1529 GetPString(IDS_DRAGFILETEXT));
1530 }
1531 DoFileDrag(hwnd, dcd->hwndObject, mp2, NULL, NULL, TRUE);
1532 if (hwndStatus2) {
1533 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
1534 }
1535 }
1536 }
1537 return 0;
[2]1538
[551]1539 case CN_DROP:
1540 {
1541 LISTINFO *li;
1542 ULONG action = UM_ACTION;
[2]1543
[726]1544 li = DoFileDrop(hwnd, NULL, TRUE, mp1, mp2);
1545 CheckPmDrgLimit(((PCNRDRAGINFO)mp2)->pDragInfo);
[551]1546 if (li) {
1547 if (!*li->targetpath) {
1548 if (li->list[0])
1549 PMMkDir(dcd->hwndParent, li->list[0], FALSE);
1550 FreeListInfo(li);
1551 return 0;
1552 }
1553 if (li->list && li->list[0] && IsRoot(li->list[0]))
1554 li->type = DO_LINK;
1555 else if (fDragndropDlg && (!*li->arcname || !li->info)) {
[2]1556
[551]1557 CHECKLIST cl;
[2]1558
[551]1559 memset(&cl, 0, sizeof(cl));
1560 cl.size = sizeof(cl);
1561 cl.flags = li->type;
1562 cl.list = li->list;
1563 cl.cmd = li->type;
1564 cl.prompt = li->targetpath;
1565 li->type = WinDlgBox(HWND_DESKTOP,
1566 dcd->hwndParent,
1567 DropListProc,
[618]1568 FM3ModHandle, DND_FRAME, MPFROMP(&cl));
1569 if (li->type == DID_ERROR)
1570 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,
1571 "Drag & Drop Dialog");
1572 if (!li->type) {
[551]1573 FreeListInfo(li);
1574 return 0;
1575 }
1576 li->list = cl.list;
[618]1577 if (!li->list || !li->list[0]) {
[551]1578 FreeListInfo(li);
1579 return 0;
1580 }
1581 }
1582 switch (li->type) {
1583 case DO_LINK:
1584 if (fLinkSetsIcon) {
1585 li->type = IDM_SETICON;
1586 action = UM_MASSACTION;
1587 }
1588 else
1589 li->type = IDM_COMPARE;
1590 break;
1591 case DND_EXTRACT:
1592 if (*li->targetpath && !IsFile(li->targetpath))
1593 li->type = IDM_EXTRACT;
1594 break;
1595 case DND_MOVE:
1596 li->type = IDM_MOVE;
1597 if (*li->targetpath && IsFile(li->targetpath) == 1) {
1598 action = UM_MASSACTION;
1599 li->type = IDM_ARCHIVEM;
1600 }
1601 break;
1602 case DND_WILDMOVE:
1603 li->type = IDM_WILDMOVE;
1604 if (*li->targetpath && IsFile(li->targetpath) == 1) {
1605 action = UM_MASSACTION;
1606 li->type = IDM_ARCHIVEM;
1607 }
1608 break;
1609 case DND_OBJECT:
1610 li->type = IDM_OBJECT;
1611 action = UM_MASSACTION;
1612 break;
1613 case DND_SHADOW:
1614 li->type = IDM_SHADOW;
1615 action = UM_MASSACTION;
1616 break;
1617 case DND_COMPARE:
1618 li->type = IDM_COMPARE;
1619 break;
1620 case DND_SETICON:
1621 action = UM_MASSACTION;
1622 li->type = IDM_SETICON;
1623 break;
1624 case DND_COPY:
1625 li->type = IDM_COPY;
1626 if (*li->targetpath && IsFile(li->targetpath) == 1) {
1627 action = UM_MASSACTION;
1628 li->type = IDM_ARCHIVE;
1629 }
1630 break;
1631 case DND_WILDCOPY:
1632 li->type = IDM_WILDCOPY;
1633 if (*li->targetpath && IsFile(li->targetpath) == 1) {
1634 action = UM_MASSACTION;
1635 li->type = IDM_ARCHIVE;
1636 }
1637 break;
1638 default:
1639 if (*li->arcname && li->info) {
1640 action = UM_MASSACTION;
1641 li->type = (li->type == DO_MOVE) ?
1642 IDM_FAKEEXTRACTM : IDM_FAKEEXTRACT;
1643 }
1644 else if (*li->targetpath && IsFile(li->targetpath) == 1) {
1645 action = UM_MASSACTION;
1646 li->type = (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE;
1647 }
1648 else
1649 li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY;
1650 break;
1651 }
1652 if (!li->list || !li->list[0])
1653 FreeListInfo(li);
1654 else if (!PostMsg(dcd->hwndObject, action, MPFROMP(li), MPVOID))
1655 FreeListInfo(li);
1656 else {
[2]1657
[551]1658 USHORT usop = 0;
[2]1659
[551]1660 switch (li->type) {
1661 case IDM_COPY:
1662 case IDM_WILDCOPY:
1663 usop = DO_COPY;
1664 break;
1665 case IDM_MOVE:
1666 case IDM_WILDMOVE:
1667 case IDM_ARCHIVEM:
1668 usop = DO_MOVE;
1669 break;
[176]1670 }
[551]1671 if (usop)
1672 return MRFROM2SHORT(DOR_DROP, usop);
[176]1673 }
[551]1674 }
1675 }
1676 return 0;
[2]1677
[551]1678 case CN_EMPHASIS:
1679 if (!fDummy) {
[2]1680
[551]1681 PNOTIFYRECORDEMPHASIS pre = mp2;
[2]1682
[551]1683 if (pre->fEmphasisMask & CRA_SELECTED) {
1684 if (pre->pRecord->flRecordAttr & CRA_SELECTED) {
1685 if (((PCNRITEM) (pre->pRecord))->attrFile & FILE_DIRECTORY) {
1686 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
1687 if (fFollowTree &&
1688 !(driveflags
[730]1689 [toupper(*((PCNRITEM) pre->pRecord)->pszFileName) -
[551]1690 'A'] & DRIVE_INVALID)) {
1691 if (!LastDir && !ParentIsDesktop(hwnd, dcd->hwndParent))
1692 LastDir = FindDirCnr(dcd->hwndParent);
1693 if (LastDir) {
[2]1694
[551]1695 NOTIFYRECORDENTER pri;
1696 BOOL tbool = fDCOpens;
[2]1697
[551]1698 fDCOpens = FALSE;
1699 memset(&pri, 0, sizeof(pri));
1700 pri.hwndCnr = hwnd;
1701 pri.fKey = FALSE;
1702 pri.pRecord = pre->pRecord;
1703 WinSendMsg(hwnd,
1704 WM_CONTROL,
1705 MPFROM2SHORT(SHORT1FROMMP(mp1),
1706 CN_ENTER), MPFROMP(&pri));
1707 fDCOpens = tbool;
[176]1708 }
1709 }
[551]1710 if (*(ULONG *) realappname != FM3UL)
1711 WinSetWindowText(WinWindowFromID(dcd->hwndFrame,
1712 MAIN_STATUS),
[730]1713 ((PCNRITEM) (pre->pRecord))->pszFileName);
[176]1714 }
1715 }
[551]1716 }
1717 }
1718 break;
[2]1719
[551]1720 case CN_CONTEXTMENU:
1721 {
1722 PCNRITEM pci = (PCNRITEM) mp2;
1723 BOOL wasFollowing;
[2]1724
[1299]1725 //DosEnterCritSec(); //GKY 11-28-08
[551]1726 wasFollowing = fFollowTree;
1727 fFollowTree = FALSE;
[1299]1728 //DosExitCritSec();
[551]1729 if (pci && (INT) pci != -1 && !(pci->flags & RECFLAGS_ENV)) {
1730 WinSendMsg(hwnd,
1731 CM_SETRECORDEMPHASIS,
1732 MPFROMP(pci), MPFROM2SHORT(TRUE, CRA_CURSORED));
1733 MarkAll(hwnd, FALSE, FALSE, TRUE);
1734 if (!(pci->attrFile & FILE_DIRECTORY))
[875]1735 dcd->hwndLastMenu = CheckMenu(hwndMainMenu, &FileMenu, FILE_POPUP);
[730]1736 else if (!IsRoot(pci->pszFileName))
[875]1737 dcd->hwndLastMenu = CheckMenu(hwndMainMenu, &DirMenu, DIR_POPUP);
[551]1738 else
[875]1739 dcd->hwndLastMenu = CheckMenu(hwndMainMenu, &TreeMenu, TREE_POPUP);
[551]1740 }
1741 else {
[875]1742 dcd->hwndLastMenu = CheckMenu(hwndMainMenu, &TreeCnrMenu, TREECNR_POPUP);
[551]1743 if (dcd->hwndLastMenu && !dcd->cnremphasized) {
1744 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
1745 MPFROM2SHORT(TRUE, CRA_SOURCE));
1746 dcd->cnremphasized = TRUE;
1747 }
1748 }
1749 if (dcd->hwndLastMenu) {
1750 if (dcd->hwndLastMenu == DirMenu)
1751 WinEnableMenuItem(DirMenu, IDM_TREE, FALSE);
1752 if (dcd->hwndLastMenu == TreeCnrMenu) {
1753 if (dcd->flWindowAttr & CV_MINI)
1754 WinCheckMenuItem(dcd->hwndLastMenu, IDM_MINIICONS, TRUE);
1755 }
1756 if (!PopupMenu(hwnd, hwnd, dcd->hwndLastMenu)) {
1757 if (dcd->cnremphasized) {
1758 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
1759 MPFROM2SHORT(FALSE, CRA_SOURCE));
1760 dcd->cnremphasized = FALSE;
[176]1761 }
[551]1762 if (dcd->hwndLastMenu != TreeCnrMenu)
1763 MarkAll(hwnd, TRUE, FALSE, TRUE);
[176]1764 }
[551]1765 }
[1299]1766 //DosEnterCritSec(); //GKY 11-28-08
[551]1767 fFollowTree = wasFollowing;
[1299]1768 //DosExitCritSec();
[551]1769 }
1770 break;
[2]1771
[551]1772 case CN_ENTER:
1773 if (mp2) {
1774 PCNRITEM pci = (PCNRITEM) ((PNOTIFYRECORDENTER) mp2)->pRecord;
[2]1775
[551]1776 PostMsg(hwnd, UM_ENTER, MPFROMP(pci), MPVOID);
1777 }
1778 break;
[2]1779
[551]1780 case CN_COLLAPSETREE:
1781 case CN_EXPANDTREE:
1782 {
1783 PCNRITEM pci = (PCNRITEM) mp2;
[2]1784
[551]1785 if (pci && (INT) pci != -1 && !(pci->flags & RECFLAGS_ENV)) {
[730]1786 if (driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_REMOVABLE) {
[2]1787
[551]1788 struct
1789 {
1790 ULONG serial;
1791 CHAR volumelength;
1792 CHAR volumelabel[CCHMAXPATH];
1793 }
1794 volser;
[2]1795
[551]1796 memset(&volser, 0, sizeof(volser));
1797 DosError(FERR_DISABLEHARDERR);
[730]1798 if (!DosQueryFSInfo(toupper(*pci->pszFileName) - '@',
[551]1799 FSIL_VOLSER, &volser,
1800 (ULONG) sizeof(volser))) {
1801 if (SHORT2FROMMP(mp1) == CN_COLLAPSETREE &&
1802 !volser.serial ||
[730]1803 driveserial[toupper(*pci->pszFileName) - 'A'] !=
[551]1804 volser.serial)
1805 UnFlesh(hwnd, pci);
1806 if (SHORT2FROMMP(mp1) != CN_COLLAPSETREE ||
1807 (!volser.serial ||
[730]1808 driveserial[toupper(*pci->pszFileName) - 'A'] !=
[551]1809 volser.serial)) {
1810 if (Flesh(hwnd, pci) &&
1811 SHORT2FROMMP(mp1) == CN_EXPANDTREE &&
1812 !dcd->suspendview && fTopDir)
1813 PostMsg(hwnd, UM_TOPDIR, MPFROMP(pci), MPVOID);
[176]1814 }
[730]1815 driveserial[toupper(*pci->pszFileName) - 'A'] = volser.serial;
[176]1816 }
[551]1817 else {
[730]1818 driveserial[toupper(*pci->pszFileName) - 'A'] = -1;
[551]1819 UnFlesh(hwnd, pci);
1820 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
1821 DosBeep(250, 100);
1822 }
[176]1823 }
[551]1824 else if (SHORT2FROMMP(mp1) == CN_EXPANDTREE) {
1825 if (Flesh(hwnd, pci) && !dcd->suspendview && fTopDir)
1826 PostMsg(hwnd, UM_TOPDIR, MPFROMP(pci), MPVOID);
1827 }
1828 if (SHORT2FROMMP(mp1) == CN_EXPANDTREE && !dcd->suspendview)
1829 WinSendMsg(hwnd, UM_FILTER, MPVOID, MPVOID);
1830 }
1831 }
1832 break;
1833 } // switch WM_CONTROL
1834 }
1835 return 0;
[2]1836
[551]1837 case UM_ACTION:
1838 if (mp1) {
[2]1839
[551]1840 LISTINFO *li = mp1;
1841 ULONG action = (ULONG) mp2;
[2]1842
[551]1843 if (!li->list || !li->list[0] ||
1844 !PostMsg(dcd->hwndObject, action, MPFROMP(li), MPVOID))
1845 FreeListInfo(li);
1846 }
1847 return 0;
[2]1848
[551]1849 case UM_SHOWME:
1850 if (mp1 && dcd) {
[1009]1851 CHAR *dir = xstrdup((CHAR *)mp1, pszSrcFile, __LINE__);
[551]1852
1853 if (dir) {
1854 if (!PostMsg(dcd->hwndObject, UM_SHOWME, MPFROMP(dir), MPVOID))
[1039]1855 free(dir);
[2]1856 }
[551]1857 }
1858 return 0;
[2]1859
[551]1860 case UM_TOPDIR:
1861 if (mp1) {
[2]1862
[551]1863 PCNRITEM pci = (PCNRITEM) mp1;
[2]1864
[551]1865 ShowCnrRecord(hwnd, (PMINIRECORDCORE) pci);
1866 }
1867 return 0;
[2]1868
[551]1869 case UM_ENTER:
1870 {
[847]1871 FILEFINDBUF3 ffb;
[551]1872 HDIR hDir = HDIR_CREATE;
[761]1873 ULONG nm = 1;
[551]1874 APIRET status;
1875 BOOL IsOk = FALSE;
1876 ULONG ulDriveNum, ulDriveMap;
1877 PCNRITEM pciP, pciL, pci;
1878 ULONG fl = SWP_ACTIVATE;
[2]1879
[551]1880 if (fFollowTree)
1881 fl = 0;
1882 SetShiftState();
1883 pci = (PCNRITEM) mp1;
1884 if (pci &&
1885 (INT) pci != -1 &&
1886 !(pci->rc.flRecordAttr & CRA_INUSE) &&
[730]1887 !(pci->flags & RECFLAGS_ENV) && IsFullName(pci->pszFileName)) {
1888 if (driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_INVALID) {
[551]1889 DosBeep(50, 100);
1890 if (hwndStatus)
1891 WinSetWindowText(hwndStatus, GetPString(IDS_RESCANSUGTEXT));
1892 return 0;
1893 }
1894 DosError(FERR_DISABLEHARDERR);
1895 if (!DosQCurDisk(&ulDriveNum, &ulDriveMap)) {
[766]1896 if (!(ulDriveMap & 1 << (toupper(*pci->pszFileName) - 'A'))) {
[176]1897 pciL = pciP = pci;
[551]1898 for (;;) {
[176]1899 pciP = WinSendMsg(hwnd,
1900 CM_QUERYRECORD,
1901 MPFROMP(pciL),
[551]1902 MPFROM2SHORT(CMA_PARENT, CMA_ITEMORDER));
1903 if (pciP && (INT) pciP != -1)
[176]1904 pciL = pciP;
1905 else {
1906 pciP = pciL;
1907 break;
1908 }
[751]1909 } // for
1910 RemoveCnrItems(hwnd, pciP, 1, CMA_FREE | CMA_INVALIDATE);
[551]1911 return 0;
1912 }
1913 }
[730]1914 if (driveflags[toupper(*pci->pszFileName) - 'A'] &
[551]1915 (DRIVE_REMOVABLE | DRIVE_NOPRESCAN)) {
1916
1917 struct
1918 {
1919 ULONG serial;
1920 CHAR volumelength;
1921 CHAR volumelabel[CCHMAXPATH];
1922 }
1923 volser;
1924
1925 pciL = pciP = pci;
1926 for (;;) {
1927 pciP = WinSendMsg(hwnd,
1928 CM_QUERYRECORD,
1929 MPFROMP(pciL),
1930 MPFROM2SHORT(CMA_PARENT, CMA_ITEMORDER));
1931 if (pciP && (INT) pciP != -1)
1932 pciL = pciP;
1933 else {
1934 pciP = pciL;
1935 break;
[176]1936 }
[551]1937 }
[730]1938 if ((driveflags[toupper(*pci->pszFileName) - 'A'] &
[176]1939 DRIVE_NOPRESCAN) ||
[730]1940 (toupper(*pci->pszFileName) > 'B' &&
1941 !(driveflags[toupper(*pci->pszFileName) - 'A'] &
[551]1942 DRIVE_CDROM))) {
[2]1943
[730]1944 INT removable, x = (INT) (toupper(*pci->pszFileName) - 'A');
[551]1945 ULONG drvtype;
1946 CHAR FileSystem[CCHMAXPATH];
[2]1947
[551]1948 DosError(FERR_DISABLEHARDERR);
[730]1949 removable = CheckDrive(toupper(*pciP->pszFileName),
[551]1950 FileSystem, &drvtype);
1951 if (removable != -1) {
1952 driveflags[x] &= (DRIVE_IGNORE | DRIVE_NOPRESCAN |
1953 DRIVE_NOLOADICONS | DRIVE_NOLOADSUBJS |
1954 DRIVE_NOLOADLONGS | DRIVE_INCLUDEFILES |
[555]1955 DRIVE_SLOW | DRIVE_NOSTATS);
[527]1956
[551]1957 if (removable == 1)
1958 driveflags[x] |= DRIVE_REMOVABLE;
1959 if (drvtype & DRIVE_REMOTE)
1960 driveflags[x] |= DRIVE_REMOTE;
[618]1961 if (!strcmp(FileSystem, CBSIFS)) {
[552]1962 driveflags[x] |= DRIVE_ZIPSTREAM;
[618]1963 driveflags[x] &= (~DRIVE_REMOTE);
1964 }
1965 if(!strcmp(FileSystem,NDFS32)) {
1966 driveflags[x] |= DRIVE_VIRTUAL;
1967 driveflags[x] &= (~DRIVE_REMOTE);
1968 }
1969 if(!strcmp(FileSystem,RAMFS)) {
1970 driveflags[x] |= DRIVE_RAMDISK;
1971 driveflags[x] &= (~DRIVE_REMOTE);
1972 }
[552]1973 if (!strcmp(FileSystem, CDFS) || !strcmp(FileSystem, ISOFS))
[551]1974 driveflags[x] |= (DRIVE_REMOVABLE |
[618]1975 DRIVE_NOTWRITEABLE | DRIVE_CDROM);
1976 if(!strcmp(FileSystem,NTFS))
1977 driveflags[x] |= DRIVE_NOTWRITEABLE;
[551]1978 if (strcmp(FileSystem, HPFS) &&
1979 strcmp(FileSystem, JFS) &&
1980 strcmp(FileSystem, CDFS) &&
[618]1981 strcmp(FileSystem, ISOFS) &&
1982 strcmp(FileSystem, RAMFS) &&
[551]1983 strcmp(FileSystem, FAT32) &&
[618]1984 strcmp(FileSystem, NDFS32) &&
1985 strcmp(FileSystem, NTFS) &&
1986 strcmp(FileSystem, HPFS386)) {
[551]1987 driveflags[x] |= DRIVE_NOLONGNAMES;
[618]1988 }
1989 SelectDriveIcon(pciP);
[551]1990 WinSendMsg(hwnd,
1991 CM_INVALIDATERECORD,
1992 MPFROMP(&pciP),
1993 MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION));
1994 if (hwndMain)
1995 PostMsg(hwndMain, UM_BUILDDRIVEBAR, MPVOID, MPVOID);
[176]1996 }
[551]1997 }
1998 memset(&volser, 0, sizeof(volser));
1999 DosError(FERR_DISABLEHARDERR);
[730]2000 status = DosQueryFSInfo(toupper(*pci->pszFileName) - '@',
[551]2001 FSIL_VOLSER, &volser,
2002 (ULONG) sizeof(volser));
2003 if (!status) {
2004 if (!volser.serial ||
[730]2005 driveserial[toupper(*pci->pszFileName) - 'A'] !=
[551]2006 volser.serial) {
2007 UnFlesh(hwnd, pciP);
2008 Flesh(hwnd, pciP);
[730]2009 driveserial[toupper(*pci->pszFileName) - 'A'] = volser.serial;
[551]2010 }
2011 pciL = WinSendMsg(hwnd,
2012 CM_QUERYRECORD,
2013 MPFROMP(pciP),
2014 MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
2015 if (!pciL)
2016 Flesh(hwnd, pciP);
2017 }
2018 else {
[730]2019 driveserial[toupper(*pci->pszFileName) - 'A'] = -1;
[551]2020 UnFlesh(hwnd, pci);
2021 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
2022 PostMsg(hwnd, UM_SETUP2, MPFROMP(pci), MPFROMLONG(status));
2023 return 0;
2024 }
2025 }
2026 status = 0;
[730]2027 IsOk = (IsRoot(pci->pszFileName) &&
2028 IsValidDrive(toupper(*pci->pszFileName)));
[551]2029 if (!IsOk) {
2030 DosError(FERR_DISABLEHARDERR);
[847]2031 status = DosFindFirst(pci->pszFileName, &hDir,
2032 FILE_NORMAL | FILE_DIRECTORY |
2033 FILE_ARCHIVED | FILE_READONLY |
2034 FILE_HIDDEN | FILE_SYSTEM,
2035 &ffb, sizeof(ffb), &nm, FIL_STANDARD);
[551]2036 priority_bumped();
2037 }
2038 if (!status) {
2039 if (!IsOk)
2040 DosFindClose(hDir);
2041 if (IsOk || (ffb.attrFile & FILE_DIRECTORY)) {
2042 if ((shiftstate & (KC_CTRL | KC_ALT)) == (KC_CTRL | KC_ALT)) {
[176]2043 PostMsg(hwnd,
[551]2044 WM_COMMAND, MPFROM2SHORT(IDM_SHOWALLFILES, 0), MPVOID);
[176]2045 return 0;
2046 }
[551]2047 if ((shiftstate & (KC_CTRL | KC_SHIFT)) == (KC_CTRL | KC_SHIFT)) {
[730]2048 OpenObject(pci->pszFileName, Settings, dcd->hwndFrame);
[551]2049 return 0;
2050 }
2051 if (!(shiftstate & (KC_CTRL | KC_SHIFT))) {
2052 if (!ParentIsDesktop(hwnd, dcd->hwndParent)) {
[730]2053 if (FindDirCnrByName(pci->pszFileName, TRUE))
[551]2054 return 0;
[176]2055 }
2056 }
[551]2057 if ((shiftstate & KC_CTRL) ||
2058 (!(shiftstate & KC_SHIFT) &&
2059 ParentIsDesktop(hwnd, dcd->hwndParent) && fVTreeOpensWPS)) {
[2]2060
[551]2061 ULONG size = sizeof(ULONG), flWindowAttr = CV_ICON;
2062 CHAR s[33];
[2]2063
[551]2064 strcpy(s, "ICON");
2065 PrfQueryProfileData(fmprof,
2066 appname,
2067 "DirflWindowAttr",
2068 (PVOID) & flWindowAttr, &size);
2069 if (flWindowAttr & CV_DETAIL) {
[730]2070 if (IsRoot(pci->pszFileName))
[551]2071 strcpy(s, "TREE");
2072 else
2073 strcpy(s, "DETAILS");
[176]2074 }
[730]2075 OpenObject(pci->pszFileName, s, dcd->hwndFrame);
[551]2076 return 0;
[176]2077 }
[551]2078 if (!ParentIsDesktop(hwnd, dcd->hwndParent) &&
2079 !fDCOpens && !LastDir && !(shiftstate & KC_SHIFT))
2080 LastDir = FindDirCnr(dcd->hwndParent);
2081 if (LastDir && !fDCOpens && !(shiftstate & KC_SHIFT)) {
2082 WinSendMsg(LastDir,
[730]2083 UM_SETDIR, MPFROMP(pci->pszFileName), MPVOID);
[551]2084 WinSetWindowPos(WinQueryWindow(WinQueryWindow(LastDir,
2085 QW_PARENT),
2086 QW_PARENT),
2087 HWND_TOP, 0, 0, 0, 0, SWP_ZORDER | fl);
2088 }
2089 else
2090 OpenDirCnr(hwnd,
2091 dcd->hwndParent,
[730]2092 dcd->hwndFrame, FALSE, pci->pszFileName);
[176]2093 }
2094 else {
[730]2095 if (!(driveflags[toupper(*pci->pszFileName) - 'A'] &
[551]2096 DRIVE_INCLUDEFILES))
[751]2097 RemoveCnrItems(hwnd, pci, 1, CMA_FREE | CMA_INVALIDATE);
[551]2098 else {
2099
2100 SWP swp;
2101
2102 WinQueryWindowPos(dcd->hwndFrame, &swp);
2103 DefaultViewKeys(hwnd,
2104 dcd->hwndFrame,
[730]2105 dcd->hwndParent, &swp, pci->pszFileName);
[176]2106 }
2107 }
2108 }
[551]2109 else {
[730]2110 if (!IsRoot(pci->pszFileName)) {
2111 NotifyError(pci->pszFileName, status);
[751]2112 RemoveCnrItems(hwnd, pci, 1, CMA_FREE | CMA_INVALIDATE);
[551]2113 }
2114 }
[2]2115 }
[551]2116 else if (!pci)
2117 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_MKDIR, 0), MPVOID);
2118 if (fFollowTree)
2119 WinSetFocus(HWND_DESKTOP, hwnd);
2120 }
2121 return 0;
[2]2122
[551]2123 case WM_MENUEND:
2124 if (dcd) {
[2]2125
[551]2126 HWND hwndMenu = (HWND) mp2;
[2]2127
[551]2128 if (hwndMenu == TreeCnrMenu || hwndMenu == TreeMenu ||
2129 hwndMenu == DirMenu) {
2130 MarkAll(hwnd, TRUE, FALSE, TRUE);
2131 if (dcd->cnremphasized) {
2132 WinSendMsg(hwnd,
2133 CM_SETRECORDEMPHASIS,
2134 MPVOID, MPFROM2SHORT(FALSE, CRA_SOURCE));
2135 dcd->cnremphasized = FALSE;
[176]2136 }
[2]2137 }
[551]2138 }
2139 break;
[2]2140
[551]2141 case UM_OPENWINDOWFORME:
2142 if (dcd) {
[1009]2143 if (mp1 && !IsFile((CHAR *)mp1))
[551]2144 OpenDirCnr(hwnd, dcd->hwndParent, dcd->hwndFrame, FALSE, (char *)mp1);
2145 }
2146 return 0;
[2]2147
[551]2148 case MM_PORTHOLEINIT:
2149 if (dcd) {
2150 switch (SHORT1FROMMP(mp1)) {
2151 case 0:
2152 case 1:
2153 {
2154 ULONG wmsg;
[2]2155
[551]2156 wmsg = ((SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU);
2157 PortholeInit((HWND) WinSendMsg(dcd->hwndClient,
2158 wmsg, MPVOID, MPVOID), mp1, mp2);
[176]2159 }
[551]2160 break;
[2]2161 }
[551]2162 }
2163 break;
[2]2164
[551]2165 case UM_INITMENU:
2166 case WM_INITMENU:
2167 if (dcd) {
2168 switch (SHORT1FROMMP(mp1)) {
2169 case IDM_FILESMENU:
2170 {
2171 PCNRITEM pci;
[2]2172
[551]2173 pci = (PCNRITEM) CurrentRecord(hwnd);
2174 if (pci && (INT) pci != -1) {
2175 BOOL rdy;
2176 BOOL writeable;
2177 BOOL removable;
2178 BOOL remote;
2179 BOOL underenv;
2180 CHAR chDrvU;
2181 CHAR szDrv[CCHMAXPATH];
[305]2182
[730]2183 strcpy(szDrv, pci->pszFileName);
2184 chDrvU = *pci->pszFileName;
[551]2185 chDrvU = toupper(chDrvU);
2186 MakeValidDir(szDrv);
2187 rdy = *szDrv == chDrvU; // Drive not ready if MakeValidDir changes drive letter
2188 removable = rdy
2189 && (driveflags[chDrvU - 'A'] & DRIVE_REMOVABLE) != 0;
2190 writeable = rdy
2191 && !(driveflags[chDrvU - 'A'] & DRIVE_NOTWRITEABLE);
[1251]2192 remote = rdy && (driveflags[chDrvU - 'A'] & (DRIVE_REMOTE || DRIVE_VIRTUAL)) == 0;
[551]2193 underenv = (pci->flags & RECFLAGS_UNDERENV) != 0;
[305]2194
[877]2195 CopyPresParams((HWND) mp2, hwndMainMenu);
[907]2196 WinEnableMenuItem((HWND) mp2, IDM_INFO, rdy);
[305]2197
[551]2198 WinEnableMenuItem((HWND) mp2, IDM_ATTRS, writeable);
2199 WinEnableMenuItem((HWND) mp2, IDM_EAS, writeable);
2200 WinEnableMenuItem((HWND) mp2, IDM_SUBJECT, writeable);
2201 WinEnableMenuItem((HWND) mp2, IDM_DRVFLAGS, 1); // fixme to allow if not ready
[305]2202
[551]2203 WinEnableMenuItem((HWND) mp2, IDM_ARCHIVE, rdy);
[305]2204
[551]2205 WinEnableMenuItem((HWND) mp2, IDM_UPDATE, !underenv);
2206 WinEnableMenuItem((HWND) mp2, IDM_EXPANDSUBMENU, !underenv);
2207 WinEnableMenuItem((HWND) mp2, IDM_EXPAND, !underenv);
2208 WinEnableMenuItem((HWND) mp2, IDM_COLLAPSE, !underenv);
[305]2209
[551]2210 WinEnableMenuItem((HWND) mp2, IDM_SIZES, rdy);
2211 WinEnableMenuItem((HWND) mp2, IDM_MKDIR, writeable);
2212 WinEnableMenuItem((HWND) mp2, IDM_SHOWALLFILES, rdy);
2213 WinEnableMenuItem((HWND) mp2, IDM_UNDELETE, writeable);
[305]2214
[551]2215 WinEnableMenuItem((HWND) mp2, IDM_CHKDSK, writeable && !remote);
2216 WinEnableMenuItem((HWND) mp2, IDM_FORMAT, writeable && !remote);
2217 WinEnableMenuItem((HWND) mp2, IDM_OPTIMIZE, writeable && !remote);
2218 WinEnableMenuItem((HWND) mp2, IDM_PARTITIONSMENU, !remote);
[305]2219
[551]2220 WinEnableMenuItem((HWND) mp2, IDM_DETACH, remote);
[305]2221
[551]2222 WinEnableMenuItem((HWND) mp2, IDM_EJECT, removable);
[305]2223
[551]2224 WinEnableMenuItem((HWND) mp2, IDM_LOCK, removable);
2225 WinEnableMenuItem((HWND) mp2, IDM_UNLOCK, removable);
[305]2226
[551]2227 WinEnableMenuItem((HWND) mp2, IDM_DELETE, !underenv && writeable);
2228 WinEnableMenuItem((HWND) mp2, IDM_PERMDELETE, !underenv
2229 && writeable);
2230 WinEnableMenuItem((HWND) mp2, IDM_DELETESUBMENU, !underenv
2231 && writeable);
2232 WinEnableMenuItem((HWND) mp2, IDM_MOVEMENU, !underenv
2233 && writeable);
[907]2234 WinEnableMenuItem((HWND) mp2, IDM_RENAME, !underenv && writeable);
[2]2235
[551]2236 }
2237 }
2238 break;
[2]2239
[551]2240 case IDM_VIEWSMENU:
2241 WinCheckMenuItem((HWND) mp2,
2242 IDM_MINIICONS, ((dcd->flWindowAttr & CV_MINI) != 0));
[907]2243 CopyPresParams((HWND) mp2, hwndMainMenu);
[877]2244 WinEnableMenuItem((HWND) mp2, IDM_RESELECT, FALSE);
[907]2245 break;
[2]2246
[551]2247 case IDM_COMMANDSMENU:
[907]2248 SetupCommandMenu((HWND) mp2, hwnd);
2249 CopyPresParams((HWND) mp2, hwndMainMenu);
[551]2250 break;
[2]2251
[551]2252 case IDM_SORTSUBMENU:
2253 SetSortChecks((HWND) mp2, TreesortFlags);
[907]2254 CopyPresParams((HWND) mp2, hwndMainMenu);
2255 break;
[2]2256
[551]2257 case IDM_WINDOWSMENU:
2258 SetupWinList((HWND) mp2,
[907]2259 (hwndMain) ? hwndMain : (HWND) 0, dcd->hwndFrame);
2260 CopyPresParams((HWND) mp2, hwndMainMenu);
[551]2261 break;
2262 }
2263 dcd->hwndLastMenu = (HWND) mp2;
2264 }
2265 if (msg == WM_INITMENU)
2266 break;
2267 return 0;
2268
2269 case UM_COMMAND:
2270 if (!mp1)
2271 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
2272 else {
2273 if (!dcd) {
2274 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
2275 FreeListInfo((LISTINFO *) mp1);
2276 }
[352]2277 else {
[551]2278 if (!PostMsg(dcd->hwndObject, UM_COMMAND, mp1, mp2)) {
2279 Runtime_Error(pszSrcFile, __LINE__, "PostMsg");
2280 FreeListInfo((LISTINFO *) mp1);
[352]2281 }
[551]2282 else
2283 return (MRESULT) TRUE;
[2]2284 }
[551]2285 }
2286 return 0;
[2]2287
[551]2288 case UM_LOADFILE:
2289 if (dcd && mp2) {
[2]2290
[1037]2291 HWND hwnd;
[2]2292
[1037]2293 if ((INT)mp1 == 5 || (INT)mp1 == 13 || (INT)mp1 == 21)
[1077]2294 hwnd = StartViewer(HWND_DESKTOP, (INT)mp1,
2295 (CHAR *)mp2, dcd->hwndFrame);
[1037]2296 else
[1077]2297 hwnd = StartMLEEditor(dcd->hwndParent,
2298 (INT)mp1, (CHAR *)mp2, dcd->hwndFrame);
[1039]2299 free((CHAR *)mp2);
[1037]2300 return MRFROMLONG(hwnd);
[551]2301 }
2302 return 0;
[2]2303
[551]2304 case UM_FIXCNRMLE:
2305 case UM_FIXEDITNAME:
2306 return CommonCnrProc(hwnd, msg, mp1, mp2);
[2]2307
[551]2308 case UM_NOTIFY:
2309 if (mp2)
[1009]2310 Notify((CHAR *)mp2);
[551]2311 return 0;
[2]2312
[551]2313 case UM_FILTER:
2314 if (dcd) {
[2]2315
[551]2316 BOOL tempsusp = dcd->suspendview;
[2]2317
[551]2318 if (mp1) {
[1304]2319 //DosEnterCritSec(); // GKY 11-30-08 moved to SetMask
[1009]2320 SetMask((CHAR *)mp1, &dcd->mask);
[1304]2321 //DosExitCritSec();
[2]2322 }
[551]2323 dcd->suspendview = TRUE;
2324 dcd->mask.attrFile |= FILE_DIRECTORY;
2325 WinSendMsg(hwnd, CM_FILTER, MPFROMP(Filter), MPFROMP(&dcd->mask));
2326 dcd->suspendview = tempsusp;
2327 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
2328 }
2329 return 0;
[2]2330
[551]2331 case UM_DRIVECMD:
2332 if (mp1)
[1009]2333 ShowTreeRec(hwnd, (CHAR *)mp1, FALSE, TRUE);
[551]2334 return 0;
[2]2335
[551]2336 case WM_APPTERMINATENOTIFY:
2337 {
2338 APPNOTIFY *info;
2339 PCNRITEM pci;
2340 CHAR s[] = " :\\";
[2]2341
[551]2342 if (!mp2) {
2343 if (hwndMain)
2344 PostMsg(hwndMain, UM_BUILDDRIVEBAR, MPVOID, MPVOID);
2345 }
2346 info = apphead;
2347 while (info) {
2348 if (info->happ == (HAPP) mp1) {
2349 *s = info->device;
2350 pci = FindCnrRecord(hwnd, s, NULL, FALSE, FALSE, TRUE);
2351 if (pci && (INT) pci != -1) {
2352 driveserial[info->device - 'A'] = -1;
2353 DriveFlagsOne(info->device - 'A');
2354 if (driveflags[info->device - 'A'] &
2355 (DRIVE_INVALID | DRIVE_IGNORE))
[751]2356 RemoveCnrItems(hwnd, pci, 1, CMA_FREE);
[551]2357 else
2358 Flesh(hwnd, pci);
[176]2359 }
[551]2360 if (info->prev)
2361 info->prev->next = info->next;
2362 if (info->next)
2363 info->next->prev = info->prev;
2364 if (apphead == info)
2365 apphead = info->next;
2366 if (apptail == info)
2367 apptail = info->prev;
[1039]2368 free(info);
[551]2369 break;
[176]2370 }
[551]2371 info = info->next;
[2]2372 }
[551]2373 }
2374 break;
[2]2375
[551]2376 case WM_COMMAND:
2377 DosError(FERR_DISABLEHARDERR);
2378 if (dcd) {
2379 if (SwitchCommand(dcd->hwndLastMenu, SHORT1FROMMP(mp1)))
2380 return 0;
2381 switch (SHORT1FROMMP(mp1)) {
2382 case IDM_SETTARGET:
2383 SetTargetDir(hwnd, FALSE);
2384 break;
[2]2385
[551]2386 case IDM_DETACH:
2387 {
2388 CHAR d[3] = " :";
2389 PCNRITEM pci;
2390 PROGDETAILS pgd;
2391 CHAR params[368], *p;
2392 HAPP happ;
[2]2393
[551]2394 pci = (PCNRITEM) CurrentRecord(hwnd);
[730]2395 if (pci && (INT) pci != -1 && isalpha(*pci->pszFileName)) {
2396 *d = toupper(*pci->pszFileName);
[551]2397 p = GetCmdSpec(FALSE);
2398 memset(&pgd, 0, sizeof(pgd));
2399 pgd.Length = sizeof(pgd);
2400 pgd.progt.progc = PROG_WINDOWABLEVIO;
2401 pgd.progt.fbVisible = SHE_VISIBLE;
2402 pgd.pszTitle = GetPString(IDS_DETACHREQUESTTEXT);
2403 pgd.pszExecutable = p;
2404 pgd.pszParameters = params;
2405 pgd.pszStartupDir = NULL;
2406 pgd.pszIcon = NULL;
2407 pgd.pszEnvironment = NULL;
2408 pgd.swpInitial.hwndInsertBehind = HWND_TOP;
2409 pgd.swpInitial.hwnd = hwnd;
2410 pgd.swpInitial.fl = SWP_SHOW | SWP_ACTIVATE;
2411 sprintf(params, "/C NET USE %s /D", d);
2412 happ = WinStartApp(hwnd, &pgd, pgd.pszParameters,
2413 NULL, SAF_MAXIMIZED);
2414 if (!happ) {
2415 saymsg(MB_CANCEL | MB_ICONEXCLAMATION, hwnd,
2416 GetPString(IDS_ERRORTEXT),
2417 GetPString(IDS_CANTSTARTTEXT), p, params);
2418 }
2419 else {
2420 APPNOTIFY *info;
[2]2421
[551]2422 info = xmallocz(sizeof(APPNOTIFY), pszSrcFile, __LINE__);
2423 if (info) {
2424 info->happ = happ;
2425 info->device = *d;
2426 if (!apphead)
2427 apphead = info;
[352]2428 else {
[551]2429 apptail->next = info;
2430 info->prev = apptail;
[176]2431 }
[551]2432 apptail = info;
[176]2433 }
2434 }
[551]2435 }
2436 }
2437 break;
[2]2438
[551]2439 case IDM_REMAP:
2440 WinDlgBox(HWND_DESKTOP, hwnd, RemapDlgProc,
2441 FM3ModHandle, MAP_FRAME, NULL);
2442 break;
[2]2443
[551]2444 case IDM_CONTEXTMENU:
2445 {
2446 PCNRITEM pci;
[2]2447
[551]2448 pci = (PCNRITEM) CurrentRecord(hwnd);
2449 PostMsg(hwnd, WM_CONTROL, MPFROM2SHORT(DIR_CNR, CN_CONTEXTMENU),
2450 MPFROMP(pci));
2451 }
2452 break;
[2]2453
[551]2454 case IDM_FINDINTREE:
2455 {
[1102]2456 PSZ pszTempDir;
[551]2457 PCNRITEM pci;
[2]2458
[551]2459 pci = (PCNRITEM) CurrentRecord(hwnd);
2460 if (pci && (INT) pci != -1) {
[1335]2461 pszTempDir = xstrdup(pci->pszFileName, pszSrcFile, __LINE__);
2462 if (pszTempDir)
[1102]2463 MakeValidDir(pszTempDir);
[551]2464 }
2465 else
[1335]2466 pszTempDir = xstrdup(pFM2SaveDirectory, pszSrcFile, __LINE__);
2467 if (pszTempDir) {
2468 if (WinDlgBox(HWND_DESKTOP, dcd->hwndParent,
2469 WalkAllDlgProc,
2470 FM3ModHandle, WALK_FRAME, MPFROMP(pszTempDir))) {
2471 if (!WinSendMsg(hwnd, UM_SHOWME, MPFROMP(pszTempDir), MPFROMLONG(1)))
2472 free(pszTempDir);
2473 }
2474 else
2475 free(pszTempDir);
2476 }
[551]2477 }
2478 break;
[2]2479
[551]2480 case IDM_BEGINEDIT:
2481 OpenEdit(hwnd);
2482 break;
[2]2483
[551]2484 case IDM_ENDEDIT:
2485 WinSendMsg(hwnd, CM_CLOSEEDIT, MPVOID, MPVOID);
2486 break;
[2]2487
[551]2488 case IDM_FILTER:
2489 {
2490 BOOL empty = FALSE;
2491 PCNRITEM pci;
[2]2492
[551]2493 pci = (PCNRITEM) CurrentRecord(hwnd);
2494 if (!*dcd->mask.szMask)
2495 empty = TRUE;
2496 dcd->mask.fIsTree = TRUE;
2497 *dcd->mask.prompt = 0;
2498 if (pci && (INT) pci != -1)
2499 dcd->mask.fFilesIncluded =
[730]2500 ((driveflags[toupper(*pci->pszFileName) - 'A'] &
[551]2501 DRIVE_INCLUDEFILES) != 0);
2502 else
2503 dcd->mask.fFilesIncluded = FALSE;
2504 if (WinDlgBox(HWND_DESKTOP, hwnd, PickMaskDlgProc,
2505 FM3ModHandle, MSK_FRAME, MPFROMP(&dcd->mask)))
2506 WinSendMsg(hwnd, UM_FILTER, MPVOID, MPVOID);
2507 else if (empty)
2508 *dcd->mask.szMask = 0;
2509 PrfWriteProfileData(fmprof, appname, "TreeFilter", &dcd->mask,
2510 sizeof(MASK));
2511 }
2512 break;
[2]2513
[551]2514 case IDM_SHOWSORT:
[875]2515 QuickPopup(hwnd, dcd, CheckMenu(hwndMainMenu, &TreeCnrMenu, TREECNR_POPUP),
[551]2516 IDM_SORTSUBMENU);
2517 break;
[2]2518
[551]2519 case IDM_SHOWSELECT:
[875]2520 QuickPopup(hwnd, dcd, CheckMenu(hwndMainMenu, &TreeCnrMenu, TREECNR_POPUP),
[551]2521 IDM_SELECTSUBMENU);
2522 break;
[2]2523
[953]2524 case IDM_TREECNRVIEWSETTINGS:
[908]2525 if (!ParentIsDesktop(dcd->hwndParent, dcd->hwndParent))
[953]2526 PostMsg(dcd->hwndParent, msg, MPFROMLONG(IDM_TREECNRVIEWSETTINGS), mp2);
[917]2527 else {
2528 WinDlgBox(HWND_DESKTOP,
2529 hwnd,
2530 CfgDlgProc,
2531 FM3ModHandle,
2532 CFG_FRAME,
[953]2533 MPFROMLONG(IDM_TREECNRVIEWSETTINGS));
[917]2534 }
[551]2535 break;
[2]2536
[551]2537 case IDM_WALKDIR:
2538 case IDM_OPENWALK:
2539 {
2540 CHAR newpath[CCHMAXPATH];
2541 PCNRITEM pci;
[2]2542
[551]2543 pci = (PCNRITEM) CurrentRecord(hwnd);
2544 if (pci && (INT) pci != -1) {
[730]2545 strcpy(newpath, pci->pszFileName);
[551]2546 MakeValidDir(newpath);
2547 }
2548 else
[1102]2549 strcpy(newpath, pFM2SaveDirectory);
[551]2550 if (!WinDlgBox(HWND_DESKTOP, dcd->hwndParent, WalkAllDlgProc,
2551 FM3ModHandle, WALK_FRAME,
2552 MPFROMP(newpath)) || !*newpath)
[176]2553 break;
[551]2554 WinSendMsg(hwnd, UM_OPENWINDOWFORME, MPFROMP(newpath), MPVOID);
2555 }
2556 break;
[2]2557
[551]2558 case IDM_HELP:
2559 if (hwndHelp) {
2560 if (!ParentIsDesktop(dcd->hwndFrame, dcd->hwndParent))
2561 PostMsg(dcd->hwndParent, UM_COMMAND, mp1, mp2);
2562 else
2563 WinSendMsg(hwndHelp, HM_HELP_CONTENTS, MPVOID, MPVOID);
2564 }
2565 break;
[2]2566
[551]2567 case IDM_PARTITION:
[907]2568 runemf2(SEPARATE | WINDOWED, HWND_DESKTOP, pszSrcFile, __LINE__,
2569 NULL, NULL,
[551]2570 "%s", "MINILVM.EXE");
2571 break;
[2]2572
[551]2573 case IDM_PARTITIONDF:
[907]2574 runemf2(SEPARATE | WINDOWED, HWND_DESKTOP, pszSrcFile, __LINE__,
2575 NULL, NULL,
[551]2576 "%s", "DFSOS2.EXE");
2577 break;
[472]2578
[551]2579 case IDM_PARTITIONLVMG:
[907]2580 runemf2(SEPARATE | WINDOWED, HWND_DESKTOP, pszSrcFile, __LINE__,
2581 NULL, NULL,
[551]2582 "%s", "LVMGUI.CMD");
2583 break;
[472]2584
[551]2585 case IDM_PARTITIONFD:
[907]2586 runemf2(SEPARATE | WINDOWED, HWND_DESKTOP, pszSrcFile, __LINE__,
2587 NULL, NULL,
[551]2588 "%s", "FDISKPM.EXE");
2589 break;
[472]2590
[551]2591 case IDM_SORTNAME:
2592 case IDM_SORTFILENAME:
2593 case IDM_SORTSIZE:
2594 case IDM_SORTEASIZE:
2595 case IDM_SORTFIRST:
2596 case IDM_SORTLAST:
2597 case IDM_SORTLWDATE:
2598 case IDM_SORTLADATE:
2599 case IDM_SORTCRDATE:
2600 TreesortFlags &= (SORT_REVERSE | SORT_DIRSFIRST | SORT_DIRSLAST);
2601 case IDM_SORTDIRSFIRST:
2602 case IDM_SORTDIRSLAST:
2603 case IDM_SORTREVERSE:
2604 switch (SHORT1FROMMP(mp1)) {
2605 case IDM_SORTFILENAME:
2606 TreesortFlags |= SORT_FILENAME;
2607 break;
2608 case IDM_SORTSIZE:
2609 TreesortFlags |= SORT_SIZE;
2610 break;
2611 case IDM_SORTEASIZE:
2612 TreesortFlags |= SORT_EASIZE;
2613 break;
2614 case IDM_SORTFIRST:
2615 TreesortFlags |= SORT_FIRSTEXTENSION;
2616 break;
2617 case IDM_SORTLAST:
2618 TreesortFlags |= SORT_LASTEXTENSION;
2619 break;
2620 case IDM_SORTLWDATE:
2621 TreesortFlags |= SORT_LWDATE;
2622 break;
2623 case IDM_SORTLADATE:
2624 TreesortFlags |= SORT_LADATE;
2625 break;
2626 case IDM_SORTCRDATE:
2627 TreesortFlags |= SORT_CRDATE;
2628 break;
2629 case IDM_SORTDIRSFIRST:
2630 if (TreesortFlags & SORT_DIRSFIRST)
2631 TreesortFlags &= (~SORT_DIRSFIRST);
2632 else {
2633 TreesortFlags |= SORT_DIRSFIRST;
2634 TreesortFlags &= (~SORT_DIRSLAST);
2635 }
2636 break;
2637 case IDM_SORTDIRSLAST:
2638 if (TreesortFlags & SORT_DIRSLAST)
2639 TreesortFlags &= (~SORT_DIRSLAST);
2640 else {
2641 TreesortFlags |= SORT_DIRSLAST;
2642 TreesortFlags &= (~SORT_DIRSFIRST);
2643 }
2644 break;
2645 case IDM_SORTREVERSE:
2646 if (TreesortFlags & SORT_REVERSE)
2647 TreesortFlags &= (~SORT_REVERSE);
2648 else
2649 TreesortFlags |= SORT_REVERSE;
2650 break;
2651 }
2652 PrfWriteProfileData(fmprof, appname, "TreeSort", &TreesortFlags,
2653 sizeof(INT));
2654 WinSendMsg(hwnd, CM_SORTRECORD, MPFROMP(SortTreeCnr), MPVOID);
2655 break;
[2]2656
[551]2657 case IDM_COLLECT:
2658 if (!Collector) {
[2]2659
[551]2660 HWND hwndC;
2661 SWP swp;
[2]2662
[551]2663 if (!ParentIsDesktop(hwnd, dcd->hwndParent) &&
2664 !fAutoTile &&
2665 (!fExternalCollector && *(ULONG *) realappname == FM3UL))
2666 GetNextWindowPos(dcd->hwndParent, &swp, NULL, NULL);
2667 hwndC = StartCollector((fExternalCollector ||
2668 *(ULONG *) realappname != FM3UL) ?
2669 HWND_DESKTOP : dcd->hwndParent, 4);
2670 if (hwndC) {
2671 if (!ParentIsDesktop(hwnd,
2672 dcd->hwndParent) &&
2673 !fAutoTile &&
2674 (!fExternalCollector && *(ULONG *) realappname == FM3UL))
[176]2675 WinSetWindowPos(hwndC,
2676 HWND_TOP,
[551]2677 swp.x,
2678 swp.y,
2679 swp.cx,
2680 swp.cy,
2681 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER);
2682 else if (!ParentIsDesktop(hwnd,
2683 dcd->hwndParent) &&
2684 fAutoTile && *(ULONG *) realappname == FM3UL)
2685 TileChildren(dcd->hwndParent, TRUE);
2686 }
2687 WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE);
[771]2688 DosSleep(100);//05 Aug 07 GKY 250
[551]2689 }
2690 else
2691 StartCollector(dcd->hwndParent, 4);
2692 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_COLLECTOR, 0), MPVOID);
2693 break;
[2]2694
[551]2695 case IDM_COLLECTOR:
[771]2696 DosSleep(32);//05 Aug 07 GKY 64
[551]2697 {
2698 CHAR **list;
[2]2699
[551]2700 list = BuildList(hwnd);
2701 if (list) {
2702 if (Collector) {
2703 if (!PostMsg(Collector, WM_COMMAND,
2704 MPFROM2SHORT(IDM_COLLECTOR, 0), MPFROMP(list)))
2705 FreeList(list);
[176]2706 }
[551]2707 else
2708 FreeList(list);
2709 }
2710 }
2711 break;
[2]2712
[551]2713 case IDM_COLLAPSEALL:
2714 WinSendMsg(hwnd, CM_COLLAPSETREE, MPVOID, MPVOID);
2715 break;
[2]2716
[551]2717 case IDM_COLLAPSE:
2718 case IDM_EXPAND:
2719 {
2720 PCNRITEM pci = NULL;
[2]2721
[551]2722 pci = (PCNRITEM) CurrentRecord(hwnd);
2723 if (pci && (INT) pci != -1) {
2724 if (pci->flags & RECFLAGS_UNDERENV)
2725 break;
2726 PostMsg(dcd->hwndObject, UM_EXPAND, mp1, MPFROMP(pci));
2727 }
2728 }
2729 break;
[2]2730
[551]2731 case IDM_UPDATE:
2732 {
[557]2733 PCNRITEM pci = (PCNRITEM)CurrentRecord(hwnd);
2734 if (pci && (INT)pci != -1) {
[730]2735 UINT driveflag = driveflags[toupper(*pci->pszFileName) - 'A'];
[551]2736 if (pci->attrFile & FILE_DIRECTORY) {
2737 if (pci->flags & RECFLAGS_UNDERENV)
2738 break;
2739 UnFlesh(hwnd, pci);
[557]2740 // Check if drive type might need update
2741 if ((driveflag & (DRIVE_INVALID | DRIVE_NOPRESCAN)) ||
[618]2742 (~driveflag & DRIVE_NOPRESCAN && pci->rc.hptrIcon == hptrDunno))
[557]2743 {
[730]2744 driveflags[toupper(*pci->pszFileName) - 'A'] &=
[551]2745 (DRIVE_IGNORE | DRIVE_NOPRESCAN | DRIVE_NOLOADICONS |
[552]2746 DRIVE_NOLOADSUBJS | DRIVE_NOLOADLONGS | DRIVE_NOSTATS);
[730]2747 DriveFlagsOne(toupper(*pci->pszFileName) - 'A');
2748 driveflag = driveflags[toupper(*pci->pszFileName) - 'A'];
[557]2749 if (driveflag & DRIVE_INVALID)
[551]2750 pci->rc.hptrIcon = hptrDunno;
[176]2751 else {
[618]2752 SelectDriveIcon(pci);
[176]2753 }
[551]2754 WinSendMsg(hwnd,
2755 CM_INVALIDATERECORD,
2756 MPFROMP(&pci),
2757 MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION));
2758 if (hwndMain)
2759 PostMsg(hwndMain, UM_BUILDDRIVEBAR, MPVOID, MPVOID);
[176]2760 }
[557]2761 if (~driveflag & DRIVE_INVALID)
[551]2762 Flesh(hwnd, pci);
[176]2763 }
[551]2764 }
2765 }
2766 break;
[2]2767
[551]2768 case IDM_RESCAN:
2769 PostMsg(dcd->hwndObject, UM_RESCAN, MPVOID, MPVOID);
2770 break;
[2]2771
[551]2772 case IDM_RESORT:
2773 WinSendMsg(hwnd, CM_SORTRECORD, MPFROMP(SortTreeCnr), MPVOID);
2774 break;
[2]2775
[551]2776 case IDM_TEXT:
2777 case IDM_MINIICONS:
2778 {
2779 CNRINFO cnri;
2780
2781 memset(&cnri, 0, sizeof(CNRINFO));
2782 cnri.cb = sizeof(CNRINFO);
2783 WinSendMsg(hwnd,
2784 CM_QUERYCNRINFO,
2785 MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
2786 if (SHORT1FROMMP(mp1) == IDM_MINIICONS) {
2787 if (cnri.flWindowAttr & CV_MINI)
2788 cnri.flWindowAttr &= (~CV_MINI);
2789 else
2790 cnri.flWindowAttr |= CV_MINI;
2791 }
2792 else {
2793 if (cnri.flWindowAttr & CV_TEXT) {
2794 cnri.flWindowAttr &= (~CV_TEXT);
2795 cnri.flWindowAttr |= CV_ICON;
[176]2796 }
[551]2797 else {
2798 cnri.flWindowAttr &= (~CV_ICON);
2799 cnri.flWindowAttr |= CV_TEXT;
2800 }
2801 }
2802 dcd->flWindowAttr = cnri.flWindowAttr;
2803 PrfWriteProfileData(fmprof,
2804 appname,
2805 "TreeflWindowAttr",
2806 &cnri.flWindowAttr, sizeof(ULONG));
2807 WinSendMsg(hwnd,
2808 CM_SETCNRINFO,
2809 MPFROMP(&cnri),
2810 MPFROMLONG(CMA_FLWINDOWATTR | CMA_TREEICON |
2811 CMA_SLTREEBITMAPORICON));
2812 }
2813 break;
[2]2814
[551]2815 case IDM_SIZES:
2816 case IDM_DRVFLAGS:
2817 case IDM_SHOWALLFILES:
2818 case IDM_UNDELETE:
2819 case IDM_OPTIMIZE:
2820 case IDM_CHKDSK:
2821 case IDM_FORMAT:
2822 case IDM_MKDIR:
2823 case IDM_LOCK:
2824 case IDM_UNLOCK:
2825 case IDM_EJECT:
2826 case IDM_CLOSETRAY:
2827 {
2828 PCNRITEM pci;
[2]2829
[551]2830 pci = (PCNRITEM) CurrentRecord(hwnd);
2831 if (pci && (INT) pci != -1)
[730]2832 CommonDriveCmd(hwnd, pci->pszFileName, SHORT1FROMMP(mp1));
[551]2833 }
2834 break;
[2]2835
[551]2836 case IDM_SAVETOLIST:
2837 WinDlgBox(HWND_DESKTOP,
2838 hwnd,
2839 SaveListDlgProc, FM3ModHandle, SAV_FRAME, MPFROMP(&hwnd));
2840 break;
[2]2841
[551]2842 case IDM_DELETE:
2843 case IDM_PERMDELETE:
2844 case IDM_MOVE:
2845 case IDM_WPSMOVE:
2846 case IDM_WILDMOVE:
2847 case IDM_RENAME:
2848 {
2849 PCNRITEM pci;
[2]2850
[551]2851 pci = (PCNRITEM) CurrentRecord(hwnd);
2852 if (pci && (INT) pci != -1) {
2853 if (pci->flags & RECFLAGS_UNDERENV)
2854 break;
2855 }
2856 }
2857 /* else intentional fallthru */
2858 case IDM_ATTRS:
2859 case IDM_INFO:
2860 case IDM_COPY:
2861 case IDM_WPSCOPY:
2862 case IDM_WILDCOPY:
2863 case IDM_DOITYOURSELF:
2864 case IDM_OPENWINDOW:
2865 case IDM_OPENSETTINGS:
2866 case IDM_OPENDEFAULT:
2867 case IDM_OPENICON:
2868 case IDM_OPENDETAILS:
2869 case IDM_OPENTREE:
2870 case IDM_SHADOW:
2871 case IDM_SHADOW2:
2872 case IDM_COMPARE:
2873 case IDM_VIEW:
2874 case IDM_VIEWTEXT:
2875 case IDM_VIEWBINARY:
2876 case IDM_EDIT:
2877 case IDM_EDITTEXT:
2878 case IDM_EDITBINARY:
2879 case IDM_EAS:
2880 case IDM_SUBJECT:
2881 case IDM_APPENDTOCLIP:
2882 case IDM_SAVETOCLIP:
2883 case IDM_ARCHIVE:
2884 case IDM_MCIPLAY:
2885 case IDM_UUDECODE:
2886 {
2887 LISTINFO *li;
2888 ULONG action = UM_ACTION;
[1077]2889# ifdef FORTIFY
2890 Fortify_EnterScope();
2891# endif
[551]2892 li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__);
2893 if (li) {
2894 li->type = SHORT1FROMMP(mp1);
2895 li->hwnd = hwnd;
2896 li->list = BuildList(hwnd);
2897 if (!li->list || !li->list[0]) {
[1039]2898 free(li);
[551]2899 break;
[176]2900 }
[551]2901 if (IsRoot(li->list[0])) {
2902 switch (SHORT1FROMMP(mp1)) {
2903 case IDM_MOVE:
2904 case IDM_COPY:
2905 case IDM_WILDCOPY:
2906 case IDM_WILDMOVE:
2907 case IDM_WPSMOVE:
2908 case IDM_WPSCOPY:
2909 case IDM_RENAME:
2910 case IDM_DELETE:
2911 case IDM_PERMDELETE:
2912 mp1 = MPFROM2SHORT(IDM_INFO, SHORT2FROMMP(mp1));
2913 li->type = IDM_INFO;
[176]2914 }
2915 }
[551]2916 switch (SHORT1FROMMP(mp1)) {
2917 case IDM_APPENDTOCLIP:
2918 case IDM_SAVETOCLIP:
2919 case IDM_ARCHIVE:
2920 case IDM_DELETE:
2921 case IDM_PERMDELETE:
2922 case IDM_ATTRS:
2923 case IDM_SHADOW:
2924 case IDM_SHADOW2:
2925 case IDM_DOITYOURSELF:
2926 case IDM_EAS:
2927 case IDM_VIEW:
2928 case IDM_VIEWTEXT:
2929 case IDM_VIEWBINARY:
2930 case IDM_EDIT:
2931 case IDM_EDITTEXT:
2932 case IDM_EDITBINARY:
2933 case IDM_MCIPLAY:
2934 action = UM_MASSACTION;
2935 }
2936 if (SHORT1FROMMP(mp1) == IDM_SHADOW ||
2937 SHORT1FROMMP(mp1) == IDM_SHADOW2)
2938 *li->targetpath = 0;
2939 if (!PostMsg(dcd->hwndObject, action, MPFROMP(li), MPVOID)) {
2940 Runtime_Error(pszSrcFile, __LINE__, "PostMsg");
2941 FreeListInfo(li);
2942 }
2943 }
[1077]2944# ifdef FORTIFY
2945 Fortify_LeaveScope();
2946# endif
[551]2947 }
2948 break;
[2]2949
[551]2950 default:
2951 if (SHORT1FROMMP(mp1) >= IDM_COMMANDSTART &&
2952 SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) {
[2]2953
[551]2954 INT x;
[2]2955
[551]2956 if (!cmdloaded)
2957 load_commands();
2958 x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART;
2959 if (x >= 0) {
2960 x++;
2961 RunCommand(hwnd, x);
2962 if (fUnHilite)
[672]2963 UnHilite(hwnd, TRUE, &dcd->lastselection, 0);
[551]2964 }
[176]2965 }
[551]2966 break;
[2]2967 }
[551]2968 }
2969 return 0;
[2]2970
[551]2971 case WM_SAVEAPPLICATION:
2972 if (dcd && !ParentIsDesktop(hwnd, dcd->hwndParent)) {
[2]2973
[551]2974 SWP swp, swpP;
2975 INT ratio;
[2]2976
[551]2977 WinQueryWindowPos(dcd->hwndFrame, &swp);
2978 if (!(swp.fl & (SWP_MINIMIZE | SWP_MAXIMIZE | SWP_HIDE))) {
2979 WinQueryWindowPos(dcd->hwndParent, &swpP);
[954]2980 if (swp.cx) {
2981 ratio = (swpP.cx * 100) / swp.cx;
2982 if (ratio > 0)
2983 PrfWriteProfileData(fmprof, appname, "TreeWindowRatio",
2984 &ratio, sizeof(INT));
2985 }
[2]2986 }
[551]2987 }
2988 else if (dcd && ParentIsDesktop(hwnd, dcd->hwndParent)) {
[2]2989
[551]2990 SWP swp;
[2]2991
[551]2992 WinQueryWindowPos(dcd->hwndFrame, &swp);
2993 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE | SWP_MAXIMIZE)))
2994 WinStoreWindowPos(FM2Str, "VTreeWindowPos", dcd->hwndFrame);
2995 }
2996 break;
[2]2997
[551]2998 case UM_MINIMIZE:
2999 if (dcd && hwndMain) {
3000 fOkayMinimize = TRUE;
3001 if (dcd->hwndObject && !fDummy) {
[771]3002 DosSleep(50);//05 Aug 07 GKY 100
[551]3003 if (!fDummy) {
3004 fOkayMinimize = FALSE;
3005 WinSetWindowPos(((hwndMain) ? WinQueryWindow(hwndMain, QW_PARENT) :
3006 dcd->hwndFrame), HWND_TOP, 0, 0, 0, 0,
3007 SWP_MINIMIZE | SWP_DEACTIVATE);
[176]3008 }
[2]3009 }
[551]3010 }
3011 return 0;
[2]3012
[551]3013 case UM_MAXIMIZE:
3014 if (dcd || hwndMain)
3015 WinSetWindowPos(((hwndMain) ? WinQueryWindow(hwndMain, QW_PARENT) :
3016 dcd->hwndFrame), HWND_TOP, 0, 0, 0, 0, SWP_MAXIMIZE |
3017 SWP_SHOW);
3018 return 0;
[2]3019
[551]3020 case UM_CLOSE:
3021 {
3022 HWND hwndParent = WinQueryWindow(WinQueryWindow(WinQueryWindow(hwnd,
3023 QW_PARENT),
3024 QW_PARENT), QW_PARENT);
[2]3025
[551]3026 if (!mp1) {
3027 if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
3028 WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
3029 if (hwndParent && !ParentIsDesktop(hwnd, hwndParent))
3030 WinDestroyWindow(hwndParent);
[2]3031 }
3032 else
[551]3033 WinDestroyWindow(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
3034 QW_PARENT));
3035 }
3036 return 0;
[2]3037
[551]3038 case WM_CLOSE:
3039 WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
3040 if (dcd)
3041 dcd->stopflag++;
3042 if (dcd && dcd->hwndObject) {
3043 /* kill object window */
[1340]3044 if (WinIsWindow((HAB) 0, dcd->hwndObject)) {
3045 if (!PostMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID))
3046 WinSendMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID);
3047 }
[551]3048 }
3049 else
[766]3050 WinSendMsg(hwnd, UM_CLOSE, MPFROMLONG(1), MPVOID);
[551]3051 return 0;
[2]3052
[551]3053 case WM_DESTROY:
[1335]3054# ifdef FORTIFY
3055 DbgMsg(pszSrcFile, __LINE__, "WM_DESTROY hwnd %p TID %u", hwnd, GetTidForThread()); // 18 Jul 08 SHL fixme
3056# endif
[551]3057 if (TreeCnrMenu)
3058 WinDestroyWindow(TreeCnrMenu);
3059 if (DirMenu)
3060 WinDestroyWindow(DirMenu);
3061 if (FileMenu)
3062 WinDestroyWindow(FileMenu);
3063 TreeCnrMenu = FileMenu = DirMenu = (HWND) 0;
3064 EmptyCnr(hwnd);
3065 if (apphead) {
3066 APPNOTIFY *info, *next;
3067 info = apphead;
3068 while (info) {
3069 next = info->next;
[1039]3070 free(info);
[551]3071 info = next;
[2]3072 }
[551]3073 apphead = apptail = NULL;
3074 }
[1077]3075# ifdef FORTIFY
3076 Fortify_LeaveScope();
3077# endif
3078 break; // WM_DESTROY
3079 } // switch
[705]3080 if (dcd && dcd->oldproc){
3081 return dcd->oldproc(hwnd, msg, mp1, mp2);
3082 }
3083 else
3084 return PFNWPCnr(hwnd, msg, mp1, mp2);
[2]3085}
3086
[551]3087HWND StartTreeCnr(HWND hwndParent, ULONG flags)
[352]3088{
[2]3089 /* bitmapped flags:
3090 * 0x00000001 = don't close app when window closes
3091 * 0x00000002 = no frame controls
[947]3092 * 0x00000004 = no close or move button
[2]3093 */
3094
[947]3095 HWND hwndFrame = NULLHANDLE;
3096 HWND hwndSysMenu = NULLHANDLE;
3097 HWND hwndClient;
[551]3098 ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
3099 FCF_SIZEBORDER | FCF_MINMAX | FCF_ICON | FCF_NOBYTEALIGN | FCF_ACCELTABLE;
3100 DIRCNRDATA *dcd;
[2]3101
[551]3102 if (!hwndParent)
[2]3103 hwndParent = HWND_DESKTOP;
[551]3104 if (ParentIsDesktop(hwndParent, hwndParent))
[2]3105 FrameFlags |= (FCF_TASKLIST | FCF_MENU);
[551]3106 if (flags & 2)
[2]3107 FrameFlags &= (~(FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER |
[551]3108 FCF_MINMAX | FCF_ICON));
[2]3109 hwndFrame = WinCreateStdWindow(hwndParent,
[176]3110 WS_VISIBLE,
3111 &FrameFlags,
[593]3112 WC_TREECONTAINER,
[176]3113 NULL,
3114 WS_VISIBLE | fwsAnimate,
[953]3115 FM3ModHandle, TREE_FRAME, &hwndClient);
[950]3116 if (hwndParent != HWND_DESKTOP) {
[947]3117 hwndSysMenu = WinWindowFromID(hwndFrame, FID_SYSMENU);
3118 if (hwndSysMenu != NULLHANDLE)
3119 WinSendMsg(hwndSysMenu, MM_SETITEMATTR,
[953]3120 MPFROM2SHORT(SC_CLOSE, TRUE),
3121 MPFROM2SHORT(MIA_DISABLED, MIA_DISABLED));
[947]3122 if (!fFreeTree)
3123 WinSendMsg(hwndSysMenu, MM_SETITEMATTR,
[953]3124 MPFROM2SHORT(SC_MOVE, TRUE),
3125 MPFROM2SHORT(MIA_DISABLED, MIA_DISABLED));
[947]3126 }
[551]3127 if (hwndFrame && hwndClient) {
[1063]3128# ifdef FORTIFY
3129 Fortify_EnterScope();
[1077]3130# endif
[1017]3131 dcd = xmallocz(sizeof(DIRCNRDATA), pszSrcFile, __LINE__);
[352]3132 if (!dcd) {
[551]3133 Runtime_Error(pszSrcFile, __LINE__, GetPString(IDS_OUTOFMEMORY));
3134 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
3135 hwndFrame = (HWND) 0;
[352]3136 }
3137 else {
[2]3138 SWP swp;
[551]3139 WinQueryWindowPos(hwndFrame, &swp);
3140 if (*(ULONG *) realappname == FM3UL) {
[377]3141 if (!WinCreateWindow(hwndFrame,
[593]3142 WC_TREEOPENBUTTON,
[1335]3143 "#303",
[1277]3144 WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS | BS_BITMAP,
[551]3145 ((swp.cx -
3146 WinQuerySysValue(HWND_DESKTOP,
3147 SV_CXMINMAXBUTTON)) -
3148 WinQuerySysValue(HWND_DESKTOP,
3149 SV_CXMINMAXBUTTON) / 2) -
[739]3150 WinQuerySysValue(HWND_DESKTOP, SV_CXSIZEBORDER),
[551]3151 (swp.cy -
3152 WinQuerySysValue(HWND_DESKTOP,
3153 SV_CYMINMAXBUTTON)) -
[739]3154 WinQuerySysValue(HWND_DESKTOP, SV_CYSIZEBORDER),
[551]3155 WinQuerySysValue(HWND_DESKTOP,
3156 SV_CXMINMAXBUTTON) / 2,
3157 WinQuerySysValue(HWND_DESKTOP,
3158 SV_CYMINMAXBUTTON), hwndFrame,
[739]3159 HWND_TOP, IDM_OPENWINDOW, NULL, NULL)) {
[551]3160 Win_Error2(hwndFrame, hwndParent, pszSrcFile, __LINE__,
3161 IDS_WINCREATEWINDOW);
[377]3162 }
3163 }
3164 else {
3165 if (!WinCreateWindow(hwndFrame,
[593]3166 WC_TREESTATUS,
[551]3167 GetPString(IDS_YOUAREHERETEXT),
3168 WS_VISIBLE | SS_TEXT | DT_LEFT | DT_VCENTER,
3169 swp.x + 4 + WinQuerySysValue(HWND_DESKTOP,
3170 SV_CXSIZEBORDER),
3171 swp.cy - (22 + WinQuerySysValue(HWND_DESKTOP,
3172 SV_CYSIZEBORDER)),
3173 (swp.cx - 8) - (WinQuerySysValue(HWND_DESKTOP,
3174 SV_CXSIZEBORDER)
3175 * 2), 22, hwndFrame, HWND_TOP,
3176 MAIN_STATUS, NULL, NULL)) {
3177 Win_Error2(hwndFrame, hwndParent, pszSrcFile, __LINE__,
3178 IDS_WINCREATEWINDOW);
[377]3179 }
3180 }
[551]3181 memset(dcd, 0, sizeof(DIRCNRDATA));
[2]3182 dcd->size = sizeof(DIRCNRDATA);
3183 dcd->type = TREE_FRAME;
3184 dcd->dontclose = ((flags & 1) != 0);
3185 dcd->hwndParent = (hwndParent) ? hwndParent : HWND_DESKTOP;
3186 dcd->hwndClient = hwndClient;
[551]3187 dcd->hwndFrame = hwndFrame;
[2]3188 {
[176]3189 PFNWP oldproc;
[2]3190
[551]3191 oldproc = WinSubclassWindow(hwndFrame, TreeFrameWndProc);
3192 WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID) oldproc);
3193 oldproc = WinSubclassWindow(WinWindowFromID(hwndFrame, FID_TITLEBAR),
3194 (PFNWP) TreeTitleWndProc);
3195 WinSetWindowPtr(WinWindowFromID(hwndFrame, FID_TITLEBAR),
3196 QWL_USER, (PVOID) oldproc);
[2]3197 }
3198 dcd->hwndCnr = WinCreateWindow(hwndClient,
[176]3199 WC_CONTAINER,
3200 NULL,
3201 CCS_AUTOPOSITION | CCS_MINIICONS |
3202 CCS_MINIRECORDCORE | WS_VISIBLE,
3203 0,
3204 0,
3205 0,
3206 0,
3207 hwndClient,
[551]3208 HWND_TOP, (ULONG) TREE_CNR, NULL, NULL);
[377]3209 if (!dcd->hwndCnr) {
[551]3210 Win_Error2(hwndClient, hwndClient, pszSrcFile, __LINE__,
3211 IDS_WINCREATEWINDOW);
3212 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
[1077]3213 free(dcd);
3214 dcd = 0;
[551]3215 hwndFrame = (HWND) 0;
[377]3216 }
3217 else {
[551]3218 WinSetWindowPtr(dcd->hwndCnr, QWL_USER, (PVOID) dcd);
3219 if (ParentIsDesktop(hwndFrame, hwndParent)) {
3220 WinSetWindowText(WinWindowFromID(hwndFrame, FID_TITLEBAR), "VTree");
3221 FixSwitchList(hwndFrame, "VTree");
[176]3222 }
3223 else {
[551]3224 WinSetWindowText(hwndFrame, GetPString(IDS_TREETEXT));
3225 WinSetWindowText(WinWindowFromID(hwndFrame, FID_TITLEBAR),
[176]3226 GetPString(IDS_TREETEXT));
3227 }
[726]3228 dcd->oldproc = WinSubclassWindow(dcd->hwndCnr, TreeCnrWndProc);
3229 // DbgMsg(pszSrcFile, __LINE__, "oldproc subclass %X", dcd->oldproc); // 05 Jul 07 SHL
3230 // fixme to document 01 test?
[766]3231 if (dcd->oldproc == 0)
[947]3232 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
[953]3233 "WinSubclassWindow");
[551]3234 if (!PostMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID))
3235 WinSendMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID);
[2]3236 }
3237 }
[1077]3238# ifdef FORTIFY
3239 if (dcd)
3240 Fortify_ChangeScope(dcd, -1);
3241 Fortify_LeaveScope();
3242 if (dcd)
3243 Fortify_ChangeScope(dcd, +1);
3244# endif
[2]3245 }
3246 return hwndFrame;
3247}
[793]3248
3249#pragma alloc_text(TREECNR,TreeCnrWndProc,TreeObjWndProc,TreeClientWndProc)
3250#pragma alloc_text(TREECNR,TreeFrameWndProc,TreeTitleWndProc,ShowTreeRec)
3251#pragma alloc_text(TREECNR,TreeStatProc,OpenButtonProc)
3252#pragma alloc_text(STARTUP,StartTreeCnr)
Note: See TracBrowser for help on using the repository browser.