diff --git a/begui/begui/imports/pascal/examples/untitled.pas b/begui/begui/imports/pascal/examples/untitled.pas new file mode 100644 index 0000000..3b2e24b --- /dev/null +++ b/begui/begui/imports/pascal/examples/untitled.pas @@ -0,0 +1,60 @@ +program untitled; + +uses + begui; + +type + PTest = ^TTest; + TTest = object + handle: MButtonH; + owner: MFormH; + procedure test; + procedure AddToForm(Form: MFormH); + constructor init; + destructor done; virtual; + end; + + constructor TTest.init; + begin + write('init'); + handle := MButton_Create_int32(170,20,190,30, pchar('C')); + writeln('.. after button create'); + end; + + destructor TTest.done; + begin + write('done'); + handle := nil; + writeln('.. after done'); + end; + + procedure TTest.test; + begin + writeln('test'); + end; + + procedure TTest.AddToForm(Form: MFormH); + begin + owner := Form; + MForm_AddChild(owner, handle); + end; + +var + t: ptest; + MainForm: MFormH; +begin + new(t, init); + + MainForm := MApplication_GetMainForm(Application); + + t^.test; + + t^.AddToForm(MainForm); + + t^.test; + + MApplication_Run(application); + + dispose(t, done); + +end. \ No newline at end of file diff --git a/begui/begui/libbegui/BeGuiClasses.cpp b/begui/begui/libbegui/BeGuiClasses.cpp index e60e41d..72ad62d 100644 --- a/begui/begui/libbegui/BeGuiClasses.cpp +++ b/begui/begui/libbegui/BeGuiClasses.cpp @@ -1,9 +1,12 @@ /* - $Header: /home/haiku/befpc/begui/begui/libbegui/BeGuiClasses.cpp,v 1.3 2002-04-23 18:37:29 memson Exp $ + $Header: /home/haiku/befpc/begui/begui/libbegui/BeGuiClasses.cpp,v 1.4 2002-04-27 08:29:51 memson Exp $ - $Revision: 1.3 $ + $Revision: 1.4 $ $Log: not supported by cvs2svn $ + Revision 1.3 2002/04/23 18:37:29 memson + *** empty log message *** + Revision 1.2 2002/04/12 23:32:56 memson Added quite a bit. @@ -110,12 +113,13 @@ */ #define BEGUI_EXPORTS 1 - #include "MList.h" #include "MFile.h" #include "BeGuiClasses.h" #include #include +#include "debug.h" + //clik - control click #define ClickMessage 'clik' @@ -904,6 +908,8 @@ thread_id MApplication::Run(void) void MApplication::RefsReceived(BMessage *message) { + SendText("MApplication::RefsReceived"); + if (message->what == SAVE_PANEL_MESSAGE){ printf("\nSave\n"); } @@ -927,7 +933,10 @@ void MApplication::MessageReceived(BMessage *message) uint32 type; int32 count; + SendText("MApplication::MessageRecvd"); + if (message->what == SAVE_PANEL_MESSAGE){ + SendText("MApplication::MessageRecvd - save panel"); if ( (err = message->FindRef("directory", &ref)) != B_OK ) { //printf("failed to find dir, error %d\n", err); return; @@ -956,33 +965,47 @@ void MApplication::MessageReceived(BMessage *message) } } - if (message->what == OPEN_PANEL_MESSAGE){ - printf("open\n"); + else if (message->what == OPEN_PANEL_MESSAGE){ + SendText("MApplication::MessageRecvd - open panel"); message->GetInfo("refs", &type, &count); if (type != B_REF_TYPE) { - printf("no refs found\n"); + SendText("MApplication::MessageRecvd - no refs found"); return; } for (int32 i = --count; i >= 0; --i) { if ((err = message->FindRef("refs", i, &ref)) == B_OK) { if (message->FindPointer("source", &pointer) == B_OK){ - printf("works1\n"); + SendText("MApplication::MessageRecvd - works 1"); if ( (err = entry.SetTo(&ref)) != B_OK ){ - printf("failed to create entr from path, error %d\n", err); + SendText("MApplication::MessageRecvd - failed to create entr from path, error"); return; } entry.GetPath(&path); if ((filepanel = reinterpret_cast(pointer)) != NULL){ - printf("works2\n"); - printf( "before event ... %s\n", path.Path() ); - filepanel->DoExecute( path ); + SendText("MApplication::MessageRecvd - works2"); + BString s; + s << "MApplication::MessageRecvd - " << "before event ... " << path.Path(); + SendText( s.String() ); + if ( LockLooper() ){ + if (fMainForm->LockLooper()){ + SendText("right befire call for file event"); + filepanel->DoExecute( path ); + SendText("just after call for file event"); + fMainForm->UnlockLooper(); + } + UnlockLooper(); + } + } } + BString s; + s.SetTo("MApplication::MessageRecvd - after file open event code"); + SendText( s.String() ); } else { printf("processing ref %d there was an error %d", i, err); @@ -990,7 +1013,10 @@ void MApplication::MessageReceived(BMessage *message) } } } - + else { + printf("MApplication::messagereceived\n"); + BApplication::MessageReceived(message); + } } void MApplication::Terminate(void) @@ -1061,6 +1087,7 @@ void MForm::MessageReceived(BMessage *message){ } else { + printf("MForm::messagereceived\n"); BWindow::MessageReceived(message); } } diff --git a/begui/begui/libbegui/MFile.cpp b/begui/begui/libbegui/MFile.cpp index 6294265..a3abfb6 100644 --- a/begui/begui/libbegui/MFile.cpp +++ b/begui/begui/libbegui/MFile.cpp @@ -1,4 +1,5 @@ #include "MFile.h" +#include "debug.h" ///////////////////////////////////////////////// // Class MFile @@ -218,7 +219,9 @@ void MDialogPlugin::DoExecute(BPath path) } if (fDialogMsg != NULL){ + SendText("before the code in MDialogPlugin calls event"); fDialogMsg( this, amsg, path.Path() ); + SendText("after the code in MDialogPlugin calls event"); } } diff --git a/begui/begui/libbegui/MFont.cpp b/begui/begui/libbegui/MFont.cpp index 17832d9..a42d728 100644 --- a/begui/begui/libbegui/MFont.cpp +++ b/begui/begui/libbegui/MFont.cpp @@ -1,4 +1,5 @@ #include "MFont.h" +#include "debug.h" BFont* BFont_Create(){ return new BFont(); diff --git a/begui/begui/libbegui/MFont.h b/begui/begui/libbegui/MFont.h index 5b01d5c..17b04ef 100644 --- a/begui/begui/libbegui/MFont.h +++ b/begui/begui/libbegui/MFont.h @@ -1,6 +1,15 @@ #ifndef MFONT_H #define MFONT_H +/* + $Header: /home/haiku/befpc/begui/begui/libbegui/MFont.h,v 1.2 2002-04-27 08:29:51 memson Exp $ + + $Revision: 1.2 $ + + $Log: not supported by cvs2svn $ + +*/ + #include #ifdef __cplusplus diff --git a/begui/begui/libbegui/debug.cpp b/begui/begui/libbegui/debug.cpp new file mode 100644 index 0000000..cdcc2e5 --- /dev/null +++ b/begui/begui/libbegui/debug.cpp @@ -0,0 +1,19 @@ +#include +#include +#include +#include "debug.h" + +void SendMessage(BMessage *message){ + if (be_app != NULL){ + BMessenger messenger("application/x-vnd.befpc-debugconsole"); + if (messenger.IsValid()) messenger.SendMessage(message); + } +} + +void SendText(const char *text){ + BMessage *msg = new BMessage('dbug'); + BString s; + s << "libbegui: " << text; + msg->AddString( "dbstring", s.String() ); + SendMessage(msg); +} \ No newline at end of file diff --git a/begui/begui/libbegui/debug.h b/begui/begui/libbegui/debug.h new file mode 100644 index 0000000..deaaf7c --- /dev/null +++ b/begui/begui/libbegui/debug.h @@ -0,0 +1,6 @@ +#ifndef _DEBUG_H +#define _DEBUG_H + +void SendText(const char *text); + +#endif \ No newline at end of file diff --git a/begui/begui/libbegui/libbegui.proj b/begui/begui/libbegui/libbegui.proj index 7c0158c..80cbdb9 100644 Binary files a/begui/begui/libbegui/libbegui.proj and b/begui/begui/libbegui/libbegui.proj differ