[DEVELOPMENT ENVIRONMENT]

* NEW: Create file dialog: Replace the deprecated ListContainer control by 
  a ListView.


git-svn-id: svn://localhost/gambas/trunk@6524 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2014-10-09 21:33:29 +00:00
parent 4285255ff0
commit 8079623a4d
3 changed files with 48 additions and 213 deletions

View File

@ -1,31 +1,36 @@
' Gambas class file
Private $sFic As String
Public Sub Run(sFic As String) As String
$sFic = sFic
If Not Me.ShowModal() Then Return
Return $sFic
End
Public Sub btnOK_Click()
$sFic = Mid$(fchFile.SelectedPath, Len(fchFile.Root) + 1)
If Left($sFic) = "/" Then $sFic = Mid$($sFic, 2)
If Not $sFic Then Return
Me.Close(True)
End
Public Sub btnCancel_Click()
Me.Close
End
Public Sub Form_Open()
fchFile.Root = Project.Dir &/ ".hidden"
fchFile.SelectedPath = Project.Dir &/ ".hidden" &/ $sFic
End
End
Public Sub fchFile_Activate()

View File

@ -22,13 +22,13 @@ Public Sub btnCancel_Click()
End
Public Sub lstType_Click()
Public Sub lvwType_Select()
Dim sPrefix As String
Dim hChild As Control
Dim bOpt As Boolean
sPrefix = lstType.Current.Tag
sPrefix = lvwType.Key
For Each hChild In panOption.Children
If Not hChild.Tag Then Continue
hChild.Visible = Split(hChild.Tag, ",").Exist(sPrefix)
@ -75,7 +75,7 @@ Public Sub InitFilter()
$bInitFileChooser = True
Endif
sType = lstType.Current.Tag
sType = lvwType.Key
If Project.IsSourceDir($sDir) Then
@ -124,54 +124,65 @@ Public Sub Form_Open()
Dim hPanel As Container
Dim hPictureBox As PictureBox
Dim aFilterType As String[]
Dim sType As String
$bDoNotSetName = False
Settings.Read(Me)
lvwType.Clear
If Project.IsSourceDir($sDir) Then
aFilterType = ["module", "class"]
lvwType.Add("module", ("Module"), Project.MakeModuleIcon("module", 32).Picture)
lvwType.Add("class", ("Class"), Project.MakeModuleIcon("class", 32).Picture)
For Each hModule In CModule.All
aFilterType.Add(hModule.Key)
lvwType.Add(hModule.Key, hModule.Name, Project.MakeModuleIcon(hModule.Key, 32).Picture)
Next
Else
aFilterType = ["image", "html", "css", "js", "text"]
lvwType.Add("image", ("Image"), Picture["icon:/32/image"])
lvwType.Add("text", ("Text file"), Picture["icon:/32/text"])
lvwType.Add("html", ("HTML file"), Picture["icon:/32/html"])
lvwType.Add("css", ("Style sheet"), Picture["icon:/32/html"])
lvwType.Add("js", ("Javascript file"), Picture["icon:/32/script"])
Endif
For Each hPanel In lstType.Children
If Not hPanel.Tag Then Continue
hPanel.Visible = aFilterType.Exist(hPanel.Tag)
If Not hPanel.Visible Then Continue
hPictureBox = hPanel.Children[0]
'hPictureBox.W = hPictureBox.H
hModule = CModule[hPanel.Tag]
If Not hModule Then Continue
hPanel.Visible = hModule.Used
If hPanel.Visible Then
If Not hPictureBox.Picture Then hPictureBox.Picture = Project.MakeModuleIcon(hPanel.Tag, 32).Picture
Endif
Next
' For Each hPanel In lstType.Children
' If Not hPanel.Tag Then Continue
' hPanel.Visible = aFilterType.Exist(hPanel.Tag)
' If Not hPanel.Visible Then Continue
' hPictureBox = hPanel.Children[0]
' 'hPictureBox.W = hPictureBox.H
' hModule = CModule[hPanel.Tag]
' If Not hModule Then Continue
' hPanel.Visible = hModule.Used
' If hPanel.Visible Then
' If Not hPictureBox.Picture Then hPictureBox.Picture = Project.MakeModuleIcon(hPanel.Tag, 32).Picture
' Endif
' Next
cmbParent.List = Project.GetClassesOnly()
cmbParent.Add(("(No parent)"), 0)
If Project.IsSourcePath($sPath) Then
cmbParent.Text = Project.GetParentClass($sPath)
Endif
If cmbParent.Index < 0 Then cmbParent.Index = 0
lstType.Select(Null)
If Not $sType Then $sType = "module"
For Each hCtrl In lstType.Children
If hCtrl.Tag = $sType Then
lstType.Select(hCtrl)
Break
Endif
Next
lvwType[$sType].Selected = True
tabFile.Index = 0
lvwType_Select
End
@ -195,7 +206,7 @@ End
Private Sub CreateFile() As Boolean
Dim sType As String = lstType.Current.Tag
Dim sType As String = lvwType.Key
Dim sName As String = Trim(txtName.Text)
Dim sMsg As String
Dim sTemp As String
@ -492,7 +503,7 @@ End
Private Sub UpdateExistingTab()
If CModule.Ext.Exist(lstType.Current.Tag) Then
If CModule.Ext.Exist(lvwType.Key) Then
fchExisting.ShowHidden = True
Endif

View File

@ -1,7 +1,7 @@
# Gambas Form File 3.0
{ Form Form
MoveScaled(0,0,92,82)
MoveScaled(0,0,82,82)
Text = ("New file")
Icon = Picture["icon:/small/new"]
Persistent = True
@ -18,191 +18,10 @@
{ HBox3 HBox
MoveScaled(1,1,77,56)
Expand = True
{ lstType ListContainer
MoveScaled(1,1,32,54)
Background = Color.TextBackground
{ lvwType ListView
MoveScaled(2,2,29,51)
Mouse = Mouse.Pointing
Border = False
{ panModule HBox panType
Name = "panModule"
MoveScaled(0,0,31,5)
Tag = "module"
Spacing = True
Margin = True
Padding = 4
{ PictureBox2 PictureBox
MoveScaled(1,1,3,3)
Picture = Picture["img/32/module.png"]
Stretch = True
Alignment = Align.Center
}
{ Label6 Label
MoveScaled(5,1,25,3)
Text = ("Module")
}
}
{ HBox1 HBox panType
Name = "HBox1"
MoveScaled(0,5,31,5)
Tag = "class"
Spacing = True
Margin = True
Padding = 4
{ PictureBox1 PictureBox
MoveScaled(1,1,3,3)
Picture = Picture["img/32/class.png"]
Stretch = True
Alignment = Align.Center
}
{ Label1 Label
MoveScaled(5,1,25,3)
Text = ("Class")
}
}
{ panForm HBox panType
Name = "panForm"
MoveScaled(0,10,31,5)
Tag = "form"
Spacing = True
Margin = True
Padding = 4
{ PictureBox3 PictureBox
MoveScaled(1,1,3,3)
Picture = Picture["img/32/form.png"]
Stretch = True
Alignment = Align.Center
}
{ Label2 Label
MoveScaled(5,1,25,3)
Text = ("Form")
}
}
{ panWebPage HBox panType
Name = "panWebPage"
MoveScaled(0,15,31,5)
Tag = "webpage"
Spacing = True
Margin = True
Padding = 4
{ PictureBox8 PictureBox
MoveScaled(1,1,3,3)
Picture = Picture["icon:/large/html"]
Stretch = True
Alignment = Align.Center
}
{ Label15 Label
MoveScaled(5,1,25,3)
Text = ("WebPage")
}
}
{ panWebPage2 HBox panType
Name = "panWebPage2"
MoveScaled(0,20,31,5)
Tag = "report"
Spacing = True
Margin = True
Padding = 4
{ PictureBox9 PictureBox
MoveScaled(1,1,3,3)
Picture = Picture["icon:/large/print"]
Stretch = True
Alignment = Align.Center
}
{ Label16 Label
MoveScaled(5,1,25,3)
Text = ("Report")
}
}
{ HBox5 HBox panType
Name = "HBox5"
MoveScaled(0,27,31,5)
Tag = "image"
Spacing = True
Margin = True
Padding = 4
{ PictureBox4 PictureBox
MoveScaled(1,1,3,3)
Picture = Picture["icon:/large/image"]
Stretch = True
Alignment = Align.Center
}
{ Label3 Label
MoveScaled(5,1,16,3)
Text = ("Image")
}
}
{ HBox4 HBox panType
Name = "HBox4"
MoveScaled(0,32,31,5)
Tag = "text"
Spacing = True
Margin = True
Padding = 4
{ PictureBox5 PictureBox
MoveScaled(1,1,3,3)
Picture = Picture["icon:/large/text"]
Stretch = True
Alignment = Align.Center
}
{ Label4 Label
MoveScaled(5,1,25,3)
Text = ("Text")
}
}
{ HBox7 HBox panType
Name = "HBox7"
MoveScaled(0,37,31,5)
Tag = "html"
Spacing = True
Margin = True
Padding = 4
{ PictureBox6 PictureBox
MoveScaled(1,1,3,3)
Picture = Picture["icon:/large/html"]
Stretch = True
Alignment = Align.Center
}
{ Label5 Label
MoveScaled(5,1,25,3)
Text = ("HTML file")
}
}
{ HBox2 HBox panType
Name = "HBox2"
MoveScaled(0,42,31,5)
Tag = "css"
Spacing = True
Margin = True
Padding = 4
{ PictureBox7 PictureBox
MoveScaled(1,1,3,3)
Picture = Picture["icon:/large/html"]
Stretch = True
Alignment = Align.Center
}
{ Label12 Label
MoveScaled(5,1,25,3)
Text = ("Style sheet")
}
}
{ HBox8 HBox panType
Name = "HBox8"
MoveScaled(0,47,31,5)
Tag = "js"
Spacing = True
Margin = True
Padding = 4
{ PictureBox10 PictureBox
MoveScaled(1,1,3,3)
Picture = Picture["icon:/large/script"]
Stretch = True
Alignment = Align.Center
}
{ Label17 Label
MoveScaled(5,1,25,3)
Text = ("Javascript file")
}
}
}
{ Separator2 Separator
MoveScaled(33,27,0,8)