mirror of
https://github.com/FellippeHeitor/InForm.git
synced 2025-01-15 03:49:56 +00:00
Fixes conversion from MenuBar to ContextMenu and vice versa.
This commit is contained in:
parent
ec2184f2c5
commit
ddd062df54
2 changed files with 64 additions and 45 deletions
|
@ -285,6 +285,8 @@ __UI_Type(__UI_Type_TrackBar).RestrictResize = __UI_CantResizeV
|
||||||
__UI_Type(__UI_Type_ContextMenu).Name = "ContextMenu"
|
__UI_Type(__UI_Type_ContextMenu).Name = "ContextMenu"
|
||||||
__UI_Type(__UI_Type_ContextMenu).TurnsInto = __UI_Type_MenuBar
|
__UI_Type(__UI_Type_ContextMenu).TurnsInto = __UI_Type_MenuBar
|
||||||
__UI_Type(__UI_Type_ContextMenu).RestrictResize = __UI_CantResize
|
__UI_Type(__UI_Type_ContextMenu).RestrictResize = __UI_CantResize
|
||||||
|
__UI_Type(__UI_Type_ContextMenu).DefaultWidth = 22
|
||||||
|
__UI_Type(__UI_Type_ContextMenu).DefaultHeight = 22
|
||||||
|
|
||||||
__UI_Type(__UI_Type_Font).Name = "Font"
|
__UI_Type(__UI_Type_Font).Name = "Font"
|
||||||
|
|
||||||
|
@ -4480,6 +4482,43 @@ FUNCTION SetFont& (__NewFontFile AS STRING, NewFontSize AS INTEGER)
|
||||||
END IF
|
END IF
|
||||||
END FUNCTION
|
END FUNCTION
|
||||||
|
|
||||||
|
'---------------------------------------------------------------------------------
|
||||||
|
SUB __UI_AdjustNewMenuBarTopHeight (NextSlot AS LONG)
|
||||||
|
DIM TempCanvas AS LONG, PrevDest AS LONG
|
||||||
|
|
||||||
|
IF _PIXELSIZE = 0 THEN
|
||||||
|
'Temporarily create a 32bit screen for proper font handling, in case
|
||||||
|
'we're still at form setup (SCREEN 0)
|
||||||
|
TempCanvas = _NEWIMAGE(10, 10, 32)
|
||||||
|
PrevDest = _DEST
|
||||||
|
_DEST TempCanvas
|
||||||
|
END IF
|
||||||
|
|
||||||
|
IF Control(__UI_FormID).Font THEN _FONT Control(__UI_FormID).Font
|
||||||
|
Control(NextSlot).Height = falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 5
|
||||||
|
Control(NextSlot).Top = 0
|
||||||
|
|
||||||
|
IF TempCanvas <> 0 THEN
|
||||||
|
_DEST PrevDest
|
||||||
|
_FREEIMAGE TempCanvas
|
||||||
|
END IF
|
||||||
|
|
||||||
|
IF __UI_HasMenuBar = False THEN
|
||||||
|
__UI_HasMenuBar = True
|
||||||
|
'Add menubar div to main form's canvas
|
||||||
|
IF Control(__UI_FormID).Canvas <> 0 THEN _FREEIMAGE Control(__UI_FormID).Canvas
|
||||||
|
Control(__UI_FormID).Canvas = _NEWIMAGE(Control(__UI_FormID).Width, Control(__UI_FormID).Height, 32)
|
||||||
|
_DEST Control(__UI_FormID).Canvas
|
||||||
|
COLOR Control(__UI_FormID).ForeColor, Control(__UI_FormID).BackColor
|
||||||
|
CLS
|
||||||
|
IF Control(__UI_FormID).Font THEN _FONT Control(__UI_FormID).Font
|
||||||
|
__UI_MenuBarOffsetV = falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 5 + 2
|
||||||
|
LINE (0, falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 5 + 1)-STEP(Control(__UI_FormID).Width - 1, 0), Darken(Control(__UI_FormID).BackColor, 80)
|
||||||
|
LINE (0, falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 5 + 2)-STEP(Control(__UI_FormID).Width - 1, 0), Darken(Control(__UI_FormID).BackColor, 120)
|
||||||
|
_DEST 0
|
||||||
|
END IF
|
||||||
|
END SUB
|
||||||
|
|
||||||
'---------------------------------------------------------------------------------
|
'---------------------------------------------------------------------------------
|
||||||
FUNCTION __UI_NewControl (ControlType AS INTEGER, ControlName AS STRING, NewWidth AS INTEGER, NewHeight AS INTEGER, NewLeft AS INTEGER, NewTop AS INTEGER, ParentID AS LONG)
|
FUNCTION __UI_NewControl (ControlType AS INTEGER, ControlName AS STRING, NewWidth AS INTEGER, NewHeight AS INTEGER, NewLeft AS INTEGER, NewTop AS INTEGER, ParentID AS LONG)
|
||||||
DIM NextSlot AS LONG, i AS LONG, Temp$, PrevDest AS LONG, TempCanvas AS LONG
|
DIM NextSlot AS LONG, i AS LONG, Temp$, PrevDest AS LONG, TempCanvas AS LONG
|
||||||
|
@ -4570,36 +4609,7 @@ FUNCTION __UI_NewControl (ControlType AS INTEGER, ControlName AS STRING, NewWidt
|
||||||
Control(NextSlot).BorderColor = __UI_DefaultColor(ControlType, 5)
|
Control(NextSlot).BorderColor = __UI_DefaultColor(ControlType, 5)
|
||||||
|
|
||||||
IF ControlType = __UI_Type_MenuBar THEN
|
IF ControlType = __UI_Type_MenuBar THEN
|
||||||
IF _PIXELSIZE = 0 THEN
|
__UI_AdjustNewMenuBarTopHeight NextSlot
|
||||||
'Temporarily create a 32bit screen for proper font handling, in case
|
|
||||||
'we're still at form setup (SCREEN 0)
|
|
||||||
TempCanvas = _NEWIMAGE(10, 10, 32)
|
|
||||||
PrevDest = _DEST
|
|
||||||
_DEST TempCanvas
|
|
||||||
END IF
|
|
||||||
|
|
||||||
IF Control(__UI_FormID).Font THEN _FONT Control(__UI_FormID).Font
|
|
||||||
Control(NextSlot).Height = falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 5
|
|
||||||
|
|
||||||
IF TempCanvas <> 0 THEN
|
|
||||||
_DEST PrevDest
|
|
||||||
_FREEIMAGE TempCanvas
|
|
||||||
END IF
|
|
||||||
|
|
||||||
IF __UI_HasMenuBar = False THEN
|
|
||||||
__UI_HasMenuBar = True
|
|
||||||
'Add menubar div to main form's canvas
|
|
||||||
IF Control(__UI_FormID).Canvas <> 0 THEN _FREEIMAGE Control(__UI_FormID).Canvas
|
|
||||||
Control(__UI_FormID).Canvas = _NEWIMAGE(Control(__UI_FormID).Width, Control(__UI_FormID).Height, 32)
|
|
||||||
_DEST Control(__UI_FormID).Canvas
|
|
||||||
COLOR Control(__UI_FormID).ForeColor, Control(__UI_FormID).BackColor
|
|
||||||
CLS
|
|
||||||
IF Control(__UI_FormID).Font THEN _FONT Control(__UI_FormID).Font
|
|
||||||
__UI_MenuBarOffsetV = falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 5 + 2
|
|
||||||
LINE (0, falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 5 + 1)-STEP(Control(__UI_FormID).Width - 1, 0), Darken(Control(__UI_FormID).BackColor, 80)
|
|
||||||
LINE (0, falcon_uspacing& + (((_FONT = 8) * -1) * __UI_Font8Offset + ((_FONT = 16) * -1) * __UI_Font16Offset) + 5 + 2)-STEP(Control(__UI_FormID).Width - 1, 0), Darken(Control(__UI_FormID).BackColor, 120)
|
|
||||||
_DEST 0
|
|
||||||
END IF
|
|
||||||
END IF
|
END IF
|
||||||
|
|
||||||
IF ControlType = __UI_Type_ToggleSwitch OR ControlType = __UI_Type_TrackBar OR ControlType = __UI_Type_TextBox OR ControlType = __UI_Type_Button OR ControlType = __UI_Type_CheckBox OR ControlType = __UI_Type_RadioButton OR ControlType = __UI_Type_ListBox OR ControlType = __UI_Type_DropdownList THEN
|
IF ControlType = __UI_Type_ToggleSwitch OR ControlType = __UI_Type_TrackBar OR ControlType = __UI_Type_TextBox OR ControlType = __UI_Type_Button OR ControlType = __UI_Type_CheckBox OR ControlType = __UI_Type_RadioButton OR ControlType = __UI_Type_ListBox OR ControlType = __UI_Type_DropdownList THEN
|
||||||
|
|
|
@ -283,8 +283,6 @@ SUB __UI_BeforeUpdateDisplay
|
||||||
SetCaption TempValue, "\#"
|
SetCaption TempValue, "\#"
|
||||||
CASE __UI_Type_ContextMenu
|
CASE __UI_Type_ContextMenu
|
||||||
Control(TempValue).HelperCanvas = _COPYIMAGE(ContextMenuIcon, 32)
|
Control(TempValue).HelperCanvas = _COPYIMAGE(ContextMenuIcon, 32)
|
||||||
Control(TempValue).Width = 22
|
|
||||||
Control(TempValue).Height = 22
|
|
||||||
RefreshContextMenus
|
RefreshContextMenus
|
||||||
__UI_ActivateMenu Control(TempValue), False
|
__UI_ActivateMenu Control(TempValue), False
|
||||||
END SELECT
|
END SELECT
|
||||||
|
@ -1860,9 +1858,23 @@ SUB ConvertControlToAlternativeType
|
||||||
DIM NewType AS INTEGER
|
DIM NewType AS INTEGER
|
||||||
|
|
||||||
NewType = __UI_Type(Control(__UI_FirstSelectedID).Type).TurnsInto
|
NewType = __UI_Type(Control(__UI_FirstSelectedID).Type).TurnsInto
|
||||||
IF NewType = 0 AND Control(__UI_FirstSelectedID).Type = __UI_Type_TextBox THEN
|
IF NewType = 0 THEN NewType = __UI_Type_TextBox
|
||||||
|
|
||||||
FOR i = 1 TO UBOUND(Control)
|
FOR i = 1 TO UBOUND(Control)
|
||||||
IF Control(i).ControlIsSelected THEN
|
IF Control(i).ControlIsSelected THEN
|
||||||
|
|
||||||
|
Control(i).Type = NewType
|
||||||
|
Control(i).Width = __UI_Type(NewType).DefaultWidth
|
||||||
|
Control(i).Height = __UI_Type(NewType).DefaultHeight
|
||||||
|
|
||||||
|
IF NewType = __UI_Type_MenuBar THEN
|
||||||
|
Caption(i) = RTRIM$(Control(i).Name)
|
||||||
|
__UI_AdjustNewMenuBarTopHeight i
|
||||||
|
ELSEIF NewType = __UI_Type_ContextMenu THEN
|
||||||
|
IF Control(i).HelperCanvas = 0 THEN
|
||||||
|
Control(i).HelperCanvas = _COPYIMAGE(ContextMenuIcon, 32)
|
||||||
|
END IF
|
||||||
|
ELSEIF NewType = __UI_Type_TextBox THEN
|
||||||
IF Control(i).NumericOnly = False THEN
|
IF Control(i).NumericOnly = False THEN
|
||||||
Control(i).NumericOnly = __UI_NumericWithBounds
|
Control(i).NumericOnly = __UI_NumericWithBounds
|
||||||
IF Control(i).Min = 0 AND Control(i).Max = 0 THEN
|
IF Control(i).Min = 0 AND Control(i).Max = 0 THEN
|
||||||
|
@ -1877,18 +1889,15 @@ SUB ConvertControlToAlternativeType
|
||||||
END IF
|
END IF
|
||||||
END IF
|
END IF
|
||||||
END IF
|
END IF
|
||||||
NEXT
|
|
||||||
__UI_ForceRedraw = True
|
|
||||||
EXIT SUB
|
|
||||||
END IF
|
END IF
|
||||||
|
NEXT
|
||||||
|
|
||||||
FOR i = 1 TO UBOUND(Control)
|
IF NewType = __UI_Type_MenuBar OR NewType = __UI_Type_ContextMenu THEN
|
||||||
IF Control(i).ControlIsSelected THEN
|
__UI_RefreshMenuBar
|
||||||
Control(i).Type = NewType
|
__UI_HasMenuBar = (__UI_FirstMenuBarControl > 0)
|
||||||
Control(i).Width = __UI_Type(NewType).DefaultWidth
|
RefreshContextMenus
|
||||||
Control(i).Height = __UI_Type(NewType).DefaultHeight
|
__UI_ActivateMenu Control(__UI_FirstSelectedID), False
|
||||||
END IF
|
END IF
|
||||||
NEXT
|
|
||||||
|
|
||||||
__UI_ForceRedraw = True
|
__UI_ForceRedraw = True
|
||||||
END SUB
|
END SUB
|
||||||
|
|
Loading…
Reference in a new issue