Skip to content

Commit

Permalink
Specify root-path as constant, update to v2.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
lehitoskin committed Apr 29, 2017
1 parent 2c28d64 commit 75ca3ff
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Makefile.posix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DESTDIR = /usr/local
DOCDIR = "$(DESTDIR)/share/doc/ivy-2.2.1"
DOCDIR = "$(DESTDIR)/share/doc/ivy-2.2.2"
MANDIR = "$(DESTDIR)/share/man/man1"

RACO = raco
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tracked solely by the application.
- [gif-image](https://github.com/lehitoskin/gif-image)
- [png-image](https://github.com/lehitoskin/png-image)
- [racquel](https://github.com/brown131/racquel)
- [riff](https://github.com/lehitoskin/riff) (which uses FLIF, see below)
- [riff](https://github.com/lehitoskin/riff) v0.2 (which uses FLIF v0.3, see below)
- [rsvg](https://github.com/takikawa/rsvg) (which uses librsvg)
- [sugar](https://github.com/mbutterick/sugar)
- [txexpr](https://github.com/mbutterick/txexpr)
Expand Down
8 changes: 4 additions & 4 deletions base.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
(define (macosx?)
(eq? (system-type) 'macosx))

(define root-path
(define +root-path+
(if (eq? (system-type) 'windows)
(build-path "C:\\")
(build-path "/")))
; path of the currently displayed image
(define image-path (make-parameter root-path))
(define image-path (make-parameter +root-path+))
; master bitmap of loaded image-path
(define image-bmp-master (make-bitmap 50 50))
; pict of the currently displayed image
Expand Down Expand Up @@ -137,7 +137,7 @@
; parameter listof path
; if pfs is empty, attempting to append a single image would
; make pfs just that image, rather than a list of length 1
(define pfs (make-parameter (list root-path)))
(define pfs (make-parameter (list +root-path+)))

(define (string->taglist str)
(cond [(string-null? str) empty]
Expand Down Expand Up @@ -938,7 +938,7 @@
; curried procedure to abstract loading an image in a collection
; mmm... curry
(define ((load-image-in-collection direction))
(unless (equal? (image-path) root-path)
(unless (equal? (image-path) +root-path+)
; kill the animation thread, if applicable
(unless (or (false? (animation-thread)) (thread-dead? (animation-thread)))
(kill-thread (animation-thread)))
Expand Down
Binary file modified doc/ivy.1.bz2
Binary file not shown.
2 changes: 1 addition & 1 deletion doc/ivy.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
% IVY(1) Ivy Image Viewer | Version 2.2.1
% IVY(1) Ivy Image Viewer | Version 2.2.2

# NAME
Ivy Image Viewer
Expand Down
2 changes: 1 addition & 1 deletion files.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
racket/file)
(provide (all-defined-out))

(define ivy-version "2.2.1")
(define ivy-version "2.2.2")

; base directory where ivy will put all of its files
(define ivy-path
Expand Down
48 changes: 24 additions & 24 deletions frame.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
(when paths
(cond
; empty collection, adding images and load the first in the list
[(equal? (first (pfs)) root-path)
[(equal? (first (pfs)) +root-path+)
(define img-path (first paths))
(define-values (base name dir?) (split-path img-path))
(image-dir base)
Expand Down Expand Up @@ -267,7 +267,7 @@
(unless (empty? paths)
(cond
; empty collection, adding images and load the first in the list
[(equal? (first (pfs)) root-path)
[(equal? (first (pfs)) +root-path+)
(define img-path (first paths))
(define-values (base name dir?) (split-path img-path))
(image-dir base)
Expand Down Expand Up @@ -310,8 +310,8 @@
(flif-destroy-decoder! (decoder))
(decoder #f))
(image-dir (find-system-path 'home-dir))
(pfs (list root-path))
(image-path root-path)
(pfs (list +root-path+))
(image-path +root-path+)
(send (ivy-canvas) set-on-paint!
(λ (canvas dc)
(send canvas set-canvas-background color-black)))
Expand Down Expand Up @@ -448,7 +448,7 @@
[checked (want-animation?)]
[callback (λ (i e)
(want-animation? (send i is-checked?))
(when (and (not (equal? (image-path) root-path))
(when (and (not (equal? (image-path) +root-path+))
(or (and (gif? (image-path))
(gif-animated? (image-path)))
(and (flif? (image-path))
Expand Down Expand Up @@ -484,7 +484,7 @@
[parent ivy-menu-bar-view-zoom-to]
[label (format "~a%" n)]
[callback (λ (i e)
(unless (equal? (image-path) root-path)
(unless (equal? (image-path) +root-path+)
(collect-garbage 'incremental)
(if (empty? image-lst-master)
(load-image (bitmap image-bmp-master) n)
Expand All @@ -496,7 +496,7 @@
[label "Rotate left"]
[help-string "Rotate the image left."]
[callback (λ (i e)
(unless (equal? (image-path) root-path)
(unless (equal? (image-path) +root-path+)
(collect-garbage 'incremental)
(load-image (rotate image-pict (/ pi 2)) 'same)))]))

Expand All @@ -506,7 +506,7 @@
[label "Rotate right"]
[help-string "Rotate the image right."]
[callback (λ (i e)
(unless (equal? (image-path) root-path)
(unless (equal? (image-path) +root-path+)
(collect-garbage 'incremental)
(load-image (rotate image-pict (- (/ pi 2))) 'same)))]))

Expand All @@ -516,7 +516,7 @@
[label "Flip horizontal"]
[help-string "Flip the image horizontally."]
[callback (λ (i e)
(unless (equal? (image-path) root-path)
(unless (equal? (image-path) +root-path+)
(define flo
(flomap-flip-horizontal (bitmap->flomap (pict->bitmap image-pict))))
(collect-garbage 'incremental)
Expand All @@ -528,7 +528,7 @@
[label "Flip vertical"]
[help-string "Flip the image vertically."]
[callback (λ (i e)
(unless (equal? (image-path) root-path)
(unless (equal? (image-path) +root-path+)
(define flo
(flomap-flip-vertical (bitmap->flomap (pict->bitmap image-pict))))
(collect-garbage 'incremental)
Expand All @@ -540,7 +540,7 @@
[label "Sort Alphabetically"]
[help-string "Sort the current collection alphabetically."]
[callback (λ (i e)
(unless (equal? (image-path) root-path)
(unless (equal? (image-path) +root-path+)
(define new-pfs (sort (pfs) path<?))
(pfs new-pfs)
(send (status-bar-position)
Expand All @@ -555,7 +555,7 @@
[label "Sort by High Rating"]
[help-string "Sort the current collection by highest Rating."]
[callback (λ (i e)
(unless (equal? (image-path) root-path)
(unless (equal? (image-path) +root-path+)
; read the database entries for ratings
(define ratings
(for/list ([img (in-list (map path->string (pfs)))])
Expand All @@ -580,7 +580,7 @@
[label "Sort by Low Rating"]
[help-string "Sort the current collection by lowest Rating."]
[callback (λ (i e)
(unless (equal? (image-path) root-path)
(unless (equal? (image-path) +root-path+)
; read the database entries for ratings
(define ratings
(for/list ([img (in-list (map path->string (pfs)))])
Expand Down Expand Up @@ -687,7 +687,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>."
[label (pict->bitmap (hc-append -12 (circle 15) (text "+ ")))]
[callback (λ (button event)
; do nothing if we've pressed ctrl+n
(unless (equal? (image-path) root-path)
(unless (equal? (image-path) +root-path+)
(collect-garbage 'incremental)
(if (and image-pict
(empty? image-lst))
Expand All @@ -700,7 +700,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>."
[label (pict->bitmap (hc-append -10 (circle 15) (text "- ")))]
[callback (λ (button event)
; do nothing if we've pressed ctrl+n
(unless (equal? (image-path) root-path)
(unless (equal? (image-path) +root-path+)
(collect-garbage 'incremental)
(if (and image-pict
(empty? image-lst))
Expand All @@ -713,7 +713,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>."
[label (pict->bitmap (rectangle 15 15))]
[callback (λ (button event)
; do nothing if we've pressed ctrl+n
(unless (equal? (image-path) root-path)
(unless (equal? (image-path) +root-path+)
(collect-garbage 'incremental)
(if (empty? image-lst)
(load-image image-bmp-master 'none)
Expand All @@ -725,7 +725,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>."
[label (pict->bitmap (hc-append -3 (frame (circle 15)) (text " ")))]
[callback (λ (button event)
; do nothing if we've pressed ctrl+n
(unless (equal? (image-path) root-path)
(unless (equal? (image-path) +root-path+)
(collect-garbage 'incremental)
(if (empty? image-lst)
(load-image image-bmp-master)
Expand All @@ -744,7 +744,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>."
[callback (λ (choice evt)
; do nothing if we've pressed ctrl+n or if the
; image cannot embed metadata
(unless (or (equal? (image-path) root-path)
(unless (or (equal? (image-path) +root-path+)
(not (embed-support? (image-path))))
(define img (image-path))

Expand Down Expand Up @@ -794,7 +794,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>."
(thread set-xmp:rating!))])))]))

(define (on-escape-key tfield)
(unless (equal? (image-path) root-path)
(unless (equal? (image-path) +root-path+)
(send tfield set-field-background color-white)
(define-values (base name-path must-be-dir?) (split-path (image-path)))
(if (string=? (send tfield get-value) (incoming-tags))
Expand Down Expand Up @@ -822,7 +822,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>."
[stretchable-height #f]
[callback
(λ (tf evt)
(unless (equal? (image-path) root-path)
(unless (equal? (image-path) +root-path+)
(define img (image-path))
(define img-str (path->string img))
(define-values (base name-path must-be-dir?) (split-path img))
Expand Down Expand Up @@ -870,7 +870,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>."
[label "Set"]
[callback
(λ (button event)
(unless (equal? (image-path) root-path)
(unless (equal? (image-path) +root-path+)
(define img (image-path))
(define img-str (path->string img))
(define-values (base name-path must-be-dir?) (split-path (image-path)))
Expand Down Expand Up @@ -937,7 +937,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>."
(cond
; empty collection, adding 1 image
; like file-open, but only open the single image
[(equal? (first (pfs)) root-path)
[(equal? (first (pfs)) +root-path+)
(define-values (base name dir?) (split-path pathname))
(image-dir base)
(pfs (list pathname))
Expand Down Expand Up @@ -968,15 +968,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>."
(case type
[(wheel-down)
; do nothing if we've pressed ctrl+n
(unless (equal? (image-path) root-path)
(unless (equal? (image-path) +root-path+)
(collect-garbage 'incremental)
(if (and image-pict
(empty? image-lst))
(load-image image-pict 'wheel-smaller)
(load-image image-lst 'wheel-smaller)))]
[(wheel-up)
; do nothing if we've pressed ctrl+n
(unless (equal? (image-path) root-path)
(unless (equal? (image-path) +root-path+)
(collect-garbage 'incremental)
(if (and image-pict
(empty? image-lst))
Expand Down
6 changes: 3 additions & 3 deletions meta-editor.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
[else empty]))

(define (ok-callback)
(unless (equal? (image-path) root-path)
(unless (equal? (image-path) +root-path+)
(define type (send xmp-lbox get-string-selection))
(when type
(define elems (send dc-tfield get-value))
Expand Down Expand Up @@ -229,7 +229,7 @@
[choices (append dublin-core xmp-base)]
[selection 11]
[callback (λ (lbox evt)
(unless (or (equal? (image-path) root-path)
(unless (or (equal? (image-path) +root-path+)
(not (embed-support? (image-path))))
(define str (send lbox get-string-selection))
; just in case get-string-selection returns #f
Expand Down Expand Up @@ -381,7 +381,7 @@
(define (show-meta-frame)
(fields-defaults)
(define img (image-path))
(when (and (not (equal? img root-path))
(when (and (not (equal? img +root-path+))
(embed-support? img))
; wait for any previous xmp-threads to complete
(let loop ()
Expand Down
2 changes: 1 addition & 1 deletion thumbnails.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"files.rkt")
(provide path->md5 generate-thumbnails)

; convert the path-string to a valid URI
(define/contract (path->uri path)
(path-string? . -> . string?)
; convert the path-string to a valid URI
(define path-lst (explode-path path))
; the first entry is going to be garbled, so omit that part
(define encoded (map (compose1 uri-encode path->string) (rest path-lst)))
Expand Down

0 comments on commit 75ca3ff

Please sign in to comment.