From 9057d59d6ca4a30e147e29ad66ef896ebc035e62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 26 May 2006 13:56:41 +0000 Subject: [PATCH] * Replaced the nice ProcessController about window with a boring one that looks like any other. * Added ProcessController to the image. * Have BeUnited made any changes to the sources besides putting "copyright beunited" everywhere? If so, we could just remove them to reduce the clutter. If anyone knows, please tell. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17595 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- build/jam/HaikuImage | 2 +- src/apps/processcontroller/AboutPC.cpp | 121 ------------------------- src/apps/processcontroller/AboutPC.h | 54 ----------- src/apps/processcontroller/Jamfile | 1 - src/apps/processcontroller/PCView.cpp | 62 +++++++++---- src/apps/processcontroller/PCView.h | 61 +++++++------ 6 files changed, 74 insertions(+), 227 deletions(-) delete mode 100644 src/apps/processcontroller/AboutPC.cpp delete mode 100644 src/apps/processcontroller/AboutPC.h diff --git a/build/jam/HaikuImage b/build/jam/HaikuImage index c7089fc7d5..61c07821ee 100644 --- a/build/jam/HaikuImage +++ b/build/jam/HaikuImage @@ -33,7 +33,7 @@ BEOS_BIN = addattr alert arp basename beep cat catattr chgrp chmod chop chown cl zipnote zipsplit zmore znew ; -BEOS_APPS = Terminal Expander People ShowImage Clock Pulse +BEOS_APPS = Terminal Expander People ShowImage Clock Pulse ProcessController Playground SoundRecorder BitmapDrawing Magnify DiskProbe AboutHaiku StyledEdit Installer Chart Workspaces $(X86_ONLY)Cortex $(X86_ONLY)CortexAddOnHost $(X86_ONLY)GLTeapot MediaPlayer diff --git a/src/apps/processcontroller/AboutPC.cpp b/src/apps/processcontroller/AboutPC.cpp deleted file mode 100644 index 431631d3ff..0000000000 --- a/src/apps/processcontroller/AboutPC.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - AboutPC.cpp - - ProcessController - © 2000, Georges-Edouard Berenger, All Rights Reserved. - 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 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 -*/ - -#include "PCWorld.h" -#include "AboutPC.h" -#include "WindowsTools.h" -#include -#include -#include -#include -#include "URLView.h" - -const char* kProgramName = "ProcessController 3.1.1"; -const char* SendTexte = "Send your bug reports & comments to:"; - -const char* kAboutProgramName = "ProcessController"; -const char* kAboutEmail = "contact@beuntied.org"; -//const char* kAboutEmail = "berenger@francenet.fr"; -//const char* kAboutWeb = "http://home.foni.net/~berenger/"; -//const char* kAboutWeb = "http://stv.steinberg.de/~georges/besoft/"; -const char* kAboutWeb = "http://www.beunited.org/index.php?page=developer"; - -AboutPC::AboutPC(BRect r):BWindow(CenterRect(r, 530, 200), B_EMPTY_STRING, - B_MODAL_WINDOW, B_NOT_RESIZABLE+B_NOT_ZOOMABLE+B_NOT_MINIMIZABLE+B_NOT_CLOSABLE) -{ - BRect rect; - AboutView *topview; - - // View de fond - rect = Bounds(); - AddChild(topview = new AboutView(rect)); - BButton *ok; - topview->AddChild(ok = new BButton(BRect(rect.right-125, rect.bottom-40, rect.right-25, rect.bottom-16), NULL, "Thanks!", new BMessage(B_QUIT_REQUESTED), B_FOLLOW_LEFT)); - ok->MakeDefault(true); - visible_window(this); - Show(); -} - -#define kTop 163 -#define kStep 12 -#define kLeft 70 - -AboutView::AboutView(BRect frame) - : BView(frame, NULL, B_FOLLOW_NONE, B_WILL_DRAW) -{ - fIcon = new BBitmap(BRect(0, 0, 31, 31), B_COLOR_8_BIT); - BMimeType(kSignature).GetIcon(fIcon, B_LARGE_ICON); - float middle = Frame ().Width () / 2; - BRect rect (middle, 112, 0, 0); - char subject[256]; - sprintf (subject, "About %s (%s, %s)", kProgramName, __DATE__, __TIME__); - mailtoView* mailto = new mailtoView (rect, kAboutEmail, subject); - AddChild (mailto); - rect.Set (kLeft - 2, kTop + kStep + 2, kLeft - 2, 0); - URLView* urlview = new URLView (rect, kAboutWeb); - AddChild (urlview); -} - -AboutView::~AboutView() -{ - if (fIcon) - delete fIcon; -} - -void AboutView::AttachedToWindow() -{ - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); -} - -void AboutView::Draw(BRect /*updateRect*/) -{ - static rgb_color panel_color = ui_color(B_PANEL_BACKGROUND_COLOR); - static rgb_color dark_panel_color = tint_color(panel_color, B_DARKEN_1_TINT); - BRect r = Bounds(); - SetDrawingMode(B_OP_OVER); - DrawBitmap(fIcon, BPoint(20, 156)); - SetDrawingMode(B_OP_COPY); - r.bottom = 80; - SetHighColor(dark_panel_color); - FillRect(r); - SetHighColor(kBordeaux); - SetLowColor(dark_panel_color); - if (fFont.SetFamilyAndFace ("Baskerville", B_BOLD_FACE | B_ITALIC_FACE) != B_OK) - fFont.SetFamilyAndFace ("Baskerville BT", B_BOLD_FACE | B_ITALIC_FACE); - fFont.SetSize(45); - SetFont(&fFont, B_FONT_FAMILY_AND_STYLE | B_FONT_SIZE); - DrawString(kProgramName, BPoint((r.Width()-StringWidth(kProgramName))/2, 50)); - fFont.SetFamilyAndFace ("Swis721 BT", B_REGULAR_FACE); - fFont.SetSize(10); - SetFont(&fFont, B_FONT_FAMILY_AND_STYLE | B_FONT_SIZE); - SetHighColor(kBlack); - SetLowColor(panel_color); - DrawString(SendTexte, BPoint((r.Width()-StringWidth(SendTexte))/2, 106)); - MovePenTo(kLeft, kTop); - DrawString("Halifax, "); - DrawString(__DATE__); - DrawString(", "); - DrawString(__TIME__); - DrawString("."); - DrawString("© www.beuntied.org, 2004. Original by Georges-Edouard Berenger.", BPoint(kLeft, kTop + kStep)); -} diff --git a/src/apps/processcontroller/AboutPC.h b/src/apps/processcontroller/AboutPC.h deleted file mode 100644 index 26da33d349..0000000000 --- a/src/apps/processcontroller/AboutPC.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - - AboutPC.h - - ProcessController - © 2000, Georges-Edouard Berenger, All Rights Reserved. - 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 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 -*/ - -#ifndef _ABOUT_PC_H_ -#define _ABOUT_PC_H_ - -class BBitmap; - -#include -#include -#include - -class AboutPC : public BWindow { - -public: - AboutPC(BRect r); -}; - -class AboutView : public BView { - -public: - AboutView(BRect frame); - ~AboutView(); -virtual void AttachedToWindow(); -virtual void Draw(BRect updateRect); - -private: - BFont fFont; - BBitmap *fIcon; -}; - -#define CenterRect(r, W, H) BRect(r.left+(r.Width()-W)/2, r.top+(r.Height()-H)/3, r.right-(r.Width()-W)/2, r.bottom-2*(r.Height()-H)/3) - -#endif // _ABOUT_PC_H_ diff --git a/src/apps/processcontroller/Jamfile b/src/apps/processcontroller/Jamfile index 781d652ae7..562d323069 100644 --- a/src/apps/processcontroller/Jamfile +++ b/src/apps/processcontroller/Jamfile @@ -3,7 +3,6 @@ SubDir HAIKU_TOP src apps processcontroller ; SetSubDirSupportedPlatformsBeOSCompatible ; Application ProcessController : - AboutPC.cpp AutoIcon.cpp IconMenuItem.cpp KernelMemoryBarMenuItem.cpp diff --git a/src/apps/processcontroller/PCView.cpp b/src/apps/processcontroller/PCView.cpp index 66e0b27ebc..0f2a954583 100644 --- a/src/apps/processcontroller/PCView.cpp +++ b/src/apps/processcontroller/PCView.cpp @@ -2,7 +2,8 @@ PCView.cpp ProcessController © 2000, Georges-Edouard Berenger, All Rights Reserved. - Copyright (C) 2004 beunited.org + Copyright (C) 2004 beunited.org + Copyright (c) 2006 Haiku, Inc. All Rights Reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -22,7 +23,6 @@ #include "PCView.h" #include "IconMenuItem.h" #include "PCWorld.h" -#include "AboutPC.h" #include "Preferences.h" #include "PCUtils.h" #include "Colors.h" @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -52,25 +53,25 @@ const char* kActiveColorPref = "deskbar_active_color"; const char* kPuseSettings = "Pulse_settings"; -const rgb_color kKernelBlue = {20, 20, 231, 255}; +const rgb_color kKernelBlue = {20, 20, 231, 255}; const rgb_color kIdleGreen = {110, 190,110, 255}; -ProcessController* gPCView; -int32 gCPUcount; -rgb_color gUserColor; -rgb_color gUserColorSelected; -rgb_color gIdleColor; -rgb_color gIdleColorSelected; -rgb_color gKernelColor; -rgb_color gKernelColorSelected; -rgb_color gFrameColor; -rgb_color gFrameColorSelected; -rgb_color gMenuBackColorSelected; -rgb_color gMenuBackColor; -rgb_color gWhiteSelected; -ThreadBarMenu* gCurrentThreadBarMenu; -bool gInDeskbar = false; -int32 gMimicPulse = 0; +ProcessController* gPCView; +int32 gCPUcount; +rgb_color gUserColor; +rgb_color gUserColorSelected; +rgb_color gIdleColor; +rgb_color gIdleColorSelected; +rgb_color gKernelColor; +rgb_color gKernelColorSelected; +rgb_color gFrameColor; +rgb_color gFrameColorSelected; +rgb_color gMenuBackColorSelected; +rgb_color gMenuBackColor; +rgb_color gWhiteSelected; +ThreadBarMenu* gCurrentThreadBarMenu; +bool gInDeskbar = false; +int32 gMimicPulse = 0; #define DEBUG_THREADS 1 @@ -319,7 +320,7 @@ ProcessController::MessageReceived(BMessage *message) } case B_ABOUT_REQUESTED: - new AboutPC(BScreen().Frame()); + AboutRequested(); break; default: @@ -328,6 +329,27 @@ ProcessController::MessageReceived(BMessage *message) } +void +ProcessController::AboutRequested() +{ + BAlert *alert = new BAlert("about", "ProcessController\n" + "\tCopyright 1997-2001,\n" + "\t\tGeorges-Edouard Berenger.\n\n" + "\tCopyright 2006, Haiku, Inc.\n\n", "Ok"); + BTextView *view = alert->TextView(); + BFont font; + + view->SetStylable(true); + + view->GetFont(&font); + font.SetSize(18); + font.SetFace(B_BOLD_FACE); + view->SetFontAndColor(0, 17, &font); + + alert->Go(); +} + + void ProcessController::DefaultColors() { diff --git a/src/apps/processcontroller/PCView.h b/src/apps/processcontroller/PCView.h index daa70089a2..dd2bb30544 100644 --- a/src/apps/processcontroller/PCView.h +++ b/src/apps/processcontroller/PCView.h @@ -1,9 +1,7 @@ /* - PCView.h - ProcessController - © 2000, Georges-Edouard Berenger, All Rights Reserved. + ProcessController © 2000, Georges-Edouard Berenger, All Rights Reserved. Copyright (C) 2004 beunited.org This library is free software; you can redistribute it and/or @@ -19,45 +17,48 @@ 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 - */ - #ifndef _PCVIEW_H_ #define _PCVIEW_H_ -#include + #include "AutoIcon.h" -class BMessageRunner; +#include + +class BMessageRunner; class ThreadBarMenu; + class _EXPORT ProcessController : public BView { + public: + ProcessController(BRect frame, bool temp = false); + ProcessController(BMessage *data); + ProcessController(); + virtual ~ProcessController(); -public: - ProcessController(BRect frame, bool temp=false); - ProcessController(BMessage *data); - ProcessController(); -virtual ~ProcessController(); -virtual void MessageReceived(BMessage *message); -virtual void AttachedToWindow(); -virtual void MouseDown(BPoint where); -virtual void Draw(BRect updateRect); - void DoDraw (bool force); -static ProcessController *Instantiate(BMessage *data); -virtual status_t Archive(BMessage *data, bool deep = true) const; + virtual void MessageReceived(BMessage *message); + virtual void AttachedToWindow(); + virtual void MouseDown(BPoint where); + virtual void Draw(BRect updateRect); + void DoDraw (bool force); + static ProcessController* Instantiate(BMessage* data); + virtual status_t Archive(BMessage *data, bool deep = true) const; - void Update (); - void DefaultColors (); - - AutoIcon fProcessControllerIcon; - AutoIcon fProcessorIcon; - AutoIcon fTrackerIcon; - AutoIcon fDeskbarIcon; - AutoIcon fTerminalIcon; + void AboutRequested(); + void Update(); + void DefaultColors(); -private: - void Init(); + // TODO: move those into private, and have getter methods + AutoIcon fProcessControllerIcon; + AutoIcon fProcessorIcon; + AutoIcon fTrackerIcon; + AutoIcon fDeskbarIcon; + AutoIcon fTerminalIcon; + + private: + void Init(); bool fTemp; float fMemoryUsage; @@ -66,7 +67,7 @@ private: double fCPUTimes[B_MAX_CPU_COUNT]; bigtime_t fPrevActive[B_MAX_CPU_COUNT]; bigtime_t fPrevTime; - BMessageRunner *fMessageRunner; + BMessageRunner* fMessageRunner; rgb_color frame_color, active_color, idle_color, memory_color, swap_color; };