4 "github.com/zyedidia/micro/cmd/micro/buffer"
5 "github.com/zyedidia/micro/cmd/micro/display"
6 "github.com/zyedidia/micro/cmd/micro/screen"
7 "github.com/zyedidia/micro/cmd/micro/views"
8 "github.com/zyedidia/tcell"
19 resizing *views.Node // node currently being resized
22 func (t *TabPane) HandleEvent(event tcell.Event) {
23 switch e := event.(type) {
24 case *tcell.EventResize:
25 w, h := screen.Screen.Size()
26 InfoBar.Resize(w, h-1)
29 case *tcell.EventMouse:
32 mx, my := e.Position()
34 resizeID := t.GetMouseLoc(buffer.Loc{mx, my}).X
35 if t.resizing != nil {
37 if t.resizing.Kind == views.STVert {
38 size = mx - t.resizing.X
40 size = my - t.resizing.Y + 1
42 t.resizing.ResizeSplit(size)
48 t.resizing = t.GetNode(uint64(resizeID))
52 for i, p := range t.Panes {
54 inpane := mx >= v.X && mx < v.X+v.Width && my >= v.Y && my < v.Y+v.Height
62 case tcell.ButtonNone:
67 t.Panes[t.active].HandleEvent(event)
70 func (t *TabPane) SetActive(i int) {
72 for j, p := range t.Panes {
81 func (t *TabPane) GetPane(splitid uint64) int {
82 for i, p := range t.Panes {
83 if p.splitID == splitid {
90 func (t *TabPane) RemovePane(i int) {
91 copy(t.Panes[i:], t.Panes[i+1:])
92 t.Panes[len(t.Panes)-1] = nil // or the zero value of T
93 t.Panes = t.Panes[:len(t.Panes)-1]
96 func (t *TabPane) Resize() {
97 for i, p := range t.Panes {
98 n := t.GetNode(p.splitID)
104 pv.X, pv.Y = n.X+offset, n.Y
106 p.Resize(n.W-offset, n.H)
110 func (t *TabPane) CurPane() *EditPane {
111 return t.Panes[t.active]