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 PUSHBUTTON "Remove",IDC_REMOVE,301,58,75,14
LTEXT "Settings.General.Restart",IDC_INFO,7,145,409,48,NOT WS_VISIBLE LTEXT "Settings.General.Restart",IDC_INFO,7,145,409,48,NOT WS_VISIBLE
CONTROL "Settings.General.Notification",IDC_NOTIFICATIONICON, 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, 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 END
IDD_SETTINGS_AUDIO DIALOGEX 0, 0, 427, 336 IDD_SETTINGS_AUDIO DIALOGEX 0, 0, 427, 336

View File

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

View File

@ -596,6 +596,7 @@ private:
bool bChangingSources; bool bChangingSources;
bool bAlwaysOnTop; bool bAlwaysOnTop;
bool bProjector; bool bProjector;
bool bEnableProjectorCursor;
UINT projectorWidth, projectorHeight; UINT projectorWidth, projectorHeight;
UINT projectorMonitorID; UINT projectorMonitorID;
HWND hwndProjector; 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")); int monitorID = AppConfig->GetInt(TEXT("Video"), TEXT("Monitor"));
if(monitorID >= (int)monitors.Num()) if(monitorID >= (int)monitors.Num())
monitorID = 0; monitorID = 0;

View File

@ -90,6 +90,8 @@ void SettingsGeneral::ApplySettings()
bool bMinimizeToNotificationArea = SendMessage(GetDlgItem(hwnd, IDC_MINIZENOTIFICATION), BM_GETCHECK, 0, 0) == BST_CHECKED; bool bMinimizeToNotificationArea = SendMessage(GetDlgItem(hwnd, IDC_MINIZENOTIFICATION), BM_GETCHECK, 0, 0) == BST_CHECKED;
AppConfig->SetInt(TEXT("General"), TEXT("MinimizeToNotificationArea"), bMinimizeToNotificationArea); AppConfig->SetInt(TEXT("General"), TEXT("MinimizeToNotificationArea"), bMinimizeToNotificationArea);
GlobalConfig->SetInt(L"General", L"EnableProjectorCursor", App->bEnableProjectorCursor);
} }
void SettingsGeneral::CancelSettings() 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); SetChangedSettings(false);
return TRUE; return TRUE;
} }
@ -365,6 +373,10 @@ INT_PTR SettingsGeneral::ProcMessage(UINT message, WPARAM wParam, LPARAM lParam)
} }
SetChangedSettings(true); SetChangedSettings(true);
break; 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_ADD,
ID_LISTBOX_GLOBALSOURCE=5000, ID_LISTBOX_GLOBALSOURCE=5000,
ID_PROJECTOR=6000,
}; };
INT_PTR CALLBACK OBS::EnterSourceNameDialogProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 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 // Sources below here
default: 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); App->EnableSceneSwitching(false);
@ -3176,6 +3185,13 @@ LRESULT CALLBACK OBS::ProjectorFrameProc(HWND hwnd, UINT message, WPARAM wParam,
App->DisableProjector(); App->DisableProjector();
break; break;
case WM_SETCURSOR:
if (App->bEnableProjectorCursor)
return DefWindowProc(hwnd, message, wParam, lParam);
else
SetCursor(NULL);
break;
default: default:
return DefWindowProc(hwnd, message, wParam, lParam); 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")); 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); HWND hwndSources = GetDlgItem(hwndMain, ID_SOURCES);
int numItems = ListView_GetItemCount(hwndSources); int numItems = ListView_GetItemCount(hwndSources);
bool bSelected = ListView_GetSelectedCount(hwndSources) != 0; bool bSelected = ListView_GetSelectedCount(hwndSources) != 0;

View File

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

View File

@ -18,6 +18,7 @@ Gamma="Gamma:"
GlobalSources="Global Sources..." 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." 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." 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" MoveDown="Move Down"
MoveToBottom="Move to Bottom" MoveToBottom="Move to Bottom"
MoveToTop="Move to Top" MoveToTop="Move to Top"
@ -70,6 +71,7 @@ MainMenu.Settings="&Settings"
MainMenu.Settings.AlwaysOnTop="&Always On Top" MainMenu.Settings.AlwaysOnTop="&Always On Top"
MainMenu.Settings.FullscreenMode="&Fullscreen Preview Mode" MainMenu.Settings.FullscreenMode="&Fullscreen Preview Mode"
MainMenu.Settings.Projector="&Projector"
MainMenu.File.Exit="E&xit" MainMenu.File.Exit="E&xit"
MainMenu.File.Save="&Save" 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.Add="Add New"
Settings.General.ConfirmDelete="Are you sure you wish to remove the profile '$1'?" 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.InvalidName="Profile names cannot use the following characters:\r\n\\ / : * ? \" < > |"
Settings.General.Language="Language:" Settings.General.Language="Language:"
Settings.General.Profile="Setting Profile:" Settings.General.Profile="Setting Profile:"