mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-21 06:43:49 +02:00
gtk intf: improved listbox SetTopIndex for newly added items
git-svn-id: trunk@10344 -
This commit is contained in:
parent
0fc3bea335
commit
6da5267421
@ -3183,9 +3183,9 @@ var
|
|||||||
if (UnitName='libc')
|
if (UnitName='libc')
|
||||||
and (System.Pos(AppendPathDelim(FPCSrcDir)+'packages'+PathDelim,ADirPath)>0)
|
and (System.Pos(AppendPathDelim(FPCSrcDir)+'packages'+PathDelim,ADirPath)>0)
|
||||||
then begin
|
then begin
|
||||||
|
// <FPCSrcDir>/rtl/netwlibc/libc.pp
|
||||||
|
// <FPCSrcDir>/packages/base/libc/libc.pp
|
||||||
Priority:=2;
|
Priority:=2;
|
||||||
DebugLn(['BrowseDirectory OldFilename=',OldUnitLink.Filename,' Old.UsedMacroCount=',OldUnitLink.UsedMacroCount,' Old.MacroCount=',OldUnitLink.MacroCount,' Old.Priority=',OldUnitLink.Priority,
|
|
||||||
' New=',AFilename,' New.MacroCount=',MacroCount,' New.UsedMacroCount=',UsedMacroCount,' New.Priority=',Priority]);
|
|
||||||
end;
|
end;
|
||||||
if (UsedMacroCount>OldUnitLink.UsedMacroCount)
|
if (UsedMacroCount>OldUnitLink.UsedMacroCount)
|
||||||
or ((UsedMacroCount=OldUnitLink.UsedMacroCount)
|
or ((UsedMacroCount=OldUnitLink.UsedMacroCount)
|
||||||
|
@ -9354,6 +9354,7 @@ var MaxMessages: integer;
|
|||||||
NewFilename: String;
|
NewFilename: String;
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
|
|
||||||
MaxMessages:=MessagesView.VisibleItemCount;
|
MaxMessages:=MessagesView.VisibleItemCount;
|
||||||
if Index>=MaxMessages then exit;
|
if Index>=MaxMessages then exit;
|
||||||
if (Index<0) then begin
|
if (Index<0) then begin
|
||||||
|
@ -279,8 +279,9 @@ begin
|
|||||||
FLastSelectedIndex := -1;
|
FLastSelectedIndex := -1;
|
||||||
|
|
||||||
Caption := lisMenuViewMessages;
|
Caption := lisMenuViewMessages;
|
||||||
MessageListBox.Style := lbOwnerDrawFixed;
|
MessageListBox.Style := lbOwnerDrawFixed;
|
||||||
MessageListBox.OnDrawItem := @MessageViewDrawItem;
|
MessageListBox.OnDrawItem := @MessageViewDrawItem;
|
||||||
|
MessageListBox.ClickOnSelChange := false;
|
||||||
|
|
||||||
// assign the root TMenuItem to the registered menu root.
|
// assign the root TMenuItem to the registered menu root.
|
||||||
// This will automatically create all registered items
|
// This will automatically create all registered items
|
||||||
@ -397,6 +398,7 @@ begin
|
|||||||
FVisibleItems.Add(NewMsg);
|
FVisibleItems.Add(NewMsg);
|
||||||
FLastLineIsProgress := ProgressLine;
|
FLastLineIsProgress := ProgressLine;
|
||||||
MessageListBox.TopIndex := MessageListBox.Items.Count - 1;
|
MessageListBox.TopIndex := MessageListBox.Items.Count - 1;
|
||||||
|
//DebugLn(['TMessagesView.Add ',MessageListBox.TopIndex]);
|
||||||
end;
|
end;
|
||||||
//ConsistencyCheck;
|
//ConsistencyCheck;
|
||||||
end;
|
end;
|
||||||
@ -525,8 +527,10 @@ end;
|
|||||||
|
|
||||||
procedure TMessagesView.ShowTopMessage;
|
procedure TMessagesView.ShowTopMessage;
|
||||||
begin
|
begin
|
||||||
if MessageListBox.Items.Count > 0 then
|
if MessageListBox.Items.Count > 0 then begin
|
||||||
MessageListBox.TopIndex := 0;
|
MessageListBox.TopIndex := 0;
|
||||||
|
//DebugLn(['TMessagesView.ShowTopMessage ']);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMessagesView.MsgCount: integer;
|
function TMessagesView.MsgCount: integer;
|
||||||
|
@ -568,7 +568,6 @@ var
|
|||||||
ListItemWidget: PGtkWidget;
|
ListItemWidget: PGtkWidget;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
DebugLn(['TGtkWSCustomListBox.SetTopIndex ',DbgSName(ACustomListBox),' NewTopIndex=',NewTopIndex,' ',GetWidgetDebugReport(PGtkWidget(ACustomListBox.Handle))]);
|
|
||||||
AWidget:=PGtkWidget(ACustomListBox.Handle);
|
AWidget:=PGtkWidget(ACustomListBox.Handle);
|
||||||
ListWidget:=PGtkList(GetWidgetInfo(AWidget, True)^.CoreWidget);
|
ListWidget:=PGtkList(GetWidgetInfo(AWidget, True)^.CoreWidget);
|
||||||
ScrolledWindow:=PGtkScrolledWindow(AWidget);
|
ScrolledWindow:=PGtkScrolledWindow(AWidget);
|
||||||
@ -597,6 +596,7 @@ var
|
|||||||
GListItem: PGList;
|
GListItem: PGList;
|
||||||
ListItemWidget: PGtkWidget;
|
ListItemWidget: PGtkWidget;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
requisition: TGtkRequisition;
|
||||||
begin
|
begin
|
||||||
//if CompareText(ACustomListBox.Name,'LBProperties')=0 then
|
//if CompareText(ACustomListBox.Name,'LBProperties')=0 then
|
||||||
// debugln('TGtkWSCustomListBox.SetTopIndex ',DbgSName(ACustomListBox));
|
// debugln('TGtkWSCustomListBox.SetTopIndex ',DbgSName(ACustomListBox));
|
||||||
@ -609,13 +609,16 @@ begin
|
|||||||
while GListItem<>nil do begin
|
while GListItem<>nil do begin
|
||||||
ListItemWidget:=PGtkWidget(GListItem^.data);
|
ListItemWidget:=PGtkWidget(GListItem^.data);
|
||||||
if i>=NewTopIndex then break;
|
if i>=NewTopIndex then break;
|
||||||
inc(AdjValue,ListItemWidget^.Allocation.Height);
|
gtk_widget_size_request(ListItemWidget,@requisition);
|
||||||
|
inc(AdjValue,requisition.height);
|
||||||
|
//DebugLn(['TGtkWSCustomListBox.SetTopIndex ',i,' AdjValue=',AdjValue,' Flags=',WidgetFlagsToString(ListItemWidget)]);
|
||||||
inc(i);
|
inc(i);
|
||||||
GListItem:=GListItem^.next;
|
GListItem:=GListItem^.next;
|
||||||
end;
|
end;
|
||||||
VertAdj:=gtk_scrolled_window_get_vadjustment(ScrolledWindow);
|
VertAdj:=gtk_scrolled_window_get_vadjustment(ScrolledWindow);
|
||||||
MaxAdjValue:=RoundToInt(VertAdj^.upper-VertAdj^.page_size);
|
MaxAdjValue:=RoundToInt(VertAdj^.upper);
|
||||||
if AdjValue>MaxAdjValue then AdjValue:=MaxAdjValue;
|
if AdjValue>MaxAdjValue then AdjValue:=MaxAdjValue;
|
||||||
|
//DebugLn(['TGtkWSCustomListBox.SetTopIndex AdjValue=',AdjValue,' VertAdj^.upper=',VertAdj^.upper,' VertAdj^.page_size=',VertAdj^.page_size]);
|
||||||
gtk_adjustment_set_value(VertAdj,AdjValue);
|
gtk_adjustment_set_value(VertAdj,AdjValue);
|
||||||
end;
|
end;
|
||||||
{$EndIf}
|
{$EndIf}
|
||||||
|
Loading…
Reference in New Issue
Block a user