| [1335] | 1 | 
 | 
|---|
| [96] | 2 | /***********************************************************************
 | 
|---|
 | 3 | 
 | 
|---|
 | 4 |   $Id: collect.c 1741 2014-02-22 23:32:04Z gyoung $
 | 
|---|
 | 5 | 
 | 
|---|
 | 6 |   Collector
 | 
|---|
 | 7 | 
 | 
|---|
 | 8 |   Copyright (c) 1993-98 M. Kimes
 | 
|---|
| [1671] | 9 |   Copyright (c) 2003, 2012 Steven H. Levine
 | 
|---|
| [96] | 10 | 
 | 
|---|
| [130] | 11 |   15 Oct 02 MK Baseline
 | 
|---|
 | 12 |   10 Jan 04 SHL Avoid -1L byte counts
 | 
|---|
 | 13 |   01 Aug 04 SHL Rework lstrip/rstrip usage
 | 
|---|
 | 14 |   23 May 05 SHL Use QWL_USER
 | 
|---|
| [145] | 15 |   24 May 05 SHL Rework Win_Error usage
 | 
|---|
| [155] | 16 |   25 May 05 SHL Use ULONGLONG and CommaFmtULL
 | 
|---|
 | 17 |   25 May 05 SHL Rework for FillInRecordFromFFB
 | 
|---|
| [186] | 18 |   05 Jun 05 SHL Use QWL_USER
 | 
|---|
| [194] | 19 |   06 Jun 05 SHL Indent -i2
 | 
|---|
| [197] | 20 |   06 Jun 05 SHL Make savedSortFlags static to avoid referencing garbage
 | 
|---|
| [280] | 21 |   24 Oct 05 SHL Sanitize handle references
 | 
|---|
 | 22 |   24 Oct 05 SHL CollectorCnrWndProc: avoid excess writes to Status2 window
 | 
|---|
 | 23 |   10 Nov 05 SHL CollectorCnrWndProc: correct missing button window updates
 | 
|---|
| [352] | 24 |   14 Jul 06 SHL Use Runtime_Error
 | 
|---|
| [403] | 25 |   27 Jul 06 SHL Avoid shutdown hang - pre3 typo
 | 
|---|
 | 26 |   29 Jul 06 SHL Use xfgets_bstripcr
 | 
|---|
| [444] | 27 |   15 Aug 06 SHL Don't write garbage to CollectorFilter INI entry
 | 
|---|
 | 28 |   15 Aug 06 SHL Rework SetMask args
 | 
|---|
 | 29 |   18 Aug 06 SHL CollectorCnrWndProc: avoid freeing NULL pointer
 | 
|---|
| [471] | 30 |   31 Aug 06 SHL Disable Utilities->Seek and scan menu while busy
 | 
|---|
 | 31 |   31 Aug 06 SHL Correct stop scan context menu enable/disable
 | 
|---|
| [593] | 32 |   30 Mar 07 GKY Remove GetPString for window class names
 | 
|---|
| [603] | 33 |   06 Apr 07 GKY Work around PM DragInfo and DrgFreeDISH limits
 | 
|---|
 | 34 |   06 Apr 07 GKY Add some error checking in drag/drop
 | 
|---|
| [618] | 35 |   19 Apr 07 SHL Use FreeDragInfoData.  Add more drag/drop error checks.
 | 
|---|
| [672] | 36 |   12 May 07 SHL Use dcd->ulItemsToUnHilite
 | 
|---|
| [688] | 37 |   10 Jun 07 GKY Add CheckPmDrgLimit including IsFm2Window as part of work around PM drag limit
 | 
|---|
| [724] | 38 |   05 Jul 07 SHL CollectorCnrWndProc: just warn if busy
 | 
|---|
| [751] | 39 |   02 Aug 07 SHL Sync with CNRITEM mods
 | 
|---|
| [775] | 40 |   06 Aug 07 GKY Reduce DosSleep times (ticket 148)
 | 
|---|
| [793] | 41 |   20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
 | 
|---|
| [814] | 42 |   26 Aug 07 GKY DosSleep(1) in loops changed to (0)
 | 
|---|
| [872] | 43 |   22 Nov 07 GKY Use CopyPresParams to fix presparam inconsistencies in menus
 | 
|---|
| [917] | 44 |   10 Jan 08 SHL Sync with CfgDlgProc mods
 | 
|---|
| [946] | 45 |   10 Feb 08 GKY Implement bubble help for bitmap menu items
 | 
|---|
| [953] | 46 |   15 Feb 08 SHL Sync with settings menu rework
 | 
|---|
| [956] | 47 |   15 Feb 08 GKY Fix attempt to free container items that were never inserted
 | 
|---|
 | 48 |   15 Feb 08 GKY Fix "collect" so it updates recollected files and unhides them if needed
 | 
|---|
| [985] | 49 |   29 Feb 08 GKY Use xfree where appropriate
 | 
|---|
| [1041] | 50 |   06 Jul 08 GKY Update delete/undelete to include move to and open XWP trashcan
 | 
|---|
| [1065] | 51 |   11 Jul 08 JBS Ticket 230: Simplified code and eliminated some local variables by incorporating
 | 
|---|
| [1077] | 52 |                 all the details view settings (both the global variables and those in the
 | 
|---|
 | 53 |                 DIRCNRDATA struct) into a new struct: DETAILS_SETTINGS.
 | 
|---|
| [1084] | 54 |   20 Jul 08 GKY Add save/append filename to clipboard.
 | 
|---|
| [1335] | 55 |                 Change menu wording to make these easier to find
 | 
|---|
| [1120] | 56 |   25 Aug 08 GKY Check TMP directory space warn if lee than 5 MiB prevent archiver from opening if
 | 
|---|
| [1335] | 57 |                 less than 10 KiB (It hangs and can't be closed)
 | 
|---|
 | 58 |   10 Dec 08 SHL Integrate exception handler support
 | 
|---|
| [1357] | 59 |   26 Dec 08 GKY Fixed DROPHELP to check for copy as default is action is DO_DEFAULT
 | 
|---|
| [1375] | 60 |   01 Jan 09 GKY Add Seek and Scan to drives & directory context menus pass drive/dir as search root
 | 
|---|
| [1395] | 61 |   07 Feb 09 GKY Eliminate Win_Error2 by moving function names to PCSZs used in Win_Error
 | 
|---|
 | 62 |   07 Feb 09 GKY Allow user to turn off alert and/or error beeps in settings notebook.
 | 
|---|
 | 63 |   07 Feb 09 GKY Add *DateFormat functions to format dates based on locale
 | 
|---|
 | 64 |   07 Feb 09 GKY Move repeated strings to PCSZs.
 | 
|---|
| [1400] | 65 |   08 Mar 09 GKY Renamed commafmt.h i18nutil.h
 | 
|---|
 | 66 |   08 Mar 09 GKY Additional strings move to PCSZs in init.c
 | 
|---|
| [1430] | 67 |   06 Jun 09 GKY Add option to show file system type or drive label in tree
 | 
|---|
| [1439] | 68 |   12 Jul 09 GKY Add szFSType to FillInRecordFromFSA use to bypass EA scan and size formatting
 | 
|---|
| [1456] | 69 |                 for tree container
 | 
|---|
| [1442] | 70 |   13 Jul 09 GKY Fixed double free of memory buffer in UM_COLLECTFROMFILE
 | 
|---|
| [1456] | 71 |   15 Sep 09 SHL Use UM_GREP when passing pathname
 | 
|---|
| [1498] | 72 |   17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
 | 
|---|
| [1546] | 73 |   23 Oct 10 GKY Add menu items for opening directory cnrs based on path of selected item
 | 
|---|
| [1563] | 74 |                 including the option to use walk directories to select path
 | 
|---|
| [1561] | 75 |   28 May 11 GKY Fixed trap caused by passing a nonexistant pci to FillInRecordFromFFB in
 | 
|---|
| [1611] | 76 |                 UM_COLLECT because pci is limited to 65535 files. (nRecord is a USHORT)
 | 
|---|
| [1563] | 77 |   29 May 11 SHL Rework UM_COLLECT >65K records logic to not require double loop
 | 
|---|
 | 78 |   29 May 11 SHL Tweak UM_COLLECT to bypass FindCnrRecord when container initially empty
 | 
|---|
| [1611] | 79 |   08 Aug 11 SHL Rework UM_COLLECT to avoid spurious container items free
 | 
|---|
| [1615] | 80 |   13 Aug 11 GKY Have file count and KIBs update at the same time
 | 
|---|
| [1664] | 81 |   04 Aug 12 GKY Changes to use Unlock to unlock files if Unlock.exe is in path both from menu and as part of copy, move and
 | 
|---|
| [1702] | 82 |                 delete operations
 | 
|---|
| [1671] | 83 |   05 Sep 12 SHL Correct UM_COLLECTFROMFILE bad list file reporting
 | 
|---|
| [1702] | 84 |   13 Dec 13 SHL CollectorCnrWndProc IDM_FILTER: avoid exception on missing fileName
 | 
|---|
| [1741] | 85 |   22 Feb 14 GKY Fix warn readonly yes don't ask to work when recursing directories.
 | 
|---|
| [96] | 86 | 
 | 
|---|
 | 87 | ***********************************************************************/
 | 
|---|
 | 88 | 
 | 
|---|
| [2] | 89 | #include <stdlib.h>
 | 
|---|
 | 90 | #include <string.h>
 | 
|---|
 | 91 | #include <ctype.h>
 | 
|---|
 | 92 | #include <share.h>
 | 
|---|
| [1563] | 93 | #include <limits.h>                     // USHRT_MAX
 | 
|---|
| [1335] | 94 | // #include <process.h>                 // _beginthread
 | 
|---|
| [155] | 95 | 
 | 
|---|
| [907] | 96 | #define INCL_DOS                        // QSV_MS_COUNT
 | 
|---|
 | 97 | #define INCL_WIN
 | 
|---|
 | 98 | #define INCL_DOSERRORS
 | 
|---|
 | 99 | #define INCL_LONGLONG
 | 
|---|
 | 100 | 
 | 
|---|
| [1181] | 101 | #include "fm3dll.h"
 | 
|---|
| [1221] | 102 | #include "fm3dll2.h"                    // #define's for UM_*, control id's, etc.
 | 
|---|
| [1205] | 103 | #include "dircnrs.h"                    // Data declaration(s)
 | 
|---|
 | 104 | #include "info.h"                       // Data declaration(s)
 | 
|---|
 | 105 | #include "init.h"                       // Data declaration(s)
 | 
|---|
| [2] | 106 | #include "fm3dlg.h"
 | 
|---|
 | 107 | #include "fm3str.h"
 | 
|---|
 | 108 | #include "mle.h"
 | 
|---|
 | 109 | #include "grep.h"
 | 
|---|
| [907] | 110 | #include "comp.h"
 | 
|---|
 | 111 | #include "arccnrs.h"                    // StartArcCnr
 | 
|---|
 | 112 | #include "filldir.h"                    // EmptyCnr...
 | 
|---|
 | 113 | #include "strutil.h"                    // GetPString
 | 
|---|
 | 114 | #include "errutil.h"                    // Runtime_Error
 | 
|---|
| [942] | 115 | #include "tmrsvcs.h"                    // ITIMER_DESC
 | 
|---|
| [953] | 116 | #include "notebook.h"                   // CfgDlgProc
 | 
|---|
| [1077] | 117 | #include "command.h"                    // RunCommand
 | 
|---|
| [1563] | 118 | #include "worker.h"                     // Action, MassAction
 | 
|---|
 | 119 | #include "notify.h"                     // AddNote
 | 
|---|
| [1335] | 120 | #include "misc.h"               // AdjustCnrColsForPref, AdjustDetailsSwitches, CnrDirectEdit,
 | 
|---|
| [1159] | 121 |                                         // LoadDetailsSwitches, OpenEdit, QuickPopup, SayFilter
 | 
|---|
 | 122 |                                         // SaySort, SayView, SetCnrCols, SetDetailsSwitches
 | 
|---|
| [1181] | 123 |                                         // SetSortChecks, SetViewMenu, disable_menuitem, CheckMenu
 | 
|---|
 | 124 |                                         // CurrentRecord, DrawTargetEmphasis, IsFm2Window
 | 
|---|
| [1159] | 125 | #include "chklist.h"                    // CenterOverWindow, DropListProc
 | 
|---|
 | 126 | #include "collect.h"
 | 
|---|
 | 127 | #include "common.h"                     // CommonCnrProc, CommonCreateTextChildren, CommonFrameWndProc
 | 
|---|
| [1563] | 128 |                                         // CommonTextPaint
 | 
|---|
| [1159] | 129 | #include "select.h"                     // DeselectAll, HideAll, RemoveAll, SelectAll, SelectList
 | 
|---|
 | 130 | #include "dirsize.h"                    // DirSizeProc
 | 
|---|
 | 131 | #include "grep2.h"                      // GrepDlgProc
 | 
|---|
 | 132 | #include "mainwnd.h"                    // MakeBubble
 | 
|---|
 | 133 | #include "objwin.h"                     // MakeObjWin
 | 
|---|
 | 134 | #include "saveclip.h"                   // SaveListDlgProc
 | 
|---|
 | 135 | #include "findrec.h"                    // ShowCnrRecord
 | 
|---|
 | 136 | #include "sortcnr.h"                    // SortCollectorCnr
 | 
|---|
 | 137 | #include "seeall.h"                     // StartSeeAll
 | 
|---|
 | 138 | #include "update.h"                     // UpdateCnrList, UpdateCnrRecord
 | 
|---|
| [1181] | 139 | #include "droplist.h"                   // CheckPmDrgLimit
 | 
|---|
 | 140 | #include "common.h"                     // CommonTextButton, CommonTextProc
 | 
|---|
 | 141 | #include "presparm.h"                   // CopyPresParams
 | 
|---|
 | 142 | #include "defview.h"                    // DefaultViewKeys
 | 
|---|
 | 143 | #include "draglist.h"                   // DoFileDrag, FreeDragInfoData
 | 
|---|
 | 144 | #include "systemf.h"                    // ExecOnList
 | 
|---|
 | 145 | #include "filter.h"                     // Filter
 | 
|---|
 | 146 | #include "findrec.h"                    // FindCnrRecord
 | 
|---|
 | 147 | #include "shadow.h"                     // OpenObject
 | 
|---|
 | 148 | #include "mkdir.h"                      // PMMkDir
 | 
|---|
 | 149 | #include "valid.h"                      // ParentIsDesktop
 | 
|---|
 | 150 | #include "viewer.h"                     // StartMLEEditor
 | 
|---|
 | 151 | #include "newview.h"                    // StartViewer
 | 
|---|
 | 152 | #include "undel.h"                      // UndeleteDlgProc
 | 
|---|
| [1400] | 153 | #include "i18nutil.h"                   // commafmt
 | 
|---|
| [1181] | 154 | #include "getnames.h"                   // insert_filename
 | 
|---|
| [1159] | 155 | #include "select.h"                     // InvertAll
 | 
|---|
| [1181] | 156 | #include "strips.h"                     // bstrip
 | 
|---|
 | 157 | #include "wrappers.h"                   // xDosFindFirst
 | 
|---|
| [1017] | 158 | #include "fortify.h"
 | 
|---|
| [1335] | 159 | #include "excputil.h"                   // xbeginthread
 | 
|---|
| [1563] | 160 | #include "walkem.h"                     // WalkAllDlgProc
 | 
|---|
| [1741] | 161 | #include "copyf.h"                      // ignorereadonly
 | 
|---|
| [1017] | 162 | 
 | 
|---|
| [1205] | 163 | // Data definitions
 | 
|---|
 | 164 | #pragma data_seg(GLOBAL1)
 | 
|---|
 | 165 | HWND CollectorCnrMenu;
 | 
|---|
 | 166 | HWND hwndStatus2;
 | 
|---|
 | 167 | 
 | 
|---|
 | 168 | #pragma data_seg(GLOBAL2)
 | 
|---|
 | 169 | INT CollectorsortFlags;
 | 
|---|
 | 170 | 
 | 
|---|
| [2] | 171 | #pragma data_seg(DATA1)
 | 
|---|
| [352] | 172 | static PSZ pszSrcFile = __FILE__;
 | 
|---|
 | 173 | 
 | 
|---|
| [194] | 174 | MRESULT EXPENTRY CollectorFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
 | 
|---|
 | 175 |                                        MPARAM mp2)
 | 
|---|
 | 176 | {
 | 
|---|
 | 177 |   return CommonFrameWndProc(COLLECTOR_CNR, hwnd, msg, mp1, mp2);
 | 
|---|
| [2] | 178 | }
 | 
|---|
 | 179 | 
 | 
|---|
| [551] | 180 | MRESULT EXPENTRY CollectorTextProc(HWND hwnd, ULONG msg, MPARAM mp1,
 | 
|---|
 | 181 |                                    MPARAM mp2)
 | 
|---|
| [96] | 182 | {
 | 
|---|
| [197] | 183 |   DIRCNRDATA *dcd;
 | 
|---|
| [155] | 184 | 
 | 
|---|
| [194] | 185 |   static BOOL emphasized = FALSE;
 | 
|---|
| [551] | 186 |   static HWND hwndButtonPopup = (HWND) 0;
 | 
|---|
| [194] | 187 |   static ULONG timestamp = ULONG_MAX;
 | 
|---|
 | 188 |   static USHORT lastid = 0;
 | 
|---|
| [2] | 189 | 
 | 
|---|
| [444] | 190 |   switch (msg) {
 | 
|---|
| [194] | 191 |   case WM_CREATE:
 | 
|---|
 | 192 |     return CommonTextProc(hwnd, msg, mp1, mp2);
 | 
|---|
| [2] | 193 | 
 | 
|---|
| [194] | 194 |   case UM_CONTEXTMENU:
 | 
|---|
 | 195 |   case WM_CONTEXTMENU:
 | 
|---|
 | 196 |     {
 | 
|---|
 | 197 |       USHORT id;
 | 
|---|
 | 198 | 
 | 
|---|
 | 199 |       id = WinQueryWindowUShort(hwnd, QWS_ID);
 | 
|---|
| [444] | 200 |       switch (id) {
 | 
|---|
| [194] | 201 |       case DIR_SELECTED:
 | 
|---|
 | 202 |       case DIR_VIEW:
 | 
|---|
 | 203 |       case DIR_SORT:
 | 
|---|
 | 204 |         {
 | 
|---|
| [551] | 205 |           POINTL ptl = { 0, 0 };
 | 
|---|
| [194] | 206 |           SWP swp;
 | 
|---|
| [2] | 207 | 
 | 
|---|
| [194] | 208 |           if (hwndButtonPopup)
 | 
|---|
 | 209 |             WinDestroyWindow(hwndButtonPopup);
 | 
|---|
| [444] | 210 |           if (id == lastid) {
 | 
|---|
| [194] | 211 |             ULONG check;
 | 
|---|
| [2] | 212 | 
 | 
|---|
| [194] | 213 |             DosQuerySysInfo(QSV_MS_COUNT,
 | 
|---|
| [551] | 214 |                             QSV_MS_COUNT, &check, sizeof(check));
 | 
|---|
| [444] | 215 |             if (check < timestamp + 500) {
 | 
|---|
| [194] | 216 |               lastid = 0;
 | 
|---|
 | 217 |               goto MenuAbort;
 | 
|---|
 | 218 |             }
 | 
|---|
 | 219 |           }
 | 
|---|
| [551] | 220 |           hwndButtonPopup = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
 | 
|---|
| [444] | 221 |           if (hwndButtonPopup) {
 | 
|---|
| [551] | 222 |             WinSetWindowUShort(hwndButtonPopup, QWS_ID, id);
 | 
|---|
| [194] | 223 |             dcd = WinQueryWindowPtr(WinWindowFromID(WinQueryWindow(hwnd,
 | 
|---|
| [352] | 224 |                                                                    QW_PARENT),
 | 
|---|
| [551] | 225 |                                                     COLLECTOR_CNR), QWL_USER);
 | 
|---|
| [444] | 226 |             if (id == DIR_VIEW) {
 | 
|---|
 | 227 |               if (dcd) {
 | 
|---|
| [551] | 228 |                 SetViewMenu(hwndButtonPopup, dcd->flWindowAttr);
 | 
|---|
| [1065] | 229 |                 SetDetailsSwitches(hwndButtonPopup, &dcd->ds);
 | 
|---|
| [907] | 230 |                 CopyPresParams(hwndButtonPopup, hwnd);
 | 
|---|
| [194] | 231 |               }
 | 
|---|
| [2] | 232 | 
 | 
|---|
| [1673] | 233 |               // don't have tree view in collector
 | 
|---|
| [194] | 234 |               WinSendMsg(hwndButtonPopup,
 | 
|---|
 | 235 |                          MM_DELETEITEM,
 | 
|---|
| [551] | 236 |                          MPFROM2SHORT(IDM_TREEVIEW, FALSE), MPVOID);
 | 
|---|
| [2] | 237 | 
 | 
|---|
| [194] | 238 |             }
 | 
|---|
| [444] | 239 |             else if (id == DIR_SORT) {
 | 
|---|
| [194] | 240 |               if (dcd)
 | 
|---|
| [551] | 241 |                 SetSortChecks(hwndButtonPopup, dcd->sortFlags);
 | 
|---|
| [194] | 242 |             }
 | 
|---|
 | 243 |             ptl.x = 0;
 | 
|---|
 | 244 |             if (WinPopupMenu(HWND_OBJECT,
 | 
|---|
 | 245 |                              HWND_OBJECT,
 | 
|---|
| [551] | 246 |                              hwndButtonPopup, -32767, -32767, 0, 0)) {
 | 
|---|
 | 247 |               WinQueryWindowPos(hwndButtonPopup, &swp);
 | 
|---|
| [194] | 248 |               ptl.y = -(swp.cy + 2);
 | 
|---|
 | 249 |             }
 | 
|---|
| [444] | 250 |             else {
 | 
|---|
| [551] | 251 |               WinQueryWindowPos(hwnd, &swp);
 | 
|---|
| [194] | 252 |               ptl.y = swp.cy + 2;
 | 
|---|
 | 253 |             }
 | 
|---|
 | 254 |             if (WinPopupMenu(hwnd,
 | 
|---|
 | 255 |                              hwnd,
 | 
|---|
 | 256 |                              hwndButtonPopup,
 | 
|---|
 | 257 |                              ptl.x,
 | 
|---|
 | 258 |                              ptl.y,
 | 
|---|
 | 259 |                              0,
 | 
|---|
 | 260 |                              PU_HCONSTRAIN | PU_VCONSTRAIN |
 | 
|---|
| [551] | 261 |                              PU_KEYBOARD | PU_MOUSEBUTTON1)) {
 | 
|---|
| [194] | 262 |               CenterOverWindow(hwndButtonPopup);
 | 
|---|
| [551] | 263 |               PaintRecessedWindow(hwnd, NULLHANDLE, FALSE, FALSE);
 | 
|---|
| [194] | 264 |             }
 | 
|---|
 | 265 |           }
 | 
|---|
 | 266 |         }
 | 
|---|
 | 267 |         break;
 | 
|---|
 | 268 |       default:
 | 
|---|
 | 269 |         PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
 | 
|---|
 | 270 |                                 COLLECTOR_CNR),
 | 
|---|
 | 271 |                 WM_CONTROL,
 | 
|---|
| [551] | 272 |                 MPFROM2SHORT(COLLECTOR_CNR, CN_CONTEXTMENU), MPVOID);
 | 
|---|
| [194] | 273 |         break;
 | 
|---|
| [2] | 274 |       }
 | 
|---|
| [194] | 275 |     }
 | 
|---|
 | 276 |   MenuAbort:
 | 
|---|
 | 277 |     if (msg == UM_CONTEXTMENU)
 | 
|---|
 | 278 |       return 0;
 | 
|---|
 | 279 |     break;
 | 
|---|
| [2] | 280 | 
 | 
|---|
| [194] | 281 |   case WM_MENUEND:
 | 
|---|
| [551] | 282 |     if (hwndButtonPopup == (HWND) mp2) {
 | 
|---|
 | 283 |       lastid = WinQueryWindowUShort((HWND) mp2, QWS_ID);
 | 
|---|
| [194] | 284 |       WinDestroyWindow(hwndButtonPopup);
 | 
|---|
| [551] | 285 |       hwndButtonPopup = (HWND) 0;
 | 
|---|
 | 286 |       DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, ×tamp,
 | 
|---|
 | 287 |                       sizeof(timestamp));
 | 
|---|
| [444] | 288 |       switch (lastid) {
 | 
|---|
| [194] | 289 |       case DIR_SELECTED:
 | 
|---|
 | 290 |       case DIR_VIEW:
 | 
|---|
 | 291 |       case DIR_SORT:
 | 
|---|
| [551] | 292 |         PaintRecessedWindow(hwnd, NULLHANDLE, TRUE, FALSE);
 | 
|---|
| [194] | 293 |         break;
 | 
|---|
| [2] | 294 |       }
 | 
|---|
| [194] | 295 |     }
 | 
|---|
 | 296 |     break;
 | 
|---|
| [2] | 297 | 
 | 
|---|
| [194] | 298 |   case WM_COMMAND:
 | 
|---|
 | 299 |     {
 | 
|---|
 | 300 |       DIRCNRDATA *dcd;
 | 
|---|
 | 301 |       MRESULT mr;
 | 
|---|
 | 302 | 
 | 
|---|
 | 303 |       mr = WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd,
 | 
|---|
 | 304 |                                                      QW_PARENT),
 | 
|---|
| [551] | 305 |                                       COLLECTOR_CNR), msg, mp1, mp2);
 | 
|---|
| [194] | 306 |       if (hwndButtonPopup &&
 | 
|---|
 | 307 |           SHORT1FROMMP(mp1) > IDM_DETAILSTITLES &&
 | 
|---|
| [551] | 308 |           SHORT1FROMMP(mp1) < IDM_DETAILSSETUP) {
 | 
|---|
| [194] | 309 |         dcd = WinQueryWindowPtr(WinWindowFromID(WinQueryWindow(hwnd,
 | 
|---|
 | 310 |                                                                QW_PARENT),
 | 
|---|
| [551] | 311 |                                                 COLLECTOR_CNR), QWL_USER);
 | 
|---|
| [194] | 312 |         if (dcd)
 | 
|---|
| [1065] | 313 |           SetDetailsSwitches(hwndButtonPopup, &dcd->ds);
 | 
|---|
| [2] | 314 |       }
 | 
|---|
| [194] | 315 |       return mr;
 | 
|---|
 | 316 |     }
 | 
|---|
| [2] | 317 | 
 | 
|---|
| [194] | 318 |   case WM_MOUSEMOVE:
 | 
|---|
 | 319 |     {
 | 
|---|
 | 320 |       USHORT id = WinQueryWindowUShort(hwnd, QWS_ID);
 | 
|---|
| [1394] | 321 |       PCSZ s = NULL;
 | 
|---|
| [194] | 322 | 
 | 
|---|
| [444] | 323 |       if (fOtherHelp) {
 | 
|---|
| [194] | 324 |         if ((!hwndBubble ||
 | 
|---|
 | 325 |              WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
 | 
|---|
| [551] | 326 |             !WinQueryCapture(HWND_DESKTOP)) {
 | 
|---|
| [444] | 327 |           switch (id) {
 | 
|---|
| [194] | 328 |           case DIR_SELECTED:
 | 
|---|
 | 329 |             s = GetPString(IDS_COLSELECTEDHELP);
 | 
|---|
 | 330 |             break;
 | 
|---|
 | 331 |           case DIR_TOTALS:
 | 
|---|
 | 332 |             s = GetPString(IDS_COLTOTALSHELP);
 | 
|---|
 | 333 |             break;
 | 
|---|
 | 334 |           case DIR_VIEW:
 | 
|---|
 | 335 |             s = GetPString(IDS_DIRCNRVIEWHELP);
 | 
|---|
 | 336 |             break;
 | 
|---|
 | 337 |           case DIR_SORT:
 | 
|---|
 | 338 |             s = GetPString(IDS_DIRCNRSORTHELP);
 | 
|---|
 | 339 |             break;
 | 
|---|
 | 340 |           case DIR_FILTER:
 | 
|---|
| [948] | 341 |             s = GetPString(IDS_DIRCNRFILTERHELP);
 | 
|---|
 | 342 |             break;
 | 
|---|
| [194] | 343 |           default:
 | 
|---|
 | 344 |             break;
 | 
|---|
 | 345 |           }
 | 
|---|
 | 346 |           if (s)
 | 
|---|
 | 347 |             MakeBubble(hwnd, TRUE, s);
 | 
|---|
 | 348 |           else if (hwndBubble)
 | 
|---|
 | 349 |             WinDestroyWindow(hwndBubble);
 | 
|---|
 | 350 |         }
 | 
|---|
| [2] | 351 |       }
 | 
|---|
| [444] | 352 |       switch (id) {
 | 
|---|
| [194] | 353 |       case DIR_FILTER:
 | 
|---|
 | 354 |       case DIR_SORT:
 | 
|---|
 | 355 |       case DIR_VIEW:
 | 
|---|
 | 356 |       case DIR_SELECTED:
 | 
|---|
 | 357 |         return CommonTextButton(hwnd, msg, mp1, mp2);
 | 
|---|
 | 358 |       }
 | 
|---|
 | 359 |     }
 | 
|---|
 | 360 |     break;
 | 
|---|
| [2] | 361 | 
 | 
|---|
| [194] | 362 |   case WM_BUTTON3UP:
 | 
|---|
 | 363 |   case WM_BUTTON1UP:
 | 
|---|
 | 364 |   case WM_BUTTON3DOWN:
 | 
|---|
 | 365 |   case WM_BUTTON1DOWN:
 | 
|---|
 | 366 |     {
 | 
|---|
 | 367 |       USHORT id;
 | 
|---|
 | 368 | 
 | 
|---|
| [280] | 369 |       id = WinQueryWindowUShort(hwnd, QWS_ID);
 | 
|---|
| [444] | 370 |       switch (id) {
 | 
|---|
| [194] | 371 |       case DIR_FILTER:
 | 
|---|
 | 372 |       case DIR_SORT:
 | 
|---|
 | 373 |       case DIR_VIEW:
 | 
|---|
 | 374 |       case DIR_SELECTED:
 | 
|---|
 | 375 |         return CommonTextButton(hwnd, msg, mp1, mp2);
 | 
|---|
| [2] | 376 |       }
 | 
|---|
| [194] | 377 |     }
 | 
|---|
 | 378 |     break;
 | 
|---|
| [2] | 379 | 
 | 
|---|
| [194] | 380 |   case UM_CLICKED:
 | 
|---|
 | 381 |   case UM_CLICKED3:
 | 
|---|
 | 382 |     {
 | 
|---|
 | 383 |       USHORT id, cmd = 0;
 | 
|---|
 | 384 | 
 | 
|---|
| [280] | 385 |       id = WinQueryWindowUShort(hwnd, QWS_ID);
 | 
|---|
| [444] | 386 |       switch (id) {
 | 
|---|
| [194] | 387 |       case DIR_VIEW:
 | 
|---|
 | 388 |       case DIR_SORT:
 | 
|---|
 | 389 |       case DIR_SELECTED:
 | 
|---|
| [551] | 390 |         PostMsg(hwnd, UM_CONTEXTMENU, MPVOID, MPVOID);
 | 
|---|
| [194] | 391 |         break;
 | 
|---|
 | 392 |       case DIR_FILTER:
 | 
|---|
 | 393 |         cmd = IDM_FILTER;
 | 
|---|
 | 394 |         break;
 | 
|---|
 | 395 |       default:
 | 
|---|
 | 396 |         break;
 | 
|---|
| [2] | 397 |       }
 | 
|---|
| [194] | 398 |       if (cmd)
 | 
|---|
| [551] | 399 |         PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
 | 
|---|
| [194] | 400 |                                 COLLECTOR_CNR),
 | 
|---|
| [551] | 401 |                 WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
 | 
|---|
| [194] | 402 |     }
 | 
|---|
 | 403 |     return 0;
 | 
|---|
| [2] | 404 | 
 | 
|---|
| [194] | 405 |   case DM_DROP:
 | 
|---|
 | 406 |   case DM_DRAGOVER:
 | 
|---|
 | 407 |   case DM_DRAGLEAVE:
 | 
|---|
 | 408 |   case DM_DROPHELP:
 | 
|---|
| [444] | 409 |     if (msg == DM_DRAGOVER) {
 | 
|---|
 | 410 |       if (!emphasized) {
 | 
|---|
| [194] | 411 |         emphasized = TRUE;
 | 
|---|
 | 412 |         DrawTargetEmphasis(hwnd, emphasized);
 | 
|---|
| [2] | 413 |       }
 | 
|---|
| [194] | 414 |     }
 | 
|---|
| [444] | 415 |     else {
 | 
|---|
 | 416 |       if (emphasized) {
 | 
|---|
| [194] | 417 |         emphasized = FALSE;
 | 
|---|
 | 418 |         DrawTargetEmphasis(hwnd, emphasized);
 | 
|---|
| [2] | 419 |       }
 | 
|---|
| [194] | 420 |     }
 | 
|---|
 | 421 |     {
 | 
|---|
 | 422 |       CNRDRAGINFO cnd;
 | 
|---|
 | 423 |       USHORT dcmd;
 | 
|---|
 | 424 | 
 | 
|---|
| [444] | 425 |       switch (msg) {
 | 
|---|
| [194] | 426 |       case DM_DROP:
 | 
|---|
 | 427 |         dcmd = CN_DROP;
 | 
|---|
 | 428 |         break;
 | 
|---|
 | 429 |       case DM_DRAGOVER:
 | 
|---|
 | 430 |         dcmd = CN_DRAGOVER;
 | 
|---|
 | 431 |         break;
 | 
|---|
 | 432 |       case DM_DRAGLEAVE:
 | 
|---|
 | 433 |         dcmd = CN_DRAGLEAVE;
 | 
|---|
 | 434 |         break;
 | 
|---|
 | 435 |       case DM_DROPHELP:
 | 
|---|
 | 436 |         dcmd = CN_DROPHELP;
 | 
|---|
 | 437 |         break;
 | 
|---|
| [2] | 438 |       }
 | 
|---|
| [194] | 439 |       memset(&cnd, 0, sizeof(cnd));
 | 
|---|
 | 440 |       cnd.pDragInfo = (PDRAGINFO) mp1;
 | 
|---|
 | 441 |       cnd.pRecord = NULL;
 | 
|---|
 | 442 |       return WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_CONTROL,
 | 
|---|
 | 443 |                         MPFROM2SHORT(COLLECTOR_CNR, dcmd), MPFROMP(&cnd));
 | 
|---|
 | 444 |     }
 | 
|---|
| [2] | 445 |   }
 | 
|---|
| [194] | 446 |   return PFNWPStatic(hwnd, msg, mp1, mp2);
 | 
|---|
| [2] | 447 | }
 | 
|---|
 | 448 | 
 | 
|---|
| [194] | 449 | MRESULT EXPENTRY CollectorClientWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
 | 
|---|
 | 450 |                                         MPARAM mp2)
 | 
|---|
 | 451 | {
 | 
|---|
| [444] | 452 |   switch (msg) {
 | 
|---|
| [194] | 453 |   case UM_CONTAINERHWND:
 | 
|---|
 | 454 |     return MRFROMLONG(WinWindowFromID(hwnd, COLLECTOR_CNR));
 | 
|---|
| [2] | 455 | 
 | 
|---|
| [194] | 456 |   case UM_VIEWSMENU:
 | 
|---|
| [872] | 457 |     return MRFROMLONG(CheckMenu(hwnd, &CollectorCnrMenu, COLLECTORCNR_POPUP));
 | 
|---|
| [2] | 458 | 
 | 
|---|
| [194] | 459 |   case MM_PORTHOLEINIT:
 | 
|---|
 | 460 |   case WM_INITMENU:
 | 
|---|
 | 461 |   case UM_INITMENU:
 | 
|---|
 | 462 |   case UM_CONTAINER_FILLED:
 | 
|---|
 | 463 |   case UM_FILESMENU:
 | 
|---|
 | 464 |   case UM_UPDATERECORD:
 | 
|---|
 | 465 |   case UM_UPDATERECORDLIST:
 | 
|---|
 | 466 |     return WinSendMsg(WinWindowFromID(hwnd, COLLECTOR_CNR), msg, mp1, mp2);
 | 
|---|
| [2] | 467 | 
 | 
|---|
| [194] | 468 |   case WM_PSETFOCUS:
 | 
|---|
 | 469 |   case WM_SETFOCUS:
 | 
|---|
 | 470 |     if (mp2)
 | 
|---|
 | 471 |       PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
 | 
|---|
 | 472 |     break;
 | 
|---|
| [2] | 473 | 
 | 
|---|
| [194] | 474 |   case UM_FOCUSME:
 | 
|---|
 | 475 |     WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, COLLECTOR_CNR));
 | 
|---|
 | 476 |     break;
 | 
|---|
| [2] | 477 | 
 | 
|---|
| [194] | 478 |   case WM_PAINT:
 | 
|---|
 | 479 |     {
 | 
|---|
 | 480 |       HPS hps;
 | 
|---|
 | 481 |       RECTL rcl;
 | 
|---|
| [2] | 482 | 
 | 
|---|
| [280] | 483 |       hps = WinBeginPaint(hwnd, NULLHANDLE, NULL);
 | 
|---|
| [444] | 484 |       if (hps) {
 | 
|---|
| [194] | 485 |         WinQueryWindowRect(hwnd, &rcl);
 | 
|---|
 | 486 |         WinFillRect(hps, &rcl, CLR_PALEGRAY);
 | 
|---|
 | 487 |         CommonTextPaint(hwnd, hps);
 | 
|---|
 | 488 |         WinEndPaint(hps);
 | 
|---|
| [2] | 489 |       }
 | 
|---|
| [194] | 490 |     }
 | 
|---|
 | 491 |     break;
 | 
|---|
| [2] | 492 | 
 | 
|---|
| [194] | 493 |   case UM_SIZE:
 | 
|---|
 | 494 |   case WM_SIZE:
 | 
|---|
| [444] | 495 |     if (msg == UM_SIZE) {
 | 
|---|
| [194] | 496 |       SWP swp;
 | 
|---|
| [2] | 497 | 
 | 
|---|
| [194] | 498 |       WinQueryWindowPos(hwnd, &swp);
 | 
|---|
 | 499 |       mp1 = MPFROM2SHORT(swp.cx, swp.cy);
 | 
|---|
 | 500 |       mp2 = MPFROM2SHORT(swp.cx, swp.cy);
 | 
|---|
 | 501 |     }
 | 
|---|
 | 502 |     {
 | 
|---|
 | 503 |       USHORT cx, cy, bx;
 | 
|---|
| [2] | 504 | 
 | 
|---|
| [194] | 505 |       cx = SHORT1FROMMP(mp2);
 | 
|---|
 | 506 |       cy = SHORT2FROMMP(mp2);
 | 
|---|
 | 507 |       WinSetWindowPos(WinWindowFromID(hwnd, COLLECTOR_CNR), HWND_TOP,
 | 
|---|
| [551] | 508 |                       0, 0, cx, cy - 24, SWP_SHOW | SWP_MOVE | SWP_SIZE);
 | 
|---|
| [194] | 509 |       WinSetWindowPos(WinWindowFromID(hwnd, DIR_TOTALS), HWND_TOP,
 | 
|---|
 | 510 |                       2,
 | 
|---|
 | 511 |                       cy - 22,
 | 
|---|
| [551] | 512 |                       (cx / 3) - 2, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
 | 
|---|
| [194] | 513 |       WinSetWindowPos(WinWindowFromID(hwnd, DIR_SELECTED), HWND_TOP,
 | 
|---|
 | 514 |                       2 + (cx / 3) + 2,
 | 
|---|
 | 515 |                       cy - 22,
 | 
|---|
| [551] | 516 |                       (cx / 3) - 2, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
 | 
|---|
| [194] | 517 |       bx = (cx - (2 + (((cx / 3) + 2) * 2))) / 3;
 | 
|---|
 | 518 |       WinSetWindowPos(WinWindowFromID(hwnd, DIR_VIEW), HWND_TOP,
 | 
|---|
 | 519 |                       2 + (((cx / 3) + 2) * 2),
 | 
|---|
| [551] | 520 |                       cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
 | 
|---|
| [194] | 521 |       WinSetWindowPos(WinWindowFromID(hwnd, DIR_SORT), HWND_TOP,
 | 
|---|
 | 522 |                       2 + (((cx / 3) + 2) * 2) + bx,
 | 
|---|
| [551] | 523 |                       cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
 | 
|---|
| [194] | 524 |       WinSetWindowPos(WinWindowFromID(hwnd, DIR_FILTER), HWND_TOP,
 | 
|---|
 | 525 |                       2 + (((cx / 3) + 2) * 2) + (bx * 2),
 | 
|---|
| [551] | 526 |                       cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
 | 
|---|
| [194] | 527 |     }
 | 
|---|
| [280] | 528 |     CommonTextPaint(hwnd, NULLHANDLE);
 | 
|---|
| [444] | 529 |     if (msg == UM_SIZE) {
 | 
|---|
| [194] | 530 |       WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0,
 | 
|---|
 | 531 |                       SWP_SHOW | SWP_ZORDER | SWP_ACTIVATE);
 | 
|---|
 | 532 |       return 0;
 | 
|---|
 | 533 |     }
 | 
|---|
 | 534 |     break;
 | 
|---|
| [2] | 535 | 
 | 
|---|
| [194] | 536 |   case UM_COMMAND:
 | 
|---|
 | 537 |   case WM_COMMAND:
 | 
|---|
 | 538 |   case WM_CONTROL:
 | 
|---|
 | 539 |   case WM_CLOSE:
 | 
|---|
 | 540 |     return WinSendMsg(WinWindowFromID(hwnd, COLLECTOR_CNR), msg, mp1, mp2);
 | 
|---|
| [2] | 541 |   }
 | 
|---|
| [194] | 542 |   return WinDefWindowProc(hwnd, msg, mp1, mp2);
 | 
|---|
| [2] | 543 | }
 | 
|---|
 | 544 | 
 | 
|---|
| [942] | 545 | MRESULT EXPENTRY CollectorObjWndProc(HWND hwnd, ULONG msg,
 | 
|---|
 | 546 |                                      MPARAM mp1, MPARAM mp2)
 | 
|---|
| [194] | 547 | {
 | 
|---|
| [197] | 548 |   ULONG size;
 | 
|---|
| [2] | 549 |   DIRCNRDATA *dcd;
 | 
|---|
 | 550 | 
 | 
|---|
| [444] | 551 |   switch (msg) {
 | 
|---|
| [194] | 552 |   case WM_CREATE:
 | 
|---|
| [1077] | 553 |     // 18 Jul 08 SHL fixme to doc why messsage gets lost
 | 
|---|
 | 554 |     DbgMsg(pszSrcFile, __LINE__, "WM_CREATE mp1 %p mp2 %p", mp1, mp2);  // 18 Jul 08 SHL fixme
 | 
|---|
| [194] | 555 |     break;
 | 
|---|
| [2] | 556 | 
 | 
|---|
| [194] | 557 |   case DM_PRINTOBJECT:
 | 
|---|
 | 558 |     return MRFROMLONG(DRR_TARGET);
 | 
|---|
| [2] | 559 | 
 | 
|---|
| [194] | 560 |   case DM_DISCARDOBJECT:
 | 
|---|
 | 561 |     dcd = INSTDATA(hwnd);
 | 
|---|
| [444] | 562 |     if (fFM2Deletes && dcd) {
 | 
|---|
| [194] | 563 |       LISTINFO *li;
 | 
|---|
 | 564 |       CNRDRAGINFO cni;
 | 
|---|
| [2] | 565 | 
 | 
|---|
| [194] | 566 |       cni.pRecord = NULL;
 | 
|---|
 | 567 |       cni.pDragInfo = (PDRAGINFO) mp1;
 | 
|---|
| [551] | 568 |       li = DoFileDrop(dcd->hwndCnr, NULL, FALSE, MPVOID, MPFROMP(&cni));
 | 
|---|
| [687] | 569 |       CheckPmDrgLimit(cni.pDragInfo);
 | 
|---|
| [444] | 570 |       if (li) {
 | 
|---|
| [672] | 571 |         li->type = fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE;
 | 
|---|
| [194] | 572 |         if (!PostMsg(hwnd, UM_MASSACTION, MPFROMP(li), MPVOID))
 | 
|---|
 | 573 |           FreeListInfo(li);
 | 
|---|
 | 574 |         else
 | 
|---|
 | 575 |           return MRFROMLONG(DRR_SOURCE);
 | 
|---|
| [2] | 576 |       }
 | 
|---|
| [194] | 577 |     }
 | 
|---|
 | 578 |     return MRFROMLONG(DRR_TARGET);
 | 
|---|
| [2] | 579 | 
 | 
|---|
| [194] | 580 |   case UM_UPDATERECORDLIST:
 | 
|---|
 | 581 |     dcd = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| [444] | 582 |     if (dcd && mp1) {
 | 
|---|
| [194] | 583 |       INT numentries = 0;
 | 
|---|
 | 584 |       CHAR **list = (CHAR **) mp1;
 | 
|---|
| [2] | 585 | 
 | 
|---|
| [194] | 586 |       while (list[numentries])
 | 
|---|
 | 587 |         numentries++;
 | 
|---|
 | 588 |       if (numentries)
 | 
|---|
| [551] | 589 |         UpdateCnrList(dcd->hwndCnr, list, numentries, FALSE, dcd);
 | 
|---|
| [194] | 590 |     }
 | 
|---|
 | 591 |     return 0;
 | 
|---|
| [2] | 592 | 
 | 
|---|
| [194] | 593 |   case UM_SETUP:
 | 
|---|
| [1077] | 594 | #   ifdef FORTIFY
 | 
|---|
 | 595 |     Fortify_EnterScope();
 | 
|---|
 | 596 | #   endif
 | 
|---|
| [194] | 597 |     dcd = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| [444] | 598 |     if (dcd) {
 | 
|---|
| [1077] | 599 | #     ifdef FORTIFY
 | 
|---|
| [1078] | 600 |       Fortify_BecomeOwner(dcd);
 | 
|---|
| [1077] | 601 | #     endif
 | 
|---|
| [1673] | 602 |       // set unique id
 | 
|---|
| [194] | 603 |       WinSetWindowUShort(hwnd,
 | 
|---|
 | 604 |                          QWS_ID,
 | 
|---|
| [551] | 605 |                          COLLECTOROBJ_FRAME + (COLLECTOR_FRAME - dcd->id));
 | 
|---|
 | 606 |       dcd->hwndObject = hwnd;
 | 
|---|
| [942] | 607 |       // 09 Feb 08 SHL fixme to be sure applet does not really need this
 | 
|---|
 | 608 |       // if (ParentIsDesktop(hwnd, dcd->hwndParent))
 | 
|---|
 | 609 |       //        DosSleep(100); //05 Aug 07 GKY 250
 | 
|---|
| [194] | 610 |     }
 | 
|---|
 | 611 |     else
 | 
|---|
 | 612 |       PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
 | 
|---|
 | 613 |     return 0;
 | 
|---|
| [2] | 614 | 
 | 
|---|
| [194] | 615 |   case UM_COMMAND:
 | 
|---|
| [444] | 616 |     if (mp1) {
 | 
|---|
| [194] | 617 |       LISTINFO *li = (LISTINFO *) mp1;
 | 
|---|
 | 618 | 
 | 
|---|
| [551] | 619 |       switch (li->type) {
 | 
|---|
| [194] | 620 |       case IDM_DOITYOURSELF:
 | 
|---|
 | 621 |       case IDM_APPENDTOCLIP:
 | 
|---|
| [1084] | 622 |       case IDM_APPENDTOCLIPFILENAME:
 | 
|---|
| [194] | 623 |       case IDM_SAVETOCLIP:
 | 
|---|
 | 624 |       case IDM_ARCHIVE:
 | 
|---|
 | 625 |       case IDM_ARCHIVEM:
 | 
|---|
 | 626 |       case IDM_VIEW:
 | 
|---|
 | 627 |       case IDM_VIEWTEXT:
 | 
|---|
 | 628 |       case IDM_VIEWBINARY:
 | 
|---|
 | 629 |       case IDM_VIEWARCHIVE:
 | 
|---|
 | 630 |       case IDM_EDIT:
 | 
|---|
 | 631 |       case IDM_EDITTEXT:
 | 
|---|
 | 632 |       case IDM_EDITBINARY:
 | 
|---|
 | 633 |       case IDM_OBJECT:
 | 
|---|
 | 634 |       case IDM_SHADOW:
 | 
|---|
 | 635 |       case IDM_SHADOW2:
 | 
|---|
 | 636 |       case IDM_PRINT:
 | 
|---|
 | 637 |       case IDM_ATTRS:
 | 
|---|
 | 638 |       case IDM_DELETE:
 | 
|---|
 | 639 |       case IDM_PERMDELETE:
 | 
|---|
 | 640 |       case IDM_FAKEEXTRACT:
 | 
|---|
 | 641 |       case IDM_FAKEEXTRACTM:
 | 
|---|
 | 642 |       case IDM_MCIPLAY:
 | 
|---|
 | 643 |       case IDM_UPDATE:
 | 
|---|
| [1741] | 644 |         if (li->type == IDM_DELETE)
 | 
|---|
 | 645 |           ignorereadonly = FALSE;
 | 
|---|
| [194] | 646 |         if (PostMsg(hwnd, UM_MASSACTION, mp1, mp2))
 | 
|---|
 | 647 |           return (MRESULT) TRUE;
 | 
|---|
 | 648 |         break;
 | 
|---|
 | 649 |       default:
 | 
|---|
 | 650 |         if (PostMsg(hwnd, UM_ACTION, mp1, mp2))
 | 
|---|
 | 651 |           return (MRESULT) TRUE;
 | 
|---|
| [2] | 652 |       }
 | 
|---|
| [194] | 653 |     }
 | 
|---|
 | 654 |     return 0;
 | 
|---|
| [2] | 655 | 
 | 
|---|
| [194] | 656 |   case UM_COLLECT:
 | 
|---|
 | 657 |     DosError(FERR_DISABLEHARDERR);
 | 
|---|
 | 658 |     dcd = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| [444] | 659 |     if (dcd) {
 | 
|---|
| [194] | 660 |       LISTINFO *li = (LISTINFO *) mp1;
 | 
|---|
| [1563] | 661 |       INT x;
 | 
|---|
| [841] | 662 |       FILEFINDBUF4L fb4;
 | 
|---|
| [194] | 663 |       HDIR hdir;
 | 
|---|
 | 664 |       ULONG ulMaxFiles;
 | 
|---|
 | 665 |       CHAR fullname[CCHMAXPATH];
 | 
|---|
| [2] | 666 | 
 | 
|---|
| [942] | 667 |       if (!hwndStatus) {
 | 
|---|
 | 668 |         WinSetWindowText(WinWindowFromID(dcd->hwndClient, DIR_SELECTED),
 | 
|---|
| [1498] | 669 |                          (CHAR *) GetPString(IDS_COLLECTINGTEXT));
 | 
|---|
| [942] | 670 |       }
 | 
|---|
 | 671 |       else {
 | 
|---|
 | 672 |         if (WinQueryFocus(HWND_DESKTOP) == dcd->hwndCnr)
 | 
|---|
| [1498] | 673 |           WinSetWindowText(hwndStatus, (CHAR *) GetPString(IDS_COLLECTINGTEXT));
 | 
|---|
| [942] | 674 |       }
 | 
|---|
 | 675 | 
 | 
|---|
| [1563] | 676 |       for (ulMaxFiles = 0; li->list[ulMaxFiles]; ulMaxFiles++) ;        // Count
 | 
|---|
 | 677 | 
 | 
|---|
 | 678 |       if (ulMaxFiles) {
 | 
|---|
 | 679 |         PCNRITEM pci = NULL;
 | 
|---|
 | 680 |         PCNRITEM pciFirst = NULL;
 | 
|---|
| [1611] | 681 |         PCNRITEM pciPrev;
 | 
|---|
| [1563] | 682 |         ULONG nm;
 | 
|---|
 | 683 |         ULONG ulRecsAtStart;
 | 
|---|
 | 684 |         ULONG ulRecsToInsert;
 | 
|---|
| [1611] | 685 |         ULONG ulRecsInserted = 0;
 | 
|---|
| [1615] | 686 |         ULONGLONG ullTotalBytes = 0;
 | 
|---|
| [1611] | 687 |         BOOL checkToInsert = FALSE;
 | 
|---|
| [1563] | 688 |         CNRINFO cnri;
 | 
|---|
 | 689 |         RECORDINSERT ri;
 | 
|---|
 | 690 |         ITIMER_DESC itdSleep = { 0 };   // 06 Feb 08 SHL
 | 
|---|
 | 691 | 
 | 
|---|
 | 692 |         InitITimer(&itdSleep, 500);     // Sleep every 500 mSec
 | 
|---|
 | 693 | 
 | 
|---|
 | 694 |         // Query initial count
 | 
|---|
 | 695 |         // 2011-05-29 SHL fixme to be utility
 | 
|---|
 | 696 |         memset(&cnri, 0, sizeof(CNRINFO));
 | 
|---|
 | 697 |         cnri.cb = sizeof(CNRINFO);
 | 
|---|
 | 698 |         if (WinSendMsg(dcd->hwndCnr, CM_QUERYCNRINFO, MPFROMP(&cnri),
 | 
|---|
 | 699 |                        MPFROMLONG(sizeof(CNRINFO)))) {
 | 
|---|
 | 700 |           ulRecsAtStart = cnri.cRecords;
 | 
|---|
 | 701 |         }
 | 
|---|
 | 702 |         else {
 | 
|---|
| [1673] | 703 |           Win_Error(hwnd, hwnd, pszSrcFile, __LINE__, PCSZ_QUERYCNRINFO);
 | 
|---|
| [1563] | 704 |           ulRecsAtStart = 0;
 | 
|---|
 | 705 |         }
 | 
|---|
 | 706 | 
 | 
|---|
 | 707 |         for (x = 0; li->list[x]; x++) {
 | 
|---|
| [1611] | 708 | 
 | 
|---|
 | 709 |           // Allocate more container items if needed
 | 
|---|
| [1563] | 710 |           if (!pci) {
 | 
|---|
| [1611] | 711 |             ulRecsToInsert = ulMaxFiles - ulRecsInserted;       // Left to do
 | 
|---|
| [1563] | 712 |             if (ulRecsToInsert > USHRT_MAX)
 | 
|---|
| [1611] | 713 |               ulRecsToInsert = USHRT_MAX;               // Avoid USHORT overflows
 | 
|---|
| [1563] | 714 |             pci = WinSendMsg(dcd->hwndCnr, CM_ALLOCRECORD,
 | 
|---|
 | 715 |                              MPFROMLONG(EXTRA_RECORD_BYTES),
 | 
|---|
 | 716 |                              MPFROMLONG(ulRecsToInsert));
 | 
|---|
| [1611] | 717 |             pciFirst = pci;
 | 
|---|
 | 718 |             pciPrev = NULL;
 | 
|---|
| [1563] | 719 |             if (!pci) {
 | 
|---|
 | 720 |               Runtime_Error(pszSrcFile, __LINE__, PCSZ_CM_ALLOCRECORD);
 | 
|---|
 | 721 |               break;
 | 
|---|
 | 722 |             }
 | 
|---|
 | 723 |           } // if need allocate
 | 
|---|
| [1611] | 724 | 
 | 
|---|
| [1563] | 725 |           nm = 1;
 | 
|---|
 | 726 |           hdir = HDIR_CREATE;
 | 
|---|
 | 727 |           DosError(FERR_DISABLEHARDERR);
 | 
|---|
 | 728 |           // If started with records in container, check if updating existing record
 | 
|---|
 | 729 |           if (ulRecsAtStart &&
 | 
|---|
 | 730 |               FindCnrRecord(dcd->hwndCnr,
 | 
|---|
 | 731 |                             li->list[x],
 | 
|---|
 | 732 |                             NULL,
 | 
|---|
 | 733 |                             FALSE,
 | 
|---|
 | 734 |                             FALSE,
 | 
|---|
| [1611] | 735 |                             TRUE))
 | 
|---|
 | 736 |           {
 | 
|---|
 | 737 |             // Updating existing record
 | 
|---|
 | 738 |             PCNRITEM pciUpd = UpdateCnrRecord(dcd->hwndCnr, li->list[x], FALSE, dcd);
 | 
|---|
 | 739 |             if (!pciUpd) {
 | 
|---|
 | 740 |               // file has disappeared
 | 
|---|
| [1563] | 741 |               Runtime_Error(pszSrcFile, __LINE__, "pci NULL for list[%u]", x);
 | 
|---|
 | 742 |             }
 | 
|---|
 | 743 |             else {
 | 
|---|
| [1611] | 744 |               // Update OK
 | 
|---|
 | 745 |               if (Filter((PMINIRECORDCORE) pciUpd, (PVOID) & dcd->mask)) {
 | 
|---|
 | 746 |                 pciUpd->rc.flRecordAttr &= ~CRA_FILTERED;       // Ensure visible
 | 
|---|
| [1563] | 747 |                 // 2011-05-29 SHL fixme to check fail
 | 
|---|
 | 748 |                 WinSendMsg(dcd->hwndCnr, CM_INVALIDATERECORD, MPVOID,
 | 
|---|
 | 749 |                            MPFROM2SHORT(0, CMA_REPOSITION | CMA_ERASE));
 | 
|---|
 | 750 |               }
 | 
|---|
 | 751 |             }
 | 
|---|
| [1611] | 752 |             ulMaxFiles--;               // No insert needed
 | 
|---|
 | 753 |             checkToInsert = TRUE;
 | 
|---|
| [1563] | 754 |           }
 | 
|---|
| [1611] | 755 |           // Add new entry maybe
 | 
|---|
| [1563] | 756 |           else if (*li->list[x] &&
 | 
|---|
 | 757 |               !DosQueryPathInfo(li->list[x], FIL_QUERYFULLNAME,
 | 
|---|
 | 758 |                                 fullname, sizeof(fullname)) &&
 | 
|---|
 | 759 |               !IsRoot(fullname) &&
 | 
|---|
 | 760 |               !xDosFindFirst(fullname,
 | 
|---|
 | 761 |                              &hdir,
 | 
|---|
 | 762 |                              FILE_NORMAL | FILE_DIRECTORY |
 | 
|---|
 | 763 |                              FILE_ARCHIVED | FILE_SYSTEM |
 | 
|---|
 | 764 |                              FILE_HIDDEN | FILE_READONLY,
 | 
|---|
| [1611] | 765 |                              &fb4, sizeof(fb4), &nm, FIL_QUERYEASIZEL))
 | 
|---|
 | 766 |           {
 | 
|---|
 | 767 |             // OK to add
 | 
|---|
| [1563] | 768 |             DosFindClose(hdir);
 | 
|---|
 | 769 |             priority_normal();
 | 
|---|
 | 770 |             *fb4.achName = 0;
 | 
|---|
| [1615] | 771 |             ullTotalBytes += FillInRecordFromFFB(dcd->hwndCnr,
 | 
|---|
| [1563] | 772 |                                                 pci,
 | 
|---|
 | 773 |                                                 fullname, &fb4, FALSE, dcd);
 | 
|---|
 | 774 |             pciPrev = pci;
 | 
|---|
 | 775 |             pci = (PCNRITEM) pci->rc.preccNextRecord;
 | 
|---|
 | 776 |           }
 | 
|---|
 | 777 |           else {
 | 
|---|
 | 778 |             // DosQueryPathInfo etc. failed - try to recover
 | 
|---|
 | 779 |             Runtime_Error(pszSrcFile, __LINE__, "DosQueryPathInfo failed for %s", fullname);
 | 
|---|
| [1611] | 780 |             ulMaxFiles--;               // Nothing to insert
 | 
|---|
 | 781 |             checkToInsert = TRUE;
 | 
|---|
 | 782 |           }
 | 
|---|
 | 783 | 
 | 
|---|
 | 784 |           if (checkToInsert) {
 | 
|---|
 | 785 |             checkToInsert = FALSE;
 | 
|---|
 | 786 |             // Remove extra records from chain
 | 
|---|
 | 787 |             while (ulRecsInserted + ulRecsToInsert > ulMaxFiles) {
 | 
|---|
 | 788 |               PCNRITEM pciNext = (PCNRITEM)pci->rc.preccNextRecord;
 | 
|---|
 | 789 |               if (pciPrev)
 | 
|---|
 | 790 |                 pciPrev->rc.preccNextRecord = (PMINIRECORDCORE)pciNext;
 | 
|---|
 | 791 |               else
 | 
|---|
 | 792 |                 pciFirst = pciNext;
 | 
|---|
 | 793 |               pci->pszFileName = NullStr;       // Avoid spurious complaints
 | 
|---|
| [1563] | 794 |               FreeCnrItem(dcd->hwndCnr, pci);
 | 
|---|
| [1611] | 795 |               pci = pciNext;
 | 
|---|
 | 796 |               ulRecsToInsert--;         // Remember gone
 | 
|---|
 | 797 |             }
 | 
|---|
| [1563] | 798 |           }
 | 
|---|
| [1611] | 799 | 
 | 
|---|
| [1563] | 800 |           // Check if time to insert
 | 
|---|
 | 801 |           if (!pci) {
 | 
|---|
| [1611] | 802 |             // All allocated CNRITEMs filled
 | 
|---|
| [1563] | 803 |             if (ulRecsToInsert) {
 | 
|---|
| [1611] | 804 |               // Have CNRITEMs to insert
 | 
|---|
| [1563] | 805 |               memset(&ri, 0, sizeof(RECORDINSERT));
 | 
|---|
 | 806 |               ri.cb = sizeof(RECORDINSERT);
 | 
|---|
 | 807 |               ri.pRecordOrder = (PRECORDCORE) CMA_END;
 | 
|---|
 | 808 |               ri.pRecordParent = (PRECORDCORE) 0;
 | 
|---|
 | 809 |               ri.zOrder = (ULONG) CMA_TOP;
 | 
|---|
 | 810 |               ri.cRecordsInsert = ulRecsToInsert;
 | 
|---|
 | 811 |               ri.fInvalidateRecord = TRUE;
 | 
|---|
 | 812 |               WinSendMsg(dcd->hwndCnr,
 | 
|---|
 | 813 |                          CM_INSERTRECORD, MPFROMP(pciFirst), MPFROMP(&ri));
 | 
|---|
 | 814 |               // 2011-05-29 SHL fixme to complain on failure
 | 
|---|
 | 815 |               PostMsg(dcd->hwndCnr, UM_RESCAN, MPVOID, MPVOID);
 | 
|---|
| [1702] | 816 |               ulRecsInserted += ulRecsToInsert;
 | 
|---|
 | 817 |               dcd->ullTotalBytes = ullTotalBytes;
 | 
|---|
| [1563] | 818 |               pciFirst = NULL;
 | 
|---|
 | 819 |               ulRecsToInsert = 0;
 | 
|---|
 | 820 |             }
 | 
|---|
 | 821 |           } // if need CM_INSERTRECORD
 | 
|---|
 | 822 |           SleepIfNeeded(&itdSleep, 1);  // 09 Feb 08 SHL
 | 
|---|
 | 823 |         } // for
 | 
|---|
 | 824 | 
 | 
|---|
 | 825 |         // Clean up in case stopped early by error
 | 
|---|
| [1611] | 826 |         if (pci)
 | 
|---|
| [1563] | 827 |           Runtime_Error(pszSrcFile, __LINE__, "pci not NULL");
 | 
|---|
| [1611] | 828 | 
 | 
|---|
| [1563] | 829 |         if (pciFirst) {
 | 
|---|
 | 830 |           Runtime_Error(pszSrcFile, __LINE__, "pciFirst not NULL");
 | 
|---|
| [1612] | 831 |           // 2011-08-08 SHL fixme to initialze pszFileName to prevent spurious complaints
 | 
|---|
| [1563] | 832 |           FreeCnrItemList(dcd->hwndCnr, pciFirst);
 | 
|---|
 | 833 |         }
 | 
|---|
 | 834 | 
 | 
|---|
 | 835 |       } // if have files
 | 
|---|
 | 836 | 
 | 
|---|
 | 837 |       if (dcd->flWindowAttr & CV_DETAIL)
 | 
|---|
 | 838 |         WinSendDlgItemMsg(hwnd,
 | 
|---|
 | 839 |                           COLLECTOR_CNR,
 | 
|---|
 | 840 |                           CM_INVALIDATERECORD,
 | 
|---|
 | 841 |                           MPVOID, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
 | 
|---|
 | 842 |     } // if dcd
 | 
|---|
| [194] | 843 |     return 0;
 | 
|---|
| [2] | 844 | 
 | 
|---|
| [194] | 845 |   case UM_COLLECTFROMFILE:
 | 
|---|
 | 846 |     dcd = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| [1077] | 847 | #   ifdef FORTIFY
 | 
|---|
 | 848 |     Fortify_EnterScope();
 | 
|---|
 | 849 | #   endif
 | 
|---|
 | 850 | 
 | 
|---|
| [403] | 851 |     if (dcd && mp1) {
 | 
|---|
| [1671] | 852 |       // mp1 is pszFileName, mp2 is unused
 | 
|---|
| [841] | 853 |       FILESTATUS4L fs4;
 | 
|---|
| [194] | 854 |       PCNRITEM pci;
 | 
|---|
 | 855 |       RECORDINSERT ri;
 | 
|---|
 | 856 |       CHAR fullname[1024], *p;
 | 
|---|
 | 857 |       FILE *fp;
 | 
|---|
| [750] | 858 |       ULONG errs = 0;
 | 
|---|
| [1671] | 859 |       BOOL first = TRUE; // 2012-09-05 SHL
 | 
|---|
| [444] | 860 |       size_t c;
 | 
|---|
| [1544] | 861 |       CHAR *moder = "r";
 | 
|---|
| [2] | 862 | 
 | 
|---|
| [1077] | 863 | #     ifdef FORTIFY
 | 
|---|
| [1078] | 864 |       Fortify_BecomeOwner(mp1);
 | 
|---|
| [1077] | 865 | #     endif
 | 
|---|
 | 866 | 
 | 
|---|
| [1544] | 867 |       fp = xfsopen((CHAR *)mp1, moder, SH_DENYNO, pszSrcFile, __LINE__, TRUE);
 | 
|---|
| [403] | 868 |       if (fp) {
 | 
|---|
 | 869 |         while (!feof(fp)) {
 | 
|---|
| [444] | 870 |           // Avoid too much noise if collecting from binary file - oops
 | 
|---|
 | 871 |           if (!fgets(fullname, sizeof(fullname), fp)) {
 | 
|---|
 | 872 |             if (ferror(fp))
 | 
|---|
 | 873 |               Runtime_Error(pszSrcFile, __LINE__, "fgets");
 | 
|---|
| [194] | 874 |             break;
 | 
|---|
 | 875 |           }
 | 
|---|
| [444] | 876 | 
 | 
|---|
 | 877 |           c = strlen(fullname);
 | 
|---|
 | 878 |           if (c + 1 >= sizeof(fullname))
 | 
|---|
| [1671] | 879 |             errs++;                     // Name too long
 | 
|---|
| [551] | 880 |           else if (!c || (fullname[c - 1] != '\n' && fullname[c - 1] != '\r'))
 | 
|---|
| [1671] | 881 |             errs++;                     // Probably reading a binary file
 | 
|---|
| [403] | 882 |           else {
 | 
|---|
| [444] | 883 |             bstripcr(fullname);
 | 
|---|
 | 884 | 
 | 
|---|
 | 885 |             if (*fullname == '\"') {
 | 
|---|
| [1671] | 886 |               // Strip quotes
 | 
|---|
| [444] | 887 |               memmove(fullname, fullname + 1, strlen(fullname) + 1);
 | 
|---|
 | 888 |               lstrip(fullname);
 | 
|---|
 | 889 |               p = strchr(fullname, '\"');
 | 
|---|
 | 890 |               if (p)
 | 
|---|
 | 891 |                 *p = 0;
 | 
|---|
 | 892 |               rstrip(fullname);
 | 
|---|
 | 893 |             }
 | 
|---|
 | 894 |             else {
 | 
|---|
| [1671] | 895 |               // Strip trailing spaces
 | 
|---|
| [444] | 896 |               p = strchr(fullname, ' ');
 | 
|---|
 | 897 |               if (p)
 | 
|---|
 | 898 |                 *p = 0;
 | 
|---|
 | 899 |             }
 | 
|---|
| [1615] | 900 |             // fullname now contains name of file to collect
 | 
|---|
| [1077] | 901 |             DosError(FERR_DISABLEHARDERR);
 | 
|---|
 | 902 |             if (FindCnrRecord(dcd->hwndCnr,
 | 
|---|
| [956] | 903 |                               fullname,
 | 
|---|
 | 904 |                               NULL,
 | 
|---|
 | 905 |                               FALSE,
 | 
|---|
 | 906 |                               FALSE,
 | 
|---|
| [1077] | 907 |                               TRUE)) {
 | 
|---|
| [1671] | 908 |               // Already in container
 | 
|---|
| [1077] | 909 |               pci = UpdateCnrRecord(dcd->hwndCnr, fullname, FALSE, dcd);
 | 
|---|
 | 910 |               if (Filter((PMINIRECORDCORE) pci, (PVOID) & dcd->mask)) {
 | 
|---|
 | 911 |                 pci->rc.flRecordAttr &= ~CRA_FILTERED;
 | 
|---|
 | 912 |                 WinSendMsg(dcd->hwndCnr, CM_INVALIDATERECORD, MPVOID,
 | 
|---|
 | 913 |                            MPFROM2SHORT(0, CMA_REPOSITION | CMA_ERASE));
 | 
|---|
 | 914 |               }
 | 
|---|
 | 915 |             }
 | 
|---|
| [956] | 916 |             else if (IsFullName(fullname) &&
 | 
|---|
| [444] | 917 |                 !IsRoot(fullname) &&
 | 
|---|
 | 918 |                 !DosQueryPathInfo(fullname,
 | 
|---|
| [841] | 919 |                                   FIL_QUERYEASIZEL,
 | 
|---|
| [444] | 920 |                                   &fs4,
 | 
|---|
| [1077] | 921 |                                   sizeof(fs4))) {
 | 
|---|
| [1671] | 922 |               // Add to collector containter
 | 
|---|
| [551] | 923 |               pci = WinSendMsg(dcd->hwndCnr,
 | 
|---|
| [444] | 924 |                                CM_ALLOCRECORD,
 | 
|---|
 | 925 |                                MPFROMLONG(EXTRA_RECORD_BYTES),
 | 
|---|
| [750] | 926 |                                MPFROMLONG(1));
 | 
|---|
| [444] | 927 |               if (pci) {
 | 
|---|
| [551] | 928 |                 dcd->ullTotalBytes += FillInRecordFromFSA(dcd->hwndCnr, pci,
 | 
|---|
 | 929 |                                                           fullname,
 | 
|---|
| [1456] | 930 |                                                           &fs4, FALSE, NULL, dcd);
 | 
|---|
| [444] | 931 |                 memset(&ri, 0, sizeof(RECORDINSERT));
 | 
|---|
 | 932 |                 ri.cb = sizeof(RECORDINSERT);
 | 
|---|
 | 933 |                 ri.pRecordOrder = (PRECORDCORE) CMA_END;
 | 
|---|
 | 934 |                 ri.pRecordParent = (PRECORDCORE) 0;
 | 
|---|
 | 935 |                 ri.zOrder = (ULONG) CMA_TOP;
 | 
|---|
| [750] | 936 |                 ri.cRecordsInsert = 1;
 | 
|---|
| [444] | 937 |                 ri.fInvalidateRecord = TRUE;
 | 
|---|
| [551] | 938 |                 WinSendMsg(dcd->hwndCnr, CM_INSERTRECORD,
 | 
|---|
| [444] | 939 |                            MPFROMP(pci), MPFROMP(&ri));
 | 
|---|
 | 940 |               }
 | 
|---|
| [194] | 941 |             }
 | 
|---|
| [444] | 942 |             else
 | 
|---|
| [1671] | 943 |               errs++;                   // Something wrong with filename or file
 | 
|---|
| [194] | 944 |           }
 | 
|---|
| [444] | 945 |           if (errs > (first ? 0 : 50)) {
 | 
|---|
| [1673] | 946 |             // prevent runaway on bad file
 | 
|---|
| [551] | 947 |             APIRET ret = saymsg(MB_YESNO, dcd->hwndCnr,
 | 
|---|
| [444] | 948 |                                 GetPString(IDS_COLLECTNOLISTHDRTEXT),
 | 
|---|
 | 949 |                                 GetPString(IDS_COLLECTNOLISTTEXT),
 | 
|---|
| [1009] | 950 |                                 (CHAR *)mp1);
 | 
|---|
| [551] | 951 | 
 | 
|---|
| [444] | 952 |             if (ret == MBID_NO)
 | 
|---|
| [1671] | 953 |               break;                    // Give up
 | 
|---|
| [444] | 954 |             if (!first)
 | 
|---|
 | 955 |               errs = 0;
 | 
|---|
 | 956 |             else
 | 
|---|
 | 957 |               first = FALSE;
 | 
|---|
| [194] | 958 |           }
 | 
|---|
| [1702] | 959 |         } // while not eof
 | 
|---|
| [194] | 960 |         fclose(fp);
 | 
|---|
| [1671] | 961 |       } // if file opened
 | 
|---|
| [1442] | 962 |       free(mp1);
 | 
|---|
| [194] | 963 |     }
 | 
|---|
| [1063] | 964 | #   ifdef FORTIFY
 | 
|---|
 | 965 |     Fortify_LeaveScope();
 | 
|---|
| [1077] | 966 | #   endif
 | 
|---|
| [194] | 967 |     return 0;
 | 
|---|
| [2] | 968 | 
 | 
|---|
| [194] | 969 |   case UM_SELECT:
 | 
|---|
 | 970 |     dcd = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| [444] | 971 |     if (dcd) {
 | 
|---|
 | 972 |       switch (SHORT1FROMMP(mp1)) {
 | 
|---|
| [194] | 973 |       case IDM_SELECTLIST:
 | 
|---|
 | 974 |         {
 | 
|---|
 | 975 |           CHAR filename[CCHMAXPATH], *p, *pp;
 | 
|---|
| [2] | 976 | 
 | 
|---|
| [1395] | 977 |           strcpy(filename, PCSZ_STARDOTLST);
 | 
|---|
| [194] | 978 |           size = CCHMAXPATH;
 | 
|---|
| [551] | 979 |           PrfQueryProfileData(fmprof, appname, "SaveToListName", filename,
 | 
|---|
 | 980 |                               &size);
 | 
|---|
| [194] | 981 |           pp = strrchr(filename, '\\');
 | 
|---|
 | 982 |           if (!pp)
 | 
|---|
 | 983 |             pp = filename;
 | 
|---|
 | 984 |           p = strrchr(pp, '.');
 | 
|---|
| [444] | 985 |           if (p && *(p + 1) && p > pp + 1) {
 | 
|---|
| [194] | 986 |             if (pp > filename)
 | 
|---|
 | 987 |               pp++;
 | 
|---|
 | 988 |             *pp = '*';
 | 
|---|
 | 989 |             pp++;
 | 
|---|
 | 990 |             if (p > pp)
 | 
|---|
 | 991 |               memmove(pp, p, strlen(p) + 1);
 | 
|---|
 | 992 |           }
 | 
|---|
 | 993 |           if (insert_filename(hwnd, filename, FALSE, FALSE))
 | 
|---|
| [551] | 994 |             SelectList(dcd->hwndCnr, TRUE, FALSE, FALSE, NULL, filename,
 | 
|---|
 | 995 |                        NULL);
 | 
|---|
| [194] | 996 |         }
 | 
|---|
 | 997 |         break;
 | 
|---|
 | 998 |       case IDM_SELECTALL:
 | 
|---|
| [551] | 999 |         SelectAll(dcd->hwndCnr, TRUE, TRUE, NULL, NULL, FALSE);
 | 
|---|
| [194] | 1000 |         break;
 | 
|---|
 | 1001 |       case IDM_DESELECTALL:
 | 
|---|
| [551] | 1002 |         DeselectAll(dcd->hwndCnr, TRUE, TRUE, NULL, NULL, FALSE);
 | 
|---|
| [194] | 1003 |         break;
 | 
|---|
 | 1004 |       case IDM_SELECTALLFILES:
 | 
|---|
| [551] | 1005 |         SelectAll(dcd->hwndCnr, TRUE, FALSE, NULL, NULL, FALSE);
 | 
|---|
| [194] | 1006 |         break;
 | 
|---|
 | 1007 |       case IDM_DESELECTALLFILES:
 | 
|---|
| [551] | 1008 |         DeselectAll(dcd->hwndCnr, TRUE, FALSE, NULL, NULL, FALSE);
 | 
|---|
| [194] | 1009 |         break;
 | 
|---|
 | 1010 |       case IDM_SELECTALLDIRS:
 | 
|---|
| [551] | 1011 |         SelectAll(dcd->hwndCnr, FALSE, TRUE, NULL, NULL, FALSE);
 | 
|---|
| [194] | 1012 |         break;
 | 
|---|
 | 1013 |       case IDM_DESELECTALLDIRS:
 | 
|---|
| [551] | 1014 |         DeselectAll(dcd->hwndCnr, FALSE, TRUE, NULL, NULL, FALSE);
 | 
|---|
| [194] | 1015 |         break;
 | 
|---|
 | 1016 |       case IDM_DESELECTMASK:
 | 
|---|
 | 1017 |       case IDM_SELECTMASK:
 | 
|---|
 | 1018 |         {
 | 
|---|
 | 1019 |           MASK mask;
 | 
|---|
 | 1020 |           PCNRITEM pci = (PCNRITEM) mp2;
 | 
|---|
| [2] | 1021 | 
 | 
|---|
| [194] | 1022 |           memset(&mask, 0, sizeof(MASK));
 | 
|---|
 | 1023 |           mask.fNoAttribs = TRUE;
 | 
|---|
 | 1024 |           mask.fNoDirs = TRUE;
 | 
|---|
 | 1025 |           mask.fText = TRUE;
 | 
|---|
 | 1026 |           strcpy(mask.prompt,
 | 
|---|
 | 1027 |                  GetPString((SHORT1FROMMP(mp1) == IDM_SELECTMASK) ?
 | 
|---|
| [551] | 1028 |                             IDS_SELECTFILTERTEXT : IDS_DESELECTFILTERTEXT));
 | 
|---|
| [194] | 1029 |           if (pci && (INT) pci != -1)
 | 
|---|
| [730] | 1030 |             strcpy(mask.szMask, pci->pszFileName);
 | 
|---|
| [551] | 1031 |           if (WinDlgBox(HWND_DESKTOP, dcd->hwndCnr, PickMaskDlgProc,
 | 
|---|
 | 1032 |                         FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {
 | 
|---|
| [194] | 1033 |             if (SHORT1FROMMP(mp1) == IDM_SELECTMASK)
 | 
|---|
| [551] | 1034 |               SelectAll(dcd->hwndCnr, TRUE, TRUE, mask.szMask, mask.szText,
 | 
|---|
| [194] | 1035 |                         FALSE);
 | 
|---|
 | 1036 |             else
 | 
|---|
| [551] | 1037 |               DeselectAll(dcd->hwndCnr, TRUE, TRUE, mask.szMask, mask.szText,
 | 
|---|
| [194] | 1038 |                           FALSE);
 | 
|---|
 | 1039 |           }
 | 
|---|
 | 1040 |         }
 | 
|---|
| [2] | 1041 | 
 | 
|---|
| [194] | 1042 |       case IDM_DESELECTCLIP:
 | 
|---|
 | 1043 |       case IDM_SELECTCLIP:
 | 
|---|
 | 1044 |         {
 | 
|---|
 | 1045 |           CHAR **list;
 | 
|---|
| [2] | 1046 | 
 | 
|---|
| [194] | 1047 |           list = ListFromClipboard(hwnd);
 | 
|---|
| [444] | 1048 |           if (list) {
 | 
|---|
| [551] | 1049 |             SelectList(dcd->hwndCnr, TRUE, FALSE,
 | 
|---|
| [194] | 1050 |                        (SHORT1FROMMP(mp1) == IDM_DESELECTCLIP),
 | 
|---|
 | 1051 |                        NULL, NULL, list);
 | 
|---|
 | 1052 |             FreeList(list);
 | 
|---|
 | 1053 |           }
 | 
|---|
 | 1054 |         }
 | 
|---|
 | 1055 |         break;
 | 
|---|
| [2] | 1056 | 
 | 
|---|
| [194] | 1057 |       case IDM_INVERT:
 | 
|---|
| [551] | 1058 |         InvertAll(dcd->hwndCnr);
 | 
|---|
| [194] | 1059 |         break;
 | 
|---|
| [2] | 1060 |       }
 | 
|---|
| [194] | 1061 |     }
 | 
|---|
 | 1062 |     return 0;
 | 
|---|
| [2] | 1063 | 
 | 
|---|
| [194] | 1064 |   case UM_MASSACTION:
 | 
|---|
| [1077] | 1065 | #   ifdef FORTIFY
 | 
|---|
 | 1066 |     Fortify_EnterScope();
 | 
|---|
 | 1067 | #   endif
 | 
|---|
| [444] | 1068 |     if (mp1) {
 | 
|---|
| [1077] | 1069 | #     ifdef FORTIFY
 | 
|---|
| [1078] | 1070 |       Fortify_BecomeOwner(mp1);
 | 
|---|
| [1077] | 1071 | #     endif
 | 
|---|
| [194] | 1072 |       dcd = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| [444] | 1073 |       if (dcd) {
 | 
|---|
| [194] | 1074 |         WORKER *wk;
 | 
|---|
| [551] | 1075 |         wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__);
 | 
|---|
| [444] | 1076 |         if (!wk)
 | 
|---|
| [352] | 1077 |           FreeListInfo((LISTINFO *) mp1);
 | 
|---|
 | 1078 |         else {
 | 
|---|
| [551] | 1079 |           wk->size = sizeof(WORKER);
 | 
|---|
 | 1080 |           wk->hwndCnr = dcd->hwndCnr;
 | 
|---|
 | 1081 |           wk->hwndParent = dcd->hwndParent;
 | 
|---|
 | 1082 |           wk->hwndFrame = dcd->hwndFrame;
 | 
|---|
 | 1083 |           wk->hwndClient = dcd->hwndClient;
 | 
|---|
 | 1084 |           wk->li = (LISTINFO *) mp1;
 | 
|---|
 | 1085 |           strcpy(wk->directory, dcd->directory);
 | 
|---|
| [1335] | 1086 |           if (xbeginthread(MassAction,
 | 
|---|
 | 1087 |                            122880,
 | 
|---|
 | 1088 |                            wk,
 | 
|---|
 | 1089 |                            pszSrcFile,
 | 
|---|
 | 1090 |                            __LINE__) == -1)
 | 
|---|
 | 1091 |           {
 | 
|---|
| [1077] | 1092 |             free(wk);
 | 
|---|
| [194] | 1093 |             FreeListInfo((LISTINFO *) mp1);
 | 
|---|
 | 1094 |           }
 | 
|---|
 | 1095 |         }
 | 
|---|
| [2] | 1096 |       }
 | 
|---|
| [194] | 1097 |     }
 | 
|---|
| [1077] | 1098 | #   ifdef FORTIFY
 | 
|---|
 | 1099 |     DosSleep(1);                        // Let receiver take ownership
 | 
|---|
 | 1100 |     Fortify_LeaveScope();
 | 
|---|
 | 1101 | #   endif
 | 
|---|
| [194] | 1102 |     return 0;
 | 
|---|
| [2] | 1103 | 
 | 
|---|
| [194] | 1104 |   case UM_ACTION:
 | 
|---|
| [1077] | 1105 | #   ifdef FORTIFY
 | 
|---|
 | 1106 |     Fortify_EnterScope();
 | 
|---|
 | 1107 | #   endif
 | 
|---|
| [444] | 1108 |     if (mp1) {
 | 
|---|
| [1077] | 1109 | #     ifdef FORTIFY
 | 
|---|
| [1078] | 1110 |       Fortify_BecomeOwner(mp1);
 | 
|---|
| [1077] | 1111 | #     endif
 | 
|---|
| [194] | 1112 |       dcd = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| [444] | 1113 |       if (dcd) {
 | 
|---|
| [194] | 1114 |         WORKER *wk;
 | 
|---|
| [551] | 1115 |         wk = xmallocz(sizeof(WORKER), pszSrcFile, __LINE__);
 | 
|---|
| [352] | 1116 |         if (!wk)
 | 
|---|
 | 1117 |           FreeListInfo((LISTINFO *) mp1);
 | 
|---|
 | 1118 |         else {
 | 
|---|
| [551] | 1119 |           wk->size = sizeof(WORKER);
 | 
|---|
 | 1120 |           wk->hwndCnr = dcd->hwndCnr;
 | 
|---|
 | 1121 |           wk->hwndParent = dcd->hwndParent;
 | 
|---|
 | 1122 |           wk->hwndFrame = dcd->hwndFrame;
 | 
|---|
 | 1123 |           wk->hwndClient = dcd->hwndClient;
 | 
|---|
 | 1124 |           wk->li = (LISTINFO *) mp1;
 | 
|---|
 | 1125 |           strcpy(wk->directory, dcd->directory);
 | 
|---|
| [1335] | 1126 |           if (xbeginthread(Action,
 | 
|---|
 | 1127 |                            122880,
 | 
|---|
 | 1128 |                            wk,
 | 
|---|
 | 1129 |                            pszSrcFile,
 | 
|---|
 | 1130 |                            __LINE__) == -1)
 | 
|---|
 | 1131 |           {
 | 
|---|
| [1077] | 1132 |             free(wk);
 | 
|---|
| [194] | 1133 |             FreeListInfo((LISTINFO *) mp1);
 | 
|---|
 | 1134 |           }
 | 
|---|
 | 1135 |         }
 | 
|---|
| [2] | 1136 |       }
 | 
|---|
| [194] | 1137 |     }
 | 
|---|
| [1077] | 1138 | #   ifdef FORTIFY
 | 
|---|
 | 1139 |     DosSleep(1);                        // Let receiver take ownership
 | 
|---|
 | 1140 |     Fortify_LeaveScope();
 | 
|---|
 | 1141 | #   endif
 | 
|---|
| [194] | 1142 |     return 0;
 | 
|---|
| [2] | 1143 | 
 | 
|---|
| [194] | 1144 |   case WM_CLOSE:
 | 
|---|
 | 1145 |     WinDestroyWindow(hwnd);
 | 
|---|
 | 1146 |     break;
 | 
|---|
| [2] | 1147 | 
 | 
|---|
| [194] | 1148 |   case WM_DESTROY:
 | 
|---|
 | 1149 |     dcd = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| [444] | 1150 |     if (dcd) {
 | 
|---|
 | 1151 |       INT x;
 | 
|---|
| [551] | 1152 | 
 | 
|---|
 | 1153 |       dcd->stopflag = 1;
 | 
|---|
| [942] | 1154 |       // Allow other threads to honor stop request
 | 
|---|
 | 1155 |       for (x = 0; x < 100 && dcd->amextracted; x++)
 | 
|---|
 | 1156 |         DosSleep(10);
 | 
|---|
 | 1157 |       if (dcd->amextracted)
 | 
|---|
 | 1158 |         Runtime_Error(pszSrcFile, __LINE__, "still busy");
 | 
|---|
| [551] | 1159 |       WinSendMsg(dcd->hwndCnr, UM_CLOSE, MPVOID, MPVOID);
 | 
|---|
 | 1160 |       FreeList(dcd->lastselection);
 | 
|---|
| [1513] | 1161 |       WinSetWindowPtr(dcd->hwndCnr, QWL_USER, NULL);    // 13 Apr 10 SHL Set NULL before freeing dcd
 | 
|---|
| [1039] | 1162 |       free(dcd);
 | 
|---|
| [1063] | 1163 | #     ifdef FORTIFY
 | 
|---|
 | 1164 |       Fortify_LeaveScope();
 | 
|---|
| [1077] | 1165 | #     endif
 | 
|---|
| [194] | 1166 |     }
 | 
|---|
 | 1167 |     DosPostEventSem(CompactSem);
 | 
|---|
| [551] | 1168 |     if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
 | 
|---|
 | 1169 |       WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
 | 
|---|
| [194] | 1170 |     break;
 | 
|---|
| [2] | 1171 |   }
 | 
|---|
| [194] | 1172 |   return WinDefWindowProc(hwnd, msg, mp1, mp2);
 | 
|---|
| [2] | 1173 | }
 | 
|---|
 | 1174 | 
 | 
|---|
| [551] | 1175 | MRESULT EXPENTRY CollectorCnrWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
 | 
|---|
 | 1176 |                                      MPARAM mp2)
 | 
|---|
| [155] | 1177 | {
 | 
|---|
| [672] | 1178 |   DIRCNRDATA *dcd = INSTDATA(hwnd);
 | 
|---|
| [197] | 1179 |   ULONG size;
 | 
|---|
| [2] | 1180 | 
 | 
|---|
| [197] | 1181 |   static INT savedSortFlags;
 | 
|---|
 | 1182 | 
 | 
|---|
| [444] | 1183 |   switch (msg) {
 | 
|---|
| [194] | 1184 |   case DM_PRINTOBJECT:
 | 
|---|
 | 1185 |     return MRFROMLONG(DRR_TARGET);
 | 
|---|
 | 1186 | 
 | 
|---|
 | 1187 |   case DM_DISCARDOBJECT:
 | 
|---|
 | 1188 |     if (dcd)
 | 
|---|
| [551] | 1189 |       return WinSendMsg(dcd->hwndObject, msg, mp1, mp2);
 | 
|---|
| [194] | 1190 |     else
 | 
|---|
| [2] | 1191 |       return MRFROMLONG(DRR_TARGET);
 | 
|---|
 | 1192 | 
 | 
|---|
| [194] | 1193 |   case WM_CHAR:
 | 
|---|
 | 1194 |     shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
 | 
|---|
 | 1195 |     if (SHORT1FROMMP(mp1) & KC_KEYUP)
 | 
|---|
 | 1196 |       return (MRESULT) TRUE;
 | 
|---|
| [444] | 1197 |     if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {
 | 
|---|
 | 1198 |       switch (SHORT2FROMMP(mp2)) {
 | 
|---|
| [194] | 1199 |       case VK_DELETE:
 | 
|---|
 | 1200 |         if ((shiftstate & KC_CTRL) == KC_CTRL)
 | 
|---|
 | 1201 |           PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_PERMDELETE, 0), MPVOID);
 | 
|---|
 | 1202 |         else if ((shiftstate & KC_SHIFT) == KC_SHIFT)
 | 
|---|
 | 1203 |           PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_SAVETOCLIP, 0), MPVOID);
 | 
|---|
 | 1204 |         else
 | 
|---|
 | 1205 |           PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_DELETE, 0), MPVOID);
 | 
|---|
 | 1206 |         break;
 | 
|---|
| [2] | 1207 |       }
 | 
|---|
| [194] | 1208 |     }
 | 
|---|
 | 1209 |     if (shiftstate || fNoSearch)
 | 
|---|
 | 1210 |       break;
 | 
|---|
| [444] | 1211 |     if (SHORT1FROMMP(mp1) & KC_CHAR) {
 | 
|---|
| [194] | 1212 |       ULONG thistime, len;
 | 
|---|
 | 1213 |       SEARCHSTRING srch;
 | 
|---|
 | 1214 |       PCNRITEM pci;
 | 
|---|
| [2] | 1215 | 
 | 
|---|
| [194] | 1216 |       if (!dcd)
 | 
|---|
 | 1217 |         break;
 | 
|---|
| [444] | 1218 |       switch (SHORT1FROMMP(mp2)) {
 | 
|---|
| [194] | 1219 |       case '\x1b':
 | 
|---|
 | 1220 |       case '\r':
 | 
|---|
 | 1221 |       case '\n':
 | 
|---|
| [551] | 1222 |         dcd->lasttime = 0;
 | 
|---|
 | 1223 |         *dcd->szCommonName = 0;
 | 
|---|
| [194] | 1224 |         break;
 | 
|---|
 | 1225 |       default:
 | 
|---|
 | 1226 |         thistime = WinQueryMsgTime(WinQueryAnchorBlock(hwnd));
 | 
|---|
| [551] | 1227 |         if (thistime > dcd->lasttime + 1250)
 | 
|---|
 | 1228 |           *dcd->szCommonName = 0;
 | 
|---|
 | 1229 |         dcd->lasttime = thistime;
 | 
|---|
 | 1230 |         if (SHORT1FROMMP(mp2) == ' ' && !dcd->szCommonName)
 | 
|---|
| [194] | 1231 |           break;
 | 
|---|
 | 1232 |       KbdRetry:
 | 
|---|
| [551] | 1233 |         len = strlen(dcd->szCommonName);
 | 
|---|
| [444] | 1234 |         if (len >= CCHMAXPATH - 1) {
 | 
|---|
| [551] | 1235 |           *dcd->szCommonName = 0;
 | 
|---|
| [194] | 1236 |           len = 0;
 | 
|---|
 | 1237 |         }
 | 
|---|
| [551] | 1238 |         dcd->szCommonName[len] = toupper(SHORT1FROMMP(mp2));
 | 
|---|
 | 1239 |         dcd->szCommonName[len + 1] = 0;
 | 
|---|
| [194] | 1240 |         memset(&srch, 0, sizeof(SEARCHSTRING));
 | 
|---|
| [197] | 1241 |         srch.cb = sizeof(SEARCHSTRING);
 | 
|---|
| [551] | 1242 |         srch.pszSearch = dcd->szCommonName;
 | 
|---|
| [194] | 1243 |         srch.fsPrefix = TRUE;
 | 
|---|
 | 1244 |         srch.fsCaseSensitive = FALSE;
 | 
|---|
 | 1245 |         srch.usView = CV_ICON;
 | 
|---|
 | 1246 |         pci = WinSendMsg(hwnd, CM_SEARCHSTRING, MPFROMP(&srch),
 | 
|---|
 | 1247 |                          MPFROMLONG(CMA_FIRST));
 | 
|---|
| [444] | 1248 |         if (pci && (INT) pci != -1) {
 | 
|---|
| [194] | 1249 |           USHORT attrib = CRA_CURSORED;
 | 
|---|
| [2] | 1250 | 
 | 
|---|
| [1673] | 1251 |           // make found item current item
 | 
|---|
| [551] | 1252 |           if (!stricmp(pci->pszFileName, dcd->szCommonName))
 | 
|---|
| [194] | 1253 |             attrib |= CRA_SELECTED;
 | 
|---|
 | 1254 |           WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPFROMP(pci),
 | 
|---|
 | 1255 |                      MPFROM2SHORT(TRUE, attrib));
 | 
|---|
| [1673] | 1256 |           // make sure that record shows in viewport
 | 
|---|
| [194] | 1257 |           ShowCnrRecord(hwnd, (PMINIRECORDCORE) pci);
 | 
|---|
 | 1258 |           return (MRESULT) TRUE;
 | 
|---|
 | 1259 |         }
 | 
|---|
| [444] | 1260 |         else {
 | 
|---|
 | 1261 |           if (SHORT1FROMMP(mp2) == ' ') {
 | 
|---|
| [551] | 1262 |             dcd->szCommonName[len] = 0;
 | 
|---|
| [194] | 1263 |             break;
 | 
|---|
 | 1264 |           }
 | 
|---|
| [551] | 1265 |           *dcd->szCommonName = 0;
 | 
|---|
 | 1266 |           dcd->lasttime = 0;
 | 
|---|
| [194] | 1267 |           if (len)                      // retry as first letter if no match
 | 
|---|
| [2] | 1268 | 
 | 
|---|
| [194] | 1269 |             goto KbdRetry;
 | 
|---|
 | 1270 |         }
 | 
|---|
 | 1271 |         break;
 | 
|---|
| [2] | 1272 |       }
 | 
|---|
| [194] | 1273 |     }
 | 
|---|
 | 1274 |     break;
 | 
|---|
| [2] | 1275 | 
 | 
|---|
| [194] | 1276 |   case WM_MOUSEMOVE:
 | 
|---|
 | 1277 |   case WM_BUTTON1UP:
 | 
|---|
 | 1278 |   case WM_BUTTON2UP:
 | 
|---|
 | 1279 |   case WM_BUTTON3UP:
 | 
|---|
 | 1280 |   case WM_CHORD:
 | 
|---|
 | 1281 |     shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL));
 | 
|---|
 | 1282 |     break;
 | 
|---|
| [2] | 1283 | 
 | 
|---|
| [194] | 1284 |   case WM_BUTTON1MOTIONEND:
 | 
|---|
 | 1285 |     {
 | 
|---|
 | 1286 |       CNRINFO cnri;
 | 
|---|
 | 1287 | 
 | 
|---|
 | 1288 |       memset(&cnri, 0, sizeof(CNRINFO));
 | 
|---|
 | 1289 |       cnri.cb = sizeof(CNRINFO);
 | 
|---|
 | 1290 |       if (WinSendMsg(hwnd, CM_QUERYCNRINFO, MPFROMP(&cnri),
 | 
|---|
| [551] | 1291 |                      MPFROMLONG(sizeof(CNRINFO)))) {
 | 
|---|
| [194] | 1292 |         if (cnri.flWindowAttr & CV_DETAIL)
 | 
|---|
 | 1293 |           PrfWriteProfileData(fmprof, appname, "CollectorCnrSplitBar",
 | 
|---|
 | 1294 |                               (PVOID) & cnri.xVertSplitbar, sizeof(LONG));
 | 
|---|
| [2] | 1295 |       }
 | 
|---|
| [194] | 1296 |     }
 | 
|---|
 | 1297 |     break;
 | 
|---|
| [2] | 1298 | 
 | 
|---|
| [194] | 1299 |   case WM_PRESPARAMCHANGED:
 | 
|---|
| [1400] | 1300 |     PresParamChanged(hwnd, PCSZ_COLLECTOR, mp1, mp2);
 | 
|---|
| [194] | 1301 |     break;
 | 
|---|
| [2] | 1302 | 
 | 
|---|
| [194] | 1303 |   case UM_COMPARE:
 | 
|---|
| [444] | 1304 |     if (dcd && mp1 && mp2) {
 | 
|---|
| [194] | 1305 |       COMPARE *cmp;
 | 
|---|
| [1009] | 1306 |       CHAR *leftdir = (CHAR *)mp1, *rightdir = (CHAR *)mp2;
 | 
|---|
| [2] | 1307 | 
 | 
|---|
| [444] | 1308 |       if (!IsFile(leftdir) && !IsFile(rightdir)) {
 | 
|---|
| [551] | 1309 |         cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__);
 | 
|---|
| [444] | 1310 |         if (cmp) {
 | 
|---|
| [551] | 1311 |           cmp->size = sizeof(COMPARE);
 | 
|---|
 | 1312 |           strcpy(cmp->leftdir, leftdir);
 | 
|---|
 | 1313 |           strcpy(cmp->rightdir, rightdir);
 | 
|---|
 | 1314 |           cmp->hwndParent = dcd->hwndParent;
 | 
|---|
 | 1315 |           cmp->dcd.hwndParent = dcd->hwndParent;
 | 
|---|
| [194] | 1316 |           WinDlgBox(HWND_DESKTOP, HWND_DESKTOP, CompareDlgProc,
 | 
|---|
 | 1317 |                     FM3ModHandle, COMP_FRAME, MPFROMP(cmp));
 | 
|---|
 | 1318 |         }
 | 
|---|
| [2] | 1319 |       }
 | 
|---|
| [194] | 1320 |     }
 | 
|---|
 | 1321 |     return 0;
 | 
|---|
| [2] | 1322 | 
 | 
|---|
| [194] | 1323 |   case UM_UPDATERECORDLIST:
 | 
|---|
 | 1324 |     if (dcd && mp1)
 | 
|---|
| [551] | 1325 |       WinSendMsg(dcd->hwndObject, msg, mp1, mp2);
 | 
|---|
| [194] | 1326 |     return 0;
 | 
|---|
| [2] | 1327 | 
 | 
|---|
| [194] | 1328 |   case UM_UPDATERECORD:
 | 
|---|
| [444] | 1329 |     if (dcd && mp1) {
 | 
|---|
| [194] | 1330 |       CHAR *filename;
 | 
|---|
| [2] | 1331 | 
 | 
|---|
| [194] | 1332 |       filename = mp1;
 | 
|---|
 | 1333 |       if (filename)
 | 
|---|
 | 1334 |         UpdateCnrRecord(hwnd, filename, TRUE, dcd);
 | 
|---|
 | 1335 |     }
 | 
|---|
 | 1336 |     return 0;
 | 
|---|
| [2] | 1337 | 
 | 
|---|
| [194] | 1338 |   case WM_SETFOCUS:
 | 
|---|
| [1673] | 1339 |     // put name of our window on status line
 | 
|---|
| [444] | 1340 |     if (dcd && hwndStatus && mp2) {
 | 
|---|
| [194] | 1341 |       PCNRITEM pci = NULL;
 | 
|---|
| [2] | 1342 | 
 | 
|---|
| [444] | 1343 |       if (fAutoView && hwndMain) {
 | 
|---|
| [194] | 1344 |         pci = WinSendMsg(hwnd,
 | 
|---|
 | 1345 |                          CM_QUERYRECORDEMPHASIS,
 | 
|---|
| [551] | 1346 |                          MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
 | 
|---|
| [194] | 1347 |         if (pci && (INT) pci != -1 &&
 | 
|---|
| [730] | 1348 |             (!(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW)))
 | 
|---|
 | 1349 |           WinSendMsg(hwndMain, UM_LOADFILE, MPFROMP(pci->pszFileName), MPVOID);
 | 
|---|
| [194] | 1350 |         else
 | 
|---|
| [551] | 1351 |           WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
 | 
|---|
| [2] | 1352 |       }
 | 
|---|
| [551] | 1353 |       if (dcd->amextracted)
 | 
|---|
| [1498] | 1354 |         WinSetWindowText(hwndStatus2, (CHAR *) GetPString(IDS_INSEEKSCANTEXT)); // Say working
 | 
|---|
| [551] | 1355 |       WinSendMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
 | 
|---|
| [194] | 1356 |     }
 | 
|---|
 | 1357 |     break;
 | 
|---|
| [2] | 1358 | 
 | 
|---|
| [194] | 1359 |   case UM_RESCAN:
 | 
|---|
| [444] | 1360 |     if (dcd) {
 | 
|---|
| [194] | 1361 |       CNRINFO cnri;
 | 
|---|
| [1397] | 1362 |       CHAR s[CCHMAXPATH + 69], tb[81], tf[81], szDate[DATE_BUF_BYTES] *p;
 | 
|---|
| [194] | 1363 |       PCNRITEM pci = NULL;
 | 
|---|
| [2] | 1364 | 
 | 
|---|
| [194] | 1365 |       memset(&cnri, 0, sizeof(CNRINFO));
 | 
|---|
 | 1366 |       cnri.cb = sizeof(CNRINFO);
 | 
|---|
 | 1367 |       WinSendMsg(hwnd, CM_QUERYCNRINFO, MPFROMP(&cnri),
 | 
|---|
 | 1368 |                  MPFROMLONG(sizeof(CNRINFO)));
 | 
|---|
| [551] | 1369 |       dcd->totalfiles = cnri.cRecords;
 | 
|---|
 | 1370 |       commafmt(tf, sizeof(tf), dcd->totalfiles);
 | 
|---|
 | 1371 |       CommaFmtULL(tb, sizeof(tb), dcd->ullTotalBytes, ' ');
 | 
|---|
| [194] | 1372 |       sprintf(s, "%s / %s", tf, tb);
 | 
|---|
| [551] | 1373 |       WinSetDlgItemText(dcd->hwndClient, DIR_TOTALS, s);
 | 
|---|
| [2] | 1374 | 
 | 
|---|
| [551] | 1375 |       commafmt(tf, sizeof(tf), dcd->selectedfiles);
 | 
|---|
 | 1376 |       CommaFmtULL(tb, sizeof(tb), dcd->selectedbytes, ' ');
 | 
|---|
| [194] | 1377 |       sprintf(s, "%s / %s", tf, tb);
 | 
|---|
| [551] | 1378 |       WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, s);
 | 
|---|
| [155] | 1379 | 
 | 
|---|
| [194] | 1380 |       if (hwndStatus &&
 | 
|---|
| [551] | 1381 |           dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
 | 
|---|
| [444] | 1382 |         if (hwndMain) {
 | 
|---|
| [194] | 1383 |           pci = WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
 | 
|---|
| [551] | 1384 |                            MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
 | 
|---|
| [194] | 1385 |           if (pci && (INT) pci != -1)
 | 
|---|
| [730] | 1386 |             PostMsg(hwndMain, UM_LOADFILE, MPFROMP(pci->pszFileName), MPVOID);
 | 
|---|
| [194] | 1387 |           else
 | 
|---|
 | 1388 |             PostMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
 | 
|---|
 | 1389 |         }
 | 
|---|
| [948] | 1390 |         if (!dcd->amextracted) {
 | 
|---|
 | 1391 |           if (!fMoreButtons) {
 | 
|---|
 | 1392 |             sprintf(s, " %s%s%s%s",
 | 
|---|
| [942] | 1393 |                     GetPString(IDS_COLLECTORTEXT),
 | 
|---|
| [948] | 1394 |                     *dcd->mask.szMask || dcd->mask.antiattr ||
 | 
|---|
 | 1395 |                       dcd->mask.attrFile != ALLATTRS ? "  (" : NullStr,
 | 
|---|
 | 1396 |                     *dcd->mask.szMask ?
 | 
|---|
 | 1397 |                       dcd->mask.szMask :
 | 
|---|
 | 1398 |                       dcd->mask.antiattr ||
 | 
|---|
 | 1399 |                        dcd->mask.attrFile != ALLATTRS ?
 | 
|---|
 | 1400 |                         GetPString(IDS_ATTRTEXT) : NullStr,
 | 
|---|
 | 1401 |                     *dcd->mask.szMask || dcd->mask.antiattr ||
 | 
|---|
 | 1402 |                       dcd->mask.attrFile != ALLATTRS ?
 | 
|---|
 | 1403 |                       ")" : NullStr);
 | 
|---|
 | 1404 |           }
 | 
|---|
 | 1405 |           else
 | 
|---|
 | 1406 |             strcpy(s, GetPString(IDS_COLLECTORTEXT));
 | 
|---|
 | 1407 |           WinSetWindowText(hwndStatus, s);
 | 
|---|
| [942] | 1408 |         }
 | 
|---|
| [194] | 1409 |         if (!pci)
 | 
|---|
 | 1410 |           pci = WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
 | 
|---|
| [551] | 1411 |                            MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
 | 
|---|
| [444] | 1412 |         if (pci && (INT) pci != -1) {
 | 
|---|
| [280] | 1413 |           BOOL fStatus2Used = FALSE;
 | 
|---|
| [551] | 1414 | 
 | 
|---|
| [444] | 1415 |           if (fSplitStatus && hwndStatus2) {
 | 
|---|
| [551] | 1416 |             if (pci->attrFile & FILE_DIRECTORY)
 | 
|---|
 | 1417 |               p = pci->pszFileName;
 | 
|---|
| [444] | 1418 |             else {
 | 
|---|
| [1611] | 1419 |               if (!pci->pszFileName)
 | 
|---|
 | 1420 |                 Runtime_Error(pszSrcFile, __LINE__, "pci->pszFileName NULL for %p", pci);
 | 
|---|
| [730] | 1421 |               p = strrchr(pci->pszFileName, '\\');
 | 
|---|
| [444] | 1422 |               if (p) {
 | 
|---|
| [194] | 1423 |                 if (*(p + 1))
 | 
|---|
 | 1424 |                   p++;
 | 
|---|
 | 1425 |                 else
 | 
|---|
| [551] | 1426 |                   p = pci->pszFileName;
 | 
|---|
| [155] | 1427 |               }
 | 
|---|
| [194] | 1428 |               else
 | 
|---|
| [551] | 1429 |                 p = pci->pszFileName;
 | 
|---|
| [194] | 1430 |             }
 | 
|---|
| [551] | 1431 |             CommaFmtULL(tb, sizeof(tb), pci->cbFile + pci->easize, ' ');
 | 
|---|
| [1456] | 1432 |             if (!fMoreButtons) {
 | 
|---|
 | 1433 |               DateFormat(szDate, pci->date);
 | 
|---|
| [1395] | 1434 |               sprintf(s, " %s  %s %02u%s%02u%s%02u  [%s]  %s",
 | 
|---|
 | 1435 |                       tb, szDate, pci->time.hours, TimeSeparator, pci->time.minutes,
 | 
|---|
 | 1436 |                       TimeSeparator, pci->time.seconds, pci->pszDispAttr, p);
 | 
|---|
| [194] | 1437 |             }
 | 
|---|
| [444] | 1438 |             else {
 | 
|---|
| [551] | 1439 |               if (pci->cbFile + pci->easize > 1024)
 | 
|---|
 | 1440 |                 CommaFmtULL(tf, sizeof(tf), pci->cbFile + pci->easize, 'K');
 | 
|---|
| [194] | 1441 |               else
 | 
|---|
 | 1442 |                 *tf = 0;
 | 
|---|
 | 1443 |               sprintf(s, GetPString(IDS_STATUSSIZETEXT),
 | 
|---|
| [551] | 1444 |                       tb, *tf ? " (" : NullStr, tf, *tf ? ")" : NullStr);
 | 
|---|
| [194] | 1445 |             }
 | 
|---|
 | 1446 |             WinSetWindowText(hwndStatus2, s);
 | 
|---|
| [280] | 1447 |             fStatus2Used = TRUE;
 | 
|---|
| [194] | 1448 |           }
 | 
|---|
| [444] | 1449 |           if (fMoreButtons) {
 | 
|---|
| [1456] | 1450 |             WinSetWindowText(hwndName, pci->pszFileName);
 | 
|---|
 | 1451 |             DateFormat(szDate, pci->date);
 | 
|---|
| [1395] | 1452 |             sprintf(s, "%s %02u%s%02u%s%02u",
 | 
|---|
 | 1453 |                     szDate, pci->time.hours, TimeSeparator, pci->time.minutes,
 | 
|---|
 | 1454 |                     TimeSeparator, pci->time.seconds);
 | 
|---|
| [194] | 1455 |             WinSetWindowText(hwndDate, s);
 | 
|---|
| [551] | 1456 |             WinSetWindowText(hwndAttr, pci->pszDispAttr);
 | 
|---|
| [194] | 1457 |           }
 | 
|---|
| [551] | 1458 |           if (dcd->amextracted && hwndStatus2 && !fStatus2Used)
 | 
|---|
| [1498] | 1459 |             WinSetWindowText(hwndStatus2, (CHAR *) GetPString(IDS_INSEEKSCANTEXT));     // Say working
 | 
|---|
| [194] | 1460 |         }
 | 
|---|
| [444] | 1461 |         else {
 | 
|---|
| [948] | 1462 |           if (hwndStatus2) {
 | 
|---|
 | 1463 |             if (dcd->amextracted)
 | 
|---|
| [1498] | 1464 |               WinSetWindowText(hwndStatus2, (CHAR *) GetPString(IDS_INSEEKSCANTEXT));   // Say working
 | 
|---|
| [948] | 1465 |             else
 | 
|---|
 | 1466 |               WinSetWindowText(hwndStatus2, NullStr);
 | 
|---|
 | 1467 |           }
 | 
|---|
| [444] | 1468 |           if (fMoreButtons) {
 | 
|---|
| [194] | 1469 |             WinSetWindowText(hwndName, NullStr);
 | 
|---|
 | 1470 |             WinSetWindowText(hwndDate, NullStr);
 | 
|---|
 | 1471 |             WinSetWindowText(hwndAttr, NullStr);
 | 
|---|
 | 1472 |           }
 | 
|---|
 | 1473 |         }
 | 
|---|
| [2] | 1474 |       }
 | 
|---|
| [194] | 1475 |     }
 | 
|---|
 | 1476 |     return 0;
 | 
|---|
| [2] | 1477 | 
 | 
|---|
| [194] | 1478 |   case UM_CONTAINER_FILLED:
 | 
|---|
| [1395] | 1479 |     if (!fAlertBeepOff)
 | 
|---|
| [1563] | 1480 |       DosBeep(1000, 50);                // Wake up user?
 | 
|---|
| [194] | 1481 |     WinSendMsg(hwnd,
 | 
|---|
 | 1482 |                CM_INVALIDATERECORD,
 | 
|---|
| [551] | 1483 |                MPVOID, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
 | 
|---|
| [471] | 1484 |     disable_menuitem(WinWindowFromID(WinQueryWindow(hwndMain, QW_PARENT),
 | 
|---|
| [1394] | 1485 |                                      FID_MENU), IDM_GREP, FALSE);
 | 
|---|
| [1366] | 1486 |     disable_menuitem(TreeMenu, IDM_GREP, FALSE);
 | 
|---|
 | 1487 |     disable_menuitem(DirMenu, IDM_GREP, FALSE);
 | 
|---|
| [551] | 1488 |     PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
 | 
|---|
| [444] | 1489 |     if (dcd) {
 | 
|---|
| [551] | 1490 |       dcd->stopflag = 0;
 | 
|---|
 | 1491 |       dcd->amextracted = FALSE;         // Say not busy
 | 
|---|
 | 1492 |       if (dcd->namecanchange) {
 | 
|---|
 | 1493 |         if (!PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID))
 | 
|---|
 | 1494 |           WinSendMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
 | 
|---|
| [2] | 1495 |       }
 | 
|---|
| [194] | 1496 |       else
 | 
|---|
 | 1497 |         WinSetWindowPos(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
 | 
|---|
 | 1498 |                                        QW_PARENT),
 | 
|---|
 | 1499 |                         HWND_TOP,
 | 
|---|
| [551] | 1500 |                         0, 0, 0, 0, SWP_SHOW | SWP_RESTORE | SWP_ZORDER);
 | 
|---|
| [194] | 1501 |     }
 | 
|---|
 | 1502 |     return 0;
 | 
|---|
| [2] | 1503 | 
 | 
|---|
| [194] | 1504 |   case UM_SETUP:
 | 
|---|
| [444] | 1505 |     if (dcd) {
 | 
|---|
| [551] | 1506 |       if (!dcd->hwndObject) {
 | 
|---|
| [1673] | 1507 |         // first time through -- set things up
 | 
|---|
| [2] | 1508 | 
 | 
|---|
| [194] | 1509 |         CNRINFO cnri;
 | 
|---|
| [2] | 1510 | 
 | 
|---|
| [1400] | 1511 |         RestorePresParams(hwnd, PCSZ_COLLECTOR);
 | 
|---|
| [1409] | 1512 |         LoadDetailsSwitches(PCSZ_COLLECTOR, &dcd->ds, FALSE);
 | 
|---|
| [471] | 1513 | 
 | 
|---|
| [551] | 1514 |         dcd->amextracted = FALSE;       // Say not busy
 | 
|---|
 | 1515 |         dcd->stopflag = 0;
 | 
|---|
| [194] | 1516 |         memset(&cnri, 0, sizeof(CNRINFO));
 | 
|---|
 | 1517 |         cnri.cb = sizeof(CNRINFO);
 | 
|---|
 | 1518 |         WinSendMsg(hwnd, CM_QUERYCNRINFO, MPFROMP(&cnri),
 | 
|---|
 | 1519 |                    MPFROMLONG(sizeof(CNRINFO)));
 | 
|---|
 | 1520 |         cnri.cyLineSpacing = 0;
 | 
|---|
| [750] | 1521 |         cnri.cxTreeIndent = 12;
 | 
|---|
| [2] | 1522 | 
 | 
|---|
| [551] | 1523 |         cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT | CV_DETAIL));
 | 
|---|
| [194] | 1524 |         cnri.flWindowAttr |= (CV_NAME | CA_DETAILSVIEWTITLES |
 | 
|---|
 | 1525 |                               CV_MINI | CV_FLOW);
 | 
|---|
 | 1526 |         cnri.pSortRecord = (PVOID) SortCollectorCnr;
 | 
|---|
| [2] | 1527 | 
 | 
|---|
| [444] | 1528 |         size = sizeof(ULONG);
 | 
|---|
 | 1529 |         PrfQueryProfileData(fmprof, appname, "CollectorflWindowAttr",
 | 
|---|
 | 1530 |                             (PVOID) & cnri.flWindowAttr, &size);
 | 
|---|
 | 1531 |         size = sizeof(MASK);
 | 
|---|
 | 1532 |         if (PrfQueryProfileSize(fmprof, appname, "CollectorFilter", &size) &&
 | 
|---|
| [551] | 1533 |             size) {
 | 
|---|
 | 1534 |           PrfQueryProfileData(fmprof, appname, "CollectorFilter", &dcd->mask,
 | 
|---|
| [444] | 1535 |                               &size);
 | 
|---|
| [551] | 1536 |           SetMask(NULL, &dcd->mask);
 | 
|---|
| [194] | 1537 |         }
 | 
|---|
| [444] | 1538 |         else {
 | 
|---|
| [551] | 1539 |           dcd->mask.attrFile = (FILE_NORMAL | FILE_READONLY |
 | 
|---|
 | 1540 |                                 FILE_DIRECTORY | FILE_HIDDEN |
 | 
|---|
 | 1541 |                                 FILE_SYSTEM | FILE_ARCHIVED);
 | 
|---|
 | 1542 |           dcd->mask.antiattr = 0;
 | 
|---|
| [444] | 1543 |         }
 | 
|---|
 | 1544 | 
 | 
|---|
| [551] | 1545 |         *(dcd->mask.prompt) = 0;
 | 
|---|
| [444] | 1546 | 
 | 
|---|
| [194] | 1547 |         cnri.flWindowAttr |= CV_FLOW;
 | 
|---|
 | 1548 |         cnri.flWindowAttr &= (~(CA_MIXEDTARGETEMPH | CA_ORDEREDTARGETEMPH));
 | 
|---|
| [551] | 1549 |         dcd->flWindowAttr = cnri.flWindowAttr;
 | 
|---|
| [194] | 1550 |         WinSendMsg(hwnd, CM_SETCNRINFO, MPFROMP(&cnri),
 | 
|---|
 | 1551 |                    MPFROMLONG(CMA_FLWINDOWATTR | CMA_LINESPACING |
 | 
|---|
 | 1552 |                               CMA_CXTREEINDENT | CMA_PSORTRECORD));
 | 
|---|
 | 1553 |         SetCnrCols(hwnd, FALSE);
 | 
|---|
| [1065] | 1554 |         AdjustCnrColsForPref(hwnd, NULL, &dcd->ds, FALSE);
 | 
|---|
| [2] | 1555 | 
 | 
|---|
| [1673] | 1556 |         // fix splitbar for collector container
 | 
|---|
| [197] | 1557 |         cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 32;
 | 
|---|
 | 1558 |         size = sizeof(LONG);
 | 
|---|
 | 1559 |         PrfQueryProfileData(fmprof, appname, "CollectorCnrSplitBar",
 | 
|---|
 | 1560 |                             &cnri.xVertSplitbar, &size);
 | 
|---|
 | 1561 |         if (cnri.xVertSplitbar <= 0)
 | 
|---|
| [194] | 1562 |           cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET - 32;
 | 
|---|
| [197] | 1563 |         WinSendMsg(hwnd, CM_SETCNRINFO, MPFROMP(&cnri),
 | 
|---|
 | 1564 |                    MPFROMLONG(CMA_XVERTSPLITBAR));
 | 
|---|
 | 1565 | 
 | 
|---|
| [1335] | 1566 |         if (xbeginthread(MakeObjWin,
 | 
|---|
 | 1567 |                          245760,
 | 
|---|
 | 1568 |                          dcd,
 | 
|---|
 | 1569 |                          pszSrcFile,
 | 
|---|
 | 1570 |                          __LINE__) == -1)
 | 
|---|
 | 1571 |         {
 | 
|---|
| [551] | 1572 |           Runtime_Error(pszSrcFile, __LINE__,
 | 
|---|
 | 1573 |                         GetPString(IDS_COULDNTSTARTTHREADTEXT));
 | 
|---|
| [194] | 1574 |           PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
 | 
|---|
 | 1575 |           return 0;
 | 
|---|
 | 1576 |         }
 | 
|---|
 | 1577 |         else
 | 
|---|
| [1563] | 1578 |           DosSleep(32);                 // Let object window get started
 | 
|---|
| [2] | 1579 |       }
 | 
|---|
| [194] | 1580 |       SayFilter(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
 | 
|---|
| [551] | 1581 |                                 DIR_FILTER), &dcd->mask, FALSE);
 | 
|---|
| [194] | 1582 |       SaySort(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
 | 
|---|
 | 1583 |                               DIR_SORT), CollectorsortFlags, FALSE);
 | 
|---|
 | 1584 |       SayView(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
 | 
|---|
| [551] | 1585 |                               DIR_VIEW), dcd->flWindowAttr);
 | 
|---|
| [194] | 1586 |     }
 | 
|---|
| [444] | 1587 |     else {
 | 
|---|
| [194] | 1588 |       PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
 | 
|---|
| [2] | 1589 |       return 0;
 | 
|---|
| [194] | 1590 |     }
 | 
|---|
 | 1591 |     return 0;
 | 
|---|
| [2] | 1592 | 
 | 
|---|
| [194] | 1593 |   case WM_MENUEND:
 | 
|---|
| [444] | 1594 |     if (dcd) {
 | 
|---|
| [551] | 1595 |       HWND hwndMenu = (HWND) mp2;
 | 
|---|
| [2] | 1596 | 
 | 
|---|
| [194] | 1597 |       if (hwndMenu == CollectorCnrMenu || hwndMenu == CollectorFileMenu ||
 | 
|---|
| [551] | 1598 |           hwndMenu == CollectorDirMenu) {
 | 
|---|
| [194] | 1599 |         MarkAll(hwnd, TRUE, FALSE, TRUE);
 | 
|---|
| [551] | 1600 |         if (dcd->cnremphasized) {
 | 
|---|
| [194] | 1601 |           WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
 | 
|---|
 | 1602 |                      MPFROM2SHORT(FALSE, CRA_SOURCE));
 | 
|---|
| [551] | 1603 |           dcd->cnremphasized = FALSE;
 | 
|---|
| [194] | 1604 |         }
 | 
|---|
| [2] | 1605 |       }
 | 
|---|
| [194] | 1606 |     }
 | 
|---|
 | 1607 |     break;
 | 
|---|
| [2] | 1608 | 
 | 
|---|
| [194] | 1609 |   case UM_OPENWINDOWFORME:
 | 
|---|
| [444] | 1610 |     if (dcd) {
 | 
|---|
| [1009] | 1611 |       if (mp1 && !IsFile((CHAR *)mp1))
 | 
|---|
| [551] | 1612 |         OpenDirCnr(HWND_DESKTOP, hwndMain, dcd->hwndFrame, FALSE, (PSZ) mp1);
 | 
|---|
| [1120] | 1613 |       else if (mp1 && IsFile(mp1) == 1 &&
 | 
|---|
| [1335] | 1614 |                CheckDriveSpaceAvail(ArcTempRoot, ullDATFileSpaceNeeded, ullTmpSpaceNeeded) != 2)
 | 
|---|
| [194] | 1615 |         StartArcCnr(HWND_DESKTOP,
 | 
|---|
| [1009] | 1616 |                     dcd->hwndFrame, (CHAR *)mp1, 4, (ARC_TYPE *) mp2);
 | 
|---|
| [194] | 1617 |     }
 | 
|---|
 | 1618 |     return 0;
 | 
|---|
| [2] | 1619 | 
 | 
|---|
| [194] | 1620 |   case MM_PORTHOLEINIT:
 | 
|---|
| [444] | 1621 |     if (dcd) {
 | 
|---|
 | 1622 |       switch (SHORT1FROMMP(mp1)) {
 | 
|---|
| [194] | 1623 |       case 0:
 | 
|---|
 | 1624 |       case 1:
 | 
|---|
 | 1625 |         {
 | 
|---|
 | 1626 |           ULONG wmsg;
 | 
|---|
| [2] | 1627 | 
 | 
|---|
| [194] | 1628 |           wmsg = (SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU;
 | 
|---|
| [551] | 1629 |           PortholeInit((HWND) WinSendMsg(dcd->hwndClient, wmsg, MPVOID,
 | 
|---|
| [194] | 1630 |                                          MPVOID), mp1, mp2);
 | 
|---|
 | 1631 |         }
 | 
|---|
 | 1632 |         break;
 | 
|---|
| [2] | 1633 |       }
 | 
|---|
| [194] | 1634 |     }
 | 
|---|
 | 1635 |     break;
 | 
|---|
| [2] | 1636 | 
 | 
|---|
| [194] | 1637 |   case UM_INITMENU:
 | 
|---|
 | 1638 |   case WM_INITMENU:
 | 
|---|
| [444] | 1639 |     if (dcd) {
 | 
|---|
 | 1640 |       switch (SHORT1FROMMP(mp1)) {
 | 
|---|
| [194] | 1641 |       case IDM_VIEWSMENU:
 | 
|---|
| [551] | 1642 |         SetViewMenu((HWND) mp2, dcd->flWindowAttr);
 | 
|---|
 | 1643 |         WinEnableMenuItem((HWND) mp2, IDM_RESELECT,
 | 
|---|
| [907] | 1644 |                           (dcd->lastselection != NULL));
 | 
|---|
 | 1645 |         CopyPresParams((HWND) mp2, hwnd);
 | 
|---|
| [194] | 1646 |         break;
 | 
|---|
| [2] | 1647 | 
 | 
|---|
| [194] | 1648 |       case IDM_DETAILSSETUP:
 | 
|---|
| [1065] | 1649 |         SetDetailsSwitches((HWND) mp2, &dcd->ds);
 | 
|---|
| [194] | 1650 |         break;
 | 
|---|
| [2] | 1651 | 
 | 
|---|
| [194] | 1652 |       case IDM_COMMANDSMENU:
 | 
|---|
| [551] | 1653 |         SetupCommandMenu((HWND) mp2, hwnd);
 | 
|---|
| [194] | 1654 |         break;
 | 
|---|
| [2] | 1655 | 
 | 
|---|
| [194] | 1656 |       case IDM_SORTSUBMENU:
 | 
|---|
| [551] | 1657 |         SetSortChecks((HWND) mp2, CollectorsortFlags);
 | 
|---|
| [194] | 1658 |         break;
 | 
|---|
| [2] | 1659 |       }
 | 
|---|
| [551] | 1660 |       dcd->hwndLastMenu = (HWND) mp2;
 | 
|---|
| [194] | 1661 |     }
 | 
|---|
 | 1662 |     if (msg == WM_INITMENU)
 | 
|---|
 | 1663 |       break;
 | 
|---|
 | 1664 |     return 0;
 | 
|---|
| [2] | 1665 | 
 | 
|---|
| [194] | 1666 |   case UM_COLLECTFROMFILE:
 | 
|---|
| [444] | 1667 |     if (mp1) {
 | 
|---|
| [1077] | 1668 | #     ifdef FORTIFY
 | 
|---|
 | 1669 |       Fortify_EnterScope();
 | 
|---|
| [1078] | 1670 |       Fortify_BecomeOwner(mp1);
 | 
|---|
| [1077] | 1671 | #     endif
 | 
|---|
| [1442] | 1672 |       if (!dcd) {
 | 
|---|
| [1563] | 1673 |         Runtime_Error(pszSrcFile, __LINE__, NULL);
 | 
|---|
 | 1674 |         free(mp1);
 | 
|---|
| [1442] | 1675 |       }
 | 
|---|
| [444] | 1676 |       else {
 | 
|---|
| [551] | 1677 |         if (!PostMsg(dcd->hwndObject, UM_COLLECTFROMFILE, mp1, mp2)) {
 | 
|---|
| [1563] | 1678 |           Runtime_Error(pszSrcFile, __LINE__, PCSZ_POSTMSG);
 | 
|---|
 | 1679 |           free(mp1);
 | 
|---|
| [194] | 1680 |         }
 | 
|---|
| [2] | 1681 |       }
 | 
|---|
| [1077] | 1682 | #     ifdef FORTIFY
 | 
|---|
 | 1683 |       DosSleep(1);                      // Let receiver take ownership
 | 
|---|
 | 1684 |       Fortify_LeaveScope();
 | 
|---|
 | 1685 | #     endif
 | 
|---|
| [194] | 1686 |     }
 | 
|---|
 | 1687 |     return 0;
 | 
|---|
| [2] | 1688 | 
 | 
|---|
| [194] | 1689 |   case UM_COMMAND:
 | 
|---|
| [444] | 1690 |     if (mp1) {
 | 
|---|
 | 1691 |       if (dcd) {
 | 
|---|
| [551] | 1692 |         if (!PostMsg(dcd->hwndObject, UM_COMMAND, mp1, mp2)) {
 | 
|---|
| [1400] | 1693 |           Runtime_Error(pszSrcFile, __LINE__, PCSZ_POSTMSG);
 | 
|---|
| [194] | 1694 |           FreeListInfo((LISTINFO *) mp1);
 | 
|---|
 | 1695 |         }
 | 
|---|
 | 1696 |         else
 | 
|---|
 | 1697 |           return (MRESULT) TRUE;
 | 
|---|
| [2] | 1698 |       }
 | 
|---|
| [194] | 1699 |       else
 | 
|---|
 | 1700 |         FreeListInfo((LISTINFO *) mp1);
 | 
|---|
 | 1701 |     }
 | 
|---|
 | 1702 |     return 0;
 | 
|---|
| [2] | 1703 | 
 | 
|---|
| [194] | 1704 |   case UM_NOTIFY:
 | 
|---|
 | 1705 |     if (mp2)
 | 
|---|
| [1009] | 1706 |       AddNote((CHAR *)mp2);
 | 
|---|
| [194] | 1707 |     return 0;
 | 
|---|
| [2] | 1708 | 
 | 
|---|
| [194] | 1709 |   case WM_COMMAND:
 | 
|---|
 | 1710 |     DosError(FERR_DISABLEHARDERR);
 | 
|---|
| [444] | 1711 |     if (dcd) {
 | 
|---|
 | 1712 |       switch (SHORT1FROMMP(mp1)) {
 | 
|---|
| [194] | 1713 |       case IDM_SETTARGET:
 | 
|---|
| [1702] | 1714 |         SetTargetDir(hwnd, FALSE, NULL);
 | 
|---|
| [194] | 1715 |         break;
 | 
|---|
| [2] | 1716 | 
 | 
|---|
| [194] | 1717 |       case IDM_CONTEXTMENU:
 | 
|---|
 | 1718 |         {
 | 
|---|
 | 1719 |           PCNRITEM pci;
 | 
|---|
| [2] | 1720 | 
 | 
|---|
| [194] | 1721 |           pci = (PCNRITEM) CurrentRecord(hwnd);
 | 
|---|
 | 1722 |           PostMsg(hwnd, WM_CONTROL, MPFROM2SHORT(COLLECTOR_CNR,
 | 
|---|
| [551] | 1723 |                                                  CN_CONTEXTMENU),
 | 
|---|
 | 1724 |                   MPFROMP(pci));
 | 
|---|
| [194] | 1725 |         }
 | 
|---|
 | 1726 |         break;
 | 
|---|
| [2] | 1727 | 
 | 
|---|
| [194] | 1728 |       case IDM_SHOWALLFILES:
 | 
|---|
 | 1729 |         {
 | 
|---|
 | 1730 |           PCNRITEM pci;
 | 
|---|
| [2] | 1731 | 
 | 
|---|
| [471] | 1732 |           pci = WinSendMsg(hwnd,
 | 
|---|
 | 1733 |                            CM_QUERYRECORDEMPHASIS,
 | 
|---|
| [551] | 1734 |                            MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
 | 
|---|
| [444] | 1735 |           if (pci && (INT) pci != -1) {
 | 
|---|
| [194] | 1736 |             static CHAR dirname[CCHMAXPATH];
 | 
|---|
| [2] | 1737 | 
 | 
|---|
| [730] | 1738 |             strcpy(dirname, pci->pszFileName);
 | 
|---|
| [194] | 1739 |             MakeValidDir(dirname);
 | 
|---|
 | 1740 |             StartSeeAll(HWND_DESKTOP, FALSE, dirname);
 | 
|---|
 | 1741 |           }
 | 
|---|
 | 1742 |         }
 | 
|---|
 | 1743 |         break;
 | 
|---|
| [2] | 1744 | 
 | 
|---|
| [194] | 1745 |       case IDM_BEGINEDIT:
 | 
|---|
 | 1746 |         OpenEdit(hwnd);
 | 
|---|
 | 1747 |         break;
 | 
|---|
| [2] | 1748 | 
 | 
|---|
| [194] | 1749 |       case IDM_ENDEDIT:
 | 
|---|
 | 1750 |         WinSendMsg(hwnd, CM_CLOSEEDIT, MPVOID, MPVOID);
 | 
|---|
 | 1751 |         break;
 | 
|---|
| [2] | 1752 | 
 | 
|---|
| [194] | 1753 |       case IDM_SHOWSELECT:
 | 
|---|
| [551] | 1754 |         QuickPopup(hwnd, dcd,
 | 
|---|
| [872] | 1755 |                    CheckMenu(hwnd, &CollectorCnrMenu, COLLECTORCNR_POPUP),
 | 
|---|
| [194] | 1756 |                    IDM_SELECTSUBMENU);
 | 
|---|
 | 1757 |         break;
 | 
|---|
| [2] | 1758 | 
 | 
|---|
| [194] | 1759 |       case IDM_SHOWSORT:
 | 
|---|
| [551] | 1760 |         QuickPopup(hwnd, dcd,
 | 
|---|
| [872] | 1761 |                    CheckMenu(hwnd, &CollectorCnrMenu, COLLECTORCNR_POPUP),
 | 
|---|
| [194] | 1762 |                    IDM_SORTSUBMENU);
 | 
|---|
 | 1763 |         break;
 | 
|---|
| [2] | 1764 | 
 | 
|---|
| [194] | 1765 |       case IDM_VIEWORARC:
 | 
|---|
 | 1766 |         {
 | 
|---|
 | 1767 |           SWP swp;
 | 
|---|
 | 1768 |           PCNRITEM pci;
 | 
|---|
| [2] | 1769 | 
 | 
|---|
| [194] | 1770 |           pci = (PCNRITEM) WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
 | 
|---|
 | 1771 |                                       MPFROMLONG(CMA_FIRST),
 | 
|---|
 | 1772 |                                       MPFROMSHORT(CRA_CURSORED));
 | 
|---|
| [444] | 1773 |           if (pci && (INT) pci != -1) {
 | 
|---|
| [551] | 1774 |             WinQueryWindowPos(dcd->hwndFrame, &swp);
 | 
|---|
 | 1775 |             DefaultViewKeys(hwnd, dcd->hwndFrame, dcd->hwndParent, &swp,
 | 
|---|
| [730] | 1776 |                             pci->pszFileName);
 | 
|---|
| [194] | 1777 |           }
 | 
|---|
 | 1778 |         }
 | 
|---|
 | 1779 |         break;
 | 
|---|
| [2] | 1780 | 
 | 
|---|
| [194] | 1781 |       case IDM_SEEALL:
 | 
|---|
| [551] | 1782 |         StartSeeAll(HWND_DESKTOP, FALSE, NULL);
 | 
|---|
| [194] | 1783 |         break;
 | 
|---|
| [2] | 1784 | 
 | 
|---|
| [194] | 1785 |       case IDM_COLLECTSELECT:
 | 
|---|
 | 1786 |         {
 | 
|---|
 | 1787 |           CHAR filename[CCHMAXPATH], *p, *pp;
 | 
|---|
| [2] | 1788 | 
 | 
|---|
| [1395] | 1789 |           strcpy(filename, PCSZ_STARDOTLST);
 | 
|---|
| [194] | 1790 |           size = CCHMAXPATH;
 | 
|---|
 | 1791 |           PrfQueryProfileData(fmprof, appname, "SaveToListName",
 | 
|---|
 | 1792 |                               filename, &size);
 | 
|---|
 | 1793 |           pp = strrchr(filename, '\\');
 | 
|---|
 | 1794 |           if (!pp)
 | 
|---|
 | 1795 |             pp = filename;
 | 
|---|
 | 1796 |           p = strrchr(pp, '.');
 | 
|---|
| [444] | 1797 |           if (p && *(p + 1) && p > pp + 1) {
 | 
|---|
| [194] | 1798 |             if (pp > filename)
 | 
|---|
 | 1799 |               pp++;
 | 
|---|
 | 1800 |             *pp = '*';
 | 
|---|
 | 1801 |             pp++;
 | 
|---|
 | 1802 |             if (p > pp)
 | 
|---|
 | 1803 |               memmove(pp, p, strlen(p) + 1);
 | 
|---|
 | 1804 |           }
 | 
|---|
| [444] | 1805 |           if (insert_filename(hwnd, filename, FALSE, FALSE)) {
 | 
|---|
| [1077] | 1806 | #           ifdef FORTIFY
 | 
|---|
 | 1807 |             Fortify_EnterScope();
 | 
|---|
 | 1808 | #           endif
 | 
|---|
| [551] | 1809 |             p = xstrdup(filename, pszSrcFile, __LINE__);
 | 
|---|
| [444] | 1810 |             if (p) {
 | 
|---|
| [194] | 1811 |               if (!PostMsg(hwnd, UM_COLLECTFROMFILE, MPFROMP(p), MPVOID))
 | 
|---|
| [1077] | 1812 |                 free(p);
 | 
|---|
| [194] | 1813 |             }
 | 
|---|
| [1077] | 1814 | #           ifdef FORTIFY
 | 
|---|
 | 1815 |             DosSleep(1);                // Let receiver take ownership
 | 
|---|
 | 1816 |             Fortify_LeaveScope();
 | 
|---|
 | 1817 | #           endif
 | 
|---|
| [194] | 1818 |           }
 | 
|---|
 | 1819 |         }
 | 
|---|
 | 1820 |         break;
 | 
|---|
| [2] | 1821 | 
 | 
|---|
| [953] | 1822 |       case IDM_COLLECTORVIEWSETTINGS:
 | 
|---|
| [551] | 1823 |         if (!ParentIsDesktop(dcd->hwndParent, dcd->hwndParent))
 | 
|---|
| [953] | 1824 |           PostMsg(dcd->hwndParent, msg, MPFROMLONG(IDM_COLLECTORVIEWSETTINGS), mp2);
 | 
|---|
| [917] | 1825 |         else {
 | 
|---|
 | 1826 |           WinDlgBox(HWND_DESKTOP,
 | 
|---|
 | 1827 |                     hwnd,
 | 
|---|
 | 1828 |                     CfgDlgProc,
 | 
|---|
 | 1829 |                     FM3ModHandle,
 | 
|---|
 | 1830 |                     CFG_FRAME,
 | 
|---|
| [953] | 1831 |                     MPFROMLONG(IDM_COLLECTORVIEWSETTINGS));
 | 
|---|
| [917] | 1832 |         }
 | 
|---|
| [194] | 1833 |         break;
 | 
|---|
| [2] | 1834 | 
 | 
|---|
| [194] | 1835 |       case IDM_RESELECT:
 | 
|---|
| [551] | 1836 |         SelectList(hwnd, FALSE, FALSE, FALSE, NULL, NULL, dcd->lastselection);
 | 
|---|
| [1563] | 1837 |         break;
 | 
|---|
| [1546] | 1838 | 
 | 
|---|
 | 1839 |       case IDM_WALKDIR:
 | 
|---|
| [1547] | 1840 |       case IDM_OPENDIRWINDOW:
 | 
|---|
 | 1841 |       case IDM_OPENDIRICON:
 | 
|---|
 | 1842 |       case IDM_OPENDIRDETAILS:
 | 
|---|
 | 1843 |       case IDM_OPENDIRTREE:
 | 
|---|
| [1546] | 1844 |         {
 | 
|---|
 | 1845 |           CHAR newpath[CCHMAXPATH];
 | 
|---|
 | 1846 |           PCNRITEM pci;
 | 
|---|
 | 1847 | 
 | 
|---|
 | 1848 |           pci = (PCNRITEM) CurrentRecord(hwnd);
 | 
|---|
 | 1849 |           if (pci && (INT) pci != -1) {
 | 
|---|
 | 1850 |             strcpy(newpath, pci->pszFileName);
 | 
|---|
 | 1851 |             MakeValidDir(newpath);
 | 
|---|
 | 1852 |           }
 | 
|---|
 | 1853 |           else
 | 
|---|
| [1563] | 1854 |             strcpy(newpath, pFM2SaveDirectory);
 | 
|---|
 | 1855 |           if (*newpath) {
 | 
|---|
 | 1856 |             switch (SHORT1FROMMP(mp1)) {
 | 
|---|
 | 1857 |             case IDM_WALKDIR:
 | 
|---|
 | 1858 |               WinDlgBox(HWND_DESKTOP, dcd->hwndParent, WalkAllDlgProc,
 | 
|---|
 | 1859 |                         FM3ModHandle, WALK_FRAME, MPFROMP(newpath));
 | 
|---|
 | 1860 |               break;
 | 
|---|
 | 1861 |             case IDM_OPENDIRWINDOW:
 | 
|---|
 | 1862 |               WinSendMsg(hwnd, UM_OPENWINDOWFORME, MPFROMP(newpath), MPVOID);
 | 
|---|
 | 1863 |               break;
 | 
|---|
 | 1864 |             case IDM_OPENDIRICON:
 | 
|---|
 | 1865 |               OpenObject(newpath, PCSZ_ICON, hwnd);
 | 
|---|
 | 1866 |               break;
 | 
|---|
 | 1867 |             case IDM_OPENDIRDETAILS:
 | 
|---|
 | 1868 |               OpenObject(newpath, Details, hwnd);
 | 
|---|
 | 1869 |               break;
 | 
|---|
 | 1870 |             case IDM_OPENDIRTREE:
 | 
|---|
 | 1871 |               OpenObject(newpath, PCSZ_TREE, hwnd);
 | 
|---|
 | 1872 |               break;
 | 
|---|
 | 1873 |             default:
 | 
|---|
 | 1874 |               break;
 | 
|---|
 | 1875 |             }
 | 
|---|
 | 1876 |           }
 | 
|---|
| [1546] | 1877 |         }
 | 
|---|
| [194] | 1878 |         break;
 | 
|---|
| [2] | 1879 | 
 | 
|---|
| [194] | 1880 |       case IDM_HELP:
 | 
|---|
 | 1881 |         if (hwndHelp)
 | 
|---|
 | 1882 |           WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
 | 
|---|
 | 1883 |                      MPFROM2SHORT(HELP_COLLECT, 0),
 | 
|---|
 | 1884 |                      MPFROMSHORT(HM_RESOURCEID));
 | 
|---|
 | 1885 |         break;
 | 
|---|
| [2] | 1886 | 
 | 
|---|
| [194] | 1887 |       case IDM_SORTNONE:
 | 
|---|
 | 1888 |       case IDM_SORTSMARTNAME:
 | 
|---|
 | 1889 |       case IDM_SORTNAME:
 | 
|---|
 | 1890 |       case IDM_SORTFILENAME:
 | 
|---|
 | 1891 |       case IDM_SORTSIZE:
 | 
|---|
 | 1892 |       case IDM_SORTEASIZE:
 | 
|---|
 | 1893 |       case IDM_SORTFIRST:
 | 
|---|
 | 1894 |       case IDM_SORTLAST:
 | 
|---|
 | 1895 |       case IDM_SORTLWDATE:
 | 
|---|
 | 1896 |       case IDM_SORTLADATE:
 | 
|---|
 | 1897 |       case IDM_SORTCRDATE:
 | 
|---|
 | 1898 |       case IDM_SORTSUBJECT:
 | 
|---|
| [197] | 1899 |         savedSortFlags = CollectorsortFlags;
 | 
|---|
| [194] | 1900 |         CollectorsortFlags &= (SORT_REVERSE | SORT_DIRSFIRST | SORT_DIRSLAST);
 | 
|---|
 | 1901 |       case IDM_SORTDIRSFIRST:
 | 
|---|
 | 1902 |       case IDM_SORTDIRSLAST:
 | 
|---|
 | 1903 |       case IDM_SORTREVERSE:
 | 
|---|
| [444] | 1904 |         switch (SHORT1FROMMP(mp1)) {
 | 
|---|
| [194] | 1905 |         case IDM_SORTSUBJECT:
 | 
|---|
 | 1906 |           CollectorsortFlags |= SORT_SUBJECT;
 | 
|---|
 | 1907 |           break;
 | 
|---|
 | 1908 |         case IDM_SORTNONE:
 | 
|---|
 | 1909 |           CollectorsortFlags |= SORT_NOSORT;
 | 
|---|
 | 1910 |           break;
 | 
|---|
 | 1911 |         case IDM_SORTSMARTNAME:
 | 
|---|
| [197] | 1912 |           if (~savedSortFlags & SORT_FILENAME)
 | 
|---|
| [194] | 1913 |             CollectorsortFlags |= SORT_FILENAME;
 | 
|---|
 | 1914 |           break;
 | 
|---|
 | 1915 |         case IDM_SORTFILENAME:
 | 
|---|
 | 1916 |           CollectorsortFlags |= SORT_FILENAME;
 | 
|---|
 | 1917 |           break;
 | 
|---|
 | 1918 |         case IDM_SORTSIZE:
 | 
|---|
 | 1919 |           CollectorsortFlags |= SORT_SIZE;
 | 
|---|
 | 1920 |           break;
 | 
|---|
 | 1921 |         case IDM_SORTEASIZE:
 | 
|---|
 | 1922 |           CollectorsortFlags |= SORT_EASIZE;
 | 
|---|
 | 1923 |           break;
 | 
|---|
 | 1924 |         case IDM_SORTFIRST:
 | 
|---|
 | 1925 |           CollectorsortFlags |= SORT_FIRSTEXTENSION;
 | 
|---|
 | 1926 |           break;
 | 
|---|
 | 1927 |         case IDM_SORTLAST:
 | 
|---|
 | 1928 |           CollectorsortFlags |= SORT_LASTEXTENSION;
 | 
|---|
 | 1929 |           break;
 | 
|---|
 | 1930 |         case IDM_SORTLWDATE:
 | 
|---|
 | 1931 |           CollectorsortFlags |= SORT_LWDATE;
 | 
|---|
 | 1932 |           break;
 | 
|---|
 | 1933 |         case IDM_SORTLADATE:
 | 
|---|
 | 1934 |           CollectorsortFlags |= SORT_LADATE;
 | 
|---|
 | 1935 |           break;
 | 
|---|
 | 1936 |         case IDM_SORTCRDATE:
 | 
|---|
 | 1937 |           CollectorsortFlags |= SORT_CRDATE;
 | 
|---|
 | 1938 |           break;
 | 
|---|
 | 1939 |         case IDM_SORTDIRSFIRST:
 | 
|---|
 | 1940 |           if (CollectorsortFlags & SORT_DIRSFIRST)
 | 
|---|
 | 1941 |             CollectorsortFlags &= (~SORT_DIRSFIRST);
 | 
|---|
| [444] | 1942 |           else {
 | 
|---|
| [194] | 1943 |             CollectorsortFlags |= SORT_DIRSFIRST;
 | 
|---|
 | 1944 |             CollectorsortFlags &= (~SORT_DIRSLAST);
 | 
|---|
 | 1945 |           }
 | 
|---|
 | 1946 |           break;
 | 
|---|
 | 1947 |         case IDM_SORTDIRSLAST:
 | 
|---|
 | 1948 |           if (CollectorsortFlags & SORT_DIRSLAST)
 | 
|---|
 | 1949 |             CollectorsortFlags &= (~SORT_DIRSLAST);
 | 
|---|
| [444] | 1950 |           else {
 | 
|---|
| [194] | 1951 |             CollectorsortFlags |= SORT_DIRSLAST;
 | 
|---|
 | 1952 |             CollectorsortFlags &= (~SORT_DIRSFIRST);
 | 
|---|
 | 1953 |           }
 | 
|---|
 | 1954 |           break;
 | 
|---|
 | 1955 |         case IDM_SORTREVERSE:
 | 
|---|
 | 1956 |           if (CollectorsortFlags & SORT_REVERSE)
 | 
|---|
 | 1957 |             CollectorsortFlags &= (~SORT_REVERSE);
 | 
|---|
 | 1958 |           else
 | 
|---|
 | 1959 |             CollectorsortFlags |= SORT_REVERSE;
 | 
|---|
 | 1960 |           break;
 | 
|---|
 | 1961 |         }
 | 
|---|
 | 1962 |         PrfWriteProfileData(fmprof, appname, "CollectorSort",
 | 
|---|
 | 1963 |                             &CollectorsortFlags, sizeof(INT));
 | 
|---|
 | 1964 |         WinSendMsg(hwnd, CM_SORTRECORD, MPFROMP(SortCollectorCnr), MPVOID);
 | 
|---|
 | 1965 |         SaySort(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
 | 
|---|
 | 1966 |                                 DIR_SORT), CollectorsortFlags, FALSE);
 | 
|---|
 | 1967 |         break;
 | 
|---|
| [2] | 1968 | 
 | 
|---|
| [194] | 1969 |       case IDM_COLLECTFROMCLIP:
 | 
|---|
 | 1970 |         {
 | 
|---|
 | 1971 |           LISTINFO *li;
 | 
|---|
| [1077] | 1972 | #         ifdef FORTIFY
 | 
|---|
 | 1973 |           Fortify_EnterScope();
 | 
|---|
 | 1974 | #         endif
 | 
|---|
| [551] | 1975 |           li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__);
 | 
|---|
| [444] | 1976 |           if (li) {
 | 
|---|
| [551] | 1977 |             li->list = ListFromClipboard(hwnd);
 | 
|---|
 | 1978 |             if (!li->list || !li->list[0])
 | 
|---|
| [194] | 1979 |               FreeListInfo(li);
 | 
|---|
| [444] | 1980 |             else {
 | 
|---|
| [551] | 1981 |               li->type = IDM_COLLECT;
 | 
|---|
 | 1982 |               if (!PostMsg(dcd->hwndObject, UM_COLLECT, MPFROMP(li), MPVOID))
 | 
|---|
| [194] | 1983 |                 FreeListInfo(li);
 | 
|---|
 | 1984 |             }
 | 
|---|
 | 1985 |           }
 | 
|---|
| [1077] | 1986 | #         ifdef FORTIFY
 | 
|---|
| [1563] | 1987 |           DosSleep(1);                  // Let receiver take ownership
 | 
|---|
| [1077] | 1988 |           Fortify_LeaveScope();
 | 
|---|
 | 1989 | #         endif
 | 
|---|
| [194] | 1990 |         }
 | 
|---|
 | 1991 |         break;
 | 
|---|
| [2] | 1992 | 
 | 
|---|
| [194] | 1993 |       case IDM_REMOVE:
 | 
|---|
| [551] | 1994 |         if (fAutoView && hwndMain)
 | 
|---|
 | 1995 |           PostMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
 | 
|---|
 | 1996 |         dcd->suspendview = 1;
 | 
|---|
 | 1997 |         RemoveAll(hwnd, &dcd->ullTotalBytes, &dcd->totalfiles);
 | 
|---|
 | 1998 |         dcd->suspendview = 0;
 | 
|---|
 | 1999 |         PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
 | 
|---|
| [194] | 2000 |         break;
 | 
|---|
| [2] | 2001 | 
 | 
|---|
| [194] | 2002 |       case IDM_CLEARCNR:
 | 
|---|
 | 2003 |         {
 | 
|---|
 | 2004 |           PCNRITEM pci;
 | 
|---|
| [2] | 2005 | 
 | 
|---|
| [194] | 2006 |           pci = (PCNRITEM) WinSendMsg(hwnd,
 | 
|---|
 | 2007 |                                       CM_QUERYRECORD,
 | 
|---|
 | 2008 |                                       MPVOID,
 | 
|---|
| [551] | 2009 |                                       MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
 | 
|---|
| [444] | 2010 |           if (pci && (INT) pci != -1) {
 | 
|---|
| [751] | 2011 |             RemoveCnrItems(hwnd, NULL, 0, CMA_FREE | CMA_INVALIDATE);
 | 
|---|
| [551] | 2012 |             dcd->ullTotalBytes = dcd->selectedbytes = dcd->selectedfiles =
 | 
|---|
| [750] | 2013 |               dcd->totalfiles = 0;
 | 
|---|
| [551] | 2014 |             PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
 | 
|---|
| [194] | 2015 |           }
 | 
|---|
 | 2016 |         }
 | 
|---|
 | 2017 |         break;
 | 
|---|
| [2] | 2018 | 
 | 
|---|
| [194] | 2019 |       case DID_CANCEL:
 | 
|---|
| [551] | 2020 |         if (dcd->amextracted)
 | 
|---|
 | 2021 |           dcd->stopflag = 1;            // Request cancel
 | 
|---|
| [194] | 2022 |         break;
 | 
|---|
| [2] | 2023 | 
 | 
|---|
| [194] | 2024 |       case IDM_COLLECTOR:
 | 
|---|
| [444] | 2025 |         if (mp2) {
 | 
|---|
| [194] | 2026 |           LISTINFO *li;
 | 
|---|
| [1077] | 2027 | #         ifdef FORTIFY
 | 
|---|
 | 2028 |           Fortify_EnterScope();
 | 
|---|
 | 2029 | #         endif
 | 
|---|
| [551] | 2030 |           li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__);
 | 
|---|
| [444] | 2031 |           if (li) {
 | 
|---|
| [551] | 2032 |             li->list = mp2;
 | 
|---|
 | 2033 |             if (!li->list || !li->list[0])
 | 
|---|
| [194] | 2034 |               FreeListInfo(li);
 | 
|---|
| [444] | 2035 |             else {
 | 
|---|
| [551] | 2036 |               li->type = IDM_COLLECT;
 | 
|---|
 | 2037 |               if (!PostMsg(dcd->hwndObject, UM_COLLECT, MPFROMP(li), MPVOID))
 | 
|---|
| [194] | 2038 |                 FreeListInfo(li);
 | 
|---|
 | 2039 |             }
 | 
|---|
 | 2040 |           }
 | 
|---|
 | 2041 |           else
 | 
|---|
 | 2042 |             FreeList(mp2);
 | 
|---|
| [1077] | 2043 | #         ifdef FORTIFY
 | 
|---|
 | 2044 |           DosSleep(1);                  // Let receiver take ownership
 | 
|---|
 | 2045 |           Fortify_LeaveScope();
 | 
|---|
 | 2046 | #         endif
 | 
|---|
| [194] | 2047 |         }
 | 
|---|
 | 2048 |         break;
 | 
|---|
| [2] | 2049 | 
 | 
|---|
| [194] | 2050 |       case IDM_UNDELETE:
 | 
|---|
| [1077] | 2051 |         {
 | 
|---|
| [194] | 2052 |           PCNRITEM pci;
 | 
|---|
| [1077] | 2053 |           CHAR path[CCHMAXPATH];
 | 
|---|
 | 2054 |           HOBJECT hObject;
 | 
|---|
 | 2055 |           HWND hwndDesktop;
 | 
|---|
| [2] | 2056 | 
 | 
|---|
| [1077] | 2057 |           hObject = WinQueryObject("<XWP_TRASHCAN>");
 | 
|---|
 | 2058 |           if (hObject != NULLHANDLE && fTrashCan) {
 | 
|---|
 | 2059 |             hwndDesktop = WinQueryDesktopWindow((HAB) 0, NULLHANDLE);
 | 
|---|
| [1041] | 2060 |             WinSetFocus(HWND_DESKTOP, hwndDesktop);
 | 
|---|
| [1077] | 2061 |             WinOpenObject(hObject, 0, TRUE);
 | 
|---|
| [194] | 2062 |           }
 | 
|---|
| [1077] | 2063 |           else {
 | 
|---|
 | 2064 |             pci = (PCNRITEM) CurrentRecord(hwnd);
 | 
|---|
 | 2065 |             if (pci && (INT) pci != -1) {
 | 
|---|
 | 2066 |               strcpy(path, pci->pszFileName);
 | 
|---|
 | 2067 |               MakeValidDir(path);
 | 
|---|
 | 2068 |               WinDlgBox(HWND_DESKTOP, hwnd, UndeleteDlgProc, FM3ModHandle,
 | 
|---|
 | 2069 |                         UNDEL_FRAME, MPFROMP(path));
 | 
|---|
 | 2070 |             }
 | 
|---|
 | 2071 |           }
 | 
|---|
| [194] | 2072 |         }
 | 
|---|
 | 2073 |         break;
 | 
|---|
| [2] | 2074 | 
 | 
|---|
| [194] | 2075 |       case IDM_GREP:
 | 
|---|
| [1456] | 2076 |       case UM_GREP:
 | 
|---|
| [724] | 2077 |         if (dcd->amextracted) {
 | 
|---|
 | 2078 |           saymsg(MB_OK | MB_ICONASTERISK,
 | 
|---|
 | 2079 |                  hwnd,
 | 
|---|
 | 2080 |                  GetPString(IDS_WARNINGTEXT),
 | 
|---|
 | 2081 |                  "Collector busy - please try again later");
 | 
|---|
 | 2082 |         }
 | 
|---|
| [1394] | 2083 |         else {
 | 
|---|
 | 2084 |           GREPINFO *GrepInfo;
 | 
|---|
| [1366] | 2085 | 
 | 
|---|
| [1394] | 2086 |           GrepInfo = xmallocz(sizeof(GREPINFO), pszSrcFile, __LINE__);
 | 
|---|
 | 2087 |           if (GrepInfo) {
 | 
|---|
 | 2088 |             GrepInfo->hwnd = &hwnd;
 | 
|---|
| [1456] | 2089 |             if (msg == UM_GREP && mp2)
 | 
|---|
| [1394] | 2090 |               GrepInfo->szGrepPath = mp2;
 | 
|---|
 | 2091 |             if (WinDlgBox(HWND_DESKTOP, hwnd, GrepDlgProc,
 | 
|---|
 | 2092 |                           FM3ModHandle, GREP_FRAME, (PVOID) GrepInfo)) {
 | 
|---|
 | 2093 |               free(GrepInfo);
 | 
|---|
 | 2094 |               dcd->amextracted = TRUE;  // Say busy scanning
 | 
|---|
 | 2095 |               disable_menuitem(WinWindowFromID
 | 
|---|
 | 2096 |                                (WinQueryWindow(hwndMain, QW_PARENT), FID_MENU),
 | 
|---|
 | 2097 |                                IDM_GREP, TRUE);
 | 
|---|
 | 2098 |               disable_menuitem(TreeMenu, IDM_GREP, TRUE);
 | 
|---|
 | 2099 |               disable_menuitem(DirMenu, IDM_GREP, TRUE);
 | 
|---|
 | 2100 |               PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
 | 
|---|
 | 2101 |             }
 | 
|---|
 | 2102 |             else
 | 
|---|
 | 2103 |               free(GrepInfo);
 | 
|---|
| [194] | 2104 |           }
 | 
|---|
 | 2105 |         }
 | 
|---|
 | 2106 |         break;
 | 
|---|
| [2] | 2107 | 
 | 
|---|
| [194] | 2108 |       case IDM_RESORT:
 | 
|---|
 | 2109 |         WinSendMsg(hwnd, CM_SORTRECORD, MPFROMP(SortCollectorCnr), MPVOID);
 | 
|---|
 | 2110 |         break;
 | 
|---|
| [2] | 2111 | 
 | 
|---|
| [194] | 2112 |       case IDM_FILTER:
 | 
|---|
 | 2113 |         {
 | 
|---|
 | 2114 |           BOOL empty = FALSE;
 | 
|---|
 | 2115 |           PCNRITEM pci;
 | 
|---|
 | 2116 |           CHAR *p;
 | 
|---|
| [2] | 2117 | 
 | 
|---|
| [551] | 2118 |           if (!*dcd->mask.szMask) {
 | 
|---|
| [194] | 2119 |             empty = TRUE;
 | 
|---|
| [1702] | 2120 |             // 2013-12-13 SHL Allow nul pszFileName
 | 
|---|
| [194] | 2121 |             pci = (PCNRITEM) CurrentRecord(hwnd);
 | 
|---|
| [1702] | 2122 |             if (pci && pci->pszFileName && ~pci->attrFile & FILE_DIRECTORY) {
 | 
|---|
| [730] | 2123 |               p = strrchr(pci->pszFileName, '\\');
 | 
|---|
| [444] | 2124 |               if (p) {
 | 
|---|
| [194] | 2125 |                 p++;
 | 
|---|
| [551] | 2126 |                 strcpy(dcd->mask.szMask, p);
 | 
|---|
| [194] | 2127 |               }
 | 
|---|
 | 2128 |             }
 | 
|---|
 | 2129 |           }
 | 
|---|
| [551] | 2130 |           *(dcd->mask.prompt) = 0;
 | 
|---|
| [2] | 2131 | 
 | 
|---|
| [194] | 2132 |           if (WinDlgBox(HWND_DESKTOP, hwnd, PickMaskDlgProc,
 | 
|---|
| [551] | 2133 |                         FM3ModHandle, MSK_FRAME, MPFROMP(&dcd->mask))) {
 | 
|---|
| [197] | 2134 |             size = sizeof(MASK);
 | 
|---|
 | 2135 |             PrfWriteProfileData(fmprof, appname, "CollectorFilter",
 | 
|---|
| [551] | 2136 |                                 &dcd->mask, size);
 | 
|---|
 | 2137 |             dcd->suspendview = 1;
 | 
|---|
 | 2138 |             WinSendMsg(hwnd, CM_FILTER, MPFROMP(Filter), MPFROMP(&dcd->mask));
 | 
|---|
 | 2139 |             dcd->suspendview = 0;
 | 
|---|
| [444] | 2140 |             if (fAutoView && hwndMain) {
 | 
|---|
| [194] | 2141 |               pci = WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
 | 
|---|
 | 2142 |                                MPFROMLONG(CMA_FIRST),
 | 
|---|
 | 2143 |                                MPFROMSHORT(CRA_CURSORED));
 | 
|---|
 | 2144 |               if (pci && (INT) pci != -1 &&
 | 
|---|
| [730] | 2145 |                   (!(driveflags[toupper(*pci->pszFileName) - 'A'] &
 | 
|---|
| [551] | 2146 |                      DRIVE_SLOW)))
 | 
|---|
| [730] | 2147 |                 WinSendMsg(hwndMain, UM_LOADFILE, MPFROMP(pci->pszFileName),
 | 
|---|
| [194] | 2148 |                            MPVOID);
 | 
|---|
 | 2149 |               else
 | 
|---|
 | 2150 |                 WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
 | 
|---|
 | 2151 |             }
 | 
|---|
 | 2152 |             PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
 | 
|---|
 | 2153 |           }
 | 
|---|
 | 2154 |           else if (empty)
 | 
|---|
| [551] | 2155 |             *dcd->mask.szMask = 0;
 | 
|---|
| [194] | 2156 |           SayFilter(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
 | 
|---|
| [551] | 2157 |                                     DIR_FILTER), &dcd->mask, FALSE);
 | 
|---|
| [194] | 2158 |         }
 | 
|---|
| [1077] | 2159 |         break;
 | 
|---|
| [2] | 2160 | 
 | 
|---|
| [958] | 2161 |       case IDM_UNHIDEALL:
 | 
|---|
| [1077] | 2162 |         WinSendMsg(hwnd, CM_FILTER, MPFROMP(Filter), MPFROMP(&dcd->mask));
 | 
|---|
 | 2163 |         break;
 | 
|---|
| [958] | 2164 | 
 | 
|---|
| [194] | 2165 |       case IDM_HIDEALL:
 | 
|---|
 | 2166 |         if (fAutoView && hwndMain)
 | 
|---|
 | 2167 |           PostMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
 | 
|---|
| [551] | 2168 |         dcd->suspendview = 1;
 | 
|---|
| [194] | 2169 |         HideAll(hwnd);
 | 
|---|
| [551] | 2170 |         dcd->suspendview = 0;
 | 
|---|
| [194] | 2171 |         PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
 | 
|---|
 | 2172 |         break;
 | 
|---|
| [2] | 2173 | 
 | 
|---|
| [194] | 2174 |       case IDM_SELECTLIST:
 | 
|---|
 | 2175 |       case IDM_SELECTALL:
 | 
|---|
 | 2176 |       case IDM_DESELECTALL:
 | 
|---|
 | 2177 |       case IDM_SELECTALLFILES:
 | 
|---|
 | 2178 |       case IDM_DESELECTALLFILES:
 | 
|---|
 | 2179 |       case IDM_SELECTALLDIRS:
 | 
|---|
 | 2180 |       case IDM_DESELECTALLDIRS:
 | 
|---|
 | 2181 |       case IDM_SELECTMASK:
 | 
|---|
 | 2182 |       case IDM_DESELECTMASK:
 | 
|---|
 | 2183 |       case IDM_INVERT:
 | 
|---|
 | 2184 |       case IDM_SELECTCLIP:
 | 
|---|
 | 2185 |       case IDM_DESELECTCLIP:
 | 
|---|
 | 2186 |         {
 | 
|---|
 | 2187 |           PCNRITEM pci;
 | 
|---|
| [2] | 2188 | 
 | 
|---|
| [194] | 2189 |           pci = (PCNRITEM) CurrentRecord(hwnd);
 | 
|---|
 | 2190 |           if ((INT) pci == -1)
 | 
|---|
 | 2191 |             pci = NULL;
 | 
|---|
| [444] | 2192 |           if (SHORT1FROMMP(mp1) == IDM_HIDEALL) {
 | 
|---|
 | 2193 |             if (pci) {
 | 
|---|
| [551] | 2194 |               if (!(pci->rc.flRecordAttr & CRA_SELECTED))
 | 
|---|
 | 2195 |                 pci->rc.flRecordAttr |= CRA_FILTERED;
 | 
|---|
| [194] | 2196 |               WinSendMsg(hwnd, CM_INVALIDATERECORD, MPFROMP(&pci),
 | 
|---|
 | 2197 |                          MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION));
 | 
|---|
 | 2198 |               break;
 | 
|---|
 | 2199 |             }
 | 
|---|
 | 2200 |           }
 | 
|---|
| [551] | 2201 |           PostMsg(dcd->hwndObject, UM_SELECT, mp1, MPFROMP(pci));
 | 
|---|
| [194] | 2202 |         }
 | 
|---|
 | 2203 |         break;
 | 
|---|
| [2] | 2204 | 
 | 
|---|
| [194] | 2205 |       case IDM_RESCAN:
 | 
|---|
| [551] | 2206 |         PostMsg(dcd->hwndObject, UM_RESCAN, MPVOID, MPVOID);
 | 
|---|
| [194] | 2207 |         break;
 | 
|---|
| [2] | 2208 | 
 | 
|---|
| [194] | 2209 |       case IDM_SHOWLNAMES:
 | 
|---|
 | 2210 |       case IDM_SHOWSUBJECT:
 | 
|---|
 | 2211 |       case IDM_SHOWEAS:
 | 
|---|
 | 2212 |       case IDM_SHOWSIZE:
 | 
|---|
 | 2213 |       case IDM_SHOWICON:
 | 
|---|
 | 2214 |       case IDM_SHOWLWDATE:
 | 
|---|
 | 2215 |       case IDM_SHOWLWTIME:
 | 
|---|
 | 2216 |       case IDM_SHOWLADATE:
 | 
|---|
 | 2217 |       case IDM_SHOWLATIME:
 | 
|---|
 | 2218 |       case IDM_SHOWCRDATE:
 | 
|---|
 | 2219 |       case IDM_SHOWCRTIME:
 | 
|---|
 | 2220 |       case IDM_SHOWATTR:
 | 
|---|
| [551] | 2221 |         AdjustDetailsSwitches(hwnd, dcd->hwndLastMenu,
 | 
|---|
| [194] | 2222 |                               SHORT1FROMMP(mp1), NULL,
 | 
|---|
| [1400] | 2223 |                               PCSZ_COLLECTOR, &dcd->ds, FALSE);
 | 
|---|
| [194] | 2224 |         break;
 | 
|---|
| [2] | 2225 | 
 | 
|---|
| [194] | 2226 |       case IDM_ICON:
 | 
|---|
 | 2227 |       case IDM_TEXT:
 | 
|---|
 | 2228 |       case IDM_DETAILS:
 | 
|---|
 | 2229 |       case IDM_NAME:
 | 
|---|
 | 2230 |       case IDM_MINIICONS:
 | 
|---|
 | 2231 |       case IDM_DETAILSTITLES:
 | 
|---|
 | 2232 |         {
 | 
|---|
 | 2233 |           CNRINFO cnri;
 | 
|---|
| [2] | 2234 | 
 | 
|---|
| [194] | 2235 |           memset(&cnri, 0, sizeof(CNRINFO));
 | 
|---|
 | 2236 |           cnri.cb = sizeof(CNRINFO);
 | 
|---|
 | 2237 |           WinSendMsg(hwnd, CM_QUERYCNRINFO, MPFROMP(&cnri),
 | 
|---|
 | 2238 |                      MPFROMLONG(sizeof(CNRINFO)));
 | 
|---|
| [444] | 2239 |           switch (SHORT1FROMMP(mp1)) {
 | 
|---|
| [194] | 2240 |           case IDM_ICON:
 | 
|---|
 | 2241 |             cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
 | 
|---|
 | 2242 |                                     CV_DETAIL | CV_NAME));
 | 
|---|
 | 2243 |             cnri.flWindowAttr |= CV_ICON;
 | 
|---|
 | 2244 |             break;
 | 
|---|
 | 2245 |           case IDM_NAME:
 | 
|---|
 | 2246 |             cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
 | 
|---|
 | 2247 |                                     CV_DETAIL | CV_NAME));
 | 
|---|
 | 2248 |             cnri.flWindowAttr |= CV_NAME;
 | 
|---|
 | 2249 |             break;
 | 
|---|
 | 2250 |           case IDM_TEXT:
 | 
|---|
 | 2251 |             cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
 | 
|---|
 | 2252 |                                     CV_DETAIL | CV_NAME));
 | 
|---|
 | 2253 |             cnri.flWindowAttr |= CV_TEXT;
 | 
|---|
 | 2254 |             break;
 | 
|---|
 | 2255 |           case IDM_DETAILS:
 | 
|---|
 | 2256 |             cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT |
 | 
|---|
 | 2257 |                                     CV_DETAIL | CV_NAME));
 | 
|---|
 | 2258 |             cnri.flWindowAttr |= CV_DETAIL;
 | 
|---|
 | 2259 |             break;
 | 
|---|
 | 2260 |           case IDM_MINIICONS:
 | 
|---|
 | 2261 |             if (cnri.flWindowAttr & CV_MINI)
 | 
|---|
 | 2262 |               cnri.flWindowAttr &= (~CV_MINI);
 | 
|---|
 | 2263 |             else
 | 
|---|
 | 2264 |               cnri.flWindowAttr |= CV_MINI;
 | 
|---|
 | 2265 |             break;
 | 
|---|
 | 2266 |           case IDM_DETAILSTITLES:
 | 
|---|
 | 2267 |             if (cnri.flWindowAttr & CA_DETAILSVIEWTITLES)
 | 
|---|
 | 2268 |               cnri.flWindowAttr &= (~CA_DETAILSVIEWTITLES);
 | 
|---|
 | 2269 |             else
 | 
|---|
 | 2270 |               cnri.flWindowAttr |= CA_DETAILSVIEWTITLES;
 | 
|---|
 | 2271 |             break;
 | 
|---|
 | 2272 |           }
 | 
|---|
| [551] | 2273 |           cnri.flWindowAttr &= (~(CA_ORDEREDTARGETEMPH | CA_MIXEDTARGETEMPH));
 | 
|---|
| [194] | 2274 |           cnri.flWindowAttr |= CV_FLOW;
 | 
|---|
| [551] | 2275 |           dcd->flWindowAttr = cnri.flWindowAttr;
 | 
|---|
| [194] | 2276 |           PrfWriteProfileData(fmprof, appname, "CollectorflWindowAttr",
 | 
|---|
 | 2277 |                               &cnri.flWindowAttr, sizeof(ULONG));
 | 
|---|
 | 2278 |           WinSendMsg(hwnd, CM_SETCNRINFO, MPFROMP(&cnri),
 | 
|---|
 | 2279 |                      MPFROMLONG(CMA_FLWINDOWATTR));
 | 
|---|
 | 2280 |           WinSendMsg(hwnd, CM_INVALIDATERECORD, MPVOID,
 | 
|---|
 | 2281 |                      MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
 | 
|---|
 | 2282 |           SayView(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
 | 
|---|
| [551] | 2283 |                                   DIR_VIEW), dcd->flWindowAttr);
 | 
|---|
| [194] | 2284 |         }
 | 
|---|
 | 2285 |         break;
 | 
|---|
| [2] | 2286 | 
 | 
|---|
| [194] | 2287 |       case IDM_SAVETOLIST:
 | 
|---|
 | 2288 |         WinDlgBox(HWND_DESKTOP, hwnd, SaveListDlgProc, FM3ModHandle,
 | 
|---|
 | 2289 |                   SAV_FRAME, MPFROMP(&hwnd));
 | 
|---|
 | 2290 |         break;
 | 
|---|
| [2] | 2291 | 
 | 
|---|
| [194] | 2292 |       case IDM_SIZES:
 | 
|---|
 | 2293 |         {
 | 
|---|
 | 2294 |           PCNRITEM pci;
 | 
|---|
| [2] | 2295 | 
 | 
|---|
| [194] | 2296 |           pci = (PCNRITEM) CurrentRecord(hwnd);
 | 
|---|
 | 2297 |           if (pci && (INT) pci != -1)
 | 
|---|
 | 2298 |             WinDlgBox(HWND_DESKTOP, HWND_DESKTOP, DirSizeProc, FM3ModHandle,
 | 
|---|
| [730] | 2299 |                       DSZ_FRAME, pci->pszFileName);
 | 
|---|
| [194] | 2300 |         }
 | 
|---|
 | 2301 |         break;
 | 
|---|
| [2] | 2302 | 
 | 
|---|
| [194] | 2303 |       case IDM_MKDIR:
 | 
|---|
 | 2304 |         {
 | 
|---|
 | 2305 |           PCNRITEM pci;
 | 
|---|
| [2] | 2306 | 
 | 
|---|
| [194] | 2307 |           pci = (PCNRITEM) CurrentRecord(hwnd);
 | 
|---|
| [551] | 2308 |           PMMkDir(dcd->hwndParent, (pci && (INT) pci != -1) ?
 | 
|---|
| [730] | 2309 |                   pci->pszFileName : NULL, FALSE);
 | 
|---|
| [194] | 2310 |         }
 | 
|---|
 | 2311 |         break;
 | 
|---|
| [2] | 2312 | 
 | 
|---|
| [194] | 2313 |       case IDM_DOITYOURSELF:
 | 
|---|
 | 2314 |       case IDM_UPDATE:
 | 
|---|
 | 2315 |       case IDM_COLLECTFROMFILE:
 | 
|---|
| [1547] | 2316 |       case IDM_OPENWINDOW:
 | 
|---|
| [194] | 2317 |       case IDM_OPENSETTINGS:
 | 
|---|
 | 2318 |       case IDM_OPENDEFAULT:
 | 
|---|
 | 2319 |       case IDM_OPENICON:
 | 
|---|
 | 2320 |       case IDM_OPENDETAILS:
 | 
|---|
 | 2321 |       case IDM_OPENTREE:
 | 
|---|
 | 2322 |       case IDM_OBJECT:
 | 
|---|
 | 2323 |       case IDM_SHADOW:
 | 
|---|
 | 2324 |       case IDM_SHADOW2:
 | 
|---|
 | 2325 |       case IDM_DELETE:
 | 
|---|
 | 2326 |       case IDM_PERMDELETE:
 | 
|---|
 | 2327 |       case IDM_PRINT:
 | 
|---|
 | 2328 |       case IDM_ATTRS:
 | 
|---|
 | 2329 |       case IDM_INFO:
 | 
|---|
 | 2330 |       case IDM_COPY:
 | 
|---|
 | 2331 |       case IDM_MOVE:
 | 
|---|
 | 2332 |       case IDM_WPSCOPY:
 | 
|---|
 | 2333 |       case IDM_WPSMOVE:
 | 
|---|
 | 2334 |       case IDM_COPYPRESERVE:
 | 
|---|
 | 2335 |       case IDM_MOVEPRESERVE:
 | 
|---|
 | 2336 |       case IDM_WILDCOPY:
 | 
|---|
 | 2337 |       case IDM_WILDMOVE:
 | 
|---|
 | 2338 |       case IDM_RENAME:
 | 
|---|
 | 2339 |       case IDM_COMPARE:
 | 
|---|
 | 2340 |       case IDM_EAS:
 | 
|---|
 | 2341 |       case IDM_SUBJECT:
 | 
|---|
 | 2342 |       case IDM_VIEW:
 | 
|---|
 | 2343 |       case IDM_VIEWTEXT:
 | 
|---|
 | 2344 |       case IDM_VIEWBINARY:
 | 
|---|
 | 2345 |       case IDM_VIEWARCHIVE:
 | 
|---|
 | 2346 |       case IDM_EDIT:
 | 
|---|
 | 2347 |       case IDM_EDITTEXT:
 | 
|---|
 | 2348 |       case IDM_EDITBINARY:
 | 
|---|
 | 2349 |       case IDM_SAVETOCLIP:
 | 
|---|
| [1084] | 2350 |       case IDM_SAVETOCLIPFILENAME:
 | 
|---|
| [194] | 2351 |       case IDM_APPENDTOCLIP:
 | 
|---|
| [1084] | 2352 |       case IDM_APPENDTOCLIPFILENAME:
 | 
|---|
| [194] | 2353 |       case IDM_ARCHIVE:
 | 
|---|
 | 2354 |       case IDM_ARCHIVEM:
 | 
|---|
 | 2355 |       case IDM_EXTRACT:
 | 
|---|
 | 2356 |       case IDM_MCIPLAY:
 | 
|---|
 | 2357 |       case IDM_UUDECODE:
 | 
|---|
| [1664] | 2358 |       case IDM_UNLOCKFILE:
 | 
|---|
| [194] | 2359 |       case IDM_MERGE:
 | 
|---|
 | 2360 |         {
 | 
|---|
 | 2361 |           LISTINFO *li;
 | 
|---|
 | 2362 |           ULONG action = UM_ACTION;
 | 
|---|
| [1077] | 2363 | #         ifdef FORTIFY
 | 
|---|
 | 2364 |           Fortify_EnterScope();
 | 
|---|
 | 2365 | #         endif
 | 
|---|
| [551] | 2366 |           li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__);
 | 
|---|
| [444] | 2367 |           if (li) {
 | 
|---|
| [551] | 2368 |             li->type = SHORT1FROMMP(mp1);
 | 
|---|
 | 2369 |             li->hwnd = hwnd;
 | 
|---|
 | 2370 |             li->list = BuildList(hwnd);
 | 
|---|
 | 2371 |             if (li->list) {
 | 
|---|
| [444] | 2372 |               switch (SHORT1FROMMP(mp1)) {
 | 
|---|
| [194] | 2373 |               case IDM_DOITYOURSELF:
 | 
|---|
| [1335] | 2374 |               case IDM_APPENDTOCLIP:
 | 
|---|
 | 2375 |               case IDM_APPENDTOCLIPFILENAME:
 | 
|---|
| [194] | 2376 |               case IDM_SAVETOCLIP:
 | 
|---|
| [1335] | 2377 |               case IDM_SAVETOCLIPFILENAME:
 | 
|---|
| [194] | 2378 |               case IDM_ARCHIVE:
 | 
|---|
 | 2379 |               case IDM_ARCHIVEM:
 | 
|---|
 | 2380 |               case IDM_DELETE:
 | 
|---|
 | 2381 |               case IDM_PERMDELETE:
 | 
|---|
 | 2382 |               case IDM_ATTRS:
 | 
|---|
 | 2383 |               case IDM_PRINT:
 | 
|---|
 | 2384 |               case IDM_SHADOW:
 | 
|---|
 | 2385 |               case IDM_SHADOW2:
 | 
|---|
 | 2386 |               case IDM_OBJECT:
 | 
|---|
 | 2387 |               case IDM_VIEW:
 | 
|---|
 | 2388 |               case IDM_VIEWTEXT:
 | 
|---|
 | 2389 |               case IDM_VIEWBINARY:
 | 
|---|
 | 2390 |               case IDM_EDIT:
 | 
|---|
 | 2391 |               case IDM_EDITTEXT:
 | 
|---|
 | 2392 |               case IDM_EDITBINARY:
 | 
|---|
 | 2393 |               case IDM_MCIPLAY:
 | 
|---|
 | 2394 |               case IDM_UPDATE:
 | 
|---|
 | 2395 |               case IDM_INFO:
 | 
|---|
 | 2396 |               case IDM_EAS:
 | 
|---|
 | 2397 |                 action = UM_MASSACTION;
 | 
|---|
 | 2398 |                 break;
 | 
|---|
| [1741] | 2399 |               }
 | 
|---|
 | 2400 |               if (li->type == IDM_DELETE)
 | 
|---|
 | 2401 |                 ignorereadonly = FALSE;
 | 
|---|
| [551] | 2402 |               if (li->type == IDM_SHADOW || li->type == IDM_OBJECT ||
 | 
|---|
 | 2403 |                   li->type == IDM_SHADOW2)
 | 
|---|
 | 2404 |                 *li->targetpath = 0;
 | 
|---|
 | 2405 |               if (!PostMsg(dcd->hwndObject, action, MPFROMP(li), MPVOID)) {
 | 
|---|
| [1400] | 2406 |                 Runtime_Error(pszSrcFile, __LINE__, PCSZ_POSTMSG);
 | 
|---|
| [194] | 2407 |                 FreeListInfo(li);
 | 
|---|
 | 2408 |               }
 | 
|---|
 | 2409 |               else if (fUnHilite)
 | 
|---|
| [672] | 2410 |                 UnHilite(hwnd, TRUE, &dcd->lastselection, dcd->ulItemsToUnHilite);
 | 
|---|
| [194] | 2411 |             }
 | 
|---|
| [1077] | 2412 |             else
 | 
|---|
 | 2413 |               free(li);
 | 
|---|
| [194] | 2414 |           }
 | 
|---|
| [1077] | 2415 | #         ifdef FORTIFY
 | 
|---|
 | 2416 |           Fortify_LeaveScope();
 | 
|---|
 | 2417 | #         endif
 | 
|---|
| [194] | 2418 |         }
 | 
|---|
 | 2419 |         break;
 | 
|---|
| [2] | 2420 | 
 | 
|---|
| [194] | 2421 |       default:
 | 
|---|
 | 2422 |         if (!cmdloaded)
 | 
|---|
 | 2423 |           load_commands();
 | 
|---|
 | 2424 |         if (SHORT1FROMMP(mp1) >= IDM_COMMANDSTART &&
 | 
|---|
| [551] | 2425 |             SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) {
 | 
|---|
| [194] | 2426 |           INT x;
 | 
|---|
| [2] | 2427 | 
 | 
|---|
| [1563] | 2428 |           x = SHORT1FROMMP(mp1);        // - IDM_COMMANDSTART;
 | 
|---|
| [444] | 2429 |           if (x >= 0) {
 | 
|---|
| [1486] | 2430 |             //x++;
 | 
|---|
| [194] | 2431 |             RunCommand(hwnd, x);
 | 
|---|
 | 2432 |             if (fUnHilite)
 | 
|---|
| [672] | 2433 |               UnHilite(hwnd, TRUE, &dcd->lastselection, dcd->ulItemsToUnHilite);
 | 
|---|
| [194] | 2434 |           }
 | 
|---|
 | 2435 |         }
 | 
|---|
 | 2436 |         break;
 | 
|---|
 | 2437 |       }
 | 
|---|
 | 2438 |     }
 | 
|---|
 | 2439 |     return 0;
 | 
|---|
| [2] | 2440 | 
 | 
|---|
| [194] | 2441 |   case UM_FIXCNRMLE:
 | 
|---|
 | 2442 |   case UM_FIXEDITNAME:
 | 
|---|
 | 2443 |     return CommonCnrProc(hwnd, msg, mp1, mp2);
 | 
|---|
| [2] | 2444 | 
 | 
|---|
| [194] | 2445 |   case UM_FILESMENU:
 | 
|---|
 | 2446 |     {
 | 
|---|
 | 2447 |       PCNRITEM pci;
 | 
|---|
| [551] | 2448 |       HWND menuHwnd = (HWND) 0;
 | 
|---|
| [2] | 2449 | 
 | 
|---|
| [194] | 2450 |       pci = (PCNRITEM) CurrentRecord(hwnd);
 | 
|---|
| [444] | 2451 |       if (pci && (INT) pci != -1) {
 | 
|---|
| [551] | 2452 |         if (pci->attrFile & FILE_DIRECTORY)
 | 
|---|
| [872] | 2453 |           menuHwnd = CheckMenu(hwnd, &CollectorDirMenu, COLLECTORDIR_POPUP);
 | 
|---|
| [194] | 2454 |         else
 | 
|---|
| [872] | 2455 |           menuHwnd = CheckMenu(hwnd, &CollectorFileMenu, COLLECTORFILE_POPUP);
 | 
|---|
| [2] | 2456 |       }
 | 
|---|
| [194] | 2457 |       return MRFROMLONG(menuHwnd);
 | 
|---|
 | 2458 |     }
 | 
|---|
| [2] | 2459 | 
 | 
|---|
| [194] | 2460 |   case WM_CONTROL:
 | 
|---|
 | 2461 |     DosError(FERR_DISABLEHARDERR);
 | 
|---|
| [444] | 2462 |     if (dcd) {
 | 
|---|
 | 2463 |       switch (SHORT2FROMMP(mp1)) {
 | 
|---|
| [194] | 2464 |       case CN_CONTEXTMENU:
 | 
|---|
 | 2465 |         {
 | 
|---|
 | 2466 |           PCNRITEM pci = (PCNRITEM) mp2;
 | 
|---|
| [2] | 2467 | 
 | 
|---|
| [444] | 2468 |           if (pci) {
 | 
|---|
| [194] | 2469 |             WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPFROMP(pci),
 | 
|---|
 | 2470 |                        MPFROM2SHORT(TRUE, CRA_CURSORED));
 | 
|---|
 | 2471 |             MarkAll(hwnd, FALSE, FALSE, TRUE);
 | 
|---|
| [551] | 2472 |             if (pci->attrFile & FILE_DIRECTORY)
 | 
|---|
| [872] | 2473 |               dcd->hwndLastMenu = CheckMenu(hwnd, &CollectorDirMenu,
 | 
|---|
| [551] | 2474 |                                             COLLECTORDIR_POPUP);
 | 
|---|
| [194] | 2475 |             else
 | 
|---|
| [872] | 2476 |               dcd->hwndLastMenu = CheckMenu(hwnd, &CollectorFileMenu,
 | 
|---|
| [551] | 2477 |                                             COLLECTORFILE_POPUP);
 | 
|---|
| [194] | 2478 |           }
 | 
|---|
| [444] | 2479 |           else {
 | 
|---|
| [872] | 2480 |             dcd->hwndLastMenu = CheckMenu(hwnd, &CollectorCnrMenu,
 | 
|---|
| [551] | 2481 |                                           COLLECTORCNR_POPUP);
 | 
|---|
 | 2482 |             if (dcd->hwndLastMenu && !dcd->cnremphasized) {
 | 
|---|
| [194] | 2483 |               WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
 | 
|---|
 | 2484 |                          MPFROM2SHORT(TRUE, CRA_SOURCE));
 | 
|---|
| [551] | 2485 |               dcd->cnremphasized = TRUE;
 | 
|---|
| [194] | 2486 |             }
 | 
|---|
 | 2487 |           }
 | 
|---|
| [551] | 2488 |           if (dcd->hwndLastMenu) {
 | 
|---|
 | 2489 |             if (dcd->hwndLastMenu == CollectorCnrMenu) {
 | 
|---|
 | 2490 |               SetViewMenu(dcd->hwndLastMenu, dcd->flWindowAttr);
 | 
|---|
| [1065] | 2491 |               SetDetailsSwitches(dcd->hwndLastMenu, &dcd->ds);
 | 
|---|
| [907] | 2492 |               CopyPresParams(dcd->hwndLastMenu, hwnd);
 | 
|---|
| [551] | 2493 |               if (dcd->flWindowAttr & CV_MINI)
 | 
|---|
 | 2494 |                 WinCheckMenuItem(dcd->hwndLastMenu, IDM_MINIICONS, TRUE);
 | 
|---|
 | 2495 |               disable_menuitem(dcd->hwndLastMenu, DID_CANCEL,
 | 
|---|
 | 2496 |                                !dcd->amextracted);
 | 
|---|
 | 2497 |               disable_menuitem(dcd->hwndLastMenu, IDM_GREP, dcd->amextracted);
 | 
|---|
| [194] | 2498 |             }
 | 
|---|
| [551] | 2499 |             if (!PopupMenu(hwnd, hwnd, dcd->hwndLastMenu)) {
 | 
|---|
 | 2500 |               if (dcd->cnremphasized) {
 | 
|---|
| [194] | 2501 |                 WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
 | 
|---|
 | 2502 |                            MPFROM2SHORT(FALSE, CRA_SOURCE));
 | 
|---|
| [551] | 2503 |                 dcd->cnremphasized = TRUE;
 | 
|---|
| [194] | 2504 |               }
 | 
|---|
 | 2505 |               MarkAll(hwnd, TRUE, FALSE, TRUE);
 | 
|---|
 | 2506 |             }
 | 
|---|
 | 2507 |           }
 | 
|---|
 | 2508 |         }
 | 
|---|
 | 2509 |         break;
 | 
|---|
| [2] | 2510 | 
 | 
|---|
| [194] | 2511 |       case CN_DROPHELP:
 | 
|---|
| [444] | 2512 |         if (mp2) {
 | 
|---|
| [194] | 2513 |           PDRAGINFO pDInfo;
 | 
|---|
 | 2514 |           PCNRITEM pci;
 | 
|---|
 | 2515 |           ULONG numitems;
 | 
|---|
 | 2516 |           USHORT usOperation;
 | 
|---|
| [2] | 2517 | 
 | 
|---|
| [551] | 2518 |           pci = (PCNRITEM) ((PCNRDRAGINFO) mp2)->pRecord;
 | 
|---|
 | 2519 |           pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
 | 
|---|
| [444] | 2520 |           if (!DrgAccessDraginfo(pDInfo)) {
 | 
|---|
| [352] | 2521 |             Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
 | 
|---|
| [1402] | 2522 |                       PCSZ_DRGACCESSDRAGINFO);
 | 
|---|
| [618] | 2523 |             return 0;
 | 
|---|
| [194] | 2524 |           }
 | 
|---|
 | 2525 |           numitems = DrgQueryDragitemCount(pDInfo);
 | 
|---|
| [551] | 2526 |           usOperation = pDInfo->usOperation;
 | 
|---|
| [1394] | 2527 |           if (usOperation == DO_DEFAULT)
 | 
|---|
 | 2528 |             usOperation = fCopyDefault ? DO_COPY : DO_MOVE;
 | 
|---|
| [618] | 2529 |           FreeDragInfoData(hwnd, pDInfo);
 | 
|---|
| [194] | 2530 |           saymsg(MB_ENTER | MB_ICONASTERISK,
 | 
|---|
 | 2531 |                  hwnd,
 | 
|---|
 | 2532 |                  GetPString(IDS_DROPHELPHDRTEXT),
 | 
|---|
 | 2533 |                  GetPString(IDS_DROPHELPTEXT),
 | 
|---|
 | 2534 |                  numitems,
 | 
|---|
| [750] | 2535 |                  &"s"[numitems == 1],
 | 
|---|
| [194] | 2536 |                  (pci) ? NullStr : GetPString(IDS_NOTEXT),
 | 
|---|
 | 2537 |                  (pci) ? NullStr : " ",
 | 
|---|
| [730] | 2538 |                  (pci) ? pci->pszFileName : NullStr,
 | 
|---|
| [194] | 2539 |                  (pci) ? " " : NullStr,
 | 
|---|
 | 2540 |                  GetPString((usOperation == DO_COPY) ?
 | 
|---|
 | 2541 |                             IDS_COPYTEXT :
 | 
|---|
 | 2542 |                             (usOperation == DO_LINK) ?
 | 
|---|
 | 2543 |                             IDS_LINKTEXT : IDS_MOVETEXT));
 | 
|---|
 | 2544 |         }
 | 
|---|
 | 2545 |         return 0;
 | 
|---|
| [2] | 2546 | 
 | 
|---|
| [194] | 2547 |       case CN_DRAGLEAVE:
 | 
|---|
| [444] | 2548 |         if (mp2) {
 | 
|---|
| [194] | 2549 |           PDRAGINFO pDInfo;
 | 
|---|
| [2] | 2550 | 
 | 
|---|
| [618] | 2551 |           // fixme to know why needed
 | 
|---|
| [551] | 2552 |           pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
 | 
|---|
| [1673] | 2553 |           DrgAccessDraginfo(pDInfo);    // Access DRAGINFO
 | 
|---|
 | 2554 |           DrgFreeDraginfo(pDInfo);      // Free DRAGINFO
 | 
|---|
| [194] | 2555 |         }
 | 
|---|
 | 2556 |         return 0;
 | 
|---|
| [2] | 2557 | 
 | 
|---|
| [194] | 2558 |       case CN_DRAGAFTER:
 | 
|---|
 | 2559 |       case CN_DRAGOVER:
 | 
|---|
| [444] | 2560 |         if (mp2) {
 | 
|---|
| [1673] | 2561 |           PDRAGITEM pDItem;             // Pointer to DRAGITEM
 | 
|---|
 | 2562 |           PDRAGINFO pDInfo;             // Pointer to DRAGINFO
 | 
|---|
| [194] | 2563 |           PCNRITEM pci;
 | 
|---|
 | 2564 |           USHORT uso;
 | 
|---|
| [2] | 2565 | 
 | 
|---|
| [551] | 2566 |           pci = (PCNRITEM) ((PCNRDRAGINFO) mp2)->pRecord;
 | 
|---|
| [618] | 2567 |           // if(SHORT1FROMMP(mp1) == CN_DRAGAFTER)
 | 
|---|
 | 2568 |           //    pci = NULL;
 | 
|---|
| [551] | 2569 |           pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
 | 
|---|
| [618] | 2570 |           if (!DrgAccessDraginfo(pDInfo)) {
 | 
|---|
 | 2571 |             Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
 | 
|---|
| [1402] | 2572 |                       PCSZ_DRGACCESSDRAGINFO);
 | 
|---|
| [1673] | 2573 |             return (MRFROM2SHORT(DOR_NODROP, 0));       // Drop not valid
 | 
|---|
| [618] | 2574 |           }
 | 
|---|
| [444] | 2575 |           if (pci) {
 | 
|---|
| [551] | 2576 |             if (pci->rc.flRecordAttr & CRA_SOURCE) {
 | 
|---|
| [194] | 2577 |               DrgFreeDraginfo(pDInfo);
 | 
|---|
 | 2578 |               return (MRFROM2SHORT(DOR_NODROP, 0));
 | 
|---|
 | 2579 |             }
 | 
|---|
| [551] | 2580 |             uso = pDInfo->usOperation;
 | 
|---|
| [194] | 2581 |             if (uso == DO_DEFAULT)
 | 
|---|
 | 2582 |               uso = (fCopyDefault) ? DO_COPY : DO_MOVE;
 | 
|---|
| [551] | 2583 |             if (!(pci->attrFile & FILE_DIRECTORY)) {
 | 
|---|
 | 2584 |               if (uso != DO_LINK && uso != DO_MOVE && uso != DO_COPY) {
 | 
|---|
| [194] | 2585 |                 DrgFreeDraginfo(pDInfo);
 | 
|---|
 | 2586 |                 return MRFROM2SHORT(DOR_NODROP, 0);
 | 
|---|
 | 2587 |               }
 | 
|---|
 | 2588 |               if (uso != DO_LINK &&
 | 
|---|
| [730] | 2589 |                   !(driveflags[toupper(*pci->pszFileName) - 'A'] &
 | 
|---|
| [551] | 2590 |                     DRIVE_NOTWRITEABLE)) {
 | 
|---|
| [194] | 2591 |                 ARC_TYPE *info = NULL;
 | 
|---|
| [2] | 2592 | 
 | 
|---|
| [194] | 2593 |                 if (!fQuickArcFind &&
 | 
|---|
| [730] | 2594 |                     !(driveflags[toupper(*pci->pszFileName) - 'A'] &
 | 
|---|
| [194] | 2595 |                       DRIVE_SLOW))
 | 
|---|
| [730] | 2596 |                   info = find_type(pci->pszFileName, NULL);
 | 
|---|
| [194] | 2597 |                 else
 | 
|---|
| [730] | 2598 |                   info = quick_find_type(pci->pszFileName, NULL);
 | 
|---|
| [551] | 2599 |                 if (!info || ((uso == DO_MOVE && !info->move) ||
 | 
|---|
 | 2600 |                               (uso == DO_COPY && !info->create))) {
 | 
|---|
| [194] | 2601 |                   DrgFreeDraginfo(pDInfo);
 | 
|---|
 | 2602 |                   return MRFROM2SHORT(DOR_NODROP, 0);
 | 
|---|
 | 2603 |                 }
 | 
|---|
 | 2604 |               }
 | 
|---|
 | 2605 |             }
 | 
|---|
 | 2606 |           }
 | 
|---|
| [1673] | 2607 |           pDItem = DrgQueryDragitemPtr(pDInfo,     // Access DRAGITEM
 | 
|---|
 | 2608 |                                        0);         // Index to DRAGITEM
 | 
|---|
 | 2609 |           if (DrgVerifyRMF(pDItem,                 // Check valid rendering
 | 
|---|
 | 2610 |                            (CHAR *) DRM_OS2FILE,   // mechanisms and data
 | 
|---|
| [551] | 2611 |                            NULL)) {
 | 
|---|
| [1673] | 2612 |             DrgFreeDraginfo(pDInfo);               // Free DRAGINFO
 | 
|---|
| [444] | 2613 |             if (pci) {
 | 
|---|
| [730] | 2614 |               if (driveflags[toupper(*pci->pszFileName) - 'A'] &
 | 
|---|
| [194] | 2615 |                   DRIVE_NOTWRITEABLE)
 | 
|---|
 | 2616 |                 return MRFROM2SHORT(DOR_DROP, DO_LINK);
 | 
|---|
| [730] | 2617 |               if (toupper(*pci->pszFileName) < 'C')
 | 
|---|
| [194] | 2618 |                 return MRFROM2SHORT(DOR_DROP, DO_COPY);
 | 
|---|
| [1673] | 2619 |               return MRFROM2SHORT(DOR_DROP,            // Return okay to drop
 | 
|---|
| [551] | 2620 |                                   ((fCopyDefault) ? DO_COPY : DO_MOVE));
 | 
|---|
| [194] | 2621 |             }
 | 
|---|
 | 2622 |             else
 | 
|---|
| [1673] | 2623 |               return MRFROM2SHORT(DOR_DROP,            // Return okay to drop
 | 
|---|
| [194] | 2624 |                                   DO_COPY);
 | 
|---|
 | 2625 |           }
 | 
|---|
| [1673] | 2626 |           DrgFreeDraginfo(pDInfo);                    // Free DRAGINFO
 | 
|---|
| [194] | 2627 |         }
 | 
|---|
| [1673] | 2628 |         return (MRFROM2SHORT(DOR_NODROP, 0));         // Drop not valid
 | 
|---|
| [2] | 2629 | 
 | 
|---|
| [194] | 2630 |       case CN_INITDRAG:
 | 
|---|
| [444] | 2631 |         if (mp2) {
 | 
|---|
| [194] | 2632 |           BOOL wasemphasized = FALSE;
 | 
|---|
 | 2633 |           PCNRDRAGINIT pcd = (PCNRDRAGINIT) mp2;
 | 
|---|
 | 2634 |           PCNRITEM pci;
 | 
|---|
| [2] | 2635 | 
 | 
|---|
| [444] | 2636 |           if (pcd) {
 | 
|---|
| [551] | 2637 |             pci = (PCNRITEM) pcd->pRecord;
 | 
|---|
| [444] | 2638 |             if (pci) {
 | 
|---|
| [551] | 2639 |               if (pci->rc.flRecordAttr & CRA_SELECTED)
 | 
|---|
| [194] | 2640 |                 wasemphasized = TRUE;
 | 
|---|
| [730] | 2641 |               if (IsRoot(pci->pszFileName))
 | 
|---|
| [194] | 2642 |                 break;
 | 
|---|
 | 2643 |               if (hwndStatus2)
 | 
|---|
| [551] | 2644 |                 WinSetWindowText(hwndStatus2,
 | 
|---|
| [1498] | 2645 |                                  (CHAR *) GetPString(IDS_DRAGFILEOBJTEXT));
 | 
|---|
| [551] | 2646 |               if (DoFileDrag(hwnd, dcd->hwndObject, mp2, NULL, NULL, TRUE)) {
 | 
|---|
| [672] | 2647 |                 if ((fUnHilite && wasemphasized) || dcd->ulItemsToUnHilite)
 | 
|---|
 | 2648 |                   UnHilite(hwnd, TRUE, &dcd->lastselection, dcd->ulItemsToUnHilite);
 | 
|---|
| [194] | 2649 |               }
 | 
|---|
 | 2650 |               if (hwndStatus2)
 | 
|---|
 | 2651 |                 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
 | 
|---|
 | 2652 |             }
 | 
|---|
 | 2653 |           }
 | 
|---|
 | 2654 |         }
 | 
|---|
 | 2655 |         return 0;
 | 
|---|
| [2] | 2656 | 
 | 
|---|
| [194] | 2657 |       case CN_DROP:
 | 
|---|
| [444] | 2658 |         if (mp2) {
 | 
|---|
| [194] | 2659 |           LISTINFO *li;
 | 
|---|
 | 2660 |           ULONG action = UM_ACTION;
 | 
|---|
| [2] | 2661 | 
 | 
|---|
| [724] | 2662 |           li = DoFileDrop(hwnd, NULL, TRUE, mp1, mp2);
 | 
|---|
 | 2663 |           CheckPmDrgLimit(((PCNRDRAGINFO)mp2)->pDragInfo);
 | 
|---|
| [444] | 2664 |           if (li) {
 | 
|---|
| [551] | 2665 |             if (!*li->targetpath) {
 | 
|---|
 | 2666 |               li->type = IDM_COLLECT;
 | 
|---|
| [194] | 2667 |               action = UM_COLLECT;
 | 
|---|
 | 2668 |             }
 | 
|---|
| [444] | 2669 |             else {
 | 
|---|
| [551] | 2670 |               if (li->list && li->list[0] && IsRoot(li->list[0]))
 | 
|---|
 | 2671 |                 li->type = DO_LINK;
 | 
|---|
 | 2672 |               else if (fDragndropDlg && (!*li->arcname || !li->info)) {
 | 
|---|
| [194] | 2673 |                 CHECKLIST cl;
 | 
|---|
| [2] | 2674 | 
 | 
|---|
| [194] | 2675 |                 memset(&cl, 0, sizeof(cl));
 | 
|---|
 | 2676 |                 cl.size = sizeof(cl);
 | 
|---|
| [551] | 2677 |                 cl.flags = li->type;
 | 
|---|
 | 2678 |                 cl.list = li->list;
 | 
|---|
 | 2679 |                 cl.cmd = li->type;
 | 
|---|
 | 2680 |                 cl.prompt = li->targetpath;
 | 
|---|
 | 2681 |                 li->type = WinDlgBox(HWND_DESKTOP, dcd->hwndParent,
 | 
|---|
 | 2682 |                                      DropListProc, FM3ModHandle,
 | 
|---|
| [618] | 2683 |                                      DND_FRAME, MPFROMP(&cl));
 | 
|---|
 | 2684 |                 if (li->type == DID_ERROR)
 | 
|---|
 | 2685 |                   Win_Error(DND_FRAME, HWND_DESKTOP, pszSrcFile, __LINE__,
 | 
|---|
| [1402] | 2686 |                             GetPString(IDS_DRAGDROPDIALOGTEXT));
 | 
|---|
| [618] | 2687 |                 if (!li->type) {
 | 
|---|
| [194] | 2688 |                   FreeListInfo(li);
 | 
|---|
 | 2689 |                   return 0;
 | 
|---|
 | 2690 |                 }
 | 
|---|
| [551] | 2691 |                 li->list = cl.list;
 | 
|---|
| [618] | 2692 |                 if (!li->list || !li->list[0]) {
 | 
|---|
| [194] | 2693 |                   FreeListInfo(li);
 | 
|---|
 | 2694 |                   return 0;
 | 
|---|
 | 2695 |                 }
 | 
|---|
 | 2696 |               }
 | 
|---|
| [551] | 2697 |               switch (li->type) {
 | 
|---|
| [194] | 2698 |               case DND_LAUNCH:
 | 
|---|
| [551] | 2699 |                 strcat(li->targetpath, " %a");
 | 
|---|
 | 2700 |                 ExecOnList(dcd->hwndParent, li->targetpath,
 | 
|---|
| [1497] | 2701 |                            PROMPT | WINDOWED, NULL, NULL, li->list, NULL,
 | 
|---|
| [907] | 2702 |                            pszSrcFile, __LINE__);
 | 
|---|
| [551] | 2703 |                 FreeList(li->list);
 | 
|---|
 | 2704 |                 li->list = NULL;
 | 
|---|
| [194] | 2705 |                 break;
 | 
|---|
 | 2706 |               case DO_LINK:
 | 
|---|
| [444] | 2707 |                 if (fLinkSetsIcon) {
 | 
|---|
| [551] | 2708 |                   li->type = IDM_SETICON;
 | 
|---|
| [194] | 2709 |                   action = UM_MASSACTION;
 | 
|---|
 | 2710 |                 }
 | 
|---|
 | 2711 |                 else
 | 
|---|
| [551] | 2712 |                   li->type = IDM_COMPARE;
 | 
|---|
| [194] | 2713 |                 break;
 | 
|---|
 | 2714 |               case DND_EXTRACT:
 | 
|---|
| [551] | 2715 |                 if (*li->targetpath && !IsFile(li->targetpath))
 | 
|---|
 | 2716 |                   li->type = IDM_EXTRACT;
 | 
|---|
| [194] | 2717 |                 break;
 | 
|---|
 | 2718 |               case DND_MOVE:
 | 
|---|
| [551] | 2719 |                 li->type = IDM_MOVE;
 | 
|---|
 | 2720 |                 if (*li->targetpath && IsFile(li->targetpath) == 1) {
 | 
|---|
| [194] | 2721 |                   action = UM_MASSACTION;
 | 
|---|
| [551] | 2722 |                   li->type = IDM_ARCHIVEM;
 | 
|---|
| [194] | 2723 |                 }
 | 
|---|
 | 2724 |                 break;
 | 
|---|
 | 2725 |               case DND_WILDMOVE:
 | 
|---|
| [551] | 2726 |                 li->type = IDM_WILDMOVE;
 | 
|---|
 | 2727 |                 if (*li->targetpath && IsFile(li->targetpath) == 1) {
 | 
|---|
| [194] | 2728 |                   action = UM_MASSACTION;
 | 
|---|
| [551] | 2729 |                   li->type = IDM_ARCHIVEM;
 | 
|---|
| [194] | 2730 |                 }
 | 
|---|
 | 2731 |                 break;
 | 
|---|
 | 2732 |               case DND_OBJECT:
 | 
|---|
| [551] | 2733 |                 li->type = IDM_OBJECT;
 | 
|---|
| [194] | 2734 |                 action = UM_MASSACTION;
 | 
|---|
 | 2735 |                 break;
 | 
|---|
 | 2736 |               case DND_SHADOW:
 | 
|---|
| [551] | 2737 |                 li->type = IDM_SHADOW;
 | 
|---|
| [194] | 2738 |                 action = UM_MASSACTION;
 | 
|---|
 | 2739 |                 break;
 | 
|---|
 | 2740 |               case DND_COMPARE:
 | 
|---|
| [551] | 2741 |                 li->type = IDM_COMPARE;
 | 
|---|
| [194] | 2742 |                 break;
 | 
|---|
 | 2743 |               case DND_SETICON:
 | 
|---|
 | 2744 |                 action = UM_MASSACTION;
 | 
|---|
| [551] | 2745 |                 li->type = IDM_SETICON;
 | 
|---|
| [194] | 2746 |                 break;
 | 
|---|
 | 2747 |               case DND_WILDCOPY:
 | 
|---|
| [551] | 2748 |                 li->type = IDM_WILDCOPY;
 | 
|---|
 | 2749 |                 if (*li->targetpath && IsFile(li->targetpath) == 1) {
 | 
|---|
| [194] | 2750 |                   action = UM_MASSACTION;
 | 
|---|
| [551] | 2751 |                   li->type = IDM_ARCHIVE;
 | 
|---|
| [194] | 2752 |                 }
 | 
|---|
 | 2753 |                 break;
 | 
|---|
 | 2754 |               case DND_COPY:
 | 
|---|
| [551] | 2755 |                 li->type = IDM_COPY;
 | 
|---|
 | 2756 |                 if (*li->targetpath && IsFile(li->targetpath) == 1) {
 | 
|---|
| [194] | 2757 |                   action = UM_MASSACTION;
 | 
|---|
| [551] | 2758 |                   li->type = IDM_ARCHIVE;
 | 
|---|
| [194] | 2759 |                 }
 | 
|---|
 | 2760 |                 break;
 | 
|---|
 | 2761 |               default:
 | 
|---|
| [551] | 2762 |                 if (*li->arcname && li->info) {
 | 
|---|
| [194] | 2763 |                   action = UM_MASSACTION;
 | 
|---|
| [551] | 2764 |                   li->type =
 | 
|---|
 | 2765 |                     (li->type ==
 | 
|---|
 | 2766 |                      DO_MOVE) ? IDM_FAKEEXTRACTM : IDM_FAKEEXTRACT;
 | 
|---|
| [194] | 2767 |                 }
 | 
|---|
| [551] | 2768 |                 else if (*li->targetpath && IsFile(li->targetpath) == 1) {
 | 
|---|
| [194] | 2769 |                   action = UM_MASSACTION;
 | 
|---|
| [551] | 2770 |                   li->type =
 | 
|---|
 | 2771 |                     (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE;
 | 
|---|
| [194] | 2772 |                 }
 | 
|---|
 | 2773 |                 else
 | 
|---|
| [551] | 2774 |                   li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY;
 | 
|---|
| [194] | 2775 |                 break;
 | 
|---|
| [1611] | 2776 |               } // switch
 | 
|---|
 | 2777 |             } // if !collect
 | 
|---|
| [551] | 2778 |             if (!li->list || !li->list[0])
 | 
|---|
| [194] | 2779 |               FreeListInfo(li);
 | 
|---|
| [551] | 2780 |             else if (!PostMsg(dcd->hwndObject, action, MPFROMP(li), MPVOID))
 | 
|---|
| [194] | 2781 |               FreeListInfo(li);
 | 
|---|
| [444] | 2782 |             else {
 | 
|---|
| [194] | 2783 |               USHORT usop = 0;
 | 
|---|
| [2] | 2784 | 
 | 
|---|
| [551] | 2785 |               switch (li->type) {
 | 
|---|
| [194] | 2786 |               case IDM_COPY:
 | 
|---|
 | 2787 |               case IDM_WILDCOPY:
 | 
|---|
 | 2788 |                 usop = DO_COPY;
 | 
|---|
 | 2789 |                 break;
 | 
|---|
 | 2790 |               case IDM_MOVE:
 | 
|---|
 | 2791 |               case IDM_WILDMOVE:
 | 
|---|
 | 2792 |               case IDM_ARCHIVEM:
 | 
|---|
 | 2793 |                 usop = DO_MOVE;
 | 
|---|
 | 2794 |                 break;
 | 
|---|
 | 2795 |               }
 | 
|---|
 | 2796 |               if (usop)
 | 
|---|
 | 2797 |                 return MRFROM2SHORT(DOR_DROP, usop);
 | 
|---|
 | 2798 |             }
 | 
|---|
 | 2799 |           }
 | 
|---|
 | 2800 |         }
 | 
|---|
 | 2801 |         return 0;
 | 
|---|
| [2] | 2802 | 
 | 
|---|
| [194] | 2803 |       case CN_BEGINEDIT:
 | 
|---|
 | 2804 |       case CN_REALLOCPSZ:
 | 
|---|
 | 2805 |       case CN_ENDEDIT:
 | 
|---|
 | 2806 |         {
 | 
|---|
 | 2807 |           MRESULT mre;
 | 
|---|
| [2] | 2808 | 
 | 
|---|
| [194] | 2809 |           mre = CnrDirectEdit(hwnd, msg, mp1, mp2);
 | 
|---|
 | 2810 |           if (mre != (MRESULT) - 1)
 | 
|---|
 | 2811 |             return mre;
 | 
|---|
 | 2812 |         }
 | 
|---|
 | 2813 |         break;
 | 
|---|
| [2] | 2814 | 
 | 
|---|
| [194] | 2815 |       case CN_EMPHASIS:
 | 
|---|
| [444] | 2816 |         if (mp2) {
 | 
|---|
| [194] | 2817 |           PNOTIFYRECORDEMPHASIS pre = mp2;
 | 
|---|
 | 2818 |           PCNRITEM pci;
 | 
|---|
| [1397] | 2819 |           CHAR s[CCHMAXPATH + 91], tb[81], tf[81], szDate[DATE_BUF_BYTES], *p;
 | 
|---|
| [2] | 2820 | 
 | 
|---|
| [551] | 2821 |           pci = (PCNRITEM) ((pre) ? pre->pRecord : NULL);
 | 
|---|
| [444] | 2822 |           if (!pci) {
 | 
|---|
| [194] | 2823 |             if (hwndStatus2)
 | 
|---|
 | 2824 |               WinSetWindowText(hwndStatus2, NullStr);
 | 
|---|
| [444] | 2825 |             if (fMoreButtons) {
 | 
|---|
| [194] | 2826 |               WinSetWindowText(hwndName, NullStr);
 | 
|---|
 | 2827 |               WinSetWindowText(hwndDate, NullStr);
 | 
|---|
 | 2828 |               WinSetWindowText(hwndAttr, NullStr);
 | 
|---|
 | 2829 |             }
 | 
|---|
 | 2830 |             if (hwndMain)
 | 
|---|
 | 2831 |               WinSendMsg(hwndMain, UM_LOADFILE, MPVOID, MPVOID);
 | 
|---|
 | 2832 |             break;
 | 
|---|
 | 2833 |           }
 | 
|---|
| [551] | 2834 |           if (pre->fEmphasisMask & CRA_SELECTED) {
 | 
|---|
 | 2835 |             if (pci->rc.flRecordAttr & CRA_SELECTED) {
 | 
|---|
 | 2836 |               dcd->selectedbytes += (pci->cbFile + pci->easize);
 | 
|---|
 | 2837 |               dcd->selectedfiles++;
 | 
|---|
| [194] | 2838 |             }
 | 
|---|
| [551] | 2839 |             else if (dcd->selectedfiles) {
 | 
|---|
 | 2840 |               dcd->selectedbytes -= (pci->cbFile + pci->easize);
 | 
|---|
 | 2841 |               dcd->selectedfiles--;
 | 
|---|
| [194] | 2842 |             }
 | 
|---|
| [551] | 2843 |             if (!dcd->suspendview) {
 | 
|---|
 | 2844 |               commafmt(tf, sizeof(tf), dcd->selectedfiles);
 | 
|---|
 | 2845 |               CommaFmtULL(tb, sizeof(tb), dcd->selectedbytes, ' ');
 | 
|---|
| [194] | 2846 |               sprintf(s, "%s / %s", tf, tb);
 | 
|---|
| [551] | 2847 |               WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, s);
 | 
|---|
| [194] | 2848 |             }
 | 
|---|
 | 2849 |           }
 | 
|---|
| [551] | 2850 |           if (!dcd->suspendview &&
 | 
|---|
 | 2851 |               WinQueryActiveWindow(dcd->hwndParent) == dcd->hwndFrame) {
 | 
|---|
 | 2852 |             if (pre->fEmphasisMask & CRA_CURSORED) {
 | 
|---|
 | 2853 |               if (pci->rc.flRecordAttr & CRA_CURSORED) {
 | 
|---|
| [444] | 2854 |                 if (fSplitStatus && hwndStatus2) {
 | 
|---|
| [551] | 2855 |                   if (pci->attrFile & FILE_DIRECTORY)
 | 
|---|
 | 2856 |                     p = pci->pszFileName;
 | 
|---|
| [444] | 2857 |                   else {
 | 
|---|
| [730] | 2858 |                     p = strrchr(pci->pszFileName, '\\');
 | 
|---|
| [444] | 2859 |                     if (p) {
 | 
|---|
| [194] | 2860 |                       if (*(p + 1))
 | 
|---|
 | 2861 |                         p++;
 | 
|---|
 | 2862 |                       else
 | 
|---|
| [551] | 2863 |                         p = pci->pszFileName;
 | 
|---|
| [194] | 2864 |                     }
 | 
|---|
 | 2865 |                     else
 | 
|---|
| [551] | 2866 |                       p = pci->pszFileName;
 | 
|---|
| [194] | 2867 |                   }
 | 
|---|
| [551] | 2868 |                   CommaFmtULL(tb, sizeof(tb), pci->cbFile + pci->easize, ' ');
 | 
|---|
| [1456] | 2869 |                   if (!fMoreButtons) {
 | 
|---|
 | 2870 |                     DateFormat(szDate, pci->date);
 | 
|---|
| [1395] | 2871 |                     sprintf(s, " %s  %s %02u%s%02u%s%02u  [%s]  %s",
 | 
|---|
 | 2872 |                             tb, szDate, pci->time.hours, TimeSeparator,
 | 
|---|
 | 2873 |                             pci->time.minutes, TimeSeparator, pci->time.seconds,
 | 
|---|
| [1456] | 2874 |                             pci->pszDispAttr, p);
 | 
|---|
 | 2875 |                   }
 | 
|---|
| [444] | 2876 |                   else {
 | 
|---|
| [551] | 2877 |                     if (pci->cbFile + pci->easize > 1024)
 | 
|---|
 | 2878 |                       CommaFmtULL(tf, sizeof(tf), pci->cbFile + pci->easize,
 | 
|---|
 | 2879 |                                   ' ');
 | 
|---|
| [194] | 2880 |                     else
 | 
|---|
 | 2881 |                       *tf = 0;
 | 
|---|
 | 2882 |                     sprintf(s, GetPString(IDS_STATUSSIZETEXT),
 | 
|---|
 | 2883 |                             tb,
 | 
|---|
| [551] | 2884 |                             *tf ? " (" : NullStr, tf, *tf ? ")" : NullStr);
 | 
|---|
| [194] | 2885 |                   }
 | 
|---|
 | 2886 |                   WinSetWindowText(hwndStatus2, s);
 | 
|---|
 | 2887 |                 }
 | 
|---|
| [444] | 2888 |                 if (fMoreButtons) {
 | 
|---|
| [1456] | 2889 |                   WinSetWindowText(hwndName, pci->pszFileName);
 | 
|---|
 | 2890 |                   DateFormat(szDate, pci->date);
 | 
|---|
| [1395] | 2891 |                   sprintf(s, "%s %02u%s%02u%s%02u",
 | 
|---|
 | 2892 |                           szDate, pci->time.hours, TimeSeparator, pci->time.minutes,
 | 
|---|
 | 2893 |                           TimeSeparator, pci->time.seconds);
 | 
|---|
| [194] | 2894 |                   WinSetWindowText(hwndDate, s);
 | 
|---|
| [551] | 2895 |                   WinSetWindowText(hwndAttr, pci->pszDispAttr);
 | 
|---|
| [194] | 2896 |                 }
 | 
|---|
 | 2897 |               }
 | 
|---|
 | 2898 |             }
 | 
|---|
 | 2899 |           }
 | 
|---|
| [551] | 2900 |           if (!dcd->suspendview && hwndMain &&
 | 
|---|
 | 2901 |               (pre->fEmphasisMask & CRA_CURSORED) &&
 | 
|---|
 | 2902 |               (pci->rc.flRecordAttr & CRA_CURSORED) &&
 | 
|---|
 | 2903 |               WinQueryActiveWindow(dcd->hwndParent) == dcd->hwndFrame)
 | 
|---|
| [194] | 2904 |             WinSendMsg(hwndMain, UM_LOADFILE,
 | 
|---|
| [551] | 2905 |                        MPFROMP(((fComments
 | 
|---|
 | 2906 |                                  || (pci->attrFile & FILE_DIRECTORY) ==
 | 
|---|
| [730] | 2907 |                                  0) ? pci->pszFileName : NULL)), MPVOID);
 | 
|---|
| [194] | 2908 |         }
 | 
|---|
 | 2909 |         break;
 | 
|---|
| [2] | 2910 | 
 | 
|---|
| [194] | 2911 |       case CN_ENTER:
 | 
|---|
| [444] | 2912 |         if (mp2) {
 | 
|---|
| [551] | 2913 |           PCNRITEM pci = (PCNRITEM) ((PNOTIFYRECORDENTER) mp2)->pRecord;
 | 
|---|
| [847] | 2914 |           FILEFINDBUF3 ffb;
 | 
|---|
| [194] | 2915 |           HDIR hDir = HDIR_CREATE;
 | 
|---|
| [750] | 2916 |           ULONG nm = 1;
 | 
|---|
| [194] | 2917 |           APIRET status = 0;
 | 
|---|
| [2] | 2918 | 
 | 
|---|
| [194] | 2919 |           SetShiftState();
 | 
|---|
| [444] | 2920 |           if (pci) {
 | 
|---|
| [551] | 2921 |             if (pci->rc.flRecordAttr & CRA_INUSE)
 | 
|---|
| [194] | 2922 |               break;
 | 
|---|
 | 2923 |             DosError(FERR_DISABLEHARDERR);
 | 
|---|
| [847] | 2924 |             status = DosFindFirst(pci->pszFileName, &hDir,
 | 
|---|
| [907] | 2925 |                                    FILE_NORMAL | FILE_DIRECTORY |
 | 
|---|
| [838] | 2926 |                                    FILE_ARCHIVED | FILE_READONLY |
 | 
|---|
 | 2927 |                                    FILE_HIDDEN | FILE_SYSTEM,
 | 
|---|
| [847] | 2928 |                                    &ffb, sizeof(ffb), &nm, FIL_STANDARD);
 | 
|---|
| [194] | 2929 |             priority_bumped();
 | 
|---|
| [444] | 2930 |             if (!status) {
 | 
|---|
| [194] | 2931 |               DosFindClose(hDir);
 | 
|---|
| [444] | 2932 |               if (ffb.attrFile & FILE_DIRECTORY) {
 | 
|---|
| [551] | 2933 |                 if ((shiftstate & (KC_CTRL | KC_ALT)) == (KC_CTRL | KC_ALT))
 | 
|---|
| [194] | 2934 |                   PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_SHOWALLFILES, 0),
 | 
|---|
 | 2935 |                           MPVOID);
 | 
|---|
 | 2936 |                 else if ((shiftstate & (KC_CTRL | KC_SHIFT)) ==
 | 
|---|
 | 2937 |                          (KC_CTRL | KC_SHIFT))
 | 
|---|
| [730] | 2938 |                   OpenObject(pci->pszFileName, Settings, dcd->hwndFrame);
 | 
|---|
| [194] | 2939 |                 else if (shiftstate & KC_CTRL)
 | 
|---|
| [730] | 2940 |                   OpenObject(pci->pszFileName, Default, dcd->hwndFrame);
 | 
|---|
| [194] | 2941 |                 else
 | 
|---|
| [280] | 2942 |                   OpenDirCnr(HWND_DESKTOP,
 | 
|---|
| [194] | 2943 |                              hwndMain,
 | 
|---|
| [730] | 2944 |                              dcd->hwndFrame, FALSE, pci->pszFileName);
 | 
|---|
| [194] | 2945 |               }
 | 
|---|
| [444] | 2946 |               else {
 | 
|---|
| [194] | 2947 |                 SWP swp;
 | 
|---|
| [2] | 2948 | 
 | 
|---|
| [194] | 2949 |                 WinSendMsg(hwnd,
 | 
|---|
 | 2950 |                            CM_SETRECORDEMPHASIS,
 | 
|---|
| [551] | 2951 |                            MPFROMP(pci), MPFROM2SHORT(TRUE, CRA_INUSE));
 | 
|---|
 | 2952 |                 WinQueryWindowPos(dcd->hwndFrame, &swp);
 | 
|---|
| [194] | 2953 |                 DefaultViewKeys(hwnd,
 | 
|---|
| [551] | 2954 |                                 dcd->hwndFrame,
 | 
|---|
| [730] | 2955 |                                 dcd->hwndParent, &swp, pci->pszFileName);
 | 
|---|
| [194] | 2956 |                 WinSendMsg(hwnd,
 | 
|---|
 | 2957 |                            CM_SETRECORDEMPHASIS,
 | 
|---|
 | 2958 |                            MPFROMP(pci),
 | 
|---|
 | 2959 |                            MPFROM2SHORT(FALSE, CRA_INUSE |
 | 
|---|
 | 2960 |                                         ((fUnHilite) ? CRA_SELECTED : 0)));
 | 
|---|
 | 2961 |               }
 | 
|---|
 | 2962 |             }
 | 
|---|
 | 2963 |             else
 | 
|---|
| [751] | 2964 |               RemoveCnrItems(hwnd, pci, 1, CMA_FREE | CMA_INVALIDATE | CMA_ERASE);
 | 
|---|
| [194] | 2965 |           }
 | 
|---|
 | 2966 |         }
 | 
|---|
 | 2967 |         break;
 | 
|---|
| [2] | 2968 |       }
 | 
|---|
| [194] | 2969 |     }
 | 
|---|
 | 2970 |     return 0;
 | 
|---|
| [2] | 2971 | 
 | 
|---|
| [194] | 2972 |   case UM_LOADFILE:
 | 
|---|
| [444] | 2973 |     if (dcd && mp2) {
 | 
|---|
| [2] | 2974 | 
 | 
|---|
| [1037] | 2975 |       HWND hwnd;
 | 
|---|
 | 2976 | 
 | 
|---|
 | 2977 |       if ((INT)mp1 == 5 || (INT)mp1 == 13 || (INT)mp1 == 21)
 | 
|---|
| [1077] | 2978 |         hwnd = StartViewer(HWND_DESKTOP, (INT)mp1,
 | 
|---|
 | 2979 |                            (CHAR *)mp2, dcd->hwndFrame);
 | 
|---|
| [1037] | 2980 |       else
 | 
|---|
| [1077] | 2981 |         hwnd = StartMLEEditor(dcd->hwndParent,
 | 
|---|
 | 2982 |                               (INT)mp1, (CHAR *)mp2, dcd->hwndFrame);
 | 
|---|
| [1039] | 2983 |       free((CHAR *)mp2);
 | 
|---|
| [1037] | 2984 |       return MRFROMLONG(hwnd);
 | 
|---|
| [194] | 2985 |     }
 | 
|---|
 | 2986 |     return 0;
 | 
|---|
| [2] | 2987 | 
 | 
|---|
| [194] | 2988 |   case UM_CLOSE:
 | 
|---|
 | 2989 |     WinDestroyWindow(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
 | 
|---|
 | 2990 |                                     QW_PARENT));
 | 
|---|
 | 2991 |     return 0;
 | 
|---|
| [2] | 2992 | 
 | 
|---|
| [194] | 2993 |   case UM_FOLDUP:
 | 
|---|
| [551] | 2994 |     if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
 | 
|---|
| [194] | 2995 |       DosExit(EXIT_PROCESS, 1);
 | 
|---|
 | 2996 |     return 0;
 | 
|---|
| [2] | 2997 | 
 | 
|---|
| [194] | 2998 |   case WM_CLOSE:
 | 
|---|
| [444] | 2999 |     if (dcd) {
 | 
|---|
| [551] | 3000 |       dcd->namecanchange = TRUE;
 | 
|---|
 | 3001 |       dcd->stopflag = 1;
 | 
|---|
 | 3002 |       if (dcd->amextracted)
 | 
|---|
 | 3003 |         return 0;                       // Can not close yet
 | 
|---|
| [194] | 3004 |     }
 | 
|---|
 | 3005 |     WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
 | 
|---|
| [444] | 3006 |     if (dcd) {
 | 
|---|
| [551] | 3007 |       if (!dcd->dontclose && ParentIsDesktop(hwnd, dcd->hwndParent))
 | 
|---|
| [194] | 3008 |         PostMsg(hwnd, UM_FOLDUP, MPVOID, MPVOID);
 | 
|---|
| [551] | 3009 |       if (dcd->hwndObject) {
 | 
|---|
| [942] | 3010 |         DosSleep(32);                   // Allow UM_FOLDUP to process
 | 
|---|
| [551] | 3011 |         if (!PostMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID))
 | 
|---|
 | 3012 |           WinSendMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID);
 | 
|---|
| [2] | 3013 |       }
 | 
|---|
| [194] | 3014 |     }
 | 
|---|
 | 3015 |     else
 | 
|---|
 | 3016 |       WinSendMsg(hwnd, UM_CLOSE, MPVOID, MPVOID);
 | 
|---|
 | 3017 |     return 0;
 | 
|---|
| [2] | 3018 | 
 | 
|---|
| [194] | 3019 |   case WM_DESTROY:
 | 
|---|
 | 3020 |     if (CollectorDirMenu)
 | 
|---|
 | 3021 |       WinDestroyWindow(CollectorDirMenu);
 | 
|---|
 | 3022 |     if (CollectorFileMenu)
 | 
|---|
 | 3023 |       WinDestroyWindow(CollectorFileMenu);
 | 
|---|
 | 3024 |     if (CollectorCnrMenu)
 | 
|---|
 | 3025 |       WinDestroyWindow(CollectorCnrMenu);
 | 
|---|
| [551] | 3026 |     CollectorCnrMenu = CollectorFileMenu = CollectorDirMenu = (HWND) 0;
 | 
|---|
 | 3027 |     Collector = (HWND) 0;
 | 
|---|
| [194] | 3028 |     EmptyCnr(hwnd);
 | 
|---|
 | 3029 |     break;
 | 
|---|
| [2] | 3030 |   }
 | 
|---|
| [705] | 3031 |   if (dcd && dcd->oldproc){
 | 
|---|
 | 3032 |       return dcd->oldproc(hwnd, msg, mp1, mp2);
 | 
|---|
 | 3033 |   }
 | 
|---|
 | 3034 |   else
 | 
|---|
 | 3035 |       return PFNWPCnr(hwnd, msg, mp1, mp2);
 | 
|---|
| [2] | 3036 | }
 | 
|---|
 | 3037 | 
 | 
|---|
| [942] | 3038 | MRESULT EXPENTRY CollectorMenuProc(HWND hwnd, ULONG msg, MPARAM mp1,
 | 
|---|
 | 3039 |                                      MPARAM mp2)
 | 
|---|
 | 3040 | {
 | 
|---|
 | 3041 |   PFNWP oldMenuProc = WinQueryWindowPtr(hwnd, QWL_USER);
 | 
|---|
| [1077] | 3042 |   static short sLastMenuitem;
 | 
|---|
| [942] | 3043 | 
 | 
|---|
 | 3044 |   switch (msg) {
 | 
|---|
 | 3045 |     case WM_MOUSEMOVE: {
 | 
|---|
 | 3046 |       if (fOtherHelp) {
 | 
|---|
| [948] | 3047 |         RECTL rectl;
 | 
|---|
 | 3048 |         SHORT i, sCurrentMenuitem;
 | 
|---|
 | 3049 |         SHORT MenuItems = 5;
 | 
|---|
 | 3050 |         SHORT asMenuIDs[5] = {IDM_GREP,
 | 
|---|
 | 3051 |               IDM_SEEALL,
 | 
|---|
 | 3052 |               IDM_CLEARCNR,
 | 
|---|
 | 3053 |               IDM_REMOVE,
 | 
|---|
 | 3054 |               0};
 | 
|---|
| [1394] | 3055 |         PCSZ szHelpString = NULL;
 | 
|---|
| [942] | 3056 | 
 | 
|---|
| [948] | 3057 |         for (i=0; i<MenuItems; i++) {
 | 
|---|
 | 3058 |           sCurrentMenuitem = asMenuIDs[i];
 | 
|---|
 | 3059 |           oldMenuProc(hwnd,MM_QUERYITEMRECT,
 | 
|---|
 | 3060 |                       MPFROM2SHORT(asMenuIDs[i], FALSE),
 | 
|---|
 | 3061 |                       &rectl);
 | 
|---|
| [942] | 3062 | 
 | 
|---|
| [948] | 3063 |         if (MOUSEMSG(&msg)->x > rectl.xLeft &&
 | 
|---|
 | 3064 |             MOUSEMSG(&msg)->x < rectl.xRight &&
 | 
|---|
 | 3065 |             MOUSEMSG(&msg)->y > rectl.yBottom &&
 | 
|---|
 | 3066 |             MOUSEMSG(&msg)->y < rectl.yTop)
 | 
|---|
 | 3067 |            break;
 | 
|---|
| [1077] | 3068 |         } // for
 | 
|---|
| [942] | 3069 | 
 | 
|---|
| [948] | 3070 |          switch (sCurrentMenuitem) {
 | 
|---|
 | 3071 |          case 0:
 | 
|---|
 | 3072 |            break;
 | 
|---|
 | 3073 |          case IDM_GREP:
 | 
|---|
 | 3074 |            szHelpString = GetPString(IDS_COLMENUSEEKSCANHELP);
 | 
|---|
 | 3075 |            break;
 | 
|---|
 | 3076 |          case IDM_SEEALL:
 | 
|---|
 | 3077 |            szHelpString = GetPString(IDS_COLMENUSEEALLHELP);
 | 
|---|
 | 3078 |            break;
 | 
|---|
 | 3079 |          case IDM_CLEARCNR:
 | 
|---|
 | 3080 |            szHelpString = GetPString(IDS_COLMENUCLEARCNRHELP);
 | 
|---|
 | 3081 |            break;
 | 
|---|
 | 3082 |          case IDM_REMOVE:
 | 
|---|
 | 3083 |            szHelpString = GetPString(IDS_COLMENUREMOVECNRHELP);
 | 
|---|
 | 3084 |            break;
 | 
|---|
 | 3085 |          default:
 | 
|---|
 | 3086 |            break;
 | 
|---|
 | 3087 |          }
 | 
|---|
| [942] | 3088 | 
 | 
|---|
| [948] | 3089 |         if (sLastMenuitem != sCurrentMenuitem && szHelpString) {
 | 
|---|
 | 3090 |           sLastMenuitem = sCurrentMenuitem;
 | 
|---|
 | 3091 |           MakeBubble(hwnd, TRUE, szHelpString);
 | 
|---|
 | 3092 |         }
 | 
|---|
 | 3093 |         else if (hwndBubble && !sCurrentMenuitem){
 | 
|---|
 | 3094 |           sLastMenuitem = sCurrentMenuitem;
 | 
|---|
 | 3095 |           WinDestroyWindow(hwndBubble);
 | 
|---|
 | 3096 |         }
 | 
|---|
| [942] | 3097 |       }
 | 
|---|
 | 3098 |     }
 | 
|---|
 | 3099 |   }
 | 
|---|
 | 3100 |     return oldMenuProc(hwnd, msg, mp1, mp2);
 | 
|---|
 | 3101 | }
 | 
|---|
 | 3102 | 
 | 
|---|
| [194] | 3103 | HWND StartCollector(HWND hwndParent, INT flags)
 | 
|---|
| [155] | 3104 | {
 | 
|---|
| [551] | 3105 |   HWND hwndFrame = (HWND) 0;
 | 
|---|
| [197] | 3106 |   HWND hwndClient;
 | 
|---|
| [194] | 3107 |   ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
 | 
|---|
| [551] | 3108 |     FCF_SIZEBORDER | FCF_MINMAX | FCF_ICON | FCF_NOBYTEALIGN | FCF_ACCELTABLE;
 | 
|---|
| [194] | 3109 |   USHORT id;
 | 
|---|
 | 3110 |   DIRCNRDATA *dcd;
 | 
|---|
| [2] | 3111 | 
 | 
|---|
| [197] | 3112 |   static USHORT idinc = 0;
 | 
|---|
 | 3113 | 
 | 
|---|
| [194] | 3114 |   if (ParentIsDesktop(hwndParent, hwndParent))
 | 
|---|
| [2] | 3115 |     FrameFlags |= (FCF_TASKLIST | FCF_SHELLPOSITION | FCF_MENU);
 | 
|---|
| [444] | 3116 |   if (Collector) {
 | 
|---|
| [2] | 3117 |     WinSetWindowPos(WinQueryWindow(WinQueryWindow(Collector,
 | 
|---|
| [194] | 3118 |                                                   QW_PARENT),
 | 
|---|
 | 3119 |                                    QW_PARENT),
 | 
|---|
| [551] | 3120 |                     HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE);
 | 
|---|
 | 3121 |     return WinQueryWindow(WinQueryWindow(Collector, QW_PARENT), QW_PARENT);
 | 
|---|
| [2] | 3122 |   }
 | 
|---|
 | 3123 |   hwndFrame = WinCreateStdWindow(hwndParent,
 | 
|---|
| [194] | 3124 |                                  WS_VISIBLE,
 | 
|---|
 | 3125 |                                  &FrameFlags,
 | 
|---|
| [1498] | 3126 |                                  (CHAR *) WC_COLLECTOR,
 | 
|---|
| [194] | 3127 |                                  NULL,
 | 
|---|
 | 3128 |                                  WS_VISIBLE | fwsAnimate,
 | 
|---|
| [551] | 3129 |                                  FM3ModHandle, COLLECTOR_FRAME, &hwndClient);
 | 
|---|
| [444] | 3130 |   if (hwndFrame && hwndClient) {
 | 
|---|
| [2] | 3131 |     id = COLLECTOR_FRAME + idinc++;
 | 
|---|
| [194] | 3132 |     WinSetWindowUShort(hwndFrame, QWS_ID, id);
 | 
|---|
| [1063] | 3133 | #   ifdef FORTIFY
 | 
|---|
 | 3134 |     Fortify_EnterScope();
 | 
|---|
| [1077] | 3135 | #   endif
 | 
|---|
| [551] | 3136 |     dcd = xmallocz(sizeof(DIRCNRDATA), pszSrcFile, __LINE__);
 | 
|---|
| [377] | 3137 |     if (!dcd) {
 | 
|---|
| [1398] | 3138 |       Runtime_Error(pszSrcFile, __LINE__, NULL);
 | 
|---|
| [551] | 3139 |       PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
 | 
|---|
 | 3140 |       hwndFrame = (HWND) 0;
 | 
|---|
| [377] | 3141 |     }
 | 
|---|
 | 3142 |     else {
 | 
|---|
| [551] | 3143 |       dcd->size = sizeof(DIRCNRDATA);
 | 
|---|
 | 3144 |       dcd->id = id;
 | 
|---|
 | 3145 |       dcd->type = COLLECTOR_FRAME;
 | 
|---|
 | 3146 |       dcd->hwndParent = (hwndParent) ? hwndParent : HWND_DESKTOP;
 | 
|---|
 | 3147 |       dcd->hwndFrame = hwndFrame;
 | 
|---|
 | 3148 |       dcd->hwndClient = hwndClient;
 | 
|---|
| [194] | 3149 |       if (flags & 4)
 | 
|---|
| [551] | 3150 |         dcd->dontclose = TRUE;
 | 
|---|
| [2] | 3151 |       {
 | 
|---|
| [194] | 3152 |         PFNWP oldproc;
 | 
|---|
| [2] | 3153 | 
 | 
|---|
| [551] | 3154 |         oldproc = WinSubclassWindow(hwndFrame, (PFNWP) CollectorFrameWndProc);
 | 
|---|
 | 3155 |         WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID) oldproc);
 | 
|---|
| [2] | 3156 |       }
 | 
|---|
| [551] | 3157 |       dcd->hwndCnr = WinCreateWindow(hwndClient,
 | 
|---|
 | 3158 |                                      WC_CONTAINER,
 | 
|---|
 | 3159 |                                      NULL,
 | 
|---|
 | 3160 |                                      CCS_AUTOPOSITION | CCS_MINIICONS |
 | 
|---|
 | 3161 |                                      CCS_MINIRECORDCORE | ulCnrType |
 | 
|---|
 | 3162 |                                      WS_VISIBLE,
 | 
|---|
 | 3163 |                                      0,
 | 
|---|
 | 3164 |                                      0,
 | 
|---|
 | 3165 |                                      0,
 | 
|---|
 | 3166 |                                      0,
 | 
|---|
 | 3167 |                                      hwndClient,
 | 
|---|
 | 3168 |                                      HWND_TOP,
 | 
|---|
 | 3169 |                                      (ULONG) COLLECTOR_CNR, NULL, NULL);
 | 
|---|
 | 3170 |       if (!dcd->hwndCnr) {
 | 
|---|
| [1395] | 3171 |         Win_Error(hwndClient, hwndClient, pszSrcFile, __LINE__,
 | 
|---|
 | 3172 |                   PCSZ_WINCREATEWINDOW);
 | 
|---|
| [551] | 3173 |         PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
 | 
|---|
| [1077] | 3174 |         free(dcd);
 | 
|---|
| [551] | 3175 |         hwndFrame = (HWND) 0;
 | 
|---|
| [377] | 3176 |       }
 | 
|---|
 | 3177 |       else {
 | 
|---|
| [551] | 3178 |         Collector = dcd->hwndCnr;
 | 
|---|
 | 3179 |         WinSetWindowPtr(dcd->hwndCnr, QWL_USER, (PVOID) dcd);
 | 
|---|
| [1498] | 3180 |         WinSetWindowText(hwndFrame, (CHAR *) GetPString(IDS_COLLECTORTITLETEXT));
 | 
|---|
| [948] | 3181 |         if (FrameFlags & FCF_MENU) {
 | 
|---|
 | 3182 |           PFNWP oldmenuproc;
 | 
|---|
 | 3183 |           HWND hwndMenu = WinWindowFromID(hwndFrame, FID_MENU);
 | 
|---|
| [942] | 3184 | 
 | 
|---|
 | 3185 |           oldmenuproc = WinSubclassWindow(hwndMenu, (PFNWP) CollectorMenuProc);
 | 
|---|
 | 3186 |           WinSetWindowPtr(hwndMenu, QWL_USER, (PVOID) oldmenuproc);
 | 
|---|
| [444] | 3187 |           if (!fToolbar) {
 | 
|---|
| [948] | 3188 |             if (hwndMenu) {
 | 
|---|
| [2] | 3189 | 
 | 
|---|
| [194] | 3190 |               WinSendMsg(hwndMenu,
 | 
|---|
 | 3191 |                          MM_DELETEITEM,
 | 
|---|
| [551] | 3192 |                          MPFROM2SHORT(IDM_SEEALL, FALSE), MPVOID);
 | 
|---|
| [194] | 3193 |               WinSendMsg(hwndMenu,
 | 
|---|
 | 3194 |                          MM_DELETEITEM,
 | 
|---|
| [551] | 3195 |                          MPFROM2SHORT(IDM_GREP, FALSE), MPVOID);
 | 
|---|
| [194] | 3196 |               WinSendMsg(hwndMenu,
 | 
|---|
 | 3197 |                          MM_DELETEITEM,
 | 
|---|
| [551] | 3198 |                          MPFROM2SHORT(IDM_CLEARCNR, FALSE), MPVOID);
 | 
|---|
| [194] | 3199 |               WinSendMsg(hwndMenu,
 | 
|---|
 | 3200 |                          MM_DELETEITEM,
 | 
|---|
| [551] | 3201 |                          MPFROM2SHORT(IDM_REMOVE, FALSE), MPVOID);
 | 
|---|
| [194] | 3202 |             }
 | 
|---|
 | 3203 |           }
 | 
|---|
 | 3204 |         }
 | 
|---|
| [551] | 3205 |         dcd->oldproc = WinSubclassWindow(dcd->hwndCnr,
 | 
|---|
 | 3206 |                                          (PFNWP) CollectorCnrWndProc);
 | 
|---|
| [194] | 3207 |         {
 | 
|---|
| [942] | 3208 |           USHORT ids[] = { DIR_TOTALS,
 | 
|---|
 | 3209 |                            DIR_SELECTED,
 | 
|---|
 | 3210 |                            DIR_VIEW,
 | 
|---|
 | 3211 |                            DIR_SORT,
 | 
|---|
 | 3212 |                            DIR_FILTER,
 | 
|---|
 | 3213 |                            0
 | 
|---|
| [551] | 3214 |           };
 | 
|---|
| [2] | 3215 | 
 | 
|---|
| [551] | 3216 |           CommonCreateTextChildren(dcd->hwndClient,
 | 
|---|
| [593] | 3217 |                                    WC_COLSTATUS, ids);
 | 
|---|
| [194] | 3218 |         }
 | 
|---|
 | 3219 |         if (FrameFlags & FCF_SHELLPOSITION)
 | 
|---|
| [551] | 3220 |           PostMsg(hwndClient, UM_SIZE, MPVOID, MPVOID);
 | 
|---|
 | 3221 |         if (!PostMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID))
 | 
|---|
 | 3222 |           WinSendMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID);
 | 
|---|
| [2] | 3223 |       }
 | 
|---|
 | 3224 |     }
 | 
|---|
| [1077] | 3225 | #   ifdef FORTIFY
 | 
|---|
| [1563] | 3226 |     DosSleep(1);                        // Let receiver take ownership
 | 
|---|
| [1077] | 3227 |     Fortify_LeaveScope();
 | 
|---|
 | 3228 | #   endif
 | 
|---|
| [2] | 3229 |   }
 | 
|---|
 | 3230 |   return hwndFrame;
 | 
|---|
 | 3231 | }
 | 
|---|
| [793] | 3232 | 
 | 
|---|
 | 3233 | #pragma alloc_text(COLLECTOR,CollectorCnrWndProc,CollectorObjWndProc)
 | 
|---|
 | 3234 | #pragma alloc_text(COLLECTOR,CollectorClientWndProc,CollectorTextProc)
 | 
|---|
 | 3235 | #pragma alloc_text(COLLECTOR,CollectorFrameWndProc)
 | 
|---|
 | 3236 | #pragma alloc_text(STARTUP,StartCollector)
 | 
|---|