fixed codetools ConstSet, implemented notifying TApplication whenmenu popups

git-svn-id: trunk@5776 -
This commit is contained in:
mattias 2004-08-13 10:20:19 +00:00
parent e8e2846b3e
commit 885b54ba20
10 changed files with 89 additions and 51 deletions

View File

@ -4691,15 +4691,6 @@ var EndPos, SubStartPos: integer;
if Result.Desc=xtContext then if Result.Desc=xtContext then
DebugLn(' Result.Context.Node=',Result.Context.Node.DescAsString); DebugLn(' Result.Context.Node=',Result.Context.Node.DescAsString);
{$ENDIF} {$ENDIF}
if not (Result.Desc in [xtConstOrdInteger,xtChar,xtWideChar])
and ((Result.Desc=xtContext)
and (Result.Context.Node.Desc<>ctnEnumerationType)) then
begin
MoveCursorToCleanPos(SubStartPos);
ReadNextAtom; // read '['
ReadNextAtom;
RaiseConstExpected;
end;
end else begin end else begin
// empty set '[]' // empty set '[]'
Result.Desc:=xtNone; Result.Desc:=xtNone;

View File

@ -46,7 +46,7 @@ type
end; end;
P2Pointer = ^T2Pointer; P2Pointer = ^T2Pointer;
TObjectList = class TObjectArray = class
private private
FCapacity: Integer; FCapacity: Integer;
FCount: Integer; FCount: Integer;
@ -85,29 +85,29 @@ type
implementation implementation
{ TObjectList } { TObjectArray }
function TObjectList.GetObject(Index: Integer): Pointer; function TObjectArray.GetObject(Index: Integer): Pointer;
begin begin
Result:=FList[Index].Associated; Result:=FList[Index].Associated;
end; end;
procedure TObjectList.PutObject(Index: Integer; const AValue: Pointer); procedure TObjectArray.PutObject(Index: Integer; const AValue: Pointer);
begin begin
FList[Index].Associated:=AValue; FList[Index].Associated:=AValue;
end; end;
function TObjectList.Get(Index: Integer): Pointer; function TObjectArray.Get(Index: Integer): Pointer;
begin begin
Result:=FList[Index].Item; Result:=FList[Index].Item;
end; end;
procedure TObjectList.Put(Index: Integer; const AValue: Pointer); procedure TObjectArray.Put(Index: Integer; const AValue: Pointer);
begin begin
FList[Index].Item:=AValue; FList[Index].Item:=AValue;
end; end;
procedure TObjectList.SetCapacity(const AValue: Integer); procedure TObjectArray.SetCapacity(const AValue: Integer);
begin begin
if FCapacity=AValue then exit; if FCapacity=AValue then exit;
FCapacity:=AValue; FCapacity:=AValue;
@ -115,36 +115,36 @@ begin
if FCount>FCapacity then FCount:=FCapacity; if FCount>FCapacity then FCount:=FCapacity;
end; end;
procedure TObjectList.SetCount(const AValue: Integer); procedure TObjectArray.SetCount(const AValue: Integer);
begin begin
if FCount=AValue then exit; if FCount=AValue then exit;
FCount:=AValue; FCount:=AValue;
if FCount>FCapacity then SetCapacity(AValue); if FCount>FCapacity then SetCapacity(AValue);
end; end;
procedure TObjectList.Grow; procedure TObjectArray.Grow;
begin begin
if FCapacity<5 then Capacity:=5 if FCapacity<5 then Capacity:=5
else Capacity:=Capacity*2; else Capacity:=Capacity*2;
end; end;
procedure TObjectList.Shrink; procedure TObjectArray.Shrink;
begin begin
Capacity:=Capacity div 2; Capacity:=Capacity div 2;
end; end;
destructor TObjectList.Destroy; destructor TObjectArray.Destroy;
begin begin
ReallocMem(FList,0); ReallocMem(FList,0);
inherited Destroy; inherited Destroy;
end; end;
function TObjectList.Add(Item: Pointer): Integer; function TObjectArray.Add(Item: Pointer): Integer;
begin begin
Result:=AddObject(Item,nil); Result:=AddObject(Item,nil);
end; end;
function TObjectList.AddObject(Item, Associated: Pointer): Integer; function TObjectArray.AddObject(Item, Associated: Pointer): Integer;
begin begin
if FCount=FCapacity then Grow; if FCount=FCapacity then Grow;
FList[FCount].Item:=Item; FList[FCount].Item:=Item;
@ -153,14 +153,14 @@ begin
inc(FCount); inc(FCount);
end; end;
procedure TObjectList.Clear; procedure TObjectArray.Clear;
begin begin
FCount:=0; FCount:=0;
ReallocMem(FList,0); ReallocMem(FList,0);
FCapacity:=0; FCapacity:=0;
end; end;
procedure TObjectList.Delete(Index: Integer); procedure TObjectArray.Delete(Index: Integer);
begin begin
if FCount>Index+1 then if FCount>Index+1 then
System.Move(FList[Index+1],FList[Index],SizeOf(T2Pointer)*(FCount-Index-1)); System.Move(FList[Index+1],FList[Index],SizeOf(T2Pointer)*(FCount-Index-1));
@ -168,7 +168,7 @@ begin
if FCapacity>FCount*4 then Shrink; if FCapacity>FCount*4 then Shrink;
end; end;
procedure TObjectList.Exchange(Index1, Index2: Integer); procedure TObjectArray.Exchange(Index1, Index2: Integer);
var var
SwapDummy: T2Pointer; SwapDummy: T2Pointer;
begin begin
@ -178,7 +178,7 @@ begin
FList[Index2]:=SwapDummy; FList[Index2]:=SwapDummy;
end; end;
function TObjectList.First: Pointer; function TObjectArray.First: Pointer;
begin begin
if FCount>0 then if FCount>0 then
Result:=FList[0].Item Result:=FList[0].Item
@ -186,18 +186,18 @@ begin
Result:=nil; Result:=nil;
end; end;
function TObjectList.IndexOf(Item: Pointer): Integer; function TObjectArray.IndexOf(Item: Pointer): Integer;
begin begin
Result:=FCount-1; Result:=FCount-1;
while (Result>=0) and (FList[Result].Item<>Item) do dec(Result); while (Result>=0) and (FList[Result].Item<>Item) do dec(Result);
end; end;
procedure TObjectList.Insert(Index: Integer; Item: Pointer); procedure TObjectArray.Insert(Index: Integer; Item: Pointer);
begin begin
InsertObject(Index,Item,nil); InsertObject(Index,Item,nil);
end; end;
procedure TObjectList.InsertObject(Index: Integer; Item, Associated: Pointer); procedure TObjectArray.InsertObject(Index: Integer; Item, Associated: Pointer);
begin begin
if FCount=FCapacity then Grow; if FCount=FCapacity then Grow;
if Index<FCount then if Index<FCount then
@ -207,7 +207,7 @@ begin
FList[Index].Associated:=Associated; FList[Index].Associated:=Associated;
end; end;
function TObjectList.Last: Pointer; function TObjectArray.Last: Pointer;
begin begin
if FCount>0 then if FCount>0 then
Result:=FList[FCount-1].Item Result:=FList[FCount-1].Item
@ -215,7 +215,7 @@ begin
Result:=nil; Result:=nil;
end; end;
procedure TObjectList.Move(CurIndex, NewIndex: Integer); procedure TObjectArray.Move(CurIndex, NewIndex: Integer);
var var
SwapDummy: T2Pointer; SwapDummy: T2Pointer;
begin begin
@ -230,7 +230,7 @@ begin
FList[NewIndex]:=SwapDummy; FList[NewIndex]:=SwapDummy;
end; end;
procedure TObjectList.Assign(SrcList: TList); procedure TObjectArray.Assign(SrcList: TList);
var var
i: Integer; i: Integer;
begin begin
@ -242,13 +242,13 @@ begin
end; end;
end; end;
function TObjectList.Remove(Item: Pointer): Integer; function TObjectArray.Remove(Item: Pointer): Integer;
begin begin
Result:=IndexOf(Item); Result:=IndexOf(Item);
if Result>=0 then Delete(Result); if Result>=0 then Delete(Result);
end; end;
procedure TObjectList.Pack; procedure TObjectArray.Pack;
var var
SrcID: Integer; SrcID: Integer;
DestID: Integer; DestID: Integer;

View File

@ -49,7 +49,8 @@ interface
uses uses
Classes, SysUtils, LCLProc, Forms, StdCtrls, Buttons, ActnList, ExtCtrls, Classes, SysUtils, LCLProc, Forms, StdCtrls, Buttons, ActnList, ExtCtrls,
Controls, Dialogs, ObjInspStrConsts, ComponentEditors, PropEdits; Controls, Dialogs, ObjInspStrConsts, ComponentEditors, PropEdits, DBActns,
StdActns;
type type
{ TActionListEditor } { TActionListEditor }
@ -786,9 +787,22 @@ end;
procedure RegisterStandardActions; procedure RegisterStandardActions;
begin begin
// TODO // TODO
// - db actions
// - edit actions
// - default images for actions // - default images for actions
// register edit actions
RegisterActions('Edit',[TEditCut,TEditCopy,TEditPaste,TEditSelectAll,
TEditUndo,TEditDelete],nil);
// register help actions
RegisterActions('Help',[THelpAction,THelpContents,THelpTopicSearch,
THelpOnHelp,THelpContextAction],nil);
// register file actions
RegisterActions('File',[TFileOpen,TFileOpenWith,TFileSaveAs,TFileExit],nil);
// register dialog actions
RegisterActions('Dialog',[TFontEdit,TColorSelect],nil);
// register database actions
RegisterActions('Database',[TDataSetFirst,TDataSetLast,TDataSetNext,
TDataSetPrior,TDataSetRefresh,TDataSetCancel,TDataSetDelete,TDataSetEdit,
TDataSetInsert,TDataSetPost],nil);
end; end;
initialization initialization

View File

@ -829,7 +829,7 @@ type
procedure RemoveHandler(HandlerType: TApplicationHandlerType; procedure RemoveHandler(HandlerType: TApplicationHandlerType;
const Handler: TMethod); const Handler: TMethod);
protected protected
Function GetConsoleApplication: boolean; override; function GetConsoleApplication: boolean; override;
procedure NotifyIdleHandler; procedure NotifyIdleHandler;
procedure NotifyIdleEndHandler; procedure NotifyIdleEndHandler;
function IsHintMsg(var Msg: TMsg): Boolean; function IsHintMsg(var Msg: TMsg): Boolean;
@ -840,6 +840,7 @@ type
procedure StartHintTimer(Interval: integer; TimerType: TAppHintTimerType); procedure StartHintTimer(Interval: integer; TimerType: TAppHintTimerType);
procedure UpdateVisible; procedure UpdateVisible;
procedure DoIdleActions; procedure DoIdleActions;
procedure MenuPopupHandler(Sender: TObject);
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -1089,9 +1090,9 @@ function GetLongHint(const Hint: string): string;
var var
Application : TApplication; Application: TApplication;
Screen : TScreen; Screen: TScreen;
ExceptionObject : TExceptObject; ExceptionObject: TExceptObject;
HintWindowClass: THintWindowClass; HintWindowClass: THintWindowClass;
type type

View File

@ -87,6 +87,8 @@ begin
FOnIdle := nil; FOnIdle := nil;
FIcon := nil; FIcon := nil;
ApplicationActionComponent:=Self; ApplicationActionComponent:=Self;
OnMenuPopupHandler:=@MenuPopupHandler;
inherited Create(AOwner); inherited Create(AOwner);
CaptureExceptions:=true; CaptureExceptions:=true;
@ -99,6 +101,9 @@ destructor TApplication.Destroy;
var var
HandlerType: TApplicationHandlerType; HandlerType: TApplicationHandlerType;
begin begin
if OnMenuPopupHandler=@MenuPopupHandler then
OnMenuPopupHandler:=nil;
// shutting down // shutting down
CancelHint; CancelHint;
ShowHint := False; ShowHint := False;
@ -675,6 +680,11 @@ begin
end; end;
end; end;
procedure TApplication.MenuPopupHandler(Sender: TObject);
begin
HideHint;
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Method: TApplication.IconChanged Method: TApplication.IconChanged
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
@ -953,9 +963,8 @@ begin
if Assigned(FOnHint) then if Assigned(FOnHint) then
FOnHint(Self) FOnHint(Self)
else begin else begin
{ Fire THintAction to anyone interested } // Send THintAction
{with THintAction.Create(Self) do {with THintAction.Create(Self) do begin
begin
Hint := Value; Hint := Value;
try try
Execute; Execute;
@ -1205,6 +1214,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.85 2004/08/13 10:20:19 mattias
fixed codetools ConstSet, implemented notifying TApplication whenmenu popups
Revision 1.84 2004/08/09 21:12:43 mattias Revision 1.84 2004/08/09 21:12:43 mattias
implemented FormStyle fsSplash for splash screens implemented FormStyle fsSplash for splash screens

View File

@ -49,11 +49,13 @@ procedure TMenuItem.Click;
begin begin
if Enabled then if Enabled then
begin begin
if Assigned(OnMenuPopupHandler) then OnMenuPopupHandler(Self);
if (not Assigned(ActionLink) and AutoCheck) or (Assigned(ActionLink) and if (not Assigned(ActionLink) and AutoCheck) or (Assigned(ActionLink) and
not (ActionLink.IsAutoCheckLinked) and AutoCheck) not (ActionLink.IsAutoCheckLinked) and AutoCheck)
then begin then begin
// Break a little Delphi compatibility // Break a little Delphi compatibility
// It makes no sense to uncheck a checked RadioItem (besides, GTK cant handle it) // It makes no sense to uncheck a checked RadioItem (besides, GTK can't handle it)
if (not RadioItem) or (not Checked) then if (not RadioItem) or (not Checked) then
Checked := not Checked; Checked := not Checked;
end; end;
@ -1162,6 +1164,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.59 2004/08/13 10:20:19 mattias
fixed codetools ConstSet, implemented notifying TApplication whenmenu popups
Revision 1.58 2004/06/24 17:45:33 mattias Revision 1.58 2004/06/24 17:45:33 mattias
fixed TMenuItem.GetIconSize fixed TMenuItem.GetIconSize
@ -1364,6 +1369,9 @@ end;
$Log$ $Log$
Revision 1.59 2004/08/13 10:20:19 mattias
fixed codetools ConstSet, implemented notifying TApplication whenmenu popups
Revision 1.58 2004/06/24 17:45:33 mattias Revision 1.58 2004/06/24 17:45:33 mattias
fixed TMenuItem.GetIconSize fixed TMenuItem.GetIconSize

View File

@ -57,6 +57,7 @@ begin
ActivePopupMenu:=Self; ActivePopupMenu:=Self;
Items.InitiateActions; Items.InitiateActions;
HandleNeeded; HandleNeeded;
if Assigned(OnMenuPopupHandler) then OnMenuPopupHandler(Self);
SendMsgToInterface(LM_POPUPSHOW, Self, @FPopupPoint); SendMsgToInterface(LM_POPUPSHOW, Self, @FPopupPoint);
end; end;
@ -77,6 +78,9 @@ end;
{ {
$Log$ $Log$
Revision 1.12 2004/08/13 10:20:19 mattias
fixed codetools ConstSet, implemented notifying TApplication whenmenu popups
Revision 1.11 2004/07/10 18:17:30 mattias Revision 1.11 2004/07/10 18:17:30 mattias
added Delphi ToDo support, Application.WndProc, small bugfixes from Colin added Delphi ToDo support, Application.WndProc, small bugfixes from Colin

View File

@ -178,7 +178,7 @@ type
protected protected
property ActionLink: TMenuActionLink read FActionLink write FActionLink; property ActionLink: TMenuActionLink read FActionLink write FActionLink;
public public
FCompStyle : LongInt; FCompStyle: LongInt;
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
function GetImageList: TCustomImageList; virtual; function GetImageList: TCustomImageList; virtual;
@ -333,6 +333,7 @@ function ShortCutToText(ShortCut: TShortCut): string;
var var
DesignerMenuItemClick: TNotifyEvent; DesignerMenuItemClick: TNotifyEvent;
ActivePopupMenu: TPopupMenu; ActivePopupMenu: TPopupMenu;
OnMenuPopupHandler: TNotifyEvent;
procedure Register; procedure Register;
@ -401,6 +402,7 @@ initialization
DesignerMenuItemClick:=nil; DesignerMenuItemClick:=nil;
ActivePopupMenu:=nil; ActivePopupMenu:=nil;
CommandPool := nil; CommandPool := nil;
OnMenuPopupHandler := nil;
finalization finalization
FreeThenNil(CommandPool); FreeThenNil(CommandPool);
@ -409,6 +411,9 @@ end.
{ {
$Log$ $Log$
Revision 1.69 2004/08/13 10:20:19 mattias
fixed codetools ConstSet, implemented notifying TApplication whenmenu popups
Revision 1.68 2004/06/17 21:24:19 mattias Revision 1.68 2004/06/17 21:24:19 mattias
implemented painting menuitem icons from ImageList implemented painting menuitem icons from ImageList

View File

@ -592,7 +592,6 @@ type
TCustomMemo = class(TCustomEdit) TCustomMemo = class(TCustomEdit)
private private
//FFont : TFont;
FHorzScrollBar: TMemoScrollBar; FHorzScrollBar: TMemoScrollBar;
FLines: TStrings; FLines: TStrings;
FScrollBars: TScrollStyle; FScrollBars: TScrollStyle;
@ -1159,6 +1158,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.157 2004/08/13 10:20:19 mattias
fixed codetools ConstSet, implemented notifying TApplication whenmenu popups
Revision 1.156 2004/08/05 21:20:47 mattias Revision 1.156 2004/08/05 21:20:47 mattias
moved designer/abstractformeditor.pp to ideintf/formeditingintf.pas moved designer/abstractformeditor.pp to ideintf/formeditingintf.pas

View File

@ -174,7 +174,7 @@ type
ComponentClassnames: TStrings): TModalResult; override; ComponentClassnames: TStrings): TModalResult; override;
function GetMissingDependenciesForUnit(const UnitFilename: string; function GetMissingDependenciesForUnit(const UnitFilename: string;
ComponentClassnames: TStrings; ComponentClassnames: TStrings;
var List: TObjectList): TModalResult; var List: TObjectArray): TModalResult;
function GetOwnersOfUnit(const UnitFilename: string): TList; function GetOwnersOfUnit(const UnitFilename: string): TList;
// package graph // package graph
@ -2480,7 +2480,7 @@ var
UnitBuf: TCodeBuffer; UnitBuf: TCodeBuffer;
UnitNames: TStringList; UnitNames: TStringList;
Packages: TList; Packages: TList;
MissingDependencies: TObjectList; MissingDependencies: TObjectArray;
function LoadAndParseUnitBuf: TModalResult; function LoadAndParseUnitBuf: TModalResult;
begin begin
@ -2670,7 +2670,8 @@ end;
function TPkgManager.GetMissingDependenciesForUnit( function TPkgManager.GetMissingDependenciesForUnit(
const UnitFilename: string; ComponentClassnames: TStrings; const UnitFilename: string; ComponentClassnames: TStrings;
var List: TObjectList): TModalResult; var List: TObjectArray): TModalResult;
// returns a list of packages needed to use the Component in the unit
var var
UnitOwners: TList; UnitOwners: TList;
UnitOwner: TObject; UnitOwner: TObject;
@ -2706,7 +2707,7 @@ begin
and (FindCompatibleDependencyInList(FirstDependency,pdlRequires, and (FindCompatibleDependencyInList(FirstDependency,pdlRequires,
RequiredPackage)=nil) RequiredPackage)=nil)
then begin then begin
if List=nil then List:=TObjectList.Create; if List=nil then List:=TObjectArray.Create;
List.AddObject(UnitOwner,RequiredPackage); List.AddObject(UnitOwner,RequiredPackage);
//writeln('TPkgManager.GetMissingDependenciesForUnit A ',UnitOwner.ClassName,' ',RequiredPackage.Name); //writeln('TPkgManager.GetMissingDependenciesForUnit A ',UnitOwner.ClassName,' ',RequiredPackage.Name);
//if TObject(List[List.Count-1])<>UnitOwner then RaiseException('A'); //if TObject(List[List.Count-1])<>UnitOwner then RaiseException('A');