aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil Hodgson <nyamatongwe@gmail.com>2017-03-04 14:32:28 +1100
committerNeil Hodgson <nyamatongwe@gmail.com>2017-03-04 14:32:28 +1100
commite17d87205db3b9a3e6bc4b7f14c11d48b48b66f2 (patch)
tree12d78104aad0cd576a856a7087e727f7b3926221
parent69df0a683aed2f3f5240894a8852514fc6458469 (diff)
downloadscintilla-mirror-e17d87205db3b9a3e6bc4b7f14c11d48b48b66f2.tar.gz
Use "override" for Cocoa platform code and add to Editor where possible.
-rw-r--r--cocoa/PlatCocoa.h76
-rw-r--r--cocoa/PlatCocoa.mm48
-rw-r--r--cocoa/ScintillaCocoa.h98
-rw-r--r--src/Editor.h32
4 files changed, 127 insertions, 127 deletions
diff --git a/cocoa/PlatCocoa.h b/cocoa/PlatCocoa.h
index 0465cb4c8..dddec85de 100644
--- a/cocoa/PlatCocoa.h
+++ b/cocoa/PlatCocoa.h
@@ -68,55 +68,55 @@ private:
static const int BYTES_PER_PIXEL = BITS_PER_PIXEL / 8;
public:
SurfaceImpl();
- ~SurfaceImpl();
+ ~SurfaceImpl() override;
- void Init(WindowID wid);
- void Init(SurfaceID sid, WindowID wid);
- void InitPixMap(int width, int height, Surface *surface_, WindowID wid);
+ void Init(WindowID wid) override;
+ void Init(SurfaceID sid, WindowID wid) override;
+ void InitPixMap(int width, int height, Surface *surface_, WindowID wid) override;
CGContextRef GetContext() { return gc; }
- void Release();
- bool Initialised();
- void PenColour(ColourDesired fore);
+ void Release() override;
+ bool Initialised() override;
+ void PenColour(ColourDesired fore) override;
/** Returns a CGImageRef that represents the surface. Returns NULL if this is not possible. */
CGImageRef GetImage();
void CopyImageRectangle(Surface &surfaceSource, PRectangle srcRect, PRectangle dstRect);
- int LogPixelsY();
- int DeviceHeightFont(int points);
- void MoveTo(int x_, int y_);
- void LineTo(int x_, int y_);
- void Polygon(Scintilla::Point *pts, int npts, ColourDesired fore, ColourDesired back);
- void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back);
- void FillRectangle(PRectangle rc, ColourDesired back);
- void FillRectangle(PRectangle rc, Surface &surfacePattern);
- void RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back);
+ int LogPixelsY() override;
+ int DeviceHeightFont(int points) override;
+ void MoveTo(int x_, int y_) override;
+ void LineTo(int x_, int y_) override;
+ void Polygon(Scintilla::Point *pts, int npts, ColourDesired fore, ColourDesired back) override;
+ void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back) override;
+ void FillRectangle(PRectangle rc, ColourDesired back) override;
+ void FillRectangle(PRectangle rc, Surface &surfacePattern) override;
+ void RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back) override;
void AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, int alphaFill,
- ColourDesired outline, int alphaOutline, int flags);
- void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage);
- void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back);
- void Copy(PRectangle rc, Scintilla::Point from, Surface &surfaceSource);
+ ColourDesired outline, int alphaOutline, int flags) override;
+ void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage) override;
+ void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back) override;
+ void Copy(PRectangle rc, Scintilla::Point from, Surface &surfaceSource) override;
void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore,
- ColourDesired back);
+ ColourDesired back) override;
void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore,
- ColourDesired back);
- void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore);
- void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions);
- XYPOSITION WidthText(Font &font_, const char *s, int len);
- XYPOSITION WidthChar(Font &font_, char ch);
- XYPOSITION Ascent(Font &font_);
- XYPOSITION Descent(Font &font_);
- XYPOSITION InternalLeading(Font &font_);
- XYPOSITION ExternalLeading(Font &font_);
- XYPOSITION Height(Font &font_);
- XYPOSITION AverageCharWidth(Font &font_);
-
- void SetClip(PRectangle rc);
- void FlushCachedState();
-
- void SetUnicodeMode(bool unicodeMode_);
- void SetDBCSMode(int codePage_);
+ ColourDesired back) override;
+ void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore) override;
+ void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions) override;
+ XYPOSITION WidthText(Font &font_, const char *s, int len) override;
+ XYPOSITION WidthChar(Font &font_, char ch) override;
+ XYPOSITION Ascent(Font &font_) override;
+ XYPOSITION Descent(Font &font_) override;
+ XYPOSITION InternalLeading(Font &font_) override;
+ XYPOSITION ExternalLeading(Font &font_) override;
+ XYPOSITION Height(Font &font_) override;
+ XYPOSITION AverageCharWidth(Font &font_) override;
+
+ void SetClip(PRectangle rc) override;
+ void FlushCachedState() override;
+
+ void SetUnicodeMode(bool unicodeMode_) override;
+ void SetDBCSMode(int codePage_) override;
}; // SurfaceImpl class
} // Scintilla namespace
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm
index 678608e11..ca599b34d 100644
--- a/cocoa/PlatCocoa.mm
+++ b/cocoa/PlatCocoa.mm
@@ -1569,41 +1569,41 @@ public:
doubleClickActionData(nullptr)
{
}
- ~ListBoxImpl() {}
+ ~ListBoxImpl() override {}
// ListBox methods
- void SetFont(Font& font);
- void Create(Window& parent, int ctrlID, Scintilla::Point pt, int lineHeight_, bool unicodeMode_, int technology_);
- void SetAverageCharWidth(int width);
- void SetVisibleRows(int rows);
- int GetVisibleRows() const;
- PRectangle GetDesiredRect();
- int CaretFromEdge();
- void Clear();
- void Append(char* s, int type = -1);
- int Length();
- void Select(int n);
- int GetSelection();
- int Find(const char* prefix);
- void GetValue(int n, char* value, int len);
- void RegisterImage(int type, const char* xpm_data);
- void RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage);
- void ClearRegisteredImages();
- void SetDoubleClickAction(CallBackAction action, void* data)
+ void SetFont(Font& font) override;
+ void Create(Window& parent, int ctrlID, Scintilla::Point pt, int lineHeight_, bool unicodeMode_, int technology_) override;
+ void SetAverageCharWidth(int width) override;
+ void SetVisibleRows(int rows) override;
+ int GetVisibleRows() const override;
+ PRectangle GetDesiredRect() override;
+ int CaretFromEdge() override;
+ void Clear() override;
+ void Append(char* s, int type = -1) override;
+ int Length() override;
+ void Select(int n) override;
+ int GetSelection() override;
+ int Find(const char* prefix) override;
+ void GetValue(int n, char* value, int len) override;
+ void RegisterImage(int type, const char* xpm_data) override;
+ void RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage) override;
+ void ClearRegisteredImages() override;
+ void SetDoubleClickAction(CallBackAction action, void* data) override
{
doubleClickAction = action;
doubleClickActionData = data;
}
- void SetList(const char* list, char separator, char typesep);
+ void SetList(const char* list, char separator, char typesep) override;
// To clean up when closed
void ReleaseViews();
// For access from AutoCompletionDataSource implement IListBox
- int Rows();
- NSImage* ImageForRow(NSInteger row);
- NSString* TextForRow(NSInteger row);
- void DoubleClick();
+ int Rows() override;
+ NSImage* ImageForRow(NSInteger row) override;
+ NSString* TextForRow(NSInteger row) override;
+ void DoubleClick() override;
};
void ListBoxImpl::Create(Window& /*parent*/, int /*ctrlID*/, Scintilla::Point pt,
diff --git a/cocoa/ScintillaCocoa.h b/cocoa/ScintillaCocoa.h
index 1defaf220..60400cc77 100644
--- a/cocoa/ScintillaCocoa.h
+++ b/cocoa/ScintillaCocoa.h
@@ -118,27 +118,27 @@ private:
FindHighlightLayer *layerFindIndicator;
protected:
- Point GetVisibleOriginInMain() const;
- PRectangle GetClientRectangle() const;
- virtual PRectangle GetClientDrawingRectangle();
+ Point GetVisibleOriginInMain() const override;
+ PRectangle GetClientRectangle() const override;
+ PRectangle GetClientDrawingRectangle() override;
Point ConvertPoint(NSPoint point);
- virtual void RedrawRect(PRectangle rc);
- virtual void DiscardOverdraw();
- virtual void Redraw();
+ void RedrawRect(PRectangle rc) override;
+ void DiscardOverdraw() override;
+ void Redraw() override;
- virtual void Initialise();
- virtual void Finalise();
- virtual CaseFolder *CaseFolderForEncoding();
- virtual std::string CaseMapString(const std::string &s, int caseMapping);
- virtual void CancelModes();
+ void Initialise() override;
+ void Finalise() override;
+ CaseFolder *CaseFolderForEncoding() override;
+ std::string CaseMapString(const std::string &s, int caseMapping) override;
+ void CancelModes() override;
public:
ScintillaCocoa(ScintillaView* sciView_, SCIContentView* viewContent, SCIMarginView* viewMargin);
- virtual ~ScintillaCocoa();
+ ~ScintillaCocoa() override;
void SetDelegate(id<ScintillaNotificationProtocol> delegate_);
void RegisterNotifyCallback(intptr_t windowid, SciNotifyFunc callback);
- sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
+ sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) override;
NSScrollView* ScrollContainer() const;
SCIContentView* ContentView();
@@ -147,43 +147,43 @@ public:
bool Draw(NSRect rect, CGContextRef gc);
void PaintMargin(NSRect aRect);
- virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
- void TickFor(TickReason reason);
- bool FineTickerAvailable();
- bool FineTickerRunning(TickReason reason);
- void FineTickerStart(TickReason reason, int millis, int tolerance);
- void FineTickerCancel(TickReason reason);
- bool SetIdle(bool on);
- void SetMouseCapture(bool on);
- bool HaveMouseCapture();
+ sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) override;
+ void TickFor(TickReason reason) override;
+ bool FineTickerAvailable() override;
+ bool FineTickerRunning(TickReason reason) override;
+ void FineTickerStart(TickReason reason, int millis, int tolerance) override;
+ void FineTickerCancel(TickReason reason) override;
+ bool SetIdle(bool on) override;
+ void SetMouseCapture(bool on) override;
+ bool HaveMouseCapture() override;
void WillDraw(NSRect rect);
- void ScrollText(int linesToMove);
- void SetVerticalScrollPos();
- void SetHorizontalScrollPos();
- bool ModifyScrollBars(int nMax, int nPage);
+ void ScrollText(int linesToMove) override;
+ void SetVerticalScrollPos() override;
+ void SetHorizontalScrollPos() override;
+ bool ModifyScrollBars(int nMax, int nPage) override;
bool SetScrollingSize(void);
void Resize();
void UpdateForScroll();
// Notifications for the owner.
- void NotifyChange();
- void NotifyFocus(bool focus);
- void NotifyParent(SCNotification scn);
+ void NotifyChange() override;
+ void NotifyFocus(bool focus) override;
+ void NotifyParent(SCNotification scn) override;
void NotifyURIDropped(const char *uri);
bool HasSelection();
bool CanUndo();
bool CanRedo();
- virtual void CopyToClipboard(const SelectionText &selectedText);
- virtual void Copy();
- virtual bool CanPaste();
- virtual void Paste();
- virtual void Paste(bool rectangular);
+ void CopyToClipboard(const SelectionText &selectedText) override;
+ void Copy() override;
+ bool CanPaste() override;
+ void Paste() override;
+ void Paste(bool rectangular);
void CTPaint(void* gc, NSRect rc);
void CallTipMouseDown(NSPoint pt);
- virtual void CreateCallTipWindow(PRectangle rc);
- virtual void AddToPopUp(const char *label, int cmd = 0, bool enabled = true);
- virtual void ClaimSelection();
+ void CreateCallTipWindow(PRectangle rc) override;
+ void AddToPopUp(const char *label, int cmd = 0, bool enabled = true) override;
+ void ClaimSelection() override;
NSPoint GetCaretPosition();
@@ -195,8 +195,8 @@ public:
static void UpdateObserver(CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *sci);
void ObserverAdd();
void ObserverRemove();
- virtual void IdleWork();
- virtual void QueueIdleWork(WorkNeeded::workItems items, int upTo);
+ void IdleWork() override;
+ void QueueIdleWork(WorkNeeded::workItems items, int upTo) override;
int InsertText(NSString* input);
NSRange PositionsFromCharacters(NSRange rangeCharacters) const;
NSRange CharactersFromPositions(NSRange rangePositions) const;
@@ -210,7 +210,7 @@ public:
void CompositionStart();
void CompositionCommit();
void CompositionUndo();
- virtual void SetDocPointer(Document *document);
+ void SetDocPointer(Document *document) override;
bool KeyboardInput(NSEvent* event);
void MouseDown(NSEvent* event);
@@ -222,7 +222,7 @@ public:
void MouseWheel(NSEvent* event);
// Drag and drop
- void StartDrag();
+ void StartDrag() override;
bool GetDragData(id <NSDraggingInfo> info, NSPasteboard &pasteBoard, SelectionText* selectedText);
NSDragOperation DraggingEntered(id <NSDraggingInfo> info);
NSDragOperation DraggingUpdated(id <NSDraggingInfo> info);
@@ -231,18 +231,18 @@ public:
void DragScroll();
// Promote some methods needed for NSResponder actions.
- virtual void SelectAll();
+ void SelectAll() override;
void DeleteBackward();
- virtual void Cut();
- virtual void Undo();
- virtual void Redo();
+ void Cut() override;
+ void Undo() override;
+ void Redo() override;
- virtual bool ShouldDisplayPopupOnMargin();
- virtual bool ShouldDisplayPopupOnText();
- virtual NSMenu* CreateContextMenu(NSEvent* event);
+ bool ShouldDisplayPopupOnMargin();
+ bool ShouldDisplayPopupOnText();
+ NSMenu* CreateContextMenu(NSEvent* event);
void HandleCommand(NSInteger command);
- virtual void ActiveStateChanged(bool isActive);
+ void ActiveStateChanged(bool isActive);
void WindowWillMove();
// Find indicator
diff --git a/src/Editor.h b/src/Editor.h
index 864bac94f..c29985c78 100644
--- a/src/Editor.h
+++ b/src/Editor.h
@@ -261,7 +261,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
bool convertPastes;
Editor();
- virtual ~Editor();
+ ~Editor() override;
virtual void Initialise() = 0;
virtual void Finalise();
@@ -274,14 +274,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() const;
+ virtual Point GetVisibleOriginInMain() const override;
PointDocument DocumentPointFromView(Point ptView) const; // Convert a point from view space to document
- int TopLineOfMain() const; // Return the line at Main's y coordinate 0
+ int TopLineOfMain() const override; // Return the line at Main's y coordinate 0
virtual PRectangle GetClientRectangle() const;
virtual PRectangle GetClientDrawingRectangle();
PRectangle GetTextRectangle() const;
- virtual int LinesOnScreen() const;
+ virtual int LinesOnScreen() const override;
int LinesToScroll() const;
int MaxScrollPos() const;
SelectionPosition ClampPositionIntoDocument(SelectionPosition sp) const;
@@ -402,16 +402,16 @@ protected: // ScintillaBase subclass needs access to much of Editor
void ClearSelection(bool retainMultipleSelections = false);
void ClearAll();
void ClearDocumentStyle();
- void Cut();
+ virtual void Cut();
void PasteRectangular(SelectionPosition pos, const char *ptr, int len);
virtual void Copy() = 0;
virtual void CopyAllowLine();
virtual bool CanPaste();
virtual void Paste() = 0;
void Clear();
- void SelectAll();
- void Undo();
- void Redo();
+ virtual void SelectAll();
+ virtual void Undo();
+ virtual void Redo();
void DelCharBack(bool allowLineStartDeletion);
virtual void ClaimSelection() = 0;
@@ -444,14 +444,14 @@ protected: // ScintillaBase subclass needs access to much of Editor
void NotifyDwelling(Point pt, bool state);
void NotifyZoom();
- void NotifyModifyAttempt(Document *document, void *userData);
- void NotifySavePoint(Document *document, void *userData, bool atSavePoint);
+ void NotifyModifyAttempt(Document *document, void *userData) override;
+ void NotifySavePoint(Document *document, void *userData, bool atSavePoint) override;
void CheckModificationForWrap(DocModification mh);
- void NotifyModified(Document *document, DocModification mh, void *userData);
- void NotifyDeleted(Document *document, void *userData);
- void NotifyStyleNeeded(Document *doc, void *userData, int endPos);
- void NotifyLexerChanged(Document *doc, void *userData);
- void NotifyErrorOccurred(Document *doc, void *userData, int status);
+ void NotifyModified(Document *document, DocModification mh, void *userData) override;
+ void NotifyDeleted(Document *document, void *userData) override;
+ void NotifyStyleNeeded(Document *doc, void *userData, int endPos) override;
+ void NotifyLexerChanged(Document *doc, void *userData) override;
+ void NotifyErrorOccurred(Document *doc, void *userData, int status) override;
void NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
void ContainerNeedsUpdate(int flags);
@@ -564,7 +564,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
bool PositionIsHotspot(int position) const;
bool PointIsHotspot(Point pt);
void SetHotSpotRange(Point *pt);
- Range GetHotSpotRange() const;
+ Range GetHotSpotRange() const override;
void SetHoverIndicatorPosition(int position);
void SetHoverIndicatorPoint(Point pt);