MG: fixed autocreate form editing in project opts

git-svn-id: trunk@1593 -
This commit is contained in:
lazarus 2002-04-05 16:34:16 +00:00
parent 77b21590ad
commit d22da79b0b
9 changed files with 69 additions and 29 deletions

View File

@ -27,22 +27,20 @@
ToDo: ToDo:
- many things, search for 'ToDo' - many things, search for 'ToDo'
- Examples: - @ operator
- @ operator + Func -> FuncResult Type
+ Func -> FuncResult Type OR in Delphi -> Func type
OR in Delphi -> Func type + @Func -> Func type
+ @Func -> Func type + @Data -> Pointer
+ @Data -> Pointer - 'inherited'
- 'inherited' - variants
- variants - interfaces
- interfaces - Get and Set property access parameter lists
- Get and Set property access parameter lists - ignore error after cursor position
- ignore error after cursor position - predefined funcs Pred, Succ, Val, Low, High
- predefined funcs Pred, Succ, Val, Low, High - find declaration in dead code
- find declaration in dead code - operator overloading
- operator overloading - ppu, ppw, dcu files
- ppu, ppw, dcu files
} }
unit FindDeclarationTool; unit FindDeclarationTool;

View File

@ -800,6 +800,7 @@ var Position: integer;
s:string; s:string;
var MainBeginNode: TCodeTreeNode; var MainBeginNode: TCodeTreeNode;
begin begin
BuildTree(false);
Result:=TStringList.Create; Result:=TStringList.Create;
MainBeginNode:=FindMainBeginEndNode; MainBeginNode:=FindMainBeginEndNode;
if MainBeginNode=nil then exit; if MainBeginNode=nil then exit;
@ -837,6 +838,7 @@ var Position, InsertPos, i, ColonPos, Indent: integer;
begin begin
Result:=false; Result:=false;
if (List=nil) or (SourceChangeCache=nil) then exit; if (List=nil) or (SourceChangeCache=nil) then exit;
BuildTree(false);
// first delete all CreateForm Statements // first delete all CreateForm Statements
SourceChangeCache.MainScanner:=Scanner; SourceChangeCache.MainScanner:=Scanner;
MainBeginNode:=FindMainBeginEndNode; MainBeginNode:=FindMainBeginEndNode;

View File

@ -973,7 +973,10 @@ begin
//writeln('[TOIPropertyGrid.SetBounds] ',Name,' ',aLeft,',',aTop,',',aWidth,',',aHeight,' Visible=',Visible); //writeln('[TOIPropertyGrid.SetBounds] ',Name,' ',aLeft,',',aTop,',',aWidth,',',aHeight,' Visible=',Visible);
inherited SetBounds(aLeft,aTop,aWidth,aHeight); inherited SetBounds(aLeft,aTop,aWidth,aHeight);
if Visible then begin if Visible then begin
SplitterX:=SplitterX; if (SplitterX<5) and (aWidth>20) then
SplitterX:=100
else
SplitterX:=SplitterX;
AlignEditComponents; AlignEditComponents;
end; end;
end; end;

View File

@ -36,7 +36,8 @@ interface
uses uses
Classes, SysUtils, LCLLinux, Forms, Controls, Buttons, StdCtrls, ComCtrls, Classes, SysUtils, LCLLinux, Forms, Controls, Buttons, StdCtrls, ComCtrls,
ExtCtrls, Menus, LResources, Graphics, Dialogs, ImgList, SynEdit, XMLCfg, ExtCtrls, Menus, LResources, Graphics, Dialogs, ImgList, SynEdit, XMLCfg,
DefineTemplates, CodeToolManager, CodeToolsOptions, CodeToolsDefPreview; DefineTemplates, CodeToolManager, CodeToolsOptions, CodeToolsDefPreview,
InputFileDialog;
type type
TCodeToolsDefinesEditor = class(TForm) TCodeToolsDefinesEditor = class(TForm)
@ -715,9 +716,24 @@ end;
procedure TCodeToolsDefinesEditor.InsertDelphi5DirectoryTemplateMenuItemClick( procedure TCodeToolsDefinesEditor.InsertDelphi5DirectoryTemplateMenuItemClick(
Sender: TObject); Sender: TObject);
var InputFileDlg: TInputFileDialog;
begin begin
InsertTemplate(Boss.DefinePool.CreateDelphi5DirectoryTemplate( InputFileDlg:=GetInputFileDialog;
SetDirSeparators('/Borland/Delphi5'))); with InputFileDlg do begin
BeginUpdate;
Caption:='Create Defines for Delphi5 Directory';
FileCount:=1;
FileTitles[0]:='Delphi5 directory';
FileDescs[0]:='The Delphi5 main directory,'#13
+'where Borland has installed all Delphi5 sources.'#13
+'For example: C:/Programme/Borland/Delphi5';
FileNames[0]:=SetDirSeparators('C:/Programme/Borland/Delphi5');
FileFlags[0]:=[iftDirectory,iftNotEmpty];
EndUpdate;
if ShowModal=mrCancel then exit;
InsertTemplate(Boss.DefinePool.CreateDelphi5DirectoryTemplate(
FileNames[0]));
end;
end; end;
procedure TCodeToolsDefinesEditor.InsertDelphi5ProjectTemplateMenuItemClick( procedure TCodeToolsDefinesEditor.InsertDelphi5ProjectTemplateMenuItemClick(

View File

@ -377,7 +377,8 @@ function FilenameIsPascalSource(const Filename: string): boolean;
var Ext: string; var Ext: string;
begin begin
Ext:=lowercase(ExtractFileExt(Filename)); Ext:=lowercase(ExtractFileExt(Filename));
Result:=(Ext='.pp') or (Ext='.pas') or (Ext='.dpr') or (Ext='.dpk'); Result:=(Ext='.pp') or (Ext='.pas') or (Ext='.lpr')
or (Ext='.dpr') or (Ext='.dpk');
end; end;
function FilenameIsPascalUnit(const Filename: string): boolean; function FilenameIsPascalUnit(const Filename: string): boolean;

View File

@ -1686,7 +1686,7 @@ begin
end; end;
procedure TMainIDE.mnuOpenClicked(Sender : TObject); procedure TMainIDE.mnuOpenClicked(Sender : TObject);
var OpenDialog:TOpenDialog; var OpenDialog: TOpenDialog;
AFilename: string; AFilename: string;
I : Integer; I : Integer;
begin begin
@ -2020,7 +2020,11 @@ begin
end; end;
procedure TMainIDE.mnuProjectOptionsClicked(Sender : TObject); procedure TMainIDE.mnuProjectOptionsClicked(Sender : TObject);
var
ActiveSrcEdit: TSourceEditor;
ActiveUnitInfo: TUnitInfo;
begin begin
BeginCodeTool(ActiveSrcEdit, ActiveUnitInfo, false);
if ShowProjectOptionsDialog(Project1)=mrOk then begin if ShowProjectOptionsDialog(Project1)=mrOk then begin
end; end;
@ -2581,9 +2585,10 @@ writeln('TMainIDE.ShowSaveFileAsDialog C ',ResourceCode<>nil);
ResourceCode:=CodeToolBoss.FindNextResourceFile(NewSource,LinkIndex); ResourceCode:=CodeToolBoss.FindNextResourceFile(NewSource,LinkIndex);
// change unitname on SourceNotebook // change unitname on SourceNotebook
SourceNoteBook.NoteBook.Pages[SourceNoteBook.NoteBook.PageIndex]:= if AnUnitInfo.EditorIndex>=0 then
CreateSrcEditPageName(NewUnitName,NewFilename, SourceNoteBook.NoteBook.Pages[AnUnitInfo.EditorIndex]:=
SourceNoteBook.NoteBook.PageIndex); CreateSrcEditPageName(NewUnitName,NewFilename,
SourceNoteBook.NoteBook.PageIndex);
Result:=mrOk; Result:=mrOk;
end; end;
@ -3032,7 +3037,7 @@ begin
if NewFilename='' then if NewFilename='' then
NewFilename:='project1'; NewFilename:='project1';
Ext:=lowercase(ExtractFileExt(NewFilename)); Ext:=lowercase(ExtractFileExt(NewFilename));
if (Ext='') or FilenameIsPascalUnit(NewFilename) or (Ext='.dpr') then if (Ext='') or FilenameIsPascalSource(NewFilename) then
NewFilename:=ChangeFileExt(NewFilename,'.lpi'); NewFilename:=ChangeFileExt(NewFilename,'.lpi');
SaveDialog.FileName:=NewFilename; SaveDialog.FileName:=NewFilename;
@ -6201,6 +6206,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.272 2002/04/05 16:34:13 lazarus
MG: fixed autocreate form editing in project opts
Revision 1.271 2002/04/04 17:21:17 lazarus Revision 1.271 2002/04/04 17:21:17 lazarus
MG: fixed outputfilter for linker errors MG: fixed outputfilter for linker errors

View File

@ -92,7 +92,7 @@ begin
try try
FileVersion:=XMLConfig.GetValue('MiscellaneousOptions/Version/Value',0); FileVersion:=XMLConfig.GetValue('MiscellaneousOptions/Version/Value',0);
if FileVersion<MiscOptsVersion then if (FileVersion<MiscOptsVersion) and (FileVersion<>0) then
writeln('Note: converting old miscellaneous options ...'); writeln('Note: converting old miscellaneous options ...');
BuildLazOpts.Load(XMLConfig,'MiscellaneousOptions/BuildLazarusOptions/'); BuildLazOpts.Load(XMLConfig,'MiscellaneousOptions/BuildLazarusOptions/');

View File

@ -1,3 +1,4 @@
{ $Id$ }
{ {
/*************************************************************************** /***************************************************************************
project.pp - project utility class file project.pp - project utility class file
@ -1353,6 +1354,9 @@ end.
{ {
$Log$ $Log$
Revision 1.60 2002/04/05 16:34:16 lazarus
MG: fixed autocreate form editing in project opts
Revision 1.59 2002/04/04 17:21:18 lazarus Revision 1.59 2002/04/04 17:21:18 lazarus
MG: fixed outputfilter for linker errors MG: fixed outputfilter for linker errors

View File

@ -67,13 +67,13 @@ type
procedure SetProject(AProject: TProject); procedure SetProject(AProject: TProject);
procedure SetupApplicationPage; procedure SetupApplicationPage;
procedure SetupFormsPage; procedure SetupFormsPage;
function GetAutoCreatedFormsList: TStrings;
procedure FillAutoCreateFormsListbox; procedure FillAutoCreateFormsListbox;
procedure FillAvailFormsListBox; procedure FillAvailFormsListBox;
function IndexOfAutoCreateForm(FormName: string): integer; function IndexOfAutoCreateForm(FormName: string): integer;
function FirstAutoCreateFormSelected: integer; function FirstAutoCreateFormSelected: integer;
function FirstAvailFormSelected: integer; function FirstAvailFormSelected: integer;
procedure SelectOnlyThisAutoCreateForm(Index: integer); procedure SelectOnlyThisAutoCreateForm(Index: integer);
function GetAutoCreatedFormsList: TStrings;
procedure SetAutoCreateForms; procedure SetAutoCreateForms;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
@ -378,8 +378,11 @@ function TProjectOptionsDialog.GetAutoCreatedFormsList: TStrings;
var i, j: integer; var i, j: integer;
begin begin
if (FProject<>nil) and (FProject.MainUnit>=0) then begin if (FProject<>nil) and (FProject.MainUnit>=0) then begin
writeln('==CCC=============================================================');
writeln(FProject.MainUnitInfo.Source.Source);
writeln('==DDD=============================================================');
Result:=CodeToolBoss.ListAllCreateFormStatements( Result:=CodeToolBoss.ListAllCreateFormStatements(
FProject.Units[FProject.MainUnit].Source); FProject.MainUnitInfo.Source);
if Result<>nil then begin if Result<>nil then begin
// shorten lines of type 'FormName:TFormName' to simply 'FormName' // shorten lines of type 'FormName:TFormName' to simply 'FormName'
for i:=0 to Result.Count-1 do begin for i:=0 to Result.Count-1 do begin
@ -391,6 +394,7 @@ begin
Result[i]:=copy(Result[i],1,j-1); Result[i]:=copy(Result[i],1,j-1);
end; end;
end; end;
writeln('BBB1 ',Result[i]);
end; end;
end; end;
end else begin end else begin
@ -578,11 +582,15 @@ begin
try try
for i:=0 to FormsAutoCreatedListBox.Items.Count-1 do begin for i:=0 to FormsAutoCreatedListBox.Items.Count-1 do begin
NewList.Add(FormsAutoCreatedListBox.Items[i]); NewList.Add(FormsAutoCreatedListBox.Items[i]);
writeln('AAA3 ',i,' ',NewList[i]);
end; end;
if not CodeToolBoss.SetAllCreateFromStatements( if not CodeToolBoss.SetAllCreateFromStatements(
Project.Units[Project.MainUnit].Source, NewList) then begin Project.Units[Project.MainUnit].Source, NewList) then begin
// ToDo: print a message // ToDo: print a message
end; end;
writeln('==EEE=============================================================');
writeln(FProject.MainUnitInfo.Source.Source);
writeln('==FFF=============================================================');
finally finally
NewList.Free; NewList.Free;
end; end;