diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/CallTip.cxx | 14 | ||||
| -rw-r--r-- | src/ScintillaBase.cxx | 75 | ||||
| -rw-r--r-- | src/Style.cxx | 50 | ||||
| -rw-r--r-- | src/Style.h | 9 | 
4 files changed, 77 insertions, 71 deletions
| diff --git a/src/CallTip.cxx b/src/CallTip.cxx index b4e6b2da7..daa038798 100644 --- a/src/CallTip.cxx +++ b/src/CallTip.cxx @@ -5,8 +5,8 @@  // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>  // The License.txt file describes the conditions under which this software may be distributed. -#include <stdlib.h>  -#include <string.h>  +#include <stdlib.h> +#include <string.h>  #include "Platform.h" @@ -29,7 +29,7 @@ CallTip::CallTip() {  }  CallTip::~CallTip() { -    font.Release(); +	font.Release();  	wCallTip.Destroy();  	delete []val;  	val = 0; @@ -45,7 +45,7 @@ void CallTip::RefreshColourPalette(Palette &pal, bool want) {  void CallTip::PaintCT(Surface *surfaceWindow) {  	if (!val) -		return; +		return ;  	PRectangle rcClientPos = wCallTip.GetClientPosition();  	PRectangle rcClientSize(0, 0, rcClientPos.right - rcClientPos.left,  	                        rcClientPos.bottom - rcClientPos.top); @@ -120,7 +120,8 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,                                   const char *faceName, int size) {  	Surface surfaceMeasure;  	surfaceMeasure.Init(); -	int deviceHeight = (size * surfaceMeasure.LogPixelsY()) / 72; +	int deviceHeight = surfaceMeasure.DeviceHeightFont(size); +	//int deviceHeight = (size * surfaceMeasure.LogPixelsY()) / 72;  	font.Create(faceName, SC_CHARSET_DEFAULT, deviceHeight, false, false);  	if (val)  		delete []val; @@ -149,10 +150,9 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,  	int lineHeight = surfaceMeasure.Height(font);  	// Extra line for border and an empty line at top and bottom  	int height = lineHeight * numLines - surfaceMeasure.InternalLeading(font) + 2 + 2; -	return PRectangle(pt.x -5, pt.y + lineHeight + 1, pt.x + width - 5, pt.y + lineHeight + 1 + height); +	return PRectangle(pt.x -5, pt.y + 1, pt.x + width - 5, pt.y + 1 + height);  } -  void CallTip::CallTipCancel() {  	inCallTipMode = false;  	if (wCallTip.Created()) { diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index ee4f5615f..fd2bef184 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -36,22 +36,22 @@  ScintillaBase::ScintillaBase() {  	listType = 0; -#ifdef SCI_LEXER	 +#ifdef SCI_LEXER  	lexLanguage = SCLEX_CONTAINER; -	for (int wl=0;wl<numWordLists;wl++) +	for (int wl = 0;wl < numWordLists;wl++)  		keyWordLists[wl] = new WordList;  #endif  }  ScintillaBase::~ScintillaBase() { -#ifdef SCI_LEXER	 -	for (int wl=0;wl<numWordLists;wl++) +#ifdef SCI_LEXER +	for (int wl = 0;wl < numWordLists;wl++)  		delete keyWordLists[wl];  #endif  }  void ScintillaBase::Finalise() { -    Editor::Finalise(); +	Editor::Finalise();  	popup.Destroy();  } @@ -72,10 +72,12 @@ void ScintillaBase::Command(int cmdId) {  	switch (cmdId) { -	case idAutoComplete: 	// Nothing to do +	case idAutoComplete:  	// Nothing to do +  		break; -	case idCallTip: 	// Nothing to do +	case idCallTip:  	// Nothing to do +  		break;  	case idcmdUndo: @@ -185,13 +187,13 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {  				pdoc->InsertString(currentPos, list + lenEntered);  				SetEmptySelection(currentPos + strlen(list + lenEntered));  			} -			return; +			return ;  		}  	}  	ac.Start(wMain, idAutoComplete, currentPos, lenEntered);  	PRectangle rcClient = GetClientRectangle(); -	Point pt = LocationFromPosition(currentPos-lenEntered); +	Point pt = LocationFromPosition(currentPos - lenEntered);  	int heightLB = 100;  	int widthLB = 100; @@ -202,8 +204,8 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {  	}  	PRectangle rcac;  	rcac.left = pt.x - 5; -	if (pt.y >= rcClient.bottom - heightLB && // Wont fit below. -	    pt.y >= (rcClient.bottom + rcClient.top) / 2) { // and there is more room above. +	if (pt.y >= rcClient.bottom - heightLB &&  // Wont fit below. +	        pt.y >= (rcClient.bottom + rcClient.top) / 2) { // and there is more room above.  		rcac.top = pt.y - heightLB;  		if (rcac.top < 0) {  			heightLB += rcac.top; @@ -227,8 +229,8 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {  	// Make an allowance for large strings in list  	rcList.left = pt.x - 5;  	rcList.right = rcList.left + widthLB; -	if (pt.y >= rcClient.bottom - heightLB && // Wont fit below. -	    pt.y >= (rcClient.bottom + rcClient.top) / 2) { // and there is more room above. +	if (pt.y >= rcClient.bottom - heightLB &&  // Wont fit below. +	        pt.y >= (rcClient.bottom + rcClient.top) / 2) { // and there is more room above.  		rcList.top = pt.y - heightAlloced;  	} else {  		rcList.top = pt.y + vs.lineHeight; @@ -238,7 +240,7 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {  	ac.Show();  	if (lenEntered != 0) {  		AutoCompleteMoveToCurrentWord(); -	}		 +	}  }  void ScintillaBase::AutoCompleteCancel() { @@ -280,7 +282,7 @@ void ScintillaBase::AutoCompleteCompleted(char fillUp/*='\0'*/) {  		ac.lb.GetValue(item, selected, sizeof(selected));  	}  	ac.Cancel(); -	 +  	if (listType > 0) {  		userListSelected = selected;  		SCNotification scn; @@ -290,12 +292,12 @@ void ScintillaBase::AutoCompleteCompleted(char fillUp/*='\0'*/) {  		scn.lParam = 0;  		scn.text = userListSelected.c_str();  		NotifyParent(scn); -		return; +		return ;  	} -	 +  	Position firstPos = ac.posStart - ac.startLen;  	if (currentPos < firstPos) -		return; +		return ;  	if (currentPos != firstPos) {  		pdoc->DeleteChars(firstPos, currentPos - firstPos);  	} @@ -349,7 +351,7 @@ void ScintillaBase::Colourise(int start, int end) {  	if (start > 0)  		styleStart = styler.StyleAt(start - 1);  	styler.SetCodePage(pdoc->dbcsCodePage); -	 +  	LexerModule::Colourise(start, len, styleStart, lexLanguage, keyWordLists, styler);  	styler.Flush();  } @@ -362,7 +364,7 @@ void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) {  		int lineEndStyled = WndProc(SCI_LINEFROMPOSITION, endStyled, 0);  		endStyled = WndProc(SCI_POSITIONFROMLINE, lineEndStyled, 0);  		Colourise(endStyled, endStyleNeeded); -		return; +		return ;  	}  #endif  	Editor::NotifyStyleToNeeded(endStyleNeeded); @@ -399,15 +401,15 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara  	case SCI_AUTOCSTOPS:  		ac.SetStopChars(reinterpret_cast<char *>(lParam));  		break; -		 +  	case SCI_AUTOCSELECT:  		ac.Select(reinterpret_cast<char *>(lParam));  		break; -	 +  	case SCI_AUTOCSETCANCELATSTART:  		ac.cancelAtStartPos = wParam;  		break; -	 +  	case SCI_AUTOCGETCANCELATSTART:  		return ac.cancelAtStartPos; @@ -421,14 +423,14 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara  	case SCI_AUTOCGETCHOOSESINGLE:  		return ac.chooseSingle; -		 +  	case SCI_AUTOCSETIGNORECASE:  		ac.ignoreCase = wParam;  		break; -		 +  	case SCI_AUTOCGETIGNORECASE:  		return ac.ignoreCase; -		 +  	case SCI_USERLISTSHOW:  		listType = wParam;  		AutoCompleteStart(0, reinterpret_cast<const char *>(lParam)); @@ -437,9 +439,12 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara  	case SCI_CALLTIPSHOW: {  			AutoCompleteCancel();  			if (!ct.wCallTip.Created()) { -				PRectangle rc = ct.CallTipStart(currentPos, LocationFromPosition(wParam), +				Point pt = LocationFromPosition(wParam); +				pt.y += vs.lineHeight; +				PRectangle rc = ct.CallTipStart(currentPos, pt,  				                                reinterpret_cast<char *>(lParam), -				                                vs.styles[STYLE_DEFAULT].fontName, vs.styles[STYLE_DEFAULT].size); +				                                vs.styles[STYLE_DEFAULT].fontName, +				                                vs.styles[STYLE_DEFAULT].sizeZoomed);  				// If the call-tip window would be out of the client  				// space, adjust so it displays above the text.  				PRectangle rcClient = GetClientRectangle(); @@ -474,25 +479,25 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara  		ct.colourBG = Colour(wParam);  		InvalidateStyleRedraw();  		break; -		 +  #ifdef SCI_LEXER  	case SCI_SETLEXER:  		lexLanguage = wParam;  		break; -		 +  	case SCI_GETLEXER:  		return lexLanguage; -		 +  	case SCI_COLOURISE:  		Colourise(wParam, lParam);  		Redraw();  		break; -		 +  	case SCI_SETPROPERTY: -		props.Set(reinterpret_cast<const char *>(wParam),  -			reinterpret_cast<const char *>(lParam)); +		props.Set(reinterpret_cast<const char *>(wParam), +		          reinterpret_cast<const char *>(lParam));  		break; -		 +  	case SCI_SETKEYWORDS:  		if (wParam < numWordLists) {  			keyWordLists[wParam]->Clear(); diff --git a/src/Style.cxx b/src/Style.cxx index 4ea1f8776..6ddf76008 100644 --- a/src/Style.cxx +++ b/src/Style.cxx @@ -14,15 +14,15 @@  Style::Style() {  	aliasOfDefaultFont = true; -	Clear(Colour(0,0,0), Colour(0xff,0xff,0xff), -	        Platform::DefaultFontSize(), 0, SC_CHARSET_DEFAULT, -		false, false, false, false, true); +	Clear(Colour(0, 0, 0), Colour(0xff, 0xff, 0xff), +	      Platform::DefaultFontSize(), 0, SC_CHARSET_DEFAULT, +	      false, false, false, false, true);  } -	 +  Style::Style(const Style &source) { -	Clear(Colour(0,0,0), Colour(0xff,0xff,0xff), -	        0, 0, 0, -		false, false, false, false, true); +	Clear(Colour(0, 0, 0), Colour(0xff, 0xff, 0xff), +	      0, 0, 0, +	      false, false, false, false, true);  	fore.desired = source.fore.desired;  	back.desired = source.back.desired;  	characterSet = source.characterSet; @@ -31,7 +31,7 @@ Style::Style(const Style &source) {  	size = source.size;  	eolFilled = source.eolFilled;  	underline = source.underline; -    visible = source.visible; +	visible = source.visible;  }  Style::~Style() { @@ -44,10 +44,10 @@ Style::~Style() {  Style &Style::operator=(const Style &source) {  	if (this == &source) -		return *this; -	Clear(Colour(0,0,0), Colour(0xff,0xff,0xff), -	        0, 0, SC_CHARSET_DEFAULT, -		false, false, false, false, true); +		return * this; +	Clear(Colour(0, 0, 0), Colour(0xff, 0xff, 0xff), +	      0, 0, SC_CHARSET_DEFAULT, +	      false, false, false, false, true);  	fore.desired = source.fore.desired;  	back.desired = source.back.desired;  	characterSet = source.characterSet; @@ -56,13 +56,13 @@ Style &Style::operator=(const Style &source) {  	size = source.size;  	eolFilled = source.eolFilled;  	underline = source.underline; -    visible = source.visible; +	visible = source.visible;  	return *this;  } -void Style::Clear(Colour fore_, Colour back_, int size_,  -	const char *fontName_, int characterSet_, -	bool bold_, bool italic_, bool eolFilled_, bool underline_, bool visible_) { +void Style::Clear(Colour fore_, Colour back_, int size_, +                  const char *fontName_, int characterSet_, +                  bool bold_, bool italic_, bool eolFilled_, bool underline_, bool visible_) {  	fore.desired = fore_;  	back.desired = back_;  	characterSet = characterSet_; @@ -72,19 +72,19 @@ void Style::Clear(Colour fore_, Colour back_, int size_,  	fontName = fontName_;  	eolFilled = eolFilled_;  	underline = underline_; -    visible = visible_; +	visible = visible_;  	if (aliasOfDefaultFont)  		font.SetID(0); -	else  +	else  		font.Release();  	aliasOfDefaultFont = false;  }  bool Style::EquivalentFontTo(const Style *other) const {  	if (bold != other->bold || -		italic != other->italic || -		size != other->size || -		characterSet != other->characterSet) +	        italic != other->italic || +	        size != other->size || +	        characterSet != other->characterSet)  		return false;  	if (fontName == other->fontName)  		return true; @@ -96,17 +96,17 @@ bool Style::EquivalentFontTo(const Style *other) const {  }  void Style::Realise(Surface &surface, int zoomLevel, Style *defaultStyle) { -	int sizeZoomed = size + zoomLevel; +	sizeZoomed = size + zoomLevel;  	if (sizeZoomed <= 2)	// Hangs if sizeZoomed <= 1  		sizeZoomed = 2;  	if (aliasOfDefaultFont)  		font.SetID(0); -	else  +	else  		font.Release();  	int deviceHeight = surface.DeviceHeightFont(sizeZoomed); -	aliasOfDefaultFont = defaultStyle &&  -		(EquivalentFontTo(defaultStyle) || !fontName); +	aliasOfDefaultFont = defaultStyle && +	                     (EquivalentFontTo(defaultStyle) || !fontName);  	if (aliasOfDefaultFont) {  		font.SetID(defaultStyle->font.GetID());  	} else if (fontName) { diff --git a/src/Style.h b/src/Style.h index cc66df7aa..251030990 100644 --- a/src/Style.h +++ b/src/Style.h @@ -25,6 +25,7 @@ public:  	bool visible;  	Font font; +	int sizeZoomed;  	unsigned int lineHeight;  	unsigned int ascent;  	unsigned int descent; @@ -37,11 +38,11 @@ public:  	~Style();  	Style &operator=(const Style &source);  	void Clear(Colour fore_, Colour back_, -           	int size_,  -		const char *fontName_, int characterSet_, -		bool bold_, bool italic_, bool eolFilled_, bool underline_, bool visible_); +	           int size_, +	           const char *fontName_, int characterSet_, +	           bool bold_, bool italic_, bool eolFilled_, bool underline_, bool visible_);  	bool EquivalentFontTo(const Style *other) const; -	void Realise(Surface &surface, int zoomLevel, Style *defaultStyle=0); +	void Realise(Surface &surface, int zoomLevel, Style *defaultStyle = 0);  };  #endif | 
