MG: added Move Page Left/Right for sourcenotebook

git-svn-id: trunk@3370 -
This commit is contained in:
lazarus 2002-09-20 11:40:07 +00:00
parent 652ff7ba3f
commit 23fac992bf
2 changed files with 72 additions and 12 deletions

View File

@ -56,15 +56,17 @@ const
ecNextEditor = ecUserFirst + 7;
ecPrevEditor = ecUserFirst + 8;
ecMoveEditorLeft = ecUserFirst + 9;
ecMoveEditorRight = ecUserFirst + 10;
ecPeriod = ecUserFirst + 10;
ecPeriod = ecUserFirst + 11;
ecFindPrevious = ecUserFirst + 11;
ecFindInFiles = ecUserFirst + 12;
ecJumpBack = ecUserFirst + 13;
ecJumpForward = ecUserFirst + 14;
ecAddJumpPoint = ecUserFirst + 15;
ecViewJumpHistory = ecUserFirst + 16;
ecFindPrevious = ecUserFirst + 12;
ecFindInFiles = ecUserFirst + 13;
ecJumpBack = ecUserFirst + 14;
ecJumpForward = ecUserFirst + 15;
ecAddJumpPoint = ecUserFirst + 16;
ecViewJumpHistory = ecUserFirst + 17;
ecFindDeclaration = ecUserFirst + 20;
ecFindBlockOtherEnd = ecUserFirst + 21;
@ -497,6 +499,8 @@ begin
ecJumpToEditor: Result:='jump to editor';
ecNextEditor: Result:= 'next editor';
ecPrevEditor: Result:= 'previous editor';
ecMoveEditorLeft: Result:= 'move editor left';
ecMoveEditorRight: Result:= 'move editor right';
ecGotoEditor1: Result:='goto editor 1';
ecGotoEditor2: Result:='goto editor 2';
ecGotoEditor3: Result:='goto editor 3';
@ -1361,7 +1365,9 @@ begin
Add(C,'Go to source editor 8',ecGotoEditor0,VK_8,[ssAlt],VK_UNKNOWN,[]);
Add(C,'Go to source editor 9',ecGotoEditor0,VK_9,[ssAlt],VK_UNKNOWN,[]);
Add(C,'Go to source editor 10',ecGotoEditor0,VK_0,[ssAlt],VK_UNKNOWN,[]);
Add(C,'Move editor left',ecMoveEditorLeft, VK_UNKNOWN, [], VK_UNKNOWN, []);
Add(C,'Move editor right',ecMoveEditorLeft, VK_UNKNOWN, [], VK_UNKNOWN, []);
// file menu
C:=Categories[AddCategory('FileMenu','File menu commands',caAll)];
Add(C,'New',ecNew,VK_UNKNOWN,[],VK_UNKNOWN,[]);

View File

@ -278,6 +278,7 @@ type
procedure CloseEditorIndex(EditorIndex:integer);
procedure InsertEditorIndex(EditorIndex:integer);
procedure MoveEditorIndex(OldEditorIndex, NewEditorIndex: integer);
procedure AddToOrRemoveFromEditorWithIndexList(AnUnitInfo: TUnitInfo);
procedure AddToOrRemoveFromFormList(AnUnitInfo: TUnitInfo);
procedure AddToOrRemoveFromLoadedList(AnUnitInfo: TUnitInfo);
@ -1568,19 +1569,69 @@ begin
end;
procedure TProject.InsertEditorIndex(EditorIndex:integer);
function MoveIndex(OldIndex: integer): integer;
begin
Result:=OldIndex;
if OldIndex>=EditorIndex then
inc(Result);
end;
var i:integer;
AnUnitInfo: TUnitInfo;
begin
// move all editor index of units:
AnUnitInfo:=fFirstUnitWithEditorIndex;
while AnUnitInfo<>nil do begin
if AnUnitInfo.EditorIndex>=EditorIndex then
AnUnitInfo.EditorIndex:=AnUnitInfo.EditorIndex+1;
AnUnitInfo.EditorIndex:=MoveIndex(AnUnitInfo.EditorIndex);
AnUnitInfo:=AnUnitInfo.fNextUnitWithEditorIndex;
end;
// move bookmarks
i:=Bookmarks.Count-1;
while (i>=0) do begin
if (Bookmarks[i].EditorIndex>=EditorIndex) then
Bookmarks[i].EditorIndex:=Bookmarks[i].EditorIndex+1;
Bookmarks[i].EditorIndex:=MoveIndex(Bookmarks[i].EditorIndex);
dec(i);
end;
Modified:=true;
end;
procedure TProject.MoveEditorIndex(OldEditorIndex, NewEditorIndex: integer);
function MoveIndex(OldIndex: integer): integer;
begin
Result:=OldIndex;
if OldIndex=OldEditorIndex then
// this is the moving index
Result:=NewEditorIndex
else if OldIndex>OldEditorIndex then begin
// right of OldPageIndex ...
if OldIndex<=NewEditorIndex then
// .. and left of NewEditorIndex
// -> move left
Dec(Result);
end else begin
// left of OldPageIndex ...
if OldIndex>=NewEditorIndex then
// .. and right of NewEditorIndex
// -> move right
Inc(Result);
end;
end;
var i:integer;
AnUnitInfo: TUnitInfo;
begin
if OldEditorIndex=NewEditorIndex then exit;
// move all editor index of units:
AnUnitInfo:=fFirstUnitWithEditorIndex;
while AnUnitInfo<>nil do begin
AnUnitInfo.EditorIndex:=MoveIndex(AnUnitInfo.EditorIndex);
AnUnitInfo:=AnUnitInfo.fNextUnitWithEditorIndex;
end;
// move bookmarks
i:=Bookmarks.Count-1;
while (i>=0) do begin
Bookmarks[i].EditorIndex:=MoveIndex(Bookmarks[i].EditorIndex);
dec(i);
end;
Modified:=true;
@ -1929,6 +1980,9 @@ end.
{
$Log$
Revision 1.76 2002/09/20 11:40:07 lazarus
MG: added Move Page Left/Right for sourcenotebook
Revision 1.75 2002/09/13 16:58:26 lazarus
MG: removed the 1x1 bitmap from TBitBtn