64 m_titleBlock( nullptr ),
65 m_drawingSheet( nullptr ),
76 if( current->GetFilename() != app_settings->
m_ColorTheme )
112 item->SetParent(
nullptr );
150 wxString msg =
_(
"Some items have the same color as the background\n"
151 "and they will not be seen on the screen. Are you\n"
152 "sure you want to use these colors?" );
154 if( wxMessageBox( msg,
_(
"Warning" ), wxYES_NO | wxICON_QUESTION,
155 wxGetTopLevelParent(
this ) ) == wxNO )
177 color.Darken( 0.01 );
189 std::vector<SCH_LAYER_ID> layers;
196 layers.push_back( i );
199 std::sort( layers.begin(), layers.end(),
202 return LayerName( a ) < LayerName( b );
205 for(
int layer : layers )
210 name += wxS(
" " ) +
_(
"(symbol editor only)" );
218 const int margin = 20;
224 m_preview->ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_NEVER );
251 std::vector<DANGLING_END_ITEM> endPointsByType;
268 auto addItem = [&](
EDA_ITEM* aItem )
274 std::vector<std::pair<SCH_LAYER_ID, std::pair<VECTOR2I, VECTOR2I>>> lines = {
275 {
LAYER_WIRE, { { 1950, 1500 }, { 2325, 1500 } } },
276 {
LAYER_WIRE, { { 1950, 2600 }, { 2350, 2600 } } },
277 {
LAYER_WIRE, { { 2150, 1700 }, { 2325, 1700 } } },
278 {
LAYER_WIRE, { { 2150, 2000 }, { 2150, 1700 } } },
279 {
LAYER_WIRE, { { 2925, 1600 }, { 3075, 1600 } } },
280 {
LAYER_WIRE, { { 3075, 1600 }, { 3075, 2000 } } },
281 {
LAYER_WIRE, { { 3075, 1600 }, { 3250, 1600 } } },
282 {
LAYER_WIRE, { { 3075, 2000 }, { 2150, 2000 } } },
283 {
LAYER_BUS, { { 1750, 1300 }, { 1850, 1300 } } },
284 {
LAYER_BUS, { { 1850, 2500 }, { 1850, 1300 } } },
285 {
LAYER_NOTES, { { 2350, 2125 }, { 2350, 2300 } } },
286 {
LAYER_NOTES, { { 2350, 2125 }, { 2950, 2125 } } },
287 {
LAYER_NOTES, { { 2950, 2125 }, { 2950, 2300 } } },
288 {
LAYER_NOTES, { { 2950, 2300 }, { 2350, 2300 } } }
291 for(
const std::pair<
SCH_LAYER_ID, std::pair<VECTOR2I, VECTOR2I>>& line : lines )
316#define MILS_POINT( x, y ) VECTOR2I( schIUScale.MilsToIU( x ), schIUScale.MilsToIU( y ) )
359 auto mapLibItemPosition =
363 return VECTOR2I( aLibPosition.x, aLibPosition.y );
377 value.
SetText( wxT(
"OPA604" ) );
391 comp_body->
SetFillMode( FILL_T::FILLED_WITH_BG_BODYCOLOR );
397 addItem( comp_body );
403 pin->SetOrientation( PIN_ORIENTATION::PIN_RIGHT );
404 pin->SetType( ELECTRICAL_PINTYPE::PT_INPUT );
405 pin->SetNumber( wxT(
"1" ) );
406 pin->SetName( wxT(
"-" ) );
410 endPointsByType.emplace_back(
PIN_END,
pin, mapLibItemPosition(
pin->GetPosition() ) );
417 pin->SetOrientation( PIN_ORIENTATION::PIN_RIGHT );
418 pin->SetType( ELECTRICAL_PINTYPE::PT_INPUT );
419 pin->SetNumber( wxT(
"2" ) );
420 pin->SetName( wxT(
"+" ) );
424 endPointsByType.emplace_back(
PIN_END,
pin, mapLibItemPosition(
pin->GetPosition() ) );
431 pin->SetOrientation( PIN_ORIENTATION::PIN_LEFT );
432 pin->SetType( ELECTRICAL_PINTYPE::PT_OUTPUT );
433 pin->SetNumber( wxT(
"3" ) );
434 pin->SetName( wxT(
"OUT" ) );
438 endPointsByType.emplace_back(
PIN_END,
pin, mapLibItemPosition(
pin->GetPosition() ) );
467 std::vector<DANGLING_END_ITEM> endPointsByPos = endPointsByType;
522 double scale = view->
GetScale() / std::max( fabs( psize.
x / screenSize.
x ),
523 fabs( psize.
y / screenSize.
y ) );
constexpr EDA_IU_SCALE schIUScale
wxString m_ColorTheme
Active color theme name.
constexpr Vec Centre() const
Color settings are a bit different than most of the settings objects in that there can be more than o...
void SetColor(int aLayer, const COLOR4D &aColor)
bool GetOverrideSchItemColors() const
COLOR4D GetColor(int aLayer) const
void SetOverrideSchItemColors(bool aFlag)
static void sort_dangling_end_items(std::vector< DANGLING_END_ITEM > &aItemListByType, std::vector< DANGLING_END_ITEM > &aItemListByPos)
Both contain the same information.
const BOX2I ViewBBox() const override
void SetPageBorderColorLayer(int aLayerId)
Overrides the layer used to pick the color of the page border (normally LAYER_GRID)
void SetColorLayer(int aLayerId)
Can be used to override which layer ID is used for drawing sheet item colors.
virtual KIGFX::VIEW * GetView() const
Return a pointer to the #VIEW instance used in the panel.
void ForceRefresh()
Force a redraw.
KIGFX::GAL * GetGAL() const
Return a pointer to the GAL instance used in the panel.
void SetStealsFocus(bool aStealsFocus)
Set whether focus is taken on certain events (mouseover, keys, etc).
A base class for most all the KiCad significant classes used in schematics and boards.
virtual void SetParent(EDA_ITEM *aParent)
void SetFillMode(FILL_T aFill)
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
void ReadConfig(COMMON_SETTINGS &aCommonConfig, WINDOW_SETTINGS &aWindowConfig, wxWindow *aWindow)
Read application and common configs.
wxString GetFilename() const
A color representation with 4 components: red, green, blue, alpha.
bool m_forceDisplayCursor
The pixel scale factor (>1 for hi-DPI scaled displays)
void SetAxesEnabled(bool aAxesEnabled)
Enable drawing the axes.
void SetClearColor(const COLOR4D &aColor)
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Set the scaling factor, zooming around a given anchor point.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Define a library symbol object.
SCH_FIELD & GetValueField() const
Return reference to the value field.
SCH_FIELD & GetReferenceField() const
Return reference to the reference designator field.
void AddDrawItem(SCH_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
Describe the page size and margins of a paper page on which to eventually print or plot.
int GetHeightIU(double aIUScale) const
Gets the page height in IU.
static const wxChar Custom[]
"User" defined page type
void SetHeightMils(double aHeightInMils)
int GetWidthIU(double aIUScale) const
Gets the page width in IU.
void SetWidthMils(double aWidthInMils)
wxCheckBox * m_optOverrideColors
wxBoxSizer * m_colorsMainSizer
wxFlexGridSizer * m_colorsGridSizer
wxScrolledWindow * m_colorsListWindow
void createThemeList(const wxString &aCurrent)
Builds the theme listbox and sets the selection to the current theme.
void createSwatch(int aLayer, const wxString &aName)
std::vector< int > m_validLayers
A list of layer IDs that are valid for the current color settings dialog.
virtual bool saveCurrentTheme(bool aValidate)
std::string m_colorNamespace
A namespace that will be passed to SETTINGS_MANAGER::SaveColorSettings.
virtual void ResetPanel() override
Reset the contents of this panel.
std::map< int, wxStaticText * > m_labels
COLOR_SETTINGS * m_currentSettings
std::map< int, COLOR_SWATCH * > m_swatches
TITLE_BLOCK * m_titleBlock
bool saveCurrentTheme(bool aValidate) override
PANEL_EESCHEMA_COLOR_SETTINGS(wxWindow *aParent)
void onNewThemeSelected() override
Event fired when a new theme is selected that can be overridden in children.
void OnOverrideItemColorsClicked(wxCommandEvent &aEvent) override
bool validateSave(bool aQuiet=false) override
Performs a pre-save validation of the current color theme.
void ResetPanel() override
Reset the contents of this panel.
GAL_DISPLAY_OPTIONS_IMPL m_galDisplayOptions
void OnSize(wxSizeEvent &aEvent) override
DS_PROXY_VIEW_ITEM * m_drawingSheet
void createPreviewItems()
~PANEL_EESCHEMA_COLOR_SETTINGS() override
void updateAllowedSwatches()
EDA_DRAW_PANEL_GAL::GAL_TYPE m_galType
void onColorChanged() override
Event fired when the user changes any color.
SCH_PREVIEW_PANEL * m_preview
void createSwatches() override
bool TransferDataToWindow() override
bool TransferDataFromWindow() override
std::vector< EDA_ITEM * > m_previewItems
virtual COMMON_SETTINGS * GetCommonSettings() const
virtual SETTINGS_MANAGER & GetSettingsManager() const
void SetPosition(const VECTOR2I &aPosition) override
Class for a wire to bus entry.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
void SetPosition(const VECTOR2I &aPosition) override
void SetText(const wxString &aText) override
void SetSpinStyle(SPIN_STYLE aSpinStyle) override
void SetSpinStyle(SPIN_STYLE aSpinStyle) override
Base class for any item which can be embedded within the SCHEMATIC container class,...
virtual void SetBodyStyle(int aBodyStyle)
virtual bool IsConnectable() const
virtual void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList)
Add the schematic item end points to aItemList if the item has end points.
virtual bool UpdateDanglingState(std::vector< DANGLING_END_ITEM > &aItemListByType, std::vector< DANGLING_END_ITEM > &aItemListByPos, const SCH_SHEET_PATH *aSheet=nullptr)
Test the schematic item to aItemList to check if it's dangling state has changed.
void SetLayer(SCH_LAYER_ID aLayer)
virtual void SetUnit(int aUnit)
virtual void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual)
void SetIsDangling(bool aIsDangling)
virtual void SetSpinStyle(SPIN_STYLE aSpinStyle)
Segment description base class to describe items which have 2 end points (track, wire,...
void SetStartPoint(const VECTOR2I &aPosition)
virtual STROKE_PARAMS GetStroke() const override
virtual void SetStroke(const STROKE_PARAMS &aStroke) override
void SetEndPoint(const VECTOR2I &aPosition)
void SetPosition(const VECTOR2I &aPosition) override
void Refresh(bool aEraseBackground, const wxRect *aRect) override
SCH_RENDER_SETTINGS * GetRenderSettings() const
void LoadColors(const COLOR_SETTINGS *aSettings) override
void SetStroke(const STROKE_PARAMS &aStroke) override
void AddPoint(const VECTOR2I &aPosition)
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
std::vector< SCH_FIELD > & GetFields()
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
T * GetAppSettings(const wxString &aFilename)
Returns a handle to the a given settings by type If the settings have already been loaded,...
Simple container to manage line stroke parameters.
void SetLineStyle(LINE_STYLE aLineStyle)
void SetWidth(int aWidth)
virtual void SetShowPinNumbers(bool aShow)
Set or clear the pin number visibility flag.
virtual void SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
void SetPinNameOffset(int aOffset)
Set the offset in mils of the pin name text from the pin symbol.
Hold the information shown in the lower right corner of a plot, printout, or editing view.
void SetTitle(const wxString &aTitle)
void SetDate(const wxString &aDate)
Set the date field, and defaults to the current time and date.
wxString LayerName(int aLayer)
Returns the default display name for a given layer.
SCH_LAYER_ID
Eeschema drawing layers.
@ LAYER_NET_COLOR_HIGHLIGHT
@ LAYER_SCHEMATIC_DRAWINGSHEET
@ LAYER_SCHEMATIC_GRID_AXES
@ LAYER_SCHEMATIC_PAGE_LIMITS
@ LAYER_SCHEMATIC_BACKGROUND
@ COLOR
Color has changed.
std::set< int > g_excludedLayers
PGM_BASE & Pgm()
The global Program "get" accessor.
constexpr int MilsToIU(int mils) const
VECTOR2< int32_t > VECTOR2I
VECTOR2D ToVECTOR2D(const wxPoint &aPoint)