Мрдуль Controls - основные доработки. Можно использовать. Пока не для WPFObjects

This commit is contained in:
Mikhalkovich Stanislav 2020-07-20 09:27:50 +03:00
parent 6710bed1cc
commit 25a5715a48
13 changed files with 684 additions and 380 deletions

View file

@ -15,7 +15,7 @@ internal static class RevisionClass
public const string Major = "3";
public const string Minor = "6";
public const string Build = "3";
public const string Revision = "2589";
public const string Revision = "2591";
public const string MainVersion = Major + "." + Minor;
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;

View file

@ -1,4 +1,4 @@
%MINOR%=6
%REVISION%=2589
%REVISION%=2591
%COREVERSION%=3
%MAJOR%=3

View file

@ -1 +1 @@
3.6.3.2589
3.6.3.2591

View file

@ -1 +1 @@
!define VERSION '3.6.3.2589'
!define VERSION '3.6.3.2591'

View file

@ -15,7 +15,7 @@
ABCDatabases,BlockFileOfT,Controls,
OpenCL, OpenCLABC,
OpenGL, OpenGLABC,
BBCMicroBit, School, SF
BBCMicroBit, School, SF, TwoPanelsWindow
;
begin

View file

@ -135,6 +135,7 @@
File ..\bin\Lib\School.pcu
File ..\bin\Lib\SF.pcu
File ..\bin\Lib\Turtle.pcu
File ..\bin\Lib\TwoPanelsWindow.pcu
File ..\bin\Lib\PABCRtl.dll
File ..\bin\Lib\HelixToolkit.Wpf.dll
@ -204,6 +205,8 @@
${AddFile} "School.pcu"
${AddFile} "SF.pcu"
${AddFile} "Turtle.pcu"
${AddFile} "TwoPanelsWindow.pcu"
${AddFile} "PABCRtl.dll"
${AddFile} "HelixToolkit.Wpf.dll"
@ -284,6 +287,7 @@
File ..\bin\Lib\School.pas
File ..\bin\Lib\SF.pas
File ..\bin\Lib\Turtle.pas
File ..\bin\Lib\TwoPanelsWindow.pas
File ..\bin\Lib\__RedirectIOMode.vb
File ..\bin\Lib\VBSystem.vb
@ -350,6 +354,8 @@
${AddFile} "School.pas"
${AddFile} "SF.pas"
${AddFile} "Turtle.pas"
${AddFile} "TwoPanelsWindow.pas"
${AddFile} "__RedirectIOMode.vb"
${AddFile} "VBSystem.vb"

View file

@ -1931,6 +1931,7 @@ public
begin
host1 := new Canvas;
host := new MyVisualHost();
host1.ClipToBounds := True;
host1.SizeChanged += (s,e) ->
begin
var sz := e.NewSize;

View file

@ -3385,7 +3385,7 @@ function Pyramid(p: Point3D; Sides: integer; Height, Radius: real; m: Material):
function PyramidWireFrame(x, y, z: real; Sides: integer; Height, Radius: real; Thickness: real; c: Color): PyramidTWireFrame := Inv(()->PyramidTWireFrame.Create(x, y, z, Sides, Radius, Height, thickness, c));
function PyramidWireFrame(p: Point3D; Sides: integer; Height, Radius: real; Thickness: real; c: Color): PyramidTWireFrame := PyramidWireFrame(p.x, p.y, p.z, Sides, Radius, Height, thickness, c);
function PyramidWireFrame(p: Point3D; Sides: integer; Height, Radius: real; Thickness: real; c: Color): PyramidTWireFrame := PyramidWireFrame(p.x, p.y, p.z, Sides, Height, Radius, thickness, c);
function Lego(x, y, z: real; Rows, Columns, Height: integer; m: Material): LegoT := Inv(()->LegoT.Create(x, y, z, Rows, Columns, Height, m));

View file

@ -202,6 +202,24 @@ namespace VisualPascalABC
return true;
}
else if (TextToLower == "with")
{
string cur, next, prev;
GetCurNextLines(out cur, out next, out prev);
if (!string.IsNullOrWhiteSpace(cur.Substring(caret.Column)))
return false;
var icur = Indent(cur);
ta.InsertString("\n" + Spaces(icur + 2));
if (cur.TrimStart().ToLower().StartsWith("match") && next == null || Indent(next) < icur || Indent(next) == icur && !next.TrimStart().ToLower().StartsWith("end"))
{
var tl_beg = new TextLocation(ta.Caret.Column, ta.Caret.Line);
int offset = doc.PositionToOffset(tl_beg);
var send = "\n" + Spaces(icur) + "end;";
doc.Insert(offset, send);
}
return true;
}
else if (Regex.IsMatch(TextToLower, "then|else|do|try|except|finally|var"))
{
if (ta.Caret.Line > 0 && TextToLower == "else")

File diff suppressed because it is too large Load diff

View file

@ -3385,7 +3385,7 @@ function Pyramid(p: Point3D; Sides: integer; Height, Radius: real; m: Material):
function PyramidWireFrame(x, y, z: real; Sides: integer; Height, Radius: real; Thickness: real; c: Color): PyramidTWireFrame := Inv(()->PyramidTWireFrame.Create(x, y, z, Sides, Radius, Height, thickness, c));
function PyramidWireFrame(p: Point3D; Sides: integer; Height, Radius: real; Thickness: real; c: Color): PyramidTWireFrame := PyramidWireFrame(p.x, p.y, p.z, Sides, Radius, Height, thickness, c);
function PyramidWireFrame(p: Point3D; Sides: integer; Height, Radius: real; Thickness: real; c: Color): PyramidTWireFrame := PyramidWireFrame(p.x, p.y, p.z, Sides, Height, Radius, thickness, c);
function Lego(x, y, z: real; Rows, Columns, Height: integer; m: Material): LegoT := Inv(()->LegoT.Create(x, y, z, Rows, Columns, Height, m));

View file

@ -1931,6 +1931,7 @@ public
begin
host1 := new Canvas;
host := new MyVisualHost();
host1.ClipToBounds := True;
host1.SizeChanged += (s,e) ->
begin
var sz := e.NewSize;

109
bin/Lib/TwoPanelsWindow.pas Normal file
View file

@ -0,0 +1,109 @@
unit TwoPanelsWindow;
{$reference 'PresentationFramework.dll'}
{$reference 'WindowsBase.dll'}
{$reference 'PresentationCore.dll'}
{$apptype windows}
uses System.Windows.Controls;
uses System.Windows;
uses System.Windows.Data;
uses System.Reflection;
uses System.Collections.ObjectModel;
var app := new Application();
var MainWindow := new Window;
procedure InitWPF;
begin
MainWindow.Title := 'WPF';
MainWindow.WindowStartupLocation := WindowStartupLocation.CenterScreen;
MainWindow.Width := 800;
MainWindow.Height := 600;
MainWindow.Show;
end;
function GetProperties<T>(t1: T): sequence of string;
begin
var props := t1.GetType.GetProperties;
Result := props.OrderBy(f->f.CustomAttributes.FirstOrDefault?.ToString ?? 'NoAttr').Select(f->f.Name);
end;
var
LeftPanel: StackPanel;
RightPanel: DockPanel;
procedure Init();
begin
var dp := new DockPanel;
MainWindow.Content := dp;
LeftPanel := new StackPanel();
LeftPanel.Width := 150;
dp.Children.Add(LeftPanel);
RightPanel := new DockPanel();
dp.Children.Add(RightPanel);
end;
type
///!#
Button = class
private
btn := new System.Windows.Controls.Button;
procedure p;
begin
if Click<>nil then
Click;
end;
public
Click: procedure;
constructor (Content: string);
begin
LeftPanel.Children.Add(btn);
btn.HorizontalAlignment := HorizontalAlignment.Stretch;
btn.Margin := new Thickness(5);
btn.Content := Content;
btn.Click += procedure (sender: object; args: RoutedEventArgs) ->
begin
p;
end;
end;
end;
///!#
ListView = class
private
lv := new System.Windows.Controls.ListView;
public
constructor ();
begin
var gv := new GridView;
lv.View := gv;
RightPanel.Children.Add(lv);
end;
procedure Отобразить<T>(data: sequence of T);
begin
var gv := lv.View as GridView;
var properties := GetProperties(data.First);
gv.Columns.Clear;
foreach var fld in properties do
begin
var col := new GridViewColumn;
col.Header := fld;
col.Width := 150;
col.DisplayMemberBinding := new Binding(fld);
gv.Columns.Add(col);
end;
lv.ItemsSource := data.Skip(1);
end;
end;
initialization
InitWPF;
Init;
finalization
app.Run();
end.