Files
vibemake-pcb-studio/common/widgets/properties_panel.css
T
likang 7e01147566
CI / typecheck + test + build (push) Has been cancelled
Initial commit: import VibeMake PCB Studio
2026-11-03 11:20:08 +08:00

346 lines
15 KiB
CSS

/* SPDX-License-Identifier: GPL-3.0-or-later
Copyright (C) 2026 ZiroEDA and contributors.
Portions derived from KiCad, copyright The KiCad Developers. See NOTICE.md.
PROPERTIES_PANEL (common/widgets/properties_panel.cpp) - the docked
Properties pane every design editor shares. It is a wxPanel holding a
wxStaticText caption and a wxPropertyGrid, and KiCad states almost nothing
about how either looks: the caption is added with `wxALL | wxEXPAND, 5`,
the panel font is KIUI::GetDockedPaneFont (on GTK the plain
wxSYS_DEFAULT_GUI_FONT), and every metric below that is wxPropertyGrid's.
So the numbers here were MEASURED, by `qa/probes/propgrid_probe.cpp`, which
builds that panel with wxWidgets and asks it - the same call KiCad makes, on
this machine, with this theme. They are corroborated by a live eeschema
capture of the same pane, which shares no arithmetic with the probe.
Everything the theme decides is taken from the tokens in ui/shell.css rather
than restated. This file states ONLY what wxPropertyGrid itself decides. */
/* The panel IS the docked pane's content: `EDA_PANE().Palette()` gives the AUI
pane no inner border, and the caption's own 5px is the only inset there is.
The same rule ui/shell.css already states for PANEL_SCH_SELECTION_FILTER,
which is a pane-filling widget for the same reason. */
.ze-panel-body:has(> .ze-pgrid-panel) {
padding: 0;
overflow: hidden;
}
.ze-pgrid-panel {
/* PROPERTIES_PANEL is a wxPanel: its face is wxSYS_COLOUR_3DFACE, not the
docked-pane body colour. The caption strip really is one step lighter than
the grid under it, and both were flat --panel-bg here before. */
background: var(--content-bg);
display: flex;
flex-direction: column;
height: 100%;
min-height: 0;
/* No font is stated on purpose. KiCad's SetFont( GetDockedPaneFont( this ) )
is, off macOS, getGUIFont( win, 0 ) - the same wxSYS_DEFAULT_GUI_FONT the
rest of the shell already inherits from --ui-font-size / --ui-font-family.
Restating it here is the specificity trap CLAUDE.md names: a local rule
that happens to agree today and silently stops tracking the token. */
}
/* `m_caption`, a wxStaticText holding EDA_ITEM::GetFriendlyName() for a single
selection, "No objects selected", or "%d objects selected"
(properties_panel.cpp:82, 196-210). Added to the panel sizer with
`wxALL | wxEXPAND, 5`, and [px] its best height is 18 - so the strip is
5 + 18 + 5 = 28, which is exactly the band a live capture measures. */
.ze-pgrid-caption {
/* [data] the wxSizer border `PROPERTIES_PANEL` passes for the caption,
`wxALL | wxEXPAND, 5` (properties_panel.cpp:82). A sizer border is a
number KiCad itself writes down, so it stays a literal here. */
padding: 5px;
/* wxSYS_COLOUR_BTNTEXT, the text ON a widget rather than inside a view. */
color: var(--chrome-fg);
line-height: var(--ui-line-height);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
flex: 0 0 auto;
}
/* The wxPropertyGrid itself. */
.ze-pgrid {
/* [px] GetCellBackgroundColour() = #272727 = wxSYS_COLOUR_WINDOW. */
background: var(--panel-bg);
/* A wxPropertyGrid is a view control, so GTK frames it the way it frames a
wxListCtrl or a wxTextCtrl - one pixel of --ctl-border, on all four sides.
`mainSizer->Add( m_grid, 1, wxEXPAND, 5 )` (properties_panel.cpp:115) has
no wxALL, so that 5 is never applied and the grid runs edge to edge inside
the pane: [px] pcbnew 1920x1200, Properties pane spanning x 66..365, reads
#181818 at x=66 and x=365 on every property row, at y=216 where the grid
starts under the 28px caption, and at y=1140 where it ends.
This border was drawn as `.ze-panel-header`'s `border-bottom` instead - so
it appeared once, above the wxStaticText caption rather than around the
grid, and the pane had no left, right or bottom edge at all. */
box-sizing: border-box;
border: 1px solid var(--ctl-border);
flex: 1 1 auto;
min-height: 0;
overflow-y: auto;
overflow-x: hidden;
/* wxPropertyGrid draws a value as TEXT and only builds an editor control
when the cell is activated, so the grid is not a form and its text is not
selectable the way a document's is. */
user-select: none;
/* [px] GetRowHeight() = 25, uniform for a category and for a property. A
capture of the live pane confirms the pitch: 24 rows of cell then one row
of line, repeating. */
--pgrid-row-height: 25px;
/* [px] GetMarginWidth() = 15. The gutter down the left that the category
twisty is drawn in; it is painted GetMarginColour(), not the cell colour. */
--pgrid-margin-width: 15px;
/* [data] wxPG_ICON_WIDTH, 9 in propgriddefs.h's __WXGTK__ block: the box
wxPropertyGrid hands wxRendererNative for the expander, in both
directions. */
--pgrid-icon-width: 9px;
/* wxPG_XBEFORETEXT, the gap between a column's edge and its text.
propgriddefs.h states it per platform and the __WXGTK__ block says 5;
a capture agrees, label and value ink both starting 5px into their cell. */
--pgrid-text-inset: 5px;
/* `m_grid->CenterSplitter()` (properties_panel.cpp:126) and
RecalculateSplitterPos(): with no dragged proportion stored the name/value
split sits at half the grid's width. */
--pgrid-splitter: 50%;
/* PGPROPERTY_COLORENUM::OnMeasureImage (pg_properties.cpp:636-644) returns
`FromDIP( wxSize( 16, -1 ) )`: the custom image slot is 16 wide, and -1
means "the whole cell" vertically. */
--pgrid-swatch-width: 16px;
}
.ze-pgrid-row,
.ze-pgrid-cat {
display: flex;
align-items: center;
box-sizing: border-box;
height: var(--pgrid-row-height);
/* [px] GetLineColour() = #373737. It is the same colour as the margin and
the category bar, which is why a category reads as an unbroken band. */
border-bottom: 1px solid var(--content-bg);
}
/* A wxPropertyCategory. It spans the whole width - no splitter is drawn on it -
and takes GetCaptionBackgroundColour() / GetCaptionForegroundColour(). The
caption font is the grid font made bold, which is wxPropertyGrid's own
`m_captionFont` rather than anything KiCad asks for. */
.ze-pgrid-cat {
background: var(--content-bg);
color: var(--chrome-fg);
font-weight: bold;
cursor: default;
}
.ze-pgrid-cat-label {
padding-left: var(--pgrid-text-inset);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* The expander wxRendererNative draws for a category. wxPG_ICON_WIDTH is 9 in
the __WXGTK__ block, and it sits at the left of the 15px margin. */
.ze-pgrid-twisty {
flex: 0 0 var(--pgrid-margin-width);
position: relative;
align-self: stretch;
}
.ze-pgrid-twisty::before {
content: "";
position: absolute;
top: 50%;
/* Centred in the margin, not flush against it. `wxRendererNative::
DrawTreeItemButton` centres GTK's expander in the rect it is handed, and
the rect is the whole 15px gutter - [px] pcbnew's "Basic Properties" row,
margin x 67..81, chevron ink x 68..78, i.e. a centre of 73 against the
gutter's 74. Ours sat at `left: 0`, which put the point 3px left of that
and read as a glyph jammed into the pane's edge. */
left: calc((var(--pgrid-margin-width) - var(--pgrid-icon-width)) / 2);
width: var(--pgrid-icon-width);
height: var(--pgrid-icon-width);
/* [art] the chevron's own stroke. wxRendererNative::DrawTreeItemButton hands
GTK's `expander` node, which paints pan-down-symbolic.svg; we cannot call
it, so this is the glyph re-drawn. The stroke is the icon's, not a number
KiCad or GTK states anywhere. */
border-top: 1.5px solid var(--chrome-fg);
/* [art] as above. */
border-right: 1.5px solid var(--chrome-fg);
transform: translate(0, -70%) rotate(135deg);
}
.ze-pgrid-twisty:not(.open)::before {
transform: translate(0, -50%) rotate(45deg);
}
/* A property row: margin gutter, name cell, splitter, value cell. */
.ze-pgrid-margin {
flex: 0 0 var(--pgrid-margin-width);
align-self: stretch;
/* [px] GetMarginColour() = #373737. */
background: var(--content-bg);
}
.ze-pgrid-name {
flex: 0 0 calc(var(--pgrid-splitter) - var(--pgrid-margin-width));
min-width: 0;
padding-left: var(--pgrid-text-inset);
box-sizing: border-box;
/* [px] GetCellTextColour() = #ffffff = wxSYS_COLOUR_WINDOWTEXT. A name cell
is not greyed when the property is read-only - PG_CELL_RENDERER::Render
only swaps the foreground for `aColumn > 0`. */
color: var(--view-fg);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.ze-pgrid-value {
flex: 1 1 auto;
min-width: 0;
/* A CELL is `GetRowHeight()` tall - the row's own 25, not its content's.
The row centres its children, which is right for the value TEXT and wrong
for the cell holding it: an editor is given the grid's editor rectangle,
`editor->SetPosition( aPos ); editor->SetSize( aSize )`
(pg_editors.cpp:350-351), and that rectangle is the row's height.
Left centred, the cell took the height of what was in it - and the colour
editor is a COLOR_SWATCH with no content of its own, so the two sized each
other: the cell from the swatch, the swatch from the cell, both to zero.
A Line Color row rendered a 164 x 0 swatch inside a 170 x 2 cell, which is
why the colour rectangle was missing from the panel altogether while the
same swatch drew correctly in DIALOG_SHAPE_PROPERTIES.
It is also what draws the splitter: the 1px border below runs the full
height of every row, so the line down the grid is unbroken. Centred, it
was a dash per row and nothing at all on a colour row. */
align-self: stretch;
display: flex;
align-items: center;
padding-left: var(--pgrid-text-inset);
box-sizing: border-box;
color: var(--view-fg);
/* The splitter. One pixel, in the line colour, and it is the ONLY rule on a
value cell: wxPropertyGrid draws no box round a value. */
border-left: 1px solid var(--content-bg);
overflow: hidden;
}
/* The resting value, painted text rather than a control. It is sized to its
content: what activates a property is the whole value CELL and not the
glyphs in it, so `.ze-pgrid-value` — not this — carries the click. */
.ze-pgrid-text {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* PGPROPERTY_COLORENUM's custom image (pg_properties.cpp:647-669):
`SetPen( *wxTRANSPARENT_PEN ); SetBrush( colour ); DrawRectangle( aRect )`.
A flat rectangle, no border and no rounding, sitting in the value cell's
image slot ahead of the text — which is where `GetImageOffset` puts the
text. It is NOT a COLOR_SWATCH: that widget is a button onto
DIALOG_COLOR_PICKER, and a layer row's swatch cannot be clicked. */
.ze-pgrid-swatch {
flex: 0 0 var(--pgrid-swatch-width);
align-self: stretch;
/* wxPG_CUSTOM_IMAGE_SPACINGY, the one pixel of cell the custom image does
not get, top and bottom. */
margin: 1px 0;
/* wxPG_XBEFORETEXT again: the same gap that leads a cell's text in also
separates the image from it. */
margin-right: var(--pgrid-text-inset);
}
/* PG_COLOR_EDITOR's swatch (pg_editors.cpp:336-351). Two things about it:
it is built SWATCH_LARGE, and it is then given the editor rectangle with
`SetSize( aSize )`, so it spans the whole value cell rather than sitting in
it at a fixed size. And it is a BARE COLOR_SWATCH — none of the
wxBORDER_SIMPLE wrapper panels the item dialogs put one in
(dialog_field_properties_base.cpp:277-286), and RenderToDC itself draws with
*wxTRANSPARENT_PEN (color_swatch.cpp:72) — which `.ze-swatch.large` already
states, so there is no border rule to write here either. */
/* Beats `.ze-swatch.large`, which is (0,2,0). `.ze-pgrid-colorcell` alone is
(0,1,0) and loses the tie regardless of which stylesheet loaded last, which
is why insetting it by a pixel changed nothing.
MEASURED, not derived. The paint path for the resting rectangle is not in
the class declarations — `PGPROPERTY_COLOR4D` is a plain wxStringProperty
with no `OnCustomPaint`, no `OnMeasureImage` and no CustomImage flag — and
two readings of the source got this cell wrong in opposite directions, once
as a filled cell and once as plain text. So it is taken off a live 10.0.5
instead, and corroborated by asking wx:
screenshot x 219..266 -> 48 wide, y 454..477 -> 24 tall,
checkerboard squares 6 px
swatch_probe ConvertDialogToPixels( SWATCH_SIZE_LARGE_DU (24,16) )
= 48 x 36, CHECKERBOARD_SIZE_DU (3,3) = 6 x 7
The two agree on the WIDTH and on the checker, and they are independent: one
is a capture, the other is the same `ConvertDialogToPixels` call
color_swatch.cpp:166-172 makes, on this machine with this font. So the width
is the swatch's OWN — `--swatch-large-w`, not restated here — and the
rectangle does not fill the cell.
The HEIGHT cannot be the swatch's: 36 does not fit a row that is 25 tall,
and what a real panel draws is 24 — the row's height less its separator
line, i.e. the cell. That is the one thing the earlier "fills the cell"
reading had right, and it needs `.ze-pgrid-value` to be full height, which
is what `align-self: stretch` up there is for. */
.ze-pgrid-value .ze-swatch.ze-pgrid-colorcell,
.ze-pgrid-colorcell {
align-self: stretch;
height: auto;
/* It starts at the cell's EDGE, not at its text inset: every other row's
value ink begins at x=224 in the capture and this begins at 219. The
activated editor does the same, by the same negative margin. */
margin-left: calc(-1 * var(--pgrid-text-inset));
}
/* PG_CELL_RENDERER::Render (common/properties/pg_cell_renderer.cpp:60-70):
a read-only property's VALUE is drawn in GetCellDisabledTextColour(), which
properties_panel.cpp:118 sets to wxSYS_COLOUR_GRAYTEXT. */
.ze-pgrid-row[data-readonly] .ze-pgrid-value {
color: var(--ctl-fg-disabled);
}
/* PGPROPERTY_BOOL uses PG_CHECKBOX_EDITOR, and a checkbox editor's DrawValue
paints the box whether or not the cell is active - so a bool row shows a
real checkbox at rest while every other kind shows text. [px] the box
measures 16 across in a live capture, which is --check-size. */
.ze-pgrid-check {
width: var(--check-size);
height: var(--check-size);
margin: 0;
flex: 0 0 auto;
}
/* The editor wxPropertyGrid builds when a cell is ACTIVATED - a wxTextCtrl
from GenerateEditorTextCtrl, or the combo an enum property makes. Its
chrome is an entry's and a combo's, which ui/shell.css already states once
for every control in the app; the only thing the GRID decides is that the
control is positioned over the cell, so that is all this rule says. */
.ze-pgrid-editor {
width: 100%;
min-width: 0;
box-sizing: border-box;
height: 100%;
margin-left: calc(-1 * var(--pgrid-text-inset));
font: inherit;
}
/* `PG_FPID_EDITOR::CreateControls` (common/properties/pg_editors.cpp:541-553)
builds a `wxPGMultiButton` beside the text control and then generates the
text control at `buttons->GetPrimarySize()` - so the entry gives up exactly
the button's width and both sit inside the cell.
The wrapper and the button are `.ze-grid-editwrap` / `.ze-grid-cellbtn` from
ui/shell.css, which already state that shape for GRID_CELL_TEXT_BUTTON - the
same editor, reached through a wxGrid instead of a wxPropertyGrid. Only the
entry's class differs here, so only that is restated. */
.ze-grid-editwrap > .ze-pgrid-editor {
flex: 1 1 auto;
min-width: 0;
}