From 6e4a04a77e56844afaeec355895e18701180bd58 Mon Sep 17 00:00:00 2001 From: Marc Feeley Date: Wed, 22 Feb 2012 11:41:57 -0500 Subject: [PATCH] Improve Gambit REPL (toolbar is semi transparent and the alpha can be set with set-toobar-alpha) and improve grd (-repl option, cat command, ls command shows "/" at end of directories). --- examples/iOS/GambitREPL.xcodeproj.tgz | Bin 5831 -> 5831 bytes examples/iOS/ViewController.h | 3 +++ examples/iOS/ViewController.m | 15 ++++++++++++- examples/iOS/ViewController.xib | 39 +++++++++++++++++++++++----------- examples/iOS/grd.scm | 27 ++++++++++++++++++++--- examples/iOS/intf#.scm | 1 + examples/iOS/intf.scm | 3 +++ include/stamp.h | 4 ++-- 8 files changed, 74 insertions(+), 18 deletions(-) diff --git a/examples/iOS/GambitREPL.xcodeproj.tgz b/examples/iOS/GambitREPL.xcodeproj.tgz index c2b5b1386204fee195be0f3de286afa51ade29cc..9bb8840975d82aa393bbccb65dcc10a83e678644 100644 GIT binary patch delta 16 XcwRfMdt8@YzMF%iTgr7K`vEZkE*=FU delta 16 XcwRfMdt8@YzMF%iXT9@A_5)%7F_{In diff --git a/examples/iOS/ViewController.h b/examples/iOS/ViewController.h index aae179a..b2b1c34 100644 --- a/examples/iOS/ViewController.h +++ b/examples/iOS/ViewController.h @@ -27,6 +27,7 @@ void set_webView_content_from_file(int view, NSString *path, NSString *base_url_ NSString *eval_js_in_webView(int view, NSString *script); void open_URL(NSString *url); void set_idle_timer(BOOL enable); +void set_toolbar_alpha(double alpha); void segm_ctrl_set_title(int segment, NSString *title); void segm_ctrl_insert(int segment, NSString *title); void segm_ctrl_remove(int segment); @@ -59,6 +60,7 @@ void setup_location_updates(double desired_accuracy, double distance_filter); UIImageView *imageView1; UIButton *cancelButton; UIView *accessoryView; + UIToolbar *toolbar; int keyboardSounds; NSTimer *timer; NSMutableArray *queuedActions; @@ -76,6 +78,7 @@ void setup_location_updates(double desired_accuracy, double distance_filter); @property (nonatomic, retain) IBOutlet UIImageView *imageView1; @property (nonatomic, assign) IBOutlet UIButton *cancelButton; @property (nonatomic, assign) IBOutlet UIView *accessoryView; +@property (nonatomic, assign) IBOutlet UIToolbar *toolbar; @property (assign) int keyboardSounds; @property (assign) NSTimer *timer; @property (assign) NSMutableArray *queuedActions; diff --git a/examples/iOS/ViewController.m b/examples/iOS/ViewController.m index f5961fb..0adc064 100644 --- a/examples/iOS/ViewController.m +++ b/examples/iOS/ViewController.m @@ -15,7 +15,7 @@ @implementation ViewController -@synthesize segmCtrl, webView0, webView1, webView2, webView3, textView0, textView1, imageView0, imageView1, cancelButton, accessoryView, keyboardSounds, timer, queuedActions, locationManager; +@synthesize segmCtrl, webView0, webView1, webView2, webView3, textView0, textView1, imageView0, imageView1, cancelButton, accessoryView, toolbar, keyboardSounds, timer, queuedActions, locationManager; //----------------------------------------------------------------------------- @@ -180,6 +180,7 @@ static ViewController *theViewController = nil; cancelButton = nil; accessoryView = nil; + toolbar = nil; theViewController = nil; @@ -613,16 +614,28 @@ NSString *eval_js_in_webView(int view, NSString *script) { return nil; } + void open_URL(NSString *url) { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]]; } + void set_idle_timer(BOOL enable) { [UIApplication sharedApplication].idleTimerDisabled = !enable; } + +void set_toolbar_alpha(double alpha) { + + ViewController *vc = theViewController; + if (vc != nil) + { + [vc->toolbar setAlpha: alpha]; + } +} + void segm_ctrl_set_title(int segment, NSString *title) { ViewController *vc = theViewController; diff --git a/examples/iOS/ViewController.xib b/examples/iOS/ViewController.xib index 5d07531..93c28c4 100644 --- a/examples/iOS/ViewController.xib +++ b/examples/iOS/ViewController.xib @@ -1,7 +1,7 @@ - 1280 + 1072 11C74 1938 1138.23 @@ -48,7 +48,7 @@ -2147483374 - {768, 960} + {768, 1004} @@ -62,7 +62,7 @@ -2147483374 - {768, 960} + {768, 1004} @@ -73,7 +73,7 @@ -2147483374 - {768, 960} + {768, 1004} @@ -84,7 +84,7 @@ -2147483374 - {768, 960} + {768, 1004} @@ -95,7 +95,7 @@ -2147483374 - {768, 960} + {768, 1004} @@ -123,7 +123,7 @@ -2147483374 - {768, 960} + {768, 1004} @@ -144,7 +144,7 @@ -2147483356 - {768, 960} + {768, 1004} @@ -155,7 +155,7 @@ -2147483356 - {768, 960} + {768, 1004} @@ -174,7 +174,6 @@ {{234, 8}, {300, 30}} - NO IBIPadFramework 2 @@ -223,6 +222,7 @@ NO NO + 0.75 IBIPadFramework YES @@ -392,6 +392,14 @@ + toolbar + + + + 104 + + + delegate @@ -653,7 +661,7 @@ - 103 + 104 @@ -872,6 +880,7 @@ segmCtrl textView0 textView1 + toolbar webView0 webView1 webView2 @@ -886,6 +895,7 @@ UISegmentedControl UITextView UITextView + UIToolbar UIWebView UIWebView UIWebView @@ -903,6 +913,7 @@ segmCtrl textView0 textView1 + toolbar webView0 webView1 webView2 @@ -939,6 +950,10 @@ UITextView + toolbar + UIToolbar + + webView0 UIWebView @@ -967,7 +982,7 @@ IBIPadFramework com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS - + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 diff --git a/examples/iOS/grd.scm b/examples/iOS/grd.scm index 33dba7a..ac998b6 100644 --- a/examples/iOS/grd.scm +++ b/examples/iOS/grd.scm @@ -54,6 +54,7 @@ This program implements several commands: grd mkdir create directory grd rm remove file or dir grd mv remove file or dir + grd cat show content of file grd eval evaluate expression grd load load file grd push copy local file or dir to iOS device @@ -315,11 +316,16 @@ EOF (define (grd-pwd #!key (addr (default-addr))) (remote-eval addr `(current-directory))) -(define (grd-cd path #!key (addr (default-addr))) +(define (grd-cd #!optional (path "~") #!key (addr (default-addr))) (remote-eval addr `(current-directory ,path))) -(define (grd-ls path #!key (addr (default-addr))) - (remote-eval addr `(directory-files ,path))) +(define (grd-ls #!optional (path ".") #!key (addr (default-addr))) + (remote-eval addr `(parameterize ((current-directory ,path)) + (map (lambda (f) + (if (eq? (file-type f) 'directory) + (string-append f "/") + f)) + (directory-files))))) (define (grd-mkdir path #!key (addr (default-addr))) (remote-eval addr `(tar#create-dir ,path))) @@ -330,6 +336,9 @@ EOF (define (grd-mv path1 path2 #!key (addr (default-addr))) (remote-eval addr `(rename-file ,path1 ,path2))) +(define (grd-cat path #!key (addr (default-addr))) + (remote-eval addr `(call-with-input-file ,path (lambda (port) (read-line port #f))))) + (define (grd-eval expr #!key (addr (default-addr))) (remote-eval addr expr)) @@ -391,6 +400,9 @@ EOF (load (cadr args)) (loop (cddr args))) + ((equal? op "-repl") + (##repl-debug-main)) + ((equal? op "scan") (scan-local-REPL-servers)) @@ -449,6 +461,15 @@ EOF (grd-mv path1 path2 addr: addr) (grd-mv path1 path2))))) + ((equal? op "cat") + (for-each + (lambda (path) + (println + (if addr + (grd-cat path addr: addr) + (grd-cat path)))) + (cdr args))) + ((equal? op "eval") (for-each (lambda (str) diff --git a/examples/iOS/intf#.scm b/examples/iOS/intf#.scm index abce11d..a33419d 100644 --- a/examples/iOS/intf#.scm +++ b/examples/iOS/intf#.scm @@ -74,6 +74,7 @@ eval-js-in-webView open-URL set-idle-timer +set-toolbar-alpha segm-ctrl-set-title segm-ctrl-insert set-pref diff --git a/examples/iOS/intf.scm b/examples/iOS/intf.scm index a4ec987..d881841 100644 --- a/examples/iOS/intf.scm +++ b/examples/iOS/intf.scm @@ -425,6 +425,9 @@ c-declare-end (define set-idle-timer (c-lambda (bool) void "set_idle_timer")) +(define set-toolbar-alpha + (c-lambda (double) void "set_toolbar_alpha")) + (define segm-ctrl-set-title (c-lambda (int NSString*) void "segm_ctrl_set_title")) diff --git a/include/stamp.h b/include/stamp.h index 6ac29ac..5d40a1a 100644 --- a/include/stamp.h +++ b/include/stamp.h @@ -2,5 +2,5 @@ * Time stamp of last source code repository commit. */ -#define ___STAMP_YMD 20120221 -#define ___STAMP_HMS 170233 +#define ___STAMP_YMD 20120222 +#define ___STAMP_HMS 164157 -- 2.11.4.GIT