kicad/eeschema/eeschema_settings.h

372 lines
9.8 KiB
C
Raw Normal View History

/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
Horizontal/vertical zoom for Simulator plots ADDED: Horizontal/vertical zoom for simulator plots, via mouse wheel, toolbar buttons, menu commands, and hotkeys. ADDED: Simulator preferences panel, populated with mouse wheel and trackpad settings that control pan and zoom of simulator plots. ADDED: Zoom In/Out Horizontally/Vertically commands that can be bound to hotkeys. CHANGED: Simulator plot scroll wheel gestures are no longer hard-coded and can now be configured via the new Simulator preferences panel. Fixes https://gitlab.com/kicad/code/kicad/-/issues/16597 Other unreported bugs that were fixed: - Fixed wierd, jumpy simulator plot view limiting behavior. - Fixed Zoom In Center and Zoom Out Center commands not preserving the simulator plot center point. - Fixed simulator plot nudging when exported as PNGs. - Fixed rectangular selection zoom being able to exceed simulator plot view limits. Notes: - Provided new SIM_PREFERENCES struct to be used for future simulator preferences set via the simulator preferences dialog. - Bundled pre-existing EESCHEMA_SETTINGS::SIMULATOR settings into EESCHEMA_SETTINGS::SIMULATOR::VIEW. - Replaced mpWindow::EnableMouseWheelPan with more general SetMouseWheelActions. - Refactored and tidied up wxMathPlot's mpWindow code involved with fitting, zooming, and panning. - Consolidated long lists of duplicated member variable initializers to a new mpWindow private delegated constructor. - Provided provisional Zoom In/Out Horizontally/Vertically toolbar icons that need improvement by a graphics designer. - Provided gitignore entries for the Qt Creator IDE
2024-01-23 01:02:50 +00:00
* Copyright (C) 2020-2024 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
*/
#ifndef _EESCHEMA_SETTINGS_H
#define _EESCHEMA_SETTINGS_H
#include <wx/aui/framemanager.h>
#include <settings/app_settings.h>
Horizontal/vertical zoom for Simulator plots ADDED: Horizontal/vertical zoom for simulator plots, via mouse wheel, toolbar buttons, menu commands, and hotkeys. ADDED: Simulator preferences panel, populated with mouse wheel and trackpad settings that control pan and zoom of simulator plots. ADDED: Zoom In/Out Horizontally/Vertically commands that can be bound to hotkeys. CHANGED: Simulator plot scroll wheel gestures are no longer hard-coded and can now be configured via the new Simulator preferences panel. Fixes https://gitlab.com/kicad/code/kicad/-/issues/16597 Other unreported bugs that were fixed: - Fixed wierd, jumpy simulator plot view limiting behavior. - Fixed Zoom In Center and Zoom Out Center commands not preserving the simulator plot center point. - Fixed simulator plot nudging when exported as PNGs. - Fixed rectangular selection zoom being able to exceed simulator plot view limits. Notes: - Provided new SIM_PREFERENCES struct to be used for future simulator preferences set via the simulator preferences dialog. - Bundled pre-existing EESCHEMA_SETTINGS::SIMULATOR settings into EESCHEMA_SETTINGS::SIMULATOR::VIEW. - Replaced mpWindow::EnableMouseWheelPan with more general SetMouseWheelActions. - Refactored and tidied up wxMathPlot's mpWindow code involved with fitting, zooming, and panning. - Consolidated long lists of duplicated member variable initializers to a new mpWindow private delegated constructor. - Provided provisional Zoom In/Out Horizontally/Vertically toolbar icons that need improvement by a graphics designer. - Provided gitignore entries for the Qt Creator IDE
2024-01-23 01:02:50 +00:00
#include <sim/sim_preferences.h>
using KIGFX::COLOR4D;
extern const wxAuiPaneInfo& defaultNetNavigatorPaneInfo();
extern const wxAuiPaneInfo& defaultPropertiesPaneInfo( wxWindow* aWindow );
extern const wxAuiPaneInfo& defaultSchSelectionFilterPaneInfo( wxWindow* aWindow );
enum LINE_MODE
{
LINE_MODE_FREE = 0,
LINE_MODE_90 = 1,
LINE_MODE_45 = 2,
LINE_MODE_COUNT,
};
class EESCHEMA_SETTINGS : public APP_SETTINGS_BASE
{
public:
struct APPEARANCE
{
wxString edit_symbol_visible_columns;
int edit_symbol_width;
int edit_symbol_height;
2020-03-06 20:02:58 +00:00
wxString edit_sheet_visible_columns;
int edit_sheet_width;
int edit_sheet_height;
wxString edit_label_visible_columns;
int edit_label_width;
int edit_label_height;
int erc_severities;
bool footprint_preview;
bool print_sheet_reference;
2022-01-07 00:47:23 +00:00
wxString default_font;
bool show_hidden_pins;
bool show_hidden_fields;
bool show_directive_labels;
bool mark_sim_exclusions;
bool show_erc_warnings;
bool show_erc_errors;
bool show_erc_exclusions;
bool show_op_voltages;
bool show_op_currents;
bool show_illegal_symbol_lib_dialog;
bool show_page_limits;
Make the new schematic and symbol library file formats the default. This is a very large and potentially disruptive change so this will be an unusually long and detailed commit message. The new file formats are now the default in both the schematic and symbol library editors. Existing symbol libraries will be saved in their current format until new features are added to library symbols. Once this happens, both the legacy schematic and symbol file formats will be no longer be savable and existing libraries will have to be converted. Saving to the legacy file formats is still available for round robin testing and should not be used for normal editing. When loading the legacy schematic file, it is imperative that the schematic library symbols are rescued and/or remapped to valid library identifiers. Otherwise, there will be no way to link to the original library symbol and the user will be required manually set the library identifier. The cached symbol will be saved in the schematic file so the last library symbol in the cache will still be used but there will be no way to update it from the original library. The next save after loading a legacy schematic file will be converted to the s-expression file format. Schematics with hierarchical sheets will automatically have all sheet file name extensions changed to .kicad_sym and saved to the new format as well. Appending schematics requires that the schematic to append has already been converted to the new file format. This is required to ensure that library symbols are guaranteed to be valid for the appended schematic. The schematic symbol library symbol link resolution has been moved out of the SCH_COMPONENT object and move into the SCH_SCREEN object that owns the symbol. This was done to ensure that there is a single place where the library symbol links get resolved rather than the dozen or so different code paths that previously existed. It also removes the necessity of the SCH_COMPONENT object of requiring any knowledge of the symbol library table and/or the cache library. When opening an s-expression schematic, the legacy cache library is not loaded so any library symbols not rescued cannot be loaded. Broken library symbol links will have to be manually resolved by adding the cache library to the symbol library table and changing the links in the schematic symbol. Now that the library symbols are embedded in the schematic file, the SCH_SCREEN object maintains the list of library symbols for the schematic automatically. No external manipulation of this library cache should ever occur. ADDED: S-expression schematic and symbol library file formats.
2020-04-16 16:43:50 +00:00
bool show_sexpr_file_convert_warning;
bool show_sheet_filename_case_sensitivity_dialog;
};
struct AUI_PANELS
{
int hierarchy_panel_docked_width; // width of hierarchy tree panel and pane when docked
int hierarchy_panel_docked_height; // height of hierarchy tree panel and pane when docked
int hierarchy_panel_float_width; // width of hierarchy tree panel when floating
int hierarchy_panel_float_height; // height of hierarchy tree panel when floating
2023-05-15 01:35:39 +00:00
int search_panel_height; // height of the search panel
int search_panel_width; // width of the search panel
int search_panel_dock_direction; // docking direction of the search panel
bool schematic_hierarchy_float; // show hierarchy tree panel as floating
bool show_schematic_hierarchy; // show hierarchy tree pane
2023-05-15 01:35:39 +00:00
bool show_search; // show the search panel
wxSize net_nav_panel_docked_size;
wxPoint net_nav_panel_float_pos;
wxSize net_nav_panel_float_size;
bool float_net_nav_panel;
bool show_net_nav_panel;
int properties_panel_width;
float properties_splitter;
bool show_properties;
};
struct AUTOPLACE_FIELDS
{
bool enable;
bool allow_rejustify;
bool align_to_grid;
};
struct BOM_PLUGIN_SETTINGS
{
BOM_PLUGIN_SETTINGS() = default;
BOM_PLUGIN_SETTINGS( const wxString& aName, const wxString& aPath ) :
name( aName ),
path( aPath )
{}
wxString name;
wxString path;
wxString command;
};
struct NETLIST_PLUGIN_SETTINGS
{
NETLIST_PLUGIN_SETTINGS() = default;
NETLIST_PLUGIN_SETTINGS( const wxString& aName, const wxString& aPath ) :
name( aName ),
path( aPath )
{}
wxString name;
wxString path;
wxString command;
};
struct DRAWING
{
int default_bus_thickness;
int default_junction_size;
int default_line_thickness;
int default_repeat_offset_x;
int default_repeat_offset_y;
int default_wire_thickness;
int default_text_size;
int pin_symbol_size;
double text_offset_ratio;
COLOR4D default_sheet_border_color;
COLOR4D default_sheet_background_color;
wxString field_names;
int line_mode;
int repeat_label_increment;
bool intersheets_ref_show;
bool intersheets_ref_own_page;
bool intersheets_ref_short;
wxString intersheets_ref_prefix;
wxString intersheets_ref_suffix;
bool auto_start_wires;
std::vector<double> junction_size_mult_list;
// Pulldown index for user default junction dot size (e.g. smallest = 0, small = 1, etc)
int junction_size_choice;
};
struct INPUT
{
bool drag_is_move;
bool esc_clears_net_highlight;
};
struct SELECTION
{
int selection_thickness;
int highlight_thickness;
bool draw_selected_children;
bool fill_shapes;
};
struct PAGE_SETTINGS
{
bool export_paper;
bool export_revision;
bool export_date;
bool export_title;
bool export_company;
bool export_comment1;
bool export_comment2;
bool export_comment3;
bool export_comment4;
bool export_comment5;
bool export_comment6;
bool export_comment7;
bool export_comment8;
bool export_comment9;
};
struct PANEL_ANNOTATE
{
2022-03-30 17:41:40 +00:00
bool automatic;
bool recursive;
int scope;
int options;
int method;
int messages_filter;
int sort_order;
};
struct PANEL_BOM
{
wxString selected_plugin;
std::vector<BOM_PLUGIN_SETTINGS> plugins;
};
struct PANEL_FIELD_EDITOR
{
2023-03-15 00:03:57 +00:00
std::map<std::string, int> field_widths;
int width;
int height;
int page;
wxString export_filename;
int selection_mode;
int scope;
};
struct PANEL_LIB_VIEW
{
int lib_list_width;
int cmp_list_width;
bool show_pin_electrical_type;
bool show_pin_numbers;
WINDOW_SETTINGS window;
};
struct PANEL_NETLIST
{
std::vector<NETLIST_PLUGIN_SETTINGS> plugins;
};
struct PANEL_PLOT
{
bool background_color;
bool color;
wxString color_theme;
int format;
bool frame_reference;
int hpgl_paper_size;
double hpgl_pen_size;
int hpgl_origin;
bool pdf_property_popups;
bool pdf_metadata;
bool open_file_after_plot;
};
struct PANEL_SYM_CHOOSER
{
int sash_pos_h;
int sash_pos_v;
int width;
int height;
int sort_mode;
bool keep_symbol;
bool place_all_units;
};
struct DIALOG_IMPORT_GRAPHICS
{
bool interactive_placement;
wxString last_file;
double dxf_line_width;
int dxf_line_width_units;
int origin_units;
double origin_x;
double origin_y;
int dxf_units;
};
struct SIMULATOR
{
Horizontal/vertical zoom for Simulator plots ADDED: Horizontal/vertical zoom for simulator plots, via mouse wheel, toolbar buttons, menu commands, and hotkeys. ADDED: Simulator preferences panel, populated with mouse wheel and trackpad settings that control pan and zoom of simulator plots. ADDED: Zoom In/Out Horizontally/Vertically commands that can be bound to hotkeys. CHANGED: Simulator plot scroll wheel gestures are no longer hard-coded and can now be configured via the new Simulator preferences panel. Fixes https://gitlab.com/kicad/code/kicad/-/issues/16597 Other unreported bugs that were fixed: - Fixed wierd, jumpy simulator plot view limiting behavior. - Fixed Zoom In Center and Zoom Out Center commands not preserving the simulator plot center point. - Fixed simulator plot nudging when exported as PNGs. - Fixed rectangular selection zoom being able to exceed simulator plot view limits. Notes: - Provided new SIM_PREFERENCES struct to be used for future simulator preferences set via the simulator preferences dialog. - Bundled pre-existing EESCHEMA_SETTINGS::SIMULATOR settings into EESCHEMA_SETTINGS::SIMULATOR::VIEW. - Replaced mpWindow::EnableMouseWheelPan with more general SetMouseWheelActions. - Refactored and tidied up wxMathPlot's mpWindow code involved with fitting, zooming, and panning. - Consolidated long lists of duplicated member variable initializers to a new mpWindow private delegated constructor. - Provided provisional Zoom In/Out Horizontally/Vertically toolbar icons that need improvement by a graphics designer. - Provided gitignore entries for the Qt Creator IDE
2024-01-23 01:02:50 +00:00
struct VIEW
{
int plot_panel_width;
int plot_panel_height;
int signal_panel_height;
int cursors_panel_height;
int measurements_panel_height;
Horizontal/vertical zoom for Simulator plots ADDED: Horizontal/vertical zoom for simulator plots, via mouse wheel, toolbar buttons, menu commands, and hotkeys. ADDED: Simulator preferences panel, populated with mouse wheel and trackpad settings that control pan and zoom of simulator plots. ADDED: Zoom In/Out Horizontally/Vertically commands that can be bound to hotkeys. CHANGED: Simulator plot scroll wheel gestures are no longer hard-coded and can now be configured via the new Simulator preferences panel. Fixes https://gitlab.com/kicad/code/kicad/-/issues/16597 Other unreported bugs that were fixed: - Fixed wierd, jumpy simulator plot view limiting behavior. - Fixed Zoom In Center and Zoom Out Center commands not preserving the simulator plot center point. - Fixed simulator plot nudging when exported as PNGs. - Fixed rectangular selection zoom being able to exceed simulator plot view limits. Notes: - Provided new SIM_PREFERENCES struct to be used for future simulator preferences set via the simulator preferences dialog. - Bundled pre-existing EESCHEMA_SETTINGS::SIMULATOR settings into EESCHEMA_SETTINGS::SIMULATOR::VIEW. - Replaced mpWindow::EnableMouseWheelPan with more general SetMouseWheelActions. - Refactored and tidied up wxMathPlot's mpWindow code involved with fitting, zooming, and panning. - Consolidated long lists of duplicated member variable initializers to a new mpWindow private delegated constructor. - Provided provisional Zoom In/Out Horizontally/Vertically toolbar icons that need improvement by a graphics designer. - Provided gitignore entries for the Qt Creator IDE
2024-01-23 01:02:50 +00:00
bool white_background;
};
VIEW view;
WINDOW_SETTINGS window;
Horizontal/vertical zoom for Simulator plots ADDED: Horizontal/vertical zoom for simulator plots, via mouse wheel, toolbar buttons, menu commands, and hotkeys. ADDED: Simulator preferences panel, populated with mouse wheel and trackpad settings that control pan and zoom of simulator plots. ADDED: Zoom In/Out Horizontally/Vertically commands that can be bound to hotkeys. CHANGED: Simulator plot scroll wheel gestures are no longer hard-coded and can now be configured via the new Simulator preferences panel. Fixes https://gitlab.com/kicad/code/kicad/-/issues/16597 Other unreported bugs that were fixed: - Fixed wierd, jumpy simulator plot view limiting behavior. - Fixed Zoom In Center and Zoom Out Center commands not preserving the simulator plot center point. - Fixed simulator plot nudging when exported as PNGs. - Fixed rectangular selection zoom being able to exceed simulator plot view limits. Notes: - Provided new SIM_PREFERENCES struct to be used for future simulator preferences set via the simulator preferences dialog. - Bundled pre-existing EESCHEMA_SETTINGS::SIMULATOR settings into EESCHEMA_SETTINGS::SIMULATOR::VIEW. - Replaced mpWindow::EnableMouseWheelPan with more general SetMouseWheelActions. - Refactored and tidied up wxMathPlot's mpWindow code involved with fitting, zooming, and panning. - Consolidated long lists of duplicated member variable initializers to a new mpWindow private delegated constructor. - Provided provisional Zoom In/Out Horizontally/Vertically toolbar icons that need improvement by a graphics designer. - Provided gitignore entries for the Qt Creator IDE
2024-01-23 01:02:50 +00:00
SIM_PREFERENCES preferences;
};
struct FIND_REPLACE_EXTRA
{
bool search_all_fields;
bool search_all_pins;
bool search_current_sheet_only;
bool search_selected_only;
bool replace_references;
};
EESCHEMA_SETTINGS();
virtual ~EESCHEMA_SETTINGS() {}
virtual bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override;
static std::vector<BOM_PLUGIN_SETTINGS> DefaultBomPlugins();
2021-03-25 14:07:16 +00:00
protected:
virtual std::string getLegacyFrameName() const override { return "SchematicFrame"; }
private:
bool migrateBomSettings();
nlohmann::json bomSettingsToJson() const;
static std::vector<BOM_PLUGIN_SETTINGS> bomSettingsFromJson( const nlohmann::json& aObj );
nlohmann::json netlistSettingsToJson() const;
static std::vector<NETLIST_PLUGIN_SETTINGS> netlistSettingsFromJson( const nlohmann::json& aObj );
2021-03-25 14:07:16 +00:00
public:
APPEARANCE m_Appearance;
AUTOPLACE_FIELDS m_AutoplaceFields;
AUI_PANELS m_AuiPanels;
DRAWING m_Drawing;
FIND_REPLACE_EXTRA m_FindReplaceExtra;
INPUT m_Input;
PAGE_SETTINGS m_PageSettings;
PANEL_ANNOTATE m_AnnotatePanel;
PANEL_BOM m_BomPanel;
PANEL_FIELD_EDITOR m_FieldEditorPanel;
PANEL_LIB_VIEW m_LibViewPanel;
PANEL_NETLIST m_NetlistPanel;
PANEL_PLOT m_PlotPanel;
PANEL_SYM_CHOOSER m_SymChooserPanel;
DIALOG_IMPORT_GRAPHICS m_ImportGraphics;
SELECTION m_Selection;
SIMULATOR m_Simulator;
bool m_RescueNeverShow;
wxString m_lastSymbolLibDir;
};
#endif