From 07dec7c1ca40591a25cc5203e5e2db6d81a8c163 Mon Sep 17 00:00:00 2001 From: DarkWyrm Date: Tue, 15 Jul 2003 23:27:50 +0000 Subject: [PATCH] CursorManager is initialized with default system cursors - need to add move cursor. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3990 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/server/AppServer.cpp | 11 +--- src/servers/app/server/CursorData.cpp | 76 ++++++++++++++++++++++++ src/servers/app/server/CursorData.h | 13 ++++ src/servers/app/server/CursorManager.cpp | 41 ++++++++++--- src/servers/app/server/CursorManager.h | 17 +----- 5 files changed, 124 insertions(+), 34 deletions(-) create mode 100644 src/servers/app/server/CursorData.h diff --git a/src/servers/app/server/AppServer.cpp b/src/servers/app/server/AppServer.cpp index 52b343a1da..772ecd4b4d 100644 --- a/src/servers/app/server/AppServer.cpp +++ b/src/servers/app/server/AppServer.cpp @@ -116,17 +116,8 @@ AppServer::AppServer(void) // Create the cursor manager. Object declared in CursorManager.cpp cursormanager=new CursorManager(); - - // Default cursor data stored in CursorData.cpp - - // TODO: fix the cursor display - extern int8 default_cursor_data[]; - ServerCursor *sc=new ServerCursor(default_cursor_data); - - cursormanager->AddCursor(sc); - cursormanager->ChangeCursor(B_CURSOR_DEFAULT, sc->ID()); cursormanager->SetCursor(B_CURSOR_DEFAULT); - + // Create the bitmap allocator. Object declared in BitmapManager.cpp bitmapmanager=new BitmapManager(); diff --git a/src/servers/app/server/CursorData.cpp b/src/servers/app/server/CursorData.cpp index 008adcaefe..2053562967 100644 --- a/src/servers/app/server/CursorData.cpp +++ b/src/servers/app/server/CursorData.cpp @@ -1,3 +1,29 @@ +//------------------------------------------------------------------------------ +// Copyright (c) 2001-2002, OpenBeOS +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// +// File Name: CursorData.cpp +// Author: DarkWyrm +// Description: File containing default cursor data +// +//------------------------------------------------------------------------------ #include /* @@ -64,6 +90,56 @@ int8 default_cursor_data[] = { 0,0 }; +int8 default_text_data[] = { + 0x10, 0x01, 0x07, 0x07, 0x00, 0x00, 0x06, 0xC0, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x06, 0xC0, 0x00, 0x00, 0x06, 0xC0, 0x0F, 0xE0, 0x07, 0xC0, 0x03, 0x80, + 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x07, 0xC0, 0x0F, 0xE0, + 0x06, 0xC0 +}; + +int8 default_drag_data[] = { + 0x10, 0x01, 0x00, 0x00, 0xFF, 0x00, 0x81, 0x00, 0x82, 0x00, 0x82, 0x00, 0x81, 0xFF, 0x80, 0x81, 0xB0, 0x41, 0xC8, 0x41, 0x04, 0x81, + 0x03, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x03, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFE, 0x00, 0xFE, 0x00, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCF, 0xFF, 0x07, 0xFF, 0x03, 0xFF, 0x03, 0xFF, 0x03, 0xFF, 0x03, 0xFF, 0x03, 0xFF, 0x03, 0xFF, + 0x03, 0xFF +}; + +int8 default_resize_data[] = { + 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x3E, 0x78, 0x1E, 0x70, 0x0E, 0x68, 0x16, 0x44, 0x22, 0x02, 0x40, 0x01, 0x80, 0x01, 0x80, + 0x02, 0x40, 0x44, 0x22, 0x68, 0x16, 0x70, 0x0E, 0x78, 0x1E, 0x7C, 0x3E, 0x00, 0x00, 0xFE, 0x7F, 0xFE, 0x7F, 0xFC, 0x3F, 0xF8, 0x1F, + 0xFC, 0x3F, 0xEE, 0x77, 0xC7, 0xE3, 0x03, 0xC0, 0x03, 0xC0, 0xC7, 0xE3, 0xEE, 0x77, 0xFC, 0x3F, 0xF8, 0x1F, 0xFC, 0x3F, 0xFE, 0x7F, + 0xFE, 0x7F +}; + +int8 default_resize_ew_data[] = { + 0x10, 0x01, 0x07, 0x07, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x11, 0x10, 0x31, 0x18, 0x71, 0x1C, 0x71, 0x1C, + 0x31, 0x18, 0x11, 0x10, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x80, 0x03, 0x80, 0x0B, 0xA0, + 0x1B, 0xB0, 0x3B, 0xB8, 0x7B, 0xBC, 0xFB, 0xBE, 0xFB, 0xBE, 0x7B, 0xBC, 0x3B, 0xB8, 0x1B, 0xB0, 0x0B, 0xA0, 0x03, 0x80, 0x03, 0x80, + 0x01, 0x00 +}; + +int8 default_resize_ns_data[] = { + 0x10, 0x01, 0x07, 0x07, 0x00, 0x00, 0x01, 0x80, 0x03, 0xC0, 0x07, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xFE, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x07, 0xE0, 0x03, 0xC0, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x03, 0xC0, 0x07, 0xE0, 0x0F, 0xF0, + 0x1F, 0xF8, 0x00, 0x00, 0x7F, 0xFE, 0xFF, 0xFF, 0x7F, 0xFE, 0x00, 0x00, 0x1F, 0xF8, 0x0F, 0xF0, 0x07, 0xE0, 0x03, 0xC0, 0x01, 0x80, + 0x00, 0x00 +}; + +int8 default_resize_nwse_data[] = { + 0x10, 0x01, 0x08, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x08, 0x1E, 0x10, 0x1C, 0x20, 0x18, 0x40, 0x10, 0x80, 0x01, 0x08, + 0x02, 0x18, 0x04, 0x38, 0x08, 0x78, 0x10, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xCC, 0x3F, 0x9C, + 0x3F, 0x38, 0x3E, 0x70, 0x3C, 0xE4, 0x39, 0xCC, 0x33, 0x9C, 0x27, 0x3C, 0x0E, 0x7C, 0x1C, 0xFC, 0x39, 0xFC, 0x33, 0xFC, 0x00, 0x00, + 0x00, 0x00 +}; + +int8 default_resize_nesw_data[] = { + 0x10, 0x01, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xF8, 0x08, 0x78, 0x04, 0x38, 0x02, 0x18, 0x01, 0x08, 0x10, 0x80, + 0x18, 0x40, 0x1C, 0x20, 0x1E, 0x10, 0x1F, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0xFC, 0x39, 0xFC, + 0x1C, 0xFC, 0x0E, 0x7C, 0x27, 0x3C, 0x33, 0x9C, 0x39, 0xCC, 0x3C, 0xE4, 0x3E, 0x70, 0x3F, 0x38, 0x3F, 0x9C, 0x3F, 0xCC, 0x00, 0x00, + 0x00, 0x00 +}; + + // known good cursor data for testing rest of system int8 cross_cursor[] = {16,1,5,5, 14,0,4,0,4,0,4,0,128,32,241,224,128,32,4,0, diff --git a/src/servers/app/server/CursorData.h b/src/servers/app/server/CursorData.h new file mode 100644 index 0000000000..3f57417b3a --- /dev/null +++ b/src/servers/app/server/CursorData.h @@ -0,0 +1,13 @@ +#ifndef CURSORDATA_H_ +#define CURSORDATA_H_ + +extern int8 default_cursor_data[]; +extern int8 default_text_data[]; +extern int8 default_drag_data[]; +extern int8 default_resize_data[]; +extern int8 default_resize_ew_data[]; +extern int8 default_resize_ns_data[]; +extern int8 default_resize_nwse_data[]; +extern int8 default_resize_nesw_data[]; + +#endif diff --git a/src/servers/app/server/CursorManager.cpp b/src/servers/app/server/CursorManager.cpp index 79e1be4bf6..5c612b9eeb 100644 --- a/src/servers/app/server/CursorManager.cpp +++ b/src/servers/app/server/CursorManager.cpp @@ -28,6 +28,7 @@ #include "Desktop.h" #include "CursorManager.h" #include "ServerCursor.h" +#include "CursorData.h" #include #include @@ -44,15 +45,39 @@ CursorManager::CursorManager(void) _tokenizer.ExcludeValue(B_ERROR); // Set system cursors to "unassigned" - _defaultcsr=NULL; - _textcsr=NULL; + ServerCursor *cdefault=new ServerCursor(default_cursor_data); + AddCursor(cdefault); + _defaultcsr=cdefault; + + ServerCursor *ctext=new ServerCursor(default_text_data); + AddCursor(ctext); + _textcsr=ctext; + + ServerCursor *cdrag=new ServerCursor(default_drag_data); + AddCursor(cdrag); + _dragcsr=cdrag; + _movecsr=NULL; - _dragcsr=NULL; - _resizecsr=NULL; - _resize_nwse_csr=NULL; - _resize_nesw_csr=NULL; - _resize_ns_csr=NULL; - _resize_ew_csr=NULL; + + ServerCursor *cresize=new ServerCursor(default_resize_data); + AddCursor(cresize); + _resizecsr=cresize; + + ServerCursor *cresizeew=new ServerCursor(default_resize_ew_data); + AddCursor(cresizeew); + _resize_ew_csr=cresizeew; + + ServerCursor *cresizenesw=new ServerCursor(default_resize_nesw_data); + AddCursor(cresizenesw); + _resize_nesw_csr=cresizenesw; + + ServerCursor *cresizens=new ServerCursor(default_resize_ns_data); + AddCursor(cresizens); + _resize_ns_csr=cresizens; + + ServerCursor *cresizenwse=new ServerCursor(default_resize_nwse_data); + AddCursor(cresizenwse); + _resize_nwse_csr=cresizenwse; } //! Does all the teardown diff --git a/src/servers/app/server/CursorManager.h b/src/servers/app/server/CursorManager.h index 5af4f64f31..e73f93adb9 100644 --- a/src/servers/app/server/CursorManager.h +++ b/src/servers/app/server/CursorManager.h @@ -29,26 +29,11 @@ #include #include +#include #include "TokenHandler.h" class ServerCursor; -// Duplicate definition - do NOT include or errors will abound... -// We do this so that we don't have to modify R5's headers in order to compile -typedef enum -{ - B_CURSOR_DEFAULT=0, - B_CURSOR_TEXT, - B_CURSOR_MOVE, - B_CURSOR_DRAG, - B_CURSOR_RESIZE, - B_CURSOR_RESIZE_NWSE, - B_CURSOR_RESIZE_NESW, - B_CURSOR_RESIZE_NS, - B_CURSOR_RESIZE_EW, - B_CURSOR_OTHER -} cursor_which; - /*! \class CursorManager CursorManager.h \brief Handles almost all cursor management functions for the system