diff --git a/bepascal/demos/demo/compile b/bepascal/demos/demo/compile index 9304f23..de344b0 100644 --- a/bepascal/demos/demo/compile +++ b/bepascal/demos/demo/compile @@ -3,6 +3,6 @@ if [ ! -d units ] then mkdir units fi -ppc386 -FE./ -FU./units ./sources/main.pp -oBPDemo +ppc386 -FE./ -FU./units ./sources/main.pp -oBPDemo -g -gl mergeres ./sources/Resource.rsrc BPDemo mimeset BPDemo diff --git a/bepascal/source/bepascal/cpp/src/be/app/Clipboard.cpp b/bepascal/source/bepascal/cpp/src/be/app/Clipboard.cpp index e66c20d..5832e59 100644 --- a/bepascal/source/bepascal/cpp/src/be/app/Clipboard.cpp +++ b/bepascal/source/bepascal/cpp/src/be/app/Clipboard.cpp @@ -15,6 +15,12 @@ extern "C" { #endif + +const TCPlusObject Get_be_clipboard(void) +{ + // Pas très propre ! Si quelqu'un a mieux... + return TCPlusObject(be_clipboard); +} /* * Method: BClipboard::BClipboard() * Descr: diff --git a/bepascal/source/bepascal/cpp/src/be/app/Message.cpp b/bepascal/source/bepascal/cpp/src/be/app/Message.cpp index 188b1dc..8e145da 100644 --- a/bepascal/source/bepascal/cpp/src/be/app/Message.cpp +++ b/bepascal/source/bepascal/cpp/src/be/app/Message.cpp @@ -152,6 +152,17 @@ status_t BMessage_FindString(TCPlusObject message,const char *name, const char * } +status_t BMessage_FindRef(TCPlusObject message,const char *name, entry_ref *ref) +{ + return reinterpret_cast(message)->FindRef(name, ref); +} + +status_t BMessage_FindRef_1(TCPlusObject message,const char *name, int32 index, entry_ref *ref) +{ + return reinterpret_cast(message)->FindRef(name,index, ref); +} + + status_t BMessage_AddMessage(TCPlusObject message, const char *name, const TCPlusObject amessage) { return reinterpret_cast(message)->AddMessage(name, reinterpret_cast(amessage)); diff --git a/bepascal/source/bepascal/pas/src/be/app/clipboard.pp b/bepascal/source/bepascal/pas/src/be/app/clipboard.pp new file mode 100644 index 0000000..8b2ac40 --- /dev/null +++ b/bepascal/source/bepascal/pas/src/be/app/clipboard.pp @@ -0,0 +1,271 @@ +{ BePascal - A pascal wrapper around the BeOS API + Copyright (C) 2002 Olivier Coursiere + Eric Jourde + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +} +unit clipboard; + +interface + +uses + beobj,messenger,SupportDefs,message; + +type + BClipboard = class(TBeObject) + private + public + constructor Create(aname : pchar; transient :boolean); + destructor Destroy;override; + function Name : PChar; + function LocalCount : Cardinal; + function SystemCount : Cardinal; + function StartWatching(target : BMessenger) : status_t; + function StopWatching(target : BMessenger) : status_t; + function Lock : boolean; + procedure Unlock; + function IsLocked : boolean; + function Clear : status_t; + function Commit : status_t; + function Revert : status_t; + function DataSource : BMessenger; + function Data : BMessage; + //constructor Create( : BClipboard); + { function operator=( : BClipboard) : BClipboard; + procedure _ReservedClipboard1; + procedure _ReservedClipboard2; + procedure _ReservedClipboard3; + function AssertLocked : boolean; + function DownloadFromSystem(force : boolean) : TStatus_t; + function UploadToSystem : TStatus_t; + procedure uint32 fCount; + procedure BMessage *fData; + procedure BLocker fLock; + procedure BMessenger fClipHandler; + procedure BMessenger fDataSource; + procedure uint32 fSystemCount; + procedure char *fName; + procedure uint32 _reserved[4]; + } + end; + +function Get_be_clipboard : TCPlusObject; cdecl; external BePascalLibName; + + +function BClipboard_Create(AObject : TBeObject;name : pchar; transient :boolean): TCPlusObject; cdecl; external BePascalLibName name 'BClipboard_Create'; +procedure BClipboard_Free(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BClipboard_Free'; +function BClipboard_Name(AObject : TCPlusObject) : PChar; cdecl; external BePascalLibName name 'BClipboard_Name'; +function BClipboard_LocalCount(AObject : TCPlusObject) : Cardinal; cdecl; external BePascalLibName name 'BClipboard_LocalCount'; +function BClipboard_SystemCount(AObject : TCPlusObject) : Cardinal; cdecl; external BePascalLibName name 'BClipboard_SystemCount'; +function BClipboard_StartWatching(AObject : TCPlusObject; target : TCPlusObject) : status_t; cdecl; external BePascalLibName name 'BClipboard_StartWatching'; +function BClipboard_StopWatching(AObject : TCPlusObject; target : TCPlusObject) : status_t; cdecl; external BePascalLibName name 'BClipboard_StopWatching'; +function BClipboard_Lock(AObject : TCPlusObject) : boolean; cdecl; external BePascalLibName name 'BClipboard_Lock'; +procedure BClipboard_Unlock(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BClipboard_Unlock'; +function BClipboard_IsLocked(AObject : TCPlusObject) : boolean; cdecl; external BePascalLibName name 'BClipboard_IsLocked'; +function BClipboard_Clear(AObject : TCPlusObject) : status_t; cdecl; external BePascalLibName name 'BClipboard_Clear'; +function BClipboard_Commit(AObject : TCPlusObject) : status_t; cdecl; external BePascalLibName name 'BClipboard_Commit'; +function BClipboard_Revert(AObject : TCPlusObject) : status_t; cdecl; external BePascalLibName name 'BClipboard_Revert'; +function BClipboard_DataSource(AObject : TCPlusObject) : BMessenger; cdecl; external BePascalLibName name 'BClipboard_DataSource'; +function BClipboard_Data(AObject : TCPlusObject) : BMessage; cdecl; external BePascalLibName name 'BClipboard_Data'; +{function BClipboard_Create(AObject : TBeObject; : BClipboard); cdecl; external BePascalLibName name 'BClipboard_Create'; +function BClipboard_operator=(AObject : TCPlusObject; : BClipboard) : BClipboard; cdecl; external BePascalLibName name 'BClipboard_operator='; +procedure BClipboard__ReservedClipboard1(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BClipboard__ReservedClipboard1'; +procedure BClipboard__ReservedClipboard2(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BClipboard__ReservedClipboard2'; +procedure BClipboard__ReservedClipboard3(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BClipboard__ReservedClipboard3'; +function BClipboard_AssertLocked(AObject : TCPlusObject) : boolean; cdecl; external BePascalLibName name 'BClipboard_AssertLocked'; +function BClipboard_DownloadFromSystem(AObject : TCPlusObject; force : boolean) : TStatus_t; cdecl; external BePascalLibName name 'BClipboard_DownloadFromSystem'; +function BClipboard_UploadToSystem(AObject : TCPlusObject) : TStatus_t; cdecl; external BePascalLibName name 'BClipboard_UploadToSystem'; +procedure BClipboard_uint32 fCount(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BClipboard_uint32 fCount'; +procedure BClipboard_BMessage *fData(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BClipboard_BMessage *fData'; +procedure BClipboard_BLocker fLock(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BClipboard_BLocker fLock'; +procedure BClipboard_BMessenger fClipHandler(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BClipboard_BMessenger fClipHandler'; +procedure BClipboard_BMessenger fDataSource(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BClipboard_BMessenger fDataSource'; +procedure BClipboard_uint32 fSystemCount(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BClipboard_uint32 fSystemCount'; +procedure BClipboard_char *fName(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BClipboard_char *fName'; +procedure BClipboard_uint32 _reserved[4](AObject : TCPlusObject); cdecl; external BePascalLibName name 'BClipboard_uint32 _reserved[4]'; +} + +var be_clipboard : BClipboard; + +implementation + +constructor BClipboard.Create(aname : pchar; transient :boolean); +begin + inherited create; + CPlusObject := BClipboard_Create(Self,aname, transient); + be_clipboard:=Self; + +end; + +destructor BClipboard.Destroy; +begin + BClipboard_Free(CPlusObject); + inherited; +end; + +function BClipboard.Name : PChar; +begin + Result := BClipboard_Name(CPlusObject); +end; + +function BClipboard.LocalCount : Cardinal; +begin + Result := BClipboard_LocalCount(CPlusObject); +end; + +function BClipboard.SystemCount : Cardinal; +begin + Result := BClipboard_SystemCount(CPlusObject); +end; + +function BClipboard.StartWatching(target : BMessenger) : status_t; +begin + Result := BClipboard_StartWatching(CPlusObject, target.CPlusObject); +end; + +function BClipboard.StopWatching(target : BMessenger) : status_t; +begin + Result := BClipboard_StopWatching(CPlusObject, target.CPlusObject); +end; + +function BClipboard.Lock : boolean; +begin + Result := BClipboard_Lock(CPlusObject); +end; + +procedure BClipboard.Unlock; +begin + BClipboard_Unlock(CPlusObject); +end; + +function BClipboard.IsLocked : boolean; +begin + Result := BClipboard_IsLocked(CPlusObject); +end; + +function BClipboard.Clear : status_t; +begin + Result := BClipboard_Clear(CPlusObject); +end; + +function BClipboard.Commit : status_t; +begin + Result := BClipboard_Commit(CPlusObject); +end; + +function BClipboard.Revert : status_t; +begin + Result := BClipboard_Revert(CPlusObject); +end; + +function BClipboard.DataSource : BMessenger; +begin + Result := BClipboard_DataSource(CPlusObject); +end; + +function BClipboard.Data : BMessage; +begin + Result := BClipboard_Data(CPlusObject); +end; + +{constructor BClipboard.Create( : BClipboard); +begin + CPlusObject := BClipboard_Create(Self, ); +end; + +function BClipboard.operator=( : BClipboard) : BClipboard; +begin + Result := BClipboard_operator=(CPlusObject, ); +end; + +procedure BClipboard._ReservedClipboard1; +begin + BClipboard__ReservedClipboard1(CPlusObject); +end; + +procedure BClipboard._ReservedClipboard2; +begin + BClipboard__ReservedClipboard2(CPlusObject); +end; + +procedure BClipboard._ReservedClipboard3; +begin + BClipboard__ReservedClipboard3(CPlusObject); +end; + +function BClipboard.AssertLocked : boolean; +begin + Result := BClipboard_AssertLocked(CPlusObject); +end; + +function BClipboard.DownloadFromSystem(force : boolean) : TStatus_t; +begin + Result := BClipboard_DownloadFromSystem(CPlusObject, force); +end; + +function BClipboard.UploadToSystem : TStatus_t; +begin + Result := BClipboard_UploadToSystem(CPlusObject); +end; + +procedure BClipboard.uint32 fCount; +begin + BClipboard_uint32 fCount(CPlusObject); +end; + +procedure BClipboard.BMessage *fData; +begin + BClipboard_BMessage *fData(CPlusObject); +end; + +procedure BClipboard.BLocker fLock; +begin + BClipboard_BLocker fLock(CPlusObject); +end; + +procedure BClipboard.BMessenger fClipHandler; +begin + BClipboard_BMessenger fClipHandler(CPlusObject); +end; + +procedure BClipboard.BMessenger fDataSource; +begin + BClipboard_BMessenger fDataSource(CPlusObject); +end; + +procedure BClipboard.uint32 fSystemCount; +begin + BClipboard_uint32 fSystemCount(CPlusObject); +end; + +procedure BClipboard.char *fName; +begin + BClipboard_char *fName(CPlusObject); +end; + +procedure BClipboard.uint32 _reserved[4]; +begin + BClipboard_uint32 _reserved[4](CPlusObject); +end; + +} + +initialization + be_clipboard := BClipboard.Wrap(Get_be_clipboard); + +finalization + be_clipboard.UnWrap; + be_clipboard := nil; +end. diff --git a/bepascal/source/bepascal/pas/src/be/app/message.pp b/bepascal/source/bepascal/pas/src/be/app/message.pp index f7fe99a..1530739 100644 --- a/bepascal/source/bepascal/pas/src/be/app/message.pp +++ b/bepascal/source/bepascal/pas/src/be/app/message.pp @@ -21,7 +21,7 @@ unit message; interface uses - beobj, supportdefs, typeconstants,dataio; + beobj, supportdefs, typeconstants, dataio, entry; const B_NO_SPECIFIER = 0; @@ -59,6 +59,8 @@ type function AddDouble(const Name : PChar; aDouble : Double) : Status_t; function AddString(const Name : PChar; aString : PChar) : Status_t; function FindString(const Name : PChar; var aString : PChar) : Status_t; + function FindRef(const Name : PChar; var ref : Entry_Ref) : Status_t; + function FindRef(const Name : PChar;aindex: integer; var ref : entry_ref) : Status_t; function AddMessage(const Name : PChar; aMessage : TCPlusObject) : Status_t; function CountNames(aType : Type_Code) : Integer; function HasSpecifiers : boolean; @@ -96,6 +98,8 @@ function BMessage_AddFloat(Message : TCPlusObject; const Name : PChar; aFloat : function BMessage_AddDouble(Message : TCPlusObject; const Name : PChar; aDouble : Double) : Status_t; cdecl; external BePascalLibName; function BMessage_AddString(Message : TCPlusObject; const Name : PChar; aString : PChar) : Status_t; cdecl; external BePascalLibName; function BMessage_FindString(Message : TCPlusObject; const Name : PChar;var aString : PChar) : Status_t; cdecl; external BePascalLibName; +function BMessage_FindRef(Message : TCPlusObject;const Name : PChar; var ref : entry_ref) : Status_t; cdecl; external BePascalLibName name 'BMessage_FindRef'; +function BMessage_FindRef(Message : TCPlusObject;const Name : PChar;aindex: integer; var ref : entry_ref) : Status_t; cdecl; external BePascalLibName name 'BMessage_FindRef_1'; function BMessage_AddMessage(Message : TCPlusObject; const Name : PChar; aMessage : TCPlusObject) : Status_t; cdecl; external BePascalLibName; function BMessage_CountNames(Message : TCPlusObject; aType : Type_Code) : Integer; cdecl; external BePascalLibName; function BMessage_HasSpecifiers(Message : TCPlusObject) : boolean; cdecl; external BePascalLibName; @@ -206,6 +210,16 @@ begin result := BMessage_FindString(CPlusObject, Name, aString); end; +function BMessage.FindRef(const Name : PChar; var ref : Entry_Ref) : Status_t; +begin + result:=BMessage_FindRef(CPlusObject,Name,ref); +end; + +function BMessage.FindRef(const Name : PChar;aindex: integer; var ref : entry_ref) : Status_t; +begin + result:=BMessage_FindRef(CPlusObject,Name,aindex,ref); +end; + function BMessage.AddMessage(const Name : PChar; aMessage : TCPlusObject) : Status_t; begin result := BMessage_AddMessage(CPlusObject, Name, aMessage); diff --git a/bepascal/source/bepascal/pas/src/be/storage/entry.pp b/bepascal/source/bepascal/pas/src/be/storage/entry.pp index e957260..5691893 100644 --- a/bepascal/source/bepascal/pas/src/be/storage/entry.pp +++ b/bepascal/source/bepascal/pas/src/be/storage/entry.pp @@ -219,4 +219,4 @@ begin Result := BEntry_Remove(CPlusObject); end; -end. \ No newline at end of file +end.