Documentation ¶
Index ¶
- Constants
- type Bookmark
- type BookmarkList
- type BookmarkListModel
- type ComicData
- type Direction
- type Layout
- type LayoutMode
- type Model
- func (m *Model) CloseCbxFile()
- func (m *Model) LoadCbxFile()
- func (m *Model) LoadSeriesList()
- func (m *Model) NewPages()
- func (m *Model) NewSpreads()
- func (m *Model) OpenCbxFile()
- func (m *Model) PageToSpread(n int) int
- func (m *Model) RefreshSpreads()
- func (m *Model) SpreadLoaded(spreadIndex int) bool
- func (m *Model) StoreLayout() error
- type Page
- type ProgramMetadata
- type Result
- type ResultCode
- type Span
- type Spread
Constants ¶
const ( SINGLE = iota DOUBLE )
const ( ONE_PAGE = iota TWO_PAGE LONG_STRIP )
const (
MAX_LOAD = 8
)
Maximum to load into the model Currently confusing because at init the units are pages Later it's spreads (so frequently double the number of pages
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BookmarkList ¶
type BookmarkList struct {
Model BookmarkListModel
}
Manage a list of bookmarks
func NewBookmarkList ¶
func NewBookmarkList(filePath string) *BookmarkList
func (*BookmarkList) Add ¶
func (l *BookmarkList) Add(b Bookmark)
func (*BookmarkList) Find ¶
func (l *BookmarkList) Find(pageIndex int) *Bookmark
func (*BookmarkList) Load ¶
func (l *BookmarkList) Load(hash string)
func (*BookmarkList) Remove ¶
func (l *BookmarkList) Remove(b Bookmark) *Bookmark
func (*BookmarkList) Store ¶
func (l *BookmarkList) Store() error
type BookmarkListModel ¶
type BookmarkListModel struct { FormatVersion string `json:"formatVersion"` Comic ComicData `json:"comic"` Bookmarks []Bookmark `json:"bookmarks"` }
Type used for serialization/deserialization of the BookmarkList
type Layout ¶
type Layout struct { FormatVersion string `json:"formatVersion"` Comic ComicData `json:"comic"` Mode LayoutMode `json:"mode"` Pages []Page `json:"pages"` }
type LayoutMode ¶
type LayoutMode int
Layout mode determines the max pages per spread ONE_PAGE = 1 pg TWO_PAGE = up to 2 pgs LONG_STRIP = n pgs
type Model ¶
type Model struct { SendMessage util.Messenger FilePath string TmpDir string Hash string Bookmarks *BookmarkList ImgPaths []string Pages []Page PageIndex int Spreads []*Spread SpreadIndex int Direction Direction LayoutMode LayoutMode SeriesList []string SeriesIndex int BrowseDir string ExportDir string HiddenPages bool Fullscreen bool Loading bool ProgramName string ProgramVersion string }
Data model of a cbx application Composed of a handful of sub-models, collections and other standard types
func (*Model) CloseCbxFile ¶
func (m *Model) CloseCbxFile()
func (*Model) LoadCbxFile ¶
func (m *Model) LoadCbxFile()
* The second phase of the "loading" process is the actual loading and * its synchronous. We have a lot of stuff to load: * individual pages * page metadata * layout * bookmarks * * It has to be synchronous because the pixbufs that are loaded into the * pages can't be touched on anything but the event dispatch thread or they * leak. * * Errors during this phase are treated as warnings. For two reasons, some of * this stuff is optional and there could be hundreds of errors on a per page * basis. If the program can be useful to the user in spite of that it tries. * * Finally there is the serieslist which is just an exception in that it really * is optional if it can't be calculated the program just does without it, see * loadSeriesList
func (*Model) LoadSeriesList ¶
func (m *Model) LoadSeriesList()
func (*Model) NewSpreads ¶
func (m *Model) NewSpreads()
Creates spread slice based on pg slice and layout mode
func (*Model) OpenCbxFile ¶ added in v0.4.4
func (m *Model) OpenCbxFile()
* When the user fires the "openFile" event a process called "loading" starts. * There are two phases: * * The first phase "Opening" the cbx is asynchronous: * hash created * tmpDir created * cbx file opened * cbx file extracted * Errors during this phase are considered critical, and stop the process * The ui is up and alive, but the user can't navigate until this phase signals * completion either success or failure. If the result is success LoadCbx is invoked, * see below *
func (*Model) PageToSpread ¶
Returns 0 if spreads are nil or page can't be found Otherwise it guesses fixme: Don't like it, but there's no point in telling a user about any of it because errors detected here are almost certainly the result of a programming error elsewhere in the program
func (*Model) RefreshSpreads ¶ added in v0.4.8
func (m *Model) RefreshSpreads()
Iterate over spreads and load/unload pages as needed based on the current spread index
func (*Model) SpreadLoaded ¶ added in v0.4.8
Test if a given spread is fully loaded
func (*Model) StoreLayout ¶
type Page ¶
type Page struct { FilePath string `json:"filePath"` Width int `json:"width"` Height int `json:"height"` Span int `json:"span"` Hidden bool `json:"hidden"` Loaded bool `json:"loaded"` Image *util.Img `json:"-"` }
A page in this case is generally analogous to an image They are grouped on Spreads
type ProgramMetadata ¶
type Result ¶ added in v0.4.4
type Result struct { Code ResultCode `json:"code"` Description string `json:"description"` }