private void setHeight(FormData fd, Control control, int rowcount) {
GC gc = new GC(control);
try {
gc.setFont(control.getFont());
FontMetrics fm = gc.getFontMetrics();
fd.height = rowcount * fm.getHeight();
} finally {
gc.dispose();
}
}
java类org.eclipse.swt.graphics.GC的实例源码
VertexDefaultSection.java 文件源码
项目:gw4e.project
阅读 26
收藏 0
点赞 0
评论 0
GraphDefaultSection.java 文件源码
项目:gw4e.project
阅读 31
收藏 0
点赞 0
评论 0
private void setHeight(FormData fd, Control control, int rowcount) {
GC gc = new GC(control);
try {
gc.setFont(control.getFont());
FontMetrics fm = gc.getFontMetrics();
fd.height = rowcount * fm.getHeight();
} finally {
gc.dispose();
}
}
CFGraph.java 文件源码
项目:n4js
阅读 26
收藏 0
点赞 0
评论 0
@Override
public void layout(GC gc) {
if (layoutDone)
return;
int lastLine = 0;
int posInLine = 10;
int lineCounter = 0;
Set<Entry<CFNode, ControlFlowElement>> entries = nodeMap.entrySet();
Iterator<Entry<CFNode, ControlFlowElement>> entriesIt = entries.iterator();
while (entriesIt.hasNext()) {
Entry<CFNode, ControlFlowElement> entry = entriesIt.next();
CFNode node = entry.getKey();
ControlFlowElement cfe = entry.getValue();
int line = getLineEnd(cfe);
boolean lineChange = lastLine != line;
lastLine = line;
if (lineChange) {
posInLine = 10;
lineCounter++;
}
node.x = posInLine;
node.y = lineCounter * 100;
node.trim(gc);
posInLine += node.width + 50;
}
layoutDone = true;
}
StackNode.java 文件源码
项目:n4js
阅读 25
收藏 0
点赞 0
评论 0
/**
* Paint the ... guess what!
*/
@Override
public void paint(GC gc) {
gc.setBackground(getColor(parentScale, siblingScale));
gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_BLACK));
gc.fillRectangle(Math.round(x), Math.round(y), Math.round(width), Math.round(height));
// StackUtils.drawString(gc, title, x, y, width, height, 0);
gc.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
}
CFEdge.java 文件源码
项目:n4js
阅读 29
收藏 0
点赞 0
评论 0
/** Paint edge to given GC. */
@Override
public void paint(GC gc) {
Node startNode = startNodes.get(0);
Node endNode = endNodes.get(0);
paintEdge(gc, startNode, endNode);
}
CFEdge.java 文件源码
项目:n4js
阅读 26
收藏 0
点赞 0
评论 0
/** Sets the color of the {@link GC} depending on the edge type. */
void setColor(GC gc) {
Display displ = Display.getCurrent();
Color color = GraphUtils.getColor(50, 50, 50);
if (isDead || cfTypes.contains(ControlFlowType.DeadCode)) {
color = displ.getSystemColor(SWT.COLOR_GRAY);
} else {
for (ControlFlowType cfType : cfTypes) {
switch (cfType) {
case LoopEnter:
case LoopReenter:
case LoopInfinite:
case Break:
case Continue:
case Return:
color = displ.getSystemColor(SWT.COLOR_BLUE);
break;
case Throw:
color = displ.getSystemColor(SWT.COLOR_RED);
break;
default:
break;
}
}
}
gc.setForeground(color);
}
CFEdge.java 文件源码
项目:n4js
阅读 30
收藏 0
点赞 0
评论 0
/**
* Paints the reverse arc. Since reverse arcs always point downwards, the start and end points are simply located at
* the lower/upper center of the source/target nodes.
*/
private Point paintSelfArc(GC gc, Node tgtN, Point tgt) {
Point srcB = new Point(tgt.x + tgtN.width / 2 + 2, tgt.y);
Point tgtB = new Point(tgt.x, tgt.y - tgtN.height / 2 - 2);
Point tgtL = new Point(tgtB.x, tgtB.y - 20);
drawLabel(gc, tgtL);
GraphUtils.arcSelf(gc, srcB, tgtB);
return tgtB;
}
VivaldiPanel.java 文件源码
项目:BiglyBT
阅读 22
收藏 0
点赞 0
评论 0
private void drawSelf(GC gc, float x, float y, float h, float errorEstimate){
int x0 = scale.getX(x, y);
int y0 = scale.getY(x, y);
//gc.drawOval(x0-50, y0-50, 100, 100);
gc.drawLine(x0-15, y0, x0+15, y0); // Horizontal
gc.drawLine(x0, y0-15, x0, y0+15); // Vertical
}
ColumnTagColor.java 文件源码
项目:BiglyBT
阅读 24
收藏 0
点赞 0
评论 0
@Override
public void cellPaint(GC gc, TableCellSWT cell) {
Rectangle bounds = cell.getBounds();
Color foregroundSWT = cell.getForegroundSWT();
if (foregroundSWT != null) {
gc.setBackground(foregroundSWT);
bounds.x+=1;
bounds.y+=1;
bounds.width-=1;
bounds.height-=1;
gc.fillRectangle(bounds);
}
}
Node.java 文件源码
项目:n4js
阅读 25
收藏 0
点赞 0
评论 0
/**
* Change size of receiving Node to its preferred size.
*/
public void trim(GC gc) {
if (title != null) {
final org.eclipse.swt.graphics.Point size = gc.stringExtent(title);
this.width = size.x + BORDER * 2;
this.height = size.y + BORDER * 2;
} else {
this.width = DEFAULT_WIDTH;
this.height = DEFAULT_HEIGHT;
}
}