Новый патч перемещающий окна для файла fpcbuild-2.6.0/fpcsrc/ide/fpdesk.pas Теперь окна перемещаются только если их координаты не вписываются в заданный диапазон. Тестируй, если всё будет нормально, отпишись в багтрекер.
Код: Выделить всё
function ReadOpenWindows(F: PResourceFile): boolean;
var S: PMemoryStream;
OK: boolean;
DV: word;
WI: TWindowInfo;
Title: string;
XDataOfs: word;
XData: array[0..1024] of byte;
procedure GetData(var B; Size: word);
begin
Move(XData[XDataOfs],B,Size);
Inc(XDataOfs,Size);
end;
procedure ProcessWindowInfo;
var W: PWindow;
SW: PSourceWindow absolute W;
St: string;
Ch: char;
TP,TP2: TPoint;
L: longint;
ZZ: byte;
R,Z: TRect; //[[[[[[[[[[[[[[[[[[[[[[[[
begin
XDataOfs:=0;
Desktop^.Lock;
W:=SearchWindow(Title);
case WI.HelpCtx of
hcSourceWindow :
begin
GetData(St[0],1);
GetData(St[1],ord(St[0]));
W:=ITryToOpenFile(@WI.Bounds,St,0,0,false,false,true);
if Assigned(W)=false then
begin
ClearFormatParams;
AddFormatParamStr(St);
Desktop^.Unlock;
ErrorBox(msg_cantopenfile,@FormatParams);
Desktop^.Lock;
end
else
begin
GetData(L,sizeof(L));
If DeskUseSyntaxHighlight(SW^.Editor) Then
L:=L or efSyntaxHighlight
else
L:=L and not efSyntaxHighlight;
SW^.Editor^.SetFlags(L);
GetData(TP,sizeof(TP)); GetData(TP2,sizeof(TP2));
SW^.Editor^.SetSelection(TP,TP2);
GetData(TP,sizeof(TP)); SW^.Editor^.SetCurPtr(TP.X,TP.Y);
GetData(TP,sizeof(TP)); SW^.Editor^.ScrollTo(TP.X,TP.Y);
end;
end;
hcClipboardWindow:
W:=ClipboardWindow;
hcCalcWindow:
W:=CalcWindow;
hcMessagesWindow:
begin
if MessagesWindow=nil then
Desktop^.Insert(New(PMessagesWindow, Init));
W:=MessagesWindow;
end;
hcCompilerMessagesWindow:
W:=CompilerMessageWindow;
{$ifndef NODEBUG}
hcGDBWindow:
begin
InitGDBWindow;
W:=GDBWindow;
end;
hcDisassemblyWindow:
begin
InitDisassemblyWindow;
W:=DisassemblyWindow;
end;
hcWatchesWindow:
begin
if WatchesWindow=nil then
begin
New(WatchesWindow,Init);
Desktop^.Insert(WatchesWindow);
end;
W:=WatchesWindow;
end;
hcStackWindow:
begin
if StackWindow=nil then
begin
New(StackWindow,Init);
Desktop^.Insert(StackWindow);
end;
W:=StackWindow;
end;
hcFPURegisters:
begin
if FPUWindow=nil then
begin
New(FPUWindow,Init);
Desktop^.Insert(FPUWindow);
end;
W:=FPUWindow;
end;
hcVectorRegisters:
begin
if VectorWindow=nil then
begin
New(VectorWindow,Init);
Desktop^.Insert(VectorWindow);
end;
W:=VectorWindow;
end;
hcRegistersWindow:
begin
if RegistersWindow=nil then
begin
New(RegistersWindow,Init);
Desktop^.Insert(RegistersWindow);
end;
W:=RegistersWindow;
end;
hcBreakpointListWindow:
begin
if BreakpointsWindow=nil then
begin
New(BreakpointsWindow,Init);
Desktop^.Insert(BreakpointsWindow);
end;
W:=BreakpointsWindow;
end;
{$endif NODEBUG}
hcASCIITableWindow:
begin
if ASCIIChart=nil then
begin
New(ASCIIChart, Init);
Desktop^.Insert(ASCIIChart);
end;
W:=ASCIIChart;
if DV>=$A then
begin
GetData(ch,sizeof(char));
AsciiChart^.Report^.AsciiChar:=ord(ch);
AsciiChart^.Table^.SetCursor(
ord(ch) mod AsciiChart^.Table^.Size.X,
ord(ch) div AsciiChart^.Table^.Size.X);
end;
end;
end;
if W=nil then
begin
Desktop^.Unlock;
Exit;
end;
W^.GetBounds(R);
if (R.A.X<>WI.Bounds.A.X) or (R.A.Y<>WI.Bounds.A.Y) then
R.Move(WI.Bounds.A.X-R.A.X,WI.Bounds.A.Y-R.A.Y);
if (W^.Flags and wfGrow)<>0 then
begin
R.B.X:=R.A.X+(WI.Bounds.B.X-WI.Bounds.A.X);
R.B.Y:=R.A.Y+(WI.Bounds.B.Y-WI.Bounds.A.Y);
end;
W^.Locate(R);
if W^.GetState(sfVisible)<>WI.Visible then
if WI.Visible then
begin
W^.Show;
W^.MakeFirst;
end
else
W^.Hide;
//[[[[[[[[[[[[[[[[[[[[[v
ZZ:=0;
Desktop^.GetExtent(Z); //записывает координаты начала и конца (Z.A.X,Z.A.Y) и (Z.B.X,Z.B.Y) окна в переменную Z
if R.A.Y>Z.B.Y-7 then begin
R.A.Y:=Z.B.Y-7;
ZZ:=1;
end;
if R.A.X>Z.B.X-4 then begin
R.A.X:=Z.B.X-4;
ZZ:=1;
end;
if R.A.Y<0 then begin
R.A.Y:=0;
ZZ:=1;
end;
if R.A.X<0 then begin
R.A.X:=0;
ZZ:=1;
end;
IF ZZ<>0 then W^.MoveTo(R.A.X,R.A.Y); //[[[[[[[ перемещает окно
// W^.Hide; // делает окно скрытым
//[[[[[[[[[[[[[[[[[[[[[[^
W^.Number:=WI.WinNb;
Desktop^.Unlock;
end;
begin
PushStatus(msg_readingdesktopcontents);
New(S, Init(32*1024,4096));
OK:=F^.ReadResourceEntryToStream(resDesktop,langDefault,S^);
S^.Seek(0);
if OK then
begin
S^.Read(DV,SizeOf(DV));
OK:=(DV=DesktopVersion) or (DV>=MinDesktopVersion);
if OK=false then
ErrorBox(msg_invaliddesktopversionlayoutlost,nil);
end;
if OK then
begin
XDataOfs:=0;
repeat
S^.Read(WI,sizeof(WI));
if S^.Status=stOK then
begin
Title[0]:=chr(WI.TitleLen);
S^.Read(Title[1],WI.TitleLen);
if WI.ExtraDataSize>0 then
S^.Read(XData,WI.ExtraDataSize);
ProcessWindowInfo;
end;
until (S^.Status<>stOK) or (S^.GetPos=S^.GetSize);
(* 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^,GDBWindow);
GetSubViewPtr(S^,BreakpointsWindow);
GetSubViewPtr(S^,WatchesWindow);
GetSubViewPtr(S^,UserScreenWindow);
GetSubViewPtr(S^,ASCIIChart);
GetSubViewPtr(S^,MessagesWindow); LastToolMessageFocused:=nil;
end;
Application^.GetExtent(R);
Inc(R.A.Y);Dec(R.B.Y);
DeskTop^.Locate(R);
Application^.Insert(Desktop);
Desktop^.ReDraw;
Message(Application,evBroadcast,cmUpdate,nil);
end;*)
if OK=false then
ErrorBox(msg_errorloadingdesktop,nil);
end;
Dispose(S, Done);
PopStatus;
ReadOpenWindows:=OK;
end;
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;
procedure AddData(const B; Size: word);
begin
Move(B,XData[XDataOfs],Size);
Inc(XDataOfs,Size);
end;
begin
XDataOfs:=0;
W:=nil;
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
W:=PWindow(P);
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);
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;
ЗЫ: Чем больший вой по поводу недопустимого инакомыслия поднимают тролли, тем забористее код
Ты серьёзно веришь в то что говоришь? С "аргументами" Brainenjii самое место на лоре плюсовиков троллить - они могут быть не в курсе на чём их разводят + их знание нехило пожирает мозг.