/*
 ============================================================================
 xoblite -> an alternative shell based on Blackbox for Windows
 Copyright  2002-2005 Karl-Henrik Henriksson [qwilk]
 Copyright  2001-2004 The Blackbox for Windows Development Team
 http://xoblite.net/ - #bb4win on irc.freenode.net
 ============================================================================

  Blackbox for Windows is free software, released under the
  GNU General Public License (GPL version 2 or later), with an extension
  that allows linking of proprietary modules under a controlled interface.
  What this means is that plugins etc. are allowed to be released
  under any license the author wishes. Please note, however, that the
  original Blackbox gradient math code used in Blackbox for Windows
  is available under the BSD license.

  http://www.fsf.org/licenses/gpl.html
  http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface
  http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  GNU General Public License for more details.

  For additional license information, please read the included license.html

 ============================================================================
*/

#ifndef __BBSETTINGS_H 
#define __BBSETTINGS_H 

#include "BBApi.h" 
#include <stdlib.h> 

//====================

// Included as we would get a FolderItem error if we tried to include shlobj.h... :(

/*
#ifndef SHFOLDERAPI
#if defined(_SHFOLDER_) || defined(_SHELL32_)
#define SHFOLDERAPI     STDAPI
#else
#define SHFOLDERAPI     EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
#endif
#endif

#ifndef SHGetFolderPath
SHFOLDERAPI SHGetFolderPathA(HWND hwnd, int csidl, HANDLE hToken, DWORD dwFlags, LPSTR pszPath);
SHFOLDERAPI SHGetFolderPathW(HWND hwnd, int csidl, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath);
#ifdef UNICODE
#define SHGetFolderPath  SHGetFolderPathW
#else
#define SHGetFolderPath  SHGetFolderPathA
#endif
#endif
*/

#ifndef SHSTDAPI 
#if defined(_SHELL32_) 
#define SHSTDAPI                        STDAPI 
#define SHSTDAPI_(type)         STDAPI_(type) 
#else 
#define SHSTDAPI                        EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE 
#define SHSTDAPI_(type)         EXTERN_C DECLSPEC_IMPORT type STDAPICALLTYPE 
#endif 
#endif 

#ifndef SHGetSpecialFolderPath 
SHSTDAPI_(BOOL) SHGetSpecialFolderPathA(HWND hwnd, LPSTR pszPath, int csidl, BOOL fCreate);
SHSTDAPI_(BOOL) SHGetSpecialFolderPathW(HWND hwnd, LPWSTR pszPath, int csidl, BOOL fCreate);
#ifdef UNICODE 
#define SHGetSpecialFolderPath  SHGetSpecialFolderPathW 
#else 
#define SHGetSpecialFolderPath  SHGetSpecialFolderPathA 
#endif 
#endif 

#ifndef CSIDL_PROGRAMS 
#define CSIDL_PROGRAMS                                  0x0002 
#endif 
#ifndef CSIDL_DESKTOPDIRECTORY 
#define CSIDL_DESKTOPDIRECTORY                  0x0010 
#endif 
#ifndef CSIDL_COMMON_PROGRAMS 
#define CSIDL_COMMON_PROGRAMS                   0x0017 
#endif 
#ifndef CSIDL_APPDATA 
#define CSIDL_APPDATA                                   0x001a 
#endif 
#ifndef CSIDL_PROGRAM_FILES 
#define CSIDL_PROGRAM_FILES                             0x0026 
#endif 

//===========================================================================

class Settings
{
public:
        Settings();
        ~Settings();

        void DeleteStyleItems();

        void ReadRCSettings();
        void WriteDefaultRCSettings();
        void ReadExtensionsRCSettings();
        void WriteDefaultMenu();

        void ReadStyleSettings();
        void ReadStyleElement(LPSTR styleFile, StyleItem* styleItem, LPSTR paramString, bool bb4nix070syntax, bool readFont);
        COLORREF CreateShadowColor(StyleItem* styleItem, COLORREF color, COLORREF colorTo, COLORREF textColor);

        void GetShellFolders();

        int GetInt(LPCSTR fp, LPCSTR szString, int szDefault);
        LPSTR GetString(LPCSTR fp, LPCSTR szString, LPSTR szDefault);
        COLORREF GetColor(LPCSTR fp, LPCSTR szString, LPCSTR szDefault, COLORREF szDefaultRef, bool useDefaultRef);

//===========================================================================

        // blackbox.rc settings - global
        int workspaces;
        bool focusLastWindow;
        char windowPlacement[MAX_LINE_LENGTH];
        char colPlacementDirection[MAX_LINE_LENGTH];
        char workspaceNames[MAX_LINE_LENGTH];
        bool focusNewWindows;
        char rowPlacementDirection[MAX_LINE_LENGTH];
        bool fullMaximization;
        char strftimeFormat[MAX_LINE_LENGTH];
        int edgeSnapThreshold;
        char focusModel[MAX_LINE_LENGTH];
        bool intelliMouse;
        char styleFile[MAX_LINE_LENGTH];
        int cacheLife;
        int cacheMax;
        bool opaqueMove;
        int doubleClickInterval;
        int autoRaiseDelay;
        char menuFile[MAX_LINE_LENGTH];
        int colorsPerChannel;
        bool imageDither;

        // blackbox.rc settings - toolbar
        bool toolbarOnTop;
        bool toolbarAutoHide;
        char toolbarPlacement[MAX_LINE_LENGTH];
        int toolbarWidthPercent;

        // blackbox.rc settings - slit
        char slitPlacement[MAX_LINE_LENGTH];
        char slitDirection[MAX_LINE_LENGTH];
        bool slitOnTop;
        bool slitAutoHide;

//===========================================================================

        // extensions.rc settings
        bool toolbarHidden;
        bool toolbarSnapToEdges;
        BYTE toolbarTransparencyAlpha;

        bool systembarHidden;
        char systembarPlacement[MAX_LINE_LENGTH];
        bool systembarOnTop;
        bool systembarSnapToEdges;
        int systembarWidthPercent;
        bool systembarTooltipsDisabled;
        BYTE systembarTransparencyAlpha;
        bool systembarFirstInSlit;
        bool systembarXobloonNotifications;

        bool systrayDisabled;
        bool systrayHidden;
        unsigned int systraySaturationValue;
        unsigned int systrayHueIntensity;

        bool taskbarHidden;
        bool taskbarOnToolbar;
        int taskbarMode;
        bool taskbarCurrentOnly;
        bool taskbarFlashing;
        unsigned int taskbarSaturationValue;
        unsigned int taskbarHueIntensity;
        bool taskbarActiveSatHue;
        bool taskbarInactiveBackground;

        bool slitHidden;
        bool slitSnapToEdges;
        BYTE slitTransparencyAlpha;
        char slitPositioning[MAX_LINE_LENGTH];

        int submenuDelay;
        int scrollSpeed;
        int wheelSpeed;
        BYTE menuTransparencyAlpha;
        bool midclickStylesMenu;
        char stylesFolder[MAX_PATH];
        char themesFolder[MAX_PATH];
        char selectedTheme[MAX_PATH];
        bool menuSeparators;

        bool pluginsHidden;
        char pluginsRepository[MAX_LINE_LENGTH];
        char checkedForUpdates[20];
        int autohideSpeed;
        bool followActive;
        bool slimlineMetrics;
        bool alternativeBullets;
        bool forceFontShadows;
        bool writeProtection;
        bool disableRootCommands;
        bool disableScriptSupport;
        char preferredEditor[MAX_LINE_LENGTH];
        bool runStartupApps;

        RECT desktopArea;
        bool desktopAreaNotDefined;

        bool debugLogging;

//===========================================================================

        bool underExplorer;
        bool usingWin2kXP;

        bool accessLock;

        //====================

        char SF_blackboxPath[MAX_PATH];
        char SF_startMenu[MAX_PATH];
        char SF_commonStartMenu[MAX_PATH];
        char SF_programFiles[MAX_PATH];
        char SF_desktop[MAX_PATH];
        char SF_userAppData[MAX_PATH];

        char SF_currentThemePath[MAX_PATH];
        bool usingDefaultTheme;

        bool menuEditboxAlreadyActive;

        bool checkingForUpdates;

        //====================

        char bbrcFile[MAX_LINE_LENGTH];
        //char menurcFile[MAX_LINE_LENGTH]; // See blackbox.rc settings above
        char plugrcFile[MAX_LINE_LENGTH];
        char extrcFile[MAX_LINE_LENGTH];
        char extrcDefaultFile[MAX_LINE_LENGTH]; // Always used for certain settings, e.g. preferred editor
        //char styleFile[MAX_LINE_LENGTH]; // See blackbox.rc settings above

//===========================================================================

        // Toolbar
        StyleItem *Toolbar;
        StyleItem *ToolbarLabel;
        StyleItem *ToolbarWindowLabel;
        StyleItem *ToolbarClock;
        StyleItem *ToolbarButton;
        StyleItem *ToolbarButtonPressed;

        // Menu
        StyleItem *MenuTitle;
        StyleItem *MenuFrame;
        StyleItem *MenuHilite;
        StyleItem *MenuIndicator;

        // Slit
        StyleItem *Slit;

        // Taskbar
        StyleItem *ActiveTask;
        StyleItem *InactiveTask;
        StyleItem *FlashingTask;

        //====================

        // Wildcard settings
        char wildcardFont[255];
        char wildcardToolbarFont[255];
        char wildcardMenuFont[255];
        char wildcardJustify[MAX_LINE_LENGTH];
        COLORREF wildcardTextColor;
        char wildcardTextColorString[MAX_LINE_LENGTH];
        int wildcardBorderWidth;
        COLORREF wildcardBorderColor;

        // Appearance in string format... (used for caching purposes)
        char toolbar[MAX_LINE_LENGTH];
        char toolbarLabel[MAX_LINE_LENGTH];
        char toolbarWindowLabel[MAX_LINE_LENGTH];
        char toolbarClock[MAX_LINE_LENGTH];
        char toolbarButton[MAX_LINE_LENGTH];
        char toolbarButtonPressed[MAX_LINE_LENGTH];
        char menuTitle[MAX_LINE_LENGTH];
        char menuFrame[MAX_LINE_LENGTH];
        char menuHilite[MAX_LINE_LENGTH];
        char menuIndicator[MAX_LINE_LENGTH];
        char slit[MAX_LINE_LENGTH];
        LPSTR appearancePointer;

        // Text alignment as string
        char toolbarJustify[MAX_LINE_LENGTH];
        char menuTitleJustify[MAX_LINE_LENGTH];
        char menuFrameJustify[MAX_LINE_LENGTH];

        // Shadow colours (not part of the current StyleItem definition)
        COLORREF toolbarLabelShadowColor;
        COLORREF toolbarWindowLabelShadowColor;
        COLORREF toolbarClockShadowColor;
        COLORREF menuTitleShadowColor;
        COLORREF menuFrameShadowColor;
        COLORREF menuHiliteShadowColor;
        COLORREF activeTaskShadowColor;
        COLORREF inactiveTaskShadowColor;
        COLORREF flashingTaskShadowColor;

        // Special items
        COLORREF menuFrameDisableColor;
        // Bullets for submenu items
        char menuBullet[MAX_LINE_LENGTH];
        char menuBulletPosition[MAX_LINE_LENGTH];
        COLORREF menuFrameBulletColor;
        COLORREF menuHiliteBulletColor;
        // Separators
        COLORREF menuSeparatorColor;

        //====================

        // A border can be drawn round all components
        int borderWidth;
        int menuBorderWidth;
        COLORREF borderColor;
        COLORREF menuBorderColor;

        int bevelWidth;
        int marginWidth;
        int handleWidth;

        // When not specified, frameWidth defaults to the value of bevelWidth
        int frameWidth;

        // This command is executed whenever this style is selected.
        // Typically it sets the root window to a nice picture.
        char rootCommand[MAX_LINE_LENGTH];
};

//===========================================================================

#endif /*__BBSETTINGS_H */ 





syntax highlighting by

w e b c p p
web c plus plus