Permalink
Browse files

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).
  • Loading branch information...
1 parent 039d428 commit 6e4a04a77e56844afaeec355895e18701180bd58 @feeley feeley committed Feb 22, 2012
View
BIN examples/iOS/GambitREPL.xcodeproj.tgz
Binary file not shown.
View
3 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;
View
15 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 @@ - (void)viewDidUnload {
cancelButton = nil;
accessoryView = nil;
+ toolbar = nil;
theViewController = nil;
@@ -613,16 +614,28 @@ void set_webView_content_from_file(int view, NSString *path, NSString *base_url_
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;
View
39 examples/iOS/ViewController.xib
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="7.10">
<data>
- <int key="IBDocument.SystemTarget">1280</int>
+ <int key="IBDocument.SystemTarget">1072</int>
<string key="IBDocument.SystemVersion">11C74</string>
<string key="IBDocument.InterfaceBuilderVersion">1938</string>
<string key="IBDocument.AppKitVersion">1138.23</string>
@@ -48,7 +48,7 @@
<object class="IBUIWebView" id="742341718">
<reference key="NSNextResponder" ref="766721923"/>
<int key="NSvFlags">-2147483374</int>
- <string key="NSFrameSize">{768, 960}</string>
+ <string key="NSFrameSize">{768, 1004}</string>
<reference key="NSSuperview" ref="766721923"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="53140855"/>
@@ -62,7 +62,7 @@
<object class="IBUIWebView" id="53140855">
<reference key="NSNextResponder" ref="766721923"/>
<int key="NSvFlags">-2147483374</int>
- <string key="NSFrameSize">{768, 960}</string>
+ <string key="NSFrameSize">{768, 1004}</string>
<reference key="NSSuperview" ref="766721923"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="94888966"/>
@@ -73,7 +73,7 @@
<object class="IBUIWebView" id="94888966">
<reference key="NSNextResponder" ref="766721923"/>
<int key="NSvFlags">-2147483374</int>
- <string key="NSFrameSize">{768, 960}</string>
+ <string key="NSFrameSize">{768, 1004}</string>
<reference key="NSSuperview" ref="766721923"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="977500972"/>
@@ -84,7 +84,7 @@
<object class="IBUIWebView" id="977500972">
<reference key="NSNextResponder" ref="766721923"/>
<int key="NSvFlags">-2147483374</int>
- <string key="NSFrameSize">{768, 960}</string>
+ <string key="NSFrameSize">{768, 1004}</string>
<reference key="NSSuperview" ref="766721923"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="382596724"/>
@@ -95,7 +95,7 @@
<object class="IBUITextView" id="382596724">
<reference key="NSNextResponder" ref="766721923"/>
<int key="NSvFlags">-2147483374</int>
- <string key="NSFrameSize">{768, 960}</string>
+ <string key="NSFrameSize">{768, 1004}</string>
<reference key="NSSuperview" ref="766721923"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="894914323"/>
@@ -123,7 +123,7 @@
<object class="IBUITextView" id="894914323">
<reference key="NSNextResponder" ref="766721923"/>
<int key="NSvFlags">-2147483374</int>
- <string key="NSFrameSize">{768, 960}</string>
+ <string key="NSFrameSize">{768, 1004}</string>
<reference key="NSSuperview" ref="766721923"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="747090650"/>
@@ -144,7 +144,7 @@
<object class="IBUIImageView" id="747090650">
<reference key="NSNextResponder" ref="766721923"/>
<int key="NSvFlags">-2147483356</int>
- <string key="NSFrameSize">{768, 960}</string>
+ <string key="NSFrameSize">{768, 1004}</string>
<reference key="NSSuperview" ref="766721923"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="217127702"/>
@@ -155,7 +155,7 @@
<object class="IBUIImageView" id="217127702">
<reference key="NSNextResponder" ref="766721923"/>
<int key="NSvFlags">-2147483356</int>
- <string key="NSFrameSize">{768, 960}</string>
+ <string key="NSFrameSize">{768, 1004}</string>
<reference key="NSSuperview" ref="766721923"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="634231874"/>
@@ -174,7 +174,6 @@
<string key="NSFrame">{{234, 8}, {300, 30}}</string>
<reference key="NSSuperview" ref="791792189"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<int key="IBSegmentControlStyle">2</int>
@@ -223,6 +222,7 @@
<reference key="NSNextKeyView" ref="252233658"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
+ <float key="IBUIAlpha">0.75</float>
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
<object class="NSMutableArray" key="IBUIItems">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -392,6 +392,14 @@
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">toolbar</string>
+ <reference key="source" ref="841351856"/>
+ <reference key="destination" ref="791792189"/>
+ </object>
+ <int key="connectionID">104</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="382596724"/>
<reference key="destination" ref="841351856"/>
@@ -653,7 +661,7 @@
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
- <int key="maxID">103</int>
+ <int key="maxID">104</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -872,6 +880,7 @@
<string>segmCtrl</string>
<string>textView0</string>
<string>textView1</string>
+ <string>toolbar</string>
<string>webView0</string>
<string>webView1</string>
<string>webView2</string>
@@ -886,6 +895,7 @@
<string>UISegmentedControl</string>
<string>UITextView</string>
<string>UITextView</string>
+ <string>UIToolbar</string>
<string>UIWebView</string>
<string>UIWebView</string>
<string>UIWebView</string>
@@ -903,6 +913,7 @@
<string>segmCtrl</string>
<string>textView0</string>
<string>textView1</string>
+ <string>toolbar</string>
<string>webView0</string>
<string>webView1</string>
<string>webView2</string>
@@ -939,6 +950,10 @@
<string key="candidateClassName">UITextView</string>
</object>
<object class="IBToOneOutletInfo">
+ <string key="name">toolbar</string>
+ <string key="candidateClassName">UIToolbar</string>
+ </object>
+ <object class="IBToOneOutletInfo">
<string key="name">webView0</string>
<string key="candidateClassName">UIWebView</string>
</object>
@@ -967,7 +982,7 @@
<string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
- <real value="1280" key="NS.object.0"/>
+ <real value="1072" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
View
27 examples/iOS/grd.scm
@@ -54,6 +54,7 @@ This program implements several commands:
grd mkdir <remote_dir> create directory
grd rm <remote_file> remove file or dir
grd mv <rem_file1> <rem_file2> remove file or dir
+ grd cat <remote_file> show content of file
grd eval <expr> evaluate expression
grd load <remote_file> load file
grd push <local_file> 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)
View
1 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
View
3 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"))
View
4 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

0 comments on commit 6e4a04a

Please sign in to comment.