mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-05 17:05:19 -05:00
Added defines for code completion to set the border mode (ccFORMCAPTION and ccFORMRESIZE). I think it's best for linux to not define either of them and for windows define ccFORMRESIZE (see ValistusDefines.inc).
This commit is contained in:
parent
cf1dbaccc7
commit
7d65466a5e
@ -1,4 +1,6 @@
|
|||||||
//Code Insight
|
//Code Insight
|
||||||
|
{.$DEFINE ccFORMCAPTION}
|
||||||
|
{$DEFINE ccFORMRESIZE}
|
||||||
{$DEFINE ciCHECKDUPLICATES}
|
{$DEFINE ciCHECKDUPLICATES}
|
||||||
{$DEFINE D8_NEWER1}
|
{$DEFINE D8_NEWER1}
|
||||||
{$DEFINE D9_NEWER}
|
{$DEFINE D9_NEWER}
|
||||||
|
@ -2,13 +2,11 @@ unit v_AutoCompleteForm;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
{$IFDEF FPC}
|
{$I ValistusDefines.inc}
|
||||||
{$mode objfpc}{$H+}
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs,
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs,
|
||||||
StdCtrls, ExtCtrls,
|
StdCtrls, ExtCtrls, SynEdit, SynEditKeyCmds,
|
||||||
|
|
||||||
{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
LMessages,
|
LMessages,
|
||||||
@ -33,6 +31,9 @@ type
|
|||||||
procedure setFilter(Filter: string);
|
procedure setFilter(Filter: string);
|
||||||
|
|
||||||
procedure DblClick; override;
|
procedure DblClick; override;
|
||||||
|
{$IFDEF ccFORMCAPTION}
|
||||||
|
procedure DoSelectionChange(User: Boolean); override;
|
||||||
|
{$ENDIF}
|
||||||
procedure DrawItem(Index: Integer; ARect: TRect; State: TOwnerDrawState); override;
|
procedure DrawItem(Index: Integer; ARect: TRect; State: TOwnerDrawState); override;
|
||||||
{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
procedure WMEraseBkgnd(var message: TLMEraseBkgnd); message LM_ERASEBKGND;
|
procedure WMEraseBkgnd(var message: TLMEraseBkgnd); message LM_ERASEBKGND;
|
||||||
@ -231,10 +232,10 @@ procedure TAutoCompleteListBox.WMEraseBkgnd(var message: TLMEraseBkgnd);
|
|||||||
procedure TAutoCompleteListBox.WMEraseBkgnd(var message: TWMEraseBkgnd);
|
procedure TAutoCompleteListBox.WMEraseBkgnd(var message: TWMEraseBkgnd);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
if (Count < Round(Height / ItemHeight)) then
|
if (Count < Round(ClientHeight / ItemHeight)) then
|
||||||
begin
|
begin
|
||||||
Canvas.Brush.Color := clYellow;
|
Canvas.Brush.Color := clYellow;
|
||||||
FillRect(message.DC, Rect(0, Count * ItemHeight, Width, Height), HBRUSH({$IFDEF FPC}Brush.Reference.Handle{$ELSE}Parent.Brush.Handle{$ENDIF}));
|
FillRect(message.DC, Rect(0, Count * ItemHeight, ClientWidth, ClientHeight), HBRUSH({$IFDEF FPC}Brush.Reference.Handle{$ELSE}Parent.Brush.Handle{$ENDIF}));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
message.Result := 1;
|
message.Result := 1;
|
||||||
@ -253,7 +254,7 @@ begin
|
|||||||
ItemIndex := TopIndex
|
ItemIndex := TopIndex
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
c := Round(Height / ItemHeight) - 1;
|
c := Round(ClientHeight / ItemHeight) - 1;
|
||||||
if (ItemIndex > TopIndex + c) then
|
if (ItemIndex > TopIndex + c) then
|
||||||
ItemIndex := TopIndex + c;
|
ItemIndex := TopIndex + c;
|
||||||
end;
|
end;
|
||||||
@ -276,7 +277,10 @@ begin
|
|||||||
begin
|
begin
|
||||||
Redirect.SetFocus;
|
Redirect.SetFocus;
|
||||||
Application.ProcessMessages;
|
Application.ProcessMessages;
|
||||||
SendMessage(Redirect.Handle, CN_Char, message.wParam, message.lParam);
|
if (Redirect is TSynEdit) then
|
||||||
|
TSynEdit(Redirect).CommandProcessor(ecChar, TUTF8Char(Chr(TLMChar(message).CharCode)), nil)
|
||||||
|
else
|
||||||
|
SendMessage(Redirect.Handle, CN_Char, message.wParam, message.lParam);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -288,6 +292,14 @@ begin
|
|||||||
TForm(Owner).Hide;
|
TForm(Owner).Hide;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$IFDEF ccFORMCAPTION}
|
||||||
|
procedure TAutoCompleteListBox.DoSelectionChange(User: Boolean);
|
||||||
|
begin
|
||||||
|
if (Owner is TForm) then
|
||||||
|
TForm(Owner).Caption := getInsert;
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
procedure TAutoCompleteListBox.DrawItem(Index: Integer; ARect: TRect; State: TOwnerDrawState);
|
procedure TAutoCompleteListBox.DrawItem(Index: Integer; ARect: TRect; State: TOwnerDrawState);
|
||||||
var
|
var
|
||||||
p1, p2, p3, tl, col: Integer;
|
p1, p2, p3, tl, col: Integer;
|
||||||
@ -416,8 +428,8 @@ end;
|
|||||||
|
|
||||||
procedure TAutoCompletePopup.DoShow;
|
procedure TAutoCompletePopup.DoShow;
|
||||||
begin
|
begin
|
||||||
//ClientHeight := Max(Min(Round(ClientHeight / l.ItemHeight), l.Count), 1) * l.ItemHeight;
|
//ClientHeight := Max(Min(Round(l.ClientHeight / l.ItemHeight), l.Count), 1) * l.ItemHeight;
|
||||||
//ClientHeight := Max(Round(ClientHeight / l.ItemHeight), 1) * l.ItemHeight;
|
//ClientHeight := Max(Round(l.ClientHeight / l.ItemHeight), 1) * l.ItemHeight;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TAutoCompletePopup.getRedirect: TWinControl;
|
function TAutoCompletePopup.getRedirect: TWinControl;
|
||||||
@ -460,15 +472,31 @@ begin
|
|||||||
ShowInTaskBar := stNever;
|
ShowInTaskBar := stNever;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
BorderStyle := bsSizeToolWin;
|
{$IFDEF ccFORMCAPTION}
|
||||||
BorderIcons := [];
|
{$IFDEF ccFORMRESIZE}
|
||||||
SetWindowLong(Handle, GWL_STYLE, GetWindowLong(Handle, GWL_STYLE) and (not WS_CAPTION) or WS_BORDER);
|
BorderStyle := bsSizeToolWin;
|
||||||
Height := Height - GetSystemMetrics(SM_CYCAPTION);
|
BorderIcons := [biSystemMenu];
|
||||||
|
{$ELSE}
|
||||||
|
BorderStyle := bsToolWindow;
|
||||||
|
BorderIcons := [biSystemMenu];
|
||||||
|
{$ENDIF}
|
||||||
|
{$ELSE}
|
||||||
|
{$IFDEF ccFORMRESIZE}
|
||||||
|
BorderStyle := bsSizeToolWin;
|
||||||
|
BorderIcons := [];
|
||||||
|
SetWindowLong(Handle, GWL_STYLE, GetWindowLong(Handle, GWL_STYLE) and (not WS_CAPTION) or WS_BORDER);
|
||||||
|
Height := Height - GetSystemMetrics(SM_CYCAPTION);
|
||||||
|
{$ELSE}
|
||||||
|
BorderStyle := bsNone;
|
||||||
|
BorderIcons := [];
|
||||||
|
l.BorderStyle := bsSingle;
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
DoubleBuffered := True;
|
DoubleBuffered := True;
|
||||||
ControlStyle := ControlStyle + [csOpaque];
|
ControlStyle := ControlStyle + [csOpaque];
|
||||||
|
|
||||||
ClientHeight := Round(ClientHeight / l.ItemHeight) * l.ItemHeight;
|
ClientHeight := (Round(ClientHeight / l.ItemHeight) * l.ItemHeight);
|
||||||
Constraints.MinHeight := l.ItemHeight;
|
Constraints.MinHeight := l.ItemHeight;
|
||||||
Constraints.MinWidth := 100;
|
Constraints.MinWidth := 100;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user