summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaromil <jaromil@dyne.org>2012-04-09 08:32:23 (GMT)
committer Jaromil <jaromil@dyne.org>2012-04-09 09:00:03 (GMT)
commitc005e216aae4c91f1469f0ad7de317b5bab1616b (patch)
tree2d4a9a019dfcf14abc3b1ed39be26b36d7154ff5
parentb12d2319e1162069d148b19ac250c7085196cf8a (diff)
build app bundle for osx
-rw-r--r--contrib/mac/TBT.app/Contents/Info.plist26
-rwxr-xr-xcontrib/mac/TBT.app/Contents/MacOS/RecordTBT.command30
-rw-r--r--contrib/mac/TBT.app/Contents/PkgInfo1
-rw-r--r--contrib/mac/TBT.app/Contents/Resources/tbt-typewriter.js207
-rw-r--r--contrib/mac/TBT.app/Contents/Resources/tbt.icnsbin0 -> 55572 bytes
-rwxr-xr-xcontrib/mac/pack.sh44
6 files changed, 308 insertions, 0 deletions
diff --git a/contrib/mac/TBT.app/Contents/Info.plist b/contrib/mac/TBT.app/Contents/Info.plist
new file mode 100644
index 0000000..2fe9ead
--- /dev/null
+++ b/contrib/mac/TBT.app/Contents/Info.plist
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>RecordTBT.command</string>
+ <key>CFBundleIconFile</key>
+ <string>tbt.icns</string>
+ <key>CFBundleIdentifier</key>
+ <string>org.dyne.tbt</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>TBT</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>CSResourcesFileMapped</key>
+ <true/>
+</dict>
+</plist>
diff --git a/contrib/mac/TBT.app/Contents/MacOS/RecordTBT.command b/contrib/mac/TBT.app/Contents/MacOS/RecordTBT.command
new file mode 100755
index 0000000..27e9728
--- /dev/null
+++ b/contrib/mac/TBT.app/Contents/MacOS/RecordTBT.command
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+appbin="${0%/*}"
+appbase=$(dirname $(dirname $(dirname $appbin)))
+
+#on getPath()
+# set myPath to path to me as string
+# set macPath to (myPath & "Contents:Resources:")
+# set binaryPath to POSIX path of macPath
+#end getPath
+
+cd $appbase
+
+cp -f $appbin/../Resources/tbt-typewriter.js $appbase
+
+osascript <<EOF
+tell application "Terminal"
+ activate
+ tell window 1
+ do script "$appbin/tbt -r -s html $appbase/TBT-record.html; exit"
+ repeat while busy
+ delay 1
+ end repeat
+ close
+ end tell
+end tell
+display dialog "Time Based Text recording saved in $appbase/TBT-record.html" with icon alias ((path to me) & "Contents:Resources:tbt.icns" as string)
+EOF
+
+
diff --git a/contrib/mac/TBT.app/Contents/PkgInfo b/contrib/mac/TBT.app/Contents/PkgInfo
new file mode 100644
index 0000000..5119498
--- /dev/null
+++ b/contrib/mac/TBT.app/Contents/PkgInfo
@@ -0,0 +1 @@
+APPLTBT
diff --git a/contrib/mac/TBT.app/Contents/Resources/tbt-typewriter.js b/contrib/mac/TBT.app/Contents/Resources/tbt-typewriter.js
new file mode 100644
index 0000000..9698973
--- /dev/null
+++ b/contrib/mac/TBT.app/Contents/Resources/tbt-typewriter.js
@@ -0,0 +1,207 @@
+// TBT javascript extensions: rgareus 2008
+// TBT javascript prototype: Jaromil 2007
+// reference javascript typewriter documentation: F. Permadi 2002
+// GNU GPL
+
+
+function TBT() {
+ this.setRowCarriageReturn = setRowCarriageReturn;
+ this.setXhtml = setXhtml;
+ this.setSpeed = setSpeed;
+ this.startTyping = startTyping;
+ this.feed = feed;
+ var currentChar;
+ var destination;
+ var cur_x;
+ var cur_y;
+ var row;
+ var col;
+ var text;
+ var render_text;
+ var rowsize;
+ var colsize;
+ var recording;
+ var cr;
+ var cc;
+ var rowcr=0; // config option; do a CR (\r) when moving the cursor up/down
+ var xhtml=0; // html or xhtml
+ var speed=1; // time factor.
+
+ function setSpeed(s) {
+ if (s> 0.01 && s< 20) this.speed=s;
+ else speed=1.0;
+ }
+
+ function setXhtml(onoff) {
+ xhtml=onoff?true:false;
+ }
+
+ function setRowCarriageReturn(onoff) {
+ rowcr=onoff?true:false;
+ }
+
+ function startTyping(destinationParam, tbtrecord) {
+ currentChar = 0;
+ destination = destinationParam;
+ recording = tbtrecord;
+
+ // global text positions
+ row = 0;
+ col = 0;
+ // cursor positions
+ cur_x = 0;
+ cur_y = 0;
+ // length counters
+ rowsize = 0;
+ colsize = 0;
+ cr = 0;
+ cc = 0;
+
+ // text bidimensional array
+ text = new Array();
+ text[0] = new Array();
+ // text render buffer
+ render_text = "";
+
+ setTimeout(this.feed, speed*recording[currentChar][1] );
+ }
+
+ function feed() {
+ var dest = document.getElementById(destination);
+
+ if (dest) {
+ // && dest.innerHTML)
+
+ /* TODO: handle movement keys:
+ KEY_BACKSPACE 275, 127, 272
+ KEY_PAGE_UP 261 ; KEY_PAGE_DOWN 262
+ KEY_HOME 263 ; KEY_DELETE 275
+ port the abstract_console from slw in js
+ */
+
+ // get the next char
+ switch( recording[currentChar][0] ) {
+ case 10: // NEWLINE
+ case 13: // RETURN
+ cur_y++; row++;
+ cur_x = 0; col = 0;
+ if(row >= text.length) {
+ text[row] = new Array();
+ }
+ break;
+
+ case 8: // standard ASCII BACKSPACE
+ case 127: // other low level BACKSPACE codes
+ case 272: // (APPLE BACKSPACE)
+ case 275: // (SOMETIMES!?)
+
+ if(col > 0) // delete if not at the beginning of line
+ text[row].splice(col-1,1);
+
+ if(cur_x > 0) {
+ cur_x--;
+ col--;
+ } else { // backspace at the beginning of a line
+ // move everything up one line
+ // TODO
+ }
+ break;
+
+ case 257: // UP
+ if(row <= 0) break;
+ cur_y--; row--;
+ if (rowcr) { col=0; cur_x=0; }
+ break;
+ case 258: // DOWN
+ if(row >= text.length) break;
+ cur_y++; row++;
+ if (rowcr) { col=0; cur_x=0; }
+ break;
+ case 259: // LEFT
+ if(cur_x <= 0) break;
+ cur_x--;
+ col--;
+ break;
+ case 260: // RIGHT
+ // if(cur_x >= text[row].length) break;
+ cur_x++;
+ col++;
+ break;
+
+ default:
+ if (!text[row]) text[row] = new Array();
+ text[row].splice(col,0,recording[currentChar][0]);
+ cur_x++; col++;
+ break;
+ }
+
+ // RENDER TEXT
+ render_text = "";
+
+ rowsize = text.length;
+ for(cr = 0; cr < rowsize; cr++) {
+
+ colsize = text[cr].length;
+
+ if(cur_y == cr) { // cursor row
+
+ for(cc = 0; cc < colsize; cc++) {
+
+ if(cur_x == cc) { // draw cursor
+ render_text += "<u>";
+ render_text += String.fromCharCode( text[cr][cc] );
+ render_text += "</u>";
+ } else // not yet on cursor
+ render_text += String.fromCharCode( text[cr][cc] );
+
+ }
+
+ // draw cursor at the end of line
+ if(cur_x >= colsize) render_text += "_";
+
+ } else // no need to draw the cursor
+ for(cc = 0; cc < colsize; cc++)
+ render_text += String.fromCharCode( text[cr][cc] );
+
+
+ // newline
+ render_text += xhtml?"<br/>":"<br>";
+ }
+
+ // render_text += String.fromCharCode( recording[currentChar][0] );
+ dest.innerHTML = render_text;
+
+
+
+ // DOM compliant alternative:
+ // var textNode=document.createTextNode(text);
+ // dest.replaceChild(textNode, dest.childNodes[0]);
+
+
+
+ // go to the next entry
+ currentChar++;
+
+
+ if (currentChar >= recording.length) {
+
+ // end of record, restart after 5 seconds
+ currentChar=0;
+ render_text="";
+
+ // clear all text buffer
+ for(cr=0; cr < text.length; cr++)
+ delete text[cr];
+ delete text;
+
+ // end of text
+
+ } else {
+
+ // RECURSION IS TIME -jrml 31jan2007
+ setTimeout(feed, speed*recording[currentChar][1] );
+ }
+ }
+ }
+};
+//Setup VIM: ex: sw=4 ts=8 enc=utf-8 :
diff --git a/contrib/mac/TBT.app/Contents/Resources/tbt.icns b/contrib/mac/TBT.app/Contents/Resources/tbt.icns
new file mode 100644
index 0000000..b4470e5
--- /dev/null
+++ b/contrib/mac/TBT.app/Contents/Resources/tbt.icns
Binary files differ
diff --git a/contrib/mac/pack.sh b/contrib/mac/pack.sh
new file mode 100755
index 0000000..a8e4eee
--- /dev/null
+++ b/contrib/mac/pack.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+# quick pack of an OSX app bundle for TBT
+# by Jaromil
+
+if ! [ -r /opt/local/lib/libslang.2.dylib ]; then
+ echo "No libslang2 found, you need to install MacPorts and build it"
+ echo "# sudo port install slang2 +universal"
+ exit 0
+fi
+
+cp /opt/local/lib/libslang.2.dylib libslang.2.dylib
+install_name_tool -id @executable_path/../Frameworks/libslang.2.dylib libslang.2.dylib
+
+echo "Compiling universal binary"
+
+if ! [ -r tbt.i386 ]; then
+cd ../..
+make clean
+CXXFLAGS="-arch i386" ./configure
+make
+cp src/tbt contrib/mac/tbt.i386
+cd -
+fi
+
+if ! [ -r tbt.x86_64 ]; then
+cd ../..
+make clean
+CXXFLAGS="-arch x86_64" ./configure
+make
+cp src/tbt contrib/mac/tbt.x86_64
+cd -
+fi
+
+
+lipo tbt.i386 tbt.x86_64 -create -output tbt
+
+cp tbt TBT.app/Contents/MacOS
+
+install_name_tool -change \
+ /opt/local/lib/libslang.2.dylib \
+ @executable_path/../Frameworks/libslang.2.dylib \
+ TBT.app/Contents/MacOS/tbt
+