From cdc3c432b409d666de3a89d356e00938046547df Mon Sep 17 00:00:00 2001 From: mattias Date: Fri, 4 May 2012 08:00:38 +0000 Subject: [PATCH] cody: new IDE window: show dialog to setup form name git-svn-id: trunk@37152 - --- .gitattributes | 2 + components/codetools/ide/cody.lpk | 8 +- components/codetools/ide/cody.pas | 2 +- .../codetools/ide/codyidentifiersdlg.pas | 4 +- components/codetools/ide/codyregistration.pas | 152 +---------- components/codetools/ide/codystrconsts.pas | 21 +- .../ide/languages/codystrconsts.de.po | 64 +++-- .../ide/languages/codystrconsts.it.po | 64 +++-- .../codetools/ide/languages/codystrconsts.po | 64 +++-- .../ide/languages/codystrconsts.pt_BR.po | 64 +++-- .../ide/languages/codystrconsts.ru.po | 64 +++-- .../ide/languages/codystrconsts.uk.po | 64 +++-- components/codetools/ide/newidewnddlg.lfm | 105 ++++++++ components/codetools/ide/newidewnddlg.pas | 252 ++++++++++++++++++ components/codetools/ide/ppulistdlg.pas | 4 +- .../ide/templateidedockablewindow.pas | 15 +- ide/main.pp | 19 +- ideintf/lazideintf.pas | 2 +- ideintf/projectintf.pas | 8 + 19 files changed, 712 insertions(+), 266 deletions(-) create mode 100644 components/codetools/ide/newidewnddlg.lfm create mode 100644 components/codetools/ide/newidewnddlg.pas diff --git a/.gitattributes b/.gitattributes index 1d6a94ab89..f0113d3ef4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -607,6 +607,8 @@ components/codetools/ide/languages/codystrconsts.po svneol=native#text/plain components/codetools/ide/languages/codystrconsts.pt_BR.po svneol=native#text/plain components/codetools/ide/languages/codystrconsts.ru.po svneol=native#text/plain components/codetools/ide/languages/codystrconsts.uk.po svneol=native#text/plain +components/codetools/ide/newidewnddlg.lfm svneol=native#text/plain +components/codetools/ide/newidewnddlg.pas svneol=native#text/plain components/codetools/ide/ppulistdlg.lfm svneol=native#text/plain components/codetools/ide/ppulistdlg.pas svneol=native#text/pascal components/codetools/ide/templateidedockablewindow.lfm svneol=native#text/plain diff --git a/components/codetools/ide/cody.lpk b/components/codetools/ide/cody.lpk index 82cb3a920b..aee47667d9 100644 --- a/components/codetools/ide/cody.lpk +++ b/components/codetools/ide/cody.lpk @@ -19,7 +19,7 @@ - + @@ -79,8 +79,12 @@ - + + + + + diff --git a/components/codetools/ide/cody.pas b/components/codetools/ide/cody.pas index 0d659538e9..21b645fa6f 100644 --- a/components/codetools/ide/cody.pas +++ b/components/codetools/ide/cody.pas @@ -10,7 +10,7 @@ uses PPUListDlg, CodyStrConsts, AddAssignMethodDlg, CodyCtrls, CodyFrm, CodyRegistration, DeclareVarDlg, CodyUtils, CodyNodeInfoDlg, CodyCopyDeclaration, AddWithBlockDlg, CodyIdentifiersDlg, CodyMiscOptsFrame, - CodyOpts, TemplateIDEDockableWindow, LazarusPackageIntf; + CodyOpts, TemplateIDEDockableWindow, NewIDEWndDlg, LazarusPackageIntf; implementation diff --git a/components/codetools/ide/codyidentifiersdlg.pas b/components/codetools/ide/codyidentifiersdlg.pas index f1d188c176..6025cb53b9 100644 --- a/components/codetools/ide/codyidentifiersdlg.pas +++ b/components/codetools/ide/codyidentifiersdlg.pas @@ -799,9 +799,9 @@ begin HideOtherProjectsCheckBox.Checked:=true; HideOtherProjectsCheckBox.Caption:=crsHideUnitsOfOtherProjects; AddToImplementationUsesCheckBox.Caption:= - lisAddUnitToImplementationUsesSection; + crsAddUnitToImplementationUsesSection; AddToImplementationUsesCheckBox.Hint:= - lisIfIdentifierIsAddedToTheImplementationSectionAndNe; + crsIfIdentifierIsAddedToTheImplementationSectionAndNe; FJumpButton:=AddButton; FJumpButton.Name:='JumpButton'; diff --git a/components/codetools/ide/codyregistration.pas b/components/codetools/ide/codyregistration.pas index 216d42bffc..468e83cd94 100644 --- a/components/codetools/ide/codyregistration.pas +++ b/components/codetools/ide/codyregistration.pas @@ -30,40 +30,13 @@ unit CodyRegistration; interface uses - Classes, SysUtils, LResources, LCLProc, Controls, Forms, IDECommands, + Classes, SysUtils, LazUTF8, LResources, LCLProc, Controls, Forms, MenuIntf, IDEWindowIntf, SrcEditorIntf, IDEOptionsIntf, ProjectIntf, - MacroIntf, CodyStrConsts, CodyCtrls, PPUListDlg, - AddAssignMethodDlg, AddWithBlockDlg, CodyUtils, CodyNodeInfoDlg, CodyFrm, - DeclareVarDlg, CodyCopyDeclaration, CodyIdentifiersDlg, CodyMiscOptsFrame, - CodyOpts, CodeToolManager, CodeCache, LazFileUtils, LazUTF8; - -type - - { TFileDescIDEDockableWindow } - - TFileDescIDEDockableWindow = class(TFileDescPascalUnit) - private - FTemplateImplementation: string; - FTemplateInterface: string; - FTemplateLFM: string; - FTemplateUsesSection: string; - FTemplateLoaded: boolean; - function ExtractTemplate(Src, StartMarker, EndMarker: string): string; - procedure LoadTemplate; - public - constructor Create; override; - function GetLocalizedName: string; override; - function GetLocalizedDescription: string; override; - function GetInterfaceUsesSection: string; override; - function GetInterfaceSource(const {%H-}Filename, {%H-}SourceName, - ResourceName: string): string; override; - function GetImplementationSource(const {%H-}Filename, {%H-}SourceName, - ResourceName: string): string; override; - property TemplateUsesSection: string read FTemplateUsesSection write FTemplateUsesSection; - property TemplateInterface: string read FTemplateInterface write FTemplateInterface; - property TemplateImplementation: string read FTemplateImplementation write FTemplateImplementation; - property TemplateLFM: string read FTemplateLFM write FTemplateLFM; - end; + IDECommands, + CodeToolManager, + CodyStrConsts, CodyCtrls, PPUListDlg, AddAssignMethodDlg, AddWithBlockDlg, + CodyUtils, CodyNodeInfoDlg, CodyFrm, DeclareVarDlg, CodyCopyDeclaration, + CodyIdentifiersDlg, CodyMiscOptsFrame, CodyOpts, NewIDEWndDlg; procedure Register; @@ -246,118 +219,5 @@ begin SourceEditorManagerIntf.RegisterCopyPasteEvent(@Cody.SrcEditCopyPaste); end; -{ TFileDescIDEDockableWindow } - -function TFileDescIDEDockableWindow.ExtractTemplate(Src, StartMarker, - EndMarker: string): string; -var - StartPos: SizeInt; - EndPos: SizeInt; -begin - StartPos:=system.Pos(StartMarker,Src); - EndPos:=system.Pos(EndMarker,Src); - if StartPos<1 then begin - debugln(['ERROR: TFileDescIDEDockableWindow.ExtractTemplate marker "'+StartMarker+'" not found']); - debugln('Source: =================================================='); - debugln(Src); - debugln('=========================================================='); - exit; - end; - if EndPos<1 then begin - debugln(['ERROR: TFileDescIDEDockableWindow.ExtractTemplate marker "'+EndMarker+'" not found']); - exit; - end; - inc(StartPos,length(StartMarker)); - Result:=UTF8Trim(copy(Src,StartPos,EndPos-StartPos)); -end; - -procedure TFileDescIDEDockableWindow.LoadTemplate; -var - BaseDir: String; - Filename: String; - Code: TCodeBuffer; -begin - if FTemplateLoaded then exit; - - BaseDir:='$PkgDir(Cody)'; - IDEMacros.SubstituteMacros(BaseDir); - if (BaseDir='') or (not DirectoryExistsUTF8(BaseDir)) then begin - debugln(['ERROR: TFileDescIDEDockableWindow.Create cody directory not found']); - exit; - end; - - // load unit source - Filename:=AppendPathDelim(BaseDir)+'templateidedockablewindow.pas'; - if not FileExistsUTF8(Filename) then begin - debugln(['ERROR: TFileDescIDEDockableWindow.Create template file not found: '+Filename]); - exit; - end; - Code:=CodeToolBoss.LoadFile(Filename,true,false); - if Code=nil then begin - debugln(['ERROR: TFileDescIDEDockableWindow.Create unable to read file ',Filename]); - exit; - end; - - TemplateUsesSection:=ExtractTemplate(Code.Source,'// UsesStart','// UsesEnd'); - TemplateInterface:=ExtractTemplate(Code.Source,'// InterfaceStart','// InterfaceEnd'); - TemplateImplementation:=ExtractTemplate(Code.Source,'// ImplementationStart','// ImplementationEnd'); - - // load lfm - Filename:=AppendPathDelim(BaseDir)+'templateidedockablewindow.lfm'; - if not FileExistsUTF8(Filename) then begin - debugln(['ERROR: TFileDescIDEDockableWindow.Create template file not found: '+Filename]); - exit; - end; - Code:=CodeToolBoss.LoadFile(Filename,true,false); - if Code=nil then begin - debugln(['ERROR: TFileDescIDEDockableWindow.Create unable to read file ',Filename]); - exit; - end; - - TemplateLFM:=Code.Source; -end; - -constructor TFileDescIDEDockableWindow.Create; -begin - inherited Create; - Name:='IDE window, dockable'; - ResourceClass:=TForm; - UseCreateFormStatements:=false; - RequiredPackages:='IDEIntf'; - AddToProject:=false; - TemplateInterface:='failed loading template'; -end; - -function TFileDescIDEDockableWindow.GetLocalizedName: string; -begin - Result:='IDE window, dockable'; -end; - -function TFileDescIDEDockableWindow.GetLocalizedDescription: string; -begin - Result:='A window for the Lazarus IDE. It can be docked like the Code Explorer or the FPDoc Editor. This also creates a menu item in the View menu and a short cut.'; -end; - -function TFileDescIDEDockableWindow.GetInterfaceUsesSection: string; -begin - LoadTemplate; - Result:=TemplateUsesSection; -end; - -function TFileDescIDEDockableWindow.GetInterfaceSource(const Filename, - SourceName, ResourceName: string): string; -begin - LoadTemplate; - Result:=StringReplace(TemplateInterface,'TemplateName',ResourceName,[rfReplaceAll]); -end; - -function TFileDescIDEDockableWindow.GetImplementationSource(const Filename, - SourceName, ResourceName: string): string; -begin - LoadTemplate; - Result:=StringReplace(TemplateImplementation,'TemplateName',ResourceName,[rfReplaceAll]) - +LineEnding+LineEnding; -end; - end. diff --git a/components/codetools/ide/codystrconsts.pas b/components/codetools/ide/codystrconsts.pas index e895343994..151e89b761 100644 --- a/components/codetools/ide/codystrconsts.pas +++ b/components/codetools/ide/codystrconsts.pas @@ -34,9 +34,9 @@ resourcestring crsPleaseOpenAProjectFirst = 'Please open a project first.'; crsPPUFilesOfProject = 'PPU files of project "%s"'; crsUses = 'Uses'; - lisCOGeneral = 'General'; + crsCOGeneral = 'General'; crsUsedBy = 'Used by'; - lisCOUsesPath = 'Uses path'; + crsCOUsesPath = 'Uses path'; crsProjectHasNoMainSourceFile = 'Project has no main source file.'; crsMainSourceFile = 'Main source file: %s'; crsSizeOfPpuFile = 'Size of .ppu file'; @@ -166,9 +166,9 @@ resourcestring crsRefresh = 'Refresh'; crsFilter = '(Filter)'; crsHideUnitsOfOtherProjects = 'Hide units of other projects'; - lisAddUnitToImplementationUsesSection = 'Add unit to implementation uses ' + crsAddUnitToImplementationUsesSection = 'Add unit to implementation uses ' +'section'; - lisIfIdentifierIsAddedToTheImplementationSectionAndNe = 'If identifier is ' + crsIfIdentifierIsAddedToTheImplementationSectionAndNe = 'If identifier is ' +'added to the implementation section and needed unit needs to be added, ' +'add to the uses section of the implementation'; crsJumpTo = '&Jump to'; @@ -227,6 +227,19 @@ resourcestring crsTheDictionaryIsSavedInIntervals = 'The dictionary is saved in intervals'; crsSaveDictionaryNow = 'Save dictionary now'; crsSaveToFile = 'Save to file %s'; + crsConfigureNewIDEWindow = 'Configure new IDE window'; + crsNoteTheNameOfTheFormMustBeAValidPascalIdentifierAn = 'Note: The name of ' + +'the form must be a valid pascal identifier and unique across the whole ' + +'IDE, which includes all packages. Prepend the name with an abbreviation ' + +'of your package. The prefixes "IDE", "Laz", "Pkg" are already used by ' + +'the IDE itself.'; + crsMenuItemCaption = 'Menu item caption:'; + crsCheetahEditor = 'Cheetah Editor'; + crsContinue = 'Continue'; + crsIDEWindowDockable = 'IDE window, dockable'; + crsAWindowForTheLazarusIDEItCanBeDockedLikeTheCodeExp = 'A window for the ' + +'Lazarus IDE. It can be docked like the Code Explorer or the FPDoc Editor' + +'. This also creates a menu item in the View menu and a short cut.'; implementation diff --git a/components/codetools/ide/languages/codystrconsts.de.po b/components/codetools/ide/languages/codystrconsts.de.po index f04aeff4f4..b36b891cc6 100644 --- a/components/codetools/ide/languages/codystrconsts.de.po +++ b/components/codetools/ide/languages/codystrconsts.de.po @@ -21,6 +21,11 @@ msgstr "" msgid "Add a \"With\" Block" msgstr "" +#: codystrconsts.crsaddunittoimplementationusessection +msgctxt "codystrconsts.crsaddunittoimplementationusessection" +msgid "Add unit to implementation uses section" +msgstr "" + #: codystrconsts.crsaddwithblock msgid "Add \"With\" Block" msgstr "" @@ -37,6 +42,10 @@ msgstr "" msgid "... and %s more identifiers" msgstr "" +#: codystrconsts.crsawindowforthelazarusideitcanbedockedlikethecodeexp +msgid "A window for the Lazarus IDE. It can be docked like the Code Explorer or the FPDoc Editor. This also creates a menu item in the View menu and a short cut." +msgstr "" + #: codystrconsts.crsbtncancel msgid "Cancel" msgstr "Abbrechen" @@ -145,6 +154,10 @@ msgstr "" msgid "%s, written by property %s" msgstr "" +#: codystrconsts.crscheetaheditor +msgid "Cheetah Editor" +msgstr "" + #: codystrconsts.crsclose msgid "&Close" msgstr "" @@ -165,10 +178,23 @@ msgstr "" msgid "Identifier Dictionary" msgstr "" +#: codystrconsts.crscogeneral +msgctxt "codystrconsts.crscogeneral" +msgid "General" +msgstr "" + +#: codystrconsts.crsconfigurenewidewindow +msgid "Configure new IDE window" +msgstr "" + #: codystrconsts.crscontains msgid "Contains" msgstr "" +#: codystrconsts.crscontinue +msgid "Continue" +msgstr "" + #: codystrconsts.crscopydeclarationtoclipboard msgid "Copy declaration to Clipboard" msgstr "Deklaration in Zwischenablage kopieren" @@ -177,6 +203,11 @@ msgstr "Deklaration in Zwischenablage kopieren" msgid "Count" msgstr "" +#: codystrconsts.crscousespath +msgctxt "codystrconsts.crscousespath" +msgid "Uses path" +msgstr "" + #: codystrconsts.crscuallfiles msgid "%s|All files (%s)|%s" msgstr "%s|Alle Dateien (%s)|%s" @@ -305,6 +336,15 @@ msgstr "Bezeichner nicht gefunden" msgid "Identifier \"%s\" not found in unit \"%s\". Maybe the identifier does not exist for this platform or maybe the identifier was deleted/renamed." msgstr "" +#: codystrconsts.crsidewindowdockable +msgid "IDE window, dockable" +msgstr "" + +#: codystrconsts.crsifidentifierisaddedtotheimplementationsectionandne +msgctxt "codystrconsts.crsifidentifierisaddedtotheimplementationsectionandne" +msgid "If identifier is added to the implementation section and needed unit needs to be added, add to the uses section of the implementation" +msgstr "" + #: codystrconsts.crsimpossibledependency msgid "Impossible dependency" msgstr "Unmögliche Abhängigkeit" @@ -357,6 +397,10 @@ msgstr "" msgid "%s member of %s %s" msgstr "" +#: codystrconsts.crsmenuitemcaption +msgid "Menu item caption:" +msgstr "" + #: codystrconsts.crsminutes msgid "%s minutes" msgstr "" @@ -373,6 +417,10 @@ msgstr "" msgid "No project" msgstr "Kein Projekt" +#: codystrconsts.crsnotethenameoftheformmustbeavalidpascalidentifieran +msgid "Note: The name of the form must be a valid pascal identifier and unique across the whole IDE, which includes all packages. Prepend the name with an abbreviation of your package. The prefixes \"IDE\", \"Laz\", \"Pkg\" are already used by the IDE itself." +msgstr "" + #: codystrconsts.crsnounitselected msgid "No unit selected" msgstr "Keine Unit ausgewählt" @@ -649,19 +697,3 @@ msgstr "" msgid "Where" msgstr "" -#: codystrconsts.lisaddunittoimplementationusessection -msgid "Add unit to implementation uses section" -msgstr "" - -#: codystrconsts.liscogeneral -msgid "General" -msgstr "" - -#: codystrconsts.liscousespath -msgid "Uses path" -msgstr "" - -#: codystrconsts.lisifidentifierisaddedtotheimplementationsectionandne -msgid "If identifier is added to the implementation section and needed unit needs to be added, add to the uses section of the implementation" -msgstr "" - diff --git a/components/codetools/ide/languages/codystrconsts.it.po b/components/codetools/ide/languages/codystrconsts.it.po index 18c67f66ca..e4e8d93230 100644 --- a/components/codetools/ide/languages/codystrconsts.it.po +++ b/components/codetools/ide/languages/codystrconsts.it.po @@ -21,6 +21,11 @@ msgstr "" msgid "Add a \"With\" Block" msgstr "" +#: codystrconsts.crsaddunittoimplementationusessection +msgctxt "codystrconsts.crsaddunittoimplementationusessection" +msgid "Add unit to implementation uses section" +msgstr "" + #: codystrconsts.crsaddwithblock msgid "Add \"With\" Block" msgstr "" @@ -37,6 +42,10 @@ msgstr "" msgid "... and %s more identifiers" msgstr "" +#: codystrconsts.crsawindowforthelazarusideitcanbedockedlikethecodeexp +msgid "A window for the Lazarus IDE. It can be docked like the Code Explorer or the FPDoc Editor. This also creates a menu item in the View menu and a short cut." +msgstr "" + #: codystrconsts.crsbtncancel msgid "Cancel" msgstr "" @@ -145,6 +154,10 @@ msgstr "" msgid "%s, written by property %s" msgstr "" +#: codystrconsts.crscheetaheditor +msgid "Cheetah Editor" +msgstr "" + #: codystrconsts.crsclose msgid "&Close" msgstr "&Chiudi" @@ -165,10 +178,23 @@ msgstr "" msgid "Identifier Dictionary" msgstr "" +#: codystrconsts.crscogeneral +msgctxt "codystrconsts.crscogeneral" +msgid "General" +msgstr "Generale" + +#: codystrconsts.crsconfigurenewidewindow +msgid "Configure new IDE window" +msgstr "" + #: codystrconsts.crscontains msgid "Contains" msgstr "" +#: codystrconsts.crscontinue +msgid "Continue" +msgstr "" + #: codystrconsts.crscopydeclarationtoclipboard msgid "Copy declaration to Clipboard" msgstr "" @@ -177,6 +203,11 @@ msgstr "" msgid "Count" msgstr "" +#: codystrconsts.crscousespath +msgctxt "codystrconsts.crscousespath" +msgid "Uses path" +msgstr "Cammino clausola uses" + #: codystrconsts.crscuallfiles msgid "%s|All files (%s)|%s" msgstr "" @@ -305,6 +336,15 @@ msgstr "" msgid "Identifier \"%s\" not found in unit \"%s\". Maybe the identifier does not exist for this platform or maybe the identifier was deleted/renamed." msgstr "" +#: codystrconsts.crsidewindowdockable +msgid "IDE window, dockable" +msgstr "" + +#: codystrconsts.crsifidentifierisaddedtotheimplementationsectionandne +msgctxt "codystrconsts.crsifidentifierisaddedtotheimplementationsectionandne" +msgid "If identifier is added to the implementation section and needed unit needs to be added, add to the uses section of the implementation" +msgstr "" + #: codystrconsts.crsimpossibledependency msgid "Impossible dependency" msgstr "" @@ -357,6 +397,10 @@ msgstr "Mbyte" msgid "%s member of %s %s" msgstr "" +#: codystrconsts.crsmenuitemcaption +msgid "Menu item caption:" +msgstr "" + #: codystrconsts.crsminutes msgid "%s minutes" msgstr "" @@ -373,6 +417,10 @@ msgstr "" msgid "No project" msgstr "Nessun progetto" +#: codystrconsts.crsnotethenameoftheformmustbeavalidpascalidentifieran +msgid "Note: The name of the form must be a valid pascal identifier and unique across the whole IDE, which includes all packages. Prepend the name with an abbreviation of your package. The prefixes \"IDE\", \"Laz\", \"Pkg\" are already used by the IDE itself." +msgstr "" + #: codystrconsts.crsnounitselected msgid "No unit selected" msgstr "Nessuna unit selezionata" @@ -655,19 +703,3 @@ msgstr "Unit virtuale" msgid "Where" msgstr "" -#: codystrconsts.lisaddunittoimplementationusessection -msgid "Add unit to implementation uses section" -msgstr "" - -#: codystrconsts.liscogeneral -msgid "General" -msgstr "Generale" - -#: codystrconsts.liscousespath -msgid "Uses path" -msgstr "Cammino clausola uses" - -#: codystrconsts.lisifidentifierisaddedtotheimplementationsectionandne -msgid "If identifier is added to the implementation section and needed unit needs to be added, add to the uses section of the implementation" -msgstr "" - diff --git a/components/codetools/ide/languages/codystrconsts.po b/components/codetools/ide/languages/codystrconsts.po index 624d5e1940..abab9f0172 100644 --- a/components/codetools/ide/languages/codystrconsts.po +++ b/components/codetools/ide/languages/codystrconsts.po @@ -13,6 +13,11 @@ msgstr "" msgid "Add a \"With\" Block" msgstr "" +#: codystrconsts.crsaddunittoimplementationusessection +msgctxt "codystrconsts.crsaddunittoimplementationusessection" +msgid "Add unit to implementation uses section" +msgstr "" + #: codystrconsts.crsaddwithblock msgid "Add \"With\" Block" msgstr "" @@ -29,6 +34,10 @@ msgstr "" msgid "... and %s more identifiers" msgstr "" +#: codystrconsts.crsawindowforthelazarusideitcanbedockedlikethecodeexp +msgid "A window for the Lazarus IDE. It can be docked like the Code Explorer or the FPDoc Editor. This also creates a menu item in the View menu and a short cut." +msgstr "" + #: codystrconsts.crsbtncancel msgid "Cancel" msgstr "" @@ -137,6 +146,10 @@ msgstr "" msgid "%s, written by property %s" msgstr "" +#: codystrconsts.crscheetaheditor +msgid "Cheetah Editor" +msgstr "" + #: codystrconsts.crsclose msgid "&Close" msgstr "" @@ -157,10 +170,23 @@ msgstr "" msgid "Identifier Dictionary" msgstr "" +#: codystrconsts.crscogeneral +msgctxt "codystrconsts.crscogeneral" +msgid "General" +msgstr "" + +#: codystrconsts.crsconfigurenewidewindow +msgid "Configure new IDE window" +msgstr "" + #: codystrconsts.crscontains msgid "Contains" msgstr "" +#: codystrconsts.crscontinue +msgid "Continue" +msgstr "" + #: codystrconsts.crscopydeclarationtoclipboard msgid "Copy declaration to Clipboard" msgstr "" @@ -169,6 +195,11 @@ msgstr "" msgid "Count" msgstr "" +#: codystrconsts.crscousespath +msgctxt "codystrconsts.crscousespath" +msgid "Uses path" +msgstr "" + #: codystrconsts.crscuallfiles msgid "%s|All files (%s)|%s" msgstr "" @@ -297,6 +328,15 @@ msgstr "" msgid "Identifier \"%s\" not found in unit \"%s\". Maybe the identifier does not exist for this platform or maybe the identifier was deleted/renamed." msgstr "" +#: codystrconsts.crsidewindowdockable +msgid "IDE window, dockable" +msgstr "" + +#: codystrconsts.crsifidentifierisaddedtotheimplementationsectionandne +msgctxt "codystrconsts.crsifidentifierisaddedtotheimplementationsectionandne" +msgid "If identifier is added to the implementation section and needed unit needs to be added, add to the uses section of the implementation" +msgstr "" + #: codystrconsts.crsimpossibledependency msgid "Impossible dependency" msgstr "" @@ -349,6 +389,10 @@ msgstr "" msgid "%s member of %s %s" msgstr "" +#: codystrconsts.crsmenuitemcaption +msgid "Menu item caption:" +msgstr "" + #: codystrconsts.crsminutes msgid "%s minutes" msgstr "" @@ -365,6 +409,10 @@ msgstr "" msgid "No project" msgstr "" +#: codystrconsts.crsnotethenameoftheformmustbeavalidpascalidentifieran +msgid "Note: The name of the form must be a valid pascal identifier and unique across the whole IDE, which includes all packages. Prepend the name with an abbreviation of your package. The prefixes \"IDE\", \"Laz\", \"Pkg\" are already used by the IDE itself." +msgstr "" + #: codystrconsts.crsnounitselected msgid "No unit selected" msgstr "" @@ -641,19 +689,3 @@ msgstr "" msgid "Where" msgstr "" -#: codystrconsts.lisaddunittoimplementationusessection -msgid "Add unit to implementation uses section" -msgstr "" - -#: codystrconsts.liscogeneral -msgid "General" -msgstr "" - -#: codystrconsts.liscousespath -msgid "Uses path" -msgstr "" - -#: codystrconsts.lisifidentifierisaddedtotheimplementationsectionandne -msgid "If identifier is added to the implementation section and needed unit needs to be added, add to the uses section of the implementation" -msgstr "" - diff --git a/components/codetools/ide/languages/codystrconsts.pt_BR.po b/components/codetools/ide/languages/codystrconsts.pt_BR.po index 6189a9951b..090285efc4 100644 --- a/components/codetools/ide/languages/codystrconsts.pt_BR.po +++ b/components/codetools/ide/languages/codystrconsts.pt_BR.po @@ -24,6 +24,11 @@ msgstr "Adicionar método \"Assign\" ..." msgid "Add a \"With\" Block" msgstr "Adicionar um bloco \"With\"" +#: codystrconsts.crsaddunittoimplementationusessection +msgctxt "codystrconsts.crsaddunittoimplementationusessection" +msgid "Add unit to implementation uses section" +msgstr "Adicionar unidade à seção \"uses\" da implementação" + #: codystrconsts.crsaddwithblock msgid "Add \"With\" Block" msgstr "Adicionar bloco \"With\"" @@ -40,6 +45,10 @@ msgstr "Já definido em %s" msgid "... and %s more identifiers" msgstr "... e mais %s identificadores" +#: codystrconsts.crsawindowforthelazarusideitcanbedockedlikethecodeexp +msgid "A window for the Lazarus IDE. It can be docked like the Code Explorer or the FPDoc Editor. This also creates a menu item in the View menu and a short cut." +msgstr "" + #: codystrconsts.crsbtncancel msgid "Cancel" msgstr "Cancelar" @@ -148,6 +157,10 @@ msgstr "?visibilidade?" msgid "%s, written by property %s" msgstr "%s, escrito pela propriedade %s" +#: codystrconsts.crscheetaheditor +msgid "Cheetah Editor" +msgstr "" + #: codystrconsts.crsclose msgid "&Close" msgstr "&Fechar" @@ -169,10 +182,23 @@ msgstr "Informação Nó de Código" msgid "Identifier Dictionary" msgstr "Dicionário de identificadores" +#: codystrconsts.crscogeneral +msgctxt "codystrconsts.crscogeneral" +msgid "General" +msgstr "Geral" + +#: codystrconsts.crsconfigurenewidewindow +msgid "Configure new IDE window" +msgstr "" + #: codystrconsts.crscontains msgid "Contains" msgstr "Contém" +#: codystrconsts.crscontinue +msgid "Continue" +msgstr "" + #: codystrconsts.crscopydeclarationtoclipboard #| msgid "Copy declaration to clipboard" msgid "Copy declaration to Clipboard" @@ -182,6 +208,11 @@ msgstr "Copiar declaração para área de transferência" msgid "Count" msgstr "Conta" +#: codystrconsts.crscousespath +msgctxt "codystrconsts.crscousespath" +msgid "Uses path" +msgstr "Caminho \"uses\"" + #: codystrconsts.crscuallfiles msgid "%s|All files (%s)|%s" msgstr "%s|Todos arquivos (%s)|%s" @@ -312,6 +343,15 @@ msgstr "Identificador não encontrado" msgid "Identifier \"%s\" not found in unit \"%s\". Maybe the identifier does not exist for this platform or maybe the identifier was deleted/renamed." msgstr "Identificador \"%s\" não encontrado na unidade \"%s\". Talvez o identificador não exista para esta plataforma ou talvez tenha sido excluído/renomeado." +#: codystrconsts.crsidewindowdockable +msgid "IDE window, dockable" +msgstr "" + +#: codystrconsts.crsifidentifierisaddedtotheimplementationsectionandne +msgctxt "codystrconsts.crsifidentifierisaddedtotheimplementationsectionandne" +msgid "If identifier is added to the implementation section and needed unit needs to be added, add to the uses section of the implementation" +msgstr "Se o identificador for adicionado à seção de implementação e a unidade necessária precisar ser adicionada, adicionar à seção \"uses\" da implementação" + #: codystrconsts.crsimpossibledependency msgid "Impossible dependency" msgstr "Dependência impossível" @@ -366,6 +406,10 @@ msgstr "Mbytes" msgid "%s member of %s %s" msgstr "%s membro de %s %s" +#: codystrconsts.crsmenuitemcaption +msgid "Menu item caption:" +msgstr "" + #: codystrconsts.crsminutes msgid "%s minutes" msgstr "%s minutos" @@ -382,6 +426,10 @@ msgstr "nada selecionado" msgid "No project" msgstr "Nenhum projeto" +#: codystrconsts.crsnotethenameoftheformmustbeavalidpascalidentifieran +msgid "Note: The name of the form must be a valid pascal identifier and unique across the whole IDE, which includes all packages. Prepend the name with an abbreviation of your package. The prefixes \"IDE\", \"Laz\", \"Pkg\" are already used by the IDE itself." +msgstr "" + #: codystrconsts.crsnounitselected msgid "No unit selected" msgstr "Nenhuma unidade selecionada" @@ -664,19 +712,3 @@ msgstr "Unidade Virtual" msgid "Where" msgstr "Where" -#: codystrconsts.lisaddunittoimplementationusessection -msgid "Add unit to implementation uses section" -msgstr "Adicionar unidade à seção \"uses\" da implementação" - -#: codystrconsts.liscogeneral -msgid "General" -msgstr "Geral" - -#: codystrconsts.liscousespath -msgid "Uses path" -msgstr "Caminho \"uses\"" - -#: codystrconsts.lisifidentifierisaddedtotheimplementationsectionandne -msgid "If identifier is added to the implementation section and needed unit needs to be added, add to the uses section of the implementation" -msgstr "Se o identificador for adicionado à seção de implementação e a unidade necessária precisar ser adicionada, adicionar à seção \"uses\" da implementação" - diff --git a/components/codetools/ide/languages/codystrconsts.ru.po b/components/codetools/ide/languages/codystrconsts.ru.po index 1884ad7be3..017f8a706b 100644 --- a/components/codetools/ide/languages/codystrconsts.ru.po +++ b/components/codetools/ide/languages/codystrconsts.ru.po @@ -24,6 +24,11 @@ msgstr "Добавить метод Assign ..." msgid "Add a \"With\" Block" msgstr "Добавить блок \"With\"" +#: codystrconsts.crsaddunittoimplementationusessection +msgctxt "codystrconsts.crsaddunittoimplementationusessection" +msgid "Add unit to implementation uses section" +msgstr "Добавить модуль в выражение Uses секции Implementation" + #: codystrconsts.crsaddwithblock msgid "Add \"With\" Block" msgstr "Добавление блока \"With\"" @@ -40,6 +45,10 @@ msgstr "Уже объявлена (%s)" msgid "... and %s more identifiers" msgstr "... дополнительно идентификаторов: %s" +#: codystrconsts.crsawindowforthelazarusideitcanbedockedlikethecodeexp +msgid "A window for the Lazarus IDE. It can be docked like the Code Explorer or the FPDoc Editor. This also creates a menu item in the View menu and a short cut." +msgstr "" + #: codystrconsts.crsbtncancel msgid "Cancel" msgstr "Отмена" @@ -148,6 +157,10 @@ msgstr "?видимость?" msgid "%s, written by property %s" msgstr "%s, записывается свойством %s" +#: codystrconsts.crscheetaheditor +msgid "Cheetah Editor" +msgstr "" + #: codystrconsts.crsclose msgid "&Close" msgstr "&Закрыть" @@ -169,10 +182,23 @@ msgstr "Сведения об элементе кода" msgid "Identifier Dictionary" msgstr "Словарь идентификаторов" +#: codystrconsts.crscogeneral +msgctxt "codystrconsts.crscogeneral" +msgid "General" +msgstr "Общие" + +#: codystrconsts.crsconfigurenewidewindow +msgid "Configure new IDE window" +msgstr "" + #: codystrconsts.crscontains msgid "Contains" msgstr "Содержит" +#: codystrconsts.crscontinue +msgid "Continue" +msgstr "" + #: codystrconsts.crscopydeclarationtoclipboard #| msgid "Copy declaration to clipboard" msgid "Copy declaration to Clipboard" @@ -182,6 +208,11 @@ msgstr "Копировать объявление в буфер обмена" msgid "Count" msgstr "Количество" +#: codystrconsts.crscousespath +msgctxt "codystrconsts.crscousespath" +msgid "Uses path" +msgstr "Цепочка Uses" + #: codystrconsts.crscuallfiles msgid "%s|All files (%s)|%s" msgstr "%s|Все файлы (%s)|%s" @@ -312,6 +343,15 @@ msgstr "Идентификатор не найден" msgid "Identifier \"%s\" not found in unit \"%s\". Maybe the identifier does not exist for this platform or maybe the identifier was deleted/renamed." msgstr "Идентификатор \"%s\" не найден в модуле \"%s\". Вероятно, идентификатор не существует на данной платформе либо был удалён или перемещён." +#: codystrconsts.crsidewindowdockable +msgid "IDE window, dockable" +msgstr "" + +#: codystrconsts.crsifidentifierisaddedtotheimplementationsectionandne +msgctxt "codystrconsts.crsifidentifierisaddedtotheimplementationsectionandne" +msgid "If identifier is added to the implementation section and needed unit needs to be added, add to the uses section of the implementation" +msgstr "Если при добавлении идентификатора в секцию Implementation требуется подключить необходимый модуль, подключать его в выражении Uses секции Implementation" + #: codystrconsts.crsimpossibledependency msgid "Impossible dependency" msgstr "Недопустимая зависимость" @@ -367,6 +407,10 @@ msgstr "МБ" msgid "%s member of %s %s" msgstr "Элемент секции %s в %s %s" +#: codystrconsts.crsmenuitemcaption +msgid "Menu item caption:" +msgstr "" + #: codystrconsts.crsminutes msgid "%s minutes" msgstr "%s минут" @@ -383,6 +427,10 @@ msgstr "не выбран" msgid "No project" msgstr "Проект отсутствует" +#: codystrconsts.crsnotethenameoftheformmustbeavalidpascalidentifieran +msgid "Note: The name of the form must be a valid pascal identifier and unique across the whole IDE, which includes all packages. Prepend the name with an abbreviation of your package. The prefixes \"IDE\", \"Laz\", \"Pkg\" are already used by the IDE itself." +msgstr "" + #: codystrconsts.crsnounitselected msgid "No unit selected" msgstr "Модуль не выбран" @@ -666,19 +714,3 @@ msgstr "Виртуальный модуль" msgid "Where" msgstr "Расположение" -#: codystrconsts.lisaddunittoimplementationusessection -msgid "Add unit to implementation uses section" -msgstr "Добавить модуль в выражение Uses секции Implementation" - -#: codystrconsts.liscogeneral -msgid "General" -msgstr "Общие" - -#: codystrconsts.liscousespath -msgid "Uses path" -msgstr "Цепочка Uses" - -#: codystrconsts.lisifidentifierisaddedtotheimplementationsectionandne -msgid "If identifier is added to the implementation section and needed unit needs to be added, add to the uses section of the implementation" -msgstr "Если при добавлении идентификатора в секцию Implementation требуется подключить необходимый модуль, подключать его в выражении Uses секции Implementation" - diff --git a/components/codetools/ide/languages/codystrconsts.uk.po b/components/codetools/ide/languages/codystrconsts.uk.po index 3b8d0c7e6f..5400d2f3ce 100644 --- a/components/codetools/ide/languages/codystrconsts.uk.po +++ b/components/codetools/ide/languages/codystrconsts.uk.po @@ -25,6 +25,11 @@ msgstr "Додати метод Assign ..." msgid "Add a \"With\" Block" msgstr "" +#: codystrconsts.crsaddunittoimplementationusessection +msgctxt "codystrconsts.crsaddunittoimplementationusessection" +msgid "Add unit to implementation uses section" +msgstr "" + #: codystrconsts.crsaddwithblock msgid "Add \"With\" Block" msgstr "" @@ -41,6 +46,10 @@ msgstr "Вже визначений в %s" msgid "... and %s more identifiers" msgstr "" +#: codystrconsts.crsawindowforthelazarusideitcanbedockedlikethecodeexp +msgid "A window for the Lazarus IDE. It can be docked like the Code Explorer or the FPDoc Editor. This also creates a menu item in the View menu and a short cut." +msgstr "" + #: codystrconsts.crsbtncancel msgid "Cancel" msgstr "Скасувати" @@ -149,6 +158,10 @@ msgstr "?видимість?" msgid "%s, written by property %s" msgstr "%s, записаний властивістю %s" +#: codystrconsts.crscheetaheditor +msgid "Cheetah Editor" +msgstr "" + #: codystrconsts.crsclose msgid "&Close" msgstr "&Закрити" @@ -169,10 +182,23 @@ msgstr "Інформація про Вузол Коду" msgid "Identifier Dictionary" msgstr "" +#: codystrconsts.crscogeneral +msgctxt "codystrconsts.crscogeneral" +msgid "General" +msgstr "Загальні" + +#: codystrconsts.crsconfigurenewidewindow +msgid "Configure new IDE window" +msgstr "" + #: codystrconsts.crscontains msgid "Contains" msgstr "" +#: codystrconsts.crscontinue +msgid "Continue" +msgstr "" + #: codystrconsts.crscopydeclarationtoclipboard #, fuzzy #| msgid "Copy declaration to clipboard" @@ -183,6 +209,11 @@ msgstr "Копіювати оголошення в буфер" msgid "Count" msgstr "" +#: codystrconsts.crscousespath +msgctxt "codystrconsts.crscousespath" +msgid "Uses path" +msgstr "Шлях Uses" + #: codystrconsts.crscuallfiles msgid "%s|All files (%s)|%s" msgstr "%s|Всі файли (%s)|%s" @@ -315,6 +346,15 @@ msgstr "" msgid "Identifier \"%s\" not found in unit \"%s\". Maybe the identifier does not exist for this platform or maybe the identifier was deleted/renamed." msgstr "" +#: codystrconsts.crsidewindowdockable +msgid "IDE window, dockable" +msgstr "" + +#: codystrconsts.crsifidentifierisaddedtotheimplementationsectionandne +msgctxt "codystrconsts.crsifidentifierisaddedtotheimplementationsectionandne" +msgid "If identifier is added to the implementation section and needed unit needs to be added, add to the uses section of the implementation" +msgstr "" + #: codystrconsts.crsimpossibledependency msgid "Impossible dependency" msgstr "" @@ -369,6 +409,10 @@ msgstr "МБ" msgid "%s member of %s %s" msgstr "%s членів %s %s" +#: codystrconsts.crsmenuitemcaption +msgid "Menu item caption:" +msgstr "" + #: codystrconsts.crsminutes msgid "%s minutes" msgstr "" @@ -385,6 +429,10 @@ msgstr "" msgid "No project" msgstr "Немає проекту" +#: codystrconsts.crsnotethenameoftheformmustbeavalidpascalidentifieran +msgid "Note: The name of the form must be a valid pascal identifier and unique across the whole IDE, which includes all packages. Prepend the name with an abbreviation of your package. The prefixes \"IDE\", \"Laz\", \"Pkg\" are already used by the IDE itself." +msgstr "" + #: codystrconsts.crsnounitselected msgid "No unit selected" msgstr "Модуль не вибраний" @@ -669,19 +717,3 @@ msgstr "Віртуальний модуль" msgid "Where" msgstr "Розміщення" -#: codystrconsts.lisaddunittoimplementationusessection -msgid "Add unit to implementation uses section" -msgstr "" - -#: codystrconsts.liscogeneral -msgid "General" -msgstr "Загальні" - -#: codystrconsts.liscousespath -msgid "Uses path" -msgstr "Шлях Uses" - -#: codystrconsts.lisifidentifierisaddedtotheimplementationsectionandne -msgid "If identifier is added to the implementation section and needed unit needs to be added, add to the uses section of the implementation" -msgstr "" - diff --git a/components/codetools/ide/newidewnddlg.lfm b/components/codetools/ide/newidewnddlg.lfm new file mode 100644 index 0000000000..b1129873dc --- /dev/null +++ b/components/codetools/ide/newidewnddlg.lfm @@ -0,0 +1,105 @@ +object NewIDEWndCfgDialog: TNewIDEWndCfgDialog + Left = 250 + Height = 204 + Top = 250 + Width = 300 + AutoSize = True + Caption = 'NewIDEWndCfgDialog' + ClientHeight = 204 + ClientWidth = 300 + Constraints.MinWidth = 300 + OnCreate = FormCreate + Position = poScreenCenter + LCLVersion = '1.1' + object OkButton: TButton + AnchorSideTop.Control = MenuItemCaptionEdit + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = Owner + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Side = asrBottom + Left = 227 + Height = 26 + Top = 101 + Width = 63 + Anchors = [akTop, akRight] + AutoSize = True + BorderSpacing.Around = 10 + Caption = 'OkButton' + Default = True + OnClick = OkButtonClick + TabOrder = 0 + end + object FormNameLabel: TLabel + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = FormNameEdit + AnchorSideTop.Side = asrCenter + Left = 6 + Height = 15 + Top = 11 + Width = 92 + BorderSpacing.Left = 6 + Caption = 'FormNameLabel' + ParentColor = False + end + object FormNameEdit: TEdit + AnchorSideLeft.Control = FormNameLabel + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = Owner + AnchorSideRight.Control = Owner + AnchorSideRight.Side = asrBottom + Left = 104 + Height = 24 + Top = 6 + Width = 190 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Around = 6 + OnChange = FormNameEditChange + TabOrder = 1 + Text = 'FormNameEdit' + end + object MenuItemCaptionLabel: TLabel + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = MenuItemCaptionEdit + AnchorSideTop.Side = asrCenter + Left = 6 + Height = 15 + Top = 72 + Width = 129 + BorderSpacing.Left = 6 + Caption = 'MenuItemCaptionLabel' + ParentColor = False + end + object MenuItemCaptionEdit: TEdit + AnchorSideLeft.Control = MenuItemCaptionLabel + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = FormNameNoteLabel + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = Owner + AnchorSideRight.Side = asrBottom + Left = 141 + Height = 24 + Top = 67 + Width = 153 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Top = 10 + BorderSpacing.Around = 6 + TabOrder = 2 + Text = 'MenuItemCaptionEdit' + end + object FormNameNoteLabel: TLabel + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = FormNameEdit + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = Owner + AnchorSideRight.Side = asrBottom + Left = 6 + Height = 15 + Top = 36 + Width = 288 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Around = 6 + Caption = 'FormNameNoteLabel' + ParentColor = False + WordWrap = True + end +end diff --git a/components/codetools/ide/newidewnddlg.pas b/components/codetools/ide/newidewnddlg.pas new file mode 100644 index 0000000000..49769401cb --- /dev/null +++ b/components/codetools/ide/newidewnddlg.pas @@ -0,0 +1,252 @@ +unit NewIDEWndDlg; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, LazLogger, LazUTF8, CodeCache, CodeToolManager, + Forms, Controls, Graphics, Dialogs, StdCtrls, ProjectIntf, MacroIntf, + IDEDialogs, CodyStrConsts; + +type + + { TFileDescIDEDockableWindow } + + TFileDescIDEDockableWindow = class(TFileDescPascalUnit) + private + FMenuItemCaption: string; + FTemplateImplementation: string; + FTemplateInterface: string; + FTemplateLFM: string; + FTemplateUsesSection: string; + FTemplateLoaded: boolean; + function ExtractTemplate(Src, StartMarker, EndMarker: string): string; + procedure LoadTemplate; + public + constructor Create; override; + function Init(var NewFilename: string; NewOwner: TObject; + var NewSource: string; Quiet: boolean): TModalResult; override; + function GetLocalizedName: string; override; + function GetLocalizedDescription: string; override; + function GetInterfaceUsesSection: string; override; + function GetInterfaceSource(const {%H-}Filename, {%H-}SourceName, + ResourceName: string): string; override; + function GetImplementationSource(const {%H-}Filename, {%H-}SourceName, + ResourceName: string): string; override; + property TemplateUsesSection: string read FTemplateUsesSection write FTemplateUsesSection; + property TemplateInterface: string read FTemplateInterface write FTemplateInterface; + property TemplateImplementation: string read FTemplateImplementation write FTemplateImplementation; + property TemplateLFM: string read FTemplateLFM write FTemplateLFM; + property MenuItemCaption: string read FMenuItemCaption write FMenuItemCaption; + end; + + + { TNewIDEWndCfgDialog } + + TNewIDEWndCfgDialog = class(TForm) + FormNameEdit: TEdit; + FormNameLabel: TLabel; + FormNameNoteLabel: TLabel; + MenuItemCaptionEdit: TEdit; + MenuItemCaptionLabel: TLabel; + OkButton: TButton; + procedure FormCreate(Sender: TObject); + procedure FormNameEditChange(Sender: TObject); + procedure OkButtonClick(Sender: TObject); + private + function IsFormNameValid: boolean; + function IsMenuCaptionValid: boolean; + public + end; + +implementation + +{$R *.lfm} + +{ TNewIDEWndCfgDialog } + +procedure TNewIDEWndCfgDialog.FormCreate(Sender: TObject); +begin + Caption:=crsConfigureNewIDEWindow; + FormNameLabel.Caption:='Form.Name:'; + FormNameEdit.Text:='MyPkgCheetahEditor'; + FormNameNoteLabel.Caption:= + crsNoteTheNameOfTheFormMustBeAValidPascalIdentifierAn; + MenuItemCaptionLabel.Caption:=crsMenuItemCaption; + MenuItemCaptionEdit.Text:=crsCheetahEditor; + OkButton.Caption:=crsContinue; +end; + +procedure TNewIDEWndCfgDialog.FormNameEditChange(Sender: TObject); +begin + if IsFormNameValid then + FormNameLabel.Font.Color:=clDefault + else + FormNameLabel.Font.Color:=clRed; +end; + +procedure TNewIDEWndCfgDialog.OkButtonClick(Sender: TObject); +begin + if not IsFormNameValid then begin + IDEMessageDialog('Error','Invalid form name.',mtError,[mbCancel]); + exit; + end; + if not IsMenuCaptionValid then begin + IDEMessageDialog('Error','Invalid menu caption.',mtError,[mbCancel]); + exit; + end; + ModalResult:=mrOK; +end; + +function TNewIDEWndCfgDialog.IsFormNameValid: boolean; +var + s: TCaption; +begin + s:=FormNameEdit.Text; + Result:=(s<>'') and IsValidIdent(s); +end; + +function TNewIDEWndCfgDialog.IsMenuCaptionValid: boolean; +var + s: TCaption; +begin + s:=UTF8Trim(MenuItemCaptionEdit.Text); + Result:=(s<>'') and (length(s)<255); +end; + +{ TFileDescIDEDockableWindow } + +function TFileDescIDEDockableWindow.ExtractTemplate(Src, StartMarker, + EndMarker: string): string; +var + StartPos: SizeInt; + EndPos: SizeInt; +begin + StartPos:=system.Pos(StartMarker,Src); + EndPos:=system.Pos(EndMarker,Src); + if StartPos<1 then begin + DebugLn(['ERROR: TFileDescIDEDockableWindow.ExtractTemplate marker "'+StartMarker+'" not found']); + debugln('Source: =================================================='); + debugln(Src); + debugln('=========================================================='); + exit; + end; + if EndPos<1 then begin + debugln(['ERROR: TFileDescIDEDockableWindow.ExtractTemplate marker "'+EndMarker+'" not found']); + exit; + end; + inc(StartPos,length(StartMarker)); + Result:=UTF8Trim(copy(Src,StartPos,EndPos-StartPos)); +end; + +procedure TFileDescIDEDockableWindow.LoadTemplate; +var + BaseDir: String; + Filename: String; + Code: TCodeBuffer; +begin + if FTemplateLoaded then exit; + + BaseDir:='$PkgDir(Cody)'; + IDEMacros.SubstituteMacros(BaseDir); + if (BaseDir='') or (not DirectoryExistsUTF8(BaseDir)) then begin + debugln(['ERROR: TFileDescIDEDockableWindow.Create cody directory not found']); + exit; + end; + + // load unit source + Filename:=AppendPathDelim(BaseDir)+'templateidedockablewindow.pas'; + if not FileExistsUTF8(Filename) then begin + debugln(['ERROR: TFileDescIDEDockableWindow.Create template file not found: '+Filename]); + exit; + end; + Code:=CodeToolBoss.LoadFile(Filename,true,false); + if Code=nil then begin + debugln(['ERROR: TFileDescIDEDockableWindow.Create unable to read file ',Filename]); + exit; + end; + + TemplateUsesSection:=ExtractTemplate(Code.Source,'// UsesStart','// UsesEnd'); + TemplateInterface:=ExtractTemplate(Code.Source,'// InterfaceStart','// InterfaceEnd'); + TemplateImplementation:=ExtractTemplate(Code.Source,'// ImplementationStart','// ImplementationEnd'); + + // load lfm + Filename:=AppendPathDelim(BaseDir)+'templateidedockablewindow.lfm'; + if not FileExistsUTF8(Filename) then begin + debugln(['ERROR: TFileDescIDEDockableWindow.Create template file not found: '+Filename]); + exit; + end; + Code:=CodeToolBoss.LoadFile(Filename,true,false); + if Code=nil then begin + debugln(['ERROR: TFileDescIDEDockableWindow.Create unable to read file ',Filename]); + exit; + end; + + TemplateLFM:=Code.Source; +end; + +constructor TFileDescIDEDockableWindow.Create; +begin + inherited Create; + Name:='IDE window, dockable'; + ResourceClass:=TForm; + UseCreateFormStatements:=false; + RequiredPackages:='IDEIntf'; + AddToProject:=false; + TemplateInterface:='failed loading template'; + MenuItemCaption:='Cheetah Editor'; +end; + +function TFileDescIDEDockableWindow.Init(var NewFilename: string; + NewOwner: TObject; var NewSource: string; Quiet: boolean): TModalResult; +var + Dlg: TNewIDEWndCfgDialog; +begin + Result:=inherited Init(NewFilename, NewOwner, NewSource, Quiet); + if not Quiet then begin + Dlg:=TNewIDEWndCfgDialog.Create(nil); + try + Result:=Dlg.ShowModal; + if Result<>mrOk then exit; + DefaultResourceName:=Dlg.FormNameEdit.Text; + MenuItemCaption:=UTF8Trim(Dlg.MenuItemCaptionEdit.Text); + finally + Dlg.Free; + end; + end; +end; + +function TFileDescIDEDockableWindow.GetLocalizedName: string; +begin + Result:=crsIDEWindowDockable; +end; + +function TFileDescIDEDockableWindow.GetLocalizedDescription: string; +begin + Result:=crsAWindowForTheLazarusIDEItCanBeDockedLikeTheCodeExp; +end; + +function TFileDescIDEDockableWindow.GetInterfaceUsesSection: string; +begin + LoadTemplate; + Result:=TemplateUsesSection; +end; + +function TFileDescIDEDockableWindow.GetInterfaceSource(const Filename, + SourceName, ResourceName: string): string; +begin + LoadTemplate; + Result:=StringReplace(TemplateInterface,'TemplateName',ResourceName,[rfReplaceAll]); +end; + +function TFileDescIDEDockableWindow.GetImplementationSource(const Filename, + SourceName, ResourceName: string): string; +begin + LoadTemplate; + Result:=StringReplace(TemplateImplementation,'TemplateName',ResourceName,[rfReplaceAll]) + +LineEnding+LineEnding; +end; + +end. + diff --git a/components/codetools/ide/ppulistdlg.pas b/components/codetools/ide/ppulistdlg.pas index 6952d4b5cc..f1ac8f6cf2 100644 --- a/components/codetools/ide/ppulistdlg.pas +++ b/components/codetools/ide/ppulistdlg.pas @@ -274,7 +274,7 @@ begin UnitsStringGrid.Columns[4].Title.Caption:=crsUsedBy; UnitsStringGrid.Columns[5].Title.Caption:=crsPackage; - InfoTabSheet.Caption:=lisCOGeneral; + InfoTabSheet.Caption:=crsCOGeneral; UsesTabSheet.Caption:=crsUses; UsesStringGrid.Columns[0].Title.Caption:=crsUnit; @@ -282,7 +282,7 @@ begin UsedByTabSheet.Caption:=crsUsedBy; UsedByStringGrid.Columns[0].Title.Caption:=crsUnit; - UsesPathTabSheet.Caption:=lisCOUsesPath; + UsesPathTabSheet.Caption:=crsCOUsesPath; UsesPathStringGrid.Columns[0].Title.Caption:=crsUnit; UnitLinkedFilesTabSheet.Caption:=crsLinkedFiles; diff --git a/components/codetools/ide/templateidedockablewindow.pas b/components/codetools/ide/templateidedockablewindow.pas index e790a3d86c..4ce95551d6 100644 --- a/components/codetools/ide/templateidedockablewindow.pas +++ b/components/codetools/ide/templateidedockablewindow.pas @@ -73,21 +73,26 @@ procedure Register; var CmdCatViewMenu: TIDECommandCategory; ViewTemplateNameCommand: TIDECommand; + MenuItemCaption: String; begin // register shortcut and menu item + MenuItemCaption:='Caption of TemplateName'; // <- this caption should be replaced by a resourcestring // search shortcut category CmdCatViewMenu:=IDECommandList.FindCategoryByName(CommandCategoryViewName); // register shortcut - ViewTemplateNameCommand:=RegisterIDECommand(CmdCatViewMenu, 'ViewTemplateName', - 'TemplateMenuCaption', + ViewTemplateNameCommand:=RegisterIDECommand(CmdCatViewMenu, + 'ViewTemplateName', + MenuItemCaption, IDEShortCut(VK_UNKNOWN,[]), // <- set here your default shortcut CleanIDEShortCut,nil,@ShowTemplateName); // register menu item in View menu - RegisterIDEMenuCommand(itmViewMainWindows, 'ViewTemplateName', - 'TemplateMenuCaption', nil, nil, ViewTemplateNameCommand); + RegisterIDEMenuCommand(itmViewMainWindows, + 'ViewTemplateName', + MenuItemCaption, nil, nil, ViewTemplateNameCommand); // register dockable Window - TemplateNameCreator:=IDEWindowCreators.Add('TemplateName', + TemplateNameCreator:=IDEWindowCreators.Add( + 'TemplateName', @CreateTemplateName,nil, '100','100','300','300' // default place at left=100, top=100, width=300, height=300 // you can also define percentage values of screen or relative positions, see wiki diff --git a/ide/main.pp b/ide/main.pp index a7beebb120..9257181e99 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -804,7 +804,7 @@ type // files/units function DoNewFile(NewFileDescriptor: TProjectFileDescriptor; - var NewFilename: string; const NewSource: string; + var NewFilename: string; NewSource: string; NewFlags: TNewFlags; NewOwner: TObject): TModalResult; override; function DoNewOther: TModalResult; procedure CreateFileDialogFilterForSourceEditorFiles(Filter: string; @@ -8819,7 +8819,7 @@ begin end; function TMainIDE.DoNewFile(NewFileDescriptor: TProjectFileDescriptor; - var NewFilename: string; const NewSource: string; + var NewFilename: string; NewSource: string; NewFlags: TNewFlags; NewOwner: TObject): TModalResult; function BeautifySrc(const s: string): string; @@ -8861,6 +8861,9 @@ begin end; end; + Result:=NewFileDescriptor.Init(NewFilename,NewOwner,NewSource,nfQuiet in NewFlags); + if Result<>mrOk then exit; + if FilenameIsAbsolute(NewFilename) and DirectoryExistsUTF8(NewFilename) then begin IDEMessageDialog(lisFileIsDirectory, @@ -9113,19 +9116,21 @@ end; function TMainIDE.DoNewOther: TModalResult; var NewIDEItem: TNewIDEItemTemplate; + NewFile: TNewItemProjectFile; begin Result:=ShowNewIDEItemDialog(NewIDEItem); if Result<>mrOk then exit; if NewIDEItem is TNewItemProjectFile then begin // file - if TNewItemProjectFile(NewIDEItem).Descriptor<>nil then - TNewItemProjectFile(NewIDEItem).Descriptor.Owner:=Project1; + NewFile:=TNewItemProjectFile(NewIDEItem); + if NewFile.Descriptor<>nil then + NewFile.Descriptor.Owner:=Project1; try - Result:=DoNewEditorFile(TNewItemProjectFile(NewIDEItem).Descriptor, + Result:=DoNewEditorFile(NewFile.Descriptor, '','',[nfOpenInEditor,nfCreateDefaultSrc]); finally - if TNewItemProjectFile(NewIDEItem).Descriptor<>nil then - TNewItemProjectFile(NewIDEItem).Descriptor.Owner:=nil; + if NewFile.Descriptor<>nil then + NewFile.Descriptor.Owner:=nil; end; end else if NewIDEItem is TNewItemProject then begin // project diff --git a/ideintf/lazideintf.pas b/ideintf/lazideintf.pas index 1a46e61f4d..343bbffa1d 100644 --- a/ideintf/lazideintf.pas +++ b/ideintf/lazideintf.pas @@ -200,7 +200,7 @@ type NewFilename: string; const NewSource: string; NewFlags: TNewFlags): TModalResult; function DoNewFile(NewFileDescriptor: TProjectFileDescriptor; - var NewFilename: string; const NewSource: string; + var NewFilename: string; NewSource: string; NewFlags: TNewFlags; NewOwner: TObject): TModalResult; virtual; abstract; function DoSaveEditorFile(PageIndex:integer; Flags: TSaveFlags): TModalResult; virtual; abstract; diff --git a/ideintf/projectintf.pas b/ideintf/projectintf.pas index e6035f242e..fabff6f78b 100644 --- a/ideintf/projectintf.pas +++ b/ideintf/projectintf.pas @@ -127,6 +127,8 @@ type function CreateSource(const Filename, SourceName, ResourceName: string): string; virtual; procedure UpdateDefaultPascalFileExtension(const DefPasExt: string); virtual; + function Init(var NewFilename: string; NewOwner: TObject; + var NewSource: string; Quiet: boolean): TModalResult; virtual; public property Owner: TObject read FOwner write SetOwner; // project, package or nil property Name: string read FName write SetName; @@ -802,6 +804,12 @@ begin DefaultFilename:=ChangeFileExt(DefaultFilename,DefPasExt); end; +function TProjectFileDescriptor.Init(var NewFilename: string; + NewOwner: TObject; var NewSource: string; Quiet: boolean): TModalResult; +begin + Result:=mrOk; +end; + { TFileDescPascalUnit } constructor TFileDescPascalUnit.Create;