From 9b695ae61d6e38bafd11660c2d9c44e6d558b081 Mon Sep 17 00:00:00 2001 From: Mikael Konradsson Date: Sat, 14 Sep 2019 07:54:32 +0000 Subject: [PATCH] ProcessController: Fixed bars so they are aligned in center and scale with the selected fonts Change-Id: I016c600d62ea28d4197f94f29ec0c372b5a87169 Reviewed-on: https://review.haiku-os.org/c/haiku/+/1848 Reviewed-by: Adrien Destugues --- .../KernelMemoryBarMenuItem.cpp | 6 ++-- .../processcontroller/MemoryBarMenuItem.cpp | 4 +-- .../processcontroller/NoiseBarMenuItem.cpp | 28 ++++++++--------- .../processcontroller/ProcessController.h | 1 + .../processcontroller/TeamBarMenuItem.cpp | 4 +-- .../processcontroller/ThreadBarMenuItem.cpp | 30 +++++++++---------- 6 files changed, 35 insertions(+), 38 deletions(-) diff --git a/src/apps/processcontroller/KernelMemoryBarMenuItem.cpp b/src/apps/processcontroller/KernelMemoryBarMenuItem.cpp index 30b5fe0a1a..a46f00a895 100644 --- a/src/apps/processcontroller/KernelMemoryBarMenuItem.cpp +++ b/src/apps/processcontroller/KernelMemoryBarMenuItem.cpp @@ -73,8 +73,8 @@ KernelMemoryBarMenuItem::DrawBar(bool force) rgb_color highColor = menu->HighColor(); // draw the bar itself - BRect cadre (frame.right - kMargin - kBarWidth, frame.top + 5, - frame.right - kMargin, frame.top + 13); + BRect cadre (frame.right - kMargin - kBarWidth, frame.top + kBarPadding, + frame.right - kMargin, frame.bottom - kBarPadding); if (fLastSum < 0) force = true; @@ -104,7 +104,6 @@ KernelMemoryBarMenuItem::DrawBar(bool force) menu->SetHighColor(gKernelColorSelected); else menu->SetHighColor(gKernelColor); -// menu->SetHighColor(gKernelColor); menu->FillRect (r); } r.left = grenze1; @@ -120,7 +119,6 @@ KernelMemoryBarMenuItem::DrawBar(bool force) menu->SetHighColor(tint_color (kLavender, B_HIGHLIGHT_BACKGROUND_TINT)); else menu->SetHighColor(kLavender); -// menu->SetHighColor(gUserColor); menu->FillRect (r); } r.left = grenze2; diff --git a/src/apps/processcontroller/MemoryBarMenuItem.cpp b/src/apps/processcontroller/MemoryBarMenuItem.cpp index d8d087f913..ea0ebd237c 100644 --- a/src/apps/processcontroller/MemoryBarMenuItem.cpp +++ b/src/apps/processcontroller/MemoryBarMenuItem.cpp @@ -118,8 +118,8 @@ MemoryBarMenuItem::DrawBar(bool force) // draw the bar itself - BRect rect(frame.right - kMargin - kBarWidth, frame.top + 5, - frame.right - kMargin, frame.top + 13); + BRect rect(frame.right - kMargin - kBarWidth, frame.top + kBarPadding, + frame.right - kMargin, frame.bottom - kBarPadding); if (fWriteMemory < 0) return; diff --git a/src/apps/processcontroller/NoiseBarMenuItem.cpp b/src/apps/processcontroller/NoiseBarMenuItem.cpp index 9446a06a98..d2070bec78 100644 --- a/src/apps/processcontroller/NoiseBarMenuItem.cpp +++ b/src/apps/processcontroller/NoiseBarMenuItem.cpp @@ -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 */ @@ -54,8 +54,8 @@ NoiseBarMenuItem::DrawBar(bool force) rgb_color highColor = menu->HighColor(); frame.right -= 24; frame.left = frame.right - kBarWidth; - frame.top += 5; - frame.bottom = frame.top + 8; + frame.top += kBarPadding; + frame.bottom -= kBarPadding; if (fBusyWaiting < 0) return; diff --git a/src/apps/processcontroller/ProcessController.h b/src/apps/processcontroller/ProcessController.h index c45f7a5a90..b32faab79b 100644 --- a/src/apps/processcontroller/ProcessController.h +++ b/src/apps/processcontroller/ProcessController.h @@ -92,5 +92,6 @@ extern bool gInDeskbar; #define kBarWidth 100 #define kMargin 12 +#define kBarPadding 7 #endif // _PCVIEW_H_ diff --git a/src/apps/processcontroller/TeamBarMenuItem.cpp b/src/apps/processcontroller/TeamBarMenuItem.cpp index 3f4a73e87e..11ca63670c 100644 --- a/src/apps/processcontroller/TeamBarMenuItem.cpp +++ b/src/apps/processcontroller/TeamBarMenuItem.cpp @@ -126,8 +126,8 @@ TeamBarMenuItem::DrawBar(bool force) rgb_color highColor = menu->HighColor(); frame.right -= 24; frame.left = frame.right-kBarWidth; - frame.top += 5; - frame.bottom = frame.top+8; + frame.top += kBarPadding; + frame.bottom -= kBarPadding; if (fKernel < 0) return; diff --git a/src/apps/processcontroller/ThreadBarMenuItem.cpp b/src/apps/processcontroller/ThreadBarMenuItem.cpp index 8845dcb5ec..cacd8af564 100644 --- a/src/apps/processcontroller/ThreadBarMenuItem.cpp +++ b/src/apps/processcontroller/ThreadBarMenuItem.cpp @@ -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 */ #include "ThreadBarMenuItem.h" @@ -59,8 +59,8 @@ ThreadBarMenuItem::DrawBar(bool force) rgb_color highColor = menu->HighColor(); frame.right -= 24; frame.left = frame.right - kBarWidth; - frame.top += 3; - frame.bottom = frame.top + 8; + frame.top += kBarPadding; + frame.bottom -= kBarPadding; if (fKernel < 0) return; @@ -138,8 +138,6 @@ void ThreadBarMenuItem::GetContentSize(float* width, float* height) { BMenuItem::GetContentSize(width, height); -// if (*height < 16) -// *height = 16; *width += 10 + kBarWidth; }