created mirror
This commit is contained in:
commit
6764738d92
600 files changed
+87187
No files matched your search
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
ZZDefaultText.java
|
||||
*
|
||||
* Copyright (c) 2000, Ted Nelson and Tuomas Lukka
|
||||
*
|
||||
* 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 Tuomas Lukka
|
||||
*/
|
||||
package org.gzigzag;
|
||||
import java.awt.*;
|
||||
|
||||
/** A simple implementation of ZZText.
|
||||
*/
|
||||
|
||||
public class ZZDefaultText extends ZZText {
|
||||
String rcsid = "$Id: ZZDefaultText.java,v 1.2 2000/10/19 17:04:26 tjl Exp $";
|
||||
|
||||
public String getText(ZZCell c) {
|
||||
return c.getText();
|
||||
}
|
||||
|
||||
public void setText(ZZCell c, String s) {
|
||||
c.disconnect("d.reftext", 1);
|
||||
// XXX Delete all cells there too?
|
||||
c.setText(s);
|
||||
}
|
||||
|
||||
public boolean isRef(ZZCell c) {
|
||||
return c.s("d.reftext") != null;
|
||||
}
|
||||
|
||||
public void delete(ZZCell c, int start) {
|
||||
// XXX faster
|
||||
delete(c, start, getText(c).length());
|
||||
}
|
||||
|
||||
public void delete(ZZCell c, int start, int end) {
|
||||
if(isRef(c)) {
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
public void insertNewRef(ZZCell c, String txt, int offs) {
|
||||
ensureRef(c);
|
||||
}
|
||||
|
||||
public void insertRef(ZZCell c, Span sp, int offs) {
|
||||
ensureRef(c);
|
||||
}
|
||||
|
||||
public Span[] getSpans(ZZCell c) {
|
||||
LoopDetector ld = new LoopDetector();
|
||||
ZZCell v = c.s("d.reftext");
|
||||
return null;
|
||||
}
|
||||
public Span[] getSpans(ZZCell c, int start) {
|
||||
LoopDetector ld = new LoopDetector();
|
||||
ZZCell v = c.s("d.reftext");
|
||||
return null;
|
||||
}
|
||||
public Span[] getSpans(ZZCell c, int start, int end) {
|
||||
LoopDetector ld = new LoopDetector();
|
||||
ZZCell v = c.s("d.reftext");
|
||||
return null;
|
||||
}
|
||||
public void setSpans(ZZCell c, Span[] spans) {
|
||||
}
|
||||
|
||||
|
||||
Span makeSpan(ZZCell c, String s) {
|
||||
StringScroll sc = c.getSpace().getStringScroll();
|
||||
long offs = sc.append(s);
|
||||
return Span.create(Address.scrollOffs(sc, offs),
|
||||
Address.scrollOffs(sc, offs+s.length()-1));
|
||||
}
|
||||
|
||||
void ensureRef(ZZCell c) {
|
||||
if(c.s("d.reftext") == null) {
|
||||
Span sp = makeSpan(c, getText(c));
|
||||
ZZCell n = c.N("d.reftext", 1);
|
||||
n.setSpan(sp);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user