added Windows menu to IDE

git-svn-id: trunk@3782 -
This commit is contained in:
mattias 2003-01-04 11:58:32 +00:00
parent 8a3ea01fb5
commit 4f99bbbbf7
6 changed files with 127 additions and 16 deletions

View File

@ -99,6 +99,7 @@ resourcestring
lisMenuRun = '&Run'; lisMenuRun = '&Run';
lisMenuTools = '&Tools'; lisMenuTools = '&Tools';
lisMenuEnvironent = 'E&nvironment'; lisMenuEnvironent = 'E&nvironment';
lisMenuWindows = '&Windows';
lisMenuHelp = '&Help'; lisMenuHelp = '&Help';
lisMenuNewUnit = 'New Unit'; lisMenuNewUnit = 'New Unit';

View File

@ -43,7 +43,7 @@ uses
Classes, LazarusIDEStrConsts, LCLType, LclLinux, Compiler, StdCtrls, Forms, Classes, LazarusIDEStrConsts, LCLType, LclLinux, Compiler, StdCtrls, Forms,
Buttons, Menus, ComCtrls, Spin, Project, SysUtils, FileCtrl, Controls, Buttons, Menus, ComCtrls, Spin, Project, SysUtils, FileCtrl, Controls,
Graphics, ExtCtrls, Dialogs, LazConf, CompReg, CodeToolManager, Graphics, ExtCtrls, Dialogs, LazConf, CompReg, CodeToolManager,
ObjectInspector, PropEdits, SynEditKeyCmds, OutputFilter, Splash, ObjectInspector, PropEdits, SynEditKeyCmds, OutputFilter,
MsgView, EnvironmentOpts, EditorOptions, IDEComp, FormEditor, MsgView, EnvironmentOpts, EditorOptions, IDEComp, FormEditor,
KeyMapping, IDEProcs, UnitEditor, Debugger, IDEOptionDefs, CodeToolsDefines; KeyMapping, IDEProcs, UnitEditor, Debugger, IDEOptionDefs, CodeToolsDefines;
@ -143,6 +143,7 @@ type
mnuRun: TMenuItem; mnuRun: TMenuItem;
mnuTools: TMenuItem; mnuTools: TMenuItem;
mnuEnvironment: TMenuItem; mnuEnvironment: TMenuItem;
mnuWindows: TMenuItem;
mnuHelp: TMenuItem; mnuHelp: TMenuItem;
itmFileNewUnit : TMenuItem; itmFileNewUnit : TMenuItem;
@ -273,6 +274,7 @@ type
// hints. Note/ToDo: hints should be controlled by the lcl, this is a workaround // hints. Note/ToDo: hints should be controlled by the lcl, this is a workaround
HintTimer1 : TIdleTimer; HintTimer1 : TIdleTimer;
HintWindow1 : THintWindow; HintWindow1 : THintWindow;
procedure mnuWindowsItemClick(Sender: TObject);
protected protected
TheCompiler: TCompiler; TheCompiler: TCompiler;
TheOutputFilter: TOutputFilter; TheOutputFilter: TOutputFilter;
@ -286,6 +288,7 @@ type
procedure SetupRunMenu; virtual; procedure SetupRunMenu; virtual;
procedure SetupToolsMenu; virtual; procedure SetupToolsMenu; virtual;
procedure SetupEnvironmentMenu; virtual; procedure SetupEnvironmentMenu; virtual;
procedure SetupWindowsMenu; virtual;
procedure SetupHelpMenu; virtual; procedure SetupHelpMenu; virtual;
procedure LoadMenuShortCuts; virtual; procedure LoadMenuShortCuts; virtual;
@ -307,6 +310,8 @@ type
function DoCheckFilesOnDisk: TModalResult; virtual; abstract; function DoCheckFilesOnDisk: TModalResult; virtual; abstract;
function DoCheckAmbigiousSources(const AFilename: string; function DoCheckAmbigiousSources(const AFilename: string;
Compiling: boolean): TModalResult; Compiling: boolean): TModalResult;
procedure UpdateWindowsMenu; virtual;
end; end;
var var
@ -380,6 +385,18 @@ end;
{ TMainIDEBar } { TMainIDEBar }
procedure TMainIDEBar.mnuWindowsItemClick(Sender: TObject);
var
i: Integer;
begin
i:=Screen.CustomFormCount-1;
while (i>=0) do begin
if Screen.CustomForms[i].Caption=TMenuItem(Sender).Caption then
Screen.CustomForms[i].BringToFront;
dec(i);
end;
end;
function TMainIDEBar.CreateMenuSeparator : TMenuItem; function TMainIDEBar.CreateMenuSeparator : TMenuItem;
begin begin
Result := TMenuItem.Create(Self); Result := TMenuItem.Create(Self);
@ -1038,6 +1055,11 @@ begin
mnuEnvironment.Add(itmEnvCodeToolsDefinesEditor); mnuEnvironment.Add(itmEnvCodeToolsDefinesEditor);
end; end;
procedure TMainIDEBar.SetupWindowsMenu;
begin
end;
procedure TMainIDEBar.SetupHelpMenu; procedure TMainIDEBar.SetupHelpMenu;
begin begin
itmHelpAboutLazarus := TMenuItem.Create(Self); itmHelpAboutLazarus := TMenuItem.Create(Self);
@ -1261,6 +1283,51 @@ begin
end; end;
end; end;
procedure TMainIDEBar.UpdateWindowsMenu;
var
WindowsList: TList;
i: Integer;
CurMenuItem: TMenuItem;
AForm: TForm;
begin
WindowsList:=TList.Create;
// add typical IDE windows
if (SourceNotebook<>nil) and (SourceNotebook.Visible) then
WindowsList.Add(SourceNotebook);
if (ObjectInspector1<>nil) and (ObjectInspector1.Visible) then
WindowsList.Add(ObjectInspector1);
// add special IDE windows
for i:=0 to Screen.FormCount-1 do begin
AForm:=Screen.Forms[i];
if (AForm<>Self) and (AForm<>SplashForm)
and (AForm.Designer=nil) and (AForm.Visible)
and (WindowsList.IndexOf(AForm)<0) then
WindowsList.Add(AForm);
end;
// add designer forms and datamodule forms
for i:=0 to Screen.FormCount-1 do begin
AForm:=Screen.Forms[i];
if (AForm.Designer<>nil) and (WindowsList.IndexOf(AForm)<0) then
WindowsList.Add(AForm);
end;
// add menuitems
for i:=0 to WindowsList.Count-1 do begin
if mnuWindows.Count>i then
CurMenuItem:=mnuWindows.Items[i]
else begin
CurMenuItem:=TMenuItem.Create(Self);
mnuWindows.Add(CurMenuItem);
CurMenuItem.OnClick:=@mnuWindowsItemClick;
end;
CurMenuItem.Caption:=TCustomForm(WindowsList[i]).Caption;
end;
// remove unused menuitems
while mnuWindows.Count>WindowsList.Count do
mnuWindows.Items[mnuWindows.Count-1].Free;
// clean up
WindowsList.Free;
end;
end. end.

View File

@ -450,6 +450,7 @@ type
FCursor: TCursor; FCursor: TCursor;
FCursorCount: integer; FCursorCount: integer;
FCursorList: PCursorRec; FCursorList: PCursorRec;
FCustomForms: TList;
FDefaultCursor: HCURSOR; FDefaultCursor: HCURSOR;
FFocusedForm: TCustomForm; FFocusedForm: TCustomForm;
FFonts : TStrings; FFonts : TStrings;
@ -466,13 +467,15 @@ type
procedure DeleteCursor(Index: Integer); procedure DeleteCursor(Index: Integer);
procedure DestroyCursors; procedure DestroyCursors;
function GetCursors(Index: Integer): HCURSOR; function GetCursors(Index: Integer): HCURSOR;
function GetCustomFormCount: Integer;
function GetCustomForms(Index: Integer): TCustomForm;
function GetFonts : TStrings; function GetFonts : TStrings;
function GetFormCount: Integer; function GetFormCount: Integer;
function GetForms(IIndex: Integer): TForm; function GetForms(IIndex: Integer): TForm;
function GetHeight : Integer; function GetHeight : Integer;
function GetWidth : Integer; function GetWidth : Integer;
procedure AddForm(FForm: TCustomForm); procedure AddForm(AForm: TCustomForm);
procedure RemoveForm(FForm: TCustomForm); procedure RemoveForm(AForm: TCustomForm);
procedure SetCursor(const AValue: TCursor); procedure SetCursor(const AValue: TCursor);
procedure SetCursors(Index: Integer; const AValue: HCURSOR); procedure SetCursors(Index: Integer; const AValue: HCURSOR);
procedure UpdateLastActive; procedure UpdateLastActive;
@ -485,6 +488,8 @@ type
property ActiveForm: TForm read FActiveForm; property ActiveForm: TForm read FActiveForm;
property Cursor: TCursor read FCursor write SetCursor; property Cursor: TCursor read FCursor write SetCursor;
property Cursors[Index: Integer]: HCURSOR read GetCursors write SetCursors; property Cursors[Index: Integer]: HCURSOR read GetCursors write SetCursors;
property CustomFormCount: Integer read GetCustomFormCount;
property CustomForms[Index: Integer]: TCustomForm read GetCustomForms;
property FormCount: Integer read GetFormCount; property FormCount: Integer read GetFormCount;
property Forms[Index: Integer]: TForm read GetForms; property Forms[Index: Integer]: TForm read GetForms;
property Fonts : TStrings read GetFonts; property Fonts : TStrings read GetFonts;
@ -600,6 +605,7 @@ type
procedure ShowHintWindow(const Info: THintInfoAtMouse); procedure ShowHintWindow(const Info: THintInfoAtMouse);
procedure StartHintTimer(Interval: integer; TimerType: TAppHintTimerType); procedure StartHintTimer(Interval: integer; TimerType: TAppHintTimerType);
procedure OnHintTimer(Sender: TObject); procedure OnHintTimer(Sender: TObject);
procedure UpdateVisible;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;

View File

@ -536,6 +536,14 @@ begin
end; end;
end; end;
{------------------------------------------------------------------------------
procedure TApplication.UpdateVisible;
------------------------------------------------------------------------------}
procedure TApplication.UpdateVisible;
begin
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Method: TApplication.IconChanged Method: TApplication.IconChanged
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
@ -851,6 +859,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.45 2003/01/04 11:58:32 mattias
added Windows menu to IDE
Revision 1.44 2002/12/27 17:12:37 mattias Revision 1.44 2002/12/27 17:12:37 mattias
added more Delphi win32 compatibility functions added more Delphi win32 compatibility functions

View File

@ -30,6 +30,7 @@ begin
inherited Create(AOwner); inherited Create(AOwner);
FFonts := TStringlist.Create; FFonts := TStringlist.Create;
TStringlist(FFonts).Sorted := True; TStringlist(FFonts).Sorted := True;
FCustomForms:=TList.Create;
FFormList := TList.Create; FFormList := TList.Create;
FPixelsPerInch:= ScreenInfo.PixelsPerInchX; FPixelsPerInch:= ScreenInfo.PixelsPerInchX;
FHintFont := TFont.Create; FHintFont := TFont.Create;
@ -52,6 +53,7 @@ Destructor TScreen.Destroy;
begin begin
FreeThenNil(FHintFont); FreeThenNil(FHintFont);
FreeThenNil(FFormList); FreeThenNil(FFormList);
FreeThenNil(FCustomForms);
FreeThenNil(FSaveFocusedList); FreeThenNil(FSaveFocusedList);
FreeThenNil(FFonts); FreeThenNil(FFonts);
inherited Destroy; inherited Destroy;
@ -137,6 +139,22 @@ begin
end; end;
end; end;
{------------------------------------------------------------------------------
function TScreen.GetCustomFormCount: Integer;
------------------------------------------------------------------------------}
function TScreen.GetCustomFormCount: Integer;
begin
Result:=FCustomForms.Count;
end;
{------------------------------------------------------------------------------
function TScreen.GetCustomForms(Index: Integer): TCustomForm;
------------------------------------------------------------------------------}
function TScreen.GetCustomForms(Index: Integer): TCustomForm;
begin
Result := TCustomForm(FCustomForms[Index]);
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Function: TScreen.AddForm Function: TScreen.AddForm
Params: FForm: The form to be added Params: FForm: The form to be added
@ -144,12 +162,16 @@ end;
Do not use this procedure. This procedure is used by TScreen internally. Do not use this procedure. This procedure is used by TScreen internally.
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TScreen.AddForm(FForm: TCustomForm); procedure TScreen.AddForm(AForm: TCustomForm);
begin begin
FFormList.Add(FForm); FCustomForms.Add(AForm);
if AForm is TForm then
begin
FFormList.Add(AForm);
Application.UpdateVisible;
end;
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Function: TScreen.GetFormCount Function: TScreen.GetFormCount
Params: none Params: none
@ -162,7 +184,6 @@ begin
Result := FFormList.Count; Result := FFormList.Count;
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Function: TScreen.GetForms Function: TScreen.GetForms
Params: IIndex: The index of the form Params: IIndex: The index of the form
@ -175,7 +196,6 @@ begin
Result := TForm(FFormList.Items[IIndex]); Result := TForm(FFormList.Items[IIndex]);
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Method: TScreen.GetWidth Method: TScreen.GetWidth
Params: none Params: none
@ -188,7 +208,6 @@ begin
Result := GetSystemMetrics(SM_CXSCREEN); Result := GetSystemMetrics(SM_CXSCREEN);
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Method: TScreen.GetHeight Method: TScreen.GetHeight
Params: none Params: none
@ -209,9 +228,13 @@ end;
Do not use this procedure. This procedure is used by TScreen internally. Do not use this procedure. This procedure is used by TScreen internally.
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TScreen.RemoveForm(FForm: TCustomForm); procedure TScreen.RemoveForm(AForm: TCustomForm);
begin begin
FFormList.Remove(FForm); FCustomForms.Remove(AForm);
FFormList.Remove(AForm);
Application.UpdateVisible;
//if (FCustomForms.Count = 0) and (Application.FHintWindow <> nil) then
// Application.FHintWindow.ReleaseHandle;
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------

View File

@ -104,10 +104,12 @@ type
FGraphic: TGraphic; FGraphic: TGraphic;
FGroupIndex: Byte; FGroupIndex: Byte;
FHandle: HMenu; FHandle: HMenu;
FHint : String; FHint: String;
FImageIndex : Integer; FImageIndex : Integer;
FItems: TList; // list of TMenuItem FItems: TList; // list of TMenuItem
FMenu: TMenu; FMenu: TMenu;
FOnChange: TMenuChangeEvent;
FOnClick: TNotifyEvent;
FParent: TMenuItem; FParent: TMenuItem;
FRadioItem: Boolean; FRadioItem: Boolean;
FRightJustify: boolean; FRightJustify: boolean;
@ -115,8 +117,6 @@ type
FShowAlwaysCheckable: boolean; FShowAlwaysCheckable: boolean;
FSubMenuImages: TCustomImageList; FSubMenuImages: TCustomImageList;
FVisible: Boolean; FVisible: Boolean;
FOnChange: TMenuChangeEvent;
FOnClick: TNotifyEvent;
function GetCount: Integer; function GetCount: Integer;
function GetItem(Index: Integer): TMenuItem; function GetItem(Index: Integer): TMenuItem;
function GetMenuIndex: Integer; function GetMenuIndex: Integer;
@ -204,7 +204,7 @@ type
read FSubMenuImages write SetSubMenuImages; read FSubMenuImages write SetSubMenuImages;
property Visible: Boolean property Visible: Boolean
read FVisible write SetVisible stored IsVisibleStored default True; read FVisible write SetVisible stored IsVisibleStored default True;
property OnClick: TNotifyEvent read FOnClick write FOnclick; property OnClick: TNotifyEvent read FOnClick write FOnClick;
end; end;
TFindItemKind = (fkCommand, fkHandle, fkShortCut); TFindItemKind = (fkCommand, fkHandle, fkShortCut);
@ -217,8 +217,8 @@ type
FImageChangeLink: TChangeLink; FImageChangeLink: TChangeLink;
FImages: TCustomImageList; FImages: TCustomImageList;
FItems: TMenuItem; FItems: TMenuItem;
FParent: TComponent;
FOnChange: TMenuChangeEvent; FOnChange: TMenuChangeEvent;
FParent: TComponent;
procedure SetImages(const AValue: TCustomImageList); procedure SetImages(const AValue: TCustomImageList);
procedure SetParent(const AValue: TComponent); procedure SetParent(const AValue: TComponent);
procedure ImageListChange(Sender: TObject); procedure ImageListChange(Sender: TObject);
@ -361,6 +361,9 @@ end.
{ {
$Log$ $Log$
Revision 1.36 2003/01/04 11:58:32 mattias
added Windows menu to IDE
Revision 1.35 2002/12/02 16:38:13 mattias Revision 1.35 2002/12/02 16:38:13 mattias
started position highlighter started position highlighter