From 9d6820dd884570efb00bb0b20eca456185b08360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Wed, 29 Jul 2015 12:59:14 +0000 Subject: [PATCH] [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 --- .../gambas3/.src/Dialog/FColorChooser.class | 56 +++++++++++++++---- .../gambas3/.src/Dialog/FColorChooser.form | 35 +++++++----- .../gambas3/.src/Editor/Form/CControl.class | 2 +- .../.src/Project/Farm/FSoftwareFarm.class | 4 +- .../.src/Project/Farm/FarmRequest.class | 24 ++++---- comp/src/gb.form/.project | 2 +- .../src/gb.form/.src/Color/FColorChooser.form | 2 +- comp/src/gb.form/.src/Main.module | 4 +- gb.gtk/gb.geom.h | 1 + gb.gtk/src/CColor.cpp | 28 +++++----- gb.gtk3/gb.geom.h | 1 + gb.net.curl/src/gb.net.curl/.project | 4 +- gb.qt4/src/CColor.cpp | 28 +++++----- 13 files changed, 115 insertions(+), 76 deletions(-) create mode 120000 gb.gtk/gb.geom.h create mode 120000 gb.gtk3/gb.geom.h diff --git a/app/src/gambas3/.src/Dialog/FColorChooser.class b/app/src/gambas3/.src/Dialog/FColorChooser.class index d594f3417..318c269a6 100644 --- a/app/src/gambas3/.src/Dialog/FColorChooser.class +++ b/app/src/gambas3/.src/Dialog/FColorChooser.class @@ -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 diff --git a/app/src/gambas3/.src/Dialog/FColorChooser.form b/app/src/gambas3/.src/Dialog/FColorChooser.form index 8b3426562..2aa316ebf 100644 --- a/app/src/gambas3/.src/Dialog/FColorChooser.form +++ b/app/src/gambas3/.src/Dialog/FColorChooser.form @@ -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 } diff --git a/app/src/gambas3/.src/Editor/Form/CControl.class b/app/src/gambas3/.src/Editor/Form/CControl.class index 2d34abc7d..31d9deea6 100644 --- a/app/src/gambas3/.src/Editor/Form/CControl.class +++ b/app/src/gambas3/.src/Editor/Form/CControl.class @@ -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 diff --git a/app/src/gambas3/.src/Project/Farm/FSoftwareFarm.class b/app/src/gambas3/.src/Project/Farm/FSoftwareFarm.class index c0d326c4a..79bb7494d 100644 --- a/app/src/gambas3/.src/Project/Farm/FSoftwareFarm.class +++ b/app/src/gambas3/.src/Project/Farm/FSoftwareFarm.class @@ -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 diff --git a/app/src/gambas3/.src/Project/Farm/FarmRequest.class b/app/src/gambas3/.src/Project/Farm/FarmRequest.class index ee995dfd7..cfa34efe3 100644 --- a/app/src/gambas3/.src/Project/Farm/FarmRequest.class +++ b/app/src/gambas3/.src/Project/Farm/FarmRequest.class @@ -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 diff --git a/comp/src/gb.form/.project b/comp/src/gb.form/.project index 9cc8a8186..958cf523e 100644 --- a/comp/src/gb.form/.project +++ b/comp/src/gb.form/.project @@ -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 diff --git a/comp/src/gb.form/.src/Color/FColorChooser.form b/comp/src/gb.form/.src/Color/FColorChooser.form index 02b91bb25..bdd59d102 100644 --- a/comp/src/gb.form/.src/Color/FColorChooser.form +++ b/comp/src/gb.form/.src/Color/FColorChooser.form @@ -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) diff --git a/comp/src/gb.form/.src/Main.module b/comp/src/gb.form/.src/Main.module index 3f967db0f..136c674d0 100644 --- a/comp/src/gb.form/.src/Main.module +++ b/comp/src/gb.form/.src/Main.module @@ -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) diff --git a/gb.gtk/gb.geom.h b/gb.gtk/gb.geom.h new file mode 120000 index 000000000..be9b8748f --- /dev/null +++ b/gb.gtk/gb.geom.h @@ -0,0 +1 @@ +../main/lib/draw/gb.geom.h \ No newline at end of file diff --git a/gb.gtk/src/CColor.cpp b/gb.gtk/src/CColor.cpp index cdd705bc6..46874a03e 100644 --- a/gb.gtk/src/CColor.cpp +++ b/gb.gtk/src/CColor.cpp @@ -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 }; diff --git a/gb.gtk3/gb.geom.h b/gb.gtk3/gb.geom.h new file mode 120000 index 000000000..abc5659ee --- /dev/null +++ b/gb.gtk3/gb.geom.h @@ -0,0 +1 @@ +../main/lib/geom/gb.geom.h \ No newline at end of file diff --git a/gb.net.curl/src/gb.net.curl/.project b/gb.net.curl/src/gb.net.curl/.project index d60bc4305..aec3c005c 100644 --- a/gb.net.curl/src/gb.net.curl/.project +++ b/gb.net.curl/src/gb.net.curl/.project @@ -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 diff --git a/gb.qt4/src/CColor.cpp b/gb.qt4/src/CColor.cpp index c0ea200f7..58c7d0d38 100644 --- a/gb.qt4/src/CColor.cpp +++ b/gb.qt4/src/CColor.cpp @@ -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 };