view src/win32/TextOptions.cpp @ 1:f9f4f1b99eed

importing src directory
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:31:27 -0600
parents
children
line wrap: on
line source
1 // TextOptions.cpp : implementation file
2 //
4 #include "stdafx.h"
5 #include "../common/Text.h"
6 #include "resource.h"
7 #include "TextOptions.h"
9 // TextOptions dialog
11 IMPLEMENT_DYNAMIC(TextOptions, CDialog)
12 TextOptions::TextOptions(CWnd*pParent /*=NULL*/)
13 : CDialog(TextOptions::IDD, pParent)
14 {}
16 TextOptions::~TextOptions()
17 {}
19 BOOL TextOptions::OnInitDialog()
20 {
21 CDialog::OnInitDialog();
23 CheckRadioButton(IDC_RADIO_WHITE, IDC_RADIO_BLACK, IDC_RADIO_WHITE + textColor);
24 CheckRadioButton(IDC_RADIO_PREFILTER, IDC_RADIO_POSTRENDER, IDC_RADIO_PREFILTER + textMethod);
25 CheckDlgButton(IDC_CHECK_OUTLINED, outlinedText);
26 CheckDlgButton(IDC_CHECK_TRANSPARENT, transparentText);
27 GetDlgItem(IDC_CHECK_TRANSPARENT)->EnableWindow(GetCheckedRadioButton(IDC_RADIO_PREFILTER,
28 IDC_RADIO_POSTRENDER) != IDC_RADIO_POSTRENDER);
30 return TRUE; // return TRUE unless you set the focus to a control
31 // EXCEPTION: OCX Property Pages should return FALSE
32 }
34 void TextOptions::DoDataExchange(CDataExchange*pDX)
35 {
36 CDialog::DoDataExchange(pDX);
37 }
39 BEGIN_MESSAGE_MAP(TextOptions, CDialog)
40 ON_BN_CLICKED(IDOK, OnBnClickedOk)
41 ON_BN_CLICKED(IDC_RADIO_PREFILTER, OnBnClickedRadioPrefilter)
42 ON_BN_CLICKED(IDC_RADIO_POSTFILTER, OnBnClickedRadioPostfilter)
43 ON_BN_CLICKED(IDC_RADIO_POSTRENDER, OnBnClickedRadioPostrender)
44 END_MESSAGE_MAP()
46 // TextOptions message handlers
48 void TextOptions::OnBnClickedOk()
49 {
50 transparentText = IsDlgButtonChecked(IDC_CHECK_TRANSPARENT) != 0;
51 outlinedText = IsDlgButtonChecked(IDC_CHECK_OUTLINED) != 0;
52 textMethod = GetCheckedRadioButton(IDC_RADIO_PREFILTER, IDC_RADIO_POSTRENDER) - IDC_RADIO_PREFILTER;
53 textColor = GetCheckedRadioButton(IDC_RADIO_WHITE, IDC_RADIO_BLACK) - IDC_RADIO_WHITE;
54 if (textMethod < 0)
55 textMethod = 0;
56 if (textMethod > 2)
57 textMethod = 2;
58 if (textColor < 0)
59 textColor = 0;
60 if (textColor > 7)
61 textColor = 7;
63 OnOK();
64 }
66 void TextOptions::OnBnClickedRadioPrefilter()
67 {
68 GetDlgItem(IDC_CHECK_TRANSPARENT)->EnableWindow(TRUE);
69 }
71 void TextOptions::OnBnClickedRadioPostfilter()
72 {
73 GetDlgItem(IDC_CHECK_TRANSPARENT)->EnableWindow(TRUE);
74 }
76 void TextOptions::OnBnClickedRadioPostrender()
77 {
78 GetDlgItem(IDC_CHECK_TRANSPARENT)->EnableWindow(FALSE);
79 CheckDlgButton(IDC_CHECK_TRANSPARENT, FALSE);
80 }