mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-02 13:19:34 +01:00
+ TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
+ Desktop saving should work now
- History saved
- Clipboard content saved
- Desktop saved
- Symbol info saved
* syntax-highlight bug fixed, which compared special keywords case sensitive
(for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
* with 'whole words only' set, the editor didn't found occourences of the
searched text, if the text appeared previously in the same line, but didn't
satisfied the 'whole-word' condition
* ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
(ie. the beginning of the selection)
* when started typing in a new line, but not at the start (X=0) of it,
the editor inserted the text one character more to left as it should...
* TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
* Shift shouldn't cause so much trouble in TCodeEditor now...
* Syntax highlight had problems recognizing a special symbol if it was
prefixed by another symbol character in the source text
* Auto-save also occours at Dos shell, Tool execution, etc. now...
This commit is contained in:
parent
ed952e06da
commit
9f334f17ac
@ -32,7 +32,8 @@ uses
|
||||
WViews,
|
||||
FPIDE,FPCalc,FPCompile,
|
||||
FPIni,FPViews,FPConst,FPVars,FPUtils,FPHelp,FPSwitch,FPUsrScr,
|
||||
FPTools,{$ifndef NODEBUG}FPDebug,{$endif}FPTemplt,FPCatch,FPRedir,FPDesk;
|
||||
FPTools,{$ifndef NODEBUG}FPDebug,{$endif}FPTemplt,FPCatch,FPRedir,FPDesk,
|
||||
FPSymbol;
|
||||
|
||||
|
||||
procedure ProcessParams(BeforeINI: boolean);
|
||||
@ -81,16 +82,19 @@ end;
|
||||
Procedure MyStreamError(Var S: TStream); {$ifndef FPC}far;{$endif}
|
||||
var ErrS: string;
|
||||
begin
|
||||
{$ifdef GABOR}{$ifdef TP}asm int 3;end;{$endif}{$endif}
|
||||
case S.Status of
|
||||
stGetError : ErrS:='Get of unregistered object type';
|
||||
stPutError : ErrS:='Put of unregistered object type';
|
||||
else ErrS:='';
|
||||
end;
|
||||
if Assigned(Application) then
|
||||
ErrorBox('Stream error: '+#13+ErrS,nil)
|
||||
else
|
||||
writeln('Error: ',ErrS);
|
||||
if ErrS<>'' then
|
||||
begin
|
||||
{$ifdef GABOR}{$ifdef TP}asm int 3;end;{$endif}{$endif}
|
||||
if Assigned(Application) then
|
||||
ErrorBox('Stream error: '+#13+ErrS,nil)
|
||||
else
|
||||
writeln('Error: ',ErrS);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure RegisterIDEObjects;
|
||||
@ -111,6 +115,7 @@ begin
|
||||
RegisterFPViews;
|
||||
RegisterMenus;
|
||||
RegisterStdDlg;
|
||||
RegisterSymbols;
|
||||
RegisterObjects;
|
||||
RegisterValidate;
|
||||
RegisterViews;
|
||||
@ -160,18 +165,12 @@ BEGIN
|
||||
ProcessParams(false);
|
||||
|
||||
repeat
|
||||
MyApp.Run;
|
||||
MyApp.Run;
|
||||
if (AutoSaveOptions and asEditorFiles)=0 then CanExit:=true else
|
||||
CanExit:=MyApp.SaveAll;
|
||||
until CanExit;
|
||||
|
||||
{ must be written before done for open files }
|
||||
if (AutoSaveOptions and asEnvironment)<>0 then
|
||||
if WriteINIFile=false then
|
||||
ErrorBox('Error saving configuration.',nil);
|
||||
if (AutoSaveOptions and asDesktop)<>0 then
|
||||
if SaveDesktop=false then
|
||||
ErrorBox('Error saving desktop.',nil);
|
||||
MyApp.AutoSave;
|
||||
|
||||
DoneDesktopFile;
|
||||
|
||||
@ -196,7 +195,29 @@ BEGIN
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.28 1999-07-10 01:24:11 pierre
|
||||
Revision 1.29 1999-08-03 20:22:25 peter
|
||||
+ TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
|
||||
+ Desktop saving should work now
|
||||
- History saved
|
||||
- Clipboard content saved
|
||||
- Desktop saved
|
||||
- Symbol info saved
|
||||
* syntax-highlight bug fixed, which compared special keywords case sensitive
|
||||
(for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
|
||||
* with 'whole words only' set, the editor didn't found occourences of the
|
||||
searched text, if the text appeared previously in the same line, but didn't
|
||||
satisfied the 'whole-word' condition
|
||||
* ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
|
||||
(ie. the beginning of the selection)
|
||||
* when started typing in a new line, but not at the start (X=0) of it,
|
||||
the editor inserted the text one character more to left as it should...
|
||||
* TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
|
||||
* Shift shouldn't cause so much trouble in TCodeEditor now...
|
||||
* Syntax highlight had problems recognizing a special symbol if it was
|
||||
prefixed by another symbol character in the source text
|
||||
* Auto-save also occours at Dos shell, Tool execution, etc. now...
|
||||
|
||||
Revision 1.28 1999/07/10 01:24:11 pierre
|
||||
+ First implementation of watches window
|
||||
|
||||
Revision 1.27 1999/06/29 22:43:12 peter
|
||||
|
||||
@ -544,8 +544,8 @@ begin
|
||||
{$endif TP}
|
||||
{ Compile ! }
|
||||
{$ifdef redircompiler}
|
||||
ChangeRedirOut('fp$$$.out',false);
|
||||
ChangeRedirError('fp$$$.err',false);
|
||||
ChangeRedirOut(FPOutFileName,false);
|
||||
ChangeRedirError(FPErrFileName,false);
|
||||
{$endif}
|
||||
{$ifdef TEMPHEAP}
|
||||
split_heap;
|
||||
@ -613,7 +613,29 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.32 1999-07-12 13:14:13 pierre
|
||||
Revision 1.33 1999-08-03 20:22:26 peter
|
||||
+ TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
|
||||
+ Desktop saving should work now
|
||||
- History saved
|
||||
- Clipboard content saved
|
||||
- Desktop saved
|
||||
- Symbol info saved
|
||||
* syntax-highlight bug fixed, which compared special keywords case sensitive
|
||||
(for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
|
||||
* with 'whole words only' set, the editor didn't found occourences of the
|
||||
searched text, if the text appeared previously in the same line, but didn't
|
||||
satisfied the 'whole-word' condition
|
||||
* ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
|
||||
(ie. the beginning of the selection)
|
||||
* when started typing in a new line, but not at the start (X=0) of it,
|
||||
the editor inserted the text one character more to left as it should...
|
||||
* TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
|
||||
* Shift shouldn't cause so much trouble in TCodeEditor now...
|
||||
* Syntax highlight had problems recognizing a special symbol if it was
|
||||
prefixed by another symbol character in the source text
|
||||
* Auto-save also occours at Dos shell, Tool execution, etc. now...
|
||||
|
||||
Revision 1.32 1999/07/12 13:14:13 pierre
|
||||
* LineEnd bug corrected, now goes end of text even if selected
|
||||
+ Until Return for debugger
|
||||
+ Code for Quit inside GDB Window
|
||||
|
||||
@ -32,8 +32,12 @@ const
|
||||
SwitchesName = 'fp.cfg';
|
||||
DesktopName = 'fp.dsk';
|
||||
|
||||
ToolCaptureName = '$$TOOL$$.OUT';
|
||||
FilterCaptureName = '$FILTER$.OUT';
|
||||
ToolCaptureName = '__TOOL__.OUT'; { all '$' signs replaces with '_'s }
|
||||
FilterCaptureName = '_FILTER_.OUT';
|
||||
FPOutFileName = 'FP___.OUT';
|
||||
FPErrFileName = 'FP___.ERR';
|
||||
GDBOutFileName = 'GDB___.OUT';
|
||||
GDBOutPutFileName = 'GDB___.txt';
|
||||
|
||||
HelpFileExts = '*.tph;*.htm*';
|
||||
|
||||
@ -337,7 +341,29 @@ implementation
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.22 1999-07-12 13:14:14 pierre
|
||||
Revision 1.23 1999-08-03 20:22:27 peter
|
||||
+ TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
|
||||
+ Desktop saving should work now
|
||||
- History saved
|
||||
- Clipboard content saved
|
||||
- Desktop saved
|
||||
- Symbol info saved
|
||||
* syntax-highlight bug fixed, which compared special keywords case sensitive
|
||||
(for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
|
||||
* with 'whole words only' set, the editor didn't found occourences of the
|
||||
searched text, if the text appeared previously in the same line, but didn't
|
||||
satisfied the 'whole-word' condition
|
||||
* ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
|
||||
(ie. the beginning of the selection)
|
||||
* when started typing in a new line, but not at the start (X=0) of it,
|
||||
the editor inserted the text one character more to left as it should...
|
||||
* TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
|
||||
* Shift shouldn't cause so much trouble in TCodeEditor now...
|
||||
* Syntax highlight had problems recognizing a special symbol if it was
|
||||
prefixed by another symbol character in the source text
|
||||
* Auto-save also occours at Dos shell, Tool execution, etc. now...
|
||||
|
||||
Revision 1.22 1999/07/12 13:14:14 pierre
|
||||
* LineEnd bug corrected, now goes end of text even if selected
|
||||
+ Until Return for debugger
|
||||
+ Code for Quit inside GDB Window
|
||||
|
||||
@ -1869,7 +1869,7 @@ end;
|
||||
procedure InitDebugger;
|
||||
begin
|
||||
{$ifdef DEBUG}
|
||||
Assign(gdb_file,'gdb$$$.out');
|
||||
Assign(gdb_file,GDBOutFileName);
|
||||
Rewrite(gdb_file);
|
||||
Use_gdb_file:=true;
|
||||
{$endif}
|
||||
@ -1952,7 +1952,29 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.23 1999-07-28 23:11:17 peter
|
||||
Revision 1.24 1999-08-03 20:22:28 peter
|
||||
+ TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
|
||||
+ Desktop saving should work now
|
||||
- History saved
|
||||
- Clipboard content saved
|
||||
- Desktop saved
|
||||
- Symbol info saved
|
||||
* syntax-highlight bug fixed, which compared special keywords case sensitive
|
||||
(for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
|
||||
* with 'whole words only' set, the editor didn't found occourences of the
|
||||
searched text, if the text appeared previously in the same line, but didn't
|
||||
satisfied the 'whole-word' condition
|
||||
* ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
|
||||
(ie. the beginning of the selection)
|
||||
* when started typing in a new line, but not at the start (X=0) of it,
|
||||
the editor inserted the text one character more to left as it should...
|
||||
* TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
|
||||
* Shift shouldn't cause so much trouble in TCodeEditor now...
|
||||
* Syntax highlight had problems recognizing a special symbol if it was
|
||||
prefixed by another symbol character in the source text
|
||||
* Auto-save also occours at Dos shell, Tool execution, etc. now...
|
||||
|
||||
Revision 1.23 1999/07/28 23:11:17 peter
|
||||
* fixes from gabor
|
||||
|
||||
Revision 1.22 1999/07/12 13:14:15 pierre
|
||||
|
||||
@ -18,6 +18,9 @@ unit FPDesk;
|
||||
interface
|
||||
|
||||
const
|
||||
DesktopVersion = $0001; { <- if you change any Load&Store methods,
|
||||
then you should change also this }
|
||||
|
||||
ResDesktopFlags = 'FLAGS';
|
||||
ResHistory = 'HISTORY';
|
||||
ResClipboard = 'CLIPBOARD';
|
||||
@ -34,9 +37,9 @@ procedure DoneDesktopFile;
|
||||
implementation
|
||||
|
||||
uses Dos,
|
||||
Objects,App,
|
||||
WResource,
|
||||
FPConst,FPVars,FPUtils;
|
||||
Objects,Drivers,Views,App,HistList,BrowCol,
|
||||
WResource,WViews,WEditor,
|
||||
FPConst,FPVars,FPUtils,FPViews,FPCompile,FPTools,FPHelp;
|
||||
|
||||
procedure InitDesktopFile;
|
||||
begin
|
||||
@ -50,16 +53,59 @@ procedure DoneDesktopFile;
|
||||
begin
|
||||
end;
|
||||
|
||||
function WriteHistory(F: PResourceFile): boolean;
|
||||
function ReadHistory(F: PResourceFile): boolean;
|
||||
var S: PMemoryStream;
|
||||
OK: boolean;
|
||||
begin
|
||||
PushStatus('Reading history...');
|
||||
New(S, Init(32*1024,4096));
|
||||
OK:=F^.ReadResourceEntryToStream(resHistory,langDefault,S^);
|
||||
S^.Seek(0);
|
||||
if OK then
|
||||
LoadHistory(S^);
|
||||
Dispose(S, Done);
|
||||
PopStatus;
|
||||
ReadHistory:=OK;
|
||||
end;
|
||||
|
||||
function WriteHistory(F: PResourceFile): boolean;
|
||||
var S: PMemoryStream;
|
||||
begin
|
||||
PushStatus('Storing history...');
|
||||
|
||||
New(S, Init(10*1024,4096));
|
||||
StoreHistory(S^);
|
||||
S^.Seek(0);
|
||||
F^.CreateResource(resHistory,rcBinary,0);
|
||||
F^.AddResourceEntryFromStream(resHistory,langDefault,0,S^,S^.GetSize);
|
||||
Dispose(S, Done);
|
||||
PopStatus;
|
||||
WriteHistory:=true;
|
||||
end;
|
||||
|
||||
function WriteClipboard(F: PResourceFile): boolean;
|
||||
(*function ReadClipboard(F: PResourceFile): boolean;
|
||||
begin
|
||||
WriteClipboard:=true;
|
||||
ReadClipboard:=true;
|
||||
end;
|
||||
|
||||
function WriteClipboard(F: PResourceFile): boolean;
|
||||
var S: PMemoryStream;
|
||||
begin
|
||||
if Assigned(Clipboard) then
|
||||
begin
|
||||
PushStatus('Storing clipboard content...');
|
||||
|
||||
New(S, Init(10*1024,4096));
|
||||
Clipboard^.SaveToStream(S^);
|
||||
S^.Seek(0);
|
||||
F^.CreateResource(resClipboard,rcBinary,0);
|
||||
F^.AddResourceEntryFromStream(resClipboard,langDefault,0,S^,S^.GetSize);
|
||||
Dispose(S, Done);
|
||||
PopStatus;
|
||||
end;
|
||||
WriteClipboard:=true;
|
||||
end;*)
|
||||
|
||||
function WriteWatches(F: PResourceFile): boolean;
|
||||
begin
|
||||
WriteWatches:=true;
|
||||
@ -70,18 +116,90 @@ begin
|
||||
WriteBreakPoints:=true;
|
||||
end;
|
||||
|
||||
function ReadOpenWindows(F: PResourceFile): boolean;
|
||||
var S: PMemoryStream;
|
||||
TempDesk: PFPDesktop;
|
||||
OK: boolean;
|
||||
W: word;
|
||||
begin
|
||||
PushStatus('Reading desktop contents...');
|
||||
New(S, Init(32*1024,4096));
|
||||
OK:=F^.ReadResourceEntryToStream(resDesktop,langDefault,S^);
|
||||
S^.Seek(0);
|
||||
if OK then
|
||||
begin
|
||||
S^.Read(W,SizeOf(W));
|
||||
OK:=(W=DesktopVersion);
|
||||
if OK=false then
|
||||
ErrorBox('Invalid desktop version. Desktop layout lost.',nil);
|
||||
end;
|
||||
if OK then
|
||||
begin
|
||||
TempDesk:=PFPDesktop(S^.Get);
|
||||
OK:=Assigned(TempDesk);
|
||||
if OK then
|
||||
begin
|
||||
Dispose(Desktop, Done);
|
||||
Desktop:=TempDesk;
|
||||
|
||||
with Desktop^ do
|
||||
begin
|
||||
GetSubViewPtr(S^,CompilerMessageWindow);
|
||||
GetSubViewPtr(S^,CompilerStatusDialog);
|
||||
GetSubViewPtr(S^,ClipboardWindow);
|
||||
if Assigned(ClipboardWindow) then Clipboard:=ClipboardWindow^.Editor;
|
||||
GetSubViewPtr(S^,CalcWindow);
|
||||
GetSubViewPtr(S^,ProgramInfoWindow);
|
||||
GetSubViewPtr(S^,GDBWindow);
|
||||
GetSubViewPtr(S^,BreakpointsWindow);
|
||||
GetSubViewPtr(S^,WatchesWindow);
|
||||
GetSubViewPtr(S^,UserScreenWindow);
|
||||
GetSubViewPtr(S^,ASCIIChart);
|
||||
GetSubViewPtr(S^,MessagesWindow); LastToolMessageFocused:=nil;
|
||||
end;
|
||||
|
||||
Application^.Insert(Desktop);
|
||||
Desktop^.ReDraw;
|
||||
Message(Application,evBroadcast,cmUpdate,nil);
|
||||
end;
|
||||
if OK=false then
|
||||
ErrorBox('Error loading desktop',nil);
|
||||
end;
|
||||
Dispose(S, Done);
|
||||
PopStatus;
|
||||
ReadOpenWindows:=OK;
|
||||
end;
|
||||
|
||||
function WriteOpenWindows(F: PResourceFile): boolean;
|
||||
var S: PMemoryStream;
|
||||
W: word;
|
||||
begin
|
||||
WriteOpenWindows:=true;
|
||||
{$ifndef DEV}Exit;{$endif}
|
||||
PushStatus('Storing desktop contents...');
|
||||
|
||||
New(S, Init(1024*1024,4096));
|
||||
Desktop^.Store(S^);
|
||||
New(S, Init(30*1024,4096));
|
||||
W:=DesktopVersion;
|
||||
S^.Write(W,SizeOf(W));
|
||||
S^.Put(Desktop);
|
||||
with Desktop^ do
|
||||
begin
|
||||
PutSubViewPtr(S^,CompilerMessageWindow);
|
||||
PutSubViewPtr(S^,CompilerStatusDialog);
|
||||
PutSubViewPtr(S^,ClipboardWindow);
|
||||
PutSubViewPtr(S^,CalcWindow);
|
||||
PutSubViewPtr(S^,ProgramInfoWindow);
|
||||
PutSubViewPtr(S^,GDBWindow);
|
||||
PutSubViewPtr(S^,BreakpointsWindow);
|
||||
PutSubViewPtr(S^,WatchesWindow);
|
||||
PutSubViewPtr(S^,UserScreenWindow);
|
||||
PutSubViewPtr(S^,ASCIIChart);
|
||||
PutSubViewPtr(S^,MessagesWindow);
|
||||
end;
|
||||
S^.Seek(0);
|
||||
F^.CreateResource(resDesktop,rcBinary,0);
|
||||
F^.AddResourceEntryFromStream(resDesktop,langDefault,0,S^,S^.GetSize);
|
||||
Dispose(S, Done);
|
||||
PopStatus;
|
||||
WriteOpenWindows:=true;
|
||||
end;
|
||||
|
||||
function WriteFlags(F: PResourceFile): boolean;
|
||||
@ -94,34 +212,78 @@ begin
|
||||
SizeOf(DesktopFileFlags));
|
||||
end;
|
||||
|
||||
function WriteSymbols(F: PResourceFile): boolean;
|
||||
function ReadSymbols(F: PResourceFile): boolean;
|
||||
var S: PMemoryStream;
|
||||
OK: boolean;
|
||||
begin
|
||||
WriteSymbols:=true;
|
||||
PushStatus('Reading symbol information...');
|
||||
New(S, Init(32*1024,4096));
|
||||
OK:=F^.ReadResourceEntryToStream(resSymbols,langDefault,S^);
|
||||
S^.Seek(0);
|
||||
if OK then
|
||||
LoadBrowserCol(S);
|
||||
Dispose(S, Done);
|
||||
PopStatus;
|
||||
ReadSymbols:=OK;
|
||||
end;
|
||||
|
||||
function WriteSymbols(F: PResourceFile): boolean;
|
||||
var S: PMemoryStream;
|
||||
OK: boolean;
|
||||
begin
|
||||
OK:=Assigned(Modules);
|
||||
|
||||
if OK then
|
||||
begin
|
||||
PushStatus('Storing symbol information...');
|
||||
|
||||
New(S, Init(200*1024,4096));
|
||||
StoreBrowserCol(S);
|
||||
S^.Seek(0);
|
||||
F^.CreateResource(resSymbols,rcBinary,0);
|
||||
F^.AddResourceEntryFromStream(resSymbols,langDefault,0,S^,S^.GetSize);
|
||||
Dispose(S, Done);
|
||||
PopStatus;
|
||||
end;
|
||||
WriteSymbols:=OK;
|
||||
end;
|
||||
|
||||
function LoadDesktop: boolean;
|
||||
var OK: boolean;
|
||||
F: PResourceFile;
|
||||
begin
|
||||
LoadDesktop:=true;
|
||||
{$ifndef DEV}Exit;{$endif}
|
||||
PushStatus('Reading desktop file...');
|
||||
New(F, LoadFile(DesktopPath));
|
||||
OK:=true;
|
||||
|
||||
OK:=Assigned(F);
|
||||
|
||||
if OK then
|
||||
begin
|
||||
ReadHistory(F);
|
||||
ReadOpenWindows(F);
|
||||
ReadSymbols(F);
|
||||
end;
|
||||
|
||||
PopStatus;
|
||||
LoadDesktop:=true;
|
||||
end;
|
||||
|
||||
function SaveDesktop: boolean;
|
||||
var OK: boolean;
|
||||
F: PResourceFile;
|
||||
begin
|
||||
PushStatus('Writing desktop file...');
|
||||
New(F, CreateFile(DesktopPath));
|
||||
OK:=true;
|
||||
|
||||
if Assigned(Clipboard) then
|
||||
if (DesktopFileFlags and dfClipboardContent)<>0 then
|
||||
Clipboard^.Flags:=Clipboard^.Flags or efStoreContent
|
||||
else
|
||||
Clipboard^.Flags:=Clipboard^.Flags and not efStoreContent;
|
||||
|
||||
OK:=Assigned(F);
|
||||
if OK and ((DesktopFileFlags and dfHistoryLists)<>0) then
|
||||
OK:=WriteHistory(F);
|
||||
if OK and ((DesktopFileFlags and dfHistoryLists)<>0) then
|
||||
OK:=WriteHistory(F);
|
||||
if OK and ((DesktopFileFlags and dfClipboardContent)<>0) then
|
||||
OK:=WriteClipboard(F);
|
||||
if OK and ((DesktopFileFlags and dfWatches)<>0) then
|
||||
OK:=WriteWatches(F);
|
||||
if OK and ((DesktopFileFlags and dfBreakpoints)<>0) then
|
||||
@ -131,14 +293,34 @@ begin
|
||||
if OK and ((DesktopFileFlags and dfSymbolInformation)<>0) then
|
||||
OK:=WriteSymbols(F);
|
||||
Dispose(F, Done);
|
||||
PopStatus;
|
||||
SaveDesktop:=OK;
|
||||
end;
|
||||
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.6 1999-07-28 23:11:18 peter
|
||||
* fixes from gabor
|
||||
Revision 1.7 1999-08-03 20:22:30 peter
|
||||
+ TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
|
||||
+ Desktop saving should work now
|
||||
- History saved
|
||||
- Clipboard content saved
|
||||
- Desktop saved
|
||||
- Symbol info saved
|
||||
* syntax-highlight bug fixed, which compared special keywords case sensitive
|
||||
(for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
|
||||
* with 'whole words only' set, the editor didn't found occourences of the
|
||||
searched text, if the text appeared previously in the same line, but didn't
|
||||
satisfied the 'whole-word' condition
|
||||
* ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
|
||||
(ie. the beginning of the selection)
|
||||
* when started typing in a new line, but not at the start (X=0) of it,
|
||||
the editor inserted the text one character more to left as it should...
|
||||
* TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
|
||||
* Shift shouldn't cause so much trouble in TCodeEditor now...
|
||||
* Syntax highlight had problems recognizing a special symbol if it was
|
||||
prefixed by another symbol character in the source text
|
||||
* Auto-save also occours at Dos shell, Tool execution, etc. now...
|
||||
|
||||
Revision 1.5 1999/06/30 23:58:13 pierre
|
||||
+ BreakpointsList Window implemented
|
||||
|
||||
@ -38,6 +38,7 @@ procedure Help(FileID, Context: THelpCtx; Modal: boolean);
|
||||
procedure HelpIndex(Keyword: string);
|
||||
procedure HelpTopicSearch(Editor: PEditor);
|
||||
procedure HelpTopic(const S: string);
|
||||
procedure CloseHelpWindows;
|
||||
|
||||
procedure InitHelpSystem;
|
||||
procedure DoneHelpSystem;
|
||||
@ -56,7 +57,7 @@ const
|
||||
|
||||
implementation
|
||||
|
||||
uses Objects,Views,App,MsgBox,
|
||||
uses Objects,Views,App,MsgBox,Commands,
|
||||
WHTMLHlp,
|
||||
FPConst,FPVars,FPUtils;
|
||||
|
||||
@ -384,10 +385,43 @@ begin
|
||||
Dispose(HelpFiles, Done);
|
||||
end;
|
||||
|
||||
procedure CloseHelpWindows;
|
||||
procedure CloseIfHelpWindow(P: PView); {$ifndef FPC}far;{$endif}
|
||||
begin
|
||||
if P^.HelpCtx=hcHelpWindow then
|
||||
Message(P,evCommand,cmClose,nil);
|
||||
end;
|
||||
begin
|
||||
Desktop^.ForEach(@CloseIfHelpWindow);
|
||||
end;
|
||||
|
||||
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.19 1999-07-12 13:14:17 pierre
|
||||
Revision 1.20 1999-08-03 20:22:31 peter
|
||||
+ TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
|
||||
+ Desktop saving should work now
|
||||
- History saved
|
||||
- Clipboard content saved
|
||||
- Desktop saved
|
||||
- Symbol info saved
|
||||
* syntax-highlight bug fixed, which compared special keywords case sensitive
|
||||
(for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
|
||||
* with 'whole words only' set, the editor didn't found occourences of the
|
||||
searched text, if the text appeared previously in the same line, but didn't
|
||||
satisfied the 'whole-word' condition
|
||||
* ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
|
||||
(ie. the beginning of the selection)
|
||||
* when started typing in a new line, but not at the start (X=0) of it,
|
||||
the editor inserted the text one character more to left as it should...
|
||||
* TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
|
||||
* Shift shouldn't cause so much trouble in TCodeEditor now...
|
||||
* Syntax highlight had problems recognizing a special symbol if it was
|
||||
prefixed by another symbol character in the source text
|
||||
* Auto-save also occours at Dos shell, Tool execution, etc. now...
|
||||
|
||||
Revision 1.19 1999/07/12 13:14:17 pierre
|
||||
* LineEnd bug corrected, now goes end of text even if selected
|
||||
+ Until Return for debugger
|
||||
+ Code for Quit inside GDB Window
|
||||
|
||||
@ -27,11 +27,13 @@ type
|
||||
|
||||
TIDEApp = object(TApplication)
|
||||
constructor Init;
|
||||
procedure InitDesktop; virtual;
|
||||
procedure InitMenuBar; virtual;
|
||||
procedure InitStatusLine; virtual;
|
||||
procedure Open(FileName: string);
|
||||
function OpenSearch(FileName: string) : boolean;
|
||||
function SaveAll: boolean;
|
||||
function AutoSave: boolean;
|
||||
procedure Idle; virtual;
|
||||
procedure Update;
|
||||
procedure UpdateTarget;
|
||||
@ -60,7 +62,7 @@ type
|
||||
procedure DoRun;
|
||||
procedure DoResetDebugger;
|
||||
procedure DoContToCursor;
|
||||
procedure DoContUntilReturn;
|
||||
procedure DoContUntilReturn;
|
||||
procedure Target;
|
||||
procedure DoCompilerMessages;
|
||||
procedure DoPrimaryFile;
|
||||
@ -107,7 +109,7 @@ type
|
||||
procedure HelpFiles;
|
||||
procedure About;
|
||||
private
|
||||
procedure DoExecute(ProgramPath, Params, InFile, OutFile: string; ExecType: TExecType);
|
||||
function DoExecute(ProgramPath, Params, InFile, OutFile: string; ExecType: TExecType): boolean;
|
||||
private
|
||||
procedure AddRecentFile(AFileName: string; CurX, CurY: integer);
|
||||
function SearchRecentFile(AFileName: string): integer;
|
||||
@ -137,7 +139,8 @@ uses
|
||||
Systems,
|
||||
WUtils,WHelp,WHlpView,WINI,WViews,
|
||||
FPConst,FPVars,FPUtils,FPSwitch,FPIni,FPIntf,FPCompile,FPHelp,
|
||||
FPTemplt,FPCalc,FPUsrScr,FPTools,{$ifndef NODEBUG}FPDebug,{$endif}FPRedir;
|
||||
FPTemplt,FPCalc,FPUsrScr,FPTools,{$ifndef NODEBUG}FPDebug,{$endif}FPRedir,
|
||||
FPDesk;
|
||||
|
||||
|
||||
function IDEUseSyntaxHighlight(Editor: PFileEditor): boolean; {$ifndef FPC}far;{$endif}
|
||||
@ -184,6 +187,16 @@ begin
|
||||
Insert(HeapView);
|
||||
end;
|
||||
|
||||
procedure TIDEApp.InitDesktop;
|
||||
var
|
||||
R: TRect;
|
||||
begin
|
||||
GetExtent(R);
|
||||
Inc(R.A.Y);
|
||||
Dec(R.B.Y);
|
||||
Desktop:=New(PFPDesktop, Init(R));
|
||||
end;
|
||||
|
||||
procedure TIDEApp.InitMenuBar;
|
||||
var R: TRect;
|
||||
begin
|
||||
@ -550,32 +563,64 @@ begin
|
||||
UpdateScreen(true);
|
||||
end;
|
||||
|
||||
|
||||
procedure TIDEApp.DoExecute(ProgramPath, Params, InFile,OutFile: string; ExecType: TExecType);
|
||||
function TIDEApp.AutoSave: boolean;
|
||||
var IOK,SOK,DOK: boolean;
|
||||
begin
|
||||
if UserScreen=nil then
|
||||
begin
|
||||
ErrorBox('Sorry, user screen not available.',nil);
|
||||
Exit;
|
||||
end;
|
||||
IOK:=true; SOK:=true; DOK:=true;
|
||||
if (AutoSaveOptions and asEnvironment)<>0 then
|
||||
begin
|
||||
IOK:=WriteINIFile;
|
||||
if IOK=false then
|
||||
ErrorBox('Error saving configuration.',nil);
|
||||
end;
|
||||
if (AutoSaveOptions and asEditorFiles)=0 then
|
||||
SOK:=MyApp.SaveAll;
|
||||
if (AutoSaveOptions and asDesktop)<>0 then
|
||||
begin
|
||||
{ destory all help & browser windows - we don't want to store them }
|
||||
CloseHelpWindows;
|
||||
CloseAllBrowsers;
|
||||
DOK:=SaveDesktop;
|
||||
if DOK=false then
|
||||
ErrorBox('Error saving desktop file.',nil);
|
||||
end;
|
||||
AutoSave:=IOK and SOK and DOK;
|
||||
end;
|
||||
|
||||
if ExecType<>exNoSwap then
|
||||
ShowUserScreen;
|
||||
function TIDEApp.DoExecute(ProgramPath, Params, InFile,OutFile: string; ExecType: TExecType): boolean;
|
||||
var CanRun: boolean;
|
||||
begin
|
||||
SaveCancelled:=false;
|
||||
CanRun:=AutoSave;
|
||||
if (CanRun=false) and (SaveCancelled=false) then
|
||||
CanRun:=true; { do not care about .DSK or .INI saving problems - just like TP }
|
||||
if CanRun then
|
||||
begin
|
||||
if UserScreen=nil then
|
||||
begin
|
||||
ErrorBox('Sorry, user screen not available.',nil);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if ExecType=exDosShell then
|
||||
WriteShellMsg;
|
||||
if ExecType<>exNoSwap then
|
||||
ShowUserScreen;
|
||||
|
||||
{$ifdef linux}
|
||||
Shell(ProgramPath+' '+Params);
|
||||
{$else}
|
||||
if (InFile='') and (OutFile='') then
|
||||
Dos.Exec(GetEnv('COMSPEC'),'/C '+ProgramPath+' '+Params)
|
||||
else
|
||||
ExecuteRedir(GetEnv('COMSPEC'),'/C '+ProgramPath+' '+Params,InFile,OutFile,'stderr');
|
||||
{$endif}
|
||||
if ExecType=exDosShell then
|
||||
WriteShellMsg;
|
||||
|
||||
if ExecType<>exNoSwap then
|
||||
ShowIDEScreen;
|
||||
{$ifdef linux}
|
||||
Shell(ProgramPath+' '+Params);
|
||||
{$else}
|
||||
if (InFile='') and (OutFile='') then
|
||||
Dos.Exec(GetEnv('COMSPEC'),'/C '+ProgramPath+' '+Params)
|
||||
else
|
||||
ExecuteRedir(GetEnv('COMSPEC'),'/C '+ProgramPath+' '+Params,InFile,OutFile,'stderr');
|
||||
{$endif}
|
||||
|
||||
if ExecType<>exNoSwap then
|
||||
ShowIDEScreen;
|
||||
end;
|
||||
DoExecute:=CanRun;
|
||||
end;
|
||||
|
||||
|
||||
@ -769,7 +814,29 @@ end;
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.33 1999-07-12 13:14:18 pierre
|
||||
Revision 1.34 1999-08-03 20:22:32 peter
|
||||
+ TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
|
||||
+ Desktop saving should work now
|
||||
- History saved
|
||||
- Clipboard content saved
|
||||
- Desktop saved
|
||||
- Symbol info saved
|
||||
* syntax-highlight bug fixed, which compared special keywords case sensitive
|
||||
(for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
|
||||
* with 'whole words only' set, the editor didn't found occourences of the
|
||||
searched text, if the text appeared previously in the same line, but didn't
|
||||
satisfied the 'whole-word' condition
|
||||
* ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
|
||||
(ie. the beginning of the selection)
|
||||
* when started typing in a new line, but not at the start (X=0) of it,
|
||||
the editor inserted the text one character more to left as it should...
|
||||
* TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
|
||||
* Shift shouldn't cause so much trouble in TCodeEditor now...
|
||||
* Syntax highlight had problems recognizing a special symbol if it was
|
||||
prefixed by another symbol character in the source text
|
||||
* Auto-save also occours at Dos shell, Tool execution, etc. now...
|
||||
|
||||
Revision 1.33 1999/07/12 13:14:18 pierre
|
||||
* LineEnd bug corrected, now goes end of text even if selected
|
||||
+ Until Return for debugger
|
||||
+ Code for Quit inside GDB Window
|
||||
|
||||
@ -22,8 +22,8 @@ uses
|
||||
const
|
||||
ININame = 'fp.ini';
|
||||
|
||||
ConfigDir : string = '.'+DirSep;
|
||||
INIFileName: string = ININame;
|
||||
ConfigDir : string{$ifdef GABOR}[50]{$endif} = '.'+DirSep;
|
||||
INIFileName: string{$ifdef GABOR}[50]{$endif} = ININame;
|
||||
|
||||
|
||||
procedure InitINIFile;
|
||||
@ -57,8 +57,8 @@ const
|
||||
|
||||
{ INI file tags }
|
||||
ieRecentFile = 'RecentFile';
|
||||
ieOpenFile = 'OpenFile';
|
||||
ieOpenFileCount = 'OpenFileCount';
|
||||
(* ieOpenFile = 'OpenFile';
|
||||
ieOpenFileCount = 'OpenFileCount'; *)
|
||||
ieRunParameters = 'Parameters';
|
||||
iePrimaryFile = 'PrimaryFile';
|
||||
ieCompileMode = 'CompileMode';
|
||||
@ -309,7 +309,7 @@ begin
|
||||
PS:=PS+StrToPalette(INIFile^.GetEntry(secColors,iePalette+'_161_200',PaletteToStr(copy(S,161,40))));
|
||||
PS:=PS+StrToPalette(INIFile^.GetEntry(secColors,iePalette+'_201_240',PaletteToStr(copy(S,201,40))));
|
||||
AppPalette:=PS;
|
||||
{ Open files }
|
||||
(* { Open files }
|
||||
for I:=INIFile^.GetIntEntry(secFiles,ieOpenFileCount,0) downto 1 do
|
||||
begin
|
||||
S:=INIFile^.GetEntry(secFiles,ieOpenFile+IntToStr(I),'');
|
||||
@ -348,6 +348,7 @@ begin
|
||||
{ remove it because otherwise we allways keep old files }
|
||||
INIFile^.DeleteEntry(secFiles,ieOpenFile+IntToStr(I));
|
||||
end;
|
||||
*)
|
||||
{ Desktop }
|
||||
DesktopFileFlags:=INIFile^.GetIntEntry(secPreferences,ieDesktopFlags,DesktopFileFlags);
|
||||
{ Preferences }
|
||||
@ -366,7 +367,7 @@ var INIFile: PINIFile;
|
||||
S1,S2,S3: string;
|
||||
W: word;
|
||||
BreakPointCount:longint;
|
||||
I,OpenFileCount: integer;
|
||||
I(*,OpenFileCount*): integer;
|
||||
OK: boolean;
|
||||
PW,PPW : PSourceWindow;
|
||||
|
||||
@ -378,7 +379,7 @@ end;
|
||||
begin
|
||||
New(INIFile, Init(INIPath));
|
||||
{ Files }
|
||||
{ avoid keeping old files }
|
||||
{ avoid keeping old files }
|
||||
INIFile^.DeleteSection(secFiles);
|
||||
INIFile^.SetEntry(secFiles,ieOpenExts,'"'+OpenExts+'"');
|
||||
for I:=1 to High(RecentFiles) do
|
||||
@ -390,6 +391,7 @@ begin
|
||||
INIFile^.SetEntry(secFiles,ieRecentFile+IntToStr(I),S);
|
||||
end;
|
||||
|
||||
(*
|
||||
PW:=FirstEditorWindow;
|
||||
PPW:=PW;
|
||||
I:=1;
|
||||
@ -413,7 +415,9 @@ begin
|
||||
If PW=PPW then
|
||||
break;
|
||||
end;
|
||||
|
||||
INIFile^.SetIntEntry(secFiles,ieOpenFileCount,OpenFileCount);
|
||||
*)
|
||||
{ Run }
|
||||
INIFile^.SetEntry(secRun,ieRunParameters,GetRunParameters);
|
||||
{ Compile }
|
||||
@ -490,7 +494,29 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.20 1999-06-28 12:36:51 pierre
|
||||
Revision 1.21 1999-08-03 20:22:33 peter
|
||||
+ TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
|
||||
+ Desktop saving should work now
|
||||
- History saved
|
||||
- Clipboard content saved
|
||||
- Desktop saved
|
||||
- Symbol info saved
|
||||
* syntax-highlight bug fixed, which compared special keywords case sensitive
|
||||
(for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
|
||||
* with 'whole words only' set, the editor didn't found occourences of the
|
||||
searched text, if the text appeared previously in the same line, but didn't
|
||||
satisfied the 'whole-word' condition
|
||||
* ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
|
||||
(ie. the beginning of the selection)
|
||||
* when started typing in a new line, but not at the start (X=0) of it,
|
||||
the editor inserted the text one character more to left as it should...
|
||||
* TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
|
||||
* Shift shouldn't cause so much trouble in TCodeEditor now...
|
||||
* Syntax highlight had problems recognizing a special symbol if it was
|
||||
prefixed by another symbol character in the source text
|
||||
* Auto-save also occours at Dos shell, Tool execution, etc. now...
|
||||
|
||||
Revision 1.20 1999/06/28 12:36:51 pierre
|
||||
* avoid keeping old open file names
|
||||
|
||||
Revision 1.19 1999/04/07 21:55:48 peter
|
||||
|
||||
@ -95,7 +95,7 @@ begin
|
||||
ChDir(Copy(FileDir,1,2));
|
||||
end;
|
||||
ChDir(FileDir);
|
||||
New(D, Init(OpenExts,'Open a file','File to open',fdOpenButton,0));
|
||||
New(D, Init(OpenExts,'Open a file','File to ope~n~',fdOpenButton,0));
|
||||
OpenIt:=Desktop^.ExecView(D)<>cmCancel;
|
||||
if OpenIt then
|
||||
Begin
|
||||
@ -179,7 +179,29 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.11 1999-06-25 00:35:54 pierre
|
||||
Revision 1.12 1999-08-03 20:22:34 peter
|
||||
+ TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
|
||||
+ Desktop saving should work now
|
||||
- History saved
|
||||
- Clipboard content saved
|
||||
- Desktop saved
|
||||
- Symbol info saved
|
||||
* syntax-highlight bug fixed, which compared special keywords case sensitive
|
||||
(for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
|
||||
* with 'whole words only' set, the editor didn't found occourences of the
|
||||
searched text, if the text appeared previously in the same line, but didn't
|
||||
satisfied the 'whole-word' condition
|
||||
* ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
|
||||
(ie. the beginning of the selection)
|
||||
* when started typing in a new line, but not at the start (X=0) of it,
|
||||
the editor inserted the text one character more to left as it should...
|
||||
* TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
|
||||
* Shift shouldn't cause so much trouble in TCodeEditor now...
|
||||
* Syntax highlight had problems recognizing a special symbol if it was
|
||||
prefixed by another symbol character in the source text
|
||||
* Auto-save also occours at Dos shell, Tool execution, etc. now...
|
||||
|
||||
Revision 1.11 1999/06/25 00:35:54 pierre
|
||||
+ uses weditor FileDir var to remember Directory for Open/Save
|
||||
|
||||
Revision 1.10 1999/03/23 15:11:32 peter
|
||||
|
||||
@ -51,6 +51,7 @@ var Title,ProgramPath,Params: string;
|
||||
Err: integer;
|
||||
CaptureFile: string;
|
||||
ExecMode: TExecType;
|
||||
Executed: boolean;
|
||||
begin
|
||||
if (Idx<1) or (Idx>GetToolCount) then Exit;
|
||||
GetToolParams(Idx-1,Title,ProgramPath,Params,Wo);
|
||||
@ -82,11 +83,12 @@ begin
|
||||
if CaptureToolTo<>capNone then
|
||||
ShowMessage('Executing tool '+KillTilde(Title)+'...');
|
||||
|
||||
DoExecute(ProgramPath,Params,'',CaptureFile,ExecMode);
|
||||
Executed:=DoExecute(ProgramPath,Params,'',CaptureFile,ExecMode);
|
||||
|
||||
if CaptureToolTo<>capNone then
|
||||
HideMessage;
|
||||
|
||||
if Executed then
|
||||
if (DosError=0) and (DosExitCode=0) then
|
||||
begin
|
||||
if CaptureToolTo=capEditWindow then
|
||||
@ -260,7 +262,29 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.12 1999-07-12 13:14:20 pierre
|
||||
Revision 1.13 1999-08-03 20:22:35 peter
|
||||
+ TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
|
||||
+ Desktop saving should work now
|
||||
- History saved
|
||||
- Clipboard content saved
|
||||
- Desktop saved
|
||||
- Symbol info saved
|
||||
* syntax-highlight bug fixed, which compared special keywords case sensitive
|
||||
(for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
|
||||
* with 'whole words only' set, the editor didn't found occourences of the
|
||||
searched text, if the text appeared previously in the same line, but didn't
|
||||
satisfied the 'whole-word' condition
|
||||
* ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
|
||||
(ie. the beginning of the selection)
|
||||
* when started typing in a new line, but not at the start (X=0) of it,
|
||||
the editor inserted the text one character more to left as it should...
|
||||
* TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
|
||||
* Shift shouldn't cause so much trouble in TCodeEditor now...
|
||||
* Syntax highlight had problems recognizing a special symbol if it was
|
||||
prefixed by another symbol character in the source text
|
||||
* Auto-save also occours at Dos shell, Tool execution, etc. now...
|
||||
|
||||
Revision 1.12 1999/07/12 13:14:20 pierre
|
||||
* LineEnd bug corrected, now goes end of text even if selected
|
||||
+ Until Return for debugger
|
||||
+ Code for Quit inside GDB Window
|
||||
|
||||
@ -509,7 +509,7 @@ procedure RedirDisableAll;
|
||||
If RedirChangedError and not ErrorRedirDisabled then
|
||||
DisableRedirError;
|
||||
end;
|
||||
|
||||
|
||||
{............................................................................}
|
||||
|
||||
procedure RedirEnableAll;
|
||||
@ -536,22 +536,19 @@ end;
|
||||
Linux
|
||||
*****************************************************************************}
|
||||
|
||||
function ExecuteRedir (Const ProgName, ComLine, RedirStdIn, RedirStdOut, RedirStdErr : String) : boolean;
|
||||
|
||||
begin
|
||||
ExecuteRedir:=false;
|
||||
end;
|
||||
function ExecuteRedir (Const ProgName, ComLine, RedirStdOut, RedirStdErr : String) : boolean;
|
||||
begin
|
||||
ExecuteRedir:=false;
|
||||
end;
|
||||
|
||||
function ChangeRedir(Const Redir : String; AppendToFile : Boolean) : Boolean;
|
||||
|
||||
begin
|
||||
ChangeRedir:=false;
|
||||
end;
|
||||
begin
|
||||
ChangeRedir:=false;
|
||||
end;
|
||||
|
||||
procedure RestoreRedir;
|
||||
|
||||
begin
|
||||
end;
|
||||
begin
|
||||
end;
|
||||
|
||||
function ChangeErrorRedir(Const Redir : String; AppendToFile : Boolean) : Boolean;
|
||||
begin
|
||||
@ -559,87 +556,12 @@ begin
|
||||
end;
|
||||
|
||||
procedure RestoreErrorRedir;
|
||||
|
||||
begin
|
||||
end;
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure InitRedir;
|
||||
|
||||
begin
|
||||
end;
|
||||
|
||||
function ChangeRedirOut(Const Redir : String; AppendToFile : Boolean) : Boolean;
|
||||
|
||||
begin
|
||||
ChangeReDirOut:=false;
|
||||
end;
|
||||
|
||||
procedure RestoreRedirOut;
|
||||
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure DisableRedirOut;
|
||||
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure EnableRedirOut;
|
||||
|
||||
begin
|
||||
end;
|
||||
|
||||
function ChangeRedirIn(Const Redir : String) : Boolean;
|
||||
|
||||
begin
|
||||
ChangeRedirIn:=false;
|
||||
end;
|
||||
|
||||
procedure RestoreRedirIn;
|
||||
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure DisableRedirIn;
|
||||
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure EnableRedirIn;
|
||||
|
||||
begin
|
||||
end;
|
||||
|
||||
function ChangeRedirError(Const Redir : String; AppendToFile : Boolean) : Boolean;
|
||||
|
||||
begin
|
||||
ChangeRedirError:=false;
|
||||
end;
|
||||
|
||||
procedure RestoreRedirError;
|
||||
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure DisableRedirError;
|
||||
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure EnableRedirError;
|
||||
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure RedirDisableAll;
|
||||
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure RedirEnableAll;
|
||||
|
||||
begin
|
||||
end;
|
||||
begin
|
||||
end;
|
||||
|
||||
{$endif not implemented}
|
||||
|
||||
@ -647,10 +569,10 @@ procedure RedirEnableAll;
|
||||
{*****************************************************************************
|
||||
Initialize
|
||||
*****************************************************************************}
|
||||
{$ifdef implemented}
|
||||
|
||||
var oldexit : pointer;
|
||||
|
||||
procedure RedirExit;
|
||||
procedure RedirExit; {$ifndef FPC}far;{$endif}
|
||||
begin
|
||||
exitproc:=oldexit;
|
||||
Dispose(FIn); Dispose(FOut); Dispose(FErr);
|
||||
@ -661,13 +583,29 @@ Begin
|
||||
exitproc:=@RedirExit;
|
||||
New(FIn); New(FOut); New(FErr);
|
||||
End.
|
||||
{$else implemented}
|
||||
end.
|
||||
{$endif implemented}
|
||||
{
|
||||
$Log$
|
||||
Revision 1.18 1999-07-18 16:26:39 florian
|
||||
* IDE compiles with for Win32 and basic things are working
|
||||
Revision 1.19 1999-08-03 20:22:36 peter
|
||||
+ TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
|
||||
+ Desktop saving should work now
|
||||
- History saved
|
||||
- Clipboard content saved
|
||||
- Desktop saved
|
||||
- Symbol info saved
|
||||
* syntax-highlight bug fixed, which compared special keywords case sensitive
|
||||
(for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
|
||||
* with 'whole words only' set, the editor didn't found occourences of the
|
||||
searched text, if the text appeared previously in the same line, but didn't
|
||||
satisfied the 'whole-word' condition
|
||||
* ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
|
||||
(ie. the beginning of the selection)
|
||||
* when started typing in a new line, but not at the start (X=0) of it,
|
||||
the editor inserted the text one character more to left as it should...
|
||||
* TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
|
||||
* Shift shouldn't cause so much trouble in TCodeEditor now...
|
||||
* Syntax highlight had problems recognizing a special symbol if it was
|
||||
prefixed by another symbol character in the source text
|
||||
* Auto-save also occours at Dos shell, Tool execution, etc. now...
|
||||
|
||||
Revision 1.17 1999/05/01 23:45:07 pierre
|
||||
* FIn FOut FErr dispsoed at exit
|
||||
|
||||
@ -136,7 +136,7 @@ procedure ClearToolMessages;
|
||||
procedure UpdateToolMessages;
|
||||
|
||||
const
|
||||
ToolFilter : string[128] = '';
|
||||
ToolFilter : string[{$ifndef GABOR}128{$else}40{$endif}] = '';
|
||||
CaptureToolTo : TCaptureTarget = capNone;
|
||||
ToolMessages : PCollection = nil;
|
||||
ToolModuleNames: PStoreCollection = nil;
|
||||
@ -1505,7 +1505,29 @@ end;
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.12 1999-07-28 23:11:24 peter
|
||||
Revision 1.13 1999-08-03 20:22:37 peter
|
||||
+ TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
|
||||
+ Desktop saving should work now
|
||||
- History saved
|
||||
- Clipboard content saved
|
||||
- Desktop saved
|
||||
- Symbol info saved
|
||||
* syntax-highlight bug fixed, which compared special keywords case sensitive
|
||||
(for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
|
||||
* with 'whole words only' set, the editor didn't found occourences of the
|
||||
searched text, if the text appeared previously in the same line, but didn't
|
||||
satisfied the 'whole-word' condition
|
||||
* ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
|
||||
(ie. the beginning of the selection)
|
||||
* when started typing in a new line, but not at the start (X=0) of it,
|
||||
the editor inserted the text one character more to left as it should...
|
||||
* TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
|
||||
* Shift shouldn't cause so much trouble in TCodeEditor now...
|
||||
* Syntax highlight had problems recognizing a special symbol if it was
|
||||
prefixed by another symbol character in the source text
|
||||
* Auto-save also occours at Dos shell, Tool execution, etc. now...
|
||||
|
||||
Revision 1.12 1999/07/28 23:11:24 peter
|
||||
* fixes from gabor
|
||||
|
||||
Revision 1.11 1999/07/12 13:14:21 pierre
|
||||
|
||||
@ -23,7 +23,7 @@ uses Objects,Views,App,
|
||||
|
||||
type
|
||||
TRecentFileEntry = record
|
||||
FileName : string{$ifdef GABOR}[20]{$endif};
|
||||
FileName : string{$ifdef GABOR}[80]{$endif};
|
||||
LastPos : TPoint;
|
||||
end;
|
||||
|
||||
@ -33,19 +33,19 @@ type
|
||||
const ClipboardWindow : PClipboardWindow = nil;
|
||||
CalcWindow : PCalculator = nil;
|
||||
RecentFileCount : integer = 0;
|
||||
OpenExts : string{$ifdef GABOR}[24]{$endif} = '*.pas;*.pp;*.inc';
|
||||
HighlightExts : string{$ifdef GABOR}[24]{$endif} = '*.pas;*.pp;*.inc';
|
||||
TabsPattern : string{$ifdef GABOR}[30]{$endif} = 'make*;make*.*';
|
||||
SourceDirs : string{$ifdef GABOR}[30]{$endif} = '';
|
||||
PrimaryFile : string{$ifdef GABOR}[60]{$endif} = '';
|
||||
PrimaryFileMain : string{$ifdef GABOR}[60]{$endif} = '';
|
||||
PrimaryFileSwitches : string{$ifdef GABOR}[30]{$endif} = '';
|
||||
PrimaryFilePara : string{$ifdef GABOR}[40]{$endif} = '';
|
||||
GDBOutputFile : string{$ifdef GABOR}[30]{$endif} = 'gdb$$$.txt';
|
||||
OpenExts : string{$ifdef GABOR}[40]{$endif} = '*.pas;*.pp;*.inc';
|
||||
HighlightExts : string{$ifdef GABOR}[40]{$endif} = '*.pas;*.pp;*.inc';
|
||||
TabsPattern : string{$ifdef GABOR}[40]{$endif} = 'make*;make*.*';
|
||||
SourceDirs : string{$ifdef GABOR}[40]{$endif} = '';
|
||||
PrimaryFile : string{$ifdef GABOR}[80]{$endif} = '';
|
||||
PrimaryFileMain : string{$ifdef GABOR}[80]{$endif} = '';
|
||||
PrimaryFileSwitches : string{$ifdef GABOR}[80]{$endif} = '';
|
||||
PrimaryFilePara : string{$ifdef GABOR}[80]{$endif} = '';
|
||||
GDBOutputFile : string{$ifdef GABOR}[80]{$endif} = GDBOutputFileName;
|
||||
IsEXECompiled : boolean = false;
|
||||
LinkAfter : boolean = true;
|
||||
MainFile : string{$ifdef GABOR}[60]{$endif} = '';
|
||||
EXEFile : string{$ifdef GABOR}[60]{$endif} = '';
|
||||
MainFile : string{$ifdef GABOR}[80]{$endif} = '';
|
||||
EXEFile : string{$ifdef GABOR}[80]{$endif} = '';
|
||||
CompilationPhase : TCompPhase = cpNothing;
|
||||
ProgramInfoWindow: PProgramInfoWindow = nil;
|
||||
GDBWindow : PGDBWindow = nil;
|
||||
@ -55,16 +55,16 @@ const ClipboardWindow : PClipboardWindow = nil;
|
||||
HeapView : PFPHeapView = nil;
|
||||
HelpFiles : WUtils.PUnsortedStringCollection = nil;
|
||||
ShowStatusOnError: boolean = true;
|
||||
StartupDir : string{$ifdef GABOR}[50]{$endif} = '.'+DirSep;
|
||||
IDEDir : string{$ifdef GABOR}[50]{$endif} = '.'+DirSep;
|
||||
INIPath : string{$ifdef GABOR}[50]{$endif} = ININame;
|
||||
SwitchesPath : string{$ifdef GABOR}[50]{$endif} = SwitchesName;
|
||||
StartupDir : string{$ifdef GABOR}[80]{$endif} = '.'+DirSep;
|
||||
IDEDir : string{$ifdef GABOR}[80]{$endif} = '.'+DirSep;
|
||||
INIPath : string{$ifdef GABOR}[80]{$endif} = ININame;
|
||||
SwitchesPath : string{$ifdef GABOR}[80]{$endif} = SwitchesName;
|
||||
CtrlMouseAction : integer = acTopicSearch;
|
||||
AltMouseAction : integer = acBrowseSymbol;
|
||||
StartupOptions : longint = 0;
|
||||
LastExitCode : integer = 0;
|
||||
ASCIIChart : PFPASCIIChart = nil;
|
||||
DesktopPath : string{$ifdef GABOR}[50]{$endif} = DesktopName;
|
||||
DesktopPath : string{$ifdef GABOR}[80]{$endif} = DesktopName;
|
||||
DesktopFileFlags : longint = dfHistoryLists+dfOpenWindows;
|
||||
DesktopLocation : byte = dlConfigFileDir;
|
||||
AutoSaveOptions : longint = asEnvironment+asDesktop;
|
||||
@ -83,7 +83,29 @@ implementation
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.20 1999-07-28 23:11:25 peter
|
||||
Revision 1.21 1999-08-03 20:22:38 peter
|
||||
+ TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
|
||||
+ Desktop saving should work now
|
||||
- History saved
|
||||
- Clipboard content saved
|
||||
- Desktop saved
|
||||
- Symbol info saved
|
||||
* syntax-highlight bug fixed, which compared special keywords case sensitive
|
||||
(for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
|
||||
* with 'whole words only' set, the editor didn't found occourences of the
|
||||
searched text, if the text appeared previously in the same line, but didn't
|
||||
satisfied the 'whole-word' condition
|
||||
* ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
|
||||
(ie. the beginning of the selection)
|
||||
* when started typing in a new line, but not at the start (X=0) of it,
|
||||
the editor inserted the text one character more to left as it should...
|
||||
* TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
|
||||
* Shift shouldn't cause so much trouble in TCodeEditor now...
|
||||
* Syntax highlight had problems recognizing a special symbol if it was
|
||||
prefixed by another symbol character in the source text
|
||||
* Auto-save also occours at Dos shell, Tool execution, etc. now...
|
||||
|
||||
Revision 1.20 1999/07/28 23:11:25 peter
|
||||
* fixes from gabor
|
||||
|
||||
Revision 1.19 1999/07/10 01:24:21 pierre
|
||||
|
||||
@ -55,8 +55,11 @@ type
|
||||
|
||||
TFPWindow = object(TWindow)
|
||||
AutoNumber: boolean;
|
||||
procedure HandleEvent(var Event: TEvent); virtual;
|
||||
procedure SetState(AState: Word; Enable: Boolean); virtual;
|
||||
procedure HandleEvent(var Event: TEvent); virtual;
|
||||
procedure SetState(AState: Word; Enable: Boolean); virtual;
|
||||
constructor Load(var S: TStream);
|
||||
procedure Store(var S: TStream);
|
||||
procedure Update;
|
||||
end;
|
||||
|
||||
PFPHelpViewer = ^TFPHelpViewer;
|
||||
@ -73,6 +76,8 @@ type
|
||||
procedure Hide; virtual;
|
||||
procedure HandleEvent(var Event: TEvent); virtual;
|
||||
function GetPalette: PPalette; virtual;
|
||||
constructor Load(var S: TStream);
|
||||
procedure Store(var S: TStream);
|
||||
end;
|
||||
|
||||
PTextScroller = ^TTextScroller;
|
||||
@ -241,6 +246,7 @@ type
|
||||
function AtTab(Index: integer): PTabDef; virtual;
|
||||
procedure SelectTab(Index: integer); virtual;
|
||||
function TabCount: integer;
|
||||
procedure SelectNextTab(Forwards: boolean);
|
||||
function Valid(Command: Word): Boolean; virtual;
|
||||
procedure ChangeBounds(var Bounds: TRect); virtual;
|
||||
procedure HandleEvent(var Event: TEvent); virtual;
|
||||
@ -291,6 +297,12 @@ type
|
||||
function GetText(Item: pointer; MaxLen: sw_integer): string; virtual;
|
||||
end;
|
||||
|
||||
PFPDesktop = ^TFPDesktop;
|
||||
TFPDesktop = object(TDesktop)
|
||||
constructor Load(var S: TStream);
|
||||
procedure Store(var S: TStream);
|
||||
end;
|
||||
|
||||
function SearchFreeWindowNo: integer;
|
||||
|
||||
function IsThereAnyEditor: boolean;
|
||||
@ -331,7 +343,7 @@ const
|
||||
|
||||
CalcClipboard : extended = 0;
|
||||
|
||||
OpenFileName : string = '';
|
||||
OpenFileName : string{$ifdef GABOR}[50]{$endif} = '';
|
||||
OpenFileLastExt : string[12] = '*.pas';
|
||||
NewEditorOpened : boolean = false;
|
||||
|
||||
@ -353,7 +365,8 @@ uses
|
||||
gdbint,
|
||||
{$endif NODEBUG}
|
||||
{$ifdef VESA}Vesa,{$endif}
|
||||
FPSwitch,FPSymbol,FPDebug,FPVars,FPUtils,FPCompile,FPHelp;
|
||||
FPSwitch,FPSymbol,FPDebug,FPVars,FPUtils,FPCompile,FPHelp,
|
||||
FPTools;
|
||||
|
||||
const
|
||||
RSourceEditor: TStreamRec = (
|
||||
@ -392,6 +405,12 @@ const
|
||||
Load: @TMessageListBox.Load;
|
||||
Store: @TMessageListBox.Store
|
||||
);
|
||||
RFPDesktop: TStreamRec = (
|
||||
ObjType: 1506;
|
||||
VmtLink: Ofs(TypeOf(TFPDesktop)^);
|
||||
Load: @TFPDesktop.Load;
|
||||
Store: @TFPDesktop.Store
|
||||
);
|
||||
|
||||
|
||||
const
|
||||
@ -829,13 +848,18 @@ begin
|
||||
Number:=0;
|
||||
end;
|
||||
|
||||
procedure TFPWindow.Update;
|
||||
begin
|
||||
ReDraw;
|
||||
end;
|
||||
|
||||
procedure TFPWindow.HandleEvent(var Event: TEvent);
|
||||
begin
|
||||
case Event.What of
|
||||
evBroadcast :
|
||||
case Event.Command of
|
||||
cmUpdate :
|
||||
ReDraw;
|
||||
Update;
|
||||
cmSearchWindow+1..cmSearchWindow+99 :
|
||||
if (Event.Command-cmSearchWindow=Number) then
|
||||
ClearEvent(Event);
|
||||
@ -844,6 +868,19 @@ begin
|
||||
inherited HandleEvent(Event);
|
||||
end;
|
||||
|
||||
|
||||
constructor TFPWindow.Load(var S: TStream);
|
||||
begin
|
||||
inherited Load(S);
|
||||
S.Read(AutoNumber,SizeOf(AutoNumber));
|
||||
end;
|
||||
|
||||
procedure TFPWindow.Store(var S: TStream);
|
||||
begin
|
||||
inherited Store(S);
|
||||
S.Write(AutoNumber,SizeOf(AutoNumber));
|
||||
end;
|
||||
|
||||
function TFPHelpViewer.GetLocalMenu: PMenu;
|
||||
var M: PMenu;
|
||||
begin
|
||||
@ -917,6 +954,16 @@ begin
|
||||
GetPalette:=@P;
|
||||
end;
|
||||
|
||||
constructor TFPHelpWindow.Load(var S: TStream);
|
||||
begin
|
||||
Abstract;
|
||||
end;
|
||||
|
||||
procedure TFPHelpWindow.Store(var S: TStream);
|
||||
begin
|
||||
Abstract;
|
||||
end;
|
||||
|
||||
constructor TSourceWindow.Init(var Bounds: TRect; AFileName: string);
|
||||
var HSB,VSB: PScrollBar;
|
||||
R: TRect;
|
||||
@ -1505,14 +1552,16 @@ end;
|
||||
|
||||
procedure TMessageListBox.Store(var S: TStream);
|
||||
var OL: PCollection;
|
||||
ORV: sw_integer;
|
||||
begin
|
||||
OL:=List;
|
||||
New(List, Init(1,1));
|
||||
OL:=List; ORV:=Range;
|
||||
|
||||
New(List, Init(1,1)); Range:=0;
|
||||
|
||||
inherited Store(S);
|
||||
|
||||
Dispose(List, Done);
|
||||
List:=OL;
|
||||
List:=OL; Range:=ORV;
|
||||
{ ^^^ nasty trick - has anyone a better idea how to avoid storing the
|
||||
collection? Pasting here a modified version of TListBox.Store+
|
||||
TAdvancedListBox.Store isn't a better solution, since by eventually
|
||||
@ -1788,6 +1837,17 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TTab.SelectNextTab(Forwards: boolean);
|
||||
var Index: integer;
|
||||
begin
|
||||
Index:=ActiveDef;
|
||||
if Index=-1 then Exit;
|
||||
if Forwards then Inc(Index) else Dec(Index);
|
||||
if Index<0 then Index:=DefCount-1 else
|
||||
if Index>DefCount-1 then Index:=0;
|
||||
SelectTab(Index);
|
||||
end;
|
||||
|
||||
procedure TTab.HandleEvent(var Event: TEvent);
|
||||
var Index : integer;
|
||||
I : integer;
|
||||
@ -1841,6 +1901,11 @@ begin
|
||||
begin
|
||||
Index:=-1;
|
||||
case Event.KeyCode of
|
||||
kbCtrlTab :
|
||||
begin
|
||||
SelectNextTab((Event.KeyShift and kbShift)=0);
|
||||
ClearEvent(Event);
|
||||
end;
|
||||
kbTab,kbShiftTab :
|
||||
if GetState(sfSelected) then
|
||||
begin
|
||||
@ -2581,6 +2646,16 @@ begin
|
||||
GetText:=copy(S,1,MaxLen);
|
||||
end;
|
||||
|
||||
constructor TFPDesktop.Load(var S: TStream);
|
||||
begin
|
||||
inherited Load(S);
|
||||
end;
|
||||
|
||||
procedure TFPDesktop.Store(var S: TStream);
|
||||
begin
|
||||
inherited Store(S);
|
||||
end;
|
||||
|
||||
{$ifdef VESA}
|
||||
function VESASetVideoModeProc(const VideoMode: TVideoMode; Params: Longint): Boolean; {$ifndef FPC}far;{$endif}
|
||||
begin
|
||||
@ -2618,13 +2693,36 @@ begin
|
||||
RegisterType(RFPHelpWindow);
|
||||
RegisterType(RClipboardWindow);
|
||||
RegisterType(RMessageListBox);
|
||||
RegisterType(RFPDesktop);
|
||||
end;
|
||||
|
||||
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.35 1999-07-12 13:14:22 pierre
|
||||
Revision 1.36 1999-08-03 20:22:39 peter
|
||||
+ TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
|
||||
+ Desktop saving should work now
|
||||
- History saved
|
||||
- Clipboard content saved
|
||||
- Desktop saved
|
||||
- Symbol info saved
|
||||
* syntax-highlight bug fixed, which compared special keywords case sensitive
|
||||
(for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
|
||||
* with 'whole words only' set, the editor didn't found occourences of the
|
||||
searched text, if the text appeared previously in the same line, but didn't
|
||||
satisfied the 'whole-word' condition
|
||||
* ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
|
||||
(ie. the beginning of the selection)
|
||||
* when started typing in a new line, but not at the start (X=0) of it,
|
||||
the editor inserted the text one character more to left as it should...
|
||||
* TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
|
||||
* Shift shouldn't cause so much trouble in TCodeEditor now...
|
||||
* Syntax highlight had problems recognizing a special symbol if it was
|
||||
prefixed by another symbol character in the source text
|
||||
* Auto-save also occours at Dos shell, Tool execution, etc. now...
|
||||
|
||||
Revision 1.35 1999/07/12 13:14:22 pierre
|
||||
* LineEnd bug corrected, now goes end of text even if selected
|
||||
+ Until Return for debugger
|
||||
+ Code for Quit inside GDB Window
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
{$endif}
|
||||
|
||||
{ --- Include VESA support --- }
|
||||
{$ifdef GO32V2}
|
||||
{$ifndef LINUX}
|
||||
{$ifndef FV20}
|
||||
{$define VESA}
|
||||
{$endif}
|
||||
@ -43,6 +43,6 @@
|
||||
{$endif}
|
||||
|
||||
{$ifdef GABOR}
|
||||
{$define NOOBJREG}
|
||||
{.$define NOOBJREG}
|
||||
{$define NODEBUG}
|
||||
{$endif}
|
||||
|
||||
@ -37,15 +37,9 @@ const
|
||||
cmReadBlock = 51246;
|
||||
cmPrintBlock = 51247;
|
||||
|
||||
{$ifdef FPC}
|
||||
EditorTextBufSize = 32768;
|
||||
MaxLineLength = 255;
|
||||
MaxLineCount = 16380;
|
||||
{$else}
|
||||
EditorTextBufSize = 4096;
|
||||
MaxLineLength = 255;
|
||||
MaxLineCount = 16380;
|
||||
{$endif}
|
||||
EditorTextBufSize = {$ifdef FPC}32768{$else} 4096{$endif};
|
||||
MaxLineLength = {$ifdef FPC} 255{$else} 255{$endif};
|
||||
MaxLineCount = {$ifdef FPC}16380{$else}16380{$endif};
|
||||
|
||||
efBackupFiles = $00000001;
|
||||
efInsertMode = $00000002;
|
||||
@ -59,6 +53,7 @@ const
|
||||
efHighlightColumn = $00000200;
|
||||
efHighlightRow = $00000400;
|
||||
efAutoBrackets = $00000800;
|
||||
efStoreContent = $80000000;
|
||||
|
||||
attrAsm = 1;
|
||||
attrComment = 2;
|
||||
@ -220,9 +215,10 @@ type
|
||||
procedure LimitsChanged; virtual;
|
||||
procedure SelectionChanged; virtual;
|
||||
procedure HighlightChanged; virtual;
|
||||
procedure Update; virtual;
|
||||
procedure ScrollTo(X, Y: sw_Integer);
|
||||
procedure SetInsertMode(InsertMode: boolean); virtual;
|
||||
procedure SetCurPtr(X, Y: sw_Integer); virtual;
|
||||
procedure SetCurPtr(X,Y: sw_integer); virtual;
|
||||
procedure SetSelection(A, B: TPoint); virtual;
|
||||
procedure SetHighlight(A, B: TPoint); virtual;
|
||||
procedure SetHighlightRow(Row: sw_integer); virtual;
|
||||
@ -233,6 +229,8 @@ type
|
||||
function IsClipboard: Boolean;
|
||||
constructor Load(var S: TStream);
|
||||
procedure Store(var S: TStream);
|
||||
function LoadFromStream(Stream: PStream): boolean; virtual;
|
||||
function SaveToStream(Stream: PStream): boolean; virtual;
|
||||
destructor Done; virtual;
|
||||
public
|
||||
{ Text & info storage abstraction }
|
||||
@ -264,6 +262,7 @@ type
|
||||
Bookmarks : array[0..9] of TEditorBookmark;
|
||||
LockFlag : integer;
|
||||
DrawCalled : boolean;
|
||||
CurEvent : PEvent;
|
||||
function Overwrite: boolean;
|
||||
function GetLine(I: sw_integer): PLine;
|
||||
procedure CheckSels;
|
||||
@ -272,6 +271,7 @@ type
|
||||
procedure DrawLines(FirstLine: sw_integer);
|
||||
procedure HideHighlight;
|
||||
procedure AddAction(AAction: byte; AStartPos, AEndPos: TPoint; AText: string);
|
||||
function ShouldExtend: boolean;
|
||||
function ValidBlock: boolean;
|
||||
public
|
||||
{ Syntax highlight support }
|
||||
@ -1050,7 +1050,7 @@ end;
|
||||
*****************************************************************************}
|
||||
|
||||
constructor TCodeEditor.Init(var Bounds: TRect; AHScrollBar, AVScrollBar:
|
||||
PScrollBar; AIndicator: PIndicator; AbufSize:Sw_Word);
|
||||
PScrollBar; AIndicator: PIndicator; ABufSize:Sw_Word);
|
||||
begin
|
||||
inherited Init(Bounds,AHScrollBar,AVScrollBar);
|
||||
StoreUndo:=false;
|
||||
@ -1105,7 +1105,7 @@ procedure TCodeEditor.UnLock;
|
||||
begin
|
||||
{$ifdef DEBUG}
|
||||
if lockflag=0 then
|
||||
messagebox('Error: negative lockflag',nil,mferror+mfcancelbutton)
|
||||
Bug('negative lockflag',nil)
|
||||
else
|
||||
{$endif DEBUG}
|
||||
Dec(LockFlag);
|
||||
@ -1212,7 +1212,7 @@ var
|
||||
begin
|
||||
if Event.What = evKeyDown then
|
||||
begin
|
||||
if (GetShiftState and kbShift <> 0) and
|
||||
if (Event.KeyShift and kbShift <> 0) and
|
||||
(Event.ScanCode >= $47) and (Event.ScanCode <= $51) then
|
||||
Event.CharCode := #0;
|
||||
Key := Event.KeyCode;
|
||||
@ -1259,7 +1259,10 @@ var DontClear : boolean;
|
||||
|
||||
var
|
||||
StartP,P: TPoint;
|
||||
E: TEvent;
|
||||
begin
|
||||
E:=Event;
|
||||
CurEvent:=@E;
|
||||
if (InASCIIMode=false) or (Event.What<>evKeyDown) then
|
||||
ConvertEvent(Event);
|
||||
case Event.What of
|
||||
@ -1380,6 +1383,8 @@ begin
|
||||
end;
|
||||
evBroadcast :
|
||||
case Event.Command of
|
||||
cmUpdate :
|
||||
Update;
|
||||
cmClearLineHighlights :
|
||||
SetHighlightRow(-1);
|
||||
cmScrollBarChanged:
|
||||
@ -1392,6 +1397,15 @@ begin
|
||||
end;
|
||||
end;
|
||||
inherited HandleEvent(Event);
|
||||
CurEvent:=nil;
|
||||
end;
|
||||
|
||||
procedure TCodeEditor.Update;
|
||||
begin
|
||||
LimitsChanged;
|
||||
SelectionChanged; HighlightChanged;
|
||||
UpdateIndicator;
|
||||
DrawView;
|
||||
end;
|
||||
|
||||
function TCodeEditor.GetLocalMenu: PMenu;
|
||||
@ -2340,6 +2354,7 @@ var LineDelta, LineCount, CurLine: Sw_integer;
|
||||
begin
|
||||
if IsReadOnly then Exit;
|
||||
if (SelStart.X=SelEnd.X) and (SelStart.Y=SelEnd.Y) then Exit;
|
||||
Lock;
|
||||
LineCount:=(SelEnd.Y-SelStart.Y)+1;
|
||||
LineDelta:=0; LastX:=CurPos.X;
|
||||
CurLine:=SelStart.Y;
|
||||
@ -2376,11 +2391,13 @@ begin
|
||||
DrawLines(CurPos.Y);
|
||||
Modified:=true;
|
||||
UpdateIndicator;
|
||||
UnLock;
|
||||
end;
|
||||
|
||||
procedure TCodeEditor.HideSelect;
|
||||
begin
|
||||
SetSelection(CurPos,CurPos);
|
||||
DrawLines(Delta.Y);
|
||||
end;
|
||||
|
||||
procedure TCodeEditor.CopyBlock;
|
||||
@ -2901,9 +2918,14 @@ end;
|
||||
because GetShitState tells to extend the
|
||||
selection which gives wrong results (PM) }
|
||||
|
||||
function ShouldExtend : boolean;
|
||||
function TCodeEditor.ShouldExtend: boolean;
|
||||
var ShiftInEvent: boolean;
|
||||
begin
|
||||
ShouldExtend:=((GetShiftState and kbShift)<>0) and
|
||||
ShiftInEvent:=false;
|
||||
if Assigned(CurEvent) then
|
||||
if CurEvent^.What=evKeyDown then
|
||||
ShiftInEvent:=((CurEvent^.KeyShift and kbShift)<>0);
|
||||
ShouldExtend:=ShiftInEvent and
|
||||
not DontConsiderShiftState;
|
||||
end;
|
||||
|
||||
@ -2988,7 +3010,9 @@ var
|
||||
|
||||
var MatchedSymbol: boolean;
|
||||
MatchingSymbol: string;
|
||||
function MatchesAnySpecSymbol(What: string; SClass: TSpecSymbolClass; PartialMatch, CaseInsensitive: boolean): boolean;
|
||||
type TPartialType = (pmNone,pmLeft,pmRight,pmAny);
|
||||
function MatchesAnySpecSymbol(What: string; SClass: TSpecSymbolClass; PartialMatch: TPartialType;
|
||||
CaseInsensitive: boolean): boolean;
|
||||
var S: string;
|
||||
I: Sw_integer;
|
||||
Match,Found: boolean;
|
||||
@ -3001,12 +3025,25 @@ var
|
||||
begin
|
||||
SymbolIndex:=I;
|
||||
S:=GetSpecSymbol(SClass,I-1);
|
||||
if CaseInsensitive then
|
||||
S:=UpcaseStr(S);
|
||||
if PartialMatch then Match:=MatchSymbol(What,S)
|
||||
else Match:=What=S;
|
||||
if (length(What)<length(S)) or
|
||||
((PartialMatch=pmNone) and (length(S)<>length(What)))
|
||||
then
|
||||
Match:=false
|
||||
else
|
||||
begin
|
||||
if CaseInsensitive then
|
||||
S:=UpcaseStr(S);
|
||||
case PartialMatch of
|
||||
pmNone : Match:=What=S;
|
||||
pmRight:
|
||||
Match:=copy(What,length(What)-length(S)+1,length(S))=S;
|
||||
else Match:=MatchSymbol(What,S);
|
||||
end;
|
||||
end;
|
||||
if Match then
|
||||
begin MatchingSymbol:=S; Found:=true; Break; end;
|
||||
begin
|
||||
MatchingSymbol:=S; Found:=true; Break;
|
||||
end;
|
||||
end;
|
||||
MatchedSymbol:=MatchedSymbol or Found;
|
||||
MatchesAnySpecSymbol:=Found;
|
||||
@ -3014,48 +3051,48 @@ var
|
||||
|
||||
function IsCommentPrefix: boolean;
|
||||
begin
|
||||
IsCommentPrefix:=MatchesAnySpecSymbol(SymbolConcat,ssCommentPrefix,true,false);
|
||||
IsCommentPrefix:=MatchesAnySpecSymbol(SymbolConcat,ssCommentPrefix,pmLeft,false);
|
||||
end;
|
||||
|
||||
function IsSingleLineCommentPrefix: boolean;
|
||||
begin
|
||||
IsSingleLineCommentPrefix:=MatchesAnySpecSymbol(SymbolConcat,ssCommentSingleLinePrefix,true,false);
|
||||
IsSingleLineCommentPrefix:=MatchesAnySpecSymbol(SymbolConcat,ssCommentSingleLinePrefix,pmLeft,false);
|
||||
end;
|
||||
|
||||
function IsCommentSuffix: boolean;
|
||||
begin
|
||||
IsCommentSuffix:=(MatchesAnySpecSymbol(SymbolConcat,ssCommentSuffix,true,false))
|
||||
IsCommentSuffix:=(MatchesAnySpecSymbol(SymbolConcat,ssCommentSuffix,pmRight,false))
|
||||
and (CurrentCommentType=SymbolIndex);
|
||||
end;
|
||||
|
||||
function IsStringPrefix: boolean;
|
||||
begin
|
||||
IsStringPrefix:=MatchesAnySpecSymbol(SymbolConcat,ssStringPrefix,true,false);
|
||||
IsStringPrefix:=MatchesAnySpecSymbol(SymbolConcat,ssStringPrefix,pmLeft,false);
|
||||
end;
|
||||
|
||||
function IsStringSuffix: boolean;
|
||||
begin
|
||||
IsStringSuffix:=MatchesAnySpecSymbol(SymbolConcat,ssStringSuffix,true,false);
|
||||
IsStringSuffix:=MatchesAnySpecSymbol(SymbolConcat,ssStringSuffix,pmRight,false);
|
||||
end;
|
||||
|
||||
function IsDirectivePrefix: boolean;
|
||||
begin
|
||||
IsDirectivePrefix:=MatchesAnySpecSymbol(SymbolConcat,ssDirectivePrefix,true,false);
|
||||
IsDirectivePrefix:=MatchesAnySpecSymbol(SymbolConcat,ssDirectivePrefix,pmLeft,false);
|
||||
end;
|
||||
|
||||
function IsDirectiveSuffix: boolean;
|
||||
begin
|
||||
IsDirectiveSuffix:=MatchesAnySpecSymbol(SymbolConcat,ssDirectiveSuffix,true,false);
|
||||
IsDirectiveSuffix:=MatchesAnySpecSymbol(SymbolConcat,ssDirectiveSuffix,pmRight,false);
|
||||
end;
|
||||
|
||||
function IsAsmPrefix(const WordS: string): boolean;
|
||||
begin
|
||||
IsAsmPrefix:=MatchesAnySpecSymbol(WordS,ssAsmPrefix,false,true);
|
||||
IsAsmPrefix:=MatchesAnySpecSymbol(WordS,ssAsmPrefix,pmNone,true);
|
||||
end;
|
||||
|
||||
function IsAsmSuffix(const WordS: string): boolean;
|
||||
begin
|
||||
IsAsmSuffix:=MatchesAnySpecSymbol(WordS,ssAsmSuffix,false,true);
|
||||
IsAsmSuffix:=MatchesAnySpecSymbol(WordS,ssAsmSuffix,pmNone,true);
|
||||
end;
|
||||
|
||||
function GetCharClass(C: char): TCharClass;
|
||||
@ -3263,6 +3300,7 @@ end;
|
||||
|
||||
procedure TCodeEditor.DrawLines(FirstLine: sw_integer);
|
||||
begin
|
||||
if FirstLine>=(Delta.Y+Size.Y) then Exit; { falls outside of the screen }
|
||||
DrawView;
|
||||
end;
|
||||
|
||||
@ -3409,6 +3447,12 @@ end;
|
||||
procedure TCodeEditor.SelectionChanged;
|
||||
var Enable,CanPaste: boolean;
|
||||
begin
|
||||
if SelEnd.Y>GetLineCount-1 then
|
||||
begin
|
||||
SelEnd.Y:=GetLineCount-1;
|
||||
SelEnd.X:=length(GetDisplayText(SelEnd.Y));
|
||||
end;
|
||||
|
||||
Enable:=((SelStart.X<>SelEnd.X) or (SelStart.Y<>SelEnd.Y)) and (Clipboard<>nil);
|
||||
SetCmdState(ToClipCmds,Enable and (Clipboard<>@Self));
|
||||
SetCmdState(NulClipCmds,Enable);
|
||||
@ -3437,6 +3481,8 @@ begin
|
||||
end;
|
||||
|
||||
constructor TCodeEditor.Load(var S: TStream);
|
||||
var TS: PSubStream;
|
||||
TSize: longint;
|
||||
begin
|
||||
inherited Load(S);
|
||||
|
||||
@ -3446,6 +3492,17 @@ begin
|
||||
Lines^.Insert(NewLine(''));
|
||||
|
||||
GetPeerViewPtr(S,Indicator);
|
||||
S.Read(Flags,SizeOf(Flags));
|
||||
S.Read(TabSize,SizeOf(TabSize));
|
||||
|
||||
if (Flags and efStoreContent)<>0 then
|
||||
begin
|
||||
S.Read(TSize,SizeOf(TSize));
|
||||
New(TS, Init(@S,S.GetPos,TSize));
|
||||
LoadFromStream(TS);
|
||||
Dispose(TS, Done);
|
||||
end;
|
||||
|
||||
S.Read(SelStart,SizeOf(SelStart));
|
||||
S.Read(SelEnd,SizeOf(SelEnd));
|
||||
S.Read(Highlight,SizeOf(Highlight));
|
||||
@ -3453,17 +3510,34 @@ begin
|
||||
S.Read(StoreUndo,SizeOf(StoreUndo));
|
||||
S.Read(IsReadOnly,SizeOf(IsReadOnly));
|
||||
S.Read(NoSelect,SizeOf(NoSelect));
|
||||
S.Read(Flags,SizeOf(Flags));
|
||||
S.Read(TabSize,SizeOf(TabSize));
|
||||
S.Read(HighlightRow,SizeOf(HighlightRow));
|
||||
|
||||
UpdateIndicator; LimitsChanged;
|
||||
LimitsChanged;
|
||||
SelectionChanged; HighlightChanged;
|
||||
UpdateIndicator;
|
||||
end;
|
||||
|
||||
procedure TCodeEditor.Store(var S: TStream);
|
||||
var NS: TNulStream;
|
||||
TSize: longint;
|
||||
begin
|
||||
inherited Store(S);
|
||||
|
||||
PutPeerViewPtr(S,Indicator);
|
||||
S.Write(Flags,SizeOf(Flags));
|
||||
S.Write(TabSize,SizeOf(TabSize));
|
||||
|
||||
if (Flags and efStoreContent)<>0 then
|
||||
begin
|
||||
NS.Init;
|
||||
SaveToStream(@NS);
|
||||
TSize:=NS.GetSize;
|
||||
NS.Done;
|
||||
|
||||
S.Write(TSize,SizeOf(TSize));
|
||||
SaveToStream(@S);
|
||||
end;
|
||||
|
||||
S.Write(SelStart,SizeOf(SelStart));
|
||||
S.Write(SelEnd,SizeOf(SelEnd));
|
||||
S.Write(Highlight,SizeOf(Highlight));
|
||||
@ -3471,11 +3545,55 @@ begin
|
||||
S.Write(StoreUndo,SizeOf(StoreUndo));
|
||||
S.Write(IsReadOnly,SizeOf(IsReadOnly));
|
||||
S.Write(NoSelect,SizeOf(NoSelect));
|
||||
S.Write(Flags,SizeOf(Flags));
|
||||
S.Write(TabSize,SizeOf(TabSize));
|
||||
S.Write(HighlightRow,SizeOf(HighlightRow));
|
||||
end;
|
||||
|
||||
function TCodeEditor.LoadFromStream(Stream: PStream): boolean;
|
||||
var S: string;
|
||||
OK: boolean;
|
||||
Line: Sw_integer;
|
||||
begin
|
||||
DeleteAllLines;
|
||||
OK:=(Stream^.Status=stOK);
|
||||
if eofstream(Stream) then
|
||||
AddLine('')
|
||||
else
|
||||
while OK and (eofstream(Stream)=false) and (GetLineCount<MaxLineCount) do
|
||||
begin
|
||||
readlnfromstream(Stream,S);
|
||||
OK:=OK and (Stream^.Status=stOK);
|
||||
if OK then AddLine(S);
|
||||
end;
|
||||
LimitsChanged;
|
||||
if (Flags and efSyntaxHighlight)<>0 then
|
||||
UpdateAttrsRange(0,GetLineCount-1,attrAll+attrForceFull);
|
||||
TextStart;
|
||||
LoadFromStream:=OK;
|
||||
end;
|
||||
|
||||
function TCodeEditor.SaveToStream(Stream: PStream): boolean;
|
||||
var S: string;
|
||||
OK: boolean;
|
||||
Line: Sw_integer;
|
||||
P: PLine;
|
||||
EOL: string[2];
|
||||
begin
|
||||
{$ifdef Linux}EOL:=#10;{$else}EOL:=#13#10;{$endif}
|
||||
OK:=(Stream^.Status=stOK); Line:=0;
|
||||
while OK and (Line<GetLineCount) do
|
||||
begin
|
||||
P:=Lines^.At(Line);
|
||||
if P^.Text=nil then S:='' else S:=P^.Text^;
|
||||
if (Flags and efUseTabCharacters)<>0 then
|
||||
S:=CompressUsingTabs(S,TabSize);
|
||||
Stream^.Write(S[1],length(S));
|
||||
Stream^.Write(EOL[1],length(EOL));
|
||||
Inc(Line);
|
||||
OK:=OK and (Stream^.Status=stOK);
|
||||
end;
|
||||
SaveToStream:=OK;
|
||||
end;
|
||||
|
||||
destructor TCodeEditor.Done;
|
||||
begin
|
||||
inherited Done;
|
||||
@ -3500,7 +3618,7 @@ begin
|
||||
Message(@Self,evBroadcast,cmFileNameChanged,@Self);
|
||||
end;
|
||||
|
||||
function TFileEditor.LoadFile: boolean;
|
||||
(*function TFileEditor.LoadFile: boolean;
|
||||
var S: string;
|
||||
OK: boolean;
|
||||
f: text;
|
||||
@ -3510,6 +3628,7 @@ begin
|
||||
DeleteAllLines;
|
||||
GetMem(Buf,EditorTextBufSize);
|
||||
{$I-}
|
||||
EatIO;
|
||||
FM:=FileMode; FileMode:=0;
|
||||
Assign(f,FileName);
|
||||
SetTextBuf(f,Buf^,EditorTextBufSize);
|
||||
@ -3529,25 +3648,31 @@ begin
|
||||
EatIO;
|
||||
{$I+}
|
||||
LimitsChanged;
|
||||
Line:=-1;
|
||||
repeat
|
||||
Line:=UpdateAttrs(Line+1,attrAll+attrForceFull);
|
||||
until Line>=GetLineCount-1;
|
||||
if (Flags and efSyntaxHighlight)<>0 then
|
||||
UpdateAttrsRange(0,GetLineCount-1,attrAll+attrForceFull);
|
||||
TextStart;
|
||||
LoadFile:=OK;
|
||||
FreeMem(Buf,EditorTextBufSize);
|
||||
end;*)
|
||||
|
||||
function TFileEditor.LoadFile: boolean;
|
||||
var S: PBufStream;
|
||||
OK: boolean;
|
||||
begin
|
||||
New(S, Init(FileName,stOpenRead,EditorTextBufSize));
|
||||
OK:=Assigned(S);
|
||||
if OK then OK:=LoadFromStream(S);
|
||||
if Assigned(S) then Dispose(S, Done);
|
||||
|
||||
LoadFile:=OK;
|
||||
end;
|
||||
|
||||
function TFileEditor.SaveFile: boolean;
|
||||
var S: string;
|
||||
OK: boolean;
|
||||
f: text;
|
||||
Line: Sw_integer;
|
||||
P: PLine;
|
||||
var OK: boolean;
|
||||
BAKName: string;
|
||||
Buf : Pointer;
|
||||
S: PBufStream;
|
||||
f: text;
|
||||
begin
|
||||
GetMem(Buf,EditorTextBufSize);
|
||||
{$I-}
|
||||
if (Flags and efBackupFiles)<>0 then
|
||||
begin
|
||||
@ -3559,26 +3684,13 @@ begin
|
||||
Rename(F,BAKName);
|
||||
EatIO;
|
||||
end;
|
||||
Assign(f,FileName);
|
||||
Rewrite(f);
|
||||
SetTextBuf(f,Buf^,EditorTextBufSize);
|
||||
OK:=(IOResult=0); Line:=0;
|
||||
while OK and (Line<GetLineCount) do
|
||||
begin
|
||||
P:=Lines^.At(Line);
|
||||
if P^.Text=nil then S:='' else S:=P^.Text^;
|
||||
if (Flags and efUseTabCharacters)<>0 then
|
||||
S:=CompressUsingTabs(S,TabSize);
|
||||
writeln(f,S);
|
||||
Inc(Line);
|
||||
OK:=OK and (IOResult=0);
|
||||
end;
|
||||
Close(F);
|
||||
EatIO;
|
||||
{$I+}
|
||||
New(S, Init(FileName,stCreate,EditorTextBufSize));
|
||||
OK:=Assigned(S);
|
||||
if OK then OK:=SaveToStream(S);
|
||||
if Assigned(S) then Dispose(S, Done);
|
||||
if OK then begin Modified:=false; UpdateIndicator; end;
|
||||
SaveFile:=OK;
|
||||
FreeMem(Buf,EditorTextBufSize);
|
||||
end;
|
||||
|
||||
function TFileEditor.ShouldSave: boolean;
|
||||
@ -3661,6 +3773,8 @@ end;
|
||||
|
||||
constructor TFileEditor.Load(var S: TStream);
|
||||
var P: PString;
|
||||
SSP,SEP,CP,DP: TPoint;
|
||||
HR: TRect;
|
||||
begin
|
||||
inherited Load(S);
|
||||
P:=S.ReadStr;
|
||||
@ -3668,7 +3782,23 @@ begin
|
||||
if P<>nil then DisposeStr(P);
|
||||
|
||||
UpdateIndicator;
|
||||
Message(@Self,evBroadcast,cmFileNameChanged,@Self);
|
||||
{ Message(@Self,evBroadcast,cmFileNameChanged,@Self);}
|
||||
|
||||
SSP:=SelStart; SEP:=SelEnd;
|
||||
CP:=CurPos;
|
||||
HR:=Highlight;
|
||||
DP:=Delta;
|
||||
|
||||
if FileName<>'' then
|
||||
LoadFile;
|
||||
|
||||
SetHighlight(HR.A,HR.B);
|
||||
SetSelection(SSP,SEP);
|
||||
SetCurPtr(CP.X,CP.Y);
|
||||
ScrollTo(DP.X,DP.Y);
|
||||
Modified:=false;
|
||||
|
||||
LimitsChanged; UpdateIndicator;
|
||||
end;
|
||||
|
||||
procedure TFileEditor.Store(var S: TStream);
|
||||
@ -3677,7 +3807,6 @@ begin
|
||||
S.WriteStr(@FileName);
|
||||
end;
|
||||
|
||||
|
||||
function CreateFindDialog: PDialog;
|
||||
var R,R1,R2: TRect;
|
||||
D: PDialog;
|
||||
@ -3959,7 +4088,29 @@ end;
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.39 1999-07-28 23:11:26 peter
|
||||
Revision 1.40 1999-08-03 20:22:42 peter
|
||||
+ TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
|
||||
+ Desktop saving should work now
|
||||
- History saved
|
||||
- Clipboard content saved
|
||||
- Desktop saved
|
||||
- Symbol info saved
|
||||
* syntax-highlight bug fixed, which compared special keywords case sensitive
|
||||
(for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
|
||||
* with 'whole words only' set, the editor didn't found occourences of the
|
||||
searched text, if the text appeared previously in the same line, but didn't
|
||||
satisfied the 'whole-word' condition
|
||||
* ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
|
||||
(ie. the beginning of the selection)
|
||||
* when started typing in a new line, but not at the start (X=0) of it,
|
||||
the editor inserted the text one character more to left as it should...
|
||||
* TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
|
||||
* Shift shouldn't cause so much trouble in TCodeEditor now...
|
||||
* Syntax highlight had problems recognizing a special symbol if it was
|
||||
prefixed by another symbol character in the source text
|
||||
* Auto-save also occours at Dos shell, Tool execution, etc. now...
|
||||
|
||||
Revision 1.39 1999/07/28 23:11:26 peter
|
||||
* fixes from gabor
|
||||
|
||||
Revision 1.38 1999/07/12 13:14:24 pierre
|
||||
|
||||
@ -108,10 +108,16 @@ const
|
||||
|
||||
function FormatPath(Path: string): string;
|
||||
var P: sw_integer;
|
||||
SC: char;
|
||||
begin
|
||||
if DirSep='/' then
|
||||
SC:='\'
|
||||
else
|
||||
SC:='/';
|
||||
|
||||
repeat
|
||||
if DirSep='/' then P:=Pos('\',Path)
|
||||
else P:=Pos('/',Path);
|
||||
P:=Pos(SC,Path);
|
||||
if Path[P]<>SC then P:=0;
|
||||
if P>0 then Path[P]:=DirSep;
|
||||
until P=0;
|
||||
FormatPath:=Path;
|
||||
|
||||
@ -114,6 +114,8 @@ type
|
||||
var Source: TStream; ADataSize: longint): boolean; virtual;
|
||||
function DeleteResourceEntry(const ResName: string; ALangID: longint): boolean; virtual;
|
||||
function DeleteResource(const ResName: string): boolean; virtual;
|
||||
function ReadResourceEntry(const ResName: string; ALangID: longint; var Buf; var BufSize: sw_word): boolean;
|
||||
function ReadResourceEntryToStream(const ResName: string; ALangID: longint; var DestS: TStream): boolean;
|
||||
procedure Flush; virtual;
|
||||
destructor Done; virtual;
|
||||
public
|
||||
@ -322,6 +324,7 @@ begin
|
||||
Modified:=true
|
||||
else
|
||||
begin
|
||||
S^.Reset;
|
||||
BaseOfs:=S^.GetPos;
|
||||
S^.Read(Header,SizeOf(Header));
|
||||
OK:=(S^.Status=stOK) and
|
||||
@ -431,6 +434,7 @@ begin
|
||||
AddResEntryPtr(P,E);
|
||||
UpdateBlockDatas;
|
||||
RemSize:=ADataSize; CurOfs:=0;
|
||||
S^.Reset;
|
||||
S^.Seek(BaseOfs+E^.DataOfs);
|
||||
while (RemSize>0) do
|
||||
begin
|
||||
@ -463,6 +467,7 @@ begin
|
||||
UpdateBlockDatas;
|
||||
GetMem(Buf,BufSize);
|
||||
RemSize:=ADataSize;
|
||||
S^.Reset;
|
||||
S^.Seek(BaseOfs+E^.DataOfs);
|
||||
while (RemSize>0) do
|
||||
begin
|
||||
@ -515,6 +520,78 @@ begin
|
||||
DeleteResource:=OK;
|
||||
end;
|
||||
|
||||
function TResourceFile.ReadResourceEntry(const ResName: string; ALangID: longint; var Buf; var BufSize: sw_word): boolean;
|
||||
var E: PResourceEntry;
|
||||
P: PResource;
|
||||
OK: boolean;
|
||||
CurOfs,CurFrag: sw_word;
|
||||
TempBuf: pointer;
|
||||
const TempBufSize = 4096;
|
||||
begin
|
||||
P:=FindResource(ResName);
|
||||
OK:=P<>nil;
|
||||
if OK then E:=P^.Items^.SearchEntryForLang(ALangID);
|
||||
OK:=OK and (E<>nil);
|
||||
OK:=OK and (E^.DataLen<=BufSize);
|
||||
if OK then
|
||||
begin
|
||||
GetMem(TempBuf,TempBufSize);
|
||||
S^.Reset;
|
||||
S^.Seek(BaseOfs+E^.DataOfs);
|
||||
OK:=(S^.Status=stOK);
|
||||
CurOfs:=0;
|
||||
|
||||
while OK and (CurOfs<E^.DataLen) do
|
||||
begin
|
||||
CurFrag:=Min(E^.DataLen-CurOfs,TempBufSize);
|
||||
S^.Read(TempBuf^,CurFrag);
|
||||
OK:=OK and (S^.Status=stOK);
|
||||
if OK then
|
||||
Move(TempBuf^,PByteArray(@Buf)^[CurOfs],CurFrag);
|
||||
Inc(CurOfs,CurFrag);
|
||||
end;
|
||||
|
||||
FreeMem(TempBuf,TempBufSize);
|
||||
end;
|
||||
ReadResourceEntry:=OK;
|
||||
end;
|
||||
|
||||
function TResourceFile.ReadResourceEntryToStream(const ResName: string; ALangID: longint; var DestS: TStream): boolean;
|
||||
var E: PResourceEntry;
|
||||
P: PResource;
|
||||
OK: boolean;
|
||||
CurOfs,CurFrag: sw_word;
|
||||
TempBuf: pointer;
|
||||
const TempBufSize = 4096;
|
||||
begin
|
||||
P:=FindResource(ResName);
|
||||
OK:=P<>nil;
|
||||
if OK then E:=P^.Items^.SearchEntryForLang(ALangID);
|
||||
OK:=OK and (E<>nil);
|
||||
if OK then
|
||||
begin
|
||||
GetMem(TempBuf,TempBufSize);
|
||||
S^.Reset;
|
||||
S^.Seek(BaseOfs+E^.DataOfs);
|
||||
OK:=(S^.Status=stOK);
|
||||
CurOfs:=0;
|
||||
|
||||
while OK and (CurOfs<E^.DataLen) do
|
||||
begin
|
||||
CurFrag:=Min(E^.DataLen-CurOfs,TempBufSize);
|
||||
S^.Read(TempBuf^,CurFrag);
|
||||
OK:=OK and (S^.Status=stOK);
|
||||
if OK then
|
||||
DestS.Write(TempBuf^,CurFrag);
|
||||
OK:=OK and (DestS.Status=stOK);
|
||||
Inc(CurOfs,CurFrag);
|
||||
end;
|
||||
|
||||
FreeMem(TempBuf,TempBufSize);
|
||||
end;
|
||||
ReadResourceEntryToStream:=OK;
|
||||
end;
|
||||
|
||||
function TResourceFile.FindResource(const ResName: string): PResource;
|
||||
begin
|
||||
FindResource:=Resources^.SearchResourceByName(ResName);
|
||||
@ -691,7 +768,7 @@ end;
|
||||
constructor TResourceFile.LoadFile(AFileName: string);
|
||||
var B: PBufStream;
|
||||
begin
|
||||
New(B, Init(AFileName, stCreate, 4096));
|
||||
New(B, Init(AFileName, stOpen, 4096));
|
||||
if (B<>nil) and (B^.Status<>stOK) then
|
||||
begin Dispose(B, Done); B:=nil; end;
|
||||
if B=nil then Fail;
|
||||
@ -703,7 +780,29 @@ end;
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.5 1999-06-17 23:45:21 pierre
|
||||
Revision 1.6 1999-08-03 20:22:44 peter
|
||||
+ TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
|
||||
+ Desktop saving should work now
|
||||
- History saved
|
||||
- Clipboard content saved
|
||||
- Desktop saved
|
||||
- Symbol info saved
|
||||
* syntax-highlight bug fixed, which compared special keywords case sensitive
|
||||
(for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
|
||||
* with 'whole words only' set, the editor didn't found occourences of the
|
||||
searched text, if the text appeared previously in the same line, but didn't
|
||||
satisfied the 'whole-word' condition
|
||||
* ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
|
||||
(ie. the beginning of the selection)
|
||||
* when started typing in a new line, but not at the start (X=0) of it,
|
||||
the editor inserted the text one character more to left as it should...
|
||||
* TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
|
||||
* Shift shouldn't cause so much trouble in TCodeEditor now...
|
||||
* Syntax highlight had problems recognizing a special symbol if it was
|
||||
prefixed by another symbol character in the source text
|
||||
* Auto-save also occours at Dos shell, Tool execution, etc. now...
|
||||
|
||||
Revision 1.5 1999/06/17 23:45:21 pierre
|
||||
* dipsoe of S field in TResourceFile destructor
|
||||
|
||||
Revision 1.4 1999/04/07 21:56:05 peter
|
||||
|
||||
@ -38,6 +38,16 @@ type
|
||||
procedure FreeItem(Item: Pointer); virtual;
|
||||
end;
|
||||
|
||||
PNulStream = ^TNulStream;
|
||||
TNulStream = object(TStream)
|
||||
constructor Init;
|
||||
function GetPos: Longint; virtual;
|
||||
function GetSize: Longint; virtual;
|
||||
procedure Read(var Buf; Count: Word); virtual;
|
||||
procedure Seek(Pos: Longint); virtual;
|
||||
procedure Write(var Buf; Count: Word); virtual;
|
||||
end;
|
||||
|
||||
PSubStream = ^TSubStream;
|
||||
TSubStream = object(TStream)
|
||||
constructor Init(AStream: PStream; AStartPos, ASize: longint);
|
||||
@ -48,7 +58,6 @@ type
|
||||
procedure Write(var Buf; Count: Word); virtual;
|
||||
private
|
||||
StartPos: longint;
|
||||
Size : longint;
|
||||
S : PStream;
|
||||
end;
|
||||
|
||||
@ -56,6 +65,8 @@ type
|
||||
procedure readln(var t:text;var s:string);
|
||||
{$endif}
|
||||
|
||||
procedure readlnfromstream(Stream: PStream; var s:string);
|
||||
function eofstream(s: pstream): boolean;
|
||||
|
||||
function Min(A,B: longint): longint;
|
||||
function Max(A,B: longint): longint;
|
||||
@ -119,6 +130,32 @@ uses
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
function eofstream(s: pstream): boolean;
|
||||
begin
|
||||
eofstream:=(s^.getpos>=s^.getsize);
|
||||
end;
|
||||
|
||||
procedure readlnfromstream(Stream: PStream; var S:string);
|
||||
var
|
||||
c : char;
|
||||
i : longint;
|
||||
begin
|
||||
c:=#0;
|
||||
i:=0;
|
||||
while (not eofstream(stream)) and (c<>#10) do
|
||||
begin
|
||||
stream^.read(c,sizeof(c));
|
||||
if c<>#10 then
|
||||
begin
|
||||
inc(i);
|
||||
s[i]:=c;
|
||||
end;
|
||||
end;
|
||||
if (i>0) and (s[i]=#13) then
|
||||
dec(i);
|
||||
s[0]:=chr(i);
|
||||
end;
|
||||
|
||||
|
||||
function Max(A,B: longint): longint;
|
||||
begin
|
||||
@ -303,23 +340,56 @@ begin
|
||||
if Item<>nil then DisposeStr(Item);
|
||||
end;
|
||||
|
||||
constructor TNulStream.Init;
|
||||
begin
|
||||
inherited Init;
|
||||
Position:=0;
|
||||
end;
|
||||
|
||||
function TNulStream.GetPos: Longint;
|
||||
begin
|
||||
GetPos:=Position;
|
||||
end;
|
||||
|
||||
function TNulStream.GetSize: Longint;
|
||||
begin
|
||||
GetSize:=Position;
|
||||
end;
|
||||
|
||||
procedure TNulStream.Read(var Buf; Count: Word);
|
||||
begin
|
||||
Error(stReadError,0);
|
||||
end;
|
||||
|
||||
procedure TNulStream.Seek(Pos: Longint);
|
||||
begin
|
||||
if Pos<=Position then
|
||||
Position:=Pos;
|
||||
end;
|
||||
|
||||
procedure TNulStream.Write(var Buf; Count: Word);
|
||||
begin
|
||||
Inc(Position,Count);
|
||||
end;
|
||||
|
||||
constructor TSubStream.Init(AStream: PStream; AStartPos, ASize: longint);
|
||||
begin
|
||||
inherited Init;
|
||||
S:=AStream; StartPos:=AStartPos; Size:=ASize;
|
||||
inherited Seek(StartPos);
|
||||
if Assigned(AStream)=false then Fail;
|
||||
S:=AStream; StartPos:=AStartPos; StreamSize:=ASize;
|
||||
Seek(0);
|
||||
end;
|
||||
|
||||
function TSubStream.GetPos: Longint;
|
||||
var Pos: longint;
|
||||
begin
|
||||
Pos:=inherited GetPos; Dec(Pos,StartPos);
|
||||
Pos:=S^.GetPos; Dec(Pos,StartPos);
|
||||
GetPos:=Pos;
|
||||
end;
|
||||
|
||||
function TSubStream.GetSize: Longint;
|
||||
begin
|
||||
GetSize:=Size;
|
||||
GetSize:=StreamSize;
|
||||
end;
|
||||
|
||||
procedure TSubStream.Read(var Buf; Count: Word);
|
||||
@ -327,8 +397,8 @@ var Pos: longint;
|
||||
RCount: word;
|
||||
begin
|
||||
Pos:=GetPos;
|
||||
if Pos+Count>Size then RCount:=Size-Pos else RCount:=Count;
|
||||
inherited Read(Buf,RCount);
|
||||
if Pos+Count>StreamSize then RCount:=StreamSize-Pos else RCount:=Count;
|
||||
S^.Read(Buf,RCount);
|
||||
if RCount<Count then
|
||||
Error(stReadError,0);
|
||||
end;
|
||||
@ -336,19 +406,41 @@ end;
|
||||
procedure TSubStream.Seek(Pos: Longint);
|
||||
var RPos: longint;
|
||||
begin
|
||||
if (Pos<=Size) then RPos:=Pos else RPos:=Size;
|
||||
inherited Seek(StartPos+RPos);
|
||||
if (Pos<=StreamSize) then RPos:=Pos else RPos:=StreamSize;
|
||||
S^.Seek(StartPos+RPos);
|
||||
end;
|
||||
|
||||
procedure TSubStream.Write(var Buf; Count: Word);
|
||||
begin
|
||||
inherited Write(Buf,Count);
|
||||
S^.Write(Buf,Count);
|
||||
end;
|
||||
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.4 1999-04-07 21:56:06 peter
|
||||
Revision 1.5 1999-08-03 20:22:45 peter
|
||||
+ TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
|
||||
+ Desktop saving should work now
|
||||
- History saved
|
||||
- Clipboard content saved
|
||||
- Desktop saved
|
||||
- Symbol info saved
|
||||
* syntax-highlight bug fixed, which compared special keywords case sensitive
|
||||
(for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
|
||||
* with 'whole words only' set, the editor didn't found occourences of the
|
||||
searched text, if the text appeared previously in the same line, but didn't
|
||||
satisfied the 'whole-word' condition
|
||||
* ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
|
||||
(ie. the beginning of the selection)
|
||||
* when started typing in a new line, but not at the start (X=0) of it,
|
||||
the editor inserted the text one character more to left as it should...
|
||||
* TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
|
||||
* Shift shouldn't cause so much trouble in TCodeEditor now...
|
||||
* Syntax highlight had problems recognizing a special symbol if it was
|
||||
prefixed by another symbol character in the source text
|
||||
* Auto-save also occours at Dos shell, Tool execution, etc. now...
|
||||
|
||||
Revision 1.4 1999/04/07 21:56:06 peter
|
||||
+ object support for browser
|
||||
* html help fixes
|
||||
* more desktop saving things
|
||||
|
||||
@ -172,6 +172,7 @@ type
|
||||
procedure InsertOK(ADialog: PDialog);
|
||||
procedure InsertButtons(ADialog: PDialog);
|
||||
|
||||
procedure Bug(const S: string; Params: pointer);
|
||||
procedure ErrorBox(const S: string; Params: pointer);
|
||||
procedure WarningBox(const S: string; Params: pointer);
|
||||
procedure InformationBox(const S: string; Params: pointer);
|
||||
@ -1299,7 +1300,7 @@ end;
|
||||
function TLocalMenuListBox.GetLocalMenu: PMenu;
|
||||
begin
|
||||
GetLocalMenu:=nil;
|
||||
Abstract;
|
||||
{ Abstract;}
|
||||
end;
|
||||
|
||||
function TLocalMenuListBox.GetCommandTarget: PView;
|
||||
@ -1379,6 +1380,10 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure Bug(const S: string; Params: pointer);
|
||||
begin
|
||||
ErrorBox('Bug check failed: '+S+#13+'Please report to author!',Params);
|
||||
end;
|
||||
|
||||
procedure ErrorBox(const S: string; Params: pointer);
|
||||
begin
|
||||
@ -2074,7 +2079,29 @@ end;
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.9 1999-06-28 19:32:37 peter
|
||||
Revision 1.10 1999-08-03 20:22:46 peter
|
||||
+ TTab acts now on Ctrl+Tab and Ctrl+Shift+Tab...
|
||||
+ Desktop saving should work now
|
||||
- History saved
|
||||
- Clipboard content saved
|
||||
- Desktop saved
|
||||
- Symbol info saved
|
||||
* syntax-highlight bug fixed, which compared special keywords case sensitive
|
||||
(for ex. 'asm' caused asm-highlighting, while 'ASM' didn't)
|
||||
* with 'whole words only' set, the editor didn't found occourences of the
|
||||
searched text, if the text appeared previously in the same line, but didn't
|
||||
satisfied the 'whole-word' condition
|
||||
* ^QB jumped to (SelStart.X,SelEnd.X) instead of (SelStart.X,SelStart.Y)
|
||||
(ie. the beginning of the selection)
|
||||
* when started typing in a new line, but not at the start (X=0) of it,
|
||||
the editor inserted the text one character more to left as it should...
|
||||
* TCodeEditor.HideSelection (Ctrl-K+H) didn't update the screen
|
||||
* Shift shouldn't cause so much trouble in TCodeEditor now...
|
||||
* Syntax highlight had problems recognizing a special symbol if it was
|
||||
prefixed by another symbol character in the source text
|
||||
* Auto-save also occours at Dos shell, Tool execution, etc. now...
|
||||
|
||||
Revision 1.9 1999/06/28 19:32:37 peter
|
||||
* fixes from gabor
|
||||
|
||||
Revision 1.8 1999/06/28 12:29:56 pierre
|
||||
|
||||
Loading…
Reference in New Issue
Block a user