mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-02 11:54:52 +01:00
225 lines
6.3 KiB
PHP
225 lines
6.3 KiB
PHP
{
|
|
$Id$
|
|
This file is part of the Free Pascal Integrated Development Environment
|
|
Copyright (c) 1998 by Berczi Gabor
|
|
|
|
File menu entries
|
|
|
|
See the file COPYING.FPC, included in this distribution,
|
|
for details about the copyright.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
**********************************************************************}
|
|
|
|
procedure TIDEApp.NewEditor;
|
|
begin
|
|
OpenEditorWindow(nil,'',0,0);
|
|
end;
|
|
|
|
|
|
procedure TIDEApp.NewFromTemplate;
|
|
var D: PCenterDialog;
|
|
R,R2: TRect;
|
|
SB: PScrollBar;
|
|
LB: PAdvancedListBox;
|
|
I: integer;
|
|
C: PUnsortedStringCollection;
|
|
TE: PSourceWindow;
|
|
begin
|
|
if GetTemplateCount=0 then
|
|
begin InformationBox('No templates available.',nil); Exit; end;
|
|
New(C, Init(10,10));
|
|
R.Assign(0,0,40,14);
|
|
New(D, Init(R, 'New from template'));
|
|
with D^ do
|
|
begin
|
|
GetExtent(R); R.Grow(-2,-2); Inc(R.A.Y); Dec(R.B.X,12);
|
|
R2.Copy(R); R2.Move(1,0); R2.A.X:=R2.B.X-1;
|
|
New(SB, Init(R2)); Insert(SB);
|
|
|
|
New(LB, Init(R,1,SB));
|
|
LB^.Default:=true;
|
|
for I:=0 to GetTemplateCount-1 do
|
|
C^.Insert(NewStr(GetTemplateName(I)));
|
|
LB^.NewList(C);
|
|
Insert(LB);
|
|
Dec(R.A.Y); R.B.Y:=R.A.Y+1;
|
|
Insert(New(PLabel, Init(R, 'Available ~t~emplates', LB)));
|
|
|
|
GetExtent(R2); R2.Grow(-2,-3); R2.A.X:=R.B.X+2; R2.B.Y:=R2.A.Y+2;
|
|
Insert(New(PButton, Init(R2, 'O~K~', cmOK, bfDefault)));
|
|
R2.Move(0,2);
|
|
Insert(New(PButton, Init(R2, 'Cancel', cmCancel, bfNormal)));
|
|
end;
|
|
LB^.Select;
|
|
if Desktop^.ExecView(D)=cmOK then
|
|
begin
|
|
Desktop^.Lock;
|
|
TE:=OpenEditorWindow(nil,'',0,0);
|
|
if TE<>nil then
|
|
begin
|
|
StartTemplate(LB^.Focused,TE^.Editor);
|
|
TE^.Editor^.Modified:=false; { if nothing changes, we don't need to save it }
|
|
TE^.Hide; { we need this trick to get the editor updated }
|
|
TE^.Show;
|
|
end;
|
|
Desktop^.UnLock;
|
|
end;
|
|
Dispose(D, Done);
|
|
Dispose(C, Done);
|
|
end;
|
|
|
|
|
|
procedure TIDEApp.Open(FileName: string);
|
|
var D: PFileDialog;
|
|
OpenIt: boolean;
|
|
begin
|
|
OpenIt:=FileName<>'';
|
|
if not OpenIt then
|
|
begin
|
|
New(D, Init(OpenExts,'Open a file','File to open',fdOpenButton,0));
|
|
OpenIt:=Desktop^.ExecView(D)<>cmCancel;
|
|
if OpenIt then
|
|
Begin
|
|
D^.GetFileName(FileName);
|
|
OpenExts:=D^.WildCard;
|
|
End;
|
|
Dispose(D, Done);
|
|
end;
|
|
if OpenIt then
|
|
begin
|
|
FileName:=FExpand(LocatePasFile(FileName));
|
|
OpenEditorWindow(nil,FileName,0,0);
|
|
end;
|
|
end;
|
|
|
|
function TIDEApp.OpenSearch(FileName: string) : boolean;
|
|
var D: PFileDialog;
|
|
OpenIt: boolean;
|
|
P : PString;
|
|
Dir : String;
|
|
begin
|
|
OpenIt:=False;
|
|
if not OpenIt then
|
|
begin
|
|
New(D, Init(FileName+'*','Open a file','Looking for '+FileName,fdOpenButton,0));
|
|
OpenIt:=Desktop^.ExecView(D)<>cmCancel;
|
|
if OpenIt then
|
|
Begin
|
|
D^.GetFileName(FileName);
|
|
End;
|
|
Dispose(D, Done);
|
|
end;
|
|
if OpenIt then
|
|
begin
|
|
FileName:=FExpand(LocatePasFile(FileName));
|
|
Dir:=DirOf(FileName);
|
|
P:=@Dir;
|
|
If Pos(Dir+';',GetSourceDirectories)=0 then
|
|
if ConfirmBox(#3'Directory %s is not in list'#13#3+
|
|
'Should we add it ?',@P,false)=cmYes then
|
|
SourceDirs:=SourceDirs+';'+Dir;
|
|
|
|
OpenEditorWindow(nil,FileName,0,0);
|
|
end;
|
|
OpenSearch:=OpenIt;
|
|
end;
|
|
|
|
|
|
procedure TIDEApp.OpenRecentFile(RecentIndex: integer);
|
|
begin
|
|
with RecentFiles[RecentIndex] do
|
|
if OpenEditorWindow(nil,FileName,LastPos.X,LastPos.Y)<>nil then
|
|
RemoveRecentFile(RecentIndex);
|
|
end;
|
|
|
|
function TIDEApp.SaveAll: boolean;
|
|
|
|
procedure SendSave(P: PView); {$ifndef FPC}far;{$endif}
|
|
begin
|
|
Message(P,evCommand,cmSave,nil);
|
|
end;
|
|
|
|
begin
|
|
SaveCancelled:=false;
|
|
Desktop^.ForEach(@SendSave);
|
|
SaveAll:=not SaveCancelled;
|
|
end;
|
|
|
|
|
|
procedure TIDEApp.ChangeDir;
|
|
begin
|
|
ExecuteDialog(New(PChDirDialog, Init(cdNormal, hisChDirDialog)),nil);
|
|
CurDirChanged;
|
|
end;
|
|
|
|
{
|
|
$Log$
|
|
Revision 1.10 1999-03-23 15:11:32 peter
|
|
* desktop saving things
|
|
* vesa mode
|
|
* preferences dialog
|
|
|
|
Revision 1.9 1999/02/19 18:43:47 peter
|
|
+ open dialog supports mask list
|
|
|
|
Revision 1.8 1999/02/05 12:11:57 pierre
|
|
+ SourceDir that stores directories for sources that the
|
|
compiler should not know about
|
|
Automatically asked for addition when a new file that
|
|
needed filedialog to be found is in an unknown directory
|
|
Stored and retrieved from INIFile
|
|
+ Breakpoints conditions added to INIFile
|
|
* Breakpoints insterted and removed at debin and end of debug session
|
|
|
|
Revision 1.7 1999/02/04 13:32:05 pierre
|
|
* Several things added (I cannot commit them independently !)
|
|
+ added TBreakpoint and TBreakpointCollection
|
|
+ added cmResetDebugger,cmGrep,CmToggleBreakpoint
|
|
+ Breakpoint list in INIFile
|
|
* Select items now also depend of SwitchMode
|
|
* Reading of option '-g' was not possible !
|
|
+ added search for -Fu args pathes in TryToOpen
|
|
+ added code for automatic opening of FileDialog
|
|
if source not found
|
|
|
|
Revision 1.6 1999/02/02 16:41:41 peter
|
|
+ automatic .pas/.pp adding by opening of file
|
|
* better debuggerscreen changes
|
|
|
|
Revision 1.5 1999/01/21 11:54:17 peter
|
|
+ tools menu
|
|
+ speedsearch in symbolbrowser
|
|
* working run command
|
|
|
|
Revision 1.4 1999/01/14 21:42:21 peter
|
|
* source tracking from Gabor
|
|
|
|
Revision 1.3 1999/01/04 11:49:46 peter
|
|
* 'Use tab characters' now works correctly
|
|
+ Syntax highlight now acts on File|Save As...
|
|
+ Added a new class to syntax highlight: 'hex numbers'.
|
|
* There was something very wrong with the palette managment. Now fixed.
|
|
+ Added output directory (-FE<xxx>) support to 'Directories' dialog...
|
|
* Fixed some possible bugs in Running/Compiling, and the compilation/run
|
|
process revised
|
|
|
|
Revision 1.2 1998/12/28 15:47:47 peter
|
|
+ Added user screen support, display & window
|
|
+ Implemented Editor,Mouse Options dialog
|
|
+ Added location of .INI and .CFG file
|
|
+ Option (INI) file managment implemented (see bottom of Options Menu)
|
|
+ Switches updated
|
|
+ Run program
|
|
|
|
Revision 1.4 1998/12/24 08:27:12 gabor
|
|
+ displaying 'opening source file...' text while reading
|
|
Revision 1.3 1998/12/22 10:39:46 peter
|
|
+ options are now written/read
|
|
+ find and replace routines
|
|
|
|
}
|