2020-08-16 05:58:29 +02:00
|
|
|
package gui
|
|
|
|
|
|
|
|
func (gui *Gui) nextSideWindow() error {
|
|
|
|
windows := gui.getCyclableWindows()
|
|
|
|
currentWindow := gui.currentWindow()
|
|
|
|
var newWindow string
|
|
|
|
if currentWindow == "" || currentWindow == windows[len(windows)-1] {
|
|
|
|
newWindow = windows[0]
|
|
|
|
} else {
|
|
|
|
for i := range windows {
|
|
|
|
if currentWindow == windows[i] {
|
|
|
|
newWindow = windows[i+1]
|
|
|
|
break
|
|
|
|
}
|
|
|
|
if i == len(windows)-1 {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-04-04 15:51:59 +02:00
|
|
|
if err := gui.resetOrigin(gui.Views.Main); err != nil {
|
2020-08-16 05:58:29 +02:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2022-06-13 03:01:26 +02:00
|
|
|
context := gui.getContextForWindow(newWindow)
|
2020-08-16 05:58:29 +02:00
|
|
|
|
2022-06-13 03:01:26 +02:00
|
|
|
return gui.c.PushContext(context)
|
2020-08-16 05:58:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (gui *Gui) previousSideWindow() error {
|
|
|
|
windows := gui.getCyclableWindows()
|
|
|
|
currentWindow := gui.currentWindow()
|
|
|
|
var newWindow string
|
|
|
|
if currentWindow == "" || currentWindow == windows[0] {
|
|
|
|
newWindow = windows[len(windows)-1]
|
|
|
|
} else {
|
|
|
|
for i := range windows {
|
|
|
|
if currentWindow == windows[i] {
|
|
|
|
newWindow = windows[i-1]
|
|
|
|
break
|
|
|
|
}
|
|
|
|
if i == len(windows)-1 {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-04-04 15:51:59 +02:00
|
|
|
if err := gui.resetOrigin(gui.Views.Main); err != nil {
|
2020-08-16 05:58:29 +02:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2022-06-13 03:01:26 +02:00
|
|
|
context := gui.getContextForWindow(newWindow)
|
2020-08-16 05:58:29 +02:00
|
|
|
|
2022-06-13 03:01:26 +02:00
|
|
|
return gui.c.PushContext(context)
|
2020-08-16 05:58:29 +02:00
|
|
|
}
|
|
|
|
|
2022-06-13 03:01:26 +02:00
|
|
|
func (gui *Gui) goToSideWindow(window string) func() error {
|
2021-04-02 10:20:40 +02:00
|
|
|
return func() error {
|
2022-06-13 03:01:26 +02:00
|
|
|
context := gui.getContextForWindow(window)
|
|
|
|
|
|
|
|
return gui.c.PushContext(context)
|
2020-08-16 05:58:29 +02:00
|
|
|
}
|
|
|
|
}
|