/* AwtView2.java * * Copyright (c) 2000-2001 Ted Nelson and Tuomas Lukka * Copyright (c) 2000-2001 Kimmo Wideroos * * You may use and distribute under the terms of either the GNU Lesser * General Public License, either version 2 of the license or, * at your choice, any later version. Alternatively, you may use and * distribute under the terms of the XPL. * * See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of * the licenses. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the README * file for more details. * */ /* * Written by Kimmo Wideroos */ /** View for a(ssociative) writing tool */ package org.gzigzag.module; import org.gzigzag.*; import java.util.*; import java.awt.*; public class AwtView2 extends Awt { public static boolean dbg = false; static final void p(String s) { if(dbg) System.out.println(s); } static final void pa(String s) { System.out.println(s); } AwtNoteFlobFactory noteFlobFact = new AwtNoteFlobFactory(); AwtLinkFlobFactory linkFlobFact = new AwtLinkFlobFactory(); // for several views we need this static private Hashtable linkcaches = new Hashtable(); // Used for checking whether links between artefacts // is handled already. private class Pair { Object a; Object b; public Pair(Object a, Object b) { this.a = a; this.b = b; } public int hashCode() { return a.hashCode() ^ b.hashCode(); } public boolean equals(Object o) { Pair p = (Pair)o; return (a==p.a && b==p.b) || (b==p.a && a==p.b); } } public void raster(FlobSet into, FlobFactory fact, ZZCell view, String[] dims, ZZCell accursed) { Awt.focusView = view; ZZCell awtlocals = accursed; //pa("[AwtView2] accursed cell: "+accursed); AwtMetrics M = getActiveMetrics(view); Dimension d = into.getSize(); if(!M.RealViewEquals(d)) { M.setRealView(d, true); M.cellRepr(); } noteFlobFact.setMetrics(M); linkFlobFact.setMetrics(M); noteFlobFact.setDragging(dragObj); boolean nileOn = false; ZZCell curb = view.h("d.bind", 1, true); if(curb!=null) { String mode = ZZCursorReal.get(curb).getText(); if(mode.indexOf("Nile") >= 0) nileOn = true; } AwtCursors awtcursors = new AwtCursors(accursed); noteFlobFact.setCursors(awtcursors); ZZCell input1 = awtcursors.get(AwtCursors.c_input1); ZZCell input2 = awtcursors.get(AwtCursors.c_input2); ZZCell[] artefs = AwtLayer.getArtefacts(accursed); ZZCell aCell; double[] vp; int depth; for(int i=0; i