Changeset 29 for branches/1.0


Ignore:
Timestamp:
Apr 21, 2010, 7:37:01 PM (15 years ago)
Author:
herwigb
Message:

Implemented Find button, fixed length limit

Location:
branches/1.0/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/1.0/src/build.cmd

    r28 r29  
    11@echo off
     2echo Cleaning.
    23@del uni.o
    34@del uni.pdr
    45@del .\de\uni.res
    5 echo Done cleaning.
    6 gcc -o utils.o utils.c -c>>build.log
     6echo Done.
     7echo Compiling.
     8gcc -o utils.o utils.c -c>build.log
    79gcc -o splpd.o splpd.c -c>>build.log
    8 gcc -o uni.o uni.c -c>build.log
    9 
    10 echo Done compiling.
     10gcc -o uni.o uni.c -c>>build.log
     11echo Done.
     12echo Compiling resources.
    1113cd de
    12 RC -r uni.RC uni.RES
     14RC -r uni.RC uni.RES >>build.log
    1315cd ..
    14 echo Done compiling resource.
     16echo Done.
     17echo Linking.
    1518gcc -Zdll -Zbin-files -Zomf -o uni.pdr utils.o splpd.o uni.o uni.def .\de\uni.res >>build.log
    16 echo Done linking.
     19echo Done.
     20echo Attaching EAS.
    1721ea2 -e DEFAULT_PORT=UNI uni.pdr >>build.log
    18 echo Done attaching EA.
     22echo Done.
    1923rem d:
    2024rem cd \OS2\DLL
  • branches/1.0/src/de/uni.dlg

    r20 r29  
    2626        LTEXT           "Working directory:", DT_DIRECTORY, 13, 45, 203, 8
    2727        ENTRYFIELD      "", ID_DIRECTORY, 15, 33, 200, 8, ES_MARGIN
    28         PUSHBUTTON      "Find", PB_FIND, 13, 86, 62, 14, WS_DISABLED
     28        PUSHBUTTON      "Find", DID_FIND, 13, 86, 62, 14
     29        PUSHBUTTON      "Setup Wizard", DID_SETUPWIZARD, 155, 86, 62, 14
    2930    END
    3031END
  • branches/1.0/src/uni.c

    r26 r29  
    1212#include    <stdio.h>
    1313#include    <stdlib.h>
     14#include    <process.h>
    1415#include    "utils.h"
    1516
     
    2324        CHAR        szTemp[ STR_LEN_PORTDESC ];
    2425        CHAR        pwBuffer[256];
     26        CHAR        setupwiz[256];
     27        CHAR        setupparms[256];
    2528        USHORT      i;
    2629        ULONG       rc = 0;
    2730        PUCHAR      token;
     31        BOOL        ulResult = MBID_ERROR;
     32        BOOL        fResult;
     33        FILEDLG     fd;
     34        CHAR        szMessage[ _MAX_PATH];
     35        CHAR        szDrive[ _MAX_PATH];
     36        CHAR        szDir[ _MAX_PATH];
     37        PSZ         pszButtonCode;
    2838
    2939        switch (msg)
     
    3141                case WM_INITDLG:
    3242//                      WinSendDlgItemMsg(hDlg,ID_BINARY,BM_SETCHECK,MPFROM2SHORT(1,0),NULL);
     43                        WinSendDlgItemMsg(hDlg,ID_PROGRAM,   EM_SETTEXTLIMIT, MPFROMSHORT(128),NULL);
     44                        WinSendDlgItemMsg(hDlg,ID_PARAMETERS,EM_SETTEXTLIMIT, MPFROMSHORT(128),NULL);
     45                        WinSendDlgItemMsg(hDlg,ID_DIRECTORY, EM_SETTEXTLIMIT, MPFROMSHORT(128),NULL);
     46
    3347                        pUniData = (PUNIDATA)mp2;
    3448                        WinSetWindowULong (hDlg, QWL_USER, (ULONG)pUniData);
     
    158172                                        WinDismissDlg(hDlg, TRUE);
    159173                                        break;
     174                                case DID_FIND:
     175                                        // setup data
     176                                        memset( &fd, 0, sizeof( fd));
     177                                        fd.cbSize    = sizeof( fd);
     178                                        fd.fl        = FDS_CENTER | FDS_HELPBUTTON | FDS_OPEN_DIALOG;
     179                                        fd.pszTitle  = "Find executable";
     180                                       
     181                                        WinQueryDlgItemText (hDlg, ID_PROGRAM, sizeof(szTemp), szTemp );
     182                                        if (strlen(szTemp) > 0) {
     183                                                _splitpath(szTemp, szDrive, szDir, NULL, NULL);
     184                                                strncat(szDrive, szDir, strlen(szDir) -1);
     185                                                strcat(szDrive,"\\*");
     186                                                strcpy( fd.szFullFile,szDrive);
     187                                        }
     188                                        else strcpy( fd.szFullFile, "C:\\*");
     189
     190                                        // launch dialog
     191                                        fResult = WinFileDlg( HWND_DESKTOP, hDlg, &fd);
     192                                        if (!fResult)
     193                                                sprintf( szMessage, "error launching WinFileDlg\n");
     194                                        else if (fd.lReturn == DID_OK) {
     195                                                WinSetDlgItemText(hDlg,ID_PROGRAM,fd.szFullFile);
     196                                                _splitpath(fd.szFullFile, szDrive, szDir, NULL, NULL);
     197                                                strncat(szDrive, szDir, strlen(szDir) -1);
     198                                                WinSetDlgItemText(hDlg,ID_DIRECTORY,szDrive);
     199                                        }
     200                                        else
     201                                            sprintf( szMessage, "error occurred!\n");
     202                                        break;
     203                                case DID_SETUPWIZARD:
     204                                        // preliminary
     205                                        WinDismissDlg(hDlg, TRUE);
     206                                        sprintf(setupwiz,"unipdrcfg.exe");
     207                                        rc = spawnlp(P_NOWAIT,setupwiz,setupwiz,pUniData->pszPortName,NULL);
     208                                        // preliminary
     209                                        WinDismissDlg(hDlg, TRUE);
     210                                        break;
    160211                                case DID_CANCEL:
    161212                                        WinDismissDlg(hDlg, MBID_CANCEL);
     
    193244}
    194245
     246/*
     247static ULONG _launchFileDlg( HWND hwnd, HWND hwndBubbleHelp)
     248
     249{
     250         BOOL           ulResult = MBID_ERROR;
     251         BOOL           fResult;
     252         FILEDLG        fd;
     253
     254         CHAR           szMessage[ _MAX_PATH];
     255         PSZ            pszButtonCode;
     256
     257// stop bubble help
     258WtkDeactivateBubbleHelp( hwndBubbleHelp);
     259
     260do
     261   {
     262   // setup data
     263   memset( &fd, 0, sizeof( fd));
     264   fd.cbSize     = sizeof( fd);
     265   fd.fl         = FDS_CENTER | FDS_HELPBUTTON | FDS_OPEN_DIALOG;
     266   fd.pszTitle   = "System File test dialog";
     267   strcpy( fd.szFullFile, "C:\\*");
     268
     269   // launch dialog
     270   fResult = WinFileDlg( HWND_DESKTOP, hwnd, &fd);
     271
     272   if (!fResult)
     273      sprintf( szMessage, "error launching WinFileDlg\n");
     274   else if (fd.lReturn == DID_OK)
     275      sprintf( szMessage, "file is: %s\n", fd.szFullFile);
     276   else
     277      sprintf( szMessage, "error occurred!\n");
     278
     279   switch (fd.lReturn)
     280      {
     281      case DID_OK:     pszButtonCode = "(DID_OK)";     break;
     282      case DID_CANCEL: pszButtonCode = "(DID_CANCEL)"; break;
     283      case DID_ERROR:  pszButtonCode = "(DID_ERROR)";  break;
     284      default:         pszButtonCode = "";             break;
     285      }
     286
     287   sprintf( &szMessage[ strlen( szMessage)],
     288            "\015\015"
     289            "return code is: %u %s\015"
     290            "WinFileDlg error source code is: %u\015",
     291            fd.lReturn, pszButtonCode, fd.lSRC);
     292
     293   WinMessageBox( HWND_DESKTOP, hwnd, szMessage, "File Dialog Result",
     294                  IDDLG_MSGBOX_RESULTFILEDLG, MB_MOVEABLE | MB_OK | MB_HELP);
     295
     296   // on error return error code
     297   if (!fResult)
     298      break;
     299
     300   // hand over result
     301   ulResult = fd.lReturn;
     302
     303   } while (FALSE);
     304
     305
     306// restart bubble help
     307WtkActivateBubbleHelp( hwndBubbleHelp);
     308return ulResult;
     309}
     310 */
  • branches/1.0/src/uni.h

    r26 r29  
    4444#define  INCL_DOSERRORS
    4545#define  INCL_WINHOOKS
     46#define  INCL_WINSTDDLGS           /* CUA controls and dialogs */
    4647
    4748#include <os2.h>
     
    239240} PORTNAMES, *PPORTNAMES;
    240241
    241 #define GB_UNICFG                   206
    242 #define ID_PROGRAM                  210
    243 #define DT_PROGRAM                  211
    244 #define ID_PARAMETERS               212
    245 #define DT_PARAMETERS               213
    246 #define DT_DIRECTORY                214
    247 #define ID_DIRECTORY                215
    248 #define PB_FIND                     216
     242#define GB_UNICFG                   201
     243#define ID_PROGRAM                  202
     244#define DT_PROGRAM                  203
     245#define ID_PARAMETERS               204
     246#define DT_PARAMETERS               205
     247#define DT_DIRECTORY                206
     248#define ID_DIRECTORY                207
     249#define DID_FIND                    208
     250#define DID_SETUPWIZARD             209
Note: See TracChangeset for help on using the changeset viewer.