If a project file is a symbolic link to a file of another project, show a menu entry allowing that file to be opened in its project so that it can be modified.

[DEVELOPMENT ENVIRONMENT]
* NEW: If a project file is a symbolic link to a file of another project, show a menu entry allowing that file to be opened in its project so that it can be modified.
* NEW: Update IDE usage text.
* BUG: Automatically update the copyright date in the licence file.
This commit is contained in:
gambas 2017-12-03 18:06:32 +01:00
parent dfb179b549
commit 3fcc897729
8 changed files with 385 additions and 328 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -47,33 +47,6 @@ Public Sub dchProject_Icon(Path As String)
End
Private Sub GetProjectPath(sPath As String) As String
Dim hFile As File
Dim sHeader As String
Do
If Exist(sPath &/ ".project") Then
hFile = Open sPath &/ ".project"
sHeader = Read #hFile, -256
hFile.Close
If sHeader Begins Project.PROJECT_MAGIC Or If sHeader Begins Project.PROJECT_MAGIC_2 Then
Return sPath
Endif
Endif
sPath = File.Dir(sPath)
If sPath = "/" Then Break
Loop
Catch
End
Private Sub UpdateButtons()
If Not $bShowButton Or If Not $sLast Then
@ -91,7 +64,7 @@ Public Sub dchProject_Change()
Dim sPath As String
Dim hProjectTree As CProjectTree
sPath = GetProjectPath(dchProject.Value)
sPath = Project.FindProjectPath(dchProject.Value)
If sPath = $sLast Then Return
If Not sPath Then
@ -131,7 +104,7 @@ End
Public Sub GetPath() As String
Return GetProjectPath(dchProject.Value)
Return Project.FindProjectPath(dchProject.Value)
End

View File

@ -362,16 +362,19 @@ Public Sub mnuPopup_Show()
Dim hProgList As DesktopFile[]
Dim bProject As Boolean
Dim sRoot As String
Dim bLink As Boolean
Dim sPath As String
sCurrent = GetCurrent()
bCurrent = sCurrent
sRoot = GetRootKey($sKey)
If sCurrent Then bLink = Stat(sCurrent).Type = gb.Link
UpdateMenu
If sCurrent And If Project.IsReadOnly(sCurrent) Then
'mnuNew.Visible = False
If Not IsDir(sCurrent) Or If Stat(sCurrent).Type <> gb.Link Then
If Not IsDir(sCurrent) Or If Not bLink Then
mnuCut.Visible = False
mnuCopy.Visible = False
mnuPaste.Visible = False
@ -525,10 +528,18 @@ Public Sub mnuPopup_Show()
Endif
mnuOpenInProject.Hide
If IsDir(sCurrent) Or If Left($sKey) = "$" Then
mnuOpenWithFileManager.Show
Else
mnuOpenWithFileManager.Hide
If bLink Then
sPath = Project.GetAbsoluteLink(sCurrent, Stat(sCurrent).Link)
If Project.FindProjectPath(sPath) Then
mnuOpenInProject.Show
mnuOpenInProject.Tag = sPath
Endif
Endif
Endif
If bProject Then
@ -2884,3 +2895,15 @@ Public Sub btnClosePanel_Click()
ShowDebug(False)
End
Public Sub wrkProject_CloseAll()
ShowDebug(False)
End
Public Sub mnuOpenInProject_Click()
Project.Open(Project.FindProjectPath(mnuOpenInProject.Tag), True, mnuOpenInProject.Tag)
End

View File

@ -595,6 +595,9 @@
Text = ("Open in file manager") & "..."
Picture = Picture["icon:/small/file-manager"]
}
{ mnuOpenInProject Menu
Text = ("Open in project") & "..."
}
{ mnuEditWith Menu
Text = ("Open with")
{ Menu23 Menu

View File

@ -272,6 +272,7 @@ Public Sub Main()
Dim iInd As Integer
Dim sArg As String
Dim hComp As CComponent
Dim aOpenFile As New String[]
'DB.Debug = True
@ -284,7 +285,7 @@ Public Sub Main()
Print File.Load("usage")
Quit
Else If sArg = "--license" Or If sArg = "-L" Then
Print File.Load("license")
Print Replace(File.Load("license"), "YEAR", CStr(Year(Now)))
Quit
Else If sArg = "--version" Or If sArg = "-V" Then
Print Application.Version
@ -301,8 +302,11 @@ Public Sub Main()
Error "gambas3: unknown option: " & sArg
Quit
Else
sPath = Args[iInd]
Break
If Not sPath Then
sPath = Args[iInd]
Else
aOpenFile.Add(Args[iInd])
Endif
Endif
Next
@ -367,6 +371,9 @@ Public Sub Main()
If sPath Then
If IsDir(sPath) Then
Project.Open(sPath)
For Each sPath In aOpenFile
OpenFile(sPath)
Next
Else If Exist(sPath) Then
FMain.OpenExternFile(sPath)
Else
@ -463,7 +470,7 @@ Finally
End
Public Function Open(sDir As String, Optional bInAnotherWindow As Boolean) As Boolean
Public Function Open(sDir As String, Optional bInAnotherWindow As Boolean, sOpenFile As String) As Boolean
Dim sOldPath As String
Dim sOldName As String
@ -479,7 +486,9 @@ Public Function Open(sDir As String, Optional bInAnotherWindow As Boolean) As Bo
Dim sStatus As String
Dim bIsFake As Boolean
If Not Exist(sDir &/ ".project") Then
sPath = FindProjectPath(sDir)
If Not sPath Then
FMain.ShowError(("This project does not exist.") & "\n\n" & sDir)
Return True
Endif
@ -495,7 +504,11 @@ Public Function Open(sDir As String, Optional bInAnotherWindow As Boolean) As Bo
Message.Error(Subst(("Unable to find Gambas IDE executable in directory:\n\n&1"), Application.Path))
Return
Endif
Exec [sExec, sDir]
If sOpenFile Then
Exec [sExec, sDir, sOpenFile]
Else
Exec [sExec, sDir]
Endif
Return True
Endif
@ -6595,3 +6608,30 @@ Private Sub RenamePaths(sOld As String, sNew As String)
Next
End
Public Sub FindProjectPath(sPath As String) As String
Dim hFile As File
Dim sHeader As String
Do
If Exist(sPath &/ ".project") Then
hFile = Open sPath &/ ".project"
sHeader = Read #hFile, -256
hFile.Close
If sHeader Begins Project.PROJECT_MAGIC Or If sHeader Begins Project.PROJECT_MAGIC_2 Then
Return sPath
Endif
Endif
sPath = File.Dir(sPath)
If sPath = "/" Then Break
Loop
Catch
End

View File

@ -1,7 +1,7 @@
Gambas 3 Integrated Development Environment
(c) 2012 Benoît Minisini, Fabien Bodard, Charlie Reinl,
(c) YEAR Benoît Minisini, Fabien Bodard, Charlie Reinl,
José Luis Redrejo, Robert Rowe
This program is free software; you can redistribute it and/or

View File

@ -1,15 +1,29 @@
Gambas 3 Integrated Development Environment
Usage: gambas3 [<project directory> | <file>]
Usages:
Open the IDE with the specific project or the specific file.
If no argument is specified, open the IDE with a nice welcome dialog.
$ 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.
Usage: gambas3 [options]
$ gambas3 <any file>
Options:
-V --version display version
-L --license display license
-h --help display this help
--cleanup clean the project directory up (i.e. remove temporary, generated, and backup files)
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 --version | -V
Display Gambas version.
$ gambas3 --licence | -L
Display Gambas licence.
$ gambas3 --help
Display this help.