mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-22 08:29:29 +02:00
* '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
This commit is contained in:
parent
913d5f2133
commit
bcecca182a
@ -18,12 +18,22 @@ begin
|
||||
status.maxerrorcount:=50;
|
||||
do_comment(V_Error,'Fake Compiler');
|
||||
do_comment(V_Error,'Cmd = "'+cmd+'"');
|
||||
Compile:=0;
|
||||
end;
|
||||
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 1998-12-28 15:44:59 peter
|
||||
Revision 1.3 1999-01-04 11:49:39 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:44:59 peter
|
||||
* use V_Error
|
||||
* set status.verbosity
|
||||
|
||||
|
@ -1,16 +1,10 @@
|
||||
--- To do ---
|
||||
|
||||
* Most editor-actions are not aware if current selection, eg.
|
||||
a line insertion does not shift the start and/or the end of the selection.
|
||||
* Implement Help|Files...
|
||||
* Implement missing option dialogs in Options menu, and
|
||||
* store settings & options
|
||||
* User screen
|
||||
|
||||
--- Ideas ---
|
||||
|
||||
* Integrated source beautifier (fully configurable)
|
||||
* Add some other classes to syntax highlight
|
||||
(eg. highlight standard Pascal types, etc.)
|
||||
|
||||
|
||||
* Integrated source beautifier (fully configurable)
|
||||
* Add some other classes to syntax highlight
|
||||
(eg. highlight standard Pascal types, etc.)
|
||||
* ASCII-table for inserting chars not accessible thru keyboard
|
||||
* Binary->source (const table/array) converter
|
||||
|
||||
|
||||
|
@ -84,8 +84,14 @@ type
|
||||
procedure UpdateRecentFileList;
|
||||
end;
|
||||
|
||||
function IDEUseSyntaxHighlight(Editor: PFileEditor): boolean; {$ifndef FPC}far;{$endif}
|
||||
begin
|
||||
IDEUseSyntaxHighlight:=MatchesFileList(NameAndExtOf(Editor^.FileName),HighlightExts);
|
||||
end;
|
||||
|
||||
constructor TIDEApp.Init;
|
||||
begin
|
||||
{$ifndef EDITORS}UseSyntaxHighlight:=IDEUseSyntaxHighlight;{$endif}
|
||||
inherited Init;
|
||||
New(ClipboardWindow, Init);
|
||||
Desktop^.Insert(ClipboardWindow);
|
||||
@ -368,6 +374,7 @@ begin
|
||||
if PrimaryFile<>'' then
|
||||
SetCmdState(CompileCmds,true);
|
||||
UpdateMenu(MenuBar^.Menu);
|
||||
Message(ProgramInfoWindow,evBroadcast,cmUpdate,nil);
|
||||
end;
|
||||
|
||||
procedure TIDEApp.UpdateINIFile;
|
||||
@ -486,8 +493,9 @@ begin
|
||||
end;
|
||||
|
||||
function TIDEApp.GetPalette: PPalette;
|
||||
const P: string[length(CIDEAppColor)] = CIDEAppColor;
|
||||
var P: string;
|
||||
begin
|
||||
P:=AppPalette;
|
||||
GetPalette:=@P;
|
||||
end;
|
||||
|
||||
@ -570,8 +578,14 @@ BEGIN
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 1998-12-30 13:38:38 peter
|
||||
* patches from Gabor
|
||||
Revision 1.4 1999-01-04 11:49:41 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:40 peter
|
||||
+ Added user screen support, display & window
|
||||
|
@ -37,7 +37,7 @@ procedure DoCompile(Mode: TCompileMode);
|
||||
implementation
|
||||
|
||||
uses
|
||||
Video,CRt,
|
||||
Dos,Video,
|
||||
Objects,Drivers,Views,App,
|
||||
CompHook,
|
||||
FPConst,FPVars,FPUtils,FPIntf,FPSwitches;
|
||||
@ -88,7 +88,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
ST^.SetText(
|
||||
'Main file: '+MainFile+#13+
|
||||
'Main file: '+SmartPath(MainFile)+#13+
|
||||
StatusS+#13#13+
|
||||
'Target: '+LExpand(KillTilde(TargetSwitches^.ItemName(TargetSwitches^.GetCurrSel)),12)+' '+
|
||||
'Line number: '+IntToStrL(Status.CurrentLine,7)+#13+
|
||||
@ -126,6 +126,20 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function GetExePath: string;
|
||||
var Path: string;
|
||||
I: integer;
|
||||
begin
|
||||
Path:='.\';
|
||||
if DirectorySwitches<>nil then
|
||||
with DirectorySwitches^ do
|
||||
for I:=0 to ItemCount-1 do
|
||||
begin
|
||||
if Pos('EXE',KillTilde(ItemName(I)))>0 then
|
||||
begin Path:=GetStringItem(I); Break; end;
|
||||
end;
|
||||
GetExePath:=CompleteDir(FExpand(Path));
|
||||
end;
|
||||
|
||||
{****************************************************************************
|
||||
DoCompile
|
||||
@ -164,7 +178,8 @@ begin
|
||||
end;
|
||||
FileName:=P^.Editor^.FileName;
|
||||
end;
|
||||
MainFile:=SmartPath(FileName);
|
||||
MainFile:=FExpand(FileName);
|
||||
EXEFile:=GetEXEPath+NameAndExtOf(MainFile);
|
||||
{ Reset }
|
||||
CtrlBreakHit:=false;
|
||||
{ Show Program Info }
|
||||
@ -186,10 +201,12 @@ begin
|
||||
|
||||
Compile(FileName);
|
||||
|
||||
CompilationPhase:=cpDone;
|
||||
if status.errorCount=0
|
||||
then CompilationPhase:=cpDone
|
||||
else CompilationPhase:=cpFailed;
|
||||
SD^.Update;
|
||||
|
||||
if ((status.errorcount=0) or (ShowStatusOnError)) and (Mode<>cRun) then
|
||||
if ((CompilationPhase in[cpDone,cpFailed]) or (ShowStatusOnError)) and (Mode<>cRun) then
|
||||
repeat
|
||||
SD^.GetEvent(E);
|
||||
if IsExitEvent(E)=false then
|
||||
@ -207,7 +224,16 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 1998-12-28 15:47:42 peter
|
||||
Revision 1.3 1999-01-04 11:49:42 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:42 peter
|
||||
+ Added user screen support, display & window
|
||||
+ Implemented Editor,Mouse Options dialog
|
||||
+ Added location of .INI and .CFG file
|
||||
|
@ -126,6 +126,7 @@ const
|
||||
hcHelpWindow = 8001;
|
||||
hcClipboardWindow = 8002;
|
||||
hcCalcWindow = 8003;
|
||||
hcInfoWindow = 8004;
|
||||
|
||||
hcShift = 10000;
|
||||
|
||||
@ -237,15 +238,21 @@ const
|
||||
{ CSourceWindow }
|
||||
{167-182}#$17#$1F#$1A#$31#$31#$1E#$71#$1F#$00#$00#$00#$00#$00#$00#$00#$00 + { 1-16}
|
||||
{183-198}#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00#$00 + {17-32}
|
||||
{199-214}#$1E#$1F#$17#$1F#$1E#$1B#$13#$1A#$1E#$71#$3F#$1F#$1C#$00#$00#$4E ; {33-48}
|
||||
{199-214}#$1E#$1F#$17#$1F#$1E#$1B#$13#$1A#$1E#$71#$3F#$1F#$1C#$13#$00#$4E ; {33-48}
|
||||
|
||||
implementation
|
||||
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 1998-12-30 13:38:39 peter
|
||||
* patches from Gabor
|
||||
Revision 1.4 1999-01-04 11:49:43 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:43 peter
|
||||
+ Added user screen support, display & window
|
||||
|
@ -83,6 +83,8 @@ begin
|
||||
hcSourceWindow : S:='';
|
||||
hcHelpWindow : S:='';
|
||||
hcCalcWindow : S:='';
|
||||
hcInfoWindow : S:='';
|
||||
hcClipboardWindow:S:='';
|
||||
|
||||
hcSystemMenu : S:='System menu';
|
||||
hcUpdate : S:='Refresh and redraw display';
|
||||
@ -151,7 +153,7 @@ begin
|
||||
hcEditor : S:='Specify default editor settings';
|
||||
hcMouse : S:='Specify mouse settings';
|
||||
hcStartup : S:='Permanently change default startup options';
|
||||
hcColors : S:='Costumize IDE colors for windows, menus, editors, etc.';
|
||||
hcColors : S:='Customize IDE colors for windows, menus, editors, etc.';
|
||||
hcOpenINI : S:='Load a previously saved options file';
|
||||
hcSaveINI : S:='Save all the changes made in the options menu';
|
||||
hcSaveAsINI : S:='Save all the changes made under a different name';
|
||||
@ -166,6 +168,7 @@ begin
|
||||
hcPrev : S:='Make the previous window active';
|
||||
hcClose : S:='Close the active window';
|
||||
hcWindowList : S:='Show a list of all open windows';
|
||||
hcUserScreenWindow:S:='Show contents of user screen in a window';
|
||||
|
||||
hcHelpMenu : S:='Get online help';
|
||||
hcHelpContents : S:='Show table of contents for Online Help';
|
||||
@ -314,7 +317,16 @@ end;
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 1998-12-28 15:47:44 peter
|
||||
Revision 1.3 1999-01-04 11:49:44 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:44 peter
|
||||
+ Added user screen support, display & window
|
||||
+ Implemented Editor,Mouse Options dialog
|
||||
+ Added location of .INI and .CFG file
|
||||
|
@ -48,6 +48,7 @@ const
|
||||
secEditor = 'Editor';
|
||||
secHighlight = 'Highlight';
|
||||
secMouse = 'Mouse';
|
||||
secSearch = 'Search';
|
||||
|
||||
{ INI file tags }
|
||||
ieRecentFile = 'RecentFile';
|
||||
@ -62,13 +63,14 @@ const
|
||||
ieReverseButtons = 'ReverseButtons';
|
||||
ieAltClickAction = 'AltClickAction';
|
||||
ieCtrlClickAction = 'CtrlClickAction';
|
||||
ieFindFlags = 'FindFlags';
|
||||
|
||||
procedure InitINIFile;
|
||||
var S: string;
|
||||
var S: string;
|
||||
begin
|
||||
S:=LocateFile(ININame);
|
||||
if S<>'' then
|
||||
INIPath:=S;
|
||||
S:=LocateFile(ININame);
|
||||
if S<>'' then
|
||||
INIPath:=S;
|
||||
INIPath:=FExpand(INIPath);
|
||||
end;
|
||||
|
||||
@ -198,11 +200,12 @@ begin
|
||||
INIFile^.SetIntEntry(secEditor,ieDefaultTabSize,DefaultTabSize);
|
||||
INIFile^.SetIntEntry(secEditor,ieDefaultEditorFlags,DefaultCodeEditorFlags);
|
||||
{$endif}
|
||||
INIFile^.SetEntry(secHighlight,ieHighlightExts,HighlightExts);
|
||||
INIFile^.SetEntry(secHighlight,ieHighlightExts,'"'+HighlightExts+'"');
|
||||
INIFile^.SetIntEntry(secMouse,ieDoubleClickDelay,DoubleDelay);
|
||||
INIFile^.SetIntEntry(secMouse,ieReverseButtons,byte(MouseReverse));
|
||||
INIFile^.SetIntEntry(secMouse,ieAltClickAction,AltMouseAction);
|
||||
INIFile^.SetIntEntry(secMouse,ieCtrlClickAction,CtrlMouseAction);
|
||||
INIFile^.SetIntEntry(secSearch,ieFindFlags,FindFlags);
|
||||
if AppPalette<>CIDEAppColor then
|
||||
begin
|
||||
{ this has a bug. if a different palette has been read on startup, and
|
||||
@ -224,11 +227,14 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 1998-12-30 13:38:40 peter
|
||||
* patches from Gabor
|
||||
|
||||
Revision 1.2 1998/12/30 10:25:01 peter
|
||||
* fixed readinifile
|
||||
Revision 1.4 1999-01-04 11:49:45 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.1 1998/12/28 15:47:45 peter
|
||||
+ Added user screen support, display & window
|
||||
|
@ -18,7 +18,6 @@ function TIDEApp.OpenEditorWindow(FileName: string; CurX,CurY: integer): PSource
|
||||
var P: PView;
|
||||
R: TRect;
|
||||
W: PSourceWindow;
|
||||
B,SH: boolean;
|
||||
begin
|
||||
P:=Message(Desktop,evBroadcast,cmSearchWindow,nil);
|
||||
if P=nil then Desktop^.GetExtent(R) else
|
||||
@ -37,18 +36,6 @@ begin
|
||||
TrackCursor(true);
|
||||
end;
|
||||
W^.HelpCtx:=hcSourceWindow;
|
||||
SH:=MatchesFileList(NameAndExtOf(FileName),HighlightExts);
|
||||
with W^.Editor^ do
|
||||
begin
|
||||
b:=(Flags and efSyntaxHighlight)<>0;
|
||||
if SH<>B then
|
||||
begin
|
||||
if SH then
|
||||
SetFlags(Flags or efSyntaxHighlight)
|
||||
else
|
||||
SetFlags(Flags and not efSyntaxHighlight);
|
||||
end;
|
||||
end;
|
||||
Desktop^.Insert(W);
|
||||
Message(Application,evBroadcast,cmUpdate,nil);
|
||||
end;
|
||||
@ -163,7 +150,16 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 1998-12-28 15:47:47 peter
|
||||
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
|
||||
|
@ -375,7 +375,8 @@ var R,R2: TRect;
|
||||
const
|
||||
LW = 25;
|
||||
begin
|
||||
R.Assign(0,0,64,10);
|
||||
Count:=DirectorySwitches^.ItemCount;
|
||||
R.Assign(0,0,64,2+Count*2);
|
||||
New(D, Init(R, 'Directories'));
|
||||
with D^ do
|
||||
begin
|
||||
@ -383,7 +384,6 @@ begin
|
||||
R.Grow(-2,-2);
|
||||
Dec(R.B.X);
|
||||
R.B.Y:=R.A.Y+1;
|
||||
Count:=DirectorySwitches^.ItemCount;
|
||||
for i:=Count-1 downto 0 do
|
||||
begin
|
||||
R2.Copy(R);
|
||||
@ -398,7 +398,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
InsertButtons(D);
|
||||
IL[0]^.Select;
|
||||
IL[Count-1]^.Select;
|
||||
if Desktop^.ExecView(D)=cmOK then
|
||||
begin
|
||||
for i:=Count-1 downto 0 do
|
||||
@ -554,7 +554,7 @@ end;
|
||||
procedure TIDEApp.Colors;
|
||||
var D: PColorDialog;
|
||||
begin
|
||||
New(D, Init(GetPalette^,
|
||||
New(D, Init(AppPalette,
|
||||
ColorGroup('Desktop', DesktopColorItems(nil),
|
||||
ColorGroup('Dialogs', DialogColorItems(dpGrayDialog,nil),
|
||||
ColorGroup('Editor',
|
||||
@ -588,12 +588,13 @@ begin
|
||||
ColorItem('Identifiers' , 203,
|
||||
ColorItem('Strings' , 204,
|
||||
ColorItem('Numbers' , 205,
|
||||
ColorItem('Hex numbers' , 212,
|
||||
ColorItem('Assembler' , 206,
|
||||
ColorItem('Symbols' , 207,
|
||||
ColorItem('Directives' , 211,
|
||||
nil))))))))),
|
||||
nil)))))))))),
|
||||
nil))))))));
|
||||
if ExecuteDialog(D, GetPalette)=cmOK then
|
||||
if ExecuteDialog(D, @AppPalette)=cmOK then
|
||||
begin
|
||||
DoneMemory;
|
||||
Message(Application,evBroadcast,cmUpdate,nil);
|
||||
@ -651,8 +652,14 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 1998-12-30 13:38:41 peter
|
||||
* patches from Gabor
|
||||
Revision 1.4 1999-01-04 11:49:47 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:49 peter
|
||||
+ Added user screen support, display & window
|
||||
|
@ -15,17 +15,22 @@
|
||||
**********************************************************************}
|
||||
|
||||
procedure TIDEApp.DoRun;
|
||||
var
|
||||
ExeFile : string;
|
||||
begin
|
||||
if (MainFile='') or (CompilationPhase<>cpDone) then
|
||||
if (not ExistsFile(ExeFile)) or (CompilationPhase<>cpDone) then
|
||||
DoCompile(cRun);
|
||||
if (MainFile='') or (CompilationPhase<>cpDone) then
|
||||
if CompilationPhase<>cpDone then
|
||||
Exit;
|
||||
if (EXEFile='') then
|
||||
begin
|
||||
ErrorBox('Oooops, nothing to run.',nil);
|
||||
Exit;
|
||||
end;
|
||||
ExeFile:=MakeExeName(MainFile);
|
||||
if not ExistsFile(ExeFile) then
|
||||
begin
|
||||
MsgParms[1].Ptr:=@EXEFile;
|
||||
ErrorBox('Invalid filename %s',@MsgParms);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if UserScreen=nil then
|
||||
begin
|
||||
@ -35,11 +40,14 @@ begin
|
||||
DoneMouse;
|
||||
DoneVideo;
|
||||
|
||||
UserScreen^.SwitchTo;
|
||||
if Assigned(UserScreen) then
|
||||
UserScreen^.SwitchTo;
|
||||
|
||||
Exec(ExeFile,GetRunParameters);
|
||||
LastExitCode:=DosExitCode;
|
||||
|
||||
UserScreen^.SwitchBack;
|
||||
if Assigned(UserScreen) then
|
||||
UserScreen^.SwitchBack;
|
||||
|
||||
InitVideo;
|
||||
InitMouse;
|
||||
@ -75,7 +83,16 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 1998-12-28 15:47:50 peter
|
||||
Revision 1.2 1999-01-04 11:49:48 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.1 1998/12/28 15:47:50 peter
|
||||
+ Added user screen support, display & window
|
||||
+ Implemented Editor,Mouse Options dialog
|
||||
+ Added location of .INI and .CFG file
|
||||
|
@ -56,6 +56,7 @@ begin
|
||||
P:=List^.At(Item);
|
||||
case P^.HelpCtx of
|
||||
hcSourceWindow : S:=PSourceWindow(P)^.GetTitle(MaxLen);
|
||||
hcInfoWindow : S:=PProgramInfoWindow(P)^.GetTitle(MaxLen);
|
||||
hcHelpWindow : S:=PHelpWindow(P)^.GetTitle(MaxLen);
|
||||
hcCalcWindow : S:=PCalculator(P)^.GetTitle(MaxLen);
|
||||
else S:='???? - '+PWindow(P)^.GetTitle(MaxLen);
|
||||
@ -161,7 +162,16 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 1998-12-28 15:47:50 peter
|
||||
Revision 1.4 1999-01-04 11:49:49 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.3 1998/12/28 15:47:50 peter
|
||||
+ Added user screen support, display & window
|
||||
+ Implemented Editor,Mouse Options dialog
|
||||
+ Added location of .INI and .CFG file
|
||||
|
@ -691,6 +691,7 @@ begin
|
||||
AddStringItem('~I~nclude directories','i',true);
|
||||
AddStringItem('~L~ibrary directories','l',true);
|
||||
AddStringItem('~O~bject directories','o',true);
|
||||
AddStringItem('~E~XE & PPU directories','E',true);
|
||||
end;
|
||||
SwitchesPath:=LocateFile(SwitchesName);
|
||||
if SwitchesPath='' then
|
||||
@ -717,7 +718,16 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 1998-12-28 15:47:52 peter
|
||||
Revision 1.2 1999-01-04 11:49:50 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.1 1998/12/28 15:47:52 peter
|
||||
+ Added user screen support, display & window
|
||||
+ Implemented Editor,Mouse Options dialog
|
||||
+ Added location of .INI and .CFG file
|
||||
|
@ -118,11 +118,13 @@ uses
|
||||
|
||||
function TScreen.GetWidth: integer;
|
||||
begin
|
||||
Getwidth:=0;
|
||||
Abstract;
|
||||
end;
|
||||
|
||||
function TScreen.GetHeight: integer;
|
||||
begin
|
||||
Getheight:=0;
|
||||
Abstract;
|
||||
end;
|
||||
|
||||
@ -208,10 +210,8 @@ end;
|
||||
|
||||
|
||||
procedure TDOSScreen.Capture;
|
||||
var X,Y: integer;
|
||||
W: word;
|
||||
r: registers;
|
||||
VSeg,SOfs: word;
|
||||
var
|
||||
VSeg,SOfs: word;
|
||||
begin
|
||||
GetVideoMode(VideoInfo);
|
||||
GetBuffer(VideoInfo.ScreenSize);
|
||||
@ -229,10 +229,8 @@ end;
|
||||
|
||||
|
||||
procedure TDOSScreen.SwitchTo;
|
||||
var X,Y: integer;
|
||||
W: word;
|
||||
r: registers;
|
||||
VSeg,SOfs: word;
|
||||
var
|
||||
VSeg,SOfs: word;
|
||||
begin
|
||||
GetVideoMode(TM);
|
||||
SetVideoMode(VideoInfo);
|
||||
@ -461,7 +459,16 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 1998-12-28 15:47:53 peter
|
||||
Revision 1.2 1999-01-04 11:49:51 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.1 1998/12/28 15:47:53 peter
|
||||
+ Added user screen support, display & window
|
||||
+ Implemented Editor,Mouse Options dialog
|
||||
+ Added location of .INI and .CFG file
|
||||
|
@ -26,7 +26,7 @@ type
|
||||
LastPos : TPoint;
|
||||
end;
|
||||
|
||||
TCompPhase = (cpCompiling,cpLinking,cpDone);
|
||||
TCompPhase = (cpNothing,cpCompiling,cpLinking,cpFailed,cpDone);
|
||||
|
||||
const ClipboardWindow : PClipboardWindow = nil;
|
||||
CalcWindow : PCalculator = nil;
|
||||
@ -35,7 +35,8 @@ const ClipboardWindow : PClipboardWindow = nil;
|
||||
PrimaryFile : string = '';
|
||||
IsEXECompiled : boolean = false;
|
||||
MainFile : string = '';
|
||||
CompilationPhase : TCompPhase = cpDone;
|
||||
EXEFile : string = '';
|
||||
CompilationPhase : TCompPhase = cpNothing;
|
||||
ProgramInfoWindow: PProgramInfoWindow = nil;
|
||||
UserScreenWindow : PScreenWindow = nil;
|
||||
HelpFiles : FPViews.PUnsortedStringCollection = nil;
|
||||
@ -46,12 +47,13 @@ const ClipboardWindow : PClipboardWindow = nil;
|
||||
CtrlMouseAction : integer = acTopicSearch;
|
||||
AltMouseAction : integer = acBrowseSymbol;
|
||||
StartupOptions : longint = 0;
|
||||
LastExitCode : integer = 0;
|
||||
|
||||
ActionCommands : array[acFirstAction..acLastAction] of word =
|
||||
(cmHelpTopicSearch,cmGotoCursor,cmToggleBreakpoint,
|
||||
cmEvaluate,cmAddWatch,cmBrowseAtCursor);
|
||||
|
||||
AppPalette : string = CAppColor;
|
||||
AppPalette : string = CIDEAppColor;
|
||||
|
||||
var RecentFiles : array[1..MaxRecentFileCount] of TRecentFileEntry;
|
||||
|
||||
@ -60,8 +62,14 @@ implementation
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 1998-12-30 13:38:42 peter
|
||||
* patches from Gabor
|
||||
Revision 1.3 1999-01-04 11:49:52 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.1 1998/12/28 15:47:54 peter
|
||||
+ Added user screen support, display & window
|
||||
|
@ -200,12 +200,15 @@ type
|
||||
|
||||
PProgramInfoWindow = ^TProgramInfoWindow;
|
||||
TProgramInfoWindow = object(TDlgWindow)
|
||||
InfoST: PStaticText;
|
||||
InfoST: PColorStaticText;
|
||||
LogLB : PMessageListBox;
|
||||
constructor Init;
|
||||
procedure AddMessage(AClass: longint; Msg, Module: string; Line: longint);
|
||||
procedure SizeLimits(var Min, Max: TPoint); virtual;
|
||||
procedure Close; virtual;
|
||||
procedure HandleEvent(var Event: TEvent); virtual;
|
||||
procedure Update; virtual;
|
||||
destructor Done; virtual;
|
||||
end;
|
||||
|
||||
PTabItem = ^TTabItem;
|
||||
@ -305,6 +308,12 @@ const
|
||||
|
||||
OpenFileName : string = '';
|
||||
|
||||
var MsgParms : array[1..10] of
|
||||
record
|
||||
case byte of
|
||||
0 : (Ptr : pointer);
|
||||
1 : (Long: longint);
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
@ -1665,7 +1674,7 @@ end;
|
||||
|
||||
function ConfirmBox(S: string; Params: pointer; CanCancel: boolean): word;
|
||||
begin
|
||||
MessageBox(S,Params,mfConfirmation+mfInsertInApp+mfYesButton+mfNoButton+integer(CanCancel)*mfCancelButton);
|
||||
ConfirmBox:=MessageBox(S,Params,mfConfirmation+mfInsertInApp+mfYesButton+mfNoButton+integer(CanCancel)*mfCancelButton);
|
||||
end;
|
||||
|
||||
function IsSeparator(P: PMenuItem): boolean;
|
||||
@ -1888,7 +1897,7 @@ begin
|
||||
I:=1;
|
||||
for Y:=0 to Size.Y-1 do
|
||||
begin
|
||||
MoveChar(B, ' ', C, Size.X);
|
||||
MoveChar(B, ' ', Lo(C), Size.X);
|
||||
CurS:='';
|
||||
if S<>'' then
|
||||
begin
|
||||
@ -1951,6 +1960,7 @@ end;
|
||||
|
||||
function TLocalMenuListBox.GetLocalMenu: PMenu;
|
||||
begin
|
||||
GetLocalMenu:=nil;
|
||||
Abstract;
|
||||
end;
|
||||
|
||||
@ -2081,7 +2091,6 @@ begin
|
||||
end;
|
||||
|
||||
procedure TMessageListBox.GotoSource;
|
||||
var P: PMessageItem;
|
||||
begin
|
||||
{ if TryToOpenSource(}
|
||||
end;
|
||||
@ -2222,10 +2231,19 @@ constructor TProgramInfoWindow.Init;
|
||||
var R,R2: TRect;
|
||||
HSB,VSB: PScrollBar;
|
||||
ST: PStaticText;
|
||||
C: word;
|
||||
const White = 15;
|
||||
begin
|
||||
Desktop^.GetExtent(R); R.A.Y:=R.B.Y-13;
|
||||
inherited Init(R, 'Program Information', wnNoNumber);
|
||||
|
||||
HelpCtx:=hcInfoWindow;
|
||||
|
||||
GetExtent(R); R.Grow(-1,-1); R.B.Y:=R.A.Y+4;
|
||||
C:=((Desktop^.GetColor(32+6) and $f0) or White)*256+Desktop^.GetColor(32+6);
|
||||
New(InfoST, Init(R,'', C)); InfoST^.GrowMode:=gfGrowHiX;
|
||||
InfoST^.DontWrap:=true;
|
||||
Insert(InfoST);
|
||||
GetExtent(R); R.Grow(-1,-1); Inc(R.A.Y,4); R.B.Y:=R.A.Y+1;
|
||||
New(ST, Init(R, CharStr('Ä', MaxViewWidth))); ST^.GrowMode:=gfGrowHiX; Insert(ST);
|
||||
GetExtent(R); R.Grow(-1,-1); Inc(R.A.Y,5);
|
||||
@ -2237,6 +2255,7 @@ begin
|
||||
LogLB^.GrowMode:=gfGrowHiX+gfGrowHiY;
|
||||
LogLB^.Transparent:=true;
|
||||
Insert(LogLB);
|
||||
Update;
|
||||
end;
|
||||
|
||||
procedure TProgramInfoWindow.AddMessage(AClass: longint; Msg, Module: string; Line: longint);
|
||||
@ -2248,7 +2267,7 @@ end;
|
||||
procedure TProgramInfoWindow.SizeLimits(var Min, Max: TPoint);
|
||||
begin
|
||||
inherited SizeLimits(Min,Max);
|
||||
Min.Y:=9;
|
||||
Min.X:=30; Min.Y:=9;
|
||||
end;
|
||||
|
||||
procedure TProgramInfoWindow.Close;
|
||||
@ -2256,6 +2275,35 @@ begin
|
||||
Hide;
|
||||
end;
|
||||
|
||||
procedure TProgramInfoWindow.HandleEvent(var Event: TEvent);
|
||||
begin
|
||||
case Event.What of
|
||||
evBroadcast :
|
||||
case Event.Command of
|
||||
cmUpdate :
|
||||
Update;
|
||||
end;
|
||||
end;
|
||||
inherited HandleEvent(Event);
|
||||
end;
|
||||
|
||||
procedure TProgramInfoWindow.Update;
|
||||
begin
|
||||
InfoST^.SetText(
|
||||
#13+
|
||||
' Current module : '+MainFile+#13+
|
||||
' Last exit code : '+IntToStr(LastExitCode)+#13+
|
||||
' Available memory : '+IntToStrL(MemAvail div 1024,5)+'K'+#13+
|
||||
''
|
||||
);
|
||||
end;
|
||||
|
||||
destructor TProgramInfoWindow.Done;
|
||||
begin
|
||||
inherited Done;
|
||||
ProgramInfoWindow:=nil;
|
||||
end;
|
||||
|
||||
function TAdvancedStatusLine.GetStatusText: string;
|
||||
var S: string;
|
||||
begin
|
||||
@ -2763,7 +2811,16 @@ end;
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 1998-12-28 15:47:54 peter
|
||||
Revision 1.3 1999-01-04 11:49:53 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:54 peter
|
||||
+ Added user screen support, display & window
|
||||
+ Implemented Editor,Mouse Options dialog
|
||||
+ Added location of .INI and .CFG file
|
||||
|
@ -1,7 +1,11 @@
|
||||
program TestProgram;
|
||||
|
||||
const A = 1234;
|
||||
B = $1234;
|
||||
|
||||
var Hello : word;
|
||||
|
||||
BEGIN
|
||||
writeln('Hello world!');
|
||||
Halt;
|
||||
END.
|
||||
|
@ -26,6 +26,8 @@ uses
|
||||
Objects,Drivers,Views,Commands;
|
||||
|
||||
const
|
||||
cmFileNameChanged = 51234;
|
||||
|
||||
MaxLineLength = 255;
|
||||
MaxLineCount = 16380;
|
||||
|
||||
@ -60,6 +62,7 @@ const
|
||||
edReplacePrompt = 10;
|
||||
edTooManyLines = 11;
|
||||
edGotoLine = 12;
|
||||
edReplaceFile = 13;
|
||||
|
||||
ffmOptions = $0007; ffsOptions = 0;
|
||||
ffmDirection = $0008; ffsDirection = 3;
|
||||
@ -92,9 +95,10 @@ const
|
||||
coAssemblerColor = 7;
|
||||
coSymbolColor = 8;
|
||||
coDirectiveColor = 9;
|
||||
coHexNumberColor = 10;
|
||||
|
||||
coFirstColor = 0;
|
||||
coLastColor = coDirectiveColor;
|
||||
coLastColor = coHexNumberColor;
|
||||
|
||||
CIndicator = #2#3#1;
|
||||
CEditor = #33#34#35#36#37#38#39#40#41#42#43#44#45#46#47#48;
|
||||
@ -246,11 +250,14 @@ type
|
||||
function LoadFile: boolean; virtual;
|
||||
function SaveFile: boolean; virtual;
|
||||
function Valid(Command: Word): Boolean; virtual;
|
||||
procedure HandleEvent(var Event: TEvent); virtual;
|
||||
function ShouldSave: boolean; virtual;
|
||||
end;
|
||||
|
||||
TCodeEditorDialog = function(Dialog: Integer; Info: Pointer): Word;
|
||||
|
||||
function DefUseSyntaxHighlight(Editor: PFileEditor): boolean;
|
||||
|
||||
const
|
||||
DefaultCodeEditorFlags : longint =
|
||||
efBackupFiles+efInsertMode+efAutoIndent+efPersistentBlocks+
|
||||
@ -273,6 +280,8 @@ const
|
||||
AlphaChars : set of char = ['A'..'Z','a'..'z','_'];
|
||||
NumberChars : set of char = ['0'..'9'];
|
||||
|
||||
UseSyntaxHighlight : function(Editor: PFileEditor): boolean = DefUseSyntaxHighlight;
|
||||
|
||||
implementation
|
||||
|
||||
uses Dos,MsgBox,Dialogs,App,StdDlg,HistList,Validate;
|
||||
@ -304,14 +313,14 @@ const
|
||||
kbShift = kbLeftShift+kbRightShift;
|
||||
|
||||
const
|
||||
FirstKeyCount = 36;
|
||||
FirstKeyCount = 37;
|
||||
FirstKeys: array[0..FirstKeyCount * 2] of Word = (FirstKeyCount,
|
||||
Ord(^A), cmWordLeft, Ord(^C), cmPageDown,
|
||||
Ord(^D), cmCharRight, Ord(^E), cmLineUp,
|
||||
Ord(^F), cmWordRight, Ord(^G), cmDelChar,
|
||||
Ord(^H), cmBackSpace, Ord(^K), $FF02,
|
||||
Ord(^L), cmSearchAgain, Ord(^M), cmNewLine,
|
||||
Ord(^Q), $FF01,
|
||||
Ord(^H), cmBackSpace, Ord(^J), cmJumpLine,
|
||||
Ord(^K), $FF02, Ord(^L), cmSearchAgain,
|
||||
Ord(^M), cmNewLine, Ord(^Q), $FF01,
|
||||
Ord(^R), cmPageUp, Ord(^S), cmCharLeft,
|
||||
Ord(^T), cmDelWord, Ord(^U), cmUndo,
|
||||
Ord(^V), cmInsMode, Ord(^X), cmLineDown,
|
||||
@ -379,6 +388,23 @@ begin
|
||||
EatIO:=IOResult;
|
||||
end;
|
||||
|
||||
function ExistsFile(FileName: string): boolean;
|
||||
var f: file;
|
||||
Exists: boolean;
|
||||
begin
|
||||
if FileName='' then Exists:=false else
|
||||
begin
|
||||
{$I-}
|
||||
Assign(f,FileName);
|
||||
Reset(f,1);
|
||||
Exists:=EatIO=0;
|
||||
Close(f);
|
||||
EatIO;
|
||||
{$I+}
|
||||
end;
|
||||
ExistsFile:=Exists;
|
||||
end;
|
||||
|
||||
function Max(A,B: longint): longint;
|
||||
begin
|
||||
if A>B then Max:=A else Max:=B;
|
||||
@ -443,6 +469,32 @@ begin
|
||||
PointOfs:=longint(P.Y)*MaxLineLength+P.X;
|
||||
end;
|
||||
|
||||
function ExtractTabs(S: string; TabSize: byte): string;
|
||||
var TabS: string;
|
||||
P: byte;
|
||||
begin
|
||||
TabS:=CharStr(' ',TabSize);
|
||||
repeat
|
||||
P:=Pos(TAB,S);
|
||||
if P>0 then
|
||||
S:=copy(S,1,P-1)+TabS+copy(S,P+1,255);
|
||||
until P=0;
|
||||
ExtractTabs:=S;
|
||||
end;
|
||||
|
||||
function CompressUsingTabs(S: string; TabSize: byte): string;
|
||||
var TabS: string;
|
||||
P: byte;
|
||||
begin
|
||||
TabS:=CharStr(' ',TabSize);
|
||||
repeat
|
||||
P:=Pos(TabS,S);
|
||||
if P>0 then
|
||||
S:=copy(S,1,P-1)+TAB+copy(S,P+TabSize,255);
|
||||
until P=0;
|
||||
CompressUsingTabs:=S;
|
||||
end;
|
||||
|
||||
{$ifdef ASMSCAN}
|
||||
|
||||
function Scan_F(var Block; Size: Word; Str: String): Word; near; assembler;
|
||||
@ -1199,6 +1251,7 @@ begin
|
||||
ColorTab[coAssemblerColor]:=GetColor(8);
|
||||
ColorTab[coSymbolColor]:=GetColor(9);
|
||||
ColorTab[coDirectiveColor]:=GetColor(13);
|
||||
ColorTab[coHexNumberColor]:=GetColor(14);
|
||||
SelectColor:=GetColor(10);
|
||||
HighlightColColor:=GetColor(11); HighlightRowColor:=GetColor(12);
|
||||
ErrorMessageColor:=GetColor(16);
|
||||
@ -1309,8 +1362,6 @@ end;
|
||||
|
||||
procedure TCodeEditor.SetLineText(I: integer; S: string);
|
||||
var L: PLine;
|
||||
TabS: string;
|
||||
P: byte;
|
||||
AddCount: word;
|
||||
begin
|
||||
AddCount:=0;
|
||||
@ -1320,14 +1371,7 @@ begin
|
||||
L:=Lines^.At(I);
|
||||
if L^.Text<>nil then DisposeStr(L^.Text);
|
||||
if ((Flags and efUseTabCharacters)<>0) and (TabSize>0) then
|
||||
begin
|
||||
TabS:=CharStr(' ',TabSize);
|
||||
repeat
|
||||
P:=Pos(TabS,S);
|
||||
if P>0 then
|
||||
S:=copy(S,1,P-1)+TAB+copy(S,P+TabSize,255);
|
||||
until P=0;
|
||||
end;
|
||||
S:=CompressUsingTabs(S,TabSize);
|
||||
L^.Text:=NewStr(S);
|
||||
end;
|
||||
|
||||
@ -1945,9 +1989,6 @@ var S: string;
|
||||
function ContainsText(const SubS:string;var S: string; Start: Sw_word): Sw_integer;
|
||||
var
|
||||
P: Sw_Integer;
|
||||
{$ifndef ASMSCAN}
|
||||
Hs : string;
|
||||
{$endif}
|
||||
begin
|
||||
if Start<=0 then
|
||||
P:=0
|
||||
@ -2020,8 +2061,7 @@ begin
|
||||
|
||||
X:=X+DX;
|
||||
CanExit:=false;
|
||||
if DoReplace and (Confirm=false) and (Owner<>nil) then
|
||||
Owner^.Lock;
|
||||
if DoReplace and (Confirm=false) and (Owner<>nil) then Owner^.Lock;
|
||||
if InArea(X,Y) then
|
||||
repeat
|
||||
S:=GetLineText(Y);
|
||||
@ -2230,11 +2270,14 @@ begin
|
||||
if InAsm then C:=coAssemblerColor else
|
||||
case SClass of
|
||||
ccWhiteSpace : C:=coWhiteSpaceColor;
|
||||
ccNumber : C:=coNumberColor;
|
||||
ccNumber : if copy(WordS,1,1)='$' then
|
||||
C:=coHexNumberColor
|
||||
else
|
||||
C:=coNumberColor;
|
||||
ccSymbol : C:=coSymbolColor;
|
||||
ccAlpha :
|
||||
begin
|
||||
WordS:=copy(LineText,StartX,EndX-StartX+1);
|
||||
{ WordS:=copy(LineText,StartX,EndX-StartX+1);}
|
||||
if IsReservedWord(WordS) then C:=coReservedWordColor
|
||||
else C:=coIdentifierColor;
|
||||
end;
|
||||
@ -2368,6 +2411,7 @@ var I: integer;
|
||||
begin
|
||||
for I:=1 to length(S) do
|
||||
AddChar(S[I]);
|
||||
InsertText:=true;
|
||||
end;
|
||||
|
||||
function TCodeEditor.InsertFrom(Editor: PCodeEditor): Boolean;
|
||||
@ -2471,6 +2515,13 @@ begin
|
||||
DrawView;
|
||||
end;
|
||||
|
||||
procedure TCodeEditor.SetState(AState: Word; Enable: Boolean);
|
||||
begin
|
||||
inherited SetState(AState,Enable);
|
||||
if (AState and (sfActive+sfSelected+sfFocused))<>0 then
|
||||
SelectionChanged;
|
||||
end;
|
||||
|
||||
function TCodeEditor.GetPalette: PPalette;
|
||||
const P: string[length(CEditor)] = CEditor;
|
||||
begin
|
||||
@ -2489,6 +2540,7 @@ begin
|
||||
inherited Init(Bounds,AHScrollBAr,AVScrollBAr,AIndicator,0);
|
||||
FileName:=AFileName;
|
||||
UpdateIndicator;
|
||||
Message(@Self,evBroadcast,cmFileNameChanged,@Self);
|
||||
end;
|
||||
|
||||
function TFileEditor.LoadFile: boolean;
|
||||
@ -2535,7 +2587,7 @@ begin
|
||||
begin
|
||||
readln(f,S);
|
||||
OK:=OK and (IOResult=0);
|
||||
if OK then Lines^.Insert(NewLine(S));
|
||||
if OK then Lines^.Insert(NewLine(ExtractTabs(S,TabSize)));
|
||||
end;
|
||||
FileMode:=FM;
|
||||
Close(F);
|
||||
@ -2576,7 +2628,7 @@ begin
|
||||
begin
|
||||
P:=Lines^.At(Line);
|
||||
if P^.Text=nil then S:='' else S:=P^.Text^;
|
||||
writeln(f,S);
|
||||
writeln(f,CompressUsingTabs(S,TabSize));
|
||||
Inc(Line);
|
||||
OK:=OK and (IOResult=0);
|
||||
end;
|
||||
@ -2604,17 +2656,33 @@ begin
|
||||
if EditorDialog(edSaveAs, @FileName) <> cmCancel then
|
||||
begin
|
||||
FileName := FExpand(FileName);
|
||||
Message(Owner, evBroadcast, cmUpdateTitle, nil);
|
||||
Message(Owner, evBroadcast, cmUpdateTitle, @Self);
|
||||
SaveAs := SaveFile;
|
||||
if IsClipboard then FileName := '';
|
||||
Message(Application,evBroadcast,cmFileNameChanged,@Self);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCodeEditor.SetState(AState: Word; Enable: Boolean);
|
||||
procedure TFileEditor.HandleEvent(var Event: TEvent);
|
||||
var SH,B: boolean;
|
||||
begin
|
||||
inherited SetState(AState,Enable);
|
||||
if (AState and (sfActive+sfSelected+sfFocused))<>0 then
|
||||
SelectionChanged;
|
||||
case Event.What of
|
||||
evBroadcast :
|
||||
case Event.Command of
|
||||
cmFileNameChanged :
|
||||
if (Event.InfoPtr=nil) or (Event.InfoPtr=@Self) then
|
||||
begin
|
||||
B:=(Flags and efSyntaxHighlight)<>0;
|
||||
SH:=UseSyntaxHighlight(@Self);
|
||||
if SH<>B then
|
||||
if SH then
|
||||
SetFlags(Flags or efSyntaxHighlight)
|
||||
else
|
||||
SetFlags(Flags and not efSyntaxHighlight);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
inherited HandleEvent(Event);
|
||||
end;
|
||||
|
||||
function TFileEditor.Valid(Command: Word): Boolean;
|
||||
@ -2808,6 +2876,8 @@ function StdEditorDialog(Dialog: Integer; Info: Pointer): Word;
|
||||
var
|
||||
R: TRect;
|
||||
T: TPoint;
|
||||
Re: word;
|
||||
Name: string;
|
||||
begin
|
||||
case Dialog of
|
||||
edOutOfMemory:
|
||||
@ -2823,15 +2893,24 @@ begin
|
||||
StdEditorDialog := MessageBox('Error creating file %s.',
|
||||
@Info, mfInsertInApp+ mfError + mfOkButton);
|
||||
edSaveModify:
|
||||
StdEditorDialog := MessageBox(#3'%s'#13#13#3'has been modified. Save?',
|
||||
StdEditorDialog := MessageBox('%s has been modified. Save?',
|
||||
@Info, mfInsertInApp+ mfInformation + mfYesNoCancel);
|
||||
edSaveUntitled:
|
||||
StdEditorDialog := MessageBox(#3'Save untitled file?',
|
||||
StdEditorDialog := MessageBox('Save untitled file?',
|
||||
nil, mfInsertInApp+ mfInformation + mfYesNoCancel);
|
||||
edSaveAs:
|
||||
StdEditorDialog :=
|
||||
Application^.ExecuteDialog(New(PFileDialog, Init('*.*',
|
||||
'Save file as', '~N~ame', fdOkButton, 101)), Info);
|
||||
begin
|
||||
Name:=PString(Info)^;
|
||||
Re:=Application^.ExecuteDialog(New(PFileDialog, Init('*.*',
|
||||
'Save file as', '~N~ame', fdOkButton, 101)), @Name);
|
||||
if (Re<>cmCancel) and (Name<>PString(Info)^) then
|
||||
if ExistsFile(Name) then
|
||||
if EditorDialog(edReplaceFile,@Name)<>cmYes then
|
||||
Re:=cmCancel;
|
||||
if Re<>cmCancel then
|
||||
PString(Info)^:=Name;
|
||||
StdEditorDialog := Re;
|
||||
end;
|
||||
edGotoLine:
|
||||
StdEditorDialog :=
|
||||
Application^.ExecuteDialog(CreateGotoLineDialog(Info), Info);
|
||||
@ -2856,14 +2935,29 @@ begin
|
||||
StdEditorDialog := MessageBoxRect(R, 'Replace this occurence?',
|
||||
nil, mfInsertInApp+ mfYesNoCancel + mfInformation);
|
||||
end;
|
||||
edReplaceFile :
|
||||
StdEditorDialog :=
|
||||
MessageBox('File %s already exists. Overwrite?',@Info,mfInsertInApp+mfConfirmation+
|
||||
mfYesButton+mfNoButton);
|
||||
end;
|
||||
end;
|
||||
|
||||
function DefUseSyntaxHighlight(Editor: PFileEditor): boolean;
|
||||
begin
|
||||
DefUseSyntaxHighlight:=(Editor^.Flags and efSyntaxHighlight)<>0;
|
||||
end;
|
||||
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 1998-12-30 10:16:20 peter
|
||||
* forward search for FPC
|
||||
Revision 1.4 1999-01-04 11:49:55 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:55 peter
|
||||
+ Added user screen support, display & window
|
||||
|
Loading…
Reference in New Issue
Block a user