[27] | 1 |
|
---|
| 2 | /***********************************************************************
|
---|
| 3 |
|
---|
| 4 | $Id: arccnrs.c 906 2008-01-06 04:21:14Z gyoung $
|
---|
| 5 |
|
---|
[123] | 6 | Archive containers
|
---|
| 7 |
|
---|
[28] | 8 | Copyright (c) 1993-98 M. Kimes
|
---|
[672] | 9 | Copyright (c) 2001, 2007 Steven H. Levine
|
---|
[27] | 10 |
|
---|
[130] | 11 | 11 Jun 02 SHL Ensure archive name not garbage
|
---|
| 12 | 22 May 03 SHL ArcObjWndProc: fix UM_RESCAN now that we understand it
|
---|
| 13 | 01 Aug 04 SHL Rework lstrip/rstrip usage
|
---|
| 14 | 23 May 05 SHL Use QWL_USER
|
---|
[156] | 15 | 25 May 05 SHL Rename comnam to szCommonName and fix typo
|
---|
| 16 | 25 May 05 SHL Use ULONGLONG and CommaFmtULL
|
---|
[212] | 17 | 05 Jun 05 SHL Drop obsolete, localize
|
---|
| 18 | 05 Jun 05 SHL Correct last sort logic
|
---|
| 19 | 05 Jun 05 SHL Use QWL_USER
|
---|
[229] | 20 | 22 Jun 05 SHL ArcSort: correct typo in last sort fix
|
---|
[249] | 21 | 13 Aug 05 SHL FillArcCnr: optimize
|
---|
[300] | 22 | 08 Dec 05 SHL FillArcCnr: allow list start and end markers to be empty (i.e. tar)
|
---|
| 23 | 08 Dec 05 SHL ArcCnrWndProc: suppress IDM_EXTRACT if no simple extract (i.e. tar)
|
---|
| 24 | 30 Dec 05 SHL ArcCnrWndProc: correct date/time column display setup
|
---|
| 25 | 29 May 06 SHL Comments
|
---|
[358] | 26 | 14 Jul 06 SHL Use Runtime_Error
|
---|
[367] | 27 | 26 Jul 06 SHL Correct SelectAll usage
|
---|
[406] | 28 | 29 Jul 06 SHL Use xfgets_bstripcr
|
---|
[423] | 29 | 31 Jul 06 SHL Lower priority for archives with more than 1000 entries
|
---|
[426] | 30 | 02 Aug 06 SHL Add logic to stop processing large archives
|
---|
[460] | 31 | 23 Aug 06 SHL Integrate John Small's switch list title logic
|
---|
[531] | 32 | 03 Nov 06 SHL Renames
|
---|
[562] | 33 | 14 Mar 07 SHL ArcObjWndProc/UM_ENTER: delay before starting viewer
|
---|
[593] | 34 | 30 Mar 07 GKY Remove GetPString for window class names
|
---|
[618] | 35 | 06 Apr 07 GKY Work around PM DragInfo and DrgFreeISH limit
|
---|
[606] | 36 | 06 Apr 07 GKY Add some error checking in drag/drop
|
---|
[618] | 37 | 20 Apr 07 SHL Sync with NumItemsToUnhilite mods
|
---|
[627] | 38 | 21 Apr 07 GKY Find FM2Utils by path or utils directory
|
---|
[672] | 39 | 12 May 07 SHL Use dcd->ulItemsToUnHilite; sync with UnHilite arg mods
|
---|
[688] | 40 | 10 Jun 07 GKY Add CheckPmDrgLimit including IsFm2Window as part of work around PM drag limit
|
---|
[696] | 41 | 16 Jun 07 SHL Use DosQueryAppType not DosQAppType
|
---|
[751] | 42 | 02 Aug 07 SHL Sync with ARCITEM mods
|
---|
[773] | 43 | 06 Aug 07 SHL Use BldFullPathName and BldQuotedFileName
|
---|
| 44 | 06 Aug 07 SHL Move BldQuotedFileName and BldQuotedFullPathNamehere
|
---|
| 45 | to be near primary caller
|
---|
[775] | 46 | 06 Aug 07 GKY Reduce DosSleep times (ticket 148)
|
---|
[793] | 47 | 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
|
---|
[814] | 48 | 26 Aug 07 GKY DosSleep(1) in loops changed to (0)
|
---|
[872] | 49 | 22 Nov 07 GKY Use CopyPresParams to fix presparam inconsistencies in menus
|
---|
[897] | 50 | 30 Dec 07 GKY Use TestCDates for sort by date
|
---|
[618] | 51 |
|
---|
[27] | 52 | ***********************************************************************/
|
---|
| 53 |
|
---|
[2] | 54 | #define INCL_DOS
|
---|
| 55 | #define INCL_DOSERRORS
|
---|
| 56 | #define INCL_WIN
|
---|
| 57 | #define INCL_GPI
|
---|
[156] | 58 | #define INCL_LONGLONG
|
---|
| 59 | #include <os2.h>
|
---|
[2] | 60 |
|
---|
| 61 | #include <stdarg.h>
|
---|
| 62 | #include <stdio.h>
|
---|
| 63 | #include <stdlib.h>
|
---|
| 64 | #include <string.h>
|
---|
| 65 | #include <ctype.h>
|
---|
| 66 | #include <time.h>
|
---|
| 67 | #include <direct.h>
|
---|
| 68 | #include <share.h>
|
---|
| 69 | #include <limits.h>
|
---|
[689] | 70 | #include <process.h> // _beginthread
|
---|
[762] | 71 |
|
---|
| 72 | #if 0
|
---|
[751] | 73 | #include <malloc.h> // _heapchk
|
---|
[762] | 74 | #endif
|
---|
[156] | 75 |
|
---|
[2] | 76 | #include "fm3dll.h"
|
---|
| 77 | #include "fm3dlg.h"
|
---|
| 78 | #include "fm3str.h"
|
---|
| 79 | #include "mle.h"
|
---|
| 80 |
|
---|
| 81 | #pragma data_seg(DATA1)
|
---|
[358] | 82 |
|
---|
| 83 | static INT DefArcSortFlags;
|
---|
| 84 | static PSZ pszSrcFile = __FILE__;
|
---|
| 85 |
|
---|
[773] | 86 | /**
|
---|
| 87 | * Build quoted full path name in callers buffer given
|
---|
| 88 | * directory name and filename
|
---|
| 89 | * @param pszPathName points to drive/directory if not NULL
|
---|
| 90 | * @returns pointer to quoted path name in caller's buffer
|
---|
| 91 | */
|
---|
| 92 |
|
---|
| 93 | PSZ BldQuotedFullPathName(PSZ pszFullPathName, PSZ pszPathName, PSZ pszFileName)
|
---|
| 94 | {
|
---|
| 95 | UINT c = pszPathName ? strlen(pszPathName) : 0;
|
---|
| 96 | BOOL q = needs_quoting(pszPathName) ||
|
---|
| 97 | needs_quoting(pszFileName);
|
---|
| 98 | PSZ psz = pszFullPathName;
|
---|
| 99 |
|
---|
| 100 | if (q)
|
---|
| 101 | *psz++ = '"';
|
---|
| 102 | if (c > 0) {
|
---|
| 103 | memcpy(psz, pszPathName, c);
|
---|
| 104 | psz += c;
|
---|
| 105 | if (*(psz - 1) != '\\')
|
---|
| 106 | *psz++ = '\\';
|
---|
| 107 | }
|
---|
| 108 | strcpy(psz, pszFileName);
|
---|
| 109 | if (q) {
|
---|
| 110 | psz += strlen(psz);
|
---|
| 111 | *psz++ = '"';
|
---|
| 112 | *psz = 0;
|
---|
| 113 | }
|
---|
| 114 | return pszFullPathName;
|
---|
| 115 | }
|
---|
| 116 |
|
---|
| 117 | /**
|
---|
| 118 | * Build quoted full path name in callers buffer given a filename
|
---|
| 119 | * @returns pointer to quoted file name in caller's buffer
|
---|
| 120 | */
|
---|
| 121 |
|
---|
| 122 | PSZ BldQuotedFileName(PSZ pszQuotedFileName, PSZ pszFileName)
|
---|
| 123 | {
|
---|
| 124 | BOOL q = needs_quoting(pszFileName);
|
---|
| 125 | PSZ psz = pszQuotedFileName;
|
---|
| 126 |
|
---|
| 127 | if (q)
|
---|
| 128 | *psz++ = '"';
|
---|
| 129 | strcpy(psz, pszFileName);
|
---|
| 130 | if (q) {
|
---|
| 131 | psz += strlen(psz);
|
---|
| 132 | *psz++ = '"';
|
---|
| 133 | *psz = 0;
|
---|
| 134 | }
|
---|
| 135 | return pszQuotedFileName;
|
---|
| 136 | }
|
---|
| 137 |
|
---|
[551] | 138 | static MRESULT EXPENTRY ArcErrProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
| 139 | MPARAM mp2)
|
---|
[172] | 140 | {
|
---|
[2] | 141 | ARCDUMP *ad;
|
---|
[773] | 142 | CHAR szQuotedArcName[CCHMAXPATH];
|
---|
[2] | 143 |
|
---|
[551] | 144 | switch (msg) {
|
---|
| 145 | case WM_INITDLG:
|
---|
| 146 | if (!mp2)
|
---|
| 147 | WinDismissDlg(hwnd, 0);
|
---|
| 148 | else {
|
---|
| 149 | ad = (ARCDUMP *) mp2;
|
---|
| 150 | WinSetWindowPtr(hwnd, QWL_USER, ad);
|
---|
| 151 | if (ad->errmsg)
|
---|
| 152 | WinSetDlgItemText(hwnd, ARCERR_TEXT, ad->errmsg);
|
---|
| 153 | if (!ad->info->test)
|
---|
| 154 | WinEnableWindow(WinWindowFromID(hwnd, ARCERR_TEST), FALSE);
|
---|
| 155 | if (ad->listname) {
|
---|
| 156 | MLEsetlimit(WinWindowFromID(hwnd, ARCERR_MLE), -1L);
|
---|
| 157 | MLEsetformat(WinWindowFromID(hwnd, ARCERR_MLE), MLFIE_NOTRANS);
|
---|
| 158 | MLEsetcurpos(WinWindowFromID(hwnd, ARCERR_MLE),
|
---|
| 159 | MLEgetlen(WinWindowFromID(hwnd, ARCERR_MLE)));
|
---|
| 160 | MLEinsert(WinWindowFromID(hwnd, ARCERR_MLE),
|
---|
| 161 | GetPString(IDS_ARCHIVERREPORTTEXT));
|
---|
| 162 | MLEinsertfile(WinWindowFromID(hwnd, ARCERR_MLE), ad->listname);
|
---|
[2] | 163 | }
|
---|
[551] | 164 | }
|
---|
| 165 | break;
|
---|
| 166 |
|
---|
| 167 | case WM_COMMAND:
|
---|
| 168 | switch (SHORT1FROMMP(mp1)) {
|
---|
| 169 | case DID_CANCEL:
|
---|
| 170 | WinDismissDlg(hwnd, 0);
|
---|
[2] | 171 | break;
|
---|
| 172 |
|
---|
[551] | 173 | case IDM_HELP:
|
---|
| 174 | if (hwndHelp) {
|
---|
| 175 | WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
|
---|
| 176 | MPFROM2SHORT(HELP_ARCERR, 0), MPFROMSHORT(HM_RESOURCEID));
|
---|
| 177 | }
|
---|
| 178 | break;
|
---|
[2] | 179 |
|
---|
[551] | 180 | case DID_OK:
|
---|
| 181 | ad = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
| 182 | WinDlgBox(HWND_DESKTOP, hwnd, ArcReviewDlgProc, FM3ModHandle,
|
---|
| 183 | AD_FRAME, MPFROMP(ad));
|
---|
| 184 | WinDismissDlg(hwnd, 0);
|
---|
| 185 | break;
|
---|
[2] | 186 |
|
---|
[551] | 187 | case ARCERR_VIEW:
|
---|
| 188 | ad = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
| 189 | {
|
---|
| 190 | CHAR *list[2];
|
---|
[2] | 191 |
|
---|
[551] | 192 | list[0] = ad->arcname;
|
---|
| 193 | list[1] = NULL;
|
---|
| 194 | if (TestBinary(ad->arcname)) {
|
---|
| 195 | if (*binview)
|
---|
| 196 | ExecOnList((HWND) 0, binview, WINDOWED | SEPARATE, NULL, list,
|
---|
[888] | 197 | NULL, pszSrcFile, __LINE__);
|
---|
[551] | 198 | else
|
---|
| 199 | StartMLEEditor(HWND_DESKTOP, 16 + 4 + 1, ad->arcname, hwnd);
|
---|
| 200 | }
|
---|
| 201 | else {
|
---|
| 202 | if (*viewer) {
|
---|
| 203 | ExecOnList((HWND) 0, viewer, WINDOWED | SEPARATE |
|
---|
[888] | 204 | (fViewChild ? CHILD : 0),
|
---|
| 205 | NULL, list, NULL, pszSrcFile, __LINE__);
|
---|
[551] | 206 | }
|
---|
| 207 | else
|
---|
| 208 | StartMLEEditor(HWND_DESKTOP, 8 + 4 + 1, ad->arcname, hwnd);
|
---|
| 209 | }
|
---|
| 210 | }
|
---|
| 211 | break;
|
---|
[2] | 212 |
|
---|
[551] | 213 | case ARCERR_TEST:
|
---|
| 214 | ad = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
| 215 | runemf2(SEPARATEKEEP | WINDOWED | MAXIMIZED,
|
---|
[888] | 216 | hwnd, pszSrcFile, __LINE__, NULL, NULL,
|
---|
[773] | 217 | "%s %s",
|
---|
| 218 | ad->info->test,
|
---|
| 219 | BldQuotedFileName(szQuotedArcName, ad->arcname));
|
---|
[551] | 220 | break;
|
---|
| 221 | }
|
---|
| 222 | return 0;
|
---|
[2] | 223 | }
|
---|
[551] | 224 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 225 | }
|
---|
| 226 |
|
---|
[551] | 227 | static SHORT APIENTRY ArcSort(PMINIRECORDCORE pmrc1, PMINIRECORDCORE pmrc2,
|
---|
| 228 | PVOID pStorage)
|
---|
[172] | 229 | {
|
---|
[551] | 230 | PARCITEM pai1 = (PARCITEM) pmrc1;
|
---|
| 231 | PARCITEM pai2 = (PARCITEM) pmrc2;
|
---|
| 232 | DIRCNRDATA *pdcd = (DIRCNRDATA *) pStorage;
|
---|
| 233 | SHORT ret = 0;
|
---|
| 234 | CHAR *pext, *ppext;
|
---|
| 235 | INT sortFlags;
|
---|
[2] | 236 |
|
---|
[423] | 237 | if (!pdcd) {
|
---|
[212] | 238 | HWND hwndCnr = pai1->hwndCnr;
|
---|
[551] | 239 |
|
---|
| 240 | pdcd = WinQueryWindowPtr(hwndCnr, QWL_USER);
|
---|
[358] | 241 | if (!pdcd) {
|
---|
[377] | 242 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
[212] | 243 | return ret;
|
---|
| 244 | }
|
---|
| 245 | }
|
---|
| 246 |
|
---|
| 247 | sortFlags = pdcd->sortFlags; // Optimize
|
---|
| 248 |
|
---|
[423] | 249 | if (sortFlags) {
|
---|
[551] | 250 | switch (sortFlags & (~SORT_REVERSE)) {
|
---|
| 251 | case SORT_FIRSTEXTENSION:
|
---|
[730] | 252 | pext = strchr(pai1->pszFileName, '.');
|
---|
| 253 | ppext = strchr(pai2->pszFileName, '.');
|
---|
[551] | 254 | if (!pext)
|
---|
| 255 | pext = NullStr;
|
---|
| 256 | if (!ppext)
|
---|
| 257 | ppext = NullStr;
|
---|
| 258 | ret = stricmp(pext, ppext);
|
---|
| 259 | break;
|
---|
[2] | 260 |
|
---|
[551] | 261 | case SORT_LASTEXTENSION:
|
---|
[730] | 262 | pext = strrchr(pai1->pszFileName, '.');
|
---|
| 263 | ppext = strrchr(pai2->pszFileName, '.');
|
---|
[551] | 264 | if (!pext)
|
---|
| 265 | pext = NullStr;
|
---|
| 266 | if (!ppext)
|
---|
| 267 | ppext = NullStr;
|
---|
| 268 | ret = stricmp(pext, ppext);
|
---|
| 269 | break;
|
---|
[2] | 270 |
|
---|
[551] | 271 | case SORT_LWDATE:
|
---|
[897] | 272 | ret = TestCDates(&pai1->date, &pai1->time,
|
---|
| 273 | &pai2->date, &pai2->time);
|
---|
| 274 | /*(pai1->date.year < pai2->date.year) ? 1 :
|
---|
[551] | 275 | (pai1->date.year > pai2->date.year) ? -1 :
|
---|
| 276 | (pai1->date.month < pai2->date.month) ? 1 :
|
---|
| 277 | (pai1->date.month > pai2->date.month) ? -1 :
|
---|
| 278 | (pai1->date.day < pai2->date.day) ? 1 :
|
---|
| 279 | (pai1->date.day > pai2->date.day) ? -1 :
|
---|
| 280 | (pai1->time.hours < pai2->time.hours) ? 1 :
|
---|
| 281 | (pai1->time.hours > pai2->time.hours) ? -1 :
|
---|
| 282 | (pai1->time.minutes < pai2->time.minutes) ? 1 :
|
---|
| 283 | (pai1->time.minutes > pai2->time.minutes) ? -1 :
|
---|
| 284 | (pai1->time.seconds < pai2->time.seconds) ? 1 :
|
---|
[897] | 285 | (pai1->time.seconds > pai2->time.seconds) ? -1 : 0;*/
|
---|
[551] | 286 | break;
|
---|
[2] | 287 |
|
---|
[551] | 288 | case SORT_SIZE:
|
---|
| 289 | ret =
|
---|
| 290 | (pai1->cbFile < pai2->cbFile) ? 1 : (pai1->cbFile ==
|
---|
| 291 | pai2->cbFile) ? 0 : -1;
|
---|
| 292 | if (!ret)
|
---|
| 293 | ret =
|
---|
| 294 | (pai1->cbComp < pai2->cbComp) ? 1 : (pai1->cbComp ==
|
---|
| 295 | pai2->cbComp) ? 0 : -1;
|
---|
| 296 | break;
|
---|
[2] | 297 |
|
---|
[551] | 298 | case SORT_EASIZE:
|
---|
| 299 | ret =
|
---|
| 300 | (pai1->cbComp < pai2->cbComp) ? 1 : (pai1->cbComp ==
|
---|
| 301 | pai2->cbComp) ? 0 : -1;
|
---|
| 302 | if (!ret)
|
---|
| 303 | ret =
|
---|
| 304 | (pai1->cbFile < pai2->cbFile) ? 1 : (pai1->cbFile ==
|
---|
| 305 | pai2->cbFile) ? 0 : -1;
|
---|
| 306 | break;
|
---|
[2] | 307 | }
|
---|
[423] | 308 | if (!ret)
|
---|
[730] | 309 | ret = (SHORT) stricmp(pai1->pszFileName, pai2->pszFileName);
|
---|
[423] | 310 | if (ret && (sortFlags & SORT_REVERSE))
|
---|
[562] | 311 | ret = ret > 0 ? -1 : 1;
|
---|
[2] | 312 | return ret;
|
---|
| 313 | }
|
---|
[730] | 314 | return (SHORT) stricmp(pai1->pszFileName, pai2->pszFileName);
|
---|
[2] | 315 | }
|
---|
| 316 |
|
---|
[551] | 317 | static INT APIENTRY ArcFilter(PMINIRECORDCORE rmini, PVOID arg)
|
---|
[172] | 318 | {
|
---|
[551] | 319 | DIRCNRDATA *dcd = (DIRCNRDATA *) arg;
|
---|
| 320 | PARCITEM r;
|
---|
| 321 | register INT x;
|
---|
| 322 | INT ret = FALSE;
|
---|
[2] | 323 |
|
---|
[423] | 324 | if (dcd && *dcd->mask.szMask) {
|
---|
[551] | 325 | r = (PARCITEM) rmini;
|
---|
[423] | 326 | if (dcd->mask.pszMasks[1]) {
|
---|
[551] | 327 | for (x = 0; dcd->mask.pszMasks[x]; x++) {
|
---|
| 328 | if (*dcd->mask.pszMasks[x]) {
|
---|
| 329 | if (*dcd->mask.pszMasks[x] != '/') {
|
---|
[730] | 330 | if (wildcard(r->pszFileName, dcd->mask.pszMasks[x], FALSE))
|
---|
[551] | 331 | ret = TRUE;
|
---|
| 332 | }
|
---|
| 333 | else {
|
---|
[730] | 334 | if (wildcard(r->pszFileName, dcd->mask.pszMasks[x] + 1, FALSE)) {
|
---|
[551] | 335 | ret = FALSE;
|
---|
| 336 | break;
|
---|
| 337 | }
|
---|
| 338 | }
|
---|
| 339 | }
|
---|
[2] | 340 | }
|
---|
| 341 | }
|
---|
| 342 | else {
|
---|
[730] | 343 | if (wildcard(r->pszFileName, dcd->mask.szMask, FALSE))
|
---|
[551] | 344 | ret = TRUE;
|
---|
[2] | 345 | }
|
---|
| 346 | }
|
---|
| 347 | else
|
---|
| 348 | ret = TRUE;
|
---|
| 349 | return ret;
|
---|
| 350 | }
|
---|
| 351 |
|
---|
[551] | 352 | static MRESULT EXPENTRY ArcFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
| 353 | MPARAM mp2)
|
---|
[172] | 354 | {
|
---|
[551] | 355 | return CommonFrameWndProc(ARC_CNR, hwnd, msg, mp1, mp2);
|
---|
[2] | 356 | }
|
---|
| 357 |
|
---|
[551] | 358 | static BOOL IsArcThere(HWND hwnd, CHAR * arcname)
|
---|
[172] | 359 | {
|
---|
[423] | 360 | if (arcname) {
|
---|
| 361 | if (IsFile(arcname) != 1) {
|
---|
[551] | 362 | saymsg(MB_CANCEL, hwnd,
|
---|
| 363 | GetPString(IDS_SAYWHATTEXT),
|
---|
| 364 | GetPString(IDS_ARCNOTTHERETEXT), arcname);
|
---|
[2] | 365 | return FALSE;
|
---|
| 366 | }
|
---|
| 367 | return TRUE;
|
---|
| 368 | }
|
---|
| 369 | return FALSE;
|
---|
| 370 | }
|
---|
| 371 |
|
---|
[751] | 372 | /**
|
---|
| 373 | * Free storage associated with archive container item
|
---|
| 374 | * Caller is responsible for correcting pointers
|
---|
| 375 | */
|
---|
| 376 |
|
---|
| 377 | static VOID FreeArcItemData(PARCITEM pai)
|
---|
| 378 | {
|
---|
| 379 | // DbgMsg(pszSrcFile, __LINE__, "FreeArcItemData %p", pai);
|
---|
[762] | 380 | PSZ psz;
|
---|
[751] | 381 |
|
---|
[762] | 382 | if (pai->pszFileName && pai->pszFileName != NullStr) {
|
---|
| 383 | psz = pai->pszFileName;
|
---|
| 384 | pai->pszFileName = NullStr;
|
---|
| 385 | free(psz);
|
---|
| 386 | }
|
---|
[751] | 387 | }
|
---|
| 388 |
|
---|
| 389 | /**
|
---|
[762] | 390 | * Remove item(s) from archive container and free associated storage if requested
|
---|
| 391 | * @param paiFirst points to first item to remove or NULL to remove all
|
---|
| 392 | * @param usCnt is remove count or 0 to remove all
|
---|
[751] | 393 | */
|
---|
| 394 |
|
---|
[762] | 395 | static VOID RemoveArcItems(HWND hwnd, PARCITEM paiFirst, USHORT usCnt, USHORT usFlags)
|
---|
[751] | 396 | {
|
---|
[762] | 397 | INT remaining = usCnt;
|
---|
| 398 | PARCITEM pai;
|
---|
| 399 |
|
---|
| 400 | if ((usCnt && !paiFirst) || (!usCnt && paiFirst))
|
---|
| 401 | Runtime_Error(pszSrcFile, __LINE__, "paiFirst %p usCnt %u mismatch", paiFirst, usCnt);
|
---|
| 402 | else {
|
---|
| 403 | // Free our buffers if free requested
|
---|
| 404 | if (usFlags & CMA_FREE) {
|
---|
| 405 | if (paiFirst)
|
---|
| 406 | pai = paiFirst;
|
---|
| 407 | else {
|
---|
[751] | 408 | pai = (PARCITEM)WinSendMsg(hwnd, CM_QUERYRECORD, MPVOID,
|
---|
| 409 | MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
|
---|
[762] | 410 | if ((INT)pai == -1) {
|
---|
[751] | 411 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_QUERYRECORD");
|
---|
[762] | 412 | remaining = -1;
|
---|
| 413 | pai = NULL;
|
---|
[751] | 414 | }
|
---|
| 415 | }
|
---|
[762] | 416 | while (pai) {
|
---|
| 417 | FreeArcItemData(pai);
|
---|
| 418 | pai = (PARCITEM)pai->rc.preccNextRecord;
|
---|
| 419 | if (remaining && --remaining == 0)
|
---|
| 420 | break;
|
---|
| 421 | }
|
---|
[751] | 422 | }
|
---|
| 423 | }
|
---|
| 424 |
|
---|
[762] | 425 | // DbgMsg(pszSrcFile, __LINE__, "RemoveArcItems %p %u %s", pai, usCnt, pai->pszFileName);
|
---|
[751] | 426 |
|
---|
[762] | 427 | if (remaining != - 1) {
|
---|
| 428 | remaining = (INT)WinSendMsg(hwnd, CM_REMOVERECORD, MPFROMP(&paiFirst), MPFROM2SHORT(usCnt, usFlags));
|
---|
| 429 | if (remaining == -1) {
|
---|
[751] | 430 | // Win_Error2(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,IDS_CMREMOVEERRTEXT);
|
---|
[762] | 431 | Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,"CM_REMOVERECORD hwnd %x pai %p cnt %u", hwnd, paiFirst, usCnt);
|
---|
[751] | 432 | }
|
---|
| 433 | }
|
---|
| 434 | }
|
---|
| 435 |
|
---|
| 436 | /**
|
---|
[762] | 437 | * Empty all records from an archive container and
|
---|
| 438 | * free associated storage and free up field infos
|
---|
[751] | 439 | */
|
---|
| 440 |
|
---|
| 441 | static VOID EmptyArcCnr(HWND hwnd)
|
---|
| 442 | {
|
---|
[773] | 443 | #if 0 // fixme to be gone or to be configurable
|
---|
[751] | 444 | {
|
---|
| 445 | int state = _heapchk();
|
---|
| 446 | if (state != _HEAPOK)
|
---|
| 447 | Runtime_Error(pszSrcFile, __LINE__, "heap corrupted %d", state);
|
---|
[762] | 448 | else
|
---|
| 449 | DbgMsg(pszSrcFile, __LINE__, "_memavl %u", _memavl());
|
---|
[751] | 450 | }
|
---|
| 451 | #endif
|
---|
| 452 |
|
---|
| 453 | // Remove all ARCITEM records
|
---|
| 454 | RemoveArcItems(hwnd, NULL, 0, CMA_FREE);
|
---|
| 455 |
|
---|
| 456 | // Use common code to remove rest
|
---|
| 457 | EmptyCnr(hwnd);
|
---|
| 458 | }
|
---|
| 459 |
|
---|
[423] | 460 | //== FillArcCnr() generate archive content list and fill container window ==
|
---|
| 461 |
|
---|
[551] | 462 | static INT FillArcCnr(HWND hwndCnr, CHAR * arcname, ARC_TYPE ** arcinfo,
|
---|
| 463 | ULONGLONG * pullTotalBytes, volatile PCHAR pStopFlag)
|
---|
[44] | 464 | {
|
---|
[551] | 465 | FILE *fp;
|
---|
| 466 | HFILE oldstdout;
|
---|
| 467 | HFILE newstdout;
|
---|
| 468 | CHAR s[CCHMAXPATH * 2], lonename[CCHMAXPATH + 2],
|
---|
[773] | 469 | *nsize, *osize, *fdate, *fname, *p, *pp, arctemp[33];
|
---|
[551] | 470 | BOOL gotstart;
|
---|
| 471 | BOOL gotend;
|
---|
| 472 | BOOL wasquote;
|
---|
[773] | 473 | BOOL nomove = FALSE; // fixme to be gone?
|
---|
[551] | 474 | INT highest = 0, x, counter = 0, numarcfiles = 0;
|
---|
| 475 | PARCITEM lastpai;
|
---|
| 476 | ARC_TYPE *info;
|
---|
| 477 | ARC_TYPE *tinfo;
|
---|
| 478 | ULONG apptype;
|
---|
| 479 | APIRET rc;
|
---|
[2] | 480 |
|
---|
[423] | 481 | if (!arcname || !arcinfo)
|
---|
[2] | 482 | return 0;
|
---|
[300] | 483 |
|
---|
[2] | 484 | info = *arcinfo;
|
---|
[423] | 485 | if (!info)
|
---|
[551] | 486 | info = find_type(arcname, NULL);
|
---|
| 487 | for (x = 0; x < 99; x++) {
|
---|
| 488 | sprintf(arctemp, "%s.%03x", ArcTempRoot, (clock() & 4095L));
|
---|
[423] | 489 | if (IsFile(arctemp) == 1)
|
---|
| 490 | DosSleep(rand() % 100);
|
---|
| 491 | else
|
---|
| 492 | break;
|
---|
| 493 | }
|
---|
[300] | 494 |
|
---|
[2] | 495 | ReTry:
|
---|
| 496 |
|
---|
| 497 | #ifdef DEBUG
|
---|
[27] | 498 | if (info && info->id)
|
---|
[551] | 499 | WinSetWindowText(WinQueryWindow
|
---|
| 500 | (WinQueryWindow(hwndCnr, QW_PARENT), QW_PARENT),
|
---|
| 501 | info->id);
|
---|
[2] | 502 | #endif
|
---|
| 503 |
|
---|
| 504 | tinfo = NULL;
|
---|
| 505 | numarcfiles = counter = highest = 0;
|
---|
| 506 | gotstart = gotend = FALSE;
|
---|
| 507 | lastpai = NULL;
|
---|
[156] | 508 | *pullTotalBytes = 0;
|
---|
[358] | 509 | if (!info || !info->list)
|
---|
[377] | 510 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
[358] | 511 | else {
|
---|
[751] | 512 | RemoveArcItems(hwndCnr, NULL, 0, CMA_FREE | CMA_INVALIDATE | CMA_ERASE);
|
---|
[2] | 513 | *arcinfo = info;
|
---|
| 514 | highest = info->osizepos;
|
---|
[423] | 515 | if (info->nsizepos > highest)
|
---|
[2] | 516 | highest = info->nsizepos;
|
---|
[423] | 517 | if (info->fdpos > highest)
|
---|
[2] | 518 | highest = info->fdpos;
|
---|
[423] | 519 | if (info->fnpos > highest)
|
---|
[2] | 520 | highest = info->fnpos;
|
---|
[423] | 521 | if (highest > 50) {
|
---|
[551] | 522 | saymsg(MB_ENTER | MB_ICONEXCLAMATION, HWND_DESKTOP,
|
---|
| 523 | GetPString(IDS_SHAMETEXT), "%s", GetPString(IDS_BUNGEDUPTEXT));
|
---|
[423] | 524 | }
|
---|
| 525 | if (info->fnpos == -1)
|
---|
[2] | 526 | highest = 32767;
|
---|
[300] | 527 |
|
---|
[2] | 528 | DosError(FERR_DISABLEHARDERR);
|
---|
| 529 | DosForceDelete(arctemp);
|
---|
| 530 | DosError(FERR_DISABLEHARDERR);
|
---|
[300] | 531 |
|
---|
[551] | 532 | strcpy(s, info->list);
|
---|
| 533 | p = strchr(s, ' ');
|
---|
[423] | 534 | if (p)
|
---|
[2] | 535 | *p = 0;
|
---|
| 536 | DosError(FERR_DISABLEHARDERR);
|
---|
[696] | 537 | if (!DosQueryAppType(s, &apptype) &&
|
---|
[563] | 538 | (apptype & FAPPTYP_DOS ||
|
---|
| 539 | apptype & FAPPTYP_WINDOWSREAL ||
|
---|
| 540 | apptype & FAPPTYP_WINDOWSPROT ||
|
---|
| 541 | apptype & FAPPTYP_WINDOWSPROT31)) {
|
---|
[2] | 542 | p = GetCmdSpec(TRUE);
|
---|
| 543 | runemf2(SEPARATE | INVISIBLE | MINIMIZED | BACKGROUND | WAIT,
|
---|
[888] | 544 | hwndCnr, pszSrcFile, __LINE__, NULL, "DOS_BACKGROUND_EXECUTION=1",
|
---|
[773] | 545 | "%s /C %s %s >%s",
|
---|
| 546 | p, // shell
|
---|
| 547 | info->list, // list command
|
---|
| 548 | BldQuotedFileName(s, arcname),
|
---|
[562] | 549 | arctemp);
|
---|
[2] | 550 | }
|
---|
| 551 | else {
|
---|
[551] | 552 | fp = xfopen(arctemp, "w", pszSrcFile, __LINE__);
|
---|
[423] | 553 | if (!fp)
|
---|
[551] | 554 | return 0;
|
---|
[358] | 555 | else {
|
---|
[551] | 556 | newstdout = -1;
|
---|
| 557 | DosError(FERR_DISABLEHARDERR);
|
---|
| 558 | rc = DosDupHandle(fileno(stdout), &newstdout);
|
---|
| 559 | if (rc) {
|
---|
| 560 | Dos_Error(MB_CANCEL, rc, hwndCnr, pszSrcFile, __LINE__,
|
---|
| 561 | "DosDupHandle");
|
---|
| 562 | return 0;
|
---|
[358] | 563 | }
|
---|
| 564 | else {
|
---|
[551] | 565 | oldstdout = fileno(stdout);
|
---|
| 566 | DosError(FERR_DISABLEHARDERR);
|
---|
| 567 | rc = DosDupHandle(fileno(fp), &oldstdout);
|
---|
| 568 | if (rc) {
|
---|
| 569 | Dos_Error(MB_CANCEL, rc, hwndCnr, pszSrcFile, __LINE__,
|
---|
| 570 | "DosDupHandle");
|
---|
| 571 | return 0;
|
---|
[358] | 572 | }
|
---|
| 573 | else {
|
---|
[551] | 574 | runemf2(SEPARATE | INVISIBLE | FULLSCREEN | BACKGROUND | WAIT,
|
---|
[888] | 575 | hwndCnr, pszSrcFile, __LINE__, NULL, NULL,
|
---|
[773] | 576 | "%s %s",
|
---|
| 577 | info->list,
|
---|
| 578 | BldQuotedFileName(s, arcname));
|
---|
[551] | 579 | oldstdout = fileno(stdout);
|
---|
| 580 | DosError(FERR_DISABLEHARDERR);
|
---|
| 581 | DosDupHandle(newstdout, &oldstdout);
|
---|
| 582 | DosClose(newstdout);
|
---|
| 583 | fclose(fp);
|
---|
| 584 | }
|
---|
| 585 | }
|
---|
[2] | 586 | }
|
---|
| 587 | }
|
---|
[300] | 588 |
|
---|
[2] | 589 | DosError(FERR_DISABLEHARDERR);
|
---|
[551] | 590 | fp = _fsopen(arctemp, "r", SH_DENYWR);
|
---|
[300] | 591 |
|
---|
[358] | 592 | if (fp) {
|
---|
[300] | 593 | gotstart = !info->startlist || !*info->startlist; // If list has no start marker
|
---|
| 594 |
|
---|
[551] | 595 | while (!feof(fp) && !gotend && !*pStopFlag) {
|
---|
| 596 | if (!xfgets_bstripcr(s, sizeof(s), fp, pszSrcFile, __LINE__))
|
---|
| 597 | break;
|
---|
| 598 | if (!gotstart) {
|
---|
| 599 | if (!strcmp(s, info->startlist))
|
---|
| 600 | gotstart = TRUE;
|
---|
| 601 | }
|
---|
| 602 | else if (info->endlist && !strcmp(s, info->endlist))
|
---|
| 603 | gotend = TRUE;
|
---|
| 604 | else {
|
---|
[300] | 605 | /* add to container */
|
---|
[551] | 606 | fname = NULL;
|
---|
| 607 | bstrip(s);
|
---|
| 608 | if (info->nameisfirst) {
|
---|
| 609 | strncpy(lonename, s, CCHMAXPATH + 2);
|
---|
| 610 | lonename[CCHMAXPATH + 1] = 0;
|
---|
| 611 | fname = lonename;
|
---|
| 612 | if (!xfgets_bstripcr(s, sizeof(s), fp, pszSrcFile, __LINE__))
|
---|
| 613 | break;
|
---|
| 614 | if (*fname == '\"') {
|
---|
| 615 | memmove(fname, fname + 1, strlen(fname) + 1);
|
---|
| 616 | p = strchr(fname, '\"');
|
---|
| 617 | if (p)
|
---|
| 618 | *p = 0;
|
---|
| 619 | }
|
---|
| 620 | }
|
---|
| 621 | nsize = NULL;
|
---|
| 622 | osize = fdate = NullStr;
|
---|
| 623 | p = s;
|
---|
| 624 | for (x = 0; x <= highest; x++) {
|
---|
| 625 | pp = p;
|
---|
| 626 | while (*pp && (*pp == ' ' || *pp == '\t')) /* skip leading */
|
---|
| 627 | pp++;
|
---|
| 628 | if (!*pp)
|
---|
| 629 | break;
|
---|
| 630 | wasquote = FALSE;
|
---|
| 631 | p = pp;
|
---|
| 632 | while (*p && (wasquote ||
|
---|
| 633 | ((x != info->fnpos || !info->nameislast) ?
|
---|
| 634 | (*p != ' ' && *p != '\t') : TRUE))) {
|
---|
| 635 | if (*p == '\"') {
|
---|
| 636 | if (!wasquote) {
|
---|
| 637 | wasquote = TRUE;
|
---|
| 638 | memmove(p, p + 1, strlen(p));
|
---|
| 639 | while (*p == ' ' || *p == '\t')
|
---|
| 640 | p++;
|
---|
| 641 | }
|
---|
| 642 | else {
|
---|
| 643 | memmove(p, p + 1, strlen(p));
|
---|
| 644 | break;
|
---|
| 645 | }
|
---|
| 646 | }
|
---|
| 647 | else if (*p)
|
---|
| 648 | p++;
|
---|
| 649 | }
|
---|
| 650 | if (*p) {
|
---|
| 651 | *p = 0;
|
---|
| 652 | p++;
|
---|
| 653 | }
|
---|
| 654 | if (x == info->nsizepos)
|
---|
| 655 | nsize = pp;
|
---|
| 656 | else if (x == info->osizepos)
|
---|
| 657 | osize = pp;
|
---|
| 658 | else if (x == info->fdpos) {
|
---|
| 659 | fdate = pp;
|
---|
| 660 | if (info->fdflds > 1 && info->fdflds < 24) {
|
---|
| 661 | INT y;
|
---|
[2] | 662 |
|
---|
[551] | 663 | if (*p) {
|
---|
| 664 | p--;
|
---|
| 665 | *p = ' ';
|
---|
| 666 | for (y = 0; y < info->fdflds - 1; y++) {
|
---|
| 667 | while (*p && (*p == ' ' || *p == '\t'))
|
---|
| 668 | p++;
|
---|
| 669 | while (*p && (*p != ' ' && *p != '\t'))
|
---|
| 670 | p++;
|
---|
| 671 | x++;
|
---|
| 672 | }
|
---|
| 673 | if (*p) {
|
---|
| 674 | *p = 0;
|
---|
| 675 | p++;
|
---|
| 676 | }
|
---|
| 677 | }
|
---|
| 678 | }
|
---|
| 679 | }
|
---|
| 680 | else if (x == info->fnpos) {
|
---|
| 681 | fname = pp;
|
---|
| 682 | if (pp && *pp == '*' && !*(pp + 1)) /* workaround for LH.EXE */
|
---|
| 683 | fname = NULL;
|
---|
| 684 | if (info->nameislast)
|
---|
| 685 | break;
|
---|
| 686 | }
|
---|
| 687 | else if ((!p || !*p) && info->fnpos == -1) {
|
---|
| 688 | fname = pp;
|
---|
| 689 | break;
|
---|
| 690 | }
|
---|
| 691 | }
|
---|
| 692 | if (info->nameisnext) {
|
---|
| 693 | if (!xfgets_bstripcr
|
---|
| 694 | (lonename, sizeof(lonename), fp, pszSrcFile, __LINE__))
|
---|
| 695 | break;
|
---|
| 696 | fname = lonename;
|
---|
| 697 | }
|
---|
[423] | 698 | // fixme to complain?
|
---|
[551] | 699 | if (fname && *fname) {
|
---|
[2] | 700 |
|
---|
[551] | 701 | RECORDINSERT ri;
|
---|
| 702 | PARCITEM pai;
|
---|
[2] | 703 |
|
---|
| 704 | #ifdef DEBUG
|
---|
[551] | 705 | saymsg(MB_ENTER, hwndCnr, DEBUG_STRING,
|
---|
| 706 | "fname: %s\r\rpp: %s\r\rp: %s\r\rlonename: %s\r\rhighest: %ld\r\rx: %ld\r\rfdate: %s",
|
---|
[562] | 707 | fname ? fname : "NULL",
|
---|
| 708 | pp ? pp : "NULL",
|
---|
| 709 | p ? p : "NULL",
|
---|
[551] | 710 | lonename, highest, x, (fdate) ? fdate : "NULL");
|
---|
[2] | 711 | #endif
|
---|
| 712 |
|
---|
[551] | 713 | pai = WinSendMsg(hwndCnr,
|
---|
| 714 | CM_ALLOCRECORD,
|
---|
| 715 | MPFROMLONG(EXTRA_ARCRECORD_BYTES),
|
---|
| 716 | MPFROMLONG(1L));
|
---|
| 717 | if (!pai) {
|
---|
[358] | 718 | Runtime_Error(pszSrcFile, __LINE__, "CM_ALLOCRECORD");
|
---|
| 719 | break;
|
---|
| 720 | }
|
---|
| 721 | else {
|
---|
[551] | 722 | memset(pai, 0, sizeof(ARCITEM));
|
---|
| 723 | pai->hwndCnr = hwndCnr;
|
---|
| 724 | if (*fname == '*') {
|
---|
| 725 | fname++;
|
---|
| 726 | pai->flags = ARCFLAGS_REALDIR;
|
---|
[358] | 727 | }
|
---|
[551] | 728 | if (fname[strlen(fname) - 1] == '\\' ||
|
---|
| 729 | fname[strlen(fname) - 1] == '/')
|
---|
| 730 | pai->flags = ARCFLAGS_REALDIR;
|
---|
[730] | 731 | pai->pszFileName = xstrdup(fname,pszSrcFile, __LINE__);
|
---|
[762] | 732 | pai->pszDisplayName = pai->pszFileName;
|
---|
| 733 | pai->rc.pszIcon = pai->pszDisplayName;
|
---|
[551] | 734 | if (fdate)
|
---|
| 735 | strcpy(pai->szDate, fdate);
|
---|
[730] | 736 | // pai->pszFileName = pai->pszFileName;
|
---|
[551] | 737 | pai->rc.pszIcon = pai->pszFileName;
|
---|
[562] | 738 | pai->rc.hptrIcon = (pai->flags & ARCFLAGS_REALDIR) != 0 ?
|
---|
[551] | 739 | hptrDir : hptrFile;
|
---|
| 740 | pai->pszDate = pai->szDate;
|
---|
| 741 | if (osize)
|
---|
| 742 | pai->cbFile = atol(osize);
|
---|
| 743 | if (nsize)
|
---|
| 744 | pai->cbComp = atol(nsize);
|
---|
| 745 | if (info->datetype && fdate && *fdate)
|
---|
| 746 | ArcDateTime(fdate, info->datetype, &pai->date, &pai->time);
|
---|
| 747 | memset(&ri, 0, sizeof(RECORDINSERT));
|
---|
| 748 | ri.cb = sizeof(RECORDINSERT);
|
---|
| 749 | ri.pRecordOrder = (PRECORDCORE) CMA_END;
|
---|
| 750 | ri.pRecordParent = (PRECORDCORE) NULL;
|
---|
| 751 | ri.zOrder = (USHORT) CMA_TOP;
|
---|
| 752 | ri.cRecordsInsert = 1L;
|
---|
| 753 | ri.fInvalidateRecord = FALSE;
|
---|
| 754 | if (WinSendMsg(hwndCnr,
|
---|
| 755 | CM_INSERTRECORD, MPFROMP(pai), MPFROMP(&ri))) {
|
---|
| 756 | *pullTotalBytes += pai->cbFile;
|
---|
| 757 | }
|
---|
| 758 | numarcfiles++;
|
---|
| 759 | if (!(++counter % 50)) {
|
---|
| 760 | if (!lastpai)
|
---|
| 761 | lastpai = pai;
|
---|
| 762 | WinSendMsg(hwndCnr,
|
---|
| 763 | CM_INVALIDATERECORD,
|
---|
| 764 | lastpai,
|
---|
| 765 | MPFROM2SHORT(10, CMA_ERASE | CMA_REPOSITION));
|
---|
| 766 | lastpai = pai;
|
---|
| 767 | }
|
---|
[426] | 768 | // Avoid hogging system for large archive
|
---|
| 769 | if (numarcfiles == 100)
|
---|
[551] | 770 | priority_idle();
|
---|
| 771 | }
|
---|
| 772 | }
|
---|
| 773 | }
|
---|
| 774 | } // while !eof
|
---|
[300] | 775 |
|
---|
[2] | 776 | fclose(fp);
|
---|
[300] | 777 |
|
---|
[426] | 778 | if (*pStopFlag)
|
---|
[551] | 779 | numarcfiles = 0; // Request close
|
---|
| 780 | else if (!numarcfiles || !gotstart
|
---|
| 781 | || (!gotend && info->endlist && *info->endlist)) {
|
---|
[423] | 782 | // Oops
|
---|
[551] | 783 | ARCDUMP ad;
|
---|
| 784 | CHAR errstr[CCHMAXPATH + 256];
|
---|
[2] | 785 |
|
---|
[423] | 786 | // Try for alternate archiver
|
---|
[551] | 787 | tinfo = info;
|
---|
| 788 | do {
|
---|
| 789 | tinfo = tinfo->next;
|
---|
| 790 | if (tinfo)
|
---|
| 791 | tinfo = find_type(arcname, tinfo);
|
---|
| 792 | if (tinfo) {
|
---|
| 793 | DosError(FERR_DISABLEHARDERR);
|
---|
| 794 | DosForceDelete(arctemp);
|
---|
| 795 | info = tinfo;
|
---|
| 796 | goto ReTry;
|
---|
| 797 | }
|
---|
| 798 | } while (tinfo);
|
---|
| 799 | DosBeep(750, 50); // wake up user
|
---|
| 800 | sprintf(errstr, GetPString(IDS_ARCERRORINFOTEXT),
|
---|
| 801 | arcname,
|
---|
[562] | 802 | !gotstart ? GetPString(IDS_NOGOTSTARTTEXT) : NullStr,
|
---|
| 803 | !numarcfiles ? GetPString(IDS_NOARCFILESFOUNDTEXT) :
|
---|
[551] | 804 | NullStr,
|
---|
[562] | 805 | !gotend ? GetPString(IDS_NOENDOFLISTTEXT) : NullStr);
|
---|
[551] | 806 | memset(&ad, 0, sizeof(ARCDUMP));
|
---|
| 807 | ad.info = info;
|
---|
| 808 | strcpy(ad.listname, arctemp);
|
---|
| 809 | strcpy(ad.arcname, arcname);
|
---|
| 810 | ad.errmsg = errstr;
|
---|
| 811 | WinDlgBox(HWND_DESKTOP,
|
---|
| 812 | hwndCnr,
|
---|
| 813 | ArcErrProc, FM3ModHandle, ARCERR_FRAME, MPFROMP(&ad));
|
---|
[2] | 814 | }
|
---|
[249] | 815 | else if (!nomove && tinfo) {
|
---|
| 816 | /* if we got a false hit, move working hit to top */
|
---|
[551] | 817 | tinfo = info->next;
|
---|
| 818 | info->next = arcsighead;
|
---|
| 819 | arcsighead->prev = info;
|
---|
| 820 | if (tinfo)
|
---|
| 821 | tinfo->next->prev = info->prev;
|
---|
| 822 | info->prev->next = tinfo;
|
---|
| 823 | info->prev = NULL;
|
---|
| 824 | arcsighead = info;
|
---|
| 825 | rewrite_archiverbb2(NULL); // Rewrite with warning
|
---|
[2] | 826 | }
|
---|
[551] | 827 | } // if opened
|
---|
[426] | 828 |
|
---|
[2] | 829 | DosError(FERR_DISABLEHARDERR);
|
---|
| 830 | DosForceDelete(arctemp);
|
---|
| 831 | }
|
---|
| 832 |
|
---|
[426] | 833 | if (numarcfiles)
|
---|
[423] | 834 | priority_normal();
|
---|
| 835 |
|
---|
[2] | 836 | return numarcfiles;
|
---|
| 837 | }
|
---|
| 838 |
|
---|
[551] | 839 | MRESULT EXPENTRY ArcTextProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
[172] | 840 | {
|
---|
[551] | 841 | static BOOL emphasized = FALSE;
|
---|
| 842 | static HWND hwndButtonPopup = (HWND) 0;
|
---|
| 843 | static ULONG timestamp = ULONG_MAX;
|
---|
| 844 | static USHORT lastid = 0;
|
---|
[2] | 845 |
|
---|
[551] | 846 | switch (msg) {
|
---|
| 847 | case WM_CREATE:
|
---|
| 848 | return CommonTextProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 849 |
|
---|
[551] | 850 | case WM_COMMAND:
|
---|
| 851 | return WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 852 | ARC_CNR), msg, mp1, mp2);
|
---|
[2] | 853 |
|
---|
[551] | 854 | case UM_CONTEXTMENU:
|
---|
| 855 | case WM_CONTEXTMENU:
|
---|
| 856 | {
|
---|
| 857 | USHORT id;
|
---|
[2] | 858 |
|
---|
[551] | 859 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
| 860 | switch (id) {
|
---|
| 861 | case DIR_SELECTED:
|
---|
| 862 | case DIR_VIEW:
|
---|
| 863 | case DIR_SORT:
|
---|
| 864 | {
|
---|
| 865 | POINTL ptl = { 0, 0 };
|
---|
| 866 | SWP swp;
|
---|
| 867 | DIRCNRDATA *dcd;
|
---|
[2] | 868 |
|
---|
[551] | 869 | if (hwndButtonPopup)
|
---|
| 870 | WinDestroyWindow(hwndButtonPopup);
|
---|
| 871 | if (id == DIR_SELECTED)
|
---|
| 872 | id = DIR_RESTORE;
|
---|
| 873 | if (id == lastid) {
|
---|
[2] | 874 |
|
---|
[551] | 875 | ULONG check;
|
---|
[2] | 876 |
|
---|
[551] | 877 | DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &check,
|
---|
| 878 | sizeof(check));
|
---|
| 879 | if (check < timestamp + 500) {
|
---|
| 880 | lastid = 0;
|
---|
| 881 | goto MenuAbort;
|
---|
| 882 | }
|
---|
| 883 | }
|
---|
| 884 | hwndButtonPopup = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
|
---|
| 885 | if (hwndButtonPopup) {
|
---|
| 886 | WinSetWindowUShort(hwndButtonPopup, QWS_ID, id);
|
---|
| 887 | dcd = WinQueryWindowPtr(WinWindowFromID(WinQueryWindow(hwnd,
|
---|
| 888 | QW_PARENT),
|
---|
| 889 | ARC_CNR), QWL_USER);
|
---|
| 890 | if (id == DIR_SORT) {
|
---|
| 891 | if (dcd)
|
---|
| 892 | SetSortChecks(hwndButtonPopup, dcd->sortFlags);
|
---|
| 893 | WinSendMsg(hwndButtonPopup,
|
---|
| 894 | MM_DELETEITEM,
|
---|
| 895 | MPFROM2SHORT(IDM_SORTNONE, FALSE), MPVOID);
|
---|
| 896 | WinSendMsg(hwndButtonPopup,
|
---|
| 897 | MM_DELETEITEM,
|
---|
| 898 | MPFROM2SHORT(IDM_SORTNAME, FALSE), MPVOID);
|
---|
| 899 | WinSendMsg(hwndButtonPopup,
|
---|
| 900 | MM_DELETEITEM,
|
---|
| 901 | MPFROM2SHORT(IDM_SORTLADATE, FALSE), MPVOID);
|
---|
| 902 | WinSendMsg(hwndButtonPopup,
|
---|
| 903 | MM_DELETEITEM,
|
---|
| 904 | MPFROM2SHORT(IDM_SORTCRDATE, FALSE), MPVOID);
|
---|
| 905 | WinSendMsg(hwndButtonPopup,
|
---|
| 906 | MM_DELETEITEM,
|
---|
| 907 | MPFROM2SHORT(IDM_SORTDIRSFIRST, FALSE), MPVOID);
|
---|
| 908 | WinSendMsg(hwndButtonPopup,
|
---|
| 909 | MM_DELETEITEM,
|
---|
| 910 | MPFROM2SHORT(IDM_SORTDIRSLAST, FALSE), MPVOID);
|
---|
| 911 | WinSendMsg(hwndButtonPopup,
|
---|
| 912 | MM_DELETEITEM,
|
---|
| 913 | MPFROM2SHORT(IDM_SORTSUBJECT, FALSE), MPVOID);
|
---|
| 914 | WinSendMsg(hwndButtonPopup,
|
---|
| 915 | MM_SETITEMTEXT,
|
---|
| 916 | MPFROM2SHORT(IDM_SORTEASIZE, 0),
|
---|
| 917 | MPFROMP(GetPString(IDS_COMPRESSEDSIZEMENUTEXT)));
|
---|
| 918 | WinSendMsg(hwndButtonPopup,
|
---|
| 919 | MM_SETITEMTEXT,
|
---|
| 920 | MPFROM2SHORT(IDM_SORTLWDATE, 0),
|
---|
| 921 | MPFROMP(GetPString(IDS_DATEMENUTEXT)));
|
---|
| 922 | }
|
---|
| 923 | ptl.x = 0;
|
---|
| 924 | if (WinPopupMenu(HWND_OBJECT,
|
---|
| 925 | HWND_OBJECT,
|
---|
| 926 | hwndButtonPopup, -32767, -32767, 0, 0)) {
|
---|
| 927 | WinQueryWindowPos(hwndButtonPopup, &swp);
|
---|
| 928 | ptl.y = -(swp.cy + 2);
|
---|
| 929 | }
|
---|
| 930 | else {
|
---|
| 931 | WinQueryWindowPos(hwnd, &swp);
|
---|
| 932 | ptl.y = swp.cy + 2;
|
---|
| 933 | }
|
---|
| 934 | if (WinPopupMenu(hwnd,
|
---|
| 935 | hwnd,
|
---|
| 936 | hwndButtonPopup,
|
---|
| 937 | ptl.x,
|
---|
| 938 | ptl.y,
|
---|
| 939 | 0,
|
---|
| 940 | PU_HCONSTRAIN | PU_VCONSTRAIN |
|
---|
| 941 | PU_KEYBOARD | PU_MOUSEBUTTON1)) {
|
---|
| 942 | CenterOverWindow(hwndButtonPopup);
|
---|
| 943 | PaintRecessedWindow(hwnd, (HPS) 0, FALSE, FALSE);
|
---|
| 944 | }
|
---|
| 945 | }
|
---|
| 946 | }
|
---|
| 947 | break;
|
---|
| 948 | default:
|
---|
| 949 | PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 950 | ARC_CNR),
|
---|
| 951 | WM_CONTROL, MPFROM2SHORT(ARC_CNR, CN_CONTEXTMENU), MPVOID);
|
---|
| 952 | break;
|
---|
[2] | 953 | }
|
---|
[551] | 954 | }
|
---|
| 955 | MenuAbort:
|
---|
| 956 | if (msg == UM_CONTEXTMENU)
|
---|
| 957 | return 0;
|
---|
| 958 | break;
|
---|
[2] | 959 |
|
---|
[551] | 960 | case WM_MENUEND:
|
---|
| 961 | if (hwndButtonPopup == (HWND) mp2) {
|
---|
| 962 | lastid = WinQueryWindowUShort((HWND) mp2, QWS_ID);
|
---|
| 963 | WinDestroyWindow(hwndButtonPopup);
|
---|
| 964 | hwndButtonPopup = (HWND) 0;
|
---|
| 965 | DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, ×tamp,
|
---|
| 966 | sizeof(timestamp));
|
---|
| 967 | switch (lastid) {
|
---|
| 968 | case DIR_VIEW:
|
---|
| 969 | case DIR_SORT:
|
---|
| 970 | case DIR_RESTORE:
|
---|
| 971 | case DIR_SELECTED:
|
---|
| 972 | PaintRecessedWindow(hwnd, (HPS) 0, TRUE, FALSE);
|
---|
| 973 | break;
|
---|
[2] | 974 | }
|
---|
[551] | 975 | }
|
---|
| 976 | break;
|
---|
[2] | 977 |
|
---|
[551] | 978 | case WM_MOUSEMOVE:
|
---|
| 979 | {
|
---|
| 980 | USHORT id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
| 981 | char *s = NULL;
|
---|
[2] | 982 |
|
---|
[551] | 983 | if (fOtherHelp) {
|
---|
| 984 | if ((!hwndBubble ||
|
---|
| 985 | WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
|
---|
| 986 | !WinQueryCapture(HWND_DESKTOP)) {
|
---|
| 987 | switch (id) {
|
---|
| 988 | case DIR_TOTALS:
|
---|
| 989 | s = GetPString(IDS_ARCCNRTOTALSHELPTEXT);
|
---|
| 990 | break;
|
---|
| 991 | case DIR_SELECTED:
|
---|
| 992 | s = GetPString(IDS_ARCCNRSELECTEDHELPTEXT);
|
---|
| 993 | break;
|
---|
| 994 | case DIR_VIEW:
|
---|
| 995 | s = GetPString(IDS_ARCCNRVIEWHELPTEXT);
|
---|
| 996 | break;
|
---|
| 997 | case DIR_SORT:
|
---|
| 998 | s = GetPString(IDS_DIRCNRSORTHELP);
|
---|
| 999 | break;
|
---|
| 1000 | case DIR_FILTER:
|
---|
| 1001 | s = GetPString(IDS_DIRCNRFILTERHELP);
|
---|
| 1002 | break;
|
---|
| 1003 | case DIR_FOLDERICON:
|
---|
| 1004 | s = GetPString(IDS_ARCCNRFOLDERHELPTEXT);
|
---|
| 1005 | break;
|
---|
| 1006 | default:
|
---|
| 1007 | break;
|
---|
| 1008 | }
|
---|
| 1009 | if (s)
|
---|
| 1010 | MakeBubble(hwnd, TRUE, s);
|
---|
| 1011 | else if (hwndBubble)
|
---|
| 1012 | WinDestroyWindow(hwndBubble);
|
---|
| 1013 | }
|
---|
[2] | 1014 | }
|
---|
[551] | 1015 | switch (id) {
|
---|
| 1016 | case DIR_FILTER:
|
---|
| 1017 | case DIR_SORT:
|
---|
| 1018 | case DIR_VIEW:
|
---|
| 1019 | case DIR_SELECTED:
|
---|
| 1020 | case DIR_FOLDERICON:
|
---|
| 1021 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
---|
| 1022 | }
|
---|
| 1023 | }
|
---|
| 1024 | break;
|
---|
[2] | 1025 |
|
---|
[551] | 1026 | case WM_BUTTON3UP:
|
---|
| 1027 | case WM_BUTTON1UP:
|
---|
| 1028 | case WM_BUTTON1DOWN:
|
---|
| 1029 | case WM_BUTTON3DOWN:
|
---|
| 1030 | {
|
---|
| 1031 | USHORT id;
|
---|
[2] | 1032 |
|
---|
[551] | 1033 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
| 1034 | switch (id) {
|
---|
| 1035 | case DIR_FILTER:
|
---|
| 1036 | case DIR_SORT:
|
---|
| 1037 | case DIR_VIEW:
|
---|
| 1038 | case DIR_SELECTED:
|
---|
| 1039 | case DIR_FOLDERICON:
|
---|
| 1040 | return CommonTextButton(hwnd, msg, mp1, mp2);
|
---|
[2] | 1041 | }
|
---|
[551] | 1042 | }
|
---|
| 1043 | break;
|
---|
[2] | 1044 |
|
---|
[551] | 1045 | case UM_CLICKED:
|
---|
| 1046 | case UM_CLICKED3:
|
---|
| 1047 | {
|
---|
| 1048 | USHORT id, cmd = 0;
|
---|
[2] | 1049 |
|
---|
[551] | 1050 | id = WinQueryWindowUShort(hwnd, QWS_ID);
|
---|
| 1051 | switch (id) {
|
---|
| 1052 | case DIR_FOLDERICON:
|
---|
| 1053 | switch (msg) {
|
---|
| 1054 | case WM_BUTTON3CLICK:
|
---|
| 1055 | case WM_CHORD:
|
---|
| 1056 | cmd = IDM_RESCAN;
|
---|
| 1057 | break;
|
---|
| 1058 | default:
|
---|
| 1059 | if ((SHORT2FROMMP(mp2) & KC_ALT) != 0)
|
---|
| 1060 | cmd = IDM_WINDOWDLG;
|
---|
| 1061 | else
|
---|
| 1062 | cmd = IDM_WALKDIR;
|
---|
| 1063 | break;
|
---|
| 1064 | }
|
---|
| 1065 | break;
|
---|
| 1066 | case DIR_VIEW:
|
---|
| 1067 | case DIR_SORT:
|
---|
| 1068 | case DIR_SELECTED:
|
---|
| 1069 | PostMsg(hwnd, UM_CONTEXTMENU, MPVOID, MPVOID);
|
---|
| 1070 | break;
|
---|
| 1071 | case DIR_FILTER:
|
---|
| 1072 | cmd = IDM_FILTER;
|
---|
| 1073 | break;
|
---|
| 1074 | default:
|
---|
| 1075 | break;
|
---|
[2] | 1076 | }
|
---|
[551] | 1077 | if (cmd)
|
---|
| 1078 | PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 1079 | ARC_CNR),
|
---|
| 1080 | WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
|
---|
| 1081 | }
|
---|
| 1082 | return 0;
|
---|
[2] | 1083 |
|
---|
[551] | 1084 | case WM_BEGINDRAG:
|
---|
| 1085 | case DM_DROP:
|
---|
| 1086 | case DM_DRAGOVER:
|
---|
| 1087 | case DM_DRAGLEAVE:
|
---|
| 1088 | case DM_DROPHELP:
|
---|
| 1089 | if (msg == DM_DRAGOVER) {
|
---|
| 1090 | if (!emphasized) {
|
---|
| 1091 | emphasized = TRUE;
|
---|
| 1092 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
[2] | 1093 | }
|
---|
[551] | 1094 | }
|
---|
| 1095 | else if (msg != WM_BEGINDRAG) {
|
---|
| 1096 | if (emphasized) {
|
---|
| 1097 | emphasized = FALSE;
|
---|
| 1098 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
[2] | 1099 | }
|
---|
[551] | 1100 | }
|
---|
| 1101 | switch (WinQueryWindowUShort(hwnd, QWS_ID)) {
|
---|
| 1102 | case DIR_FOLDERICON:
|
---|
| 1103 | switch (msg) {
|
---|
| 1104 | case DM_DRAGOVER:
|
---|
[618] | 1105 | if (AcceptOneDrop(hwnd, mp1, mp2))
|
---|
[551] | 1106 | return MRFROM2SHORT(DOR_DROP, DO_MOVE);
|
---|
[562] | 1107 | return MRFROM2SHORT(DOR_NODROP, 0); /* Drop not valid */
|
---|
[551] | 1108 | case DM_DROPHELP:
|
---|
| 1109 | DropHelp(mp1, mp2, hwnd, GetPString(IDS_ARCCNRFOLDERDROPHELPTEXT));
|
---|
| 1110 | return 0;
|
---|
| 1111 | case DM_DROP:
|
---|
| 1112 | {
|
---|
| 1113 | char szFrom[CCHMAXPATH + 2];
|
---|
[2] | 1114 |
|
---|
[551] | 1115 | if (emphasized) {
|
---|
| 1116 | emphasized = FALSE;
|
---|
| 1117 | DrawTargetEmphasis(hwnd, emphasized);
|
---|
| 1118 | }
|
---|
[618] | 1119 | if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom)))
|
---|
[551] | 1120 | WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 1121 | ARC_CNR),
|
---|
| 1122 | WM_COMMAND,
|
---|
| 1123 | MPFROM2SHORT(IDM_SWITCH, 0), MPFROMP(szFrom));
|
---|
| 1124 | }
|
---|
| 1125 | return 0;
|
---|
| 1126 | default:
|
---|
| 1127 | return PFNWPStatic(hwnd, msg, mp1, mp2);
|
---|
| 1128 | }
|
---|
| 1129 | default:
|
---|
| 1130 | {
|
---|
| 1131 | CNRDRAGINFO cnd;
|
---|
| 1132 | USHORT dcmd;
|
---|
[2] | 1133 |
|
---|
[551] | 1134 | switch (msg) {
|
---|
| 1135 | case DM_DROP:
|
---|
| 1136 | dcmd = CN_DROP;
|
---|
| 1137 | break;
|
---|
| 1138 | case DM_DRAGOVER:
|
---|
| 1139 | dcmd = CN_DRAGOVER;
|
---|
| 1140 | break;
|
---|
| 1141 | case DM_DRAGLEAVE:
|
---|
| 1142 | dcmd = CN_DRAGLEAVE;
|
---|
| 1143 | break;
|
---|
| 1144 | case DM_DROPHELP:
|
---|
| 1145 | dcmd = CN_DROPHELP;
|
---|
| 1146 | break;
|
---|
| 1147 | case WM_BEGINDRAG:
|
---|
| 1148 | dcmd = CN_INITDRAG;
|
---|
| 1149 | break;
|
---|
| 1150 | }
|
---|
| 1151 | cnd.pDragInfo = (PDRAGINFO) mp1;
|
---|
| 1152 | cnd.pRecord = NULL;
|
---|
| 1153 | return WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 1154 | WM_CONTROL,
|
---|
| 1155 | MPFROM2SHORT(ARC_CNR, dcmd), MPFROMP(&cnd));
|
---|
[2] | 1156 | }
|
---|
[551] | 1157 | }
|
---|
[2] | 1158 | }
|
---|
[551] | 1159 | return PFNWPStatic(hwnd, msg, mp1, mp2);
|
---|
[2] | 1160 | }
|
---|
| 1161 |
|
---|
[551] | 1162 | MRESULT EXPENTRY ArcClientWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
| 1163 | MPARAM mp2)
|
---|
| 1164 | {
|
---|
[2] | 1165 |
|
---|
[551] | 1166 | switch (msg) {
|
---|
| 1167 | case UM_CONTAINERHWND:
|
---|
| 1168 | return MRFROMLONG(WinWindowFromID(hwnd, ARC_CNR));
|
---|
[2] | 1169 |
|
---|
[551] | 1170 | case UM_VIEWSMENU:
|
---|
| 1171 | // fixme to disble menu items as needed
|
---|
[872] | 1172 | return MRFROMLONG(CheckMenu(hwnd, &ArcCnrMenu, ARCCNR_POPUP));
|
---|
[2] | 1173 |
|
---|
[551] | 1174 | case UM_FILESMENU:
|
---|
| 1175 | // fixme to disble menu items as needed
|
---|
[872] | 1176 | return MRFROMLONG(CheckMenu(hwnd, &ArcMenu, ARC_POPUP));
|
---|
[2] | 1177 |
|
---|
[551] | 1178 | case MM_PORTHOLEINIT:
|
---|
| 1179 | case WM_INITMENU:
|
---|
| 1180 | case UM_INITMENU:
|
---|
| 1181 | case UM_COMMAND:
|
---|
| 1182 | case UM_LOADFILE:
|
---|
| 1183 | case UM_UPDATERECORD:
|
---|
| 1184 | case UM_UPDATERECORDLIST:
|
---|
| 1185 | case WM_COMMAND:
|
---|
| 1186 | case WM_CONTROL:
|
---|
| 1187 | case WM_CLOSE:
|
---|
| 1188 | return WinSendMsg(WinWindowFromID(hwnd, ARC_CNR), msg, mp1, mp2);
|
---|
[2] | 1189 |
|
---|
[551] | 1190 | case WM_PSETFOCUS:
|
---|
| 1191 | case WM_SETFOCUS:
|
---|
| 1192 | if (mp2)
|
---|
| 1193 | PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
|
---|
| 1194 | break;
|
---|
[2] | 1195 |
|
---|
[551] | 1196 | case UM_FOCUSME:
|
---|
| 1197 | WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, ARC_CNR));
|
---|
| 1198 | break;
|
---|
[2] | 1199 |
|
---|
[551] | 1200 | case WM_PAINT:
|
---|
| 1201 | {
|
---|
| 1202 | HPS hps;
|
---|
| 1203 | RECTL rcl;
|
---|
[2] | 1204 |
|
---|
[551] | 1205 | hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
|
---|
| 1206 | if (hps) {
|
---|
| 1207 | WinQueryWindowRect(hwnd, &rcl);
|
---|
| 1208 | WinFillRect(hps, &rcl, CLR_PALEGRAY);
|
---|
| 1209 | CommonTextPaint(hwnd, hps);
|
---|
| 1210 | WinEndPaint(hps);
|
---|
[2] | 1211 | }
|
---|
[551] | 1212 | }
|
---|
| 1213 | break;
|
---|
[2] | 1214 |
|
---|
[551] | 1215 | case UM_SIZE:
|
---|
| 1216 | case WM_SIZE:
|
---|
| 1217 | if (msg == UM_SIZE) {
|
---|
[2] | 1218 |
|
---|
[551] | 1219 | SWP swp;
|
---|
[2] | 1220 |
|
---|
[551] | 1221 | WinQueryWindowPos(hwnd, &swp);
|
---|
| 1222 | mp1 = MPFROM2SHORT(swp.cx, swp.cy);
|
---|
| 1223 | mp2 = MPFROM2SHORT(swp.cx, swp.cy);
|
---|
| 1224 | }
|
---|
| 1225 | {
|
---|
| 1226 | USHORT cx, cy, bx;
|
---|
[2] | 1227 |
|
---|
[551] | 1228 | cx = SHORT1FROMMP(mp2);
|
---|
| 1229 | cy = SHORT2FROMMP(mp2);
|
---|
| 1230 | WinSetWindowPos(WinWindowFromID(hwnd, ARC_CNR), HWND_TOP,
|
---|
| 1231 | 0,
|
---|
| 1232 | 22, cx, cy - (24 + 22), SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
| 1233 | WinSetWindowPos(WinWindowFromID(hwnd, ARC_EXTRACTDIR), HWND_TOP,
|
---|
| 1234 | 0, 0, cx, 22, SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
| 1235 | WinSetWindowPos(WinWindowFromID(hwnd, DIR_FOLDERICON), HWND_TOP,
|
---|
| 1236 | 2, cy - 22, 24, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
| 1237 | WinSetWindowPos(WinWindowFromID(hwnd, DIR_TOTALS), HWND_TOP,
|
---|
| 1238 | 29,
|
---|
| 1239 | cy - 22,
|
---|
| 1240 | (cx / 3) - 2, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
| 1241 | WinSetWindowPos(WinWindowFromID(hwnd, DIR_SELECTED), HWND_TOP,
|
---|
| 1242 | 29 + (cx / 3) + 2,
|
---|
| 1243 | cy - 22,
|
---|
| 1244 | (cx / 3) - 2, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
| 1245 | bx = (cx - (29 + (((cx / 3) + 2) * 2))) / 3;
|
---|
| 1246 | WinSetWindowPos(WinWindowFromID(hwnd, DIR_VIEW), HWND_TOP,
|
---|
| 1247 | 29 + (((cx / 3) + 2) * 2),
|
---|
| 1248 | cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
| 1249 | WinSetWindowPos(WinWindowFromID(hwnd, DIR_SORT), HWND_TOP,
|
---|
| 1250 | 29 + (((cx / 3) + 2) * 2) + bx,
|
---|
| 1251 | cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
| 1252 | WinSetWindowPos(WinWindowFromID(hwnd, DIR_FILTER), HWND_TOP,
|
---|
| 1253 | 29 + (((cx / 3) + 2) * 2) + (bx * 2),
|
---|
| 1254 | cy - 22, bx - 4, 20, SWP_SHOW | SWP_MOVE | SWP_SIZE);
|
---|
| 1255 | }
|
---|
| 1256 | CommonTextPaint(hwnd, (HPS) 0);
|
---|
| 1257 | if (msg == UM_SIZE) {
|
---|
| 1258 | WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0,
|
---|
| 1259 | SWP_SHOW | SWP_ZORDER | SWP_ACTIVATE);
|
---|
| 1260 | return 0;
|
---|
| 1261 | }
|
---|
| 1262 | break;
|
---|
[2] | 1263 | }
|
---|
[551] | 1264 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 1265 | }
|
---|
| 1266 |
|
---|
[551] | 1267 | MRESULT EXPENTRY ArcObjWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
[172] | 1268 | {
|
---|
[2] | 1269 | DIRCNRDATA *dcd;
|
---|
[358] | 1270 | PSZ psz;
|
---|
[773] | 1271 | CHAR szQuotedArcName[CCHMAXPATH];
|
---|
| 1272 | CHAR szQuotedMemberName[CCHMAXPATH];
|
---|
[2] | 1273 |
|
---|
[551] | 1274 | switch (msg) {
|
---|
| 1275 | case DM_PRINTOBJECT:
|
---|
| 1276 | case DM_DISCARDOBJECT:
|
---|
| 1277 | dcd = INSTDATA(hwnd);
|
---|
| 1278 | if (dcd) {
|
---|
[2] | 1279 |
|
---|
[551] | 1280 | LISTINFO *li;
|
---|
| 1281 | CNRDRAGINFO cni;
|
---|
[2] | 1282 |
|
---|
[551] | 1283 | cni.pRecord = NULL;
|
---|
| 1284 | cni.pDragInfo = (PDRAGINFO) mp1;
|
---|
| 1285 | li = DoFileDrop(dcd->hwndCnr,
|
---|
[762] | 1286 | dcd->directory, FALSE, MPVOID, MPFROMP(&cni));
|
---|
[687] | 1287 | CheckPmDrgLimit(cni.pDragInfo);
|
---|
[551] | 1288 | if (li) {
|
---|
| 1289 | li->type = (msg == DM_DISCARDOBJECT) ? IDM_DELETE : IDM_PRINT;
|
---|
| 1290 | if (!li->list ||
|
---|
| 1291 | !li->list[0] || !PostMsg(hwnd, UM_ACTION, MPFROMP(li), MPVOID))
|
---|
| 1292 | FreeListInfo(li);
|
---|
| 1293 | else
|
---|
| 1294 | return MRFROMLONG(DRR_SOURCE);
|
---|
[2] | 1295 | }
|
---|
[551] | 1296 | }
|
---|
| 1297 | return MRFROMLONG(DRR_TARGET);
|
---|
[2] | 1298 |
|
---|
[551] | 1299 | case DM_RENDERPREPARE:
|
---|
| 1300 | return (MRESULT) TRUE;
|
---|
[2] | 1301 |
|
---|
[551] | 1302 | case DM_RENDER:
|
---|
| 1303 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
| 1304 | if (dcd && dcd->info && dcd->info->extract && dcd->arcname) {
|
---|
[2] | 1305 |
|
---|
[551] | 1306 | PDRAGTRANSFER pdt = (PDRAGTRANSFER) mp1;
|
---|
| 1307 | CHAR filename[CCHMAXPATH];
|
---|
| 1308 | ULONG len;
|
---|
[2] | 1309 |
|
---|
[551] | 1310 | if (pdt->hwndClient && pdt->pditem && pdt->hstrSelectedRMF &&
|
---|
| 1311 | pdt->hstrRenderToName) {
|
---|
| 1312 | if (pdt->usOperation == DO_COPY || pdt->usOperation == DO_MOVE) {
|
---|
| 1313 | *filename = 0;
|
---|
| 1314 | len = DrgQueryStrName(pdt->hstrSelectedRMF, CCHMAXPATH, filename);
|
---|
| 1315 | filename[len] = 0;
|
---|
| 1316 | if (!strnicmp(filename, "OS2FILE,", 8)) {
|
---|
| 1317 | // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"RMF = \"%s\"",filename);
|
---|
| 1318 | }
|
---|
| 1319 | else {
|
---|
| 1320 | *filename = 0;
|
---|
| 1321 | len =
|
---|
| 1322 | DrgQueryStrName(pdt->hstrRenderToName, CCHMAXPATH, filename);
|
---|
| 1323 | filename[len] = 0;
|
---|
| 1324 | if (len && *filename) {
|
---|
| 1325 | psz = xstrdup(filename, pszSrcFile, __LINE__);
|
---|
| 1326 | if (psz) {
|
---|
| 1327 | PostMsg(hwnd, UM_RENDER, MPFROMP(pdt), MPFROMP(psz));
|
---|
| 1328 | return (MRESULT) TRUE;
|
---|
| 1329 | }
|
---|
| 1330 | }
|
---|
[358] | 1331 | else {
|
---|
[551] | 1332 | // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"No render-to name given.");
|
---|
[358] | 1333 | }
|
---|
| 1334 | }
|
---|
[551] | 1335 | }
|
---|
| 1336 | pdt->fsReply = DMFL_RENDERRETRY;
|
---|
[2] | 1337 | }
|
---|
[551] | 1338 | }
|
---|
| 1339 | return (MRESULT) FALSE;
|
---|
[2] | 1340 |
|
---|
[551] | 1341 | case UM_RENDER:
|
---|
| 1342 | {
|
---|
| 1343 | PDRAGTRANSFER pdt = (PDRAGTRANSFER) mp1;
|
---|
| 1344 | USHORT usRes = DMFL_RENDERFAIL;
|
---|
[2] | 1345 |
|
---|
[551] | 1346 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
| 1347 | if (dcd && dcd->info && dcd->info->extract && dcd->arcname) {
|
---|
[2] | 1348 |
|
---|
[551] | 1349 | CHAR *filename = (CHAR *) mp2, *p;
|
---|
| 1350 | ULONG len;
|
---|
| 1351 | CHAR membername[CCHMAXPATH], construct[CCHMAXPATH * 2];
|
---|
[2] | 1352 |
|
---|
[551] | 1353 | *membername = 0;
|
---|
| 1354 | len = DrgQueryStrName(pdt->pditem->hstrSourceName,
|
---|
| 1355 | CCHMAXPATH, membername);
|
---|
| 1356 | membername[len] = 0;
|
---|
| 1357 | if (*membername && len && filename) {
|
---|
| 1358 | unlinkf("%s", filename);
|
---|
| 1359 | strcpy(construct, filename);
|
---|
| 1360 | p = strrchr(filename, '\\');
|
---|
| 1361 | if (!p)
|
---|
| 1362 | *construct = 0;
|
---|
| 1363 | else {
|
---|
| 1364 | if (p == filename || *(p - 1) == ':')
|
---|
| 1365 | p++;
|
---|
| 1366 | *p = 0;
|
---|
| 1367 | }
|
---|
| 1368 | // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"%s %s %s\r[%s]",dcd->info->extract,dcd->arcname,membername,construct);
|
---|
| 1369 | runemf2(SEPARATE | WINDOWED | WAIT |
|
---|
[888] | 1370 | (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED),
|
---|
| 1371 | dcd->hwndClient, pszSrcFile, __LINE__, construct, NULL,
|
---|
[773] | 1372 | "%s %s %s",
|
---|
[551] | 1373 | dcd->info->extract,
|
---|
[773] | 1374 | BldQuotedFileName(szQuotedArcName, dcd->arcname),
|
---|
| 1375 | BldQuotedFileName(szQuotedMemberName, membername));
|
---|
| 1376 | BldFullPathName(construct, construct, membername);
|
---|
[551] | 1377 | if (IsFile(construct) != -1) {
|
---|
| 1378 | rename(construct, filename);
|
---|
| 1379 | unlinkf("%s", construct);
|
---|
| 1380 | if (IsFile(filename) != -1)
|
---|
| 1381 | usRes = DMFL_RENDEROK;
|
---|
| 1382 | }
|
---|
| 1383 | }
|
---|
[2] | 1384 | }
|
---|
[551] | 1385 | if (mp2)
|
---|
| 1386 | free((CHAR *) mp2);
|
---|
| 1387 | PostMsg(pdt->hwndClient, DM_RENDERCOMPLETE, MPFROMP(pdt),
|
---|
| 1388 | MPFROM2SHORT(usRes, 0));
|
---|
| 1389 | }
|
---|
| 1390 | return 0;
|
---|
[2] | 1391 |
|
---|
[551] | 1392 | case UM_SETUP:
|
---|
| 1393 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
| 1394 | if (!dcd) {
|
---|
| 1395 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
| 1396 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
| 1397 | }
|
---|
| 1398 | else {
|
---|
| 1399 | /* set unique id */
|
---|
| 1400 | WinSetWindowUShort(hwnd, QWS_ID, ARCOBJ_FRAME + (ARC_FRAME - dcd->id));
|
---|
| 1401 | dcd->hwndObject = hwnd; // pass back hwnd
|
---|
| 1402 | if (ParentIsDesktop(hwnd, dcd->hwndParent))
|
---|
[771] | 1403 | DosSleep(100); //05 Aug 07 GKY 250 // Avoid race?
|
---|
[551] | 1404 | }
|
---|
| 1405 | return 0;
|
---|
| 1406 |
|
---|
| 1407 | case UM_RESCAN:
|
---|
| 1408 | /*
|
---|
| 1409 | * populate container
|
---|
| 1410 | */
|
---|
| 1411 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
| 1412 | if (dcd) {
|
---|
| 1413 | if (mp1)
|
---|
| 1414 | strcpy(dcd->arcname, (CHAR *) mp1); // Update name on request
|
---|
| 1415 | dcd->ullTotalBytes = dcd->totalfiles =
|
---|
| 1416 | dcd->selectedfiles = dcd->selectedbytes = 0;
|
---|
| 1417 | WinSetDlgItemText(dcd->hwndClient, DIR_TOTALS, "0");
|
---|
| 1418 | WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, "0 / 0k");
|
---|
| 1419 | dcd->totalfiles = FillArcCnr(dcd->hwndCnr,
|
---|
| 1420 | dcd->arcname,
|
---|
| 1421 | &dcd->info,
|
---|
| 1422 | &dcd->ullTotalBytes, &dcd->stopflag);
|
---|
| 1423 | if (!dcd->totalfiles)
|
---|
| 1424 | PostMsg(dcd->hwndCnr, WM_CLOSE, MPVOID, MPVOID);
|
---|
[423] | 1425 | else {
|
---|
[551] | 1426 | dcd->arcfilled = TRUE;
|
---|
| 1427 | if (!PostMsg(dcd->hwndCnr, UM_RESCAN, MPVOID, MPVOID))
|
---|
| 1428 | WinSendMsg(dcd->hwndCnr, UM_RESCAN, MPVOID, MPVOID);
|
---|
| 1429 | PostMsg(dcd->hwndCnr, UM_SETUP2, MPVOID, MPVOID);
|
---|
| 1430 | WinSendMsg(dcd->hwndCnr,
|
---|
| 1431 | CM_INVALIDATERECORD,
|
---|
| 1432 | MPVOID, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
|
---|
[2] | 1433 | }
|
---|
[551] | 1434 | }
|
---|
| 1435 | return 0;
|
---|
[2] | 1436 |
|
---|
[551] | 1437 | case UM_SELECT:
|
---|
| 1438 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
| 1439 | if (dcd) {
|
---|
| 1440 | switch (SHORT1FROMMP(mp1)) {
|
---|
| 1441 | case IDM_SELECTALL:
|
---|
| 1442 | case IDM_SELECTALLFILES:
|
---|
| 1443 | SelectAll(dcd->hwndCnr, TRUE, TRUE, NULL, NULL, TRUE);
|
---|
| 1444 | break;
|
---|
| 1445 | case IDM_DESELECTALL:
|
---|
| 1446 | case IDM_DESELECTALLFILES:
|
---|
| 1447 | DeselectAll(dcd->hwndCnr, TRUE, TRUE, NULL, NULL, TRUE);
|
---|
| 1448 | break;
|
---|
| 1449 | case IDM_DESELECTMASK:
|
---|
| 1450 | case IDM_SELECTMASK:
|
---|
| 1451 | {
|
---|
| 1452 | MASK mask;
|
---|
| 1453 | PARCITEM pci = (PARCITEM) mp2;
|
---|
[2] | 1454 |
|
---|
[551] | 1455 | memset(&mask, 0, sizeof(MASK));
|
---|
| 1456 | mask.fNoAttribs = TRUE;
|
---|
| 1457 | mask.fNoDirs = TRUE;
|
---|
| 1458 | strcpy(mask.prompt,
|
---|
| 1459 | GetPString((SHORT1FROMMP(mp1) == IDM_SELECTMASK) ?
|
---|
| 1460 | IDS_SELECTFILTERTEXT : IDS_DESELECTFILTERTEXT));
|
---|
| 1461 | if (pci && (INT) pci != -1)
|
---|
[730] | 1462 | strcpy(mask.szMask, pci->pszFileName);
|
---|
[551] | 1463 | if (WinDlgBox(HWND_DESKTOP, dcd->hwndCnr, PickMaskDlgProc,
|
---|
| 1464 | FM3ModHandle, MSK_FRAME, MPFROMP(&mask))) {
|
---|
| 1465 | if (SHORT1FROMMP(mp1) == IDM_SELECTMASK)
|
---|
| 1466 | SelectAll(dcd->hwndCnr, TRUE, TRUE, mask.szMask, NULL, FALSE);
|
---|
| 1467 | else
|
---|
| 1468 | DeselectAll(dcd->hwndCnr, TRUE, TRUE, mask.szMask, NULL, FALSE);
|
---|
| 1469 | }
|
---|
| 1470 | }
|
---|
[2] | 1471 |
|
---|
[551] | 1472 | case IDM_INVERT:
|
---|
| 1473 | InvertAll(dcd->hwndCnr);
|
---|
| 1474 | break;
|
---|
[2] | 1475 | }
|
---|
[551] | 1476 | }
|
---|
| 1477 | return 0;
|
---|
[2] | 1478 |
|
---|
[551] | 1479 | case UM_ENTER:
|
---|
| 1480 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
| 1481 | if (dcd) {
|
---|
[2] | 1482 |
|
---|
[551] | 1483 | CHAR *s = (CHAR *) mp1, *p, *pp, filename[CCHMAXPATH];
|
---|
[2] | 1484 |
|
---|
[551] | 1485 | if (s) {
|
---|
| 1486 | if (!dcd->info->extract) {
|
---|
| 1487 | Runtime_Error(pszSrcFile, __LINE__, "no extract");
|
---|
| 1488 | free(s);
|
---|
| 1489 | return 0;
|
---|
| 1490 | }
|
---|
[773] | 1491 | runemf2(SEPARATE | WINDOWED | WAIT |
|
---|
[888] | 1492 | (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED),
|
---|
| 1493 | dcd->hwndClient, pszSrcFile, __LINE__, dcd->workdir, NULL,
|
---|
[773] | 1494 | "%s %s %s",
|
---|
[562] | 1495 | dcd->info->exwdirs ? dcd->info->exwdirs :
|
---|
| 1496 | dcd->info->extract,
|
---|
[773] | 1497 | BldQuotedFileName(szQuotedArcName, dcd->arcname),
|
---|
| 1498 | BldQuotedFileName(szQuotedMemberName, s));
|
---|
[551] | 1499 | if (!dcd->info->exwdirs) {
|
---|
| 1500 | p = s;
|
---|
| 1501 | p = strrchr(s, '\\');
|
---|
| 1502 | pp = strrchr(s, '/');
|
---|
| 1503 | if (p && pp)
|
---|
| 1504 | p = max(p, pp);
|
---|
| 1505 | else if (!p)
|
---|
| 1506 | p = pp;
|
---|
| 1507 | if (p)
|
---|
| 1508 | memmove(s, p + 1, strlen(p + 1));
|
---|
| 1509 | }
|
---|
| 1510 | sprintf(filename, "%s\\%s", dcd->workdir, s);
|
---|
| 1511 | p = filename;
|
---|
| 1512 | while (*p) {
|
---|
| 1513 | if (*p == '/')
|
---|
| 1514 | *p = '\\';
|
---|
| 1515 | p++;
|
---|
| 1516 | }
|
---|
[562] | 1517 | // printf("%s %d UM_ENTER %s %s\n",__FILE__, __LINE__,filename, s); fflush(stdout); // 10 Mar 07 SHL hang
|
---|
[551] | 1518 | free(s);
|
---|
[562] | 1519 | if (IsFile(filename) == 1) {
|
---|
[570] | 1520 | if (fViewChild && fArcStuffVisible)
|
---|
[835] | 1521 | DosSleep(100); // Allow unzip session to finish closing 14 Mar 07 SHL
|
---|
[551] | 1522 | WinSendMsg(dcd->hwndCnr, UM_ENTER, MPFROMP(filename), MPVOID);
|
---|
[562] | 1523 | }
|
---|
[2] | 1524 | }
|
---|
[551] | 1525 | }
|
---|
| 1526 | return 0;
|
---|
[2] | 1527 |
|
---|
[551] | 1528 | case UM_COMMAND:
|
---|
| 1529 | if (mp1) {
|
---|
| 1530 | if (PostMsg(hwnd, UM_ACTION, mp1, mp2))
|
---|
| 1531 | return (MRESULT) TRUE;
|
---|
| 1532 | }
|
---|
| 1533 | return 0;
|
---|
[2] | 1534 |
|
---|
[551] | 1535 | case UM_ACTION:
|
---|
| 1536 | DosError(FERR_DISABLEHARDERR);
|
---|
| 1537 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
| 1538 | if (dcd) {
|
---|
[2] | 1539 |
|
---|
[551] | 1540 | LISTINFO *li = (LISTINFO *) mp1;
|
---|
| 1541 | register INT x;
|
---|
[2] | 1542 |
|
---|
[551] | 1543 | if (li && li->list && li->list[0]) {
|
---|
| 1544 | switch (li->type) {
|
---|
| 1545 | case IDM_ARCHIVE:
|
---|
| 1546 | case IDM_ARCHIVEM:
|
---|
| 1547 | {
|
---|
| 1548 | DIRCNRDATA ad;
|
---|
| 1549 | CHAR szBuffer[1025], *p;
|
---|
[2] | 1550 |
|
---|
[551] | 1551 | if (!li->list[1] && !stricmp(li->list[0], dcd->arcname)) {
|
---|
| 1552 | Runtime_Error(pszSrcFile, __LINE__, "arc to self");
|
---|
| 1553 | break;
|
---|
| 1554 | }
|
---|
| 1555 | ad = *dcd;
|
---|
| 1556 | ad.namecanchange = 0;
|
---|
| 1557 | ad.fmoving = (li->type == IDM_ARCHIVEM);
|
---|
| 1558 | if (!WinDlgBox(HWND_DESKTOP, dcd->hwndClient, ArchiveDlgProc, FM3ModHandle, ARCH_FRAME, (PVOID) & ad) || !*ad.arcname || !*ad.command) /* we blew it */
|
---|
| 1559 | break;
|
---|
| 1560 | /* build the sucker */
|
---|
| 1561 | strcpy(szBuffer, ad.command);
|
---|
| 1562 | strcat(szBuffer, " ");
|
---|
[773] | 1563 |
|
---|
| 1564 | BldQuotedFileName(szBuffer + strlen(szBuffer), ad.arcname);
|
---|
| 1565 |
|
---|
| 1566 | p = &szBuffer[strlen(szBuffer)]; // Remeber where archiver name ends
|
---|
| 1567 |
|
---|
[551] | 1568 | if (ad.mask.szMask) {
|
---|
| 1569 | strcat(szBuffer, " ");
|
---|
[773] | 1570 |
|
---|
| 1571 | BldQuotedFileName(szBuffer + strlen(szBuffer), ad.mask.szMask);
|
---|
[551] | 1572 | }
|
---|
| 1573 | strcat(szBuffer, " ");
|
---|
| 1574 | x = 0;
|
---|
[773] | 1575 |
|
---|
| 1576 | // Run commands avoiding command line overflow
|
---|
[551] | 1577 | while (li->list[x]) {
|
---|
[773] | 1578 |
|
---|
| 1579 | if (IsFile(li->list[x]))
|
---|
[888] | 1580 | BldQuotedFileName(szBuffer + strlen(szBuffer), li->list[x]);
|
---|
[773] | 1581 | else
|
---|
[888] | 1582 | BldQuotedFullPathName(szBuffer + strlen(szBuffer), li->list[x], "*");
|
---|
[773] | 1583 |
|
---|
[551] | 1584 | x++;
|
---|
| 1585 | if (!li->list[x] || strlen(szBuffer) +
|
---|
| 1586 | strlen(li->list[x]) + 5 > 1024) {
|
---|
| 1587 | runemf2(SEPARATE | WINDOWED |
|
---|
[888] | 1588 | (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED) |
|
---|
| 1589 | WAIT, hwnd, pszSrcFile, __LINE__,
|
---|
| 1590 | NULL, NULL, "%s", szBuffer);
|
---|
[551] | 1591 | *p = 0;
|
---|
| 1592 | }
|
---|
| 1593 | strcat(szBuffer, " ");
|
---|
[773] | 1594 | } // while
|
---|
| 1595 |
|
---|
[551] | 1596 | PostMsg(dcd->hwndCnr, UM_RESCAN, MPFROMSHORT(1), MPVOID);
|
---|
| 1597 | Broadcast(WinQueryAnchorBlock(hwnd),
|
---|
| 1598 | hwndMain, UM_UPDATERECORD, MPFROMP(ad.arcname), MPVOID);
|
---|
| 1599 | Broadcast(WinQueryAnchorBlock(hwnd),
|
---|
| 1600 | hwndMain,
|
---|
| 1601 | UM_UPDATERECORDLIST, MPFROMP(li->list), MPVOID);
|
---|
| 1602 | }
|
---|
| 1603 | break;
|
---|
[2] | 1604 |
|
---|
[551] | 1605 | case IDM_REFRESH:
|
---|
| 1606 | case IDM_DELETE:
|
---|
| 1607 | {
|
---|
| 1608 | CHAR cl[1001], *endofit;
|
---|
| 1609 | INT z;
|
---|
| 1610 | CHECKLIST ck;
|
---|
| 1611 | CHAR prompt[CCHMAXPATH + 257];
|
---|
[2] | 1612 |
|
---|
[551] | 1613 | if (!dcd->info->delete)
|
---|
| 1614 | break;
|
---|
| 1615 | memset(&ck, 0, sizeof(ck));
|
---|
| 1616 | ck.size = sizeof(ck);
|
---|
| 1617 | ck.list = li->list;
|
---|
| 1618 | ck.cmd = li->type;
|
---|
| 1619 | ck.prompt = prompt;
|
---|
| 1620 | sprintf(prompt, GetPString(IDS_ARCCNRDELREFTEXT),
|
---|
| 1621 | (li->type == IDM_DELETE) ?
|
---|
| 1622 | GetPString(IDS_DELETELOWERTEXT) :
|
---|
| 1623 | GetPString(IDS_REFRESHLOWERTEXT),
|
---|
| 1624 | &"s"[li->list[1] == NULL],
|
---|
| 1625 | dcd->arcname,
|
---|
| 1626 | (li->type == IDM_DELETE) ?
|
---|
| 1627 | GetPString(IDS_DELETELOWERTEXT) :
|
---|
| 1628 | GetPString(IDS_REFRESHLOWERTEXT));
|
---|
| 1629 | if (!WinDlgBox(HWND_DESKTOP, hwnd, CheckListProc,
|
---|
| 1630 | FM3ModHandle, CHECK_FRAME, MPFROMP(&ck)))
|
---|
| 1631 | break;
|
---|
| 1632 | li->list = ck.list;
|
---|
| 1633 | if (!li->list || !li->list[0])
|
---|
| 1634 | break;
|
---|
[773] | 1635 | strcpy(cl, li->type == IDM_DELETE ?
|
---|
| 1636 | dcd->info->delete :
|
---|
| 1637 | dcd->info->create);
|
---|
| 1638 | strcat(cl, " ");
|
---|
| 1639 | BldQuotedFileName(cl + strlen(cl), dcd->arcname);
|
---|
[551] | 1640 | endofit = &cl[strlen(cl)];
|
---|
| 1641 | z = 0;
|
---|
| 1642 | do {
|
---|
| 1643 | for (x = z; li->list[x] &&
|
---|
[888] | 1644 | strlen(cl) + strlen(li->list[x]) < 999; x++) {
|
---|
[551] | 1645 | strcat(cl, " ");
|
---|
[773] | 1646 | BldQuotedFileName(cl + strlen(cl), li->list[x]);
|
---|
[551] | 1647 | }
|
---|
| 1648 | z = x;
|
---|
[773] | 1649 | runemf2(SEPARATE | WINDOWED | WAIT |
|
---|
[888] | 1650 | (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED),
|
---|
| 1651 | hwnd, pszSrcFile, __LINE__, NullStr, NULL, "%s", cl);
|
---|
[551] | 1652 | *endofit = 0;
|
---|
| 1653 | } while (li->list[x]);
|
---|
| 1654 | PostMsg(dcd->hwndCnr, UM_RESCAN, MPFROMSHORT(1), MPVOID);
|
---|
| 1655 | Broadcast(WinQueryAnchorBlock(hwnd),
|
---|
| 1656 | hwndMain,
|
---|
| 1657 | UM_UPDATERECORD, MPFROMP(dcd->arcname), MPVOID);
|
---|
| 1658 | }
|
---|
| 1659 | break;
|
---|
[2] | 1660 |
|
---|
[551] | 1661 | case IDM_PRINT:
|
---|
| 1662 | case IDM_VIRUSSCAN:
|
---|
| 1663 | case IDM_VIEW:
|
---|
| 1664 | case IDM_MCIPLAY:
|
---|
| 1665 | case IDM_VIEWARCHIVE:
|
---|
| 1666 | case IDM_VIEWTEXT:
|
---|
| 1667 | case IDM_VIEWBINARY:
|
---|
| 1668 | case IDM_EDIT:
|
---|
| 1669 | case IDM_EDITTEXT:
|
---|
| 1670 | case IDM_EDITBINARY:
|
---|
| 1671 | case IDM_EXEC:
|
---|
| 1672 | case IDM_EXTRACTWDIRS:
|
---|
| 1673 | case IDM_EXTRACT:
|
---|
| 1674 | {
|
---|
| 1675 | CHAR cl[1001], *endofit, *ptr;
|
---|
| 1676 | INT z;
|
---|
[2] | 1677 |
|
---|
[551] | 1678 | if ((li->type == IDM_EXTRACT && !li->info->extract) ||
|
---|
| 1679 | ((li->type == IDM_VIEW || li->type == IDM_VIEWTEXT ||
|
---|
| 1680 | li->type == IDM_VIEWBINARY || li->type == IDM_EDIT ||
|
---|
| 1681 | li->type == IDM_VIEWARCHIVE || li->type == IDM_EDITTEXT ||
|
---|
| 1682 | li->type == IDM_EDITBINARY || li->type == IDM_MCIPLAY) &&
|
---|
| 1683 | (!li->info->extract && !li->info->exwdirs)) ||
|
---|
| 1684 | (li->type != IDM_EXTRACT && li->type != IDM_EDIT &&
|
---|
| 1685 | li->type != IDM_VIEW && li->type != IDM_VIEWTEXT &&
|
---|
| 1686 | li->type != IDM_VIEWBINARY &&
|
---|
| 1687 | li->type != IDM_VIEWARCHIVE &&
|
---|
| 1688 | li->type != IDM_EDITTEXT &&
|
---|
| 1689 | li->type != IDM_EDITBINARY &&
|
---|
| 1690 | li->type != IDM_MCIPLAY && !li->info->exwdirs)) {
|
---|
| 1691 | Runtime_Error(pszSrcFile, __LINE__, "no cmd for request");
|
---|
| 1692 | break;
|
---|
| 1693 | }
|
---|
| 1694 | if (li->type == IDM_EXTRACT || li->type == IDM_EXTRACTWDIRS) {
|
---|
[2] | 1695 |
|
---|
[551] | 1696 | CHAR fullname[CCHMAXPATH * 2];
|
---|
| 1697 | CHAR **exfiles = NULL;
|
---|
| 1698 | INT numfiles = 0, numalloc = 0;
|
---|
[2] | 1699 |
|
---|
[551] | 1700 | for (x = 0; li->list[x]; x++) {
|
---|
[773] | 1701 | BldFullPathName(fullname, li->targetpath, li->list[x]);
|
---|
[551] | 1702 | if (IsFile(fullname) != -1) {
|
---|
| 1703 | AddToList(li->list[x], &exfiles, &numfiles, &numalloc);
|
---|
| 1704 | li->list = RemoveFromList(li->list, li->list[x]);
|
---|
| 1705 | if (!li->list)
|
---|
| 1706 | break;
|
---|
| 1707 | x--;
|
---|
| 1708 | }
|
---|
| 1709 | }
|
---|
| 1710 | if (exfiles && numfiles) {
|
---|
[2] | 1711 |
|
---|
[551] | 1712 | CHECKLIST ckl;
|
---|
| 1713 | CHAR prompt[(CCHMAXPATH * 2) + 256];
|
---|
[2] | 1714 |
|
---|
[551] | 1715 | memset(&ckl, 0, sizeof(ckl));
|
---|
| 1716 | ckl.size = sizeof(ckl);
|
---|
| 1717 | ckl.list = exfiles;
|
---|
| 1718 | ckl.prompt = prompt;
|
---|
| 1719 | ckl.cmd = li->type;
|
---|
| 1720 | sprintf(prompt,
|
---|
| 1721 | GetPString(IDS_REPLACEWARNTEXT),
|
---|
| 1722 | &"s"[numfiles == 1],
|
---|
| 1723 | li->arcname, &"s"[numfiles != 1], li->targetpath);
|
---|
| 1724 | if (!WinDlgBox(HWND_DESKTOP, hwnd, CheckListProc,
|
---|
| 1725 | FM3ModHandle, CHECK_FRAME, MPFROMP(&ckl))) {
|
---|
| 1726 | if (ckl.list)
|
---|
| 1727 | FreeList(ckl.list);
|
---|
| 1728 | break;
|
---|
| 1729 | }
|
---|
| 1730 | else if (ckl.list)
|
---|
| 1731 | li->list = CombineLists(li->list, ckl.list);
|
---|
| 1732 | }
|
---|
| 1733 | }
|
---|
| 1734 | if (!li->list || !li->list[0])
|
---|
| 1735 | break;
|
---|
[773] | 1736 | strcpy(cl,
|
---|
| 1737 | (li->type == IDM_EXTRACT ||
|
---|
| 1738 | ((li->type == IDM_VIEW ||
|
---|
| 1739 | li->type == IDM_VIEWTEXT ||
|
---|
| 1740 | li->type == IDM_VIEWBINARY ||
|
---|
| 1741 | li->type == IDM_VIEWARCHIVE ||
|
---|
| 1742 | li->type == IDM_PRINT ||
|
---|
| 1743 | li->type == IDM_EDIT ||
|
---|
| 1744 | li->type == IDM_EDITTEXT ||
|
---|
| 1745 | (li->type == IDM_EDITBINARY &&
|
---|
| 1746 | li->type == IDM_MCIPLAY)) &&
|
---|
| 1747 | !li->info->exwdirs)) ?
|
---|
| 1748 | li->info->extract :
|
---|
| 1749 | li->info->exwdirs);
|
---|
| 1750 | strcat(cl, " ");
|
---|
| 1751 | BldQuotedFileName(cl + strlen(cl), li->arcname);
|
---|
[888] | 1752 | endofit = &cl[strlen(cl)];
|
---|
| 1753 | z = 0;
|
---|
| 1754 | do {
|
---|
| 1755 | for (x = z; li->list[x] &&
|
---|
[551] | 1756 | strlen(cl) + strlen(li->list[x]) < 999; x++) {
|
---|
| 1757 | strcat(cl, " ");
|
---|
[773] | 1758 | BldQuotedFileName(cl + strlen(cl), li->list[x]);
|
---|
[551] | 1759 | ptr = li->list[x];
|
---|
| 1760 | while (*ptr) {
|
---|
| 1761 | if (*ptr == '/')
|
---|
| 1762 | *ptr = '\\';
|
---|
| 1763 | ptr++;
|
---|
| 1764 | }
|
---|
| 1765 | }
|
---|
| 1766 | z = x;
|
---|
| 1767 | runemf2(SEPARATE | WINDOWED |
|
---|
[888] | 1768 | (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED) |
|
---|
| 1769 | WAIT, hwnd, pszSrcFile, __LINE__,
|
---|
| 1770 | li->targetpath, NULL, "%s", cl);
|
---|
[551] | 1771 | *endofit = 0;
|
---|
| 1772 | } while (li->list[x]);
|
---|
| 1773 | if (li->type == IDM_EXTRACT || li->type == IDM_EXTRACTWDIRS) {
|
---|
| 1774 | /* update windows */
|
---|
| 1775 | for (x = 0; li->list[x]; x++) {
|
---|
[2] | 1776 |
|
---|
[551] | 1777 | CHAR *temp, *p;
|
---|
[2] | 1778 |
|
---|
[551] | 1779 | temp = li->list[x];
|
---|
| 1780 | p = temp;
|
---|
| 1781 | while (*p) {
|
---|
| 1782 | if (*p == '/')
|
---|
| 1783 | *p = '\\';
|
---|
| 1784 | p++;
|
---|
| 1785 | }
|
---|
| 1786 | p =
|
---|
| 1787 | xmalloc(strlen(temp) + strlen(li->targetpath) + 2,
|
---|
| 1788 | pszSrcFile, __LINE__);
|
---|
| 1789 | if (p) {
|
---|
| 1790 | strcpy(p, li->targetpath);
|
---|
| 1791 | if (p[strlen(p) - 1] != '\\')
|
---|
| 1792 | strcat(p, "\\");
|
---|
| 1793 | strcat(p, temp);
|
---|
| 1794 | li->list[x] = p;
|
---|
| 1795 | free(temp);
|
---|
| 1796 | }
|
---|
| 1797 | }
|
---|
| 1798 | if (fFolderAfterExtract) {
|
---|
[2] | 1799 |
|
---|
[551] | 1800 | CHAR objectpath[CCHMAXPATH], *p;
|
---|
| 1801 | APIRET rc;
|
---|
[2] | 1802 |
|
---|
[551] | 1803 | GetDesktopName(objectpath, sizeof(objectpath));
|
---|
| 1804 | rc = WinDlgBox(HWND_DESKTOP, dcd->hwndParent, ObjCnrDlgProc,
|
---|
| 1805 | FM3ModHandle, OBJCNR_FRAME,
|
---|
| 1806 | MPFROMP(objectpath));
|
---|
| 1807 | if (rc) {
|
---|
| 1808 | if (rc > 1)
|
---|
| 1809 | strcpy(objectpath, "<WP_DESKTOP>");
|
---|
| 1810 | p = NULL;
|
---|
| 1811 | if (li->arcname) {
|
---|
| 1812 | p = strrchr(li->arcname, '\\');
|
---|
| 1813 | if (p)
|
---|
| 1814 | p++;
|
---|
| 1815 | }
|
---|
| 1816 | MakeShadows(dcd->hwndParent, li->list, 2, objectpath, p);
|
---|
| 1817 | }
|
---|
| 1818 | }
|
---|
| 1819 | Broadcast(WinQueryAnchorBlock(hwnd),
|
---|
| 1820 | hwndMain,
|
---|
| 1821 | UM_UPDATERECORDLIST, MPFROMP(li->list), MPVOID);
|
---|
| 1822 | }
|
---|
| 1823 | else if (li->type == IDM_EXEC)
|
---|
| 1824 | ExecOnList(hwnd,
|
---|
| 1825 | li->runfile,
|
---|
| 1826 | WINDOWED | SEPARATEKEEP | PROMPT,
|
---|
| 1827 | li->targetpath,
|
---|
[888] | 1828 | NULL, GetPString(IDS_EXECARCFILETITLETEXT),
|
---|
| 1829 | pszSrcFile, __LINE__);
|
---|
[551] | 1830 | else if (li->type == IDM_VIRUSSCAN)
|
---|
| 1831 | ExecOnList(hwnd, virus, PROMPT | WINDOWED | SEPARATEKEEP,
|
---|
| 1832 | li->targetpath, NULL,
|
---|
[888] | 1833 | GetPString(IDS_VIRUSSCANARCHIVETITLETEXT),
|
---|
| 1834 | pszSrcFile, __LINE__);
|
---|
[551] | 1835 | else if (li->type == IDM_VIEW || li->type == IDM_VIEWTEXT ||
|
---|
| 1836 | li->type == IDM_VIEWBINARY || li->type == IDM_EDIT ||
|
---|
| 1837 | li->type == IDM_EDITTEXT ||
|
---|
| 1838 | li->type == IDM_VIEWARCHIVE ||
|
---|
| 1839 | li->type == IDM_EDITBINARY ||
|
---|
| 1840 | li->type == IDM_MCIPLAY || li->type == IDM_PRINT) {
|
---|
[2] | 1841 |
|
---|
[551] | 1842 | CHAR *temp, *p;
|
---|
[2] | 1843 |
|
---|
[551] | 1844 | for (x = 0; li->list[x]; x++) {
|
---|
| 1845 | if (!li->info->exwdirs) {
|
---|
| 1846 | temp = li->list[x];
|
---|
| 1847 | p = strrchr(li->list[x], '\\');
|
---|
| 1848 | if (p) {
|
---|
| 1849 | p++;
|
---|
| 1850 | li->list[x] = xstrdup(p, pszSrcFile, __LINE__);
|
---|
| 1851 | if (!li->list[x])
|
---|
| 1852 | li->list[x] = temp;
|
---|
| 1853 | else {
|
---|
| 1854 | free(temp);
|
---|
| 1855 | }
|
---|
| 1856 | }
|
---|
| 1857 | }
|
---|
[773] | 1858 | BldFullPathName(cl, li->targetpath, li->list[x]);
|
---|
[551] | 1859 | temp = li->list[x];
|
---|
| 1860 | li->list[x] = xstrdup(cl, pszSrcFile, __LINE__);
|
---|
| 1861 | if (!li->list[x])
|
---|
| 1862 | li->list[x] = temp;
|
---|
| 1863 | else
|
---|
| 1864 | free(temp);
|
---|
| 1865 | }
|
---|
| 1866 | if (li->type == IDM_VIEW || li->type == IDM_EDIT) {
|
---|
[2] | 1867 |
|
---|
[551] | 1868 | BOOL isit = TestBinary(li->list[0]);
|
---|
[2] | 1869 |
|
---|
[551] | 1870 | if (isit) {
|
---|
| 1871 | if (li->type == IDM_VIEW)
|
---|
| 1872 | li->type = IDM_VIEWBINARY;
|
---|
| 1873 | else
|
---|
| 1874 | li->type = IDM_EDITBINARY;
|
---|
| 1875 | }
|
---|
| 1876 | else {
|
---|
| 1877 | if (li->type == IDM_VIEW)
|
---|
| 1878 | li->type = IDM_VIEWTEXT;
|
---|
| 1879 | else
|
---|
| 1880 | li->type = IDM_EDITTEXT;
|
---|
| 1881 | }
|
---|
| 1882 | }
|
---|
| 1883 | if (li->type == IDM_MCIPLAY) {
|
---|
[2] | 1884 |
|
---|
[762] | 1885 | FILE *fp;
|
---|
[2] | 1886 |
|
---|
[551] | 1887 | fp = xfopen("$FM2PLAY.$$$", "w", pszSrcFile, __LINE__);
|
---|
| 1888 | if (fp) {
|
---|
| 1889 | fprintf(fp, "%s", ";AV/2-built FM2Play listfile\n");
|
---|
| 1890 | for (x = 0; li->list[x]; x++)
|
---|
| 1891 | fprintf(fp, "%s\n", li->list[x]);
|
---|
| 1892 | fprintf(fp, ";end\n");
|
---|
[762] | 1893 | fclose(fp);
|
---|
| 1894 | RunFM2Util("FM2PLAY.EXE", "/@$FM2PLAY.$$$");
|
---|
| 1895 | }
|
---|
[551] | 1896 | }
|
---|
| 1897 | else if (li->type == IDM_PRINT) {
|
---|
| 1898 | strcpy(li->targetpath, printer);
|
---|
| 1899 | if (_beginthread(PrintListThread, NULL, 65536, (PVOID) li) !=
|
---|
| 1900 | -1) {
|
---|
| 1901 | Runtime_Error(pszSrcFile, __LINE__,
|
---|
| 1902 | GetPString(IDS_COULDNTSTARTTHREADTEXT));
|
---|
| 1903 | li = NULL;
|
---|
| 1904 | }
|
---|
| 1905 | }
|
---|
| 1906 | else if (li->type == IDM_VIEWARCHIVE) {
|
---|
[2] | 1907 |
|
---|
[551] | 1908 | ARC_TYPE *info;
|
---|
[2] | 1909 |
|
---|
[551] | 1910 | for (x = 0; li->list[x]; x++) {
|
---|
| 1911 | if (IsFile(li->list[x]) == 1) {
|
---|
| 1912 | info = NULL; // Do not hide dups - fixme to know why?
|
---|
| 1913 | if (WinDlgBox(HWND_DESKTOP, HWND_DESKTOP,
|
---|
| 1914 | SBoxDlgProc, FM3ModHandle, ASEL_FRAME,
|
---|
| 1915 | (PVOID) & info) && info) {
|
---|
| 1916 | StartArcCnr(HWND_DESKTOP,
|
---|
| 1917 | HWND_DESKTOP, li->list[x], 4, info);
|
---|
| 1918 | }
|
---|
| 1919 | }
|
---|
| 1920 | }
|
---|
| 1921 | }
|
---|
| 1922 | else if ((li->type == IDM_VIEWTEXT && *viewer) ||
|
---|
| 1923 | (li->type == IDM_VIEWBINARY && *binview) ||
|
---|
| 1924 | (li->type == IDM_EDITTEXT && *editor) ||
|
---|
| 1925 | (li->type == IDM_EDITBINARY && *bined)) {
|
---|
[814] | 1926 | DosSleep(32); //05 Aug 07 GKY 100
|
---|
[551] | 1927 | ExecOnList(hwnd, ((li->type == IDM_VIEWTEXT) ? viewer :
|
---|
| 1928 | (li->type == IDM_VIEWBINARY) ? binview :
|
---|
| 1929 | (li->type == IDM_EDITTEXT) ? editor :
|
---|
| 1930 | bined),
|
---|
| 1931 | WINDOWED | SEPARATE, li->targetpath, li->list,
|
---|
[888] | 1932 | NULL, pszSrcFile, __LINE__);
|
---|
[551] | 1933 | }
|
---|
| 1934 | else {
|
---|
| 1935 | if (li->hwnd) {
|
---|
[2] | 1936 |
|
---|
[551] | 1937 | ULONG viewtype;
|
---|
[2] | 1938 |
|
---|
[551] | 1939 | for (x = 0; li->list[x]; x++) {
|
---|
| 1940 | if (x == 0) {
|
---|
| 1941 | if (li->type == IDM_VIEWBINARY ||
|
---|
| 1942 | li->type == IDM_EDITBINARY)
|
---|
| 1943 | viewtype = 16;
|
---|
| 1944 | else
|
---|
| 1945 | viewtype = 8;
|
---|
| 1946 | }
|
---|
| 1947 | else
|
---|
| 1948 | viewtype = 0;
|
---|
| 1949 | temp = xstrdup(li->list[x], pszSrcFile, __LINE__);
|
---|
| 1950 | if (temp) {
|
---|
| 1951 | if (!PostMsg(WinQueryWindow(li->hwnd, QW_PARENT),
|
---|
| 1952 | UM_LOADFILE,
|
---|
| 1953 | MPFROMLONG(4L +
|
---|
| 1954 | (li->type == IDM_VIEWTEXT ||
|
---|
| 1955 | li->type == IDM_VIEWBINARY) +
|
---|
| 1956 | viewtype), MPFROMP(temp)))
|
---|
| 1957 | free(temp);
|
---|
| 1958 | }
|
---|
| 1959 | }
|
---|
| 1960 | }
|
---|
| 1961 | }
|
---|
| 1962 | }
|
---|
| 1963 | }
|
---|
| 1964 | break;
|
---|
[2] | 1965 |
|
---|
[551] | 1966 | case IDM_FIND:
|
---|
| 1967 | {
|
---|
| 1968 | INT numfiles = 0, numalloced = 0;
|
---|
| 1969 | CHAR **list2 = NULL, fullname[CCHMAXPATH * 2], *p;
|
---|
[2] | 1970 |
|
---|
[551] | 1971 | for (x = 0; li->list[x]; x++) {
|
---|
| 1972 | p = li->list[x];
|
---|
| 1973 | while (*p) {
|
---|
| 1974 | if (*p == '/')
|
---|
| 1975 | *p = '\\';
|
---|
| 1976 | p++;
|
---|
| 1977 | }
|
---|
[773] | 1978 | BldFullPathName(fullname, dcd->directory, li->list[x]);
|
---|
| 1979 | // sprintf(fullname, "%s%s%s", dcd->directory,
|
---|
| 1980 | // (dcd->directory[strlen(dcd->directory) - 1] == '\\') ?
|
---|
| 1981 | // NullStr : "\\", li->list[x]);
|
---|
[551] | 1982 | if (IsFile(fullname) != -1)
|
---|
| 1983 | if (AddToList(fullname, &list2, &numfiles, &numalloced))
|
---|
| 1984 | break;
|
---|
| 1985 | if (strchr(li->list[x], '\\')) {
|
---|
| 1986 | p = strrchr(li->list[x], '\\');
|
---|
| 1987 | if (p) {
|
---|
| 1988 | p++;
|
---|
| 1989 | if (*p) {
|
---|
[773] | 1990 | BldFullPathName(fullname, dcd->directory, p);
|
---|
| 1991 | // sprintf(fullname, "%s%s%s", dcd->directory,
|
---|
| 1992 | // (dcd->directory[strlen(dcd->directory) - 1] ==
|
---|
| 1993 | // '\\') ? NullStr : "\\",
|
---|
| 1994 | // p);
|
---|
[551] | 1995 | if (IsFile(fullname) != -1)
|
---|
| 1996 | if (AddToList(fullname, &list2, &numfiles, &numalloced))
|
---|
| 1997 | break;
|
---|
| 1998 | }
|
---|
| 1999 | }
|
---|
| 2000 | }
|
---|
| 2001 | }
|
---|
| 2002 | if (!numfiles || !list2)
|
---|
| 2003 | Runtime_Error(pszSrcFile, __LINE__, "no files or list");
|
---|
| 2004 | else {
|
---|
| 2005 | WinSendMsg(dcd->hwndCnr, WM_COMMAND,
|
---|
| 2006 | MPFROM2SHORT(IDM_COLLECTOR, 0), MPVOID);
|
---|
[814] | 2007 | DosSleep(10); //05 Aug 07 GKY 128
|
---|
[551] | 2008 | if (Collector) {
|
---|
| 2009 | if (!PostMsg(Collector, WM_COMMAND,
|
---|
| 2010 | MPFROM2SHORT(IDM_COLLECTOR, 0), MPFROMP(list2)))
|
---|
| 2011 | FreeList(list2);
|
---|
| 2012 | }
|
---|
| 2013 | else
|
---|
| 2014 | FreeList(list2);
|
---|
| 2015 | }
|
---|
| 2016 | }
|
---|
| 2017 | break;
|
---|
| 2018 | }
|
---|
[2] | 2019 | }
|
---|
[551] | 2020 | FreeListInfo(li);
|
---|
| 2021 | }
|
---|
| 2022 | return 0;
|
---|
[2] | 2023 |
|
---|
[551] | 2024 | case WM_CLOSE:
|
---|
| 2025 | WinDestroyWindow(hwnd);
|
---|
| 2026 | break;
|
---|
[2] | 2027 |
|
---|
[551] | 2028 | case WM_DESTROY:
|
---|
| 2029 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
| 2030 | if (dcd) {
|
---|
| 2031 | if (*dcd->workdir) {
|
---|
[771] | 2032 | DosSleep(16); //05 Aug 07 GKY 33
|
---|
[551] | 2033 | wipeallf("%s\\*", dcd->workdir);
|
---|
| 2034 | if (rmdir(dcd->workdir)) {
|
---|
[771] | 2035 | DosSleep(100); //05 Aug 07 GKY 256
|
---|
[551] | 2036 | wipeallf("%s\\*", dcd->workdir);
|
---|
| 2037 | rmdir(dcd->workdir);
|
---|
| 2038 | }
|
---|
[2] | 2039 | }
|
---|
[551] | 2040 | FreeList(dcd->lastselection);
|
---|
| 2041 | WinSendMsg(dcd->hwndCnr, UM_CLOSE, MPVOID, MPVOID);
|
---|
| 2042 | free(dcd);
|
---|
| 2043 | WinSetWindowPtr(dcd->hwndCnr, QWL_USER, NULL);
|
---|
| 2044 | }
|
---|
| 2045 | if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
|
---|
| 2046 | WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
|
---|
| 2047 | break;
|
---|
| 2048 | } // switch
|
---|
| 2049 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
[2] | 2050 | }
|
---|
| 2051 |
|
---|
[551] | 2052 | static MRESULT EXPENTRY ArcCnrWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
|
---|
| 2053 | MPARAM mp2)
|
---|
[172] | 2054 | {
|
---|
[672] | 2055 | DIRCNRDATA *dcd = INSTDATA(hwnd);
|
---|
[773] | 2056 | CHAR szQuotedArcName[CCHMAXPATH];
|
---|
[2] | 2057 |
|
---|
[551] | 2058 | switch (msg) {
|
---|
| 2059 | case DM_PRINTOBJECT:
|
---|
| 2060 | case DM_DISCARDOBJECT:
|
---|
| 2061 | if (dcd)
|
---|
| 2062 | return WinSendMsg(dcd->hwndObject, msg, mp1, mp2);
|
---|
| 2063 | else
|
---|
| 2064 | return MRFROMLONG(DRR_TARGET);
|
---|
[2] | 2065 |
|
---|
[551] | 2066 | case WM_CHAR:
|
---|
| 2067 | shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
| 2068 | if (SHORT1FROMMP(mp1) & KC_KEYUP)
|
---|
| 2069 | return (MRESULT) TRUE;
|
---|
| 2070 | if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {
|
---|
| 2071 | switch (SHORT2FROMMP(mp2)) {
|
---|
| 2072 | case VK_DELETE:
|
---|
| 2073 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_DELETE, 0), MPVOID);
|
---|
| 2074 | break;
|
---|
[2] | 2075 | }
|
---|
[551] | 2076 | }
|
---|
| 2077 | if (shiftstate || fNoSearch)
|
---|
| 2078 | break;
|
---|
| 2079 | if (SHORT1FROMMP(mp1) & KC_CHAR) {
|
---|
[2] | 2080 |
|
---|
[551] | 2081 | ULONG thistime, len;
|
---|
| 2082 | SEARCHSTRING srch;
|
---|
| 2083 | PCNRITEM pci;
|
---|
[2] | 2084 |
|
---|
[551] | 2085 | if (!dcd)
|
---|
| 2086 | break;
|
---|
| 2087 | switch (SHORT1FROMMP(mp2)) {
|
---|
| 2088 | case '\x1b':
|
---|
| 2089 | case '\r':
|
---|
| 2090 | case '\n':
|
---|
| 2091 | dcd->lasttime = 0;
|
---|
| 2092 | *dcd->szCommonName = 0;
|
---|
| 2093 | break;
|
---|
| 2094 | default:
|
---|
| 2095 | thistime = WinQueryMsgTime(WinQueryAnchorBlock(hwnd));
|
---|
| 2096 | if (thistime > dcd->lasttime + 1250)
|
---|
| 2097 | *dcd->szCommonName = 0;
|
---|
| 2098 | dcd->lasttime = thistime;
|
---|
| 2099 | if (SHORT1FROMMP(mp2) == ' ' && !*dcd->szCommonName)
|
---|
| 2100 | break;
|
---|
| 2101 | KbdRetry:
|
---|
| 2102 | len = strlen(dcd->szCommonName);
|
---|
| 2103 | if (len >= CCHMAXPATH - 1) {
|
---|
| 2104 | *dcd->szCommonName = 0;
|
---|
| 2105 | len = 0;
|
---|
| 2106 | }
|
---|
| 2107 | dcd->szCommonName[len] = toupper(SHORT1FROMMP(mp2));
|
---|
| 2108 | dcd->szCommonName[len + 1] = 0;
|
---|
| 2109 | memset(&srch, 0, sizeof(SEARCHSTRING));
|
---|
| 2110 | srch.cb = (ULONG) sizeof(SEARCHSTRING);
|
---|
| 2111 | srch.pszSearch = dcd->szCommonName;
|
---|
| 2112 | srch.fsPrefix = TRUE;
|
---|
| 2113 | srch.fsCaseSensitive = FALSE;
|
---|
| 2114 | srch.usView = CV_ICON;
|
---|
| 2115 | pci = WinSendMsg(hwnd,
|
---|
| 2116 | CM_SEARCHSTRING,
|
---|
| 2117 | MPFROMP(&srch), MPFROMLONG(CMA_FIRST));
|
---|
| 2118 | if (pci && (INT) pci != -1) {
|
---|
[2] | 2119 |
|
---|
[551] | 2120 | USHORT attrib = CRA_CURSORED;
|
---|
[2] | 2121 |
|
---|
[551] | 2122 | /* make found item current item */
|
---|
| 2123 | if (!stricmp(pci->pszFileName, dcd->szCommonName))
|
---|
| 2124 | attrib |= CRA_SELECTED;
|
---|
| 2125 | WinSendMsg(hwnd,
|
---|
| 2126 | CM_SETRECORDEMPHASIS,
|
---|
| 2127 | MPFROMP(pci), MPFROM2SHORT(TRUE, attrib));
|
---|
| 2128 | /* make sure that record shows in viewport */
|
---|
| 2129 | ShowCnrRecord(hwnd, (PMINIRECORDCORE) pci);
|
---|
| 2130 | return (MRESULT) TRUE;
|
---|
| 2131 | }
|
---|
| 2132 | else {
|
---|
| 2133 | if (SHORT1FROMMP(mp2) == ' ') {
|
---|
| 2134 | dcd->szCommonName[len] = 0;
|
---|
| 2135 | break;
|
---|
| 2136 | }
|
---|
| 2137 | *dcd->szCommonName = 0;
|
---|
| 2138 | dcd->lasttime = 0;
|
---|
| 2139 | if (len) // retry as first letter if no match
|
---|
| 2140 | goto KbdRetry;
|
---|
| 2141 | }
|
---|
| 2142 | break;
|
---|
[2] | 2143 | }
|
---|
[551] | 2144 | }
|
---|
| 2145 | break;
|
---|
[2] | 2146 |
|
---|
[551] | 2147 | case WM_MOUSEMOVE:
|
---|
| 2148 | case WM_BUTTON1UP:
|
---|
| 2149 | case WM_BUTTON2UP:
|
---|
| 2150 | case WM_BUTTON3UP:
|
---|
| 2151 | case WM_CHORD:
|
---|
| 2152 | shiftstate = (SHORT2FROMMP(mp2) & (KC_SHIFT | KC_ALT | KC_CTRL));
|
---|
| 2153 | break;
|
---|
[2] | 2154 |
|
---|
[551] | 2155 | case WM_BUTTON1MOTIONEND:
|
---|
| 2156 | {
|
---|
| 2157 | CNRINFO cnri;
|
---|
[2] | 2158 |
|
---|
[551] | 2159 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
| 2160 | cnri.cb = sizeof(CNRINFO);
|
---|
| 2161 | if (WinSendMsg(hwnd,
|
---|
| 2162 | CM_QUERYCNRINFO,
|
---|
| 2163 | MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)))) {
|
---|
| 2164 | if (cnri.flWindowAttr & CV_DETAIL)
|
---|
| 2165 | PrfWriteProfileData(fmprof,
|
---|
| 2166 | appname,
|
---|
| 2167 | "ArcCnrSplitBar",
|
---|
| 2168 | (PVOID) & cnri.xVertSplitbar, sizeof(LONG));
|
---|
[2] | 2169 | }
|
---|
[551] | 2170 | }
|
---|
| 2171 | break;
|
---|
[2] | 2172 |
|
---|
[551] | 2173 | case WM_PRESPARAMCHANGED:
|
---|
| 2174 | PresParamChanged(hwnd, "ArcCnr", mp1, mp2);
|
---|
| 2175 | break;
|
---|
[2] | 2176 |
|
---|
[551] | 2177 | case UM_UPDATERECORD:
|
---|
| 2178 | case UM_UPDATERECORDLIST:
|
---|
| 2179 | if (dcd && !IsArcThere(hwnd, dcd->arcname))
|
---|
| 2180 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
| 2181 | return 0;
|
---|
[2] | 2182 |
|
---|
[551] | 2183 | case WM_SETFOCUS:
|
---|
| 2184 | /*
|
---|
| 2185 | * put name of our window (archive name) on status line
|
---|
| 2186 | */
|
---|
| 2187 | if (dcd && hwndStatus && mp2)
|
---|
| 2188 | WinSendMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
| 2189 | break;
|
---|
[2] | 2190 |
|
---|
[551] | 2191 | case UM_SETUP2:
|
---|
| 2192 | if (dcd && dcd->info) {
|
---|
| 2193 | if (dcd->info->fdpos == -1 || !dcd->info->datetype)
|
---|
| 2194 | dcd->sortFlags &= (~SORT_LWDATE);
|
---|
| 2195 | if (dcd->info->nsizepos == -1)
|
---|
| 2196 | dcd->sortFlags &= (~SORT_EASIZE);
|
---|
| 2197 | if (dcd->info->osizepos == -1)
|
---|
| 2198 | dcd->sortFlags &= (~SORT_SIZE);
|
---|
| 2199 | AdjustCnrColVis(hwnd,
|
---|
| 2200 | GetPString(IDS_OLDSIZECOLTEXT),
|
---|
| 2201 | dcd->info->osizepos != -1, FALSE);
|
---|
| 2202 | AdjustCnrColVis(hwnd,
|
---|
| 2203 | GetPString(IDS_NEWSIZECOLTEXT),
|
---|
| 2204 | dcd->info->nsizepos != -1, FALSE);
|
---|
| 2205 | // Display unsullied date/time string if type 0
|
---|
| 2206 | AdjustCnrColVis(hwnd,
|
---|
| 2207 | GetPString(IDS_DATETIMECOLTEXT),
|
---|
| 2208 | dcd->info->fdpos != -1 && !dcd->info->datetype, FALSE);
|
---|
| 2209 | // Display parsed date/time columns if type specified
|
---|
| 2210 | AdjustCnrColVis(hwnd,
|
---|
| 2211 | GetPString(IDS_TIMECOLTEXT),
|
---|
| 2212 | dcd->info->fdpos != -1 && dcd->info->datetype, FALSE);
|
---|
| 2213 | AdjustCnrColVis(hwnd,
|
---|
| 2214 | GetPString(IDS_DATECOLTEXT),
|
---|
| 2215 | dcd->info->fdpos != -1 && dcd->info->datetype, FALSE);
|
---|
| 2216 | WinSendMsg(hwnd, CM_INVALIDATEDETAILFIELDINFO, MPVOID, MPVOID);
|
---|
| 2217 | }
|
---|
| 2218 | return 0;
|
---|
[2] | 2219 |
|
---|
[551] | 2220 | case UM_RESCAN:
|
---|
| 2221 | if (dcd) {
|
---|
| 2222 | CNRINFO cnri;
|
---|
| 2223 | CHAR s[CCHMAXPATH * 2], tb[81], tf[81];
|
---|
| 2224 | PARCITEM pci;
|
---|
[2] | 2225 |
|
---|
[551] | 2226 | if (mp1) {
|
---|
| 2227 | PostMsg(dcd->hwndObject, UM_RESCAN, MPVOID, MPVOID);
|
---|
| 2228 | return 0;
|
---|
| 2229 | }
|
---|
| 2230 | memset(&cnri, 0, sizeof(CNRINFO));
|
---|
| 2231 | cnri.cb = sizeof(CNRINFO);
|
---|
| 2232 | WinSendMsg(hwnd,
|
---|
| 2233 | CM_QUERYCNRINFO,
|
---|
| 2234 | MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
|
---|
| 2235 | dcd->totalfiles = cnri.cRecords;
|
---|
| 2236 | commafmt(tf, sizeof(tf), dcd->selectedfiles);
|
---|
| 2237 | if (dcd->ullTotalBytes)
|
---|
| 2238 | CommaFmtULL(tb, sizeof(tb), dcd->selectedbytes, 'K');
|
---|
| 2239 | else
|
---|
| 2240 | *tb = 0;
|
---|
| 2241 | sprintf(s, "%s%s%s", tf, *tb ? " / " : NullStr, tb);
|
---|
| 2242 | WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, s);
|
---|
| 2243 | commafmt(tf, sizeof(tf), dcd->totalfiles);
|
---|
| 2244 | if (dcd->ullTotalBytes)
|
---|
| 2245 | CommaFmtULL(tb, sizeof(tb), dcd->ullTotalBytes, 'K');
|
---|
| 2246 | else
|
---|
| 2247 | *tb = 0;
|
---|
| 2248 | sprintf(s, "%s%s%s", tf, *tb ? " / " : NullStr, tb);
|
---|
| 2249 | WinSetDlgItemText(dcd->hwndClient, DIR_TOTALS, s);
|
---|
| 2250 | if (hwndStatus &&
|
---|
| 2251 | dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) {
|
---|
| 2252 | sprintf(s, " [%s%s%s]%s%s%s %s",
|
---|
| 2253 | tf,
|
---|
[156] | 2254 | *tb ? " / " : NullStr,
|
---|
[551] | 2255 | tb,
|
---|
[562] | 2256 | *dcd->mask.szMask ? " (" : NullStr,
|
---|
| 2257 | *dcd->mask.szMask ? dcd->mask.szMask : NullStr,
|
---|
| 2258 | *dcd->mask.szMask ? ")" : NullStr, dcd->arcname);
|
---|
[551] | 2259 | WinSetWindowText(hwndStatus, s);
|
---|
| 2260 | if (!ParentIsDesktop(hwnd, dcd->hwndParent)) {
|
---|
| 2261 | pci = WinSendMsg(hwnd,
|
---|
| 2262 | CM_QUERYRECORDEMPHASIS,
|
---|
| 2263 | MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
|
---|
| 2264 | if (pci && (INT) pci != -1) {
|
---|
| 2265 | if (fSplitStatus && hwndStatus2) {
|
---|
| 2266 | if (dcd->ullTotalBytes)
|
---|
| 2267 | CommaFmtULL(tb, sizeof(tb), pci->cbFile, ' ');
|
---|
| 2268 | else
|
---|
| 2269 | *tb = 0;
|
---|
| 2270 | sprintf(s, "%s%s%s%s",
|
---|
| 2271 | *tb ? " " : NullStr,
|
---|
[730] | 2272 | tb, *tb ? " " : NullStr, pci->pszFileName);
|
---|
[551] | 2273 | WinSetWindowText(hwndStatus2, s);
|
---|
| 2274 | }
|
---|
| 2275 | if (fMoreButtons)
|
---|
[730] | 2276 | WinSetWindowText(hwndName, pci->pszFileName);
|
---|
[551] | 2277 | }
|
---|
| 2278 | else {
|
---|
| 2279 | WinSetWindowText(hwndStatus2, NullStr);
|
---|
| 2280 | WinSetWindowText(hwndName, NullStr);
|
---|
| 2281 | }
|
---|
| 2282 | WinSetWindowText(hwndDate, NullStr);
|
---|
| 2283 | WinSetWindowText(hwndAttr, NullStr);
|
---|
| 2284 | }
|
---|
[2] | 2285 | }
|
---|
[563] | 2286 | if ((dcd->arcfilled && !dcd->totalfiles) ||
|
---|
[762] | 2287 | !IsArcThere(hwnd, dcd->arcname))
|
---|
[551] | 2288 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
| 2289 | }
|
---|
| 2290 | return 0;
|
---|
| 2291 |
|
---|
| 2292 | case UM_SETUP:
|
---|
| 2293 | if (!dcd) {
|
---|
| 2294 | Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
|
---|
| 2295 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
[2] | 2296 | return 0;
|
---|
[551] | 2297 | }
|
---|
| 2298 | else {
|
---|
| 2299 | if (!dcd->hwndObject) {
|
---|
| 2300 | /*
|
---|
| 2301 | * first time through -- set things up
|
---|
| 2302 | */
|
---|
| 2303 | {
|
---|
| 2304 | CHAR *p, *pp;
|
---|
| 2305 | ULONG z, was;
|
---|
| 2306 | APIRET rc;
|
---|
[2] | 2307 |
|
---|
[551] | 2308 | rc = DosCreateDir(dcd->workdir, 0);
|
---|
| 2309 | if (rc) {
|
---|
| 2310 | if (rc == ERROR_ACCESS_DENIED) {
|
---|
| 2311 | p = strrchr(dcd->workdir, '.');
|
---|
| 2312 | if (p) {
|
---|
| 2313 | p++;
|
---|
| 2314 | pp = p;
|
---|
| 2315 | was = strtoul(p, &pp, 16);
|
---|
| 2316 | for (z = 0; z < 99; z++) {
|
---|
| 2317 | was++;
|
---|
| 2318 | sprintf(p, "%03x");
|
---|
| 2319 | rc = DosCreateDir(dcd->workdir, 0);
|
---|
| 2320 | if (!rc || rc != ERROR_ACCESS_DENIED)
|
---|
| 2321 | break;
|
---|
| 2322 | }
|
---|
| 2323 | }
|
---|
| 2324 | }
|
---|
| 2325 | if (rc)
|
---|
| 2326 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
| 2327 | return 0;
|
---|
| 2328 | }
|
---|
| 2329 | }
|
---|
| 2330 | RestorePresParams(hwnd, "ArcCnr");
|
---|
| 2331 | dcd->mask.fNoAttribs = TRUE;
|
---|
| 2332 | dcd->mask.fNoDirs = TRUE;
|
---|
| 2333 | *dcd->mask.prompt = 0;
|
---|
| 2334 | {
|
---|
| 2335 | PFIELDINFO pfi, pfiLastLeftCol;
|
---|
| 2336 | ULONG numcols = CON_COLS;
|
---|
| 2337 | CNRINFO cnri;
|
---|
| 2338 | ULONG size;
|
---|
[2] | 2339 |
|
---|
[551] | 2340 | pfi = WinSendMsg(hwnd,
|
---|
| 2341 | CM_ALLOCDETAILFIELDINFO,
|
---|
| 2342 | MPFROMLONG(numcols), NULL);
|
---|
| 2343 | if (pfi) {
|
---|
[2] | 2344 |
|
---|
[551] | 2345 | PFIELDINFO pfiFirst;
|
---|
| 2346 | FIELDINFOINSERT fii;
|
---|
[2] | 2347 |
|
---|
[551] | 2348 | pfiFirst = pfi;
|
---|
| 2349 | pfi->flData = CFA_STRING | CFA_LEFT | CFA_FIREADONLY;
|
---|
| 2350 | pfi->flTitle = CFA_CENTER;
|
---|
| 2351 | pfi->pTitleData = GetPString(IDS_FILENAMECOLTEXT);
|
---|
[739] | 2352 | pfi->offStruct = FIELDOFFSET(ARCITEM, pszDisplayName);
|
---|
[551] | 2353 | pfiLastLeftCol = pfi;
|
---|
| 2354 | pfi = pfi->pNextFieldInfo;
|
---|
| 2355 | pfi->flData =
|
---|
| 2356 | CFA_ULONG | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY;
|
---|
| 2357 | pfi->flTitle = CFA_CENTER;
|
---|
| 2358 | pfi->pTitleData = GetPString(IDS_OLDSIZECOLTEXT);
|
---|
| 2359 | pfi->offStruct = FIELDOFFSET(ARCITEM, cbFile);
|
---|
| 2360 | pfi = pfi->pNextFieldInfo;
|
---|
| 2361 | pfi->flData =
|
---|
| 2362 | CFA_ULONG | CFA_RIGHT | CFA_SEPARATOR | CFA_FIREADONLY;
|
---|
| 2363 | pfi->flTitle = CFA_CENTER;
|
---|
| 2364 | pfi->pTitleData = GetPString(IDS_NEWSIZECOLTEXT);
|
---|
| 2365 | pfi->offStruct = FIELDOFFSET(ARCITEM, cbComp);
|
---|
| 2366 | pfi = pfi->pNextFieldInfo;
|
---|
| 2367 | pfi->flData =
|
---|
| 2368 | CFA_STRING | CFA_CENTER | CFA_SEPARATOR | CFA_FIREADONLY;
|
---|
| 2369 | pfi->flTitle = CFA_CENTER | CFA_FITITLEREADONLY;
|
---|
| 2370 | pfi->pTitleData = GetPString(IDS_DATETIMECOLTEXT);
|
---|
| 2371 | pfi->offStruct = FIELDOFFSET(ARCITEM, pszDate);
|
---|
| 2372 | pfi = pfi->pNextFieldInfo;
|
---|
| 2373 | pfi->flData = CFA_DATE | CFA_RIGHT | CFA_FIREADONLY;
|
---|
| 2374 | pfi->flTitle = CFA_CENTER;
|
---|
| 2375 | pfi->pTitleData = GetPString(IDS_DATECOLTEXT);
|
---|
| 2376 | pfi->offStruct = FIELDOFFSET(ARCITEM, date);
|
---|
| 2377 | pfi = pfi->pNextFieldInfo;
|
---|
| 2378 | pfi->flData = CFA_TIME | CFA_RIGHT | CFA_FIREADONLY;
|
---|
| 2379 | pfi->flTitle = CFA_CENTER | CFA_FITITLEREADONLY;
|
---|
| 2380 | pfi->pTitleData = GetPString(IDS_TIMECOLTEXT);
|
---|
| 2381 | pfi->offStruct = FIELDOFFSET(ARCITEM, time);
|
---|
| 2382 | memset(&fii, 0, sizeof(FIELDINFOINSERT));
|
---|
| 2383 | fii.cb = sizeof(FIELDINFOINSERT);
|
---|
| 2384 | fii.pFieldInfoOrder = (PFIELDINFO) CMA_FIRST;
|
---|
| 2385 | fii.cFieldInfoInsert = (SHORT) numcols;
|
---|
| 2386 | fii.fInvalidateFieldInfo = TRUE;
|
---|
| 2387 | WinSendMsg(hwnd,
|
---|
| 2388 | CM_INSERTDETAILFIELDINFO,
|
---|
| 2389 | MPFROMP(pfiFirst), MPFROMP(&fii));
|
---|
| 2390 | PostMsg(hwnd, UM_SETUP2, MPVOID, MPVOID);
|
---|
[2] | 2391 |
|
---|
[551] | 2392 | memset(&cnri, 0, sizeof(cnri));
|
---|
| 2393 | cnri.cb = sizeof(CNRINFO);
|
---|
| 2394 | cnri.pFieldInfoLast = pfiLastLeftCol;
|
---|
| 2395 | cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET + 32;
|
---|
[2] | 2396 |
|
---|
[551] | 2397 | size = sizeof(LONG);
|
---|
| 2398 | PrfQueryProfileData(fmprof, appname, "ArcCnrSplitBar",
|
---|
| 2399 | &cnri.xVertSplitbar, &size);
|
---|
| 2400 | if (cnri.xVertSplitbar <= 0)
|
---|
| 2401 | cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET + 32;
|
---|
[2] | 2402 |
|
---|
[551] | 2403 | cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT | CV_NAME));
|
---|
| 2404 | cnri.flWindowAttr |= (CV_DETAIL | CA_DETAILSVIEWTITLES | CV_FLOW);
|
---|
| 2405 | cnri.flWindowAttr &= (~(CA_ORDEREDTARGETEMPH |
|
---|
| 2406 | CA_MIXEDTARGETEMPH));
|
---|
| 2407 | cnri.pSortRecord = (PVOID) ArcSort;
|
---|
| 2408 | WinSendMsg(hwnd,
|
---|
| 2409 | CM_SETCNRINFO,
|
---|
| 2410 | MPFROMP(&cnri),
|
---|
| 2411 | MPFROMLONG(CMA_PFIELDINFOLAST |
|
---|
| 2412 | CMA_XVERTSPLITBAR |
|
---|
| 2413 | CMA_PSORTRECORD | CMA_FLWINDOWATTR));
|
---|
| 2414 | }
|
---|
| 2415 | }
|
---|
| 2416 | WinSendMsg(hwnd, CM_SORTRECORD, MPFROMP(ArcSort), MPFROMP(dcd));
|
---|
| 2417 | if (_beginthread(MakeObjWin, NULL, 245760, (PVOID) dcd) == -1) {
|
---|
| 2418 | Runtime_Error(pszSrcFile, __LINE__,
|
---|
| 2419 | GetPString(IDS_COULDNTSTARTTHREADTEXT));
|
---|
| 2420 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
| 2421 | return 0;
|
---|
| 2422 | }
|
---|
| 2423 | else
|
---|
[766] | 2424 | DosSleep(1);
|
---|
[551] | 2425 | SayFilter(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 2426 | DIR_FILTER), &dcd->mask, TRUE);
|
---|
| 2427 | SaySort(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 2428 | DIR_SORT), dcd->sortFlags, TRUE);
|
---|
| 2429 | DefArcSortFlags = dcd->sortFlags; // Remember for new windows
|
---|
[2] | 2430 | }
|
---|
[551] | 2431 | }
|
---|
| 2432 | return 0;
|
---|
[2] | 2433 |
|
---|
[551] | 2434 | case UM_SETDIR:
|
---|
| 2435 | if (dcd) {
|
---|
[2] | 2436 |
|
---|
[551] | 2437 | CHAR s[CCHMAXPATH], *p;
|
---|
| 2438 | ULONG ret = 0;
|
---|
[2] | 2439 |
|
---|
[551] | 2440 | WinQueryDlgItemText(dcd->hwndClient, ARC_EXTRACTDIR, CCHMAXPATH, s);
|
---|
| 2441 | bstrip(s);
|
---|
| 2442 | MakeFullName(s);
|
---|
| 2443 | if (*s) {
|
---|
| 2444 | while ((p = strchr(s, '/')) != NULL)
|
---|
| 2445 | *p = '\\';
|
---|
| 2446 | while (strlen(s) > 3 && s[strlen(s) - 1] == '\\')
|
---|
| 2447 | s[strlen(s) - 1] = 0;
|
---|
| 2448 | if (stricmp(s, dcd->directory)) {
|
---|
| 2449 | if (IsFullName(s)) {
|
---|
| 2450 | if (driveflags[toupper(*s) - 'A'] &
|
---|
| 2451 | (DRIVE_NOTWRITEABLE | DRIVE_IGNORE | DRIVE_INVALID)) {
|
---|
| 2452 | Runtime_Error(pszSrcFile, __LINE__, "drive %s bad", s);
|
---|
| 2453 | WinSetDlgItemText(dcd->hwndClient,
|
---|
| 2454 | ARC_EXTRACTDIR, dcd->directory);
|
---|
| 2455 | return 0;
|
---|
| 2456 | }
|
---|
| 2457 | }
|
---|
| 2458 | if (!SetDir(dcd->hwndParent, hwnd, s, 0)) {
|
---|
| 2459 | if (stricmp(dcd->directory, s)) {
|
---|
| 2460 | DosEnterCritSec();
|
---|
| 2461 | strcpy(lastextractpath, s);
|
---|
| 2462 | DosExitCritSec();
|
---|
| 2463 | }
|
---|
| 2464 | strcpy(dcd->directory, s);
|
---|
| 2465 | if ((!isalpha(*s) || s[1] != ':') && *s != '.')
|
---|
| 2466 | saymsg(MB_ENTER | MB_ICONASTERISK,
|
---|
| 2467 | hwnd,
|
---|
| 2468 | GetPString(IDS_WARNINGTEXT),
|
---|
| 2469 | GetPString(IDS_SPECIFYDRIVETEXT));
|
---|
| 2470 | }
|
---|
| 2471 | else
|
---|
| 2472 | ret = 1;
|
---|
| 2473 | }
|
---|
[2] | 2474 | }
|
---|
[551] | 2475 | WinSetDlgItemText(dcd->hwndClient, ARC_EXTRACTDIR, dcd->directory);
|
---|
| 2476 | return (MRESULT) ret;
|
---|
| 2477 | }
|
---|
| 2478 | return 0;
|
---|
| 2479 |
|
---|
| 2480 | case UM_ENTER:
|
---|
| 2481 | if (WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID))
|
---|
[2] | 2482 | return 0;
|
---|
[551] | 2483 | SetShiftState();
|
---|
| 2484 | if (dcd && (CHAR *) mp1) {
|
---|
[2] | 2485 |
|
---|
[551] | 2486 | SWP swp;
|
---|
| 2487 | CHAR *filename = mp1;
|
---|
[2] | 2488 |
|
---|
[551] | 2489 | if (IsFile(filename) != 1)
|
---|
| 2490 | return 0;
|
---|
| 2491 | WinQueryWindowPos(dcd->hwndFrame, &swp);
|
---|
| 2492 | DefaultViewKeys(hwnd, dcd->hwndFrame, dcd->hwndParent, &swp, filename);
|
---|
| 2493 | if (fUnHilite)
|
---|
[672] | 2494 | UnHilite(hwnd, FALSE, &dcd->lastselection, 0);
|
---|
[551] | 2495 | }
|
---|
| 2496 | return 0;
|
---|
[2] | 2497 |
|
---|
[551] | 2498 | case WM_MENUEND:
|
---|
| 2499 | if (dcd) {
|
---|
[2] | 2500 |
|
---|
[551] | 2501 | HWND hwndMenu = (HWND) mp2;
|
---|
[2] | 2502 |
|
---|
[551] | 2503 | if (hwndMenu == ArcCnrMenu || hwndMenu == ArcMenu) {
|
---|
| 2504 | MarkAll(hwnd, TRUE, FALSE, TRUE);
|
---|
| 2505 | if (dcd->cnremphasized) {
|
---|
| 2506 | WinSendMsg(hwnd,
|
---|
| 2507 | CM_SETRECORDEMPHASIS,
|
---|
| 2508 | MPVOID, MPFROM2SHORT(FALSE, CRA_SOURCE));
|
---|
| 2509 | dcd->cnremphasized = FALSE;
|
---|
| 2510 | }
|
---|
[2] | 2511 | }
|
---|
[551] | 2512 | }
|
---|
| 2513 | break;
|
---|
[2] | 2514 |
|
---|
[551] | 2515 | case MM_PORTHOLEINIT:
|
---|
| 2516 | if (dcd) {
|
---|
| 2517 | switch (SHORT1FROMMP(mp1)) {
|
---|
| 2518 | case 0:
|
---|
| 2519 | case 1:
|
---|
| 2520 | {
|
---|
| 2521 | ULONG wmsg;
|
---|
[2] | 2522 |
|
---|
[562] | 2523 | wmsg = SHORT1FROMMP(mp1) == 0 ? UM_FILESMENU : UM_VIEWSMENU;
|
---|
[551] | 2524 | PortholeInit((HWND) WinSendMsg(dcd->hwndClient,
|
---|
| 2525 | wmsg, MPVOID, MPVOID), mp1, mp2);
|
---|
| 2526 | }
|
---|
| 2527 | break;
|
---|
[2] | 2528 | }
|
---|
[551] | 2529 | }
|
---|
| 2530 | break;
|
---|
[2] | 2531 |
|
---|
[551] | 2532 | case UM_INITMENU:
|
---|
| 2533 | case WM_INITMENU:
|
---|
| 2534 | if (dcd) {
|
---|
| 2535 | switch (SHORT1FROMMP(mp1)) {
|
---|
| 2536 | case IDM_FILESMENU:
|
---|
| 2537 | if (dcd->info) {
|
---|
| 2538 | WinEnableMenuItem((HWND) mp2,
|
---|
| 2539 | IDM_DELETE, dcd->info->delete != NULL);
|
---|
| 2540 | WinEnableMenuItem((HWND) mp2, IDM_TEST, dcd->info->test != NULL);
|
---|
| 2541 | WinEnableMenuItem((HWND) mp2,
|
---|
| 2542 | IDM_EXTRACT, dcd->info->extract != NULL);
|
---|
| 2543 | WinEnableMenuItem((HWND) mp2,
|
---|
| 2544 | IDM_EXTRACTWDIRS, dcd->info->exwdirs != NULL);
|
---|
| 2545 | WinEnableMenuItem((HWND) mp2,
|
---|
| 2546 | IDM_ARCEXTRACTWDIRS, dcd->info->exwdirs != NULL);
|
---|
| 2547 | WinEnableMenuItem((HWND) mp2,
|
---|
| 2548 | IDM_ARCEXTRACTWDIRSEXIT,
|
---|
| 2549 | dcd->info->exwdirs != NULL);
|
---|
| 2550 | }
|
---|
| 2551 | break;
|
---|
[2] | 2552 |
|
---|
[551] | 2553 | case IDM_VIEWSMENU:
|
---|
| 2554 | WinCheckMenuItem((HWND) mp2,
|
---|
[562] | 2555 | IDM_MINIICONS, (dcd->flWindowAttr & CV_MINI) != 0);
|
---|
[551] | 2556 | WinEnableMenuItem((HWND) mp2,
|
---|
| 2557 | IDM_RESELECT, (dcd->lastselection != NULL));
|
---|
| 2558 | break;
|
---|
[2] | 2559 |
|
---|
[551] | 2560 | case IDM_COMMANDSMENU:
|
---|
| 2561 | SetupCommandMenu((HWND) mp2, hwnd);
|
---|
| 2562 | break;
|
---|
[2] | 2563 |
|
---|
[551] | 2564 | case IDM_SORTSUBMENU:
|
---|
| 2565 | SetSortChecks((HWND) mp2, dcd->sortFlags);
|
---|
| 2566 | break;
|
---|
[2] | 2567 |
|
---|
[551] | 2568 | case IDM_WINDOWSMENU:
|
---|
| 2569 | /*
|
---|
| 2570 | * add switchlist entries to end of pulldown menu
|
---|
| 2571 | */
|
---|
[562] | 2572 | SetupWinList((HWND)mp2,
|
---|
| 2573 | hwndMain ? hwndMain : (HWND)0, dcd->hwndFrame);
|
---|
[551] | 2574 | break;
|
---|
[2] | 2575 | }
|
---|
[551] | 2576 | dcd->hwndLastMenu = (HWND) mp2;
|
---|
| 2577 | }
|
---|
| 2578 | if (msg == WM_INITMENU)
|
---|
| 2579 | break;
|
---|
| 2580 | return 0;
|
---|
[2] | 2581 |
|
---|
[551] | 2582 | case UM_LOADFILE:
|
---|
| 2583 | if (dcd && mp2) {
|
---|
[2] | 2584 |
|
---|
[551] | 2585 | HWND ret;
|
---|
[2] | 2586 |
|
---|
[551] | 2587 | ret = StartMLEEditor(dcd->hwndParent,
|
---|
| 2588 | (INT) mp1, (CHAR *) mp2, dcd->hwndFrame);
|
---|
| 2589 | free((CHAR *) mp2);
|
---|
| 2590 | return MRFROMLONG(ret);
|
---|
| 2591 | }
|
---|
| 2592 | return 0;
|
---|
| 2593 |
|
---|
| 2594 | case UM_COMMAND:
|
---|
| 2595 | if (mp1) {
|
---|
| 2596 | if (dcd) {
|
---|
| 2597 | if (!PostMsg(dcd->hwndObject, UM_COMMAND, mp1, mp2)) {
|
---|
| 2598 | Runtime_Error(pszSrcFile, __LINE__, "post");
|
---|
| 2599 | FreeListInfo((LISTINFO *) mp1);
|
---|
| 2600 | }
|
---|
| 2601 | else
|
---|
| 2602 | return (MRESULT) TRUE;
|
---|
[2] | 2603 | }
|
---|
[551] | 2604 | else
|
---|
| 2605 | FreeListInfo((LISTINFO *) mp1);
|
---|
| 2606 | }
|
---|
| 2607 | return 0;
|
---|
[2] | 2608 |
|
---|
[551] | 2609 | case UM_OPENWINDOWFORME:
|
---|
| 2610 | if (dcd) {
|
---|
| 2611 | if (mp1 && !IsFile((CHAR *) mp1)) {
|
---|
| 2612 | OpenDirCnr((HWND) 0, hwndMain, dcd->hwndFrame, FALSE, (char *)mp1);
|
---|
[2] | 2613 | }
|
---|
[551] | 2614 | else if (mp1 && IsFile(mp1) == 1) {
|
---|
| 2615 | StartArcCnr(HWND_DESKTOP,
|
---|
| 2616 | dcd->hwndFrame, (CHAR *) mp1, 4, (ARC_TYPE *) mp2);
|
---|
| 2617 | }
|
---|
| 2618 | }
|
---|
| 2619 | return 0;
|
---|
[2] | 2620 |
|
---|
[551] | 2621 | case WM_COMMAND:
|
---|
| 2622 | DosError(FERR_DISABLEHARDERR);
|
---|
| 2623 | if (dcd) {
|
---|
| 2624 | if (SwitchCommand(dcd->hwndLastMenu, SHORT1FROMMP(mp1)))
|
---|
| 2625 | return 0;
|
---|
| 2626 | if (WinSendMsg(hwnd, UM_SETDIR, MPVOID, MPVOID))
|
---|
| 2627 | return 0;
|
---|
| 2628 | if (!IsArcThere(hwnd, dcd->arcname)) {
|
---|
| 2629 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
| 2630 | return 0;
|
---|
[2] | 2631 | }
|
---|
[551] | 2632 | switch (SHORT1FROMMP(mp1)) {
|
---|
| 2633 | case IDM_TREEVIEW:
|
---|
[2] | 2634 |
|
---|
[551] | 2635 | break;
|
---|
[2] | 2636 |
|
---|
[551] | 2637 | case IDM_CONTEXTMENU:
|
---|
| 2638 | {
|
---|
| 2639 | PCNRITEM pci;
|
---|
[2] | 2640 |
|
---|
[551] | 2641 | pci = (PCNRITEM) CurrentRecord(hwnd);
|
---|
| 2642 | PostMsg(hwnd,
|
---|
| 2643 | WM_CONTROL,
|
---|
| 2644 | MPFROM2SHORT(ARC_CNR, CN_CONTEXTMENU), MPFROMP(pci));
|
---|
| 2645 | }
|
---|
| 2646 | break;
|
---|
[2] | 2647 |
|
---|
[551] | 2648 | case IDM_NEXTWINDOW:
|
---|
| 2649 | case IDM_PREVWINDOW:
|
---|
| 2650 | {
|
---|
| 2651 | HWND hwndActive;
|
---|
[2] | 2652 |
|
---|
[551] | 2653 | hwndActive = WinQueryFocus(HWND_DESKTOP);
|
---|
| 2654 | WinSetFocus(HWND_DESKTOP,
|
---|
[563] | 2655 | hwndActive == hwnd ?
|
---|
[762] | 2656 | WinWindowFromID(dcd->hwndClient, ARC_EXTRACTDIR) :
|
---|
| 2657 | hwnd);
|
---|
[551] | 2658 | }
|
---|
| 2659 | break;
|
---|
[2] | 2660 |
|
---|
[551] | 2661 | case IDM_FOLDERAFTEREXTRACT:
|
---|
[562] | 2662 | fFolderAfterExtract = fFolderAfterExtract ? FALSE : TRUE;
|
---|
[551] | 2663 | PrfWriteProfileData(fmprof, appname, "FolderAfterExtract",
|
---|
| 2664 | &fFolderAfterExtract, sizeof(BOOL));
|
---|
| 2665 | break;
|
---|
[2] | 2666 |
|
---|
[551] | 2667 | case IDM_SHOWSELECT:
|
---|
[872] | 2668 | QuickPopup(hwnd, dcd, CheckMenu(hwnd, &ArcCnrMenu, ARCCNR_POPUP),
|
---|
[551] | 2669 | IDM_SELECTSUBMENU);
|
---|
| 2670 | break;
|
---|
[2] | 2671 |
|
---|
[551] | 2672 | case IDM_SHOWSORT:
|
---|
[872] | 2673 | QuickPopup(hwnd, dcd, CheckMenu(hwnd, &ArcCnrMenu, ARCCNR_POPUP),
|
---|
[551] | 2674 | IDM_SORTSUBMENU);
|
---|
| 2675 | break;
|
---|
[2] | 2676 |
|
---|
[551] | 2677 | case IDM_NOTEBOOK:
|
---|
| 2678 | if (!ParentIsDesktop(dcd->hwndParent, dcd->hwndParent))
|
---|
[906] | 2679 | PostMsg(dcd->hwndParent, msg, mp1, mp2);
|
---|
| 2680 | else
|
---|
[551] | 2681 | WinDlgBox(HWND_DESKTOP,
|
---|
| 2682 | hwnd,
|
---|
[906] | 2683 | CfgDlgProc, FM3ModHandle, CFG_FRAME, MPFROMP("Archive"));
|
---|
[551] | 2684 | break;
|
---|
[2] | 2685 |
|
---|
[551] | 2686 | case IDM_RESCAN:
|
---|
| 2687 | dcd->ullTotalBytes = dcd->totalfiles =
|
---|
| 2688 | dcd->selectedfiles = dcd->selectedbytes = 0;
|
---|
| 2689 | WinSetDlgItemText(dcd->hwndClient, DIR_TOTALS, "0");
|
---|
| 2690 | WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, "0 / 0k");
|
---|
| 2691 | dcd->totalfiles = FillArcCnr(dcd->hwndCnr,
|
---|
| 2692 | dcd->arcname,
|
---|
| 2693 | &dcd->info,
|
---|
| 2694 | &dcd->ullTotalBytes, &dcd->stopflag);
|
---|
| 2695 | PostMsg(dcd->hwndCnr, UM_RESCAN, MPVOID, MPVOID);
|
---|
| 2696 | PostMsg(dcd->hwndCnr, UM_SETUP2, MPVOID, MPVOID);
|
---|
| 2697 | WinSendMsg(dcd->hwndCnr,
|
---|
| 2698 | CM_INVALIDATERECORD,
|
---|
| 2699 | MPVOID, MPFROM2SHORT(0, CMA_ERASE | CMA_REPOSITION));
|
---|
| 2700 | break;
|
---|
[2] | 2701 |
|
---|
[551] | 2702 | case IDM_RESELECT:
|
---|
| 2703 | SelectList(hwnd, TRUE, FALSE, FALSE, NULL, NULL, dcd->lastselection);
|
---|
| 2704 | break;
|
---|
[2] | 2705 |
|
---|
[551] | 2706 | case IDM_HELP:
|
---|
| 2707 | if (hwndHelp)
|
---|
| 2708 | WinSendMsg(hwndHelp,
|
---|
| 2709 | HM_DISPLAY_HELP,
|
---|
| 2710 | MPFROM2SHORT(HELP_ARCLIST, 0),
|
---|
| 2711 | MPFROMSHORT(HM_RESOURCEID));
|
---|
| 2712 | break;
|
---|
[2] | 2713 |
|
---|
[551] | 2714 | case IDM_WINDOWDLG:
|
---|
| 2715 | if (!ParentIsDesktop(dcd->hwndParent, dcd->hwndFrame))
|
---|
| 2716 | PostMsg(dcd->hwndParent,
|
---|
| 2717 | UM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);
|
---|
| 2718 | break;
|
---|
[2] | 2719 |
|
---|
[551] | 2720 | case IDM_SELECTALL:
|
---|
| 2721 | case IDM_SELECTALLFILES:
|
---|
| 2722 | case IDM_DESELECTALL:
|
---|
| 2723 | case IDM_DESELECTALLFILES:
|
---|
| 2724 | case IDM_SELECTMASK:
|
---|
| 2725 | case IDM_DESELECTMASK:
|
---|
| 2726 | case IDM_INVERT:
|
---|
| 2727 | {
|
---|
| 2728 | PARCITEM pci;
|
---|
[2] | 2729 |
|
---|
[551] | 2730 | pci = (PARCITEM) WinSendMsg(hwnd,
|
---|
| 2731 | CM_QUERYRECORDEMPHASIS,
|
---|
| 2732 | MPFROMLONG(CMA_FIRST),
|
---|
| 2733 | MPFROMSHORT(CRA_CURSORED));
|
---|
| 2734 | if ((INT) pci == -1)
|
---|
| 2735 | pci = NULL;
|
---|
| 2736 | if (SHORT1FROMMP(mp1) == IDM_HIDEALL) {
|
---|
| 2737 | if (pci) {
|
---|
| 2738 | if (!(pci->rc.flRecordAttr & CRA_SELECTED))
|
---|
| 2739 | pci->rc.flRecordAttr |= CRA_FILTERED;
|
---|
| 2740 | WinSendMsg(hwnd,
|
---|
| 2741 | CM_INVALIDATERECORD,
|
---|
| 2742 | MPFROMP(&pci),
|
---|
| 2743 | MPFROM2SHORT(1, CMA_ERASE | CMA_REPOSITION));
|
---|
| 2744 | break;
|
---|
| 2745 | }
|
---|
| 2746 | }
|
---|
| 2747 | PostMsg(dcd->hwndObject, UM_SELECT, mp1, MPFROMP(pci));
|
---|
| 2748 | }
|
---|
| 2749 | break;
|
---|
[2] | 2750 |
|
---|
[551] | 2751 | case IDM_SORTSMARTNAME:
|
---|
| 2752 | case IDM_SORTNAME:
|
---|
| 2753 | case IDM_SORTFILENAME:
|
---|
| 2754 | case IDM_SORTSIZE:
|
---|
| 2755 | case IDM_SORTEASIZE:
|
---|
| 2756 | case IDM_SORTFIRST:
|
---|
| 2757 | case IDM_SORTLAST:
|
---|
| 2758 | case IDM_SORTLWDATE:
|
---|
| 2759 | dcd->sortFlags &= SORT_REVERSE;
|
---|
| 2760 | /* intentional fallthru */
|
---|
| 2761 | case IDM_SORTREVERSE:
|
---|
| 2762 | switch (SHORT1FROMMP(mp1)) {
|
---|
| 2763 | case IDM_SORTSMARTNAME:
|
---|
| 2764 | case IDM_SORTFILENAME:
|
---|
| 2765 | dcd->sortFlags |= SORT_FILENAME;
|
---|
| 2766 | break;
|
---|
| 2767 | case IDM_SORTSIZE:
|
---|
| 2768 | dcd->sortFlags |= SORT_SIZE;
|
---|
| 2769 | break;
|
---|
| 2770 | case IDM_SORTEASIZE:
|
---|
| 2771 | dcd->sortFlags |= SORT_EASIZE;
|
---|
| 2772 | break;
|
---|
| 2773 | case IDM_SORTFIRST:
|
---|
| 2774 | dcd->sortFlags |= SORT_FIRSTEXTENSION;
|
---|
| 2775 | break;
|
---|
| 2776 | case IDM_SORTLAST:
|
---|
| 2777 | dcd->sortFlags |= SORT_LASTEXTENSION;
|
---|
| 2778 | break;
|
---|
| 2779 | case IDM_SORTLWDATE:
|
---|
| 2780 | dcd->sortFlags |= SORT_LWDATE;
|
---|
| 2781 | break;
|
---|
| 2782 | case IDM_SORTREVERSE:
|
---|
| 2783 | if (dcd->sortFlags & SORT_REVERSE)
|
---|
| 2784 | dcd->sortFlags &= (~SORT_REVERSE);
|
---|
| 2785 | else
|
---|
| 2786 | dcd->sortFlags |= SORT_REVERSE;
|
---|
| 2787 | break;
|
---|
| 2788 | }
|
---|
| 2789 | WinSendMsg(hwnd, CM_SORTRECORD, MPFROMP(ArcSort), MPFROMP(dcd));
|
---|
| 2790 | SaySort(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 2791 | DIR_SORT), dcd->sortFlags, TRUE);
|
---|
| 2792 | DefArcSortFlags = dcd->sortFlags; // Remember for new windows
|
---|
| 2793 | break;
|
---|
[2] | 2794 |
|
---|
[551] | 2795 | case IDM_COLLECTOR:
|
---|
| 2796 | if (!Collector) {
|
---|
| 2797 | HWND hwndC;
|
---|
| 2798 | SWP swp;
|
---|
[2] | 2799 |
|
---|
[551] | 2800 | if (ParentIsDesktop(hwnd, dcd->hwndParent) && !fAutoTile &&
|
---|
| 2801 | (!fExternalCollector && !strcmp(realappname, FM3Str)))
|
---|
| 2802 | GetNextWindowPos(dcd->hwndParent, &swp, NULL, NULL);
|
---|
[563] | 2803 | hwndC = StartCollector(fExternalCollector ||
|
---|
| 2804 | strcmp(realappname, FM3Str) ?
|
---|
| 2805 | HWND_DESKTOP : dcd->hwndParent, 4);
|
---|
[551] | 2806 | if (hwndC) {
|
---|
| 2807 | if (!ParentIsDesktop(hwnd, dcd->hwndParent) && !fAutoTile &&
|
---|
| 2808 | (!fExternalCollector && !strcmp(realappname, FM3Str)))
|
---|
| 2809 | WinSetWindowPos(hwndC,
|
---|
| 2810 | HWND_TOP,
|
---|
| 2811 | swp.x,
|
---|
| 2812 | swp.y,
|
---|
| 2813 | swp.cx,
|
---|
| 2814 | swp.cy,
|
---|
| 2815 | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER);
|
---|
| 2816 | else if (!ParentIsDesktop(hwnd, dcd->hwndParent) &&
|
---|
| 2817 | fAutoTile && !strcmp(realappname, FM3Str)) {
|
---|
| 2818 | TileChildren(dcd->hwndParent, TRUE);
|
---|
| 2819 | }
|
---|
| 2820 | WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE);
|
---|
[771] | 2821 | DosSleep(100); //05 Aug 07 GKY 128
|
---|
[551] | 2822 | }
|
---|
| 2823 | }
|
---|
| 2824 | else
|
---|
| 2825 | StartCollector(dcd->hwndParent, 4);
|
---|
| 2826 | break;
|
---|
[2] | 2827 |
|
---|
[551] | 2828 | case IDM_ARCEXTRACTEXIT:
|
---|
| 2829 | case IDM_ARCEXTRACT:
|
---|
| 2830 | if (dcd->info->extract)
|
---|
| 2831 | runemf2(SEPARATE | WINDOWED |
|
---|
[888] | 2832 | (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED),
|
---|
| 2833 | hwnd, pszSrcFile, __LINE__,
|
---|
| 2834 | dcd->directory, NULL, "%s %s", dcd->info->extract,
|
---|
[773] | 2835 | BldQuotedFileName(szQuotedArcName, dcd->arcname));
|
---|
[551] | 2836 | if (SHORT1FROMMP(mp1) == IDM_ARCEXTRACTEXIT)
|
---|
| 2837 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
| 2838 | break;
|
---|
[2] | 2839 |
|
---|
[551] | 2840 | case IDM_ARCEXTRACTWDIRSEXIT:
|
---|
| 2841 | case IDM_ARCEXTRACTWDIRS:
|
---|
| 2842 | if (dcd->info->exwdirs)
|
---|
| 2843 | runemf2(SEPARATE | WINDOWED |
|
---|
[888] | 2844 | (fArcStuffVisible ? 0 : BACKGROUND | MINIMIZED),
|
---|
| 2845 | hwnd, pszSrcFile, __LINE__,
|
---|
| 2846 | dcd->directory, NULL, "%s %s",
|
---|
[551] | 2847 | dcd->info->exwdirs,
|
---|
[773] | 2848 | BldQuotedFileName(szQuotedArcName, dcd->arcname));
|
---|
[551] | 2849 | if (SHORT1FROMMP(mp1) == IDM_ARCEXTRACTWDIRSEXIT)
|
---|
| 2850 | PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
|
---|
| 2851 | break;
|
---|
[2] | 2852 |
|
---|
[551] | 2853 | case IDM_RESORT:
|
---|
| 2854 | WinSendMsg(hwnd, CM_SORTRECORD, MPFROMP(ArcSort), MPFROMP(dcd));
|
---|
| 2855 | break;
|
---|
[2] | 2856 |
|
---|
[551] | 2857 | case IDM_FILTER:
|
---|
| 2858 | {
|
---|
| 2859 | BOOL empty = FALSE;
|
---|
| 2860 | PARCITEM pci;
|
---|
[2] | 2861 |
|
---|
[551] | 2862 | if (!*dcd->mask.szMask) {
|
---|
| 2863 | empty = TRUE;
|
---|
| 2864 | pci = (PARCITEM) CurrentRecord(hwnd);
|
---|
[730] | 2865 | if (pci && strchr(pci->pszFileName, '.'))
|
---|
| 2866 | strcpy(dcd->mask.szMask, pci->pszFileName);
|
---|
[551] | 2867 | }
|
---|
[2] | 2868 |
|
---|
[551] | 2869 | if (WinDlgBox(HWND_DESKTOP, hwnd, PickMaskDlgProc,
|
---|
| 2870 | FM3ModHandle, MSK_FRAME, MPFROMP(&dcd->mask))) {
|
---|
| 2871 | WinSendMsg(hwnd, CM_FILTER, MPFROMP(ArcFilter), MPFROMP(dcd));
|
---|
| 2872 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
| 2873 | }
|
---|
| 2874 | else if (empty)
|
---|
| 2875 | *dcd->mask.szMask = 0;
|
---|
| 2876 | SayFilter(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 2877 | DIR_FILTER), &dcd->mask, TRUE);
|
---|
| 2878 | }
|
---|
| 2879 | break;
|
---|
[2] | 2880 |
|
---|
[551] | 2881 | case IDM_SWITCH:
|
---|
| 2882 | if (mp2) {
|
---|
| 2883 | if (stricmp(dcd->directory, (CHAR *) mp2)) {
|
---|
| 2884 | DosEnterCritSec();
|
---|
| 2885 | strcpy(lastextractpath, (CHAR *) mp2);
|
---|
| 2886 | MakeValidDir(lastextractpath);
|
---|
| 2887 | DosExitCritSec();
|
---|
| 2888 | }
|
---|
| 2889 | strcpy(dcd->directory, (CHAR *) mp2);
|
---|
| 2890 | MakeValidDir(dcd->directory);
|
---|
| 2891 | WinSetWindowText(dcd->hwndExtract, dcd->directory);
|
---|
| 2892 | }
|
---|
| 2893 | break;
|
---|
[2] | 2894 |
|
---|
[551] | 2895 | case IDM_WALKDIR:
|
---|
| 2896 | {
|
---|
| 2897 | CHAR newdir[CCHMAXPATH];
|
---|
[2] | 2898 |
|
---|
[551] | 2899 | strcpy(newdir, dcd->directory);
|
---|
| 2900 | if (!WinDlgBox(HWND_DESKTOP, dcd->hwndParent, WalkExtractDlgProc,
|
---|
| 2901 | FM3ModHandle, WALK_FRAME,
|
---|
| 2902 | MPFROMP(newdir)) || !*newdir)
|
---|
| 2903 | break;
|
---|
| 2904 | if (stricmp(newdir, dcd->directory)) {
|
---|
| 2905 | strcpy(dcd->directory, newdir);
|
---|
| 2906 | if (stricmp(lastextractpath, newdir))
|
---|
| 2907 | strcpy(lastextractpath, newdir);
|
---|
| 2908 | WinSetWindowText(dcd->hwndExtract, dcd->directory);
|
---|
| 2909 | }
|
---|
| 2910 | }
|
---|
| 2911 | break;
|
---|
[2] | 2912 |
|
---|
[551] | 2913 | case IDM_TEST:
|
---|
| 2914 | if (dcd->info->test)
|
---|
| 2915 | runemf2(SEPARATEKEEP | WINDOWED | MAXIMIZED,
|
---|
[888] | 2916 | hwnd, pszSrcFile, __LINE__, NULL, NULL,
|
---|
[773] | 2917 | "%s %s",dcd->info->test,
|
---|
| 2918 | BldQuotedFileName(szQuotedArcName, dcd->arcname));
|
---|
[551] | 2919 | break;
|
---|
[2] | 2920 |
|
---|
[551] | 2921 | case IDM_REFRESH:
|
---|
| 2922 | case IDM_DELETE:
|
---|
| 2923 | case IDM_PRINT:
|
---|
| 2924 | case IDM_VIEW:
|
---|
| 2925 | case IDM_VIEWTEXT:
|
---|
| 2926 | case IDM_VIEWBINARY:
|
---|
| 2927 | case IDM_VIEWARCHIVE:
|
---|
| 2928 | case IDM_EDIT:
|
---|
| 2929 | case IDM_EDITTEXT:
|
---|
| 2930 | case IDM_EDITBINARY:
|
---|
| 2931 | case IDM_EXTRACT:
|
---|
| 2932 | case IDM_EXTRACTWDIRS:
|
---|
| 2933 | case IDM_FIND:
|
---|
| 2934 | case IDM_EXEC:
|
---|
| 2935 | case IDM_VIRUSSCAN:
|
---|
| 2936 | {
|
---|
| 2937 | LISTINFO *li;
|
---|
[2] | 2938 |
|
---|
[551] | 2939 | li = xmallocz(sizeof(LISTINFO), pszSrcFile, __LINE__);
|
---|
| 2940 | if (li) {
|
---|
| 2941 | li->type = SHORT1FROMMP(mp1);
|
---|
| 2942 | li->hwnd = hwnd;
|
---|
| 2943 | li->list = BuildArcList(hwnd);
|
---|
| 2944 | if (li->type == IDM_REFRESH) {
|
---|
[2] | 2945 |
|
---|
[551] | 2946 | CHAR s[CCHMAXPATH], *p;
|
---|
| 2947 | INT x, y;
|
---|
[2] | 2948 |
|
---|
[551] | 2949 | for (x = 0; li->list && li->list[x]; x++) {
|
---|
[773] | 2950 | BldFullPathName(s, dcd->workdir, li->list[x]);
|
---|
[551] | 2951 | if (IsFile(s) != 1) {
|
---|
| 2952 | free(li->list[x]);
|
---|
| 2953 | li->list[x] = NULL;
|
---|
| 2954 | for (y = x; li->list[y]; y++)
|
---|
| 2955 | li->list[y] = li->list[y + 1];
|
---|
| 2956 | li->list =
|
---|
| 2957 | xrealloc(li->list, y * sizeof(CHAR *), pszSrcFile,
|
---|
| 2958 | __LINE__);
|
---|
| 2959 | x--;
|
---|
| 2960 | }
|
---|
| 2961 | else {
|
---|
| 2962 | p = xstrdup(s, pszSrcFile, __LINE__);
|
---|
| 2963 | if (p) {
|
---|
| 2964 | free(li->list[x]);
|
---|
| 2965 | li->list[x] = p;
|
---|
| 2966 | }
|
---|
| 2967 | }
|
---|
| 2968 | } // for
|
---|
| 2969 | }
|
---|
| 2970 | strcpy(li->arcname, dcd->arcname);
|
---|
| 2971 | li->info = dcd->info;
|
---|
| 2972 | {
|
---|
| 2973 | PARCITEM pai;
|
---|
[2] | 2974 |
|
---|
[551] | 2975 | if (SHORT1FROMMP(mp1) != IDM_EXEC)
|
---|
| 2976 | pai = (PARCITEM) CurrentRecord(hwnd);
|
---|
| 2977 | else
|
---|
| 2978 | pai = (PARCITEM) WinSendMsg(hwnd, CM_QUERYRECORDEMPHASIS,
|
---|
| 2979 | MPFROMLONG(CMA_FIRST),
|
---|
| 2980 | MPFROMSHORT(CRA_CURSORED));
|
---|
| 2981 | if (pai && (INT) pai != -1)
|
---|
[730] | 2982 | strcpy(li->runfile, pai->pszFileName);
|
---|
[551] | 2983 | else
|
---|
| 2984 | strcpy(li->runfile, li->list[0]);
|
---|
| 2985 | }
|
---|
| 2986 | switch (SHORT1FROMMP(mp1)) {
|
---|
| 2987 | case IDM_VIEW:
|
---|
| 2988 | case IDM_VIEWTEXT:
|
---|
| 2989 | case IDM_VIEWBINARY:
|
---|
| 2990 | case IDM_VIEWARCHIVE:
|
---|
| 2991 | case IDM_EDIT:
|
---|
| 2992 | case IDM_EDITTEXT:
|
---|
| 2993 | case IDM_EDITBINARY:
|
---|
| 2994 | case IDM_EXEC:
|
---|
| 2995 | case IDM_PRINT:
|
---|
| 2996 | case IDM_VIRUSSCAN:
|
---|
| 2997 | strcpy(li->targetpath, dcd->workdir);
|
---|
| 2998 | break;
|
---|
| 2999 | default:
|
---|
| 3000 | strcpy(li->targetpath, dcd->directory);
|
---|
| 3001 | break;
|
---|
| 3002 | }
|
---|
| 3003 | if (li->list) {
|
---|
| 3004 | if (!PostMsg(dcd->hwndObject, UM_ACTION, MPFROMP(li), MPVOID)) {
|
---|
| 3005 | Runtime_Error(pszSrcFile, __LINE__, "post");
|
---|
| 3006 | FreeListInfo(li);
|
---|
| 3007 | }
|
---|
| 3008 | else if (fUnHilite && SHORT1FROMMP(mp1) != IDM_EDIT)
|
---|
[672] | 3009 | UnHilite(hwnd, TRUE, &dcd->lastselection, 0);
|
---|
[551] | 3010 | }
|
---|
| 3011 | else
|
---|
| 3012 | free(li);
|
---|
| 3013 | }
|
---|
| 3014 | }
|
---|
| 3015 | break;
|
---|
[2] | 3016 | }
|
---|
[551] | 3017 | }
|
---|
| 3018 | return 0;
|
---|
[2] | 3019 |
|
---|
[551] | 3020 | case WM_CONTROL:
|
---|
| 3021 | DosError(FERR_DISABLEHARDERR);
|
---|
| 3022 | if (dcd) {
|
---|
| 3023 | switch (SHORT2FROMMP(mp1)) {
|
---|
| 3024 | case CN_BEGINEDIT:
|
---|
| 3025 | PostMsg(hwnd, CM_CLOSEEDIT, MPVOID, MPVOID);
|
---|
| 3026 | break;
|
---|
[2] | 3027 |
|
---|
[551] | 3028 | case CN_ENDEDIT:
|
---|
| 3029 | if (!((PCNREDITDATA) mp2)->pRecord) {
|
---|
[2] | 3030 |
|
---|
[551] | 3031 | PFIELDINFO pfi = ((PCNREDITDATA) mp2)->pFieldInfo;
|
---|
| 3032 | USHORT cmd = 0;
|
---|
[2] | 3033 |
|
---|
[739] | 3034 | if (!pfi || pfi->offStruct == FIELDOFFSET(ARCITEM, pszDisplayName))
|
---|
[551] | 3035 | cmd = IDM_SORTSMARTNAME;
|
---|
| 3036 | else if (pfi->offStruct == FIELDOFFSET(ARCITEM, cbFile))
|
---|
| 3037 | cmd = IDM_SORTSIZE;
|
---|
| 3038 | else if (pfi->offStruct == FIELDOFFSET(ARCITEM, cbComp))
|
---|
| 3039 | cmd = IDM_SORTEASIZE;
|
---|
| 3040 | else if (pfi->offStruct == FIELDOFFSET(ARCITEM, date))
|
---|
| 3041 | cmd = IDM_SORTLWDATE;
|
---|
| 3042 | else if (pfi->offStruct == FIELDOFFSET(ARCITEM, time))
|
---|
| 3043 | cmd = IDM_SORTLWDATE;
|
---|
| 3044 | if (cmd)
|
---|
| 3045 | PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
|
---|
| 3046 | }
|
---|
| 3047 | break;
|
---|
[2] | 3048 |
|
---|
[551] | 3049 | case CN_DROPHELP:
|
---|
| 3050 | saymsg(MB_ENTER, hwnd,
|
---|
| 3051 | GetPString(IDS_DROPHELPHDRTEXT),
|
---|
| 3052 | GetPString(IDS_ARCCNRDROPHELPTEXT), dcd->arcname);
|
---|
| 3053 | return 0;
|
---|
[2] | 3054 |
|
---|
[551] | 3055 | case CN_DRAGLEAVE:
|
---|
| 3056 | if (mp2) {
|
---|
[2] | 3057 |
|
---|
[551] | 3058 | PDRAGINFO pDInfo;
|
---|
[2] | 3059 |
|
---|
[551] | 3060 | pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
|
---|
[562] | 3061 | DrgAccessDraginfo(pDInfo); /* Access DRAGINFO */
|
---|
| 3062 | DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
|
---|
[551] | 3063 | }
|
---|
| 3064 | return 0;
|
---|
[2] | 3065 |
|
---|
[551] | 3066 | case CN_DRAGAFTER:
|
---|
| 3067 | case CN_DRAGOVER:
|
---|
| 3068 | if (mp2) {
|
---|
[2] | 3069 |
|
---|
[773] | 3070 | PDRAGITEM pDItem; /* Pointer to DRAGITEM */
|
---|
| 3071 | PDRAGINFO pDInfo; /* Pointer to DRAGINFO */
|
---|
[551] | 3072 | PARCITEM pci;
|
---|
[2] | 3073 |
|
---|
[551] | 3074 | pci = (PARCITEM) ((PCNRDRAGINFO) mp2)->pRecord;
|
---|
| 3075 | if (SHORT1FROMMP(mp1) == CN_DRAGAFTER)
|
---|
| 3076 | pci = NULL;
|
---|
| 3077 | pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
|
---|
[562] | 3078 | DrgAccessDraginfo(pDInfo); /* Access DRAGINFO */
|
---|
[551] | 3079 | if (*dcd->arcname) {
|
---|
| 3080 | if ((driveflags[toupper(*dcd->arcname) - 'A'] &
|
---|
| 3081 | DRIVE_NOTWRITEABLE) || !dcd->info || !dcd->info->create) {
|
---|
| 3082 | DrgFreeDraginfo(pDInfo);
|
---|
| 3083 | return MRFROM2SHORT(DOR_NEVERDROP, 0);
|
---|
| 3084 | }
|
---|
| 3085 | }
|
---|
| 3086 | if (pci) {
|
---|
| 3087 | DrgFreeDraginfo(pDInfo);
|
---|
| 3088 | return MRFROM2SHORT(DOR_NODROP, 0);
|
---|
| 3089 | }
|
---|
[562] | 3090 | pDItem = DrgQueryDragitemPtr(pDInfo, /* Access DRAGITEM */
|
---|
| 3091 | 0); /* Index to DRAGITEM */
|
---|
[551] | 3092 | if (DrgVerifyRMF(pDItem, /* Check valid rendering */
|
---|
[562] | 3093 | DRM_OS2FILE, /* mechanisms and data */
|
---|
[551] | 3094 | NULL) && !(pDItem->fsControl & DC_PREPARE)) {
|
---|
[773] | 3095 | DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
|
---|
[562] | 3096 | return MRFROM2SHORT(DOR_DROP, /* Return okay to drop */
|
---|
| 3097 | fCopyDefault ? DO_COPY : DO_MOVE);
|
---|
[551] | 3098 | }
|
---|
[562] | 3099 | DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */
|
---|
[551] | 3100 | }
|
---|
[562] | 3101 | return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */
|
---|
[2] | 3102 |
|
---|
[551] | 3103 | case CN_INITDRAG:
|
---|
| 3104 | if (mp2) {
|
---|
[2] | 3105 |
|
---|
[551] | 3106 | BOOL wasemphasized = FALSE;
|
---|
| 3107 | PCNRDRAGINIT pcd = (PCNRDRAGINIT) mp2;
|
---|
| 3108 | PARCITEM pci;
|
---|
[2] | 3109 |
|
---|
[551] | 3110 | if (pcd) {
|
---|
| 3111 | pci = (PARCITEM) pcd->pRecord;
|
---|
| 3112 | if (pci) {
|
---|
| 3113 | if (pci->rc.flRecordAttr & CRA_SELECTED)
|
---|
| 3114 | wasemphasized = TRUE;
|
---|
| 3115 | if (!ParentIsDesktop(hwnd, dcd->hwndParent) &&
|
---|
| 3116 | fSplitStatus && hwndStatus2)
|
---|
| 3117 | WinSetWindowText(hwndStatus2, GetPString(IDS_DRAGARCMEMTEXT));
|
---|
| 3118 | if (DoFileDrag(hwnd,
|
---|
| 3119 | dcd->hwndObject,
|
---|
| 3120 | mp2, dcd->arcname, NULL, TRUE)) {
|
---|
[672] | 3121 | if ((fUnHilite && wasemphasized) || dcd->ulItemsToUnHilite)
|
---|
| 3122 | UnHilite(hwnd, TRUE, &dcd->lastselection, dcd->ulItemsToUnHilite);
|
---|
[551] | 3123 | }
|
---|
| 3124 | if (!ParentIsDesktop(hwnd, dcd->hwndParent) &&
|
---|
| 3125 | fSplitStatus && hwndStatus2) {
|
---|
| 3126 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
| 3127 | }
|
---|
| 3128 | }
|
---|
| 3129 | else {
|
---|
| 3130 | if (!ParentIsDesktop(hwnd, dcd->hwndParent) &&
|
---|
| 3131 | fSplitStatus && hwndStatus2)
|
---|
| 3132 | WinSetWindowText(hwndStatus2,
|
---|
| 3133 | GetPString(IDS_DRAGARCFILETEXT));
|
---|
| 3134 | DragOne(hwnd, dcd->hwndObject, dcd->arcname, FALSE);
|
---|
| 3135 | if (!ParentIsDesktop(hwnd, dcd->hwndParent) &&
|
---|
| 3136 | fSplitStatus && hwndStatus2)
|
---|
| 3137 | PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
|
---|
| 3138 | }
|
---|
| 3139 | }
|
---|
| 3140 | }
|
---|
| 3141 | return 0;
|
---|
[2] | 3142 |
|
---|
[551] | 3143 | case CN_DROP:
|
---|
| 3144 | if (mp2) {
|
---|
[2] | 3145 |
|
---|
[551] | 3146 | LISTINFO *li;
|
---|
[2] | 3147 |
|
---|
[551] | 3148 | DosBeep(500, 100); // fixme to know why beep?
|
---|
| 3149 | li = DoFileDrop(hwnd, dcd->arcname, FALSE, mp1, mp2);
|
---|
[762] | 3150 | DosBeep(50, 100); // fixme to know why beep?
|
---|
| 3151 | CheckPmDrgLimit(((PCNRDRAGINFO)mp2)->pDragInfo);
|
---|
[551] | 3152 | if (li) {
|
---|
[562] | 3153 | li->type = li->type == DO_MOVE ? IDM_ARCHIVEM : IDM_ARCHIVE;
|
---|
[551] | 3154 | strcpy(li->targetpath, dcd->arcname);
|
---|
| 3155 | if (!li->list ||
|
---|
| 3156 | !li->list[0] ||
|
---|
| 3157 | !PostMsg(dcd->hwndObject, UM_ACTION, MPFROMP(li), MPVOID))
|
---|
| 3158 | FreeListInfo(li);
|
---|
| 3159 | }
|
---|
| 3160 | }
|
---|
| 3161 | return 0;
|
---|
[2] | 3162 |
|
---|
[551] | 3163 | case CN_CONTEXTMENU:
|
---|
| 3164 | {
|
---|
| 3165 | PARCITEM pci = (PARCITEM) mp2;
|
---|
[2] | 3166 |
|
---|
[551] | 3167 | if (pci) {
|
---|
| 3168 | WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPFROMP(pci),
|
---|
| 3169 | MPFROM2SHORT(TRUE, CRA_CURSORED));
|
---|
| 3170 | MarkAll(hwnd, FALSE, FALSE, TRUE);
|
---|
[872] | 3171 | dcd->hwndLastMenu = CheckMenu(hwnd, &ArcMenu, ARC_POPUP);
|
---|
[551] | 3172 | }
|
---|
| 3173 | else {
|
---|
[872] | 3174 | dcd->hwndLastMenu = CheckMenu(hwnd, &ArcCnrMenu, ARCCNR_POPUP);
|
---|
[551] | 3175 | if (dcd->hwndLastMenu && !dcd->cnremphasized) {
|
---|
| 3176 | WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
|
---|
| 3177 | MPFROM2SHORT(TRUE, CRA_SOURCE));
|
---|
| 3178 | dcd->cnremphasized = TRUE;
|
---|
| 3179 | }
|
---|
| 3180 | }
|
---|
| 3181 | if (dcd->hwndLastMenu) {
|
---|
| 3182 | if (dcd->hwndLastMenu == ArcCnrMenu) {
|
---|
| 3183 | if (dcd->flWindowAttr & CV_MINI)
|
---|
| 3184 | WinCheckMenuItem(dcd->hwndLastMenu, IDM_MINIICONS, TRUE);
|
---|
| 3185 | }
|
---|
| 3186 | WinCheckMenuItem(dcd->hwndLastMenu, IDM_FOLDERAFTEREXTRACT,
|
---|
| 3187 | fFolderAfterExtract);
|
---|
| 3188 | if (!PopupMenu(hwnd, hwnd, dcd->hwndLastMenu)) {
|
---|
| 3189 | if (dcd->cnremphasized) {
|
---|
| 3190 | WinSendMsg(hwnd, CM_SETRECORDEMPHASIS, MPVOID,
|
---|
| 3191 | MPFROM2SHORT(FALSE, CRA_SOURCE));
|
---|
| 3192 | dcd->cnremphasized = TRUE;
|
---|
| 3193 | }
|
---|
| 3194 | MarkAll(hwnd, TRUE, FALSE, TRUE);
|
---|
| 3195 | }
|
---|
| 3196 | }
|
---|
| 3197 | }
|
---|
| 3198 | break;
|
---|
[2] | 3199 |
|
---|
[551] | 3200 | case CN_EMPHASIS:
|
---|
| 3201 | if (mp2) {
|
---|
[2] | 3202 |
|
---|
[551] | 3203 | PNOTIFYRECORDEMPHASIS pre = mp2;
|
---|
| 3204 | PARCITEM pci;
|
---|
| 3205 | CHAR s[CCHMAXPATHCOMP + 91], tf[81], tb[81];
|
---|
[2] | 3206 |
|
---|
[562] | 3207 | pci = (PARCITEM)(pre ? pre->pRecord : NULL);
|
---|
[551] | 3208 | if (!pci) {
|
---|
| 3209 | if (!ParentIsDesktop(hwnd, dcd->hwndParent)) {
|
---|
| 3210 | if (hwndStatus2)
|
---|
| 3211 | WinSetWindowText(hwndStatus2, NullStr);
|
---|
| 3212 | if (fMoreButtons)
|
---|
| 3213 | WinSetWindowText(hwndName, NullStr);
|
---|
| 3214 | }
|
---|
| 3215 | break;
|
---|
| 3216 | }
|
---|
| 3217 | if (pre->fEmphasisMask & CRA_SELECTED) {
|
---|
| 3218 | if (pci->rc.flRecordAttr & CRA_SELECTED) {
|
---|
| 3219 | dcd->selectedbytes += pci->cbFile;
|
---|
| 3220 | dcd->selectedfiles++;
|
---|
| 3221 | }
|
---|
| 3222 | else if (dcd->selectedfiles) {
|
---|
| 3223 | dcd->selectedbytes -= pci->cbFile;
|
---|
| 3224 | dcd->selectedfiles--;
|
---|
| 3225 | }
|
---|
| 3226 | commafmt(tf, sizeof(tf), dcd->selectedfiles);
|
---|
| 3227 | if (dcd->ullTotalBytes)
|
---|
| 3228 | CommaFmtULL(tb, sizeof(tb), dcd->selectedbytes, ' ');
|
---|
| 3229 | else
|
---|
| 3230 | *tb = 0;
|
---|
| 3231 | sprintf(s, "%s%s%s", tf, *tb ? " / " : NullStr, tb);
|
---|
| 3232 | WinSetDlgItemText(dcd->hwndClient, DIR_SELECTED, s);
|
---|
| 3233 | }
|
---|
| 3234 | else if (WinQueryActiveWindow(dcd->hwndParent) ==
|
---|
| 3235 | dcd->hwndFrame &&
|
---|
| 3236 | !ParentIsDesktop(hwnd, dcd->hwndParent)) {
|
---|
| 3237 | if (pre->fEmphasisMask & CRA_CURSORED) {
|
---|
| 3238 | if (pci->rc.flRecordAttr & CRA_CURSORED) {
|
---|
| 3239 | if (fSplitStatus && hwndStatus2) {
|
---|
| 3240 | if (dcd->ullTotalBytes)
|
---|
| 3241 | CommaFmtULL(tb, sizeof(tb), pci->cbFile, ' ');
|
---|
| 3242 | else
|
---|
| 3243 | *tb = 0;
|
---|
| 3244 | sprintf(s, "%s%s%s%s",
|
---|
| 3245 | *tb ? " " : NullStr,
|
---|
[730] | 3246 | tb, *tb ? " " : NullStr, pci->pszFileName);
|
---|
[551] | 3247 | WinSetWindowText(hwndStatus2, s);
|
---|
| 3248 | }
|
---|
| 3249 | if (fMoreButtons)
|
---|
[730] | 3250 | WinSetWindowText(hwndName, pci->pszFileName);
|
---|
[551] | 3251 | }
|
---|
| 3252 | }
|
---|
| 3253 | }
|
---|
| 3254 | }
|
---|
| 3255 | break;
|
---|
[2] | 3256 |
|
---|
[551] | 3257 | case CN_ENTER:
|
---|
| 3258 | if (mp2) {
|
---|
[2] | 3259 |
|
---|
[551] | 3260 | PARCITEM pci = (PARCITEM) ((PNOTIFYRECORDENTER) mp2)->pRecord;
|
---|
[2] | 3261 |
|
---|
[551] | 3262 | if (pci) {
|
---|
[2] | 3263 |
|
---|
[551] | 3264 | CHAR *s;
|
---|
[2] | 3265 |
|
---|
[551] | 3266 | if ((pci->rc.flRecordAttr & CRA_INUSE) ||
|
---|
| 3267 | (pci->flags & (ARCFLAGS_REALDIR | ARCFLAGS_PSEUDODIR)))
|
---|
| 3268 | break;
|
---|
[730] | 3269 | s = xstrdup(pci->pszFileName, pszSrcFile, __LINE__);
|
---|
[551] | 3270 | if (s) {
|
---|
| 3271 | if (!PostMsg(dcd->hwndObject, UM_ENTER, MPFROMP(s), MPVOID)) {
|
---|
| 3272 | Runtime_Error(pszSrcFile, __LINE__, "post");
|
---|
| 3273 | free(s);
|
---|
| 3274 | }
|
---|
| 3275 | }
|
---|
| 3276 | }
|
---|
| 3277 | }
|
---|
| 3278 | break;
|
---|
[2] | 3279 | }
|
---|
[551] | 3280 | }
|
---|
| 3281 | return 0;
|
---|
[2] | 3282 |
|
---|
[551] | 3283 | case UM_FOLDUP:
|
---|
| 3284 | if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
|
---|
| 3285 | DosExit(EXIT_PROCESS, 1);
|
---|
| 3286 | return 0;
|
---|
[2] | 3287 |
|
---|
[551] | 3288 | case UM_CLOSE:
|
---|
| 3289 | WinDestroyWindow(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
|
---|
| 3290 | QW_PARENT));
|
---|
| 3291 | return 0;
|
---|
[2] | 3292 |
|
---|
[551] | 3293 | case WM_SAVEAPPLICATION:
|
---|
| 3294 | if (dcd && ParentIsDesktop(hwnd, dcd->hwndParent)) {
|
---|
| 3295 | SWP swp;
|
---|
[2] | 3296 |
|
---|
[551] | 3297 | WinQueryWindowPos(dcd->hwndFrame, &swp);
|
---|
| 3298 | if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE | SWP_MAXIMIZE)))
|
---|
| 3299 | PrfWriteProfileData(fmprof, appname, "AV2SizePos", &swp, sizeof(swp));
|
---|
| 3300 | }
|
---|
| 3301 | break;
|
---|
[2] | 3302 |
|
---|
[551] | 3303 | case WM_CLOSE:
|
---|
| 3304 | WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
|
---|
| 3305 | if (dcd)
|
---|
| 3306 | dcd->stopflag++;
|
---|
| 3307 | if (dcd && dcd->hwndObject) {
|
---|
| 3308 | if (!PostMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID))
|
---|
| 3309 | WinSendMsg(dcd->hwndObject, WM_CLOSE, MPVOID, MPVOID);
|
---|
| 3310 | }
|
---|
| 3311 | // In case object window frees dcd
|
---|
| 3312 | dcd = WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
| 3313 | if (!dcd ||
|
---|
| 3314 | (!dcd->dontclose &&
|
---|
| 3315 | !dcd->amextracted && ParentIsDesktop(hwnd, dcd->hwndParent))) {
|
---|
| 3316 | if (!PostMsg(hwnd, UM_FOLDUP, MPVOID, MPVOID))
|
---|
| 3317 | WinSendMsg(hwnd, UM_FOLDUP, MPVOID, MPVOID);
|
---|
| 3318 | }
|
---|
| 3319 | return 0;
|
---|
| 3320 |
|
---|
| 3321 | case WM_DESTROY:
|
---|
| 3322 | if (ArcMenu)
|
---|
| 3323 | WinDestroyWindow(ArcMenu);
|
---|
| 3324 | if (ArcCnrMenu)
|
---|
| 3325 | WinDestroyWindow(ArcCnrMenu);
|
---|
| 3326 | ArcMenu = ArcCnrMenu = (HWND) 0;
|
---|
[751] | 3327 | EmptyArcCnr(hwnd);
|
---|
[551] | 3328 | break;
|
---|
[2] | 3329 | }
|
---|
[705] | 3330 | if (dcd && dcd->oldproc){
|
---|
| 3331 | return dcd->oldproc(hwnd, msg, mp1, mp2);
|
---|
| 3332 | }
|
---|
| 3333 | else
|
---|
| 3334 | return PFNWPCnr(hwnd, msg, mp1, mp2);
|
---|
[2] | 3335 | }
|
---|
| 3336 |
|
---|
[551] | 3337 | HWND StartArcCnr(HWND hwndParent, HWND hwndCaller, CHAR * arcname, INT flags,
|
---|
| 3338 | ARC_TYPE * sinfo)
|
---|
[212] | 3339 | {
|
---|
[2] | 3340 | /*
|
---|
| 3341 | * bitmapped flags:
|
---|
| 3342 | * 1 = am extracted from another archive
|
---|
| 3343 | * 4 = don't kill proc on close
|
---|
| 3344 | */
|
---|
| 3345 |
|
---|
[551] | 3346 | HWND hwndFrame = (HWND) 0, hwndClient;
|
---|
| 3347 | ULONG FrameFlags = FCF_TITLEBAR | FCF_SYSMENU |
|
---|
| 3348 | FCF_SIZEBORDER | FCF_MINMAX | FCF_ICON | FCF_NOBYTEALIGN | FCF_ACCELTABLE;
|
---|
| 3349 | USHORT id;
|
---|
| 3350 | DIRCNRDATA *dcd;
|
---|
| 3351 | ARC_TYPE *info = sinfo;
|
---|
| 3352 | CHAR title[MAXNAMEL + 1] = "AV/2 - ";
|
---|
| 3353 | CHAR fullname[CCHMAXPATH + 8], *p, temp;
|
---|
[2] | 3354 | static USHORT idinc = 0;
|
---|
| 3355 |
|
---|
[423] | 3356 | if (!idinc)
|
---|
[2] | 3357 | idinc = (rand() % 256);
|
---|
[551] | 3358 | if (ParentIsDesktop(hwndParent, hwndParent))
|
---|
[2] | 3359 | FrameFlags |= (FCF_TASKLIST | FCF_MENU);
|
---|
[423] | 3360 | if (arcname) {
|
---|
[2] | 3361 | DosError(FERR_DISABLEHARDERR);
|
---|
[423] | 3362 | if (DosQueryPathInfo(arcname,
|
---|
[551] | 3363 | FIL_QUERYFULLNAME, fullname, sizeof(fullname)))
|
---|
| 3364 | strcpy(fullname, arcname);
|
---|
[2] | 3365 | p = fullname;
|
---|
[551] | 3366 | while (*p) {
|
---|
[423] | 3367 | if (*p == '/')
|
---|
[551] | 3368 | *p = '\\';
|
---|
[2] | 3369 | p++;
|
---|
| 3370 | }
|
---|
[423] | 3371 | if (!info)
|
---|
[551] | 3372 | info = find_type(fullname, arcsighead);
|
---|
[423] | 3373 | if (!info)
|
---|
[2] | 3374 | return hwndFrame;
|
---|
[551] | 3375 | if (strlen(title) + strlen(fullname) > MAXNAMEL) {
|
---|
| 3376 | p = title + strlen(title);
|
---|
| 3377 | strncpy(p, fullname, MAXNAMEL / 2 - 5);
|
---|
| 3378 | strcpy(p + MAXNAMEL / 2 - 5, "...");
|
---|
| 3379 | strcat(title, fullname + strlen(fullname) - (MAXNAMEL / 2 - 5));
|
---|
[460] | 3380 | }
|
---|
[551] | 3381 | else {
|
---|
| 3382 | strcat(title, fullname);
|
---|
[460] | 3383 | }
|
---|
[2] | 3384 | hwndFrame = WinCreateStdWindow(hwndParent,
|
---|
[551] | 3385 | WS_VISIBLE,
|
---|
| 3386 | &FrameFlags,
|
---|
[593] | 3387 | WC_ARCCONTAINER,
|
---|
[551] | 3388 | title,
|
---|
| 3389 | WS_VISIBLE | fwsAnimate,
|
---|
| 3390 | FM3ModHandle, ARC_FRAME, &hwndClient);
|
---|
[423] | 3391 | if (hwndFrame && hwndClient) {
|
---|
[2] | 3392 | id = ARC_FRAME + idinc++;
|
---|
[423] | 3393 | if (idinc > 512)
|
---|
[551] | 3394 | idinc = 0;
|
---|
| 3395 | WinSetWindowUShort(hwndFrame, QWS_ID, id);
|
---|
| 3396 | dcd = xmallocz(sizeof(DIRCNRDATA), pszSrcFile, __LINE__);
|
---|
[358] | 3397 | if (!dcd) {
|
---|
[551] | 3398 | PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
|
---|
| 3399 | hwndFrame = (HWND) 0;
|
---|
[358] | 3400 | }
|
---|
| 3401 | else {
|
---|
[551] | 3402 | dcd->size = sizeof(DIRCNRDATA);
|
---|
| 3403 | dcd->id = id;
|
---|
| 3404 | dcd->type = ARC_FRAME;
|
---|
| 3405 | save_dir2(dcd->workdir);
|
---|
| 3406 | if (dcd->workdir[strlen(dcd->workdir) - 1] != '\\')
|
---|
| 3407 | strcat(dcd->workdir, "\\");
|
---|
| 3408 | sprintf(dcd->workdir + strlen(dcd->workdir), "%s.%03x",
|
---|
| 3409 | ArcTempRoot, (clock() & 4095));
|
---|
| 3410 | strcpy(dcd->arcname, fullname);
|
---|
| 3411 | if (*extractpath) {
|
---|
| 3412 | if (!strcmp(extractpath, "*")) {
|
---|
| 3413 | p = strrchr(fullname, '\\');
|
---|
| 3414 | if (p) {
|
---|
| 3415 | if (p < fullname + 3)
|
---|
| 3416 | p++;
|
---|
| 3417 | temp = *p;
|
---|
| 3418 | *p = 0;
|
---|
| 3419 | strcpy(dcd->directory, fullname);
|
---|
| 3420 | *p = temp;
|
---|
| 3421 | }
|
---|
| 3422 | }
|
---|
| 3423 | else
|
---|
| 3424 | strcpy(dcd->directory, extractpath);
|
---|
| 3425 | }
|
---|
| 3426 | if (!*dcd->directory && *lastextractpath) {
|
---|
| 3427 | DosEnterCritSec();
|
---|
| 3428 | strcpy(dcd->directory, lastextractpath);
|
---|
| 3429 | DosExitCritSec();
|
---|
| 3430 | }
|
---|
| 3431 | if (!*dcd->directory) {
|
---|
| 3432 | if (!ParentIsDesktop(hwndParent, hwndParent))
|
---|
| 3433 | TopWindowName(hwndParent, hwndCaller, dcd->directory);
|
---|
| 3434 | if (!*dcd->directory) {
|
---|
| 3435 | p = strrchr(fullname, '\\');
|
---|
| 3436 | if (p) {
|
---|
| 3437 | if (p < fullname + 3)
|
---|
| 3438 | p++;
|
---|
| 3439 | *p = 0;
|
---|
| 3440 | strcpy(dcd->directory, fullname);
|
---|
| 3441 | }
|
---|
| 3442 | }
|
---|
| 3443 | }
|
---|
| 3444 | if (!*dcd->directory ||
|
---|
| 3445 | IsFile(dcd->directory) ||
|
---|
| 3446 | (isalpha(*dcd->directory) &&
|
---|
| 3447 | (driveflags[toupper(*dcd->directory) - 'A'] &
|
---|
| 3448 | DRIVE_NOTWRITEABLE)))
|
---|
| 3449 | save_dir2(dcd->directory);
|
---|
[562] | 3450 | dcd->hwndParent = hwndParent ? hwndParent : HWND_DESKTOP;
|
---|
[551] | 3451 | dcd->hwndFrame = hwndFrame;
|
---|
| 3452 | dcd->hwndClient = hwndClient;
|
---|
[562] | 3453 | dcd->amextracted = (flags & 1) != 0;
|
---|
| 3454 | dcd->dontclose = (flags & 4) != 0;
|
---|
[551] | 3455 | dcd->info = info;
|
---|
| 3456 | dcd->sortFlags = DefArcSortFlags;
|
---|
| 3457 | {
|
---|
| 3458 | PFNWP oldproc;
|
---|
[2] | 3459 |
|
---|
[551] | 3460 | oldproc = WinSubclassWindow(hwndFrame, (PFNWP) ArcFrameWndProc);
|
---|
| 3461 | WinSetWindowPtr(hwndFrame, QWL_USER, (PVOID) oldproc);
|
---|
[358] | 3462 | }
|
---|
[551] | 3463 | dcd->hwndCnr = WinCreateWindow(hwndClient,
|
---|
| 3464 | WC_CONTAINER,
|
---|
| 3465 | NULL,
|
---|
| 3466 | CCS_AUTOPOSITION | CCS_MINIICONS |
|
---|
| 3467 | CCS_MINIRECORDCORE | ulCnrType |
|
---|
| 3468 | WS_VISIBLE,
|
---|
| 3469 | 0,
|
---|
| 3470 | 0,
|
---|
| 3471 | 0,
|
---|
| 3472 | 0,
|
---|
| 3473 | hwndClient,
|
---|
| 3474 | HWND_TOP, (ULONG) ARC_CNR, NULL, NULL);
|
---|
| 3475 | if (!dcd->hwndCnr) {
|
---|
| 3476 | Win_Error2(hwndClient, hwndClient, pszSrcFile, __LINE__,
|
---|
| 3477 | IDS_WINCREATEWINDOW);
|
---|
| 3478 | PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID);
|
---|
| 3479 | free(dcd);
|
---|
| 3480 | hwndFrame = (HWND) 0;
|
---|
| 3481 | }
|
---|
[358] | 3482 | else {
|
---|
[551] | 3483 | WinSetWindowPtr(dcd->hwndCnr, QWL_USER, (PVOID) dcd);
|
---|
| 3484 | dcd->oldproc = WinSubclassWindow(dcd->hwndCnr,
|
---|
| 3485 | (PFNWP) ArcCnrWndProc);
|
---|
| 3486 | {
|
---|
| 3487 | USHORT ids[] = { DIR_TOTALS, DIR_SELECTED, DIR_VIEW, DIR_SORT,
|
---|
| 3488 | DIR_FILTER, DIR_FOLDERICON, 0
|
---|
| 3489 | };
|
---|
[2] | 3490 |
|
---|
[551] | 3491 | CommonCreateTextChildren(dcd->hwndClient,
|
---|
[593] | 3492 | WC_ARCSTATUS, ids);
|
---|
[551] | 3493 | }
|
---|
| 3494 | WinEnableWindow(WinWindowFromID(dcd->hwndClient, DIR_VIEW), FALSE);
|
---|
| 3495 | dcd->hwndExtract = WinCreateWindow(dcd->hwndClient,
|
---|
| 3496 | WC_ENTRYFIELD,
|
---|
| 3497 | NULL,
|
---|
| 3498 | ES_AUTOSCROLL,
|
---|
| 3499 | 0,
|
---|
| 3500 | 0,
|
---|
| 3501 | 0,
|
---|
| 3502 | 0,
|
---|
| 3503 | dcd->hwndClient,
|
---|
| 3504 | HWND_TOP,
|
---|
| 3505 | ARC_EXTRACTDIR, NULL, NULL);
|
---|
| 3506 | WinSendMsg(dcd->hwndExtract,
|
---|
| 3507 | EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
|
---|
| 3508 | WinSetWindowText(dcd->hwndExtract, dcd->directory);
|
---|
| 3509 | if (!PostMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID))
|
---|
| 3510 | WinSendMsg(dcd->hwndCnr, UM_SETUP, MPVOID, MPVOID);
|
---|
| 3511 | if (FrameFlags & FCF_MENU) {
|
---|
| 3512 | if (!fToolbar) {
|
---|
| 3513 | HWND hwndMenu = WinWindowFromID(hwndFrame, FID_MENU);
|
---|
[2] | 3514 |
|
---|
[551] | 3515 | if (hwndMenu) {
|
---|
| 3516 | WinSendMsg(hwndMenu, MM_DELETEITEM,
|
---|
| 3517 | MPFROM2SHORT(IDM_VIEW, FALSE), MPVOID);
|
---|
| 3518 | WinSendMsg(hwndMenu, MM_DELETEITEM,
|
---|
| 3519 | MPFROM2SHORT(IDM_EXEC, FALSE), MPVOID);
|
---|
| 3520 | WinSendMsg(hwndMenu, MM_DELETEITEM,
|
---|
| 3521 | MPFROM2SHORT(IDM_RESCAN, FALSE), MPVOID);
|
---|
| 3522 | WinSendMsg(hwndMenu, MM_DELETEITEM,
|
---|
| 3523 | MPFROM2SHORT(IDM_DELETE, FALSE), MPVOID);
|
---|
| 3524 | WinSendMsg(hwndMenu, MM_DELETEITEM,
|
---|
| 3525 | MPFROM2SHORT(IDM_EXTRACT, FALSE), MPVOID);
|
---|
| 3526 | WinSendMsg(hwndMenu, MM_DELETEITEM,
|
---|
| 3527 | MPFROM2SHORT(IDM_TEST, FALSE), MPVOID);
|
---|
| 3528 | WinSendMsg(hwndMenu, MM_DELETEITEM,
|
---|
| 3529 | MPFROM2SHORT(IDM_VIRUSSCAN, FALSE), MPVOID);
|
---|
| 3530 | WinSendMsg(hwndMenu, MM_DELETEITEM,
|
---|
| 3531 | MPFROM2SHORT(IDM_WALKDIR, FALSE), MPVOID);
|
---|
| 3532 | WinSendMsg(hwndMenu, MM_DELETEITEM,
|
---|
| 3533 | MPFROM2SHORT(IDM_FILTER, FALSE), MPVOID);
|
---|
| 3534 | }
|
---|
| 3535 | }
|
---|
| 3536 | }
|
---|
| 3537 | if (FrameFlags & FCF_TASKLIST) {
|
---|
[2] | 3538 |
|
---|
[551] | 3539 | SWP swp, swpD;
|
---|
| 3540 | ULONG size = sizeof(swp);
|
---|
| 3541 | LONG cxScreen, cyScreen;
|
---|
[2] | 3542 |
|
---|
[551] | 3543 | WinQueryTaskSizePos(WinQueryAnchorBlock(hwndFrame), 0, &swp);
|
---|
| 3544 | if (PrfQueryProfileData(fmprof,
|
---|
| 3545 | appname, "AV2SizePos", &swpD, &size)) {
|
---|
| 3546 | cxScreen = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN);
|
---|
| 3547 | cyScreen = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN);
|
---|
| 3548 | if (swp.x + swpD.cx > cxScreen)
|
---|
| 3549 | swp.x = cxScreen - swpD.cx;
|
---|
| 3550 | if (swp.y + swpD.cy > cyScreen)
|
---|
| 3551 | swp.y = cyScreen - swpD.cy;
|
---|
| 3552 | swp.cx = swpD.cx;
|
---|
| 3553 | swp.cy = swpD.cy;
|
---|
| 3554 | }
|
---|
| 3555 | WinSetWindowPos(hwndFrame,
|
---|
| 3556 | HWND_TOP,
|
---|
| 3557 | swp.x,
|
---|
| 3558 | swp.y,
|
---|
| 3559 | swp.cx,
|
---|
| 3560 | swp.cy,
|
---|
| 3561 | SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_ZORDER |
|
---|
| 3562 | SWP_ACTIVATE);
|
---|
| 3563 | }
|
---|
| 3564 | }
|
---|
[2] | 3565 | }
|
---|
| 3566 | }
|
---|
| 3567 | }
|
---|
| 3568 | return hwndFrame;
|
---|
| 3569 | }
|
---|
[793] | 3570 |
|
---|
| 3571 | #pragma alloc_text(ARCCNRS,ArcCnrWndProc,ArcObjWndProc,ArcClientWndProc,BldQuotedFullPathName)
|
---|
| 3572 | #pragma alloc_text(ARCCNRS,ArcTextProc,FillArcCnr,ArcFilter,BldQuotedFileName)
|
---|
| 3573 | #pragma alloc_text(ARCCNRS,ArcSort,ArcFrameWndProc,IsArcThere,ArcErrProc)
|
---|
| 3574 | #pragma alloc_text(STARTUP,StartArcCnr)
|
---|