Example #1
0
  private void initItem(Graphics g) {
    if (false) {
      SimpleDisplayObject child = new TestDisplayObject();
      child.setRect(100, 100);
      mStage.getRoot().addChild(child);
    }
    if (false) {
      EmptyLineViewBufferSpecImpl e = new EmptyLineViewBufferSpecImpl(100);
      e.append(new KyoroString("--1--\n"));
      e.append(new KyoroString("--2--\n"));
      e.append(new KyoroString("--3--\n"));
      e.append(new KyoroString("--4--\n"));
      EditableLineView v = new EditableLineView(e, 22, 256);
      v.setRect(200, 200);
      mStage.getRoot().addChild(v);
    }
    if (true) {
      EmptyLineViewBufferSpecImpl e = new EmptyLineViewBufferSpecImpl(100);
      e.append(new KyoroString("--1--\n"));
      e.append(new KyoroString("--2--\n"));
      e.append(new KyoroString("--3--\n"));
      e.append(new KyoroString("--4--\n"));

      g.setFont(g.getFont().deriveFont(11));
      TextViewer viewer =
          new TextViewer(e, 11, 400, 10, new SimpleFontForJ2SE(null, g.getFontMetrics()), "utf8");
      readStartupMessage(viewer);
      viewer.setRect(800, 800);
      mStage.getRoot().addChild(viewer);
      //			viewer.getLineView().setMode(EditableLineView.MODE_SELECT);
      viewer.getLineView().setMode(EditableLineView.MODE_EDIT);
    }
  }
Example #2
0
 private void cursorIsInShowingView(EditableLineView v) {
   int s = v.getShowingTextStartPosition();
   int e = v.getShowingTextEndPosition();
   int c = v.getLeft().getCursorCol();
   if (!(s <= c && c <= e)) {
     v.recenter();
   }
 }
Example #3
0
  public void updateCommitTextFromIME(
      EditableLineView mTextView, EditableLineViewBuffer mTextBuffer) {
    // following code is yaxutuke sigoto
    if (!mTextView.isFocus()) {
      return;
    }
    setMode(mTextView.getMode());
    if (mTextView.getMyInputConnection() == null) {
      return;
    }
    mTextView.getMyInputConnection().setIMEController(KeyEventManager.this);
    MyInputConnection c = mTextView.getMyInputConnection();
    if (c == null) {
      return;
    }

    mTextBuffer.IsCrlfMode(mTextView.isCrlfMode());

    boolean first = true;
    while (true) {
      CommitText text = c.popFirst();
      if (text != null) {
        mTextView.getStage(mTextView).resetTimer();
        if (first == true) {
          cursorIsInShowingView(mTextView);
          first = false;
        }
        // android.util.Log.v("kiyo","key= #");
        mTextBuffer.setCursor(
            mTextView.getLeft().getCursorRow(), mTextView.getLeft().getCursorCol());
        a(text, mTextView, mTextBuffer);
        mTextView.getLeft().setCursorRow(mTextBuffer.getRow());
        mTextView.getLeft().setCursorCol(mTextBuffer.getCol());
      } else {
        break;
      }
    }
  }