Massive reconfiguring to fix link problems with all things needing app_server so

urces


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3963 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm
2003-07-13 20:56:00 +00:00
parent df5f3cae53
commit 9381d29b6f
30 changed files with 281 additions and 271 deletions
+87
View File
@@ -0,0 +1,87 @@
//------------------------------------------------------------------------------
// 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: ColorSet.h
// Author: DarkWyrm <[email protected]>
// Description: Class for encapsulating GUI system colors
//
//
//------------------------------------------------------------------------------
#ifndef COLORSET_H_
#define COLORSET_H_
#include <Locker.h>
#include "RGBColor.h"
/*!
\class ColorSet ColorSet.h
\brief Encapsulates GUI system colors
*/
class ColorSet : public BLocker
{
public:
ColorSet(void);
ColorSet(const ColorSet &cs);
ColorSet & operator=(const ColorSet &cs);
void SetColors(const ColorSet &cs);
void PrintToStream(void) const;
RGBColor panel_background,
panel_text,
document_background,
document_text,
control_background,
control_text,
control_highlight,
control_border,
tooltip_background,
tooltip_text,
menu_background,
menu_selected_background,
menu_text,
menu_selected_text,
menu_selected_border,
keyboard_navigation_base,
keyboard_navigation_pulse,
success,
failure,
shine,
shadow,
window_tab,
// Not all of these guys don't exist in InterfaceDefs.h, but we keep
// them as part of the color set anyway - they're important nonetheless
window_tab_text,
inactive_window_tab,
inactive_window_tab_text;
};
void SetDefaultGUIColors(ColorSet *set);
bool LoadGUIColors(ColorSet *set);
void SaveGUIColors(const ColorSet &set);
#endif
+131
View File
@@ -0,0 +1,131 @@
//------------------------------------------------------------------------------
// 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: Decorator.h
// Author: DarkWyrm <[email protected]>
// Description: Base class for window decorators
//
//------------------------------------------------------------------------------
#ifndef _DECORATOR_H_
#define _DECORATOR_H_
#include <SupportDefs.h>
#include <Rect.h>
#include <Region.h>
#include <String.h>
#include <Window.h>
#include "LayerData.h"
#include "ColorSet.h"
class DisplayDriver;
typedef enum { CLICK_NONE=0, CLICK_ZOOM, CLICK_CLOSE, CLICK_MINIMIZE,
CLICK_TAB, CLICK_DRAG, CLICK_MOVETOBACK, CLICK_MOVETOFRONT, CLICK_SLIDETAB,
CLICK_RESIZE, CLICK_RESIZE_L, CLICK_RESIZE_T,
CLICK_RESIZE_R, CLICK_RESIZE_B, CLICK_RESIZE_LT, CLICK_RESIZE_RT,
CLICK_RESIZE_LB, CLICK_RESIZE_RB } click_type;
class Decorator
{
public:
Decorator(BRect rect, int32 wlook, int32 wfeel, int32 wflags);
virtual ~Decorator(void);
void SetColors(const ColorSet &cset);
void SetDriver(DisplayDriver *driver);
void SetFlags(int32 wflags);
void SetFeel(int32 wfeel);
void SetLook(int32 wlook);
void SetClose(bool is_down);
void SetMinimize(bool is_down);
void SetZoom(bool is_down);
virtual void SetTitle(const char *string);
int32 GetLook(void);
int32 GetFeel(void);
int32 GetFlags(void);
const char *GetTitle(void);
bool GetClose(void);
bool GetMinimize(void);
bool GetZoom(void);
void SetFocus(bool is_active);
bool GetFocus(void) { return _has_focus; };
ColorSet GetColors(void) { return (_colors)?*_colors:ColorSet(); }
virtual BRect SlideTab(float dx, float dy=0);
virtual BRegion *GetFootprint(void);
virtual click_type Clicked(BPoint pt, int32 buttons, int32 modifiers);
virtual void MoveBy(float x, float y);
virtual void MoveBy(BPoint pt);
virtual void ResizeBy(float x, float y);
virtual void ResizeBy(BPoint pt);
virtual void Draw(BRect r);
virtual void Draw(void);
virtual void DrawClose(void);
virtual void DrawFrame(void);
virtual void DrawMinimize(void);
virtual void DrawTab(void);
virtual void DrawTitle(void);
virtual void DrawZoom(void);
protected:
int32 _ClipTitle(float width);
/*!
\brief Returns the number of characters in the title
\return The title character count
*/
int32 _TitleWidth(void) { return (_title_string)?_title_string->CountChars():0; }
virtual void _DrawClose(BRect r);
virtual void _DrawFrame(BRect r);
virtual void _DrawMinimize(BRect r);
virtual void _DrawTab(BRect r);
virtual void _DrawTitle(BRect r);
virtual void _DrawZoom(BRect r);
virtual void _SetFocus(void);
virtual void _DoLayout(void);
virtual void _SetColors(void);
ColorSet *_colors;
DisplayDriver *_driver;
LayerData _layerdata;
int32 _look, _feel, _flags;
BRect _zoomrect,_closerect,_minimizerect,_tabrect,_frame,
_resizerect,_borderrect;
private:
bool _close_state, _zoom_state, _minimize_state;
bool _has_focus;
BString *_title_string;
};
typedef float get_version(void);
typedef Decorator *create_decorator(BRect rect, int32 wlook, int32 wfeel, int32 wflags);
#endif
+186
View File
@@ -0,0 +1,186 @@
//------------------------------------------------------------------------------
// 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: DisplayDriver.h
// Author: DarkWyrm <[email protected]>
// Description: Mostly abstract class which handles all graphics output
// for the server
//
//------------------------------------------------------------------------------
#ifndef _DISPLAY_DRIVER_H_
#define _DISPLAY_DRIVER_H_
#include <GraphicsCard.h>
#include <OS.h>
#include <View.h>
#include <Font.h>
#include <Rect.h>
#include <Locker.h>
#include "RGBColor.h"
#include <Region.h>
class ServerCursor;
class ServerBitmap;
class LayerData;
#ifndef ROUND
#define ROUND(a) ( (long)(a+.5) )
#endif
/*!
\brief Data structure for passing cursor information to hardware drivers.
*/
typedef struct
{
uchar *xormask, *andmask;
int32 width, height;
int32 hotx, hoty;
} cursor_data;
#ifndef HOOK_DEFINE_CURSOR
#define HOOK_DEFINE_CURSOR 0
#define HOOK_MOVE_CURSOR 1
#define HOOK_SHOW_CURSOR 2
#define HOOK_DRAW_LINE_8BIT 3
#define HOOK_DRAW_LINE_16BIT 12
#define HOOK_DRAW_LINE_32BIT 4
#define HOOK_DRAW_RECT_8BIT 5
#define HOOK_DRAW_RECT_16BIT 13
#define HOOK_DRAW_RECT_32BIT 6
#define HOOK_BLIT 7
#define HOOK_DRAW_ARRAY_8BIT 8
#define HOOK_DRAW_ARRAY_16BIT 14 // Not implemented in current R5 drivers
#define HOOK_DRAW_ARRAY_32BIT 9
#define HOOK_SYNC 10
#define HOOK_INVERT_RECT 11
#endif
/*!
\class DisplayDriver DisplayDriver.h
\brief Mostly abstract class which handles all graphics output for the server.
The DisplayDriver is called in order to handle all messiness associated with
a particular rendering context, such as the screen, and the methods to
handle organizing information related to it along with writing to the context
itself.
While all virtual functions are technically optional, the default versions
do very little, so implementing them all more or less required.
*/
class DisplayDriver
{
public:
DisplayDriver(void);
virtual ~DisplayDriver(void);
virtual bool Initialize(void);
virtual void Shutdown(void);
virtual void CopyBits(BRect src, BRect dest);
virtual void CopyRegion(BRegion *src, const BPoint &lefttop);
virtual void DrawBitmap(ServerBitmap *bmp, BRect src, BRect dest, LayerData *d);
virtual void DrawString(const char *string, int32 length, BPoint pt, LayerData *d, escapement_delta *delta=NULL);
virtual void FillArc(BRect r, float angle, float span, LayerData *d, int8 *pat);
virtual void FillBezier(BPoint *pts, LayerData *d, int8 *pat);
virtual void FillEllipse(BRect r, LayerData *d, int8 *pat);
virtual void FillPolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, int8 *pat);
virtual void FillRect(BRect r, LayerData *d, int8 *pat);
virtual void FillRegion(BRegion *r, LayerData *d, int8 *pat);
virtual void FillRoundRect(BRect r, float xrad, float yrad, LayerData *d, int8 *pat);
// virtual void FillShape(SShape *sh, LayerData *d, int8 *pat);
virtual void FillTriangle(BPoint *pts, BRect r, LayerData *d, int8 *pat);
virtual void HideCursor(void);
virtual bool IsCursorHidden(void);
virtual void MoveCursorTo(float x, float y);
virtual void InvertRect(BRect r);
virtual void ShowCursor(void);
virtual void ObscureCursor(void);
virtual void SetCursor(ServerCursor *cursor);
virtual void StrokeArc(BRect r, float angle, float span, LayerData *d, int8 *pat);
virtual void StrokeBezier(BPoint *pts, LayerData *d, int8 *pat);
virtual void StrokeEllipse(BRect r, LayerData *d, int8 *pat);
virtual void StrokeLine(BPoint start, BPoint end, LayerData *d, int8 *pat);
virtual void StrokePolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, int8 *pat, bool is_closed=true);
virtual void StrokeRect(BRect r, LayerData *d, int8 *pat);
virtual void StrokeRegion(BRegion *r, LayerData *d, int8 *pat);
virtual void StrokeRoundRect(BRect r, float xrad, float yrad, LayerData *d, int8 *pat);
// virtual void StrokeShape(SShape *sh, LayerData *d, int8 *pat);
virtual void StrokeTriangle(BPoint *pts, BRect r, LayerData *d, int8 *pat);
virtual void StrokeLineArray(BPoint *pts, int32 numlines, RGBColor *colors, LayerData *d);
virtual void SetMode(int32 mode);
virtual bool DumpToFile(const char *path);
virtual ServerBitmap *DumpToBitmap(void);
virtual float StringWidth(const char *string, int32 length, LayerData *d);
virtual float StringHeight(const char *string, int32 length, LayerData *d);
virtual void GetBoundingBoxes(const char *string, int32 count, font_metric_mode mode,
escapement_delta *delta, BRect *rectarray, LayerData *d);
virtual void GetEscapements(const char *string, int32 charcount, escapement_delta *delta,
escapement_delta *escapements, escapement_delta *offsets, LayerData *d);
virtual void GetEdges(const char *string, int32 charcount, edge_info *edgearray, LayerData *d);
virtual void GetHasGlyphs(const char *string, int32 charcount, bool *hasarray);
virtual void GetTruncatedStrings( const char **instrings, int32 stringcount, uint32 mode,
float maxwidth, char **outstrings);
virtual status_t SetDPMSState(uint32 state);
uint32 GetDPMSState(void);
uint32 GetDPMSCapabilities(void);
uint8 GetDepth(void);
uint16 GetHeight(void);
uint16 GetWidth(void);
uint32 GetBytesPerRow(void);
int32 GetMode(void);
bool IsCursorObscured(bool state);
protected:
bool _Lock(bigtime_t timeout=B_INFINITE_TIMEOUT);
void _Unlock(void);
void _SetDepth(uint8 d);
void _SetHeight(uint16 h);
void _SetWidth(uint16 w);
void _SetMode(int32 m);
void _SetBytesPerRow(uint32 bpr);
void _SetDPMSCapabilities(uint32 caps);
void _SetDPMSState(uint32 state);
ServerCursor *_GetCursor(void);
private:
BLocker *_locker;
uint8 _buffer_depth;
uint16 _buffer_width;
uint16 _buffer_height;
int32 _buffer_mode;
uint32 _bytes_per_row;
bool _is_cursor_hidden;
bool _is_cursor_obscured;
ServerCursor *_cursor;
uint32 _dpms_state;
uint32 _dpms_caps;
};
#endif
+162
View File
@@ -0,0 +1,162 @@
//------------------------------------------------------------------------------
// 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: FontFamily.h
// Author: DarkWyrm <[email protected]>
// Description: classes to represent font styles and families
//
//------------------------------------------------------------------------------
#ifndef FONT_FAMILY_H_
#define FONT_FAMILY_H_
#include <String.h>
#include <Rect.h>
#include <Font.h>
#include <List.h>
#include <ft2build.h>
#include FT_FREETYPE_H
#include "SharedObject.h"
class FontFamily;
class ServerFont;
enum font_format
{
FONT_TRUETYPE=0,
FONT_TYPE_1,
FONT_OPENTYPE,
FONT_BDF,
FONT_CFF,
FONT_CID,
FONT_PCF,
FONT_PFR,
FONT_SFNT,
FONT_TYPE_42,
FONT_WINFONT,
};
//! data structure used by the FreeType cache manager
typedef struct CachedFaceRec_
{
BString file_path;
int face_index;
} CachedFaceRec, *CachedFace;
/*!
\class FontStyle FontFamily.h
\brief Object used to represent a font style
FontStyle objects help abstract a lot of the font engine details while
still offering plenty of information the style in question.
*/
class FontStyle : public SharedObject
{
public:
FontStyle(const char *filepath, FT_Face face);
~FontStyle(void);
ServerFont *Instantiate(float size, float rotation=0.0, float shear=90.0);
/*!
\fn bool FontStyle::IsFixedWidth(void)
\brief Determines whether the font's character width is fixed
\return true if fixed, false if not
*/
bool IsFixedWidth(void) { return is_fixedwidth; }
/*!
\fn bool FontStyle::IsScalable(void)
\brief Determines whether the font can be scaled to any size
\return true if scalable, false if not
*/
bool IsScalable(void) { return is_scalable; }
/*!
\fn bool FontStyle::HasKerning(void)
\brief Determines whether the font has kerning information
\return true if kerning info is available, false if not
*/
bool HasKerning(void) { return has_kerning; }
/*!
\fn bool FontStyle::HasTuned(void)
\brief Determines whether the font contains strikes
\return true if it has strikes included, false if not
*/
bool HasTuned(void) { return has_bitmaps; }
/*!
\fn bool FontStyle::TunedCount(void)
\brief Returns the number of strikes the style contains
\return The number of strikes the style contains
*/
int32 TunedCount(void) { return tunedcount; }
/*!
\fn bool FontStyle::GlyphCount(void)
\brief Returns the number of glyphs in the style
\return The number of glyphs the style contains
*/
uint16 GlyphCount(void) { return glyphcount; }
/*!
\fn bool FontStyle::CharMapCount(void)
\brief Returns the number of character maps the style contains
\return The number of character maps the style contains
*/
uint16 CharMapCount(void) { return charmapcount; }
const char *Name(void);
FontFamily *Family(void) { return family; }
FT_Face GetFace(void);
const char *GetPath(void);
int16 ConvertToUnicode(uint16 c);
protected:
friend class FontFamily;
FontFamily *family;
uint16 glyphcount, charmapcount;
BString *name, *path;
BList *instances;
bool is_fixedwidth, is_scalable, has_kerning, has_bitmaps;
int32 tunedcount;
CachedFace cachedface;
uint8 format;
BRect fbounds;
};
/*!
\class FontFamily FontFamily.h
\brief Class representing a collection of similar styles
FontFamily objects bring together many styles of the same face, such as
Arial Roman, Arial Italic, Arial Bold, etc.
*/
class FontFamily : public SharedObject
{
public:
FontFamily(const char *namestr);
~FontFamily(void);
const char *Name(void);
void AddStyle(const char *path, FT_Face face);
void RemoveStyle(const char *style);
bool HasStyle(const char *style);
int32 CountStyles(void);
const char *GetStyle(int32 index);
FontStyle *GetStyle(const char *style);
protected:
BString *name;
BList *styles;
};
#endif
+54
View File
@@ -0,0 +1,54 @@
#ifndef LAYERDATA_H_
#define LAYERDATA_H_
#include <Point.h>
#include <Font.h>
#include "RGBColor.h"
//#include "FontServer.h"
#include "ServerFont.h"
class ServerBitmap;
class LayerData
{
public:
LayerData(void)
{
pensize=1.0;
penlocation.Set(0,0);
draw_mode=B_OP_COPY;
blending_mode=B_ALPHA_OVERLAY;
alpha_mode=B_CONSTANT_ALPHA;
background=NULL;
overlay=NULL;
highcolor.SetColor(0,0,0,255);
lowcolor.SetColor(255,255,255,255);
viewcolor.SetColor(255,255,255,255);
// font=fontserver->GetSystemPlain();
font=NULL;
scale=1.0;
edelta.space=0;
edelta.nonspace=0;
}
~LayerData(void)
{
if(font)
{
delete font;
font=NULL;
}
}
float pensize;
BPoint penlocation;
drawing_mode draw_mode;
source_alpha alpha_mode;
alpha_function blending_mode;
ServerBitmap *background;
ServerBitmap *overlay;
RGBColor highcolor, lowcolor, viewcolor;
ServerFont *font;
float scale;
escapement_delta edelta;
};
#endif
@@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// 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: PatternHandler.h
// Author: DarkWyrm <[email protected]>
// Description: Class for easy calculation and use of patterns
//
//------------------------------------------------------------------------------
#ifndef PATTERNHADLER_H
#include <SupportDefs.h>
#include "RGBColor.h"
typedef union
{
uint64 type64;
int8 type8[8];
} pattern_union;
/*!
\brief Class for easy calculation and use of patterns
PatternHandlers are designed specifically for DisplayDriver subclasses.
Pattern support can be easily added by setting the pattern to use via
SetTarget, and then merely retrieving the value for the coordinates
specified.
*/
class PatternHandler
{
public:
PatternHandler(void);
PatternHandler(int8 *pat);
~PatternHandler(void);
void SetTarget(int8 *pat);
void SetColors(const RGBColor &high, const RGBColor &low);
RGBColor GetColor(const BPoint &pt);
RGBColor GetColor(const float &x, const float &y);
bool GetValue(const float &x, const float &y);
bool GetValue(const BPoint &pt);
private:
pattern_union _pat;
RGBColor *_high,*_low;
};
#endif
+77
View File
@@ -0,0 +1,77 @@
//------------------------------------------------------------------------------
// 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: RGBColor.h
// Author: DarkWyrm <[email protected]>
// Description: Color encapsulation class for the app_server
//
//------------------------------------------------------------------------------
#ifndef RGBCOLOR_H_
#define RGBCOLOR_H_
#include <GraphicsDefs.h>
/*!
\class RGBColor RGBColor.h
\brief A color class to encapsulate color space ugliness in the app_server
RGBColors can be used to perform tasks much more difficult using rgb_colors. This
class is limited to the app_server because of the access to the system palette for
looking up the 32-bit value to each color index.
*/
class RGBColor
{
public:
RGBColor(uint8 r, uint8 g, uint8 b, uint8 a=255);
RGBColor(int r, int g, int b, int a=255);
RGBColor(const rgb_color &col);
RGBColor(uint16 col);
RGBColor(uint8 col);
RGBColor(const RGBColor &col);
RGBColor(void);
void PrintToStream(void) const;
uint8 GetColor8(void) const;
uint16 GetColor16(void) const;
rgb_color GetColor32(void) const;
void SetColor(uint8 r, uint8 g, uint8 b, uint8 a=255);
void SetColor(int r, int g, int b, int a=255);
void SetColor(uint16 color16);
void SetColor(uint8 color8);
void SetColor(const rgb_color &color);
void SetColor(const RGBColor &col);
RGBColor MakeBlendColor(const RGBColor &color, const float &position);
RGBColor & operator=(const RGBColor &col);
RGBColor & operator=(const rgb_color &col);
bool operator==(const rgb_color &col);
bool operator==(const RGBColor &col);
protected:
rgb_color color32;
uint16 color16;
uint8 color8;
};
#endif
+38
View File
@@ -0,0 +1,38 @@
//------------------------------------------------------------------------------
// 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: RectUtils.h
// Author: DarkWyrm <[email protected]>
// Description: Utilities for work around R5 Interface Kit bugs
//
//------------------------------------------------------------------------------
#ifndef RECTUTILS_H_
#define RECTUTILS_H_
#include <Rect.h>
#include <Region.h>
bool TestLineIntersection(const BRect&r, float x1, float y1, float x2, float y2,bool vertical=true);
bool TestRectIntersection(const BRect &r,const BRect &r2);
bool TestRegionIntersection(BRegion *r,const BRect &r2);
void IntersectRegionWith(BRegion *r,const BRect &r2);
void ValidateRect(BRect *r);
#endif
+117
View File
@@ -0,0 +1,117 @@
//------------------------------------------------------------------------------
// 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: ServerBitmap.h
// Author: DarkWyrm <[email protected]>
// Description: Bitmap class used inside the server
//
//------------------------------------------------------------------------------
#ifndef _SERVER_BITMAP_H_
#define _SERVER_BITMAP_H_
#include <GraphicsDefs.h>
#include <Rect.h>
#include <OS.h>
class BitmapManager;
/*!
\class ServerBitmap ServerBitmap.h
\brief Bitmap class used inside the server.
This class is not directly allocated or freed. Instead, it is
managed by the BitmapManager class. It is also the base class for
all cursors. Every BBitmap has a shadow ServerBitmap object.
*/
class ServerBitmap
{
public:
ServerBitmap(BRect rect,color_space space, int32 flags,
int32 bytesperline=-1, screen_id screen=B_MAIN_SCREEN_ID);
ServerBitmap(const ServerBitmap *bmp);
~ServerBitmap(void);
/*!
\brief Returns the area in which the buffer resides
\return
- \c B_ERROR if the buffer is not allocated in an area
- area_id for the buffer
*/
area_id Area(void) { return _area; }
// Returns the offset of the bitmap in its area
int32 AreaOffset(void) { return _offset; }
//! Returns the bitmap's buffer
uint8 *Bits(void) { return _buffer; }
uint32 BitsLength(void);
//! Returns the size of the bitmap
BRect Bounds() { return BRect(0,0,_width-1,_height-1); };
//! Returns the number of bytes in each row, including padding
int32 BytesPerRow(void) { return _bytesperrow; };
//! Returns the pixel color depth
uint8 BitsPerPixel(void) { return _bpp; }
//! Returns the color space of the bitmap
color_space ColorSpace(void) { return _space; }
//! Returns the width of the bitmap
int32 Width(void) const { return _width; }
//! Returns the height of the bitmap
int32 Height(void) const { return _height; }
//! Returns whether the bitmap is valid
bool InitCheck(void) { return _initialized; }
//! Returns the identifier token for the bitmap
int32 Token(void) { return _token; }
protected:
friend class BitmapManager;
//! Internal function used by the BitmapManager.
void _SetArea(area_id ID) { _area=ID; }
//! Internal function used by the BitmapManager.
void _SetBuffer(void *ptr) { _buffer=(uint8*)ptr; }
void _AllocateBuffer(void);
void _FreeBuffer(void);
void _HandleSpace(color_space space, int32 bytesperline=-1);
bool _initialized;
area_id _area;
uint8 *_buffer;
int32 _width,_height;
int32 _bytesperrow;
color_space _space;
int32 _flags;
int _bpp;
int32 _token;
int32 _offset;
};
#endif
@@ -0,0 +1,82 @@
#ifndef _APPSERVER_CONFIG_H
#define _APPSERVER_CONFIG_H
// This is defined to place the server in test mode, which modifies certain things like
// system keyboard shortcuts. Note that it is possible, though senseless, to place it in
// regular mode and still use a display driver which depends on the R5 app_server
#define TEST_MODE
// The ViewDriver is a BView/BWindow combination. Plenty of functionality,
// but dog-slow.
#define VIEWDRIVER 0
// The ScreenDriver utilizes a BWindowScreen to directly access the video
// hardware.
#define SCREENDRIVER 1
// The SecondDriver allows the server to make use of a second video card while
// still running as a regular BeOS application. You could say it's training
// wheels for the HWDriver
#define SECONDDRIVER 2
// The HWDriver is the real thing - loads all the graphics hardware and
// literally takes over the system as the app_server is supposed to. This
// one can be used only when the app_server is running as *the* app_server
// and not in testing mode like the other drivers are for.
#define HWDRIVER 3
// Display driver to be used by the server.
#define DISPLAYDRIVER VIEWDRIVER
// Uncomment this if the DisplayDriver should only rely on drawing functions implemented
// in software even though hardware-accelerated functions are available
//#define DISABLE_HARDWARE_ACCELERATION
// Define this for a quick hack to test some of the drawing functions
//#define DISPLAYDRIVER_TEST_HACK
// Define this if you want the display driver to emulate the input server.
// Comment this out if DISPLAYDRIVER is defined as HWDRIVER.
#define ENABLE_INPUT_SERVER_EMULATION
// This is the application signature of our app_server when running as a
// regular application. When running as the app_server, this is not used.
#define SERVER_SIGNATURE "application/x-vnd.obe-OBAppServer"
// Directory for all app_server-related settings. Must include ending slash.
#define SERVER_SETTINGS_DIR "/boot/home/config/settings/app_server/"
// Flattened list of usable fonts maintained by the server. The file is a
// flattened BMessage which is used for caching the names when obtained
// by the various font functions.
#define SERVER_FONT_LIST "/boot/home/config/settings/app_server/fontlist"
// folder used to keep saved color sets for the UI - tab color, etc.
#define COLOR_SET_DIR "/boot/home/config/settings/color_sets/"
// name of the file containing the current UI color settings
#define COLOR_SETTINGS_NAME "system_colors"
// name of the file containing the config data for the desktop
#define WORKSPACE_SETTINGS_NAME "workspace_data"
// Folder for additional window decorators
#define DECORATORS_DIR "/boot/home/config/add-ons/decorators/"
// These definitions provide the server something to use for default
// system fonts.
#define DEFAULT_PLAIN_FONT_FAMILY "Swis721 BT"
#define DEFAULT_PLAIN_FONT_STYLE "Roman"
#define DEFAULT_PLAIN_FONT_SIZE 12
#define DEFAULT_BOLD_FONT_FAMILY "Swis721 BT"
#define DEFAULT_BOLD_FONT_STYLE "Bold"
#define DEFAULT_BOLD_FONT_SIZE 12
#define DEFAULT_FIXED_FONT_FAMILY "Courier10 BT"
#define DEFAULT_FIXED_FONT_STYLE "Roman"
#define DEFAULT_FIXED_FONT_SIZE 12
// This is the port capacity for all monitoring objects - ServerApps
// and ServerWindows
#define DEFAULT_MONITOR_PORT_SIZE 30
#endif
@@ -0,0 +1,69 @@
//------------------------------------------------------------------------------
// 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: ServerCursor.h
// Author: DarkWyrm <[email protected]>
// Description: Glorified ServerBitmap used for cursor work.
//
//------------------------------------------------------------------------------
#ifndef SERVERCURSOR_H_
#define SERVERCURSOR_H_
#include <Point.h>
#include "ServerBitmap.h"
class ServerApp;
class CursorManager;
/*!
\class ServerCursor ServerCursor.h
\brief Class to handle all cursor capabilities for the system
Although descended from ServerBitmaps, ServerCursors are not handled by
the BitmapManager - they are allocated like any other object. Unlike BeOS
R5, cursors can be any size or color space, and this class accomodates and
expands the R5 API.
*/
class ServerCursor : public ServerBitmap
{
public:
ServerCursor(BRect r, color_space cspace, int32 flags, BPoint hotspot, int32 bytesperrow=-1, screen_id screen=B_MAIN_SCREEN_ID);
ServerCursor(int8 *data);
ServerCursor(const ServerCursor *cursor);
~ServerCursor(void);
//! Returns the cursor's hot spot
BPoint GetHotSpot(void) { return _hotspot; }
void SetHotSpot(BPoint pt);
const char *GetAppSignature(void) { return _app_signature; }
void SetAppSignature(const char *signature);
//! Returns the cursor's ID
int32 ID(void) { return _token; }
private:
friend class CursorManager;
BPoint _hotspot;
char *_app_signature;
int32 _token;
};
#endif
+83
View File
@@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// 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: ServerFont.h
// Author: DarkWyrm <[email protected]>
// Description: Shadow BFont class
//
//------------------------------------------------------------------------------
#ifndef SERVERFONT_H_
#define SERVERFONT_H_
#include <Rect.h>
#include <Font.h>
class FontStyle;
class ServerFont
{
public:
ServerFont(FontStyle *fstyle, float fsize=12.0, float frotation=0.0, float fshear=90.0,
uint16 flags=0, uint8 spacing=B_CHAR_SPACING);
ServerFont(const ServerFont &font);
~ServerFont(void);
font_direction Direction(void) { return fdirection; }
uint8 Encoding(void) { return fencoding; }
edge_info Edges(void) { return fedges; }
uint32 Flags(void) { return fflags; }
uint8 Spacing(void) { return fspacing; }
float Shear(void) { return fshear; }
float Rotation(void) { return frotation; }
float Size(void) { return fsize; }
uint16 Face(void) { return fface; }
uint32 CountGlyphs(void);
int32 CountTuned(void);
font_file_format FileFormat(void);
FontStyle *Style(void) { return fstyle; }
void SetDirection(const font_direction &dir) { fdirection=dir; }
void SetEdges(const edge_info &info) { fedges=info; }
void SetEncoding(uint8 encoding) { fencoding=encoding; }
void SetFlags(const uint32 &value) { fflags=value; }
void SetSpacing(const uint8 &value) { fspacing=value; }
void SetShear(const float &value) { fshear=value; }
void SetSize(const float &value) { fsize=value; }
void SetRotation(const float &value) { frotation=value; }
void SetFace(const uint16 &value) { fface=value; }
BRect BoundingBox(void);
void Height(font_height *fh);
protected:
friend class FontStyle;
FontStyle *fstyle;
font_height fheight;
edge_info fedges;
float fsize, frotation, fshear;
BRect fbounds;
uint32 fflags;
uint8 fspacing;
uint16 fface;
font_direction fdirection;
uint8 ftruncate;
uint8 fencoding;
};
#endif
@@ -0,0 +1,55 @@
//------------------------------------------------------------------------------
// 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: SharedObject.h
// Author: DarkWyrm <[email protected]>
// Description: This class is used as a base class for other objects which
// must be shared. By using this, objects which depend on its
// existence can be somewhat sure that the shared object will
// not be deleted until nothing depends on it.
//
//------------------------------------------------------------------------------
#ifndef SHAREDOBJ_H_
#define SHAREDOBJ_H_
#include <SupportDefs.h>
/*!
\class SharedObject SharedObject.h
\brief Base class for shared objects
SharedObjects track dependencies upon a particular object. In this way, is is
possible to ensure that a shared resource is not deleted if something else
needs it. How the dependency tracking is done largely depends on the child class.
*/
class SharedObject
{
public:
SharedObject(void) { dependents=0; }
virtual ~SharedObject(void){}
virtual void AddDependent(void) { dependents++; }
virtual void RemoveDependent(void) { dependents--; }
virtual bool HasDependents(void) { return (dependents>0)?true:false; }
private:
uint32 dependents;
};
#endif
@@ -0,0 +1,36 @@
//------------------------------------------------------------------------------
// 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: SystemPalette.h
// Author: DarkWyrm <[email protected]>
// Description: One global function to generate the palette which is
// the default BeOS System palette and the variable to go with it
//
//------------------------------------------------------------------------------
#ifndef _SYSTEM_PALETTE_H_
#define _SYSTEM_PALETTE_H_
#include <GraphicsDefs.h>
void GenerateSystemPalette(rgb_color *palette);
extern rgb_color system_palette[];
#endif