diff options
-rw-r--r-- | cocoa/ScintillaCocoa.h | 6 | ||||
-rw-r--r-- | cocoa/ScintillaCocoa.mm | 6 | ||||
-rw-r--r-- | gtk/ScintillaGTK.cxx | 7 | ||||
-rw-r--r-- | src/Editor.cxx | 9 | ||||
-rw-r--r-- | src/Editor.h | 6 |
5 files changed, 18 insertions, 16 deletions
diff --git a/cocoa/ScintillaCocoa.h b/cocoa/ScintillaCocoa.h index 05ee56c7c..ec253b161 100644 --- a/cocoa/ScintillaCocoa.h +++ b/cocoa/ScintillaCocoa.h @@ -111,8 +111,8 @@ private: FindHighlightLayer *layerFindIndicator; protected: - Point GetVisibleOriginInMain(); - PRectangle GetClientRectangle(); + Point GetVisibleOriginInMain() const; + PRectangle GetClientRectangle() const; virtual PRectangle GetClientDrawingRectangle(); Point ConvertPoint(NSPoint point); virtual void RedrawRect(PRectangle rc); @@ -133,7 +133,7 @@ public: void RegisterNotifyCallback(intptr_t windowid, SciNotifyFunc callback); sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); - NSScrollView* ScrollContainer(); + NSScrollView* ScrollContainer() const; SCIContentView* ContentView(); bool SyncPaint(void* gc, PRectangle rc); diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index b4c16dce4..10992ba86 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -658,7 +658,7 @@ void ScintillaCocoa::CancelModes() { /** * Helper function to get the scrolling view. */ -NSScrollView* ScintillaCocoa::ScrollContainer() { +NSScrollView* ScintillaCocoa::ScrollContainer() const { NSView* container = static_cast<NSView*>(wMain.GetID()); return static_cast<NSScrollView*>([[container superview] superview]); } @@ -678,7 +678,7 @@ SCIContentView* ScintillaCocoa::ContentView() /** * Return the top left visible point relative to the origin point of the whole document. */ -Scintilla::Point ScintillaCocoa::GetVisibleOriginInMain() +Scintilla::Point ScintillaCocoa::GetVisibleOriginInMain() const { NSScrollView *scrollView = ScrollContainer(); NSRect contentRect = [[scrollView contentView] bounds]; @@ -692,7 +692,7 @@ Scintilla::Point ScintillaCocoa::GetVisibleOriginInMain() * in order to make scrolling working properly. * The returned value is in document coordinates. */ -PRectangle ScintillaCocoa::GetClientRectangle() +PRectangle ScintillaCocoa::GetClientRectangle() const { NSScrollView *scrollView = ScrollContainer(); NSSize size = [[scrollView contentView] bounds].size; diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index f74971b1b..fe3547fe2 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -192,7 +192,7 @@ private: virtual bool HaveMouseCapture(); virtual bool PaintContains(PRectangle rc); void FullPaint(); - virtual PRectangle GetClientRectangle(); + virtual PRectangle GetClientRectangle() const; virtual void ScrollText(int linesToMove); virtual void SetVerticalScrollPos(); virtual void SetHorizontalScrollPos(); @@ -1121,8 +1121,9 @@ void ScintillaGTK::FullPaint() { wText.InvalidateAll(); } -PRectangle ScintillaGTK::GetClientRectangle() { - PRectangle rc = wMain.GetClientPosition(); +PRectangle ScintillaGTK::GetClientRectangle() const { + Window &win = const_cast<Window &>(wMain); + PRectangle rc = win.GetClientPosition(); if (verticalScrollBarVisible) rc.right -= verticalScrollBarWidth; if (horizontalScrollBarVisible && !Wrapping()) diff --git a/src/Editor.cxx b/src/Editor.cxx index d3e5f3090..686012f32 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -355,7 +355,7 @@ void Editor::RefreshStyleData() { } } -Point Editor::GetVisibleOriginInMain() { +Point Editor::GetVisibleOriginInMain() const { return Point(0,0); } @@ -379,8 +379,9 @@ int Editor::TopLineOfMain() const { return topLine; } -PRectangle Editor::GetClientRectangle() { - return wMain.GetClientPosition(); +PRectangle Editor::GetClientRectangle() const { + Window &win = const_cast<Window &>(wMain); + return win.GetClientPosition(); } PRectangle Editor::GetClientDrawingRectangle() { @@ -394,7 +395,7 @@ PRectangle Editor::GetTextRectangle() { return rc; } -int Editor::LinesOnScreen() { +int Editor::LinesOnScreen() const { PRectangle rcClient = GetClientRectangle(); int htClient = static_cast<int>(rcClient.bottom - rcClient.top); //Platform::DebugPrintf("lines on screen = %d\n", htClient / lineHeight + 1); diff --git a/src/Editor.h b/src/Editor.h index c7d44c16d..103891e71 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -333,14 +333,14 @@ protected: // ScintillaBase subclass needs access to much of Editor // The top left visible point in main window coordinates. Will be 0,0 except for // scroll views where it will be equivalent to the current scroll position. - virtual Point GetVisibleOriginInMain(); + virtual Point GetVisibleOriginInMain() const; Point DocumentPointFromView(Point ptView); // Convert a point from view space to document int TopLineOfMain() const; // Return the line at Main's y coordinate 0 - virtual PRectangle GetClientRectangle(); + virtual PRectangle GetClientRectangle() const; virtual PRectangle GetClientDrawingRectangle(); PRectangle GetTextRectangle(); - int LinesOnScreen(); + int LinesOnScreen() const; int LinesToScroll(); int MaxScrollPos(); SelectionPosition ClampPositionIntoDocument(SelectionPosition sp) const; |