From 5deaeeeb3e181344abf0e7f6b23e32833042598e Mon Sep 17 00:00:00 2001 From: Twan van Laarhoven Date: Sat, 16 May 2020 00:23:18 +0200 Subject: [PATCH] Cleanup: use override specifier everywhere, and enable gcc warning to check for it. --- CMakeLists.txt | 2 +- src/cli/cli_main.hpp | 6 +-- src/data/action/keyword.hpp | 12 ++--- src/data/action/set.hpp | 32 ++++++------ src/data/action/symbol.hpp | 56 ++++++++++---------- src/data/action/symbol_part.cpp | 8 +-- src/data/action/symbol_part.hpp | 38 +++++++------- src/data/action/value.cpp | 4 +- src/data/action/value.hpp | 32 ++++++------ src/data/export_template.hpp | 6 +-- src/data/field/boolean.hpp | 4 +- src/data/field/choice.hpp | 14 ++--- src/data/field/color.hpp | 6 +-- src/data/field/image.hpp | 2 +- src/data/field/information.hpp | 16 +++--- src/data/field/multiple_choice.hpp | 6 +-- src/data/field/package_choice.hpp | 14 ++--- src/data/field/text.hpp | 20 +++---- src/data/filter.hpp | 2 +- src/data/format/apprentice.cpp | 22 ++++---- src/data/format/image.cpp | 2 +- src/data/format/mse1.cpp | 10 ++-- src/data/format/mse2.cpp | 14 ++--- src/data/format/mtg_editor.cpp | 22 ++++---- src/data/game.hpp | 6 +-- src/data/installer.hpp | 6 +-- src/data/locale.hpp | 4 +- src/data/pack.cpp | 4 +- src/data/set.hpp | 10 ++-- src/data/stylesheet.hpp | 6 +-- src/data/symbol.hpp | 38 +++++++------- src/data/symbol_font.hpp | 20 +++---- src/gui/about_window.hpp | 8 +-- src/gui/auto_replace_window.cpp | 14 ++--- src/gui/control/card_editor.cpp | 4 +- src/gui/control/card_editor.hpp | 12 ++--- src/gui/control/card_list.hpp | 34 ++++++------ src/gui/control/card_viewer.hpp | 14 ++--- src/gui/control/filter_ctrl.cpp | 8 +-- src/gui/control/filtered_card_list.hpp | 6 +-- src/gui/control/gallery_list.hpp | 2 +- src/gui/control/graph.hpp | 60 ++++++++++----------- src/gui/control/image_card_list.cpp | 6 +-- src/gui/control/image_card_list.hpp | 12 ++--- src/gui/control/item_list.hpp | 2 +- src/gui/control/keyword_list.hpp | 32 ++++++------ src/gui/control/native_look_editor.hpp | 20 +++---- src/gui/control/package_list.hpp | 4 +- src/gui/control/select_card_list.hpp | 4 +- src/gui/control/text_ctrl.hpp | 14 ++--- src/gui/control/tree_list.cpp | 2 +- src/gui/drop_down_list.cpp | 4 +- src/gui/image_slice_window.hpp | 4 +- src/gui/package_update_list.cpp | 12 ++--- src/gui/package_update_list.hpp | 10 ++-- src/gui/packages_window.cpp | 4 +- src/gui/preferences_window.cpp | 8 +-- src/gui/print_window.cpp | 10 ++-- src/gui/set/cards_panel.cpp | 10 ++-- src/gui/set/cards_panel.hpp | 44 ++++++++-------- src/gui/set/console_panel.hpp | 14 ++--- src/gui/set/keywords_panel.hpp | 28 +++++----- src/gui/set/panel.hpp | 2 +- src/gui/set/random_pack_panel.cpp | 12 ++--- src/gui/set/random_pack_panel.hpp | 24 ++++----- src/gui/set/set_info_panel.hpp | 26 +++++----- src/gui/set/stats_panel.cpp | 10 ++-- src/gui/set/stats_panel.hpp | 16 +++--- src/gui/set/style_panel.hpp | 26 +++++----- src/gui/set/window.cpp | 2 +- src/gui/set/window.hpp | 4 +- src/gui/symbol/basic_shape_editor.hpp | 24 ++++----- src/gui/symbol/control.hpp | 4 +- src/gui/symbol/part_list.hpp | 8 +-- src/gui/symbol/point_editor.cpp | 2 +- src/gui/symbol/point_editor.hpp | 30 +++++------ src/gui/symbol/select_editor.hpp | 30 +++++------ src/gui/symbol/symmetry_editor.hpp | 26 +++++----- src/gui/thumbnail_thread.cpp | 2 +- src/gui/update_checker.cpp | 4 +- src/gui/value/choice.cpp | 6 +-- src/gui/value/choice.hpp | 18 +++---- src/gui/value/color.cpp | 14 ++--- src/gui/value/color.hpp | 10 ++-- src/gui/value/editor.hpp | 8 +-- src/gui/value/image.hpp | 14 ++--- src/gui/value/information.hpp | 4 +- src/gui/value/multiple_choice.hpp | 10 ++-- src/gui/value/package_choice.cpp | 12 ++--- src/gui/value/package_choice.hpp | 10 ++-- src/gui/value/symbol.hpp | 12 ++--- src/gui/value/text.cpp | 20 +++---- src/gui/value/text.hpp | 72 +++++++++++++------------- src/gui/welcome_window.hpp | 2 +- src/main.cpp | 12 ++--- src/render/card/viewer.hpp | 4 +- src/render/symbol/filter.hpp | 18 +++---- src/render/symbol/viewer.hpp | 2 +- src/render/value/choice.hpp | 6 +-- src/render/value/color.hpp | 4 +- src/render/value/image.hpp | 6 +-- src/render/value/information.hpp | 2 +- src/render/value/multiple_choice.hpp | 6 +-- src/render/value/package_choice.hpp | 2 +- src/render/value/symbol.hpp | 4 +- src/render/value/text.hpp | 12 ++--- src/render/value/viewer.hpp | 4 +- src/script/functions/regex.cpp | 4 +- src/script/script_manager.hpp | 2 +- src/util/dynamic_arg.hpp | 6 +-- src/util/io/package.hpp | 6 +-- src/util/smart_ptr.hpp | 4 +- src/util/vcs/subversion.hpp | 6 +-- 113 files changed, 710 insertions(+), 714 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fd3c9fd..19854f2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,7 +52,7 @@ endif() # warnings if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) # Update if necessary - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-comment") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wsuggest-override -Wstrict-null-sentinel -Wno-comment -Wno-unused-parameter") endif() # visual studio debugger diff --git a/src/cli/cli_main.hpp b/src/cli/cli_main.hpp index 0daa4c8d..5106833d 100644 --- a/src/cli/cli_main.hpp +++ b/src/cli/cli_main.hpp @@ -20,9 +20,9 @@ public: /// The set is optional CLISetInterface(const SetP& set, bool quiet = false, bool run = true); protected: - virtual void onAction(const Action&, bool) {} - virtual void onChangeSet(); - virtual void onBeforeChangeSet(); + void onAction(const Action&, bool) override {} + void onChangeSet() override; + void onBeforeChangeSet() override; private: bool quiet; ///< Supress prompts and other non-vital stuff bool running; ///< Still running? diff --git a/src/data/action/keyword.hpp b/src/data/action/keyword.hpp index b97625da..34182b02 100644 --- a/src/data/action/keyword.hpp +++ b/src/data/action/keyword.hpp @@ -40,8 +40,8 @@ public: AddKeywordAction(Set& set); AddKeywordAction(AddingOrRemoving, Set& set, const KeywordP& keyword); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; const GenericAddAction action; }; @@ -75,9 +75,9 @@ public: Keyword& keyword; ///< The keyword we are the reminder text of /// Try to compile the script - virtual void store(); + void store() override; /// Add some tags, so the script looks nice - virtual void retrieve(); + void retrieve() override; /// Syntax highlight, and store in value void highlight(const String& code, const vector& errors); @@ -91,8 +91,8 @@ class ChangeKeywordModeAction : public Action { public: ChangeKeywordModeAction(Keyword& keyword, const String& new_mode); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; //private: Keyword& keyword; diff --git a/src/data/action/set.hpp b/src/data/action/set.hpp index 84153042..3b97ed94 100644 --- a/src/data/action/set.hpp +++ b/src/data/action/set.hpp @@ -44,8 +44,8 @@ public: AddCardAction(AddingOrRemoving, Set& set, const CardP& card); AddCardAction(AddingOrRemoving, Set& set, const vector& cards); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; const GenericAddAction action; }; @@ -57,8 +57,8 @@ class ReorderCardsAction : public CardListAction { public: ReorderCardsAction(Set& set, size_t card_id1, size_t card_id2); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; //private: const size_t card_id1, card_id2; ///< Positions of the two cards to swap @@ -69,8 +69,8 @@ public: /// An action that affects the rendering/display/look of a set or cards in the set class DisplayChangeAction : public Action { public: - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; }; /// Changing the style of a a card @@ -78,8 +78,8 @@ class ChangeCardStyleAction : public DisplayChangeAction { public: ChangeCardStyleAction(const CardP& card, const StyleSheetP& stylesheet); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; //private: CardP card; ///< The affected card @@ -93,8 +93,8 @@ class ChangeSetStyleAction : public DisplayChangeAction { public: ChangeSetStyleAction(Set& set, const CardP& card); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; private: Set& set; ///< The affected set @@ -109,8 +109,8 @@ class ChangeCardHasStylingAction : public DisplayChangeAction { public: ChangeCardHasStylingAction(Set& set, const CardP& card); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; //private: Set& set; ///< The set to copy styling from @@ -136,8 +136,8 @@ public: /// Add a newly allocated card AddPackAction(AddingOrRemoving, Set& set, const PackTypeP& pack); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; const GenericAddAction action; }; @@ -148,8 +148,8 @@ public: /// Add a newly allocated card ChangePackAction(Set& set, size_t pos, const PackTypeP& new_pack); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; private: PackTypeP pack; diff --git a/src/data/action/symbol.hpp b/src/data/action/symbol.hpp index ec2cf513..536d4670 100644 --- a/src/data/action/symbol.hpp +++ b/src/data/action/symbol.hpp @@ -40,8 +40,8 @@ class SymbolPartMoveAction : public SymbolPartsAction { public: SymbolPartMoveAction(const set& parts, const Vector2D& delta = Vector2D()); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; /// Update this action to move some more void move(const Vector2D& delta); @@ -80,8 +80,8 @@ class SymbolPartRotateAction : public SymbolPartMatrixAction { public: SymbolPartRotateAction(const set& parts, const Vector2D& center); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; /// Update this action to rotate to a different angle void rotateTo(Radians newAngle); @@ -103,8 +103,8 @@ class SymbolPartShearAction : public SymbolPartMatrixAction { public: SymbolPartShearAction(const set& parts, const Vector2D& center); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; /// Change shear by a given amount void move(const Vector2D& deltaShear); @@ -126,8 +126,8 @@ class SymbolPartScaleAction : public SymbolPartsAction { public: SymbolPartScaleAction(const set& parts, int scaleX, int scaleY); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; /// Change min and max coordinates void move(const Vector2D& delta_min, const Vector2D& delta_max); @@ -157,8 +157,8 @@ public: // All parts must be SymbolParts CombiningModeAction(const set& parts, SymbolShapeCombine mode); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; private: void add(const SymbolPartP&, SymbolShapeCombine mode); @@ -172,9 +172,9 @@ class SymbolPartNameAction : public SymbolPartAction { public: SymbolPartNameAction(const SymbolPartP& part, const String& name, size_t old_cursor, size_t new_cursor); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); - virtual bool merge(const Action& action); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; + bool merge(const Action& action) override; public: SymbolPartP part; ///< Affected part @@ -190,8 +190,8 @@ class AddSymbolPartAction : public SymbolPartListAction { public: AddSymbolPartAction(Symbol& symbol, const SymbolPartP& part); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; private: Symbol& symbol; ///< Symbol to add the part to @@ -205,8 +205,8 @@ class RemoveSymbolPartsAction : public SymbolPartListAction { public: RemoveSymbolPartsAction(Symbol& symbol, const set& parts); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; private: Symbol& symbol; @@ -234,8 +234,8 @@ class DuplicateSymbolPartsAction : public SymbolPartListAction { public: DuplicateSymbolPartsAction(Symbol& symbol, const set& parts); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; /// Fill a set with all the new parts void getParts(set& parts); @@ -254,8 +254,8 @@ class ReorderSymbolPartsAction : public SymbolPartListAction { public: ReorderSymbolPartsAction(SymbolGroup& old_parent, size_t old_position, SymbolGroup& new_parent, size_t new_position); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; private: SymbolGroup* old_parent, *new_parent;///< Parents to move from and to @@ -269,8 +269,8 @@ public: /// Remove all the given groups UngroupReorderSymbolPartsAction(SymbolGroup& group_parent, size_t group_pos, SymbolGroup& target_parent, size_t target_pos); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; private: SymbolGroup& group_parent; @@ -287,11 +287,11 @@ class GroupSymbolPartsActionBase : public SymbolPartListAction { public: GroupSymbolPartsActionBase(SymbolGroup& root); - virtual void perform(bool to_undo); + void perform(bool to_undo) override; protected: - SymbolGroup& root; ///< Symbol or group to group stuff in - vector old_part_list; ///< Old part list of the symbol + SymbolGroup& root; ///< Symbol or group to group stuff in + vector old_part_list; ///< Old part list of the symbol }; /// Group multiple symbol parts together @@ -299,7 +299,7 @@ class GroupSymbolPartsAction : public GroupSymbolPartsActionBase { public: GroupSymbolPartsAction(SymbolGroup& root, const set& parts, const SymbolGroupP& group); - virtual String getName(bool to_undo) const; + String getName(bool to_undo) const override; private: SymbolGroupP group; }; @@ -310,6 +310,6 @@ public: /// Remove all the given groups UngroupSymbolPartsAction(SymbolGroup& root, const set& groups); - virtual String getName(bool to_undo) const; + String getName(bool to_undo) const override; }; diff --git a/src/data/action/symbol_part.cpp b/src/data/action/symbol_part.cpp index a91c20af..d229e65e 100644 --- a/src/data/action/symbol_part.cpp +++ b/src/data/action/symbol_part.cpp @@ -304,8 +304,8 @@ class SinglePointRemoveAction : public Action, public IntrusivePtrBase& to_delete); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; private: vector removals; diff --git a/src/data/action/symbol_part.hpp b/src/data/action/symbol_part.hpp index 8446f32b..6637f71d 100644 --- a/src/data/action/symbol_part.hpp +++ b/src/data/action/symbol_part.hpp @@ -54,8 +54,8 @@ class ControlPointMoveAction : public ExtendableAction { public: ControlPointMoveAction(const set& points); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; /// Update this action to move some more void move(const Vector2D& delta); @@ -76,8 +76,8 @@ class HandleMoveAction : public ExtendableAction { public: HandleMoveAction(const SelectedHandle& handle); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; /// Update this action to move some more void move(const Vector2D& delta); @@ -115,8 +115,8 @@ class SegmentModeAction : public Action { public: SegmentModeAction(const ControlPointP& p1, const ControlPointP& p2, SegmentMode mode); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; protected: ControlPointUpdate point1, point2; @@ -129,8 +129,8 @@ class LockModeAction : public Action { public: LockModeAction(const ControlPointP& p, LockMode mode); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; private: ControlPointUpdate point; ///< The affected point @@ -145,9 +145,9 @@ class CurveDragAction : public SegmentModeAction { public: CurveDragAction(const ControlPointP& point1, const ControlPointP& point2); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); - + String getName(bool to_undo) const override; + void perform(bool to_undo) override; + // Move the curve by this much, it is grabbed at time t void move(const Vector2D& delta, double t); }; @@ -160,8 +160,8 @@ public: /// Insert a new point in shape, after position insertAfter_, at the time t on the segment ControlPointAddAction(const SymbolShapeP& shape, UInt insert_after, double t); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; inline ControlPointP getNewPoint() const { return new_point; } @@ -188,8 +188,8 @@ class SymmetryMoveAction : public Action { public: SymmetryMoveAction(SymbolSymmetry& symmetry, bool is_handle); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; /// Update this action to move some more void move(const Vector2D& delta); @@ -211,8 +211,8 @@ class SymmetryTypeAction : public Action { public: SymmetryTypeAction(SymbolSymmetry& symmetry, SymbolSymmetryType type); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; private: SymbolSymmetry& symmetry; SymbolSymmetryType type; @@ -227,8 +227,8 @@ class SymmetryCopiesAction : public Action { public: SymmetryCopiesAction(SymbolSymmetry& symmetry, int copies); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; private: SymbolSymmetry& symmetry; int copies; diff --git a/src/data/action/value.cpp b/src/data/action/value.cpp index 10157370..9becad61 100644 --- a/src/data/action/value.cpp +++ b/src/data/action/value.cpp @@ -59,13 +59,13 @@ public: : ValueAction(value), new_value(new_value) {} - virtual void perform(bool to_undo) { + void perform(bool to_undo) override { ValueAction::perform(to_undo); swap_value(static_cast(*valueP), new_value); valueP->onAction(*this, to_undo); // notify value } - virtual bool merge(const Action& action) { + bool merge(const Action& action) override { if (!ALLOW_MERGE) return false; TYPE_CASE(action, SimpleValueAction) { if (action.valueP == valueP) { diff --git a/src/data/action/value.hpp b/src/data/action/value.hpp index 18763ff3..ede4a70f 100644 --- a/src/data/action/value.hpp +++ b/src/data/action/value.hpp @@ -40,8 +40,8 @@ public: : valueP(value), card(nullptr), old_time_modified(wxDateTime::Now()) {} - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; /// We know that the value is on the given card, add that information void isOnCard(Card* card); @@ -69,9 +69,9 @@ class TextValueAction : public ValueAction { public: TextValueAction(const TextValueP& value, size_t start, size_t end, size_t new_end, const Defaultable& new_value, const String& name); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); - virtual bool merge(const Action& action); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; + bool merge(const Action& action) override; inline const String& newValue() const { return new_value(); } @@ -99,10 +99,10 @@ class TextToggleReminderAction : public ValueAction { public: TextToggleReminderAction(const TextValueP& value, size_t pos); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; - private: +private: size_t pos; ///< Position of "& new_value); - virtual void perform(bool to_undo); + void perform(bool to_undo) override; bool merge(const SimpleTextValueAction& action); private: Defaultable new_value; @@ -125,8 +125,8 @@ class ReplaceAllAction : public Action { public: ~ReplaceAllAction(); - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; vector actions; }; @@ -137,9 +137,9 @@ public: class ScriptValueEvent : public Action { public: inline ScriptValueEvent(const Card* card, const Value* value) : card(card), value(value) {} - - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + + String getName(bool to_undo) const override; + void perform(bool to_undo) override; const Card* card; ///< Card the value is on const Value* value; ///< The modified value @@ -152,8 +152,8 @@ public: : stylesheet(stylesheet), style(style) {} - virtual String getName(bool to_undo) const; - virtual void perform(bool to_undo); + String getName(bool to_undo) const override; + void perform(bool to_undo) override; const StyleSheet* stylesheet; ///< StyleSheet the style is for const Style* style; ///< The modified style diff --git a/src/data/export_template.hpp b/src/data/export_template.hpp index f8da69df..9f64b653 100644 --- a/src/data/export_template.hpp +++ b/src/data/export_template.hpp @@ -34,9 +34,9 @@ public: OptionalScript script; ///< Export script, for multi file templates and initialization static String typeNameStatic(); - virtual String typeName() const; - Version fileVersion() const; - virtual void validate(Version = app_version); + String typeName() const override; + Version fileVersion() const override; + void validate(Version = app_version) override; /// Loads the export template with a particular name static ExportTemplateP byName(const String & name); private: diff --git a/src/data/field/boolean.hpp b/src/data/field/boolean.hpp index c6bc611b..03d1dd84 100644 --- a/src/data/field/boolean.hpp +++ b/src/data/field/boolean.hpp @@ -33,7 +33,7 @@ class BooleanStyle : public ChoiceStyle { public: BooleanStyle(const ChoiceFieldP& field); DECLARE_HAS_FIELD(Boolean); // not DECLARE_STYLE_TYPE, because we use a normal ChoiceValueViewer/Editor - virtual StyleP clone() const; + StyleP clone() const override; // no extra data @@ -48,7 +48,7 @@ class BooleanValue : public ChoiceValue { public: inline BooleanValue(const ChoiceFieldP& field) : ChoiceValue(field) {} DECLARE_HAS_FIELD(Boolean); - virtual ValueP clone() const; + ValueP clone() const override; // no extra data diff --git a/src/data/field/choice.hpp b/src/data/field/choice.hpp index 3b626469..5953792c 100644 --- a/src/data/field/choice.hpp +++ b/src/data/field/choice.hpp @@ -41,8 +41,8 @@ public: map choice_colors; ///< Colors for the various choices (when color_cardlist) map choice_colors_cardlist; ///< Colors for the various choices, for in the card list - virtual void initDependencies(Context&, const Dependency&) const; - virtual void after_reading(Version ver); + void initDependencies(Context&, const Dependency&) const override; + void after_reading(Version ver) override; }; @@ -174,10 +174,10 @@ public: /// Initialize image from choice_images void initImage(); - virtual int update(Context&); - virtual void initDependencies(Context&, const Dependency&) const; - virtual void checkContentDependencies(Context&, const Dependency&) const; - virtual void invalidate(); + int update(Context&) override; + void initDependencies(Context&, const Dependency&) const override; + void checkContentDependencies(Context&, const Dependency&) const override; + void invalidate() override; }; // ----------------------------------------------------------------------------- : ChoiceValue @@ -194,6 +194,6 @@ public: ValueType value; /// The name of the selected choice - virtual bool update(Context&); + bool update(Context&) override; }; diff --git a/src/data/field/color.hpp b/src/data/field/color.hpp index edf55bd5..ef206cb9 100644 --- a/src/data/field/color.hpp +++ b/src/data/field/color.hpp @@ -36,7 +36,7 @@ public: Defaultable initial; ///< Initial choice of a new value, if not set the first choice is used String default_name; ///< Name of "default" value - virtual void initDependencies(Context&, const Dependency&) const; + void initDependencies(Context&, const Dependency&) const override; }; /// A color that can be chosen for this field @@ -63,7 +63,7 @@ public: double bottom_width; ///< Width of the colored region on the bottom side ImageCombine combine; ///< How to combine image with the background - virtual int update(Context&); + int update(Context&) override; }; // ----------------------------------------------------------------------------- : ColorValue @@ -76,7 +76,7 @@ public: ValueType value; ///< The value - virtual bool update(Context&); + bool update(Context&) override; }; diff --git a/src/data/field/image.hpp b/src/data/field/image.hpp index faa1a826..feb449e0 100644 --- a/src/data/field/image.hpp +++ b/src/data/field/image.hpp @@ -37,7 +37,7 @@ public: ScriptableImage default_image; ///< Placeholder - virtual int update(Context&); + int update(Context&) override; }; // ----------------------------------------------------------------------------- : ImageValue diff --git a/src/data/field/information.hpp b/src/data/field/information.hpp index 21d710c3..aa75f6aa 100644 --- a/src/data/field/information.hpp +++ b/src/data/field/information.hpp @@ -28,9 +28,9 @@ public: InfoField() { editable = false; } DECLARE_FIELD_TYPE(Text); - OptionalScript script; ///< Script to apply to all values + OptionalScript script; ///< Script to apply to all values - virtual void initDependencies(Context&, const Dependency&) const; + void initDependencies(Context&, const Dependency&) const override; }; // ----------------------------------------------------------------------------- : InfoStyle @@ -41,14 +41,14 @@ public: InfoStyle(const InfoFieldP&); DECLARE_STYLE_TYPE(Info); - Font font; ///< Font to use for the text - Alignment alignment; ///< Alignment inside the box - double padding_left, padding_right; ///< Padding + Font font; ///< Font to use for the text + Alignment alignment; ///< Alignment inside the box + double padding_left, padding_right; ///< Padding double padding_top, padding_bottom; Color background_color; - virtual int update(Context&); - virtual void initDependencies(Context&, const Dependency&) const; + int update(Context&) override; + void initDependencies(Context&, const Dependency&) const override; }; // ----------------------------------------------------------------------------- : InfoValue @@ -61,6 +61,6 @@ public: ValueType value; - virtual bool update(Context&); + bool update(Context&) override; }; diff --git a/src/data/field/multiple_choice.hpp b/src/data/field/multiple_choice.hpp index 61fe6b23..d29dcf88 100644 --- a/src/data/field/multiple_choice.hpp +++ b/src/data/field/multiple_choice.hpp @@ -38,7 +38,7 @@ public: Scriptable direction; ///< In what direction are choices layed out? Scriptable spacing; ///< Spacing between choices (images) in pixels - virtual int update(Context&); + int update(Context&) override; }; // ----------------------------------------------------------------------------- : MultipleChoiceValue @@ -51,7 +51,7 @@ class MultipleChoiceValue : public ChoiceValue { public: inline MultipleChoiceValue(const MultipleChoiceFieldP& field) : ChoiceValue(field, false) {} DECLARE_HAS_FIELD(MultipleChoice); - virtual ValueP clone() const; + ValueP clone() const override; String last_change; ///< Which of the choices was selected/deselected last? @@ -64,7 +64,7 @@ public: /// Splits the value, stores the selected choices in the out parameter void get(vector& out) const; - virtual bool update(Context&); + bool update(Context&) override; private: DECLARE_REFLECTION(); diff --git a/src/data/field/package_choice.hpp b/src/data/field/package_choice.hpp index c56d57b2..10f055a7 100644 --- a/src/data/field/package_choice.hpp +++ b/src/data/field/package_choice.hpp @@ -28,12 +28,12 @@ public: DECLARE_FIELD_TYPE(PackageChoice); OptionalScript script; ///< Script to apply to all values - String match; ///< Package filenames to match - String initial; ///< Initial value + String match; ///< Package filenames to match + String initial; ///< Initial value bool required; ///< Is selecting a package required? - String empty_name; ///< Displayed name for the empty value (if !required) + String empty_name; ///< Displayed name for the empty value (if !required) - virtual void initDependencies(Context&, const Dependency&) const; + void initDependencies(Context&, const Dependency&) const override; }; // ----------------------------------------------------------------------------- : PackageChoiceStyle @@ -46,7 +46,7 @@ public: Font font; ///< Font to use for the text - virtual int update(Context&); + int update(Context&) override; }; // ----------------------------------------------------------------------------- : PackageChoiceValue @@ -59,9 +59,9 @@ public: ValueType package_name; ///< The selected package - /// Get the package (if it is set) + /// Get the package (if it is set), otherwise return nullptr PackagedP getPackage() const; - virtual bool update(Context&); + bool update(Context&) override; }; diff --git a/src/data/field/text.hpp b/src/data/field/text.hpp index 74510bb5..153b3958 100644 --- a/src/data/field/text.hpp +++ b/src/data/field/text.hpp @@ -34,14 +34,14 @@ public: TextField(); DECLARE_FIELD_TYPE(Text); - OptionalScript script; ///< Script to apply to all values + OptionalScript script; ///< Script to apply to all values OptionalScript default_script; ///< Script that generates the default value //%OptionalScript view_script; ///< Script to apply before viewing //%OptionalScript unview_script; ///< Script to apply after changes to the view - bool multi_line; ///< Are newlines allowed in the text? - String default_name; ///< Name of "default" value + bool multi_line; ///< Are newlines allowed in the text? + String default_name; ///< Name of "default" value - virtual void initDependencies(Context&, const Dependency&) const; + void initDependencies(Context&, const Dependency&) const override; }; // ----------------------------------------------------------------------------- : TextStyle @@ -95,9 +95,9 @@ public: double content_width, content_height; ///< Size of the rendered text int content_lines; ///< Number of rendered lines - virtual int update(Context&); - virtual void initDependencies(Context&, const Dependency&) const; - virtual void checkContentDependencies(Context&, const Dependency&) const; + int update(Context&) override; + void initDependencies(Context&, const Dependency&) const override; + void checkContentDependencies(Context&, const Dependency&) const override; /// Stretch factor to use double getStretch() const; @@ -114,7 +114,7 @@ public: ValueType value; ///< The text of this value Age last_update; ///< When was the text last changed? - virtual bool update(Context&); + bool update(Context&) override; }; // ----------------------------------------------------------------------------- : TextValue @@ -139,8 +139,8 @@ public: virtual void retrieve(); /// Update underlying data - virtual void onAction(Action& a, bool undone); + void onAction(Action& a, bool undone) override; /// Editing the same underlying value? - virtual bool equals(const Value* that); + bool equals(const Value* that) override; }; diff --git a/src/data/filter.hpp b/src/data/filter.hpp index 9751f5d4..939153ef 100644 --- a/src/data/filter.hpp +++ b/src/data/filter.hpp @@ -64,7 +64,7 @@ template class QuickFilter : public Filter { public: QuickFilter(String const& query) : query(parse_quicksearch_query(query)) {} - virtual bool keep(T const& x) const { + bool keep(T const& x) const override { return match_quicksearch_query(query, x); } private: diff --git a/src/data/format/apprentice.cpp b/src/data/format/apprentice.cpp index 9a97630e..62da76ab 100644 --- a/src/data/format/apprentice.cpp +++ b/src/data/format/apprentice.cpp @@ -43,7 +43,7 @@ public: /// Update the progress bar /** if the operation should be aborted, throws an AbortException */ - virtual void onProgress(float progress, const String& message); + void onProgress(float progress, const String& message) override; }; ExportProgressDialog::ExportProgressDialog(Window* parent, const String& title, const String& message) @@ -133,8 +133,8 @@ public: : ApprDatabase(progress_target, _("Expan.dat")) {} protected: - virtual void doRead(wxInputStream& in); - virtual void doWrite(wxOutputStream& out); + void doRead(wxInputStream& in) override; + void doWrite(wxOutputStream& out) override; public: map expansions; ///< code -> name @@ -196,8 +196,8 @@ public: void removeSet(const String& code); protected: - virtual void doRead(wxInputStream& in); - virtual void doWrite(wxOutputStream& out); + void doRead(wxInputStream& in) override; + void doWrite(wxOutputStream& out) override; private: vector formats; @@ -280,8 +280,8 @@ public: void removeSet(const String& code); protected: - virtual void doRead(wxInputStream& in); - virtual void doWrite(wxOutputStream& out); + void doRead(wxInputStream& in) override; + void doWrite(wxOutputStream& out) override; public: map distros; @@ -295,7 +295,7 @@ void ApprDistroDatabase::removeSet(const String& code) { void ApprDistroDatabase::doRead(wxInputStream& in) { wxTextInputStream tin(in); - ApprDistro* last = 0; + ApprDistro* last = nullptr; while (!in.Eof()) { String l = trim(tin.ReadLine()); if (l.size() > 2 && l.GetChar(0) == _('<')) { @@ -365,8 +365,8 @@ public: void removeSet(const String& code); protected: - virtual void doRead(wxInputStream& in); - virtual void doWrite(wxOutputStream& out); + void doRead(wxInputStream& in) override; + void doWrite(wxOutputStream& out) override; public: vector cards; @@ -582,7 +582,7 @@ class ApprenticeExportWindow : public wxDialog, public WithProgress { public: ApprenticeExportWindow(Window* parent, const SetP& set); - virtual void onProgress(float p, const String& message); + void onProgress(float p, const String& message) override; void doStep(const String& s, float size); private: diff --git a/src/data/format/image.cpp b/src/data/format/image.cpp index 573c55b4..57f4edc4 100644 --- a/src/data/format/image.cpp +++ b/src/data/format/image.cpp @@ -29,7 +29,7 @@ public: UnzoomedDataViewer(bool use_zoom_settings) : use_zoom_settings(use_zoom_settings) {} - virtual Rotation getRotation() const; + Rotation getRotation() const override; private: bool use_zoom_settings; }; diff --git a/src/data/format/mse1.cpp b/src/data/format/mse1.cpp index f5e0748d..9d721104 100644 --- a/src/data/format/mse1.cpp +++ b/src/data/format/mse1.cpp @@ -22,11 +22,11 @@ /// The file format of MSE1 files class MSE1FileFormat : public FileFormat { public: - virtual String extension() { return _("mse"); } - virtual String name() { return _("Magic Set Editor version 1 files (*.mse)"); } - virtual bool canImport() { return true; } - virtual bool canExport(const Game&) { return false; } - virtual SetP importSet(const String& filename); + String extension() override { return _("mse"); } + String name() override { return _("Magic Set Editor version 1 files (*.mse)"); } + bool canImport() override { return true; } + bool canExport(const Game&) override { return false; } + SetP importSet(const String& filename) override; }; FileFormatP mse1_file_format() { diff --git a/src/data/format/mse2.cpp b/src/data/format/mse2.cpp index 27b588fc..0dd6427d 100644 --- a/src/data/format/mse2.cpp +++ b/src/data/format/mse2.cpp @@ -16,12 +16,12 @@ /// The file format of MSE2 files class MSE2FileFormat : public FileFormat { public: - virtual String extension() { return _("mse-set"); } - virtual String matches() { return _("*.mse-set;set"); } - virtual String name() { return _("Magic Set Editor sets (*.mse-set)"); } - virtual bool canImport() { return true; } - virtual bool canExport(const Game&) { return true; } - virtual SetP importSet(const String& filename) { + String extension() override { return _("mse-set"); } + String matches() override { return _("*.mse-set;set"); } + String name() override { return _("Magic Set Editor sets (*.mse-set)"); } + bool canImport() override { return true; } + bool canExport(const Game&) override { return true; } + SetP importSet(const String& filename) override { wxString set_name = filename; // Strip "/set" or "/set.mset-set" from the end, this allows opening directories as set files if (filename.EndsWith(_(".mse-set/set")) || filename.EndsWith(_(".mse-set\\set"))) { @@ -34,7 +34,7 @@ public: settings.addRecentFile(set_name); return set; } - virtual void exportSet(Set& set, const String& filename, bool is_copy) { + void exportSet(Set& set, const String& filename, bool is_copy) override { if (is_copy) { set.saveCopy(filename); } else { diff --git a/src/data/format/mtg_editor.cpp b/src/data/format/mtg_editor.cpp index 17d1410e..634bca74 100644 --- a/src/data/format/mtg_editor.cpp +++ b/src/data/format/mtg_editor.cpp @@ -23,11 +23,11 @@ /// The file format of Mtg Editor files class MtgEditorFileFormat : public FileFormat { public: - virtual String extension() { return _("set"); } - virtual String name() { return _("Mtg Editor files (*.set)"); } - virtual bool canImport() { return true; } - virtual bool canExport(const Game&) { return false; } - virtual SetP importSet(const String& filename); + String extension() override { return _("set"); } + String name() override { return _("Mtg Editor files (*.set)"); } + bool canImport() override { return true; } + bool canExport(const Game&) override { return false; } + SetP importSet(const String& filename) override; private: // Filter: se filename -> image directory // based on MtgEditor's: CardSet.getImageFolder @@ -115,17 +115,17 @@ SetP MtgEditorFileFormat::importSet(const String& filename) { } else if (line == _("#COST##########")) { // casting cost target = ¤t_card->value(_("casting cost")).value; } else if (line == _("#RARITY########") || line == _("#FREQUENCY#####")) { // rarity - target = 0; + target = nullptr; line = file.ReadLine(); if (line == _("0")) current_card->value(_("rarity")).value.assign(_("common")); else if (line == _("1")) current_card->value(_("rarity")).value.assign(_("uncommon")); else current_card->value(_("rarity")).value.assign(_("rare")); } else if (line == _("#COLOR#########")) { // card color - target = 0; + target = nullptr; line = file.ReadLine(); current_card->value(_("card color")).value.assign(line); } else if (line == _("#AUTOBG########")) { // card color.isDefault - target = 0; + target = nullptr; line = file.ReadLine(); if (line == _("TRUE")) { current_card->value(_("card color")).value.makeDefault(); @@ -143,7 +143,7 @@ SetP MtgEditorFileFormat::importSet(const String& filename) { } else if (line == _("#TOUGHNESS#####")) { // toughness target = ¤t_card->value(_("toughness")).value; } else if (line == _("#ILLUSTRATION##") || line == _("#ILLUSTRATION8#")) { // image - target = 0; + target = nullptr; line = file.ReadLine(); if (!wxFileExists(line)) { // based on card name and date @@ -158,14 +158,14 @@ SetP MtgEditorFileFormat::importSet(const String& filename) { } } } else if (line == _("#TOMBSTONE#####")) { // tombstone - target = 0; + target = nullptr; line = file.ReadLine(); current_card->value(_("card symbol")).value.assign( line==_("TRUE") ? _("tombstone") : _("none") ); } else { // normal text - if (target != 0) { // value of a text field + if (target != nullptr) { // value of a text field if (!target->isDefault()) target->mutate() += _("\n"); target->mutate() += line; } else { diff --git a/src/data/game.hpp b/src/data/game.hpp index d88d40fc..c34c3ede 100644 --- a/src/data/game.hpp +++ b/src/data/game.hpp @@ -70,11 +70,11 @@ public: void initCardListColorScript(); static String typeNameStatic(); - virtual String typeName() const; - Version fileVersion() const; + String typeName() const override; + Version fileVersion() const override; protected: - virtual void validate(Version); + void validate(Version) override; DECLARE_REFLECTION_OVERRIDE(); }; diff --git a/src/data/installer.hpp b/src/data/installer.hpp index 659e1f35..2fbccf2d 100644 --- a/src/data/installer.hpp +++ b/src/data/installer.hpp @@ -43,9 +43,9 @@ public: void addPackage(Packaged& package); protected: - virtual String typeName() const; - virtual Version fileVersion() const; - virtual void validate(Version file_app_version); + String typeName() const override; + Version fileVersion() const override; + void validate(Version file_app_version) override; DECLARE_REFLECTION(); }; diff --git a/src/data/locale.hpp b/src/data/locale.hpp index 963fd11b..8b5c8892 100644 --- a/src/data/locale.hpp +++ b/src/data/locale.hpp @@ -43,8 +43,8 @@ public: static LocaleP byName(const String& name); protected: - String typeName() const; - Version fileVersion() const; + String typeName() const override; + Version fileVersion() const override; DECLARE_REFLECTION(); }; diff --git a/src/data/pack.cpp b/src/data/pack.cpp index 755e5478..18d83daa 100644 --- a/src/data/pack.cpp +++ b/src/data/pack.cpp @@ -256,7 +256,7 @@ void PackInstance::generate(vector* out) { // 1. the weights of each item, and of the cards vector weighted_items; FOR_EACH_CONST(item, pack_type.items) { - WeightedItem wi = {0,0,parent.gen()}; + WeightedItem wi = {0,0,(int)parent.gen()}; if (pack_type.select == SELECT_EQUAL_PROPORTIONAL) { wi.weight = item->weight * parent.get(item->name).total_weight; } else if (pack_type.select == SELECT_EQUAL_NONEMPTY) { @@ -266,7 +266,7 @@ void PackInstance::generate(vector* out) { } weighted_items.push_back(wi); } - WeightedItem wi = {cards.size(),0,parent.gen()}; + WeightedItem wi = {(double)cards.size(),0,(int)parent.gen()}; weighted_items.push_back(wi); // 2. divide the requested_copies among the cards and the items, taking the weights into account weighted_equal_divide(weighted_items, (int)requested_copies); diff --git a/src/data/set.hpp b/src/data/set.hpp index 5f9c74c4..a46895af 100644 --- a/src/data/set.hpp +++ b/src/data/set.hpp @@ -114,18 +114,18 @@ public: /// Clear the order_cache used by positionOfCard void clearOrderCache(); - virtual String typeName() const; - Version fileVersion() const; + String typeName() const override; + Version fileVersion() const override; /// Validate that the set is correctly loaded - virtual void validate(Version = app_version); + void validate(Version = app_version) override; protected: - virtual VCSP getVCS() { + VCSP getVCS() override { return vcs; } private: - DECLARE_REFLECTION(); + DECLARE_REFLECTION_OVERRIDE(); template void reflect_cards(Handler& handler); diff --git a/src/data/stylesheet.hpp b/src/data/stylesheet.hpp index cd607566..c68e5a3f 100644 --- a/src/data/stylesheet.hpp +++ b/src/data/stylesheet.hpp @@ -62,10 +62,10 @@ public: String stylesheetName() const; static String typeNameStatic(); - virtual String typeName() const; - Version fileVersion() const; + String typeName() const override; + Version fileVersion() const override; /// Validate the stylesheet - virtual void validate(Version = app_version); + void validate(Version = app_version) override; protected: diff --git a/src/data/symbol.hpp b/src/data/symbol.hpp index cdca2091..2a6aeeca 100644 --- a/src/data/symbol.hpp +++ b/src/data/symbol.hpp @@ -206,11 +206,11 @@ public: SymbolShape(); - virtual String typeName() const; - virtual SymbolPartP clone() const; - virtual int icon() const { return combine; } - virtual SymbolShape* isSymbolShape() { return this; } - virtual const SymbolShape* isSymbolShape() const { return this; } + String typeName() const override; + SymbolPartP clone() const override; + int icon() const override { return combine; } + SymbolShape* isSymbolShape() override { return this; } + const SymbolShape* isSymbolShape() const override { return this; } /// Get a control point, wraps around inline ControlPointP getPoint(int id) const { @@ -221,7 +221,7 @@ public: void enforceConstraints(); /// Calculate the position and size of the part using the given rotation matrix - virtual Bounds calculateBounds(const Vector2D& origin, const Matrix2D& m, bool is_identity); + Bounds calculateBounds(const Vector2D& origin, const Matrix2D& m, bool is_identity) override; DECLARE_REFLECTION_OVERRIDE(); void after_reading(Version) override; @@ -236,15 +236,15 @@ public: SymbolGroup(); - virtual String typeName() const; - virtual SymbolPartP clone() const; - virtual int icon() const { return SYMBOL_COMBINE_BORDER + 3; } - virtual SymbolGroup* isSymbolGroup() { return this; } - virtual const SymbolGroup* isSymbolGroup() const { return this; } + String typeName() const override; + SymbolPartP clone() const override; + int icon() const override { return SYMBOL_COMBINE_BORDER + 3; } + SymbolGroup* isSymbolGroup() override { return this; } + const SymbolGroup* isSymbolGroup() const override { return this; } - virtual bool isAncestor(const SymbolPart& that) const; + bool isAncestor(const SymbolPart& that) const override; - virtual Bounds calculateBounds(const Vector2D& origin, const Matrix2D& m, bool is_identity); + Bounds calculateBounds(const Vector2D& origin, const Matrix2D& m, bool is_identity) override; DECLARE_REFLECTION_OVERRIDE(); }; @@ -268,14 +268,14 @@ public: SymbolSymmetry(); - virtual String typeName() const; - virtual SymbolPartP clone() const; - virtual int icon() const { return kind + SYMBOL_COMBINE_BORDER + 1; } - virtual SymbolSymmetry* isSymbolSymmetry() { return this; } - virtual const SymbolSymmetry* isSymbolSymmetry() const { return this; } + String typeName() const override; + SymbolPartP clone() const override; + int icon() const override { return kind + SYMBOL_COMBINE_BORDER + 1; } + SymbolSymmetry* isSymbolSymmetry() override { return this; } + const SymbolSymmetry* isSymbolSymmetry() const override { return this; } String expectedName() const; - virtual Bounds calculateBounds(const Vector2D& origin, const Matrix2D& m, bool is_identity); + Bounds calculateBounds(const Vector2D& origin, const Matrix2D& m, bool is_identity) override; DECLARE_REFLECTION_OVERRIDE(); }; diff --git a/src/data/symbol_font.hpp b/src/data/symbol_font.hpp index 84e311ec..93e24e2b 100644 --- a/src/data/symbol_font.hpp +++ b/src/data/symbol_font.hpp @@ -68,8 +68,8 @@ public: Image getImage(double font_size, const DrawableSymbol& symbol); static String typeNameStatic(); - virtual String typeName() const; - Version fileVersion() const; + String typeName() const override; + Version fileVersion() const override; /// Generate a 'insert symbol' menu. /** This class owns the menu! @@ -112,9 +112,9 @@ public: // ----------------------------------------------------------------------------- : InsertSymbolMenu enum MenuItemType -{ ITEM_CODE ///< Name gives the code to insert -, ITEM_CUSTOM ///< Use a dialog box -, ITEM_LINE ///< A menu separator +{ ITEM_CODE ///< Name gives the code to insert +, ITEM_CUSTOM ///< Use a dialog box +, ITEM_LINE ///< A menu separator , ITEM_SUBMENU ///< A submenu }; @@ -153,11 +153,11 @@ public: /// Is a font loaded? bool valid() const; - Scriptable name; ///< Font package name, can be changed with script - Scriptable size; ///< Size of the font - double scale_down_to; ///< Mimumum size of the font - Scriptable alignment; ///< Alignment of symbols in a line of text - SymbolFontP font; ///< The font, if it is loaded + Scriptable name; ///< Font package name, can be changed with script + Scriptable size; ///< Size of the font + double scale_down_to; ///< Mimumum size of the font + Scriptable alignment; ///< Alignment of symbols in a line of text + SymbolFontP font; ///< The font, if it is loaded private: DECLARE_REFLECTION(); diff --git a/src/gui/about_window.hpp b/src/gui/about_window.hpp index 2a98dc12..cd54c821 100644 --- a/src/gui/about_window.hpp +++ b/src/gui/about_window.hpp @@ -41,7 +41,7 @@ class HoverButtonBase : public wxControl { public: HoverButtonBase(Window* parent, int id, bool accepts_focus = true); - virtual bool AcceptsFocus() const; + bool AcceptsFocus() const override; virtual void SetHelpText(const String& s) { help_text = s; } @@ -90,14 +90,14 @@ private: Bitmap bg_normal, bg_hover, bg_focus, bg_down; ///< Bitmaps for the states of the button Color background; - virtual wxSize DoGetBestSize() const; + wxSize DoGetBestSize() const override; const Bitmap* last_drawn; const Bitmap* toDraw() const; protected: int drawDelta() const; - virtual void refreshIfNeeded(); - virtual void draw(DC& dc); + void refreshIfNeeded() override; + void draw(DC& dc) override; }; diff --git a/src/gui/auto_replace_window.cpp b/src/gui/auto_replace_window.cpp index f492211f..0cb97116 100644 --- a/src/gui/auto_replace_window.cpp +++ b/src/gui/auto_replace_window.cpp @@ -47,24 +47,24 @@ public: protected: /// Get all items - virtual void getItems(vector& out) const; + void getItems(vector& out) const override; /// Return the AutoReplace at the given position in the sorted list inline AutoReplaceP getAR(long pos) const { return static_pointer_cast(getItem(pos)); } /// Send an 'item selected' event for the currently selected item (selected_item) - virtual void sendEvent(); + void sendEvent() override; /// Compare items - virtual bool compareItems(void* a, void* b) const; - virtual bool mustSort() const { return true; } + bool compareItems(void* a, void* b) const override; + bool mustSort() const override { return true; } /// 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; mutable wxListItemAttr item_attr; // for OnGetItemAttr }; diff --git a/src/gui/control/card_editor.cpp b/src/gui/control/card_editor.cpp index 4c46f3dd..faef93aa 100644 --- a/src/gui/control/card_editor.cpp +++ b/src/gui/control/card_editor.cpp @@ -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 diff --git a/src/gui/control/card_editor.hpp b/src/gui/control/card_editor.hpp index a15c891c..175ef04a 100644 --- a/src/gui/control/card_editor.hpp +++ b/src/gui/control/card_editor.hpp @@ -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); + virtual void addAction(unique_ptr 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 diff --git a/src/gui/control/card_list.hpp b/src/gui/control/card_list.hpp index 025bb308..fd3be012 100644 --- a/src/gui/control/card_list.hpp +++ b/src/gui/control/card_list.hpp @@ -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& out) const; protected: /// Get a list of all cards - virtual void getItems(vector& out) const; + void getItems(vector& 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: diff --git a/src/gui/control/card_viewer.hpp b/src/gui/control/card_viewer.hpp index 63bd6fe0..3bb3dc73 100644 --- a/src/gui/control/card_viewer.hpp +++ b/src/gui/control/card_viewer.hpp @@ -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(); diff --git a/src/gui/control/filter_ctrl.cpp b/src/gui/control/filter_ctrl.cpp index 70a7532a..6406f77a 100644 --- a/src/gui/control/filter_ctrl.cpp +++ b/src/gui/control/filter_ctrl.cpp @@ -24,10 +24,10 @@ public: vector 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 diff --git a/src/gui/control/filtered_card_list.hpp b/src/gui/control/filtered_card_list.hpp index 9146ccc2..8a872c52 100644 --- a/src/gui/control/filtered_card_list.hpp +++ b/src/gui/control/filtered_card_list.hpp @@ -26,11 +26,11 @@ public: protected: /// Get only the subset of the cards - virtual void getItems(vector& out) const; + void getItems(vector& out) const override; - virtual void onChangeSet(); + void onChangeSet() override; - private: +private: CardListFilterP filter; ///< Filter with which this.cards is made }; diff --git a/src/gui/control/gallery_list.hpp b/src/gui/control/gallery_list.hpp index b790bac6..358aee01 100644 --- a/src/gui/control/gallery_list.hpp +++ b/src/gui/control/gallery_list.hpp @@ -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 { diff --git a/src/gui/control/graph.hpp b/src/gui/control/graph.hpp index 749d0471..c5827105 100644 --- a/src/gui/control/graph.hpp +++ b/src/gui/control/graph.hpp @@ -157,9 +157,9 @@ protected: class Graph1D : public Graph { public: inline Graph1D(size_t axis) : axis(axis) {} - virtual void draw(RotatedDC& dc, const vector& current, DrawLayer layer) const; - virtual bool findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight, vector& out) const; - virtual void setData(const GraphDataP& d); + void draw(RotatedDC& dc, const vector& current, DrawLayer layer) const override; + bool findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight, vector& 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 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& current, DrawLayer layer) const; - virtual bool findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight, vector& out) const; + void draw(RotatedDC& dc, const vector& current, DrawLayer layer) const override; + bool findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight, vector& 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& current, DrawLayer layer) const; - virtual bool findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight, vector& out) const; - virtual void setData(const GraphDataP& d); + void draw(RotatedDC& dc, const vector& current, DrawLayer layer) const override; + bool findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight, vector& 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 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& current, DrawLayer layer) const; + void draw(RotatedDC& dc, const vector& 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& current, DrawLayer layer) const; - virtual bool findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight, vector& out) const; - virtual void setData(const GraphDataP& d); + void draw(RotatedDC& dc, const vector& current, DrawLayer layer) const override; + bool findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight, vector& 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& current, DrawLayer layer) const; - virtual bool findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight, vector& out) const; - virtual void setData(const GraphDataP& d); + void draw(RotatedDC& dc, const vector& current, DrawLayer layer) const override; + bool findItem(const RealPoint& pos, const RealRect& screen_rect, bool tight, vector& out) const override; + void setData(const GraphDataP& d) override; void add(const GraphP& graph); private: diff --git a/src/gui/control/image_card_list.cpp b/src/gui/control/image_card_list.cpp index e0ea12c0..1cfbc784 100644 --- a/src/gui/control/image_card_list.cpp +++ b/src/gui/control/image_card_list.cpp @@ -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; }; diff --git a/src/gui/control/image_card_list.hpp b/src/gui/control/image_card_list.hpp index 7921794d..7fe2bea1 100644 --- a/src/gui/control/image_card_list.hpp +++ b/src/gui/control/image_card_list.hpp @@ -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& out) const; - virtual void onChangeSet(); + void getItems(vector& out) const override; + void onChangeSet() override; private: CardListFilterP filter; ///< Filter with which this.cards is made diff --git a/src/gui/control/item_list.hpp b/src/gui/control/item_list.hpp index 6d0f5315..cc411ebb 100644 --- a/src/gui/control/item_list.hpp +++ b/src/gui/control/item_list.hpp @@ -99,7 +99,7 @@ protected: // --------------------------------------------------- : Fixing wx issues - wxSize DoGetBestClientSize() const; + wxSize DoGetBestClientSize() const override; // --------------------------------------------------- : Data VoidP selected_item; ///< The currently selected item diff --git a/src/gui/control/keyword_list.hpp b/src/gui/control/keyword_list.hpp index 64e848bc..0b2fd2ae 100644 --- a/src/gui/control/keyword_list.hpp +++ b/src/gui/control/keyword_list.hpp @@ -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& out) const; + void getItems(vector& 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(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(); diff --git a/src/gui/control/native_look_editor.hpp b/src/gui/control/native_look_editor.hpp index 3f09c5f1..55234581 100644 --- a/src/gui/control/native_look_editor.hpp +++ b/src/gui/control/native_look_editor.hpp @@ -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; }; diff --git a/src/gui/control/package_list.hpp b/src/gui/control/package_list.hpp index 348e5aa2..c4f76e37 100644 --- a/src/gui/control/package_list.hpp +++ b/src/gui/control/package_list.hpp @@ -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 diff --git a/src/gui/control/select_card_list.hpp b/src/gui/control/select_card_list.hpp index b9900ca9..44544d48 100644 --- a/src/gui/control/select_card_list.hpp +++ b/src/gui/control/select_card_list.hpp @@ -31,8 +31,8 @@ public: void setSelection(const vector& cards); protected: - virtual int OnGetItemImage(long pos) const; - virtual void onChangeSet(); + int OnGetItemImage(long pos) const override; + void onChangeSet() override; private: DECLARE_EVENT_TABLE(); diff --git a/src/gui/control/text_ctrl.hpp b/src/gui/control/text_ctrl.hpp index 8015b71b..c1153992 100644 --- a/src/gui/control/text_ctrl.hpp +++ b/src/gui/control/text_ctrl.hpp @@ -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? diff --git a/src/gui/control/tree_list.cpp b/src/gui/control/tree_list.cpp index 178d591f..eff226c4 100644 --- a/src/gui/control/tree_list.cpp +++ b/src/gui/control/tree_list.cpp @@ -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; } diff --git a/src/gui/drop_down_list.cpp b/src/gui/drop_down_list.cpp index 1bcb83da..5fe3a07b 100644 --- a/src/gui/drop_down_list.cpp +++ b/src/gui/drop_down_list.cpp @@ -26,7 +26,7 @@ public: private: DropDownList& list; - virtual bool ProcessEvent(wxEvent& ev) { + bool ProcessEvent(wxEvent& ev) override { int t = ev.GetEventType(); if ( t == wxEVT_LEFT_DOWN || t == wxEVT_RIGHT_DOWN || t == wxEVT_MOVE || t == wxEVT_SIZE @@ -98,7 +98,7 @@ void DropDownList::show(bool in_place, wxPoint pos, RealRect* rect) { dc.SetFont(*wxNORMAL_FONT); for (size_t i = 0 ; i < count ; ++i) { int text_width; - dc.GetTextExtent(capitalize(itemText(i)), &text_width, 0); + dc.GetTextExtent(capitalize(itemText(i)), &text_width, nullptr); item_size.width = max(item_size.width, text_width + icon_size.width + 14); // 14 = room for popup arrow + padding } } diff --git a/src/gui/image_slice_window.hpp b/src/gui/image_slice_window.hpp index 599f3fa0..1d366714 100644 --- a/src/gui/image_slice_window.hpp +++ b/src/gui/image_slice_window.hpp @@ -127,13 +127,13 @@ private: const AlphaMask& mask; bool mouse_down; - int mouseX, mouseY; ///< starting mouse position + int mouseX, mouseY; ///< starting mouse position wxRect start_selection; ///< selection in slice at start of dragging // --------------------------------------------------- : Events DECLARE_EVENT_TABLE(); - wxSize DoGetBestSize() const; + wxSize DoGetBestSize() const override; void onLeftDown(wxMouseEvent&); void onLeftUp (wxMouseEvent&); diff --git a/src/gui/package_update_list.cpp b/src/gui/package_update_list.cpp index 2a116b55..8669bb1d 100644 --- a/src/gui/package_update_list.cpp +++ b/src/gui/package_update_list.cpp @@ -128,23 +128,23 @@ public: buffer_size = m_parent_i_stream->LastRead(); } - bool IsSeekable() const { return true; } + bool IsSeekable() const override { return true; } protected: - virtual size_t OnSysRead(void *buffer, size_t bufsize) { + size_t OnSysRead(void *buffer, size_t bufsize) override { size_t len = min(buffer_size - buffer_pos, bufsize); memcpy(buffer, this->buffer + buffer_pos, len); buffer_pos += len; m_parent_i_stream->Read((Byte*)buffer + len, bufsize - len); return m_parent_i_stream->LastRead() + len; } - virtual wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode) { + wxFileOffset OnSysSeek(wxFileOffset seek, wxSeekMode mode) override { if (mode == wxFromStart) buffer_pos = seek; else if (mode == wxFromCurrent) buffer_pos += seek; else assert(false); assert(buffer_pos < buffer_size); return buffer_pos; } - virtual wxFileOffset OnSysTell() const { + wxFileOffset OnSysTell() const override { assert(buffer_pos < buffer_size); return buffer_pos; } @@ -164,7 +164,7 @@ public: , list(list), ti(ti) {} - virtual Image generate() { + Image generate() override { wxURL url(ti->package->description->icon_url); unique_ptr isP(url.GetInputStream()); if (!isP) return wxImage(); @@ -172,7 +172,7 @@ public: Image result(is2); return result; } - virtual void store(const Image& image) { + void store(const Image& image) override { if (!image.Ok()) return; ti->setIcon(image); list->Refresh(false); diff --git a/src/gui/package_update_list.hpp b/src/gui/package_update_list.hpp index 47817416..e80c091d 100644 --- a/src/gui/package_update_list.hpp +++ b/src/gui/package_update_list.hpp @@ -30,12 +30,12 @@ public: protected: // overridden methods from TreeList - virtual void initItems(); - virtual void drawItem(DC& dc, size_t index, size_t column, int x, int y, bool selected) const; + void initItems() override; + void drawItem(DC& dc, size_t index, size_t column, int x, int y, bool selected) const override; - virtual size_t columnCount() const { return 3; } - virtual String columnText(size_t column) const; - virtual int columnWidth(size_t column) const; + size_t columnCount() const override { return 3; } + String columnText(size_t column) const override; + int columnWidth(size_t column) const override; private: /// The list of packages we are displaying diff --git a/src/gui/packages_window.cpp b/src/gui/packages_window.cpp index 485a1a41..062f2628 100644 --- a/src/gui/packages_window.cpp +++ b/src/gui/packages_window.cpp @@ -57,7 +57,7 @@ private: wxMutex lock; struct Thread : public wxThread { - virtual ExitCode Entry(); + ExitCode Entry() override; }; }; @@ -104,7 +104,7 @@ public: void setPackage(const InstallablePackageP& package); - virtual wxSize DoGetBestSize() const; + wxSize DoGetBestSize() const override; private: InstallablePackageP package; diff --git a/src/gui/preferences_window.cpp b/src/gui/preferences_window.cpp index 189ce854..81606864 100644 --- a/src/gui/preferences_window.cpp +++ b/src/gui/preferences_window.cpp @@ -36,7 +36,7 @@ public: class GlobalPreferencesPage : public PreferencesPage { public: GlobalPreferencesPage(Window* parent); - void store(); + void store() override; private: wxComboBox* language; @@ -47,7 +47,7 @@ private: class DisplayPreferencesPage : public PreferencesPage { public: DisplayPreferencesPage(Window* parent); - void store(); + void store() override; private: DECLARE_EVENT_TABLE(); @@ -74,7 +74,7 @@ private: class DirsPreferencesPage : public PreferencesPage { public: DirsPreferencesPage(Window* parent); - void store(); + void store() override; private: DECLARE_EVENT_TABLE(); @@ -88,7 +88,7 @@ private: class UpdatePreferencesPage : public PreferencesPage { public: UpdatePreferencesPage(Window* parent); - void store(); + void store() override; private: DECLARE_EVENT_TABLE(); diff --git a/src/gui/print_window.cpp b/src/gui/print_window.cpp index b100d053..798c8a64 100644 --- a/src/gui/print_window.cpp +++ b/src/gui/print_window.cpp @@ -55,13 +55,13 @@ class CardsPrintout : public wxPrintout { public: CardsPrintout(PrintJobP const& job); /// Number of pages, and something else I don't understand... - virtual void GetPageInfo(int* pageMin, int* pageMax, int* pageFrom, int* pageTo); + void GetPageInfo(int* pageMin, int* pageMax, int* pageFrom, int* pageTo) override; /// Again, 'number of pages', strange wx interface - virtual bool HasPage(int page); + bool HasPage(int page) override; /// Determine the layout - virtual void OnPreparePrinting(); + void OnPreparePrinting() override; /// Print a page - virtual bool OnPrintPage(int page); + bool OnPrintPage(int page) override; private: PrintJobP job; ///< Cards to print @@ -175,7 +175,7 @@ PrintJobP make_print_job(Window* parent, const SetP& set, const ExportCardSelect s2->Add(s3, 1, wxEXPAND | wxALL, 8); wxSizer* s4 = new wxStaticBoxSizer(wxVERTICAL, &wnd, L"Settings"); s4->Add(space, 1, wxALL | wxALIGN_TOP, 8); - s2->Add(s4, 1, wxEXPAND | wxALL & ~wxLEFT, 8); + s2->Add(s4, 1, wxEXPAND | (wxALL & ~wxLEFT), 8); s->Add(s2, 1, wxEXPAND); s->Add(wnd.CreateButtonSizer(wxOK | wxCANCEL) , 0, wxEXPAND | wxALL, 8); s->SetSizeHints(&wnd); diff --git a/src/gui/set/cards_panel.cpp b/src/gui/set/cards_panel.cpp index 4116d981..b573b809 100644 --- a/src/gui/set/cards_panel.cpp +++ b/src/gui/set/cards_panel.cpp @@ -284,13 +284,9 @@ void CardsPanel::onMenuOpen(wxMenuEvent& ev) { wxMenu* menu = editor->getMenu(ID_INSERT_SYMBOL); if (insertSymbolMenu->GetSubMenu() != menu || (menu && menu->GetParent() != menuFormat)) { // re-add the menu - fprintf(stderr,"insert1 %p %p\n", menuFormat,insertSymbolMenu);fflush(stderr); menuFormat->Remove(ID_INSERT_SYMBOL); - fprintf(stderr,"insert2\n");fflush(stderr); insertSymbolMenu->SetSubMenu(menu); - fprintf(stderr,"insert3\n");fflush(stderr); menuFormat->Append(insertSymbolMenu); - fprintf(stderr,"insert4\n");fflush(stderr); } } @@ -418,7 +414,7 @@ void CardsPanel::doSelectAll() { class CardsPanel::SearchFindInfo : public FindInfo { public: SearchFindInfo(CardsPanel& panel, wxFindReplaceData& what) : FindInfo(what), panel(panel) {} - virtual bool handle(const CardP& card, const TextValueP& value, size_t pos, bool was_selection) { + bool handle(const CardP& card, const TextValueP& value, size_t pos, bool was_selection) override { // Select the card panel.card_list->setCard(card); return true; @@ -430,7 +426,7 @@ private: class CardsPanel::ReplaceFindInfo : public FindInfo { public: ReplaceFindInfo(CardsPanel& panel, wxFindReplaceData& what) : FindInfo(what), panel(panel) {} - virtual bool handle(const CardP& card, const TextValueP& value, size_t pos, bool was_selection) { + bool handle(const CardP& card, const TextValueP& value, size_t pos, bool was_selection) override { // Select the card panel.card_list->setCard(card); // Replace @@ -441,7 +437,7 @@ public: return true; } } - virtual bool searchSelection() const { return true; } + bool searchSelection() const override { return true; } private: CardsPanel& panel; }; diff --git a/src/gui/set/cards_panel.hpp b/src/gui/set/cards_panel.hpp index 211bcc45..85bdae28 100644 --- a/src/gui/set/cards_panel.hpp +++ b/src/gui/set/cards_panel.hpp @@ -27,27 +27,27 @@ public: CardsPanel(Window* parent, int id); ~CardsPanel(); - virtual void onChangeSet(); + void onChangeSet() override; // --------------------------------------------------- : UI - virtual void initUI (wxToolBar* tb, wxMenuBar* mb); - virtual void destroyUI(wxToolBar* tb, wxMenuBar* mb); - virtual void onUpdateUI(wxUpdateUIEvent&); - virtual void onCommand(int id); - virtual void onMenuOpen(wxMenuEvent&); + void initUI (wxToolBar* tb, wxMenuBar* mb) override; + void destroyUI(wxToolBar* tb, wxMenuBar* mb) override; + void onUpdateUI(wxUpdateUIEvent&) override; + void onCommand(int id) override; + void onMenuOpen(wxMenuEvent&) override; // --------------------------------------------------- : Actions - virtual bool wantsToHandle(const Action&, bool undone) const; + bool wantsToHandle(const Action&, bool undone) const override; // --------------------------------------------------- : Clipboard - virtual bool canCut() const; - virtual bool canCopy() const; - virtual bool canPaste() const; - virtual void doCut(); - virtual void doCopy(); - virtual void doPaste(); + bool canCut() const override; + bool canCopy() const override; + bool canPaste() const override; + void doCut() override; + void doCopy() override; + void doPaste() override; // --------------------------------------------------- : Text selection @@ -56,11 +56,11 @@ public: // --------------------------------------------------- : Searching (find/replace) - virtual bool canFind() const { return true; } - virtual bool canReplace() const { return true; } - virtual bool doFind (wxFindReplaceData&); - virtual bool doReplace (wxFindReplaceData&); - virtual bool doReplaceAll(wxFindReplaceData&); + bool canFind() const override { return true; } + bool canReplace() const override { return true; } + bool doFind (wxFindReplaceData&) override; + bool doReplace (wxFindReplaceData&) override; + bool doReplaceAll(wxFindReplaceData&) override; private: /// Do a search or replace action for the given FindInfo in all cards bool search(FindInfo& find, bool from_start); @@ -71,9 +71,9 @@ private: public: // --------------------------------------------------- : Selection - virtual CardP selectedCard() const; - virtual void selectCard(const CardP& card); - virtual void selectFirstCard(); + CardP selectedCard() const override; + void selectCard(const CardP& card) override; + void selectFirstCard() override; private: // --------------------------------------------------- : Controls @@ -92,7 +92,7 @@ private: void updateNotesPosition(); // before Layout, call updateNotesPosition. // NOTE: docs say this function returns void, but the code says bool - virtual bool Layout(); + bool Layout() override; // --------------------------------------------------- : Menus & tools wxMenu* menuCard, *menuFormat; diff --git a/src/gui/set/console_panel.hpp b/src/gui/set/console_panel.hpp index 39d94d58..4289d0ae 100644 --- a/src/gui/set/console_panel.hpp +++ b/src/gui/set/console_panel.hpp @@ -25,16 +25,16 @@ public: void onIdle(wxIdleEvent&); void onEnter(wxCommandEvent&); - virtual void initUI (wxToolBar* tb, wxMenuBar* mb); - virtual void destroyUI(wxToolBar* tb, wxMenuBar* mb); - virtual void onUpdateUI(wxUpdateUIEvent&); - virtual void onCommand(int id); + void initUI (wxToolBar* tb, wxMenuBar* mb) override; + void destroyUI(wxToolBar* tb, wxMenuBar* mb) override; + void onUpdateUI(wxUpdateUIEvent&) override; + void onCommand(int id) override; // --------------------------------------------------- : Clipboard - virtual bool canCut() const; - virtual bool canCopy() const; - virtual void doCopy(); + bool canCut() const override; + bool canCopy() const override; + void doCopy() override; protected: void onChangeSet() override; diff --git a/src/gui/set/keywords_panel.hpp b/src/gui/set/keywords_panel.hpp index 103e2d4b..f364edcd 100644 --- a/src/gui/set/keywords_panel.hpp +++ b/src/gui/set/keywords_panel.hpp @@ -26,26 +26,26 @@ public: KeywordsPanel(Window* parent, int id); ~KeywordsPanel(); - virtual void onChangeSet(); - virtual void onAction(const Action&, bool); + void onChangeSet() override; + void onAction(const Action&, bool) override; // --------------------------------------------------- : UI - virtual void initUI (wxToolBar* tb, wxMenuBar* mb); - virtual void destroyUI(wxToolBar* tb, wxMenuBar* mb); - virtual void onUpdateUI(wxUpdateUIEvent&); - virtual void onCommand(int id); + void initUI (wxToolBar* tb, wxMenuBar* mb) override; + void destroyUI(wxToolBar* tb, wxMenuBar* mb) override; + void onUpdateUI(wxUpdateUIEvent&) override; + void onCommand(int id) override; // --------------------------------------------------- : Clipboard - virtual bool canCut() const; - virtual bool canCopy() const; - virtual bool canPaste() const; - virtual void doCut(); - virtual void doCopy(); - virtual void doPaste(); + bool canCut() const override; + bool canCopy() const override; + bool canPaste() const override; + void doCut() override; + void doCopy() override; + void doPaste() override; - virtual bool canSelectAll() const; - virtual void doSelectAll(); + bool canSelectAll() const override; + void doSelectAll() override; private: DECLARE_EVENT_TABLE(); diff --git a/src/gui/set/panel.hpp b/src/gui/set/panel.hpp index 63d07be6..2e575633 100644 --- a/src/gui/set/panel.hpp +++ b/src/gui/set/panel.hpp @@ -51,7 +51,7 @@ public: /// Should return true if this panel wants to get focus to show an action virtual bool wantsToHandle(const Action&, bool undone) const { return false; } /// Handle an action that changes the current set - virtual void onAction(const Action&, bool undone) {} + virtual void onAction(const Action&, bool undone) override {} // --------------------------------------------------- : Clipboard virtual bool canPaste() const { return false; } ///< Is pasting possible? diff --git a/src/gui/set/random_pack_panel.cpp b/src/gui/set/random_pack_panel.cpp index cae36b9f..3cfcd419 100644 --- a/src/gui/set/random_pack_panel.cpp +++ b/src/gui/set/random_pack_panel.cpp @@ -36,8 +36,8 @@ public: vector cards; protected: - virtual void getItems(vector& out) const; - virtual void onChangeSet(); + void getItems(vector& out) const override; + void onChangeSet() override; }; RandomCardList::RandomCardList(Window* parent, int id, long style) @@ -68,7 +68,7 @@ public: PackTotalsPanel(Window* parent, int id, PackGenerator& generator, bool show_all = false) : wxPanel(parent,id), generator(generator), show_all(show_all) {} void setGame(const GameP& game); - virtual wxSize DoGetBestSize() const; + virtual wxSize DoGetBestSize() const override; private: DECLARE_EVENT_TABLE(); GameP game; @@ -157,7 +157,7 @@ public: , interactive(interactive) , buddy(nullptr) {} - void draw(DC& dc) { + void draw(DC& dc) override { Color bg = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); Color fg = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT); // clear background @@ -176,7 +176,7 @@ public: dc.GetTextExtent(label,&w,&h); dc.DrawText(interactive && hover ? label + _("...") : label, 2, (s.y-h)/2); } - wxSize DoGetBestSize() const { + wxSize DoGetBestSize() const override { int w,h; wxClientDC dc(const_cast(this)); dc.SetFont(*wxNORMAL_FONT); @@ -186,7 +186,7 @@ public: void setBuddy(wxWindow* buddy) { this->buddy = buddy; } - virtual void onClick() { + void onClick() override { if (buddy) buddy->SetFocus(); } void onDoubleClick(wxMouseEvent&) { diff --git a/src/gui/set/random_pack_panel.hpp b/src/gui/set/random_pack_panel.hpp index bd3b6877..b20e9fd1 100644 --- a/src/gui/set/random_pack_panel.hpp +++ b/src/gui/set/random_pack_panel.hpp @@ -43,24 +43,24 @@ public: // --------------------------------------------------- : UI - 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; - virtual void initUI (wxToolBar* tb, wxMenuBar* mb); - virtual void destroyUI(wxToolBar* tb, wxMenuBar* mb); - virtual void onUpdateUI(wxUpdateUIEvent&); - virtual void onCommand(int id); + void initUI (wxToolBar* tb, wxMenuBar* mb) override; + void destroyUI(wxToolBar* tb, wxMenuBar* mb) override; + void onUpdateUI(wxUpdateUIEvent&) override; + void onCommand(int id) override; // --------------------------------------------------- : Selection - virtual CardP selectedCard() const; - virtual void selectCard(const CardP& card); - virtual void selectionChoices(ExportCardSelectionChoices& out); + CardP selectedCard() const override; + void selectCard(const CardP& card) override; + void selectionChoices(ExportCardSelectionChoices& out) override; // --------------------------------------------------- : Clipboard - virtual bool canCopy() const; - virtual void doCopy(); + bool canCopy() const override; + void doCopy() override; private: DECLARE_EVENT_TABLE(); diff --git a/src/gui/set/set_info_panel.hpp b/src/gui/set/set_info_panel.hpp index 2df4d7d4..67d8b5f8 100644 --- a/src/gui/set/set_info_panel.hpp +++ b/src/gui/set/set_info_panel.hpp @@ -21,24 +21,24 @@ public: // --------------------------------------------------- : UI - virtual void initUI (wxToolBar* tb, wxMenuBar* mb); - virtual void destroyUI(wxToolBar* tb, wxMenuBar* mb); - virtual void onUpdateUI(wxUpdateUIEvent&); - virtual void onCommand(int id); + void initUI (wxToolBar* tb, wxMenuBar* mb) override; + void destroyUI(wxToolBar* tb, wxMenuBar* mb) override; + void onUpdateUI(wxUpdateUIEvent&) override; + void onCommand(int id) override; // --------------------------------------------------- : Clipboard - virtual bool canCut() const; - virtual bool canCopy() const; - virtual bool canPaste() const; - virtual bool canSelectAll() const; - virtual void doCut(); - virtual void doCopy(); - virtual void doPaste(); - virtual void doSelectAll(); + bool canCut() const override; + bool canCopy() const override; + bool canPaste() const override; + bool canSelectAll() const override; + void doCut() override; + void doCopy() override; + void doPaste() override; + void doSelectAll() override; protected: - virtual void onChangeSet(); + void onChangeSet() override; private: SetInfoEditor* editor; diff --git a/src/gui/set/stats_panel.cpp b/src/gui/set/stats_panel.cpp index b447ceb2..438cba1f 100644 --- a/src/gui/set/stats_panel.cpp +++ b/src/gui/set/stats_panel.cpp @@ -146,14 +146,14 @@ public: } protected: - virtual size_t itemCount() const; - virtual void drawItem(DC& dc, int x, int y, size_t item); + size_t itemCount() const override; + void drawItem(DC& dc, int x, int y, size_t item) override; - virtual double subcolumnActivity(size_t col) const { + double subcolumnActivity(size_t col) const override { return col-1 >= prefered_dimension_count ? 0.2 : 0.7; } - virtual void onSelect(size_t item, size_t old_col, bool& changes) { + void onSelect(size_t item, size_t old_col, bool& changes) override { // swap selection with another subcolumn? for (size_t j = 1 ; j < subcolumns.size() ; ++j) { if (j != active_subcolumn && subcolumns[j].selection == item && @@ -527,7 +527,7 @@ public: StatsFilter(GraphData& data, const vector match) { data.indices(match, indices); } - virtual void getItems(const vector& cards, vector& out) const { + void getItems(const vector& cards, vector& out) const override { FOR_EACH_CONST(idx, indices) { out.push_back(cards.at(idx)); } diff --git a/src/gui/set/stats_panel.hpp b/src/gui/set/stats_panel.hpp index 809b42c2..7f167704 100644 --- a/src/gui/set/stats_panel.hpp +++ b/src/gui/set/stats_panel.hpp @@ -31,17 +31,17 @@ public: // --------------------------------------------------- : UI - virtual void onChangeSet(); - virtual void onAction(const Action&, bool undone); + void onChangeSet() override; + void onAction(const Action&, bool undone) override; - virtual void initUI (wxToolBar*, wxMenuBar*); - virtual void destroyUI(wxToolBar*, wxMenuBar*); - virtual void onUpdateUI(wxUpdateUIEvent&); - virtual void onCommand(int id); + void initUI (wxToolBar*, wxMenuBar*) override; + void destroyUI(wxToolBar*, wxMenuBar*) override; + void onUpdateUI(wxUpdateUIEvent&) override; + void onCommand(int id) override; // --------------------------------------------------- : Selection - virtual CardP selectedCard() const; - virtual void selectCard(const CardP& card); + CardP selectedCard() const override; + void selectCard(const CardP& card) override; // --------------------------------------------------- : Data private: diff --git a/src/gui/set/style_panel.hpp b/src/gui/set/style_panel.hpp index 439347ea..955ced43 100644 --- a/src/gui/set/style_panel.hpp +++ b/src/gui/set/style_panel.hpp @@ -22,25 +22,25 @@ class StylePanel : public SetWindowPanel { public: StylePanel(Window* parent, int id); - virtual void onChangeSet(); - virtual void onAction(const Action&, bool undone); + void onChangeSet() override; + void onAction(const Action&, bool undone) override; // --------------------------------------------------- : UI - virtual void initUI(wxToolBar*, wxMenuBar*); + void initUI(wxToolBar*, wxMenuBar*) override; // --------------------------------------------------- : Clipboard - virtual bool canCut() const; - virtual bool canCopy() const; - virtual bool canPaste() const; - virtual bool canSelectAll() const; - virtual void doCut(); - virtual void doCopy(); - virtual void doPaste(); - virtual void doSelectAll(); + bool canCut() const override; + bool canCopy() const override; + bool canPaste() const override; + bool canSelectAll() const override; + void doCut() override; + void doCopy() override; + void doPaste() override; + void doSelectAll() override; // --------------------------------------------------- : Selection - virtual void selectCard(const CardP& card); + void selectCard(const CardP& card) override; private: DECLARE_EVENT_TABLE(); @@ -58,7 +58,7 @@ private: /// Determine the best size for the list of stylesheets based on available space void updateListSize(); - virtual bool Layout(); + bool Layout() override; /// Actual intialization of the controls void initControls(); diff --git a/src/gui/set/window.cpp b/src/gui/set/window.cpp index b6fda933..52d5a279 100644 --- a/src/gui/set/window.cpp +++ b/src/gui/set/window.cpp @@ -460,7 +460,7 @@ bool SetWindow::askSaveAndContinue() { set->actions.setSavePoint(); return true; } - } catch (Error e) { + } catch (Error const& e) { // something went wrong with saving, don't proceed handle_error(e); return false; diff --git a/src/gui/set/window.hpp b/src/gui/set/window.hpp index 06f6e436..8bb674cc 100644 --- a/src/gui/set/window.hpp +++ b/src/gui/set/window.hpp @@ -74,9 +74,9 @@ private: // --------------------------------------------------- : Action related protected: /// We want to respond to set changes - virtual void onChangeSet(); + void onChangeSet() override; /// Actions that change the set - virtual void onAction(const Action&, bool undone); + void onAction(const Action&, bool undone) override; public: // minSize = mainSizer->getMinWindowSize(this) diff --git a/src/gui/symbol/basic_shape_editor.hpp b/src/gui/symbol/basic_shape_editor.hpp index 8d9b0f5e..5254bcaf 100644 --- a/src/gui/symbol/basic_shape_editor.hpp +++ b/src/gui/symbol/basic_shape_editor.hpp @@ -16,33 +16,33 @@ class wxSpinCtrl; // ----------------------------------------------------------------------------- : SymbolBasicShapeEditor /// Editor for drawing basic shapes such as rectangles and polygons -class SymbolBasicShapeEditor : public SymbolEditorBase { +class SymbolBasicShapeEditor final : public SymbolEditorBase { public: SymbolBasicShapeEditor(SymbolControl* control); // --------------------------------------------------- : Drawing - virtual void draw(DC& dc); + void draw(DC& dc) override; // --------------------------------------------------- : UI - virtual void initUI (wxToolBar* tb, wxMenuBar* mb); - virtual void destroyUI(wxToolBar* tb, wxMenuBar* mb); - virtual void onUpdateUI(wxUpdateUIEvent&); - virtual void onCommand(int id); - virtual int modeToolId(); + void initUI (wxToolBar* tb, wxMenuBar* mb) override; + void destroyUI(wxToolBar* tb, wxMenuBar* mb) override; + void onUpdateUI(wxUpdateUIEvent&) override; + void onCommand(int id) override; + int modeToolId() override; // --------------------------------------------------- : Mouse events - virtual void onLeftDown (const Vector2D& pos, wxMouseEvent& ev); - virtual void onLeftUp (const Vector2D& pos, wxMouseEvent& ev); - virtual void onMouseDrag (const Vector2D& from, const Vector2D& to, wxMouseEvent& ev); + void onLeftDown (const Vector2D& pos, wxMouseEvent& ev) override; + void onLeftUp (const Vector2D& pos, wxMouseEvent& ev) override; + void onMouseDrag (const Vector2D& from, const Vector2D& to, wxMouseEvent& ev) override; // --------------------------------------------------- : Other events - virtual void onKeyChange(wxKeyEvent& ev); + void onKeyChange(wxKeyEvent& ev) override; - virtual bool isEditing(); + bool isEditing() override; // --------------------------------------------------- : Data private: diff --git a/src/gui/symbol/control.hpp b/src/gui/symbol/control.hpp index 3e66cd14..45c2f8de 100644 --- a/src/gui/symbol/control.hpp +++ b/src/gui/symbol/control.hpp @@ -26,9 +26,9 @@ class SymbolControl : public wxControl, public SymbolViewer { public: SymbolControl(SymbolWindow* parent, int id, const SymbolP& symbol); - virtual void onChangeSymbol(); + void onChangeSymbol() override; - virtual void onAction(const Action&, bool undone); + void onAction(const Action&, bool undone) override; // Forward command to editor void onExtraTool(wxCommandEvent& ev); diff --git a/src/gui/symbol/part_list.hpp b/src/gui/symbol/part_list.hpp index 2ee992f5..4760fecd 100644 --- a/src/gui/symbol/part_list.hpp +++ b/src/gui/symbol/part_list.hpp @@ -31,9 +31,9 @@ public: SymbolPartList(Window* parent, int id, SymbolPartsSelection& selection, SymbolP symbol = SymbolP()); /// Another symbol is being viewed - virtual void onChangeSymbol(); + void onChangeSymbol() override; /// Event handler for changes to the symbol - virtual void onAction(const Action&, bool); + void onAction(const Action&, bool) override; /// Update the control void update(); @@ -41,7 +41,7 @@ public: void updateParts(const set& parts); protected: - virtual wxSize DoGetBestSize() const; + wxSize DoGetBestSize() const override; private: SymbolPartsSelection& selection; ///< Store selection here int number_of_items; @@ -75,7 +75,7 @@ private: void onChar(wxKeyEvent& ev); void onPaint(wxPaintEvent&); void onSize(wxSizeEvent&); - void OnDraw(DC& dc); + void OnDraw(DC& dc) override; void sendEvent(int type); diff --git a/src/gui/symbol/point_editor.cpp b/src/gui/symbol/point_editor.cpp index 2b518141..4751c5ff 100644 --- a/src/gui/symbol/point_editor.cpp +++ b/src/gui/symbol/point_editor.cpp @@ -284,7 +284,7 @@ void SymbolPointEditor::onMouseDrag(const Vector2D& from, const Vector2D& to, wx Vector2D delta = to - from; if (selection == SELECTED_LINE && ev.AltDown()) { // Drag the curve - if (controlPointMoveAction) controlPointMoveAction = 0; + if (controlPointMoveAction) controlPointMoveAction = nullptr; if (!curveDragAction) { auto action = make_unique(selected_line1, selected_line2); curveDragAction = action.get(); diff --git a/src/gui/symbol/point_editor.hpp b/src/gui/symbol/point_editor.hpp index 65380f33..d11ba8cd 100644 --- a/src/gui/symbol/point_editor.hpp +++ b/src/gui/symbol/point_editor.hpp @@ -19,13 +19,13 @@ class CurveDragAction; // Symbol editor for editing control points and handles -class SymbolPointEditor : public SymbolEditorBase { +class SymbolPointEditor final : public SymbolEditorBase { public: SymbolPointEditor(SymbolControl* control, const SymbolShapeP& part); // --------------------------------------------------- : Drawing - virtual void draw(DC& dc); + void draw(DC& dc) override; private: /// Draws a gradient on the selected line to indicate curve dragging @@ -56,25 +56,25 @@ private: public: // --------------------------------------------------- : UI - virtual void initUI (wxToolBar* tb, wxMenuBar* mb); - virtual void destroyUI(wxToolBar* tb, wxMenuBar* mb); - virtual void onUpdateUI(wxUpdateUIEvent&); - virtual void onCommand(int id); - virtual int modeToolId(); + void initUI (wxToolBar* tb, wxMenuBar* mb) override; + void destroyUI(wxToolBar* tb, wxMenuBar* mb) override; + void onUpdateUI(wxUpdateUIEvent&) override; + void onCommand(int id) override; + int modeToolId() override; // --------------------------------------------------- : Mouse events - virtual void onLeftDown (const Vector2D& pos, wxMouseEvent& ev); - virtual void onLeftUp (const Vector2D& pos, wxMouseEvent& ev); - virtual void onLeftDClick(const Vector2D& pos, wxMouseEvent& ev); - virtual void onMouseMove(const Vector2D& from, const Vector2D& to, wxMouseEvent& ev); - virtual void onMouseDrag(const Vector2D& from, const Vector2D& to, wxMouseEvent& ev); + void onLeftDown (const Vector2D& pos, wxMouseEvent& ev) override; + void onLeftUp (const Vector2D& pos, wxMouseEvent& ev) override; + void onLeftDClick(const Vector2D& pos, wxMouseEvent& ev) override; + void onMouseMove(const Vector2D& from, const Vector2D& to, wxMouseEvent& ev) override; + void onMouseDrag(const Vector2D& from, const Vector2D& to, wxMouseEvent& ev) override; // --------------------------------------------------- : Other events - virtual void onKeyChange(wxKeyEvent& ev); - virtual void onChar(wxKeyEvent& ev); - virtual bool isEditing(); + void onKeyChange(wxKeyEvent& ev) override; + void onChar(wxKeyEvent& ev) override; + bool isEditing() override; private: // --------------------------------------------------- : Data diff --git a/src/gui/symbol/select_editor.hpp b/src/gui/symbol/select_editor.hpp index 5ab2a28b..685e0e04 100644 --- a/src/gui/symbol/select_editor.hpp +++ b/src/gui/symbol/select_editor.hpp @@ -19,13 +19,13 @@ DECLARE_POINTER_TYPE(SymbolPartShearAction); // ----------------------------------------------------------------------------- : SymbolSelectEditor /// Editor that allows the user to select symbol parts -class SymbolSelectEditor : public SymbolEditorBase { +class SymbolSelectEditor final : public SymbolEditorBase { public: SymbolSelectEditor(SymbolControl* control, bool rotate); // --------------------------------------------------- : Drawing - virtual void draw(DC& dc); + void draw(DC& dc) override; private: /// Draw handles on all sides @@ -39,26 +39,26 @@ private: public: // --------------------------------------------------- : UI - virtual void initUI (wxToolBar* tb, wxMenuBar* mb); - virtual void destroyUI(wxToolBar* tb, wxMenuBar* mb); - virtual void onUpdateUI(wxUpdateUIEvent&); - virtual void onCommand(int id); - virtual int modeToolId(); + void initUI (wxToolBar* tb, wxMenuBar* mb) override; + void destroyUI(wxToolBar* tb, wxMenuBar* mb) override; + void onUpdateUI(wxUpdateUIEvent&) override; + void onCommand(int id) override; + int modeToolId() override; // --------------------------------------------------- : Mouse events - virtual void onLeftDown (const Vector2D& pos, wxMouseEvent& ev); - virtual void onLeftDClick (const Vector2D& pos, wxMouseEvent& ev); - virtual void onLeftUp (const Vector2D& pos, wxMouseEvent& ev); - virtual void onMouseMove (const Vector2D& from, const Vector2D& to, wxMouseEvent& ev); - virtual void onMouseDrag (const Vector2D& from, const Vector2D& to, wxMouseEvent& ev); + void onLeftDown (const Vector2D& pos, wxMouseEvent& ev) override; + void onLeftDClick (const Vector2D& pos, wxMouseEvent& ev) override; + void onLeftUp (const Vector2D& pos, wxMouseEvent& ev) override; + void onMouseMove (const Vector2D& from, const Vector2D& to, wxMouseEvent& ev) override; + void onMouseDrag (const Vector2D& from, const Vector2D& to, wxMouseEvent& ev) override; // --------------------------------------------------- : Other events - virtual void onKeyChange (wxKeyEvent& ev); - virtual void onChar (wxKeyEvent& ev); + void onKeyChange (wxKeyEvent& ev) override; + void onChar (wxKeyEvent& ev) override; - virtual bool isEditing(); + bool isEditing() override; private: // The part under the mouse cursor diff --git a/src/gui/symbol/symmetry_editor.hpp b/src/gui/symbol/symmetry_editor.hpp index ccfc2d86..d2bdadfb 100644 --- a/src/gui/symbol/symmetry_editor.hpp +++ b/src/gui/symbol/symmetry_editor.hpp @@ -17,35 +17,35 @@ class SymmetryMoveAction; // ----------------------------------------------------------------------------- : SymbolSymmetryEditor /// Editor for adding symmetries -class SymbolSymmetryEditor : public SymbolEditorBase { +class SymbolSymmetryEditor final : public SymbolEditorBase { public: /** The symmetry parameter is optional, if it is not set, then only new ones can be created */ SymbolSymmetryEditor(SymbolControl* control, const SymbolSymmetryP& symmetry); // --------------------------------------------------- : Drawing - virtual void draw(DC& dc); + void draw(DC& dc) override; // --------------------------------------------------- : UI - virtual void initUI (wxToolBar* tb, wxMenuBar* mb); - virtual void destroyUI(wxToolBar* tb, wxMenuBar* mb); - virtual void onUpdateUI(wxUpdateUIEvent&); - virtual void onCommand(int id); - virtual int modeToolId(); + void initUI (wxToolBar* tb, wxMenuBar* mb) override; + void destroyUI(wxToolBar* tb, wxMenuBar* mb) override; + void onUpdateUI(wxUpdateUIEvent&) override; + void onCommand(int id) override; + int modeToolId() override; // --------------------------------------------------- : Mouse events - virtual void onLeftDown (const Vector2D& pos, wxMouseEvent& ev); - virtual void onLeftUp (const Vector2D& pos, wxMouseEvent& ev); - virtual void onMouseMove (const Vector2D& from, const Vector2D& to, wxMouseEvent& ev); - virtual void onMouseDrag (const Vector2D& from, const Vector2D& to, wxMouseEvent& ev); + void onLeftDown (const Vector2D& pos, wxMouseEvent& ev) override; + void onLeftUp (const Vector2D& pos, wxMouseEvent& ev) override; + void onMouseMove (const Vector2D& from, const Vector2D& to, wxMouseEvent& ev) override; + void onMouseDrag (const Vector2D& from, const Vector2D& to, wxMouseEvent& ev) override; // --------------------------------------------------- : Other events - virtual void onKeyChange(wxKeyEvent& ev); + void onKeyChange(wxKeyEvent& ev) override; - virtual bool isEditing(); + bool isEditing() override; // --------------------------------------------------- : Data private: diff --git a/src/gui/thumbnail_thread.cpp b/src/gui/thumbnail_thread.cpp index 6ce58f13..fe11bdc4 100644 --- a/src/gui/thumbnail_thread.cpp +++ b/src/gui/thumbnail_thread.cpp @@ -42,7 +42,7 @@ class ThumbnailThreadWorker : public wxThread { public: ThumbnailThreadWorker(ThumbnailThread* parent); - virtual ExitCode Entry(); + ExitCode Entry() override; ThumbnailRequestP current; ///< Request we are working on ThumbnailThread* parent; diff --git a/src/gui/update_checker.cpp b/src/gui/update_checker.cpp index 9da32d88..5c7f2c98 100644 --- a/src/gui/update_checker.cpp +++ b/src/gui/update_checker.cpp @@ -91,7 +91,7 @@ bool update_available() { // If not, displays a message class CheckUpdateThread : public wxThread { public: - virtual void* Entry() { + void* Entry() override { Work(); return 0; } @@ -170,7 +170,7 @@ struct HtmlWindowToBrowser : public wxHtmlWindow { : wxHtmlWindow(parent, id, pos, size, flags) {} - virtual void OnLinkClicked(const wxHtmlLinkInfo& info) { + void OnLinkClicked(const wxHtmlLinkInfo& info) override { wxLaunchDefaultBrowser( info.GetHref() ); } }; diff --git a/src/gui/value/choice.cpp b/src/gui/value/choice.cpp index 40fb7998..49fb1319 100644 --- a/src/gui/value/choice.cpp +++ b/src/gui/value/choice.cpp @@ -22,11 +22,11 @@ const double min_item_size = thumbnail_size; class ChoiceThumbnailRequest : public ThumbnailRequest { public: ChoiceThumbnailRequest(ValueViewer* cve, int id, bool from_disk, bool thread_safe); - virtual Image generate(); - virtual void store(const Image&); + Image generate() override; + void store(const Image&) override; bool isThreadSafe; - virtual bool threadSafe() const {return isThreadSafe;} + bool threadSafe() const override {return isThreadSafe;} private: int id; diff --git a/src/gui/value/choice.hpp b/src/gui/value/choice.hpp index 87a0e497..1e6b61d9 100644 --- a/src/gui/value/choice.hpp +++ b/src/gui/value/choice.hpp @@ -25,12 +25,12 @@ public: ~ChoiceValueEditor(); // --------------------------------------------------- : Events - virtual bool onLeftDown(const RealPoint& pos, wxMouseEvent& ev); - virtual bool onChar(wxKeyEvent& ev); - virtual void onLoseFocus(); + bool onLeftDown(const RealPoint& pos, wxMouseEvent& ev) override; + bool onChar(wxKeyEvent& ev) override; + void onLoseFocus() override; - virtual void draw(RotatedDC& dc); - virtual void determineSize(bool); + void draw(RotatedDC& dc) override; + void determineSize(bool) override; private: DropDownListP drop_down; @@ -93,9 +93,9 @@ public: DropDownChoiceList(Window* parent, bool is_submenu, ValueViewer& cve, ChoiceField::ChoiceP group); protected: - virtual void onShow(); - virtual void select(size_t item); - virtual size_t selection() const; - virtual DropDownList* createSubMenu(ChoiceField::ChoiceP group) const; + void onShow() override; + void select(size_t item) override; + size_t selection() const override; + DropDownList* createSubMenu(ChoiceField::ChoiceP group) const override; }; diff --git a/src/gui/value/color.cpp b/src/gui/value/color.cpp index e2b93904..930c1be7 100644 --- a/src/gui/value/color.cpp +++ b/src/gui/value/color.cpp @@ -20,14 +20,14 @@ class DropDownColorList : public DropDownList { public: DropDownColorList(Window* parent, ColorValueEditor& cve); - protected: - virtual size_t itemCount() const; - virtual bool lineBelow(size_t item) const; - virtual String itemText(size_t item) const; - virtual void drawIcon(DC& dc, int x, int y, size_t item, bool selected) const; +protected: + size_t itemCount() const override; + bool lineBelow(size_t item) const override; + String itemText(size_t item) const override; + void drawIcon(DC& dc, int x, int y, size_t item, bool selected) const override; - virtual void select(size_t item); - virtual size_t selection() const; + void select(size_t item) override; + size_t selection() const override; private: ColorValueEditor& cve; diff --git a/src/gui/value/color.hpp b/src/gui/value/color.hpp index 457b25ef..5606e8a1 100644 --- a/src/gui/value/color.hpp +++ b/src/gui/value/color.hpp @@ -22,12 +22,12 @@ public: DECLARE_VALUE_EDITOR(Color); // --------------------------------------------------- : Events - virtual bool onLeftDown(const RealPoint& pos, wxMouseEvent& ev); - virtual bool onChar(wxKeyEvent& ev); - virtual void onLoseFocus(); + bool onLeftDown(const RealPoint& pos, wxMouseEvent& ev) override; + bool onChar(wxKeyEvent& ev) override; + void onLoseFocus() override; - virtual void draw(RotatedDC& dc); - virtual void determineSize(bool); + void draw(RotatedDC& dc) override; + void determineSize(bool) override; private: DropDownListP drop_down; diff --git a/src/gui/value/editor.hpp b/src/gui/value/editor.hpp index 9be458a1..0b57bc1e 100644 --- a/src/gui/value/editor.hpp +++ b/src/gui/value/editor.hpp @@ -138,13 +138,13 @@ protected: #define DECLARE_VALUE_EDITOR(Type) \ Type##ValueEditor(DataEditor& parent, const Type##StyleP& style); \ - virtual ValueEditor* getEditor() { return this; } \ - private: \ + ValueEditor* getEditor() override { return this; } \ + private: \ /** Retrieve the parent editor object */ \ - inline DataEditor& editor() const { \ + inline DataEditor& editor() const override { \ return static_cast(viewer); \ } \ - public: + public: #define IMPLEMENT_VALUE_EDITOR(Type) \ ValueViewerP Type##Style::makeEditor(DataEditor& parent) { \ diff --git a/src/gui/value/image.hpp b/src/gui/value/image.hpp index 120a93f9..e4e833df 100644 --- a/src/gui/value/image.hpp +++ b/src/gui/value/image.hpp @@ -19,17 +19,17 @@ class ImageValueEditor : public ImageValueViewer, public ValueEditor { public: DECLARE_VALUE_EDITOR(Image); - virtual bool onLeftDClick(const RealPoint&, wxMouseEvent&); + bool onLeftDClick(const RealPoint&, wxMouseEvent&) override; // --------------------------------------------------- : Clipboard - virtual bool canCopy() const; - virtual bool canPaste() const; - virtual bool doCopy(); - virtual bool doPaste(); - virtual bool doDelete(); + bool canCopy() const override; + bool canPaste() const override; + bool doCopy() override; + bool doPaste() override; + bool doDelete() override; - virtual bool onChar(wxKeyEvent&); + bool onChar(wxKeyEvent&) override; private: // Open the image slice window showing the give image diff --git a/src/gui/value/information.hpp b/src/gui/value/information.hpp index 189bb547..a6b11447 100644 --- a/src/gui/value/information.hpp +++ b/src/gui/value/information.hpp @@ -19,7 +19,7 @@ class InfoValueEditor : public InfoValueViewer, public ValueEditor { public: DECLARE_VALUE_EDITOR(Info); - virtual void determineSize(bool); - virtual bool drawLabel() const { return false; } + void determineSize(bool) override; + bool drawLabel() const override { return false; } }; diff --git a/src/gui/value/multiple_choice.hpp b/src/gui/value/multiple_choice.hpp index 2bc6dfef..e09f0414 100644 --- a/src/gui/value/multiple_choice.hpp +++ b/src/gui/value/multiple_choice.hpp @@ -21,13 +21,13 @@ public: DECLARE_VALUE_EDITOR(MultipleChoice); ~MultipleChoiceValueEditor(); - virtual void onValueChange(); + void onValueChange() override; - virtual void determineSize(bool force_fit); + void determineSize(bool force_fit) override; - virtual bool onLeftDown (const RealPoint& pos, wxMouseEvent& ev); - virtual bool onChar(wxKeyEvent& ev); - virtual void onLoseFocus(); + bool onLeftDown(const RealPoint& pos, wxMouseEvent& ev) override; + bool onChar(wxKeyEvent& ev) override; + void onLoseFocus() override; private: DropDownListP drop_down; diff --git a/src/gui/value/package_choice.cpp b/src/gui/value/package_choice.cpp index 7f3b8f03..7214b414 100644 --- a/src/gui/value/package_choice.cpp +++ b/src/gui/value/package_choice.cpp @@ -20,12 +20,12 @@ public: DropDownPackageChoiceList(Window* parent, PackageChoiceValueEditor* editor); protected: - virtual size_t itemCount() const; - virtual String itemText(size_t item) const; - virtual bool lineBelow(size_t item) const; - virtual void drawIcon(DC& dc, int x, int y, size_t item, bool selected) const; - virtual void select(size_t selection); - virtual size_t selection() const; + size_t itemCount() const override; + String itemText(size_t item) const override; + bool lineBelow(size_t item) const override; + void drawIcon(DC& dc, int x, int y, size_t item, bool selected) const override; + void select(size_t selection) override; + size_t selection() const override; private: PackageChoiceValueEditor& editor; diff --git a/src/gui/value/package_choice.hpp b/src/gui/value/package_choice.hpp index 5156d710..f713c253 100644 --- a/src/gui/value/package_choice.hpp +++ b/src/gui/value/package_choice.hpp @@ -21,11 +21,11 @@ class PackageChoiceValueEditor : public PackageChoiceValueViewer, public ValueEd public: DECLARE_VALUE_EDITOR(PackageChoice); - virtual void draw(RotatedDC& dc); - virtual void determineSize(bool force_fit); - virtual bool onLeftDown (const RealPoint& pos, wxMouseEvent& ev); - virtual bool onChar(wxKeyEvent& ev); - virtual void onLoseFocus(); + void draw(RotatedDC& dc) override; + void determineSize(bool force_fit) override; + bool onLeftDown(const RealPoint& pos, wxMouseEvent& ev) override; + bool onChar(wxKeyEvent& ev) override; + void onLoseFocus() override; private: DropDownListP drop_down; diff --git a/src/gui/value/symbol.hpp b/src/gui/value/symbol.hpp index 01ba3d69..5fdca2c1 100644 --- a/src/gui/value/symbol.hpp +++ b/src/gui/value/symbol.hpp @@ -21,12 +21,12 @@ class SymbolValueEditor : public SymbolValueViewer, public ValueEditor { public: DECLARE_VALUE_EDITOR(Symbol); - virtual void draw(RotatedDC& dc); - virtual bool onLeftDown (const RealPoint& pos, wxMouseEvent&); - virtual bool onLeftUp (const RealPoint& pos, wxMouseEvent&); - virtual bool onLeftDClick(const RealPoint& pos, wxMouseEvent&); - virtual bool onMotion (const RealPoint& pos, wxMouseEvent&); - virtual void determineSize(bool); + void draw(RotatedDC& dc) override; + bool onLeftDown (const RealPoint& pos, wxMouseEvent&) override; + bool onLeftUp (const RealPoint& pos, wxMouseEvent&) override; + bool onLeftDClick(const RealPoint& pos, wxMouseEvent&) override; + bool onMotion (const RealPoint& pos, wxMouseEvent&) override; + void determineSize(bool) override; private: /// Draw a button, buttons are numbered from the right void drawButton(RotatedDC& dc, int button, const String& text); diff --git a/src/gui/value/text.cpp b/src/gui/value/text.cpp index 81f992dc..63e11401 100644 --- a/src/gui/value/text.cpp +++ b/src/gui/value/text.cpp @@ -116,15 +116,15 @@ public: inline WordListPosP getPos() const { return pos; } protected: - virtual void redrawArrowOnParent(); - virtual size_t itemCount() const { return items.size(); } - virtual bool lineBelow(size_t item) const { return items[item].flags & FLAG_LINE_BELOW; } - virtual String itemText(size_t item) const { return items[item].name; } - virtual void drawIcon(DC& dc, int x, int y, size_t item, bool selected) const; - virtual DropDownList* submenu(size_t item) const; - virtual size_t selection() const; - virtual void select(size_t item); - virtual bool stayOpen(size_t selection) const; + void redrawArrowOnParent() override; + size_t itemCount() const override { return items.size(); } + bool lineBelow(size_t item) const override { return items[item].flags & FLAG_LINE_BELOW; } + String itemText(size_t item) const override { return items[item].name; } + void drawIcon(DC& dc, int x, int y, size_t item, bool selected) const override; + DropDownList* submenu(size_t item) const override; + size_t selection() const override; + void select(size_t item) override; + bool stayOpen(size_t selection) const override; private: TextValueEditor& tve; WordListPosP pos; @@ -887,7 +887,7 @@ void TextValueEditor::showCaret() { // TODO : high quality? dc.SetFont(style().font.toWxFont(1.0)); int hi; - dc.GetTextExtent(_(" "), 0, &hi); + dc.GetTextExtent(_(" "), nullptr, &hi); #ifdef __WXGTK__ // HACK: Some fonts don't get the descender height set correctly. int charHeight = dc.GetCharHeight(); diff --git a/src/gui/value/text.hpp b/src/gui/value/text.hpp index 195ab848..784ed1cc 100644 --- a/src/gui/value/text.hpp +++ b/src/gui/value/text.hpp @@ -34,67 +34,67 @@ public: // --------------------------------------------------- : Events - virtual void onFocus(); - virtual void onLoseFocus(); + void onFocus() override; + void onLoseFocus() override; - virtual bool onLeftDown (const RealPoint& pos, wxMouseEvent&); - virtual bool onLeftUp (const RealPoint& pos, wxMouseEvent&); - virtual bool onLeftDClick(const RealPoint& pos, wxMouseEvent&); - virtual bool onRightDown (const RealPoint& pos, wxMouseEvent&); - virtual bool onMotion (const RealPoint& pos, wxMouseEvent&); - virtual void onMouseLeave(const RealPoint& pos, wxMouseEvent&); - virtual bool onMouseWheel(const RealPoint& pos, wxMouseEvent&); + bool onLeftDown (const RealPoint& pos, wxMouseEvent&) override; + bool onLeftUp (const RealPoint& pos, wxMouseEvent&) override; + bool onLeftDClick(const RealPoint& pos, wxMouseEvent&) override; + bool onRightDown (const RealPoint& pos, wxMouseEvent&) override; + bool onMotion (const RealPoint& pos, wxMouseEvent&) override; + void onMouseLeave(const RealPoint& pos, wxMouseEvent&) override; + bool onMouseWheel(const RealPoint& pos, wxMouseEvent&) override; - virtual bool onContextMenu(wxMenu& m, wxContextMenuEvent&); - virtual wxMenu* getMenu(int type) const; - virtual bool onCommand(int); + bool onContextMenu(wxMenu& m, wxContextMenuEvent&) override; + wxMenu* getMenu(int type) const override; + bool onCommand(int) override; - virtual bool onChar(wxKeyEvent&); + bool onChar(wxKeyEvent&) override; // --------------------------------------------------- : Actions - virtual void onValueChange(); - virtual void onAction(const Action&, bool undone); + void onValueChange() override; + void onAction(const Action&, bool undone) override; // --------------------------------------------------- : Clipboard - virtual bool canCopy() const; - virtual bool canPaste() const; - virtual bool doCopy(); - virtual bool doPaste(); - virtual bool doDelete(); + bool canCopy() const override; + bool canPaste() const override; + bool doCopy() override; + bool doPaste() override; + bool doDelete() override; // --------------------------------------------------- : Formating - virtual bool canFormat(int type) const; - virtual bool hasFormat(int type) const; - virtual void doFormat(int type); + bool canFormat(int type) const override; + bool hasFormat(int type) const override; + void doFormat(int type) override; // --------------------------------------------------- : Selection - virtual bool canSelectAll() const { return true; } - virtual void doSelectAll(); - virtual void select(size_t start, size_t end); - virtual size_t selectionStart() const { return selection_start; } - virtual size_t selectionEnd() const { return selection_end; } + bool canSelectAll() const override { return true; } + void doSelectAll() override; + void select(size_t start, size_t end) override; + size_t selectionStart() const override { return selection_start; } + size_t selectionEnd() const override { return selection_end; } - virtual void insert(const String& text, const String& action_name); + void insert(const String& text, const String& action_name) override; // --------------------------------------------------- : Search/replace - virtual bool search(FindInfo& find, bool from_start); + bool search(FindInfo& find, bool from_start) override; private: bool matchSubstr(const String& s, size_t pos, FindInfo& find); public: // --------------------------------------------------- : Other - virtual wxCursor cursor(const RealPoint& pos) const; - virtual void determineSize(bool force_fit = false); - virtual bool containsPoint(const RealPoint& p) const; - virtual RealRect boundingBox() const; - virtual void onShow(bool); - virtual void draw(RotatedDC&); + wxCursor cursor(const RealPoint& pos) const override; + void determineSize(bool force_fit = false) override; + bool containsPoint(const RealPoint& p) const override; + RealRect boundingBox() const override; + void onShow(bool) override; + void draw(RotatedDC&) override; // --------------------------------------------------- : Data private: diff --git a/src/gui/welcome_window.hpp b/src/gui/welcome_window.hpp index 2d8f5ff6..00c3492f 100644 --- a/src/gui/welcome_window.hpp +++ b/src/gui/welcome_window.hpp @@ -63,6 +63,6 @@ private: wxFont font_large, font_small; protected: - virtual void draw(DC& dc); + void draw(DC& dc) override; }; diff --git a/src/main.cpp b/src/main.cpp index c9eea772..ea49d8fe 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -38,23 +38,23 @@ ScriptValueP export_set(SetP const& set, vector const& cards, ExportTempl class MSE : public wxApp { public: /// Do nothing. The command line parsing, etc. is done in OnRun - bool OnInit() { return true; } + bool OnInit() override { return true; } /// Main startup function of the program /** Use OnRun instead of OnInit, so we can determine whether or not we need a main loop * Also, OnExit is always run. */ - int OnRun(); + int OnRun() override; /// Actually start the GUI mainloop int runGUI(); /// On exit: write the settings to the config file - int OnExit(); + int OnExit() override; /// On exception: display error message - void HandleEvent(wxEvtHandler *handler, wxEventFunction func, wxEvent& event) const; + void HandleEvent(wxEvtHandler *handler, wxEventFunction func, wxEvent& event) const override; /// Hack around some wxWidget idiocies - int FilterEvent(wxEvent& ev); + int FilterEvent(wxEvent& ev) override; /// Fancier assert #if defined(_MSC_VER) && defined(_DEBUG) && defined(_CRT_WIDE) - void OnAssert(const wxChar *file, int line, const wxChar *cond, const wxChar *msg); + void OnAssert(const wxChar *file, int line, const wxChar *cond, const wxChar *msg) override; #endif }; diff --git a/src/render/card/viewer.hpp b/src/render/card/viewer.hpp index 9890c760..97f8d5c7 100644 --- a/src/render/card/viewer.hpp +++ b/src/render/card/viewer.hpp @@ -69,7 +69,7 @@ class DataViewer : public SetView { void setCard(const CardP& card, bool refresh = false); /// Clear data - virtual void onChangeSet(); + void onChangeSet() override; // --------------------------------------------------- : The viewers private: @@ -88,7 +88,7 @@ protected: virtual ValueViewerP makeViewer(const StyleP&); /// Update the viewers and forward actions - virtual void onAction(const Action&, bool undone); + void onAction(const Action&, bool undone) override; /// Notification that the total image has changed virtual void onChange() {} diff --git a/src/render/symbol/filter.hpp b/src/render/symbol/filter.hpp index 6fd03c85..83d3e88f 100644 --- a/src/render/symbol/filter.hpp +++ b/src/render/symbol/filter.hpp @@ -62,9 +62,9 @@ public: inline SolidFillSymbolFilter(const Color& fill_color, const Color& border_color) : fill_color(fill_color), border_color(border_color) {} - virtual Color color(double x, double y, SymbolSet point) const; - virtual String fillType() const; - virtual bool operator == (const SymbolFilter& that) const; + Color color(double x, double y, SymbolSet point) const override; + String fillType() const override; + bool operator == (const SymbolFilter& that) const override; private: Color fill_color, border_color; DECLARE_REFLECTION_OVERRIDE(); @@ -95,9 +95,9 @@ public: LinearGradientSymbolFilter(const Color& fill_color_1, const Color& border_color_1, const Color& fill_color_2, const Color& border_color_2 ,double center_x, double center_y, double end_x, double end_y); - virtual Color color(double x, double y, SymbolSet point) const; - virtual String fillType() const; - virtual bool operator == (const SymbolFilter& that) const; + Color color(double x, double y, SymbolSet point) const override; + String fillType() const override; + bool operator == (const SymbolFilter& that) const override; /// return time on the gradient, used by GradientSymbolFilter::color inline double t(double x, double y) const; @@ -117,9 +117,9 @@ public: : GradientSymbolFilter(fill_color_1, border_color_1, fill_color_2, border_color_2) {} - virtual Color color(double x, double y, SymbolSet point) const; - virtual String fillType() const; - virtual bool operator == (const SymbolFilter& that) const; + Color color(double x, double y, SymbolSet point) const override; + String fillType() const override; + bool operator == (const SymbolFilter& that) const override; /// return time on the gradient, used by GradientSymbolFilter::color inline double t(double x, double y) const; diff --git a/src/render/symbol/viewer.hpp b/src/render/symbol/viewer.hpp index 0c29e9c9..fa79c380 100644 --- a/src/render/symbol/viewer.hpp +++ b/src/render/symbol/viewer.hpp @@ -58,7 +58,7 @@ public: void drawEditingHints(DC& dc); - void onAction(const Action&, bool) {} + void onAction(const Action&, bool) override {} private: diff --git a/src/render/value/choice.hpp b/src/render/value/choice.hpp index 90f38bb5..39967405 100644 --- a/src/render/value/choice.hpp +++ b/src/render/value/choice.hpp @@ -19,9 +19,9 @@ class ChoiceValueViewer : public ValueViewer { public: DECLARE_VALUE_VIEWER(Choice) : ValueViewer(parent,style) {} - virtual bool prepare(RotatedDC& dc); - virtual void draw(RotatedDC& dc); - virtual void onStyleChange(int); + bool prepare(RotatedDC& dc) override; + void draw(RotatedDC& dc) override; + void onStyleChange(int) override; }; bool prepare_choice_viewer(RotatedDC& dc, ValueViewer& viewer, ChoiceStyle& style, const String& value); diff --git a/src/render/value/color.hpp b/src/render/value/color.hpp index 5576f912..3d2ed640 100644 --- a/src/render/value/color.hpp +++ b/src/render/value/color.hpp @@ -21,7 +21,7 @@ class ColorValueViewer : public ValueViewer { public: DECLARE_VALUE_VIEWER(Color) : ValueViewer(parent,style) {} - virtual void draw(RotatedDC& dc); - virtual bool containsPoint(const RealPoint& p) const; + void draw(RotatedDC& dc) override; + bool containsPoint(const RealPoint& p) const override; }; diff --git a/src/render/value/image.hpp b/src/render/value/image.hpp index 1cf74598..7029fc40 100644 --- a/src/render/value/image.hpp +++ b/src/render/value/image.hpp @@ -21,9 +21,9 @@ class ImageValueViewer : public ValueViewer { public: DECLARE_VALUE_VIEWER(Image) : ValueViewer(parent,style) {} - virtual void draw(RotatedDC& dc); - virtual void onValueChange(); - virtual void onStyleChange(int); + void draw(RotatedDC& dc) override; + void onValueChange() override; + void onStyleChange(int) override; private: Bitmap bitmap; ///< Cached bitmap diff --git a/src/render/value/information.hpp b/src/render/value/information.hpp index 59a693ed..10d16e7f 100644 --- a/src/render/value/information.hpp +++ b/src/render/value/information.hpp @@ -19,7 +19,7 @@ class InfoValueViewer : public ValueViewer { public: DECLARE_VALUE_VIEWER(Info) : ValueViewer(parent,style) {} - virtual void draw(RotatedDC& dc); + void draw(RotatedDC& dc) override; }; diff --git a/src/render/value/multiple_choice.hpp b/src/render/value/multiple_choice.hpp index 98ab61af..25a56495 100644 --- a/src/render/value/multiple_choice.hpp +++ b/src/render/value/multiple_choice.hpp @@ -19,9 +19,9 @@ class MultipleChoiceValueViewer : public ValueViewer { public: DECLARE_VALUE_VIEWER(MultipleChoice) : ValueViewer(parent,style), item_height(0) {} - virtual bool prepare(RotatedDC& dc); - virtual void draw(RotatedDC& dc); - virtual void onStyleChange(int); + bool prepare(RotatedDC& dc) override; + void draw(RotatedDC& dc) override; + void onStyleChange(int) override; protected: double item_height; ///< Height of a single item, or 0 if non uniform private: diff --git a/src/render/value/package_choice.hpp b/src/render/value/package_choice.hpp index e7cb2f59..afc7ad5c 100644 --- a/src/render/value/package_choice.hpp +++ b/src/render/value/package_choice.hpp @@ -19,7 +19,7 @@ class PackageChoiceValueViewer : public ValueViewer { public: DECLARE_VALUE_VIEWER(PackageChoice) : ValueViewer(parent,style) { initItems(); } - virtual void draw(RotatedDC& dc); + void draw(RotatedDC& dc) override; struct Item{ String package_name; diff --git a/src/render/value/symbol.hpp b/src/render/value/symbol.hpp index b1adc78c..2b9613ba 100644 --- a/src/render/value/symbol.hpp +++ b/src/render/value/symbol.hpp @@ -19,8 +19,8 @@ class SymbolValueViewer : public ValueViewer { public: DECLARE_VALUE_VIEWER(Symbol) : ValueViewer(parent,style) {} - virtual void draw(RotatedDC& dc); - void onValueChange(); + void draw(RotatedDC& dc) override; + void onValueChange() override; protected: vector symbols; ///< Cached images diff --git a/src/render/value/text.hpp b/src/render/value/text.hpp index 773e24ab..3d9ecbf8 100644 --- a/src/render/value/text.hpp +++ b/src/render/value/text.hpp @@ -20,12 +20,12 @@ class TextValueViewer : public ValueViewer { public: DECLARE_VALUE_VIEWER(Text) : ValueViewer(parent,style) {} - virtual bool prepare(RotatedDC& dc); - virtual void draw(RotatedDC& dc); - virtual void onValueChange(); - virtual void onStyleChange(int); - virtual void onAction(const Action&, bool undone); - virtual double getStretch() const; + bool prepare(RotatedDC& dc) override; + void draw(RotatedDC& dc) override; + void onValueChange() override; + void onStyleChange(int) override; + void onAction(const Action&, bool undone) override; + double getStretch() const override; protected: TextViewer v; diff --git a/src/render/value/viewer.hpp b/src/render/value/viewer.hpp index 26974bd0..aed0b14c 100644 --- a/src/render/value/viewer.hpp +++ b/src/render/value/viewer.hpp @@ -63,12 +63,12 @@ public: virtual void onValueChange() {} /// Called when a (scripted) property of the associated style has changed /** Default: redraws the viewer if needed */ - virtual void onStyleChange(int changes); + void onStyleChange(int changes) override; /// Called when an action is performed on the associated value virtual void onAction(const Action&, bool undone) { onValueChange(); } /// Convert this viewer to an editor, if possible - virtual ValueEditor* getEditor() { return 0; } + virtual ValueEditor* getEditor() { return nullptr; } DataViewer& viewer; ///< Our parent object protected: diff --git a/src/script/functions/regex.cpp b/src/script/functions/regex.cpp index 20b5dbec..da45347e 100644 --- a/src/script/functions/regex.cpp +++ b/src/script/functions/regex.cpp @@ -19,8 +19,8 @@ DECLARE_POINTER_TYPE(ScriptRegex); /// A regular expression for use in a script class ScriptRegex : public ScriptValue, public Regex { public: - virtual ScriptType type() const { return SCRIPT_REGEX; } - virtual String typeName() const { return _("regex"); } + ScriptType type() const override { return SCRIPT_REGEX; } + String typeName() const override { return _("regex"); } ScriptRegex(const String& code) { assign(code); diff --git a/src/script/script_manager.hpp b/src/script/script_manager.hpp index 27a5b2df..3fd10f48 100644 --- a/src/script/script_manager.hpp +++ b/src/script/script_manager.hpp @@ -107,6 +107,6 @@ private: protected: /// Respond to actions by updating scripts - void onAction(const Action&, bool undone); + void onAction(const Action&, bool undone) override; }; diff --git a/src/util/dynamic_arg.hpp b/src/util/dynamic_arg.hpp index 186d7a79..babbcac3 100644 --- a/src/util/dynamic_arg.hpp +++ b/src/util/dynamic_arg.hpp @@ -54,7 +54,7 @@ /// Implementation of a dynamic argument #define IMPLEMENT_DYNAMIC_ARG(Type, name, initial) \ - THREAD_LOCAL Type name##_private = initial; + THREAD_LOCAL Type name##_private = initial /// Locally change the value of a dynamic argument /** Usage: @@ -107,10 +107,10 @@ }; #define DECLARE_DYNAMIC_ARG(Type, name) \ - extern ThreadLocalObject name; + extern ThreadLocalObject name #define IMPLEMENT_DYNAMIC_ARG(Type, name, initial) \ - ThreadLocalObject name (initial); + ThreadLocalObject name (initial) #define WITH_DYNAMIC_ARG(name, value) \ name.store(value); diff --git a/src/util/io/package.hpp b/src/util/io/package.hpp index 22421e71..6d15df9c 100644 --- a/src/util/io/package.hpp +++ b/src/util/io/package.hpp @@ -316,9 +316,9 @@ inline void after_reading(Packaged& p, Version file_app_version) { /// A package that just contains a bunch of files that are used from other packages class IncludePackage : public Packaged { protected: - String typeName() const; - Version fileVersion() const; - DECLARE_REFLECTION(); + String typeName() const override; + Version fileVersion() const override; + DECLARE_REFLECTION_OVERRIDE(); }; // ----------------------------------------------------------------------------- : Utility diff --git a/src/util/smart_ptr.hpp b/src/util/smart_ptr.hpp index 6c02eb27..20867c54 100644 --- a/src/util/smart_ptr.hpp +++ b/src/util/smart_ptr.hpp @@ -104,12 +104,12 @@ inline intrusive_ptr make_intrusive(Args&&... args) { /// Declares the type TypeP as a intrusive_ptr #define DECLARE_POINTER_TYPE(Type) \ class Type; \ - typedef intrusive_ptr Type##P; + typedef intrusive_ptr Type##P /// Declares the type TypeP as a shared_ptr #define DECLARE_SHARED_POINTER_TYPE(Type) \ class Type; \ - typedef shared_ptr Type##P; + typedef shared_ptr Type##P // ----------------------------------------------------------------------------- : Utility diff --git a/src/util/vcs/subversion.hpp b/src/util/vcs/subversion.hpp index 2bdc87f4..2d18258a 100644 --- a/src/util/vcs/subversion.hpp +++ b/src/util/vcs/subversion.hpp @@ -15,9 +15,9 @@ class SubversionVCS : public VCS { public: - virtual void addFile (const wxFileName& filename); - virtual void moveFile (const wxFileName& source, const wxFileName& destination); - virtual void removeFile (const wxFileName& filename); + void addFile (const wxFileName& filename) final; + void moveFile (const wxFileName& source, const wxFileName& destination) final; + void removeFile (const wxFileName& filename) final; DECLARE_REFLECTION(); };