mirror of
https://github.com/moparisthebest/Simba
synced 2025-02-07 02:30:19 -05:00
Added MMLThread plus comments and and sample for Raymond.
git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@37 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
parent
ddd3a8bb3b
commit
9a2b50ef82
@ -7,7 +7,7 @@
|
||||
<TargetFileExt Value=""/>
|
||||
<Title Value="Mufasa Stand Alone"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<ActiveEditorIndexAtStart Value="8"/>
|
||||
<ActiveEditorIndexAtStart Value="9"/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<ProjectVersion Value=""/>
|
||||
@ -29,15 +29,15 @@
|
||||
<PackageName Value="LCL"/>
|
||||
</Item1>
|
||||
</RequiredPackages>
|
||||
<Units Count="48">
|
||||
<Units Count="50">
|
||||
<Unit0>
|
||||
<Filename Value="project1.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="project1"/>
|
||||
<CursorPos X="74" Y="10"/>
|
||||
<CursorPos X="12" Y="11"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="64"/>
|
||||
<UsageCount Value="65"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
@ -166,10 +166,10 @@
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="TestUnit"/>
|
||||
<CursorPos X="58" Y="168"/>
|
||||
<TopLine Value="128"/>
|
||||
<CursorPos X="26" Y="266"/>
|
||||
<TopLine Value="241"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<UsageCount Value="30"/>
|
||||
<UsageCount Value="31"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit18>
|
||||
<Unit19>
|
||||
@ -301,7 +301,7 @@
|
||||
<CursorPos X="46" Y="39"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<UsageCount Value="29"/>
|
||||
<UsageCount Value="30"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit37>
|
||||
<Unit38>
|
||||
@ -311,7 +311,7 @@
|
||||
<CursorPos X="3" Y="16"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<UsageCount Value="29"/>
|
||||
<UsageCount Value="30"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit38>
|
||||
<Unit39>
|
||||
@ -328,7 +328,7 @@
|
||||
<CursorPos X="62" Y="61"/>
|
||||
<TopLine Value="46"/>
|
||||
<EditorIndex Value="7"/>
|
||||
<UsageCount Value="30"/>
|
||||
<UsageCount Value="31"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit40>
|
||||
<Unit41>
|
||||
@ -338,7 +338,7 @@
|
||||
<CursorPos X="35" Y="187"/>
|
||||
<TopLine Value="174"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<UsageCount Value="29"/>
|
||||
<UsageCount Value="30"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit41>
|
||||
<Unit42>
|
||||
@ -367,8 +367,8 @@
|
||||
<Unit45>
|
||||
<Filename Value="../../Units/MMLCore/input.pas"/>
|
||||
<UnitName Value="Input"/>
|
||||
<CursorPos X="36" Y="203"/>
|
||||
<TopLine Value="168"/>
|
||||
<CursorPos X="39" Y="203"/>
|
||||
<TopLine Value="187"/>
|
||||
<EditorIndex Value="8"/>
|
||||
<UsageCount Value="13"/>
|
||||
<Loaded Value="True"/>
|
||||
@ -378,9 +378,9 @@
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="finder"/>
|
||||
<CursorPos X="24" Y="130"/>
|
||||
<TopLine Value="89"/>
|
||||
<TopLine Value="99"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="22"/>
|
||||
<UsageCount Value="23"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit46>
|
||||
<Unit47>
|
||||
@ -390,112 +390,140 @@
|
||||
<TopLine Value="2282"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit47>
|
||||
<Unit48>
|
||||
<Filename Value="../../Units/MMLAddon/mmlthread.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="MMLThread"/>
|
||||
<CursorPos X="49" Y="20"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="9"/>
|
||||
<UsageCount Value="21"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit48>
|
||||
<Unit49>
|
||||
<Filename Value="../../../../Documents/fpc/rtl/objpas/classes/classesh.inc"/>
|
||||
<CursorPos X="27" Y="1430"/>
|
||||
<TopLine Value="1422"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit49>
|
||||
</Units>
|
||||
<JumpHistory Count="26" HistoryIndex="25">
|
||||
<JumpHistory Count="29" HistoryIndex="28">
|
||||
<Position1>
|
||||
<Filename Value="../../Units/MMLCore/client.pas"/>
|
||||
<Caret Line="31" Column="71" TopLine="14"/>
|
||||
<Filename Value="../../Units/MMLCore/windowutil.pas"/>
|
||||
<Caret Line="34" Column="34" TopLine="24"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="../../Units/MMLCore/window.pas"/>
|
||||
<Caret Line="157" Column="52" TopLine="141"/>
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<Caret Line="1" Column="1" TopLine="1"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="../../Units/MMLCore/window.pas"/>
|
||||
<Caret Line="232" Column="59" TopLine="217"/>
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<Caret Line="213" Column="5" TopLine="203"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="../../Units/MMLCore/window.pas"/>
|
||||
<Caret Line="236" Column="29" TopLine="217"/>
|
||||
<Filename Value="../../Units/MMLCore/input.pas"/>
|
||||
<Caret Line="1" Column="1" TopLine="1"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="../../Units/MMLCore/client.pas"/>
|
||||
<Caret Line="1" Column="1" TopLine="1"/>
|
||||
<Caret Line="8" Column="53" TopLine="1"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="../../Units/MMLCore/window.pas"/>
|
||||
<Caret Line="106" Column="10" TopLine="91"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="../../Units/MMLCore/windowutil.pas"/>
|
||||
<Caret Line="21" Column="37" TopLine="1"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="../../Units/MMLCore/windowutil.pas"/>
|
||||
<Caret Line="109" Column="35" TopLine="86"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="../../Units/MMLCore/windowutil.pas"/>
|
||||
<Caret Line="34" Column="34" TopLine="24"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<Caret Line="1" Column="1" TopLine="1"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="../../Units/MMLCore/files.pas"/>
|
||||
<Caret Line="213" Column="5" TopLine="203"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="../../Units/MMLCore/input.pas"/>
|
||||
<Caret Line="1" Column="1" TopLine="1"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="../../Units/MMLCore/client.pas"/>
|
||||
<Caret Line="8" Column="53" TopLine="1"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="35" Column="5" TopLine="31"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="92" Column="48" TopLine="75"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="../../Units/MMLCore/finder.pas"/>
|
||||
<Caret Line="84" Column="12" TopLine="64"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="84" Column="18" TopLine="69"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="88" Column="30" TopLine="65"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="87" Column="16" TopLine="69"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="90" Column="41" TopLine="75"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="../../Units/MMLCore/input.pas"/>
|
||||
<Caret Line="201" Column="18" TopLine="1"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="../../Units/MMLCore/input.pas"/>
|
||||
<Caret Line="209" Column="34" TopLine="195"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="../../Units/MMLCore/input.pas"/>
|
||||
<Caret Line="215" Column="65" TopLine="193"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="../../Units/MMLCore/input.pas"/>
|
||||
<Caret Line="202" Column="41" TopLine="182"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="../../Units/MMLCore/input.pas"/>
|
||||
<Caret Line="203" Column="39" TopLine="183"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="../../Units/MMLCore/input.pas"/>
|
||||
<Caret Line="202" Column="39" TopLine="183"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="../../Units/MMLCore/input.pas"/>
|
||||
<Caret Line="188" Column="63" TopLine="172"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="../../Units/MMLAddon/mmlthread.pas"/>
|
||||
<Caret Line="31" Column="21" TopLine="7"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="../../Units/MMLAddon/mmlthread.pas"/>
|
||||
<Caret Line="34" Column="6" TopLine="12"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="../../Units/MMLAddon/mmlthread.pas"/>
|
||||
<Caret Line="40" Column="12" TopLine="13"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="../../Units/MMLAddon/mmlthread.pas"/>
|
||||
<Caret Line="36" Column="38" TopLine="14"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="../../Units/MMLAddon/mmlthread.pas"/>
|
||||
<Caret Line="42" Column="5" TopLine="14"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="../../Units/MMLAddon/mmlthread.pas"/>
|
||||
<Caret Line="41" Column="38" TopLine="18"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="../../Units/MMLAddon/mmlthread.pas"/>
|
||||
<Caret Line="42" Column="47" TopLine="20"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="../../Units/MMLAddon/mmlthread.pas"/>
|
||||
<Caret Line="29" Column="12" TopLine="12"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="250" Column="18" TopLine="57"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="testunit.pas"/>
|
||||
<Caret Line="263" Column="20" TopLine="239"/>
|
||||
</Position29>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
@ -505,7 +533,7 @@
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)/"/>
|
||||
<OtherUnitFiles Value="$(ProjPath)../../Units/MMLCore/"/>
|
||||
<OtherUnitFiles Value="$(ProjPath)../../Units/MMLCore/;/home/merlijn/Programs/mufasa/Units/MMLAddon/"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<Optimizations>
|
||||
|
@ -7,7 +7,8 @@ uses
|
||||
cthreads, cmem,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, LResources, Window, files, MufasaTypes, Client, TestUnit, finder;
|
||||
Forms, LResources, Window, files, MufasaTypes, Client, TestUnit, finder,
|
||||
MMLThread;
|
||||
|
||||
{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}
|
||||
|
||||
|
@ -6,7 +6,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
||||
StdCtrls, Client, MufasaTypes;
|
||||
StdCtrls, Client, MufasaTypes, mmlthread;
|
||||
|
||||
type
|
||||
|
||||
@ -253,11 +253,14 @@ end;
|
||||
|
||||
procedure TForm1.Button1Click(Sender: TObject);
|
||||
Var
|
||||
MyThread: TMyThread;
|
||||
//MyThread: TMyThread;
|
||||
MMLThread: TMMLThread;
|
||||
|
||||
begin
|
||||
MyThread := TMyThread.Create(True);
|
||||
MyThread.Resume;
|
||||
{ MyThread := TMyThread.Create(True);
|
||||
MyThread.Resume; }
|
||||
MMLThread := TMMLThread.Create(True);
|
||||
MMLThread.Resume;
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
80
Units/MMLAddon/mmlthread.pas
Normal file
80
Units/MMLAddon/mmlthread.pas
Normal file
@ -0,0 +1,80 @@
|
||||
unit MMLThread;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, client;
|
||||
|
||||
type
|
||||
TMMLThread = class(TThread)
|
||||
protected
|
||||
Client: TClient;
|
||||
|
||||
procedure Execute; override;
|
||||
public
|
||||
constructor Create(CreateSuspended: Boolean);
|
||||
destructor Destroy;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{
|
||||
Note to Raymond: For PascalScript, Create it on the .Create,
|
||||
Execute it on the .Execute, and don't forget to Destroy it on .Destroy.
|
||||
|
||||
Furthermore, all the wrappers can be in the unit "implementation" section.
|
||||
Better still to create an .inc for it, otherwise this unit will become huge.
|
||||
(You can even split up the .inc's in stuff like color, bitmap, etc. )
|
||||
|
||||
Also, don't add PS to this unit, but make a seperate unit for it.
|
||||
Unit "MMLPSThread", perhaps?
|
||||
|
||||
See the TestUnit for use of this thread, it's pretty straightforward.
|
||||
|
||||
It may also be wise to turn the "Importing of wrappers" into an include as
|
||||
well, it will really make the unit more straightforward to use and read.
|
||||
}
|
||||
|
||||
|
||||
constructor TMMLThread.Create(CreateSuspended : boolean);
|
||||
begin
|
||||
Client := TClient.Create;
|
||||
// Create Stuff here
|
||||
|
||||
FreeOnTerminate := True;
|
||||
inherited Create(CreateSuspended);
|
||||
end;
|
||||
|
||||
destructor TMMLThread.Destroy;
|
||||
begin
|
||||
Client.Destroy;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TMMLThread.Execute;
|
||||
var
|
||||
i,w,h: Integer;
|
||||
|
||||
begin
|
||||
|
||||
i := 0;
|
||||
while (not Terminated) and (i < 10) do
|
||||
begin
|
||||
Sleep(1000);
|
||||
Client.MWindow.GetDimensions(W, H);
|
||||
writeln(inttostr(w) + ', ' + inttostr(h));
|
||||
Inc(i);
|
||||
end;
|
||||
end;
|
||||
|
||||
{ Include stuff here? }
|
||||
|
||||
//{$I inc/colors.inc}
|
||||
//{$I inc/bitmaps.inc}
|
||||
|
||||
|
||||
end.
|
||||
|
||||
|
@ -199,8 +199,8 @@ begin
|
||||
mouse_Right: Event.xbutton.button:= Button3;
|
||||
end;
|
||||
|
||||
event.xbutton.send_event := True;
|
||||
event.xbutton.same_screen:= True;
|
||||
event.xbutton.send_event := TBool(1);
|
||||
event.xbutton.same_screen:= TBool(1);
|
||||
event.xbutton.subwindow:= 0; // this can't be right.
|
||||
event.xbutton.root := TClient(Client).MWindow.DesktopWindow;
|
||||
event.xbutton.window := TClient(Client).MWindow.CurWindow;
|
||||
|
Loading…
Reference in New Issue
Block a user