Merge branch 'a12_2_a13'

This commit is contained in:
Basile Burg 2015-02-07 08:59:48 +01:00
commit 0d7d51a0d8
3 changed files with 51 additions and 9 deletions

View File

@ -99,7 +99,7 @@ begin
//
completion.OnPaintItem := @completionItemPaint;
fSyncEdit := TSynPluginSyncroEdit.Create(self);
//TODO-ccLCL&LAZ-specific: activate this after next Laz release
//TODO-cLCL&LAZ-specific: activate this after next Laz release
//fSyncEdit.CaseSensitive:=true;
bmp := TBitmap.Create;
try

View File

@ -853,12 +853,27 @@ end;
procedure TCEMainForm.ApplicationProperties1ShowHint(var HintStr: string;
var CanShow: Boolean; var HintInfo: THintInfo);
begin
CanShow := true;
//if fDoc <> nil then if fDoc.Focused then
//begin
// DcdWrapper.getDdocFromCursor(HintStr);
// CanShow := HintStr <> '';
//end;
// TODO-crefactor: move this to TCESynMemo or TCEEditorWidget.
// TODO-cbugfix: first DDoc hint, window rect is wrong.
if fDoc <> nil then if fDoc.Focused then
begin
TCEEditorHintWindow.FontSize := fDoc.Font.Size;
HintInfo.HintWindowClass := TCEEditorHintWindow;
HintInfo.HideTimeout := 120000;
// note: non-default color allows non-themed draw() which allows custom font-size to be handled.
HintInfo.HintColor := clInfoBk + $01010100;
//
DcdWrapper.getDdocFromCursor(HintStr);
if (length(HintStr) > 0) then
if Hintstr[1] = #13 then
Hintstr := Hintstr[2..length(Hintstr)];
if (length(HintStr) > 0) then
if Hintstr[1] = #10 then
Hintstr := Hintstr[2..length(Hintstr)];
end else
HintInfo.HideTimeout := 2500;
//
CanShow := HintStr <> '';
end;
{$ENDREGION}

View File

@ -7,12 +7,20 @@ interface
uses
Classes, SysUtils, SynEdit, ce_d2syn, ce_txtsyn ,SynEditHighlighter, controls,
lcltype, LazSynEditText, SynEditKeyCmds, SynHighlighterLFM, SynEditMouseCmds,
SynEditFoldedView, crc, ce_common, ce_observer, ce_writableComponent;
SynEditFoldedView, crc, ce_common, ce_observer, ce_writableComponent, Forms;
type
TCESynMemo = class;
TCEEditorHintWindow = class(THintWindow)
public
class var FontSize: Integer;
constructor Create(AOwner: TComponent); override;
function CalcHintRect(MaxWidth: Integer; const AHint: String;
AData: Pointer): TRect; override;
end;
TCEFoldCache = class(TCollectionItem)
private
fCollapsed: boolean;
@ -123,6 +131,20 @@ implementation
uses
graphics, ce_interfaces, ce_staticmacro, ce_dcd, SynEditHighlighterFoldBase;
constructor TCEEditorHintWindow.Create(AOwner: TComponent);
begin
inherited;
Canvas.Font.Size:= FontSize;
end;
function TCEEditorHintWindow.CalcHintRect(MaxWidth: Integer; const AHint: String; AData: Pointer): TRect;
begin
Canvas.Font.Size:= FontSize;
result := inherited CalcHintRect(MaxWidth, AHint, AData);
end;
{$REGION TCESynMemoCache -------------------------------------------------------}
constructor TCESynMemoCache.create(aComponent: TComponent);
begin
@ -153,6 +175,7 @@ begin
fSourceFilename := fMemo.fileName;
fSelectionEnd := fMemo.SelEnd;
fFontSize := fMemo.Font.Size;
TCEEditorHintWindow.FontSize := fMemo.Font.Size;
//
// TODO-cEditor Cache: >nested< folding persistence
// cf. other ways: http://forum.lazarus.freepascal.org/index.php?topic=26748.msg164722#msg164722
@ -486,12 +509,14 @@ procedure TCESynMemo.KeyDown(var Key: Word; Shift: TShiftState);
begin
inherited;
identifierToD2Syn;
if not (Shift = [ssCtrl]) then exit;
//
if (Shift = [ssCtrl]) then case Key of
case Key of
VK_ADD: if Font.Size < 50 then Font.Size := Font.Size + 1;
VK_SUBTRACT: if Font.Size > 3 then Font.Size := Font.Size - 1;
VK_DECIMAL: Font.Size := fStoredFontSize;
end;
TCEEditorHintWindow.FontSize := Font.Size;
end;
procedure TCESynMemo.KeyUp(var Key: Word; Shift: TShiftState);
@ -552,6 +577,8 @@ initialization
LfmSyn.KeyAttri.Style := [fsBold];
LfmSyn.NumberAttri.Foreground := clMaroon;
LfmSyn.StringAttri.Foreground := clBlue;
//
TCEEditorHintWindow.FontSize := 10;
finalization
D2Syn.Free;
LfmSyn.Free;