Implement scene collections in menu only

This hopefully resolves some conflicting opinions about how scene
collections should be handled, and removes it from the general settings
panel, where it felt a bit cluttered.

Actually, I would kind of like it if profiles were handled this way too.
This feels a lot cleaner than how profiles are handled in the general
settings.  The profiles thing in the general settings definitely feels
clunky.

In the main menu, the scene collections menu now has the following menu
items:

- New
- Duplicate
- Rename
- Remove
- Import
- Export

Duplicate was something I personally added - I felt like it might be a
nice thing to have for the sake of convenience.  Import/Export was
requested by dodgepong, and is also definitely nice to have.  Due to how
easy new scene collections are to set up it didn't take very long to put
in.
master
jp9000 2014-07-30 18:19:10 -07:00
parent 75b365cdf4
commit 70cb064d32
8 changed files with 342 additions and 233 deletions

27
OBS.rc
View File

@ -185,20 +185,15 @@ BEGIN
PUSHBUTTON "Add",IDC_ADD,146,58,76,14
PUSHBUTTON "Rename",IDC_RENAME,224,58,76,14
PUSHBUTTON "Remove",IDC_REMOVE,302,58,70,14
LTEXT "Settings.General.Restart",IDC_INFO,7,202,409,48,NOT WS_VISIBLE
LTEXT "Settings.General.Restart",IDC_INFO,7,160,409,48,NOT WS_VISIBLE
CONTROL "Settings.General.Notification",IDC_NOTIFICATIONICON,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,122,264,10,WS_EX_RIGHT
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,80,264,10,WS_EX_RIGHT
CONTROL "Settings.General.NotificationMinimize",IDC_MINIZENOTIFICATION,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,133,264,10,WS_EX_RIGHT
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,91,264,10,WS_EX_RIGHT
CONTROL "Settings.General.EnableProjectorCursor",IDC_ENABLEPROJECTORCURSOR,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,154,264,10,WS_EX_RIGHT
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,112,264,10,WS_EX_RIGHT
CONTROL "Settings.General.ShowLogWindowOnLaunch",IDC_SHOWLOGWINDOWONLAUNCH,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,175,264,10,WS_EX_RIGHT
RTEXT "Settings.General.SceneCollection",IDC_STATIC,4,85,139,8,NOT WS_VISIBLE
COMBOBOX IDC_SCENECOLLECTION,146,82,226,126,CBS_DROPDOWN | CBS_SORT | NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Add",IDC_ADD2,146,98,76,14,NOT WS_VISIBLE
PUSHBUTTON "Rename",IDC_RENAME2,223,98,76,14,NOT WS_VISIBLE
PUSHBUTTON "Remove",IDC_REMOVE2,301,98,71,14,NOT WS_VISIBLE
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,133,264,10,WS_EX_RIGHT
END
IDD_SETTINGS_AUDIO DIALOGEX 0, 0, 427, 336
@ -965,6 +960,18 @@ BEGIN
BEGIN
MENUITEM "nothing here", ID_MAINMENU_NOTHINGHERE
END
POPUP "MainMenu.SceneCollection"
BEGIN
MENUITEM "MainMenu.SceneCollection.New", ID_SCENECOLLECTION_NEW
MENUITEM "MainMenu.SceneCollection.Duplicate", ID_SCENECOLLECTION_CLONE
MENUITEM "MainMenu.SceneCollection.Rename", ID_SCENECOLLECTION_RENAME
MENUITEM "MainMenu.SceneCollection.Remove", ID_SCENECOLLECTION_REMOVE
MENUITEM SEPARATOR
MENUITEM "MainMenu.SceneCollection.Import", ID_SCENECOLLECTION_IMPORT
MENUITEM "MainMenu.SceneCollection.Export", ID_SCENECOLLECTION_EXPORT
MENUITEM SEPARATOR
MENUITEM "nothing here", ID_MAINMENU_NOTHINGHERE
END
POPUP "MainMenu.Help"
BEGIN
MENUITEM "MainMenu.Help.VisitWebsite", ID_HELP_VISITWEBSITE

View File

@ -468,7 +468,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
int numArgs;
LPWSTR *args = CommandLineToArgvW(GetCommandLineW(), &numArgs);
LPWSTR profile = NULL;
//LPWSTR sceneCollection = NULL;
LPWSTR sceneCollection = NULL;
bool bDisableMutex = false;
@ -485,11 +485,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
if (++i < numArgs)
profile = args[i];
}
/*else if (scmpi(args[i], L"-scenecollection") == 0)
else if (scmpi(args[i], L"-scenecollection") == 0)
{
if (++i < numArgs)
sceneCollection = args[i];
}*/
}
}
//------------------------------------------------------------
@ -566,9 +566,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
if(!OSFileExists(strProfilesPath) && !OSCreateDirectory(strProfilesPath))
CrashError(TEXT("Couldn't create directory '%s'"), strProfilesPath.Array());
/*String strSceneCollectionPath = strAppDataPath + TEXT("\\sceneCollection");
String strSceneCollectionPath = strAppDataPath + TEXT("\\sceneCollection");
if (!OSFileExists(strSceneCollectionPath) && !OSCreateDirectory(strSceneCollectionPath))
CrashError(TEXT("Couldn't create directory '%s'"), strSceneCollectionPath.Array());*/
CrashError(TEXT("Couldn't create directory '%s'"), strSceneCollectionPath.Array());
String strLogsPath = strAppDataPath + TEXT("\\logs");
if(!OSFileExists(strLogsPath) && !OSCreateDirectory(strLogsPath))
@ -617,7 +617,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
AppConfig = new ConfigFile;
SetupIni(profile);
//SetupSceneCollection(sceneCollection);
SetupSceneCollection(sceneCollection);
//--------------------------------------------

View File

@ -545,15 +545,13 @@ OBS::OBS()
hwndTemp = GetDlgItem(hwndMain, ID_SCENES);
//CTSTR collection = GetCurrentSceneCollection();
CTSTR collection = GetCurrentSceneCollection();
String strScenesConfig;
/*strScenesConfig = FormattedString(L"%s/%s.xconfig", lpAppDataPath, collection);
strScenesConfig = FormattedString(L"%s/%s.xconfig", lpAppDataPath, collection);
if (!OSFileExists(strScenesConfig))
strScenesConfig = FormattedString(L"%s\\sceneCollection\\%s.xconfig", lpAppDataPath, collection);*/
strScenesConfig << lpAppDataPath << TEXT("\\scenes.xconfig");
strScenesConfig = FormattedString(L"%s\\sceneCollection\\%s.xconfig", lpAppDataPath, collection);
if(!scenesConfig.Open(strScenesConfig))
CrashError(TEXT("Could not open '%s'"), strScenesConfig.Array());
@ -636,7 +634,7 @@ OBS::OBS()
ReloadIniSettings();
ResetProfileMenu();
//ResetSceneCollectionMenu();
ResetSceneCollectionMenu();
ResetLogUploadMenu();
//-----------------------------------------------------

View File

@ -549,6 +549,12 @@ void ResetWASAPIAudioDevice(AudioSource *source);
struct FrameProcessInfo;
enum class SceneCollectionAction {
Add,
Rename,
Clone
};
//todo: this class has become way too big, it's horrible, and I should be ashamed of myself
class OBS
{
@ -1004,6 +1010,11 @@ private:
static void ResetLogUploadMenu();
static void DisableMenusWhileStreaming(bool disable);
static INT_PTR CALLBACK EnterSceneCollectionDialogProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
void AddSceneCollection(SceneCollectionAction action);
void RemoveSceneCollection();
void ImportSceneCollection();
void ExportSceneCollection();
static void ResetSceneCollectionMenu();
static void AddSceneCollectionToMenu(HMENU menu);
void ReloadSceneCollection();

View File

@ -177,30 +177,6 @@ INT_PTR SettingsGeneral::ProcMessage(UINT message, WPARAM wParam, LPARAM lParam)
//----------------------------------------------
/*String strCurSceneCollection = GlobalConfig->GetString(TEXT("General"), TEXT("SceneCollection"));
hwndTemp = GetDlgItem(hwnd, IDC_SCENECOLLECTION);
StringList sceneCollectionList;
App->GetSceneCollection(sceneCollectionList);
for (UINT i = 0; i<sceneCollectionList.Num(); i++)
{
UINT id = (UINT)SendMessage(hwndTemp, CB_ADDSTRING, 0, (LPARAM)sceneCollectionList[i].Array());
if (sceneCollectionList[i].CompareI(strCurSceneCollection))
SendMessage(hwndTemp, CB_SETCURSEL, id, 0);
}
EnableWindow(hwndTemp, !App->bRunning);
EnableWindow(GetDlgItem(hwnd, IDC_ADD2), FALSE);
EnableWindow(GetDlgItem(hwnd, IDC_RENAME2), FALSE);
UINT numItems2 = (UINT)SendMessage(hwndTemp, CB_GETCOUNT, 0, 0);
EnableWindow(GetDlgItem(hwnd, IDC_REMOVE2), (numItems2 > 1) && !App->bRunning && strCurSceneCollection != L"scenes");*/
//----------------------------------------------
bool bShowNotificationAreaIcon = AppConfig->GetInt(TEXT("General"), TEXT("ShowNotificationAreaIcon"), 0) != 0;
SendMessage(GetDlgItem(hwnd, IDC_NOTIFICATIONICON), BM_SETCHECK, bShowNotificationAreaIcon ? BST_CHECKED : BST_UNCHECKED, 0);
@ -314,83 +290,6 @@ INT_PTR SettingsGeneral::ProcMessage(UINT message, WPARAM wParam, LPARAM lParam)
App->ResizeWindow(false);
}
break;
/*case IDC_SCENECOLLECTION:
if (App->bRunning)
{
HWND cb = (HWND)lParam;
String curSceneCollection = GlobalConfig->GetString(TEXT("General"), TEXT("SceneCollection"));
UINT numItems = (UINT)SendMessage(cb, CB_GETCOUNT, 0, 0);
for (UINT i = 0; i < numItems; i++)
{
if (GetCBText(cb, i).Compare(curSceneCollection))
SendMessage(cb, CB_SETCURSEL, i, 0);
}
break;
}
if (HIWORD(wParam) == CBN_EDITCHANGE)
{
String strText = GetEditText((HWND)lParam).KillSpaces();
EnableWindow(GetDlgItem(hwnd, IDC_REMOVE2), FALSE);
if (strText.IsValid())
{
if (IsValidFileName(strText))
{
String strCurSceneCollection = GlobalConfig->GetString(TEXT("General"), TEXT("SceneCollection"));
UINT id = (UINT)SendMessage((HWND)lParam, CB_FINDSTRINGEXACT, -1, (LPARAM)strText.Array());
EnableWindow(GetDlgItem(hwnd, IDC_ADD2), (id == CB_ERR));
EnableWindow(GetDlgItem(hwnd, IDC_RENAME2), strCurSceneCollection != L"scenes" && ((id == CB_ERR) || strCurSceneCollection.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_ADD2), FALSE);
EnableWindow(GetDlgItem(hwnd, IDC_RENAME2), FALSE);
}
else if (HIWORD(wParam) == CBN_SELCHANGE)
{
EnableWindow(GetDlgItem(hwnd, IDC_ADD2), FALSE);
EnableWindow(GetDlgItem(hwnd, IDC_RENAME2), FALSE);
App->scenesConfig.Save();
String strSceneCollection = GetCBText((HWND)lParam);
String strSceneCollectionPath;
strSceneCollectionPath = FormattedString(L"%s/%s.xconfig", lpAppDataPath, strSceneCollection.Array());
if (!OSFileExists(strSceneCollectionPath))
strSceneCollectionPath = FormattedString(L"%s\\sceneCollection\\%s.xconfig", lpAppDataPath, strSceneCollection.Array());
if (!App->scenesConfig.Open(strSceneCollectionPath))
{
OBSMessageBox(hwnd, TEXT("Error - unable to open xconfig file"), NULL, 0);
break;
}
GlobalConfig->SetString(TEXT("General"), TEXT("SceneCollection"), strSceneCollection);
App->scenesConfig.Close();
App->ReloadSceneCollection();
App->ResetSceneCollectionMenu();
App->ResetApplicationName();
App->UpdateNotificationAreaIcon();
UINT numItems = (UINT)SendMessage(GetDlgItem(hwnd, IDC_SCENECOLLECTION), CB_GETCOUNT, 0, 0);
EnableWindow(GetDlgItem(hwnd, IDC_REMOVE2), (numItems > 1) && strSceneCollection != L"scenes");
App->ResizeWindow(false);
}
break;*/
case IDC_RENAME:
case IDC_ADD:
if (App->bRunning)
@ -488,108 +387,6 @@ INT_PTR SettingsGeneral::ProcMessage(UINT message, WPARAM wParam, LPARAM lParam)
break;
}
/*case IDC_RENAME2:
case IDC_ADD2:
if (App->bRunning)
break;
if (HIWORD(wParam) == BN_CLICKED)
{
App->scenesConfig.Save();
HWND hwndSceneCollectionList = GetDlgItem(hwnd, IDC_SCENECOLLECTION);
String strSceneCollection = GetEditText(hwndSceneCollectionList).KillSpaces();
SetWindowText(hwndSceneCollectionList, strSceneCollection);
if (strSceneCollection.IsEmpty())
break;
bool bRenaming = (LOWORD(wParam) == IDC_RENAME2);
String strCurSceneCollection = GlobalConfig->GetString(TEXT("General"), TEXT("SceneCollection"));
String strCurSceneCollectionPath;
strCurSceneCollectionPath = FormattedString(L"%s/%s.xconfig", lpAppDataPath, strCurSceneCollection.Array());
if (!OSFileExists(strCurSceneCollectionPath))
strCurSceneCollectionPath = FormattedString(L"%s\\sceneCollection\\%s.xconfig", lpAppDataPath, strCurSceneCollection.Array());
String strSceneCollectionPath;
strSceneCollectionPath << lpAppDataPath << TEXT("\\sceneCollection\\") << strSceneCollection << TEXT(".xconfig");
if ((!bRenaming || !strSceneCollectionPath.CompareI(strCurSceneCollectionPath)) && OSFileExists(strSceneCollectionPath))
OBSMessageBox(hwnd, Str("Settings.General.ScenesExists"), NULL, 0);
else
{
if (bRenaming)
{
if (!MoveFile(strCurSceneCollectionPath, strSceneCollectionPath))
break;
App->scenesConfig.Close();
UINT curID2 = (UINT)SendMessage(hwndSceneCollectionList, CB_FINDSTRINGEXACT, -1, (LPARAM)strCurSceneCollection.Array());
if (curID2 != CB_ERR)
SendMessage(hwndSceneCollectionList, CB_DELETESTRING, curID2, 0);
}
else
{
if(!App->scenesConfig.Open(strSceneCollectionPath))
{
OBSMessageBox(hwnd, TEXT("Error - unable to create new Scene Collection, could not create file"), NULL, 0);
break;
}
}
UINT id = (UINT)SendMessage(hwndSceneCollectionList, CB_ADDSTRING, 0, (LPARAM)strSceneCollection.Array());
SendMessage(hwndSceneCollectionList, CB_SETCURSEL, id, 0);
GlobalConfig->SetString(TEXT("General"), TEXT("SceneCollection"), strSceneCollection);
UINT numItems2 = (UINT)SendMessage(hwndSceneCollectionList, CB_GETCOUNT, 0, 0);
EnableWindow(GetDlgItem(hwnd, IDC_REMOVE2), (numItems2 > 1) && strSceneCollection != L"scenes");
EnableWindow(GetDlgItem(hwnd, IDC_RENAME2), FALSE);
EnableWindow(GetDlgItem(hwnd, IDC_ADD2), FALSE);
App->scenesConfig.Close(true);
App->ReloadSceneCollection();
App->ResetSceneCollectionMenu();
App->ResetApplicationName();
}
}
break;
case IDC_REMOVE2:
if (App->bRunning)
break;
{
HWND hwndSceneCollectionList = GetDlgItem(hwnd, IDC_SCENECOLLECTION);
String strCurSceneCollection = GlobalConfig->GetString(TEXT("General"), TEXT("SceneCollection"));
UINT numItems = (UINT)SendMessage(hwndSceneCollectionList, CB_GETCOUNT, 0, 0);
String strConfirm = Str("Settings.General.ConfirmDelete");
strConfirm.FindReplace(TEXT("$1"), strCurSceneCollection);
if (OBSMessageBox(hwnd, strConfirm, Str("DeleteConfirm.Title"), MB_YESNO) == IDYES)
{
UINT id = (UINT)SendMessage(hwndSceneCollectionList, CB_FINDSTRINGEXACT, -1, (LPARAM)strCurSceneCollection.Array());
if (id != CB_ERR)
{
SendMessage(hwndSceneCollectionList, CB_DELETESTRING, id, 0);
if (id == numItems - 1)
id--;
SendMessage(hwndSceneCollectionList, CB_SETCURSEL, id, 0);
DialogProc(hwnd, WM_COMMAND, MAKEWPARAM(IDC_SCENECOLLECTION, CBN_SELCHANGE), (LPARAM)hwndSceneCollectionList);
String strCurSceneCollectionPath;
strCurSceneCollectionPath << lpAppDataPath << TEXT("\\sceneCollection\\") << strCurSceneCollection << TEXT(".xconfig");
OSDeleteFile(strCurSceneCollectionPath);
App->scenesConfig.Close();
App->ReloadSceneCollection();
App->ResetSceneCollectionMenu();
}
}
break;
}*/
case IDC_NOTIFICATIONICON:
if (SendMessage(GetDlgItem(hwnd, IDC_NOTIFICATIONICON), BM_GETCHECK, 0, 0) == BST_UNCHECKED)
{

View File

@ -74,6 +74,61 @@ enum
ID_PROJECTOR=6000,
};
INT_PTR CALLBACK OBS::EnterSceneCollectionDialogProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
{
SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR)lParam);
LocalizeWindow(hwnd);
String &strOut = *(String*)GetWindowLongPtr(hwnd, DWLP_USER);
SetWindowText(GetDlgItem(hwnd, IDC_NAME), strOut);
return true;
}
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
{
String str;
str.SetLength((UINT)SendMessage(GetDlgItem(hwnd, IDC_NAME), WM_GETTEXTLENGTH, 0, 0));
if (!str.Length())
{
OBSMessageBox(hwnd, Str("EnterName"), NULL, 0);
break;
}
SendMessage(GetDlgItem(hwnd, IDC_NAME), WM_GETTEXT, str.Length()+1, (LPARAM)str.Array());
String &strOut = *(String*)GetWindowLongPtr(hwnd, DWLP_USER);
String strSceneCollectionPath;
strSceneCollectionPath << lpAppDataPath << TEXT("\\sceneCollection\\") << str << TEXT(".xconfig");
if (OSFileExists(strSceneCollectionPath))
{
String strExists = Str("NameExists");
strExists.FindReplace(TEXT("$1"), str);
OBSMessageBox(hwnd, strExists, NULL, 0);
break;
}
strOut = str;
}
case IDCANCEL:
EndDialog(hwnd, LOWORD(wParam));
break;
}
}
return false;
}
INT_PTR CALLBACK OBS::EnterSourceNameDialogProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
@ -2316,20 +2371,217 @@ void OBS::AddSceneCollectionToMenu(HMENU menu)
}
}
//----------------------------
void OBS::AddSceneCollection(SceneCollectionAction action)
{
if (App->bRunning)
return;
String strCurSceneCollection = GlobalConfig->GetString(TEXT("General"), TEXT("SceneCollection"));
String strSceneCollection;
if (action == SceneCollectionAction::Rename)
strSceneCollection = strCurSceneCollection;
if (OBSDialogBox(hinstMain, MAKEINTRESOURCE(IDD_ENTERNAME), hwndMain, OBS::EnterSceneCollectionDialogProc, (LPARAM)&strSceneCollection) != IDOK)
return;
App->scenesConfig.Save();
String strCurSceneCollectionPath;
strCurSceneCollectionPath = FormattedString(L"%s/%s.xconfig", lpAppDataPath, strCurSceneCollection.Array());
if (!OSFileExists(strCurSceneCollectionPath))
strCurSceneCollectionPath = FormattedString(L"%s\\sceneCollection\\%s.xconfig", lpAppDataPath, strCurSceneCollection.Array());
String strSceneCollectionPath;
strSceneCollectionPath << lpAppDataPath << TEXT("\\sceneCollection\\") << strSceneCollection << TEXT(".xconfig");
if ((action != SceneCollectionAction::Rename || !strSceneCollectionPath.CompareI(strCurSceneCollectionPath)) && OSFileExists(strSceneCollectionPath))
OBSMessageBox(hwndMain, Str("Settings.General.ScenesExists"), NULL, 0);
else
{
bool success = true;
App->scenesConfig.Close(true);
if (action == SceneCollectionAction::Rename)
{
if (!MoveFile(strCurSceneCollectionPath, strSceneCollectionPath))
success = false;
}
else if (action == SceneCollectionAction::Clone)
{
if (!CopyFileW(strCurSceneCollectionPath, strSceneCollectionPath, TRUE))
success = false;
}
else
{
if (!App->scenesConfig.Open(strSceneCollectionPath))
{
OBSMessageBox(hwndMain, TEXT("Error - unable to create new Scene Collection, could not create file"), NULL, 0);
success = false;
}
}
if (!success)
{
App->scenesConfig.Open(strCurSceneCollectionPath);
return;
}
GlobalConfig->SetString(TEXT("General"), TEXT("SceneCollection"), strSceneCollection);
App->ReloadSceneCollection();
App->ResetSceneCollectionMenu();
App->ResetApplicationName();
}
}
void OBS::RemoveSceneCollection()
{
if (App->bRunning)
return;
String strCurSceneCollection = GlobalConfig->GetString(TEXT("General"), TEXT("SceneCollection"));
String strCurSceneCollectionFile = strCurSceneCollection + L".xconfig";
String strCurSceneCollectionDir;
strCurSceneCollectionDir << lpAppDataPath << TEXT("\\sceneCollection\\");
OSFindData ofd;
HANDLE hFind = OSFindFirstFile(strCurSceneCollectionDir + L"*.xconfig", ofd);
if (!hFind)
{
Log(L"Find failed for scene collections");
return;
}
String nextFile;
do
{
if (scmpi(ofd.fileName, strCurSceneCollectionFile) != 0)
{
nextFile = ofd.fileName;
break;
}
} while (OSFindNextFile(hFind, ofd));
OSFindClose(hFind);
if (nextFile.IsEmpty())
return;
String strConfirm = Str("Settings.General.ConfirmDelete");
strConfirm.FindReplace(TEXT("$1"), strCurSceneCollection);
if (OBSMessageBox(hwndMain, strConfirm, Str("DeleteConfirm.Title"), MB_YESNO) == IDYES)
{
String strCurSceneCollectionPath;
strCurSceneCollectionPath << strCurSceneCollectionDir << strCurSceneCollection << TEXT(".xconfig");
OSDeleteFile(strCurSceneCollectionPath);
App->scenesConfig.Close();
GlobalConfig->SetString(L"General", L"SceneCollection", GetPathWithoutExtension(nextFile));
App->ReloadSceneCollection();
App->ResetSceneCollectionMenu();
}
}
void OBS::ImportSceneCollection()
{
if (OBSMessageBox(hwndMain, Str("ImportCollectionReplaceWarning.Text"), Str("ImportCollectionReplaceWarning.Title"), MB_YESNO) == IDNO)
return;
TCHAR lpFile[MAX_PATH+1];
zero(lpFile, sizeof(lpFile));
OPENFILENAME ofn;
zero(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.lpstrFile = lpFile;
ofn.hwndOwner = hwndMain;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrFilter = TEXT("Scene Files (*.xconfig)\0*.xconfig\0");
ofn.nFilterIndex = 1;
ofn.lpstrInitialDir = GlobalConfig->GetString(L"General", L"LastImportExportPath");
TCHAR curDirectory[MAX_PATH+1];
GetCurrentDirectory(MAX_PATH, curDirectory);
BOOL bOpenFile = GetOpenFileName(&ofn);
SetCurrentDirectory(curDirectory);
if (!bOpenFile)
return;
if (GetPathExtension(lpFile).IsEmpty())
scat(lpFile, L".xconfig");
GlobalConfig->SetString(L"General", L"LastImportExportPath", GetPathDirectory(lpFile));
String strCurSceneCollection = GlobalConfig->GetString(TEXT("General"), TEXT("SceneCollection"));
String strCurSceneCollectionFile;
strCurSceneCollectionFile << lpAppDataPath << TEXT("\\sceneCollection\\") << strCurSceneCollection << L".xconfig";
scenesConfig.Close();
CopyFile(lpFile, strCurSceneCollectionFile, false);
App->ReloadSceneCollection();
}
void OBS::ExportSceneCollection()
{
TCHAR lpFile[MAX_PATH+1];
zero(lpFile, sizeof(lpFile));
OPENFILENAME ofn;
zero(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.lpstrFile = lpFile;
ofn.hwndOwner = hwndMain;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrFilter = TEXT("Scene Files (*.xconfig)\0*.xconfig\0");
ofn.nFilterIndex = 1;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
ofn.lpstrInitialDir = GlobalConfig->GetString(L"General", L"LastImportExportPath");
TCHAR curDirectory[MAX_PATH+1];
GetCurrentDirectory(MAX_PATH, curDirectory);
BOOL bSaveFile = GetSaveFileName(&ofn);
SetCurrentDirectory(curDirectory);
if (!bSaveFile)
return;
if (GetPathExtension(lpFile).IsEmpty())
scat(lpFile, L".xconfig");
GlobalConfig->SetString(L"General", L"LastImportExportPath", GetPathDirectory(lpFile));
String strCurSceneCollection = GlobalConfig->GetString(TEXT("General"), TEXT("SceneCollection"));
String strCurSceneCollectionFile;
strCurSceneCollectionFile << lpAppDataPath << TEXT("\\sceneCollection\\") << strCurSceneCollection << L".xconfig";
scenesConfig.Save();
CopyFile(strCurSceneCollectionFile, lpFile, FALSE);
}
//----------------------------
void OBS::ResetSceneCollectionMenu()
{
HMENU hmenuMain = GetMenu(hwndMain);
HMENU hmenuSceneCollection = GetSubMenu(hmenuMain, 3);
while (DeleteMenu(hmenuSceneCollection, 0, MF_BYPOSITION));
while (DeleteMenu(hmenuSceneCollection, 8, MF_BYPOSITION));
AddSceneCollectionToMenu(hmenuSceneCollection);
}
//----------------------------
void OBS::ResetProfileMenu()
{
HMENU hmenuMain = GetMenu(hwndMain);
HMENU hmenuProfiles = GetSubMenu(hmenuMain, 2);
while(DeleteMenu(hmenuProfiles, 0, MF_BYPOSITION));
while (DeleteMenu(hmenuProfiles, 0, MF_BYPOSITION));
AddProfilesToMenu(hmenuProfiles);
}
@ -2700,7 +2952,7 @@ String OBS::GetApplicationName()
// we hide the bit version on 32 bit to avoid confusing users who have a 64
// bit pc unncessarily asking for the 64 bit version under the assumption
// that the 32 bit version doesn't work or something.
name << "Profile: " << App->GetCurrentProfile() /*<< " - " << "SceneCollection: " << App->GetCurrentSceneCollection()*/ << L" - " OBS_VERSION_STRING
name << "Profile: " << App->GetCurrentProfile() << " - " << "Scenes: " << App->GetCurrentSceneCollection() << L" - " OBS_VERSION_STRING
#ifdef _WIN64
L" - 64bit";
#else
@ -2921,6 +3173,25 @@ LRESULT CALLBACK OBS::OBSProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
}
break;
case ID_SCENECOLLECTION_NEW:
App->AddSceneCollection(SceneCollectionAction::Add);
break;
case ID_SCENECOLLECTION_CLONE:
App->AddSceneCollection(SceneCollectionAction::Clone);
break;
case ID_SCENECOLLECTION_RENAME:
App->AddSceneCollection(SceneCollectionAction::Rename);
break;
case ID_SCENECOLLECTION_REMOVE:
App->RemoveSceneCollection();
break;
case ID_SCENECOLLECTION_IMPORT:
App->ImportSceneCollection();
break;
case ID_SCENECOLLECTION_EXPORT:
App->ExportSceneCollection();
break;
case ID_TESTSTREAM:
App->RefreshStreamButtons(true);
App->bTestStream = true;
@ -3067,7 +3338,7 @@ LRESULT CALLBACK OBS::OBSProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
ResetApplicationName();
}
}
/*else if (id >= ID_SWITCHSCENECOLLECTION &&
else if (id >= ID_SWITCHSCENECOLLECTION &&
id <= ID_SWITCHSCENECOLLECTION_END)
{
if (App->bRunning)
@ -3111,7 +3382,7 @@ LRESULT CALLBACK OBS::OBSProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
ResetApplicationName();
App->UpdateNotificationAreaIcon();
}
}*/
}
else if (id >= ID_UPLOAD_LOG && id <= ID_UPLOAD_LOG_END)
{
String log = GetLogUploadMenuItem(id - ID_UPLOAD_LOG);

View File

@ -361,14 +361,26 @@
#define ID_HELP_ANALYZE_CURRENT_LOG 40063
#define ID_SETTINGS_SHOWCONSOLE 40066
#define ID_SHOWLOG 40067
#define ID_RECORDINGSFOLDER 40068
#define ID_RECORDINGSFOLDER 40068
#define ID_MAINMENU_NEW 40069
#define ID_MAINMENU_CLONE 40070
#define ID_MAINMENU_REMOVE 40071
#define ID_SCENECOLLECTION_REMOVE 40072
#define ID_SCENECOLLECTION_CLONE 40073
#define ID_SCENECOLLECTION_NEW 40074
#define ID_MAINMENU_RENAME 40075
#define ID_SCENECOLLECTION_RENAME 40076
#define ID_MAINMENU_MAINMENU40077 40077
#define ID_MAINMENU_MAINMENU40078 40078
#define ID_SCENECOLLECTION_IMPORT 40079
#define ID_SCENECOLLECTION_EXPORT 40080
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 149
#define _APS_NEXT_COMMAND_VALUE 40069
#define _APS_NEXT_COMMAND_VALUE 40081
#define _APS_NEXT_CONTROL_VALUE 1178
#define _APS_NEXT_SYMED_VALUE 101
#endif

View File

@ -44,6 +44,12 @@ StreamReport="Stream Report"
MessageBoxWarningCaption="Warning"
NoSourcesFound="You haven't added any sources! Are you sure you want to stream a black screen?"
ImportCollectionReplaceWarning.Title="Import Scene Collection"
ImportCollectionReplaceWarning.Text="The current scene data will be lost. Are you sure you want to import?"
DeleteCollection="Remove scene collection"
DeleteCollection.Text="Are you sure you want to remove the current scene collection?"
BuildingMP4Dialog.Progress="Building MP4, please wait..."
Connection.CouldNotConnect="Could not connect to server"
@ -73,6 +79,13 @@ Listbox.SetHotkey="Set Hotkey"
ListBox.ResetCrop="Reset Cropping"
MainMenu.SceneCollection="&Scene Collection"
MainMenu.SceneCollection.New="&New"
MainMenu.SceneCollection.Duplicate="&Duplicate"
MainMenu.SceneCollection.Rename="&Rename"
MainMenu.SceneCollection.Remove="Re&move"
MainMenu.SceneCollection.Import="&Import"
MainMenu.SceneCollection.Export="&Export"
MainMenu.File="&File"
MainMenu.Help="&Help"
MainMenu.Profiles="&Profiles"