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; completion.OnPaintItem := @completionItemPaint;
fSyncEdit := TSynPluginSyncroEdit.Create(self); 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; //fSyncEdit.CaseSensitive:=true;
bmp := TBitmap.Create; bmp := TBitmap.Create;
try try

View File

@ -853,12 +853,27 @@ end;
procedure TCEMainForm.ApplicationProperties1ShowHint(var HintStr: string; procedure TCEMainForm.ApplicationProperties1ShowHint(var HintStr: string;
var CanShow: Boolean; var HintInfo: THintInfo); var CanShow: Boolean; var HintInfo: THintInfo);
begin begin
CanShow := true; // TODO-crefactor: move this to TCESynMemo or TCEEditorWidget.
//if fDoc <> nil then if fDoc.Focused then // TODO-cbugfix: first DDoc hint, window rect is wrong.
//begin if fDoc <> nil then if fDoc.Focused then
// DcdWrapper.getDdocFromCursor(HintStr); begin
// CanShow := HintStr <> ''; TCEEditorHintWindow.FontSize := fDoc.Font.Size;
//end; 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; end;
{$ENDREGION} {$ENDREGION}

View File

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