void SettingsEncoding::ApplySettings() { int quality = (int)SendMessage(GetDlgItem(hwnd, IDC_QUALITY), CB_GETCURSEL, 0, 0); if(quality != CB_ERR) AppConfig->SetInt(TEXT("Video Encoding"), TEXT("Quality"), quality); UINT bitrate = GetEditText(GetDlgItem(hwnd, IDC_MAXBITRATE)).ToInt(); if(bitrate < 100) bitrate = 100; AppConfig->SetInt(TEXT("Video Encoding"), TEXT("MaxBitrate"), bitrate); UINT bufSize = GetEditText(GetDlgItem(hwnd, IDC_BUFFERSIZE)).ToInt(); //if(bufSize < 100) bufSize = bitrate; //R1CH: Allow users to enter 0 buffer size to disable VBV, its protected by checkbox anyway AppConfig->SetInt(TEXT("Video Encoding"), TEXT("BufferSize"), bufSize); String strTemp = GetCBText(GetDlgItem(hwnd, IDC_AUDIOCODEC)); AppConfig->SetString(TEXT("Audio Encoding"), TEXT("Codec"), strTemp); strTemp = GetCBText(GetDlgItem(hwnd, IDC_AUDIOBITRATE)); AppConfig->SetString(TEXT("Audio Encoding"), TEXT("Bitrate"), strTemp); int curSel = (int)SendMessage(GetDlgItem(hwnd, IDC_AUDIOFORMAT), CB_GETCURSEL, 0, 0); if(curSel != CB_ERR) AppConfig->SetInt(TEXT("Audio Encoding"), TEXT("Format"), curSel); bool bUseCBR = SendMessage(GetDlgItem(hwnd, IDC_USECBR), BM_GETCHECK, 0, 0) == BST_CHECKED; AppConfig->SetInt(TEXT("Video Encoding"), TEXT("UseCBR"), bUseCBR); bool bCustomBuffer = SendMessage(GetDlgItem(hwnd, IDC_CUSTOMBUFFER), BM_GETCHECK, 0, 0) == BST_CHECKED; AppConfig->SetInt(TEXT("Video Encoding"), TEXT("UseBufferSize"), bCustomBuffer); }
void SettingsVideo::ApplySettings() { int curSel = (int)SendMessage(GetDlgItem(hwnd, IDC_MONITOR), CB_GETCURSEL, 0, 0); if(curSel != CB_ERR) AppConfig->SetInt(TEXT("Video"), TEXT("Monitor"), curSel); int iVal = GetEditText(GetDlgItem(hwnd, IDC_SIZEX)).ToInt(); if(iVal >= 128) AppConfig->SetInt(TEXT("Video"), TEXT("BaseWidth"), iVal); iVal = GetEditText(GetDlgItem(hwnd, IDC_SIZEY)).ToInt(); if(iVal >= 128) AppConfig->SetInt(TEXT("Video"), TEXT("BaseHeight"), iVal); BOOL bDisableAero = SendMessage(GetDlgItem(hwnd, IDC_DISABLEAERO), BM_GETCHECK, 0, 0) == BST_CHECKED ? TRUE : FALSE; AppConfig->SetInt(TEXT("Video"), TEXT("DisableAero"), bDisableAero); BOOL bFailed; int fps = (int)SendMessage(GetDlgItem(hwnd, IDC_FPS), UDM_GETPOS32, 0, (LPARAM)&bFailed); AppConfig->SetInt(TEXT("Video"), TEXT("FPS"), (bFailed) ? 30 : fps); curSel = (int)SendMessage(GetDlgItem(hwnd, IDC_DOWNSCALE), CB_GETCURSEL, 0, 0); if(curSel != CB_ERR) AppConfig->SetFloat(TEXT("Video"), TEXT("Downscale"), downscaleMultipliers[curSel]); int gammaVal = (int)SendMessage(GetDlgItem(hwnd, IDC_GAMMA), TBM_GETPOS, 0, 0); AppConfig->SetInt(TEXT("Video"), TEXT("Gamma"), gammaVal); //------------------------------------ if(!App->bRunning) App->ResizeWindow(false); }
void SettingsVideo::ApplySettings() { UINT adapterID = (UINT)SendMessage(GetDlgItem(hwnd, IDC_DEVICE), CB_GETCURSEL, 0, 0); if (adapterID == CB_ERR) adapterID = 0; GlobalConfig->SetInt(TEXT("Video"), TEXT("Adapter"), adapterID); int curSel = (int)SendMessage(GetDlgItem(hwnd, IDC_MONITOR), CB_GETCURSEL, 0, 0); if(curSel != CB_ERR) AppConfig->SetInt(TEXT("Video"), TEXT("Monitor"), curSel); int iVal = GetEditText(GetDlgItem(hwnd, IDC_SIZEX)).ToInt(); if(iVal >= 128) AppConfig->SetInt(TEXT("Video"), TEXT("BaseWidth"), iVal); iVal = GetEditText(GetDlgItem(hwnd, IDC_SIZEY)).ToInt(); if(iVal >= 128) AppConfig->SetInt(TEXT("Video"), TEXT("BaseHeight"), iVal); BOOL bDisableAero = SendMessage(GetDlgItem(hwnd, IDC_DISABLEAERO), BM_GETCHECK, 0, 0) == BST_CHECKED ? TRUE : FALSE; AppConfig->SetInt(TEXT("Video"), TEXT("DisableAero"), bDisableAero); BOOL bFailed; int fps = (int)SendMessage(GetDlgItem(hwnd, IDC_FPS), UDM_GETPOS32, 0, (LPARAM)&bFailed); AppConfig->SetInt(TEXT("Video"), TEXT("FPS"), (bFailed) ? 30 : fps); curSel = (int)SendMessage(GetDlgItem(hwnd, IDC_DOWNSCALE), CB_GETCURSEL, 0, 0); if(curSel != CB_ERR) AppConfig->SetFloat(TEXT("Video"), TEXT("Downscale"), downscaleMultipliers[curSel]); curSel = (int)SendMessage(GetDlgItem(hwnd, IDC_FILTER), CB_GETCURSEL, 0, 0); if(curSel == CB_ERR) curSel = 0; AppConfig->SetInt(TEXT("Video"), TEXT("Filter"), curSel); int gammaVal = (int)SendMessage(GetDlgItem(hwnd, IDC_GAMMA), TBM_GETPOS, 0, 0); AppConfig->SetInt(TEXT("Video"), TEXT("Gamma"), gammaVal); //------------------------------------ if(!App->bRunning) App->ResizeWindow(false); if(OSGetVersion() < 8) { if (bDisableAero) { Log(TEXT("Settings::Video: Disabling Aero")); DwmEnableComposition(DWM_EC_DISABLECOMPOSITION); } else { Log(TEXT("Settings::Video: Enabling Aero")); DwmEnableComposition(DWM_EC_ENABLECOMPOSITION); } } }
INT_PTR CALLBACK IVALoginProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: { LocalizeWindow(hwnd); CTSTR lpName = g_pCloudData->GetLoginName(); SetWindowText(GetDlgItem(hwnd, IDC_LOGINNAME), lpName); CTSTR lpPassword = g_pCloudData->GetLoginPassword(); SetWindowText(GetDlgItem(hwnd, IDC_LOGINPASSWORD), lpPassword); return 1; } case WM_COMMAND: { switch (LOWORD(wParam)) { case IDOK: { String strName = GetEditText(GetDlgItem(hwnd, IDC_LOGINNAME)); if (strName.IsEmpty()) { OBSMessageBox(hwnd, L"请输入用户名", NULL, 0); break; } String strPassword = GetEditText(GetDlgItem(hwnd, IDC_LOGINPASSWORD)); if (strPassword.IsEmpty()) { OBSMessageBox(hwnd, L"密码不能为空", NULL, 0); break; } g_pCloudData->SetLoginName(strName); g_pCloudData->SetLoginPassword(strPassword); } case IDCANCEL: EndDialog(hwnd, LOWORD(wParam)); break; } break; } } return 0; }
LRESULT WINAPI ResolutionEditSubclassProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { if( ((message == WM_KEYDOWN) && (wParam == VK_RETURN)) || (message == WM_KILLFOCUS) ) { String strText = GetEditText(hwnd); if(ValidIntString(strText)) { int iVal = strText.ToInt(); if(iVal < 128) strText = TEXT("128"); else if(iVal > 4096) strText = TEXT("4096"); else return CallWindowProc((WNDPROC)editProc, hwnd, message, wParam, lParam); } else strText = TEXT("128"); SetWindowText(hwnd, strText); } return CallWindowProc((WNDPROC)editProc, hwnd, message, wParam, lParam); }
void SceneSwitcherSettings::EditItem(bool selChange) { HWND wsMap = GetDlgItem(hwnd, IDC_WSMAP); HWND appList = GetDlgItem(hwnd, IDC_APPLIST); HWND scnList = GetDlgItem(hwnd, IDC_MAINSCN); const int sel = SendMessage(wsMap, LVM_GETSELECTIONMARK, 0, 0); if (sel < 0) return; String wnd = selChange ? GetCBText(appList, CB_ERR) : GetEditText(appList); // First column LVITEM lv1; lv1.mask = LVIF_TEXT; lv1.iItem = sel; lv1.iSubItem = 0; lv1.pszText = wnd; String scn = GetCBText(scnList, CB_ERR); // Second column LVITEM lv2; lv2.mask = LVIF_TEXT; lv2.iItem = sel; lv2.iSubItem = 1; lv2.pszText = scn; // Set the text SendMessage(wsMap, LVM_SETITEM, 0, (LPARAM)&lv1); SendMessage(wsMap, LVM_SETITEM, 0, (LPARAM)&lv2); SetChangedSettings(pChange = true); }
static void RefreshPreview(HWND hWnd) { TCHAR tmp[MAX_FOLDER_SIZE], res[MAX_FOLDER_SIZE]; GetEditText(hWnd, tmp, MAX_FOLDER_SIZE); ExpandPath(res, tmp, MAX_FOLDER_SIZE); SetWindowText(GetDlgItem(hWnd, IDC_PREVIEW_EDIT), res); }
void Group_Create_OnNames (HWND hDlg) { TCHAR szSeparators[ cchRESOURCE ]; GetString (szSeparators, IDS_SEPARATORS); lstrcat (szSeparators, TEXT(" \t")); LPTSTR pszNames = GetEditText (GetDlgItem (hDlg, IDC_NEWGROUP_NAME)); EnableWindow (GetDlgItem (hDlg, IDOK), (pszNames && *pszNames)); BOOL fMultiple = FALSE; for (LPTSTR psz = pszNames; !fMultiple && psz && *psz; ++psz) { if (lstrchr (szSeparators, *psz)) fMultiple = TRUE; } FreeString (pszNames); EnableWindow (GetDlgItem (hDlg, IDC_NEWGROUP_ID_AUTO), !fMultiple); EnableWindow (GetDlgItem (hDlg, IDC_NEWGROUP_ID_MANUAL), !fMultiple); if (fMultiple) { CheckDlgButton (hDlg, IDC_NEWGROUP_ID_AUTO, TRUE); CheckDlgButton (hDlg, IDC_NEWGROUP_ID_MANUAL, FALSE); Group_Create_OnID (hDlg); } }
bool EditControl::GetEditBinaryNum(u32 &dest) { u32 temp = 0; char* editText; if ( GetEditText(editText) ) { const u32 u32BitValues[] = { 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, 0x20000000, 0x40000000, 0x80000000 }; int length = std::strlen(editText); for ( int i=length-1; i>=0; i-- ) { if ( editText[i] == '1' ) temp |= u32BitValues[(length-1)-i]; else if ( editText[i] != '0' ) { delete[] editText; return false; } } delete[] editText; dest = temp; return true; } else return false; }
static int ChangesNotSaved(HWND hWnd, PFolderItem item) { if (!item) return 0; TCHAR buffer[MAX_FOLDER_SIZE]; GetEditText(hWnd, buffer, MAX_FOLDER_SIZE); return _tcscmp(item->GetFormat(), buffer) != 0; }
SStringT SComboBase::GetWindowText(BOOL bRawText/*=TRUE*/) { if(!m_bDropdown) { return GetEditText(); } if(GetCurSel()==-1) return _T(""); return GetLBText(GetCurSel(),bRawText); }
void MAPS::ChangePlayer(u8 newPlayer) { curr->currPlayer() = newPlayer; if ( curr->currLayer() == LAYER_UNITS ) { if ( clipboard.isPasting() ) { PasteUnitNode* curr = clipboard.getFirstUnit(); while ( curr != nullptr ) { curr->unit.owner = newPlayer; curr = curr->next; } } u16 numUnits = curr->numUnits(); UnitNode* currSelUnit = curr->selections().getFirstUnit(); while ( currSelUnit != nullptr ) { ChkUnit* unit; if ( curr->getUnit(unit, currSelUnit->index) ) unit->owner = newPlayer; if ( hUnit ) { HWND hOwner = GetDlgItem(hUnit, IDC_COMBO_PLAYER); HWND hUnitList = GetDlgItem(hUnit, IDC_UNITLIST); if ( newPlayer < 12 ) SendMessage(hOwner, CB_SETCURSEL, newPlayer, NULL); else { char* text; if ( GetEditText(hPlayer, text) ) { SetWindowText(hOwner, text); delete[] text; } } ChangeOwner(hUnitList, currSelUnit->index, newPlayer); } currSelUnit = currSelUnit->next; } curr->Redraw(true); } char color[32], race[32], playerText[64]; sprintf_s(color, "Red"); sprintf_s(race, "Terran"); sprintf_s(playerText, "Player %i: %s %s", curr->currPlayer()+1, color, race); SendMessage(hStatus, SB_SETTEXT, 2, (INT_PTR)playerText); }
void SettingsEncoding::ApplySettings() { int quality = (int)SendMessage(GetDlgItem(hwnd, IDC_QUALITY), CB_GETCURSEL, 0, 0); if(quality != CB_ERR) AppConfig->SetInt(TEXT("Video Encoding"), TEXT("Quality"), quality); UINT bitrate = GetEditText(GetDlgItem(hwnd, IDC_MAXBITRATE)).ToInt(); if(bitrate < 100) bitrate = 100; AppConfig->SetInt(TEXT("Video Encoding"), TEXT("MaxBitrate"), bitrate); UINT bufSize = GetEditText(GetDlgItem(hwnd, IDC_BUFFERSIZE)).ToInt(); //if(bufSize < 100) bufSize = bitrate; //R1CH: Allow users to enter 0 buffer size to disable VBV, its protected by checkbox anyway AppConfig->SetInt(TEXT("Video Encoding"), TEXT("BufferSize"), bufSize); if(App->GetVideoEncoder() != NULL) { if(App->GetVideoEncoder()->DynamicBitrateSupported()) { int oldBitrate = App->GetVideoEncoder()->GetBitRate(); App->GetVideoEncoder()->SetBitRate(bitrate, bufSize); if(oldBitrate != bitrate) Log(FormattedString(TEXT("Settings::Encoding: Changing bitrate from %dkb/s to %dkb/s"), oldBitrate, bitrate)); } } String strTemp = GetCBText(GetDlgItem(hwnd, IDC_AUDIOCODEC)); AppConfig->SetString(TEXT("Audio Encoding"), TEXT("Codec"), strTemp); strTemp = GetCBText(GetDlgItem(hwnd, IDC_AUDIOBITRATE)); AppConfig->SetString(TEXT("Audio Encoding"), TEXT("Bitrate"), strTemp); int curSel = (int)SendMessage(GetDlgItem(hwnd, IDC_AUDIOFORMAT), CB_GETCURSEL, 0, 0); if(curSel != CB_ERR) AppConfig->SetInt(TEXT("Audio Encoding"), TEXT("Format"), curSel); bool bUseCBR = SendMessage(GetDlgItem(hwnd, IDC_USECBR), BM_GETCHECK, 0, 0) == BST_CHECKED; AppConfig->SetInt(TEXT("Video Encoding"), TEXT("UseCBR"), bUseCBR); bool bPadCBR = SendMessage(GetDlgItem(hwnd, IDC_PADCBR), BM_GETCHECK, 0, 0) == BST_CHECKED; AppConfig->SetInt(TEXT("Video Encoding"), TEXT("PadCBR"), bPadCBR); bool bCustomBuffer = SendMessage(GetDlgItem(hwnd, IDC_CUSTOMBUFFER), BM_GETCHECK, 0, 0) == BST_CHECKED; AppConfig->SetInt(TEXT("Video Encoding"), TEXT("UseBufferSize"), bCustomBuffer); }
static void SaveItem(HWND hWnd, PFolderItem item, int bEnableApply) { if (!item) return; TCHAR buffer[MAX_FOLDER_SIZE]; GetEditText(hWnd, buffer, SIZEOF(buffer)); item->SetFormat(buffer); if (bEnableApply) SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0); }
bool EditControl::GetEditText(std::string& dest) { char* temp; if ( GetEditText(temp) ) { try { dest = temp; } catch ( std::exception ) { delete[] temp; return false; } delete[] temp; return true; } else return false; }
void Browse_OnOK (HWND hDlg) { LPBROWSE_PARAMS lpp; if ((lpp = (LPBROWSE_PARAMS)GetWindowLongPtr (hDlg, DWLP_USER)) != NULL) { LPTSTR pszNames = GetEditText (GetDlgItem (hDlg, IDC_BROWSE_NAMED)); // Disable the controls on the dialog for a bit... // Browse_Enable (hDlg, FALSE); // Start a background task to translate the typed list-of-names into // a usable ASID list. When it comes back, we'll close the dialog. // LPLIST_TRANSLATE_PARAMS pTask = New (LIST_TRANSLATE_PARAMS); pTask->Type = Browse_GetSelectedType (hDlg); pTask->pszNames = pszNames; StartTask (taskLIST_TRANSLATE, hDlg, pTask); } }
void EditControl::ExpandToText() { HDC hDC = GetDC(getHandle()); char* text; if ( hDC != NULL && GetEditText(text) ) { SIZE strSize = { }; RECT textRect = { }; if ( GetTextExtentPoint32A(hDC, text, GetTextLength(), &strSize) == TRUE && GetClientRect(getHandle(), &textRect) == TRUE && strSize.cx > (textRect.right-textRect.left) ) { textRect.right = textRect.left + strSize.cx; if ( AdjustWindowRect(&textRect, GetWindowStyle(getHandle()), FALSE) != 0 ) SetWidth(textRect.right-textRect.left); } delete[] text; ReleaseDC(hDC); } }
void SettingsAdvanced::ApplySettings() { //precheck for QSV enable/disable in case the checkbox is currently enabled while no hardware support is found bool bHasQSV = CheckQSVHardwareSupport(false); bool bUseQSV = SendMessage(GetDlgItem(hwnd, IDC_USEQSV), BM_GETCHECK, 0, 0) == BST_CHECKED; bool bUseQSV_prev = AppConfig->GetInt(TEXT("Video Encoding"), TEXT("UseQSV")) != 0; if (!bHasQSV && !bUseQSV && bUseQSV_prev && MessageBox(hwnd, Str("Settings.Advanced.UseQSVDisabledAfterApply"), Str("MessageBoxWarningCaption"), MB_ICONEXCLAMATION | MB_OKCANCEL) != IDOK) { SetAbortApplySettings(true); return; } //precheck for NVENC enable/disable in case the checkbox is currently enabled while no hardware support is found bool bHasNVENC = CheckNVENCHardwareSupport(false); bool bUseNVENC = SendMessage(GetDlgItem(hwnd, IDC_USENVENC), BM_GETCHECK, 0, 0) == BST_CHECKED; bool bUseNVENC_prev = AppConfig->GetInt(TEXT("Video Encoding"), TEXT("UseNVENC")) != 0; if (!bHasNVENC && !bUseNVENC && bUseNVENC_prev && MessageBox(hwnd, Str("Settings.Advanced.UseNVENCDisabledAfterApply"), Str("MessageBoxWarningCaption"), MB_ICONEXCLAMATION | MB_OKCANCEL) != IDOK) { SetAbortApplySettings(true); return; } //-------------------------------------------------- String strTemp = GetCBText(GetDlgItem(hwnd, IDC_PRESET)); AppConfig->SetString(TEXT("Video Encoding"), TEXT("Preset"), strTemp); //------------------------------------ strTemp = GetCBText(GetDlgItem(hwnd, IDC_X264PROFILE)); AppConfig->SetString(TEXT("Video Encoding"), TEXT("X264Profile"), strTemp); //-------------------------------------------------- bool bUseMTOptimizations = SendMessage(GetDlgItem(hwnd, IDC_USEMULTITHREADEDOPTIMIZATIONS), BM_GETCHECK, 0, 0) == BST_CHECKED; AppConfig->SetInt(TEXT("General"), TEXT("UseMultithreadedOptimizations"), bUseMTOptimizations); int priority = (int)SendMessage(GetDlgItem(hwnd, IDC_PRIORITY), CB_GETCURSEL, 0, 0); switch (priority) { case 0: strTemp = TEXT("High"); break; case 1: strTemp = TEXT("Above Normal"); break; case 2: strTemp = TEXT("Normal"); break; case 3: strTemp = TEXT("Idle"); break; } AppConfig->SetString(TEXT("General"), TEXT("Priority"), strTemp); //-------------------------------------------------- UINT sceneBufferTime = (UINT)SendMessage(GetDlgItem(hwnd, IDC_SCENEBUFFERTIME), UDM_GETPOS32, 0, 0); GlobalConfig->SetInt(TEXT("General"), TEXT("SceneBufferingTime"), sceneBufferTime); //-------------------------------------------------- bool bDisablePreviewEncoding = SendMessage(GetDlgItem(hwnd, IDC_DISABLEPREVIEWENCODING), BM_GETCHECK, 0, 0) == BST_CHECKED; GlobalConfig->SetInt(TEXT("General"), TEXT("DisablePreviewEncoding"), bDisablePreviewEncoding); //-------------------------------------------------- bool bAllowOtherHotkeyModifiers = SendMessage(GetDlgItem(hwnd, IDC_ALLOWOTHERHOTKEYMODIFIERS), BM_GETCHECK, 0, 0) == BST_CHECKED; GlobalConfig->SetInt(TEXT("General"), TEXT("AllowOtherHotkeyModifiers"), bAllowOtherHotkeyModifiers); //-------------------------------------------------- UINT keyframeInt = (UINT)SendMessage(GetDlgItem(hwnd, IDC_KEYFRAMEINTERVAL), UDM_GETPOS32, 0, 0); AppConfig->SetInt(TEXT("Video Encoding"), TEXT("KeyframeInterval"), keyframeInt); //-------------------------------------------------- bool bUseCFR = SendMessage(GetDlgItem(hwnd, IDC_USECFR), BM_GETCHECK, 0, 0) == BST_CHECKED; AppConfig->SetInt (TEXT("Video Encoding"), TEXT("UseCFR"), bUseCFR); //-------------------------------------------------- BOOL bUseCustomX264Settings = SendMessage(GetDlgItem(hwnd, IDC_USEVIDEOENCODERSETTINGS), BM_GETCHECK, 0, 0) == BST_CHECKED; String strCustomX264Settings = GetEditText(GetDlgItem(hwnd, IDC_VIDEOENCODERSETTINGS)); AppConfig->SetInt (TEXT("Video Encoding"), TEXT("UseCustomSettings"), bUseCustomX264Settings); AppConfig->SetString(TEXT("Video Encoding"), TEXT("CustomSettings"), strCustomX264Settings); //-------------------------------------------------- BOOL bUnlockFPS = SendMessage(GetDlgItem(hwnd, IDC_UNLOCKHIGHFPS), BM_GETCHECK, 0, 0) == BST_CHECKED; AppConfig->SetInt (TEXT("Video"), TEXT("UnlockFPS"), bUnlockFPS); //------------------------------------ EnableWindow(GetDlgItem(hwnd, IDC_USEQSV), (bHasQSV || bUseQSV) && !bUseNVENC); AppConfig->SetInt(TEXT("Video Encoding"), TEXT("UseQSV"), bUseQSV); BOOL bQSVUseVideoEncoderSettings = SendMessage(GetDlgItem(hwnd, IDC_QSVUSEVIDEOENCODERSETTINGS), BM_GETCHECK, 0, 0) == BST_CHECKED; AppConfig->SetInt(TEXT("Video Encoding"), TEXT("QSVUseVideoEncoderSettings"), bQSVUseVideoEncoderSettings); //------------------------------------ EnableWindow(GetDlgItem(hwnd, IDC_USENVENC), (bHasNVENC || bUseNVENC) && !bUseQSV); AppConfig->SetInt(TEXT("Video Encoding"), TEXT("UseNVENC"), bUseNVENC && !bUseQSV); SendMessage(GetDlgItem(hwnd, IDC_USENVENC), BM_SETCHECK, (bUseNVENC && !bUseQSV) ? BST_CHECKED : BST_UNCHECKED, 0); //------------------------------------ BOOL bSyncToVideoTime = SendMessage(GetDlgItem(hwnd, IDC_SYNCTOVIDEOTIME), BM_GETCHECK, 0, 0) == BST_CHECKED; AppConfig->SetInt (TEXT("Audio"), TEXT("SyncToVideoTime"), bSyncToVideoTime); //-------------------------------------------------- BOOL bUseMicQPC = SendMessage(GetDlgItem(hwnd, IDC_USEMICQPC), BM_GETCHECK, 0, 0) == BST_CHECKED; GlobalConfig->SetInt(TEXT("Audio"), TEXT("UseMicQPC"), bUseMicQPC); //-------------------------------------------------- int globalAudioTimeAdjust = (int)SendMessage(GetDlgItem(hwnd, IDC_AUDIOTIMEADJUST), UDM_GETPOS32, 0, 0); GlobalConfig->SetInt(TEXT("Audio"), TEXT("GlobalAudioTimeAdjust"), globalAudioTimeAdjust); //-------------------------------------------------- BOOL bUseMicSyncFixHack = SendMessage(GetDlgItem(hwnd, IDC_MICSYNCFIX), BM_GETCHECK, 0, 0) == BST_CHECKED; GlobalConfig->SetInt(TEXT("Audio"), TEXT("UseMicSyncFixHack"), bUseMicSyncFixHack); //-------------------------------------------------- BOOL bLowLatencyAutoMode = SendMessage(GetDlgItem(hwnd, IDC_LATENCYMETHOD), BM_GETCHECK, 0, 0) == BST_CHECKED; int latencyFactor = GetDlgItemInt(hwnd, IDC_LATENCYTUNE, NULL, TRUE); AppConfig->SetInt (TEXT("Publish"), TEXT("LatencyFactor"), latencyFactor); AppConfig->SetInt (TEXT("Publish"), TEXT("LowLatencyMethod"), bLowLatencyAutoMode); //-------------------------------------------------- strTemp = GetCBText(GetDlgItem(hwnd, IDC_BINDIP)); AppConfig->SetString(TEXT("Publish"), TEXT("BindToIP"), strTemp); }
//************************************************************************** void CBCGPRibbonComboBox::DropDownList () { ASSERT_VALID (this); if (IsDisabled ()) { return; } if (m_pWndEdit->GetSafeHwnd () != NULL && !m_pWndEdit->IsWindowVisible ()) { return; } if (CBCGPPopupMenu::GetActiveMenu () != NULL) { if (CBCGPPopupMenu::GetActiveMenu ()->GetMenuBar () != m_pParentMenu) { CBCGPPopupMenu::GetActiveMenu ()->SendMessage (WM_CLOSE); return; } } CBCGPBaseRibbonElement::OnShowPopupMenu (); if (m_bIsCalculator) { if (m_pCalcPopup != NULL) { m_pCalcPopup->SendMessage (WM_CLOSE); m_pCalcPopup = NULL; SetDroppedDown(NULL); } else { if (CBCGPPopupMenu::GetActiveMenu () != NULL) { if (CBCGPPopupMenu::GetActiveMenu ()->GetMenuBar () != m_pParentMenu) { CBCGPPopupMenu::GetActiveMenu ()->SendMessage (WM_CLOSE); return; } } CBCGPBaseRibbonElement::OnShowPopupMenu (); double dblValue = 0.; CString strValue = GetEditText (); if (!strValue.IsEmpty ()) { strValue.Replace (_T(','), _T('.')); #if _MSC_VER < 1400 _stscanf (strValue, _T("%lf"), &dblValue); #else _stscanf_s (strValue, _T("%lf"), &dblValue); #endif } m_pCalcPopup = new CBCGPCalculatorPopup (dblValue, 0, this); m_pCalcPopup->m_bAutoDestroyParent = FALSE; m_pCalcPopup->SetParentRibbonElement (this); CBCGPCalculator* pCalc = DYNAMIC_DOWNCAST (CBCGPCalculator, m_pCalcPopup->GetMenuBar()); if (pCalc != NULL) { ASSERT_VALID (pCalc); if (!m_lstCalcAdditionalCommands.IsEmpty ()) { pCalc->SetAdditionalCommands (m_lstCalcAdditionalCommands); } if (!m_lstCalcExtCommands.IsEmpty ()) { pCalc->SetExtendedCommands (m_lstCalcExtCommands); } if (!m_strCalcDisplayFormat.IsEmpty()) { pCalc->SetDisplayFormat(m_strCalcDisplayFormat); } } CRect rectWindow; m_pWndEdit->GetWindowRect (rectWindow); if (!m_pCalcPopup->Create (m_pWndEdit, rectWindow.left - m_szMargin.cx, rectWindow.bottom + m_szMargin.cy, NULL, TRUE)) { ASSERT (FALSE); m_pCalcPopup = NULL; } else { SetDroppedDown(m_pCalcPopup); m_pCalcPopup->GetMenuBar()->SetFocus (); CRect rect; m_pCalcPopup->GetWindowRect (&rect); m_pCalcPopup->UpdateShadow (&rect); } } return; } CBCGPDropDownList* pList = new CBCGPDropDownList (this); pList->SetParentRibbonElement (this); int i = 0; for (POSITION pos = m_lstItems.GetHeadPosition (); pos != NULL; i++) { CString strItem = m_lstItems.GetNext (pos); pList->AddString (strItem); if (m_bHasEditBox && strItem == m_strEdit) { m_iSelIndex = i; } } pList->SetCurSel (m_iSelIndex); pList->SetMaxHeight (m_nDropDownHeight); pList->SetMinWidth (m_rect.Width ()); CWnd* pWndParent = GetParentWnd (); if (pWndParent == NULL) { ASSERT (FALSE); return; } const BOOL bIsRTL = (pWndParent->GetExStyle () & WS_EX_LAYOUTRTL); CRect rect = m_rectCommand.IsRectEmpty () ? m_rect : m_rectCommand; pWndParent->ClientToScreen (&rect); SetDroppedDown (pList); if (m_pParent != NULL) { ASSERT_VALID (m_pParent); m_pParent->HighlightPanel (NULL, CPoint (-1, -1)); } if (m_pWndEdit->GetSafeHwnd () != NULL) { m_pWndEdit->SetFocus (); m_pWndEdit->SetSel (0, -1); } if (m_bResizeDropDownList) { pList->EnableVertResize (2 * globalData.GetTextHeight ()); } pList->Track (CPoint ( bIsRTL ? rect.right : rect.left, rect.bottom), pWndParent->GetOwner ()); }
void SettingsEncoding::ApplySettings() { bool useQSV = SendMessage(GetDlgItem(hwnd, IDC_ENCODERQSV), BM_GETCHECK, 0, 0) == BST_CHECKED; bool useNVENC = SendMessage(GetDlgItem(hwnd, IDC_ENCODERNVENC), BM_GETCHECK, 0, 0) == BST_CHECKED; bool usex264 = !useQSV && !useNVENC; String vcodec = AppConfig->GetString(L"Video Encoding", L"Encoder"); bool useQSV_prev = !!(vcodec == L"QSV"); bool useNVENC_prev = !!(vcodec == L"NVENC"); if (!hasQSV && !useQSV && useQSV_prev && OBSMessageBox(hwnd, Str("Settings.Encoding.Video.EncoderQSVDisabledAfterApply"), Str("MessageBoxWarningCaption"), MB_ICONEXCLAMATION | MB_OKCANCEL) != IDOK) { SetAbortApplySettings(true); return; } if (!hasNVENC && !useNVENC && useNVENC_prev && OBSMessageBox(hwnd, Str("Settings.Encoding.Video.EncoderNVENCDisabledAfterApply"), Str("MessageBoxWarningCaption"), MB_ICONEXCLAMATION | MB_OKCANCEL) != IDOK) { SetAbortApplySettings(true); return; } EnableWindow(GetDlgItem(hwnd, IDC_ENCODERQSV), hasQSV || useQSV); EnableWindow(GetDlgItem(hwnd, IDC_ENCODERNVENC), hasNVENC || useNVENC); AppConfig->SetString(L"Video Encoding", L"Encoder", useQSV ? L"QSV" : useNVENC ? L"NVENC" : L"x264"); int quality = (int)SendMessage(GetDlgItem(hwnd, IDC_QUALITY), CB_GETCURSEL, 0, 0); if(quality != CB_ERR) AppConfig->SetInt(TEXT("Video Encoding"), TEXT("Quality"), quality); static const int minBitRate = 64; UINT bitrate = GetEditText(GetDlgItem(hwnd, IDC_MAXBITRATE)).ToInt(); if (bitrate < minBitRate) bitrate = minBitRate; AppConfig->SetInt(TEXT("Video Encoding"), TEXT("MaxBitrate"), bitrate); UINT bufSize = GetEditText(GetDlgItem(hwnd, IDC_BUFFERSIZE)).ToInt(); //if(bufSize < minBitRate) bufSize = bitrate; //R1CH: Allow users to enter 0 buffer size to disable VBV, its protected by checkbox anyway AppConfig->SetInt(TEXT("Video Encoding"), TEXT("BufferSize"), bufSize); if(App->GetVideoEncoder() != NULL) { if(App->GetVideoEncoder()->DynamicBitrateSupported()) { int oldBitrate = App->GetVideoEncoder()->GetBitRate(); App->GetVideoEncoder()->SetBitRate(bitrate, bufSize); if(oldBitrate != bitrate) Log(FormattedString(TEXT("Settings::Encoding: Changing bitrate from %dkb/s to %dkb/s"), oldBitrate, bitrate)); } } String strTemp = GetCBText(GetDlgItem(hwnd, IDC_AUDIOCODEC)); AppConfig->SetString(TEXT("Audio Encoding"), TEXT("Codec"), strTemp); strTemp = GetCBText(GetDlgItem(hwnd, IDC_AUDIOBITRATE)); AppConfig->SetString(TEXT("Audio Encoding"), TEXT("Bitrate"), strTemp); int curSel = (int)SendMessage(GetDlgItem(hwnd, IDC_AUDIOFORMAT), CB_GETCURSEL, 0, 0); if(curSel != CB_ERR) AppConfig->SetInt(TEXT("Audio Encoding"), TEXT("Format"), curSel); int curSelCh = (int)SendMessage(GetDlgItem(hwnd, IDC_AUDIOCHANNEL), CB_GETCURSEL, 0, 0); if(curSelCh != CB_ERR) AppConfig->SetInt(TEXT("Audio Encoding"), TEXT("isStereo"), curSelCh); bool bUseCBR = SendMessage(GetDlgItem(hwnd, IDC_USECBR), BM_GETCHECK, 0, 0) == BST_CHECKED; AppConfig->SetInt(TEXT("Video Encoding"), TEXT("UseCBR"), bUseCBR); bool bPadCBR = SendMessage(GetDlgItem(hwnd, IDC_PADCBR), BM_GETCHECK, 0, 0) == BST_CHECKED; AppConfig->SetInt(TEXT("Video Encoding"), TEXT("PadCBR"), bPadCBR); bool bCustomBuffer = SendMessage(GetDlgItem(hwnd, IDC_CUSTOMBUFFER), BM_GETCHECK, 0, 0) == BST_CHECKED; AppConfig->SetInt(TEXT("Video Encoding"), TEXT("UseBufferSize"), bCustomBuffer); }
INT_PTR SettingsEncoding::ProcMessage(UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_INITDIALOG: { HWND hwndTemp; LocalizeWindow(hwnd); //-------------------------------------------- bool showQSVConfigurationWarning = false; hasQSV = CheckQSVHardwareSupport(false, &showQSVConfigurationWarning); hasNVENC = CheckNVENCHardwareSupport(false); String vcodec = AppConfig->GetString(L"Video Encoding", L"Encoder"); bool useQSV = !!(vcodec == L"QSV"); bool useNVENC = !!(vcodec == L"NVENC"); bool usex264 = !useQSV && !useNVENC; SendMessage(GetDlgItem(hwnd, IDC_ENCODERX264), BM_SETCHECK, usex264, 0); SendMessage(GetDlgItem(hwnd, IDC_ENCODERQSV), BM_SETCHECK, useQSV, 0); SendMessage(GetDlgItem(hwnd, IDC_ENCODERNVENC), BM_SETCHECK, useNVENC, 0); EnableWindow(GetDlgItem(hwnd, IDC_ENCODERQSV), hasQSV || useQSV); EnableWindow(GetDlgItem(hwnd, IDC_ENCODERNVENC), hasNVENC || useNVENC); bool QSVOnUnsupportedWinVer = OSGetVersion() < 7 && IsKnownQSVCPUPlatform() && !hasQSV; ShowWindow(GetDlgItem(hwnd, IDC_QSV_WINVER_WARNING), QSVOnUnsupportedWinVer ? SW_SHOW : SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDC_QSV_CONFIG_WARNING), !QSVOnUnsupportedWinVer && showQSVConfigurationWarning ? SW_SHOW : SW_HIDE); //-------------------------------------------- HWND hwndToolTip = CreateWindowEx(NULL, TOOLTIPS_CLASS, NULL, WS_POPUP|TTS_NOPREFIX|TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, NULL, hinstMain, NULL); TOOLINFO ti; zero(&ti, sizeof(ti)); ti.cbSize = sizeof(ti); ti.uFlags = TTF_SUBCLASS|TTF_IDISHWND; ti.hwnd = hwnd; if (LocaleIsRTL()) ti.uFlags |= TTF_RTLREADING; SendMessage(hwndToolTip, TTM_SETMAXTIPWIDTH, 0, 500); SendMessage(hwndToolTip, TTM_SETDELAYTIME, TTDT_AUTOPOP, 8000); //-------------------------------------------- hwndTemp = GetDlgItem(hwnd, IDC_QUALITY); for(int i=0; i<=10; i++) SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)IntString(i).Array()); LoadSettingComboString(hwndTemp, TEXT("Video Encoding"), TEXT("Quality"), TEXT("8")); ti.lpszText = (LPWSTR)Str("Settings.Encoding.Video.QualityTooltip"); ti.uId = (UINT_PTR)hwndTemp; SendMessage(hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti); //-------------------------------------------- bool bUseCBR = AppConfig->GetInt(TEXT("Video Encoding"), TEXT("UseCBR"), 1) != 0; bool bPadCBR = AppConfig->GetInt(TEXT("Video Encoding"), TEXT("PadCBR"), 1) != 0; SendMessage(GetDlgItem(hwnd, IDC_USECBR), BM_SETCHECK, bUseCBR ? BST_CHECKED : BST_UNCHECKED, 0); SendMessage(GetDlgItem(hwnd, IDC_PADCBR), BM_SETCHECK, bPadCBR ? BST_CHECKED : BST_UNCHECKED, 0); EnableWindow(GetDlgItem(hwnd, IDC_QUALITY), !bUseCBR && (usex264 || useNVENC)); EnableWindow(GetDlgItem(hwnd, IDC_PADCBR), bUseCBR && (usex264 || useNVENC)); ti.lpszText = (LPWSTR)Str("Settings.Advanced.PadCBRToolTip"); ti.uId = (UINT_PTR)GetDlgItem(hwnd, IDC_PADCBR); SendMessage(hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti); //-------------------------------------------- int bitrate = LoadSettingEditInt(GetDlgItem(hwnd, IDC_MAXBITRATE), TEXT("Video Encoding"), TEXT("MaxBitrate"), 1000); int buffersize = LoadSettingEditInt(GetDlgItem(hwnd, IDC_BUFFERSIZE), TEXT("Video Encoding"), TEXT("BufferSize"), 1000); ti.lpszText = (LPWSTR)Str("Settings.Encoding.Video.MaxBitRateTooltip"); ti.uId = (UINT_PTR)GetDlgItem(hwnd, IDC_MAXBITRATE); SendMessage(hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti); ti.lpszText = (LPWSTR)Str("Settings.Encoding.Video.BufferSizeTooltip"); ti.uId = (UINT_PTR)GetDlgItem(hwnd, IDC_BUFFERSIZE); SendMessage(hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti); //-------------------------------------------- bool bUseBufferSize = AppConfig->GetInt(TEXT("Video Encoding"), TEXT("UseBufferSize"), 0) != 0; SendMessage(GetDlgItem(hwnd, IDC_CUSTOMBUFFER), BM_SETCHECK, bUseBufferSize ? BST_CHECKED : BST_UNCHECKED, 0); EnableWindow(GetDlgItem(hwnd, IDC_BUFFERSIZE), bUseBufferSize); //-------------------------------------------- hwndTemp = GetDlgItem(hwnd, IDC_AUDIOCODEC); SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("MP3")); #ifdef USE_AAC if(1)//OSGetVersion() >= 7) { SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("AAC")); LoadSettingComboString(hwndTemp, TEXT("Audio Encoding"), TEXT("Codec"), TEXT("AAC")); } else LoadSettingComboString(hwndTemp, TEXT("Audio Encoding"), TEXT("Codec"), TEXT("MP3")); #else LoadSettingComboString(hwndTemp, TEXT("Audio Encoding"), TEXT("Codec"), TEXT("MP3")); #endif //-------------------------------------------- hwndTemp = GetDlgItem(hwnd, IDC_AUDIOFORMAT); BOOL isAAC = SendMessage(GetDlgItem(hwnd, IDC_AUDIOCODEC), CB_GETCURSEL, 0, 0) == 1; if (isAAC) { SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("44.1kHz")); SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("48kHz")); } else { SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("44.1kHz")); } LoadSettingComboInt(hwndTemp, TEXT("Audio Encoding"), TEXT("Format"), 1, isAAC ? 1 : 0); //-------------------------------------------- hwndTemp = GetDlgItem(hwnd, IDC_AUDIOCHANNEL); SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("mono")); SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("stereo")); LoadSettingComboInt(hwndTemp, TEXT("Audio Encoding"), TEXT("isStereo"), 1, 1); //-------------------------------------------- hwndTemp = GetDlgItem(hwnd, IDC_AUDIOBITRATE); BOOL isStereo = SendMessage(GetDlgItem(hwnd, IDC_AUDIOCHANNEL), CB_GETCURSEL, 0, 0) == 1; if (isStereo) { SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("48")); SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("64")); SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("80")); SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("96"));//default SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("112")); SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("128")); SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("160")); SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("192")); SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("256")); SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("320")); } else { SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("32")); SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("40")); SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("48"));//default SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("56")); SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("64")); SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("80")); SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("96")); SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("128")); SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)TEXT("160")); } LoadSettingComboString(hwndTemp, TEXT("Audio Encoding"), TEXT("Bitrate"), isStereo ? TEXT("96") : TEXT("48")); //-------------------------------------------- ShowWindow(GetDlgItem(hwnd, IDC_INFO), SW_HIDE); SetChangedSettings(false); return TRUE; } case WM_COMMAND: { bool bDataChanged = false; bool useQSV = SendMessage(GetDlgItem(hwnd, IDC_ENCODERQSV), BM_GETCHECK, 0, 0) == BST_CHECKED; bool useNVENC = SendMessage(GetDlgItem(hwnd, IDC_ENCODERNVENC), BM_GETCHECK, 0, 0) == BST_CHECKED; bool usex264 = !useQSV && !useNVENC; bool useCBR = SendMessage(GetDlgItem(hwnd, IDC_USECBR), BM_GETCHECK, 0, 0) == BST_CHECKED; switch(LOWORD(wParam)) { case IDC_QUALITY: case IDC_AUDIOBITRATE: if(HIWORD(wParam) == CBN_SELCHANGE) { bDataChanged = true; } break; case IDC_AUDIOFORMAT: if(HIWORD(wParam) == CBN_SELCHANGE) { bDataChanged = true; } break; case IDC_AUDIOCHANNEL: if(HIWORD(wParam) == CBN_SELCHANGE) { HWND hwndAudioBitrate = GetDlgItem(hwnd, IDC_AUDIOBITRATE); SendMessage(hwndAudioBitrate, CB_RESETCONTENT, 0, 0); BOOL isStereo = SendMessage(GetDlgItem(hwnd, IDC_AUDIOCHANNEL), CB_GETCURSEL, 0, 0) == 1; if (isStereo) { SendMessage(hwndAudioBitrate, CB_ADDSTRING, 0, (LPARAM)TEXT("48")); SendMessage(hwndAudioBitrate, CB_ADDSTRING, 0, (LPARAM)TEXT("64")); SendMessage(hwndAudioBitrate, CB_ADDSTRING, 0, (LPARAM)TEXT("80")); SendMessage(hwndAudioBitrate, CB_ADDSTRING, 0, (LPARAM)TEXT("96"));//default SendMessage(hwndAudioBitrate, CB_ADDSTRING, 0, (LPARAM)TEXT("112")); SendMessage(hwndAudioBitrate, CB_ADDSTRING, 0, (LPARAM)TEXT("128")); SendMessage(hwndAudioBitrate, CB_ADDSTRING, 0, (LPARAM)TEXT("160")); SendMessage(hwndAudioBitrate, CB_ADDSTRING, 0, (LPARAM)TEXT("192")); SendMessage(hwndAudioBitrate, CB_ADDSTRING, 0, (LPARAM)TEXT("256")); SendMessage(hwndAudioBitrate, CB_ADDSTRING, 0, (LPARAM)TEXT("320")); } else { SendMessage(hwndAudioBitrate, CB_ADDSTRING, 0, (LPARAM)TEXT("32")); SendMessage(hwndAudioBitrate, CB_ADDSTRING, 0, (LPARAM)TEXT("40")); SendMessage(hwndAudioBitrate, CB_ADDSTRING, 0, (LPARAM)TEXT("48"));//default SendMessage(hwndAudioBitrate, CB_ADDSTRING, 0, (LPARAM)TEXT("56")); SendMessage(hwndAudioBitrate, CB_ADDSTRING, 0, (LPARAM)TEXT("64")); SendMessage(hwndAudioBitrate, CB_ADDSTRING, 0, (LPARAM)TEXT("80")); SendMessage(hwndAudioBitrate, CB_ADDSTRING, 0, (LPARAM)TEXT("96")); SendMessage(hwndAudioBitrate, CB_ADDSTRING, 0, (LPARAM)TEXT("128")); SendMessage(hwndAudioBitrate, CB_ADDSTRING, 0, (LPARAM)TEXT("160")); } SendMessage(hwndAudioBitrate, CB_SETCURSEL, isStereo ? 3 : 2, 0); bDataChanged = true; } break; case IDC_AUDIOCODEC: if(HIWORD(wParam) == CBN_SELCHANGE) { HWND hwndAudioFormat = GetDlgItem(hwnd, IDC_AUDIOFORMAT); SendMessage(hwndAudioFormat, CB_RESETCONTENT, 0, 0); BOOL isAAC = SendMessage(GetDlgItem(hwnd, IDC_AUDIOCODEC), CB_GETCURSEL, 0, 0) == 1; if (isAAC) { SendMessage(hwndAudioFormat, CB_ADDSTRING, 0, (LPARAM)TEXT("44.1kHz")); SendMessage(hwndAudioFormat, CB_ADDSTRING, 0, (LPARAM)TEXT("48kHz")); } else { SendMessage(hwndAudioFormat, CB_ADDSTRING, 0, (LPARAM)TEXT("44.1kHz")); } SendMessage(hwndAudioFormat, CB_SETCURSEL, isAAC ? 1 : 0, 0); bDataChanged = true; } break; case IDC_MAXBITRATE: if(HIWORD(wParam) == EN_CHANGE) { bool bCustomBuffer = SendMessage(GetDlgItem(hwnd, IDC_CUSTOMBUFFER), BM_GETCHECK, 0, 0) == BST_CHECKED; if (!bCustomBuffer) { String strText = GetEditText((HWND)lParam); SetWindowText(GetDlgItem(hwnd, IDC_BUFFERSIZE), strText); } if (App->GetVideoEncoder() && App->GetVideoEncoder()->DynamicBitrateSupported()) SetChangedSettings(true); else bDataChanged = true; } break; case IDC_BUFFERSIZE: if (HIWORD(wParam) == EN_CHANGE) { if (App->GetVideoEncoder() && App->GetVideoEncoder()->DynamicBitrateSupported()) SetChangedSettings(true); else bDataChanged = true; } break; case IDC_ENCODERX264: case IDC_ENCODERQSV: case IDC_ENCODERNVENC: if (HIWORD(wParam) == BN_CLICKED) bDataChanged = true; EnableWindow(GetDlgItem(hwnd, IDC_QUALITY), !useCBR && (usex264 || useNVENC)); EnableWindow(GetDlgItem(hwnd, IDC_PADCBR), useCBR && (usex264 || useNVENC)); break; case IDC_CUSTOMBUFFER: case IDC_USECBR: case IDC_PADCBR: if (HIWORD(wParam) == BN_CLICKED) { bool bChecked = SendMessage((HWND)lParam, BM_GETCHECK, 0, 0) == BST_CHECKED; if(LOWORD(wParam) == IDC_CUSTOMBUFFER) EnableWindow(GetDlgItem(hwnd, IDC_BUFFERSIZE), bChecked); else if(LOWORD(wParam) == IDC_USECBR) { EnableWindow(GetDlgItem(hwnd, IDC_QUALITY), !bChecked && (usex264 || useNVENC)); EnableWindow(GetDlgItem(hwnd, IDC_PADCBR), bChecked && (usex264 || useNVENC)); } bDataChanged = true; } break; } if(bDataChanged) { if (App->GetVideoEncoder()) ShowWindow(GetDlgItem(hwnd, IDC_INFO), SW_SHOW); SetChangedSettings(true); } break; } } return FALSE; }
INT_PTR CALLBACK ConfigureBitmapProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static bool bSelectingColor = false; static bool bMouseDown = false; static ColorSelectionData colorData; switch(message) { case WM_INITDIALOG: { ConfigBitmapInfo *configInfo = (ConfigBitmapInfo*)lParam; SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR)configInfo); LocalizeWindow(hwnd); //-------------------------- CTSTR lpBitmap = configInfo->data->GetString(TEXT("path")); SetWindowText(GetDlgItem(hwnd, IDC_BITMAP), lpBitmap); //-------------------------- int opacity = configInfo->data->GetInt(TEXT("opacity"), 100); if(opacity > 100) opacity = 100; else if(opacity < 0) opacity = 0; SendMessage(GetDlgItem(hwnd, IDC_OPACITY), UDM_SETRANGE32, 0, 100); SendMessage(GetDlgItem(hwnd, IDC_OPACITY), UDM_SETPOS32, 0, opacity); //-------------------------- DWORD color = configInfo->data->GetInt(TEXT("color"), 0xFFFFFFFF); DWORD colorkey = configInfo->data->GetInt(TEXT("keyColor"), 0xFFFFFFFF); UINT similarity = configInfo->data->GetInt(TEXT("keySimilarity"), 10); UINT blend = configInfo->data->GetInt(TEXT("keyBlend"), 0); CCSetColor(GetDlgItem(hwnd, IDC_COLOR), color); CCSetColor(GetDlgItem(hwnd, IDC_KEYCOLOR), colorkey); SendMessage(GetDlgItem(hwnd, IDC_BASETHRESHOLD), UDM_SETRANGE32, 0, 100); SendMessage(GetDlgItem(hwnd, IDC_BASETHRESHOLD), UDM_SETPOS32, 0, similarity); SendMessage(GetDlgItem(hwnd, IDC_BLEND), UDM_SETRANGE32, 0, 100); SendMessage(GetDlgItem(hwnd, IDC_BLEND), UDM_SETPOS32, 0, blend); //-------------------------- int monitor = configInfo->data->GetInt(TEXT("monitor"), 0); SendMessage(GetDlgItem(hwnd, IDC_MONITOR), BM_SETCHECK, monitor ? BST_CHECKED : BST_UNCHECKED, 0); int colorkeyChk = configInfo->data->GetInt(TEXT("useColorKey"), 0); SendMessage(GetDlgItem(hwnd, IDC_USECOLORKEY), BM_SETCHECK, colorkeyChk ? BST_CHECKED : BST_UNCHECKED, 0); EnableWindow(GetDlgItem(hwnd, IDC_KEYCOLOR), colorkeyChk); EnableWindow(GetDlgItem(hwnd, IDC_SELECT), colorkeyChk); EnableWindow(GetDlgItem(hwnd, IDC_BASETHRESHOLD_EDIT), colorkeyChk); EnableWindow(GetDlgItem(hwnd, IDC_BASETHRESHOLD), colorkeyChk); EnableWindow(GetDlgItem(hwnd, IDC_BLEND_EDIT), colorkeyChk); EnableWindow(GetDlgItem(hwnd, IDC_BLEND), colorkeyChk); return TRUE; } case WM_LBUTTONDOWN: if(bSelectingColor) { bMouseDown = true; CCSetColor(GetDlgItem(hwnd, IDC_KEYCOLOR), colorData.GetColor()); ConfigureBitmapProc(hwnd, WM_COMMAND, MAKEWPARAM(IDC_KEYCOLOR, CCN_CHANGED), (LPARAM)GetDlgItem(hwnd, IDC_KEYCOLOR)); } break; case WM_MOUSEMOVE: if(bSelectingColor && bMouseDown) { CCSetColor(GetDlgItem(hwnd, IDC_KEYCOLOR), colorData.GetColor()); ConfigureBitmapProc(hwnd, WM_COMMAND, MAKEWPARAM(IDC_KEYCOLOR, CCN_CHANGED), (LPARAM)GetDlgItem(hwnd, IDC_KEYCOLOR)); } break; case WM_LBUTTONUP: if(bSelectingColor) { colorData.Clear(); ReleaseCapture(); bMouseDown = false; bSelectingColor = false; ConfigDesktopSourceInfo *configData = (ConfigDesktopSourceInfo*)GetWindowLongPtr(hwnd, DWLP_USER); ImageSource *source = API->GetSceneImageSource(configData->lpName); if(source) source->SetInt(TEXT("useColorKey"), true); } break; case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_BROWSE: { TCHAR lpFile[MAX_PATH+1]; zero(lpFile, sizeof(lpFile)); OPENFILENAME ofn; zero(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.lpstrFile = lpFile; ofn.hwndOwner = hwnd; ofn.nMaxFile = MAX_PATH; ofn.lpstrFilter = TEXT("All Formats (*.bmp;*.dds;*.jpg;*.png;*.gif)\0*.bmp;*.dds;*.jpg;*.png;*.gif\0"); ofn.nFilterIndex = 1; ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; TCHAR curDirectory[MAX_PATH+1]; GetCurrentDirectory(MAX_PATH, curDirectory); BOOL bOpenFile = GetOpenFileName(&ofn); SetCurrentDirectory(curDirectory); if(bOpenFile) SetWindowText(GetDlgItem(hwnd, IDC_BITMAP), lpFile); break; } case IDC_USECOLORKEY: { HWND hwndUseColorKey = (HWND)lParam; BOOL bUseColorKey = SendMessage(hwndUseColorKey, BM_GETCHECK, 0, 0) == BST_CHECKED; ConfigDesktopSourceInfo *configData = (ConfigDesktopSourceInfo*)GetWindowLongPtr(hwnd, DWLP_USER); ImageSource *source = API->GetSceneImageSource(configData->lpName); if(source) source->SetInt(TEXT("useColorKey"), bUseColorKey); EnableWindow(GetDlgItem(hwnd, IDC_KEYCOLOR), bUseColorKey); EnableWindow(GetDlgItem(hwnd, IDC_SELECT), bUseColorKey); EnableWindow(GetDlgItem(hwnd, IDC_BASETHRESHOLD_EDIT), bUseColorKey); EnableWindow(GetDlgItem(hwnd, IDC_BASETHRESHOLD), bUseColorKey); EnableWindow(GetDlgItem(hwnd, IDC_BLEND_EDIT), bUseColorKey); EnableWindow(GetDlgItem(hwnd, IDC_BLEND), bUseColorKey); break; } case IDC_KEYCOLOR: { ConfigDesktopSourceInfo *configData = (ConfigDesktopSourceInfo*)GetWindowLongPtr(hwnd, DWLP_USER); ImageSource *source = API->GetSceneImageSource(configData->lpName); if(source) { DWORD color = CCGetColor((HWND)lParam); source->SetInt(TEXT("keyColor"), color); } break; } case IDC_SELECT: { if(!bSelectingColor) { if(colorData.Init()) { bMouseDown = false; bSelectingColor = true; SetCapture(hwnd); HCURSOR hCursor = (HCURSOR)LoadImage(hinstMain, MAKEINTRESOURCE(IDC_COLORPICKER), IMAGE_CURSOR, 32, 32, 0); SetCursor(hCursor); ConfigDesktopSourceInfo *configData = (ConfigDesktopSourceInfo*)GetWindowLongPtr(hwnd, DWLP_USER); ImageSource *source = API->GetSceneImageSource(configData->lpName); if(source) source->SetInt(TEXT("useColorKey"), false); } else colorData.Clear(); } break; } break; case IDC_OPACITY_EDIT: case IDC_BASETHRESHOLD_EDIT: case IDC_BLEND_EDIT: if(HIWORD(wParam) == EN_CHANGE) { ConfigDesktopSourceInfo *configData = (ConfigDesktopSourceInfo*)GetWindowLongPtr(hwnd, DWLP_USER); if(configData) { ImageSource *source = API->GetSceneImageSource(configData->lpName); if(source) { HWND hwndVal = NULL; switch(LOWORD(wParam)) { case IDC_BASETHRESHOLD_EDIT: hwndVal = GetDlgItem(hwnd, IDC_BASETHRESHOLD); break; case IDC_BLEND_EDIT: hwndVal = GetDlgItem(hwnd, IDC_BLEND); break; case IDC_OPACITY_EDIT: hwndVal = GetDlgItem(hwnd, IDC_OPACITY2); break; } int val = (int)SendMessage(hwndVal, UDM_GETPOS32, 0, 0); switch(LOWORD(wParam)) { case IDC_BASETHRESHOLD_EDIT: source->SetInt(TEXT("keySimilarity"), val); break; case IDC_BLEND_EDIT: source->SetInt(TEXT("keyBlend"), val); break; case IDC_OPACITY_EDIT: source->SetInt(TEXT("opacity"), val); break; } } } } break; case IDOK: { String strBitmap = GetEditText(GetDlgItem(hwnd, IDC_BITMAP)); if(strBitmap.IsEmpty()) { MessageBox(hwnd, Str("Sources.BitmapSource.Empty"), NULL, 0); break; } ConfigBitmapInfo *configInfo = (ConfigBitmapInfo*)GetWindowLongPtr(hwnd, DWLP_USER); configInfo->data->SetString(TEXT("path"), strBitmap); BOOL bFailed; int opacity = (int)SendMessage(GetDlgItem(hwnd, IDC_OPACITY), UDM_GETPOS32, 0, (LPARAM)&bFailed); if(opacity > 100) opacity = 100; else if(opacity < 0) opacity = 0; configInfo->data->SetInt(TEXT("opacity"), bFailed ? 100 : opacity); DWORD color = CCGetColor(GetDlgItem(hwnd, IDC_COLOR)); configInfo->data->SetInt(TEXT("color"), color); BOOL bUseColorKey = SendMessage(GetDlgItem(hwnd, IDC_USECOLORKEY), BM_GETCHECK, 0, 0) == BST_CHECKED; DWORD keyColor = CCGetColor(GetDlgItem(hwnd, IDC_KEYCOLOR)); UINT keySimilarity = (UINT)SendMessage(GetDlgItem(hwnd, IDC_BASETHRESHOLD), UDM_GETPOS32, 0, 0); UINT keyBlend = (UINT)SendMessage(GetDlgItem(hwnd, IDC_BLEND), UDM_GETPOS32, 0, 0); configInfo->data->SetInt(TEXT("useColorKey"), bUseColorKey); configInfo->data->SetInt(TEXT("keyColor"), keyColor); configInfo->data->SetInt(TEXT("keySimilarity"), keySimilarity); configInfo->data->SetInt(TEXT("keyBlend"), keyBlend); int monitor = (int)SendMessage(GetDlgItem(hwnd, IDC_MONITOR), BM_GETCHECK, 0, 0); if (monitor == BST_CHECKED) configInfo->data->SetInt(TEXT("monitor"), 1); else configInfo->data->SetInt(TEXT("monitor"), 0); } case IDCANCEL: EndDialog(hwnd, LOWORD(wParam)); break; } break; } return 0; }
INT_PTR SettingsGeneral::ProcMessage(UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_INITDIALOG: { LocalizeWindow(hwnd); //---------------------------------------------- HWND hwndTemp = GetDlgItem(hwnd, IDC_LANGUAGE); OSFindData ofd; HANDLE hFind; if(hFind = OSFindFirstFile(TEXT("locale/*.txt"), ofd)) { do { if(ofd.bDirectory) continue; String langCode = GetPathFileName(ofd.fileName); LocaleNativeName *langInfo = GetLocaleNativeName(langCode); if(langInfo) { UINT id = (UINT)SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)langInfo->lpNative); SendMessage(hwndTemp, CB_SETITEMDATA, id, (LPARAM)langInfo->lpCode); if(App->strLanguage.CompareI(langCode)) SendMessage(hwndTemp, CB_SETCURSEL, id, 0); } } while(OSFindNextFile(hFind, ofd)); OSFindClose(hFind); } //---------------------------------------------- String strCurProfile = GlobalConfig->GetString(TEXT("General"), TEXT("Profile")); hwndTemp = GetDlgItem(hwnd, IDC_PROFILE); StringList profileList; App->GetProfiles(profileList); for(UINT i=0; i<profileList.Num(); i++) { UINT id = (UINT)SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)profileList[i].Array()); if(profileList[i].CompareI(strCurProfile)) SendMessage(hwndTemp, CB_SETCURSEL, id, 0); } EnableWindow(hwndTemp, !App->bRunning); EnableWindow(GetDlgItem(hwnd, IDC_ADD), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_RENAME), FALSE); UINT numItems = (UINT)SendMessage(hwndTemp, CB_GETCOUNT, 0, 0); EnableWindow(GetDlgItem(hwnd, IDC_REMOVE), (numItems > 1) && !App->bRunning); //---------------------------------------------- bool bShowNotificationAreaIcon = AppConfig->GetInt(TEXT("General"), TEXT("ShowNotificationAreaIcon"), 0) != 0; SendMessage(GetDlgItem(hwnd, IDC_NOTIFICATIONICON), BM_SETCHECK, bShowNotificationAreaIcon ? BST_CHECKED : BST_UNCHECKED, 0); bool bMinimizeToNotificationArea = AppConfig->GetInt(TEXT("General"), TEXT("MinimizeToNotificationArea"), 0) != 0; SendMessage(GetDlgItem(hwnd, IDC_MINIZENOTIFICATION), BM_SETCHECK, bMinimizeToNotificationArea ? BST_CHECKED : BST_UNCHECKED, 0); //---------------------------------------------- App->bEnableProjectorCursor = GlobalConfig->GetInt(L"General", L"EnableProjectorCursor", 1) != 0; SendMessage(GetDlgItem(hwnd, IDC_ENABLEPROJECTORCURSOR), BM_SETCHECK, App->bEnableProjectorCursor ? BST_CHECKED : BST_UNCHECKED, 0); //---------------------------------------------- bool showLogWindowOnLaunch = GlobalConfig->GetInt(TEXT("General"), TEXT("ShowLogWindowOnLaunch")) != 0; SendMessage(GetDlgItem(hwnd, IDC_SHOWLOGWINDOWONLAUNCH), BM_SETCHECK, showLogWindowOnLaunch ? BST_CHECKED : BST_UNCHECKED, 0); //---------------------------------------------- SetChangedSettings(false); return TRUE; } case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_LANGUAGE: { if(HIWORD(wParam) != CBN_SELCHANGE) break; HWND hwndTemp = (HWND)lParam; SetWindowText(GetDlgItem(hwnd, IDC_INFO), Str("Settings.General.Restart")); ShowWindow(GetDlgItem(hwnd, IDC_INFO), SW_SHOW); SetChangedSettings(true); break; } case IDC_PROFILE: if (App->bRunning) { HWND cb = (HWND)lParam; String curProfile = GlobalConfig->GetString(TEXT("General"), TEXT("Profile")); UINT numItems = (UINT)SendMessage(cb, CB_GETCOUNT, 0, 0); for (UINT i = 0; i < numItems; i++) { if (GetCBText(cb, i).Compare(curProfile)) SendMessage(cb, CB_SETCURSEL, i, 0); } break; } if(HIWORD(wParam) == CBN_EDITCHANGE) { String strText = GetEditText((HWND)lParam).KillSpaces(); EnableWindow(GetDlgItem(hwnd, IDC_REMOVE), FALSE); if(strText.IsValid()) { if(IsValidFileName(strText)) { String strCurProfile = GlobalConfig->GetString(TEXT("General"), TEXT("Profile")); UINT id = (UINT)SendMessage((HWND)lParam, CB_FINDSTRINGEXACT, -1, (LPARAM)strText.Array()); EnableWindow(GetDlgItem(hwnd, IDC_ADD), (id == CB_ERR)); EnableWindow(GetDlgItem(hwnd, IDC_RENAME), (id == CB_ERR) || strCurProfile.CompareI(strText)); ShowWindow(GetDlgItem(hwnd, IDC_INFO), SW_HIDE); break; } SetWindowText(GetDlgItem(hwnd, IDC_INFO), Str("Settings.General.InvalidName")); ShowWindow(GetDlgItem(hwnd, IDC_INFO), SW_SHOW); } else ShowWindow(GetDlgItem(hwnd, IDC_INFO), SW_HIDE); EnableWindow(GetDlgItem(hwnd, IDC_ADD), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_RENAME), FALSE); } else if(HIWORD(wParam) == CBN_SELCHANGE) { EnableWindow(GetDlgItem(hwnd, IDC_ADD), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_RENAME), FALSE); String strProfile = GetCBText((HWND)lParam); String strProfilePath; strProfilePath << lpAppDataPath << TEXT("\\profiles\\") << strProfile << TEXT(".ini"); if(!AppConfig->Open(strProfilePath)) { OBSMessageBox(hwnd, TEXT("Error - unable to open ini file"), NULL, 0); break; } App->ReloadIniSettings(); SetWindowText(GetDlgItem(hwnd, IDC_INFO), Str("Settings.Info")); ShowWindow(GetDlgItem(hwnd, IDC_INFO), SW_SHOW); GlobalConfig->SetString(TEXT("General"), TEXT("Profile"), strProfile); App->ResetProfileMenu(); App->ResetApplicationName(); App->UpdateNotificationAreaIcon(); UINT numItems = (UINT)SendMessage(GetDlgItem(hwnd, IDC_PROFILE), CB_GETCOUNT, 0, 0); EnableWindow(GetDlgItem(hwnd, IDC_REMOVE), (numItems > 1)); App->ResizeWindow(false); } break; case IDC_RENAME: case IDC_ADD: if (App->bRunning) break; if(HIWORD(wParam) == BN_CLICKED) { HWND hwndProfileList = GetDlgItem(hwnd, IDC_PROFILE); String strProfile = GetEditText(hwndProfileList).KillSpaces(); SetWindowText(hwndProfileList, strProfile); if(strProfile.IsEmpty()) break; bool bRenaming = (LOWORD(wParam) == IDC_RENAME); String strCurProfile = GlobalConfig->GetString(TEXT("General"), TEXT("Profile")); String strCurProfilePath; strCurProfilePath << lpAppDataPath << TEXT("\\profiles\\") << strCurProfile << TEXT(".ini"); String strProfilePath; strProfilePath << lpAppDataPath << TEXT("\\profiles\\") << strProfile << TEXT(".ini"); if((!bRenaming || !strProfilePath.CompareI(strCurProfilePath)) && OSFileExists(strProfilePath)) OBSMessageBox(hwnd, Str("Settings.General.ProfileExists"), NULL, 0); else { if(bRenaming) { if(!MoveFile(strCurProfilePath, strProfilePath)) break; AppConfig->SetFilePath(strProfilePath); UINT curID = (UINT)SendMessage(hwndProfileList, CB_FINDSTRINGEXACT, -1, (LPARAM)strCurProfile.Array()); if(curID != CB_ERR) SendMessage(hwndProfileList, CB_DELETESTRING, curID, 0); } else { if(!AppConfig->SaveAs(strProfilePath)) { OBSMessageBox(hwnd, TEXT("Error - unable to create new profile, could not create file"), NULL, 0); break; } } UINT id = (UINT)SendMessage(hwndProfileList, CB_ADDSTRING, 0, (LPARAM)strProfile.Array()); SendMessage(hwndProfileList, CB_SETCURSEL, id, 0); GlobalConfig->SetString(TEXT("General"), TEXT("Profile"), strProfile); UINT numItems = (UINT)SendMessage(hwndProfileList, CB_GETCOUNT, 0, 0); EnableWindow(GetDlgItem(hwnd, IDC_REMOVE), (numItems > 1)); EnableWindow(GetDlgItem(hwnd, IDC_RENAME), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_ADD), FALSE); App->ResetProfileMenu(); App->ResetApplicationName(); } } break; case IDC_REMOVE: if (App->bRunning) break; { HWND hwndProfileList = GetDlgItem(hwnd, IDC_PROFILE); String strCurProfile = GlobalConfig->GetString(TEXT("General"), TEXT("Profile")); UINT numItems = (UINT)SendMessage(hwndProfileList, CB_GETCOUNT, 0, 0); String strConfirm = Str("Settings.General.ConfirmDelete"); strConfirm.FindReplace(TEXT("$1"), strCurProfile); if(OBSMessageBox(hwnd, strConfirm, Str("DeleteConfirm.Title"), MB_YESNO) == IDYES) { UINT id = (UINT)SendMessage(hwndProfileList, CB_FINDSTRINGEXACT, -1, (LPARAM)strCurProfile.Array()); if(id != CB_ERR) { SendMessage(hwndProfileList, CB_DELETESTRING, id, 0); if(id == numItems-1) id--; SendMessage(hwndProfileList, CB_SETCURSEL, id, 0); DialogProc(hwnd, WM_COMMAND, MAKEWPARAM(IDC_PROFILE, CBN_SELCHANGE), (LPARAM)hwndProfileList); String strCurProfilePath; strCurProfilePath << lpAppDataPath << TEXT("\\profiles\\") << strCurProfile << TEXT(".ini"); OSDeleteFile(strCurProfilePath); App->ResetProfileMenu(); } } break; } case IDC_NOTIFICATIONICON: if (SendMessage(GetDlgItem(hwnd, IDC_NOTIFICATIONICON), BM_GETCHECK, 0, 0) == BST_UNCHECKED) { SendMessage(GetDlgItem(hwnd, IDC_MINIZENOTIFICATION), BM_SETCHECK, BST_UNCHECKED, 0); } SetChangedSettings(true); break; case IDC_MINIZENOTIFICATION: if (SendMessage(GetDlgItem(hwnd, IDC_MINIZENOTIFICATION), BM_GETCHECK, 0, 0) == BST_CHECKED) { SendMessage(GetDlgItem(hwnd, IDC_NOTIFICATIONICON), BM_SETCHECK, BST_CHECKED, 0); } SetChangedSettings(true); break; case IDC_ENABLEPROJECTORCURSOR: case IDC_SHOWLOGWINDOWONLAUNCH: SetChangedSettings(true); break; } } return FALSE; }
void SettingsAdvanced::ApplySettings() { //-------------------------------------------------- String strTemp = GetCBText(GetDlgItem(hwnd, IDC_PRESET)); AppConfig->SetString(TEXT("Video Encoding"), TEXT("Preset"), strTemp); //------------------------------------ strTemp = GetCBText(GetDlgItem(hwnd, IDC_X264PROFILE)); AppConfig->SetString(TEXT("Video Encoding"), TEXT("X264Profile"), strTemp); //-------------------------------------------------- bool bUseMTOptimizations = SendMessage(GetDlgItem(hwnd, IDC_USEMULTITHREADEDOPTIMIZATIONS), BM_GETCHECK, 0, 0) == BST_CHECKED; AppConfig->SetInt(TEXT("General"), TEXT("UseMultithreadedOptimizations"), bUseMTOptimizations); int priority = (int)SendMessage(GetDlgItem(hwnd, IDC_PRIORITY), CB_GETCURSEL, 0, 0); switch (priority) { case 0: strTemp = TEXT("High"); break; case 1: strTemp = TEXT("Above Normal"); break; case 2: strTemp = TEXT("Normal"); break; case 3: strTemp = TEXT("Idle"); break; } AppConfig->SetString(TEXT("General"), TEXT("Priority"), strTemp); //-------------------------------------------------- UINT sceneBufferTime = (UINT)SendMessage(GetDlgItem(hwnd, IDC_SCENEBUFFERTIME), UDM_GETPOS32, 0, 0); GlobalConfig->SetInt(TEXT("General"), TEXT("SceneBufferingTime"), sceneBufferTime); //-------------------------------------------------- bool bDisablePreviewEncoding = SendMessage(GetDlgItem(hwnd, IDC_DISABLEPREVIEWENCODING), BM_GETCHECK, 0, 0) == BST_CHECKED; GlobalConfig->SetInt(TEXT("General"), TEXT("DisablePreviewEncoding"), bDisablePreviewEncoding); //-------------------------------------------------- bool bAllowOtherHotkeyModifiers = SendMessage(GetDlgItem(hwnd, IDC_ALLOWOTHERHOTKEYMODIFIERS), BM_GETCHECK, 0, 0) == BST_CHECKED; GlobalConfig->SetInt(TEXT("General"), TEXT("AllowOtherHotkeyModifiers"), bAllowOtherHotkeyModifiers); //-------------------------------------------------- UINT keyframeInt = (UINT)SendMessage(GetDlgItem(hwnd, IDC_KEYFRAMEINTERVAL), UDM_GETPOS32, 0, 0); AppConfig->SetInt(TEXT("Video Encoding"), TEXT("KeyframeInterval"), keyframeInt); //-------------------------------------------------- bool bUseCFR = SendMessage(GetDlgItem(hwnd, IDC_USECFR), BM_GETCHECK, 0, 0) == BST_CHECKED; AppConfig->SetInt (TEXT("Video Encoding"), TEXT("UseCFR"), bUseCFR); //-------------------------------------------------- BOOL bUseCustomX264Settings = SendMessage(GetDlgItem(hwnd, IDC_USEVIDEOENCODERSETTINGS), BM_GETCHECK, 0, 0) == BST_CHECKED; String strCustomX264Settings = GetEditText(GetDlgItem(hwnd, IDC_VIDEOENCODERSETTINGS)); AppConfig->SetInt (TEXT("Video Encoding"), TEXT("UseCustomSettings"), bUseCustomX264Settings); AppConfig->SetString(TEXT("Video Encoding"), TEXT("CustomSettings"), strCustomX264Settings); //-------------------------------------------------- AppConfig->SetString(L"Video Encoding", L"CustomQSVSettings", GetEditText(GetDlgItem(hwnd, IDC_QSVVIDEOENCODERSETTINGS))); //-------------------------------------------------- BOOL bUnlockFPS = SendMessage(GetDlgItem(hwnd, IDC_UNLOCKHIGHFPS), BM_GETCHECK, 0, 0) == BST_CHECKED; AppConfig->SetInt (TEXT("Video"), TEXT("UnlockFPS"), bUnlockFPS); //------------------------------------ BOOL bQSVUseVideoEncoderSettings = SendMessage(GetDlgItem(hwnd, IDC_QSVUSEVIDEOENCODERSETTINGS), BM_GETCHECK, 0, 0) == BST_CHECKED; AppConfig->SetInt(TEXT("Video Encoding"), TEXT("QSVUseVideoEncoderSettings"), bQSVUseVideoEncoderSettings); //------------------------------------ int qsvPreset = (int)SendMessage(GetDlgItem(hwnd, IDC_QSVPRESET), CB_GETCURSEL, 0, 0); if (qsvPreset != CB_ERR) { qsvPreset = (int)SendMessage(GetDlgItem(hwnd, IDC_QSVPRESET), CB_GETITEMDATA, qsvPreset, 0); AppConfig->SetInt(TEXT("Video Encoding"), TEXT("QSVPreset"), qsvPreset); } //------------------------------------ strTemp = GetCBText(GetDlgItem(hwnd, IDC_NVENCPRESET)); AppConfig->SetString(TEXT("Video Encoding"), TEXT("NVENCPreset"), strTemp); //------------------------------------ BOOL bSyncToVideoTime = SendMessage(GetDlgItem(hwnd, IDC_SYNCTOVIDEOTIME), BM_GETCHECK, 0, 0) == BST_CHECKED; AppConfig->SetInt (TEXT("Audio"), TEXT("SyncToVideoTime"), bSyncToVideoTime); //-------------------------------------------------- BOOL bUseMicQPC = SendMessage(GetDlgItem(hwnd, IDC_USEMICQPC), BM_GETCHECK, 0, 0) == BST_CHECKED; GlobalConfig->SetInt(TEXT("Audio"), TEXT("UseMicQPC"), bUseMicQPC); //-------------------------------------------------- int globalAudioTimeAdjust = (int)SendMessage(GetDlgItem(hwnd, IDC_AUDIOTIMEADJUST), UDM_GETPOS32, 0, 0); GlobalConfig->SetInt(TEXT("Audio"), TEXT("GlobalAudioTimeAdjust"), globalAudioTimeAdjust); //-------------------------------------------------- BOOL bUseMicSyncFixHack = SendMessage(GetDlgItem(hwnd, IDC_MICSYNCFIX), BM_GETCHECK, 0, 0) == BST_CHECKED; GlobalConfig->SetInt(TEXT("Audio"), TEXT("UseMicSyncFixHack"), bUseMicSyncFixHack); //-------------------------------------------------- BOOL bLowLatencyAutoMode = SendMessage(GetDlgItem(hwnd, IDC_LATENCYMETHOD), BM_GETCHECK, 0, 0) == BST_CHECKED; int latencyFactor = GetDlgItemInt(hwnd, IDC_LATENCYTUNE, NULL, TRUE); AppConfig->SetInt (TEXT("Publish"), TEXT("LatencyFactor"), latencyFactor); AppConfig->SetInt (TEXT("Publish"), TEXT("LowLatencyMethod"), bLowLatencyAutoMode); //-------------------------------------------------- strTemp = GetCBText(GetDlgItem(hwnd, IDC_BINDIP)); AppConfig->SetString(TEXT("Publish"), TEXT("BindToIP"), strTemp); }
BOOL Group_Create_OnOK (HWND hDlg) { LPCREATEGROUPDLG lpp = (LPCREATEGROUPDLG)GetWindowLongPtr (hDlg, DWLP_USER); // Start a background task to do all the work. // LPGROUP_CREATE_PARAMS pTask = New (GROUP_CREATE_PARAMS); memset (pTask, 0x00, sizeof(GROUP_CREATE_PARAMS)); if (IsDlgButtonChecked (hDlg, IDC_NEWGROUP_ID_AUTO)) pTask->idGroup = UID_AUTOSELECT; else // (IsDlgButtonChecked (hDlg, IDC_NEWGROUP_ID_MANUAL)) pTask->idGroup = SP_GetPos (GetDlgItem (hDlg, IDC_NEWGROUP_ID)); lstrcpy (pTask->Properties.szOwner, lpp->Advanced.szOwner); pTask->Properties.aaListStatus = lpp->Advanced.aaStatus; pTask->Properties.aaListGroupsOwned = lpp->Advanced.aaGroups; pTask->Properties.aaListMembers = lpp->Advanced.aaMembers; pTask->Properties.aaAddMember = lpp->Advanced.aaAdd; pTask->Properties.aaDeleteMember = lpp->Advanced.aaRemove; if (lpp->Advanced.pMembers) asc_AsidListCopy (&pTask->pMembers, &lpp->Advanced.pMembers); else pTask->pMembers = NULL; if (lpp->Advanced.pGroupsOwner) asc_AsidListCopy (&pTask->pGroupsOwner, &lpp->Advanced.pGroupsOwner); else pTask->pGroupsOwner = NULL; // Crack the specified list of user names into a multi-string // TCHAR szSeparators[ cchRESOURCE ]; GetString (szSeparators, IDS_SEPARATORS); lstrcat (szSeparators, TEXT(" \t")); LPTSTR pszNames = GetEditText (GetDlgItem (hDlg, IDC_NEWGROUP_NAME)); LPCTSTR pszStart = pszNames; while (lstrchr (szSeparators, *pszStart)) ++pszStart; while (*pszStart) { // Find the first non-name character // LPCTSTR pszEnd = pszStart; while (*pszEnd && !lstrchr(szSeparators, *pszEnd)) ++pszEnd; // Copy off this particular name // TCHAR szName[ cchNAME ]; lstrcpy (szName, pszStart); szName[ pszEnd - pszStart ] = TEXT('\0'); if (szName[0]) FormatMultiString (&pTask->mszNames, FALSE, TEXT("%1"), TEXT("%s"), szName); // Find the next valid-name character // pszStart = pszEnd; while (lstrchr(szSeparators, *pszStart)) ++pszStart; } FreeString (pszNames); // Do the real work of creating the user(s) // StartTask (taskGROUP_CREATE, NULL, pTask); // Store these creation parameters as the new defaults // memcpy (&gr.CreateGroup, &lpp->Advanced, sizeof(GROUPPROPINFO)); return TRUE; }
void SettingsPublish::ApplySettings() { String strSavePath = GetEditText(GetDlgItem(hwnd, IDC_SAVEPATH)); String defaultPath = OSGetDefaultVideoSavePath(L"\\.flv"); if (!strSavePath.IsValid() && defaultPath.IsValid()) { String text = Str("Settings.Publish.InvalidSavePath"); text.FindReplace(L"$1", defaultPath); if (OBSMessageBox(nullptr, text, Str("Settings.Publish.InvalidSavePathCaption"), MB_ICONEXCLAMATION | MB_OKCANCEL) != IDOK) { SetAbortApplySettings(true); return; } SetWindowText(GetDlgItem(hwnd, IDC_SAVEPATH), defaultPath.Array()); } //------------------------------------------ int curSel = (int)SendMessage(GetDlgItem(hwnd, IDC_MODE), CB_GETCURSEL, 0, 0); if(curSel != CB_ERR) AppConfig->SetInt(TEXT("Publish"), TEXT("Mode"), curSel); int serviceID = (int)SendMessage(GetDlgItem(hwnd, IDC_SERVICE), CB_GETCURSEL, 0, 0); if(serviceID != CB_ERR) { serviceID = (int)SendMessage(GetDlgItem(hwnd, IDC_SERVICE), CB_GETITEMDATA, serviceID, 0); AppConfig->SetInt(TEXT("Publish"), TEXT("Service"), serviceID); } String strTemp = GetEditText(GetDlgItem(hwnd, IDC_PLAYPATH)); strTemp.KillSpaces(); AppConfig->SetString(TEXT("Publish"), TEXT("PlayPath"), strTemp); if(serviceID == 0) { strTemp = GetEditText(GetDlgItem(hwnd, IDC_URL)); AppConfig->SetString(TEXT("Publish"), TEXT("URL"), strTemp); } else { strTemp = GetCBText(GetDlgItem(hwnd, IDC_SERVERLIST)); AppConfig->SetString(TEXT("Publish"), TEXT("URL"), strTemp); } //------------------------------------------ bool bLowLatencyMode = SendMessage(GetDlgItem(hwnd, IDC_LOWLATENCYMODE), BM_GETCHECK, 0, 0) == BST_CHECKED; AppConfig->SetInt(TEXT("Publish"), TEXT("LowLatencyMode"), bLowLatencyMode); //------------------------------------------ App->bAutoReconnect = SendMessage(GetDlgItem(hwnd, IDC_AUTORECONNECT), BM_GETCHECK, 0, 0) == BST_CHECKED; App->bKeepRecording = SendMessage(GetDlgItem(hwnd, IDC_KEEPRECORDING), BM_GETCHECK, 0, 0) == BST_CHECKED; BOOL bError = FALSE; App->reconnectTimeout = (UINT)SendMessage(GetDlgItem(hwnd, IDC_AUTORECONNECT_TIMEOUT), UDM_GETPOS32, 0, (LPARAM)&bError); if(bError) App->reconnectTimeout = 10; AppConfig->SetInt(TEXT("Publish"), TEXT("AutoReconnect"), App->bAutoReconnect); AppConfig->SetInt(TEXT("Publish"), TEXT("AutoReconnectTimeout"), App->reconnectTimeout); AppConfig->SetInt(TEXT("Publish"), TEXT("KeepRecording"), App->bKeepRecording); //------------------------------------------ bError = FALSE; int delayTime = (int)SendMessage(GetDlgItem(hwnd, IDC_DELAY), UDM_GETPOS32, 0, (LPARAM)&bError); if(bError) delayTime = 0; AppConfig->SetInt(TEXT("Publish"), TEXT("Delay"), delayTime); //------------------------------------------ BOOL bSaveToFile = SendMessage(GetDlgItem(hwnd, IDC_SAVETOFILE), BM_GETCHECK, 0, 0) != BST_UNCHECKED; AppConfig->SetInt (TEXT("Publish"), TEXT("SaveToFile"), bSaveToFile); AppConfig->SetString(TEXT("Publish"), TEXT("SavePath"), strSavePath); //------------------------------------------ DWORD stopStreamHotkey = (DWORD)SendMessage(GetDlgItem(hwnd, IDC_STOPSTREAMHOTKEY), HKM_GETHOTKEY, 0, 0); AppConfig->SetInt(TEXT("Publish"), TEXT("StopStreamHotkey"), stopStreamHotkey); if(App->stopStreamHotkeyID) { API->DeleteHotkey(App->stopStreamHotkeyID); App->stopStreamHotkeyID = 0; } if(stopStreamHotkey) App->stopStreamHotkeyID = API->CreateHotkey(stopStreamHotkey, OBS::StopStreamHotkey, NULL); //------------------------------------------ DWORD startStreamHotkey = (DWORD)SendMessage(GetDlgItem(hwnd, IDC_STARTSTREAMHOTKEY), HKM_GETHOTKEY, 0, 0); AppConfig->SetInt(TEXT("Publish"), TEXT("StartStreamHotkey"), startStreamHotkey); if(App->startStreamHotkeyID) { API->DeleteHotkey(App->startStreamHotkeyID); App->startStreamHotkeyID = 0; } if(startStreamHotkey) App->startStreamHotkeyID = API->CreateHotkey(startStreamHotkey, OBS::StartStreamHotkey, NULL); //------------------------------------------ DWORD stopRecordingHotkey = (DWORD)SendMessage(GetDlgItem(hwnd, IDC_STOPRECORDINGHOTKEY), HKM_GETHOTKEY, 0, 0); AppConfig->SetInt(TEXT("Publish"), TEXT("StopRecordingHotkey"), stopRecordingHotkey); if (App->stopRecordingHotkeyID) { API->DeleteHotkey(App->stopRecordingHotkeyID); App->stopRecordingHotkeyID = 0; } if (stopRecordingHotkey) App->stopRecordingHotkeyID = API->CreateHotkey(stopRecordingHotkey, OBS::StopRecordingHotkey, NULL); //------------------------------------------ DWORD startRecordingHotkey = (DWORD)SendMessage(GetDlgItem(hwnd, IDC_STARTRECORDINGHOTKEY), HKM_GETHOTKEY, 0, 0); AppConfig->SetInt(TEXT("Publish"), TEXT("StartRecordingHotkey"), startRecordingHotkey); if (App->startRecordingHotkeyID) { API->DeleteHotkey(App->startRecordingHotkeyID); App->startRecordingHotkeyID = 0; } if (startRecordingHotkey) App->startRecordingHotkeyID = API->CreateHotkey(startRecordingHotkey, OBS::StartRecordingHotkey, NULL); //------------------------------------------ App->ConfigureStreamButtons(); /* App->strDashboard = GetEditText(GetDlgItem(hwnd, IDC_DASHBOARDLINK)).KillSpaces(); AppConfig->SetString(TEXT("Publish"), TEXT("Dashboard"), App->strDashboard); ShowWindow(GetDlgItem(hwndMain, ID_DASHBOARD), App->strDashboard.IsValid() && !curSel ? SW_SHOW : SW_HIDE); */ }
void CozyKnightModifyDlg::UpdateModify() { m_StrName = GetEditText(m_NameEdit); m_Value = ::_ttoi(GetEditText(m_ValueEdit)); m_Lock = GetItemCheck(IDC_CHK_LOCK); }
INT_PTR SceneSwitcherSettings::MsgClicked(int controlId, int code, HWND controlHwnd) { switch(controlId) { case IDC_CLEAR_HOTKEY: if(code == BN_CLICKED) { SendMessage(GetDlgItem(hwnd, IDC_TOGGLEHOTKEY), HKM_SETHOTKEY, 0, 0); SetChangedSettings(pChange = true); return TRUE; } break; case IDC_STOP: if(code == BN_CLICKED) // Stop button clicked { if(thePlugin->IsRunning()) thePlugin->StopThread(hwnd); else { ApplyConfig(hwnd); pChange = false; thePlugin->StartThread(hwnd); } SetChangedSettings(pChange); return TRUE; } break; case IDUP: { HWND wsMap = GetDlgItem(hwnd, IDC_WSMAP); const int sel = SendMessage(wsMap, LVM_GETSELECTIONMARK, 0, 0); if (sel > 0) { // Get the text from the item String wnd; wnd.SetLength(256); ListView_GetItemText(wsMap, sel, 0, wnd, 256); String scn; scn.SetLength(256); ListView_GetItemText(wsMap, sel, 1, scn, 256); // Delete it SendMessage(wsMap, LVM_DELETEITEM, sel, 0); // Add it above LVITEM lv1; lv1.mask = LVIF_TEXT; lv1.iItem = sel - 1; lv1.iSubItem = 0; lv1.pszText = wnd; LVITEM lv2; lv2.mask = LVIF_TEXT; lv2.iItem = sel - 1; lv2.iSubItem = 1; lv2.pszText = scn; SendMessage(wsMap, LVM_INSERTITEM, sel - 1, (LPARAM) &lv1); SendMessage(wsMap, LVM_SETITEM, sel - 1, (LPARAM) &lv2); // Update the selection mark SendMessage(wsMap, LVM_SETSELECTIONMARK, 0, sel - 1); SetChangedSettings(pChange = true); return TRUE; } break; } case IDDOWN: { HWND wsMap = GetDlgItem(hwnd, IDC_WSMAP); const int sel = SendMessage(wsMap, LVM_GETSELECTIONMARK, 0, 0); const int max = SendMessage(wsMap, LVM_GETITEMCOUNT, 0, 0) - 1; if (sel > -1 && sel < max) { // Get the text from the item String wnd; wnd.SetLength(256); ListView_GetItemText(wsMap, sel, 0, wnd, 256); String scn; scn.SetLength(256); ListView_GetItemText(wsMap, sel, 1, scn, 256); // Delete it SendMessage(wsMap, LVM_DELETEITEM, sel, 0); // Add it below LVITEM lv1; lv1.mask = LVIF_TEXT; lv1.iItem = sel + 1; lv1.iSubItem = 0; lv1.pszText = wnd; LVITEM lv2; lv2.mask = LVIF_TEXT; lv2.iItem = sel + 1; lv2.iSubItem = 1; lv2.pszText = scn; SendMessage(wsMap, LVM_INSERTITEM, sel + 1, (LPARAM) &lv1); SendMessage(wsMap, LVM_SETITEM, sel + 1, (LPARAM) &lv2); // Update the selection mark SendMessage(wsMap, LVM_SETSELECTIONMARK, 0, sel + 1); SetChangedSettings(pChange = true); return TRUE; } break; } case IDADD: { HWND wsMap = GetDlgItem(hwnd, IDC_WSMAP); HWND appList = GetDlgItem(hwnd, IDC_APPLIST); HWND scnList = GetDlgItem(hwnd, IDC_MAINSCN); String wnd = GetEditText(appList); // First column LVITEM lv1; lv1.mask = LVIF_TEXT; lv1.iItem = 0; lv1.iSubItem = 0; lv1.pszText = wnd; // Second column String scn = GetCBText(scnList, CB_ERR); LVITEM lv2; lv2.mask = LVIF_TEXT; lv2.iItem = 0; lv2.iSubItem = 1; lv2.pszText = scn; // Add first column then set second SendMessage(wsMap, LVM_INSERTITEM, 0, (LPARAM)&lv1); SendMessage(wsMap, LVM_SETITEM, 0, (LPARAM)&lv2); SetChangedSettings(pChange = true); return TRUE; } break; case IDREM: { // Remove the item HWND wsMap = GetDlgItem(hwnd, IDC_WSMAP); const int sel = SendMessage(wsMap, LVM_GETSELECTIONMARK, 0, 0); if (sel > -1) SendMessage(wsMap, LVM_DELETEITEM, sel, 0); SetChangedSettings(pChange = true); return TRUE; } break; case IDC_ALTSWITCH: case IDC_ALTNOSWITCH: if (code == BN_CLICKED) { HWND swButton = GetDlgItem(hwnd, IDC_ALTSWITCH); HWND altCombo = GetDlgItem(hwnd, IDC_ALTSCN); const bool swChecked = (SendMessage(swButton, BM_GETSTATE, 0, 0) & BST_CHECKED) != 0; EnableWindow(altCombo, swChecked); pChange = pChange || (swChecked != thePlugin->IsAltDoSwitch()); SetChangedSettings(pChange); return TRUE; } break; case IDC_STARTAUTO: { HWND control = GetDlgItem(hwnd, IDC_STARTAUTO); bool newState = (SendMessage(control, BM_GETSTATE, 0, 0) & BST_CHECKED) != 0; pChange = pChange || (newState != thePlugin->IsStartAuto()); SetChangedSettings(pChange); return TRUE; } break; case IDC_TOGGLEHOTKEY: if (code == EN_CHANGE) { SetChangedSettings(pChange = true); return TRUE; } break; case IDC_FREQ: if(code == EN_CHANGE) { DWORD newFreq = GetDlgItemInt(hwnd, IDC_FREQ, NULL, FALSE); DWORD oldFreq = thePlugin->GettimeToSleep(); pChange = pChange || newFreq != oldFreq; SetChangedSettings(pChange); return TRUE; } break; case IDC_APPLIST: case IDC_MAINSCN: if (code == CBN_SELCHANGE || code == CBN_EDITCHANGE) { EditItem(code == CBN_SELCHANGE && controlId == IDC_APPLIST); return TRUE; } break; case IDC_ALTSCN: if (code == CBN_SELCHANGE) { SetChangedSettings(pChange = true); return TRUE; } break; } return FALSE; }
void SettingsPublish::ApplySettings() { int curSel = (int)SendMessage(GetDlgItem(hwnd, IDC_MODE), CB_GETCURSEL, 0, 0); if(curSel != CB_ERR) AppConfig->SetInt(TEXT("Publish"), TEXT("Mode"), curSel); int serviceID = (int)SendMessage(GetDlgItem(hwnd, IDC_SERVICE), CB_GETCURSEL, 0, 0); if(serviceID != CB_ERR) { serviceID = (int)SendMessage(GetDlgItem(hwnd, IDC_SERVICE), CB_GETITEMDATA, serviceID, 0); AppConfig->SetInt(TEXT("Publish"), TEXT("Service"), serviceID); } String strTemp = GetEditText(GetDlgItem(hwnd, IDC_PLAYPATH)); strTemp.KillSpaces(); AppConfig->SetString(TEXT("Publish"), TEXT("PlayPath"), strTemp); if(serviceID == 0) { strTemp = GetEditText(GetDlgItem(hwnd, IDC_URL)); AppConfig->SetString(TEXT("Publish"), TEXT("URL"), strTemp); } else { strTemp = GetCBText(GetDlgItem(hwnd, IDC_SERVERLIST)); AppConfig->SetString(TEXT("Publish"), TEXT("URL"), strTemp); } //------------------------------------------ bool bLowLatencyMode = SendMessage(GetDlgItem(hwnd, IDC_LOWLATENCYMODE), BM_GETCHECK, 0, 0) == BST_CHECKED; AppConfig->SetInt(TEXT("Publish"), TEXT("LowLatencyMode"), bLowLatencyMode); //------------------------------------------ App->bAutoReconnect = SendMessage(GetDlgItem(hwnd, IDC_AUTORECONNECT), BM_GETCHECK, 0, 0) == BST_CHECKED; BOOL bError = FALSE; App->reconnectTimeout = (UINT)SendMessage(GetDlgItem(hwnd, IDC_AUTORECONNECT_TIMEOUT), UDM_GETPOS32, 0, (LPARAM)&bError); if(bError) App->reconnectTimeout = 5; AppConfig->SetInt(TEXT("Publish"), TEXT("AutoReconnect"), App->bAutoReconnect); AppConfig->SetInt(TEXT("Publish"), TEXT("AutoReconnectTimeout"), App->reconnectTimeout); //------------------------------------------ bError = FALSE; int delayTime = (int)SendMessage(GetDlgItem(hwnd, IDC_DELAY), UDM_GETPOS32, 0, (LPARAM)&bError); if(bError) delayTime = 0; AppConfig->SetInt(TEXT("Publish"), TEXT("Delay"), delayTime); //------------------------------------------ String strSavePath = GetEditText(GetDlgItem(hwnd, IDC_SAVEPATH)); BOOL bSaveToFile = SendMessage(GetDlgItem(hwnd, IDC_SAVETOFILE), BM_GETCHECK, 0, 0) != BST_UNCHECKED; if(!strSavePath.IsValid()) bSaveToFile = FALSE; AppConfig->SetInt (TEXT("Publish"), TEXT("SaveToFile"), bSaveToFile); AppConfig->SetString(TEXT("Publish"), TEXT("SavePath"), strSavePath); //------------------------------------------ DWORD stopStreamHotkey = (DWORD)SendMessage(GetDlgItem(hwnd, IDC_STOPSTREAMHOTKEY), HKM_GETHOTKEY, 0, 0); AppConfig->SetInt(TEXT("Publish"), TEXT("StopStreamHotkey"), stopStreamHotkey); if(App->stopStreamHotkeyID) { API->DeleteHotkey(App->stopStreamHotkeyID); App->stopStreamHotkeyID = 0; } if(stopStreamHotkey) App->stopStreamHotkeyID = API->CreateHotkey(stopStreamHotkey, OBS::StopStreamHotkey, NULL); //------------------------------------------ DWORD startStreamHotkey = (DWORD)SendMessage(GetDlgItem(hwnd, IDC_STARTSTREAMHOTKEY), HKM_GETHOTKEY, 0, 0); AppConfig->SetInt(TEXT("Publish"), TEXT("StartStreamHotkey"), startStreamHotkey); if(App->startStreamHotkeyID) { API->DeleteHotkey(App->startStreamHotkeyID); App->startStreamHotkeyID = 0; } if(startStreamHotkey) App->startStreamHotkeyID = API->CreateHotkey(startStreamHotkey, OBS::StartStreamHotkey, NULL); //------------------------------------------ App->strDashboard = GetEditText(GetDlgItem(hwnd, IDC_DASHBOARDLINK)).KillSpaces(); AppConfig->SetString(TEXT("Publish"), TEXT("Dashboard"), App->strDashboard); ShowWindow(GetDlgItem(hwndMain, ID_DASHBOARD), App->strDashboard.IsValid() && !curSel ? SW_SHOW : SW_HIDE); }
INT_PTR SettingsVideo::ProcMessage(UINT message, WPARAM wParam, LPARAM lParam) { HWND hwndTemp; switch(message) { case WM_INITDIALOG: { LocalizeWindow(hwnd); if (LocaleIsRTL()) { RECT xRect, yRect; GetWindowRect(GetDlgItem(hwnd, IDC_SIZEX), &xRect); MapWindowPoints(HWND_DESKTOP, hwnd, (LPPOINT)&xRect.left, 2); GetWindowRect(GetDlgItem(hwnd, IDC_SIZEY), &yRect); MapWindowPoints(HWND_DESKTOP, hwnd, (LPPOINT)&yRect.left, 2); SetWindowPos(GetDlgItem(hwnd, IDC_SIZEX), nullptr, yRect.left, yRect.top, 0, 0, SWP_NOSIZE); SetWindowPos(GetDlgItem(hwnd, IDC_SIZEY), nullptr, xRect.left, xRect.top, 0, 0, SWP_NOSIZE); } //-------------------------------------------- HWND hwndToolTip = CreateWindowEx(NULL, TOOLTIPS_CLASS, NULL, WS_POPUP|TTS_NOPREFIX|TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, NULL, hinstMain, NULL); TOOLINFO ti; zero(&ti, sizeof(ti)); ti.cbSize = sizeof(ti); ti.uFlags = TTF_SUBCLASS|TTF_IDISHWND; ti.hwnd = hwnd; if (LocaleIsRTL()) ti.uFlags |= TTF_RTLREADING; SendMessage(hwndToolTip, TTM_SETMAXTIPWIDTH, 0, 500); SendMessage(hwndToolTip, TTM_SETDELAYTIME, TTDT_AUTOPOP, 8000); //-------------------------------------------- DeviceOutputs outputs; GetDisplayDevices(outputs); hwndTemp = GetDlgItem(hwnd, IDC_DEVICE); for (UINT i=0; i<outputs.devices.Num(); i++) { SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)outputs.devices[i].strDevice.Array()); } UINT adapterID = GlobalConfig->GetInt(TEXT("Video"), TEXT("Adapter"), 0); if (adapterID >= outputs.devices.Num()) adapterID = 0; SendMessage(hwndTemp, CB_SETCURSEL, adapterID, 0); //-------------------------------------------- hwndTemp = GetDlgItem(hwnd, IDC_MONITOR); App->monitors.Clear(); EnumDisplayMonitors(NULL, NULL, (MONITORENUMPROC)MonitorInfoEnumProc, (LPARAM)&App->monitors); for(UINT i=0; i<App->monitors.Num(); i++) SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)IntString(i+1).Array()); int monitorID = LoadSettingComboInt(hwndTemp, TEXT("Video"), TEXT("Monitor"), 0, App->monitors.Num()-1); if(monitorID > (int)App->monitors.Num()) monitorID = 0; //-------------------------------------------- SendMessage(GetDlgItem(hwnd, IDC_USECUSTOM), BM_SETCHECK, BST_CHECKED, 0); EnableWindow(GetDlgItem(hwnd, IDC_MONITOR), FALSE); //-------------------------------------------- int cx, cy; if(!AppConfig->HasKey(TEXT("Video"), TEXT("BaseWidth")) || !AppConfig->HasKey(TEXT("Video"), TEXT("BaseHeight"))) { cx = App->monitors[monitorID].rect.right - App->monitors[monitorID].rect.left; cy = App->monitors[monitorID].rect.bottom - App->monitors[monitorID].rect.top; AppConfig->SetInt(TEXT("Video"), TEXT("BaseWidth"), cx); AppConfig->SetInt(TEXT("Video"), TEXT("BaseHeight"), cy); } else { cx = AppConfig->GetInt(TEXT("Video"), TEXT("BaseWidth")); cy = AppConfig->GetInt(TEXT("Video"), TEXT("BaseHeight")); if(cx < 128) cx = 128; else if(cx > 4096) cx = 4096; if(cy < 128) cy = 128; else if(cy > 4096) cy = 4096; } RefreshAspect(hwnd, cx, cy); hwndTemp = GetDlgItem(hwnd, IDC_SIZEX); editProc = (FARPROC)GetWindowLongPtr(hwndTemp, GWLP_WNDPROC); SetWindowLongPtr(hwndTemp, GWLP_WNDPROC, (LONG_PTR)ResolutionEditSubclassProc); SetWindowText(hwndTemp, IntString(cx).Array()); hwndTemp = GetDlgItem(hwnd, IDC_SIZEY); SetWindowLongPtr(hwndTemp, GWLP_WNDPROC, (LONG_PTR)ResolutionEditSubclassProc); SetWindowText(hwndTemp, IntString(cy).Array()); //-------------------------------------------- hwndTemp = GetDlgItem(hwnd, IDC_DISABLEAERO); if(OSGetVersion() == 8) EnableWindow(hwndTemp, FALSE); BOOL bDisableAero = AppConfig->GetInt(TEXT("Video"), TEXT("DisableAero"), 0); SendMessage(hwndTemp, BM_SETCHECK, bDisableAero ? BST_CHECKED : 0, 0); ti.lpszText = (LPWSTR)Str("Settings.Video.DisableAeroTooltip"); ti.uId = (UINT_PTR)hwndTemp; SendMessage(hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti); //-------------------------------------------- BOOL bUnlockFPS = AppConfig->GetInt(TEXT("Video"), TEXT("UnlockFPS")); int topFPS = bUnlockFPS ? 120 : 60; hwndTemp = GetDlgItem(hwnd, IDC_FPS); SendMessage(hwndTemp, UDM_SETRANGE32, 1, topFPS); int fps = AppConfig->GetInt(TEXT("Video"), TEXT("FPS"), 30); if(!AppConfig->HasKey(TEXT("Video"), TEXT("FPS"))) { AppConfig->SetInt(TEXT("Video"), TEXT("FPS"), 30); fps = 30; } else if(fps < 1) { AppConfig->SetInt(TEXT("Video"), TEXT("FPS"), 1); fps = 1; } else if(fps > topFPS) { AppConfig->SetInt(TEXT("Video"), TEXT("FPS"), topFPS); fps = topFPS; } SendMessage(hwndTemp, UDM_SETPOS32, 0, fps); //-------------------------------------------- hwndTemp = GetDlgItem(hwnd, IDC_DOWNSCALE); RefreshDownscales(hwndTemp, cx, cy); ti.lpszText = (LPWSTR)Str("Settings.Video.DownscaleTooltip"); ti.uId = (UINT_PTR)hwndTemp; SendMessage(hwndToolTip, TTM_ADDTOOL, 0, (LPARAM)&ti); //-------------------------------------------- RefreshFilters(hwnd, true); //-------------------------------------------- ShowWindow(GetDlgItem(hwnd, IDC_INFO), SW_HIDE); SetChangedSettings(false); return TRUE; } case WM_COMMAND: { bool bDataChanged = false; switch(LOWORD(wParam)) { case IDC_MONITOR: { if(HIWORD(wParam) != CBN_SELCHANGE) break; int sel = (int)SendMessage(GetDlgItem(hwnd, IDC_MONITOR), CB_GETCURSEL, 0, 0); if(sel != CB_ERR) { if(sel >= (int)App->monitors.Num()) sel = 0; MonitorInfo &monitor = App->monitors[sel]; int cx, cy; cx = monitor.rect.right - monitor.rect.left; cy = monitor.rect.bottom - monitor.rect.top; SetWindowText(GetDlgItem(hwnd, IDC_SIZEX), IntString(cx).Array()); SetWindowText(GetDlgItem(hwnd, IDC_SIZEY), IntString(cy).Array()); RefreshAspect(hwnd, cx, cy); } break; } case IDC_USECUSTOM: SendMessage(GetDlgItem(hwnd, IDC_SIZEX), EM_SETREADONLY, FALSE, 0); SendMessage(GetDlgItem(hwnd, IDC_SIZEY), EM_SETREADONLY, FALSE, 0); EnableWindow(GetDlgItem(hwnd, IDC_MONITOR), FALSE); break; case IDC_USEMONITOR: { SendMessage(GetDlgItem(hwnd, IDC_SIZEX), EM_SETREADONLY, TRUE, 0); SendMessage(GetDlgItem(hwnd, IDC_SIZEY), EM_SETREADONLY, TRUE, 0); EnableWindow(GetDlgItem(hwnd, IDC_MONITOR), TRUE); int sel = (int)SendMessage(GetDlgItem(hwnd, IDC_MONITOR), CB_GETCURSEL, 0, 0); if(sel != CB_ERR) { if(sel >= (int)App->monitors.Num()) sel = 0; MonitorInfo &monitor = App->monitors[sel]; int cx, cy; cx = monitor.rect.right - monitor.rect.left; cy = monitor.rect.bottom - monitor.rect.top; SetWindowText(GetDlgItem(hwnd, IDC_SIZEX), IntString(cx).Array()); SetWindowText(GetDlgItem(hwnd, IDC_SIZEY), IntString(cy).Array()); RefreshAspect(hwnd, cx, cy); } break; } case IDC_SIZEX: case IDC_SIZEY: { if(HIWORD(wParam) != EN_CHANGE) break; int cx = GetEditText(GetDlgItem(hwnd, IDC_SIZEX)).ToInt(); int cy = GetEditText(GetDlgItem(hwnd, IDC_SIZEY)).ToInt(); if(cx < 128) cx = 128; else if(cx > 4096) cx = 4096; if(cy < 128) cy = 128; else if(cy > 4096) cy = 4096; RefreshDownscales(GetDlgItem(hwnd, IDC_DOWNSCALE), cx, cy); RefreshAspect(hwnd, cx, cy); bDataChanged = true; break; } case IDC_DISABLEAERO: if(HIWORD(wParam) == BN_CLICKED) bDataChanged = true; break; case IDC_FPS_EDIT: if(HIWORD(wParam) == EN_CHANGE) bDataChanged = true; break; case IDC_DEVICE: case IDC_FILTER: if(HIWORD(wParam) == CBN_SELCHANGE) bDataChanged = true; break; case IDC_DOWNSCALE: if(HIWORD(wParam) == CBN_SELCHANGE) { bDataChanged = true; RefreshFilters(hwnd, false); } break; } if(bDataChanged) { if (App->GetVideoEncoder()) ShowWindow(GetDlgItem(hwnd, IDC_INFO), SW_SHOW); SetChangedSettings(true); } break; } } return FALSE; }