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;
|
BBox *BottomFrame;
|
||||||
BRect BottomFrameRect(r.left+11,r.bottom-124,r.right-12,r.bottom-12);
|
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);
|
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
|
// 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 = new BButton(ConfigureButtonRect,"btnConfigure","Configure", new BMessage(BTN_CONFIGURE), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM, B_WILL_DRAW | B_NAVIGABLE);
|
||||||
btnConfigure->MakeDefault(true);
|
btnConfigure->MakeDefault(true);
|
||||||
btnConfigure->SetEnabled(false);
|
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);
|
BBox *background = new BBox(Bounds(), "background", B_FOLLOW_ALL_SIDES, B_WILL_DRAW, B_PLAIN_BORDER);
|
||||||
AddChild(background);
|
AddChild(background);
|
||||||
|
|
||||||
// Add Child(ren)
|
// Add Child(ren) - in reverse order to avoid one control overwriting another
|
||||||
background->AddChild(menubar);
|
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(stvDeviceName);
|
||||||
background->AddChild(stvCurrentState);
|
background->AddChild(stvCurrentState);
|
||||||
background->AddChild(stvIRQ);
|
background->AddChild(menubar);
|
||||||
background->AddChild(stvDMA);
|
|
||||||
background->AddChild(stvIORanges);
|
|
||||||
background->AddChild(stvMemoryRanges);
|
|
||||||
background->AddChild(outlinesv);
|
|
||||||
background->AddChild(btnConfigure);
|
|
||||||
background->AddChild(BottomFrame);
|
|
||||||
|
|
||||||
// Set Window Limits
|
// Set Window Limits
|
||||||
float xsize = 396 + (be_plain_font->Size()-10)*40;
|
float xsize = 396 + (be_plain_font->Size()-10)*40;
|
||||||
@@ -318,12 +320,12 @@ DevicesWindow::MessageReceived (BMessage *message)
|
|||||||
break;
|
break;
|
||||||
case BTN_CONFIGURE:
|
case BTN_CONFIGURE:
|
||||||
{
|
{
|
||||||
DeviceItem *item = (DeviceItem *)outline->ItemAt(outline->CurrentSelection());
|
DeviceItem *devItem = dynamic_cast<DeviceItem *>(outline->ItemAt(outline->CurrentSelection()));
|
||||||
if (item && is_instance_of(item, DeviceItem) ) {
|
if (devItem && devItem->GetInfo()) {
|
||||||
if (item->GetWindow()!=NULL)
|
if (devItem->GetWindow()!=NULL)
|
||||||
item->GetWindow()->Activate();
|
devItem->GetWindow()->Activate();
|
||||||
else
|
else
|
||||||
new ConfigurationWindow(BRect(150,150,562,602), item);
|
new ConfigurationWindow(BRect(150,150,562,602), devItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -331,6 +333,7 @@ DevicesWindow::MessageReceived (BMessage *message)
|
|||||||
BWindow::MessageReceived(message);
|
BWindow::MessageReceived(message);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
UpdateIfNeeded();
|
||||||
}
|
}
|
||||||
// ---------------------------------------------------------------------------------------------------------- //
|
// ---------------------------------------------------------------------------------------------------------- //
|
||||||
|
|
||||||
@@ -396,9 +399,10 @@ DevicesWindow::InitDevices(bus_type bus)
|
|||||||
void
|
void
|
||||||
DevicesWindow::UpdateDeviceInfo()
|
DevicesWindow::UpdateDeviceInfo()
|
||||||
{
|
{
|
||||||
DeviceItem *item = (DeviceItem *)outline->ItemAt(outline->CurrentSelection());
|
DeviceItem *item = dynamic_cast<DeviceItem *>(outline->ItemAt(outline->CurrentSelection()));
|
||||||
if (item && is_instance_of(item, DeviceItem) ) {
|
if (item) {
|
||||||
DevicesInfo *deviceInfo = item->GetInfo();
|
DevicesInfo *deviceInfo = item->GetInfo();
|
||||||
|
if (deviceInfo) {
|
||||||
struct device_configuration *current = deviceInfo->GetCurrent();
|
struct device_configuration *current = deviceInfo->GetCurrent();
|
||||||
resource_descriptor r;
|
resource_descriptor r;
|
||||||
|
|
||||||
@@ -492,10 +496,19 @@ DevicesWindow::UpdateDeviceInfo()
|
|||||||
|
|
||||||
btnConfigure->SetEnabled(true);
|
btnConfigure->SetEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
|
BlankDeviceInfoBox();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
BlankDeviceInfoBox();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DevicesWindow::BlankDeviceInfoBox()
|
||||||
|
{
|
||||||
stvIRQ->SetText("IRQs: ");
|
stvIRQ->SetText("IRQs: ");
|
||||||
stvDMA->SetText("DMAs: ");
|
stvDMA->SetText("DMAs: ");
|
||||||
stvIORanges->SetText("IO Ranges: ");
|
stvIORanges->SetText("IO Ranges: ");
|
||||||
stvMemoryRanges->SetText("Memory Ranges: ");
|
stvMemoryRanges->SetText("Memory Ranges: ");
|
||||||
btnConfigure->SetEnabled(false);
|
btnConfigure->SetEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ class DevicesWindow : public BWindow
|
|||||||
void LoadSettings(BMessage *msg);
|
void LoadSettings(BMessage *msg);
|
||||||
void SaveSettings(void);
|
void SaveSettings(void);
|
||||||
void UpdateDeviceInfo();
|
void UpdateDeviceInfo();
|
||||||
|
void BlankDeviceInfoBox();
|
||||||
|
|
||||||
ResourceUsageWindow* ptrResourceUsageWindow;
|
ResourceUsageWindow* ptrResourceUsageWindow;
|
||||||
ModemWindow* ptrModemWindow;
|
ModemWindow* ptrModemWindow;
|
||||||
@@ -106,4 +107,3 @@ class DevicesWindow : public BWindow
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user