aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2013-02-22 17:06:50 +1100
committernyamatongwe <devnull@localhost>2013-02-22 17:06:50 +1100
commit18e16eec6d4a66f9d9a365e2498ab511e56b6a97 (patch)
tree47dc5204d018285b8d80187dfff81eb6d658e1e6 /src
parent64a54a3c407b2208f299701628619c55121da4a3 (diff)
downloadscintilla-mirror-18e16eec6d4a66f9d9a365e2498ab511e56b6a97.tar.gz
Define the maximum number of margins in Scintilla.iface.
Diffstat (limited to 'src')
-rw-r--r--src/Editor.cxx10
-rw-r--r--src/ViewStyle.cxx8
-rw-r--r--src/ViewStyle.h3
3 files changed, 10 insertions, 11 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 0c1336aa0..e5c997cf4 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -1775,7 +1775,7 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
PRectangle rcSelMargin = rcMargin;
rcSelMargin.right = rcMargin.left;
- for (int margin = 0; margin < vs.margins; margin++) {
+ for (int margin = 0; margin <= SC_MAX_MARGIN; margin++) {
if (vs.ms[margin].width > 0) {
rcSelMargin.left = rcSelMargin.right;
@@ -3727,7 +3727,7 @@ long Editor::FormatRange(bool draw, Sci_RangeToFormat *pfr) {
// Modify the view style for printing as do not normally want any of the transient features to be printed
// Printing supports only the line number margin.
int lineNumberIndex = -1;
- for (int margin = 0; margin < ViewStyle::margins; margin++) {
+ for (int margin = 0; margin <= SC_MAX_MARGIN; margin++) {
if ((vsPrint.ms[margin].style == SC_MARGIN_NUMBER) && (vsPrint.ms[margin].width > 0)) {
lineNumberIndex = margin;
} else {
@@ -4455,7 +4455,7 @@ void Editor::NotifyIndicatorClick(bool click, int position, bool shift, bool ctr
bool Editor::NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt) {
int marginClicked = -1;
int x = 0;
- for (int margin = 0; margin < ViewStyle::margins; margin++) {
+ for (int margin = 0; margin <= SC_MAX_MARGIN; margin++) {
if ((pt.x >= x) && (pt.x < x + vs.ms[margin].width))
marginClicked = margin;
x += vs.ms[margin].width;
@@ -6122,7 +6122,7 @@ bool Editor::PointInSelMargin(Point pt) {
Window::Cursor Editor::GetMarginCursor(Point pt) {
int x = 0;
- for (int margin = 0; margin < ViewStyle::margins; margin++) {
+ for (int margin = 0; margin <= SC_MAX_MARGIN; margin++) {
if ((pt.x >= x) && (pt.x < x + vs.ms[margin].width))
return static_cast<Window::Cursor>(vs.ms[margin].cursor);
x += vs.ms[margin].width;
@@ -7056,7 +7056,7 @@ void Editor::AddStyledText(char *buffer, int appendLength) {
}
static bool ValidMargin(unsigned long wParam) {
- return wParam < ViewStyle::margins;
+ return wParam <= SC_MAX_MARGIN;
}
static char *CharPtrFromSPtr(sptr_t lParam) {
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx
index b9284c05e..f316d264e 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -193,8 +193,8 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
someStylesForceCase = false;
leftMarginWidth = source.leftMarginWidth;
rightMarginWidth = source.rightMarginWidth;
- for (int i=0; i < margins; i++) {
- ms[i] = source.ms[i];
+ for (int margin=0; margin <= SC_MAX_MARGIN; margin++) {
+ ms[margin] = source.ms[margin];
}
maskInLine = source.maskInLine;
fixedColumnWidth = source.fixedColumnWidth;
@@ -308,7 +308,7 @@ void ViewStyle::Init(size_t stylesSize_) {
ms[2].mask = 0;
fixedColumnWidth = leftMarginWidth;
maskInLine = 0xffffffff;
- for (int margin=0; margin < margins; margin++) {
+ for (int margin=0; margin <= SC_MAX_MARGIN; margin++) {
fixedColumnWidth += ms[margin].width;
if (ms[margin].width > 0)
maskInLine &= ~ms[margin].mask;
@@ -389,7 +389,7 @@ void ViewStyle::Refresh(Surface &surface) {
fixedColumnWidth = leftMarginWidth;
maskInLine = 0xffffffff;
- for (int margin=0; margin < margins; margin++) {
+ for (int margin=0; margin <= SC_MAX_MARGIN; margin++) {
fixedColumnWidth += ms[margin].width;
if (ms[margin].width > 0)
maskInLine &= ~ms[margin].mask;
diff --git a/src/ViewStyle.h b/src/ViewStyle.h
index 5a623986b..ddcc64312 100644
--- a/src/ViewStyle.h
+++ b/src/ViewStyle.h
@@ -104,11 +104,10 @@ public:
bool hotspotUnderline;
bool hotspotSingleLine;
/// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
- enum { margins=5 };
int leftMarginWidth; ///< Spacing margin on left of text
int rightMarginWidth; ///< Spacing margin on right of text
int maskInLine; ///< Mask for markers to be put into text because there is nowhere for them to go in margin
- MarginStyle ms[margins];
+ MarginStyle ms[SC_MAX_MARGIN+1];
int fixedColumnWidth;
int zoomLevel;
WhiteSpaceVisibility viewWhitespace;