Changeset 487


Ignore:
Timestamp:
Sep 7, 2006, 7:10:39 AM (19 years ago)
Author:
root
Message:

docopyf filename args must be variables
Sync with standard source formattting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/tools.c

    r440 r487  
    1414  29 Jul 06 SHL Use xfgets, xfgets_bstripcr
    1515  18 Aug 06 SHL Report more runtime errors
     16  05 Sep 06 SHL docopyf filename args must be variables
     17  05 Sep 06 SHL Sync with standard source formattting
    1618
    1719***********************************************************************/
     
    9092  CHAR  s[CCHMAXPATH + 14];
    9193
    92   if(!quicktool[0])
     94  if (!quicktool[0])
    9395    return;
    9496  save_dir2(s);
    95   if(s[strlen(s) - 1] != '\\')
     97  if (s[strlen(s) - 1] != '\\')
    9698    strcat(s,"\\");
    9799  strcat(s,"QUICKTLS.DAT");
    98100  fp = xfopen(s,"w",pszSrcFile,__LINE__);
    99101  if (fp) {
    100     for(x = 0;quicktool[x] && x < 50;x++)
     102    for (x = 0;quicktool[x] && x < 50;x++)
    101103      fprintf(fp,"%s\n",quicktool[x]);
    102104    fclose(fp);
     
    113115  TOOL  *info;
    114116
    115   if(!fToolbar) {
     117  if (!fToolbar) {
    116118    toolhead = free_tools();
    117119    return toolhead;
    118120  }
    119   if(!filename ||
     121  if (!filename ||
    120122     !*filename)
    121123    filename = (*lasttoolbox) ? lasttoolbox : "CMDS.TLS";
    122   if(*filename)
     124  if (*filename)
    123125    fname = searchpath(filename);
    124   if(!fname ||
     126  if (!fname ||
    125127     !*fname)
    126128    fname = "FM3TOOLS.DAT";
    127   if(fname &&
     129  if (fname &&
    128130     *fname) {
    129131    filename = fname;
     
    132134    if (fp) {
    133135      toolhead = free_tools();
    134       while(!feof(fp)) {
     136      while (!feof(fp)) {
    135137        do {
    136           if(!xfgets(help,sizeof(help),fp,pszSrcFile,__LINE__))
     138          if (!xfgets(help,sizeof(help),fp,pszSrcFile,__LINE__))
    137139            break;
    138         } while(*help == ';' && !feof(fp));
     140        } while (*help == ';' && !feof(fp));
    139141        stripcr(help);
    140         if(!xfgets(text,sizeof(text),fp,pszSrcFile,__LINE__))
     142        if (!xfgets(text,sizeof(text),fp,pszSrcFile,__LINE__))
    141143          break;
    142144        stripcr(text);
    143         if(!xfgets(flagstr,sizeof(flagstr),fp,pszSrcFile,__LINE__))
    144           break;
    145         if(!xfgets(idstr,sizeof(idstr),fp,pszSrcFile,__LINE__))
    146           break;
    147         if(!(USHORT)atoi(idstr))
     145        if (!xfgets(flagstr,sizeof(flagstr),fp,pszSrcFile,__LINE__))
     146          break;
     147        if (!xfgets(idstr,sizeof(idstr),fp,pszSrcFile,__LINE__))
     148          break;
     149        if (!(USHORT)atoi(idstr))
    148150          continue;
    149151        info = xmallocz(sizeof(TOOL),pszSrcFile,__LINE__);
    150152        if (info) {
    151           if(*help) {
     153          if (*help) {
    152154            literal(help);
    153             if(*help)
     155            if (*help)
    154156              info->help = xstrdup(help,pszSrcFile,__LINE__);
    155157          }
    156           if(*text)
     158          if (*text)
    157159            info->text = xstrdup(text,pszSrcFile,__LINE__);
    158160          info->flags = (atoi(flagstr) & (~(T_TEXT | T_EMPHASIZED)));
     
    176178  TOOL  *info;
    177179
    178   if(!filename)
     180  if (!filename)
    179181    filename = lasttoolbox;
    180   if(*filename)
     182  if (*filename)
    181183    fname = searchpath(filename);
    182   if(fname && *fname)
     184  if (fname && *fname)
    183185    filename = fname;
    184186  else {
    185     if(*lasttoolbox)
     187    if (*lasttoolbox)
    186188      filename = lasttoolbox;
    187189    else
    188190      filename = "FM3TOOLS.TLS";
    189191    fname = searchpath(filename);
    190     if(fname && *fname)
     192    if (fname && *fname)
    191193      filename = fname;
    192194  }
    193195
    194   if(stristr(filename,"FM3TOOLS.DAT"))
     196  if (stristr(filename,"FM3TOOLS.DAT"))
    195197    filename = "FM3TOOLS.TLS";
    196   if(toolhead && filename && *filename) {
     198  if (toolhead && filename && *filename) {
    197199    strcpy(lasttoolbox,filename);
    198     PrfWriteProfileString(fmprof,
    199                           FM3Str,
    200                           "LastToolBox",
    201                           filename);
    202   }
    203   if(!toolhead) {
     200    PrfWriteProfileString(fmprof,FM3Str,"LastToolBox",filename);
     201  }
     202  if (!toolhead) {
    204203    unlinkf("%s",filename);
    205204    return;
     
    209208    fprintf(fp,GetPString(IDS_TOOLFILETEXT),filename);
    210209    info = toolhead;
    211     while(info) {
     210    while (info) {
    212211      fprintf(fp,
    213212              "%s\n%s\n%u\n%u\n;\n",
     
    221220    fToolsChanged = FALSE;
    222221  }
    223   if(hwndMain)
    224     PostMsg(hwndMain,
    225             UM_FILLBUTTONLIST,
    226             MPVOID,
    227             MPVOID);
     222  if (hwndMain)
     223    PostMsg(hwndMain,UM_FILLBUTTONLIST,MPVOID,MPVOID);
    228224}
    229225
     
    233229  TOOL *info;
    234230
    235   if(tool) {
     231  if (tool) {
    236232    info = toolhead;
    237     if(info) {
    238       while(info->next)
     233    if (info) {
     234      while (info->next)
    239235        info = info->next;
    240236    }
    241     if(info)
     237    if (info)
    242238      info->next = tool;
    243239    else
     
    251247TOOL *insert_tool(TOOL *tool,TOOL *after)
    252248{
    253   if(tool) {
    254     if(!toolhead)
     249  if (tool) {
     250    if (!toolhead)
    255251      return add_tool(tool);
    256     if(!after) {
     252    if (!after) {
    257253      tool->next = toolhead;
    258254      toolhead = tool;
     
    273269  TOOL *info,*prev = NULL;
    274270
    275   if(tool) {
     271  if (tool) {
    276272    info = toolhead;
    277     while(info) {
    278       if(info == tool) {
    279         if(info == toolhead)
     273    while (info) {
     274      if (info == tool) {
     275        if (info == toolhead)
    280276          toolhead = info->next;
    281         if(prev)
     277        if (prev)
    282278          prev->next = info->next;
    283         if(info->help)
     279        if (info->help)
    284280          free(info->help);
    285         if(info->text)
     281        if (info->text)
    286282          free(info->text);
    287283        free(info);
     
    301297  TOOL *tool;
    302298
    303   if(id) {
     299  if (id) {
    304300    tool = toolhead;
    305     while(tool) {
    306       if(id && tool->id == id)
     301    while (tool) {
     302      if (id && tool->id == id)
    307303        return tool;
    308304      tool = tool->next;
     
    315311TOOL *next_tool(TOOL *tool,BOOL skipinvisible)
    316312{
    317   while(tool) {
    318     if(tool->next && (skipinvisible && (tool->next->flags & T_INVISIBLE)))
     313  while (tool) {
     314    if (tool->next && (skipinvisible && (tool->next->flags & T_INVISIBLE)))
    319315      tool = tool->next;
    320316    else
     
    330326
    331327Again:
    332   while(tool) {
     328  while (tool) {
    333329    info = toolhead;
    334     while(info) {
    335       if(info->next == tool) {
    336         if(skipinvisible && (info->flags & T_INVISIBLE)) {
     330    while (info) {
     331      if (info->next == tool) {
     332        if (skipinvisible && (info->flags & T_INVISIBLE)) {
    337333          tool = info;
    338334          goto Again;
     
    340336        return info;
    341337      }
    342       if(!info->next && tool == toolhead)
     338      if (!info->next && tool == toolhead)
    343339        return info;
    344340      info = info->next;
     
    354350  TOOL *prev1 = NULL,*prev2 = NULL,*info;
    355351
    356   if(tool1 && tool2 && tool1 != tool2) {
     352  if (tool1 && tool2 && tool1 != tool2) {
    357353    info = toolhead;
    358     while(info && !prev1 && !prev2) {
    359       if(info->next == tool1)
     354    while (info && !prev1 && !prev2) {
     355      if (info->next == tool1)
    360356        prev1 = info;
    361       else if(info->next == tool2)
     357      else if (info->next == tool2)
    362358        prev2 = info;
    363359      info = info->next;
     
    367363    tool1 = info;
    368364    info = tool2->next;
    369     if(prev1)
     365    if (prev1)
    370366      prev1->next = tool2;
    371     if(prev2)
     367    if (prev2)
    372368      prev2->next = tool1;
    373369    tool2->next = tool1->next;
     
    384380
    385381  tool = toolhead;
    386   while(tool) {
     382  while (tool) {
    387383    next = tool->next;
    388     if(tool->help)
     384    if (tool->help)
    389385      free(tool->help);
    390     if(tool->text)
     386    if (tool->text)
    391387      free(tool->text);
    392388    free(tool);
     
    398394
    399395
    400 MRESULT EXPENTRY ReOrderToolsProc(HWND hwnd,ULONG msg,MPARAM mp1,
    401                                   MPARAM mp2)
    402 {
    403   switch(msg) {
     396MRESULT EXPENTRY ReOrderToolsProc(HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2)
     397{
     398  switch (msg) {
    404399    case WM_INITDLG:
    405       if(!toolhead || !toolhead->next)
     400      if (!toolhead || !toolhead->next)
    406401        WinDismissDlg(hwnd,0);
    407       WinSetWindowText(hwnd,
    408                        GetPString(IDS_RETOOLTEXT));
     402      WinSetWindowText(hwnd,GetPString(IDS_RETOOLTEXT));
    409403      {
    410404        TOOL  *tool;
     
    413407
    414408        tool = toolhead;
    415         while(tool) {
     409        while (tool) {
    416410          sprintf(s,
    417411                  "%-5u  %s",
     
    423417                                             MPFROMSHORT(LIT_END),
    424418                                             MPFROMP(s));
    425           if(sSelect >= 0)
     419          if (sSelect >= 0)
    426420            WinSendDlgItemMsg(hwnd,
    427421                              RE_ADDLISTBOX,
     
    438432
    439433    case WM_COMMAND:
    440       switch(SHORT1FROMMP(mp1)) {
     434      switch (SHORT1FROMMP(mp1)) {
    441435        case DID_CANCEL:
    442436          WinDismissDlg(hwnd,0);
     
    451445                                                LM_QUERYITEMCOUNT,
    452446                                                MPVOID,MPVOID);
    453             while(numitems) {
     447            while (numitems) {
    454448              tool = (TOOL *)WinSendDlgItemMsg(hwnd,RE_REMOVELISTBOX,
    455449                                               LM_QUERYITEMHANDLE,
    456450                                               MPFROMSHORT(sSelect++),MPVOID);
    457               if(tool) {
    458                 if(!thead)
     451              if (tool) {
     452                if (!thead)
    459453                  thead = tool;
    460454                else
     
    468462                                                LM_QUERYITEMCOUNT,
    469463                                                MPVOID,MPVOID);
    470             while(numitems) {
     464            while (numitems) {
    471465              tool = (TOOL *)WinSendDlgItemMsg(hwnd,RE_ADDLISTBOX,
    472466                                               LM_QUERYITEMHANDLE,
    473467                                               MPFROMSHORT(sSelect++),
    474468                                               MPVOID);
    475               if(tool) {
    476                 if(!thead)
     469              if (tool) {
     470                if (!thead)
    477471                  thead = tool;
    478472                else
     
    482476              numitems--;
    483477            }
    484             if(last)
     478            if (last)
    485479              last->next = NULL;
    486480            toolhead = thead;
     
    491485
    492486        case IDM_HELP:
    493           if(hwndHelp)
     487          if (hwndHelp)
    494488            WinSendMsg(hwndHelp,HM_DISPLAY_HELP,
    495489                       MPFROM2SHORT(HELP_REORDERBUTTONS,0),
     
    508502                                                MPFROMSHORT(LIT_FIRST),
    509503                                                MPVOID);
    510             while(sSelect >= 0) {
     504            while (sSelect >= 0) {
    511505              tool = (TOOL *)WinSendDlgItemMsg(hwnd,
    512506                                               RE_ADDLISTBOX,
     
    514508                                               MPFROMSHORT(sSelect),
    515509                                               MPVOID);
    516               if(tool) {
     510              if (tool) {
    517511                sprintf(s,
    518512                        "%-5u  %s",
     
    524518                                                    MPFROM2SHORT(LIT_END,0),
    525519                                                    MPFROMP(s));
    526                 if(sSelect2 >= 0)
     520                if (sSelect2 >= 0)
    527521                  WinSendDlgItemMsg(hwnd,
    528522                                    RE_REMOVELISTBOX,
     
    562556                                                MPFROMSHORT(LIT_FIRST),
    563557                                                MPVOID);
    564             while(sSelect >= 0) {
     558            while (sSelect >= 0) {
    565559              tool = (TOOL *)WinSendDlgItemMsg(hwnd,
    566560                                               RE_REMOVELISTBOX,
     
    568562                                               MPFROMSHORT(sSelect),
    569563                                               MPVOID);
    570               if(tool) {
     564              if (tool) {
    571565                sprintf(s,
    572566                        "%-5u  %s",
     
    578572                                                    MPFROM2SHORT(LIT_END,0),
    579573                                                    MPFROMP(s));
    580                 if(sSelect2 >= 0)
     574                if (sSelect2 >= 0)
    581575                  WinSendDlgItemMsg(hwnd,
    582576                                    RE_ADDLISTBOX,
     
    613607MRESULT EXPENTRY AddToolProc(HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2)
    614608{
    615   switch(msg) {
     609  switch (msg) {
    616610    case WM_INITDLG:
    617611      WinSetWindowPtr(hwnd,QWL_USER,mp2);
    618       if(mp2) {
     612      if (mp2) {
    619613        WinSetWindowText(hwnd,GetPString(IDS_EDITTOOLTEXT));
    620614        WinSendDlgItemMsg(hwnd,ADDBTN_ID,EM_SETREADONLY,
     
    627621      WinSendDlgItemMsg(hwnd,ADDBTN_ID,EM_SETTEXTLIMIT,
    628622                        MPFROM2SHORT(5,0),MPVOID);
    629       if(!mp2)
     623      if (!mp2)
    630624        WinCheckButton(hwnd,ADDBTN_VISIBLE,TRUE);
    631625      else {
     
    633627        CHAR  s[33];
    634628
    635         if(tool->help)
     629        if (tool->help)
    636630          WinSetDlgItemText(hwnd,ADDBTN_HELP,tool->help);
    637         if(tool->text)
     631        if (tool->text)
    638632          WinSetDlgItemText(hwnd,ADDBTN_TEXT,tool->text);
    639         if(tool->flags & T_MYICON)
     633        if (tool->flags & T_MYICON)
    640634          WinCheckButton(hwnd,ADDBTN_MYICON,TRUE);
    641635        else
    642636          WinEnableWindow(WinWindowFromID(hwnd,ADDBTN_EDITBMP),FALSE);
    643         if(tool->flags & T_DROPABLE)
     637        if (tool->flags & T_DROPABLE)
    644638          WinCheckButton(hwnd,ADDBTN_DROPABLE,TRUE);
    645         if(!(tool->flags & T_INVISIBLE))
     639        if (!(tool->flags & T_INVISIBLE))
    646640          WinCheckButton(hwnd,ADDBTN_VISIBLE,TRUE);
    647         if(tool->flags & T_SEPARATOR)
     641        if (tool->flags & T_SEPARATOR)
    648642          WinCheckButton(hwnd,ADDBTN_SEPARATOR,TRUE);
    649         if(tool->flags & T_TEXT)
     643        if (tool->flags & T_TEXT)
    650644          WinCheckButton(hwnd,ADDBTN_SHOWTEXT,TRUE);
    651         sprintf(s,
    652                 "%u",
    653                 tool->id);
    654         WinSetDlgItemText(hwnd,
    655                           ADDBTN_ID,
    656                           s);
    657         WinEnableWindow(WinWindowFromID(hwnd,ADDBTN_SHOWTEXT),
    658                         FALSE);
    659       }
    660       WinShowWindow(WinWindowFromID(hwnd,ADDBTN_SHOWTEXT),
    661                     FALSE);
    662       PostMsg(hwnd,
    663               UM_SETUP,
    664               MPVOID,
    665               MPVOID);
     645        sprintf(s,"%u",tool->id);
     646        WinSetDlgItemText(hwnd,ADDBTN_ID,s);
     647        WinEnableWindow(WinWindowFromID(hwnd,ADDBTN_SHOWTEXT),FALSE);
     648      }
     649      WinShowWindow(WinWindowFromID(hwnd,ADDBTN_SHOWTEXT),FALSE);
     650      PostMsg(hwnd,UM_SETUP,MPVOID,MPVOID);
    666651      break;
    667652
     
    687672        WinQueryDlgItemText(hwnd,ADDBTN_ID,6,idstr);
    688673        id = atoi(idstr);
    689         if(id) {
     674        if (id) {
    690675          hps = WinGetPS(WinWindowFromID(hwnd,ADDBTN_BMP));
    691           if(!WinQueryButtonCheckstate(hwnd,ADDBTN_MYICON))
     676          if (!WinQueryButtonCheckstate(hwnd,ADDBTN_MYICON))
    692677            hbm = GpiLoadBitmap(hps,0,id,28,28);
    693           if(!hbm)
     678          if (!hbm)
    694679            hbm = LoadBitmapFromFileNum(id);
    695           if(hbm) {
     680          if (hbm) {
    696681            hbmd = (HBITMAP)WinSendDlgItemMsg(hwnd,ADDBTN_BMP,SM_QUERYHANDLE,
    697682                                              MPVOID,MPVOID);
    698683            hbmdd = (HBITMAP)WinSendDlgItemMsg(hwnd,ADDBTN_BMP,SM_SETHANDLE,
    699684                                               MPFROMLONG(hbm),MPVOID);
    700             if(hbmdd && hbmd && hbmd != hbmdd)
     685            if (hbmdd && hbmd && hbmd != hbmdd)
    701686              GpiDeleteBitmap(hbmd);
    702687          }
     
    706691
    707692    case WM_CONTROL:
    708       switch(SHORT1FROMMP(mp1)) {
     693      switch (SHORT1FROMMP(mp1)) {
    709694        case ADDBTN_HELP:
    710           if(SHORT2FROMMP(mp1) == EN_KILLFOCUS)
    711             WinSetDlgItemText(hwnd,
    712                               ADDBTN_HELPME,
    713                               NullStr);
    714           if(SHORT2FROMMP(mp1) == EN_SETFOCUS)
     695          if (SHORT2FROMMP(mp1) == EN_KILLFOCUS)
     696            WinSetDlgItemText(hwnd,ADDBTN_HELPME,NullStr);
     697          if (SHORT2FROMMP(mp1) == EN_SETFOCUS)
    715698            WinSetDlgItemText(hwnd,ADDBTN_HELPME,
    716699                              GetPString(IDS_ADDTOOLQUICKHELPTEXT));
     
    718701
    719702        case ADDBTN_TEXT:
    720           if(SHORT2FROMMP(mp1) == EN_KILLFOCUS)
    721             WinSetDlgItemText(hwnd,
    722                               ADDBTN_HELPME,
    723                               NullStr);
    724           if(SHORT2FROMMP(mp1) == EN_SETFOCUS)
     703          if (SHORT2FROMMP(mp1) == EN_KILLFOCUS)
     704            WinSetDlgItemText(hwnd,ADDBTN_HELPME,NullStr);
     705          if (SHORT2FROMMP(mp1) == EN_SETFOCUS)
    725706            WinSetDlgItemText(hwnd,ADDBTN_HELPME,
    726707                              GetPString(IDS_ADDTOOLBUTTONTEXT));
     
    728709
    729710        case ADDBTN_ID:
    730           if(SHORT2FROMMP(mp1) == EN_KILLFOCUS) {
    731             WinSetDlgItemText(hwnd,
    732                               ADDBTN_HELPME,
    733                               NullStr);
    734             PostMsg(hwnd,
    735                     UM_SETUP,
    736                     MPVOID,
    737                     MPVOID);
    738           }
    739           if(SHORT2FROMMP(mp1) == EN_SETFOCUS)
     711          if (SHORT2FROMMP(mp1) == EN_KILLFOCUS) {
     712            WinSetDlgItemText(hwnd,ADDBTN_HELPME,NullStr);
     713            PostMsg(hwnd,UM_SETUP,MPVOID,MPVOID);
     714          }
     715          if (SHORT2FROMMP(mp1) == EN_SETFOCUS)
    740716            WinSetDlgItemText(hwnd,
    741717                              ADDBTN_HELPME,
     
    752728
    753729    case WM_COMMAND:
    754       switch(SHORT1FROMMP(mp1)) {
     730      switch (SHORT1FROMMP(mp1)) {
    755731        case DID_OK:
    756732          {
     
    761737            WinQueryDlgItemText(hwnd,ADDBTN_HELP,80,help);
    762738            WinQueryDlgItemText(hwnd,ADDBTN_TEXT,80,text);
    763             if(WinQueryButtonCheckstate(hwnd,ADDBTN_DROPABLE))
     739            if (WinQueryButtonCheckstate(hwnd,ADDBTN_DROPABLE))
    764740              dropable = TRUE;
    765741            else
    766742              dropable = FALSE;
    767743            myicon = WinQueryButtonCheckstate(hwnd,ADDBTN_MYICON);
    768             if(WinQueryButtonCheckstate(hwnd,ADDBTN_VISIBLE))
     744            if (WinQueryButtonCheckstate(hwnd,ADDBTN_VISIBLE))
    769745              invisible = FALSE;
    770746            else
    771747              invisible = TRUE;
    772             if(WinQueryButtonCheckstate(hwnd,ADDBTN_SEPARATOR))
     748            if (WinQueryButtonCheckstate(hwnd,ADDBTN_SEPARATOR))
    773749              separator = TRUE;
    774750            else
    775751              separator = FALSE;
    776             if(WinQueryButtonCheckstate(hwnd,ADDBTN_SHOWTEXT))
     752            if (WinQueryButtonCheckstate(hwnd,ADDBTN_SHOWTEXT))
    777753              istext = TRUE;
    778754            else
    779755              istext = FALSE;
    780756            tool = INSTDATA(hwnd);
    781             if(tool) {        /* just editing strings... */
     757            if (tool) {        /* just editing strings... */
    782758              istext = ((tool->flags & T_TEXT) != 0);
    783               if(tool->help)
     759              if (tool->help)
    784760                free(tool->help);
    785761              tool->help = NULL;
    786               if(tool->text)
     762              if (tool->text)
    787763                free(tool->text);
    788764              tool->text = NULL;
    789               if(*help)
     765              if (*help)
    790766                tool->help = xstrdup(help,pszSrcFile,__LINE__);
    791               if(*text)
     767              if (*text)
    792768                tool->text = xstrdup(text,pszSrcFile,__LINE__);
    793769              tool->flags = (((dropable) ? T_DROPABLE : 0)  |
     
    802778            *idstr = 0;
    803779            WinQueryDlgItemText(hwnd,ADDBTN_ID,6,idstr);
    804             if(!(USHORT)atoi(idstr)) {
     780            if (!(USHORT)atoi(idstr)) {
    805781              DosBeep(250,100);
    806782              break;
    807783            }
    808784            tool = toolhead;
    809             while(tool) {
    810               if(tool->id == (USHORT)atoi(idstr) && tool != tool) {
     785            while (tool) {
     786              if (tool->id == (USHORT)atoi(idstr) && tool != tool) {
    811787                saymsg(MB_ENTER,
    812788                       hwnd,
    813789                       GetPString(IDS_DUPLICATETEXT),
    814790                       GetPString(IDS_TOOLIDEXISTS));
    815                 WinSetDlgItemText(hwnd,
    816                                   ADDBTN_ID,
    817                                   NullStr);
    818                 WinSetFocus(HWND_DESKTOP,
    819                             WinWindowFromID(hwnd,ADDBTN_ID));
     791                WinSetDlgItemText(hwnd,ADDBTN_ID,NullStr);
     792                WinSetFocus(HWND_DESKTOP,WinWindowFromID(hwnd,ADDBTN_ID));
    820793                break;
    821794              }
     
    824797            tool = xmallocz(sizeof(TOOL),pszSrcFile,__LINE__);
    825798            if (tool) {
    826               if(*help)
     799              if (*help)
    827800                tool->help = xstrdup(help,pszSrcFile,__LINE__);
    828               if(*text)
     801              if (*text)
    829802                tool->text = xstrdup(text,pszSrcFile,__LINE__);
    830803              tool->id = (USHORT)atoi(idstr);
     
    850823            *idstr = 0;
    851824            WinQueryDlgItemText(hwnd,ADDBTN_ID,6,idstr);
    852             if(!(USHORT)atoi(idstr)) {
     825            if (!(USHORT)atoi(idstr)) {
    853826              DosBeep(250,100);
    854827              break;
    855828            }
    856             sprintf(filename,
    857                     "%u.BMP",
    858                     atoi(idstr));
    859             if(IsFile(filename) != 1)
    860               docopyf(COPY,
    861                       "EMPTY.BMP",
    862                       filename);
     829            sprintf(filename,"%u.BMP",atoi(idstr));
     830            if (IsFile(filename) != 1) {
     831              CHAR s[CCHMAXPATH] = "EMPTY.BMP";
     832              docopyf(COPY, s, filename);
     833            }
    863834            runemf2(SEPARATE | WINDOWED,
    864835                    hwnd,
     
    871842
    872843        case IDM_HELP:
    873           if(hwndHelp) {
    874             if(INSTDATA(hwnd))
     844          if (hwndHelp) {
     845            if (INSTDATA(hwnd))
    875846              WinSendMsg(hwndHelp,HM_DISPLAY_HELP,
    876847                         MPFROM2SHORT(HELP_CHANGEBUTTON,0),
     
    891862MRESULT EXPENTRY PickToolProc(HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2)
    892863{
    893   switch(msg) {
     864  switch (msg) {
    894865    case WM_INITDLG:
    895       if(mp2) {
     866      if (mp2) {
    896867        CHAR s[133];
    897868
     
    906877
    907878        tool = toolhead;
    908         while(tool) {
     879        while (tool) {
    909880          sprintf(s,
    910881                  "%-5u  %s",
     
    922893
    923894    case WM_CONTROL:
    924       if(SHORT1FROMMP(mp1) == PICKBTN_LISTBOX) {
    925         switch(SHORT2FROMMP(mp1)) {
     895      if (SHORT1FROMMP(mp1) == PICKBTN_LISTBOX) {
     896        switch (SHORT2FROMMP(mp1)) {
    926897          case LN_ENTER:
    927898            PostMsg(hwnd,WM_COMMAND,MPFROM2SHORT(DID_OK,0),MPVOID);
     
    932903
    933904    case WM_COMMAND:
    934       switch(SHORT1FROMMP(mp1)) {
     905      switch (SHORT1FROMMP(mp1)) {
    935906        case DID_CANCEL:
    936907          WinDismissDlg(hwnd,0);
     
    945916                                               MPFROMSHORT(LIT_FIRST),
    946917                                               MPVOID);
    947             if(sSelect >= 0) {
     918            if (sSelect >= 0) {
    948919              *s = 0;
    949920              WinSendDlgItemMsg(hwnd,PICKBTN_LISTBOX,LM_QUERYITEMTEXT,
    950921                                MPFROM2SHORT(sSelect,32),MPFROMP(s));
    951               if(*s)
     922              if (*s)
    952923                WinDismissDlg(hwnd,(USHORT)atoi(s));
    953924            }
     
    963934MRESULT EXPENTRY ToolIODlgProc(HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2)
    964935{
    965   switch(msg) {
     936  switch (msg) {
    966937    case WM_INITDLG:
    967       if(mp2)
     938      if (mp2)
    968939        WinSetWindowULong(hwnd,QWL_USER,TRUE);
    969940      else {
     
    983954        CHAR        *masks[] = {"*.TLS","FM3TOOLS.DAT",NULL};
    984955
    985         if(mp2)
     956        if (mp2)
    986957          masks[1] = NULL;
    987         while(masks[x]) {
     958        while (masks[x]) {
    988959          hDir = HDIR_CREATE;
    989960          ulSearchCount = 1L;
    990961          DosError(FERR_DISABLEHARDERR);
    991           if(!DosFindFirst(masks[x],
     962          if (!DosFindFirst(masks[x],
    992963                           &hDir,
    993964                           FILE_ARCHIVED,
     
    1004975                         MPFROMP(findbuf.achName));
    1005976              ulSearchCount = 1L;
    1006             } while(!DosFindNext(hDir,
     977            } while (!DosFindNext(hDir,
    1007978                                 &findbuf,
    1008979                                 sizeof(FILEFINDBUF3),
     
    1015986        DosError(FERR_DISABLEHARDERR);
    1016987      }
    1017       if(!WinSendDlgItemMsg(hwnd,
     988      if (!WinSendDlgItemMsg(hwnd,
    1018989                            SVBTN_LISTBOX,
    1019990                            LM_QUERYITEMCOUNT,
    1020991                            MPVOID,
    1021992                            MPVOID)) {
    1022         WinEnableWindow(WinWindowFromID(hwnd,
    1023                                         SVBTN_LISTBOX),
     993        WinEnableWindow(WinWindowFromID(hwnd,SVBTN_LISTBOX),
    1024994                        FALSE);
    1025         PostMsg(hwnd,
    1026                 UM_SETUP,
    1027                 MPVOID,
    1028                 MPVOID);
     995        PostMsg(hwnd,UM_SETUP,MPVOID,MPVOID);
    1029996      }
    1030997      WinSetDlgItemText(hwnd,
     
    10401007
    10411008    case WM_CONTROL:
    1042       if(SHORT1FROMMP(mp1) == SVBTN_LISTBOX) {
     1009      if (SHORT1FROMMP(mp1) == SVBTN_LISTBOX) {
    10431010        SHORT sSelect;
    10441011        CHAR  szBuffer[CCHMAXPATH];
    10451012
    1046         switch(SHORT2FROMMP(mp1)) {
     1013        switch (SHORT2FROMMP(mp1)) {
    10471014          case LN_SELECT:
    10481015            sSelect = (SHORT)WinSendDlgItemMsg(hwnd,SVBTN_LISTBOX,
     
    10501017                                               MPFROMSHORT(LIT_FIRST),
    10511018                                               MPVOID);
    1052             if(sSelect >= 0) {
     1019            if (sSelect >= 0) {
    10531020              *szBuffer = 0;
    10541021              WinSendDlgItemMsg(hwnd,SVBTN_LISTBOX,LM_QUERYITEMTEXT,
    10551022                                MPFROM2SHORT(sSelect,CCHMAXPATH),
    10561023                                MPFROMP(szBuffer));
    1057               if(*szBuffer)
     1024              if (*szBuffer)
    10581025                WinSetDlgItemText(hwnd,SVBTN_ENTRY,szBuffer);
    10591026            }
     
    10681035
    10691036    case WM_COMMAND:
    1070       switch(SHORT1FROMMP(mp1)) {
     1037      switch (SHORT1FROMMP(mp1)) {
    10711038        case IDM_HELP:
    1072           if(hwndHelp) {
    1073             if(INSTDATA(hwnd))
     1039          if (hwndHelp) {
     1040            if (INSTDATA(hwnd))
    10741041              WinSendMsg(hwndHelp,HM_DISPLAY_HELP,
    10751042                         MPFROM2SHORT(HELP_SAVETOOLS,0),
     
    10921059
    10931060            strcpy(temptools,lasttoolbox);
    1094             if(fToolsChanged)
     1061            if (fToolsChanged)
    10951062              save_tools(NULL);
    10961063            WinQueryDlgItemText(hwnd,
     
    10981065                                sizeof(lasttoolbox),
    10991066                                lasttoolbox);
    1100             if(*lasttoolbox) {
    1101               if(!strchr(lasttoolbox,'.'))
     1067            if (*lasttoolbox) {
     1068              if (!strchr(lasttoolbox,'.'))
    11021069                strcat(lasttoolbox,".TLS");
    11031070            }
    1104             if(saving && *lasttoolbox)
     1071            if (saving && *lasttoolbox)
    11051072              save_tools(NULL);
    11061073            else {
    1107               if(!load_tools(NULL)) {
     1074              if (!load_tools(NULL)) {
    11081075                strcpy(lasttoolbox,temptools);
    1109                 if(!load_tools(NULL)) {
     1076                if (!load_tools(NULL)) {
    11101077                  *lasttoolbox = 0;
    11111078                  load_tools(NULL);
Note: See TracChangeset for help on using the changeset viewer.