Salome HOME
Merge branch 'pre/V8_2_BR' of https://git.salome-platform.org/git/modules/gui into...
[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   virtual ~PyEditor_Settings() {}
50
51   void setHighlightCurrentLine( bool );
52   bool highlightCurrentLine() const;
53
54   void setTextWrapping( bool );
55   bool textWrapping() const;
56
57   void setCenterCursorOnScroll( bool );
58   bool centerCursorOnScroll() const;
59
60   void setLineNumberArea( bool );
61   bool lineNumberArea() const;
62
63   void setVerticalEdge( bool );
64   bool verticalEdge() const;
65
66   void setNumberColumns( int );
67   int numberColumns() const;
68
69   void setTabSpaceVisible( bool );
70   bool tabSpaceVisible() const;
71
72   void setTabSize( int );
73   int tabSize() const;
74
75   void setFont( const QFont& );
76   QFont font() const;
77
78   virtual void load();
79   virtual void save();
80
81   void copyFrom( const PyEditor_Settings& );
82   
83 protected:
84   QString option( Option );
85
86 private:
87   // Display settings
88   bool myHighlightCurrentLine;
89   bool myTextWrapping;
90   bool myCenterCursorOnScroll;
91   bool myLineNumberArea;
92   
93   // Vertical edge settings
94   bool myVerticalEdge;
95   int  myNumberColumns;
96   
97   // Tab settings
98   bool myTabSpaceVisible;
99   int  myTabSize;
100   
101   // Font settings
102   QFont myFont;
103
104   static PyEditor_Settings* myGlobalSettings;
105 };
106
107 #endif // PYEDITOR_SETTINGS_H