Extract subchild cleanup to a function.

* No functional change intended.
This commit is contained in:
Kacper Kasper 2018-04-20 22:25:57 +02:00
parent d9a9615de8
commit 6c9edbb68c
2 changed files with 20 additions and 36 deletions

View File

@ -391,18 +391,7 @@ int YabInterface::CloseWindow(const char* view)
yabcanvas->RemoveItem(child);
// viewList->PrintOut();
BView *subchild;
if(subchild = child->ChildAt(0))
while(subchild)
{
CleanupYabTabView(subchild);
if(viewList->GetView(subchild->Name()))
{
RemoveView(subchild);
viewList->DelView(subchild->Name());
}
subchild = subchild->NextSibling();
}
CleanupSubchildView(child->ChildAt(0));
if(viewList->GetView(child->Name()))
{
RemoveView(child);
@ -3366,18 +3355,7 @@ void YabInterface::WindowClear(const char* window)
CleanupYabTabView(child);
if(is_kind_of(child, YabBitmapView))
yabcanvas->RemoveItem(child);
BView *subchild;
if(subchild = child->ChildAt(0))
while(subchild)
{
CleanupYabTabView(subchild);
if(viewList->GetView(subchild->Name()))
{
RemoveView(subchild);
viewList->DelView(subchild->Name());
}
subchild = subchild->NextSibling();
}
CleanupSubchildView(child->ChildAt(0));
if(viewList->GetView(child->Name()))
{
RemoveView(child);
@ -3429,18 +3407,7 @@ void YabInterface::RemoveView(BView *myView)
CleanupYabTabView(child);
if(is_kind_of(child, YabBitmapView))
yabcanvas->RemoveItem(child);
BView *subchild;
if(subchild = child->ChildAt(0))
while(subchild)
{
CleanupYabTabView(subchild);
if(viewList->GetView(subchild->Name()))
{
RemoveView(subchild);
viewList->DelView(subchild->Name());
}
subchild = subchild->NextSibling();
}
CleanupSubchildView(child->ChildAt(0));
if(viewList->GetView(child->Name()))
{
RemoveView(child);
@ -3493,6 +3460,22 @@ void YabInterface::CleanupYabTabView(BView* view)
}
}
void YabInterface::CleanupSubchildView(BView* view)
{
if(view == NULL || viewList == NULL) return;
while(view)
{
CleanupYabTabView(view);
if(viewList->GetView(view->Name()))
{
RemoveView(view);
viewList->DelView(view->Name());
}
view = view->NextSibling();
}
}
void YabInterface::TextEdit(BRect frame, const char* title, int scrollbar, const char* window)
{
YabView *myView = cast_as((BView*)viewList->GetView(window), YabView);

View File

@ -249,6 +249,7 @@
BBitmap* loadImage(const char* name);
static int compare(BListItem **firstArg, BListItem **secondArg);
void CleanupYabTabView(BView* view);
void CleanupSubchildView(BView* view);
BTranslatorRoster *Roster;
char ApplicationDirectory[1024];