mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-27 14:14:33 +02:00
Merged revisions 1552-1554 via svnmerge from
http://svn.freepascal.org/svn/fpc/trunk r1552 (florian) * fixed video unit for windows with sizes requiring scrolling * prevent potential overflow by changing integer to longint r1553 (florian) + printing support, currently win32 only r1554 (florian) * save untitled file dialogs looks nicer now git-svn-id: branches/fixes_2_0@1555 -
This commit is contained in:
parent
31f07c1e22
commit
473251178b
@ -143,6 +143,7 @@ const
|
|||||||
hidBreakpointDialogName = 208;
|
hidBreakpointDialogName = 208;
|
||||||
hidRunDir = 209;
|
hidRunDir = 209;
|
||||||
hidBreakpointDialogCond = 210;
|
hidBreakpointDialogCond = 210;
|
||||||
|
hidPrinterDevice = 211;
|
||||||
|
|
||||||
{ Command constants }
|
{ Command constants }
|
||||||
cmShowClipboard = 201;
|
cmShowClipboard = 201;
|
||||||
@ -191,14 +192,18 @@ const
|
|||||||
cmDoReload = 244;
|
cmDoReload = 244;
|
||||||
cmVectorRegisters = 245;
|
cmVectorRegisters = 245;
|
||||||
|
|
||||||
|
|
||||||
{ in wviews.pas defined
|
{ in wviews.pas defined
|
||||||
cmSelectAll = 246;
|
cmSelectAll = 246;
|
||||||
cmUnselect = 247;
|
cmUnselect = 247;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmPrint = 248;
|
||||||
|
|
||||||
cmNotImplemented = 1000;
|
cmNotImplemented = 1000;
|
||||||
cmNewFromTemplate = 1001;
|
cmNewFromTemplate = 1001;
|
||||||
cmShowReadme = 1002;
|
cmShowReadme = 1002;
|
||||||
|
cmPrinterSetup = 1003;
|
||||||
|
|
||||||
cmSearchWindow = 1500;
|
cmSearchWindow = 1500;
|
||||||
cmSourceWndClosing = 1601;
|
cmSourceWndClosing = 1601;
|
||||||
@ -415,6 +420,8 @@ const
|
|||||||
hcRegistersWindow = hcShift+cmRegisters;
|
hcRegistersWindow = hcShift+cmRegisters;
|
||||||
hcFPURegisters = hcShift+cmFPURegisters;
|
hcFPURegisters = hcShift+cmFPURegisters;
|
||||||
hcVectorRegisters = hcShift+cmVectorRegisters;
|
hcVectorRegisters = hcShift+cmVectorRegisters;
|
||||||
|
hcPrint = hcShift+cmPrint;
|
||||||
|
hcPrinterSetup = hcShift+cmPrinterSetup;
|
||||||
|
|
||||||
hcOpenAtCursor = hcShift+cmOpenAtCursor;
|
hcOpenAtCursor = hcShift+cmOpenAtCursor;
|
||||||
hcBrowseAtCursor = hcShift+cmBrowseAtCursor;
|
hcBrowseAtCursor = hcShift+cmBrowseAtCursor;
|
||||||
|
@ -117,6 +117,8 @@ begin
|
|||||||
hcSave : S:=hint_filesave;
|
hcSave : S:=hint_filesave;
|
||||||
hcSaveAs : S:=hint_filesaveas;
|
hcSaveAs : S:=hint_filesaveas;
|
||||||
hcSaveAll : S:=hint_filesaveall;
|
hcSaveAll : S:=hint_filesaveall;
|
||||||
|
hcPrint : S:=hint_print;
|
||||||
|
hcPrinterSetup : S:=hint_printersetup;
|
||||||
hcChangeDir : S:=hint_changedir;
|
hcChangeDir : S:=hint_changedir;
|
||||||
hcDOSShell : S:=hint_dosshell;
|
hcDOSShell : S:=hint_dosshell;
|
||||||
hcQuit : S:=hint_exit;
|
hcQuit : S:=hint_exit;
|
||||||
|
@ -58,6 +58,8 @@ type
|
|||||||
procedure NewFromTemplate;
|
procedure NewFromTemplate;
|
||||||
procedure OpenRecentFile(RecentIndex: integer);
|
procedure OpenRecentFile(RecentIndex: integer);
|
||||||
procedure ChangeDir;
|
procedure ChangeDir;
|
||||||
|
procedure Print;
|
||||||
|
procedure PrinterSetup;
|
||||||
procedure ShowClipboard;
|
procedure ShowClipboard;
|
||||||
procedure FindProcedure;
|
procedure FindProcedure;
|
||||||
procedure Objects;
|
procedure Objects;
|
||||||
@ -313,10 +315,13 @@ begin
|
|||||||
NewItem(menu_file_saveas,'',kbNoKey,cmSaveAs,hcSaveAs,
|
NewItem(menu_file_saveas,'',kbNoKey,cmSaveAs,hcSaveAs,
|
||||||
NewItem(menu_file_saveall,'',kbNoKey,cmSaveAll,hcSaveAll,
|
NewItem(menu_file_saveall,'',kbNoKey,cmSaveAll,hcSaveAll,
|
||||||
NewLine(
|
NewLine(
|
||||||
|
NewItem(menu_file_print,'',kbNoKey,cmPrint,hcPrint,
|
||||||
|
NewItem(menu_file_printsetup,'',kbNoKey,cmPrinterSetup,hcPrinterSetup,
|
||||||
|
NewLine(
|
||||||
NewItem(menu_file_changedir,'',kbNoKey,cmChangeDir,hcChangeDir,
|
NewItem(menu_file_changedir,'',kbNoKey,cmChangeDir,hcChangeDir,
|
||||||
NewItem(menu_file_dosshell,'',kbNoKey,cmDOSShell,hcDOSShell,
|
NewItem(menu_file_dosshell,'',kbNoKey,cmDOSShell,hcDOSShell,
|
||||||
NewItem(menu_file_exit,menu_key_file_exit,kbNoKey,cmQuit,hcQuit,
|
NewItem(menu_file_exit,menu_key_file_exit,kbNoKey,cmQuit,hcQuit,
|
||||||
nil)))))))))))),
|
nil))))))))))))))),
|
||||||
NewSubMenu(menu_edit,hcEditMenu, NewMenu(
|
NewSubMenu(menu_edit,hcEditMenu, NewMenu(
|
||||||
NewItem(menu_edit_undo,menu_key_edit_undo, kbAltBack, cmUndo, hcUndo,
|
NewItem(menu_edit_undo,menu_key_edit_undo, kbAltBack, cmUndo, hcUndo,
|
||||||
NewItem(menu_edit_redo,'', kbNoKey, cmRedo, hcRedo,
|
NewItem(menu_edit_redo,'', kbNoKey, cmRedo, hcRedo,
|
||||||
@ -663,6 +668,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
OpenFileName:='';
|
OpenFileName:='';
|
||||||
end;
|
end;
|
||||||
|
cmPrint : Print;
|
||||||
|
cmPrinterSetup : PrinterSetup;
|
||||||
cmSaveAll : SaveAll;
|
cmSaveAll : SaveAll;
|
||||||
cmChangeDir : ChangeDir;
|
cmChangeDir : ChangeDir;
|
||||||
cmDOSShell : DOSShell;
|
cmDOSShell : DOSShell;
|
||||||
|
@ -26,6 +26,8 @@ procedure CheckINIFile;
|
|||||||
function ReadINIFile: boolean;
|
function ReadINIFile: boolean;
|
||||||
function WriteINIFile(FromSaveAs : boolean) : boolean;
|
function WriteINIFile(FromSaveAs : boolean) : boolean;
|
||||||
|
|
||||||
|
function GetPrinterDevice: string;
|
||||||
|
procedure SetPrinterDevice(const Device: string);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -40,6 +42,22 @@ uses
|
|||||||
{$ifndef NODEBUG}FPDebug,{$endif}FPConst,FPVars,
|
{$ifndef NODEBUG}FPDebug,{$endif}FPConst,FPVars,
|
||||||
FPIntf,FPTools,FPSwitch,FPString;
|
FPIntf,FPTools,FPSwitch,FPString;
|
||||||
|
|
||||||
|
const
|
||||||
|
PrinterDevice : string = 'prn';
|
||||||
|
|
||||||
|
|
||||||
|
function GetPrinterDevice: string;
|
||||||
|
begin
|
||||||
|
GetPrinterDevice:=PrinterDevice;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure SetPrinterDevice(const Device: string);
|
||||||
|
begin
|
||||||
|
PrinterDevice:=Device;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
const
|
const
|
||||||
{ INI file sections }
|
{ INI file sections }
|
||||||
secFiles = 'Files';
|
secFiles = 'Files';
|
||||||
@ -60,6 +78,7 @@ const
|
|||||||
|
|
||||||
{ INI file tags }
|
{ INI file tags }
|
||||||
ieRecentFile = 'RecentFile';
|
ieRecentFile = 'RecentFile';
|
||||||
|
iePrinterDevice = 'PrinterDevice';
|
||||||
(* ieOpenFile = 'OpenFile';
|
(* ieOpenFile = 'OpenFile';
|
||||||
ieOpenFileCount = 'OpenFileCount'; *)
|
ieOpenFileCount = 'OpenFileCount'; *)
|
||||||
ieRunDir = 'RunDirectory';
|
ieRunDir = 'RunDirectory';
|
||||||
@ -351,6 +370,7 @@ begin
|
|||||||
{ Run }
|
{ Run }
|
||||||
SetRunDir(INIFile^.GetEntry(secRun,ieRunDir,GetRunDir));
|
SetRunDir(INIFile^.GetEntry(secRun,ieRunDir,GetRunDir));
|
||||||
SetRunParameters(INIFile^.GetEntry(secRun,ieRunParameters,GetRunParameters));
|
SetRunParameters(INIFile^.GetEntry(secRun,ieRunParameters,GetRunParameters));
|
||||||
|
SetPrinterDevice(INIFile^.GetEntry(secFiles,iePrinterDevice,GetPrinterDevice));
|
||||||
{ First read the primary file, which can also set the parameters which can
|
{ First read the primary file, which can also set the parameters which can
|
||||||
be overruled with the parameter loading }
|
be overruled with the parameter loading }
|
||||||
SetPrimaryFile(INIFile^.GetEntry(secCompile,iePrimaryFile,PrimaryFile));
|
SetPrimaryFile(INIFile^.GetEntry(secCompile,iePrimaryFile,PrimaryFile));
|
||||||
@ -548,6 +568,7 @@ begin
|
|||||||
{ Run }
|
{ Run }
|
||||||
INIFile^.SetEntry(secRun,ieRunDir,GetRunDir);
|
INIFile^.SetEntry(secRun,ieRunDir,GetRunDir);
|
||||||
INIFile^.SetEntry(secRun,ieRunParameters,GetRunParameters);
|
INIFile^.SetEntry(secRun,ieRunParameters,GetRunParameters);
|
||||||
|
INIFile^.SetEntry(secFiles,iePrinterDevice,GetPrinterDevice);
|
||||||
{ If DebuggeeTTY<>'' then }
|
{ If DebuggeeTTY<>'' then }
|
||||||
INIFile^.SetEntry(secRun,ieDebuggeeRedir,DebuggeeTTY);
|
INIFile^.SetEntry(secRun,ieDebuggeeRedir,DebuggeeTTY);
|
||||||
{$ifdef SUPPORT_REMOTE}
|
{$ifdef SUPPORT_REMOTE}
|
||||||
|
@ -222,3 +222,67 @@ begin
|
|||||||
GetDir(0,StartUpDir);
|
GetDir(0,StartUpDir);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TIDEApp.PrinterSetup;
|
||||||
|
var R,R2: TRect;
|
||||||
|
D: PCenterDialog;
|
||||||
|
IL: PEditorInputLine;
|
||||||
|
begin
|
||||||
|
R.Assign(0,0,round(ScreenWidth*54/80),4);
|
||||||
|
New(D, Init(R, dialog_setupprinter));
|
||||||
|
with D^ do
|
||||||
|
begin
|
||||||
|
GetExtent(R); R.Grow(-2,-1); Inc(R.A.Y); R.B.Y:=R.A.Y+1;
|
||||||
|
R2.Copy(R); R2.A.X:=16; Dec(R2.B.X,4);
|
||||||
|
New(IL, Init(R2, 255));
|
||||||
|
IL^.Data^:=GetPrinterDevice;
|
||||||
|
Insert(IL);
|
||||||
|
R2.Copy(R); R2.A.X:=R2.B.X-3; R2.B.X:=R2.A.X+3;
|
||||||
|
Insert(New(PHistory, Init(R2, IL, hidPrinterDevice)));
|
||||||
|
R2.Copy(R); R2.B.X:=16;
|
||||||
|
Insert(New(PLabel, Init(R2, label_setupprinter_device, IL)));
|
||||||
|
end;
|
||||||
|
InsertButtons(D);
|
||||||
|
IL^.Select;
|
||||||
|
if Desktop^.ExecView(D)=cmOK then
|
||||||
|
SetPrinterDevice(IL^.Data^);
|
||||||
|
Dispose(D, Done);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TIDEApp.Print;
|
||||||
|
var
|
||||||
|
d : string;
|
||||||
|
P : PSourceWindow;
|
||||||
|
i : longint;
|
||||||
|
f : text;
|
||||||
|
begin
|
||||||
|
d:=GetPrinterDevice;
|
||||||
|
{ sanity check }
|
||||||
|
if d='' then
|
||||||
|
d:='prn';
|
||||||
|
|
||||||
|
P:=Message(Desktop,evBroadcast,cmSearchWindow,nil);
|
||||||
|
if assigned(P) then
|
||||||
|
begin
|
||||||
|
assign(f,d);
|
||||||
|
rewrite(f);
|
||||||
|
if ioresult<>0 then
|
||||||
|
begin
|
||||||
|
MessageBox(#3+msg_PrintError,nil,mferror+mfokbutton);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
for i:=0 to P^.Editor^.Core^.GetLineCount-1 do
|
||||||
|
begin
|
||||||
|
writeln(f,P^.Editor^.Core^.GetLineText(i));
|
||||||
|
if ioresult<>0 then
|
||||||
|
begin
|
||||||
|
MessageBox(#3+msg_PrintError,nil,mferror+mfokbutton);
|
||||||
|
close(f);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
write(f,#12);
|
||||||
|
close(f);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
@ -53,6 +53,8 @@ const
|
|||||||
menu_file_saveas = 'Save ~a~s...';
|
menu_file_saveas = 'Save ~a~s...';
|
||||||
menu_file_saveall = 'Save a~l~l';
|
menu_file_saveall = 'Save a~l~l';
|
||||||
menu_file_reload = '~R~eload';
|
menu_file_reload = '~R~eload';
|
||||||
|
menu_file_print = '~P~rint';
|
||||||
|
menu_file_printsetup = 'Print s~e~tup';
|
||||||
menu_file_changedir = '~C~hange dir...';
|
menu_file_changedir = '~C~hange dir...';
|
||||||
menu_file_dosshell = 'Comman~d~ shell';
|
menu_file_dosshell = 'Comman~d~ shell';
|
||||||
menu_file_exit = 'E~x~it';
|
menu_file_exit = 'E~x~it';
|
||||||
@ -269,6 +271,8 @@ const
|
|||||||
|
|
||||||
msg_quitconfirm = 'Do You really want to quit?';
|
msg_quitconfirm = 'Do You really want to quit?';
|
||||||
|
|
||||||
|
msg_printerror = 'Error while printing';
|
||||||
|
|
||||||
{ CodeComplete dialog }
|
{ CodeComplete dialog }
|
||||||
dialog_codecomplete = 'CodeComplete';
|
dialog_codecomplete = 'CodeComplete';
|
||||||
label_codecomplete_keywords = '~K~eywords';
|
label_codecomplete_keywords = '~K~eywords';
|
||||||
@ -362,6 +366,9 @@ const
|
|||||||
dialog_programparameters = 'Program parameters';
|
dialog_programparameters = 'Program parameters';
|
||||||
label_parameters_parameter = '~P~arameter';
|
label_parameters_parameter = '~P~arameter';
|
||||||
|
|
||||||
|
dialog_setupprinter = 'Setup printer';
|
||||||
|
label_setupprinter_device = '~D~evice';
|
||||||
|
|
||||||
dialog_openoptions = 'Open Options';
|
dialog_openoptions = 'Open Options';
|
||||||
msg_cantopenconfigfile = 'Can''t open config file.';
|
msg_cantopenconfigfile = 'Can''t open config file.';
|
||||||
msg_errorsavingconfigfile = 'Error saving config file.';
|
msg_errorsavingconfigfile = 'Error saving config file.';
|
||||||
@ -936,6 +943,8 @@ const
|
|||||||
hint_filesave = 'Save the file in the active edit window';
|
hint_filesave = 'Save the file in the active edit window';
|
||||||
hint_filesaveas = 'Save the current file under a different name, directory or drive';
|
hint_filesaveas = 'Save the current file under a different name, directory or drive';
|
||||||
hint_filesaveall = 'Save all modified files';
|
hint_filesaveall = 'Save all modified files';
|
||||||
|
hint_print = 'Print current file';
|
||||||
|
hint_printersetup = 'Setup printer output device';
|
||||||
hint_changedir = 'Choose a new default directory';
|
hint_changedir = 'Choose a new default directory';
|
||||||
hint_dosshell = 'Temporarily exit to shell';
|
hint_dosshell = 'Temporarily exit to shell';
|
||||||
hint_exit = 'Exit the IDE';
|
hint_exit = 'Exit the IDE';
|
||||||
|
@ -2473,7 +2473,7 @@ begin
|
|||||||
if R.Empty then
|
if R.Empty then
|
||||||
begin
|
begin
|
||||||
GetStaticTextDimensions(S,40,Cols,Rows);
|
GetStaticTextDimensions(S,40,Cols,Rows);
|
||||||
if Cols<30 then Cols:=30; if Rows=0 then Rows:=1;
|
if Cols<32 then Cols:=32; if Rows=0 then Rows:=1;
|
||||||
R.Assign(0,0,3+Cols+3,Rows+6);
|
R.Assign(0,0,3+Cols+3,Rows+6);
|
||||||
if (AOptions and mfInsertInApp)= 0 then
|
if (AOptions and mfInsertInApp)= 0 then
|
||||||
R.Move((Desktop^.Size.X-(R.B.X-R.A.X)) div 2,(Desktop^.Size.Y-(R.B.Y-R.A.Y)) div 2)
|
R.Move((Desktop^.Size.X-(R.B.X-R.A.X)) div 2,(Desktop^.Size.Y-(R.B.Y-R.A.Y)) div 2)
|
||||||
|
@ -79,7 +79,7 @@ end;
|
|||||||
Procedure AssignVideoBuf (OldCols, OldRows : Word);
|
Procedure AssignVideoBuf (OldCols, OldRows : Word);
|
||||||
|
|
||||||
Var NewVideoBuf,NewOldVideoBuf : PVideoBuf;
|
Var NewVideoBuf,NewOldVideoBuf : PVideoBuf;
|
||||||
S,I,C,R,NewVideoBufSize : Integer;
|
S,I,C,R,NewVideoBufSize : longint;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
S:=SizeOf(TVideoCell);
|
S:=SizeOf(TVideoCell);
|
||||||
|
@ -414,7 +414,7 @@ begin
|
|||||||
SysVMD[SysVideoModeCount-1].Col:=dwMaximumWindowSize.X;
|
SysVMD[SysVideoModeCount-1].Col:=dwMaximumWindowSize.X;
|
||||||
SysVMD[SysVideoModeCount-1].Row:=dwMaximumWindowSize.Y;
|
SysVMD[SysVideoModeCount-1].Row:=dwMaximumWindowSize.Y;
|
||||||
SysVMD[SysVideoModeCount-1].Color:=true;
|
SysVMD[SysVideoModeCount-1].Color:=true;
|
||||||
OrigScreenSize := dwMaximumWindowSize.X * dwMaximumWindowSize.Y * SizeOf (Char_Info);
|
OrigScreenSize := max(dwMaximumWindowSize.X,dwSize.X) * max(dwMaximumWindowSize.Y,dwSize.Y) * SizeOf (Char_Info);
|
||||||
end;
|
end;
|
||||||
GetMem (OrigScreen, OrigScreenSize);
|
GetMem (OrigScreen, OrigScreenSize);
|
||||||
with C do
|
with C do
|
||||||
|
Loading…
Reference in New Issue
Block a user