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
|
||||
{.$DEFINE ccFORMCAPTION}
|
||||
{$DEFINE ccFORMRESIZE}
|
||||
{$DEFINE ciCHECKDUPLICATES}
|
||||
{$DEFINE D8_NEWER1}
|
||||
{$DEFINE D9_NEWER}
|
||||
|
@ -2,13 +2,11 @@ unit v_AutoCompleteForm;
|
||||
|
||||
interface
|
||||
|
||||
{$IFDEF FPC}
|
||||
{$mode objfpc}{$H+}
|
||||
{$ENDIF}
|
||||
{$I ValistusDefines.inc}
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs,
|
||||
StdCtrls, ExtCtrls,
|
||||
StdCtrls, ExtCtrls, SynEdit, SynEditKeyCmds,
|
||||
|
||||
{$IFDEF FPC}
|
||||
LMessages,
|
||||
@ -33,6 +31,9 @@ type
|
||||
procedure setFilter(Filter: string);
|
||||
|
||||
procedure DblClick; override;
|
||||
{$IFDEF ccFORMCAPTION}
|
||||
procedure DoSelectionChange(User: Boolean); override;
|
||||
{$ENDIF}
|
||||
procedure DrawItem(Index: Integer; ARect: TRect; State: TOwnerDrawState); override;
|
||||
{$IFDEF FPC}
|
||||
procedure WMEraseBkgnd(var message: TLMEraseBkgnd); message LM_ERASEBKGND;
|
||||
@ -231,10 +232,10 @@ procedure TAutoCompleteListBox.WMEraseBkgnd(var message: TLMEraseBkgnd);
|
||||
procedure TAutoCompleteListBox.WMEraseBkgnd(var message: TWMEraseBkgnd);
|
||||
{$ENDIF}
|
||||
begin
|
||||
if (Count < Round(Height / ItemHeight)) then
|
||||
if (Count < Round(ClientHeight / ItemHeight)) then
|
||||
begin
|
||||
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;
|
||||
|
||||
message.Result := 1;
|
||||
@ -253,7 +254,7 @@ begin
|
||||
ItemIndex := TopIndex
|
||||
else
|
||||
begin
|
||||
c := Round(Height / ItemHeight) - 1;
|
||||
c := Round(ClientHeight / ItemHeight) - 1;
|
||||
if (ItemIndex > TopIndex + c) then
|
||||
ItemIndex := TopIndex + c;
|
||||
end;
|
||||
@ -276,7 +277,10 @@ begin
|
||||
begin
|
||||
Redirect.SetFocus;
|
||||
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;
|
||||
|
||||
@ -288,6 +292,14 @@ begin
|
||||
TForm(Owner).Hide;
|
||||
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);
|
||||
var
|
||||
p1, p2, p3, tl, col: Integer;
|
||||
@ -416,8 +428,8 @@ end;
|
||||
|
||||
procedure TAutoCompletePopup.DoShow;
|
||||
begin
|
||||
//ClientHeight := Max(Min(Round(ClientHeight / l.ItemHeight), l.Count), 1) * l.ItemHeight;
|
||||
//ClientHeight := Max(Round(ClientHeight / l.ItemHeight), 1) * l.ItemHeight;
|
||||
//ClientHeight := Max(Min(Round(l.ClientHeight / l.ItemHeight), l.Count), 1) * l.ItemHeight;
|
||||
//ClientHeight := Max(Round(l.ClientHeight / l.ItemHeight), 1) * l.ItemHeight;
|
||||
end;
|
||||
|
||||
function TAutoCompletePopup.getRedirect: TWinControl;
|
||||
@ -460,15 +472,31 @@ begin
|
||||
ShowInTaskBar := stNever;
|
||||
{$ENDIF}
|
||||
|
||||
BorderStyle := bsSizeToolWin;
|
||||
BorderIcons := [];
|
||||
SetWindowLong(Handle, GWL_STYLE, GetWindowLong(Handle, GWL_STYLE) and (not WS_CAPTION) or WS_BORDER);
|
||||
Height := Height - GetSystemMetrics(SM_CYCAPTION);
|
||||
{$IFDEF ccFORMCAPTION}
|
||||
{$IFDEF ccFORMRESIZE}
|
||||
BorderStyle := bsSizeToolWin;
|
||||
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;
|
||||
ControlStyle := ControlStyle + [csOpaque];
|
||||
|
||||
ClientHeight := Round(ClientHeight / l.ItemHeight) * l.ItemHeight;
|
||||
ClientHeight := (Round(ClientHeight / l.ItemHeight) * l.ItemHeight);
|
||||
Constraints.MinHeight := l.ItemHeight;
|
||||
Constraints.MinWidth := 100;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user