Changeset 121 for trunk/about.cpp


Ignore:
Timestamp:
Aug 14, 2021, 12:05:55 AM (4 years ago)
Author:
Gregg Young
Message:

Add windowproc for the about dialog (for code page changes and dynamically loading strings)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/about.cpp

    r2 r121  
    2020#include "gotcha.h"
    2121
     22#ifndef _QUIET_
     23MRESULT EXPENTRY AboutWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
     24{
     25
     26    switch (msg) {
     27    case WM_INITDLG:{
     28
     29        HMQ hmq;
     30        BOOL bUniCodeFont = FALSE;
     31        CHAR ucFont[FACESIZE];
     32        CHAR       ucLangStr[300];
     33        INT i;
     34       
     35        if (pset->GetLangID() == RU) {
     36            hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
     37            WinSetCp(hmq, 866);
     38            bUniCodeFont = TRUE;
     39        }
     40        else if (pset->GetLangID() == CZ || pset->GetLangID() == PL) {
     41            hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
     42            WinSetCp(hmq, 852);
     43            bUniCodeFont = TRUE;
     44        }
     45        else {
     46            hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
     47            WinSetCp(hmq, 850);
     48        }
     49
     50        if (bUniCodeFont) {
     51            strcpy(ucFont, "9.Times New Roman MT 30");
     52            WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);
     53        }
     54        for (i = 0; i < WID_ST_END - 400; i++) {
     55                WinLoadString(hab, g_hmod, LANG_COPYRIGHT + i, sizeof(ucLangStr), ucLangStr);
     56                WinSetDlgItemText(hwnd, WID_ST_COPYRIGHT + i, ucLangStr);
     57            }
     58        return (MRESULT) TRUE;
     59    }
     60    case WM_COMMAND:
     61        switch (SHORT1FROMMP(mp1)) {
     62        case DID_OK:
     63        case DID_CANCEL:
     64            WinPostMsg(WinQueryWindow(hwnd, QW_OWNER), msg, mp1, mp2);
     65            break;
     66        default:
     67            return WinDefDlgProc(hwnd, msg, mp1, mp2);
     68        }
     69        break;
     70    default:
     71        return WinDefDlgProc(hwnd, msg, mp1, mp2);
     72    }
     73    return 0;
     74}
     75
    2276VOID AboutBox (HWND hwnd)
    2377{
    24     WinDlgBox (HWND_DESKTOP, hwnd, NULL, GETMODULE, ID_DLG_ABOUT, NULL);
     78    WinDlgBox (HWND_DESKTOP, hwnd, AboutWndProc, GETMODULE, ID_DLG_ABOUT, NULL);
    2579}
     80
     81#endif
Note: See TracChangeset for help on using the changeset viewer.