|
@@ -1,13 +1,14 @@
|
|
|
+
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
-;;;;;;;;;;;;;;;;;;;;;; PHOTOGAL ;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
+;;;;;;;;;;;;;;;;;;;;;; PHOTOGAL ;;;;;;;;;;;;;;;;;;;;;`;
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; v1.0 ;;;;;;
|
|
|
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*;;;
|
|
|
;; ;;
|
|
|
;; author: jordyn , - * ;;
|
|
|
;; authored: spokane valley, summer '22 . ` ;;
|
|
|
-;; ^ ~ ';
|
|
|
-;; PHOTO * , ' . ` ` * , ;;
|
|
|
-;; , Grouper ' ` . ,* - . ;;
|
|
|
+;; * ^ ~ ';
|
|
|
+;; PHOTO * , ' . ` * , ;;
|
|
|
+;; , Grouper ' ` . * - . ;;
|
|
|
;; . And , ^ ' . ' . ` ` ' ;;
|
|
|
;; ` Labeler ' , * ' * ;;
|
|
|
;; , . , ` ' . ;;
|
|
@@ -68,21 +69,29 @@
|
|
|
(photogal--set-name (photogal--lookup-photo photo-filepath) name))
|
|
|
|
|
|
;; // internal \\ ;;
|
|
|
-(defun photogal--get-filepath (photo)
|
|
|
- (car photo))
|
|
|
(defun photogal--lookup-photo (photo-filepath)
|
|
|
(assoc photo-filepath *photogal/operating-table*))
|
|
|
+
|
|
|
+(defun photogal--get-filepath (photo)
|
|
|
+ (plist-get photo 'filepath))
|
|
|
(defun photogal--get-tags (photo)
|
|
|
"What are all the tags for this file?"
|
|
|
- (caadr photo))
|
|
|
+ (plist-get photo 'tags))
|
|
|
(defun photogal--set-tags (photo tags)
|
|
|
- (setcar (cadr photo)
|
|
|
- tags))
|
|
|
+ (plist-put photo 'tags
|
|
|
+ tags))
|
|
|
+(defun photogal--get-folders (photo)
|
|
|
+ "What are all the folders for this file?"
|
|
|
+ (plist-get photo 'folders))
|
|
|
+(defun photogal--set-folders (photo folders)
|
|
|
+ (plist-put photo 'folders
|
|
|
+ folders))
|
|
|
(defun photogal--get-name (photo)
|
|
|
- (cadadr photo))
|
|
|
+ (plist-get photo 'name))
|
|
|
(defun photogal--set-name (photo name)
|
|
|
- (setcar (cdadr photo)
|
|
|
- name))
|
|
|
+ (plist-put photo 'name
|
|
|
+ name))
|
|
|
+
|
|
|
;; \\ internal // ;;
|
|
|
|
|
|
(defun photogal-advance-photo ()
|
|
@@ -115,11 +124,15 @@
|
|
|
|
|
|
;;;; -- ---- -- - INITIALIZATION - -- ---- -- ;;;;
|
|
|
|
|
|
+(defun photogal-make-photo (filepath)
|
|
|
+ `(filepath ,filepath
|
|
|
+ tags ()
|
|
|
+ name nil))
|
|
|
+
|
|
|
(defun photogal-init-operating-table ()
|
|
|
(setq *photogal/operating-table*
|
|
|
(mapcar (lambda (photo)
|
|
|
- ;; '(old-file-path (tags optional-name))
|
|
|
- (list photo (list '() nil)))
|
|
|
+ (photogal-make-photo photo))
|
|
|
*photogal/all-photos*)))
|
|
|
|
|
|
(defun photogal-generate-tag-commands ()
|
|
@@ -143,7 +156,8 @@ for all tags defined -- one function per tag."
|
|
|
(if (or tag-code-too-long tag-code-in-use)
|
|
|
(progn (message "tag code must be a single character and can't be already in use")
|
|
|
(call-interactively 'photogal-add-tag))
|
|
|
- (photogal--add-tag new-tag new-tag-code))))
|
|
|
+ (photogal--add-tag new-tag new-tag-code)
|
|
|
+ (photogal-refresh-buffer))))
|
|
|
|
|
|
(defun photogal-delete-tag (tag-code)
|
|
|
"Remove a tag from the library."
|
|
@@ -159,8 +173,7 @@ for all tags defined -- one function per tag."
|
|
|
(customize-save-variable
|
|
|
'photogal/tags
|
|
|
(cons (cons new-tag-code escaped-str-tag) photogal/tags)))
|
|
|
- (photogal-generate-tag-commands)
|
|
|
- (photogal-refresh-buffer))
|
|
|
+ (photogal-generate-tag-commands))
|
|
|
|
|
|
(defun photogal-tag-code-in-use (tag-code)
|
|
|
(seq-contains-p
|
|
@@ -181,13 +194,6 @@ for all tags defined -- one function per tag."
|
|
|
(photogal-set-tags-for-file file
|
|
|
(seq-sort #'string< (seq-uniq (cons tag tags))))))
|
|
|
|
|
|
-(defun photogal-name-the-file (name)
|
|
|
- (interactive "sWhat do u want to name this file? ")
|
|
|
- (photogal-set-name-for-file
|
|
|
- (photogal-current-file)
|
|
|
- (string-replace " " "-" name))
|
|
|
- (photogal-refresh-buffer))
|
|
|
-
|
|
|
(defun photogal-rm-tag-from-file (file tag)
|
|
|
"Dissociate tag from file."
|
|
|
(defun tags-without-tag (tags tag)
|
|
@@ -205,6 +211,16 @@ for all tags defined -- one function per tag."
|
|
|
(let ((tags (photogal-get-tags-for-file file)))
|
|
|
(seq-contains-p tags tag)))
|
|
|
|
|
|
+
|
|
|
+;;;; -- ---- -- - FILE NAME - -- ---- -- ;;;;
|
|
|
+
|
|
|
+(defun photogal-name-the-file (name)
|
|
|
+ (interactive "sWhat do u want to name this file? ")
|
|
|
+ (photogal-set-name-for-file
|
|
|
+ (photogal-current-file)
|
|
|
+ (string-replace " " "-" name))
|
|
|
+ (photogal-refresh-buffer))
|
|
|
+
|
|
|
;;;; -- ---- -- - FILE OPS - -- ---- -- ;;;;
|
|
|
|
|
|
(defun photogal-all-photos (directory)
|
|
@@ -218,11 +234,12 @@ for all tags defined -- one function per tag."
|
|
|
|
|
|
;;;; -- ---- -- - U I - -- ---- -- ;;;;
|
|
|
(defun photogal-init (photo-file-path &optional show-filepath)
|
|
|
- "Set everything up in the buffer."
|
|
|
+ "Set everything up in the buffer."
|
|
|
(let ((buf (get-buffer-create "photogal")))
|
|
|
(with-current-buffer buf
|
|
|
(photogal-mode)
|
|
|
(erase-buffer)
|
|
|
+ (photogal-index-tracker)
|
|
|
(insert "\n")
|
|
|
(insert " ")
|
|
|
(insert-image
|
|
@@ -274,7 +291,27 @@ for all tags defined -- one function per tag."
|
|
|
(interactive)
|
|
|
(photogal-refresh-buffer t))
|
|
|
|
|
|
+(defun photogal-index-tracker ()
|
|
|
+ ;; this is a little expensive, running photogal-all-photos
|
|
|
+ ;; on every paint, but i'd like to have the file count
|
|
|
+ ;; be very accurate.
|
|
|
+ (let ((current-index
|
|
|
+ (+ 1 (seq-position
|
|
|
+ (photogal-all-photos *photogal/photos-origin-directory*)
|
|
|
+ (photogal-current-file))))
|
|
|
+ (total-photos
|
|
|
+ (length (photogal-all-photos *photogal/photos-origin-directory*))))
|
|
|
+ (insert "ur lookin at photo ")
|
|
|
+ (photogal--insert-print-color current-index "red")
|
|
|
+ (insert " of ")
|
|
|
+ (photogal--insert-print-color total-photos "red")))
|
|
|
+
|
|
|
+
|
|
|
;;;; -- ---- -- - LO-LEVEL DISPLAY - -- ---- -- ;;;;
|
|
|
+;; this stuff paints the words on the screen, changing ;;
|
|
|
+;; color, etc, pprinting stuff at a pretty granular and ;;
|
|
|
+;; tediously technical level. ;;
|
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
(defun photogal-insert-tags-to-buffer (tags)
|
|
|
"Pretty print the tags with their toggle key."
|
|
@@ -319,6 +356,8 @@ for all tags defined -- one function per tag."
|
|
|
(put-text-property beg (point) 'font-lock-face `(:foreground ,color))))
|
|
|
|
|
|
;;;; -- ---- -- - META SHIT - -- ---- -- ;;;;
|
|
|
+;; this is the coolest damn thing here. ;;
|
|
|
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
(defmacro photogal-generate-tagger (name)
|
|
|
"Generate function to toggle a tag which is itself on the current file.
|
|
@@ -399,6 +438,7 @@ the current file."
|
|
|
(define-key photogal-mode-map (kbd "G") 'photogal-refresh-buffer)
|
|
|
(define-key photogal-mode-map (kbd "RET") 'photogal-next-file)
|
|
|
(define-key photogal-mode-map (kbd "<right>") 'photogal-next-file)
|
|
|
+ (define-key photogal-mode-map (kbd "SPC") 'photogal-next-file)
|
|
|
(define-key photogal-mode-map (kbd "P") 'photogal-prev-file)
|
|
|
(define-key photogal-mode-map (kbd "<left>") 'photogal-prev-file)
|
|
|
(define-key photogal-mode-map (kbd "A") 'photogal-add-tag)
|