mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 09:19:22 +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
|
// chomp empty lines at end
|
||||||
fPart1.GetPrevLineExtends(Cur1);
|
fPart1.GetPrevLineExtends(Cur1);
|
||||||
fPart2.GetPrevLineExtends(Cur2);
|
fPart2.GetPrevLineExtends(Cur2);
|
||||||
|
if (Cur1.LineNumber < 1) or (Cur2.LineNumber < 1) then
|
||||||
|
break;
|
||||||
until not LinesAreEqual(Cur1,Cur2);
|
until not LinesAreEqual(Cur1,Cur2);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -289,9 +289,11 @@ type
|
|||||||
procedure AssignClient(AClient: TObject); override;
|
procedure AssignClient(AClient: TObject); override;
|
||||||
procedure SetGroupIndex(Value: Integer); override;
|
procedure SetGroupIndex(Value: Integer); override;
|
||||||
procedure SetChecked(Value: Boolean); override;
|
procedure SetChecked(Value: Boolean); override;
|
||||||
|
procedure SetImageIndex(Value: Integer); override;
|
||||||
public
|
public
|
||||||
function IsCheckedLinked: Boolean; override;
|
function IsCheckedLinked: Boolean; override;
|
||||||
function IsGroupIndexLinked: Boolean; override;
|
function IsGroupIndexLinked: Boolean; override;
|
||||||
|
function IsImageIndexLinked: Boolean; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TCustomSpeedButton }
|
{ TCustomSpeedButton }
|
||||||
|
@ -62,6 +62,7 @@ Type
|
|||||||
procedure Loaded; override;
|
procedure Loaded; override;
|
||||||
function IndexOfFile(const AFilename: string): integer;
|
function IndexOfFile(const AFilename: string): integer;
|
||||||
procedure KeyUp(var Key: Word; Shift: TShiftState); override;
|
procedure KeyUp(var Key: Word; Shift: TShiftState); override;
|
||||||
|
procedure SetItemIndex(AIndex: Integer); override;
|
||||||
public
|
public
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -420,6 +421,12 @@ begin
|
|||||||
UpdateFileList;
|
UpdateFileList;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomFileListbox.SetItemIndex(AIndex: Integer);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
UpdateSelectedFileName;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomFileListBox.SetFileName(const AValue: String);
|
procedure TCustomFileListBox.SetFileName(const AValue: String);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
@ -8433,6 +8433,9 @@ begin
|
|||||||
// high control coords (like GTK2)
|
// high control coords (like GTK2)
|
||||||
CellR := Bounds(-FEditor.Width-100, -FEditor.Height-100, CellR.Right-CellR.Left, CellR.Bottom-CellR.Top);
|
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 FEditorOptions and EO_AUTOSIZE = EO_AUTOSIZE then begin
|
||||||
if (FEditor = FStringEditor) and (EditorBorderStyle = bsNone) then
|
if (FEditor = FStringEditor) and (EditorBorderStyle = bsNone) then
|
||||||
CellR := TWSCustomGridClass(WidgetSetClass).
|
CellR := TWSCustomGridClass(WidgetSetClass).
|
||||||
|
@ -422,7 +422,7 @@ begin { do not call inherited ! }
|
|||||||
end;
|
end;
|
||||||
anyRect.Top:=(ARect.Top+ARect.Bottom-FTextHeight) div 2;
|
anyRect.Top:=(ARect.Top+ARect.Bottom-FTextHeight) div 2;
|
||||||
anyRect.Bottom:=anyRect.Top+FTextHeight;
|
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;
|
end;
|
||||||
|
|
||||||
procedure TCustomComboBoxEx.FontChanged(Sender: TObject);
|
procedure TCustomComboBoxEx.FontChanged(Sender: TObject);
|
||||||
@ -684,7 +684,7 @@ begin { do not call inherited ! }
|
|||||||
end;
|
end;
|
||||||
anyRect.Top:=(ARect.Top+ARect.Bottom-FTextHeight) div 2;
|
anyRect.Top:=(ARect.Top+ARect.Bottom-FTextHeight) div 2;
|
||||||
anyRect.Bottom:=anyRect.Top+FTextHeight;
|
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;
|
end;
|
||||||
|
|
||||||
procedure TCustomCheckCombo.DropDown;
|
procedure TCustomCheckCombo.DropDown;
|
||||||
|
@ -23,6 +23,7 @@ type
|
|||||||
procedure SaveCheckStates(out AStates: TByteDynArray);
|
procedure SaveCheckStates(out AStates: TByteDynArray);
|
||||||
protected
|
protected
|
||||||
procedure Changed; override;
|
procedure Changed; override;
|
||||||
|
procedure InsertItem(Index: Integer; const S: string; O: TObject); override;
|
||||||
public
|
public
|
||||||
constructor Create(TheCheckGroup: TCustomCheckGroup);
|
constructor Create(TheCheckGroup: TCustomCheckGroup);
|
||||||
procedure Delete(AIndex: Integer); override;
|
procedure Delete(AIndex: Integer); override;
|
||||||
@ -61,6 +62,24 @@ begin
|
|||||||
RestoreCheckStates(b);
|
RestoreCheckStates(b);
|
||||||
end;
|
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);
|
procedure TCheckGroupStringList.RestoreCheckStates(const AStates: TByteDynArray);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
@ -1226,6 +1226,12 @@ begin
|
|||||||
(SpeedButton.GroupIndex = (Action as TCustomAction).GroupIndex);
|
(SpeedButton.GroupIndex = (Action as TCustomAction).GroupIndex);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSpeedButtonActionLink.IsImageIndexLinked: Boolean;
|
||||||
|
begin
|
||||||
|
Result := inherited IsImageIndexLinked and
|
||||||
|
(TSpeedButton(FClient).ImageIndex = (Action as TCustomAction).ImageIndex);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSpeedButtonActionLink.SetGroupIndex(Value: Integer);
|
procedure TSpeedButtonActionLink.SetGroupIndex(Value: Integer);
|
||||||
begin
|
begin
|
||||||
if IsGroupIndexLinked then TCustomSpeedButton(FClient).GroupIndex := Value;
|
if IsGroupIndexLinked then TCustomSpeedButton(FClient).GroupIndex := Value;
|
||||||
@ -1236,6 +1242,12 @@ begin
|
|||||||
if IsCheckedLinked then TCustomSpeedButton(FClient).Down := Value;
|
if IsCheckedLinked then TCustomSpeedButton(FClient).Down := Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSpeedButtonActionLink.SetImageIndex(Value: Integer);
|
||||||
|
begin
|
||||||
|
if IsImageIndexLinked then
|
||||||
|
TSpeedButton(FClient).ImageIndex := Value;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$IFDEF ASSERT_IS_ON}
|
{$IFDEF ASSERT_IS_ON}
|
||||||
{$UNDEF ASSERT_IS_ON}
|
{$UNDEF ASSERT_IS_ON}
|
||||||
|
@ -7603,7 +7603,7 @@ function CreateFormContents(AForm: TCustomForm;
|
|||||||
var FormWidget: Pointer; AWidgetInfo: PWidgetInfo = nil): Pointer;
|
var FormWidget: Pointer; AWidgetInfo: PWidgetInfo = nil): Pointer;
|
||||||
var
|
var
|
||||||
ScrolledWidget, ClientAreaWidget: PGtkWidget;
|
ScrolledWidget, ClientAreaWidget: PGtkWidget;
|
||||||
WindowStyle: PGtkStyle;
|
// WindowStyle: PGtkStyle;
|
||||||
Adjustment: PGtkAdjustment;
|
Adjustment: PGtkAdjustment;
|
||||||
begin
|
begin
|
||||||
// Create the VBox. We need that to place controls outside
|
// Create the VBox. We need that to place controls outside
|
||||||
@ -7620,8 +7620,10 @@ begin
|
|||||||
gtk_widget_show(ScrolledWidget);
|
gtk_widget_show(ScrolledWidget);
|
||||||
|
|
||||||
ClientAreaWidget := gtk_layout_new(nil, nil);
|
ClientAreaWidget := gtk_layout_new(nil, nil);
|
||||||
WindowStyle := GetStyle(lgsWindow);
|
// issue #16183: not sure why the GtkLayout is given a GtkWindow style here,
|
||||||
gtk_widget_set_style(ClientAreaWidget, WindowStyle);
|
// this prevents setting color to the GtkLayout
|
||||||
|
// WindowStyle := GetStyle(lgsWindow);
|
||||||
|
// gtk_widget_set_style(ClientAreaWidget, WindowStyle);
|
||||||
//debugln('CreateFormContents Style=',GetStyleDebugReport(WindowStyle));
|
//debugln('CreateFormContents Style=',GetStyleDebugReport(WindowStyle));
|
||||||
gtk_container_add(PGtkContainer(ScrolledWidget), ClientAreaWidget);
|
gtk_container_add(PGtkContainer(ScrolledWidget), ClientAreaWidget);
|
||||||
|
|
||||||
|
@ -2283,7 +2283,10 @@ begin
|
|||||||
|
|
||||||
if ChangeBGColor then
|
if ChangeBGColor then
|
||||||
begin
|
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
|
NewColor := nil
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
@ -857,8 +857,27 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TGtk2WSCustomForm.SetColor(const AWinControl: TWinControl);
|
class procedure TGtk2WSCustomForm.SetColor(const AWinControl: TWinControl);
|
||||||
|
var
|
||||||
|
AScrolled: PGtkWidget;
|
||||||
|
AColor: TColor;
|
||||||
begin
|
begin
|
||||||
TGtk2WSWinControl.SetColor(AWinControl);
|
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;
|
end;
|
||||||
|
|
||||||
class procedure TGtk2WSCustomForm.SetRealPopupParent(
|
class procedure TGtk2WSCustomForm.SetRealPopupParent(
|
||||||
@ -964,12 +983,20 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TGtk2WSScrollingWinControl.SetColor(const AWinControl: TWinControl);
|
class procedure TGtk2WSScrollingWinControl.SetColor(const AWinControl: TWinControl);
|
||||||
|
var
|
||||||
|
AColor: TColor;
|
||||||
begin
|
begin
|
||||||
if not WSCheckHandleAllocated(AWinControl, 'SetColor')
|
if not WSCheckHandleAllocated(AWinControl, 'SetColor')
|
||||||
then Exit;
|
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,
|
Gtk2WidgetSet.SetWidgetColor({%H-}PGtkBin(AWinControl.Handle)^.child,
|
||||||
clNone, AWinControl.Color,
|
clNone, AColor,
|
||||||
[GTK_STATE_NORMAL, GTK_STATE_ACTIVE,
|
[GTK_STATE_NORMAL, GTK_STATE_ACTIVE,
|
||||||
GTK_STATE_PRELIGHT, GTK_STATE_SELECTED]);
|
GTK_STATE_PRELIGHT, GTK_STATE_SELECTED]);
|
||||||
end;
|
end;
|
||||||
|
@ -50,6 +50,7 @@ type
|
|||||||
TWSScrollingWinControl = class(TWSWinControl)
|
TWSScrollingWinControl = class(TWSWinControl)
|
||||||
published
|
published
|
||||||
// procedure ScrollBy is moved to TWSWinControl.
|
// procedure ScrollBy is moved to TWSWinControl.
|
||||||
|
class function GetDefaultColor(const AControl: TControl; const ADefaultColorType: TDefaultColorType): TColor; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TWSScrollBox }
|
{ TWSScrollBox }
|
||||||
@ -139,6 +140,19 @@ type
|
|||||||
|
|
||||||
implementation
|
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 }
|
{ TWSCustomForm }
|
||||||
|
|
||||||
class procedure TWSCustomForm.CloseModal(const ACustomForm: TCustomForm);
|
class procedure TWSCustomForm.CloseModal(const ACustomForm: TCustomForm);
|
||||||
|
Loading…
Reference in New Issue
Block a user