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