aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2013-02-05 09:28:07 +1100
committernyamatongwe <devnull@localhost>2013-02-05 09:28:07 +1100
commit9162c73355b47219d24ddba152fe931fdfabbcfc (patch)
tree40f963ff3a3e36ee8f3a4fdeb679a8c9881f8db8 /src
parent4d129be11ee453b135d16c78dfdff8d176b3cd7f (diff)
downloadscintilla-mirror-9162c73355b47219d24ddba152fe931fdfabbcfc.tar.gz
Add allocation of extended styles.
Diffstat (limited to 'src')
-rw-r--r--src/Editor.cxx9
-rw-r--r--src/ViewStyle.cxx13
-rw-r--r--src/ViewStyle.h3
3 files changed, 24 insertions, 1 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index f150aa202..7d449663e 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -6824,6 +6824,8 @@ void Editor::SetDocPointer(Document *document) {
braces[0] = invalidPosition;
braces[1] = invalidPosition;
+ vs.ReleaseAllExtendedStyles();
+
// Reset the contraction state to fully shown.
cs.Clear();
cs.InsertLines(0, pdoc->LinesTotal() - 1);
@@ -9161,6 +9163,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_ANNOTATIONGETSTYLEOFFSET:
return vs.annotationStyleOffset;
+ case SCI_RELEASEALLEXTENDEDSTYLES:
+ vs.ReleaseAllExtendedStyles();
+ break;
+
+ case SCI_ALLOCATEEXTENDEDSTYLES:
+ return vs.AllocateExtendedStyles(wParam);
+
case SCI_ADDUNDOACTION:
pdoc->AddUndoAction(wParam, lParam & UNDO_MAY_COALESCE);
break;
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx
index 059f885f7..b9284c05e 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -141,6 +141,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
// Can't just copy fontname as its lifetime is relative to its owning ViewStyle
styles[sty].fontName = fontNames.Save(source.styles[sty].fontName);
}
+ nextExtendedStyle = source.nextExtendedStyle;
for (int mrk=0; mrk<=MARKER_MAX; mrk++) {
markers[mrk] = source.markers[mrk];
}
@@ -226,6 +227,7 @@ void ViewStyle::Init(size_t stylesSize_) {
stylesSize = 0;
styles = NULL;
AllocStyles(stylesSize_);
+ nextExtendedStyle = 256;
fontNames.Clear();
ResetDefaultStyle();
@@ -413,6 +415,16 @@ void ViewStyle::AllocStyles(size_t sizeNew) {
stylesSize = sizeNew;
}
+void ViewStyle::ReleaseAllExtendedStyles() {
+ nextExtendedStyle = 256;
+}
+
+int ViewStyle::AllocateExtendedStyles(int numberStyles) {
+ int startRange = static_cast<int>(nextExtendedStyle);
+ nextExtendedStyle += numberStyles;
+ return startRange;
+}
+
void ViewStyle::EnsureStyle(size_t index) {
if (index >= stylesSize) {
size_t sizeNew = stylesSize * 2;
@@ -471,4 +483,3 @@ void ViewStyle::CalcLargestMarkerHeight() {
}
}
}
-
diff --git a/src/ViewStyle.h b/src/ViewStyle.h
index 676aee7da..5a623986b 100644
--- a/src/ViewStyle.h
+++ b/src/ViewStyle.h
@@ -67,6 +67,7 @@ public:
FontRealised *frFirst;
size_t stylesSize;
Style *styles;
+ size_t nextExtendedStyle;
LineMarker markers[MARKER_MAX + 1];
int largestMarkerHeight;
Indicator indicators[INDIC_MAX + 1];
@@ -144,6 +145,8 @@ public:
void CreateFont(const FontSpecification &fs);
void Refresh(Surface &surface);
void AllocStyles(size_t sizeNew);
+ void ReleaseAllExtendedStyles();
+ int AllocateExtendedStyles(int numberStyles);
void EnsureStyle(size_t index);
void ResetDefaultStyle();
void ClearStyles();