mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 19:08:03 +02:00
added Windows menu to IDE
git-svn-id: trunk@3782 -
This commit is contained in:
parent
8a3ea01fb5
commit
4f99bbbbf7
@ -99,6 +99,7 @@ resourcestring
|
||||
lisMenuRun = '&Run';
|
||||
lisMenuTools = '&Tools';
|
||||
lisMenuEnvironent = 'E&nvironment';
|
||||
lisMenuWindows = '&Windows';
|
||||
lisMenuHelp = '&Help';
|
||||
|
||||
lisMenuNewUnit = 'New Unit';
|
||||
|
@ -43,7 +43,7 @@ uses
|
||||
Classes, LazarusIDEStrConsts, LCLType, LclLinux, Compiler, StdCtrls, Forms,
|
||||
Buttons, Menus, ComCtrls, Spin, Project, SysUtils, FileCtrl, Controls,
|
||||
Graphics, ExtCtrls, Dialogs, LazConf, CompReg, CodeToolManager,
|
||||
ObjectInspector, PropEdits, SynEditKeyCmds, OutputFilter,
|
||||
Splash, ObjectInspector, PropEdits, SynEditKeyCmds, OutputFilter,
|
||||
MsgView, EnvironmentOpts, EditorOptions, IDEComp, FormEditor,
|
||||
KeyMapping, IDEProcs, UnitEditor, Debugger, IDEOptionDefs, CodeToolsDefines;
|
||||
|
||||
@ -143,6 +143,7 @@ type
|
||||
mnuRun: TMenuItem;
|
||||
mnuTools: TMenuItem;
|
||||
mnuEnvironment: TMenuItem;
|
||||
mnuWindows: TMenuItem;
|
||||
mnuHelp: TMenuItem;
|
||||
|
||||
itmFileNewUnit : TMenuItem;
|
||||
@ -273,6 +274,7 @@ type
|
||||
// hints. Note/ToDo: hints should be controlled by the lcl, this is a workaround
|
||||
HintTimer1 : TIdleTimer;
|
||||
HintWindow1 : THintWindow;
|
||||
procedure mnuWindowsItemClick(Sender: TObject);
|
||||
protected
|
||||
TheCompiler: TCompiler;
|
||||
TheOutputFilter: TOutputFilter;
|
||||
@ -286,6 +288,7 @@ type
|
||||
procedure SetupRunMenu; virtual;
|
||||
procedure SetupToolsMenu; virtual;
|
||||
procedure SetupEnvironmentMenu; virtual;
|
||||
procedure SetupWindowsMenu; virtual;
|
||||
procedure SetupHelpMenu; virtual;
|
||||
|
||||
procedure LoadMenuShortCuts; virtual;
|
||||
@ -307,6 +310,8 @@ type
|
||||
function DoCheckFilesOnDisk: TModalResult; virtual; abstract;
|
||||
function DoCheckAmbigiousSources(const AFilename: string;
|
||||
Compiling: boolean): TModalResult;
|
||||
|
||||
procedure UpdateWindowsMenu; virtual;
|
||||
end;
|
||||
|
||||
var
|
||||
@ -380,6 +385,18 @@ end;
|
||||
|
||||
{ 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;
|
||||
begin
|
||||
Result := TMenuItem.Create(Self);
|
||||
@ -1038,6 +1055,11 @@ begin
|
||||
mnuEnvironment.Add(itmEnvCodeToolsDefinesEditor);
|
||||
end;
|
||||
|
||||
procedure TMainIDEBar.SetupWindowsMenu;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TMainIDEBar.SetupHelpMenu;
|
||||
begin
|
||||
itmHelpAboutLazarus := TMenuItem.Create(Self);
|
||||
@ -1261,6 +1283,51 @@ begin
|
||||
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.
|
||||
|
||||
|
10
lcl/forms.pp
10
lcl/forms.pp
@ -450,6 +450,7 @@ type
|
||||
FCursor: TCursor;
|
||||
FCursorCount: integer;
|
||||
FCursorList: PCursorRec;
|
||||
FCustomForms: TList;
|
||||
FDefaultCursor: HCURSOR;
|
||||
FFocusedForm: TCustomForm;
|
||||
FFonts : TStrings;
|
||||
@ -466,13 +467,15 @@ type
|
||||
procedure DeleteCursor(Index: Integer);
|
||||
procedure DestroyCursors;
|
||||
function GetCursors(Index: Integer): HCURSOR;
|
||||
function GetCustomFormCount: Integer;
|
||||
function GetCustomForms(Index: Integer): TCustomForm;
|
||||
function GetFonts : TStrings;
|
||||
function GetFormCount: Integer;
|
||||
function GetForms(IIndex: Integer): TForm;
|
||||
function GetHeight : Integer;
|
||||
function GetWidth : Integer;
|
||||
procedure AddForm(FForm: TCustomForm);
|
||||
procedure RemoveForm(FForm: TCustomForm);
|
||||
procedure AddForm(AForm: TCustomForm);
|
||||
procedure RemoveForm(AForm: TCustomForm);
|
||||
procedure SetCursor(const AValue: TCursor);
|
||||
procedure SetCursors(Index: Integer; const AValue: HCURSOR);
|
||||
procedure UpdateLastActive;
|
||||
@ -485,6 +488,8 @@ type
|
||||
property ActiveForm: TForm read FActiveForm;
|
||||
property Cursor: TCursor read FCursor write SetCursor;
|
||||
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 Forms[Index: Integer]: TForm read GetForms;
|
||||
property Fonts : TStrings read GetFonts;
|
||||
@ -600,6 +605,7 @@ type
|
||||
procedure ShowHintWindow(const Info: THintInfoAtMouse);
|
||||
procedure StartHintTimer(Interval: integer; TimerType: TAppHintTimerType);
|
||||
procedure OnHintTimer(Sender: TObject);
|
||||
procedure UpdateVisible;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
|
@ -536,6 +536,14 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
procedure TApplication.UpdateVisible;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TApplication.UpdateVisible;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TApplication.IconChanged
|
||||
------------------------------------------------------------------------------}
|
||||
@ -851,6 +859,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$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
|
||||
added more Delphi win32 compatibility functions
|
||||
|
||||
|
@ -30,6 +30,7 @@ begin
|
||||
inherited Create(AOwner);
|
||||
FFonts := TStringlist.Create;
|
||||
TStringlist(FFonts).Sorted := True;
|
||||
FCustomForms:=TList.Create;
|
||||
FFormList := TList.Create;
|
||||
FPixelsPerInch:= ScreenInfo.PixelsPerInchX;
|
||||
FHintFont := TFont.Create;
|
||||
@ -52,6 +53,7 @@ Destructor TScreen.Destroy;
|
||||
begin
|
||||
FreeThenNil(FHintFont);
|
||||
FreeThenNil(FFormList);
|
||||
FreeThenNil(FCustomForms);
|
||||
FreeThenNil(FSaveFocusedList);
|
||||
FreeThenNil(FFonts);
|
||||
inherited Destroy;
|
||||
@ -137,6 +139,22 @@ begin
|
||||
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
|
||||
Params: FForm: The form to be added
|
||||
@ -144,12 +162,16 @@ end;
|
||||
|
||||
Do not use this procedure. This procedure is used by TScreen internally.
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TScreen.AddForm(FForm: TCustomForm);
|
||||
procedure TScreen.AddForm(AForm: TCustomForm);
|
||||
begin
|
||||
FFormList.Add(FForm);
|
||||
FCustomForms.Add(AForm);
|
||||
if AForm is TForm then
|
||||
begin
|
||||
FFormList.Add(AForm);
|
||||
Application.UpdateVisible;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: TScreen.GetFormCount
|
||||
Params: none
|
||||
@ -162,7 +184,6 @@ begin
|
||||
Result := FFormList.Count;
|
||||
end;
|
||||
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: TScreen.GetForms
|
||||
Params: IIndex: The index of the form
|
||||
@ -175,7 +196,6 @@ begin
|
||||
Result := TForm(FFormList.Items[IIndex]);
|
||||
end;
|
||||
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TScreen.GetWidth
|
||||
Params: none
|
||||
@ -188,7 +208,6 @@ begin
|
||||
Result := GetSystemMetrics(SM_CXSCREEN);
|
||||
end;
|
||||
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TScreen.GetHeight
|
||||
Params: none
|
||||
@ -209,9 +228,13 @@ end;
|
||||
|
||||
Do not use this procedure. This procedure is used by TScreen internally.
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TScreen.RemoveForm(FForm: TCustomForm);
|
||||
procedure TScreen.RemoveForm(AForm: TCustomForm);
|
||||
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;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
13
lcl/menus.pp
13
lcl/menus.pp
@ -104,10 +104,12 @@ type
|
||||
FGraphic: TGraphic;
|
||||
FGroupIndex: Byte;
|
||||
FHandle: HMenu;
|
||||
FHint : String;
|
||||
FHint: String;
|
||||
FImageIndex : Integer;
|
||||
FItems: TList; // list of TMenuItem
|
||||
FMenu: TMenu;
|
||||
FOnChange: TMenuChangeEvent;
|
||||
FOnClick: TNotifyEvent;
|
||||
FParent: TMenuItem;
|
||||
FRadioItem: Boolean;
|
||||
FRightJustify: boolean;
|
||||
@ -115,8 +117,6 @@ type
|
||||
FShowAlwaysCheckable: boolean;
|
||||
FSubMenuImages: TCustomImageList;
|
||||
FVisible: Boolean;
|
||||
FOnChange: TMenuChangeEvent;
|
||||
FOnClick: TNotifyEvent;
|
||||
function GetCount: Integer;
|
||||
function GetItem(Index: Integer): TMenuItem;
|
||||
function GetMenuIndex: Integer;
|
||||
@ -204,7 +204,7 @@ type
|
||||
read FSubMenuImages write SetSubMenuImages;
|
||||
property Visible: Boolean
|
||||
read FVisible write SetVisible stored IsVisibleStored default True;
|
||||
property OnClick: TNotifyEvent read FOnClick write FOnclick;
|
||||
property OnClick: TNotifyEvent read FOnClick write FOnClick;
|
||||
end;
|
||||
|
||||
TFindItemKind = (fkCommand, fkHandle, fkShortCut);
|
||||
@ -217,8 +217,8 @@ type
|
||||
FImageChangeLink: TChangeLink;
|
||||
FImages: TCustomImageList;
|
||||
FItems: TMenuItem;
|
||||
FParent: TComponent;
|
||||
FOnChange: TMenuChangeEvent;
|
||||
FParent: TComponent;
|
||||
procedure SetImages(const AValue: TCustomImageList);
|
||||
procedure SetParent(const AValue: TComponent);
|
||||
procedure ImageListChange(Sender: TObject);
|
||||
@ -361,6 +361,9 @@ end.
|
||||
|
||||
{
|
||||
$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
|
||||
started position highlighter
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user