2023-04-11 16:05:24 +02:00
|
|
|
package ui
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fyne.io/fyne/v2/container"
|
2023-05-12 09:10:24 +02:00
|
|
|
"gitea.mmo.to/ppForge/ppforge/packet"
|
|
|
|
"gitea.mmo.to/ppForge/ppforge/packetctl"
|
2023-04-11 16:05:24 +02:00
|
|
|
)
|
|
|
|
|
2023-04-12 15:14:19 +02:00
|
|
|
// PacketFileHandler implements TabProvider, FileHandler
|
2023-04-11 16:05:24 +02:00
|
|
|
type PacketFileHandler struct {
|
|
|
|
PacketEditor *PacketEditor
|
|
|
|
name string
|
|
|
|
path string
|
|
|
|
changed bool
|
|
|
|
tab *container.TabItem
|
|
|
|
|
2023-04-12 15:14:19 +02:00
|
|
|
Reference *packet.Structure
|
2023-04-11 16:05:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewPacketFileHandler() *PacketFileHandler {
|
|
|
|
pfh := PacketFileHandler{}
|
|
|
|
pfh.name = "*new"
|
|
|
|
pfh.changed = true
|
|
|
|
pfh.Reference = packetctl.NewPacketStructure()
|
|
|
|
pfh.PacketEditor = NewPacketEditor(pfh.Reference)
|
|
|
|
return &pfh
|
|
|
|
}
|
|
|
|
|
|
|
|
func (pfh *PacketFileHandler) SetTab(tab *container.TabItem) {
|
|
|
|
pfh.tab = tab
|
|
|
|
}
|
|
|
|
|
|
|
|
func (pfh *PacketFileHandler) Tab() *container.TabItem {
|
|
|
|
return pfh.tab
|
|
|
|
}
|
2023-04-12 15:14:19 +02:00
|
|
|
|
|
|
|
func (pfh *PacketFileHandler) Name() string {
|
|
|
|
return pfh.name
|
|
|
|
}
|
|
|
|
|
|
|
|
func (pfh *PacketFileHandler) Path() string {
|
|
|
|
return pfh.path
|
|
|
|
}
|
|
|
|
|
|
|
|
func (pfh *PacketFileHandler) Open(path string) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (pfh *PacketFileHandler) Save() error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (pfh *PacketFileHandler) SaveAs(path string) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (pfh *PacketFileHandler) Close() error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (pfh *PacketFileHandler) SetChanged() {
|
|
|
|
|
|
|
|
}
|
|
|
|
func (pfh *PacketFileHandler) HasChanged() bool {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
func (pfh *PacketFileHandler) GetReference() interface{} {
|
|
|
|
return nil
|
|
|
|
}
|