[snow-cvs] r26 - in trunk: docs src/lisp/snow src/lisp/snow/showcase src/lisp/snow/swing
Alessio Stalla
astalla at common-lisp.net
Thu Nov 26 20:26:00 UTC 2009
Author: astalla
Date: Thu Nov 26 15:25:59 2009
New Revision: 26
Log:
Updated tutorial
Fixed progressbar
Modified:
trunk/docs/tutorial.html
trunk/src/lisp/snow/showcase/showcase.lisp
trunk/src/lisp/snow/snow.lisp
trunk/src/lisp/snow/start.lisp
trunk/src/lisp/snow/swing/swing.lisp
Modified: trunk/docs/tutorial.html
==============================================================================
--- trunk/docs/tutorial.html (original)
+++ trunk/docs/tutorial.html Thu Nov 26 15:25:59 2009
@@ -5,9 +5,10 @@
</head>
<body>
<h1>Snow Tutorial</h1>
+<h4>Last modified 2009-11-26</h4>
<ol>
<li><a href="#ch001">Getting and Installing Snow</a></li>
- <li><a href="#terminology">Terminology</a></li>
+ <li><a href="#building">Building Snow from source (optional)</a></li>
<li><a href="#repl">The Snow REPL</a></li>
<li><a href="#basic-concepts">Basic Concepts</a></li>
<li><a href="#layout">Layout</a></li>
@@ -29,16 +30,8 @@
</li>
</ul>
Currently Snow, when run from the jar, requires a temporary directory to load itself; make sure your application has write permissions on your OS's tmp directory. Snow should automatically clear its temporary files when the application exits.
-<a name="terminology" /><h3>Terminology</h3>
-The boring part :) you can skip this if you know Lisp, since I'm going to loosely define some terms Snow borrows from Lisp that will be used in this tutorial.
-<ul>
- <li><dd><strong>car</strong></dd><dt>the first element of a list.</dt></li>
- <li><dd><strong>cdr</strong></dd><dt>the rest of a list (all elements except the first).</dt></li>
- <li><dd><strong>nil</strong></dd><dt>the empty list, and the only boolean false value.</dt></li>
- <li><dd><strong>t</strong></dd><dt>a self-evaluating symbol representing the canonical boolean true value (among other things).</dt></li>
- <li><dd><strong>form</strong></dd><dt>an expression to be evaluated or compiled.</dt></li>
- <li><dd><strong>keyword</strong></dd><dt>a self-evaluating symbol starting with a colon (like <code>:title</code>). More correctly, a symbol in the KEYWORD package.</dt></li>
-</ul>
+<a name="building" /><h3>Building Snow from source (optional)</h3>
+Snow is built using the Ant program (a Java make-like tool). You can get it from <<a href="http://ant.apache.org/">http://ant.apache.org/</a>>. To obtain the source code for Snow, either download a source release from the <a href="http://common-lisp.net/project/snow">project page</a> or, if you want the latest & greatest stuff, follow the instructions at <<a href="http://common-lisp.net/faq.shtml">http://common-lisp.net/faq.shtml</a>> to checkout it from the SVN repository. Once you have the source in a given directory, cd to that directory and issue the command <code>ant snow.jar</code> to build Snow. <code>ant snow.clean</code> removes all compiled files.
<a name="repl" /><h3>The Snow REPL</h3>
Being based on Lisp, Snow offers a REPL (read-eval-print-loop), an interactive prompt that allows you to evaluate arbitrary pieces of code. If you launch Snow through its main class (snow.Snow) with no command-line arguments, it will show a window containing the REPL (which is nothing more than a wrapped ABCL REPL). It should print
<br /><br />
Modified: trunk/src/lisp/snow/showcase/showcase.lisp
==============================================================================
--- trunk/src/lisp/snow/showcase/showcase.lisp (original)
+++ trunk/src/lisp/snow/showcase/showcase.lisp Thu Nov 26 15:25:59 2009
@@ -27,8 +27,7 @@
:layout "dock south"
:on-action (lambda (evt)
(declare (ignore evt))
- (setf (c-value ,show-source-p) t)))
- (setf ,gui-panel self))
+ (setf (c-value ,show-source-p) t))))
(panel (:layout "dock south, hidemode 3"
:visible-p $(c? (jbool (c-value ,show-source-p))))
(scroll (:layout "grow, wrap")
@@ -42,8 +41,7 @@
:layout "dock south"
:on-action (lambda (evt)
(declare (ignore evt))
- (setf (c-value ,show-source-p) nil)))
- (setf ,source-panel self))))))
+ (setf (c-value ,show-source-p) nil))))))))
*examples*
:test #'equal
:key #'car)))
Modified: trunk/src/lisp/snow/snow.lisp
==============================================================================
--- trunk/src/lisp/snow/snow.lisp (original)
+++ trunk/src/lisp/snow/snow.lisp Thu Nov 26 15:25:59 2009
@@ -223,15 +223,17 @@
(defmacro with-gui ((&optional (gui-backend '*gui-backend*)) &body body)
(with-unique-names (gui-backend-var package-var debugger-hook-var
- dynamic-environment)
+ dynamic-environment terminal-io-var)
`(let* ((,gui-backend-var ,gui-backend)
(*gui-backend* ,gui-backend-var)
(,package-var *package*)
- (,debugger-hook-var *debugger-hook*)) ;;Etc...
+ (,debugger-hook-var *debugger-hook*)
+ (,terminal-io-var *terminal-io*)) ;;Etc...
(dynamic-wind
(let ((*gui-backend* ,gui-backend-var)
(*package* ,package-var)
- (*debugger-hook* ,debugger-hook-var))
+ (*debugger-hook* ,debugger-hook-var)
+ (*terminal-io* ,terminal-io-var))
(proceed
(let ((,dynamic-environment (capture-dynamic-environment)))
(call-in-gui-thread
@@ -342,15 +344,12 @@
:orientation ,orientation :smoothp ,smoothp)
`(common-widget-setup self ,layout ,binding ,enabled-p ,visible-p ,location ,size))
-(defmacro defwidget (name &rest args)
- (let* (
- (maker-sym (intern (concatenate 'string "MAKE-" (symbol-name name))))
- )
- `(progn
- (definterface ,maker-sym *gui-backend* (&key , at args &allow-other-keys))
- (define-widget ,name (, at args &allow-other-keys) ,maker-sym)
- )))
-
+(defmacro defwidget (name &rest args)
+ (let* ((maker-sym (intern (concatenate 'string "MAKE-" (symbol-name name)))))
+ `(progn
+ (definterface ,maker-sym *gui-backend* (&key , at args &allow-other-keys))
+ (define-widget ,name (, at args &allow-other-keys) ,maker-sym))))
+
;;Buttons and similar
(definterface make-button *gui-backend* (&key text on-action &allow-other-keys))
@@ -359,14 +358,14 @@
(definterface make-check-box *gui-backend* (&key text selected-p &allow-other-keys))
(define-widget check-box (text selected-p &allow-other-keys) make-check-box)
-
-;;Misc
-
-(def-widget progress-bar value orientation (paint-border t) progress-string)
-
-;;Text
-
-(def-widget label text)
+
+;;Misc
+
+(defwidget progress-bar value orientation (paint-border t) progress-string)
+
+;;Text
+
+(defwidget label text)
; (definterface make-label *gui-backend* (&key text &allow-other-keys))
Modified: trunk/src/lisp/snow/start.lisp
==============================================================================
--- trunk/src/lisp/snow/start.lisp (original)
+++ trunk/src/lisp/snow/start.lisp Thu Nov 26 15:25:59 2009
@@ -38,6 +38,10 @@
:text "Copyright (C) 2008-2009 Alessio Stalla")
(label :layout "wrap"
:text "This program is distributed under the GNU GPL; see the file copying for details.")
+ (label :layout "wrap"
+ :text "Many thanks to these people for contributing to Snow:")
+ (label :layout "wrap"
+ :text "Nikita \"Shviller\" Mamardashvili")
(button :text "Ok" :on-action (lambda (evt)
(declare (ignore evt))
(dispose dlg)))
Modified: trunk/src/lisp/snow/swing/swing.lisp
==============================================================================
--- trunk/src/lisp/snow/swing/swing.lisp (original)
+++ trunk/src/lisp/snow/swing/swing.lisp Thu Nov 26 15:25:59 2009
@@ -232,21 +232,21 @@
(if selected-p selected-p (jbool nil)))
btn))
-;Misc
-(defconstant +swingconstant-vertical+ 1) ; it should be something like (jmethod "javax.swing.SwingConstants" "VERTICAL")
-(defimpl snow::make-progress-bar (&key value orientation (paint-border t) progress-string &allow-other-keys)
- (let ((pbar (new "javax.swing.JProgressBar")))
- (when value
- (setf (widget-property pbar :value) value))
- (when orientation
- (setf (widget-property pbar :orientation) +swingconstant-vertical+))
- (when (not paint-border)
- (setf (widget-property pbar :border-painted) (jbool nil)))
- (when progress-string
- (setf (widget-property pbar :string-painted) (jbool t))
- (setf (widget-property pbar :string) progress-string)
- )
- pbar))
+;Misc
+(defconstant +swingconstant-vertical+ 1) ; it should be something like (jmethod "javax.swing.SwingConstants" "VERTICAL")
+(defimpl snow::make-progress-bar (&key value orientation (paint-border t) progress-string &allow-other-keys)
+ (let ((pbar (new "javax.swing.JProgressBar")))
+ (when value
+ (setf (widget-property pbar :value) value))
+ (when orientation
+ (setf (widget-property pbar :orientation) +swingconstant-vertical+))
+ (when (not paint-border)
+ (setf (widget-property pbar :border-painted) (jbool nil)))
+ (when progress-string
+ (setf (widget-property pbar :string-painted) (jbool t))
+ (setf (widget-property pbar :string) progress-string))
+ pbar))
+
;Text
(defimpl snow::make-label (&key text &allow-other-keys)
(let ((lbl (new "javax.swing.JLabel")))
More information about the snow-cvs
mailing list