[DEVELOPMENT ENVIRONMENT]

* NEW: New project creation dialog based on template projects located in
  '/usr/share/gambas3/template' and in '~/.local/share/gambas3/template'.
  These are default directories, they may change according to your gambas
  installation prefix and home directory configuration.

[TEMPLATES]
* NEW: Project templates. There are only two at the moment, others will
  come.

git-svn-id: svn://localhost/gambas/trunk@7321 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2015-09-18 00:41:43 +00:00
parent 614e483598
commit abf1ba8cbf
30 changed files with 981 additions and 373 deletions

View file

@ -1,4 +1,4 @@
EXTRA_DIST = reconf src spec mime desktop
EXTRA_DIST = reconf src spec mime desktop template
install-exec-local:
@if test "x$(ROOT)" != "x"; then \
@ -43,6 +43,10 @@ install-exec-local:
@echo "Installing the Gambas appdata file"
@$(INSTALL) -d $(DESTDIR)$(datarootdir)/appdata
@$(INSTALL) $(srcdir)/desktop/gambas3.appdata.xml $(DESTDIR)$(datarootdir)/appdata
@echo "Installing the Gambas template projects"
$(INSTALL) -d $(DESTDIR)$(gbdatadir)/template;
cp -R $(srcdir)/template/* $(DESTDIR)$(gbdatadir)/template;
uninstall-local:
@rm -f $(DESTDIR)$(bindir)/gambas$(GAMBAS_VERSION)

View file

@ -1,5 +1,5 @@
# Gambas Project File 3.0
# Compiled with Gambas 3.6.90
# Compiled with Gambas 3.8.90
Title=PeriodicTimer
Startup=FMain
Icon=lcdlabel.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

@ -17,7 +17,7 @@ End
Public Sub Form_Open()
$sLast = ""
dchProject.Bookmarks = [["Name": ("Installed software"), "Path": Desktop.DataDir &/ "gambas3/src", "Icon": "icon:/small/download"]]
dchProject.Bookmarks = Project.GetBookmarks()
dchProject.ShowFile = True
dchProject_Change
UpdateButtons

View file

@ -62,6 +62,7 @@ End
Public Sub Form_Open()
'DEBUG
Me.Move(Screen.AvailableX, Screen.AvailableY, Screen.AvailableWidth, Screen.AvailableHeight)
Settings.Read(Me)
Settings.Read(panProject, "panProject")
Settings.Read(panProperty, "panProperty")

View file

@ -5915,7 +5915,7 @@ Public Sub OpenFake() As Boolean
Try Mkdir sDir &/ ".src"
Try Mkdir sDir &/ ".hidden"
Copy "template/_fake_project" To sDir &/ ".project"
Copy "_fake_project" To sDir &/ ".project"
Return Project.Open(sDir)
@ -6167,3 +6167,10 @@ Private Sub RefreshIcon(sPath As String)
Endif
End
Public Sub GetBookmarks() As Collection[]
Return [["Name": ("Installed software"), "Path": Desktop.DataDir &/ "gambas" & System.Version & "/src", "Icon": "icon:/small/download"],
["Name": ("Project templates"), "Path": Desktop.DataDir &/ "gambas" & System.Version & "/template", "Icon": "icon:/small/copy"]]
End

View file

@ -27,6 +27,9 @@ Private $sStartup As String
Private $aComponents As New String[]
Private $bRead As Boolean
Private $sTranslatedTitle As String
Private $sTranslatedDescription As String
Private Sub GetProjectPath(sPath As String) As String
Do
@ -212,3 +215,46 @@ Public Sub GetIconPath() As String
Endif
End
Private Sub GetTranslation(sStr As String) As String
Dim sLang As String
Dim sPath As String
Dim aTrans As String[]
Dim iPos As Integer
Dim sTrans As String
sLang = Language.Find(System.Language)
sPath = $sPath &/ ".lang" &/ sLang & ".po"
If Not Exist(sPath) Then Return sStr
aTrans = Split(File.Load(sPath), "\n")
iPos = aTrans.Find("msgid " & Quote(sStr))
If iPos < 0 Then Return sStr
sTrans = aTrans[iPos + 1]
If sTrans Not Begins "msgstr " Then Return sStr
Return UnQuote(Mid$(sTrans, 8))
End
Public Sub GetTranslatedTitle() As String
If Not $sTranslatedTitle Then
ReadProject
$sTranslatedTitle = GetTranslation($sTitle)
Endif
Return $sTranslatedTitle
End
Public Sub GetTranslatedDescription() As String
If Not $sTranslatedDescription Then
ReadProject
$sTranslatedDescription = GetTranslation($sDescription)
Endif
Return $sTranslatedDescription
End

View file

@ -1,10 +1,12 @@
' Gambas class file
Public Enum TYPE_RECENT, TYPE_EXAMPLE, TYPE_SOFTWARE
Public Enum TYPE_RECENT, TYPE_EXAMPLE, TYPE_SOFTWARE, TYPE_TEMPLATE
Event Click(Path As String, Another As Boolean)
Event DblClick(Path As String)
Property AllowOpenExtern As Boolean
Property Current As ProjectBox
Private $hList As ScrollView
Private $hFilter As ButtonBox
@ -16,6 +18,7 @@ Private $hObsList As Observer
Private $dRecent As Date
Private $sLastURL As String
Private $hHelp As WebView
Private $hCurrent As ProjectBox
Public Sub _new(hList As ScrollView, hFilter As ButtonBox, iType As Integer, Optional iArrange As Integer = Arrange.Row)
@ -240,6 +243,69 @@ Private Sub FillWithSoftware()
End
Private Sub GetTemplates() As String[]
Dim sFile As String
Dim aList As New String[]
Dim sDir As String
sDir = System.Path &/ "share/" & "gambas" & System.Version &/ "template"
For Each sFile In Dir(sDir)
If Left(sFile) = "." Then Continue
If Not Exist(sDir &/ sFile &/ ".project") Then Continue
aList.Add(sDir &/ sFile)
Next
sDir = Desktop.DataDir &/ "gambas3/template/"
If IsDir(sDir) Then
For Each sFile In Dir(sDir)
If Left(sFile) = "." Then Continue
If Not Exist(sDir &/ sFile &/ ".project") Then Continue
aList.Add(sDir &/ sFile)
Next
Endif
aList.Sort(gb.Natural)
Return aList
End
Private Sub FillWithTemplate()
Dim hProjectItem As ProjectBox
Dim sGroup As String
Dim aSoft As String[]
Dim sSoft As String
Inc Application.Busy
$hList.Arrangement = Arrange.None
aSoft = GetTemplates()
If aSoft.Count Then
Clear
For Each sSoft In aSoft
hProjectItem = New ProjectBox($hList) As "ProjectItem"
hProjectItem.ResizeScaled(40, 16)
hProjectItem.Path = sSoft
hProjectItem.Group = sGroup
hProjectItem.Template = True
Next
ApplyFilter($hFilter.Text)
$hList.Arrangement = $iArrange
$hFilter.Enabled = True
Endif
Dec Application.Busy
End
Public Sub Clear()
$hList.Children.Clear
@ -335,6 +401,8 @@ Public Sub Fill(Optional bClear As Boolean)
FillWithExample
Case TYPE_SOFTWARE
FillWithSoftware
Case TYPE_TEMPLATE
FillWithTemplate
End Select
End
@ -409,7 +477,15 @@ End
Public Sub ProjectItem_Click()
Raise Click(Last.Path, False)
Me.Current = Last
Raise Click($hCurrent.Path, False)
End
Public Sub ProjectItem_DblClick()
Me.Current = Last
Raise DblClick($hCurrent.Path)
End
@ -501,3 +577,19 @@ Public Sub ExampleWebView_Menu()
Stop Event
End
Private Function Current_Read() As ProjectBox
Return $hCurrent
End
Private Sub Current_Write(Value As ProjectBox)
If $hCurrent = Value Then Return
If $hCurrent Then $hCurrent.Selected = False
$hCurrent = Value
If $hCurrent Then $hCurrent.Selected = True
End

View file

@ -4,10 +4,12 @@ Static Public InAnotherWindow As Boolean
Static Private $sPath As String
Static Private $cVar As New Collection(gb.IgnoreCase)
Static Private $bRepository As Boolean
Static Private $bAnother As Boolean
Static Private $hTemplate As CProjectList
Static Private $sTemplate As String
Static Public Sub Run(Optional bAnother As Boolean) As String
$bAnother = bAnother
@ -20,98 +22,54 @@ Public Sub Form_Open()
'dchProject.SelectedPath = Settings["/FCreateProject/Path", System.User.Home]
Settings.Read(Me)
lstType.Select(panDefaultType)
wizProject.Index = 0
edtOutput.ReadConfig
edtOutput.Text = ""
chkOther.Visible = $bAnother
Settings.Read(dchProject, "dchProject")
ProjectBox.ShowButton = False
$hTemplate = New CProjectList(svwTemplate, txtFilter, CProjectList.TYPE_TEMPLATE, Arrange.Row) As "ProjectItem"
$hTemplate.Fill
$hTemplate.ApplyFilter(txtFilter.Text)
txtFilter.SetFocus
$sTemplate = ""
Dec Application.Busy
End
Private Sub GetTest(sTest As String) As Boolean
Public Sub wizProject_Cancel()
Me.Close
End
Public Sub ProjectItem_Click(sPath As String, (bAnother) As Boolean)
Return Eval(sTest, $cVar)
$sTemplate = sPath
Balloon.Hide
End
Private Sub JumpFile(hFile As File, sBegin As String, sEnd As String, Optional sSearch As String)
Public Sub ProjectItem_DblClick((sPath) As String)
Dim sLine As String
Dim iLevel As Integer
While Not Eof(hFile)
Line Input #hFile, sLine
sLine = Trim(sLine)
If sSearch And If sLine = sSearch Then
If iLevel = 0 Then Return
Continue
Endif
If sLine Begins sBegin & " " Then
Inc iLevel
Else If sLine = sEnd Then
If iLevel = 0 Then Return
Dec iLevel
Endif
Wend
wizProject.MoveNext
End
Private Sub GetFile(sPath As String) As String
Dim hFile As File
Dim sLine As String
Dim sTrim As String
Dim sResult As String
Dim iPos As Integer
Dim iPos2 As Integer
hFile = Open sPath
While Not Eof(hFile)
Line Input #hFile, sLine
sTrim = Trim(sLine)
If Left(sTrim, 4) = "@IF " Then
If Not GetTest(Mid$(sTrim, 5)) Then
JumpFile(hFile, "@IF", "@ENDIF", "@ELSE")
Endif
Else If sTrim = "@ELSE" Then
JumpFile(hFile, "@IF", "@ENDIF")
Else If Left(sTrim) <> "@" Then
iPos = 1
Do
iPos = InStr(sLine, "$(", iPos)
If iPos = 0 Then Break
iPos2 = InStr(sLine, ")", iPos)
sLine = Left(sLine, iPos - 1) & CStr($cVar[Mid$(sLine, iPos + 2, iPos2 - iPos - 2)]) & Mid(sLine, iPos2 + 1)
Loop
sResult &= sLine & "\n"
Endif
Wend
Return sResult
End
Private Sub CreateProject() As Boolean
Dim sDir As String
Dim sName As String
Dim hCtrl As Object
Dim sPath As String
Dim sDest As String
Dim bErr As Boolean
Dim hFile As File
Dim hDest As File
Dim sLine As String
Dim sTemp As String
'DIM hIcon AS Picture
If $bRepository Then
@ -131,50 +89,50 @@ Private Sub CreateProject() As Boolean
Else
sName = Trim(txtName.Text)
sDir = dchProject.SelectedPath &/ sName
sDir = dchProject.SelectedPath
$cVar["NAME"] = sName
Shell "cp -R " & Shell$($sTemplate) & " " & Shell$(sDir) & " 2>&1" To sTemp
If Process.LastValue Then Error.Raise(sTemp)
$cVar["TITLE"] = Trim(txtTitle.Text)
If Not $cVar["TITLE"] Then $cVar["TITLE"] = sName
$cVar["LANGUAGE"] = System.Language
For Each hCtrl In lstType.Children
If hCtrl.Tag Then $cVar[hCtrl.Tag] = False
Next
$cVar[lstType.Current.Tag] = True
If sName <> File.Name($sTemplate) Then Move sDir &/ File.Name($sTemplate) To sDir &/ sName
sDir &/= sName
For Each hCtrl In svwOption.Children
If hCtrl.Tag Then $cVar[hCtrl.Tag] = hCtrl.Value
Next
Shell "rm -rf " & Shell$(sDir &/ ".lang") Wait
Kill sDir &/ "icon.png"
$cVar["GRAPHIC"] = $cVar["QT"] Or $cVar["GTK"] Or $cVar["GUI"]
sTemp = Temp$()
Try Rmdir sDir
hFile = Open sDir &/ ".project"
hDest = Open sTemp For Create
Mkdir sDir
Mkdir sDir &/ ".src"
Mkdir sDir &/ ".hidden"
For Each sPath In Split(GetFile("template/list"), "\n", "", True)
For Each sLine In hFile.Lines
sDest = sPath
If Left(sDest) = "_" Then sDest = "." & Mid(sDest, 2)
If InStr(sDest, "/") Then
Try Mkdir sDir &/ File.Dir(sDest)
Else If CModule.Ext.Exist(File.Ext(sDest))
sDest = ".src" &/ sDest
If sLine Begins "# Compiled with" Then
Continue
Else If sLine Begins "Title=" Then
sLine = "Title=" & txtTitle.Text
Else If sLine Begins "Translate=" Then
If Not chkTranslate.Value Then Continue
sLine = "Translate=1"
Mkdir sDir &/ ".lang"
Else If sLine Begins "Version=" Then
sLine = "Version=0.0.1"
Else If sLine Begins "Description=" Then
Continue
Else If sLine Begins "Icon=" Then
Continue
Endif
If File.Ext(sPath) = "png" Then
Copy "template" &/ File.Name(sPath) To sDir &/ sDest
Else
File.Save(sDir &/ sDest, GetFile("template" &/ File.Name(sPath)))
Endif
Print #hDest, sLine
Next
Close #hFile
Close #hDest
Kill sDir &/ ".project"
Copy sTemp To sDir &/ ".project"
Project.MakeDirectoryIcon(sDir)
Endif
@ -209,6 +167,13 @@ Public Sub wizProject_BeforeChange()
Select Case wizProject.Index
Case 0
If Not $sTemplate Then
Balloon.Warning(("Please choose a template"), svwTemplate)
Stop Event
Endif
$bRepository = File.Name($sTemplate) = "~subversion"
Case 1
panRepository.Visible = $bRepository
panIdent.Visible = Not $bRepository
@ -265,18 +230,12 @@ Public Sub wizProject_Close()
End
Public Sub wizProject_Cancel()
Me.Close
End
Public Sub lstType_Click()
$bRepository = Left(lstType.Current.Tag) = "!"
svwOption.Enabled = Not $bRepository
End
' Public Sub lstType_Click()
'
' $bRepository = Left(lstType.Current.Tag) = "!"
' svwOption.Enabled = Not $bRepository
'
' End
Public Sub txtName_Change()
@ -287,3 +246,10 @@ Public Sub txtName_Change()
Endif
End
Public Sub svwTemplate_MouseUp()
$hTemplate.Current = Null
$sTemplate = ""
End

View file

@ -1,14 +1,14 @@
# Gambas Form File 3.0
{ Form Form
MoveScaled(0,0,87,70)
MoveScaled(0,0,84,72)
Text = ("New project")
Icon = Picture["icon:/small/new"]
Persistent = True
Arrangement = Arrange.Fill
Margin = True
{ wizProject Wizard
MoveScaled(1,1,84,68)
MoveScaled(1,1,82,69)
Arrangement = Arrange.Vertical
Spacing = True
Count = 3
@ -18,250 +18,46 @@
Animated = True
Index = 0
Text = ("Project type")
{ HBox5 HBox
MoveScaled(1,0,81,58)
{ Panel1 Panel
MoveScaled(1,1,80,54)
Background = Color.TextBackground
Expand = True
Arrangement = Arrange.Vertical
Spacing = True
{ VBox3 VBox
MoveScaled(1,1,35,53)
Expand = True
Spacing = True
{ Label5 Label
MoveScaled(1,1,25,3)
Font = Font["Bold"]
AutoResize = True
Text = ("Type")
}
{ lstType ListContainer
MoveScaled(1,5,33,47)
Expand = True
{ panDefaultType HBox
MoveScaled(0,0,32,6)
Tag = "GUI"
Mouse = Mouse.Pointing
Spacing = True
Margin = True
Padding = 4
{ PictureBox7 PictureBox
MoveScaled(1,1,5,5)
Picture = Picture["icon:/32/mouse"]
Stretch = True
Alignment = Align.Center
}
{ Label11 Label
MoveScaled(8,1,22,5)
Expand = True
Text = ("Graphical application")
}
}
{ HBox9 HBox
MoveScaled(0,7,32,6)
Tag = "QT"
Mouse = Mouse.Pointing
Spacing = True
Margin = True
Padding = 4
{ PictureBox2 PictureBox
MoveScaled(1,1,5,5)
Picture = Picture["img/logo/qt.png"]
Stretch = True
Alignment = Align.Center
}
{ Label6 Label
MoveScaled(8,1,22,5)
Expand = True
Text = ("QT graphical application")
}
}
{ HBox2 HBox
MoveScaled(0,13,32,6)
Tag = "GTK"
Mouse = Mouse.Pointing
Spacing = True
Margin = True
Padding = 4
{ PictureBox3 PictureBox
MoveScaled(1,1,5,5)
Picture = Picture["img/logo/gtk.png"]
Stretch = True
Alignment = Align.Center
}
{ Label8 Label
MoveScaled(8,1,23,5)
Expand = True
Text = ("GTK+ graphical application")
}
}
{ HBox3 HBox
MoveScaled(0,19,32,6)
Tag = "CONSOLE"
Mouse = Mouse.Pointing
Spacing = True
Margin = True
Padding = 4
{ PictureBox4 PictureBox
MoveScaled(1,1,5,5)
Picture = Picture["icon:/48/terminal"]
Stretch = True
Alignment = Align.Center
}
{ Label9 Label
MoveScaled(8,1,22,5)
Expand = True
Text = ("Command-line application")
}
}
{ HBox4 HBox
MoveScaled(0,25,32,6)
Tag = "GAME"
Mouse = Mouse.Pointing
Spacing = True
Margin = True
Padding = 4
{ PictureBox5 PictureBox
MoveScaled(1,1,5,5)
Picture = Picture["icon:/48/game"]
Stretch = True
Alignment = Align.Center
}
{ Label13 Label
MoveScaled(8,1,22,5)
Expand = True
Text = ("SDL application")
}
}
{ HBox1 HBox
MoveScaled(0,31,32,6)
Tag = "WEB"
Mouse = Mouse.Pointing
Spacing = True
Margin = True
Padding = 4
{ PictureBox1 PictureBox
MoveScaled(1,1,5,5)
Picture = Picture["img/logo/browser.png"]
Stretch = True
Alignment = Align.Center
}
{ Label1 Label
MoveScaled(8,1,22,5)
Expand = True
Text = ("CGI Web application")
}
}
{ Separator2 Separator
MoveScaled(-3,37,37,3)
}
{ HBox8 HBox
MoveScaled(0,39,32,6)
Tag = "!SVN"
Mouse = Mouse.Pointing
Spacing = True
Margin = True
Padding = 4
{ PictureBox6 PictureBox
MoveScaled(1,1,5,5)
Picture = Picture["img/logo/subversion.png"]
Stretch = True
Alignment = Align.Center
}
{ Label4 Label
MoveScaled(8,1,22,5)
Expand = True
Text = ("Application stored in a\nSubversion repository")
}
}
Margin = True
Border = Border.Plain
{ Panel3 Panel
MoveScaled(6,4,38,4)
Visible = False
Arrangement = Arrange.Fill
Border = Border.Plain
{ txtFilter ButtonBox
MoveScaled(1,0,24,4)
Foreground = Color.LightForeground
Picture = Picture["icon:/small/clear"]
Border = False
}
}
{ VBox1 VBox
MoveScaled(37,1,41,56)
{ svwTemplate ScrollView
MoveScaled(4,12,72,39)
Background = Color.TextBackground
Expand = True
Arrangement = Arrange.Row
Spacing = True
{ Label12 Label
MoveScaled(1,1,25,3)
Font = Font["Bold"]
AutoResize = True
Text = ("Options")
}
{ svwOption ScrollView
MoveScaled(1,5,39,50)
Background = Color.TextBackground
Expand = True
Arrangement = Arrange.Vertical
Padding = 4
ScrollBar = Scroll.Vertical
{ chkLocalize CheckBox
MoveScaled(1,0,37,4)
Tag = "TRANSLATE"
Text = ("Internationalization")
}
{ CheckBox2 CheckBox
MoveScaled(1,4,37,4)
Tag = "DATABASE"
Text = ("Database access")
}
{ CheckBox3 CheckBox
MoveScaled(1,8,37,4)
Tag = "NETWORK"
Text = ("Network programming")
}
{ CheckBox7 CheckBox
MoveScaled(1,12,37,4)
Tag = "SETTINGS"
Text = ("Settings files management")
}
{ CheckBox1 CheckBox
MoveScaled(1,16,37,4)
Tag = "REGEXP"
Text = ("Regular expressions")
}
{ CheckBox4 CheckBox
MoveScaled(1,20,37,4)
Tag = "XML"
Text = ("XML / XSLT programming")
}
{ CheckBox6 CheckBox
MoveScaled(1,24,37,4)
Tag = "OPENGL"
Text = ("OpenGL programming")
}
{ CheckBox5 CheckBox
MoveScaled(1,28,37,4)
Tag = "IMAGE"
Text = ("Image processing")
}
{ chkCtrlPublic2 CheckBox
MoveScaled(1,32,37,4)
Tag = "SCIENCE"
Text = ("Scientific computing")
}
{ chkCtrlPublic CheckBox
MoveScaled(1,36,37,4)
Tag = "VISUAL"
Text = ("Visual Basic™ conversion help")
}
{ Separator1 Separator
MoveScaled(1,41,37,3)
}
{ CheckBox8 CheckBox
MoveScaled(1,44,35,4)
Tag = "COMPONENT"
Text = ("Component programming")
}
}
Border = False
}
}
Index = 1
Text = ("Project parent directory")
Text = ("Parent directory")
{ dchProject DirChooser
MoveScaled(2,1,81,56)
MoveScaled(4,3,73,50)
Expand = True
Root = "/"
}
Index = 2
Text = ("Project information")
Text = ("Project details")
{ panIdent VBox
MoveScaled(0,0,80,31)
MoveScaled(1,0,80,39)
Spacing = True
{ Label10 Label
MoveScaled(0,0,25,3)
@ -277,7 +73,7 @@
Font = Font["Italic,-1"]
Text = ("The project name is the name of the project directory.")
}
{ Panel1 HBox
{ Panel2 HBox
MoveScaled(0,11,74,2)
Spacing = True
{ Label16 Label
@ -306,13 +102,20 @@
Font = Font["Italic,-1"]
Text = ("The project title is the true name of the application.")
}
{ Panel4 Panel
MoveScaled(22,27,4,1)
}
{ chkTranslate CheckBox
MoveScaled(1,29,43,3)
Text = ("Project is translatable")
}
{ chkOther CheckBox
MoveScaled(1,27,43,4)
MoveScaled(1,33,43,3)
Text = ("Open in another window")
}
}
{ panRepository VBox
MoveScaled(0,32,81,25)
MoveScaled(1,40,81,18)
Expand = True
Spacing = True
{ Label7 Label
@ -330,7 +133,7 @@
Text = ("The project repository is directly sent to the 'svn checkout' command.")
}
{ edtOutput TextEditor
MoveScaled(0,12,79,12)
MoveScaled(0,11,79,6)
Font = Font["Monospace,-1"]
Expand = True
ReadOnly = True

View file

@ -0,0 +1,289 @@
' Gambas class file
Static Public InAnotherWindow As Boolean
Static Private $sPath As String
Static Private $cVar As New Collection(gb.IgnoreCase)
Static Private $bRepository As Boolean
Static Private $bAnother As Boolean
Static Public Sub Run(Optional bAnother As Boolean) As String
$bAnother = bAnother
Inc Application.Busy
If Me.ShowModal() Then Return $sPath
End
Public Sub Form_Open()
'dchProject.SelectedPath = Settings["/FCreateProject/Path", System.User.Home]
Settings.Read(Me)
lstType.Select(panDefaultType)
wizProject.Index = 0
edtOutput.ReadConfig
edtOutput.Text = ""
chkOther.Visible = $bAnother
Settings.Read(dchProject, "dchProject")
Dec Application.Busy
End
Private Sub GetTest(sTest As String) As Boolean
Return Eval(sTest, $cVar)
End
Private Sub JumpFile(hFile As File, sBegin As String, sEnd As String, Optional sSearch As String)
Dim sLine As String
Dim iLevel As Integer
While Not Eof(hFile)
Line Input #hFile, sLine
sLine = Trim(sLine)
If sSearch And If sLine = sSearch Then
If iLevel = 0 Then Return
Continue
Endif
If sLine Begins sBegin & " " Then
Inc iLevel
Else If sLine = sEnd Then
If iLevel = 0 Then Return
Dec iLevel
Endif
Wend
End
Private Sub GetFile(sPath As String) As String
Dim hFile As File
Dim sLine As String
Dim sTrim As String
Dim sResult As String
Dim iPos As Integer
Dim iPos2 As Integer
hFile = Open sPath
While Not Eof(hFile)
Line Input #hFile, sLine
sTrim = Trim(sLine)
If Left(sTrim, 4) = "@IF " Then
If Not GetTest(Mid$(sTrim, 5)) Then
JumpFile(hFile, "@IF", "@ENDIF", "@ELSE")
Endif
Else If sTrim = "@ELSE" Then
JumpFile(hFile, "@IF", "@ENDIF")
Else If Left(sTrim) <> "@" Then
iPos = 1
Do
iPos = InStr(sLine, "$(", iPos)
If iPos = 0 Then Break
iPos2 = InStr(sLine, ")", iPos)
sLine = Left(sLine, iPos - 1) & CStr($cVar[Mid$(sLine, iPos + 2, iPos2 - iPos - 2)]) & Mid(sLine, iPos2 + 1)
Loop
sResult &= sLine & "\n"
Endif
Wend
Return sResult
End
Private Sub CreateProject() As Boolean
Dim sDir As String
Dim sName As String
Dim hCtrl As Object
Dim sPath As String
Dim sDest As String
Dim bErr As Boolean
'DIM hIcon AS Picture
If $bRepository Then
sPath = Trim(txtRepository.Text)
If Right(sPath) = "/" Then sPath = Left(sPath, -1)
sDir = dchProject.SelectedPath
edtOutput.ReadOnly = False
bErr = VersionControl.CheckoutSVN(sPath, sDir, edtOutput)
edtOutput.ReadOnly = True
If bErr Then Error.Raise(("Project checkout has failed."))
sDir &/= File.Name(sPath)
Else
sName = Trim(txtName.Text)
sDir = dchProject.SelectedPath &/ sName
$cVar["NAME"] = sName
$cVar["TITLE"] = Trim(txtTitle.Text)
If Not $cVar["TITLE"] Then $cVar["TITLE"] = sName
$cVar["LANGUAGE"] = System.Language
For Each hCtrl In lstType.Children
If hCtrl.Tag Then $cVar[hCtrl.Tag] = False
Next
$cVar[lstType.Current.Tag] = True
For Each hCtrl In svwOption.Children
If hCtrl.Tag Then $cVar[hCtrl.Tag] = hCtrl.Value
Next
$cVar["GRAPHIC"] = $cVar["QT"] Or $cVar["GTK"] Or $cVar["GUI"]
Try Rmdir sDir
Mkdir sDir
Mkdir sDir &/ ".src"
Mkdir sDir &/ ".hidden"
For Each sPath In Split(GetFile("template/list"), "\n", "", True)
sDest = sPath
If Left(sDest) = "_" Then sDest = "." & Mid(sDest, 2)
If InStr(sDest, "/") Then
Try Mkdir sDir &/ File.Dir(sDest)
Else If CModule.Ext.Exist(File.Ext(sDest))
sDest = ".src" &/ sDest
Endif
If File.Ext(sPath) = "png" Then
Copy "template" &/ File.Name(sPath) To sDir &/ sDest
Else
File.Save(sDir &/ sDest, GetFile("template" &/ File.Name(sPath)))
Endif
Next
Project.MakeDirectoryIcon(sDir)
Endif
$sPath = sDir
Return False
Catch
Message.Error(("Cannot create project!") & "\n\n" & Error.Text)
Return True
End
Public Sub Form_Close()
Settings.Write(dchProject, "dchProject")
Settings.Write(Me)
End
Public Sub dchProject_Icon(Path As String)
If Exist(Path &/ ".project") Then
dchProject.Icon = Project.GetIcon(Path, 16)
Endif
End
Public Sub wizProject_BeforeChange()
Select Case wizProject.Index
Case 1
panRepository.Visible = $bRepository
panIdent.Visible = Not $bRepository
If $bRepository Then
txtRepository.SetFocus
Else
txtName.SetFocus
txtName_Change
Endif
End Select
End
Public Sub wizProject_Close()
Dim sMsg As String
If $bRepository Then
If Not Trim(txtRepository.Text) Then
txtRepository.SetFocus
Balloon.Warning(("Please enter the location of the repository."), txtRepository)
Return
Endif
Else
sMsg = Project.CheckProjectName(txtName.Text, dchProject.SelectedPath)
If sMsg
txtName.SetFocus
txtName.SelectAll
Balloon.Warning(sMsg, txtName)
Return
Endif
Endif
' IF NOT dchProject.SelectedPath THEN
' dchProject.SetFocus
' 'tabProject.Index = 1
' Balloon.Warning(("Choose the project parent directory."), dchProject)
' RETURN
' ENDIF
If CreateProject() Then Return
Message(("The project has been successfully created."))
InAnotherWindow = chkOther.Value
Me.Close(True)
End
Public Sub wizProject_Cancel()
Me.Close
End
Public Sub lstType_Click()
$bRepository = Left(lstType.Current.Tag) = "!"
svwOption.Enabled = Not $bRepository
End
Public Sub txtName_Change()
If Trim(txtName.Text) Then
lblFinalDir.Text = dchProject.SelectedPath &/ Trim(txtName.Text)
Else
lblFinalDir.Text = dchProject.SelectedPath &/ "..."
Endif
End

View file

@ -0,0 +1,341 @@
# Gambas Form File 3.0
{ Form Form
MoveScaled(0,0,87,70)
Text = ("New project")
Icon = Picture["icon:/small/new"]
Persistent = True
Arrangement = Arrange.Fill
Margin = True
{ wizProject Wizard
MoveScaled(1,1,84,68)
Arrangement = Arrange.Vertical
Spacing = True
Count = 3
TextFont = Font["Bold,+3"]
ShowIndex = True
Border = False
Animated = True
Index = 0
Text = ("Project type")
{ HBox5 HBox
MoveScaled(1,0,81,58)
Expand = True
Spacing = True
{ VBox3 VBox
MoveScaled(1,1,35,53)
Expand = True
Spacing = True
{ Label5 Label
MoveScaled(1,1,25,3)
Font = Font["Bold"]
AutoResize = True
Text = ("Type")
}
{ lstType ListContainer
MoveScaled(1,5,33,47)
Expand = True
{ panDefaultType HBox
MoveScaled(0,0,32,6)
Tag = "GUI"
Mouse = Mouse.Pointing
Spacing = True
Margin = True
Padding = 4
{ PictureBox7 PictureBox
MoveScaled(1,1,5,5)
Picture = Picture["icon:/32/mouse"]
Stretch = True
Alignment = Align.Center
}
{ Label11 Label
MoveScaled(8,1,22,5)
Expand = True
Text = ("Graphical application")
}
}
{ HBox9 HBox
MoveScaled(0,7,32,6)
Tag = "QT"
Mouse = Mouse.Pointing
Spacing = True
Margin = True
Padding = 4
{ PictureBox2 PictureBox
MoveScaled(1,1,5,5)
Picture = Picture["img/logo/qt.png"]
Stretch = True
Alignment = Align.Center
}
{ Label6 Label
MoveScaled(8,1,22,5)
Expand = True
Text = ("QT graphical application")
}
}
{ HBox2 HBox
MoveScaled(0,13,32,6)
Tag = "GTK"
Mouse = Mouse.Pointing
Spacing = True
Margin = True
Padding = 4
{ PictureBox3 PictureBox
MoveScaled(1,1,5,5)
Picture = Picture["img/logo/gtk.png"]
Stretch = True
Alignment = Align.Center
}
{ Label8 Label
MoveScaled(8,1,23,5)
Expand = True
Text = ("GTK+ graphical application")
}
}
{ HBox3 HBox
MoveScaled(0,19,32,6)
Tag = "CONSOLE"
Mouse = Mouse.Pointing
Spacing = True
Margin = True
Padding = 4
{ PictureBox4 PictureBox
MoveScaled(1,1,5,5)
Picture = Picture["icon:/48/terminal"]
Stretch = True
Alignment = Align.Center
}
{ Label9 Label
MoveScaled(8,1,22,5)
Expand = True
Text = ("Command-line application")
}
}
{ HBox4 HBox
MoveScaled(0,25,32,6)
Tag = "GAME"
Mouse = Mouse.Pointing
Spacing = True
Margin = True
Padding = 4
{ PictureBox5 PictureBox
MoveScaled(1,1,5,5)
Picture = Picture["icon:/48/game"]
Stretch = True
Alignment = Align.Center
}
{ Label13 Label
MoveScaled(8,1,22,5)
Expand = True
Text = ("SDL application")
}
}
{ HBox1 HBox
MoveScaled(0,31,32,6)
Tag = "WEB"
Mouse = Mouse.Pointing
Spacing = True
Margin = True
Padding = 4
{ PictureBox1 PictureBox
MoveScaled(1,1,5,5)
Picture = Picture["img/logo/browser.png"]
Stretch = True
Alignment = Align.Center
}
{ Label1 Label
MoveScaled(8,1,22,5)
Expand = True
Text = ("CGI Web application")
}
}
{ Separator2 Separator
MoveScaled(-3,37,37,3)
}
{ HBox8 HBox
MoveScaled(0,39,32,6)
Tag = "!SVN"
Mouse = Mouse.Pointing
Spacing = True
Margin = True
Padding = 4
{ PictureBox6 PictureBox
MoveScaled(1,1,5,5)
Picture = Picture["img/logo/subversion.png"]
Stretch = True
Alignment = Align.Center
}
{ Label4 Label
MoveScaled(8,1,22,5)
Expand = True
Text = ("Application stored in a\nSubversion repository")
}
}
}
}
{ VBox1 VBox
MoveScaled(37,1,41,56)
Expand = True
Spacing = True
{ Label12 Label
MoveScaled(1,1,25,3)
Font = Font["Bold"]
AutoResize = True
Text = ("Options")
}
{ svwOption ScrollView
MoveScaled(1,5,39,50)
Background = Color.TextBackground
Expand = True
Arrangement = Arrange.Vertical
Padding = 4
ScrollBar = Scroll.Vertical
{ chkLocalize CheckBox
MoveScaled(1,0,37,4)
Tag = "TRANSLATE"
Text = ("Internationalization")
}
{ CheckBox2 CheckBox
MoveScaled(1,4,37,4)
Tag = "DATABASE"
Text = ("Database access")
}
{ CheckBox3 CheckBox
MoveScaled(1,8,37,4)
Tag = "NETWORK"
Text = ("Network programming")
}
{ CheckBox7 CheckBox
MoveScaled(1,12,37,4)
Tag = "SETTINGS"
Text = ("Settings files management")
}
{ CheckBox1 CheckBox
MoveScaled(1,16,37,4)
Tag = "REGEXP"
Text = ("Regular expressions")
}
{ CheckBox4 CheckBox
MoveScaled(1,20,37,4)
Tag = "XML"
Text = ("XML / XSLT programming")
}
{ CheckBox6 CheckBox
MoveScaled(1,24,37,4)
Tag = "OPENGL"
Text = ("OpenGL programming")
}
{ CheckBox5 CheckBox
MoveScaled(1,28,37,4)
Tag = "IMAGE"
Text = ("Image processing")
}
{ chkCtrlPublic2 CheckBox
MoveScaled(1,32,37,4)
Tag = "SCIENCE"
Text = ("Scientific computing")
}
{ chkCtrlPublic CheckBox
MoveScaled(1,36,37,4)
Tag = "VISUAL"
Text = ("Visual Basic™ conversion help")
}
{ Separator1 Separator
MoveScaled(1,41,37,3)
}
{ CheckBox8 CheckBox
MoveScaled(1,44,35,4)
Tag = "COMPONENT"
Text = ("Component programming")
}
}
}
}
Index = 1
Text = ("Project parent directory")
{ dchProject DirChooser
MoveScaled(2,1,81,56)
Expand = True
Root = "/"
}
Index = 2
Text = ("Project information")
{ panIdent VBox
MoveScaled(0,0,80,31)
Spacing = True
{ Label10 Label
MoveScaled(0,0,25,3)
Font = Font["Bold"]
Text = ("Project name")
Alignment = Align.BottomNormal
}
{ txtName TextBox
MoveScaled(0,4,49,4)
}
{ Label2 Label
MoveScaled(0,8,76,2)
Font = Font["Italic,-1"]
Text = ("The project name is the name of the project directory.")
}
{ Panel1 HBox
MoveScaled(0,11,74,2)
Spacing = True
{ Label16 Label
MoveScaled(0,0,23,2)
Font = Font["Italic,-1"]
AutoResize = True
Text = ("The project final directory is :")
}
{ lblFinalDir Label
MoveScaled(24,0,39,2)
Font = Font["Bold,-1"]
Expand = True
}
}
{ Label3 Label
MoveScaled(1,15,25,3)
Font = Font["Bold"]
Text = ("Project title")
Alignment = Align.BottomNormal
}
{ txtTitle TextBox
MoveScaled(1,19,51,4)
}
{ Label14 Label
MoveScaled(1,23,76,2)
Font = Font["Italic,-1"]
Text = ("The project title is the true name of the application.")
}
{ chkOther CheckBox
MoveScaled(1,27,43,4)
Text = ("Open in another window")
}
}
{ panRepository VBox
MoveScaled(0,32,81,25)
Expand = True
Spacing = True
{ Label7 Label
MoveScaled(0,0,25,3)
Font = Font["Bold"]
Text = ("Repository")
Alignment = Align.BottomNormal
}
{ txtRepository TextBox
MoveScaled(0,4,51,4)
}
{ Label15 Label
MoveScaled(0,8,76,2)
Font = Font["Italic,-1"]
Text = ("The project repository is directly sent to the 'svn checkout' command.")
}
{ edtOutput TextEditor
MoveScaled(0,12,79,12)
Font = Font["Monospace,-1"]
Expand = True
ReadOnly = True
}
}
Index = 0
}
}

View file

@ -79,6 +79,8 @@ Public Sub Form_Open()
Settings.Read(Me)
Settings.Read(dchProject, "dchProject")
dchProject.Bookmarks = Project.GetBookmarks()
End
Public Sub Form_Close()

View file

@ -16,7 +16,9 @@ Property Selected As Boolean
'Property Read IdealHeight As Integer
Property ShowAuthors As Boolean
Property Read Info As CProjectInfo
Public Group As String ' for examples
Public Template As Boolean
'Static Private $hGradient As Image
@ -165,7 +167,11 @@ Public Sub DrawingArea_Draw()
Paint.AntiAlias = False
Paint.Rectangle(X, Y, W - 1, H - 1)
iBg = Color.Merge(Color.TextForeground, Color.TextBackground, 0.97)
If $bSelected Then
iBg = Color.LightBackground
Else
iBg = Color.Merge(Color.TextForeground, Color.TextBackground, 0.97)
Endif
Paint.Background = iBg
Paint.Fill(True)
@ -207,13 +213,29 @@ Public Sub DrawingArea_Draw()
X += ICON_SIZE + P
sText = .Name
If Template Then
sText = .GetTranslatedTitle()
Else
sText = .Name
Endif
'Paint.Font = Font["+1"]
Paint.Background = iCol
Paint.DrawTextShadow(sText, X, Y, W, H, Align.TopLeft)
Paint.DrawText(sText, X, Y, W, H, Align.TopLeft)
If bSmall Then
If Template Then
X -= ICON_SIZE + P
sText = .GetTranslatedDescription()
Paint.Font = Font["-1"]
W = W - X - P * 2
H = H - Y - ICON_SIZE
sText = Paint.TrimText(sText, W, H)
Paint.DrawText(sText, X, Y + ICON_SIZE + P, W, H)
Else If bSmall Then
WT = Paint.Font.TextWidth(sText & " ")
@ -236,6 +258,7 @@ Public Sub DrawingArea_Draw()
Else
Paint.Font.Bold = False
sText = .Version
'Paint.DrawTextShadow(sText, X + 1, Y + Paint.Font.Height + 1, Paint.W, Paint.H, Align.TopLeft, 4)
Paint.DrawText(sText, X, Y + Paint.Font.Height, Paint.W, Paint.H, Align.TopLeft)
@ -272,6 +295,10 @@ Public Sub DrawingArea_Draw()
Paint.DrawText(("Open in another window") & "…", X + P, Y, W - P * 2, H, Align.Normal)
Endif
' If Template And If $sPath = GetParent().Current Then
' Paint.FillRect(0, 0, Paint.W, Paint.H, Color.SetAlpha(Color.SelectedBackground, 128))
' Endif
'
End
Public Sub DrawingArea_Enter()
@ -402,6 +429,7 @@ Public Sub DrawingArea_MouseUp()
Else
Raise Click
Endif
$hDrawingArea.Refresh
Endif
End

View file

@ -2,6 +2,6 @@ MMain
gb.args
0
0
3.6.90
3.8.90

View file

@ -2,7 +2,7 @@ Form11
Desktop-neutral routines from Portland project
0
0
3.7.90
3.8.90
gb.image
gb.gui

View file

@ -1,7 +1,7 @@
# Gambas Project File 3.0
# Compiled with Gambas 3.8.90
Title=More controls for graphical components
Startup=FTestDateChooser
Startup=Main
Version=3.8.90
VersionFile=1
Component=gb.image

View file

@ -201,7 +201,36 @@ End
Public Sub Main()
FTestBalloon.ShowModal
Dim hTask As CTaskDirSize
hTask = New CTaskDirSize("/home/benoit/gambas/3.0") As "Task"
Wait 10
End
Public Sub Task_Read(sData As String)
Debug sData
End
Public Sub Task_Error(Data As String)
Debug Data
End
Public Sub Task_Kill()
Dim sStr As String
Try sStr = Last.Value
If Error Then
Debug Error.Text
Else
Debug "->";; sStr
Endif
End

View file

@ -2,6 +2,6 @@ MTest
gb.logging
0
0
3.6.90
3.8.90

View file

@ -2,7 +2,7 @@ Form5
gb.map
0
0
3.6.90
3.8.90
gb.image
gb.gui

View file

@ -2,6 +2,6 @@ MTest
Gambas markup syntax
0
0
3.7.90
3.8.90

View file

@ -2,7 +2,7 @@ modMain
mysql
0
0
3.6.90
3.8.90
gb.db

View file

@ -2,7 +2,7 @@ MTest
gb.net.pop3
0
0
3.6.90
3.8.90
gb.net
gb.mime

View file

@ -2,7 +2,7 @@ Module2
gb.scanner
0
0
3.7.0
3.8.90
gb.image
gb.gui

View file

@ -2,6 +2,6 @@ MMain
gb.util.web
0
0
3.8.0
3.8.90

View file

@ -2,6 +2,6 @@ MMain
Gambas utilities
0
0
3.7.90
3.8.90

View file

@ -2,7 +2,7 @@ MMain
gb.net.curl
0
0
3.7.90
3.8.90
gb.net
gb.net.curl

View file

@ -2,7 +2,7 @@ Main
gb.db
0
0
3.7.90
3.8.90
gb.db

View file

@ -2,6 +2,6 @@ MMain
gbh3
0
0
3.6.90
3.8.90