Changeset 1300 for trunk/dll


Ignore:
Timestamp:
Nov 29, 2008, 7:08:20 PM (17 years ago)
Author:
Gregg Young
Message:

Add the option of creating a subdirectory from the arcname for the extract path. (Ticket 22)

Location:
trunk/dll
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/extract.c

    r1223 r1300  
    1515  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
    1616  19 Jul 08 GKY Replace save_dir2(dir) with pFM2SaveDirectory
     17  29 Nov 08 GKY Add the option of creating a subdirectory from the arcname
     18                for the extract path.
    1719
    1820***********************************************************************/
     
    98100{
    99101  EXTRDATA *arcdata = NULL;
     102  ULONG size = sizeof(BOOL);
     103  BOOL fFileNameExtPath;
    100104
    101105  switch (msg) {
     
    104108    arcdata = (EXTRDATA *) mp2;
    105109    {
    106       ULONG size = sizeof(BOOL);
     110      ULONG sizet;
    107111      BOOL fRemember = FALSE;
    108112      BOOL fDirectory = FALSE;
    109113      PFNWP oldproc;
    110114
     115      fFileNameExtPath = FALSE;
    111116      oldproc = WinSubclassWindow(WinWindowFromID(hwnd, EXT_DIRECTORY),
    112117                                  (PFNWP) ExtractTextProc);
     
    117122                          (PVOID) & fRemember, &size);
    118123      PrfQueryProfileData(fmprof, FM3Str, "DirectoryExt",
    119                           (PVOID) & fDirectory, &size);
     124                          (PVOID) & fDirectory, &size);
     125      PrfQueryProfileData(fmprof, FM3Str, "FileNamePathExt",
     126                          (PVOID) & fFileNameExtPath, &size);
    120127      WinCheckButton(hwnd, EXT_REMEMBER, fRemember);
    121128      WinCheckButton(hwnd, EXT_AWDIRS, fDirectory);
     129      WinCheckButton(hwnd, EXT_FILENAMEEXT, fFileNameExtPath);
    122130      WinSendDlgItemMsg(hwnd, EXT_DIRECTORY, EM_SETTEXTLIMIT,
    123131                        MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     
    131139        WinSetDlgItemText(hwnd, EXT_FILENAME, arcdata->arcname);
    132140      else
    133         WinSetDlgItemText(hwnd, EXT_FILENAME, GetPString(IDS_EXTVARIOUSTEXT));
     141        WinSetDlgItemText(hwnd, EXT_FILENAME, GetPString(IDS_EXTVARIOUSTEXT));
     142
     143      if (fFileNameExtPath && arcdata->arcname) {
     144
     145        CHAR FileName[CCHMAXPATH];
     146        PSZ p;
     147
     148        strcpy(FileName, arcdata->arcname);
     149        p = strrchr(FileName, '.');
     150        if (p)
     151          *p = 0;
     152        else {
     153          p = FileName + strlen(arcdata->arcname);
     154          p--;
     155          *p = 0;
     156        }
     157        strcpy(arcdata->extractdir, FileName);
     158        WinSetDlgItemText(hwnd, EXT_DIRECTORY, arcdata->extractdir);
     159      }
    134160      if (fDirectory) {
    135161        WinSendDlgItemMsg(hwnd, EXT_WDIRS, BM_SETCHECK,
     
    147173        CHAR textdir[CCHMAXPATH];
    148174
    149         size = sizeof(textdir);
     175        sizet = sizeof(textdir);
    150176        *textdir = 0;
    151177        PrfQueryProfileData(fmprof, FM3Str, "Ext_ExtractDir",
     
    153179        if (*textdir && !IsFile(textdir))
    154180          strcpy(arcdata->extractdir, textdir);
    155         size = sizeof(textdir);
     181        sizet = sizeof(textdir);
    156182        *textdir = 0;
    157183        PrfQueryProfileData(fmprof, FM3Str, "Ext_Mask", (PVOID) textdir,
     
    198224        WinEnableWindow(WinWindowFromID(hwnd, EXT_WDIRS), FALSE);
    199225      else if (fRemember) {
    200         size = sizeof(BOOL);
     226        //size = sizeof(BOOL);
    201227        fRemember = FALSE;
    202228        PrfQueryProfileData(fmprof, FM3Str, "Ext_WDirs",
    203                             (PVOID) & fRemember, &size);
     229                            (PVOID) &fRemember, &size);
    204230        if (fRemember)
    205231          PostMsg(WinWindowFromID(hwnd, EXT_WDIRS), BM_CLICK, MPVOID, MPVOID);
     
    227253
    228254        PrfWriteProfileData(fmprof, FM3Str, "RememberExt",
    229                             (PVOID) & fRemember, sizeof(BOOL));
     255                            (PVOID) &fRemember, size);
    230256      }
    231257      break;
     
    236262
    237263        PrfWriteProfileData(fmprof, FM3Str, "DirectoryExt",
    238                             (PVOID) & fDirectory, sizeof(BOOL));
     264                            (PVOID) &fDirectory, size);
    239265
    240266        if (fDirectory) {
     
    248274          WinSetDlgItemText(hwnd, EXT_COMMAND, arcdata->info->extract);
    249275        }
     276      }
     277      break;
     278
     279    case EXT_FILENAMEEXT:
     280      {
     281        BOOL fFileNameExtPath = WinQueryButtonCheckstate(hwnd, EXT_FILENAMEEXT);
     282
     283        PrfWriteProfileData(fmprof, FM3Str, "FileNamePathExt",
     284                            (PVOID) &fFileNameExtPath, size);
     285        if (fFileNameExtPath && arcdata->arcname) {
     286          CHAR FileName[CCHMAXPATH];
     287          PSZ p;
     288
     289          strcpy(FileName, arcdata->arcname);
     290          p = strrchr(FileName, '.');
     291          if (p)
     292           *p = 0;
     293          else {
     294            p = FileName + strlen(arcdata->arcname);
     295            p--;
     296            *p = 0;
     297          }
     298          strcpy(arcdata->extractdir, FileName);
     299          WinSetDlgItemText(hwnd, EXT_DIRECTORY, arcdata->extractdir);
     300        }
     301        else {
     302          *arcdata->extractdir = 0;
     303          if (*extractpath) {
     304            if (arcdata->arcname && *arcdata->arcname &&
     305                !strcmp(extractpath, "*")) {
     306
     307              CHAR *p;
     308
     309              strcpy(arcdata->extractdir, arcdata->arcname);
     310              p = strrchr(arcdata->extractdir, '\\');
     311              if (p) {
     312                if (p < arcdata->extractdir + 3)
     313                  p++;
     314                *p = 0;
     315              }
     316            }
     317            else
     318              strcpy(arcdata->extractdir, extractpath);
     319          }
     320          if (!*arcdata->extractdir) {
     321            if (*lastextractpath)
     322              strcpy(arcdata->extractdir, lastextractpath);
     323            else if (arcdata->arcname && *arcdata->arcname) {
     324
     325              CHAR *p;
     326
     327              strcpy(arcdata->extractdir, arcdata->arcname);
     328              p = strrchr(arcdata->extractdir, '\\');
     329              if (p) {
     330                if (p < arcdata->extractdir + 3)
     331                  p++;
     332                *p = 0;
     333              }
     334            }
     335            if (!*arcdata->extractdir)
     336              strcpy(arcdata->extractdir, pFM2SaveDirectory);
     337          }
     338          WinSetDlgItemText(hwnd, EXT_DIRECTORY, arcdata->extractdir);
     339        }
    250340      }
    251341      break;
     
    325415        if (*s) {
    326416          if (!SetDir(WinQueryWindow(WinQueryWindow(hwnd, QW_PARENT),
    327                                      QW_OWNER), hwnd, s, 0)) {
     417                                     QW_OWNER), hwnd, s, fFileNameExtPath ? 1:0)) {
    328418            strcpy(arcdata->extractdir, s);
    329419            WinSetDlgItemText(hwnd, EXT_DIRECTORY, s);
     
    340430            fRemember = WinQueryButtonCheckstate(hwnd, EXT_WDIRS);
    341431            PrfWriteProfileData(fmprof, FM3Str, "Ext_WDirs",
    342                                 (PVOID) & fRemember, sizeof(BOOL));
     432                                (PVOID) &fRemember, size);
    343433            fRemember = TRUE;
    344434          }
  • trunk/dll/fm3dlg.h

    r1086 r1300  
    2121  29 Feb 08 GKY Changes to enable user settable command line length
    2222  20 Jul 08 JBS Ticket 114: Support user-selectable env. strings in Tree container.
     23  29 Nov 08 GKY Add the option of creating a subdirectory from the arcname
     24                for the extract path.
    2325
    2426***********************************************************************/
     
    138140#define EXT_REMEMBER                                                                            20511
    139141#define EXT_AWDIRS                                                                              20512
     142#define EXT_FILENAMEEXT                                                                         20513
    140143
    141144#define ARCH_FRAME                                                                              20600
  • trunk/dll/fm3res.dlg

    r1289 r1300  
    3838  01 Sep 08 GKY Change User-defined BMP text to better match what it actually does.
    3939  21 Nov 08 JBS Ticket 297: Added use of COPYRIGHT_YEAR in About dialog
     40  29 Nov 08 GKY Add the option of creating a subdirectory from the arcname
     41                for the extract path to extract dialog.
    4042
    4143***********************************************************************/
     
    12641266        LTEXT           "Command Line:", -1, 4, 74, 72, 8, NOT WS_GROUP
    12651267        LTEXT           "Filename:", -1, 4, 53, 56, 8, NOT WS_GROUP
    1266         LTEXT           "Extract Directory:", -1, 4, 31, 93, 8, NOT WS_GROUP
     1268        LTEXT           "Extract Directory:", -1, 4, 31, 50, 8, NOT WS_GROUP
    12671269        ENTRYFIELD      "", EXT_MASK, 36, 109, 144, 8, ES_MARGIN | WS_GROUP
    12681270        AUTORADIOBUTTON "~Normal", EXT_NORMAL, 5, 88, 43, 10,
     
    12721274                        BS_NOPOINTERFOCUS | WS_TABSTOP
    12731275                        // PRESPARAMS PP_FONTNAMESIZE, "8.Helvetica.Bold"
    1274         AUTOCHECKBOX "~Always Paths", EXT_AWDIRS, 115, 88, 65, 10,
    1275                         BS_NOPOINTERFOCUS | WS_TABSTOP
    1276                         // PRESPARAMS PP_FONTNAMESIZE, "8.Helvetica.Bold"
     1276        AUTOCHECKBOX    "~Always Paths", EXT_AWDIRS, 115, 88, 65, 10,
     1277                        BS_NOPOINTERFOCUS | WS_TABSTOP
     1278                        // PRESPARAMS PP_FONTNAMESIZE, "8.Helvetica.Bold"
     1279        AUTOCHECKBOX    "~Filename as extract path", EXT_FILENAMEEXT, 55, 31, 85, 10,
     1280                        BS_NOPOINTERFOCUS
    12771281        ENTRYFIELD      "", EXT_COMMAND, 6, 63, 174, 8, ES_MARGIN | WS_GROUP
    12781282        PUSHBUTTON      "~See", EXT_SEE, 148, 73, 34, 11
Note: See TracChangeset for help on using the changeset viewer.