| [36] | 1 |  | 
|---|
|  | 2 | /*********************************************************************** | 
|---|
|  | 3 |  | 
|---|
|  | 4 | $Id: seeall.c 1559 2010-12-01 22:16:31Z stevenhl $ | 
|---|
|  | 5 |  | 
|---|
|  | 6 | See all matching files | 
|---|
|  | 7 |  | 
|---|
|  | 8 | Copyright (c) 1993-98 M. Kimes | 
|---|
| [1498] | 9 | Copyright (c) 2001, 2010 Steven H. Levine | 
|---|
| [36] | 10 |  | 
|---|
| [130] | 11 | 16 Oct 02 SHL Handle large partitions | 
|---|
|  | 12 | 25 Nov 03 SHL StartSeeAll: avoid forgetting startpath | 
|---|
|  | 13 | 06 Dec 03 SHL StartSeeAll: correct malloc arg oops | 
|---|
|  | 14 | 23 May 05 SHL Use QWL_USER | 
|---|
| [162] | 15 | 25 May 05 SHL Use ULONGLONG and CommaFmtULL | 
|---|
| [186] | 16 | 05 Jun 05 SHL Use QWL_USER | 
|---|
| [204] | 17 | 06 Jun 05 SHL Drop unused code | 
|---|
| [302] | 18 | 29 May 06 SHL Comments | 
|---|
| [335] | 19 | 17 Jul 06 SHL Use Runtime_Error | 
|---|
| [517] | 20 | 19 Oct 06 SHL Correct . and .. detect | 
|---|
| [533] | 21 | 03 Nov 06 SHL Renames | 
|---|
|  | 22 | 03 Nov 06 SHL Count thread usage | 
|---|
| [593] | 23 | 30 Mar 07 GKY Remove GetPString for window class names | 
|---|
| [783] | 24 | 03 Aug 07 GKY Enlarged and made setable everywhere Findbuf (speeds file loading) | 
|---|
| [775] | 25 | 06 Aug 07 GKY Reduce DosSleep times (ticket 148) | 
|---|
| [773] | 26 | 07 Aug 07 SHL Use BldQuotedFullPathName and BldQuotedFileName | 
|---|
| [783] | 27 | 13 Aug 07 SHL Sync code with other FilesToGet usage | 
|---|
|  | 28 | 13 Aug 07 SHL Move #pragma alloc_text to end for OpenWatcom compat | 
|---|
| [787] | 29 | 14 Aug 07 SHL Revert to DosSleep(0) to speed up inner loops | 
|---|
|  | 30 | 14 Aug 07 SHL Drop afFilesToGet | 
|---|
| [814] | 31 | 26 Aug 07 GKY DosSleep(1) in loops changed to (0) | 
|---|
| [846] | 32 | 27 Sep 07 SHL Correct ULONGLONG size formatting | 
|---|
| [897] | 33 | 30 Dec 07 GKY Use CommaFmtULL | 
|---|
|  | 34 | 30 Dec 07 GKY Use TestFDates for comparing by date | 
|---|
| [955] | 35 | 15 Feb 08 GKY Prevent trap on scan of drive containing files that exceed maxpath | 
|---|
| [985] | 36 | 29 Feb 08 GKY Use xfree where appropriate | 
|---|
|  | 37 | 29 Feb 08 GKY Refactor global command line variables to notebook.h | 
|---|
| [1084] | 38 | 20 Jul 08 GKY Add save/append filename to clipboard. | 
|---|
| [1335] | 39 | Change menu wording to make these easier to find | 
|---|
|  | 40 | 10 Dec 08 SHL Integrate exception handler support | 
|---|
| [1358] | 41 | 25 Dec 08 GKY Add code to allow write verify to be turned off on a per drive basis | 
|---|
| [1391] | 42 | 11 Jan 09 GKY Replace font names in the string file with global set at compile in init.c | 
|---|
|  | 43 | 11 Jan 08 GKY Change flag on GetMLEFont to 3 from 11 to give a larger selection of mono spaced fonts | 
|---|
| [1395] | 44 | 07 Feb 09 GKY Allow user to turn off alert and/or error beeps in settings notebook. | 
|---|
|  | 45 | 07 Feb 09 GKY Add *DateFormat functions to format dates based on locale | 
|---|
|  | 46 | 07 Feb 09 GKY Eliminate Win_Error2 by moving function names to PCSZs used in Win_Error | 
|---|
| [1400] | 47 | 08 Mar 09 GKY Renamed commafmt.h i18nutil.h | 
|---|
|  | 48 | 08 Mar 09 GKY Additional strings move to PCSZs in init.c | 
|---|
| [1402] | 49 | 08 Mar 09 GKY Removed variable aurguments from docopyf and unlinkf (not used) | 
|---|
| [1438] | 50 | 28 Jun 09 GKY Added AddBackslashToPath() to remove repeatative code. | 
|---|
| [1559] | 51 | 17 Jan 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *. | 
|---|
|  | 52 | 01 Dec 10 SHL Ensure FindAllThread thread quits fast when requested | 
|---|
| [36] | 53 |  | 
|---|
|  | 54 | ***********************************************************************/ | 
|---|
|  | 55 |  | 
|---|
| [907] | 56 | #include <stdlib.h> | 
|---|
|  | 57 | #include <string.h> | 
|---|
|  | 58 | #include <ctype.h> | 
|---|
| [1335] | 59 | // #include <process.h> | 
|---|
| [907] | 60 |  | 
|---|
| [2] | 61 | #define INCL_DOS | 
|---|
|  | 62 | #define INCL_DOSERRORS | 
|---|
|  | 63 | #define INCL_WIN | 
|---|
|  | 64 | #define INCL_GPI | 
|---|
| [162] | 65 | #define INCL_LONGLONG | 
|---|
| [2] | 66 |  | 
|---|
| [1180] | 67 | #include "fm3dll.h" | 
|---|
| [1226] | 68 | #include "fm3dll2.h"                    // #define's for UM_*, control id's, etc. | 
|---|
|  | 69 | #include "seeall.h" | 
|---|
| [1212] | 70 | #include "mainwnd2.h"                   // Data declaration(s) | 
|---|
|  | 71 | #include "grep.h"                       // Data declaration(s) | 
|---|
|  | 72 | #include "arccnrs.h"                    // Data declaration(s) | 
|---|
|  | 73 | #include "init.h"                       // Data declaration(s) | 
|---|
|  | 74 | #include "worker.h"                     // Data declaration(s) | 
|---|
|  | 75 | #include "newview.h"                    // Data declarations | 
|---|
| [2] | 76 | #include "fm3dlg.h" | 
|---|
|  | 77 | #include "fm3str.h" | 
|---|
| [1335] | 78 | #include "pathutil.h"                   // BldQuotedFullPathName... | 
|---|
|  | 79 | #include "makelist.h"                   // AddToList | 
|---|
|  | 80 | #include "errutil.h"                    // Dos_Error... | 
|---|
|  | 81 | #include "strutil.h"                    // GetPString | 
|---|
|  | 82 | #include "notebook.h"                   // targetdirectory | 
|---|
|  | 83 | #include "copyf.h"                      // AdjustWildcardName, make_deleteable | 
|---|
|  | 84 | #include "attribs.h"                    // AttrListDlgProc | 
|---|
|  | 85 | #include "chklist.h"                    // CenterOverWindow, CheckListProc | 
|---|
|  | 86 | #include "colors.h"                     // ColorDlgProc | 
|---|
|  | 87 | #include "draglist.h"                   // DragList | 
|---|
|  | 88 | #include "extract.h"                    // ExtractDlgProc | 
|---|
|  | 89 | #include "info.h"                       // FileInfoProc | 
|---|
|  | 90 | #include "valid.h"                      // GetDesktopName, IsNewer, TestFDates | 
|---|
|  | 91 | #include "saveclip.h"                   // ListToClipboardHab, SaveAllListDlgProc | 
|---|
|  | 92 | #include "shadow.h"                     // MakeShadows | 
|---|
|  | 93 | #include "mkdir.h"                      // MassMkdir | 
|---|
|  | 94 | #include "objcnr.h"                     // ObjCnrDlgProc | 
|---|
|  | 95 | #include "codepage.h"                   // PickCodepage | 
|---|
|  | 96 | #include "printer.h"                    // PrintDlgProc, PrintListThread | 
|---|
|  | 97 | #include "rename.h"                     // RenameProc | 
|---|
|  | 98 | #include "uudecode.h"                   // UUD | 
|---|
| [1158] | 99 | #include "walkem.h"                     // WalkCopyDlgProc, WalkMoveDlgProc | 
|---|
| [1180] | 100 | #include "archive.h"                    // ArchiveDlgProc | 
|---|
|  | 101 | #include "common.h"                     // CommonTextProc, DecrThreadUsage, IncrThreadUsage | 
|---|
|  | 102 | #include "defview.h"                    // DefaultViewKeys | 
|---|
|  | 103 | #include "eas.h"                        // DisplayEAsProc | 
|---|
|  | 104 | #include "mainwnd.h"                    // GetNextWindowPos | 
|---|
|  | 105 | #include "filter.h"                     // PickMaskDlgProc | 
|---|
|  | 106 | #include "avl.h"                        // SBoxDlgProc | 
|---|
|  | 107 | #include "collect.h"                    // StartCollector | 
|---|
|  | 108 | #include "subj.h"                       // Subject | 
|---|
| [1400] | 109 | #include "i18nutil.h"                   // commafmt | 
|---|
| [1180] | 110 | #include "literal.h"                    // wildcard | 
|---|
|  | 111 | #include "wrappers.h"                   // xDosFindNext | 
|---|
| [1335] | 112 | #include "misc.h"                       // SetConditionalCascade | 
|---|
| [1180] | 113 | #include "fonts.h"                      // SetMLEFont | 
|---|
|  | 114 | #include "stristr.h"                    // stristr | 
|---|
|  | 115 | #include "systemf.h"                    // runemf2 | 
|---|
| [1018] | 116 | #include "fortify.h" | 
|---|
| [1335] | 117 | #include "excputil.h"                   // xbeginthread | 
|---|
| [1018] | 118 |  | 
|---|
| [2] | 119 | #pragma data_seg(DATA2) | 
|---|
| [335] | 120 |  | 
|---|
|  | 121 | static PSZ pszSrcFile = __FILE__; | 
|---|
|  | 122 |  | 
|---|
| [551] | 123 | typedef struct | 
|---|
|  | 124 | { | 
|---|
|  | 125 | CHAR *fullname, *filename; | 
|---|
|  | 126 | USHORT attrFile, flags; | 
|---|
|  | 127 | FDATE date; | 
|---|
|  | 128 | FTIME time; | 
|---|
| [841] | 129 | ULONGLONG cbFile; | 
|---|
|  | 130 | ULONG CRC; | 
|---|
| [551] | 131 | } | 
|---|
|  | 132 | ALLFILES; | 
|---|
| [2] | 133 |  | 
|---|
|  | 134 | #define AF_SELECTED     0x0001 | 
|---|
|  | 135 | #define AF_DELETED      0x0002 | 
|---|
|  | 136 | #define AF_FILTERED     0x0004 | 
|---|
|  | 137 | #define AF_DUPE         0x0008 | 
|---|
|  | 138 | #define AF_CRCED        0x0010 | 
|---|
|  | 139 |  | 
|---|
|  | 140 | #define AFM_MARK        0 | 
|---|
|  | 141 | #define AFM_UNMARK      1 | 
|---|
|  | 142 | #define AFM_INVERT      2 | 
|---|
|  | 143 | #define AFM_MARKDELETED 3 | 
|---|
|  | 144 | #define AFM_FILTER      4 | 
|---|
|  | 145 |  | 
|---|
|  | 146 | #define DP_NAMES        0x0001 | 
|---|
|  | 147 | #define DP_DATES        0x0002 | 
|---|
|  | 148 | #define DP_SIZES        0x0004 | 
|---|
|  | 149 | #define DP_CRCS         0x0008 | 
|---|
|  | 150 | #define DP_EXTS         0x0010 | 
|---|
|  | 151 |  | 
|---|
| [1433] | 152 | #define SEEALLFILECNR_FONT_LCID 15 | 
|---|
| [2] | 153 |  | 
|---|
|  | 154 | #define COLORS_MAX                   8 | 
|---|
|  | 155 |  | 
|---|
|  | 156 | #define COLORS_CURSOREDNORMALBACK    0 | 
|---|
|  | 157 | #define COLORS_CURSOREDSELECTEDBACK  1 | 
|---|
|  | 158 | #define COLORS_NORMALBACK            2 | 
|---|
|  | 159 | #define COLORS_SELECTEDBACK          3 | 
|---|
|  | 160 | #define COLORS_SELECTEDNORMALFORE    4 | 
|---|
|  | 161 | #define COLORS_NORMALFORE            5 | 
|---|
|  | 162 | #define COLORS_READONLYFORE          6 | 
|---|
|  | 163 | #define COLORS_SYSTEMFORE            7 | 
|---|
|  | 164 |  | 
|---|
| [551] | 165 | static LONG Colors[COLORS_MAX] = { COLR_WHITE, COLR_DARKGRAY, COLR_PALEGRAY, | 
|---|
|  | 166 | COLR_BLACK, COLR_WHITE, COLR_BLACK, | 
|---|
|  | 167 | COLR_DARKBLUE, COLR_DARKRED | 
|---|
|  | 168 | }; | 
|---|
| [2] | 169 |  | 
|---|
| [551] | 170 | typedef int (FNSORT) (const void *, const void *); | 
|---|
| [2] | 171 | typedef FNSORT *PFNSORT; | 
|---|
|  | 172 |  | 
|---|
| [551] | 173 | typedef struct | 
|---|
|  | 174 | { | 
|---|
|  | 175 | USHORT size; | 
|---|
|  | 176 | USHORT dupeflags; | 
|---|
|  | 177 | ALLFILES *afhead; | 
|---|
|  | 178 | ALLFILES **afindex; | 
|---|
| [943] | 179 | ULONG afheadcnt; | 
|---|
| [551] | 180 | ULONG afalloc; | 
|---|
|  | 181 | ULONG longest; | 
|---|
|  | 182 | ULONG longestw; | 
|---|
|  | 183 | ULONG topfile; | 
|---|
|  | 184 | ULONG cursored; | 
|---|
|  | 185 | ULONG selected; | 
|---|
|  | 186 | ULONGLONG ullSelectedBytes; | 
|---|
| [943] | 187 | ULONG afindexcnt; | 
|---|
| [551] | 188 | ULONG lastselected; | 
|---|
|  | 189 | ULONG lastdirection; | 
|---|
|  | 190 | ULONG multiplier; | 
|---|
|  | 191 | ULONG lasttime; | 
|---|
|  | 192 | CHAR stopflag; | 
|---|
|  | 193 | CHAR abDrvFlags[26]; | 
|---|
|  | 194 | CHAR szCommonName[CCHMAXPATH]; | 
|---|
|  | 195 | CHAR szFindPath[CCHMAXPATH]; | 
|---|
|  | 196 | LONG lMaxAscender; | 
|---|
|  | 197 | LONG lMaxDescender; | 
|---|
|  | 198 | LONG lMaxHeight; | 
|---|
|  | 199 | LONG maxx; | 
|---|
|  | 200 | LONG horzscroll; | 
|---|
|  | 201 | BOOL fullnames; | 
|---|
|  | 202 | BOOL invertsort; | 
|---|
|  | 203 | BOOL mousecaptured; | 
|---|
|  | 204 | HMTX hmtxScan; | 
|---|
|  | 205 | HWND hvscroll; | 
|---|
|  | 206 | HWND hhscroll; | 
|---|
|  | 207 | HWND hwndMenu; | 
|---|
|  | 208 | HWND hwndObj; | 
|---|
|  | 209 | HWND hwndClient; | 
|---|
|  | 210 | HWND hwndPopup; | 
|---|
|  | 211 | HWND hwndStatus; | 
|---|
|  | 212 | HWND hwndFrame; | 
|---|
|  | 213 | HPS hps; | 
|---|
|  | 214 | PFNSORT pfnCompare; | 
|---|
|  | 215 | MASK mask; | 
|---|
|  | 216 | FATTRS fattrs; | 
|---|
|  | 217 | LONG aulColors[8]; | 
|---|
|  | 218 | BOOL killme; | 
|---|
|  | 219 | } | 
|---|
|  | 220 | ALLDATA; | 
|---|
| [2] | 221 |  | 
|---|
| [551] | 222 | static BOOL Fullnames = FALSE; | 
|---|
|  | 223 | static BOOL Firsttime = TRUE; | 
|---|
|  | 224 | static BOOL SortReverse; | 
|---|
|  | 225 | static USHORT Codepage, SortType; | 
|---|
| [2] | 226 | static FATTRS Fattrs; | 
|---|
|  | 227 |  | 
|---|
| [551] | 228 | extern LONG CRCFile(CHAR * filename, INT * error); | 
|---|
| [2] | 229 |  | 
|---|
| [551] | 230 | MRESULT EXPENTRY DupeDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 
|---|
| [162] | 231 | { | 
|---|
| [551] | 232 | switch (msg) { | 
|---|
|  | 233 | case WM_INITDLG: | 
|---|
|  | 234 | { | 
|---|
|  | 235 | USHORT flags = SHORT1FROMMP(mp2); | 
|---|
| [2] | 236 |  | 
|---|
| [551] | 237 | WinCheckButton(hwnd, DUPE_NAMES, ((flags & DP_NAMES) != 0)); | 
|---|
|  | 238 | WinCheckButton(hwnd, DUPE_DATES, ((flags & DP_NAMES) != 0)); | 
|---|
|  | 239 | WinCheckButton(hwnd, DUPE_SIZES, ((flags & DP_NAMES) != 0)); | 
|---|
|  | 240 | WinCheckButton(hwnd, DUPE_CRCS, ((flags & DP_NAMES) != 0)); | 
|---|
|  | 241 | if (!(flags & DP_NAMES)) | 
|---|
| [1335] | 242 | WinEnableWindow(WinWindowFromID(hwnd, DUPE_EXTS), FALSE); | 
|---|
| [551] | 243 | } | 
|---|
|  | 244 | break; | 
|---|
|  | 245 |  | 
|---|
|  | 246 | case WM_CONTROL: | 
|---|
|  | 247 | switch (SHORT1FROMMP(mp1)) { | 
|---|
|  | 248 | case DUPE_NAMES: | 
|---|
|  | 249 | if (WinQueryButtonCheckstate(hwnd, DUPE_NAMES)) | 
|---|
| [1335] | 250 | WinEnableWindow(WinWindowFromID(hwnd, DUPE_EXTS), TRUE); | 
|---|
| [551] | 251 | else { | 
|---|
| [1335] | 252 | WinCheckButton(hwnd, DUPE_EXTS, FALSE); | 
|---|
|  | 253 | WinEnableWindow(WinWindowFromID(hwnd, DUPE_EXTS), FALSE); | 
|---|
| [2] | 254 | } | 
|---|
|  | 255 | break; | 
|---|
| [551] | 256 | case DUPE_SIZES: | 
|---|
|  | 257 | if (!WinQueryButtonCheckstate(hwnd, DUPE_SIZES)) | 
|---|
| [1335] | 258 | WinCheckButton(hwnd, DUPE_CRCS, FALSE); | 
|---|
| [551] | 259 | break; | 
|---|
|  | 260 | case DUPE_CRCS: | 
|---|
|  | 261 | if (WinQueryButtonCheckstate(hwnd, DUPE_CRCS)) | 
|---|
| [1335] | 262 | WinCheckButton(hwnd, DUPE_SIZES, TRUE); | 
|---|
| [551] | 263 | break; | 
|---|
|  | 264 | } | 
|---|
|  | 265 | return 0; | 
|---|
| [2] | 266 |  | 
|---|
| [551] | 267 | case WM_COMMAND: | 
|---|
|  | 268 | switch (SHORT1FROMMP(mp1)) { | 
|---|
|  | 269 | case DID_OK: | 
|---|
|  | 270 | { | 
|---|
| [1335] | 271 | USHORT flags = 0; | 
|---|
| [551] | 272 |  | 
|---|
| [1335] | 273 | if (WinQueryButtonCheckstate(hwnd, DUPE_NAMES)) { | 
|---|
|  | 274 | flags |= DP_NAMES; | 
|---|
|  | 275 | if (WinQueryButtonCheckstate(hwnd, DUPE_EXTS)) | 
|---|
|  | 276 | flags |= DP_EXTS; | 
|---|
|  | 277 | } | 
|---|
|  | 278 | if (WinQueryButtonCheckstate(hwnd, DUPE_DATES)) | 
|---|
|  | 279 | flags |= DP_DATES; | 
|---|
|  | 280 | if (WinQueryButtonCheckstate(hwnd, DUPE_SIZES)) { | 
|---|
|  | 281 | flags |= DP_SIZES; | 
|---|
|  | 282 | if (WinQueryButtonCheckstate(hwnd, DUPE_CRCS)) | 
|---|
|  | 283 | flags |= (DP_CRCS | DP_SIZES); | 
|---|
|  | 284 | } | 
|---|
|  | 285 | if (!flags) | 
|---|
|  | 286 | saymsg(MB_ENTER, | 
|---|
|  | 287 | hwnd, | 
|---|
|  | 288 | GetPString(IDS_ERRORTEXT), | 
|---|
| [1402] | 289 | GetPString(IDS_CHECKONETEXT)); | 
|---|
| [1335] | 290 | else | 
|---|
|  | 291 | WinDismissDlg(hwnd, flags); | 
|---|
| [2] | 292 | } | 
|---|
| [551] | 293 | break; | 
|---|
| [2] | 294 |  | 
|---|
| [551] | 295 | case DID_CANCEL: | 
|---|
|  | 296 | WinDismissDlg(hwnd, 0); | 
|---|
|  | 297 | break; | 
|---|
| [2] | 298 |  | 
|---|
| [551] | 299 | case IDM_HELP: | 
|---|
|  | 300 | if (hwndHelp) | 
|---|
| [1335] | 301 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP, | 
|---|
|  | 302 | MPFROM2SHORT(HELP_DUPES, 0), MPFROMSHORT(HM_RESOURCEID)); | 
|---|
| [551] | 303 | break; | 
|---|
|  | 304 | } | 
|---|
|  | 305 | return 0; | 
|---|
| [2] | 306 | } | 
|---|
| [551] | 307 | return WinDefDlgProc(hwnd, msg, mp1, mp2); | 
|---|
| [2] | 308 | } | 
|---|
|  | 309 |  | 
|---|
| [551] | 310 | static ULONG NumLines(RECTL * rcl, ALLDATA * ad) | 
|---|
| [162] | 311 | { | 
|---|
| [2] | 312 | ULONG numlines; | 
|---|
|  | 313 |  | 
|---|
|  | 314 | numlines = (rcl->yTop - rcl->yBottom) / ad->lMaxHeight; | 
|---|
| [551] | 315 | if (ad->lMaxDescender && numlines && | 
|---|
|  | 316 | ((rcl->yTop - rcl->yBottom) - | 
|---|
|  | 317 | (numlines * ad->lMaxHeight) <= ad->lMaxDescender)) | 
|---|
| [2] | 318 | numlines--; | 
|---|
|  | 319 | return numlines; | 
|---|
|  | 320 | } | 
|---|
|  | 321 |  | 
|---|
| [551] | 322 | MRESULT EXPENTRY SeeObjWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 
|---|
| [50] | 323 | { | 
|---|
| [551] | 324 | switch (msg) { | 
|---|
|  | 325 | case UM_MASSACTION: | 
|---|
|  | 326 | { | 
|---|
|  | 327 | CHAR **files = NULL, **list = (CHAR **) mp2, path[CCHMAXPATH]; | 
|---|
| [907] | 328 | UINT numfiles = 0, numalloc = 0; | 
|---|
|  | 329 | INT plen = 0; | 
|---|
| [551] | 330 | HWND hwndFrame = WinQueryWindowULong(hwnd, QWL_USER); | 
|---|
|  | 331 | CHAR message[CCHMAXPATH * 2], wildname[CCHMAXPATH]; | 
|---|
|  | 332 | register INT x; | 
|---|
|  | 333 | register CHAR *p, *pp; | 
|---|
|  | 334 | BOOL dontask = FALSE, wildcarding = FALSE, | 
|---|
| [1335] | 335 | overold = FALSE, overnew = FALSE; | 
|---|
| [2] | 336 |  | 
|---|
| [551] | 337 | if (!list || !list[0]) | 
|---|
| [1335] | 338 | goto Abort; | 
|---|
| [551] | 339 | *path = *wildname = 0; | 
|---|
| [2] | 340 |  | 
|---|
| [551] | 341 | switch (SHORT1FROMMP(mp1)) { | 
|---|
|  | 342 | case IDM_MOVEPRESERVE: | 
|---|
| [1335] | 343 | { | 
|---|
|  | 344 | CHAR preserve[CCHMAXPATH], *end; | 
|---|
| [2] | 345 |  | 
|---|
| [1335] | 346 | mp1 = MPFROM2SHORT(IDM_MOVE, SHORT2FROMMP(mp1)); | 
|---|
|  | 347 | strcpy(preserve, list[0] + 2); | 
|---|
|  | 348 | end = strrchr(preserve, '\\'); | 
|---|
|  | 349 | if (end) { | 
|---|
|  | 350 | end++; | 
|---|
|  | 351 | for (x = 1; list[x]; x++) { | 
|---|
|  | 352 | p = preserve; | 
|---|
|  | 353 | pp = list[x] + 2; | 
|---|
|  | 354 | while (p < end && toupper(*p) == toupper(*pp)) { | 
|---|
|  | 355 | p++; | 
|---|
|  | 356 | pp++; | 
|---|
|  | 357 | } | 
|---|
|  | 358 | if (*p == '\\') | 
|---|
|  | 359 | p++; | 
|---|
|  | 360 | if (p < end) | 
|---|
|  | 361 | end = p; | 
|---|
|  | 362 | } | 
|---|
|  | 363 | *end = 0; | 
|---|
|  | 364 | } | 
|---|
|  | 365 | else | 
|---|
|  | 366 | *preserve = 0; | 
|---|
|  | 367 | plen = strlen(preserve); | 
|---|
|  | 368 | if (plen) | 
|---|
|  | 369 | plen += 2; | 
|---|
|  | 370 | } | 
|---|
|  | 371 | break; | 
|---|
| [551] | 372 | case IDM_COPYPRESERVE: | 
|---|
| [1335] | 373 | { | 
|---|
|  | 374 | CHAR preserve[CCHMAXPATH], *end; | 
|---|
| [2] | 375 |  | 
|---|
| [1335] | 376 | mp1 = MPFROM2SHORT(IDM_COPY, SHORT2FROMMP(mp1)); | 
|---|
|  | 377 | strcpy(preserve, list[0] + 2); | 
|---|
|  | 378 | end = strrchr(preserve, '\\'); | 
|---|
|  | 379 | if (end) { | 
|---|
|  | 380 | end++; | 
|---|
|  | 381 | for (x = 1; list[x]; x++) { | 
|---|
|  | 382 | p = preserve; | 
|---|
|  | 383 | pp = list[x] + 2; | 
|---|
|  | 384 | while (p < end && toupper(*p) == toupper(*pp)) { | 
|---|
|  | 385 | p++; | 
|---|
|  | 386 | pp++; | 
|---|
|  | 387 | } | 
|---|
|  | 388 | if (*p == '\\') | 
|---|
|  | 389 | p++; | 
|---|
|  | 390 | if (p < end) | 
|---|
|  | 391 | end = p; | 
|---|
|  | 392 | } | 
|---|
|  | 393 | *end = 0; | 
|---|
|  | 394 | } | 
|---|
|  | 395 | else | 
|---|
|  | 396 | *preserve = 0; | 
|---|
|  | 397 | plen = strlen(preserve); | 
|---|
|  | 398 | if (plen) | 
|---|
|  | 399 | plen += 2; | 
|---|
|  | 400 | } | 
|---|
|  | 401 | break; | 
|---|
| [551] | 402 | case IDM_WILDMOVE: | 
|---|
| [1335] | 403 | wildcarding = TRUE; | 
|---|
|  | 404 | mp1 = MPFROM2SHORT(IDM_MOVE, SHORT2FROMMP(mp1)); | 
|---|
|  | 405 | break; | 
|---|
| [551] | 406 | case IDM_WILDRENAME: | 
|---|
| [1335] | 407 | wildcarding = TRUE; | 
|---|
|  | 408 | mp1 = MPFROM2SHORT(IDM_RENAME, SHORT2FROMMP(mp1)); | 
|---|
|  | 409 | break; | 
|---|
| [551] | 410 | case IDM_WILDCOPY: | 
|---|
| [1335] | 411 | wildcarding = TRUE; | 
|---|
|  | 412 | mp1 = MPFROM2SHORT(IDM_COPY, SHORT2FROMMP(mp1)); | 
|---|
|  | 413 | break; | 
|---|
| [551] | 414 | } | 
|---|
| [2] | 415 |  | 
|---|
| [551] | 416 | switch (SHORT1FROMMP(mp1)) { | 
|---|
|  | 417 | case IDM_OBJECT: | 
|---|
|  | 418 | case IDM_SHADOW: | 
|---|
| [1335] | 419 | { | 
|---|
|  | 420 | APIRET rc; | 
|---|
| [2] | 421 |  | 
|---|
| [1335] | 422 | GetDesktopName(path, sizeof(path)); | 
|---|
|  | 423 | rc = WinDlgBox(HWND_DESKTOP, | 
|---|
|  | 424 | hwndFrame, | 
|---|
|  | 425 | ObjCnrDlgProc, | 
|---|
|  | 426 | FM3ModHandle, OBJCNR_FRAME, MPFROMP(path)); | 
|---|
|  | 427 | if (rc) { | 
|---|
|  | 428 | if (rc > 1) | 
|---|
|  | 429 | strcpy(path, "<WP_DESKTOP>"); | 
|---|
|  | 430 | } | 
|---|
|  | 431 | else { | 
|---|
|  | 432 | FreeList(list); | 
|---|
|  | 433 | break; | 
|---|
|  | 434 | } | 
|---|
|  | 435 | MakeShadows(hwndFrame, | 
|---|
|  | 436 | list, (SHORT1FROMMP(mp1) == IDM_SHADOW), path, NULL); | 
|---|
|  | 437 | } | 
|---|
|  | 438 | FreeList(list); | 
|---|
|  | 439 | break; | 
|---|
| [2] | 440 |  | 
|---|
| [551] | 441 | case IDM_PRINT: | 
|---|
| [1335] | 442 | { | 
|---|
|  | 443 | LISTINFO *li; | 
|---|
| [1063] | 444 | #         ifdef FORTIFY | 
|---|
| [1335] | 445 | Fortify_EnterScope(); | 
|---|
| [1063] | 446 | #          endif | 
|---|
| [1335] | 447 | li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__); | 
|---|
|  | 448 | if (li) { | 
|---|
|  | 449 | li->hwndS = WinWindowFromID(hwndFrame, FID_CLIENT); | 
|---|
|  | 450 | li->type = IDM_PRINT; | 
|---|
|  | 451 | li->list = list; | 
|---|
|  | 452 | if (WinDlgBox(HWND_DESKTOP, | 
|---|
|  | 453 | li->hwndS, | 
|---|
|  | 454 | PrintDlgProc, | 
|---|
|  | 455 | FM3ModHandle, PRN_FRAME, MPFROMP(li))) { | 
|---|
|  | 456 | if (li && li->list && li->list[0]) { | 
|---|
|  | 457 | strcpy(li->targetpath, printer); | 
|---|
|  | 458 | if (xbeginthread(PrintListThread, | 
|---|
|  | 459 | 65536, | 
|---|
|  | 460 | li, | 
|---|
|  | 461 | pszSrcFile, | 
|---|
|  | 462 | __LINE__) == -1) | 
|---|
|  | 463 | { | 
|---|
|  | 464 | FreeListInfo(li); | 
|---|
|  | 465 | } | 
|---|
|  | 466 | } | 
|---|
|  | 467 | } | 
|---|
|  | 468 | } | 
|---|
|  | 469 | } | 
|---|
|  | 470 | break; | 
|---|
| [2] | 471 |  | 
|---|
| [551] | 472 | case IDM_EAS: | 
|---|
| [1335] | 473 | if (WinDlgBox(HWND_DESKTOP, | 
|---|
|  | 474 | hwndFrame, | 
|---|
|  | 475 | DisplayEAsProc, FM3ModHandle, EA_FRAME, (PVOID) list)) { | 
|---|
|  | 476 | if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
|  | 477 | UM_UPDATERECORDLIST, MPFROMP(list), MPVOID)) | 
|---|
|  | 478 | FreeList(list); | 
|---|
|  | 479 | } | 
|---|
|  | 480 | else | 
|---|
|  | 481 | FreeList(list); | 
|---|
|  | 482 | break; | 
|---|
| [551] | 483 |  | 
|---|
|  | 484 | case IDM_INFO: | 
|---|
| [1335] | 485 | if (WinDlgBox(HWND_DESKTOP, | 
|---|
|  | 486 | hwndFrame, | 
|---|
|  | 487 | FileInfoProc, | 
|---|
|  | 488 | FM3ModHandle, FLE_FRAME, (PVOID) list) == 2) { | 
|---|
|  | 489 | if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
|  | 490 | UM_UPDATERECORDLIST, MPFROMP(list), MPVOID)) | 
|---|
|  | 491 | FreeList(list); | 
|---|
|  | 492 | } | 
|---|
|  | 493 | else | 
|---|
|  | 494 | FreeList(list); | 
|---|
|  | 495 | break; | 
|---|
| [551] | 496 |  | 
|---|
|  | 497 | case IDM_ARCHIVE: | 
|---|
| [1335] | 498 | { | 
|---|
|  | 499 | DIRCNRDATA ad; | 
|---|
|  | 500 | CHAR szBuffer[1025]; | 
|---|
| [551] | 501 |  | 
|---|
| [1335] | 502 | memset(&ad, 0, sizeof(ad)); | 
|---|
|  | 503 | ad.namecanchange = 1; | 
|---|
|  | 504 | ad.info = arcsighead;         // Hide dups | 
|---|
|  | 505 | if (!WinDlgBox(HWND_DESKTOP, | 
|---|
|  | 506 | hwndFrame, | 
|---|
|  | 507 | SBoxDlgProc, | 
|---|
|  | 508 | FM3ModHandle, | 
|---|
|  | 509 | ASEL_FRAME, (PVOID) & ad.info) || !ad.info) { | 
|---|
|  | 510 | // we blew it | 
|---|
|  | 511 | FreeList(list); | 
|---|
|  | 512 | break; | 
|---|
|  | 513 | } | 
|---|
|  | 514 | if (!ad.info->create && | 
|---|
|  | 515 | !ad.info->move && | 
|---|
|  | 516 | !ad.info->createwdirs && | 
|---|
|  | 517 | !ad.info->movewdirs && !ad.info->createrecurse) { | 
|---|
|  | 518 | // 14 Aug 07 SHL fixme to tell user why we failed | 
|---|
|  | 519 | FreeList(list); | 
|---|
|  | 520 | break; | 
|---|
|  | 521 | } | 
|---|
|  | 522 | if (!WinDlgBox(HWND_DESKTOP, hwndFrame, ArchiveDlgProc, FM3ModHandle, ARCH_FRAME, (PVOID) & ad) || !*ad.arcname || !*ad.command) {    /* we blew it */ | 
|---|
|  | 523 | FreeList(list); | 
|---|
|  | 524 | break; | 
|---|
|  | 525 | } | 
|---|
|  | 526 | // Build archiver command line | 
|---|
|  | 527 | strcpy(szBuffer, ad.command); | 
|---|
|  | 528 | strcat(szBuffer, " "); | 
|---|
|  | 529 | strcat(szBuffer, ad.arcname); | 
|---|
|  | 530 | p = &szBuffer[strlen(szBuffer)]; | 
|---|
|  | 531 | if (ad.mask.szMask) { | 
|---|
|  | 532 | strcat(szBuffer, " "); | 
|---|
|  | 533 | strcat(szBuffer, ad.mask.szMask); | 
|---|
|  | 534 | } | 
|---|
|  | 535 | strcat(szBuffer, " "); | 
|---|
|  | 536 | x = 0; | 
|---|
|  | 537 | while (list[x]) { | 
|---|
|  | 538 | FILESTATUS3 fsa; | 
|---|
|  | 539 | memset(&fsa, 0, sizeof(fsa)); | 
|---|
|  | 540 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 541 | DosQueryPathInfo(list[x], FIL_STANDARD, &fsa, sizeof(fsa)); | 
|---|
|  | 542 | if (fsa.attrFile & FILE_DIRECTORY) { | 
|---|
|  | 543 | BldQuotedFullPathName(szBuffer + strlen(szBuffer), | 
|---|
|  | 544 | list[x], "*"); | 
|---|
|  | 545 | } | 
|---|
|  | 546 | else | 
|---|
|  | 547 | BldQuotedFileName(szBuffer + strlen(szBuffer), list[x]); | 
|---|
|  | 548 | x++; | 
|---|
|  | 549 | if (!list[x] || strlen(szBuffer) + strlen(list[x]) + 5 > 1024) { | 
|---|
|  | 550 | runemf2(SEPARATE | WINDOWED | WAIT | | 
|---|
|  | 551 | (fArcStuffVisible ? 0 : (BACKGROUND | MINIMIZED)), | 
|---|
|  | 552 | HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
|  | 553 | NULL, NULL, "%s", szBuffer); | 
|---|
|  | 554 | DosSleep(1);              // Let archiver get started | 
|---|
|  | 555 | *p = 0; | 
|---|
|  | 556 | } | 
|---|
|  | 557 | strcat(szBuffer, " "); | 
|---|
|  | 558 | } // while | 
|---|
|  | 559 | AddToList(ad.arcname, &files, &numfiles, &numalloc); | 
|---|
|  | 560 | } | 
|---|
|  | 561 | if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
|  | 562 | UM_UPDATERECORDLIST, MPFROMP(list), MPVOID)) | 
|---|
|  | 563 | FreeList(list); | 
|---|
|  | 564 | break; | 
|---|
| [2] | 565 |  | 
|---|
| [551] | 566 | case IDM_ATTRS: | 
|---|
| [1335] | 567 | { | 
|---|
|  | 568 | LISTINFO li; | 
|---|
| [2] | 569 |  | 
|---|
| [1335] | 570 | memset(&li, 0, sizeof(li)); | 
|---|
|  | 571 | li.list = list; | 
|---|
|  | 572 | if (WinDlgBox(HWND_DESKTOP, | 
|---|
|  | 573 | hwndFrame, | 
|---|
|  | 574 | AttrListDlgProc, | 
|---|
|  | 575 | FM3ModHandle, ATR_FRAME, MPFROMP(&li))) { | 
|---|
|  | 576 | if (li.list && li.list[0]) { | 
|---|
|  | 577 | if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
|  | 578 | UM_UPDATERECORDLIST, MPFROMP(li.list), MPVOID)) | 
|---|
|  | 579 | FreeList(li.list); | 
|---|
|  | 580 | } | 
|---|
|  | 581 | } | 
|---|
|  | 582 | else | 
|---|
|  | 583 | FreeList(list); | 
|---|
|  | 584 | } | 
|---|
|  | 585 | break; | 
|---|
| [2] | 586 |  | 
|---|
| [551] | 587 | case IDM_MOVE: | 
|---|
|  | 588 | case IDM_COPY: | 
|---|
| [1335] | 589 | if (!*path) | 
|---|
|  | 590 | strcpy(path, targetdir); | 
|---|
|  | 591 | if (!*path) | 
|---|
|  | 592 | strcpy(path, list[0]); | 
|---|
|  | 593 | MakeValidDir(path); | 
|---|
| [551] | 594 | RetryPath: | 
|---|
| [1335] | 595 | if (SHORT1FROMMP(mp1) == IDM_MOVE) { | 
|---|
|  | 596 | if (!WinDlgBox(HWND_DESKTOP, | 
|---|
|  | 597 | hwndFrame, | 
|---|
|  | 598 | WalkMoveDlgProc, | 
|---|
|  | 599 | FM3ModHandle, WALK_FRAME, MPFROMP(path)) || !*path) { | 
|---|
|  | 600 | FreeList(list); | 
|---|
|  | 601 | goto Abort; | 
|---|
|  | 602 | } | 
|---|
|  | 603 | } | 
|---|
|  | 604 | else { | 
|---|
|  | 605 | if (!WinDlgBox(HWND_DESKTOP, | 
|---|
|  | 606 | hwndFrame, | 
|---|
|  | 607 | WalkCopyDlgProc, | 
|---|
|  | 608 | FM3ModHandle, WALK_FRAME, MPFROMP(path)) || !*path) { | 
|---|
|  | 609 | FreeList(list); | 
|---|
|  | 610 | goto Abort; | 
|---|
|  | 611 | } | 
|---|
|  | 612 | } | 
|---|
|  | 613 | if (driveflags[toupper(*path) - 'A'] & DRIVE_NOTWRITEABLE) { | 
|---|
|  | 614 | saymsg(MB_CANCEL, | 
|---|
|  | 615 | hwndFrame, | 
|---|
|  | 616 | GetPString(IDS_ERRORTEXT), | 
|---|
| [1402] | 617 | GetPString(IDS_NOTWRITENOTARGETTEXT)); | 
|---|
| [1335] | 618 | goto RetryPath; | 
|---|
|  | 619 | } | 
|---|
|  | 620 | /* intentional fallthru */ | 
|---|
| [551] | 621 | case IDM_RENAME: | 
|---|
| [1335] | 622 | { | 
|---|
| [1394] | 623 | CHAR newname[CCHMAXPATH]; | 
|---|
|  | 624 | PCSZ moving, move, moved; | 
|---|
| [1335] | 625 | APIRET rc; | 
|---|
|  | 626 | INT type; | 
|---|
|  | 627 | FILESTATUS4L fs4; | 
|---|
| [1354] | 628 | BOOL isnewer, existed, fResetVerify = FALSE; | 
|---|
| [2] | 629 |  | 
|---|
| [1335] | 630 | for (x = 0; list[x]; x++) { | 
|---|
|  | 631 | Retry: | 
|---|
|  | 632 | type = (SHORT1FROMMP(mp1) == IDM_RENAME) ? MOVE : | 
|---|
|  | 633 | (SHORT1FROMMP(mp1) == IDM_MOVE) ? MOVE : | 
|---|
|  | 634 | (SHORT1FROMMP(mp1) == IDM_WPSMOVE) ? WPSMOVE : | 
|---|
|  | 635 | (SHORT1FROMMP(mp1) == IDM_WPSCOPY) ? WPSCOPY : COPY; | 
|---|
|  | 636 | moving = (SHORT1FROMMP(mp1) == IDM_RENAME) ? | 
|---|
|  | 637 | GetPString(IDS_RENAMINGTEXT) : | 
|---|
|  | 638 | (SHORT1FROMMP(mp1) == IDM_MOVE || | 
|---|
|  | 639 | SHORT1FROMMP(mp1) == IDM_WPSMOVE) ? | 
|---|
|  | 640 | GetPString(IDS_MOVINGTEXT) : GetPString(IDS_COPYINGTEXT); | 
|---|
|  | 641 | move = (SHORT1FROMMP(mp1) == IDM_RENAME) ? | 
|---|
|  | 642 | GetPString(IDS_RENAMETEXT) : | 
|---|
|  | 643 | (SHORT1FROMMP(mp1) == IDM_MOVE || | 
|---|
|  | 644 | SHORT1FROMMP(mp1) == IDM_WPSMOVE) ? | 
|---|
|  | 645 | GetPString(IDS_MOVETEXT) : GetPString(IDS_COPYTEXT); | 
|---|
|  | 646 | moved = (SHORT1FROMMP(mp1) == IDM_RENAME) ? | 
|---|
|  | 647 | GetPString(IDS_RENAMEDTEXT) : | 
|---|
|  | 648 | (SHORT1FROMMP(mp1) == IDM_MOVE || | 
|---|
|  | 649 | SHORT1FROMMP(mp1) == IDM_WPSMOVE) ? | 
|---|
|  | 650 | GetPString(IDS_MOVEDTEXT) : GetPString(IDS_COPIEDTEXT); | 
|---|
|  | 651 | if (*path) { | 
|---|
| [1559] | 652 | strcpy(newname, path); | 
|---|
|  | 653 | AddBackslashToPath(newname); | 
|---|
| [1438] | 654 | //if (newname[strlen(newname) - 1] != '\\') | 
|---|
|  | 655 | //  strcat(newname, "\\"); | 
|---|
| [1335] | 656 | if (plen) | 
|---|
|  | 657 | p = list[x] + plen; | 
|---|
|  | 658 | else { | 
|---|
|  | 659 | p = strrchr(list[x], '\\'); | 
|---|
|  | 660 | if (p) | 
|---|
|  | 661 | p++; | 
|---|
|  | 662 | else | 
|---|
|  | 663 | p = list[x]; | 
|---|
|  | 664 | } | 
|---|
|  | 665 | strcat(newname, p); | 
|---|
|  | 666 | } | 
|---|
|  | 667 | else | 
|---|
|  | 668 | strcpy(newname, list[x]); | 
|---|
|  | 669 | if ((wildcarding || SHORT1FROMMP(mp1) == IDM_RENAME) && *wildname) { | 
|---|
| [2] | 670 |  | 
|---|
| [1335] | 671 | CHAR testname[CCHMAXPATH]; | 
|---|
| [2] | 672 |  | 
|---|
| [1335] | 673 | strcpy(testname, wildname); | 
|---|
|  | 674 | if (AdjustWildcardName(newname, testname)) | 
|---|
|  | 675 | strcpy(newname, testname); | 
|---|
|  | 676 | } | 
|---|
|  | 677 | existed = (IsFile(newname) != -1); | 
|---|
|  | 678 | isnewer = IsNewer(list[x], newname); | 
|---|
|  | 679 | if (existed && SHORT1FROMMP(mp1) != IDM_RENAME && dontask) { | 
|---|
|  | 680 | if (!overold && !overnew) | 
|---|
|  | 681 | break; | 
|---|
|  | 682 | if (!overold && !isnewer) | 
|---|
|  | 683 | break; | 
|---|
|  | 684 | if (!overnew && isnewer) | 
|---|
|  | 685 | break; | 
|---|
|  | 686 | } | 
|---|
|  | 687 | if ((SHORT1FROMMP(mp1) == IDM_RENAME && | 
|---|
|  | 688 | (!dontask || !*wildname)) || | 
|---|
|  | 689 | (!dontask && existed) || | 
|---|
|  | 690 | (!dontask && wildcarding) || | 
|---|
|  | 691 | (IsFile(newname) == 0 && IsFile(list[x]) == 1)) { | 
|---|
| [2] | 692 |  | 
|---|
| [1335] | 693 | MOVEIT mv; | 
|---|
| [551] | 694 |  | 
|---|
| [1335] | 695 | memset(&mv, 0, sizeof(mv)); | 
|---|
|  | 696 | mv.rename = (SHORT1FROMMP(mp1) == IDM_RENAME); | 
|---|
|  | 697 | mv.source = list[x]; | 
|---|
|  | 698 | strcpy(mv.target, newname); | 
|---|
|  | 699 | rc = WinDlgBox(HWND_DESKTOP, | 
|---|
|  | 700 | hwndFrame, | 
|---|
|  | 701 | RenameProc, | 
|---|
|  | 702 | FM3ModHandle, REN_FRAME, (PVOID) & mv); | 
|---|
|  | 703 | if (!rc) { | 
|---|
|  | 704 | FreeList(list); | 
|---|
|  | 705 | goto Abort; | 
|---|
|  | 706 | } | 
|---|
|  | 707 | DosSleep(0);              //26 Aug 07 GKY 1 | 
|---|
|  | 708 | if (mv.skip || !*mv.target) | 
|---|
|  | 709 | break; | 
|---|
|  | 710 | if (mv.dontask) | 
|---|
|  | 711 | dontask = TRUE; | 
|---|
|  | 712 | if (mv.overold) | 
|---|
|  | 713 | overold = TRUE; | 
|---|
|  | 714 | if (mv.overnew) | 
|---|
|  | 715 | overnew = TRUE; | 
|---|
|  | 716 | if (wildcarding || SHORT1FROMMP(mp1) == IDM_RENAME) { | 
|---|
|  | 717 | p = strrchr(mv.target, '\\'); | 
|---|
|  | 718 | if (p && (strchr(p, '*') || strchr(p, '?'))) { | 
|---|
|  | 719 | strcpy(wildname, mv.target); | 
|---|
|  | 720 | AdjustWildcardName(list[x], mv.target); | 
|---|
|  | 721 | } | 
|---|
|  | 722 | else | 
|---|
|  | 723 | *wildname = 0; | 
|---|
|  | 724 | } | 
|---|
|  | 725 | strcpy(newname, mv.target); | 
|---|
|  | 726 | existed = (IsFile(newname) != -1); | 
|---|
|  | 727 | isnewer = IsNewer(list[x], newname); | 
|---|
|  | 728 | if (!mv.overwrite) { | 
|---|
|  | 729 | if (existed && SHORT1FROMMP(mp1) != IDM_RENAME && dontask) { | 
|---|
|  | 730 | if (!overold && !overnew) | 
|---|
|  | 731 | break; | 
|---|
|  | 732 | if (!overold && !isnewer) | 
|---|
|  | 733 | break; | 
|---|
|  | 734 | if (!overnew && isnewer) | 
|---|
|  | 735 | break; | 
|---|
|  | 736 | } | 
|---|
|  | 737 | } | 
|---|
|  | 738 | } | 
|---|
|  | 739 | if (!stricmp(list[x], newname)) | 
|---|
|  | 740 | break; | 
|---|
|  | 741 | sprintf(message, | 
|---|
|  | 742 | " %s \"%s\" %s \"%s\"", | 
|---|
|  | 743 | moving, list[x], GetPString(IDS_TOTEXT), newname); | 
|---|
|  | 744 | WinSetWindowText(WinWindowFromID(hwndFrame, SEEALL_STATUS), | 
|---|
|  | 745 | message); | 
|---|
|  | 746 | if (fRealIdle) | 
|---|
| [1394] | 747 | priority_idle(); | 
|---|
|  | 748 | if (fVerify && (driveflags[toupper(*list[x]) - 'A'] & DRIVE_WRITEVERIFYOFF || | 
|---|
|  | 749 | driveflags[toupper(*newname) - 'A'] & DRIVE_WRITEVERIFYOFF)) { | 
|---|
|  | 750 | DosSetVerify(FALSE); | 
|---|
|  | 751 | fResetVerify = TRUE; | 
|---|
|  | 752 | } | 
|---|
| [1335] | 753 | if (plen) { | 
|---|
|  | 754 | /* make directory/ies, if required */ | 
|---|
| [2] | 755 |  | 
|---|
| [1335] | 756 | CHAR dirpart[CCHMAXPATH]; | 
|---|
| [2] | 757 |  | 
|---|
| [1335] | 758 | strcpy(dirpart, newname); | 
|---|
|  | 759 | p = strrchr(dirpart, '\\'); | 
|---|
|  | 760 | if (p) { | 
|---|
|  | 761 | *p = 0; | 
|---|
|  | 762 | if (p > dirpart + 3) | 
|---|
|  | 763 | MassMkdir((hwndMain) ? hwndMain : (HWND) 0, dirpart); | 
|---|
|  | 764 | } | 
|---|
|  | 765 | } | 
|---|
| [1402] | 766 | rc = docopyf(type, list[x], newname); | 
|---|
| [1394] | 767 | if (fResetVerify) { | 
|---|
|  | 768 | DosSetVerify(fVerify); | 
|---|
|  | 769 | fResetVerify = FALSE; | 
|---|
|  | 770 | } | 
|---|
| [1335] | 771 | priority_normal(); | 
|---|
|  | 772 | if (rc) { | 
|---|
|  | 773 | if ((rc == ERROR_DISK_FULL || | 
|---|
|  | 774 | rc == ERROR_HANDLE_DISK_FULL) && | 
|---|
|  | 775 | isalpha(*newname) && | 
|---|
|  | 776 | (driveflags[toupper(*newname) - 'A'] & DRIVE_REMOVABLE) && | 
|---|
|  | 777 | !(driveflags[toupper(*newname) - 'A'] & DRIVE_NOTWRITEABLE) | 
|---|
|  | 778 | && toupper(*newname) != toupper(*list[x]) | 
|---|
|  | 779 | && !DosQueryPathInfo(list[x], FIL_QUERYEASIZEL, &fs4, | 
|---|
|  | 780 | sizeof(fs4)) | 
|---|
|  | 781 | && !(fs4.attrFile & FILE_DIRECTORY)) { | 
|---|
| [2] | 782 |  | 
|---|
| [1335] | 783 | FSALLOCATE fsa; | 
|---|
|  | 784 | ULONGLONG ullFreeBytes; | 
|---|
|  | 785 | CHAR *ptr; | 
|---|
|  | 786 | INT cntr; | 
|---|
| [2] | 787 |  | 
|---|
| [1335] | 788 | WinSetWindowText(WinWindowFromID(hwndFrame, SEEALL_STATUS), | 
|---|
| [1498] | 789 | (CHAR *) GetPString(IDS_FITTINGTEXT)); | 
|---|
| [1335] | 790 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 791 | if (!DosQueryFSInfo(toupper(*newname) - '@', | 
|---|
|  | 792 | FSIL_ALLOC, &fsa, sizeof(fsa))) { | 
|---|
|  | 793 | // Assume large file support | 
|---|
|  | 794 | ullFreeBytes = (ULONGLONG) fsa.cUnitAvail * fsa.cSectorUnit * | 
|---|
|  | 795 | fsa.cbSector; | 
|---|
|  | 796 | if (ullFreeBytes) { | 
|---|
|  | 797 | // Find item that will fit in available space | 
|---|
|  | 798 | for (cntr = x + 1; list[cntr]; cntr++) { | 
|---|
|  | 799 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 800 | if (!DosQueryPathInfo(list[cntr], | 
|---|
|  | 801 | FIL_QUERYEASIZEL, | 
|---|
|  | 802 | &fs4, sizeof(fs4)) && | 
|---|
|  | 803 | !(fs4.attrFile & FILE_DIRECTORY) && | 
|---|
|  | 804 | // fixme to use CBLIST_TO_EASIZE? | 
|---|
|  | 805 | fs4.cbFile + fs4.cbList <= ullFreeBytes) { | 
|---|
|  | 806 | // Swap with failing item | 
|---|
|  | 807 | ptr = list[x]; | 
|---|
|  | 808 | list[x] = list[cntr]; | 
|---|
|  | 809 | list[cntr] = ptr; | 
|---|
|  | 810 | goto Retry; | 
|---|
|  | 811 | } | 
|---|
|  | 812 | } | 
|---|
|  | 813 | WinSetWindowText(WinWindowFromID(hwndFrame, | 
|---|
|  | 814 | SEEALL_STATUS), | 
|---|
| [1498] | 815 | (CHAR *) GetPString(IDS_COULDNTFITTEXT)); | 
|---|
| [1335] | 816 | } | 
|---|
|  | 817 | } | 
|---|
|  | 818 | rc = saymsg(MB_ABORTRETRYIGNORE | MB_ICONEXCLAMATION, | 
|---|
|  | 819 | hwndFrame, | 
|---|
|  | 820 | GetPString(IDS_DISKFULLTEXT), | 
|---|
| [1402] | 821 | GetPString(IDS_ANOTHERDISKTEXT)); | 
|---|
| [1335] | 822 | if (rc == MBID_RETRY) | 
|---|
|  | 823 | goto Retry; | 
|---|
|  | 824 | if (rc == MBID_ABORT) { | 
|---|
|  | 825 | FreeList(list); | 
|---|
|  | 826 | goto Abort; | 
|---|
|  | 827 | } | 
|---|
|  | 828 | } | 
|---|
|  | 829 | else { | 
|---|
|  | 830 | if (LogFileHandle) | 
|---|
|  | 831 | fprintf(LogFileHandle, | 
|---|
|  | 832 | GetPString(IDS_LOGTOFAILEDTEXT), | 
|---|
|  | 833 | move, list[x], newname, rc); | 
|---|
|  | 834 | rc = Dos_Error(MB_ENTERCANCEL, | 
|---|
|  | 835 | rc, | 
|---|
|  | 836 | hwndFrame, | 
|---|
|  | 837 | pszSrcFile, | 
|---|
|  | 838 | __LINE__, | 
|---|
|  | 839 | "%s %s \"%s\" %s\"%s\" %s.", | 
|---|
|  | 840 | move, | 
|---|
|  | 841 | GetPString(IDS_OFTEXT), | 
|---|
|  | 842 | list[x], | 
|---|
|  | 843 | GetPString(IDS_TOTEXT), | 
|---|
|  | 844 | newname, GetPString(IDS_FAILEDTEXT)); | 
|---|
|  | 845 | if (rc == MBID_CANCEL) { | 
|---|
|  | 846 | FreeList(list); | 
|---|
|  | 847 | goto Abort; | 
|---|
|  | 848 | } | 
|---|
|  | 849 | } | 
|---|
|  | 850 | } | 
|---|
|  | 851 | else { | 
|---|
|  | 852 | if (LogFileHandle) | 
|---|
|  | 853 | fprintf(LogFileHandle, | 
|---|
|  | 854 | "%s \"%s\" %s \"%s\"\n", | 
|---|
|  | 855 | moved, list[x], GetPString(IDS_TOTEXT), newname); | 
|---|
|  | 856 | AddToList(newname, &files, &numfiles, &numalloc); | 
|---|
|  | 857 | } | 
|---|
|  | 858 | } | 
|---|
|  | 859 | } | 
|---|
|  | 860 | if (SHORT1FROMMP(mp1) != IDM_COPY) { | 
|---|
|  | 861 | if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
|  | 862 | UM_UPDATERECORDLIST, MPFROMP(list), MPVOID)) | 
|---|
|  | 863 | FreeList(list); | 
|---|
|  | 864 | } | 
|---|
|  | 865 | else | 
|---|
|  | 866 | FreeList(list); | 
|---|
|  | 867 | break; | 
|---|
| [2] | 868 |  | 
|---|
| [551] | 869 | case IDM_UUDECODE: | 
|---|
| [1335] | 870 | for (x = 0; list[x]; x++) | 
|---|
|  | 871 | UUD(list[x], NULL); | 
|---|
|  | 872 | break; | 
|---|
| [2] | 873 |  | 
|---|
| [551] | 874 | case IDM_EXTRACT: | 
|---|
| [1335] | 875 | for (x = 0; list[x]; x++) { | 
|---|
| [2] | 876 |  | 
|---|
| [1335] | 877 | EXTRDATA ex; | 
|---|
|  | 878 | BOOL maskspaces = FALSE; | 
|---|
| [2] | 879 |  | 
|---|
| [1335] | 880 | memset(&ex, 0, sizeof(ex)); | 
|---|
|  | 881 | ex.info = find_type(list[x], NULL); | 
|---|
|  | 882 | if (!ex.info || (!ex.info->extract && !ex.info->exwdirs)) | 
|---|
|  | 883 | break; | 
|---|
|  | 884 | ex.size = sizeof(ex); | 
|---|
|  | 885 | ex.arcname = list[x]; | 
|---|
|  | 886 | strcpy(ex.masks, "*"); | 
|---|
|  | 887 | if (!WinDlgBox(HWND_DESKTOP, | 
|---|
|  | 888 | hwndFrame, | 
|---|
|  | 889 | ExtractDlgProc, | 
|---|
|  | 890 | FM3ModHandle, | 
|---|
|  | 891 | EXT_FRAME, | 
|---|
|  | 892 | (PVOID) & ex) || | 
|---|
|  | 893 | !ex.ret || !*ex.command || !*ex.arcname || !*ex.extractdir) | 
|---|
|  | 894 | break; | 
|---|
|  | 895 | if (IsFile(ex.extractdir) != 0) | 
|---|
|  | 896 | Runtime_Error(pszSrcFile, __LINE__, "directory expected"); | 
|---|
|  | 897 | else { | 
|---|
|  | 898 | if (needs_quoting(ex.masks) && !strchr(ex.masks, '\"')) | 
|---|
|  | 899 | maskspaces = TRUE; | 
|---|
|  | 900 | runemf2(SEPARATE | WINDOWED | | 
|---|
|  | 901 | (fArcStuffVisible ? 0 : (BACKGROUND | MINIMIZED)), | 
|---|
|  | 902 | HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
|  | 903 | ex.extractdir, NULL, | 
|---|
|  | 904 | "%s %s %s%s%s", | 
|---|
|  | 905 | ex.command, | 
|---|
|  | 906 | ex.arcname, | 
|---|
|  | 907 | maskspaces ? "\"" : NullStr, | 
|---|
|  | 908 | *ex.masks ? ex.masks : "*", | 
|---|
|  | 909 | maskspaces ? "\"" : NullStr); | 
|---|
|  | 910 | } | 
|---|
|  | 911 | } | 
|---|
|  | 912 | // fixme to not leak? | 
|---|
|  | 913 | if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
|  | 914 | UM_UPDATERECORDLIST, MPFROMP(list), MPVOID)) | 
|---|
|  | 915 | FreeList(list); | 
|---|
|  | 916 | break; | 
|---|
| [2] | 917 |  | 
|---|
| [551] | 918 | case IDM_SUBJECT: | 
|---|
| [1335] | 919 | for (x = 0; list[x]; x++) { | 
|---|
| [2] | 920 |  | 
|---|
| [1335] | 921 | INT ret; | 
|---|
| [2] | 922 |  | 
|---|
| [1335] | 923 | if (IsFile(list[x]) == 1) { | 
|---|
|  | 924 | ret = Subject(hwndFrame, list[x]); | 
|---|
|  | 925 | if (!ret) | 
|---|
|  | 926 | break; | 
|---|
|  | 927 | } | 
|---|
|  | 928 | } | 
|---|
|  | 929 | if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
|  | 930 | UM_UPDATERECORDLIST, MPFROMP(list), MPVOID)) | 
|---|
|  | 931 | FreeList(list); | 
|---|
|  | 932 | break; | 
|---|
| [2] | 933 |  | 
|---|
| [551] | 934 | case IDM_OPENDEFAULT: | 
|---|
|  | 935 | case IDM_OPENSETTINGS: | 
|---|
| [1335] | 936 | for (x = 0; list[x]; x++) { | 
|---|
|  | 937 | if (IsFile(list[x]) != -1) { | 
|---|
| [2] | 938 |  | 
|---|
| [1335] | 939 | CHAR *s; | 
|---|
| [2] | 940 |  | 
|---|
| [1335] | 941 | switch (SHORT1FROMMP(mp1)) { | 
|---|
|  | 942 | case IDM_OPENSETTINGS: | 
|---|
| [1402] | 943 | s = (PSZ) Settings; | 
|---|
| [1335] | 944 | break; | 
|---|
|  | 945 | default: | 
|---|
| [1402] | 946 | s = (PSZ) Default; | 
|---|
| [1335] | 947 | break; | 
|---|
|  | 948 | } | 
|---|
|  | 949 | OpenObject(list[x], s, hwndFrame); | 
|---|
|  | 950 | } | 
|---|
|  | 951 | } | 
|---|
|  | 952 | FreeList(list); | 
|---|
|  | 953 | break; | 
|---|
| [2] | 954 |  | 
|---|
| [551] | 955 | case IDM_DELETE: | 
|---|
|  | 956 | case IDM_PERMDELETE: | 
|---|
| [1335] | 957 | { | 
|---|
|  | 958 | CHECKLIST cl; | 
|---|
|  | 959 | INT isdir = 0, sysdir = 0, ro = 0, hs = 0; | 
|---|
|  | 960 | FILESTATUS3 fsa; | 
|---|
|  | 961 | CHAR prompt[CCHMAXPATH * 3]; | 
|---|
|  | 962 | APIRET error; | 
|---|
| [2] | 963 |  | 
|---|
| [1335] | 964 | for (x = 0; list[x]; x++) { | 
|---|
|  | 965 | if (IsRoot(list[x])) { | 
|---|
|  | 966 | list = RemoveFromList(list, list[x]); | 
|---|
|  | 967 | if (!list) | 
|---|
|  | 968 | break; | 
|---|
|  | 969 | x--; | 
|---|
|  | 970 | continue; | 
|---|
|  | 971 | } | 
|---|
|  | 972 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 973 | if (DosQueryPathInfo(list[x], FIL_STANDARD, &fsa, sizeof(fsa))) { | 
|---|
|  | 974 | list = RemoveFromList(list, list[x]); | 
|---|
|  | 975 | if (!list) | 
|---|
|  | 976 | break; | 
|---|
|  | 977 | x--; | 
|---|
|  | 978 | continue; | 
|---|
|  | 979 | } | 
|---|
|  | 980 | if (fsa.attrFile & FILE_DIRECTORY) { | 
|---|
|  | 981 | isdir++; | 
|---|
|  | 982 | if (stristr(list[x], ":\\OS2\\") || | 
|---|
|  | 983 | !stricmp(list[x] + 1, ":\\OS2")) | 
|---|
|  | 984 | sysdir++; | 
|---|
|  | 985 | } | 
|---|
|  | 986 | else { | 
|---|
|  | 987 | if (fsa.attrFile & (FILE_HIDDEN | FILE_SYSTEM)) | 
|---|
|  | 988 | hs++; | 
|---|
|  | 989 | if (fsa.attrFile & FILE_READONLY) | 
|---|
|  | 990 | ro++; | 
|---|
|  | 991 | } | 
|---|
|  | 992 | } | 
|---|
|  | 993 | if (!list) | 
|---|
|  | 994 | break; | 
|---|
|  | 995 | if (fConfirmDelete || isdir) { | 
|---|
|  | 996 | memset(&cl, 0, sizeof(cl)); | 
|---|
|  | 997 | cl.size = sizeof(cl); | 
|---|
|  | 998 | cl.list = list; | 
|---|
|  | 999 | cl.prompt = prompt; | 
|---|
|  | 1000 | cl.flags |= CHECK_FILES; | 
|---|
|  | 1001 | cl.cmd = SHORT1FROMMP(mp1); | 
|---|
|  | 1002 | sprintf(prompt, | 
|---|
|  | 1003 | GetPString(IDS_DELPROMPT1TEXT), | 
|---|
|  | 1004 | (SHORT1FROMMP(mp1) == IDM_DELETE) ? | 
|---|
|  | 1005 | NullStr : | 
|---|
|  | 1006 | GetPString(IDS_PERMANENTLYTEXT), &"s"[list[1] == NULL]); | 
|---|
|  | 1007 | if (isdir) { | 
|---|
|  | 1008 | sprintf(&prompt[strlen(prompt)], | 
|---|
|  | 1009 | GetPString(IDS_DELPROMPT2TEXT), | 
|---|
|  | 1010 | isdir, | 
|---|
|  | 1011 | (isdir > 1) ? | 
|---|
|  | 1012 | GetPString(IDS_ARETEXT) : | 
|---|
|  | 1013 | GetPString(IDS_ISTEXT), | 
|---|
|  | 1014 | (isdir == 1) ? | 
|---|
|  | 1015 | GetPString(IDS_ATEXT) : | 
|---|
|  | 1016 | NullStr, | 
|---|
|  | 1017 | (isdir > 1) ? | 
|---|
|  | 1018 | GetPString(IDS_IESTEXT) : GetPString(IDS_YTEXT)); | 
|---|
|  | 1019 | if (sysdir) | 
|---|
|  | 1020 | sprintf(&prompt[strlen(prompt)], | 
|---|
|  | 1021 | GetPString(IDS_DELPROMPT3TEXT), | 
|---|
|  | 1022 | sysdir, | 
|---|
|  | 1023 | (sysdir == 1) ? | 
|---|
|  | 1024 | GetPString(IDS_YTEXT) : GetPString(IDS_IESTEXT)); | 
|---|
|  | 1025 | } | 
|---|
|  | 1026 | if (ro) | 
|---|
|  | 1027 | sprintf(&prompt[strlen(prompt)], | 
|---|
|  | 1028 | GetPString(IDS_DELPROMPT4TEXT), | 
|---|
|  | 1029 | ro, | 
|---|
|  | 1030 | &"s"[ro == 1], | 
|---|
|  | 1031 | (ro > 1) ? | 
|---|
|  | 1032 | GetPString(IDS_ARETEXT) : GetPString(IDS_ISTEXT)); | 
|---|
|  | 1033 | if (hs) | 
|---|
|  | 1034 | sprintf(&prompt[strlen(prompt)], | 
|---|
|  | 1035 | GetPString(IDS_DELPROMPT5TEXT), | 
|---|
|  | 1036 | hs, | 
|---|
|  | 1037 | &"s"[hs == 1], | 
|---|
|  | 1038 | (hs > 1) ? | 
|---|
|  | 1039 | GetPString(IDS_ARETEXT) : GetPString(IDS_ISTEXT)); | 
|---|
| [1395] | 1040 | if ((ro || hs || sysdir) && !fAlertBeepOff) | 
|---|
| [1335] | 1041 | DosBeep(300, 100); | 
|---|
|  | 1042 | strcat(prompt, GetPString(IDS_DELPROMPT6TEXT)); | 
|---|
|  | 1043 | if (!WinDlgBox(HWND_DESKTOP, | 
|---|
|  | 1044 | WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
|  | 1045 | CheckListProc, | 
|---|
|  | 1046 | FM3ModHandle, CHECK_FRAME, MPFROMP(&cl))) | 
|---|
|  | 1047 | break; | 
|---|
|  | 1048 | list = cl.list; | 
|---|
|  | 1049 | if (!list || !list[0]) | 
|---|
|  | 1050 | break; | 
|---|
|  | 1051 | } | 
|---|
|  | 1052 | for (x = 0; list[x]; x++) { | 
|---|
|  | 1053 | fsa.attrFile = 0; | 
|---|
|  | 1054 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 1055 | DosQueryPathInfo(list[x], FIL_STANDARD, &fsa, sizeof(fsa)); | 
|---|
|  | 1056 | if (fsa.attrFile & FILE_DIRECTORY) { | 
|---|
|  | 1057 | sprintf(prompt, GetPString(IDS_DELETINGTEXT), list[x]); | 
|---|
|  | 1058 | WinSetWindowText(WinWindowFromID(hwndFrame, SEEALL_STATUS), | 
|---|
|  | 1059 | prompt); | 
|---|
|  | 1060 | error = (APIRET) wipeallf("%s%s*", | 
|---|
|  | 1061 | list[x], | 
|---|
|  | 1062 | (*list[x] && | 
|---|
|  | 1063 | list[x][strlen(list[x]) - 1] != | 
|---|
| [1438] | 1064 | '\\') ? PCSZ_BACKSLASH : NullStr); | 
|---|
| [1335] | 1065 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 1066 | if (!error) | 
|---|
|  | 1067 | error = DosDeleteDir(list[x]); | 
|---|
|  | 1068 | else | 
|---|
|  | 1069 | DosDeleteDir(list[x]); | 
|---|
|  | 1070 | } | 
|---|
|  | 1071 | else { | 
|---|
|  | 1072 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 1073 | if (SHORT1FROMMP(mp1) == IDM_DELETE) | 
|---|
|  | 1074 | error = DosDelete(list[x]); | 
|---|
|  | 1075 | else | 
|---|
|  | 1076 | error = DosForceDelete(list[x]); | 
|---|
|  | 1077 | if (error) { | 
|---|
|  | 1078 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 1079 | make_deleteable(list[x]); | 
|---|
|  | 1080 | if (SHORT1FROMMP(mp1) == IDM_DELETE) | 
|---|
|  | 1081 | error = DosDelete(list[x]); | 
|---|
|  | 1082 | else | 
|---|
|  | 1083 | error = DosForceDelete(list[x]); | 
|---|
|  | 1084 | } | 
|---|
|  | 1085 | } | 
|---|
|  | 1086 | if (error) { | 
|---|
|  | 1087 | if (LogFileHandle) | 
|---|
|  | 1088 | fprintf(LogFileHandle, | 
|---|
|  | 1089 | GetPString(IDS_DELETEFAILED1TEXT), list[x], error); | 
|---|
|  | 1090 | if (Dos_Error(MB_ENTERCANCEL, | 
|---|
|  | 1091 | error, | 
|---|
|  | 1092 | hwndFrame, | 
|---|
|  | 1093 | pszSrcFile, | 
|---|
|  | 1094 | __LINE__, | 
|---|
|  | 1095 | GetPString(IDS_DELETEFAILED2TEXT), | 
|---|
|  | 1096 | list[x]) == MBID_CANCEL) | 
|---|
|  | 1097 | break; | 
|---|
|  | 1098 | } | 
|---|
|  | 1099 | else if (LogFileHandle) | 
|---|
|  | 1100 | fprintf(LogFileHandle, | 
|---|
|  | 1101 | "%s\n", GetPString(IDS_DELETEDTEXT), list[x]); | 
|---|
|  | 1102 | AddToList(list[x], &files, &numfiles, &numalloc); | 
|---|
|  | 1103 | } | 
|---|
|  | 1104 | } | 
|---|
|  | 1105 | FreeList(list); | 
|---|
|  | 1106 | break; | 
|---|
| [2] | 1107 |  | 
|---|
| [551] | 1108 | case IDM_SAVETOLIST: | 
|---|
| [1335] | 1109 | if (list) { | 
|---|
|  | 1110 | WinDlgBox(HWND_DESKTOP, | 
|---|
|  | 1111 | WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
|  | 1112 | SaveAllListDlgProc, | 
|---|
|  | 1113 | FM3ModHandle, SAV_FRAME, MPFROMP(list)); | 
|---|
|  | 1114 | FreeList(list); | 
|---|
|  | 1115 | } | 
|---|
|  | 1116 | break; | 
|---|
| [2] | 1117 |  | 
|---|
| [551] | 1118 | case IDM_SAVETOCLIP: | 
|---|
|  | 1119 | case IDM_APPENDTOCLIP: | 
|---|
| [1084] | 1120 | case IDM_SAVETOCLIPFILENAME: | 
|---|
|  | 1121 | case IDM_APPENDTOCLIPFILENAME: | 
|---|
| [1335] | 1122 | if (list) { | 
|---|
|  | 1123 | ListToClipboardHab(WinQueryAnchorBlock(hwnd), | 
|---|
|  | 1124 | list, SHORT1FROMMP(mp1)); | 
|---|
|  | 1125 | FreeList(list); | 
|---|
|  | 1126 | } | 
|---|
|  | 1127 | break; | 
|---|
| [2] | 1128 |  | 
|---|
| [551] | 1129 | default: | 
|---|
| [1335] | 1130 | if (list) | 
|---|
|  | 1131 | FreeList(list); | 
|---|
|  | 1132 | break; | 
|---|
| [551] | 1133 | } | 
|---|
| [2] | 1134 |  | 
|---|
| [551] | 1135 | switch (SHORT1FROMMP(mp1)) { | 
|---|
|  | 1136 | case IDM_MOVE: | 
|---|
|  | 1137 | case IDM_COPY: | 
|---|
|  | 1138 | case IDM_RENAME: | 
|---|
| [1335] | 1139 | sprintf(message, | 
|---|
|  | 1140 | GetPString(IDS_OPSCOMPLETETEXT), | 
|---|
|  | 1141 | SHORT1FROMMP(mp1) == IDM_MOVE ? | 
|---|
|  | 1142 | GetPString(IDS_MOVETEXT) : | 
|---|
|  | 1143 | SHORT1FROMMP(mp1) == IDM_COPY ? | 
|---|
|  | 1144 | GetPString(IDS_COPYTEXT) : | 
|---|
|  | 1145 | SHORT1FROMMP(mp1) == IDM_WPSMOVE ? | 
|---|
|  | 1146 | GetPString(IDS_WPSMOVETEXT) : | 
|---|
|  | 1147 | SHORT1FROMMP(mp1) == IDM_WPSCOPY ? | 
|---|
|  | 1148 | GetPString(IDS_WPSCOPYTEXT) : | 
|---|
|  | 1149 | GetPString(IDS_RENAMETEXT), | 
|---|
|  | 1150 | &"s"[x == 1], | 
|---|
|  | 1151 | SHORT1FROMMP(mp1) == IDM_MOVE || | 
|---|
|  | 1152 | SHORT1FROMMP(mp1) == IDM_COPY || | 
|---|
|  | 1153 | SHORT1FROMMP(mp1) == IDM_WPSMOVE || | 
|---|
|  | 1154 | SHORT1FROMMP(mp1) == IDM_WPSCOPY ? | 
|---|
|  | 1155 | GetPString(IDS_TOTEXT) : NullStr, | 
|---|
|  | 1156 | SHORT1FROMMP(mp1) == IDM_MOVE || | 
|---|
|  | 1157 | SHORT1FROMMP(mp1) == IDM_COPY || | 
|---|
|  | 1158 | SHORT1FROMMP(mp1) == IDM_WPSCOPY ? | 
|---|
|  | 1159 | path : NullStr, | 
|---|
|  | 1160 | x != 1 ? GetPString(IDS_ARETEXT) : GetPString(IDS_ISTEXT)); | 
|---|
|  | 1161 | WinSetWindowText(WinWindowFromID(hwndFrame, SEEALL_STATUS), message); | 
|---|
| [1395] | 1162 | if (toupper(*path) < 'C' && !fAlertBeepOff) | 
|---|
| [1335] | 1163 | DosBeep(1000, 25); | 
|---|
|  | 1164 | DosSleep(16);                   // 05 Aug 07 GKY 33 | 
|---|
|  | 1165 | break; | 
|---|
| [551] | 1166 |  | 
|---|
|  | 1167 | default: | 
|---|
| [1335] | 1168 | break; | 
|---|
| [2] | 1169 | } | 
|---|
| [551] | 1170 | Abort: | 
|---|
|  | 1171 | if (files) { | 
|---|
| [1335] | 1172 | if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
|  | 1173 | UM_UPDATERECORDLIST, MPFROMP(files), MPVOID)) | 
|---|
|  | 1174 | FreeList(files); | 
|---|
| [551] | 1175 | } | 
|---|
|  | 1176 | PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
| [1335] | 1177 | UM_RESCAN, MPVOID, MPVOID); | 
|---|
| [551] | 1178 | } | 
|---|
|  | 1179 | return 0; | 
|---|
| [2] | 1180 |  | 
|---|
| [551] | 1181 | case WM_CLOSE: | 
|---|
|  | 1182 | WinDestroyWindow(hwnd); | 
|---|
|  | 1183 | break; | 
|---|
| [2] | 1184 |  | 
|---|
| [551] | 1185 | case WM_DESTROY: | 
|---|
|  | 1186 | if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID)) | 
|---|
|  | 1187 | WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID); | 
|---|
|  | 1188 | break; | 
|---|
| [2] | 1189 | } | 
|---|
| [551] | 1190 | return WinDefWindowProc(hwnd, msg, mp1, mp2); | 
|---|
| [2] | 1191 | } | 
|---|
|  | 1192 |  | 
|---|
| [551] | 1193 | static VOID MakeSeeObjWinThread(VOID * args) | 
|---|
| [162] | 1194 | { | 
|---|
| [551] | 1195 | HAB hab2; | 
|---|
|  | 1196 | HMQ hmq2; | 
|---|
|  | 1197 | HWND hwndObj; | 
|---|
|  | 1198 | ALLDATA *ad = (ALLDATA *) args; | 
|---|
|  | 1199 | QMSG qmsg2; | 
|---|
| [2] | 1200 |  | 
|---|
| [551] | 1201 | if (ad) { | 
|---|
| [1063] | 1202 | #   ifdef FORTIFY | 
|---|
|  | 1203 | Fortify_EnterScope(); | 
|---|
|  | 1204 | #    endif | 
|---|
| [2] | 1205 | hab2 = WinInitialize(0); | 
|---|
| [551] | 1206 | if (hab2) { | 
|---|
|  | 1207 | hmq2 = WinCreateMsgQueue(hab2, 256); | 
|---|
|  | 1208 | if (hmq2) { | 
|---|
| [1335] | 1209 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 1210 | WinRegisterClass(hab2, | 
|---|
| [1498] | 1211 | (CHAR *) WC_OBJECTWINDOW, | 
|---|
| [1335] | 1212 | SeeObjWndProc, 0, sizeof(PVOID)); | 
|---|
|  | 1213 | hwndObj = WinCreateWindow(HWND_OBJECT, | 
|---|
| [1498] | 1214 | (CHAR *) WC_OBJECTWINDOW, | 
|---|
| [1335] | 1215 | (PSZ) NULL, | 
|---|
|  | 1216 | 0, | 
|---|
|  | 1217 | 0, | 
|---|
|  | 1218 | 0, | 
|---|
|  | 1219 | 0, | 
|---|
|  | 1220 | 0, 0, HWND_TOP, SEEALL_OBJ, NULL, NULL); | 
|---|
|  | 1221 | if (!hwndObj) { | 
|---|
| [1395] | 1222 | Win_Error(HWND_OBJECT, HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
|  | 1223 | PCSZ_WINCREATEWINDOW); | 
|---|
| [1335] | 1224 | if (!PostMsg(ad->hwndClient, WM_CLOSE, MPVOID, MPVOID)) | 
|---|
|  | 1225 | WinSendMsg(ad->hwndClient, WM_CLOSE, MPVOID, MPVOID); | 
|---|
|  | 1226 | } | 
|---|
|  | 1227 | else { | 
|---|
|  | 1228 | ad->hwndObj = hwndObj; | 
|---|
|  | 1229 | WinSetWindowULong(hwndObj, QWL_USER, ad->hwndFrame); | 
|---|
|  | 1230 | priority_normal(); | 
|---|
|  | 1231 | while (WinGetMsg(hab2, &qmsg2, (HWND) 0, 0, 0)) | 
|---|
|  | 1232 | WinDispatchMsg(hab2, &qmsg2); | 
|---|
|  | 1233 | WinDestroyWindow(hwndObj); | 
|---|
|  | 1234 | } | 
|---|
|  | 1235 | WinDestroyMsgQueue(hmq2); | 
|---|
| [2] | 1236 | } | 
|---|
|  | 1237 | else | 
|---|
| [1335] | 1238 | WinTerminate(hab2); | 
|---|
| [1063] | 1239 | } | 
|---|
|  | 1240 | #   ifdef FORTIFY | 
|---|
| [1038] | 1241 | Fortify_LeaveScope(); | 
|---|
| [1063] | 1242 | #    endif | 
|---|
| [2] | 1243 | } | 
|---|
|  | 1244 | } | 
|---|
|  | 1245 |  | 
|---|
| [551] | 1246 | static VOID SelectMask(HWND hwnd, BOOL deselect) | 
|---|
| [84] | 1247 | { | 
|---|
| [551] | 1248 | MASK mask; | 
|---|
|  | 1249 | register ULONG x, y, z; | 
|---|
|  | 1250 | BOOL ret; | 
|---|
|  | 1251 | ALLDATA *pAD = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| [2] | 1252 |  | 
|---|
| [551] | 1253 | memset(&mask, 0, sizeof(mask)); | 
|---|
| [2] | 1254 | mask.fNoAttribs = FALSE; | 
|---|
|  | 1255 | mask.fNoDirs = TRUE; | 
|---|
| [84] | 1256 | mask.attrFile = pAD->mask.attrFile; | 
|---|
|  | 1257 | mask.antiattr = pAD->mask.antiattr; | 
|---|
| [2] | 1258 | mask.fIsSeeAll = TRUE; | 
|---|
|  | 1259 | strcpy(mask.prompt, | 
|---|
| [1335] | 1260 | GetPString((!deselect) ? | 
|---|
|  | 1261 | IDS_SELECTFILTERTEXT : IDS_DESELECTFILTERTEXT)); | 
|---|
| [84] | 1262 | if (WinDlgBox(HWND_DESKTOP, | 
|---|
| [1335] | 1263 | hwnd, | 
|---|
|  | 1264 | PickMaskDlgProc, | 
|---|
|  | 1265 | FM3ModHandle, | 
|---|
|  | 1266 | MSK_FRAME, | 
|---|
|  | 1267 | MPFROMP(&mask)) && | 
|---|
| [551] | 1268 | (*mask.szMask || | 
|---|
|  | 1269 | mask.attrFile != pAD->mask.attrFile || | 
|---|
|  | 1270 | mask.antiattr != pAD->mask.antiattr)) { | 
|---|
| [943] | 1271 | for (x = 0; x < pAD->afindexcnt; x++) { | 
|---|
|  | 1272 | y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x; | 
|---|
| [2] | 1273 | ret = FALSE; | 
|---|
| [84] | 1274 | if (mask.pszMasks[1]) { | 
|---|
| [1335] | 1275 | for (z = 0; mask.pszMasks[z]; z++) { | 
|---|
|  | 1276 | if (*mask.pszMasks[z]) { | 
|---|
|  | 1277 | if (*mask.pszMasks[z] != '/') { | 
|---|
|  | 1278 | if (wildcard((strchr(mask.pszMasks[z], '\\') || | 
|---|
|  | 1279 | strchr(mask.pszMasks[z], ':')) ? | 
|---|
|  | 1280 | pAD->afindex[y]->fullname : pAD->afindex[y]-> | 
|---|
|  | 1281 | filename, mask.pszMasks[z], FALSE)) | 
|---|
|  | 1282 | ret = TRUE; | 
|---|
|  | 1283 | } | 
|---|
|  | 1284 | else { | 
|---|
|  | 1285 | if (wildcard((strchr(mask.pszMasks[z], '\\') || | 
|---|
|  | 1286 | strchr(mask.pszMasks[z], ':')) ? | 
|---|
|  | 1287 | pAD->afindex[y]->fullname : pAD->afindex[y]-> | 
|---|
|  | 1288 | filename, mask.pszMasks[y] + 1, FALSE)) { | 
|---|
|  | 1289 | ret = FALSE; | 
|---|
|  | 1290 | break; | 
|---|
|  | 1291 | } | 
|---|
|  | 1292 | } | 
|---|
|  | 1293 | } | 
|---|
|  | 1294 | } | 
|---|
| [2] | 1295 | } | 
|---|
| [84] | 1296 | else if (*mask.szMask) { | 
|---|
| [1335] | 1297 | if (wildcard((strchr(mask.szMask, '\\') || | 
|---|
|  | 1298 | strchr(mask.szMask, ':')) ? | 
|---|
|  | 1299 | pAD->afindex[y]->fullname : pAD->afindex[y]->filename, | 
|---|
|  | 1300 | mask.szMask, FALSE)) | 
|---|
|  | 1301 | ret = TRUE; | 
|---|
| [2] | 1302 | } | 
|---|
|  | 1303 | else | 
|---|
| [1335] | 1304 | ret = TRUE; | 
|---|
| [84] | 1305 | if (ret) { | 
|---|
| [1335] | 1306 | if ((!(mask.attrFile & FILE_HIDDEN) | 
|---|
|  | 1307 | && (pAD->afindex[y]->attrFile & FILE_HIDDEN)) | 
|---|
|  | 1308 | || (!(mask.attrFile & FILE_SYSTEM) | 
|---|
|  | 1309 | && (pAD->afindex[y]->attrFile & FILE_SYSTEM)) | 
|---|
|  | 1310 | || (!(mask.attrFile & FILE_READONLY) | 
|---|
|  | 1311 | && (pAD->afindex[y]->attrFile & FILE_READONLY)) | 
|---|
|  | 1312 | || (!(mask.attrFile & FILE_ARCHIVED) | 
|---|
|  | 1313 | && (pAD->afindex[y]->attrFile & FILE_ARCHIVED))) | 
|---|
|  | 1314 | ret = FALSE; | 
|---|
|  | 1315 | else | 
|---|
|  | 1316 | if (((mask.antiattr & FILE_HIDDEN) | 
|---|
|  | 1317 | && !(pAD->afindex[y]->attrFile & FILE_HIDDEN)) | 
|---|
|  | 1318 | || ((mask.antiattr & FILE_SYSTEM) | 
|---|
|  | 1319 | && !(pAD->afindex[y]->attrFile & FILE_SYSTEM)) | 
|---|
|  | 1320 | || ((mask.antiattr & FILE_READONLY) | 
|---|
|  | 1321 | && !(pAD->afindex[y]->attrFile & FILE_READONLY)) | 
|---|
|  | 1322 | || ((mask.antiattr & FILE_ARCHIVED) | 
|---|
|  | 1323 | && !(pAD->afindex[y]->attrFile & FILE_ARCHIVED))) | 
|---|
|  | 1324 | ret = FALSE; | 
|---|
| [2] | 1325 | } | 
|---|
| [84] | 1326 | if (ret) { | 
|---|
| [1335] | 1327 | if (deselect) { | 
|---|
|  | 1328 | if (pAD->afindex[y]->flags & AF_SELECTED) { | 
|---|
|  | 1329 | pAD->selected--; | 
|---|
|  | 1330 | pAD->ullSelectedBytes -= pAD->afindex[y]->cbFile; | 
|---|
|  | 1331 | pAD->afindex[y]->flags &= ~AF_SELECTED; | 
|---|
|  | 1332 | } | 
|---|
|  | 1333 | } | 
|---|
|  | 1334 | else { | 
|---|
|  | 1335 | if (~pAD->afindex[y]->flags & AF_SELECTED) { | 
|---|
|  | 1336 | pAD->selected++; | 
|---|
|  | 1337 | pAD->ullSelectedBytes += pAD->afindex[y]->cbFile; | 
|---|
|  | 1338 | pAD->afindex[y]->flags |= AF_SELECTED; | 
|---|
|  | 1339 | } | 
|---|
|  | 1340 | } | 
|---|
| [2] | 1341 | } | 
|---|
| [1158] | 1342 | }                                   // for | 
|---|
| [2] | 1343 | } | 
|---|
|  | 1344 | } | 
|---|
|  | 1345 |  | 
|---|
| [551] | 1346 | static VOID CollectList(HWND hwnd, CHAR ** list) | 
|---|
| [162] | 1347 | { | 
|---|
| [551] | 1348 | if (!Collector) { | 
|---|
|  | 1349 | if (hwndMain && !fExternalCollector && !strcmp(realappname, FM3Str)) { | 
|---|
| [2] | 1350 |  | 
|---|
|  | 1351 | HWND hwndC; | 
|---|
| [551] | 1352 | SWP swp; | 
|---|
| [2] | 1353 |  | 
|---|
| [551] | 1354 | if (!fAutoTile) | 
|---|
| [1335] | 1355 | GetNextWindowPos(hwndMain, &swp, NULL, NULL); | 
|---|
| [551] | 1356 | hwndC = StartCollector(hwndMain, 4); | 
|---|
|  | 1357 | if (hwndC) { | 
|---|
| [1335] | 1358 | if (!fAutoTile) | 
|---|
|  | 1359 | WinSetWindowPos(hwndC, HWND_TOP, swp.x, swp.y, | 
|---|
|  | 1360 | swp.cx, swp.cy, SWP_MOVE | SWP_SIZE | | 
|---|
|  | 1361 | SWP_SHOW | SWP_ZORDER); | 
|---|
|  | 1362 | else | 
|---|
|  | 1363 | TileChildren(hwndMain, TRUE); | 
|---|
|  | 1364 | WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE); | 
|---|
|  | 1365 | DosSleep(100);//05 Aug 07 GKY 250 | 
|---|
| [2] | 1366 | } | 
|---|
|  | 1367 | } | 
|---|
|  | 1368 | else { | 
|---|
| [551] | 1369 | StartCollector(HWND_DESKTOP, 4); | 
|---|
| [771] | 1370 | DosSleep(100);//05 Aug 07 GKY 250 | 
|---|
| [2] | 1371 | } | 
|---|
|  | 1372 | } | 
|---|
| [551] | 1373 | if (!PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_COLLECTOR, 0), | 
|---|
| [1335] | 1374 | MPFROMP(list))) | 
|---|
| [2] | 1375 | FreeList(list); | 
|---|
|  | 1376 | } | 
|---|
|  | 1377 |  | 
|---|
| [551] | 1378 | static VOID FreeAllFilesList(HWND hwnd) | 
|---|
| [162] | 1379 | { | 
|---|
| [551] | 1380 | ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| [2] | 1381 | register ULONG x; | 
|---|
|  | 1382 |  | 
|---|
| [943] | 1383 | if (ad->afhead && ad->afheadcnt) { | 
|---|
|  | 1384 | for (x = 0; x < ad->afheadcnt; x++) { | 
|---|
| [1009] | 1385 | xfree(ad->afhead[x].fullname, pszSrcFile, __LINE__); | 
|---|
| [2] | 1386 | } | 
|---|
| [1039] | 1387 | free(ad->afhead); | 
|---|
| [2] | 1388 | ad->afhead = NULL; | 
|---|
| [1009] | 1389 | xfree(ad->afindex, pszSrcFile, __LINE__); | 
|---|
| [2] | 1390 | ad->afindex = NULL; | 
|---|
|  | 1391 | } | 
|---|
|  | 1392 | DosPostEventSem(CompactSem); | 
|---|
| [943] | 1393 | ad->afalloc = ad->afindexcnt = ad->afheadcnt = ad->longest = ad->longestw = | 
|---|
| [2] | 1394 | ad->maxx = ad->horzscroll = 0; | 
|---|
|  | 1395 | } | 
|---|
|  | 1396 |  | 
|---|
| [551] | 1397 | static CHAR **BuildAList(HWND hwnd) | 
|---|
| [162] | 1398 | { | 
|---|
| [551] | 1399 | ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
|  | 1400 | ULONG x; | 
|---|
|  | 1401 | ULONG y; | 
|---|
|  | 1402 | ULONG z = 0; | 
|---|
|  | 1403 | CHAR **list = NULL; | 
|---|
| [907] | 1404 | UINT numfiles = 0; | 
|---|
|  | 1405 | UINT numalloc = 0; | 
|---|
| [551] | 1406 | INT error; | 
|---|
| [2] | 1407 |  | 
|---|
| [551] | 1408 | if (ad->selected) { | 
|---|
| [943] | 1409 | for (x = 0; x < ad->afindexcnt; x++) { | 
|---|
|  | 1410 | y = (ad->invertsort) ? (ad->afindexcnt - 1) - x : x; | 
|---|
| [551] | 1411 | if (ad->afindex[y]->flags & AF_SELECTED) { | 
|---|
| [1335] | 1412 | error = AddToList(ad->afindex[y]->fullname, &list, | 
|---|
|  | 1413 | &numfiles, &numalloc); | 
|---|
|  | 1414 | if (error) | 
|---|
|  | 1415 | break; | 
|---|
|  | 1416 | z++; | 
|---|
|  | 1417 | if (z >= ad->selected) | 
|---|
|  | 1418 | break; | 
|---|
| [2] | 1419 | } | 
|---|
|  | 1420 | } | 
|---|
|  | 1421 | } | 
|---|
|  | 1422 | return list; | 
|---|
|  | 1423 | } | 
|---|
|  | 1424 |  | 
|---|
| [551] | 1425 | static BOOL Mark(HWND hwnd, INT command, CHAR ** list) | 
|---|
| [84] | 1426 | { | 
|---|
| [2] | 1427 | /* Marks only unfiltered files */ | 
|---|
|  | 1428 |  | 
|---|
| [551] | 1429 | ALLDATA *pAD = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
|  | 1430 | register ULONG x, y, z; | 
|---|
|  | 1431 | BOOL ret = TRUE; | 
|---|
|  | 1432 | BOOL didone = FALSE; | 
|---|
| [2] | 1433 |  | 
|---|
| [943] | 1434 | for (x = 0; x < pAD->afindexcnt; x++) { | 
|---|
|  | 1435 | y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x; | 
|---|
| [551] | 1436 | if (list) { | 
|---|
| [2] | 1437 | ret = FALSE; | 
|---|
| [551] | 1438 | for (z = 0; list[z]; z++) { | 
|---|
| [1335] | 1439 | if (!stricmp(list[z], pAD->afindex[y]->fullname)) { | 
|---|
|  | 1440 | ret = TRUE; | 
|---|
|  | 1441 | break; | 
|---|
|  | 1442 | } | 
|---|
| [2] | 1443 | } | 
|---|
|  | 1444 | } | 
|---|
| [551] | 1445 | if (ret) { | 
|---|
| [2] | 1446 | didone = TRUE; | 
|---|
| [84] | 1447 | if (command == AFM_UNMARK) { | 
|---|
| [1335] | 1448 | if (pAD->afindex[y]->flags & AF_SELECTED) { | 
|---|
|  | 1449 | pAD->selected--; | 
|---|
|  | 1450 | pAD->ullSelectedBytes -= pAD->afindex[y]->cbFile; | 
|---|
|  | 1451 | pAD->afindex[y]->flags &= ~AF_SELECTED; | 
|---|
|  | 1452 | } | 
|---|
| [2] | 1453 | } | 
|---|
| [84] | 1454 | else if (command == AFM_MARK) { | 
|---|
| [1335] | 1455 | if (~pAD->afindex[y]->flags & AF_SELECTED) { | 
|---|
|  | 1456 | pAD->selected++; | 
|---|
|  | 1457 | pAD->ullSelectedBytes += pAD->afindex[y]->cbFile; | 
|---|
|  | 1458 | pAD->afindex[y]->flags |= AF_SELECTED; | 
|---|
|  | 1459 | } | 
|---|
| [2] | 1460 | } | 
|---|
| [84] | 1461 | else if (command == AFM_INVERT) { | 
|---|
| [1335] | 1462 | if (pAD->afindex[y]->flags & AF_SELECTED) { | 
|---|
|  | 1463 | pAD->selected--; | 
|---|
|  | 1464 | pAD->ullSelectedBytes -= pAD->afindex[y]->cbFile; | 
|---|
|  | 1465 | pAD->afindex[y]->flags &= ~AF_SELECTED; | 
|---|
|  | 1466 | } | 
|---|
|  | 1467 | else { | 
|---|
|  | 1468 | pAD->selected++; | 
|---|
|  | 1469 | pAD->ullSelectedBytes += pAD->afindex[y]->cbFile; | 
|---|
|  | 1470 | pAD->afindex[y]->flags |= AF_SELECTED; | 
|---|
|  | 1471 | } | 
|---|
| [2] | 1472 | } | 
|---|
| [84] | 1473 | else if (command == AFM_MARKDELETED) { | 
|---|
| [1335] | 1474 | if (pAD->afindex[y]->flags & AF_SELECTED) | 
|---|
|  | 1475 | pAD->afindex[y]->flags |= AF_DELETED; | 
|---|
| [2] | 1476 | } | 
|---|
| [551] | 1477 | else if (command == AFM_FILTER) { | 
|---|
| [1335] | 1478 | if (pAD->afindex[y]->flags & AF_SELECTED) | 
|---|
|  | 1479 | pAD->afindex[y]->flags |= AF_FILTERED; | 
|---|
| [2] | 1480 | } | 
|---|
|  | 1481 | } | 
|---|
| [1158] | 1482 | }                                     // for x | 
|---|
| [2] | 1483 | return didone; | 
|---|
|  | 1484 | } | 
|---|
|  | 1485 |  | 
|---|
| [783] | 1486 | static BOOL UpdateList(HWND hwnd, CHAR **list) | 
|---|
| [162] | 1487 | { | 
|---|
| [2] | 1488 | /* Updates files in the list */ | 
|---|
|  | 1489 |  | 
|---|
| [551] | 1490 | ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| [783] | 1491 | ULONG x, z; | 
|---|
| [551] | 1492 | BOOL ret, didone = FALSE; | 
|---|
| [841] | 1493 | FILEFINDBUF3L ffb; | 
|---|
| [783] | 1494 | ULONG ulFindCnt; | 
|---|
| [551] | 1495 | HDIR hdir; | 
|---|
|  | 1496 | CHAR *p; | 
|---|
| [2] | 1497 |  | 
|---|
| [551] | 1498 | if (list) { | 
|---|
|  | 1499 | for (z = 0; list[z] && !ad->stopflag; z++) { | 
|---|
| [2] | 1500 | ret = FALSE; | 
|---|
| [943] | 1501 | for (x = 0; x < ad->afheadcnt; x++) { | 
|---|
| [1335] | 1502 | if (!stricmp(list[z], ad->afhead[x].fullname)) { | 
|---|
|  | 1503 | ret = TRUE; | 
|---|
|  | 1504 | break; | 
|---|
|  | 1505 | } | 
|---|
| [2] | 1506 | } | 
|---|
| [551] | 1507 | if (ret) { | 
|---|
| [1335] | 1508 | didone = TRUE; | 
|---|
|  | 1509 | hdir = HDIR_CREATE; | 
|---|
|  | 1510 | ulFindCnt = 1; | 
|---|
|  | 1511 | if (!xDosFindFirst(list[z], &hdir, FILE_NORMAL | FILE_ARCHIVED | | 
|---|
|  | 1512 | FILE_DIRECTORY | FILE_READONLY | FILE_SYSTEM | | 
|---|
|  | 1513 | FILE_HIDDEN, &ffb, sizeof(ffb), &ulFindCnt, | 
|---|
|  | 1514 | FIL_STANDARDL)) { | 
|---|
|  | 1515 | DosFindClose(hdir); | 
|---|
|  | 1516 | if (!(ffb.attrFile & FILE_DIRECTORY)) { | 
|---|
|  | 1517 | ad->afhead[x].attrFile = (USHORT) ffb.attrFile; | 
|---|
|  | 1518 | ad->afhead[x].cbFile = ffb.cbFile; | 
|---|
|  | 1519 | ad->afhead[x].date = ffb.fdateLastWrite; | 
|---|
|  | 1520 | ad->afhead[x].time = ffb.ftimeLastWrite; | 
|---|
|  | 1521 | } | 
|---|
|  | 1522 | else | 
|---|
|  | 1523 | ad->afhead[x].flags |= AF_DELETED; | 
|---|
|  | 1524 | } | 
|---|
|  | 1525 | else | 
|---|
|  | 1526 | ad->afhead[x].flags |= AF_DELETED; | 
|---|
| [2] | 1527 | } | 
|---|
| [551] | 1528 | else if (isalpha(*list[z]) && ad->abDrvFlags[toupper(*list[z]) - 'A']) { | 
|---|
| [1335] | 1529 | didone = TRUE; | 
|---|
|  | 1530 | hdir = HDIR_CREATE; | 
|---|
|  | 1531 | ulFindCnt = 1; | 
|---|
|  | 1532 | if (!xDosFindFirst(list[z], &hdir, FILE_NORMAL | FILE_ARCHIVED | | 
|---|
|  | 1533 | FILE_DIRECTORY | FILE_READONLY | FILE_SYSTEM | | 
|---|
|  | 1534 | FILE_HIDDEN, &ffb, sizeof(ffb), &ulFindCnt, | 
|---|
|  | 1535 | FIL_STANDARDL)) { | 
|---|
|  | 1536 | DosFindClose(hdir); | 
|---|
|  | 1537 | if (!(ffb.attrFile & FILE_DIRECTORY)) { | 
|---|
|  | 1538 | if (!ad->afalloc || ad->afheadcnt > ad->afalloc - 1) { | 
|---|
| [2] | 1539 |  | 
|---|
| [1335] | 1540 | ALLFILES *temp, **templ; | 
|---|
| [2] | 1541 |  | 
|---|
| [1335] | 1542 | temp = | 
|---|
|  | 1543 | xrealloc(ad->afhead, (ad->afalloc + 1) * sizeof(ALLFILES), | 
|---|
|  | 1544 | pszSrcFile, __LINE__); | 
|---|
|  | 1545 | if (!temp) { | 
|---|
|  | 1546 | ad->stopflag = 1; | 
|---|
|  | 1547 | break; | 
|---|
|  | 1548 | } | 
|---|
|  | 1549 | else { | 
|---|
|  | 1550 | ad->afhead = temp; | 
|---|
|  | 1551 | templ = | 
|---|
|  | 1552 | xrealloc(ad->afindex, | 
|---|
|  | 1553 | (ad->afalloc + 1) * sizeof(ALLFILES *), pszSrcFile, | 
|---|
|  | 1554 | __LINE__); | 
|---|
|  | 1555 | if (!templ) { | 
|---|
|  | 1556 | ad->stopflag = 1; | 
|---|
|  | 1557 | break; | 
|---|
|  | 1558 | } | 
|---|
|  | 1559 | else | 
|---|
|  | 1560 | ad->afindex = templ; | 
|---|
|  | 1561 | ad->afalloc++; | 
|---|
|  | 1562 | } | 
|---|
|  | 1563 | } | 
|---|
|  | 1564 | ad->afhead[ad->afheadcnt].fullname = | 
|---|
|  | 1565 | xstrdup(list[z], pszSrcFile, __LINE__); | 
|---|
|  | 1566 | if (ad->afhead[ad->afheadcnt].fullname) { | 
|---|
|  | 1567 | p = strrchr(ad->afhead[ad->afheadcnt].fullname, '\\'); | 
|---|
|  | 1568 | if (!p) | 
|---|
|  | 1569 | p = ad->afhead[ad->afheadcnt].fullname; | 
|---|
|  | 1570 | else | 
|---|
|  | 1571 | p++; | 
|---|
|  | 1572 | ad->afhead[ad->afheadcnt].filename = p; | 
|---|
|  | 1573 | ad->afhead[ad->afheadcnt].cbFile = ffb.cbFile; | 
|---|
|  | 1574 | ad->afhead[ad->afheadcnt].date = ffb.fdateLastWrite; | 
|---|
|  | 1575 | ad->afhead[ad->afheadcnt].time = ffb.ftimeLastWrite; | 
|---|
|  | 1576 | ad->afhead[ad->afheadcnt].attrFile = (USHORT) ffb.attrFile; | 
|---|
|  | 1577 | ad->afhead[ad->afheadcnt].flags = 0; | 
|---|
|  | 1578 | if (ad->longest < strlen(ad->afhead[ad->afheadcnt].filename)) | 
|---|
|  | 1579 | ad->longest = strlen(ad->afhead[ad->afheadcnt].filename); | 
|---|
|  | 1580 | if (ad->longestw < strlen(ad->afhead[ad->afheadcnt].fullname)) | 
|---|
|  | 1581 | ad->longestw = strlen(ad->afhead[ad->afheadcnt].fullname); | 
|---|
| [2] | 1582 |  | 
|---|
| [1335] | 1583 | ad->afheadcnt++; | 
|---|
|  | 1584 | } | 
|---|
|  | 1585 | else { | 
|---|
|  | 1586 | ad->stopflag = 1; | 
|---|
|  | 1587 | break; | 
|---|
|  | 1588 | } | 
|---|
|  | 1589 | } | 
|---|
|  | 1590 | } | 
|---|
| [2] | 1591 | } | 
|---|
|  | 1592 | } | 
|---|
|  | 1593 | } | 
|---|
|  | 1594 | return didone; | 
|---|
|  | 1595 | } | 
|---|
|  | 1596 |  | 
|---|
| [551] | 1597 | static int comparefullnames(const void *v1, const void *v2) | 
|---|
| [162] | 1598 | { | 
|---|
| [551] | 1599 | ALLFILES *d1 = *(ALLFILES **) v1; | 
|---|
|  | 1600 | ALLFILES *d2 = *(ALLFILES **) v2; | 
|---|
|  | 1601 | int ret; | 
|---|
| [2] | 1602 |  | 
|---|
| [551] | 1603 | ret = stricmp(d1->fullname, d2->fullname); | 
|---|
| [2] | 1604 | return ret; | 
|---|
|  | 1605 | } | 
|---|
|  | 1606 |  | 
|---|
| [551] | 1607 | static int comparenames(const void *v1, const void *v2) | 
|---|
| [162] | 1608 | { | 
|---|
| [551] | 1609 | ALLFILES *d1 = *(ALLFILES **) v1; | 
|---|
|  | 1610 | ALLFILES *d2 = *(ALLFILES **) v2; | 
|---|
|  | 1611 | int ret; | 
|---|
| [2] | 1612 |  | 
|---|
| [551] | 1613 | ret = stricmp(d1->filename, d2->filename); | 
|---|
|  | 1614 | if (!ret) | 
|---|
|  | 1615 | ret = comparefullnames(v1, v2); | 
|---|
| [2] | 1616 | return ret; | 
|---|
|  | 1617 | } | 
|---|
|  | 1618 |  | 
|---|
| [551] | 1619 | static int compareexts(const void *v1, const void *v2) | 
|---|
| [162] | 1620 | { | 
|---|
| [551] | 1621 | ALLFILES *d1 = *(ALLFILES **) v1; | 
|---|
|  | 1622 | ALLFILES *d2 = *(ALLFILES **) v2; | 
|---|
|  | 1623 | register CHAR *p1, *p2; | 
|---|
|  | 1624 | int ret; | 
|---|
| [2] | 1625 |  | 
|---|
| [551] | 1626 | p1 = strrchr(d1->filename, '.'); | 
|---|
|  | 1627 | p2 = strrchr(d2->filename, '.'); | 
|---|
|  | 1628 | if (!p1) | 
|---|
| [2] | 1629 | p1 = NullStr; | 
|---|
|  | 1630 | else | 
|---|
|  | 1631 | p1++; | 
|---|
| [551] | 1632 | if (!p2) | 
|---|
| [2] | 1633 | p2 = NullStr; | 
|---|
|  | 1634 | else | 
|---|
|  | 1635 | p2++; | 
|---|
| [551] | 1636 | ret = stricmp(p1, p2); | 
|---|
|  | 1637 | if (!ret) | 
|---|
|  | 1638 | ret = comparenames(v1, v2); | 
|---|
| [2] | 1639 | return ret; | 
|---|
|  | 1640 | } | 
|---|
|  | 1641 |  | 
|---|
| [551] | 1642 | static int comparesizes(const void *v1, const void *v2) | 
|---|
| [162] | 1643 | { | 
|---|
| [551] | 1644 | ALLFILES *d1 = *(ALLFILES **) v1; | 
|---|
|  | 1645 | ALLFILES *d2 = *(ALLFILES **) v2; | 
|---|
|  | 1646 | int ret; | 
|---|
| [2] | 1647 |  | 
|---|
|  | 1648 | ret = (d1->cbFile > d2->cbFile) ? 1 : (d1->cbFile == d2->cbFile) ? 0 : -1; | 
|---|
| [551] | 1649 | if (!ret) | 
|---|
|  | 1650 | ret = comparenames(v1, v2); | 
|---|
| [2] | 1651 | return ret; | 
|---|
|  | 1652 | } | 
|---|
|  | 1653 |  | 
|---|
| [551] | 1654 | static int comparedates(const void *v1, const void *v2) | 
|---|
| [162] | 1655 | { | 
|---|
| [551] | 1656 | ALLFILES *d1 = *(ALLFILES **) v1; | 
|---|
|  | 1657 | ALLFILES *d2 = *(ALLFILES **) v2; | 
|---|
| [2] | 1658 | int ret; | 
|---|
|  | 1659 |  | 
|---|
| [897] | 1660 | ret = TestFDates(NULL, NULL, | 
|---|
| [1335] | 1661 | &d2->date, &d2->time, | 
|---|
|  | 1662 | &d1->date, &d1->time); | 
|---|
| [2] | 1663 |  | 
|---|
| [551] | 1664 | if (!ret) | 
|---|
|  | 1665 | ret = comparenames(v1, v2); | 
|---|
| [2] | 1666 | return ret; | 
|---|
|  | 1667 | } | 
|---|
|  | 1668 |  | 
|---|
| [551] | 1669 | static VOID ReSort(HWND hwnd) | 
|---|
| [162] | 1670 | { | 
|---|
| [551] | 1671 | ALLDATA *pAD = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
|  | 1672 | register ULONG x, y; | 
|---|
| [2] | 1673 |  | 
|---|
| [84] | 1674 | pAD->selected = 0; | 
|---|
| [162] | 1675 | pAD->ullSelectedBytes = 0; | 
|---|
| [943] | 1676 | for (x = 0, y = 0; x < pAD->afheadcnt; x++) { | 
|---|
| [551] | 1677 | if (!(pAD->afhead[x].flags & (AF_DELETED | AF_FILTERED))) { | 
|---|
| [84] | 1678 | if (pAD->afhead[x].flags & AF_SELECTED) { | 
|---|
| [1335] | 1679 | pAD->selected++; | 
|---|
|  | 1680 | pAD->ullSelectedBytes += pAD->afhead[x].cbFile; | 
|---|
| [2] | 1681 | } | 
|---|
| [84] | 1682 | pAD->afindex[y++] = &(pAD->afhead[x]); | 
|---|
| [2] | 1683 | } | 
|---|
| [1158] | 1684 | }                                     // for x | 
|---|
| [943] | 1685 | pAD->afindexcnt = y; | 
|---|
| [551] | 1686 | PostMsg(hwnd, UM_SETUP3, MPVOID, MPVOID); | 
|---|
| [943] | 1687 | if (!pAD->stopflag && pAD->pfnCompare && pAD->afindexcnt) { | 
|---|
| [766] | 1688 | WinSendMsg(hwnd, UM_RESCAN, MPFROMLONG(1), MPVOID); | 
|---|
| [943] | 1689 | qsort(pAD->afindex, pAD->afindexcnt, sizeof(ALLFILES *), pAD->pfnCompare); | 
|---|
| [2] | 1690 | } | 
|---|
|  | 1691 | } | 
|---|
|  | 1692 |  | 
|---|
| [787] | 1693 | VOID FindDupesThread(VOID * args) | 
|---|
| [162] | 1694 | { | 
|---|
| [551] | 1695 | register ULONG x, z; | 
|---|
|  | 1696 | register CHAR *px, *pz; | 
|---|
|  | 1697 | CHAR s[80]; | 
|---|
|  | 1698 | INT error; | 
|---|
|  | 1699 | HWND hwnd = (HWND) args; | 
|---|
|  | 1700 | HAB hab2 = (HAB) 0; | 
|---|
|  | 1701 | HMQ hmq2 = (HMQ) 0; | 
|---|
|  | 1702 | ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| [2] | 1703 |  | 
|---|
| [1038] | 1704 | # ifdef FORTIFY | 
|---|
|  | 1705 | Fortify_EnterScope(); | 
|---|
| [1063] | 1706 | #  endif | 
|---|
| [551] | 1707 | if (!DosRequestMutexSem(ad->hmtxScan, SEM_INDEFINITE_WAIT)) { | 
|---|
| [2] | 1708 | priority_normal(); | 
|---|
|  | 1709 | hab2 = WinInitialize(0); | 
|---|
| [551] | 1710 | if (hab2) { | 
|---|
|  | 1711 | hmq2 = WinCreateMsgQueue(hab2, 0); | 
|---|
|  | 1712 | if (hmq2) { | 
|---|
| [1335] | 1713 | WinCancelShutdown(hmq2, TRUE); | 
|---|
|  | 1714 | IncrThreadUsage(); | 
|---|
|  | 1715 | if (ad->cursored <= ad->afindexcnt) { | 
|---|
|  | 1716 | for (x = 0; x < ad->afheadcnt; x++) | 
|---|
|  | 1717 | ad->afhead[x].flags &= (~(AF_DUPE | AF_SELECTED)); | 
|---|
|  | 1718 | DosSleep(0);  //26 Aug 07 GKY 1 | 
|---|
|  | 1719 | for (x = 0; x < ad->afheadcnt && !ad->stopflag; x++) { | 
|---|
|  | 1720 | if (!(ad->afhead[x].flags & (AF_DUPE | AF_FILTERED))) { | 
|---|
|  | 1721 | if (!(x % 50)) { | 
|---|
|  | 1722 | sprintf(s, | 
|---|
|  | 1723 | GetPString(IDS_DUPECHECKINGOFTEXT), x, ad->afheadcnt); | 
|---|
|  | 1724 | WinSetWindowText(ad->hwndStatus, s); | 
|---|
|  | 1725 | } | 
|---|
|  | 1726 | for (z = 0; z < ad->afheadcnt && !ad->stopflag; z++) { | 
|---|
|  | 1727 | if (x != z && | 
|---|
|  | 1728 | !(ad->afhead[z].flags & (AF_DUPE | AF_FILTERED))) | 
|---|
|  | 1729 | { | 
|---|
|  | 1730 | if (ad->dupeflags & DP_SIZES) { | 
|---|
|  | 1731 | if (ad->afhead[x].cbFile != ad->afhead[z].cbFile) | 
|---|
|  | 1732 | goto SkipNonDupe; | 
|---|
|  | 1733 | } | 
|---|
|  | 1734 | if (ad->dupeflags & DP_DATES) { | 
|---|
|  | 1735 | if (*(INT *) & ad->afhead[x].date != | 
|---|
|  | 1736 | *(INT *) & ad->afhead[z].date || | 
|---|
|  | 1737 | *(INT *) & ad->afhead[x].time != | 
|---|
|  | 1738 | *(INT *) & ad->afhead[z].time) | 
|---|
|  | 1739 | goto SkipNonDupe; | 
|---|
|  | 1740 | } | 
|---|
|  | 1741 | if (ad->dupeflags & DP_NAMES) { | 
|---|
|  | 1742 | if (ad->dupeflags & DP_EXTS) { | 
|---|
|  | 1743 | px = strrchr(ad->afhead[x].filename, '.'); | 
|---|
|  | 1744 | pz = strrchr(ad->afhead[z].filename, '.'); | 
|---|
|  | 1745 | if ((px || pz) && (!px || !pz)) | 
|---|
|  | 1746 | goto SkipNonDupe; | 
|---|
|  | 1747 | if (px) { | 
|---|
|  | 1748 | *px = 0; | 
|---|
|  | 1749 | *pz = 0; | 
|---|
|  | 1750 | } | 
|---|
|  | 1751 | } | 
|---|
|  | 1752 | if (stricmp(ad->afhead[x].filename, | 
|---|
|  | 1753 | ad->afhead[z].filename)) { | 
|---|
|  | 1754 | if (ad->dupeflags & DP_EXTS) { | 
|---|
|  | 1755 | if (px) { | 
|---|
|  | 1756 | *px = '.'; | 
|---|
|  | 1757 | *pz = '.'; | 
|---|
|  | 1758 | } | 
|---|
|  | 1759 | } | 
|---|
|  | 1760 | goto SkipNonDupe; | 
|---|
|  | 1761 | } | 
|---|
|  | 1762 | if (ad->dupeflags & DP_EXTS) { | 
|---|
|  | 1763 | if (px) { | 
|---|
|  | 1764 | *px = '.'; | 
|---|
|  | 1765 | *pz = '.'; | 
|---|
|  | 1766 | } | 
|---|
|  | 1767 | } | 
|---|
|  | 1768 | } | 
|---|
|  | 1769 | if (ad->dupeflags & DP_CRCS) { | 
|---|
|  | 1770 | if (!(ad->afhead[x].flags & AF_CRCED)) { | 
|---|
|  | 1771 | ad->afhead[x].CRC = CRCFile(ad->afhead[x].fullname, | 
|---|
|  | 1772 | &error); | 
|---|
|  | 1773 | if (!error) | 
|---|
|  | 1774 | ad->afhead[x].flags |= AF_CRCED; | 
|---|
|  | 1775 | } | 
|---|
|  | 1776 | if (!(ad->afhead[z].flags & AF_CRCED)) { | 
|---|
|  | 1777 | ad->afhead[z].CRC = CRCFile(ad->afhead[z].fullname, | 
|---|
|  | 1778 | &error); | 
|---|
|  | 1779 | if (!error) | 
|---|
|  | 1780 | ad->afhead[z].flags |= AF_CRCED; | 
|---|
|  | 1781 | } | 
|---|
|  | 1782 | if ((ad->afhead[x].flags & AF_CRCED) && | 
|---|
|  | 1783 | (ad->afhead[z].flags & AF_CRCED)) { | 
|---|
|  | 1784 | if (ad->afhead[x].CRC != ad->afhead[z].CRC) | 
|---|
|  | 1785 | goto SkipNonDupe; | 
|---|
|  | 1786 | } | 
|---|
|  | 1787 | DosSleep(0); | 
|---|
|  | 1788 | } | 
|---|
|  | 1789 | ad->afhead[x].flags |= AF_DUPE; | 
|---|
|  | 1790 | ad->afhead[z].flags |= AF_DUPE; | 
|---|
|  | 1791 | SkipNonDupe: | 
|---|
|  | 1792 | ; | 
|---|
|  | 1793 | } | 
|---|
|  | 1794 | } // for | 
|---|
|  | 1795 | DosSleep(0); | 
|---|
|  | 1796 | } | 
|---|
|  | 1797 | } // for | 
|---|
|  | 1798 | for (x = 0; x < ad->afheadcnt && !ad->stopflag; x++) { | 
|---|
|  | 1799 | if (!(ad->afhead[x].flags & AF_DUPE)) | 
|---|
|  | 1800 | ad->afhead[x].flags |= AF_FILTERED; | 
|---|
|  | 1801 | } | 
|---|
|  | 1802 | ReSort(hwnd); | 
|---|
|  | 1803 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
|  | 1804 | } | 
|---|
| [2] | 1805 | } | 
|---|
|  | 1806 | } | 
|---|
| [551] | 1807 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
| [162] | 1808 | DosReleaseMutexSem(ad->hmtxScan); | 
|---|
| [787] | 1809 | } // if got sem | 
|---|
| [551] | 1810 | if (hmq2) { | 
|---|
|  | 1811 | PostMsg(hwnd, UM_CONTAINER_FILLED, MPVOID, MPVOID); | 
|---|
| [533] | 1812 | WinDestroyMsgQueue(hmq2); | 
|---|
| [2] | 1813 | } | 
|---|
| [551] | 1814 | if (hab2) { | 
|---|
| [533] | 1815 | DecrThreadUsage(); | 
|---|
| [2] | 1816 | WinTerminate(hab2); | 
|---|
| [533] | 1817 | } | 
|---|
| [1038] | 1818 | # ifdef FORTIFY | 
|---|
| [1063] | 1819 | Fortify_LeaveScope(); | 
|---|
|  | 1820 | #  endif | 
|---|
| [2] | 1821 | } | 
|---|
|  | 1822 |  | 
|---|
| [961] | 1823 | static VOID FilterAll(HWND hwnd, ALLDATA *ad); | 
|---|
|  | 1824 |  | 
|---|
| [551] | 1825 | static VOID FilterList(HWND hwnd) | 
|---|
| [162] | 1826 | { | 
|---|
| [958] | 1827 | ULONG x; | 
|---|
| [551] | 1828 | ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
|  | 1829 | CHAR *p; | 
|---|
| [2] | 1830 |  | 
|---|
| [943] | 1831 | if (ad->cursored <= ad->afindexcnt) { | 
|---|
| [2] | 1832 | x = ad->cursored - 1; | 
|---|
| [943] | 1833 | x = (ad->invertsort) ? (ad->afindexcnt - 1) - x : x; | 
|---|
| [551] | 1834 | p = strrchr(ad->afindex[x]->filename, '.'); | 
|---|
|  | 1835 | if (p) { | 
|---|
|  | 1836 | strcpy(ad->mask.szMask, "*"); | 
|---|
|  | 1837 | strcat(ad->mask.szMask, p); | 
|---|
| [2] | 1838 | } | 
|---|
|  | 1839 | } | 
|---|
|  | 1840 | *(ad->mask.prompt) = 0; | 
|---|
|  | 1841 | ad->mask.fIsSeeAll = TRUE; | 
|---|
| [551] | 1842 | if (WinDlgBox(HWND_DESKTOP, hwnd, PickMaskDlgProc, | 
|---|
| [1335] | 1843 | FM3ModHandle, MSK_FRAME, MPFROMP(&ad->mask))) | 
|---|
| [958] | 1844 | FilterAll(hwnd, ad); | 
|---|
|  | 1845 | } | 
|---|
|  | 1846 |  | 
|---|
|  | 1847 | static VOID FilterAll(HWND hwnd, ALLDATA *ad) | 
|---|
|  | 1848 | { | 
|---|
|  | 1849 | ULONG x, z; | 
|---|
|  | 1850 | BOOL ret; | 
|---|
|  | 1851 |  | 
|---|
|  | 1852 | if (ad) { | 
|---|
| [943] | 1853 | for (x = 0; x < ad->afheadcnt; x++) { | 
|---|
| [2] | 1854 | ret = FALSE; | 
|---|
| [551] | 1855 | if (ad->mask.pszMasks[1]) { | 
|---|
| [1335] | 1856 | for (z = 0; ad->mask.pszMasks[z]; z++) { | 
|---|
|  | 1857 | if (*ad->mask.pszMasks[z]) { | 
|---|
|  | 1858 | if (*ad->mask.pszMasks[z] != '/') { | 
|---|
|  | 1859 | if (wildcard((strchr(ad->mask.pszMasks[z], '\\') || | 
|---|
|  | 1860 | strchr(ad->mask.pszMasks[z], ':')) ? | 
|---|
|  | 1861 | ad->afhead[x].fullname : ad->afhead[x].filename, | 
|---|
|  | 1862 | ad->mask.pszMasks[z], FALSE)) | 
|---|
|  | 1863 | ret = TRUE; | 
|---|
|  | 1864 | } | 
|---|
|  | 1865 | else { | 
|---|
|  | 1866 | if (wildcard((strchr(ad->mask.pszMasks[z], '\\') || | 
|---|
|  | 1867 | strchr(ad->mask.pszMasks[z], ':')) ? | 
|---|
|  | 1868 | ad->afhead[x].fullname : ad->afhead[x].filename, | 
|---|
|  | 1869 | ad->mask.pszMasks[z] + 1, FALSE)) { | 
|---|
|  | 1870 | ret = FALSE; | 
|---|
|  | 1871 | break; | 
|---|
|  | 1872 | } | 
|---|
|  | 1873 | } | 
|---|
|  | 1874 | } | 
|---|
|  | 1875 | } | 
|---|
| [2] | 1876 | } | 
|---|
| [551] | 1877 | else if (*ad->mask.szMask) { | 
|---|
| [1335] | 1878 | if (wildcard((strchr(ad->mask.szMask, '\\') || | 
|---|
|  | 1879 | strchr(ad->mask.szMask, ':')) ? | 
|---|
|  | 1880 | ad->afhead[x].fullname : ad->afhead[x].filename, | 
|---|
|  | 1881 | ad->mask.szMask, FALSE)) | 
|---|
|  | 1882 | ret = TRUE; | 
|---|
| [2] | 1883 | } | 
|---|
|  | 1884 | else | 
|---|
| [1335] | 1885 | ret = TRUE; | 
|---|
| [2] | 1886 |  | 
|---|
| [551] | 1887 | if (ret) { | 
|---|
| [1335] | 1888 | if ((!(ad->mask.attrFile & FILE_HIDDEN) | 
|---|
|  | 1889 | && (ad->afhead[x].attrFile & FILE_HIDDEN)) | 
|---|
|  | 1890 | || (!(ad->mask.attrFile & FILE_SYSTEM) | 
|---|
|  | 1891 | && (ad->afhead[x].attrFile & FILE_SYSTEM)) | 
|---|
|  | 1892 | || (!(ad->mask.attrFile & FILE_READONLY) | 
|---|
|  | 1893 | && (ad->afhead[x].attrFile & FILE_READONLY)) | 
|---|
|  | 1894 | || (!(ad->mask.attrFile & FILE_ARCHIVED) | 
|---|
|  | 1895 | && (ad->afhead[x].attrFile & FILE_ARCHIVED))) | 
|---|
|  | 1896 | ret = FALSE; | 
|---|
|  | 1897 | else | 
|---|
|  | 1898 | if (((ad->mask.antiattr & FILE_HIDDEN) | 
|---|
|  | 1899 | && !(ad->afhead[x].attrFile & FILE_HIDDEN)) | 
|---|
|  | 1900 | || ((ad->mask.antiattr & FILE_SYSTEM) | 
|---|
|  | 1901 | && !(ad->afhead[x].attrFile & FILE_SYSTEM)) | 
|---|
|  | 1902 | || ((ad->mask.antiattr & FILE_READONLY) | 
|---|
|  | 1903 | && !(ad->afhead[x].attrFile & FILE_READONLY)) | 
|---|
|  | 1904 | || ((ad->mask.antiattr & FILE_ARCHIVED) | 
|---|
|  | 1905 | && !(ad->afhead[x].attrFile & FILE_ARCHIVED))) | 
|---|
|  | 1906 | ret = FALSE; | 
|---|
| [2] | 1907 | } | 
|---|
|  | 1908 |  | 
|---|
| [551] | 1909 | if (!ret) | 
|---|
| [1335] | 1910 | ad->afhead[x].flags |= AF_FILTERED; | 
|---|
| [2] | 1911 | else | 
|---|
| [1335] | 1912 | ad->afhead[x].flags &= (~AF_FILTERED); | 
|---|
| [2] | 1913 | } | 
|---|
|  | 1914 | ReSort(hwnd); | 
|---|
| [551] | 1915 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
|  | 1916 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| [2] | 1917 | } | 
|---|
|  | 1918 | } | 
|---|
|  | 1919 |  | 
|---|
| [551] | 1920 | static ULONG RemoveDeleted(HWND hwnd) | 
|---|
| [162] | 1921 | { | 
|---|
| [551] | 1922 | ALLDATA *pAD = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| [943] | 1923 | ULONG oldafheadcnt = pAD->afheadcnt; | 
|---|
| [551] | 1924 | register ULONG x, y; | 
|---|
| [2] | 1925 |  | 
|---|
| [943] | 1926 | for (x = 0; x < pAD->afheadcnt; x++) { | 
|---|
| [84] | 1927 | if (pAD->afhead[x].flags & AF_DELETED) { | 
|---|
| [943] | 1928 | for (y = x; y < pAD->afheadcnt; y++) { | 
|---|
| [1335] | 1929 | if (~pAD->afhead[y].flags & AF_DELETED) | 
|---|
|  | 1930 | break; | 
|---|
|  | 1931 | if (pAD->afhead[y].flags & AF_SELECTED && | 
|---|
|  | 1932 | ~pAD->afhead[y].flags & AF_FILTERED) { | 
|---|
|  | 1933 | pAD->selected--; | 
|---|
|  | 1934 | pAD->ullSelectedBytes -= pAD->afhead[y].cbFile; | 
|---|
|  | 1935 | } | 
|---|
|  | 1936 | xfree(pAD->afhead[y].fullname, pszSrcFile, __LINE__); | 
|---|
| [2] | 1937 | } | 
|---|
| [551] | 1938 | memmove(&(pAD->afhead[x]), &(pAD->afhead[y]), | 
|---|
| [1335] | 1939 | (pAD->afheadcnt - y) * sizeof(ALLFILES)); | 
|---|
| [943] | 1940 | pAD->afheadcnt -= (y - x); | 
|---|
| [2] | 1941 | } | 
|---|
| [1158] | 1942 | }                                     // for x | 
|---|
| [943] | 1943 | if (pAD->afheadcnt != oldafheadcnt) { | 
|---|
| [2] | 1944 |  | 
|---|
| [551] | 1945 | ALLFILES *tempa, **templ; | 
|---|
| [2] | 1946 |  | 
|---|
| [943] | 1947 | if (!pAD->afheadcnt) | 
|---|
| [2] | 1948 | FreeAllFilesList(hwnd); | 
|---|
|  | 1949 | else { | 
|---|
| [551] | 1950 | tempa = | 
|---|
| [1335] | 1951 | xrealloc(pAD->afhead, pAD->afheadcnt * sizeof(ALLFILES), pszSrcFile, | 
|---|
|  | 1952 | __LINE__); | 
|---|
| [335] | 1953 | if (tempa) { | 
|---|
| [1335] | 1954 | pAD->afhead = tempa; | 
|---|
|  | 1955 | pAD->afalloc = pAD->afheadcnt; | 
|---|
| [2] | 1956 | } | 
|---|
| [551] | 1957 | templ = | 
|---|
| [1335] | 1958 | xrealloc(pAD->afindex, pAD->afheadcnt * sizeof(ALLFILES *), pszSrcFile, | 
|---|
|  | 1959 | __LINE__); | 
|---|
| [335] | 1960 | if (templ) | 
|---|
| [1335] | 1961 | pAD->afindex = templ; | 
|---|
| [2] | 1962 | DosPostEventSem(CompactSem); | 
|---|
|  | 1963 | ReSort(hwnd); | 
|---|
|  | 1964 | } | 
|---|
|  | 1965 | } | 
|---|
| [943] | 1966 | return pAD->afheadcnt; | 
|---|
| [2] | 1967 | } | 
|---|
|  | 1968 |  | 
|---|
| [551] | 1969 | static VOID DoADir(HWND hwnd, CHAR * pathname) | 
|---|
| [162] | 1970 | { | 
|---|
| [551] | 1971 | ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
|  | 1972 | CHAR *filename, *enddir; | 
|---|
| [841] | 1973 | PFILEFINDBUF3L pffbArray, pffbFile; | 
|---|
| [551] | 1974 | HDIR hdir = HDIR_CREATE; | 
|---|
| [783] | 1975 | ULONG ulFindCnt; | 
|---|
|  | 1976 | ULONG ulFindMax; | 
|---|
|  | 1977 | ULONG ulBufBytes; | 
|---|
|  | 1978 | ULONG x; | 
|---|
|  | 1979 | APIRET rc; | 
|---|
| [955] | 1980 | static BOOL fDone; | 
|---|
| [2] | 1981 |  | 
|---|
| [955] | 1982 | filename = xmalloc(CCHMAXPATH + 100, pszSrcFile, __LINE__); | 
|---|
| [551] | 1983 | if (!filename) | 
|---|
| [2] | 1984 | return; | 
|---|
| [335] | 1985 |  | 
|---|
| [787] | 1986 | ulFindMax = FilesToGet; | 
|---|
| [551] | 1987 | if (fRemoteBug && isalpha(*pathname) && pathname[1] == ':' && | 
|---|
|  | 1988 | pathname[2] == '\\' && | 
|---|
|  | 1989 | (driveflags[toupper(*pathname) - 'A'] & DRIVE_REMOTE)) | 
|---|
| [783] | 1990 | ulFindMax = 1; | 
|---|
|  | 1991 |  | 
|---|
| [841] | 1992 | ulBufBytes = sizeof(FILEFINDBUF3L) * ulFindMax; | 
|---|
| [783] | 1993 | pffbArray = xmalloc(ulBufBytes, pszSrcFile, __LINE__); | 
|---|
|  | 1994 | if (!pffbArray) { | 
|---|
| [1039] | 1995 | free(filename); | 
|---|
| [2] | 1996 | return; | 
|---|
|  | 1997 | } | 
|---|
| [783] | 1998 |  | 
|---|
| [551] | 1999 | strcpy(filename, pathname); | 
|---|
| [2] | 2000 | enddir = &filename[strlen(filename) - 1]; | 
|---|
| [551] | 2001 | if (*enddir != '\\') { | 
|---|
| [2] | 2002 | enddir++; | 
|---|
|  | 2003 | *enddir = '\\'; | 
|---|
|  | 2004 | } | 
|---|
|  | 2005 | enddir++; | 
|---|
| [551] | 2006 | strcpy(enddir, "*"); | 
|---|
| [2] | 2007 | DosError(FERR_DISABLEHARDERR); | 
|---|
| [783] | 2008 | ulFindCnt = ulFindMax; | 
|---|
| [838] | 2009 | rc = xDosFindFirst(filename, &hdir, FILE_NORMAL | FILE_ARCHIVED | | 
|---|
| [1335] | 2010 | FILE_READONLY | FILE_DIRECTORY | FILE_SYSTEM | | 
|---|
|  | 2011 | FILE_HIDDEN, | 
|---|
|  | 2012 | pffbArray, ulBufBytes, &ulFindCnt, FIL_STANDARDL); | 
|---|
| [783] | 2013 | if (!rc) { | 
|---|
| [2] | 2014 | do { | 
|---|
|  | 2015 | priority_normal(); | 
|---|
| [783] | 2016 | pffbFile = pffbArray; | 
|---|
| [1559] | 2017 |  | 
|---|
| [783] | 2018 | for (x = 0; x < ulFindCnt; x++) { | 
|---|
| [1559] | 2019 | if (ad->stopflag) | 
|---|
|  | 2020 | break; | 
|---|
| [1335] | 2021 | if (pffbFile->attrFile & FILE_DIRECTORY) { | 
|---|
|  | 2022 | // Skip . and .. | 
|---|
|  | 2023 | if (pffbFile->achName[0] != '.' || | 
|---|
|  | 2024 | (pffbFile->achName[1] && | 
|---|
|  | 2025 | (pffbFile->achName[1] != '.' || pffbFile->achName[2]))) { | 
|---|
|  | 2026 | strcpy(enddir, pffbFile->achName); | 
|---|
|  | 2027 | DoADir(hwnd, filename); | 
|---|
|  | 2028 | } | 
|---|
|  | 2029 | } | 
|---|
|  | 2030 | else { | 
|---|
|  | 2031 | *enddir = 0; | 
|---|
|  | 2032 | strcpy(enddir, pffbFile->achName); | 
|---|
|  | 2033 | if (strlen(filename) > CCHMAXPATH) { | 
|---|
|  | 2034 | // Complain if pathnames exceeds max | 
|---|
|  | 2035 | DosFindClose(hdir); | 
|---|
|  | 2036 | free(pffbArray); | 
|---|
|  | 2037 | free(filename); | 
|---|
|  | 2038 | if (!fDone) { | 
|---|
|  | 2039 | fDone = TRUE; | 
|---|
|  | 2040 | saymsg(MB_OK | MB_ICONASTERISK, | 
|---|
|  | 2041 | HWND_DESKTOP, | 
|---|
|  | 2042 | GetPString(IDS_WARNINGTEXT), | 
|---|
| [1402] | 2043 | GetPString(IDS_LENGTHEXCEEDSMAXPATHTEXT)); | 
|---|
| [1335] | 2044 | } | 
|---|
|  | 2045 | return; | 
|---|
|  | 2046 | } | 
|---|
|  | 2047 | if (!ad->afalloc || ad->afheadcnt > ad->afalloc - 1) { | 
|---|
| [2] | 2048 |  | 
|---|
| [1335] | 2049 | ALLFILES *temp; | 
|---|
| [2] | 2050 |  | 
|---|
| [1335] | 2051 | temp = xrealloc(ad->afhead, (ad->afalloc + 1000) * | 
|---|
|  | 2052 | sizeof(ALLFILES), pszSrcFile, __LINE__); | 
|---|
|  | 2053 | if (!temp) { | 
|---|
|  | 2054 | ad->stopflag = 1; | 
|---|
|  | 2055 | break; | 
|---|
|  | 2056 | } | 
|---|
|  | 2057 | else { | 
|---|
|  | 2058 | ad->afhead = temp; | 
|---|
|  | 2059 | if (ad->stopflag) | 
|---|
|  | 2060 | break; | 
|---|
|  | 2061 | ad->afalloc += 1000; | 
|---|
|  | 2062 | } | 
|---|
|  | 2063 | } | 
|---|
|  | 2064 | ad->afhead[ad->afheadcnt].fullname = | 
|---|
|  | 2065 | xstrdup(filename, pszSrcFile, __LINE__); | 
|---|
|  | 2066 | if (!ad->afhead[ad->afheadcnt].fullname) { | 
|---|
|  | 2067 | ad->stopflag = 1; | 
|---|
|  | 2068 | break; | 
|---|
|  | 2069 | } | 
|---|
|  | 2070 | else { | 
|---|
|  | 2071 | ad->afhead[ad->afheadcnt].filename = | 
|---|
|  | 2072 | ad->afhead[ad->afheadcnt].fullname + (enddir - filename); | 
|---|
|  | 2073 | ad->afhead[ad->afheadcnt].cbFile = pffbFile->cbFile; | 
|---|
|  | 2074 | ad->afhead[ad->afheadcnt].date = pffbFile->fdateLastWrite; | 
|---|
|  | 2075 | ad->afhead[ad->afheadcnt].time = pffbFile->ftimeLastWrite; | 
|---|
|  | 2076 | ad->afhead[ad->afheadcnt].attrFile = (USHORT) pffbFile->attrFile; | 
|---|
|  | 2077 | ad->afhead[ad->afheadcnt].flags = 0; | 
|---|
|  | 2078 | ad->afheadcnt++; | 
|---|
|  | 2079 | if (ad->longest < pffbFile->cchName) | 
|---|
|  | 2080 | ad->longest = pffbFile->cchName; | 
|---|
|  | 2081 | if (ad->longestw < pffbFile->cchName + (enddir - filename)) | 
|---|
|  | 2082 | ad->longestw = pffbFile->cchName + (enddir - filename); | 
|---|
|  | 2083 | } | 
|---|
|  | 2084 | } | 
|---|
|  | 2085 | pffbFile = (PFILEFINDBUF3L)((PBYTE)pffbFile + pffbFile->oNextEntryOffset); | 
|---|
| [783] | 2086 | } // for | 
|---|
| [1559] | 2087 |  | 
|---|
| [783] | 2088 | if (ad->stopflag) | 
|---|
| [1335] | 2089 | break; | 
|---|
| [1559] | 2090 |  | 
|---|
| [783] | 2091 | ulFindCnt = ulFindMax; | 
|---|
| [850] | 2092 | rc = xDosFindNext(hdir, | 
|---|
| [1335] | 2093 | pffbArray, | 
|---|
|  | 2094 | sizeof(FILEFINDBUF3L) * ulFindCnt, | 
|---|
|  | 2095 | &ulFindCnt, | 
|---|
|  | 2096 | FIL_STANDARDL); | 
|---|
| [783] | 2097 | } while (!rc); | 
|---|
| [2] | 2098 | DosFindClose(hdir); | 
|---|
|  | 2099 | } | 
|---|
| [783] | 2100 |  | 
|---|
|  | 2101 | if (rc && rc != ERROR_NO_MORE_FILES) { | 
|---|
|  | 2102 | Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, | 
|---|
| [1335] | 2103 | GetPString(IDS_CANTFINDDIRTEXT), filename); | 
|---|
| [783] | 2104 | } | 
|---|
|  | 2105 |  | 
|---|
| [1039] | 2106 | free(pffbArray); | 
|---|
|  | 2107 | free(filename); | 
|---|
| [2] | 2108 | } | 
|---|
|  | 2109 |  | 
|---|
| [551] | 2110 | static VOID FindAllThread(VOID * args) | 
|---|
| [162] | 2111 | { | 
|---|
| [551] | 2112 | ULONG ulDriveNum, ulDriveMap, x; | 
|---|
|  | 2113 | CHAR startname[] = " :\\"; | 
|---|
|  | 2114 | HWND hwnd = (HWND) args; | 
|---|
|  | 2115 | HAB hab2 = (HAB) 0; | 
|---|
|  | 2116 | HMQ hmq2 = (HMQ) 0; | 
|---|
|  | 2117 | ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| [1559] | 2118 | APIRET apiret; | 
|---|
| [2] | 2119 |  | 
|---|
| [1038] | 2120 | # ifdef FORTIFY | 
|---|
|  | 2121 | Fortify_EnterScope(); | 
|---|
| [1063] | 2122 | #  endif | 
|---|
| [1559] | 2123 |  | 
|---|
|  | 2124 | // DbgMsg(pszSrcFile, __LINE__, "FindAllThread requesting hmtxScan"); | 
|---|
|  | 2125 | apiret = DosRequestMutexSem(ad->hmtxScan, SEM_INDEFINITE_WAIT); | 
|---|
|  | 2126 | if (apiret != NO_ERROR) | 
|---|
|  | 2127 | Dos_Error(MB_CANCEL, apiret, hwnd, pszSrcFile, __LINE__, "DosRequestMutexSem"); | 
|---|
|  | 2128 | else { | 
|---|
| [2] | 2129 | priority_normal(); | 
|---|
|  | 2130 | hab2 = WinInitialize(0); | 
|---|
| [1559] | 2131 |  | 
|---|
| [551] | 2132 | if (hab2) { | 
|---|
|  | 2133 | hmq2 = WinCreateMsgQueue(hab2, 0); | 
|---|
|  | 2134 | if (hmq2) { | 
|---|
| [1335] | 2135 | WinCancelShutdown(hmq2, TRUE); | 
|---|
|  | 2136 | IncrThreadUsage(); | 
|---|
|  | 2137 | if (!*ad->szFindPath) { | 
|---|
|  | 2138 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 2139 | if (!DosQCurDisk(&ulDriveNum, &ulDriveMap)) { | 
|---|
|  | 2140 | for (x = 2; x < 26 && !ad->stopflag; x++) { | 
|---|
|  | 2141 | if ((ulDriveMap & (1 << x)) && ad->abDrvFlags[x]) { | 
|---|
|  | 2142 | *startname = (CHAR) (x + 'A'); | 
|---|
|  | 2143 | DoADir(hwnd, startname); | 
|---|
| [1559] | 2144 | if (ad->stopflag) | 
|---|
|  | 2145 | break; | 
|---|
| [1335] | 2146 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
|  | 2147 | DosSleep(0); //26 Aug 07 GKY 1 | 
|---|
|  | 2148 | } | 
|---|
| [1559] | 2149 | } // for | 
|---|
| [1335] | 2150 | } | 
|---|
|  | 2151 | } | 
|---|
|  | 2152 | else | 
|---|
|  | 2153 | DoADir(hwnd, ad->szFindPath); | 
|---|
| [1559] | 2154 |  | 
|---|
| [1335] | 2155 | DosPostEventSem(CompactSem); | 
|---|
| [2] | 2156 | } | 
|---|
|  | 2157 | } | 
|---|
|  | 2158 |  | 
|---|
| [1559] | 2159 | if (!ad->stopflag) { | 
|---|
|  | 2160 | if (ad->afalloc != ad->afheadcnt) { | 
|---|
| [2] | 2161 |  | 
|---|
| [1559] | 2162 | ALLFILES *tempa, **templ; | 
|---|
|  | 2163 |  | 
|---|
|  | 2164 | tempa = | 
|---|
|  | 2165 | xrealloc(ad->afhead, sizeof(ALLFILES) * ad->afheadcnt, pszSrcFile, | 
|---|
|  | 2166 | __LINE__); | 
|---|
|  | 2167 | if (tempa) { | 
|---|
|  | 2168 | ad->afhead = tempa; | 
|---|
|  | 2169 | ad->afalloc = ad->afheadcnt; | 
|---|
|  | 2170 | } | 
|---|
|  | 2171 | templ = | 
|---|
|  | 2172 | xrealloc(ad->afindex, sizeof(ALLFILES *) * ad->afheadcnt, pszSrcFile, | 
|---|
|  | 2173 | __LINE__); | 
|---|
|  | 2174 | if (templ) | 
|---|
|  | 2175 | ad->afindex = templ; | 
|---|
|  | 2176 | DosPostEventSem(CompactSem); | 
|---|
| [2] | 2177 | } | 
|---|
| [766] | 2178 | PostMsg(hwnd, UM_RESCAN, MPFROMLONG(1), MPVOID); | 
|---|
| [2] | 2179 | ReSort(hwnd); | 
|---|
|  | 2180 | } | 
|---|
| [1559] | 2181 |  | 
|---|
|  | 2182 | // DbgMsg(pszSrcFile, __LINE__, "FindAllThread releasing hmtxScan"); | 
|---|
| [162] | 2183 | DosReleaseMutexSem(ad->hmtxScan); | 
|---|
| [2] | 2184 | } | 
|---|
| [1559] | 2185 |  | 
|---|
| [551] | 2186 | if (hmq2) { | 
|---|
|  | 2187 | PostMsg(hwnd, UM_CONTAINER_FILLED, MPVOID, MPVOID); | 
|---|
| [2] | 2188 | WinDestroyMsgQueue(hmq2); | 
|---|
| [533] | 2189 | } | 
|---|
| [1559] | 2190 |  | 
|---|
| [551] | 2191 | if (hab2) { | 
|---|
| [533] | 2192 | DecrThreadUsage(); | 
|---|
| [2] | 2193 | WinTerminate(hab2); | 
|---|
| [533] | 2194 | } | 
|---|
| [1559] | 2195 |  | 
|---|
| [1038] | 2196 | # ifdef FORTIFY | 
|---|
| [1063] | 2197 | Fortify_LeaveScope(); | 
|---|
|  | 2198 | #  endif | 
|---|
| [2] | 2199 | } | 
|---|
|  | 2200 |  | 
|---|
| [551] | 2201 | MRESULT EXPENTRY AFDrvsWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 
|---|
| [162] | 2202 | { | 
|---|
| [551] | 2203 | switch (msg) { | 
|---|
|  | 2204 | case WM_INITDLG: | 
|---|
|  | 2205 | if (mp2) { | 
|---|
| [2] | 2206 |  | 
|---|
| [551] | 2207 | ULONG ulDriveNum, ulDriveMap, x; | 
|---|
|  | 2208 | CHAR startname[] = " :"; | 
|---|
|  | 2209 | SHORT sSelect; | 
|---|
|  | 2210 | ALLDATA *ad; | 
|---|
| [2] | 2211 |  | 
|---|
| [551] | 2212 | ad = (ALLDATA *) mp2; | 
|---|
|  | 2213 | WinSetWindowPtr(hwnd, QWL_USER, mp2); | 
|---|
|  | 2214 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 2215 | if (!DosQCurDisk(&ulDriveNum, &ulDriveMap)) { | 
|---|
| [1335] | 2216 | for (x = 2; x < 26 && !ad->stopflag; x++) { | 
|---|
|  | 2217 | if (!(driveflags[x] & (DRIVE_IGNORE | DRIVE_INVALID))) { | 
|---|
|  | 2218 | if (ulDriveMap & (1 << x)) { | 
|---|
|  | 2219 | *startname = (CHAR) (x + 'A'); | 
|---|
|  | 2220 | sSelect = (SHORT) WinSendDlgItemMsg(hwnd, DRVS_LISTBOX, | 
|---|
|  | 2221 | LM_INSERTITEM, | 
|---|
|  | 2222 | MPFROM2SHORT(LIT_END, 0), | 
|---|
|  | 2223 | MPFROMP(startname)); | 
|---|
|  | 2224 | if (sSelect >= 0 && ad->abDrvFlags[x]) | 
|---|
|  | 2225 | WinSendDlgItemMsg(hwnd, DRVS_LISTBOX, LM_SELECTITEM, | 
|---|
|  | 2226 | MPFROM2SHORT(sSelect, 0), MPFROMLONG(TRUE)); | 
|---|
|  | 2227 | } | 
|---|
|  | 2228 | } | 
|---|
|  | 2229 | } | 
|---|
| [2] | 2230 | } | 
|---|
| [551] | 2231 | } | 
|---|
|  | 2232 | else | 
|---|
|  | 2233 | WinDismissDlg(hwnd, 0); | 
|---|
|  | 2234 | break; | 
|---|
| [2] | 2235 |  | 
|---|
| [551] | 2236 | case WM_CONTROL: | 
|---|
|  | 2237 | switch (SHORT1FROMMP(mp1)) { | 
|---|
|  | 2238 | case DRVS_LISTBOX: | 
|---|
|  | 2239 | switch (SHORT2FROMMP(mp1)) { | 
|---|
|  | 2240 | case LN_ENTER: | 
|---|
| [1335] | 2241 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(DID_OK, 0), MPVOID); | 
|---|
|  | 2242 | break; | 
|---|
| [2] | 2243 | } | 
|---|
| [551] | 2244 | break; | 
|---|
|  | 2245 | } | 
|---|
|  | 2246 | return 0; | 
|---|
| [2] | 2247 |  | 
|---|
| [551] | 2248 | case WM_COMMAND: | 
|---|
|  | 2249 | switch (SHORT1FROMMP(mp1)) { | 
|---|
|  | 2250 | case DID_OK: | 
|---|
|  | 2251 | { | 
|---|
| [1335] | 2252 | INT x; | 
|---|
|  | 2253 | SHORT sSelect; | 
|---|
|  | 2254 | CHAR filename[3]; | 
|---|
|  | 2255 | ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| [2] | 2256 |  | 
|---|
| [1335] | 2257 | memset(ad->abDrvFlags, 0, sizeof(ad->abDrvFlags)); | 
|---|
|  | 2258 | sSelect = (SHORT) WinSendDlgItemMsg(hwnd, DRVS_LISTBOX, | 
|---|
|  | 2259 | LM_QUERYSELECTION, | 
|---|
|  | 2260 | MPFROM2SHORT(LIT_FIRST, 0), | 
|---|
|  | 2261 | MPVOID); | 
|---|
|  | 2262 | while (sSelect >= 0) { | 
|---|
|  | 2263 | *filename = 0; | 
|---|
|  | 2264 | if (WinSendDlgItemMsg(hwnd, DRVS_LISTBOX, LM_QUERYITEMTEXT, | 
|---|
|  | 2265 | MPFROM2SHORT(sSelect, 2), | 
|---|
|  | 2266 | MPFROMP(filename)) && *filename) | 
|---|
|  | 2267 | ad->abDrvFlags[*filename - 'A'] = 1; | 
|---|
|  | 2268 | sSelect = (SHORT) WinSendDlgItemMsg(hwnd, DRVS_LISTBOX, | 
|---|
|  | 2269 | LM_QUERYSELECTION, | 
|---|
|  | 2270 | MPFROM2SHORT(sSelect, 0), | 
|---|
|  | 2271 | MPVOID); | 
|---|
|  | 2272 | } | 
|---|
|  | 2273 | for (x = 2; x < 26; x++) { | 
|---|
|  | 2274 | if (ad->abDrvFlags[x]) { | 
|---|
|  | 2275 | WinDismissDlg(hwnd, 1); | 
|---|
|  | 2276 | return 0; | 
|---|
|  | 2277 | } | 
|---|
|  | 2278 | } | 
|---|
| [551] | 2279 | } | 
|---|
|  | 2280 | WinDismissDlg(hwnd, 0); | 
|---|
|  | 2281 | break; | 
|---|
| [2] | 2282 |  | 
|---|
| [551] | 2283 | case IDM_HELP: | 
|---|
|  | 2284 | if (hwndHelp) | 
|---|
| [1335] | 2285 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP, | 
|---|
|  | 2286 | MPFROM2SHORT(HELP_DRVSWND, 0), MPFROMSHORT(HM_RESOURCEID)); | 
|---|
| [551] | 2287 | break; | 
|---|
| [2] | 2288 |  | 
|---|
| [551] | 2289 | case DID_CANCEL: | 
|---|
|  | 2290 | WinDismissDlg(hwnd, 0); | 
|---|
|  | 2291 | break; | 
|---|
|  | 2292 | } | 
|---|
|  | 2293 | return 0; | 
|---|
| [2] | 2294 | } | 
|---|
| [551] | 2295 | return WinDefDlgProc(hwnd, msg, mp1, mp2); | 
|---|
| [2] | 2296 | } | 
|---|
|  | 2297 |  | 
|---|
| [551] | 2298 | static HPS InitWindow(HWND hwnd) | 
|---|
| [162] | 2299 | { | 
|---|
| [551] | 2300 | ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
|  | 2301 | HPS hps = (HPS) 0; | 
|---|
|  | 2302 | SIZEL sizel; | 
|---|
|  | 2303 | FONTMETRICS FontMetrics; | 
|---|
| [2] | 2304 |  | 
|---|
| [551] | 2305 | if (ad) { | 
|---|
| [2] | 2306 | sizel.cx = sizel.cy = 0; | 
|---|
| [551] | 2307 | hps = GpiCreatePS(WinQueryAnchorBlock(hwnd), WinOpenWindowDC(hwnd), | 
|---|
| [1335] | 2308 | (PSIZEL) & sizel, PU_PELS | GPIF_DEFAULT | GPIT_MICRO | | 
|---|
|  | 2309 | GPIA_ASSOC); | 
|---|
| [551] | 2310 | if (hps) { | 
|---|
|  | 2311 | GpiSetCp(hps, (ULONG) ad->fattrs.usCodePage); | 
|---|
| [1433] | 2312 | GpiCreateLogFont(hps, NULL, SEEALLFILECNR_FONT_LCID, &ad->fattrs); | 
|---|
|  | 2313 | GpiSetCharSet(hps, SEEALLFILECNR_FONT_LCID); | 
|---|
| [551] | 2314 | GpiQueryFontMetrics(hps, sizeof(FontMetrics), &FontMetrics); | 
|---|
|  | 2315 | ad->fattrs.lAveCharWidth = FontMetrics.lAveCharWidth; | 
|---|
| [2] | 2316 | ad->fattrs.lMaxBaselineExt = FontMetrics.lMaxBaselineExt; | 
|---|
| [551] | 2317 | ad->lMaxAscender = max(FontMetrics.lMaxAscender, 0); | 
|---|
|  | 2318 | ad->lMaxDescender = max(FontMetrics.lMaxDescender, 0); | 
|---|
| [2] | 2319 | ad->lMaxHeight = ad->lMaxDescender + ad->lMaxAscender; | 
|---|
| [551] | 2320 | if (ad->fattrs.usCodePage != FontMetrics.usCodePage) { | 
|---|
| [1335] | 2321 | ad->fattrs.usCodePage = FontMetrics.usCodePage; | 
|---|
|  | 2322 | Codepage = ad->fattrs.usCodePage; | 
|---|
|  | 2323 | PrfWriteProfileData(fmprof, | 
|---|
|  | 2324 | appname, | 
|---|
|  | 2325 | "Seeall.Codepage", | 
|---|
|  | 2326 | &ad->fattrs.usCodePage, sizeof(USHORT)); | 
|---|
| [2] | 2327 | } | 
|---|
| [551] | 2328 | else if (ad->fattrs.usCodePage) { | 
|---|
| [2] | 2329 |  | 
|---|
| [1335] | 2330 | HMQ hmq; | 
|---|
|  | 2331 | ULONG cps[50], len, x; | 
|---|
| [2] | 2332 |  | 
|---|
| [1335] | 2333 | if (!DosQueryCp(sizeof(cps), cps, &len)) { | 
|---|
|  | 2334 | for (x = 0; x < len / sizeof(ULONG); x++) { | 
|---|
|  | 2335 | if (cps[x] == (ULONG) ad->fattrs.usCodePage) { | 
|---|
|  | 2336 | hmq = WinQueryWindowULong(hwnd, QWL_HMQ); | 
|---|
|  | 2337 | WinSetCp(hmq, ad->fattrs.usCodePage); | 
|---|
|  | 2338 | break; | 
|---|
|  | 2339 | } | 
|---|
|  | 2340 | } | 
|---|
|  | 2341 | } | 
|---|
|  | 2342 | DosSetProcessCp((ULONG) ad->fattrs.usCodePage); | 
|---|
| [2] | 2343 | } | 
|---|
| [551] | 2344 | GpiSetBackMix(hps, BM_OVERPAINT); | 
|---|
| [2] | 2345 | } | 
|---|
|  | 2346 | } | 
|---|
|  | 2347 | return (hps); | 
|---|
|  | 2348 | } | 
|---|
|  | 2349 |  | 
|---|
| [551] | 2350 | static VOID PaintLine(HWND hwnd, HPS hps, ULONG whichfile, ULONG topfile, | 
|---|
| [1335] | 2351 | RECTL * Rectl) | 
|---|
| [551] | 2352 | { | 
|---|
|  | 2353 | ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
|  | 2354 | POINTL ptl; | 
|---|
| [1397] | 2355 | CHAR szBuff[CCHMAXPATH + 80], szCmmaFmtFileSize[81], szDate[DATE_BUF_BYTES]; | 
|---|
| [551] | 2356 | ULONG len, y; | 
|---|
| [2] | 2357 |  | 
|---|
| [943] | 2358 | y = (ad->invertsort) ? (ad->afindexcnt - 1) - whichfile : whichfile; | 
|---|
| [2] | 2359 | ptl.y = (Rectl->yTop - | 
|---|
| [1335] | 2360 | (ad->lMaxHeight * (((whichfile + 1) - topfile) + 1))); | 
|---|
| [2] | 2361 | ptl.x = ad->horzscroll; | 
|---|
| [943] | 2362 | if (ptl.y < Rectl->yBottom || ptl.y > Rectl->yTop || y > ad->afindexcnt) | 
|---|
| [2] | 2363 | return; | 
|---|
| [551] | 2364 | GpiSetBackMix(hps, BM_OVERPAINT); | 
|---|
|  | 2365 | if (ad->afindex[y]->flags & AF_SELECTED) { | 
|---|
|  | 2366 | GpiSetColor(hps, standardcolors[Colors[COLORS_SELECTEDNORMALFORE]]); | 
|---|
|  | 2367 | GpiSetBackColor(hps, (whichfile == ad->cursored - 1) ? | 
|---|
| [1335] | 2368 | standardcolors[Colors[COLORS_CURSOREDSELECTEDBACK]] : | 
|---|
|  | 2369 | standardcolors[Colors[COLORS_SELECTEDBACK]]); | 
|---|
| [2] | 2370 | } | 
|---|
|  | 2371 | else { | 
|---|
|  | 2372 | GpiSetColor(hps, | 
|---|
| [1335] | 2373 | ((ad->afindex[y]->attrFile & (FILE_SYSTEM | FILE_HIDDEN)) != | 
|---|
|  | 2374 | 0) ? standardcolors[Colors[COLORS_SYSTEMFORE]] : ((ad-> | 
|---|
|  | 2375 | afindex | 
|---|
|  | 2376 | [y]-> | 
|---|
|  | 2377 | attrFile & | 
|---|
|  | 2378 | FILE_READONLY) | 
|---|
|  | 2379 | != | 
|---|
|  | 2380 | 0) ? | 
|---|
|  | 2381 | standardcolors[Colors[COLORS_READONLYFORE]] : | 
|---|
|  | 2382 | standardcolors[Colors[COLORS_NORMALFORE]]); | 
|---|
| [551] | 2383 | GpiSetBackColor(hps, | 
|---|
| [1335] | 2384 | (whichfile == | 
|---|
|  | 2385 | ad->cursored - | 
|---|
|  | 2386 | 1) ? standardcolors[Colors[COLORS_CURSOREDNORMALBACK]] : | 
|---|
|  | 2387 | standardcolors[Colors[COLORS_NORMALBACK]]); | 
|---|
| [2] | 2388 | } | 
|---|
| [897] | 2389 | CommaFmtULL(szCmmaFmtFileSize, | 
|---|
| [1559] | 2390 | sizeof(szCmmaFmtFileSize), ad->afindex[y]->cbFile, ' '); | 
|---|
| [1395] | 2391 | FDateFormat(szDate, ad->afindex[y]->date); | 
|---|
| [2] | 2392 | len = sprintf(szBuff, | 
|---|
| [1395] | 2393 | "%c%-*.*s  %-12s  %c%c%c%c%c  %s %02u%s%02u%s%02u ", | 
|---|
| [1335] | 2394 | whichfile == ad->cursored - 1 ? '>' : ' ', | 
|---|
|  | 2395 | ad->fullnames ? ad->longestw : ad->longest, | 
|---|
|  | 2396 | ad->fullnames ? ad->longestw : ad->longest, | 
|---|
|  | 2397 | ad->fullnames ? ad->afindex[y]->fullname : | 
|---|
|  | 2398 | ad->afindex[y]->filename, | 
|---|
|  | 2399 | szCmmaFmtFileSize, | 
|---|
|  | 2400 | "-A"[((ad->afindex[y]->attrFile & FILE_ARCHIVED) != 0)], | 
|---|
|  | 2401 | "-R"[((ad->afindex[y]->attrFile & FILE_READONLY) != 0)], | 
|---|
|  | 2402 | "-H"[((ad->afindex[y]->attrFile & FILE_HIDDEN) != 0)], | 
|---|
|  | 2403 | "-S"[((ad->afindex[y]->attrFile & FILE_SYSTEM) != 0)], | 
|---|
|  | 2404 | "-D"[((ad->afindex[y]->attrFile & FILE_DIRECTORY) != 0)], | 
|---|
| [1559] | 2405 | szDate, | 
|---|
| [1395] | 2406 | ad->afindex[y]->time.hours, TimeSeparator, | 
|---|
|  | 2407 | ad->afindex[y]->time.minutes, TimeSeparator, | 
|---|
| [1335] | 2408 | ad->afindex[y]->time.twosecs * 2); | 
|---|
| [551] | 2409 | GpiCharStringAt(hps, &ptl, len, szBuff); | 
|---|
|  | 2410 | GpiQueryCurrentPosition(hps, &ptl); | 
|---|
|  | 2411 | if (ptl.x + abs(ad->horzscroll) > ad->maxx) { | 
|---|
| [2] | 2412 | ad->maxx = ptl.x + abs(ad->horzscroll); | 
|---|
| [551] | 2413 | WinSendMsg(ad->hhscroll, SBM_SETTHUMBSIZE, | 
|---|
| [1335] | 2414 | MPFROM2SHORT((SHORT) Rectl->xRight, (SHORT) ad->maxx), MPVOID); | 
|---|
| [2] | 2415 | } | 
|---|
|  | 2416 | } | 
|---|
|  | 2417 |  | 
|---|
| [551] | 2418 | MRESULT EXPENTRY SeeStatusProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 
|---|
| [162] | 2419 | { | 
|---|
| [551] | 2420 | switch (msg) { | 
|---|
|  | 2421 | case WM_CREATE: | 
|---|
|  | 2422 | return CommonTextProc(hwnd, msg, mp1, mp2); | 
|---|
| [2] | 2423 |  | 
|---|
| [551] | 2424 | case WM_SETFOCUS: | 
|---|
|  | 2425 | if (mp2) | 
|---|
|  | 2426 | PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID); | 
|---|
|  | 2427 | break; | 
|---|
| [2] | 2428 |  | 
|---|
| [551] | 2429 | case WM_PAINT: | 
|---|
|  | 2430 | { | 
|---|
|  | 2431 | SWP swp; | 
|---|
|  | 2432 | POINTL ptl; | 
|---|
|  | 2433 | HPS hps; | 
|---|
| [2] | 2434 |  | 
|---|
| [551] | 2435 | PaintRecessedWindow(hwnd, (HPS) 0, FALSE, FALSE); | 
|---|
|  | 2436 | hps = WinGetPS(WinQueryWindow(hwnd, QW_PARENT)); | 
|---|
|  | 2437 | if (hps) { | 
|---|
| [1335] | 2438 | WinQueryWindowPos(hwnd, &swp); | 
|---|
|  | 2439 | ptl.x = swp.x - 1; | 
|---|
|  | 2440 | ptl.y = swp.y + swp.cy + 2; | 
|---|
|  | 2441 | GpiMove(hps, &ptl); | 
|---|
|  | 2442 | GpiSetColor(hps, CLR_WHITE); | 
|---|
|  | 2443 | ptl.x = swp.x + swp.cx; | 
|---|
|  | 2444 | GpiLine(hps, &ptl); | 
|---|
|  | 2445 | WinReleasePS(hps); | 
|---|
| [2] | 2446 | } | 
|---|
| [551] | 2447 | } | 
|---|
|  | 2448 | break; | 
|---|
| [2] | 2449 |  | 
|---|
| [551] | 2450 | case UM_FOCUSME: | 
|---|
|  | 2451 | WinSetFocus(HWND_DESKTOP, WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), | 
|---|
| [1335] | 2452 | FID_CLIENT)); | 
|---|
| [551] | 2453 | return 0; | 
|---|
| [2] | 2454 | } | 
|---|
| [551] | 2455 | return PFNWPStatic(hwnd, msg, mp1, mp2); | 
|---|
| [2] | 2456 | } | 
|---|
|  | 2457 |  | 
|---|
| [551] | 2458 | MRESULT EXPENTRY SeeFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 
|---|
| [162] | 2459 | { | 
|---|
| [551] | 2460 | PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| [2] | 2461 |  | 
|---|
| [551] | 2462 | switch (msg) { | 
|---|
|  | 2463 | case WM_BUTTON1UP: | 
|---|
|  | 2464 | case WM_BUTTON2UP: | 
|---|
|  | 2465 | case WM_BUTTON3UP: | 
|---|
|  | 2466 | case WM_MOUSEMOVE: | 
|---|
|  | 2467 | case WM_CHORD: | 
|---|
|  | 2468 | shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL)); | 
|---|
|  | 2469 | break; | 
|---|
| [2] | 2470 |  | 
|---|
| [551] | 2471 | case WM_CHAR: | 
|---|
|  | 2472 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL)); | 
|---|
|  | 2473 | break; | 
|---|
| [2] | 2474 |  | 
|---|
| [551] | 2475 | case WM_CALCFRAMERECT: | 
|---|
|  | 2476 | { | 
|---|
|  | 2477 | MRESULT mr; | 
|---|
|  | 2478 | PRECTL prectl; | 
|---|
| [2] | 2479 |  | 
|---|
| [551] | 2480 | mr = oldproc(hwnd, msg, mp1, mp2); | 
|---|
| [2] | 2481 |  | 
|---|
| [551] | 2482 | /* | 
|---|
|  | 2483 | * Calculate the position of the client rectangle. | 
|---|
|  | 2484 | * Otherwise,  we'll see a lot of redraw when we move the | 
|---|
|  | 2485 | * client during WM_FORMATFRAME. | 
|---|
|  | 2486 | */ | 
|---|
| [2] | 2487 |  | 
|---|
| [551] | 2488 | if (mr && mp2) { | 
|---|
| [1335] | 2489 | prectl = (PRECTL) mp1; | 
|---|
|  | 2490 | prectl->yBottom += 22; | 
|---|
|  | 2491 | prectl->yTop -= 24; | 
|---|
| [2] | 2492 | } | 
|---|
| [551] | 2493 | return mr; | 
|---|
|  | 2494 | } | 
|---|
| [2] | 2495 |  | 
|---|
| [551] | 2496 | case WM_FORMATFRAME: | 
|---|
|  | 2497 | { | 
|---|
|  | 2498 | SHORT sCount; | 
|---|
|  | 2499 | PSWP pswp, pswpClient, pswpNew; | 
|---|
| [2] | 2500 |  | 
|---|
| [551] | 2501 | sCount = (SHORT) oldproc(hwnd, msg, mp1, mp2); | 
|---|
| [2] | 2502 |  | 
|---|
| [551] | 2503 | /* | 
|---|
|  | 2504 | * Reformat the frame to "squeeze" the client | 
|---|
|  | 2505 | * and make room for status window sibling beneath | 
|---|
|  | 2506 | */ | 
|---|
| [2] | 2507 |  | 
|---|
| [551] | 2508 | pswp = (PSWP) mp1; | 
|---|
|  | 2509 | { | 
|---|
| [1335] | 2510 | SHORT x; | 
|---|
| [2] | 2511 |  | 
|---|
| [1335] | 2512 | for (x = 0; x < sCount; x++) { | 
|---|
|  | 2513 | if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_CLIENT) { | 
|---|
|  | 2514 | pswpClient = pswp; | 
|---|
|  | 2515 | break; | 
|---|
|  | 2516 | } | 
|---|
|  | 2517 | pswp++; | 
|---|
|  | 2518 | } | 
|---|
| [2] | 2519 | } | 
|---|
| [551] | 2520 | pswpNew = (PSWP) mp1 + sCount; | 
|---|
|  | 2521 | *pswpNew = *pswpClient; | 
|---|
|  | 2522 | pswpNew->hwnd = WinWindowFromID(hwnd, SEEALL_STATUS); | 
|---|
|  | 2523 | pswpNew->x = pswpClient->x + 2; | 
|---|
|  | 2524 | pswpNew->y = pswpClient->y + 2; | 
|---|
|  | 2525 | pswpNew->cx = pswpClient->cx - 3; | 
|---|
|  | 2526 | pswpNew->cy = 20; | 
|---|
|  | 2527 | pswpClient->y = pswpNew->y + pswpNew->cy + 3; | 
|---|
|  | 2528 | pswpClient->cy = (pswpClient->cy - pswpNew->cy) - 5; | 
|---|
|  | 2529 | sCount++; | 
|---|
|  | 2530 | return MRFROMSHORT(sCount); | 
|---|
|  | 2531 | } | 
|---|
| [2] | 2532 |  | 
|---|
| [551] | 2533 | case WM_QUERYFRAMECTLCOUNT: | 
|---|
|  | 2534 | { | 
|---|
|  | 2535 | SHORT sCount; | 
|---|
| [2] | 2536 |  | 
|---|
| [551] | 2537 | sCount = (SHORT) oldproc(hwnd, msg, mp1, mp2); | 
|---|
|  | 2538 | sCount++; | 
|---|
|  | 2539 | return MRFROMSHORT(sCount); | 
|---|
|  | 2540 | } | 
|---|
| [2] | 2541 | } | 
|---|
| [551] | 2542 | return oldproc(hwnd, msg, mp1, mp2); | 
|---|
| [2] | 2543 | } | 
|---|
|  | 2544 |  | 
|---|
| [551] | 2545 | MRESULT EXPENTRY SeeAllWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) | 
|---|
| [162] | 2546 | { | 
|---|
| [551] | 2547 | ALLDATA *pAD = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
| [1559] | 2548 | APIRET apiret; | 
|---|
| [2] | 2549 |  | 
|---|
|  | 2550 | switch (msg) { | 
|---|
| [551] | 2551 | case WM_CREATE: | 
|---|
| [1559] | 2552 | // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc WM_CREATE"); | 
|---|
| [551] | 2553 | WinSetWindowPtr(hwnd, QWL_USER, NULL); | 
|---|
| [1063] | 2554 | #   ifdef FORTIFY | 
|---|
|  | 2555 | Fortify_EnterScope(); | 
|---|
|  | 2556 | #    endif | 
|---|
| [551] | 2557 | pAD = xmallocz(sizeof(ALLDATA), pszSrcFile, __LINE__); | 
|---|
|  | 2558 | if (pAD) { | 
|---|
|  | 2559 | HWND hwndFrame; | 
|---|
|  | 2560 |  | 
|---|
|  | 2561 | pAD->size = sizeof(ALLDATA); | 
|---|
|  | 2562 | hwndFrame = WinQueryWindow(hwnd, QW_PARENT); | 
|---|
|  | 2563 | pAD->hwndFrame = hwndFrame; | 
|---|
|  | 2564 | pAD->mask.attrFile = FILE_READONLY | FILE_HIDDEN | | 
|---|
| [1335] | 2565 | FILE_SYSTEM | FILE_ARCHIVED; | 
|---|
| [551] | 2566 | pAD->mask.fNoDirs = TRUE; | 
|---|
|  | 2567 | *(pAD->mask.prompt) = 0; | 
|---|
|  | 2568 | WinSetWindowPtr(hwnd, QWL_USER, (PVOID) pAD); | 
|---|
|  | 2569 | pAD->pfnCompare = comparenames; | 
|---|
|  | 2570 | if (Firsttime) { | 
|---|
|  | 2571 |  | 
|---|
| [1335] | 2572 | ULONG size; | 
|---|
| [551] | 2573 |  | 
|---|
| [1335] | 2574 | size = sizeof(USHORT); | 
|---|
|  | 2575 | PrfQueryProfileData(fmprof, | 
|---|
|  | 2576 | appname, | 
|---|
|  | 2577 | "Seeall.Codepage", (PVOID) & Codepage, &size); | 
|---|
|  | 2578 | size = sizeof(BOOL); | 
|---|
|  | 2579 | PrfQueryProfileData(fmprof, | 
|---|
|  | 2580 | appname, | 
|---|
|  | 2581 | "Seeall.Fullnames", (PVOID) & Fullnames, &size); | 
|---|
|  | 2582 | size = sizeof(USHORT); | 
|---|
|  | 2583 | PrfQueryProfileData(fmprof, | 
|---|
|  | 2584 | appname, | 
|---|
|  | 2585 | "Seeall.Sort", (PVOID) & SortType, &size); | 
|---|
|  | 2586 | size = sizeof(BOOL); | 
|---|
|  | 2587 | PrfQueryProfileData(fmprof, | 
|---|
|  | 2588 | appname, | 
|---|
|  | 2589 | "Seeall.SortReverse", | 
|---|
|  | 2590 | (PVOID) & SortReverse, &size); | 
|---|
|  | 2591 | memset(&Fattrs, 0, sizeof(Fattrs)); | 
|---|
|  | 2592 | size = sizeof(Fattrs); | 
|---|
|  | 2593 | Fattrs.usRecordLength = sizeof(Fattrs); | 
|---|
|  | 2594 | Fattrs.lMaxBaselineExt = 16; | 
|---|
|  | 2595 | Fattrs.lAveCharWidth = 8; | 
|---|
|  | 2596 | Fattrs.usCodePage = Codepage; | 
|---|
|  | 2597 | strcpy(Fattrs.szFacename, GetPString(IDS_SYSMONOTEXT)); | 
|---|
|  | 2598 | PrfQueryProfileData(fmprof, | 
|---|
|  | 2599 | appname, | 
|---|
|  | 2600 | "Seeall.Fattrs", (PVOID) & Fattrs, &size); | 
|---|
|  | 2601 | size = sizeof(LONG) * COLORS_MAX; | 
|---|
|  | 2602 | PrfQueryProfileData(fmprof, | 
|---|
|  | 2603 | appname, "Seeall.Colors", (PVOID) Colors, &size); | 
|---|
|  | 2604 | Firsttime = FALSE; | 
|---|
| [551] | 2605 | } | 
|---|
|  | 2606 | switch (SortType) { | 
|---|
|  | 2607 | case IDM_SORTEASIZE: | 
|---|
| [1335] | 2608 | pAD->pfnCompare = (PFNSORT) NULL; | 
|---|
|  | 2609 | break; | 
|---|
| [551] | 2610 | case IDM_SORTNAME: | 
|---|
| [1335] | 2611 | pAD->pfnCompare = comparefullnames; | 
|---|
|  | 2612 | break; | 
|---|
| [551] | 2613 | case IDM_SORTFILENAME: | 
|---|
| [1335] | 2614 | pAD->pfnCompare = comparenames; | 
|---|
|  | 2615 | break; | 
|---|
| [551] | 2616 | case IDM_SORTSIZE: | 
|---|
| [1335] | 2617 | pAD->pfnCompare = comparesizes; | 
|---|
|  | 2618 | break; | 
|---|
| [551] | 2619 | case IDM_SORTLWDATE: | 
|---|
| [1335] | 2620 | pAD->pfnCompare = comparedates; | 
|---|
|  | 2621 | break; | 
|---|
| [551] | 2622 | case IDM_SORTFIRST: | 
|---|
| [1335] | 2623 | pAD->pfnCompare = compareexts; | 
|---|
|  | 2624 | break; | 
|---|
| [551] | 2625 | } | 
|---|
|  | 2626 | pAD->invertsort = SortReverse; | 
|---|
|  | 2627 | pAD->fattrs = Fattrs; | 
|---|
|  | 2628 | pAD->fullnames = Fullnames; | 
|---|
|  | 2629 | pAD->stopflag = 0; | 
|---|
|  | 2630 | pAD->cursored = pAD->topfile = 1; | 
|---|
|  | 2631 | pAD->fattrs.usCodePage = Codepage; | 
|---|
|  | 2632 | memcpy(pAD->aulColors, Colors, sizeof(LONG) * COLORS_MAX); | 
|---|
|  | 2633 | pAD->hwndMenu = WinWindowFromID(hwndFrame, FID_MENU); | 
|---|
|  | 2634 | SetConditionalCascade(pAD->hwndMenu, IDM_DELETESUBMENU, | 
|---|
| [1335] | 2635 | (fDefaultDeletePerm) ? | 
|---|
|  | 2636 | IDM_PERMDELETE : IDM_DELETE); | 
|---|
| [551] | 2637 | SetConditionalCascade(pAD->hwndMenu, IDM_MOVEMENU, IDM_MOVE); | 
|---|
|  | 2638 | SetConditionalCascade(pAD->hwndMenu, IDM_COPYMENU, IDM_COPY); | 
|---|
|  | 2639 | SetConditionalCascade(pAD->hwndMenu, IDM_OPENSUBMENU, IDM_OPENDEFAULT); | 
|---|
|  | 2640 | SetConditionalCascade(pAD->hwndMenu, IDM_OBJECTSUBMENU, IDM_SHADOW); | 
|---|
|  | 2641 | if (fWorkPlace) { | 
|---|
| [1335] | 2642 | WinSendMsg(pAD->hwndMenu, MM_DELETEITEM, | 
|---|
|  | 2643 | MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID); | 
|---|
|  | 2644 | WinSendMsg(pAD->hwndMenu, MM_DELETEITEM, | 
|---|
|  | 2645 | MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID); | 
|---|
| [551] | 2646 | } | 
|---|
|  | 2647 | pAD->hwndClient = hwnd; | 
|---|
|  | 2648 | pAD->hps = InitWindow(hwnd); | 
|---|
|  | 2649 | pAD->hvscroll = WinWindowFromID(hwndFrame, FID_VERTSCROLL); | 
|---|
|  | 2650 | pAD->hhscroll = WinWindowFromID(hwndFrame, FID_HORZSCROLL); | 
|---|
|  | 2651 | pAD->multiplier = 1; | 
|---|
| [1335] | 2652 | if (xbeginthread(MakeSeeObjWinThread, | 
|---|
|  | 2653 | 122880, | 
|---|
|  | 2654 | pAD, | 
|---|
|  | 2655 | pszSrcFile, | 
|---|
|  | 2656 | __LINE__) != -1) | 
|---|
|  | 2657 | { | 
|---|
|  | 2658 | if (!DosCreateMutexSem(NULL, &pAD->hmtxScan, 0, FALSE)) { | 
|---|
|  | 2659 | pAD->hwndStatus = WinCreateWindow(hwndFrame, | 
|---|
| [1498] | 2660 | (CHAR *) WC_SEESTATUS, | 
|---|
| [1335] | 2661 | NullStr, | 
|---|
|  | 2662 | WS_VISIBLE | SS_TEXT | | 
|---|
|  | 2663 | DT_LEFT | DT_VCENTER, | 
|---|
|  | 2664 | 0, | 
|---|
|  | 2665 | 0, | 
|---|
|  | 2666 | 0, | 
|---|
|  | 2667 | 0, | 
|---|
|  | 2668 | hwndFrame, | 
|---|
|  | 2669 | HWND_TOP, | 
|---|
|  | 2670 | SEEALL_STATUS, NULL, NULL); | 
|---|
|  | 2671 | if (!pAD->hwndStatus) | 
|---|
| [1395] | 2672 | Win_Error(hwndFrame, hwnd, pszSrcFile, __LINE__, | 
|---|
|  | 2673 | PCSZ_WINCREATEWINDOW); | 
|---|
| [1335] | 2674 | else { | 
|---|
|  | 2675 | PFNWP oldproc; | 
|---|
| [2] | 2676 |  | 
|---|
| [1335] | 2677 | oldproc = WinSubclassWindow(hwndFrame, SeeFrameWndProc); | 
|---|
|  | 2678 | WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID) oldproc); | 
|---|
|  | 2679 | } | 
|---|
|  | 2680 | break; | 
|---|
|  | 2681 | } | 
|---|
| [2] | 2682 | } | 
|---|
| [551] | 2683 | } | 
|---|
|  | 2684 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID); | 
|---|
|  | 2685 | break; | 
|---|
| [2] | 2686 |  | 
|---|
| [551] | 2687 | case UM_SETUP5: | 
|---|
| [1559] | 2688 | // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc UM_SETUP5"); | 
|---|
| [551] | 2689 | if (pAD) { | 
|---|
| [1009] | 2690 | if (mp1 && *((CHAR *)mp1)) | 
|---|
| [1335] | 2691 | strcpy(pAD->szFindPath, (CHAR *)mp1); | 
|---|
| [551] | 2692 | else { | 
|---|
| [1335] | 2693 | if (!WinDlgBox(HWND_DESKTOP, hwnd, AFDrvsWndProc, | 
|---|
|  | 2694 | FM3ModHandle, DRVS_FRAME, (PVOID) pAD)) { | 
|---|
|  | 2695 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID); | 
|---|
|  | 2696 | return 0; | 
|---|
|  | 2697 | } | 
|---|
| [2] | 2698 | } | 
|---|
| [1335] | 2699 | if (xbeginthread(FindAllThread, | 
|---|
|  | 2700 | 524288, | 
|---|
|  | 2701 | (PVOID)hwnd, | 
|---|
|  | 2702 | pszSrcFile, | 
|---|
|  | 2703 | __LINE__) == -1) | 
|---|
|  | 2704 | { | 
|---|
|  | 2705 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID); | 
|---|
| [551] | 2706 | } | 
|---|
|  | 2707 | else { | 
|---|
| [1335] | 2708 | DosSleep(50);//05 Aug 07 GKY 100 | 
|---|
|  | 2709 | PostMsg(hwnd, UM_SETUP, MPVOID, MPVOID); | 
|---|
|  | 2710 | PostMsg(hwnd, UM_SETUP2, MPVOID, MPVOID); | 
|---|
| [551] | 2711 | } | 
|---|
|  | 2712 | } | 
|---|
|  | 2713 | else | 
|---|
|  | 2714 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID); | 
|---|
|  | 2715 | return 0; | 
|---|
| [2] | 2716 |  | 
|---|
| [551] | 2717 | case UM_UPDATERECORDLIST: | 
|---|
|  | 2718 | if (mp1) { | 
|---|
| [2] | 2719 |  | 
|---|
| [551] | 2720 | APIRET rc; | 
|---|
| [2] | 2721 |  | 
|---|
| [551] | 2722 | rc = DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN); | 
|---|
|  | 2723 | if (!rc) { | 
|---|
| [1335] | 2724 | WinSetPointer(HWND_DESKTOP, hptrBusy); | 
|---|
|  | 2725 | if (UpdateList(hwnd, mp1)) { | 
|---|
|  | 2726 | FreeList(mp1); | 
|---|
|  | 2727 | RemoveDeleted(hwnd); | 
|---|
|  | 2728 | ReSort(hwnd); | 
|---|
|  | 2729 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
|  | 2730 | } | 
|---|
|  | 2731 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
|  | 2732 | WinSetPointer(HWND_DESKTOP, hptrArrow); | 
|---|
| [2] | 2733 | } | 
|---|
| [551] | 2734 | } | 
|---|
|  | 2735 | return 0; | 
|---|
| [2] | 2736 |  | 
|---|
| [551] | 2737 | case UM_SETUP2: | 
|---|
| [1559] | 2738 | // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc UM_SETUP2"); | 
|---|
| [551] | 2739 | if (pAD) { | 
|---|
| [2] | 2740 |  | 
|---|
| [551] | 2741 | CHAR s[256]; | 
|---|
|  | 2742 | BOOL once = FALSE; | 
|---|
|  | 2743 | ULONG x, ulDriveNum, ulDriveMap; | 
|---|
| [2] | 2744 |  | 
|---|
| [551] | 2745 | strcpy(s, GetPString(IDS_SEEALLTITLETEXT)); | 
|---|
|  | 2746 | if (!*pAD->szFindPath) { | 
|---|
| [1335] | 2747 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 2748 | if (!DosQCurDisk(&ulDriveNum, &ulDriveMap)) { | 
|---|
|  | 2749 | for (x = 2; x < 26 && !pAD->stopflag; x++) { | 
|---|
|  | 2750 | if ((ulDriveMap & (1 << x)) && pAD->abDrvFlags[x]) { | 
|---|
|  | 2751 | sprintf(&s[strlen(s)], "%s%c:", (once) ? ", " : " (", x + 'A'); | 
|---|
|  | 2752 | once = TRUE; | 
|---|
|  | 2753 | } | 
|---|
|  | 2754 | } | 
|---|
|  | 2755 | if (once) | 
|---|
|  | 2756 | strcat(s, ")"); | 
|---|
|  | 2757 | } | 
|---|
| [2] | 2758 | } | 
|---|
| [551] | 2759 | else { | 
|---|
| [1335] | 2760 | strcat(s, " ("); | 
|---|
|  | 2761 | strcat(s, pAD->szFindPath); | 
|---|
|  | 2762 | strcat(s, ")"); | 
|---|
| [551] | 2763 | } | 
|---|
|  | 2764 | WinSetWindowText(WinQueryWindow(hwnd, QW_PARENT), s); | 
|---|
|  | 2765 | } | 
|---|
|  | 2766 | return 0; | 
|---|
| [2] | 2767 |  | 
|---|
| [551] | 2768 | case UM_SETUP3: | 
|---|
| [1559] | 2769 | // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc UM_SETUP3"); | 
|---|
| [551] | 2770 | if (pAD) { | 
|---|
| [943] | 2771 | pAD->multiplier = pAD->afindexcnt / 32767; | 
|---|
|  | 2772 | if (pAD->multiplier * 32767 != pAD->afindexcnt) | 
|---|
| [1335] | 2773 | pAD->multiplier++; | 
|---|
| [551] | 2774 | if (!pAD->multiplier) | 
|---|
| [1335] | 2775 | pAD->multiplier++; | 
|---|
| [551] | 2776 | { | 
|---|
| [1335] | 2777 | RECTL Rectl; | 
|---|
|  | 2778 | ULONG numlines; | 
|---|
| [2] | 2779 |  | 
|---|
| [1335] | 2780 | WinQueryWindowRect(hwnd, &Rectl); | 
|---|
|  | 2781 | numlines = NumLines(&Rectl, pAD); | 
|---|
|  | 2782 | if (numlines) { | 
|---|
|  | 2783 | WinSendMsg(pAD->hhscroll, SBM_SETTHUMBSIZE, | 
|---|
|  | 2784 | MPFROM2SHORT((SHORT) Rectl.xRight, (SHORT) pAD->maxx), | 
|---|
|  | 2785 | MPVOID); | 
|---|
|  | 2786 | WinSendMsg(pAD->hvscroll, SBM_SETTHUMBSIZE, | 
|---|
|  | 2787 | MPFROM2SHORT((SHORT) numlines, | 
|---|
|  | 2788 | (SHORT) min(pAD->afindexcnt, 32767)), | 
|---|
|  | 2789 | MPFROM2SHORT(1, pAD->afindexcnt + 1)); | 
|---|
|  | 2790 | WinSendMsg(pAD->hhscroll, SBM_SETSCROLLBAR, | 
|---|
|  | 2791 | MPFROMSHORT((SHORT) abs(pAD->horzscroll)), | 
|---|
|  | 2792 | MPFROM2SHORT(0, (SHORT) (pAD->maxx - Rectl.xRight))); | 
|---|
|  | 2793 | WinSendMsg(pAD->hvscroll, SBM_SETSCROLLBAR, | 
|---|
|  | 2794 | MPFROMSHORT((SHORT) (pAD->topfile / pAD->multiplier)), | 
|---|
|  | 2795 | MPFROM2SHORT(1, | 
|---|
|  | 2796 | (SHORT) (pAD->afindexcnt / pAD->multiplier) - | 
|---|
|  | 2797 | (numlines - 1))); | 
|---|
|  | 2798 | if (pAD->afindexcnt - pAD->topfile < numlines) { | 
|---|
|  | 2799 | pAD->topfile = ((pAD->afindexcnt - pAD->topfile) - numlines); | 
|---|
|  | 2800 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
|  | 2801 | } | 
|---|
|  | 2802 | } | 
|---|
| [2] | 2803 | } | 
|---|
| [551] | 2804 | } | 
|---|
|  | 2805 | return 0; | 
|---|
| [2] | 2806 |  | 
|---|
| [551] | 2807 | case UM_SETUP4: | 
|---|
| [1559] | 2808 | // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc UM_SETUP4"); | 
|---|
| [551] | 2809 | if (pAD) | 
|---|
|  | 2810 | pAD->killme = TRUE; | 
|---|
|  | 2811 | else | 
|---|
|  | 2812 | PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID); | 
|---|
|  | 2813 | return 0; | 
|---|
| [2] | 2814 |  | 
|---|
| [551] | 2815 | case UM_RESCAN: | 
|---|
| [1559] | 2816 | // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc UM_RESCAN"); | 
|---|
| [551] | 2817 | if (pAD && !pAD->stopflag) { | 
|---|
|  | 2818 | if (DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) { | 
|---|
| [1559] | 2819 | // Assume still working - show progress | 
|---|
| [1335] | 2820 | CHAR s[CCHMAXPATH + 80], tm[34]; | 
|---|
| [2] | 2821 |  | 
|---|
| [1335] | 2822 | if (mp1) { | 
|---|
|  | 2823 | strcpy(s, GetPString(IDS_SORTINGTEXT)); | 
|---|
|  | 2824 | if (pAD->afindexcnt) { | 
|---|
|  | 2825 | commafmt(tm, sizeof(tm), pAD->afindexcnt); | 
|---|
|  | 2826 | strcat(s, tm); | 
|---|
|  | 2827 | } | 
|---|
|  | 2828 | } | 
|---|
|  | 2829 | else { | 
|---|
|  | 2830 | strcpy(s, GetPString(IDS_WORKINGTEXT)); | 
|---|
|  | 2831 | if (pAD->afheadcnt) { | 
|---|
|  | 2832 | commafmt(tm, sizeof(tm), pAD->afheadcnt); | 
|---|
|  | 2833 | strcat(s, tm); | 
|---|
|  | 2834 | } | 
|---|
|  | 2835 | } | 
|---|
|  | 2836 | if (mp2) { | 
|---|
|  | 2837 | strcat(s, " "); | 
|---|
|  | 2838 | strcat(s, (CHAR *)mp2); | 
|---|
|  | 2839 | } | 
|---|
|  | 2840 | WinSetWindowText(pAD->hwndStatus, s); | 
|---|
| [551] | 2841 | } | 
|---|
|  | 2842 | else { | 
|---|
| [1559] | 2843 | // Assume scan done | 
|---|
| [1335] | 2844 | CHAR s[(CCHMAXPATH * 2) + 80], tm[34], ts[34], tb[34]; | 
|---|
|  | 2845 | ULONG y; | 
|---|
| [2] | 2846 |  | 
|---|
| [1335] | 2847 | if (mp1) { | 
|---|
|  | 2848 | strcpy(s, GetPString(IDS_SORTINGTEXT)); | 
|---|
|  | 2849 | if (pAD->afindexcnt) { | 
|---|
|  | 2850 | commafmt(tm, sizeof(tm), pAD->afindexcnt); | 
|---|
|  | 2851 | strcat(s, tm); | 
|---|
|  | 2852 | } | 
|---|
|  | 2853 | if (mp2) { | 
|---|
|  | 2854 | strcat(s, " "); | 
|---|
|  | 2855 | strcat(s, (CHAR *)mp2); | 
|---|
|  | 2856 | } | 
|---|
|  | 2857 | } | 
|---|
|  | 2858 | else if (pAD->afindexcnt) { | 
|---|
|  | 2859 | y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - (pAD->cursored - 1) : | 
|---|
|  | 2860 | pAD->cursored - 1; | 
|---|
|  | 2861 | commafmt(tm, sizeof(tm), pAD->afindexcnt); | 
|---|
|  | 2862 | commafmt(ts, sizeof(ts), pAD->selected); | 
|---|
|  | 2863 | CommaFmtULL(tb, sizeof(tb), pAD->ullSelectedBytes, ' '); | 
|---|
|  | 2864 | sprintf(s, | 
|---|
|  | 2865 | " %s %s%s%s  %s %s (%s)  %s %s", | 
|---|
|  | 2866 | tm, | 
|---|
|  | 2867 | GetPString(IDS_FILETEXT), | 
|---|
|  | 2868 | &"s"[pAD->afindexcnt == 1], | 
|---|
|  | 2869 | (*pAD->mask.szMask || | 
|---|
|  | 2870 | (pAD->mask.attrFile & (~FILE_DIRECTORY)) != | 
|---|
|  | 2871 | (ALLATTRS & (~FILE_DIRECTORY)) || | 
|---|
|  | 2872 | pAD->mask.antiattr) ? | 
|---|
|  | 2873 | GetPString(IDS_FILTEREDTEXT) : | 
|---|
|  | 2874 | NullStr, | 
|---|
|  | 2875 | ts, | 
|---|
|  | 2876 | GetPString(IDS_SELECTEDTEXT), | 
|---|
|  | 2877 | tb, GetPString(IDS_CURRTEXT), pAD->afindex[y]->fullname); | 
|---|
|  | 2878 | } | 
|---|
|  | 2879 | else | 
|---|
|  | 2880 | sprintf(s, | 
|---|
|  | 2881 | GetPString(IDS_NOFILESPSTEXT), | 
|---|
|  | 2882 | (*pAD->mask.szMask || | 
|---|
|  | 2883 | (pAD->mask.attrFile & (~FILE_DIRECTORY)) != | 
|---|
|  | 2884 | (ALLATTRS & (~FILE_DIRECTORY)) || | 
|---|
|  | 2885 | pAD->mask.antiattr) ? | 
|---|
|  | 2886 | GetPString(IDS_FILTEREDTEXT) : NullStr); | 
|---|
|  | 2887 | WinSetWindowText(pAD->hwndStatus, s); | 
|---|
|  | 2888 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
| [2] | 2889 | } | 
|---|
| [551] | 2890 | } | 
|---|
|  | 2891 | return 0; | 
|---|
| [2] | 2892 |  | 
|---|
| [551] | 2893 | case UM_SETUP: | 
|---|
| [1559] | 2894 | // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc UM_SETUP"); | 
|---|
| [551] | 2895 | if (pAD) { | 
|---|
|  | 2896 | WinSendMsg(pAD->hvscroll, SBM_SETTHUMBSIZE, MPFROM2SHORT(1, 1), MPVOID); | 
|---|
|  | 2897 | WinSendMsg(pAD->hhscroll, SBM_SETTHUMBSIZE, MPFROM2SHORT(1, 1), MPVOID); | 
|---|
|  | 2898 | WinSetActiveWindow(HWND_DESKTOP, WinQueryWindow(hwnd, QW_PARENT)); | 
|---|
|  | 2899 | } | 
|---|
|  | 2900 | return 0; | 
|---|
| [2] | 2901 |  | 
|---|
| [551] | 2902 | case WM_CHAR: | 
|---|
|  | 2903 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL)); | 
|---|
|  | 2904 | if (pAD && !(SHORT1FROMMP(mp1) & KC_KEYUP)) { | 
|---|
| [2] | 2905 |  | 
|---|
| [551] | 2906 | register ULONG x; | 
|---|
|  | 2907 | ULONG numlines, y, wascursored = pAD->cursored, thistime, len; | 
|---|
|  | 2908 | BOOL found = FALSE; | 
|---|
|  | 2909 | RECTL rcl; | 
|---|
| [2] | 2910 |  | 
|---|
| [551] | 2911 | WinQueryWindowRect(hwnd, &rcl); | 
|---|
|  | 2912 | numlines = NumLines(&rcl, pAD); | 
|---|
|  | 2913 | if (numlines) { | 
|---|
| [1335] | 2914 | if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) { | 
|---|
|  | 2915 | pAD->lasttime = 0; | 
|---|
|  | 2916 | *pAD->szCommonName = 0; | 
|---|
|  | 2917 | switch (SHORT2FROMMP(mp2)) { | 
|---|
|  | 2918 | case VK_DELETE: | 
|---|
|  | 2919 | if ((shiftstate & KC_CTRL) == KC_CTRL) | 
|---|
|  | 2920 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_PERMDELETE, 0), | 
|---|
|  | 2921 | MPVOID); | 
|---|
|  | 2922 | else if ((shiftstate & KC_SHIFT) == KC_SHIFT) | 
|---|
|  | 2923 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_SAVETOCLIP, 0), | 
|---|
|  | 2924 | MPVOID); | 
|---|
|  | 2925 | else | 
|---|
|  | 2926 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_DELETE, 0), MPVOID); | 
|---|
|  | 2927 | break; | 
|---|
|  | 2928 | case VK_LEFT: | 
|---|
|  | 2929 | WinSendMsg(hwnd, WM_HSCROLL, MPFROM2SHORT(FID_HORZSCROLL, 0), | 
|---|
|  | 2930 | MPFROM2SHORT(0, SB_LINELEFT)); | 
|---|
|  | 2931 | break; | 
|---|
|  | 2932 | case VK_RIGHT: | 
|---|
|  | 2933 | WinSendMsg(hwnd, WM_HSCROLL, MPFROM2SHORT(FID_HORZSCROLL, 0), | 
|---|
|  | 2934 | MPFROM2SHORT(0, SB_LINERIGHT)); | 
|---|
|  | 2935 | break; | 
|---|
|  | 2936 | case VK_PAGEUP: | 
|---|
|  | 2937 | WinSendMsg(hwnd, WM_VSCROLL, MPFROM2SHORT(FID_VERTSCROLL, 0), | 
|---|
|  | 2938 | MPFROM2SHORT(0, SB_PAGEUP)); | 
|---|
|  | 2939 | break; | 
|---|
|  | 2940 | case VK_PAGEDOWN: | 
|---|
|  | 2941 | WinSendMsg(hwnd, WM_VSCROLL, MPFROM2SHORT(FID_VERTSCROLL, 0), | 
|---|
|  | 2942 | MPFROM2SHORT(0, SB_PAGEDOWN)); | 
|---|
|  | 2943 | break; | 
|---|
|  | 2944 | case VK_UP: | 
|---|
|  | 2945 | if (pAD->cursored > 1) { | 
|---|
|  | 2946 | if (shiftstate & KC_SHIFT) | 
|---|
|  | 2947 | WinSendMsg(hwnd, WM_BUTTON1CLICK, | 
|---|
|  | 2948 | MPFROM2SHORT(pAD->fattrs.lAveCharWidth + 2, | 
|---|
|  | 2949 | ((rcl.yTop - (pAD->lMaxHeight * | 
|---|
|  | 2950 | ((pAD->cursored) - | 
|---|
|  | 2951 | pAD->topfile))) - | 
|---|
|  | 2952 | pAD->lMaxDescender) - 1), | 
|---|
|  | 2953 | MPFROM2SHORT(TRUE, 0)); | 
|---|
|  | 2954 | pAD->cursored--; | 
|---|
|  | 2955 | if (pAD->cursored < pAD->topfile) { | 
|---|
|  | 2956 | PaintLine(hwnd, pAD->hps, pAD->cursored, pAD->topfile, &rcl); | 
|---|
|  | 2957 | WinSendMsg(hwnd, WM_VSCROLL, MPFROM2SHORT(FID_VERTSCROLL, 0), | 
|---|
|  | 2958 | MPFROM2SHORT(0, SB_LINEUP)); | 
|---|
|  | 2959 | } | 
|---|
|  | 2960 | else { | 
|---|
|  | 2961 | PaintLine(hwnd, pAD->hps, pAD->cursored - 1, pAD->topfile, | 
|---|
|  | 2962 | &rcl); | 
|---|
|  | 2963 | PaintLine(hwnd, pAD->hps, pAD->cursored, pAD->topfile, &rcl); | 
|---|
|  | 2964 | } | 
|---|
|  | 2965 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
|  | 2966 | } | 
|---|
|  | 2967 | break; | 
|---|
|  | 2968 | case VK_DOWN: | 
|---|
|  | 2969 | if (pAD->cursored < pAD->afindexcnt | 
|---|
|  | 2970 | && pAD->cursored < pAD->topfile + numlines) { | 
|---|
|  | 2971 | if (shiftstate & KC_SHIFT) | 
|---|
|  | 2972 | WinSendMsg(hwnd, WM_BUTTON1CLICK, | 
|---|
|  | 2973 | MPFROM2SHORT(pAD->fattrs.lAveCharWidth + 2, | 
|---|
|  | 2974 | ((rcl.yTop - (pAD->lMaxHeight * | 
|---|
|  | 2975 | ((pAD->cursored) - | 
|---|
|  | 2976 | pAD->topfile))) - | 
|---|
|  | 2977 | pAD->lMaxDescender) - 1), | 
|---|
|  | 2978 | MPFROM2SHORT(TRUE, 0)); | 
|---|
|  | 2979 | pAD->cursored++; | 
|---|
|  | 2980 | if (pAD->cursored >= pAD->topfile + numlines) { | 
|---|
|  | 2981 | PaintLine(hwnd, pAD->hps, pAD->cursored - 2, pAD->topfile, | 
|---|
|  | 2982 | &rcl); | 
|---|
|  | 2983 | WinSendMsg(hwnd, WM_VSCROLL, MPFROM2SHORT(FID_VERTSCROLL, 0), | 
|---|
|  | 2984 | MPFROM2SHORT(0, SB_LINEDOWN)); | 
|---|
|  | 2985 | } | 
|---|
|  | 2986 | else { | 
|---|
|  | 2987 | PaintLine(hwnd, pAD->hps, pAD->cursored - 1, pAD->topfile, | 
|---|
|  | 2988 | &rcl); | 
|---|
|  | 2989 | PaintLine(hwnd, pAD->hps, pAD->cursored - 2, pAD->topfile, | 
|---|
|  | 2990 | &rcl); | 
|---|
|  | 2991 | } | 
|---|
|  | 2992 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
|  | 2993 | } | 
|---|
|  | 2994 | break; | 
|---|
|  | 2995 | case VK_END: | 
|---|
|  | 2996 | if ((shiftstate & KC_CTRL) || | 
|---|
|  | 2997 | pAD->cursored == (pAD->topfile - 1) + numlines) { | 
|---|
|  | 2998 | pAD->cursored = pAD->afindexcnt; | 
|---|
|  | 2999 | pAD->topfile = (pAD->afindexcnt + 1) - numlines; | 
|---|
|  | 3000 | if (pAD->topfile > pAD->afindexcnt) | 
|---|
|  | 3001 | pAD->topfile = 1; | 
|---|
|  | 3002 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
|  | 3003 | } | 
|---|
|  | 3004 | else { | 
|---|
|  | 3005 | pAD->cursored = (pAD->topfile - 1) + numlines; | 
|---|
|  | 3006 | if (pAD->cursored > pAD->afindexcnt) | 
|---|
|  | 3007 | pAD->cursored = pAD->afindexcnt; | 
|---|
|  | 3008 | PaintLine(hwnd, pAD->hps, pAD->cursored - 1, pAD->topfile, | 
|---|
|  | 3009 | &rcl); | 
|---|
|  | 3010 | PaintLine(hwnd, pAD->hps, wascursored - 1, pAD->topfile, &rcl); | 
|---|
|  | 3011 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
|  | 3012 | } | 
|---|
|  | 3013 | break; | 
|---|
|  | 3014 | case VK_HOME: | 
|---|
|  | 3015 | if ((shiftstate & KC_CTRL) || pAD->cursored == pAD->topfile) { | 
|---|
|  | 3016 | pAD->topfile = 1; | 
|---|
|  | 3017 | pAD->cursored = 1; | 
|---|
|  | 3018 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
|  | 3019 | } | 
|---|
|  | 3020 | else { | 
|---|
|  | 3021 | pAD->cursored = pAD->topfile; | 
|---|
|  | 3022 | PaintLine(hwnd, pAD->hps, pAD->cursored - 1, pAD->topfile, | 
|---|
|  | 3023 | &rcl); | 
|---|
|  | 3024 | PaintLine(hwnd, pAD->hps, wascursored - 1, pAD->topfile, &rcl); | 
|---|
|  | 3025 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
|  | 3026 | } | 
|---|
|  | 3027 | break; | 
|---|
|  | 3028 | case VK_SPACE: | 
|---|
|  | 3029 | WinSendMsg(hwnd, WM_BUTTON1CLICK, | 
|---|
|  | 3030 | MPFROM2SHORT(pAD->fattrs.lAveCharWidth + 2, | 
|---|
|  | 3031 | ((rcl.yTop - (pAD->lMaxHeight * | 
|---|
|  | 3032 | ((pAD->cursored) - | 
|---|
|  | 3033 | pAD->topfile))) - | 
|---|
|  | 3034 | pAD->lMaxDescender) - 1), | 
|---|
|  | 3035 | MPFROM2SHORT(TRUE, 0)); | 
|---|
|  | 3036 | break; | 
|---|
|  | 3037 | case VK_NEWLINE: | 
|---|
|  | 3038 | case VK_ENTER: | 
|---|
|  | 3039 | WinSendMsg(hwnd, WM_BUTTON1DBLCLK, | 
|---|
|  | 3040 | MPFROM2SHORT(pAD->fattrs.lAveCharWidth + 2, | 
|---|
|  | 3041 | ((rcl.yTop - (pAD->lMaxHeight * | 
|---|
|  | 3042 | ((pAD->cursored) - | 
|---|
|  | 3043 | pAD->topfile))) - | 
|---|
|  | 3044 | pAD->lMaxDescender) - 1), MPFROM2SHORT(0, | 
|---|
|  | 3045 | 0)); | 
|---|
|  | 3046 | break; | 
|---|
|  | 3047 | } | 
|---|
|  | 3048 | } | 
|---|
|  | 3049 | else if (SHORT1FROMMP(mp1) & KC_CHAR) { | 
|---|
|  | 3050 | switch (SHORT1FROMMP(mp2)) { | 
|---|
|  | 3051 | case '\x1b': | 
|---|
|  | 3052 | case '\r': | 
|---|
|  | 3053 | case '\n': | 
|---|
|  | 3054 | WinSendMsg(hwnd, WM_BUTTON1DBLCLK, | 
|---|
|  | 3055 | MPFROM2SHORT(pAD->fattrs.lAveCharWidth + 2, | 
|---|
|  | 3056 | (rcl.yTop - (pAD->lMaxHeight * | 
|---|
|  | 3057 | ((pAD->cursored) - | 
|---|
|  | 3058 | pAD->topfile))) - 1), | 
|---|
|  | 3059 | MPFROM2SHORT(0, 0)); | 
|---|
|  | 3060 | pAD->lasttime = 0; | 
|---|
|  | 3061 | *pAD->szCommonName = 0; | 
|---|
|  | 3062 | break; | 
|---|
|  | 3063 | default: | 
|---|
|  | 3064 | thistime = WinQueryMsgTime(WinQueryAnchorBlock(hwnd)); | 
|---|
|  | 3065 | if (thistime > pAD->lasttime + 1000) | 
|---|
|  | 3066 | *pAD->szCommonName = 0; | 
|---|
|  | 3067 | pAD->lasttime = thistime; | 
|---|
|  | 3068 | KbdRetry: | 
|---|
|  | 3069 | len = strlen(pAD->szCommonName); | 
|---|
|  | 3070 | if (len >= CCHMAXPATH - 1) { | 
|---|
|  | 3071 | *pAD->szCommonName = 0; | 
|---|
|  | 3072 | len = 0; | 
|---|
|  | 3073 | } | 
|---|
|  | 3074 | pAD->szCommonName[len] = toupper(SHORT1FROMMP(mp2)); | 
|---|
|  | 3075 | pAD->szCommonName[len + 1] = 0; | 
|---|
|  | 3076 | for (x = pAD->cursored - (len > 0); x < pAD->afindexcnt; x++) { | 
|---|
|  | 3077 | y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x; | 
|---|
|  | 3078 | if (pAD->fullnames) { | 
|---|
|  | 3079 | if (!strnicmp(pAD->afindex[y]->fullname, pAD->szCommonName, | 
|---|
|  | 3080 | len + 1)) { | 
|---|
|  | 3081 | found = TRUE; | 
|---|
|  | 3082 | break; | 
|---|
|  | 3083 | } | 
|---|
|  | 3084 | } | 
|---|
|  | 3085 | else { | 
|---|
|  | 3086 | if (!strnicmp(pAD->afindex[y]->filename, pAD->szCommonName, | 
|---|
|  | 3087 | len + 1)) { | 
|---|
|  | 3088 | found = TRUE; | 
|---|
|  | 3089 | break; | 
|---|
|  | 3090 | } | 
|---|
|  | 3091 | } | 
|---|
|  | 3092 | } | 
|---|
|  | 3093 | if (!found) { | 
|---|
|  | 3094 | for (x = 0; x < pAD->cursored - (len > 0); x++) { | 
|---|
|  | 3095 | y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x; | 
|---|
|  | 3096 | if (pAD->fullnames) { | 
|---|
|  | 3097 | if (!strnicmp(pAD->afindex[y]->fullname, pAD->szCommonName, | 
|---|
|  | 3098 | len + 1)) { | 
|---|
|  | 3099 | found = TRUE; | 
|---|
|  | 3100 | break; | 
|---|
|  | 3101 | } | 
|---|
|  | 3102 | } | 
|---|
|  | 3103 | else { | 
|---|
|  | 3104 | if (!strnicmp(pAD->afindex[y]->filename, pAD->szCommonName, | 
|---|
|  | 3105 | len + 1)) { | 
|---|
|  | 3106 | found = TRUE; | 
|---|
|  | 3107 | break; | 
|---|
|  | 3108 | } | 
|---|
|  | 3109 | } | 
|---|
|  | 3110 | } | 
|---|
|  | 3111 | } | 
|---|
|  | 3112 | if (found) { | 
|---|
|  | 3113 | if (x + 1 != pAD->cursored) { | 
|---|
|  | 3114 | pAD->cursored = x + 1; | 
|---|
|  | 3115 | if (pAD->cursored >= pAD->topfile && | 
|---|
|  | 3116 | pAD->cursored < pAD->topfile + numlines && | 
|---|
|  | 3117 | wascursored != pAD->cursored) { | 
|---|
|  | 3118 | PaintLine(hwnd, pAD->hps, pAD->cursored - 1, pAD->topfile, | 
|---|
|  | 3119 | &rcl); | 
|---|
|  | 3120 | PaintLine(hwnd, pAD->hps, wascursored - 1, pAD->topfile, | 
|---|
|  | 3121 | &rcl); | 
|---|
|  | 3122 | } | 
|---|
|  | 3123 | else { | 
|---|
|  | 3124 | if (pAD->cursored < numlines) | 
|---|
|  | 3125 | pAD->topfile = 1; | 
|---|
|  | 3126 | else if (pAD->cursored > | 
|---|
|  | 3127 | (pAD->afindexcnt + 1) - (numlines / 2)) | 
|---|
|  | 3128 | pAD->topfile = (pAD->afindexcnt + 1) - numlines; | 
|---|
|  | 3129 | else | 
|---|
|  | 3130 | pAD->topfile = pAD->cursored - (numlines / 2); | 
|---|
|  | 3131 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
|  | 3132 | } | 
|---|
|  | 3133 | } | 
|---|
|  | 3134 | } | 
|---|
|  | 3135 | else { | 
|---|
|  | 3136 | *pAD->szCommonName = 0; | 
|---|
|  | 3137 | pAD->lasttime = 0; | 
|---|
|  | 3138 | if (len)                  // retry as first letter if no match | 
|---|
|  | 3139 | goto KbdRetry; | 
|---|
|  | 3140 | } | 
|---|
|  | 3141 | break; | 
|---|
|  | 3142 | } | 
|---|
|  | 3143 | } | 
|---|
| [2] | 3144 | } | 
|---|
| [551] | 3145 | } | 
|---|
|  | 3146 | break; | 
|---|
| [2] | 3147 |  | 
|---|
| [551] | 3148 | case DM_PRINTOBJECT: | 
|---|
|  | 3149 | return MRFROMLONG(DRR_TARGET); | 
|---|
| [2] | 3150 |  | 
|---|
| [551] | 3151 | case DM_DISCARDOBJECT: | 
|---|
|  | 3152 | return MRFROMLONG(DRR_TARGET); | 
|---|
| [2] | 3153 |  | 
|---|
| [551] | 3154 | case WM_BEGINDRAG: | 
|---|
|  | 3155 | { | 
|---|
|  | 3156 | CHAR **list; | 
|---|
| [2] | 3157 |  | 
|---|
| [551] | 3158 | list = BuildAList(hwnd); | 
|---|
|  | 3159 | if (!list) | 
|---|
| [1398] | 3160 | Runtime_Error(pszSrcFile, __LINE__, NULL); | 
|---|
| [551] | 3161 | else { | 
|---|
| [1498] | 3162 | WinSetWindowText(pAD->hwndStatus, (CHAR *) GetPString(IDS_DRAGGINGFILESTEXT)); | 
|---|
| [1335] | 3163 | DragList(hwnd, (HWND) 0, list, TRUE); | 
|---|
|  | 3164 | FreeList(list); | 
|---|
|  | 3165 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
| [2] | 3166 | } | 
|---|
| [551] | 3167 | } | 
|---|
|  | 3168 | break; | 
|---|
| [2] | 3169 |  | 
|---|
| [551] | 3170 | case WM_BUTTON1MOTIONSTART: | 
|---|
|  | 3171 | if (pAD && !pAD->stopflag && | 
|---|
| [1335] | 3172 | !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) { | 
|---|
| [551] | 3173 | pAD->mousecaptured = TRUE; | 
|---|
|  | 3174 | pAD->lastselected = (ULONG) - 1; | 
|---|
|  | 3175 | pAD->lastdirection = 0; | 
|---|
|  | 3176 | WinSetCapture(HWND_DESKTOP, hwnd); | 
|---|
|  | 3177 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
|  | 3178 | WinSendMsg(hwnd, WM_BUTTON1CLICK, mp1, MPFROM2SHORT(TRUE, 0)); | 
|---|
|  | 3179 | } | 
|---|
|  | 3180 | break; | 
|---|
| [2] | 3181 |  | 
|---|
| [551] | 3182 | case WM_MOUSEMOVE: | 
|---|
|  | 3183 | shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL)); | 
|---|
|  | 3184 | if (pAD && pAD->mousecaptured) { | 
|---|
| [2] | 3185 |  | 
|---|
| [551] | 3186 | ULONG numlines, whichfile, y, x; | 
|---|
|  | 3187 | LONG inc; | 
|---|
|  | 3188 | RECTL Rectl; | 
|---|
|  | 3189 | POINTS pts; | 
|---|
|  | 3190 | BOOL outofwindow = FALSE; | 
|---|
| [2] | 3191 |  | 
|---|
| [551] | 3192 | WinQueryWindowRect(hwnd, &Rectl); | 
|---|
|  | 3193 | numlines = NumLines(&Rectl, pAD); | 
|---|
|  | 3194 | if (numlines) { | 
|---|
| [1335] | 3195 | pts.x = SHORT1FROMMP(mp1); | 
|---|
|  | 3196 | pts.y = SHORT2FROMMP(mp1); | 
|---|
|  | 3197 | if (pts.y < 0) { | 
|---|
|  | 3198 | WinSendMsg(hwnd, WM_VSCROLL, MPFROM2SHORT(FID_VERTSCROLL, 0), | 
|---|
|  | 3199 | MPFROM2SHORT(0, SB_LINEDOWN)); | 
|---|
|  | 3200 | pts.y = 1; | 
|---|
|  | 3201 | outofwindow = TRUE; | 
|---|
|  | 3202 | } | 
|---|
|  | 3203 | else if (pts.y > Rectl.yTop - Rectl.yBottom) { | 
|---|
|  | 3204 | WinSendMsg(hwnd, WM_VSCROLL, MPFROM2SHORT(FID_VERTSCROLL, 0), | 
|---|
|  | 3205 | MPFROM2SHORT(0, SB_LINEUP)); | 
|---|
| [1533] | 3206 | pts.y = (SHORT) (Rectl.yTop - Rectl.yBottom) - 1; | 
|---|
| [1335] | 3207 | outofwindow = TRUE; | 
|---|
|  | 3208 | } | 
|---|
|  | 3209 | whichfile = ((Rectl.yTop - Rectl.yBottom) - | 
|---|
|  | 3210 | ((LONG) pts.y + pAD->lMaxDescender)) / pAD->lMaxHeight; | 
|---|
|  | 3211 | if (whichfile > numlines - 1) | 
|---|
|  | 3212 | whichfile = numlines - 1; | 
|---|
|  | 3213 | whichfile += (pAD->topfile - 1); | 
|---|
|  | 3214 | y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - whichfile : whichfile; | 
|---|
|  | 3215 | if (y < pAD->afindexcnt && pAD->lastselected != whichfile) { | 
|---|
|  | 3216 | if (pAD->lastselected != (ULONG) - 1) { | 
|---|
|  | 3217 | inc = (pAD->lastselected < whichfile) ? 1 : -1; | 
|---|
|  | 3218 | for (x = pAD->lastselected + inc; | 
|---|
|  | 3219 | x != whichfile && x < pAD->afindexcnt; | 
|---|
|  | 3220 | (pAD->lastselected < whichfile) ? x++ : x--) { | 
|---|
|  | 3221 | y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x; | 
|---|
|  | 3222 | if (pAD->afindex[y]->flags & AF_SELECTED) { | 
|---|
|  | 3223 | pAD->afindex[y]->flags &= ~AF_SELECTED; | 
|---|
|  | 3224 | pAD->selected--; | 
|---|
|  | 3225 | pAD->ullSelectedBytes -= pAD->afindex[y]->cbFile; | 
|---|
|  | 3226 | } | 
|---|
|  | 3227 | else { | 
|---|
|  | 3228 | pAD->afindex[y]->flags |= AF_SELECTED; | 
|---|
|  | 3229 | pAD->selected++; | 
|---|
|  | 3230 | pAD->ullSelectedBytes += pAD->afindex[y]->cbFile; | 
|---|
|  | 3231 | } | 
|---|
|  | 3232 | PaintLine(hwnd, pAD->hps, x, pAD->topfile, &Rectl); | 
|---|
|  | 3233 | } | 
|---|
|  | 3234 | } | 
|---|
|  | 3235 | WinSendMsg(hwnd, WM_BUTTON1CLICK, MPFROM2SHORT(pts.x, pts.y), | 
|---|
|  | 3236 | MPFROM2SHORT(TRUE, 0)); | 
|---|
|  | 3237 | } | 
|---|
| [2] | 3238 | } | 
|---|
| [551] | 3239 | if (outofwindow) { | 
|---|
| [2] | 3240 |  | 
|---|
| [1335] | 3241 | POINTL ptl; | 
|---|
| [2] | 3242 |  | 
|---|
| [1335] | 3243 | WinQueryPointerPos(HWND_DESKTOP, &ptl); | 
|---|
|  | 3244 | WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1); | 
|---|
|  | 3245 | if ((SHORT) ptl.y == (SHORT) SHORT2FROMMP(mp1) && | 
|---|
|  | 3246 | (SHORT) ptl.x == (SHORT) SHORT1FROMMP(mp1) && | 
|---|
|  | 3247 | ((SHORT) ptl.y < 0 || ptl.y > (Rectl.yTop - Rectl.yBottom))) { | 
|---|
|  | 3248 | PostMsg(hwnd, UM_MOUSEMOVE, mp1, MPVOID); | 
|---|
|  | 3249 | DosSleep(1); | 
|---|
|  | 3250 | } | 
|---|
| [2] | 3251 | } | 
|---|
| [551] | 3252 | } | 
|---|
|  | 3253 | break; | 
|---|
| [2] | 3254 |  | 
|---|
| [551] | 3255 | case UM_MOUSEMOVE: | 
|---|
|  | 3256 | if (pAD && pAD->mousecaptured) { | 
|---|
|  | 3257 |  | 
|---|
|  | 3258 | POINTL ptl; | 
|---|
|  | 3259 | RECTL Rectl; | 
|---|
|  | 3260 |  | 
|---|
|  | 3261 | WinQueryWindowRect(hwnd, &Rectl); | 
|---|
|  | 3262 | WinQueryPointerPos(HWND_DESKTOP, &ptl); | 
|---|
| [766] | 3263 | WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1); | 
|---|
| [551] | 3264 | if ((SHORT) ptl.y == (SHORT) SHORT2FROMMP(mp1) && | 
|---|
| [1335] | 3265 | (SHORT) ptl.x == (SHORT) SHORT1FROMMP(mp1) && | 
|---|
|  | 3266 | ((SHORT) ptl.y < 0 || ptl.y > (Rectl.yTop - Rectl.yBottom))) { | 
|---|
|  | 3267 | DosSleep(1); | 
|---|
|  | 3268 | PostMsg(hwnd, WM_MOUSEMOVE, mp1, MPFROM2SHORT(TRUE, 0)); | 
|---|
| [2] | 3269 | } | 
|---|
| [551] | 3270 | } | 
|---|
|  | 3271 | return 0; | 
|---|
| [2] | 3272 |  | 
|---|
| [551] | 3273 | case WM_BUTTON1UP: | 
|---|
|  | 3274 | case WM_BUTTON1MOTIONEND: | 
|---|
|  | 3275 | if (pAD) { | 
|---|
|  | 3276 | pAD->mousecaptured = FALSE; | 
|---|
|  | 3277 | pAD->lastselected = (ULONG) - 1; | 
|---|
|  | 3278 | pAD->lastdirection = 0; | 
|---|
|  | 3279 | WinSetCapture(HWND_DESKTOP, NULLHANDLE); | 
|---|
|  | 3280 | } | 
|---|
|  | 3281 | break; | 
|---|
| [2] | 3282 |  | 
|---|
| [551] | 3283 | case WM_BUTTON1CLICK: | 
|---|
|  | 3284 | case WM_BUTTON1DBLCLK: | 
|---|
|  | 3285 | shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL)); | 
|---|
|  | 3286 | if (pAD && !pAD->stopflag && | 
|---|
| [1335] | 3287 | !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) { | 
|---|
| [2] | 3288 |  | 
|---|
| [551] | 3289 | ULONG numlines, whichfile, y, wascursored; | 
|---|
|  | 3290 | RECTL Rectl; | 
|---|
|  | 3291 | POINTS pts; | 
|---|
|  | 3292 |  | 
|---|
| [943] | 3293 | if (pAD->afindexcnt) { | 
|---|
| [1335] | 3294 | WinQueryWindowRect(hwnd, &Rectl); | 
|---|
|  | 3295 | numlines = NumLines(&Rectl, pAD); | 
|---|
|  | 3296 | if (numlines) { | 
|---|
|  | 3297 | pts.x = SHORT1FROMMP(mp1); | 
|---|
|  | 3298 | pts.y = SHORT2FROMMP(mp1); | 
|---|
|  | 3299 | whichfile = ((Rectl.yTop - Rectl.yBottom) - | 
|---|
|  | 3300 | ((LONG) pts.y + pAD->lMaxDescender)) / pAD->lMaxHeight; | 
|---|
|  | 3301 | if (whichfile > numlines - 1) | 
|---|
|  | 3302 | whichfile = numlines - 1; | 
|---|
|  | 3303 | whichfile += (pAD->topfile - 1); | 
|---|
|  | 3304 | if (whichfile + 1 > pAD->afindexcnt) | 
|---|
|  | 3305 | break; | 
|---|
|  | 3306 | y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - whichfile : whichfile; | 
|---|
|  | 3307 | wascursored = pAD->cursored; | 
|---|
|  | 3308 | pAD->cursored = whichfile + 1; | 
|---|
|  | 3309 | if (pAD->cursored != wascursored) | 
|---|
|  | 3310 | PaintLine(hwnd, pAD->hps, wascursored - 1, pAD->topfile, &Rectl); | 
|---|
|  | 3311 | if (y < pAD->afindexcnt) { | 
|---|
|  | 3312 | if (msg == WM_BUTTON1CLICK || fUnHilite) { | 
|---|
|  | 3313 | if (pAD->afindex[y]->flags & AF_SELECTED) { | 
|---|
|  | 3314 | pAD->afindex[y]->flags &= ~AF_SELECTED; | 
|---|
|  | 3315 | pAD->selected--; | 
|---|
|  | 3316 | pAD->ullSelectedBytes -= pAD->afindex[y]->cbFile; | 
|---|
|  | 3317 | } | 
|---|
|  | 3318 | else { | 
|---|
|  | 3319 | pAD->afindex[y]->flags |= AF_SELECTED; | 
|---|
|  | 3320 | pAD->selected++; | 
|---|
|  | 3321 | pAD->ullSelectedBytes += pAD->afindex[y]->cbFile; | 
|---|
|  | 3322 | } | 
|---|
|  | 3323 | PaintLine(hwnd, pAD->hps, whichfile, pAD->topfile, &Rectl); | 
|---|
|  | 3324 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
|  | 3325 | } | 
|---|
|  | 3326 | } | 
|---|
|  | 3327 | if (msg == WM_BUTTON1CLICK) { | 
|---|
|  | 3328 | if (pAD->lastselected != (ULONG) - 1) { | 
|---|
|  | 3329 | if (whichfile > pAD->lastselected) | 
|---|
|  | 3330 | pAD->lastdirection = 1; | 
|---|
|  | 3331 | else | 
|---|
|  | 3332 | pAD->lastdirection = 2; | 
|---|
|  | 3333 | } | 
|---|
|  | 3334 | else | 
|---|
|  | 3335 | pAD->lastdirection = 0; | 
|---|
|  | 3336 | pAD->lastselected = whichfile; | 
|---|
|  | 3337 | } | 
|---|
|  | 3338 | else | 
|---|
|  | 3339 | DefaultViewKeys(hwnd, pAD->hwndFrame, HWND_DESKTOP, NULL, | 
|---|
|  | 3340 | pAD->afindex[y]->fullname); | 
|---|
|  | 3341 | } | 
|---|
| [2] | 3342 | } | 
|---|
| [551] | 3343 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
|  | 3344 | } | 
|---|
|  | 3345 | break; | 
|---|
| [2] | 3346 |  | 
|---|
| [551] | 3347 | case WM_MENUEND: | 
|---|
|  | 3348 | if (pAD && (HWND) mp2 == pAD->hwndPopup) { | 
|---|
|  | 3349 | WinDestroyWindow(pAD->hwndPopup); | 
|---|
|  | 3350 | pAD->hwndPopup = (HWND) 0; | 
|---|
|  | 3351 | } | 
|---|
|  | 3352 | break; | 
|---|
| [2] | 3353 |  | 
|---|
| [551] | 3354 | case WM_CONTEXTMENU: | 
|---|
|  | 3355 | if (pAD) { | 
|---|
|  | 3356 | if (!pAD->hwndPopup) { | 
|---|
| [1335] | 3357 | pAD->hwndPopup = | 
|---|
|  | 3358 | WinLoadMenu(HWND_DESKTOP, FM3ModHandle, SEEALL_POPUP); | 
|---|
| [1394] | 3359 | if (pAD->hwndPopup) { | 
|---|
|  | 3360 | //fixme to allow user to change presparams 1-10-09 GKY | 
|---|
| [1335] | 3361 | WinSetPresParam(pAD->hwndPopup, PP_FONTNAMESIZE, | 
|---|
| [1391] | 3362 | strlen(FNT_8HELVETICA) + 1, | 
|---|
| [1400] | 3363 | (PVOID) FNT_8HELVETICA); | 
|---|
| [1335] | 3364 | SetConditionalCascade(pAD->hwndPopup, | 
|---|
|  | 3365 | IDM_DELETESUBMENU, | 
|---|
|  | 3366 | (fDefaultDeletePerm) ? | 
|---|
|  | 3367 | IDM_PERMDELETE : IDM_DELETE); | 
|---|
|  | 3368 | SetConditionalCascade(pAD->hwndPopup, IDM_MOVEMENU, IDM_MOVE); | 
|---|
|  | 3369 | SetConditionalCascade(pAD->hwndPopup, IDM_COPYMENU, IDM_COPY); | 
|---|
|  | 3370 | SetConditionalCascade(pAD->hwndPopup, IDM_OPENSUBMENU, | 
|---|
|  | 3371 | IDM_OPENDEFAULT); | 
|---|
|  | 3372 | SetConditionalCascade(pAD->hwndMenu, IDM_OBJECTSUBMENU, IDM_SHADOW); | 
|---|
|  | 3373 | if (fWorkPlace) { | 
|---|
|  | 3374 | WinSendMsg(pAD->hwndPopup, MM_DELETEITEM, | 
|---|
|  | 3375 | MPFROM2SHORT(IDM_OPENSUBMENU, TRUE), MPVOID); | 
|---|
|  | 3376 | WinSendMsg(pAD->hwndPopup, MM_DELETEITEM, | 
|---|
|  | 3377 | MPFROM2SHORT(IDM_OBJECTSUBMENU, TRUE), MPVOID); | 
|---|
|  | 3378 | } | 
|---|
|  | 3379 | } | 
|---|
| [551] | 3380 | } | 
|---|
|  | 3381 | if (pAD->hwndPopup) { | 
|---|
| [2] | 3382 |  | 
|---|
| [1335] | 3383 | APIRET rc; | 
|---|
| [2] | 3384 |  | 
|---|
| [1335] | 3385 | rc = DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN); | 
|---|
|  | 3386 | WinEnableMenuItem(pAD->hwndPopup, IDM_EAS, (rc == 0 && | 
|---|
|  | 3387 | pAD->selected != 0)); | 
|---|
|  | 3388 | WinEnableMenuItem(pAD->hwndPopup, IDM_UUDECODE, (rc == 0 && | 
|---|
|  | 3389 | pAD->selected != 0)); | 
|---|
|  | 3390 | WinEnableMenuItem(pAD->hwndPopup, IDM_EXTRACT, (rc == 0 && | 
|---|
|  | 3391 | pAD->selected != 0)); | 
|---|
|  | 3392 | WinEnableMenuItem(pAD->hwndPopup, IDM_ARCHIVE, (rc == 0 && | 
|---|
|  | 3393 | pAD->selected != 0)); | 
|---|
|  | 3394 | WinEnableMenuItem(pAD->hwndPopup, IDM_MOVEMENU, (rc == 0 && | 
|---|
|  | 3395 | pAD->selected != 0)); | 
|---|
|  | 3396 | WinEnableMenuItem(pAD->hwndPopup, IDM_COPYMENU, (rc == 0 && | 
|---|
|  | 3397 | pAD->selected != 0)); | 
|---|
|  | 3398 | WinEnableMenuItem(pAD->hwndPopup, IDM_RENAME, (rc == 0 && | 
|---|
|  | 3399 | pAD->selected != 0)); | 
|---|
|  | 3400 | WinEnableMenuItem(pAD->hwndPopup, IDM_PRINT, (rc == 0 && | 
|---|
|  | 3401 | pAD->selected != 0)); | 
|---|
|  | 3402 | WinEnableMenuItem(pAD->hwndPopup, IDM_SUBJECT, (rc == 0 && | 
|---|
|  | 3403 | pAD->selected != 0)); | 
|---|
|  | 3404 | WinEnableMenuItem(pAD->hwndPopup, IDM_OPENSUBMENU, (rc == 0 && | 
|---|
|  | 3405 | pAD->selected != | 
|---|
|  | 3406 | 0)); | 
|---|
|  | 3407 | WinEnableMenuItem(pAD->hwndPopup, IDM_OBJECTSUBMENU, | 
|---|
|  | 3408 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3409 | WinEnableMenuItem(pAD->hwndPopup, IDM_DELETESUBMENU, | 
|---|
|  | 3410 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3411 | WinEnableMenuItem(pAD->hwndPopup, IDM_INFO, | 
|---|
|  | 3412 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3413 | WinEnableMenuItem(pAD->hwndPopup, IDM_ATTRS, | 
|---|
|  | 3414 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3415 | WinEnableMenuItem(pAD->hwndPopup, IDM_COLLECT, | 
|---|
|  | 3416 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3417 | WinEnableMenuItem(pAD->hwndPopup, IDM_SAVETOCLIP, | 
|---|
|  | 3418 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3419 | WinEnableMenuItem(pAD->hwndPopup, IDM_SAVETOCLIPFILENAME, | 
|---|
|  | 3420 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3421 | WinEnableMenuItem(pAD->hwndPopup, IDM_APPENDTOCLIP, | 
|---|
|  | 3422 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3423 | WinEnableMenuItem(pAD->hwndPopup, IDM_APPENDTOCLIPFILENAME, | 
|---|
|  | 3424 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3425 | WinEnableMenuItem(pAD->hwndPopup, IDM_SAVETOLIST, | 
|---|
|  | 3426 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3427 | WinEnableMenuItem(pAD->hwndPopup, IDM_REMOVE, | 
|---|
|  | 3428 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3429 | WinEnableMenuItem(pAD->hwndPopup, IDM_HIDEALL, | 
|---|
|  | 3430 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3431 | WinEnableMenuItem(pAD->hwndPopup, IDM_SELECTALL, | 
|---|
|  | 3432 | (rc == 0 && pAD->afindexcnt != 0)); | 
|---|
|  | 3433 | WinEnableMenuItem(pAD->hwndPopup, IDM_SELECTMASK, | 
|---|
|  | 3434 | (rc == 0 && pAD->afindexcnt != 0)); | 
|---|
|  | 3435 | WinEnableMenuItem(pAD->hwndPopup, IDM_DESELECTALL, | 
|---|
|  | 3436 | (rc == 0 && pAD->afindexcnt != 0)); | 
|---|
|  | 3437 | WinEnableMenuItem(pAD->hwndPopup, IDM_DESELECTMASK, | 
|---|
|  | 3438 | (rc == 0 && pAD->afindexcnt != 0)); | 
|---|
|  | 3439 | WinEnableMenuItem(pAD->hwndPopup, IDM_INVERT, | 
|---|
|  | 3440 | (rc == 0 && pAD->afindexcnt != 0)); | 
|---|
|  | 3441 | WinEnableMenuItem(pAD->hwndPopup, IDM_FILTER, | 
|---|
|  | 3442 | (rc == 0 && pAD->afheadcnt != 0)); | 
|---|
|  | 3443 | if (!rc) | 
|---|
|  | 3444 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
|  | 3445 | if (WinPopupMenu(hwnd, hwnd, pAD->hwndPopup, SHORT1FROMMP(mp1), | 
|---|
|  | 3446 | SHORT2FROMMP(mp1), 0, | 
|---|
|  | 3447 | PU_HCONSTRAIN | PU_VCONSTRAIN | | 
|---|
|  | 3448 | PU_KEYBOARD | PU_MOUSEBUTTON1)) | 
|---|
|  | 3449 | CenterOverWindow(pAD->hwndPopup); | 
|---|
| [2] | 3450 | } | 
|---|
| [551] | 3451 | } | 
|---|
|  | 3452 | break; | 
|---|
| [2] | 3453 |  | 
|---|
| [551] | 3454 | case UM_CONTAINER_FILLED: | 
|---|
|  | 3455 | if (pAD) { | 
|---|
|  | 3456 | pAD->stopflag = 0; | 
|---|
|  | 3457 | pAD->topfile = 1; | 
|---|
|  | 3458 | pAD->cursored = 1; | 
|---|
|  | 3459 | pAD->multiplier = 1; | 
|---|
| [943] | 3460 | if (!pAD->afindexcnt) { | 
|---|
| [1559] | 3461 | if (!fAlertBeepOff) | 
|---|
| [1395] | 3462 | DosBeep(250, 50); | 
|---|
| [1335] | 3463 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
| [2] | 3464 | } | 
|---|
| [551] | 3465 | else { | 
|---|
| [1559] | 3466 | if (!fAlertBeepOff) | 
|---|
| [1395] | 3467 | DosBeep(1000, 25); | 
|---|
| [1335] | 3468 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
|  | 3469 | PostMsg(hwnd, UM_SETUP3, MPVOID, MPVOID); | 
|---|
| [551] | 3470 | } | 
|---|
|  | 3471 | WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0, | 
|---|
| [1335] | 3472 | SWP_SHOW | SWP_RESTORE | SWP_ACTIVATE | SWP_ZORDER); | 
|---|
| [551] | 3473 | } | 
|---|
|  | 3474 | return 0; | 
|---|
| [2] | 3475 |  | 
|---|
| [551] | 3476 | case WM_ERASEBACKGROUND: | 
|---|
|  | 3477 | WinFillRect((HPS) mp1, (PRECTL) mp2, | 
|---|
| [1335] | 3478 | standardcolors[Colors[COLORS_NORMALBACK]]); | 
|---|
| [551] | 3479 | return 0; | 
|---|
| [2] | 3480 |  | 
|---|
| [551] | 3481 | case WM_PAINT: | 
|---|
| [1559] | 3482 | // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc WM_PAINT"); | 
|---|
| [551] | 3483 | if (pAD) { | 
|---|
| [2] | 3484 |  | 
|---|
| [551] | 3485 | HPS hpsp; | 
|---|
|  | 3486 | RECTL Rectl; | 
|---|
|  | 3487 | POINTL ptl; | 
|---|
|  | 3488 | register ULONG x; | 
|---|
|  | 3489 | ULONG y, len, numlines; | 
|---|
| [1397] | 3490 | CHAR szBuff[CCHMAXPATH + 80], szCmmaFmtFileSize[81], szDate[DATE_BUF_BYTES]; | 
|---|
| [551] | 3491 | BOOL inverted, hidsys, reado, wascursored; | 
|---|
| [2] | 3492 |  | 
|---|
| [551] | 3493 | hpsp = WinBeginPaint(hwnd, pAD->hps, &Rectl); | 
|---|
|  | 3494 | WinFillRect(hpsp, &Rectl, standardcolors[Colors[COLORS_NORMALBACK]]); | 
|---|
|  | 3495 | if (!pAD->stopflag && | 
|---|
| [1335] | 3496 | !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) { | 
|---|
|  | 3497 | WinQueryWindowRect(hwnd, &Rectl); | 
|---|
|  | 3498 | numlines = NumLines(&Rectl, pAD); | 
|---|
|  | 3499 | if (pAD->afindexcnt && numlines) { | 
|---|
|  | 3500 | if (pAD->topfile > (pAD->afindexcnt + 1) - numlines) | 
|---|
|  | 3501 | pAD->topfile = (pAD->afindexcnt + 1) - numlines; | 
|---|
|  | 3502 | if (pAD->topfile > pAD->afindexcnt) | 
|---|
|  | 3503 | pAD->topfile = 1; | 
|---|
|  | 3504 | if (!pAD->topfile) | 
|---|
|  | 3505 | pAD->topfile = 1; | 
|---|
|  | 3506 | if (pAD->cursored < pAD->topfile) | 
|---|
|  | 3507 | pAD->cursored = pAD->topfile; | 
|---|
|  | 3508 | else if (pAD->cursored > (pAD->topfile + numlines) - 1) | 
|---|
|  | 3509 | pAD->cursored = (pAD->topfile + numlines) - 1; | 
|---|
|  | 3510 | if (pAD->cursored > pAD->afindexcnt) | 
|---|
|  | 3511 | pAD->cursored = pAD->afindexcnt; | 
|---|
|  | 3512 | } | 
|---|
|  | 3513 | else | 
|---|
|  | 3514 | pAD->topfile = pAD->cursored = 1; | 
|---|
|  | 3515 | if (numlines && pAD->afindexcnt) { | 
|---|
|  | 3516 | GpiSetBackMix(hpsp, BM_OVERPAINT); | 
|---|
|  | 3517 | wascursored = TRUE; | 
|---|
|  | 3518 | for (x = pAD->topfile - 1; x < pAD->afindexcnt; x++) { | 
|---|
|  | 3519 | ptl.x = pAD->horzscroll; | 
|---|
|  | 3520 | if (wascursored) {          /* reestablish normal colors */ | 
|---|
|  | 3521 | GpiSetColor(pAD->hps, | 
|---|
|  | 3522 | standardcolors[Colors[COLORS_NORMALFORE]]); | 
|---|
|  | 3523 | GpiSetBackColor(pAD->hps, | 
|---|
|  | 3524 | standardcolors[Colors[COLORS_NORMALBACK]]); | 
|---|
|  | 3525 | wascursored = inverted = hidsys = reado = FALSE; | 
|---|
|  | 3526 | } | 
|---|
|  | 3527 | if (x == pAD->cursored - 1) | 
|---|
|  | 3528 | wascursored = TRUE; | 
|---|
|  | 3529 | y = (pAD->invertsort) ? (pAD->afindexcnt - 1) - x : x; | 
|---|
|  | 3530 | ptl.y = (Rectl.yTop - | 
|---|
|  | 3531 | (pAD->lMaxHeight * (((x + 1) - pAD->topfile) + 1))); | 
|---|
|  | 3532 | if (ptl.y - pAD->lMaxDescender <= 0) | 
|---|
|  | 3533 | break; | 
|---|
|  | 3534 | if (pAD->afindex[y]->flags & AF_SELECTED) { | 
|---|
|  | 3535 | if (!inverted) { | 
|---|
|  | 3536 | GpiSetColor(pAD->hps, | 
|---|
|  | 3537 | standardcolors[Colors | 
|---|
|  | 3538 | [COLORS_SELECTEDNORMALFORE]]); | 
|---|
|  | 3539 | GpiSetBackColor(pAD->hps, | 
|---|
|  | 3540 | (wascursored) ? | 
|---|
|  | 3541 | standardcolors[Colors | 
|---|
|  | 3542 | [COLORS_CURSOREDSELECTEDBACK]] | 
|---|
|  | 3543 | : | 
|---|
|  | 3544 | standardcolors[Colors[COLORS_SELECTEDBACK]]); | 
|---|
|  | 3545 | inverted = TRUE; | 
|---|
|  | 3546 | } | 
|---|
|  | 3547 | } | 
|---|
|  | 3548 | else if (inverted || | 
|---|
|  | 3549 | ((pAD->afindex[y]->attrFile & | 
|---|
|  | 3550 | (FILE_SYSTEM | FILE_HIDDEN)) != 0) != hidsys || | 
|---|
|  | 3551 | ((pAD->afindex[y]->attrFile & FILE_READONLY) != 0) != | 
|---|
|  | 3552 | reado) { | 
|---|
|  | 3553 | if (pAD->afindex[y]->attrFile & (FILE_SYSTEM | FILE_HIDDEN)) { | 
|---|
|  | 3554 | GpiSetColor(pAD->hps, | 
|---|
|  | 3555 | standardcolors[Colors[COLORS_SYSTEMFORE]]); | 
|---|
|  | 3556 | hidsys = TRUE; | 
|---|
|  | 3557 | } | 
|---|
|  | 3558 | else if ((pAD->afindex[y]->attrFile & FILE_READONLY) != 0) { | 
|---|
|  | 3559 | GpiSetColor(pAD->hps, | 
|---|
|  | 3560 | standardcolors[Colors[COLORS_READONLYFORE]]); | 
|---|
|  | 3561 | reado = TRUE; | 
|---|
|  | 3562 | } | 
|---|
|  | 3563 | else | 
|---|
|  | 3564 | GpiSetColor(pAD->hps, | 
|---|
|  | 3565 | standardcolors[Colors[COLORS_NORMALFORE]]); | 
|---|
|  | 3566 | GpiSetBackColor(pAD->hps, | 
|---|
|  | 3567 | (wascursored) ? | 
|---|
|  | 3568 | standardcolors[Colors | 
|---|
|  | 3569 | [COLORS_CURSOREDNORMALBACK]] : | 
|---|
|  | 3570 | standardcolors[Colors[COLORS_NORMALBACK]]); | 
|---|
|  | 3571 | inverted = FALSE; | 
|---|
|  | 3572 | } | 
|---|
|  | 3573 | else if (wascursored) | 
|---|
|  | 3574 | GpiSetBackColor(pAD->hps, | 
|---|
|  | 3575 | standardcolors[Colors | 
|---|
|  | 3576 | [COLORS_CURSOREDNORMALBACK]]); | 
|---|
|  | 3577 | CommaFmtULL(szCmmaFmtFileSize, | 
|---|
| [1559] | 3578 | sizeof(szCmmaFmtFileSize), pAD->afindex[y]->cbFile, ' '); | 
|---|
|  | 3579 | FDateFormat(szDate, pAD->afindex[y]->date); | 
|---|
| [1335] | 3580 | len = | 
|---|
|  | 3581 | sprintf(szBuff, | 
|---|
| [1395] | 3582 | "%c%-*.*s  %-12s  %c%c%c%c%c  %s %02u%s%02u%s%02u ", | 
|---|
| [1335] | 3583 | wascursored ? '>' : ' ', | 
|---|
|  | 3584 | pAD->fullnames ? pAD->longestw : pAD->longest, | 
|---|
|  | 3585 | pAD->fullnames ? pAD->longestw : pAD->longest, | 
|---|
|  | 3586 | (pAD->fullnames) ? pAD->afindex[y]->fullname : pAD-> | 
|---|
|  | 3587 | afindex[y]->filename, szCmmaFmtFileSize, | 
|---|
|  | 3588 | "-A"[((pAD->afindex[y]->attrFile & FILE_ARCHIVED) != | 
|---|
|  | 3589 | 0)], | 
|---|
|  | 3590 | "-R"[((pAD->afindex[y]->attrFile & FILE_READONLY) != | 
|---|
|  | 3591 | 0)], | 
|---|
|  | 3592 | "-H"[((pAD->afindex[y]->attrFile & FILE_HIDDEN) != 0)], | 
|---|
|  | 3593 | "-S"[((pAD->afindex[y]->attrFile & FILE_SYSTEM) != 0)], | 
|---|
| [1559] | 3594 | "-D"[((pAD->afindex[y]->attrFile & FILE_DIRECTORY) != 0)], | 
|---|
|  | 3595 | szDate, | 
|---|
| [1395] | 3596 | pAD->afindex[y]->time.hours, TimeSeparator, | 
|---|
|  | 3597 | pAD->afindex[y]->time.minutes, TimeSeparator, | 
|---|
| [1335] | 3598 | pAD->afindex[y]->time.twosecs * 2); | 
|---|
|  | 3599 | GpiCharStringAt(hpsp, &ptl, len, szBuff); | 
|---|
|  | 3600 | GpiQueryCurrentPosition(hpsp, &ptl); | 
|---|
|  | 3601 | if (ptl.x + abs(pAD->horzscroll) > pAD->maxx) { | 
|---|
|  | 3602 | pAD->maxx = ptl.x + abs(pAD->horzscroll); | 
|---|
|  | 3603 | WinSendMsg(pAD->hhscroll, SBM_SETTHUMBSIZE, | 
|---|
|  | 3604 | MPFROM2SHORT((SHORT) Rectl.xRight, | 
|---|
|  | 3605 | (SHORT) pAD->maxx), MPVOID); | 
|---|
|  | 3606 | } | 
|---|
|  | 3607 | } | 
|---|
|  | 3608 | } | 
|---|
|  | 3609 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
| [2] | 3610 | } | 
|---|
| [551] | 3611 | WinEndPaint(hpsp); | 
|---|
|  | 3612 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
|  | 3613 | if (!pAD->stopflag) | 
|---|
| [1335] | 3614 | WinSendMsg(pAD->hvscroll, SBM_SETSCROLLBAR, | 
|---|
|  | 3615 | MPFROMSHORT((SHORT) (pAD->topfile / pAD->multiplier)), | 
|---|
|  | 3616 | MPFROM2SHORT(1, | 
|---|
|  | 3617 | (SHORT) (pAD->afindexcnt / pAD->multiplier) - | 
|---|
|  | 3618 | (numlines - 1))); | 
|---|
| [551] | 3619 | WinSendMsg(pAD->hhscroll, SBM_SETSCROLLBAR, | 
|---|
| [1335] | 3620 | MPFROMSHORT((SHORT) abs(pAD->horzscroll)), | 
|---|
|  | 3621 | MPFROM2SHORT(0, (SHORT) (pAD->maxx - Rectl.xRight))); | 
|---|
| [551] | 3622 | WinSendMsg(pAD->hhscroll, SBM_SETTHUMBSIZE, | 
|---|
| [1335] | 3623 | MPFROM2SHORT((SHORT) Rectl.xRight, (SHORT) pAD->maxx), | 
|---|
|  | 3624 | MPVOID); | 
|---|
| [551] | 3625 | } | 
|---|
|  | 3626 | break; | 
|---|
| [2] | 3627 |  | 
|---|
| [551] | 3628 | case WM_HSCROLL: | 
|---|
|  | 3629 | { | 
|---|
|  | 3630 | RECTL rectl; | 
|---|
|  | 3631 | BOOL invalidate = TRUE; | 
|---|
| [2] | 3632 |  | 
|---|
| [551] | 3633 | WinQueryWindowRect(hwnd, &rectl); | 
|---|
|  | 3634 | switch (SHORT2FROMMP(mp2)) { | 
|---|
|  | 3635 | case SB_PAGERIGHT: | 
|---|
| [1335] | 3636 | if (abs(pAD->horzscroll) < pAD->maxx - rectl.xRight) { | 
|---|
|  | 3637 | pAD->horzscroll -= rectl.xRight; | 
|---|
|  | 3638 | if (abs(pAD->horzscroll) > pAD->maxx - rectl.xRight) | 
|---|
|  | 3639 | pAD->horzscroll = -(pAD->maxx - rectl.xRight); | 
|---|
|  | 3640 | } | 
|---|
|  | 3641 | break; | 
|---|
| [2] | 3642 |  | 
|---|
| [551] | 3643 | case SB_PAGELEFT: | 
|---|
| [1335] | 3644 | if (pAD->horzscroll < 0) { | 
|---|
|  | 3645 | pAD->horzscroll += rectl.xRight; | 
|---|
|  | 3646 | if (pAD->horzscroll > 0) | 
|---|
|  | 3647 | pAD->horzscroll = 0; | 
|---|
|  | 3648 | } | 
|---|
|  | 3649 | break; | 
|---|
| [2] | 3650 |  | 
|---|
| [551] | 3651 | case SB_LINERIGHT: | 
|---|
| [1335] | 3652 | if (abs(pAD->horzscroll) < pAD->maxx - rectl.xRight) | 
|---|
|  | 3653 | pAD->horzscroll -= pAD->fattrs.lAveCharWidth; | 
|---|
|  | 3654 | break; | 
|---|
| [2] | 3655 |  | 
|---|
| [551] | 3656 | case SB_LINELEFT: | 
|---|
| [1335] | 3657 | if (pAD->horzscroll < 0) | 
|---|
|  | 3658 | pAD->horzscroll += pAD->fattrs.lAveCharWidth; | 
|---|
|  | 3659 | break; | 
|---|
| [2] | 3660 |  | 
|---|
| [551] | 3661 | case SB_SLIDERTRACK: | 
|---|
| [1335] | 3662 | pAD->horzscroll = SHORT1FROMMP(mp2); | 
|---|
|  | 3663 | pAD->horzscroll = -(pAD->horzscroll); | 
|---|
|  | 3664 | if (pAD->horzscroll > 0) | 
|---|
|  | 3665 | pAD->horzscroll = 0; | 
|---|
|  | 3666 | if (abs(pAD->horzscroll) > pAD->maxx - rectl.xRight) | 
|---|
|  | 3667 | pAD->horzscroll = -(pAD->maxx - rectl.xRight); | 
|---|
|  | 3668 | break; | 
|---|
| [2] | 3669 |  | 
|---|
| [551] | 3670 | default: | 
|---|
| [1335] | 3671 | invalidate = FALSE; | 
|---|
|  | 3672 | break; | 
|---|
| [2] | 3673 | } | 
|---|
| [551] | 3674 | if (invalidate) | 
|---|
| [1335] | 3675 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| [551] | 3676 | } | 
|---|
|  | 3677 | break; | 
|---|
| [2] | 3678 |  | 
|---|
| [551] | 3679 | case WM_VSCROLL: | 
|---|
| [1559] | 3680 | // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc WM_VSCROLL"); | 
|---|
| [551] | 3681 | if (pAD && !pAD->stopflag && | 
|---|
| [1335] | 3682 | !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) { | 
|---|
| [2] | 3683 |  | 
|---|
| [551] | 3684 | ULONG numlines, wascursored; | 
|---|
|  | 3685 | RECTL rcl; | 
|---|
| [2] | 3686 |  | 
|---|
| [943] | 3687 | if (pAD->afindexcnt) { | 
|---|
| [1335] | 3688 | WinQueryWindowRect(hwnd, &rcl); | 
|---|
|  | 3689 | numlines = NumLines(&rcl, pAD); | 
|---|
|  | 3690 | if (numlines) { | 
|---|
|  | 3691 | wascursored = pAD->cursored; | 
|---|
|  | 3692 | switch (SHORT2FROMMP(mp2)) { | 
|---|
|  | 3693 | case SB_PAGEUP: | 
|---|
|  | 3694 | if (pAD->topfile > 1) { | 
|---|
|  | 3695 | pAD->topfile -= numlines; | 
|---|
|  | 3696 | if (pAD->topfile > pAD->afindexcnt || | 
|---|
|  | 3697 | pAD->topfile > (pAD->afindexcnt + 1) - numlines) | 
|---|
|  | 3698 | pAD->topfile = 1; | 
|---|
|  | 3699 | if (pAD->cursored > pAD->topfile + numlines) | 
|---|
|  | 3700 | pAD->cursored = pAD->topfile + numlines; | 
|---|
|  | 3701 | if (pAD->cursored > pAD->afindexcnt) | 
|---|
|  | 3702 | pAD->cursored = pAD->afindexcnt; | 
|---|
|  | 3703 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
|  | 3704 | } | 
|---|
|  | 3705 | break; | 
|---|
|  | 3706 | case SB_PAGEDOWN: | 
|---|
|  | 3707 | if (pAD->topfile <= pAD->afindexcnt - numlines) { | 
|---|
|  | 3708 | pAD->topfile += numlines; | 
|---|
|  | 3709 | if (pAD->topfile > (pAD->afindexcnt + 1) - numlines) | 
|---|
|  | 3710 | pAD->topfile = (pAD->afindexcnt + 1) - numlines; | 
|---|
|  | 3711 | if (pAD->cursored < pAD->topfile) | 
|---|
|  | 3712 | pAD->cursored = pAD->topfile; | 
|---|
|  | 3713 | if (pAD->cursored > (pAD->topfile + numlines) - 1) | 
|---|
|  | 3714 | pAD->cursored = (pAD->topfile + numlines) - 1; | 
|---|
|  | 3715 | if (pAD->cursored > pAD->afindexcnt) | 
|---|
|  | 3716 | pAD->cursored = pAD->afindexcnt; | 
|---|
|  | 3717 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
|  | 3718 | } | 
|---|
|  | 3719 | break; | 
|---|
|  | 3720 | case SB_LINEDOWN: | 
|---|
|  | 3721 | if (pAD->topfile <= pAD->afindexcnt - numlines) { | 
|---|
| [2] | 3722 |  | 
|---|
| [1335] | 3723 | RECTL Rectl, iRectl; | 
|---|
| [2] | 3724 |  | 
|---|
| [1335] | 3725 | pAD->topfile++; | 
|---|
|  | 3726 | if (pAD->cursored < pAD->topfile) | 
|---|
|  | 3727 | pAD->cursored = pAD->topfile; | 
|---|
|  | 3728 | else if (pAD->cursored > (pAD->topfile + numlines) - 1) | 
|---|
|  | 3729 | pAD->cursored = (pAD->topfile + numlines) - 1; | 
|---|
|  | 3730 | if (pAD->cursored > pAD->afindexcnt) | 
|---|
|  | 3731 | pAD->cursored = pAD->afindexcnt; | 
|---|
|  | 3732 | WinQueryWindowRect(hwnd, &Rectl); | 
|---|
|  | 3733 | WinScrollWindow(hwnd, 0, pAD->lMaxHeight, | 
|---|
|  | 3734 | NULL, NULL, NULLHANDLE, &iRectl, 0); | 
|---|
|  | 3735 | WinFillRect(pAD->hps, &iRectl, | 
|---|
|  | 3736 | standardcolors[Colors[COLORS_NORMALBACK]]); | 
|---|
|  | 3737 | PaintLine(hwnd, pAD->hps, (pAD->topfile + numlines) - 2, | 
|---|
|  | 3738 | pAD->topfile, &Rectl); | 
|---|
|  | 3739 | if (pAD->cursored != pAD->topfile + numlines) | 
|---|
|  | 3740 | PaintLine(hwnd, pAD->hps, pAD->cursored - 1, pAD->topfile, | 
|---|
|  | 3741 | &Rectl); | 
|---|
|  | 3742 | if (wascursored != pAD->cursored | 
|---|
|  | 3743 | && wascursored < pAD->topfile + numlines | 
|---|
|  | 3744 | && wascursored >= pAD->topfile) | 
|---|
|  | 3745 | PaintLine(hwnd, pAD->hps, wascursored - 1, pAD->topfile, | 
|---|
|  | 3746 | &Rectl); | 
|---|
|  | 3747 | if (wascursored != pAD->cursored) | 
|---|
|  | 3748 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
|  | 3749 | WinSendMsg(pAD->hhscroll, SBM_SETSCROLLBAR, | 
|---|
|  | 3750 | MPFROMSHORT((SHORT) abs(pAD->horzscroll)), | 
|---|
|  | 3751 | MPFROM2SHORT(0, (SHORT) (pAD->maxx - Rectl.xRight))); | 
|---|
|  | 3752 | WinSendMsg(pAD->hvscroll, SBM_SETSCROLLBAR, | 
|---|
|  | 3753 | MPFROMSHORT((SHORT) (pAD->topfile / | 
|---|
|  | 3754 | pAD->multiplier)), | 
|---|
|  | 3755 | MPFROM2SHORT(1, (SHORT) (pAD->afindexcnt / | 
|---|
|  | 3756 | pAD->multiplier) - | 
|---|
|  | 3757 | (numlines - 1))); | 
|---|
|  | 3758 | } | 
|---|
|  | 3759 | break; | 
|---|
|  | 3760 | case SB_LINEUP: | 
|---|
|  | 3761 | if (pAD->topfile > 1) { | 
|---|
| [2] | 3762 |  | 
|---|
| [1335] | 3763 | RECTL Rectl, iRectl; | 
|---|
| [2] | 3764 |  | 
|---|
| [1335] | 3765 | pAD->topfile--; | 
|---|
|  | 3766 | if (pAD->cursored < pAD->topfile) | 
|---|
|  | 3767 | pAD->cursored = pAD->topfile; | 
|---|
|  | 3768 | else if (pAD->cursored > (pAD->topfile + numlines) - 1) | 
|---|
|  | 3769 | pAD->cursored = (pAD->topfile + numlines) - 1; | 
|---|
|  | 3770 | if (pAD->cursored > pAD->afindexcnt) | 
|---|
|  | 3771 | pAD->cursored = pAD->afindexcnt; | 
|---|
|  | 3772 | WinQueryWindowRect(hwnd, &Rectl); | 
|---|
|  | 3773 | WinScrollWindow(hwnd, 0, -pAD->lMaxHeight, | 
|---|
|  | 3774 | NULL, NULL, NULLHANDLE, &iRectl, 0); | 
|---|
|  | 3775 | WinFillRect(pAD->hps, &iRectl, | 
|---|
|  | 3776 | standardcolors[Colors[COLORS_NORMALBACK]]); | 
|---|
|  | 3777 | iRectl = Rectl; | 
|---|
|  | 3778 | iRectl.yTop -= ((numlines * pAD->lMaxHeight) + | 
|---|
|  | 3779 | pAD->lMaxDescender); | 
|---|
|  | 3780 | WinFillRect(pAD->hps, &iRectl, | 
|---|
|  | 3781 | standardcolors[pAD->aulColors[COLORS_NORMALBACK]]); | 
|---|
|  | 3782 | PaintLine(hwnd, pAD->hps, pAD->topfile - 1, pAD->topfile, | 
|---|
|  | 3783 | &Rectl); | 
|---|
|  | 3784 | if (pAD->cursored != pAD->topfile) | 
|---|
|  | 3785 | PaintLine(hwnd, pAD->hps, pAD->cursored - 1, pAD->topfile, | 
|---|
|  | 3786 | &Rectl); | 
|---|
|  | 3787 | if (pAD->cursored != wascursored && wascursored >= pAD->topfile | 
|---|
|  | 3788 | && wascursored < pAD->topfile + numlines) | 
|---|
|  | 3789 | PaintLine(hwnd, pAD->hps, wascursored - 1, pAD->topfile, | 
|---|
|  | 3790 | &Rectl); | 
|---|
|  | 3791 | if (pAD->cursored != wascursored) | 
|---|
|  | 3792 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
|  | 3793 | WinSendMsg(pAD->hhscroll, SBM_SETSCROLLBAR, | 
|---|
|  | 3794 | MPFROMSHORT((SHORT) abs(pAD->horzscroll)), | 
|---|
|  | 3795 | MPFROM2SHORT(0, (SHORT) (pAD->maxx - Rectl.xRight))); | 
|---|
|  | 3796 | WinSendMsg(pAD->hvscroll, SBM_SETSCROLLBAR, | 
|---|
|  | 3797 | MPFROMSHORT((SHORT) (pAD->topfile / | 
|---|
|  | 3798 | pAD->multiplier)), | 
|---|
|  | 3799 | MPFROM2SHORT(1, (SHORT) (pAD->afindexcnt / | 
|---|
|  | 3800 | pAD->multiplier) - | 
|---|
|  | 3801 | (numlines - 1))); | 
|---|
|  | 3802 | } | 
|---|
|  | 3803 | break; | 
|---|
|  | 3804 | case SB_SLIDERTRACK: | 
|---|
|  | 3805 | if ((SHORT1FROMMP(mp2) >= 1) || | 
|---|
|  | 3806 | (SHORT1FROMMP(mp2)) <= pAD->afindexcnt) { | 
|---|
|  | 3807 | pAD->topfile = (ULONG) SHORT1FROMMP(mp2) * pAD->multiplier; | 
|---|
|  | 3808 | if (pAD->topfile > (pAD->afindexcnt + 1) - numlines) | 
|---|
|  | 3809 | pAD->topfile = (pAD->afindexcnt + 1) - numlines; | 
|---|
|  | 3810 | if (!pAD->topfile) | 
|---|
|  | 3811 | pAD->topfile = 1; | 
|---|
|  | 3812 | if (pAD->cursored < pAD->topfile) | 
|---|
|  | 3813 | pAD->cursored = pAD->topfile; | 
|---|
|  | 3814 | else if (pAD->cursored > pAD->topfile + numlines) | 
|---|
|  | 3815 | pAD->cursored = pAD->topfile + numlines; | 
|---|
|  | 3816 | if (pAD->cursored > pAD->afindexcnt) | 
|---|
|  | 3817 | pAD->cursored = pAD->afindexcnt; | 
|---|
|  | 3818 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
|  | 3819 | } | 
|---|
|  | 3820 | else | 
|---|
|  | 3821 | WinAlarm(HWND_DESKTOP, WA_NOTE); | 
|---|
|  | 3822 | break; | 
|---|
|  | 3823 | } | 
|---|
|  | 3824 | } | 
|---|
| [2] | 3825 | } | 
|---|
| [551] | 3826 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
|  | 3827 | } | 
|---|
|  | 3828 | break; | 
|---|
| [2] | 3829 |  | 
|---|
| [551] | 3830 | case WM_INITMENU: | 
|---|
|  | 3831 | if (pAD) { | 
|---|
|  | 3832 | switch (SHORT1FROMMP(mp1)) { | 
|---|
|  | 3833 | case IDM_FILESMENU: | 
|---|
| [1335] | 3834 | { | 
|---|
|  | 3835 | APIRET rc; | 
|---|
| [2] | 3836 |  | 
|---|
| [1335] | 3837 | rc = DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN); | 
|---|
|  | 3838 | WinEnableMenuItem((HWND) mp2, IDM_DUPES, (rc == 0)); | 
|---|
|  | 3839 | WinEnableMenuItem((HWND) mp2, IDM_COLLECT, (rc == 0 && | 
|---|
|  | 3840 | pAD->selected != 0)); | 
|---|
|  | 3841 | WinEnableMenuItem((HWND) mp2, IDM_SAVETOCLIP, (rc == 0 && | 
|---|
|  | 3842 | pAD->selected != 0)); | 
|---|
|  | 3843 | WinEnableMenuItem((HWND) mp2, IDM_SAVETOCLIPFILENAME, | 
|---|
|  | 3844 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3845 | WinEnableMenuItem((HWND) mp2, IDM_APPENDTOCLIP, | 
|---|
|  | 3846 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3847 | WinEnableMenuItem((HWND) mp2, IDM_APPENDTOCLIPFILENAME, | 
|---|
|  | 3848 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3849 | WinEnableMenuItem((HWND) mp2, IDM_SAVETOLIST, | 
|---|
|  | 3850 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3851 | WinEnableMenuItem((HWND) mp2, IDM_REMOVE, | 
|---|
|  | 3852 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3853 | WinEnableMenuItem((HWND) mp2, IDM_HIDEALL, | 
|---|
|  | 3854 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3855 | WinEnableMenuItem((HWND) mp2, IDM_DELETESUBMENU, | 
|---|
|  | 3856 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3857 | WinEnableMenuItem((HWND) mp2, IDM_INFO, | 
|---|
|  | 3858 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3859 | WinEnableMenuItem((HWND) mp2, IDM_ATTRS, | 
|---|
|  | 3860 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3861 | WinEnableMenuItem((HWND) mp2, IDM_EAS, | 
|---|
|  | 3862 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3863 | WinEnableMenuItem((HWND) mp2, IDM_UUDECODE, | 
|---|
|  | 3864 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3865 | WinEnableMenuItem((HWND) mp2, IDM_EXTRACT, | 
|---|
|  | 3866 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3867 | WinEnableMenuItem((HWND) mp2, IDM_ARCHIVE, | 
|---|
|  | 3868 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3869 | WinEnableMenuItem((HWND) mp2, IDM_MOVEMENU, | 
|---|
|  | 3870 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3871 | WinEnableMenuItem((HWND) mp2, IDM_COPYMENU, | 
|---|
|  | 3872 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3873 | WinEnableMenuItem((HWND) mp2, IDM_RENAME, | 
|---|
|  | 3874 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3875 | WinEnableMenuItem((HWND) mp2, IDM_PRINT, | 
|---|
|  | 3876 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3877 | WinEnableMenuItem((HWND) mp2, IDM_SUBJECT, | 
|---|
|  | 3878 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3879 | WinEnableMenuItem((HWND) mp2, IDM_OPENSUBMENU, | 
|---|
|  | 3880 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3881 | WinEnableMenuItem((HWND) mp2, IDM_OBJECTSUBMENU, | 
|---|
|  | 3882 | (rc == 0 && pAD->selected != 0)); | 
|---|
|  | 3883 | if (!rc) | 
|---|
|  | 3884 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
|  | 3885 | } | 
|---|
|  | 3886 | break; | 
|---|
| [2] | 3887 |  | 
|---|
| [551] | 3888 | case IDM_SELECTSUBMENU: | 
|---|
| [1335] | 3889 | { | 
|---|
|  | 3890 | APIRET rc; | 
|---|
| [2] | 3891 |  | 
|---|
| [1335] | 3892 | rc = DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN); | 
|---|
|  | 3893 | WinEnableMenuItem((HWND) mp2, IDM_SELECTALL, (rc == 0 && | 
|---|
|  | 3894 | pAD->afindexcnt != 0 && | 
|---|
|  | 3895 | (pAD->afindexcnt != | 
|---|
|  | 3896 | pAD->selected || | 
|---|
|  | 3897 | !pAD->selected))); | 
|---|
|  | 3898 | WinEnableMenuItem((HWND) mp2, IDM_SELECTMASK, (rc == 0 && | 
|---|
|  | 3899 | pAD->afindexcnt != 0 && | 
|---|
|  | 3900 | (pAD->afindexcnt != | 
|---|
|  | 3901 | pAD->selected || | 
|---|
|  | 3902 | !pAD->selected))); | 
|---|
|  | 3903 | WinEnableMenuItem((HWND) mp2, IDM_DESELECTALL, (rc == 0 && | 
|---|
|  | 3904 | pAD->afindexcnt != 0 | 
|---|
|  | 3905 | && pAD->selected)); | 
|---|
|  | 3906 | WinEnableMenuItem((HWND) mp2, IDM_DESELECTMASK, | 
|---|
|  | 3907 | (rc == 0 && pAD->afindexcnt != 0) && pAD->selected); | 
|---|
|  | 3908 | WinEnableMenuItem((HWND) mp2, IDM_INVERT, | 
|---|
|  | 3909 | (rc == 0 && pAD->afindexcnt != 0)); | 
|---|
|  | 3910 | if (!rc) | 
|---|
|  | 3911 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
|  | 3912 | } | 
|---|
|  | 3913 | break; | 
|---|
| [2] | 3914 |  | 
|---|
| [551] | 3915 | case IDM_SORTSUBMENU: | 
|---|
| [1335] | 3916 | { | 
|---|
|  | 3917 | APIRET rc; | 
|---|
| [2] | 3918 |  | 
|---|
| [1335] | 3919 | rc = DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN); | 
|---|
|  | 3920 | WinEnableMenuItem((HWND) mp2, IDM_SORTNAME, (rc == 0)); | 
|---|
|  | 3921 | WinEnableMenuItem((HWND) mp2, IDM_SORTEASIZE, (rc == 0)); | 
|---|
|  | 3922 | WinEnableMenuItem((HWND) mp2, IDM_SORTSIZE, (rc == 0)); | 
|---|
|  | 3923 | WinEnableMenuItem((HWND) mp2, IDM_SORTLWDATE, (rc == 0)); | 
|---|
|  | 3924 | WinEnableMenuItem((HWND) mp2, IDM_SORTFILENAME, (rc == 0)); | 
|---|
|  | 3925 | WinEnableMenuItem((HWND) mp2, IDM_SORTFIRST, (rc == 0)); | 
|---|
|  | 3926 | if (!rc) | 
|---|
|  | 3927 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
|  | 3928 | } | 
|---|
|  | 3929 | WinCheckMenuItem((HWND) mp2, IDM_SORTNAME, | 
|---|
|  | 3930 | (pAD->pfnCompare == comparefullnames)); | 
|---|
|  | 3931 | WinCheckMenuItem((HWND) mp2, IDM_SORTEASIZE, | 
|---|
|  | 3932 | (pAD->pfnCompare == (PFNSORT) NULL)); | 
|---|
|  | 3933 | WinCheckMenuItem((HWND) mp2, IDM_SORTSIZE, | 
|---|
|  | 3934 | (pAD->pfnCompare == comparesizes)); | 
|---|
|  | 3935 | WinCheckMenuItem((HWND) mp2, IDM_SORTLWDATE, | 
|---|
|  | 3936 | (pAD->pfnCompare == comparedates)); | 
|---|
|  | 3937 | WinCheckMenuItem((HWND) mp2, IDM_SORTFILENAME, | 
|---|
|  | 3938 | (pAD->pfnCompare == comparenames)); | 
|---|
|  | 3939 | WinCheckMenuItem((HWND) mp2, IDM_SORTREVERSE, pAD->invertsort); | 
|---|
|  | 3940 | WinCheckMenuItem((HWND) mp2, IDM_SORTFIRST, | 
|---|
|  | 3941 | (pAD->pfnCompare == compareexts)); | 
|---|
|  | 3942 | break; | 
|---|
| [2] | 3943 |  | 
|---|
| [551] | 3944 | case IDM_VIEWSMENU: | 
|---|
| [1335] | 3945 | { | 
|---|
|  | 3946 | APIRET rc; | 
|---|
| [2] | 3947 |  | 
|---|
| [1335] | 3948 | rc = DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN); | 
|---|
|  | 3949 | WinEnableMenuItem((HWND) mp2, IDM_RESCAN, (rc == 0)); | 
|---|
|  | 3950 | WinEnableMenuItem((HWND) mp2, IDM_FILTER, (rc == 0 && | 
|---|
|  | 3951 | pAD->afheadcnt != 0)); | 
|---|
|  | 3952 | if (!rc) | 
|---|
|  | 3953 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
|  | 3954 | } | 
|---|
|  | 3955 | WinCheckMenuItem((HWND) mp2, IDM_SHOWLNAMES, pAD->fullnames); | 
|---|
|  | 3956 | break; | 
|---|
| [2] | 3957 | } | 
|---|
| [551] | 3958 | } | 
|---|
|  | 3959 | break; | 
|---|
|  | 3960 |  | 
|---|
|  | 3961 | case WM_COMMAND: | 
|---|
| [783] | 3962 | if (!pAD) { | 
|---|
| [1398] | 3963 | Runtime_Error(pszSrcFile, __LINE__, NULL); | 
|---|
| [551] | 3964 | return 0; | 
|---|
| [783] | 3965 | } | 
|---|
| [551] | 3966 | switch (SHORT1FROMMP(mp1)) { | 
|---|
|  | 3967 | case IDM_SETTARGET: | 
|---|
|  | 3968 | SetTargetDir(hwnd, FALSE); | 
|---|
| [2] | 3969 | break; | 
|---|
|  | 3970 |  | 
|---|
| [551] | 3971 | case IDM_DUPES: | 
|---|
|  | 3972 | if (!pAD->stopflag && | 
|---|
| [1335] | 3973 | !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) { | 
|---|
|  | 3974 | pAD->dupeflags = (USHORT) WinDlgBox(HWND_DESKTOP, | 
|---|
|  | 3975 | hwnd, | 
|---|
|  | 3976 | DupeDlgProc, | 
|---|
|  | 3977 | FM3ModHandle, | 
|---|
|  | 3978 | DUPE_FRAME, | 
|---|
|  | 3979 | MPFROM2SHORT(pAD->dupeflags, 0)); | 
|---|
|  | 3980 | if (pAD->dupeflags) { | 
|---|
|  | 3981 | xbeginthread(FindDupesThread, | 
|---|
|  | 3982 | 65536, | 
|---|
|  | 3983 | (PVOID)hwnd, | 
|---|
|  | 3984 | pszSrcFile, | 
|---|
|  | 3985 | __LINE__); | 
|---|
|  | 3986 | } | 
|---|
|  | 3987 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
| [551] | 3988 | } | 
|---|
|  | 3989 | break; | 
|---|
| [2] | 3990 |  | 
|---|
| [551] | 3991 | case IDM_COLORPALETTE: | 
|---|
|  | 3992 | { | 
|---|
| [1335] | 3993 | COLORS co; | 
|---|
|  | 3994 | LONG temp[COLORS_MAX]; | 
|---|
| [2] | 3995 |  | 
|---|
| [1335] | 3996 | memset(&co, 0, sizeof(co)); | 
|---|
|  | 3997 | co.size = sizeof(co); | 
|---|
|  | 3998 | co.numcolors = COLORS_MAX; | 
|---|
|  | 3999 | co.colors = pAD->aulColors; | 
|---|
|  | 4000 | co.descriptions = IDS_SACOLORS1TEXT; | 
|---|
|  | 4001 | co.origs = temp; | 
|---|
|  | 4002 | co.prompt = IDS_SACOLORSPROMPTTEXT; | 
|---|
|  | 4003 | memcpy(temp, pAD->aulColors, sizeof(LONG) * COLORS_MAX); | 
|---|
|  | 4004 | if (WinDlgBox(HWND_DESKTOP, | 
|---|
|  | 4005 | hwnd, | 
|---|
|  | 4006 | ColorDlgProc, | 
|---|
|  | 4007 | FM3ModHandle, COLOR_FRAME, (PVOID) & co)) { | 
|---|
|  | 4008 | memcpy(Colors, pAD->aulColors, sizeof(LONG) * COLORS_MAX); | 
|---|
|  | 4009 | PrfWriteProfileData(fmprof, | 
|---|
|  | 4010 | appname, | 
|---|
|  | 4011 | "Seeall.Colors", | 
|---|
|  | 4012 | &pAD->aulColors, sizeof(LONG) * COLORS_MAX); | 
|---|
|  | 4013 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
|  | 4014 | } | 
|---|
| [551] | 4015 | } | 
|---|
|  | 4016 | break; | 
|---|
| [2] | 4017 |  | 
|---|
| [551] | 4018 | case IDM_CODEPAGE: | 
|---|
|  | 4019 | { | 
|---|
| [1335] | 4020 | INT cp; | 
|---|
| [2] | 4021 |  | 
|---|
| [1335] | 4022 | cp = PickCodepage(hwnd); | 
|---|
|  | 4023 | if (cp != -1) { | 
|---|
|  | 4024 | pAD->fattrs.usCodePage = (USHORT) cp; | 
|---|
|  | 4025 | Codepage = pAD->fattrs.usCodePage; | 
|---|
|  | 4026 | PrfWriteProfileData(fmprof, | 
|---|
|  | 4027 | appname, | 
|---|
|  | 4028 | "Seeall.Codepage", | 
|---|
|  | 4029 | &pAD->fattrs.usCodePage, sizeof(USHORT)); | 
|---|
| [1433] | 4030 | GpiDeleteSetId(pAD->hps, SEEALLFILECNR_FONT_LCID); | 
|---|
| [1335] | 4031 | GpiAssociate(pAD->hps, 0); | 
|---|
|  | 4032 | GpiDestroyPS(pAD->hps); | 
|---|
|  | 4033 | pAD->hps = InitWindow(hwnd); | 
|---|
|  | 4034 | pAD->maxx = pAD->horzscroll = 0; | 
|---|
|  | 4035 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
|  | 4036 | } | 
|---|
| [551] | 4037 | } | 
|---|
|  | 4038 | break; | 
|---|
| [2] | 4039 |  | 
|---|
| [551] | 4040 | case IDM_FONTPALETTE: | 
|---|
| [1391] | 4041 | SetMLEFont(hwnd, &pAD->fattrs, 3); | 
|---|
| [551] | 4042 | PrfWriteProfileData(fmprof, | 
|---|
| [1335] | 4043 | appname, | 
|---|
|  | 4044 | "Seeall.Fattrs", &pAD->fattrs, sizeof(pAD->fattrs)); | 
|---|
| [551] | 4045 | Fattrs = pAD->fattrs; | 
|---|
| [1433] | 4046 | GpiDeleteSetId(pAD->hps, SEEALLFILECNR_FONT_LCID); | 
|---|
| [551] | 4047 | GpiAssociate(pAD->hps, 0); | 
|---|
|  | 4048 | GpiDestroyPS(pAD->hps); | 
|---|
|  | 4049 | pAD->hps = InitWindow(hwnd); | 
|---|
|  | 4050 | pAD->maxx = pAD->horzscroll = 0; | 
|---|
|  | 4051 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
|  | 4052 | break; | 
|---|
|  | 4053 |  | 
|---|
|  | 4054 | case IDM_SHOWLNAMES: | 
|---|
|  | 4055 | pAD->fullnames = (pAD->fullnames) ? FALSE : TRUE; | 
|---|
|  | 4056 | PrfWriteProfileData(fmprof, | 
|---|
| [1335] | 4057 | appname, | 
|---|
|  | 4058 | "Seeall.Fullnames", &pAD->fullnames, sizeof(BOOL)); | 
|---|
| [551] | 4059 | Fullnames = pAD->fullnames; | 
|---|
|  | 4060 | pAD->maxx = pAD->horzscroll = 0; | 
|---|
|  | 4061 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
|  | 4062 | break; | 
|---|
|  | 4063 |  | 
|---|
|  | 4064 | case IDM_SORTREVERSE: | 
|---|
|  | 4065 | pAD->invertsort = (pAD->invertsort) ? FALSE : TRUE; | 
|---|
|  | 4066 | SortReverse = pAD->invertsort; | 
|---|
|  | 4067 | PrfWriteProfileData(fmprof, | 
|---|
| [1335] | 4068 | appname, | 
|---|
|  | 4069 | "Seeall.SortReverse", | 
|---|
|  | 4070 | (PVOID) & pAD->invertsort, sizeof(BOOL)); | 
|---|
| [551] | 4071 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
|  | 4072 | break; | 
|---|
|  | 4073 |  | 
|---|
|  | 4074 | case IDM_SORTEASIZE: | 
|---|
|  | 4075 | case IDM_SORTNAME: | 
|---|
|  | 4076 | case IDM_SORTFILENAME: | 
|---|
|  | 4077 | case IDM_SORTSIZE: | 
|---|
|  | 4078 | case IDM_SORTLWDATE: | 
|---|
|  | 4079 | case IDM_SORTFIRST: | 
|---|
|  | 4080 | if (!pAD->stopflag && | 
|---|
| [1335] | 4081 | !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) { | 
|---|
|  | 4082 | { | 
|---|
|  | 4083 | USHORT dummy = SHORT1FROMMP(mp1); | 
|---|
| [551] | 4084 |  | 
|---|
| [1335] | 4085 | PrfWriteProfileData(fmprof, | 
|---|
|  | 4086 | appname, | 
|---|
|  | 4087 | "Seeall.Sort", (PVOID) & dummy, sizeof(USHORT)); | 
|---|
|  | 4088 | SortType = SHORT1FROMMP(mp1); | 
|---|
|  | 4089 | } | 
|---|
|  | 4090 | WinSetPointer(HWND_DESKTOP, hptrBusy); | 
|---|
|  | 4091 | WinSendMsg(hwnd, UM_RESCAN, MPFROMLONG(1), MPVOID); | 
|---|
|  | 4092 | switch (SHORT1FROMMP(mp1)) { | 
|---|
|  | 4093 | case IDM_SORTEASIZE: | 
|---|
|  | 4094 | pAD->pfnCompare = (PFNSORT) NULL; | 
|---|
|  | 4095 | ReSort(hwnd); | 
|---|
|  | 4096 | break; | 
|---|
| [2] | 4097 |  | 
|---|
| [1335] | 4098 | case IDM_SORTNAME: | 
|---|
|  | 4099 | pAD->pfnCompare = comparefullnames; | 
|---|
|  | 4100 | ReSort(hwnd); | 
|---|
|  | 4101 | break; | 
|---|
| [2] | 4102 |  | 
|---|
| [1335] | 4103 | case IDM_SORTFILENAME: | 
|---|
|  | 4104 | pAD->pfnCompare = comparenames; | 
|---|
|  | 4105 | ReSort(hwnd); | 
|---|
|  | 4106 | break; | 
|---|
| [551] | 4107 |  | 
|---|
| [1335] | 4108 | case IDM_SORTSIZE: | 
|---|
|  | 4109 | pAD->pfnCompare = comparesizes; | 
|---|
|  | 4110 | ReSort(hwnd); | 
|---|
|  | 4111 | break; | 
|---|
| [551] | 4112 |  | 
|---|
| [1335] | 4113 | case IDM_SORTLWDATE: | 
|---|
|  | 4114 | pAD->pfnCompare = comparedates; | 
|---|
|  | 4115 | ReSort(hwnd); | 
|---|
|  | 4116 | break; | 
|---|
| [551] | 4117 |  | 
|---|
| [1335] | 4118 | case IDM_SORTFIRST: | 
|---|
|  | 4119 | pAD->pfnCompare = compareexts; | 
|---|
|  | 4120 | ReSort(hwnd); | 
|---|
|  | 4121 | break; | 
|---|
|  | 4122 | } | 
|---|
|  | 4123 | WinSetPointer(HWND_DESKTOP, hptrArrow); | 
|---|
|  | 4124 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
|  | 4125 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
| [551] | 4126 | } | 
|---|
|  | 4127 | break; | 
|---|
| [2] | 4128 |  | 
|---|
| [551] | 4129 | case IDM_FILTER: | 
|---|
|  | 4130 | if (!pAD->stopflag && | 
|---|
| [1335] | 4131 | !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) { | 
|---|
|  | 4132 | FilterList(hwnd); | 
|---|
|  | 4133 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
| [551] | 4134 | } | 
|---|
|  | 4135 | break; | 
|---|
| [2] | 4136 |  | 
|---|
| [551] | 4137 | case IDM_RESCAN: | 
|---|
|  | 4138 | if (!pAD->stopflag && | 
|---|
| [1335] | 4139 | !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) { | 
|---|
| [2] | 4140 |  | 
|---|
| [1335] | 4141 | CHAR tempflags[26]; | 
|---|
| [2] | 4142 |  | 
|---|
| [1335] | 4143 | memcpy(tempflags, pAD->abDrvFlags, sizeof(tempflags)); | 
|---|
|  | 4144 | if (!WinDlgBox(HWND_DESKTOP, hwnd, AFDrvsWndProc, FM3ModHandle, | 
|---|
|  | 4145 | DRVS_FRAME, (PVOID) pAD)) { | 
|---|
|  | 4146 | memcpy(pAD->abDrvFlags, tempflags, sizeof(tempflags)); | 
|---|
|  | 4147 | *pAD->szFindPath = 0; | 
|---|
|  | 4148 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
|  | 4149 | break; | 
|---|
|  | 4150 | } | 
|---|
|  | 4151 | WinSendMsg(pAD->hhscroll, SBM_SETTHUMBSIZE, MPFROM2SHORT(1, 1), | 
|---|
|  | 4152 | MPVOID); | 
|---|
|  | 4153 | WinSendMsg(pAD->hvscroll, SBM_SETTHUMBSIZE, MPFROM2SHORT(1, 1), | 
|---|
|  | 4154 | MPVOID); | 
|---|
|  | 4155 | pAD->topfile = 1; | 
|---|
|  | 4156 | pAD->cursored = 1; | 
|---|
|  | 4157 | pAD->selected = 0; | 
|---|
|  | 4158 | pAD->ullSelectedBytes = 0; | 
|---|
|  | 4159 | pAD->maxx = pAD->horzscroll = 0; | 
|---|
|  | 4160 | FreeAllFilesList(hwnd); | 
|---|
|  | 4161 | pAD->stopflag = 0; | 
|---|
|  | 4162 | if (xbeginthread(FindAllThread, | 
|---|
|  | 4163 | 524288, | 
|---|
|  | 4164 | (PVOID)hwnd, | 
|---|
|  | 4165 | pszSrcFile, | 
|---|
|  | 4166 | __LINE__) == -1) | 
|---|
|  | 4167 | { | 
|---|
|  | 4168 | WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT)); | 
|---|
|  | 4169 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
|  | 4170 | } | 
|---|
|  | 4171 | else { | 
|---|
|  | 4172 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
|  | 4173 | DosSleep(50);//05 Aug 07 GKY 100 | 
|---|
|  | 4174 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
|  | 4175 | PostMsg(hwnd, UM_SETUP2, MPVOID, MPVOID); | 
|---|
|  | 4176 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); | 
|---|
|  | 4177 | } | 
|---|
| [551] | 4178 | } | 
|---|
|  | 4179 | break; | 
|---|
| [958] | 4180 | case IDM_UNHIDEALL: | 
|---|
|  | 4181 | { | 
|---|
|  | 4182 | ALLDATA *ad = WinQueryWindowPtr(hwnd, QWL_USER); | 
|---|
|  | 4183 | FilterAll(hwnd, ad); | 
|---|
|  | 4184 | } | 
|---|
|  | 4185 | break; | 
|---|
| [2] | 4186 |  | 
|---|
| [551] | 4187 | case IDM_DELETE: | 
|---|
|  | 4188 | case IDM_PERMDELETE: | 
|---|
|  | 4189 | case IDM_SELECTALL: | 
|---|
|  | 4190 | case IDM_DESELECTALL: | 
|---|
|  | 4191 | case IDM_INVERT: | 
|---|
|  | 4192 | case IDM_SELECTMASK: | 
|---|
|  | 4193 | case IDM_DESELECTMASK: | 
|---|
|  | 4194 | case IDM_REMOVE: | 
|---|
|  | 4195 | case IDM_HIDEALL: | 
|---|
|  | 4196 | case IDM_COLLECT: | 
|---|
|  | 4197 | case IDM_COLLECTOR: | 
|---|
|  | 4198 | case IDM_SAVETOCLIP: | 
|---|
| [1084] | 4199 | case IDM_SAVETOCLIPFILENAME: | 
|---|
| [551] | 4200 | case IDM_APPENDTOCLIP: | 
|---|
| [1084] | 4201 | case IDM_APPENDTOCLIPFILENAME: | 
|---|
| [551] | 4202 | case IDM_SAVETOLIST: | 
|---|
|  | 4203 | case IDM_INFO: | 
|---|
|  | 4204 | case IDM_ATTRS: | 
|---|
|  | 4205 | case IDM_MOVE: | 
|---|
|  | 4206 | case IDM_COPY: | 
|---|
|  | 4207 | case IDM_RENAME: | 
|---|
|  | 4208 | case IDM_MOVEPRESERVE: | 
|---|
|  | 4209 | case IDM_COPYPRESERVE: | 
|---|
|  | 4210 | case IDM_WILDMOVE: | 
|---|
|  | 4211 | case IDM_WILDCOPY: | 
|---|
|  | 4212 | case IDM_SUBJECT: | 
|---|
|  | 4213 | case IDM_EAS: | 
|---|
|  | 4214 | case IDM_PRINT: | 
|---|
|  | 4215 | case IDM_ARCHIVE: | 
|---|
|  | 4216 | case IDM_EXTRACT: | 
|---|
|  | 4217 | case IDM_UUDECODE: | 
|---|
|  | 4218 | case IDM_SHADOW: | 
|---|
|  | 4219 | case IDM_OBJECT: | 
|---|
|  | 4220 | case IDM_OPENSETTINGS: | 
|---|
|  | 4221 | case IDM_OPENDEFAULT: | 
|---|
|  | 4222 | if (!pAD->stopflag && | 
|---|
| [1335] | 4223 | !DosRequestMutexSem(pAD->hmtxScan, SEM_IMMEDIATE_RETURN)) { | 
|---|
|  | 4224 | switch (SHORT1FROMMP(mp1)) { | 
|---|
|  | 4225 | case IDM_SELECTALL: | 
|---|
|  | 4226 | case IDM_DESELECTALL: | 
|---|
|  | 4227 | case IDM_INVERT: | 
|---|
|  | 4228 | case IDM_HIDEALL: | 
|---|
|  | 4229 | case IDM_REMOVE: | 
|---|
|  | 4230 | Mark(hwnd, (SHORT1FROMMP(mp1) == IDM_DESELECTALL) ? | 
|---|
|  | 4231 | AFM_UNMARK : (SHORT1FROMMP(mp1) == IDM_INVERT) ? | 
|---|
|  | 4232 | AFM_INVERT : (SHORT1FROMMP(mp1) == IDM_HIDEALL) ? | 
|---|
|  | 4233 | AFM_FILTER : (SHORT1FROMMP(mp1) == IDM_REMOVE) ? | 
|---|
|  | 4234 | AFM_MARKDELETED : 0, NULL); | 
|---|
|  | 4235 | if (SHORT1FROMMP(mp1) == IDM_REMOVE || | 
|---|
|  | 4236 | SHORT1FROMMP(mp1) == IDM_HIDEALL) { | 
|---|
|  | 4237 | if (SHORT1FROMMP(mp1) == IDM_REMOVE) | 
|---|
|  | 4238 | RemoveDeleted(hwnd); | 
|---|
|  | 4239 | else | 
|---|
|  | 4240 | ReSort(hwnd); | 
|---|
|  | 4241 | } | 
|---|
|  | 4242 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
|  | 4243 | break; | 
|---|
| [2] | 4244 |  | 
|---|
| [1335] | 4245 | case IDM_SELECTMASK: | 
|---|
|  | 4246 | case IDM_DESELECTMASK: | 
|---|
|  | 4247 | SelectMask(hwnd, (SHORT1FROMMP(mp1) == IDM_DESELECTMASK)); | 
|---|
|  | 4248 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
|  | 4249 | break; | 
|---|
| [2] | 4250 |  | 
|---|
| [1335] | 4251 | case IDM_DELETE: | 
|---|
|  | 4252 | case IDM_PERMDELETE: | 
|---|
|  | 4253 | case IDM_APPENDTOCLIP: | 
|---|
|  | 4254 | case IDM_APPENDTOCLIPFILENAME: | 
|---|
|  | 4255 | case IDM_SAVETOCLIP: | 
|---|
|  | 4256 | case IDM_SAVETOCLIPFILENAME: | 
|---|
|  | 4257 | case IDM_SAVETOLIST: | 
|---|
|  | 4258 | case IDM_COLLECT: | 
|---|
|  | 4259 | case IDM_INFO: | 
|---|
|  | 4260 | case IDM_ATTRS: | 
|---|
|  | 4261 | case IDM_MOVE: | 
|---|
|  | 4262 | case IDM_COPY: | 
|---|
|  | 4263 | case IDM_RENAME: | 
|---|
|  | 4264 | case IDM_MOVEPRESERVE: | 
|---|
|  | 4265 | case IDM_COPYPRESERVE: | 
|---|
|  | 4266 | case IDM_WILDMOVE: | 
|---|
|  | 4267 | case IDM_WILDCOPY: | 
|---|
|  | 4268 | case IDM_SUBJECT: | 
|---|
|  | 4269 | case IDM_PRINT: | 
|---|
|  | 4270 | case IDM_EAS: | 
|---|
|  | 4271 | case IDM_ARCHIVE: | 
|---|
|  | 4272 | case IDM_EXTRACT: | 
|---|
|  | 4273 | case IDM_SHADOW: | 
|---|
|  | 4274 | case IDM_OBJECT: | 
|---|
|  | 4275 | case IDM_OPENSETTINGS: | 
|---|
|  | 4276 | case IDM_OPENDEFAULT: | 
|---|
|  | 4277 | case IDM_UUDECODE: | 
|---|
|  | 4278 | { | 
|---|
|  | 4279 | CHAR **list = BuildAList(hwnd); | 
|---|
| [2] | 4280 |  | 
|---|
| [1335] | 4281 | if (!list) | 
|---|
| [1398] | 4282 | Runtime_Error(pszSrcFile, __LINE__, NULL); | 
|---|
| [1335] | 4283 | else { | 
|---|
|  | 4284 | switch (SHORT1FROMMP(mp1)) { | 
|---|
|  | 4285 | case IDM_COLLECT: | 
|---|
|  | 4286 | CollectList(hwnd, list); | 
|---|
|  | 4287 | break; | 
|---|
|  | 4288 | case IDM_DELETE: | 
|---|
|  | 4289 | case IDM_PERMDELETE: | 
|---|
|  | 4290 | case IDM_APPENDTOCLIP: | 
|---|
|  | 4291 | case IDM_APPENDTOCLIPFILENAME: | 
|---|
|  | 4292 | case IDM_SAVETOCLIP: | 
|---|
|  | 4293 | case IDM_SAVETOCLIPFILENAME: | 
|---|
|  | 4294 | case IDM_SAVETOLIST: | 
|---|
|  | 4295 | case IDM_INFO: | 
|---|
|  | 4296 | case IDM_ATTRS: | 
|---|
|  | 4297 | case IDM_MOVE: | 
|---|
|  | 4298 | case IDM_COPY: | 
|---|
|  | 4299 | case IDM_RENAME: | 
|---|
|  | 4300 | case IDM_MOVEPRESERVE: | 
|---|
|  | 4301 | case IDM_COPYPRESERVE: | 
|---|
|  | 4302 | case IDM_WILDMOVE: | 
|---|
|  | 4303 | case IDM_WILDCOPY: | 
|---|
|  | 4304 | case IDM_SUBJECT: | 
|---|
|  | 4305 | case IDM_PRINT: | 
|---|
|  | 4306 | case IDM_EAS: | 
|---|
|  | 4307 | case IDM_ARCHIVE: | 
|---|
|  | 4308 | case IDM_EXTRACT: | 
|---|
|  | 4309 | case IDM_UUDECODE: | 
|---|
|  | 4310 | case IDM_OBJECT: | 
|---|
|  | 4311 | case IDM_SHADOW: | 
|---|
|  | 4312 | case IDM_OPENSETTINGS: | 
|---|
|  | 4313 | case IDM_OPENDEFAULT: | 
|---|
|  | 4314 | if (!PostMsg(pAD->hwndObj, UM_MASSACTION, mp1, MPFROMP(list))) | 
|---|
|  | 4315 | FreeList(list); | 
|---|
|  | 4316 | break; | 
|---|
|  | 4317 | } | 
|---|
|  | 4318 | if (fUnHilite) { | 
|---|
|  | 4319 | Mark(hwnd, AFM_UNMARK, NULL); | 
|---|
|  | 4320 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
|  | 4321 | } | 
|---|
|  | 4322 | } | 
|---|
|  | 4323 | } | 
|---|
|  | 4324 | break; | 
|---|
| [2] | 4325 |  | 
|---|
| [1335] | 4326 | case IDM_COLLECTOR: | 
|---|
|  | 4327 | if (mp2) { | 
|---|
| [2] | 4328 |  | 
|---|
| [1335] | 4329 | CHAR **list = mp2; | 
|---|
| [2] | 4330 |  | 
|---|
| [1335] | 4331 | if (Collector) { | 
|---|
|  | 4332 | if (!PostMsg(Collector, WM_COMMAND, | 
|---|
|  | 4333 | MPFROM2SHORT(IDM_COLLECTOR, 0), MPFROMP(list))) | 
|---|
|  | 4334 | FreeList(list); | 
|---|
|  | 4335 | else if (fUnHilite) { | 
|---|
|  | 4336 | Mark(hwnd, AFM_UNMARK, NULL); | 
|---|
|  | 4337 | WinInvalidateRect(hwnd, NULL, FALSE); | 
|---|
|  | 4338 | } | 
|---|
|  | 4339 | } | 
|---|
|  | 4340 | else | 
|---|
|  | 4341 | FreeList(list); | 
|---|
|  | 4342 | } | 
|---|
|  | 4343 | break; | 
|---|
|  | 4344 | } | 
|---|
|  | 4345 | DosReleaseMutexSem(pAD->hmtxScan); | 
|---|
| [2] | 4346 | } | 
|---|
| [551] | 4347 | else if (SHORT1FROMMP(mp1) == IDM_COLLECTOR) { | 
|---|
| [1335] | 4348 | DosSleep(50);//05 Aug 07 GKY 100 | 
|---|
|  | 4349 | if (!PostMsg(hwnd, msg, mp1, mp2)) | 
|---|
|  | 4350 | WinSendMsg(hwnd, msg, mp1, mp2); | 
|---|
| [551] | 4351 | } | 
|---|
|  | 4352 | break; | 
|---|
| [2] | 4353 |  | 
|---|
| [551] | 4354 | case IDM_HELP: | 
|---|
|  | 4355 | if (hwndHelp) | 
|---|
| [1335] | 4356 | WinSendMsg(hwndHelp, | 
|---|
|  | 4357 | HM_DISPLAY_HELP, | 
|---|
|  | 4358 | MPFROM2SHORT(HELP_SEEALL, 0), MPFROMSHORT(HM_RESOURCEID)); | 
|---|
| [2] | 4359 | break; | 
|---|
| [551] | 4360 | } | 
|---|
|  | 4361 | return 0; | 
|---|
| [2] | 4362 |  | 
|---|
| [551] | 4363 | case WM_SIZE: | 
|---|
| [1559] | 4364 | // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc WM_SIZE"); | 
|---|
| [551] | 4365 | PostMsg(hwnd, UM_SETUP3, MPVOID, MPVOID); | 
|---|
|  | 4366 | break; | 
|---|
|  | 4367 |  | 
|---|
|  | 4368 | case WM_CLOSE: | 
|---|
| [1559] | 4369 | // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc WM_CLOSE"); | 
|---|
| [551] | 4370 | if (pAD) | 
|---|
|  | 4371 | pAD->stopflag = 1; | 
|---|
|  | 4372 | WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT)); | 
|---|
|  | 4373 | return 0; | 
|---|
| [2] | 4374 |  | 
|---|
| [551] | 4375 | case WM_DESTROY: | 
|---|
| [1559] | 4376 | // DbgMsg(pszSrcFile, __LINE__, "SeeAllWndProc WM_DESTROY"); | 
|---|
| [551] | 4377 | if (pAD) { | 
|---|
|  | 4378 | pAD->stopflag = 1; | 
|---|
|  | 4379 | if (pAD->hmtxScan) { | 
|---|
| [1559] | 4380 | apiret = DosRequestMutexSem(pAD->hmtxScan, 2000); | 
|---|
|  | 4381 | if (apiret != NO_ERROR) | 
|---|
|  | 4382 | Dos_Error(MB_CANCEL, apiret, hwnd, pszSrcFile, __LINE__, "DosRequestMutexSem"); | 
|---|
|  | 4383 | DosCloseMutexSem(pAD->hmtxScan);        // Are probably going to die anyway | 
|---|
| [2] | 4384 | } | 
|---|
| [551] | 4385 | if (pAD->hwndPopup) | 
|---|
| [1335] | 4386 | WinDestroyWindow(pAD->hwndPopup); | 
|---|
| [551] | 4387 | if (pAD->hwndObj) { | 
|---|
| [1335] | 4388 | if (!PostMsg(pAD->hwndObj, WM_CLOSE, MPVOID, MPVOID)) | 
|---|
|  | 4389 | WinSendMsg(pAD->hwndObj, WM_CLOSE, MPVOID, MPVOID); | 
|---|
| [551] | 4390 | } | 
|---|
|  | 4391 | if (pAD->hps) { | 
|---|
| [1433] | 4392 | GpiDeleteSetId(pAD->hps, SEEALLFILECNR_FONT_LCID); | 
|---|
| [1335] | 4393 | GpiAssociate(pAD->hps, 0); | 
|---|
|  | 4394 | GpiDestroyPS(pAD->hps); | 
|---|
| [551] | 4395 | } | 
|---|
|  | 4396 | if (pAD->killme) { | 
|---|
| [1335] | 4397 | if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID)) | 
|---|
|  | 4398 | WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID); | 
|---|
| [551] | 4399 | } | 
|---|
|  | 4400 | FreeAllFilesList(hwnd); | 
|---|
| [1039] | 4401 | free(pAD); | 
|---|
| [551] | 4402 | } | 
|---|
| [1063] | 4403 | #   ifdef FORTIFY | 
|---|
|  | 4404 | Fortify_LeaveScope(); | 
|---|
|  | 4405 | #    endif | 
|---|
| [551] | 4406 | break; | 
|---|
| [2] | 4407 | } | 
|---|
|  | 4408 |  | 
|---|
| [551] | 4409 | return WinDefWindowProc(hwnd, msg, mp1, mp2); | 
|---|
| [2] | 4410 | } | 
|---|
|  | 4411 |  | 
|---|
| [1158] | 4412 | HWND StartSeeAll(HWND hwndParent, BOOL standalone,      // called by applet | 
|---|
| [1335] | 4413 | CHAR * pszStartPath)   // pathname or NULL | 
|---|
| [84] | 4414 | { | 
|---|
| [551] | 4415 | HWND hwndFrame = (HWND) 0, hwndClient; | 
|---|
|  | 4416 | ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU | | 
|---|
|  | 4417 | FCF_SIZEBORDER | FCF_MINMAX | | 
|---|
|  | 4418 | FCF_NOBYTEALIGN | FCF_VERTSCROLL | | 
|---|
|  | 4419 | FCF_MENU | FCF_ICON | FCF_ACCELTABLE | FCF_HORZSCROLL; | 
|---|
| [2] | 4420 |  | 
|---|
| [551] | 4421 | if (ParentIsDesktop(hwndParent, hwndParent)) | 
|---|
| [2] | 4422 | FrameFlags |= (FCF_TASKLIST | FCF_SHELLPOSITION); | 
|---|
|  | 4423 | hwndFrame = WinCreateStdWindow(hwndParent, | 
|---|
| [1335] | 4424 | WS_VISIBLE, | 
|---|
|  | 4425 | &FrameFlags, | 
|---|
| [1498] | 4426 | (CHAR *) WC_SEEALL, | 
|---|
|  | 4427 | (CHAR *) GetPString(IDS_SEEALLTITLETEXT), | 
|---|
| [1335] | 4428 | WS_VISIBLE | fwsAnimate, | 
|---|
|  | 4429 | FM3ModHandle, SEEALL_FRAME, &hwndClient); | 
|---|
| [551] | 4430 | if (hwndFrame) { | 
|---|
|  | 4431 | static CHAR *pszDir; | 
|---|
|  | 4432 |  | 
|---|
|  | 4433 | if (standalone) { | 
|---|
|  | 4434 | if (!PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
| [1335] | 4435 | UM_SETUP4, MPVOID, MPVOID)) { | 
|---|
|  | 4436 | PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID); | 
|---|
|  | 4437 | return (HWND) 0; | 
|---|
| [2] | 4438 | } | 
|---|
|  | 4439 | } | 
|---|
| [551] | 4440 | if (pszStartPath) { | 
|---|
| [84] | 4441 | // Needs to be static for other thread | 
|---|
|  | 4442 | if (!pszDir) | 
|---|
| [1335] | 4443 | pszDir = xmalloc(CCHMAXPATH, pszSrcFile, __LINE__); | 
|---|
| [84] | 4444 | if (pszDir) { | 
|---|
| [1335] | 4445 | strcpy(pszDir, pszStartPath); | 
|---|
|  | 4446 | pszStartPath = pszDir; | 
|---|
| [84] | 4447 | } | 
|---|
|  | 4448 | } | 
|---|
| [551] | 4449 | PostMsg(WinWindowFromID(hwndFrame, FID_CLIENT), | 
|---|
| [1335] | 4450 | UM_SETUP5, MPFROMP(pszStartPath), MPVOID); | 
|---|
| [2] | 4451 | } | 
|---|
| [551] | 4452 | else if (standalone) | 
|---|
|  | 4453 | PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID); | 
|---|
| [2] | 4454 | return hwndFrame; | 
|---|
|  | 4455 | } | 
|---|
| [783] | 4456 |  | 
|---|
|  | 4457 | #pragma alloc_text(SEEALL,comparefullnames,comparenames,comparesizes) | 
|---|
|  | 4458 | #pragma alloc_text(SEEALL,comparedates,compareexts,SeeStatusProc) | 
|---|
|  | 4459 | #pragma alloc_text(SEEALL,InitWindow,PaintLine,SeeAllWndProc) | 
|---|
|  | 4460 | #pragma alloc_text(SEEALL,UpdateList,CollectList,ReSort,Mark) | 
|---|
| [985] | 4461 | #pragma alloc_text(SEEALL,BuildAList,RemoveDeleted,SeeFrameWndProc,FilterList,FilterAll) | 
|---|
| [787] | 4462 | #pragma alloc_text(SEEALL2,SeeObjWndProc,MakeSeeObjWinThread,FindDupesThread,DupeDlgProc) | 
|---|
| [783] | 4463 | #pragma alloc_text(SEEALL3,FreeAllFilesList,DoADir,FindAllThread,AFDrvsWndProc) | 
|---|
|  | 4464 | #pragma alloc_text(SEEALL3,StartSeeAll) | 
|---|
|  | 4465 |  | 
|---|