* base lineheight on TextMetric instead of font height

git-svn-id: trunk@22538 -
This commit is contained in:
marc 2009-11-11 23:32:30 +00:00
parent 4b3af617a2
commit 03d44b6c7a

View File

@ -6,7 +6,7 @@ interface
uses uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
ComCtrls, StdCtrls, Grids, ExtCtrls, LclType, DebuggerDlg, Debugger, ComCtrls, StdCtrls, Grids, ExtCtrls, LclType, LCLIntf, DebuggerDlg, Debugger,
EditorOptions, Maps, Math; EditorOptions, Maps, Math;
type type
@ -87,14 +87,13 @@ end;
constructor TAssemblerDlg.Create(AOwner: TComponent); constructor TAssemblerDlg.Create(AOwner: TComponent);
begin begin
FLineHeight := Abs(EditorOpts.EditorFontHeight) + EditorOpts.ExtraLineSpacing;
FGutterWidth := 32; FGutterWidth := 32;
inherited Create(AOwner); inherited Create(AOwner);
// DoubleBuffered := True; // DoubleBuffered := True;
pbAsm.Font.Name := EditorOpts.EditorFont;
pbAsm.Font.Height := EditorOpts.EditorFontHeight; pbAsm.Font.Height := EditorOpts.EditorFontHeight;
pbAsm.Font.Name := EditorOpts.EditorFont;
Caption := lisMenuViewAssembler; Caption := lisMenuViewAssembler;
end; end;
@ -145,18 +144,28 @@ begin
sbHorizontal.PageSize := R.Right; sbHorizontal.PageSize := R.Right;
sbHorizontal.LargeChange := R.Right div 3; sbHorizontal.LargeChange := R.Right div 3;
FLineCount := R.Bottom div FLineHeight; if FLineHeight <> 0
UpdateLineData(FTopLine + FLineCount); then begin
FLineCount := R.Bottom div FLineHeight;
UpdateLineData(FTopLine + FLineCount);
end;
pbAsm.SetBounds(0, 0, R.Right, R.Bottom); pbAsm.SetBounds(0, 0, R.Right, R.Bottom);
end; end;
procedure TAssemblerDlg.InitializeWnd; procedure TAssemblerDlg.InitializeWnd;
var
TM: TTextMetric;
begin begin
inherited InitializeWnd; inherited InitializeWnd;
FCharWidth := EditorOpts.ExtraCharSpacing + pbAsm.Canvas.TextExtent('X').cx; GetTextMetrics(pbAsm.Canvas.Handle, TM);
FCharWidth := EditorOpts.ExtraCharSpacing + TM.tmMaxCharWidth;
sbHorizontal.SmallChange := FCHarWidth; sbHorizontal.SmallChange := FCHarWidth;
FLineHeight := EditorOpts.ExtraLineSpacing + TM.tmHeight;
FLineCount := pbAsm.Height div FLineHeight;
UpdateLineData(FTopLine + FLineCount);
end; end;
procedure TAssemblerDlg.pbAsmMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure TAssemblerDlg.pbAsmMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);