Skip to content

Commit 334323c

Browse files
committed
remove unused variables to prevent warnings
1 parent f2e0ffb commit 334323c

1 file changed

Lines changed: 17 additions & 23 deletions

File tree

app/src/processing/app/syntax/im/InputMethodSupport.java

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* @see <a href="https://processing.org/bugs/bugzilla/1531.html">Bug 1531 : Can't input full-width space when Japanese IME is on.</a>
3535
* @see http://docs.oracle.com/javase/8/docs/technotes/guides/imf/index.html
3636
* @see http://docs.oracle.com/javase/tutorial/2d/text/index.html
37-
*
37+
*
3838
* @author Takashi Maekawa (takachin@generative.info)
3939
* @author Satoshi Okita
4040
*/
@@ -44,11 +44,9 @@ public class InputMethodSupport implements InputMethodRequests,
4444
private static final Attribute[] CUSTOM_IM_ATTRIBUTES = {
4545
TextAttribute.INPUT_METHOD_HIGHLIGHT,
4646
};
47-
47+
4848
private int committed_count = 0;
49-
private TextHitInfo caret;
5049
private JEditTextArea textArea;
51-
private AttributedCharacterIterator composedText;
5250
private AttributedString composedTextString;
5351

5452
public InputMethodSupport(JEditTextArea textArea) {
@@ -70,10 +68,10 @@ public Rectangle getTextLocation(TextHitInfo offset) {
7068
// '+1' mean textArea.lineToY(line) + textArea.getPainter().getFontMetrics().getHeight().
7169
// TextLayout#draw method need at least one height of font.
7270
Rectangle rectangle = new Rectangle(textArea.offsetToX(line, offsetX), textArea.lineToY(line + 1), 0, 0);
73-
71+
7472
Point location = textArea.getPainter().getLocationOnScreen();
7573
rectangle.translate(location.x, location.y);
76-
74+
7775
return rectangle;
7876
}
7977

@@ -87,7 +85,7 @@ public TextHitInfo getLocationOffset(int x, int y) {
8785
public int getInsertPositionOffset() {
8886
return textArea.getCaretPosition() * -1;
8987
}
90-
88+
9189
@Override
9290
public AttributedCharacterIterator getCommittedText(int beginIndex,
9391
int endIndex, AttributedCharacterIterator.Attribute[] attributes) {
@@ -118,12 +116,11 @@ public AttributedCharacterIterator getSelectedText(
118116
/////////////////////////////////////////////////////////////////////////////
119117
/**
120118
* Handles events from InputMethod.
121-
*
119+
*
122120
* @param event event from Input Method.
123121
*/
124122
@Override
125-
public void inputMethodTextChanged(InputMethodEvent event) {
126-
composedText = null;
123+
public void inputMethodTextChanged(InputMethodEvent event) {
127124
if (Base.DEBUG) {
128125
StringBuilder sb = new StringBuilder();
129126
sb.append("#Called inputMethodTextChanged");
@@ -132,16 +129,16 @@ public void inputMethodTextChanged(InputMethodEvent event) {
132129
sb.append("\t parmString: " + event.paramString());
133130
Messages.log(sb.toString());
134131
}
135-
132+
136133
AttributedCharacterIterator text = event.getText(); // text = composedText + commitedText
137134
committed_count = event.getCommittedCharacterCount();
138-
139-
135+
136+
140137
// The caret for Input Method.
141138
// if you type a character by a input method, original caret become off.
142139
// a JEditTextArea is not implemented by the AttributedStirng and TextLayout.
143140
// so JEditTextArea Caret On-off logic.
144-
//
141+
//
145142
// japanese : if the enter key pressed, event.getText is null.
146143
// japanese : if first space key pressed, event.getText is null.
147144
// chinese(pinin) : if a space key pressed, event.getText is null.
@@ -168,7 +165,7 @@ public void inputMethodTextChanged(InputMethodEvent event) {
168165
this.insertCharacter(c);
169166
c = text.next();
170167
}
171-
168+
172169
CompositionTextPainter compositionPainter = textArea.getPainter().getCompositionTextpainter();
173170
if (Base.DEBUG) {
174171
Messages.log(" textArea.getCaretPosition() + committed_count: " + (textArea.getCaretPosition() + committed_count));
@@ -181,28 +178,26 @@ public void inputMethodTextChanged(InputMethodEvent event) {
181178
compositionPainter.setComposedTextLayout(null, 0);
182179
compositionPainter.setCaret(null);
183180
}
184-
caret = event.getCaret();
185181
event.consume();
186-
textArea.repaint();
182+
textArea.repaint();
187183
}
188-
184+
189185
private TextLayout getTextLayout(AttributedCharacterIterator text, int committedCount) {
190186
boolean antialias = Preferences.getBoolean("editor.smooth");
191187
TextAreaPainter painter = textArea.getPainter();
192-
188+
193189
// create attributed string with font info.
194190
//if (text.getEndIndex() - (text.getBeginIndex() + committedCharacterCount) > 0) {
195191
if (text.getEndIndex() - (text.getBeginIndex() + committedCount) > 0) {
196192
composedTextString = new AttributedString(text, committedCount, text.getEndIndex(), CUSTOM_IM_ATTRIBUTES);
197193
Font font = painter.getFontMetrics().getFont();
198194
composedTextString.addAttribute(TextAttribute.FONT, font);
199195
composedTextString.addAttribute(TextAttribute.BACKGROUND, Color.WHITE);
200-
composedText = composedTextString.getIterator();
201196
} else {
202197
composedTextString = new AttributedString("");
203198
return null;
204199
}
205-
200+
206201
// set hint of antialiasing to render target.
207202
Graphics2D g2d = (Graphics2D)painter.getGraphics();
208203
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
@@ -219,10 +214,9 @@ private TextLayout getTextLayout(AttributedCharacterIterator text, int committed
219214

220215
@Override
221216
public void caretPositionChanged(InputMethodEvent event) {
222-
caret = event.getCaret();
223217
event.consume();
224218
}
225-
219+
226220
private void insertCharacter(char c) {
227221
if (Base.DEBUG) {
228222
Messages.log("debug: insertCharacter(char c) textArea.getCaretPosition()=" + textArea.getCaretPosition());

0 commit comments

Comments
 (0)