forked from loov/lensm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
58 lines (46 loc) · 1.11 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package main
import (
"flag"
"fmt"
"image"
"image/color"
"os"
"gioui.org/app"
"gioui.org/unit"
"gioui.org/widget/material"
)
func main() {
textSize := flag.Int("text-size", 12, "default font size")
filter := flag.String("filter", "", "filter the symbol by regexp")
watch := flag.Bool("watch", false, "auto reload executable")
context := flag.Int("context", 3, "source line context")
font := flag.String("font", "", "user font")
flag.Parse()
exePath := flag.Arg(0)
if exePath == "" {
fmt.Fprintln(os.Stderr, "lensm <exePath>")
flag.Usage()
os.Exit(1)
}
windows := &Windows{}
theme := material.NewTheme(LoadFonts(*font))
theme.TextSize = unit.Sp(*textSize)
ui := NewExeUI(windows, theme)
ui.Config = ExeUIConfig{
Exe: exePath,
Watch: *watch,
Context: *context,
}
ui.Symbols.SetFilter(*filter)
windows.Open("lensm", image.Pt(1400, 900), ui.Run)
go func() {
windows.Wait()
os.Exit(0)
}()
// This starts Gio main.
app.Main()
}
var (
secondaryBackground = color.NRGBA{R: 0xF0, G: 0xF0, B: 0xF0, A: 0xFF}
splitterColor = color.NRGBA{R: 0x80, G: 0x80, B: 0x80, A: 0xFF}
)