From 399ffe0398e762ffd3b0b4c7355d52b547632632 Mon Sep 17 00:00:00 2001 From: mattias Date: Wed, 7 Oct 2015 13:36:53 +0000 Subject: [PATCH] cody: find overloads: sort columns git-svn-id: trunk@49973 - --- .../codetools/ide/codyfindoverloads.lfm | 40 ++++++++++--------- .../codetools/ide/codyfindoverloads.pas | 31 ++++++++++++-- .../languages/printer4lazstrconst.de.po | 4 -- .../printers/languages/printer4lazstrconst.po | 4 -- .../languages/printer4lazstrconst.ru.po | 5 +-- 5 files changed, 50 insertions(+), 34 deletions(-) diff --git a/components/codetools/ide/codyfindoverloads.lfm b/components/codetools/ide/codyfindoverloads.lfm index 394f9f8fe7..30d3593ccd 100644 --- a/components/codetools/ide/codyfindoverloads.lfm +++ b/components/codetools/ide/codyfindoverloads.lfm @@ -1,11 +1,11 @@ object CodyFindOverloadsWindow: TCodyFindOverloadsWindow Left = 728 - Height = 380 + Height = 400 Top = 242 - Width = 553 + Width = 556 Caption = 'CodyFindOverloadsWindow' - ClientHeight = 380 - ClientWidth = 553 + ClientHeight = 400 + ClientWidth = 556 OnClose = FormClose OnCreate = FormCreate OnDestroy = FormDestroy @@ -14,8 +14,8 @@ object CodyFindOverloadsWindow: TCodyFindOverloadsWindow object BtnPanel: TPanel Left = 0 Height = 39 - Top = 341 - Width = 553 + Top = 361 + Width = 556 Align = alBottom AutoSize = True BevelOuter = bvNone @@ -23,10 +23,10 @@ object CodyFindOverloadsWindow: TCodyFindOverloadsWindow ChildSizing.TopBottomSpacing = 6 ChildSizing.HorizontalSpacing = 6 ClientHeight = 39 - ClientWidth = 553 + ClientWidth = 556 TabOrder = 0 object JumpToButton: TButton - Left = 453 + Left = 456 Height = 27 Top = 6 Width = 94 @@ -51,14 +51,14 @@ object CodyFindOverloadsWindow: TCodyFindOverloadsWindow object FilterGroupBox: TGroupBox Left = 0 Height = 94 - Top = 247 - Width = 553 + Top = 267 + Width = 556 Align = alBottom AutoSize = True Caption = 'FilterGroupBox' ChildSizing.LeftRightSpacing = 6 ClientHeight = 77 - ClientWidth = 549 + ClientWidth = 552 TabOrder = 1 object CompatibleParamsCheckBox: TCheckBox AnchorSideLeft.Control = FilterGroupBox @@ -93,7 +93,7 @@ object CodyFindOverloadsWindow: TCodyFindOverloadsWindow Left = 87 Height = 29 Top = 24 - Width = 456 + Width = 459 Anchors = [akTop, akLeft, akRight] BorderSpacing.Left = 6 BorderSpacing.Right = 6 @@ -117,21 +117,22 @@ object CodyFindOverloadsWindow: TCodyFindOverloadsWindow end object ResultsGroupBox: TGroupBox Left = 0 - Height = 247 + Height = 267 Top = 0 - Width = 553 + Width = 556 Align = alClient Caption = 'ResultsGroupBox' - ClientHeight = 230 - ClientWidth = 549 + ClientHeight = 250 + ClientWidth = 552 TabOrder = 2 object ResultsStringGrid: TStringGrid Left = 0 - Height = 210 + Height = 230 Top = 20 - Width = 549 + Width = 552 Align = alClient ColCount = 3 + ColumnClickSorts = True Columns = < item ReadOnly = True @@ -156,6 +157,7 @@ object CodyFindOverloadsWindow: TCodyFindOverloadsWindow FixedCols = 0 Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goColSizing, goRowSelect, goDblClickAutoSize, goSmoothScroll, goRowHighlight] TabOrder = 0 + OnColRowExchanged = ResultsStringGridColRowExchanged OnCompareCells = ResultsStringGridCompareCells ColWidths = ( 182 @@ -167,7 +169,7 @@ object CodyFindOverloadsWindow: TCodyFindOverloadsWindow Left = 0 Height = 20 Top = 0 - Width = 549 + Width = 552 Align = alTop TabOrder = 1 end diff --git a/components/codetools/ide/codyfindoverloads.pas b/components/codetools/ide/codyfindoverloads.pas index 07743c1508..016242b852 100644 --- a/components/codetools/ide/codyfindoverloads.pas +++ b/components/codetools/ide/codyfindoverloads.pas @@ -86,6 +86,7 @@ type Name: string; ClassPath: string; TheUnitName: string; + Caption: string; Params: string; Distance: integer; Compatibility: TTypeCompatibility; @@ -119,6 +120,8 @@ type procedure JumpToButtonClick(Sender: TObject); procedure OnIdle(Sender: TObject; var Done: Boolean); procedure RefreshButtonClick(Sender: TObject); + procedure ResultsStringGridColRowExchanged(Sender: TObject; + IsColumn: Boolean; sIndex, tIndex: Integer); procedure ResultsStringGridCompareCells(Sender: TObject; ACol, ARow, BCol, BRow: Integer; var Result: integer); procedure Timer1Timer(Sender: TObject); @@ -259,12 +262,33 @@ begin Init; end; +procedure TCodyFindOverloadsWindow.ResultsStringGridColRowExchanged( + Sender: TObject; IsColumn: Boolean; sIndex, tIndex: Integer); +begin + if (not IsColumn) and (sIndex>0) and (sIndex<=ProcCount) + and (tIndex>0) and (tIndex<=ProcCount) then + FProcList.Exchange(sIndex-1,tIndex-1); +end; + procedure TCodyFindOverloadsWindow.ResultsStringGridCompareCells( Sender: TObject; ACol, ARow, BCol, BRow: Integer; var Result: integer); +var + AProc, BProc: TCFOProc; begin - if (aRow>0) and (ARow<=ProcCount) then begin - - end; + if (ARow>0) and (ARow<=ProcCount) and (ACol=BCol) + and (BRow>0) and (BRow<=ProcCount) then begin + AProc:=Procs[ARow-1]; + BProc:=Procs[BRow-1]; + case ACol of + 0: Result:=CompareText(AProc.Caption,BProc.Caption); + 1: Result:=ord(AProc.Compatibility)-ord(BProc.Compatibility); + 2: Result:=ord(AProc.Distance)-ord(BProc.Distance); + end; + if ResultsStringGrid.SortOrder=soDescending then + Result:=-Result; + //debugln(['TCodyFindOverloadsWindow.ResultsStringGridCompareCells "',AProc.Caption,'" "',BProc.Caption,'" ',Result]); + end else + debugln(['TCodyFindOverloadsWindow.ResultsStringGridCompareCells invalid ACol=',ACol,' ARow=',ARow,' BCol=',BCol,' BRow=',BRow]); end; procedure TCodyFindOverloadsWindow.Timer1Timer(Sender: TObject); @@ -670,6 +694,7 @@ begin if aProc.ClassPath<>'' then s+=aProc.ClassPath+'.'; s+=aProc.Name; + aProc.Caption:=s; Grid.Cells[0,Row]:=s; case aProc.Compatibility of diff --git a/components/printers/languages/printer4lazstrconst.de.po b/components/printers/languages/printer4lazstrconst.de.po index 473066520d..8edc40600d 100644 --- a/components/printers/languages/printer4lazstrconst.de.po +++ b/components/printers/languages/printer4lazstrconst.de.po @@ -68,10 +68,6 @@ msgstr "Papiertyp" msgid "Portrait" msgstr "Hochformat" -#: printer4lazstrconst.p4lrsprinterproperties -msgid "Printer properties" -msgstr "" - #: printer4lazstrconst.p4lrsresolution msgid "Resolution" msgstr "Auflösung" diff --git a/components/printers/languages/printer4lazstrconst.po b/components/printers/languages/printer4lazstrconst.po index 6dd933dbab..cd5f51b386 100644 --- a/components/printers/languages/printer4lazstrconst.po +++ b/components/printers/languages/printer4lazstrconst.po @@ -57,10 +57,6 @@ msgstr "" msgid "Portrait" msgstr "" -#: printer4lazstrconst.p4lrsprinterproperties -msgid "Printer properties" -msgstr "" - #: printer4lazstrconst.p4lrsresolution msgid "Resolution" msgstr "" diff --git a/components/printers/languages/printer4lazstrconst.ru.po b/components/printers/languages/printer4lazstrconst.ru.po index 437311c042..4ba96aac15 100644 --- a/components/printers/languages/printer4lazstrconst.ru.po +++ b/components/printers/languages/printer4lazstrconst.ru.po @@ -67,10 +67,6 @@ msgstr "Тип бумаги" msgid "Portrait" msgstr "Книжная" -#: printer4lazstrconst.p4lrsprinterproperties -msgid "Printer properties" -msgstr "Свойства принтера" - #: printer4lazstrconst.p4lrsresolution msgid "Resolution" msgstr "Разрешение" @@ -86,3 +82,4 @@ msgstr "Обратная книжная" #: printer4lazstrconst.p4lrsstart msgid "Start" msgstr "Верхний" +