Cleanp continues. Removed 2 methods from Workspace class because were related to rebuild/redraw stuff. Workspace should only care about corect window placement and order.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8366 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -334,7 +334,7 @@ void Desktop::MouseEventHandler(PortMessage *msg)
|
|||||||
Workspace *ws;
|
Workspace *ws;
|
||||||
rl = ActiveRootLayer();
|
rl = ActiveRootLayer();
|
||||||
ws = rl->ActiveWorkspace();
|
ws = rl->ActiveWorkspace();
|
||||||
target = ws->SearchWinBorder(pt);
|
target = rl->WinBorderAt(pt);
|
||||||
if (target)
|
if (target)
|
||||||
{
|
{
|
||||||
fGeneralLock.Lock();
|
fGeneralLock.Lock();
|
||||||
@@ -437,7 +437,7 @@ printf("2Focus: %s\n", ws->FocusLayer()->GetName());
|
|||||||
// After we read the data, we need to reset it for MouseUp()
|
// After we read the data, we need to reset it for MouseUp()
|
||||||
msg->Rewind();
|
msg->Rewind();
|
||||||
|
|
||||||
WinBorder *target = ActiveRootLayer()->ActiveWorkspace()->SearchWinBorder(pt);
|
WinBorder *target = ActiveRootLayer()->WinBorderAt(pt);
|
||||||
if(target){
|
if(target){
|
||||||
target->Window()->Lock();
|
target->Window()->Lock();
|
||||||
target->MouseUp(msg);
|
target->MouseUp(msg);
|
||||||
@@ -481,7 +481,7 @@ printf("2Focus: %s\n", ws->FocusLayer()->GetName());
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WinBorder *target = ActiveRootLayer()->ActiveWorkspace()->SearchWinBorder(BPoint(x,y));
|
WinBorder *target = ActiveRootLayer()->WinBorderAt(BPoint(x,y));
|
||||||
if(target){
|
if(target){
|
||||||
target->Window()->Lock();
|
target->Window()->Lock();
|
||||||
target->MouseMoved(msg);
|
target->MouseMoved(msg);
|
||||||
|
|||||||
@@ -368,6 +368,21 @@ void RootLayer::RemoveWinBorder(WinBorder* winBorder)
|
|||||||
desktop->fGeneralLock.Unlock();
|
desktop->fGeneralLock.Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WinBorder* RootLayer::WinBorderAt(const BPoint& pt){
|
||||||
|
WinBorder *target = NULL;
|
||||||
|
WinBorder *wb = NULL;
|
||||||
|
|
||||||
|
for( wb = fActiveWorkspace->GoToBottomItem(); wb; wb = fActiveWorkspace->GoToUpperItem())
|
||||||
|
{
|
||||||
|
if(!wb->IsHidden() && wb->HasPoint(pt))
|
||||||
|
{
|
||||||
|
target = wb;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
void RootLayer::ChangeWorkspacesFor(WinBorder* winBorder, uint32 newWorkspaces)
|
void RootLayer::ChangeWorkspacesFor(WinBorder* winBorder, uint32 newWorkspaces)
|
||||||
{
|
{
|
||||||
// only normal windows are affected by this change
|
// only normal windows are affected by this change
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ public:
|
|||||||
|
|
||||||
void AddWinBorder(WinBorder *winBorder);
|
void AddWinBorder(WinBorder *winBorder);
|
||||||
void RemoveWinBorder(WinBorder *winBorder);
|
void RemoveWinBorder(WinBorder *winBorder);
|
||||||
|
WinBorder* WinBorderAt(const BPoint& pt);
|
||||||
void ChangeWorkspacesFor(WinBorder *winBorder, uint32 newWorkspaces);
|
void ChangeWorkspacesFor(WinBorder *winBorder, uint32 newWorkspaces);
|
||||||
bool SetFrontWinBorder(WinBorder *winBorder);
|
bool SetFrontWinBorder(WinBorder *winBorder);
|
||||||
|
|
||||||
|
|||||||
@@ -357,8 +357,10 @@ void ServerWindow::Hide(void)
|
|||||||
{
|
{
|
||||||
if (ws->FocusLayer() == fWinBorder)
|
if (ws->FocusLayer() == fWinBorder)
|
||||||
ws->SearchAndSetNewFocus(fWinBorder);
|
ws->SearchAndSetNewFocus(fWinBorder);
|
||||||
else
|
else{
|
||||||
ws->Invalidate();
|
// TODO: RootLayer class should take care of this. (or Desktop)
|
||||||
|
// ws->Invalidate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rl->fMainLock.Unlock();
|
rl->fMainLock.Unlock();
|
||||||
|
|||||||
@@ -410,7 +410,7 @@ void WinBorder::ResizeBy(float x, float y)
|
|||||||
Layer::ResizeBy(x,y);
|
Layer::ResizeBy(x,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WinBorder::HasPoint(BPoint& pt) const
|
bool WinBorder::HasPoint(const BPoint& pt) const
|
||||||
{
|
{
|
||||||
return fFullVisible.Contains(pt);
|
return fFullVisible.Contains(pt);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public:
|
|||||||
void SetLevel();
|
void SetLevel();
|
||||||
void HighlightDecorator(const bool &active);
|
void HighlightDecorator(const bool &active);
|
||||||
|
|
||||||
bool HasPoint(BPoint &pt) const;
|
bool HasPoint(const BPoint &pt) const;
|
||||||
|
|
||||||
void AddToSubsetOf(WinBorder* main);
|
void AddToSubsetOf(WinBorder* main);
|
||||||
void RemoveFromSubsetOf(WinBorder* main);
|
void RemoveFromSubsetOf(WinBorder* main);
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
# define STRACESTREAM() ;
|
# define STRACESTREAM() ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
Workspace::Workspace(const uint32 colorspace, int32 ID, const RGBColor& BGColor, RootLayer *owner)
|
Workspace::Workspace(const uint32 colorspace, int32 ID, const RGBColor& BGColor, RootLayer *owner)
|
||||||
{
|
{
|
||||||
@@ -85,6 +86,8 @@ Workspace::Workspace(const uint32 colorspace, int32 ID, const RGBColor& BGColor,
|
|||||||
fDisplayTiming.flags=0;
|
fDisplayTiming.flags=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
Workspace::~Workspace(void)
|
Workspace::~Workspace(void)
|
||||||
{
|
{
|
||||||
ListData *toast;
|
ListData *toast;
|
||||||
@@ -102,6 +105,7 @@ Workspace::~Workspace(void)
|
|||||||
fFrontItem = NULL;
|
fFrontItem = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
/*
|
/*
|
||||||
Adds layer ptr to workspace's list of WinBorders. After the item is added a
|
Adds layer ptr to workspace's list of WinBorders. After the item is added a
|
||||||
*smart* search is performed to set the new front WinBorder. Of course,
|
*smart* search is performed to set the new front WinBorder. Of course,
|
||||||
@@ -144,6 +148,7 @@ bool Workspace::AddLayerPtr(WinBorder *layer)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
/*
|
/*
|
||||||
Removes a WinBorder from workspace's list. It DOES NOT delete it!
|
Removes a WinBorder from workspace's list. It DOES NOT delete it!
|
||||||
If this window was the front/focus one it calls SearchAndSetNew(Front/Focus)
|
If this window was the front/focus one it calls SearchAndSetNew(Front/Focus)
|
||||||
@@ -215,6 +220,8 @@ bool Workspace::RemoveLayerPtr(WinBorder *layer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
bool Workspace::HideSubsetWindows(WinBorder *layer)
|
bool Workspace::HideSubsetWindows(WinBorder *layer)
|
||||||
{
|
{
|
||||||
if(!layer)
|
if(!layer)
|
||||||
@@ -263,22 +270,30 @@ bool Workspace::HideSubsetWindows(WinBorder *layer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
WinBorder *Workspace::FocusLayer() const
|
WinBorder *Workspace::FocusLayer() const
|
||||||
{
|
{
|
||||||
return fFocusItem ? fFocusItem->layerPtr : NULL;
|
return fFocusItem ? fFocusItem->layerPtr : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
WinBorder *Workspace::FrontLayer() const
|
WinBorder *Workspace::FrontLayer() const
|
||||||
{
|
{
|
||||||
return fFrontItem? fFrontItem->layerPtr: NULL;
|
return fFrontItem? fFrontItem->layerPtr: NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
WinBorder *Workspace::GoToBottomItem(void)
|
WinBorder *Workspace::GoToBottomItem(void)
|
||||||
{
|
{
|
||||||
fCurrentItem = fBottomItem;
|
fCurrentItem = fBottomItem;
|
||||||
return fCurrentItem ? fCurrentItem->layerPtr : NULL;
|
return fCurrentItem ? fCurrentItem->layerPtr : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
WinBorder *Workspace::GoToUpperItem(void)
|
WinBorder *Workspace::GoToUpperItem(void)
|
||||||
{
|
{
|
||||||
if(fCurrentItem)
|
if(fCurrentItem)
|
||||||
@@ -290,12 +305,16 @@ WinBorder *Workspace::GoToUpperItem(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
WinBorder *Workspace::GoToTopItem(void)
|
WinBorder *Workspace::GoToTopItem(void)
|
||||||
{
|
{
|
||||||
fCurrentItem = fTopItem;
|
fCurrentItem = fTopItem;
|
||||||
return fCurrentItem ? fCurrentItem->layerPtr : NULL;
|
return fCurrentItem ? fCurrentItem->layerPtr : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
WinBorder *Workspace::GoToLowerItem(void)
|
WinBorder *Workspace::GoToLowerItem(void)
|
||||||
{
|
{
|
||||||
if(fCurrentItem)
|
if(fCurrentItem)
|
||||||
@@ -307,6 +326,8 @@ WinBorder *Workspace::GoToLowerItem(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
bool Workspace::GoToItem(WinBorder *layer)
|
bool Workspace::GoToItem(WinBorder *layer)
|
||||||
{
|
{
|
||||||
if(!layer)
|
if(!layer)
|
||||||
@@ -326,100 +347,7 @@ bool Workspace::GoToItem(WinBorder *layer)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
WinBorder *Workspace::SearchWinBorder(BPoint pt)
|
//----------------------------------------------------------------------------------
|
||||||
{
|
|
||||||
// TODO: implement correctly once you have clipping code working
|
|
||||||
|
|
||||||
// For the moment, take windows from front to back and see in which one 'pt' falls
|
|
||||||
WinBorder *target = NULL;
|
|
||||||
fOpLock.Lock();
|
|
||||||
|
|
||||||
for( WinBorder *wb = GoToBottomItem(); wb; wb = GoToUpperItem())
|
|
||||||
{
|
|
||||||
// wb->PrintToStream();
|
|
||||||
if(!wb->IsHidden() && wb->HasPoint(pt))
|
|
||||||
{
|
|
||||||
STRACE(("%s - SELECTED!\n", wb->GetName()));
|
|
||||||
target = wb;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fOpLock.Unlock();
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Workspace::Invalidate(void)
|
|
||||||
{
|
|
||||||
//TODO: Remove. Testing purposes only!
|
|
||||||
|
|
||||||
/* fOpLock.Lock();
|
|
||||||
if(fOwner->ActiveWorkspace() == this)
|
|
||||||
fOwner->FullInvalidate(fOwner->Bounds());
|
|
||||||
fOpLock.Unlock();*/
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Workspace::InsertItem(ListData *item, ListData *before)
|
|
||||||
{
|
|
||||||
// insert before one other item;
|
|
||||||
if(before)
|
|
||||||
{
|
|
||||||
if(before->upperItem)
|
|
||||||
before->upperItem->lowerItem = item;
|
|
||||||
item->upperItem = before->upperItem;
|
|
||||||
before->upperItem = item;
|
|
||||||
item->lowerItem = before;
|
|
||||||
|
|
||||||
// if we're inserting at top of the stack, change it accordingly.
|
|
||||||
if(fTopItem == before)
|
|
||||||
fTopItem = item;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// insert item at bottom.
|
|
||||||
item->upperItem = fBottomItem;
|
|
||||||
if(fBottomItem)
|
|
||||||
fBottomItem->lowerItem = item;
|
|
||||||
|
|
||||||
fBottomItem = item;
|
|
||||||
|
|
||||||
if(!fTopItem)
|
|
||||||
fTopItem = item;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Workspace::RemoveItem(ListData *item)
|
|
||||||
{
|
|
||||||
if(!item)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(fBottomItem == item)
|
|
||||||
fBottomItem = item->upperItem;
|
|
||||||
else
|
|
||||||
item->lowerItem->upperItem = item->upperItem;
|
|
||||||
|
|
||||||
if(fTopItem == item)
|
|
||||||
fTopItem = item->lowerItem;
|
|
||||||
else
|
|
||||||
item->upperItem->lowerItem = item->lowerItem;
|
|
||||||
|
|
||||||
// set all these to NULL to avoid confusion later.
|
|
||||||
|
|
||||||
item->upperItem = NULL;
|
|
||||||
item->lowerItem = NULL;
|
|
||||||
|
|
||||||
if(fFocusItem == item)
|
|
||||||
{
|
|
||||||
fFocusItem->layerPtr->HighlightDecorator(false);
|
|
||||||
fFocusItem = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fFrontItem == item)
|
|
||||||
fFrontItem = NULL;
|
|
||||||
|
|
||||||
if(fCurrentItem == item)
|
|
||||||
fCurrentItem = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ListData *Workspace::HasItem(ListData *item)
|
ListData *Workspace::HasItem(ListData *item)
|
||||||
{
|
{
|
||||||
@@ -431,6 +359,8 @@ ListData *Workspace::HasItem(ListData *item)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
ListData *Workspace::HasItem(WinBorder *layer)
|
ListData *Workspace::HasItem(WinBorder *layer)
|
||||||
{
|
{
|
||||||
for (ListData *item = fBottomItem; item != NULL; item = item->upperItem)
|
for (ListData *item = fBottomItem; item != NULL; item = item->upperItem)
|
||||||
@@ -440,6 +370,8 @@ ListData *Workspace::HasItem(WinBorder *layer)
|
|||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
/*
|
/*
|
||||||
This, also is a "smart" method. Firstly this funtionality was in
|
This, also is a "smart" method. Firstly this funtionality was in
|
||||||
SearchAndSetNewFront, but I've split it for reasons of clarity. Anyway,
|
SearchAndSetNewFront, but I've split it for reasons of clarity. Anyway,
|
||||||
@@ -453,7 +385,6 @@ ListData *Workspace::HasItem(WinBorder *layer)
|
|||||||
Other windows that need to be placed before it, *WILL* be placed by almost
|
Other windows that need to be placed before it, *WILL* be placed by almost
|
||||||
all code found in SearchAndSetNewFront
|
all code found in SearchAndSetNewFront
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ListData *Workspace::FindPlace(ListData *pref)
|
ListData *Workspace::FindPlace(ListData *pref)
|
||||||
{
|
{
|
||||||
// if we received a NULL value, we stil have to give 'front' state to some window...
|
// if we received a NULL value, we stil have to give 'front' state to some window...
|
||||||
@@ -608,6 +539,8 @@ ListData *Workspace::FindPlace(ListData *pref)
|
|||||||
|
|
||||||
return pref;
|
return pref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
/*
|
/*
|
||||||
This method is the key to correct window arangement
|
This method is the key to correct window arangement
|
||||||
With the help of FindPlace it correctly aranges windows. FindPlace, only
|
With the help of FindPlace it correctly aranges windows. FindPlace, only
|
||||||
@@ -616,7 +549,6 @@ ListData *Workspace::FindPlace(ListData *pref)
|
|||||||
about floating and modal windows.
|
about floating and modal windows.
|
||||||
It also cleverly selects the new FINAL front window.
|
It also cleverly selects the new FINAL front window.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void Workspace::SearchAndSetNewFront(WinBorder *preferred)
|
void Workspace::SearchAndSetNewFront(WinBorder *preferred)
|
||||||
{
|
{
|
||||||
STRACE(("*WS(%ld)::SASNF(%s)\n", ID(), preferred? preferred->GetName(): "NULL"));
|
STRACE(("*WS(%ld)::SASNF(%s)\n", ID(), preferred? preferred->GetName(): "NULL"));
|
||||||
@@ -1160,6 +1092,7 @@ void Workspace::SearchAndSetNewFront(WinBorder *preferred)
|
|||||||
STRACESTREAM();
|
STRACESTREAM();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
/*
|
/*
|
||||||
This method performs a simple opperation. It searched the new focus window
|
This method performs a simple opperation. It searched the new focus window
|
||||||
by walking from front to back, cheking for some things, until all variables
|
by walking from front to back, cheking for some things, until all variables
|
||||||
@@ -1246,6 +1179,8 @@ void Workspace::SearchAndSetNewFocus(WinBorder *preferred)
|
|||||||
fOpLock.Unlock();
|
fOpLock.Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
void Workspace::BringToFrontANormalWindow(WinBorder *layer)
|
void Workspace::BringToFrontANormalWindow(WinBorder *layer)
|
||||||
{
|
{
|
||||||
switch (layer->Window()->Feel())
|
switch (layer->Window()->Feel())
|
||||||
@@ -1285,6 +1220,8 @@ void Workspace::BringToFrontANormalWindow(WinBorder *layer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// This method moves a window to the back of its subset.
|
// This method moves a window to the back of its subset.
|
||||||
void Workspace::MoveToBack(WinBorder *newLast)
|
void Workspace::MoveToBack(WinBorder *newLast)
|
||||||
{
|
{
|
||||||
@@ -1405,26 +1342,35 @@ void Workspace::MoveToBack(WinBorder *newLast)
|
|||||||
STRACE((" this operation was not needed\n"));
|
STRACE((" this operation was not needed\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
void Workspace::SetLocalSpace(const uint32 colorspace)
|
void Workspace::SetLocalSpace(const uint32 colorspace)
|
||||||
{
|
{
|
||||||
fSpace = colorspace;
|
fSpace = colorspace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
uint32 Workspace::LocalSpace() const
|
uint32 Workspace::LocalSpace() const
|
||||||
{
|
{
|
||||||
return fSpace;
|
return fSpace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
void Workspace::SetBGColor(const RGBColor &c)
|
void Workspace::SetBGColor(const RGBColor &c)
|
||||||
{
|
{
|
||||||
fBGColor = c;
|
fBGColor = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
RGBColor Workspace::BGColor(void) const
|
RGBColor Workspace::BGColor(void) const
|
||||||
{
|
{
|
||||||
return fBGColor;
|
return fBGColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
/*!
|
/*!
|
||||||
\brief Retrieves settings from a container message passed to PutSettings
|
\brief Retrieves settings from a container message passed to PutSettings
|
||||||
\param A BMessage containing data from a PutSettings() call
|
\param A BMessage containing data from a PutSettings() call
|
||||||
@@ -1437,12 +1383,14 @@ void Workspace::GetSettings(const BMessage &msg)
|
|||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
//! Sets workspace settings to defaults
|
//! Sets workspace settings to defaults
|
||||||
void Workspace::GetDefaultSettings(void)
|
void Workspace::GetDefaultSettings(void)
|
||||||
{
|
{
|
||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
/*!
|
/*!
|
||||||
\brief Places the screen settings for the workspace in the passed BMessage
|
\brief Places the screen settings for the workspace in the passed BMessage
|
||||||
\param msg BMessage pointer to receive the settings
|
\param msg BMessage pointer to receive the settings
|
||||||
@@ -1465,6 +1413,7 @@ void Workspace::PutSettings(BMessage *msg, const int32 &index) const
|
|||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
/*!
|
/*!
|
||||||
\brief Places default settings for the workspace in the passed BMessage
|
\brief Places default settings for the workspace in the passed BMessage
|
||||||
\param msg BMessage pointer to receive the settings
|
\param msg BMessage pointer to receive the settings
|
||||||
@@ -1475,7 +1424,8 @@ void Workspace::PutDefaultSettings(BMessage *msg, const int32 &index)
|
|||||||
// TODO: Implement
|
// TODO: Implement
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debug methods
|
//----------------------------------------------------------------------------------
|
||||||
|
// Debug method
|
||||||
void Workspace::PrintToStream() const
|
void Workspace::PrintToStream() const
|
||||||
{
|
{
|
||||||
printf("\nWorkspace %ld hierarchy shown from back to front:\n", fID);
|
printf("\nWorkspace %ld hierarchy shown from back to front:\n", fID);
|
||||||
@@ -1509,6 +1459,8 @@ void Workspace::PrintToStream() const
|
|||||||
// printf("Bottom Layer:\t%s\n", fBottomItem? fBottomItem->layerPtr->GetName(): "NULL");
|
// printf("Bottom Layer:\t%s\n", fBottomItem? fBottomItem->layerPtr->GetName(): "NULL");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// Debug method
|
||||||
void Workspace::PrintItem(ListData *item) const
|
void Workspace::PrintItem(ListData *item) const
|
||||||
{
|
{
|
||||||
printf("ListData members:\n");
|
printf("ListData members:\n");
|
||||||
@@ -1523,3 +1475,73 @@ void Workspace::PrintItem(ListData *item) const
|
|||||||
printf("NULL item\n");
|
printf("NULL item\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
// PRIVATE
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void Workspace::InsertItem(ListData *item, ListData *before)
|
||||||
|
{
|
||||||
|
// insert before one other item;
|
||||||
|
if(before)
|
||||||
|
{
|
||||||
|
if(before->upperItem)
|
||||||
|
before->upperItem->lowerItem = item;
|
||||||
|
item->upperItem = before->upperItem;
|
||||||
|
before->upperItem = item;
|
||||||
|
item->lowerItem = before;
|
||||||
|
|
||||||
|
// if we're inserting at top of the stack, change it accordingly.
|
||||||
|
if(fTopItem == before)
|
||||||
|
fTopItem = item;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// insert item at bottom.
|
||||||
|
item->upperItem = fBottomItem;
|
||||||
|
if(fBottomItem)
|
||||||
|
fBottomItem->lowerItem = item;
|
||||||
|
|
||||||
|
fBottomItem = item;
|
||||||
|
|
||||||
|
if(!fTopItem)
|
||||||
|
fTopItem = item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void Workspace::RemoveItem(ListData *item)
|
||||||
|
{
|
||||||
|
if(!item)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(fBottomItem == item)
|
||||||
|
fBottomItem = item->upperItem;
|
||||||
|
else
|
||||||
|
item->lowerItem->upperItem = item->upperItem;
|
||||||
|
|
||||||
|
if(fTopItem == item)
|
||||||
|
fTopItem = item->lowerItem;
|
||||||
|
else
|
||||||
|
item->upperItem->lowerItem = item->lowerItem;
|
||||||
|
|
||||||
|
// set all these to NULL to avoid confusion later.
|
||||||
|
|
||||||
|
item->upperItem = NULL;
|
||||||
|
item->lowerItem = NULL;
|
||||||
|
|
||||||
|
if(fFocusItem == item)
|
||||||
|
{
|
||||||
|
fFocusItem->layerPtr->HighlightDecorator(false);
|
||||||
|
fFocusItem = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(fFrontItem == item)
|
||||||
|
fFrontItem = NULL;
|
||||||
|
|
||||||
|
if(fCurrentItem == item)
|
||||||
|
fCurrentItem = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------
|
||||||
@@ -66,9 +66,6 @@ public:
|
|||||||
WinBorder *GoToLowerItem(void);
|
WinBorder *GoToLowerItem(void);
|
||||||
bool GoToItem(WinBorder *layer);
|
bool GoToItem(WinBorder *layer);
|
||||||
|
|
||||||
WinBorder *SearchWinBorder(BPoint pt);
|
|
||||||
void Invalidate(void);
|
|
||||||
|
|
||||||
void SetLocalSpace(const uint32 colorspace);
|
void SetLocalSpace(const uint32 colorspace);
|
||||||
uint32 LocalSpace(void) const;
|
uint32 LocalSpace(void) const;
|
||||||
|
|
||||||
@@ -92,13 +89,13 @@ public:
|
|||||||
void SearchAndSetNewFocus(WinBorder *preferred);
|
void SearchAndSetNewFocus(WinBorder *preferred);
|
||||||
void BringToFrontANormalWindow(WinBorder *layer);
|
void BringToFrontANormalWindow(WinBorder *layer);
|
||||||
|
|
||||||
ListData *HasItem(ListData *item);
|
|
||||||
ListData *HasItem(WinBorder *layer);
|
ListData *HasItem(WinBorder *layer);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void InsertItem(ListData *item, ListData *before);
|
void InsertItem(ListData *item, ListData *before);
|
||||||
void RemoveItem(ListData *item);
|
void RemoveItem(ListData *item);
|
||||||
|
ListData *HasItem(ListData *item);
|
||||||
|
|
||||||
ListData *FindPlace(ListData *pref);
|
ListData *FindPlace(ListData *pref);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user