47 #include <wx/msgdlg.h> 62 m_titleBlock( nullptr ),
63 m_drawingSheet( nullptr ),
77 if( current->GetFilename() != app_settings->
m_ColorTheme )
106 m_preview->ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_NEVER );
164 wxString msg =
_(
"Some items have the same color as the background\n" 165 "and they will not be seen on the screen. Are you\n" 166 "sure you want to use these colors?" );
168 if( wxMessageBox( msg,
_(
"Warning" ), wxYES_NO | wxICON_QUESTION,
this ) == wxNO )
190 color.Darken( 0.01 );
202 std::vector<SCH_LAYER_ID> layers;
209 layers.push_back( i );
213 std::sort( layers.begin(), layers.end(),
219 for(
int layer : layers )
224 name += wxS(
" " ) +
_(
"(symbol editor only)" );
232 const int margin = 20;
247 std::vector<DANGLING_END_ITEM> endPoints;
264 auto addItem = [&](
EDA_ITEM* aItem )
270 std::vector<std::pair<SCH_LAYER_ID, std::pair<wxPoint, wxPoint>>> lines = {
271 {
LAYER_WIRE, { { 1950, 1500 }, { 2325, 1500 } } },
272 {
LAYER_WIRE, { { 1950, 2600 }, { 2350, 2600 } } },
273 {
LAYER_WIRE, { { 2150, 1700 }, { 2325, 1700 } } },
274 {
LAYER_WIRE, { { 2150, 2000 }, { 2150, 1700 } } },
275 {
LAYER_WIRE, { { 2925, 1600 }, { 3075, 1600 } } },
276 {
LAYER_WIRE, { { 3075, 1600 }, { 3075, 2000 } } },
277 {
LAYER_WIRE, { { 3075, 1600 }, { 3250, 1600 } } },
278 {
LAYER_WIRE, { { 3075, 2000 }, { 2150, 2000 } } },
279 {
LAYER_BUS, { { 1750, 1400 }, { 1850, 1400 } } },
280 {
LAYER_BUS, { { 1850, 2500 }, { 1850, 1400 } } },
281 {
LAYER_NOTES, { { 2350, 2125 }, { 2350, 2300 } } },
282 {
LAYER_NOTES, { { 2350, 2125 }, { 2950, 2125 } } },
283 {
LAYER_NOTES, { { 2950, 2125 }, { 2950, 2300 } } },
284 {
LAYER_NOTES, { { 2950, 2300 }, { 2350, 2300 } } }
287 for(
const std::pair<
SCH_LAYER_ID, std::pair<wxPoint, wxPoint>>& line : lines )
305 wire->
SetStartPoint( wxPoint( Mils2iu( line.second.first.x ),
306 Mils2iu( line.second.first.y ) ) );
307 wire->
SetEndPoint( wxPoint( Mils2iu( line.second.second.x ),
308 Mils2iu( line.second.second.y ) ) );
312 #define MILS_POINT( x, y ) wxPoint( Mils2iu( x ), Mils2iu( y ) ) 356 auto mapLibItemPosition =
357 [](
const wxPoint& aLibPosition ) -> wxPoint
359 return wxPoint( aLibPosition.x, -aLibPosition.y );
363 wxPoint p( 2625, -1600 );
373 value.
SetText( wxT(
"OPA604" ) );
385 comp_body->
SetWidth( Mils2iu( 10 ) );
392 addItem( comp_body );
397 pin->SetLength( Mils2iu( 100 ) );
400 pin->SetNumber( wxT(
"1" ) );
401 pin->SetName( wxT(
"-" ) );
403 endPoints.emplace_back(
PIN_END,
pin, mapLibItemPosition(
pin->GetPosition() ) );
409 pin->SetLength( Mils2iu( 100 ) );
412 pin->SetNumber( wxT(
"2" ) );
413 pin->SetName( wxT(
"+" ) );
415 endPoints.emplace_back(
PIN_END,
pin, mapLibItemPosition(
pin->GetPosition() ) );
421 pin->SetLength( Mils2iu( 100 ) );
424 pin->SetNumber( wxT(
"3" ) );
425 pin->SetName( wxT(
"OUT" ) );
427 endPoints.emplace_back(
PIN_END,
pin, mapLibItemPosition(
pin->GetPosition() ) );
434 s->
SetSize( wxSize( Mils2iu( 800 ), Mils2iu( 1300 ) ) );
445 SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( item );
456 SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( item );
504 double scale = view->
GetScale() / std::max( fabs( psize.x / screenSize.
x ),
505 fabs( psize.y / screenSize.
y ) );
bool TransferDataFromWindow() override
void ResetPanel() override
Reset the contents of this panel.
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void SetPinNameOffset(int aOffset)
Set the offset in mils of the pin name text from the pin symbol.
void SetClearColor(const COLOR4D &aColor)
void AddPoint(const wxPoint &aPosition)
void SetWidth(int aWidth)
virtual bool IsConnectable() const
void ForceRefresh()
Force a redraw.
virtual bool saveCurrentTheme(bool aValidate)
void createPreviewItems()
wxCheckBox * m_optOverrideColors
void SetColorLayer(int aLayerId)
Can be used to override which layer ID is used for drawing sheet item colors.
virtual void ResetPanel() override
Reset the contents of this panel.
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
virtual void GetEndPoints(std::vector< DANGLING_END_ITEM > &aItemList)
Add the schematic item end points to aItemList if the item has end points.
wxString GetFilename() const
Field object used in symbol libraries.
std::map< int, wxStaticText * > m_labels
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
void SetPosition(const wxPoint &aPosition) override
void SetColor(int aLayer, const COLOR4D &aColor)
void SetDate(const wxString &aDate)
Set the date field, and defaults to the current time and date.
void SetPlotStyle(PLOT_DASH_TYPE aPlotStyle)
static const wxChar Custom[]
"User" defined page type
std::map< int, COLOR_SWATCH * > m_swatches
LIB_FIELD & GetValueField()
Return reference to the value field.
bool m_forceDisplayCursor
The pixel scale factor (>1 for hi-DPI scaled displays)
void SetIsDangling(bool aIsDangling)
void OnSize(wxSizeEvent &aEvent) override
wxFlexGridSizer * m_colorsGridSizer
bool validateSave(bool aQuiet=false) override
Performs a pre-save validation of the current color theme.
Define a library symbol object.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
wxScrolledWindow * m_colorsListWindow
Hold the information shown in the lower right corner of a plot, printout, or editing view.
LIB_FIELD & GetReferenceField()
Return reference to the reference designator field.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
void SetEndPoint(const wxPoint &aPosition)
std::string m_colorNamespace
A namespace that will be passed to SETTINGS_MANAGER::SaveColorSettings.
virtual bool UpdateDanglingState(std::vector< DANGLING_END_ITEM > &aItemList, const SCH_SHEET_PATH *aPath=nullptr)
Test the schematic item to aItemList to check if it's dangling state has changed.
bool saveCurrentTheme(bool aValidate) override
void onNewThemeSelected() override
Event fired when a new theme is selected that can be overridden in children.
std::vector< SCH_FIELD > & GetFields()
void SetShowPinNames(bool aShow)
Set or clear the pin name visibility flag.
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
virtual void SetText(const wxString &aText)
SCH_LAYER_ID
Eeschema drawing layers.
void onColorChanged() override
Event fired when the user changes any color.
void SetPosition(const wxPoint &aPosition) override
PANEL_EESCHEMA_COLOR_SETTINGS(SCH_BASE_FRAME *aFrame, wxWindow *aParent)
SCH_PREVIEW_PANEL * m_preview
Describe the page size and margins of a paper page on which to eventually print or plot.
void createThemeList(const wxString &aCurrent)
Builds the theme listbox and sets the selection to the current theme.
virtual void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual)
COLOR_SETTINGS * m_currentSettings
void SetStartPoint(const wxPoint &aPosition)
void SetLayer(SCH_LAYER_ID aLayer)
Set the layer this item is on.
void SetOverrideSchItemColors(bool aFlag)
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
~PANEL_EESCHEMA_COLOR_SETTINGS() override
void SetStealsFocus(bool aStealsFocus)
Set whether focus is taken on certain events (mouseover, keys, etc).
T * GetAppSettings(bool aLoadNow=true)
Returns a handle to the a given settings by type If the settings have already been loaded,...
std::vector< EDA_ITEM * > m_previewItems
void SetLabelSpinStyle(LABEL_SPIN_STYLE aSpinStyle) override
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
KIGFX::GAL * GetGAL() const
Return a pointer to the GAL instance used in the panel.
virtual KIGFX::VIEW * GetView() const
Return a pointer to the #VIEW instance used in the panel.
wxBoxSizer * m_colorsMainSizer
wxString LayerName(int aLayer)
Returns the default display name for a given layer.
void SetWidth(int aWidth)
void AddDrawItem(LIB_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
Define a sheet pin (label) used in sheets to create hierarchical schematics.
void SetTitle(const wxString &aTitle)
void SetAxesEnabled(bool aAxesEnabled)
Enable drawing the axes.
TITLE_BLOCK * m_titleBlock
void SetHeightMils(int aHeightInMils)
std::vector< int > m_validLayers
A list of layer IDs that are valid for the current color settings dialog.
bool TransferDataToWindow() override
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
void SetSize(const wxSize &aSize)
void SetConvert(int aConvert)
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Set the scaling factor, zooming around a given anchor point.
void OnOverrideItemColorsClicked(wxCommandEvent &aEvent) override
std::set< int > g_excludedLayers
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
COLOR4D GetColor(int aLayer) const
void ReloadColorSettings()
Re-scans the color themes directory, reloading any changes it finds.
virtual void SetStroke(const STROKE_PARAMS &aStroke) override
const BOX2I ViewBBox() const override
Segment description base class to describe items which have 2 end points (track, wire,...
void SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
Simple container to manage line stroke parameters.
usual pin input: must be connected
void SetWidthMils(int aWidthInMils)
void ReadConfig(COMMON_SETTINGS &aCommonConfig, WINDOW_SETTINGS &aWindowConfig, wxWindow *aWindow)
Read application and common configs.
void SetShowPinNumbers(bool aShow)
Set or clear the pin number visibility flag.
A base class for most all the KiCad significant classes used in schematics and boards.
virtual STROKE_PARAMS GetStroke() const override
Class for a wire to bus entry.
Color settings are a bit different than most of the settings objects in that there can be more than o...
void SetPosition(const wxPoint &aPosition) override
bool GetOverrideSchItemColors() const
void SetFillMode(FILL_T aFill)
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
void SetLabelSpinStyle(LABEL_SPIN_STYLE aSpinStyle) override
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual) override
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
virtual void SetLabelSpinStyle(LABEL_SPIN_STYLE aSpinStyle)
Set a spin or rotation angle, along with specific horizontal and vertical justification styles with e...
void Refresh(bool aEraseBackground, const wxRect *aRect) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
virtual void LoadColors(const COLOR_SETTINGS *aSettings)
void createSwatch(int aLayer, const wxString &aName)
KIGFX::GAL_DISPLAY_OPTIONS m_galDisplayOptions
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
Base class for any item which can be embedded within the SCHEMATIC container class,...
DS_PROXY_VIEW_ITEM * m_drawingSheet
wxString m_ColorTheme
Active color theme name.
A color representation with 4 components: red, green, blue, alpha.