Ignore:
Timestamp:
Jul 14, 2003, 4:00:08 PM (22 years ago)
Author:
sandervl
Message:

KOM: Ascii/Unicode conversion fixes (DBCS)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comctl32/propsheet.c

    r10098 r10165  
    222222    add_flag(PSH_NOCONTEXTHELP);
    223223    if (string[0] != '\0')
    224         FIXME("%s\n", string);
     224    FIXME("%s\n", string);
    225225}
    226226#undef add_flag
     
    294294  memcpy(&psInfo->ppshheader,lppsh,dwSize);
    295295  TRACE("\n** PROPSHEETHEADER **\ndwSize\t\t%ld\ndwFlags\t\t%08lx\nhwndParent\t%p\nhInstance\t%p\npszCaption\t'%s'\nnPages\t\t%d\npfnCallback\t%p\n",
    296         lppsh->dwSize, lppsh->dwFlags, lppsh->hwndParent, lppsh->hInstance,
    297         debugstr_a(lppsh->pszCaption), lppsh->nPages, lppsh->pfnCallback);
     296    lppsh->dwSize, lppsh->dwFlags, lppsh->hwndParent, lppsh->hInstance,
     297    debugstr_a(lppsh->pszCaption), lppsh->nPages, lppsh->pfnCallback);
    298298
    299299  PROPSHEET_UnImplementedFlags(lppsh->dwFlags);
     
    301301  if (HIWORD(lppsh->pszCaption))
    302302  {
     303#ifdef __WIN32OS2__
     304     int len = MultiByteToWideChar( CP_ACP, 0, lppsh->pszCaption, -1, 0, 0 );
     305     psInfo->ppshheader.pszCaption = HeapAlloc( GetProcessHeap(), 0, len*sizeof (WCHAR) );
     306     MultiByteToWideChar(CP_ACP, 0, lppsh->pszCaption, -1, (LPWSTR) psInfo->ppshheader.pszCaption, len);
     307#else
    303308     int len = strlen(lppsh->pszCaption);
    304309     psInfo->ppshheader.pszCaption = HeapAlloc( GetProcessHeap(), 0, (len+1)*sizeof (WCHAR) );
    305310     MultiByteToWideChar(CP_ACP, 0, lppsh->pszCaption, -1, (LPWSTR) psInfo->ppshheader.pszCaption, len+1);
     311#endif
    306312     /* strcpy( (char *)psInfo->ppshheader.pszCaption, lppsh->pszCaption ); */
    307313  }
     
    507513      {
    508514        pTitle = pszNull;
    509         FIXME("Could not load resource #%04x?\n",LOWORD(lppsp->pszTitle));
     515    FIXME("Could not load resource #%04x?\n",LOWORD(lppsp->pszTitle));
    510516      }
    511517      else
     
    538544    {
    539545      if (psInfo->hImageList == 0 )
    540         psInfo->hImageList = ImageList_Create(icon_cx, icon_cy, ILC_COLOR, 1, 1);
     546    psInfo->hImageList = ImageList_Create(icon_cx, icon_cy, ILC_COLOR, 1, 1);
    541547
    542548      ImageList_AddIcon(psInfo->hImageList, hIcon);
     
    826832  TRACE("Biggest page %ld %ld %ld %ld\n", rc.left, rc.top, rc.right, rc.bottom);
    827833  TRACE("   constants padx=%d, pady=%d, butH=%d, lH=%d\n",
    828         padding.x, padding.y, buttonHeight, lineHeight);
     834    padding.x, padding.y, buttonHeight, lineHeight);
    829835
    830836  /* Make room */
     
    10921098  if (psInfo->hasHelp)
    10931099  {
    1094         idButton = IDHELP;
     1100    idButton = IDHELP;
    10951101  }
    10961102  else
     
    10981104    if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD)
    10991105    {
    1100         idButton = IDC_NEXT_BUTTON;
     1106    idButton = IDC_NEXT_BUTTON;
    11011107    }
    11021108    else
    11031109    {
    1104         /* hopefully this is ok */
    1105         idButton = IDCANCEL;
     1110    /* hopefully this is ok */
     1111    idButton = IDCANCEL;
    11061112    }
    11071113  }
     
    11271133
    11281134  if (padding.y < 0)
    1129           ERR("padding negative ! Please report this !\n");
     1135      ERR("padding negative ! Please report this !\n");
    11301136
    11311137  /* this is most probably not correct, but the best we have now */
     
    12551261  /* font, if DS_SETFONT set */
    12561262  if ((DS_SETFONT & ((istemplateex)?  ((MyDLGTEMPLATEEX*)pTemplate)->style :
    1257                      pTemplate->style)))
     1263             pTemplate->style)))
    12581264    {
    12591265      p+=(istemplateex)?3:1;
     
    12681274    {
    12691275      p = (WORD*)(((DWORD)p + 3) & ~3); /* DWORD align */
    1270      
     1276
    12711277      /* skip header */
    12721278      p += (istemplateex ? sizeof(MyDLGITEMTEMPLATEEX) : sizeof(DLGITEMTEMPLATE))/sizeof(WORD);
    1273      
     1279
    12741280      /* check class */
    12751281      switch ((WORD)*p)
    1276         {
    1277         case 0x0000:
    1278           p++;
    1279           break;
    1280         case 0xffff:
    1281           TRACE("class ordinal 0x%08lx\n",*(DWORD*)p);
    1282           p += 2;
    1283           break;
    1284         default:
    1285           TRACE("class %s\n",debugstr_w((LPCWSTR)p));
    1286           p += lstrlenW( (LPCWSTR)p ) + 1;
    1287           break;
    1288         }
     1282    {
     1283    case 0x0000:
     1284      p++;
     1285      break;
     1286    case 0xffff:
     1287      TRACE("class ordinal 0x%08lx\n",*(DWORD*)p);
     1288      p += 2;
     1289      break;
     1290    default:
     1291      TRACE("class %s\n",debugstr_w((LPCWSTR)p));
     1292      p += lstrlenW( (LPCWSTR)p ) + 1;
     1293      break;
     1294    }
    12891295
    12901296      /* check title text */
    12911297      switch ((WORD)*p)
    1292         {
    1293         case 0x0000:
    1294           p++;
    1295           break;
    1296         case 0xffff:
    1297           TRACE("text ordinal 0x%08lx\n",*(DWORD*)p);
    1298           p += 2;
    1299           break;
    1300         default:
    1301           TRACE("text %s\n",debugstr_w((LPCWSTR)p));
    1302           p += lstrlenW( (LPCWSTR)p ) + 1;
    1303           break;
    1304         }
     1298    {
     1299    case 0x0000:
     1300      p++;
     1301      break;
     1302    case 0xffff:
     1303      TRACE("text ordinal 0x%08lx\n",*(DWORD*)p);
     1304      p += 2;
     1305      break;
     1306    default:
     1307      TRACE("text %s\n",debugstr_w((LPCWSTR)p));
     1308      p += lstrlenW( (LPCWSTR)p ) + 1;
     1309      break;
     1310    }
    13051311      p += *p + 1;    /* Skip extra data */
    13061312      --nrofitems;
    13071313    }
    1308  
     1314
    13091315  TRACE("%p %p size 0x%08x\n",p, (WORD*)pTemplate,sizeof(WORD)*(p - (WORD*)pTemplate));
    13101316  return (p - (WORD*)pTemplate)*sizeof(WORD);
    1311  
     1317
    13121318}
    13131319
     
    13521358                                    RT_DIALOGW);
    13531359    if(!hResource)
    1354         return FALSE;
     1360    return FALSE;
    13551361
    13561362    resSize = SizeofResource(ppshpage->hInstance, hResource);
     
    13581364    hTemplate = LoadResource(ppshpage->hInstance, hResource);
    13591365    if(!hTemplate)
    1360         return FALSE;
     1366    return FALSE;
    13611367
    13621368    pTemplate = (LPDLGTEMPLATEW)LockResource(hTemplate);
     
    13681374  if (!temp)
    13691375    return FALSE;
    1370  
     1376
    13711377  TRACE("copying pTemplate %p into temp %p (%ld)\n", pTemplate, temp, resSize);
    13721378  memcpy(temp, pTemplate, resSize);
     
    14021408
    14031409  hwndPage = CreateDialogIndirectParamW(ppshpage->hInstance,
    1404                                         pTemplate,
    1405                                         hwndParent,
    1406                                         ppshpage->pfnDlgProc,
    1407                                         (LPARAM)ppshpage);
     1410                    pTemplate,
     1411                    hwndParent,
     1412                    ppshpage->pfnDlgProc,
     1413                    (LPARAM)ppshpage);
    14081414  /* Free a no more needed copy */
    14091415  if(temp)
     
    14281434      padding = PROPSHEET_GetPaddingInfoWizard(hwndParent, psInfo);
    14291435      TRACE("setting page %08lx, rc (%ld,%ld)-(%ld,%ld) w=%d, h=%d, padx=%d, pady=%d\n",
    1430             (DWORD)hwndPage, rc.left, rc.top, rc.right, rc.bottom,
    1431             pageWidth, pageHeight, padding.x, padding.y);
     1436        (DWORD)hwndPage, rc.left, rc.top, rc.right, rc.bottom,
     1437        pageWidth, pageHeight, padding.x, padding.y);
    14321438      SetWindowPos(hwndPage, HWND_TOP,
    1433                    rc.left + padding.x/2,
    1434                    rc.top + padding.y/2,
    1435                    pageWidth, pageHeight, 0);
     1439           rc.left + padding.x/2,
     1440           rc.top + padding.y/2,
     1441           pageWidth, pageHeight, 0);
    14361442  }
    14371443  else {
     
    14441450      pageHeight = rc.bottom - rc.top;
    14451451      TRACE("setting page %08lx, rc (%ld,%ld)-(%ld,%ld) w=%d, h=%d\n",
    1446             (DWORD)hwndPage, rc.left, rc.top, rc.right, rc.bottom,
    1447             pageWidth, pageHeight);
     1452        (DWORD)hwndPage, rc.left, rc.top, rc.right, rc.bottom,
     1453        pageWidth, pageHeight);
    14481454      SetWindowPos(hwndPage, HWND_TOP,
    1449                    rc.left, rc.top,
    1450                    pageWidth, pageHeight, 0);
     1455           rc.left, rc.top,
     1456           pageWidth, pageHeight, 0);
    14511457  }
    14521458
     
    18971903static BOOL PROPSHEET_SetCurSel(HWND hwndDlg,
    18981904                                int index,
    1899                                 int skipdir,
     1905                int skipdir,
    19001906                                HPROPSHEETPAGE hpage
    1901                                 )
     1907                )
    19021908{
    19031909  PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, PropSheetInfoStr);
     
    19211927
    19221928    if (hwndTabControl)
    1923         SendMessageW(hwndTabControl, TCM_SETCURSEL, index, 0);
     1929    SendMessageW(hwndTabControl, TCM_SETCURSEL, index, 0);
    19241930
    19251931    psn.hdr.code     = PSN_SETACTIVE;
     
    19391945      index+=skipdir;
    19401946      if (index < 0) {
    1941         index = 0;
    1942         FIXME("Tried to skip before first property sheet page!\n");
    1943         break;
     1947    index = 0;
     1948    FIXME("Tried to skip before first property sheet page!\n");
     1949    break;
    19441950      }
    19451951      if (index >= psInfo->nPages) {
    1946         FIXME("Tried to skip after last property sheet page!\n");
    1947         index = psInfo->nPages-1;
    1948         break;
     1952    FIXME("Tried to skip after last property sheet page!\n");
     1953    index = psInfo->nPages-1;
     1954    break;
    19491955      }
    19501956    }
     
    19962002     WCHAR szTitle[256];
    19972003     MultiByteToWideChar(CP_ACP, 0, lpszText, -1,
     2004#ifdef __WIN32OS2__
     2005                 szTitle, sizeof( szTitle ) / sizeof( WCHAR ));
     2006#else
    19982007                             szTitle, sizeof szTitle);
     2008#endif
    19992009     PROPSHEET_SetTitleW(hwndDlg, dwStyle, szTitle);
    20002010  }
     
    20102020static void PROPSHEET_SetTitleW(HWND hwndDlg, DWORD dwStyle, LPCWSTR lpszText)
    20112021{
    2012   PropSheetInfo*        psInfo = (PropSheetInfo*) GetPropW(hwndDlg, PropSheetInfoStr);
    2013   WCHAR                 szTitle[256];
     2022  PropSheetInfo*    psInfo = (PropSheetInfo*) GetPropW(hwndDlg, PropSheetInfoStr);
     2023  WCHAR         szTitle[256];
    20142024
    20152025  TRACE("'%s' (style %08lx)\n", debugstr_w(lpszText), dwStyle);
     
    24152425                               psInfo, n))
    24162426    {
    2417         if (lppsh->dwFlags & PSH_PROPSHEETPAGE)
    2418             DestroyPropertySheetPage(psInfo->proppage[n].hpage);
    2419         n--;
    2420         psInfo->nPages--;
     2427    if (lppsh->dwFlags & PSH_PROPSHEETPAGE)
     2428        DestroyPropertySheetPage(psInfo->proppage[n].hpage);
     2429    n--;
     2430    psInfo->nPages--;
    24212431    }
    24222432  }
     
    24592469                               psInfo, n))
    24602470    {
    2461         if (lppsh->dwFlags & PSH_PROPSHEETPAGE)
    2462             DestroyPropertySheetPage(psInfo->proppage[n].hpage);
    2463         n--;
    2464         psInfo->nPages--;
     2471    if (lppsh->dwFlags & PSH_PROPSHEETPAGE)
     2472        DestroyPropertySheetPage(psInfo->proppage[n].hpage);
     2473    n--;
     2474    psInfo->nPages--;
    24652475    }
    24662476  }
     
    26232633    case IDOK:
    26242634    case IDC_APPLY_BUTTON:
    2625         {
    2626             HWND hwndApplyBtn = GetDlgItem(hwnd, IDC_APPLY_BUTTON);
    2627 
    2628             if (PROPSHEET_Apply(hwnd, wID == IDOK ? 1: 0) == FALSE)
    2629                 break;
    2630 
    2631             if (wID == IDOK)
    2632                 {
    2633                     PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd,
    2634                                                                       PropSheetInfoStr);
    2635                     int result = TRUE;
    2636 
    2637                     if (psInfo->restartWindows)
    2638                         result = ID_PSRESTARTWINDOWS;
    2639 
    2640                     /* reboot system takes precedence over restart windows */
    2641                     if (psInfo->rebootSystem)
    2642                         result = ID_PSREBOOTSYSTEM;
    2643 
    2644                     if (psInfo->isModeless)
    2645                         psInfo->activeValid = FALSE;
    2646                     else
    2647                         EndDialog(hwnd, result);
    2648                 }
    2649             else
    2650                 EnableWindow(hwndApplyBtn, FALSE);
    2651 
    2652             break;
    2653         }
     2635    {
     2636        HWND hwndApplyBtn = GetDlgItem(hwnd, IDC_APPLY_BUTTON);
     2637
     2638        if (PROPSHEET_Apply(hwnd, wID == IDOK ? 1: 0) == FALSE)
     2639        break;
     2640
     2641        if (wID == IDOK)
     2642        {
     2643            PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd,
     2644                                      PropSheetInfoStr);
     2645            int result = TRUE;
     2646
     2647            if (psInfo->restartWindows)
     2648            result = ID_PSRESTARTWINDOWS;
     2649
     2650            /* reboot system takes precedence over restart windows */
     2651            if (psInfo->rebootSystem)
     2652            result = ID_PSREBOOTSYSTEM;
     2653
     2654            if (psInfo->isModeless)
     2655            psInfo->activeValid = FALSE;
     2656            else
     2657            EndDialog(hwnd, result);
     2658        }
     2659        else
     2660        EnableWindow(hwndApplyBtn, FALSE);
     2661
     2662        break;
     2663    }
    26542664
    26552665    case IDC_BACK_BUTTON:
    2656         PROPSHEET_Back(hwnd);
    2657         break;
     2666    PROPSHEET_Back(hwnd);
     2667    break;
    26582668
    26592669    case IDC_NEXT_BUTTON:
    2660         PROPSHEET_Next(hwnd);
    2661         break;
     2670    PROPSHEET_Next(hwnd);
     2671    break;
    26622672
    26632673    case IDC_FINISH_BUTTON:
    2664         PROPSHEET_Finish(hwnd);
    2665         break;
     2674    PROPSHEET_Finish(hwnd);
     2675    break;
    26662676
    26672677    case IDCANCEL:
    2668         PROPSHEET_Cancel(hwnd, 0);
    2669         break;
     2678    PROPSHEET_Cancel(hwnd, 0);
     2679    break;
    26702680
    26712681    case IDHELP:
    2672         PROPSHEET_Help(hwnd);
    2673         break;
     2682    PROPSHEET_Help(hwnd);
     2683    break;
    26742684    }
    26752685
     
    26842694{
    26852695  TRACE("hwnd=%p msg=0x%04x wparam=%x lparam=%lx\n",
    2686         hwnd, uMsg, wParam, lParam);
     2696    hwnd, uMsg, wParam, lParam);
    26872697
    26882698  switch (uMsg)
     
    27572767      if (psInfo->useCallback)
    27582768             (*(psInfo->ppshheader.pfnCallback))(hwnd,
    2759                                               PSCB_INITIALIZED, (LPARAM)0);
     2769                          PSCB_INITIALIZED, (LPARAM)0);
    27602770
    27612771      idx = psInfo->active_page;
     
    28592869        msgResult = PROPSHEET_SetCurSel(hwnd,
    28602870                                       (int)wParam,
    2861                                        1,
     2871                       1,
    28622872                                       (HPROPSHEETPAGE)lParam);
    28632873      }
Note: See TracChangeset for help on using the changeset viewer.