HWND SceneSwitcherSettings::CreatePane(HWND parentHwnd) { hwnd = CreateDialogParam(thePlugin->hinstDll, MAKEINTRESOURCE(IDD_SETTINGS_SCENESW), parentHwnd, (DLGPROC)DialogProc, (LPARAM)this); //EM_SETCUEBANNER HWND hwndAppList = GetDlgItem(hwnd, IDC_APPLIST); HWND hwndMainScn = GetDlgItem(hwnd, IDC_MAINSCN); ComboBox_SetCueBannerText(hwndMainScn, PluginStr("Settings.Scene")); ComboBox_SetCueBannerText(hwndAppList, PluginStr("Settings.WindowTitle")); return hwnd; }
CTSTR SceneSwitcherSettings::GetCategory() const { return PluginStr("Plugin.SettingsName"); }
CTSTR GetPluginDescription() { return PluginStr("Plugin.Description"); }
void SceneSwitcherSettings::MsgInitDialog() { LocalizeWindow(hwnd, thePlugin->pluginLocale); HWND hwndAppList = GetDlgItem(hwnd, IDC_APPLIST); HWND hwndMainScn = GetDlgItem(hwnd, IDC_MAINSCN); HWND hwndAltScn = GetDlgItem(hwnd, IDC_ALTSCN); HWND hwndWSMap = GetDlgItem(hwnd, IDC_WSMAP); HWND hwndSwButton = GetDlgItem(hwnd, IDC_ALTSWITCH); HWND hwndNoswButton = GetDlgItem(hwnd, IDC_ALTNOSWITCH); HWND hwndCurrent = GetWindow(GetDesktopWindow(), GW_CHILD); // The top child of the desktop // let's fill the listcontrol SendMessage(hwndWSMap, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP, LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP); LVCOLUMN col1; col1.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH; col1.fmt = LVCFMT_RIGHT | LVCFMT_FIXED_WIDTH; col1.cx = 204+205; col1.pszText = (LPWSTR)PluginStr("Settings.WindowTitle"); LVCOLUMN col2; col2.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH; col2.fmt = LVCFMT_LEFT | LVCFMT_FIXED_WIDTH; col2.cx = 205; col2.pszText = (LPWSTR)PluginStr("Settings.Scene"); SendMessage(hwndWSMap, LVM_INSERTCOLUMN, 0, (LPARAM) (LPLVCOLUMN) &col1); SendMessage(hwndWSMap, LVM_INSERTCOLUMN, 1, (LPARAM) (LPLVCOLUMN) &col2); // Add the items for (int i = 0; i < thePlugin->GetnWindowsDefined(); i++) { String window = thePlugin->GetWindow(i); String scene = thePlugin->GetScene(i); LVITEM item; item.iItem = 0; item.iSubItem = 0; item.mask = LVIF_TEXT; item.pszText = window; LVITEM subItem; subItem.iItem = 0; subItem.iSubItem = 1; subItem.mask = LVIF_TEXT; subItem.pszText = scene; SendMessage(hwndWSMap, LVM_INSERTITEM, 0, (LPARAM) &item); SendMessage(hwndWSMap, LVM_SETITEM, 0, (LPARAM) &subItem); } // Set the radio buttons and alt scene combo state SendMessage(hwndSwButton, BM_SETCHECK, (thePlugin->IsAltDoSwitch() ? BST_CHECKED : BST_UNCHECKED), 0); SendMessage(hwndNoswButton, BM_SETCHECK, (thePlugin->IsAltDoSwitch() ? BST_UNCHECKED : BST_CHECKED), 0); EnableWindow(hwndAltScn, thePlugin->IsAltDoSwitch()); do { if(IsWindowVisible(hwndCurrent)) { // Get the styles for the window DWORD exStyles = (DWORD)GetWindowLongPtr(hwndCurrent, GWL_EXSTYLE); DWORD styles = (DWORD)GetWindowLongPtr(hwndCurrent, GWL_STYLE); if( (exStyles & WS_EX_TOOLWINDOW) == 0 && (styles & WS_CHILD) == 0) { // The window is not a toolwindow, and not a child window String strWindowName; // Get the name of the window strWindowName.SetLength(GetWindowTextLength(hwndCurrent)); GetWindowText(hwndCurrent, strWindowName, strWindowName.Length()+1); // Add the Name of the window to the appList const int id = (int)SendMessage(hwndAppList, CB_ADDSTRING, 0, (LPARAM)strWindowName.Array()); // Set the data for the added item to be the window handle SendMessage(hwndAppList, CB_SETITEMDATA, id, (LPARAM)hwndCurrent); } } } // Move down the windows in z-order while (hwndCurrent = GetNextWindow(hwndCurrent, GW_HWNDNEXT)); // Get the list of scenes from OBS XElement* scnList = OBSGetSceneListElement(); if(scnList) { const DWORD numScn = scnList->NumElements(); for(DWORD i=0; i<numScn; i++) { CTSTR sceneName = (scnList->GetElementByID(i))->GetName(); // Add the scene name to both scene lists SendMessage(hwndMainScn, CB_ADDSTRING, 0, (LPARAM)sceneName); SendMessage(hwndAltScn, CB_ADDSTRING, 0, (LPARAM)sceneName); } } // Set the selected list items to be the ones from settings SendMessage(hwndMainScn, CB_SETCURSEL, SendMessage(hwndMainScn, CB_FINDSTRINGEXACT, -1, (LPARAM)thePlugin->GetmainSceneName()), 0); SendMessage(hwndAltScn, CB_SETCURSEL, SendMessage(hwndAltScn, CB_FINDSTRINGEXACT, -1, (LPARAM)thePlugin->GetaltSceneName()), 0); SendMessage(hwndAppList, CB_SETCURSEL, SendMessage(hwndAppList, CB_FINDSTRINGEXACT, -1, (LPARAM)thePlugin->GetmainWndName()), 0); // Set the frequency from the settings SetDlgItemInt(hwnd, IDC_FREQ, thePlugin->GettimeToSleep(), FALSE); // Set the autostart checkbox value from the settings if(thePlugin->IsStartAuto()) CheckDlgButton(hwnd, IDC_STARTAUTO, BST_CHECKED); // Set the toggle hotkey control SendMessage(GetDlgItem(hwnd, IDC_TOGGLEHOTKEY), HKM_SETHOTKEY, thePlugin->GetToggleHotkey(), 0); // If the plugin is running, update the text values if(thePlugin->IsRunning()) { SetWindowText(GetDlgItem(hwnd, IDC_RUN), PluginStr("Settings.Running")); SetWindowText(GetDlgItem(hwnd, IDC_STOP), PluginStr("Settings.Stop")); } }
CTSTR GetPluginName() { return PluginStr("Plugin.Name"); }