Extract streaming/record/test stream button UI calls
parent
a7f4bf655e
commit
a5f92b34b1
|
@ -388,7 +388,7 @@ OBS::OBS()
|
|||
// start/stop recording button
|
||||
|
||||
hwndTemp = CreateWindow(TEXT("BUTTON"), Str("MainWindow.StartRecording"),
|
||||
WS_CHILDWINDOW|WS_VISIBLE|WS_TABSTOP|BS_TEXT|BS_PUSHBUTTON|WS_DISABLED|WS_CLIPSIBLINGS,
|
||||
WS_CHILDWINDOW|WS_VISIBLE|WS_TABSTOP|BS_TEXT|BS_PUSHBUTTON|WS_CLIPSIBLINGS,
|
||||
0, 0, 0, 0, hwndMain, (HMENU)ID_TOGGLERECORDING, 0, 0);
|
||||
SendMessage(hwndTemp, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
|
||||
|
||||
|
@ -1204,21 +1204,25 @@ void OBS::GetProfiles(StringList &profileList)
|
|||
}
|
||||
}
|
||||
|
||||
void OBS::ConfigureStreamButtons()
|
||||
void OBS::RefreshStreamButtons(bool disable)
|
||||
{
|
||||
int networkMode = AppConfig->GetInt(TEXT("Publish"), TEXT("Mode"), 2);
|
||||
bRecordingOnly = (networkMode == 1);
|
||||
bool canStream = networkMode == 0 && !bTestStream;
|
||||
bool canRecord = (bRecordingOnly || (AppConfig->GetInt(TEXT("Publish"), TEXT("SaveToFile")) != 0 && bStreaming)) && !bTestStream;
|
||||
bool canTest = !bRecording && (!bStreaming || bTestStream);
|
||||
|
||||
if (bRecordingOnly)
|
||||
{
|
||||
EnableWindow(GetDlgItem(hwndMain, ID_STARTSTOP), FALSE);
|
||||
EnableWindow(GetDlgItem(hwndMain, ID_TOGGLERECORDING), TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
EnableWindow(GetDlgItem(hwndMain, ID_STARTSTOP), TRUE);
|
||||
EnableWindow(GetDlgItem(hwndMain, ID_TOGGLERECORDING), FALSE);
|
||||
}
|
||||
EnableWindow(GetDlgItem(hwndMain, ID_STARTSTOP), !disable && canStream);
|
||||
EnableWindow(GetDlgItem(hwndMain, ID_TOGGLERECORDING), !disable && canRecord);
|
||||
EnableWindow(GetDlgItem(hwndMain, ID_TESTSTREAM), !disable && canTest);
|
||||
}
|
||||
|
||||
void OBS::ConfigureStreamButtons()
|
||||
{
|
||||
RefreshStreamButtons();
|
||||
SetWindowText(GetDlgItem(hwndMain, ID_STARTSTOP), bStreaming ? Str("MainWindow.StopStream") : Str("MainWindow.StartStream"));
|
||||
SetWindowText(GetDlgItem(hwndMain, ID_TOGGLERECORDING), bRecording ? Str("MainWindow.StopRecording") : Str("MainWindow.StartRecording"));
|
||||
SetWindowText(GetDlgItem(hwndMain, ID_TESTSTREAM), bTestStream ? Str("MainWindow.StopTest") : Str("MainWindow.TestStream"));
|
||||
}
|
||||
|
||||
void OBS::ReloadIniSettings()
|
||||
|
@ -1333,8 +1337,7 @@ void OBS::ReloadIniSettings()
|
|||
if (!minimizeToIcon && !IsWindowVisible(hwndMain))
|
||||
ShowWindow(hwndMain, SW_SHOW);
|
||||
|
||||
if (!bRunning)
|
||||
ConfigureStreamButtons();
|
||||
RefreshStreamButtons();
|
||||
}
|
||||
|
||||
void OBS::UpdateAudioMeters()
|
||||
|
|
|
@ -967,6 +967,7 @@ private:
|
|||
static void ClearStatusBar();
|
||||
static void DrawStatusBar(DRAWITEMSTRUCT &dis);
|
||||
|
||||
void RefreshStreamButtons(bool disable=false);
|
||||
void ConfigureStreamButtons();
|
||||
|
||||
void ReloadIniSettings();
|
||||
|
|
|
@ -151,10 +151,9 @@ void OBS::StartRecording()
|
|||
bRecording = false;
|
||||
}
|
||||
else {
|
||||
EnableWindow(GetDlgItem(hwndMain, ID_TOGGLERECORDING), TRUE);
|
||||
SetWindowText(GetDlgItem(hwndMain, ID_TOGGLERECORDING), Str("MainWindow.StopRecording"));
|
||||
bRecording = true;
|
||||
}
|
||||
ConfigureStreamButtons();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,12 +191,10 @@ void OBS::Start()
|
|||
|
||||
Log(TEXT("=====Stream Start (while recording): %s============================="), CurrentDateTimeString().Array());
|
||||
|
||||
EnableWindow(GetDlgItem(hwndMain, ID_STARTSTOP), TRUE);
|
||||
SetWindowText(GetDlgItem(hwndMain, ID_STARTSTOP), Str("MainWindow.StopStream"));
|
||||
|
||||
bSentHeaders = false;
|
||||
bStreaming = true;
|
||||
|
||||
ConfigureStreamButtons();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -671,18 +668,6 @@ retryHookTestV2:
|
|||
hEncodeThread = OSCreateThread((XTHREAD)OBS::EncodeThread, NULL);
|
||||
hVideoThread = OSCreateThread((XTHREAD)OBS::MainCaptureThread, NULL);
|
||||
|
||||
if(bTestStream)
|
||||
{
|
||||
EnableWindow(GetDlgItem(hwndMain, ID_STARTSTOP), FALSE);
|
||||
EnableWindow(GetDlgItem(hwndMain, ID_TOGGLERECORDING), FALSE);
|
||||
SetWindowText(GetDlgItem(hwndMain, ID_TESTSTREAM), Str("MainWindow.StopTest"));
|
||||
}
|
||||
else
|
||||
{
|
||||
EnableWindow(GetDlgItem(hwndMain, ID_TESTSTREAM), FALSE);
|
||||
SetWindowText(GetDlgItem(hwndMain, ID_STARTSTOP), Str("MainWindow.StopStream"));
|
||||
}
|
||||
|
||||
EnableWindow(GetDlgItem(hwndMain, ID_SCENEEDITOR), TRUE);
|
||||
|
||||
//-------------------------------------------------------------
|
||||
|
@ -700,6 +685,8 @@ retryHookTestV2:
|
|||
OSLeaveMutex (hStartupShutdownMutex);
|
||||
|
||||
bStartingUp = false;
|
||||
|
||||
ConfigureStreamButtons();
|
||||
}
|
||||
|
||||
void OBS::Stop(bool overrideKeepRecording)
|
||||
|
@ -723,12 +710,11 @@ void OBS::Stop(bool overrideKeepRecording)
|
|||
|
||||
delete tempStream;
|
||||
|
||||
EnableWindow(GetDlgItem(hwndMain, ID_STARTSTOP), TRUE);
|
||||
SetWindowText(GetDlgItem(hwndMain, ID_STARTSTOP), Str("MainWindow.StartStream"));
|
||||
|
||||
bStreaming = false;
|
||||
bSentHeaders = false;
|
||||
|
||||
ConfigureStreamButtons();
|
||||
|
||||
OSLeaveMutex(hHotkeyMutex);
|
||||
|
||||
return;
|
||||
|
@ -903,24 +889,6 @@ void OBS::Stop(bool overrideKeepRecording)
|
|||
//update notification icon to reflect current status
|
||||
UpdateNotificationAreaIcon();
|
||||
|
||||
if (bRecordingOnly)
|
||||
{
|
||||
EnableWindow(GetDlgItem(hwndMain, ID_TOGGLERECORDING), TRUE);
|
||||
EnableWindow(GetDlgItem(hwndMain, ID_STARTSTOP), FALSE);
|
||||
EnableWindow(GetDlgItem(hwndMain, ID_TESTSTREAM), TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
EnableWindow(GetDlgItem(hwndMain, ID_TOGGLERECORDING), FALSE);
|
||||
EnableWindow(GetDlgItem(hwndMain, ID_STARTSTOP), TRUE);
|
||||
EnableWindow(GetDlgItem(hwndMain, ID_TESTSTREAM), TRUE);
|
||||
}
|
||||
|
||||
SetWindowText(GetDlgItem(hwndMain, ID_TOGGLERECORDING), Str("MainWindow.StartRecording"));
|
||||
SetWindowText(GetDlgItem(hwndMain, ID_TESTSTREAM), Str("MainWindow.TestStream"));
|
||||
SetWindowText(GetDlgItem(hwndMain, ID_STARTSTOP), Str("MainWindow.StartStream"));
|
||||
|
||||
|
||||
bEditMode = false;
|
||||
SendMessage(GetDlgItem(hwndMain, ID_SCENEEDITOR), BM_SETCHECK, BST_UNCHECKED, 0);
|
||||
EnableWindow(GetDlgItem(hwndMain, ID_SCENEEDITOR), FALSE);
|
||||
|
|
|
@ -2325,7 +2325,9 @@ LRESULT CALLBACK OBS::OBSProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
break;
|
||||
|
||||
case ID_TOGGLERECORDING:
|
||||
App->RefreshStreamButtons(true);
|
||||
App->ToggleRecording();
|
||||
App->RefreshStreamButtons();
|
||||
break;
|
||||
|
||||
case ID_FILE_EXIT:
|
||||
|
@ -2461,14 +2463,16 @@ LRESULT CALLBACK OBS::OBSProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
break;
|
||||
|
||||
case ID_TESTSTREAM:
|
||||
App->RefreshStreamButtons(true);
|
||||
App->bTestStream = true;
|
||||
App->ToggleCapturing();
|
||||
App->RefreshStreamButtons();
|
||||
break;
|
||||
|
||||
case ID_STARTSTOP:
|
||||
EnableWindow(GetDlgItem(hwnd, ID_STARTSTOP), false);
|
||||
App->RefreshStreamButtons(true);
|
||||
App->ToggleCapturing();
|
||||
EnableWindow(GetDlgItem(hwnd, ID_STARTSTOP), true);
|
||||
App->RefreshStreamButtons();
|
||||
break;
|
||||
|
||||
case ID_MINIMIZERESTORE:
|
||||
|
|
Loading…
Reference in New Issue