PoChecker: GraphStat form:

- Show the form before constructing the icons
- Give visual feedback whilst constructing the icons

git-svn-id: trunk@46535 -
This commit is contained in:
bart 2014-10-12 11:52:31 +00:00
parent d02270af1c
commit 65a9bb9867
3 changed files with 43 additions and 7 deletions

View File

@ -2,10 +2,10 @@ object GraphStatForm: TGraphStatForm
Left = 652
Height = 544
Top = 116
Width = 636
Width = 637
Caption = 'Graphical summary'
ClientHeight = 544
ClientWidth = 636
ClientWidth = 637
OnActivate = FormActivate
OnClose = FormClose
OnCreate = FormCreate
@ -16,10 +16,10 @@ object GraphStatForm: TGraphStatForm
Left = 0
Height = 80
Top = 464
Width = 636
Width = 637
Align = alBottom
ClientHeight = 80
ClientWidth = 636
ClientWidth = 637
TabOrder = 0
object TranslatedShape: TShape
Left = 24
@ -63,6 +63,22 @@ object GraphStatForm: TGraphStatForm
Caption = 'FuzzyLabel'
ParentColor = False
end
object StatusLabel: TLabel
AnchorSideRight.Control = LegendPanel
AnchorSideRight.Side = asrBottom
Left = 404
Height = 25
Top = 17
Width = 222
Anchors = [akTop, akRight]
BorderSpacing.Right = 10
Caption = 'Creating icon nr %d of %d'
Font.Color = clRed
Font.Height = -19
ParentColor = False
ParentFont = False
Visible = False
end
end
object ListView: TListView
Left = 40

View File

@ -20,6 +20,7 @@ type
{ TGraphStatForm }
TGraphStatForm = class(TForm)
StatusLabel: TLabel;
ListView: TListView;
TranslatedLabel: TLabel;
UnTranslatedLabel: TLabel;
@ -47,7 +48,7 @@ type
Procedure SaveConfig;
function CreateBitmap(AStat: TStat): TBitmap;
procedure AddToListView(AStat: TStat; ABmp: TBitmap);
procedure DrawGraphs;
procedure DrawGraphs(Cnt: PtrInt);
procedure MaybeOpenInLazIDE(const Fn: String);
procedure MaybeOpenInExternalEditor(const Fn: String);
public
@ -96,6 +97,7 @@ begin
Application.HintHidePause := 5000;
LoadConfig;
WindowState := Settings.GraphFormWindowState;
Application.QueueAsyncCall(@DrawGraphs, FPoFamilyStats.Count);
end;
procedure TGraphStatForm.ListViewMouseMove(Sender: TObject; Shift: TShiftState;
@ -194,7 +196,7 @@ end;
procedure TGraphStatForm.FormActivate(Sender: TObject);
begin
//Doing this in TGraphStatForm.FormShow results in icons disappearing in Linux GTK2
DrawGraphs;
//DrawGraphs;
end;
procedure TGraphStatForm.FormDestroy(Sender: TObject);
@ -280,27 +282,44 @@ begin
ListItem.ImageIndex := ImgIndex;
end;
procedure TGraphStatForm.DrawGraphs;
procedure TGraphStatForm.DrawGraphs(Cnt: PtrInt);
var
Bmp: TBitmap;
AStat: TStat;
Index: Integer;
Cur: TCursor;
begin
if Assigned(FImgList) then FImgList.Free;
FImgList := TImageList.CreateSize(BmpWH, BmpWH);
ListView.Clear;
ListView.LargeImages := FImgList;
ListView.BeginUpdate;
Cur := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
StatusLabel.Visible := True;
for Index := 0 to FPoFamilyStats.Count - 1 do
begin
StatusLabel.Caption := Format(sCreatingIconXofY,[Index, Cnt]);
StatusLabel.Repaint;
AStat := FPoFamilyStats.Items[Index];
Bmp := CreateBitmap(AStat);
AddToListView(AStat, Bmp);
//if there are many icns to draw, occasionally update the ListView as visual feedback
if (((Index + 1) mod 25) = 0) then
begin
ListView.EndUpdate;
ListView.Repaint;
ListView.BeginUpdate;
end;
Bmp.Free;
end;
finally
ListView.EndUpdate;
Screen.Cursor := Cur;
StatusLabel.Visible := False;
end;
end;

View File

@ -56,6 +56,7 @@ resourcestring
SOpenFail = 'Unable to open file:' + LineEnding + '"%s"';
SOpenFailExternal = 'Unable to open file' + LineEnding +
'"%s"' + LineEnding + 'in external editor' + LineEnding + '"%s"';
sCreatingIconXofY = 'Creating icon nr. %d of %d';
//PoFamiles
sOriginal = 'Original';