Compare commits

...

18 commits

Author SHA1 Message Date
Piotr Grabowski 396bdb9897 docs(readme): update copyright year 2024-08-24 15:27:22 +02:00
Piotr Grabowski 3982bf9ec8 chore(deps): update deps 2024-08-10 16:13:43 +02:00
Piotr Grabowski e054220b82 qual: lint fixes 2024-08-10 15:01:34 +02:00
Piotr Grabowski 784bb77d91 feat(ui): allow temporarily revealing the UI with the alt button if hidden 2024-08-10 14:58:13 +02:00
Piotr Grabowski 3f1ac02fe7 improve(ui): shift fullscreen and hide ui options to top of their submenu 2024-08-10 14:50:01 +02:00
Piotr Grabowski 76e05847c4 qual: update copyright year 2024-08-10 14:48:56 +02:00
Piotr Grabowski e056ee91f6 feat(archive): add rar archive support 2024-08-10 13:00:25 +02:00
Piotr Grabowski 9262f1bc59 fix(scroll): make auto-scroll on page change work consistently 2024-08-10 12:52:49 +02:00
Piotr Grabowski 2970fabeb1 refactor(ui): move some ui logic out of config code 2024-08-10 12:48:37 +02:00
Piotr Grabowski fb91eac669 docs(readme): add some information on OS support 2023-12-06 22:06:10 +01:00
Piotr Grabowski 5d1bec47ad improve(platform): add platform-specific code for other oses in case the program works there 2023-12-06 21:56:49 +01:00
Piotr Grabowski bc39ba3c6c chore(deps): update deps 2023-11-11 15:23:38 +01:00
Piotr Grabowski 6c33eaec6d qual: lint fixes 2023-02-04 18:44:32 +01:00
Piotr Grabowski f81c9e269d chore(makefile): add lint command 2023-02-04 18:44:28 +01:00
Piotr Grabowski 27e12057bc qual: use url.JoinPath() for constructing Kamite cmd endpoint URLs 2023-02-04 18:25:04 +01:00
Piotr Grabowski d27039fdb7 chore(makefile): polish Makefile 2023-02-04 18:14:27 +01:00
Piotr Grabowski c35438c33d chore(deps): update deps and go ver. to 1.20 2023-02-04 18:14:09 +01:00
Piotr Grabowski 175815a305 qual: update copyright year 2023-02-04 18:11:09 +01:00
46 changed files with 431 additions and 123 deletions

6
.golangci.yml Normal file
View file

@ -0,0 +1,6 @@
---
run:
skip-dirs:
- ".*go/pkg.*"
- ".*go/src.*"

View file

@ -1,24 +1,35 @@
.PHONY: build clean dist
# --- PREAMBLE
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
MAKEFLAGS += --warn-undefined-variables
BUILD_DATE := $(shell date +'%Y%m%d')
VERSION := $(shell support/get-version.sh)
build:
go build -o target/gomicsv \
-ldflags="-X main.buildDate=$(BUILD_DATE) -X main.versionString=$(VERSION)" \
cmd/gomicsv/main.go
-ldflags="-X main.buildDate=$(BUILD_DATE) -X main.versionString=$(VERSION)" \
cmd/gomicsv/main.go
.PHONY: build
clean:
rm -rf target/; \
rm -rf target/
.PHONY: clean
dist: build
rm -rf target/dist; \
rm -rf target/*.zip; \
mkdir -p target/dist/gomicsv; \
cp target/gomicsv target/dist/gomicsv/gomicsv; \
cp README.md target/dist/gomicsv; \
cp COPYING.md target/dist/gomicsv; \
cp CHANGELOG.md target/dist/gomicsv; \
pushd target/dist; \
zip -r ../Gomics-v_$(VERSION).zip gomicsv; \
rm -rf gomicsv; \
rm -rf target/dist
rm -rf target/*.zip
mkdir -p target/dist/gomicsv
cp target/gomicsv target/dist/gomicsv/gomicsv
cp README.md target/dist/gomicsv
cp COPYING.md target/dist/gomicsv
cp CHANGELOG.md target/dist/gomicsv
pushd target/dist
zip -r ../Gomics-v_$(VERSION).zip gomicsv
rm -rf gomicsv
.PHONY: dist
lint:
golangci-lint run
.PHONY: lint

View file

@ -18,6 +18,9 @@ This fork has been made with personal use for reading manga with
mouse-centered navigation in mind. Consequently, some aspects of other workflows
might have been broken.
The program has only been confirmed to work on Linux, but it is possible it
would work on other platforms.
<p align="center">
<img src="screenshot.png" title="A screenshot of Gomics-v">
</p>
@ -69,10 +72,11 @@ might have been broken.
## Installation
Download the latest release package from the [Releases] page and extract it to
the location where you want to keep the program files (e.g., `/opt/gomicsv`).
Download the latest release package from the [Releases] page (Linux only) and
extract it to the location where you want to keep the program files (e.g.,
`/opt/gomicsv`).
Or build it from the source:
Or build it from the source (see below).
[Releases]: https://github.com/fauu/gomicsv/releases
@ -94,6 +98,14 @@ Building requires [go] and some GTK-related dependencies. See
[gomics: Requirements][gomics-requirements]. GTK-related build steps might take
up to 15 minutes on first compile.
---
Extra information for Windows and macOS:
- <https://github.com/gotk3/gotk3/wiki/Installing-on-Windows>
- <https://github.com/gotk3/gotk3/wiki/Installing-on-macOS>
[go]: https://go.dev/
[gomics-requirements]: https://github.com/salviati/gomics#requirements
@ -101,7 +113,7 @@ up to 15 minutes on first compile.
Gomics-v\
Copyright (c) 20132021 Utkan Güngördü <utkan@freeconsole.org>\
Copyright (c) 20212022 Piotr Grabowski
Copyright (c) 20212024 Piotr Grabowski
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software

8
app.go
View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -70,6 +70,7 @@ type State struct {
RecentManager *gtk.RecentManager
BackgroundColorCssProvider *gtk.CssProvider
PageCacheTrimTimeoutHandle *glib.SourceHandle
UITemporarilyRevealed bool
}
//go:embed about.jpg
@ -236,6 +237,11 @@ func (app *App) handleKeyPress(key uint, shift bool, ctrl bool) {
} else {
app.W.MenuItemNextPage.Activate()
}
case gdk.KEY_Alt_L:
if app.Config.HideUI {
app.S.UITemporarilyRevealed = !app.S.UITemporarilyRevealed
app.toggleHideUI(!app.S.UITemporarilyRevealed)
}
}
}

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -24,7 +24,6 @@ import (
"net/url"
"os"
"path/filepath"
"reflect"
"strings"
"github.com/fauu/gomicsv/archive"
@ -119,7 +118,7 @@ func (app *App) doLoadArchive(path string, assumeHTTPURL bool, httpReferer strin
}
func (app *App) archiveIsLoaded() bool {
return app.S.Archive != nil && !reflect.ValueOf(app.S.Archive).IsNil() && app.S.ArchivePath != ""
return app.S.ArchivePath != ""
}
func (app *App) archiveGetBaseName() string {
@ -144,7 +143,6 @@ func (app *App) archiveClose() {
app.S.Archive.Close()
app.S.Archive = nil
app.S.ArchivePath = ""
app.S.ArchivePos = 0

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -64,7 +64,9 @@ func NewArchive(path string, pageCache *pagecache.PageCache, httpReferer string)
switch ext {
case "zip", "cbz":
return NewZip(path)
case "7z", "rar", "tar", "tgz", "gz", "tbz2", "cb7", "cbr", "cbt", "lha":
case "rar":
return NewRar(path)
case "7z", "tar", "tgz", "gz", "tbz2", "cb7", "cbr", "cbt", "lha":
return nil, errors.New("Archive type not supported, please unpack it first")
}

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

162
archive/rar.go Normal file
View file

@ -0,0 +1,162 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package archive
import (
"errors"
"fmt"
"io"
"log"
"path/filepath"
"sort"
"github.com/fauu/gomicsv/pixbuf"
"github.com/gotk3/gotk3/gdk"
"github.com/nwaples/rardecode/v2"
)
type Rar struct {
files RarMembers // Sorted by name
reader *rardecode.ReadCloser
name string
}
type RarMember struct {
Header *rardecode.FileHeader
Offset int // in terms of files
}
type RarMembers []RarMember
func (p RarMembers) Len() int { return len(p) }
func (p RarMembers) Less(i, j int) bool { return strcmp(p[i].Header.Name, p[j].Header.Name, true) }
func (p RarMembers) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
// NewRar reads supported image filenames from a given rar archive and sorts them
func NewRar(name string) (*Rar, error) {
var err error
ar := new(Rar)
ar.name = filepath.Base(name)
ar.files = make([]RarMember, 0, MaxArchiveEntries)
ar.reader, err = rardecode.OpenReader(name)
if err != nil {
return nil, err
}
offsetAcc := -1
for {
offsetAcc += 1
header, err := ar.reader.Next()
if err != nil {
if err == io.EOF {
break
}
log.Printf("error reading a file inside the rar archive: %v", err)
}
if header.IsDir {
continue
}
if !extensionMatches(header.Name, imageExtensions) {
continue
}
ar.files = append(ar.files, RarMember{
Header: header,
Offset: offsetAcc,
})
}
if len(ar.files) == 0 {
return nil, errors.New(ar.name + ": no supported images in the rar file")
}
sort.Sort(RarMembers(ar.files))
ar.Close()
return ar, nil
}
func (ar *Rar) checkbounds(i int) error {
if i < 0 || i >= len(ar.files) {
return ErrBounds
}
return nil
}
func (ar *Rar) Load(i int, autorotate bool, _nPreload int) (*gdk.Pixbuf, error) {
var err error
if err = ar.checkbounds(i); err != nil {
return nil, err
}
ar.reader, err = rardecode.OpenReader(ar.name)
if err != nil {
return nil, err
}
targetOffset := ar.files[i].Offset
offsetAcc := -1
for {
offsetAcc += 1
header, err := ar.reader.Next()
if err != nil {
if err == io.EOF {
break
}
log.Printf("error reading a file inside the rar archive: %v", err)
}
if header.IsDir {
continue
}
if offsetAcc == targetOffset {
defer ar.Close()
return pixbuf.Load(ar.reader, autorotate)
}
}
return nil, fmt.Errorf(ar.name + ": could not find a file inside the rar archive")
}
func (ar *Rar) Kind() Kind {
return Packed
}
func (ar *Rar) ArchiveName() string {
return ar.name
}
func (ar *Rar) Name(i int) (string, error) {
if err := ar.checkbounds(i); err != nil {
return "", err
}
return ar.files[i].Header.Name, nil
}
func (ar *Rar) Len() *int {
l := len(ar.files)
return &l
}
func (ar *Rar) Close() error {
return ar.reader.Close()
}

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -37,7 +37,7 @@ type Loader interface {
Len() int
}
var archiveExtensions = []string{".zip", ".cbz"}
var archiveExtensions = []string{".zip", ".cbz", ".rar"}
var imageExtensions []string
func init() {
@ -119,7 +119,7 @@ func NewFile(f *os.File) *File {
}
func (r *File) Size() (int64, error) {
fi, err := r.Stat()
fi, err := r.Stat() // nolint:typecheck
if err != nil {
return 0, err
}
@ -127,11 +127,11 @@ func (r *File) Size() (int64, error) {
}
func (r *File) SetSize(n int64) error {
return r.Truncate(n)
return r.Truncate(n) // nolint:typecheck
}
func (r *File) Ext() string {
ext := filepath.Ext(r.Name())
ext := filepath.Ext(r.Name()) // nolint:typecheck
if len(ext) <= 1 || ext[0] != '.' {
return ""
}
@ -156,7 +156,7 @@ func (b *Buffer) SetSize(int64) error {
}
func (b *Buffer) Size() (int64, error) {
return int64(b.Len()), nil
return int64(b.Len()), nil // nolint:typecheck
}
func strcmp(a, b string, nat bool) bool {

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -194,30 +194,15 @@ func (app *App) setVFlip(vflip bool) {
func (app *App) setFullscreen(fullscreen bool) {
app.Config.Fullscreen = fullscreen
if fullscreen {
app.W.MainWindow.Fullscreen()
} else {
app.W.MainWindow.Unfullscreen()
}
app.toggleFullscreen(fullscreen)
app.W.MenuItemFullscreen.SetActive(fullscreen)
}
func (app *App) setHideUI(hideUI bool) {
app.Config.HideUI = hideUI
if hideUI {
app.W.Menubar.Hide()
app.W.Toolbar.Hide()
app.W.Statusbar.Hide()
} else {
app.W.Menubar.Show()
app.W.Toolbar.Show()
app.W.Statusbar.Show()
}
app.toggleHideUI(hideUI)
app.W.MenuItemHideUI.SetActive(hideUI)
app.S.UITemporarilyRevealed = false
}
func (app *App) setShrink(shrink bool) {

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

11
go.mod
View file

@ -2,11 +2,12 @@ module github.com/fauu/gomicsv
replace github.com/fauu/gomicsv => ./
go 1.17
go 1.20
require (
github.com/flytam/filenamify v1.1.0
github.com/gotk3/gotk3 v0.6.1
github.com/spf13/pflag v1.0.5
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6
github.com/flytam/filenamify v1.2.0
github.com/gotk3/gotk3 v0.6.3
github.com/nwaples/rardecode/v2 v2.0.0-beta.2
github.com/spf13/pflag v1.0.5
golang.org/x/sys v0.24.0
)

30
go.sum
View file

@ -1,16 +1,22 @@
github.com/diamondburned/gotk4 v0.0.3-0.20220418035147-8a785583d00a h1:u+75gz/SWdpIWJaD0TFR4lgmz+s0JUkKfLXgJesf+GQ=
github.com/diamondburned/gotk4 v0.0.3-0.20220418035147-8a785583d00a/go.mod h1:WbOkeM91aOubLbxqcbYwd7q/HCKxAmqObvT5Dhpzm1Y=
github.com/diamondburned/gotk4/pkg v0.0.0-20220418035147-8a785583d00a h1:UrzOwwQiOLckSyU1ETP66Qz9XV/vvVCn0RS1YTY1prk=
github.com/diamondburned/gotk4/pkg v0.0.0-20220418035147-8a785583d00a/go.mod h1:rLH6FHos690jFgAM/GYEpMykuE/9NmN6zOvFlr8JTvE=
github.com/flytam/filenamify v1.1.0 h1:iEOcC/1UgxJf4lp2E2CWtYO7TMyYmgb2RPSTou89FLs=
github.com/flytam/filenamify v1.1.0/go.mod h1:Dzf9kVycwcsBlr2ATg6uxjqiFgKGH+5SKFuhdeP5zu8=
github.com/gotk3/gotk3 v0.6.0 h1:Aqlq4/6VabNwtCyA9M9zFNad5yHAqCi5heWnZ9y+3dA=
github.com/gotk3/gotk3 v0.6.0/go.mod h1:/hqFpkNa9T3JgNAE2fLvCdov7c5bw//FHNZrZ3Uv9/Q=
github.com/flytam/filenamify v1.1.2 h1:dGlfWU4zrhDlsmvob4IFcfgjG5vIjfo4UwLyec6Wx94=
github.com/flytam/filenamify v1.1.2/go.mod h1:Dzf9kVycwcsBlr2ATg6uxjqiFgKGH+5SKFuhdeP5zu8=
github.com/flytam/filenamify v1.2.0 h1:7RiSqXYR4cJftDQ5NuvljKMfd/ubKnW/j9C6iekChgI=
github.com/flytam/filenamify v1.2.0/go.mod h1:Dzf9kVycwcsBlr2ATg6uxjqiFgKGH+5SKFuhdeP5zu8=
github.com/gotk3/gotk3 v0.6.1 h1:GJ400a0ecEEWrzjBvzBzH+pB/esEMIGdB9zPSmBdoeo=
github.com/gotk3/gotk3 v0.6.1/go.mod h1:/hqFpkNa9T3JgNAE2fLvCdov7c5bw//FHNZrZ3Uv9/Q=
github.com/gotk3/gotk3 v0.6.2 h1:sx/PjaKfKULJPTPq8p2kn2ZbcNFxpOJqi4VLzMbEOO8=
github.com/gotk3/gotk3 v0.6.2/go.mod h1:/hqFpkNa9T3JgNAE2fLvCdov7c5bw//FHNZrZ3Uv9/Q=
github.com/gotk3/gotk3 v0.6.3 h1:+Ke4WkM1TQUNOlM2TZH6szqknqo+zNbX3BZWVXjSHYw=
github.com/gotk3/gotk3 v0.6.3/go.mod h1:/hqFpkNa9T3JgNAE2fLvCdov7c5bw//FHNZrZ3Uv9/Q=
github.com/gotk3/gotk3 v0.6.4 h1:5ur/PRr86PwCG8eSj98D1eXvhrNNK6GILS2zq779dCg=
github.com/gotk3/gotk3 v0.6.4/go.mod h1:/hqFpkNa9T3JgNAE2fLvCdov7c5bw//FHNZrZ3Uv9/Q=
github.com/nwaples/rardecode/v2 v2.0.0-beta.2 h1:e3mzJFJs4k83GXBEiTaQ5HgSc/kOK8q0rDaRO0MPaOk=
github.com/nwaples/rardecode/v2 v2.0.0-beta.2/go.mod h1:yntwv/HfMc/Hbvtq9I19D1n58te3h6KsqCf3GxyfBGY=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5 h1:y/woIyUBFbpQGKS0u1aHF/40WUDnek3fPOyD08H5Vng=
golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 h1:nonptSpoQ4vQjyraW20DXPAglgQfVnM9ZC6MmNLMR60=
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
Copyright (c) 2021-2022 Piotr Grabowski
Copyright (c) 2021-2024 Piotr Grabowski
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -23,6 +23,7 @@
<mime-types>
<mime-type>application/zip</mime-type>
<mime-type>application/x-cbz</mime-type>
<mime-type>application/vnd.rar</mime-type>
</mime-types>
</object>
<object class="GtkRecentFilter" id="RecentFilter">
@ -168,6 +169,28 @@
<object class="GtkMenu" id="MenuView">
<property name="visible">true</property>
<property name="can-focus">false</property>
<child>
<object class="GtkCheckMenuItem" id="MenuItemFullscreen">
<property name="visible">true</property>
<property name="can-focus">false</property>
<property name="label" translatable="yes">Fullscreen</property>
<property name="use-underline">true</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="MenuItemHideUI">
<property name="visible">true</property>
<property name="can-focus">false</property>
<property name="label" translatable="yes">Hide UI</property>
<property name="use-underline">true</property>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="menuitem0">
<property name="visible">true</property>
<property name="can-focus">false</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="MenuItemShrink">
<property name="visible">true</property>
@ -243,22 +266,6 @@
<property name="can-focus">false</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="MenuItemFullscreen">
<property name="visible">true</property>
<property name="can-focus">false</property>
<property name="label" translatable="yes">Fullscreen</property>
<property name="use-underline">true</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="MenuItemHideUI">
<property name="visible">true</property>
<property name="can-focus">false</property>
<property name="label" translatable="yes">Hide UI</property>
<property name="use-underline">true</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="MenuItemSeamless">
<property name="visible">true</property>
@ -726,7 +733,7 @@
<property name="transient-for">MainWindow</property>
<property name="program-name">Gomics-v</property>
<property name="copyright" translatable="yes">Copyright (c) 20132021 Utkan Güngördü
Copyright (c) 20212022 Piotr Grabowski</property>
Copyright (c) 20212024 Piotr Grabowski</property>
<property name="comments" translatable="yes">Gomics-v is a GTK comic and image archive viewer written in Go, available under the GNU GPL v3 or later.</property>
<property name="website">https://github.com/fauu/gomicsv</property>
<property name="authors">Utkan Güngördü, Piotr Grabowski</property>

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

2
gtk.go
View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -35,6 +35,12 @@ func (app *App) imageAreaInit() {
})
app.W.ScrolledWindow.Connect("button-press-event", func(self *gtk.ScrolledWindow, event *gdk.Event) bool {
if app.S.UITemporarilyRevealed {
app.S.UITemporarilyRevealed = false
app.toggleHideUI(true)
return true
}
be := &gdk.EventButton{Event: event}
switch be.Button() {
case 1:

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -25,6 +25,7 @@ import (
"fmt"
"log"
"net/http"
"net/url"
"github.com/gotk3/gotk3/gdk"
)
@ -166,6 +167,6 @@ func kamiteSendOCRImageCommand(port int, imgBytes []byte, w, h int) {
}
func kamiteMakeEndpointURL(port int, suffix string) string {
// TODO(fau): Go 1.19+ url.JoinPath()
return fmt.Sprintf(kamiteCMDEndpointBaseTpl, port) + suffix
path, _ := url.JoinPath(fmt.Sprintf(kamiteCMDEndpointBaseTpl, port), suffix)
return path
}

2
md5.go
View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -293,7 +293,7 @@ func (app *App) currentArchiveIdx() (idx int, err error) {
}
}
if idx == -1 {
return 0, errors.New("Couldn't find the current archive in the current dir. Deleted, perhaps?")
return 0, errors.New("could not find the current archive in the current directory. Deleted, perhaps?")
}
return
}
@ -321,7 +321,7 @@ func (app *App) archiveNameRelativeToCurrent(relIdx int) (newName string, err er
idx := currIdx + relIdx
if idx < 0 || idx >= len(arNames) {
err = errors.New("No more archives in the directory")
err = errors.New("no more archives in the directory")
return
}

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -95,6 +95,7 @@ func (app *App) scroll(dx, dy float64) {
}
func (app *App) scrollToStart() {
app.W.ScrolledWindow.SetVAdjustment(nil) // Needed to prevent a bug where it scrolls back by itself
app.W.ScrolledWindow.GetVAdjustment().SetValue(0) // Vertical: top
var newHadj float64 = 0
@ -102,18 +103,21 @@ func (app *App) scrollToStart() {
imgw, _ := app.getImageAreaInnerSize()
newHadj = float64(imgw)
}
app.W.ScrolledWindow.SetHAdjustment(nil)
app.W.ScrolledWindow.GetHAdjustment().SetValue(newHadj) // Horizontal: left (non-manga) or right (manga) edge
}
func (app *App) scrollToEnd() {
imgw, imgh := app.getImageAreaInnerSize()
app.W.ScrolledWindow.SetVAdjustment(nil)
app.W.ScrolledWindow.GetVAdjustment().SetValue(float64(imgh)) // Vertical: bottom
var newHadj float64 = 0
if !app.Config.MangaMode {
newHadj = float64(imgw)
}
app.W.ScrolledWindow.SetHAdjustment(nil)
app.W.ScrolledWindow.GetHAdjustment().SetValue(newHadj) // Horizontal: left (manga) or right (non-manga) edge
}

41
standard_paths_darwin.go Normal file
View file

@ -0,0 +1,41 @@
//go:build darwin
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gomicsv
import (
"errors"
"os"
"path/filepath"
)
func getConfigLocation(appName string) (string, error) {
return getUserDataLocation(appName)
}
func getUserDataLocation(appName string) (string, error) {
if appName == "" {
return "", errors.New("'appName' is empty")
}
if envHome := os.Getenv("HOME"); envHome != "" {
return filepath.Join(envHome, "Library", "Application Support", appName), nil
}
return "", errors.New("getting user appdata directory")
}

41
standard_paths_windows.go Normal file
View file

@ -0,0 +1,41 @@
//go:build windows
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gomicsv
import (
"errors"
"os"
"path/filepath"
)
func getConfigLocation(appName string) (string, error) {
return getUserDataLocation(appName)
}
func getUserDataLocation(appName string) (string, error) {
if appName == "" {
return "", errors.New("'appName' is empty")
}
if envAppdata := os.Getenv("APPDATA"); envAppdata != "" {
return filepath.Join(envAppdata, appName), nil
}
return "", errors.New("getting user appdata directory")
}

View file

@ -1,9 +1,8 @@
//go:build linux
// +build linux
//go:build freebsd || linux || netbsd || openbsd || solaris
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

22
ui.go
View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -119,3 +119,23 @@ func (app *App) syncWidgetsToConfig() {
app.W.KamitePortContainer.SetSensitive(app.Config.KamiteEnabled)
app.W.KamitePortEntry.SetText(fmt.Sprint(app.Config.KamitePort))
}
func (app *App) toggleHideUI(hideUI bool) {
if hideUI {
app.W.Menubar.Hide()
app.W.Toolbar.Hide()
app.W.Statusbar.Hide()
} else {
app.W.Menubar.Show()
app.W.Toolbar.Show()
app.W.Statusbar.Show()
}
}
func (app *App) toggleFullscreen(fullscreen bool) {
if fullscreen {
app.W.MainWindow.Fullscreen()
} else {
app.W.MainWindow.Unfullscreen()
}
}

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2021 Utkan Güngördü <utkan@freeconsole.org>
* Copyright (c) 2021-2022 Piotr Grabowski
* Copyright (c) 2021-2024 Piotr Grabowski
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by