From 1113e18c4067cda1853f6893507b3ad4a14be2e6 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 3 Jun 2019 12:08:33 +0200 Subject: [PATCH] Fix incorrect initialization of some menuitems IDs. Although is is currently working, it is a potential issue. --- common/bin_mod.cpp | 1 + common/dialogs/panel_common_settings.cpp | 1 + gerbview/gerbview_id.h | 2 +- include/id.h | 11 +++++++++++ include/pgm_base.h | 13 ------------- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/common/bin_mod.cpp b/common/bin_mod.cpp index 1ad4b01ae0..45531863e4 100644 --- a/common/bin_mod.cpp +++ b/common/bin_mod.cpp @@ -25,6 +25,7 @@ #include #include #include +#include BIN_MOD::BIN_MOD( const char* aName ) : diff --git a/common/dialogs/panel_common_settings.cpp b/common/dialogs/panel_common_settings.cpp index db51bf4310..2596d82107 100644 --- a/common/dialogs/panel_common_settings.cpp +++ b/common/dialogs/panel_common_settings.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include diff --git a/gerbview/gerbview_id.h b/gerbview/gerbview_id.h index bd32694fe2..624f2df69b 100644 --- a/gerbview/gerbview_id.h +++ b/gerbview/gerbview_id.h @@ -79,7 +79,7 @@ enum gerbview_ids ID_HIGHLIGHT_APER_ATTRIBUTE_ITEMS, // IDs for drill file history (ID_FILEnn is already in use) - ID_GERBVIEW_DRILL_FILE = 4300, + ID_GERBVIEW_DRILL_FILE, ID_GERBVIEW_DRILL_FILE1, ID_GERBVIEW_DRILL_FILEMAX = ID_GERBVIEW_DRILL_FILE + MAX_FILE_HISTORY_SIZE, diff --git a/include/id.h b/include/id.h index 3b4e509abc..6bb4155321 100644 --- a/include/id.h +++ b/include/id.h @@ -61,6 +61,11 @@ #define ROOM_FOR_3D_VIEWER 100 #define ROOM_FOR_PANEL_PREV_MODEL 50 +/// The default file history size is 9. +#define DEFAULT_FILE_HISTORY_SIZE 9 +// Our max file history count +#define MAX_FILE_HISTORY_SIZE 99 + enum main_id { ID_RUN_PCB = wxID_HIGHEST, @@ -85,6 +90,12 @@ enum main_id ID_CONFIG_SAVE, ID_CONFIG_READ, + // ID for menuitems used in our file history management, + // when we do not use wxFILE_ID (restricted to 9 items) + ID_FILE, + ID_FILE1, + ID_FILEMAX = ID_FILE + MAX_FILE_HISTORY_SIZE, + ID_MENU_CANVAS_LEGACY, ID_MENU_CANVAS_OPENGL, ID_MENU_CANVAS_CAIRO, diff --git a/include/pgm_base.h b/include/pgm_base.h index b03c1e62ec..4aba77bb30 100644 --- a/include/pgm_base.h +++ b/include/pgm_base.h @@ -57,10 +57,6 @@ ///@} -/// The default file history size is 9. -#define DEFAULT_FILE_HISTORY_SIZE 9 -#define MAX_FILE_HISTORY_SIZE 99 - class wxConfigBase; class wxSingleInstanceChecker; class wxApp; @@ -71,15 +67,6 @@ class FILENAME_RESOLVER; class EDA_DRAW_FRAME; - -enum FILE_HISTORY_IDS -{ - ID_FILE = 4200, - ID_FILE1, - ID_FILEMAX = ID_FILE + MAX_FILE_HISTORY_SIZE -}; - - class FILE_HISTORY : public wxFileHistory { public: