IDE usage help is now translatable. Project directory icon can be updated with the '--update-icon' command-line option.

[DEVELOPMENT ENVIRONMENT]
* NEW: IDE usage help is now translatable.
* NEW: Update French translation.
* NEW: Generate the project directory icon each time the project is loaded.
* NEW: Use the current icon theme icons to make the project directory icon.
* NEW: Project directory icon can be updated with the '--update-icon' command-line option.
This commit is contained in:
Benoît Minisini 2023-09-27 22:03:21 +02:00
parent bb337157b9
commit 13dc9fcea8
5 changed files with 7694 additions and 7835 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 10 KiB

File diff suppressed because it is too large Load diff

View file

@ -313,6 +313,7 @@ Public Sub Main()
Dim sArg As String Dim sArg As String
Dim aOpenFile As New String[] Dim aOpenFile As New String[]
Dim sLang As String Dim sLang As String
Dim bMakeIcon As Boolean
'DB.Debug = True 'DB.Debug = True
@ -327,7 +328,7 @@ Public Sub Main()
$bTesting = True $bTesting = True
Continue Continue
Else If sArg = "--help" Or If sArg = "-h" Then Else If sArg = "--help" Or If sArg = "-h" Then
Print File.Load("usage") PrintUsage
Quit Quit
Else If sArg = "--license" Or If sArg = "-L" Then Else If sArg = "--license" Or If sArg = "-L" Then
Print Replace(File.Load("license"), "YEAR", CStr(Year(Now))) Print Replace(File.Load("license"), "YEAR", CStr(Year(Now)))
@ -347,6 +348,8 @@ Public Sub Main()
InitVersion InitVersion
Print FSystemInfo.GetInfo().Join("\n") Print FSystemInfo.GetInfo().Join("\n")
Quit Quit
Else If sArg = "--update-icon" Then
bMakeIcon = True
Else If Left(sArg) = "-" Then Else If Left(sArg) = "-" Then
Error "gambas3: unknown option: " & sArg Error "gambas3: unknown option: " & sArg
Quit 1 Quit 1
@ -358,6 +361,20 @@ Public Sub Main()
Endif Endif
Endif Endif
Next Next
If bMakeIcon Then
If Not sPath Or If File.IsRelative(sPath) Then
sPath = Application.Dir &/ sPath
Endif
If MakeDirectoryIcon(sPath) Then
Quit 1
Else
Quit
Endif
Endif
Try Component.Load("gb.inotify") Try Component.Load("gb.inotify")
Try Component.Load("gb.media") Try Component.Load("gb.media")
@ -887,6 +904,7 @@ _INIT_AGAIN:
If Settings["/RestoreFiles", 1] Then LoadLastOpenedFiles If Settings["/RestoreFiles", 1] Then LoadLastOpenedFiles
Endif Endif
MakeDirectoryIcon
RecentFiles = New String[] RecentFiles = New String[]
CPosition.Clear CPosition.Clear
@ -5421,27 +5439,29 @@ Public Sub GetTranslations() As String[]
End End
Public Sub MakeDirectoryIcon(Optional sDir As String) Public Sub MakeDirectoryIcon(Optional sDir As String) As Boolean
Dim sIcon As String
Dim hDirIcon As Image Dim hDirIcon As Image
Dim hIcon As Image Dim hIcon As Image
Dim bExist As Boolean Dim bExist As Boolean
Dim sPath As String Dim sPath As String
Dim bLocalize As Boolean
If Not sDir Then sDir = Project.Dir If Not sDir Then
sDir = Project.Dir
If Project.Icon Then bLocalize = Project.Localize
sIcon = sDir &/ Project.Icon
Else Else
sIcon = "img/logo/project.png" bLocalize = InStr(File.Load(sDir &/ ".project"), "\nTranslate=1")
Endif Endif
hDirIcon = Picture["icon:/256/directory"].Image
hDirIcon = Image.Load("img/logo/folder.png") Try hIcon = GetIcon(sDir, 96).Image
If hIcon Then hDirIcon.PaintImage(hIcon, 80, 104)
Try hIcon = StretchIcon(sIcon, 128)
If hIcon Then hDirIcon.PaintImage(hIcon, 64, 88) hIcon = Picture["icon:/64/language"].Image
If bLocalize Then hDirIcon.PaintImage(hIcon, hDirIcon.W - hIcon.W, hDirIcon.H - hIcon.H)
Try Kill sDir &/ ".icon.png" Try Kill sDir &/ ".icon.png"
hDirIcon.Save(sDir &/ ".icon.png") hDirIcon.Save(sDir &/ ".icon.png")
@ -5452,7 +5472,8 @@ Public Sub MakeDirectoryIcon(Optional sDir As String)
Catch Catch
Error "gambas3: warning: unable to create project directory icon" Error "gambas3: warning: unable to create project directory icon: "; Error.Text
Return True
End End
@ -7078,3 +7099,46 @@ Public Sub GetMessagePrefix(sPath As String) As String
Return "<tt><b>" & Html(sPath) & "</b></tt>\n\n" Return "<tt><b>" & Html(sPath) & "</b></tt>\n\n"
End End
Private Sub PrintUsage()
Print
Print ("Gambas 3 Integrated Development Environment")
Print
Print ("Usage:")
Print
Print "$ gambas3 [<"; ("project directory"); "> [<"; ("project file"); "> ...]]"
Print
Print " "; ("Open the IDE with the specified project, optionally opening the specified project files.")
Print " "; ("If no argument is specified, open the IDE with a nice welcome dialog.")
Print
Print "$ gambas3 <"; ("any file"); ">"
Print
Print " "; ("Open the IDE for editing the specified file if the IDE has an editor for it.")
Print
Print "$ gambas3 --cleanup <"; ("project directory"); ">"
Print
Print " "; ("Clean the project directory up (i.e. remove temporary, generated, and backup files).")
Print
Print "$ gambas3 --system-information | -i"
Print
Print " "; ("Print system information.")
Print
Print "$ gambas3 --update-icon <"; ("project directory"); ">"
Print
Print " "; ("Update project directory icon.")
Print
Print "$ gambas3 --version | -V"
Print
Print " "; ("Display Gambas version.")
Print
Print "$ gambas3 --license | -L"
Print
Print " "; ("Display Gambas license.")
Print
Print "$ gambas3 --help"
Print
Print " "; ("Display this help.")
Print
End

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -1,33 +0,0 @@
Gambas 3 Integrated Development Environment
Usage:
$ gambas3 [<project directory> [<project file> ...]]
Open the IDE with the specific project, optionally opening the specified project files.
If no argument is specified, open the IDE with a nice welcome dialog.
$ gambas3 <any file>
Open the IDE for editing the specified file if the IDE has an editor for it.
$ gambas3 --cleanup <project directory>
Clean the project directory up (i.e. remove temporary, generated, and backup files).
$ gambas3 --system-information | -i
Print system information
$ gambas3 --version | -V
Display Gambas version.
$ gambas3 --license | -L
Display Gambas license.
$ gambas3 --help
Display this help.