mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-11 04:09:35 +01:00
Fixed sizing of the progress label
git-svn-id: trunk@7678 -
This commit is contained in:
parent
924ba29164
commit
a641b3fe25
@ -6,7 +6,7 @@ object SearchForm: TSearchForm
|
||||
OnCreate = SearchFormCREATE
|
||||
OnDestroy = SearchFormDESTROY
|
||||
ParentFont = True
|
||||
PixelsPerInch = 112
|
||||
PixelsPerInch = 96
|
||||
Position = poOwnerFormCenter
|
||||
HorzScrollBar.Page = 427
|
||||
VertScrollBar.Page = 148
|
||||
@ -16,6 +16,7 @@ object SearchForm: TSearchForm
|
||||
Width = 428
|
||||
object Panel2: TPanel
|
||||
Align = alClient
|
||||
BorderSpacing.OnChange = nil
|
||||
BevelInner = bvLowered
|
||||
ClientHeight = 149
|
||||
ClientWidth = 428
|
||||
@ -23,10 +24,10 @@ object SearchForm: TSearchForm
|
||||
ParentFont = True
|
||||
TabOrder = 0
|
||||
TabStop = True
|
||||
OnClick = Panel2Click
|
||||
Height = 149
|
||||
Width = 428
|
||||
object lblMatches: TLabel
|
||||
BorderSpacing.OnChange = nil
|
||||
Color = clNone
|
||||
Left = 96
|
||||
Height = 17
|
||||
@ -34,6 +35,7 @@ object SearchForm: TSearchForm
|
||||
Width = 321
|
||||
end
|
||||
object MatchesLabel: TLabel
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'Matches'
|
||||
Color = clNone
|
||||
Left = 16
|
||||
@ -42,7 +44,7 @@ object SearchForm: TSearchForm
|
||||
Width = 64
|
||||
end
|
||||
object lblProgress: TLabel
|
||||
AutoSize = False
|
||||
BorderSpacing.OnChange = nil
|
||||
Color = clNone
|
||||
Left = 96
|
||||
Height = 17
|
||||
@ -50,6 +52,7 @@ object SearchForm: TSearchForm
|
||||
Width = 320
|
||||
end
|
||||
object SearchingLabel: TLabel
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'Searching:'
|
||||
Color = clNone
|
||||
Left = 16
|
||||
@ -58,6 +61,7 @@ object SearchForm: TSearchForm
|
||||
Width = 64
|
||||
end
|
||||
object SearchTextLabel: TLabel
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'Search Text:'
|
||||
Color = clNone
|
||||
Left = 16
|
||||
@ -66,6 +70,7 @@ object SearchForm: TSearchForm
|
||||
Width = 80
|
||||
end
|
||||
object lblSearchText: TLabel
|
||||
BorderSpacing.OnChange = nil
|
||||
Color = clNone
|
||||
Left = 96
|
||||
Height = 17
|
||||
@ -74,6 +79,7 @@ object SearchForm: TSearchForm
|
||||
end
|
||||
object btnCancel: TButton
|
||||
AutoSize = True
|
||||
BorderSpacing.OnChange = nil
|
||||
Caption = 'Cancel'
|
||||
Default = True
|
||||
OnClick = btnAbortCLICK
|
||||
|
||||
@ -4,23 +4,25 @@ LazarusResources.Add('TSearchForm','FORMDATA',[
|
||||
'TPF0'#11'TSearchForm'#10'SearchForm'#11'BorderStyle'#7#8'bsDialog'#7'Caption'
|
||||
+#6#13'Searching....'#12'ClientHeight'#3#149#0#11'ClientWidth'#3#172#1#8'OnCr'
|
||||
+'eate'#7#16'SearchFormCREATE'#9'OnDestroy'#7#17'SearchFormDESTROY'#10'Parent'
|
||||
+'Font'#9#13'PixelsPerInch'#2'p'#8'Position'#7#17'poOwnerFormCenter'#18'HorzS'
|
||||
+'Font'#9#13'PixelsPerInch'#2'`'#8'Position'#7#17'poOwnerFormCenter'#18'HorzS'
|
||||
+'crollBar.Page'#3#171#1#18'VertScrollBar.Page'#3#148#0#4'Left'#3#205#1#6'Hei'
|
||||
+'ght'#3#149#0#3'Top'#3'!'#1#5'Width'#3#172#1#0#6'TPanel'#6'Panel2'#5'Align'#7
|
||||
+#8'alClient'#10'BevelInner'#7#9'bvLowered'#12'ClientHeight'#3#149#0#11'Clien'
|
||||
+'tWidth'#3#172#1#11'FullRepaint'#8#10'ParentFont'#9#8'TabOrder'#2#0#7'TabSto'
|
||||
+'p'#9#7'OnClick'#7#11'Panel2Click'#6'Height'#3#149#0#5'Width'#3#172#1#0#6'TL'
|
||||
+'abel'#10'lblMatches'#5'Color'#7#6'clNone'#4'Left'#2'`'#6'Height'#2#17#3'Top'
|
||||
+#2'P'#5'Width'#3'A'#1#0#0#6'TLabel'#12'MatchesLabel'#7'Caption'#6#7'Matches'
|
||||
+#5'Color'#7#6'clNone'#4'Left'#2#16#6'Height'#2#17#3'Top'#2'P'#5'Width'#2'@'#0
|
||||
+#0#6'TLabel'#11'lblProgress'#8'AutoSize'#8#5'Color'#7#6'clNone'#4'Left'#2'`'
|
||||
+#6'Height'#2#17#3'Top'#2'0'#5'Width'#3'@'#1#0#0#6'TLabel'#14'SearchingLabel'
|
||||
+#7'Caption'#6#10'Searching:'#5'Color'#7#6'clNone'#4'Left'#2#16#6'Height'#2#17
|
||||
+#3'Top'#2'0'#5'Width'#2'@'#0#0#6'TLabel'#15'SearchTextLabel'#7'Caption'#6#12
|
||||
+'Search Text:'#5'Color'#7#6'clNone'#4'Left'#2#16#6'Height'#2#17#3'Top'#2#16#5
|
||||
+'Width'#2'P'#0#0#6'TLabel'#13'lblSearchText'#5'Color'#7#6'clNone'#4'Left'#2
|
||||
+'`'#6'Height'#2#17#3'Top'#2#16#5'Width'#3'@'#1#0#0#7'TButton'#9'btnCancel'#8
|
||||
+'AutoSize'#9#7'Caption'#6#6'Cancel'#7'Default'#9#7'OnClick'#7#13'btnAbortCLI'
|
||||
+'CK'#8'TabOrder'#2#0#4'Left'#3#177#0#6'Height'#2#25#3'Top'#2'p'#5'Width'#2'K'
|
||||
+#0#0#0#0
|
||||
+#8'alClient'#22'BorderSpacing.OnChange'#13#10'BevelInner'#7#9'bvLowered'#12
|
||||
+'ClientHeight'#3#149#0#11'ClientWidth'#3#172#1#11'FullRepaint'#8#10'ParentFo'
|
||||
+'nt'#9#8'TabOrder'#2#0#7'TabStop'#9#6'Height'#3#149#0#5'Width'#3#172#1#0#6'T'
|
||||
+'Label'#10'lblMatches'#22'BorderSpacing.OnChange'#13#5'Color'#7#6'clNone'#4
|
||||
+'Left'#2'`'#6'Height'#2#17#3'Top'#2'P'#5'Width'#3'A'#1#0#0#6'TLabel'#12'Matc'
|
||||
+'hesLabel'#22'BorderSpacing.OnChange'#13#7'Caption'#6#7'Matches'#5'Color'#7#6
|
||||
+'clNone'#4'Left'#2#16#6'Height'#2#17#3'Top'#2'P'#5'Width'#2'@'#0#0#6'TLabel'
|
||||
+#11'lblProgress'#22'BorderSpacing.OnChange'#13#5'Color'#7#6'clNone'#4'Left'#2
|
||||
+'`'#6'Height'#2#17#3'Top'#2'0'#5'Width'#3'@'#1#0#0#6'TLabel'#14'SearchingLab'
|
||||
+'el'#22'BorderSpacing.OnChange'#13#7'Caption'#6#10'Searching:'#5'Color'#7#6
|
||||
+'clNone'#4'Left'#2#16#6'Height'#2#17#3'Top'#2'0'#5'Width'#2'@'#0#0#6'TLabel'
|
||||
+#15'SearchTextLabel'#22'BorderSpacing.OnChange'#13#7'Caption'#6#12'Search Te'
|
||||
+'xt:'#5'Color'#7#6'clNone'#4'Left'#2#16#6'Height'#2#17#3'Top'#2#16#5'Width'#2
|
||||
+'P'#0#0#6'TLabel'#13'lblSearchText'#22'BorderSpacing.OnChange'#13#5'Color'#7
|
||||
+#6'clNone'#4'Left'#2'`'#6'Height'#2#17#3'Top'#2#16#5'Width'#3'@'#1#0#0#7'TBu'
|
||||
+'tton'#9'btnCancel'#8'AutoSize'#9#22'BorderSpacing.OnChange'#13#7'Caption'#6
|
||||
+#6'Cancel'#7'Default'#9#7'OnClick'#7#13'btnAbortCLICK'#8'TabOrder'#2#0#4'Lef'
|
||||
+'t'#3#177#0#6'Height'#2#25#3'Top'#2'p'#5'Width'#2'K'#0#0#0#0
|
||||
]);
|
||||
|
||||
@ -53,7 +53,6 @@ type
|
||||
lblProgress: TLABEL;
|
||||
lblSearchText: TLABEL;
|
||||
Panel2: TPANEL;
|
||||
procedure Panel2Click(Sender: TObject);
|
||||
procedure SearchFormCREATE(Sender: TObject);
|
||||
procedure SearchFormDESTROY(Sender: TObject);
|
||||
procedure btnAbortCLICK(Sender: TObject);
|
||||
@ -71,7 +70,6 @@ type
|
||||
fAbort: boolean;
|
||||
fAbortString: string;
|
||||
fAborting: boolean;
|
||||
fCharWidth: longint;
|
||||
fSearchProject: boolean;
|
||||
fSearchOpen: boolean;
|
||||
fSearchFileList: TStringList;
|
||||
@ -115,10 +113,6 @@ begin
|
||||
end;
|
||||
|
||||
procedure TSearchForm.SearchFormCREATE(Sender: TObject);
|
||||
var
|
||||
FormFont: THandle;
|
||||
tm : TTextmetric;
|
||||
DC: HDC;
|
||||
begin
|
||||
//Set Defaults
|
||||
MatchesLabel.Caption:=lissMatches;
|
||||
@ -139,22 +133,8 @@ begin
|
||||
fSearchOpen:= false;
|
||||
fSearchFiles:= false;
|
||||
self.Caption:= dlgSearchCaption;
|
||||
try
|
||||
DC:= GetDC(0);
|
||||
FormFont:= SelectObject(DC, Font.Handle);
|
||||
GetTextMetrics(DC, tm);
|
||||
fCharWidth:= tm.tmAveCharWidth;
|
||||
finally
|
||||
SelectObject(DC, FormFont);
|
||||
ReleaseDC(0, DC);
|
||||
end;//finally
|
||||
end;//SearchFormCreate
|
||||
|
||||
procedure TSearchForm.Panel2Click(Sender: TObject);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TSearchForm.SearchFormDESTROY(Sender: TObject);
|
||||
begin
|
||||
FreeAndNil(fParsedMasks);
|
||||
@ -508,20 +488,14 @@ end;//UpdateMatches
|
||||
procedure TSearchForm.UpdateProgress(FileName: string);
|
||||
var
|
||||
DisplayFileName: string;
|
||||
OldDisplayFileNameLength:Integer;
|
||||
begin
|
||||
DisplayFileName := FileName;
|
||||
OldDisplayFileNameLength := Length(DisplayFileName) + Length(fPad);
|
||||
While ((Length(DisplayFileName) * fCharWidth) >= lblProgress.Width) do
|
||||
lblProgress.Caption:= DisplayFileName;
|
||||
while (lblProgress.Left + lblProgress.Width)> lblProgress.Parent.ClientWidth-12 do
|
||||
begin
|
||||
DisplayFileName:= PadAndShorten(DisplayFileName);
|
||||
if Length(DisplayFileName) < OldDisplayFileNameLength
|
||||
then
|
||||
OldDisplayFileNameLength := Length(DisplayFileName)
|
||||
else
|
||||
Break;
|
||||
lblProgress.Caption := DisplayFileName;
|
||||
end;//while
|
||||
lblProgress.Caption:= DisplayFileName;
|
||||
end;//UpdateProgress
|
||||
|
||||
function TSearchForm.PadAndShorten(FileName: string): string;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user