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