Skip to content

Commit bf2807f

Browse files
committed
Merge branch 'release/0.1.0-beta'
2 parents b921d07 + 4796d3b commit bf2807f

25 files changed

+4443
-2
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# .gitignore file for Keynote project
1+
# .gitignore file for Unit2NS project
22

33

44
# Delphi generated temporary files and directories
@@ -8,6 +8,8 @@ __history
88
*.local
99
*.identcache
1010
*.res
11+
*.dsk
12+
*.~*
1113

1214

1315
# Project specific directories & files

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Changelog
2+
3+
This is the change log for _unit2ns_ by DelphiDabbler.
4+
5+
All notable changes to this project are documented in this file. Releases are listed in reverse version number order.
6+
7+
The version numbering attempts to adhere to the principles of [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8+
9+
## Release v0.1.0-beta of 8 February 2021
10+
11+
Initial beta release.

Deploy.bat

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
:: Deploy script for Unit2NS
2+
::
3+
:: This script compiles release versions of the 64 and 32 bit versions of
4+
:: Unit2NS and places then into zip files ready for release.
5+
::
6+
:: This script uses MSBuild and Zip.exe
7+
8+
:: To use the script start the Embarcadero RAD Studio Command Prompt to set the
9+
:: required environment variables for MSBuild.
10+
:: Next set the ZIPROOT environment variable to the directory where zip.exe is
11+
:: installed.
12+
::
13+
:: Usage:
14+
:: Deploy <version>
15+
:: where
16+
:: <version> is the version number of the release, e.g. 0.5.3-beta or 1.2.0
17+
18+
@echo off
19+
20+
echo -------------------------
21+
echo Deploying Unit2NS Release
22+
echo -------------------------
23+
24+
:: Check for required parameter
25+
if "%1"=="" goto paramerror
26+
27+
:: Check for required environment variables
28+
if "%ZipRoot%"=="" goto envvarerror
29+
30+
:: Set variables
31+
set Version=%1
32+
set BuildRoot=.\_build
33+
set BuildExeRoot=%BuildRoot%\exe
34+
set Win32Dir=%BuildExeRoot%\Win32\Release
35+
set Win64Dir=%BuildExeRoot%\Win64\Release
36+
set ReleaseDir=%BuildRoot%\release
37+
set OutFile32=%ReleaseDir%\unit2ns-32bit-%Version%.zip
38+
set OutFile64=%ReleaseDir%\unit2ns-64bit-%Version%.zip
39+
set DocsDir=docs
40+
set SrcDir=src
41+
42+
:: Make a clean directory structure
43+
if exist %BuildRoot% rmdir /S /Q %BuildRoot%
44+
mkdir %BuildExeRoot%
45+
mkdir %BuildExeRoot%\Win32
46+
mkdir %Win32Dir%
47+
mkdir %BuildExeRoot%\Win64
48+
mkdir %Win64Dir%
49+
mkdir %ReleaseDir%
50+
51+
setlocal
52+
53+
:: Build Pascal
54+
cd %SrcDir%
55+
56+
echo.
57+
echo Building 32 bit version
58+
echo.
59+
msbuild Unit2NS.dproj /p:config=Release /p:platform=Win32
60+
echo.
61+
62+
echo.
63+
echo Building 64 bit version
64+
echo.
65+
msbuild Unit2NS.dproj /p:config=Release /p:platform=Win64
66+
echo.
67+
68+
endlocal
69+
70+
:: Rename exe files as 32 and 64 bit
71+
setlocal
72+
cd %Win32Dir%
73+
ren Unit2NS.exe Unit2NS32.exe
74+
endlocal
75+
76+
setlocal
77+
cd %Win64Dir%
78+
ren Unit2NS.exe Unit2NS64.exe
79+
endlocal
80+
81+
:: Create zip files
82+
echo.
83+
echo Creating zip files
84+
%ZipRoot%\zip.exe -j -9 %OutFile32% %Win32Dir%\Unit2NS32.exe
85+
%ZipRoot%\zip.exe -j -9 %OutFile64% %Win64Dir%\Unit2NS64.exe
86+
%ZipRoot%\zip.exe -j -9 %OutFile32% %DocsDir%\README.txt
87+
%ZipRoot%\zip.exe -j -9 %OutFile64% %DocsDir%\README.txt
88+
89+
echo.
90+
echo ---------------
91+
echo Build completed
92+
echo ---------------
93+
94+
goto end
95+
96+
:: Error messages
97+
98+
:paramerror
99+
echo.
100+
echo ***ERROR: Please specify a version number as a parameter
101+
echo.
102+
goto end
103+
104+
:envvarerror
105+
echo.
106+
echo ***ERROR: ZipRoot environment variable not set
107+
echo.
108+
goto end
109+
110+
:: End
111+
:end

README.md

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,81 @@
11
# unit2ns
2-
A little tool for Delphi programmer to find the namespace that a unit belongs to
2+
3+
A little tool for Delphi programmers to find the namespace(s) that a unit belongs to.
4+
5+
## Introduction
6+
7+
Since the introduction of namespaces to Delphi I've been struggling to remember which namespaces some units belong to. OK, sometimes the code editor pops up a list of unit names in a namespace, but what I want is to type in a unit name and be told what namespace(s) the unit may belong to. Hence _Unit2NS_.
8+
9+
## Installation, Updating & Removal
10+
11+
### Installing
12+
13+
_Unit2NS_ is available is either a 32 bit or 64 bit Windows application. Download the appropriate version from the _Releases_ tab on [GitHub](https://github.com/delphidabbler/unit2ns). The program comes in a zip file which you should unzip.
14+
15+
There is no installer for this simple program. Simply copy the `.exe` file to a folder on your computer or on a USB drive. If you have the 32 bit version the executable file is named `Unit2NS32.exe` while the 64 bit version is `Unit2NS64.exe`. You can copy this `README` file to the same location if you wish.
16+
17+
When it is first run, _Unit2NS_ will write data to a `config` sub-directory of whichever folder you put it in. For that reason you may prefer to place the program in its own folder.
18+
19+
**DO NOT** place _Unit2NS_ in your system's program files folder since the system will probably prevent it from writing the necessary data files.
20+
21+
### Updating
22+
23+
To update the program simply download a newer version and overwrite the `.exe` file in whichever location you installed it. Be careful not to delete the `config` subdirectory otherwise you will loose your data.
24+
25+
### Uninstalling
26+
27+
To uninstall the program simply delete the `.exe` file from wherever you installed it. If you have no further use for the program's data then delete the `config` sub-directory and all its contents too.
28+
29+
## Mini-help
30+
31+
_Unit2NS_ is in very early beta, and there's no proper help system as yet. So this is all you get right now!
32+
33+
### Getting started
34+
35+
_Unit2NS_ uses what it calls "mappings" to look up up namespaces for a given unit. The idea is you can have different mappings for different versions of Delphi. So, before you can start using it you need to provide a at least one mapping.
36+
37+
To do this, start the program and click the _New Mapping_ button. In the resulting dialogue box first give the mapping a sensible name.
38+
39+
Now you need to provide it with a list of namespaces and units. There are two ways to do this at present. The first is to enter a fully specified unit name in the edit box above the _Add_ button, e.g. `System.SysUtils` and then click _Add_. Keep doing this until you've entered all the units you need. Tedious huh?
40+
41+
Secondly you can choose the _Read Units From Source Folder_ button. This opens a dialogue box where you choose a directory containing some Pascal source code. Selecting a folder causes every Pascal unit in that folder, and all it's sub-folders, to be read into the mapping. So, if you choose your version of Delphi's `source` folder you'll load every unit Delphi provides into your new mapping. You'll also get quite a few you probably don't want, but that's not really a problem. You can delete any units you don't want by selecting them in the list and clicking the _Delete_ button.
42+
43+
Once you're done click the _Save And Close_ button to save the mapping.
44+
45+
The new mapping will appear in the _Mappings_ drop down at the top of the main window, along with any others you've created. All mappings are saved in a `config` folder alongside the executable program and are loaded automatically the next time you start _Unit2NS_.
46+
47+
### General use
48+
49+
When you need to know what namespace a unit is in, enter it's name in the _Name Of Unit_ edit box of the main window. Click _Find Namespace(s)_ and any namespaces containing a unit of that name will appear in the list box below. Selecting the namespace you want then clicking _Copy Full Name_ puts the fully specified namespace and unit name on the clipboard ready for pasting into your code.
50+
51+
You will sometimes see a namespace called `<no namespace>`. That's just a dummy that indicates that the unit exists outside any namespace. When the dummy namespace is selected clicking _Copy Full Name_ simply puts the unqualified unit name on the clipboard.
52+
53+
There's another little feature you might find useful if Delphi's code editor doesn't feel like showing you all the unit names in a namespace. In the _Lookup units in namespace_ box you can select any namespace from the _Choose namespace_ drop down to reveal all its units in the list below. This time selecting `<no namespace>` reveals all the units that exist outside a namespace.
54+
55+
You can create new mappings, edit them or delete them whenever you wish. The buttons to do that are pretty self-explanatory!
56+
57+
At present you can't rename a namespace.
58+
59+
## License
60+
61+
_Unit2NS_ is copyright © 2021, Peter Johnson (delphidabbler.com) and is released under the MIT license. See the [`LICENSE`](https://github.com/delphidabbler/unit2ns/blob/master/LICENSE) file included in the root of the GitHub repository for details.
62+
63+
## Changelog
64+
65+
See the file [CHANGELOG.md](https://github.com/delphidabbler/unit2ns/blob/master/CHANGELOG.md) in the root of the GitHub repository for details of releases and changes.
66+
67+
## Contributing
68+
69+
Contributions are welcome. The source code is on GitHub at https://github.com/delphidabbler/unit2ns.
70+
71+
Please make a fork from the `develop` branch (**not** `master`) and create an new feature branch for your code. When ready please submit a pull request.
72+
73+
### Compiling From Source
74+
75+
_Unit2NS_ is written in Delphi Object Pascal and developed using Delphi 10.4.1 Sydney. The program can be compiled from within the IDE.
76+
77+
## Bugs and Feature Requests
78+
79+
It's early days yet, so bugs are likely. Bug reports are welcomed. Please use the GitHub project's [_Issues_](https://github.com/delphidabbler/unit2ns/issues) feature to do that. Bug **fixes** are even more welcome!
80+
81+
You can also request new features. I want to keep this little app simple, but I can see several ways in which it can be improved, so don't hesitate to suggest something.

docs/Deployment.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Release Builds & Deployment
2+
3+
_Unit2NS_ is written in Delphi Pascal and was developed using Delphi 10.4.1 Sydney. Debug builds and draft releases can be built entirely from within the Delphi IDE.
4+
5+
Releases for deployment are created using the `Deploy.bat` script that can be found in the Git repository root.
6+
7+
The script depends on both _MSBuild_ and _InfoZip_'s version of `zip.exe`.
8+
9+
The required environment is set up by starting the Delphi Sydney RAD Studio Command Prompt from the Windows start menu and then:
10+
11+
1. Create an environment variable named `ZipRoot` that must be set to the directory containing `zip.exe`.
12+
13+
2. `cd` into the project folder where the Git repository was cloned.
14+
15+
3. Run `Deploy.bat` passing a suitable version number on the command line. Version numbers should be in the form `9.9.9` or `9.9.9-beta`.
16+
17+
The script will now build both the Windows 32 and 64 bit release versions of the program. The resulting `.exe` files are renamed `Unit2NS32.exe` and `Unit2NS64.exe` respectively.
18+
19+
The `.exe` files are then compressed into separate `.zip` files, one each for the 32 bit and 64 bit release. A read-me file then added to the `.zip` files.
20+
21+
The `.zip` files are named `unit2ns-64bit-<version>.zip` and `unit2ns-64bit-<version>.zip` where `<version>` is the version number passed on the command line. The zip files will be placed in the `_build\release` subdirectory of the project folder.
22+
23+
The `.zip` files are then deployed.
24+
25+
Finally the whole `_build` directory can be deleted.

docs/README.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Unit2NS is a portable Windows application for finding which namespace a Delphi
2+
unit belongs to. It comes in both 32 and 64 bit versions. There is a different
3+
download for each version. The 32 bit version executable file is named
4+
Unit2NS32.exe and the 64 bit version is Unit2NS64.exe.
5+
6+
There is no installer for this simple program. Simply copy the .exe file to a
7+
folder on your computer or on a USB drive. You can copy this README file to the
8+
same location if you wish.
9+
10+
When it is first run, Unit2NS will write data to a `config` sub-directory of
11+
whichever folder you put it in. For that reason you may prefer to place the
12+
program in its own folder.
13+
14+
DO NOT place Unit2NS in your system's program files folder since the system
15+
will probably prevent it from writing the necessary data files.
16+
17+
To update the program simply download a newer version and overwrite the
18+
executable file in whichever location you installed it. Be careful not to delete
19+
the `config` subdirectory otherwise you will loose your data.
20+
21+
To uninstall the program simply delete the .exe from wherever you installed it.
22+
If you have no further use for the program's data then delete the `config`
23+
sub-directory and all its contents too.
24+
25+
The program is open source and is maintained on GitHub at
26+
https://github.com/delphidabbler/unit2ns
27+
28+
Brief help on using Unit2NS can be found at
29+
https://github.com/delphidabbler/unit2ns/blob/master/README.md
30+
31+
Unit2NS is copyright (c) 2021 Peter Johnson (delphidabbler.com) and is released
32+
under the MIT License. See
33+
https://github.com/delphidabbler/unit2ns/blob/develop/LICENSE

src/FmEditMapping.fmx

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
inherited EditMappingDlg: TEditMappingDlg
2+
Caption = 'Edit Mappings'
3+
DesignerMasterStyle = 0
4+
inherited gbEdit: TGroupBox
5+
TabOrder = 13
6+
inherited lbFullUnitNames: TListBox
7+
TabOrder = 0
8+
Viewport.Width = 173.000000000000000000
9+
Viewport.Height = 213.000000000000000000
10+
end
11+
inherited edNameEditor: TEdit
12+
TabOrder = 1
13+
end
14+
inherited btnAdd: TButton
15+
TabOrder = 2
16+
end
17+
inherited btnUpdate: TButton
18+
TabOrder = 4
19+
end
20+
inherited btnDelete: TButton
21+
TabOrder = 7
22+
end
23+
inherited lblAddHelp: TLabel
24+
TabOrder = 10
25+
end
26+
inherited lblUpdateHelp: TLabel
27+
TabOrder = 13
28+
end
29+
inherited lblDeleteHelp: TLabel
30+
TabOrder = 16
31+
end
32+
inherited btnSort: TButton
33+
TabOrder = 15
34+
end
35+
inherited btnReadSourceDir: TButton
36+
TabOrder = 19
37+
end
38+
inherited lblUnitNamesError: TLabel
39+
TabOrder = 27
40+
end
41+
inherited btnClear: TButton
42+
TabOrder = 14
43+
end
44+
end
45+
inherited btnSaveClose: TButton
46+
TabOrder = 26
47+
end
48+
inherited btnCancel: TButton
49+
TabOrder = 28
50+
end
51+
inherited edMappingName: TEdit
52+
Enabled = False
53+
end
54+
inherited alMain: TActionList
55+
inherited actReadSourceDir: TAction
56+
Text = 'Read Units From Source Folder'
57+
end
58+
inherited actSaveClose: TAction
59+
OnExecute = actSaveCloseExecute
60+
end
61+
object actDeleteMapping: TAction [7]
62+
Text = 'Delete Mapping'
63+
end
64+
object actRename: TAction [8]
65+
Text = 'Rename...'
66+
end
67+
end
68+
end

0 commit comments

Comments
 (0)