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