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