mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-20 19:39:29 +01:00
fixed SourceChangeCache when nothing has changed
git-svn-id: trunk@3682 -
This commit is contained in:
parent
5c93adce8a
commit
10e045f319
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -40,8 +40,7 @@ uses
|
||||
{$ELSE}
|
||||
Graphics,
|
||||
{$IFDEF SYN_LAZARUS}
|
||||
LCLLinux,
|
||||
LCLType, GraphType,
|
||||
LCLLinux, LCLType, GraphType,
|
||||
{$ELSE}
|
||||
Windows,
|
||||
{$ENDIF}
|
||||
|
||||
@ -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<FRows.Count)
|
||||
and (FStates*[pgsChangingItemIndex,pgsApplyingValue]=[]) then
|
||||
begin
|
||||
CurRow:=Rows[FItemIndex];
|
||||
if paDialog in CurRow.Editor.GetAttributes then begin
|
||||
CurRow.Editor.Edit;
|
||||
if FCurrentEdit=ValueEdit then
|
||||
ValueEdit.Text:=CurRow.Editor.GetVisualValue
|
||||
else
|
||||
ValueComboBox.Text:=CurRow.Editor.GetVisualValue;
|
||||
end;
|
||||
end;
|
||||
DoCallEdit;
|
||||
end;
|
||||
|
||||
procedure TOIPropertyGrid.SetItemIndex(NewIndex:integer);
|
||||
@ -1614,70 +1642,47 @@ end;
|
||||
|
||||
PRocedure TOIPropertyGrid.ValueEditDblClick(Sender : TObject);
|
||||
var
|
||||
//Rect : TRect;
|
||||
Position : TPoint;
|
||||
Index: integer;
|
||||
PointedRow:TOIpropertyGridRow;
|
||||
CurRow: TOIPropertyGridRow;
|
||||
TypeKind : TTypeKind;
|
||||
Temp : String;
|
||||
CurValue: string;
|
||||
begin
|
||||
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;
|
||||
|
||||
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<FRows.Count) then
|
||||
begin
|
||||
PointedRow:=Rows[Index];
|
||||
if Assigned(PointedRow) then
|
||||
Begin
|
||||
|
||||
TypeKind := PointedRow.Editor.GetPropType^.Kind;
|
||||
case TypeKind of
|
||||
tkMethod : begin
|
||||
//event
|
||||
//if blank then create event!
|
||||
if TComboBox(sender).Text = '' then
|
||||
Begin
|
||||
//see if it's in the list first.
|
||||
Temp := TMethodPropertyEditor(PointedRow.Editor).GetFormMethodName;
|
||||
if (TComboBox(sender).Items.Indexof(Temp) = -1) then
|
||||
TComboBox(sender).Items.Add(Temp);
|
||||
//set the text
|
||||
TComboBox(sender).Text := Temp;
|
||||
end
|
||||
else //jump to event!
|
||||
Begin
|
||||
|
||||
end;
|
||||
|
||||
end;
|
||||
else
|
||||
Begin
|
||||
if TComboBox(Sender).Items.Count = 0 then Exit;
|
||||
if TComboBox(sender).ItemIndex < (TComboBox(sender).Items.Count-1) then
|
||||
TComboBox(sender).ItemIndex := TComboBox(sender).ItemIndex +1
|
||||
else
|
||||
TComboBox(sender).ItemIndex := 0;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
if (FCurrentEdit=ValueComboBox) then Begin
|
||||
//either an Event or an enumeration or Boolean
|
||||
CurRow:=Rows[FItemIndex];
|
||||
TypeKind := CurRow.Editor.GetPropType^.Kind;
|
||||
if TypeKind in [tkEnumeration,tkBool] then begin
|
||||
// set value to next value in list
|
||||
if ValueComboBox.Items.Count = 0 then Exit;
|
||||
if ValueComboBox.ItemIndex < (ValueComboBox.Items.Count-1) then
|
||||
ValueComboBox.ItemIndex := ValueComboBox.ItemIndex +1
|
||||
else
|
||||
ValueComboBox.ItemIndex := 0;
|
||||
end else if TypeKind=tkMethod then begin
|
||||
DoCallEdit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TOIPropertyGrid.SetBackgroundColor(const AValue: TColor);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user