Cleanup: use override specifier everywhere, and enable gcc warning to check for it.

This commit is contained in:
Twan van Laarhoven
2020-05-16 00:23:18 +02:00
parent a7c47729c1
commit 5deaeeeb3e
113 changed files with 710 additions and 714 deletions
+2 -2
View File
@@ -122,8 +122,8 @@ struct CompareTabOrder {
assert(a && b);
Style& as = *a->getStyle(), &bs = *b->getStyle();
// if tab_index differs, use that
if (as.tab_index < as.tab_index) return true;
if (as.tab_index > as.tab_index) return false;
if (as.tab_index < bs.tab_index) return true;
if (as.tab_index > bs.tab_index) return false;
// otherwise look at the positions
// To get a total order, we look at the viewer center.
// Not completely (y,x), because for viewers that are almost at the same y we prefer to sort by x
+6 -6
View File
@@ -23,10 +23,10 @@ public:
// --------------------------------------------------- : Utility for ValueViewers/Editors
virtual DrawWhat drawWhat(const ValueViewer*) const;
virtual bool viewerIsCurrent(const ValueViewer*) const;
DrawWhat drawWhat(const ValueViewer*) const override;
bool viewerIsCurrent(const ValueViewer*) const override;
virtual void addAction(unique_ptr<Action> action);
virtual void addAction(unique_ptr<Action> action) final;
inline SetP getSetForActions() { return set; }
// --------------------------------------------------- : Selection
@@ -42,7 +42,7 @@ public:
/// Select the previous editable editor, returns false if the current editor is the first one
bool selectPrevious();
virtual bool AcceptsFocus() const;
bool AcceptsFocus() const override;
/// The next window in the tab order (optional)
const wxWindow* next_in_tab_order;
@@ -90,9 +90,9 @@ public:
protected:
/// Create an editor for the given style (as opposed to a normal viewer)
virtual ValueViewerP makeViewer(const StyleP&);
ValueViewerP makeViewer(const StyleP&) override;
virtual void onInit();
void onInit() override;
// --------------------------------------------------- : Data
ValueViewer* current_viewer; ///< The currently selected viewer
+17 -17
View File
@@ -69,20 +69,20 @@ public:
// --------------------------------------------------- : Clipboard
bool canCut() const;
bool canCopy() const;
bool canPaste() const;
bool canDelete() const;
bool canCut() const override;
bool canCopy() const override;
bool canPaste() const override;
bool canDelete() const override;
// Try to perform a clipboard operation, return success
bool doCopy();
bool doPaste();
bool doDelete();
bool doCopy() override;
bool doPaste() override;
bool doDelete() override;
// --------------------------------------------------- : Set actions
virtual void onBeforeChangeSet();
virtual void onChangeSet();
virtual void onAction(const Action&, bool undone);
void onBeforeChangeSet() override;
void onChangeSet() override;
void onAction(const Action&, bool undone) override;
// --------------------------------------------------- : The cards
public:
@@ -92,7 +92,7 @@ public:
void getSelection(vector<CardP>& out) const;
protected:
/// Get a list of all cards
virtual void getItems(vector<VoidP>& out) const;
void getItems(vector<VoidP>& out) const override;
/// Rebuild the card list (clear all vectors and fill them again)
void rebuild();
@@ -101,24 +101,24 @@ protected:
/// Can the card list be modified?
virtual bool allowModify() const { return false; }
/// Sort all card lists
virtual void sortBy(long column, bool ascending);
void sortBy(long column, bool ascending) override;
/// Send an 'item selected' event for the currently selected item (selected_item)
virtual void sendEvent() { sendEvent(EVENT_CARD_SELECT); }
void sendEvent() override { sendEvent(EVENT_CARD_SELECT); }
void sendEvent(int type = EVENT_CARD_SELECT);
/// Compare cards
virtual bool compareItems(void* a, void* b) const;
bool compareItems(void* a, void* b) const override;
// --------------------------------------------------- : Item 'events'
/// Get the text of an item in a specific column
/** Overrides a function from wxListCtrl */
virtual String OnGetItemText (long pos, long col) const;
String OnGetItemText (long pos, long col) const override;
/// Get the image of an item, by default no image is used
/** Overrides a function from wxListCtrl */
virtual int OnGetItemImage(long pos) const;
int OnGetItemImage(long pos) const override;
/// Get the color for an item
virtual wxListItemAttr* OnGetItemAttr(long pos) const;
wxListItemAttr* OnGetItemAttr(long pos) const override;
// --------------------------------------------------- : Data
private:
+7 -7
View File
@@ -32,24 +32,24 @@ public:
/// Invalidate and redraw the entire viewer
void redraw();
/// Invalidate and redraw (the area of) a single value viewer
virtual void redraw(const ValueViewer&);
void redraw(const ValueViewer&) override;
/// The rotation to use
virtual Rotation getRotation() const;
Rotation getRotation() const override;
virtual bool AcceptsFocus() const { return false; }
bool AcceptsFocus() const override { return false; }
protected:
/// Return the desired size of control
virtual wxSize DoGetBestSize() const;
wxSize DoGetBestSize() const override;
virtual void onChange();
virtual void onChangeSize();
void onChange() override;
void onChangeSize() override;
/// Should the given viewer be drawn?
bool shouldDraw(const ValueViewer&) const;
virtual void drawViewer(RotatedDC& dc, ValueViewer& v);
void drawViewer(RotatedDC& dc, ValueViewer& v) override;
private:
DECLARE_EVENT_TABLE();
+4 -4
View File
@@ -24,10 +24,10 @@ public:
vector<String> choices;
protected:
virtual size_t selection() const { return NO_SELECTION; }
virtual size_t itemCount() const { return choices.size(); }
virtual String itemText(size_t item) const { return choices.at(item); }
virtual void select(size_t item);
size_t selection() const override { return NO_SELECTION; }
size_t itemCount() const override { return choices.size(); }
String itemText(size_t item) const override { return choices.at(item); }
void select(size_t item) override;
};
// ----------------------------------------------------------------------------- : FilterControl
+3 -3
View File
@@ -26,11 +26,11 @@ public:
protected:
/// Get only the subset of the cards
virtual void getItems(vector<VoidP>& out) const;
void getItems(vector<VoidP>& out) const override;
virtual void onChangeSet();
void onChangeSet() override;
private:
private:
CardListFilterP filter; ///< Filter with which this.cards is made
};
+1 -1
View File
@@ -71,7 +71,7 @@ protected:
virtual void onSelect(size_t item, size_t col, bool& changes) {}
/// Return the desired size of control
virtual wxSize DoGetBestSize() const;
wxSize DoGetBestSize() const override;
/// Information on the subcolumns. These are columns inside items
struct SubColumn {
+30 -30
View File
@@ -157,9 +157,9 @@ protected:
class Graph1D : public Graph {
public:
inline Graph1D(size_t axis) : axis(axis) {}
virtual void draw(RotatedDC& dc, const vector<int>& current, DrawLayer layer) const;
virtual bool findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight, vector<int>& out) const;
virtual void setData(const GraphDataP& d);
void draw(RotatedDC& dc, const vector<int>& current, DrawLayer layer) const override;
bool findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight, vector<int>& out) const override;
void setData(const GraphDataP& d) override;
protected:
size_t axis;
/// Find an item, return the position along the axis, or -1 if not found
@@ -172,7 +172,7 @@ protected:
class Graph2D : public Graph {
public:
inline Graph2D(size_t axis1, size_t axis2) : axis1(axis1), axis2(axis2) {}
virtual void setData(const GraphDataP& d);
void setData(const GraphDataP& d) override;
protected:
size_t axis1, axis2;
vector<UInt> values; // axis1.size * axis2.size array
@@ -184,33 +184,33 @@ protected:
class BarGraph : public Graph1D {
public:
inline BarGraph(size_t axis) : Graph1D(axis) {}
virtual void draw(RotatedDC& dc, int current, DrawLayer layer) const;
virtual int findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight) const;
void draw(RotatedDC& dc, int current, DrawLayer layer) const override;
int findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight) const override;
};
// A bar graph with stacked bars
class BarGraph2D : public Graph2D {
public:
inline BarGraph2D(size_t axis_h, size_t axis_v) : Graph2D(axis_h, axis_v) {}
virtual void draw(RotatedDC& dc, const vector<int>& current, DrawLayer layer) const;
virtual bool findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight, vector<int>& out) const;
void draw(RotatedDC& dc, const vector<int>& current, DrawLayer layer) const override;
bool findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight, vector<int>& out) const override;
};
/// A pie graph
class PieGraph : public Graph1D {
public:
inline PieGraph(size_t axis) : Graph1D(axis) {}
virtual void draw(RotatedDC& dc, int current, DrawLayer layer) const;
virtual int findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight) const;
void draw(RotatedDC& dc, int current, DrawLayer layer) const override;
int findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight) const override;
};
/// A scatter plot
class ScatterGraph : public Graph2D {
public:
inline ScatterGraph(size_t axis1, size_t axis2) : Graph2D(axis1, axis2) {}
virtual void draw(RotatedDC& dc, const vector<int>& current, DrawLayer layer) const;
virtual bool findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight, vector<int>& out) const;
virtual void setData(const GraphDataP& d);
void draw(RotatedDC& dc, const vector<int>& current, DrawLayer layer) const override;
bool findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight, vector<int>& out) const override;
void setData(const GraphDataP& d) override;
protected:
UInt max_value;
double max_value_x, max_value_y; ///< highest sum of two adjacent scaled values (radii)
@@ -221,7 +221,7 @@ protected:
class ScatterGraphPlus : public ScatterGraph {
public:
inline ScatterGraphPlus(size_t axis1, size_t axis2, size_t axis3) : ScatterGraph(axis1, axis2), axis3(axis3) {}
virtual void setData(const GraphDataP& d);
void setData(const GraphDataP& d) override;
protected:
size_t axis3;
vector<UInt> values3D; // axis1.size * axis2.size * axis3.size array
@@ -232,7 +232,7 @@ protected:
class ScatterPieGraph : public ScatterGraphPlus {
public:
inline ScatterPieGraph(size_t axis1, size_t axis2, size_t axis3) : ScatterGraphPlus(axis1, axis2, axis3) {}
virtual void draw(RotatedDC& dc, const vector<int>& current, DrawLayer layer) const;
void draw(RotatedDC& dc, const vector<int>& current, DrawLayer layer) const override;
};
/// The legend, used for pie graphs
@@ -241,9 +241,9 @@ public:
inline GraphLegend(size_t axis, Alignment alignment, bool reverse = false)
: Graph1D(axis), alignment(alignment), reverse(reverse)
{}
virtual RealSize determineSize(RotatedDC& dc) const;
virtual void draw(RotatedDC& dc, int current, DrawLayer layer) const;
virtual int findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight) const;
RealSize determineSize(RotatedDC& dc) const override;
void draw(RotatedDC& dc, int current, DrawLayer layer) const override;
int findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight) const override;
private:
mutable RealSize size, item_size;
Alignment alignment;
@@ -256,9 +256,9 @@ public:
inline GraphStats(size_t axis, Alignment alignment)
: Graph1D(axis), alignment(alignment)
{}
virtual RealSize determineSize(RotatedDC& dc) const;
virtual void draw(RotatedDC& dc, int current, DrawLayer layer) const;
virtual void setData(const GraphDataP& d);
RealSize determineSize(RotatedDC& dc) const override;
void draw(RotatedDC& dc, int current, DrawLayer layer) const override;
void setData(const GraphDataP& d) override;
private:
mutable RealSize size, item_size;
mutable double label_width;
@@ -281,8 +281,8 @@ public:
inline GraphLabelAxis(size_t axis, Direction direction, bool rotate = false, DrawLines draw_lines = DRAW_LINES_NO, bool label = false)
: Graph1D(axis), direction(direction), rotate(rotate), draw_lines(draw_lines), label(label)
{}
virtual void draw(RotatedDC& dc, int current, DrawLayer layer) const;
virtual int findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight) const;
void draw(RotatedDC& dc, int current, DrawLayer layer) const override;
int findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight) const override;
private:
Direction direction;
int levels;
@@ -295,7 +295,7 @@ private:
class GraphValueAxis : public Graph1D {
public:
inline GraphValueAxis(size_t axis, bool highlight_value) : Graph1D(axis), highlight_value(highlight_value) {}
virtual void draw(RotatedDC& dc, int current, DrawLayer layer) const;
void draw(RotatedDC& dc, int current, DrawLayer layer) const override;
private:
bool highlight_value;
};
@@ -310,9 +310,9 @@ public:
, margin_left(margin_left), margin_top(margin_top), margin_right(margin_right), margin_bottom(margin_bottom)
, upside_down(upside_down)
{}
virtual void draw(RotatedDC& dc, const vector<int>& current, DrawLayer layer) const;
virtual bool findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight, vector<int>& out) const;
virtual void setData(const GraphDataP& d);
void draw(RotatedDC& dc, const vector<int>& current, DrawLayer layer) const override;
bool findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight, vector<int>& out) const override;
void setData(const GraphDataP& d) override;
private:
const GraphP graph;
double margin_left, margin_top, margin_right, margin_bottom;
@@ -322,9 +322,9 @@ private:
/// A display containing multiple graphs
class GraphContainer : public Graph {
public:
virtual void draw(RotatedDC& dc, const vector<int>& current, DrawLayer layer) const;
virtual bool findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight, vector<int>& out) const;
virtual void setData(const GraphDataP& d);
void draw(RotatedDC& dc, const vector<int>& current, DrawLayer layer) const override;
bool findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight, vector<int>& out) const override;
void setData(const GraphDataP& d) override;
void add(const GraphP& graph);
private:
+3 -3
View File
@@ -57,7 +57,7 @@ public:
wxDateTime::Now()) // TODO: Find mofication time of card image
, filename(filename)
{}
virtual Image generate() {
Image generate() override {
try {
ImageCardList* parent = (ImageCardList*)owner;
Image image;
@@ -72,7 +72,7 @@ public:
return Image();
}
}
virtual void store(const Image& img) {
void store(const Image& img) override {
// add finished bitmap to the imagelist
ImageCardList* parent = (ImageCardList*)owner;
if (img.Ok()) {
@@ -83,7 +83,7 @@ public:
}
}
virtual bool threadSafe() const {return true;}
bool threadSafe() const override {return true;}
private:
LocalFileName filename;
};
+6 -6
View File
@@ -23,10 +23,10 @@ public:
~ImageCardList();
ImageCardList(Window* parent, int id, long additional_style = 0);
protected:
virtual int OnGetItemImage(long pos) const;
virtual void onRebuild();
virtual void onBeforeChangeSet();
virtual bool allowModify() const { return true; }
int OnGetItemImage(long pos) const override;
void onRebuild() override;
void onBeforeChangeSet() override;
bool allowModify() const override { return true; }
private:
DECLARE_EVENT_TABLE();
void onIdle(wxIdleEvent&);
@@ -50,8 +50,8 @@ public:
protected:
/// Get only the subset of the cards
virtual void getItems(vector<VoidP>& out) const;
virtual void onChangeSet();
void getItems(vector<VoidP>& out) const override;
void onChangeSet() override;
private:
CardListFilterP filter; ///< Filter with which this.cards is made
+1 -1
View File
@@ -99,7 +99,7 @@ protected:
// --------------------------------------------------- : Fixing wx issues
wxSize DoGetBestClientSize() const;
wxSize DoGetBestClientSize() const override;
// --------------------------------------------------- : Data
VoidP selected_item; ///< The currently selected item
+16 -16
View File
@@ -43,9 +43,9 @@ public:
// --------------------------------------------------- : Set stuff
virtual void onBeforeChangeSet();
virtual void onChangeSet();
virtual void onAction(const Action&, bool);
void onBeforeChangeSet() override;
void onChangeSet() override;
void onAction(const Action&, bool) override;
void updateUsageStatistics();
// --------------------------------------------------- : Selection
@@ -58,35 +58,35 @@ public:
// --------------------------------------------------- : Clipboard
bool canDelete() const;
bool canCopy() const;
bool canPaste() const;
bool canDelete() const override;
bool canCopy() const override;
bool canPaste() const override;
// Try to perform a clipboard operation, return success
bool doCut();
bool doCopy();
bool doPaste();
bool doDelete();
bool doCut() override;
bool doCopy() override;
bool doPaste() override;
bool doDelete() override;
// --------------------------------------------------- : The keywords
protected:
/// Get a list of all keywords
virtual void getItems(vector<VoidP>& out) const;
void getItems(vector<VoidP>& out) const override;
/// Return the keyword at the given position in the sorted keyword list
inline KeywordP getKeyword(long pos) const { return static_pointer_cast<Keyword>(getItem(pos)); }
/// Send an 'item selected' event for the currently selected item (selected_item)
virtual void sendEvent();
void sendEvent() override;
/// Compare keywords
virtual bool compareItems(void* a, void* b) const;
bool compareItems(void* a, void* b) const override;
/// Get the text of an item in a specific column
/** Overrides a function from wxListCtrl */
virtual String OnGetItemText (long pos, long col) const;
String OnGetItemText (long pos, long col) const override;
/// Get the image of an item, by default no image is used
/** Overrides a function from wxListCtrl */
virtual int OnGetItemImage(long pos) const;
int OnGetItemImage(long pos) const override;
/// Get the color for an item
virtual wxListItemAttr* OnGetItemAttr(long pos) const;
wxListItemAttr* OnGetItemAttr(long pos) const override;
private:
void storeColumns();
+10 -10
View File
@@ -21,16 +21,16 @@ public:
NativeLookEditor(Window* parent, int id, long style = wxBORDER_THEME);
/// Uses a native look
virtual bool nativeLook() const { return true; }
virtual Rotation getRotation() const;
bool nativeLook() const override { return true; }
Rotation getRotation() const override;
virtual void draw(DC& dc);
virtual void drawViewer(RotatedDC& dc, ValueViewer& v);
void draw(DC& dc) override;
void drawViewer(RotatedDC& dc, ValueViewer& v) override;
protected:
// Best size doesn't really matter, as long as it is not too small
virtual wxSize DoGetBestSize() const;
virtual void onInit();
wxSize DoGetBestSize() const override;
void onInit() override;
private:
static const int margin = 6;
@@ -57,9 +57,9 @@ class SetInfoEditor : public NativeLookEditor {
public:
SetInfoEditor(Window* parent, int id, long style = wxBORDER_THEME);
virtual Package& getStylePackage() const;
Package& getStylePackage() const override;
protected:
virtual void onChangeSet();
void onChangeSet() override;
};
// ----------------------------------------------------------------------------- : StylingEditor
@@ -74,7 +74,7 @@ public:
/// Show the styling for given card
void showCard(const CardP& card);
protected:
virtual void onChangeSet();
void onChangeSet() override;
};
// ----------------------------------------------------------------------------- : ExportOptionsEditor
@@ -87,7 +87,7 @@ public:
/// Show the options for given export template
void showExport(const ExportTemplateP& export_template);
virtual Package& getStylePackage() const;
Package& getStylePackage() const override;
private:
ExportTemplateP export_template;
};
+2 -2
View File
@@ -53,9 +53,9 @@ public:
protected:
/// Draw an item
virtual void drawItem(DC& dc, int x, int y, size_t item);
void drawItem(DC& dc, int x, int y, size_t item) override;
/// Return how many items there are in the list
virtual size_t itemCount() const;
size_t itemCount() const override;
private:
// The default icon to use
+2 -2
View File
@@ -31,8 +31,8 @@ public:
void setSelection(const vector<CardP>& cards);
protected:
virtual int OnGetItemImage(long pos) const;
virtual void onChangeSet();
int OnGetItemImage(long pos) const override;
void onChangeSet() override;
private:
DECLARE_EVENT_TABLE();
+7 -7
View File
@@ -48,18 +48,18 @@ public:
TextStyle& getStyle();
/// Uses a native look
virtual bool nativeLook() const { return true; }
virtual Rotation getRotation() const;
bool nativeLook() const override { return true; }
Rotation getRotation() const override;
virtual void draw(DC& dc);
void draw(DC& dc) override;
virtual bool AcceptsFocus() const;
bool AcceptsFocus() const override;
virtual void onChangeSet();
void onChangeSet() override;
protected:
virtual void onInit();
virtual wxSize DoGetBestSize() const;
void onInit() override;
wxSize DoGetBestSize() const override;
private:
bool multi_line; ///< Multi line text control?
+1 -1
View File
@@ -131,7 +131,7 @@ TreeList::TreeList(Window* parent, int id, long style)
wxClientDC dc(this);
dc.SetFont(*wxNORMAL_FONT);
int h;
dc.GetTextExtent(_("X"), 0, &h);
dc.GetTextExtent(_("X"), nullptr, &h);
item_height = h + 2;
}