Removed unnessecary BView creation, added code to check for the initial, "no config view yet" state

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9971 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matthew Wilber
2004-11-15 23:57:45 +00:00
parent 85e99c67fa
commit 7df553e6f3
@@ -124,6 +124,9 @@ DataTranslationsWindow::ShowConfigView(int32 id)
if (id >= num_translators) if (id >= num_translators)
return B_BAD_VALUE; return B_BAD_VALUE;
// fConfigView is NULL the first time this function
// is called, prevent a segment fault
if (fConfigView)
fRightBox->RemoveChild(fConfigView); fRightBox->RemoveChild(fConfigView);
BMessage emptyMsg; BMessage emptyMsg;
BRect rect(0, 0, 200, 233); BRect rect(0, 0, 200, 233);
@@ -159,6 +162,10 @@ DataTranslationsWindow::ShowConfigView(int32 id)
void void
DataTranslationsWindow::SetupViews() DataTranslationsWindow::SetupViews()
{ {
fConfigView = NULL;
// This is NULL until a translator is
// selected from the listview
// Window box // Window box
BBox *mainBox = new BBox(BRect(0, 0, DTW_RIGHT, DTW_BOTTOM), BBox *mainBox = new BBox(BRect(0, 0, DTW_RIGHT, DTW_BOTTOM),
"All_Window", B_FOLLOW_ALL_SIDES, "All_Window", B_FOLLOW_ALL_SIDES,
@@ -194,13 +201,6 @@ DataTranslationsWindow::SetupViews()
B_FOLLOW_LEFT | B_FOLLOW_BOTTOM); B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
fRightBox->AddChild(fTranNameView); fRightBox->AddChild(fTranNameView);
// Add the translator config panel
BRect configRect(rightRect);
configRect.bottom = iconRect.top;
fConfigView = new BView(configRect, "ConfigPanel", B_FOLLOW_ALL_SIDES,
B_WILL_DRAW | B_FRAME_EVENTS);
fRightBox->AddChild(fConfigView);
// Add the translators list view // Add the translators list view
fTranListView = new DataTranslationsView(BRect(10, 10, 120, 288), fTranListView = new DataTranslationsView(BRect(10, 10, 120, 288),
"TransList", B_SINGLE_SELECTION_LIST); "TransList", B_SINGLE_SELECTION_LIST);