AppServer.cpp: removed a memory leak from new_decorator

decorators now set appropriate fonts for their context
WinBorder: tweaked some debug output settings
Layer: tweaked some debug output settings
PicturePlayer: added some tentative code and notes for escapements in DrawString case for player
CursorManager: update to resemble OT style
RootLayer: removed testing-purposes-only Draw() function
	Implemented methods to read in workspace data
Workspace: Janitorial work
	Added methods for packing and unpacking settings
	Added some members for holding basic settings
Desktop: Moved workspace data functions to RootLayer
Other files: Janitorial work


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8172 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm 2004-06-26 02:15:48 +00:00
parent 557b47b2d0
commit a596e677c7
16 changed files with 1301 additions and 998 deletions

View File

@ -821,7 +821,6 @@ Decorator *new_decorator(BRect rect, const char *title, int32 wlook, int32 wfeel
{
Decorator *dec=NULL;
dec=new DefaultDecorator(rect,wlook,wfeel,wflags);
if(!app_server->make_decorator)
dec=new DefaultDecorator(rect,wlook,wfeel,wflags);
else
@ -830,7 +829,6 @@ Decorator *new_decorator(BRect rect, const char *title, int32 wlook, int32 wfeel
gui_colorset.Lock();
dec->SetDriver(ddriver);
dec->SetColors(gui_colorset);
dec->SetFont(fontserver->GetSystemPlain());
dec->SetTitle(title);
gui_colorset.Unlock();

View File

@ -42,47 +42,47 @@ CursorManager *cursormanager;
//! Initializes the CursorManager
CursorManager::CursorManager(void)
{
_cursorlist=new BList(0);
fCursorList=new BList(0);
// Error code for AddCursor
_tokenizer.ExcludeValue(B_ERROR);
fTokenizer.ExcludeValue(B_ERROR);
// Set system cursors to "unassigned"
ServerCursor *cdefault=new ServerCursor(default_cursor_data);
AddCursor(cdefault);
_defaultcsr=cdefault;
fDefaultCursor=cdefault;
ServerCursor *ctext=new ServerCursor(default_text_data);
AddCursor(ctext);
_textcsr=ctext;
fTextCursor=ctext;
ServerCursor *cmove=new ServerCursor(default_move_data);
AddCursor(cmove);
_movecsr=cmove;
fMoveCursor=cmove;
ServerCursor *cdrag=new ServerCursor(default_drag_data);
AddCursor(cdrag);
_dragcsr=cdrag;
fDragCursor=cdrag;
ServerCursor *cresize=new ServerCursor(default_resize_data);
AddCursor(cresize);
_resizecsr=cresize;
fResizeCursor=cresize;
ServerCursor *cresizenwse=new ServerCursor(default_resize_nwse_data);
AddCursor(cresizenwse);
_resize_nwse_csr=cresizenwse;
fNWSECursor=cresizenwse;
ServerCursor *cresizenesw=new ServerCursor(default_resize_nesw_data);
AddCursor(cresizenesw);
_resize_nesw_csr=cresizenesw;
fNESWCursor=cresizenesw;
ServerCursor *cresizens=new ServerCursor(default_resize_ns_data);
AddCursor(cresizens);
_resize_ns_csr=cresizens;
fNSCursor=cresizens;
ServerCursor *cresizeew=new ServerCursor(default_resize_ew_data);
AddCursor(cresizeew);
_resize_ew_csr=cresizeew;
fEWCursor=cresizeew;
}
@ -90,14 +90,14 @@ CursorManager::CursorManager(void)
CursorManager::~CursorManager(void)
{
ServerCursor *temp;
for(int32 i=0; i<_cursorlist->CountItems();i++)
for(int32 i=0; i<fCursorList->CountItems();i++)
{
temp=(ServerCursor*)_cursorlist->ItemAt(i);
temp=(ServerCursor*)fCursorList->ItemAt(i);
if(temp)
delete temp;
}
_cursorlist->MakeEmpty();
delete _cursorlist;
fCursorList->MakeEmpty();
delete fCursorList;
// Note that it is not necessary to remove and delete the system
// cursors. These cursors are kept in the list with a NULL application
@ -117,8 +117,8 @@ int32 CursorManager::AddCursor(ServerCursor *sc)
return B_ERROR;
Lock();
_cursorlist->AddItem(sc);
int32 value=_tokenizer.GetToken();
fCursorList->AddItem(sc);
int32 value=fTokenizer.GetToken();
sc->_token=value;
Unlock();
@ -136,12 +136,12 @@ void CursorManager::DeleteCursor(int32 token)
Lock();
ServerCursor *temp;
for(int32 i=0; i<_cursorlist->CountItems();i++)
for(int32 i=0; i<fCursorList->CountItems();i++)
{
temp=(ServerCursor*)_cursorlist->ItemAt(i);
temp=(ServerCursor*)fCursorList->ItemAt(i);
if(temp && temp->_token==token)
{
_cursorlist->RemoveItem(i);
fCursorList->RemoveItem(i);
delete temp;
break;
}
@ -161,13 +161,13 @@ void CursorManager::RemoveAppCursors(const char *signature)
Lock();
ServerCursor *temp;
for(int32 i=0; i<_cursorlist->CountItems();i++)
for(int32 i=0; i<fCursorList->CountItems();i++)
{
temp=(ServerCursor*)_cursorlist->ItemAt(i);
temp=(ServerCursor*)fCursorList->ItemAt(i);
if(temp && temp->GetAppSignature() &&
strcmp(signature, temp->GetAppSignature())==0)
{
_cursorlist->RemoveItem(i);
fCursorList->RemoveItem(i);
delete temp;
break;
}
@ -212,12 +212,12 @@ void CursorManager::ObscureCursor(void)
void CursorManager::SetCursor(int32 token)
{
Lock();
ServerCursor *c=_FindCursor(token);
ServerCursor *c=FindCursor(token);
if(c)
{
DisplayDriver *driver = desktop->ActiveScreen()->DDriver();
driver->SetCursor(c);
_current_which=B_CURSOR_OTHER;
fCurrentWhich=B_CURSOR_OTHER;
}
Unlock();
}
@ -231,56 +231,56 @@ void CursorManager::SetCursor(cursor_which which)
{
case B_CURSOR_DEFAULT:
{
driver->SetCursor(_defaultcsr);
_current_which=which;
driver->SetCursor(fDefaultCursor);
fCurrentWhich=which;
break;
}
case B_CURSOR_TEXT:
{
driver->SetCursor(_textcsr);
_current_which=which;
driver->SetCursor(fTextCursor);
fCurrentWhich=which;
break;
}
case B_CURSOR_MOVE:
{
driver->SetCursor(_movecsr);
_current_which=which;
driver->SetCursor(fMoveCursor);
fCurrentWhich=which;
break;
}
case B_CURSOR_DRAG:
{
driver->SetCursor(_dragcsr);
_current_which=which;
driver->SetCursor(fDragCursor);
fCurrentWhich=which;
break;
}
case B_CURSOR_RESIZE:
{
driver->SetCursor(_resizecsr);
_current_which=which;
driver->SetCursor(fResizeCursor);
fCurrentWhich=which;
break;
}
case B_CURSOR_RESIZE_NWSE:
{
driver->SetCursor(_resize_nwse_csr);
_current_which=which;
driver->SetCursor(fNWSECursor);
fCurrentWhich=which;
break;
}
case B_CURSOR_RESIZE_NESW:
{
driver->SetCursor(_resize_nesw_csr);
_current_which=which;
driver->SetCursor(fNESWCursor);
fCurrentWhich=which;
break;
}
case B_CURSOR_RESIZE_NS:
{
driver->SetCursor(_resize_ns_csr);
_current_which=which;
driver->SetCursor(fNSCursor);
fCurrentWhich=which;
break;
}
case B_CURSOR_RESIZE_EW:
{
driver->SetCursor(_resize_ew_csr);
_current_which=which;
driver->SetCursor(fEWCursor);
fCurrentWhich=which;
break;
}
default:
@ -309,65 +309,65 @@ void CursorManager::SetCursorSet(const char *path)
if(cs.FindCursor(B_CURSOR_DEFAULT,&csr)==B_OK)
{
if(_defaultcsr)
delete _defaultcsr;
_defaultcsr=csr;
if(fDefaultCursor)
delete fDefaultCursor;
fDefaultCursor=csr;
}
if(cs.FindCursor(B_CURSOR_TEXT,&csr)==B_OK)
{
if(_textcsr)
delete _textcsr;
_textcsr=csr;
if(fTextCursor)
delete fTextCursor;
fTextCursor=csr;
}
if(cs.FindCursor(B_CURSOR_MOVE,&csr)==B_OK)
{
if(_movecsr)
delete _movecsr;
_movecsr=csr;
if(fMoveCursor)
delete fMoveCursor;
fMoveCursor=csr;
}
if(cs.FindCursor(B_CURSOR_DRAG,&csr)==B_OK)
{
if(_dragcsr)
delete _dragcsr;
_dragcsr=csr;
if(fDragCursor)
delete fDragCursor;
fDragCursor=csr;
}
if(cs.FindCursor(B_CURSOR_RESIZE,&csr)==B_OK)
{
if(_resizecsr)
delete _resizecsr;
_resizecsr=csr;
if(fResizeCursor)
delete fResizeCursor;
fResizeCursor=csr;
}
if(cs.FindCursor(B_CURSOR_RESIZE_NWSE,&csr)==B_OK)
{
if(_resize_nwse_csr)
delete _resize_nwse_csr;
_resize_nwse_csr=csr;
if(fNWSECursor)
delete fNWSECursor;
fNWSECursor=csr;
}
if(cs.FindCursor(B_CURSOR_RESIZE_NESW,&csr)==B_OK)
{
if(_resize_nesw_csr)
delete _resize_nesw_csr;
_resize_nesw_csr=csr;
if(fNESWCursor)
delete fNESWCursor;
fNESWCursor=csr;
}
if(cs.FindCursor(B_CURSOR_RESIZE_NS,&csr)==B_OK)
{
if(_resize_ns_csr)
delete _resize_ns_csr;
_resize_ns_csr=csr;
if(fNSCursor)
delete fNSCursor;
fNSCursor=csr;
}
if(cs.FindCursor(B_CURSOR_RESIZE_EW,&csr)==B_OK)
{
if(_resize_ew_csr)
delete _resize_ew_csr;
_resize_ew_csr=csr;
if(fEWCursor)
delete fEWCursor;
fEWCursor=csr;
}
Unlock();
@ -389,47 +389,47 @@ ServerCursor *CursorManager::GetCursor(cursor_which which)
{
case B_CURSOR_DEFAULT:
{
temp=_defaultcsr;
temp=fDefaultCursor;
break;
}
case B_CURSOR_TEXT:
{
temp=_textcsr;
temp=fTextCursor;
break;
}
case B_CURSOR_MOVE:
{
temp=_movecsr;
temp=fMoveCursor;
break;
}
case B_CURSOR_DRAG:
{
temp=_dragcsr;
temp=fDragCursor;
break;
}
case B_CURSOR_RESIZE:
{
temp=_resizecsr;
temp=fResizeCursor;
break;
}
case B_CURSOR_RESIZE_NWSE:
{
temp=_resize_nwse_csr;
temp=fNWSECursor;
break;
}
case B_CURSOR_RESIZE_NESW:
{
temp=_resize_nesw_csr;
temp=fNESWCursor;
break;
}
case B_CURSOR_RESIZE_NS:
{
temp=_resize_ns_csr;
temp=fNSCursor;
break;
}
case B_CURSOR_RESIZE_EW:
{
temp=_resize_ew_csr;
temp=fEWCursor;
break;
}
default:
@ -449,7 +449,7 @@ cursor_which CursorManager::GetCursorWhich(void)
cursor_which temp;
Lock();
temp=_current_which;
temp=fCurrentWhich;
Unlock();
return temp;
}
@ -468,7 +468,7 @@ void CursorManager::ChangeCursor(cursor_which which, int32 token)
Lock();
// Find the cursor, based on the token
ServerCursor *cursor=_FindCursor(token);
ServerCursor *cursor=FindCursor(token);
// Did we find a cursor with this token?
if(!cursor)
@ -482,111 +482,111 @@ void CursorManager::ChangeCursor(cursor_which which, int32 token)
{
case B_CURSOR_DEFAULT:
{
if(_defaultcsr)
delete _defaultcsr;
if(fDefaultCursor)
delete fDefaultCursor;
_defaultcsr=cursor;
fDefaultCursor=cursor;
if(cursor->GetAppSignature())
cursor->SetAppSignature("");
_cursorlist->RemoveItem(cursor);
fCursorList->RemoveItem(cursor);
break;
}
case B_CURSOR_TEXT:
{
if(_textcsr)
delete _textcsr;
if(fTextCursor)
delete fTextCursor;
_textcsr=cursor;
fTextCursor=cursor;
if(cursor->GetAppSignature())
cursor->SetAppSignature("");
_cursorlist->RemoveItem(cursor);
fCursorList->RemoveItem(cursor);
break;
}
case B_CURSOR_MOVE:
{
if(_movecsr)
delete _movecsr;
if(fMoveCursor)
delete fMoveCursor;
_movecsr=cursor;
fMoveCursor=cursor;
if(cursor->GetAppSignature())
cursor->SetAppSignature("");
_cursorlist->RemoveItem(cursor);
fCursorList->RemoveItem(cursor);
break;
}
case B_CURSOR_DRAG:
{
if(_dragcsr)
delete _dragcsr;
if(fDragCursor)
delete fDragCursor;
_dragcsr=cursor;
fDragCursor=cursor;
if(cursor->GetAppSignature())
cursor->SetAppSignature("");
_cursorlist->RemoveItem(cursor);
fCursorList->RemoveItem(cursor);
break;
}
case B_CURSOR_RESIZE:
{
if(_resizecsr)
delete _resizecsr;
if(fResizeCursor)
delete fResizeCursor;
_resizecsr=cursor;
fResizeCursor=cursor;
if(cursor->GetAppSignature())
cursor->SetAppSignature("");
_cursorlist->RemoveItem(cursor);
fCursorList->RemoveItem(cursor);
break;
}
case B_CURSOR_RESIZE_NWSE:
{
if(_resize_nwse_csr)
delete _resize_nwse_csr;
if(fNWSECursor)
delete fNWSECursor;
_resize_nwse_csr=cursor;
fNWSECursor=cursor;
if(cursor->GetAppSignature())
cursor->SetAppSignature("");
_cursorlist->RemoveItem(cursor);
fCursorList->RemoveItem(cursor);
break;
}
case B_CURSOR_RESIZE_NESW:
{
if(_resize_nesw_csr)
delete _resize_nesw_csr;
if(fNESWCursor)
delete fNESWCursor;
_resize_nesw_csr=cursor;
fNESWCursor=cursor;
if(cursor->GetAppSignature())
cursor->SetAppSignature("");
_cursorlist->RemoveItem(cursor);
fCursorList->RemoveItem(cursor);
break;
}
case B_CURSOR_RESIZE_NS:
{
if(_resize_ns_csr)
delete _resize_ns_csr;
if(fNSCursor)
delete fNSCursor;
_resize_ns_csr=cursor;
fNSCursor=cursor;
if(cursor->GetAppSignature())
cursor->SetAppSignature("");
_cursorlist->RemoveItem(cursor);
fCursorList->RemoveItem(cursor);
break;
}
case B_CURSOR_RESIZE_EW:
{
if(_resize_ew_csr)
delete _resize_ew_csr;
if(fEWCursor)
delete fEWCursor;
_resize_ew_csr=cursor;
fEWCursor=cursor;
if(cursor->GetAppSignature())
cursor->SetAppSignature("");
_cursorlist->RemoveItem(cursor);
fCursorList->RemoveItem(cursor);
break;
}
default:
@ -601,12 +601,12 @@ void CursorManager::ChangeCursor(cursor_which which, int32 token)
\param token ID of the cursor to find
\return The cursor or NULL if not found
*/
ServerCursor *CursorManager::_FindCursor(int32 token)
ServerCursor *CursorManager::FindCursor(int32 token)
{
ServerCursor *temp;
for(int32 i=0; i<_cursorlist->CountItems();i++)
for(int32 i=0; i<fCursorList->CountItems();i++)
{
temp=(ServerCursor*)_cursorlist->ItemAt(i);
temp=(ServerCursor*)fCursorList->ItemAt(i);
if(temp && temp->_token==token)
return temp;
}

View File

@ -62,22 +62,22 @@ public:
void ChangeCursor(cursor_which which, int32 token);
void SetDefaults(void);
private:
ServerCursor *_FindCursor(int32 token);
ServerCursor *FindCursor(int32 token);
BList *_cursorlist;
TokenHandler _tokenizer;
BList *fCursorList;
TokenHandler fTokenizer;
// System cursor members
ServerCursor *_defaultcsr,
*_textcsr,
*_movecsr,
*_dragcsr,
*_resizecsr,
*_resize_nwse_csr,
*_resize_nesw_csr,
*_resize_ns_csr,
*_resize_ew_csr;
cursor_which _current_which;
ServerCursor *fDefaultCursor,
*fTextCursor,
*fMoveCursor,
*fDragCursor,
*fResizeCursor,
*fNWSECursor,
*fNESWCursor,
*fNSCursor,
*fEWCursor;
cursor_which fCurrentWhich;
};
extern CursorManager *cursormanager;

View File

@ -49,20 +49,22 @@ Decorator::Decorator(BRect rect, int32 wlook, int32 wfeel, int32 wflags)
_title_string=new BString;
_driver=NULL;
/// xxx.Set(0,0,1,1) produces a rectangle 2 pixels wide, that
// WILL be drawn on screen. We so not want that... so...
// [ A BRect when instantiated is made invalid, so, no need for: ]
/* _closerect.Set( 0, 0, -1, -1);
/// xxx.Set(0,0,1,1) produces a rectangle 2 pixels wide, that
// WILL be drawn on screen. We so not want that... so...
// [ A BRect when instantiated is made invalid, so, no need for: ]
/*
_closerect.Set( 0, 0, -1, -1);
_zoomrect.Set( 0, 0, -1, -1);
_minimizerect.Set( 0, 0, -1, -1);
_resizerect.Set( 0, 0, -1, -1);
*/
_frame=rect;
// !!! rect rectangle MUST remain intact - it is top_view's area !!!
// Decorator drawing MUST be done arround that area !!!
// rect rectangle MUST remain intact - it is top_view's area
// Decorator drawing MUST be done arround that area
//_tabrect.Set(rect.left,rect.top,rect.right, rect.top+((rect.bottom-rect.top)/4));
// [ A BRect when instantiated is made invalid, so, no need for: ]
/* _tabrect.Set( 0, 0, -1, -1 ); */
// [ A BRect when instantiated is made invalid, so, no need for: ]
// _tabrect.Set( 0, 0, -1, -1 );
_look=wlook;
_feel=wfeel;
@ -594,7 +596,3 @@ void Decorator::_DoLayout(void)
{
}
/*
@log
* changed SetFont to acomodate(eng?) with LayerData's 'font' member witch is now allocated on stack.
*/

View File

@ -34,6 +34,7 @@
#include "RGBColor.h"
#include "RectUtils.h"
#include <stdio.h>
#include "FontServer.h"
//#define USE_VIEW_FILL_HACK
@ -52,7 +53,12 @@ DefaultDecorator::DefaultDecorator(BRect rect, int32 wlook, int32 wfeel, int32 w
taboffset=0;
titlepixelwidth=0;
SetFont(fontserver->GetSystemBold());
_drawdata.font.SetSize(14);
_drawdata.font.SetFlags(B_FORCE_ANTIALIASING);
_drawdata.font.SetSpacing(B_STRING_SPACING);
framecolors=new RGBColor[6];
framecolors[0].SetColor(152,152,152);
framecolors[1].SetColor(255,255,255);
@ -60,7 +66,9 @@ DefaultDecorator::DefaultDecorator(BRect rect, int32 wlook, int32 wfeel, int32 w
framecolors[3].SetColor(136,136,136);
framecolors[4].SetColor(152,152,152);
framecolors[5].SetColor(96,96,96);
// Set appropriate colors based on the current focus value. In this case, each decorator
// defaults to not having the focus.
_SetFocus();
@ -365,7 +373,7 @@ void DefaultDecorator::_DrawTitle(BRect r)
titlestr+="...";
titlecount+=2;
}
// The text position needs tweaked when working as a floating window because the closerect placement
// is a little different. If it isn't moved, title placement looks really funky
if(_look==B_FLOATING_WINDOW_LOOK)

View File

@ -199,8 +199,8 @@ void Desktop::SetActiveRootLayer(RootLayer* rl)
fActiveRootLayer = rl;
// TODO: fix!!!!!!!!!!!!!!!!!!!!!!!! or not?
// also set the new front and focus
// TODO: fix... or not?
// also set the new front and focus
// SetFrontWinBorder(fActiveRootLayer->ActiveWorkspace()->FrontLayer());
// SetFocusWinBorder(fActiveRootLayer->ActiveWorkspace()->FocusLayer());
@ -362,7 +362,7 @@ WinBorder* Desktop::FocusWinBorder(void) const
//---------------------------------------------------------------------------
void Desktop::MouseEventHandler(PortMessage *msg)
{
// TODO: locking mechanism needs SERIOUS rethought!!!!
// TODO: locking mechanism needs SERIOUS rethought
switch(msg->Code())
{
case B_MOUSE_DOWN:
@ -420,7 +420,7 @@ void Desktop::MouseEventHandler(PortMessage *msg)
invalidRegion.Include(&(activeFocus->fFull));
invalidRegion.Include(&(activeFocus->fTopLayer->fFull));
activeFocus->fParent->FullInvalidate(invalidRegion);
// TODO: this is a hack!!! Should be something like this:
// TODO: this is a hack! Should be something like this:
// void Layer::RebuildAndForceRedraw(invalidReg, target){
// BPoint pt(0,0);
// StartRebuildRegions(invalidRegion, NULL, B_LAYER_NONE, pt);
@ -875,19 +875,6 @@ mode_mouse Desktop::FFMouseMode(void) const
return fMouseMode;
}
bool Desktop::ReadWorkspaceData(void)
{
// TODO: implement
STRACE(("Desktop::ReadWorkspaceData unimplemented\n"));
return true;
}
void Desktop::SaveWorkspaceData(void)
{
// TODO: implement
STRACE(("Desktop::ReadWorkspaceData unimplemented\n"));
}
void Desktop::RemoveSubsetWindow(WinBorder* wb)
{
WinBorder *winBorder = NULL;

View File

@ -54,31 +54,31 @@ public:
// Methods for multiple monitors.
Screen *ScreenAt(int32 index) const;
int32 ScreenCount(void) const;
Screen* ActiveScreen(void) const;
Screen *ActiveScreen(void) const;
void SetActiveRootLayerByIndex(int32 listIndex);
void SetActiveRootLayer(RootLayer* rl);
RootLayer* RootLayerAt(int32 index);
RootLayer* ActiveRootLayer(void) const;
void SetActiveRootLayer(RootLayer *rl);
RootLayer *RootLayerAt(int32 index);
RootLayer *ActiveRootLayer(void) const;
int32 ActiveRootLayerIndex(void) const;
int32 CountRootLayers(void) const;
DisplayDriver* GetDisplayDriver(void) const;
DisplayDriver *GetDisplayDriver(void) const;
// Methods for layer(WinBorder) manipulation.
void AddWinBorder(WinBorder* winBorder);
void RemoveWinBorder(WinBorder* winBorder);
bool HasWinBorder(WinBorder* winBorder);
void SetFrontWinBorder(WinBorder* winBorder);
void SetFocusWinBorder(WinBorder* winBorder);
WinBorder* FrontWinBorder(void) const;
WinBorder* FocusWinBorder(void) const;
void AddWinBorder(WinBorder *winBorder);
void RemoveWinBorder(WinBorder *winBorder);
bool HasWinBorder(WinBorder *winBorder);
void SetFrontWinBorder(WinBorder *winBorder);
void SetFocusWinBorder(WinBorder *winBorder);
WinBorder *FrontWinBorder(void) const;
WinBorder *FocusWinBorder(void) const;
// Input related methods
void MouseEventHandler(PortMessage *msg);
void KeyboardEventHandler(PortMessage *msg);
void SetDragMessage(BMessage* msg);
BMessage* DragMessage(void) const;
void SetDragMessage(BMessage *msg);
BMessage *DragMessage(void) const;
// Methods for various desktop stuff handled by the server
void SetScrollBarInfo(const scroll_bar_info &info);
@ -93,16 +93,13 @@ public:
void SetFFMouseMode(const mode_mouse &value);
mode_mouse FFMouseMode(void) const;
bool ReadWorkspaceData(void);
void SaveWorkspaceData(void);
// Debugging methods
void PrintToStream(void);
void PrintVisibleInRootLayerNo(int32 no);
// "Private" to app_server :-) - means they should not be used very much
void RemoveSubsetWindow(WinBorder* wb);
WinBorder* FindWinBorderByServerWindowTokenAndTeamID(int32 token, team_id teamID);
void RemoveSubsetWindow(WinBorder *wb);
WinBorder *FindWinBorderByServerWindowTokenAndTeamID(int32 token, team_id teamID);
BLocker fGeneralLock;
BLocker fLayerLock;
@ -112,16 +109,16 @@ private:
BMessage *fDragMessage;
BList fRootLayerList;
RootLayer* fActiveRootLayer;
WinBorder* fFrontWinBorder;
WinBorder* fFocusWinBorder;
WinBorder* fMouseTarget;
RootLayer *fActiveRootLayer;
WinBorder *fFrontWinBorder;
WinBorder *fFocusWinBorder;
WinBorder *fMouseTarget;
BList fScreenList;
// '1' or 'n' Screen(s). Not sure it's needed though.
int32 fScreenMode;
Screen* fActiveScreen;
Screen *fActiveScreen;
scroll_bar_info fScrollBarInfo;
menu_info fMenuInfo;
@ -130,6 +127,6 @@ private:
int32 fScreenShotIndex;
};
extern Desktop* desktop;
extern Desktop *desktop;
#endif // _DESKTOP_H_

View File

@ -378,8 +378,8 @@ void Layer::FullInvalidate(const BRegion& region)
{
STRACE(("Layer(%s)::FullInvalidate():\n", GetName()));
#ifdef DEBUG_LAYER
region.PrintToStream();
printf("\n");
region.PrintToStream();
printf("\n");
#endif
BPoint pt(0,0);
@ -394,8 +394,8 @@ void Layer::Invalidate(const BRegion& region)
{
STRACE(("Layer(%s)::Invalidate():\n", GetName()));
#ifdef DEBUG_LAYER
region.PrintToStream();
printf("\n");
region.PrintToStream();
printf("\n");
#endif
gRedrawReg = region;
@ -440,7 +440,7 @@ void Layer::RequestDraw(const BRegion &reg, Layer *startFrom)
Draw(fUpdateReg.Frame());
fDriver->ConstrainClippingRegion(NULL);
// TODO: (WARNING!): For the Update code is MUST NOT be emptied!!!
// TODO: WARNING: For the Update code is MUST NOT be emptied
fUpdateReg.MakeEmpty();
}
}
@ -465,9 +465,11 @@ void Layer::RequestDraw(const BRegion &reg, Layer *startFrom)
void Layer::Draw(const BRect &r)
{
// TODO/NOTE: this should be an empty method! the next lines are for testing only
printf("Layer::Draw\n");
r.PrintToStream();
STRACE(("Layer::Draw() Called\n"));
#ifdef DEBUG_LAYER
printf("Layer::Draw: ");
r.PrintToStream();
#endif
/*
RGBColor col(152,102,51);
fDriver->FillRect(fUpdateReg.Frame(), col);
@ -547,7 +549,7 @@ void Layer::RebuildFullRegion( )
else
fFull.Set( fFrame );
// TODO: restrict to screen coordinates!!!
// TODO: restrict to screen coordinates
// TODO: Convert to screen coordinates!
LayerData *ld;
ld = fLayerData;
@ -942,7 +944,6 @@ void Layer::MoveBy(float x, float y)
BRect rect(fFull.Frame().OffsetByCopy(pt));
fParent->StartRebuildRegions(BRegion(rect), this, B_LAYER_MOVE, pt);
fDriver->CopyRegionList(&gCopyRegList, &gCopyList, gCopyRegList.CountItems(), &fFullVisible);
fParent->Redraw(gRedrawReg, this);

View File

@ -224,11 +224,14 @@ status_t PicturePlayer::Play(int32 tableEntries,void *userData, LayerData *d)
char *string = new char[len + 1];
GetData(string, len);
string[len] = '\0';
// float deltax = GetFloat();
// float deltay = GetFloat();
float deltax = GetFloat();
float deltay = GetFloat();
// TODO: The deltas given are escapements. Find out how they translate into
// escapement_delta units.
// TODO: The deltas given are escapements. They seem to be called deltax and deltay
// despite the fact that they are space and non-space escapements. Find out which is which when possible.
// My best guess is that deltax corresponds to escapement_delta.nonspace.
fldata.edelta.nonspace=deltax;
fldata.edelta.space=deltay;
fdriver->DrawString(string,len,fldata.penlocation,&fldata);
delete string;

View File

@ -30,6 +30,8 @@
#include <stdio.h>
#include <Window.h>
#include <List.h>
#include <Message.h>
#include <File.h>
#include "Globals.h"
#include "RootLayer.h"
@ -40,6 +42,7 @@
#include "ServerWindow.h"
#include "ServerApp.h"
#include "Desktop.h"
#include "ServerConfig.h"
#include "FMWList.h"
#include "DisplayDriver.h"
@ -66,6 +69,10 @@ RootLayer::RootLayer(const char *name, int32 workspaceCount,
fRows = 0;
fColumns = 0;
// TODO: this should eventually be replaced by a method to convert the monitor
// number to an index in the name, i.e. workspace_settings_1 for screen #1
ReadWorkspaceData(WORKSPACE_DATA_LIST);
// TODO: read these 3 from a configuration file.
fScreenXResolution = 0;
fScreenYResolution = 0;
@ -74,7 +81,6 @@ RootLayer::RootLayer(const char *name, int32 workspaceCount,
fViewToken = 0; // is this used for WinBorders?
fHidden = false;
SetWorkspaceCount(workspaceCount);
}
RootLayer::~RootLayer()
@ -82,84 +88,6 @@ RootLayer::~RootLayer()
// RootLayer object just uses Screen objects, it is not allowed to delete them.
}
void RootLayer::Draw(const BRect &r)
{
// REMOVEME: This method is here because of DisplayDriver testing ONLY.
// It should be removed when testing is finished
STRACE(("*RootLayer(%s)::Draw(r)\n", GetName()));
RGBColor c(51,102,152);
fDriver->FillRect(r, c);
STRACE(("#RootLayer(%s)::Draw(r) END\n", GetName()));
#ifdef DISPLAYDRIVER_TEST_HACK
DisplayDriver *_driver = fDriver;
int8 pattern[8];
int8 pattern2[8];
memset(pattern,255,8);
memset(pattern2,128+64+32+16,8);
BRect r1(100,100,1500,1100);
BPoint pts[4];
pts[0].x = 200;
pts[0].y = 200;
pts[1].x = 400;
pts[1].y = 1000;
pts[2].x = 600;
pts[2].y = 400;
pts[3].x = 1200;
pts[3].y = 800;
BPoint triangle[3];
BRect triangleRect(100,100,400,300);
triangle[0].x = 100;
triangle[0].y = 100;
triangle[1].x = 100;
triangle[1].y = 300;
triangle[2].x = 400;
triangle[2].y = 300;
BPoint polygon[6];
BRect polygonRect(100,100,300,400);
polygon[0].x = 100;
polygon[0].y = 100;
polygon[1].x = 100;
polygon[1].y = 400;
polygon[2].x = 200;
polygon[2].y = 300;
polygon[3].x = 300;
polygon[3].y = 400;
polygon[4].x = 300;
polygon[4].y = 100;
polygon[5].x = 200;
polygon[5].y = 200;
fLayerData->highcolor.SetColor(255,0,0,255);
fLayerData->lowcolor.SetColor(255,255,255,255);
_driver->FillRect(r1,fLayerData,pattern);
fLayerData->highcolor.SetColor(255,255,0,255);
_driver->StrokeLine(BPoint(100,100),BPoint(1500,1100),fLayerData,pattern);
fLayerData->highcolor.SetColor(0,0,255,255);
_driver->StrokeBezier(pts,fLayerData,pattern);
_driver->StrokeArc(BRect(200,300,400,600),30,270,fLayerData,pattern);
_driver->StrokeEllipse(BRect(200,700,400,900),fLayerData,pattern);
_driver->StrokeRect(BRect(650,1000,750,1090),fLayerData,pattern);
_driver->StrokeRoundRect(BRect(200,1000,600,1090),30,40,fLayerData,pattern);
// _driver->StrokePolygon(polygon,6,polygonRect,fLayerData,pattern);
// _driver->StrokeTriangle(triangle,triangleRect,fLayerData,pattern);
fLayerData->highcolor.SetColor(255,0,255,255);
_driver->FillArc(BRect(1250,300,1450,600),30,270,fLayerData,pattern);
// _driver->FillBezier(pts,fLayerData,pattern);
_driver->FillEllipse(BRect(800,300,1200,600),fLayerData,pattern);
_driver->FillRoundRect(BRect(800,1000,1200,1090),30,40,fLayerData,pattern2);
_driver->FillPolygon(polygon,6,polygonRect,fLayerData,pattern);
// _driver->FillTriangle(triangle,triangleRect,fLayerData,pattern);
#endif // end DISPLAYDRIVER_TEST_HACK
}
void RootLayer::MoveBy(float x, float y)
{
}
@ -189,6 +117,99 @@ Layer* RootLayer::VirtualBottomChild() const
return fActiveWorkspace->GoToBottomItem();
}
void RootLayer::ReadWorkspaceData(const char *path)
{
BMessage msg, settings;
BFile file(path,B_READ_ONLY);
char string[20];
if(file.InitCheck()==B_OK && msg.Unflatten(&file)==B_OK)
{
int32 count;
if(msg.FindInt32("workspace_count",&count)!=B_OK)
count=9;
SetWorkspaceCount(count);
for(int32 i=0; i<count; i++)
{
Workspace *ws=(Workspace*)fWorkspaceList.ItemAt(i);
if(!ws)
continue;
sprintf(string,"workspace %ld",i);
if(msg.FindMessage(string,&settings)==B_OK)
{
ws->GetSettings(settings);
settings.MakeEmpty();
}
else
ws->GetDefaultSettings();
}
}
else
{
SetWorkspaceCount(9);
for(int32 i=0; i<9; i++)
{
Workspace *ws=(Workspace*)fWorkspaceList.ItemAt(i);
if(!ws)
continue;
ws->GetDefaultSettings();
}
}
}
void RootLayer::SaveWorkspaceData(const char *path)
{
BMessage msg,dummy;
BFile file(path,B_READ_WRITE | B_CREATE_FILE);
if(file.InitCheck()!=B_OK)
{
printf("ERROR: Couldn't save workspace data in RootLayer\n");
return;
}
char string[20];
int32 count=fWorkspaceList.CountItems();
if(msg.Unflatten(&file)==B_OK)
{
// if we were successful in unflattening the file, it means we're
// going to need to save over the existing data
for(int32 i=0; i<count; i++)
{
sprintf(string,"workspace %ld",i);
if(msg.FindMessage(string,&dummy)==B_OK)
msg.RemoveName(string);
}
}
for(int32 i=0; i<count; i++)
{
sprintf(string,"workspace %ld",i);
Workspace *ws=(Workspace*)fWorkspaceList.ItemAt(i);
if(!ws)
{
dummy.MakeEmpty();
ws->PutSettings(&dummy,i);
msg.AddMessage(string,&dummy);
}
else
{
// We're not supposed to have this happen, but we'll suck it up, anyway. :P
Workspace::PutDefaultSettings(&msg,i);
}
}
}
void RootLayer::AddWinBorderToWorkspaces(WinBorder* winBorder, uint32 wks)
{
if (!(fMainLock.IsLocked()))
@ -567,7 +588,7 @@ void RootLayer::SetWorkspaceCount(const int32 count)
for(int i=0; i < count; i++)
{
workspacePtr = fWSPtrList.ItemAt(i);
workspacePtr = fWorkspaceList.ItemAt(i);
if (workspacePtr)
newWSPtrList.AddItem(workspacePtr);
else
@ -579,10 +600,10 @@ void RootLayer::SetWorkspaceCount(const int32 count)
}
// delete other Workspace objects if the count is smaller than current one.
for (int j=count; j < fWSPtrList.CountItems(); j++)
for (int j=count; j < fWorkspaceList.CountItems(); j++)
{
Workspace *ws = NULL;
ws = static_cast<Workspace*>(fWSPtrList.ItemAt(j));
ws = static_cast<Workspace*>(fWorkspaceList.ItemAt(j));
if (ws)
delete ws;
else
@ -592,7 +613,7 @@ void RootLayer::SetWorkspaceCount(const int32 count)
}
}
fWSPtrList = newWSPtrList;
fWorkspaceList = newWSPtrList;
fMainLock.Unlock();
STRACE(("*RootLayer::SetWorkspaceCount(%ld) - main lock released\n", count));
@ -609,13 +630,13 @@ void RootLayer::SetWorkspaceCount(const int32 count)
int32 RootLayer::WorkspaceCount() const
{
return fWSPtrList.CountItems();
return fWorkspaceList.CountItems();
}
Workspace* RootLayer::WorkspaceAt(const int32 index) const
{
Workspace *ws = NULL;
ws = static_cast<Workspace*>(fWSPtrList.ItemAt(index-1));
ws = static_cast<Workspace*>(fWorkspaceList.ItemAt(index-1));
return ws;
}
@ -623,7 +644,7 @@ Workspace* RootLayer::WorkspaceAt(const int32 index) const
void RootLayer::SetActiveWorkspaceByIndex(const int32 index)
{
Workspace *ws = NULL;
ws = static_cast<Workspace*>(fWSPtrList.ItemAt(index-1));
ws = static_cast<Workspace*>(fWorkspaceList.ItemAt(index-1));
if (ws)
SetActiveWorkspace(ws);
}
@ -679,10 +700,10 @@ void RootLayer::PrintToStream()
printf("Screen rows: %ld\nScreen columns: %ld\n", fRows, fColumns);
printf("Resolution for all Screens: %ldx%ldx%ld\n", fScreenXResolution, fScreenYResolution, fColorSpace);
printf("Workspace list:\n");
for(int32 i=0; i<fWSPtrList.CountItems(); i++)
for(int32 i=0; i<fWorkspaceList.CountItems(); i++)
{
printf("\t~~~Workspace: %ld\n", ((Workspace*)fWSPtrList.ItemAt(i))->ID());
((Workspace*)fWSPtrList.ItemAt(i))->PrintToStream();
printf("\t~~~Workspace: %ld\n", ((Workspace*)fWorkspaceList.ItemAt(i))->ID());
((Workspace*)fWorkspaceList.ItemAt(i))->PrintToStream();
printf("~~~~~~~~\n");
}
printf("Active Workspace: %ld\n", fActiveWorkspace? fActiveWorkspace->ID(): -1);

View File

@ -56,7 +56,6 @@ public:
DisplayDriver *driver);
virtual ~RootLayer(void);
virtual void Draw(const BRect &r);
virtual void MoveBy(float x, float y);
virtual void ResizeBy(float x, float y);
@ -65,6 +64,9 @@ public:
virtual Layer *VirtualLowerSibling(void) const;
virtual Layer *VirtualUpperSibling(void) const;
virtual Layer *VirtualBottomChild(void) const;
void ReadWorkspaceData(const char *path);
void SaveWorkspaceData(const char *path);
void AddWinBorder(WinBorder *winBorder);
void RemoveWinBorder(WinBorder *winBorder);
@ -108,7 +110,7 @@ private:
int32 fScreenYResolution;
uint32 fColorSpace;
BList fWSPtrList;
BList fWorkspaceList;
Workspace *fActiveWorkspace;
};

View File

@ -42,8 +42,9 @@ ServerBitmap::ServerBitmap(BRect rect,color_space space, int32 flags,
_initialized=false;
_area=B_ERROR;
//!!! WARNING !!! '1' is added to the width and height. Same is done in FBBitmap
// subclass, so if you modify here make sure to do the same under FBBitmap::SetSize(...)
// WARNING: '1' is added to the width and height. Same is done in FBBitmap
// subclass, so if you modify here make sure to do the same under FBBitmap::SetSize(...)
_width=rect.IntegerWidth()+1;
_height=rect.IntegerHeight()+1;
_space=space;

View File

@ -215,14 +215,9 @@ ServerWindow::~ServerWindow(void)
cl = NULL;
STRACE(("#ServerWindow(%s) will exit NOW!!!\n", fTitle.String()));
STRACE(("#ServerWindow(%s) will exit NOW\n", fTitle.String()));
}
//5700 - fara servo , fara cas
//6300 - 1,4
//6700 - 1,6
//7100 - 1,4
//7500 - 1,6
//------------------------------------------------------------------------------
//! Forces the window border to update its decorator
void ServerWindow::ReplaceDecorator(void)
{

View File

@ -350,15 +350,17 @@ void WinBorder::MouseUp(PortMessage *msg)
void WinBorder::HighlightDecorator(const bool &active)
{
printf("Decorator->Highlight\n");
STRACE(("Decorator->Highlight\n"));
fDecorator->SetFocus(active);
}
void WinBorder::Draw(const BRect &r)
{
STRACE(("WinBorder(%s)::Draw()\n", GetName()));
printf("WinBorder::DRAW\n");
r.PrintToStream();
#ifdef DEBUG_WINBORDER
printf("WinBorder(%s)::Draw() : ", GetName()));
r.PrintToStream();
#endif
// if we have a visible region, it is decorator's one.
if(fDecorator)
{
@ -371,10 +373,11 @@ r.PrintToStream();
*/
fDecorator->Draw(fUpdateReg.Frame());
}
// clear background, *only IF* our view color is different to B_TRANSPARENT_COLOR!
// TODO: DO That!
// TODO: UNcomment!!!
// TODO !!! UPDATE code !!!
// TODO: UNcomment
// TODO: UPDATE code
/*
BMessage msg;
msg.what = _UPDATE_;

File diff suppressed because it is too large Load Diff

View File

@ -29,6 +29,7 @@
#include <SupportDefs.h>
#include <Locker.h>
#include <Accelerant.h>
#include "RGBColor.h"
@ -36,83 +37,104 @@ class WinBorder;
class RBGColor;
class RootLayer;
struct ListData{
WinBorder *layerPtr;
ListData *upperItem;
ListData *lowerItem;
struct ListData
{
WinBorder *layerPtr;
ListData *upperItem;
ListData *lowerItem;
};
class Workspace
{
public:
Workspace(const uint32 colorspace,
int32 ID,
const RGBColor& BGColor,
RootLayer* owner);
~Workspace();
bool AddLayerPtr(WinBorder* layer);
bool RemoveLayerPtr(WinBorder* layer);
bool HideSubsetWindows(WinBorder* layer);
WinBorder* SetFocusLayer(WinBorder* layer);
WinBorder* FocusLayer() const;
WinBorder* SetFrontLayer(WinBorder* layer);
WinBorder* FrontLayer() const;
void MoveToBack(WinBorder* newLast);
WinBorder* GoToBottomItem(); // the one that's visible.
WinBorder* GoToUpperItem();
WinBorder* GoToTopItem();
WinBorder* GoToLowerItem();
bool GoToItem(WinBorder* layer);
WinBorder* SearchWinBorder(BPoint pt);
void Invalidate();
void SetLocalSpace(const uint32 colorspace);
uint32 LocalSpace() const;
void SetBGColor(const RGBColor &c);
RGBColor BGColor(void) const;
int32 ID() const { return fID; }
// void SetFlags(const uint32 flags);
// uint32 Flags(void) const;
Workspace(const uint32 colorspace, int32 ID, const RGBColor& BGColor,
RootLayer *owner);
~Workspace(void);
bool AddLayerPtr(WinBorder *layer);
bool RemoveLayerPtr(WinBorder *layer);
bool HideSubsetWindows(WinBorder *layer);
WinBorder *SetFocusLayer(WinBorder *layer);
WinBorder *FocusLayer(void) const;
WinBorder *SetFrontLayer(WinBorder *layer);
WinBorder *FrontLayer(void) const;
void MoveToBack(WinBorder *newLast);
// The bottom item is the one which is visible
WinBorder *GoToBottomItem(void);
WinBorder *GoToUpperItem(void);
WinBorder *GoToTopItem(void);
WinBorder *GoToLowerItem(void);
bool GoToItem(WinBorder *layer);
WinBorder *SearchWinBorder(BPoint pt);
void Invalidate(void);
void SetLocalSpace(const uint32 colorspace);
uint32 LocalSpace(void) const;
void SetBGColor(const RGBColor &c);
RGBColor BGColor(void) const;
int32 ID(void) const { return fID; }
void GetSettings(const BMessage &msg);
void GetDefaultSettings(void);
void PutSettings(BMessage *msg, const int32 &index) const;
static void PutDefaultSettings(BMessage *msg, const int32 &index);
// debug methods
void PrintToStream() const;
void PrintItem(ListData *item) const;
// .... private :-) - do not use!
void SearchAndSetNewFront(WinBorder* preferred);
void SearchAndSetNewFocus(WinBorder* preferred);
void BringToFrontANormalWindow(WinBorder* layer);
ListData* HasItem(ListData* item);
ListData* HasItem(WinBorder* layer);
void PrintToStream(void) const;
void PrintItem(ListData *item) const;
// TODO: Bad Style. There should be a more elegant way of doing this
// .... private :-) - do not use!
void SearchAndSetNewFront(WinBorder *preferred);
void SearchAndSetNewFocus(WinBorder *preferred);
void BringToFrontANormalWindow(WinBorder *layer);
ListData *HasItem(ListData *item);
ListData *HasItem(WinBorder *layer);
private:
void InsertItem(ListData* item, ListData* before);
void RemoveItem(ListData* item);
ListData* FindPlace(ListData* pref);
int32 fID;
uint32 fSpace;
// uint32 fFlags;
RGBColor fBGColor;
BLocker opLock;
RootLayer *fOwner;
ListData *fBottomItem, // first visible onscreen
*fTopItem, // the last visible(or covered by other Layers)
*fCurrentItem, // pointer to the currect element in the list
*fFocusItem, // the focus WinBorder - for keyboard events
*fFrontItem; // the one the mouse can bring in front as possible(in its set)
void InsertItem(ListData *item, ListData *before);
void RemoveItem(ListData *item);
ListData *FindPlace(ListData *pref);
int32 fID;
uint32 fSpace;
RGBColor fBGColor;
BLocker fOpLock;
RootLayer *fOwner;
// first visible onscreen
ListData *fBottomItem;
// the last visible(or covered by other Layers)
ListData *fTopItem;
// pointer to the currect element in the list
ListData *fCurrentItem;
// the focus WinBorder - for keyboard events
ListData *fFocusItem;
// the one the mouse can bring in front as possible(in its set)
ListData *fFrontItem;
// settings for each workspace -- example taken from R5's app_server_settings file
display_timing fDisplayTiming;
int16 fVirtualWidth;
int16 fVirtualHeight;
// TODO: find out what specific values need to be contained in fFlags as per R5's server
// not to be confused with display_timing.flags
uint32 fFlags;
};
#endif