From 3c2a860dcca3e2ebd34138c952dce289cc0d24e7 Mon Sep 17 00:00:00 2001 From: DarkWyrm Date: Thu, 24 Jun 2004 16:33:52 +0000 Subject: [PATCH] Added a little font sensitivity to MainWindow layout Removed a warning from main.cpp git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8146 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/prefs/virtualmemory/MainWindow.cpp | 17 ++++++++++++++--- src/prefs/virtualmemory/main.cpp | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/prefs/virtualmemory/MainWindow.cpp b/src/prefs/virtualmemory/MainWindow.cpp index 879475f2d4..1e6a5b8682 100644 --- a/src/prefs/virtualmemory/MainWindow.cpp +++ b/src/prefs/virtualmemory/MainWindow.cpp @@ -34,6 +34,13 @@ MainWindow::MainWindow(BRect frame, int physMemVal, int currSwapVal, int minVal, fillColor.blue = 152; fillColor.green = 102; + /** + * Set up variables to help handle font sensitivity + */ + font_height fontHeightStruct; + be_plain_font->GetHeight(&fontHeightStruct); + float fontheight=fontHeightStruct.ascent+fontHeightStruct.descent+fontHeightStruct.leading; + /** * This var sets the size of the visible box around the string views and * the slider. @@ -50,23 +57,27 @@ MainWindow::MainWindow(BRect frame, int physMemVal, int currSwapVal, int minVal, origMemSize = currSwapVal; minSwapVal = minVal; + BRect rect(10,10,210,10+fontheight+2); + /** * Set up the "Physical Memory" label. */ sprintf(labels, "Physical Memory: %d MB", physMemVal); - physMem = new BStringView(*(new BRect(10, 10, 210, 20)), "PhysicalMemory", labels, B_FOLLOW_ALL, B_WILL_DRAW); + physMem = new BStringView(rect, "PhysicalMemory", labels, B_FOLLOW_ALL, B_WILL_DRAW); /** * Set up the "Current Swap File Size" label. */ + rect.OffsetBy(0,rect.Height()); sprintf(labels, "Current Swap File Size: %d MB", currSwapVal); - currSwap = new BStringView(*(new BRect(10, 25, 210, 35)), "CurrentSwapSize", labels, B_FOLLOW_ALL, B_WILL_DRAW); + currSwap = new BStringView(rect, "CurrentSwapSize", labels, B_FOLLOW_ALL, B_WILL_DRAW); /** * Set up the "Requested Swap File Size" label. */ + rect.OffsetBy(0,rect.Height()); sprintf(labels, "Requested Swap File Size: %d MB", currSwapVal); - reqSwap = new BStringView(*(new BRect(10, 40, 210, 50)), "RequestedSwapSize", labels, B_FOLLOW_ALL, B_WILL_DRAW); + reqSwap = new BStringView(rect, "RequestedSwapSize", labels, B_FOLLOW_ALL, B_WILL_DRAW); /** * Set up the slider. diff --git a/src/prefs/virtualmemory/main.cpp b/src/prefs/virtualmemory/main.cpp index 8112e2f282..216a0ffec0 100644 --- a/src/prefs/virtualmemory/main.cpp +++ b/src/prefs/virtualmemory/main.cpp @@ -37,7 +37,7 @@ VM_pref::VM_pref() FILE *settingsFile = fopen("/boot/home/config/settings/kernel/drivers/virtual_memory", "r"); - FILE *ptr; +// FILE *ptr; char dummy[80]; BVolume bootVol; BVolumeRoster *vol_rost = new BVolumeRoster();