diff options
author | Siva Velusamy <vsiva@google.com> | 2011-09-14 17:31:59 -0700 |
---|---|---|
committer | Siva Velusamy <vsiva@google.com> | 2011-09-14 17:31:59 -0700 |
commit | 38bd31650c8753fe392938e8e5904f9cead77577 (patch) | |
tree | 345eeb312c7492df7c32098174cd44d61981e272 /ddms | |
parent | 34f99057592be9ecaf5562637fb6cc5071bc4ce2 (diff) | |
download | sdk-38bd31650c8753fe392938e8e5904f9cead77577.zip sdk-38bd31650c8753fe392938e8e5904f9cead77577.tar.gz sdk-38bd31650c8753fe392938e8e5904f9cead77577.tar.bz2 |
Use default system font size.
And make sure that the default logcat table row height is high
enough for the currently used font.
Change-Id: Ibfabb05b92add42c6d0acb2b79668f93b833057f
Diffstat (limited to 'ddms')
-rw-r--r-- | ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatPanel.java | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatPanel.java b/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatPanel.java index 2461232..58913b6 100644 --- a/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatPanel.java +++ b/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogCatPanel.java @@ -59,6 +59,7 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.ScrollBar; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; @@ -84,10 +85,16 @@ public final class LogCatPanel extends SelectionDependentPanel /** Preference key to use for storing font settings. */ public static final String LOGCAT_VIEW_FONT_PREFKEY = "logcat.view.font"; + // Use a monospace font family private static final String FONT_FAMILY = DdmConstants.CURRENT_PLATFORM == DdmConstants.PLATFORM_DARWIN ? "Monaco":"Courier New"; - private static final FontData DEFAULT_LOGCAT_FONT = new FontData( - FONT_FAMILY, 12, SWT.NORMAL); + + // Use the default system font size + private static final FontData DEFAULT_LOGCAT_FONTDATA; + static { + int h = Display.getDefault().getSystemFont().getFontData()[0].getHeight(); + DEFAULT_LOGCAT_FONTDATA = new FontData(FONT_FAMILY, h, SWT.NORMAL); + } private static final String LOGCAT_VIEW_COLSIZE_PREFKEY_PREFIX = "logcat.view.colsize."; @@ -158,7 +165,7 @@ public final class LogCatPanel extends SelectionDependentPanel private void setupDefaultPreferences() { PreferenceConverter.setDefault(mPrefStore, LogCatPanel.LOGCAT_VIEW_FONT_PREFKEY, - DEFAULT_LOGCAT_FONT); + DEFAULT_LOGCAT_FONTDATA); mPrefStore.setDefault(LogCatMessageList.MAX_MESSAGES_PREFKEY, LogCatMessageList.MAX_MESSAGES_DEFAULT); } @@ -649,6 +656,15 @@ public final class LogCatPanel extends SelectionDependentPanel mViewer.setContentProvider(new LogCatMessageContentProvider()); WrappingToolTipSupport.enableFor(mViewer, ToolTip.NO_RECREATE); + // Set the row height to be sufficient enough to display the current font. + // This is not strictly necessary, except that on WinXP, the rows showed up clipped. So + // we explicitly set it to be sure. + mViewer.getTable().addListener(SWT.MeasureItem, new Listener() { + public void handleEvent(Event event) { + event.height = event.gc.getFontMetrics().getHeight(); + } + }); + initDoubleClickListener(); } |