Use string_for_size() to format and localize sizes in a consistent way.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40780 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Houdoin
2011-03-02 16:08:24 +00:00
parent e8cd700741
commit a559946f03
4 changed files with 48 additions and 44 deletions
@@ -1,20 +1,20 @@
/*
ProcessController © 2000, Georges-Edouard Berenger, All Rights Reserved.
Copyright (C) 2004 beunited.org
Copyright (C) 2004 beunited.org
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
@@ -26,6 +26,7 @@
#include <Bitmap.h>
#include <Catalog.h>
#include <StringForSize.h>
#include <stdio.h>
@@ -214,13 +215,13 @@ MemoryBarMenuItem::DrawBar(bool force)
menu->SetHighColor(kBlack);
char infos[128];
snprintf(infos, sizeof(infos), B_TRANSLATE("%d KiB"), fWriteMemory);
string_for_size(fWriteMemory * 1024.0, infos, sizeof(infos));
BPoint loc(rect.left - kMargin - gMemoryTextWidth / 2 - menu->StringWidth(infos),
rect.bottom + 1);
menu->DrawString(infos, loc);
snprintf(infos, sizeof(infos), B_TRANSLATE("%d KiB"), fAllMemory);
string_for_size(fAllMemory * 1024.0, infos, sizeof(infos));
loc.x = rect.left - kMargin - menu->StringWidth(infos);
menu->DrawString(infos, loc);
}