From 10e045f31906ee551e02b619fc374b493a37807c Mon Sep 17 00:00:00 2001 From: mattias Date: Mon, 2 Dec 2002 10:44:57 +0000 Subject: [PATCH] fixed SourceChangeCache when nothing has changed git-svn-id: trunk@3682 - --- components/codetools/eventcodetool.pas | 5 +- components/codetools/sourcechanger.pas | 6 +- components/synedit/synedithighlighter.pp | 3 +- designer/objectinspector.pp | 151 ++++++++++++----------- 4 files changed, 86 insertions(+), 79 deletions(-) diff --git a/components/codetools/eventcodetool.pas b/components/codetools/eventcodetool.pas index 71c5325958..8692c12cbc 100644 --- a/components/codetools/eventcodetool.pas +++ b/components/codetools/eventcodetool.pas @@ -460,10 +460,9 @@ end; function TEventsCodeTool.JumpToPublishedMethodBody(const UpperClassName, UpperMethodName: string; var NewPos: TCodeXYPosition; var NewTopLine: integer): boolean; -var ANode: TCodeTreeNode; +var + ANode: TCodeTreeNode; begin - - // ToDo: method overloading ANode:=FindMethodNodeInImplementation(UpperClassName,UpperMethodName,true); Result:=FindJumpPointInProcNode(ANode,NewPos,NewTopLine); end; diff --git a/components/codetools/sourcechanger.pas b/components/codetools/sourcechanger.pas index d9c6b3cd1a..6a261d8870 100644 --- a/components/codetools/sourcechanger.pas +++ b/components/codetools/sourcechanger.pas @@ -633,6 +633,10 @@ begin Result:=true; exit; end; + if FEntries.Count=0 then begin + Result:=true; + exit; + end; if Assigned(FOnBeforeApplyChanges) then begin Abort:=false; FOnBeforeApplyChanges(Abort); @@ -655,7 +659,7 @@ begin InsertText:=FirstEntry.Text; // add after gap AddAfterGap(CurNode); - // add text from every nodes inserted at the same position + // add text from every node inserted at the same position PrecNode:=FEntries.FindPrecessor(CurNode); CurEntry:=FirstEntry; while (PrecNode<>nil) do begin diff --git a/components/synedit/synedithighlighter.pp b/components/synedit/synedithighlighter.pp index 684ac8220f..3820212cf6 100644 --- a/components/synedit/synedithighlighter.pp +++ b/components/synedit/synedithighlighter.pp @@ -40,8 +40,7 @@ uses {$ELSE} Graphics, {$IFDEF SYN_LAZARUS} - LCLLinux, - LCLType, GraphType, + LCLLinux, LCLType, GraphType, {$ELSE} Windows, {$ENDIF} diff --git a/designer/objectinspector.pp b/designer/objectinspector.pp index e8d1272a6b..462f3e08d3 100644 --- a/designer/objectinspector.pp +++ b/designer/objectinspector.pp @@ -203,6 +203,7 @@ type procedure AddSubEditor(PropEditor:TPropertyEditor); procedure SetRowValue; + procedure DoCallEdit; procedure RefreshValueEdit; Procedure ValueEditDblClick(Sender : TObject); procedure ValueEditMouseDown(Sender: TObject; Button:TMouseButton; @@ -690,6 +691,46 @@ begin end; end; +procedure TOIPropertyGrid.DoCallEdit; +var + CurRow:TOIPropertyGridRow; + OldChangeStep: integer; +begin +writeln('#################### TOIPropertyGrid.DoCallEdit'); + if (FStates*[pgsChangingItemIndex,pgsApplyingValue]<>[]) + or (FCurrentEdit=nil) + or (FItemIndex<0) + or (FItemIndex>=FRows.Count) + or ((FCurrentEditorLookupRoot<>nil) + and (FPropertyEditorHook<>nil) + and (FPropertyEditorHook.LookupRoot<>FCurrentEditorLookupRoot)) + then begin + exit; + end; + + OldChangeStep:=fChangeStep; + CurRow:=Rows[FItemIndex]; + if paDialog in CurRow.Editor.GetAttributes then begin + try + CurRow.Editor.Edit; + except + on E: Exception do begin + MessageDlg('Error',E.Message,mtError,[mbOk],0); + end; + end; + if (OldChangeStep<>FChangeStep) then begin + // the selection has changed + // => CurRow does not exist any more + exit; + end; + + if FCurrentEdit=ValueEdit then + ValueEdit.Text:=CurRow.Editor.GetVisualValue + else + ValueComboBox.Text:=CurRow.Editor.GetVisualValue; + end; +end; + procedure TOIPropertyGrid.RefreshValueEdit; var CurRow: TOIPropertyGridRow; @@ -769,21 +810,8 @@ begin end; procedure TOIPropertyGrid.ValueButtonClick(Sender: TObject); -var CurRow:TOIPropertyGridRow; begin -writeln('#################### TOIPropertyGrid.ValueButtonClick'); - if (FCurrentEdit<>nil) and (FItemIndex>=0) and (FItemIndex[]) + or (FCurrentEdit=nil) + or (FItemIndex<0) + or (FItemIndex>=FRows.Count) + or ((FCurrentEditorLookupRoot<>nil) + and (FPropertyEditorHook<>nil) + and (FPropertyEditorHook.LookupRoot<>FCurrentEditorLookupRoot)) + then begin + exit; + end; + FHintTimer.Enabled := False; - //if event, then either create it or go to it. - //if Edit box, then nothing - //if combobox, then select the next value - if (sender is TComboBox) then - Begin //either an Event of a enumeration or Boolean + if FCurrentEdit=ValueEdit then + CurValue:=ValueEdit.Text + else + CurValue:=ValueComboBox.Text; + if CurValue='' then begin + DoCallEdit; + exit; + end; - Position := Mouse.CursorPos; - if ( (FLastMouseMovePos.X <= 0) or (FLastMouseMOvePos.Y <= 0) - or (FLastMouseMovePos.X >= Width) or (FLastMouseMovePos.Y >= Height)) then - Exit; - - Position := ScreenToClient(Position); - if ((Position.X <=0) or (Position.X >= Width) or (Position.Y <= 0) - or (Position.Y >= Height)) then - Exit; - - Index:=MouseToIndex(Position.Y,false); - if (Index>=0) and (Index