Salome HOME
PyEditor refactoring
[modules/gui.git] / tools / PyEditor / src / PyEditor_Settings.h
1 // Copyright (C) 2015-2016  OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // File   : PyEditor_Settings.h
20 // Author : Maxim GLIBIN, Open CASCADE S.A.S. (maxim.glibin@opencascade.com)
21 //
22
23 #ifndef PYEDITOR_SETTINGS_H
24 #define PYEDITOR_SETTINGS_H
25
26 #include "PyEditor.h"
27
28 #include <QFont>
29
30 class PYEDITOR_EXPORT PyEditor_Settings
31 {
32 protected:
33   enum Option { snEditor, 
34                 snHighlightCurrentLine,
35                 snTextWrapping,
36                 snCenterCursorOnScroll,
37                 snLineNumberArea,
38                 snVerticalEdge,
39                 snNumberColumns,
40                 snTabSpaceVisible,
41                 snTabSize,
42                 snFont };
43
44 public:
45   static PyEditor_Settings* settings();
46   static void setSettings( PyEditor_Settings* );
47   
48   PyEditor_Settings();
49
50   void setHighlightCurrentLine( bool );
51   bool highlightCurrentLine() const;
52
53   void setTextWrapping( bool );
54   bool textWrapping() const;
55
56   void setCenterCursorOnScroll( bool );
57   bool centerCursorOnScroll() const;
58
59   void setLineNumberArea( bool );
60   bool lineNumberArea() const;
61
62   void setVerticalEdge( bool );
63   bool verticalEdge() const;
64
65   void setNumberColumns( int );
66   int numberColumns() const;
67
68   void setTabSpaceVisible( bool );
69   bool tabSpaceVisible() const;
70
71   void setTabSize( int );
72   int tabSize() const;
73
74   void setFont( const QFont& );
75   QFont font() const;
76
77   virtual void load();
78   virtual void save();
79
80   void copyFrom( const PyEditor_Settings& );
81   
82 protected:
83   QString option( Option );
84
85 private:
86   // Display settings
87   bool myHighlightCurrentLine;
88   bool myTextWrapping;
89   bool myCenterCursorOnScroll;
90   bool myLineNumberArea;
91   
92   // Vertical edge settings
93   bool myVerticalEdge;
94   int  myNumberColumns;
95   
96   // Tab settings
97   bool myTabSpaceVisible;
98   int  myTabSize;
99   
100   // Font settings
101   QFont myFont;
102
103   static PyEditor_Settings* myGlobalSettings;
104 };
105
106 #endif // PYEDITOR_SETTINGS_H