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