diff --git a/components/idespotter/frmspotter.lfm b/components/idespotter/frmspotter.lfm index 2b1d897ab2..670433b900 100644 --- a/components/idespotter/frmspotter.lfm +++ b/components/idespotter/frmspotter.lfm @@ -3,7 +3,6 @@ object SpotterForm: TSpotterForm Height = 232 Top = 195 Width = 497 - ActiveControl = ECommand BorderStyle = bsSizeToolWin Caption = 'Spotter' ClientHeight = 232 @@ -18,34 +17,78 @@ object SpotterForm: TSpotterForm ShowInTaskBar = stNever LCLVersion = '2.1.0.0' Visible = True - object ECommand: TEdit - Left = 0 - Height = 27 - Top = 0 - Width = 497 - Align = alTop - OnChange = ECommandChange - OnKeyUp = ECommandKeyUp - TabOrder = 0 - TextHint = 'Search command' - end object LBMatches: TListBox - Left = 0 - Height = 205 - Top = 27 - Width = 497 + Left = 3 + Height = 196 + Top = 33 + Width = 491 Align = alClient + BorderSpacing.Around = 3 ClickOnSelChange = False ItemHeight = 0 OnClick = LBMatchesClick OnDrawItem = LBMatchesDrawItem OnKeyUp = LBMatchesKeyUp ParentShowHint = False - ScrollWidth = 495 + ScrollWidth = 489 ShowHint = True Style = lbOwnerDrawFixed - TabOrder = 1 + TabOrder = 0 TabStop = False TopIndex = -1 end + object ESearch: TEditButton + Left = 3 + Height = 27 + Top = 3 + Width = 491 + Align = alTop + BorderSpacing.Around = 3 + ButtonWidth = 23 + Flat = True + Glyph.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000064000000640000000000000000000000000000000000 + 0000000000000000000000000000000000000000000020A1C9FF2CAACFFF1082 + ACFF000000000000000000000000000000000000000000000000000000000000 + 0000000000002BA3C9FF24A5CCFF0F84AEFF149AC3FF24AED6FF33B1D5FF188B + B4FF1787AFFF43ABCCFF3DA8CBFF000000000000000000000000000000000000 + 00000000000032A5C9FF37B8DCFF14AED9FF11A1CBFF1DC7F0FF48D7F8FF34A6 + CAFF5CC1DDFF67C4DEFF3FA4C6FF00000000000000000000000000000000208C + B4FF2C98BDFF4EB5D5FF85DBEFFF51C0DEFF39C8ECFF1ED7FFFF3ADBFFFF5FD4 + F1FF75C6DFFFB0E1ECFF90CEE1FF1B8BB5FF00000000000000000000000060BA + D7FF48B0D2FF53BEE0FF95EDFFFF8DEFFFFF5AE5FFFF27DAFFFF1CD8FFFF52E2 + FFFF79E8FFFF7DEBFFFF3FCBEEFF31B1D9FF2CA4CEFF00000000000000001391 + C0FF22A6D7FF4EC3EAFF81DFF7FF92EFFFFF71D3E8FF5CB8CCFF50B2C9FF2AC7 + EBFF07D1FFFF04CFFEFF09D0FEFF08C9F5FF0EB4E1FF00000000000000001C8E + B8FF28ADDEFF3FBBE7FF6DD7F6FF91C7D3FF979696FF979696FF979696FF9796 + 96FF45BCD8FF02D2FFFF14D3FEFF1ED2FBFF0C9ECBFF00000000000000001E92 + BCFF27ADDFFF31B4E3FF5ACFF4FF979696FFE9E3E2FFB2B3B3FFACA2A2FFE1B7 + B5FF979696FF59DCFAFF9CF0FFFFB5EFFCFF3D9BBDFF0000000000000000148C + B8FF1F9DCDFF27ACDDFF47C5EFFF979696FFE9E2E0FFB1B2B2FFACA2A2FFDCB5 + B4FF979696FF7CE4FBFFACECF9FF8ACBE0FF48A5C4FF00000000000000000000 + 00000E80AAFF20A2D3FF36BCEBFF979696FFE9E2E0FFB1B2B2FFACA2A2FFDDB6 + B4FF979696FF65E1FDFF68CAE6FF0579A4FF0000000000000000000000000000 + 0000000000001389B4FF0D8FBEFF979696FFECE5E2FFB1B2B2FFACA2A2FFE0B8 + B6FF979696FF1E9AC1FF2293BAFF000000000000000000000000000000000000 + 0000000000000000000000000000979696FFE5E3E2FFAEAFAFFFABA1A1FFD8B6 + B6FF979696FF0000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000979696FFB2B2B2FFA0A0A0FF999696FFABA0 + A0FF979696FF0000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000979696FFE1E0E0FFC6C7C7FFA5A3A3FFB3A5 + A5FF979696FF0000000000000000000000000000000000000000000000000000 + 0000000000000000000000000000979696FFE5E4E4FFEAE9E9FFBCBCBCFFA39E + 9EFF979696FF0000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000979696FF979696FF979696FF9796 + 96FF000000000000000000000000000000000000000000000000 + } + MaxLength = 0 + NumGlyphs = 1 + OnButtonClick = ESearchButtonClick + OnChange = ECommandChange + OnKeyDown = ECommandKeyDown + PasswordChar = #0 + TabOrder = 1 + TextHint = 'Type search terms' + end end diff --git a/components/idespotter/frmspotter.pas b/components/idespotter/frmspotter.pas index 966c708573..63fcca3502 100644 --- a/components/idespotter/frmspotter.pas +++ b/components/idespotter/frmspotter.pas @@ -35,7 +35,7 @@ interface uses Classes, SysUtils, FileUtil, LazUTF8, Forms, Controls, Graphics, Dialogs, - StdCtrls, IDECommands, LazIDEIntf, Types; + StdCtrls, EditBtn, IDECommands, LazIDEIntf, Types, LCLType, IDEOptionsIntf, IDEOptEditorIntf; type @@ -64,10 +64,11 @@ type { TSpotterForm } TSpotterForm = class(TForm) - ECommand: TEdit; + ESearch: TEditButton; LBMatches: TListBox; procedure ECommandChange(Sender: TObject); - procedure ECommandKeyUp(Sender: TObject; var Key: Word; {%H-}Shift: TShiftState); + procedure ECommandKeyDown(Sender: TObject; var Key: Word; {%H-}Shift: TShiftState); + procedure ESearchButtonClick(Sender: TObject); procedure FormActivate(Sender: TObject); procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); procedure FormCreate(Sender: TObject); @@ -101,8 +102,9 @@ type Var ShowCmdCategory : Boolean = True; ShowShortCutKey : Boolean = True; - MatchColor : TColor = clRed; - KeyStrokeColor : TColor = clGreen; + MatchColor : TColor = clMaroon; + KeyStrokeColor : TColor = clNavy; + SettingsClass : TAbstractIDEOptionsEditorClass = Nil; Procedure ShowSpotterForm; Procedure ApplySpotterOptions; @@ -111,7 +113,7 @@ procedure LoadSpotterOptions; implementation -Uses BaseIDEIntf, LazConfigStorage, StrUtils, LCLIntf, LCLType, LCLProc, srceditorintf; +Uses BaseIDEIntf, LazConfigStorage, StrUtils, LCLIntf, LCLProc, srceditorintf; {$R *.lfm} @@ -207,10 +209,10 @@ end; procedure TSpotterForm.ECommandChange(Sender: TObject); begin - FilterList(ECommand.Text); + FilterList(ESearch.Text); end; -procedure TSpotterForm.ECommandKeyUp(Sender: TObject; var Key: Word; +procedure TSpotterForm.ECommandKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin Case Key of @@ -220,14 +222,14 @@ begin If LBMatches.ItemIndex>0 then LBMatches.ItemIndex:=LBMatches.ItemIndex-1; Key:=0; - ECommand.SelStart:=Length(ECommand.Text); + ESearch.SelStart:=Length(ESearch.Text); end; VK_DOWN: begin If LBMatches.ItemIndex=0 then @@ -235,9 +237,16 @@ begin end; end; +procedure TSpotterForm.ESearchButtonClick(Sender: TObject); +begin + LazarusIDE.DoOpenIDEOptions(SettingsClass,'IDE Spotter'); + Close; +end; + + procedure TSpotterForm.FormActivate(Sender: TObject); begin - ECommand.SetFocus; + ESearch.SetFocus; end; procedure TSpotterForm.FormClose(Sender: TObject; @@ -338,7 +347,7 @@ begin Top:=MF.ClientOrigin.y+32; // Note: docked or not docked Left:=MF.ClientOrigin.x+(MF.Width-Width) div 2; end; - ECommand.Clear; + ESearch.Clear; LBMatches.Clear; RefreshCaption(-1); end; @@ -352,16 +361,19 @@ end; procedure TSpotterForm.LBMatchesDrawItem(Control: TWinControl; Index: Integer; ARect: TRect; State: TOwnerDrawState); +Const + LeftMargin = 5; + RightMargin = LeftMargin; + Var LB : TListbox; DS,S : String; Itm : TSearchItem; R : TRect; - P,I,SP,W,SW : Integer; + P,I,SP,W : Integer; FC : TColor; begin - SW := GetSystemMetrics(SM_CXVSCROLL); LB:=Control as TListBox; LB.Canvas.FillRect(ARect); FC:=LB.Canvas.Font.Color; @@ -371,9 +383,9 @@ begin if ShowShortCutKey and (Itm.KeyStroke<>'') then begin W:=LB.Canvas.TextWidth(Itm.KeyStroke); - R.Right:=R.Right-W-SW; + R.Right:=R.Right-W-RightMargin; end; - Inc(R.Left,2); + Inc(R.Left,LeftMargin); SP:=1; For I:=0 to Length(Itm.MatchPos)-1 do begin diff --git a/components/idespotter/regidespotter.pas b/components/idespotter/regidespotter.pas index 900a2c78fd..771d8135fb 100644 --- a/components/idespotter/regidespotter.pas +++ b/components/idespotter/regidespotter.pas @@ -66,6 +66,7 @@ var IDESpotteroptionsFrameID: Integer = 2000; begin + LoadSpotterOptions; IDEShortCutX := IDEShortCut(VK_P, ShiftKeys, VK_UNKNOWN, []); IDECommandCategory := IDECommandList.FindCategoryByName(CommandCategoryViewName); if IDECommandCategory <> nil then @@ -81,5 +82,7 @@ begin @IDEMenuClicked,IDECommand); end; +Initialization + SettingsClass:=TIDESpotterOptionsFrame; end.