1: /*
2: ============================================================================
3: xoblite™ -> an advanced "extended shell" for Microsoft® Windows® 11
4: Copyright © 2002-2026 Karl Henrik Henriksson [qwilk/@xoblite]
5: Copyright © 2001-2004 The Blackbox for Windows Development Team
6: http://xoblite.net/ + https://github.com/xoblite/
7: ============================================================================
8:
9: Blackbox for Windows is free software, released under the
10: GNU General Public License (GPL version 2 or later), with an extension
11: that allows linking of proprietary modules under a controlled interface.
12: What this means is that plugins etc. are allowed to be released
13: under any license the author wishes. Please note, however, that the
14: original Blackbox gradient math code used in Blackbox for Windows
15: is available under the BSD license.
16:
17: http://www.fsf.org/licenses/gpl.html
18: http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface
19: http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5
20:
21: This program is distributed in the hope that it will be useful,
22: but WITHOUT ANY WARRANTY; without even the implied warranty of
23: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24: GNU General Public License for more details.
25:
26: For additional license information, please read the included license.html.
27:
28: ============================================================================
29: */
30:
31: #ifndef __BBSETTINGS_H
32: #define __BBSETTINGS_H
33:
34: #include "..\API\BBApi.h"
35:
36: //====================
37:
38: #define COLOR_UNDEFINED -1
39:
40: //====================
41:
42: #define TASKBAR_MODE_HIDDEN 0
43: #define TASKBAR_MODE_BARS 1
44: #define TASKBAR_MODE_BARSICONS 2
45: #define TASKBAR_MODE_ICONS 3
46:
47: #define TASKBAR_SORT_DISABLED 0
48: #define TASKBAR_SORT_FOLLOW_ACTIVE 1
49: #define TASKBAR_SORT_BY_LAST_USED 2
50: //#define TASKBAR_SORT_BY_NAME 3
51:
52: //====================
53:
54: #define MENU_BULLET_EMPTY 0
55: #define MENU_BULLET_DIAMOND 1
56: #define MENU_BULLET_SQUARE 2
57: #define MENU_BULLET_TRIANGLE 3
58: #define MENU_BULLET_CIRCLE 4
59: #define MENU_BULLET_TRIPLE 5
60: #define MENU_BULLET_COMMENT 6
61: #define MENU_BULLET_GRID 7
62: #define MENU_BULLET_QUAD 8
63: #define MENU_BULLET_IMAGE 255
64:
65: //====================
66:
67: #define PLACEMENT_MANUAL 0
68: #define PLACEMENT_TOP_LEFT 1
69: #define PLACEMENT_TOP_CENTER 2
70: #define PLACEMENT_TOP_RIGHT 3
71: #define PLACEMENT_CENTER_LEFT 4
72: #define PLACEMENT_CENTER_CENTER 5
73: #define PLACEMENT_CENTER_RIGHT 6
74: #define PLACEMENT_BOTTOM_LEFT 7
75: #define PLACEMENT_BOTTOM_CENTER 8
76: #define PLACEMENT_BOTTOM_RIGHT 9
77: #define PLACEMENT_DEFAULT 10
78: #define PLACEMENT_OPPOSITE_TOOLBAR 11
79:
80: #define PLACEMENT_LEFT_HALF 21 // Used for window tiling only
81: #define PLACEMENT_RIGHT_HALF 22 // Used for window tiling only
82: #define PLACEMENT_TOP_HALF 23 // Used for window tiling only
83: #define PLACEMENT_BOTTOM_HALF 24 // Used for window tiling only
84: #define PLACEMENT_CENTERED 25 // Used for window tiling only
85:
86: typedef struct Placement
87: {
88: public:
89: int placement;
90: int rcx; // x placement (as parsed from input string, in turn typically read from settings .rc)
91: int rcy; // y placement (as parsed from input string, in turn typically read from settings .rc)
92: bool centeredx;
93: bool centeredy;
94: int x; // x position in screen coordinates (calculated)
95: int y; // y position in screen coordinates (calculated)
96: int width;
97: int height;
98: char rcString[255];
99: } Placement;
100:
101: //====================
102:
103: #define OSVERSION_WIN95 0x0400 // Windows 95
104: #define OSVERSION_WIN98 0x0410 // Windows 98
105: #define OSVERSION_WINME 0x0490 // Windows ME
106:
107: #define OSVERSION_WINNT4 0x1400 // Windows NT4
108:
109: #define OSVERSION_WIN2K 0x1500 // Windows 2000
110: #define OSVERSION_WINXP 0x1501 // Windows XP
111: #define OSVERSION_WIN2003 0x1502 // Windows Server 2003
112:
113: #define OSVERSION_WINVISTA 0x1600 // Windows Vista & Windows Server 2008
114: #define OSVERSION_WIN7 0x1601 // Windows 7
115: #define OSVERSION_WIN8 0x1602 // Windows 8
116: #define OSVERSION_WIN81 0x1603 // Windows 8.1
117: #define OSVERSION_WIN10 0x1a00 // Windows 10
118: #define OSVERSION_WIN11 0x1a01 // Windows 11
119:
120: //===========================================================================
121:
122: class Settings
123: {
124: public:
125: Settings();
126: ~Settings();
127:
128: void InitStyleItems();
129: void InitStyleItem(StyleItem* styleItem);
130: void DestroyStyleItems();
131: void DestroyStyleItem(StyleItem* styleItem);
132:
133: LPSTR CreateFileCache(LPSTR path);
134: void DestroyFileCache(LPSTR cachedFilePtr);
135:
136: void ReadConfiguration();
137: void WriteDefaultRCSettings();
138: void WriteDefaultMenu();
139:
140: void ReadStyle();
141: bool ReadStyleElement(LPSTR styleBuffer, StyleItem* styleItem, LPSTR paramString, bool readFont);
142: void DeriveTaskbarStyle();
143: COLORREF CreateShadowColor(StyleItem* styleItem, COLORREF color, COLORREF colorTo, COLORREF textColor);
144: COLORREF InvertColor(COLORREF color);
145: COLORREF MixColors(COLORREF colorA, COLORREF colorB);
146:
147: void GetShellFolders();
148:
149: bool GetBool(LPCSTR fp, LPSTR buffer, LPCSTR szString, bool szDefault);
150: int GetInt(LPCSTR fp, LPSTR buffer, LPCSTR szString, int szDefault);
151: LPSTR GetString(LPCSTR fp, LPSTR buffer, LPCSTR szString, LPSTR szDefault);
152: LPWSTR GetStringUnicode(LPCSTR fp, LPSTR cachedFilePtr, LPCSTR szString, LPWSTR szDefault);
153: COLORREF GetColor(LPCSTR fp, LPSTR buffer, LPCSTR szString, LPCSTR szDefault, COLORREF szDefaultRef, bool useDefaultRef);
154:
155: LPSTR GetValueFromCache(LPSTR cachedFilePtr, LPCSTR szString);
156: bool CheckForComment(LPSTR cachedFilePtr, LPSTR ptr);
157:
158: void UpdateAppearanceString(StyleItem* styleItem);
159: LPSTR GetAlignmentAsString(StyleItem* styleItem);
160:
161: void ParsePlacement(LPSTR inputString, Placement* outputPlacement);
162: void PositionFromPlacement(Placement* inputPlacement);
163: void WritePlacement(Placement* inputPlacement);
164:
165: void WriteStyle();
166: void WriteStyleElement(HANDLE file, StyleItem* styleItem);
167:
168: //===========================================================================
169: // ############# CONFIGURATION RELATED PARAMETERS AND SETTINGS ##############
170: //===========================================================================
171: // -> xoblite.rc (including previous blackbox.rc + extensions.rc) settings
172: //===========================================================================
173:
174: // === Menu ===
175: char menuFile[MAX_LINE_LENGTH];
176: bool menuSeparators;
177: bool menuRoundedCorners;
178: BYTE menuTransparencyAlpha;
179: BYTE menuTitleTransparencyAlpha;
180: BYTE menuFrameTransparencyAlpha;
181: BYTE menuGripTransparencyAlpha;
182: BYTE menuActiveTransparencyAlpha;
183: int submenuGap;
184: int submenuDelay;
185: // int scrollSpeed;
186: // int wheelSpeed;
187:
188: // === Toolbar+Taskbar ===
189: bool toolbarHidden;
190: Placement ToolbarPlacement;
191: char toolbarPlacementString[MAX_LINE_LENGTH];
192: bool toolbarVertical;
193: int toolbarHorizontalWidth;
194: int toolbarVerticalWidth;
195: bool toolbarSnapToEdges;
196: BYTE toolbarTransparencyAlpha;
197: BYTE toolbarLabelTransparencyAlpha;
198: BYTE toolbarWindowLabelTransparencyAlpha;
199: BYTE toolbarClockTransparencyAlpha;
200: BYTE toolbarButtonTransparencyAlpha;
201: bool toolbarRoundedCorners;
202: bool toolbarOnTop;
203: char toolbarClockFormat[MAX_LINE_LENGTH];
204:
205: bool toolbarLabelHidden;
206: bool toolbarDownUpButtonsHidden;
207: bool toolbarLeftRightButtonsHidden;
208: bool toolbarClockHidden;
209: bool toolbarAllowAsymmetry;
210:
211: char toolbarLabelDLClickOverride[MAX_LINE_LENGTH];
212: char toolbarLabelRClickOverride[MAX_LINE_LENGTH];
213: char toolbarLabelMClickOverride[MAX_LINE_LENGTH];
214: char toolbarLabelX1ClickOverride[MAX_LINE_LENGTH];
215: char toolbarLabelX2ClickOverride[MAX_LINE_LENGTH];
216:
217: char toolbarClockDLClickOverride[MAX_LINE_LENGTH];
218: char toolbarClockRClickOverride[MAX_LINE_LENGTH];
219: char toolbarClockMClickOverride[MAX_LINE_LENGTH];
220: char toolbarClockX1ClickOverride[MAX_LINE_LENGTH];
221: char toolbarClockX2ClickOverride[MAX_LINE_LENGTH];
222:
223: char toolbarDownButtonOverride[MAX_LINE_LENGTH];
224: char toolbarUpButtonOverride[MAX_LINE_LENGTH];
225: char toolbarLeftButtonOverride[MAX_LINE_LENGTH];
226: char toolbarRightButtonOverride[MAX_LINE_LENGTH];
227:
228: int taskbarMode;
229: int taskbarMaxItems;
230: int taskbarSorting;
231: bool taskbarShowTaskWorkspace;
232: bool taskbarCurrentOnly;
233: bool taskbarFlashing;
234: unsigned int taskbarSaturationValue;
235: unsigned int taskbarHueIntensity;
236: bool taskbarActiveSatHue;
237: BYTE taskbarActiveTransparencyAlpha;
238: bool taskbarActiveLivePreview;
239: bool taskbarInactiveBackground;
240: bool taskbarPreviews;
241: bool taskbarTooltips;
242:
243: // === Dock ===
244: bool dockHidden;
245: Placement DockPlacement;
246: char dockPlacementString[MAX_LINE_LENGTH];
247: char dockDirection[MAX_LINE_LENGTH];
248: bool dockVertical;
249: bool dockPuzzlePositioning;
250: bool dockOnTop;
251: bool dockSnapToEdges;
252: BYTE dockTransparencyAlpha;
253:
254: // === Console ===
255: bool consoleHidden;
256: Placement ConsolePlacement;
257: bool consoleMaximized;
258: int consoleMaximizedWidth;
259: int consoleMaximizedMessages;
260: int consoleRestoredWidth;
261: int consoleRestoredMessages;
262: BYTE consoleTransparencyAlpha;
263: bool consoleDesktopMode;
264: bool consoleRoundedCorners;
265: int consolePadding;
266:
267: // === Desktop ===
268: bool desktopClockHidden;
269: char desktopClockType[MAX_LINE_LENGTH];
270: Placement desktopClockPlacement;
271: BYTE desktopClockTransparencyAlpha;
272: bool desktopClockFontDefined;
273: char desktopClockFont[128];
274: int desktopClockFontHeight;
275: int desktopClockFontWeight;
276:
277: bool desktopWeekdayHidden;
278: Placement desktopWeekdayPlacement;
279: BYTE desktopWeekdayTransparencyAlpha;
280: bool desktopWeekdayFontDefined;
281: char desktopWeekdayFont[128];
282: int desktopWeekdayFontHeight;
283: int desktopWeekdayFontWeight;
284:
285: bool desktopDateHidden;
286: char desktopDateFormat[MAX_LINE_LENGTH];
287: Placement desktopDatePlacement;
288: BYTE desktopDateTransparencyAlpha;
289: bool desktopDateFontDefined;
290: char desktopDateFont[128];
291: int desktopDateFontHeight;
292: int desktopDateFontWeight;
293:
294: bool desktopGreetingHidden;
295: Placement desktopGreetingPlacement;
296: BYTE desktopGreetingTransparencyAlpha;
297: bool desktopGreetingFontDefined;
298: char desktopGreetingFont[128];
299: int desktopGreetingFontHeight;
300: int desktopGreetingFontWeight;
301: wchar_t desktopGreetingNight[256];
302: wchar_t desktopGreetingMorning[256];
303: wchar_t desktopGreetingAfternoon[256];
304: wchar_t desktopGreetingEvening[256];
305:
306: bool desktopWorkspaceIndicatorHidden;
307: bool desktopBorderHidden;
308:
309: COLORREF desktopWidgetColor;
310: COLORREF desktopClockColor;
311: COLORREF desktopWeekdayColor;
312: COLORREF desktopDateColor;
313: COLORREF desktopGreetingColor;
314:
315: bool desktopDisableGDIplusForWidgets;
316:
317: char desktopRClickOverride[MAX_LINE_LENGTH];
318: char desktopMClickOverride[MAX_LINE_LENGTH];
319: char desktopX1ClickOverride[MAX_LINE_LENGTH];
320: char desktopX2ClickOverride[MAX_LINE_LENGTH];
321:
322: // === Hotkeys ===
323: char hotkeysFile[MAX_PATH];
324:
325: // === Workspaces ===
326: int numberOfWorkspaces;
327: char workspaceNames[MAX_LINE_LENGTH];
328: bool mousewheelChanging;
329: bool followActive;
330: bool wallpaperPerWorkspace;
331: bool wallpaperPerWorkspaceSemaphore; // (Used to suppress "wallpaper changed" messages in the console on workspace change.)
332:
333: // === Plugins ===
334: char pluginsFile[MAX_PATH];
335: bool pluginsHidden;
336: char pluginsRepository[MAX_LINE_LENGTH];
337:
338: // === Design+Global ===
339: char themesFolder[MAX_PATH];
340: char stylesFolder[MAX_PATH];
341: char wallpapersFolder[MAX_PATH];
342: char soundsFolder[MAX_PATH];
343: char selectedTheme[MAX_PATH];
344: char styleFile[MAX_PATH];
345:
346: bool doubleScaleHiDPI; // TO BE REMOVED
347: int scalingFactorHiDPI;
348: bool multimonPlacements;
349: bool fullscreenDetection;
350: bool enableSoundFX;
351: bool designerModeEnabled;
352: bool writeProtection;
353: bool disableRootCommands;
354: bool disableThemeFonts;
355: bool disableScriptSupport;
356: bool disableUnicodeParsing;
357:
358: bool explorerHidden;
359:
360: char timeDateLocale[MAX_LINE_LENGTH];
361:
362: char preferredEditor[MAX_LINE_LENGTH];
363: char checkedForUpdates[20];
364:
365: // bool focusLastWindow;
366: // char windowPlacement[MAX_LINE_LENGTH];
367: // char colPlacementDirection[MAX_LINE_LENGTH];
368: // bool focusNewWindows;
369: // char rowPlacementDirection[MAX_LINE_LENGTH];
370:
371: // char focusModel[MAX_LINE_LENGTH];
372: // bool opaqueMove;
373: // bool fullMaximization;
374:
375: int edgeSnapThreshold;
376: // int doubleClickInterval;
377: // int autoRaiseDelay;
378:
379: // RECT desktopArea;
380: // bool desktopAreaDefined;
381:
382: bool debugLogging;
383:
384: //===========================================================================
385:
386: USHORT machineArchitecture;
387: int operatingSystemVersion;
388: BOOL runningUnderWOW64;
389: bool underExplorer;
390:
391: bool accessLock;
392:
393: int currentWorkspace;
394: int lastWorkspace;
395:
396: //====================
397:
398: char SF_blackboxPath[MAX_PATH];
399: char SF_startMenu[MAX_PATH];
400: char SF_commonStartMenu[MAX_PATH];
401: char SF_programFiles[MAX_PATH];
402: char SF_programFilesX86[MAX_PATH];
403: char SF_desktop[MAX_PATH];
404: char SF_userAppData[MAX_PATH];
405: char SF_userProfile[MAX_PATH];
406:
407: char SF_currentThemePath[MAX_PATH];
408: bool usingDefaultTheme;
409:
410: bool menuEditboxAlreadyActive;
411: MenuItem* menuEditboxStringItemPtr;
412:
413: bool checkingForUpdates;
414:
415: struct Statistics
416: {
417: int changedTheme;
418: int changedStyle;
419: int changedWallpaper;
420: int usedAHotkey;
421: int executedBroams;
422: } Statistics;
423:
424: //====================
425:
426: char bbrcFile[MAX_LINE_LENGTH]; // Legacy blackbox.rc (for backwards compatibility)
427: char xobrcFile[MAX_LINE_LENGTH]; // xoblite.rc theme specific settings
428: char xobrcDefaultFile[MAX_LINE_LENGTH]; // xoblite.rc universal settings
429:
430: char* bbrcCache;
431: char* xobrcCache;
432: char* xobrcDefaultCache;
433:
434: //===========================================================================
435: // ################# STYLE RELATED PARAMETERS AND SETTINGS ##################
436: //===========================================================================
437:
438: char* styleCache;
439:
440: //====================
441:
442: // Wildcard (top level only, e.g. *.parameter)
443: StyleItem* Wildcard;
444:
445: // Toolbar
446: StyleItem* Toolbar;
447: StyleItem* ToolbarLabel;
448: StyleItem* ToolbarWindowLabel;
449: StyleItem* ToolbarClock;
450: StyleItem* ToolbarButton;
451: StyleItem* ToolbarButtonPressed;
452: StyleItem* ToolbarBorder;
453:
454: // Menu
455: StyleItem* MenuTitle;
456: StyleItem* MenuFrame;
457: StyleItem* MenuActive;
458: StyleItem* MenuGrip;
459: StyleItem* MenuFrameBullet;
460: StyleItem* MenuActiveBullet;
461: StyleItem* MenuIndicator;
462: StyleItem* MenuSeparator;
463: StyleItem* MenuFrameBorder;
464:
465: // Dock
466: StyleItem* Dock;
467: StyleItem* DockBorder;
468:
469: // Taskbar
470: StyleItem* ActiveTask;
471: StyleItem* InactiveTask;
472: StyleItem* FlashingTask;
473:
474: // Console
475: StyleItem* Console;
476:
477: // Windows
478: StyleItem* WindowTitleFocus;
479: StyleItem* WindowTitleUnfocus;
480: StyleItem* WindowLabelFocus;
481: StyleItem* WindowLabelUnfocus;
482: StyleItem* WindowButtonFocus;
483: StyleItem* WindowButtonUnfocus;
484: StyleItem* WindowButtonPressed;
485: StyleItem* WindowGripFocus;
486: StyleItem* WindowGripUnfocus;
487: StyleItem* WindowHandleFocus;
488: StyleItem* WindowHandleUnfocus;
489:
490: // Hardware
491: StyleItem* ExternalHardware;
492:
493: StyleItem* selectedElement; // Used by the xoblite Designer mode (see Broams.cpp), pointer to the currently selected UI element StyleItem (see above)
494:
495: //====================
496:
497: // Additional wildcard settings
498: char wildcardToolbarFont[255];
499: char wildcardMenuFont[255];
500: char wildcardWindowFont[255];
501:
502: // Appearance in string format... (used for caching purposes; not part of the current StyleItem definition)
503: char wildcard[MAX_LINE_LENGTH];
504: char toolbar[MAX_LINE_LENGTH];
505: char toolbarLabel[MAX_LINE_LENGTH];
506: char toolbarWindowLabel[MAX_LINE_LENGTH];
507: char toolbarClock[MAX_LINE_LENGTH];
508: char toolbarButton[MAX_LINE_LENGTH];
509: char toolbarButtonPressed[MAX_LINE_LENGTH];
510: char toolbarBorder[MAX_LINE_LENGTH];
511: char menuTitle[MAX_LINE_LENGTH];
512: char menuFrame[MAX_LINE_LENGTH];
513: char menuActive[MAX_LINE_LENGTH];
514: char menuGrip[MAX_LINE_LENGTH];
515: char menuIndicator[MAX_LINE_LENGTH];
516: char menuSeparator[MAX_LINE_LENGTH];
517: char menuFrameBorder[MAX_LINE_LENGTH];
518: char dock[MAX_LINE_LENGTH];
519: char dockBorder[MAX_LINE_LENGTH];
520: char console[MAX_LINE_LENGTH];
521: char windowTitleFocus[MAX_LINE_LENGTH];
522: char windowTitleUnfocus[MAX_LINE_LENGTH];
523: char windowLabelFocus[MAX_LINE_LENGTH];
524: char windowLabelUnfocus[MAX_LINE_LENGTH];
525: char windowButtonFocus[MAX_LINE_LENGTH];
526: char windowButtonUnfocus[MAX_LINE_LENGTH];
527: char windowButtonPressed[MAX_LINE_LENGTH];
528: char windowGripFocus[MAX_LINE_LENGTH];
529: char windowGripUnfocus[MAX_LINE_LENGTH];
530: char windowHandleFocus[MAX_LINE_LENGTH];
531: char windowHandleUnfocus[MAX_LINE_LENGTH];
532: char externalHardware[MAX_LINE_LENGTH];
533: LPSTR appearancePointer;
534: /*
535: // Shadow colours (not part of the current StyleItem definition)
536: COLORREF toolbarLabelShadowColor;
537: COLORREF toolbarWindowLabelShadowColor;
538: COLORREF toolbarClockShadowColor;
539: COLORREF menuTitleShadowColor;
540: COLORREF menuFrameShadowColor;
541: COLORREF menuActiveShadowColor;
542: COLORREF activeTaskShadowColor;
543: COLORREF inactiveTaskShadowColor;
544: COLORREF flashingTaskShadowColor;
545:
546: // Outline booleans and colours (not part of the current StyleItem definition)
547: bool menuTitleOutline;
548: COLORREF menuTitleOutlineColor;
549: bool menuFrameOutline;
550: COLORREF menuFrameOutlineColor;
551: bool menuActiveOutline;
552: COLORREF menuActiveOutlineColor;
553: bool toolbarLabelOutline;
554: COLORREF toolbarLabelOutlineColor;
555: bool toolbarWindowLabelOutline;
556: COLORREF toolbarWindowLabelOutlineColor;
557: bool toolbarClockOutline;
558: COLORREF toolbarClockOutlineColor;
559: */
560: // Bullets for submenu items (not part of the current StyleItem definition)
561: int menuBullet;
562: char menuFrameBulletAsString[MAX_LINE_LENGTH];
563: char menuActiveBulletAsString[MAX_LINE_LENGTH];
564: char menuBulletPosition[MAX_LINE_LENGTH];
565: // COLORREF menuFrameBulletColor;
566: // COLORREF menuActiveBulletColor;
567:
568: // Console font
569: bool consoleFontDefined;
570: char consoleFont[128];
571: int consoleFontHeight;
572: int consoleFontWeight;
573:
574: // Global font override (nb. only used if specified in xoblite.rc)
575: bool globalFontOverride;
576: char globalFont[128];
577: int globalFontHeight;
578:
579: //====================
580:
581: int borderWidth;
582: int menuBorderWidth;
583: COLORREF borderColor;
584: COLORREF menuBorderColor;
585:
586: int bevelWidth;
587: int marginWidth;
588: int handleHeight;
589:
590: int frameWidth;
591:
592: char rootCommand[MAX_LINE_LENGTH];
593:
594: //====================
595:
596: int ScreenWidth;
597: int ScreenHeight;
598: int ScreenX;
599: int ScreenY;
600:
601: BYTE red, green, blue;
602: };
603:
604: //===========================================================================
605:
606: #endif /*__BBSETTINGS_H */
607: