use of org.antlr.works.ate.gutter.ATEGutterColumnManager in project antlrworks by antlr.
the class ATEGutter method updateInfo.
public void updateInfo(Rectangle clip) {
/** Make sure we are only updating objects in the current visible range
*
*/
int startIndex = textEditor.textPane.viewToModel(new Point(clip.x, clip.y));
int endIndex = textEditor.textPane.viewToModel(new Point(clip.x + clip.width, clip.y + clip.height));
items.clear();
if (textEditor.gutterColumnsManager != null) {
ATEGutterColumnManager manager = textEditor.gutterColumnsManager;
int offsetX = offsetForLineNumber;
for (String column : manager.getColumns()) {
for (ATEGutterItem item : manager.getGutterItems(column)) {
int index = item.getItemIndex();
if (index >= startIndex && index <= endIndex) {
int y = getLineYPixelPosition(item.getItemIndex());
int width = item.getItemWidth();
int height = item.getItemHeight();
Rectangle r = new Rectangle(offsetX, y - height / 2, width, height);
this.items.add(new ItemInfo(item, r));
}
}
offsetX += manager.getColumnWidth(column);
}
}
foldingInfos.clear();
if (textEditor.foldingManager != null) {
List<ATEFoldingEntity> entities = textEditor.foldingManager.getFoldingEntities();
for (ATEFoldingEntity entity : entities) {
int entityStartIndex = entity.foldingEntityGetStartIndex();
int entityEndIndex = entity.foldingEntityGetEndIndex();
if (!(entityStartIndex > endIndex || entityEndIndex < startIndex)) {
int top_y = getLineYPixelPosition(entity.foldingEntityGetStartIndex());
int bottom_y = getLineYPixelPosition(entity.foldingEntityGetEndIndex());
Point top = new Point(getWidth() - getOffsetFromText(), top_y);
Point bottom = new Point(getWidth() - getOffsetFromText(), bottom_y);
foldingInfos.add(new FoldingInfo(entity, top, bottom));
}
}
}
}
use of org.antlr.works.ate.gutter.ATEGutterColumnManager in project antlrworks by antlr.
the class ATEGutter method handleClickInColumn.
private boolean handleClickInColumn(Point point) {
if (textEditor.gutterColumnsManager == null)
return false;
ATEGutterColumnManager manager = textEditor.gutterColumnsManager;
if (point.x < offsetForLineNumber)
return false;
String column = null;
int width = offsetForLineNumber;
for (String c : manager.getColumns()) {
width += manager.getColumnWidth(c);
if (point.x < width) {
column = c;
break;
}
}
if (column == null)
return false;
// use only y-axis
point.x = 0;
int index = textEditor.textPane.viewToModel(point);
return manager.handleClickInColumn(column, index);
}
Aggregations