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: // === Mouse ===
326: int mouseWiggleHorizontalThreshold;
327: char mouseWiggleHorizontalCommand[MAX_LINE_LENGTH];
328: int mouseWiggleVerticalThreshold;
329: char mouseWiggleVerticalCommand[MAX_LINE_LENGTH];
330:
331: // === Workspaces ===
332: int numberOfWorkspaces;
333: char workspaceNames[MAX_LINE_LENGTH];
334: bool mousewheelChanging;
335: bool followActive;
336: bool wallpaperPerWorkspace;
337: bool wallpaperPerWorkspaceSemaphore; // (Used to suppress "wallpaper changed" messages in the console on workspace change.)
338:
339: // === Plugins ===
340: char pluginsFile[MAX_PATH];
341: bool pluginsHidden;
342: char pluginsRepository[MAX_LINE_LENGTH];
343:
344: // === Design+Global ===
345: char themesFolder[MAX_PATH];
346: char stylesFolder[MAX_PATH];
347: char wallpapersFolder[MAX_PATH];
348: char soundsFolder[MAX_PATH];
349: char selectedTheme[MAX_PATH];
350: char styleFile[MAX_PATH];
351:
352: bool doubleScaleHiDPI; // TO BE REMOVED
353: int scalingFactorHiDPI;
354: bool multimonPlacements;
355: bool fullscreenDetection;
356: bool enableSoundFX;
357: bool designerModeEnabled;
358: bool writeProtection;
359: bool disableRootCommands;
360: bool disableThemeFonts;
361: bool disableScriptSupport;
362: bool disableUnicodeParsing;
363:
364: bool explorerHidden;
365:
366: char timeDateLocale[MAX_LINE_LENGTH];
367:
368: char preferredEditor[MAX_LINE_LENGTH];
369: char checkedForUpdates[20];
370:
371: // bool focusLastWindow;
372: // char windowPlacement[MAX_LINE_LENGTH];
373: // char colPlacementDirection[MAX_LINE_LENGTH];
374: // bool focusNewWindows;
375: // char rowPlacementDirection[MAX_LINE_LENGTH];
376:
377: // char focusModel[MAX_LINE_LENGTH];
378: // bool opaqueMove;
379: // bool fullMaximization;
380:
381: int edgeSnapThreshold;
382: // int doubleClickInterval;
383: // int autoRaiseDelay;
384:
385: // RECT desktopArea;
386: // bool desktopAreaDefined;
387:
388: bool debugLogging;
389:
390: //===========================================================================
391:
392: USHORT machineArchitecture;
393: int operatingSystemVersion;
394: BOOL runningUnderWOW64;
395: bool underExplorer;
396:
397: bool accessLock;
398:
399: int currentWorkspace;
400: int lastWorkspace;
401:
402: //====================
403:
404: char SF_blackboxPath[MAX_PATH];
405: char SF_startMenu[MAX_PATH];
406: char SF_commonStartMenu[MAX_PATH];
407: char SF_programFiles[MAX_PATH];
408: char SF_programFilesX86[MAX_PATH];
409: char SF_desktop[MAX_PATH];
410: char SF_userAppData[MAX_PATH];
411: char SF_userProfile[MAX_PATH];
412:
413: char SF_currentThemePath[MAX_PATH];
414: bool usingDefaultTheme;
415:
416: bool menuEditboxAlreadyActive;
417: MenuItem* menuEditboxStringItemPtr;
418:
419: bool checkingForUpdates;
420:
421: struct Statistics
422: {
423: int changedTheme;
424: int changedStyle;
425: int changedWallpaper;
426: int usedAHotkey;
427: int executedBroams;
428: } Statistics;
429:
430: //====================
431:
432: char bbrcFile[MAX_LINE_LENGTH]; // Legacy blackbox.rc (for backwards compatibility)
433: char xobrcFile[MAX_LINE_LENGTH]; // xoblite.rc theme specific settings
434: char xobrcDefaultFile[MAX_LINE_LENGTH]; // xoblite.rc universal settings
435:
436: char* bbrcCache;
437: char* xobrcCache;
438: char* xobrcDefaultCache;
439:
440: //===========================================================================
441: // ################# STYLE RELATED PARAMETERS AND SETTINGS ##################
442: //===========================================================================
443:
444: char* styleCache;
445:
446: //====================
447:
448: // Wildcard (top level only, e.g. *.parameter)
449: StyleItem* Wildcard;
450:
451: // Toolbar
452: StyleItem* Toolbar;
453: StyleItem* ToolbarLabel;
454: StyleItem* ToolbarWindowLabel;
455: StyleItem* ToolbarClock;
456: StyleItem* ToolbarButton;
457: StyleItem* ToolbarButtonPressed;
458: StyleItem* ToolbarBorder;
459:
460: // Menu
461: StyleItem* MenuTitle;
462: StyleItem* MenuFrame;
463: StyleItem* MenuActive;
464: StyleItem* MenuGrip;
465: StyleItem* MenuFrameBullet;
466: StyleItem* MenuActiveBullet;
467: StyleItem* MenuIndicator;
468: StyleItem* MenuSeparator;
469: StyleItem* MenuFrameBorder;
470:
471: // Dock
472: StyleItem* Dock;
473: StyleItem* DockBorder;
474:
475: // Taskbar
476: StyleItem* ActiveTask;
477: StyleItem* InactiveTask;
478: StyleItem* FlashingTask;
479:
480: // Console
481: StyleItem* Console;
482:
483: // Windows
484: StyleItem* WindowTitleFocus;
485: StyleItem* WindowTitleUnfocus;
486: StyleItem* WindowLabelFocus;
487: StyleItem* WindowLabelUnfocus;
488: StyleItem* WindowButtonFocus;
489: StyleItem* WindowButtonUnfocus;
490: StyleItem* WindowButtonPressed;
491: StyleItem* WindowGripFocus;
492: StyleItem* WindowGripUnfocus;
493: StyleItem* WindowHandleFocus;
494: StyleItem* WindowHandleUnfocus;
495:
496: // Hardware
497: StyleItem* ExternalHardware;
498:
499: StyleItem* selectedElement; // Used by the xoblite Designer mode (see Broams.cpp), pointer to the currently selected UI element StyleItem (see above)
500:
501: //====================
502:
503: // Additional wildcard settings
504: char wildcardToolbarFont[255];
505: char wildcardMenuFont[255];
506: char wildcardWindowFont[255];
507:
508: // Appearance in string format... (used for caching purposes; not part of the current StyleItem definition)
509: char wildcard[MAX_LINE_LENGTH];
510: char toolbar[MAX_LINE_LENGTH];
511: char toolbarLabel[MAX_LINE_LENGTH];
512: char toolbarWindowLabel[MAX_LINE_LENGTH];
513: char toolbarClock[MAX_LINE_LENGTH];
514: char toolbarButton[MAX_LINE_LENGTH];
515: char toolbarButtonPressed[MAX_LINE_LENGTH];
516: char toolbarBorder[MAX_LINE_LENGTH];
517: char menuTitle[MAX_LINE_LENGTH];
518: char menuFrame[MAX_LINE_LENGTH];
519: char menuActive[MAX_LINE_LENGTH];
520: char menuGrip[MAX_LINE_LENGTH];
521: char menuIndicator[MAX_LINE_LENGTH];
522: char menuSeparator[MAX_LINE_LENGTH];
523: char menuFrameBorder[MAX_LINE_LENGTH];
524: char dock[MAX_LINE_LENGTH];
525: char dockBorder[MAX_LINE_LENGTH];
526: char console[MAX_LINE_LENGTH];
527: char windowTitleFocus[MAX_LINE_LENGTH];
528: char windowTitleUnfocus[MAX_LINE_LENGTH];
529: char windowLabelFocus[MAX_LINE_LENGTH];
530: char windowLabelUnfocus[MAX_LINE_LENGTH];
531: char windowButtonFocus[MAX_LINE_LENGTH];
532: char windowButtonUnfocus[MAX_LINE_LENGTH];
533: char windowButtonPressed[MAX_LINE_LENGTH];
534: char windowGripFocus[MAX_LINE_LENGTH];
535: char windowGripUnfocus[MAX_LINE_LENGTH];
536: char windowHandleFocus[MAX_LINE_LENGTH];
537: char windowHandleUnfocus[MAX_LINE_LENGTH];
538: char externalHardware[MAX_LINE_LENGTH];
539: LPSTR appearancePointer;
540: /*
541: // Shadow colours (not part of the current StyleItem definition)
542: COLORREF toolbarLabelShadowColor;
543: COLORREF toolbarWindowLabelShadowColor;
544: COLORREF toolbarClockShadowColor;
545: COLORREF menuTitleShadowColor;
546: COLORREF menuFrameShadowColor;
547: COLORREF menuActiveShadowColor;
548: COLORREF activeTaskShadowColor;
549: COLORREF inactiveTaskShadowColor;
550: COLORREF flashingTaskShadowColor;
551:
552: // Outline booleans and colours (not part of the current StyleItem definition)
553: bool menuTitleOutline;
554: COLORREF menuTitleOutlineColor;
555: bool menuFrameOutline;
556: COLORREF menuFrameOutlineColor;
557: bool menuActiveOutline;
558: COLORREF menuActiveOutlineColor;
559: bool toolbarLabelOutline;
560: COLORREF toolbarLabelOutlineColor;
561: bool toolbarWindowLabelOutline;
562: COLORREF toolbarWindowLabelOutlineColor;
563: bool toolbarClockOutline;
564: COLORREF toolbarClockOutlineColor;
565: */
566: // Bullets for submenu items (not part of the current StyleItem definition)
567: int menuBullet;
568: char menuFrameBulletAsString[MAX_LINE_LENGTH];
569: char menuActiveBulletAsString[MAX_LINE_LENGTH];
570: char menuBulletPosition[MAX_LINE_LENGTH];
571: // COLORREF menuFrameBulletColor;
572: // COLORREF menuActiveBulletColor;
573:
574: // Console font
575: bool consoleFontDefined;
576: char consoleFont[128];
577: int consoleFontHeight;
578: int consoleFontWeight;
579:
580: // Global font override (nb. only used if specified in xoblite.rc)
581: bool globalFontOverride;
582: char globalFont[128];
583: int globalFontHeight;
584:
585: //====================
586:
587: int borderWidth;
588: int menuBorderWidth;
589: COLORREF borderColor;
590: COLORREF menuBorderColor;
591:
592: int bevelWidth;
593: int marginWidth;
594: int handleHeight;
595:
596: int frameWidth;
597:
598: char rootCommand[MAX_LINE_LENGTH];
599:
600: //====================
601:
602: int ScreenWidth;
603: int ScreenHeight;
604: int ScreenX;
605: int ScreenY;
606:
607: BYTE red, green, blue;
608: };
609:
610: //===========================================================================
611:
612: #endif /*__BBSETTINGS_H */
613: