Skip to content

Commit ada6a5b

Browse files
committed
Add logo to frames, move code around
1 parent 00ad217 commit ada6a5b

File tree

4 files changed

+28
-28
lines changed

4 files changed

+28
-28
lines changed

base.rkt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,18 @@
107107
str
108108
(substring str 0 n)))
109109

110+
; awww yeah... so oldskool...
111+
(define (remove-children parent kids)
112+
(when (> (length kids) 0)
113+
(send parent delete-child (car kids))
114+
(remove-children parent (cdr kids))))
115+
116+
; just check out those tail recursions...
117+
(define (add-children parent kids)
118+
(when (> (length kids) 0)
119+
(send parent add-child (car kids))
120+
(add-children parent (cdr kids))))
121+
110122
; objects that will be used extensively in transparency-grid
111123
(define dgray-color (make-object color% 128 128 128))
112124
(define lgray-color (make-object color% 204 204 204))

db-statistics.rkt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,24 @@
44
racket/format
55
racket/gui/base
66
racket/list
7-
"db.rkt")
7+
"base.rkt"
8+
"db.rkt"
9+
"files.rkt")
810
(provide stats-frame update-stats)
911

1012
(define stats-frame (new frame%
1113
[label "Ivy Statistics"]
1214
[width 800]
1315
[height 100]))
1416

17+
(unless (macosx?)
18+
(send stats-frame set-icon (read-bitmap logo)))
19+
1520
(define stats-vpanel
1621
(new vertical-panel%
1722
[parent stats-frame]
1823
[alignment '(left center)]))
1924

20-
(define (remove-children)
21-
(for ([child (in-list (send stats-vpanel get-children))])
22-
(send stats-vpanel delete-child child)))
23-
2425
(define (greater lst [num 0] [name ""])
2526
(cond [(empty? lst) (values num name)]
2627
[else
@@ -62,5 +63,5 @@
6263
(void))
6364

6465
(define (update-stats)
65-
(remove-children)
66+
(remove-children stats-vpanel (send stats-vpanel get-children))
6667
(create-children))

frame.rkt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,6 @@
6060

6161
;; Fullscreen handling ;;
6262

63-
; awww yeah... so oldskool...
64-
(define (remove-children parent kids)
65-
(when (> (length kids) 0)
66-
(send parent delete-child (car kids))
67-
(remove-children parent (cdr kids))))
68-
69-
; just check out those tail recursions...
70-
(define (add-children parent kids)
71-
(when (> (length kids) 0)
72-
(send parent add-child (car kids))
73-
(add-children parent (cdr kids))))
74-
7563
(define (toggle-fullscreen canvas frame)
7664
(define was-fullscreen? (send frame is-fullscreened?))
7765
(define going-to-be-fullscreen? (not was-fullscreen?))

tag-browser.rkt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
racket/gui/base
66
racket/string
77
"base.rkt"
8-
"db.rkt")
8+
"db.rkt"
9+
"files.rkt")
910
(provide show-tag-browser)
1011

1112
(define browser-frame
@@ -14,6 +15,10 @@
1415
[width 800]
1516
[height 500]))
1617

18+
; set the icon for the frame
19+
(unless (macosx?)
20+
(send browser-frame set-icon (read-bitmap logo)))
21+
1722
; begin menu bar definitions
1823

1924
(define browser-menu-bar
@@ -144,9 +149,7 @@
144149
; 15 the tallest any column can be
145150
(define tag-grid (grid-list (image-taglist img-label) 15))
146151
; remove any children vpanel might have
147-
(define children (send edit-tags-check-hpanel get-children))
148-
(unless (null? children)
149-
(map (λ (child) (send edit-tags-check-hpanel delete-child child)) children))
152+
(remove-children edit-tags-check-hpanel (send edit-tags-check-hpanel get-children))
150153
; loop over the tag sections
151154
(for ([tag-section (in-list tag-grid)])
152155
(define vpanel-section
@@ -259,9 +262,7 @@
259262
(generate-thumbnails (list img-str)))
260263
(send thumb-bmp load-file thumb-path)
261264
; remove old thumb-button
262-
(define vpanel-children (send thumb-vpanel get-children))
263-
(unless (null? vpanel-children)
264-
(send thumb-vpanel delete-child (car (send thumb-vpanel get-children))))
265+
(remove-children thumb-vpanel (send thumb-vpanel get-children))
265266
; generate new thumb-button
266267
(new button%
267268
[parent thumb-vpanel]
@@ -303,9 +304,7 @@
303304
(send tag-lbox clear)
304305
(send img-lbox clear)
305306
; remove old thumb-button
306-
(define vpanel-children (send thumb-vpanel get-children))
307-
(unless (null? vpanel-children)
308-
(send thumb-vpanel delete-child (car (send thumb-vpanel get-children))))
307+
(remove-children thumb-vpanel (send thumb-vpanel get-children))
309308
; get every tag in the database
310309
(define tag-labels (sort (table-column 'tags 'Tag_Label) string<?))
311310
; add them to the list-box

0 commit comments

Comments
 (0)