~ubuntu-branches/ubuntu/natty/geany/natty

« back to all changes in this revision

Viewing changes to scintilla/ViewStyle.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Chow Loong Jin
  • Date: 2010-08-07 03:23:12 UTC
  • mfrom: (1.4.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: james.westby@ubuntu.com-20100807032312-ot70ac9d50cn79we
Tags: upstream-0.19
ImportĀ upstreamĀ versionĀ 0.19

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
}
42
42
 
43
43
void FontNames::Clear() {
44
 
        for (int i=0;i<max;i++) {
 
44
        for (int i=0; i<max; i++) {
45
45
                delete []names[i];
46
46
        }
47
47
        max = 0;
50
50
const char *FontNames::Save(const char *name) {
51
51
        if (!name)
52
52
                return 0;
53
 
        for (int i=0;i<max;i++) {
 
53
        for (int i=0; i<max; i++) {
54
54
                if (strcmp(names[i], name) == 0) {
55
55
                        return names[i];
56
56
                }
59
59
                // Grow array
60
60
                int sizeNew = size * 2;
61
61
                char **namesNew = new char *[sizeNew];
62
 
                for (int j=0;j<max;j++) {
 
62
                for (int j=0; j<max; j++) {
63
63
                        namesNew[j] = names[j];
64
64
                }
65
65
                delete []names;
78
78
 
79
79
ViewStyle::ViewStyle(const ViewStyle &source) {
80
80
        Init(source.stylesSize);
81
 
        for (unsigned int sty=0;sty<source.stylesSize;sty++) {
 
81
        for (unsigned int sty=0; sty<source.stylesSize; sty++) {
82
82
                styles[sty] = source.styles[sty];
83
83
                // Can't just copy fontname as its lifetime is relative to its owning ViewStyle
84
84
                styles[sty].fontName = fontNames.Save(source.styles[sty].fontName);
85
85
        }
86
 
        for (int mrk=0;mrk<=MARKER_MAX;mrk++) {
 
86
        for (int mrk=0; mrk<=MARKER_MAX; mrk++) {
87
87
                markers[mrk] = source.markers[mrk];
88
88
        }
89
 
        for (int ind=0;ind<=INDIC_MAX;ind++) {
 
89
        for (int ind=0; ind<=INDIC_MAX; ind++) {
90
90
                indicators[ind] = source.indicators[ind];
91
91
        }
92
92
 
93
93
        selforeset = source.selforeset;
94
94
        selforeground.desired = source.selforeground.desired;
 
95
        selAdditionalForeground.desired = source.selAdditionalForeground.desired;
95
96
        selbackset = source.selbackset;
96
97
        selbackground.desired = source.selbackground.desired;
 
98
        selAdditionalBackground.desired = source.selAdditionalBackground.desired;
97
99
        selbackground2.desired = source.selbackground2.desired;
98
100
        selAlpha = source.selAlpha;
 
101
        selAdditionalAlpha = source.selAdditionalAlpha;
99
102
        selEOLFilled = source.selEOLFilled;
100
103
 
101
104
        foldmarginColourSet = source.foldmarginColourSet;
117
120
        selbar.desired = source.selbar.desired;
118
121
        selbarlight.desired = source.selbarlight.desired;
119
122
        caretcolour.desired = source.caretcolour.desired;
 
123
        additionalCaretColour.desired = source.additionalCaretColour.desired;
120
124
        showCaretLineBackground = source.showCaretLineBackground;
121
125
        caretLineBackground.desired = source.caretLineBackground.desired;
122
126
        caretLineAlpha = source.caretLineAlpha;
127
131
        someStylesProtected = false;
128
132
        leftMarginWidth = source.leftMarginWidth;
129
133
        rightMarginWidth = source.rightMarginWidth;
130
 
        for (int i=0;i < margins; i++) {
 
134
        for (int i=0; i < margins; i++) {
131
135
                ms[i] = source.ms[i];
132
136
        }
133
137
        symbolMargin = source.symbolMargin;
135
139
        fixedColumnWidth = source.fixedColumnWidth;
136
140
        zoomLevel = source.zoomLevel;
137
141
        viewWhitespace = source.viewWhitespace;
 
142
        whitespaceSize = source.whitespaceSize;
138
143
        viewIndentationGuides = source.viewIndentationGuides;
139
144
        viewEOL = source.viewEOL;
140
145
        showMarkedLines = source.showMarkedLines;
176
181
 
177
182
        selforeset = false;
178
183
        selforeground.desired = ColourDesired(0xff, 0, 0);
 
184
        selAdditionalForeground.desired = ColourDesired(0xff, 0, 0);
179
185
        selbackset = true;
180
186
        selbackground.desired = ColourDesired(0xc0, 0xc0, 0xc0);
 
187
        selAdditionalBackground.desired = ColourDesired(0xd7, 0xd7, 0xd7);
181
188
        selbackground2.desired = ColourDesired(0xb0, 0xb0, 0xb0);
182
189
        selAlpha = SC_ALPHA_NOALPHA;
 
190
        selAdditionalAlpha = SC_ALPHA_NOALPHA;
183
191
        selEOLFilled = false;
184
192
 
185
193
        foldmarginColourSet = false;
196
204
        styles[STYLE_LINENUMBER].fore.desired = ColourDesired(0, 0, 0);
197
205
        styles[STYLE_LINENUMBER].back.desired = Platform::Chrome();
198
206
        caretcolour.desired = ColourDesired(0, 0, 0);
 
207
        additionalCaretColour.desired = ColourDesired(0x7f, 0x7f, 0x7f);
199
208
        showCaretLineBackground = false;
200
209
        caretLineBackground.desired = ColourDesired(0xff, 0xff, 0);
201
210
        caretLineAlpha = SC_ALPHA_NOALPHA;
234
243
        }
235
244
        zoomLevel = 0;
236
245
        viewWhitespace = wsInvisible;
 
246
        whitespaceSize = 1;
237
247
        viewIndentationGuides = ivNone;
238
248
        viewEOL = false;
239
249
        showMarkedLines = true;
240
 
        extraFontFlag = false;
 
250
        extraFontFlag = 0;
241
251
        extraAscent = 0;
242
252
        extraDescent = 0;
243
253
        marginStyleOffset = 0;
247
257
 
248
258
void ViewStyle::RefreshColourPalette(Palette &pal, bool want) {
249
259
        unsigned int i;
250
 
        for (i=0;i<stylesSize;i++) {
 
260
        for (i=0; i<stylesSize; i++) {
251
261
                pal.WantFind(styles[i].fore, want);
252
262
                pal.WantFind(styles[i].back, want);
253
263
        }
254
 
        for (i=0;i<(sizeof(indicators)/sizeof(indicators[0]));i++) {
 
264
        for (i=0; i<(sizeof(indicators)/sizeof(indicators[0])); i++) {
255
265
                pal.WantFind(indicators[i].fore, want);
256
266
        }
257
 
        for (i=0;i<(sizeof(markers)/sizeof(markers[0]));i++) {
 
267
        for (i=0; i<(sizeof(markers)/sizeof(markers[0])); i++) {
258
268
                markers[i].RefreshColourPalette(pal, want);
259
269
        }
260
270
        pal.WantFind(selforeground, want);
 
271
        pal.WantFind(selAdditionalForeground, want);
261
272
        pal.WantFind(selbackground, want);
 
273
        pal.WantFind(selAdditionalBackground, want);
262
274
        pal.WantFind(selbackground2, want);
263
275
 
264
276
        pal.WantFind(foldmarginColour, want);
269
281
        pal.WantFind(selbar, want);
270
282
        pal.WantFind(selbarlight, want);
271
283
        pal.WantFind(caretcolour, want);
 
284
        pal.WantFind(additionalCaretColour, want);
272
285
        pal.WantFind(caretLineBackground, want);
273
286
        pal.WantFind(edgecolour, want);
274
287
        pal.WantFind(hotspotForeground, want);