xoblite™ / Blackbox for Windows bb5 | RC6 preview | 0.25.2.14
http://xoblite.net/
Broams.cpp File Reference
#include "Broams.h"
#include <io.h>

Functions

bool ExecuteBroam (LPSTR broam, HINSTANCE hMainInstance)
 
void ExecuteScript (void *param)
 
bool FindRandomFile (LPSTR folder, int type, bool applyRandom)
 
void ToggleExplorer ()
 
void HideExplorer (bool hideOnStartup)
 
void ShowExplorer ()
 
BOOL CALLBACK ExplorerEnumWindowsProc (HWND hwnd, LPARAM lParam)
 
void CreateRunBox (HINSTANCE hMainInstance, LPSTR commandString, LPSTR initString)
 
void DestroyRunBox ()
 
LRESULT CALLBACK RunBoxWindowSubclassProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
 

Variables

SettingspSettings
 
MenuCommonpMenuCommon
 
DockpDock
 
ConsolepConsole
 
DesktoppDesktop
 
PluginManagerpPluginManager
 
ToolbarpToolbar
 
TaskbarpTaskbar
 
TooltipspTooltips
 
WorkspacespWorkspaces
 
HotkeyspHotkeys
 
WallpaperpWallpaper
 
unsigned int numberOfFiles
 
unsigned int currentFile
 
unsigned int randomFile
 
char pathToScan [MAX_PATH]
 
char pathToFile [MAX_PATH]
 
vector< HWND > ExplorerWndList
 
char enumClassName [MAX_LINE_LENGTH]
 
char enumWindowTitle [MAX_LINE_LENGTH]
 
HWND runBoxWindow = NULL
 
HFONT runBoxFont = NULL
 
char runBoxCommand [MAX_LINE_LENGTH] = "\0"
 
char runBoxString [MAX_LINE_LENGTH] = "@xoblite "
 

Function Documentation

◆ ExecuteBroam()

bool ExecuteBroam ( LPSTR broam,
HINSTANCE hMainInstance )
57{
58 if (pSettings) pSettings->Statistics.executedBroams++; // Update statistics
59
60 if (!_strnicmp(broam, "@xoblite", 8)) // xoblite core bro@ms
61 {
62 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_REGULAR_MESSAGE, (LPARAM)broam); // Display the bro@m in the console...
63
64 static char msg[MAX_LINE_LENGTH];
65 char token1[MAX_LINE_LENGTH], token2[MAX_LINE_LENGTH], token3[MAX_LINE_LENGTH], token4[MAX_LINE_LENGTH], extra[MAX_LINE_LENGTH];
66 LPSTR tokens[4];
67 tokens[0] = token1;
68 tokens[1] = token2;
69 tokens[2] = token3;
70 tokens[3] = token4;
71
72 token1[0] = token2[0] = token3[0] = token4[0] = extra[0] = '\0';
73 BBTokenize(broam, tokens, 4, extra);
74
75 //====================
76
77 if (!_stricmp(token2, "About"))
78 {
79 if (!_stricmp(token3, "Plugins"))
80 {
81 if (pPluginManager) pPluginManager->AboutPlugins();
82 }
83 else if (!_stricmp(token3, "Style"))
84 {
86 strcpy(a1, ReadString(pSettings->styleFile, "style.name:", "[Style name not specified]"));
87 strcpy(a2, ReadString(pSettings->styleFile, "style.author:", "[Author not specified]"));
88 strcpy(a3, ReadString(pSettings->styleFile, "style.date:", ""));
89 strcpy(a4, ReadString(pSettings->styleFile, "style.credits:", ""));
90 strcpy(a5, ReadString(pSettings->styleFile, "style.comments:", ""));
91 sprintf(aboutStyle, "%s \nby %s \n%s \n\n%s \n\n%s ", a1, a2, a3, a4, a5);
92 SendMessage(GetBBWnd(), BB_POPUPMESSAGE, (WPARAM)"About the current style...", (LPARAM)aboutStyle);
93 }
94 else if (!_stricmp(token3, "Hide"))
95 {
96 SendMessage(GetBBWnd(), BB_POPUPMESSAGE, NULL, NULL); // Hide any visible About popup dialogs... (this can be useful e.g. for certain @Script's)
97 }
98 else
99 {
100 char buffer[MAX_LINE_LENGTH];
101 ULONG* size = 0;
102 DWORD number = GetFileVersionInfoSize("Blackbox.exe", size);
103 GetFileVersionInfo("Blackbox.exe", NULL, number, (LPVOID)buffer);
104 void* value;
105 UINT bytes;
106 VerQueryValue(buffer, TEXT("\\StringFileInfo\\000004b0\\FileVersion"), &value, &bytes); // Make sure the correct version encoding is used (currently "000004b0" = language neutral)
107
108 char title[32];
109 strcpy(title, "About xoblite...");
110 char body[MAX_LINE_LENGTH];
111
112 if (pSettings->debugLogging)
113 {
114 char buildType[32];
115 if (pSettings->runningUnderWOW64) strcpy(buildType, "64-bit on ");
116 else strcpy(buildType, "32-bit on ");
117 if (pSettings->machineArchitecture == IMAGE_FILE_MACHINE_I386) strcat(buildType, "Intel CPU");
118 else if (pSettings->machineArchitecture == IMAGE_FILE_MACHINE_AMD64) strcat(buildType, "AMD CPU");
119 else if (pSettings->machineArchitecture == IMAGE_FILE_MACHINE_ARM64) strcat(buildType, "ARM CPU");
120 else strcat(buildType, "unknown CPU");
121
122 sprintf(body, "xoblite\x99 %s | %s\n", (LPCSTR)value, buildType); // Note: We currently do not offer x64 (64-bit) nor ARM builds, but maybe later...?
123 }
124 else sprintf(body, "xoblite\x99 %s\n", (LPCSTR)value);
125
126 strcat(body,
127 "\xA9 2002-2025 Karl Henrik Henriksson [qwilk/@xoblite]\n"
128 "\xA9 2001-2004 The Blackbox for Windows Development Team\n\n"
129 "Contains a heavily modified version of the BImage rendering engine\n"
130 "used in the original \"Blackbox\" window manager for the X Window System\n"
131 "\xA9 1997-2000 Bradley T Hughes\n"
132 "\xA9 2001-2002 Sean 'Shaleh' Perry\n\n"
133 "More information about xoblite can be found in the documentation... :)\n\n"
134 "http://xoblite.net/\n"
135 "https://github.com/xoblite/");
136 SendMessage(GetBBWnd(), BB_POPUPMESSAGE, (WPARAM)title, (LPARAM)body);
137 }
138
139 return true;
140 }
141
142 //====================
143
144 else if (!_stricmp(token2, "Run"))
145 {
146 CreateRunBox(hMainInstance, NULL, ""); // No input string here -> Starts with last entered command, all selected.
147 return true;
148 }
149
150 //====================
151
152 else if (!_stricmp(token2, "CheckForUpdates"))
153 {
154 bool silent = false;
155 _beginthread(checkForUpdates, 0, &silent);
156 return true;
157 }
158
159 //====================
160
161 else if (!_stricmp(token2, "LoadPlugin"))
162 {
163 if (strlen(token3)) pPluginManager->LoadPlugin(token3);
164 else
165 {
166 if (pMenuCommon) pMenuCommon->Hide();
167 pPluginManager->LoadPluginDialog();
168 }
169 return true;
170 }
171 else if (!_stricmp(token2, "UnloadPlugin"))
172 {
173 if (token3[0] == '#')
174 {
175 int pluginNumber = atoi(&token3[1]) - 1; // Nb. Using more human friendly 1-N numbering for the UnloadPlugin bro@ms!
176
177 if (!_stricmp(token4, "<Yes>")) pPluginManager->UnloadPlugin(NULL, pluginNumber); // <- User answering "Yes" when asked if he/she wants to unload the specified plugin...
178 else
179 {
180 char msg[MAX_LINE_LENGTH], pluginName[MAX_LINE_LENGTH];
181 strcpy(pluginName, pPluginManager->GetPluginInfo(pluginNumber, PLUGIN_NAME));
182 sprintf(msg, "Are you sure you want to unload %s?", pluginName);
183
184 char popupBroam[MAX_LINE_LENGTH];
185 sprintf(popupBroam, "@xoblite UnloadPlugin %s <Yes>", token3);
186
187 SendMessage(GetBBWnd(), BB_POPUPMESSAGE, (WPARAM)msg, (LPARAM)popupBroam);
188 }
189 }
190 else pPluginManager->UnloadPlugin(token3, -1);
191
192 return true;
193 }
194 else if (!_stricmp(token2, "TogglePluginLoaded"))
195 {
196 char path[MAX_LINE_LENGTH];
197 if (strlen(extra)) sprintf(path, "%s %s %s", token3, token4, extra);
198 else if (strlen(token4)) sprintf(path, "%s %s", token3, token4);
199 else strcpy(path, token3);
200
201 if (strlen(path))
202 {
203 if (strchr(path, '\"')) StrRemoveEncap(path);
204 if (strchr(path, '$')) ReplaceShellFolders(path);
205 if (strchr(path, '%')) ReplaceEnvVars(path);
206
207 if (pPluginManager->IsPluginLoaded(path)) pPluginManager->UnloadPlugin(path, -1);
208 else pPluginManager->LoadPlugin(path);
209 }
210
211 return true;
212 }
213
214
215 //====================
216
217 else if (!_stricmp(token2, "Toolbar"))
218 {
219 if (!_stricmp(token3, "Hide") && !pSettings->toolbarHidden) PostMessage(GetBBWnd(), BB_TOGGLETOOLBAR, 0, 0);
220 else if (!_stricmp(token3, "Show") && pSettings->toolbarHidden) PostMessage(GetBBWnd(), BB_TOGGLETOOLBAR, 0, 0);
221 else if (!_stricmp(token3, "Toggle"))
222 {
223 if (strlen(token4) > 0)
224 {
225 if (!_stricmp(token4, "Label")) // -> Toggle the toolbar workspace label...
226 {
227 if (!pSettings->toolbarLabelHidden) pSettings->toolbarLabelHidden = true;
228 else pSettings->toolbarLabelHidden = false;
229 WriteBool(pSettings->xobrcFile, "xoblite.toolbar.label.hidden:", pSettings->toolbarLabelHidden);
230 }
231 else if (!_stricmp(token4, "DownUp")) // -> Toggle the toolbar workspace selection buttons... (i.e. the leftmost buttons with "down/up" arrows)
232 {
233 if (!pSettings->toolbarDownUpButtonsHidden) pSettings->toolbarDownUpButtonsHidden = true;
234 else pSettings->toolbarDownUpButtonsHidden = false;
235 WriteBool(pSettings->xobrcFile, "xoblite.toolbar.downup.buttons.hidden:", pSettings->toolbarDownUpButtonsHidden);
236 }
237 else if (!_stricmp(token4, "LeftRight")) // -> Toggle the toolbar taskbar mode selection buttons... (i.e. the rightmost buttons with "left/right" arrows)
238 {
239 if (!pSettings->toolbarLeftRightButtonsHidden) pSettings->toolbarLeftRightButtonsHidden = true;
240 else pSettings->toolbarLeftRightButtonsHidden = false;
241 WriteBool(pSettings->xobrcFile, "xoblite.toolbar.leftright.buttons.hidden:", pSettings->toolbarLeftRightButtonsHidden);
242 }
243 else if (!_stricmp(token4, "Clock")) // -> Toggle the toolbar clock...
244 {
245 if (!pSettings->toolbarClockHidden) pSettings->toolbarClockHidden = true;
246 else pSettings->toolbarClockHidden = false;
247 WriteBool(pSettings->xobrcFile, "xoblite.toolbar.clock.hidden:", pSettings->toolbarClockHidden);
248 }
249 else if (!_stricmp(token4, "Asymmetry")) // -> Toggle toolbar label/clock assymetry allowed...
250 {
251 if (!pSettings->toolbarAllowAsymmetry) pSettings->toolbarAllowAsymmetry = true;
252 else pSettings->toolbarAllowAsymmetry = false;
253 WriteBool(pSettings->xobrcFile, "xoblite.toolbar.allow.asymmetry:", pSettings->toolbarAllowAsymmetry);
254 }
255
256 pToolbar->UpdatePosition();
258 }
259 else PostMessage(GetBBWnd(), BB_TOGGLETOOLBAR, 0, 0); // -> Toggle the toolbar itself...
260 }
261 else if (!_stricmp(token3, "Placement"))
262 {
263 char placement[255];
264 sprintf(placement, "%s %s", token4, extra); // <- We need to merge these back as Manual placements include space chars in them!
265 pSettings->ParsePlacement(placement, &pSettings->ToolbarPlacement);
266 pSettings->WritePlacement(&pSettings->ToolbarPlacement);
267 pToolbar->UpdatePosition();
268 if (pDock && (pSettings->DockPlacement.placement == PLACEMENT_OPPOSITE_TOOLBAR)) pDock->UpdatePosition();
269 pDesktop->UpdateDesktopWindow(); // In case e.g. the workspace indicators need to be moved given the new toolbar placement
271 }
272 else if (!_stricmp(token3, "Orientation"))
273 {
274 if (!_stricmp(token4, "Vertical")) pSettings->toolbarVertical = true;
275 else pSettings->toolbarVertical = false;
276 pToolbar->UpdatePosition();
278 WriteBool(pSettings->xobrcFile, "xoblite.toolbar.vertical:", pSettings->toolbarVertical);
279 }
280 else if (!_stricmp(token3, "ToggleOrientation"))
281 {
282 if (!pSettings->toolbarVertical) pSettings->toolbarVertical = true;
283 else pSettings->toolbarVertical = false;
284 pToolbar->UpdatePosition();
286 WriteBool(pSettings->xobrcFile, "xoblite.toolbar.vertical:", pSettings->toolbarVertical);
287 }
288 else if (!_stricmp(token3, "Transparency"))
289 {
290 if (!_stricmp(token4, "Label")) // -> Alpha transparency for the toolbar label (i.e. using per pixel alpha)
291 {
292 pSettings->toolbarLabelTransparencyAlpha = atoi(extra);
293 WriteInt(pSettings->xobrcFile, "xoblite.toolbar.label.transparency.alpha:", pSettings->toolbarLabelTransparencyAlpha);
294 }
295 else if (!_stricmp(token4, "WindowLabel")) // -> Alpha transparency for the toolbar windowLabel (i.e. using per pixel alpha)
296 {
297 pSettings->toolbarWindowLabelTransparencyAlpha = atoi(extra);
298 WriteInt(pSettings->xobrcFile, "xoblite.toolbar.windowlabel.transparency.alpha:", pSettings->toolbarWindowLabelTransparencyAlpha);
299 }
300 else if (!_stricmp(token4, "Clock")) // -> Alpha transparency for the toolbar clock (i.e. using per pixel alpha)
301 {
302 pSettings->toolbarClockTransparencyAlpha = atoi(extra);
303 WriteInt(pSettings->xobrcFile, "xoblite.toolbar.clock.transparency.alpha:", pSettings->toolbarClockTransparencyAlpha);
304 }
305 else if (!_stricmp(token4, "Button")) // -> Alpha transparency for the toolbar buttons (i.e. using per pixel alpha)
306 {
307 pSettings->toolbarButtonTransparencyAlpha = atoi(extra);
308 WriteInt(pSettings->xobrcFile, "xoblite.toolbar.button.transparency.alpha:", pSettings->toolbarButtonTransparencyAlpha);
309 }
310 else if (!_stricmp(token4, "ActiveTask")) // -> Alpha transparency for the taskbar's currently active task (i.e. using per pixel alpha)
311 {
312 pSettings->taskbarActiveTransparencyAlpha = atoi(extra);
313 WriteInt(pSettings->xobrcFile, "xoblite.taskbar.active.transparency.alpha:", pSettings->taskbarActiveTransparencyAlpha);
314 }
315 else // -> Alpha transparency for the toolbar itself (cf. regular window level alpha, but here using per pixel alpha applied before the other toolbar element's per pixel alpha's)
316 {
317 pSettings->toolbarTransparencyAlpha = atoi(token4);
318 WriteInt(pSettings->xobrcFile, "xoblite.toolbar.transparency.alpha:", pSettings->toolbarTransparencyAlpha);
319 }
320
321 if (pToolbar) pToolbar->UpdateToolbarWindow();
322 }
323 else if (!_stricmp(token3, "Button"))
324 {
325 if (!_stricmp(token4, "Down"))
326 {
327 strcpy(pSettings->toolbarDownButtonOverride, extra);
328 WriteString(pSettings->xobrcFile, "xoblite.toolbar.downbutton.override:", pSettings->toolbarDownButtonOverride);
329 return true;
330 }
331 else if (!_stricmp(token4, "Up"))
332 {
333 strcpy(pSettings->toolbarUpButtonOverride, extra);
334 WriteString(pSettings->xobrcFile, "xoblite.toolbar.upbutton.override:", pSettings->toolbarUpButtonOverride);
335 return true;
336 }
337 else if (!_stricmp(token4, "Left"))
338 {
339 strcpy(pSettings->toolbarLeftButtonOverride, extra);
340 WriteString(pSettings->xobrcFile, "xoblite.toolbar.leftbutton.override:", pSettings->toolbarLeftButtonOverride);
341 return true;
342 }
343 else if (!_stricmp(token4, "Right"))
344 {
345 strcpy(pSettings->toolbarRightButtonOverride, extra);
346 WriteString(pSettings->xobrcFile, "xoblite.toolbar.rightbutton.override:", pSettings->toolbarRightButtonOverride);
347 return true;
348 }
349 }
350 else if (!_stricmp(token3, "MoveToMouse"))
351 {
352 pToolbar->MoveToMouse();
354 }
355 else if (!_stricmp(token3, "MoveToTop"))
356 {
357 SetForegroundWindow(pToolbar->hToolbarWnd);
359 }
360 else if (!_stricmp(token3, "ToggleRoundedCorners"))
361 {
362 if (!pSettings->toolbarRoundedCorners) pSettings->toolbarRoundedCorners = true;
363 else pSettings->toolbarRoundedCorners = false;
364 pToolbar->UpdatePosition();
365 WriteBool(pSettings->xobrcFile, "xoblite.toolbar.rounded:", pSettings->toolbarRoundedCorners);
366 }
367 else if (!_stricmp(token3, "ToggleAlwaysOnTop")) pToolbar->ToggleAlwaysOnTop();
368 else if (!_stricmp(token3, "ToggleSnapToEdges"))
369 {
370 if (!pSettings->toolbarSnapToEdges) pSettings->toolbarSnapToEdges = true;
371 else pSettings->toolbarSnapToEdges = false;
372 WriteBool(pSettings->xobrcFile, "xoblite.toolbar.snapToEdges:", pSettings->toolbarSnapToEdges);
373 }
374
375 return true;
376 }
377
378 //====================
379
380 else if (!_stricmp(token2, "Taskbar"))
381 {
382 if (!_stricmp(token3, "Hide"))
383 {
384 pTaskbar->ChangeTaskbarMode(TASKBAR_MODE_HIDDEN); // Hide the taskbar == Show the toolbar.windowLabel instead...
385 }
386 else if (!_stricmp(token3, "Mode"))
387 {
388 if (!_stricmp(token4, "Bars")) pTaskbar->ChangeTaskbarMode(TASKBAR_MODE_BARS);
389 else if (!_stricmp(token4, "Bars+Icons")) pTaskbar->ChangeTaskbarMode(TASKBAR_MODE_BARSICONS);
390 else if (!_stricmp(token4, "Icons")) pTaskbar->ChangeTaskbarMode(TASKBAR_MODE_ICONS);
391 else if (!_stricmp(token4, "Hidden")) pTaskbar->ChangeTaskbarMode(TASKBAR_MODE_HIDDEN);
392 else pTaskbar->ChangeTaskbarMode(TASKBAR_MODE_BARSICONS);
393 }
394 else if (!_stricmp(token3, "Items"))
395 {
396 pSettings->taskbarMaxItems = atoi(token4);
397 if (pToolbar)
398 {
399 pTaskbar->taskButtonsOffset = 0;
400 pToolbar->UpdatePosition();
401 }
402 WriteInt(pSettings->xobrcFile, "xoblite.taskbar.max.items:", pSettings->taskbarMaxItems);
403 }
404 else if (!_stricmp(token3, "Sort"))
405 {
406 if (!_stricmp(token4, "Last")) // Last used
407 {
408 pSettings->taskbarSorting = TASKBAR_SORT_BY_LAST_USED;
409 WriteString(pSettings->xobrcFile, "xoblite.taskbar.sorting:", "LastUsed");
410 }
411 else if (!_stricmp(token4, "Follow")) // Follow active
412 {
413 pSettings->taskbarSorting = TASKBAR_SORT_FOLLOW_ACTIVE;
414 WriteString(pSettings->xobrcFile, "xoblite.taskbar.sorting:", "FollowActive");
415 }
416 else // Disabled
417 {
418 pSettings->taskbarSorting = TASKBAR_SORT_DISABLED;
419 WriteString(pSettings->xobrcFile, "xoblite.taskbar.sorting:", "Disabled");
420 }
421 if (pToolbar) pToolbar->UpdateToolbarWindow();
422 }
423 else if (!_stricmp(token3, "IconSaturation"))
424 {
425 pSettings->taskbarSaturationValue = atoi(token4);
426 if (pToolbar) pToolbar->UpdateToolbarWindow();
427 WriteInt(pSettings->xobrcFile, "xoblite.taskbar.saturation:", pSettings->taskbarSaturationValue);
428 }
429 else if (!_stricmp(token3, "IconHue"))
430 {
431 pSettings->taskbarHueIntensity = atoi(token4);
432 if (pToolbar) pToolbar->UpdateToolbarWindow();
433 WriteInt(pSettings->xobrcFile, "xoblite.taskbar.hue:", pSettings->taskbarHueIntensity);
434 }
435 else if (!_stricmp(token3, "ToggleShowTaskWorkspace"))
436 {
437 if (!pSettings->taskbarShowTaskWorkspace) pSettings->taskbarShowTaskWorkspace = true;
438 else pSettings->taskbarShowTaskWorkspace = false;
439 if (pToolbar) pToolbar->UpdateToolbarWindow();
440 WriteBool(pSettings->xobrcFile, "xoblite.taskbar.show.task.workspace:", pSettings->taskbarShowTaskWorkspace);
441 }
442 else if (!_stricmp(token3, "ToggleCurrentOnly"))
443 {
444 pTaskbar->ToggleCurrentOnly();
445 }
446 else if (!_stricmp(token3, "ToggleFlashing"))
447 {
448 if (!pSettings->taskbarFlashing) pSettings->taskbarFlashing = true;
449 else pSettings->taskbarFlashing = false;
450 WriteBool(pSettings->xobrcFile, "xoblite.taskbar.flashing:", pSettings->taskbarFlashing);
451 }
452 else if (!_stricmp(token3, "ToggleActiveSatHue"))
453 {
454 if (!pSettings->taskbarActiveSatHue) pSettings->taskbarActiveSatHue = true;
455 else pSettings->taskbarActiveSatHue = false;
456 if (pToolbar) pToolbar->UpdateToolbarWindow();
457 WriteBool(pSettings->xobrcFile, "xoblite.taskbar.active.SatHue:", pSettings->taskbarActiveSatHue);
458 }
459 else if (!_stricmp(token3, "ToggleActiveLivePreview"))
460 {
461 if (!pSettings->taskbarActiveLivePreview) pSettings->taskbarActiveLivePreview = true;
462 else pSettings->taskbarActiveLivePreview = false;
463 if (pToolbar) pToolbar->UpdateToolbarWindow();
464 WriteBool(pSettings->xobrcFile, "xoblite.taskbar.active.live.preview:", pSettings->taskbarActiveLivePreview);
465 }
466 else if (!_stricmp(token3, "ToggleInactiveBackground"))
467 {
468 if (!pSettings->taskbarInactiveBackground) pSettings->taskbarInactiveBackground = true;
469 else pSettings->taskbarInactiveBackground = false;
470 if (pToolbar) pToolbar->UpdateToolbarWindow();
471 WriteBool(pSettings->xobrcFile, "xoblite.taskbar.inactive.background:", pSettings->taskbarInactiveBackground);
472 }
473 else if (!_stricmp(token3, "ToggleTooltips"))
474 {
475 if (pTooltips) pTooltips->ToggleTooltips();
476 }
477 else if (!_stricmp(token3, "QuitCurrentTask"))
478 {
479 HWND hwnd = pTaskbar->GetActiveWindow();
480 if (IsIconic(hwnd)) ShowWindow(hwnd, SW_RESTORE);
481 SetForegroundWindow(hwnd);
482 PostMessage(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
483 }
484 else if (!_stricmp(token3, "ZoomCurrentTask"))
485 {
486 HWND hwnd = pTaskbar->GetActiveWindow();
487 if (!IsIconic(hwnd))
488 {
489 if (IsZoomed(hwnd)) ShowWindow(hwnd, SW_RESTORE);
490 else ShowWindow(hwnd, SW_MAXIMIZE);
491 }
492 }
493/*
494 else if (!_stricmp(token2, "CycleTasks"))
495 {
496 HWND hwnd = pTaskbar->GetActiveWindow();
497 ShowWindow(hwnd, SW_RESTORE);
498// SetWindowPos(hwnd, HWND_NOTOPMOST, 1050, 10, 0, 0, SWP_NOSIZE|SWP_NOZORDER);
499 SetWindowPos(hwnd, HWND_NOTOPMOST, -100, 10, 200, 700, SWP_NOZORDER);
500
501 int nextTask = pTaskbar->FindTask(pTaskbar->GetActiveWindow()) + 1;
502 if (nextTask >= (int)pTaskbar->taskList.size()) nextTask = 0;
503 hwnd = pTaskbar->taskList[nextTask]->hwnd;
504 ShowWindow(hwnd, SW_RESTORE);
505 SetForegroundWindow(hwnd);
506 SendMessage(GetBBWnd(), BB_BRINGTOFRONT, 0, (LPARAM)hwnd);
507// SetWindowPos(hwnd, HWND_NOTOPMOST, 10, 10, 0, 0, SWP_NOSIZE|SWP_NOZORDER);
508 SetWindowPos(hwnd, HWND_NOTOPMOST, 150, 10, 1200, 700, SWP_NOZORDER);
509 }
510*/
511 return true;
512 }
513
514 //====================
515
516 else if (!_stricmp(token2, "Dock"))
517 {
518 if (!_stricmp(token3, "Hide") && !pSettings->dockHidden) PostMessage(GetBBWnd(), BB_TOGGLEDOCK, 0, 0);
519 else if (!_stricmp(token3, "Show") && pSettings->dockHidden) PostMessage(GetBBWnd(), BB_TOGGLEDOCK, 0, 0);
520 else if (!_stricmp(token3, "Toggle")) PostMessage(GetBBWnd(), BB_TOGGLEDOCK, 0, 0);
521 else if (!_stricmp(token3, "Placement"))
522 {
523 char placement[255];
524 sprintf(placement, "%s %s", token4, extra); // Note: We need to merge these back as Manual placement strings include space chars in them!
525 pSettings->ParsePlacement(placement, &pSettings->DockPlacement);
526 pSettings->WritePlacement(&pSettings->DockPlacement);
527 if (pDock) pDock->UpdatePosition();
529 }
530 else if (!_stricmp(token3, "Orientation"))
531 {
532 if (!_stricmp(token4, "Vertical")) pSettings->dockVertical = true;
533 else pSettings->dockVertical = false;
534 if (pDock) pDock->UpdateDockWindow();
536 WriteBool(pSettings->xobrcFile, "xoblite.dock.vertical:", pSettings->dockVertical);
537 }
538 else if (!_stricmp(token3, "ToggleOrientation"))
539 {
540 if (!pSettings->dockVertical) pSettings->dockVertical = true;
541 else pSettings->dockVertical = false;
542 if (pDock) pDock->UpdateDockWindow();
544 WriteBool(pSettings->xobrcFile, "xoblite.dock.vertical:", pSettings->dockVertical);
545 }
546 else if (!_stricmp(token3, "Transparency"))
547 {
548 pSettings->dockTransparencyAlpha = atoi(token4);
549 if (pDock) SetTransparency(pDock->hDockWnd, pSettings->dockTransparencyAlpha);
550 WriteInt(pSettings->xobrcFile, "xoblite.dock.transparency.alpha:", pSettings->dockTransparencyAlpha);
551 }
552 else if (!_stricmp(token3, "TogglePuzzlePositioning"))
553 {
554 if (!pSettings->dockPuzzlePositioning) pSettings->dockPuzzlePositioning = true;
555 else pSettings->dockPuzzlePositioning = false;
556 if (pDock) pDock->UpdateDockWindow();
557 WriteBool(pSettings->xobrcFile, "xoblite.dock.puzzle.positioning:", pSettings->dockPuzzlePositioning);
558 }
559 else if (!_stricmp(token3, "ToggleAlwaysOnTop"))
560 {
561 if (pDock) pDock->ToggleAlwaysOnTop();
562 }
563 else if (!_stricmp(token3, "ToggleSnapToEdges"))
564 {
565 if (!pSettings->dockSnapToEdges) pSettings->dockSnapToEdges = true;
566 else pSettings->dockSnapToEdges = false;
567 WriteBool(pSettings->xobrcFile, "xoblite.dock.snapToEdges:", pSettings->dockSnapToEdges);
568 }
569
570 return true;
571 }
572
573 //====================
574
575 else if (!_stricmp(token2, "Menu"))
576 {
577 if (!_stricmp(token3, "Show"))
578 {
579 if (!_stricmp(token4, "Configuration")) SendMessage(GetBBWnd(), BB_MENU, 2, 0); // -> Show configuration menu
580 else if (!_stricmp(token4, "Workspaces")) SendMessage(GetBBWnd(), BB_MENU, 1, 0); // -> Show workspaces menu
581 else SendMessage(GetBBWnd(), BB_MENU, 0, 0); // -> Show main menu
583 }
584 else if (!_stricmp(token3, "Hide"))
585 {
586 if (pMenuCommon) pMenuCommon->Hide();
587 }
588 else if (!_stricmp(token3, "Transparency"))
589 {
590 if (!_stricmp(token4, "Title")) // -> Alpha transparency for the menu title (i.e. using per pixel alpha)
591 {
592 pSettings->menuTitleTransparencyAlpha = atoi(extra);
593 WriteInt(pSettings->xobrcFile, "xoblite.menu.title.transparency.alpha:", pSettings->menuTitleTransparencyAlpha);
594 }
595 else if (!_stricmp(token4, "Frame")) // -> Alpha transparency for the menu frame (i.e. using per pixel alpha)
596 {
597 pSettings->menuFrameTransparencyAlpha = atoi(extra);
598 WriteInt(pSettings->xobrcFile, "xoblite.menu.frame.transparency.alpha:", pSettings->menuFrameTransparencyAlpha);
599 }
600 else if (!_stricmp(token4, "Grip")) // -> Alpha transparency for the menu grip (i.e. using per pixel alpha)
601 {
602 pSettings->menuGripTransparencyAlpha = atoi(extra);
603 WriteInt(pSettings->xobrcFile, "xoblite.menu.grip.transparency.alpha:", pSettings->menuGripTransparencyAlpha);
604 }
605 else if (!_stricmp(token4, "Active")) // -> Alpha transparency for the active menu item (i.e. using per pixel alpha)
606 {
607 pSettings->menuActiveTransparencyAlpha = atoi(extra);
608 WriteInt(pSettings->xobrcFile, "xoblite.menu.active.transparency.alpha:", pSettings->menuActiveTransparencyAlpha);
609 }
610 else // -> Alpha transparency for the menu itself (cf. regular window level alpha, but here using per pixel alpha applied before the other menu element's per pixel alpha's)
611 {
612 pSettings->menuTransparencyAlpha = atoi(token4);
613 WriteInt(pSettings->xobrcFile, "xoblite.menu.transparency.alpha:", pSettings->menuTransparencyAlpha);
614 }
615
616 // ###################################################################################################################
617 // Note: Since there can be any number of open menues at any time, they will be updated with new transparency alpha's
618 // on the fly when accessing them, rather than being force updated from here... (maybe I'll add this later though [?])
619 // ###################################################################################################################
620 }
621 else if (!_stricmp(token3, "ToggleRoundedCorners"))
622 {
623 if (!pSettings->menuRoundedCorners) pSettings->menuRoundedCorners = true;
624 else pSettings->menuRoundedCorners = false;
625 pMenuCommon->Hide();
626 SendMessage(GetBBWnd(), BB_RECONFIGURE, 0, 0); // Note: We need to perform a full reconfigure as the submenu gap is adaptively calculated during style parsing... (i.e. BB_REDRAWGUI is not enough)
627 WriteBool(pSettings->xobrcFile, "xoblite.menu.rounded:", pSettings->menuRoundedCorners);
628 return true;
629 }
630 else if (!_stricmp(token3, "ToggleSeparators"))
631 {
632 if (!pSettings->menuSeparators) pSettings->menuSeparators = true;
633 else pSettings->menuSeparators = false;
634 WriteBool(pSettings->xobrcFile, "xoblite.menu.separators:", pSettings->menuSeparators);
635 PostMessage(GetBBWnd(), BB_RESTART, 0, 0); // Note: We need to perform a full restart here as actual menu separator items are not created if not enabled...
636 return true;
637 }
638 else if (!_stricmp(token3, "SetRCPath"))
639 {
640 menuPath(token4);
641 if (pMenuCommon) delete pMenuCommon;
642 pMenuCommon = new MenuCommon();
643 pMenuCommon->Initialize(hMainInstance);
644 }
645
646 return true;
647 }
648
649 //====================
650
651 else if (!_stricmp(token2, "Console"))
652 {
653 if (!_stricmp(token3, "Hide") && !pSettings->consoleHidden) PostMessage(GetBBWnd(), BB_TOGGLECONSOLE, 0, 0);
654 else if (!_stricmp(token3, "Show") && pSettings->consoleHidden) PostMessage(GetBBWnd(), BB_TOGGLECONSOLE, 0, 0);
655 else if (!_stricmp(token3, "Toggle")) PostMessage(GetBBWnd(), BB_TOGGLECONSOLE, 0, 0);
656 else if (!_stricmp(token3, "ToggleMaximized"))
657 {
658 pConsole->ToggleMaximized();
659 }
660 else if (!_stricmp(token3, "Placement"))
661 {
662 char placement[255];
663 sprintf(placement, "%s %s", token4, extra); // <- We need to merge these back as Manual placements include space chars in them!
664 pSettings->ParsePlacement(placement, &pSettings->ConsolePlacement);
665 pSettings->WritePlacement(&pSettings->ConsolePlacement);
666 pConsole->UpdatePosition();
668 }
669 else if (!_stricmp(token3, "Messages"))
670 {
671 if (!_stricmp(token4, "Maximized"))
672 {
673 pSettings->consoleMaximizedMessages = atoi(extra);
674 WriteInt(pSettings->xobrcFile, "xoblite.console.maximized.messages:", pSettings->consoleMaximizedMessages);
675 }
676 else if (!_stricmp(token4, "Restored"))
677 {
678 pSettings->consoleRestoredMessages = atoi(extra);
679 WriteInt(pSettings->xobrcFile, "xoblite.console.restored.messages:", pSettings->consoleRestoredMessages);
680 }
681 pConsole->UpdatePosition();
682 }
683 else if (!_stricmp(token3, "Transparency"))
684 {
685 pSettings->consoleTransparencyAlpha = atoi(token4);
686 WriteInt(pSettings->xobrcFile, "xoblite.console.transparency.alpha:", pSettings->consoleTransparencyAlpha);
687 pConsole->UpdatePosition();
688 }
689 else if (!_stricmp(token3, "ToggleDesktopMode"))
690 {
691 if (!pSettings->consoleDesktopMode) pSettings->consoleDesktopMode = true;
692 else pSettings->consoleDesktopMode = false;
693 pConsole->UpdatePosition();
694 WriteBool(pSettings->xobrcFile, "xoblite.console.desktop.mode:", pSettings->consoleDesktopMode);
695 }
696 else if (!_stricmp(token3, "ToggleRoundedCorners"))
697 {
698 if (!pSettings->consoleRoundedCorners) pSettings->consoleRoundedCorners = true;
699 else pSettings->consoleRoundedCorners = false;
700 pConsole->UpdatePosition();
701 WriteBool(pSettings->xobrcFile, "xoblite.console.rounded:", pSettings->consoleRoundedCorners);
702 }
703 else if (!_stricmp(token3, "ClearHistory"))
704 {
705 pConsole->ClearHistory(true);
706 }
707
708 return true;
709 }
710
711 //====================
712
713 else if (!_stricmp(token2, "Desktop"))
714 {
715 if (!_stricmp(token3, "Toggle"))
716 {
717 if (!_stricmp(token4, "Clock"))
718 {
719 if (!pSettings->desktopClockHidden) pSettings->desktopClockHidden = true;
720 else pSettings->desktopClockHidden = false;
721 pDesktop->UpdateDesktopWindow();
722 WriteBool(pSettings->xobrcFile, "xoblite.desktop.clock.hidden:", pSettings->desktopClockHidden);
723 return true;
724 }
725 else if (!_stricmp(token4, "Weekday"))
726 {
727 if (!pSettings->desktopWeekdayHidden) pSettings->desktopWeekdayHidden = true;
728 else pSettings->desktopWeekdayHidden = false;
729 pDesktop->UpdateDesktopWindow();
730 WriteBool(pSettings->xobrcFile, "xoblite.desktop.weekday.hidden:", pSettings->desktopWeekdayHidden);
731 return true;
732 }
733 else if (!_stricmp(token4, "Date"))
734 {
735 if (!pSettings->desktopDateHidden) pSettings->desktopDateHidden = true;
736 else pSettings->desktopDateHidden = false;
737 pDesktop->UpdateDesktopWindow();
738 WriteBool(pSettings->xobrcFile, "xoblite.desktop.date.hidden:", pSettings->desktopDateHidden);
739 return true;
740 }
741 else if (!_stricmp(token4, "Greeting"))
742 {
743 if (!pSettings->desktopGreetingHidden) pSettings->desktopGreetingHidden = true;
744 else pSettings->desktopGreetingHidden = false;
745 pDesktop->UpdateDesktopWindow();
746 WriteBool(pSettings->xobrcFile, "xoblite.desktop.greeting.hidden:", pSettings->desktopGreetingHidden);
747 return true;
748 }
749 else if (!_stricmp(token4, "Indicator"))
750 {
751 if (!pSettings->desktopWorkspaceIndicatorHidden) pSettings->desktopWorkspaceIndicatorHidden = true;
752 else pSettings->desktopWorkspaceIndicatorHidden = false;
753 pDesktop->UpdateDesktopWindow();
754 WriteBool(pSettings->xobrcFile, "xoblite.desktop.indicator.hidden:", pSettings->desktopWorkspaceIndicatorHidden);
755 return true;
756 }
757 else if (!_stricmp(token4, "Border"))
758 {
759 if (!pSettings->desktopBorderHidden) pSettings->desktopBorderHidden = true;
760 else pSettings->desktopBorderHidden = false;
761 pDesktop->UpdateDesktopWindow();
762 WriteBool(pSettings->xobrcFile, "xoblite.desktop.border.hidden:", pSettings->desktopBorderHidden);
763 return true;
764 }
765 else if (!_stricmp(token4, "ClockWeekdayDate"))
766 {
767 if (!pSettings->desktopClockHidden) pSettings->desktopClockHidden = true;
768 else pSettings->desktopClockHidden = false;
769 if (!pSettings->desktopWeekdayHidden) pSettings->desktopWeekdayHidden = true;
770 else pSettings->desktopWeekdayHidden = false;
771 if (!pSettings->desktopDateHidden) pSettings->desktopDateHidden = true;
772 else pSettings->desktopDateHidden = false;
773 pDesktop->UpdateDesktopWindow();
774 WriteBool(pSettings->xobrcFile, "xoblite.desktop.clock.hidden:", pSettings->desktopClockHidden);
775 WriteBool(pSettings->xobrcFile, "xoblite.desktop.weekday.hidden:", pSettings->desktopWeekdayHidden);
776 WriteBool(pSettings->xobrcFile, "xoblite.desktop.date.hidden:", pSettings->desktopDateHidden);
777 return true;
778 }
779 }
780 else if (!_stricmp(token3, "Clock"))
781 {
782 if (!_stricmp(token4, "Placement"))
783 {
784 pSettings->ParsePlacement(extra, &pSettings->desktopClockPlacement);
785 pSettings->WritePlacement(&pSettings->desktopClockPlacement);
786 pDesktop->UpdateDesktopWindow();
787 return true;
788 }
789 else if (!_stricmp(token4, "Regular") || !_stricmp(token4, "Text") || !_stricmp(token4, "Binary")) strcpy(pSettings->desktopClockType, token4);
790 {
791 pDesktop->UpdateDesktopWindow();
792 WriteString(pSettings->xobrcFile, "xoblite.desktop.clock.type:", pSettings->desktopClockType);
793 return true;
794 }
795 }
796 else if (!_stricmp(token3, "Weekday"))
797 {
798 if (!_stricmp(token4, "Placement"))
799 {
800 pSettings->ParsePlacement(extra, &pSettings->desktopWeekdayPlacement);
801 pSettings->WritePlacement(&pSettings->desktopWeekdayPlacement);
802 pDesktop->UpdateDesktopWindow();
803 return true;
804 }
805 }
806 else if (!_stricmp(token3, "Date"))
807 {
808 if (!_stricmp(token4, "Placement"))
809 {
810 pSettings->ParsePlacement(extra, &pSettings->desktopDatePlacement);
811 pSettings->WritePlacement(&pSettings->desktopDatePlacement);
812 pDesktop->UpdateDesktopWindow();
813 return true;
814 }
815 }
816 else if (!_stricmp(token3, "Greeting"))
817 {
818 if (!_stricmp(token4, "Placement"))
819 {
820 pSettings->ParsePlacement(extra, &pSettings->desktopGreetingPlacement);
821 pSettings->WritePlacement(&pSettings->desktopGreetingPlacement);
822 pDesktop->UpdateDesktopWindow();
823 return true;
824 }
825 }
826 else if (!_stricmp(token3, "Color"))
827 {
828 if ((*token4 != '#') || (strlen(token4) != 7)) return false; // Check if the input is a #RRGGBB format string...
829
830 if (*token4 == '#') memmove(token4, token4+1, strlen(token4));
831 COLORREF color = strtol(token4, NULL, 16);
832 color = RGB(GetBValue(color), GetGValue(color), GetRValue(color)); // Swap from RGB to BGR format...
833 pWallpaper->SetDesktopColor(color);
834 return true;
835 }
836 else if (!_stricmp(token3, "Widget"))
837 {
838 if (!_stricmp(token4, "Color"))
839 {
840 if ((*extra != '#') || (strlen(extra) != 7)) return false; // Check if the input is a #RRGGBB format string...
841
842 if (*extra == '#') memmove(extra, extra +1, strlen(extra));
843 COLORREF color = strtol(extra, NULL, 16);
844 pSettings->desktopWidgetColor = RGB(GetBValue(color), GetGValue(color), GetRValue(color)); // Swap from RGB to BGR format...
845 pDesktop->UpdateDesktopWindow();
846 if (pDock) pDock->UpdateDockWindow(); // (...because the dock inherits the desktop widget color if it's empty.)
847 WriteColor(pSettings->xobrcFile, "xoblite.desktop.widget.color:", pSettings->desktopWidgetColor);
848 return true;
849 }
850 }
851 else if (!_stricmp(token3, "Click"))
852 {
853 if (!_stricmp(token4, "R"))
854 {
855 strcpy(pSettings->desktopRClickOverride, extra);
856 WriteString(pSettings->xobrcFile, "xoblite.desktop.rclick.override:", pSettings->desktopRClickOverride);
857 return true;
858 }
859 else if (!_stricmp(token4, "M"))
860 {
861 strcpy(pSettings->desktopMClickOverride, extra);
862 WriteString(pSettings->xobrcFile, "xoblite.desktop.mclick.override:", pSettings->desktopMClickOverride);
863 return true;
864 }
865 else if (!_stricmp(token4, "X1"))
866 {
867 strcpy(pSettings->desktopX1ClickOverride, extra);
868 WriteString(pSettings->xobrcFile, "xoblite.desktop.x1click.override:", pSettings->desktopX1ClickOverride);
869 return true;
870 }
871 else if (!_stricmp(token4, "X2"))
872 {
873 strcpy(pSettings->desktopX2ClickOverride, extra);
874 WriteString(pSettings->xobrcFile, "xoblite.desktop.x2click.override:", pSettings->desktopX2ClickOverride);
875 return true;
876 }
877 }
878
879 return false;
880 }
881
882 //====================
883
884 else if (!_stricmp(token2, "Hotkey"))
885 {
886 int hotkeyNumber = atoi(&token3[1]) - 1; // Nb. Using more human friendly 1-N numbering for the Hotkey bro@ms! (...though in practise likely only to be used internally within xoblite :))
887
888 if (hotkeyNumber > (int)pHotkeys->hotkeyList.size()) return false;
889 else pHotkeys->ExecuteHotkey(pHotkeys->hotkeyList[hotkeyNumber]->ID);
890
891 return true;
892 }
893
894 //====================
895
896 else if (!_stricmp(token2, "Workspaces"))
897 {
898 if (isdigit(token3[0]))
899 {
900 int ws = atoi(token3);
901 if ((ws < 1) || (ws > pSettings->numberOfWorkspaces))
902 {
903 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)"... Error: The requested workspace does not exist.");
904 return false;
905 }
906
907 PostMessage(GetBBWnd(), BB_WORKSPACE, 4, (ws-1)); // Note: Internally workspaces are referenced 0-m, while externally as 1-n.
908 }
909 else if (!_stricmp(token3, "Next"))
910 {
911 PostMessage(GetBBWnd(), BB_WORKSPACE, 1, 0);
912 }
913 else if (!_stricmp(token3, "Previous"))
914 {
915 PostMessage(GetBBWnd(), BB_WORKSPACE, 0, 0);
916 }
917 else if (!_stricmp(token3, "New"))
918 {
919 PostMessage(GetBBWnd(), BB_WORKSPACE, 2, 0); // -> Add new workspace
920 }
921 else if (!_stricmp(token3, "Remove"))
922 {
923 PostMessage(GetBBWnd(), BB_WORKSPACE, 3, 0); // -> Remove last workspace
924 }
925 else if (!_stricmp(token3, "ToggleMousewheelChanging"))
926 {
927 if (!pSettings->mousewheelChanging) pSettings->mousewheelChanging = true;
928 else pSettings->mousewheelChanging = false;
929 WriteBool(pSettings->xobrcDefaultFile, "xoblite.workspaces.mousewheel.changing:", pSettings->mousewheelChanging);
930 }
931 else if (!_stricmp(token3, "ToggleFollowActive"))
932 {
933 if (!pSettings->followActive) pSettings->followActive = true;
934 else pSettings->followActive = false;
935 WriteBool(pSettings->xobrcDefaultFile, "xoblite.workspaces.followActive:", pSettings->followActive);
936 }
937 else if (!_stricmp(token3, "ToggleWallpaperPerWorkspace"))
938 {
939 if (!pSettings->wallpaperPerWorkspace) pSettings->wallpaperPerWorkspace = true;
940 else pSettings->wallpaperPerWorkspace = false;
941 WriteBool(pSettings->xobrcDefaultFile, "xoblite.workspaces.wallpapers:", pSettings->wallpaperPerWorkspace);
942 }
943 else if (!_stricmp(token3, "GatherWindows"))
944 {
945 if (pWorkspaces) pWorkspaces->GatherWindows();
946 }
947
948 return true;
949 }
950
951 //====================
952
953 else if (!_stricmp(token2, "Plugins"))
954 {
955 if (!_stricmp(token3, "Hide") && !pSettings->pluginsHidden) PostMessage(GetBBWnd(), BB_TOGGLEPLUGINS, 0, 0);
956 else if (!_stricmp(token3, "Show") && pSettings->pluginsHidden) PostMessage(GetBBWnd(), BB_TOGGLEPLUGINS, 0, 0);
957 else if (!_stricmp(token3, "Toggle")) PostMessage(GetBBWnd(), BB_TOGGLEPLUGINS, 0, 0);
958// else if (!_stricmp(token3, "About") && pPluginManager) pPluginManager->AboutPlugins(); // Note: Reverse duplicate of @xoblite About Plugins
959
960 return true;
961 }
962
963 //====================
964
965 else if (!_stricmp(token2, "Global"))
966 {
967/*
968 if (!_stricmp(token3, "FocusNewWindows"))
969 {
970 if (!pSettings->focusNewWindows) pSettings->focusNewWindows = true;
971 else pSettings->focusNewWindows = false;
972 WriteBool(pSettings->xobrcDefaultFile, "session.screen0.focusNewWindows:", pSettings->focusNewWindows);
973 }
974 else if (!_stricmp(token3, "FocusLastWindow"))
975 {
976 if (!pSettings->focusLastWindow) pSettings->focusLastWindow = true;
977 else pSettings->focusLastWindow = false;
978 WriteBool(pSettings->xobrcDefaultFile, "session.screen0.focusLastWindow:", pSettings->focusLastWindow);
979 }
980 else if (!_stricmp(token3, "OpaqueWindowMoving"))
981 {
982 if (!pSettings->opaqueMove) pSettings->opaqueMove = true;
983 else pSettings->opaqueMove = false;
984 SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, pSettings->opaqueMove, NULL, SPIF_SENDCHANGE);
985 WriteBool(pSettings->xobrcDefaultFile, "session.opaqueMove:", pSettings->opaqueMove);
986 }
987 else if (!_stricmp(token3, "FullMaximization"))
988 {
989 if (!pSettings->fullMaximization) pSettings->fullMaximization = true;
990 else pSettings->fullMaximization = false;
991 pToolbar->UpdateDesktopArea();
992 WriteBool(pSettings->xobrcDefaultFile, "session.screen0.fullMaximization:", pSettings->fullMaximization);
993 }
994*/
995 if (!_stricmp(token3, "HiDPI"))
996 {
997 bool savedWriteProtection = pSettings->writeProtection;
998 pSettings->writeProtection = false;
999
1000// if (GetAsyncKeyState(VK_MENU) & 0x8000) pSettings->scalingFactorHiDPI = 2;
1001// else pSettings->scalingFactorHiDPI = atoi(token4);
1002 pSettings->scalingFactorHiDPI = atoi(token4);
1003 if (pSettings->scalingFactorHiDPI < 1) pSettings->scalingFactorHiDPI = 1; // Safeguard
1004 if (pSettings->scalingFactorHiDPI > 4) pSettings->scalingFactorHiDPI = 4; // Safeguard
1005 WriteInt(pSettings->xobrcDefaultFile, "xoblite.hidpi.scaling.factor:", pSettings->scalingFactorHiDPI);
1006
1007 pSettings->writeProtection = savedWriteProtection;
1008
1009 PostMessage(GetBBWnd(), BB_RESTART, 0, 0);
1010
1011 char msg[255];
1012 if (savedWriteProtection) strcpy(msg, "Temporarily bypassing write protection: ");
1013 else strcpy(msg, "");
1014 sprintf(msg, "xoblite HiDPI scaling factor set to %dx. ", pSettings->scalingFactorHiDPI);
1015 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_REGULAR_MESSAGE, (LPARAM)msg);
1016 }
1017 else if (!_stricmp(token3, "ToggleMultiMonitorPlacements"))
1018 {
1019 if (!pSettings->multimonPlacements) pSettings->multimonPlacements = true;
1020 else pSettings->multimonPlacements = false;
1021 WriteBool(pSettings->xobrcDefaultFile, "xoblite.multimonitor.placements:", pSettings->multimonPlacements);
1022
1023 // Update core shell elements + notify plugins that the available screen resolution or desktop work area has changed...
1024 if (pDesktop) pDesktop->UpdateDesktopWindow();
1025 if (pToolbar) pToolbar->UpdatePosition();
1026 if (pConsole) pConsole->UpdatePosition();
1027 if (pDock) pDock->UpdatePosition();
1028 SendMessage(GetBBWnd(), BB_REDRAWGUI, BBRG_DESKTOP, 0);
1029
1031 }
1032 else if (!_stricmp(token3, "ToggleSoundFX"))
1033 {
1034 if (!pSettings->enableSoundFX) pSettings->enableSoundFX = true;
1035 else pSettings->enableSoundFX = false;
1036 WriteBool(pSettings->xobrcDefaultFile, "xoblite.sound.effects:", pSettings->enableSoundFX);
1037 }
1038 else if (!_stricmp(token3, "ToggleDesignerMode"))
1039 {
1040 char xDGUIpath[MAX_PATH];
1041 sprintf(xDGUIpath, "%s\\%s", pSettings->SF_blackboxPath, "xDesignerGUI.dll");
1042 if (!pSettings->designerModeEnabled)
1043 {
1044 pSettings->designerModeEnabled = true;
1045 if (!pPluginManager->IsPluginLoaded("xDesignerGUI.dll")) pPluginManager->LoadPlugin(xDGUIpath);
1046 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"Designer mode enabled.");
1047 }
1048 else
1049 {
1050 pSettings->designerModeEnabled = false;
1051 if (pPluginManager->IsPluginLoaded("xDesignerGUI.dll")) pPluginManager->UnloadPlugin(xDGUIpath, -1);
1052 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"Designer mode disabled.");
1053 }
1054 WriteBool(pSettings->xobrcDefaultFile, "xoblite.designer.mode:", pSettings->designerModeEnabled);
1055 }
1056 else if (!_stricmp(token3, "ToggleRootCommands"))
1057 {
1058 if (!pSettings->disableRootCommands) pSettings->disableRootCommands = true;
1059 else pSettings->disableRootCommands = false;
1060 WriteBool(pSettings->xobrcDefaultFile, "xoblite.disable.rootCommands:", pSettings->disableRootCommands);
1061 }
1062 else if (!_stricmp(token3, "ToggleThemeFonts"))
1063 {
1064 if (!pSettings->disableThemeFonts)
1065 {
1066 pSettings->disableThemeFonts = true;
1068 }
1069 else
1070 {
1071 pSettings->disableThemeFonts = false;
1073 }
1074 WriteBool(pSettings->xobrcDefaultFile, "xoblite.disable.theme.fonts:", pSettings->disableThemeFonts);
1075 }
1076 else if (!_stricmp(token3, "ToggleScriptSupport"))
1077 {
1078 if (!pSettings->disableScriptSupport) pSettings->disableScriptSupport = true;
1079 else pSettings->disableScriptSupport = false;
1080
1081 WriteBool(pSettings->xobrcDefaultFile, "xoblite.disable.script.support:", pSettings->disableScriptSupport);
1082
1083 if (pSettings->disableScriptSupport) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_WARNING_MESSAGE, (LPARAM)"@Script support disabled.");
1084 else SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_WARNING_MESSAGE, (LPARAM)"@Script support enabled.");
1085 }
1086 else if (!_stricmp(token3, "SetEditor"))
1087 {
1088 if (strlen(token4) > 0)
1089 {
1090 if (strlen(extra)) sprintf(pSettings->preferredEditor, "\"%s %s\"", token4, extra);
1091 else sprintf(pSettings->preferredEditor, "\"%s\"", token4);
1092 WriteString(pSettings->xobrcDefaultFile, "xoblite.editor:", pSettings->preferredEditor);
1093 }
1094 }
1095
1096 return true;
1097 }
1098
1099 //====================
1100
1101 else if (!_stricmp(token2, "Window"))
1102 {
1103 if (!pTaskbar) return false;
1104
1105 HWND hwnd = pTaskbar->GetActiveWindow();
1106 if (hwnd == NULL) return false;
1107
1108 if (!_stricmp(token3, "Toggle"))
1109 {
1110 if (!_stricmp(token4, "Sticky"))
1111 {
1112 ToggleSticky(hwnd);
1113 if (pToolbar) pToolbar->UpdatePosition();
1114 }
1115 }
1116 else if (!_stricmp(token3, "Workspace"))
1117 {
1118 if (!_stricmp(token4, "Next") && pWorkspaces) pWorkspaces->MoveWindowToNextWorkspace(hwnd);
1119 else if (!_stricmp(token4, "Previous") && pWorkspaces) pWorkspaces->MoveWindowToPreviousWorkspace(hwnd);
1120 else if ((strlen(token4) > 0))
1121 {
1122 int workspace = atoi(&token4[0]) - 1;
1123 if (pWorkspaces) pWorkspaces->MoveWindowToWorkspace(hwnd, workspace);
1124 }
1125 }
1126 else if (!_stricmp(token3, "Zoom"))
1127 {
1128 if (!IsIconic(hwnd))
1129 {
1130 if (IsZoomed(hwnd)) ShowWindow(hwnd, SW_RESTORE);
1131 else ShowWindow(hwnd, SW_MAXIMIZE);
1132 }
1133 }
1134 else if (!_stricmp(token3, "Shade")) pDesktop->ShadeWindow();
1135 else if (!_stricmp(token3, "Lower")) pDesktop->LowerWindow();
1136 else if (!_stricmp(token3, "Grow"))
1137 {
1138 if (!_stricmp(token4, "Width")) pDesktop->GrowWindowWidth();
1139 else if (!_stricmp(token4, "Height")) pDesktop->GrowWindowHeight();
1140 }
1141 else if (!_stricmp(token3, "Tile"))
1142 {
1143 if (IsInString(token4, "Left"))
1144 {
1145 if (IsInString(token4, "Top")) pTaskbar->TileWindow(PLACEMENT_TOP_LEFT);
1146 else if (IsInString(token4, "Center")) pTaskbar->TileWindow(PLACEMENT_CENTER_LEFT);
1147 else if (IsInString(token4, "Bottom")) pTaskbar->TileWindow(PLACEMENT_BOTTOM_LEFT);
1148 else pTaskbar->TileWindow(PLACEMENT_LEFT_HALF);
1149 }
1150 else if (IsInString(token4, "Right"))
1151 {
1152 if (IsInString(token4, "Top")) pTaskbar->TileWindow(PLACEMENT_TOP_RIGHT);
1153 else if (IsInString(token4, "Center")) pTaskbar->TileWindow(PLACEMENT_CENTER_RIGHT);
1154 else if (IsInString(token4, "Bottom")) pTaskbar->TileWindow(PLACEMENT_BOTTOM_RIGHT);
1155 else pTaskbar->TileWindow(PLACEMENT_RIGHT_HALF);
1156 }
1157 else if (IsInString(token4, "Center"))
1158 {
1159 if (IsInString(token4, "Top")) pTaskbar->TileWindow(PLACEMENT_TOP_CENTER);
1160 else if (IsInString(token4, "Bottom")) pTaskbar->TileWindow(PLACEMENT_BOTTOM_CENTER);
1161 else if (IsInString(token4, "CenterCenter")) pTaskbar->TileWindow(PLACEMENT_CENTER_CENTER);
1162 else pTaskbar->TileWindow(PLACEMENT_CENTERED); // <- "Default" placement centered at 2/3 screen size
1163 }
1164 else if (IsInString(token4, "Top")) pTaskbar->TileWindow(PLACEMENT_TOP_HALF);
1165 else if (IsInString(token4, "Bottom")) pTaskbar->TileWindow(PLACEMENT_BOTTOM_HALF);
1166 else
1167 {
1168 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)"... Error: The requested window tiling position is not supported.");
1169 return false;
1170 }
1171 }
1172 else if (!_stricmp(token3, "Float")) pTaskbar->TileWindow(PLACEMENT_DEFAULT);
1173 else if (!_stricmp(token3, "Quit"))
1174 {
1175 if (IsIconic(hwnd)) ShowWindow(hwnd, SW_RESTORE);
1176 SetForegroundWindow(hwnd);
1177 PostMessage(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
1178 }
1179
1180 return true;
1181 }
1182
1183 //====================
1184
1185 else if (!_stricmp(token2, "ToggleWriteProtection"))
1186 {
1187 if (!pSettings->writeProtection)
1188 {
1189 // Note: Since write protection blocks writes to config files, we need to save
1190 // the new "true" value to file *before* we actually enable write protection...
1191 WriteBool(pSettings->xobrcFile, "xoblite.write.protection:", true);
1192 pSettings->writeProtection = true;
1193 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_WARNING_MESSAGE, (LPARAM)"Write protection enabled.");
1194 }
1195 else
1196 {
1197 // Note: Since write protection blocks writes to config files, we need to
1198 // disable write protection *before* we save the new "false" value to file...
1199 pSettings->writeProtection = false;
1200 WriteBool(pSettings->xobrcFile, "xoblite.write.protection:", false);
1201 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_WARNING_MESSAGE, (LPARAM)"Write protection disabled.");
1202 }
1203
1204 return true;
1205 }
1206
1207 //====================
1208
1209 else if (!_stricmp(token2, "Edit"))
1210 {
1211 char cmdPlusArgs[MAX_LINE_LENGTH];
1212
1213 if (!_stricmp(token3, "Style")) // -> Edit the *currently* selected style! (nb. since this can change dynamically over time, the path can not be stored statically in e.g. a hotkey)
1214 {
1215 sprintf(cmdPlusArgs, "%s %s", pSettings->preferredEditor, pSettings->styleFile);
1216 }
1217 else if (!_stricmp(token3, "Configuration")) // -> Edit the *currently* selected theme's xoblite.rc! (...)
1218 {
1219 sprintf(cmdPlusArgs, "%s %s", pSettings->preferredEditor, pSettings->xobrcFile);
1220 }
1221 else if (!_stricmp(token3, "Menu")) // -> Edit the globally defined menu.rc!
1222 {
1223 sprintf(cmdPlusArgs, "%s %s", pSettings->preferredEditor, pSettings->menuFile);
1224 }
1225 else if (!_stricmp(token3, "Hotkeys")) // -> Edit the globally defined hotkeys.rc!
1226 {
1227 sprintf(cmdPlusArgs, "%s %s", pSettings->preferredEditor, pSettings->hotkeysFile);
1228 }
1229 else if (!_stricmp(token3, "Plugins")) // -> Edit the *currently* selected theme's plugins.rc!
1230 {
1231 sprintf(cmdPlusArgs, "%s %s", pSettings->preferredEditor, pSettings->pluginsFile);
1232 }
1233 else // -> Edit any other file!
1234 {
1235 if (strchr(token3, '$')) ReplaceShellFolders(token3);
1236 if (strchr(token3, '%')) ReplaceEnvVars(token3);
1237
1238 // As the plain tokenizing above may have misinterpreted spaces in the supplied argument(s), let's merge applicable tokens again...
1239 sprintf(cmdPlusArgs, "%s %s %s %s", pSettings->preferredEditor, token3, token4, extra);
1240 }
1241
1242 BBSmartExecute(cmdPlusArgs);
1243
1244 return true;
1245 }
1246
1247 //====================
1248
1249 else if (!_stricmp(token2, "Set"))
1250 {
1251 if (!_stricmp(token3, "Style"))
1252 {
1253 if (strlen(token4)) PostMessage(GetBBWnd(), BB_SETSTYLE, 0, (LPARAM)token4);
1254 return true;
1255 }
1256 else if (!_stricmp(token3, "Theme"))
1257 {
1258 if (strlen(token4)) PostMessage(GetBBWnd(), BB_SETTHEME, 0, (LPARAM)token4);
1259 return true;
1260 }
1261 }
1262/*
1263 else if (!_stricmp(token2, "SetStyle")) // Legacy syntax
1264 {
1265 if (strlen(token3)) PostMessage(GetBBWnd(), BB_SETSTYLE, 0, (LPARAM)token3);
1266 return true;
1267 }
1268 else if (!_stricmp(token2, "SetTheme")) // Legacy syntax
1269 {
1270 if (strlen(token3)) PostMessage(GetBBWnd(), BB_SETTHEME, 0, (LPARAM)token3);
1271 return true;
1272 }
1273*/
1274
1275 //====================
1276
1277 else if (!_stricmp(token2, "Random"))
1278 {
1279 int type;
1280 if (!_stricmp(token3, "Style")) type = BROAM_RANDOM_STYLE;
1281 else if (!_stricmp(token3, "Wallpaper")) type = BROAM_RANDOM_WALLPAPER;
1282 else return false;
1283
1284 if (strlen(token4)) // Was a path specified? (i.e. 4th argument -> @xoblite Random <Style/Wallpaper> <path> )
1285 {
1286 strcpy(pathToScan, token4);
1287 if (strchr(pathToScan, '\"')) StrRemoveEncap(pathToScan);
1288 if (strchr(pathToScan, '$')) ReplaceShellFolders(pathToScan);
1289 if (strchr(pathToScan, '%')) ReplaceEnvVars(pathToScan);
1290 }
1291 else // If not, use the styles/wallpaper folder defined in xoblite.rc as default path...
1292 {
1293 if (type == BROAM_RANDOM_STYLE) strcpy(pathToScan, pSettings->stylesFolder);
1294 else strcpy(pathToScan, pSettings->wallpapersFolder);
1295 }
1296
1298 FindRandomFile(pathToScan, type, false); // Count the number of files...
1299
1300 if (numberOfFiles == 0)
1301 {
1302 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_ERROR_MESSAGE, (LPARAM)"@xoblite Random -> No applicable files found at the specified path!");
1303 return false;
1304 }
1305
1306 randomFile = (rand() % numberOfFiles) + 1; // Select a random file... (note: srand() seeding is done in Blackbox.cpp during startup)
1307 FindRandomFile(pathToScan, type, true); // Apply the selected style/wallpaper...
1308
1309 return true;
1310 }
1311
1312 //====================
1313
1314 else if (!_stricmp(token2, "Designer"))
1315 {
1316 if (!pSettings->designerModeEnabled)
1317 {
1318 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.");
1319 return false;
1320 }
1321
1322 char feedback[64];
1323 feedback[0] = '\0';
1324
1325 if (!_stricmp(token3, "Select"))
1326 {
1327 if (!_strnicmp(token4, "Toolbar", 7))
1328 {
1329 if (!_stricmp(token4, "Toolbar")) pSettings->selectedElement = pSettings->Toolbar;
1330 else if (!_stricmp(token4, "ToolbarLabel")) pSettings->selectedElement = pSettings->ToolbarLabel;
1331 else if (!_stricmp(token4, "ToolbarWindowLabel")) pSettings->selectedElement = pSettings->ToolbarWindowLabel;
1332 else if (!_stricmp(token4, "ToolbarClock")) pSettings->selectedElement = pSettings->ToolbarClock;
1333 else if (!_stricmp(token4, "ToolbarButton")) pSettings->selectedElement = pSettings->ToolbarButton;
1334 else if (!_stricmp(token4, "ToolbarButtonPressed")) pSettings->selectedElement = pSettings->ToolbarButtonPressed;
1335 else if (!_stricmp(token4, "ToolbarBorder")) pSettings->selectedElement = pSettings->ToolbarBorder;
1336 }
1337 else if (!_strnicmp(token4, "Menu", 4))
1338 {
1339 if (!_stricmp(token4, "MenuTitle")) pSettings->selectedElement = pSettings->MenuTitle;
1340 else if (!_stricmp(token4, "MenuFrame")) pSettings->selectedElement = pSettings->MenuFrame;
1341 else if (!_stricmp(token4, "MenuActive")) pSettings->selectedElement = pSettings->MenuActive;
1342 else if (!_stricmp(token4, "MenuGrip")) pSettings->selectedElement = pSettings->MenuGrip;
1343 else if (!_stricmp(token4, "MenuIndicator")) pSettings->selectedElement = pSettings->MenuIndicator;
1344 else if (!_stricmp(token4, "MenuSeparator")) pSettings->selectedElement = pSettings->MenuSeparator;
1345 else if (!_stricmp(token4, "MenuFrameBorder")) pSettings->selectedElement = pSettings->MenuFrameBorder;
1346 }
1347 else if (!_stricmp(token4, "Dock")) pSettings->selectedElement = pSettings->Dock;
1348 else if (!_stricmp(token4, "DockBorder")) pSettings->selectedElement = pSettings->DockBorder;
1349 else if (!_stricmp(token4, "Console")) pSettings->selectedElement = pSettings->Console;
1350 else if (!_strnicmp(token4, "Window", 6))
1351 {
1352 if (!_strnicmp(&token4[6], "Title", 5))
1353 {
1354 if (!_stricmp(token4, "WindowTitleFocus")) pSettings->selectedElement = pSettings->WindowTitleFocus;
1355 else if (!_stricmp(token4, "WindowTitleUnfocus")) pSettings->selectedElement = pSettings->WindowTitleUnfocus;
1356 }
1357 else if (!_strnicmp(&token4[6], "Label", 5))
1358 {
1359 if (!_stricmp(token4, "WindowLabelFocus")) pSettings->selectedElement = pSettings->WindowLabelFocus;
1360 else if (!_stricmp(token4, "WindowLabelUnfocus")) pSettings->selectedElement = pSettings->WindowLabelUnfocus;
1361 }
1362 else if (!_strnicmp(&token4[6], "Button", 6))
1363 {
1364 if (!_stricmp(token4, "WindowButtonFocus")) pSettings->selectedElement = pSettings->WindowButtonFocus;
1365 else if (!_stricmp(token4, "WindowButtonUnfocus")) pSettings->selectedElement = pSettings->WindowButtonUnfocus;
1366 else if (!_stricmp(token4, "WindowButtonPressed")) pSettings->selectedElement = pSettings->WindowButtonPressed;
1367 }
1368 else if (!_strnicmp(&token4[6], "Grip", 4))
1369 {
1370 if (!_stricmp(token4, "WindowGripFocus")) pSettings->selectedElement = pSettings->WindowGripFocus;
1371 else if (!_stricmp(token4, "WindowGripUnfocus")) pSettings->selectedElement = pSettings->WindowGripUnfocus;
1372 }
1373 else if (!_strnicmp(&token4[6], "Handle", 6))
1374 {
1375 if (!_stricmp(token4, "WindowHandleFocus")) pSettings->selectedElement = pSettings->WindowHandleFocus;
1376 else if (!_stricmp(token4, "WindowHandleUnfocus")) pSettings->selectedElement = pSettings->WindowHandleUnfocus;
1377 }
1378 }
1379 else if (!_strnicmp(token4, "Hardware", 8)) pSettings->selectedElement = pSettings->ExternalHardware;
1380
1381 else if (!_stricmp(token4, "Next") || !_stricmp(token4, "Previous") || strlen(token4) == 0)
1382 {
1383 if (!_stricmp(token4, "Previous"))
1384 {
1385 if (pSettings->selectedElement == pSettings->Toolbar) pSettings->selectedElement = pSettings->ExternalHardware;
1386 else if (pSettings->selectedElement == pSettings->ToolbarBorder) pSettings->selectedElement = pSettings->Toolbar;
1387 else if (pSettings->selectedElement == pSettings->ToolbarLabel) pSettings->selectedElement = pSettings->ToolbarBorder;
1388 else if (pSettings->selectedElement == pSettings->ToolbarWindowLabel) pSettings->selectedElement = pSettings->ToolbarLabel;
1389 else if (pSettings->selectedElement == pSettings->ToolbarClock) pSettings->selectedElement = pSettings->ToolbarWindowLabel;
1390 else if (pSettings->selectedElement == pSettings->ToolbarButton) pSettings->selectedElement = pSettings->ToolbarClock;
1391 else if (pSettings->selectedElement == pSettings->ToolbarButtonPressed) pSettings->selectedElement = pSettings->ToolbarButton;
1392 else if (pSettings->selectedElement == pSettings->MenuTitle) pSettings->selectedElement = pSettings->ToolbarButtonPressed;
1393 else if (pSettings->selectedElement == pSettings->MenuFrame) pSettings->selectedElement = pSettings->MenuTitle;
1394 else if (pSettings->selectedElement == pSettings->MenuFrameBorder) pSettings->selectedElement = pSettings->MenuFrame;
1395 else if (pSettings->selectedElement == pSettings->MenuActive) pSettings->selectedElement = pSettings->MenuFrameBorder;
1396 else if (pSettings->selectedElement == pSettings->MenuGrip) pSettings->selectedElement = pSettings->MenuActive;
1397 else if (pSettings->selectedElement == pSettings->MenuIndicator) pSettings->selectedElement = pSettings->MenuGrip;
1398 else if (pSettings->selectedElement == pSettings->MenuSeparator) pSettings->selectedElement = pSettings->MenuIndicator;
1399 else if (pSettings->selectedElement == pSettings->Dock) pSettings->selectedElement = pSettings->MenuSeparator;
1400 else if (pSettings->selectedElement == pSettings->DockBorder) pSettings->selectedElement = pSettings->Dock;
1401 else if (pSettings->selectedElement == pSettings->Console) pSettings->selectedElement = pSettings->DockBorder;
1402
1403 else if (pSettings->selectedElement == pSettings->WindowTitleFocus) pSettings->selectedElement = pSettings->Console;
1404 else if (pSettings->selectedElement == pSettings->WindowLabelFocus) pSettings->selectedElement = pSettings->WindowTitleFocus;
1405 else if (pSettings->selectedElement == pSettings->WindowButtonFocus) pSettings->selectedElement = pSettings->WindowLabelFocus;
1406 else if (pSettings->selectedElement == pSettings->WindowGripFocus) pSettings->selectedElement = pSettings->WindowButtonFocus;
1407 else if (pSettings->selectedElement == pSettings->WindowHandleFocus) pSettings->selectedElement = pSettings->WindowGripFocus;
1408 else if (pSettings->selectedElement == pSettings->WindowButtonPressed) pSettings->selectedElement = pSettings->WindowHandleFocus;
1409 else if (pSettings->selectedElement == pSettings->WindowTitleUnfocus) pSettings->selectedElement = pSettings->WindowButtonPressed;
1410 else if (pSettings->selectedElement == pSettings->WindowLabelUnfocus) pSettings->selectedElement = pSettings->WindowTitleUnfocus;
1411 else if (pSettings->selectedElement == pSettings->WindowButtonUnfocus) pSettings->selectedElement = pSettings->WindowLabelUnfocus;
1412 else if (pSettings->selectedElement == pSettings->WindowGripUnfocus) pSettings->selectedElement = pSettings->WindowButtonUnfocus;
1413 else if (pSettings->selectedElement == pSettings->WindowHandleUnfocus) pSettings->selectedElement = pSettings->WindowGripUnfocus;
1414 else if (pSettings->selectedElement == pSettings->ExternalHardware) pSettings->selectedElement = pSettings->WindowHandleUnfocus;
1415 }
1416 else // if (!_stricmp(token4, "Next") || strlen(token4) == 0)
1417 {
1418 if (pSettings->selectedElement == pSettings->Toolbar) pSettings->selectedElement = pSettings->ToolbarBorder;
1419 else if (pSettings->selectedElement == pSettings->ToolbarBorder) pSettings->selectedElement = pSettings->ToolbarLabel;
1420 else if (pSettings->selectedElement == pSettings->ToolbarLabel) pSettings->selectedElement = pSettings->ToolbarWindowLabel;
1421 else if (pSettings->selectedElement == pSettings->ToolbarWindowLabel) pSettings->selectedElement = pSettings->ToolbarClock;
1422 else if (pSettings->selectedElement == pSettings->ToolbarClock) pSettings->selectedElement = pSettings->ToolbarButton;
1423 else if (pSettings->selectedElement == pSettings->ToolbarButton) pSettings->selectedElement = pSettings->ToolbarButtonPressed;
1424 else if (pSettings->selectedElement == pSettings->ToolbarButtonPressed) pSettings->selectedElement = pSettings->MenuTitle;
1425 else if (pSettings->selectedElement == pSettings->MenuTitle) pSettings->selectedElement = pSettings->MenuFrame;
1426 else if (pSettings->selectedElement == pSettings->MenuFrame) pSettings->selectedElement = pSettings->MenuFrameBorder;
1427 else if (pSettings->selectedElement == pSettings->MenuFrameBorder) pSettings->selectedElement = pSettings->MenuActive;
1428 else if (pSettings->selectedElement == pSettings->MenuActive) pSettings->selectedElement = pSettings->MenuGrip;
1429 else if (pSettings->selectedElement == pSettings->MenuGrip) pSettings->selectedElement = pSettings->MenuIndicator;
1430 else if (pSettings->selectedElement == pSettings->MenuIndicator) pSettings->selectedElement = pSettings->MenuSeparator;
1431 else if (pSettings->selectedElement == pSettings->MenuSeparator) pSettings->selectedElement = pSettings->Dock;
1432 else if (pSettings->selectedElement == pSettings->Dock) pSettings->selectedElement = pSettings->DockBorder;
1433 else if (pSettings->selectedElement == pSettings->DockBorder) pSettings->selectedElement = pSettings->Console;
1434 else if (pSettings->selectedElement == pSettings->Console) pSettings->selectedElement = pSettings->WindowTitleFocus;
1435
1436 else if (pSettings->selectedElement == pSettings->WindowTitleFocus) pSettings->selectedElement = pSettings->WindowLabelFocus;
1437 else if (pSettings->selectedElement == pSettings->WindowLabelFocus) pSettings->selectedElement = pSettings->WindowButtonFocus;
1438 else if (pSettings->selectedElement == pSettings->WindowButtonFocus) pSettings->selectedElement = pSettings->WindowGripFocus;
1439 else if (pSettings->selectedElement == pSettings->WindowGripFocus) pSettings->selectedElement = pSettings->WindowHandleFocus;
1440 else if (pSettings->selectedElement == pSettings->WindowHandleFocus) pSettings->selectedElement = pSettings->WindowButtonPressed;
1441 else if (pSettings->selectedElement == pSettings->WindowButtonPressed) pSettings->selectedElement = pSettings->WindowTitleUnfocus;
1442 else if (pSettings->selectedElement == pSettings->WindowTitleUnfocus) pSettings->selectedElement = pSettings->WindowLabelUnfocus;
1443 else if (pSettings->selectedElement == pSettings->WindowLabelUnfocus) pSettings->selectedElement = pSettings->WindowButtonUnfocus;
1444 else if (pSettings->selectedElement == pSettings->WindowButtonUnfocus) pSettings->selectedElement = pSettings->WindowGripUnfocus;
1445 else if (pSettings->selectedElement == pSettings->WindowGripUnfocus) pSettings->selectedElement = pSettings->WindowHandleUnfocus;
1446 else if (pSettings->selectedElement == pSettings->WindowHandleUnfocus) pSettings->selectedElement = pSettings->ExternalHardware;
1447 else if (pSettings->selectedElement == pSettings->ExternalHardware) pSettings->selectedElement = pSettings->Toolbar;
1448 }
1449 }
1450
1451 if (pSettings->selectedElement == pSettings->Toolbar) strcpy(feedback, "... Toolbar");
1452 else if (pSettings->selectedElement == pSettings->ToolbarLabel) strcpy(feedback, "... Toolbar Label");
1453 else if (pSettings->selectedElement == pSettings->ToolbarWindowLabel) strcpy(feedback, "... Toolbar WindowLabel");
1454 else if (pSettings->selectedElement == pSettings->ToolbarClock) strcpy(feedback, "... Toolbar Clock");
1455 else if (pSettings->selectedElement == pSettings->ToolbarButton) strcpy(feedback, "... Toolbar Button");
1456 else if (pSettings->selectedElement == pSettings->ToolbarButtonPressed) strcpy(feedback, "... Toolbar Button Pressed");
1457 else if (pSettings->selectedElement == pSettings->ToolbarBorder) strcpy(feedback, "... Toolbar Border");
1458 else if (pSettings->selectedElement == pSettings->MenuTitle) strcpy(feedback, "... Menu Title");
1459 else if (pSettings->selectedElement == pSettings->MenuFrame) strcpy(feedback, "... Menu Frame");
1460 else if (pSettings->selectedElement == pSettings->MenuFrameBorder) strcpy(feedback, "... Menu Frame Border");
1461 else if (pSettings->selectedElement == pSettings->MenuActive) strcpy(feedback, "... Menu Active");
1462 else if (pSettings->selectedElement == pSettings->MenuGrip) strcpy(feedback, "... Menu Grip");
1463 else if (pSettings->selectedElement == pSettings->MenuIndicator) strcpy(feedback, "... Menu Indicator");
1464 else if (pSettings->selectedElement == pSettings->MenuSeparator) strcpy(feedback, "... Menu Separator");
1465 else if (pSettings->selectedElement == pSettings->Dock) strcpy(feedback, "... Dock");
1466 else if (pSettings->selectedElement == pSettings->DockBorder) strcpy(feedback, "... Dock Border");
1467 else if (pSettings->selectedElement == pSettings->Console) strcpy(feedback, "... Console");
1468
1469 else if (pSettings->selectedElement == pSettings->WindowTitleFocus) strcpy(feedback, "... Window Title Focus");
1470 else if (pSettings->selectedElement == pSettings->WindowTitleUnfocus) strcpy(feedback, "... Window Title Unfocus");
1471 else if (pSettings->selectedElement == pSettings->WindowLabelFocus) strcpy(feedback, "... Window Label Focus");
1472 else if (pSettings->selectedElement == pSettings->WindowLabelUnfocus) strcpy(feedback, "... Window Label Unfocus");
1473 else if (pSettings->selectedElement == pSettings->WindowButtonFocus) strcpy(feedback, "... Window Button Focus");
1474 else if (pSettings->selectedElement == pSettings->WindowButtonUnfocus) strcpy(feedback, "... Window Button Unfocus");
1475 else if (pSettings->selectedElement == pSettings->WindowButtonPressed) strcpy(feedback, "... Window Button Pressed");
1476 else if (pSettings->selectedElement == pSettings->WindowGripFocus) strcpy(feedback, "... Window Grip Focus");
1477 else if (pSettings->selectedElement == pSettings->WindowGripUnfocus) strcpy(feedback, "... Window Grip Unfocus");
1478 else if (pSettings->selectedElement == pSettings->WindowHandleFocus) strcpy(feedback, "... Window Handle Focus");
1479 else if (pSettings->selectedElement == pSettings->WindowHandleUnfocus) strcpy(feedback, "... Window Handle Unfocus");
1480 else if (pSettings->selectedElement == pSettings->ExternalHardware) strcpy(feedback, "... Hardware");
1481
1482 if (strlen(feedback) > 0)
1483 {
1484 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
1485
1486 char broam[MAX_LINE_LENGTH];
1487 sprintf(broam, "@xDesigner Feedback %s", feedback);
1488 SendMessage(GetBBWnd(), BB_BROADCAST, 0, (LPARAM)broam);
1489 }
1490
1491 return true;
1492 }
1493
1494 //====================
1495
1496 else if (!_stricmp(token3, "Modify"))
1497 {
1498 if (!_stricmp(token4, "Appearance"))
1499 {
1500 if (!_stricmp(extra, "Previous"))
1501 {
1502 // Switch to the previous appearance type for the currently selected element...
1503 if (pSettings->selectedElement == pSettings->MenuSeparator)
1504 {
1505 switch (pSettings->selectedElement->type)
1506 {
1507 case B_SOLID: { pSettings->selectedElement->type = B_SUPERHORIZONTAL; break; }
1508 case B_HORIZONTAL: { pSettings->selectedElement->type = B_SOLID; break; }
1509 case B_MIRRORHORIZONTAL: { pSettings->selectedElement->type = B_HORIZONTAL; break; }
1510 case B_SPLITHORIZONTAL: { pSettings->selectedElement->type = B_MIRRORHORIZONTAL; break; }
1511 case B_SUPERHORIZONTAL: { pSettings->selectedElement->type = B_SPLITHORIZONTAL; break; }
1512 default: { pSettings->selectedElement->type = B_SOLID; break; }
1513 }
1514 }
1515 else if (pSettings->selectedElement == pSettings->ToolbarBorder ||
1516 pSettings->selectedElement == pSettings->MenuFrameBorder ||
1517 pSettings->selectedElement == pSettings->DockBorder)
1518 {
1519 switch (pSettings->selectedElement->type)
1520 {
1521 case B_PARENTRELATIVE: { pSettings->selectedElement->type = B_SUPERVERTICAL; break; }
1522 case B_HORIZONTAL: { pSettings->selectedElement->type = B_PARENTRELATIVE; break; }
1523 case B_VERTICAL: { pSettings->selectedElement->type = B_HORIZONTAL; break; }
1524 case B_MIRRORHORIZONTAL: { pSettings->selectedElement->type = B_VERTICAL; break; }
1525 case B_MIRRORVERTICAL: { pSettings->selectedElement->type = B_MIRRORHORIZONTAL; break; }
1526 case B_SPLITHORIZONTAL: { pSettings->selectedElement->type = B_MIRRORVERTICAL; break; }
1527 case B_SPLITVERTICAL: { pSettings->selectedElement->type = B_SPLITHORIZONTAL; break; }
1528 case B_SUPERHORIZONTAL: { pSettings->selectedElement->type = B_SPLITVERTICAL; break; }
1529 case B_SUPERVERTICAL: { pSettings->selectedElement->type = B_SUPERHORIZONTAL; break; }
1530 default: { pSettings->selectedElement->type = B_PARENTRELATIVE; break; }
1531 }
1532 }
1533 else switch (pSettings->selectedElement->type)
1534 {
1535 case B_PARENTRELATIVE: { pSettings->selectedElement->type = B_SUPERVERTICAL; break; }
1536 case B_SOLID: { pSettings->selectedElement->type = B_PARENTRELATIVE; break; }
1537 case B_HORIZONTAL: { pSettings->selectedElement->type = B_SOLID; break; }
1538 case B_VERTICAL: { pSettings->selectedElement->type = B_HORIZONTAL; break; }
1539 case B_DIAGONAL: { pSettings->selectedElement->type = B_VERTICAL; break; }
1540 case B_CROSSDIAGONAL: { pSettings->selectedElement->type = B_DIAGONAL; break; }
1541 case B_PIPECROSS: { pSettings->selectedElement->type = B_CROSSDIAGONAL; break; }
1542 case B_ELLIPTIC: { pSettings->selectedElement->type = B_PIPECROSS; break; }
1543 case B_RECTANGLE: { pSettings->selectedElement->type = B_ELLIPTIC; break; }
1544 case B_PYRAMID: { pSettings->selectedElement->type = B_RECTANGLE; break; }
1545 case B_MIRRORHORIZONTAL: { pSettings->selectedElement->type = B_PYRAMID; break; }
1546 case B_MIRRORVERTICAL: { pSettings->selectedElement->type = B_MIRRORHORIZONTAL; break; }
1547 case B_SPLITSOLID: { pSettings->selectedElement->type = B_MIRRORVERTICAL; break; }
1548 case B_SPLITHORIZONTAL: { pSettings->selectedElement->type = B_SPLITSOLID; break; }
1549 case B_SPLITVERTICAL: { pSettings->selectedElement->type = B_SPLITHORIZONTAL; break; }
1550 case B_SUPERHORIZONTAL: { pSettings->selectedElement->type = B_SPLITVERTICAL; break; }
1551 case B_SUPERVERTICAL: { pSettings->selectedElement->type = B_SUPERHORIZONTAL; break; }
1552 default: { pSettings->selectedElement->type = B_PARENTRELATIVE; break; }
1553 }
1554 }
1555 else // if (!_stricmp(extra, "Next") || strlen(token4) == 0)
1556 {
1557 // Switch to the next appearance type for the currently selected element...
1558 if (pSettings->selectedElement == pSettings->MenuSeparator)
1559 {
1560 switch (pSettings->selectedElement->type)
1561 {
1562 case B_SOLID: { pSettings->selectedElement->type = B_HORIZONTAL; break; }
1563 case B_HORIZONTAL: { pSettings->selectedElement->type = B_MIRRORHORIZONTAL; break; }
1564 case B_MIRRORHORIZONTAL: { pSettings->selectedElement->type = B_SPLITHORIZONTAL; break; }
1565 case B_SPLITHORIZONTAL: { pSettings->selectedElement->type = B_SUPERHORIZONTAL; break; }
1566 case B_SUPERHORIZONTAL: { pSettings->selectedElement->type = B_SOLID; break; }
1567 default: { pSettings->selectedElement->type = B_SOLID; break; }
1568 }
1569 }
1570 else if (pSettings->selectedElement == pSettings->ToolbarBorder ||
1571 pSettings->selectedElement == pSettings->MenuFrameBorder ||
1572 pSettings->selectedElement == pSettings->DockBorder)
1573 {
1574 switch (pSettings->selectedElement->type)
1575 {
1576 case B_PARENTRELATIVE: { pSettings->selectedElement->type = B_HORIZONTAL; break; }
1577 case B_HORIZONTAL: { pSettings->selectedElement->type = B_VERTICAL; break; }
1578 case B_VERTICAL: { pSettings->selectedElement->type = B_MIRRORHORIZONTAL; break; }
1579 case B_MIRRORHORIZONTAL: { pSettings->selectedElement->type = B_MIRRORVERTICAL; break; }
1580 case B_MIRRORVERTICAL: { pSettings->selectedElement->type = B_SPLITHORIZONTAL; break; }
1581 case B_SPLITHORIZONTAL: { pSettings->selectedElement->type = B_SPLITVERTICAL; break; }
1582 case B_SPLITVERTICAL: { pSettings->selectedElement->type = B_SUPERHORIZONTAL; break; }
1583 case B_SUPERHORIZONTAL: { pSettings->selectedElement->type = B_SUPERVERTICAL; break; }
1584 case B_SUPERVERTICAL: { pSettings->selectedElement->type = B_PARENTRELATIVE; break; }
1585 default: { pSettings->selectedElement->type = B_PARENTRELATIVE; break; }
1586 }
1587 }
1588 else switch (pSettings->selectedElement->type)
1589 {
1590 case B_PARENTRELATIVE: { pSettings->selectedElement->type = B_SOLID; break; }
1591 case B_SOLID: { pSettings->selectedElement->type = B_HORIZONTAL; break; }
1592 case B_HORIZONTAL: { pSettings->selectedElement->type = B_VERTICAL; break; }
1593 case B_VERTICAL: { pSettings->selectedElement->type = B_DIAGONAL; break; }
1594 case B_DIAGONAL: { pSettings->selectedElement->type = B_CROSSDIAGONAL; break; }
1595 case B_CROSSDIAGONAL: { pSettings->selectedElement->type = B_PIPECROSS; break; }
1596 case B_PIPECROSS: { pSettings->selectedElement->type = B_ELLIPTIC; break; }
1597 case B_ELLIPTIC: { pSettings->selectedElement->type = B_RECTANGLE; break; }
1598 case B_RECTANGLE: { pSettings->selectedElement->type = B_PYRAMID; break; }
1599 case B_PYRAMID: { pSettings->selectedElement->type = B_MIRRORHORIZONTAL; break; }
1600 case B_MIRRORHORIZONTAL: { pSettings->selectedElement->type = B_MIRRORVERTICAL; break; }
1601 case B_MIRRORVERTICAL: { pSettings->selectedElement->type = B_SPLITSOLID; break; }
1602 case B_SPLITSOLID: { pSettings->selectedElement->type = B_SPLITHORIZONTAL; break; }
1603 case B_SPLITHORIZONTAL: { pSettings->selectedElement->type = B_SPLITVERTICAL; break; }
1604 case B_SPLITVERTICAL: { pSettings->selectedElement->type = B_SUPERHORIZONTAL; break; }
1605 case B_SUPERHORIZONTAL: { pSettings->selectedElement->type = B_SUPERVERTICAL; break; }
1606 case B_SUPERVERTICAL: { pSettings->selectedElement->type = B_PARENTRELATIVE; break; }
1607 default: { pSettings->selectedElement->type = B_PARENTRELATIVE; break; }
1608 }
1609 }
1610
1611 if (pSettings->selectedElement->type == B_PARENTRELATIVE) pSettings->selectedElement->parentRelative = true;
1612 else pSettings->selectedElement->parentRelative = false;
1613
1614 switch (pSettings->selectedElement->type)
1615 {
1616 case B_PARENTRELATIVE: { strcpy(feedback, "... ParentRelative"); break; }
1617 case B_SOLID: { strcpy(feedback, "... Solid (1 color)"); break; }
1618 case B_HORIZONTAL: { strcpy(feedback, "... Horizontal (2 colors)"); break; }
1619 case B_VERTICAL: { strcpy(feedback, "... Vertical (2 colors)"); break; }
1620 case B_DIAGONAL: { strcpy(feedback, "... Diagonal (2 colors)"); break; }
1621 case B_CROSSDIAGONAL: { strcpy(feedback, "... CrossDiagonal (2 colors)"); break; }
1622 case B_PIPECROSS: { strcpy(feedback, "... Pipecross (2 colors)"); break; }
1623 case B_ELLIPTIC: { strcpy(feedback, "... Elliptic (2 colors)"); break; }
1624 case B_RECTANGLE: { strcpy(feedback, "... Rectangle (2 colors)"); break; }
1625 case B_PYRAMID: { strcpy(feedback, "... Pyramid (2 colors)"); break; }
1626 case B_MIRRORHORIZONTAL: { strcpy(feedback, "... MirrorHorizontal (2 colors)"); break; }
1627 case B_MIRRORVERTICAL: { strcpy(feedback, "... MirrorVertical (2 colors)"); break; }
1628 case B_SPLITSOLID: { strcpy(feedback, "... SplitSolid (2 colors)"); break; }
1629 case B_SPLITHORIZONTAL: { strcpy(feedback, "... SplitHorizontal (4 colors)"); break; }
1630 case B_SPLITVERTICAL: { strcpy(feedback, "... SplitVertical (4 colors)"); break; }
1631 case B_SUPERHORIZONTAL: { strcpy(feedback, "... SuperHorizontal (8 colors)"); break; }
1632 case B_SUPERVERTICAL: { strcpy(feedback, "... SuperVertical (8 colors)"); break; }
1633 default: { strcpy(feedback, "... Error: Unsupported appearance!"); break; }
1634 }
1635
1636 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
1637 }
1638
1639 //====================
1640
1641 else if (!_stricmp(token4, "Bevel"))
1642 {
1643 // Switch to the next bevel type/position for the currently selected element...
1644 if ((pSettings->selectedElement != pSettings->MenuSeparator) && (pSettings->selectedElement != pSettings->ToolbarBorder) &&
1645 (pSettings->selectedElement != pSettings->MenuFrameBorder) && (pSettings->selectedElement != pSettings->DockBorder) &&
1646 (pSettings->selectedElement != pSettings->ExternalHardware))
1647 {
1648 if (pSettings->selectedElement->bevelstyle == BEVEL_FLAT)
1649 {
1650 pSettings->selectedElement->bevelstyle = BEVEL_RAISED;
1651 pSettings->selectedElement->bevelposition = BEVEL1;
1652 strcpy(feedback, "... Raised Bevel1");
1653 }
1654 else if (pSettings->selectedElement->bevelstyle == BEVEL_RAISED)
1655 {
1656 if (pSettings->selectedElement->bevelposition == BEVEL1)
1657 {
1658 pSettings->selectedElement->bevelposition = BEVEL2;
1659 strcpy(feedback, "... Raised Bevel2");
1660 }
1661 else
1662 {
1663 pSettings->selectedElement->bevelstyle = BEVEL_SUNKEN;
1664 pSettings->selectedElement->bevelposition = BEVEL1;
1665 strcpy(feedback, "... Sunken Bevel1");
1666 }
1667 }
1668 else if (pSettings->selectedElement->bevelstyle == BEVEL_SUNKEN)
1669 {
1670 if (pSettings->selectedElement->bevelposition == BEVEL1)
1671 {
1672 pSettings->selectedElement->bevelposition = BEVEL2;
1673 strcpy(feedback, "... Sunken Bevel2");
1674 }
1675 else
1676 {
1677 pSettings->selectedElement->bevelstyle = BEVEL_FLAT;
1678 pSettings->selectedElement->bevelposition = BEVEL1; // ...just in case later on? (most prefer B1 over B2 after all ;))
1679 strcpy(feedback, "... Flat");
1680 }
1681 }
1682
1683 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
1684 }
1685 else
1686 {
1687 pSettings->selectedElement->bevelstyle = BEVEL_FLAT;
1688 strcpy(feedback, "--- Not available ---");
1689 }
1690 }
1691
1692 //====================
1693
1694 else if (!_stricmp(token4, "Interlaced"))
1695 {
1696 if ((pSettings->selectedElement != pSettings->MenuSeparator) && (pSettings->selectedElement != pSettings->ToolbarBorder) &&
1697 (pSettings->selectedElement != pSettings->MenuFrameBorder) && (pSettings->selectedElement != pSettings->DockBorder) &&
1698 (pSettings->selectedElement != pSettings->ExternalHardware))
1699 {
1700 if (!pSettings->selectedElement->interlaced)
1701 {
1702 pSettings->selectedElement->interlaced = true;
1703 strcpy(feedback, "... Interlace enabled");
1704 }
1705 else
1706 {
1707 pSettings->selectedElement->interlaced = false;
1708 strcpy(feedback, "... Interlace disabled");
1709 }
1710
1711 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
1712 }
1713 else strcpy(feedback, "--- Not available ---");
1714 }
1715
1716 //====================
1717
1718 else if (!_stricmp(token4, "Colors"))
1719 {
1720 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 };
1721
1722 for (int n = 1; n <= 8; n++)
1723 {
1724 COLORREF* color;
1725 switch (n)
1726 {
1727 case 1: { color = &pSettings->selectedElement->Color1; break; }
1728 case 2: { color = &pSettings->selectedElement->Color2; break; }
1729 case 3: { color = &pSettings->selectedElement->Color3; break; }
1730 case 4: { color = &pSettings->selectedElement->Color4; break; }
1731 case 5: { color = &pSettings->selectedElement->Color5; break; }
1732 case 6: { color = &pSettings->selectedElement->Color6; break; }
1733 case 7: { color = &pSettings->selectedElement->Color7; break; }
1734 case 8: { color = &pSettings->selectedElement->Color8; break; }
1735 default: return false;
1736 }
1737
1738 if (!_stricmp(extra, "Greyscale"))
1739 {
1740 int greyscale = ((BYTE)GetRValue(*color) + (BYTE)GetGValue(*color) + (BYTE)GetBValue(*color)) / 3;
1741 *color = RGB((BYTE)greyscale, (BYTE)greyscale, (BYTE)greyscale);
1742 strcpy(feedback, "... converted to greyscale!");
1743 }
1744 if (!_stricmp(extra, "Sepia"))
1745 {
1746 double r, g, b;
1747 r = (GetRValue(*color) * 0.393) + (GetGValue(*color) * 0.769) + (GetBValue(*color) * 0.189);
1748 if (r > 255) r = 255;
1749 g = (GetRValue(*color) * 0.349) + (GetGValue(*color) * 0.686) + (GetBValue(*color) * 0.168);
1750 if (g > 255) g = 255;
1751 b = (GetRValue(*color) * 0.272) + (GetGValue(*color) * 0.534) + (GetBValue(*color) * 0.131);
1752 if (b > 255) b = 255;
1753 *color = RGB((BYTE)r, (BYTE)g, (BYTE)b);
1754 strcpy(feedback, "... converted to sepia!");
1755 }
1756 else if (!_stricmp(extra, "Darken"))
1757 {
1758 double r = GetRValue(*color) * 0.9;
1759 double g = GetGValue(*color) * 0.9;
1760 double b = GetBValue(*color) * 0.9;
1761 *color = RGB((BYTE)r, (BYTE)g, (BYTE)b);
1762 strcpy(feedback, "... colors darkened!");
1763 }
1764 else if (!_stricmp(extra, "Lighten"))
1765 {
1766 bool ceilingHit = false;
1767 double r = GetRValue(*color) * 1.1;
1768 if (r > 255) ceilingHit = true;
1769 double g = GetGValue(*color) * 1.1;
1770 if (g > 255) ceilingHit = true;
1771 double b = GetBValue(*color) * 1.1;
1772 if (b > 255) ceilingHit = true;
1773 if (!ceilingHit)
1774 {
1775 *color = RGB((BYTE)r, (BYTE)g, (BYTE)b);
1776 strcpy(feedback, "... colors lightened!");
1777 }
1778 else strcpy(feedback, "... can not go further!");
1779 }
1780 else if (!_stricmp(extra, "Invert"))
1781 {
1782 BYTE r = 255 - GetRValue(*color);
1783 BYTE g = 255 - GetGValue(*color);
1784 BYTE b = 255 - GetBValue(*color);
1785 *color = RGB((BYTE)r, (BYTE)g, (BYTE)b);
1786 strcpy(feedback, "... colors inverted!");
1787 }
1788 else if (!_stricmp(extra, "Flip"))
1789 {
1790 if ((pSettings->selectedElement->type == B_PARENTRELATIVE) || pSettings->selectedElement->parentRelative) break;
1791 else if ((pSettings->selectedElement->type == B_SUPERHORIZONTAL) || (pSettings->selectedElement->type == B_SUPERVERTICAL)) *color = colors[8-n];
1792 else if (((pSettings->selectedElement->type == B_SPLITHORIZONTAL) || (pSettings->selectedElement->type == B_SPLITVERTICAL)) && (n<=4)) *color = colors[4-n];
1793 else if ((pSettings->selectedElement->type != B_SOLID) && (n<=2)) *color = colors[2-n];
1794 else break;
1795 strcpy(feedback, "... colors flipped!");
1796 }
1797 }
1798 }
1799
1800 //====================
1801
1802 else if (IsInString(token4, "Color"))
1803 {
1804 // Check if its a #RRGGBB type string...
1805 if (*extra == '#') memmove(extra, extra + 1, strlen(extra));
1806 COLORREF newColor = strtol(extra, NULL, 16);
1807 newColor = RGB(GetBValue(newColor), GetGValue(newColor), GetRValue(newColor)); // Swap from RGB to BGR format...
1808
1809 if (!_strnicmp(token4, "Color", 5)) // -> Color1-8
1810 {
1811 int color = atoi(&token4[5]);
1812 switch (color)
1813 {
1814 case 1: { pSettings->selectedElement->Color1 = newColor; break; }
1815 case 2: { pSettings->selectedElement->Color2 = newColor; break; }
1816 case 3: { pSettings->selectedElement->Color3 = newColor; break; }
1817 case 4: { pSettings->selectedElement->Color4 = newColor; break; }
1818 case 5: { pSettings->selectedElement->Color5 = newColor; break; }
1819 case 6: { pSettings->selectedElement->Color6 = newColor; break; }
1820 case 7: { pSettings->selectedElement->Color7 = newColor; break; }
1821 case 8: { pSettings->selectedElement->Color8 = newColor; break; }
1822 default: break;
1823 }
1824 }
1825 else if (!_stricmp(token4, "TextColor")) pSettings->selectedElement->TextColor = newColor;
1826 else if (!_stricmp(token4, "OutlineColor"))
1827 {
1828 pSettings->selectedElement->OutlineColor = newColor;
1829 pSettings->selectedElement->FontOutline = true;
1830 }
1831 else if (!_stricmp(token4, "ShadowColor"))
1832 {
1833 pSettings->selectedElement->ShadowColor = newColor;
1834 pSettings->selectedElement->FontShadow = true;
1835 }
1836 else if (!_stricmp(token4, "DisabledColor")) pSettings->selectedElement->disabledColor = newColor;
1837 else if (!_stricmp(token4, "GlyphColor")) pSettings->selectedElement->BulletColor = newColor; // -> bulletColor, picColor, foregroundColor (TENTATIVE NAMING "GlyphColor")
1838 else if (!_stricmp(token4, "BorderColor")) pSettings->selectedElement->borderColor = newColor;
1839 }
1840
1841 //====================
1842
1843 else if (!_stricmp(token4, "MarginWidth"))
1844 {
1845 if ((pSettings->selectedElement != pSettings->MenuSeparator) && (pSettings->selectedElement != pSettings->ToolbarBorder) &&
1846 (pSettings->selectedElement != pSettings->MenuFrameBorder) && (pSettings->selectedElement != pSettings->DockBorder) &&
1847 (pSettings->selectedElement != pSettings->ExternalHardware))
1848 {
1849 if (!_stricmp(extra, "+")) pSettings->selectedElement->marginWidth += pSettings->scalingFactorHiDPI;
1850 else if (!_stricmp(extra, "-"))
1851 {
1852 pSettings->selectedElement->marginWidth -= pSettings->scalingFactorHiDPI;
1853 if (pSettings->selectedElement->marginWidth < 0) pSettings->selectedElement->marginWidth = 0;
1854 }
1855
1856 sprintf(feedback, "... %d pixels (eq)", (pSettings->selectedElement->marginWidth / pSettings->scalingFactorHiDPI));
1857 }
1858 else strcpy(feedback, "--- Not available ---");
1859
1860// SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
1861 }
1862
1863 //====================
1864
1865 else if (!_stricmp(token4, "BorderWidth"))
1866 {
1867 if ((pSettings->selectedElement != pSettings->MenuSeparator) &&
1868 (pSettings->selectedElement != pSettings->ExternalHardware))
1869 {
1870 // Redirect any gradient border BorderWidth commands to their respective "parent" elements...
1871 StyleItem* styleItemPtr;
1872 if (pSettings->selectedElement == pSettings->ToolbarBorder) styleItemPtr = pSettings->Toolbar;
1873 else if (pSettings->selectedElement == pSettings->MenuFrameBorder) styleItemPtr = pSettings->MenuFrame;
1874 else if (pSettings->selectedElement == pSettings->DockBorder) styleItemPtr = pSettings->Dock;
1875 else styleItemPtr = pSettings->selectedElement;
1876
1877 if (!_stricmp(extra, "+")) styleItemPtr->borderWidth += pSettings->scalingFactorHiDPI;
1878 else if (!_stricmp(extra, "-"))
1879 {
1880 styleItemPtr->borderWidth -= pSettings->scalingFactorHiDPI;
1881 if (styleItemPtr->borderWidth < 0) styleItemPtr->borderWidth = 0;
1882 }
1883
1884 if (styleItemPtr->borderWidth > 0) styleItemPtr->bordered = true;
1885 else styleItemPtr->bordered = false;
1886
1887 sprintf(feedback, "... %d pixels (eq)", (styleItemPtr->borderWidth / pSettings->scalingFactorHiDPI));
1888 }
1889 else strcpy(feedback, "--- Not available ---");
1890
1891// SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
1892 }
1893
1894 //====================
1895
1896 else if (IsInString(token4, "Font"))
1897 {
1898 if ((pSettings->selectedElement != pSettings->ToolbarButton) && (pSettings->selectedElement != pSettings->ToolbarButtonPressed)
1899 && (pSettings->selectedElement != pSettings->MenuIndicator) && (pSettings->selectedElement != pSettings->MenuSeparator)
1900 && (pSettings->selectedElement != pSettings->ToolbarBorder) && (pSettings->selectedElement != pSettings->MenuFrameBorder)
1901 && (pSettings->selectedElement != pSettings->DockBorder)
1902 && (pSettings->selectedElement != pSettings->WindowTitleFocus) && (pSettings->selectedElement != pSettings->WindowTitleUnfocus)
1903 && (pSettings->selectedElement != pSettings->WindowButtonFocus) && (pSettings->selectedElement != pSettings->WindowButtonUnfocus)
1904 && (pSettings->selectedElement != pSettings->WindowButtonPressed)
1905 && (pSettings->selectedElement != pSettings->WindowGripFocus) && (pSettings->selectedElement != pSettings->WindowGripUnfocus)
1906 && (pSettings->selectedElement != pSettings->WindowHandleFocus) && (pSettings->selectedElement != pSettings->WindowHandleUnfocus)
1907 && (pSettings->selectedElement != pSettings->ExternalHardware))
1908 {
1909 if (!_stricmp(token4, "Font"))
1910 {
1911 if (strlen(extra) > 0) // -> Font specified!
1912 {
1913 if (strchr(extra, '\"')) StrRemoveEncap(extra);
1914 if (strchr(extra, '/')) // -> Font/Size/Weight format
1915 {
1916 ParseFontString(extra, pSettings->selectedElement);
1917 pSettings->selectedElement->FontHeight *= pSettings->scalingFactorHiDPI;
1918 }
1919 else // -> Font name only
1920 {
1921// strncpy(pSettings->selectedElement->Font, extra, sizeof(pSettings->selectedElement->Font));
1922 strncpy_s(pSettings->selectedElement->Font, sizeof(pSettings->selectedElement->Font), extra, _TRUNCATE);
1923 pSettings->selectedElement->Font[sizeof(pSettings->selectedElement->Font) - 1] = '\0'; // Failsafe
1924 }
1925 }
1926 else // -> Open choose font dialog...
1927 {
1928 static LOGFONT lf;
1929 ZeroMemory(&lf, sizeof(lf));
1930 strcpy(lf.lfFaceName, pSettings->selectedElement->Font);
1931 lf.lfHeight = -MulDiv((pSettings->selectedElement->FontHeight / pSettings->scalingFactorHiDPI), GetDeviceCaps(GetDC(NULL), LOGPIXELSY), 72);
1932 lf.lfWeight = pSettings->selectedElement->FontWeight;
1933
1934 CHOOSEFONT cf;
1935 ZeroMemory(&cf, sizeof(cf));
1936 cf.lStructSize = sizeof(cf);
1937 cf.hwndOwner = NULL;
1938 cf.lpLogFont = &lf;
1939 cf.Flags = CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT;
1940
1941 if (ChooseFont(&cf) == TRUE)
1942 {
1943 if (strlen(lf.lfFaceName) > 0)
1944 {
1945 strcpy(pSettings->selectedElement->Font, lf.lfFaceName);
1946 pSettings->selectedElement->FontHeight = cf.iPointSize / 10; // Note: iPointSize is the size of the selected font in units of *1/10* of a point... :)
1947 if ((cf.nFontType == BOLD_FONTTYPE) || (lf.lfWeight >= FW_BOLD)) pSettings->selectedElement->FontWeight = FW_BOLD;
1948 else pSettings->selectedElement->FontWeight = FW_NORMAL;
1949
1950 sprintf(feedback, "... %s/%d/", pSettings->selectedElement->Font, pSettings->selectedElement->FontHeight);
1951 if (pSettings->selectedElement->FontWeight == FW_BOLD) strcat(feedback, "Bold");
1952 else strcat(feedback, "Normal");
1953 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
1954
1955 pSettings->selectedElement->FontHeight *= pSettings->scalingFactorHiDPI; // We apply the internal HiDPI scaling factor as applicable *after* displaying the selected value in "1x" style format...
1956 }
1957 }
1958 }
1959 }
1960 else if (!_stricmp(token4, "FontHeight"))
1961 {
1962 if (!_stricmp(extra, "+")) pSettings->selectedElement->FontHeight += pSettings->scalingFactorHiDPI;
1963 else if (!_stricmp(extra, "-"))
1964 {
1965 pSettings->selectedElement->FontHeight -= pSettings->scalingFactorHiDPI;
1966 if (pSettings->selectedElement->FontHeight < pSettings->scalingFactorHiDPI) pSettings->selectedElement->FontHeight = pSettings->scalingFactorHiDPI;
1967 }
1968
1969 sprintf(feedback, "... %d points (eq)", (pSettings->selectedElement->FontHeight / pSettings->scalingFactorHiDPI));
1970 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
1971 }
1972 else if (!_stricmp(token4, "FontWeight"))
1973 {
1974 if (pSettings->selectedElement->FontWeight == FW_NORMAL)
1975 {
1976 pSettings->selectedElement->FontWeight = FW_BOLD;
1977 strcpy(feedback, "... Bold");
1978 }
1979 else
1980 {
1981 pSettings->selectedElement->FontWeight = FW_NORMAL;
1982 strcpy(feedback, "... Normal");
1983 }
1984
1985 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
1986 }
1987 }
1988 else strcpy(feedback, "--- Not available ---");
1989 }
1990
1991 //====================
1992
1993 else if (!_stricmp(token4, "Alignment"))
1994 {
1995 if ((pSettings->selectedElement != pSettings->MenuSeparator) && (pSettings->selectedElement != pSettings->ToolbarBorder) &&
1996 (pSettings->selectedElement != pSettings->MenuFrameBorder) && (pSettings->selectedElement != pSettings->DockBorder) &&
1997 (pSettings->selectedElement != pSettings->ExternalHardware))
1998 {
1999 if (pSettings->selectedElement->Justify == DT_LEFT)
2000 {
2001 pSettings->selectedElement->Justify = DT_CENTER;
2002 strcpy(feedback, "... Center");
2003 }
2004 else if (pSettings->selectedElement->Justify == DT_CENTER)
2005 {
2006 pSettings->selectedElement->Justify = DT_RIGHT;
2007 strcpy(feedback, "... Right");
2008 }
2009 else // if (pSettings->selectedElement->Justify == DT_RIGHT)
2010 {
2011 pSettings->selectedElement->Justify = DT_LEFT;
2012 strcpy(feedback, "... Left");
2013 }
2014
2015 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
2016 }
2017 else strcpy(feedback, "--- Not available ---");
2018 }
2019
2020 //====================
2021
2022 else if (!_stricmp(token4, "Outline"))
2023 {
2024 if ((pSettings->selectedElement != pSettings->MenuSeparator) && (pSettings->selectedElement != pSettings->ToolbarBorder) &&
2025 (pSettings->selectedElement != pSettings->MenuFrameBorder) && (pSettings->selectedElement != pSettings->DockBorder) &&
2026 (pSettings->selectedElement != pSettings->ExternalHardware))
2027 {
2028 if (!pSettings->selectedElement->FontOutline)
2029 {
2030 pSettings->selectedElement->FontOutline = true;
2031 strcpy(feedback, "... Outline enabled");
2032 }
2033 else
2034 {
2035 pSettings->selectedElement->FontOutline = false;
2036 strcpy(feedback, "... Outline disabled");
2037 }
2038
2039 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
2040 }
2041 else strcpy(feedback, "--- Not available ---");
2042 }
2043
2044 //====================
2045
2046 else if (!_stricmp(token4, "Shadow"))
2047 {
2048 if ((pSettings->selectedElement != pSettings->MenuSeparator) && (pSettings->selectedElement != pSettings->ToolbarBorder) &&
2049 (pSettings->selectedElement != pSettings->MenuFrameBorder) && (pSettings->selectedElement != pSettings->DockBorder) &&
2050 (pSettings->selectedElement != pSettings->ExternalHardware))
2051 {
2052 if (!pSettings->selectedElement->FontShadow)
2053 {
2054 pSettings->selectedElement->FontShadow = true;
2055 strcpy(feedback, "... Shadow enabled");
2056 }
2057 else
2058 {
2059 pSettings->selectedElement->FontShadow = false;
2060 strcpy(feedback, "... Shadow disabled");
2061 }
2062
2063 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
2064 }
2065 else strcpy(feedback, "--- Not available ---");
2066 }
2067
2068 //====================
2069
2070 else if (!_stricmp(token4, "MenuBullet"))
2071 {
2072 if (pSettings->menuBullet == MENU_BULLET_IMAGE) pSettings->menuBullet = MENU_BULLET_EMPTY;
2073 else if (pSettings->menuBullet == MENU_BULLET_QUAD) pSettings->menuBullet = MENU_BULLET_EMPTY;
2074 else pSettings->menuBullet++;
2075
2076 switch (pSettings->menuBullet)
2077 {
2078 case MENU_BULLET_EMPTY: { strcpy(feedback, "... Empty (none)"); break; }
2079 case MENU_BULLET_DIAMOND: { strcpy(feedback, "... Diamond"); break; }
2080 case MENU_BULLET_SQUARE: { strcpy(feedback, "... Square"); break; }
2081 case MENU_BULLET_TRIANGLE: { strcpy(feedback, "...Triangle"); break; }
2082 case MENU_BULLET_CIRCLE: { strcpy(feedback, "... Circle"); break; }
2083 case MENU_BULLET_TRIPLE: { strcpy(feedback, "... Triple"); break; }
2084 case MENU_BULLET_COMMENT: { strcpy(feedback, "... Comment"); break; }
2085 case MENU_BULLET_GRID: { strcpy(feedback, "... Grid"); break; }
2086 case MENU_BULLET_QUAD: { strcpy(feedback, "... Quad"); break; }
2087 default: { strcpy(feedback, "... Error: Unsupported menu bullet type!"); break; }
2088 }
2089
2090 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
2091 }
2092 else if (!_stricmp(token4, "MenuBulletPosition"))
2093 {
2094 if (!_stricmp(pSettings->menuBulletPosition, "Right")) strcpy(pSettings->menuBulletPosition, "Left");
2095 else strcpy(pSettings->menuBulletPosition, "Right");
2096 sprintf(feedback, "... %s", pSettings->menuBulletPosition);
2097 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)feedback);
2098 }
2099
2100 //====================
2101
2102 // Send any feedback on the modify command back to the xDesignerGUI plugin as well... (nb. same feedback as displayed in the console)
2103 if (strlen(feedback) > 0)
2104 {
2105 char broam[MAX_LINE_LENGTH];
2106 sprintf(broam, "@xDesigner Feedback %s", feedback);
2107 SendMessage(GetBBWnd(), BB_BROADCAST, 0, (LPARAM)broam);
2108 }
2109
2110 //====================
2111
2112 // Update the cached appearance *string* for the selected element...
2113 // (nb. not included in the StyleItem definition but potentially used by
2114 // e.g. plugins calling ReadString, so needs to reflect the latest changes too)
2115 pSettings->UpdateAppearanceString(pSettings->selectedElement);
2116
2117 if (pSettings->selectedElement == pSettings->MenuTitle || pSettings->selectedElement == pSettings->MenuFrame ||
2118 pSettings->selectedElement == pSettings->MenuActive || pSettings->selectedElement == pSettings->MenuGrip ||
2119 pSettings->selectedElement == pSettings->MenuIndicator || pSettings->selectedElement == pSettings->MenuSeparator ||
2120 pSettings->selectedElement == pSettings->MenuFrameBorder ||
2121 !_stricmp(token4, "MenuBullet") || !_stricmp(token4, "MenuBulletPosition")) // Note: We need to check the Menu if's first as we have some non-selectedElement checks here...
2122 {
2123 if (pMenuCommon)
2124 {
2125 pMenuCommon->Configure();
2126 SendMessage(GetBBWnd(), BB_REDRAWGUI, BBRG_MENU, 0); // Note: Using BB_REDRAWGUI here; we do not want/need to trigger a full BB_RECONFIGURE for Designer mode single style param changes
2127 }
2128 }
2129 else if (pSettings->selectedElement == pSettings->Toolbar || pSettings->selectedElement == pSettings->ToolbarLabel ||
2130 pSettings->selectedElement == pSettings->ToolbarWindowLabel || pSettings->selectedElement == pSettings->ToolbarClock ||
2131 pSettings->selectedElement == pSettings->ToolbarButton || pSettings->selectedElement == pSettings->ToolbarButtonPressed ||
2132 pSettings->selectedElement == pSettings->ToolbarBorder)
2133 {
2134 pSettings->DeriveTaskbarStyle(); // Note: The taskbar style parameters are derived from other elements, and hence they need to be updated on changes too...
2135 if (pToolbar) pToolbar->UpdatePosition();
2136 SendMessage(GetBBWnd(), BB_REDRAWGUI, BBRG_TOOLBAR, 0); // Signal BB_REDRAWGUI to any other listening subscribers...
2137 }
2138 else if (pSettings->selectedElement == pSettings->Dock || pSettings->selectedElement == pSettings->DockBorder)
2139 {
2140 if (pDock) pDock->UpdateDockWindow();
2141 SendMessage(GetBBWnd(), BB_REDRAWGUI, BBRG_DOCK, 0); // Signal BB_REDRAWGUI to any other listening subscribers...
2142 }
2143 else if (pSettings->selectedElement == pSettings->Console)
2144 {
2145 if (pConsole) pConsole->UpdatePosition();
2146 }
2147 else if (pSettings->selectedElement == pSettings->WindowTitleFocus || pSettings->selectedElement == pSettings->WindowTitleUnfocus ||
2148 pSettings->selectedElement == pSettings->WindowLabelFocus || pSettings->selectedElement == pSettings->WindowLabelUnfocus ||
2149 pSettings->selectedElement == pSettings->WindowButtonFocus || pSettings->selectedElement == pSettings->WindowButtonUnfocus || pSettings->selectedElement == pSettings->WindowButtonPressed ||
2150 pSettings->selectedElement == pSettings->WindowGripFocus || pSettings->selectedElement == pSettings->WindowGripUnfocus ||
2151 pSettings->selectedElement == pSettings->WindowHandleFocus || pSettings->selectedElement == pSettings->WindowHandleUnfocus)
2152 {
2153 SendMessage(GetBBWnd(), BB_REDRAWGUI, BBRG_WINDOW, 0); // Signal BB_REDRAWGUI to any other listening subscribers...
2154 }
2155 else if (pSettings->selectedElement == pSettings->ExternalHardware)
2156 {
2157 SendMessage(GetBBWnd(), BB_REDRAWGUI, BBRG_HARDWARE, 0); // Signal BB_REDRAWGUI to any other listening subscribers...
2158 }
2159
2160 return true;
2161 }
2162
2163 //====================
2164
2165 else if (!_stricmp(token3, "Copy"))
2166 {
2167 StyleItem* source = NULL;
2168 StyleItem* destination = NULL;
2169 StyleItem* ptr;
2170 char srcdest[MAX_LINE_LENGTH];
2171
2172 for (int n=1; n<=2; n++)
2173 {
2174 if (n == 1) strcpy(srcdest, token4);
2175 else strcpy(srcdest, extra);
2176
2177 if (!_strnicmp(srcdest, "Toolbar", 7))
2178 {
2179 if (!_stricmp(srcdest, "Toolbar")) ptr = pSettings->Toolbar;
2180 else if (!_stricmp(srcdest, "ToolbarLabel")) ptr = pSettings->ToolbarLabel;
2181 else if (!_stricmp(srcdest, "ToolbarWindowLabel")) ptr = pSettings->ToolbarWindowLabel;
2182 else if (!_stricmp(srcdest, "ToolbarClock")) ptr = pSettings->ToolbarClock;
2183 else if (!_stricmp(srcdest, "ToolbarButton")) ptr = pSettings->ToolbarButton;
2184 else if (!_stricmp(srcdest, "ToolbarButtonPressed")) ptr = pSettings->ToolbarButtonPressed;
2185 else if (!_stricmp(srcdest, "ToolbarBorder")) ptr = pSettings->ToolbarBorder;
2186 }
2187 else if (!_strnicmp(srcdest, "Menu", 4))
2188 {
2189 if (!_stricmp(srcdest, "MenuTitle")) ptr = pSettings->MenuTitle;
2190 else if (!_stricmp(srcdest, "MenuFrame")) ptr = pSettings->MenuFrame;
2191 else if (!_stricmp(srcdest, "MenuActive")) ptr = pSettings->MenuActive;
2192 else if (!_stricmp(srcdest, "MenuGrip")) ptr = pSettings->MenuGrip;
2193 else if (!_stricmp(srcdest, "MenuIndicator")) ptr = pSettings->MenuIndicator;
2194 else if (!_stricmp(srcdest, "MenuSeparator")) ptr = pSettings->MenuSeparator;
2195 else if (!_stricmp(srcdest, "MenuFrameBorder")) ptr = pSettings->MenuFrameBorder;
2196 }
2197 else if (!_stricmp(srcdest, "Dock")) ptr = pSettings->Dock;
2198 else if (!_stricmp(srcdest, "DockBorder")) ptr = pSettings->DockBorder;
2199 else if (!_stricmp(srcdest, "Console")) ptr = pSettings->Console;
2200 else if (!_strnicmp(srcdest, "Window", 6))
2201 {
2202 if (!_strnicmp(&srcdest[6], "Title", 5))
2203 {
2204 if (!_stricmp(srcdest, "WindowTitleFocus")) ptr = pSettings->WindowTitleFocus;
2205 else if (!_stricmp(srcdest, "WindowTitleUnfocus")) ptr = pSettings->WindowTitleUnfocus;
2206 }
2207 else if (!_strnicmp(&srcdest[6], "Label", 5))
2208 {
2209 if (!_stricmp(srcdest, "WindowLabelFocus")) ptr = pSettings->WindowLabelFocus;
2210 else if (!_stricmp(srcdest, "WindowLabelUnfocus")) ptr = pSettings->WindowLabelUnfocus;
2211 }
2212 else if (!_strnicmp(&srcdest[6], "Button", 6))
2213 {
2214 if (!_stricmp(srcdest, "WindowButtonFocus")) ptr = pSettings->WindowButtonFocus;
2215 else if (!_stricmp(srcdest, "WindowButtonUnfocus")) ptr = pSettings->WindowButtonUnfocus;
2216 else if (!_stricmp(srcdest, "WindowButtonPressed")) ptr = pSettings->WindowButtonPressed;
2217 }
2218 else if (!_strnicmp(&srcdest[6], "Grip", 4))
2219 {
2220 if (!_stricmp(srcdest, "WindowGripFocus")) ptr = pSettings->WindowGripFocus;
2221 else if (!_stricmp(srcdest, "WindowGripUnfocus")) ptr = pSettings->WindowGripUnfocus;
2222 }
2223 else if (!_strnicmp(&srcdest[6], "Handle", 6))
2224 {
2225 if (!_stricmp(srcdest, "WindowHandleFocus")) ptr = pSettings->WindowHandleFocus;
2226 else if (!_stricmp(srcdest, "WindowHandleUnfocus")) ptr = pSettings->WindowHandleUnfocus;
2227 }
2228 }
2229 else if (!_stricmp(srcdest, "Hardware")) ptr = pSettings->ExternalHardware;
2230 else return false; // Failsafe
2231
2232 if (n == 1) source = ptr;
2233 else destination = ptr;
2234 }
2235
2236 // Copy from the source element to the destination element... (and select the latter for further editing)
2237 CopyMemory(destination, source, sizeof(StyleItem));
2238 pSettings->selectedElement = destination;
2239
2240 // Update all UI elements... (because that's way easier than complex source/destination checking ;))
2241 if (pToolbar) pToolbar->UpdatePosition();
2242 if (pMenuCommon)
2243 {
2244 pMenuCommon->Configure();
2245 SendMessage(GetBBWnd(), BB_REDRAWGUI, BBRG_MENU, 0);
2246 }
2247 if (pDock) pDock->UpdateDockWindow();
2248 if (pConsole) pConsole->UpdatePosition();
2249 SendMessage(GetBBWnd(), BB_REDRAWGUI, BBRG_WINDOW, 0);
2250
2251 SendMessage(GetBBWnd(), BB_BROADCAST, 0, (LPARAM)"@xDesigner Feedback ... copied!");
2252 }
2253
2254 //====================
2255
2256 else if (!_stricmp(token3, "Save"))
2257 {
2258 pSettings->WriteStyle();
2259 SendMessage(GetBBWnd(), BB_BROADCAST, 0, (LPARAM)"@xDesigner Feedback ... saved!");
2260 }
2261 }
2262
2263 //====================
2264
2265 else if (!_stricmp(token2, "Reconfigure"))
2266 {
2267 PostMessage(GetBBWnd(), BB_SETSTYLE, 0, 0); // -> Reload current style
2268 return true;
2269 }
2270
2271 else if (!_stricmp(token2, "Restart"))
2272 {
2273 PostMessage(GetBBWnd(), BB_RESTART, 0, 0);
2274 return true;
2275 }
2276
2277 else if (!_stricmp(token2, "PausedRestart"))
2278 {
2279 // Note: BB_RESTART WPARAM set to 1 -> Paused restart! (xoblite only for now)
2280 PostMessage(GetBBWnd(), BB_RESTART, 1, 0);
2281 return true;
2282 }
2283
2284 //====================
2285
2286 else if (!_stricmp(token2, "MinimizeAll"))
2287 {
2288 pTaskbar->MinimizeAllWindows();
2289 return true;
2290 }
2291 else if (!_stricmp(token2, "RestoreAll"))
2292 {
2293 pTaskbar->RestoreAllWindows();
2294 return true;
2295 }
2296
2297 //====================
2298
2299 else if (!_stricmp(token2, "Explorer")) // New more flexible syntax
2300 {
2301 if (!_stricmp(token3, "Toggle")) ToggleExplorer();
2302 else if (!_stricmp(token3, "Hide") && !pSettings->explorerHidden) ToggleExplorer();
2303 else if (!_stricmp(token3, "Show") && pSettings->explorerHidden) ToggleExplorer();
2304
2305 return true;
2306 }
2307
2308 else if (!_stricmp(token2, "ToggleExplorer")) // Legacy syntax (kept for backwards compatibility only)
2309 {
2311 return true;
2312 }
2313
2314 else if (!_stricmp(token2, "EmptyRecycleBin"))
2315 {
2316 SHEmptyRecycleBin(NULL, NULL, 0);
2317 return true;
2318 }
2319
2320 //====================
2321
2322 else if (!_stricmp(token2, "Statistics"))
2323 {
2324 char msg[255];
2325 sprintf(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" : ""));
2326 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_SHELL_MESSAGE, (LPARAM)msg);
2327 sprintf(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" : ""));
2328 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_PLAIN_MESSAGE, (LPARAM)msg);
2329 return true;
2330 }
2331
2332 //====================
2333
2334 else if (!_stricmp(token2, "Quit"))
2335 {
2336 if (!_stricmp(token3, "<Yes>")) PostMessage(GetBBWnd(), BB_QUIT, 0, 0);
2337 else SendMessage(GetBBWnd(), BB_POPUPMESSAGE, (WPARAM)"Are you sure you want to quit?", (LPARAM)"@xoblite Quit <Yes>");
2338 return true;
2339 }
2340
2341 //====================
2342
2343 else if (!_stricmp(token2, "System"))
2344 {
2345 if (!_stricmp(token3, "Shutdown")) PostMessage(GetBBWnd(), BB_SHUTDOWN, 0, 1); // Setting LPARAM to 1 -> Skip the normal "yes/no" dialog (xoblite only)
2346 else if (!_stricmp(token3, "Reboot")) PostMessage(GetBBWnd(), BB_SHUTDOWN, 1, 1);
2347 else if (!_stricmp(token3, "LogOff")) PostMessage(GetBBWnd(), BB_SHUTDOWN, 2, 1);
2348 else if (!_stricmp(token3, "Hibernate")) PostMessage(GetBBWnd(), BB_SHUTDOWN, 3, 1);
2349 else if (!_stricmp(token3, "Standby")) PostMessage(GetBBWnd(), BB_SHUTDOWN, 4, 1);
2350 return true;
2351 }
2352 }
2353
2354 //====================
2355
2356 else if (!_strnicmp(broam, "@Script", 7))
2357 {
2358 if (!pSettings->disableScriptSupport)
2359 {
2360 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_REGULAR_MESSAGE, (LPARAM)broam); // Display the @Script bro@m in the console...
2361
2362 char token1[MAX_LINE_LENGTH], script[MAX_LINE_LENGTH];
2363 LPSTR tokens[1];
2364 tokens[0] = token1;
2365
2366 token1[0] = script[0] = '\0';
2367 BBTokenize(broam, tokens, 1, script);
2368
2369 // Remove encapsulating [] brackets and execute the script...
2370 script[strlen(script) - 1] = '\0';
2371 _beginthread(ExecuteScript, 0, &script[1]);
2372 }
2373 else SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"@Script support is currently disabled.");
2374
2375 return true;
2376 }
2377
2378 //====================
2379
2380 else if (!_strnicmp(broam, "@Callback", 9))
2381 {
2382 // Edit a generic string, and when ready execute the specified callback broam...
2383
2384 char token1[MAX_LINE_LENGTH], token2[MAX_LINE_LENGTH], token3[MAX_LINE_LENGTH], extra[MAX_LINE_LENGTH];
2385 LPSTR tokens[4];
2386 tokens[0] = token1;
2387 tokens[1] = token2;
2388 tokens[2] = token3;
2389 token1[0] = token2[0] = token3[0] = extra[0] = '\0';
2390 BBTokenize(broam, tokens, 3, extra);
2391
2392 if ((token2[0] == '@') && strlen(token3)) // ...expecting a two-parameter callback broam in @xxxxx yyyyy format! (this should be sufficient for most if not all use cases)
2393 {
2394 char command[MAX_LINE_LENGTH];
2395 sprintf(command, "%s %s", token2, token3);
2396 CreateRunBox(hMainInstance, command, extra); // Callback broam -> @xxxxx yyyyy <edited string>
2397 return false; // Suppress the pre-editing @Callback <...> bro@m from being displayed in the console...
2398 }
2399 }
2400
2401 //====================
2402
2403 else if (!_strnicmp(broam, "@GoToURL", 8))
2404 {
2405 char token1[MAX_LINE_LENGTH], extra[MAX_LINE_LENGTH];
2406 LPSTR tokens[1];
2407 tokens[0] = token1;
2408 token1[0] = extra[0] = '\0';
2409 BBTokenize(broam, tokens, 1, extra);
2410 BBSmartExecute(extra);
2411 return false; // Suppress internal @GoToURL bro@ms from being displayed in the console...
2412 }
2413
2414 //====================
2415
2416 else if (!_strnicmp(broam, "@BBShowPlugins", 14) || !_strnicmp(broam, "@BBHidePlugins", 14)) return false; // Suppress the "silent" internal @BBShowPlugins/@BBHidePlugins typically triggered by calling @xoblite Plugins Toggle...
2417 else if (!_strnicmp(broam, "@xDesigner Feedback", 19)) return false; // Suppress xDesignerGUI feedback bro@ms from being displayed in the console...
2418 else if (!_strnicmp(broam, "@xWebViewer Bookmark", 20) || !_strnicmp(broam, "@xWebViewer URL", 15)) return false; // Suppress xWebViewer bookmark+URL bro@ms from being displayed in the console...
2419 else if (!_strnicmp(broam, "@", 1))
2420 {
2421 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_REGULAR_MESSAGE, (LPARAM)broam); // Display all other bro@ms in the console...
2422
2423 if (IsInString(broam, "@xDesignerGUI") && !pSettings->designerModeEnabled)
2424 {
2425 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"Designer mode is disabled. Please enable it to use the @xDesignerGUI bro@ms.");
2426 }
2427 }
2428 else SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_ERROR_MESSAGE, (LPARAM)broam); // Debug failsafe (e.g. non-broam, non-terminated, etc) -> Display message as is but with ERROR flag set...
2429
2430 //====================
2431
2432 return false;
2433}
void ParseFontString(LPSTR string, StyleItem *item)
Definition BBApi.cpp:2669
void WriteBool(LPCSTR fp, LPCSTR keyword, bool value)
Definition BBApi.cpp:3131
void WriteInt(LPCSTR fp, LPCSTR keyword, int value)
Definition BBApi.cpp:3144
Desktop * pDesktop
Definition Blackbox.cpp:37
void WriteString(LPCSTR fp, LPCSTR keyword, LPSTR value)
Definition BBApi.cpp:3156
BYTE greyscale
Definition BBApi.cpp:3761
Workspaces * pWorkspaces
Definition Blackbox.cpp:51
bool SetTransparency(HWND hwnd, BYTE alpha)
Definition BBApi.cpp:3068
Taskbar * pTaskbar
Definition Blackbox.cpp:47
bool IsInString(LPCSTR inputString, LPCSTR searchString)
Definition BBApi.cpp:2519
LPSTR ReadString(LPCSTR fp, LPCSTR szString, LPSTR szDefault)
Definition BBApi.cpp:544
void BBSmartExecute(LPSTR inputString)
Definition BBApi.cpp:1767
void ToggleSticky(HWND window)
Definition BBApi.cpp:3006
MenuCommon * pMenuCommon
Definition Blackbox.cpp:41
Wallpaper * pWallpaper
Definition Blackbox.cpp:50
int BBTokenize(LPCSTR szString, char *lpszBuffers[], DWORD dwNumBuffers, LPSTR szExtraParameters)
Definition BBApi.cpp:316
LPSTR StrRemoveEncap(LPSTR string)
Definition BBApi.cpp:406
void ReplaceEnvVars(LPSTR string)
Definition BBApi.cpp:2594
void ReplaceShellFolders(LPSTR string)
Definition BBApi.cpp:2633
LPCSTR menuPath(LPCSTR other)
Definition BBApi.cpp:920
Settings * pSettings
Definition Blackbox.cpp:46
PluginManager * pPluginManager
Definition Blackbox.cpp:43
void WriteColor(LPCSTR fp, LPCSTR keyword, COLORREF value)
Definition BBApi.cpp:3165
HWND GetBBWnd()
Definition BBApi.cpp:128
#define BB_SHUTDOWN
Definition BBApi.h:175
#define BBRG_DOCK
Definition BBApi.h:231
#define BB_QUIT
Definition BBApi.h:145
#define PLUGIN_NAME
Definition BBApi.h:266
#define BEVEL1
Definition BBApi.h:108
#define B_VERTICAL
Definition BBApi.h:73
#define BB_TOGGLECONSOLE
Definition BBApi.h:173
#define BB_RESTART
Definition BBApi.h:146
#define B_MIRRORHORIZONTAL
Definition BBApi.h:95
#define B_CROSSDIAGONAL
Definition BBApi.h:75
#define BB_CONSOLEMESSAGE
Definition BBApi.h:165
#define B_SOLID
Definition BBApi.h:80
#define B_ELLIPTIC
Definition BBApi.h:77
#define BB_TOGGLEPLUGINS
Definition BBApi.h:167
#define CONSOLE_REGULAR_MESSAGE
Definition BBApi.h:297
#define BBRG_HARDWARE
Definition BBApi.h:232
#define BB_REDRAWGUI
Definition BBApi.h:220
#define BB_MENU
Definition BBApi.h:160
#define CONSOLE_PLAIN_MESSAGE
Definition BBApi.h:302
#define B_MIRRORVERTICAL
Definition BBApi.h:96
#define BBRG_TOOLBAR
Definition BBApi.h:221
#define B_HORIZONTAL
Definition BBApi.h:72
#define B_DIAGONAL
Definition BBApi.h:74
#define BB_BROADCAST
Definition BBApi.h:245
#define BB_RECONFIGURE
Definition BBApi.h:147
#define CONSOLE_SHELL_MESSAGE
Definition BBApi.h:301
#define B_SPLITSOLID
Definition BBApi.h:88
#define B_PIPECROSS
Definition BBApi.h:76
#define CONSOLE_ERROR_MESSAGE
Definition BBApi.h:300
#define BB_SETTHEME
Definition BBApi.h:151
#define BEVEL_RAISED
Definition BBApi.h:106
#define BEVEL_FLAT
Definition BBApi.h:105
#define B_SPLITHORIZONTAL
Definition BBApi.h:86
#define BB_WORKSPACE
Definition BBApi.h:183
#define B_SUPERVERTICAL
Definition BBApi.h:92
#define BB_SETSTYLE
Definition BBApi.h:148
#define BEVEL_SUNKEN
Definition BBApi.h:107
#define BBRG_DESKTOP
Definition BBApi.h:225
#define B_SPLITVERTICAL
Definition BBApi.h:87
#define BBRG_WINDOW
Definition BBApi.h:223
#define BB_POPUPMESSAGE
Definition BBApi.h:166
#define BB_TOGGLEDOCK
Definition BBApi.h:170
#define BEVEL2
Definition BBApi.h:109
#define B_PARENTRELATIVE
Definition BBApi.h:69
#define B_SUPERHORIZONTAL
Definition BBApi.h:91
#define MAX_LINE_LENGTH
Definition BBApi.h:64
#define B_PYRAMID
Definition BBApi.h:79
#define CONSOLE_INFORMATION_MESSAGE
Definition BBApi.h:298
#define BB_TOGGLETOOLBAR
Definition BBApi.h:171
#define BBRG_MENU
Definition BBApi.h:222
#define B_RECTANGLE
Definition BBApi.h:78
#define CONSOLE_INDENTED_MESSAGE
Definition BBApi.h:303
#define CONSOLE_WARNING_MESSAGE
Definition BBApi.h:299
Hotkeys * pHotkeys
Definition Blackbox.cpp:39
Toolbar * pToolbar
Definition Blackbox.cpp:48
Tooltips * pTooltips
Definition Blackbox.cpp:49
Console * pConsole
Definition Blackbox.cpp:36
HINSTANCE hMainInstance
Definition Blackbox.cpp:61
Dock * pDock
Definition Blackbox.cpp:38
void ExecuteScript(void *param)
Definition Broams.cpp:2440
unsigned int numberOfFiles
Definition Broams.cpp:47
bool FindRandomFile(LPSTR folder, int type, bool applyRandom)
Definition Broams.cpp:2460
unsigned int currentFile
Definition Broams.cpp:47
void ToggleExplorer()
Definition Broams.cpp:2560
unsigned int randomFile
Definition Broams.cpp:47
char pathToScan[MAX_PATH]
Definition Broams.cpp:48
void CreateRunBox(HINSTANCE hMainInstance, LPSTR commandString, LPSTR initString)
Definition Broams.cpp:2739
#define BROAM_RANDOM_STYLE
Definition Broams.h:36
#define BROAM_RANDOM_WALLPAPER
Definition Broams.h:37
void checkForUpdates(void *param)
Definition PluginManager.cpp:630
#define MENU_BULLET_TRIPLE
Definition Settings.h:59
#define PLACEMENT_CENTER_LEFT
Definition Settings.h:71
#define PLACEMENT_OPPOSITE_TOOLBAR
Definition Settings.h:78
#define PLACEMENT_LEFT_HALF
Definition Settings.h:80
#define TASKBAR_SORT_BY_LAST_USED
Definition Settings.h:49
#define PLACEMENT_TOP_CENTER
Definition Settings.h:69
#define TASKBAR_MODE_BARS
Definition Settings.h:43
#define PLACEMENT_CENTERED
Definition Settings.h:84
#define PLACEMENT_TOP_HALF
Definition Settings.h:82
#define MENU_BULLET_COMMENT
Definition Settings.h:60
#define PLACEMENT_BOTTOM_CENTER
Definition Settings.h:75
#define PLACEMENT_DEFAULT
Definition Settings.h:77
#define MENU_BULLET_SQUARE
Definition Settings.h:56
#define MENU_BULLET_QUAD
Definition Settings.h:62
#define MENU_BULLET_DIAMOND
Definition Settings.h:55
#define MENU_BULLET_CIRCLE
Definition Settings.h:58
#define MENU_BULLET_EMPTY
Definition Settings.h:54
#define TASKBAR_MODE_BARSICONS
Definition Settings.h:44
#define PLACEMENT_BOTTOM_LEFT
Definition Settings.h:74
#define MENU_BULLET_TRIANGLE
Definition Settings.h:57
#define MENU_BULLET_IMAGE
Definition Settings.h:63
#define TASKBAR_MODE_HIDDEN
Definition Settings.h:42
#define PLACEMENT_BOTTOM_HALF
Definition Settings.h:83
#define TASKBAR_SORT_DISABLED
Definition Settings.h:47
#define PLACEMENT_TOP_LEFT
Definition Settings.h:68
#define MENU_BULLET_GRID
Definition Settings.h:61
#define PLACEMENT_CENTER_CENTER
Definition Settings.h:72
#define PLACEMENT_TOP_RIGHT
Definition Settings.h:70
#define PLACEMENT_BOTTOM_RIGHT
Definition Settings.h:76
#define PLACEMENT_CENTER_RIGHT
Definition Settings.h:73
#define TASKBAR_MODE_ICONS
Definition Settings.h:45
#define TASKBAR_SORT_FOLLOW_ACTIVE
Definition Settings.h:48
#define PLACEMENT_RIGHT_HALF
Definition Settings.h:81
void PlaySoundFX(int sound)
Definition Sounds.cpp:40
@ SFX_MENU_SHOW
Definition Sounds.h:42
@ SFX_TOGGLE_ELEMENT
Definition Sounds.h:48
void UnregisterThemeFonts()
Definition Themes.cpp:293
void RegisterThemeFonts()
Definition Themes.cpp:229
Definition MenuCommon.h:43
Definition BBApi.h:398
int borderWidth
Definition BBApi.h:417
bool bordered
Definition BBApi.h:421

◆ ExecuteScript()

void ExecuteScript ( void * param)
2441{
2442 char script[MAX_LINE_LENGTH], cmd[MAX_LINE_LENGTH];
2443 strcpy(script, (LPSTR)param);
2444
2445 while (strlen(script))
2446 {
2447 strcpy(script, Tokenize(script, cmd, "|"));
2448 if (pConsole) pConsole->BlockMessage(cmd); // Block individual items of an @Script being echoed in the Console...
2449 BBSmartExecute(cmd);
2450 }
2451
2452 _endthread();
2453}
LPSTR Tokenize(LPCSTR string, LPSTR buf, LPSTR delims)
Definition BBApi.cpp:273

◆ FindRandomFile()

bool FindRandomFile ( LPSTR folder,
int type,
bool applyRandom )
2461{
2462 char thisFolder[MAX_PATH];
2463 char subFolder[MAX_PATH];
2464 long handle;
2465 _finddata_t found;
2466
2467// strncpy(thisFolder, folder, MAX_PATH - 1);
2468 strncpy_s(thisFolder, sizeof(thisFolder), folder, _TRUNCATE);
2469 if (thisFolder[strlen(thisFolder)] != '\\') strcat(thisFolder, "\\");
2470 strcat(thisFolder, "*");
2471
2472 handle = _findfirst(thisFolder, &found);
2473
2474 if (handle != -1)
2475 {
2476 do
2477 {
2478 if (strcmp(found.name, ".") == 0 || strcmp(found.name, "..") == 0 || (found.attrib & _A_HIDDEN))
2479 {
2480 // Skip hidden files...
2481 continue;
2482 }
2483
2484 if (found.attrib & _A_SUBDIR)
2485 {
2486 // Scan through subfolders too...
2487// strncpy(subFolder, thisFolder, MAX_PATH - 1);
2488 strncpy_s(subFolder, sizeof(subFolder), thisFolder, _TRUNCATE);
2489 subFolder[strlen(subFolder) - 1] = '\0'; // Remove the * wildcard...
2490 strcat(subFolder, found.name);
2491 if (FindRandomFile(subFolder, type, applyRandom)) break;
2492 }
2493 else
2494 {
2495 if (type == BROAM_RANDOM_STYLE)
2496 {
2497 // Skip any .3dc colour scheme files in styles folders...
2498 if (IsInString(found.name, ".3dc")) continue;
2499 }
2500 else // BROAM_RANDOM_WALLPAPER
2501 {
2502 // We allow only JPG/JPEG, PNG, and BMP files as wallpaper images...
2503 if (!IsInString(found.name, ".jpg") && !IsInString(found.name, ".jpeg") && !IsInString(found.name, ".png") && !IsInString(found.name, ".bmp")) continue;
2504 }
2505
2506 if (applyRandom)
2507 {
2508 currentFile++;
2509 if (currentFile == randomFile)
2510 {
2511// strncpy(pathToFile, thisFolder, MAX_PATH - 1);
2512 strncpy_s(pathToFile, sizeof(pathToFile), thisFolder, _TRUNCATE);
2513 pathToFile[strlen(pathToFile) - 1] = '\0'; // Remove the * wildcard...
2514 strcat(pathToFile, found.name);
2515
2516 if (type == BROAM_RANDOM_STYLE)
2517 {
2518 PostMessage(GetBBWnd(), BB_SETSTYLE, 0, (LPARAM)pathToFile); // Set randomly selected style...
2519 // pSettings->Statistics.changedStyle++; // Note: We do this under BB_SETSTYLE in Blackbox.cpp for all style changes instead!
2520 }
2521 else // BROAM_RANDOM_WALLPAPER
2522 {
2523 // Set randomly selected wallpaper...
2524 pWallpaper->SetWallpaper(pathToFile, "stretch");
2525/*
2526 // ...and copy a matching rootCommand to the clipboard for
2527 // possibly updating of a style in case it was a good match! =]
2528 char rootCmd[MAX_LINE_LENGTH];
2529 if (IsInString(pathToFile, pSettings->SF_currentThemePath)) sprintf(rootCmd, "rootCommand: bsetbg -full \"$CurrentTheme$%s\"", &pathToFile[strlen(pSettings->SF_currentThemePath)]);
2530 else if (IsInString(pathToFile, pSettings->SF_blackboxPath)) sprintf(rootCmd, "rootCommand: bsetbg -full \"%s\"", &pathToFile[strlen(pSettings->SF_blackboxPath)+1]);
2531 else sprintf(rootCmd, "rootCommand: bsetbg -full \"%s\"", pathToFile);
2532 CopyStringToClipboard(rootCmd);
2533
2534 strcpy(pSettings->rootCommand, &rootCmd[13]); // Finally, remember the manually applied wallpaper as the "last applied" rootCommand in case Designer mode wants to Save it later on...
2535*/
2536 pSettings->Statistics.changedWallpaper++; // Update statistics...
2537 }
2538
2539 return true;
2540 }
2541 }
2542 else numberOfFiles++;
2543 }
2544 } while (_findnext(handle, &found) == 0);
2545 }
2546
2547 _findclose(handle);
2548
2549 return false;
2550}
char pathToFile[MAX_PATH]
Definition Broams.cpp:49

◆ ToggleExplorer()

void ToggleExplorer ( )
2561{
2562 if (!pSettings->underExplorer) return;
2563
2564 if (!pSettings->explorerHidden) HideExplorer(false);
2565 else ShowExplorer();
2566
2567 bool savedWriteProtection = pSettings->writeProtection;
2568 pSettings->writeProtection = false;
2569 WriteBool(pSettings->xobrcDefaultFile, "xoblite.explorer.hidden:", pSettings->explorerHidden);
2570 pSettings->writeProtection = savedWriteProtection;
2571
2572 // Update core shell elements...
2573 if (pDesktop) pDesktop->UpdateDesktopWindow();
2574 if (pToolbar) pToolbar->UpdatePosition();
2575 if (pConsole) pConsole->UpdatePosition();
2576 if (pDock) pDock->UpdatePosition();
2577
2578 // Notify plugins that the desktop work area has changed...
2579 SendMessage(GetBBWnd(), BB_REDRAWGUI, BBRG_DESKTOP, 0);
2580
2582
2583// if (pSettings->explorerHidden) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"Explorer taskbar hidden.");
2584// else SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"Explorer taskbar shown.");
2585}
void ShowExplorer()
Definition Broams.cpp:2632
void HideExplorer(bool hideOnStartup)
Definition Broams.cpp:2589

◆ HideExplorer()

void HideExplorer ( bool hideOnStartup)
2590{
2592
2593 if (!pSettings->explorerHidden || hideOnStartup)
2594 {
2595 if (FindWindow("Shell_TrayWnd", "") == NULL) return;
2596/*
2597 // Save the current/original desktop work area before the Explorer taskbar is hidden...
2598 SystemParametersInfo(SPI_GETWORKAREA, 0, (PVOID)&origWorkArea, 0);
2599*/
2600 // Enable taskbar auto-hide... (nb. this will prevent it from still taking up desktop work area when forcibly/truly hidden)
2601 APPBARDATA abd;
2602 ZeroMemory(&abd, sizeof(abd));
2603 abd.cbSize = sizeof(abd);
2604 abd.lParam = ABS_AUTOHIDE;
2605 SHAppBarMessage(ABM_SETSTATE, &abd);
2606 // SHAppBarMessage(ABM_WINDOWPOSCHANGED, &abd);
2607
2608 // Hide applicable Explorer shell elements... (e.g. taskbar including the system tray, etc)
2609 ExplorerWndList.clear();
2610 EnumWindows(ExplorerEnumWindowsProc, 0);
2611
2612 // Set a timer for every 2 seconds to check whether they have gone visible again... (see also WM_TIMER handling in Blackbox.cpp)
2613 SetTimer(GetBBWnd(), CHECK_EXPLORER_HIDDEN_TIMER, 2000, (TIMERPROC)NULL);
2614
2615 pSettings->explorerHidden = true;
2616/*
2617 // Finally, we set a new desktop work area to use when the Explorer taskbar is hidden...
2618 RECT newWorkArea;
2619 int ScreenX = GetSystemMetrics(SM_XVIRTUALSCREEN);
2620 int ScreenY = GetSystemMetrics(SM_YVIRTUALSCREEN);
2621 int ScreenWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
2622 int ScreenHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);
2623 SetRect(&newWorkArea, ScreenX, ScreenY, ScreenX+ScreenWidth, ScreenY+ScreenHeight);
2624 SystemParametersInfo(SPI_SETWORKAREA, 0, (PVOID)&newWorkArea, SPIF_SENDCHANGE);
2625 // SystemParametersInfo(SPI_GETWORKAREA, 0, (PVOID)&newWorkArea, SPIF_SENDCHANGE); // (...is this really needed? Just in case...)
2626*/
2627 }
2628}
#define CHECK_EXPLORER_HIDDEN_TIMER
Definition Blackbox.h:64
vector< HWND > ExplorerWndList
Definition Broams.cpp:2557
BOOL CALLBACK ExplorerEnumWindowsProc(HWND hwnd, LPARAM lParam)
Definition Broams.cpp:2666

◆ ShowExplorer()

void ShowExplorer ( )
2633{
2635
2636 if (pSettings->explorerHidden)
2637 {
2638/*
2639 // Restore the original desktop work area... (see HideExplorer() above)
2640 SystemParametersInfo(SPI_SETWORKAREA, 0, (PVOID)&origWorkArea, SPIF_SENDCHANGE);
2641 // SystemParametersInfo(SPI_GETWORKAREA, 0, (PVOID)&origWorkArea, SPIF_SENDCHANGE); // (...is this really needed? Just in case...)
2642*/
2643 // Show previously hidden Explorer shell elements...
2644 while (ExplorerWndList.size())
2645 {
2646 ShowWindow(ExplorerWndList.back(), SW_SHOWNOACTIVATE);
2647 ExplorerWndList.pop_back();
2648 }
2649
2650 // Disable taskbar auto-hide... (nb. maybe we could somehow have saved the previous state here, but that's arguably a minor thing)
2651 APPBARDATA abd;
2652 ZeroMemory(&abd, sizeof(abd));
2653 abd.cbSize = sizeof(abd);
2654 abd.lParam = ABS_ALWAYSONTOP;
2655 SHAppBarMessage(ABM_SETSTATE, &abd);
2656 // SHAppBarMessage(ABM_WINDOWPOSCHANGED, &abd);
2657
2658 pSettings->explorerHidden = false;
2659 }
2660}

◆ ExplorerEnumWindowsProc()

BOOL CALLBACK ExplorerEnumWindowsProc ( HWND hwnd,
LPARAM lParam )
2667{
2668// if (IsWindowVisible(hwnd))
2669 {
2670 GetClassName(hwnd, enumClassName, sizeof(enumClassName));
2671
2672 if (!_stricmp(enumClassName, "Shell_TrayWnd") || !_stricmp(enumClassName, "Shell_SecondaryTrayWnd"))
2673 {
2674// GetWindowText(hwnd, enumWindowTitle, sizeof(enumWindowTitle));
2675// if (!_stricmp(enumWindowTitle, ""))
2676 {
2677 ShowWindow(hwnd, SW_HIDE);
2678 ExplorerWndList.push_back(hwnd);
2679 }
2680 }
2681 else if (!_stricmp(enumClassName, "Button"))
2682 {
2683 GetWindowText(hwnd, enumWindowTitle, sizeof(enumWindowTitle));
2684 if (!_stricmp(enumWindowTitle, "Start")) // -> The Start button in Windows Vista/7 [...iirc?]
2685 {
2686 ShowWindow(hwnd, SW_HIDE);
2687 ExplorerWndList.push_back(hwnd);
2688 }
2689 }
2690/*
2691 else if (!_stricmp(enumClassName, "Progman"))
2692 {
2693 // ##### Note: This part commented out because for xoblite bb5 onwards we do not
2694 // want to hide the desktop window etc -> Kept for legacy reference only... #####
2695 GetWindowText(hwnd, enumWindowTitle, sizeof(enumWindowTitle));
2696 if (!_stricmp(enumWindowTitle, "Program Manager"))
2697 {
2698 ShowWindow(hwnd, SW_HIDE);
2699 ExplorerWndList.push_back(hwnd);
2700 }
2701 }
2702*/
2703/*
2704 else if (!_stricmp(enumClassName, "Progman"))
2705 {
2706 GetWindowText(hwnd, enumWindowTitle, sizeof(enumWindowTitle));
2707 if (!_stricmp(enumWindowTitle, "Program Manager"))
2708 {
2709 HWND desktopIconsWindow = FindWindowEx(hwnd, NULL, "SHELLDLL_DefView", "");
2710 if (desktopIconsWindow != NULL)
2711 {
2712 desktopIconsWindow = FindWindowEx(desktopIconsWindow, NULL, "SysListView32", "FolderView");
2713 if (desktopIconsWindow != NULL)
2714 {
2715 ShowWindow(desktopIconsWindow, SW_HIDE);
2716 ExplorerWndList.push_back(desktopIconsWindow);
2717 }
2718 }
2719 }
2720 }
2721*/
2722 else if (!_stricmp(enumClassName, "BaseBar"))
2723 {
2724 ShowWindow(hwnd, SW_HIDE);
2725 ExplorerWndList.push_back(hwnd);
2726 }
2727 }
2728
2729 return true;
2730}
char enumWindowTitle[MAX_LINE_LENGTH]
Definition Broams.cpp:2664
char enumClassName[MAX_LINE_LENGTH]
Definition Broams.cpp:2664

◆ CreateRunBox()

void CreateRunBox ( HINSTANCE hMainInstance,
LPSTR commandString,
LPSTR initString )
2740{
2741 if (commandString != NULL) strcpy(runBoxCommand, commandString);
2742 else runBoxCommand[0] = '\0';
2743
2744 if (!runBoxWindow)
2745 {
2746 RECT workArea;
2747 ZeroMemory(&workArea, sizeof(workArea));
2748 SystemParametersInfo(SPI_GETWORKAREA, 0, &workArea, 0);
2749
2750 int editboxWidth = (workArea.right - workArea.left) / 2;
2751 int editboxHeight = 15 * pSettings->scalingFactorHiDPI; // Using a fixed font size of 15 pixels times the HiDPI scaling factor... (Segoe UI)
2752 editboxHeight += 12; // Add vertical padding to allow for a WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE sunken double border (see extended window styles below)
2753 int editboxX = editboxWidth / 2;
2754 int editboxY = ((workArea.bottom - workArea.top) / 2) - (editboxHeight / 2);
2755
2756 runBoxWindow = CreateWindowEx(
2757 WS_EX_TOOLWINDOW | WS_EX_TOPMOST | WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE, // window style
2758 "EDIT", // window class
2759 NULL, // window name
2760 WS_POPUP | WS_BORDER | ES_LEFT | ES_AUTOHSCROLL, // window parameters
2761 editboxX, // x position
2762 editboxY, // y position
2763 editboxWidth, // window width
2764 editboxHeight, // window height
2765 GetBBWnd(), // parent window
2766 NULL, // no menu
2767 hMainInstance, // hInstance
2768 NULL // no window creation data
2769 );
2770
2771 if (!runBoxWindow)
2772 {
2773 MessageBox(0, "Error creating run box window!", "xoblite", MB_OK | MB_ICONERROR | MB_TOPMOST);
2774 Log("xoblite", "Error creating run box window!");
2775 runBoxWindow = NULL;
2776 }
2777 else
2778 {
2779 if (runBoxFont) DeleteObject(runBoxFont);
2780 int runBoxFontSize = 15 * pSettings->scalingFactorHiDPI;
2781 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");
2782
2783 SendMessage(runBoxWindow, (UINT)WM_SETFONT, (WPARAM)runBoxFont, TRUE);
2784 SendMessage(runBoxWindow, (UINT)EM_SETLIMITTEXT, (WPARAM)MAX_LINE_LENGTH, 0); // Allow maximum 4096 characters in the edit control
2785 if (strlen(initString) > 0) SendMessage(runBoxWindow, WM_SETTEXT, 0, (LPARAM)initString); // -> Init string specified
2786 else SendMessage(runBoxWindow, WM_SETTEXT, 0, (LPARAM)runBoxString); // -> Init string not specified -> Use the last run box history entry
2787 SendMessage(runBoxWindow, EM_SETSEL, (WPARAM)0, (LPARAM)-1); // Select all text in the edit control
2788
2789 // Add a subclass to the edit window to be able to respond to the Return/Enter and Escape keys (not visible to the parent WndProc) being pressed...
2790 SetWindowSubclass(runBoxWindow, RunBoxWindowSubclassProc, 0, 0);
2791
2792 ShowWindow(runBoxWindow, SW_SHOW);
2793 SetWindowPos(runBoxWindow, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE);
2794 SetForegroundWindow(runBoxWindow);
2795
2797 }
2798 }
2799 else DestroyRunBox();
2800}
void Log(LPCSTR des, LPCSTR line)
Definition BBApi.cpp:638
LRESULT CALLBACK RunBoxWindowSubclassProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
Definition Broams.cpp:2819
char runBoxCommand[MAX_LINE_LENGTH]
Definition Broams.cpp:2736
char runBoxString[MAX_LINE_LENGTH]
Definition Broams.cpp:2737
void DestroyRunBox()
Definition Broams.cpp:2804
HFONT runBoxFont
Definition Broams.cpp:2735
HWND runBoxWindow
Definition Broams.cpp:2734

◆ DestroyRunBox()

void DestroyRunBox ( )
2805{
2806 if (runBoxWindow)
2807 {
2808 ShowWindow(runBoxWindow, SW_HIDE);
2809 RemoveWindowSubclass(runBoxWindow, RunBoxWindowSubclassProc, 0);
2810 DestroyWindow(runBoxWindow);
2811 runBoxWindow = NULL;
2812 }
2813
2814 if (runBoxFont) DeleteObject(runBoxFont);
2815}

◆ RunBoxWindowSubclassProc()

LRESULT CALLBACK RunBoxWindowSubclassProc ( HWND hwnd,
UINT message,
WPARAM wParam,
LPARAM lParam,
UINT_PTR uIdSubclass,
DWORD_PTR dwRefData )
2820{
2821 if (runBoxWindow && (message == WM_KEYDOWN))
2822 {
2823 if (wParam == VK_RETURN)
2824 {
2825 // The user has pressed the Return/Enter key -> Execute the command entered in the run box, or send the applicable post-editing callback broam...
2826 if (strlen(runBoxCommand))
2827 {
2828 char editedString[MAX_LINE_LENGTH], callback[MAX_LINE_LENGTH];
2829 SendMessage(runBoxWindow, WM_GETTEXT, MAX_LINE_LENGTH, (LPARAM)&editedString); // Fetch the edited string from the run box... (nb. *not* added to run box history)
2830 ShowWindow(runBoxWindow, SW_HIDE); // Hide the run box to let the focus go back to the previously active task first...
2831 sprintf(callback, "%s %s", runBoxCommand, editedString);
2832 BBSmartExecute(callback); // Execute the post-editing callback broam... (with command+parameters depending on the prior input)
2833 }
2834 else
2835 {
2836 SendMessage(runBoxWindow, WM_GETTEXT, MAX_LINE_LENGTH, (LPARAM)&runBoxString); // Fetch the command string from the run box... (nb. added to run box history)
2837 ShowWindow(runBoxWindow, SW_HIDE); // Hide the run box to let the focus go back to the previously active task first...
2838 BBSmartExecute(runBoxString); // Execute the command... (this could be a bro@m, an @Script, a regular command, a URL, a ? <searchstring>, etc, see BBSmartExecute() in BBApi.cpp)
2839 }
2840// PlaySoundFX(SFX_MENU_CLICK);
2841
2842 // ...and then close the run box...
2843 DestroyRunBox();
2844 }
2845 else if (wParam == VK_ESCAPE)
2846 {
2847 // The user has pressed the Escape key -> Close the run box *without* executing any entered command...
2848 DestroyRunBox();
2849 }
2850 }
2851
2852 return DefSubclassProc(hwnd, message, wParam, lParam);
2853}

Variable Documentation

◆ pSettings

Settings* pSettings
extern

◆ pMenuCommon

MenuCommon* pMenuCommon
extern

◆ pDock

Dock* pDock
extern

◆ pConsole

Console* pConsole
extern

◆ pDesktop

Desktop* pDesktop
extern

◆ pPluginManager

PluginManager* pPluginManager
extern

◆ pToolbar

Toolbar* pToolbar
extern

◆ pTaskbar

Taskbar* pTaskbar
extern

◆ pTooltips

Tooltips* pTooltips
extern

◆ pWorkspaces

Workspaces* pWorkspaces
extern

◆ pHotkeys

Hotkeys* pHotkeys
extern

◆ pWallpaper

Wallpaper* pWallpaper
extern

◆ numberOfFiles

unsigned int numberOfFiles

◆ currentFile

unsigned int currentFile

◆ randomFile

unsigned int randomFile

◆ pathToScan

char pathToScan[MAX_PATH]

◆ pathToFile

char pathToFile[MAX_PATH]

◆ ExplorerWndList

vector<HWND> ExplorerWndList

◆ enumClassName

char enumClassName[MAX_LINE_LENGTH]

◆ enumWindowTitle

char enumWindowTitle[MAX_LINE_LENGTH]

◆ runBoxWindow

HWND runBoxWindow = NULL

◆ runBoxFont

HFONT runBoxFont = NULL

◆ runBoxCommand

char runBoxCommand[MAX_LINE_LENGTH] = "\0"

◆ runBoxString

char runBoxString[MAX_LINE_LENGTH] = "@xoblite "