Files
vibemake-pcb-studio/bitmap2component/bitmap2cmp_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

438 lines
14 KiB
CSS

/* BITMAP2CMP_PANEL's window (bitmap2cmp_panel_ui.tsx).
Every control metric, font and colour in here comes from the shared GTK
control-theme tokens in common/widgets/shell.css - the same way wxWidgets
takes them from the GTK theme once and every KiCad launcher inherits the
identical result. Nothing below re-states a number that belongs to the
theme.
What IS stated below is the arrangement BITMAP2CMP_PANEL_BASE specifies for
this panel alone: which groups exist and in what order, the width of the
right column, where the stretch spacer goes, and the wxFormBuilder border on
each sizer item. Those cite bitmap2cmp_panel_base.cpp and belong to no other
editor. The frame around it (the window, its status bar) is
designer/src/editors/image/imageConverter.css. */
.imgc-body {
display: flex;
flex: 1;
min-height: 0;
}
/* --- left preview notebook --- */
/* bMainSizer->Add( m_Notebook, 1, wxEXPAND|wxBOTTOM|wxLEFT, 10 )
(bitmap2cmp_panel_base.cpp:30): the notebook is inset 10 px from the window's
left and bottom edges, with the window background showing through, and GTK
draws its own 1 px frame around it. */
.imgc-notebook {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
/* [data] wxBOTTOM|wxLEFT, 10 — bitmap2cmp_panel_base.cpp:30 writes 10,
not two --wx-border 5s, so it is upstream's number and stays. */
margin: 0 0 10px 10px;
border: 1px solid var(--ctl-border);
}
/* The wxNotebook tab strip. A GTK notebook draws no tab cards: the strip is
flat and the selected tab carries an accent bar in place of the strip's
bottom border, which is what the real bitmap2component window shows. */
.imgc-tabs {
display: flex;
gap: 0;
padding: 0;
height: var(--tab-strip-height);
flex: none;
background: var(--chrome-bg);
border-bottom: 1px solid var(--ctl-border);
}
.imgc-tab {
display: flex;
align-items: center;
padding: 0 var(--tab-pad-x);
cursor: default;
background: transparent;
border: none;
border-bottom: var(--tab-underline) solid transparent;
border-radius: 0;
color: inherit;
font: inherit;
/* The accent bar replaces the strip's own bottom border rather than stacking
under it: the tab hangs 1 px past the strip so its bottom edge lands on the
border row, exactly where KiCad's bar is. Any more than that and the next
element paints over it. */
margin-bottom: -1px;
}
.imgc-tab.active {
border-bottom-color: var(--chrome-active);
}
/* The notebook's three pages. BITMAP2CMP_PANEL_BASE builds three separate
wxScrolledWindows (bitmap2cmp_panel_base.cpp:21,24,27) and AddPage()s one
each, so every page keeps its own scroll position and switching tabs does not
move or reset the others. All three stay in the layout, stacked in one grid
cell, because a page removed from the box tree loses its scroll offset.
(SetScrollRate(5,5) only sets wx's scroll *unit*, the step a scrollbar click
moves by; a browser already scrolls by pixel, so there is nothing to port.) */
.imgc-pages {
flex: 1;
min-height: 0;
min-width: 0;
display: grid;
grid-template: 1fr / 1fr;
}
.imgc-view {
grid-area: 1 / 1;
min-width: 0;
min-height: 0;
overflow: auto;
/* KiCad's pages are plain flat scrolled windows, with no backdrop of their
own behind the bitmap. */
background: var(--panel-bg);
visibility: hidden;
}
.imgc-view.active {
visibility: visible;
}
/* wxDC::DrawBitmap( bmp, 0, 0 ) inside a scrolled window whose virtual size is
the image's own w x h (bitmap2cmp_panel.cpp:231-233): the preview is drawn
1:1 at the top-left and the user scrolls to the rest. Never scale it -- a
resampled 1-bit image greys out and drops single-pixel strokes, which reads
as a bad conversion when the traced geometry is exact. */
.imgc-canvas {
display: block;
image-rendering: pixelated;
}
/* --- right control column --- */
/* bMainSizer->Add( brightSizer, 0, wxEXPAND|wxALL, 5 ) plus the wxALL 5 that
every item inside brightSizer carries: 10 px from the column's edge to the
first group, and 10 px between any two items. Measured on the real window:
the column is 277 px of content and the group boxes inside it are 257 px. */
.imgc-side {
flex: none;
width: 277px;
overflow-y: auto;
padding: calc(2 * var(--wx-border));
background: var(--chrome-bg);
display: flex;
flex-direction: column;
gap: calc(2 * var(--wx-border));
}
/* A GTK frame: square, one hairline, and the label straddling the top edge at
its very left. The label is NOT bold - measuring ink density in the real
window put "Options" at 0.203 against "Negative" at 0.235, i.e. the same
weight - and the frame carries no padding of its own, because in wx every
child inside it brings its own wxFormBuilder border instead. */
.imgc-group {
border: 1px solid var(--ctl-border);
border-radius: 0;
padding: 0;
margin: 0;
min-inline-size: 0;
flex-shrink: 0;
display: flex;
flex-direction: column;
}
.imgc-group legend {
padding: 0;
margin-left: -1px;
font-weight: normal;
}
/* brightSizer->Add( 0, 0, 1, wxEXPAND ) (bitmap2cmp_panel_base.cpp:79) sits
between the Load Source Image button and the Output Size box, so all the
slack in the column opens up THERE and the four lower groups plus both export
buttons stay flush with the bottom edge. */
.imgc-spacer {
flex: 1 1 0;
}
/* The Output Format box is the column's other stretchy item
(bitmap2cmp_panel_base.cpp:198, proportion 1), so it shares the slack with
the spacer half and half; its radio buttons stay at the top of the box. */
.imgc-group.imgc-format {
flex-grow: 1;
justify-content: flex-start;
}
/* Image Information: a 4-column wxFlexGridSizer whose cells each carry a 5 px
border (bitmap2cmp_panel_base.cpp:47-88). One row is therefore one GtkLabel
tall with 5 px under it, which is the 23 px pitch the real window measures. */
.imgc-info {
display: grid;
grid-template-columns: auto 1fr 1fr auto;
padding: var(--wx-border);
gap: var(--wx-border);
align-items: center;
}
.imgc-info .k {
padding-right: var(--wx-border);
}
/* A wxFlexGridSizer cell is left-aligned; only wxALIGN_RIGHT would move it. */
.imgc-info .v {
text-align: left;
font-variant-numeric: tabular-nums;
}
/* Output Size row. bSizerRes: the label carries wxRIGHT|wxLEFT 5 and each of
the three controls wxRIGHT 5, and the sizer itself wxBOTTOM 5
(bitmap2cmp_panel_base.cpp:113-134). */
.imgc-sizerow {
display: flex;
align-items: center;
padding: 0 var(--wx-border) var(--wx-border);
gap: var(--wx-border);
}
.imgc-sizerow .lbl {
padding-left: var(--wx-border);
}
/* m_layerLabel is indented 28 px, not the usual 5
(bitmap2cmp_panel_base.cpp:177), so it hangs under the Footprint radio's
label rather than under its button. */
.imgc-layerrow {
display: flex;
align-items: center;
padding-left: 28px; /* [data] bitmap2cmp_panel_base.cpp:177 */
padding-right: var(--wx-border);
gap: var(--wx-border);
}
/* m_layerLabel->Enable( m_rbFootprint->GetValue() ) (bitmap2cmp_panel.cpp:571):
the label greys with its control. */
.imgc-layerrow.disabled .lbl {
color: var(--ctl-fg-disabled);
}
/* Text fields and combos are the same height as a button, which is what makes a
mixed row line up. m_UnitSizeX/Y SetMinSize( 60, -1 ) and m_PixelUnit
SetMinSize( 80, -1 ), all three at sizer proportion 0, so the row packs left
and the slack stays on the right.
These rules carry .imgc-panel, and the entries carry `ze-bare`, purely to get
out from under the shell's blanket entry rule: that one is deliberately built
at (0,5,1) and documents `ze-bare` as its opt-out. Without both, the shell
paints these fields --chrome-bg2 with a 3 px radius and the GTK field metrics
below never reach the screen. */
.imgc-panel .imgc-input {
background: var(--field-bg);
color: var(--chrome-fg);
border: 1px solid var(--ctl-border);
border-radius: var(--ctl-radius);
height: var(--ctl-height);
padding: 0 var(--field-pad-x);
font: inherit;
flex: none;
}
/* The three controls of the Output Size row, at the widths
bitmap2cmp_panel_base.cpp:112,118,126 give them. */
.imgc-sizerow .imgc-input {
width: 60px;
font-variant-numeric: tabular-nums;
}
/* The Layer and unit combos are the shared `Combo` (ui/Combo.tsx), and NOTHING
about how they look is restated here. They used to share `.imgc-input`'s rule,
which painted them the entry interior `--field-bg`; a combo is a GTK *button*
and takes `--ctl-face` (Yaru: `button { background-image: image(#373737) }`
against an entry's #282828, and a real bitmap2component samples rgb(55,55,55)
inside the Layer combo). Because the local rule was (0,2,0) it silently beat
`.ze-combo`'s (0,1,0), so fixing the widget centrally changed nothing here —
which is exactly why the look now lives in one place and this file keeps only
the LAYOUT bitmap2cmp_panel_base gives this panel: sizer proportion and the
SetMinSize widths. Layout is the panel's business; looks are the widget's. */
.imgc-panel .imgc-select {
flex: none;
}
.imgc-sizerow .imgc-select {
width: 80px;
}
/* Only an entry takes a focus ring, and at 70% alpha: Yaru gives
`entry:focus { border-color: rgba(239, 134, 97, 0.7) }` and gives `button` no
:focus rule at all. A combo is a button, so it is not listed here — the
keyboard rectangle it does get lives on `.ze-combo:focus-visible`. */
.imgc-panel .imgc-input:focus {
outline: 1px solid var(--field-focus-border);
}
/* m_layerCtrl is the one control here at sizer proportion 1. */
.imgc-panel .imgc-select.grow {
flex: 1;
width: auto;
}
/* GTK greys a disabled control by colour, not by fading the whole widget: the
background and border stay put and only the text changes. */
.imgc-panel .imgc-input:disabled {
color: var(--ctl-fg-disabled);
opacity: 1;
}
/* Options. The label carries wxRIGHT|wxLEFT 5, the slider
wxBOTTOM|wxLEFT|wxRIGHT 5 and the checkbox wxBOTTOM|wxRIGHT|wxLEFT 5
(bitmap2cmp_panel_base.cpp:144-156). */
.imgc-thresh-label {
padding: 0 var(--wx-border);
}
/* wxSL_LABELS (bitmap2cmp_panel_base.cpp:150): GTK draws the current value
centred ABOVE the thumb and the two range ends, 0 and 100, at the ends of the
track BELOW it, each on its own label line. --slider-thumb-size is the
browser's range thumb; the thumb centre travels only between half a thumb in
from each end, which is what the second term of the calc() corrects for. */
.imgc-slider {
/* [data] `wxBOTTOM|wxLEFT|wxRIGHT, 5` on the slider
(bitmap2cmp_panel_base.cpp:150); the padding is the shared rule's. */
margin-bottom: var(--wx-border);
}
/* The threshold slider is the shared wxSlider - see ui/Slider.tsx and the
`.ze-slider` rules in shell.css. Everything that used to stand here was a
copy of that control scoped to `.imgc-frame`, so no other launcher could
reach it; the colour picker asked for the same slider and got a bare range
input. Only the box AROUND it is this panel's, and that is above. */
/* GtkCheckButton / GtkRadioButton: a 22 px row with a 16 px indicator that
carries a 4 px margin either side. */
.imgc-check,
.imgc-radio {
display: flex;
align-items: center;
height: var(--check-row);
cursor: default;
}
.imgc-panel .imgc-check input,
.imgc-panel .imgc-radio input {
appearance: none;
flex: none;
width: var(--check-size);
height: var(--check-size);
margin: 0 var(--check-margin);
box-sizing: border-box;
background: var(--check-face);
border: 1px solid var(--ctl-border);
border-radius: var(--check-radius);
}
.imgc-panel .imgc-radio input {
border-radius: 50%;
}
.imgc-panel .imgc-check input:checked,
.imgc-panel .imgc-radio input:checked {
background: var(--chrome-active);
border-color: var(--chrome-active);
}
/* The check mark and the radio dot GTK draws inside the accent square. */
.imgc-panel .imgc-check input:checked::after {
content: "";
display: block;
/* [art] the tick's own geometry. GTK draws check-symbolic.svg here, so there
is no metric to copy — only the ink is shared, as --check-mark. */
width: 4px; /* [art] */
height: 8px; /* [art] */
margin: 1px auto 0; /* [art] */
border: solid var(--check-mark);
border-width: 0 2px 2px 0; /* [art] */
transform: rotate(45deg);
}
.imgc-panel .imgc-radio input:checked::after {
content: "";
display: block;
/* [art] as above, for bullet-symbolic.svg. */
width: 6px; /* [art] */
height: 6px; /* [art] */
margin: 4px auto; /* [art] */
border-radius: 50%;
background: var(--check-mark);
}
/* wxALL 5 on m_aspectRatioCheckbox; wxBOTTOM|wxRIGHT|wxLEFT 5 on
m_checkNegative (bitmap2cmp_panel_base.cpp:135,156). */
.imgc-group > .imgc-check {
margin: 0 var(--wx-border) var(--wx-border);
}
.imgc-sizerow + .imgc-check {
margin-top: var(--wx-border);
}
/* Output Format: wxFlexGridSizer( 5, 1, 2, 0 ), so a 2 px gap between rows, and
then the per-row wxFormBuilder borders on top of it
(bitmap2cmp_panel_base.cpp:161-193). Row 3 - the Layer row - is the one added
with no border at all. */
.imgc-formats {
display: flex;
flex-direction: column;
gap: 2px; /* [data] wxFlexGridSizer( 5, 1, 2, 0 ) — the vgap is upstream's */
padding: 0 var(--wx-border);
}
.imgc-formats > :nth-child(1) {
margin-bottom: var(--wx-border); /* wxBOTTOM|wxRIGHT, 5 */
}
.imgc-formats > :nth-child(2) {
margin-top: var(--wx-border); /* wxTOP|wxRIGHT, 5 */
}
.imgc-formats > :nth-child(4) {
margin: var(--wx-border) 0; /* wxTOP|wxBOTTOM|wxRIGHT, 5 */
}
.imgc-formats > :nth-child(5) {
margin-top: var(--wx-border); /* wxTOP|wxRIGHT, 5 */
}
/* Buttons */
.imgc-panel .imgc-btn {
background: var(--ctl-face);
color: var(--chrome-fg);
border: 1px solid var(--ctl-border);
border-radius: var(--ctl-radius);
height: var(--ctl-height);
padding: 0 var(--ctl-pad-x);
font: inherit;
cursor: default;
flex: none;
}
.imgc-panel .imgc-btn:hover:not(:disabled) {
background: var(--chrome-hover);
}
.imgc-btn.block {
width: 100%;
}
.imgc-panel .imgc-btn:disabled {
background: var(--ctl-face-disabled);
color: var(--ctl-fg-disabled);
cursor: default;
}
/* m_buttonExportClipboard is added wxBOTTOM|wxRIGHT|wxLEFT - no wxTOP - so it
sits 5 px under Export to File, half the column's usual 10
(bitmap2cmp_panel_base.cpp:205). */
.imgc-btn.block + .imgc-btn.block {
margin-top: calc(-1 * var(--wx-border));
}