📄 win32preferencewindow.cpp
字号:
if(Button_GetCheck(hwndUseProxyServer) == BST_CHECKED)
{
m_proposedValues.useProxyServer = true;
}
else
{
m_proposedValues.useProxyServer = false;
}
enabled = (m_proposedValues.useProxyServer ? TRUE : FALSE);
Button_Enable(hwndProxyServerAddress, enabled);
Button_Enable(hwndProxyServerAddressText, enabled);
Button_Enable(hwndProxyServerPort, enabled);
Button_Enable(hwndProxyServerPortText, enabled);
Button_Enable(hwndColon, enabled);
if(m_proposedValues != m_currentValues)
{
PropSheet_Changed(GetParent(hwnd), hwnd);
}
else
{
PropSheet_UnChanged(GetParent(hwnd), hwnd);
}
break;
}
case IDC_PROXYADDRESS:
case IDC_PORT:
{
if(HIWORD(wParam) == EN_CHANGE)
{
char temp[MAX_PATH];
char port[6];
Edit_GetText( hwndProxyServerAddress,
temp,
MAX_PATH);
m_proposedValues.proxyServer = temp;
Edit_GetText( hwndProxyServerPort,
port,
sizeof(port));
if(*port)
{
m_proposedValues.proxyServer += ":";
m_proposedValues.proxyServer += port;
}
if(m_proposedValues != m_currentValues)
{
PropSheet_Changed(GetParent(hwnd), hwnd);
}
else
{
PropSheet_UnChanged(GetParent(hwnd), hwnd);
}
}
break;
}
case IDC_USETHISIP:
{
BOOL enabled;
if(Button_GetCheck(hwndUseAlternateIP) == BST_CHECKED)
{
m_proposedValues.useAlternateIP = true;
}
else
{
m_proposedValues.useAlternateIP = false;
}
enabled = (m_proposedValues.useAlternateIP ? TRUE : FALSE);
Button_Enable(hwndUseAlternateIPText, enabled);
Button_Enable(hwndAlternateIPAddress1, enabled);
Button_Enable(hwndPeriod1, enabled);
Button_Enable(hwndAlternateIPAddress2, enabled);
Button_Enable(hwndPeriod2, enabled);
Button_Enable(hwndAlternateIPAddress3, enabled);
Button_Enable(hwndPeriod3, enabled);
Button_Enable(hwndAlternateIPAddress4, enabled);
if(m_proposedValues != m_currentValues)
{
PropSheet_Changed(GetParent(hwnd), hwnd);
}
else
{
PropSheet_UnChanged(GetParent(hwnd), hwnd);
}
break;
}
case IDC_IPADDRESS1:
case IDC_IPADDRESS2:
case IDC_IPADDRESS3:
case IDC_IPADDRESS4:
{
if(HIWORD(wParam) == EN_CHANGE)
{
char ip[4];
Edit_GetText(hwndAlternateIPAddress1, ip, 4);
if(*ip)
{
m_proposedValues.alternateIP = ip;
}
else
{
m_proposedValues.alternateIP = "0";
}
m_proposedValues.alternateIP += ".";
Edit_GetText(hwndAlternateIPAddress2, ip, 4);
if(*ip)
{
m_proposedValues.alternateIP += ip;
}
else
{
m_proposedValues.alternateIP += "0";
}
m_proposedValues.alternateIP += ".";
Edit_GetText(hwndAlternateIPAddress3, ip, 4);
if(*ip)
{
m_proposedValues.alternateIP += ip;
}
else
{
m_proposedValues.alternateIP += "0";
}
m_proposedValues.alternateIP += ".";
Edit_GetText(hwndAlternateIPAddress4, ip, 4);
if(*ip)
{
m_proposedValues.alternateIP += ip;
}
else
{
m_proposedValues.alternateIP += "0";
}
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_HELP:
{
LaunchHelp(hwnd, Preferences_Streaming);
break;
}
case PSN_SETACTIVE:
{
break;
}
case PSN_APPLY:
{
SavePrefsValues(prefs, &m_proposedValues);
break;
}
case PSN_KILLACTIVE:
{
break;
}
case PSN_RESET:
{
SavePrefsValues(prefs, &m_originalValues);
break;
}
}
break;
}
}
return result;
}
bool Win32PreferenceWindow::PrefDebugProc(HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam)
{
bool result = false;
static PROPSHEETPAGE* psp = NULL;
static Preferences* prefs = NULL;
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:
{
// remember these for later...
psp = (PROPSHEETPAGE*)lParam;
prefs = (Preferences*)psp->lParam;
// 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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -