diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/win32/TextOptions.cpp	Sat Mar 03 10:31:27 2012 -0600
     1.3 @@ -0,0 +1,81 @@
     1.4 +// TextOptions.cpp : implementation file
     1.5 +//
     1.6 +
     1.7 +#include "stdafx.h"
     1.8 +#include "../common/Text.h"
     1.9 +#include "resource.h"
    1.10 +#include "TextOptions.h"
    1.11 +
    1.12 +// TextOptions dialog
    1.13 +
    1.14 +IMPLEMENT_DYNAMIC(TextOptions, CDialog)
    1.15 +TextOptions::TextOptions(CWnd*pParent /*=NULL*/)
    1.16 +	: CDialog(TextOptions::IDD, pParent)
    1.17 +{}
    1.18 +
    1.19 +TextOptions::~TextOptions()
    1.20 +{}
    1.21 +
    1.22 +BOOL TextOptions::OnInitDialog()
    1.23 +{
    1.24 +	CDialog::OnInitDialog();
    1.25 +
    1.26 +	CheckRadioButton(IDC_RADIO_WHITE, IDC_RADIO_BLACK, IDC_RADIO_WHITE + textColor);
    1.27 +	CheckRadioButton(IDC_RADIO_PREFILTER, IDC_RADIO_POSTRENDER, IDC_RADIO_PREFILTER + textMethod);
    1.28 +	CheckDlgButton(IDC_CHECK_OUTLINED, outlinedText);
    1.29 +	CheckDlgButton(IDC_CHECK_TRANSPARENT, transparentText);
    1.30 +	GetDlgItem(IDC_CHECK_TRANSPARENT)->EnableWindow(GetCheckedRadioButton(IDC_RADIO_PREFILTER,
    1.31 +	                                                                      IDC_RADIO_POSTRENDER) != IDC_RADIO_POSTRENDER);
    1.32 +
    1.33 +	return TRUE;  // return TRUE unless you set the focus to a control
    1.34 +	// EXCEPTION: OCX Property Pages should return FALSE
    1.35 +}
    1.36 +
    1.37 +void TextOptions::DoDataExchange(CDataExchange*pDX)
    1.38 +{
    1.39 +	CDialog::DoDataExchange(pDX);
    1.40 +}
    1.41 +
    1.42 +BEGIN_MESSAGE_MAP(TextOptions, CDialog)
    1.43 +ON_BN_CLICKED(IDOK, OnBnClickedOk)
    1.44 +ON_BN_CLICKED(IDC_RADIO_PREFILTER, OnBnClickedRadioPrefilter)
    1.45 +ON_BN_CLICKED(IDC_RADIO_POSTFILTER, OnBnClickedRadioPostfilter)
    1.46 +ON_BN_CLICKED(IDC_RADIO_POSTRENDER, OnBnClickedRadioPostrender)
    1.47 +END_MESSAGE_MAP()
    1.48 +
    1.49 +// TextOptions message handlers
    1.50 +
    1.51 +void TextOptions::OnBnClickedOk()
    1.52 +{
    1.53 +	transparentText = IsDlgButtonChecked(IDC_CHECK_TRANSPARENT) != 0;
    1.54 +	outlinedText    = IsDlgButtonChecked(IDC_CHECK_OUTLINED) != 0;
    1.55 +	textMethod      = GetCheckedRadioButton(IDC_RADIO_PREFILTER, IDC_RADIO_POSTRENDER) - IDC_RADIO_PREFILTER;
    1.56 +	textColor       = GetCheckedRadioButton(IDC_RADIO_WHITE, IDC_RADIO_BLACK) - IDC_RADIO_WHITE;
    1.57 +	if (textMethod < 0)
    1.58 +		textMethod = 0;
    1.59 +	if (textMethod > 2)
    1.60 +		textMethod = 2;
    1.61 +	if (textColor < 0)
    1.62 +		textColor = 0;
    1.63 +	if (textColor > 7)
    1.64 +		textColor = 7;
    1.65 +
    1.66 +	OnOK();
    1.67 +}
    1.68 +
    1.69 +void TextOptions::OnBnClickedRadioPrefilter()
    1.70 +{
    1.71 +	GetDlgItem(IDC_CHECK_TRANSPARENT)->EnableWindow(TRUE);
    1.72 +}
    1.73 +
    1.74 +void TextOptions::OnBnClickedRadioPostfilter()
    1.75 +{
    1.76 +	GetDlgItem(IDC_CHECK_TRANSPARENT)->EnableWindow(TRUE);
    1.77 +}
    1.78 +
    1.79 +void TextOptions::OnBnClickedRadioPostrender()
    1.80 +{
    1.81 +	GetDlgItem(IDC_CHECK_TRANSPARENT)->EnableWindow(FALSE);
    1.82 +	CheckDlgButton(IDC_CHECK_TRANSPARENT, FALSE);
    1.83 +}
    1.84 +