Form editor: Draw the red border of containers in a more logical way.
[DEVELOPMENT ENVIRONMENT] * NEW: Form editor: Draw the red border of containers in a more logical way.
This commit is contained in:
parent
52dbf8fdf3
commit
5b58d76864
9 changed files with 60 additions and 27 deletions
|
@ -23,7 +23,7 @@
|
|||
MoveScaled(9,1,0,13)
|
||||
}
|
||||
{ hvwHelp HelpView
|
||||
MoveScaled(16,2,25,11)
|
||||
MoveScaled(16,2,27,11)
|
||||
Expand = True
|
||||
Border = False
|
||||
}
|
||||
|
|
|
@ -478,7 +478,6 @@ Public Sub HasProperty(sProp As String) As Boolean
|
|||
|
||||
End
|
||||
|
||||
|
||||
Private Function GetRealValue(hProp As CPropertyInfo, vVal As Variant) As Variant
|
||||
|
||||
Dim vRealVal As Variant
|
||||
|
@ -620,10 +619,10 @@ Public Function SetProperty(sProp As String, vVal As Variant, Optional bDoNotApp
|
|||
|
||||
If bDoNotApply Then Goto _DO_NOT_APPLY
|
||||
|
||||
If Control Is DrawingArea Or If IsContainer() Then
|
||||
If sProp = "Enabled" Then
|
||||
Goto _DO_NOT_APPLY
|
||||
Endif
|
||||
If Control Is DrawingArea Then
|
||||
If sProp = "Enabled" Or If sProp = "Border" Then Goto _DO_NOT_APPLY
|
||||
Else If IsContainer() Then
|
||||
If sProp = "Enabled" Then Goto _DO_NOT_APPLY
|
||||
Endif
|
||||
|
||||
If Unknown Then
|
||||
|
|
|
@ -2696,7 +2696,7 @@ Public Sub Control_Draw(...)
|
|||
'Paint.FillRect(0, 0, DS * 2, DS * 2, Color.Red)
|
||||
Paint.Fill
|
||||
Endif
|
||||
|
||||
|
||||
$hFamily.DrawControl(hCCtrl)
|
||||
|
||||
Endif
|
||||
|
|
|
@ -670,25 +670,25 @@
|
|||
Name = "panRight"
|
||||
MoveScaled(8,16,1,1)
|
||||
Background = Color.TextBackground
|
||||
Mouse = Mouse.SizeE
|
||||
Mouse = Cursor.SizeE
|
||||
Border = Border.Plain
|
||||
}
|
||||
{ panDown Panel Handle
|
||||
Name = "panDown"
|
||||
MoveScaled(6,18,1,1)
|
||||
Background = Color.TextBackground
|
||||
Mouse = Mouse.SizeS
|
||||
Mouse = Cursor.SizeS
|
||||
Border = Border.Plain
|
||||
}
|
||||
{ panRightDown Panel Handle
|
||||
Name = "panRightDown"
|
||||
MoveScaled(8,18,1,1)
|
||||
Background = Color.TextBackground
|
||||
Mouse = Mouse.SizeNWSE
|
||||
Mouse = Cursor.SizeNWSE
|
||||
Border = Border.Plain
|
||||
}
|
||||
{ panBorder DrawingArea
|
||||
MoveScaled(29,13,24,24)
|
||||
MoveScaled(25,14,24,24)
|
||||
Background = Color.Background
|
||||
{ panSelectN DrawingArea panSelect
|
||||
Name = "panSelectN"
|
||||
|
|
|
@ -1303,7 +1303,7 @@
|
|||
{ dwgBranchColor DrawingArea
|
||||
MoveScaled(0,0,5,4)
|
||||
Visible = False
|
||||
Mouse = Mouse.Pointing
|
||||
Mouse = Cursor.Pointing
|
||||
Expand = True
|
||||
}
|
||||
{ btnVcChanges ToolButton
|
||||
|
@ -1446,7 +1446,7 @@
|
|||
Separator = True
|
||||
Transparent = True
|
||||
{ panImageProperty Panel
|
||||
MoveScaled(8,3,16,14)
|
||||
MoveScaled(9,2,16,14)
|
||||
Expand = True
|
||||
Arrangement = Arrange.Fill
|
||||
}
|
||||
|
|
|
@ -76,11 +76,21 @@ End
|
|||
'' Return TRUE if the control is not managed: then a default frame with the control icon and the control name will be drawn.
|
||||
Public Sub DrawControl(hCtrl As CControl) As Boolean
|
||||
|
||||
If TypeOf(hCtrl["Border"]) = gb.Boolean And If hCtrl["Border"] Then
|
||||
Paint.DrawRect(Paint.X, Paint.Y, Paint.W, Paint.H, Color.LightForeground)
|
||||
Else If hCtrl Is Container Then
|
||||
PaintContainer(Paint.X, Paint.Y, Paint.W, Paint.H)
|
||||
If hCtrl.IsContainer() Then
|
||||
PaintContainer(hCtrl)
|
||||
Else If hCtrl.HasProperty("Border") Then
|
||||
If hCtrl["Border"] Then
|
||||
Paint.DrawRect(Paint.X, Paint.Y, Paint.W, Paint.H, Color.LightForeground)
|
||||
Else
|
||||
Paint.Dash = [1]
|
||||
'Paint.DrawRect(Paint.X, Paint.Y, Paint.W, Paint.H, Color.LightForeground)
|
||||
Paint.Background = Color.LightForeground
|
||||
Paint.Rectangle(Paint.X, Paint.Y, Paint.W, Paint.H)
|
||||
Paint.Stroke
|
||||
Paint.Dash = Null
|
||||
Endif
|
||||
Endif
|
||||
|
||||
PaintIcon(hCtrl)
|
||||
|
||||
End
|
||||
|
@ -514,9 +524,25 @@ Public Sub SelectAudio((sPropertyType) As String, sAudio As String) As String
|
|||
|
||||
End
|
||||
|
||||
Static Public Sub PaintContainer(X As Float, Y As Float, W As Float, H As Float)
|
||||
Static Public Sub PaintContainer(hCCtrl As CControl, Optional X As Float = Paint.X, Y As Float = Paint.Y, W As Float = Paint.W, H As Float = Paint.H)
|
||||
|
||||
Paint.DrawRect(X, Y, W, H, Color.SetAlpha(&HFF8080, 128))
|
||||
Dim iCol As Integer
|
||||
|
||||
If W < 1 Or If H < 1 Then Return
|
||||
|
||||
If hCCtrl And If hCCtrl.HasProperty("Border") And If hCCtrl.GetPropertyReal("Border") Then
|
||||
Paint.DrawRect(X, Y, W, H, Color.LightForeground)
|
||||
If W < 3 Or If H < 3 Then Return
|
||||
Inc X
|
||||
Inc Y
|
||||
W -= 2
|
||||
H -= 2
|
||||
iCol = &HFF8080
|
||||
Else
|
||||
iCol = Color.SetAlpha(&HFF8080, 128)
|
||||
Endif
|
||||
|
||||
Paint.DrawRect(X, Y, W, H, iCol)
|
||||
|
||||
End
|
||||
|
||||
|
@ -677,12 +703,15 @@ Static Public Sub PaintIcon(hCtrl As CControl)
|
|||
|
||||
Dim DS As Integer
|
||||
Dim hPict As Picture
|
||||
Dim W As Float
|
||||
|
||||
Paint.Background = Color.TextForeground
|
||||
DS = Desktop.Scale
|
||||
hPict = Picture[".control" &/ LCase(hCtrl.Kind)]
|
||||
If hPict Then
|
||||
Paint.DrawPicture(hPict, DS, DS, DS * 4, DS * 4)
|
||||
Paint.DrawText(hCtrl.Name, DS * 6, DS, Paint.W, Paint.H, Align.TopLeft)
|
||||
W = DS * 4 * hPict.Width / hPict.Height
|
||||
Paint.DrawPicture(hPict, DS, DS, W, DS * 4)
|
||||
Paint.DrawText(hCtrl.Name, CInt(W + DS * 2), DS, Paint.W, Paint.H, Align.TopLeft)
|
||||
Else
|
||||
Paint.DrawText(hCtrl.Name, DS, DS, Paint.W, Paint.H, Align.TopLeft)
|
||||
Endif
|
||||
|
|
|
@ -71,12 +71,13 @@ Public Sub DrawControl(hCCtrl As CControl) As Boolean
|
|||
|
||||
Dim iBorder As Integer
|
||||
Dim hCtrl As Control = hCCtrl.Control
|
||||
Dim FW As Integer
|
||||
|
||||
Select LCase(hCCtrl.Kind)
|
||||
|
||||
Case "hbox", "vbox", "hpanel", "vpanel"
|
||||
|
||||
CFamily.PaintContainer(Paint.X, Paint.Y, Paint.W, Paint.H)
|
||||
CFamily.PaintContainer(hCCtrl)
|
||||
Return
|
||||
|
||||
Case "panel"
|
||||
|
@ -86,18 +87,23 @@ Public Sub DrawControl(hCCtrl As CControl) As Boolean
|
|||
Select Case hCCtrl.GetProperty("Border")
|
||||
Case "Raised"
|
||||
iBorder = Border.Raised
|
||||
FW = 2
|
||||
Case "Sunken"
|
||||
iBorder = Border.Sunken
|
||||
FW = 2
|
||||
Case "Etched"
|
||||
iBorder = Border.Etched
|
||||
FW = 2
|
||||
Case "Plain"
|
||||
iBorder = Border.Plain
|
||||
FW = 1
|
||||
Default
|
||||
CFamily.PaintContainer(Paint.X, Paint.Y, Paint.W, Paint.H)
|
||||
CFamily.PaintContainer(hCCtrl)
|
||||
Return
|
||||
End Select
|
||||
|
||||
Style.PaintPanel(0, 0, hCtrl.W, hCtrl.H, iBorder)
|
||||
CFamily.PaintContainer(Null, FW, FW, hCtrl.W - 2 * FW, hCtrl.H - 2 * FW)
|
||||
Return
|
||||
|
||||
Case "spring"
|
||||
|
@ -113,7 +119,7 @@ Public Sub DrawControl(hCCtrl As CControl) As Boolean
|
|||
Paint.Rectangle(Paint.X, Paint.Y, Paint.W, Paint.H)
|
||||
Paint.Fill
|
||||
|
||||
CFamily.PaintContainer(Paint.X, Paint.Y, Paint.W, Paint.H)
|
||||
CFamily.PaintContainer(hCCtrl)
|
||||
If hCCtrl["Separator"] Then Paint.FillRect(Paint.X, Paint.H - 1, Paint.W, 1, Color.LightForeground)
|
||||
|
||||
Return
|
||||
|
@ -127,7 +133,6 @@ Public Sub DrawControl(hCCtrl As CControl) As Boolean
|
|||
|
||||
End Select
|
||||
|
||||
|
||||
End
|
||||
|
||||
Public Sub ActionDialog(sAction As String) As Boolean
|
||||
|
|
|
@ -152,7 +152,7 @@ Public Sub DrawControl(hCCtrl As CControl) As Boolean
|
|||
|
||||
Case "WebContainer", "WebHBox", "WebVBox"
|
||||
If Not CFamily.PaintExpand(hCCtrl) Then
|
||||
CFamily.PaintContainer(0, 0, hCCtrl.W, hCCtrl.H)
|
||||
CFamily.PaintContainer(hCCtrl, 0, 0, hCCtrl.W, hCCtrl.H)
|
||||
Endif
|
||||
Return
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ End
|
|||
Public Sub Container_Draw()
|
||||
|
||||
'Paint.Background = Color.LightForeground
|
||||
CFamily.PaintContainer(0, -1, Paint.W, Paint.H + 1)
|
||||
CFamily.PaintContainer(Null, 0, -1, Paint.W, Paint.H + 1)
|
||||
'Paint.Stroke
|
||||
|
||||
End
|
||||
|
|
Loading…
Reference in a new issue