From a850d00d273b146df7ef5ca973498bb8b08d3a20 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Sun, 21 Feb 2016 21:52:00 +0100 Subject: [PATCH] made page hisotry compatible with move page left/right --- src/ce_controls.pas | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/ce_controls.pas b/src/ce_controls.pas index 4296faa6..cf33c4ea 100644 --- a/src/ce_controls.pas +++ b/src/ce_controls.pas @@ -450,26 +450,52 @@ begin end; procedure TCEPageControl.movePageRight; +var + i: integer; begin if fPageIndex = fPages.Count-1 then exit; fPages.Exchange(fPageIndex, fPageIndex + 1); fTabs.Tabs.Exchange(fPageIndex, fPageIndex + 1); + + {$PUSH}{$HINTS OFF}{$WARNINGS OFF} + for i := 0 to fPagesHistory.Count-1 do + begin + if PtrInt(fPagesHistory[i]) = fPageIndex then + fPagesHistory[i] := Pointer(PtrInt(fPageIndex+1)) + else if PtrInt(fPagesHistory[i]) = fPageIndex+1 then + fPagesHistory[i] := Pointer(PtrInt(fPageIndex)) + end; + {$POP} + if fPageIndex = fSplittedPageIndex then fSplittedPageIndex += 1; setPageIndex(fPageIndex+1); end; procedure TCEPageControl.movePageLeft; +var + i: integer; begin if fPageIndex <= 0 then exit; fPages.Exchange(fPageIndex, fPageIndex - 1); fTabs.Tabs.Exchange(fPageIndex, fPageIndex - 1); + + {$PUSH}{$HINTS OFF}{$WARNINGS OFF} + for i := 0 to fPagesHistory.Count-1 do + begin + if PtrInt(fPagesHistory[i]) = fPageIndex then + fPagesHistory[i] := Pointer(PtrInt(fPageIndex-1)) + else if PtrInt(fPagesHistory[i]) = fPageIndex-1 then + fPagesHistory[i] := Pointer(PtrInt(fPageIndex)) + end; + {$POP} + if fPageIndex = fSplittedPageIndex then - fSplittedPageIndex -= 1; + fSplittedPageIndex -= 1; setPageIndex(fPageIndex-1); end;