menu.lisp 31 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
;;
;; Copyright 2002, 2009 Genworks International and Genworks BV 
;;
;; This source file is part of the General-purpose Declarative
;; Language project (GDL).
;;
;; This source file contains free software: you can redistribute it
;; and/or modify it under the terms of the GNU Affero General Public
;; License as published by the Free Software Foundation, either
;; version 3 of the License, or (at your option) any later version.
;; 
;; This source file 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
;; Affero General Public License for more details.
;; 
;; You should have received a copy of the GNU Affero General Public
;; License along with this source file.  If not, see
;; <http://www.gnu.org/licenses/>.
;; 


(in-package :tasty)

(define-object menu-section (sheet-section)

  :input-slots (tatu-root
                uri-static-gwl-images
                uri-static-gwl-unpix
                at-true-root?
                (line-thickness-selected nil :settable)
                
                (color nil :settable)
                
                (show-line-thicknesses? nil :settable)
                
                (show-colors? nil :settable)
                
                (blue-arrow
                 (with-cl-who-string ()
                   ((:span :style "font-weight: 900.0; color: blue;") "&rArr;")))
                
                (green-arrow
                 (with-cl-who-string ()
                   ((:span :style "font-weight: 900.0; color: green;") "&rArr;")))
                
                (purple-arrow
                 (with-cl-who-string ()
                   ((:span :style "font-weight: 900.0; color: purple;") "&rArr;")))
                
                (selected-character-spaces "&nbsp;&nbsp;&nbsp;")
                )


  :computed-slots
  (
   (tree-expand-mode (the tree expand-mode))
   
   (js-to-eval "initMenus();")
   
61
   (inner-html
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
    (with-cl-who-string ()

      (str (the menu-view))
      
      (str (the toolbar-view))
      
      ))


   (menu-view
    (with-cl-who-string ()
      ((:ul :id "menu" :class "ui-state-active navbar ui-widget-header")
       
       
       
       #+nil ;; --FLAG -- SvdE @ 12-08-09 -- no functions from the "file" menu are currently in use
       ((:li :id "menuFile" :class "top")
        "File"
        (:ul
         (:li ((:a :href "#")"New"))
         (:li ((:a :href "#")"Open"))
         (:li ((:a :href "#")"Close"))
         ((:li :class "separator"):nbsp)
         (:li ((:a :href "#")"Save"))
         (:li ((:a :href "#")"Save as"))
         ((:li :class "separator"):nbsp)
         (:li ((:a :href "#")"Export"))
         ((:li :class "separator"):nbsp)
         (:li ((:a :href "#")"Exit"))))
       
       
       
       ((:li :id "menuEdit" :class "top")
        "Edit"
        (:ul
         
         (:li ((:a :href "#")"Color"))
         (:li ((:a :href "#")"Stroke"))
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-click-mode!
                                                          :arguments (list :update-node))))
               "Update Object (U!)"))))
       
       
       
       ((:li :id "menuTree" :class "top")
        "Tree"
        (:ul
         
         ((:li :class "separator"):nbsp)
         
         
         ((:li :class "heading")"Object Click Mode:")
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-click-mode!
                                                          :arguments (list :add-node))))
               (fmt "~a&nbsp;Add Node... (AN)"
                    (if (eql (the click-mode value) :add-node) 
                        (the blue-arrow) 
                      (the selected-character-spaces)))))
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-click-mode!
                                                          :arguments (list :add-leaves))))
               (fmt "~a&nbsp;Add Leaves... (AL)"
                    (if (eql (the click-mode value) :add-leaves) 
                        (the blue-arrow) 
                      (the selected-character-spaces)))))
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-click-mode!
                                                          :arguments (list :add-leaves*))))
               (fmt "~a&nbsp;Add Leaves indiv... (AL*)"
                    (if (eql (the click-mode value) :add-leaves*) 
                        (the blue-arrow) 
                      (the selected-character-spaces)))))
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-click-mode!
                                                          :arguments (list :draw-node))))
               (fmt "~a&nbsp;Draw Node (DN)"
                    (if (eql (the click-mode value) :draw-node) 
                        (the blue-arrow) 
                      (the selected-character-spaces)))))
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-click-mode!
                                                          :arguments (list :draw-leaves))))
               (fmt "~a&nbsp;Draw Leaves (DL)"
                    (if (eql (the click-mode value) :draw-leaves) 
                        (the blue-arrow) 
                      (the selected-character-spaces)))))
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-click-mode!
                                                          :arguments (list :delete-leaves))))
               (fmt "~a&nbsp;Clear Leaves (CL)"
                    (if (eql (the click-mode value) :delete-leaves) 
                        (the blue-arrow) 
                      (the selected-character-spaces)))))
         

         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-click-mode!
                                                          :arguments (list :inspect))))
               (fmt "~a&nbsp;Inspect Object (I)"
                    (if (eql (the click-mode value) :inspect) 
                        (the blue-arrow) 
                      (the selected-character-spaces)))))
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-click-mode!
                                                          :arguments (list :break))))
               (fmt "~a&nbsp;Set Self to Object (SS)"
                    (if (eql (the click-mode value) :break) 
                        (the blue-arrow) 
                      (the selected-character-spaces)))))
         
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-click-mode!
                                                          :arguments (list :set-root))))
               (fmt "~a&nbsp;Set Root to Object (SR)"
                    (if (eql (the click-mode value) :set-root) 
                        (the blue-arrow) 
                      (the selected-character-spaces)))))

         
         ((:li :class "heading") "Tree Actions")
         
         
         #+nil
         ((:li :class (when (the at-true-root?) "heading"))
          "Up Root! (UR!)")
         
         #+nil
         ((:li :class (when (the at-true-root?) "heading"))
          "Reset Root! (RR!)")

         
         ((:li :class (when (the at-true-root?) "disabled"))
          (if (the at-true-root?)
              (htm "Up Root! (UR!)")
            (htm ((:a :href "#" :onclick (unless (the at-true-root?)
                                           (the (gdl-ajax-call :function-key :up-root!))))
                  "Up Root! (UR!)"))))
         
         ((:li :class (when (the at-true-root?) "disabled"))
          (if (the at-true-root?)
              (htm "Reset Root! (RR!)")
            (htm ((:a :href "#" :onclick (unless (the at-true-root?)
                                           (the (gdl-ajax-call :function-key :reset-root!))))
                  "Reset Root! (RR!)"))))
         
         ((:li :class "heading") "Tree Navigation ")
         
         
         ;;
         ;; FLAG -- SvdE @ 12-08-09 -- Link functions in tree navigation sub-menu 
         ;;
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-tree-expand-mode!
                                                          :arguments (list :leaves))))
               (fmt "~a&nbsp;Expand to Leaves (L)" 
                    (if (eql (the tree-expand-mode) :leaves) 
                        (the green-arrow) 
                      (the selected-character-spaces)))))
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-tree-expand-mode!
                                                           :arguments (list :children))))
               (fmt "~a&nbsp;Expand to Children (C)" 
                    (if (eql (the tree-expand-mode) :children) 
                        (the green-arrow) 
                      (the selected-character-spaces)))))
         (:li ((:a :href "#"  :onclick (the (gdl-ajax-call :function-key :set-tree-expand-mode!
                                                           :arguments (list :auto-close))))
               (fmt "~a&nbsp;Auto Close (A)"
                    (if (eql (the tree-expand-mode) :auto-close) 
                        (the green-arrow) 
                      (the selected-character-spaces)))))
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-tree-expand-mode!
                                                          :arguments (list :remember))))
               (fmt "~a&nbsp;Remember State (R)"
                    (if (eql (the tree-expand-mode) :remember) 
                        (the green-arrow) 
                      (the selected-character-spaces)))))))
       
       
       
       ((:li :id "menuView" :class "top")
        "View"
        (:ul
         
         
         ((:li :class "heading") "Viewport Actions")
         
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :reset-zoom!)))
               "Fit to Window!"))
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :clear!)))
               "Clear View! (CL!)"))
         
         #+nil ;; FLAG -- function not in use, could be used to restore all display settings to defaults
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-display-defaults!)))
               "Restore Display Defaults!"))
         
         ((:li :class "separator"):nbsp)   
         
         
         ((:li :class "heading") "Image Format")
         
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-image-format!
                                                          :arguments (list :png))))
               (fmt "~a&nbsp;PNG" 
                    (if (eql (the viewport image-format-selector value) :png)
                        (the blue-arrow)
                      (the selected-character-spaces)))))
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-image-format!
                                                          :arguments (list :jpeg))))
               (fmt "~a&nbsp;JPEG" 
                    (if (eql (the viewport image-format-selector value) :jpeg)
                        (the blue-arrow)
                      (the selected-character-spaces)))))

         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-image-format!
                                                          :arguments (list :vrml))));;:web3d))))
               (fmt "~a&nbsp;VRML" 
                    (if (eql (the viewport image-format-selector value) :vrml)
                        (the blue-arrow)
                      (the selected-character-spaces)))))
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-image-format!
                                                          :arguments (list :x3d))))
               (fmt "~a&nbsp;X3D" 
                    (if (eql (the viewport image-format-selector value) :x3d)
                        (the blue-arrow)
                      (the selected-character-spaces)))))

         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-image-format!
                                                          :arguments (list :x3dom))))
               (fmt "~a&nbsp;X3DOM" 
                    (if (eql (the viewport image-format-selector value) :x3dom)
                        (the blue-arrow)
                      (the selected-character-spaces)))))

         
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-image-format!
                                                          :arguments (list :raphael))))
               
               (fmt "~a&nbsp;SVG/VML" 
                    (if (eql (the viewport image-format-selector value) :raphael)
                        (the blue-arrow)
                      (the selected-character-spaces)))))
         
         ((:li :class "separator"):nbsp) 
         
         
         ((:li :class "heading") "Click Modes")
         
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-zoom!
                                                          :arguments (list :in))))
               (fmt "~a&nbsp;Zoom in"
                    (if (eql (the viewport zoom-mode) :in)
                        (the green-arrow)
                      (the selected-character-spaces)))))
         ;;
         ;;FLAG -- SvdE @ 09-05-20 -- Zoom-out does not work
         ;;
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-zoom!
                                                          :arguments (list :out))))
               (fmt "~a&nbsp;Zoom out"
                    (if (eql (the viewport zoom-mode) :out)
                        (the green-arrow)
                      (the selected-character-spaces)))))
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-digitation-mode!
                                                          :arguments (list :measure-distance))))
               (fmt "~a&nbsp;Measure distance"
                    (if (eql (the viewport digitation-mode) :measure-distance)
                        (the green-arrow)
                      (the selected-character-spaces)))))
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-digitation-mode!
                                                          :arguments (list :report-point))))
               (fmt "~a&nbsp;Get coordinates"
                    (if (eql (the viewport digitation-mode) :report-point)
                        (the green-arrow)
                      (the selected-character-spaces)))))
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-digitation-mode!
                                                          :arguments (list :select-object))))
               
               (fmt "~a&nbsp;Select object"
                    (if (eql (the viewport digitation-mode) :select-object)
                        (the green-arrow)
                      (the selected-character-spaces)))))
         
         
         ((:li :class "separator"):nbsp) 
         
         ((:li :class "heading") "Perspective")        
         
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-view!
                                                          :arguments (list :trimetric))))
               (fmt "~a&nbsp;Trimetric"
                    (if (eql (the viewport view-selector value) :trimetric)
                        (the purple-arrow)
                      (the selected-character-spaces)))))
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-view!
                                                          :arguments (list :front))))
               
               (fmt "~a&nbsp;Front"
                    (if (eql (the viewport view-selector value) :front)
                        (the purple-arrow)
                      (the selected-character-spaces)))))        
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-view!
                                                          :arguments (list :rear))))
               (fmt "~a&nbsp;Rear"
                    (if (eql (the viewport view-selector value) :rear)
                        (the purple-arrow)
                      (the selected-character-spaces)))))        
         
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-view!
                                                          :arguments (list :left))))
               (fmt "~a&nbsp;Left"
                    (if (eql (the viewport view-selector value) :left)
                        (the purple-arrow)
                      (the selected-character-spaces)))))        
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-view!
                                                          :arguments (list :right))))
               (fmt "~a&nbsp;Right"
                    (if (eql (the viewport view-selector value) :right)
                        (the purple-arrow)
                      (the selected-character-spaces)))))        
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-view!
                                                          :arguments (list :top))))
               (fmt "~a&nbsp;Top"
                    (if (eql (the viewport view-selector value) :top)
                        (the purple-arrow)
                      (the selected-character-spaces)))))        
         
         (:li ((:a :href "#" :onclick (the (gdl-ajax-call :function-key :set-view!
                                                          :arguments (list :bottom))))
               (fmt "~a&nbsp;Bottom"
                    (if (eql (the viewport view-selector value) :bottom)
                        (the purple-arrow)
                      (the selected-character-spaces)))))))
       
       
       ((:li :id "menuWindow" :class "top")
        "Window"
        (:ul
         
         (:li ((:a :href "#" 
                   :onclick "initApplicationLayout();PageLayout.open('north');PageLayout.resizeAll()")"Standard Mode"))        
         (:li ((:a :href "#" 
                   :onclick "focusCenter();PageLayout.resizeAll()")"Expert Mode"))
         (:li ((:a :href "#" 
                   :onclick "focusCenter();PageLayout.resizeAll()")"End-User Mode (UI)"))))
       
       
       ((:li :id "menuHelp" :class "top")
        "Help"
        (:ul
         (:li ((:a :href "http://www.genworks.com" :target "_new") "Documentation"))        
         (:li ((:a :href "http://www.genworks.com/dl" :target "_new") "Check for Updates"))        
         (:li ((:a :href "http://www.genworks.com" :target "_new") "Contact Us"))  
         )))))


   (toolbar-view 
    (with-cl-who-string
        ()
      ((:ul :id "toolbar" :class "navbar ui-widget-header")
       
       ((:li :id "tbarDrawObject")
        ((:span 
          :onclick (the (gdl-ajax-call :function-key :set-click-mode!
                                       :arguments (list :add-leaves))))
     
	 (:img :src (string-append (the uri-static-gwl-unpix) "draw.png") 
	      
	       :height "32px" 
	       :width  "32px"
               :alt "Draw Object (AL)"
               :title "Draw Object (AL)"
               :border "0")
         ((:span :class "tbartext")"Draw Object (AL)")))
       
       ((:li :id "tbarInspectObject")
        ((:span 
          :onclick (the (gdl-ajax-call :function-key :set-click-mode!
                                       :arguments (list :inspect))))
         (:img :src (string-append (the uri-static-gwl-unpix) "inspect.png") 
               :height "32px" 
	       :width  "32px"
	       :alt "InspectObject"
               :title "Inspect Object"
               :border "0")
         ((:span :class "tbartext")"Inspect Object (I)")))
      
       ((:li :id "tbarClearObject")
        ((:span 
          :onclick (the (gdl-ajax-call :function-key :set-click-mode!
                                       :arguments (list :delete-leaves))))
         (:img :src (string-append (the uri-static-gwl-unpix) "draw-erase.png") 
               :alt "ClearObject"
	       :height "32px" 
	       :width  "32px"
               :title "Clear Object (DL)"
               :border "0")
         ((:span :class "tbartext")"Clear Object (DL)")))
       
       
       ((:li :class "separator")
        (:img :src (string-append (the uri-static-gwl-unpix) "tbar_separator.png")))

       ((:li :id "tbarClearView")
        ((:span 
          :onclick (the (gdl-ajax-call :function-key :clear!)))
         (:img :src (string-append (the uri-static-gwl-unpix) "cleare-view.png")
	       :height "32px" 
	       :width  "32px"
               :alt "ClearView"
               :title "Clear View (CL!)"
               :border "0")
         ((:span :class "tbartext")"Clear View (CL!)")))
        
       ((:li :id "tbarZoomIn")
        ((:span 
          :onclick (the (gdl-ajax-call :function-key :set-zoom!
                                       :arguments (list :in))))
496
         (:img :src (string-append (the uri-static-gwl-unpix) "viewmag+.png") 
497
498
499
500
501
502
503
504
505
506
507
               :alt "ZoomIn"
	       :height "32px" 
	       :width  "32px"
               :title "Set click mode of the viewport to Zoom In"
               :border "0")
         ((:span :class "tbartext")"Zoom In (+)")))
       
       ((:li :id "tbarZoomOut")
        ((:span 
          :onclick (the (gdl-ajax-call :function-key :set-zoom!
                                       :arguments (list :out))))
508
         (:img :src (string-append (the uri-static-gwl-unpix) "viewmag-.png") 
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
               :alt "ZoomOut"
	       :height "32px" 
	       :width  "32px"
               :title "Set click mode of the viewport to Zoom Out"
               :border "0")
         ((:span :class "tbartext")"Zoom Out (-)")))

       
       ((:li :class "separator")
        (:img :src (string-append (the uri-static-gwl-unpix) "tbar_separator.png")))

       (when (typep (the tatu-root root-object) 'base-html-sheet)
         (htm
          ((:li :id "tbarUI")
           ((:span 
             ;; we need to do use javascript as an :a is not possible in the menu
             :onclick (format nil "window.location='~a'" (the tatu-root root-object url)))
            (:img :src (string-append (the uri-static-gwl-unpix) "ui.png") 
		  :height "32px" 
		  :width  "32px"
                  :alt "UI"
                  :title "Change to application User Interface (UI)"
                  :border "0")
            ((:span :class "tbartext")"User interface (UI)")))))

       
       ((:li :class "separator")
        (:img :src (string-append (the uri-static-gwl-unpix) "tbar_separator.png")))
       
       ((:li :id "tbarSetSelf")
        ((:span 
          :onclick (the (gdl-ajax-call :function-key :set-click-mode!
                                       :arguments (list :break))))
         (:img :src (string-append (the uri-static-gwl-unpix) "break.png") 
	       :height "32px" 
	       :width  "32px"
               :alt "Break/Setself"
               :title "Set click mode of an object in the tree to Break and Setself!"
               :border "0")
         ((:span :class "tbartext")"Break/SetSelf")))
       
       ((:li :id "tbarUpdate")
        ((:span 
          :onclick (the (gdl-ajax-call :function-key :update-root!)))
         ;;:arguments (list :inspect))))
         (:img :src (string-append (the uri-static-gwl-unpix) "update.png")
	       :height "32px" 
	       :width  "32px"
               :alt "Update"
               :title "Perform Full Update of the object tree!"
               :border "0")
         ((:span :class "tbartext")"Update")))
       
562
               (unless (the show-line-thicknesses?)
563
564
565
566
567
568
569
570
         (htm ((:li :id "lineThicknesses")
               ((:span :style "cursor: pointer;"
                       :onclick (the (gdl-ajax-call :function-key :set-slot!
                                                    :arguments (list :show-line-thicknesses? t))))
                "Line Thicknesses"))))
       
       (when (the show-line-thicknesses?)
         (htm ((:li :id "lineThickness")
571
               ((:span :style " height: 32pt; cursor: pointer; "
572
573
                       :onclick (the (gdl-ajax-call :function-key :set-slot!
                                                    :arguments (list :show-line-thicknesses? nil))))
574
575
                (:sup "X "))
               (dolist (thickness '((0.5 "line-d.gif" )
576
577
578
                                    (1.0 "line-1.gif" )
                                    (2.0 "line-2.gif" )
                                    (3.0 "line-3.gif" )
579
                                    (4.0 "line-4.gif" )))
580
581
582
583
584
585
                 (htm
                  ((:span :style "cursor: pointer;" 
                          :title (format nil "Set Line Thickness to ~a" (first thickness))
                          :onclick (the (gdl-ajax-call :function-key :set-slot!
                                                       :arguments (list :line-thickness-selected 
                                                                        (first thickness)))))
586
                    (:img :border 0  :src (format nil "/images/gwl/~a" (second thickness)))))
587
588
                  (if (and (the line-thickness-selected)
                           (= (the line-thickness-selected) (first thickness)))
589
                      (htm ((:span :style " height: 32pt; cursor: pointer; color:green "
590
591
592
                                   :title "Restore Default Line Thickness"
                                   :onclick (the (gdl-ajax-call :function-key :restore-slot-default!
                                                                :arguments (list :line-thickness-selected))))
593
594
                             "&lArr; " "")))
              ))))
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729

       (htm ((:li :id "colors")
             (:table (:tr ((:td :style (format nil "width: 25pt; height: 25pt; cursor: pointer; ~a "
                                               (if (the color)
                                                   (format nil "background: #~a;" (the color))
                                                 ""))
                                :onclick (if (the color)
                                             (the (gdl-ajax-call :function-key :restore-slot-default!
                                                                 :arguments (list :color)))
                                           (unless (the show-colors?) 
                                             (the (gdl-ajax-call :function-key :set-slot!
                                                                 :arguments (list :show-colors? t))))))
                           
                           )))))
       
       
       (unless (the show-colors?)
         (htm ((:li :id "colors")
               ((:span :style "cursor: pointer;"
                       :onclick (the (gdl-ajax-call :function-key :set-slot!
                                                    :arguments (list :show-colors? t))))
                "Colors"))))
       
       (when (the show-colors?)
         (htm ((:li :id "colors")
               ((:span :style "cursor: pointer;"
                       :onclick (the (gdl-ajax-call :function-key :set-slot!
                                                    :arguments (list :show-colors? nil))))
                "X")))
         
         (str (the  color-chooser full-grid)))
       
       
       
       
       
       ))))

  :objects ((color-chooser :type 'color-chooser))
  
  :functions
  (
   
   (update-root!
    ()
    (the tatu-root update-root-object!))
   
   (clear!
    ()
    (the viewport clear!))
   
   
   ;;
   ;; FLAG SvdE @ 14-08-09 -- set-display-defaults! should be defined in viewport
   ;;
   (set-display-defaults!
    ()
    (the viewport set-display-defaults!))
  
   
   (up-root!
   ()
   (the parent up-root!)) ;;parent refers to the ojbect 'assembly' in assembly'.lisp
   
   (reset-root!
   ()
   (the parent reset-root!)) ;;parent refers to the ojbect 'assembly' in assembly'.lisp
   
   (set-click-mode!
    (mode)
    (the click-mode (set-slot! :value mode)))
   
   (set-image-format!
    (format)
    (the viewport image-format-selector  (set-slot! :value format)))
   
   (set-view!
    (view)
    (the viewport view-selector (set-slot! :value view)))
   
   (set-zoom!
    (zoom)
    (the viewport (set-slot! :digitized-point nil))
    (the viewport (set-slot! :digitized-distance nil))
    (the viewport (set-slot! :digitation-mode :zoom-and-center))
    (the viewport (set-slot! :zoom-mode zoom)))
   
   (reset-zoom!
    ()
    (the viewport reset-zoom!))
   
   (set-digitation-mode!
    (click-mode)
    #+nil
    (unless (eql click-mode :report-point) 
      (the viewport (set-slot! :digitized-point nil)))
    (the viewport (set-slot! :digitized-point nil))
    (the viewport (set-slot! :digitized-distance nil))
    (the viewport (set-slot! :zoom-mode nil))
    (the viewport (set-slot! :digitation-mode click-mode)))
   
   (set-tree-expand-mode!
    (expand-mode)
    (the tree (set-slot! :expand-mode expand-mode)))
   
   ))


(define-object color-chooser ()
  :input-slots
  ((components (list "FF" "CC" "99" "66" "33" "00"))
   (cell-size 7))
  
  :computed-slots
  ((full-grid
    (let ((colors (the components)))
      (with-cl-who-string ()
        ((:table :border "0" :cellspacing "0" :cellpadding "0")
         (:tr (dolist (red colors)
                (htm
                 (:td 
                  ((:table :border "0" :cellspacing "0" :cellpadding "0")
                   (dolist (green colors)
                     (htm 
                      (:tr (dolist (blue colors)
                             (htm ((:td :style (format nil "cursor: pointer; background: #~a~a~a; height: ~apx; width: ~apx;" 
                                                       red green blue
                                                       (the cell-size) (the cell-size))
                                        :title (format nil "Set Color for Next Matched Object(s) to Hex RGB: ~a~a~a"
                                                       red green blue)
                                        :onclick (the parent
                                                   (gdl-ajax-call :function-key :set-slot!
                                                                  :arguments (list :color (format nil "~a~a~a" red green blue))))
                                        
                                        ))))))))))))))))))