mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 21:16:32 +02:00
Merged revision(s) 64165 #7d90e95e0b, 64167-64168 #51302252eb-#51302252eb, 64195 #aa8f480e17, 64199 #473e65ba01, 64211 #1c9c36d205, 64267 #5197500844 from trunk:
LCL: Propogate TAction.ImageIndex to TSpeedButton.ImageIndex. Issue #38135, patch from Anton Kavalenka. ........ LCL-GTK2: Paint a form with one color also after scrolling. Issue #16183, patch from Joeny Ang. ........ LCL/CheckGroup: Fix items and checkboxes getting out of sync upon Items.Insert. Issue #38157. ........ LCL/Grids: Fix grids truncating cell height during editing if TitleFont.Size is smaller than Font.Size. Issue #38203). ........ IDE: Prevent an infinite loop when comparing files. Issue #38185, patch from Domingo Galmés. ........ LCL/FileListbox: Update selected filename when ItemIndex is set ........ LCL: Fix selected items of TComboBoxEx and TCheckComboBox not being painted with color clHighlightText. ........ git-svn-id: branches/fixes_2_0@64612 -
This commit is contained in:
parent
561d01f2e6
commit
2c03a634c5
@ -616,6 +616,8 @@ begin
|
||||
// chomp empty lines at end
|
||||
fPart1.GetPrevLineExtends(Cur1);
|
||||
fPart2.GetPrevLineExtends(Cur2);
|
||||
if (Cur1.LineNumber < 1) or (Cur2.LineNumber < 1) then
|
||||
break;
|
||||
until not LinesAreEqual(Cur1,Cur2);
|
||||
end;
|
||||
end;
|
||||
|
@ -289,9 +289,11 @@ type
|
||||
procedure AssignClient(AClient: TObject); override;
|
||||
procedure SetGroupIndex(Value: Integer); override;
|
||||
procedure SetChecked(Value: Boolean); override;
|
||||
procedure SetImageIndex(Value: Integer); override;
|
||||
public
|
||||
function IsCheckedLinked: Boolean; override;
|
||||
function IsGroupIndexLinked: Boolean; override;
|
||||
function IsImageIndexLinked: Boolean; override;
|
||||
end;
|
||||
|
||||
{ TCustomSpeedButton }
|
||||
|
@ -62,6 +62,7 @@ Type
|
||||
procedure Loaded; override;
|
||||
function IndexOfFile(const AFilename: string): integer;
|
||||
procedure KeyUp(var Key: Word; Shift: TShiftState); override;
|
||||
procedure SetItemIndex(AIndex: Integer); override;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
@ -420,6 +421,12 @@ begin
|
||||
UpdateFileList;
|
||||
end;
|
||||
|
||||
procedure TCustomFileListbox.SetItemIndex(AIndex: Integer);
|
||||
begin
|
||||
inherited;
|
||||
UpdateSelectedFileName;
|
||||
end;
|
||||
|
||||
procedure TCustomFileListBox.SetFileName(const AValue: String);
|
||||
var
|
||||
i: Integer;
|
||||
|
@ -8433,6 +8433,9 @@ begin
|
||||
// high control coords (like GTK2)
|
||||
CellR := Bounds(-FEditor.Width-100, -FEditor.Height-100, CellR.Right-CellR.Left, CellR.Bottom-CellR.Top);
|
||||
|
||||
// Make sure to use the grid font, not that of the title (issue #38203).
|
||||
Canvas.Font.Assign(Font);
|
||||
|
||||
if FEditorOptions and EO_AUTOSIZE = EO_AUTOSIZE then begin
|
||||
if (FEditor = FStringEditor) and (EditorBorderStyle = bsNone) then
|
||||
CellR := TWSCustomGridClass(WidgetSetClass).
|
||||
|
@ -422,7 +422,7 @@ begin { do not call inherited ! }
|
||||
end;
|
||||
anyRect.Top:=(ARect.Top+ARect.Bottom-FTextHeight) div 2;
|
||||
anyRect.Bottom:=anyRect.Top+FTextHeight;
|
||||
ThemeServices.DrawText(Canvas, aDetail, ItemsEx[Index].Caption, anyRect, aFlags, 0);
|
||||
DrawText(Canvas.Handle, PChar(ItemsEx[Index].Caption), Length(ItemsEx[Index].Caption), anyRect, aFlags);
|
||||
end;
|
||||
|
||||
procedure TCustomComboBoxEx.FontChanged(Sender: TObject);
|
||||
@ -684,7 +684,7 @@ begin { do not call inherited ! }
|
||||
end;
|
||||
anyRect.Top:=(ARect.Top+ARect.Bottom-FTextHeight) div 2;
|
||||
anyRect.Bottom:=anyRect.Top+FTextHeight;
|
||||
ThemeServices.DrawText(Canvas, aDetail, Items[Index], anyRect, aFlags, 0);
|
||||
DrawText(Canvas.Handle, PChar(Items[Index]), Length(Items[Index]), anyRect, aFlags);
|
||||
end;
|
||||
|
||||
procedure TCustomCheckCombo.DropDown;
|
||||
|
@ -23,6 +23,7 @@ type
|
||||
procedure SaveCheckStates(out AStates: TByteDynArray);
|
||||
protected
|
||||
procedure Changed; override;
|
||||
procedure InsertItem(Index: Integer; const S: string; O: TObject); override;
|
||||
public
|
||||
constructor Create(TheCheckGroup: TCustomCheckGroup);
|
||||
procedure Delete(AIndex: Integer); override;
|
||||
@ -61,6 +62,24 @@ begin
|
||||
RestoreCheckStates(b);
|
||||
end;
|
||||
|
||||
procedure TCheckGroupStringList.InsertItem(Index: Integer; const S: string; O: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
b: TByteDynArray;
|
||||
begin
|
||||
if csLoading in FCheckGroup.ComponentState then
|
||||
inherited
|
||||
else begin
|
||||
SaveCheckStates(b);
|
||||
inherited;
|
||||
SetLength(b, Length(b)+1);
|
||||
for i := High(b) downto Index+1 do
|
||||
b[i] := b[i-1];
|
||||
b[Index] := 2; // default for new item: unchecked, enabled
|
||||
RestoreCheckStates(b);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCheckGroupStringList.RestoreCheckStates(const AStates: TByteDynArray);
|
||||
var
|
||||
i: Integer;
|
||||
|
@ -1226,6 +1226,12 @@ begin
|
||||
(SpeedButton.GroupIndex = (Action as TCustomAction).GroupIndex);
|
||||
end;
|
||||
|
||||
function TSpeedButtonActionLink.IsImageIndexLinked: Boolean;
|
||||
begin
|
||||
Result := inherited IsImageIndexLinked and
|
||||
(TSpeedButton(FClient).ImageIndex = (Action as TCustomAction).ImageIndex);
|
||||
end;
|
||||
|
||||
procedure TSpeedButtonActionLink.SetGroupIndex(Value: Integer);
|
||||
begin
|
||||
if IsGroupIndexLinked then TCustomSpeedButton(FClient).GroupIndex := Value;
|
||||
@ -1236,6 +1242,12 @@ begin
|
||||
if IsCheckedLinked then TCustomSpeedButton(FClient).Down := Value;
|
||||
end;
|
||||
|
||||
procedure TSpeedButtonActionLink.SetImageIndex(Value: Integer);
|
||||
begin
|
||||
if IsImageIndexLinked then
|
||||
TSpeedButton(FClient).ImageIndex := Value;
|
||||
end;
|
||||
|
||||
|
||||
{$IFDEF ASSERT_IS_ON}
|
||||
{$UNDEF ASSERT_IS_ON}
|
||||
|
@ -7603,7 +7603,7 @@ function CreateFormContents(AForm: TCustomForm;
|
||||
var FormWidget: Pointer; AWidgetInfo: PWidgetInfo = nil): Pointer;
|
||||
var
|
||||
ScrolledWidget, ClientAreaWidget: PGtkWidget;
|
||||
WindowStyle: PGtkStyle;
|
||||
// WindowStyle: PGtkStyle;
|
||||
Adjustment: PGtkAdjustment;
|
||||
begin
|
||||
// Create the VBox. We need that to place controls outside
|
||||
@ -7620,8 +7620,10 @@ begin
|
||||
gtk_widget_show(ScrolledWidget);
|
||||
|
||||
ClientAreaWidget := gtk_layout_new(nil, nil);
|
||||
WindowStyle := GetStyle(lgsWindow);
|
||||
gtk_widget_set_style(ClientAreaWidget, WindowStyle);
|
||||
// issue #16183: not sure why the GtkLayout is given a GtkWindow style here,
|
||||
// this prevents setting color to the GtkLayout
|
||||
// WindowStyle := GetStyle(lgsWindow);
|
||||
// gtk_widget_set_style(ClientAreaWidget, WindowStyle);
|
||||
//debugln('CreateFormContents Style=',GetStyleDebugReport(WindowStyle));
|
||||
gtk_container_add(PGtkContainer(ScrolledWidget), ClientAreaWidget);
|
||||
|
||||
|
@ -2283,7 +2283,10 @@ begin
|
||||
|
||||
if ChangeBGColor then
|
||||
begin
|
||||
if (BGColor = clDefault) or (BGColor = clBtnFace) then
|
||||
// setting bg color to nil will cancel previous calls to gtk_widget_modify_bg()
|
||||
// cannot use nil on a GtkLayout (issue #16183)
|
||||
if not GTK_IS_LAYOUT(AWidget) and
|
||||
((BGColor = clDefault) or (BGColor = clBtnFace)) then
|
||||
NewColor := nil
|
||||
else
|
||||
begin
|
||||
|
@ -857,8 +857,27 @@ begin
|
||||
end;
|
||||
|
||||
class procedure TGtk2WSCustomForm.SetColor(const AWinControl: TWinControl);
|
||||
var
|
||||
AScrolled: PGtkWidget;
|
||||
AColor: TColor;
|
||||
begin
|
||||
TGtk2WSWinControl.SetColor(AWinControl);
|
||||
|
||||
// Forms: GtkWindow->GtkVBox->gtkScrolledWindow->GtkLayout
|
||||
// we need to set the color of the GtkLayout so that the whole viewport
|
||||
// will be filled (issue #16183)
|
||||
AScrolled := g_object_get_data({%H-}PGObject(AWinControl.Handle), odnScrollArea);
|
||||
if GTK_IS_SCROLLED_WINDOW(AScrolled) and
|
||||
GTK_IS_LAYOUT({%H-}PGtkBin(AScrolled)^.child) then
|
||||
begin
|
||||
AColor := AWinControl.Color;
|
||||
if AColor = clDefault then
|
||||
AColor := GetDefaultColor(AWinControl, dctBrush);
|
||||
Gtk2WidgetSet.SetWidgetColor({%H-}PGtkBin(AScrolled)^.child,
|
||||
clNone, AColor,
|
||||
[GTK_STATE_NORMAL, GTK_STATE_ACTIVE,
|
||||
GTK_STATE_PRELIGHT, GTK_STATE_SELECTED]);
|
||||
end;
|
||||
end;
|
||||
|
||||
class procedure TGtk2WSCustomForm.SetRealPopupParent(
|
||||
@ -964,12 +983,20 @@ begin
|
||||
end;
|
||||
|
||||
class procedure TGtk2WSScrollingWinControl.SetColor(const AWinControl: TWinControl);
|
||||
var
|
||||
AColor: TColor;
|
||||
begin
|
||||
if not WSCheckHandleAllocated(AWinControl, 'SetColor')
|
||||
then Exit;
|
||||
|
||||
// ScrollingWinControl: GtkScrolledWindow->GtkLayout
|
||||
// we need to set the color of the GtkLayout so that the whole viewport
|
||||
// will be filled (issue #16183)
|
||||
AColor := AWinControl.Color;
|
||||
if AColor = clDefault then
|
||||
AColor := GetDefaultColor(AWinControl, dctBrush);
|
||||
Gtk2WidgetSet.SetWidgetColor({%H-}PGtkBin(AWinControl.Handle)^.child,
|
||||
clNone, AWinControl.Color,
|
||||
clNone, AColor,
|
||||
[GTK_STATE_NORMAL, GTK_STATE_ACTIVE,
|
||||
GTK_STATE_PRELIGHT, GTK_STATE_SELECTED]);
|
||||
end;
|
||||
|
@ -50,6 +50,7 @@ type
|
||||
TWSScrollingWinControl = class(TWSWinControl)
|
||||
published
|
||||
// procedure ScrollBy is moved to TWSWinControl.
|
||||
class function GetDefaultColor(const AControl: TControl; const ADefaultColorType: TDefaultColorType): TColor; override;
|
||||
end;
|
||||
|
||||
{ TWSScrollBox }
|
||||
@ -139,6 +140,19 @@ type
|
||||
|
||||
implementation
|
||||
|
||||
{ TWSScrollingWinControl }
|
||||
|
||||
class function TWSScrollingWinControl.GetDefaultColor(const AControl: TControl;
|
||||
const ADefaultColorType: TDefaultColorType): TColor;
|
||||
const
|
||||
DefColors: array[TDefaultColorType] of TColor = (
|
||||
{ dctBrush } clForm,
|
||||
{ dctFont } clBtnText
|
||||
);
|
||||
begin
|
||||
Result := DefColors[ADefaultColorType];
|
||||
end;
|
||||
|
||||
{ TWSCustomForm }
|
||||
|
||||
class procedure TWSCustomForm.CloseModal(const ACustomForm: TCustomForm);
|
||||
|
Loading…
Reference in New Issue
Block a user