From f7943628facc7311c19cc052fa2bd504ec6100cb Mon Sep 17 00:00:00 2001 From: mattias Date: Sun, 27 Jul 2008 21:13:41 +0000 Subject: [PATCH] gtk intf: Avoid the creation of WidgetInfo to combox childs, Update the ItemIndex cache when inserting items, from Luiz git-svn-id: trunk@15894 - --- components/synedit/syntextdrawer.pp | 5 +- ide/infobuild.lfm | 69 +++++++++----- ide/infobuild.lrs | 140 +++++++++++----------------- lcl/interfaces/gtk/gtkwidgetset.inc | 9 +- lcl/interfaces/gtk/gtkwsstdctrls.pp | 27 +++--- lcl/interfaces/gtk2/gtk2int.pas | 11 +++ 6 files changed, 130 insertions(+), 131 deletions(-) diff --git a/components/synedit/syntextdrawer.pp b/components/synedit/syntextdrawer.pp index 1dc64cc569..45b3460a01 100644 --- a/components/synedit/syntextdrawer.pp +++ b/components/synedit/syntextdrawer.pp @@ -1169,7 +1169,10 @@ begin end else begin DistArray:=nil; end; - LCLIntf.ExtUTF8Out(FDC, X, Y, fuOptions, @ARect, Text, Length, DistArray); + if UseUTF8 then + LCLIntf.ExtUTF8Out(FDC, X, Y, fuOptions, @ARect, Text, Length, DistArray) + else + LCLIntf.ExtTextOut(FDC, X, Y, fuOptions, @ARect, Text, Length, DistArray) {$ELSE} if FETOSizeInChar < Length then InitETODist(GetCharWidth); diff --git a/ide/infobuild.lfm b/ide/infobuild.lfm index 667d207fcf..a458f79e48 100644 --- a/ide/infobuild.lfm +++ b/ide/infobuild.lfm @@ -1,14 +1,18 @@ object FInfoCompile: TFInfoCompile Left = 270 - Height = 199 + Height = 202 Top = 251 - Width = 397 + Width = 430 ActiveControl = BClose BorderIcons = [] BorderStyle = bsDialog Caption = 'Compile project' - ClientHeight = 199 - ClientWidth = 397 + ChildSizing.LeftRightSpacing = 6 + ChildSizing.TopBottomSpacing = 6 + ChildSizing.HorizontalSpacing = 6 + ChildSizing.VerticalSpacing = 6 + ClientHeight = 202 + ClientWidth = 430 FormStyle = fsStayOnTop OnCreate = FormCreate Position = poScreenCenter @@ -17,7 +21,8 @@ object FInfoCompile: TFInfoCompile Left = 6 Height = 24 Top = 6 - Width = 386 + Width = 418 + Align = alTop BevelInner = bvLowered BevelOuter = bvLowered BorderStyle = bsSingle @@ -26,10 +31,13 @@ object FInfoCompile: TFInfoCompile TabOrder = 0 end object BClose: TBitBtn - Left = 138 + AnchorSideBottom.Control = Owner + AnchorSideBottom.Side = asrBottom + Left = 154 Height = 34 - Top = 154 + Top = 162 Width = 107 + Anchors = [akBottom] Caption = '&OK' Default = True Kind = bkOK @@ -41,19 +49,20 @@ object FInfoCompile: TFInfoCompile object Panel1: TPanel Left = 6 Height = 50 - Top = 34 - Width = 386 + Top = 36 + Width = 418 + Align = alTop BevelInner = bvLowered BevelOuter = bvLowered BorderWidth = 1 ClientHeight = 50 - ClientWidth = 386 + ClientWidth = 418 TabOrder = 2 object PCurrentStatus: TLabel Left = 3 Height = 44 Top = 3 - Width = 380 + Width = 412 Align = alClient Alignment = taCenter AutoSize = False @@ -63,15 +72,22 @@ object FInfoCompile: TFInfoCompile end end object Panel4: TPanel - Left = 176 + AnchorSideLeft.Control = Panel2 + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = Panel1 + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = Owner + AnchorSideRight.Side = asrBottom + Left = 156 Height = 48 - Top = 94 - Width = 210 + Top = 92 + Width = 268 + Anchors = [akTop, akLeft, akRight] BevelInner = bvLowered BevelOuter = bvLowered BorderStyle = bsSingle ClientHeight = 48 - ClientWidth = 210 + ClientWidth = 268 TabOrder = 3 object LNHint: TLabel Left = 68 @@ -86,17 +102,17 @@ object FInfoCompile: TFInfoCompile end object LInfoHint: TLabel Left = 6 - Height = 14 + Height = 20 Top = 5 - Width = 29 + Width = 38 Caption = 'Hints:' ParentColor = False end object LInfoWarning: TLabel Left = 6 - Height = 14 + Height = 20 Top = 26 - Width = 50 + Width = 62 Caption = 'Warnings:' ParentColor = False end @@ -113,9 +129,9 @@ object FInfoCompile: TFInfoCompile end object LInfoError: TLabel Left = 112 - Height = 14 + Height = 20 Top = 26 - Width = 34 + Width = 43 Caption = 'Errors:' ParentColor = False end @@ -132,9 +148,9 @@ object FInfoCompile: TFInfoCompile end object LInfoNote: TLabel Left = 112 - Height = 14 + Height = 20 Top = 5 - Width = 33 + Width = 43 Caption = 'Notes:' ParentColor = False end @@ -151,9 +167,12 @@ object FInfoCompile: TFInfoCompile end end object Panel2: TPanel - Left = 8 + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = Panel4 + AnchorSideTop.Side = asrCenter + Left = 6 Height = 28 - Top = 104 + Top = 102 Width = 144 BevelInner = bvLowered BevelOuter = bvLowered diff --git a/ide/infobuild.lrs b/ide/infobuild.lrs index 596fa451fb..079f5b3209 100644 --- a/ide/infobuild.lrs +++ b/ide/infobuild.lrs @@ -1,91 +1,57 @@ { Questo è un file risorse generato automaticamente da Lazarus } LazarusResources.Add('TFInfoCompile','FORMDATA',[ - 'TPF0'#13'TFInfoCompile'#12'FInfoCompile'#4'Left'#3#14#1#6'Height'#3#199#0#3 - +'Top'#3#251#0#5'Width'#3#141#1#13'ActiveControl'#7#6'BClose'#11'BorderIcons' - +#11#0#11'BorderStyle'#7#8'bsDialog'#7'Caption'#6#15'Compile project'#12'Clie' - +'ntHeight'#3#199#0#11'ClientWidth'#3#141#1#9'FormStyle'#7#11'fsStayOnTop'#8 - +'OnCreate'#7#10'FormCreate'#8'Position'#7#14'poScreenCenter'#10'LCLVersion'#6 - +#6'0.9.25'#0#6'TPanel'#5'PInfo'#4'Left'#2#6#6'Height'#2#24#3'Top'#2#6#5'Widt' - +'h'#3#130#1#10'BevelInner'#7#9'bvLowered'#10'BevelOuter'#7#9'bvLowered'#11'B' - +'orderStyle'#7#8'bsSingle'#7'Caption'#6#5'PInfo'#10'Font.Style'#11#6'fsBold' - +#0#8'TabOrder'#2#0#0#0#7'TBitBtn'#6'BClose'#4'Left'#3#138#0#6'Height'#2'"'#3 - +'Top'#3#154#0#5'Width'#2'k'#7'Caption'#6#3'&OK'#7'Default'#9#4'Kind'#7#4'bkO' - +'K'#11'ModalResult'#2#1#9'NumGlyphs'#2#0#7'OnClick'#7#11'BCloseClick'#8'TabO' - +'rder'#2#1#0#0#6'TPanel'#6'Panel1'#4'Left'#2#6#6'Height'#2'2'#3'Top'#2'"'#5 - +'Width'#3#130#1#10'BevelInner'#7#9'bvLowered'#10'BevelOuter'#7#9'bvLowered' - +#11'BorderWidth'#2#1#12'ClientHeight'#2'2'#11'ClientWidth'#3#130#1#8'TabOrde' - +'r'#2#2#0#6'TLabel'#14'PCurrentStatus'#4'Left'#2#3#6'Height'#2','#3'Top'#2#3 - +#5'Width'#3'|'#1#5'Align'#7#8'alClient'#9'Alignment'#7#8'taCenter'#8'AutoSiz' - +'e'#8#7'Caption'#6#14'PCurrentStatus'#11'ParentColor'#8#8'WordWrap'#9#0#0#0#6 - +'TPanel'#6'Panel4'#4'Left'#3#176#0#6'Height'#2'0'#3'Top'#2'^'#5'Width'#3#210 - +#0#10'BevelInner'#7#9'bvLowered'#10'BevelOuter'#7#9'bvLowered'#11'BorderStyl' - +'e'#7#8'bsSingle'#12'ClientHeight'#2'0'#11'ClientWidth'#3#210#0#8'TabOrder'#2 - +#3#0#6'TLabel'#6'LNHint'#4'Left'#2'D'#6'Height'#2#14#3'Top'#2#5#5'Width'#2#31 - +#9'Alignment'#7#14'taRightJustify'#8'AutoSize'#8#7'Caption'#6#1'0'#10'Font.C' - +'olor'#7#6'clBlue'#11'ParentColor'#8#0#0#6'TLabel'#9'LInfoHint'#4'Left'#2#6#6 - +'Height'#2#14#3'Top'#2#5#5'Width'#2#29#7'Caption'#6#6'Hints:'#11'ParentColor' - +#8#0#0#6'TLabel'#12'LInfoWarning'#4'Left'#2#6#6'Height'#2#14#3'Top'#2#26#5'W' - +'idth'#2'2'#7'Caption'#6#9'Warnings:'#11'ParentColor'#8#0#0#6'TLabel'#9'LNWa' - +'rning'#4'Left'#2'D'#6'Height'#2#14#3'Top'#2#26#5'Width'#2#31#9'Alignment'#7 - +#14'taRightJustify'#8'AutoSize'#8#7'Caption'#6#1'0'#10'Font.Color'#7#7'clGre' - +'en'#11'ParentColor'#8#0#0#6'TLabel'#10'LInfoError'#4'Left'#2'p'#6'Height'#2 - +#14#3'Top'#2#26#5'Width'#2'"'#7'Caption'#6#7'Errors:'#11'ParentColor'#8#0#0#6 - +'TLabel'#7'LNError'#4'Left'#3#172#0#6'Height'#2#14#3'Top'#2#26#5'Width'#2#31 - +#9'Alignment'#7#14'taRightJustify'#8'AutoSize'#8#7'Caption'#6#1'0'#10'Font.C' - +'olor'#7#5'clRed'#11'ParentColor'#8#0#0#6'TLabel'#9'LInfoNote'#4'Left'#2'p'#6 - +'Height'#2#14#3'Top'#2#5#5'Width'#2'!'#7'Caption'#6#6'Notes:'#11'ParentColor' - +#8#0#0#6'TLabel'#6'LNNote'#4'Left'#3#172#0#6'Height'#2#14#3'Top'#2#5#5'Width' - +#2#31#9'Alignment'#7#14'taRightJustify'#8'AutoSize'#8#7'Caption'#6#1'0'#10'F' - +'ont.Color'#7#7'clBlack'#11'ParentColor'#8#0#0#0#6'TPanel'#6'Panel2'#4'Left' - +#2#8#6'Height'#2#28#3'Top'#2'h'#5'Width'#3#144#0#10'BevelInner'#7#9'bvLowere' - +'d'#10'BevelOuter'#7#9'bvLowered'#11'BorderStyle'#7#8'bsSingle'#12'ClientHei' - +'ght'#2#28#11'ClientWidth'#3#144#0#8'TabOrder'#2#4#0#6'TLabel'#7'LNLines'#4 - +'Left'#2'X'#6'Height'#2#14#3'Top'#2#6#5'Width'#2'1'#9'Alignment'#7#14'taRigh' - +'tJustify'#8'AutoSize'#8#7'Caption'#6#1'0'#11'ParentColor'#8#0#0#6'TLabel'#10 - +'LInfoLines'#4'Left'#2#6#6'Height'#2#14#3'Top'#2#6#5'Width'#2#29#7'Caption'#6 - +#6'Lines:'#11'ParentColor'#8#0#0#0#0#13'TFInfoCompile'#12'FInfoCompile'#4'Le' - +'ft'#3#14#1#6'Height'#3#199#0#3'Top'#3#251#0#5'Width'#3#141#1#13'ActiveContr' - +'ol'#7#6'BClose'#11'BorderIcons'#11#0#11'BorderStyle'#7#8'bsDialog'#7'Captio' - +'n'#6#15'Compile project'#12'ClientHeight'#3#199#0#11'ClientWidth'#3#141#1#9 - +'FormStyle'#7#11'fsStayOnTop'#8'OnCreate'#7#10'FormCreate'#8'Position'#7#14 - +'poScreenCenter'#10'LCLVersion'#6#6'0.9.25'#0#6'TPanel'#5'PInfo'#4'Left'#2#6 - +#6'Height'#2#24#3'Top'#2#6#5'Width'#3#130#1#10'BevelInner'#7#9'bvLowered'#10 - +'BevelOuter'#7#9'bvLowered'#11'BorderStyle'#7#8'bsSingle'#7'Caption'#6#5'PIn' - +'fo'#10'Font.Style'#11#6'fsBold'#0#8'TabOrder'#2#0#0#0#7'TBitBtn'#6'BClose'#4 - +'Left'#3#138#0#6'Height'#2'"'#3'Top'#3#154#0#5'Width'#2'k'#7'Caption'#6#3'&O' - +'K'#7'Default'#9#4'Kind'#7#4'bkOK'#11'ModalResult'#2#1#9'NumGlyphs'#2#0#7'On' - +'Click'#7#11'BCloseClick'#8'TabOrder'#2#1#0#0#6'TPanel'#6'Panel1'#4'Left'#2#6 - +#6'Height'#2'2'#3'Top'#2'"'#5'Width'#3#130#1#10'BevelInner'#7#9'bvLowered'#10 - +'BevelOuter'#7#9'bvLowered'#11'BorderWidth'#2#1#12'ClientHeight'#2'2'#11'Cli' - +'entWidth'#3#130#1#8'TabOrder'#2#2#0#6'TLabel'#14'PCurrentStatus'#4'Left'#2#3 - +#6'Height'#2','#3'Top'#2#3#5'Width'#3'|'#1#5'Align'#7#8'alClient'#9'Alignmen' - +'t'#7#8'taCenter'#8'AutoSize'#8#7'Caption'#6#14'PCurrentStatus'#11'ParentCol' - +'or'#8#8'WordWrap'#9#0#0#0#6'TPanel'#6'Panel4'#4'Left'#3#176#0#6'Height'#2'0' - +#3'Top'#2'^'#5'Width'#3#210#0#10'BevelInner'#7#9'bvLowered'#10'BevelOuter'#7 - +#9'bvLowered'#11'BorderStyle'#7#8'bsSingle'#12'ClientHeight'#2'0'#11'ClientW' - +'idth'#3#210#0#8'TabOrder'#2#3#0#6'TLabel'#6'LNHint'#4'Left'#2'D'#6'Height'#2 - ,#14#3'Top'#2#5#5'Width'#2#31#9'Alignment'#7#14'taRightJustify'#8'AutoSize'#8 - +#7'Caption'#6#1'0'#10'Font.Color'#7#6'clBlue'#11'ParentColor'#8#0#0#6'TLabel' - +#9'LInfoHint'#4'Left'#2#6#6'Height'#2#14#3'Top'#2#5#5'Width'#2#29#7'Caption' - +#6#6'Hints:'#11'ParentColor'#8#0#0#6'TLabel'#12'LInfoWarning'#4'Left'#2#6#6 - +'Height'#2#14#3'Top'#2#26#5'Width'#2'2'#7'Caption'#6#9'Warnings:'#11'ParentC' - +'olor'#8#0#0#6'TLabel'#9'LNWarning'#4'Left'#2'D'#6'Height'#2#14#3'Top'#2#26#5 - +'Width'#2#31#9'Alignment'#7#14'taRightJustify'#8'AutoSize'#8#7'Caption'#6#1 - +'0'#10'Font.Color'#7#7'clGreen'#11'ParentColor'#8#0#0#6'TLabel'#10'LInfoErro' - +'r'#4'Left'#2'p'#6'Height'#2#14#3'Top'#2#26#5'Width'#2'"'#7'Caption'#6#7'Err' - +'ors:'#11'ParentColor'#8#0#0#6'TLabel'#7'LNError'#4'Left'#3#172#0#6'Height'#2 - +#14#3'Top'#2#26#5'Width'#2#31#9'Alignment'#7#14'taRightJustify'#8'AutoSize'#8 - +#7'Caption'#6#1'0'#10'Font.Color'#7#5'clRed'#11'ParentColor'#8#0#0#6'TLabel' - +#9'LInfoNote'#4'Left'#2'p'#6'Height'#2#14#3'Top'#2#5#5'Width'#2'!'#7'Caption' - +#6#6'Notes:'#11'ParentColor'#8#0#0#6'TLabel'#6'LNNote'#4'Left'#3#172#0#6'Hei' - +'ght'#2#14#3'Top'#2#5#5'Width'#2#31#9'Alignment'#7#14'taRightJustify'#8'Auto' - +'Size'#8#7'Caption'#6#1'0'#10'Font.Color'#7#7'clBlack'#11'ParentColor'#8#0#0 - +#0#6'TPanel'#6'Panel2'#4'Left'#2#8#6'Height'#2#28#3'Top'#2'h'#5'Width'#3#144 - +#0#10'BevelInner'#7#9'bvLowered'#10'BevelOuter'#7#9'bvLowered'#11'BorderStyl' - +'e'#7#8'bsSingle'#12'ClientHeight'#2#28#11'ClientWidth'#3#144#0#8'TabOrder'#2 - +#4#0#6'TLabel'#7'LNLines'#4'Left'#2'X'#6'Height'#2#14#3'Top'#2#6#5'Width'#2 - +'1'#9'Alignment'#7#14'taRightJustify'#8'AutoSize'#8#7'Caption'#6#1'0'#11'Par' - +'entColor'#8#0#0#6'TLabel'#10'LInfoLines'#4'Left'#2#6#6'Height'#2#14#3'Top'#2 - +#6#5'Width'#2#29#7'Caption'#6#6'Lines:'#11'ParentColor'#8#0#0#0#0 + 'TPF0'#13'TFInfoCompile'#12'FInfoCompile'#4'Left'#3#14#1#6'Height'#3#202#0#3 + +'Top'#3#251#0#5'Width'#3#174#1#13'ActiveControl'#7#6'BClose'#11'BorderIcons' + +#11#0#11'BorderStyle'#7#8'bsDialog'#7'Caption'#6#15'Compile project'#28'Chil' + +'dSizing.LeftRightSpacing'#2#6#28'ChildSizing.TopBottomSpacing'#2#6#29'Child' + +'Sizing.HorizontalSpacing'#2#6#27'ChildSizing.VerticalSpacing'#2#6#12'Client' + +'Height'#3#202#0#11'ClientWidth'#3#174#1#9'FormStyle'#7#11'fsStayOnTop'#8'On' + +'Create'#7#10'FormCreate'#8'Position'#7#14'poScreenCenter'#10'LCLVersion'#6#6 + +'0.9.25'#0#6'TPanel'#5'PInfo'#4'Left'#2#6#6'Height'#2#24#3'Top'#2#6#5'Width' + +#3#162#1#5'Align'#7#5'alTop'#10'BevelInner'#7#9'bvLowered'#10'BevelOuter'#7#9 + +'bvLowered'#11'BorderStyle'#7#8'bsSingle'#7'Caption'#6#5'PInfo'#10'Font.Styl' + +'e'#11#6'fsBold'#0#8'TabOrder'#2#0#0#0#7'TBitBtn'#6'BClose'#24'AnchorSideBot' + +'tom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#3 + +#154#0#6'Height'#2'"'#3'Top'#3#162#0#5'Width'#2'k'#7'Anchors'#11#8'akBottom' + +#0#7'Caption'#6#3'&OK'#7'Default'#9#4'Kind'#7#4'bkOK'#11'ModalResult'#2#1#9 + +'NumGlyphs'#2#0#7'OnClick'#7#11'BCloseClick'#8'TabOrder'#2#1#0#0#6'TPanel'#6 + +'Panel1'#4'Left'#2#6#6'Height'#2'2'#3'Top'#2'$'#5'Width'#3#162#1#5'Align'#7#5 + +'alTop'#10'BevelInner'#7#9'bvLowered'#10'BevelOuter'#7#9'bvLowered'#11'Borde' + +'rWidth'#2#1#12'ClientHeight'#2'2'#11'ClientWidth'#3#162#1#8'TabOrder'#2#2#0 + +#6'TLabel'#14'PCurrentStatus'#4'Left'#2#3#6'Height'#2','#3'Top'#2#3#5'Width' + +#3#156#1#5'Align'#7#8'alClient'#9'Alignment'#7#8'taCenter'#8'AutoSize'#8#7'C' + +'aption'#6#14'PCurrentStatus'#11'ParentColor'#8#8'WordWrap'#9#0#0#0#6'TPanel' + +#6'Panel4'#22'AnchorSideLeft.Control'#7#6'Panel2'#19'AnchorSideLeft.Side'#7#9 + +'asrBottom'#21'AnchorSideTop.Control'#7#6'Panel1'#18'AnchorSideTop.Side'#7#9 + +'asrBottom'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7 + +#9'asrBottom'#4'Left'#3#156#0#6'Height'#2'0'#3'Top'#2'\'#5'Width'#3#12#1#7'A' + +'nchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#10'BevelInner'#7#9'bvLowered'#10 + +'BevelOuter'#7#9'bvLowered'#11'BorderStyle'#7#8'bsSingle'#12'ClientHeight'#2 + +'0'#11'ClientWidth'#3#12#1#8'TabOrder'#2#3#0#6'TLabel'#6'LNHint'#4'Left'#2'D' + +#6'Height'#2#14#3'Top'#2#5#5'Width'#2#31#9'Alignment'#7#14'taRightJustify'#8 + +'AutoSize'#8#7'Caption'#6#1'0'#10'Font.Color'#7#6'clBlue'#11'ParentColor'#8#0 + +#0#6'TLabel'#9'LInfoHint'#4'Left'#2#6#6'Height'#2#20#3'Top'#2#5#5'Width'#2'&' + +#7'Caption'#6#6'Hints:'#11'ParentColor'#8#0#0#6'TLabel'#12'LInfoWarning'#4'L' + +'eft'#2#6#6'Height'#2#20#3'Top'#2#26#5'Width'#2'>'#7'Caption'#6#9'Warnings:' + +#11'ParentColor'#8#0#0#6'TLabel'#9'LNWarning'#4'Left'#2'D'#6'Height'#2#14#3 + +'Top'#2#26#5'Width'#2#31#9'Alignment'#7#14'taRightJustify'#8'AutoSize'#8#7'C' + +'aption'#6#1'0'#10'Font.Color'#7#7'clGreen'#11'ParentColor'#8#0#0#6'TLabel' + +#10'LInfoError'#4'Left'#2'p'#6'Height'#2#20#3'Top'#2#26#5'Width'#2'+'#7'Capt' + +'ion'#6#7'Errors:'#11'ParentColor'#8#0#0#6'TLabel'#7'LNError'#4'Left'#3#172#0 + +#6'Height'#2#14#3'Top'#2#26#5'Width'#2#31#9'Alignment'#7#14'taRightJustify'#8 + +'AutoSize'#8#7'Caption'#6#1'0'#10'Font.Color'#7#5'clRed'#11'ParentColor'#8#0 + +#0#6'TLabel'#9'LInfoNote'#4'Left'#2'p'#6'Height'#2#20#3'Top'#2#5#5'Width'#2 + +'+'#7'Caption'#6#6'Notes:'#11'ParentColor'#8#0#0#6'TLabel'#6'LNNote'#4'Left' + +#3#172#0#6'Height'#2#14#3'Top'#2#5#5'Width'#2#31#9'Alignment'#7#14'taRightJu' + +'stify'#8'AutoSize'#8#7'Caption'#6#1'0'#10'Font.Color'#7#7'clBlack'#11'Paren' + +'tColor'#8#0#0#0#6'TPanel'#6'Panel2'#22'AnchorSideLeft.Control'#7#5'Owner'#21 + +'AnchorSideTop.Control'#7#6'Panel4'#18'AnchorSideTop.Side'#7#9'asrCenter'#4 + +'Left'#2#6#6'Height'#2#28#3'Top'#2'f'#5'Width'#3#144#0#10'BevelInner'#7#9'bv' + +'Lowered'#10'BevelOuter'#7#9'bvLowered'#11'BorderStyle'#7#8'bsSingle'#12'Cli' + +'entHeight'#2#28#11'ClientWidth'#3#144#0#8'TabOrder'#2#4#0#6'TLabel'#7'LNLin' + +'es'#4'Left'#2'X'#6'Height'#2#14#3'Top'#2#6#5'Width'#2'1'#9'Alignment'#7#14 + +'taRightJustify'#8'AutoSize'#8#7'Caption'#6#1'0'#11'ParentColor'#8#0#0#6'TLa' + +'bel'#10'LInfoLines'#4'Left'#2#6#6'Height'#2#14#3'Top'#2#6#5'Width'#2#29#7'C' + +'aption'#6#6'Lines:'#11'ParentColor'#8#0#0#0#0 ]); diff --git a/lcl/interfaces/gtk/gtkwidgetset.inc b/lcl/interfaces/gtk/gtkwidgetset.inc index f7ff62c589..e8683a54ba 100644 --- a/lcl/interfaces/gtk/gtkwidgetset.inc +++ b/lcl/interfaces/gtk/gtkwidgetset.inc @@ -3642,19 +3642,16 @@ begin // callbacks RemoveCallbacks(Widget); + {$ifdef Gtk1} + //Gtk2 uses a different combobox widget class // childs if GtkWidgetIsA(Widget,GTK_COMBO_GET_TYPE) then begin g_signal_handlers_destroy(PGtkObject(PGtkCombo(Widget)^.Entry)); g_signal_handlers_destroy(PGtkObject(PGtkCombo(Widget)^.List)); //is really necessary to clear the text here? gtk_entry_set_text(PGtkEntry(PGtkCombo(Widget)^.Entry), ''); - - // MWE: - // TODO: Check: Why is there widgetinfo on subwidgets ??? - FreeWidgetInfo(PGtkCombo(Widget)^.List); - FreeWidgetInfo(PGtkCombo(Widget)^.Entry); - FreeWidgetInfo(PGtkCombo(Widget)^.Button); end; + {$endif} // update mouse capturing if (MouseCaptureWidget=Widget) or (MouseCaptureWidget=FixWidget) then diff --git a/lcl/interfaces/gtk/gtkwsstdctrls.pp b/lcl/interfaces/gtk/gtkwsstdctrls.pp index e6fc8e40b4..482652e963 100644 --- a/lcl/interfaces/gtk/gtkwsstdctrls.pp +++ b/lcl/interfaces/gtk/gtkwsstdctrls.pp @@ -806,7 +806,7 @@ end; {$IFDEF GTK1} -function gtkComboBoxChanged(widget: PGtkWidget; data: gPointer) : GBoolean; cdecl; +function gtkComboBoxChanged(Widget: PGtkWidget; Info: PWidgetInfo): GBoolean; cdecl; var Mess : TLMessage; GtkComboWidget: PGtkCombo; @@ -816,21 +816,21 @@ var begin Result := CallBackDefaultReturn; - if ComponentIsDestroyingHandle(TWinControl(Data)) or - (LockOnChange(PGtkObject(Widget), 0) > 0) or + if ComponentIsDestroyingHandle(TWinControl(Info^.LCLObject)) or + (Info^.ChangeLock > 0) or (gtk_signal_n_emissions_by_name(PGtkObject(widget), 'changed') > 1) then exit; {$IFDEF EventTrace} - EventTrace('changed', data); + EventTrace('changed', Info^.LCLObject); {$ENDIF} FillChar(Mess, SizeOf(Mess), 0); Mess.Msg := LM_CHANGED; - DeliverMessage(Data, Mess); + DeliverMessage(Info^.LCLObject, Mess); - GtkComboWidget := PGtkCombo(TComboBox(Data).Handle); + GtkComboWidget := PGtkCombo(Info^.CoreWidget); GtkListWidget := PGtkList(GtkComboWidget^.list); - LCLIndex := PInteger(GetWidgetInfo(GtkComboWidget)^.UserData); + LCLIndex := PInteger(Info^.UserData); //Check if an item is selected if (GtkListWidget^.selection <> nil) then @@ -843,7 +843,7 @@ begin gtk_list_set_selection_mode(GtkListWidget, GTK_SELECTION_BROWSE); LCLIndex^ := GtkIndex; Mess.Msg := LM_SELCHANGE; - DeliverMessage(Data, Mess); + DeliverMessage(Info^.LCLObject, Mess); end; end else @@ -860,8 +860,8 @@ begin with TGtkWidgetset(Widgetset) do begin //gtk1 and gtk2 have different 'changed' event handlers - ConnectSignal(PGtkObject(PGtkCombo(AGtkWidget)^.entry), - 'changed', @gtkComboBoxChanged, AWidgetInfo^.LCLObject); + g_signal_connect(PGtkObject(PGtkCombo(AGtkWidget)^.entry), + 'changed', TGTKSignalFunc(@gtkComboBoxChanged), AWidgetInfo); SetCallback(LM_COMMAND, PGtkObject(AGtkWidget), AWidgetInfo^.LCLObject); end; end; @@ -881,6 +881,7 @@ begin Widget := gtk_combo_new(); SetMainWidget(Widget, ComboWidget^.entry); + SetMainWidget(Widget, ComboWidget^.button); gtk_combo_disable_activate(ComboWidget); gtk_combo_set_case_sensitive(ComboWidget, GdkTrue); @@ -1078,6 +1079,7 @@ class procedure TGtkWSCustomComboBox.SetText(const AWinControl: TWinControl; var ComboControl: TCustomComboBox absolute AWinControl; ComboWidget: PGtkCombo; + WidgetInfo: PWidgetInfo; i: Integer; begin if ComboControl.ReadOnly then @@ -1088,13 +1090,14 @@ begin else begin ComboWidget := PGtkCombo(AWinControl.Handle); + WidgetInfo := GetWidgetInfo(ComboWidget); // lock combobox, so that no OnChange event is not fired - LockOnChange(PGtkObject(ComboWidget^.entry), +1); + Inc(WidgetInfo^.ChangeLock); // set text // The String > PChar conversion ensures at least a null terminated string gtk_entry_set_text(PGtkEntry(ComboWidget^.entry), PChar(AText)); // unlock combobox - LockOnChange(PGtkObject(ComboWidget^.entry), -1); + Dec(WidgetInfo^.ChangeLock); end; end; diff --git a/lcl/interfaces/gtk2/gtk2int.pas b/lcl/interfaces/gtk2/gtk2int.pas index 0568aeabcb..180410c77b 100644 --- a/lcl/interfaces/gtk2/gtk2int.pas +++ b/lcl/interfaces/gtk2/gtk2int.pas @@ -599,6 +599,7 @@ procedure TGtkListStoreStringList.Insert(Index : integer; const S : string); var li : TGtkTreeIter; l, m, r, cmp: integer; + LCLIndex: PInteger; {procedure TestNewItem; var @@ -654,6 +655,16 @@ begin gtk_list_store_insert(FGtkListStore, @li, Index); gtk_list_store_set(FGtkListStore, @li, [FColumnIndex, PChar(S), -1]); IncreaseChangeStamp; + + //if the item is inserted before the selected item the + //internal index cache becomes out of sync + if (FOwner is TCustomComboBox) and FOwner.HandleAllocated then + begin + LCLIndex := PInteger(GetWidgetInfo(Pointer(FOwner.Handle))^.UserData); + if Index <= LCLIndex^ then + Inc(LCLIndex^); + end; + // ToDo: connect callbacks if not (glsCountNeedsUpdate in FStates) then