1 // Scintilla source code edit control 2 /** @file ViewStyle.h 3 ** Store information on how the document is to be viewed. 4 **/ 5 // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> 6 // The License.txt file describes the conditions under which this software may be distributed. 7 8 #ifndef VIEWSTYLE_H 9 #define VIEWSTYLE_H 10 11 #ifdef SCI_NAMESPACE 12 namespace Scintilla { 13 #endif 14 15 /** 16 */ 17 class MarginStyle { 18 public: 19 int style; 20 int width; 21 int mask; 22 bool sensitive; 23 int cursor; 24 MarginStyle(); 25 }; 26 27 /** 28 */ 29 class FontNames { 30 private: 31 char **names; 32 int size; 33 int max; 34 35 public: 36 FontNames(); 37 ~FontNames(); 38 void Clear(); 39 const char *Save(const char *name); 40 }; 41 42 class FontRealised : public FontSpecification, public FontMeasurements { 43 // Private so FontRealised objects can not be copied 44 FontRealised(const FontRealised &); 45 FontRealised &operator=(const FontRealised &); 46 public: 47 Font font; 48 FontRealised *frNext; 49 FontRealised(const FontSpecification &fs); 50 virtual ~FontRealised(); 51 void Realise(Surface &surface, int zoomLevel, int technology); 52 FontRealised *Find(const FontSpecification &fs); 53 void FindMaxAscentDescent(unsigned int &maxAscent, unsigned int &maxDescent); 54 }; 55 56 enum IndentView {ivNone, ivReal, ivLookForward, ivLookBoth}; 57 58 enum WhiteSpaceVisibility {wsInvisible=0, wsVisibleAlways=1, wsVisibleAfterIndent=2}; 59 60 /** 61 */ 62 class ViewStyle { 63 public: 64 FontNames fontNames; 65 FontRealised *frFirst; 66 size_t stylesSize; 67 Style *styles; 68 LineMarker markers[MARKER_MAX + 1]; 69 int largestMarkerHeight; 70 Indicator indicators[INDIC_MAX + 1]; 71 int technology; 72 int lineHeight; 73 unsigned int maxAscent; 74 unsigned int maxDescent; 75 XYPOSITION aveCharWidth; 76 XYPOSITION spaceWidth; 77 bool selforeset; 78 ColourDesired selforeground; 79 ColourDesired selAdditionalForeground; 80 bool selbackset; 81 ColourDesired selbackground; 82 ColourDesired selAdditionalBackground; 83 ColourDesired selbackground2; 84 int selAlpha; 85 int selAdditionalAlpha; 86 bool selEOLFilled; 87 bool whitespaceForegroundSet; 88 ColourDesired whitespaceForeground; 89 bool whitespaceBackgroundSet; 90 ColourDesired whitespaceBackground; 91 ColourDesired selbar; 92 ColourDesired selbarlight; 93 bool foldmarginColourSet; 94 ColourDesired foldmarginColour; 95 bool foldmarginHighlightColourSet; 96 ColourDesired foldmarginHighlightColour; 97 bool hotspotForegroundSet; 98 ColourDesired hotspotForeground; 99 bool hotspotBackgroundSet; 100 ColourDesired hotspotBackground; 101 bool hotspotUnderline; 102 bool hotspotSingleLine; 103 /// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin 104 enum { margins=5 }; 105 int leftMarginWidth; ///< Spacing margin on left of text 106 int rightMarginWidth; ///< Spacing margin on right of text 107 int maskInLine; ///< Mask for markers to be put into text because there is nowhere for them to go in margin 108 MarginStyle ms[margins]; 109 int fixedColumnWidth; 110 int zoomLevel; 111 WhiteSpaceVisibility viewWhitespace; 112 int whitespaceSize; 113 IndentView viewIndentationGuides; 114 bool viewEOL; 115 ColourDesired caretcolour; 116 ColourDesired additionalCaretColour; 117 bool showCaretLineBackground; 118 ColourDesired caretLineBackground; 119 int caretLineAlpha; 120 ColourDesired edgecolour; 121 int edgeState; 122 int caretStyle; 123 int caretWidth; 124 bool someStylesProtected; 125 bool someStylesForceCase; 126 int extraFontFlag; 127 int extraAscent; 128 int extraDescent; 129 int marginStyleOffset; 130 int annotationVisible; 131 int annotationStyleOffset; 132 bool braceHighlightIndicatorSet; 133 int braceHighlightIndicator; 134 bool braceBadLightIndicatorSet; 135 int braceBadLightIndicator; 136 137 ViewStyle(); 138 ViewStyle(const ViewStyle &source); 139 ~ViewStyle(); 140 void Init(size_t stylesSize_=64); 141 void CreateFont(const FontSpecification &fs); 142 void Refresh(Surface &surface); 143 void AllocStyles(size_t sizeNew); 144 void EnsureStyle(size_t index); 145 void ResetDefaultStyle(); 146 void ClearStyles(); 147 void SetStyleFontName(int styleIndex, const char *name); 148 bool ProtectionActive() const; 149 bool ValidStyle(size_t styleIndex) const; 150 void CalcLargestMarkerHeight(); 151 }; 152 153 #ifdef SCI_NAMESPACE 154 } 155 #endif 156 157 #endif 158