+ Browser info saving

This commit is contained in:
pierre 2000-01-25 00:26:35 +00:00
parent bc59550b33
commit 8c7cc67209
4 changed files with 170 additions and 64 deletions

View File

@ -62,6 +62,11 @@ begin
Delete(Param,1,1); { eat separator } Delete(Param,1,1); { eat separator }
INIPath:=copy(Param,2,255); INIPath:=copy(Param,2,255);
end; end;
{$ifdef go32v2}
'N' :
if UpCase(Param)='NOLFN' then
LFNSupport:=false;
{$endif go32v2}
'R' : { enter the directory last exited from (BP comp.) } 'R' : { enter the directory last exited from (BP comp.) }
begin begin
Param:=copy(Param,2,255); Param:=copy(Param,2,255);
@ -130,16 +135,17 @@ var CanExit : boolean;
BEGIN BEGIN
{$ifdef DEV}HeapLimit:=4096;{$endif} {$ifdef DEV}HeapLimit:=4096;{$endif}
writeln('þ Free Pascal IDE Version '+VersionStr); writeln('þ Free Pascal IDE Version '+VersionStr);
ProcessParams(true);
StartupDir:=CompleteDir(FExpand('.')); StartupDir:=CompleteDir(FExpand('.'));
IDEDir:=CompleteDir(DirOf(system.Paramstr(0))); IDEDir:=CompleteDir(DirOf(system.Paramstr(0)));
RegisterIDEObjects; RegisterIDEObjects;
StreamError:=@MyStreamError; StreamError:=@MyStreamError;
ProcessParams(true);
{$ifdef win32} {$ifdef win32}
DosExecute(GetEnv('COMSPEC'),'/C echo Win32 mouse test'); DosExecute(GetEnv('COMSPEC'),'/C echo This dummy call gets the mouse to become visible');
{$endif win32} {$endif win32}
{$ifdef VESA} {$ifdef VESA}
InitVESAScreenModes; InitVESAScreenModes;
@ -207,7 +213,10 @@ BEGIN
END. END.
{ {
$Log$ $Log$
Revision 1.36 2000-01-10 15:53:37 pierre Revision 1.37 2000-01-25 00:26:35 pierre
+ Browser info saving
Revision 1.36 2000/01/10 15:53:37 pierre
* WViews objects were not registered * WViews objects were not registered
Revision 1.35 2000/01/03 11:38:33 michael Revision 1.35 2000/01/03 11:38:33 michael

View File

@ -94,7 +94,7 @@ uses
App,Commands,tokens, App,Commands,tokens,
CompHook, Compiler, systems, browcol, CompHook, Compiler, systems, browcol,
WUtils,WEditor, WUtils,WEditor,
FPRedir, FPRedir,FPDesk,
FPIde,FPConst,FPVars,FPUtils,FPIntf,FPSwitch; FPIde,FPConst,FPVars,FPUtils,FPIntf,FPSwitch;
{$ifndef NOOBJREG} {$ifndef NOOBJREG}
@ -548,6 +548,8 @@ begin
WriteSwitches(SwitchesPath); WriteSwitches(SwitchesPath);
{ leaving open browsers leads to crashes !! (PM) } { leaving open browsers leads to crashes !! (PM) }
CloseAllBrowsers; CloseAllBrowsers;
if ((DesktopFileFlags and dfSymbolInformation)<>0) then
WriteSymbolsFile(BrowserName);
{ MainFile:=FixFileName(FExpand(FileName));} { MainFile:=FixFileName(FExpand(FileName));}
If GetEXEPath<>'' then If GetEXEPath<>'' then
EXEFile:=FixFileName(GetEXEPath+NameOf(MainFile)+ExeExt) EXEFile:=FixFileName(GetEXEPath+NameOf(MainFile)+ExeExt)
@ -684,6 +686,10 @@ begin
end; end;
{ ^^^ we need this trick to reactivate the desktop } { ^^^ we need this trick to reactivate the desktop }
EditorModified:=false; EditorModified:=false;
{ Try to read Browser info in again if compilation failure !! }
if Not Assigned(Modules) and
((DesktopFileFlags and dfSymbolInformation)<>0) then
ReadSymbolsFile(BrowserName);
end; end;
function NeedRecompile: boolean; function NeedRecompile: boolean;
@ -736,7 +742,10 @@ end;
end. end.
{ {
$Log$ $Log$
Revision 1.48 2000-01-14 15:38:28 pierre Revision 1.49 2000-01-25 00:26:35 pierre
+ Browser info saving
Revision 1.48 2000/01/14 15:38:28 pierre
+ support for long filenames with spaces for compilation + support for long filenames with spaces for compilation
* avoid too long linker error output * avoid too long linker error output

View File

@ -33,6 +33,7 @@ const
ININame = 'fp.ini'; ININame = 'fp.ini';
SwitchesName = 'fp.cfg'; SwitchesName = 'fp.cfg';
DesktopName = 'fp.dsk'; DesktopName = 'fp.dsk';
BrowserName = 'fp.brw';
ToolCaptureName = '__tool__.out'; { all '$' signs replaces with '_'s } ToolCaptureName = '__tool__.out'; { all '$' signs replaces with '_'s }
FilterCaptureName = '_filter_.out'; FilterCaptureName = '_filter_.out';
@ -374,7 +375,10 @@ implementation
END. END.
{ {
$Log$ $Log$
Revision 1.32 2000-01-08 18:26:20 florian Revision 1.33 2000-01-25 00:26:36 pierre
+ Browser info saving
Revision 1.32 2000/01/08 18:26:20 florian
+ added a register window, doesn't work yet + added a register window, doesn't work yet
Revision 1.31 2000/01/03 11:38:33 michael Revision 1.31 2000/01/03 11:38:33 michael

View File

@ -35,6 +35,8 @@ procedure InitDesktopFile;
function LoadDesktop: boolean; function LoadDesktop: boolean;
function SaveDesktop: boolean; function SaveDesktop: boolean;
procedure DoneDesktopFile; procedure DoneDesktopFile;
function WriteSymbolsFile(const filename : string): boolean;
function ReadSymbolsFile(const filename : string): boolean;
implementation implementation
@ -42,6 +44,7 @@ uses Dos,
Objects,Drivers,Video, Objects,Drivers,Video,
Views,App,HistList,BrowCol, Views,App,HistList,BrowCol,
WResource,WViews,WEditor, WResource,WViews,WEditor,
WUtils,
{$ifndef NODEBUG} {$ifndef NODEBUG}
fpdebug, fpdebug,
{$endif ndef NODEBUG} {$endif ndef NODEBUG}
@ -70,12 +73,15 @@ begin
if OK then if OK then
LoadHistory(S^); LoadHistory(S^);
Dispose(S, Done); Dispose(S, Done);
if OK=false then
ErrorBox('Error loading history',nil);
PopStatus; PopStatus;
ReadHistory:=OK; ReadHistory:=OK;
end; end;
function WriteHistory(F: PResourceFile): boolean; function WriteHistory(F: PResourceFile): boolean;
var S: PMemoryStream; var S: PMemoryStream;
OK: boolean;
begin begin
PushStatus('Storing history...'); PushStatus('Storing history...');
@ -83,10 +89,12 @@ begin
StoreHistory(S^); StoreHistory(S^);
S^.Seek(0); S^.Seek(0);
F^.CreateResource(resHistory,rcBinary,0); F^.CreateResource(resHistory,rcBinary,0);
F^.AddResourceEntryFromStream(resHistory,langDefault,0,S^,S^.GetSize); OK:=F^.AddResourceEntryFromStream(resHistory,langDefault,0,S^,S^.GetSize);
Dispose(S, Done); Dispose(S, Done);
if OK=false then
ErrorBox('Error storing history',nil);
PopStatus; PopStatus;
WriteHistory:=true; WriteHistory:=OK;
end; end;
(*function ReadClipboard(F: PResourceFile): boolean; (*function ReadClipboard(F: PResourceFile): boolean;
@ -134,6 +142,8 @@ begin
else if assigned(OWC) then else if assigned(OWC) then
WatchesCollection:=OWC; WatchesCollection:=OWC;
end; end;
if OK=false then
ErrorBox('Error loading watches',nil);
ReadWatches:=OK; ReadWatches:=OK;
Dispose(S, Done); Dispose(S, Done);
PopStatus; PopStatus;
@ -145,6 +155,7 @@ end;
function WriteWatches(F: PResourceFile): boolean; function WriteWatches(F: PResourceFile): boolean;
var var
S : PMemoryStream; S : PMemoryStream;
OK : boolean;
begin begin
{$ifndef NODEBUG} {$ifndef NODEBUG}
if not assigned(WatchesCollection) then if not assigned(WatchesCollection) then
@ -158,9 +169,12 @@ begin
S^.Put(WatchesCollection); S^.Put(WatchesCollection);
S^.Seek(0); S^.Seek(0);
F^.CreateResource(resWatches,rcBinary,0); F^.CreateResource(resWatches,rcBinary,0);
WriteWatches:=F^.AddResourceEntryFromStream(resWatches,langDefault,0,S^,S^.GetSize); OK:=F^.AddResourceEntryFromStream(resWatches,langDefault,0,S^,S^.GetSize);
Dispose(S, Done); Dispose(S, Done);
if OK=false then
ErrorBox('Error storing watches',nil);
PopStatus; PopStatus;
WriteWatches:=OK;
end; end;
{$endif NODEBUG} {$endif NODEBUG}
end; end;
@ -188,6 +202,8 @@ begin
else if assigned(OBC) then else if assigned(OBC) then
BreakpointsCollection:=OBC; BreakpointsCollection:=OBC;
end; end;
if OK=false then
ErrorBox('Error loading breakpoints',nil);
ReadBreakpoints:=OK; ReadBreakpoints:=OK;
Dispose(S, Done); Dispose(S, Done);
PopStatus; PopStatus;
@ -199,6 +215,7 @@ end;
function WriteBreakpoints(F: PResourceFile): boolean; function WriteBreakpoints(F: PResourceFile): boolean;
var var
S : PMemoryStream; S : PMemoryStream;
OK : boolean;
begin begin
{$ifndef NODEBUG} {$ifndef NODEBUG}
if not assigned(BreakpointsCollection) then if not assigned(BreakpointsCollection) then
@ -212,8 +229,11 @@ begin
BreakpointsCollection^.Store(S^); BreakpointsCollection^.Store(S^);
S^.Seek(0); S^.Seek(0);
F^.CreateResource(resBreakpoints,rcBinary,0); F^.CreateResource(resBreakpoints,rcBinary,0);
WriteBreakPoints:=F^.AddResourceEntryFromStream(resBreakpoints,langDefault,0,S^,S^.GetSize); OK:=F^.AddResourceEntryFromStream(resBreakpoints,langDefault,0,S^,S^.GetSize);
Dispose(S, Done); Dispose(S, Done);
if OK=false then
ErrorBox('Error storing breakpoints',nil);
WriteBreakPoints:=OK;
PopStatus; PopStatus;
end; end;
{$endif NODEBUG} {$endif NODEBUG}
@ -313,56 +333,80 @@ begin
end; end;
Dispose(S, Done); Dispose(S, Done);
end; end;
if OK=false then
ErrorBox('Error storing desktop',nil);
PopStatus; PopStatus;
WriteOpenWindows:=OK; WriteOpenWindows:=OK;
end; end;
function WriteFlags(F: PResourceFile): boolean; function WriteFlags(F: PResourceFile): boolean;
var
OK: boolean;
begin begin
F^.CreateResource(resDesktopFlags,rcBinary,0); F^.CreateResource(resDesktopFlags,rcBinary,0);
WriteFlags:=F^.AddResourceEntry(resDesktopFlags,langDefault,0,DesktopFileFlags, OK:=F^.AddResourceEntry(resDesktopFlags,langDefault,0,DesktopFileFlags,
SizeOf(DesktopFileFlags)); SizeOf(DesktopFileFlags));
if OK=false then
ErrorBox('Error writing flags',nil);
WriteFlags:=OK;
end; end;
function ReadFlags(F: PResourceFile): boolean; function ReadFlags(F: PResourceFile): boolean;
var var
size : sw_word; size : sw_word;
OK: boolean;
begin begin
ReadFlags:=F^.ReadResourceEntry(resDesktopFlags,langDefault,DesktopFileFlags, OK:=F^.ReadResourceEntry(resDesktopFlags,langDefault,DesktopFileFlags,
size); size);
if OK=false then
ErrorBox('Error loading flags',nil);
ReadFlags:=OK;
end; end;
function WriteVideoMode(F: PResourceFile): boolean; function WriteVideoMode(F: PResourceFile): boolean;
var
OK: boolean;
begin begin
F^.CreateResource(resVideo,rcBinary,0); F^.CreateResource(resVideo,rcBinary,0);
WriteVideoMode:=F^.AddResourceEntry(resVideo,langDefault,0,ScreenMode, OK:=F^.AddResourceEntry(resVideo,langDefault,0,ScreenMode,
SizeOf(TVideoMode)); SizeOf(TVideoMode));
if OK=false then
ErrorBox('Error storing video mode',nil);
WriteVideoMode:=OK;
end; end;
function ReadVideoMode(F: PResourceFile;var NewScreenMode : TVideoMode): boolean; function ReadVideoMode(F: PResourceFile;var NewScreenMode : TVideoMode): boolean;
var var
size : sw_word; size : sw_word;
test : boolean; OK,test : boolean;
begin begin
size:=SizeOf(TVideoMode); size:=SizeOf(TVideoMode);
test:=F^.ReadResourceEntry(resVideo,langDefault,NewScreenMode, test:=F^.ReadResourceEntry(resVideo,langDefault,NewScreenMode,
size); size);
if not test then if not test then
NewScreenMode:=ScreenMode; NewScreenMode:=ScreenMode;
ReadVideoMode:= test and (size = SizeOf(TVideoMode)); OK:=test and (size = SizeOf(TVideoMode));
if OK=false then
ErrorBox('Error loading video mode',nil);
ReadVideoMode:=OK;
end; end;
function ReadSymbols(F: PResourceFile): boolean; function ReadSymbols(F: PResourceFile): boolean;
var S: PMemoryStream; var S: PMemoryStream;
OK: boolean; OK: boolean;
begin begin
{ if no symbols stored ... no problems }
if not Assigned(F^.FindResource(resSymbols)) then
exit;
PushStatus('Reading symbol information...'); PushStatus('Reading symbol information...');
New(S, Init(32*1024,4096)); New(S, Init(32*1024,4096));
OK:=F^.ReadResourceEntryToStream(resSymbols,langDefault,S^); OK:=F^.ReadResourceEntryToStream(resSymbols,langDefault,S^);
S^.Seek(0); S^.Seek(0);
if OK then if OK then
LoadBrowserCol(S); OK:=LoadBrowserCol(S);
Dispose(S, Done); Dispose(S, Done);
if OK=false then
ErrorBox('Error loading symbol information',nil);
PopStatus; PopStatus;
ReadSymbols:=OK; ReadSymbols:=OK;
end; end;
@ -378,11 +422,18 @@ begin
PushStatus('Storing symbol information...'); PushStatus('Storing symbol information...');
New(S, Init(200*1024,4096)); New(S, Init(200*1024,4096));
StoreBrowserCol(S); OK:=Assigned(S);
if OK then
OK:=StoreBrowserCol(S);
if OK then
begin
S^.Seek(0); S^.Seek(0);
F^.CreateResource(resSymbols,rcBinary,0); F^.CreateResource(resSymbols,rcBinary,0);
OK:=F^.AddResourceEntryFromStream(resSymbols,langDefault,0,S^,S^.GetSize); OK:=F^.AddResourceEntryFromStream(resSymbols,langDefault,0,S^,S^.GetSize);
end;
Dispose(S, Done); Dispose(S, Done);
if OK=false then
ErrorBox('Error storing symbol information',nil);
PopStatus; PopStatus;
end; end;
WriteSymbols:=OK; WriteSymbols:=OK;
@ -394,30 +445,27 @@ var OK,VOK: boolean;
VM : TVideoMode; VM : TVideoMode;
begin begin
PushStatus('Reading desktop file...'); PushStatus('Reading desktop file...');
New(F, LoadFile(DesktopPath)); New(F, LoadFile(GetShortName(DesktopPath)));
OK:=Assigned(F); OK:=false;
if OK then if Assigned(F) then
begin begin
OK:=ReadFlags(F); OK:=ReadFlags(F);
if OK then
begin
VOK:=ReadVideoMode(F,VM); VOK:=ReadVideoMode(F,VM);
if VOK and ((VM.Col<>ScreenMode.Col) or if VOK and ((VM.Col<>ScreenMode.Col) or
(VM.Row<>ScreenMode.Row) or (VM.Color<>ScreenMode.Color)) then (VM.Row<>ScreenMode.Row) or (VM.Color<>ScreenMode.Color)) then
Application^.SetScreenVideoMode(VM); Application^.SetScreenVideoMode(VM);
end; if ((DesktopFileFlags and dfHistoryLists)<>0) then
if {OK and} ((DesktopFileFlags and dfHistoryLists)<>0) then
OK:=OK and ReadHistory(F); OK:=OK and ReadHistory(F);
if {OK and} ((DesktopFileFlags and dfWatches)<>0) then if ((DesktopFileFlags and dfWatches)<>0) then
OK:=OK and ReadWatches(F); OK:=OK and ReadWatches(F);
if {OK and} ((DesktopFileFlags and dfBreakpoints)<>0) then if ((DesktopFileFlags and dfBreakpoints)<>0) then
OK:=OK and ReadBreakpoints(F); OK:=OK and ReadBreakpoints(F);
if {OK and} ((DesktopFileFlags and dfOpenWindows)<>0) then if ((DesktopFileFlags and dfOpenWindows)<>0) then
OK:=OK and ReadOpenWindows(F); OK:=OK and ReadOpenWindows(F);
{ no errors if no browser info available PM } { no errors if no browser info available PM }
if {OK and} ((DesktopFileFlags and dfSymbolInformation)<>0) then if ((DesktopFileFlags and dfSymbolInformation)<>0) then
OK:=OK and ReadSymbols(F); OK:=OK and ReadSymbols(F);
Dispose(F, Done); Dispose(F, Done);
end; end;
@ -430,35 +478,35 @@ function SaveDesktop: boolean;
var OK: boolean; var OK: boolean;
F: PResourceFile; F: PResourceFile;
TempPath: string; TempPath: string;
ff: file;
begin begin
TempPath:=DirOf(DesktopPath)+DesktopTempName; TempPath:=DirOf(DesktopPath)+DesktopTempName;
PushStatus('Writing desktop file...'); PushStatus('Writing desktop file...');
New(F, CreateFile(TempPath)); New(F, CreateFile(GetShortName(TempPath)));
if Assigned(Clipboard) then if Assigned(Clipboard) then
if (DesktopFileFlags and dfClipboardContent)<>0 then if (DesktopFileFlags and dfClipboardContent)<>0 then
Clipboard^.Flags:=Clipboard^.Flags or efStoreContent Clipboard^.Flags:=Clipboard^.Flags or efStoreContent
else else
Clipboard^.Flags:=Clipboard^.Flags and not efStoreContent; Clipboard^.Flags:=Clipboard^.Flags and not efStoreContent;
OK:=false;
OK:=Assigned(F); if Assigned(F) then
{if OK then} begin
OK:=OK and WriteFlags(F); OK:=WriteFlags(F);
{if OK then}
OK:=OK and WriteVideoMode(F); OK:=OK and WriteVideoMode(F);
if {OK and} ((DesktopFileFlags and dfHistoryLists)<>0) then if ((DesktopFileFlags and dfHistoryLists)<>0) then
OK:=OK and WriteHistory(F); OK:=OK and WriteHistory(F);
if {OK and} ((DesktopFileFlags and dfWatches)<>0) then if ((DesktopFileFlags and dfWatches)<>0) then
OK:=OK and WriteWatches(F); OK:=OK and WriteWatches(F);
if {OK and} ((DesktopFileFlags and dfBreakpoints)<>0) then if ((DesktopFileFlags and dfBreakpoints)<>0) then
OK:=OK and WriteBreakpoints(F); OK:=OK and WriteBreakpoints(F);
if {OK and} ((DesktopFileFlags and dfOpenWindows)<>0) then if ((DesktopFileFlags and dfOpenWindows)<>0) then
OK:=OK and WriteOpenWindows(F); OK:=OK and WriteOpenWindows(F);
{ no errors if no browser info available PM } { no errors if no browser info available PM }
if {OK and} ((DesktopFileFlags and dfSymbolInformation)<>0) then if ((DesktopFileFlags and dfSymbolInformation)<>0) then
OK:=OK and (WriteSymbols(F) or not Assigned(Modules)); OK:=OK and (WriteSymbols(F) or not Assigned(Modules));
Dispose(F, Done); Dispose(F, Done);
end;
if OK then if OK then
begin begin
if ExistsFile(DesktopPath) then if ExistsFile(DesktopPath) then
@ -471,10 +519,46 @@ begin
SaveDesktop:=OK; SaveDesktop:=OK;
end; end;
function WriteSymbolsFile(const filename : string): boolean;
var OK: boolean;
F: PResourceFile;
begin
WriteSymbolsFile:=false;
If not assigned(Modules) then
exit;
New(F, CreateFile(GetShortName(FileName)));
OK:=Assigned(F);
if OK and ((DesktopFileFlags and dfSymbolInformation)<>0) then
OK:=OK and WriteSymbols(F);
if assigned(F) then
Dispose(F,Done);
WriteSymbolsFile:=OK;
end;
function ReadSymbolsFile(const FileName : string): boolean;
var OK: boolean;
F: PResourceFile;
begin
ReadSymbolsFile:=false;
{ Don't read again !! }
If assigned(Modules) then
exit;
New(F, LoadFile(GetShortName(FileName)));
OK:=Assigned(F);
if OK and ((DesktopFileFlags and dfSymbolInformation)<>0) then
OK:=OK and ReadSymbols(F);
if assigned(F) then
Dispose(F,Done);
ReadSymbolsFile:=OK;
end;
END. END.
{ {
$Log$ $Log$
Revision 1.18 2000-01-03 11:38:33 michael Revision 1.19 2000-01-25 00:26:36 pierre
+ Browser info saving
Revision 1.18 2000/01/03 11:38:33 michael
Changes from Gabor Changes from Gabor
Revision 1.17 1999/12/20 00:30:56 pierre Revision 1.17 1999/12/20 00:30:56 pierre