43#include <wx/checkbox.h>
54static void shrinkFont( wxWindow* aControl,
int aPointSize )
56 wxFont font = aControl->GetFont();
57 font.SetPointSize( aPointSize );
58 aControl->SetFont( font );
81 wxWindow* eventSource = (wxWindow*) event.GetEventObject();
95 for( row = 0; row<rowCount; ++row )
97 if( y < height + heights[row] )
100 height += heights[row];
103 if( row >= rowCount )
112 int id = eventSource->GetId();
125 const wxString& aLayerName )
130 _(
"Change Layer Color for" ) + wxS(
" " ) + aLayerName,
131 KiBitmap( BITMAPS::color_materials ) );
132 menu.AppendSeparator();
136 menu.Bind( wxEVT_COMMAND_MENU_SELECTED, [aColorSwatch]( wxCommandEvent& event )
140 aColorSwatch->GetNewSwatchColor();
164 wxPostEvent(
this, event );
172 wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject();
181 const wxString& aRenderName )
186 _(
"Change Render Color for" ) + wxS(
" " )+ aRenderName,
187 KiBitmap( BITMAPS::color_materials ) );
189 menu.Bind( wxEVT_COMMAND_MENU_SELECTED,
190 [aColorSwatch]( wxCommandEvent& event )
242 wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject();
264 if( ndx < m_LayersFlexGridSizer->GetChildren().GetCount() )
275 for(
int row = 0; row < count; ++row )
293 if( (
unsigned) ndx < m_RenderFlexGridSizer->GetChildren().GetCount() )
304 for(
int row = 0; row < count; ++row )
320 wxASSERT( aRow >= 0 );
324 const int flags = wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT;
340 bmb->SetToolTip(
_(
"Left double click or middle click for color change, right click for "
348 cb->SetValue( aSpec.
state );
350 cb->SetToolTip(
_(
"Enable this for visibility" ) );
357 aSpec.
rowName, wxDefaultPosition,
359 wxST_ELLIPSIZE_MIDDLE );
362 st->SetToolTip( aSpec.
tooltip );
373 wxString layerName( aSpec.
rowName );
375 sbm->Bind( wxEVT_RIGHT_DOWN, [
this, bmb, layerName] ( wxMouseEvent& aEvt )
379 bmb->Bind( wxEVT_RIGHT_DOWN, [
this, bmb, layerName] ( wxMouseEvent& aEvt )
383 cb->Bind( wxEVT_RIGHT_DOWN, [
this, bmb, layerName] ( wxMouseEvent& aEvt )
387 st->Bind( wxEVT_RIGHT_DOWN, [
this, bmb, layerName] ( wxMouseEvent& aEvt )
399 label->SetLabel( aName );
415 wxASSERT( aRow >= 0 );
419 const int flags = wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT;
421 wxString renderName( aSpec.
rowName );
422 wxCheckBox* cb =
nullptr;
429 aSpec.
rowName, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
431 cb->SetValue( aSpec.
state );
434 cb->SetToolTip( aSpec.
tooltip );
440 if( aSpec.
color != COLOR4D::UNSPECIFIED )
445 bmb->SetToolTip(
_(
"Left double click or middle click for color change" ) );
448 bmb->Bind( wxEVT_RIGHT_DOWN, [
this, bmb, renderName] ( wxMouseEvent& aEvt ) {
451 cb->Bind( wxEVT_RIGHT_DOWN, [
this, bmb, renderName] ( wxMouseEvent& aEvt ) {
486 const wxPoint& pos,
const wxSize& size,
long style ) :
487 wxPanel( aParent, id, pos, size, style ),
488 m_smallestLayerString( wxT(
"M...M" ) )
490 int indicatorSize = ConvertDialogToPixels( wxSize( 6, 6 ) ).x;
493 int pointSize = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ).GetPointSize();
494 int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
496 if( screenHeight <= 900 && pointSize >= indicatorSize )
497 pointSize = pointSize * 8 / 10;
501 wxBoxSizer* mainSizer =
new wxBoxSizer( wxVERTICAL );
503 m_notebook =
new wxNotebook(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_TOP );
508 font.SetPointSize( pointSize );
514 wxBoxSizer* layerPanelSizer;
515 layerPanelSizer =
new wxBoxSizer( wxVERTICAL );
518 wxDefaultSize, wxNO_BORDER );
539 wxBoxSizer* renderPanelSizer;
540 renderPanelSizer =
new wxBoxSizer( wxVERTICAL );
543 wxDefaultSize, wxNO_BORDER );
561 SetSizer( mainSizer );
586 if( widths.GetCount() )
600 unsigned totHeight = 32;
602 wxSize layerz( totWidth, totHeight );
610 if( widths.GetCount() )
622 wxSize renderz( totWidth, totHeight );
626 wxSize clientz( std::max(renderz.x,layerz.x), std::max(renderz.y,layerz.y) );
726 cb->SetValue( isVisible );
739 return cb->GetValue();
756 swatch->SetSwatchColor( aColor,
false );
771 return swatch->GetSwatchColor();
774 return COLOR4D::UNSPECIFIED;
788 return swatch->GetSwatchColor();
791 return COLOR4D::UNSPECIFIED;
804 cb->SetValue( isSet );
818 return cb->GetValue();
839 for(
int row = 0; row < rowCount ; row++ )
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Create and insert a menu item with an icon into aMenu.
A simple color swatch of the kind used to set layer colors.
void GetNewSwatchColor()
Prompt for a new colour, using the colour picker dialog.
KIGFX::COLOR4D GetSwatchColor() const
void SetSwatchBackground(const KIGFX::COLOR4D &aBackground)
Set the swatch background color.
representing a row indicator icon for use in places like the layer widget
void SetIndicatorState(ICON_ID aIconId)
Set the row indicator to the given state.
A color representation with 4 components: red, green, blue, alpha.
Icon provider for the "standard" row indicators, for example in layer selection lists.
STATE
< State constants to select the right icons
@ OFF
Row "off" or "deselected".
@ ON
Row "on" or "selected".
A version of a wxStaticText control that will request a smaller size than the full string.
void SetMinimumStringLength(const wxString &aString)
Set the string that is used for determining the requested size of the control.
@ LAYER_PCB_BACKGROUND
PCB background color.
This file contains miscellaneous commonly used macros and functions.