📄 prefdialog.cpp
字号:
else
{
currentValues.saveStreams = false;
}
enabled = (currentValues.saveStreams ? TRUE : FALSE);
Button_Enable(hwndSaveStreamsDirectory, enabled);
Button_Enable(hwndBrowse, enabled);
Button_Enable( hwndSaveLocationText,enabled);
if(memcmp( &originalValues,
¤tValues,
sizeof(PrefsStruct)))
{
PropSheet_Changed(GetParent(hwnd), hwnd);
}
else
{
PropSheet_UnChanged(GetParent(hwnd), hwnd);
}
break;
}
case IDC_STREAMSAVEDIR:
{
if(HIWORD(wParam) == EN_CHANGE)
{
memset(currentValues.saveStreamsDirectory, 0x00, MAX_PATH);
Edit_GetText( hwndSaveStreamsDirectory,
currentValues.saveStreamsDirectory,
MAX_PATH);
if(memcmp( &originalValues,
¤tValues,
sizeof(PrefsStruct)))
{
PropSheet_Changed(GetParent(hwnd), hwnd);
}
else
{
PropSheet_UnChanged(GetParent(hwnd), hwnd);
}
}
break;
}
case IDC_BROWSE:
{
LPMALLOC pMalloc;
if(SUCCEEDED(SHGetMalloc(&pMalloc)))
{
BROWSEINFO bi;
LPITEMIDLIST browseId;
char displayName[MAX_PATH + 1];
bi.hwndOwner = hwnd;
bi.pidlRoot = NULL;
bi.pszDisplayName = displayName;
bi.lpszTitle = "Please select the folder to which you want to save streams.";
bi.ulFlags = BIF_RETURNONLYFSDIRS;
bi.lpfn = NULL;
browseId = SHBrowseForFolder(&bi);
if(browseId)
{
memset( currentValues.saveStreamsDirectory,
0x00,
MAX_PATH);
SHGetPathFromIDList(browseId,
currentValues.saveStreamsDirectory);
Edit_SetText( hwndSaveStreamsDirectory,
currentValues.saveStreamsDirectory);
pMalloc->Free(browseId);
}
}
break;
}
case IDC_USEPROXY:
{
BOOL enabled;
if(Button_GetCheck(hwndUseProxyServer) == BST_CHECKED)
{
currentValues.useProxyServer = true;
}
else
{
currentValues.useProxyServer = false;
}
enabled = (currentValues.useProxyServer ? TRUE : FALSE);
Button_Enable(hwndProxyServerAddress, enabled);
Button_Enable(hwndProxyServerAddressText, enabled);
Button_Enable(hwndProxyServerPort, enabled);
Button_Enable(hwndProxyServerPortText, enabled);
Button_Enable(hwndColon, enabled);
if(memcmp( &originalValues,
¤tValues,
sizeof(PrefsStruct)))
{
PropSheet_Changed(GetParent(hwnd), hwnd);
}
else
{
PropSheet_UnChanged(GetParent(hwnd), hwnd);
}
break;
}
case IDC_PROXYADDRESS:
case IDC_PORT:
{
if(HIWORD(wParam) == EN_CHANGE)
{
char port[6];
memset(currentValues.proxyServer, 0x00, MAX_PATH);
Edit_GetText( hwndProxyServerAddress,
currentValues.proxyServer,
MAX_PATH);
Edit_GetText( hwndProxyServerPort,
port,
sizeof(port));
if(*port)
{
strcat(currentValues.proxyServer, ":");
strcat(currentValues.proxyServer, port);
}
if(memcmp( &originalValues,
¤tValues,
sizeof(PrefsStruct)))
{
PropSheet_Changed(GetParent(hwnd), hwnd);
}
else
{
PropSheet_UnChanged(GetParent(hwnd), hwnd);
}
}
break;
}
case IDC_USETHISIP:
{
BOOL enabled;
if(Button_GetCheck(hwndUseAlternateIP) == BST_CHECKED)
{
currentValues.useAlternateIP = true;
}
else
{
currentValues.useAlternateIP = false;
}
enabled = (currentValues.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(memcmp( &originalValues,
¤tValues,
sizeof(PrefsStruct)))
{
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];
memset(currentValues.alternateIP, 0x00, 16);
Edit_GetText(hwndAlternateIPAddress1, ip, 4);
if(*ip)
{
strcat(currentValues.alternateIP, ip);
}
else
{
strcat(currentValues.alternateIP, "0");
}
strcat(currentValues.alternateIP, ".");
Edit_GetText(hwndAlternateIPAddress2, ip, 4);
if(*ip)
{
strcat(currentValues.alternateIP, ip);
}
else
{
strcat(currentValues.alternateIP, "0");
}
strcat(currentValues.alternateIP, ".");
Edit_GetText(hwndAlternateIPAddress3, ip, 4);
if(*ip)
{
strcat(currentValues.alternateIP, ip);
}
else
{
strcat(currentValues.alternateIP, "0");
}
strcat(currentValues.alternateIP, ".");
Edit_GetText(hwndAlternateIPAddress4, ip, 4);
if(*ip)
{
strcat(currentValues.alternateIP, ip);
}
else
{
strcat(currentValues.alternateIP, "0");
}
if(memcmp( &originalValues,
¤tValues,
sizeof(PrefsStruct)))
{
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(prefs, ¤tValues);
break;
}
case PSN_KILLACTIVE:
{
break;
}
case PSN_RESET:
{
SavePrefsValues(prefs, &originalValues);
break;
}
}
break;
}
}
return result;
}
static
BOOL
CALLBACK
PrefPage3Proc( HWND hwnd,
UINT msg,
WPARAM wParam,
LPARAM lParam)
{
UINT result = 0;
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 = 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, originalValues.logMain);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -