Changeset 112 for trunk/src


Ignore:
Timestamp:
Jun 17, 1999, 8:25:22 PM (26 years ago)
Author:
phaller
Message:

Fix: major restructuring of Open32 handle management, HandleManager

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/async.cpp

    r111 r112  
    1 /* $Id: async.cpp,v 1.4 1999-06-17 18:21:37 phaller Exp $ */
     1/* $Id: async.cpp,v 1.5 1999-06-17 18:25:22 phaller Exp $ */
    22
    33/*
     
    4747#include "unicode.h"
    4848
    49 // PH: to soothe the compiler
    50 #define BY_HANDLE_FILE_INFORMATION void
    51 #define LPFILETIME void*
    52 #define OFSTRUCT void
    53 
     49#include "conwin.h"          // Windows Header for console only
    5450#include "handlemanager.h"
    5551
  • trunk/src/kernel32/winexe.cpp

    r111 r112  
    1 /* $Id: winexe.cpp,v 1.4 1999-06-17 18:21:43 phaller Exp $ */
     1/* $Id: winexe.cpp,v 1.5 1999-06-17 18:25:22 phaller Exp $ */
    22
    33/*
     
    3131#include "cio.h"
    3232
    33 
    34 // PH: to soothe the compiler
    35 #define BY_HANDLE_FILE_INFORMATION void
    36 #define LPFILETIME void*
    37 #define OFSTRUCT void
    38 
     33#include "conwin.h"          // Windows Header for console only
    3934#include "console.h"
    4035#include "handlemanager.h"
  • trunk/src/kernel32/wprocess.cpp

    r111 r112  
    1 /* $Id: wprocess.cpp,v 1.6 1999-06-17 18:21:43 phaller Exp $ */
     1/* $Id: wprocess.cpp,v 1.7 1999-06-17 18:25:22 phaller Exp $ */
    22
    33/*
     
    2626#include "except.h"
    2727#include "os2util.h"
     28
    2829#include "console.h"
    2930#include "cio.h"
  • trunk/src/user32/dlgconvert.cpp

    r96 r112  
    1 /* $Id: dlgconvert.cpp,v 1.3 1999-06-10 16:50:38 phaller Exp $ */
     1/* $Id: dlgconvert.cpp,v 1.4 1999-06-17 18:22:43 phaller Exp $ */
    22
    33/*
     
    2626#define DWORD   ULONG
    2727#define LPVOID  VOID *
    28 #define WORD    USHORT 
     28#define WORD    USHORT
    2929#define WCHAR   USHORT
    3030#define HANDLE  ULONG
     
    6565 PRESPARAMS  *dlgpparam;
    6666 char        *dlgdata, *dlgcurdata;
    67  WCHAR       *szCaption;
     67 WCHAR        *szCaption;
    6868 WORD        *ptrArray;
    6969 char        *ctrltext, *szClass, *font;
     
    7676  if(windlgex->wDlgVer == 1 && windlgex->wSignature == 0xFFFF) {
    7777#ifdef DEBUG
    78         WriteLog("ConvertWin32DlgTemplate: DLGTEMPLATEEX!\n");
    79 #endif
    80         return(ConvertWin32DlgTemplateEx(windlgex));
    81   }
    82 
    83   //should be enough 
     78   WriteLog("ConvertWin32DlgTemplate: DLGTEMPLATEEX!\n");
     79#endif
     80   return(ConvertWin32DlgTemplateEx(windlgex));
     81  }
     82
     83  //should be enough
    8484  size    = dhdr->NumberOfItems*sizeof(DLGTITEM) * 128;
    8585  dlgt    = (DLGTEMPLATE *)malloc(sizeof(DLGTEMPLATE) + dhdr->NumberOfItems*sizeof(DLGTITEM) + size);
     
    8989  dlgcurdata = dlgdata;
    9090
    91   dlgt->codepage         = 437;
    92   dlgt->offadlgti        = 14;
     91  dlgt->codepage                         = 437;
     92  dlgt->offadlgti                        = 14;
    9393  dlgt->fsTemplateStatus = 1;
    9494  dlgt->iItemFocus       = 65535;
     
    9999  ctrlflag = 0;
    100100  if((dhdr->lStyle & WINWS_CAPTION) == WINWS_CAPTION) {
    101         ctrlflag |= FCF_TITLEBAR;
    102         dlgitem->flStyle |= FS_BORDER;
     101   ctrlflag |= FCF_TITLEBAR;
     102   dlgitem->flStyle |= FS_BORDER;
    103103  }
    104104  else
    105   if(dhdr->lStyle & WINWS_DLGFRAME)     //can't have title bar
    106         dlgitem->flStyle |= FS_DLGBORDER;
     105  if(dhdr->lStyle & WINWS_DLGFRAME)      //can't have title bar
     106   dlgitem->flStyle |= FS_DLGBORDER;
    107107
    108108  if((dhdr->lStyle & (WINWS_SYSMENU | WINWS_CAPTION)) == (WINWS_SYSMENU | WINWS_CAPTION))
    109         ctrlflag |= FCF_SYSMENU;
     109   ctrlflag |= FCF_SYSMENU;
    110110  if(dhdr->lStyle & WINWS_VSCROLL)
    111         ctrlflag |= FCF_VERTSCROLL;
     111   ctrlflag |= FCF_VERTSCROLL;
    112112  if(dhdr->lStyle & WINWS_HSCROLL)
    113         ctrlflag |= FCF_HORZSCROLL;
     113   ctrlflag |= FCF_HORZSCROLL;
    114114  if(dhdr->lStyle & WINWS_MINIMIZEBOX)
    115         ctrlflag |= FCF_MINBUTTON;
     115   ctrlflag |= FCF_MINBUTTON;
    116116  if(dhdr->lStyle & WINWS_MAXIMIZEBOX)
    117         ctrlflag |= FCF_MAXBUTTON;
     117   ctrlflag |= FCF_MAXBUTTON;
    118118  if(dhdr->lStyle & WINWS_THICKFRAME)
    119         dlgitem->flStyle |= FS_SIZEBORDER;
     119   dlgitem->flStyle |= FS_SIZEBORDER;
    120120
    121121  if(ctrlflag) {
    122         *(ULONG *)dlgcurdata = ctrlflag;
    123         dlgitem->offCtlData  = (USHORT)((int)dlgcurdata - (int)dlgt);
    124         dlgcurdata          += sizeof(ULONG);
     122   *(ULONG *)dlgcurdata = ctrlflag;
     123   dlgitem->offCtlData  = (USHORT)((int)dlgcurdata - (int)dlgt);
     124   dlgcurdata          += sizeof(ULONG);
    125125  }
    126126  else  dlgitem->offCtlData  = 0xFFFF;
    127   dlgitem->x            = dhdr->x;
    128   dlgitem->y            = dhdr->y;
    129   dlgitem->cx           = dhdr->cx;
    130   dlgitem->cy           = dhdr->cy;
     127  dlgitem->x           = dhdr->x;
     128  dlgitem->y           = dhdr->y;
     129  dlgitem->cx          = dhdr->cx;
     130  dlgitem->cy          = dhdr->cy;
    131131  dlgitem->cChildren    = dhdr->NumberOfItems;
    132   dlgitem->id           = (USHORT)0;            //ord id or converted name id
     132  dlgitem->id           = (USHORT)0;        //ord id or converted name id
    133133  dlgitem->fsItemStatus = 1;
    134   dlgitem->offClassName = 1;    //WC_FRAME
     134  dlgitem->offClassName = 1;             //WC_FRAME
    135135
    136136#ifdef DEBUG
     
    145145  if(dhdr->fNameOrd == 0xFFFF) {
    146146#ifdef DEBUG
    147         WriteLog("Menu ID            : %d\n", (int)*(WORD *)(dhdr+1));
    148 #endif
    149         ptrArray = (WORD *)((int)dhdr + sizeof(DialogBoxHeader) + sizeof(WORD));
     147   WriteLog("Menu ID            : %d\n", (int)*(WORD *)(dhdr+1));
     148#endif
     149   ptrArray = (WORD *)((int)dhdr + sizeof(DialogBoxHeader) + sizeof(WORD));
    150150  }
    151151  else {
    152         if(dhdr->fNameOrd == 0) {//SvL: 0 == no menu!
    153                 ptrArray = (WORD *)((int)dhdr + sizeof(DialogBoxHeader));
    154         }
    155         else {
    156 #ifdef DEBUG
    157                 ctrltext = UnicodeToAsciiString((WCHAR *)&dhdr->fNameOrd);
    158                 WriteLog("Menu namestring    : %s\n", ctrltext);
    159                 FreeAsciiString(ctrltext);
    160 #endif
    161                 ptrArray = (WORD *)((int)&dhdr->fNameOrd + UniStrlen((WCHAR *)(&dhdr->fNameOrd))*2 + sizeof(WCHAR));
    162         }
     152   if(dhdr->fNameOrd == 0) {//SvL: 0 == no menu!
     153      ptrArray = (WORD *)((int)dhdr + sizeof(DialogBoxHeader));
     154   }
     155   else {
     156#ifdef DEBUG
     157      ctrltext = UnicodeToAsciiString((WCHAR *)&dhdr->fNameOrd);
     158      WriteLog("Menu namestring    : %s\n", ctrltext);
     159      FreeAsciiString(ctrltext);
     160#endif
     161      ptrArray = (WORD *)((int)&dhdr->fNameOrd + UniStrlen((WCHAR *)(&dhdr->fNameOrd))*2 + sizeof(WCHAR));
     162   }
    163163  }
    164164  //Class id
    165165  if(*ptrArray == 0xFFFF) {
    166166#ifdef DEBUG
    167         winclass = (int)*(WORD *)(ptrArray+1);
    168         WriteLog("Class ID           : %d\n", winclass);
    169 #endif
    170         //SvL: shouldn't happen! (at least not with this code)
    171         assert(FALSE);
    172         ptrArray = (WORD *)((int)ptrArray + 2*sizeof(WORD));
     167   winclass = (int)*(WORD *)(ptrArray+1);
     168   WriteLog("Class ID           : %d\n", winclass);
     169#endif
     170   //SvL: shouldn't happen! (at least not with this code)
     171   assert(FALSE);
     172   ptrArray = (WORD *)((int)ptrArray + 2*sizeof(WORD));
    173173  }
    174174  else {
    175         if(*ptrArray == 0) {//SvL: 0 == no class!
    176                 ptrArray = (WORD *)((int)ptrArray + sizeof(WORD));
    177         }
    178         else {
    179                 szClass = UnicodeToAsciiString((WCHAR *)ptrArray);
    180 #ifdef DEBUG
    181                 WriteLog("Class namestring    : %s\n", szClass);
    182 #endif
    183 //              cout << "Class Name            : " << szClass << endl;
    184 
    185                 dlgitem->cchClassName = strlen(szClass);
    186                 dlgitem->offClassName = (USHORT)((int)dlgcurdata - (int)dlgt);
    187                 strcpy((char *)dlgcurdata, szClass);
    188                 //Open32 wants class name in upper case!
    189                 UpCase((char *)dlgcurdata);
    190                 dlgcurdata           += dlgitem->cchClassName + 1;      //include terminating 0 (just to be sure)
    191 //TODO: SvL: Can they also be system classes? 
    192 //              dlgitem->flStyle      = dhdr->lStyle;
    193 //              dlgitem->flStyle      = ConvertDlgItemStyle(dhdr->lStyle);
    194                 ptrArray = (WORD *)((int)ptrArray + UniStrlen((WCHAR *)(ptrArray))*2 + sizeof(WORD));
    195                 FreeAsciiString(szClass);
    196         }
     175   if(*ptrArray == 0) {//SvL: 0 == no class!
     176      ptrArray = (WORD *)((int)ptrArray + sizeof(WORD));
     177   }
     178   else {
     179      szClass = UnicodeToAsciiString((WCHAR *)ptrArray);
     180#ifdef DEBUG
     181      WriteLog("Class namestring    : %s\n", szClass);
     182#endif
     183//    cout << "Class Name            : " << szClass << endl;
     184
     185      dlgitem->cchClassName = strlen(szClass);
     186      dlgitem->offClassName = (USHORT)((int)dlgcurdata - (int)dlgt);
     187      strcpy((char *)dlgcurdata, szClass);
     188      //Open32 wants class name in upper case!
     189      UpCase((char *)dlgcurdata);
     190      dlgcurdata           += dlgitem->cchClassName + 1;   //include terminating 0 (just to be sure)
     191//TODO: SvL: Can they also be system classes?
     192//    dlgitem->flStyle      = dhdr->lStyle;
     193//    dlgitem->flStyle      = ConvertDlgItemStyle(dhdr->lStyle);
     194      ptrArray = (WORD *)((int)ptrArray + UniStrlen((WCHAR *)(ptrArray))*2 + sizeof(WORD));
     195      FreeAsciiString(szClass);
     196   }
    197197  }
    198198
     
    200200  if(*ptrArray == 0) {
    201201#ifdef DEBUG
    202         WriteLog("No title\n");
    203 #endif
    204         ctrldata = (ControlData *)((int)(int)ptrArray + sizeof(WORD));
     202   WriteLog("No title\n");
     203#endif
     204   ctrldata = (ControlData *)((int)(int)ptrArray + sizeof(WORD));
    205205  }
    206206  else {
    207         ctrltext = UnicodeToAsciiString((WCHAR *)(ptrArray));
    208 #ifdef DEBUG
    209         WriteLog("Title                : %s\n", ctrltext);
    210 #endif
    211         ctrldata = (ControlData *)((int)(int)ptrArray + UniStrlen((WCHAR *)(ptrArray))*2 + sizeof(WORD));
    212 
    213         if(ctrltext[0] != 0) {
    214                 dlgitem->cchText = strlen(ctrltext);
    215                 dlgitem->offText = (USHORT)((int)dlgcurdata - (int)dlgt);
    216                 strcpy((char *)dlgcurdata, ctrltext);
    217                 dlgcurdata      += dlgitem->cchText + 1;        //include terminating 0 (just to be sure)
    218         }
    219         FreeAsciiString(ctrltext);
     207   ctrltext = UnicodeToAsciiString((WCHAR *)(ptrArray));
     208#ifdef DEBUG
     209   WriteLog("Title                : %s\n", ctrltext);
     210#endif
     211   ctrldata = (ControlData *)((int)(int)ptrArray + UniStrlen((WCHAR *)(ptrArray))*2 + sizeof(WORD));
     212
     213   if(ctrltext[0] != 0) {
     214      dlgitem->cchText = strlen(ctrltext);
     215      dlgitem->offText = (USHORT)((int)dlgcurdata - (int)dlgt);
     216      strcpy((char *)dlgcurdata, ctrltext);
     217      dlgcurdata      += dlgitem->cchText + 1; //include terminating 0 (just to be sure)
     218   }
     219   FreeAsciiString(ctrltext);
    220220  }
    221221  dlgitem++;
    222222
    223223  if(dhdr->lStyle & DS_SETFONT) {
    224         fhdr = (FontHeader *)ctrldata;
    225         font = UnicodeToAsciiString(fhdr->szFontName);
    226 #ifdef DEBUG
    227         WriteLog("Font Point Size      : %d\n", fhdr->wPointSize);
    228         WriteLog("Font Name            : %s\n", font);
     224   fhdr = (FontHeader *)ctrldata;
     225   font = UnicodeToAsciiString(fhdr->szFontName);
     226#ifdef DEBUG
     227   WriteLog("Font Point Size      : %d\n", fhdr->wPointSize);
     228   WriteLog("Font Name            : %s\n", font);
    229229#endif
    230230        ctrldata = (ControlData *)((int)fhdr + sizeof(FontHeader) - 2 + UniStrlen(fhdr->szFontName)*2 + sizeof(WORD));  /*PLF Sat  97-06-21 20:22:44*/
    231231        //TODO: no pres params yet (font in win32 dialog ignored)
    232         dlgpparam = (PRESPARAMS *)dlgcurdata;
    233         dlgpparam->cb = 0;
    234         dlgpparam->aparam[0].id = PP_FONTNAMESIZE;
    235         dlgpparam->aparam[0].cb = 0;
    236         UpCase(font);
    237         if(ConvertFont(font, dlgpparam, fhdr->wPointSize) == TRUE) {
    238                 dlgpparam->cb           = sizeof(PARAM) + dlgpparam->aparam[0].cb - 1;
    239                 dlgpparam->aparam[0].cb = strlen(dlgpparam->aparam[0].ab) + 1;
    240                 dlgt->coffPresParams    = (int)dlgpparam;
    241                 dlgcurdata += sizeof(PRESPARAMS) + dlgpparam->aparam[0].cb - 1;
    242         }
    243         FreeAsciiString(font);
     232   dlgpparam = (PRESPARAMS *)dlgcurdata;
     233   dlgpparam->cb = 0;
     234   dlgpparam->aparam[0].id = PP_FONTNAMESIZE;
     235   dlgpparam->aparam[0].cb = 0;
     236   UpCase(font);
     237   if(ConvertFont(font, dlgpparam, fhdr->wPointSize) == TRUE) {
     238      dlgpparam->cb           = sizeof(PARAM) + dlgpparam->aparam[0].cb - 1;
     239      dlgpparam->aparam[0].cb = strlen(dlgpparam->aparam[0].ab) + 1;
     240      dlgt->coffPresParams    = (int)dlgpparam;
     241      dlgcurdata += sizeof(PRESPARAMS) + dlgpparam->aparam[0].cb - 1;
     242   }
     243   FreeAsciiString(font);
    244244  }
    245245  ctrldata = (ControlData *)(((int)ctrldata+3) & ~3);
    246246
    247247  for(i=0;i<dhdr->NumberOfItems;i++) {
    248         //save as OS/2 DLGTITEM
    249         dlgitem->x             = ctrldata->x;
    250         //SvL: 3-8-'97
    251         // OS/2  -> left bottom == origin and y coordinate == left bottom origin control
    252         // Win32 -> left top    == origin and y coordinate == left top origin
    253         dlgitem->y             = dlgt->adlgti[0].cy - ctrldata->y - ctrldata->cy;
    254         dlgitem->cx            = ctrldata->cx;
    255         dlgitem->cy            = ctrldata->cy;
    256         dlgitem->id            = ctrldata->wId;
    257         dlgitem->offCtlData    = 0xFFFF;
    258         dlgitem->offPresParams = 0xFFFF;
    259 
    260         //TODO: Extended style
    261 
    262 #ifdef DEBUG
    263         WriteLog("***** Control Style   : %X\n", ctrldata->lStyle);
    264         WriteLog("Extended Control Style: %X\n", ctrldata->lExtendedStyle);
    265         WriteLog("Position              : (%d,%d)\n", ctrldata->x, ctrldata->y);
    266         WriteLog("Size                  : (%d,%d)\n", ctrldata->cx, ctrldata->cy);
    267         WriteLog("wID                   : %d\n", ctrldata->wId);
    268 #endif
    269         winclass = 0;
    270         if(ctrldata->fClassId == 0xFFFF) {
    271                 winclass = *(WORD *)(ctrldata+1);
    272 #ifdef DEBUG
    273                 WriteLog("Class ID              : %d\n", winclass);
    274 #endif
    275                 szCaption = (WCHAR *)((int)ctrldata + sizeof(ControlData) + sizeof(WORD));
    276                 dlgitem->flStyle      = ConvertClassAndStyle(winclass, ctrldata->lStyle, &dlgitem->offClassName, &fIconBmp);
    277                 dlgitem->cchClassName = 0;
    278         }
    279         else {
    280                 szClass = UnicodeToAsciiString((WCHAR *)&ctrldata->fClassId);
    281 #ifdef DEBUG
    282                 WriteLog("Class Name            : %s\n", szClass);
    283 #endif
    284                 szCaption = (WCHAR *)((int)ctrldata + sizeof(ControlData) + strlen(szClass)*2);
    285                 dlgitem->cchClassName = strlen(szClass);
    286                 dlgitem->offClassName = (USHORT)((int)dlgcurdata - (int)dlgt);
    287                 strcpy((char *)dlgcurdata, szClass);
    288                 //Open32 wants class name in upper case!
    289                 UpCase((char *)dlgcurdata);
    290                 dlgcurdata           += dlgitem->cchClassName + 1;      //include terminating 0 (just to be sure)
    291 //TODO: SvL: Can they also be system classes? 
    292 //              dlgitem->flStyle      = ctrldata->lStyle;
    293                 dlgitem->flStyle      = ConvertDlgItemStyle(ctrldata->lStyle) ;
    294                 FreeAsciiString(szClass);
    295         }       
    296         if(*(USHORT *)szCaption == 0xFFFF) {
    297                 szCaption += 2;
    298         }
    299         else {  //Handle Caption
    300                 ctrltext = UnicodeToAsciiString(szCaption);
    301                 //SvL: (16-9-'97) Convert '&' chars to '~' (for some classes)
    302                 ConvertCaption(winclass, ctrltext);
    303                 if(fIconBmp == TRUE) {//control contains bitmap or icon
    304                         dlgitem->offText = (USHORT)((int)dlgcurdata - (int)dlgt);
    305                         int resid =  ConvertNameId(NULL, ctrltext);
    306                         *(char *)dlgcurdata = '#';
    307                         itoa(resid, (char *)dlgcurdata+1, 10);
    308                         dlgitem->cchText = strlen((char *)dlgcurdata);  //one USHORT for res id
    309                         dlgcurdata      += dlgitem->cchText + 1;        //include terminating 0 (just to be sure)
    310                 }
    311                 else {
    312                         if(ctrltext[0] != 0) {
    313                                 dlgitem->cchText = strlen(ctrltext);
    314                                 dlgitem->offText = (USHORT)((int)dlgcurdata - (int)dlgt);
    315                                 strcpy((char *)dlgcurdata, ctrltext);
    316                                 dlgcurdata      += dlgitem->cchText + 1;        //include terminating 0 (just to be sure)
    317                         }
    318                 }
    319 #ifdef DEBUG
    320                 szClass = UnicodeToAsciiString(szCaption);
    321                 WriteLog("Text                  : %s\n", szClass);
    322                 FreeAsciiString(szClass);
    323 #endif
    324                 szCaption = (WCHAR *)((int)szCaption + UniStrlen(szCaption)*2 + sizeof(WORD));
    325         }
    326 
    327 //      cout << "Extra Stuff WORD      : " << *(WORD *)(szCaption) << endl;
    328         ctrldata = (ControlData *)((int)szCaption + sizeof(WORD));
    329         ctrldata = (ControlData *)(((int)ctrldata+3) & ~3);
    330         dlgitem++;
     248   //save as OS/2 DLGTITEM
     249   dlgitem->x             = ctrldata->x;
     250   //SvL: 3-8-'97
     251   // OS/2  -> left bottom == origin and y coordinate == left bottom origin control
     252   // Win32 -> left top    == origin and y coordinate == left top origin
     253   dlgitem->y             = dlgt->adlgti[0].cy - ctrldata->y - ctrldata->cy;
     254   dlgitem->cx            = ctrldata->cx;
     255   dlgitem->cy            = ctrldata->cy;
     256   dlgitem->id            = ctrldata->wId;
     257   dlgitem->offCtlData    = 0xFFFF;
     258   dlgitem->offPresParams = 0xFFFF;
     259
     260   //TODO: Extended style
     261
     262#ifdef DEBUG
     263   WriteLog("***** Control Style   : %X\n", ctrldata->lStyle);
     264   WriteLog("Extended Control Style: %X\n", ctrldata->lExtendedStyle);
     265   WriteLog("Position              : (%d,%d)\n", ctrldata->x, ctrldata->y);
     266   WriteLog("Size                  : (%d,%d)\n", ctrldata->cx, ctrldata->cy);
     267   WriteLog("wID                   : %d\n", ctrldata->wId);
     268#endif
     269   winclass = 0;
     270   if(ctrldata->fClassId == 0xFFFF) {
     271      winclass = *(WORD *)(ctrldata+1);
     272#ifdef DEBUG
     273      WriteLog("Class ID              : %d\n", winclass);
     274#endif
     275      szCaption = (WCHAR *)((int)ctrldata + sizeof(ControlData) + sizeof(WORD));
     276      dlgitem->flStyle      = ConvertClassAndStyle(winclass, ctrldata->lStyle, &dlgitem->offClassName, &fIconBmp);
     277      dlgitem->cchClassName = 0;
     278   }
     279   else {
     280      szClass = UnicodeToAsciiString((WCHAR *)&ctrldata->fClassId);
     281#ifdef DEBUG
     282      WriteLog("Class Name            : %s\n", szClass);
     283#endif
     284      szCaption = (WCHAR *)((int)ctrldata + sizeof(ControlData) + strlen(szClass)*2);
     285      dlgitem->cchClassName = strlen(szClass);
     286      dlgitem->offClassName = (USHORT)((int)dlgcurdata - (int)dlgt);
     287      strcpy((char *)dlgcurdata, szClass);
     288      //Open32 wants class name in upper case!
     289      UpCase((char *)dlgcurdata);
     290      dlgcurdata           += dlgitem->cchClassName + 1;   //include terminating 0 (just to be sure)
     291//TODO: SvL: Can they also be system classes?
     292//    dlgitem->flStyle      = ctrldata->lStyle;
     293      dlgitem->flStyle      = ConvertDlgItemStyle(ctrldata->lStyle) ;
     294      FreeAsciiString(szClass);
     295   }
     296   if(*(USHORT *)szCaption == 0xFFFF) {
     297      szCaption += 2;
     298   }
     299   else {   //Handle Caption
     300      ctrltext = UnicodeToAsciiString(szCaption);
     301      //SvL: (16-9-'97) Convert '&' chars to '~' (for some classes)
     302      ConvertCaption(winclass, ctrltext);
     303      if(fIconBmp == TRUE) {//control contains bitmap or icon
     304         dlgitem->offText = (USHORT)((int)dlgcurdata - (int)dlgt);
     305         int resid =  ConvertNameId(NULL, ctrltext);
     306         *(char *)dlgcurdata = '#';
     307         itoa(resid, (char *)dlgcurdata+1, 10);
     308         dlgitem->cchText = strlen((char *)dlgcurdata); //one USHORT for res id
     309         dlgcurdata      += dlgitem->cchText + 1; //include terminating 0 (just to be sure)
     310      }
     311      else {
     312         if(ctrltext[0] != 0) {
     313            dlgitem->cchText = strlen(ctrltext);
     314            dlgitem->offText = (USHORT)((int)dlgcurdata - (int)dlgt);
     315            strcpy((char *)dlgcurdata, ctrltext);
     316            dlgcurdata      += dlgitem->cchText + 1; //include terminating 0 (just to be sure)
     317         }
     318      }
     319#ifdef DEBUG
     320      szClass = UnicodeToAsciiString(szCaption);
     321      WriteLog("Text                  : %s\n", szClass);
     322      FreeAsciiString(szClass);
     323#endif
     324      szCaption = (WCHAR *)((int)szCaption + UniStrlen(szCaption)*2 + sizeof(WORD));
     325   }
     326
     327// cout << "Extra Stuff WORD      : " << *(WORD *)(szCaption) << endl;
     328   ctrldata = (ControlData *)((int)szCaption + sizeof(WORD));
     329   ctrldata = (ControlData *)(((int)ctrldata+3) & ~3);
     330   dlgitem++;
    331331  }
    332332  //calculate dialog box length
     
    342342 PRESPARAMS  *dlgpparam;
    343343 char        *dlgdata, *dlgcurdata;
    344  WCHAR       *szCaption;
     344 WCHAR        *szCaption;
    345345 WORD        *ptrArray;
    346346 char        *ctrltext, *szClass, *font;
     
    351351 BOOL         fIconBmp;
    352352
    353   //should be enough 
     353  //should be enough
    354354  size    = dhdr->NumberOfItems*sizeof(DLGTITEM) * 128;
    355355  dlgt    = (DLGTEMPLATE *)malloc(sizeof(DLGTEMPLATE) + dhdr->NumberOfItems*sizeof(DLGTITEM) + size);
     
    359359  dlgcurdata = dlgdata;
    360360
    361   dlgt->codepage         = 437;
    362   dlgt->offadlgti        = 14;
     361  dlgt->codepage                         = 437;
     362  dlgt->offadlgti                        = 14;
    363363  dlgt->fsTemplateStatus = 1;
    364364  dlgt->iItemFocus       = 65535;
     
    370370  ctrlflag = 0;
    371371  if((dhdr->lStyle & WINWS_CAPTION) == WINWS_CAPTION) {
    372         ctrlflag |= FCF_TITLEBAR;
    373         dlgitem->flStyle |= FS_BORDER;
     372   ctrlflag |= FCF_TITLEBAR;
     373   dlgitem->flStyle |= FS_BORDER;
    374374  }
    375375  else
    376   if(dhdr->lStyle & WINWS_DLGFRAME)     //can't have title bar
    377         dlgitem->flStyle |= FS_DLGBORDER;
     376  if(dhdr->lStyle & WINWS_DLGFRAME)      //can't have title bar
     377   dlgitem->flStyle |= FS_DLGBORDER;
    378378
    379379  if((dhdr->lStyle & (WINWS_SYSMENU | WINWS_CAPTION)) == (WINWS_SYSMENU | WINWS_CAPTION))
    380         ctrlflag |= FCF_SYSMENU;
     380   ctrlflag |= FCF_SYSMENU;
    381381  if(dhdr->lStyle & WINWS_VSCROLL)
    382         ctrlflag |= FCF_VERTSCROLL;
     382   ctrlflag |= FCF_VERTSCROLL;
    383383  if(dhdr->lStyle & WINWS_HSCROLL)
    384         ctrlflag |= FCF_HORZSCROLL;
     384   ctrlflag |= FCF_HORZSCROLL;
    385385  if(dhdr->lStyle & WINWS_MINIMIZEBOX)
    386         ctrlflag |= FCF_MINBUTTON;
     386   ctrlflag |= FCF_MINBUTTON;
    387387  if(dhdr->lStyle & WINWS_MAXIMIZEBOX)
    388         ctrlflag |= FCF_MAXBUTTON;
     388   ctrlflag |= FCF_MAXBUTTON;
    389389  if(dhdr->lStyle & WINWS_THICKFRAME)
    390         dlgitem->flStyle |= FS_SIZEBORDER;
     390   dlgitem->flStyle |= FS_SIZEBORDER;
    391391
    392392  if(ctrlflag) {
    393         *(ULONG *)dlgcurdata = ctrlflag;
    394         dlgitem->offCtlData  = (USHORT)((int)dlgcurdata - (int)dlgt);
    395         dlgcurdata          += sizeof(ULONG);
     393   *(ULONG *)dlgcurdata = ctrlflag;
     394   dlgitem->offCtlData  = (USHORT)((int)dlgcurdata - (int)dlgt);
     395   dlgcurdata          += sizeof(ULONG);
    396396  }
    397397  else  dlgitem->offCtlData  = 0xFFFF;
    398   dlgitem->x            = dhdr->x;
    399   dlgitem->y            = dhdr->y;
    400   dlgitem->cx           = dhdr->cx;
    401   dlgitem->cy           = dhdr->cy;
     398  dlgitem->x           = dhdr->x;
     399  dlgitem->y           = dhdr->y;
     400  dlgitem->cx          = dhdr->cx;
     401  dlgitem->cy          = dhdr->cy;
    402402  dlgitem->cChildren    = dhdr->NumberOfItems;
    403   dlgitem->id           = (USHORT)0;            //ord id or converted name id
     403  dlgitem->id           = (USHORT)0;        //ord id or converted name id
    404404  dlgitem->fsItemStatus = 1;
    405   dlgitem->offClassName = 1;    //WC_FRAME
     405  dlgitem->offClassName = 1;             //WC_FRAME
    406406
    407407#ifdef DEBUG
     
    416416  if(dhdr->fNameOrd == 0xFFFF) {
    417417#ifdef DEBUG
    418         WriteLog("Menu ID            : %d\n", (int)*(WORD *)(dhdr+1));
    419 #endif
    420         ptrArray = (WORD *)((int)dhdr + sizeof(WINDLGTEMPLATEEX) + sizeof(WORD));
     418   WriteLog("Menu ID            : %d\n", (int)*(WORD *)(dhdr+1));
     419#endif
     420   ptrArray = (WORD *)((int)dhdr + sizeof(WINDLGTEMPLATEEX) + sizeof(WORD));
    421421  }
    422422  else {
    423         if(dhdr->fNameOrd == 0) {//SvL: 0 == no menu!
    424                 ptrArray = (WORD *)((int)dhdr + sizeof(WINDLGTEMPLATEEX));
    425         }
    426         else {
    427 #ifdef DEBUG
    428                 ctrltext = UnicodeToAsciiString((WCHAR *)&dhdr->fNameOrd);
    429                 WriteLog("Menu namestring    : %s\n", ctrltext);
    430                 FreeAsciiString(ctrltext);
    431 #endif
    432                 ptrArray = (WORD *)((int)&dhdr->fNameOrd + UniStrlen((WCHAR *)(&dhdr->fNameOrd))*2 + sizeof(WCHAR));
    433         }
     423   if(dhdr->fNameOrd == 0) {//SvL: 0 == no menu!
     424      ptrArray = (WORD *)((int)dhdr + sizeof(WINDLGTEMPLATEEX));
     425   }
     426   else {
     427#ifdef DEBUG
     428      ctrltext = UnicodeToAsciiString((WCHAR *)&dhdr->fNameOrd);
     429      WriteLog("Menu namestring    : %s\n", ctrltext);
     430      FreeAsciiString(ctrltext);
     431#endif
     432      ptrArray = (WORD *)((int)&dhdr->fNameOrd + UniStrlen((WCHAR *)(&dhdr->fNameOrd))*2 + sizeof(WCHAR));
     433   }
    434434  }
    435435  //Class id
    436436  if(*ptrArray == 0xFFFF) {
    437437#ifdef DEBUG
    438         WriteLog("Class ID           : %d\n", (int)*(WORD *)(ptrArray+1));
    439 #endif
    440         ptrArray = (WORD *)((int)ptrArray + 2*sizeof(WORD));
     438   WriteLog("Class ID           : %d\n", (int)*(WORD *)(ptrArray+1));
     439#endif
     440   ptrArray = (WORD *)((int)ptrArray + 2*sizeof(WORD));
    441441  }
    442442  else {
    443         if(*ptrArray == 0) {//SvL: 0 == no class!
    444                 ptrArray = (WORD *)((int)ptrArray + sizeof(WORD));
    445         }
    446         else {
    447                 szClass = UnicodeToAsciiString((WCHAR *)ptrArray);
    448 #ifdef DEBUG
    449                 WriteLog("Class namestring    : %s\n", szClass);
    450 #endif
    451 //              cout << "Class Name            : " << szClass << endl;
     443   if(*ptrArray == 0) {//SvL: 0 == no class!
     444      ptrArray = (WORD *)((int)ptrArray + sizeof(WORD));
     445   }
     446   else {
     447      szClass = UnicodeToAsciiString((WCHAR *)ptrArray);
     448#ifdef DEBUG
     449      WriteLog("Class namestring    : %s\n", szClass);
     450#endif
     451//    cout << "Class Name            : " << szClass << endl;
    452452#if 1
    453                 dlgitem->cchClassName = strlen(szClass);
    454                 dlgitem->offClassName = (USHORT)((int)dlgcurdata - (int)dlgt);
    455                 strcpy((char *)dlgcurdata, szClass);
    456                 //Open32 wants class name in upper case!
    457                 UpCase((char *)dlgcurdata);
    458                 dlgcurdata           += dlgitem->cchClassName + 1;      //include terminating 0 (just to be sure)
    459 //TODO: SvL: Can they also be system classes? 
    460 //              dlgitem->flStyle      = dhdr->lStyle;
    461 //              dlgitem->flStyle      = ConvertDlgItemStyle(dhdr->lStyle);
    462 #endif
    463                 ptrArray = (WORD *)((int)ptrArray + UniStrlen((WCHAR *)(ptrArray))*2 + sizeof(WORD));
    464                 FreeAsciiString(szClass);
    465         }
     453      dlgitem->cchClassName = strlen(szClass);
     454      dlgitem->offClassName = (USHORT)((int)dlgcurdata - (int)dlgt);
     455      strcpy((char *)dlgcurdata, szClass);
     456      //Open32 wants class name in upper case!
     457      UpCase((char *)dlgcurdata);
     458      dlgcurdata           += dlgitem->cchClassName + 1;   //include terminating 0 (just to be sure)
     459//TODO: SvL: Can they also be system classes?
     460//    dlgitem->flStyle      = dhdr->lStyle;
     461//    dlgitem->flStyle      = ConvertDlgItemStyle(dhdr->lStyle);
     462#endif
     463      ptrArray = (WORD *)((int)ptrArray + UniStrlen((WCHAR *)(ptrArray))*2 + sizeof(WORD));
     464      FreeAsciiString(szClass);
     465   }
    466466  }
    467467
     
    469469  if(*ptrArray == 0) {
    470470#ifdef DEBUG
    471         WriteLog("No title\n");
    472 #endif
    473         ctrldata = (WINDLGITEMTEMPLATEEX *)((int)(int)ptrArray + sizeof(WORD));
     471   WriteLog("No title\n");
     472#endif
     473   ctrldata = (WINDLGITEMTEMPLATEEX *)((int)(int)ptrArray + sizeof(WORD));
    474474  }
    475475  else {
    476         ctrltext = UnicodeToAsciiString((WCHAR *)(ptrArray));
    477 #ifdef DEBUG
    478         WriteLog("Title                : %s\n", ctrltext);
    479 #endif
    480         ctrldata = (WINDLGITEMTEMPLATEEX *)((int)(int)ptrArray + UniStrlen((WCHAR *)(ptrArray))*2 + sizeof(WORD));
    481 
    482         if(ctrltext[0] != 0) {
    483                 dlgitem->cchText = strlen(ctrltext);
    484                 dlgitem->offText = (USHORT)((int)dlgcurdata - (int)dlgt);
    485                 strcpy((char *)dlgcurdata, ctrltext);
    486                 dlgcurdata      += dlgitem->cchText + 1;        //include terminating 0 (just to be sure)
    487         }
    488         FreeAsciiString(ctrltext);
     476   ctrltext = UnicodeToAsciiString((WCHAR *)(ptrArray));
     477#ifdef DEBUG
     478   WriteLog("Title                : %s\n", ctrltext);
     479#endif
     480   ctrldata = (WINDLGITEMTEMPLATEEX *)((int)(int)ptrArray + UniStrlen((WCHAR *)(ptrArray))*2 + sizeof(WORD));
     481
     482   if(ctrltext[0] != 0) {
     483      dlgitem->cchText = strlen(ctrltext);
     484      dlgitem->offText = (USHORT)((int)dlgcurdata - (int)dlgt);
     485      strcpy((char *)dlgcurdata, ctrltext);
     486      dlgcurdata      += dlgitem->cchText + 1; //include terminating 0 (just to be sure)
     487   }
     488   FreeAsciiString(ctrltext);
    489489  }
    490490  dlgitem++;
    491491
    492492  if(dhdr->lStyle & DS_SETFONT) {
    493         fhdr = (FontHeaderEx *)ctrldata;
    494         font = UnicodeToAsciiString(fhdr->szFontName);
    495 #ifdef DEBUG
    496         WriteLog("Font Point Size      : %d\n", fhdr->wPointSize);
    497         WriteLog("Font Name            : %s\n", font);
     493   fhdr = (FontHeaderEx *)ctrldata;
     494   font = UnicodeToAsciiString(fhdr->szFontName);
     495#ifdef DEBUG
     496   WriteLog("Font Point Size      : %d\n", fhdr->wPointSize);
     497   WriteLog("Font Name            : %s\n", font);
    498498#endif
    499499        ctrldata = (WINDLGITEMTEMPLATEEX *)((int)fhdr + sizeof(FontHeaderEx) - 2 + UniStrlen(fhdr->szFontName)*2 + sizeof(WORD));  /*PLF Sat  97-06-21 20:22:44*/
    500500        //TODO: no pres params yet (font in win32 dialog ignored)
    501         dlgpparam = (PRESPARAMS *)dlgcurdata;
    502         dlgpparam->cb = 0;
    503         dlgpparam->aparam[0].id = PP_FONTNAMESIZE;
    504         dlgpparam->aparam[0].cb = 0;
    505         UpCase(font);
    506         if(ConvertFont(font, dlgpparam, fhdr->wPointSize) == TRUE) {
    507                 dlgpparam->cb           = sizeof(PARAM) + dlgpparam->aparam[0].cb - 1;
    508                 dlgpparam->aparam[0].cb = strlen(dlgpparam->aparam[0].ab) + 1;
    509                 dlgt->coffPresParams    = (int)dlgpparam;
    510                 dlgcurdata += sizeof(PRESPARAMS) + dlgpparam->aparam[0].cb - 1;
    511         }
    512         FreeAsciiString(font);
     501   dlgpparam = (PRESPARAMS *)dlgcurdata;
     502   dlgpparam->cb = 0;
     503   dlgpparam->aparam[0].id = PP_FONTNAMESIZE;
     504   dlgpparam->aparam[0].cb = 0;
     505   UpCase(font);
     506   if(ConvertFont(font, dlgpparam, fhdr->wPointSize) == TRUE) {
     507      dlgpparam->cb           = sizeof(PARAM) + dlgpparam->aparam[0].cb - 1;
     508      dlgpparam->aparam[0].cb = strlen(dlgpparam->aparam[0].ab) + 1;
     509      dlgt->coffPresParams    = (int)dlgpparam;
     510      dlgcurdata += sizeof(PRESPARAMS) + dlgpparam->aparam[0].cb - 1;
     511   }
     512   FreeAsciiString(font);
    513513  }
    514514  ctrldata = (WINDLGITEMTEMPLATEEX *)(((int)ctrldata+3) & ~3);
    515515
    516516  for(i=0;i<dhdr->NumberOfItems;i++) {
    517         //save as OS/2 DLGTITEM
    518         dlgitem->x             = ctrldata->x;
    519         //SvL: 3-8-'97
    520         // OS/2  -> left bottom == origin and y coordinate == left bottom origin control
    521         // Win32 -> left top    == origin and y coordinate == left top origin
    522         dlgitem->y             = dlgt->adlgti[0].cy - ctrldata->y - ctrldata->cy;
    523         dlgitem->cx            = ctrldata->cx;
    524         dlgitem->cy            = ctrldata->cy;
    525         dlgitem->id            = ctrldata->wId;
    526         dlgitem->offCtlData    = 0xFFFF;
    527         dlgitem->offPresParams = 0xFFFF;
    528 
    529         //TODO: Extended style
    530 #ifdef DEBUG
    531         WriteLog("***** Control Style   : %X\n", ctrldata->lStyle);
    532         WriteLog("Extended Control Style: %X\n", ctrldata->lExtendedStyle);
    533         WriteLog("Position              : (%d,%d)\n", ctrldata->x, ctrldata->y);
    534         WriteLog("Size                  : (%d,%d)\n", ctrldata->cx, ctrldata->cy);
    535         WriteLog("wID                   : %d\n", ctrldata->wId);
    536 #endif
    537         winclass = 0;
    538         if(ctrldata->fClassId == 0xFFFF) {
    539                 winclass = *(WORD *)(ctrldata+1);
    540 #ifdef DEBUG
    541                 WriteLog("Class ID              : %d\n", winclass);
    542 #endif
    543                 szCaption = (WCHAR *)((int)ctrldata + sizeof(WINDLGITEMTEMPLATEEX) + sizeof(WORD));
    544                 dlgitem->flStyle      = ConvertClassAndStyle(*(WORD *)(ctrldata+1), ctrldata->lStyle, &dlgitem->offClassName, &fIconBmp);
    545                 dlgitem->cchClassName = 0;
    546         }
    547         else {
    548                 szClass = UnicodeToAsciiString((WCHAR *)&ctrldata->fClassId);
    549 #ifdef DEBUG
    550                 WriteLog("Class Name            : %s\n", szClass);
    551 #endif
    552                 szCaption = (WCHAR *)((int)ctrldata + sizeof(WINDLGITEMTEMPLATEEX) + strlen(szClass)*2);
    553                 dlgitem->cchClassName = strlen(szClass);
    554                 dlgitem->offClassName = (USHORT)((int)dlgcurdata - (int)dlgt);
    555                 strcpy((char *)dlgcurdata, szClass);
    556                 //Open32 wants class name in upper case!
    557                 UpCase((char *)dlgcurdata);
    558                 dlgcurdata           += dlgitem->cchClassName + 1;      //include terminating 0 (just to be sure)
    559 //TODO: SvL: Can they also be system classes? 
    560 //              dlgitem->flStyle      = ctrldata->lStyle;
    561                 dlgitem->flStyle      = ConvertDlgItemStyle(ctrldata->lStyle) ;
    562                 FreeAsciiString(szClass);
    563         }       
    564         if(*(USHORT *)szCaption == 0xFFFF) {
    565                 szCaption += 2;
    566         }
    567         else {  //Handle Caption
    568                 ctrltext = UnicodeToAsciiString(szCaption);
    569                 //SvL: (16-9-'97) Convert '&' chars to '~' (for some classes)
    570                 ConvertCaption(winclass, ctrltext);
    571                 if(fIconBmp == TRUE) {//control contains bitmap or icon
    572                         dlgitem->offText = (USHORT)((int)dlgcurdata - (int)dlgt);
    573                         int resid =  ConvertNameId(NULL, ctrltext);
    574                         *(char *)dlgcurdata = '#';
    575                         itoa(resid, (char *)dlgcurdata+1, 10);
    576                         dlgitem->cchText = strlen((char *)dlgcurdata);  //one USHORT for res id
    577                         dlgcurdata      += dlgitem->cchText + 1;        //include terminating 0 (just to be sure)
    578                 }
    579                 else {
    580                         if(ctrltext[0] != 0) {
    581                                 dlgitem->cchText = strlen(ctrltext);
    582                                 dlgitem->offText = (USHORT)((int)dlgcurdata - (int)dlgt);
    583                                 strcpy((char *)dlgcurdata, ctrltext);
    584                                 dlgcurdata      += dlgitem->cchText + 1;        //include terminating 0 (just to be sure)
    585                         }
    586                 }
    587 #ifdef DEBUG
    588                 szClass = UnicodeToAsciiString(szCaption);
    589                 WriteLog("Text                  : %s\n", szClass);
    590                 FreeAsciiString(szClass);
    591 #endif
    592                 szCaption = (WCHAR *)((int)szCaption + UniStrlen(szCaption)*2 + sizeof(WORD));
    593         }
    594 
    595 //      cout << "Extra Stuff WORD      : " << *(WORD *)(szCaption) << endl;
    596         ctrldata = (WINDLGITEMTEMPLATEEX *)((int)szCaption + sizeof(WORD));
    597         ctrldata = (WINDLGITEMTEMPLATEEX *)(((int)ctrldata+3) & ~3);
    598         dlgitem++;
     517   //save as OS/2 DLGTITEM
     518   dlgitem->x             = ctrldata->x;
     519   //SvL: 3-8-'97
     520   // OS/2  -> left bottom == origin and y coordinate == left bottom origin control
     521   // Win32 -> left top    == origin and y coordinate == left top origin
     522   dlgitem->y             = dlgt->adlgti[0].cy - ctrldata->y - ctrldata->cy;
     523   dlgitem->cx            = ctrldata->cx;
     524   dlgitem->cy            = ctrldata->cy;
     525   dlgitem->id            = ctrldata->wId;
     526   dlgitem->offCtlData    = 0xFFFF;
     527   dlgitem->offPresParams = 0xFFFF;
     528
     529   //TODO: Extended style
     530#ifdef DEBUG
     531   WriteLog("***** Control Style   : %X\n", ctrldata->lStyle);
     532   WriteLog("Extended Control Style: %X\n", ctrldata->lExtendedStyle);
     533   WriteLog("Position              : (%d,%d)\n", ctrldata->x, ctrldata->y);
     534   WriteLog("Size                  : (%d,%d)\n", ctrldata->cx, ctrldata->cy);
     535   WriteLog("wID                   : %d\n", ctrldata->wId);
     536#endif
     537   winclass = 0;
     538   if(ctrldata->fClassId == 0xFFFF) {
     539      winclass = *(WORD *)(ctrldata+1);
     540#ifdef DEBUG
     541      WriteLog("Class ID              : %d\n", winclass);
     542#endif
     543      szCaption = (WCHAR *)((int)ctrldata + sizeof(WINDLGITEMTEMPLATEEX) + sizeof(WORD));
     544      dlgitem->flStyle      = ConvertClassAndStyle(*(WORD *)(ctrldata+1), ctrldata->lStyle, &dlgitem->offClassName, &fIconBmp);
     545      dlgitem->cchClassName = 0;
     546   }
     547   else {
     548      szClass = UnicodeToAsciiString((WCHAR *)&ctrldata->fClassId);
     549#ifdef DEBUG
     550      WriteLog("Class Name            : %s\n", szClass);
     551#endif
     552      szCaption = (WCHAR *)((int)ctrldata + sizeof(WINDLGITEMTEMPLATEEX) + strlen(szClass)*2);
     553      dlgitem->cchClassName = strlen(szClass);
     554      dlgitem->offClassName = (USHORT)((int)dlgcurdata - (int)dlgt);
     555      strcpy((char *)dlgcurdata, szClass);
     556      //Open32 wants class name in upper case!
     557      UpCase((char *)dlgcurdata);
     558      dlgcurdata           += dlgitem->cchClassName + 1;   //include terminating 0 (just to be sure)
     559//TODO: SvL: Can they also be system classes?
     560//    dlgitem->flStyle      = ctrldata->lStyle;
     561      dlgitem->flStyle      = ConvertDlgItemStyle(ctrldata->lStyle) ;
     562      FreeAsciiString(szClass);
     563   }
     564   if(*(USHORT *)szCaption == 0xFFFF) {
     565      szCaption += 2;
     566   }
     567   else {   //Handle Caption
     568      ctrltext = UnicodeToAsciiString(szCaption);
     569      //SvL: (16-9-'97) Convert '&' chars to '~' (for some classes)
     570      ConvertCaption(winclass, ctrltext);
     571      if(fIconBmp == TRUE) {//control contains bitmap or icon
     572         dlgitem->offText = (USHORT)((int)dlgcurdata - (int)dlgt);
     573         int resid =  ConvertNameId(NULL, ctrltext);
     574         *(char *)dlgcurdata = '#';
     575         itoa(resid, (char *)dlgcurdata+1, 10);
     576         dlgitem->cchText = strlen((char *)dlgcurdata); //one USHORT for res id
     577         dlgcurdata      += dlgitem->cchText + 1; //include terminating 0 (just to be sure)
     578      }
     579      else {
     580         if(ctrltext[0] != 0) {
     581            dlgitem->cchText = strlen(ctrltext);
     582            dlgitem->offText = (USHORT)((int)dlgcurdata - (int)dlgt);
     583            strcpy((char *)dlgcurdata, ctrltext);
     584            dlgcurdata      += dlgitem->cchText + 1; //include terminating 0 (just to be sure)
     585         }
     586      }
     587#ifdef DEBUG
     588      szClass = UnicodeToAsciiString(szCaption);
     589      WriteLog("Text                  : %s\n", szClass);
     590      FreeAsciiString(szClass);
     591#endif
     592      szCaption = (WCHAR *)((int)szCaption + UniStrlen(szCaption)*2 + sizeof(WORD));
     593   }
     594
     595// cout << "Extra Stuff WORD      : " << *(WORD *)(szCaption) << endl;
     596   ctrldata = (WINDLGITEMTEMPLATEEX *)((int)szCaption + sizeof(WORD));
     597   ctrldata = (WINDLGITEMTEMPLATEEX *)(((int)ctrldata+3) & ~3);
     598   dlgitem++;
    599599  }
    600600  //calculate dialog box length
     
    612612
    613613  switch(winclass) {
    614         case WIN_BUTTON:
     614   case WIN_BUTTON:
    615615#if 0
    616                 if(style & WINBS_LEFTTEXT)
    617                         os2style |= ;
    618 #endif
    619                 style &= 0xF;
     616      if(style & WINBS_LEFTTEXT)
     617         os2style |= ;
     618#endif
     619      style &= 0xF;
    620620//BS_TEXT, BS_BITMAP, BS_ICON, BS_MINIICON can only be used with BS_PUSHBUTTON
    621                 *os2class = (int)WC_BUTTON & 0xFFFF;
    622                 if(style == WINBS_PUSHBUTTON)
    623                         os2style |= BS_PUSHBUTTON;
    624                 else
    625                 if(style == WINBS_DEFPUSHBUTTON)
    626                         os2style |= (BS_PUSHBUTTON | BS_DEFAULT);       //TODO: Correct?
    627                 else
    628                 if(style == WINBS_CHECKBOX)
    629                         os2style |= BS_CHECKBOX;
    630                 else
    631                 if(style == WINBS_AUTOCHECKBOX)
    632                         os2style |= BS_AUTOCHECKBOX;
    633                 else
    634                 if(style == WINBS_RADIOBUTTON)
    635                         os2style |= BS_RADIOBUTTON;
    636                 else
    637                 if(style == WINBS_3STATE)
    638                         os2style |= BS_3STATE;
    639                 else
    640                 if(style == WINBS_AUTO3STATE)
    641                         os2style |= BS_AUTO3STATE;
    642                 else
    643                 if(style == WINBS_USERBUTTON) //obsolete
    644                         os2style |= BS_USERBUTTON;
    645                 else
    646                 if(style == WINBS_AUTORADIOBUTTON)
    647                         os2style |= BS_AUTORADIOBUTTON;
    648                 else
    649                 if(style == WINBS_GROUPBOX) {
    650                          *os2class = (int)WC_STATIC & 0xFFFF;    /*PLF Sat  97-09-20 23:58:28*/
    651                          os2style  |= SS_GROUPBOX;   /*PLF Sun  97-09-21 00:11:07*/
    652                 }
    653                 else   
    654                 if(style & WINBS_OWNERDRAW)
    655                         os2style |= BS_USERBUTTON;      //TODO:Correct??
    656                 else    os2style |= (BS_TEXT | BS_PUSHBUTTON);
    657                 os2style |= BS_AUTOSIZE;
    658                 break;
    659         case WIN_EDIT:
    660                 *os2class = (int)WC_ENTRYFIELD & 0xFFFF;
    661                 if(style & WINES_LEFT)
    662                         os2style |= ES_LEFT;           
    663                 if(style & WINES_CENTER)
    664                         os2style |= ES_CENTER;
    665                 if(style & WINES_RIGHT)
    666                         os2style |= ES_RIGHT;
    667 #if 0
    668                 if(style & WINES_MULTILINE)
    669                         os2style |= ;
    670                 if(style & WINES_UPPERCASE)
    671                         os2style |= ;
    672                 if(style & WINES_LOWERCASE)
    673                         os2style |= ;
    674 #endif
    675                 if(style & WINES_PASSWORD)
    676                         os2style |= ES_UNREADABLE;
    677 #if 0
    678                 if(style & WINES_AUTOVSCROLL)
    679                         os2style |= ;
    680                 if(style & WINES_AUTOHSCROLL)
    681                         os2style |= ES_AUTOSCROLL;
    682                 if(style & WINES_NOHIDESEL)
    683                         os2style |= ;
    684                 if(style & WINES_OEMCONVERT)
    685                         os2style |= ;
    686 #endif
    687                 if(style & WINES_READONLY)
    688                         os2style |= ES_READONLY;
    689 #if 0
    690                 if(style & WINES_WANTRETURN)
    691                         os2style |= ;
    692 #endif
    693                 break;
    694         case WIN_STATIC:
    695                 *os2class = (int)WC_STATIC & 0xFFFF;
    696                 if(style == WINSS_LEFT)
    697                         os2style |= SS_TEXT | DT_LEFT;
    698                 else
    699                 if(style == WINSS_CENTER)
    700                         os2style |= SS_TEXT | DT_CENTER;
    701                 else
    702                 if(style == WINSS_RIGHT)
    703                         os2style |= SS_TEXT | DT_RIGHT;
    704                 else
    705                 if(style == WINSS_SIMPLE)
    706                         os2style |= SS_TEXT | DT_LEFT;
    707                 else
    708                 if(style == WINSS_ICON) {
    709                         os2style |= SS_ICON;
    710                         *fIconBmp = TRUE;
    711                 }
    712                 else
    713                 if(style == WINSS_BLACKRECT)
    714                         os2style |= SS_FGNDRECT;
    715                 else
    716                 if(style == WINSS_GRAYRECT)
    717                         os2style |= SS_HALFTONERECT;
    718                 else
    719                 if(style == WINSS_WHITERECT)
    720                         os2style |= SS_BKGNDRECT;
    721                 else
    722                 if(style == WINSS_BLACKFRAME)
    723                         os2style |= SS_FGNDFRAME;
    724                 else
    725                 if(style == WINSS_GRAYFRAME)
    726                         os2style |= SS_HALFTONEFRAME;
    727                 else
    728                 if(style == WINSS_WHITEFRAME)
    729                         os2style |= SS_BKGNDFRAME;
    730                 else    os2style |= SS_TEXT;
     621      *os2class = (int)WC_BUTTON & 0xFFFF;
     622      if(style == WINBS_PUSHBUTTON)        os2style |= BS_PUSHBUTTON;
     623      else
     624      if(style == WINBS_DEFPUSHBUTTON)     os2style |= (BS_PUSHBUTTON | BS_DEFAULT);   //TODO: Correct?
     625      else
     626      if(style == WINBS_CHECKBOX)          os2style |= BS_CHECKBOX;
     627      else
     628      if(style == WINBS_AUTOCHECKBOX)      os2style |= BS_AUTOCHECKBOX;
     629      else
     630      if(style == WINBS_RADIOBUTTON)       os2style |= BS_RADIOBUTTON;
     631      else
     632      if(style == WINBS_3STATE)            os2style |= BS_3STATE;
     633      else
     634      if(style == WINBS_AUTO3STATE)        os2style |= BS_AUTO3STATE;
     635      else
     636      if(style == WINBS_USERBUTTON)        os2style |= BS_USERBUTTON; //obsolete
     637      else
     638      if(style == WINBS_AUTORADIOBUTTON)   os2style |= BS_AUTORADIOBUTTON;
     639      else
     640      if(style == WINBS_GROUPBOX)
     641      {
     642         *os2class = (int)WC_STATIC & 0xFFFF;    /*PLF Sat  97-09-20 23:58:28*/
     643         os2style  |= SS_GROUPBOX;   /*PLF Sun  97-09-21 00:11:07*/
     644      }
     645      else
     646      if(style & WINBS_OWNERDRAW)          os2style |= BS_USERBUTTON;      //TODO:Correct??
     647      else
     648        os2style |= (BS_TEXT | BS_PUSHBUTTON);
     649
     650      os2style |= BS_AUTOSIZE;
     651      break;
     652
     653   /***
     654    * Edit Control
     655    ***/
     656   case WIN_EDIT:
     657      if (style & WINES_MULTILINE)
     658      {
     659        *os2class = (int)WC_MLE & 0xFFFF;
     660  //    if(style & WINES_LEFT)        os2style |= ;
     661  //    if(style & WINES_CENTER)      os2style |= ;
     662  //    if(style & WINES_RIGHT)       os2style |= ;
     663  //    if(style & WINES_UPPERCASE)   os2style |= ;
     664  //    if(style & WINES_LOWERCASE)   os2style |= ;
     665  //    if(style & WINES_PASSWORD)    os2style |= ;
     666  //    if(style & WINES_AUTOVSCROLL) os2style |= ;
     667  //    if(style & WINES_AUTOHSCROLL) os2style |= ; // @@@PH: experiment
     668  //    if(style & WINES_NOHIDESEL)   os2style |= ;
     669  //    if(style & WINES_OEMCONVERT)  os2style |= ;
     670        if(style & WINES_READONLY)    os2style |= MLS_READONLY;
     671  //    if(style & WINES_WANTRETURN)  os2style |= ;
     672  //    if(style & WINES_NUMBER)      os2style |= ;
     673        if(style & WINWS_BORDER)      os2style |= MLS_BORDER;   // @@@PH: experiment
     674      }
     675      else
     676      {
     677        *os2class = (int)WC_ENTRYFIELD & 0xFFFF;
     678        if(style & WINES_LEFT)        os2style |= ES_LEFT;
     679        if(style & WINES_CENTER)      os2style |= ES_CENTER;
     680        if(style & WINES_RIGHT)       os2style |= ES_RIGHT;
     681  //    if(style & WINES_UPPERCASE)   os2style |= ;
     682  //    if(style & WINES_LOWERCASE)   os2style |= ;
     683        if(style & WINES_PASSWORD)    os2style |= ES_UNREADABLE;
     684  //    if(style & WINES_AUTOVSCROLL) os2style |= ;
     685        if(style & WINES_AUTOHSCROLL) os2style |= ES_AUTOSCROLL; // @@@PH: experiment
     686  //    if(style & WINES_NOHIDESEL)   os2style |= ;
     687  //    if(style & WINES_OEMCONVERT)  os2style |= ;
     688        if(style & WINES_READONLY)    os2style |= ES_READONLY;
     689  //    if(style & WINES_WANTRETURN)  os2style |= ;
     690  //    if(style & WINES_NUMBER)      os2style |= ;
     691  //    if(style & WINWS_BORDER)      os2style |= ;
     692      }
     693      break;
     694
     695   case WIN_STATIC:
     696      *os2class = (int)WC_STATIC & 0xFFFF;
     697      if(style == WINSS_LEFT)                     os2style |= SS_TEXT | DT_LEFT;
     698      else
     699      if(style == WINSS_CENTER)                   os2style |= SS_TEXT | DT_CENTER;
     700      else
     701      if(style == WINSS_RIGHT)                    os2style |= SS_TEXT | DT_RIGHT;
     702      else
     703      if(style == WINSS_SIMPLE)                   os2style |= SS_TEXT | DT_LEFT;
     704      else
     705      if(style == WINSS_ICON)
     706      {
     707         os2style |= SS_ICON;
     708         *fIconBmp = TRUE;
     709      }
     710      else
     711      if(style == WINSS_BLACKRECT)               os2style |= SS_FGNDRECT;
     712      else
     713      if(style == WINSS_GRAYRECT)                os2style |= SS_HALFTONERECT;
     714      else
     715      if(style == WINSS_WHITERECT)               os2style |= SS_BKGNDRECT;
     716      else
     717      if(style == WINSS_BLACKFRAME)              os2style |= SS_FGNDFRAME;
     718      else
     719      if(style == WINSS_GRAYFRAME)               os2style |= SS_HALFTONEFRAME;
     720      else
     721      if(style == WINSS_WHITEFRAME)              os2style |= SS_BKGNDFRAME;
     722      else  os2style |= SS_TEXT;
    731723
    732724//TODO
    733 #if 0
    734                 if(style == WINSS_LEFTNOWORDWRAP)
    735                         os2style |= ;
    736                 if(style == WINSS_USERITEM)
    737                         os2style |= ;
    738                 if(style == WINSS_NOPREFIX)
    739                         os2style |= ;
    740 #endif
    741                 break;
    742         case WIN_LISTBOX:
    743                 *os2class = (int)WC_LISTBOX & 0xFFFF;
    744 #if 0
    745                 if(style & WINLBS_NOTIFY)
    746                         os2style |= ;
    747                 if(style & WINLBS_SORT)
    748                         os2style |= ;
    749                 if(style & WINLBS_NOREDRAW)
    750                         os2style |= ;
    751 #endif
    752                 if(style & WINLBS_MULTIPLESEL)
    753                         os2style |= LS_MULTIPLESEL;
    754                 if(style & WINLBS_OWNERDRAWFIXED)
    755                         os2style |= LS_OWNERDRAW;       //TODO: Correct?
    756                 if(style & WINLBS_OWNERDRAWVARIABLE)
    757                         os2style |= LS_OWNERDRAW;       //TODO: Correct?
    758 #if 0
    759                 if(style & WINLBS_HASSTRINGS)
    760                         os2style |= ;
    761                 if(style & WINLBS_USETABSTOPS)
    762                         os2style |= ;
    763                 if(style & WINLBS_NOINTEGRALHEIGHT)
    764                         os2style |= ;
    765                 if(style & WINLBS_MULTICOLUMN)
    766                         os2style |= ;
    767                 if(style & WINLBS_WANTKEYBOARDINPUT)
    768                         os2style |= ;
    769                 if(style & WINLBS_EXTENDEDSEL)
    770                         os2style |= LS_EXTENDEDSEL;
    771                 if(style & WINLBS_DISABLENOSCROLL)
    772                         os2style |= ;
    773 #endif
    774 //              if(style & WINLBS_NODATA)
    775 //                      os2style |= ;
    776                 break;
    777         case WIN_SCROLLBAR:
    778                 *os2class = (int)WC_SCROLLBAR & 0xFFFF;
    779                 if(style & WINSBS_HORZ)
    780                         os2style |= SBS_HORZ;
    781                 else
    782                 if(style & WINSBS_VERT)
    783                         os2style |= SBS_VERT;
    784 #if 0
    785                 if(style & WINSBS_TOPALIGN)
    786                         os2style |= ;
    787                 if(style & WINSBS_LEFTALIGN)
    788                         os2style |= ;
    789                 if(style & WINSBS_BOTTOMALIGN)
    790                         os2style |= ;
    791                 if(style & WINSBS_RIGHTALIGN)
    792                         os2style |= ;
    793                 if(style & WINSBS_SIZEBOXTOPLEFTALIGN)
    794                         os2style |= ;
    795                 if(style & WINSBS_SIZEBOXBOTTOMRIGHTALIGN)
    796                         os2style |= ;
    797 #endif
    798                 if(style & WINSBS_SIZEBOX)
    799                         os2style |= SBS_AUTOSIZE;       //TODO: Correct?
    800                 break;
    801         case WIN_COMBOBOX:
    802                 *os2class = (int)WC_COMBOBOX & 0xFFFF; 
    803                 if(style & WINCBS_SIMPLE)
    804                         os2style |= CBS_SIMPLE;
    805                 else
    806                 if(style & WINCBS_DROPDOWN)
    807                         os2style |= CBS_DROPDOWN;
    808                 else
    809                 if(style & WINCBS_DROPDOWNLIST)
    810                         os2style |= CBS_DROPDOWNLIST;
    811 #if 0
    812                 if(style & WINCBS_OWNERDRAWFIXED)
    813                         os2style |= ;
    814                 if(style & WINCBS_OWNERDRAWVARIABLE)
    815                         os2style |= ;
    816                 if(style & WINCBS_AUTOHSCROLL)
    817                         os2style |= ;
    818                 if(style & WINCBS_OEMCONVERT)
    819                         os2style |= ;
    820                 if(style & WINCBS_SORT)
    821                         os2style |= ;
    822                 if(style & WINCBS_HASSTRINGS)
    823                         os2style |= ;
    824                 if(style & WINCBS_NOINTEGRALHEIGHT)
    825                         os2style |= ;
    826                 if(style & WINCBS_DISABLENOSCROLL)
    827                         os2style |= ;
    828 #endif
    829                 break;
    830         default:
    831                 //SvL:9nov97 Special class control. Just copy style
    832                 os2style = style;
    833                 break;
     725//    if(style == WINSS_LEFTNOWORDWRAP)          os2style |= ;
     726//    if(style == WINSS_USERITEM)                os2style |= ;
     727//    if(style == WINSS_NOPREFIX)                os2style |= ;
     728      break;
     729
     730   case WIN_LISTBOX:
     731      *os2class = (int)WC_LISTBOX & 0xFFFF;
     732//    if(style & WINLBS_NOTIFY)                  os2style |= ;
     733//    if(style & WINLBS_SORT)                    os2style |= ;
     734//    if(style & WINLBS_NOREDRAW)                os2style |= ;
     735      if(style & WINLBS_MULTIPLESEL)             os2style |= LS_MULTIPLESEL;
     736      if(style & WINLBS_OWNERDRAWFIXED)          os2style |= LS_OWNERDRAW;       //TODO: Correct?
     737      if(style & WINLBS_OWNERDRAWVARIABLE)       os2style |= LS_OWNERDRAW;       //TODO: Correct?
     738//    if(style & WINLBS_HASSTRINGS)              os2style |= ;
     739//    if(style & WINLBS_USETABSTOPS)             os2style |= ;
     740//    if(style & WINLBS_NOINTEGRALHEIGHT)        os2style |= ;
     741//    if(style & WINLBS_MULTICOLUMN)             os2style |= ;
     742//    if(style & WINLBS_WANTKEYBOARDINPUT)       os2style |= ;
     743//    if(style & WINLBS_EXTENDEDSEL)             os2style |= LS_EXTENDEDSEL;
     744//    if(style & WINLBS_DISABLENOSCROLL)         os2style |= ;
     745//    if(style & WINLBS_NODATA)                  os2style |= ;
     746      break;
     747
     748   case WIN_SCROLLBAR:
     749      *os2class = (int)WC_SCROLLBAR & 0xFFFF;
     750      if(style & WINSBS_HORZ)                    os2style |= SBS_HORZ;
     751      else
     752      if(style & WINSBS_VERT)                    os2style |= SBS_VERT;
     753
     754//    if(style & WINSBS_TOPALIGN)                os2style |= ;
     755//    if(style & WINSBS_LEFTALIGN)               os2style |= ;
     756//    if(style & WINSBS_BOTTOMALIGN)             os2style |= ;
     757//    if(style & WINSBS_RIGHTALIGN)              os2style |= ;
     758//    if(style & WINSBS_SIZEBOXTOPLEFTALIGN)     os2style |= ;
     759//    if(style & WINSBS_SIZEBOXBOTTOMRIGHTALIGN) os2style |= ;
     760      if(style & WINSBS_SIZEBOX)                 os2style |= SBS_AUTOSIZE;       //TODO: Correct?
     761      break;
     762
     763   case WIN_COMBOBOX:
     764      *os2class = (int)WC_COMBOBOX & 0xFFFF;
     765      if(style & WINCBS_SIMPLE)                  os2style |= CBS_SIMPLE;
     766      else
     767      if(style & WINCBS_DROPDOWN)                os2style |= CBS_DROPDOWN;
     768      else
     769      if(style & WINCBS_DROPDOWNLIST)            os2style |= CBS_DROPDOWNLIST;
     770//    if(style & WINCBS_OWNERDRAWFIXED)          os2style |= ;
     771//    if(style & WINCBS_OWNERDRAWVARIABLE)       os2style |= ;
     772//    if(style & WINCBS_AUTOHSCROLL)             os2style |= ;
     773//    if(style & WINCBS_OEMCONVERT)              os2style |= ;
     774//    if(style & WINCBS_SORT)                    os2style |= ;
     775//    if(style & WINCBS_HASSTRINGS)              os2style |= ;
     776//    if(style & WINCBS_NOINTEGRALHEIGHT)        os2style |= ;
     777//    if(style & WINCBS_DISABLENOSCROLL)         os2style |= ;
     778      break;
     779
     780   default:
     781      //SvL:9nov97 Special class control. Just copy style
     782      os2style = style;
     783      break;
    834784  }
    835785  return(os2style);
     
    841791 int os2style = 0;
    842792
    843 ///  if(style & WINWS_POPUP)
    844 ///     os2style |=
    845 ///  if(style & WINWS_CHILD)
    846 ///     os2style |=
    847   if(style & WINWS_MINIMIZE)
    848         os2style |= WS_MINIMIZED;
    849   if(style & WINWS_MAXIMIZE)
    850         os2style |= WS_MAXIMIZED;
    851   if(style & WINWS_VISIBLE)
    852         os2style |= WS_VISIBLE;
    853   if(style & WINWS_DISABLED)
    854         os2style |= WS_DISABLED;
    855   if(style & WINWS_CLIPSIBLINGS)
    856         os2style |= WS_CLIPSIBLINGS;
    857   if(style & WINWS_CLIPCHILDREN)
    858         os2style |= WS_CLIPCHILDREN;
    859   if(style & WINWS_TABSTOP)
    860         os2style |= WS_TABSTOP;
     793///  if(style & WINWS_POPUP)     os2style |=
     794///  if(style & WINWS_CHILD)     os2style |=
     795  if(style & WINWS_MINIMIZE)     os2style |= WS_MINIMIZED;
     796  if(style & WINWS_MAXIMIZE)     os2style |= WS_MAXIMIZED;
     797  if(style & WINWS_VISIBLE)      os2style |= WS_VISIBLE;
     798  if(style & WINWS_DISABLED)     os2style |= WS_DISABLED;
     799  if(style & WINWS_CLIPSIBLINGS) os2style |= WS_CLIPSIBLINGS;
     800  if(style & WINWS_CLIPCHILDREN) os2style |= WS_CLIPCHILDREN;
     801  if(style & WINWS_TABSTOP)      os2style |= WS_TABSTOP;
    861802
    862803  return(os2style);
     
    868809 int os2style = 0;
    869810
    870   if(style & WINWS_VISIBLE)
    871         os2style |= WS_VISIBLE;
    872   if(style & WINWS_DISABLED)
    873         os2style |= WS_DISABLED;
    874   if(style & WINWS_CLIPSIBLINGS)
    875         os2style |= WS_CLIPSIBLINGS;
    876   if(style & WINWS_CLIPCHILDREN)
    877         os2style |= WS_CLIPCHILDREN;
    878   if(style & WINWS_TABSTOP)
    879         os2style |= WS_TABSTOP;
    880   if(style & WINWS_GROUP)
    881         os2style |= WS_GROUP;
     811  if(style & WINWS_VISIBLE)      os2style |= WS_VISIBLE;
     812  if(style & WINWS_DISABLED)     os2style |= WS_DISABLED;
     813  if(style & WINWS_CLIPSIBLINGS) os2style |= WS_CLIPSIBLINGS;
     814  if(style & WINWS_CLIPCHILDREN) os2style |= WS_CLIPCHILDREN;
     815  if(style & WINWS_TABSTOP)      os2style |= WS_TABSTOP;
     816  if(style & WINWS_GROUP)        os2style |= WS_GROUP;
    882817
    883818  return(os2style);
     
    890825 int i, len = strlen(caption), j;
    891826
    892   switch(style) {
    893         case WIN_BUTTON:
    894         case WIN_EDIT:
    895         case WIN_LISTBOX:
    896         case WIN_SCROLLBAR:
    897         case WIN_COMBOBOX:
    898                 for(i=0;i<len;i++) {
    899                         if(caption[i] == '&')   caption[i] = '~';
    900                 }
    901                 break;
    902         case WIN_STATIC:
    903                 j = 0;
    904                 for(i=0;i<=len;i++) {
    905                         if(caption[i] != '&')   os2caption[j++] = caption[i];
    906                 }
    907                 strcpy(caption, os2caption);
    908                 break;
    909   } 
     827  switch(style)
     828  {
     829    case WIN_BUTTON:
     830    case WIN_EDIT:
     831    case WIN_LISTBOX:
     832    case WIN_SCROLLBAR:
     833    case WIN_COMBOBOX:
     834      for(i=0;
     835          i<len;
     836          i++)
     837      {
     838        if(caption[i] == '&')
     839          caption[i] = '~';
     840      }
     841      break;
     842
     843    case WIN_STATIC:
     844      // @@@PH: what to do if MNEMONIC style ?
     845      j = 0;
     846      for(i=0;i<=len;i++)
     847      {
     848        if(caption[i] != '&')
     849          os2caption[j++] = caption[i];
     850      }
     851      strcpy(caption, os2caption);
     852      break;
     853  }
    910854}
    911855//******************************************************************************
     
    916860
    917861  if(strcmp(font, "MS SHELL DLG") == 0) {
    918         strcpy(dlgpparam->aparam[0].ab, "System VIO");
    919         dlgpparam->aparam[0].cb = sizeof("System VIO");
    920         sprintf(fontsize, ".%d", fsize);
    921         strcat(dlgpparam->aparam[0].ab, fontsize);
    922         return(TRUE);
     862   strcpy(dlgpparam->aparam[0].ab, "System VIO");
     863   dlgpparam->aparam[0].cb = sizeof("System VIO");
     864   sprintf(fontsize, ".%d", fsize);
     865   strcat(dlgpparam->aparam[0].ab, fontsize);
     866   return(TRUE);
    923867  }
    924868//  else TODO: More fonts!!!
    925   return(FALSE);        //not found
     869  return(FALSE);  //not found
    926870}
    927871//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.