42#include <wx/checkbox.h>
53static void shrinkFont( wxWindow* aControl,
int aPointSize )
55 wxFont font = aControl->GetFont();
56 font.SetPointSize( aPointSize );
57 aControl->SetFont( font );
80 wxWindow* eventSource = (wxWindow*) event.GetEventObject();
94 for( row = 0; row<rowCount; ++row )
96 if( y < height + heights[row] )
99 height += heights[row];
102 if( row >= rowCount )
111 int id = eventSource->GetId();
124 const wxString& aLayerName )
129 _(
"Change Layer Color for" ) + wxS(
" " ) + aLayerName,
130 KiBitmap( BITMAPS::color_materials ) );
131 menu.AppendSeparator();
135 menu.Bind( wxEVT_COMMAND_MENU_SELECTED, [aColorSwatch]( wxCommandEvent& event )
139 aColorSwatch->GetNewSwatchColor();
163 wxPostEvent(
this, event );
171 wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject();
180 const wxString& aRenderName )
185 _(
"Change Render Color for" ) + wxS(
" " )+ aRenderName,
186 KiBitmap( BITMAPS::color_materials ) );
188 menu.Bind( wxEVT_COMMAND_MENU_SELECTED,
189 [aColorSwatch]( wxCommandEvent& event )
241 wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject();
263 if( ndx < m_LayersFlexGridSizer->GetChildren().GetCount() )
274 for(
int row = 0; row < count; ++row )
292 if( (
unsigned) ndx < m_RenderFlexGridSizer->GetChildren().GetCount() )
303 for(
int row = 0; row < count; ++row )
319 wxASSERT( aRow >= 0 );
323 const int flags = wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT;
339 bmb->SetToolTip(
_(
"Left double click or middle click for color change, right click for "
347 cb->SetValue( aSpec.
state );
349 cb->SetToolTip(
_(
"Enable this for visibility" ) );
356 aSpec.
rowName, wxDefaultPosition,
358 wxST_ELLIPSIZE_MIDDLE );
361 st->SetToolTip( aSpec.
tooltip );
372 wxString layerName( aSpec.
rowName );
374 sbm->Bind( wxEVT_RIGHT_DOWN, [
this, bmb, layerName] ( wxMouseEvent& aEvt )
378 bmb->Bind( wxEVT_RIGHT_DOWN, [
this, bmb, layerName] ( wxMouseEvent& aEvt )
382 cb->Bind( wxEVT_RIGHT_DOWN, [
this, bmb, layerName] ( wxMouseEvent& aEvt )
386 st->Bind( wxEVT_RIGHT_DOWN, [
this, bmb, layerName] ( wxMouseEvent& aEvt )
398 label->SetLabel( aName );
414 wxASSERT( aRow >= 0 );
418 const int flags = wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT;
420 wxString renderName( aSpec.
rowName );
421 wxCheckBox* cb =
nullptr;
428 aSpec.
rowName, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
430 cb->SetValue( aSpec.
state );
433 cb->SetToolTip( aSpec.
tooltip );
439 if( aSpec.
color != COLOR4D::UNSPECIFIED )
444 bmb->SetToolTip(
_(
"Left double click or middle click for color change" ) );
447 bmb->Bind( wxEVT_RIGHT_DOWN, [
this, bmb, renderName] ( wxMouseEvent& aEvt ) {
450 cb->Bind( wxEVT_RIGHT_DOWN, [
this, bmb, renderName] ( wxMouseEvent& aEvt ) {
485 const wxPoint& pos,
const wxSize& size,
long style ) :
486 wxPanel( aParent, id, pos, size, style ),
487 m_smallestLayerString( wxT(
"M...M" ) )
489 int indicatorSize = ConvertDialogToPixels( wxSize( 6, 6 ) ).x;
492 int pointSize = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ).GetPointSize();
493 int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
495 if( screenHeight <= 900 && pointSize >= indicatorSize )
496 pointSize = pointSize * 8 / 10;
500 wxBoxSizer* mainSizer =
new wxBoxSizer( wxVERTICAL );
502 m_notebook =
new wxNotebook(
this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_TOP );
507 font.SetPointSize( pointSize );
513 wxBoxSizer* layerPanelSizer;
514 layerPanelSizer =
new wxBoxSizer( wxVERTICAL );
517 wxDefaultSize, wxNO_BORDER );
538 wxBoxSizer* renderPanelSizer;
539 renderPanelSizer =
new wxBoxSizer( wxVERTICAL );
542 wxDefaultSize, wxNO_BORDER );
560 SetSizer( mainSizer );
586 totWidth += widths[i];
594 unsigned totHeight = 32;
596 wxSize layerz( totWidth, totHeight );
605 totWidth += widths[i];
611 wxSize renderz( totWidth, totHeight );
615 wxSize clientz( std::max(renderz.x,layerz.x), std::max(renderz.y,layerz.y) );
715 cb->SetValue( isVisible );
728 return cb->GetValue();
745 swatch->SetSwatchColor( aColor,
false );
760 return swatch->GetSwatchColor();
763 return COLOR4D::UNSPECIFIED;
777 return swatch->GetSwatchColor();
780 return COLOR4D::UNSPECIFIED;
793 cb->SetValue( isSet );
807 return cb->GetValue();
828 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...
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.
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.