From 930552f748df84d38fe2c466a12629b2e4e0d0e4 Mon Sep 17 00:00:00 2001 From: lazarus Date: Sun, 9 Jun 2002 14:00:41 +0000 Subject: [PATCH] MG: fixed persistent caret and implemented Form.BorderStyle=bsNone git-svn-id: trunk@1744 - --- components/synedit/syncompletion.pas | 6 +++++- components/synedit/synedit.pp | 17 +++++++++-------- ide/editoroptions.pp | 2 +- lcl/interfaces/gtk/gtkcallback.inc | 20 ++++++++++++++++++-- lcl/interfaces/gtk/gtkdef.pp | 4 ++++ 5 files changed, 37 insertions(+), 12 deletions(-) diff --git a/components/synedit/syncompletion.pas b/components/synedit/syncompletion.pas index 99f32c02a5..0c652d749b 100644 --- a/components/synedit/syncompletion.pas +++ b/components/synedit/syncompletion.pas @@ -469,7 +469,11 @@ begin Canvas.Draw(1, 1, bitmap); // draw a rectangle around the window {$ENDIF} - Canvas.Pen.Color := ClBlack; + {$IFDEF SYN_LAZARUS} + Canvas.Pen.Color := TextColor; + {$ELSE} + Canvas.Pen.Color := clBlack; + {$ENDIF} Canvas.Moveto(0, 0); Canvas.LineTo(Width - 1, 0); Canvas.LineTo(Width - 1, Height - 1); diff --git a/components/synedit/synedit.pp b/components/synedit/synedit.pp index 2645fa1b76..3e11cc41ef 100644 --- a/components/synedit/synedit.pp +++ b/components/synedit/synedit.pp @@ -1811,7 +1811,7 @@ begin BeginDrag(false); end; end else if (ssLeft in Shift) and MouseCapture then begin -//writeln('AAA TCustomSynEdit.MouseMove CAPTURE Mouse=',X,',',Y,' Caret=',CaretX,',',CaretY,', BlockBegin=',BlockBegin.X,',',BlockBegin.Y,' BlockEnd=',BlockEnd.X,',',BlockEnd.Y,' Client=',ClientWidth-ScrollBarWidth,',',ClientHeight-ScrollBarWidth); +//writeln(' TCustomSynEdit.MouseMove CAPTURE Mouse=',X,',',Y,' Caret=',CaretX,',',CaretY,', BlockBegin=',BlockBegin.X,',',BlockBegin.Y,' BlockEnd=',BlockEnd.X,',',BlockEnd.Y,' Client=',ClientWidth-ScrollBarWidth,',',ClientHeight-ScrollBarWidth); if (X >= fGutterWidth) and (X < ClientWidth{$IFDEF SYN_LAZARUS}-ScrollBarWidth{$ENDIF}) and (Y >= 0) @@ -3601,16 +3601,17 @@ end; procedure TCustomSynEdit.ShowCaret; begin +//writeln(' [TCustomSynEdit.ShowCaret] ShowCaret ',Name,' ',sfCaretVisible in fStateFlags); if not (eoNoCaret in Options) and not (sfCaretVisible in fStateFlags) then begin - if {$IFDEF SYN_LAZARUS}LCLLinux{$ELSE}Windows{$ENDIF}.ShowCaret(Handle) then - begin -//writeln('[TCustomSynEdit.ShowCaret] A ',Name); - Include(fStateFlags, sfCaretVisible) - end; {$IFDEF SYN_LAZARUS} SetCaretRespondToFocus(Handle,not (eoPersistentCaret in fOptions)); {$ENDIF} + if {$IFDEF SYN_LAZARUS}LCLLinux{$ELSE}Windows{$ENDIF}.ShowCaret(Handle) then + begin +//writeln('[TCustomSynEdit.ShowCaret] A ',Name); + Include(fStateFlags, sfCaretVisible); + end; end; end; @@ -3637,10 +3638,10 @@ begin {$ELSE} SetCaretPos(CX, CY); {$ENDIF} -//writeln('[TCustomSynEdit.UpdateCaret] ShowCaret ',Name); +//writeln(' [TCustomSynEdit.UpdateCaret] ShowCaret ',Name); ShowCaret; end else begin -//writeln('[TCustomSynEdit.UpdateCaret] HideCaret ',Name); +//writeln(' [TCustomSynEdit.UpdateCaret] HideCaret ',Name); HideCaret; {$IFDEF SYN_LAZARUS} SetCaretPosEx(Handle,CX, CY); diff --git a/ide/editoroptions.pp b/ide/editoroptions.pp index 1e43493bb7..cf9c7318cd 100644 --- a/ide/editoroptions.pp +++ b/ide/editoroptions.pp @@ -5082,7 +5082,7 @@ begin SaveCurCodeTemplate; // save all values - SynOptions:=PreviewEdits[1].Options; + SynOptions:=PreviewEdits[1].Options-[eoNoSelection,eoNoCaret]; if BracketHighlightCheckBox.Checked then Include(SynOptions,eoBracketHighlight) else diff --git a/lcl/interfaces/gtk/gtkcallback.inc b/lcl/interfaces/gtk/gtkcallback.inc index 038b60ace0..0de22454b1 100644 --- a/lcl/interfaces/gtk/gtkcallback.inc +++ b/lcl/interfaces/gtk/gtkcallback.inc @@ -82,13 +82,26 @@ end; is used for the second part of the initialization of a widget. -------------------------------------------------------------------------------} function GTKRealizeCB(Widget: PGtkWidget; Data: Pointer): GBoolean; cdecl; +var + WinWidgetInfo: PWinWidgetInfo; begin EventTrace('realize', nil); // set extra signal masks after the widget window is created // define extra events we're interrested in + WinWidgetInfo:=GetWidgetInfo(Widget,true); gdk_window_set_events(Widget^.Window, - gdk_window_get_events(Widget^.Window) or TGdkEventMask(Data)); - + gdk_window_get_events(Widget^.Window) or WinWidgetInfo^.EventMask); + + if Data<>nil then begin + if TObject(Data) is TWinControl then begin + if TWinControl(Data) is TCustomForm then begin + if TCustomForm(Data).BorderStyle=bsNone then begin + gdk_window_set_decorations(Widget^.Window,0); + end; + end; + end; + end; + Result := True; end; @@ -1910,6 +1923,9 @@ end; { ============================================================================= $Log$ + Revision 1.83 2002/06/09 14:00:41 lazarus + MG: fixed persistent caret and implemented Form.BorderStyle=bsNone + Revision 1.82 2002/06/09 07:08:43 lazarus MG: fixed window jumping diff --git a/lcl/interfaces/gtk/gtkdef.pp b/lcl/interfaces/gtk/gtkdef.pp index e8806990c7..9f70a594bd 100644 --- a/lcl/interfaces/gtk/gtkdef.pp +++ b/lcl/interfaces/gtk/gtkdef.pp @@ -109,6 +109,7 @@ type Style: Integer; ExStyle: Integer; UserData: Integer; + EventMask: TGdkEventMask; end; // clipboard @@ -141,6 +142,9 @@ end. { ============================================================================= $Log$ + Revision 1.9 2002/06/09 14:00:41 lazarus + MG: fixed persistent caret and implemented Form.BorderStyle=bsNone + Revision 1.8 2002/06/04 15:17:23 lazarus MG: improved TFont for XLFD font names