Added UI stuff for projector

This commit is contained in:
jp9000 2013-09-02 19:38:03 -07:00
parent 3520b15ca4
commit 0bcbc14fc0
8 changed files with 68 additions and 5 deletions

6
OBS.rc
View File

@ -168,9 +168,11 @@ BEGIN
PUSHBUTTON "Remove",IDC_REMOVE,301,58,75,14
LTEXT "Settings.General.Restart",IDC_INFO,7,145,409,48,NOT WS_VISIBLE
CONTROL "Settings.General.Notification",IDC_NOTIFICATIONICON,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,94,264,10,WS_EX_RIGHT
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,85,264,10,WS_EX_RIGHT
CONTROL "Settings.General.NotificationMinimize",IDC_MINIZENOTIFICATION,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,110,264,10,WS_EX_RIGHT
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,96,264,10,WS_EX_RIGHT
CONTROL "Settings.General.EnableProjectorCursor",IDC_ENABLEPROJECTORCURSOR,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,117,264,10,WS_EX_RIGHT
END
IDD_SETTINGS_AUDIO DIALOGEX 0, 0, 427, 336

View File

@ -1687,7 +1687,7 @@ void OBS::EnableProjector(UINT monitorID)
L"OBS Projector Window",
WS_VISIBLE|WS_POPUP, mi.rect.left, mi.rect.top,
projectorWidth, projectorHeight,
hwndMain, NULL, hinstMain, NULL);
NULL, NULL, hinstMain, NULL);
DXGI_SWAP_CHAIN_DESC swapDesc;
zero(&swapDesc, sizeof(swapDesc));

View File

@ -596,6 +596,7 @@ private:
bool bChangingSources;
bool bAlwaysOnTop;
bool bProjector;
bool bEnableProjectorCursor;
UINT projectorWidth, projectorHeight;
UINT projectorMonitorID;
HWND hwndProjector;

View File

@ -153,6 +153,8 @@ retryHookTest:
//-------------------------------------------------------------
bEnableProjectorCursor = GlobalConfig->GetInt(L"General", L"EnableProjectorCursor", 1) != 0;
int monitorID = AppConfig->GetInt(TEXT("Video"), TEXT("Monitor"));
if(monitorID >= (int)monitors.Num())
monitorID = 0;

View File

@ -90,6 +90,8 @@ void SettingsGeneral::ApplySettings()
bool bMinimizeToNotificationArea = SendMessage(GetDlgItem(hwnd, IDC_MINIZENOTIFICATION), BM_GETCHECK, 0, 0) == BST_CHECKED;
AppConfig->SetInt(TEXT("General"), TEXT("MinimizeToNotificationArea"), bMinimizeToNotificationArea);
GlobalConfig->SetInt(L"General", L"EnableProjectorCursor", App->bEnableProjectorCursor);
}
void SettingsGeneral::CancelSettings()
@ -169,6 +171,12 @@ INT_PTR SettingsGeneral::ProcMessage(UINT message, WPARAM wParam, LPARAM lParam)
//----------------------------------------------
App->bEnableProjectorCursor = GlobalConfig->GetInt(L"General", L"EnableProjectorCursor", 1) != 0;
SendMessage(GetDlgItem(hwnd, IDC_ENABLEPROJECTORCURSOR), BM_SETCHECK,
App->bEnableProjectorCursor ? BST_CHECKED : BST_UNCHECKED, 0);
//----------------------------------------------
SetChangedSettings(false);
return TRUE;
}
@ -365,6 +373,10 @@ INT_PTR SettingsGeneral::ProcMessage(UINT message, WPARAM wParam, LPARAM lParam)
}
SetChangedSettings(true);
break;
case IDC_ENABLEPROJECTORCURSOR:
App->bEnableProjectorCursor = (SendMessage(GetDlgItem(hwnd, IDC_ENABLEPROJECTORCURSOR), BM_GETCHECK, 0, 0) == BST_CHECKED);
break;
}
}

View File

@ -66,6 +66,7 @@ enum
ID_LISTBOX_ADD,
ID_LISTBOX_GLOBALSOURCE=5000,
ID_PROJECTOR=6000,
};
INT_PTR CALLBACK OBS::EnterSourceNameDialogProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
@ -699,7 +700,15 @@ void OBS::TrackModifyListbox(HWND hwnd, int ret)
// Sources below here
default:
if(ret >= ID_LISTBOX_ADD)
if (ret >= ID_PROJECTOR)
{
UINT monitorID = ret-ID_PROJECTOR;
if (monitorID == 0)
DisableProjector();
else
EnableProjector(monitorID-1);
}
else if(ret >= ID_LISTBOX_ADD)
{
App->EnableSceneSwitching(false);
@ -3176,6 +3185,13 @@ LRESULT CALLBACK OBS::ProjectorFrameProc(HWND hwnd, UINT message, WPARAM wParam,
App->DisableProjector();
break;
case WM_SETCURSOR:
if (App->bEnableProjectorCursor)
return DefWindowProc(hwnd, message, wParam, lParam);
else
SetCursor(NULL);
break;
default:
return DefWindowProc(hwnd, message, wParam, lParam);
}
@ -3964,6 +3980,28 @@ LRESULT CALLBACK OBS::RenderFrameProc(HWND hwnd, UINT message, WPARAM wParam, LP
AppendMenu(hPopup, MF_STRING | (App->bFullscreenMode ? MF_CHECKED : 0), ID_TOGGLEFULLSCREEN, Str("MainMenu.Settings.FullscreenMode"));
//---------------------------------------------------
if (App->bRunning) {
HMENU hProjector = CreatePopupMenu();
AppendMenu(hProjector, MF_STRING | (App->bProjector ? 0 : MF_CHECKED),
ID_PROJECTOR, Str("Disable"));
AppendMenu(hProjector, MF_SEPARATOR, 0, 0);
for (UINT i = 0; i < App->NumMonitors(); i++) {
String strMonitor = Str("MonitorNum");
strMonitor.FindReplace(L"$1", UIntString(i+1));
bool enabled = App->bProjector && App->projectorMonitorID == i;
AppendMenu(hProjector, MF_STRING | (enabled ? MF_CHECKED : 0),
ID_PROJECTOR+i+1, strMonitor);
}
AppendMenu(hPopup, MF_STRING|MF_POPUP, (UINT_PTR)hProjector, Str("MainMenu.Settings.Projector"));
}
//---------------------------------------------------
HWND hwndSources = GetDlgItem(hwndMain, ID_SOURCES);
int numItems = ListView_GetItemCount(hwndSources);
bool bSelected = ListView_GetSelectedCount(hwndSources) != 0;

View File

@ -272,6 +272,7 @@
#define IDC_MICSYNCFIX 1160
#define IDC_CHECK3 1161
#define IDC_SCROLLMODE 1161
#define IDC_ENABLEPROJECTORCURSOR 1161
#define IDA_SOURCE_MOVEUP 40018
#define IDA_SOURCE_MOVEDOWN 40019
#define IDA_SOURCE_MOVETOTOP 40020
@ -303,9 +304,13 @@
#define ID_MAINMENU_MAINMENU40048 40049
#define ID_FILE_SAVE2 40050
#define IDA_SOURCE_LEFT_CANVAS 40051
#define ID_MAINMENU_NOTHINGHERE40051 40051
#define IDA_SOURCE_TOP_CANVAS 40052
#define ID_MAINMENU_MAINMENU40052 40052
#define IDA_SOURCE_RIGHT_CANVAS 40053
#define ID_MAINMENU_MAINMENU40053 40053
#define IDA_SOURCE_BOTTOM_CANVAS 40054
#define ID_SETTINGS_DISABLEPROJECTOR 40054
#define IDA_SOURCE_CENTER_VER 40055
#define IDA_SOURCE_CENTER_HOR 40056
#define IDA_SOURCE_RESETCROP 40057
@ -315,7 +320,7 @@
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 145
#define _APS_NEXT_COMMAND_VALUE 40051
#define _APS_NEXT_COMMAND_VALUE 40055
#define _APS_NEXT_CONTROL_VALUE 1162
#define _APS_NEXT_SYMED_VALUE 101
#endif

View File

@ -18,6 +18,7 @@ Gamma="Gamma:"
GlobalSources="Global Sources..."
IncompatibleModules="Incompatible hook modules were detected in the OBS process. Please make sure OBS is added to the ignore list of any overlay or capture programs such as DXTory, FRAPS, ASUS/MSI OSD, etc. After changing ignore settings or closing such programs, you may need to restart OBS for changes to take effect.\r\n\r\nYou may ignore this warning and continue anyway at the risk of possible OBS crashes."
MicrophoneFailure="An error occurred initializing microphone audio - it may not be not plugged in, or another application could be using it in exclusive mode."
MonitorNum="Monitor $1"
MoveDown="Move Down"
MoveToBottom="Move to Bottom"
MoveToTop="Move to Top"
@ -70,6 +71,7 @@ MainMenu.Settings="&Settings"
MainMenu.Settings.AlwaysOnTop="&Always On Top"
MainMenu.Settings.FullscreenMode="&Fullscreen Preview Mode"
MainMenu.Settings.Projector="&Projector"
MainMenu.File.Exit="E&xit"
MainMenu.File.Save="&Save"
@ -186,6 +188,7 @@ Settings.Encoding.Video.QualityTooltip="This setting will attempt to target a ce
Settings.General.Add="Add New"
Settings.General.ConfirmDelete="Are you sure you wish to remove the profile '$1'?"
Settings.General.EnableProjectorCursor="Enable Cursor over projector"
Settings.General.InvalidName="Profile names cannot use the following characters:\r\n\\ / : * ? \" < > |"
Settings.General.Language="Language:"
Settings.General.Profile="Setting Profile:"