mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 20:59:06 +02:00
IDE, component palette options: Fix ordering comps inside one page. Less debug messages.
git-svn-id: trunk@46984 -
This commit is contained in:
parent
f9c7b414be
commit
9fd513f3c2
@ -362,8 +362,7 @@ var
|
|||||||
procedure DoInsideListBox;
|
procedure DoInsideListBox;
|
||||||
begin
|
begin
|
||||||
Assert(Source = Sender, 'TCompPaletteOptionsFrame.PagesListBoxDragDrop: Source and Sender ListBoxes differ.');
|
Assert(Source = Sender, 'TCompPaletteOptionsFrame.PagesListBoxDragDrop: Source and Sender ListBoxes differ.');
|
||||||
DebugLn(['TCompPaletteOptionsFrame.PagesListBoxDragDrop: DestInd=', DestInd,
|
//DebugLn(['TCompPaletteOptionsFrame.PagesListBoxDragDrop: DestInd=',DestInd,', ItemIndex=',lb.ItemIndex]);
|
||||||
', ItemIndex=', lb.ItemIndex]);
|
|
||||||
if lb.ItemIndex < DestInd then
|
if lb.ItemIndex < DestInd then
|
||||||
Dec(DestInd);
|
Dec(DestInd);
|
||||||
if (lb.ItemIndex > 0) and (lb.ItemIndex <> DestInd) then
|
if (lb.ItemIndex > 0) and (lb.ItemIndex <> DestInd) then
|
||||||
@ -416,8 +415,8 @@ var
|
|||||||
// Delete the original item from ListView
|
// Delete the original item from ListView
|
||||||
aSrcView.Items.Delete(OrigInd);
|
aSrcView.Items.Delete(OrigInd);
|
||||||
end;
|
end;
|
||||||
DebugLn(['TCompPaletteOptionsFrame.PagesListBoxDragDrop: CompName=',
|
//DebugLn(['TCompPaletteOptionsFrame.PagesListBoxDragDrop: CompName=',
|
||||||
CompName, ', SrcPage=', SrcPage, ', DestPage=', DestPage]);
|
// CompName, ', SrcPage=', SrcPage, ', DestPage=', DestPage]);
|
||||||
end;
|
end;
|
||||||
inc(OrigInd);
|
inc(OrigInd);
|
||||||
end;
|
end;
|
||||||
@ -456,25 +455,31 @@ end;
|
|||||||
procedure TCompPaletteOptionsFrame.ComponentsListViewDragDrop(Sender, Source: TObject; X, Y: Integer);
|
procedure TCompPaletteOptionsFrame.ComponentsListViewDragDrop(Sender, Source: TObject; X, Y: Integer);
|
||||||
var
|
var
|
||||||
lv: TListView;
|
lv: TListView;
|
||||||
DestInd: Integer;
|
SrcInd, DstInd: Integer;
|
||||||
SrcItem, DstItem: TListItem;
|
SrcItem, DstItem: TListItem;
|
||||||
|
Comps: TStringList;
|
||||||
begin
|
begin
|
||||||
lv := Sender as TListView;
|
lv := Sender as TListView;
|
||||||
DstItem := lv.GetItemAt(X, Y);
|
DstItem := lv.GetItemAt(X, Y);
|
||||||
SrcItem := lv.Selected;
|
SrcItem := lv.Selected;
|
||||||
if (DstItem = nil) or (SrcItem = nil) then exit;
|
if (DstItem = nil) or (SrcItem = nil) then exit;
|
||||||
DestInd := DstItem.Index;
|
DstInd := DstItem.Index;
|
||||||
|
SrcInd := SrcItem.Index;
|
||||||
Assert(Source = Sender, 'TCompPaletteOptionsFrame.ComponentsListViewDragDrop: Source and Sender ListViews differ.');
|
Assert(Source = Sender, 'TCompPaletteOptionsFrame.ComponentsListViewDragDrop: Source and Sender ListViews differ.');
|
||||||
DebugLn(['TCompPaletteOptionsFrame.ComponentsListViewDragDrop: DestInd=', DestInd,
|
//DebugLn(['TCompPaletteOptionsFrame.ComponentsListViewDragDrop: DestInd=',DstInd,', ItemIndex=',SrcInd]);
|
||||||
', ItemIndex=', SrcItem.Index]);
|
if SrcInd < DstInd then
|
||||||
if SrcItem.Index < DestInd then
|
Dec(DstInd);
|
||||||
Dec(DestInd);
|
if (SrcInd > -1) and (DstInd > -1) and (SrcInd <> DstInd) then
|
||||||
if (SrcItem.Index > -1) and (DestInd > -1) and (SrcItem.Index <> DestInd) then
|
|
||||||
begin
|
begin
|
||||||
|
// Move component names in ListView.
|
||||||
lv.Selected := Nil;
|
lv.Selected := Nil;
|
||||||
lv.Items.Move(SrcItem.Index, DestInd);
|
lv.Items.Move(SrcInd, DstInd);
|
||||||
lv.Selected := lv.Items[DestInd];
|
lv.Selected := lv.Items[DstInd];
|
||||||
UpdateCompMoveButtons(DestInd);
|
// Move component names inside a StringList, too.
|
||||||
|
Comps := PagesListBox.Items.Objects[PagesListBox.ItemIndex] as TStringList;
|
||||||
|
Comps.Move(SrcInd, DstInd);
|
||||||
|
//
|
||||||
|
UpdateCompMoveButtons(DstInd);
|
||||||
fConfigChanged := True;
|
fConfigChanged := True;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -495,7 +500,7 @@ end;
|
|||||||
|
|
||||||
procedure TCompPaletteOptionsFrame.ComponentsListViewClick(Sender: TObject);
|
procedure TCompPaletteOptionsFrame.ComponentsListViewClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
DebugLn(['TCompPaletteOptionsFrame.ComponentsListViewClick: ']);
|
//DebugLn(['TCompPaletteOptionsFrame.ComponentsListViewClick: ']);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCompPaletteOptionsFrame.ComponentsListViewItemChecked(Sender: TObject; Item: TListItem);
|
procedure TCompPaletteOptionsFrame.ComponentsListViewItemChecked(Sender: TObject; Item: TListItem);
|
||||||
@ -621,7 +626,7 @@ end;
|
|||||||
|
|
||||||
procedure TCompPaletteOptionsFrame.UpdatePageMoveButtons(ListIndex: integer);
|
procedure TCompPaletteOptionsFrame.UpdatePageMoveButtons(ListIndex: integer);
|
||||||
begin
|
begin
|
||||||
DebugLn(['TCompPaletteOptionsFrame.UpdatePageMoveButtons: Page index=', ListIndex]);
|
//DebugLn(['TCompPaletteOptionsFrame.UpdatePageMoveButtons: Page index=', ListIndex]);
|
||||||
if (ListIndex > 0) and (ListIndex < PagesListBox.Items.Count) then
|
if (ListIndex > 0) and (ListIndex < PagesListBox.Items.Count) then
|
||||||
begin
|
begin
|
||||||
PageMoveUpBtn.Enabled := ListIndex > 1;
|
PageMoveUpBtn.Enabled := ListIndex > 1;
|
||||||
@ -635,7 +640,7 @@ end;
|
|||||||
|
|
||||||
procedure TCompPaletteOptionsFrame.UpdateCompMoveButtons(ListIndex: integer);
|
procedure TCompPaletteOptionsFrame.UpdateCompMoveButtons(ListIndex: integer);
|
||||||
begin
|
begin
|
||||||
DebugLn(['TCompPaletteOptionsFrame.UpdateCompMoveButtons: Component index=', ListIndex]);
|
//DebugLn(['TCompPaletteOptionsFrame.UpdateCompMoveButtons: Component index=', ListIndex]);
|
||||||
if (ListIndex > -1) and (ListIndex < ComponentsListView.Items.Count)
|
if (ListIndex > -1) and (ListIndex < ComponentsListView.Items.Count)
|
||||||
and (PagesListBox.ItemIndex > 0) then // No moving when <All> components is selected.
|
and (PagesListBox.ItemIndex > 0) then // No moving when <All> components is selected.
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user