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
-2
View File
@@ -821,7 +821,6 @@ Decorator *new_decorator(BRect rect, const char *title, int32 wlook, int32 wfeel
{ {
Decorator *dec=NULL; Decorator *dec=NULL;
dec=new DefaultDecorator(rect,wlook,wfeel,wflags);
if(!app_server->make_decorator) if(!app_server->make_decorator)
dec=new DefaultDecorator(rect,wlook,wfeel,wflags); dec=new DefaultDecorator(rect,wlook,wfeel,wflags);
else else
@@ -830,7 +829,6 @@ Decorator *new_decorator(BRect rect, const char *title, int32 wlook, int32 wfeel
gui_colorset.Lock(); gui_colorset.Lock();
dec->SetDriver(ddriver); dec->SetDriver(ddriver);
dec->SetColors(gui_colorset); dec->SetColors(gui_colorset);
dec->SetFont(fontserver->GetSystemPlain());
dec->SetTitle(title); dec->SetTitle(title);
gui_colorset.Unlock(); gui_colorset.Unlock();
+120 -120
View File
@@ -42,47 +42,47 @@ CursorManager *cursormanager;
//! Initializes the CursorManager //! Initializes the CursorManager
CursorManager::CursorManager(void) CursorManager::CursorManager(void)
{ {
_cursorlist=new BList(0); fCursorList=new BList(0);
// Error code for AddCursor // Error code for AddCursor
_tokenizer.ExcludeValue(B_ERROR); fTokenizer.ExcludeValue(B_ERROR);
// Set system cursors to "unassigned" // Set system cursors to "unassigned"
ServerCursor *cdefault=new ServerCursor(default_cursor_data); ServerCursor *cdefault=new ServerCursor(default_cursor_data);
AddCursor(cdefault); AddCursor(cdefault);
_defaultcsr=cdefault; fDefaultCursor=cdefault;
ServerCursor *ctext=new ServerCursor(default_text_data); ServerCursor *ctext=new ServerCursor(default_text_data);
AddCursor(ctext); AddCursor(ctext);
_textcsr=ctext; fTextCursor=ctext;
ServerCursor *cmove=new ServerCursor(default_move_data); ServerCursor *cmove=new ServerCursor(default_move_data);
AddCursor(cmove); AddCursor(cmove);
_movecsr=cmove; fMoveCursor=cmove;
ServerCursor *cdrag=new ServerCursor(default_drag_data); ServerCursor *cdrag=new ServerCursor(default_drag_data);
AddCursor(cdrag); AddCursor(cdrag);
_dragcsr=cdrag; fDragCursor=cdrag;
ServerCursor *cresize=new ServerCursor(default_resize_data); ServerCursor *cresize=new ServerCursor(default_resize_data);
AddCursor(cresize); AddCursor(cresize);
_resizecsr=cresize; fResizeCursor=cresize;
ServerCursor *cresizenwse=new ServerCursor(default_resize_nwse_data); ServerCursor *cresizenwse=new ServerCursor(default_resize_nwse_data);
AddCursor(cresizenwse); AddCursor(cresizenwse);
_resize_nwse_csr=cresizenwse; fNWSECursor=cresizenwse;
ServerCursor *cresizenesw=new ServerCursor(default_resize_nesw_data); ServerCursor *cresizenesw=new ServerCursor(default_resize_nesw_data);
AddCursor(cresizenesw); AddCursor(cresizenesw);
_resize_nesw_csr=cresizenesw; fNESWCursor=cresizenesw;
ServerCursor *cresizens=new ServerCursor(default_resize_ns_data); ServerCursor *cresizens=new ServerCursor(default_resize_ns_data);
AddCursor(cresizens); AddCursor(cresizens);
_resize_ns_csr=cresizens; fNSCursor=cresizens;
ServerCursor *cresizeew=new ServerCursor(default_resize_ew_data); ServerCursor *cresizeew=new ServerCursor(default_resize_ew_data);
AddCursor(cresizeew); AddCursor(cresizeew);
_resize_ew_csr=cresizeew; fEWCursor=cresizeew;
} }
@@ -90,14 +90,14 @@ CursorManager::CursorManager(void)
CursorManager::~CursorManager(void) CursorManager::~CursorManager(void)
{ {
ServerCursor *temp; 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) if(temp)
delete temp; delete temp;
} }
_cursorlist->MakeEmpty(); fCursorList->MakeEmpty();
delete _cursorlist; delete fCursorList;
// Note that it is not necessary to remove and delete the system // Note that it is not necessary to remove and delete the system
// cursors. These cursors are kept in the list with a NULL application // cursors. These cursors are kept in the list with a NULL application
@@ -117,8 +117,8 @@ int32 CursorManager::AddCursor(ServerCursor *sc)
return B_ERROR; return B_ERROR;
Lock(); Lock();
_cursorlist->AddItem(sc); fCursorList->AddItem(sc);
int32 value=_tokenizer.GetToken(); int32 value=fTokenizer.GetToken();
sc->_token=value; sc->_token=value;
Unlock(); Unlock();
@@ -136,12 +136,12 @@ void CursorManager::DeleteCursor(int32 token)
Lock(); Lock();
ServerCursor *temp; 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) if(temp && temp->_token==token)
{ {
_cursorlist->RemoveItem(i); fCursorList->RemoveItem(i);
delete temp; delete temp;
break; break;
} }
@@ -161,13 +161,13 @@ void CursorManager::RemoveAppCursors(const char *signature)
Lock(); Lock();
ServerCursor *temp; 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() && if(temp && temp->GetAppSignature() &&
strcmp(signature, temp->GetAppSignature())==0) strcmp(signature, temp->GetAppSignature())==0)
{ {
_cursorlist->RemoveItem(i); fCursorList->RemoveItem(i);
delete temp; delete temp;
break; break;
} }
@@ -212,12 +212,12 @@ void CursorManager::ObscureCursor(void)
void CursorManager::SetCursor(int32 token) void CursorManager::SetCursor(int32 token)
{ {
Lock(); Lock();
ServerCursor *c=_FindCursor(token); ServerCursor *c=FindCursor(token);
if(c) if(c)
{ {
DisplayDriver *driver = desktop->ActiveScreen()->DDriver(); DisplayDriver *driver = desktop->ActiveScreen()->DDriver();
driver->SetCursor(c); driver->SetCursor(c);
_current_which=B_CURSOR_OTHER; fCurrentWhich=B_CURSOR_OTHER;
} }
Unlock(); Unlock();
} }
@@ -231,56 +231,56 @@ void CursorManager::SetCursor(cursor_which which)
{ {
case B_CURSOR_DEFAULT: case B_CURSOR_DEFAULT:
{ {
driver->SetCursor(_defaultcsr); driver->SetCursor(fDefaultCursor);
_current_which=which; fCurrentWhich=which;
break; break;
} }
case B_CURSOR_TEXT: case B_CURSOR_TEXT:
{ {
driver->SetCursor(_textcsr); driver->SetCursor(fTextCursor);
_current_which=which; fCurrentWhich=which;
break; break;
} }
case B_CURSOR_MOVE: case B_CURSOR_MOVE:
{ {
driver->SetCursor(_movecsr); driver->SetCursor(fMoveCursor);
_current_which=which; fCurrentWhich=which;
break; break;
} }
case B_CURSOR_DRAG: case B_CURSOR_DRAG:
{ {
driver->SetCursor(_dragcsr); driver->SetCursor(fDragCursor);
_current_which=which; fCurrentWhich=which;
break; break;
} }
case B_CURSOR_RESIZE: case B_CURSOR_RESIZE:
{ {
driver->SetCursor(_resizecsr); driver->SetCursor(fResizeCursor);
_current_which=which; fCurrentWhich=which;
break; break;
} }
case B_CURSOR_RESIZE_NWSE: case B_CURSOR_RESIZE_NWSE:
{ {
driver->SetCursor(_resize_nwse_csr); driver->SetCursor(fNWSECursor);
_current_which=which; fCurrentWhich=which;
break; break;
} }
case B_CURSOR_RESIZE_NESW: case B_CURSOR_RESIZE_NESW:
{ {
driver->SetCursor(_resize_nesw_csr); driver->SetCursor(fNESWCursor);
_current_which=which; fCurrentWhich=which;
break; break;
} }
case B_CURSOR_RESIZE_NS: case B_CURSOR_RESIZE_NS:
{ {
driver->SetCursor(_resize_ns_csr); driver->SetCursor(fNSCursor);
_current_which=which; fCurrentWhich=which;
break; break;
} }
case B_CURSOR_RESIZE_EW: case B_CURSOR_RESIZE_EW:
{ {
driver->SetCursor(_resize_ew_csr); driver->SetCursor(fEWCursor);
_current_which=which; fCurrentWhich=which;
break; break;
} }
default: default:
@@ -309,65 +309,65 @@ void CursorManager::SetCursorSet(const char *path)
if(cs.FindCursor(B_CURSOR_DEFAULT,&csr)==B_OK) if(cs.FindCursor(B_CURSOR_DEFAULT,&csr)==B_OK)
{ {
if(_defaultcsr) if(fDefaultCursor)
delete _defaultcsr; delete fDefaultCursor;
_defaultcsr=csr; fDefaultCursor=csr;
} }
if(cs.FindCursor(B_CURSOR_TEXT,&csr)==B_OK) if(cs.FindCursor(B_CURSOR_TEXT,&csr)==B_OK)
{ {
if(_textcsr) if(fTextCursor)
delete _textcsr; delete fTextCursor;
_textcsr=csr; fTextCursor=csr;
} }
if(cs.FindCursor(B_CURSOR_MOVE,&csr)==B_OK) if(cs.FindCursor(B_CURSOR_MOVE,&csr)==B_OK)
{ {
if(_movecsr) if(fMoveCursor)
delete _movecsr; delete fMoveCursor;
_movecsr=csr; fMoveCursor=csr;
} }
if(cs.FindCursor(B_CURSOR_DRAG,&csr)==B_OK) if(cs.FindCursor(B_CURSOR_DRAG,&csr)==B_OK)
{ {
if(_dragcsr) if(fDragCursor)
delete _dragcsr; delete fDragCursor;
_dragcsr=csr; fDragCursor=csr;
} }
if(cs.FindCursor(B_CURSOR_RESIZE,&csr)==B_OK) if(cs.FindCursor(B_CURSOR_RESIZE,&csr)==B_OK)
{ {
if(_resizecsr) if(fResizeCursor)
delete _resizecsr; delete fResizeCursor;
_resizecsr=csr; fResizeCursor=csr;
} }
if(cs.FindCursor(B_CURSOR_RESIZE_NWSE,&csr)==B_OK) if(cs.FindCursor(B_CURSOR_RESIZE_NWSE,&csr)==B_OK)
{ {
if(_resize_nwse_csr) if(fNWSECursor)
delete _resize_nwse_csr; delete fNWSECursor;
_resize_nwse_csr=csr; fNWSECursor=csr;
} }
if(cs.FindCursor(B_CURSOR_RESIZE_NESW,&csr)==B_OK) if(cs.FindCursor(B_CURSOR_RESIZE_NESW,&csr)==B_OK)
{ {
if(_resize_nesw_csr) if(fNESWCursor)
delete _resize_nesw_csr; delete fNESWCursor;
_resize_nesw_csr=csr; fNESWCursor=csr;
} }
if(cs.FindCursor(B_CURSOR_RESIZE_NS,&csr)==B_OK) if(cs.FindCursor(B_CURSOR_RESIZE_NS,&csr)==B_OK)
{ {
if(_resize_ns_csr) if(fNSCursor)
delete _resize_ns_csr; delete fNSCursor;
_resize_ns_csr=csr; fNSCursor=csr;
} }
if(cs.FindCursor(B_CURSOR_RESIZE_EW,&csr)==B_OK) if(cs.FindCursor(B_CURSOR_RESIZE_EW,&csr)==B_OK)
{ {
if(_resize_ew_csr) if(fEWCursor)
delete _resize_ew_csr; delete fEWCursor;
_resize_ew_csr=csr; fEWCursor=csr;
} }
Unlock(); Unlock();
@@ -389,47 +389,47 @@ ServerCursor *CursorManager::GetCursor(cursor_which which)
{ {
case B_CURSOR_DEFAULT: case B_CURSOR_DEFAULT:
{ {
temp=_defaultcsr; temp=fDefaultCursor;
break; break;
} }
case B_CURSOR_TEXT: case B_CURSOR_TEXT:
{ {
temp=_textcsr; temp=fTextCursor;
break; break;
} }
case B_CURSOR_MOVE: case B_CURSOR_MOVE:
{ {
temp=_movecsr; temp=fMoveCursor;
break; break;
} }
case B_CURSOR_DRAG: case B_CURSOR_DRAG:
{ {
temp=_dragcsr; temp=fDragCursor;
break; break;
} }
case B_CURSOR_RESIZE: case B_CURSOR_RESIZE:
{ {
temp=_resizecsr; temp=fResizeCursor;
break; break;
} }
case B_CURSOR_RESIZE_NWSE: case B_CURSOR_RESIZE_NWSE:
{ {
temp=_resize_nwse_csr; temp=fNWSECursor;
break; break;
} }
case B_CURSOR_RESIZE_NESW: case B_CURSOR_RESIZE_NESW:
{ {
temp=_resize_nesw_csr; temp=fNESWCursor;
break; break;
} }
case B_CURSOR_RESIZE_NS: case B_CURSOR_RESIZE_NS:
{ {
temp=_resize_ns_csr; temp=fNSCursor;
break; break;
} }
case B_CURSOR_RESIZE_EW: case B_CURSOR_RESIZE_EW:
{ {
temp=_resize_ew_csr; temp=fEWCursor;
break; break;
} }
default: default:
@@ -449,7 +449,7 @@ cursor_which CursorManager::GetCursorWhich(void)
cursor_which temp; cursor_which temp;
Lock(); Lock();
temp=_current_which; temp=fCurrentWhich;
Unlock(); Unlock();
return temp; return temp;
} }
@@ -468,7 +468,7 @@ void CursorManager::ChangeCursor(cursor_which which, int32 token)
Lock(); Lock();
// Find the cursor, based on the token // Find the cursor, based on the token
ServerCursor *cursor=_FindCursor(token); ServerCursor *cursor=FindCursor(token);
// Did we find a cursor with this token? // Did we find a cursor with this token?
if(!cursor) if(!cursor)
@@ -482,111 +482,111 @@ void CursorManager::ChangeCursor(cursor_which which, int32 token)
{ {
case B_CURSOR_DEFAULT: case B_CURSOR_DEFAULT:
{ {
if(_defaultcsr) if(fDefaultCursor)
delete _defaultcsr; delete fDefaultCursor;
_defaultcsr=cursor; fDefaultCursor=cursor;
if(cursor->GetAppSignature()) if(cursor->GetAppSignature())
cursor->SetAppSignature(""); cursor->SetAppSignature("");
_cursorlist->RemoveItem(cursor); fCursorList->RemoveItem(cursor);
break; break;
} }
case B_CURSOR_TEXT: case B_CURSOR_TEXT:
{ {
if(_textcsr) if(fTextCursor)
delete _textcsr; delete fTextCursor;
_textcsr=cursor; fTextCursor=cursor;
if(cursor->GetAppSignature()) if(cursor->GetAppSignature())
cursor->SetAppSignature(""); cursor->SetAppSignature("");
_cursorlist->RemoveItem(cursor); fCursorList->RemoveItem(cursor);
break; break;
} }
case B_CURSOR_MOVE: case B_CURSOR_MOVE:
{ {
if(_movecsr) if(fMoveCursor)
delete _movecsr; delete fMoveCursor;
_movecsr=cursor; fMoveCursor=cursor;
if(cursor->GetAppSignature()) if(cursor->GetAppSignature())
cursor->SetAppSignature(""); cursor->SetAppSignature("");
_cursorlist->RemoveItem(cursor); fCursorList->RemoveItem(cursor);
break; break;
} }
case B_CURSOR_DRAG: case B_CURSOR_DRAG:
{ {
if(_dragcsr) if(fDragCursor)
delete _dragcsr; delete fDragCursor;
_dragcsr=cursor; fDragCursor=cursor;
if(cursor->GetAppSignature()) if(cursor->GetAppSignature())
cursor->SetAppSignature(""); cursor->SetAppSignature("");
_cursorlist->RemoveItem(cursor); fCursorList->RemoveItem(cursor);
break; break;
} }
case B_CURSOR_RESIZE: case B_CURSOR_RESIZE:
{ {
if(_resizecsr) if(fResizeCursor)
delete _resizecsr; delete fResizeCursor;
_resizecsr=cursor; fResizeCursor=cursor;
if(cursor->GetAppSignature()) if(cursor->GetAppSignature())
cursor->SetAppSignature(""); cursor->SetAppSignature("");
_cursorlist->RemoveItem(cursor); fCursorList->RemoveItem(cursor);
break; break;
} }
case B_CURSOR_RESIZE_NWSE: case B_CURSOR_RESIZE_NWSE:
{ {
if(_resize_nwse_csr) if(fNWSECursor)
delete _resize_nwse_csr; delete fNWSECursor;
_resize_nwse_csr=cursor; fNWSECursor=cursor;
if(cursor->GetAppSignature()) if(cursor->GetAppSignature())
cursor->SetAppSignature(""); cursor->SetAppSignature("");
_cursorlist->RemoveItem(cursor); fCursorList->RemoveItem(cursor);
break; break;
} }
case B_CURSOR_RESIZE_NESW: case B_CURSOR_RESIZE_NESW:
{ {
if(_resize_nesw_csr) if(fNESWCursor)
delete _resize_nesw_csr; delete fNESWCursor;
_resize_nesw_csr=cursor; fNESWCursor=cursor;
if(cursor->GetAppSignature()) if(cursor->GetAppSignature())
cursor->SetAppSignature(""); cursor->SetAppSignature("");
_cursorlist->RemoveItem(cursor); fCursorList->RemoveItem(cursor);
break; break;
} }
case B_CURSOR_RESIZE_NS: case B_CURSOR_RESIZE_NS:
{ {
if(_resize_ns_csr) if(fNSCursor)
delete _resize_ns_csr; delete fNSCursor;
_resize_ns_csr=cursor; fNSCursor=cursor;
if(cursor->GetAppSignature()) if(cursor->GetAppSignature())
cursor->SetAppSignature(""); cursor->SetAppSignature("");
_cursorlist->RemoveItem(cursor); fCursorList->RemoveItem(cursor);
break; break;
} }
case B_CURSOR_RESIZE_EW: case B_CURSOR_RESIZE_EW:
{ {
if(_resize_ew_csr) if(fEWCursor)
delete _resize_ew_csr; delete fEWCursor;
_resize_ew_csr=cursor; fEWCursor=cursor;
if(cursor->GetAppSignature()) if(cursor->GetAppSignature())
cursor->SetAppSignature(""); cursor->SetAppSignature("");
_cursorlist->RemoveItem(cursor); fCursorList->RemoveItem(cursor);
break; break;
} }
default: default:
@@ -601,12 +601,12 @@ void CursorManager::ChangeCursor(cursor_which which, int32 token)
\param token ID of the cursor to find \param token ID of the cursor to find
\return The cursor or NULL if not found \return The cursor or NULL if not found
*/ */
ServerCursor *CursorManager::_FindCursor(int32 token) ServerCursor *CursorManager::FindCursor(int32 token)
{ {
ServerCursor *temp; 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) if(temp && temp->_token==token)
return temp; return temp;
} }
+13 -13
View File
@@ -62,22 +62,22 @@ public:
void ChangeCursor(cursor_which which, int32 token); void ChangeCursor(cursor_which which, int32 token);
void SetDefaults(void); void SetDefaults(void);
private: private:
ServerCursor *_FindCursor(int32 token); ServerCursor *FindCursor(int32 token);
BList *_cursorlist; BList *fCursorList;
TokenHandler _tokenizer; TokenHandler fTokenizer;
// System cursor members // System cursor members
ServerCursor *_defaultcsr, ServerCursor *fDefaultCursor,
*_textcsr, *fTextCursor,
*_movecsr, *fMoveCursor,
*_dragcsr, *fDragCursor,
*_resizecsr, *fResizeCursor,
*_resize_nwse_csr, *fNWSECursor,
*_resize_nesw_csr, *fNESWCursor,
*_resize_ns_csr, *fNSCursor,
*_resize_ew_csr; *fEWCursor;
cursor_which _current_which; cursor_which fCurrentWhich;
}; };
extern CursorManager *cursormanager; extern CursorManager *cursormanager;
+10 -12
View File
@@ -49,20 +49,22 @@ Decorator::Decorator(BRect rect, int32 wlook, int32 wfeel, int32 wflags)
_title_string=new BString; _title_string=new BString;
_driver=NULL; _driver=NULL;
/// xxx.Set(0,0,1,1) produces a rectangle 2 pixels wide, that /// xxx.Set(0,0,1,1) produces a rectangle 2 pixels wide, that
// WILL be drawn on screen. We so not want that... so... // WILL be drawn on screen. We so not want that... so...
// [ A BRect when instantiated is made invalid, so, no need for: ] // [ A BRect when instantiated is made invalid, so, no need for: ]
/* _closerect.Set( 0, 0, -1, -1); /*
_closerect.Set( 0, 0, -1, -1);
_zoomrect.Set( 0, 0, -1, -1); _zoomrect.Set( 0, 0, -1, -1);
_minimizerect.Set( 0, 0, -1, -1); _minimizerect.Set( 0, 0, -1, -1);
_resizerect.Set( 0, 0, -1, -1); _resizerect.Set( 0, 0, -1, -1);
*/ */
_frame=rect; _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)); //_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: ] // [ A BRect when instantiated is made invalid, so, no need for: ]
/* _tabrect.Set( 0, 0, -1, -1 ); */ // _tabrect.Set( 0, 0, -1, -1 );
_look=wlook; _look=wlook;
_feel=wfeel; _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.
*/
@@ -34,6 +34,7 @@
#include "RGBColor.h" #include "RGBColor.h"
#include "RectUtils.h" #include "RectUtils.h"
#include <stdio.h> #include <stdio.h>
#include "FontServer.h"
//#define USE_VIEW_FILL_HACK //#define USE_VIEW_FILL_HACK
@@ -53,6 +54,11 @@ DefaultDecorator::DefaultDecorator(BRect rect, int32 wlook, int32 wfeel, int32 w
taboffset=0; taboffset=0;
titlepixelwidth=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=new RGBColor[6];
framecolors[0].SetColor(152,152,152); framecolors[0].SetColor(152,152,152);
framecolors[1].SetColor(255,255,255); framecolors[1].SetColor(255,255,255);
@@ -61,6 +67,8 @@ DefaultDecorator::DefaultDecorator(BRect rect, int32 wlook, int32 wfeel, int32 w
framecolors[4].SetColor(152,152,152); framecolors[4].SetColor(152,152,152);
framecolors[5].SetColor(96,96,96); framecolors[5].SetColor(96,96,96);
// Set appropriate colors based on the current focus value. In this case, each decorator // Set appropriate colors based on the current focus value. In this case, each decorator
// defaults to not having the focus. // defaults to not having the focus.
_SetFocus(); _SetFocus();
+4 -17
View File
@@ -199,8 +199,8 @@ void Desktop::SetActiveRootLayer(RootLayer* rl)
fActiveRootLayer = rl; fActiveRootLayer = rl;
// TODO: fix!!!!!!!!!!!!!!!!!!!!!!!! or not? // TODO: fix... or not?
// also set the new front and focus // also set the new front and focus
// SetFrontWinBorder(fActiveRootLayer->ActiveWorkspace()->FrontLayer()); // SetFrontWinBorder(fActiveRootLayer->ActiveWorkspace()->FrontLayer());
// SetFocusWinBorder(fActiveRootLayer->ActiveWorkspace()->FocusLayer()); // SetFocusWinBorder(fActiveRootLayer->ActiveWorkspace()->FocusLayer());
@@ -362,7 +362,7 @@ WinBorder* Desktop::FocusWinBorder(void) const
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void Desktop::MouseEventHandler(PortMessage *msg) void Desktop::MouseEventHandler(PortMessage *msg)
{ {
// TODO: locking mechanism needs SERIOUS rethought!!!! // TODO: locking mechanism needs SERIOUS rethought
switch(msg->Code()) switch(msg->Code())
{ {
case B_MOUSE_DOWN: case B_MOUSE_DOWN:
@@ -420,7 +420,7 @@ void Desktop::MouseEventHandler(PortMessage *msg)
invalidRegion.Include(&(activeFocus->fFull)); invalidRegion.Include(&(activeFocus->fFull));
invalidRegion.Include(&(activeFocus->fTopLayer->fFull)); invalidRegion.Include(&(activeFocus->fTopLayer->fFull));
activeFocus->fParent->FullInvalidate(invalidRegion); 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){ // void Layer::RebuildAndForceRedraw(invalidReg, target){
// BPoint pt(0,0); // BPoint pt(0,0);
// StartRebuildRegions(invalidRegion, NULL, B_LAYER_NONE, pt); // StartRebuildRegions(invalidRegion, NULL, B_LAYER_NONE, pt);
@@ -875,19 +875,6 @@ mode_mouse Desktop::FFMouseMode(void) const
return fMouseMode; 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) void Desktop::RemoveSubsetWindow(WinBorder* wb)
{ {
WinBorder *winBorder = NULL; WinBorder *winBorder = NULL;
+22 -25
View File
@@ -54,31 +54,31 @@ public:
// Methods for multiple monitors. // Methods for multiple monitors.
Screen *ScreenAt(int32 index) const; Screen *ScreenAt(int32 index) const;
int32 ScreenCount(void) const; int32 ScreenCount(void) const;
Screen* ActiveScreen(void) const; Screen *ActiveScreen(void) const;
void SetActiveRootLayerByIndex(int32 listIndex); void SetActiveRootLayerByIndex(int32 listIndex);
void SetActiveRootLayer(RootLayer* rl); void SetActiveRootLayer(RootLayer *rl);
RootLayer* RootLayerAt(int32 index); RootLayer *RootLayerAt(int32 index);
RootLayer* ActiveRootLayer(void) const; RootLayer *ActiveRootLayer(void) const;
int32 ActiveRootLayerIndex(void) const; int32 ActiveRootLayerIndex(void) const;
int32 CountRootLayers(void) const; int32 CountRootLayers(void) const;
DisplayDriver* GetDisplayDriver(void) const; DisplayDriver *GetDisplayDriver(void) const;
// Methods for layer(WinBorder) manipulation. // Methods for layer(WinBorder) manipulation.
void AddWinBorder(WinBorder* winBorder); void AddWinBorder(WinBorder *winBorder);
void RemoveWinBorder(WinBorder* winBorder); void RemoveWinBorder(WinBorder *winBorder);
bool HasWinBorder(WinBorder* winBorder); bool HasWinBorder(WinBorder *winBorder);
void SetFrontWinBorder(WinBorder* winBorder); void SetFrontWinBorder(WinBorder *winBorder);
void SetFocusWinBorder(WinBorder* winBorder); void SetFocusWinBorder(WinBorder *winBorder);
WinBorder* FrontWinBorder(void) const; WinBorder *FrontWinBorder(void) const;
WinBorder* FocusWinBorder(void) const; WinBorder *FocusWinBorder(void) const;
// Input related methods // Input related methods
void MouseEventHandler(PortMessage *msg); void MouseEventHandler(PortMessage *msg);
void KeyboardEventHandler(PortMessage *msg); void KeyboardEventHandler(PortMessage *msg);
void SetDragMessage(BMessage* msg); void SetDragMessage(BMessage *msg);
BMessage* DragMessage(void) const; BMessage *DragMessage(void) const;
// Methods for various desktop stuff handled by the server // Methods for various desktop stuff handled by the server
void SetScrollBarInfo(const scroll_bar_info &info); void SetScrollBarInfo(const scroll_bar_info &info);
@@ -93,16 +93,13 @@ public:
void SetFFMouseMode(const mode_mouse &value); void SetFFMouseMode(const mode_mouse &value);
mode_mouse FFMouseMode(void) const; mode_mouse FFMouseMode(void) const;
bool ReadWorkspaceData(void);
void SaveWorkspaceData(void);
// Debugging methods // Debugging methods
void PrintToStream(void); void PrintToStream(void);
void PrintVisibleInRootLayerNo(int32 no); void PrintVisibleInRootLayerNo(int32 no);
// "Private" to app_server :-) - means they should not be used very much // "Private" to app_server :-) - means they should not be used very much
void RemoveSubsetWindow(WinBorder* wb); void RemoveSubsetWindow(WinBorder *wb);
WinBorder* FindWinBorderByServerWindowTokenAndTeamID(int32 token, team_id teamID); WinBorder *FindWinBorderByServerWindowTokenAndTeamID(int32 token, team_id teamID);
BLocker fGeneralLock; BLocker fGeneralLock;
BLocker fLayerLock; BLocker fLayerLock;
@@ -112,16 +109,16 @@ private:
BMessage *fDragMessage; BMessage *fDragMessage;
BList fRootLayerList; BList fRootLayerList;
RootLayer* fActiveRootLayer; RootLayer *fActiveRootLayer;
WinBorder* fFrontWinBorder; WinBorder *fFrontWinBorder;
WinBorder* fFocusWinBorder; WinBorder *fFocusWinBorder;
WinBorder* fMouseTarget; WinBorder *fMouseTarget;
BList fScreenList; BList fScreenList;
// '1' or 'n' Screen(s). Not sure it's needed though. // '1' or 'n' Screen(s). Not sure it's needed though.
int32 fScreenMode; int32 fScreenMode;
Screen* fActiveScreen; Screen *fActiveScreen;
scroll_bar_info fScrollBarInfo; scroll_bar_info fScrollBarInfo;
menu_info fMenuInfo; menu_info fMenuInfo;
@@ -130,6 +127,6 @@ private:
int32 fScreenShotIndex; int32 fScreenShotIndex;
}; };
extern Desktop* desktop; extern Desktop *desktop;
#endif // _DESKTOP_H_ #endif // _DESKTOP_H_
+10 -9
View File
@@ -378,8 +378,8 @@ void Layer::FullInvalidate(const BRegion& region)
{ {
STRACE(("Layer(%s)::FullInvalidate():\n", GetName())); STRACE(("Layer(%s)::FullInvalidate():\n", GetName()));
#ifdef DEBUG_LAYER #ifdef DEBUG_LAYER
region.PrintToStream(); region.PrintToStream();
printf("\n"); printf("\n");
#endif #endif
BPoint pt(0,0); BPoint pt(0,0);
@@ -394,8 +394,8 @@ void Layer::Invalidate(const BRegion& region)
{ {
STRACE(("Layer(%s)::Invalidate():\n", GetName())); STRACE(("Layer(%s)::Invalidate():\n", GetName()));
#ifdef DEBUG_LAYER #ifdef DEBUG_LAYER
region.PrintToStream(); region.PrintToStream();
printf("\n"); printf("\n");
#endif #endif
gRedrawReg = region; gRedrawReg = region;
@@ -440,7 +440,7 @@ void Layer::RequestDraw(const BRegion &reg, Layer *startFrom)
Draw(fUpdateReg.Frame()); Draw(fUpdateReg.Frame());
fDriver->ConstrainClippingRegion(NULL); 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(); fUpdateReg.MakeEmpty();
} }
} }
@@ -465,9 +465,11 @@ void Layer::RequestDraw(const BRegion &reg, Layer *startFrom)
void Layer::Draw(const BRect &r) void Layer::Draw(const BRect &r)
{ {
// TODO/NOTE: this should be an empty method! the next lines are for testing only // TODO/NOTE: this should be an empty method! the next lines are for testing only
printf("Layer::Draw\n");
#ifdef DEBUG_LAYER
printf("Layer::Draw: ");
r.PrintToStream(); r.PrintToStream();
STRACE(("Layer::Draw() Called\n")); #endif
/* /*
RGBColor col(152,102,51); RGBColor col(152,102,51);
fDriver->FillRect(fUpdateReg.Frame(), col); fDriver->FillRect(fUpdateReg.Frame(), col);
@@ -547,7 +549,7 @@ void Layer::RebuildFullRegion( )
else else
fFull.Set( fFrame ); fFull.Set( fFrame );
// TODO: restrict to screen coordinates!!! // TODO: restrict to screen coordinates
// TODO: Convert to screen coordinates! // TODO: Convert to screen coordinates!
LayerData *ld; LayerData *ld;
ld = fLayerData; ld = fLayerData;
@@ -942,7 +944,6 @@ void Layer::MoveBy(float x, float y)
BRect rect(fFull.Frame().OffsetByCopy(pt)); BRect rect(fFull.Frame().OffsetByCopy(pt));
fParent->StartRebuildRegions(BRegion(rect), this, B_LAYER_MOVE, pt); fParent->StartRebuildRegions(BRegion(rect), this, B_LAYER_MOVE, pt);
fDriver->CopyRegionList(&gCopyRegList, &gCopyList, gCopyRegList.CountItems(), &fFullVisible); fDriver->CopyRegionList(&gCopyRegList, &gCopyList, gCopyRegList.CountItems(), &fFullVisible);
fParent->Redraw(gRedrawReg, this); fParent->Redraw(gRedrawReg, this);
+7 -4
View File
@@ -224,11 +224,14 @@ status_t PicturePlayer::Play(int32 tableEntries,void *userData, LayerData *d)
char *string = new char[len + 1]; char *string = new char[len + 1];
GetData(string, len); GetData(string, len);
string[len] = '\0'; string[len] = '\0';
// float deltax = GetFloat(); float deltax = GetFloat();
// float deltay = GetFloat(); float deltay = GetFloat();
// TODO: The deltas given are escapements. Find out how they translate into // TODO: The deltas given are escapements. They seem to be called deltax and deltay
// escapement_delta units. // 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); fdriver->DrawString(string,len,fldata.penlocation,&fldata);
delete string; delete string;
+110 -89
View File
@@ -30,6 +30,8 @@
#include <stdio.h> #include <stdio.h>
#include <Window.h> #include <Window.h>
#include <List.h> #include <List.h>
#include <Message.h>
#include <File.h>
#include "Globals.h" #include "Globals.h"
#include "RootLayer.h" #include "RootLayer.h"
@@ -40,6 +42,7 @@
#include "ServerWindow.h" #include "ServerWindow.h"
#include "ServerApp.h" #include "ServerApp.h"
#include "Desktop.h" #include "Desktop.h"
#include "ServerConfig.h"
#include "FMWList.h" #include "FMWList.h"
#include "DisplayDriver.h" #include "DisplayDriver.h"
@@ -66,6 +69,10 @@ RootLayer::RootLayer(const char *name, int32 workspaceCount,
fRows = 0; fRows = 0;
fColumns = 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. // TODO: read these 3 from a configuration file.
fScreenXResolution = 0; fScreenXResolution = 0;
fScreenYResolution = 0; fScreenYResolution = 0;
@@ -74,7 +81,6 @@ RootLayer::RootLayer(const char *name, int32 workspaceCount,
fViewToken = 0; // is this used for WinBorders? fViewToken = 0; // is this used for WinBorders?
fHidden = false; fHidden = false;
SetWorkspaceCount(workspaceCount);
} }
RootLayer::~RootLayer() RootLayer::~RootLayer()
@@ -82,84 +88,6 @@ RootLayer::~RootLayer()
// RootLayer object just uses Screen objects, it is not allowed to delete them. // 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) void RootLayer::MoveBy(float x, float y)
{ {
} }
@@ -189,6 +117,99 @@ Layer* RootLayer::VirtualBottomChild() const
return fActiveWorkspace->GoToBottomItem(); 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) void RootLayer::AddWinBorderToWorkspaces(WinBorder* winBorder, uint32 wks)
{ {
if (!(fMainLock.IsLocked())) if (!(fMainLock.IsLocked()))
@@ -567,7 +588,7 @@ void RootLayer::SetWorkspaceCount(const int32 count)
for(int i=0; i < count; i++) for(int i=0; i < count; i++)
{ {
workspacePtr = fWSPtrList.ItemAt(i); workspacePtr = fWorkspaceList.ItemAt(i);
if (workspacePtr) if (workspacePtr)
newWSPtrList.AddItem(workspacePtr); newWSPtrList.AddItem(workspacePtr);
else else
@@ -579,10 +600,10 @@ void RootLayer::SetWorkspaceCount(const int32 count)
} }
// delete other Workspace objects if the count is smaller than current one. // 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; Workspace *ws = NULL;
ws = static_cast<Workspace*>(fWSPtrList.ItemAt(j)); ws = static_cast<Workspace*>(fWorkspaceList.ItemAt(j));
if (ws) if (ws)
delete ws; delete ws;
else else
@@ -592,7 +613,7 @@ void RootLayer::SetWorkspaceCount(const int32 count)
} }
} }
fWSPtrList = newWSPtrList; fWorkspaceList = newWSPtrList;
fMainLock.Unlock(); fMainLock.Unlock();
STRACE(("*RootLayer::SetWorkspaceCount(%ld) - main lock released\n", count)); STRACE(("*RootLayer::SetWorkspaceCount(%ld) - main lock released\n", count));
@@ -609,13 +630,13 @@ void RootLayer::SetWorkspaceCount(const int32 count)
int32 RootLayer::WorkspaceCount() const int32 RootLayer::WorkspaceCount() const
{ {
return fWSPtrList.CountItems(); return fWorkspaceList.CountItems();
} }
Workspace* RootLayer::WorkspaceAt(const int32 index) const Workspace* RootLayer::WorkspaceAt(const int32 index) const
{ {
Workspace *ws = NULL; Workspace *ws = NULL;
ws = static_cast<Workspace*>(fWSPtrList.ItemAt(index-1)); ws = static_cast<Workspace*>(fWorkspaceList.ItemAt(index-1));
return ws; return ws;
} }
@@ -623,7 +644,7 @@ Workspace* RootLayer::WorkspaceAt(const int32 index) const
void RootLayer::SetActiveWorkspaceByIndex(const int32 index) void RootLayer::SetActiveWorkspaceByIndex(const int32 index)
{ {
Workspace *ws = NULL; Workspace *ws = NULL;
ws = static_cast<Workspace*>(fWSPtrList.ItemAt(index-1)); ws = static_cast<Workspace*>(fWorkspaceList.ItemAt(index-1));
if (ws) if (ws)
SetActiveWorkspace(ws); SetActiveWorkspace(ws);
} }
@@ -679,10 +700,10 @@ void RootLayer::PrintToStream()
printf("Screen rows: %ld\nScreen columns: %ld\n", fRows, fColumns); printf("Screen rows: %ld\nScreen columns: %ld\n", fRows, fColumns);
printf("Resolution for all Screens: %ldx%ldx%ld\n", fScreenXResolution, fScreenYResolution, fColorSpace); printf("Resolution for all Screens: %ldx%ldx%ld\n", fScreenXResolution, fScreenYResolution, fColorSpace);
printf("Workspace list:\n"); 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()); printf("\t~~~Workspace: %ld\n", ((Workspace*)fWorkspaceList.ItemAt(i))->ID());
((Workspace*)fWSPtrList.ItemAt(i))->PrintToStream(); ((Workspace*)fWorkspaceList.ItemAt(i))->PrintToStream();
printf("~~~~~~~~\n"); printf("~~~~~~~~\n");
} }
printf("Active Workspace: %ld\n", fActiveWorkspace? fActiveWorkspace->ID(): -1); printf("Active Workspace: %ld\n", fActiveWorkspace? fActiveWorkspace->ID(): -1);
+4 -2
View File
@@ -56,7 +56,6 @@ public:
DisplayDriver *driver); DisplayDriver *driver);
virtual ~RootLayer(void); virtual ~RootLayer(void);
virtual void Draw(const BRect &r);
virtual void MoveBy(float x, float y); virtual void MoveBy(float x, float y);
virtual void ResizeBy(float x, float y); virtual void ResizeBy(float x, float y);
@@ -66,6 +65,9 @@ public:
virtual Layer *VirtualUpperSibling(void) const; virtual Layer *VirtualUpperSibling(void) const;
virtual Layer *VirtualBottomChild(void) const; virtual Layer *VirtualBottomChild(void) const;
void ReadWorkspaceData(const char *path);
void SaveWorkspaceData(const char *path);
void AddWinBorder(WinBorder *winBorder); void AddWinBorder(WinBorder *winBorder);
void RemoveWinBorder(WinBorder *winBorder); void RemoveWinBorder(WinBorder *winBorder);
void ChangeWorkspacesFor(WinBorder *winBorder, uint32 newWorkspaces); void ChangeWorkspacesFor(WinBorder *winBorder, uint32 newWorkspaces);
@@ -108,7 +110,7 @@ private:
int32 fScreenYResolution; int32 fScreenYResolution;
uint32 fColorSpace; uint32 fColorSpace;
BList fWSPtrList; BList fWorkspaceList;
Workspace *fActiveWorkspace; Workspace *fActiveWorkspace;
}; };
+3 -2
View File
@@ -42,8 +42,9 @@ ServerBitmap::ServerBitmap(BRect rect,color_space space, int32 flags,
_initialized=false; _initialized=false;
_area=B_ERROR; _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; _width=rect.IntegerWidth()+1;
_height=rect.IntegerHeight()+1; _height=rect.IntegerHeight()+1;
_space=space; _space=space;
+2 -7
View File
@@ -215,14 +215,9 @@ ServerWindow::~ServerWindow(void)
cl = NULL; 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 //! Forces the window border to update its decorator
void ServerWindow::ReplaceDecorator(void) void ServerWindow::ReplaceDecorator(void)
{ {
+9 -6
View File
@@ -350,15 +350,17 @@ void WinBorder::MouseUp(PortMessage *msg)
void WinBorder::HighlightDecorator(const bool &active) void WinBorder::HighlightDecorator(const bool &active)
{ {
printf("Decorator->Highlight\n"); STRACE(("Decorator->Highlight\n"));
fDecorator->SetFocus(active); fDecorator->SetFocus(active);
} }
void WinBorder::Draw(const BRect &r) void WinBorder::Draw(const BRect &r)
{ {
STRACE(("WinBorder(%s)::Draw()\n", GetName())); #ifdef DEBUG_WINBORDER
printf("WinBorder::DRAW\n"); printf("WinBorder(%s)::Draw() : ", GetName()));
r.PrintToStream(); r.PrintToStream();
#endif
// if we have a visible region, it is decorator's one. // if we have a visible region, it is decorator's one.
if(fDecorator) if(fDecorator)
{ {
@@ -371,10 +373,11 @@ r.PrintToStream();
*/ */
fDecorator->Draw(fUpdateReg.Frame()); fDecorator->Draw(fUpdateReg.Frame());
} }
// clear background, *only IF* our view color is different to B_TRANSPARENT_COLOR! // clear background, *only IF* our view color is different to B_TRANSPARENT_COLOR!
// TODO: DO That! // TODO: DO That!
// TODO: UNcomment!!! // TODO: UNcomment
// TODO !!! UPDATE code !!! // TODO: UPDATE code
/* /*
BMessage msg; BMessage msg;
msg.what = _UPDATE_; msg.what = _UPDATE_;
File diff suppressed because it is too large Load Diff
+75 -53
View File
@@ -29,6 +29,7 @@
#include <SupportDefs.h> #include <SupportDefs.h>
#include <Locker.h> #include <Locker.h>
#include <Accelerant.h>
#include "RGBColor.h" #include "RGBColor.h"
@@ -36,83 +37,104 @@ class WinBorder;
class RBGColor; class RBGColor;
class RootLayer; class RootLayer;
struct ListData{ struct ListData
WinBorder *layerPtr; {
ListData *upperItem; WinBorder *layerPtr;
ListData *lowerItem; ListData *upperItem;
ListData *lowerItem;
}; };
class Workspace class Workspace
{ {
public: public:
Workspace(const uint32 colorspace, Workspace(const uint32 colorspace, int32 ID, const RGBColor& BGColor,
int32 ID, RootLayer *owner);
const RGBColor& BGColor, ~Workspace(void);
RootLayer* owner);
~Workspace();
bool AddLayerPtr(WinBorder* layer); bool AddLayerPtr(WinBorder *layer);
bool RemoveLayerPtr(WinBorder* layer); bool RemoveLayerPtr(WinBorder *layer);
bool HideSubsetWindows(WinBorder* layer); bool HideSubsetWindows(WinBorder *layer);
WinBorder* SetFocusLayer(WinBorder* layer); WinBorder *SetFocusLayer(WinBorder *layer);
WinBorder* FocusLayer() const; WinBorder *FocusLayer(void) const;
WinBorder* SetFrontLayer(WinBorder* layer); WinBorder *SetFrontLayer(WinBorder *layer);
WinBorder* FrontLayer() const; WinBorder *FrontLayer(void) const;
void MoveToBack(WinBorder* newLast); void MoveToBack(WinBorder *newLast);
WinBorder* GoToBottomItem(); // the one that's visible. // The bottom item is the one which is visible
WinBorder* GoToUpperItem(); WinBorder *GoToBottomItem(void);
WinBorder* GoToTopItem(); WinBorder *GoToUpperItem(void);
WinBorder* GoToLowerItem(); WinBorder *GoToTopItem(void);
bool GoToItem(WinBorder* layer); WinBorder *GoToLowerItem(void);
bool GoToItem(WinBorder *layer);
WinBorder* SearchWinBorder(BPoint pt); WinBorder *SearchWinBorder(BPoint pt);
void Invalidate(); void Invalidate(void);
void SetLocalSpace(const uint32 colorspace); void SetLocalSpace(const uint32 colorspace);
uint32 LocalSpace() const; uint32 LocalSpace(void) const;
void SetBGColor(const RGBColor &c); void SetBGColor(const RGBColor &c);
RGBColor BGColor(void) const; RGBColor BGColor(void) const;
int32 ID() const { return fID; } 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);
// void SetFlags(const uint32 flags);
// uint32 Flags(void) const;
// debug methods // debug methods
void PrintToStream() const; void PrintToStream(void) const;
void PrintItem(ListData *item) const; void PrintItem(ListData *item) const;
// .... private :-) - do not use! // TODO: Bad Style. There should be a more elegant way of doing this
void SearchAndSetNewFront(WinBorder* preferred); // .... private :-) - do not use!
void SearchAndSetNewFocus(WinBorder* preferred); void SearchAndSetNewFront(WinBorder *preferred);
void BringToFrontANormalWindow(WinBorder* layer); void SearchAndSetNewFocus(WinBorder *preferred);
void BringToFrontANormalWindow(WinBorder *layer);
ListData* HasItem(ListData* item); 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* FindPlace(ListData* pref); ListData *FindPlace(ListData *pref);
int32 fID; int32 fID;
uint32 fSpace; uint32 fSpace;
// uint32 fFlags; RGBColor fBGColor;
RGBColor fBGColor;
BLocker opLock; BLocker fOpLock;
RootLayer *fOwner; RootLayer *fOwner;
ListData *fBottomItem, // first visible onscreen // first visible onscreen
*fTopItem, // the last visible(or covered by other Layers) ListData *fBottomItem;
*fCurrentItem, // pointer to the currect element in the list
*fFocusItem, // the focus WinBorder - for keyboard events // the last visible(or covered by other Layers)
*fFrontItem; // the one the mouse can bring in front as possible(in its set) 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 #endif