Blame view

GUI/SW2/SRC/src/Config.hpp 8.6 KB
886c558b   Steve Greedy   SACAMOS Public Re...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
//**************************************************************************************************
//                                          Config.hpp                                             *
//                                         ------------                                            *
// Description : This class is an application specific interface to the wxWidget wxConfig object.  *
// Started     : 2016-09-25                                                                        *
// Last Update : 2016-11-09                                                                        *
// Copyright   : (C) 2016 MSWaters                                                                 *
//**************************************************************************************************

//**************************************************************************************************
//                                                                                                 *
//      This program is free software; you can redistribute it and/or modify it under the          *
//      terms of the GNU General Public License as published by the Free Software Foundation;      *
//      either version 3 of the License, or (at your option) any later version.                    *
//                                                                                                 *
//**************************************************************************************************

#ifndef CONFIG_HPP
#define CONFIG_HPP

// Application Includes

#include "TypeDefs.hpp"
#include "CmdLinePcr.hpp"
#include "utility/PnlTxtSpn.hpp"
#include "utility/StrUtils.hpp"

// wxWidgets Includes

#include <wx/config.h>

// Local constant declarations

#define  CFG_DEF_TMPFILEMGT   eTFM_DELETE
#define  CFG_DEF_FRMLAYOUT    0
#define  CFG_DEF_PRECISION    CNVT_DEF_FLT_RES
#define  CFG_DEF_NBKMAXLNS    TXT_LNSDEF
#define  CFG_DEF_SPNPERIOD    SPN_PERIOD_DEF
#define  CFG_DEF_TOOLTIPS     false
#define  CFG_DEF_TOOLTIPDLY   700
#define  CFG_DEF_KEEPNETLST   false
#define  CFG_DEF_MAINPOSNX    100
#define  CFG_DEF_MAINPOSNY    100
#define  CFG_DEF_MAINSIZEW    793
#define  CFG_DEF_MAINSIZEH    623

#define  CFG_DEF_HELPPOSNX    500
#define  CFG_DEF_HELPPOSNY    1
#define  CFG_DEF_HELPSIZEW    500
#define  CFG_DEF_HELPSIZEH    700

#define  CFG_DEF_VERBOSEMODE  false
#define  CFG_DEF_GUILEPROC    wxT("spice-sdb")
#define  CFG_DEF_INCLUDEMODE  false
#define  CFG_DEF_EMBEDMODE    false
#define  CFG_DEF_NOMUNGEMODE  false

#define  CFG_DEF_SIMENG       wxT("NG-Spice")
#define  CFG_DEF_ANALYSIS     wxT("OP")
#define  CFG_DEF_PHASEUNITS   eUNITS_PHAD
#define  CFG_DEF_SYNCSWPSRCS  true
#define  CFG_DEF_SYNCTEMPS    true

#define  CFG_DEF_SCHEMEDIT    BIN_GSCHEM

#define  CFG_DEF_DATAVIEWER   wxT("Gaw")

//**************************************************************************************************

class Config
{
  private :

            wxFileName  m_oFileName;  // The RC file name
    static  wxConfig *  m_poCfg;      // Pointer to the wxWidgets configuration object

          bool         bSet( const wxString & rosGroup, const wxString & rosKey, int  iValue );
          bool         bSet( const wxString & rosGroup, const wxString & rosKey, bool bValue );
          bool         bSet( const wxString & rosGroup, const wxString & rosKey,
                             const wxString & rosValue );

          int          iGet( const wxString & rosGroup, const wxString & rosKey, int  iDefault );
          bool         bGet( const wxString & rosGroup, const wxString & rosKey, bool bDefault );
    const wxString & rosGet( const wxString & rosGroup, const wxString & rosKey,
                             const wxString & rosDefault );

  public :

          Config( void );
         ~Config( );

    bool  bOpen  ( const wxString & rosFileName=wxEmptyString );
    bool  bIsOpen( void ) { return( m_poCfg != NULL ); }
    bool  bClose ( void );
    bool  bFlush ( void );
    bool  bClean ( void );

          bool         bSetFileName( const wxString & rosFileName );
    const wxString & rosGetFileName( void );

    // Set configuration functions
    bool  bSetFrmLayout  ( uint             uiLayout       );  // MAIN       group
    bool  bSetTmpFileMgt ( eTypeTmpFileMgt  eTmpFileMgt    );
    bool  bSetPrecision  ( uint             uiFltRes       );
    bool  bSetNbkMaxLns  ( uint             uiLnCnt        );
    bool  bSetSpnPeriod  ( uint             ui_mSec        );
    bool  bSetToolTips   ( bool             bEnable        );
    bool  bSetToolTipDly ( uint             ui_mSec        );
    bool  bSetKeepNetLst ( bool             bEnable        );
    bool  bSetMainPosnX  ( int              iPosnX         );
    bool  bSetMainPosnY  ( int              iPosnY         );
    bool  bSetMainSizeW  ( int              iSizeW         );
    bool  bSetMainSizeH  ( int              iSizeH         );

    bool  bSetHelpPosnX  ( int              iPosnX         );  // HELP       group
    bool  bSetHelpPosnY  ( int              iPosnY         );
    bool  bSetHelpSizeW  ( int              iSizeW         );
    bool  bSetHelpSizeH  ( int              iSizeH         );

    bool  bSetNetLstFile ( const wxString      &  rosFile  );  // FILES      group
    bool  bSetSchemFiles ( const wxString      &  rosFiles );
    bool  bSetSchemFiles ( const wxArrayString & roasFiles );
    bool  bSetRecentFiles( const wxString      &  rosFiles );
    bool  bSetRecentFiles( const wxArrayString & roasFiles );
    bool  bSetDirLastAcc ( const wxString      &  rosDir   );

    bool  bSetVerboseMode( bool             bEnable        );  // GNETLIST   group
    bool  bSetGuileProc  ( const wxString & rosGuileProc   );
    bool  bSetIncludeMode( bool             bEnable        );
    bool  bSetEmbedMode  ( bool             bEnable        );
    bool  bSetNoMungeMode( bool             bEnable        );

    bool  bSetSimEng     ( const wxString & rosSimEng      );  // SIMULATOR  group
    bool  bSetSimEng     ( eTypeSimEng      eSimEng        );
    bool  bSetAnalysis   ( eTypeCmd         eAnalysis      );
    bool  bSetPhaseUnits ( eTypeUnits       eUnits         );
    bool  bSetSyncSwpSrcs( bool             bEnable        );
    bool  bSetSyncTemps  ( bool             bEnable        );

    bool  bSetSchemEdit  ( const wxString & rosSchemEdit   );  // SCHEMEDIT  group

    bool  bSetDataViewer ( const wxString & rosDataViewer  );  // DATAVIEWER group
    bool  bSetDataViewer ( eTypeViewer      eDataViewer    );

    // Get configuration functions
          uint              uiGetFrmLayout  ( void );
          eTypeTmpFileMgt    eGetTmpFileMgt ( void );
          uint              uiGetPrecision  ( void );
          uint              uiGetNbkMaxLns  ( void );
          uint              uiGetSpnPeriod  ( void );
          bool               bGetToolTips   ( void );
          uint              uiGetToolTipDly ( void );
          bool               bGetKeepNetLst ( void );
          int                iGetMainPosnX  ( void );
          int                iGetMainPosnY  ( void );
          int                iGetMainSizeW  ( void );
          int                iGetMainSizeH  ( void );

          int                iGetHelpPosnX  ( void );
          int                iGetHelpPosnY  ( void );
          int                iGetHelpSizeW  ( void );
          int                iGetHelpSizeH  ( void );

    const wxString      &  rosGetNetLstFile ( void );
    const wxString      &  rosGetSchemFiles ( void );
    const wxArrayString & roasGetSchemFiles ( void );
    const wxString      &  rosGetRecentFiles( void );
    const wxArrayString & roasGetRecentFiles( void );
    const wxString      &  rosGetDirLastAcc ( void );

          bool               bGetVerboseMode( void );
    const wxString      &  rosGetGuileProc  ( void );
          bool               bGetIncludeMode( void );
          bool               bGetEmbedMode  ( void );
          bool               bGetNoMungeMode( void );

    const wxString      &  rosGetSimEng     ( void );
          eTypeSimEng        eGetSimEng     ( void );
          eTypeCmd           eGetAnalysis   ( void );
          eTypeUnits         eGetPhaseUnits ( void );
          bool               bGetSyncSwpSrcs( void );
          bool               bGetSyncTemps  ( void );

    const wxString      &  rosGetSchemEdit  ( void );

    const wxString      &  rosGetDataViewer ( void );
          eTypeViewer        eGetDataViewer ( void );

    // The following function is intended for debugging
    void  Print( const wxString & rosPrefix=wxT("  ") );
};

//**************************************************************************************************

#endif // CONFIG_HPP