mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-07 02:39:37 +01:00
+ ctrl-c capture with confirm dialog
+ ascii table in the tools menu + heapviewer * empty file fixed * fixed callback routines in fpdebug to have far for tp7
This commit is contained in:
parent
afba976e1a
commit
be2415693b
@ -22,11 +22,7 @@ uses
|
|||||||
Dos,
|
Dos,
|
||||||
BrowCol,
|
BrowCol,
|
||||||
FPIni,FPViews,FPConst,FPVars,FPUtils,FPIde,FPHelp,FPSwitch,FPUsrScr,
|
FPIni,FPViews,FPConst,FPVars,FPUtils,FPIde,FPHelp,FPSwitch,FPUsrScr,
|
||||||
FPTools,FPDebug,FPTemplt
|
FPTools,FPDebug,FPTemplt,FPCatch;
|
||||||
{$ifdef TEMPHEAP}
|
|
||||||
,dpmiexcp
|
|
||||||
{$endif TEMPHEAP}
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
procedure ProcessParams(BeforeINI: boolean);
|
procedure ProcessParams(BeforeINI: boolean);
|
||||||
@ -111,7 +107,14 @@ BEGIN
|
|||||||
END.
|
END.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.11 1999-02-18 13:44:30 peter
|
Revision 1.12 1999-02-20 15:18:25 peter
|
||||||
|
+ ctrl-c capture with confirm dialog
|
||||||
|
+ ascii table in the tools menu
|
||||||
|
+ heapviewer
|
||||||
|
* empty file fixed
|
||||||
|
* fixed callback routines in fpdebug to have far for tp7
|
||||||
|
|
||||||
|
Revision 1.11 1999/02/18 13:44:30 peter
|
||||||
* search fixed
|
* search fixed
|
||||||
+ backward search
|
+ backward search
|
||||||
* help fixes
|
* help fixes
|
||||||
|
|||||||
@ -93,7 +93,7 @@ const
|
|||||||
procedure TCalcButton.HandleEvent(var Event: TEvent);
|
procedure TCalcButton.HandleEvent(var Event: TEvent);
|
||||||
var
|
var
|
||||||
Call : boolean;
|
Call : boolean;
|
||||||
i : Sw_Word;
|
i : longint;
|
||||||
begin
|
begin
|
||||||
Call:=true;
|
Call:=true;
|
||||||
case Event.What of
|
case Event.What of
|
||||||
@ -423,7 +423,14 @@ end;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.1 1998-12-22 14:27:54 peter
|
Revision 1.2 1999-02-20 15:18:27 peter
|
||||||
|
+ ctrl-c capture with confirm dialog
|
||||||
|
+ ascii table in the tools menu
|
||||||
|
+ heapviewer
|
||||||
|
* empty file fixed
|
||||||
|
* fixed callback routines in fpdebug to have far for tp7
|
||||||
|
|
||||||
|
Revision 1.1 1998/12/22 14:27:54 peter
|
||||||
* moved
|
* moved
|
||||||
|
|
||||||
Revision 1.2 1998/12/22 10:39:39 peter
|
Revision 1.2 1998/12/22 10:39:39 peter
|
||||||
|
|||||||
92
ide/text/fpcatch.pas
Normal file
92
ide/text/fpcatch.pas
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
{
|
||||||
|
$Id$
|
||||||
|
Copyright (c) 1997-98 by Michael Van Canneyt
|
||||||
|
|
||||||
|
Unit to catch segmentation faults and Ctrl-C and exit gracefully
|
||||||
|
under linux and go32v2
|
||||||
|
|
||||||
|
See the file COPYING.FPC, included in this distribution,
|
||||||
|
for details about the copyright.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
**********************************************************************}
|
||||||
|
Unit fpcatch;
|
||||||
|
interface
|
||||||
|
|
||||||
|
{$ifdef linux}
|
||||||
|
{$define has_signal}
|
||||||
|
uses
|
||||||
|
linux;
|
||||||
|
{$endif}
|
||||||
|
{$ifdef go32v2}
|
||||||
|
{$define has_signal}
|
||||||
|
uses
|
||||||
|
dpmiexcp;
|
||||||
|
{$endif}
|
||||||
|
|
||||||
|
{$ifdef has_signal}
|
||||||
|
Var
|
||||||
|
NewSignal,OldSigSegm,OldSigInt : SignalHandler;
|
||||||
|
{$endif}
|
||||||
|
|
||||||
|
|
||||||
|
Implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
commands,msgbox,
|
||||||
|
fpide,fpviews;
|
||||||
|
|
||||||
|
|
||||||
|
{$ifdef has_signal}
|
||||||
|
{$ifdef linux}
|
||||||
|
Procedure CatchSignal(Sig : Integer);cdecl;
|
||||||
|
{$else}
|
||||||
|
Function CatchSignal(Sig : longint):longint;
|
||||||
|
{$endif}
|
||||||
|
begin
|
||||||
|
case Sig of
|
||||||
|
SIGSEGV : begin
|
||||||
|
MyApp.Done;
|
||||||
|
Writeln('Internal Error caught');
|
||||||
|
Halt;
|
||||||
|
end;
|
||||||
|
SIGINT : begin
|
||||||
|
if MessageBox(#3'Do You really want to quit?',nil,mferror+mfyesbutton+mfnobutton)=cmYes then
|
||||||
|
begin
|
||||||
|
MyApp.Done;
|
||||||
|
Halt;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
{$ifndef linux}
|
||||||
|
CatchSignal:=0;
|
||||||
|
{$endif}
|
||||||
|
end;
|
||||||
|
{$endif def has_signal}
|
||||||
|
|
||||||
|
|
||||||
|
begin
|
||||||
|
{$ifdef has_signal}
|
||||||
|
{$ifndef TP}
|
||||||
|
NewSignal:=SignalHandler(@CatchSignal);
|
||||||
|
{$else TP}
|
||||||
|
NewSignal:=SignalHandler(CatchSignal);
|
||||||
|
{$endif TP}
|
||||||
|
OldSigSegm:=Signal (SIGSEGV,NewSignal);
|
||||||
|
OldSigInt:=Signal (SIGINT,NewSignal);
|
||||||
|
{$endif}
|
||||||
|
end.
|
||||||
|
|
||||||
|
{
|
||||||
|
$Log$
|
||||||
|
Revision 1.1 1999-02-20 15:18:28 peter
|
||||||
|
+ ctrl-c capture with confirm dialog
|
||||||
|
+ ascii table in the tools menu
|
||||||
|
+ heapviewer
|
||||||
|
* empty file fixed
|
||||||
|
* fixed callback routines in fpdebug to have far for tp7
|
||||||
|
|
||||||
|
}
|
||||||
@ -99,6 +99,7 @@ const
|
|||||||
cmUserScreenWindow = 1651;
|
cmUserScreenWindow = 1651;
|
||||||
cmEvaluate = 1652;
|
cmEvaluate = 1652;
|
||||||
cmCalculator = 1653;
|
cmCalculator = 1653;
|
||||||
|
cmAsciiTable = 1654;
|
||||||
|
|
||||||
cmToolsMessages = 1700;
|
cmToolsMessages = 1700;
|
||||||
cmToolsBase = 1800;
|
cmToolsBase = 1800;
|
||||||
@ -172,6 +173,7 @@ const
|
|||||||
hcSaveINI = hcShift+cmSaveINI;
|
hcSaveINI = hcShift+cmSaveINI;
|
||||||
hcSaveAsINI = hcShift+cmSaveAsINI;
|
hcSaveAsINI = hcShift+cmSaveAsINI;
|
||||||
hcCalculator = hcShift+cmCalculator;
|
hcCalculator = hcShift+cmCalculator;
|
||||||
|
hcAsciiTable = hcShift+cmAsciiTable;
|
||||||
hcGrep = hcShift+cmGrep;
|
hcGrep = hcShift+cmGrep;
|
||||||
hcSwitchesMode = hcShift+cmSwitchesMode;
|
hcSwitchesMode = hcShift+cmSwitchesMode;
|
||||||
hcAbout = hcShift+cmAbout;
|
hcAbout = hcShift+cmAbout;
|
||||||
@ -273,7 +275,14 @@ implementation
|
|||||||
END.
|
END.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.10 1999-02-11 19:07:19 pierre
|
Revision 1.11 1999-02-20 15:18:28 peter
|
||||||
|
+ ctrl-c capture with confirm dialog
|
||||||
|
+ ascii table in the tools menu
|
||||||
|
+ heapviewer
|
||||||
|
* empty file fixed
|
||||||
|
* fixed callback routines in fpdebug to have far for tp7
|
||||||
|
|
||||||
|
Revision 1.10 1999/02/11 19:07:19 pierre
|
||||||
* GDBWindow redesigned :
|
* GDBWindow redesigned :
|
||||||
normal editor apart from
|
normal editor apart from
|
||||||
that any kbEnter will send the line (for begin to cursor)
|
that any kbEnter will send the line (for begin to cursor)
|
||||||
|
|||||||
@ -128,7 +128,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDebugController.InsertBreakpoints;
|
procedure TDebugController.InsertBreakpoints;
|
||||||
procedure DoInsert(PB : PBreakpoint);
|
|
||||||
|
procedure DoInsert(PB : PBreakpoint);{$ifndef FPC}far;{$endif}
|
||||||
begin
|
begin
|
||||||
PB^.Insert;
|
PB^.Insert;
|
||||||
end;
|
end;
|
||||||
@ -139,16 +140,18 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
procedure TDebugController.RemoveBreakpoints;
|
procedure TDebugController.RemoveBreakpoints;
|
||||||
procedure DoDelete(PB : PBreakpoint);
|
|
||||||
|
procedure DoDelete(PB : PBreakpoint);{$ifndef FPC}far;{$endif}
|
||||||
begin
|
begin
|
||||||
PB^.Remove;
|
PB^.Remove;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
BreakpointCollection^.ForEach(@DoDelete);
|
BreakpointCollection^.ForEach(@DoDelete);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDebugController.ResetBreakpointsValues;
|
procedure TDebugController.ResetBreakpointsValues;
|
||||||
procedure DoResetVal(PB : PBreakpoint);
|
procedure DoResetVal(PB : PBreakpoint);{$ifndef FPC}far;{$endif}
|
||||||
begin
|
begin
|
||||||
PB^.ResetValues;
|
PB^.ResetValues;
|
||||||
end;
|
end;
|
||||||
@ -544,7 +547,7 @@ end;
|
|||||||
|
|
||||||
procedure TBreakpointCollection.ShowBreakpoints(W : PSourceWindow);
|
procedure TBreakpointCollection.ShowBreakpoints(W : PSourceWindow);
|
||||||
|
|
||||||
procedure SetInSource(P : PBreakpoint);
|
procedure SetInSource(P : PBreakpoint);{$ifndef FPC}far;{$endif}
|
||||||
begin
|
begin
|
||||||
If assigned(P^.FileName) and (P^.FileName^=W^.Editor^.FileName) then
|
If assigned(P^.FileName) and (P^.FileName^=W^.Editor^.FileName) then
|
||||||
W^.Editor^.SetLineBreakState(P^.Line,P^.state=bs_enabled);
|
W^.Editor^.SetLineBreakState(P^.Line,P^.state=bs_enabled);
|
||||||
@ -556,7 +559,7 @@ end;
|
|||||||
|
|
||||||
function TBreakpointCollection.GetType(typ : BreakpointType;Const s : String) : PBreakpoint;
|
function TBreakpointCollection.GetType(typ : BreakpointType;Const s : String) : PBreakpoint;
|
||||||
|
|
||||||
function IsThis(P : PBreakpoint) : boolean;
|
function IsThis(P : PBreakpoint) : boolean;{$ifndef FPC}far;{$endif}
|
||||||
begin
|
begin
|
||||||
IsThis:=(P^.typ=typ) and (P^.Name^=S);
|
IsThis:=(P^.typ=typ) and (P^.Name^=S);
|
||||||
end;
|
end;
|
||||||
@ -569,7 +572,7 @@ function TBreakpointCollection.ToggleFileLine(Const FileName: String;LineNr : Lo
|
|||||||
|
|
||||||
var PB : PBreakpoint;
|
var PB : PBreakpoint;
|
||||||
|
|
||||||
function IsThere(P : PBreakpoint) : boolean;
|
function IsThere(P : PBreakpoint) : boolean;{$ifndef FPC}far;{$endif}
|
||||||
begin
|
begin
|
||||||
IsThere:=(P^.typ=bt_file_line) and (P^.FileName^=FileName) and (P^.Line=LineNr);
|
IsThere:=(P^.typ=bt_file_line) and (P^.FileName^=FileName) and (P^.Line=LineNr);
|
||||||
end;
|
end;
|
||||||
@ -676,7 +679,14 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.14 1999-02-16 12:47:36 pierre
|
Revision 1.15 1999-02-20 15:18:29 peter
|
||||||
|
+ ctrl-c capture with confirm dialog
|
||||||
|
+ ascii table in the tools menu
|
||||||
|
+ heapviewer
|
||||||
|
* empty file fixed
|
||||||
|
* fixed callback routines in fpdebug to have far for tp7
|
||||||
|
|
||||||
|
Revision 1.14 1999/02/16 12:47:36 pierre
|
||||||
* GDBWindow does not popup on F7 or F8 anymore
|
* GDBWindow does not popup on F7 or F8 anymore
|
||||||
|
|
||||||
Revision 1.13 1999/02/16 10:43:54 peter
|
Revision 1.13 1999/02/16 10:43:54 peter
|
||||||
|
|||||||
@ -17,14 +17,16 @@ unit fpide;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Drivers,Views,App,
|
Drivers,Views,App,Gadgets,
|
||||||
{$ifdef EDITORS}Editors,{$else}WEditor,{$endif}
|
{$ifdef EDITORS}Editors,{$else}WEditor,{$endif}
|
||||||
Comphook,
|
Comphook,
|
||||||
FPViews;
|
FPViews;
|
||||||
|
|
||||||
type
|
type
|
||||||
TIDEApp = object(TApplication)
|
TIDEApp = object(TApplication)
|
||||||
|
Heap : PHeapView;
|
||||||
constructor Init;
|
constructor Init;
|
||||||
|
procedure Idle;virtual;
|
||||||
procedure InitMenuBar; virtual;
|
procedure InitMenuBar; virtual;
|
||||||
procedure InitStatusLine; virtual;
|
procedure InitStatusLine; virtual;
|
||||||
procedure Open(FileName: string);
|
procedure Open(FileName: string);
|
||||||
@ -60,6 +62,7 @@ type
|
|||||||
procedure DoOpenGDBWindow;
|
procedure DoOpenGDBWindow;
|
||||||
procedure DoToggleBreak;
|
procedure DoToggleBreak;
|
||||||
procedure Information;
|
procedure Information;
|
||||||
|
procedure DoAsciiTable;
|
||||||
procedure Calculator;
|
procedure Calculator;
|
||||||
procedure ExecuteTool(Idx: integer);
|
procedure ExecuteTool(Idx: integer);
|
||||||
procedure SetSwitchesMode;
|
procedure SetSwitchesMode;
|
||||||
@ -112,6 +115,7 @@ uses
|
|||||||
{$endif}
|
{$endif}
|
||||||
Video,Mouse,Keyboard,
|
Video,Mouse,Keyboard,
|
||||||
Dos,Objects,Memory,Menus,Dialogs,StdDlg,ColorSel,Commands,HelpCtx,
|
Dos,Objects,Memory,Menus,Dialogs,StdDlg,ColorSel,Commands,HelpCtx,
|
||||||
|
AsciiTab,
|
||||||
Systems,BrowCol,
|
Systems,BrowCol,
|
||||||
WHelp,WHlpView,WINI,
|
WHelp,WHlpView,WINI,
|
||||||
FPConst,FPVars,FPUtils,FPSwitch,FPIni,FPIntf,FPCompile,FPHelp,
|
FPConst,FPVars,FPUtils,FPSwitch,FPIni,FPIntf,FPCompile,FPHelp,
|
||||||
@ -129,6 +133,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TIDEApp.Init;
|
constructor TIDEApp.Init;
|
||||||
|
var
|
||||||
|
R : TRect;
|
||||||
begin
|
begin
|
||||||
{$ifndef EDITORS}
|
{$ifndef EDITORS}
|
||||||
UseSyntaxHighlight:=IDEUseSyntaxHighlight;
|
UseSyntaxHighlight:=IDEUseSyntaxHighlight;
|
||||||
@ -144,6 +150,18 @@ begin
|
|||||||
Desktop^.Insert(ProgramInfoWindow);
|
Desktop^.Insert(ProgramInfoWindow);
|
||||||
Message(@Self,evBroadcast,cmUpdate,nil);
|
Message(@Self,evBroadcast,cmUpdate,nil);
|
||||||
CurDirChanged;
|
CurDirChanged;
|
||||||
|
{ heap viewer }
|
||||||
|
GetExtent(R);
|
||||||
|
Dec(R.B.X);
|
||||||
|
R.A.X := R.B.X - 9; R.A.Y := R.B.Y - 1;
|
||||||
|
Heap := New(PHeapView, InitKb(R));
|
||||||
|
Insert(Heap);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TIDEApp.Idle;
|
||||||
|
begin
|
||||||
|
inherited Idle;
|
||||||
|
Heap^.Update;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TIDEApp.InitMenuBar;
|
procedure TIDEApp.InitMenuBar;
|
||||||
@ -216,7 +234,8 @@ begin
|
|||||||
NewLine(
|
NewLine(
|
||||||
NewItem('~G~rep', 'Shift+F2', kbShiftF2, cmGrep, hcGrep,
|
NewItem('~G~rep', 'Shift+F2', kbShiftF2, cmGrep, hcGrep,
|
||||||
NewItem('~C~alculator', '', kbNoKey, cmCalculator, hcCalculator,
|
NewItem('~C~alculator', '', kbNoKey, cmCalculator, hcCalculator,
|
||||||
nil))))),
|
NewItem('Ascii ~t~able', '', kbNoKey, cmAsciiTable, hcAsciiTable,
|
||||||
|
nil)))))),
|
||||||
NewSubMenu('~O~ptions', hcOptionsMenu, NewMenu(
|
NewSubMenu('~O~ptions', hcOptionsMenu, NewMenu(
|
||||||
NewItem('Mode~.~..','', kbNoKey, cmSwitchesMode, hcSwitchesMode,
|
NewItem('Mode~.~..','', kbNoKey, cmSwitchesMode, hcSwitchesMode,
|
||||||
NewItem('~C~ompiler...','', kbNoKey, cmCompiler, hcCompiler,
|
NewItem('~C~ompiler...','', kbNoKey, cmCompiler, hcCompiler,
|
||||||
@ -375,6 +394,7 @@ begin
|
|||||||
cmSaveINI : SaveINI;
|
cmSaveINI : SaveINI;
|
||||||
cmSaveAsINI : SaveAsINI;
|
cmSaveAsINI : SaveAsINI;
|
||||||
{ -- Tools menu -- }
|
{ -- Tools menu -- }
|
||||||
|
cmAsciiTable : DoAsciiTable;
|
||||||
cmCalculator : Calculator;
|
cmCalculator : Calculator;
|
||||||
cmGrep : Grep;
|
cmGrep : Grep;
|
||||||
cmToolsBase+1..
|
cmToolsBase+1..
|
||||||
@ -662,7 +682,14 @@ end;
|
|||||||
END.
|
END.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.16 1999-02-18 13:44:31 peter
|
Revision 1.17 1999-02-20 15:18:30 peter
|
||||||
|
+ ctrl-c capture with confirm dialog
|
||||||
|
+ ascii table in the tools menu
|
||||||
|
+ heapviewer
|
||||||
|
* empty file fixed
|
||||||
|
* fixed callback routines in fpdebug to have far for tp7
|
||||||
|
|
||||||
|
Revision 1.16 1999/02/18 13:44:31 peter
|
||||||
* search fixed
|
* search fixed
|
||||||
+ backward search
|
+ backward search
|
||||||
* help fixes
|
* help fixes
|
||||||
|
|||||||
@ -14,6 +14,16 @@
|
|||||||
|
|
||||||
**********************************************************************}
|
**********************************************************************}
|
||||||
|
|
||||||
|
procedure TIDEApp.DoAsciiTable;
|
||||||
|
var
|
||||||
|
P: PAsciiChart;
|
||||||
|
begin
|
||||||
|
P := New(PAsciiChart, Init);
|
||||||
|
P^.HelpCtx := hcAsciiTable;
|
||||||
|
InsertWindow(P);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TIDEApp.Calculator;
|
procedure TIDEApp.Calculator;
|
||||||
begin
|
begin
|
||||||
with CalcWindow^ do
|
with CalcWindow^ do
|
||||||
@ -127,7 +137,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.6 1999-02-05 13:51:42 peter
|
Revision 1.7 1999-02-20 15:18:31 peter
|
||||||
|
+ ctrl-c capture with confirm dialog
|
||||||
|
+ ascii table in the tools menu
|
||||||
|
+ heapviewer
|
||||||
|
* empty file fixed
|
||||||
|
* fixed callback routines in fpdebug to have far for tp7
|
||||||
|
|
||||||
|
Revision 1.6 1999/02/05 13:51:42 peter
|
||||||
* unit name of FPSwitches -> FPSwitch which is easier to use
|
* unit name of FPSwitches -> FPSwitch which is easier to use
|
||||||
* some fixes for tp7 compiling
|
* some fixes for tp7 compiling
|
||||||
|
|
||||||
|
|||||||
@ -72,20 +72,23 @@ Type
|
|||||||
|
|
||||||
Var
|
Var
|
||||||
PrefSeg : Word;
|
PrefSeg : Word;
|
||||||
|
{$IfDef MsDos}
|
||||||
MinBlockSize : Word;
|
MinBlockSize : Word;
|
||||||
FName : PathStr;
|
|
||||||
F,FE : File;
|
|
||||||
MyBlockSize : Word;
|
MyBlockSize : Word;
|
||||||
|
{$endif}
|
||||||
|
F,FE : File;
|
||||||
RedirChanged : Boolean;
|
RedirChanged : Boolean;
|
||||||
RedirErrorChanged : Boolean;
|
RedirErrorChanged : Boolean;
|
||||||
Handles : PHandles;
|
|
||||||
OldHandle,OldErrorHandle : Byte;
|
OldHandle,OldErrorHandle : Byte;
|
||||||
|
{$ifdef UseDUP}
|
||||||
TempH, TempErrorH : longint;
|
TempH, TempErrorH : longint;
|
||||||
|
{$endif}
|
||||||
{$ifdef FPC}
|
{$ifdef FPC}
|
||||||
HandlesOffset : word;
|
HandlesOffset : word;
|
||||||
|
{$else}
|
||||||
|
Handles : PHandles;
|
||||||
{$endif FPC}
|
{$endif FPC}
|
||||||
|
|
||||||
|
|
||||||
function dup(fh : longint) : longint;
|
function dup(fh : longint) : longint;
|
||||||
var
|
var
|
||||||
Regs : Registers;
|
Regs : Registers;
|
||||||
@ -377,7 +380,14 @@ Begin
|
|||||||
End.
|
End.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.6 1999-02-05 13:51:43 peter
|
Revision 1.7 1999-02-20 15:18:32 peter
|
||||||
|
+ ctrl-c capture with confirm dialog
|
||||||
|
+ ascii table in the tools menu
|
||||||
|
+ heapviewer
|
||||||
|
* empty file fixed
|
||||||
|
* fixed callback routines in fpdebug to have far for tp7
|
||||||
|
|
||||||
|
Revision 1.6 1999/02/05 13:51:43 peter
|
||||||
* unit name of FPSwitches -> FPSwitch which is easier to use
|
* unit name of FPSwitches -> FPSwitch which is easier to use
|
||||||
* some fixes for tp7 compiling
|
* some fixes for tp7 compiling
|
||||||
|
|
||||||
|
|||||||
@ -778,10 +778,12 @@ end;
|
|||||||
PLine,TLineCollection
|
PLine,TLineCollection
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|
||||||
function NewLine(S: string): PLine;
|
function NewLine(const S: string): PLine;
|
||||||
var P: PLine;
|
var
|
||||||
|
P: PLine;
|
||||||
begin
|
begin
|
||||||
New(P); FillChar(P^,SizeOf(P^),0);
|
New(P);
|
||||||
|
FillChar(P^,SizeOf(P^),0);
|
||||||
P^.Text:=NewStr(S);
|
P^.Text:=NewStr(S);
|
||||||
NewLine:=P;
|
NewLine:=P;
|
||||||
end;
|
end;
|
||||||
@ -883,6 +885,8 @@ constructor TCodeEditor.Init(var Bounds: TRect; AHScrollBar, AVScrollBar:
|
|||||||
begin
|
begin
|
||||||
inherited Init(Bounds,AHScrollBar,AVScrollBar);
|
inherited Init(Bounds,AHScrollBar,AVScrollBar);
|
||||||
New(Lines, Init(500,1000));
|
New(Lines, Init(500,1000));
|
||||||
|
{ we have always need at least 1 line }
|
||||||
|
Lines^.Insert(NewLine(''));
|
||||||
SetState(sfCursorVis,true);
|
SetState(sfCursorVis,true);
|
||||||
SetFlags(DefaultCodeEditorFlags); TabSize:=DefaultTabSize;
|
SetFlags(DefaultCodeEditorFlags); TabSize:=DefaultTabSize;
|
||||||
SetHighlightRow(-1);
|
SetHighlightRow(-1);
|
||||||
@ -1683,10 +1687,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TCodeEditor.InsertLine: Sw_integer;
|
function TCodeEditor.InsertLine: Sw_integer;
|
||||||
var Ind: Sw_integer;
|
var
|
||||||
|
SelBack,Ind: Sw_integer;
|
||||||
S,IndentStr: string;
|
S,IndentStr: string;
|
||||||
procedure CalcIndent(LineOver: Sw_integer);
|
|
||||||
begin
|
procedure CalcIndent(LineOver: Sw_integer);
|
||||||
|
begin
|
||||||
if (LineOver<0) or (LineOver>GetLineCount) then Ind:=0 else
|
if (LineOver<0) or (LineOver>GetLineCount) then Ind:=0 else
|
||||||
begin
|
begin
|
||||||
IndentStr:=GetLineText(LineOver);
|
IndentStr:=GetLineText(LineOver);
|
||||||
@ -1695,11 +1701,18 @@ begin
|
|||||||
Inc(Ind);
|
Inc(Ind);
|
||||||
end;
|
end;
|
||||||
IndentStr:=CharStr(' ',Ind);
|
IndentStr:=CharStr(' ',Ind);
|
||||||
end;
|
end;
|
||||||
var SelBack: integer;
|
|
||||||
begin
|
begin
|
||||||
if IsReadOnly then begin InsertLine:=-1; Exit; end;
|
if IsReadOnly then
|
||||||
if CurPos.Y<GetLineCount then S:=GetLineText(CurPos.Y) else S:='';
|
begin
|
||||||
|
InsertLine:=-1;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
if CurPos.Y<GetLineCount then
|
||||||
|
S:=GetLineText(CurPos.Y)
|
||||||
|
else
|
||||||
|
S:='';
|
||||||
if Overwrite=false then
|
if Overwrite=false then
|
||||||
begin
|
begin
|
||||||
SelBack:=0;
|
SelBack:=0;
|
||||||
@ -1708,23 +1721,30 @@ begin
|
|||||||
S:=GetDisplayText(CurPos.Y);
|
S:=GetDisplayText(CurPos.Y);
|
||||||
SelBack:=length(S)-SelEnd.X;
|
SelBack:=length(S)-SelEnd.X;
|
||||||
SetDisplayText(CurPos.Y,RTrim(S));
|
SetDisplayText(CurPos.Y,RTrim(S));
|
||||||
end;
|
|
||||||
CalcIndent(CurPos.Y);
|
CalcIndent(CurPos.Y);
|
||||||
Lines^.AtInsert(CurPos.Y+1,NewLine(IndentStr+copy(S,CurPos.X+1,255)));
|
Lines^.AtInsert(CurPos.Y+1,NewLine(IndentStr+copy(S,CurPos.X+1,255)));
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
CalcIndent(0);
|
||||||
|
Lines^.Insert(NewLine(IndentStr));
|
||||||
|
end;
|
||||||
LimitsChanged;
|
LimitsChanged;
|
||||||
SetDisplayText(CurPos.Y,copy(S,1,CurPos.X-1+1));
|
SetDisplayText(CurPos.Y,copy(S,1,CurPos.X-1+1));
|
||||||
if PointOfs(SelStart)<>PointOfs(SelEnd) then { !!! check it - it's buggy !!! }
|
if PointOfs(SelStart)<>PointOfs(SelEnd) then { !!! check it - it's buggy !!! }
|
||||||
begin SelEnd.Y:=CurPos.Y+1; SelEnd.X:=length(GetLineText(CurPos.Y+1))-SelBack; end;
|
begin
|
||||||
|
SelEnd.Y:=CurPos.Y+1;
|
||||||
|
SelEnd.X:=length(GetLineText(CurPos.Y+1))-SelBack;
|
||||||
|
end;
|
||||||
UpdateAttrs(CurPos.Y,attrAll);
|
UpdateAttrs(CurPos.Y,attrAll);
|
||||||
SetCurPtr(Ind,CurPos.Y+1);
|
SetCurPtr(Ind,CurPos.Y+1);
|
||||||
end else
|
end
|
||||||
|
else
|
||||||
begin
|
begin
|
||||||
if CurPos.Y=GetLineCount-1 then
|
if CurPos.Y=GetLineCount-1 then
|
||||||
CalcIndent(CurPos.Y);
|
CalcIndent(CurPos.Y);
|
||||||
begin
|
|
||||||
Lines^.Insert(NewLine(IndentStr));
|
Lines^.Insert(NewLine(IndentStr));
|
||||||
LimitsChanged;
|
LimitsChanged;
|
||||||
end;
|
|
||||||
SetCurPtr(Ind,CurPos.Y+1);
|
SetCurPtr(Ind,CurPos.Y+1);
|
||||||
end;
|
end;
|
||||||
DrawLines(CurPos.Y);
|
DrawLines(CurPos.Y);
|
||||||
@ -2833,12 +2853,17 @@ begin
|
|||||||
Reset(f);
|
Reset(f);
|
||||||
{$ifdef TPUNIXLF}OnlyLF:=true;{$endif}
|
{$ifdef TPUNIXLF}OnlyLF:=true;{$endif}
|
||||||
OK:=(IOResult=0);
|
OK:=(IOResult=0);
|
||||||
|
if Eof(f) then
|
||||||
|
AddLine('')
|
||||||
|
else
|
||||||
|
begin
|
||||||
while OK and (Eof(f)=false) and (GetLineCount<MaxLineCount) do
|
while OK and (Eof(f)=false) and (GetLineCount<MaxLineCount) do
|
||||||
begin
|
begin
|
||||||
readln(f,S);
|
readln(f,S);
|
||||||
OK:=OK and (IOResult=0);
|
OK:=OK and (IOResult=0);
|
||||||
if OK then AddLine(S);
|
if OK then AddLine(S);
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
FileMode:=FM;
|
FileMode:=FM;
|
||||||
Close(F);
|
Close(F);
|
||||||
EatIO;
|
EatIO;
|
||||||
@ -3217,7 +3242,14 @@ end;
|
|||||||
END.
|
END.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.20 1999-02-18 17:27:57 pierre
|
Revision 1.21 1999-02-20 15:18:33 peter
|
||||||
|
+ ctrl-c capture with confirm dialog
|
||||||
|
+ ascii table in the tools menu
|
||||||
|
+ heapviewer
|
||||||
|
* empty file fixed
|
||||||
|
* fixed callback routines in fpdebug to have far for tp7
|
||||||
|
|
||||||
|
Revision 1.20 1999/02/18 17:27:57 pierre
|
||||||
* find/replace dialogs need packed records !!
|
* find/replace dialogs need packed records !!
|
||||||
|
|
||||||
Revision 1.19 1999/02/18 13:44:36 peter
|
Revision 1.19 1999/02/18 13:44:36 peter
|
||||||
|
|||||||
@ -409,6 +409,7 @@ end;
|
|||||||
function THelpFile.LoadIndex: boolean;
|
function THelpFile.LoadIndex: boolean;
|
||||||
begin
|
begin
|
||||||
Abstract;
|
Abstract;
|
||||||
|
LoadIndex:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function THelpFile.SearchTopic(HelpCtx: THelpCtx): PTopic;
|
function THelpFile.SearchTopic(HelpCtx: THelpCtx): PTopic;
|
||||||
@ -421,6 +422,7 @@ end;
|
|||||||
function THelpFile.ReadTopic(T: PTopic): boolean;
|
function THelpFile.ReadTopic(T: PTopic): boolean;
|
||||||
begin
|
begin
|
||||||
Abstract;
|
Abstract;
|
||||||
|
ReadTopic:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure THelpFile.MaintainTopicCache;
|
procedure THelpFile.MaintainTopicCache;
|
||||||
@ -943,7 +945,14 @@ end;
|
|||||||
END.
|
END.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.5 1999-02-19 15:43:22 peter
|
Revision 1.6 1999-02-20 15:18:35 peter
|
||||||
|
+ ctrl-c capture with confirm dialog
|
||||||
|
+ ascii table in the tools menu
|
||||||
|
+ heapviewer
|
||||||
|
* empty file fixed
|
||||||
|
* fixed callback routines in fpdebug to have far for tp7
|
||||||
|
|
||||||
|
Revision 1.5 1999/02/19 15:43:22 peter
|
||||||
* compatibility fixes for FV
|
* compatibility fixes for FV
|
||||||
|
|
||||||
Revision 1.4 1999/02/18 13:44:37 peter
|
Revision 1.4 1999/02/18 13:44:37 peter
|
||||||
|
|||||||
@ -128,6 +128,7 @@ end;
|
|||||||
function TTextFile.GetLine(Idx: sw_integer; var S: string): boolean;
|
function TTextFile.GetLine(Idx: sw_integer; var S: string): boolean;
|
||||||
begin
|
begin
|
||||||
Abstract;
|
Abstract;
|
||||||
|
GetLine:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TDOSTextFile.Init(AFileName: string);
|
constructor TDOSTextFile.Init(AFileName: string);
|
||||||
@ -288,6 +289,7 @@ begin
|
|||||||
|
|
||||||
end;
|
end;
|
||||||
if WasThereAnyText then DocSoftBreak;
|
if WasThereAnyText then DocSoftBreak;
|
||||||
|
ProcessLine:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSGMLParser.DocSoftBreak;
|
procedure TSGMLParser.DocSoftBreak;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user