diff options
| author | nyamatongwe <unknown> | 2013-02-05 09:28:07 +1100 | 
|---|---|---|
| committer | nyamatongwe <unknown> | 2013-02-05 09:28:07 +1100 | 
| commit | ff4788b4cf8ec592dbeb5db3270061c0af76da90 (patch) | |
| tree | 918d925828ed132043e82d7e93d4a7b1a1248f37 /src | |
| parent | e24c283b7c2ad83bbe09d3dd8f9053af68b77d07 (diff) | |
| download | scintilla-mirror-ff4788b4cf8ec592dbeb5db3270061c0af76da90.tar.gz | |
Add allocation of extended styles.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Editor.cxx | 9 | ||||
| -rw-r--r-- | src/ViewStyle.cxx | 13 | ||||
| -rw-r--r-- | src/ViewStyle.h | 3 | 
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(); | 
