mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 21:35:57 +02:00
fixed opening main unit
git-svn-id: trunk@2946 -
This commit is contained in:
parent
5895aa70b7
commit
583f88ee9d
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -172,6 +172,7 @@ ide/codetoolsdefpreview.pas svneol=native#text/pascal
|
||||
ide/codetoolsoptions.pas svneol=native#text/pascal
|
||||
ide/compiler.pp svneol=native#text/pascal
|
||||
ide/compileroptions.pp svneol=native#text/pascal
|
||||
ide/componentpalette.pas svneol=native#text/pascal
|
||||
ide/compreg.pp svneol=native#text/pascal
|
||||
ide/customformeditor.pp svneol=native#text/pascal
|
||||
ide/debugmanager.pas svneol=native#text/pascal
|
||||
|
83
ide/componentpalette.pas
Normal file
83
ide/componentpalette.pas
Normal file
@ -0,0 +1,83 @@
|
||||
{ $Id$ }
|
||||
{
|
||||
/***************************************************************************
|
||||
componentpalette.pas
|
||||
--------------------
|
||||
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* This source is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This code is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* General Public License for more details. *
|
||||
* *
|
||||
* A copy of the GNU General Public License is available on the World *
|
||||
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
|
||||
* obtain it by writing to the Free Software Foundation, *
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
Author: Mattias Gaertner
|
||||
|
||||
Abstract:
|
||||
|
||||
}
|
||||
unit ComponentPalette;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Dialogs, Graphics, ExtCtrls, ComponentReg, PackageDefs;
|
||||
|
||||
type
|
||||
TComponentPalette = class(TBaseComponentPalette)
|
||||
private
|
||||
FNoteBook: TNotebook;
|
||||
fNoteBookNeedsUpdate: boolean;
|
||||
procedure SetNoteBook(const AValue: TNotebook);
|
||||
protected
|
||||
procedure DoEndUpdate(Changed: boolean); override;
|
||||
public
|
||||
procedure UpdateNoteBookButtons;
|
||||
property NoteBook: TNotebook read FNoteBook write SetNoteBook;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{ TComponentPalette }
|
||||
|
||||
procedure TComponentPalette.SetNoteBook(const AValue: TNotebook);
|
||||
begin
|
||||
if FNoteBook=AValue then exit;
|
||||
FNoteBook:=AValue;
|
||||
UpdateNoteBookButtons;
|
||||
end;
|
||||
|
||||
procedure TComponentPalette.DoEndUpdate(Changed: boolean);
|
||||
begin
|
||||
if Changed then UpdateNoteBookButtons;
|
||||
inherited DoEndUpdate(Changed);
|
||||
end;
|
||||
|
||||
procedure TComponentPalette.UpdateNoteBookButtons;
|
||||
begin
|
||||
if IsUpdating then begin
|
||||
fNoteBookNeedsUpdate:=true;
|
||||
exit;
|
||||
end;
|
||||
fNoteBookNeedsUpdate:=false;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
26
ide/main.pp
26
ide/main.pp
@ -59,7 +59,12 @@ uses
|
||||
Project, ProjectDefs, NewProjectDlg, ProjectOpts, PublishProjectDlg,
|
||||
ProjectInspector,
|
||||
// designer
|
||||
CompReg, IDEComp, AbstractFormEditor, Designer, FormEditor, CustomFormEditor,
|
||||
{$IFDEF EnablePkgs}
|
||||
ComponentReg,
|
||||
{$ELSE}
|
||||
CompReg, IDEComp,
|
||||
{$ENDIF}
|
||||
AbstractFormEditor, Designer, FormEditor, CustomFormEditor,
|
||||
ObjectInspector, PropEdits, ControlSelection, ColumnDlg,
|
||||
{$IFDEF UseNewMenuEditor}
|
||||
MenuEditorForm,
|
||||
@ -376,7 +381,9 @@ type
|
||||
procedure ConnectMainBarEvents;
|
||||
procedure SetupSpeedButtons;
|
||||
procedure SetupComponentNoteBook;
|
||||
{$IFNDEF EnablePkgs}
|
||||
procedure SetupComponentTabs;
|
||||
{$ENDIF}
|
||||
procedure SetupHints;
|
||||
procedure SetupOutputFilter;
|
||||
procedure SetupObjectInspector;
|
||||
@ -807,7 +814,9 @@ begin
|
||||
Name := NonModalIDEWindowNames[nmiwMainIDEName];
|
||||
EnvironmentOptions.IDEWindowLayoutList.Apply(TForm(Self),Name);
|
||||
|
||||
{$IFNDEF EnablePkgs}
|
||||
InitIDEComponents;
|
||||
{$ENDIF}
|
||||
if LazarusResources.Find(ClassName)=nil then begin
|
||||
SetupMainMenu;
|
||||
SetupSpeedButtons;
|
||||
@ -829,7 +838,9 @@ begin
|
||||
SetupSourceNotebook;
|
||||
SetupTransferMacros;
|
||||
SetupControlSelection;
|
||||
{$IFNDEF EnablePkgs}
|
||||
SetupComponentTabs;
|
||||
{$ENDIF}
|
||||
|
||||
// Main IDE bar created and setup completed -> Show it
|
||||
Show;
|
||||
@ -1065,12 +1076,13 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{$IFNDEF EnablePkgs}
|
||||
procedure TMainIDE.SetupComponentTabs;
|
||||
var
|
||||
PageCount, I, X: integer;
|
||||
RegComp : TRegisteredComponent;
|
||||
RegCompPage : TRegisteredComponentPage;
|
||||
IDEComponent: TIdeComponent;
|
||||
IDEComponent: TIDEComponent;
|
||||
SelectionPointerPixmap: TPixmap;
|
||||
begin
|
||||
PageCount := 0;
|
||||
@ -1117,6 +1129,7 @@ begin
|
||||
ComponentNotebook.OnPageChanged := @ControlClick;
|
||||
ComponentNotebook.Show;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure TMainIDE.SetupHints;
|
||||
var
|
||||
@ -4409,14 +4422,14 @@ begin
|
||||
if Project1.MainUnitID<0 then exit;
|
||||
MainUnitInfo:=Project1.MainUnitInfo;
|
||||
|
||||
// check if main unit is already loaded in source editor
|
||||
if MainUnitInfo.Loaded then begin
|
||||
// check if main unit is already open in source editor
|
||||
if MainUnitInfo.Loaded and (not ProjectLoading) then begin
|
||||
// already loaded -> switch to source editor
|
||||
SourceNotebook.NoteBook.PageIndex:=MainUnitInfo.EditorIndex;
|
||||
Result:=mrOk;
|
||||
exit;
|
||||
end;
|
||||
|
||||
|
||||
// open file in source notebook
|
||||
OpenFlags:=[];
|
||||
if ProjectLoading then Include(OpenFlags,ofProjectLoading);
|
||||
@ -8471,6 +8484,9 @@ end.
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.532 2003/04/21 18:00:52 mattias
|
||||
fixed opening main unit
|
||||
|
||||
Revision 1.531 2003/04/21 16:21:28 mattias
|
||||
implemented default package for custom IDE components
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user