[DEVELOPMENT ENVIRONMENT]
* NEW: The system colors of the color choose dialog are now dynamically filled from the Color class information. Consequently, you can add new colors by extending and adding new color constants or properties to the Color class in your project. * BUG: Prevent a possible crash in the farm client request manager. [GB.GTK] * BUG: The color properties of the Color class are now correctly read-only. * BUG: Add a forgotten source file header symbolic link. [GB.GTK3] * BUG: The color properties of the Color class are now correctly read-only. * BUG: Add a forgotten source file header symbolic link. [GB.QT4] * BUG: The color properties of the Color class are now correctly read-only. [GB.QT5] * BUG: The color properties of the Color class are now correctly read-only. git-svn-id: svn://localhost/gambas/trunk@7189 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
5ecb973af4
commit
9d6820dd88
13 changed files with 115 additions and 76 deletions
|
@ -6,17 +6,33 @@ Static Public Prefix As String
|
|||
|
||||
Static Private $sColor As String
|
||||
Static Private $bAlpha As Boolean
|
||||
Static Private $aSystem As String[] = ["Background", "Foreground", "SelectedBackground", "SelectedForeground", "LightBackground", "LightForeground", "TextBackground", "TextForeground", "ButtonBackground", "ButtonForeground", "TooltipBackground", "TooltipForeground", "LinkForeground", "VisitedForeground"]
|
||||
'Static Private $aDefaultColors As String[] = ["Background", "Foreground", "SelectedBackground", "SelectedForeground", "LightBackground", "LightForeground", "TextBackground", "TextForeground", "ButtonBackground", "ButtonForeground", "TooltipBackground", "TooltipForeground", "LinkForeground", "VisitedForeground"]
|
||||
Static Private $aColorName As String[]
|
||||
Static Private $aPict As Picture[]
|
||||
Static Private $sTitle As String
|
||||
Static Private $aPrefix As String[]
|
||||
|
||||
Private Const DEFAULT_COLOR As String = "-"
|
||||
|
||||
Static Private Sub GetColor(sName As String) As Integer
|
||||
|
||||
Dim hClass As CClassInfo
|
||||
Dim hSym As CSymbolInfo
|
||||
|
||||
hClass = CComponent.Classes["Color"]
|
||||
hSym = hClass.Symbols[sName]
|
||||
If hSym.Kind = "C" And If hSym.Type = "i" Then Return CInt(hSym.Value)
|
||||
Try Return Object.GetProperty(Classes["Color"], sName)
|
||||
Return -1
|
||||
|
||||
End
|
||||
|
||||
|
||||
|
||||
Static Public Sub FromString(sColor As String) As Integer
|
||||
|
||||
If sColor == "Default" Then Return -1
|
||||
If IsLetter(Left(sColor)) Then Return Object.GetProperty(Classes["Color"], sColor)
|
||||
If sColor == "None" Then Return -1
|
||||
If IsLetter(Left(sColor)) Then Return GetColor(sColor)
|
||||
If Left(sColor) = "#" Then Return Val("&H" & Mid$(sColor, 2))
|
||||
If Left(sColor) = "&" Then Return Val(sColor)
|
||||
|
||||
|
@ -61,16 +77,32 @@ End
|
|||
|
||||
Public Sub Form_Open()
|
||||
|
||||
Dim hClass As CClassInfo
|
||||
Dim hSym As CSymbolInfo
|
||||
Dim sColor As String
|
||||
|
||||
Settings.Read(Me)
|
||||
|
||||
$aPict = New Picture[$aSystem.Count]
|
||||
$aColorName = New String[]
|
||||
hClass = CComponent.Classes["Color"]
|
||||
|
||||
For Each hSym In hClass.Symbols
|
||||
sColor = hSym.Name
|
||||
If sColor = "Default" Then Continue
|
||||
If InStr("RC", hSym.Kind) And If hSym.Type = "i" And If Not $aColorName.Exist(sColor) Then
|
||||
$aColorName.Add(sColor)
|
||||
Endif
|
||||
Next
|
||||
|
||||
$aColorName.Sort()
|
||||
|
||||
$aPict = New Picture[$aColorName.Count]
|
||||
|
||||
gvwColor.Columns.Count = 2
|
||||
gvwColor.Padding = 3
|
||||
gvwColor.Mode = Select.Single
|
||||
gvwColor.Columns[0].W = 24
|
||||
gvwColor.Columns[0].Alignment = Align.Center
|
||||
gvwColor.Rows.Count = $aSystem.Count + 1
|
||||
gvwColor.Rows.Count = $aColorName.Count + 1
|
||||
|
||||
cmbPrefix.List = $aPrefix
|
||||
If $aPrefix Then
|
||||
|
@ -85,7 +117,7 @@ Public Sub Form_Open()
|
|||
tabColor.Index = 1
|
||||
Else
|
||||
If $sColor Then
|
||||
gvwColor.Row = $aSystem.Find($sColor) + 1
|
||||
gvwColor.Row = $aColorName.Find($sColor) + 1
|
||||
Else
|
||||
gvwColor.Row = 0
|
||||
Endif
|
||||
|
@ -128,7 +160,7 @@ Private Sub UpdateColor()
|
|||
If gvwColor.Row = 0 Then
|
||||
sColor = ""
|
||||
Else
|
||||
sColor = $aSystem[gvwColor.Row - 1]
|
||||
sColor = $aColorName[gvwColor.Row - 1]
|
||||
Endif
|
||||
Else
|
||||
sColor = CStr(dlgColor.Value)
|
||||
|
@ -140,7 +172,7 @@ Private Sub UpdateColor()
|
|||
sColor = "FFFFFF"
|
||||
Else If IsLetter(Left(sColor)) Then
|
||||
Color = sColor
|
||||
Value = Object.GetProperty(Classes["Color"], sColor)
|
||||
Value = GetColor(sColor)
|
||||
sColor = Hex$(Value, 6)
|
||||
Else
|
||||
Value = Val(sColor)
|
||||
|
@ -198,7 +230,7 @@ Public Sub gvwColor_Data(Row As Integer, Column As Integer)
|
|||
If Not hPict Then
|
||||
hImage = New Image(16, 16, 0)
|
||||
Paint.Begin(hImage)
|
||||
Paint.FillRect(1, 1, 14, 14, Object.GetProperty(Classes["Color"], $aSystem[Row - 1]))
|
||||
Paint.FillRect(1, 1, 14, 14, GetColor($aColorName[Row - 1]))
|
||||
Paint.End
|
||||
hPict = hImage.Picture
|
||||
$aPict[Row - 1] = hPict
|
||||
|
@ -207,9 +239,9 @@ Public Sub gvwColor_Data(Row As Integer, Column As Integer)
|
|||
|
||||
Case 1
|
||||
If Row = 0 Then
|
||||
.Text = "Default"
|
||||
.Text = "None"
|
||||
Else
|
||||
.Text = $aSystem[Row - 1]
|
||||
.Text = $aColorName[Row - 1]
|
||||
Endif
|
||||
|
||||
End Select
|
||||
|
|
|
@ -1,53 +1,58 @@
|
|||
# Gambas Form File 3.0
|
||||
|
||||
{ Form Form
|
||||
MoveScaled(0,2.1429,55,71)
|
||||
MoveScaled(0,2.1429,51,64)
|
||||
Text = ("Select a color")
|
||||
Persistent = True
|
||||
Arrangement = Arrange.Vertical
|
||||
Spacing = True
|
||||
Margin = True
|
||||
{ tabColor TabPanel
|
||||
MoveScaled(0,0,53,57)
|
||||
MoveScaled(0,0,49,57)
|
||||
Expand = True
|
||||
Arrangement = Arrange.Fill
|
||||
Margin = True
|
||||
Border = False
|
||||
Count = 2
|
||||
Index = 0
|
||||
Text = ("System")
|
||||
{ gvwColor GridView
|
||||
MoveScaled(2,2,43,44)
|
||||
Border = False
|
||||
Grid = False
|
||||
}
|
||||
Index = 1
|
||||
Text = ("Free")
|
||||
{ dlgColor ColorChooser
|
||||
MoveScaled(1,1,50,51)
|
||||
Expand = True
|
||||
Border = False
|
||||
ShowCustom = True
|
||||
{ Panel3 Panel
|
||||
MoveScaled(1,1,47,50)
|
||||
Arrangement = Arrange.Fill
|
||||
Margin = True
|
||||
{ dlgColor ColorChooser
|
||||
MoveScaled(1,1,45,48)
|
||||
Expand = True
|
||||
Border = False
|
||||
ShowCustom = True
|
||||
}
|
||||
}
|
||||
Index = 0
|
||||
}
|
||||
{ Panel2 Panel
|
||||
MoveScaled(1,58,53,6)
|
||||
MoveScaled(0,58,49,4)
|
||||
Arrangement = Arrange.Horizontal
|
||||
Spacing = True
|
||||
Margin = True
|
||||
{ cmbPrefix ComboBox
|
||||
MoveScaled(2,0,15,4)
|
||||
MoveScaled(0,0,15,4)
|
||||
ReadOnly = True
|
||||
}
|
||||
{ Panel1 Panel
|
||||
MoveScaled(19,0,2,4)
|
||||
MoveScaled(16,0,1,4)
|
||||
Expand = True
|
||||
}
|
||||
{ btnOK Button
|
||||
MoveScaled(22,0,15,4)
|
||||
MoveScaled(18,0,15,4)
|
||||
Text = ("OK")
|
||||
Default = True
|
||||
}
|
||||
{ btnCancel Button
|
||||
MoveScaled(38,0,15,4)
|
||||
MoveScaled(34,0,15,4)
|
||||
Text = ("Cancel")
|
||||
Cancel = True
|
||||
}
|
||||
|
|
|
@ -471,7 +471,7 @@ Private Function GetRealValue(sProp As String, vVal As Variant) As Variant
|
|||
If Not IsNull(Val(vRealVal)) Then
|
||||
vRealVal = Val(vRealVal)
|
||||
Else
|
||||
vRealVal = Object.GetProperty(Color, vRealVal)
|
||||
vRealVal = FColorChooser.FromString(vRealVal) 'Object.GetProperty(Color, vRealVal)
|
||||
Endif
|
||||
Endif
|
||||
|
||||
|
|
|
@ -627,11 +627,9 @@ End
|
|||
|
||||
Public Sub dwgName_Draw()
|
||||
|
||||
Dim sText As String
|
||||
|
||||
If Not $hSoft Then Return
|
||||
|
||||
Paint.Font.Grade = 6
|
||||
Paint.Font.Grade = 4
|
||||
$hSoft.PaintName(0, 0)
|
||||
|
||||
End
|
||||
|
|
|
@ -97,18 +97,20 @@ Public Sub Request_Finished()
|
|||
|
||||
If $bFile Then
|
||||
ResultFile = $hForm.TargetFile
|
||||
For Each sHeader In $hForm.Headers
|
||||
If sHeader Begins "Content-Disposition:" Then
|
||||
iPos = InStr(sHeader, "filename=")
|
||||
If iPos Then
|
||||
sName = File.SetName(ResultFile, UnQuote(Mid$(sHeader, iPos + 9)))
|
||||
Try Kill sName
|
||||
Move ResultFile To sName
|
||||
ResultFile = sName
|
||||
Break
|
||||
If $hForm.Headers Then
|
||||
For Each sHeader In $hForm.Headers
|
||||
If sHeader Begins "Content-Disposition:" Then
|
||||
iPos = InStr(sHeader, "filename=")
|
||||
If iPos Then
|
||||
sName = File.SetName(ResultFile, UnQuote(Mid$(sHeader, iPos + 9)))
|
||||
Try Kill sName
|
||||
Move ResultFile To sName
|
||||
ResultFile = sName
|
||||
Break
|
||||
Endif
|
||||
Endif
|
||||
Endif
|
||||
Next
|
||||
Next
|
||||
Endif
|
||||
Raise Finished
|
||||
Return
|
||||
Endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Gambas Project File 3.0
|
||||
# Compiled with Gambas 3.7.90
|
||||
Title=More controls for graphical components
|
||||
Startup=FTestFileView
|
||||
Startup=FTestColorChooser
|
||||
Version=3.7.90
|
||||
VersionFile=1
|
||||
Component=gb.image
|
||||
|
|
|
@ -148,7 +148,7 @@
|
|||
MoveScaled(32,11,1,3)
|
||||
}
|
||||
{ VBox1 VBox
|
||||
MoveScaled(34,1,14,19)
|
||||
MoveScaled(34,1,15,19)
|
||||
Spacing = True
|
||||
{ panColor DrawingArea
|
||||
MoveScaled(0,0,11,6)
|
||||
|
|
|
@ -107,8 +107,8 @@ Public Sub PaintColor(X As Integer, Y As Integer, W As Integer, H As Integer, iC
|
|||
Paint.Rectangle(X, Y, W, H)
|
||||
Paint.Clip
|
||||
|
||||
For J = 0 To W Step 8
|
||||
For I = 0 To H Step 8
|
||||
For J = 0 To W + 7 Step 8
|
||||
For I = 0 To H + 7 Step 8
|
||||
|
||||
If ((I + J) \ 8) And 1 Then
|
||||
C = Color.Blend(iColor, &H808080)
|
||||
|
|
1
gb.gtk/gb.geom.h
Symbolic link
1
gb.gtk/gb.geom.h
Symbolic link
|
@ -0,0 +1 @@
|
|||
../main/lib/draw/gb.geom.h
|
|
@ -117,21 +117,21 @@ GB_DESC CColorDesc[] =
|
|||
{
|
||||
GB_DECLARE_STATIC("Color"),
|
||||
|
||||
GB_STATIC_PROPERTY("Background", "i", Color_Background),
|
||||
GB_STATIC_PROPERTY("SelectedBackground", "i", Color_SelectedBackground),
|
||||
GB_STATIC_PROPERTY("LightBackground", "i", Color_LightBackground),
|
||||
GB_STATIC_PROPERTY("TextBackground", "i", Color_TextBackground),
|
||||
GB_STATIC_PROPERTY("ButtonBackground", "i", Color_ButtonBackground),
|
||||
GB_STATIC_PROPERTY("TooltipBackground", "i", Color_TooltipBackground),
|
||||
GB_STATIC_PROPERTY_READ("Background", "i", Color_Background),
|
||||
GB_STATIC_PROPERTY_READ("SelectedBackground", "i", Color_SelectedBackground),
|
||||
GB_STATIC_PROPERTY_READ("LightBackground", "i", Color_LightBackground),
|
||||
GB_STATIC_PROPERTY_READ("TextBackground", "i", Color_TextBackground),
|
||||
GB_STATIC_PROPERTY_READ("ButtonBackground", "i", Color_ButtonBackground),
|
||||
GB_STATIC_PROPERTY_READ("TooltipBackground", "i", Color_TooltipBackground),
|
||||
|
||||
GB_STATIC_PROPERTY("Foreground", "i", Color_Foreground),
|
||||
GB_STATIC_PROPERTY("SelectedForeground", "i", Color_SelectedForeground),
|
||||
GB_STATIC_PROPERTY("LightForeground", "i", Color_LightForeground),
|
||||
GB_STATIC_PROPERTY("TextForeground", "i", Color_TextForeground),
|
||||
GB_STATIC_PROPERTY("ButtonForeground", "i", Color_ButtonForeground),
|
||||
GB_STATIC_PROPERTY("TooltipForeground", "i", Color_TooltipForeground),
|
||||
GB_STATIC_PROPERTY("LinkForeground", "i", Color_LinkForeground),
|
||||
GB_STATIC_PROPERTY("VisitedForeground", "i", Color_VisitedForeground),
|
||||
GB_STATIC_PROPERTY_READ("Foreground", "i", Color_Foreground),
|
||||
GB_STATIC_PROPERTY_READ("SelectedForeground", "i", Color_SelectedForeground),
|
||||
GB_STATIC_PROPERTY_READ("LightForeground", "i", Color_LightForeground),
|
||||
GB_STATIC_PROPERTY_READ("TextForeground", "i", Color_TextForeground),
|
||||
GB_STATIC_PROPERTY_READ("ButtonForeground", "i", Color_ButtonForeground),
|
||||
GB_STATIC_PROPERTY_READ("TooltipForeground", "i", Color_TooltipForeground),
|
||||
GB_STATIC_PROPERTY_READ("LinkForeground", "i", Color_LinkForeground),
|
||||
GB_STATIC_PROPERTY_READ("VisitedForeground", "i", Color_VisitedForeground),
|
||||
|
||||
GB_END_DECLARE
|
||||
};
|
||||
|
|
1
gb.gtk3/gb.geom.h
Symbolic link
1
gb.gtk3/gb.geom.h
Symbolic link
|
@ -0,0 +1 @@
|
|||
../main/lib/geom/gb.geom.h
|
|
@ -1,8 +1,8 @@
|
|||
# Gambas Project File 3.0
|
||||
# Compiled with Gambas 3.6.90
|
||||
# Compiled with Gambas 3.7.90
|
||||
Title=gb.net.curl
|
||||
Startup=MMain
|
||||
Version=3.6.90
|
||||
Version=3.7.90
|
||||
VersionFile=1
|
||||
Component=gb.net
|
||||
Component=gb.net.curl
|
||||
|
|
|
@ -146,21 +146,21 @@ GB_DESC CColorDesc[] =
|
|||
{
|
||||
GB_DECLARE_STATIC("Color"),
|
||||
|
||||
GB_STATIC_PROPERTY("Background", "i", Color_Background),
|
||||
GB_STATIC_PROPERTY("SelectedBackground", "i", Color_SelectedBackground),
|
||||
GB_STATIC_PROPERTY("LightBackground", "i", Color_LightBackground),
|
||||
GB_STATIC_PROPERTY("TextBackground", "i", Color_TextBackground),
|
||||
GB_STATIC_PROPERTY("ButtonBackground", "i", Color_ButtonBackground),
|
||||
GB_STATIC_PROPERTY("TooltipBackground", "i", Color_TooltipBackground),
|
||||
GB_STATIC_PROPERTY_READ("Background", "i", Color_Background),
|
||||
GB_STATIC_PROPERTY_READ("SelectedBackground", "i", Color_SelectedBackground),
|
||||
GB_STATIC_PROPERTY_READ("LightBackground", "i", Color_LightBackground),
|
||||
GB_STATIC_PROPERTY_READ("TextBackground", "i", Color_TextBackground),
|
||||
GB_STATIC_PROPERTY_READ("ButtonBackground", "i", Color_ButtonBackground),
|
||||
GB_STATIC_PROPERTY_READ("TooltipBackground", "i", Color_TooltipBackground),
|
||||
|
||||
GB_STATIC_PROPERTY("Foreground", "i", Color_Foreground),
|
||||
GB_STATIC_PROPERTY("LightForeground", "i", Color_LightForeground),
|
||||
GB_STATIC_PROPERTY("SelectedForeground", "i", Color_SelectedForeground),
|
||||
GB_STATIC_PROPERTY("TextForeground", "i", Color_TextForeground),
|
||||
GB_STATIC_PROPERTY("ButtonForeground", "i", Color_ButtonForeground),
|
||||
GB_STATIC_PROPERTY("TooltipForeground", "i", Color_TooltipForeground),
|
||||
GB_STATIC_PROPERTY("LinkForeground", "i", Color_LinkForeground),
|
||||
GB_STATIC_PROPERTY("VisitedForeground", "i", Color_VisitedForeground),
|
||||
GB_STATIC_PROPERTY_READ("Foreground", "i", Color_Foreground),
|
||||
GB_STATIC_PROPERTY_READ("LightForeground", "i", Color_LightForeground),
|
||||
GB_STATIC_PROPERTY_READ("SelectedForeground", "i", Color_SelectedForeground),
|
||||
GB_STATIC_PROPERTY_READ("TextForeground", "i", Color_TextForeground),
|
||||
GB_STATIC_PROPERTY_READ("ButtonForeground", "i", Color_ButtonForeground),
|
||||
GB_STATIC_PROPERTY_READ("TooltipForeground", "i", Color_TooltipForeground),
|
||||
GB_STATIC_PROPERTY_READ("LinkForeground", "i", Color_LinkForeground),
|
||||
GB_STATIC_PROPERTY_READ("VisitedForeground", "i", Color_VisitedForeground),
|
||||
|
||||
GB_END_DECLARE
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue