|
#include "stdafx.h"
#include "resource.h"
#include "Select.h"
#include "CtxMenu.h"
#include "PatternDlg.h"
#include "defs.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
BEGIN_MESSAGE_MAP(PatternDlg, super)
//{{AFX_MSG_MAP(PatternDlg)
ON_CBN_EDITUPDATE(IDC_PATTERN_COMBO, OnComboEdit)
ON_CBN_SELENDOK(IDC_PATTERN_COMBO, OnComboSelect)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
PatternDlg::PatternDlg(CtxMenu* ctxmenu)
: super(PatternDlg::IDD, NULL)
{
this->ctxmenu = ctxmenu;
}
/////////////////////////////////////////////////////////////////////////////
void PatternDlg::DoDataExchange(CDataExchange* pDX)
{
super::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CClickMeNotDlg)
DDX_Control(pDX, IDC_PATTERN_COMBO, combo);
DDX_Control(pDX, IDC_HYPERLINK, link);
//}}AFX_DATA_MAP
}
/////////////////////////////////////////////////////////////////////////////
BOOL PatternDlg::OnInitDialog(void)
{
super::OnInitDialog();
link.SetURL(WEBSITE_URL);
combo.LoadHistory(SETTINGS_KEY, PATTERNS_SETTINGS);
GetDlgItem(IDOK)->EnableWindow(FALSE);
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
void PatternDlg::OnOK(void)
{
combo.AddToHistory();
combo.SaveHistory(SETTINGS_KEY, PATTERNS_SETTINGS);
super::OnOK();
}
/////////////////////////////////////////////////////////////////////////////
void PatternDlg::OnComboEdit(void)
{
CString str;
combo.GetWindowText(str);
SelectFiles(str);
}
/////////////////////////////////////////////////////////////////////////////
void PatternDlg::OnComboSelect(void)
{
int index = combo.GetCurSel();
if (index != -1)
{
CString str;
combo.GetLBText(index, str);
SelectFiles(str);
}
}
/////////////////////////////////////////////////////////////////////////////
void PatternDlg::SelectFiles(CString& str)
{
if (str.IsEmpty())
{
GetDlgItem(IDOK)->EnableWindow(FALSE);
ctxmenu->RestoreOriginalSelection();
}
else
{
GetDlgItem(IDOK)->EnableWindow(TRUE);
ctxmenu->SelectFiles((LPCTSTR) str);
}
}
/////////////////////////////////////////////////////////////////////////////
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.