MG: added find-block-start and renamed find-block-other-end

git-svn-id: trunk@613 -
This commit is contained in:
lazarus 2002-01-21 14:17:47 +00:00
parent e1bd2273fe
commit 74e062ae3e
7 changed files with 118 additions and 54 deletions

View File

@ -1746,7 +1746,7 @@ begin
Include(fStateFlags, sfPossibleGutterClick);
{$IFDEF SYN_LAZARUS}
LCLLinux.SetFocus(Handle);
ShowCaret;
UpdateCaret;
{$ELSE}
Windows.SetFocus(Handle);
{$ENDIF}
@ -3445,7 +3445,10 @@ procedure TCustomSynEdit.ShowCaret;
begin
if not (eoNoCaret in Options) and not (sfCaretVisible in fStateFlags) then
if {$IFDEF SYN_LAZARUS}LCLLinux{$ELSE}Windows{$ENDIF}.ShowCaret(Handle) then
begin
//writeln('[TCustomSynEdit.ShowCaret] A ',Name);
Include(fStateFlags, sfCaretVisible)
end;
end;
procedure TCustomSynEdit.UpdateCaret;
@ -3471,8 +3474,10 @@ begin
{$ELSE}
SetCaretPos(CX, CY);
{$ENDIF}
//writeln('[TCustomSynEdit.UpdateCaret] ShowCaret ',Name);
ShowCaret;
end else begin
//writeln('[TCustomSynEdit.UpdateCaret] HideCaret ',Name);
HideCaret;
{$IFDEF SYN_LAZARUS}
SetCaretPosEx(Handle,CX, CY);
@ -3615,7 +3620,7 @@ end;
procedure TCustomSynEdit.WMKillFocus(var Msg: TWMKillFocus);
begin
inherited;
//writeln('[TCustomSynEdit.WMKillFocus] A');
writeln('[TCustomSynEdit.WMKillFocus] A ',Name);
HideCaret;
{$IFDEF SYN_LAZARUS}
LCLLinux.DestroyCaret(Handle);
@ -3624,7 +3629,7 @@ begin
{$ENDIF}
if FHideSelection and SelAvail then
Invalidate;
//writeln('[TCustomSynEdit.WMKillFocus] END');
writeln('[TCustomSynEdit.WMKillFocus] END ',Name);
end;
procedure TCustomSynEdit.WMSetFocus(var Msg: TWMSetFocus);
@ -4803,6 +4808,7 @@ begin
IncPaintLock;
try
// Make sure X is visible
//writeln('[TCustomSynEdit.EnsureCursorPosVisible] A CaretX=',CaretX,' LeftChar=',LeftChar,' CharsInWindow=',CharsInWindow,' ClientWidth=',ClientWidth);
if CaretX < LeftChar then
LeftChar := CaretX
else if CaretX > CharsInWindow + LeftChar then

View File

@ -51,7 +51,8 @@ const
ecViewJumpHistory = ecUserFirst + 15;
ecFindDeclaration = ecUserFirst + 20;
ecFindBlockEnd = ecUserFirst + 21;
ecFindBlockOtherEnd = ecUserFirst + 21;
ecFindBlockStart = ecUserFirst + 22;
ecWordCompletion = ecUserFirst + 100;
ecCompleteCode = ecUserFirst + 101;
@ -346,7 +347,8 @@ begin
ecAddJumpPoint: Result:='add jump point';
ecViewJumpHistory: Result:='view jump history';
ecFindDeclaration: Result:='find declaration';
ecFindBlockEnd: Result:='find block end';
ecFindBlockOtherEnd: Result:='find block other end';
ecFindBlockStart: Result:='find block start';
ecNextEditor: Result:= 'next editor';
ecPrevEditor: Result:= 'previous editor';
ecPeriod: Result:= 'period';
@ -937,7 +939,8 @@ begin
Add('Find procedure method',ecFindProcedureMethod,
VK_DOWN,[ssShift,SSCtrl],VK_UNKNOWN,[]);
Add('Find declaration',ecFindDeclaration,VK_UNKNOWN,[],VK_UNKNOWN,[]);
Add('Find block end',ecFindBlockEnd,VK_UNKNOWN,[],VK_UNKNOWN,[]);
Add('Find block other end',ecFindBlockOtherEnd,VK_UNKNOWN,[],VK_UNKNOWN,[]);
Add('Find block start',ecFindBlockStart,VK_UNKNOWN,[],VK_UNKNOWN,[]);
Add('Go to line number',ecGotoLineNumber,VK_G,[ssCtrl],VK_UNKNOWN,[]);
Add('Jump back',ecJumpBack,VK_H,[ssCtrl],VK_UNKNOWN,[]);
Add('Jump forward',ecJumpForward,VK_H,[ssCtrl,ssShift],VK_UNKNOWN,[]);

View File

@ -1,4 +1,3 @@
{ $Id$ }
{
/***************************************************************************
@ -387,7 +386,8 @@ type
procedure DoCompleteCodeAtCursor;
procedure DoJumpToCodeToolBossError;
function DoCheckSyntax: TModalResult;
procedure DoGoToPascalBlockEnd;
procedure DoGoToPascalBlockOtherEnd;
procedure DoGoToPascalBlockStart;
procedure DoJumpToGuessedUnclosedBlock(FindNext: boolean);
// methods for debugging, compiling and external tools
@ -1774,8 +1774,11 @@ begin
ecFindDeclaration:
DoFindDeclarationAtCursor;
ecFindBlockEnd:
DoGoToPascalBlockEnd;
ecFindBlockOtherEnd:
DoGoToPascalBlockOtherEnd;
ecFindBlockStart:
DoGoToPascalBlockStart;
ecCompleteCode:
DoCompleteCodeAtCursor;
@ -5088,6 +5091,7 @@ begin
BlockBegin:=CaretXY;
BlockEnd:=CaretXY;
TopLine:=NewTopLine;
SetFocus;
end;
Result:=mrOk;
end;
@ -5179,7 +5183,7 @@ writeln('[TMainIDE.DoFindDeclarationAtCursor] ************');
DoJumpToCodeToolBossError;
end;
procedure TMainIDE.DoGoToPascalBlockEnd;
procedure TMainIDE.DoGoToPascalBlockOtherEnd;
var ActiveSrcEdit: TSourceEditor;
ActiveUnitInfo: TUnitInfo;
NewSource: TCodeBuffer;
@ -5188,7 +5192,7 @@ begin
if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo) then exit;
{$IFDEF IDE_DEBUG}
writeln('');
writeln('[TMainIDE.DoGoToPascalBlockEnd] ************');
writeln('[TMainIDE.DoGoToPascalBlockOtherEnd] ************');
{$ENDIF}
if CodeToolBoss.FindBlockCounterPart(ActiveUnitInfo.Source,
ActiveSrcEdit.EditorComponent.CaretX,
@ -5201,6 +5205,29 @@ writeln('[TMainIDE.DoGoToPascalBlockEnd] ************');
DoJumpToCodeToolBossError;
end;
procedure TMainIDE.DoGoToPascalBlockStart;
var ActiveSrcEdit: TSourceEditor;
ActiveUnitInfo: TUnitInfo;
NewSource: TCodeBuffer;
NewX, NewY, NewTopLine: integer;
begin
if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo) then exit;
{$IFDEF IDE_DEBUG}
writeln('');
writeln('[TMainIDE.DoGoToPascalBlockStart] ************');
{$ENDIF}
writeln('[TMainIDE.DoGoToPascalBlockStart] ************');
if CodeToolBoss.FindBlockStart(ActiveUnitInfo.Source,
ActiveSrcEdit.EditorComponent.CaretX,
ActiveSrcEdit.EditorComponent.CaretY,
NewSource,NewX,NewY,NewTopLine) then
begin
DoJumpToCodePos(ActiveSrcEdit, ActiveUnitInfo,
NewSource, NewX, NewY, NewTopLine, false);
end else
DoJumpToCodeToolBossError;
end;
procedure TMainIDE.DoJumpToGuessedUnclosedBlock(FindNext: boolean);
var ActiveSrcEdit: TSourceEditor;
ActiveUnitInfo: TUnitInfo;
@ -5586,6 +5613,9 @@ end.
=======
$Log$
Revision 1.203 2002/01/21 14:17:44 lazarus
MG: added find-block-start and renamed find-block-other-end
Revision 1.202 2002/01/17 11:00:00 lazarus
MG: increased IDE version to 0.8.2 alpha
@ -5626,6 +5656,9 @@ end.
<<<<<<< main.pp
$Log$
Revision 1.203 2002/01/21 14:17:44 lazarus
MG: added find-block-start and renamed find-block-other-end
Revision 1.202 2002/01/17 11:00:00 lazarus
MG: increased IDE version to 0.8.2 alpha

View File

@ -1053,8 +1053,6 @@ Begin
End;
Procedure TSourceEditor.CreateEditor(AOwner : TComponent; AParent: TWinControl);
type
bytearray = array[0..10000] of byte;
var
NewName: string;
i: integer;
@ -1083,7 +1081,7 @@ writeln('TSourceEditor.CreateEditor A ');
OnMouseMove := @EditorMouseMoved;
OnMouseDown := @EditorMouseDown;
OnKeyDown := @EditorKeyDown;
Show;
Visible:=true;
end;
if FCodeTemplates<>nil then
FCodeTemplates.AddEditor(FEditor);
@ -2100,12 +2098,6 @@ Begin
SrcPopupMenu := TPopupMenu.Create(Self);
SrcPopupMenu.AutoPopup := True;
MenuItem := TMenuItem.Create(Self);
MenuItem.Name:='ClosePageMenuItem';
MenuItem.Caption := '&Close Page';
MenuItem.OnClick := @CloseClicked;
SrcPopupMenu.Items.Add(MenuItem);
MenuItem := TMenuItem.Create(Self);
MenuItem.Name:='FindDeclarationMenuItem';
MenuItem.Caption := '&Find Declaration';
@ -2118,6 +2110,12 @@ Begin
MenuItem.OnClick := @OpenAtCursorClicked;
SrcPopupMenu.Items.Add(MenuItem);
MenuItem := TMenuItem.Create(Self);
MenuItem.Name:='ClosePageMenuItem';
MenuItem.Caption := '&Close Page';
MenuItem.OnClick := @CloseClicked;
SrcPopupMenu.Items.Add(MenuItem);
SrcPopupMenu.Items.Add(Seperator);
ToggleMenuItem := TMenuItem.Create(Self);

View File

@ -783,13 +783,13 @@ procedure TWinControl.SetFocus;
var
Form : TCustomForm;
begin
Form := GetParentForm(self);
//if ClassName='TSYNEDIT' then writeln('[TWinControl.SetFocus] ',Name,' Visible=',Visible,' HandleAllocated=',HandleAllocated);
Form := GetParentForm(self);
if Form <> nil then
Form.FocusControl(self)
Form.FocusControl(self)
else
if Visible and HandleAllocated then
LCLLinux.SetFocus(Handle);
LCLLinux.SetFocus(Handle);
end;
{------------------------------------------------------------------------------}
@ -1995,6 +1995,9 @@ end;
{ =============================================================================
$Log$
Revision 1.49 2002/01/21 14:17:47 lazarus
MG: added find-block-start and renamed find-block-other-end
Revision 1.48 2002/01/01 15:50:15 lazarus
MG: fixed initial component aligning

View File

@ -3777,37 +3777,46 @@ function TgtkObject.SetFocus(hWnd: HWND): HWND;
var
TopLevel: PGTKWidget;
begin
if hwnd = 0
then
//writeln('[TgtkObject.SetFocus] A hWnd=',HexStr(Cardinal(hWnd),8));
if hwnd = 0 then
Result := 0
else begin
// return the old focus handle
Result := GetFocus;
TopLevel := gtk_widget_get_toplevel(PGTKWidget(hWND));
//writeln('[TgtkObject.SetFocus] B hWnd=',HexStr(Cardinal(hWnd),8),' Result=',HexStr(Cardinal(Result),8),' TopLevel=',HexStr(Cardinal(TopLevel),8));
if gtk_type_is_a(gtk_object_type(PGTKObject(TopLevel)), gtk_window_get_type)
then begin
if GTK_WIDGET_CAN_FOCUS(TOPLEVEL) then
gtk_window_set_focus(PGTKWindow(TopLevel), PGTKWidget(hWND))
else
begin
if gtk_type_is_a(gtk_object_type(PGTKObject(hwnd)), gtk_combo_get_type) then
Begin
gtk_widget_grab_focus(PgtkWidget(PGtkCombo(hwnd)^.entry));
end
else
if GetCoreChildWidget(PGtkWidget(Hwnd)) <> nil then
gtk_widget_grab_focus(GetCoreChildWidget(PGtkWidget(Hwnd)))
else
gtk_widget_grab_focus(PgtkWidget(hwnd));
end;
end
else
begin
if GTK_WIDGET_CAN_FOCUS(PgtkWidget(hwnd)) then
gtk_widget_grab_focus(PgtkWidget(hwnd));
end;
//writeln('[TgtkObject.SetFocus] C TopLevel is a gtkwindow');
// TopLevel is a gtkwindow
if GTK_WIDGET_CAN_FOCUS(TOPLEVEL) then begin
// TopLevel window can focus
//writeln('[TgtkObject.SetFocus] D TopLevel window can focus');
gtk_window_set_focus(PGTKWindow(TopLevel), PGTKWidget(hWND))
end
else begin
// TopLevel window can not focus
//writeln('[TgtkObject.SetFocus] E TopLevel window can not focus');
if gtk_type_is_a(gtk_object_type(PGTKObject(hwnd)), gtk_combo_get_type)
then begin
// handle is a gtk combo
gtk_widget_grab_focus(PgtkWidget(PGtkCombo(hwnd)^.entry));
end
else if (GetCoreChildWidget(PGtkWidget(Hwnd)) <> nil) then begin
gtk_widget_grab_focus(GetCoreChildWidget(PGtkWidget(Hwnd)))
end
else begin
gtk_widget_grab_focus(PgtkWidget(hwnd));
end;
end;
end
else begin
if GTK_WIDGET_CAN_FOCUS(PgtkWidget(hwnd)) then begin
gtk_widget_grab_focus(PgtkWidget(hwnd));
end;
end;
end;
//writeln('[TgtkObject.SetFocus] END hWnd=',HexStr(Cardinal(hWnd),8),' Result=',HexStr(Cardinal(Result),8),' TopLevel=',HexStr(Cardinal(TopLevel),8),' NewFocus=',HexStr(Cardinal(GetFocus),8));
end;
Function TgtkObject.SetProp(Handle: hwnd; Str : PChar; Data : Pointer) : Boolean;
@ -4328,6 +4337,9 @@ end;
{ =============================================================================
$Log$
Revision 1.58 2002/01/21 14:17:47 lazarus
MG: added find-block-start and renamed find-block-other-end
Revision 1.57 2002/01/08 16:02:45 lazarus
Minor changes to TListView.
Added TImageList to the IDE

View File

@ -397,17 +397,24 @@ begin
);
// draw caret
if (PGTKStyle(PGTKWidget(Client)^.theStyle)<>nil)
{writeln('GTKAPIWidgetClient_DrawCaret B Client=',HexStr(Cardinal(Client),8)
,' ',cardinal(PGTKWidget(Client)^.theStyle)
,' ',cardinal(PGTKWidget(Client)^.Window)
,' ',Width
,' ',Height
);}
if (PGTKWidget(Client)^.theStyle<>nil)
and (PGTKWidget(Client)^.Window<>nil)
and (Width>0) and (Height>0)
and (PGTKWidget(Client)^.theStyle<>nil) then begin
and (Width>0) and (Height>0) then begin
// set draw function to xor
ForeGroundGC:=PGTKStyle(
PGTKWidget(Client)^.theStyle)^.fg_gc[GC_STATE[Integer(Pixmap) <> 1]];
//gdk_gc_get_values(ForeGroundGC,@ForeGroundGCValues);
//OldGdkFunction:=ForeGroundGCValues.thefunction;
//gdk_gc_set_function(ForeGroundGC,GDK_XOR);
// draw the caret
//writeln('DRAWING');
gdk_draw_rectangle(
PGTKWidget(Client)^.Window,
ForeGroundGC,
@ -418,10 +425,9 @@ begin
end else
writeln('***: Draw Caret failed: Client=',HexStr(Cardinal(Client),8),' X=',X,' Y=',Y,' W=',Width,' H=',Height,' ',Pixmap<>nil,',',PGTKWidget(Client)^.Window<>nil,',',PGTKWidget(Client)^.theStyle<>nil);
IsDrawn := True;
end;
//writeln('GTKAPIWidgetClient_DrawCaret A Client=',HexStr(Cardinal(Client),8),' Timer=',Timer,' Blink=',Blinking,' Visible=',Visible,' ShowHideOnFocus=',ShowHideOnFocus,' Focus=',gtk_widget_has_focus(Widget),' W=',Width,' H=',Height);
//writeln('GTKAPIWidgetClient_DrawCaret A Client=',HexStr(Cardinal(Client),8),' Timer=',Timer,' Blink=',Blinking,' Visible=',Visible,' ShowHideOnFocus=',ShowHideOnFocus,' Focus=',gtk_widget_has_focus(Widget),' IsDrawn=',IsDrawn,' W=',Width,' H=',Height);
if Visible and Blinking and (Timer = 0)
and (not ShowHideOnFocus or HasFocus)
then
@ -712,6 +718,9 @@ end.
{ =============================================================================
$Log$
Revision 1.20 2002/01/21 14:17:47 lazarus
MG: added find-block-start and renamed find-block-other-end
Revision 1.19 2001/12/17 12:14:40 lazarus
MG: tried to xor caret, but failed :(