Skip to content

Commit 5b106dd

Browse files
committed
Use tile widgets library
1 parent ed789e1 commit 5b106dd

40 files changed

+1129
-1661
lines changed

application/application.go

-47
This file was deleted.

cmd/main.go

+28-9
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,53 @@
11
package main
22

33
import (
4+
"context"
45
"flag"
56
"fmt"
7+
"path/filepath"
68

79
_ "github.com/codeation/impress/duo"
810

9-
"github.com/codeation/lineation/application"
10-
"github.com/codeation/lineation/mindmap"
11+
"github.com/codeation/impress"
12+
"github.com/codeation/tile/eventlink"
13+
14+
"github.com/codeation/lineation/mapcontrol"
15+
"github.com/codeation/lineation/mapmodel"
16+
"github.com/codeation/lineation/mapview"
17+
"github.com/codeation/lineation/menuevent"
18+
"github.com/codeation/lineation/palette"
19+
"github.com/codeation/lineation/xmlfile"
1120
)
1221

13-
func run() error {
22+
func run(ctx context.Context) error {
1423
flag.Parse()
1524
if len(flag.Args()) != 1 {
1625
return fmt.Errorf("filename argument is missing")
1726
}
27+
filename := filepath.Clean(flag.Args()[0])
28+
29+
pal := palette.NewPalette()
30+
a := impress.NewApplication(pal.DefaultAppRect(), fmt.Sprintf("lineation %s", filename))
31+
app := eventlink.MainApp(a)
32+
defer app.Close()
33+
menuevent.New(app.Application)
1834

19-
mm, err := mindmap.Open(flag.Args()[0])
35+
mapRoot, err := xmlfile.Open(filename)
2036
if err != nil {
21-
return fmt.Errorf("NewMindMap: %w", err)
37+
return fmt.Errorf("xmlfile.Open: %w", err)
2238
}
39+
mapModel := mapmodel.New(mapRoot, filename)
40+
mapView := mapview.New(app, mapModel, pal)
41+
defer mapView.Destroy()
42+
43+
mapControl := mapcontrol.New(app, mapModel, mapView)
44+
app.Run(ctx, mapControl)
2345

24-
app := application.NewApplication(mm)
25-
defer app.Close()
26-
app.Run()
2746
return nil
2847
}
2948

3049
func main() {
31-
if err := run(); err != nil {
50+
if err := run(context.Background()); err != nil {
3251
fmt.Println(err)
3352
}
3453
}

control/control.go

-47
This file was deleted.

control/do.go

-64
This file was deleted.

control/dragdrop.go

-39
This file was deleted.

0 commit comments

Comments
 (0)