- 编辑器:多标签、语法高亮、gopls 全套(补全/诊断/跳转/重命名/代码动作/内联提示/签名大纲) - 调试:Delve DAP(断点/条件断点/变量树/表达式求值/goroutine 列表) - 测试:结果树、覆盖率行着色、失败跳源码、-run 精确运行、行号可跑标记 - Git:状态着色、选择性暂存提交、pull/push、历史并排对比 - 本地历史 + 自动快照 + 崩溃恢复、会话/光标恢复 - 全局搜索替换(预览+确认,GBK 安全)、多终端、gopls 崩溃自愈 - 设计文档与验证记录见 docs/plans/
58 lines
1.8 KiB
Go
58 lines
1.8 KiB
Go
package app
|
|
|
|
import (
|
|
"fmt"
|
|
"runtime"
|
|
|
|
"github.com/egoist/mygo"
|
|
"github.com/egoist/mygo/ui"
|
|
)
|
|
|
|
// About 打开「关于」窗口;已经开着就提到前面,不重复创建。
|
|
func (a *App) About() {
|
|
if a.aboutWin != nil {
|
|
a.aboutWin.Show()
|
|
a.aboutWin.Focus()
|
|
return
|
|
}
|
|
w := mygo.NewWindow(mygo.WindowOptions{
|
|
Title: "关于 MyGoland",
|
|
Width: 400,
|
|
Height: 380,
|
|
// 关于窗口是固定尺寸的说明页:不能拉伸、不需要最小化和最大化,
|
|
// 只留右上角一个关闭按钮。
|
|
DisableResize: true,
|
|
DisableMinimize: true,
|
|
DisableMaximize: true,
|
|
// 菜单栏默认收起(按 Alt 才会露面):应用级菜单会下发到每个窗口,
|
|
// 关于窗口只该有一块内容,不该跑出一排「文件 编辑 运行…」。
|
|
AutoHideMenuBar: true,
|
|
Content: ui.View(a.aboutView),
|
|
})
|
|
if err := w.SetIcon(iconPNG); err != nil {
|
|
logf("关于窗口设置图标失败: %v", err)
|
|
}
|
|
w.Show()
|
|
// 再给一个空菜单,把继承来的应用级菜单顶掉。SetMenu(nil) 在这条路径上
|
|
// 会被应用菜单盖回来,空菜单对象才稳。
|
|
w.SetMenu(mygo.NewMenu(nil))
|
|
a.aboutWin = w
|
|
}
|
|
|
|
// aboutView 是「关于」窗口的内容:标识、名称、版本与运行环境。
|
|
func (a *App) aboutView(c *ui.Context) {
|
|
c.SetTheme(a.th)
|
|
t := c.Theme()
|
|
ui.Column(c).Fill().Center().Gap(6).Padding(28).Children(func() {
|
|
logoCard(c, 92)
|
|
ui.Box(c).Height(8)
|
|
ui.Text(c, "MyGoland").FontSize(24).Bold().TextColor(t.Text)
|
|
ui.Text(c, "轻量 Go IDE · mygo + Go").FontSize(12).TextColor(t.TextMuted)
|
|
ui.Box(c).Height(10)
|
|
ui.Text(c, "版本 "+Version).FontSize(11).TextColor(t.TextMuted)
|
|
ui.Text(c, fmt.Sprintf("%s / %s", runtime.GOOS, runtime.GOARCH)).
|
|
FontSize(11).TextColor(t.TextMuted)
|
|
ui.Text(c, runtime.Version()).FontSize(11).TextColor(t.TextMuted)
|
|
})
|
|
}
|