#include "Broams.h"
#include <io.h>
extern Settings *pSettings;
extern MenuCommon* pMenuCommon;
extern Dock *pDock;
extern Console *pConsole;
extern Desktop* pDesktop;
extern PluginManager *pPluginManager;
extern Toolbar *pToolbar;
extern Taskbar *pTaskbar;
extern Tooltips* pTooltips;
extern Workspaces* pWorkspaces;
extern Hotkeys* pHotkeys;
extern Wallpaper* pWallpaper;
unsigned int numberOfFiles, currentFile, randomFile;
char pathToScan[MAX_PATH];
char pathToFile[MAX_PATH];
bool ExecuteBroam(LPSTR broam, HINSTANCE hMainInstance)
{
if (pSettings) pSettings->Statistics.executedBroams++;
if (!_strnicmp(broam, "@xoblite", 8))
{
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_REGULAR_MESSAGE, (LPARAM)broam);
static char msg[MAX_LINE_LENGTH];
char token1[MAX_LINE_LENGTH], token2[MAX_LINE_LENGTH], token3[MAX_LINE_LENGTH], token4[MAX_LINE_LENGTH], extra[MAX_LINE_LENGTH];
LPSTR tokens[4];
tokens[0] = token1;
tokens[1] = token2;
tokens[2] = token3;
tokens[3] = token4;
token1[0] = token2[0] = token3[0] = token4[0] = extra[0] = '\0';
BBTokenize(broam, tokens, 4, extra);
if (!_stricmp(token2, "About"))
{
if (!_stricmp(token3, "Plugins"))
{
if (pPluginManager) pPluginManager->AboutPlugins();
}
else if (!_stricmp(token3, "Style"))
{
char aboutStyle[MAX_LINE_LENGTH], a1[MAX_LINE_LENGTH], a2[MAX_LINE_LENGTH], a3[MAX_LINE_LENGTH], a4[MAX_LINE_LENGTH], a5[MAX_LINE_LENGTH];
strcpy_s(a1, sizeofArray(a1), ReadString(pSettings->styleFile, "style.name:", "[Style name not specified]"));
strcpy_s(a2, sizeofArray(a2), ReadString(pSettings->styleFile, "style.author:", "[Author not specified]"));
strcpy_s(a3, sizeofArray(a3), ReadString(pSettings->styleFile, "style.date:", ""));
strcpy_s(a4, sizeofArray(a4), ReadString(pSettings->styleFile, "style.credits:", ""));
strcpy_s(a5, sizeofArray(a5), ReadString(pSettings->styleFile, "style.comments:", ""));
sprintf_s(aboutStyle, sizeofArray(aboutStyle), "%s \nby %s \n%s \n\n%s \n\n%s ", a1, a2, a3, a4, a5);
SendMessage(GetBBWnd(), BB_POPUPMESSAGE, (WPARAM)"About the current style...", (LPARAM)aboutStyle);
}
else if (!_stricmp(token3, "Hide"))
{
SendMessage(GetBBWnd(), BB_POPUPMESSAGE, NULL, NULL);
}
else
{
char buffer[MAX_LINE_LENGTH];
ULONG* size = 0;
DWORD number = GetFileVersionInfoSize("Blackbox.exe", size);
GetFileVersionInfo("Blackbox.exe", NULL, number, (LPVOID)buffer);
void* value;
UINT bytes;
VerQueryValue(buffer, TEXT("\\StringFileInfo\\000004b0\\FileVersion"), &value, &bytes);
char title[32];
strcpy_s(title, sizeofArray(title), "About xoblite...");
char body[MAX_LINE_LENGTH];
if (pSettings->debugLogging)
{
char buildType[32];
if (pSettings->runningUnderWOW64) strcpy_s(buildType, sizeofArray(buildType), "64-bit on ");
else strcpy_s(buildType, sizeofArray(buildType), "32-bit on ");
if (pSettings->machineArchitecture == IMAGE_FILE_MACHINE_I386) strcat_s(buildType, sizeofArray(buildType), "Intel CPU");
else if (pSettings->machineArchitecture == IMAGE_FILE_MACHINE_AMD64) strcat_s(buildType, sizeofArray(buildType), "AMD CPU");
else if (pSettings->machineArchitecture == IMAGE_FILE_MACHINE_ARM64) strcat_s(buildType, sizeofArray(buildType), "ARM CPU");
else strcat_s(buildType, sizeofArray(buildType), "unknown CPU");
sprintf_s(body, sizeofArray(body), "xoblite\x99 %s | %s\n", (LPCSTR)value, buildType);
}
else sprintf_s(body, sizeofArray(body), "xoblite\x99 %s\n", (LPCSTR)value);
strcat_s(body, sizeofArray(body),
"\xA9 2002-2026 Karl Henrik Henriksson [qwilk/@xoblite]\n"
"\xA9 2001-2004 The Blackbox for Windows Development Team\n\n"
"Contains a heavily modified version of the BImage rendering engine\n"
"used in the original \"Blackbox\" window manager for the X Window System\n"
"\xA9 1997-2000 Bradley T Hughes\n"
"\xA9 2001-2002 Sean 'Shaleh' Perry\n\n"
"More information about xoblite can be found in the documentation... :)\n\n"
"http://xoblite.net/\n"
"https://github.com/xoblite/ (used for issue reporting only)"); // Note: Used for issue reporting only; for various reasons the source code documentation etc is nowadays back on xoblite.net
SendMessage(GetBBWnd(), BB_POPUPMESSAGE, (WPARAM)title, (LPARAM)body);
}
return true;
}
else if (!_stricmp(token2, "Run"))
{
CreateRunBox(hMainInstance, NULL, "");
return true;
}
else if (!_stricmp(token2, "CheckForUpdates"))
{
bool silent = false;
_beginthread(checkForUpdates, 0, &silent);
return true;
}
else if (!_stricmp(token2, "LoadPlugin"))
{
if (strnlen_s(token3, sizeofArray(token3))) pPluginManager->LoadPlugin(token3);
else
{
if (pMenuCommon) pMenuCommon->Hide();
pPluginManager->LoadPluginDialog();
}
return true;
}
else if (!_stricmp(token2, "UnloadPlugin"))
{
if (token3[0] == '#')
{
int pluginNumber = atoi(&token3[1]) - 1;
if (!_stricmp(token4, "<Yes>")) pPluginManager->UnloadPlugin(NULL, pluginNumber);
else
{
char msg[MAX_LINE_LENGTH], pluginName[MAX_LINE_LENGTH];
strcpy_s(pluginName, sizeofArray(pluginName), pPluginManager->GetPluginInfo(pluginNumber, PLUGIN_NAME));
sprintf_s(msg, sizeofArray(msg), "Are you sure you want to unload %s?", pluginName);
char popupBroam[MAX_LINE_LENGTH];
sprintf_s(popupBroam, sizeofArray(popupBroam), "@xoblite UnloadPlugin %s <Yes>", token3);
SendMessage(GetBBWnd(), BB_POPUPMESSAGE, (WPARAM)msg, (LPARAM)popupBroam);
}
}
else pPluginManager->UnloadPlugin(token3, -1);
return true;
}
else if (!_stricmp(token2, "TogglePluginLoaded"))
{
char path[MAX_LINE_LENGTH];
if (strnlen_s(extra, sizeofArray(extra))) sprintf_s(path, sizeofArray(path), "%s %s %s", token3, token4, extra);
else if (strnlen_s(token4, sizeofArray(token4))) sprintf_s(path, sizeofArray(path), "%s %s", token3, token4);
else strcpy_s(path, sizeofArray(path), token3);
if (strnlen_s(path, sizeofArray(path)))
{
if (strchr(path, '\"')) StrRemoveEncap(path);
if (strchr(path, '$')) ReplaceShellFolders(path);
if (strchr(path, '%')) ReplaceEnvVars(path);
if (pPluginManager->IsPluginLoaded(path)) pPluginManager->UnloadPlugin(path, -1);
else pPluginManager->LoadPlugin(path);
}
return true;
}
else if (!_stricmp(token2, "Toolbar"))
{
if (!_stricmp(token3, "Hide") && !pSettings->toolbarHidden) PostMessage(GetBBWnd(), BB_TOGGLETOOLBAR, 0, 0);
else if (!_stricmp(token3, "Show") && pSettings->toolbarHidden) PostMessage(GetBBWnd(), BB_TOGGLETOOLBAR, 0, 0);
else if (!_stricmp(token3, "Toggle"))
{
if (strnlen_s(token4, sizeofArray(token4)) > 0)
{
if (!_stricmp(token4, "Label"))
{
if (!pSettings->toolbarLabelHidden) pSettings->toolbarLabelHidden = true;
else pSettings->toolbarLabelHidden = false;
WriteBool(pSettings->xobrcFile, "xoblite.toolbar.label.hidden:", pSettings->toolbarLabelHidden);
}
else if (!_stricmp(token4, "DownUp"))
{
if (!pSettings->toolbarDownUpButtonsHidden) pSettings->toolbarDownUpButtonsHidden = true;
else pSettings->toolbarDownUpButtonsHidden = false;
WriteBool(pSettings->xobrcFile, "xoblite.toolbar.downup.buttons.hidden:", pSettings->toolbarDownUpButtonsHidden);
}
else if (!_stricmp(token4, "LeftRight"))
{
if (!pSettings->toolbarLeftRightButtonsHidden) pSettings->toolbarLeftRightButtonsHidden = true;
else pSettings->toolbarLeftRightButtonsHidden = false;
WriteBool(pSettings->xobrcFile, "xoblite.toolbar.leftright.buttons.hidden:", pSettings->toolbarLeftRightButtonsHidden);
}
else if (!_stricmp(token4, "Clock"))
{
if (!pSettings->toolbarClockHidden) pSettings->toolbarClockHidden = true;
else pSettings->toolbarClockHidden = false;
WriteBool(pSettings->xobrcFile, "xoblite.toolbar.clock.hidden:", pSettings->toolbarClockHidden);
}
else if (!_stricmp(token4, "Asymmetry"))
{
if (!pSettings->toolbarAllowAsymmetry) pSettings->toolbarAllowAsymmetry = true;
else pSettings->toolbarAllowAsymmetry = false;
WriteBool(pSettings->xobrcFile, "xoblite.toolbar.allow.asymmetry:", pSettings->toolbarAllowAsymmetry);
}
pToolbar->UpdatePosition();
PlaySoundFX(SFX_TOGGLE_ELEMENT);
}
else PostMessage(GetBBWnd(), BB_TOGGLETOOLBAR, 0, 0);
}
else if (!_stricmp(token3, "Placement"))
{
char placement[255];
sprintf_s(placement, sizeofArray(placement), "%s %s", token4, extra);
pSettings->ParsePlacement(placement, &pSettings->ToolbarPlacement);
pSettings->WritePlacement(&pSettings->ToolbarPlacement);
pToolbar->UpdatePosition();
if (pDock && (pSettings->DockPlacement.placement == PLACEMENT_OPPOSITE_TOOLBAR)) pDock->UpdatePosition();
pDesktop->UpdateDesktopWindow();
PlaySoundFX(SFX_TOGGLE_ELEMENT);
}
else if (!_stricmp(token3, "Orientation"))
{
if (!_stricmp(token4, "Vertical")) pSettings->toolbarVertical = true;
else pSettings->toolbarVertical = false;
pToolbar->UpdatePosition();
PlaySoundFX(SFX_TOGGLE_ELEMENT);
WriteBool(pSettings->xobrcFile, "xoblite.toolbar.vertical:", pSettings->toolbarVertical);
}
else if (!_stricmp(token3, "ToggleOrientation"))
{
if (!pSettings->toolbarVertical) pSettings->toolbarVertical = true;
else pSettings->toolbarVertical = false;
pToolbar->UpdatePosition();
PlaySoundFX(SFX_TOGGLE_ELEMENT);
WriteBool(pSettings->xobrcFile, "xoblite.toolbar.vertical:", pSettings->toolbarVertical);
}
else if (!_stricmp(token3, "Width"))
{
int screenWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
int width = atoi(token4);
if (!pSettings->toolbarVertical)
{
if (width <= 100)
{
if (width < 30) width = 30;
}
else
{
int minWidth = (screenWidth * 30) / 100;
if (width < minWidth) width = minWidth;
else if (width > screenWidth) width = screenWidth;
}
if (width != pSettings->toolbarHorizontalWidth)
{
pSettings->toolbarHorizontalWidth = width;
pToolbar->UpdateWidth();
}
}
else
{
if (width <= 100)
{
if (width < 5) width = 5;
else if (width > 25) width = 25;
}
else
{
int minWidth = (screenWidth * 5) / 100;
int maxWidth = (screenWidth * 25) / 100;
if (width < minWidth) width = minWidth;
else if (width > maxWidth) width = maxWidth;
}
if (width != pSettings->toolbarVerticalWidth)
{
pSettings->toolbarVerticalWidth = width;
pToolbar->UpdateWidth();
}
}
}
else if (!_stricmp(token3, "Transparency"))
{
if (!_stricmp(token4, "Label"))
{
pSettings->toolbarLabelTransparencyAlpha = atoi(extra);
WriteInt(pSettings->xobrcFile, "xoblite.toolbar.label.transparency.alpha:", pSettings->toolbarLabelTransparencyAlpha);
}
else if (!_stricmp(token4, "WindowLabel"))
{
pSettings->toolbarWindowLabelTransparencyAlpha = atoi(extra);
WriteInt(pSettings->xobrcFile, "xoblite.toolbar.windowlabel.transparency.alpha:", pSettings->toolbarWindowLabelTransparencyAlpha);
}
else if (!_stricmp(token4, "Clock"))
{
pSettings->toolbarClockTransparencyAlpha = atoi(extra);
WriteInt(pSettings->xobrcFile, "xoblite.toolbar.clock.transparency.alpha:", pSettings->toolbarClockTransparencyAlpha);
}
else if (!_stricmp(token4, "Button"))
{
pSettings->toolbarButtonTransparencyAlpha = atoi(extra);
WriteInt(pSettings->xobrcFile, "xoblite.toolbar.button.transparency.alpha:", pSettings->toolbarButtonTransparencyAlpha);
}
else if (!_stricmp(token4, "ActiveTask"))
{
pSettings->taskbarActiveTransparencyAlpha = atoi(extra);
WriteInt(pSettings->xobrcFile, "xoblite.taskbar.active.transparency.alpha:", pSettings->taskbarActiveTransparencyAlpha);
}
else
{
pSettings->toolbarTransparencyAlpha = atoi(token4);
WriteInt(pSettings->xobrcFile, "xoblite.toolbar.transparency.alpha:", pSettings->toolbarTransparencyAlpha);
}
if (pToolbar) pToolbar->UpdateToolbarWindow();
}
else if (!_stricmp(token3, "Label"))
{
if (!_stricmp(token4, "Click"))
{
char button[MAX_LINE_LENGTH], command[MAX_LINE_LENGTH];
LPSTR override[1];
override[0] = button;
button[0] = command[0] = '\0';
BBTokenize(extra, override, 1, command);
if (!_stricmp(button, "DL"))
{
strcpy_s(pSettings->toolbarLabelDLClickOverride, sizeofArray(pSettings->toolbarLabelDLClickOverride), command);
WriteString(pSettings->xobrcFile, "xoblite.toolbar.label.dlclick.override:", pSettings->toolbarLabelDLClickOverride);
return true;
}
else if (!_stricmp(button, "R"))
{
strcpy_s(pSettings->toolbarLabelRClickOverride, sizeofArray(pSettings->toolbarLabelRClickOverride), command);
WriteString(pSettings->xobrcFile, "xoblite.toolbar.label.rclick.override:", pSettings->toolbarLabelRClickOverride);
return true;
}
else if (!_stricmp(button, "M"))
{
strcpy_s(pSettings->toolbarLabelMClickOverride, sizeofArray(pSettings->toolbarLabelMClickOverride), command);
WriteString(pSettings->xobrcFile, "xoblite.toolbar.label.mclick.override:", pSettings->toolbarLabelMClickOverride);
return true;
}
else if (!_stricmp(button, "X1"))
{
strcpy_s(pSettings->toolbarLabelX1ClickOverride, sizeofArray(pSettings->toolbarLabelX1ClickOverride), command);
WriteString(pSettings->xobrcFile, "xoblite.toolbar.label.x1click.override:", pSettings->toolbarLabelX1ClickOverride);
return true;
}
else if (!_stricmp(button, "X2"))
{
strcpy_s(pSettings->toolbarLabelX2ClickOverride, sizeofArray(pSettings->toolbarLabelX2ClickOverride), command);
WriteString(pSettings->xobrcFile, "xoblite.toolbar.label.x2click.override:", pSettings->toolbarLabelX2ClickOverride);
return true;
}
}
}
else if (!_stricmp(token3, "Clock"))
{
if (!_stricmp(token4, "Click"))
{
char button[MAX_LINE_LENGTH], command[MAX_LINE_LENGTH];
LPSTR override[1];
override[0] = button;
button[0] = command[0] = '\0';
BBTokenize(extra, override, 1, command);
if (!_stricmp(button, "DL"))
{
strcpy_s(pSettings->toolbarClockDLClickOverride, sizeofArray(pSettings->toolbarClockDLClickOverride), command);
WriteString(pSettings->xobrcFile, "xoblite.toolbar.clock.dlclick.override:", pSettings->toolbarClockDLClickOverride);
return true;
}
else if (!_stricmp(button, "R"))
{
strcpy_s(pSettings->toolbarClockRClickOverride, sizeofArray(pSettings->toolbarClockRClickOverride), command);
WriteString(pSettings->xobrcFile, "xoblite.toolbar.clock.rclick.override:", pSettings->toolbarClockRClickOverride);
return true;
}
else if (!_stricmp(button, "M"))
{
strcpy_s(pSettings->toolbarClockMClickOverride, sizeofArray(pSettings->toolbarClockMClickOverride), command);
WriteString(pSettings->xobrcFile, "xoblite.toolbar.clock.mclick.override:", pSettings->toolbarClockMClickOverride);
return true;
}
else if (!_stricmp(button, "X1"))
{
strcpy_s(pSettings->toolbarClockX1ClickOverride, sizeofArray(pSettings->toolbarClockX1ClickOverride), command);
WriteString(pSettings->xobrcFile, "xoblite.toolbar.clock.x1click.override:", pSettings->toolbarClockX1ClickOverride);
return true;
}
else if (!_stricmp(button, "X2"))
{
strcpy_s(pSettings->toolbarClockX2ClickOverride, sizeofArray(pSettings->toolbarClockX2ClickOverride), command);
WriteString(pSettings->xobrcFile, "xoblite.toolbar.clock.x2click.override:", pSettings->toolbarClockX2ClickOverride);
return true;
}
}
}
else if (!_stricmp(token3, "Button"))
{
if (!_stricmp(token4, "Down"))
{
strcpy_s(pSettings->toolbarDownButtonOverride, sizeofArray(pSettings->toolbarDownButtonOverride), extra);
WriteString(pSettings->xobrcFile, "xoblite.toolbar.downbutton.override:", pSettings->toolbarDownButtonOverride);
return true;
}
else if (!_stricmp(token4, "Up"))
{
strcpy_s(pSettings->toolbarUpButtonOverride, sizeofArray(pSettings->toolbarUpButtonOverride), extra);
WriteString(pSettings->xobrcFile, "xoblite.toolbar.upbutton.override:", pSettings->toolbarUpButtonOverride);
return true;
}
else if (!_stricmp(token4, "Left"))
{
strcpy_s(pSettings->toolbarLeftButtonOverride, sizeofArray(pSettings->toolbarLeftButtonOverride), extra);
WriteString(pSettings->xobrcFile, "xoblite.toolbar.leftbutton.override:", pSettings->toolbarLeftButtonOverride);
return true;
}
else if (!_stricmp(token4, "Right"))
{
strcpy_s(pSettings->toolbarRightButtonOverride, sizeofArray(pSettings->toolbarRightButtonOverride), extra);
WriteString(pSettings->xobrcFile, "xoblite.toolbar.rightbutton.override:", pSettings->toolbarRightButtonOverride);
return true;
}
}
else if (!_stricmp(token3, "MoveToMouse"))
{
pToolbar->MoveToMouse();
PlaySoundFX(SFX_TOGGLE_ELEMENT);
}
else if (!_stricmp(token3, "MoveToTop"))
{
SetForegroundWindow(pToolbar->hToolbarWnd);
PlaySoundFX(SFX_TOGGLE_ELEMENT);
}
else if (!_stricmp(token3, "ToggleRoundedCorners"))
{
if (!pSettings->toolbarRoundedCorners) pSettings->toolbarRoundedCorners = true;
else pSettings->toolbarRoundedCorners = false;
pToolbar->UpdatePosition();
WriteBool(pSettings->xobrcFile, "xoblite.toolbar.rounded:", pSettings->toolbarRoundedCorners);
}
else if (!_stricmp(token3, "ToggleAlwaysOnTop")) pToolbar->ToggleAlwaysOnTop();
else if (!_stricmp(token3, "ToggleSnapToEdges"))
{
if (!pSettings->toolbarSnapToEdges) pSettings->toolbarSnapToEdges = true;
else pSettings->toolbarSnapToEdges = false;
WriteBool(pSettings->xobrcFile, "xoblite.toolbar.snapToEdges:", pSettings->toolbarSnapToEdges);
}
return true;
}
else if (!_stricmp(token2, "Taskbar"))
{
if (!_stricmp(token3, "Hide"))
{
pTaskbar->ChangeTaskbarMode(TASKBAR_MODE_HIDDEN);
}
else if (!_stricmp(token3, "Mode"))
{
if (!_stricmp(token4, "Bars")) pTaskbar->ChangeTaskbarMode(TASKBAR_MODE_BARS);
else if (!_stricmp(token4, "Bars+Icons")) pTaskbar->ChangeTaskbarMode(TASKBAR_MODE_BARSICONS);
else if (!_stricmp(token4, "Icons")) pTaskbar->ChangeTaskbarMode(TASKBAR_MODE_ICONS);
else if (!_stricmp(token4, "Hidden")) pTaskbar->ChangeTaskbarMode(TASKBAR_MODE_HIDDEN);
else pTaskbar->ChangeTaskbarMode(TASKBAR_MODE_BARSICONS);
}
else if (!_stricmp(token3, "Items"))
{
pSettings->taskbarMaxItems = atoi(token4);
if (pToolbar)
{
pTaskbar->taskButtonsOffset = 0;
pToolbar->UpdatePosition();
}
WriteInt(pSettings->xobrcFile, "xoblite.taskbar.max.items:", pSettings->taskbarMaxItems);
}
else if (!_stricmp(token3, "Sort"))
{
if (!_stricmp(token4, "Last"))
{
pSettings->taskbarSorting = TASKBAR_SORT_BY_LAST_USED;
WriteString(pSettings->xobrcFile, "xoblite.taskbar.sorting:", "LastUsed");
}
else if (!_stricmp(token4, "Follow"))
{
pSettings->taskbarSorting = TASKBAR_SORT_FOLLOW_ACTIVE;
WriteString(pSettings->xobrcFile, "xoblite.taskbar.sorting:", "FollowActive");
}
else
{
pSettings->taskbarSorting = TASKBAR_SORT_DISABLED;
WriteString(pSettings->xobrcFile, "xoblite.taskbar.sorting:", "Disabled");
}
if (pToolbar) pToolbar->UpdateToolbarWindow();
}
else if (!_stricmp(token3, "IconSaturation"))
{
pSettings->taskbarSaturationValue = atoi(token4);
if (pToolbar) pToolbar->UpdateToolbarWindow();
WriteInt(pSettings->xobrcFile, "xoblite.taskbar.saturation:", pSettings->taskbarSaturationValue);
}
else if (!_stricmp(token3, "IconHue"))
{
pSettings->taskbarHueIntensity = atoi(token4);
if (pToolbar) pToolbar->UpdateToolbarWindow();
WriteInt(pSettings->xobrcFile, "xoblite.taskbar.hue:", pSettings->taskbarHueIntensity);
}
else if (!_stricmp(token3, "ToggleShowTaskWorkspace"))
{
if (!pSettings->taskbarShowTaskWorkspace) pSettings->taskbarShowTaskWorkspace = true;
else pSettings->taskbarShowTaskWorkspace = false;
if (pToolbar) pToolbar->UpdateToolbarWindow();
WriteBool(pSettings->xobrcFile, "xoblite.taskbar.show.task.workspace:", pSettings->taskbarShowTaskWorkspace);
}
else if (!_stricmp(token3, "ToggleCurrentOnly"))
{
pTaskbar->ToggleCurrentOnly();
}
else if (!_stricmp(token3, "ToggleFlashing"))
{
if (!pSettings->taskbarFlashing) pSettings->taskbarFlashing = true;
else pSettings->taskbarFlashing = false;
WriteBool(pSettings->xobrcFile, "xoblite.taskbar.flashing:", pSettings->taskbarFlashing);
}
else if (!_stricmp(token3, "ToggleActiveSatHue"))
{
if (!pSettings->taskbarActiveSatHue) pSettings->taskbarActiveSatHue = true;
else pSettings->taskbarActiveSatHue = false;
if (pToolbar) pToolbar->UpdateToolbarWindow();
WriteBool(pSettings->xobrcFile, "xoblite.taskbar.active.SatHue:", pSettings->taskbarActiveSatHue);
}
else if (!_stricmp(token3, "ToggleInactiveBackground"))
{
if (!pSettings->taskbarInactiveBackground) pSettings->taskbarInactiveBackground = true;
else pSettings->taskbarInactiveBackground = false;
if (pToolbar) pToolbar->UpdateToolbarWindow();
WriteBool(pSettings->xobrcFile, "xoblite.taskbar.inactive.background:", pSettings->taskbarInactiveBackground);
}
else if (!_stricmp(token3, "TogglePreviews"))
{
if (!pSettings->taskbarPreviews) pSettings->taskbarPreviews = true;
else pSettings->taskbarPreviews = false;
WriteBool(pSettings->xobrcFile, "xoblite.taskbar.previews:", pSettings->taskbarPreviews);
}
else if (!_stricmp(token3, "ToggleTooltips"))
{
if (pTooltips) pTooltips->ToggleTooltips();
}
else if (!_stricmp(token3, "QuitCurrentTask"))
{
HWND hwnd = pTaskbar->GetActiveWindow();
if (IsIconic(hwnd)) ShowWindow(hwnd, SW_RESTORE);
SetForegroundWindow(hwnd);
PostMessage(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
}
else if (!_stricmp(token3, "ZoomCurrentTask"))
{
HWND hwnd = pTaskbar->GetActiveWindow();
if (!IsIconic(hwnd))
{
if (IsZoomed(hwnd)) ShowWindow(hwnd, SW_RESTORE);
else ShowWindow(hwnd, SW_MAXIMIZE);
}
}
return true;
}
else if (!_stricmp(token2, "Dock"))
{
if (!_stricmp(token3, "Hide") && !pSettings->dockHidden) PostMessage(GetBBWnd(), BB_TOGGLEDOCK, 0, 0);
else if (!_stricmp(token3, "Show") && pSettings->dockHidden) PostMessage(GetBBWnd(), BB_TOGGLEDOCK, 0, 0);
else if (!_stricmp(token3, "Toggle")) PostMessage(GetBBWnd(), BB_TOGGLEDOCK, 0, 0);
else if (!_stricmp(token3, "Placement"))
{
char placement[255];
sprintf_s(placement, sizeofArray(placement), "%s %s", token4, extra);
pSettings->ParsePlacement(placement, &pSettings->DockPlacement);
pSettings->WritePlacement(&pSettings->DockPlacement);
if (pDock) pDock->UpdatePosition();
PlaySoundFX(SFX_TOGGLE_ELEMENT);
}
else if (!_stricmp(token3, "Orientation"))
{
if (!_stricmp(token4, "Vertical")) pSettings->dockVertical = true;
else pSettings->dockVertical = false;
if (pDock) pDock->UpdateDockWindow();
PlaySoundFX(SFX_TOGGLE_ELEMENT);
WriteBool(pSettings->xobrcFile, "xoblite.dock.vertical:", pSettings->dockVertical);
}
else if (!_stricmp(token3, "ToggleOrientation"))
{
if (!pSettings->dockVertical) pSettings->dockVertical = true;
else pSettings->dockVertical = false;
if (pDock) pDock->UpdateDockWindow();
PlaySoundFX(SFX_TOGGLE_ELEMENT);
WriteBool(pSettings->xobrcFile, "xoblite.dock.vertical:", pSettings->dockVertical);
}
else if (!_stricmp(token3, "Transparency"))
{
pSettings->dockTransparencyAlpha = atoi(token4);
if (pDock) SetTransparency(pDock->hDockWnd, pSettings->dockTransparencyAlpha);
WriteInt(pSettings->xobrcFile, "xoblite.dock.transparency.alpha:", pSettings->dockTransparencyAlpha);
}
else if (!_stricmp(token3, "TogglePuzzlePositioning"))
{
if (!pSettings->dockPuzzlePositioning) pSettings->dockPuzzlePositioning = true;
else pSettings->dockPuzzlePositioning = false;
if (pDock) pDock->UpdateDockWindow();
WriteBool(pSettings->xobrcFile, "xoblite.dock.puzzle.positioning:", pSettings->dockPuzzlePositioning);
}
else if (!_stricmp(token3, "ToggleAlwaysOnTop"))
{
if (pDock) pDock->ToggleAlwaysOnTop();
}
else if (!_stricmp(token3, "ToggleSnapToEdges"))
{
if (!pSettings->dockSnapToEdges) pSettings->dockSnapToEdges = true;
else pSettings->dockSnapToEdges = false;
WriteBool(pSettings->xobrcFile, "xoblite.dock.snapToEdges:", pSettings->dockSnapToEdges);
}
return true;
}
else if (!_stricmp(token2, "Menu"))
{
if (!_stricmp(token3, "Show"))
{
if (!_stricmp(token4, "Configuration")) SendMessage(GetBBWnd(), BB_MENU, 2, 0);
else if (!_stricmp(token4, "Workspaces")) SendMessage(GetBBWnd(), BB_MENU, 1, 0);
else SendMessage(GetBBWnd(), BB_MENU, 0, 0);
PlaySoundFX(SFX_MENU_SHOW);
}
else if (!_stricmp(token3, "Hide"))
{
if (pMenuCommon) pMenuCommon->Hide();
}
else if (!_stricmp(token3, "Transparency"))
{
if (!_stricmp(token4, "Title"))
{
pSettings->menuTitleTransparencyAlpha = atoi(extra);
WriteInt(pSettings->xobrcFile, "xoblite.menu.title.transparency.alpha:", pSettings->menuTitleTransparencyAlpha);
}
else if (!_stricmp(token4, "Frame"))
{
pSettings->menuFrameTransparencyAlpha = atoi(extra);
WriteInt(pSettings->xobrcFile, "xoblite.menu.frame.transparency.alpha:", pSettings->menuFrameTransparencyAlpha);
}
else if (!_stricmp(token4, "Grip"))
{
pSettings->menuGripTransparencyAlpha = atoi(extra);
WriteInt(pSettings->xobrcFile, "xoblite.menu.grip.transparency.alpha:", pSettings->menuGripTransparencyAlpha);
}
else if (!_stricmp(token4, "Active"))
{
pSettings->menuActiveTransparencyAlpha = atoi(extra);
WriteInt(pSettings->xobrcFile, "xoblite.menu.active.transparency.alpha:", pSettings->menuActiveTransparencyAlpha);
}
else
{
pSettings->menuTransparencyAlpha = atoi(token4);
WriteInt(pSettings->xobrcFile, "xoblite.menu.transparency.alpha:", pSettings->menuTransparencyAlpha);
}
}
else if (!_stricmp(token3, "ToggleRoundedCorners"))
{
if (!pSettings->menuRoundedCorners) pSettings->menuRoundedCorners = true;
else pSettings->menuRoundedCorners = false;
pMenuCommon->Hide();
SendMessage(GetBBWnd(), BB_RECONFIGURE, 0, 0);
WriteBool(pSettings->xobrcFile, "xoblite.menu.rounded:", pSettings->menuRoundedCorners);
return true;
}
else if (!_stricmp(token3, "ToggleSeparators"))
{
if (!pSettings->menuSeparators) pSettings->menuSeparators = true;
else pSettings->menuSeparators = false;
WriteBool(pSettings->xobrcFile, "xoblite.menu.separators:", pSettings->menuSeparators);
PostMessage(GetBBWnd(), BB_RESTART, 0, 0);
return true;
}
else if (!_stricmp(token3, "SetRCPath"))
{
menuPath(token4);
if (pMenuCommon) delete pMenuCommon;
pMenuCommon = new MenuCommon();
pMenuCommon->Initialize(hMainInstance);
}
return true;
}
else if (!_stricmp(token2, "Console"))
{
if (!_stricmp(token3, "Hide") && !pSettings->consoleHidden) PostMessage(GetBBWnd(), BB_TOGGLECONSOLE, 0, 0);
else if (!_stricmp(token3, "Show") && pSettings->consoleHidden) PostMessage(GetBBWnd(), BB_TOGGLECONSOLE, 0, 0);
else if (!_stricmp(token3, "Toggle")) PostMessage(GetBBWnd(), BB_TOGGLECONSOLE, 0, 0);
else if (!_stricmp(token3, "ToggleMaximized"))
{
pConsole->ToggleMaximized();
}
else if (!_stricmp(token3, "Placement"))
{
char placement[255];
sprintf_s(placement, sizeofArray(placement), "%s %s", token4, extra);
pSettings->ParsePlacement(placement, &pSettings->ConsolePlacement);
pSettings->WritePlacement(&pSettings->ConsolePlacement);
pConsole->UpdatePosition();
PlaySoundFX(SFX_TOGGLE_ELEMENT);
}
else if (!_stricmp(token3, "Messages"))
{
if (!_stricmp(token4, "Maximized"))
{
pSettings->consoleMaximizedMessages = atoi(extra);
WriteInt(pSettings->xobrcFile, "xoblite.console.maximized.messages:", pSettings->consoleMaximizedMessages);
}
else if (!_stricmp(token4, "Restored"))
{
pSettings->consoleRestoredMessages = atoi(extra);
WriteInt(pSettings->xobrcFile, "xoblite.console.restored.messages:", pSettings->consoleRestoredMessages);
}
pConsole->UpdatePosition();
}
else if (!_stricmp(token3, "Transparency"))
{
pSettings->consoleTransparencyAlpha = atoi(token4);
WriteInt(pSettings->xobrcFile, "xoblite.console.transparency.alpha:", pSettings->consoleTransparencyAlpha);
pConsole->UpdatePosition();
}
else if (!_stricmp(token3, "ToggleDesktopMode"))
{
if (!pSettings->consoleDesktopMode) pSettings->consoleDesktopMode = true;
else pSettings->consoleDesktopMode = false;
pConsole->UpdatePosition();
WriteBool(pSettings->xobrcFile, "xoblite.console.desktop.mode:", pSettings->consoleDesktopMode);
}
else if (!_stricmp(token3, "ToggleRoundedCorners"))
{
if (!pSettings->consoleRoundedCorners) pSettings->consoleRoundedCorners = true;
else pSettings->consoleRoundedCorners = false;
pConsole->UpdatePosition();
WriteBool(pSettings->xobrcFile, "xoblite.console.rounded:", pSettings->consoleRoundedCorners);
}
else if (!_stricmp(token3, "ClearHistory"))
{
pConsole->ClearHistory(true);
}
return true;
}
else if (!_stricmp(token2, "Desktop"))
{
if (!_stricmp(token3, "Toggle"))
{
if (!_stricmp(token4, "Clock"))
{
if (!pSettings->desktopClockHidden) pSettings->desktopClockHidden = true;
else pSettings->desktopClockHidden = false;
pDesktop->UpdateDesktopWindow();
WriteBool(pSettings->xobrcFile, "xoblite.desktop.clock.hidden:", pSettings->desktopClockHidden);
return true;
}
else if (!_stricmp(token4, "Weekday"))
{
if (!pSettings->desktopWeekdayHidden) pSettings->desktopWeekdayHidden = true;
else pSettings->desktopWeekdayHidden = false;
pDesktop->UpdateDesktopWindow();
WriteBool(pSettings->xobrcFile, "xoblite.desktop.weekday.hidden:", pSettings->desktopWeekdayHidden);
return true;
}
else if (!_stricmp(token4, "Date"))
{
if (!pSettings->desktopDateHidden) pSettings->desktopDateHidden = true;
else pSettings->desktopDateHidden = false;
pDesktop->UpdateDesktopWindow();
WriteBool(pSettings->xobrcFile, "xoblite.desktop.date.hidden:", pSettings->desktopDateHidden);
return true;
}
else if (!_stricmp(token4, "Greeting"))
{
if (!pSettings->desktopGreetingHidden) pSettings->desktopGreetingHidden = true;
else pSettings->desktopGreetingHidden = false;
pDesktop->UpdateDesktopWindow();
WriteBool(pSettings->xobrcFile, "xoblite.desktop.greeting.hidden:", pSettings->desktopGreetingHidden);
return true;
}
else if (!_stricmp(token4, "Indicator"))
{
if (!pSettings->desktopWorkspaceIndicatorHidden) pSettings->desktopWorkspaceIndicatorHidden = true;
else pSettings->desktopWorkspaceIndicatorHidden = false;
pDesktop->UpdateDesktopWindow();
WriteBool(pSettings->xobrcFile, "xoblite.desktop.indicator.hidden:", pSettings->desktopWorkspaceIndicatorHidden);
return true;
}
else if (!_stricmp(token4, "Border"))
{
if (!pSettings->desktopBorderHidden) pSettings->desktopBorderHidden = true;
else pSettings->desktopBorderHidden = false;
pDesktop->UpdateDesktopWindow();
WriteBool(pSettings->xobrcFile, "xoblite.desktop.border.hidden:", pSettings->desktopBorderHidden);
return true;
}
else if (!_stricmp(token4, "ClockWeekdayDate"))
{
if (!pSettings->desktopClockHidden) pSettings->desktopClockHidden = true;
else pSettings->desktopClockHidden = false;
if (!pSettings->desktopWeekdayHidden) pSettings->desktopWeekdayHidden = true;
else pSettings->desktopWeekdayHidden = false;
if (!pSettings->desktopDateHidden) pSettings->desktopDateHidden = true;
else pSettings->desktopDateHidden = false;
pDesktop->UpdateDesktopWindow();
WriteBool(pSettings->xobrcFile, "xoblite.desktop.clock.hidden:", pSettings->desktopClockHidden);
WriteBool(pSettings->xobrcFile, "xoblite.desktop.weekday.hidden:", pSettings->desktopWeekdayHidden);
WriteBool(pSettings->xobrcFile, "xoblite.desktop.date.hidden:", pSettings->desktopDateHidden);
return true;
}
}
else if (!_stricmp(token3, "Clock"))
{
if (!_stricmp(token4, "Placement"))
{
pSettings->ParsePlacement(extra, &pSettings->desktopClockPlacement);
pSettings->WritePlacement(&pSettings->desktopClockPlacement);
pDesktop->UpdateDesktopWindow();
return true;
}
else if (!_stricmp(token4, "Transparency"))
{
pSettings->desktopClockTransparencyAlpha = atoi(extra);
WriteInt(pSettings->xobrcFile, "xoblite.desktop.clock.transparency.alpha:", pSettings->desktopClockTransparencyAlpha);
pDesktop->UpdateDesktopWindow();
}
else if (!_stricmp(token4, "Font"))
{
StyleItem tempStyleItem;
ParseFontString(extra, &tempStyleItem);
if (strnlen_s(tempStyleItem.Font, sizeofArray(tempStyleItem.Font)))
{
strcpy_s(pSettings->desktopClockFont, tempStyleItem.Font);
pSettings->desktopClockFontHeight = tempStyleItem.FontHeight;
pSettings->desktopClockFontWeight = tempStyleItem.FontWeight;
pSettings->desktopClockFontDefined = true;
WriteString(pSettings->xobrcFile, "xoblite.desktop.clock.font:", extra);
}
pDesktop->UpdateDesktopWindow();
}
else if (!_stricmp(token4, "Regular") || !_stricmp(token4, "Text") || !_stricmp(token4, "Binary"))
{
strcpy_s(pSettings->desktopClockType, sizeofArray(pSettings->desktopClockType), token4);
pDesktop->UpdateDesktopWindow();
WriteString(pSettings->xobrcFile, "xoblite.desktop.clock.type:", pSettings->desktopClockType);
return true;
}
}
else if (!_stricmp(token3, "Weekday"))
{
if (!_stricmp(token4, "Placement"))
{
pSettings->ParsePlacement(extra, &pSettings->desktopWeekdayPlacement);
pSettings->WritePlacement(&pSettings->desktopWeekdayPlacement);
pDesktop->UpdateDesktopWindow();
return true;
}
else if (!_stricmp(token4, "Transparency"))
{
pSettings->desktopWeekdayTransparencyAlpha = atoi(extra);
WriteInt(pSettings->xobrcFile, "xoblite.desktop.weekday.transparency.alpha:", pSettings->desktopWeekdayTransparencyAlpha);
pDesktop->UpdateDesktopWindow();
}
else if (!_stricmp(token4, "Font"))
{
StyleItem tempStyleItem;
ParseFontString(extra, &tempStyleItem);
if (strnlen_s(tempStyleItem.Font, sizeofArray(tempStyleItem.Font)))
{
strcpy_s(pSettings->desktopWeekdayFont, tempStyleItem.Font);
pSettings->desktopWeekdayFontHeight = tempStyleItem.FontHeight;
pSettings->desktopWeekdayFontWeight = tempStyleItem.FontWeight;
pSettings->desktopWeekdayFontDefined = true;
WriteString(pSettings->xobrcFile, "xoblite.desktop.weekday.font:", extra);
}
pDesktop->UpdateDesktopWindow();
}
}
else if (!_stricmp(token3, "Date"))
{
if (!_stricmp(token4, "Placement"))
{
pSettings->ParsePlacement(extra, &pSettings->desktopDatePlacement);
pSettings->WritePlacement(&pSettings->desktopDatePlacement);
pDesktop->UpdateDesktopWindow();
return true;
}
else if (!_stricmp(token4, "Transparency"))
{
pSettings->desktopDateTransparencyAlpha = atoi(extra);
WriteInt(pSettings->xobrcFile, "xoblite.desktop.date.transparency.alpha:", pSettings->desktopDateTransparencyAlpha);
pDesktop->UpdateDesktopWindow();
}
else if (!_stricmp(token4, "Font"))
{
StyleItem tempStyleItem;
ParseFontString(extra, &tempStyleItem);
if (strnlen_s(tempStyleItem.Font, sizeofArray(tempStyleItem.Font)))
{
strcpy_s(pSettings->desktopDateFont, tempStyleItem.Font);
pSettings->desktopDateFontHeight = tempStyleItem.FontHeight;
pSettings->desktopDateFontWeight = tempStyleItem.FontWeight;
pSettings->desktopDateFontDefined = true;
WriteString(pSettings->xobrcFile, "xoblite.desktop.date.font:", extra);
}
pDesktop->UpdateDesktopWindow();
}
}
else if (!_stricmp(token3, "Greeting"))
{
if (!_stricmp(token4, "Placement"))
{
pSettings->ParsePlacement(extra, &pSettings->desktopGreetingPlacement);
pSettings->WritePlacement(&pSettings->desktopGreetingPlacement);
pDesktop->UpdateDesktopWindow();
return true;
}
else if (!_stricmp(token4, "Transparency"))
{
pSettings->desktopGreetingTransparencyAlpha = atoi(extra);
WriteInt(pSettings->xobrcFile, "xoblite.desktop.greeting.transparency.alpha:", pSettings->desktopGreetingTransparencyAlpha);
pDesktop->UpdateDesktopWindow();
}
else if (!_stricmp(token4, "Font"))
{
StyleItem tempStyleItem;
ParseFontString(extra, &tempStyleItem);
if (strnlen_s(tempStyleItem.Font, sizeofArray(tempStyleItem.Font)))
{
strcpy_s(pSettings->desktopGreetingFont, tempStyleItem.Font);
pSettings->desktopGreetingFontHeight = tempStyleItem.FontHeight;
pSettings->desktopGreetingFontWeight = tempStyleItem.FontWeight;
pSettings->desktopGreetingFontDefined = true;
WriteString(pSettings->xobrcFile, "xoblite.desktop.greeting.font:", extra);
}
pDesktop->UpdateDesktopWindow();
}
}
else if (!_stricmp(token3, "Color"))
{
if ((*token4 != '#') || (strnlen_s(token4, sizeofArray(token4)) != 7)) return false;
if (*token4 == '#') memmove(token4, token4+1, strnlen_s(token4, sizeofArray(token4)));
COLORREF color = strtol(token4, NULL, 16);
color = RGB(GetBValue(color), GetGValue(color), GetRValue(color));
pWallpaper->SetDesktopColor(color);
return true;
}
else if (!_stricmp(token3, "Widget"))
{
if (!_stricmp(token4, "Color"))
{
if ((*extra != '#') || (strnlen_s(extra, sizeofArray(extra)) != 7)) return false;
if (*extra == '#') memmove(extra, extra +1, strnlen_s(extra, sizeofArray(extra)));
COLORREF color = strtol(extra, NULL, 16);
pSettings->desktopWidgetColor = RGB(GetBValue(color), GetGValue(color), GetRValue(color));
pDesktop->UpdateDesktopWindow();
if (pDock) pDock->UpdateDockWindow();
WriteColor(pSettings->xobrcFile, "xoblite.desktop.widget.color:", pSettings->desktopWidgetColor);
return true;
}
}
else if (!_stricmp(token3, "Click"))
{
if (!_stricmp(token4, "R"))
{
strcpy_s(pSettings->desktopRClickOverride, sizeofArray(pSettings->desktopRClickOverride), extra);
WriteString(pSettings->xobrcFile, "xoblite.desktop.rclick.override:", pSettings->desktopRClickOverride);
return true;
}
else if (!_stricmp(token4, "M"))
{
strcpy_s(pSettings->desktopMClickOverride, sizeofArray(pSettings->desktopMClickOverride), extra);
WriteString(pSettings->xobrcFile, "xoblite.desktop.mclick.override:", pSettings->desktopMClickOverride);
return true;
}
else if (!_stricmp(token4, "X1"))
{
strcpy_s(pSettings->desktopX1ClickOverride, sizeofArray(pSettings->desktopX1ClickOverride), extra);
WriteString(pSettings->xobrcFile, "xoblite.desktop.x1click.override:", pSettings->desktopX1ClickOverride);
return true;
}
else if (!_stricmp(token4, "X2"))
{
strcpy_s(pSettings->desktopX2ClickOverride, sizeofArray(pSettings->desktopX2ClickOverride), extra);
WriteString(pSettings->xobrcFile, "xoblite.desktop.x2click.override:", pSettings->desktopX2ClickOverride);
return true;
}
}
return false;
}
else if (!_stricmp(token2, "Hotkey"))
{
int hotkeyNumber = atoi(&token3[1]) - 1;
if (hotkeyNumber > (int)pHotkeys->hotkeyList.size()) return false;
else pHotkeys->ExecuteHotkey(pHotkeys->hotkeyList[hotkeyNumber]->ID);
return true;
}
else if (!_stricmp(token2, "Workspaces"))
{
if (isdigit(token3[0]))
{
int ws = atoi(token3);
if ((ws < 1) || (ws > pSettings->numberOfWorkspaces))
{
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)"... Error: The requested workspace does not exist.");
return false;
}
PostMessage(GetBBWnd(), BB_WORKSPACE, 4, (ws-1));
}
else if (!_stricmp(token3, "Next"))
{
PostMessage(GetBBWnd(), BB_WORKSPACE, 1, 0);
}
else if (!_stricmp(token3, "Previous"))
{
PostMessage(GetBBWnd(), BB_WORKSPACE, 0, 0);
}
else if (!_stricmp(token3, "New"))
{
PostMessage(GetBBWnd(), BB_WORKSPACE, 2, 0);
}
else if (!_stricmp(token3, "Remove"))
{
PostMessage(GetBBWnd(), BB_WORKSPACE, 3, 0);
}
else if (!_stricmp(token3, "ToggleMousewheelChanging"))
{
if (!pSettings->mousewheelChanging) pSettings->mousewheelChanging = true;
else pSettings->mousewheelChanging = false;
WriteBool(pSettings->xobrcDefaultFile, "xoblite.workspaces.mousewheel.changing:", pSettings->mousewheelChanging);
}
else if (!_stricmp(token3, "ToggleFollowActive"))
{
if (!pSettings->followActive) pSettings->followActive = true;
else pSettings->followActive = false;
WriteBool(pSettings->xobrcDefaultFile, "xoblite.workspaces.followActive:", pSettings->followActive);
}
else if (!_stricmp(token3, "ToggleWallpaperPerWorkspace"))
{
if (!pSettings->wallpaperPerWorkspace) pSettings->wallpaperPerWorkspace = true;
else pSettings->wallpaperPerWorkspace = false;
WriteBool(pSettings->xobrcDefaultFile, "xoblite.workspaces.wallpapers:", pSettings->wallpaperPerWorkspace);
}
else if (!_stricmp(token3, "GatherWindows"))
{
if (pWorkspaces) pWorkspaces->GatherWindows();
}
return true;
}
else if (!_stricmp(token2, "Plugins"))
{
if (!_stricmp(token3, "Hide") && !pSettings->pluginsHidden) PostMessage(GetBBWnd(), BB_TOGGLEPLUGINS, 0, 0);
else if (!_stricmp(token3, "Show") && pSettings->pluginsHidden) PostMessage(GetBBWnd(), BB_TOGGLEPLUGINS, 0, 0);
else if (!_stricmp(token3, "Toggle")) PostMessage(GetBBWnd(), BB_TOGGLEPLUGINS, 0, 0);
return true;
}
else if (!_stricmp(token2, "Global"))
{
if (!_stricmp(token3, "HiDPI"))
{
bool savedWriteProtection = pSettings->writeProtection;
pSettings->writeProtection = false;
pSettings->scalingFactorHiDPI = atoi(token4);
if (pSettings->scalingFactorHiDPI < 1) pSettings->scalingFactorHiDPI = 1;
if (pSettings->scalingFactorHiDPI > 4) pSettings->scalingFactorHiDPI = 4;
WriteInt(pSettings->xobrcDefaultFile, "xoblite.hidpi.scaling.factor:", pSettings->scalingFactorHiDPI);
pSettings->writeProtection = savedWriteProtection;
PostMessage(GetBBWnd(), BB_RESTART, 0, 0);
char msg[255];
if (savedWriteProtection) strcpy_s(msg, sizeofArray(msg), "Temporarily bypassing write protection: ");
else strcpy_s(msg, sizeofArray(msg), "");
sprintf_s(msg, sizeofArray(msg), "xoblite HiDPI scaling factor set to %dx. ", pSettings->scalingFactorHiDPI);
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_REGULAR_MESSAGE, (LPARAM)msg);
}
else if (!_stricmp(token3, "ToggleMultiMonitorPlacements"))
{
if (!pSettings->multimonPlacements) pSettings->multimonPlacements = true;
else pSettings->multimonPlacements = false;
WriteBool(pSettings->xobrcDefaultFile, "xoblite.multimonitor.placements:", pSettings->multimonPlacements);
if (pDesktop) pDesktop->UpdateDesktopWindow();
if (pToolbar) pToolbar->UpdatePosition();
if (pConsole) pConsole->UpdatePosition();
if (pDock) pDock->UpdatePosition();
SendMessage(GetBBWnd(), BB_REDRAWGUI, BBRG_DESKTOP, 0);
PlaySoundFX(SFX_TOGGLE_ELEMENT);
}
else if (!_stricmp(token3, "ToggleFullscreenDetection"))
{
if (!pSettings->fullscreenDetection) pSettings->fullscreenDetection = true;
else pSettings->fullscreenDetection = false;
WriteBool(pSettings->xobrcDefaultFile, "xoblite.fullscreen.detection:", pSettings->fullscreenDetection);
}
else if (!_stricmp(token3, "ToggleSoundFX"))
{
if (!pSettings->enableSoundFX) pSettings->enableSoundFX = true;
else pSettings->enableSoundFX = false;
WriteBool(pSettings->xobrcDefaultFile, "xoblite.sound.effects:", pSettings->enableSoundFX);
}
else if (!_stricmp(token3, "ToggleDesignerMode"))
{
char xDGUIpath[MAX_PATH];
sprintf_s(xDGUIpath, sizeofArray(xDGUIpath), "%s\\%s", pSettings->SF_blackboxPath, "xDesignerGUI.dll");
if (!pSettings->designerModeEnabled)
{
pSettings->designerModeEnabled = true;
if (!pPluginManager->IsPluginLoaded("xDesignerGUI.dll")) pPluginManager->LoadPlugin(xDGUIpath);
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"Designer mode enabled.");
}
else
{
pSettings->designerModeEnabled = false;
if (pPluginManager->IsPluginLoaded("xDesignerGUI.dll")) pPluginManager->UnloadPlugin(xDGUIpath, -1);
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"Designer mode disabled.");
}
WriteBool(pSettings->xobrcDefaultFile, "xoblite.designer.mode:", pSettings->designerModeEnabled);
}
else if (!_stricmp(token3, "ToggleRootCommands"))
{
if (!pSettings->disableRootCommands) pSettings->disableRootCommands = true;
else pSettings->disableRootCommands = false;
WriteBool(pSettings->xobrcDefaultFile, "xoblite.disable.rootCommands:", pSettings->disableRootCommands);
}
else if (!_stricmp(token3, "ToggleThemeFonts"))
{
if (!pSettings->disableThemeFonts)
{
pSettings->disableThemeFonts = true;
UnregisterThemeFonts();
}
else
{
pSettings->disableThemeFonts = false;
RegisterThemeFonts();
}
WriteBool(pSettings->xobrcDefaultFile, "xoblite.disable.theme.fonts:", pSettings->disableThemeFonts);
}
else if (!_stricmp(token3, "ToggleScriptSupport"))
{
if (!pSettings->disableScriptSupport) pSettings->disableScriptSupport = true;
else pSettings->disableScriptSupport = false;
WriteBool(pSettings->xobrcDefaultFile, "xoblite.disable.script.support:", pSettings->disableScriptSupport);
if (pSettings->disableScriptSupport) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_WARNING_MESSAGE, (LPARAM)"@Script support disabled.");
else SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_WARNING_MESSAGE, (LPARAM)"@Script support enabled.");
}
else if (!_stricmp(token3, "SetEditor"))
{
if (strnlen_s(token4, sizeofArray(token4)) > 0)
{
if (strnlen_s(extra, sizeofArray(extra))) sprintf_s(pSettings->preferredEditor, sizeofArray(pSettings->preferredEditor), "\"%s %s\"", token4, extra);
else sprintf_s(pSettings->preferredEditor, sizeofArray(pSettings->preferredEditor), "\"%s\"", token4);
WriteString(pSettings->xobrcDefaultFile, "xoblite.editor:", pSettings->preferredEditor);
}
}
return true;
}
else if (!_stricmp(token2, "Window"))
{
if (!pTaskbar) return false;
HWND hwnd = pTaskbar->GetActiveWindow();
if (hwnd == NULL) return false;
if (!_stricmp(token3, "Toggle"))
{
if (!_stricmp(token4, "Sticky"))
{
ToggleSticky(hwnd);
if (pToolbar) pToolbar->UpdatePosition();
}
}
else if (!_stricmp(token3, "Workspace"))
{
if (!_stricmp(token4, "Next") && pWorkspaces) pWorkspaces->MoveWindowToNextWorkspace(hwnd);
else if (!_stricmp(token4, "Previous") && pWorkspaces) pWorkspaces->MoveWindowToPreviousWorkspace(hwnd);
else if ((strnlen_s(token4, sizeofArray(token4)) > 0))
{
int workspace = atoi(&token4[0]) - 1;
if (pWorkspaces) pWorkspaces->MoveWindowToWorkspace(hwnd, workspace);
}
}
else if (!_stricmp(token3, "Zoom"))
{
if (!IsIconic(hwnd))
{
if (IsZoomed(hwnd)) ShowWindow(hwnd, SW_RESTORE);
else ShowWindow(hwnd, SW_MAXIMIZE);
}
}
else if (!_stricmp(token3, "Shade")) pDesktop->ShadeWindow();
else if (!_stricmp(token3, "Lower")) pDesktop->LowerWindow();
else if (!_stricmp(token3, "Grow"))
{
if (!_stricmp(token4, "Width")) pDesktop->GrowWindowWidth();
else if (!_stricmp(token4, "Height")) pDesktop->GrowWindowHeight();
}
else if (!_stricmp(token3, "Tile"))
{
if (IsInString(token4, "Left"))
{
if (IsInString(token4, "Top")) pTaskbar->TileWindow(PLACEMENT_TOP_LEFT);
else if (IsInString(token4, "Center")) pTaskbar->TileWindow(PLACEMENT_CENTER_LEFT);
else if (IsInString(token4, "Bottom")) pTaskbar->TileWindow(PLACEMENT_BOTTOM_LEFT);
else pTaskbar->TileWindow(PLACEMENT_LEFT_HALF);
}
else if (IsInString(token4, "Right"))
{
if (IsInString(token4, "Top")) pTaskbar->TileWindow(PLACEMENT_TOP_RIGHT);
else if (IsInString(token4, "Center")) pTaskbar->TileWindow(PLACEMENT_CENTER_RIGHT);
else if (IsInString(token4, "Bottom")) pTaskbar->TileWindow(PLACEMENT_BOTTOM_RIGHT);
else pTaskbar->TileWindow(PLACEMENT_RIGHT_HALF);
}
else if (IsInString(token4, "Center"))
{
if (IsInString(token4, "Top")) pTaskbar->TileWindow(PLACEMENT_TOP_CENTER);
else if (IsInString(token4, "Bottom")) pTaskbar->TileWindow(PLACEMENT_BOTTOM_CENTER);
else if (IsInString(token4, "CenterCenter")) pTaskbar->TileWindow(PLACEMENT_CENTER_CENTER);
else pTaskbar->TileWindow(PLACEMENT_CENTERED);
}
else if (IsInString(token4, "Top")) pTaskbar->TileWindow(PLACEMENT_TOP_HALF);
else if (IsInString(token4, "Bottom")) pTaskbar->TileWindow(PLACEMENT_BOTTOM_HALF);
else
{
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)"... Error: The requested window tiling position is not supported.");
return false;
}
}
else if (!_stricmp(token3, "Float")) pTaskbar->TileWindow(PLACEMENT_DEFAULT);
else if (!_stricmp(token3, "Quit"))
{
if (IsIconic(hwnd)) ShowWindow(hwnd, SW_RESTORE);
SetForegroundWindow(hwnd);
PostMessage(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
}
return true;
}
else if (!_stricmp(token2, "ToggleWriteProtection"))
{
if (!pSettings->writeProtection)
{
WriteBool(pSettings->xobrcFile, "xoblite.write.protection:", true);
pSettings->writeProtection = true;
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_WARNING_MESSAGE, (LPARAM)"Write protection enabled.");
}
else
{
pSettings->writeProtection = false;
WriteBool(pSettings->xobrcFile, "xoblite.write.protection:", false);
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_WARNING_MESSAGE, (LPARAM)"Write protection disabled.");
}
return true;
}
else if (!_stricmp(token2, "Edit"))
{
char cmdPlusArgs[MAX_LINE_LENGTH];
if (!_stricmp(token3, "Style"))
{
sprintf_s(cmdPlusArgs, sizeofArray(cmdPlusArgs), "%s %s", pSettings->preferredEditor, pSettings->styleFile);
}
else if (!_stricmp(token3, "Configuration"))
{
sprintf_s(cmdPlusArgs, sizeofArray(cmdPlusArgs), "%s %s", pSettings->preferredEditor, pSettings->xobrcFile);
}
else if (!_stricmp(token3, "Menu"))
{
sprintf_s(cmdPlusArgs, sizeofArray(cmdPlusArgs), "%s %s", pSettings->preferredEditor, pSettings->menuFile);
}
else if (!_stricmp(token3, "Hotkeys"))
{
sprintf_s(cmdPlusArgs, sizeofArray(cmdPlusArgs), "%s %s", pSettings->preferredEditor, pSettings->hotkeysFile);
}
else if (!_stricmp(token3, "Plugins"))
{
sprintf_s(cmdPlusArgs, sizeofArray(cmdPlusArgs), "%s %s", pSettings->preferredEditor, pSettings->pluginsFile);
}
else
{
if (strchr(token3, '$')) ReplaceShellFolders(token3);
if (strchr(token3, '%')) ReplaceEnvVars(token3);
sprintf_s(cmdPlusArgs, sizeofArray(cmdPlusArgs), "%s %s %s %s", pSettings->preferredEditor, token3, token4, extra);
}
BBSmartExecute(cmdPlusArgs);
return true;
}
else if (!_stricmp(token2, "Set"))
{
if (!_stricmp(token3, "Style"))
{
if (strnlen_s(token4, sizeofArray(token4))) PostMessage(GetBBWnd(), BB_SETSTYLE, 0, (LPARAM)token4);
return true;
}
else if (!_stricmp(token3, "Theme"))
{
if (strnlen_s(token4, sizeofArray(token4))) PostMessage(GetBBWnd(), BB_SETTHEME, 0, (LPARAM)token4);
return true;
}
}
else if (!_stricmp(token2, "Random"))
{
int type;
if (!_stricmp(token3, "Style")) type = BROAM_RANDOM_STYLE;
else if (!_stricmp(token3, "Wallpaper")) type = BROAM_RANDOM_WALLPAPER;
else return false;
if (strnlen_s(token4, sizeofArray(token4)))
{
strcpy_s(pathToScan, sizeofArray(pathToScan), token4);
if (strchr(pathToScan, '\"')) StrRemoveEncap(pathToScan);
if (strchr(pathToScan, '$')) ReplaceShellFolders(pathToScan);
if (strchr(pathToScan, '%')) ReplaceEnvVars(pathToScan);
}
else
{
if (type == BROAM_RANDOM_STYLE) strcpy_s(pathToScan, sizeofArray(pathToScan), pSettings->stylesFolder);
else strcpy_s(pathToScan, sizeofArray(pathToScan), pSettings->wallpapersFolder);
}
numberOfFiles = currentFile = randomFile = 0;
FindRandomFile(pathToScan, type, false);
if (numberOfFiles == 0)
{
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_ERROR_MESSAGE, (LPARAM)"@xoblite Random -> No applicable files found at the specified path!");
return false;
}
randomFile = (rand() % numberOfFiles) + 1;
FindRandomFile(pathToScan, type, true);
return true;
}
else if (!_stricmp(token2, "Designer"))
{
if (!pSettings->designerModeEnabled)
{
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"Designer mode is currently disabled. Enable it to allow dynamic updating of style parameters via bro@ms.");
return false;
}
char feedback[64];
feedback[0] = '\0';
if (!_stricmp(token3, "Select"))
{
if (!_strnicmp(token4, "Toolbar", 7))
{
if (!_stricmp(token4, "Toolbar")) pSettings->selectedElement = pSettings->Toolbar;
else if (!_stricmp(token4, "ToolbarLabel")) pSettings->selectedElement = pSettings->ToolbarLabel;
else if (!_stricmp(token4, "ToolbarWindowLabel")) pSettings->selectedElement = pSettings->ToolbarWindowLabel;
else if (!_stricmp(token4, "ToolbarClock")) pSettings->selectedElement = pSettings->ToolbarClock;
else if (!_stricmp(token4, "ToolbarButton")) pSettings->selectedElement = pSettings->ToolbarButton;
else if (!_stricmp(token4, "ToolbarButtonPressed")) pSettings->selectedElement = pSettings->ToolbarButtonPressed;
else if (!_stricmp(token4, "ToolbarBorder")) pSettings->selectedElement = pSettings->ToolbarBorder;
}
else if (!_strnicmp(token4, "Menu", 4))
{
if (!_stricmp(token4, "MenuTitle")) pSettings->selectedElement = pSettings->MenuTitle;
else if (!_stricmp(token4, "MenuFrame")) pSettings->selectedElement = pSettings->MenuFrame;
else if (!_stricmp(token4, "MenuActive")) pSettings->selectedElement = pSettings->MenuActive;
else if (!_stricmp(token4, "MenuGrip")) pSettings->selectedElement = pSettings->MenuGrip;
else if (!_stricmp(token4, "MenuIndicator")) pSettings->selectedElement = pSettings->MenuIndicator;
else if (!_stricmp(token4, "MenuSeparator")) pSettings->selectedElement = pSettings->MenuSeparator;
else if (!_stricmp(token4, "MenuFrameBorder")) pSettings->selectedElement = pSettings->MenuFrameBorder;
}
else if (!_stricmp(token4, "Dock")) pSettings->selectedElement = pSettings->Dock;
else if (!_stricmp(token4, "DockBorder")) pSettings->selectedElement = pSettings->DockBorder;
else if (!_stricmp(token4, "Console")) pSettings->selectedElement = pSettings->Console;
else if (!_strnicmp(token4, "Window", 6))
{
if (!_strnicmp(&token4[6], "Title", 5))
{
if (!_stricmp(token4, "WindowTitleFocus")) pSettings->selectedElement = pSettings->WindowTitleFocus;
else if (!_stricmp(token4, "WindowTitleUnfocus")) pSettings->selectedElement = pSettings->WindowTitleUnfocus;
}
else if (!_strnicmp(&token4[6], "Label", 5))
{
if (!_stricmp(token4, "WindowLabelFocus")) pSettings->selectedElement = pSettings->WindowLabelFocus;
else if (!_stricmp(token4, "WindowLabelUnfocus")) pSettings->selectedElement = pSettings->WindowLabelUnfocus;
}
else if (!_strnicmp(&token4[6], "Button", 6))
{
if (!_stricmp(token4, "WindowButtonFocus")) pSettings->selectedElement = pSettings->WindowButtonFocus;
else if (!_stricmp(token4, "WindowButtonUnfocus")) pSettings->selectedElement = pSettings->WindowButtonUnfocus;
else if (!_stricmp(token4, "WindowButtonPressed")) pSettings->selectedElement = pSettings->WindowButtonPressed;
}
else if (!_strnicmp(&token4[6], "Grip", 4))
{
if (!_stricmp(token4, "WindowGripFocus")) pSettings->selectedElement = pSettings->WindowGripFocus;
else if (!_stricmp(token4, "WindowGripUnfocus")) pSettings->selectedElement = pSettings->WindowGripUnfocus;
}
else if (!_strnicmp(&token4[6], "Handle", 6))
{
if (!_stricmp(token4, "WindowHandleFocus")) pSettings->selectedElement = pSettings->WindowHandleFocus;
else if (!_stricmp(token4, "WindowHandleUnfocus")) pSettings->selectedElement = pSettings->WindowHandleUnfocus;
}
}
else if (!_strnicmp(token4, "Hardware", 8)) pSettings->selectedElement = pSettings->ExternalHardware;
else if (!_stricmp(token4, "Next") || !_stricmp(token4, "Previous") || strnlen_s(token4, sizeofArray(token4)) == 0)
{
if (!_stricmp(token4, "Previous"))
{
if (pSettings->selectedElement == pSettings->Toolbar) pSettings->selectedElement = pSettings->ExternalHardware;
else if (pSettings->selectedElement == pSettings->ToolbarBorder) pSettings->selectedElement = pSettings->Toolbar;
else if (pSettings->selectedElement == pSettings->ToolbarLabel) pSettings->selectedElement = pSettings->ToolbarBorder;
else if (pSettings->selectedElement == pSettings->ToolbarWindowLabel) pSettings->selectedElement = pSettings->ToolbarLabel;
else if (pSettings->selectedElement == pSettings->ToolbarClock) pSettings->selectedElement = pSettings->ToolbarWindowLabel;
else if (pSettings->selectedElement == pSettings->ToolbarButton) pSettings->selectedElement = pSettings->ToolbarClock;
else if (pSettings->selectedElement == pSettings->ToolbarButtonPressed) pSettings->selectedElement = pSettings->ToolbarButton;
else if (pSettings->selectedElement == pSettings->MenuTitle) pSettings->selectedElement = pSettings->ToolbarButtonPressed;
else if (pSettings->selectedElement == pSettings->MenuFrame) pSettings->selectedElement = pSettings->MenuTitle;
else if (pSettings->selectedElement == pSettings->MenuFrameBorder) pSettings->selectedElement = pSettings->MenuFrame;
else if (pSettings->selectedElement == pSettings->MenuActive) pSettings->selectedElement = pSettings->MenuFrameBorder;
else if (pSettings->selectedElement == pSettings->MenuGrip) pSettings->selectedElement = pSettings->MenuActive;
else if (pSettings->selectedElement == pSettings->MenuIndicator) pSettings->selectedElement = pSettings->MenuGrip;
else if (pSettings->selectedElement == pSettings->MenuSeparator) pSettings->selectedElement = pSettings->MenuIndicator;
else if (pSettings->selectedElement == pSettings->Dock) pSettings->selectedElement = pSettings->MenuSeparator;
else if (pSettings->selectedElement == pSettings->DockBorder) pSettings->selectedElement = pSettings->Dock;
else if (pSettings->selectedElement == pSettings->Console) pSettings->selectedElement = pSettings->DockBorder;
else if (pSettings->selectedElement == pSettings->WindowTitleFocus) pSettings->selectedElement = pSettings->Console;
else if (pSettings->selectedElement == pSettings->WindowLabelFocus) pSettings->selectedElement = pSettings->WindowTitleFocus;
else if (pSettings->selectedElement == pSettings->WindowButtonFocus) pSettings->selectedElement = pSettings->WindowLabelFocus;
else if (pSettings->selectedElement == pSettings->WindowGripFocus) pSettings->selectedElement = pSettings->WindowButtonFocus;
else if (pSettings->selectedElement == pSettings->WindowHandleFocus) pSettings->selectedElement = pSettings->WindowGripFocus;
else if (pSettings->selectedElement == pSettings->WindowButtonPressed) pSettings->selectedElement = pSettings->WindowHandleFocus;
else if (pSettings->selectedElement == pSettings->WindowTitleUnfocus) pSettings->selectedElement = pSettings->WindowButtonPressed;
else if (pSettings->selectedElement == pSettings->WindowLabelUnfocus) pSettings->selectedElement = pSettings->WindowTitleUnfocus;
else if (pSettings->selectedElement == pSettings->WindowButtonUnfocus) pSettings->selectedElement = pSettings->WindowLabelUnfocus;
else if (pSettings->selectedElement == pSettings->WindowGripUnfocus) pSettings->selectedElement = pSettings->WindowButtonUnfocus;
else if (pSettings->selectedElement == pSettings->WindowHandleUnfocus) pSettings->selectedElement = pSettings->WindowGripUnfocus;
else if (pSettings->selectedElement == pSettings->ExternalHardware) pSettings->selectedElement = pSettings->WindowHandleUnfocus;
}
else
{
if (pSettings->selectedElement == pSettings->Toolbar) pSettings->selectedElement = pSettings->ToolbarBorder;
else if (pSettings->selectedElement == pSettings->ToolbarBorder) pSettings->selectedElement = pSettings->ToolbarLabel;
else if (pSettings->selectedElement == pSettings->ToolbarLabel) pSettings->selectedElement = pSettings->ToolbarWindowLabel;
else if (pSettings->selectedElement == pSettings->ToolbarWindowLabel) pSettings->selectedElement = pSettings->ToolbarClock;
else if (pSettings->selectedElement == pSettings->ToolbarClock) pSettings->selectedElement = pSettings->ToolbarButton;
else if (pSettings->selectedElement == pSettings->ToolbarButton) pSettings->selectedElement = pSettings->ToolbarButtonPressed;
else if (pSettings->selectedElement == pSettings->ToolbarButtonPressed) pSettings->selectedElement = pSettings->MenuTitle;
else if (pSettings->selectedElement == pSettings->MenuTitle) pSettings->selectedElement = pSettings->MenuFrame;
else if (pSettings->selectedElement == pSettings->MenuFrame) pSettings->selectedElement = pSettings->MenuFrameBorder;
else if (pSettings->selectedElement == pSettings->MenuFrameBorder) pSettings->selectedElement = pSettings->MenuActive;
else if (pSettings->selectedElement == pSettings->MenuActive) pSettings->selectedElement = pSettings->MenuGrip;
else if (pSettings->selectedElement == pSettings->MenuGrip) pSettings->selectedElement = pSettings->MenuIndicator;
else if (pSettings->selectedElement == pSettings->MenuIndicator) pSettings->selectedElement = pSettings->MenuSeparator;
else if (pSettings->selectedElement == pSettings->MenuSeparator) pSettings->selectedElement = pSettings->Dock;
else if (pSettings->selectedElement == pSettings->Dock) pSettings->selectedElement = pSettings->DockBorder;
else if (pSettings->selectedElement == pSettings->DockBorder) pSettings->selectedElement = pSettings->Console;
else if (pSettings->selectedElement == pSettings->Console) pSettings->selectedElement = pSettings->WindowTitleFocus;
else if (pSettings->selectedElement == pSettings->WindowTitleFocus) pSettings->selectedElement = pSettings->WindowLabelFocus;
else if (pSettings->selectedElement == pSettings->WindowLabelFocus) pSettings->selectedElement = pSettings->WindowButtonFocus;
else if (pSettings->selectedElement == pSettings->WindowButtonFocus) pSettings->selectedElement = pSettings->WindowGripFocus;
else if (pSettings->selectedElement == pSettings->WindowGripFocus) pSettings->selectedElement = pSettings->WindowHandleFocus;
else if (pSettings->selectedElement == pSettings->WindowHandleFocus) pSettings->selectedElement = pSettings->WindowButtonPressed;
else if (pSettings->selectedElement == pSettings->WindowButtonPressed) pSettings->selectedElement = pSettings->WindowTitleUnfocus;
else if (pSettings->selectedElement == pSettings->WindowTitleUnfocus) pSettings->selectedElement = pSettings->WindowLabelUnfocus;
else if (pSettings->selectedElement == pSettings->WindowLabelUnfocus) pSettings->selectedElement = pSettings->WindowButtonUnfocus;
else if (pSettings->selectedElement == pSettings->WindowButtonUnfocus) pSettings->selectedElement = pSettings->WindowGripUnfocus;
else if (pSettings->selectedElement == pSettings->WindowGripUnfocus) pSettings->selectedElement = pSettings->WindowHandleUnfocus;
else if (pSettings->selectedElement == pSettings->WindowHandleUnfocus) pSettings->selectedElement = pSettings->ExternalHardware;
else if (pSettings->selectedElement == pSettings->ExternalHardware) pSettings->selectedElement = pSettings->Toolbar;
}
}
if (pSettings->selectedElement == pSettings->Toolbar) strcpy_s(feedback, sizeofArray(feedback), "... Toolbar");
else if (pSettings->selectedElement == pSettings->ToolbarLabel) strcpy_s(feedback, sizeofArray(feedback), "... Toolbar Label");
else if (pSettings->selectedElement == pSettings->ToolbarWindowLabel) strcpy_s(feedback, sizeofArray(feedback), "... Toolbar WindowLabel");
else if (pSettings->selectedElement == pSettings->ToolbarClock) strcpy_s(feedback, sizeofArray(feedback), "... Toolbar Clock");
else if (pSettings->selectedElement == pSettings->ToolbarButton) strcpy_s(feedback, sizeofArray(feedback), "... Toolbar Button");
else if (pSettings->selectedElement == pSettings->ToolbarButtonPressed) strcpy_s(feedback, sizeofArray(feedback), "... Toolbar Button Pressed");
else if (pSettings->selectedElement == pSettings->ToolbarBorder) strcpy_s(feedback, sizeofArray(feedback), "... Toolbar Border");
else if (pSettings->selectedElement == pSettings->MenuTitle) strcpy_s(feedback, sizeofArray(feedback), "... Menu Title");
else if (pSettings->selectedElement == pSettings->MenuFrame) strcpy_s(feedback, sizeofArray(feedback), "... Menu Frame");
else if (pSettings->selectedElement == pSettings->MenuFrameBorder) strcpy_s(feedback, sizeofArray(feedback), "... Menu Frame Border");
else if (pSettings->selectedElement == pSettings->MenuActive) strcpy_s(feedback, sizeofArray(feedback), "... Menu Active");
else if (pSettings->selectedElement == pSettings->MenuGrip) strcpy_s(feedback, sizeofArray(feedback), "... Menu Grip");
else if (pSettings->selectedElement == pSettings->MenuIndicator) strcpy_s(feedback, sizeofArray(feedback), "... Menu Indicator");
else if (pSettings->selectedElement == pSettings->MenuSeparator) strcpy_s(feedback, sizeofArray(feedback), "... Menu Separator");
else if (pSettings->selectedElement == pSettings->Dock) strcpy_s(feedback, sizeofArray(feedback), "... Dock");
else if (pSettings->selectedElement == pSettings->DockBorder) strcpy_s(feedback, sizeofArray(feedback), "... Dock Border");
else if (pSettings->selectedElement == pSettings->Console) strcpy_s(feedback, sizeofArray(feedback), "... Console");
else if (pSettings->selectedElement == pSettings->WindowTitleFocus) strcpy_s(feedback, sizeofArray(feedback), "... Window Title Focus");
else if (pSettings->selectedElement == pSettings->WindowTitleUnfocus) strcpy_s(feedback, sizeofArray(feedback), "... Window Title Unfocus");
else if (pSettings->selectedElement == pSettings->WindowLabelFocus) strcpy_s(feedback, sizeofArray(feedback), "... Window Label Focus");
else if (pSettings->selectedElement == pSettings->WindowLabelUnfocus) strcpy_s(feedback, sizeofArray(feedback), "... Window Label Unfocus");
else if (pSettings->selectedElement == pSettings->WindowButtonFocus) strcpy_s(feedback, sizeofArray(feedback), "... Window Button Focus");
else if (pSettings->selectedElement == pSettings->WindowButtonUnfocus) strcpy_s(feedback, sizeofArray(feedback), "... Window Button Unfocus");
else if (pSettings->selectedElement == pSettings->WindowButtonPressed) strcpy_s(feedback, sizeofArray(feedback), "... Window Button Pressed");
else if (pSettings->selectedElement == pSettings->WindowGripFocus) strcpy_s(feedback, sizeofArray(feedback), "... Window Grip Focus");
else if (pSettings->selectedElement == pSettings->WindowGripUnfocus) strcpy_s(feedback, sizeofArray(feedback), "... Window Grip Unfocus");
else if (pSettings->selectedElement == pSettings->WindowHandleFocus) strcpy_s(feedback, sizeofArray(feedback), "... Window Handle Focus");
else if (pSettings->selectedElement == pSettings->WindowHandleUnfocus) strcpy_s(feedback, sizeofArray(feedback), "... Window Handle Unfocus");
else if (pSettings->selectedElement == pSettings->ExternalHardware) strcpy_s(feedback, sizeofArray(feedback), "... Hardware");
if (strnlen_s(feedback, sizeofArray(feedback)) > 0)
{
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
char broam[MAX_LINE_LENGTH];
sprintf_s(broam, sizeofArray(broam), "@xDesigner Feedback %s", feedback);
SendMessage(GetBBWnd(), BB_BROADCAST, 0, (LPARAM)broam);
}
return true;
}
else if (!_stricmp(token3, "Modify"))
{
if (!_stricmp(token4, "Appearance"))
{
if (!_stricmp(extra, "Previous"))
{
if (pSettings->selectedElement == pSettings->MenuSeparator)
{
switch (pSettings->selectedElement->type)
{
case B_SOLID: { pSettings->selectedElement->type = B_SUPERHORIZONTAL; break; }
case B_HORIZONTAL: { pSettings->selectedElement->type = B_SOLID; break; }
case B_MIRRORHORIZONTAL: { pSettings->selectedElement->type = B_HORIZONTAL; break; }
case B_SPLITHORIZONTAL: { pSettings->selectedElement->type = B_MIRRORHORIZONTAL; break; }
case B_SUPERHORIZONTAL: { pSettings->selectedElement->type = B_SPLITHORIZONTAL; break; }
default: { pSettings->selectedElement->type = B_SOLID; break; }
}
}
else if (pSettings->selectedElement == pSettings->ToolbarBorder ||
pSettings->selectedElement == pSettings->MenuFrameBorder ||
pSettings->selectedElement == pSettings->DockBorder)
{
switch (pSettings->selectedElement->type)
{
case B_PARENTRELATIVE: { pSettings->selectedElement->type = B_SUPERVERTICAL; break; }
case B_HORIZONTAL: { pSettings->selectedElement->type = B_PARENTRELATIVE; break; }
case B_VERTICAL: { pSettings->selectedElement->type = B_HORIZONTAL; break; }
case B_MIRRORHORIZONTAL: { pSettings->selectedElement->type = B_VERTICAL; break; }
case B_MIRRORVERTICAL: { pSettings->selectedElement->type = B_MIRRORHORIZONTAL; break; }
case B_SPLITHORIZONTAL: { pSettings->selectedElement->type = B_MIRRORVERTICAL; break; }
case B_SPLITVERTICAL: { pSettings->selectedElement->type = B_SPLITHORIZONTAL; break; }
case B_SUPERHORIZONTAL: { pSettings->selectedElement->type = B_SPLITVERTICAL; break; }
case B_SUPERVERTICAL: { pSettings->selectedElement->type = B_SUPERHORIZONTAL; break; }
default: { pSettings->selectedElement->type = B_PARENTRELATIVE; break; }
}
}
else switch (pSettings->selectedElement->type)
{
case B_PARENTRELATIVE: { pSettings->selectedElement->type = B_SUPERVERTICAL; break; }
case B_SOLID: { pSettings->selectedElement->type = B_PARENTRELATIVE; break; }
case B_HORIZONTAL: { pSettings->selectedElement->type = B_SOLID; break; }
case B_VERTICAL: { pSettings->selectedElement->type = B_HORIZONTAL; break; }
case B_DIAGONAL: { pSettings->selectedElement->type = B_VERTICAL; break; }
case B_CROSSDIAGONAL: { pSettings->selectedElement->type = B_DIAGONAL; break; }
case B_PIPECROSS: { pSettings->selectedElement->type = B_CROSSDIAGONAL; break; }
case B_ELLIPTIC: { pSettings->selectedElement->type = B_PIPECROSS; break; }
case B_RECTANGLE: { pSettings->selectedElement->type = B_ELLIPTIC; break; }
case B_PYRAMID: { pSettings->selectedElement->type = B_RECTANGLE; break; }
case B_MIRRORHORIZONTAL: { pSettings->selectedElement->type = B_PYRAMID; break; }
case B_MIRRORVERTICAL: { pSettings->selectedElement->type = B_MIRRORHORIZONTAL; break; }
case B_SPLITSOLID: { pSettings->selectedElement->type = B_MIRRORVERTICAL; break; }
case B_SPLITHORIZONTAL: { pSettings->selectedElement->type = B_SPLITSOLID; break; }
case B_SPLITVERTICAL: { pSettings->selectedElement->type = B_SPLITHORIZONTAL; break; }
case B_SUPERHORIZONTAL: { pSettings->selectedElement->type = B_SPLITVERTICAL; break; }
case B_SUPERVERTICAL: { pSettings->selectedElement->type = B_SUPERHORIZONTAL; break; }
default: { pSettings->selectedElement->type = B_PARENTRELATIVE; break; }
}
}
else
{
if (pSettings->selectedElement == pSettings->MenuSeparator)
{
switch (pSettings->selectedElement->type)
{
case B_SOLID: { pSettings->selectedElement->type = B_HORIZONTAL; break; }
case B_HORIZONTAL: { pSettings->selectedElement->type = B_MIRRORHORIZONTAL; break; }
case B_MIRRORHORIZONTAL: { pSettings->selectedElement->type = B_SPLITHORIZONTAL; break; }
case B_SPLITHORIZONTAL: { pSettings->selectedElement->type = B_SUPERHORIZONTAL; break; }
case B_SUPERHORIZONTAL: { pSettings->selectedElement->type = B_SOLID; break; }
default: { pSettings->selectedElement->type = B_SOLID; break; }
}
}
else if (pSettings->selectedElement == pSettings->ToolbarBorder ||
pSettings->selectedElement == pSettings->MenuFrameBorder ||
pSettings->selectedElement == pSettings->DockBorder)
{
switch (pSettings->selectedElement->type)
{
case B_PARENTRELATIVE: { pSettings->selectedElement->type = B_HORIZONTAL; break; }
case B_HORIZONTAL: { pSettings->selectedElement->type = B_VERTICAL; break; }
case B_VERTICAL: { pSettings->selectedElement->type = B_MIRRORHORIZONTAL; break; }
case B_MIRRORHORIZONTAL: { pSettings->selectedElement->type = B_MIRRORVERTICAL; break; }
case B_MIRRORVERTICAL: { pSettings->selectedElement->type = B_SPLITHORIZONTAL; break; }
case B_SPLITHORIZONTAL: { pSettings->selectedElement->type = B_SPLITVERTICAL; break; }
case B_SPLITVERTICAL: { pSettings->selectedElement->type = B_SUPERHORIZONTAL; break; }
case B_SUPERHORIZONTAL: { pSettings->selectedElement->type = B_SUPERVERTICAL; break; }
case B_SUPERVERTICAL: { pSettings->selectedElement->type = B_PARENTRELATIVE; break; }
default: { pSettings->selectedElement->type = B_PARENTRELATIVE; break; }
}
}
else switch (pSettings->selectedElement->type)
{
case B_PARENTRELATIVE: { pSettings->selectedElement->type = B_SOLID; break; }
case B_SOLID: { pSettings->selectedElement->type = B_HORIZONTAL; break; }
case B_HORIZONTAL: { pSettings->selectedElement->type = B_VERTICAL; break; }
case B_VERTICAL: { pSettings->selectedElement->type = B_DIAGONAL; break; }
case B_DIAGONAL: { pSettings->selectedElement->type = B_CROSSDIAGONAL; break; }
case B_CROSSDIAGONAL: { pSettings->selectedElement->type = B_PIPECROSS; break; }
case B_PIPECROSS: { pSettings->selectedElement->type = B_ELLIPTIC; break; }
case B_ELLIPTIC: { pSettings->selectedElement->type = B_RECTANGLE; break; }
case B_RECTANGLE: { pSettings->selectedElement->type = B_PYRAMID; break; }
case B_PYRAMID: { pSettings->selectedElement->type = B_MIRRORHORIZONTAL; break; }
case B_MIRRORHORIZONTAL: { pSettings->selectedElement->type = B_MIRRORVERTICAL; break; }
case B_MIRRORVERTICAL: { pSettings->selectedElement->type = B_SPLITSOLID; break; }
case B_SPLITSOLID: { pSettings->selectedElement->type = B_SPLITHORIZONTAL; break; }
case B_SPLITHORIZONTAL: { pSettings->selectedElement->type = B_SPLITVERTICAL; break; }
case B_SPLITVERTICAL: { pSettings->selectedElement->type = B_SUPERHORIZONTAL; break; }
case B_SUPERHORIZONTAL: { pSettings->selectedElement->type = B_SUPERVERTICAL; break; }
case B_SUPERVERTICAL: { pSettings->selectedElement->type = B_PARENTRELATIVE; break; }
default: { pSettings->selectedElement->type = B_PARENTRELATIVE; break; }
}
}
if (pSettings->selectedElement->type == B_PARENTRELATIVE) pSettings->selectedElement->parentRelative = true;
else pSettings->selectedElement->parentRelative = false;
switch (pSettings->selectedElement->type)
{
case B_PARENTRELATIVE: { strcpy_s(feedback, sizeofArray(feedback), "... ParentRelative"); break; }
case B_SOLID: { strcpy_s(feedback, sizeofArray(feedback), "... Solid (1 color)"); break; }
case B_HORIZONTAL: { strcpy_s(feedback, sizeofArray(feedback), "... Horizontal (2 colors)"); break; }
case B_VERTICAL: { strcpy_s(feedback, sizeofArray(feedback), "... Vertical (2 colors)"); break; }
case B_DIAGONAL: { strcpy_s(feedback, sizeofArray(feedback), "... Diagonal (2 colors)"); break; }
case B_CROSSDIAGONAL: { strcpy_s(feedback, sizeofArray(feedback), "... CrossDiagonal (2 colors)"); break; }
case B_PIPECROSS: { strcpy_s(feedback, sizeofArray(feedback), "... Pipecross (2 colors)"); break; }
case B_ELLIPTIC: { strcpy_s(feedback, sizeofArray(feedback), "... Elliptic (2 colors)"); break; }
case B_RECTANGLE: { strcpy_s(feedback, sizeofArray(feedback), "... Rectangle (2 colors)"); break; }
case B_PYRAMID: { strcpy_s(feedback, sizeofArray(feedback), "... Pyramid (2 colors)"); break; }
case B_MIRRORHORIZONTAL: { strcpy_s(feedback, sizeofArray(feedback), "... MirrorHorizontal (2 colors)"); break; }
case B_MIRRORVERTICAL: { strcpy_s(feedback, sizeofArray(feedback), "... MirrorVertical (2 colors)"); break; }
case B_SPLITSOLID: { strcpy_s(feedback, sizeofArray(feedback), "... SplitSolid (2 colors)"); break; }
case B_SPLITHORIZONTAL: { strcpy_s(feedback, sizeofArray(feedback), "... SplitHorizontal (4 colors)"); break; }
case B_SPLITVERTICAL: { strcpy_s(feedback, sizeofArray(feedback), "... SplitVertical (4 colors)"); break; }
case B_SUPERHORIZONTAL: { strcpy_s(feedback, sizeofArray(feedback), "... SuperHorizontal (8 colors)"); break; }
case B_SUPERVERTICAL: { strcpy_s(feedback, sizeofArray(feedback), "... SuperVertical (8 colors)"); break; }
default: { strcpy_s(feedback, sizeofArray(feedback), "... Error: Unsupported appearance!"); break; }
}
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
}
else if (!_stricmp(token4, "Bevel"))
{
if ((pSettings->selectedElement != pSettings->MenuSeparator) && (pSettings->selectedElement != pSettings->ToolbarBorder) &&
(pSettings->selectedElement != pSettings->MenuFrameBorder) && (pSettings->selectedElement != pSettings->DockBorder) &&
(pSettings->selectedElement != pSettings->ExternalHardware))
{
if (pSettings->selectedElement->bevelstyle == BEVEL_FLAT)
{
pSettings->selectedElement->bevelstyle = BEVEL_RAISED;
pSettings->selectedElement->bevelposition = BEVEL1;
strcpy_s(feedback, sizeofArray(feedback), "... Raised Bevel1");
}
else if (pSettings->selectedElement->bevelstyle == BEVEL_RAISED)
{
if (pSettings->selectedElement->bevelposition == BEVEL1)
{
pSettings->selectedElement->bevelposition = BEVEL2;
strcpy_s(feedback, sizeofArray(feedback), "... Raised Bevel2");
}
else
{
pSettings->selectedElement->bevelstyle = BEVEL_SUNKEN;
pSettings->selectedElement->bevelposition = BEVEL1;
strcpy_s(feedback, sizeofArray(feedback), "... Sunken Bevel1");
}
}
else if (pSettings->selectedElement->bevelstyle == BEVEL_SUNKEN)
{
if (pSettings->selectedElement->bevelposition == BEVEL1)
{
pSettings->selectedElement->bevelposition = BEVEL2;
strcpy_s(feedback, sizeofArray(feedback), "... Sunken Bevel2");
}
else
{
pSettings->selectedElement->bevelstyle = BEVEL_FLAT;
pSettings->selectedElement->bevelposition = BEVEL1;
strcpy_s(feedback, sizeofArray(feedback), "... Flat");
}
}
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
}
else
{
pSettings->selectedElement->bevelstyle = BEVEL_FLAT;
strcpy_s(feedback, sizeofArray(feedback), "--- Not available ---");
}
}
else if (!_stricmp(token4, "Interlaced"))
{
if ((pSettings->selectedElement != pSettings->MenuSeparator) && (pSettings->selectedElement != pSettings->ToolbarBorder) &&
(pSettings->selectedElement != pSettings->MenuFrameBorder) && (pSettings->selectedElement != pSettings->DockBorder) &&
(pSettings->selectedElement != pSettings->ExternalHardware))
{
if (!pSettings->selectedElement->interlaced)
{
pSettings->selectedElement->interlaced = true;
strcpy_s(feedback, sizeofArray(feedback), "... Interlace enabled");
}
else
{
pSettings->selectedElement->interlaced = false;
strcpy_s(feedback, sizeofArray(feedback), "... Interlace disabled");
}
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
}
else strcpy_s(feedback, sizeofArray(feedback), "--- Not available ---");
}
else if (!_stricmp(token4, "Colors"))
{
COLORREF colors[8] = { pSettings->selectedElement->Color1, pSettings->selectedElement->Color2, pSettings->selectedElement->Color3, pSettings->selectedElement->Color4, pSettings->selectedElement->Color5, pSettings->selectedElement->Color6, pSettings->selectedElement->Color7, pSettings->selectedElement->Color8 };
for (int n = 1; n <= 8; n++)
{
COLORREF* color;
switch (n)
{
case 1: { color = &pSettings->selectedElement->Color1; break; }
case 2: { color = &pSettings->selectedElement->Color2; break; }
case 3: { color = &pSettings->selectedElement->Color3; break; }
case 4: { color = &pSettings->selectedElement->Color4; break; }
case 5: { color = &pSettings->selectedElement->Color5; break; }
case 6: { color = &pSettings->selectedElement->Color6; break; }
case 7: { color = &pSettings->selectedElement->Color7; break; }
case 8: { color = &pSettings->selectedElement->Color8; break; }
default: return false;
}
if (!_stricmp(extra, "Greyscale"))
{
int greyscale = ((BYTE)GetRValue(*color) + (BYTE)GetGValue(*color) + (BYTE)GetBValue(*color)) / 3;
*color = RGB((BYTE)greyscale, (BYTE)greyscale, (BYTE)greyscale);
strcpy_s(feedback, sizeofArray(feedback), "... converted to greyscale!");
}
if (!_stricmp(extra, "Sepia"))
{
double r, g, b;
r = (GetRValue(*color) * 0.393) + (GetGValue(*color) * 0.769) + (GetBValue(*color) * 0.189);
if (r > 255) r = 255;
g = (GetRValue(*color) * 0.349) + (GetGValue(*color) * 0.686) + (GetBValue(*color) * 0.168);
if (g > 255) g = 255;
b = (GetRValue(*color) * 0.272) + (GetGValue(*color) * 0.534) + (GetBValue(*color) * 0.131);
if (b > 255) b = 255;
*color = RGB((BYTE)r, (BYTE)g, (BYTE)b);
strcpy_s(feedback, sizeofArray(feedback), "... converted to sepia!");
}
else if (!_stricmp(extra, "Darken"))
{
double r = GetRValue(*color) * 0.9;
double g = GetGValue(*color) * 0.9;
double b = GetBValue(*color) * 0.9;
*color = RGB((BYTE)r, (BYTE)g, (BYTE)b);
strcpy_s(feedback, sizeofArray(feedback), "... colors darkened!");
}
else if (!_stricmp(extra, "Lighten"))
{
bool ceilingHit = false;
double r = GetRValue(*color) * 1.1;
if (r > 255) ceilingHit = true;
double g = GetGValue(*color) * 1.1;
if (g > 255) ceilingHit = true;
double b = GetBValue(*color) * 1.1;
if (b > 255) ceilingHit = true;
if (!ceilingHit)
{
*color = RGB((BYTE)r, (BYTE)g, (BYTE)b);
strcpy_s(feedback, sizeofArray(feedback), "... colors lightened!");
}
else strcpy_s(feedback, sizeofArray(feedback), "... can not go further!");
}
else if (!_stricmp(extra, "Invert"))
{
BYTE r = 255 - GetRValue(*color);
BYTE g = 255 - GetGValue(*color);
BYTE b = 255 - GetBValue(*color);
*color = RGB((BYTE)r, (BYTE)g, (BYTE)b);
strcpy_s(feedback, sizeofArray(feedback), "... colors inverted!");
}
else if (!_stricmp(extra, "Flip"))
{
if ((pSettings->selectedElement->type == B_PARENTRELATIVE) || pSettings->selectedElement->parentRelative) break;
else if ((pSettings->selectedElement->type == B_SUPERHORIZONTAL) || (pSettings->selectedElement->type == B_SUPERVERTICAL)) *color = colors[8-n];
else if (((pSettings->selectedElement->type == B_SPLITHORIZONTAL) || (pSettings->selectedElement->type == B_SPLITVERTICAL)) && (n<=4)) *color = colors[4-n];
else if ((pSettings->selectedElement->type != B_SOLID) && (n<=2)) *color = colors[2-n];
else break;
strcpy_s(feedback, sizeofArray(feedback), "... colors flipped!");
}
}
}
else if (IsInString(token4, "Color"))
{
if (*extra == '#') memmove(extra, extra + 1, strnlen_s(extra, sizeofArray(extra)));
COLORREF newColor = strtol(extra, NULL, 16);
newColor = RGB(GetBValue(newColor), GetGValue(newColor), GetRValue(newColor));
if (!_strnicmp(token4, "Color", 5))
{
int color = atoi(&token4[5]);
switch (color)
{
case 1: { pSettings->selectedElement->Color1 = newColor; break; }
case 2: { pSettings->selectedElement->Color2 = newColor; break; }
case 3: { pSettings->selectedElement->Color3 = newColor; break; }
case 4: { pSettings->selectedElement->Color4 = newColor; break; }
case 5: { pSettings->selectedElement->Color5 = newColor; break; }
case 6: { pSettings->selectedElement->Color6 = newColor; break; }
case 7: { pSettings->selectedElement->Color7 = newColor; break; }
case 8: { pSettings->selectedElement->Color8 = newColor; break; }
default: break;
}
}
else if (!_stricmp(token4, "TextColor")) pSettings->selectedElement->TextColor = newColor;
else if (!_stricmp(token4, "OutlineColor"))
{
pSettings->selectedElement->OutlineColor = newColor;
pSettings->selectedElement->FontOutline = true;
}
else if (!_stricmp(token4, "ShadowColor"))
{
pSettings->selectedElement->ShadowColor = newColor;
pSettings->selectedElement->FontShadow = true;
}
else if (!_stricmp(token4, "DisabledColor")) pSettings->selectedElement->disabledColor = newColor;
else if (!_stricmp(token4, "GlyphColor")) pSettings->selectedElement->BulletColor = newColor;
else if (!_stricmp(token4, "BorderColor")) pSettings->selectedElement->borderColor = newColor;
}
else if (!_stricmp(token4, "MarginWidth"))
{
if ((pSettings->selectedElement != pSettings->MenuSeparator) && (pSettings->selectedElement != pSettings->ToolbarBorder) &&
(pSettings->selectedElement != pSettings->MenuFrameBorder) && (pSettings->selectedElement != pSettings->DockBorder) &&
(pSettings->selectedElement != pSettings->ExternalHardware))
{
if (!_stricmp(extra, "+")) pSettings->selectedElement->marginWidth += pSettings->scalingFactorHiDPI;
else if (!_stricmp(extra, "-"))
{
pSettings->selectedElement->marginWidth -= pSettings->scalingFactorHiDPI;
if (pSettings->selectedElement->marginWidth < 0) pSettings->selectedElement->marginWidth = 0;
}
sprintf_s(feedback, sizeofArray(feedback), "... %d pixels (eq)", (pSettings->selectedElement->marginWidth / pSettings->scalingFactorHiDPI));
}
else strcpy_s(feedback, sizeofArray(feedback), "--- Not available ---");
}
else if (!_stricmp(token4, "BorderWidth"))
{
if ((pSettings->selectedElement != pSettings->MenuSeparator) &&
(pSettings->selectedElement != pSettings->ExternalHardware))
{
StyleItem* styleItemPtr;
if (pSettings->selectedElement == pSettings->ToolbarBorder) styleItemPtr = pSettings->Toolbar;
else if (pSettings->selectedElement == pSettings->MenuFrameBorder) styleItemPtr = pSettings->MenuFrame;
else if (pSettings->selectedElement == pSettings->DockBorder) styleItemPtr = pSettings->Dock;
else styleItemPtr = pSettings->selectedElement;
if (!_stricmp(extra, "+")) styleItemPtr->borderWidth += pSettings->scalingFactorHiDPI;
else if (!_stricmp(extra, "-"))
{
styleItemPtr->borderWidth -= pSettings->scalingFactorHiDPI;
if (styleItemPtr->borderWidth < 0) styleItemPtr->borderWidth = 0;
}
if (styleItemPtr->borderWidth > 0) styleItemPtr->bordered = true;
else styleItemPtr->bordered = false;
sprintf_s(feedback, sizeofArray(feedback), "... %d pixels (eq)", (styleItemPtr->borderWidth / pSettings->scalingFactorHiDPI));
}
else strcpy_s(feedback, sizeofArray(feedback), "--- Not available ---");
}
else if (IsInString(token4, "Font"))
{
if ((pSettings->selectedElement != pSettings->ToolbarButton) && (pSettings->selectedElement != pSettings->ToolbarButtonPressed)
&& (pSettings->selectedElement != pSettings->MenuIndicator) && (pSettings->selectedElement != pSettings->MenuSeparator)
&& (pSettings->selectedElement != pSettings->ToolbarBorder) && (pSettings->selectedElement != pSettings->MenuFrameBorder)
&& (pSettings->selectedElement != pSettings->DockBorder)
&& (pSettings->selectedElement != pSettings->WindowTitleFocus) && (pSettings->selectedElement != pSettings->WindowTitleUnfocus)
&& (pSettings->selectedElement != pSettings->WindowButtonFocus) && (pSettings->selectedElement != pSettings->WindowButtonUnfocus)
&& (pSettings->selectedElement != pSettings->WindowButtonPressed)
&& (pSettings->selectedElement != pSettings->WindowGripFocus) && (pSettings->selectedElement != pSettings->WindowGripUnfocus)
&& (pSettings->selectedElement != pSettings->WindowHandleFocus) && (pSettings->selectedElement != pSettings->WindowHandleUnfocus)
&& (pSettings->selectedElement != pSettings->ExternalHardware))
{
if (!_stricmp(token4, "Font"))
{
if (strnlen_s(extra, sizeofArray(extra)) > 0)
{
if (strchr(extra, '\"')) StrRemoveEncap(extra);
if (strchr(extra, '/'))
{
ParseFontString(extra, pSettings->selectedElement);
pSettings->selectedElement->FontHeight *= pSettings->scalingFactorHiDPI;
}
else
{
strncpy_s(pSettings->selectedElement->Font, sizeof(pSettings->selectedElement->Font), extra, _TRUNCATE);
pSettings->selectedElement->Font[sizeof(pSettings->selectedElement->Font) - 1] = '\0';
}
}
else
{
static LOGFONT lf;
ZeroMemory(&lf, sizeof(lf));
strcpy_s(lf.lfFaceName, sizeofArray(lf.lfFaceName), pSettings->selectedElement->Font);
lf.lfHeight = -MulDiv((pSettings->selectedElement->FontHeight / pSettings->scalingFactorHiDPI), GetDeviceCaps(GetDC(NULL), LOGPIXELSY), 72);
lf.lfWeight = pSettings->selectedElement->FontWeight;
CHOOSEFONT cf;
ZeroMemory(&cf, sizeof(cf));
cf.lStructSize = sizeof(cf);
cf.hwndOwner = NULL;
cf.lpLogFont = &lf;
cf.Flags = CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT;
if (ChooseFont(&cf) == TRUE)
{
if (strnlen_s(lf.lfFaceName, sizeofArray(lf.lfFaceName)) > 0)
{
strcpy_s(pSettings->selectedElement->Font, sizeofArray(pSettings->selectedElement->Font), lf.lfFaceName);
pSettings->selectedElement->FontHeight = cf.iPointSize / 10;
if ((cf.nFontType == BOLD_FONTTYPE) || (lf.lfWeight >= FW_BOLD)) pSettings->selectedElement->FontWeight = FW_BOLD;
else pSettings->selectedElement->FontWeight = FW_NORMAL;
sprintf_s(feedback, sizeofArray(feedback), "... %s/%d/", pSettings->selectedElement->Font, pSettings->selectedElement->FontHeight);
if (pSettings->selectedElement->FontWeight == FW_BOLD) strcat_s(feedback, sizeofArray(feedback), "Bold");
else strcat_s(feedback, sizeofArray(feedback), "Normal");
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
pSettings->selectedElement->FontHeight *= pSettings->scalingFactorHiDPI;
}
}
}
}
else if (!_stricmp(token4, "FontHeight"))
{
if (!_stricmp(extra, "+")) pSettings->selectedElement->FontHeight += pSettings->scalingFactorHiDPI;
else if (!_stricmp(extra, "-"))
{
pSettings->selectedElement->FontHeight -= pSettings->scalingFactorHiDPI;
if (pSettings->selectedElement->FontHeight < pSettings->scalingFactorHiDPI) pSettings->selectedElement->FontHeight = pSettings->scalingFactorHiDPI;
}
sprintf_s(feedback, sizeofArray(feedback), "... %d points (eq)", (pSettings->selectedElement->FontHeight / pSettings->scalingFactorHiDPI));
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
}
else if (!_stricmp(token4, "FontWeight"))
{
if (pSettings->selectedElement->FontWeight == FW_NORMAL)
{
pSettings->selectedElement->FontWeight = FW_BOLD;
strcpy_s(feedback, sizeofArray(feedback), "... Bold");
}
else
{
pSettings->selectedElement->FontWeight = FW_NORMAL;
strcpy_s(feedback, sizeofArray(feedback), "... Normal");
}
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
}
}
else strcpy_s(feedback, sizeofArray(feedback), "--- Not available ---");
}
else if (!_stricmp(token4, "Alignment"))
{
if ((pSettings->selectedElement != pSettings->MenuSeparator) && (pSettings->selectedElement != pSettings->ToolbarBorder) &&
(pSettings->selectedElement != pSettings->MenuFrameBorder) && (pSettings->selectedElement != pSettings->DockBorder) &&
(pSettings->selectedElement != pSettings->ExternalHardware))
{
if (pSettings->selectedElement->Justify == DT_LEFT)
{
pSettings->selectedElement->Justify = DT_CENTER;
strcpy_s(feedback, sizeofArray(feedback), "... Center");
}
else if (pSettings->selectedElement->Justify == DT_CENTER)
{
pSettings->selectedElement->Justify = DT_RIGHT;
strcpy_s(feedback, sizeofArray(feedback), "... Right");
}
else
{
pSettings->selectedElement->Justify = DT_LEFT;
strcpy_s(feedback, sizeofArray(feedback), "... Left");
}
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
}
else strcpy_s(feedback, sizeofArray(feedback), "--- Not available ---");
}
else if (!_stricmp(token4, "Outline"))
{
if ((pSettings->selectedElement != pSettings->MenuSeparator) && (pSettings->selectedElement != pSettings->ToolbarBorder) &&
(pSettings->selectedElement != pSettings->MenuFrameBorder) && (pSettings->selectedElement != pSettings->DockBorder) &&
(pSettings->selectedElement != pSettings->ExternalHardware))
{
if (!pSettings->selectedElement->FontOutline)
{
pSettings->selectedElement->FontOutline = true;
strcpy_s(feedback, sizeofArray(feedback), "... Outline enabled");
}
else
{
pSettings->selectedElement->FontOutline = false;
strcpy_s(feedback, sizeofArray(feedback), "... Outline disabled");
}
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
}
else strcpy_s(feedback, sizeofArray(feedback), "--- Not available ---");
}
else if (!_stricmp(token4, "Shadow"))
{
if ((pSettings->selectedElement != pSettings->MenuSeparator) && (pSettings->selectedElement != pSettings->ToolbarBorder) &&
(pSettings->selectedElement != pSettings->MenuFrameBorder) && (pSettings->selectedElement != pSettings->DockBorder) &&
(pSettings->selectedElement != pSettings->ExternalHardware))
{
if (!pSettings->selectedElement->FontShadow)
{
pSettings->selectedElement->FontShadow = true;
strcpy_s(feedback, sizeofArray(feedback), "... Shadow enabled");
}
else
{
pSettings->selectedElement->FontShadow = false;
strcpy_s(feedback, sizeofArray(feedback), "... Shadow disabled");
}
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
}
else strcpy_s(feedback, sizeofArray(feedback), "--- Not available ---");
}
else if (!_stricmp(token4, "MenuBullet"))
{
if (pSettings->menuBullet == MENU_BULLET_IMAGE) pSettings->menuBullet = MENU_BULLET_EMPTY;
else if (pSettings->menuBullet == MENU_BULLET_QUAD) pSettings->menuBullet = MENU_BULLET_EMPTY;
else pSettings->menuBullet++;
switch (pSettings->menuBullet)
{
case MENU_BULLET_EMPTY: { strcpy_s(feedback, sizeofArray(feedback), "... Empty (none)"); break; }
case MENU_BULLET_DIAMOND: { strcpy_s(feedback, sizeofArray(feedback), "... Diamond"); break; }
case MENU_BULLET_SQUARE: { strcpy_s(feedback, sizeofArray(feedback), "... Square"); break; }
case MENU_BULLET_TRIANGLE: { strcpy_s(feedback, sizeofArray(feedback), "...Triangle"); break; }
case MENU_BULLET_CIRCLE: { strcpy_s(feedback, sizeofArray(feedback), "... Circle"); break; }
case MENU_BULLET_TRIPLE: { strcpy_s(feedback, sizeofArray(feedback), "... Triple"); break; }
case MENU_BULLET_COMMENT: { strcpy_s(feedback, sizeofArray(feedback), "... Comment"); break; }
case MENU_BULLET_GRID: { strcpy_s(feedback, sizeofArray(feedback), "... Grid"); break; }
case MENU_BULLET_QUAD: { strcpy_s(feedback, sizeofArray(feedback), "... Quad"); break; }
default: { strcpy_s(feedback, sizeofArray(feedback), "... Error: Unsupported menu bullet type!"); break; }
}
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
}
else if (!_stricmp(token4, "MenuBulletPosition"))
{
if (!_stricmp(pSettings->menuBulletPosition, "Right")) strcpy_s(pSettings->menuBulletPosition, sizeofArray(pSettings->menuBulletPosition), "Left");
else strcpy_s(pSettings->menuBulletPosition, sizeofArray(pSettings->menuBulletPosition), "Right");
sprintf_s(feedback, sizeofArray(feedback), "... %s", pSettings->menuBulletPosition);
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
}
if (strnlen_s(feedback, sizeofArray(feedback)) > 0)
{
char broam[MAX_LINE_LENGTH];
sprintf_s(broam, sizeofArray(broam), "@xDesigner Feedback %s", feedback);
SendMessage(GetBBWnd(), BB_BROADCAST, 0, (LPARAM)broam);
}
pSettings->UpdateAppearanceString(pSettings->selectedElement);
if (pSettings->selectedElement == pSettings->MenuTitle || pSettings->selectedElement == pSettings->MenuFrame ||
pSettings->selectedElement == pSettings->MenuActive || pSettings->selectedElement == pSettings->MenuGrip ||
pSettings->selectedElement == pSettings->MenuIndicator || pSettings->selectedElement == pSettings->MenuSeparator ||
pSettings->selectedElement == pSettings->MenuFrameBorder ||
!_stricmp(token4, "MenuBullet") || !_stricmp(token4, "MenuBulletPosition"))
{
if (pMenuCommon)
{
pMenuCommon->Configure();
SendMessage(GetBBWnd(), BB_REDRAWGUI, BBRG_MENU, 0);
}
}
else if (pSettings->selectedElement == pSettings->Toolbar || pSettings->selectedElement == pSettings->ToolbarLabel ||
pSettings->selectedElement == pSettings->ToolbarWindowLabel || pSettings->selectedElement == pSettings->ToolbarClock ||
pSettings->selectedElement == pSettings->ToolbarButton || pSettings->selectedElement == pSettings->ToolbarButtonPressed ||
pSettings->selectedElement == pSettings->ToolbarBorder)
{
pSettings->DeriveTaskbarStyle();
if (pToolbar) pToolbar->UpdatePosition();
SendMessage(GetBBWnd(), BB_REDRAWGUI, BBRG_TOOLBAR, 0);
}
else if (pSettings->selectedElement == pSettings->Dock || pSettings->selectedElement == pSettings->DockBorder)
{
if (pDock) pDock->UpdateDockWindow();
SendMessage(GetBBWnd(), BB_REDRAWGUI, BBRG_DOCK, 0);
}
else if (pSettings->selectedElement == pSettings->Console)
{
if (pConsole) pConsole->UpdatePosition();
}
else if (pSettings->selectedElement == pSettings->WindowTitleFocus || pSettings->selectedElement == pSettings->WindowTitleUnfocus ||
pSettings->selectedElement == pSettings->WindowLabelFocus || pSettings->selectedElement == pSettings->WindowLabelUnfocus ||
pSettings->selectedElement == pSettings->WindowButtonFocus || pSettings->selectedElement == pSettings->WindowButtonUnfocus || pSettings->selectedElement == pSettings->WindowButtonPressed ||
pSettings->selectedElement == pSettings->WindowGripFocus || pSettings->selectedElement == pSettings->WindowGripUnfocus ||
pSettings->selectedElement == pSettings->WindowHandleFocus || pSettings->selectedElement == pSettings->WindowHandleUnfocus)
{
SendMessage(GetBBWnd(), BB_REDRAWGUI, BBRG_WINDOW, 0);
}
else if (pSettings->selectedElement == pSettings->ExternalHardware)
{
SendMessage(GetBBWnd(), BB_REDRAWGUI, BBRG_HARDWARE, 0);
}
return true;
}
else if (!_stricmp(token3, "Copy"))
{
StyleItem* source = NULL;
StyleItem* destination = NULL;
StyleItem* ptr;
char srcdest[MAX_LINE_LENGTH];
for (int n=1; n<=2; n++)
{
if (n == 1) strcpy_s(srcdest, sizeofArray(srcdest), token4);
else strcpy_s(srcdest, sizeofArray(srcdest), extra);
if (!_strnicmp(srcdest, "Toolbar", 7))
{
if (!_stricmp(srcdest, "Toolbar")) ptr = pSettings->Toolbar;
else if (!_stricmp(srcdest, "ToolbarLabel")) ptr = pSettings->ToolbarLabel;
else if (!_stricmp(srcdest, "ToolbarWindowLabel")) ptr = pSettings->ToolbarWindowLabel;
else if (!_stricmp(srcdest, "ToolbarClock")) ptr = pSettings->ToolbarClock;
else if (!_stricmp(srcdest, "ToolbarButton")) ptr = pSettings->ToolbarButton;
else if (!_stricmp(srcdest, "ToolbarButtonPressed")) ptr = pSettings->ToolbarButtonPressed;
else if (!_stricmp(srcdest, "ToolbarBorder")) ptr = pSettings->ToolbarBorder;
}
else if (!_strnicmp(srcdest, "Menu", 4))
{
if (!_stricmp(srcdest, "MenuTitle")) ptr = pSettings->MenuTitle;
else if (!_stricmp(srcdest, "MenuFrame")) ptr = pSettings->MenuFrame;
else if (!_stricmp(srcdest, "MenuActive")) ptr = pSettings->MenuActive;
else if (!_stricmp(srcdest, "MenuGrip")) ptr = pSettings->MenuGrip;
else if (!_stricmp(srcdest, "MenuIndicator")) ptr = pSettings->MenuIndicator;
else if (!_stricmp(srcdest, "MenuSeparator")) ptr = pSettings->MenuSeparator;
else if (!_stricmp(srcdest, "MenuFrameBorder")) ptr = pSettings->MenuFrameBorder;
}
else if (!_stricmp(srcdest, "Dock")) ptr = pSettings->Dock;
else if (!_stricmp(srcdest, "DockBorder")) ptr = pSettings->DockBorder;
else if (!_stricmp(srcdest, "Console")) ptr = pSettings->Console;
else if (!_strnicmp(srcdest, "Window", 6))
{
if (!_strnicmp(&srcdest[6], "Title", 5))
{
if (!_stricmp(srcdest, "WindowTitleFocus")) ptr = pSettings->WindowTitleFocus;
else if (!_stricmp(srcdest, "WindowTitleUnfocus")) ptr = pSettings->WindowTitleUnfocus;
}
else if (!_strnicmp(&srcdest[6], "Label", 5))
{
if (!_stricmp(srcdest, "WindowLabelFocus")) ptr = pSettings->WindowLabelFocus;
else if (!_stricmp(srcdest, "WindowLabelUnfocus")) ptr = pSettings->WindowLabelUnfocus;
}
else if (!_strnicmp(&srcdest[6], "Button", 6))
{
if (!_stricmp(srcdest, "WindowButtonFocus")) ptr = pSettings->WindowButtonFocus;
else if (!_stricmp(srcdest, "WindowButtonUnfocus")) ptr = pSettings->WindowButtonUnfocus;
else if (!_stricmp(srcdest, "WindowButtonPressed")) ptr = pSettings->WindowButtonPressed;
}
else if (!_strnicmp(&srcdest[6], "Grip", 4))
{
if (!_stricmp(srcdest, "WindowGripFocus")) ptr = pSettings->WindowGripFocus;
else if (!_stricmp(srcdest, "WindowGripUnfocus")) ptr = pSettings->WindowGripUnfocus;
}
else if (!_strnicmp(&srcdest[6], "Handle", 6))
{
if (!_stricmp(srcdest, "WindowHandleFocus")) ptr = pSettings->WindowHandleFocus;
else if (!_stricmp(srcdest, "WindowHandleUnfocus")) ptr = pSettings->WindowHandleUnfocus;
}
}
else if (!_stricmp(srcdest, "Hardware")) ptr = pSettings->ExternalHardware;
else return false;
if (n == 1) source = ptr;
else destination = ptr;
}
CopyMemory(destination, source, sizeof(StyleItem));
pSettings->selectedElement = destination;
if (pToolbar) pToolbar->UpdatePosition();
if (pMenuCommon)
{
pMenuCommon->Configure();
SendMessage(GetBBWnd(), BB_REDRAWGUI, BBRG_MENU, 0);
}
if (pDock) pDock->UpdateDockWindow();
if (pConsole) pConsole->UpdatePosition();
SendMessage(GetBBWnd(), BB_REDRAWGUI, BBRG_WINDOW, 0);
SendMessage(GetBBWnd(), BB_BROADCAST, 0, (LPARAM)"@xDesigner Feedback ... copied!");
}
else if (!_stricmp(token3, "Save"))
{
pSettings->WriteStyle();
SendMessage(GetBBWnd(), BB_BROADCAST, 0, (LPARAM)"@xDesigner Feedback ... saved!");
}
}
else if (!_stricmp(token2, "Reconfigure"))
{
PostMessage(GetBBWnd(), BB_SETSTYLE, 0, 0);
return true;
}
else if (!_stricmp(token2, "Restart"))
{
PostMessage(GetBBWnd(), BB_RESTART, 0, 0);
return true;
}
else if (!_stricmp(token2, "PausedRestart"))
{
PostMessage(GetBBWnd(), BB_RESTART, 1, 0);
return true;
}
else if (!_stricmp(token2, "MinimizeAll"))
{
pTaskbar->MinimizeAllWindows();
return true;
}
else if (!_stricmp(token2, "RestoreAll"))
{
pTaskbar->RestoreAllWindows();
return true;
}
else if (!_stricmp(token2, "Explorer"))
{
if (!_stricmp(token3, "Toggle")) ToggleExplorer();
else if (!_stricmp(token3, "Hide") && !pSettings->explorerHidden) ToggleExplorer();
else if (!_stricmp(token3, "Show") && pSettings->explorerHidden) ToggleExplorer();
return true;
}
else if (!_stricmp(token2, "ToggleExplorer"))
{
ToggleExplorer();
return true;
}
else if (!_stricmp(token2, "EmptyRecycleBin"))
{
SHEmptyRecycleBin(NULL, NULL, 0);
return true;
}
else if (!_stricmp(token2, "Statistics"))
{
char msg[255];
sprintf_s(msg, sizeofArray(msg), "xoblite says: \"Since launch, you have changed theme %d time%s, style %d time%s, and wallpaper %d time%s.\"", pSettings->Statistics.changedTheme, ((pSettings->Statistics.changedTheme != 1) ? "s" : ""), pSettings->Statistics.changedStyle, ((pSettings->Statistics.changedStyle != 1) ? "s" : ""), pSettings->Statistics.changedWallpaper, ((pSettings->Statistics.changedWallpaper != 1) ? "s" : ""));
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_SHELL_MESSAGE, (LPARAM)msg);
sprintf_s(msg, sizeofArray(msg), "\"You have also used hotkeys %d time%s, and (through various actions) triggered %d bro@m%s.\"", pSettings->Statistics.usedAHotkey, ((pSettings->Statistics.usedAHotkey != 1) ? "s" : ""), pSettings->Statistics.executedBroams, ((pSettings->Statistics.executedBroams != 1) ? "s" : ""));
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_PLAIN_MESSAGE, (LPARAM)msg);
return true;
}
else if (!_stricmp(token2, "Quit"))
{
if (!_stricmp(token3, "<Yes>")) PostMessage(GetBBWnd(), BB_QUIT, 0, 0);
else SendMessage(GetBBWnd(), BB_POPUPMESSAGE, (WPARAM)"Are you sure you want to quit?", (LPARAM)"@xoblite Quit <Yes>");
return true;
}
else if (!_stricmp(token2, "System"))
{
if (!_stricmp(token3, "Shutdown")) PostMessage(GetBBWnd(), BB_SHUTDOWN, 0, 1);
else if (!_stricmp(token3, "Reboot")) PostMessage(GetBBWnd(), BB_SHUTDOWN, 1, 1);
else if (!_stricmp(token3, "LogOff")) PostMessage(GetBBWnd(), BB_SHUTDOWN, 2, 1);
else if (!_stricmp(token3, "Hibernate")) PostMessage(GetBBWnd(), BB_SHUTDOWN, 3, 1);
else if (!_stricmp(token3, "Standby")) PostMessage(GetBBWnd(), BB_SHUTDOWN, 4, 1);
return true;
}
}
else if (!_strnicmp(broam, "@Script", 7))
{
if (!pSettings->disableScriptSupport)
{
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_REGULAR_MESSAGE, (LPARAM)broam);
char token1[MAX_LINE_LENGTH], script[MAX_LINE_LENGTH];
LPSTR tokens[1];
tokens[0] = token1;
token1[0] = script[0] = '\0';
BBTokenize(broam, tokens, 1, script);
script[strnlen_s(script, sizeofArray(script)) - 1] = '\0';
_beginthread(ExecuteScript, 0, &script[1]);
}
else SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"@Script support is currently disabled.");
return true;
}
else if (!_strnicmp(broam, "@Callback", 9))
{
char token1[MAX_LINE_LENGTH], token2[MAX_LINE_LENGTH], token3[MAX_LINE_LENGTH], extra[MAX_LINE_LENGTH];
LPSTR tokens[4];
tokens[0] = token1;
tokens[1] = token2;
tokens[2] = token3;
token1[0] = token2[0] = token3[0] = extra[0] = '\0';
BBTokenize(broam, tokens, 3, extra);
if ((token2[0] == '@') && strnlen_s(token3, sizeofArray(token3)))
{
char command[MAX_LINE_LENGTH];
sprintf_s(command, sizeofArray(command), "%s %s", token2, token3);
CreateRunBox(hMainInstance, command, extra);
return false;
}
}
else if (!_strnicmp(broam, "@GoToURL", 8))
{
char token1[MAX_LINE_LENGTH], extra[MAX_LINE_LENGTH];
LPSTR tokens[1];
tokens[0] = token1;
token1[0] = extra[0] = '\0';
BBTokenize(broam, tokens, 1, extra);
BBSmartExecute(extra);
return false;
}
else if (!_strnicmp(broam, "@BBShowPlugins", 14) || !_strnicmp(broam, "@BBHidePlugins", 14)) return false;
else if (!_strnicmp(broam, "@xDesigner Feedback", 19)) return false;
else if (!_strnicmp(broam, "@xWebViewer Bookmark", 20) || !_strnicmp(broam, "@xWebViewer URL", 15)) return false;
else if (!_strnicmp(broam, "@", 1))
{
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_REGULAR_MESSAGE, (LPARAM)broam);
if (IsInString(broam, "@xDesignerGUI") && !pSettings->designerModeEnabled)
{
SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"Designer mode is disabled. Please enable it to use the @xDesignerGUI bro@ms.");
}
}
else SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_ERROR_MESSAGE, (LPARAM)broam);
return false;
}
void ExecuteScript(void *param)
{
char script[MAX_LINE_LENGTH], cmd[MAX_LINE_LENGTH];
strcpy_s(script, sizeofArray(script), (LPSTR)param);
while (strnlen_s(script, sizeofArray(script)))
{
strcpy_s(script, sizeofArray(script), Tokenize(script, cmd, "|"));
if (pConsole) pConsole->BlockMessage(cmd);
BBSmartExecute(cmd);
}
_endthread();
}
bool FindRandomFile(LPSTR folder, int type, bool applyRandom)
{
char thisFolder[MAX_PATH];
char subFolder[MAX_PATH];
long handle;
_finddata_t found;
strncpy_s(thisFolder, sizeof(thisFolder), folder, _TRUNCATE);
if (thisFolder[strnlen_s(thisFolder, sizeofArray(thisFolder))] != '\\') strcat_s(thisFolder, sizeofArray(thisFolder), "\\");
strcat_s(thisFolder, sizeofArray(thisFolder), "*");
handle = _findfirst(thisFolder, &found);
if (handle != -1)
{
do
{
if (strcmp(found.name, ".") == 0 || strcmp(found.name, "..") == 0 || (found.attrib & _A_HIDDEN))
{
continue;
}
if (found.attrib & _A_SUBDIR)
{
strncpy_s(subFolder, sizeof(subFolder), thisFolder, _TRUNCATE);
subFolder[strnlen_s(subFolder, sizeofArray(subFolder)) - 1] = '\0';
strcat_s(subFolder, sizeofArray(subFolder), found.name);
if (FindRandomFile(subFolder, type, applyRandom)) break;
}
else
{
if (type == BROAM_RANDOM_STYLE)
{
if (IsInString(found.name, ".3dc")) continue;
}
else
{
if (!IsInString(found.name, ".jpg") && !IsInString(found.name, ".jpeg") && !IsInString(found.name, ".png") && !IsInString(found.name, ".bmp")) continue;
}
if (applyRandom)
{
currentFile++;
if (currentFile == randomFile)
{
strncpy_s(pathToFile, sizeof(pathToFile), thisFolder, _TRUNCATE);
pathToFile[strnlen_s(pathToFile, sizeofArray(pathToFile)) - 1] = '\0';
strcat_s(pathToFile, sizeofArray(pathToFile), found.name);
if (type == BROAM_RANDOM_STYLE)
{
PostMessage(GetBBWnd(), BB_SETSTYLE, 0, (LPARAM)pathToFile);
}
else
{
pWallpaper->SetWallpaper(pathToFile, "stretch");
pSettings->Statistics.changedWallpaper++;
}
return true;
}
}
else numberOfFiles++;
}
} while (_findnext(handle, &found) == 0);
}
_findclose(handle);
return false;
}
vector<HWND> ExplorerWndList;
void ToggleExplorer()
{
if (!pSettings->underExplorer) return;
if (!pSettings->explorerHidden) HideExplorer(false);
else ShowExplorer();
bool savedWriteProtection = pSettings->writeProtection;
pSettings->writeProtection = false;
WriteBool(pSettings->xobrcDefaultFile, "xoblite.explorer.hidden:", pSettings->explorerHidden);
pSettings->writeProtection = savedWriteProtection;
if (pDesktop) pDesktop->UpdateDesktopWindow();
if (pToolbar) pToolbar->UpdatePosition();
if (pConsole) pConsole->UpdatePosition();
if (pDock) pDock->UpdatePosition();
SendMessage(GetBBWnd(), BB_REDRAWGUI, BBRG_DESKTOP, 0);
PlaySoundFX(SFX_TOGGLE_ELEMENT);
}
void HideExplorer(bool hideOnStartup)
{
KillTimer(GetBBWnd(), CHECK_EXPLORER_HIDDEN_TIMER);
if (!pSettings->explorerHidden || hideOnStartup)
{
if (FindWindow("Shell_TrayWnd", "") == NULL) return;
APPBARDATA abd;
ZeroMemory(&abd, sizeof(abd));
abd.cbSize = sizeof(abd);
abd.lParam = ABS_AUTOHIDE;
SHAppBarMessage(ABM_SETSTATE, &abd);
ExplorerWndList.clear();
EnumWindows(ExplorerEnumWindowsProc, 0);
SetTimer(GetBBWnd(), CHECK_EXPLORER_HIDDEN_TIMER, 2000, (TIMERPROC)NULL);
pSettings->explorerHidden = true;
}
}
void ShowExplorer()
{
KillTimer(GetBBWnd(), CHECK_EXPLORER_HIDDEN_TIMER);
if (pSettings->explorerHidden)
{
while (ExplorerWndList.size())
{
ShowWindow(ExplorerWndList.back(), SW_SHOWNOACTIVATE);
ExplorerWndList.pop_back();
}
APPBARDATA abd;
ZeroMemory(&abd, sizeof(abd));
abd.cbSize = sizeof(abd);
abd.lParam = ABS_ALWAYSONTOP;
SHAppBarMessage(ABM_SETSTATE, &abd);
pSettings->explorerHidden = false;
}
}
char enumClassName[MAX_LINE_LENGTH], enumWindowTitle[MAX_LINE_LENGTH];
BOOL CALLBACK ExplorerEnumWindowsProc(HWND hwnd, LPARAM lParam)
{
{
GetClassName(hwnd, enumClassName, sizeof(enumClassName));
if (!_stricmp(enumClassName, "Shell_TrayWnd") || !_stricmp(enumClassName, "Shell_SecondaryTrayWnd"))
{
{
ShowWindow(hwnd, SW_HIDE);
ExplorerWndList.push_back(hwnd);
}
}
else if (!_stricmp(enumClassName, "Button"))
{
GetWindowText(hwnd, enumWindowTitle, sizeof(enumWindowTitle));
if (!_stricmp(enumWindowTitle, "Start"))
{
ShowWindow(hwnd, SW_HIDE);
ExplorerWndList.push_back(hwnd);
}
}
else if (!_stricmp(enumClassName, "BaseBar"))
{
ShowWindow(hwnd, SW_HIDE);
ExplorerWndList.push_back(hwnd);
}
}
return true;
}
HWND runBoxWindow = NULL;
HFONT runBoxFont = NULL;
char runBoxCommand[MAX_LINE_LENGTH] = "\0";
char runBoxString[MAX_LINE_LENGTH] = "@xoblite ";
void CreateRunBox(HINSTANCE hMainInstance, LPSTR commandString, LPSTR initString)
{
if (commandString != NULL) strcpy_s(runBoxCommand, sizeofArray(runBoxCommand), commandString);
else runBoxCommand[0] = '\0';
if (!runBoxWindow)
{
RECT workArea;
ZeroMemory(&workArea, sizeof(workArea));
SystemParametersInfo(SPI_GETWORKAREA, 0, &workArea, 0);
int editboxWidth = (workArea.right - workArea.left) / 2;
int editboxHeight = 15 * pSettings->scalingFactorHiDPI;
editboxHeight += 12;
int editboxX = editboxWidth / 2;
int editboxY = ((workArea.bottom - workArea.top) / 2) - (editboxHeight / 2);
runBoxWindow = CreateWindowEx(
WS_EX_TOOLWINDOW | WS_EX_TOPMOST | WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE,
"EDIT",
NULL,
WS_POPUP | WS_BORDER | ES_LEFT | ES_AUTOHSCROLL,
editboxX,
editboxY,
editboxWidth,
editboxHeight,
GetBBWnd(),
NULL,
hMainInstance,
NULL
);
if (!runBoxWindow)
{
MessageBox(0, "Error creating run box window!", "xoblite", MB_OK | MB_ICONERROR | MB_TOPMOST);
Log("xoblite", "Error creating run box window!");
runBoxWindow = NULL;
}
else
{
if (runBoxFont) DeleteObject(runBoxFont);
int runBoxFontSize = 15 * pSettings->scalingFactorHiDPI;
runBoxFont = CreateFont(runBoxFontSize, 0, 0, 0, FW_BOLD, false, false, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Segoe UI");
SendMessage(runBoxWindow, (UINT)WM_SETFONT, (WPARAM)runBoxFont, TRUE);
SendMessage(runBoxWindow, (UINT)EM_SETLIMITTEXT, (WPARAM)MAX_LINE_LENGTH, 0);
if (strlen(initString) > 0) SendMessage(runBoxWindow, WM_SETTEXT, 0, (LPARAM)initString);
else SendMessage(runBoxWindow, WM_SETTEXT, 0, (LPARAM)runBoxString);
SendMessage(runBoxWindow, EM_SETSEL, (WPARAM)0, (LPARAM)-1);
SetWindowSubclass(runBoxWindow, RunBoxWindowSubclassProc, 0, 0);
ShowWindow(runBoxWindow, SW_SHOW);
SetWindowPos(runBoxWindow, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE);
SetForegroundWindow(runBoxWindow);
PlaySoundFX(SFX_TOGGLE_ELEMENT);
}
}
else DestroyRunBox();
}
void DestroyRunBox()
{
if (runBoxWindow)
{
ShowWindow(runBoxWindow, SW_HIDE);
RemoveWindowSubclass(runBoxWindow, RunBoxWindowSubclassProc, 0);
DestroyWindow(runBoxWindow);
runBoxWindow = NULL;
}
if (runBoxFont) DeleteObject(runBoxFont);
}
LRESULT CALLBACK RunBoxWindowSubclassProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
{
if (runBoxWindow && (message == WM_KEYDOWN))
{
if (wParam == VK_RETURN)
{
if (strnlen_s(runBoxCommand, sizeofArray(runBoxCommand)))
{
char editedString[MAX_LINE_LENGTH], callback[MAX_LINE_LENGTH];
SendMessage(runBoxWindow, WM_GETTEXT, MAX_LINE_LENGTH, (LPARAM)&editedString);
ShowWindow(runBoxWindow, SW_HIDE);
sprintf_s(callback, sizeofArray(callback), "%s %s", runBoxCommand, editedString);
BBSmartExecute(callback);
}
else
{
SendMessage(runBoxWindow, WM_GETTEXT, MAX_LINE_LENGTH, (LPARAM)&runBoxString);
ShowWindow(runBoxWindow, SW_HIDE);
BBSmartExecute(runBoxString);
}
DestroyRunBox();
}
else if (wParam == VK_ESCAPE)
{
DestroyRunBox();
}
}
return DefSubclassProc(hwnd, message, wParam, lParam);
}