diff options
| -rw-r--r-- | doc/ScintillaDoc.html | 15 | ||||
| -rw-r--r-- | include/Scintilla.h | 31 | ||||
| -rw-r--r-- | include/Scintilla.iface | 26 | ||||
| -rw-r--r-- | src/CellBuffer.cxx | 4 | ||||
| -rw-r--r-- | src/CellBuffer.h | 6 | ||||
| -rw-r--r-- | src/Document.h | 4 | ||||
| -rw-r--r-- | src/Editor.cxx | 78 | ||||
| -rw-r--r-- | win32/ScintillaWin.cxx | 24 | 
8 files changed, 81 insertions, 107 deletions
| diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 73393b0be..4e4e94eef 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -55,6 +55,7 @@ WM_SETTEXT(<unused>, char *text)  EM_GETLINE(int line, char *text)  EM_REPLACESEL(<unused>, char *text)  EM_SETREADONLY +SCI_GETREADONLY  EM_GETTEXTRANGE(<unused>, TEXTRANGE *tr)  SCI_ADDTEXT(int length, char *s)  SCI_ADDSTYLEDTEXT(int length, cell *s) @@ -112,10 +113,10 @@ EM_CANUNDO  EM_EMPTYUNDOBUFFER  SCI_REDO  SCI_CANREDO -SCI_SETUNDOCOLLECTION(SC_UNDOCOLLECT_NONE | SC_UNDOCOLLECT_AUTOSTART | SC_UNDOCOLLECT_MANUALSTART) +SCI_SETUNDOCOLLECTION(bool collectUndo) +SCI_GETUNDOCOLLECTION  SCI_BEGINUNDOACTION  SCI_ENDUNDOACTION -SCI_APPENDUNDOSTARTACTION  </pre>      <p>         Scintilla has multiple level undo and redo. It will continue to collect undoable actions @@ -123,10 +124,7 @@ SCI_APPENDUNDOSTARTACTION        make it easier to undo and redo at a sensible level of detail. Sequences of actions can be        combined into actions that are undone as a unit. These sequences occur between        SCI_BEGINUNDOACTION and SCI_ENDUNDOACTION messages. These sequences can be nested and only -      the top level sequences are undone as units.<br /> -       If undo collection is put into manual mode, then the SCI_APPENDUNDOSTARTACTION message -      finishes any current sequence and starts a new sequence. This message and the corresponding -      SC_UNDOCOLLECT_MANUALSTART are deprecated and only included for backward compatibility. +      the top level sequences are undone as units.      </p>      <h3>         Selection and information @@ -333,6 +331,7 @@ SCI_SETFONT(char *fontname)  SCI_SETSELFORE(bool useSelectionForeColour, int colour)  SCI_SETSELBACK(bool useSelectionBackColour, int colour)  SCI_SETCARETFORE(int colour) +SCI_GETCARETFORE  SCI_GETCARETPERIOD  SCI_SETCARETPERIOD(int milliseconds)  </pre> @@ -395,6 +394,7 @@ SCI_GETMARGINSENSITIVEN(int margin)      </h3>  <pre>  SCI_SETUSEPALETTE(bool allowPaletteUse) +SCI_GETUSEPALETTE  </pre>      <p>         On 8 bit displays, which can only display a maximum of 256 colours, the graphics environment @@ -415,6 +415,7 @@ SCI_SETUSEPALETTE(bool allowPaletteUse)      </p>  <pre>  SCI_SETBUFFEREDDRAW(bool isbuffered) +SCI_GETBUFFEREDDRAW  </pre>      <p>         Turns on or off buffered drawing. Buffered drawing draws each line into a bitmap rather than @@ -451,6 +452,7 @@ SCI_GETCOLUMN(int position)      </p>  <pre>  SCI_SETCODEPAGE(int codepage) +SCI_GETCODEPAGE  </pre>      <p>         Scintilla has some very simple Japanese DBCS (and probably Chinese and Korean) support. Use @@ -947,6 +949,7 @@ SCN_KEY  SCN_MODIFIED  EN_CHANGE  SCI_SETMODEVENTMASK(int eventmask) +SCI_GETMODEVENTMASK  </pre>      <p>         SCN_MODIFIED is fired when the document has been changed including changes to both the text diff --git a/include/Scintilla.h b/include/Scintilla.h index 7640dfaa8..04d67e78a 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -47,9 +47,7 @@ void Scintilla_RegisterClasses(HINSTANCE hInstance);  #define SCI_CANREDO SCI_START + 16  #define SCI_MARKERLINEFROMHANDLE SCI_START + 17  #define SCI_MARKERDELETEHANDLE SCI_START + 18 - -#define SC_UNDOCOLLECT_NONE 0 -#define SC_UNDOCOLLECT_AUTOSTART 1 +#define SCI_GETUNDOCOLLECTION SCI_START + 19  #define SCWS_INVISIBLE 0  #define SCWS_VISIBLEALWAYS 1 @@ -77,6 +75,7 @@ void Scintilla_RegisterClasses(HINSTANCE hInstance);  // This is the same value as CP_UTF8 in Windows  #define SC_CP_UTF8 65001 +#define SCI_GETBUFFEREDDRAW SCI_START + 34  #define SCI_SETBUFFEREDDRAW SCI_START + 35  #define SCI_SETTABWIDTH SCI_START + 36  #define SCI_SETCODEPAGE SCI_START + 37 @@ -227,6 +226,10 @@ void Scintilla_RegisterClasses(HINSTANCE hInstance);  #define SCI_SETHIGHLIGHTGUIDE SCI_START + 134  #define SCI_GETHIGHLIGHTGUIDE SCI_START + 135  #define SCI_GETLINEENDPOSITION SCI_START + 136 +#define SCI_GETCODEPAGE SCI_START + 137 +#define SCI_GETCARETFORE SCI_START + 138 +#define SCI_GETUSEPALETTE SCI_START + 139 +#define SCI_GETREADONLY SCI_START + 140  #define SCI_CALLTIPSHOW SCI_START + 200  #define SCI_CALLTIPCANCEL SCI_START + 201 @@ -342,6 +345,8 @@ void Scintilla_RegisterClasses(HINSTANCE hInstance);  #define SCI_ADDREFDOCUMENT SCI_START + 376  #define SCI_RELEASEDOCUMENT SCI_START + 377 +#define SCI_GETMODEVENTMASK SCI_START + 378 +  // GTK+ Specific  #define SCI_GRABFOCUS SCI_START + 400 @@ -427,23 +432,9 @@ struct SCNotification {  #ifdef INCLUDE_DEPRECATED_FEATURES -#define SCI_CHANGEPOSITION SCI_START + 22 - -// Default style settings. These are deprecated and will be removed in a future version. -#define SCI_SETFORE SCI_START + 60 -#define SCI_SETBACK SCI_START + 61 -#define SCI_SETBOLD SCI_START + 62 -#define SCI_SETITALIC SCI_START + 63 -#define SCI_SETSIZE SCI_START + 64 -#define SCI_SETFONT SCI_START + 65 - -#define SCI_APPENDUNDOSTARTACTION SCI_START + 74 - -#define SC_UNDOCOLLECT_MANUALSTART 2 - -// Deprecated in release 1.22 -#define SCI_SETMARGINWIDTH SCI_START + 34 -#define SCI_SETLINENUMBERWIDTH SCI_START + 38 +// Deprecated in 1.27 +#define SC_UNDOCOLLECT_NONE 0 +#define SC_UNDOCOLLECT_AUTOSTART 1  #endif diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 1343cbfdc..d2195d3ef 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -81,12 +81,9 @@ get int GetStyleAt=2010(position pos,)  # Redoes the next action on the undo history  fun void Redo=2011(,) -val SC_UNDOCOLLECT_NONE=0 -val SC_UNDOCOLLECT_AUTOSTART=1 -  # Choose between collecting actions into the undo   # history and discarding them. -set void SetUndoCollection=2012(int collectUndo,) +set void SetUndoCollection=2012(bool collectUndo,)  # Select all the text in the document.  fun void SelectAll=2013(,) @@ -108,6 +105,9 @@ fun int MarkerLineFromHandle=2017(int handle,)  # Delete a marker.  fun void MarkerDeleteHandle=2018(int handle,) +# Is undo history being collected? +get bool GetUndoCollection=2019(,) +  val SCWS_INVISIBLE=0  val SCWS_VISIBLEALWAYS=1  val SCWS_VISIBLEAFTERINDENT=2 @@ -158,6 +158,9 @@ fun void StartStyling=2032(position pos, int mask)  # and move the current styling position to after this newly styled segment.  fun void SetStyling=2033(int length, int style) +# Is drawing done first into a buffer or direct to the screen. +get bool GetBufferedDraw=2034(,) +  # If drawing is buffered then each line of text is drawn into a bitmap buffer  # before drawing it to the screen to avoid flicker.  set void SetBufferedDraw=2035(bool buffered,) @@ -466,6 +469,18 @@ get int GetHighlightGuide=2135(,)  # Get the position after the last visible characters on a line.  get int GetLineEndPosition=2136(int line,) +# Get the code page used to interpret the bytes of the document as characters. +get int GetCodePage=2137(,) + +# Get the foreground colour of the caret. +get colour GetCaretFore=2138(,) + +# In palette mode? +get bool GetUsePalette=2139(,) + +# In read-only mode? +get bool GetReadOnly=2140(,) +  # Show a call tip containing a definition near position pos.  fun void CallTipShow=2200(position pos, string definition) @@ -758,6 +773,9 @@ fun void AddRefDocument=2376(, int doc)  # Release a reference to the document, deleting document if it fades to black.  fun void ReleaseDocument=2377(, int doc) +# Get which document modification events are sent to the container. +get int GetModEventMask=2378(,) +  # Set the focus to this Scintilla widget.  fun void GrabFocus=2400(,) diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx index e6aa4a013..3f094ce96 100644 --- a/src/CellBuffer.cxx +++ b/src/CellBuffer.cxx @@ -567,7 +567,7 @@ CellBuffer::CellBuffer(int initialLength) {  	gaplen = initialLength;  	part2body = body + gaplen;  	readOnly = false; -	collectingUndo = undoCollectAutoStart; +	collectingUndo = true;  }  CellBuffer::~CellBuffer() { @@ -952,7 +952,7 @@ void CellBuffer::BasicDeleteChars(int position, int deleteLength) {  	part2body = body + gaplen;  } -undoCollectionType CellBuffer::SetUndoCollection(undoCollectionType collectUndo) { +bool CellBuffer::SetUndoCollection(bool collectUndo) {  	collectingUndo = collectUndo;  	uh.DropUndoSequence();  	return collectingUndo; diff --git a/src/CellBuffer.h b/src/CellBuffer.h index 409a8749d..7a3eabaeb 100644 --- a/src/CellBuffer.h +++ b/src/CellBuffer.h @@ -88,8 +88,6 @@ public:  	void Grab(Action *source);  }; -enum undoCollectionType { undoCollectNone, undoCollectAutoStart, undoCollectManualStart }; -  class UndoHistory {  	Action *actions;  	int lenActions; @@ -141,7 +139,7 @@ private:  	char *part2body;  	bool readOnly; -	undoCollectionType collectingUndo; +	bool collectingUndo;  	UndoHistory uh;  	LineVector lv; @@ -199,7 +197,7 @@ public:  	void BasicInsertString(int position, char *s, int insertLength);  	void BasicDeleteChars(int position, int deleteLength); -	undoCollectionType SetUndoCollection(undoCollectionType collectUndo); +	bool SetUndoCollection(bool collectUndo);  	bool IsCollectingUndo();  	void BeginUndoAction();  	void EndUndoAction(); diff --git a/src/Document.h b/src/Document.h index 64955639e..b8f24ebe1 100644 --- a/src/Document.h +++ b/src/Document.h @@ -113,9 +113,10 @@ public:  	bool CanUndo() { return cb.CanUndo(); }  	bool CanRedo() { return cb.CanRedo(); }  	void DeleteUndoHistory() { cb.DeleteUndoHistory(); } -	undoCollectionType SetUndoCollection(undoCollectionType collectUndo) { +	bool SetUndoCollection(bool collectUndo) {  		return cb.SetUndoCollection(collectUndo);  	} +	bool IsCollectingUndo() { return cb.IsCollectingUndo(); }  	void BeginUndoAction() { cb.BeginUndoAction(); }  	void EndUndoAction() { cb.EndUndoAction(); }  	void SetSavePoint(); @@ -128,6 +129,7 @@ public:  	void Indent(bool forwards, int lineBottom, int lineTop);  	void ConvertLineEnds(int eolModeSet);  	void SetReadOnly(bool set) { cb.SetReadOnly(set); } +	bool IsReadOnly() { return cb.IsReadOnly(); }  	void InsertChar(int pos, char ch);  	void InsertString(int position, const char *s); diff --git a/src/Editor.cxx b/src/Editor.cxx index e6ddd3874..26f61f7c8 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -3160,6 +3160,9 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {  		pdoc->SetReadOnly(wParam);  		return TRUE; +	case SCI_GETREADONLY: +		return pdoc->IsReadOnly(); +  	case EM_CANPASTE:  		return 1; @@ -3277,15 +3280,11 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {  		return 0;  	case SCI_SETUNDOCOLLECTION: -		pdoc->SetUndoCollection(static_cast<enum undoCollectionType>(wParam)); +		pdoc->SetUndoCollection(wParam);  		return 0; -#ifdef INCLUDE_DEPRECATED_FEATURES -	case SCI_APPENDUNDOSTARTACTION: -		// Not just deprecated - now dead -		//pdoc->AppendUndoStartAction(); -		return 0; -#endif +	case SCI_GETUNDOCOLLECTION: +		return pdoc->IsCollectingUndo();  	case SCI_BEGINUNDOACTION:  		pdoc->BeginUndoAction(); @@ -3424,19 +3423,13 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {  		pdoc->SetStyles(wParam, reinterpret_cast<char *>(lParam));  		break; -#ifdef INCLUDE_DEPRECATED_FEATURES -	case SCI_SETMARGINWIDTH: -		if (wParam < 100) { -			vs.ms[1].width = wParam; -		} -		InvalidateStyleRedraw(); -		break; -#endif -  	case SCI_SETBUFFEREDDRAW:  		bufferedDraw = wParam;  		break; +	case SCI_GETBUFFEREDDRAW: +		return bufferedDraw; +  	case SCI_SETTABWIDTH:  		if (wParam > 0)  			pdoc->tabInChars = wParam; @@ -3509,20 +3502,17 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {  		pdoc->dbcsCodePage = wParam;  		break; -#ifdef INCLUDE_DEPRECATED_FEATURES -	case SCI_SETLINENUMBERWIDTH: -		if (wParam < 200) { -			vs.ms[0].width = wParam; -		} -		InvalidateStyleRedraw(); -		break; -#endif +	case SCI_GETCODEPAGE: +		return pdoc->dbcsCodePage;  	case SCI_SETUSEPALETTE:  		palette.allowRealization = wParam;  		InvalidateStyleRedraw();  		break; +	case SCI_GETUSEPALETTE: +		return palette.allowRealization; +  		// Marker definition and setting  	case SCI_MARKERDEFINE:  		if (wParam <= MARKER_MAX) @@ -3790,40 +3780,6 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {  		displayPopupMenu = wParam;  		break; -  #ifdef INCLUDE_DEPRECATED_FEATURES -	case SCI_SETFORE: -		vs.styles[STYLE_DEFAULT].fore.desired = Colour(wParam); -		InvalidateStyleRedraw(); -		break; - -	case SCI_SETBACK: -		vs.styles[STYLE_DEFAULT].back.desired = Colour(wParam); -		InvalidateStyleRedraw(); -		break; - -	case SCI_SETBOLD: -		vs.styles[STYLE_DEFAULT].bold = wParam; -		InvalidateStyleRedraw(); -		break; - -	case SCI_SETITALIC: -		vs.styles[STYLE_DEFAULT].italic = wParam; -		InvalidateStyleRedraw(); -		break; - -	case SCI_SETSIZE: -		vs.styles[STYLE_DEFAULT].size = wParam; -		InvalidateStyleRedraw(); -		break; - -	case SCI_SETFONT: -		if (wParam == 0) -			return 0; -		strcpy(vs.styles[STYLE_DEFAULT].fontName, reinterpret_cast<char *>(wParam)); -		InvalidateStyleRedraw(); -		break; -#endif -  	case SCI_SETSELFORE:  		vs.selforeset = wParam;  		vs.selforeground.desired = Colour(lParam); @@ -3841,6 +3797,9 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {  		InvalidateStyleRedraw();  		break; +	case SCI_GETCARETFORE: +		return vs.caretcolour.desired.AsLong(); +  	case SCI_ASSIGNCMDKEY:  		kmap.AssignCmdKey(LOWORD(wParam), HIWORD(wParam), lParam);  		break; @@ -3997,6 +3956,9 @@ LRESULT Editor::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {  		modEventMask = wParam;  		return 0; +	case SCI_GETMODEVENTMASK: +		return modEventMask; +		  	case SCI_CONVERTEOLS:  		pdoc->ConvertLineEnds(wParam);  		SetSelection(currentPos, anchor);	// Ensure selection inside document diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 25af77f99..140d0de87 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -289,11 +289,11 @@ LRESULT ScintillaWin::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {  	case WM_PAINT: {  			//CElapsed ce; ce.Begin(); -			LARGE_INTEGER perfStart; -			LARGE_INTEGER perfEnd; -			LARGE_INTEGER performanceFreq; -			QueryPerformanceFrequency(&performanceFreq); -			QueryPerformanceCounter(&perfStart); +			//LARGE_INTEGER perfStart; +			//LARGE_INTEGER perfEnd; +			//LARGE_INTEGER performanceFreq; +			//QueryPerformanceFrequency(&performanceFreq); +			//QueryPerformanceCounter(&perfStart);  			paintState = painting;  			PAINTSTRUCT ps;  			BeginPaint(wMain.GetID(), &ps); @@ -316,13 +316,13 @@ LRESULT ScintillaWin::WndProc(UINT iMessage, WPARAM wParam, LPARAM lParam) {  				FullPaint();  			}  			paintState = notPainting; -			QueryPerformanceCounter(&perfEnd); -			__int64 start = perfStart.QuadPart; -			__int64 end = perfEnd.QuadPart; -			__int64 freq = performanceFreq.QuadPart; -			__int64 dur = end - start; -			double per = double(dur) / double(freq); -			Platform::DebugPrintf("Paint took %5.03g\n", per); +			//QueryPerformanceCounter(&perfEnd); +			//__int64 start = perfStart.QuadPart; +			//__int64 end = perfEnd.QuadPart; +			//__int64 freq = performanceFreq.QuadPart; +			//__int64 dur = end - start; +			//double per = double(dur) / double(freq); +			//Platform::DebugPrintf("Paint took %5.03g\n", per);  			//Platform::DebugPrintf("Paint took %g\n", ce.End());  		}  		break; | 
