Merging Baldur's updates
This commit is contained in:
@@ -22,7 +22,7 @@ interface
|
||||
|
||||
uses
|
||||
beobj, view, message, archivable, SupportDefs, rect, list,
|
||||
handler, messenger,interfacedefs,font,graphicdefs;
|
||||
handler, messenger,interfacedefs,font,graphicdefs,clipboard;
|
||||
type
|
||||
text_run = Record
|
||||
offset : LongInt;
|
||||
@@ -85,12 +85,12 @@ type
|
||||
function CountLines : integer;
|
||||
function CurrentLine : integer;
|
||||
procedure GoToLine(lineNum : integer);
|
||||
{ procedure Cut(clipboard : TClipboard);
|
||||
procedure Copy(clipboard : TClipboard);
|
||||
procedure Paste(clipboard : TClipboard);
|
||||
procedure Cut(clipboard : BClipboard);
|
||||
procedure Copy(clipboard : BClipboard);
|
||||
procedure Paste(clipboard : BClipboard);
|
||||
procedure Clear;
|
||||
function AcceptsPaste(clipboard : TClipboard) : boolean;
|
||||
} function AcceptsDrop(inMessage : BMessage) : boolean;
|
||||
function AcceptsPaste(clipboard : BClipboard) : boolean;
|
||||
// function AcceptsDrop(inMessage : BMessage) : boolean;
|
||||
procedure Select(startOffset : integer; endOffset : integer);
|
||||
procedure SelectAll;
|
||||
// procedure GetSelection(outStart : integer; outEnd : integer);
|
||||
@@ -193,11 +193,11 @@ function BTextView_ByteAt(AObject : TCPlusObject; offset : integer) : PChar; cd
|
||||
function BTextView_CountLines(AObject : TCPlusObject) : integer; cdecl; external BePascalLibName name 'BTextView_CountLines';
|
||||
function BTextView_CurrentLine(AObject : TCPlusObject) : integer; cdecl; external BePascalLibName name 'BTextView_CurrentLine';
|
||||
procedure BTextView_GoToLine(AObject : TCPlusObject; lineNum : integer); cdecl; external BePascalLibName name 'BTextView_GoToLine';
|
||||
//procedure BTextView_Cut(AObject : TCPlusObject; clipboard : TClipboard); cdecl; external BePascalLibName name 'BTextView_Cut';
|
||||
//procedure BTextView_Copy(AObject : TCPlusObject; clipboard : TClipboard); cdecl; external BePascalLibName name 'BTextView_Copy';
|
||||
//procedure BTextView_Paste(AObject : TCPlusObject; clipboard : TClipboard); cdecl; external BePascalLibName name 'BTextView_Paste';
|
||||
procedure BTextView_Cut(AObject : TCPlusObject; clipboard : TCPlusObject); cdecl; external BePascalLibName name 'BTextView_Cut';
|
||||
procedure BTextView_Copy(AObject : TCPlusObject; clipboard : TCPlusObject); cdecl; external BePascalLibName name 'BTextView_Copy';
|
||||
procedure BTextView_Paste(AObject : TCPlusObject; clipboard : TCPlusObject); cdecl; external BePascalLibName name 'BTextView_Paste';
|
||||
procedure BTextView_Clear(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BTextView_Clear';
|
||||
//function BTextView_AcceptsPaste(AObject : TCPlusObject; clipboard : TClipboard) : boolean; cdecl; external BePascalLibName name 'BTextView_AcceptsPaste';
|
||||
function BTextView_AcceptsPaste(AObject : TCPlusObject; clipboard : TCPlusObject) : boolean; cdecl; external BePascalLibName name 'BTextView_AcceptsPaste';
|
||||
function BTextView_AcceptsDrop(AObject : TCPlusObject; inMessage : TCPlusObject) : boolean; cdecl; external BePascalLibName name 'BTextView_AcceptsDrop';
|
||||
procedure BTextView_Select(AObject : TCPlusObject; startOffset : integer; endOffset : integer); cdecl; external BePascalLibName name 'BTextView_Select';
|
||||
procedure BTextView_SelectAll(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BTextView_SelectAll';
|
||||
@@ -498,17 +498,18 @@ begin
|
||||
BTextView_GoToLine(CPlusObject, lineNum);
|
||||
end;
|
||||
|
||||
{procedure BTextView.Cut(clipboard : TClipboard);
|
||||
procedure BTextView.Cut(clipboard : BClipboard);
|
||||
begin
|
||||
BTextView_Cut(CPlusObject, clipboard.CPlusObject);
|
||||
end;
|
||||
|
||||
procedure BTextView.Copy(clipboard : TClipboard);
|
||||
procedure BTextView.Copy(clipboard : BClipboard);
|
||||
begin
|
||||
|
||||
BTextView_Copy(CPlusObject, clipboard.CPlusObject);
|
||||
end;
|
||||
|
||||
procedure BTextView.Paste(clipboard : TClipboard);
|
||||
procedure BTextView.Paste(clipboard : BClipboard);
|
||||
begin
|
||||
BTextView_Paste(CPlusObject, clipboard.CPlusObject);
|
||||
end;
|
||||
@@ -518,16 +519,16 @@ begin
|
||||
BTextView_Clear(CPlusObject);
|
||||
end;
|
||||
|
||||
function BTextView.AcceptsPaste(clipboard : TClipboard) : boolean;
|
||||
function BTextView.AcceptsPaste(clipboard : BClipboard) : boolean;
|
||||
begin
|
||||
Result := BTextView_AcceptsPaste(CPlusObject, clipboard.CPlusObject);
|
||||
end;
|
||||
}
|
||||
function BTextView.AcceptsDrop(inMessage : BMessage) : boolean;
|
||||
|
||||
{function BTextView.AcceptsDrop(inMessage : BMessage) : boolean;
|
||||
begin
|
||||
Result := BTextView_AcceptsDrop(CPlusObject, inMessage);
|
||||
end;
|
||||
|
||||
}
|
||||
procedure BTextView.Select(startOffset : integer; endOffset : integer);
|
||||
begin
|
||||
BTextView_Select(CPlusObject, startOffset, endOffset);
|
||||
|
||||
@@ -24,10 +24,11 @@ interface
|
||||
|
||||
uses
|
||||
beobj, handler, rect, os, application, appdefs, message,font,SupportDefs,
|
||||
graphicdefs,bitmap,region,picture,cursor,interfacedefs,polygon,shape;
|
||||
graphicdefs,bitmap,region,picture,cursor,interfacedefs,polygon,shape,Archivable;
|
||||
|
||||
type
|
||||
|
||||
BBitmap =class;
|
||||
|
||||
BView = class(BHandler)
|
||||
public
|
||||
constructor Create(frame1 : BRect; name : PChar; resizingMode1, flags1 : Cardinal);
|
||||
@@ -446,6 +447,154 @@ const
|
||||
B_FONT_FLAGS = 128;
|
||||
B_FONT_ALL = 255;
|
||||
|
||||
|
||||
|
||||
|
||||
// Bitmap
|
||||
type
|
||||
BBitmap = class(BArchivable)
|
||||
private
|
||||
public
|
||||
constructor Create(_bounds : BRect; flags : Longword; depth : color_space;
|
||||
bytesPerRow_ : Longint {$ifndef VER1_0}= B_ANY_BYTES_PER_ROW{$endif};
|
||||
screenID : screen_id {$ifndef VER1_0}= B_MAIN_SCREEN_ID{$endif});
|
||||
constructor Create(_bounds : BRect; depth : color_space;
|
||||
accepts_views : Boolean {$ifndef VER1_0}= false{$endif};
|
||||
need_contiguous : Boolean {$ifndef VER1_0}= false{$endif});
|
||||
constructor Create(const source : BBitmap; accepts_views : Boolean {$ifndef VER1_0}= false{$endif};
|
||||
need_contiguous : Boolean {$ifndef VER1_0}= false{$endif});
|
||||
constructor Create(data : BMessage);
|
||||
|
||||
destructor Destroy; override;
|
||||
|
||||
function Instantiate(data : BMessage) : BArchivable;
|
||||
function Archive(data : BMessage; deep : Boolean{$ifndef VER1_0}= true{$endif}) : status_t;
|
||||
function InitCheck : status_t;
|
||||
function IsValid : Boolean;
|
||||
function LockBits(state : PLongword {$ifndef VER1_0}= nil{$endif}) : status_t;
|
||||
procedure UnlockBits;
|
||||
function Area : area_id;
|
||||
function Bits : Pointer;
|
||||
function BitsLength : Longint;
|
||||
function BytesPerRow : Longint;
|
||||
function ColorSpace : color_space;
|
||||
function Bounds : BRect;
|
||||
procedure SetBits(const data : Pointer; length : Longint; offset : Longint;
|
||||
cs : color_space);
|
||||
function GetOverlayRestrictions(var restrict : overlay_restrictions)
|
||||
: status_t;
|
||||
|
||||
// to mimic a BWindow
|
||||
procedure AddChild(view : BView); virtual;
|
||||
function RemoveChild(view : BView) : Boolean; virtual;
|
||||
function CountChildren : Longint;
|
||||
function ChildAt(index : Longint) : BView;
|
||||
function FindView(const view_name : PChar) : BView;
|
||||
function FindView(point : BPoint) : BView;
|
||||
function Lock : Boolean;
|
||||
procedure Unlock;
|
||||
function IsLocked : Boolean;
|
||||
|
||||
function Perform(d : perform_code; arg : Pointer) : status_t;
|
||||
end;
|
||||
|
||||
function BBitmap_Create(AObject : TBeObject; frame : TCPlusObject;
|
||||
flags : Longword; depth : color_space;
|
||||
bytesPerRow_ : Longint; screenID : screen_id)
|
||||
: TCPlusObject; cdecl; external BePascalLibName name 'BBitmap_Create';
|
||||
|
||||
function BBitmap_Create_1(AObject : TBeObject; frame : TCPlusObject;
|
||||
depth : color_space; accepts_views : Boolean;
|
||||
need_contiguous : Boolean)
|
||||
: TCPlusObject; cdecl; external BePascalLibName name 'BBitmap_Create_1';
|
||||
|
||||
function BBitmap_Create_2(AObject : TBeObject; source : BBitmap;
|
||||
accepts_views : Boolean; need_contiguous : Boolean)
|
||||
: TCPlusObject; cdecl; external BePascalLibName name 'BBitmap_Create_2';
|
||||
|
||||
function BBitmap_Create_3(AObject : TBeObject; data : TCPlusObject)
|
||||
: TCPlusObject; cdecl; external BePascalLibName name 'BBitmap_Create_3';
|
||||
|
||||
|
||||
procedure BBitmap_Free(AObject : TCPlusObject);
|
||||
cdecl; external BePascalLibName name 'BBitmap_Free';
|
||||
|
||||
function BBitmap_Instantiate(AObject : TCPlusObject; data : TCPlusObject)
|
||||
: BArchivable;
|
||||
cdecl; external BePascalLibName name 'BBitmap_Instantiate';
|
||||
|
||||
function BBitmap_Archive(AObject : TCPlusObject; data : TCPlusObject;
|
||||
deep : Boolean) : status_t;
|
||||
cdecl; external BePascalLibName name 'BBitmap_Archive';
|
||||
|
||||
function BBitmap_InitCheck(AObject : TCPlusObject) : status_t;
|
||||
cdecl; external BePascalLibName name 'BBitmap_InitCheck';
|
||||
|
||||
function BBitmap_IsValid(AObject : TCPlusObject) : Boolean;
|
||||
cdecl; external BePascalLibName name 'BBitmap_IsValid';
|
||||
|
||||
function BBitmap_LockBits(AObject : TCPlusObject; state : PCardinal) : status_t;
|
||||
cdecl; external BePascalLibName name 'BBitmap_LockBits';
|
||||
|
||||
procedure BBitmap_UnlockBits(AObject : TCPlusObject);
|
||||
cdecl; external BePascalLibName name 'BBitmap_UnlockBits';
|
||||
|
||||
function BBitmap_Area(AObject : TCPlusObject) : Area_ID;
|
||||
cdecl; external BePascalLibName name 'BBitmap_Area';
|
||||
|
||||
function BBitmap_Bits(AObject : TCPlusObject) : Pointer;
|
||||
cdecl; external BePascalLibName name 'BBitmap_Bits';
|
||||
|
||||
function BBitmap_BitsLength(AObject : TCPlusObject) : Longint;
|
||||
cdecl; external BePascalLibName name 'BBitmap_BitsLength';
|
||||
|
||||
function BBitmap_BytesPerRow(AObject : TCPlusObject) : Longint;
|
||||
cdecl; external BePascalLibName name 'BBitmap_BytesPerRow';
|
||||
|
||||
function BBitmap_ColorSpace(AObject : TCPlusObject) : Color_Space;
|
||||
cdecl; external BePascalLibName name 'BBitmap_ColorSpace';
|
||||
|
||||
function BBitmap_Bounds(AObject : TCPlusObject) : BRect;
|
||||
cdecl; external BePascalLibName name 'BBitmap_Bounds';
|
||||
|
||||
procedure BBitmap_SetBits(AObject : TCPlusObject; data : Pointer; length : Longint;
|
||||
offset : Longint; cs : Color_Space);
|
||||
cdecl; external BePascalLibName name 'BBitmap_SetBits';
|
||||
|
||||
function BBitmap_GetOverlayRestrictions(AObject : TCPlusObject; restrict : overlay_restrictions)
|
||||
: status_t; cdecl; external BePascalLibName name 'BBitmap_GetOverlayRestrictions';
|
||||
|
||||
procedure BBitmap_AddChild(AObject : TCPlusObject; view : TCPlusObject);
|
||||
cdecl; external BePascalLibName name 'BBitmap_AddChild';
|
||||
|
||||
function BBitmap_RemoveChild(AObject : TCPlusObject; view : TCPlusObject)
|
||||
: Boolean; cdecl; external BePascalLibName name 'BBitmap_RemoveChild';
|
||||
|
||||
function BBitmap_CountChildren(AObject : TCPlusObject) : Longint;
|
||||
cdecl; external BePascalLibName name 'BBitmap_CountChildren';
|
||||
|
||||
function BBitmap_ChildAt(AObject : TCPlusObject; index : Longint) : BView;
|
||||
cdecl; external BePascalLibName name 'BBitmap_ChildAt';
|
||||
|
||||
function BBitmap_FindView(AObject : TCPlusObject; view_name : PChar) : BView;
|
||||
cdecl; external BePascalLibName name 'BBitmap_FindView';
|
||||
|
||||
function BBitmap_FindView(AObject : TCPlusObject; point : {BPoint}TCPlusObject)
|
||||
: BView; cdecl; external BePascalLibName name 'BBitmap_FindView';
|
||||
|
||||
function BBitmap_Lock(AObject : TCPlusObject) : Boolean;
|
||||
cdecl; external BePascalLibName name 'BBitmap_Lock';
|
||||
|
||||
procedure BBitmap_Unlock(AObject : TCPlusObject);
|
||||
cdecl; external BePascalLibName name 'BBitmap_Unlock';
|
||||
|
||||
function BBitmap_IsLocked(AObject : TCPlusObject) : Boolean;
|
||||
cdecl; external BePascalLibName name 'BBitmap_IsLocked';
|
||||
|
||||
function BBitmap_Perform(AObject : TCPlusObject; d : perform_code; arg : Pointer)
|
||||
: status_t; cdecl; external BePascalLibName name 'BBitmap_Perform';
|
||||
|
||||
|
||||
implementation
|
||||
var
|
||||
View_AllAttached_hook : Pointer; cvar; external;
|
||||
@@ -1552,6 +1701,171 @@ end;
|
||||
// end;
|
||||
//end;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
constructor BBitmap.Create(_bounds : BRect; flags : Longword; depth : color_space;
|
||||
bytesPerRow_ : Longint; screenID : screen_id);
|
||||
begin
|
||||
inherited Create;
|
||||
CPlusObject := BBitmap_Create(Self, _bounds, flags, depth, bytesPerRow_, screenID);
|
||||
end;
|
||||
|
||||
constructor BBitmap.Create(_bounds : BRect; depth : color_space;
|
||||
accepts_views : Boolean; need_contiguous : Boolean);
|
||||
begin
|
||||
inherited Create;
|
||||
CPlusObject := BBitmap_Create_1(Self, _bounds.CPlusObject, depth, accepts_views,
|
||||
need_contiguous);
|
||||
end;
|
||||
|
||||
constructor BBitmap.Create(const source : BBitmap; accepts_views : Boolean;
|
||||
need_contiguous : Boolean);
|
||||
begin
|
||||
inherited Create;
|
||||
CPlusObject := BBitmap_Create_2(Self, source, accepts_views, need_contiguous);
|
||||
end;
|
||||
|
||||
constructor BBitmap.Create(data : BMessage);
|
||||
begin
|
||||
inherited Create;
|
||||
CPlusObject := BBitmap_Create_3(Self, data.CPlusObject);
|
||||
end;
|
||||
|
||||
destructor BBitmap.Destroy;
|
||||
begin
|
||||
BBitmap_Free(CPlusObject);
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function BBitmap.Instantiate(data : BMessage) : BArchivable;
|
||||
begin
|
||||
Result := BBitmap_Instantiate(CPlusObject, data.CPlusObject);
|
||||
end;
|
||||
|
||||
function BBitmap.Archive(data : BMessage; deep : Boolean) : status_t;
|
||||
begin
|
||||
Result := BBitmap_Archive(CPlusObject, data.CPlusObject, deep);
|
||||
end;
|
||||
|
||||
function BBitmap.InitCheck : status_t;
|
||||
begin
|
||||
Result := BBitmap_InitCheck(CPlusObject);
|
||||
end;
|
||||
|
||||
function BBitmap.IsValid : Boolean;
|
||||
begin
|
||||
Result := BBitmap_IsValid(CPlusObject);
|
||||
end;
|
||||
|
||||
function BBitmap.LockBits(state : PLongword) : status_t;
|
||||
begin
|
||||
Result := BBitmap_LockBits(CPlusObject, state);
|
||||
end;
|
||||
|
||||
procedure BBitmap.UnlockBits;
|
||||
begin
|
||||
BBitmap_UnlockBits(CPlusObject);
|
||||
end;
|
||||
|
||||
function BBitmap.Area : area_id;
|
||||
begin
|
||||
Result := BBitmap_Area(CPlusObject);
|
||||
end;
|
||||
|
||||
function BBitmap.Bits : Pointer;
|
||||
begin
|
||||
Result := BBitmap_Bits(CPlusObject);
|
||||
end;
|
||||
|
||||
function BBitmap.BitsLength : Longint;
|
||||
begin
|
||||
Result := BBitmap_BitsLength(CPlusObject);
|
||||
end;
|
||||
|
||||
function BBitmap.BytesPerRow : Longint;
|
||||
begin
|
||||
Result := BBitmap_BytesPerRow(CPlusObject);
|
||||
end;
|
||||
|
||||
function BBitmap.ColorSpace : color_space;
|
||||
begin
|
||||
Result := BBitmap_ColorSpace(CPlusObject);
|
||||
end;
|
||||
|
||||
function BBitmap.Bounds : BRect;
|
||||
begin
|
||||
Result := BBitmap_Bounds(CPlusObject);
|
||||
end;
|
||||
|
||||
procedure BBitmap.SetBits(const data : Pointer; length : Longint; offset : Longint;
|
||||
cs : color_space);
|
||||
begin
|
||||
BBitmap_SetBits(CPlusObject, data, length, offset, cs);
|
||||
end;
|
||||
|
||||
function BBitmap.GetOverlayRestrictions(var restrict : overlay_restrictions) : status_t;
|
||||
begin
|
||||
Result := BBitmap_GetOverlayRestrictions(CPlusObject, restrict);
|
||||
end;
|
||||
|
||||
procedure BBitmap.AddChild(view : BView);
|
||||
begin
|
||||
BBitmap_AddChild(CPlusObject, view.CPlusObject);
|
||||
end;
|
||||
|
||||
function BBitmap.RemoveChild(view : BView) : Boolean;
|
||||
begin
|
||||
Result := BBitmap_RemoveChild(CPlusObject, view.CPlusObject);
|
||||
end;
|
||||
|
||||
function BBitmap.CountChildren : Longint;
|
||||
begin
|
||||
Result := BBitmap_CountChildren(CPlusObject);
|
||||
end;
|
||||
|
||||
function BBitmap.ChildAt(index : Longint) : BView;
|
||||
begin
|
||||
Result := BBitmap_ChildAt(CPlusObject, index);
|
||||
end;
|
||||
|
||||
function BBitmap.FindView(const view_name : PChar) : BView;
|
||||
begin
|
||||
Result := BBitmap_FindView(CPlusObject, view_name);
|
||||
end;
|
||||
|
||||
function BBitmap.FindView(point : BPoint) : BView;
|
||||
begin
|
||||
Result := BBitmap_FindView(CPlusObject, point.CPlusObject);
|
||||
end;
|
||||
|
||||
function BBitmap.Lock : Boolean;
|
||||
begin
|
||||
Result := BBitmap_Lock(CPlusObject);
|
||||
end;
|
||||
|
||||
procedure BBitmap.Unlock;
|
||||
begin
|
||||
BBitmap_Unlock(CPlusObject);
|
||||
end;
|
||||
|
||||
function BBitmap.IsLocked : Boolean;
|
||||
begin
|
||||
Result := BBitmap_IsLocked(CPlusObject);
|
||||
end;
|
||||
|
||||
function BBitmap.Perform(d : perform_code; arg : Pointer) : status_t;
|
||||
begin
|
||||
Result := BBitmap_Perform(CPlusObject, d, arg);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
procedure View_WindowActivated_hook_func(View : BView; active : boolean); cdecl;
|
||||
begin
|
||||
if View <> nil then
|
||||
|
||||
@@ -249,7 +249,7 @@ procedure BWindow_DisableUpdates(AObject : TCPlusObject); cdecl; external BePasc
|
||||
procedure BWindow_EnableUpdates(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BWindow_EnableUpdates';
|
||||
procedure BWindow_BeginViewTransaction(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BWindow_BeginViewTransaction';
|
||||
procedure BWindow_EndViewTransaction(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BWindow_EndViewTransaction';
|
||||
function BWindow_Bounds(AObject : TCPlusObject) : BRect; cdecl; external BePascalLibName name 'BWindow_Bounds';
|
||||
function BWindow_Bounds(AObject : TCPlusObject) : TCPlusObject; cdecl; external BePascalLibName name 'BWindow_Bounds';
|
||||
function BWindow_Frame(AObject : TCPlusObject) : BRect; cdecl; external BePascalLibName name 'BWindow_Frame';
|
||||
function BWindow_Title(AObject : TCPlusObject) : PChar; cdecl; external BePascalLibName name 'BWindow_Title';
|
||||
procedure BWindow_SetTitle(AObject : TCPlusObject; title : PChar); cdecl; external BePascalLibName name 'BWindow_SetTitle';
|
||||
@@ -718,7 +718,7 @@ end;
|
||||
|
||||
function BWindow.Bounds : BRect;
|
||||
begin
|
||||
Result := BWindow_Bounds(CPlusObject);
|
||||
Result := BRect.Wrap(BWindow_Bounds(CPlusObject));
|
||||
end;
|
||||
|
||||
function BWindow.GetFrame : BRect;
|
||||
|
||||
@@ -179,4 +179,4 @@ begin
|
||||
Result := BPath_GetParent(CPlusObject, aPath.CPlusObject);
|
||||
end;
|
||||
|
||||
end.
|
||||
end.
|
||||
|
||||
@@ -103,4 +103,4 @@ end;
|
||||
initialization
|
||||
Archivable_Instantiate_hook := @Archivable_Instantiate_hook_func;
|
||||
Archivable_Archive_hook := @Archivable_Archive_hook_func;
|
||||
end.
|
||||
end.
|
||||
|
||||
Reference in New Issue
Block a user