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:
parent
e8cd700741
commit
a559946f03
@ -1,6 +1,7 @@
|
||||
SubDir HAIKU_TOP src apps processcontroller ;
|
||||
|
||||
UsePrivateSystemHeaders ;
|
||||
UsePrivateHeaders shared ;
|
||||
|
||||
Application ProcessController :
|
||||
AutoIcon.cpp
|
||||
@ -20,7 +21,7 @@ Application ProcessController :
|
||||
ThreadBarMenu.cpp
|
||||
ThreadBarMenuItem.cpp
|
||||
Utilities.cpp
|
||||
: be $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS)
|
||||
: be libshared.a $(TARGET_LIBSUPC++) $(HAIKU_LOCALE_LIBS)
|
||||
: ProcessController.rdef
|
||||
;
|
||||
|
||||
|
@ -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
|
||||
*/
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include <Catalog.h>
|
||||
#include <StringForSize.h>
|
||||
|
||||
#undef B_TRANSLATE_CONTEXT
|
||||
#define B_TRANSLATE_CONTEXT "ProcessController"
|
||||
@ -152,13 +153,11 @@ KernelMemoryBarMenuItem::DrawBar(bool force)
|
||||
menu->SetHighColor(kBlack);
|
||||
|
||||
char infos[128];
|
||||
snprintf(infos, sizeof(infos),
|
||||
B_TRANSLATE("%.1f MiB"), fCachedMemory / 1024.f);
|
||||
string_for_size(fCachedMemory * 1024.0, infos, sizeof(infos));
|
||||
BPoint loc(cadre.left, cadre.bottom + 1);
|
||||
loc.x -= kMargin + gMemoryTextWidth / 2 + menu->StringWidth(infos);
|
||||
menu->DrawString(infos, loc);
|
||||
snprintf(infos, sizeof(infos),
|
||||
B_TRANSLATE("%.1f MiB"), fCommittedMemory / 1024.f);
|
||||
string_for_size(fCommittedMemory * 1024.0, infos, sizeof(infos));
|
||||
loc.x = cadre.left - kMargin - menu->StringWidth(infos);
|
||||
menu->DrawString(infos, loc);
|
||||
fLastSum = sum;
|
||||
|
@ -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 <Roster.h>
|
||||
#include <StringForSize.h>
|
||||
#include <Window.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -57,7 +58,9 @@ MemoryBarMenu::MemoryBarMenu(const char* name, info_pack* infos, system_info& sy
|
||||
fTeamList[k++] = -1;
|
||||
}
|
||||
|
||||
gMemoryTextWidth = 2 * StringWidth(B_TRANSLATE("99999 KiB")) + 20;
|
||||
char buffer[64];
|
||||
string_for_size(99999999.9, buffer, sizeof(buffer));
|
||||
gMemoryTextWidth = 2 * StringWidth(buffer) + 32;
|
||||
|
||||
fRecycleCount = EXTRA;
|
||||
fRecycleList = (MRecycleItem*)malloc(sizeof(MRecycleItem) * fRecycleCount);
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user