begin hungarian documentation, make urpd's end with slashes for consistency

This commit is contained in:
Jeremy Penner 2011-02-01 16:45:57 -08:00
parent 4731b4f15e
commit 40eb555605
3 changed files with 33 additions and 13 deletions

View file

@ -23,7 +23,7 @@ package
public function Folder(sidebar: Sidebar, urpd: String) public function Folder(sidebar: Sidebar, urpd: String)
{ {
super(sidebar, bmpFolder); 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; text.color = 0x4444FF;
addGraphic(text); addGraphic(text);

View file

@ -19,14 +19,14 @@ package
public static const LOADED: String = "ImgLoaded"; public static const LOADED: String = "ImgLoaded";
private var dir: File; private var dir: File;
private var mpurpf_bmp: Object; private var mpurpf_bmp: Object;
private var rgurpd: Object; private var rgdirname: Object;
public function Imgdir(url: String) public function Imgdir(url: String)
{ {
trace("imgdir: " + url); trace("imgdir: " + url);
this.dir = new File(url); this.dir = new File(url);
this.dir.addEventListener(FileListEvent.DIRECTORY_LISTING, OnDirUpdate); this.dir.addEventListener(FileListEvent.DIRECTORY_LISTING, OnDirUpdate);
this.mpurpf_bmp = { }; this.mpurpf_bmp = { };
this.rgurpd = { }; this.rgdirname = { };
} }
public function Update() : void public function Update() : void
@ -38,13 +38,13 @@ package
{ {
for each (var file: File in ev.files) for each (var file: File in ev.files)
{ {
var urp: String = file.name; if (file.isDirectory && !rgdirname[file.name])
if (file.isDirectory && !rgurpd[urp])
{ {
rgurpd[urp] = true; var urpd: String = file.name + "/";
dispatchEvent(new EvNewImg(LOADED, urp, null)); 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); LoadBmp(file, OnBmpLoaded);
} }
} }

View file

@ -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 package
{ {
import flash.display.BitmapData; import flash.display.BitmapData;
@ -74,7 +92,6 @@ package
Load(); Load();
addTween(new Alarm(3, FileWatcher.CheckAll, Tween.LOOPING), true); addTween(new Alarm(3, FileWatcher.CheckAll, Tween.LOOPING), true);
} }
public function KillToken(tok: Token): void public function KillToken(tok: Token): void
{ {
remove(tok); remove(tok);
@ -82,6 +99,9 @@ package
if (tokSelected === tok) if (tokSelected === tok)
tokSelected = null; tokSelected = null;
} }
// pointScreen - a position on the screen
// pointReal - a position on the stage
public function PointRealFromScreen(pointScreen: Point): Point public function PointRealFromScreen(pointScreen: Point): Point
{ {
return new Point((pointScreen.x / zoom) + pointView.x, (pointScreen.y / zoom) + pointView.y); return new Point((pointScreen.x / zoom) + pointView.x, (pointScreen.y / zoom) + pointView.y);
@ -98,6 +118,7 @@ package
else else
entity = new Factory(SidebarFind(LAYER_SIDEBAR), ev.urp, ev.bmp); entity = new Factory(SidebarFind(LAYER_SIDEBAR), ev.urp, ev.bmp);
} }
public function UabFromUrf(urf:String): String public function UabFromUrf(urf:String): String
{ {
return uabd + urf; return uabd + urf;
@ -108,7 +129,7 @@ package
} }
public function Urfd(): String public function Urfd(): String
{ {
return rgurpd.join("/") + "/"; return rgurpd.join("") + "/";
} }
public function Chdir(urpd: String): void public function Chdir(urpd: String): void
{ {
@ -124,7 +145,7 @@ package
entity.active = false; entity.active = false;
} }
} }
if (urpd === "..") if (urpd === "../")
rgurpd = rgurpd.slice(0, rgurpd.length - 1); rgurpd = rgurpd.slice(0, rgurpd.length - 1);
else if (urpd !== null) else if (urpd !== null)
rgurpd.push(urpd); rgurpd.push(urpd);
@ -137,7 +158,7 @@ package
AddSidebar(new Sidebar(0, -32, 0, 0, 32, FP.height, LAYER_SIDEBAR, urpd !== null /*fStartShown*/, true)); AddSidebar(new Sidebar(0, -32, 0, 0, 32, FP.height, LAYER_SIDEBAR, urpd !== null /*fStartShown*/, true));
if (rgurpd.length > 0) if (rgurpd.length > 0)
OnNewImg(new EvNewImg(Imgdir.LOADED, "..", null)); OnNewImg(new EvNewImg(Imgdir.LOADED, "../", null));
} }
private function SidebarFind(layer: int):Sidebar private function SidebarFind(layer: int):Sidebar
{ {
@ -335,5 +356,4 @@ package
return xml; return xml;
} }
} }
} }