Теперь что касается бага c fp.dsk, есть два наиболее приемлемых подхода к его исправлению: заменять координаты окна при сохранении и при чтении. Первый подход реализуется проще. Правим файл fpcbuild-2.6.0/fpcsrc/ide/fpdesk.pas
- Код: Выделить всё
function WriteOpenWindows(F: PResourceFile): boolean;
var S: PMemoryStream;
procedure CollectInfo(P: PView);
var W: PWindow;
SW: PSourceWindow absolute W;
WI: TWindowInfo;
Title: string;
XDataOfs: word;
XData: array[0..1024] of byte;
St: string;
Ch: char;
TP: TPoint;
L: longint;
XY, XY2: Sw_Integer;//[[[[[[[[[[[[[[[[[[[[[[ патчи
procedure AddData(const B; Size: word);
begin
Move(B,XData[XDataOfs],Size);
Inc(XDataOfs,Size);
end;
begin
XDataOfs:=0;
W:=nil;
XY:=0; //[[[[[[[[[[[[[[
XY2:=2; //[[[[[[[[[[[[[[
if (P^.HelpCtx=hcSourceWindow) or
(P^.HelpCtx=hcHelpWindow) or
(P^.HelpCtx=hcClipboardWindow) or
(P^.HelpCtx=hcCalcWindow) or
(P^.HelpCtx=hcInfoWindow) or
(P^.HelpCtx=hcBrowserWindow) or
(P^.HelpCtx=hcMessagesWindow) or
(P^.HelpCtx=hcCompilerMessagesWindow) or
(P^.HelpCtx=hcGDBWindow) or
(P^.HelpCtx=hcDisassemblyWindow) or
(P^.HelpCtx=hcStackWindow) or
(P^.HelpCtx=hcRegistersWindow) or
(P^.HelpCtx=hcFPURegisters) or
(P^.HelpCtx=hcVectorRegisters) or
(P^.HelpCtx=hcWatchesWindow) or
(P^.HelpCtx=hcBreakpointListWindow) or
(P^.HelpCtx=hcASCIITableWindow)
then begin //[[[[[[[[[[[[[
if (P^.HelpCtx=hcSourceWindow) then P^.MoveTo(XY,XY)
else P^.MoveTo(XY2,XY2);
W:=PWindow(P);
end; //[[[[[[[[[[[[[[
if Assigned(W) and (P^.HelpCtx=hcSourceWindow) then
if SW^.Editor^.FileName='' then
W:=nil;
if W=nil then Exit;
FillChar(WI,sizeof(WI),0);
Title:=W^.GetTitle(255);
WI.HelpCtx:=W^.HelpCtx;
W^.GetBounds(WI.Bounds);
WI.Visible:=W^.GetState(sfVisible);
WI.WinNb:=W^.Number;
case WI.HelpCtx of
hcSourceWindow :
begin
St:=SW^.Editor^.FileName; AddData(St,length(St)+1);
L:=SW^.Editor^.GetFlags; AddData(L,sizeof(L));
TP:=SW^.Editor^.SelStart; AddData(TP,sizeof(TP));
TP:=SW^.Editor^.SelEnd; AddData(TP,sizeof(TP));
TP:=SW^.Editor^.CurPos; AddData(TP,sizeof(TP));
TP:=SW^.Editor^.Delta; AddData(TP,sizeof(TP));
end;
hcAsciiTableWindow :
begin
ch:=chr(PFPAsciiChart(P)^.Report^.AsciiChar);
AddData(ch,sizeof(char));
end;
end;
WI.TitleLen:=length(Title);
WI.ExtraDataSize:=XDataOfs;
S^.Write(WI,sizeof(WI));
S^.Write(Title[1],WI.TitleLen);
if WI.ExtraDataSize>0 then
S^.Write(XData,WI.ExtraDataSize);
P^.MoveTo(XY,XY);//[[[[[[[[[[[[[[[[
end;
var W: word;
OK: boolean;
PV: PView;
begin
PushStatus(msg_storingdesktopcontents);
New(S, Init(30*1024,4096));
OK:=Assigned(S);
if OK then
begin
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^,GDBWindow);
PutSubViewPtr(S^,BreakpointsWindow);
PutSubViewPtr(S^,WatchesWindow);
PutSubViewPtr(S^,UserScreenWindow);
PutSubViewPtr(S^,ASCIIChart);
PutSubViewPtr(S^,MessagesWindow);
end;}
{ PV:=Application^.Last;
while PV<>nil do
begin
CollectInfo(PV);
PV:=PV^.PrevView;
end;}
PV:=Desktop^.Last;
while PV<>nil do
begin
CollectInfo(PV);
PV:=PV^.PrevView;
end;
OK:=(S^.Status=stOK);
if OK then
begin
S^.Seek(0);
OK:=F^.CreateResource(resDesktop,rcBinary,0);
OK:=OK and F^.AddResourceEntryFromStream(resDesktop,langDefault,0,S^,S^.GetSize);
end;
Dispose(S, Done);
end;
if OK=false then
ErrorBox(msg_errorstoringdesktop,nil);
PopStatus;
WriteOpenWindows:=OK;
end;