From fdadfbf88b6ef8abfc4ee6d0d07fa76cd6f79cf1 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Wed, 8 Mar 2000 13:56:46 +0000 Subject: Made work on GTK+/Linux. --- doc/ScintillaDoc.html | 8 +++++--- gtk/PlatGTK.cxx | 8 ++++++-- src/PropSet.cxx | 5 +++++ src/Style.cxx | 9 ++++++++- src/ViewStyle.cxx | 8 ++------ 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 95f95a7e3..4046638fd 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -809,12 +809,14 @@ SCI_SETSAVEPOINT

Sent to the container when the savepoint is entered or left, allowing the container to to - display a dirty indicator and change its menues. The first parameter is 1 when entering the + display a dirty indicator and change its menus. The first parameter is 1 when entering the save point, 0 when leaving.

- The container tells Scintilla where the save point is by sending the SCI_SETSAVEPOINT - message. + The container tells Scintilla where the save point is by sending the SCI_SETSAVEPOINT + message. This is usually done when the file is saved or loaded. As Scintilla performs + undo and redo operations, it will notify the container that it has entered or left the save + point, allowing the container to know if the file should be considered dirty or not.

 SCN_MODIFYATTEMPTRO
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx
index e074aed17..5da2a3a94 100644
--- a/gtk/PlatGTK.cxx
+++ b/gtk/PlatGTK.cxx
@@ -381,8 +381,12 @@ void Surface::DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char
 void Surface::MeasureWidths(Font &font_, const char *s, int len, int *positions) {
 	int totalWidth = 0;
 	for (int i=0;i 1) && lenData > 0) {
 		char ch = *fpc;
 		fpc++;
@@ -46,6 +47,7 @@ static bool GetFullLine(const char *&fpc, int &lenData, char *s, int len) {
 		} else {
 			continuation = false;
 			*s++ = ch;
+			*s = '\0';
 			len--;
 		}
 	}
@@ -253,6 +255,9 @@ void PropSet::ReadFromMemory(const char *data, int len) {
 			if (isalpha(linebuf[0]))
 				Set(linebuf);
 		}
+		// If there is a final line:
+		if (isalpha(linebuf[0]))
+			Set(linebuf);
 	}
 }
 
diff --git a/src/Style.cxx b/src/Style.cxx
index 271d98fc2..120fd6e95 100644
--- a/src/Style.cxx
+++ b/src/Style.cxx
@@ -10,6 +10,7 @@
 #include "Style.h"
 
 Style::Style() {
+	aliasOfDefaultFont = false;
 	Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
 	        Platform::DefaultFontSize(), 0,
 		false, false, false);
@@ -18,11 +19,14 @@ Style::Style() {
 Style::~Style() {
 	if (!aliasOfDefaultFont)
 		font.Release();
+	aliasOfDefaultFont = false;
 }
 
 Style &Style::operator=(const Style &source) {
 	if (this == &source)
 		return *this;
+	// Crash:
+	*(char *)0 = 1;
 	Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),
 	        Platform::DefaultFontSize(), 0,
 		false, false, false);
@@ -47,6 +51,8 @@ void Style::Clear(Colour fore_, Colour back_, int size_, const char *fontName_,
 	eolFilled = eolFilled_;
 	if (!aliasOfDefaultFont)
 		font.Release();
+	else 
+		font.SetID(0);
 	aliasOfDefaultFont = false;
 }
 
@@ -68,7 +74,8 @@ void Style::Realise(Surface &surface, int zoomLevel, Style *defaultStyle) {
 	int sizeZoomed = size + zoomLevel;
 	if (sizeZoomed <= 2)	// Hangs if sizeZoomed <= 1
 		sizeZoomed = 2;
-		
+
+	font.Release();		
 	int deviceHeight = (sizeZoomed * surface.LogPixelsY()) / 72;
 	aliasOfDefaultFont = defaultStyle && EquivalentFontTo(defaultStyle);
 	if (aliasOfDefaultFont) {
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx
index 122db6a00..976593de3 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -51,7 +51,7 @@ ViewStyle::ViewStyle() {
 
 ViewStyle::ViewStyle(const ViewStyle &source) {
 	Init();
-	for (int sty=0;sty<=STYLE_MAX;sty++) {
+	for (unsigned int sty=0;sty<(sizeof(styles)/sizeof(styles[0]));sty++) {
 		styles[sty] = source.styles[sty];
 	}
 	for (int mrk=0;mrk<=MARKER_MAX;mrk++) {
@@ -163,9 +163,7 @@ void ViewStyle::RefreshColourPalette(Palette &pal, bool want) {
 	pal.WantFind(edgecolour, want);
 }
 
-#include 
 void ViewStyle::Refresh(Surface &surface) {
-DWORD dwStart = timeGetTime();
 	selbar.desired = Platform::Chrome();
 	selbarlight.desired = Platform::ChromeHighlight();
 	maxAscent = 1;
@@ -194,8 +192,6 @@ DWORD dwStart = timeGetTime();
 		if (ms[margin].width > 0)
 			maskInLine &= ~ms[margin].mask;
 	}
-DWORD dwEnd = timeGetTime();
-Platform::DebugPrintf("Refresh took %d\n", dwEnd - dwStart);
 }
 
 void ViewStyle::ResetDefaultStyle() {
@@ -206,7 +202,7 @@ void ViewStyle::ResetDefaultStyle() {
 
 void ViewStyle::ClearStyles() {
 	// Reset all styles to be like the default style
-	for (int i=0; i<=STYLE_MAX; i++) {
+	for (unsigned int i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) {
 		if (i != STYLE_DEFAULT) {
 			styles[i].Clear(
 				styles[STYLE_DEFAULT].fore.desired, 
-- 
cgit v1.2.3