annotate src/win32/LangSelect.cpp @ 6:458a4f18f3cd

working on lua generation
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:48:33 -0600
parents f9f4f1b99eed
children
rev   line source
rlm@1 1 // LangSelect.cpp : implementation file
rlm@1 2 //
rlm@1 3
rlm@1 4 #include "stdafx.h"
rlm@1 5 #include "resource.h"
rlm@1 6 #include "LangSelect.h"
rlm@1 7 #include "VBA.h"
rlm@1 8
rlm@1 9 /////////////////////////////////////////////////////////////////////////////
rlm@1 10 // LangSelect dialog
rlm@1 11
rlm@1 12 LangSelect::LangSelect(CWnd*pParent /*=NULL*/)
rlm@1 13 : CDialog(LangSelect::IDD, pParent)
rlm@1 14 {
rlm@1 15 //{{AFX_DATA_INIT(LangSelect)
rlm@1 16 // NOTE: the ClassWizard will add member initialization here
rlm@1 17 //}}AFX_DATA_INIT
rlm@1 18 }
rlm@1 19
rlm@1 20 void LangSelect::DoDataExchange(CDataExchange*pDX)
rlm@1 21 {
rlm@1 22 CDialog::DoDataExchange(pDX);
rlm@1 23 //{{AFX_DATA_MAP(LangSelect)
rlm@1 24 DDX_Control(pDX, IDC_LANG_STRING, m_langString);
rlm@1 25 DDX_Control(pDX, IDC_LANG_NAME, m_langName);
rlm@1 26 //}}AFX_DATA_MAP
rlm@1 27 }
rlm@1 28
rlm@1 29 BEGIN_MESSAGE_MAP(LangSelect, CDialog)
rlm@1 30 //{{AFX_MSG_MAP(LangSelect)
rlm@1 31 ON_BN_CLICKED(ID_CANCEL, OnCancel)
rlm@1 32 ON_BN_CLICKED(ID_OK, OnOk)
rlm@1 33 //}}AFX_MSG_MAP
rlm@1 34 END_MESSAGE_MAP()
rlm@1 35
rlm@1 36 /////////////////////////////////////////////////////////////////////////////
rlm@1 37 // LangSelect message handlers
rlm@1 38
rlm@1 39 void LangSelect::OnCancel()
rlm@1 40 {
rlm@1 41 EndDialog(FALSE);
rlm@1 42 }
rlm@1 43
rlm@1 44 void LangSelect::OnOk()
rlm@1 45 {
rlm@1 46 m_langString.GetWindowText(theApp.languageName);
rlm@1 47 EndDialog(TRUE);
rlm@1 48 }
rlm@1 49
rlm@1 50 BOOL LangSelect::OnInitDialog()
rlm@1 51 {
rlm@1 52 CDialog::OnInitDialog();
rlm@1 53
rlm@1 54 char lbuffer[10];
rlm@1 55 if (GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SABBREVLANGNAME,
rlm@1 56 lbuffer, 10))
rlm@1 57 {
rlm@1 58 m_langName.SetWindowText(lbuffer);
rlm@1 59 }
rlm@1 60 else
rlm@1 61 {
rlm@1 62 m_langName.SetWindowText("???");
rlm@1 63 }
rlm@1 64
rlm@1 65 if (!theApp.languageName.IsEmpty())
rlm@1 66 m_langString.SetWindowText(theApp.languageName);
rlm@1 67
rlm@1 68 m_langString.LimitText(3);
rlm@1 69
rlm@1 70 CenterWindow();
rlm@1 71
rlm@1 72 return TRUE; // return TRUE unless you set the focus to a control
rlm@1 73 // EXCEPTION: OCX Property Pages should return FALSE
rlm@1 74 }
rlm@1 75