- Timestamp:
- Nov 2, 2024, 10:04:51 PM (3 weeks ago)
- Location:
- branches/Independent
- Files:
-
- 6 added
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Independent/Forms/FormScreen.pas
r66 r67 31 31 var 32 32 I: Integer; 33 const 34 TitleHeight = 40; 33 35 begin 34 36 PaintBox1.Canvas.Brush.Color := clBlack; … … 45 47 PaintBox1.Canvas.Rectangle(Rect); 46 48 PaintBox1.Canvas.TextOut(Rect.Left + 20, Rect.Top + 5, Name); 49 PaintBox1.Canvas.Line(Rect.Left, Rect.Top + TitleHeight, Rect.Right, Rect.Top + TitleHeight); 47 50 end; 48 51 end; -
branches/Independent/Independent.lpi
r66 r67 24 24 <SearchPaths> 25 25 <IncludeFiles Value="$(ProjOutDir)"/> 26 <OtherUnitFiles Value="Forms "/>26 <OtherUnitFiles Value="Forms;Apps/Code;Apps/Test"/> 27 27 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)-$(BuildMode)"/> 28 28 </SearchPaths> … … 85 85 </Unit> 86 86 <Unit> 87 <Filename Value="Apps .pas"/>87 <Filename Value="Apps/Test/AppTest.pas"/> 88 88 <IsPartOfProject Value="True"/> 89 89 </Unit> … … 104 104 <IsPartOfProject Value="True"/> 105 105 <ComponentName Value="FormConsole"/> 106 <HasResources Value="True"/> 106 107 <ResourceBaseClass Value="Form"/> 107 108 </Unit> … … 110 111 <IsPartOfProject Value="True"/> 111 112 <ComponentName Value="FormScreen"/> 113 <HasResources Value="True"/> 112 114 <ResourceBaseClass Value="Form"/> 115 </Unit> 116 <Unit> 117 <Filename Value="Apps/Code/AppCode.pas"/> 118 <IsPartOfProject Value="True"/> 119 </Unit> 120 <Unit> 121 <Filename Value="SystemApi.pas"/> 122 <IsPartOfProject Value="True"/> 113 123 </Unit> 114 124 </Units> … … 121 131 <SearchPaths> 122 132 <IncludeFiles Value="$(ProjOutDir)"/> 123 <OtherUnitFiles Value="Forms "/>133 <OtherUnitFiles Value="Forms;Apps/Code;Apps/Test"/> 124 134 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)-$(BuildMode)"/> 125 135 </SearchPaths> -
branches/Independent/Independent.lpr
r66 r67 9 9 {$ENDIF} 10 10 Interfaces, // this includes the LCL widgetset 11 Forms, FormMain, FormScreen, SysUtils 11 Forms, FormMain, FormScreen, SysUtils, AppCode, SystemApi 12 12 { you can add units after this }; 13 13 -
branches/Independent/Os.pas
r66 r67 22 22 TRunningApp = class 23 23 private 24 AppThread: TAppThread;25 24 FApp: TApp; 26 25 procedure SetApp(AValue: TApp); 27 26 public 28 27 Context: TAppContext; 28 AppThread: TAppThread; 29 29 procedure Run; 30 30 constructor Create; … … 37 37 TRunningApps = class(TObjectList<TRunningApp>) 38 38 function AddNew(App: TApp; System: TSystem): TRunningApp; 39 end;40 41 { TSystemApi }42 43 TSystemApi = class(TApi)44 private45 FName: string;46 FText: string;47 procedure WriteLineSync;48 procedure RunAppSync;49 public50 App: TRunningApp;51 System: TSystem;52 procedure WriteLine(Text: string); override;53 procedure RunApp(Name: string); override;54 procedure Sleep(Time: TDateTime); override;55 function CreateWindow: THandle; override;56 procedure SetWindowName(Handle: THandle; Name: string); override;57 procedure SetWindowRect(Handle: THandle; Rect: TRect); override;58 procedure SetWindowVisible(Handle: THandle; Visible: Boolean); override;59 39 end; 60 40 … … 80 60 private 81 61 FOnDraw: TNotifyEvent; 82 procedure Redraw;83 62 public 84 63 Console: TConsole; … … 88 67 Windows: TWindows; 89 68 Handles: THandles; 69 procedure Redraw; 90 70 procedure RunApp(Name: string); 91 71 procedure Start; … … 95 75 end; 96 76 77 97 78 implementation 98 79 99 80 uses 100 App s;81 AppCode, AppTest, SystemApi; 101 82 102 83 { TAppThread } … … 151 132 end; 152 133 153 { TSystemApi }154 155 procedure TSystemApi.WriteLineSync;156 begin157 System.Console.Write(App.App.Name + ': ' + FText);158 end;159 160 procedure TSystemApi.RunAppSync;161 begin162 System.RunApp(FName);163 end;164 165 procedure TSystemApi.WriteLine(Text: string);166 begin167 FText := Text;168 App.AppThread.Synchronize(WriteLineSync);169 end;170 171 procedure TSystemApi.RunApp(Name: string);172 begin173 FName := Name;174 App.AppThread.Synchronize(RunAppSync);175 end;176 177 procedure TSystemApi.Sleep(Time: TDateTime);178 begin179 App.AppThread.Sleep(Round(Time / OneMillisecond));180 end;181 182 function TSystemApi.CreateWindow: THandle;183 var184 Window: TWindow;185 begin186 Window := System.Windows.AddNew;187 Window.Handle := System.Handles.AddNew;188 Result := Window.Handle;189 end;190 191 procedure TSystemApi.SetWindowName(Handle: THandle; Name: string);192 var193 Window: TWindow;194 begin195 Window := System.Windows.SearchByHandle(Handle);196 if Assigned(Window) then begin197 Window.Name := Name;198 System.Redraw;199 end;200 end;201 202 procedure TSystemApi.SetWindowRect(Handle: THandle; Rect: TRect);203 var204 Window: TWindow;205 begin206 Window := System.Windows.SearchByHandle(Handle);207 if Assigned(Window) then begin208 Window.Rect := Rect;209 System.Redraw;210 end;211 end;212 213 procedure TSystemApi.SetWindowVisible(Handle: THandle; Visible: Boolean);214 var215 Window: TWindow;216 begin217 Window := System.Windows.SearchByHandle(Handle);218 if Assigned(Window) then begin219 Window.Visible := Visible;220 System.Redraw;221 end;222 end;223 224 134 { TWindows } 225 135
Note:
See TracChangeset
for help on using the changeset viewer.