mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 17:35:35 +02:00
[205526] Some font choices/sizes do not render well in the traditional memory rendering
This commit is contained in:
parent
35b3629b8f
commit
0e65733fdb
4 changed files with 19 additions and 10 deletions
|
@ -26,6 +26,7 @@ import org.eclipse.swt.events.MouseListener;
|
|||
import org.eclipse.swt.events.MouseMoveListener;
|
||||
import org.eclipse.swt.events.PaintEvent;
|
||||
import org.eclipse.swt.events.PaintListener;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
import org.eclipse.swt.graphics.FontMetrics;
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
|
@ -639,6 +640,14 @@ public abstract class AbstractPane extends Canvas
|
|||
|
||||
abstract protected int getCellCharacterCount();
|
||||
|
||||
public void setFont(Font font)
|
||||
{
|
||||
super.setFont(font);
|
||||
fCharacterWidth = -1;
|
||||
fCellHeight = -1;
|
||||
fTextHeight = -1;
|
||||
}
|
||||
|
||||
private int fCellHeight = -1; // called often, cache
|
||||
|
||||
protected int getCellHeight()
|
||||
|
@ -659,7 +668,7 @@ public abstract class AbstractPane extends Canvas
|
|||
if(fCharacterWidth == -1)
|
||||
{
|
||||
GC gc = new GC(this);
|
||||
gc.setFont(fRendering.getFont());
|
||||
gc.setFont(fRendering.getFont());
|
||||
fCharacterWidth = gc.getAdvanceWidth('F');
|
||||
gc.dispose();
|
||||
}
|
||||
|
|
|
@ -80,14 +80,14 @@ public class AddressPane extends AbstractPane
|
|||
}
|
||||
|
||||
protected int getCellWidth()
|
||||
{
|
||||
GC gc = new GC(this);
|
||||
gc.setFont(fRendering.getFont());
|
||||
int width = gc.getAdvanceWidth('0');
|
||||
{
|
||||
GC gc = new GC(this);
|
||||
StringBuffer buf = new StringBuffer();
|
||||
for(int i = 0; i < getCellCharacterCount(); i++)
|
||||
buf.append("0");
|
||||
int width = gc.textExtent(buf.toString()).x;
|
||||
gc.dispose();
|
||||
|
||||
return getCellCharacterCount() * width
|
||||
+ (fRendering.getCellPadding() * 2);
|
||||
return width;
|
||||
}
|
||||
|
||||
private int getColumnCount()
|
||||
|
|
|
@ -241,7 +241,7 @@ public class DataPane extends AbstractPane
|
|||
|
||||
int cellHeight = getCellHeight();
|
||||
int cellWidth = getCellWidth();
|
||||
|
||||
|
||||
int columns = fRendering.getColumnCount();
|
||||
|
||||
try
|
||||
|
|
|
@ -462,7 +462,7 @@ public class Rendering extends Composite implements IDebugEventSetListener
|
|||
controls[i].setFont(font);
|
||||
|
||||
packColumns();
|
||||
redrawPanes();
|
||||
layout(true);
|
||||
}
|
||||
|
||||
public void handleDebugEvents(DebugEvent[] events)
|
||||
|
|
Loading…
Add table
Reference in a new issue