Project properties dialog: Add a button to enable variable prefix check compilation flag.

[DEVELOPMENT ENVIRONMENT]
* NEW: Project properties dialog: Add a button to enable variable prefix check compilation flag.
* BUG: Rename some variables whose datatype prefix was incorrect.
This commit is contained in:
gambas 2021-05-07 20:03:59 +02:00
parent 3732a5b778
commit 0e7773b112
12 changed files with 587 additions and 314 deletions

File diff suppressed because it is too large Load diff

View file

@ -35,6 +35,7 @@ Environment="GB_GUI=gb.qt5\n GTK_DEBUG=interactive"
TabSize=2
Translate=1
Language=en
CheckVariablePrefix=1
Maintainer=gambas
Vendor=gambas
Address=gambas@users.sourceforge.net

View file

@ -860,7 +860,7 @@ Private Sub GetTestSuite() As String
Dim hSettings As Settings
Dim iSuite As Integer
Dim sSuite As Variant
Dim sSuite As String
Dim aTest As String[]
Dim I As Integer

View file

@ -533,17 +533,17 @@ End
Public Sub RefreshInfo(sInfo As String)
Dim xStr As String
Dim sStr As String
$sInfo = sInfo
Me.Enabled = True
$sInfo = sInfo
Me.Enabled = True
For Each xStr In $cVal
$cOldVal.Add(xStr, $cVal.Key)
Next
For Each sStr In $cVal
$cOldVal.Add(sStr, $cVal.Key)
Next
$cVal.Clear
Init(sInfo, False)
$cVal.Clear
Init(sInfo, False)
End

View file

@ -452,7 +452,7 @@ Public Sub ReadWatchSettings()
Dim iCount As Integer
Dim iInd As Integer
Dim sFlag As String
Dim sExpr As Variant
Dim sExpr As String
sFlag = "/Watches"
iInd = 0

View file

@ -26,7 +26,7 @@ Private $cFieldInfo As New Collection
Private $aCollations As String[]
Private $bMetadata As Boolean
Private $bTemplate As Variant
Private $bTemplate As Boolean
Private Const KEY_REQUEST As String = "$"
Private $bInCheckCurrent As Boolean
@ -513,7 +513,7 @@ Private Sub ReloadTable()
Dim hCIndexField As CIndexField
Dim sField As String
Dim bCreate As Boolean
Dim hResult As Result
Dim rResult As Result
Dim cDescField As Collection
Dim cDescIndex As Collection
@ -530,21 +530,21 @@ Private Sub ReloadTable()
cDescField = New Collection
cDescIndex = New Collection
Try hResult = $hConn.Find(MConnection.METADATA_TABLE_NAME, "sTableName = &1", $sTable)
If hResult And If hResult.Available Then
Try rResult = $hConn.Find(MConnection.METADATA_TABLE_NAME, "sTableName = &1", $sTable)
If rResult And If rResult.Available Then
For Each hResult
For Each rResult
Select Case hResult!iType
Select Case rResult!iType
Case MConnection.MD_TABLE
$sDescription = hResult!sValue
$sDescription = rResult!sValue
Case MConnection.MD_FIELD
cDescField[hResult!sKey] = hResult!sValue
cDescField[rResult!sKey] = rResult!sValue
Case MConnection.MD_INDEX
cDescIndex[hResult!sKey] = hResult!sValue
cDescIndex[rResult!sKey] = rResult!sValue
End Select

View file

@ -1682,12 +1682,12 @@ Private Function GetCoord(iCoord As Integer, Optional bDim As Boolean) As Float
End
Private Sub FormatScaledCoord(eCoord As Float) As String
Private Sub FormatScaledCoord(fCoord As Float) As String
If eCoord = Int(eCoord) Then
Return CStr(Int(eCoord))
If fCoord = Int(fCoord) Then
Return CStr(Int(fCoord))
Else
Return CStr(Int(eCoord)) & "." & Mid$(Format(Frac(eCoord), ".####"), 2)
Return CStr(Int(fCoord)) & "." & Mid$(Format(Frac(fCoord), ".####"), 2)
Endif
End

View file

@ -243,7 +243,7 @@ Private Sub FromString(sData As String, Optional hParent As CControl) As String
Dim iLevel As Integer
Dim sEventName As String
Dim aCoord As String[]
Dim eW, eH As Float
Dim fW, fH As Float
Dim X, Y, W, H As Integer
Dim bFirst As Boolean
Dim bPublic As Boolean
@ -528,21 +528,21 @@ Private Sub FromString(sData As String, Optional hParent As CControl) As String
Endif
If aCoord.Count = 4 Then
eW = CFloat(aCoord[2])
eH = CFloat(aCoord[3])
fW = CFloat(aCoord[2])
fH = CFloat(aCoord[3])
If $bConvert Then
If eW <= 3 Then Inc eW
If eH <= 3 Then Inc eH
If fW <= 3 Then Inc fW
If fH <= 3 Then Inc fH
Endif
If eW = 0 Then
If fW = 0 Then
W = 1
Else
W = Round(eW * DS)
W = Round(fW * DS)
Endif
If eH = 0 Then
If fH = 0 Then
H = 1
Else
H = Round(eH * DS)
H = Round(fH * DS)
Endif
Try hCtrl.MoveAndResize(X, Y, W, H)
Else
@ -4376,7 +4376,7 @@ Public Sub mnuFont_Show()
Dim I As Integer
Dim sParentFont As String
Dim hParent As Menu
Dim iCount As Variant
Dim iCount As Integer
mnuFont.Children.Clear

View file

@ -452,7 +452,7 @@ End
Static Private Sub RoundRect(x As Float, y As Float, w As Float, h As Float, Radius_X As Float[], radius_y As Float[])
Dim ARC_TO_BEZIER As Float = 0.55228475
Dim c1, c2 As Float
Dim C1, C2 As Float
Dim i As Integer
For i = 0 To 3
@ -481,33 +481,33 @@ Static Private Sub RoundRect(x As Float, y As Float, w As Float, h As Float, Rad
Paint.LineTo(x + w - radius_x[1], y)
'-->C
c1 = ARC_TO_BEZIER * radius_x[1]
c2 = ARC_TO_BEZIER * radius_y[1]
Paint.RelCurveTo(c1, 0.0, radius_x[1], c2, radius_x[1], radius_y[1])
C1 = ARC_TO_BEZIER * radius_x[1]
C2 = ARC_TO_BEZIER * radius_y[1]
Paint.RelCurveTo(C1, 0.0, radius_x[1], C2, radius_x[1], radius_y[1])
'-->D
Paint.LineTo(x + w, y + h - radius_y[2])
'-->E
c1 = ARC_TO_BEZIER * radius_x[2]
c2 = ARC_TO_BEZIER * radius_y[2]
Paint.RelCurveTo(0.0, c2, c1 - radius_x[2], radius_y[2], -radius_x[2], radius_y[2])
C1 = ARC_TO_BEZIER * radius_x[2]
C2 = ARC_TO_BEZIER * radius_y[2]
Paint.RelCurveTo(0.0, C2, C1 - radius_x[2], radius_y[2], -radius_x[2], radius_y[2])
'-->F
Paint.LineTo(x + radius_x[3], y + h)
'-->G
c1 = ARC_TO_BEZIER * radius_x[3]
c2 = ARC_TO_BEZIER * radius_y[3]
Paint.RelCurveTo(-c1, 0, -radius_x[3], -c2, -radius_x[3], -radius_y[3])
C1 = ARC_TO_BEZIER * radius_x[3]
C2 = ARC_TO_BEZIER * radius_y[3]
Paint.RelCurveTo(-C1, 0, -radius_x[3], -C2, -radius_x[3], -radius_y[3])
'-->H
Paint.LineTo(x, y + radius_y[0])
'-->A
c1 = ARC_TO_BEZIER * radius_x[0]
c2 = ARC_TO_BEZIER * radius_y[0]
Paint.relcurveto(0.0, -c2, radius_x[0] - c1, -radius_y[0], radius_x[0], -radius_y[0])
C1 = ARC_TO_BEZIER * radius_x[0]
C2 = ARC_TO_BEZIER * radius_y[0]
Paint.RelCurveTo(0.0, -C2, radius_x[0] - C1, -radius_y[0], radius_x[0], -radius_y[0])
'Paint.closepath()

View file

@ -53,6 +53,7 @@ Public ControlPublic As Boolean
Public ModulePublic As Boolean
Public ShowDeprecated As Boolean
Public Warnings As Boolean
Public CheckVariablePrefix As Boolean
Public MajorVersion As Integer
Public MinorVersion As Integer
Public ReleaseVersion As Integer
@ -2520,7 +2521,10 @@ Public Function GetCompileCommand(bAll As Boolean, bNoDebug As Boolean, bMakeExe
sExec &= "-j" & CStr(Settings["/CompilerJobs", 1]) & " "
'sExec = sExec & "-c " & Quote(CLASSES_FILE) & " " & Quote(Project.Dir) & " > " & OUTPUT_FILE & " 2>&1"
If bIDE Then
If Project.Warnings Then sExec &= "-w "
If Project.Warnings Then
sExec &= "-w "
If CheckVariablePrefix Then sExec &= "-fcheck-prefix "
Endif
sExec = sExec & Shell$(Project.Dir)
sExec = sExec & " > " & OUTPUT_FILE & " 2>&1"
Endif
@ -3396,6 +3400,7 @@ Public Sub ReadProject(Optional bConvert As Boolean)
ModulePublic = False
ShowDeprecated = False
Warnings = True
CheckVariablePrefix = False
KeepDebugInfo = True
CompressFiles = True
Localize = False
@ -3577,6 +3582,9 @@ Public Sub ReadProject(Optional bConvert As Boolean)
Case "warnings"
Warnings = CInt(sVal) <> 0
Case "checkvariableprefix"
CheckVariablePrefix = CInt(sVal) <> 0
Case "description"
Description = UnQuote(sVal)
@ -3918,6 +3926,7 @@ Public Sub WriteProject(Optional bComponentDoNotChange As Boolean, Optional bMak
If ModulePublic Then Print #hFile, "ModulePublic=1"
If ShowDeprecated Then Print #hFile, "ShowDeprecated=1"
If Not Warnings Then Print #hFile, "Warnings=0"
If CheckVariablePrefix Then Print #hFile, "CheckVariablePrefix=1"
If SourcePath Then Print #hFile, "SourcePath="; SourcePath
If Maintainer Then Print #hFile, "Maintainer="; Maintainer

View file

@ -88,6 +88,7 @@ Public Sub Form_Open()
btnModulePublic.Value = .ModulePublic
btnShowDeprecated.Value = .ShowDeprecated
btnWarning.Value = .Warnings
btnCheckPrefix.Value = .CheckVariablePrefix
txtMajor.Value = .MajorVersion
txtMinor.Value = .MinorVersion
txtRelease.Value = .ReleaseVersion
@ -234,6 +235,7 @@ Private Function DoApply() As Boolean
Endif
.Warnings = btnWarning.Value
.CheckVariablePrefix = btnCheckPrefix.Value
.MajorVersion = txtMajor.Value
.MinorVersion = txtMinor.Value
.ReleaseVersion = txtRelease.Value
@ -1475,3 +1477,9 @@ Public Sub tvwEnv_Hide()
UpdateEnv
End
Public Sub btnWarning_Click()
btnCheckPrefix.Enabled = btnWarning.Value
End

View file

@ -565,7 +565,7 @@
Text = ("Options")
Picture = Picture["icon:/large/options"]
{ Panel6 VBox
MoveScaled(1,2,86,60)
MoveScaled(1,2,86,64)
Expand = True
Spacing = True
{ Label7 Label
@ -580,6 +580,7 @@
Indent = True
{ Label1 Label
MoveScaled(0,0,46,4)
Expand = True
Text = ("Tab size")
}
{ txtTabSize SpinBox
@ -590,6 +591,7 @@
}
{ Label5 Label
MoveScaled(59,0,22,4)
AutoResize = True
Text = ("space(s)")
}
}
@ -599,6 +601,7 @@
Indent = True
{ Label2 Label
MoveScaled(0,0,46,4)
Expand = True
Text = ("Show deprecated components and controls")
}
{ btnShowDeprecated SwitchButton
@ -618,6 +621,7 @@
Indent = True
{ Label21 Label
MoveScaled(0,0,46,4)
Expand = True
Text = ("Module symbols are public by default")
}
{ btnModulePublic SwitchButton
@ -631,6 +635,7 @@
Indent = True
{ Label22 Label
MoveScaled(0,0,46,4)
Expand = True
Text = ("Form controls are public")
}
{ btnControlPublic SwitchButton
@ -644,6 +649,7 @@
Indent = True
{ Label4 Label
MoveScaled(0,0,46,4)
Expand = True
Text = ("Activate warnings")
}
{ btnWarning SwitchButton
@ -651,18 +657,34 @@
Animated = True
}
}
{ HBox2 HBox
MoveScaled(1,33,83,4)
Spacing = True
Indent = True
{ Label30 Label
MoveScaled(0,0,46,4)
Expand = True
Text = ("Check prefix of variables")
}
{ btnCheckPrefix SwitchButton
MoveScaled(47,0,8,4)
Enabled = False
Animated = True
}
}
{ Label19 Label
MoveScaled(0,33,84,3)
MoveScaled(0,40,84,3)
Font = Font["Bold"]
Alignment = Align.BottomNormal
Text = ("Translation")
}
{ HBox9 HBox
MoveScaled(1,37,83,4)
MoveScaled(1,44,83,4)
Spacing = True
Indent = True
{ Label24 Label
MoveScaled(0,0,46,4)
Expand = True
Text = ("Project is translatable")
}
{ btnTranslate SwitchButton
@ -671,32 +693,34 @@
}
}
{ HBox8 HBox
MoveScaled(1,42,83,4)
MoveScaled(1,49,83,4)
Spacing = True
Indent = True
{ Label20 Label
MoveScaled(0,0,46,4)
MoveScaled(0,0,38,4)
Expand = True
Text = ("Default language")
}
{ cmbDefaultLanguage ComboBox
MoveScaled(47,0,36,4)
MoveScaled(38,0,45,4)
Expand = True
ReadOnly = True
Sorted = True
}
}
{ Label27 Label
MoveScaled(0,47,84,3)
MoveScaled(0,54,84,3)
Font = Font["Bold"]
Alignment = Align.BottomNormal
Text = ("Version control")
}
{ HBox6 HBox
MoveScaled(1,52,83,4)
MoveScaled(1,59,83,4)
Spacing = True
Indent = True
{ Label23 Label
MoveScaled(0,0,46,4)
Expand = True
Text = ("Add branch to version number")
}
{ btnVersionAddBranch SwitchButton