A couple small bug fixes related to the new message queue interaction.

This commit is contained in:
casey 2016-05-15 21:28:06 -07:00
parent 2353f827eb
commit d1f2d867f5
4 changed files with 25 additions and 22 deletions

View File

@ -6,7 +6,7 @@
#include "IWindowMessage.h"
#define MESSAGE_TYPE_UPDATE 1001
#define UPDATE_INTERVAL_MS 500
#define UPDATE_INTERVAL_MS 1000
MainLayout::MainLayout(Transport& transport, LibraryPtr library)
: LayoutBase() {
@ -21,6 +21,8 @@ MainLayout::MainLayout(Transport& transport, LibraryPtr library)
this->AddWindow(this->output);
this->AddWindow(this->resources);
this->AddWindow(this->transport);
Post(MESSAGE_TYPE_UPDATE, 0, 0, UPDATE_INTERVAL_MS);
}
MainLayout::~MainLayout() {
@ -61,7 +63,6 @@ void MainLayout::Layout() {
void MainLayout::Show() {
LayoutBase::Show();
this->UpdateWindows();
Post(MESSAGE_TYPE_UPDATE, 0, 0, UPDATE_INTERVAL_MS);
}
void MainLayout::ProcessMessage(IWindowMessage &message) {

View File

@ -8,6 +8,8 @@
#include <core/debug.h>
#include <boost/format.hpp>
#include <core/debug.h>
#define BYTES_PER_MEGABYTE 1048576.0f
ResourcesWindow::ResourcesWindow(IWindow *parent)

View File

@ -78,7 +78,7 @@ double SystemInfo::GetCpuUsage() {
WindowsSystemInfo::WindowsSystemInfo() {
PdhOpenQuery(NULL, NULL, &cpuQuery);
PdhAddCounter(cpuQuery, "\\Processor(_Total)\\% Processor Time", NULL, &cpuTotal);
//PdhCollectQueryData(cpuQuery);
PdhCollectQueryData(cpuQuery);
SYSTEM_INFO sysInfo;
FILETIME ftime, fsys, fuser;
@ -145,6 +145,6 @@ double WindowsSystemInfo::GetCpuUsage() {
lastUserCpu = user;
lastSysCpu = sys;
return percent * 100;
return (percent * 100.0f);
}
#endif

View File

@ -218,6 +218,24 @@ void Window::Show() {
this->isVisible = true;
}
void Window::Hide() {
if (this->frame) {
wclear(this->frame);
wclear(this->content);
this->Repaint();
delwin(this->content);
if (this->content != this->frame) {
delwin(this->frame);
}
this->frame = this->content = NULL;
}
this->isVisible = false;
}
void Window::SetFrameVisible(bool enabled) {
if (enabled != this->drawFrame) {
this->drawFrame = enabled;
@ -260,21 +278,3 @@ void Window::Focus() {
void Window::Blur() {
}
void Window::Hide() {
if (this->frame) {
wclear(this->frame);
wclear(this->content);
this->Repaint();
delwin(this->content);
if (this->content != this->frame) {
delwin(this->frame);
}
this->frame = this->content = NULL;
}
this->isVisible = false;
}