fenfire-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fenfire-dev] Mudyc's merge request


From: Tuomas Lukka
Subject: [Fenfire-dev] Mudyc's merge request
Date: Thu, 23 Oct 2003 20:14:25 +0300
User-agent: Mutt/1.5.4i

The following changes I have some issues with:
 
> --- orig/org/fenfire/util/AlphContent.java
> +++ mod/org/fenfire/util/AlphContent.java
> @@ -47,6 +47,9 @@
>         this.ff = ff;
>      }
> 
> +    public Enfilade1D getEnfilade1D(Object node) {
> +       return (Enfilade1D) ff.getContent(node);
> +    }
>      public String getText(Object node) {
>         Enfilade1D enf = (Enfilade1D)ff.getContent(node);
>         return enf.makeString();
> @@ -58,6 +61,17 @@
>                         .makeTextSpan(s)));
>      }
> 
> +    public void setText(Object node, Enfilade1D enf) {
> +       ff.setContent(node, enf);
> +    }
> +
> +    public void insertText(Object node, int ind, Enfilade1D insertEnf) {
> +       Enfilade1D old = (Enfilade1D)ff.getContent(node);
> +       Enfilade1D enf = old.sub(0, ind);
> +       enf = enf.plus(insertEnf);
> +       enf = enf.plus(old.sub(ind));
> +       ff.setContent(node, enf);
> +    }
>      public void insertText(Object node, int ind, String s, boolean user) {
>         Enfilade1D old = (Enfilade1D)ff.getContent(node);
> 
> @@ -70,12 +84,16 @@
>         ff.setContent(node, enf);
>      }
> 
> -    public void deleteText(Object node, int begin, int end) {
> +    public Enfilade1D deleteText(Object node, int begin, int end) {
> +       if (dbg) p("begin: "+begin+", end: "+end);
>         Enfilade1D old = (Enfilade1D)ff.getContent(node);
>         Enfilade1D enf = old.sub(0, begin);
>         enf = enf.plus(old.sub(end));
> 
>         ff.setContent(node, enf);
> +
> +       // return the "deleted" enfilade.
> +       return old.sub(begin,end);
>      }
> 
>  }

AlphContent is an old remnant that is meant for one thing only: 
manipulating FF content as *text*. I really don't think it should
be using enfilades.

Especially the getEnfilade1D delegation seems unsound, design-wise.

I'd actually prefer to get rid of this class, implementing these routines
for enfilades somewhere else...

Possibly adding the insert &c stuff into ff.structure.Ff would work?

> --- orig/org/fenfire/view/buoy/AbstractMainNode2D.java
> +++ mod/org/fenfire/view/buoy/AbstractMainNode2D.java
> @@ -252,6 +254,25 @@
>         }
>      }
> 
> +    public int getNodeCS(VobScene oldVobScene, Object node) {
> +       View2D view = getView2D();
> +       while (view.getChildView2D() != null)
> +           view = view.getChildView2D();
> +
> +       // XXX should this be in View2D?
> +       if (view instanceof CanvasView2D) {
> +
> +           int cs = ((CanvasView2D)view)
> +               .getNodeCS(oldVobScene, node,
> +                        plane, box2screen, box2screen,
> +                        box2paper, null);
> +
> +           if(dbg) p("CS is: "+cs);
> +           return cs;
> +       }
> +       return -1;
> +    }
> +
>      public int getNodeCS(VobScene oldVobScene, float x, float y) {
>         View2D view = getView2D();
>         while (view.getChildView2D() != null)
> 
> 
> 


This is another: I don't like abstract mainnode2D knowing about node coordinate 
systems,
they are the responsibility of the view shown in the main node.

How about an architecture where the AbstractMainNode2D knows
1) the rendering View2D, as currently
2) the "logical" View2D, which would in this case be CanvasView2D

and others could query it and then cast it to CanvasView2D.

        Tuomas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]