📄 win32preferencewindow.cpp
字号:
{
bool result = false;
static HWND hwndLog = NULL;
static HWND hwndLogDecoder = NULL;
static HWND hwndLogInput = NULL;
static HWND hwndLogOutput = NULL;
static HWND hwndLogMain = NULL;
static HWND hwndLogPerformance = NULL;
switch(msg)
{
case WM_INITDIALOG:
{
// get the handles to all our controls
hwndLog = GetDlgItem(hwnd, IDC_LOG);
hwndLogDecoder = GetDlgItem(hwnd, IDC_LOGDECODER);
hwndLogInput = GetDlgItem(hwnd, IDC_LOGINPUT);
hwndLogOutput = GetDlgItem(hwnd, IDC_LOGOUTPUT);
hwndLogMain = GetDlgItem(hwnd, IDC_LOGMAIN);
hwndLogPerformance = GetDlgItem(hwnd, IDC_LOGPERFORMANCE);
// initialize our controls
bool value;
value = m_originalValues.enableLogging;
Button_SetCheck(hwndLog, value);
Button_Enable(hwndLogDecoder, value);
Button_Enable(hwndLogInput, value);
Button_Enable(hwndLogOutput, value);
Button_Enable(hwndLogMain, value);
Button_Enable(hwndLogPerformance, value);
Button_SetCheck(hwndLogMain, m_originalValues.logMain);
Button_SetCheck(hwndLogDecoder, m_originalValues.logDecoder);
Button_SetCheck(hwndLogInput, m_originalValues.logInput);
Button_SetCheck(hwndLogOutput, m_originalValues.logOutput);
Button_SetCheck(hwndLogPerformance, m_originalValues.logPerformance);
break;
}
case WM_COMMAND:
{
switch(LOWORD(wParam))
{
case IDC_LOG:
{
BOOL enabled;
if(Button_GetCheck(hwndLog) == BST_CHECKED)
{
m_proposedValues.enableLogging = true;
}
else
{
m_proposedValues.enableLogging = false;
}
enabled = (m_proposedValues.enableLogging ? TRUE : FALSE);
Button_Enable(hwndLogDecoder, enabled);
Button_Enable(hwndLogInput, enabled);
Button_Enable(hwndLogOutput, enabled);
Button_Enable(hwndLogMain, enabled);
Button_Enable(hwndLogPerformance, enabled);
if(m_proposedValues != m_currentValues)
{
PropSheet_Changed(GetParent(hwnd), hwnd);
}
else
{
PropSheet_UnChanged(GetParent(hwnd), hwnd);
}
break;
}
case IDC_LOGDECODER:
{
if(Button_GetCheck(hwndLogDecoder) == BST_CHECKED)
{
m_proposedValues.logDecoder = true;
}
else
{
m_proposedValues.logDecoder = false;
}
if(m_proposedValues != m_currentValues)
{
PropSheet_Changed(GetParent(hwnd), hwnd);
}
else
{
PropSheet_UnChanged(GetParent(hwnd), hwnd);
}
break;
}
case IDC_LOGINPUT:
{
if(Button_GetCheck(hwndLogInput) == BST_CHECKED)
{
m_proposedValues.logInput = true;
}
else
{
m_proposedValues.logInput = false;
}
if(m_proposedValues != m_currentValues)
{
PropSheet_Changed(GetParent(hwnd), hwnd);
}
else
{
PropSheet_UnChanged(GetParent(hwnd), hwnd);
}
break;
}
case IDC_LOGOUTPUT:
{
if(Button_GetCheck(hwndLogOutput) == BST_CHECKED)
{
m_proposedValues.logOutput = true;
}
else
{
m_proposedValues.logOutput = false;
}
if(m_proposedValues != m_currentValues)
{
PropSheet_Changed(GetParent(hwnd), hwnd);
}
else
{
PropSheet_UnChanged(GetParent(hwnd), hwnd);
}
break;
}
case IDC_LOGPERFORMANCE:
{
if(Button_GetCheck(hwndLogPerformance) == BST_CHECKED)
{
m_proposedValues.logPerformance = true;
}
else
{
m_proposedValues.logPerformance = false;
}
if(m_proposedValues != m_currentValues)
{
PropSheet_Changed(GetParent(hwnd), hwnd);
}
else
{
PropSheet_UnChanged(GetParent(hwnd), hwnd);
}
break;
}
case IDC_LOGMAIN:
{
if(Button_GetCheck(hwndLogMain) == BST_CHECKED)
{
m_proposedValues.logMain = true;
}
else
{
m_proposedValues.logMain = false;
}
if(m_proposedValues != m_currentValues)
{
PropSheet_Changed(GetParent(hwnd), hwnd);
}
else
{
PropSheet_UnChanged(GetParent(hwnd), hwnd);
}
break;
}
}
break;
}
case WM_NOTIFY:
{
NMHDR* notify = (NMHDR*)lParam;
switch(notify->code)
{
case PSN_SETACTIVE:
{
break;
}
case PSN_APPLY:
{
SavePrefsValues(&m_proposedValues);
break;
}
case PSN_KILLACTIVE:
{
break;
}
case PSN_RESET:
{
SavePrefsValues(&m_originalValues);
break;
}
}
break;
}
}
return result;
}
bool Win32PreferenceWindow::PrefProfileProc(HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam)
{
bool result = false;
static HWND hwndProfileList = NULL;
static HWND hwndAddProfile = NULL;
static HWND hwndAddProfileButton = NULL;
static HWND hwndDeleteProfile = NULL;
static HWND hwndEnableProfile = NULL;
static HWND hwndHelpMe = NULL;
switch(msg)
{
case WM_INITDIALOG:
{
hwndProfileList = GetDlgItem(hwnd, IDC_PROFILE_LIST);
hwndAddProfile = GetDlgItem(hwnd, IDC_NEW_PROFILE);
hwndDeleteProfile = GetDlgItem(hwnd, IDC_DELETEPROFILE);
hwndEnableProfile = GetDlgItem(hwnd, IDC_PROFILE_ENABLE);
hwndHelpMe = GetDlgItem(hwnd, IDC_PROFILE_HELP);
hwndAddProfileButton = GetDlgItem(hwnd, IDC_ADDPROFILE);
APSInterface *pTemp = m_pContext->aps;
SetFocus(GetDlgItem(hwnd, IDC_PROFILE_LIST));
BOOL enabled = FALSE;
if (pTemp != NULL)
{
vector<string>::iterator i;
vector<string> *pProfiles = pTemp->GetKnownProfiles();
if (pProfiles)
{
for (i =pProfiles->begin(); i != pProfiles->end() ; i++)
{
SendDlgItemMessage(hwnd, IDC_PROFILE_LIST,
LB_ADDSTRING, NULL,
(LPARAM)(LPCTSTR)(*i).c_str());
}
SetFocus(GetDlgItem(hwnd, IDC_PROFILE_LIST));
}
if (pTemp->GetTurnedOnFlag())
enabled = TRUE;
}
Button_SetCheck(hwndEnableProfile, enabled);
Button_Enable(hwndAddProfile, enabled);
Button_Enable(hwndDeleteProfile, enabled);
Button_Enable(hwndProfileList, enabled);
Button_Enable(hwndAddProfileButton, enabled);
break;
}
case WM_DRAWITEM:
{
SendDlgItemMessage(hwnd, IDC_PROFILE_LIST, WM_SETREDRAW, true, 0L);
InvalidateRect(hwndProfileList, NULL, true);
break;
}
case UWM_HELP:
case WM_HELP:
{
ShowHelp(m_pContext, Preferences_Relatable);
break;
}
case WM_COMMAND:
{
switch(LOWORD(wParam))
{
case IDC_PROFILE_LIST:
{
switch(HIWORD(wParam))
{
case LBN_SELCHANGE:
{
/*
int iIndex;
int nNumSelected;
char szCurSel[256];
iIndex = SendDlgItemMessage(hwnd, IDC_PROFILE_LIST,
LB_GETCARETINDEX, 0, 0);
nNumSelected = SendDlgItemMessage(hwnd,
IDC_PROFILE_LIST,
LB_GETSELCOUNT,
0, 0);
if (iIndex >= 0)
{
SendDlgItemMessage(hwnd, IDC_PROFILE_LIST,
LB_GETTEXT, iIndex,
(LPARAM)szCurSel);
m_pContext->aps->ChangeProfile(szCurSel);
}
*/
break;
}
}
break;
}
case IDC_PROFILE_ENABLE:
{
BOOL enabled = false;
if (Button_GetCheck(hwndEnableProfile) == BST_CHECKED)
{
m_pContext->aps->TurnOn();
enabled = true;
}
else
{
m_pContext->aps->TurnOff();
enabled = false;
}
Button_Enable(hwndAddProfile, enabled);
Button_Enable(hwndDeleteProfile, enabled);
Button_Enable(hwndProfileList, enabled);
Button_Enable(hwndAddProfileButton, enabled);
break;
}
case IDC_PROFILE_HELP:
{
ShowHelp(m_pContext, Preferences_RelatableFeatures);
break;
}
case IDC_ADDPROFILE:
{
char szCurSel[256];
memset(szCurSel, 0, sizeof(szCurSel));
Edit_GetText(hwndAddProfile, szCurSel, sizeof(szCurSel));
if (strlen(szCurSel) > 0)
{
APSInterface *pAPS = m_pContext->aps;
if (pAPS)
{
vector<string> *profiles = pAPS->GetKnownProfiles();
int nRes = pAPS->CreateProfile(szCurSel);
if (nRes == APS_NOERROR)
{
SendDlgItemMessage(hwnd, IDC_PROFILE_LIST,
LB_ADDSTRING, NULL,
(LPARAM)(LPCTSTR)szCurSel);
SendDlgItemMessage(hwnd, IDC_PROFILE_LIST,
LB_SELECTSTRING, -1,
(LPARAM)(LPCTSTR)szCurSel);
if (!profiles || profiles->size() == 0)
m_pContext->target->AcceptEvent(new Event(INFO_UnsignaturedTracksExist));
}
else
{
M
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -