/[fenfire]/fenfire/org/fenfire/view/FenPDFContext.java
ViewVC logotype

Diff of /fenfire/org/fenfire/view/FenPDFContext.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by mudyc, Mon May 5 01:38:49 2003 UTC revision 1.2 by mudyc, Mon May 5 02:37:39 2003 UTC
# Line 55  public class FenPDFContext { Line 55  public class FenPDFContext {
55    
56              if (stroke.equals(" ")) {              if (stroke.equals(" ")) {
57                  p("space pressed!");                  p("space pressed!");
58    
59                    // check if two spaces one after other XXX
60                    // and make a new sentence
61    
62                    Object node = RDFUtil.N(fen, RST.Node);
63                    alphContent.setText(node, stroke, true);
64                    rst.insertNode(sentence, node,  
65                                   getNodeNumInSentence(getLastNode(sentence)) + 1);
66                    rst.generateBasicSpatialCoords(
67                        rst.getRSTCanvas(rst.getParagraph(rstNode)),
68                        nodef);
69    
70                  return;                  return;
71              }              }
72              if (stroke.equals("Return")) {              else if (stroke.equals("Return")) {
73                  p("enter makes a new sentence.");                  p("enter makes a new sentence.");
74                                    p("...if implemented ;)");
75    
76                    int num = getSentenceNum(sentence);
77                    Object para = rst.getParagraph(sentence);
78                    rstNode = sentence = rst.newSentence(para, num+1);
79    
80                    Object node = RDFUtil.N(fen, RST.Node);
81                    alphContent.setText(node, " ", true);
82                    rst.insertNode(sentence, node, 0);
83                    rst.generateBasicSpatialCoords(
84                        rst.getRSTCanvas(rst.getParagraph(rstNode)),
85                        nodef);
86                    
87                  return;                  return;
88              }              }
89                            
90              p("length"+stroke.length());              else if (stroke.length() == 1) {
             if (stroke.length() == 1) {  
91                  Object node = RDFUtil.N(fen, RST.Node);                  Object node = RDFUtil.N(fen, RST.Node);
92                  alphContent.setText(node, stroke, true);                  alphContent.setText(node, stroke, true);
93                  rst.insertNode(sentence, node,                    rst.insertNode(sentence, node,  
# Line 120  public class FenPDFContext { Line 142  public class FenPDFContext {
142              throw new Error("node not found in sentence");              throw new Error("node not found in sentence");
143          return i;          return i;
144      }      }
145        
146        private int getSentenceNum(Object sentence) {
147            if (! RDFUtil.isNodeType(fen, sentence, RST.Sentence))
148                throw new Error("sentence is not sentence! "+sentence);
149            
150            Object n = sentence;
151            Object prev = fen.graph.find1_X11(RST.nextSentence, n);
152            while (prev != null) {
153                n = prev;
154                prev = fen.graph.find1_X11(RST.nextSentence, n);
155            }
156            int i=0;
157            for (i=0; n!=sentence; i++) {
158                n = fen.graph.find1_11X(n, RST.nextSentence);
159            }
160            return i;
161        }
162    
163  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26