diff --git a/Frames/FMX/uFrame_GitIgnoreGenerator.fmx b/Frames/FMX/uFrame_GitIgnoreGenerator.fmx new file mode 100644 index 0000000..2f02ecf --- /dev/null +++ b/Frames/FMX/uFrame_GitIgnoreGenerator.fmx @@ -0,0 +1,278 @@ +object Frame_GitIgnoreGenerator: TFrame_GitIgnoreGenerator + Size.Width = 852.000000000000000000 + Size.Height = 756.000000000000000000 + Size.PlatformDefault = False + object layBottom: TLayout + Align = Client + Padding.Left = 20.000000000000000000 + Padding.Top = 20.000000000000000000 + Padding.Right = 20.000000000000000000 + Padding.Bottom = 20.000000000000000000 + Size.Width = 852.000000000000000000 + Size.Height = 568.000000000000000000 + Size.PlatformDefault = False + TabOrder = 0 + object memTitleOutput: TLabel + Align = Top + StyledSettings = [Family, Style, FontColor] + Position.X = 20.000000000000000000 + Position.Y = 20.000000000000000000 + Size.Width = 812.000000000000000000 + Size.Height = 36.000000000000000000 + Size.PlatformDefault = False + TextSettings.Font.Size = 20.000000000000000000 + TextSettings.Trimming = None + Text = '.gitignore Content' + TabOrder = 0 + object btnOutputCopyToClipboard: TButton + Align = Right + Cursor = crHandPoint + Margins.Top = 1.000000000000000000 + Margins.Right = 1.000000000000000000 + Margins.Bottom = 1.000000000000000000 + Position.X = 741.000000000000000000 + Position.Y = 1.000000000000000000 + Size.Width = 70.000000000000000000 + Size.Height = 34.000000000000000000 + Size.PlatformDefault = False + TabOrder = 5 + TextSettings.Trimming = None + OnClick = btnOutputCopyToClipboardClick + object imgOutputCopyToClipboard: TSkSvg + Align = Left + Margins.Left = 5.000000000000000000 + Margins.Top = 5.000000000000000000 + Margins.Right = 5.000000000000000000 + Margins.Bottom = 5.000000000000000000 + Position.X = 5.000000000000000000 + Position.Y = 5.000000000000000000 + Size.Width = 24.000000000000000000 + Size.Height = 24.000000000000000000 + Size.PlatformDefault = False + Svg.OverrideColor = claWhite + Svg.Source = + ''#13 + + #10' '#13#10' '#13#10'' + end + object lblOutputCopyToClipboard: TLabel + Align = Client + Size.Width = 36.000000000000000000 + Size.Height = 34.000000000000000000 + Size.PlatformDefault = False + TextSettings.Trimming = None + Text = 'Copy' + TabOrder = 5 + end + end + end + object memOutput: TMemo + Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] + DataDetectorTypes = [] + Align = Client + Size.Width = 812.000000000000000000 + Size.Height = 492.000000000000000000 + Size.PlatformDefault = False + TabOrder = 1 + Viewport.Width = 812.000000000000000000 + Viewport.Height = 492.000000000000000000 + end + end + object layTop: TLayout + Align = Top + Padding.Left = 20.000000000000000000 + Padding.Top = 20.000000000000000000 + Padding.Right = 20.000000000000000000 + Padding.Bottom = 20.000000000000000000 + Size.Width = 852.000000000000000000 + Size.Height = 188.000000000000000000 + Size.PlatformDefault = False + TabOrder = 1 + object lblConfiguration: TLabel + Align = Top + StyledSettings = [Family, Style, FontColor] + Position.X = 20.000000000000000000 + Position.Y = 20.000000000000000000 + Size.Width = 812.000000000000000000 + Size.Height = 30.000000000000000000 + Size.PlatformDefault = False + TextSettings.Font.Size = 20.000000000000000000 + TextSettings.Trimming = None + Text = 'Configuration' + TabOrder = 0 + end + object layCategory: TRectangle + Align = Top + Fill.Color = x4B000000 + Padding.Left = 12.000000000000000000 + Padding.Top = 12.000000000000000000 + Padding.Right = 12.000000000000000000 + Padding.Bottom = 12.000000000000000000 + Margins.Bottom = 6.000000000000000000 + Position.X = 20.000000000000000000 + Position.Y = 50.000000000000000000 + Sides = [] + Size.Width = 812.000000000000000000 + Size.Height = 56.000000000000000000 + Size.PlatformDefault = False + Stroke.Kind = None + XRadius = 8.000000000000000000 + YRadius = 8.000000000000000000 + object imgCategory: TSkSvg + Align = Left + Margins.Left = 5.000000000000000000 + Margins.Top = 8.000000000000000000 + Margins.Right = 8.000000000000000000 + Margins.Bottom = 8.000000000000000000 + Position.X = 17.000000000000000000 + Position.Y = 20.000000000000000000 + Size.Width = 24.000000000000000000 + Size.Height = 24.000000000000000000 + Size.PlatformDefault = False + Svg.OverrideColor = claWhite + Svg.Source = + ''#13#10' ' + + '' + + #13#10' '#13#10'' + end + object layCategoryTitleDescription: TLayout + Align = Client + Size.Width = 611.000000000000000000 + Size.Height = 32.000000000000000000 + Size.PlatformDefault = False + TabOrder = 1 + object lblCategoryTitle: TLabel + Align = Client + StyledSettings = [Family, Style, FontColor] + Size.Width = 611.000000000000000000 + Size.Height = 32.000000000000000000 + Size.PlatformDefault = False + TextSettings.Font.Size = 18.000000000000000000 + TextSettings.Trimming = None + Text = 'Category' + TabOrder = 1 + end + object lblCategoryDescription: TLabel + Align = Bottom + StyledSettings = [Family, Style, FontColor] + Position.Y = 32.000000000000000000 + Size.Width = 611.000000000000000000 + Size.Height = 0.000000000000000000 + Size.PlatformDefault = False + TextSettings.Font.Size = 14.000000000000000000 + TextSettings.Trimming = None + Text = 'Select the category of gitignore template' + TabOrder = 0 + Visible = False + end + end + object cbCategory: TComboBox + Align = Right + ItemIndex = -1 + Position.X = 660.000000000000000000 + Position.Y = 12.000000000000000000 + Size.Width = 140.000000000000000000 + Size.Height = 32.000000000000000000 + Size.PlatformDefault = False + TabOrder = 2 + OnChange = cbCategoryChange + end + end + object layTemplate: TRectangle + Align = Top + Fill.Color = x4B000000 + Padding.Left = 12.000000000000000000 + Padding.Top = 12.000000000000000000 + Padding.Right = 12.000000000000000000 + Padding.Bottom = 12.000000000000000000 + Margins.Bottom = 6.000000000000000000 + Position.X = 20.000000000000000000 + Position.Y = 112.000000000000000000 + Sides = [] + Size.Width = 812.000000000000000000 + Size.Height = 56.000000000000000000 + Size.PlatformDefault = False + Stroke.Kind = None + XRadius = 8.000000000000000000 + YRadius = 8.000000000000000000 + object imgTemplate: TSkSvg + Align = Left + Margins.Left = 5.000000000000000000 + Margins.Top = 8.000000000000000000 + Margins.Right = 8.000000000000000000 + Margins.Bottom = 8.000000000000000000 + Position.X = 17.000000000000000000 + Position.Y = 20.000000000000000000 + Size.Width = 24.000000000000000000 + Size.Height = 24.000000000000000000 + Size.PlatformDefault = False + Svg.OverrideColor = claWhite + Svg.Source = + ''#13#10' '#13#10' '#13#10'' + end + object layTemplateTitleDescription: TLayout + Align = Client + Size.Width = 611.000000000000000000 + Size.Height = 32.000000000000000000 + Size.PlatformDefault = False + TabOrder = 1 + object lblTemplateTitle: TLabel + Align = Client + StyledSettings = [Family, Style, FontColor] + Size.Width = 611.000000000000000000 + Size.Height = 32.000000000000000000 + Size.PlatformDefault = False + TextSettings.Font.Size = 18.000000000000000000 + TextSettings.Trimming = None + Text = 'Template' + TabOrder = 1 + end + object lblTemplateDescription: TLabel + Align = Bottom + StyledSettings = [Family, Style, FontColor] + Position.Y = 32.000000000000000000 + Size.Width = 611.000000000000000000 + Size.Height = 0.000000000000000000 + Size.PlatformDefault = False + TextSettings.Font.Size = 14.000000000000000000 + TextSettings.Trimming = None + Text = 'Select the gitignore template' + TabOrder = 0 + Visible = False + end + end + object cbTemplate: TComboBox + Align = Right + ItemIndex = -1 + Position.X = 660.000000000000000000 + Position.Y = 12.000000000000000000 + Size.Width = 140.000000000000000000 + Size.Height = 32.000000000000000000 + Size.PlatformDefault = False + TabOrder = 2 + OnChange = cbTemplateChange + end + end + end +end diff --git a/Frames/FMX/uFrame_GitIgnoreGenerator.pas b/Frames/FMX/uFrame_GitIgnoreGenerator.pas new file mode 100644 index 0000000..25e00ac --- /dev/null +++ b/Frames/FMX/uFrame_GitIgnoreGenerator.pas @@ -0,0 +1,141 @@ +unit uFrame_GitIgnoreGenerator; + +interface + +uses + System.SysUtils, + System.Types, + System.UITypes, + System.Classes, + System.Variants, + FMX.Types, + FMX.Graphics, + FMX.Controls, + FMX.Forms, + FMX.Dialogs, + FMX.StdCtrls, + FMX.Memo.Types, + FMX.Controls.Presentation, + FMX.ScrollBox, + FMX.Memo, + FMX.ListBox, + FMX.Layouts, + FMX.Objects, + + System.Skia, + FMX.Skia, + + Roselt.Clipboard, + Roselt.GitIgnoreGenerator; + +type + TFrame_GitIgnoreGenerator = class(TFrame) + layBottom: TLayout; + memTitleOutput: TLabel; + btnOutputCopyToClipboard: TButton; + imgOutputCopyToClipboard: TSkSvg; + lblOutputCopyToClipboard: TLabel; + memOutput: TMemo; + layTop: TLayout; + lblConfiguration: TLabel; + layTemplate: TRectangle; + imgTemplate: TSkSvg; + layTemplateTitleDescription: TLayout; + lblTemplateTitle: TLabel; + lblTemplateDescription: TLabel; + cbTemplate: TComboBox; + layCategory: TRectangle; + imgCategory: TSkSvg; + layCategoryTitleDescription: TLayout; + lblCategoryTitle: TLabel; + lblCategoryDescription: TLabel; + cbCategory: TComboBox; + procedure cbCategoryChange(Sender: TObject); + procedure cbTemplateChange(Sender: TObject); + procedure btnOutputCopyToClipboardClick(Sender: TObject); + private + { Private declarations } + procedure LoadCategories; + procedure LoadTemplatesByCategory(const ACategory: String); + procedure GenerateGitIgnore; + public + { Public declarations } + constructor Create(AOwner: TComponent); override; + end; + +implementation + +{$R *.fmx} + +constructor TFrame_GitIgnoreGenerator.Create(AOwner: TComponent); +begin + inherited; + LoadCategories; +end; + +procedure TFrame_GitIgnoreGenerator.LoadCategories; +var + Categories: TArray; + Category: String; +begin + cbCategory.Clear; + Categories := GetTemplateCategories; + for Category in Categories do + cbCategory.Items.Add(Category); + + if cbCategory.Items.Count > 0 then + begin + cbCategory.ItemIndex := 0; + LoadTemplatesByCategory(cbCategory.Items[0]); + end; +end; + +procedure TFrame_GitIgnoreGenerator.LoadTemplatesByCategory(const ACategory: String); +var + Templates: TArray; + Template: TGitIgnoreTemplate; +begin + cbTemplate.Clear; + Templates := GetTemplatesByCategory(ACategory); + for Template in Templates do + cbTemplate.Items.Add(Template.Name); + + if cbTemplate.Items.Count > 0 then + begin + cbTemplate.ItemIndex := 0; + GenerateGitIgnore; + end; +end; + +procedure TFrame_GitIgnoreGenerator.GenerateGitIgnore; +var + TemplateName: String; + Content: String; +begin + if cbTemplate.ItemIndex >= 0 then + begin + TemplateName := cbTemplate.Items[cbTemplate.ItemIndex]; + Content := GetGitIgnoreTemplateByName(TemplateName); + memOutput.Text := Content; + end + else + memOutput.Text := ''; +end; + +procedure TFrame_GitIgnoreGenerator.cbCategoryChange(Sender: TObject); +begin + if cbCategory.ItemIndex >= 0 then + LoadTemplatesByCategory(cbCategory.Items[cbCategory.ItemIndex]); +end; + +procedure TFrame_GitIgnoreGenerator.cbTemplateChange(Sender: TObject); +begin + GenerateGitIgnore; +end; + +procedure TFrame_GitIgnoreGenerator.btnOutputCopyToClipboardClick(Sender: TObject); +begin + CopyToClipboard(memOutput.Text); +end; + +end. diff --git a/Lib/Roselt.GitIgnoreGenerator.pas b/Lib/Roselt.GitIgnoreGenerator.pas new file mode 100644 index 0000000..d829001 --- /dev/null +++ b/Lib/Roselt.GitIgnoreGenerator.pas @@ -0,0 +1,445 @@ +// GitIgnore Generator Library +// Based on templates from: https://github.com/github/gitignore + +unit Roselt.GitIgnoreGenerator; + +interface + +uses + System.SysUtils, + System.Classes, + System.Generics.Collections; + +type + TGitIgnoreTemplate = record + Name: String; + Description: String; + Category: String; + Content: String; + end; + +function GetGitIgnoreTemplates: TArray; +function GetGitIgnoreTemplateByName(const AName: String): String; +function GetTemplateCategories: TArray; +function GetTemplatesByCategory(const ACategory: String): TArray; + +implementation + +function GetGitIgnoreTemplates: TArray; +begin + SetLength(Result, 10); + + // Python + Result[0].Name := 'Python'; + Result[0].Description := 'Python projects'; + Result[0].Category := 'Languages'; + Result[0].Content := + '# Byte-compiled / optimized / DLL files' + sLineBreak + + '__pycache__/' + sLineBreak + + '*.py[cod]' + sLineBreak + + '*$py.class' + sLineBreak + + '' + sLineBreak + + '# C extensions' + sLineBreak + + '*.so' + sLineBreak + + '' + sLineBreak + + '# Distribution / packaging' + sLineBreak + + '.Python' + sLineBreak + + 'build/' + sLineBreak + + 'develop-eggs/' + sLineBreak + + 'dist/' + sLineBreak + + 'downloads/' + sLineBreak + + 'eggs/' + sLineBreak + + '.eggs/' + sLineBreak + + 'lib/' + sLineBreak + + 'lib64/' + sLineBreak + + 'parts/' + sLineBreak + + 'sdist/' + sLineBreak + + 'var/' + sLineBreak + + 'wheels/' + sLineBreak + + '*.egg-info/' + sLineBreak + + '.installed.cfg' + sLineBreak + + '*.egg' + sLineBreak + + 'MANIFEST' + sLineBreak + + '' + sLineBreak + + '# PyInstaller' + sLineBreak + + '*.manifest' + sLineBreak + + '*.spec' + sLineBreak + + '' + sLineBreak + + '# Unit test / coverage reports' + sLineBreak + + 'htmlcov/' + sLineBreak + + '.tox/' + sLineBreak + + '.nox/' + sLineBreak + + '.coverage' + sLineBreak + + '.coverage.*' + sLineBreak + + '.cache' + sLineBreak + + 'nosetests.xml' + sLineBreak + + 'coverage.xml' + sLineBreak + + '*.cover' + sLineBreak + + '*.py,cover' + sLineBreak + + '.pytest_cache/' + sLineBreak + + '' + sLineBreak + + '# Environments' + sLineBreak + + '.env' + sLineBreak + + '.venv' + sLineBreak + + 'env/' + sLineBreak + + 'venv/' + sLineBreak + + 'ENV/' + sLineBreak + + 'env.bak/' + sLineBreak + + 'venv.bak/' + sLineBreak + + '' + sLineBreak + + '# IDEs' + sLineBreak + + '.vscode/' + sLineBreak + + '.idea/' + sLineBreak + + '*.swp' + sLineBreak + + '*.swo' + sLineBreak + + '*~'; + + // Node.js + Result[1].Name := 'Node'; + Result[1].Description := 'Node.js projects'; + Result[1].Category := 'Languages'; + Result[1].Content := + '# Logs' + sLineBreak + + 'logs' + sLineBreak + + '*.log' + sLineBreak + + 'npm-debug.log*' + sLineBreak + + 'yarn-debug.log*' + sLineBreak + + 'yarn-error.log*' + sLineBreak + + '' + sLineBreak + + '# Dependency directories' + sLineBreak + + 'node_modules/' + sLineBreak + + 'jspm_packages/' + sLineBreak + + '' + sLineBreak + + '# TypeScript cache' + sLineBreak + + '*.tsbuildinfo' + sLineBreak + + '' + sLineBreak + + '# Optional npm cache directory' + sLineBreak + + '.npm' + sLineBreak + + '' + sLineBreak + + '# Optional eslint cache' + sLineBreak + + '.eslintcache' + sLineBreak + + '' + sLineBreak + + '# Optional stylelint cache' + sLineBreak + + '.stylelintcache' + sLineBreak + + '' + sLineBreak + + '# dotenv environment variables file' + sLineBreak + + '.env' + sLineBreak + + '.env.test' + sLineBreak + + '.env.local' + sLineBreak + + '' + sLineBreak + + '# Next.js build output' + sLineBreak + + '.next' + sLineBreak + + 'out' + sLineBreak + + '' + sLineBreak + + '# Build output' + sLineBreak + + 'dist' + sLineBreak + + 'build' + sLineBreak + + '' + sLineBreak + + '# yarn v3' + sLineBreak + + '.yarn/*' + sLineBreak + + '!.yarn/patches' + sLineBreak + + '!.yarn/plugins' + sLineBreak + + '!.yarn/releases' + sLineBreak + + '!.yarn/sdks' + sLineBreak + + '!.yarn/versions'; + + // Java + Result[2].Name := 'Java'; + Result[2].Description := 'Java projects'; + Result[2].Category := 'Languages'; + Result[2].Content := + '# Compiled class file' + sLineBreak + + '*.class' + sLineBreak + + '' + sLineBreak + + '# Log file' + sLineBreak + + '*.log' + sLineBreak + + '' + sLineBreak + + '# BlueJ files' + sLineBreak + + '*.ctxt' + sLineBreak + + '' + sLineBreak + + '# Mobile Tools for Java (J2ME)' + sLineBreak + + '.mtj.tmp/' + sLineBreak + + '' + sLineBreak + + '# Package Files' + sLineBreak + + '*.jar' + sLineBreak + + '*.war' + sLineBreak + + '*.nar' + sLineBreak + + '*.ear' + sLineBreak + + '*.zip' + sLineBreak + + '*.tar.gz' + sLineBreak + + '*.rar' + sLineBreak + + '' + sLineBreak + + '# Maven' + sLineBreak + + 'target/' + sLineBreak + + 'pom.xml.tag' + sLineBreak + + 'pom.xml.releaseBackup' + sLineBreak + + 'pom.xml.versionsBackup' + sLineBreak + + 'pom.xml.next' + sLineBreak + + '' + sLineBreak + + '# Gradle' + sLineBreak + + '.gradle' + sLineBreak + + 'build/'; + + // C# + Result[3].Name := 'C#'; + Result[3].Description := 'C# / .NET projects'; + Result[3].Category := 'Languages'; + Result[3].Content := + '# Build results' + sLineBreak + + '[Dd]ebug/' + sLineBreak + + '[Rr]elease/' + sLineBreak + + 'x64/' + sLineBreak + + 'x86/' + sLineBreak + + '[Bb]in/' + sLineBreak + + '[Oo]bj/' + sLineBreak + + '' + sLineBreak + + '# Visual Studio cache/options' + sLineBreak + + '.vs/' + sLineBreak + + '' + sLineBreak + + '# Visual Studio profiler' + sLineBreak + + '*.psess' + sLineBreak + + '*.vsp' + sLineBreak + + '*.vspx' + sLineBreak + + '' + sLineBreak + + '# User-specific files' + sLineBreak + + '*.rsuser' + sLineBreak + + '*.suo' + sLineBreak + + '*.user' + sLineBreak + + '*.userosscache' + sLineBreak + + '*.sln.docstates' + sLineBreak + + '' + sLineBreak + + '# NuGet Packages' + sLineBreak + + '*.nupkg' + sLineBreak + + '**/packages/*' + sLineBreak + + '' + sLineBreak + + '# .NET Core' + sLineBreak + + 'project.lock.json' + sLineBreak + + 'project.fragment.lock.json' + sLineBreak + + 'artifacts/'; + + // Delphi + Result[4].Name := 'Delphi'; + Result[4].Description := 'Delphi projects'; + Result[4].Category := 'Languages'; + Result[4].Content := + '# Compiled files' + sLineBreak + + '*.dcu' + sLineBreak + + '*.exe' + sLineBreak + + '*.dll' + sLineBreak + + '*.bpl' + sLineBreak + + '*.dcp' + sLineBreak + + '*.so' + sLineBreak + + '*.apk' + sLineBreak + + '*.drc' + sLineBreak + + '*.map' + sLineBreak + + '*.dres' + sLineBreak + + '*.rsm' + sLineBreak + + '*.tds' + sLineBreak + + '*.dsk' + sLineBreak + + '*.ddp' + sLineBreak + + '' + sLineBreak + + '# Delphi local files' + sLineBreak + + '*.local' + sLineBreak + + '*.identcache' + sLineBreak + + '*.projdata' + sLineBreak + + '*.tvsconfig' + sLineBreak + + '**/*.stat' + sLineBreak + + '' + sLineBreak + + '# Delphi history and backup' + sLineBreak + + '__history/' + sLineBreak + + '__recovery/' + sLineBreak + + '*.~*' + sLineBreak + + '' + sLineBreak + + '# Output directories' + sLineBreak + + 'Win32/' + sLineBreak + + 'Win64/' + sLineBreak + + 'OSX32/' + sLineBreak + + 'OSX64/' + sLineBreak + + 'Android/' + sLineBreak + + 'iOSDevice/' + sLineBreak + + 'iOSSimulator/'; + + // Visual Studio Code + Result[5].Name := 'Visual Studio Code'; + Result[5].Description := 'VS Code editor'; + Result[5].Category := 'IDEs'; + Result[5].Content := + '.vscode/*' + sLineBreak + + '!.vscode/settings.json' + sLineBreak + + '!.vscode/tasks.json' + sLineBreak + + '!.vscode/launch.json' + sLineBreak + + '!.vscode/extensions.json' + sLineBreak + + '*.code-workspace' + sLineBreak + + '' + sLineBreak + + '# Local History for Visual Studio Code' + sLineBreak + + '.history/'; + + // JetBrains IDEs + Result[6].Name := 'JetBrains'; + Result[6].Description := 'JetBrains IDEs (IntelliJ, PyCharm, WebStorm, etc.)'; + Result[6].Category := 'IDEs'; + Result[6].Content := + '# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider' + sLineBreak + + '' + sLineBreak + + '*.iml' + sLineBreak + + '' + sLineBreak + + '# User-specific stuff' + sLineBreak + + '.idea/**/workspace.xml' + sLineBreak + + '.idea/**/tasks.xml' + sLineBreak + + '.idea/**/usage.statistics.xml' + sLineBreak + + '.idea/**/dictionaries' + sLineBreak + + '.idea/**/shelf' + sLineBreak + + '' + sLineBreak + + '# Generated files' + sLineBreak + + '.idea/**/contentModel.xml' + sLineBreak + + '' + sLineBreak + + '# Sensitive or high-churn files' + sLineBreak + + '.idea/**/dataSources/' + sLineBreak + + '.idea/**/dataSources.ids' + sLineBreak + + '.idea/**/dataSources.local.xml' + sLineBreak + + '.idea/**/sqlDataSources.xml' + sLineBreak + + '.idea/**/dynamic.xml' + sLineBreak + + '.idea/**/uiDesigner.xml' + sLineBreak + + '.idea/**/dbnavigator.xml'; + + // macOS + Result[7].Name := 'macOS'; + Result[7].Description := 'macOS system files'; + Result[7].Category := 'Operating Systems'; + Result[7].Content := + '# General' + sLineBreak + + '.DS_Store' + sLineBreak + + '__MACOSX/' + sLineBreak + + '.AppleDouble' + sLineBreak + + '.LSOverride' + sLineBreak + + '' + sLineBreak + + '# Icon file with custom folder icon (represented as Icon[] in gitignore)' + sLineBreak + + 'Icon[]' + sLineBreak + + '' + sLineBreak + + '# Thumbnails' + sLineBreak + + '._*' + sLineBreak + + '' + sLineBreak + + '# Files that might appear in the root of a volume' + sLineBreak + + '.DocumentRevisions-V100' + sLineBreak + + '.fseventsd' + sLineBreak + + '.Spotlight-V100' + sLineBreak + + '.TemporaryItems' + sLineBreak + + '.Trashes' + sLineBreak + + '.VolumeIcon.icns' + sLineBreak + + '.com.apple.timemachine.donotpresent' + sLineBreak + + '' + sLineBreak + + '# Directories potentially created on remote AFP share' + sLineBreak + + '.AppleDB' + sLineBreak + + '.AppleDesktop' + sLineBreak + + 'Network Trash Folder' + sLineBreak + + 'Temporary Items' + sLineBreak + + '.apdisk'; + + // Windows + Result[8].Name := 'Windows'; + Result[8].Description := 'Windows system files'; + Result[8].Category := 'Operating Systems'; + Result[8].Content := + '# Windows thumbnail cache files' + sLineBreak + + 'Thumbs.db' + sLineBreak + + 'Thumbs.db:encryptable' + sLineBreak + + 'ehthumbs.db' + sLineBreak + + 'ehthumbs_vista.db' + sLineBreak + + '' + sLineBreak + + '# Dump file' + sLineBreak + + '*.stackdump' + sLineBreak + + '' + sLineBreak + + '# Folder config file' + sLineBreak + + '[Dd]esktop.ini' + sLineBreak + + '' + sLineBreak + + '# Recycle Bin used on file shares' + sLineBreak + + '$RECYCLE.BIN/' + sLineBreak + + '' + sLineBreak + + '# Windows Installer files' + sLineBreak + + '*.cab' + sLineBreak + + '*.msi' + sLineBreak + + '*.msix' + sLineBreak + + '*.msm' + sLineBreak + + '*.msp' + sLineBreak + + '' + sLineBreak + + '# Windows shortcuts' + sLineBreak + + '*.lnk'; + + // Linux + Result[9].Name := 'Linux'; + Result[9].Description := 'Linux system files'; + Result[9].Category := 'Operating Systems'; + Result[9].Content := + '*~' + sLineBreak + + '' + sLineBreak + + '# temporary files which can be created if a process still has a handle open of a deleted file' + sLineBreak + + '.fuse_hidden*' + sLineBreak + + '' + sLineBreak + + '# KDE directory preferences' + sLineBreak + + '.directory' + sLineBreak + + '' + sLineBreak + + '# Linux trash folder which might appear on any partition or disk' + sLineBreak + + '.Trash-*' + sLineBreak + + '' + sLineBreak + + '# .nfs files are created when an open file is removed but is still being accessed' + sLineBreak + + '.nfs*'; +end; + +function GetGitIgnoreTemplateByName(const AName: String): String; +var + Templates: TArray; + Template: TGitIgnoreTemplate; +begin + Result := ''; + Templates := GetGitIgnoreTemplates; + for Template in Templates do + begin + if SameText(Template.Name, AName) then + begin + Result := Template.Content; + Break; + end; + end; +end; + +function GetTemplateCategories: TArray; +var + Categories: TList; + Templates: TArray; + Template: TGitIgnoreTemplate; +begin + Categories := TList.Create; + try + Templates := GetGitIgnoreTemplates; + for Template in Templates do + begin + if not Categories.Contains(Template.Category) then + Categories.Add(Template.Category); + end; + Result := Categories.ToArray; + finally + Categories.Free; + end; +end; + +function GetTemplatesByCategory(const ACategory: String): TArray; +var + Templates: TArray; + FilteredList: TList; + Template: TGitIgnoreTemplate; +begin + FilteredList := TList.Create; + try + Templates := GetGitIgnoreTemplates; + for Template in Templates do + begin + if SameText(Template.Category, ACategory) then + FilteredList.Add(Template); + end; + Result := FilteredList.ToArray; + finally + FilteredList.Free; + end; +end; + +end. \ No newline at end of file diff --git a/Roselt.Menu.pas b/Roselt.Menu.pas index 9b38211..7651ce6 100644 --- a/Roselt.Menu.pas +++ b/Roselt.Menu.pas @@ -52,7 +52,8 @@ interface uFrame_ImageConverter, uFrame_BootstrapIcons, uFrame_FontAwesomeIcons, - uFrame_FeatherIcons; + uFrame_FeatherIcons, + uFrame_GitIgnoreGenerator; type TRoseltMenuFrame = class of TFrame; @@ -94,7 +95,7 @@ procedure BuildMenu(var Options: TBuildMenuOptions); NavMouseHelper: TNavMouseHelper; const - RoseltMenuArray: array[0..47] of TRoseltMenu = ( + RoseltMenuArray: array[0..48] of TRoseltMenu = ( ( // Converters Main Category (Parent) text_short: 'Converters'; text_long: 'Converters'; @@ -599,6 +600,22 @@ procedure BuildMenu(var Options: TBuildMenuOptions); parent: 'Generators'; frame: TFrame_PasswordGenerator; ), + ( + text_short: '.gitignore'; + text_long: '.gitignore Generator'; + name: 'GitIgnoreGenerator'; + description: 'Generate .gitignore files for various languages and platforms'; + icon: 'file-earmark-code'; + {$IFDEF DEBUG} + active: true; + visible: true; + {$ELSE} + active: true; + visible: true; + {$ENDIF} + parent: 'Generators'; + frame: TFrame_GitIgnoreGenerator; + ), ( text_short: 'Case Converter && Inspector'; text_long: 'Case Converter && Inspector';