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