From 40eb555605215d8d8249bdeb28913cc6c5e648b4 Mon Sep 17 00:00:00 2001 From: Jeremy Penner Date: Tue, 1 Feb 2011 16:45:57 -0800 Subject: [PATCH] begin hungarian documentation, make urpd's end with slashes for consistency --- src/Folder.as | 2 +- src/Imgdir.as | 14 +++++++------- src/WorldStage.as | 30 +++++++++++++++++++++++++----- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/Folder.as b/src/Folder.as index 69a33f3..3f8c9b4 100644 --- a/src/Folder.as +++ b/src/Folder.as @@ -23,7 +23,7 @@ package public function Folder(sidebar: Sidebar, urpd: String) { super(sidebar, bmpFolder); - text = new Text(urpd, 2, (img.scaledHeight / 2) - 6); + text = new Text(urpd.slice(0, urpd.length - 1), 2, (img.scaledHeight / 2) - 6); text.color = 0x4444FF; addGraphic(text); diff --git a/src/Imgdir.as b/src/Imgdir.as index c1a811d..26c1e93 100644 --- a/src/Imgdir.as +++ b/src/Imgdir.as @@ -19,14 +19,14 @@ package public static const LOADED: String = "ImgLoaded"; private var dir: File; private var mpurpf_bmp: Object; - private var rgurpd: Object; + private var rgdirname: Object; public function Imgdir(url: String) { trace("imgdir: " + url); this.dir = new File(url); this.dir.addEventListener(FileListEvent.DIRECTORY_LISTING, OnDirUpdate); this.mpurpf_bmp = { }; - this.rgurpd = { }; + this.rgdirname = { }; } public function Update() : void @@ -38,13 +38,13 @@ package { for each (var file: File in ev.files) { - var urp: String = file.name; - if (file.isDirectory && !rgurpd[urp]) + if (file.isDirectory && !rgdirname[file.name]) { - rgurpd[urp] = true; - dispatchEvent(new EvNewImg(LOADED, urp, null)); + var urpd: String = file.name + "/"; + rgdirname[urpd] = true; + dispatchEvent(new EvNewImg(LOADED, urpd, null)); } - else if (!file.isDirectory && /\.(png|gif|jpg|jpeg)$/i.test(urp) && !mpurpf_bmp[urp]) + else if (!file.isDirectory && /\.(png|gif|jpg|jpeg)$/i.test(file.name) && !mpurpf_bmp[file.name]) LoadBmp(file, OnBmpLoaded); } } diff --git a/src/WorldStage.as b/src/WorldStage.as index 75491e9..2c2c934 100644 --- a/src/WorldStage.as +++ b/src/WorldStage.as @@ -1,3 +1,21 @@ +// Hungarian-to-English dictionary + +// bits of paths are represented as strings, with the following schema determining the name: +// u(ab|rp|rf)(d|f)? +// u: url +// ab: absolute path (includes beginning of url) +// rp: partial relative path -- indicates a single "level" of a path +// rf: full relative path -- a path that is intended to be put on the end of an implied absolute path to make a complete absolute path +// d: directory -- always ends with a slash +// f: file +// if the function accepts either a directory or file, neither d nor f is specified +// examples: +// file:///c/foo/bar/baz/ -- uabd +// file:///c/foo/bar.baz -- uabf +// bar/baz.foo -- urff +// bar/baz/ -- urfd +// bar/ -- urpd + package { import flash.display.BitmapData; @@ -74,7 +92,6 @@ package Load(); addTween(new Alarm(3, FileWatcher.CheckAll, Tween.LOOPING), true); } - public function KillToken(tok: Token): void { remove(tok); @@ -82,6 +99,9 @@ package if (tokSelected === tok) tokSelected = null; } + + // pointScreen - a position on the screen + // pointReal - a position on the stage public function PointRealFromScreen(pointScreen: Point): Point { return new Point((pointScreen.x / zoom) + pointView.x, (pointScreen.y / zoom) + pointView.y); @@ -98,6 +118,7 @@ package else entity = new Factory(SidebarFind(LAYER_SIDEBAR), ev.urp, ev.bmp); } + public function UabFromUrf(urf:String): String { return uabd + urf; @@ -108,7 +129,7 @@ package } public function Urfd(): String { - return rgurpd.join("/") + "/"; + return rgurpd.join("") + "/"; } public function Chdir(urpd: String): void { @@ -124,7 +145,7 @@ package entity.active = false; } } - if (urpd === "..") + if (urpd === "../") rgurpd = rgurpd.slice(0, rgurpd.length - 1); else if (urpd !== null) rgurpd.push(urpd); @@ -137,7 +158,7 @@ package AddSidebar(new Sidebar(0, -32, 0, 0, 32, FP.height, LAYER_SIDEBAR, urpd !== null /*fStartShown*/, true)); if (rgurpd.length > 0) - OnNewImg(new EvNewImg(Imgdir.LOADED, "..", null)); + OnNewImg(new EvNewImg(Imgdir.LOADED, "../", null)); } private function SidebarFind(layer: int):Sidebar { @@ -335,5 +356,4 @@ package return xml; } } - } \ No newline at end of file