Changeset 1121 for trunk/dll/tools.c


Ignore:
Timestamp:
Aug 27, 2008, 2:07:20 AM (17 years ago)
Author:
Gregg Young
Message:

Require unique ID plus text and help strings for all tools save toolbar on button delete. (Tickets 264, 266 & 272)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/tools.c

    r1119 r1121  
    2020  19 Jul 08 GKY Replace save_dir2(dir) with pFM2SaveDirectory and use BldFullPathName
    2121  24 Aug 08 GKY Warn full drive on save of .DAT & .TLS files; prevent loss of existing file
     22  26 Aug 08 GKY Require unique ID plus text and help strings for all tools save toolbar on button delete
    2223
    2324***********************************************************************/
     
    705706        CHAR help[81], text[81], idstr[7];
    706707        BOOL invisible, dropable, separator, istext, myicon;
    707         TOOL *tool;
    708 
     708        TOOL *tool;
     709        BOOL BadID = FALSE;
     710
     711        help[0] = text[0] = NULL;
    709712        WinQueryDlgItemText(hwnd, ADDBTN_HELP, 80, help);
    710713        WinQueryDlgItemText(hwnd, ADDBTN_TEXT, 80, text);
     
    733736          xfree(tool->text, pszSrcFile, __LINE__);
    734737          tool->text = NULL;
    735           if (*help)
     738          if (*help && *text && help && text) {
    736739            tool->help = xstrdup(help, pszSrcFile, __LINE__);
    737           if (*text)
    738             tool->text = xstrdup(text, pszSrcFile, __LINE__);
     740            tool->text = xstrdup(text, pszSrcFile, __LINE__);
     741          }
     742          else {
     743            saymsg(MB_ENTER,
     744                   hwnd,
     745                   GetPString(IDS_MISSINGTEXT),
     746                   GetPString(IDS_TOOLHELPTEXTBLANK));
     747            WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, ADDBTN_HELP));
     748            break;
     749          }
    739750          tool->flags = (((dropable) ? T_DROPABLE : 0) |
    740751                         ((invisible) ? T_INVISIBLE : 0) |
     
    753764        tool = toolhead;
    754765        while (tool) {
    755           if (tool->id == (USHORT) atoi(idstr) && tool != tool) {
     766          if (tool->id == (USHORT) atoi(idstr)) { // && tool != tool) {
    756767            saymsg(MB_ENTER,
    757768                   hwnd,
     
    759770                   GetPString(IDS_TOOLIDEXISTS));
    760771            WinSetDlgItemText(hwnd, ADDBTN_ID, NullStr);
    761             WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, ADDBTN_ID));
     772            WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, ADDBTN_ID));
     773            BadID =TRUE;
    762774            break;
    763775          }
    764776          tool = tool->next;
    765         }
     777        }
     778        if (BadID)
     779          break;
    766780        tool = xmallocz(sizeof(TOOL), pszSrcFile, __LINE__);
    767781        if (tool) {
Note: See TracChangeset for help on using the changeset viewer.