Changeset 1160


Ignore:
Timestamp:
Sep 5, 2008, 11:41:43 PM (17 years ago)
Author:
John Small
Message:

Ticket 187: Draft 1: Functions only

Location:
trunk/dll
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/arccnrs.c

    r1120 r1160  
    8888#include "strutil.h"                    // GetPString
    8989#include "notebook.h"                   // CfgDlgProc
     90#include "worker.h"                     // Action, MassAction
     91#include "avv.h"                        // ArcReviewDlgProc, rewrite_archiverbb2
     92#include "chklist.h"                    // CenterOverWindow, CheckListProc
     93#include "common.h"                     // CommonCreateTextChildren, CommonFrameWndProc, CommonTextPaint
     94#include "draglist.h"                   // DragOne
     95#include "valid.h"                      // GetDesktopName, TestCDates
     96#include "mainwnd.h"                    // MakeBubble, TopWindowName
     97#include "objwin.h"                     // MakeObjWin
     98#include "shadow.h"                     // MakeShadows
     99#include "objcnr.h"                     // ObjCnrDlgProc
     100#include "printer.h"                    // PrintListThread
     101#include "srchpath.h"                   // RunFM2Util
     102#include "misc.h"                       // SayFilter, SaySort
     103#include "select.h"                     // SelectAll, SelectList
     104#include "findrec.h"                    // ShowCnrRecord
     105#include "walkem.h"                     // WalkExtractDlgProc
    90106#include "fm3dll.h"
     107#include "misc.h"                       // AdjustCnrColVis, QuickPopup, SetSortChecks, SwitchCommand
     108#include "select.h"                     // DeselectAll, InvertAll
    91109#include "fortify.h"
    92110
  • trunk/dll/chklist.c

    r907 r1160  
    2929#include "errutil.h"                    // Dos_Error...
    3030#include "strutil.h"                    // GetPString
     31#include "getnames.h"                   // CustomFileDlg
     32#include "chklist.h"
     33#include "info.h"                       // FileInfoProc
     34#include "defview.h"                    // QuickView
     35#include "valid.h"                      // IsExecutable
    3136#include "fm3dll.h"
    3237
  • trunk/dll/commafmt.c

    r907 r1160  
    3131#include <string.h>
    3232
     33#include "commafmt.h"
    3334#include "fm3dll.h"
    3435
  • trunk/dll/findrec.c

    r907 r1160  
    1818
    1919#include "fm3dll.h"
     20#include "findrec.h"
    2021
    2122PCNRITEM FindCnrRecord(HWND hwndCnr, CHAR * filename, PCNRITEM pciParent,
  • trunk/dll/fonts.c

    r907 r1160  
    1818#define INCL_WIN
    1919#define INCL_GPI
    20 #define INCL_LONGLONG                   // dircnrs.h
     20#define INCL_LONGLONG                   // dircnrs.h
    2121
    2222#include "fm3str.h"
    23 #include "errutil.h"                    // Dos_Error...
    24 #include "strutil.h"                    // GetPString
     23#include "errutil.h"                    // Dos_Error...
     24#include "strutil.h"                    // GetPString
     25#include "fonts.h"
    2526#include "fm3dll.h"
     27
     28//static VOID SetFont(HWND hwnd);
    2629
    2730#pragma data_seg(DATA1)
     
    4346  SIZEF sizef;
    4447
    45   hps = WinGetScreenPS(HWND_DESKTOP);   /* Screen presentation space */
     48  hps = WinGetScreenPS(HWND_DESKTOP);   /* Screen presentation space */
    4649
    4750  /*
     
    6871  WinReleasePS(hps);
    6972
    70 }                                       /* end ConvertVectorPointSize() */
     73}                                       /* end ConvertVectorPointSize() */
    7174
    7275VOID SetPresParamFromFattrs(HWND hwnd, FATTRS * fattrs,
    73                             SHORT sNominalPointSize, FIXED fxPointSize)
     76                            SHORT sNominalPointSize, FIXED fxPointSize)
    7477{
    7578
     
    8285    if ((((USHORT) FIXEDFRAC(fxPointSize) * 100) / 65536) > 0)
    8386      sprintf(&s[strlen(s)], "%hd.",
    84               ((USHORT) FIXEDFRAC(fxPointSize) * 100) / 65536);
     87              ((USHORT) FIXEDFRAC(fxPointSize) * 100) / 65536);
    8588  }
    8689  strcat(s, fattrs->szFacename);
     
    108111}
    109112
     113#if 0   // JBS
    110114VOID SetFont(HWND hwnd)
    111115{
     
    124128  }
    125129  DosExitCritSec();
    126   memset(&fontdlg, 0, sizeof(fontdlg)); /* initialize all fields */
     130  memset(&fontdlg, 0, sizeof(fontdlg)); /* initialize all fields */
    127131  hps = WinGetPS(hwnd);
    128132  GpiQueryFontMetrics(hps, sizeof(FONTMETRICS), &fm);
     
    153157  WinReleasePS(fontdlg.hpsScreen);
    154158  SetPresParamFromFattrs(hwnd, &fontdlg.fAttrs, fontdlg.sNominalPointSize,
    155                         fontdlg.fxPointSize);
     159                        fontdlg.fxPointSize);
    156160}
     161#endif
    157162
    158163FATTRS *SetMLEFont(HWND hwndMLE, FATTRS * fattrs, ULONG flags)
     
    173178  FONTMETRICS fontMetrics;
    174179  CHAR szFamily[CCHMAXPATH], *szPreview;
    175   static FIXED fxPointSize = 0; /* keep track of this for vector fonts */
     180  static FIXED fxPointSize = 0; /* keep track of this for vector fonts */
    176181
    177182  if ((flags & 1) && !fattrs)
     
    184189  }
    185190  DosExitCritSec();
    186   memset(&fontDlg, 0, sizeof(fontDlg)); /* initialize all fields */
     191  memset(&fontDlg, 0, sizeof(fontDlg)); /* initialize all fields */
    187192  /*
    188193   * Get the current font attributes
     
    191196  if (!(flags & 1))
    192197    WinSendMsg(hwndMLE, MLM_QUERYFONT,
    193                MPFROMP((PFATTRS) & (fontDlg.fAttrs)), NULL);
     198               MPFROMP((PFATTRS) & (fontDlg.fAttrs)), NULL);
    194199  else
    195200    memcpy(&fontDlg.fAttrs, fattrs, sizeof(FATTRS));
     
    198203
    199204  GpiCreateLogFont(hps, (PSTR8) fontDlg.fAttrs.szFacename, 1,
    200                    &(fontDlg.fAttrs));
     205                   &(fontDlg.fAttrs));
    201206  GpiSetCharSet(hps, 1);
    202207  GpiQueryFontMetrics(hps, sizeof(FONTMETRICS), &fontMetrics);
     
    208213   * Initialize the FONTDLG structure with the current font
    209214   */
    210   fontDlg.cbSize = sizeof(FONTDLG);     /* sizeof(FONTDLG) */
    211   fontDlg.hpsScreen = WinGetScreenPS(HWND_DESKTOP);     /* Screen presentation space */
    212   fontDlg.hpsPrinter = NULLHANDLE;      /* Printer presentation space */
     215  fontDlg.cbSize = sizeof(FONTDLG);     /* sizeof(FONTDLG) */
     216  fontDlg.hpsScreen = WinGetScreenPS(HWND_DESKTOP);     /* Screen presentation space */
     217  fontDlg.hpsPrinter = NULLHANDLE;      /* Printer presentation space */
    213218
    214219  fontDlg.pszTitle = GetPString(IDS_SETVIEWERFONTTITLETEXT);
    215220  fontDlg.pszPreview = szPreview;
    216   fontDlg.pszPtSizeList = NULL;         /* Application provided size list  */
    217   fontDlg.pfnDlgProc = NULL;            /* Dialog subclass procedure       */
    218   strcpy(szFamily, fontMetrics.szFamilyname);   /* Family name of font        */
    219   fontDlg.pszFamilyname = szFamily;     /* point to Family name of font    */
    220   fontDlg.fxPointSize = fxPointSize;    /* Point size the user selected    */
    221   fontDlg.fl = FNTS_CENTER |            /* FNTS_* flags - dialog styles    */
     221  fontDlg.pszPtSizeList = NULL;         /* Application provided size list  */
     222  fontDlg.pfnDlgProc = NULL;            /* Dialog subclass procedure       */
     223  strcpy(szFamily, fontMetrics.szFamilyname);   /* Family name of font        */
     224  fontDlg.pszFamilyname = szFamily;     /* point to Family name of font    */
     225  fontDlg.fxPointSize = fxPointSize;    /* Point size the user selected    */
     226  fontDlg.fl = FNTS_CENTER |            /* FNTS_* flags - dialog styles    */
    222227    FNTS_INITFROMFATTRS;
    223228  if (flags & 2)
     
    229234  else if (flags & 16)
    230235    fontDlg.fl |= FNTS_VECTORONLY;
    231   fontDlg.flFlags = 0;                  /* FNTF_* state flags              */
     236  fontDlg.flFlags = 0;                  /* FNTF_* state flags              */
    232237  /* Font type option bits           */
    233238  fontDlg.flType = (LONG) fontMetrics.fsType;
    234   fontDlg.flTypeMask = 0;               /* Mask of which font types to use */
    235   fontDlg.flStyle = 0;                  /* The selected style bits         */
    236   fontDlg.flStyleMask = 0;              /* Mask of which style bits to use */
    237   fontDlg.clrFore = CLR_NEUTRAL;        /* Selected foreground color       */
    238   fontDlg.clrBack = CLR_BACKGROUND;     /* Selected background color       */
    239   fontDlg.ulUser = 0;                   /* Blank field for application     */
    240   fontDlg.lReturn = 0;                  /* Return Value of the Dialog      */
    241   fontDlg.lEmHeight = 0;                /* Em height of the current font   */
    242   fontDlg.lXHeight = 0;                 /* X height of the current font    */
    243   fontDlg.lExternalLeading = 0;         /* External Leading of font        */
     239  fontDlg.flTypeMask = 0;               /* Mask of which font types to use */
     240  fontDlg.flStyle = 0;                  /* The selected style bits         */
     241  fontDlg.flStyleMask = 0;              /* Mask of which style bits to use */
     242  fontDlg.clrFore = CLR_NEUTRAL;        /* Selected foreground color       */
     243  fontDlg.clrBack = CLR_BACKGROUND;     /* Selected background color       */
     244  fontDlg.ulUser = 0;                   /* Blank field for application     */
     245  fontDlg.lReturn = 0;                  /* Return Value of the Dialog      */
     246  fontDlg.lEmHeight = 0;                /* Em height of the current font   */
     247  fontDlg.lXHeight = 0;                 /* X height of the current font    */
     248  fontDlg.lExternalLeading = 0;         /* External Leading of font        */
    244249  /* Nominal Point Size of font      */
    245250  fontDlg.sNominalPointSize = fontMetrics.sNominalPointSize;
    246   fontDlg.usWeight = fontMetrics.usWeightClass; /* The boldness of the font */
    247   fontDlg.usWidth = fontMetrics.usWidthClass;   /* The width of the font     */
    248   fontDlg.x = 0;                        /* X coordinate of the dialog      */
    249   fontDlg.y = 0;                        /* Y coordinate of the dialog      */
     251  fontDlg.usWeight = fontMetrics.usWeightClass; /* The boldness of the font */
     252  fontDlg.usWidth = fontMetrics.usWidthClass;   /* The width of the font     */
     253  fontDlg.x = 0;                        /* X coordinate of the dialog      */
     254  fontDlg.y = 0;                        /* Y coordinate of the dialog      */
    250255//   fontDlg.usDlgId      = IDD_FONT;       /* ID of a custom dialog template  */
    251   fontDlg.usFamilyBufLen = sizeof(szFamily);    /*Length of family name buffer */
     256  fontDlg.usFamilyBufLen = sizeof(szFamily);    /*Length of family name buffer */
    252257
    253258  /*
     
    260265    return NULL;
    261266  }
    262   fxPointSize = fontDlg.fxPointSize;    /* save point size for next dialog */
     267  fxPointSize = fontDlg.fxPointSize;    /* save point size for next dialog */
    263268
    264269  /*
     
    277282  return fattrs;
    278283
    279 }                                       /* End of SetMLEFont() */
     284}                                       /* End of SetMLEFont() */
    280285
    281286#pragma alloc_text(FONTS,ConvertVectorFontSize,SetFont,SetMLEFont)
  • trunk/dll/info.c

    r1039 r1160  
    4343#include "errutil.h"                    // Dos_Error...
    4444#include "strutil.h"                    // GetPString
     45#include "attribs.h"                    // AttrListDlgProc
     46#include "defview.h"                    // DefaultView
     47#include "info.h"
     48#include "valid.h"                      // IsBinary
     49#include "seticon.h"                    // SetIconDlgProc
    4550#include "fm3dll.h"
    4651#include "fortify.h"
  • trunk/dll/literal.c

    r1047 r1160  
    3030
    3131#include "errutil.h"                    // Dos_Error...
     32#include "literal.h"
    3233#include "fm3dll.h"
    3334#include "fortify.h"
  • trunk/dll/rename.c

    r907 r1160  
    2525#include "errutil.h"                    // Dos_Error...
    2626#include "strutil.h"                    // GetPString
     27#include "copyf.h"                      // AdjustWildcardName
     28#include "rename.h"
     29#include "valid.h"                      // TestFDates
    2730#include "fm3dll.h"
    2831
  • trunk/dll/tools.c

    r1140 r1160  
    4040#include "pathutil.h"                   // BldFullPathName
    4141#include "fortify.h"
     42#include "loadbmp.h"                    // LoadBitmapFromFileNum
    4243#include "fm3dll.h"
    4344
  • trunk/dll/uudecode.c

    r907 r1160  
    2525#define INCL_DOS
    2626#define INCL_WIN
    27 #define INCL_LONGLONG                   // dircnrs.h
     27#define INCL_LONGLONG                   // dircnrs.h
    2828
    2929#include "fm3dlg.h"
    3030#include "fm3str.h"
    31 #include "makelist.h"                   // AddToList
    32 #include "errutil.h"                    // Dos_Error...
    33 #include "strutil.h"                    // GetPString
     31#include "makelist.h"                   // AddToList
     32#include "errutil.h"                    // Dos_Error...
     33#include "strutil.h"                    // GetPString
     34#include "defview.h"
     35#include "uudecode.h"
    3436#include "fm3dll.h"
    3537
     
    4143
    4244/* single character decode */
    43 #define DEC(c)  (((c) - ' ') & 077)
     45#define DEC(c)  (((c) - ' ') & 077)
    4446
    4547int UUD(char *filename, CHAR * dest)
     
    5557  if (!in) {
    5658    saymsg(MB_CANCEL,
    57            HWND_DESKTOP,
    58            GetPString(IDS_ERRORTEXT),
    59            GetPString(IDS_COMPCANTOPENTEXT), filename);
     59           HWND_DESKTOP,
     60           GetPString(IDS_ERRORTEXT),
     61           GetPString(IDS_COMPCANTOPENTEXT), filename);
    6062    return ret;
    6163  }
     
    6668      fclose(in);
    6769      saymsg(MB_CANCEL,
    68              HWND_DESKTOP,
    69              GetPString(IDS_ERRORTEXT),
    70              GetPString(IDS_UUDNOBEGINTEXT), filename);
     70             HWND_DESKTOP,
     71             GetPString(IDS_ERRORTEXT),
     72             GetPString(IDS_UUDNOBEGINTEXT), filename);
    7173      return ret;
    7274    }
    7375    if (!strncmp(buf, "begin ", 6))
    7476      break;
    75   }                                     // for
     77  }                                     // for
    7678  *dest = 0;
    7779  sscanf(buf, "begin %o %259s", &mode, dest);
     
    103105    fclose(in);
    104106    saymsg(MB_CANCEL,
    105            HWND_DESKTOP,
    106            GetPString(IDS_ERRORTEXT),
    107            GetPString(IDS_UUDCANTOPENFORTEXT), dest, filename);
     107           HWND_DESKTOP,
     108           GetPString(IDS_ERRORTEXT),
     109           GetPString(IDS_UUDCANTOPENFORTEXT), dest, filename);
    108110    return ret;
    109111  }
     
    176178      wk = (WORKER *) mp2;
    177179      if (wk->li && wk->li->list && wk->li->list[0]) {
    178         WinSendDlgItemMsg(hwnd, MRG_TARGETNAME, EM_SETTEXTLIMIT,
    179                           MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    180         PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
     180        WinSendDlgItemMsg(hwnd, MRG_TARGETNAME, EM_SETTEXTLIMIT,
     181                          MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     182        PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID);
    181183      }
    182184      else
    183         WinDismissDlg(hwnd, 0);
     185        WinDismissDlg(hwnd, 0);
    184186    }
    185187    else
     
    199201      p = strrchr(wk->li->targetpath, '\\');
    200202      if (p)
    201         start = (p + 1) - wk->li->targetpath;
     203        start = (p + 1) - wk->li->targetpath;
    202204      WinSendDlgItemMsg(hwnd, MRG_TARGETNAME, EM_SETSEL,
    203                         MPFROM2SHORT(start, CCHMAXPATH), MPVOID);
     205                        MPFROM2SHORT(start, CCHMAXPATH), MPVOID);
    204206      for (x = 0; wk->li->list[x]; x++) {
    205         if (IsFile(wk->li->list[x]) == 1) {
    206           numfiles++;
    207           WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_INSERTITEM,
    208                             MPFROM2SHORT(LIT_END, 0),
    209                             MPFROMP(wk->li->list[x]));
    210         }
     207        if (IsFile(wk->li->list[x]) == 1) {
     208          numfiles++;
     209          WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_INSERTITEM,
     210                            MPFROM2SHORT(LIT_END, 0),
     211                            MPFROMP(wk->li->list[x]));
     212        }
    211213      }
    212214      WinCheckButton(hwnd, MRG_BINARY, (wk->li->type == IDM_MERGEBINARY));
    213215      if (!numfiles) {
    214         saymsg(MB_CANCEL | MB_ICONEXCLAMATION,
    215                hwnd,
    216                GetPString(IDS_SILLYERRORTEXT),
    217                GetPString(IDS_MERGEWASTETEXT));
    218         WinDismissDlg(hwnd, 0);
     216        saymsg(MB_CANCEL | MB_ICONEXCLAMATION,
     217               hwnd,
     218               GetPString(IDS_SILLYERRORTEXT),
     219               GetPString(IDS_MERGEWASTETEXT));
     220        WinDismissDlg(hwnd, 0);
    219221      }
    220222    }
     
    226228      switch (SHORT2FROMMP(mp1)) {
    227229      case LN_ENTER:
    228         {
    229           SHORT x;
    230           CHAR szBuffer[CCHMAXPATH];
    231 
    232           x = (SHORT) WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_QUERYSELECTION,
    233                                         MPFROMSHORT(LIT_FIRST), MPVOID);
    234           if (x >= 0) {
    235             *szBuffer = 0;
    236             WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_QUERYITEMTEXT,
    237                               MPFROM2SHORT(x, CCHMAXPATH), MPFROMP(szBuffer));
    238             if (*szBuffer)
    239               QuickEdit(hwnd, szBuffer);
    240           }
    241         }
    242         break;
     230        {
     231          SHORT x;
     232          CHAR szBuffer[CCHMAXPATH];
     233
     234          x = (SHORT) WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_QUERYSELECTION,
     235                                        MPFROMSHORT(LIT_FIRST), MPVOID);
     236          if (x >= 0) {
     237            *szBuffer = 0;
     238            WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_QUERYITEMTEXT,
     239                              MPFROM2SHORT(x, CCHMAXPATH), MPFROMP(szBuffer));
     240            if (*szBuffer)
     241              QuickEdit(hwnd, szBuffer);
     242          }
     243        }
     244        break;
    243245      }
    244246      break;
     
    252254  case UM_SETDIR:
    253255    PaintRecessedWindow(WinWindowFromID(hwnd, MRG_HELP), (HPS) 0, FALSE,
    254                         TRUE);
     256                        TRUE);
    255257    return 0;
    256258
     
    264266      wk = WinQueryWindowPtr(hwnd, QWL_USER);
    265267      if (wk) {
    266         CHAR filename[CCHMAXPATH];
    267 
    268         strcpy(filename, wk->li->targetpath);
    269         if (export_filename(HWND_DESKTOP, filename, FALSE) && *filename) {
    270           strcpy(wk->li->targetpath, filename);
    271           WinSetDlgItemText(hwnd, MRG_TARGETNAME, wk->li->targetpath);
    272         }
     268        CHAR filename[CCHMAXPATH];
     269
     270        strcpy(filename, wk->li->targetpath);
     271        if (export_filename(HWND_DESKTOP, filename, FALSE) && *filename) {
     272          strcpy(wk->li->targetpath, filename);
     273          WinSetDlgItemText(hwnd, MRG_TARGETNAME, wk->li->targetpath);
     274        }
    273275      }
    274276      break;
     
    276278    case MRG_REMOVE:
    277279      {
    278         SHORT x;
    279 
    280         x = (SHORT) WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_QUERYSELECTION,
    281                                       MPFROMSHORT(LIT_FIRST), MPVOID);
    282         if (x >= 0)
    283           WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_DELETEITEM,
    284                             MPFROMSHORT(x), MPVOID);
     280        SHORT x;
     281
     282        x = (SHORT) WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_QUERYSELECTION,
     283                                      MPFROMSHORT(LIT_FIRST), MPVOID);
     284        if (x >= 0)
     285          WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_DELETEITEM,
     286                            MPFROMSHORT(x), MPVOID);
    285287      }
    286288      break;
     
    289291    case MRG_TOP:
    290292      {
    291         SHORT x;
    292         CHAR szBuffer[CCHMAXPATH];
    293 
    294         x = (SHORT) WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_QUERYSELECTION,
    295                                       MPFROMSHORT(LIT_FIRST), MPVOID);
    296         if (x >= 0) {
    297           *szBuffer = 0;
    298           WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_QUERYITEMTEXT,
    299                             MPFROM2SHORT(x, CCHMAXPATH), MPFROMP(szBuffer));
    300           if (*szBuffer) {
    301             WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_DELETEITEM,
    302                               MPFROMSHORT(x), MPVOID);
    303             if (SHORT1FROMMP(mp1) == MRG_TOP)
    304               WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_INSERTITEM,
    305                                 MPFROM2SHORT(0, 0), MPFROMP(szBuffer));
    306             else
    307               WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_INSERTITEM,
    308                                 MPFROM2SHORT(LIT_END, 0), MPFROMP(szBuffer));
    309           }
    310         }
     293        SHORT x;
     294        CHAR szBuffer[CCHMAXPATH];
     295
     296        x = (SHORT) WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_QUERYSELECTION,
     297                                      MPFROMSHORT(LIT_FIRST), MPVOID);
     298        if (x >= 0) {
     299          *szBuffer = 0;
     300          WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_QUERYITEMTEXT,
     301                            MPFROM2SHORT(x, CCHMAXPATH), MPFROMP(szBuffer));
     302          if (*szBuffer) {
     303            WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_DELETEITEM,
     304                              MPFROMSHORT(x), MPVOID);
     305            if (SHORT1FROMMP(mp1) == MRG_TOP)
     306              WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_INSERTITEM,
     307                                MPFROM2SHORT(0, 0), MPFROMP(szBuffer));
     308            else
     309              WinSendDlgItemMsg(hwnd, MRG_LISTBOX, LM_INSERTITEM,
     310                                MPFROM2SHORT(LIT_END, 0), MPFROMP(szBuffer));
     311          }
     312        }
    311313      }
    312314      break;
     
    318320    case IDM_HELP:
    319321      if (hwndHelp)
    320         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    321                    MPFROM2SHORT(HELP_MERGE, 0), MPFROMSHORT(HM_RESOURCEID));
     322        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     323                   MPFROM2SHORT(HELP_MERGE, 0), MPFROMSHORT(HM_RESOURCEID));
    322324      break;
    323325
     
    325327      wk = WinQueryWindowPtr(hwnd, QWL_USER);
    326328      if (wk) {
    327         BOOL append, binary;
    328         CHAR **list = NULL, **test, szBuffer[CCHMAXPATH];
    329         UINT numfiles = 0, numalloc = 0;
    330         INT error;
    331         SHORT x, y;
    332 
    333         *szBuffer = 0;
    334         WinQueryDlgItemText(hwnd, MRG_TARGETNAME, CCHMAXPATH, szBuffer);
    335         if (!*szBuffer) {
    336           DosBeep(50, 100);
    337           WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, MRG_TARGETNAME));
    338           break;
    339         }
    340         if (DosQueryPathInfo(szBuffer,
    341                              FIL_QUERYFULLNAME,
    342                              wk->li->targetpath, CCHMAXPATH)) {
    343           DosBeep(50, 100);
    344           WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, MRG_TARGETNAME));
    345           break;
    346         }
    347         WinSetDlgItemText(hwnd, MRG_TARGETNAME, szBuffer);
    348         append = WinQueryButtonCheckstate(hwnd, MRG_APPEND);
    349         binary = WinQueryButtonCheckstate(hwnd, MRG_BINARY);
    350         wk->li->type = (append && binary) ? IDM_MERGEBINARYAPPEND :
    351           (append) ? IDM_MERGETEXTAPPEND :
    352           (binary) ? IDM_MERGEBINARY : IDM_MERGETEXT;
    353         x = (SHORT) WinSendDlgItemMsg(hwnd,
    354                                       MRG_LISTBOX,
    355                                       LM_QUERYITEMCOUNT, MPVOID, MPVOID);
    356         for (y = 0; y < x; y++) {
    357           *szBuffer = 0;
    358           WinSendDlgItemMsg(hwnd,
    359                             MRG_LISTBOX,
    360                             LM_QUERYITEMTEXT,
    361                             MPFROM2SHORT(y, CCHMAXPATH), MPFROMP(szBuffer));
    362           if (*szBuffer) {
    363             error = AddToList(szBuffer, &list, &numfiles, &numalloc);
    364             if (error) {
    365               Runtime_Error(pszSrcFile, __LINE__, "AddToList");
    366               break;
    367             }
    368           }
    369         }
    370         if (numfiles && list && numfiles + 1 < numalloc) {
    371           test =
    372             xrealloc(list, sizeof(CHAR *) * (numfiles + 1), pszSrcFile,
    373                      __LINE__);
    374           if (test)
    375             list = test;
    376         }
    377         if (!list || !list[0]) {
    378           Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    379           break;
    380         }
    381         else {
    382           FreeList(wk->li->list);
    383           wk->li->list = list;
    384         }
     329        BOOL append, binary;
     330        CHAR **list = NULL, **test, szBuffer[CCHMAXPATH];
     331        UINT numfiles = 0, numalloc = 0;
     332        INT error;
     333        SHORT x, y;
     334
     335        *szBuffer = 0;
     336        WinQueryDlgItemText(hwnd, MRG_TARGETNAME, CCHMAXPATH, szBuffer);
     337        if (!*szBuffer) {
     338          DosBeep(50, 100);
     339          WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, MRG_TARGETNAME));
     340          break;
     341        }
     342        if (DosQueryPathInfo(szBuffer,
     343                             FIL_QUERYFULLNAME,
     344                             wk->li->targetpath, CCHMAXPATH)) {
     345          DosBeep(50, 100);
     346          WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, MRG_TARGETNAME));
     347          break;
     348        }
     349        WinSetDlgItemText(hwnd, MRG_TARGETNAME, szBuffer);
     350        append = WinQueryButtonCheckstate(hwnd, MRG_APPEND);
     351        binary = WinQueryButtonCheckstate(hwnd, MRG_BINARY);
     352        wk->li->type = (append && binary) ? IDM_MERGEBINARYAPPEND :
     353          (append) ? IDM_MERGETEXTAPPEND :
     354          (binary) ? IDM_MERGEBINARY : IDM_MERGETEXT;
     355        x = (SHORT) WinSendDlgItemMsg(hwnd,
     356                                      MRG_LISTBOX,
     357                                      LM_QUERYITEMCOUNT, MPVOID, MPVOID);
     358        for (y = 0; y < x; y++) {
     359          *szBuffer = 0;
     360          WinSendDlgItemMsg(hwnd,
     361                            MRG_LISTBOX,
     362                            LM_QUERYITEMTEXT,
     363                            MPFROM2SHORT(y, CCHMAXPATH), MPFROMP(szBuffer));
     364          if (*szBuffer) {
     365            error = AddToList(szBuffer, &list, &numfiles, &numalloc);
     366            if (error) {
     367              Runtime_Error(pszSrcFile, __LINE__, "AddToList");
     368              break;
     369            }
     370          }
     371        }
     372        if (numfiles && list && numfiles + 1 < numalloc) {
     373          test =
     374            xrealloc(list, sizeof(CHAR *) * (numfiles + 1), pszSrcFile,
     375                     __LINE__);
     376          if (test)
     377            list = test;
     378        }
     379        if (!list || !list[0]) {
     380          Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     381          break;
     382        }
     383        else {
     384          FreeList(wk->li->list);
     385          wk->li->list = list;
     386        }
    385387      }
    386388      WinDismissDlg(hwnd, 1);
    387389      break;
    388     }                                   // switch WM_COMMAND mp1
     390    }                                   // switch WM_COMMAND mp1
    389391    return 0;
    390   }                                     // switch msg
     392  }                                     // switch msg
    391393  return WinDefDlgProc(hwnd, msg, mp1, mp2);
    392394}
Note: See TracChangeset for help on using the changeset viewer.