diff --git a/common/eda_draw_frame.cpp b/common/eda_draw_frame.cpp index b1b20f2eb3..ab12308bcb 100644 --- a/common/eda_draw_frame.cpp +++ b/common/eda_draw_frame.cpp @@ -57,6 +57,7 @@ #include #include #include +#include #define FR_HISTORY_LIST_CNT 10 ///< Maximum size of the find/replace history stacks. diff --git a/common/tool/common_tools.cpp b/common/tool/common_tools.cpp index 79cb2f58e9..318cea4f87 100644 --- a/common/tool/common_tools.cpp +++ b/common/tool/common_tools.cpp @@ -39,6 +39,7 @@ #include #include #include +#include COMMON_TOOLS::COMMON_TOOLS() : diff --git a/common/tool/zoom_menu.cpp b/common/tool/zoom_menu.cpp index 07c69ba495..bfe546c7e1 100644 --- a/common/tool/zoom_menu.cpp +++ b/common/tool/zoom_menu.cpp @@ -32,6 +32,7 @@ #include #include #include +#include using namespace std::placeholders; diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 25153c3a31..1e5050cf3c 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -46,6 +46,7 @@ #include #include #include +#include /// Helper for all the old plotting/printing code while it still exists diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index c7ed1e5c78..b2f367d125 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -61,6 +61,7 @@ #include "widgets/gbr_layer_box_selector.h" #include "widgets/gerbview_layer_widget.h" #include "widgets/dcode_selection_box.h" +#include GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ) diff --git a/include/convert_to_biu.h b/include/convert_to_biu.h index 63c7941505..56701390ca 100644 --- a/include/convert_to_biu.h +++ b/include/convert_to_biu.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2012-2016 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2019 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -22,8 +22,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef CONVERT_TO_BIU_H_ -#define CONVERT_TO_BIU_H_ +#pragma once /** * @brief some define and functions to convert a value in mils, decimils or mm @@ -127,56 +126,3 @@ constexpr inline double PcbIu2Millimeter( int iu ) } #endif - -/* ZOOM LIMITS - - The largest distance that wx can support is INT_MAX, since it represents - distance often in a wxCoord or wxSize. As a scalar, a distance is always - positive. On most machines which run KiCad, int is 32 bits and INT_MAX is - 2147483647. The most difficult distance for a virtual (world) cartesian - space is the hypotenuse, or diagonal measurement at a 45 degree angle. This - puts the most stress on the distance magnitude within the bounded virtual - space. So if we allow this distance to be our constraint of <= INT_MAX, this - constraint then propagates to the maximum distance in X and in Y that can be - supported on each axis. Remember that the hypotenuse of a 1x1 square is - sqrt( 1x1 + 1x1 ) = sqrt(2) = 1.41421356. - - hypotenuse of any square = sqrt(2) * deltaX; - - Let maximum supported hypotenuse be INT_MAX, then: - - MAX_AXIS = INT_MAX / sqrt(2) = 2147483647 / 1.41421356 = 1518500251 - - This maximum distance is imposed by wxWidgets, not by KiCad. The imposition - comes in the form of the data structures used in the graphics API at the - wxDC level. Obviously when we are not interacting with wx we can use double - to compute distances larger than this. For example the computation of the - total length of a net, can and should be done in double, since it might - actually be longer than a single diagonal line. - - The next choice is what to use for internal units (IU), sometimes called - world units. If nanometers, then the virtual space must be limited to - about 1.5 x 1.5 meters square. This is 1518500251 divided by 1e9 nm/meter. - - The maximum zoom factor then depends on the client window size. If we ask - wx to handle something outside INT_MIN to INT_MAX, there are unreported - problems in the non-Debug build because wxRound() goes silent. - - Let: - const double MAX_AXIS = 1518500251; - - Then a maximum zoom factor for a screen of 1920 pixels wide is - 1518500251 / 1920 = 790885. - - The largest zoom factor allowed is therefore ~ 300 (which computes to 762000). -*/ - -#define MAX_ZOOM_FACTOR 300.0 - -// Adjusted to display zoom level ~ 1 when the screen shows a 1:1 image. -// Obviously depends on the monitor, but this is an acceptable value. -#define ZOOM_COEFF 1.1 - - - -#endif // CONVERT_TO_BIU_H_ diff --git a/include/zoom_defines.h b/include/zoom_defines.h new file mode 100644 index 0000000000..21adbb54b5 --- /dev/null +++ b/include/zoom_defines.h @@ -0,0 +1,74 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2012-2016 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#pragma once + +/* ZOOM LIMITS + + The largest distance that we (and Kicad) can support is INT_MAX, since it represents + distance often in a wxCoord or wxSize. As a scalar, a distance is always + positive. Because int is 32 bits and INT_MAX is + 2147483647. The most difficult distance for a virtual (world) cartesian + space is the hypotenuse, or diagonal measurement at a 45 degree angle. This + puts the most stress on the distance magnitude within the bounded virtual + space. So if we allow this distance to be our constraint of <= INT_MAX, this + constraint then propagates to the maximum distance in X and in Y that can be + supported on each axis. Remember that the hypotenuse of a 1x1 square is + sqrt( 1x1 + 1x1 ) = sqrt(2) = 1.41421356. + + hypotenuse of any square = sqrt(2) * deltaX; + + Let maximum supported hypotenuse be INT_MAX, then: + + MAX_AXIS = INT_MAX / sqrt(2) = 2147483647 / 1.41421356 = 1518500251 + + This maximum distance is imposed by wxWidgets, not by KiCad. The imposition + comes in the form of the data structures used in the graphics API at the + wxDC level. Obviously when we are not interacting with wx we can use double + to compute distances larger than this. For example the computation of the + total length of a net, can and should be done in double, since it might + actually be longer than a single diagonal line. + + The next choice is what to use for internal units (IU), sometimes called + world units. If nanometers, then the virtual space must be limited to + about 1.5 x 1.5 meters square. This is 1518500251 divided by 1e9 nm/meter. + + The maximum zoom factor then depends on the client window size. If we ask + wx to handle something outside INT_MIN to INT_MAX, there are unreported + problems in the non-Debug build because wxRound() goes silent. + + Let: + const double MAX_AXIS = 1518500251; + + Then a maximum zoom factor for a screen of 1920 pixels wide is + 1518500251 / 1920 = 790885. + + The largest zoom factor allowed is therefore ~ 300 (which computes to 762000). +*/ + +#define MAX_ZOOM_FACTOR 300.0 + +// Adjusted to display zoom level ~ 1 when the screen shows a 1:1 image. +// Obviously depends on the monitor, but this is an acceptable value. +#define ZOOM_COEFF 1.1 diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp index 724ee8f3b4..3f39ee82cb 100644 --- a/pagelayout_editor/pl_editor_frame.cpp +++ b/pagelayout_editor/pl_editor_frame.cpp @@ -60,6 +60,7 @@ #include "tools/pl_point_editor.h" #include "invoke_pl_editor_dialog.h" #include "tools/pl_editor_control.h" +#include BEGIN_EVENT_TABLE( PL_EDITOR_FRAME, EDA_DRAW_FRAME ) diff --git a/pcbnew/footprint_preview_panel.cpp b/pcbnew/footprint_preview_panel.cpp index 324dd3de88..f83465e4aa 100644 --- a/pcbnew/footprint_preview_panel.cpp +++ b/pcbnew/footprint_preview_panel.cpp @@ -40,6 +40,7 @@ #include #include #include +#include /** * Threadsafe interface class between loader thread and panel class. @@ -413,7 +414,9 @@ FOOTPRINT_PREVIEW_PANEL* FOOTPRINT_PREVIEW_PANEL::New( KIWAY* aKiway, wxWindow* { PCBNEW_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings(); - if( cfg->m_Window.grid.sizes.empty() ) + // Currently values read from config file are not used because the user cannot + // change this config + // if( cfg->m_Window.grid.sizes.empty() ) { cfg->m_Window.grid.sizes = { "1000 mil", "500 mil", @@ -439,12 +442,11 @@ FOOTPRINT_PREVIEW_PANEL* FOOTPRINT_PREVIEW_PANEL::New( KIWAY* aKiway, wxWindow* "0.01 mm" }; } - if( cfg->m_Window.zoom_factors.empty() ) + // Currently values read from config file are not used because the user cannot + // change this config + //if( cfg->m_Window.zoom_factors.empty() ) { - cfg->m_Window.zoom_factors = { 0.035, - 0.05, - 0.08, - 0.13, + cfg->m_Window.zoom_factors = { 0.13, 0.22, 0.35, 0.6, diff --git a/pcbnew/pcb_base_frame.cpp b/pcbnew/pcb_base_frame.cpp index 4b5169ffae..de0899f132 100644 --- a/pcbnew/pcb_base_frame.cpp +++ b/pcbnew/pcb_base_frame.cpp @@ -49,6 +49,8 @@ #include #include #include "cleanup_item.h" +#include + wxDEFINE_EVENT( BOARD_CHANGED, wxCommandEvent ); @@ -566,7 +568,9 @@ void PCB_BASE_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg ) { EDA_DRAW_FRAME::LoadSettings( aCfg ); - if( aCfg->m_Window.grid.sizes.empty() ) + // Currently values read from config file are not used because the user cannot + // change this config + // if( aCfg->m_Window.grid.sizes.empty() ) { aCfg->m_Window.grid.sizes = { "1000 mil", "500 mil", @@ -592,12 +596,11 @@ void PCB_BASE_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg ) "0.01 mm" }; } - if( aCfg->m_Window.zoom_factors.empty() ) + // Currently values read from config file are not used because the user cannot + // change this config + // if( aCfg->m_Window.zoom_factors.empty() ) { - aCfg->m_Window.zoom_factors = { 0.035, - 0.05, - 0.08, - 0.13, + aCfg->m_Window.zoom_factors = { 0.13, 0.22, 0.35, 0.6,