Add media components 346-365; input.SlideBase, guarded Pad
An audio player with transport, scrubber and volume; an equalizer and a visualizer; a playlist; a cassette, cartridge and record that turn while they play and hold where they stop; piano keys, a step sequencer and a tracker you can type into; a waveform, a 16:9 video frame, an image compare, a gallery, a filmstrip, a record button and an FM tuner. input exports SlideBase, the undrawn rail its sliders share; the gallery treats exported Bases as building blocks, not components. pixel's micro font gains '#' for notes like C#4. pixel.Pad and the slide rail read input only while their base is enabled, so Inert or a fresh Disabled stops a drag or a key already sent. AGENTS records why a drawn container keeps the DISABLED description: MyGo paints a disabled subtree at half opacity.
This commit is contained in:
39 files changed
+3066
-10
No files matched your search
+3
-3
@@ -193,7 +193,7 @@ func hanging(punct func(rune) bool) func(rune) bool {
|
||||
}
|
||||
|
||||
func TestMicroFont(t *testing.T) {
|
||||
set := "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ+-.:/%! "
|
||||
set := "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ+-#.:/%! "
|
||||
seen := map[[MicroHeight]uint8]rune{}
|
||||
for _, r := range set {
|
||||
g := microGlyph(r)
|
||||
@@ -213,8 +213,8 @@ func TestMicroFont(t *testing.T) {
|
||||
}
|
||||
defer func() {
|
||||
if recover() == nil {
|
||||
t.Fatal("micro '#' did not panic")
|
||||
t.Fatal("micro '@' did not panic")
|
||||
}
|
||||
}()
|
||||
MicroWidth("#")
|
||||
MicroWidth("@")
|
||||
}
|
||||
@@ -34,6 +34,7 @@ var messages = map[Locale]map[string]string{
|
||||
"from": "FROM", "subject": "SUBJECT", "date": "DATE", "faces": "FACES", "nature": "NATURE", "items": "ITEMS",
|
||||
"mute": "MUTE", "camera": "CAMERA", "hang_up": "HANG UP", "new_count": "%d NEW", "votes": "%d VOTES", "unread": "%d UNREAD",
|
||||
"day_date": "%[1]s %[2]d %[3]s", "category": "CATEGORY", "days": "SUN MON TUE WED THU FRI SAT",
|
||||
"prev_track": "PREVIOUS", "next_track": "NEXT", "play": "PLAY", "volume": "VOLUME", "rec": "REC", "playing": "PLAYING", "seek": "SEEK",
|
||||
},
|
||||
Zh: {
|
||||
"ok": "确定", "cancel": "取消", "yes": "是", "no": "否", "close": "关闭",
|
||||
@@ -66,6 +67,7 @@ var messages = map[Locale]map[string]string{
|
||||
"from": "发件人", "subject": "主题", "date": "日期", "faces": "表情", "nature": "万物", "items": "道具",
|
||||
"mute": "静音", "camera": "摄像头", "hang_up": "挂断", "new_count": "%d 条新", "votes": "%d 票", "unread": "%d 未读",
|
||||
"day_date": "%[4]d月%[2]d日 周%[1]s", "category": "类别", "days": "日 一 二 三 四 五 六",
|
||||
"prev_track": "上一首", "next_track": "下一首", "play": "播放", "volume": "音量", "rec": "录制", "playing": "正在播放", "seek": "进度",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ var micro = microFont(map[rune]string{
|
||||
'Z': "###|..#|.#.|#..|###",
|
||||
'+': "...|.#.|###|.#.|...",
|
||||
'-': "...|...|###|...|...",
|
||||
'#': "#.#|###|#.#|###|#.#",
|
||||
'.': "...|...|...|...|.#.",
|
||||
':': "...|.#.|...|.#.|...",
|
||||
'/': "..#|..#|.#.|#..|#..",
|
||||
|
||||
+5
-1
@@ -9,6 +9,11 @@ func Pad(c *ui.Context, text string, cols, n, cw, ch int, cur *int, disabled boo
|
||||
return ui.Box(c).Focusable().Role(ui.RoleGroup).Label(text).Disabled(disabled)
|
||||
})
|
||||
shell.Size(k.D(cols*cw), k.D((n+cols-1)/cols*ch))
|
||||
picked = -1
|
||||
// Disabled or inert, even a key already sent waits.
|
||||
if base.IsDisabled() {
|
||||
return shell, base, st, picked
|
||||
}
|
||||
for _, m := range []struct {
|
||||
key ui.Key
|
||||
to func() int
|
||||
@@ -21,7 +26,6 @@ func Pad(c *ui.Context, text string, cols, n, cw, ch int, cur *int, disabled boo
|
||||
*cur = to
|
||||
}
|
||||
}
|
||||
picked = -1
|
||||
enter, space := base.Shortcut(0, ui.KeyEnter), base.Shortcut(0, ui.KeySpace)
|
||||
if enter || space {
|
||||
picked = *cur
|
||||
|
||||
Reference in new issue
Block a user