Updated by Mark Hogben <[email protected]>
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8142 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -207,9 +207,11 @@ void DevicesWindow::InitWindow(void)
|
||||
BBox *BottomFrame;
|
||||
BRect BottomFrameRect(r.left+11,r.bottom-124,r.right-12,r.bottom-12);
|
||||
BottomFrame = new BBox(BottomFrameRect, "BottomFrame", B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM, B_WILL_DRAW, B_FANCY_BORDER);
|
||||
BRect bottomFrameBounds = BottomFrame->Bounds();
|
||||
|
||||
// Create BButton - Configure
|
||||
BRect ConfigureButtonRect(r.left+298,r.bottom-47,r.right-23,r.bottom-23);
|
||||
BRect ConfigureButtonRect(bottomFrameBounds.left+290, bottomFrameBounds.bottom-37,
|
||||
bottomFrameBounds.right-13, bottomFrameBounds.bottom-13);
|
||||
btnConfigure = new BButton(ConfigureButtonRect,"btnConfigure","Configure", new BMessage(BTN_CONFIGURE), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM, B_WILL_DRAW | B_NAVIGABLE);
|
||||
btnConfigure->MakeDefault(true);
|
||||
btnConfigure->SetEnabled(false);
|
||||
@@ -218,17 +220,17 @@ void DevicesWindow::InitWindow(void)
|
||||
BBox *background = new BBox(Bounds(), "background", B_FOLLOW_ALL_SIDES, B_WILL_DRAW, B_PLAIN_BORDER);
|
||||
AddChild(background);
|
||||
|
||||
// Add Child(ren)
|
||||
background->AddChild(menubar);
|
||||
// Add Child(ren) - in reverse order to avoid one control overwriting another
|
||||
background->AddChild(BottomFrame);
|
||||
BottomFrame->AddChild(btnConfigure);
|
||||
background->AddChild(outlinesv);
|
||||
background->AddChild(stvMemoryRanges);
|
||||
background->AddChild(stvIORanges);
|
||||
background->AddChild(stvDMA);
|
||||
background->AddChild(stvIRQ);
|
||||
background->AddChild(stvDeviceName);
|
||||
background->AddChild(stvCurrentState);
|
||||
background->AddChild(stvIRQ);
|
||||
background->AddChild(stvDMA);
|
||||
background->AddChild(stvIORanges);
|
||||
background->AddChild(stvMemoryRanges);
|
||||
background->AddChild(outlinesv);
|
||||
background->AddChild(btnConfigure);
|
||||
background->AddChild(BottomFrame);
|
||||
background->AddChild(menubar);
|
||||
|
||||
// Set Window Limits
|
||||
float xsize = 396 + (be_plain_font->Size()-10)*40;
|
||||
@@ -318,12 +320,12 @@ DevicesWindow::MessageReceived (BMessage *message)
|
||||
break;
|
||||
case BTN_CONFIGURE:
|
||||
{
|
||||
DeviceItem *item = (DeviceItem *)outline->ItemAt(outline->CurrentSelection());
|
||||
if (item && is_instance_of(item, DeviceItem) ) {
|
||||
if (item->GetWindow()!=NULL)
|
||||
item->GetWindow()->Activate();
|
||||
DeviceItem *devItem = dynamic_cast<DeviceItem *>(outline->ItemAt(outline->CurrentSelection()));
|
||||
if (devItem && devItem->GetInfo()) {
|
||||
if (devItem->GetWindow()!=NULL)
|
||||
devItem->GetWindow()->Activate();
|
||||
else
|
||||
new ConfigurationWindow(BRect(150,150,562,602), item);
|
||||
new ConfigurationWindow(BRect(150,150,562,602), devItem);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -331,6 +333,7 @@ DevicesWindow::MessageReceived (BMessage *message)
|
||||
BWindow::MessageReceived(message);
|
||||
break;
|
||||
}
|
||||
UpdateIfNeeded();
|
||||
}
|
||||
// ---------------------------------------------------------------------------------------------------------- //
|
||||
|
||||
@@ -396,9 +399,10 @@ DevicesWindow::InitDevices(bus_type bus)
|
||||
void
|
||||
DevicesWindow::UpdateDeviceInfo()
|
||||
{
|
||||
DeviceItem *item = (DeviceItem *)outline->ItemAt(outline->CurrentSelection());
|
||||
if (item && is_instance_of(item, DeviceItem) ) {
|
||||
DeviceItem *item = dynamic_cast<DeviceItem *>(outline->ItemAt(outline->CurrentSelection()));
|
||||
if (item) {
|
||||
DevicesInfo *deviceInfo = item->GetInfo();
|
||||
if (deviceInfo) {
|
||||
struct device_configuration *current = deviceInfo->GetCurrent();
|
||||
resource_descriptor r;
|
||||
|
||||
@@ -492,10 +496,19 @@ DevicesWindow::UpdateDeviceInfo()
|
||||
|
||||
btnConfigure->SetEnabled(true);
|
||||
} else {
|
||||
BlankDeviceInfoBox();
|
||||
}
|
||||
} else {
|
||||
BlankDeviceInfoBox();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DevicesWindow::BlankDeviceInfoBox()
|
||||
{
|
||||
stvIRQ->SetText("IRQs: ");
|
||||
stvDMA->SetText("DMAs: ");
|
||||
stvIORanges->SetText("IO Ranges: ");
|
||||
stvMemoryRanges->SetText("Memory Ranges: ");
|
||||
btnConfigure->SetEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +85,7 @@ class DevicesWindow : public BWindow
|
||||
void LoadSettings(BMessage *msg);
|
||||
void SaveSettings(void);
|
||||
void UpdateDeviceInfo();
|
||||
void BlankDeviceInfoBox();
|
||||
|
||||
ResourceUsageWindow* ptrResourceUsageWindow;
|
||||
ModemWindow* ptrModemWindow;
|
||||
@@ -106,4 +107,3 @@ class DevicesWindow : public BWindow
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user