PoChecker: starts implementing graphical summary for statistics.

git-svn-id: trunk@46230 -
This commit is contained in:
bart 2014-09-14 14:21:05 +00:00
parent e7fad8fd70
commit 8dce505d77
10 changed files with 415 additions and 17 deletions

2
.gitattributes vendored
View File

@ -2905,6 +2905,8 @@ components/pochecker/Proj/README.txt svneol=native#text/plain
components/pochecker/Proj/pochecker.lpi svneol=native#text/plain
components/pochecker/Proj/pochecker.lpr svneol=native#text/plain
components/pochecker/README.txt svneol=native#text/plain
components/pochecker/graphstat.lfm svneol=native#text/plain
components/pochecker/graphstat.pp svneol=native#text/pascal
components/pochecker/languages/pocheckerconsts.cs.po svneol=native#text/plain
components/pochecker/languages/pocheckerconsts.de.po svneol=native#text/plain
components/pochecker/languages/pocheckerconsts.es.po svneol=native#text/plain

View File

@ -69,7 +69,7 @@
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="6">
<Units Count="7">
<Unit0>
<Filename Value="pochecker.lpr"/>
<IsPartOfProject Value="True"/>
@ -85,6 +85,7 @@
<ComponentName Value="ResultDlgForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ResultDlg"/>
</Unit2>
<Unit3>
<Filename Value="..\simplepofiles.pp"/>
@ -104,6 +105,14 @@
<ResourceBaseClass Value="Form"/>
<UnitName Value="pocheckermain"/>
</Unit5>
<Unit6>
<Filename Value="..\graphstat.pp"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="GraphStatForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="GraphStat"/>
</Unit6>
</Units>
</ProjectOptions>
<CompilerOptions>

View File

@ -7,7 +7,8 @@ uses
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, pocheckermain, pofamilies, resultdlg, simplepofiles, pocheckerconsts;
Forms, pocheckermain, pofamilies, resultdlg, simplepofiles, pocheckerconsts,
graphstat;
{$R *.res}
@ -15,6 +16,7 @@ begin
RequireDerivedFormResource := True;
Application.Initialize;
Application.CreateForm(TPoCheckerForm, PoCheckerForm);
Application.CreateForm(TGraphStatForm, GraphStatForm);
Application.Run;
end.

View File

@ -0,0 +1,24 @@
object GraphStatForm: TGraphStatForm
Left = 652
Height = 544
Top = 116
Width = 636
HorzScrollBar.Page = 602
HorzScrollBar.Range = 4000
HorzScrollBar.Visible = False
VertScrollBar.Page = 510
VertScrollBar.Range = 4000
BorderStyle = bsDialog
Caption = 'Graphical summary'
ClientHeight = 544
ClientWidth = 619
OnCreate = FormCreate
OnShow = FormShow
LCLVersion = '1.3'
object Img: TImage
Left = 0
Height = 4000
Top = 0
Width = 4000
end
end

View File

@ -0,0 +1,254 @@
unit GraphStat;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
PoFamilies, PoCheckerConsts, Math, LCLProc;
type
{ TGraphStatForm }
TGraphStatForm = class(TForm)
Img: TImage;
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ private declarations }
WidthPerStat: Integer;
HeightPerStat: Integer;
LegHeight: Integer;
SingleLegItemHeight: Integer;
FPoFamilyStats: TPoFamilyStats;
procedure CalcBoundsRequiredPerStat(out AWidth, AHeight: Integer);
procedure PrepareDimensions;
procedure DrawGraphs;
procedure DrawGraph(AStat: TStat; ARow, ACol: Integer);
procedure DrawLegenda;
public
{ public declarations }
property PoFamilyStats: TPoFamilyStats read FPoFamilyStats write FPoFamilyStats;
end;
var
GraphStatForm: TGraphStatForm;
implementation
{$R *.lfm}
const
Radius = 30;
Cols = 4;
clBack = clWhite;
clPie = clForm;
clTrans = clGreen;
clUnTrans = clRed;
clFuzzy = clFuchsia;
clCircle = clBlack;
clTxt = clBlack;
LMargin = 10;
RMargin = 10;
TMargin = 10;
BMargin = 10;
TxtMargin = 5;
LegTMargin = 40;
LegBMargin = 10;
LegLMargin = LMargin;
LegBarHeight = 20;
LegBarWidth = 40;
{ TGraphStatForm }
procedure TGraphStatForm.FormShow(Sender: TObject);
begin
PrepareDimensions;
DrawGraphs;
DrawLegenda;
end;
procedure TGraphStatForm.FormCreate(Sender: TObject);
begin
Caption := sGrapStatFormCaption;
end;
procedure TGraphStatForm.CalcBoundsRequiredPerStat(out AWidth, AHeight: Integer);
var
i, TW, TH, MaxTH: Integer;
Stat: TStat;
begin
AWidth := 2 * Radius;
MaxTH := 0;
for i := 0 to FPoFamilyStats.Count - 1 do
begin
Stat := FPoFamilyStats.Items[i];
TW := Img.Canvas.TextWidth(Stat.PoName);
TH := Img.Canvas.TextHeight(Stat.PoName);
if TW > AWidth then AWidth := TW;
if TH > MaxTH then MaxTH := TH;
end;
//Add margins
AWidth := AWidth + LMargin + RMargin; //L+R
AHeight := TMargin + 2 * Radius + TxtMargin + MaxTH + BMargin; //Top+distance between text and graph+Bottom
//Debugln('TGraphStatForm.CalcBoundsRequiredPerStat: AWidth = ',DbgS(AWidth),' AHeight = ',DbgS(AHeight),' MaxTH = ',DbgS(MaxTH));
end;
procedure TGraphStatForm.PrepareDimensions;
var
Rows, IHeight: Integer;
begin
CalcBoundsRequiredPerStat(WidthPerStat, HeightPerStat);
Img.Width := Cols * WidthPerStat;
Rows := Ceil(PoFamilyStats.Count / Cols);
IHeight := HeightPerStat * Rows;
SingleLegItemHeight := Max(Img.Canvas.TextHeight('qWM'), LegBarHeight);
LegHeight := LegTMargin + TxtMargin + (3 * SingleLegItemHeight + TxtMargin) + LegBMargin;
IHeight := IHeight + LegHeight;
ClientWidth := Img.Width;
Img.Height := IHeight;
Img.Height := IHeight;
//DebugLn('TGraphStatForm.FormShow: Img.Width -> ',DbgS(Img.Width), ' Canvas.Width = ',DbgS(Img.Canvas.Width));
//DebugLn('TGraphStatForm.FormShow: Img.Height -> ',DbgS(Img.Height),' Canvas.Heigth = ',DbgS(Img.Canvas.Height));
ClientHeight := Min(Screen.Height - 50, Img.Height);
VertScrollBar.Visible := (ClientHeight < Img.Height);
if Top + ClientHeight + 50 > Screen.Height then Top := 0;
end;
procedure TGraphStatForm.DrawGraphs;
var
Index, ARow, ACol: Integer;
begin
//debugln('TGraphStatForm.DrawGraphs: FPoFamilyStats.Count = ',DbgS(FPoFamilyStats.Count));
Img.Canvas.Brush.Color := clBack;
Img.Canvas.Clear;
Img.Canvas.FillRect(0,0,Img.Width,Img.Height);
for Index := 0 to FPoFamilyStats.Count - 1 do
begin
ARow := Index mod Cols;
ACol := Index div Cols;
DrawGraph(FPoFamilyStats.Items[Index], ARow, ACol);
end;
end;
procedure TGraphStatForm.DrawGraph(AStat: TStat; ARow, ACol: Integer);
var
X,Y, TW: Integer;
Origo: TPoint;
OrigoCol, PixCol: TColor;
begin
//debugln('TGraphStatForm.DrawGraph: PoName = ',DbgS(AStat.PoName));
Origo.X := (ARow * WidthPerStat) + (WidthPerStat div 2);
Origo.Y := (ACol * HeightPerStat) + Radius + TMargin;
//debugln('TGraphStatForm.DrawGraph: ARow = ',DbgS(ARow),' ACol = ',DbgS(ACol));
//debugln('TGraphStatForm.DrawGraph: Origo.X = ',DbgS(Origo.X),' Origo.Y = ',DbgS(Origo.Y));
{
Img.Canvas.Pen.Color := clCircle;
Img.Canvas.Brush.Color := clPie;
Img.Canvas.EllipseC(Origo.X,Origo.Y,Radius,Radius);
}
with Img do
begin
//First draw a circle
Canvas.Brush.Color := clPie;
Canvas.Pen.Color := clCircle;
Canvas.EllipseC(Origo.X,Origo.Y,Radius,Radius);
//Draw the Translated section
Canvas.MoveTo(Origo);
Canvas.LineTo(Origo.X + Radius, Origo.Y);
Canvas.MoveTo(Origo);
X := Origo.X + Round(Cos(AStat.FracTranslated * (2 * pi)) * Radius);
Y := Origo.Y - Round(Sin(AStat.FracTranslated * (2 * pi)) * Radius);
Canvas.LineTo(X, Y);
OrigoCol := Canvas.Pixels[Origo.X,Origo.Y];
//Calculate a point inside the section
X := Origo.X + Round(Cos((AStat.FracTranslated/2) * (2 * pi)) * (Radius - 3));
Y := Origo.Y - Round(Sin((AStat.FracTranslated/2) * (2 * pi)) * (Radius - 3));
Canvas.Brush.Color := clTrans;
PixCol := Canvas.Pixels[X,Y];
//Don't FloodFill if the section has no visible pixels on the screen
if (PixCol <> OrigoCol) then Canvas.FloodFill(X,Y,PixCol,fsSurface);
//Draw the UnTranslated section
Canvas.MoveTo(Origo);
X := Origo.X + Round(Cos((AStat.FracTranslated+AStat.FracUnTranslated) * 2 * pi) * Radius);
Y := Origo.Y - Round(Sin((AStat.FracTranslated+AStat.FracUnTranslated) * 2 * pi) * Radius);
Canvas.LineTo(X, Y);
//Calculate a point inside the section
X := Origo.X + Round(Cos((AStat.FracTranslated+AStat.FracUnTranslated/2) * (2 * pi)) * (Radius - 3));
Y := Origo.Y - Round(Sin((AStat.FracTranslated+AStat.FracUnTranslated/2) * (2 * pi)) * (Radius - 3));
Canvas.Brush.Color := clUnTrans;
PixCol := Canvas.Pixels[X,Y];
//Don't FloodFill if the section has no visible pixels on the screen
if (PixCol <> OrigoCol) then Canvas.FloodFill(X,Y,PixCol,fsSurface);
//Draw the Fuzzy section
Canvas.MoveTo(Origo);
X := Origo.X + Round(Cos((AStat.FracTranslated+AStat.FracUnTranslated+AStat.FracFuzzy) * 2 * pi) * Radius);
Y := Origo.Y - Round(Sin((AStat.FracTranslated+AStat.FracUnTranslated+AStat.FracFuzzy) * 2 * pi) * Radius);
Canvas.LineTo(X, Y);
//Calculate a point inside the section
X := Origo.X + Round(Cos((AStat.FracTranslated+AStat.FracUnTranslated+AStat.FracFuzzy/2) * (2 * pi)) * (Radius - 3));
Y := Origo.Y - Round(Sin((AStat.FracTranslated+AStat.FracUnTranslated+AStat.FracFuzzy/2) * (2 * pi)) * (Radius - 3));
Canvas.Brush.Color := clFuzzy;
PixCol := Canvas.Pixels[X,Y];
//Don't FloodFill if the section has no visible pixels on the screen
if (PixCol <> OrigoCol) then Canvas.FloodFill(X,Y,PixCol,fsSurface);
//Draw the text
TW := Canvas.TextWidth(AStat.PoName);
X := Origo.X - (TW div 2);
Y := Origo.Y + Radius + TxtMargin;
Canvas.Pen.Color := clTxt;
Canvas.Brush.Color := clBack;
Canvas.TextOut(X, Y, AStat.PoName);
end;
end;
procedure TGraphStatForm.DrawLegenda;
var
X, Y, LegTop, TH: Integer;
begin
LegTop := Img.Height - LegHeight;
//Debugln('TGraphStatForm.DrawLegenda: LegTop = ',DbgS(LegTop));
with Img do
begin
TH := Canvas.TextHeight('qWM');
X := LegLMargin;
Y := LegTop;
Canvas.Pen.Color := clTxt;
Canvas.MoveTo(LegLMargin, LegTop);
Canvas.LineTo(Img.Width - LegLMargin, LegTop);
Y := Y + TxtMargin;
Canvas.Brush.Color := clTrans;
Canvas.FillRect(X,Y,X+LegBarWidth,Y+LegBarHeight);
Canvas.Brush.Color := clBack;
Canvas.TextOut(X + LegBarWidth + TxtMargin, Y + ((LegBarHeight - TH) div 2), 'Translated');
Y := Y + SingleLegItemHeight + TxtMargin;
Canvas.Brush.Color := clUnTrans;
Canvas.FillRect(X,Y,X+LegBarWidth,Y+LegBarHeight);
Canvas.Brush.Color := clBack;
Canvas.TextOut(X + LegBarWidth + TxtMargin, Y + ((LegBarHeight - TH) div 2), 'Untranslated');
Y := Y + SingleLegItemHeight + TxtMargin;
Canvas.Brush.Color := clFuzzy;
Canvas.FillRect(X,Y,X+LegBarWidth,Y+LegBarHeight);
Canvas.Brush.Color := clBack;
Canvas.TextOut(X + LegBarWidth + TxtMargin, Y + ((LegBarHeight - TH) div 2), 'Fuzzy');
end;
end;
end.

View File

@ -31,6 +31,10 @@ resourcestring
sSaveCaption = 'Save to file';
sResults = 'Results';
sCopyCaption = 'Copy to clipboard';
sShowStatGraph = 'Show statistics graph';
//Graphical summary form
sGrapStatFormCaption = 'Graphical summary';
//PoFamiles
sOriginal = 'Original';

View File

@ -373,6 +373,10 @@ begin
try
ResultDlg.Log.Assign(SL);
FreeAndNil(SL); //No need to keep 2 copies of this data
if (pttCheckStatistics in TestTypes) then
ResultDlg.PoFamilyStats := PoFamily.PoFamilyStats
else
ResultDlg.PoFamilyStats := nil;
ResultDlg.ShowModal;
finally
ResultDlg.Free;

View File

@ -103,15 +103,19 @@ Type
property NrTranslated: Integer read FNrTranslated;
property NrUnTranslated: Integer read FNrUnTranslated;
property NrFuzzy: Integer read FNrFuzzy;
function PercTranslated: Double;
function PercUnTranslated: Double;
function PercFuzzy: Double;
function PercTranslated: Double; inline;
function PercUnTranslated: Double; inline;
function PercFuzzy: Double; inline;
function FracTranslated: Double;
function FracUnTranslated: Double;
function FracFuzzy: Double;
end;
TPoFamilyStats = class
private
FList: TFPObjectList;
function GetCount: Integer;
function GetItems(Index: Integer): TStat;
public
procedure Clear;
procedure Add(AName: String; ANrTotal, ANrTranslated, ANrUnTranslated, ANrFuzzy: Integer);
@ -119,6 +123,7 @@ Type
destructor Destroy; override;
procedure AddStatisticsToLog(ALog: TStrings);
property Items[Index: Integer]: TStat read GetItems;
property Count: Integer read GetCount;
end;
@ -325,17 +330,32 @@ end;
function TStat.PercTranslated: Double;
begin
Result := 100 * (FNrTranslated / FNrTotal);
Result := 100 * FracTranslated;
end;
function TStat.PercUnTranslated: Double;
begin
Result := 100 * (FNrUnTranslated / FNrTotal);
Result := 100 * FracUnTranslated;
end;
function TStat.PercFuzzy: Double;
begin
Result := 100 * (FNrFuzzy / FNrTotal);
Result := 100 * FracFuzzy;
end;
function TStat.FracTranslated: Double;
begin
Result := (FNrTranslated / FNrTotal);
end;
function TStat.FracUnTranslated: Double;
begin
Result := (FNrUnTranslated / FNrTotal);
end;
function TStat.FracFuzzy: Double;
begin
Result := (FNrFuzzy / FNrTotal);
end;
{ TPoFamilyStats }
@ -345,6 +365,11 @@ begin
Result := FList.Count;
end;
function TPoFamilyStats.GetItems(Index: Integer): TStat;
begin
Result := TStat(FList.Items[Index]);
end;
procedure TPoFamilyStats.Clear;
begin
FList.Clear;

View File

@ -13,7 +13,7 @@ object ResultDlgForm: TResultDlgForm
OnDestroy = FormDestroy
OnKeyDown = FormKeyDown
OnShow = FormShow
LCLVersion = '0.9.31'
LCLVersion = '1.3'
object Panel1: TPanel
Left = 0
Height = 50
@ -27,10 +27,10 @@ object ResultDlgForm: TResultDlgForm
object CloseBtn: TBitBtn
AnchorSideRight.Control = Panel1
AnchorSideRight.Side = asrBottom
Left = 643
Left = 657
Height = 26
Top = 12
Width = 89
Width = 75
Anchors = [akRight]
AutoSize = True
BorderSpacing.Right = 10
@ -41,10 +41,10 @@ object ResultDlgForm: TResultDlgForm
end
object SaveBtn: TBitBtn
AnchorSideRight.Control = CloseBtn
Left = 534
Left = 544
Height = 26
Top = 12
Width = 99
Width = 103
Anchors = [akRight]
AutoSize = True
BorderSpacing.Around = 10
@ -90,10 +90,10 @@ object ResultDlgForm: TResultDlgForm
end
object CopyBtn: TBitBtn
AnchorSideRight.Control = SaveBtn
Left = 395
Left = 393
Height = 26
Top = 12
Width = 129
Width = 141
Anchors = [akRight]
AutoSize = True
BorderSpacing.Around = 10
@ -137,6 +137,52 @@ object ResultDlgForm: TResultDlgForm
OnClick = CopyBtnClick
TabOrder = 0
end
object GraphStatBtn: TBitBtn
Left = 224
Height = 26
Top = 12
Width = 155
Anchors = [akRight]
Caption = 'Show statistics graph'
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF002E28EE0C2821EB81221BEAC91D15E8FF1911E72DFFFFFF00FFFF
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00403BF2453833F1DE5856EBFF6C6DE7FF332DE9FF1F17E82D984B20D29145
1DC98B411981853D160CFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF005452
F6546262F3FF7D7FEEFF9499EBFF8D91E9FF3B37ECFF261FEB2DA15127D2D68E
62FFB86643FF8D421ADE863D1748FFFFFF00FFFFFF00FFFFFF00696AFA155F5F
F8F39599F2FFA5AAEEFF7B81E6FF979AEBFF4440EFFF2E28EE2DA95A2DD2DB99
70FFE6A47FFFCB8057FFA65531FF883E1854FFFFFF00FFFFFF007476FB116B6C
FA996262F9F98485F4FFA3A8EFFFA0A5EDFF4F4CF1FF3733F12DB36234D2DEA1
79FFDE895BFFE6A67FFFD0875CFF90451CF38A401915FFFFFF00449A4C733D91
44666275D31B6566F98D5C5CF8F37C7EF3FF5958F4FF423EF22DBA6C3BD2E1A8
81FFE09264FFD9794CFFE7A884FFBE704AFF91451D84FFFFFF004DA556CF90BF
93FF3F9346EA388A3F725471B51D5F5FF87B5655F7ED4E4BF52DC37544D2E4B0
8BFFE39C6DFFDD8554FFE29667FFDA976DFF9A4C22CFFFFFFF0056AF60F0CAE8
C8FFAFD9ABFF92BF94FF3A8D40ED3482397E8171B814A4759118CB804BD2E7B7
93FFE7A677FFE0905DFFDE8E5CFFE6AD88FFA35328F3FFFFFF0060B86BF9B6E0
B1FF7BCC6FFF92D289FFADD9A9FF89B88BFF35843A9DD7915B56D18954F6EFC8
A9FFE6A673FFE29B67FFE29866FFE7B38FFFAB5C2EF0FFFFFF0068C175CFBADF
B8FF7ACC6DFF66C659FF72C866FFA8DAA3FF68A86DFF37863D3CD8925DC3E6B5
8EFFF0CCACFFE5A671FFE9B184FFE3AF88FFB46435CFFFFFFF0073C87F84B3DA
B5FFA2D89AFF6DCA5FFF66C658FF80CC75FFA3CEA3FF3F9346CFD4996232D993
5EFCF2D1B2FFEBB98DFFF0C9AAFFD89C70FFBC6D3D84FFFFFF007CCF891274CA
82F3BEE1BEFF94D489FF6ECA62FF6EC960FF9ED697FF93C196FF41964769DE9C
6696E7B48EFFF3D3B5FFE9BB98FFCB804BF3C5774512FFFFFF00FFFFFF007CD0
8A51A0D5A8FFBAE0BBFFA7DAA0FF7DCE70FF7FCD73FFB0D9ADFF4AA152ED9B9D
5B23DF9E68EDEBC29EFFDDA273FFD1895451FFFFFF00FFFFFF00FFFFFF00FFFF
FF007ED18C3F78CC85DEB4DCB7FFBCE0BAFFB9E1B5FFCEEACBFFA4CEA6FF4BA3
5496E3A46F69DF9F69DEDC99633FFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
FF00FFFFFF007FD28E0C79CE877E73C87FC66AC277FC63BC6FFC5BB567C655AD
5E7D8CA76103E4A6710AFFFFFF00FFFFFF00FFFFFF00FFFFFF00
}
OnClick = GraphStatBtnClick
TabOrder = 3
end
end
inline LogMemo: TSynEdit
Left = 98
@ -656,6 +702,7 @@ object ResultDlgForm: TResultDlgForm
ShiftMask = [ssShift, ssAlt, ssCtrl]
Command = emcMouseLink
end>
MouseTextActions = <>
MouseSelActions = <
item
ClickDir = cdDown
@ -667,23 +714,38 @@ object ResultDlgForm: TResultDlgForm
VisibleSpecialChars = [vscSpace, vscTabAtLast]
ReadOnly = True
ScrollBars = ssAutoBoth
SelectedColor.FrameEdges = sfeAround
SelectedColor.BackPriority = 50
SelectedColor.ForePriority = 50
SelectedColor.FramePriority = 50
SelectedColor.BoldPriority = 50
SelectedColor.ItalicPriority = 50
SelectedColor.UnderlinePriority = 50
SelectedColor.StrikeOutPriority = 50
IncrementColor.FrameEdges = sfeAround
HighlightAllColor.FrameEdges = sfeAround
BracketHighlightStyle = sbhsBoth
BracketMatchColor.Background = clNone
BracketMatchColor.Foreground = clNone
BracketMatchColor.FrameEdges = sfeAround
BracketMatchColor.Style = [fsBold]
FoldedCodeColor.Background = clNone
FoldedCodeColor.Foreground = clGray
FoldedCodeColor.FrameColor = clGray
FoldedCodeColor.FrameEdges = sfeAround
MouseLinkColor.Background = clNone
MouseLinkColor.Foreground = clBlue
MouseLinkColor.FrameEdges = sfeAround
LineHighlightColor.Background = clNone
LineHighlightColor.Foreground = clNone
LineHighlightColor.FrameEdges = sfeAround
inline SynLeftGutterPartList1: TSynGutterPartList
object SynGutterLineNumber1: TSynGutterLineNumber
Width = 17
MouseActions = <>
MarkupInfo.Background = clBtnFace
MarkupInfo.Foreground = clNone
MarkupInfo.FrameEdges = sfeAround
DigitCount = 2
ShowOnlyLineNumbersMultiplesOf = 1
ZeroStart = False

View File

@ -7,13 +7,14 @@ interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
ExtCtrls, Buttons, ClipBrd, LCLType, LCLProc, SynEdit, SynHighlighterPo,
pocheckerconsts;
PoFamilies, GraphStat, PoCheckerConsts;
type
{ TResultDlgForm }
TResultDlgForm = class(TForm)
GraphStatBtn: TBitBtn;
CopyBtn: TBitBtn;
SaveBtn: TBitBtn;
CloseBtn: TBitBtn;
@ -27,12 +28,15 @@ type
procedure FormDestroy(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure FormShow(Sender: TObject);
procedure GraphStatBtnClick(Sender: TObject);
procedure SaveBtnClick(Sender: TObject);
private
PoHL: TSynPoSyn;
FPoFamilyStats: TPoFamilyStats;
procedure SaveToFile;
public
property Log: TStringList read FLog write FLog;
property PoFamilyStats: TPoFamilyStats read FPoFamilyStats write FPoFamilyStats;
end;
implementation
@ -51,6 +55,7 @@ begin
LogMemo.Highlighter := PoHL;
SaveBtn.Caption := sSaveCaption;
CopyBtn.Caption := sCopyCaption;
GraphStatBtn.Caption := sShowStatGraph;
end;
procedure TResultDlgForm.FormClose(Sender: TObject;
@ -84,6 +89,13 @@ end;
procedure TResultDlgForm.FormShow(Sender: TObject);
begin
LogMemo.Lines.Assign(FLog);
GraphStatBtn.Visible := (PoFamilyStats <> nil) and (PoFamilyStats.Count > 0);
end;
procedure TResultDlgForm.GraphStatBtnClick(Sender: TObject);
begin
GraphStatForm.PoFamilyStats := Self.PoFamilyStats;
GraphStatForm.ShowModal;
end;
procedure TResultDlgForm.SaveBtnClick(Sender: TObject);
@ -105,7 +117,7 @@ begin
try
LogMemo.Lines.SaveToFile(SaveDialog.FileName);
except
MessageDlg('GPoCheck',Format(sSaveError,[SaveDialog.FileName]), mtError, [mbOk], 0);
MessageDlg('Po-checker',Format(sSaveError,[SaveDialog.FileName]), mtError, [mbOk], 0);
end;
end;
end;