* Moved "install to Deskbar" alert into the application.
* If you install ProcessController to the Deskbar after startup, its window is not opened anymore. * When you install ProcessController, the Deskbar is only restarted if needed; this can probably be removed completely under Haiku. * Renamed some menu items. * Removed "Use Pulse's settings" menu item. * Fixed remaining issues from bug #633 as far as ProcessController was concerned. * Removed unused source files. * Big cleanup, even though there could be done much much more. * Compacted the source files a bit, merged PCView.cpp and PCView2.cpp to ProcessController.cpp to match the name of the class. * Renamed PCUtils.{cpp|h} to Utilities.{cpp|h} git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17647 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
|
||||
ThreadBarMenu.cpp
|
||||
|
||||
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,28 +15,33 @@
|
||||
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 "ThreadBarMenu.h"
|
||||
#include "ThreadBarMenuItem.h"
|
||||
|
||||
#include "PriorityMenu.h"
|
||||
#include "PCView.h"
|
||||
#include "ProcessController.h"
|
||||
#include "ThreadBarMenuItem.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define EXTRA 20
|
||||
|
||||
ThreadBarMenu::ThreadBarMenu(const char *title, team_id team, int32 thread_count):
|
||||
BMenu(title), fThreadsRecCount(thread_count+EXTRA), fTeam(team)
|
||||
|
||||
ThreadBarMenu::ThreadBarMenu(const char *title, team_id team, int32 threadCount)
|
||||
: BMenu(title),
|
||||
fThreadsRecCount(threadCount + EXTRA),
|
||||
fTeam(team)
|
||||
{
|
||||
SetFont(be_plain_font);
|
||||
fThreadsRec = (ThreadRec*) malloc(sizeof(ThreadRec)*fThreadsRecCount);
|
||||
fThreadsRec = (ThreadRec*) malloc(sizeof(ThreadRec) * fThreadsRecCount);
|
||||
Init();
|
||||
fRound = 0; // for syslog
|
||||
AddNew();
|
||||
}
|
||||
|
||||
|
||||
ThreadBarMenu::~ThreadBarMenu()
|
||||
{
|
||||
free(fThreadsRec);
|
||||
@@ -48,37 +49,47 @@ ThreadBarMenu::~ThreadBarMenu()
|
||||
gCurrentThreadBarMenu = NULL;
|
||||
}
|
||||
|
||||
void ThreadBarMenu::Init()
|
||||
|
||||
void
|
||||
ThreadBarMenu::Init()
|
||||
{
|
||||
int k = 0;
|
||||
int k = 0;
|
||||
while (k < fThreadsRecCount)
|
||||
fThreadsRec[k++].thread = -1;
|
||||
fRound = 1;
|
||||
}
|
||||
|
||||
void ThreadBarMenu::Reset(team_id team)
|
||||
|
||||
void
|
||||
ThreadBarMenu::Reset(team_id team)
|
||||
{
|
||||
fTeam = team;
|
||||
RemoveItems(0, CountItems(), true);
|
||||
Init();
|
||||
}
|
||||
|
||||
void ThreadBarMenu::AttachedToWindow()
|
||||
|
||||
void
|
||||
ThreadBarMenu::AttachedToWindow()
|
||||
{
|
||||
BMenu::AttachedToWindow();
|
||||
}
|
||||
|
||||
void ThreadBarMenu::Draw(BRect r)
|
||||
|
||||
void
|
||||
ThreadBarMenu::Draw(BRect r)
|
||||
{
|
||||
gCurrentThreadBarMenu = this;
|
||||
BMenu::Draw(r);
|
||||
}
|
||||
|
||||
void ThreadBarMenu::AddNew()
|
||||
|
||||
void
|
||||
ThreadBarMenu::AddNew()
|
||||
{
|
||||
thread_info info;
|
||||
int32 cookie = 0;
|
||||
int32 k = 0;
|
||||
int32 cookie = 0;
|
||||
int32 k = 0;
|
||||
while (get_next_thread_info(fTeam, &cookie, &info) == B_OK) {
|
||||
int lastk = k;
|
||||
while (k < fThreadsRecCount && fThreadsRec[k].thread != info.thread)
|
||||
@@ -118,12 +129,15 @@ void ThreadBarMenu::AddNew()
|
||||
fRound++;
|
||||
}
|
||||
|
||||
void ThreadBarMenu::Update()
|
||||
|
||||
void
|
||||
ThreadBarMenu::Update()
|
||||
{
|
||||
AddNew();
|
||||
int32 k, del;
|
||||
int32 k, del;
|
||||
del = -1;
|
||||
ThreadBarMenuItem *item;
|
||||
|
||||
for (k = 0; (item = (ThreadBarMenuItem*) ItemAt(k)) != NULL; k++) {
|
||||
item->BarUpdate();
|
||||
item->DrawBar(false);
|
||||
|
||||
Reference in New Issue
Block a user