2020-07-07 01:53:12 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
|
2021-01-25 12:42:36 +00:00
|
|
|
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2020-07-07 01:53:12 +00:00
|
|
|
*
|
|
|
|
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2020-07-11 17:40:23 +00:00
|
|
|
#ifndef KICAD_BOARD_PROJECT_SETTINGS_H
|
|
|
|
#define KICAD_BOARD_PROJECT_SETTINGS_H
|
|
|
|
|
|
|
|
#include <layers_id_colors_and_visibility.h>
|
2020-09-30 03:29:58 +00:00
|
|
|
#include <settings/parameters.h>
|
2020-07-11 17:40:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This file contains data structures that are saved in the project file or project local settings
|
|
|
|
* file that are specific to PcbNew. This is done so that these structures are available in common.
|
|
|
|
*/
|
|
|
|
|
2020-07-07 01:53:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Selection filtering that applies all the time (not the "filter selection" dialog that modifies
|
|
|
|
* the current selection)
|
|
|
|
*/
|
|
|
|
struct SELECTION_FILTER_OPTIONS
|
|
|
|
{
|
|
|
|
bool lockedItems; ///< Allow selecting locked items
|
|
|
|
bool footprints; ///< Allow selecting entire footprints
|
|
|
|
bool text; ///< Text (free or attached to a footprint)
|
|
|
|
bool tracks; ///< Copper tracks
|
|
|
|
bool vias; ///< Vias (all types>
|
|
|
|
bool pads; ///< Footprint pads
|
|
|
|
bool graphics; ///< Graphic lines, shapes, polygons
|
|
|
|
bool zones; ///< Copper zones
|
|
|
|
bool keepouts; ///< Keepout zones
|
|
|
|
bool dimensions; ///< Dimension items
|
|
|
|
bool otherItems; ///< Anything not fitting one of the above categories
|
|
|
|
|
|
|
|
SELECTION_FILTER_OPTIONS()
|
|
|
|
{
|
|
|
|
lockedItems = true;
|
|
|
|
footprints = true;
|
|
|
|
text = true;
|
|
|
|
tracks = true;
|
|
|
|
vias = true;
|
|
|
|
pads = true;
|
|
|
|
graphics = true;
|
|
|
|
zones = true;
|
|
|
|
keepouts = true;
|
|
|
|
dimensions = true;
|
|
|
|
otherItems = true;
|
|
|
|
}
|
|
|
|
|
2020-09-28 23:58:08 +00:00
|
|
|
/**
|
|
|
|
* @return true if any of the item types are enabled (excluding "locked items" which is special)
|
|
|
|
*/
|
2020-07-07 01:53:12 +00:00
|
|
|
bool Any()
|
|
|
|
{
|
2020-09-28 23:58:08 +00:00
|
|
|
return ( footprints || text || tracks || vias || pads || graphics || zones
|
2020-07-07 01:53:12 +00:00
|
|
|
|| keepouts || dimensions || otherItems );
|
|
|
|
}
|
|
|
|
|
2020-09-28 23:58:08 +00:00
|
|
|
/**
|
|
|
|
* @return true if all the item types are enabled (excluding "locked items" which is special)
|
|
|
|
*/
|
2020-07-07 01:53:12 +00:00
|
|
|
bool All()
|
|
|
|
{
|
2020-09-28 23:58:08 +00:00
|
|
|
return ( footprints && text && tracks && vias && pads && graphics && zones
|
2020-07-07 01:53:12 +00:00
|
|
|
&& keepouts && dimensions && otherItems );
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-07-11 17:40:23 +00:00
|
|
|
/**
|
2021-01-25 12:42:36 +00:00
|
|
|
* Determine how inactive layers should be displayed.
|
2020-07-11 17:42:00 +00:00
|
|
|
*/
|
2020-07-11 17:40:23 +00:00
|
|
|
enum class HIGH_CONTRAST_MODE
|
|
|
|
{
|
2021-04-03 09:30:38 +00:00
|
|
|
NORMAL = 0, ///< Inactive layers are shown normally (no high-contrast mode)
|
|
|
|
DIMMED, ///< Inactive layers are dimmed (old high-contrast mode)
|
|
|
|
HIDDEN ///< Inactive layers are hidden
|
2020-07-11 17:40:23 +00:00
|
|
|
};
|
|
|
|
|
2021-01-25 12:42:36 +00:00
|
|
|
///< Determine how zones should be displayed.
|
2020-07-11 17:42:00 +00:00
|
|
|
enum class ZONE_DISPLAY_MODE
|
|
|
|
{
|
2020-12-24 00:38:33 +00:00
|
|
|
SHOW_FILLED, ///< Filled polygons are shown
|
|
|
|
SHOW_ZONE_OUTLINE, ///< Only the zone outline is shown
|
|
|
|
SHOW_FILLED_OUTLINE ///< Outlines of filled polygons are shown
|
2020-07-11 17:42:00 +00:00
|
|
|
};
|
|
|
|
|
2021-01-25 12:42:36 +00:00
|
|
|
///< Determine how net color overrides should be applied.
|
2020-07-11 17:42:00 +00:00
|
|
|
enum class NET_COLOR_MODE
|
|
|
|
{
|
|
|
|
OFF, ///< Net (and netclass) colors are not shown
|
|
|
|
RATSNEST, ///< Net/netclass colors are shown on ratsnest lines only
|
|
|
|
ALL ///< Net/netclass colors are shown on all net copper
|
|
|
|
};
|
|
|
|
|
2021-01-25 12:42:36 +00:00
|
|
|
///< Determine how ratsnest lines are drawn.
|
2020-09-07 20:43:31 +00:00
|
|
|
enum class RATSNEST_MODE
|
|
|
|
{
|
|
|
|
ALL, ///< Ratsnest lines are drawn to items on all layers (default)
|
|
|
|
VISIBLE ///< Ratsnest lines are drawn to items on visible layers only
|
|
|
|
};
|
|
|
|
|
2020-07-11 17:40:23 +00:00
|
|
|
/**
|
2021-01-25 12:42:36 +00:00
|
|
|
* A saved set of layers that are visible.
|
2020-07-11 17:40:23 +00:00
|
|
|
*/
|
|
|
|
struct LAYER_PRESET
|
|
|
|
{
|
|
|
|
wxString name; ///< A name for this layer set
|
|
|
|
LSET layers; ///< Board layers that are visible
|
|
|
|
GAL_SET renderLayers; ///< Render layers (e.g. object types) that are visible
|
|
|
|
PCB_LAYER_ID activeLayer; ///< Optional layer to set active when this preset is loaded
|
2020-07-11 17:42:00 +00:00
|
|
|
bool readOnly; ///< True if this is a read-only (built-in) preset
|
2020-07-11 17:40:23 +00:00
|
|
|
|
2020-07-11 17:42:00 +00:00
|
|
|
LAYER_PRESET( const wxString& aName = wxEmptyString ) :
|
2020-07-11 17:40:23 +00:00
|
|
|
name( aName ),
|
|
|
|
activeLayer( UNSELECTED_LAYER )
|
|
|
|
{
|
2020-07-11 17:42:00 +00:00
|
|
|
layers = LSET::AllLayersMask();
|
|
|
|
renderLayers = GAL_SET::DefaultVisible();
|
|
|
|
readOnly = false;
|
2020-07-11 17:40:23 +00:00
|
|
|
}
|
|
|
|
|
2020-07-11 17:42:00 +00:00
|
|
|
LAYER_PRESET( const wxString& aName, const LSET& aVisibleLayers ) :
|
2020-07-11 17:40:23 +00:00
|
|
|
name( aName ),
|
2020-07-11 17:42:00 +00:00
|
|
|
layers( aVisibleLayers ),
|
2020-07-11 17:40:23 +00:00
|
|
|
activeLayer( UNSELECTED_LAYER )
|
|
|
|
{
|
2020-07-11 17:42:00 +00:00
|
|
|
renderLayers = GAL_SET::DefaultVisible();
|
|
|
|
readOnly = false;
|
2020-07-11 17:40:23 +00:00
|
|
|
}
|
|
|
|
|
2020-07-11 17:42:00 +00:00
|
|
|
LAYER_PRESET( const wxString& aName, const LSET& aVisibleLayers, const GAL_SET& aVisibleObjects,
|
|
|
|
PCB_LAYER_ID aActiveLayer ) :
|
2020-07-11 17:40:23 +00:00
|
|
|
name( aName ),
|
2020-07-11 17:42:00 +00:00
|
|
|
layers( aVisibleLayers ),
|
|
|
|
renderLayers( aVisibleObjects ),
|
|
|
|
activeLayer( aActiveLayer )
|
2020-07-11 17:40:23 +00:00
|
|
|
{
|
2020-07-11 17:42:00 +00:00
|
|
|
readOnly = false;
|
2020-07-11 17:40:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool LayersMatch( const LAYER_PRESET& aOther )
|
|
|
|
{
|
|
|
|
return aOther.layers == layers && aOther.renderLayers == renderLayers;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-09-30 03:29:58 +00:00
|
|
|
|
|
|
|
class PARAM_LAYER_PRESET : public PARAM_LAMBDA<nlohmann::json>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PARAM_LAYER_PRESET( const std::string& aPath, std::vector<LAYER_PRESET>* aPresetList );
|
|
|
|
|
|
|
|
private:
|
|
|
|
nlohmann::json presetsToJson();
|
|
|
|
|
|
|
|
void jsonToPresets( const nlohmann::json& aJson );
|
|
|
|
|
|
|
|
std::vector<LAYER_PRESET>* m_presets;
|
|
|
|
};
|
|
|
|
|
2020-07-11 17:40:23 +00:00
|
|
|
#endif // KICAD_BOARD_PROJECT_SETTINGS_H
|