mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-05 13:56:00 +02:00
LazReport, lift up to preview window improving layout and functionality, from Julio Jimenez B.
git-svn-id: trunk@36938 -
This commit is contained in:
parent
98541475a5
commit
1dbb373b69
File diff suppressed because it is too large
Load Diff
@ -93,11 +93,15 @@ type
|
|||||||
{ TfrPreviewForm }
|
{ TfrPreviewForm }
|
||||||
|
|
||||||
TfrPreviewForm = class(TForm)
|
TfrPreviewForm = class(TForm)
|
||||||
|
BtZoomOut: TBitBtn;
|
||||||
|
BtZoomIn: TBitBtn;
|
||||||
frTBSeparator1: TPanel;
|
frTBSeparator1: TPanel;
|
||||||
frTBSeparator2: TPanel;
|
frTBSeparator2: TPanel;
|
||||||
frTBSeparator3: TPanel;
|
frTBSeparator3: TPanel;
|
||||||
LbPanel: TPanel;
|
LbPanel: TPanel;
|
||||||
PanTop: TPanel;
|
PanTop: TPanel;
|
||||||
|
PgDown: TSpeedButton;
|
||||||
|
PgUp: TSpeedButton;
|
||||||
ProcMenu: TPopupMenu;
|
ProcMenu: TPopupMenu;
|
||||||
N2001: TMenuItem;
|
N2001: TMenuItem;
|
||||||
N1501: TMenuItem;
|
N1501: TMenuItem;
|
||||||
@ -111,7 +115,6 @@ type
|
|||||||
N3: TMenuItem;
|
N3: TMenuItem;
|
||||||
OpenDialog: TOpenDialog;
|
OpenDialog: TOpenDialog;
|
||||||
SaveDialog: TSaveDialog;
|
SaveDialog: TSaveDialog;
|
||||||
Bevel2: TBevel;
|
|
||||||
N4: TMenuItem;
|
N4: TMenuItem;
|
||||||
N5: TMenuItem;
|
N5: TMenuItem;
|
||||||
N6: TMenuItem;
|
N6: TMenuItem;
|
||||||
@ -119,8 +122,8 @@ type
|
|||||||
PreviewPanel: TPanel;
|
PreviewPanel: TPanel;
|
||||||
ScrollBox1: TScrollBox;
|
ScrollBox1: TScrollBox;
|
||||||
RPanel: TPanel;
|
RPanel: TPanel;
|
||||||
PgUp: TSpeedButton;
|
BtPgFirst: TSpeedButton;
|
||||||
PgDown: TSpeedButton;
|
BtPgLast: TSpeedButton;
|
||||||
VScrollBar: TScrollBar;
|
VScrollBar: TScrollBar;
|
||||||
BPanel: TPanel;
|
BPanel: TPanel;
|
||||||
HScrollBar: TScrollBar;
|
HScrollBar: TScrollBar;
|
||||||
@ -129,10 +132,12 @@ type
|
|||||||
LoadBtn: TBitBtn;
|
LoadBtn: TBitBtn;
|
||||||
SaveBtn: TBitBtn;
|
SaveBtn: TBitBtn;
|
||||||
PrintBtn: TBitBtn;
|
PrintBtn: TBitBtn;
|
||||||
FindBtn: TBitBtn;
|
|
||||||
HelpBtn: TBitBtn;
|
|
||||||
ExitBtn: TBitBtn;
|
ExitBtn: TBitBtn;
|
||||||
|
procedure BtZoomInClick(Sender: TObject);
|
||||||
|
procedure BtZoomOutClick(Sender: TObject);
|
||||||
procedure FormResize(Sender: TObject);
|
procedure FormResize(Sender: TObject);
|
||||||
|
procedure BtPgFirstClick(Sender: TObject);
|
||||||
|
procedure BtPgLastClick(Sender: TObject);
|
||||||
procedure VScrollBarChange(Sender: TObject);
|
procedure VScrollBarChange(Sender: TObject);
|
||||||
procedure HScrollBarChange(Sender: TObject);
|
procedure HScrollBarChange(Sender: TObject);
|
||||||
procedure PgUpClick(Sender: TObject);
|
procedure PgUpClick(Sender: TObject);
|
||||||
@ -518,21 +523,9 @@ begin
|
|||||||
LoadBtn.Hint := sPreviewFormOpen;
|
LoadBtn.Hint := sPreviewFormOpen;
|
||||||
SaveBtn.Hint := sPreviewFormSave;
|
SaveBtn.Hint := sPreviewFormSave;
|
||||||
PrintBtn.Hint := sPreviewFormPrint;
|
PrintBtn.Hint := sPreviewFormPrint;
|
||||||
FindBtn.Hint := sPreviewFormFind;
|
|
||||||
HelpBtn.Hint := sPreviewFormHelp;
|
|
||||||
ExitBtn.Hint := sPreviewFormClose;
|
ExitBtn.Hint := sPreviewFormClose;
|
||||||
|
|
||||||
// adjust scrollbars widths
|
// TODO: ADD hints to new buttons
|
||||||
|
|
||||||
W := PgUp.Glyph.Width + 2;
|
|
||||||
VScrollbar.Width := W;
|
|
||||||
PgUp.Width := W;
|
|
||||||
PgDown. Width := W;
|
|
||||||
PgUp.Height := PgUp.Glyph.Height + 2;
|
|
||||||
PgDown.Height := PgDown.Glyph.Height + 2;
|
|
||||||
|
|
||||||
BPanel.Height := RPanel.Width;
|
|
||||||
HScrollbar.Height := W;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrPreviewForm.FormDestroy(Sender: TObject);
|
procedure TfrPreviewForm.FormDestroy(Sender: TObject);
|
||||||
@ -569,12 +562,9 @@ begin
|
|||||||
LoadBtn.Visible := pbLoad in TfrReport(Doc).PreviewButtons;
|
LoadBtn.Visible := pbLoad in TfrReport(Doc).PreviewButtons;
|
||||||
SaveBtn.Visible := pbSave in TfrReport(Doc).PreviewButtons;
|
SaveBtn.Visible := pbSave in TfrReport(Doc).PreviewButtons;
|
||||||
PrintBtn.Visible := pbPrint in TfrReport(Doc).PreviewButtons;
|
PrintBtn.Visible := pbPrint in TfrReport(Doc).PreviewButtons;
|
||||||
FindBtn.Visible := pbFind in TfrReport(Doc).PreviewButtons;
|
|
||||||
HelpBtn.Visible := pbHelp in TfrReport(Doc).PreviewButtons;
|
|
||||||
ExitBtn.Visible := pbExit in TfrReport(Doc).PreviewButtons;
|
ExitBtn.Visible := pbExit in TfrReport(Doc).PreviewButtons;
|
||||||
if not ZoomBtn.Visible then
|
if not ZoomBtn.Visible then
|
||||||
frTBSeparator1.Hide;
|
frTBSeparator1.Hide;
|
||||||
frTBSeparator3.Visible := FindBtn.Visible or HelpBtn.Visible;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
PrintBtn.Enabled := Printer.Printers.Count > 0;
|
PrintBtn.Enabled := Printer.Printers.Count > 0;
|
||||||
@ -851,9 +841,10 @@ begin
|
|||||||
Inc(i, nx);
|
Inc(i, nx);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
VScrollBar.Height := RPanel.Height - PgUp.height - PgDown.height;
|
// REMOVE: scrolls size hacks
|
||||||
if RPanel.Visible then
|
//VScrollBar.Height := RPanel.Height - PgUp.height - PgDown.height;
|
||||||
HScrollbar.Width := BPanel.Width - HScrollbar.Left - RPanel.Width;
|
//if RPanel.Visible then
|
||||||
|
// HScrollbar.Width := BPanel.Width - HScrollbar.Left - RPanel.Width;
|
||||||
|
|
||||||
if maxx < 0 then maxx := 0 else Inc(maxx, 10);
|
if maxx < 0 then maxx := 0 else Inc(maxx, 10);
|
||||||
if maxy < 0 then maxy := 0 else Inc(maxy, 10);
|
if maxy < 0 then maxy := 0 else Inc(maxy, 10);
|
||||||
@ -869,6 +860,56 @@ begin
|
|||||||
PaintAllowed := True;
|
PaintAllowed := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrPreviewForm.BtZoomOutClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if EMFPages = nil then Exit;
|
||||||
|
ofx := 0;
|
||||||
|
if LastScale > 0.1 then
|
||||||
|
begin
|
||||||
|
mode := mdNone;
|
||||||
|
per := (LastScale - 0.1);
|
||||||
|
HScrollBar.Position := 0;
|
||||||
|
FormResize(nil);
|
||||||
|
LastScale := per;
|
||||||
|
LastScaleMode := mode;
|
||||||
|
PBox.Repaint;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrPreviewForm.BtZoomInClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if EMFPages = nil then Exit;
|
||||||
|
ofx := 0;
|
||||||
|
if LastScale < 100 then
|
||||||
|
begin
|
||||||
|
mode := mdNone;
|
||||||
|
per := (LastScale + 0.1);
|
||||||
|
HScrollBar.Position := 0;
|
||||||
|
FormResize(nil);
|
||||||
|
LastScale := per;
|
||||||
|
LastScaleMode := mode;
|
||||||
|
PBox.Repaint;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrPreviewForm.BtPgFirstClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if EMFPages = nil then Exit;
|
||||||
|
if CurPage > 1 then
|
||||||
|
CurPage := 1;
|
||||||
|
ShowPageNum;
|
||||||
|
SetToCurPage;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrPreviewForm.BtPgLastClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if EMFPages = nil then Exit;
|
||||||
|
if CurPage < TfrEMFPages(EMFPages).Count then
|
||||||
|
CurPage := TfrEMFPages(EMFPages).Count;
|
||||||
|
ShowPageNum;
|
||||||
|
SetToCurPage;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfrPreviewForm.SetToCurPage;
|
procedure TfrPreviewForm.SetToCurPage;
|
||||||
begin
|
begin
|
||||||
if EMFPages = nil then Exit;
|
if EMFPages = nil then Exit;
|
||||||
@ -1009,6 +1050,7 @@ end;
|
|||||||
|
|
||||||
procedure TfrPreviewForm.PgUpClick(Sender: TObject);
|
procedure TfrPreviewForm.PgUpClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
if EMFPages = nil then Exit;
|
||||||
if CurPage > 1 then Dec(CurPage);
|
if CurPage > 1 then Dec(CurPage);
|
||||||
ShowPageNum;
|
ShowPageNum;
|
||||||
SetToCurPage;
|
SetToCurPage;
|
||||||
@ -1274,25 +1316,16 @@ begin
|
|||||||
RedrawAll;
|
RedrawAll;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//type THackBtn = class(TBitBtn);
|
|
||||||
|
|
||||||
procedure TfrPreviewForm.HelpBtnClick(Sender: TObject);
|
procedure TfrPreviewForm.HelpBtnClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Screen.Cursor := crHelp;
|
Screen.Cursor := crHelp;
|
||||||
SetCapture(Handle);
|
SetCapture(Handle);
|
||||||
//** THackBtn(HelpBtn).FMouseInControl := False;
|
|
||||||
HelpBtn.Invalidate;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrPreviewForm.FormMouseDown(Sender: TObject;
|
procedure TfrPreviewForm.FormMouseDown(Sender: TObject;
|
||||||
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||||
begin
|
begin
|
||||||
// HelpBtn.Down := False;
|
|
||||||
Screen.Cursor := crDefault;
|
Screen.Cursor := crDefault;
|
||||||
(* c := frControlAtPos(Self, Point(X, Y));
|
|
||||||
if (c <> nil) and (c <> HelpBtn) then
|
|
||||||
Application.HelpCommand(HELP_CONTEXTPOPUP, c.Tag);
|
|
||||||
*)
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user