fixed opening main unit

git-svn-id: trunk@2946 -
This commit is contained in:
mattias 2002-08-18 08:56:27 +00:00
parent 5895aa70b7
commit 583f88ee9d
3 changed files with 105 additions and 5 deletions

1
.gitattributes vendored
View File

@ -172,6 +172,7 @@ ide/codetoolsdefpreview.pas svneol=native#text/pascal
ide/codetoolsoptions.pas svneol=native#text/pascal ide/codetoolsoptions.pas svneol=native#text/pascal
ide/compiler.pp svneol=native#text/pascal ide/compiler.pp svneol=native#text/pascal
ide/compileroptions.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/compreg.pp svneol=native#text/pascal
ide/customformeditor.pp svneol=native#text/pascal ide/customformeditor.pp svneol=native#text/pascal
ide/debugmanager.pas svneol=native#text/pascal ide/debugmanager.pas svneol=native#text/pascal

83
ide/componentpalette.pas Normal file
View 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.

View File

@ -59,7 +59,12 @@ uses
Project, ProjectDefs, NewProjectDlg, ProjectOpts, PublishProjectDlg, Project, ProjectDefs, NewProjectDlg, ProjectOpts, PublishProjectDlg,
ProjectInspector, ProjectInspector,
// designer // designer
CompReg, IDEComp, AbstractFormEditor, Designer, FormEditor, CustomFormEditor, {$IFDEF EnablePkgs}
ComponentReg,
{$ELSE}
CompReg, IDEComp,
{$ENDIF}
AbstractFormEditor, Designer, FormEditor, CustomFormEditor,
ObjectInspector, PropEdits, ControlSelection, ColumnDlg, ObjectInspector, PropEdits, ControlSelection, ColumnDlg,
{$IFDEF UseNewMenuEditor} {$IFDEF UseNewMenuEditor}
MenuEditorForm, MenuEditorForm,
@ -376,7 +381,9 @@ type
procedure ConnectMainBarEvents; procedure ConnectMainBarEvents;
procedure SetupSpeedButtons; procedure SetupSpeedButtons;
procedure SetupComponentNoteBook; procedure SetupComponentNoteBook;
{$IFNDEF EnablePkgs}
procedure SetupComponentTabs; procedure SetupComponentTabs;
{$ENDIF}
procedure SetupHints; procedure SetupHints;
procedure SetupOutputFilter; procedure SetupOutputFilter;
procedure SetupObjectInspector; procedure SetupObjectInspector;
@ -807,7 +814,9 @@ begin
Name := NonModalIDEWindowNames[nmiwMainIDEName]; Name := NonModalIDEWindowNames[nmiwMainIDEName];
EnvironmentOptions.IDEWindowLayoutList.Apply(TForm(Self),Name); EnvironmentOptions.IDEWindowLayoutList.Apply(TForm(Self),Name);
{$IFNDEF EnablePkgs}
InitIDEComponents; InitIDEComponents;
{$ENDIF}
if LazarusResources.Find(ClassName)=nil then begin if LazarusResources.Find(ClassName)=nil then begin
SetupMainMenu; SetupMainMenu;
SetupSpeedButtons; SetupSpeedButtons;
@ -829,7 +838,9 @@ begin
SetupSourceNotebook; SetupSourceNotebook;
SetupTransferMacros; SetupTransferMacros;
SetupControlSelection; SetupControlSelection;
{$IFNDEF EnablePkgs}
SetupComponentTabs; SetupComponentTabs;
{$ENDIF}
// Main IDE bar created and setup completed -> Show it // Main IDE bar created and setup completed -> Show it
Show; Show;
@ -1065,12 +1076,13 @@ begin
end; end;
end; end;
{$IFNDEF EnablePkgs}
procedure TMainIDE.SetupComponentTabs; procedure TMainIDE.SetupComponentTabs;
var var
PageCount, I, X: integer; PageCount, I, X: integer;
RegComp : TRegisteredComponent; RegComp : TRegisteredComponent;
RegCompPage : TRegisteredComponentPage; RegCompPage : TRegisteredComponentPage;
IDEComponent: TIdeComponent; IDEComponent: TIDEComponent;
SelectionPointerPixmap: TPixmap; SelectionPointerPixmap: TPixmap;
begin begin
PageCount := 0; PageCount := 0;
@ -1117,6 +1129,7 @@ begin
ComponentNotebook.OnPageChanged := @ControlClick; ComponentNotebook.OnPageChanged := @ControlClick;
ComponentNotebook.Show; ComponentNotebook.Show;
end; end;
{$ENDIF}
procedure TMainIDE.SetupHints; procedure TMainIDE.SetupHints;
var var
@ -4409,14 +4422,14 @@ begin
if Project1.MainUnitID<0 then exit; if Project1.MainUnitID<0 then exit;
MainUnitInfo:=Project1.MainUnitInfo; MainUnitInfo:=Project1.MainUnitInfo;
// check if main unit is already loaded in source editor // check if main unit is already open in source editor
if MainUnitInfo.Loaded then begin if MainUnitInfo.Loaded and (not ProjectLoading) then begin
// already loaded -> switch to source editor // already loaded -> switch to source editor
SourceNotebook.NoteBook.PageIndex:=MainUnitInfo.EditorIndex; SourceNotebook.NoteBook.PageIndex:=MainUnitInfo.EditorIndex;
Result:=mrOk; Result:=mrOk;
exit; exit;
end; end;
// open file in source notebook // open file in source notebook
OpenFlags:=[]; OpenFlags:=[];
if ProjectLoading then Include(OpenFlags,ofProjectLoading); if ProjectLoading then Include(OpenFlags,ofProjectLoading);
@ -8471,6 +8484,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $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 Revision 1.531 2003/04/21 16:21:28 mattias
implemented default package for custom IDE components implemented default package for custom IDE components