- Timestamp:
- 02/10/11 22:37:35 (1 year ago)
- Files:
-
- trunk/import/flowerd/common.d (modified) (3 diffs)
- trunk/import/flowerd/config.d (modified) (10 diffs)
- trunk/import/flowerd/dfl.d (modified) (7 diffs)
- trunk/import/flowerd/dwt.d (modified) (11 diffs)
- trunk/import/flowerd/sharedlib.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/import/flowerd/common.d
r20 r25 3 3 import tango.io.FileSystem; 4 4 import tango.io.FilePath; 5 import tango.util.PathUtil;6 import tango.io. FileConst;5 import Path = tango.io.Path; 6 import tango.io.model.IFile; 7 7 import tango.text.Util; 8 8 import tango.sys.Environment; 9 9 //alias ulong Hash; 10 10 alias uint Hash; … … 37 37 if(!destpath.length) return 0; 38 38 if(!basepath.length) {ret=destpath;return 1;} 39 auto basefp=FileSystem.toAbsolute(FilePath(normalize(basepath))); 40 auto destfp=FileSystem.toAbsolute(FilePath(normalize(destpath))); 39 auto basefp=(new FilePath(Path.normalize(basepath))).absolute(tango.sys.Environment.Environment.cwd); 40 //auto basefp=FileSystem.toAbsolute(FilePath(Path.normalize(basepath))); 41 auto destfp=(new FilePath(Path.normalize(destpath))).absolute(tango.sys.Environment.Environment.cwd); 42 //auto destfp = FileSystem.toAbsolute(FilePath(Path.normalize(destpath))); 41 43 basepath=basefp.toString(); 42 44 destpath=destfp.toString(); … … 59 61 if (basedirs[i] != destdirs[i]) break; 60 62 lastCommonDir=i; 61 } 63 } 62 64 63 65 int end=basedirs.length-(lastCommonDir+1); trunk/import/flowerd/config.d
r18 r25 5 5 import Int=tango.text.convert.Integer; 6 6 import tango.text.Util; 7 import tango.io. FileConduit;8 import tango.io.GrowBuffer;7 import tango.io.device.File; 8 import DeviceArray = tango.io.device.Array; 9 9 import tango.io.model.IConduit; 10 10 … … 198 198 void each(void delegate(ConfigNode) dg) 199 199 { 200 if(dg is null) return false; 200 //if(dg is null) return false; 201 if(dg is null) return; //January 19, 2011 yidabu 201 202 foreach(c;mChildren) dg(c); 202 return true; 203 //return true; 204 return; 203 205 } 204 206 … … 512 514 bool load(char[] file) 513 515 { 514 File Conduit fc=Try.silentr({return new FileConduit(file);});516 File fc=Try.silentr({return new File(file);}); 515 517 if(fc) 516 518 { … … 523 525 bool save(char[] file) 524 526 { 525 File Conduit fc=Try.silentr({return new FileConduit(file,FileConduit.WriteCreate);});527 File fc=Try.silentr({return new File(file,File.WriteCreate);}); 526 528 if(fc) 527 529 { … … 615 617 { 616 618 int c=-1; 617 scope auto g=new GrowBuffer(100,100);619 scope auto g=new DeviceArray.Array(100,100); 618 620 scope auto bytes=new char[1]; 619 621 for(;;++c) … … 638 640 char[] readline(ref int cbyte) 639 641 { 640 scope auto g=new GrowBuffer(100,100);642 scope auto g=new DeviceArray.Array(100,100); 641 643 scope auto bytes=new char[1]; 642 644 for(;cbyte!='\n' && cbyte!=EOF;) … … 662 664 char[] readstring(ref int cbyte,ref int ret) 663 665 { 664 scope auto g=new GrowBuffer(100,100);666 scope auto g=new DeviceArray.Array(100,100); 665 667 auto bytes=new char[1]; 666 668 int brace=cbyte; … … 681 683 else if(cbyte=='n') {bytes[0]='\n';} 682 684 else return null; 683 685 684 686 } 685 687 else bytes[0]=cast(char)cbyte; … … 707 709 if(i!=ident || cbyte==EOF) {lastbyte=cbyte;lastident=i;break;} 708 710 else lastident=0; 709 711 710 712 name=readname(cbyte); 711 713 if(!name.length || name=="." || name==".." || locate(name,'/')<name.length) return false; … … 723 725 cbyte=getbyte; 724 726 } 725 727 726 728 if(t==':' || t=='%' || t=='$') value=readline(cbyte); 727 729 else if(t=='s') trunk/import/flowerd/dfl.d
r18 r25 106 106 this.argv=argv; 107 107 main(); 108 Application.run(mForm,&execute); 108 //Application.run(mForm,&execute); 109 Application.run(mForm); 109 110 } 110 111 … … 184 185 { 185 186 super.onMouseMove(mea); 186 187 187 188 traverseMouseEvent(MOUSE_MOVE,mea.x,mea.y,getMouseButton(mea),0); 188 189 } … … 212 213 traverseKeyboardEvent(KEY_DOWN,kea.keyCode,getAltState(kea)); 213 214 } 214 215 215 216 void onKeyUp(KeyEventArgs kea) 216 217 { … … 218 219 traverseKeyboardEvent(KEY_UP,kea.keyCode,getAltState(kea)); 219 220 } 220 221 221 222 void onKeyPress(KeyPressEventArgs kea) 222 223 { … … 264 265 } 265 266 266 bool traverseMouseEvent( UINT mouseCmd, INT x, INT y, UINT buttons, UINT alt_state ) 267 { 268 MOUSE_PARAMS mp; 267 bool traverseMouseEvent( UINT mouseCmd, INT x, INT y, UINT buttons, UINT alt_state ) 268 { 269 MOUSE_PARAMS mp; 269 270 mp.alt_state = alt_state; 270 271 mp.button_state = buttons; … … 275 276 return result; 276 277 } 277 278 bool traverseKeyboardEvent( UINT keyCmd, UINT code, UINT alt_state ) 278 279 bool traverseKeyboardEvent( UINT keyCmd, UINT code, UINT alt_state ) 279 280 { 280 281 KEY_PARAMS kp; … … 338 339 mControl.onKeyDown(kea); 339 340 } 340 341 341 342 void onKeyUp(KeyEventArgs kea) 342 343 { 343 344 mControl.onKeyUp(kea); 344 345 } 345 346 346 347 void onKeyPress(KeyPressEventArgs kea) 347 348 { trunk/import/flowerd/dwt.d
r17 r25 5 5 version(DWT_import_libs) 6 6 { 7 pragma(lib, "dwt.lib");7 //pragma(lib, "dwt2.lib"); 8 8 pragma(lib, "advapi32"); 9 9 pragma(lib, "comctl32.lib"); … … 22 22 } 23 23 24 import dwt.DWT;25 import dwt.widgets.Control;26 import dwt.widgets.Display;27 import dwt.widgets.Shell;28 import dwt.widgets.Composite;29 import dwt.widgets.MessageBox;30 import dwt.widgets.Canvas;31 import dwt.widgets.Listener;32 import dwt.widgets.Event;33 import dwt.graphics.Point;34 import dwt.graphics.Rectangle;35 import dwt.layout.FillLayout;36 import dwt.internal.win32.OS;37 38 // DWT's TIMERPROC is wrong24 import org.eclipse.swt.SWT; 25 import org.eclipse.swt.widgets.Control; 26 import org.eclipse.swt.widgets.Display; 27 import org.eclipse.swt.widgets.Shell; 28 import org.eclipse.swt.widgets.Composite; 29 import org.eclipse.swt.widgets.MessageBox; 30 import org.eclipse.swt.widgets.Canvas; 31 import org.eclipse.swt.widgets.Listener; 32 import org.eclipse.swt.widgets.Event; 33 import org.eclipse.swt.graphics.Point; 34 import org.eclipse.swt.graphics.Rectangle; 35 import org.eclipse.swt.layout.FillLayout; 36 import org.eclipse.swt.internal.win32.OS; 37 38 //SWT's TIMERPROC is wrong 39 39 extern(Windows) 40 40 { … … 46 46 class DWTForm : Display //easy access to syncExec 47 47 { 48 this(int style= DWT.SHELL_TRIM)48 this(int style=SWT.SHELL_TRIM) 49 49 { 50 50 super(); … … 66 66 } 67 67 68 int msgBox(char[] text,char[] title="",int style= DWT.ICON_INFORMATION|DWT.OK)68 int msgBox(char[] text,char[] title="",int style=SWT.ICON_INFORMATION|SWT.OK) 69 69 { 70 70 scope auto m=new MessageBox(shell,style); … … 98 98 { 99 99 super(); 100 layout = new HLayoutControl(shell, DWT.NONE);100 layout = new HLayoutControl(shell, SWT.NONE); 101 101 } 102 102 … … 111 111 { 112 112 super(); 113 layout = new HLiteControl(shell, DWT.NONE);113 layout = new HLiteControl(shell, SWT.NONE); 114 114 } 115 115 … … 171 171 int border = getBorderWidth () * 2; 172 172 int width,height; 173 if (wHint !is DWT.DEFAULT) width += wHint;173 if (wHint !is SWT.DEFAULT) width += wHint; 174 174 else width += minWidth; 175 if (hHint !is DWT.DEFAULT) height += hHint;175 if (hHint !is SWT.DEFAULT) height += hHint; 176 176 else height += minHeight(width); 177 177 return new Point (width+border, height+border); … … 209 209 this (Composite parent, int style) 210 210 { 211 super(parent, style| DWT.NO_BACKGROUND|DWT.DOUBLE_BUFFERED);211 super(parent, style|SWT.NO_BACKGROUND|SWT.DOUBLE_BUFFERED); 212 212 setDragDetect(false); 213 addListener( DWT.Paint,new onPaint);214 addListener( DWT.Resize,new onSize);215 addListener( DWT.MouseMove,new onMouseMove);216 addListener( DWT.MouseDown,new onMouseDown);217 addListener( DWT.MouseDoubleClick,new onMouseDoubleClick);218 addListener( DWT.MouseWheel,new onMouseWheel);219 addListener( DWT.MouseUp,new onMouseUp);220 addListener( DWT.KeyDown,new onKeyDown);221 addListener( DWT.KeyUp,new onKeyUp);213 addListener(SWT.Paint,new onPaint); 214 addListener(SWT.Resize,new onSize); 215 addListener(SWT.MouseMove,new onMouseMove); 216 addListener(SWT.MouseDown,new onMouseDown); 217 addListener(SWT.MouseDoubleClick,new onMouseDoubleClick); 218 addListener(SWT.MouseWheel,new onMouseWheel); 219 addListener(SWT.MouseUp,new onMouseUp); 220 addListener(SWT.KeyDown,new onKeyDown); 221 addListener(SWT.KeyUp,new onKeyUp); 222 222 } 223 223 … … 225 225 { 226 226 int alts; 227 if(e.stateMask& DWT.SHIFT) alts |= KEYBOARD_STATES.SHIFT_KEY_PRESSED;228 if(e.stateMask& DWT.CTRL) alts |= KEYBOARD_STATES.CONTROL_KEY_PRESSED;229 if(e.stateMask& DWT.ALT) alts |= KEYBOARD_STATES.ALT_KEY_PRESSED;227 if(e.stateMask&SWT.SHIFT) alts |= KEYBOARD_STATES.SHIFT_KEY_PRESSED; 228 if(e.stateMask&SWT.CTRL) alts |= KEYBOARD_STATES.CONTROL_KEY_PRESSED; 229 if(e.stateMask&SWT.ALT) alts |= KEYBOARD_STATES.ALT_KEY_PRESSED; 230 230 return alts; 231 231 } … … 297 297 int border = getBorderWidth () * 2; 298 298 int width,height; 299 if (wHint !is DWT.DEFAULT) width += wHint;299 if (wHint !is SWT.DEFAULT) width += wHint; 300 300 else width += minWidth; 301 if (hHint !is DWT.DEFAULT) height += hHint;301 if (hHint !is SWT.DEFAULT) height += hHint; 302 302 else height += minHeight; 303 303 return new Point (width+border, height+border); … … 344 344 static auto cursor_ids = 345 345 [ 346 DWT.CURSOR_ARROW,347 DWT.CURSOR_IBEAM,348 DWT.CURSOR_WAIT,349 DWT.CURSOR_CROSS,350 DWT.CURSOR_UPARROW,351 DWT.CURSOR_SIZENWSE,352 DWT.CURSOR_SIZENESW,353 DWT.CURSOR_SIZEWE,354 DWT.CURSOR_SIZENS,355 DWT.CURSOR_SIZEALL,356 DWT.CURSOR_NO,357 DWT.CURSOR_APPSTARTING,358 DWT.CURSOR_HELP,359 DWT.CURSOR_HAND,346 SWT.CURSOR_ARROW, 347 SWT.CURSOR_IBEAM, 348 SWT.CURSOR_WAIT, 349 SWT.CURSOR_CROSS, 350 SWT.CURSOR_UPARROW, 351 SWT.CURSOR_SIZENWSE, 352 SWT.CURSOR_SIZENESW, 353 SWT.CURSOR_SIZEWE, 354 SWT.CURSOR_SIZENS, 355 SWT.CURSOR_SIZEALL, 356 SWT.CURSOR_NO, 357 SWT.CURSOR_APPSTARTING, 358 SWT.CURSOR_HELP, 359 SWT.CURSOR_HAND, 360 360 ]; 361 361 static int lastid=-1; trunk/import/flowerd/sharedlib.d
r18 r25 33 33 import tango.stdc.stdlib; 34 34 import tango.stdc.string; 35 import tango.stdc.stringz; 35 36 36 37 private:
