root/BF_GUI_Setup.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 #ifndef __BF_GUI_SETUP_H__
   2 #define __BF_GUI_SETUP_H__
   3 /* includes */
   4 #include <Font.h>
   5 #include "BF_Node.h"
   6 #include "BL_File.h"
   7 //#include "BF_GUI_NodePanel.h"
   8 /* */
   9 
  10 class BF_GUI_Setup_Color;
  11 
  12 #define BEFAR_SETTINGS_DIR      (const char*)"/boot/home/config/settings/BeFAR/"
  13 
  14 class BF_ConfigFile:public BL_File{
  15 public:
  16                 BL_String                               sLine;
  17                 
  18                                                                 BF_ConfigFile(const char *pc_Path, uint32 i_OpenMode);
  19                 status_t                                WriteStyle(uint32 i_Styles,uint32 i_Style,const char *pc_Text);         
  20                 status_t                                ReadColor(BF_GUI_Setup_Color &o_Color);
  21                 status_t                                VarUnpack(BL_String & s_Var,BL_String & s_Name,BL_String & s_Value);
  22                 
  23                 status_t                                WriteVar(const char *pc_Name,const char *pc_Value);
  24                 status_t                                WriteVar(const char *pc_Name,float f_Value);    
  25                 
  26                 status_t                                ReadLine();
  27 
  28                 bool                                    IsLineVar(const char *pc_VarName);
  29                 bool                                    VarTo(BL_String & s_Var);
  30 };
  31 
  32 class BF_GUI_Setup_Vars_Panel:public BL_Object{
  33 public:
  34                 BL_String                               sPath;
  35                 uint32                                  iModeFullStyles,iModeColsStyles,iMode;          
  36                                 
  37                                                                 BF_GUI_Setup_Vars_Panel();
  38                 void                                    Clear();
  39                 void                                    Load(BF_ConfigFile &o_File);
  40 };
  41 
  42 
  43 class BF_GUI_Setup_Vars:public BL_Object{
  44 public:                 
  45                 BF_GUI_Setup_Vars_Panel oLPanel,oRPanel;
  46                 BRect                                   oWinFrame;              
  47                                                 
  48                                                                 BF_GUI_Setup_Vars();
  49                                                                 
  50                 void                                    Save();
  51                 status_t                                Load();
  52                 bool                                    Loaded(){return bLoaded;};
  53                 
  54 private:
  55                 void                                    SavePanel(BF_ConfigFile &o_File,const BF_GUI_Setup_Vars_Panel & o_Panel,bool b_LeftPanel);
  56                 bool                                    bLoaded;
  57 };
  58 
  59 class BF_GUI_Setup_Font:public BL_Object{
  60 public:
  61                 BL_String                               sName;
  62                 int                                             iStyles;
  63                 int                                             iFlags;
  64                 float                                   fSize;
  65                 
  66                 float                                   fHeight;
  67                 float                                   fAscent,fDescent;               
  68                 BFont                                   oFont;
  69                                                                 
  70                 void                                    operator = (BF_GUI_Setup_Font & o_From);
  71                 void                                    Set(const char *pc_Name,int i_Styles,int i_Flags,float f_Size);         
  72                 void                                    Save(const char *pc_Type,BF_ConfigFile & o_File);
  73                 void                                    Load(BF_ConfigFile & o_File);           
  74                 
  75                 int                                             StylesStrToInt(const char *pc_Styles);
  76 private:                
  77                 void                                    CalcVars();
  78                 void                                    MakeFont();
  79 };
  80 
  81 class BF_GUI_Setup_Color:public BL_Object{
  82 public:
  83                 rgb_color                               rgb;
  84                 BL_String                               sCode;
  85                 int32                                   iDictCode;
  86                                                                 BF_GUI_Setup_Color(){RGB_SET(rgb,0,0,0);iDictCode=0xffffff;};                                                           
  87                 void                                    operator = (BF_GUI_Setup_Color & o_From);
  88                 void                                    Save(BF_ConfigFile & o_File);
  89 };
  90 
  91 class BF_GUI_Setup;
  92 
  93 enum{
  94         BF_COLOR_BACK=0,
  95         BF_COLOR_FRAME, 
  96         BF_COLOR_NODE,
  97         BF_COLOR_NODE_LINK,
  98         BF_COLOR_NODE_DIR,      
  99         BF_COLOR_NODE_DIR_LINK,         
 100         BF_COLOR_CURSOR_BACK,
 101         BF_COLOR_CURSOR_TEXT,
 102         BF_COLOR_HEADER_TEXT,
 103         BF_COLOR_PANEL_INFO_TEXT,
 104         BF_COLOR_PATH_FOCUSTEXT,
 105         BF_COLOR_PATH_FOCUSBACK,
 106         BF_COLOR_PATH_TEXT,
 107         BF_COLOR_PATH_BACK,
 108         BF_COLOR_NODE_SELECT,
 109         BF_COLOR_NODE_FOCUSSELECT,
 110         BF_COLOR_DIALOG_BACK,   
 111         BF_COLOR_DIALOG_TEXT,   
 112         BF_COLOR_DIALOG_MENU_ITEMSELECTED,      
 113         BF_COLOR_DIALOG_EDIT_TEXT,      
 114         BF_COLOR_DIALOG_EDIT_BACK,      
 115         BF_COLOR_DIALOG_BUTTON_FOCUS,   
 116         BF_COLOR_DIALOG_BUTTON_TEXT,    
 117         BF_COLOR_DIALOG_PROGRESS_EMPTY,
 118         BF_COLOR_DIALOG_PROGRESS_FILLED,
 119         BF_COLOR_DIALOG_VIEWBORDER_FOCUSED,
 120         BF_COLOR_DIALOG_VIEWBORDER_UNFOCUSED,
 121         BF_COLOR_RED,  
 122         BF_COLOR_CMDLINE_BACK,  
 123         BF_COLOR_CMDLINE_TEXT,
 124         BF_COLOR_TEXTVIEWER_STATUS_BACK,
 125         BF_COLOR_TEXTVIEWER_STATUS_TEXT,
 126         BF_COLOR_TEXTVIEWER_TEXT,       
 127         BF_COLOR_TEXTVIEWER_BACK,       
 128         BF_COLOR_END
 129 };
 130 
 131 #define BF_SETUP_FPANELMODE_FULL_DRAWLINES      1
 132 
 133 #define BF_SETUP_FPANELMODE_COLS_DRAWLINES      1
 134 
 135 #define BF_SETUP_MAIN_RETURN_REMEMBER                           0x0000001
 136 #define BF_SETUP_MAIN_ASK_DELETE                                        0x0000002
 137 #define BF_SETUP_MAIN_ASK_EXIT                                          0x0000004
 138 #define BF_SETUP_MAIN_ASK_COPY                                          0x0000008
 139 #define BF_SETUP_MAIN_SELECTVOL_SHOWSICON                       0x0000010
 140 #define BF_SETUP_MAIN_SELECTVOL_SHOWSPEC                        0x0000020
 141 #define BF_SETUP_MAIN_SELECTVOL_SHOWSTACK                       0x0000040
 142 #define BF_SETUP_SEARCH_SETUP_VOLICONS                          0x0000080
 143 #define BF_SETUP_MAIN_FP_HEADERICON                                     0x0000100
 144 #define BF_SETUP_NODEPANEL_DESELECT_AFTER_COPY          0x0000200
 145 #define BF_SETUP_NODEPANEL_DESELECT_AFTER_MOVE          0x0000400
 146 #define BF_SETUP_NODEPANEL_USE_BACKSPACE                        0x0000800
 147 #define BF_SETUP_OPERROSTER_DEFDIALOG                           0x0001000
 148 #define BF_SETUP_CMDLINE_SHOWPATH                                       0x0002000
 149 #define BF_SETUP_FILESPANEL_TRACKERADDONS_SHOWICONS     0x0004000
 150 #define BF_SETUP_AUTOSAVE                                                       0x0008000
 151 
 152 #define BF_SETUP_DEB_NOMONITORING                                       0x0100000
 153 #define BF_SETUP_DEB_NOSORTING                                          0x0200000
 154 
 155 class BF_GUI_Setup_FilePanel{   
 156 public:
 157                 
 158                 
 159                 BF_GUI_Setup                    *poSetup;
 160                 
 161                                                                 BF_GUI_Setup_FilePanel();
 162                 void                                    Calc(float f_Width);
 163 };
 164 
 165 class BF_GUI_Setup:BArchivable{
 166 public:
 167                                                                 BF_GUI_Setup();
 168                 
 169                 void                                    InitDefault();          
 170                 
 171                 uint32                                  MainStyle();            
 172                 uint32                                  FPanelFullStyle();
 173                 uint32                                  FPanelColsStyle();
 174                 
 175                 void                                    SetMainStyle(uint32 i_Style);
 176                 
 177                 void                                    SetColor(int i_Index,int32      i_DictCode,const char *pc_Code,uint8 i_R,uint8 i_G,uint8 i_B,uint8 i_A=255);
 178                 int32                                   ColorIndexByCode(const char *pc_Code);
 179                 void                                    SetColorByCode(BF_GUI_Setup_Color & o_ColFrom);
 180                 
 181                 void                                    CopyTo(BF_GUI_Setup & o_Res);
 182                 void                                    UpdateFrom(BF_GUI_Setup & o_Src);               
 183                 
 184                 void                                    Save();
 185                 void                                    Load(bool b_ShowErrors=true);           
 186                 void                                    SavePalete(const char *pc_FileName);
 187                 void                                    LoadPalete(const char *pc_FileName);
 188                 void                                    LoadColors(BF_ConfigFile & o_File);             
 189                 void                                    Save_Fonts(BF_ConfigFile & o_File);
 190                 
 191                 
 192                 BF_GUI_Setup_Font               oFontNode,oFontToolView,oFontMono,oFontCMDLine;         
 193                 BF_GUI_Setup_Color              aoColor[BF_COLOR_END];
 194                 BF_GUI_Setup_Vars               oVars;
 195                 
 196                 int32                                   iPathHistorySize;
 197                 int32                                   iCmdLineHistorySize;            
 198                 
 199                 BF_Path                                 oPathSysTrash;
 200                 
 201                 BL_String                               sDictFile;
 202 private:
 203                 uint32                                  iFPanelFullStyle,iFPanelColsStyle,iMainStyle;           
 204                 
 205                 void                                    Save_Colors(BF_ConfigFile & o_File);
 206                         
 207 };
 208 
 209 #define SYS_COLOR(index) poSysSetup->aoColor[index].rgb
 210 
 211 extern BF_GUI_Setup *poSysSetup;
 212 
 213 

/* [previous][next][first][last][top][bottom][index][help] */