[资料] dmd r487 tango r5460 phobos v1.061 v2.046

betty_betty2008 2010-04-21
sleets 写道
dwt1 ==> dwt 0.36
dwt2 ==> det-win & dwtx

PHOBOS 和 d2相关的lib文件没有,所以编译包里带的sqlite,pcred,dfl,dwt都需要和tango一起用。

PHOBOS和d2是说这个包可以编译PHOBOS和d2项目,在dmake.ini里配置默认默认标准库后编译时就不用再指定了,编译时内嵌的dmake命令和dmake.conf里的命令可以覆盖dmake.ini里配置的标准库。


俺自家编译了一套这样的架构:
dmd1.058+phobos+std2+dcollections+dfl+juno+xmlp+dbi+dwt(Shawn0.36);
另外一套建立在你之前Tango+dwt基础上:
dmd1056+tango+tangobos+std+std2,

现在想把你的最新的包里加入tangobos+std+std2+xmlp+dcollections,然后再试看能不能把juno在Tango下整好,发现sc.ini文件不能修改?

4/23加:

你的包(未改动)中的pcred库,把pcred.RegExp 里的unittest提取出来制成一测度程序,编译通过,运行里异常:

pcred.RegExp.CompileTimeException: support for \P, \p, and \X has not been compiled


这是什么意思?
sleets 2010-04-24
楼上的错误原因是pcre库没起用utf-8支持,现在修复了。

本包暂不支持其他ide, 如果想尝试在其他ide里使用,可以把dmake.exe,dmake.ini 复制为dmd.exe, dmd.ini(同样在scite目录下), 然后设置ide的dmd路径为scite目录。

本包的配置方式比较特殊,如不习惯可使用原官方包。

sc.ini是动态生成的,把配置写在dmake.ini里,加一节点使用的时候启用比较好。
betty_betty2008 2010-04-27
sleets 写道
楼上的错误原因是pcre库没起用utf-8支持,现在修复了。

本包暂不支持其他ide, 如果想尝试在其他ide里使用,可以把dmake.exe,dmake.ini 复制为dmd.exe, dmd.ini(同样在scite目录下), 然后设置ide的dmd路径为scite目录。

本包的配置方式比较特殊,如不习惯可使用原官方包。

sc.ini是动态生成的,把配置写在dmake.ini里,加一节点使用的时候启用比较好。

还有一个问题,Tango版的DWT怎么没有Browser类而Phobos版的却有?因为什么原因没有将Browser类加入呢,可不可以自行加入,需要做什么修改.
sleets 2010-05-06
需要很多工作,我转化他们老是出问题。最后给删了。
betty_betty2008 2010-05-10
sleets 写道
需要很多工作,我转化他们老是出问题。最后给删了。

LZ维护的DWT项目很多D FANS 受益良多,还是期望有一日能用到BROWSER 和 OLE_COM..
betty_betty2008 2010-05-17
sleets 写道
需要很多工作,我转化他们老是出问题。最后给删了。


帮忙看看这里有什么毛病,例子改自The Definite Guide to SWT and JFace/Graphics/Image 一节,程序运行时没有出现动画,窗口也未能正确显示.


public class AnimatorDoubleBuffer {
  // The width (and height) of the image
  
  
  private const int IMAGE_WIDTH = 100;

  // The timer interval in milliseconds
  private const int TIMER_INTERVAL = 10;

  // The location of the "ball"
  private int x = 0;
  private int y = 0;

  // The direction the "ball" is moving
  private int directionX = 1;
  private int directionY = 1;

  // We draw everything on this canvas
  private Canvas canvas;

  /**
   * Runs the application
   */
  public void show() {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Animator Double Buffer");
    createContents(shell);
    shell.open();

    // Set up the timer for the animation
    Runnable runnable = new class Runnable {
      public void run() {
        animate();
        display.timerExec(TIMER_INTERVAL, this);
      }
    };

    // Launch the timer
    display.timerExec(TIMER_INTERVAL, runnable);

    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }

    // Kill the timer
    display.timerExec(-1, runnable);
    display.dispose();
  }

  /**
   * Creates the main window's contents
   * 
   * @param shell the main window
   */
  private void createContents(Shell shell) {
    shell.setLayout(new FillLayout());

    // Create the canvas for drawing
    canvas = new Canvas(shell, DWT.NO_BACKGROUND);
    canvas.addPaintListener(new class PaintListener {
      public void paintControl(PaintEvent event) {
        // Create the image to fill the canvas
        Image image = new Image(shell.getDisplay(), canvas.getBounds());

        // Set up the offscreen gc
        GC gcImage = new GC(image);

        // Draw the background
        gcImage.setBackground(event.gc.getBackground());
        gcImage.fillRectangle(image.getBounds());

        // Set the color of the ball
        gcImage.setBackground(shell.getDisplay().getSystemColor(DWT.COLOR_RED));

        // Draw the ball
        gcImage.fillOval(x, y, IMAGE_WIDTH, IMAGE_WIDTH);

        // Draw the offscreen buffer to the screen
        event.gc.drawImage(image, 0, 0);

        // Clean up
        image.dispose();
        gcImage.dispose();
      }
    });
  }

  /**
   * Animates the next frame
   */
  public void animate() {
    // Determine the ball's location
    x += directionX;
    y += directionY;

    // Determine out of bounds
    Rectangle rect = canvas.getClientArea();
    if (x < 0) {
      x = 0;
      directionX = 1;
    } else if (x > rect.width - IMAGE_WIDTH) {
      x = rect.width - IMAGE_WIDTH;
      directionX = -1;
    }
    if (y < 0) {
      y = 0;
      directionY = 1;
    } else if (y > rect.height - IMAGE_WIDTH) {
      y = rect.height - IMAGE_WIDTH;
      directionY = -1;
    }

    // Force a redraw
    canvas.redraw();
  }

  /**
   * The application entry point
   * 
   * @param args the command line arguments
   */
  public static void main(string[] args) {
    auto form=new AnimatorDoubleBuffer;
	form.show;
  }
}


void main(string[] args)
{
	/+
	auto form=new AnimatorDoubleBuffer;
	form.show;
	+/
	AnimatorDoubleBuffer.main(args);
}



还有这个,以前好好的,现在是黑乎乎的一团.happyguy.gif存在当前.
module happy;

import dwt.all;

class HappyGuy
{
	public void run()
	{
		Display display=new Display;
		Shell shell=new Shell(display);
		Image image=new Image(display,"happyguy.gif");
		createContents(shell,image);
		shell.pack;
		shell.open;
		
		while(!shell.isDisposed)
		{
			if(!display.readAndDispatch)
				display.sleep;
		}
		if(image !is null)
			image.dispose;
	}
	private void createContents(Shell shell,Image image)
	{
		shell.setLayout(new GridLayout);
		Label label=new Label(shell,DWT.NONE);
		label.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
		label.setImage(image);
		label.setData(label);
	
		shell.addControlListener(new class ControlAdapter
		{
			public void controlResized(ControlEvent event)
			{
				Shell shell=cast(Shell)event.getSource;
				Label label=cast(Label)shell.getData;
				Rectangle rect=shell.getClientArea;
				ImageData data=label.getImage.getImageData;
				if(rect.width<data.width || rect.height<data.height)
				{
					shell.setText("Tool small");
					label.setText("I'm melting");
				}
				else
				{
					shell.setText("Happy Guy Fits");
					label.setImage(label.getImage);
				}
			}
		});
	}
}

int main(char[][] args)
{
	auto form=new HappyGuy;
	form.run;

	return 0;
}
sleets 2010-06-05
@betty_betty2008

委托里对外部的变量引用值竟然是错误的,应该是dmd bug, 但具体是什么搞不清楚。
sleets 2010-06-05
reduce to :
 
extern(C) void printf(char*, ... );

interface MyCall{
	void call(int);
}

class MyObject{
	MyCall[] list;
	
	void add(MyCall _mycall){
		list	~= _mycall ;
	}
	
	void call(int i){
		foreach( c ; list) {
			c.call(i);
		}
	}
}


class MyTest {
	public void run(){
		MyObject obj	= new MyObject ;
		
		test3(obj);
		test2(obj);
		test1!("test1\0")(obj);
		
		obj.call(3);
	}
	
	static void test1(char[] name)(MyObject obj){
		printf("out: `%s` = `%x` \n\0".ptr ,  name.ptr, cast(void*) obj );
		obj.add( new class( delegate(int i){
			printf("in: `%s` = `%x` \n\0".ptr ,  name.ptr, cast(void*) obj );
		} ) MyCall{
			void delegate(int) dg;
			this(void delegate(int) _dg){
				this.dg	= _dg;
			}
			void call(int i) {
				dg(i);
			}
		} ) ;
	}
	
	void test2(MyObject obj){
		test1!("test2\0")(obj);
	}
	
	void test3(ref MyObject obj){
		test1!("test3\0")(obj);
	}
}

void main(){
	auto t	= new MyTest;
	t.run;
}
sleets 2010-06-29
由于我自己对D1的闭包理解错误,所以解释错了。

上面的例子打印出不同的值,是因为D1的闭包出了定义域执行就可能发生错误。


下面的例子可以运行:
//: \@dwtx

import dwt.all ;

alias char[] string;

public class AnimatorDoubleBuffer {
	// The width (and height) of the image
	private const int IMAGE_WIDTH = 100;

	// The timer interval in milliseconds
	private const int TIMER_INTERVAL = 10;

	// The location of the "ball"
	private int x = 0;
	private int y = 0;

	// The direction the "ball" is moving
	private int directionX = 1;
	private int directionY = 1;

	// We draw everything on this canvas
	private Canvas canvas;

	/**
	* Runs the application
	*/
	Display	display;
	Shell		shell ;
	public void show() {
		display	= new Display();
		shell		= new Shell(display);
		shell.setText("Animator Double Buffer");
		createContents(shell);
		shell.open();

		// Set up the timer for the animation
		Runnable runnable = new class Runnable {
			public void run() {
				animate();
				display.timerExec(TIMER_INTERVAL, this);
			}
		};

		// Launch the timer
		display.timerExec(TIMER_INTERVAL, runnable);

		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}

		// Kill the timer
		display.timerExec(-1, runnable);
		display.dispose();
	}

	/**
	* Creates the main window's contents
	* 
	* @param shell the main window
	*/
	private void createContents(Shell shell) {
		shell.setLayout(new FillLayout());

		// Create the canvas for drawing
		canvas = new Canvas(shell, DWT.NO_BACKGROUND);
		canvas.addPaintListener(new class(this) PaintListener {
			private AnimatorDoubleBuffer _self;
			public this(AnimatorDoubleBuffer _this){
				_self	= _this ;
			}
			public void paintControl(PaintEvent event) {
				// Create the image to fill the canvas
				Image image = new Image(_self.shell.getDisplay(), _self.canvas.getBounds());

				// Set up the offscreen gc
				GC gcImage = new GC(image);

				// Draw the background
				gcImage.setBackground(event.gc.getBackground());
				gcImage.fillRectangle(image.getBounds());

				// Set the color of the ball
				gcImage.setBackground(_self.shell.getDisplay().getSystemColor(DWT.COLOR_RED));

				// Draw the ball
				gcImage.fillOval(x, y, IMAGE_WIDTH, IMAGE_WIDTH);

				// Draw the offscreen buffer to the screen
				event.gc.drawImage(image, 0, 0);

				// Clean up
				image.dispose();
				gcImage.dispose();
			}
		});
	}

	/**
	* Animates the next frame
	*/
	public void animate() {
		// Determine the ball's location
		x += directionX;
		y += directionY;

		// Determine out of bounds
		Rectangle rect = canvas.getClientArea();
		if (x < 0) {
			x = 0;
			directionX = 1;
		} else if (x > rect.width - IMAGE_WIDTH) {
			x = rect.width - IMAGE_WIDTH;
			directionX = -1;
		}
		if (y < 0) {
			y = 0;
			directionY = 1;
		} else if (y > rect.height - IMAGE_WIDTH) {
			y = rect.height - IMAGE_WIDTH;
			directionY = -1;
		}
		// Force a redraw
		canvas.redraw();
	}

	/**
	* The application entry point
	* 
	* @param args the command line arguments
	*/
	public static void main(string[] args) {
		auto form=new AnimatorDoubleBuffer;
		form.show;
	}
}


void main(string[] args)
{
	AnimatorDoubleBuffer.main(args);
}





在使用dwt里的事件时,在D1里不可以在委托函数里直接引用外部变量。
hqs7636 2010-06-29
第三方包官方基本都不维护了,楼主还是麻烦做成官方样式的下载包吧,方便大家使用!

谢谢!!!
Global site tag (gtag.js) - Google Analytics