[DEVELOPMENT ENVIRONMENT]
* NEW: The name of the database metadata table is "__gb_metadata" now. * NEW: Add a "display metadata" option in the connection properties. * NEW: The file creation dialog now can create javascript files. git-svn-id: svn://localhost/gambas/trunk@5843 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
f1ae3e8d36
commit
8106069ddb
12 changed files with 393 additions and 270 deletions
File diff suppressed because it is too large
Load diff
|
@ -28,6 +28,7 @@ Private Sub LoadConnection()
|
|||
txtPath.Text = hConfig["Connection/Path"]
|
||||
chkRememberPassword.Value = If(hConfig["Connection/RememberPassword"], 1, 0)
|
||||
chkIgnoreCharset.Value = If(hConfig["Connection/IgnoreCharset"], 1, 0)
|
||||
chkDisplayMetadata.Value = If(hConfig["Connection/DisplayMetadata"], 1, 0)
|
||||
|
||||
For iInd = 0 To cmbType.Count - 1
|
||||
If LCase(cmbType[iInd].Text) = sType Then
|
||||
|
@ -52,6 +53,7 @@ Private Sub FillConfig(hConfig As Object)
|
|||
hConfig["Connection/Path"] = txtPath.Text
|
||||
hConfig["Connection/RememberPassword"] = CBool(chkRememberPassword.Value)
|
||||
hConfig["Connection/IgnoreCharset"] = CBool(chkIgnoreCharset.Value)
|
||||
hConfig["Connection/DisplayMetadata"] = CBool(chkDisplayMetadata.Value)
|
||||
hConfig["Connection/Database"] = txtDatabase.Text
|
||||
|
||||
End
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Gambas Form File 3.0
|
||||
|
||||
{ Form Form
|
||||
MoveScaled(0,0,70,69)
|
||||
MoveScaled(0,0,70,75)
|
||||
Icon = Picture["img/16/database.png"]
|
||||
Resizable = False
|
||||
Arrangement = Arrange.Vertical
|
||||
|
@ -156,8 +156,22 @@
|
|||
Text = ("Ignore database charset")
|
||||
}
|
||||
}
|
||||
{ HBox8 HBox
|
||||
MoveScaled(1,64,68,3)
|
||||
{ Label12 Label
|
||||
MoveScaled(0,0,18,3)
|
||||
}
|
||||
{ chkDisplayMetadata CheckBox
|
||||
MoveScaled(27,0,24,3)
|
||||
Expand = True
|
||||
Text = ("Display metadata")
|
||||
}
|
||||
}
|
||||
{ Panel2 Panel
|
||||
MoveScaled(38,68,6,1)
|
||||
}
|
||||
{ HBox1 HBox
|
||||
MoveScaled(1,64,68,4)
|
||||
MoveScaled(1,70,68,4)
|
||||
Spacing = True
|
||||
{ Panel1 Panel
|
||||
MoveScaled(4,0,4,4)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
' Gambas module file
|
||||
|
||||
Public Password As New Collection
|
||||
Public Const InfoTableName As String = "_gbFieldDesc"
|
||||
Public Const METADATA_TABLE_NAME As String = "__gb_metadata"
|
||||
|
||||
Private $bError As Boolean
|
||||
|
||||
|
@ -335,13 +335,12 @@ Public Sub FillViewWithTables(lvwTable As TreeView, hConn As Connection, bShowSy
|
|||
'lvwTable.Add("$", ("SQL request"), Picture["img/16/sql.png"])
|
||||
For Each hTable In hConn.Tables
|
||||
|
||||
If hTable.System And If Not bShowSystem Then Continue
|
||||
If Not bShowSystem Then
|
||||
If hTable.System Or If hTable.Name = METADATA_TABLE_NAME Then Continue
|
||||
Endif
|
||||
|
||||
sName = hTable.Name
|
||||
|
||||
'NOTE: FABIEN: Mask the Gambas Infos table
|
||||
If sName = InfoTableName Then Continue
|
||||
|
||||
iPos = InStr(sName, ".")
|
||||
If iPos Then
|
||||
sParent = ">" & Left(sName, iPos - 1)
|
||||
|
|
|
@ -17,7 +17,7 @@ Private $cFieldName As New Collection
|
|||
Private $aIndexField As New CIndexField[]
|
||||
Private $cFieldInfo As New Collection
|
||||
|
||||
Private $bAllowDesc As Boolean = False
|
||||
Private $bMetadata As Boolean
|
||||
|
||||
Public Sub _new(sPath As String)
|
||||
|
||||
|
@ -26,7 +26,7 @@ Public Sub _new(sPath As String)
|
|||
|
||||
With tbvField
|
||||
|
||||
.Columns.Count = IIf($bAllowDesc, 6, 5)
|
||||
.Columns.Count = 5
|
||||
|
||||
With tbvField.Columns[0]
|
||||
.Text = " "
|
||||
|
@ -53,13 +53,6 @@ Public Sub _new(sPath As String)
|
|||
.Width = Desktop.Scale * 24
|
||||
End With
|
||||
|
||||
If $bAllowDesc Then
|
||||
With tbvField.Columns[5]
|
||||
.Text = ("Description")
|
||||
.Width = Desktop.Scale * 24
|
||||
End With
|
||||
Endif
|
||||
|
||||
End With
|
||||
|
||||
With tbvIndex
|
||||
|
@ -193,6 +186,18 @@ Public Sub Reload() As Boolean
|
|||
datData.Connection = $hConn
|
||||
datRequest.Connection = $hConn
|
||||
|
||||
$bMetadata = hConfig["Connection/DisplayMetadata"]
|
||||
|
||||
If $bMetadata Then
|
||||
tbvField.Columns.Count = 6
|
||||
With tbvField.Columns[5]
|
||||
.Text = ("Description")
|
||||
.Width = Desktop.Scale * 24
|
||||
End With
|
||||
Else
|
||||
tbvField.Columns.Count = 5
|
||||
Endif
|
||||
|
||||
LoadList($sTable)
|
||||
|
||||
DrawTitle
|
||||
|
@ -329,17 +334,19 @@ Private Sub ReloadTable()
|
|||
$aIndexField.Clear
|
||||
$cFieldInfo.Clear
|
||||
|
||||
If $bAllowDesc Then
|
||||
If $bMetadata Then
|
||||
'create the info table if not exist
|
||||
If Not $hConn.Tables.Exist(MConnection.InfoTableName) Then
|
||||
hTable = $hConn.Tables.Add(MConnection.InfoTableName)
|
||||
hTable.Fields.Add("field", db.String)
|
||||
hTable.Fields.Add("desc", db.String)
|
||||
If Not $hConn.Tables.Exist(MConnection.METADATA_TABLE_NAME) Then
|
||||
hTable = $hConn.Tables.Add(MConnection.METADATA_TABLE_NAME)
|
||||
hTable.Fields.Add("type", db.Integer)
|
||||
hTable.Fields.Add("key", db.String)
|
||||
hTable.Fields.Add("value", db.String)
|
||||
hTable.PrimaryKey = ["type", "key"]
|
||||
hTable.Update
|
||||
Endif
|
||||
|
||||
'Loading bdd infos
|
||||
hResult = $hConn.Find(MConnection.InfoTableName, "field like &1", $sTable &/ "%")
|
||||
hResult = $hConn.Find(MConnection.METADATA_TABLE_NAME, "field like &1", $sTable &/ "%")
|
||||
|
||||
If hResult.Available Then
|
||||
For Each hResult
|
||||
|
@ -1258,12 +1265,12 @@ Private Sub WriteTable(Optional sOldTable As String) As Boolean
|
|||
|
||||
Endif
|
||||
|
||||
If $bAllowDesc Then
|
||||
If $bMetadata Then
|
||||
'Save the field Desc
|
||||
$hConn.Delete(MConnection.InfoTableName, "field like &1", $sTable &/ "%")
|
||||
$hConn.Delete(MConnection.METADATA_TABLE_NAME, "field like &1", $sTable &/ "%")
|
||||
$hConn.Begin
|
||||
For Each s In $cFieldInfo
|
||||
rInfo = $hConn.Create(MConnection.InfoTableName)
|
||||
rInfo = $hConn.Create(MConnection.METADATA_TABLE_NAME)
|
||||
rInfo!field = $cFieldInfo.Key
|
||||
rInfo!desc = s
|
||||
rInfo.Update
|
||||
|
|
|
@ -2703,6 +2703,12 @@ Public Sub mnuFormat_Show()
|
|||
hMenu.Checked = hMenu.Tag = sFormat
|
||||
Next
|
||||
|
||||
' If sFormat = "jpeg" Or If sFormat = "png" Then
|
||||
' mnuQuality.Enabled = True
|
||||
' Else
|
||||
' mnuQuality.Enabled = False
|
||||
' Endif
|
||||
|
||||
End
|
||||
|
||||
|
||||
|
|
20
app/src/gambas3/.src/Editor/Image/FImageQuality.class
Normal file
20
app/src/gambas3/.src/Editor/Image/FImageQuality.class
Normal file
|
@ -0,0 +1,20 @@
|
|||
' Gambas class file
|
||||
|
||||
Public Sub Run() As Boolean
|
||||
|
||||
Return Not Me.ShowModal()
|
||||
|
||||
End
|
||||
|
||||
Public Sub btnOK_Click()
|
||||
|
||||
Me.Close(TRUE)
|
||||
|
||||
End
|
||||
|
||||
Public Sub btnCancel_Click()
|
||||
|
||||
Me.Close
|
||||
|
||||
End
|
||||
|
25
app/src/gambas3/.src/Editor/Image/FImageQuality.form
Normal file
25
app/src/gambas3/.src/Editor/Image/FImageQuality.form
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Gambas Form File 3.0
|
||||
|
||||
{ Form Form
|
||||
MoveScaled(0,0,55,12)
|
||||
Text = ("Image quality")
|
||||
Resizable = False
|
||||
Arrangement = Arrange.Vertical
|
||||
Spacing = True
|
||||
Margin = True
|
||||
{ sldQuality SliderBox
|
||||
MoveScaled(1,1,53,4)
|
||||
Step = 10
|
||||
Value = 80
|
||||
}
|
||||
{ btnOK Button
|
||||
MoveScaled(21,7,16,4)
|
||||
Text = ("OK")
|
||||
Default = True
|
||||
}
|
||||
{ btnCancel Button
|
||||
MoveScaled(38,7,16,4)
|
||||
Text = ("Cancel")
|
||||
Cancel = True
|
||||
}
|
||||
}
|
|
@ -400,6 +400,12 @@
|
|||
Picture = Picture["icon:/small/html"]
|
||||
Tag = "css"
|
||||
}
|
||||
{ mnuNewJS Menu mnuNewFile
|
||||
Name = "mnuNewJS"
|
||||
Text = ("&Javascript file...")
|
||||
Picture = Picture["icon:/small/script"]
|
||||
Tag = "js"
|
||||
}
|
||||
{ mnuNewFile Menu mnuNewFile
|
||||
Name = "mnuNewFile"
|
||||
Action = "new-other"
|
||||
|
|
|
@ -46,7 +46,7 @@ Public Sub lstType_Click()
|
|||
sPrefix = UCase(Left(sPrefix)) & Mid(sPrefix, 2)
|
||||
Object.Lock(txtName)
|
||||
Select Case LCase(sPrefix)
|
||||
Case "text", "image", "html", "css"
|
||||
Case "text", "image", "html", "css", "js"
|
||||
txtName.Text = Project.GetNewName(sPrefix, $sDir)
|
||||
Case Else
|
||||
txtName.Text = Project.GetNewName(sPrefix)
|
||||
|
@ -115,8 +115,8 @@ Public Sub Form_Open()
|
|||
|
||||
Else
|
||||
|
||||
$aFilterType = ["image", "html", "css", "text"]
|
||||
$aFilter = ["*.png;*.jpg;*.jpeg;*.xpm;*.gif", ("Picture files"), "*.htm;*.html", ("HTML files"), "*.css", ("Cascading style sheets")]
|
||||
$aFilterType = ["image", "html", "css", "js", "text"]
|
||||
$aFilter = ["*.png;*.jpg;*.jpeg;*.xpm;*.gif", ("Picture files"), "*.htm;*.html", ("HTML files"), "*.css", ("Cascading style sheets"), "*.js", ("Javascript files")]
|
||||
|
||||
Endif
|
||||
|
||||
|
@ -184,12 +184,12 @@ Private Sub CreateFile() As Boolean
|
|||
|
||||
Select Case sType
|
||||
|
||||
Case "text", "image", "html", "css"
|
||||
Case "text", "image", "html", "css", "js"
|
||||
|
||||
If sName And If chkExt.Value Then
|
||||
If sType = "image" Then
|
||||
sName = File.SetExt(sName, LCase(cmbImageType.Text))
|
||||
Else If sType = "html" Or sType = "css" Then
|
||||
Else If sType = "html" Or If sType = "css" Or If sType = "js" Then
|
||||
sName = File.SetExt(sName, sType)
|
||||
Endif
|
||||
Endif
|
||||
|
@ -261,19 +261,19 @@ Private Sub CreateFile() As Boolean
|
|||
" Spacing = True\n"
|
||||
" Margin = True\n"
|
||||
sTemp &= "{ HBox1 HBox\n"
|
||||
" MoveScaled(1,59,66,4)\n"
|
||||
" MoveScaled(1,59,62,4)\n"
|
||||
" Spacing = True\n"
|
||||
" { Panel1 Panel\n"
|
||||
" MoveScaled(4,0,4,4)\n"
|
||||
" Expand = True\n"
|
||||
" }\n"
|
||||
" { btnOK Button\n"
|
||||
" MoveScaled(31,0,16,4)\n"
|
||||
" MoveScaled(29,0,16,4)\n"
|
||||
" Text = (\"OK\")\n"
|
||||
" Default = True\n"
|
||||
" }\n"
|
||||
" { btnCancel Button\n"
|
||||
" MoveScaled(48,0,16,4)\n"
|
||||
" MoveScaled(46,0,16,4)\n"
|
||||
" Text = (\"Cancel\")\n"
|
||||
" Cancel = True\n"
|
||||
" }\n"
|
||||
|
@ -302,7 +302,7 @@ Private Sub CreateFile() As Boolean
|
|||
|
||||
Case "html"
|
||||
|
||||
File.Save($sDir &/ sName, "<html>\n<body>\n</body>\n</html>\n")
|
||||
File.Save($sDir &/ sName, "<html>\n\n<head>\n</head>\n\n<body>\n</body>\n\n</html>\n")
|
||||
Project.InsertFile(sName, $sDir)
|
||||
|
||||
Case "css"
|
||||
|
@ -310,10 +310,19 @@ Private Sub CreateFile() As Boolean
|
|||
File.Save($sDir &/ sName, "BODY\n{\n}\n")
|
||||
Project.InsertFile(sName, $sDir)
|
||||
|
||||
Case "js"
|
||||
|
||||
File.Save($sDir &/ sName, "// " & sName & "\n\nfunction foo()\n{\n}\n")
|
||||
Project.InsertFile(sName, $sDir)
|
||||
|
||||
Case "image"
|
||||
|
||||
hImage = New Image(txtWidth.Value, txtHeight.Value)
|
||||
hImage.Fill(Color.Transparent)
|
||||
If cmbImageType.Text = "JPEG" Then
|
||||
hImage.Fill(Color.White)
|
||||
Else
|
||||
hImage.Fill(Color.Transparent)
|
||||
Endif
|
||||
hImage.Save($sDir &/ sName)
|
||||
|
||||
Project.InsertFile(sName, $sDir)
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
Spacing = True
|
||||
Margin = True
|
||||
{ lstType ListContainer
|
||||
MoveScaled(1,1,32,52)
|
||||
MoveScaled(1,1,32,54)
|
||||
Mouse = Mouse.Pointing
|
||||
{ panModule HBox panType
|
||||
Name = "panModule"
|
||||
|
@ -185,6 +185,24 @@
|
|||
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")
|
||||
}
|
||||
}
|
||||
}
|
||||
{ panOption VBox
|
||||
MoveScaled(34,1,42,52)
|
||||
|
@ -241,7 +259,7 @@
|
|||
MoveScaled(13,10,17,4)
|
||||
#Translate = False
|
||||
ReadOnly = True
|
||||
List = ["PNG", "XPM", "GIF"]
|
||||
List = ["PNG", "JPEG", "XPM", "GIF"]
|
||||
}
|
||||
{ Label13 Label
|
||||
MoveScaled(23,0,4,4)
|
||||
|
@ -280,7 +298,7 @@
|
|||
}
|
||||
{ Panel3 Panel
|
||||
MoveScaled(0,44,41,4)
|
||||
Tag = "image,html,css"
|
||||
Tag = "image,html,css,js"
|
||||
{ chkExt CheckBox
|
||||
MoveScaled(1,0,36,4)
|
||||
Text = ("Automatic extension")
|
||||
|
|
|
@ -123,7 +123,7 @@
|
|||
Text = ("Description")
|
||||
}
|
||||
{ txtDesc TextArea
|
||||
MoveScaled(18,15,60,18)
|
||||
MoveScaled(18,15,60,17)
|
||||
Expand = True
|
||||
Wrap = True
|
||||
}
|
||||
|
@ -133,7 +133,7 @@
|
|||
Text = ("Author(s)")
|
||||
}
|
||||
{ txtAuthor TextArea
|
||||
MoveScaled(18,34,57,16)
|
||||
MoveScaled(18,33,57,17)
|
||||
Expand = True
|
||||
Wrap = True
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue