Extract YabTabView cleanup to a function.
* No functional change intended.
This commit is contained in:
@@ -105,7 +105,7 @@ static bool quitting = false;
|
|||||||
static property_info prop_list[] = {
|
static property_info prop_list[] = {
|
||||||
{ "YabSendString", {B_SET_PROPERTY, 0}, {B_NAME_SPECIFIER, 0}, "Send a string to MESSAGE$"},
|
{ "YabSendString", {B_SET_PROPERTY, 0}, {B_NAME_SPECIFIER, 0}, "Send a string to MESSAGE$"},
|
||||||
0 // terminate list
|
0 // terminate list
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* _L(const char* text)
|
const char* _L(const char* text)
|
||||||
{
|
{
|
||||||
@@ -386,15 +386,7 @@ int YabInterface::CloseWindow(const char* view)
|
|||||||
{
|
{
|
||||||
while(child)
|
while(child)
|
||||||
{
|
{
|
||||||
if(is_kind_of(child, YabTabView))
|
CleanupYabTabView(child);
|
||||||
{
|
|
||||||
for(int i = 0; i<((YabTabView*)child)->CountTabs(); i++)
|
|
||||||
{
|
|
||||||
YabView *t = (YabView*)((YabTabView*)child)->TabAt(i)->View();
|
|
||||||
RemoveView(t);
|
|
||||||
viewList->DelView(t->NameForTabView());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(is_kind_of(child, YabBitmapView))
|
if(is_kind_of(child, YabBitmapView))
|
||||||
yabcanvas->RemoveItem(child);
|
yabcanvas->RemoveItem(child);
|
||||||
|
|
||||||
@@ -403,15 +395,7 @@ int YabInterface::CloseWindow(const char* view)
|
|||||||
if(subchild = child->ChildAt(0))
|
if(subchild = child->ChildAt(0))
|
||||||
while(subchild)
|
while(subchild)
|
||||||
{
|
{
|
||||||
if(is_kind_of(subchild, YabTabView))
|
CleanupYabTabView(subchild);
|
||||||
{
|
|
||||||
for(int i = 0; i<((YabTabView*)subchild)->CountTabs(); i++)
|
|
||||||
{
|
|
||||||
YabView *t = (YabView*)((YabTabView*)subchild)->TabAt(i)->View();
|
|
||||||
RemoveView(t);
|
|
||||||
viewList->DelView(t->NameForTabView());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(viewList->GetView(subchild->Name()))
|
if(viewList->GetView(subchild->Name()))
|
||||||
{
|
{
|
||||||
RemoveView(subchild);
|
RemoveView(subchild);
|
||||||
@@ -3379,30 +3363,14 @@ void YabInterface::WindowClear(const char* window)
|
|||||||
{
|
{
|
||||||
while(child)
|
while(child)
|
||||||
{
|
{
|
||||||
if(is_kind_of(child, YabTabView))
|
CleanupYabTabView(child);
|
||||||
{
|
|
||||||
for(int i = 0; i<((YabTabView*)child)->CountTabs(); i++)
|
|
||||||
{
|
|
||||||
YabView *t = (YabView*)((YabTabView*)child)->TabAt(i)->View();
|
|
||||||
RemoveView(t);
|
|
||||||
viewList->DelView(t->NameForTabView());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(is_kind_of(child, YabBitmapView))
|
if(is_kind_of(child, YabBitmapView))
|
||||||
yabcanvas->RemoveItem(child);
|
yabcanvas->RemoveItem(child);
|
||||||
BView *subchild;
|
BView *subchild;
|
||||||
if(subchild = child->ChildAt(0))
|
if(subchild = child->ChildAt(0))
|
||||||
while(subchild)
|
while(subchild)
|
||||||
{
|
{
|
||||||
if(is_kind_of(subchild, YabTabView))
|
CleanupYabTabView(subchild);
|
||||||
{
|
|
||||||
for(int i = 0; i<((YabTabView*)subchild)->CountTabs(); i++)
|
|
||||||
{
|
|
||||||
YabView *t = (YabView*)((YabTabView*)subchild)->TabAt(i)->View();
|
|
||||||
RemoveView(t);
|
|
||||||
viewList->DelView(t->NameForTabView());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(viewList->GetView(subchild->Name()))
|
if(viewList->GetView(subchild->Name()))
|
||||||
{
|
{
|
||||||
RemoveView(subchild);
|
RemoveView(subchild);
|
||||||
@@ -3458,31 +3426,14 @@ void YabInterface::RemoveView(BView *myView)
|
|||||||
if(child = myView->ChildAt(0))
|
if(child = myView->ChildAt(0))
|
||||||
while(child)
|
while(child)
|
||||||
{
|
{
|
||||||
|
CleanupYabTabView(child);
|
||||||
if(is_kind_of(child, YabTabView))
|
|
||||||
{
|
|
||||||
for(int i = 0; i<((YabTabView*)child)->CountTabs(); i++)
|
|
||||||
{
|
|
||||||
YabView *t = (YabView*)((YabTabView*)child)->TabAt(i)->View();
|
|
||||||
RemoveView(t);
|
|
||||||
viewList->DelView(t->NameForTabView());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(is_kind_of(child, YabBitmapView))
|
if(is_kind_of(child, YabBitmapView))
|
||||||
yabcanvas->RemoveItem(child);
|
yabcanvas->RemoveItem(child);
|
||||||
BView *subchild;
|
BView *subchild;
|
||||||
if(subchild = child->ChildAt(0))
|
if(subchild = child->ChildAt(0))
|
||||||
while(subchild)
|
while(subchild)
|
||||||
{
|
{
|
||||||
if(is_kind_of(subchild, YabTabView))
|
CleanupYabTabView(subchild);
|
||||||
{
|
|
||||||
for(int i = 0; i<((YabTabView*)subchild)->CountTabs(); i++)
|
|
||||||
{
|
|
||||||
YabView *t = (YabView*)((YabTabView*)subchild)->TabAt(i)->View();
|
|
||||||
RemoveView(t);
|
|
||||||
viewList->DelView(t->NameForTabView());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(viewList->GetView(subchild->Name()))
|
if(viewList->GetView(subchild->Name()))
|
||||||
{
|
{
|
||||||
RemoveView(subchild);
|
RemoveView(subchild);
|
||||||
@@ -3527,6 +3478,21 @@ void YabInterface::RemoveView(BView *myView)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void YabInterface::CleanupYabTabView(BView* view)
|
||||||
|
{
|
||||||
|
if(view == NULL || viewList == NULL) return;
|
||||||
|
|
||||||
|
if(is_kind_of(view, YabTabView)) {
|
||||||
|
YabTabView* tabView = static_cast<YabTabView*>(view);
|
||||||
|
for(int i = 0; i < tabView->CountTabs(); i++)
|
||||||
|
{
|
||||||
|
YabView *t = static_cast<YabView*>(tabView->TabAt(i)->View());
|
||||||
|
RemoveView(t);
|
||||||
|
viewList->DelView(t->NameForTabView());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void YabInterface::TextEdit(BRect frame, const char* title, int scrollbar, const char* window)
|
void YabInterface::TextEdit(BRect frame, const char* title, int scrollbar, const char* window)
|
||||||
{
|
{
|
||||||
YabView *myView = cast_as((BView*)viewList->GetView(window), YabView);
|
YabView *myView = cast_as((BView*)viewList->GetView(window), YabView);
|
||||||
|
|||||||
@@ -248,6 +248,7 @@
|
|||||||
void GetMMsgInfo(BString &t, int mouseStateInfo, int mouseLButton, int mouseMButton, int mouseRButton, int x, int y, const char* name);
|
void GetMMsgInfo(BString &t, int mouseStateInfo, int mouseLButton, int mouseMButton, int mouseRButton, int x, int y, const char* name);
|
||||||
BBitmap* loadImage(const char* name);
|
BBitmap* loadImage(const char* name);
|
||||||
static int compare(BListItem **firstArg, BListItem **secondArg);
|
static int compare(BListItem **firstArg, BListItem **secondArg);
|
||||||
|
void CleanupYabTabView(BView* view);
|
||||||
|
|
||||||
BTranslatorRoster *Roster;
|
BTranslatorRoster *Roster;
|
||||||
char ApplicationDirectory[1024];
|
char ApplicationDirectory[1024];
|
||||||
|
|||||||
Reference in New Issue
Block a user