From ba22db923ee18c31a0a8797dbe1e6c6c3ec2e4e0 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sat, 27 Jan 2001 06:00:27 +0000 Subject: Much changed ScintillaGTK widget code that draws directly onto the Scintilla widget with no wDraw drawing area. Signals handled directly through callbacks. --- src/Editor.cxx | 18 +++++++++--------- src/Editor.h | 8 +++----- src/ScintillaBase.cxx | 6 +++--- 3 files changed, 15 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/Editor.cxx b/src/Editor.cxx index dc5c03622..e79d43e6f 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -1,6 +1,6 @@ // Scintilla source code edit control // Editor.cxx - main code for the edit control -// Copyright 1998-2000 by Neil Hodgson +// Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include @@ -168,7 +168,7 @@ void Editor::RefreshStyleData() { } PRectangle Editor::GetClientRectangle() { - return wDraw.GetClientPosition(); + return wMain.GetClientPosition(); } PRectangle Editor::GetTextRectangle() { @@ -310,7 +310,7 @@ int Editor::PositionFromLineX(int line, int x) { } void Editor::RedrawRect(PRectangle rc) { - //Platform::DebugPrintf("Redraw %d %d - %d %d\n", rc.left, rc.top, rc.right, rc.bottom); + //Platform::DebugPrintf("Redraw %0d,%0d - %0d,%0d\n", rc.left, rc.top, rc.right, rc.bottom); // Clip the redraw rectangle into the client area PRectangle rcClient = GetClientRectangle(); @@ -324,13 +324,13 @@ void Editor::RedrawRect(PRectangle rc) { rc.right = rcClient.right; if ((rc.bottom > rc.top) && (rc.right > rc.left)) { - wDraw.InvalidateRectangle(rc); + wMain.InvalidateRectangle(rc); } } void Editor::Redraw() { //Platform::DebugPrintf("Redraw all\n"); - wDraw.InvalidateAll(); + wMain.InvalidateAll(); } void Editor::RedrawSelMargin() { @@ -339,7 +339,7 @@ void Editor::RedrawSelMargin() { } else { PRectangle rcSelMargin = GetClientRectangle(); rcSelMargin.right = vs.fixedColumnWidth; - wDraw.InvalidateRectangle(rcSelMargin); + wMain.InvalidateRectangle(rcSelMargin); } } @@ -549,7 +549,7 @@ void Editor::HorizontalScrollTo(int xPos) { if (xOffset < 0) xOffset = 0; SetHorizontalScrollPos(); - Redraw(); + RedrawRect(GetClientRectangle()); } void Editor::MoveCaretInsideView() { @@ -2563,9 +2563,9 @@ void Editor::SetDragPosition(int newPos) { void Editor::DisplayCursor(Window::Cursor c) { if (cursorMode == SC_CURSORNORMAL) - wDraw.SetCursor(c); + wMain.SetCursor(c); else - wDraw.SetCursor(static_cast(cursorMode)); + wMain.SetCursor(static_cast(cursorMode)); } void Editor::StartDrag() { diff --git a/src/Editor.h b/src/Editor.h index 52b3d7037..0a37c8b8f 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -1,6 +1,6 @@ // Scintilla source code edit control // Editor.h - defines the main editor class -// Copyright 1998-2000 by Neil Hodgson +// Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #ifndef EDITOR_H @@ -48,11 +48,9 @@ class Editor : public DocWatcher { Editor &operator=(const Editor &) { return *this; } protected: // ScintillaBase subclass needs access to much of Editor - // On GTK+, Scintilla is a container widget holding two scroll bars and a drawing area + // On GTK+, Scintilla is a container widget holding two scroll bars // whereas on Windows there is just one window with both scroll bars turned on. - // Therefore, on GTK+ the following are separate windows but only one window on Windows. Window wMain; // The Scintilla parent window - Window wDraw; // The text drawing area // Style resources may be expensive to allocate so are cached between uses. // When a style attribute is changed, this cache is flushed. @@ -161,7 +159,7 @@ protected: // ScintillaBase subclass needs access to much of Editor void RefreshStyleData(); void DropGraphics(); - PRectangle GetClientRectangle(); + virtual PRectangle GetClientRectangle(); PRectangle GetTextRectangle(); int LinesOnScreen(); diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 703d6e534..ccb9dcf53 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -1,6 +1,6 @@ // Scintilla source code edit control // ScintillaBase.cxx - an enhanced subclass of Editor with calltips, autocomplete and context menu -// Copyright 1998-2000 by Neil Hodgson +// Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include @@ -187,7 +187,7 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) { return; } } - ac.Start(wDraw, idAutoComplete, currentPos, lenEntered); + ac.Start(wMain, idAutoComplete, currentPos, lenEntered); PRectangle rcClient = GetClientRectangle(); Point pt = LocationFromPosition(currentPos-lenEntered); @@ -448,7 +448,7 @@ long ScintillaBase::WndProc(unsigned int iMessage, unsigned long wParam, long lP } // Now display the window. CreateCallTipWindow(rc); - ct.wCallTip.SetPositionRelative(rc, wDraw); + ct.wCallTip.SetPositionRelative(rc, wMain); ct.wCallTip.Show(); } } -- cgit v1.2.3