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