1
1
Fork 0
mirror of https://github.com/FellippeHeitor/InForm.git synced 2025-01-15 03:49:56 +00:00

Begins adapting Editor/Preview to new Menu system.

This commit is contained in:
FellippeHeitor 2018-09-12 12:17:30 -03:00
parent ca50978da5
commit 2f2e21caf7
3 changed files with 25 additions and 24 deletions

View file

@ -3553,7 +3553,7 @@ SUB __UI_EventDispatcher
IF __UI_KeyHit >= 97 THEN __UI_KeyHit = __UI_KeyHit - 32 'Turn to capitals IF __UI_KeyHit >= 97 THEN __UI_KeyHit = __UI_KeyHit - 32 'Turn to capitals
'Search for a matching hot key in menu bar items 'Search for a matching hot key in menu bar items
FOR i = 1 TO UBOUND(Control) FOR i = 1 TO UBOUND(Control)
IF Control(i).HotKey = __UI_KeyHit AND NOT Control(i).Disabled AND Control(i).Type = __UI_Type_MenuItem AND Control(i).ParentID = __UI_ParentMenu THEN IF Control(i).HotKey = __UI_KeyHit AND NOT Control(i).Disabled AND Control(i).Type = __UI_Type_MenuItem AND Control(i).ParentID = __UI_ParentMenu(__UI_TotalActiveMenus) THEN
__UI_Focus = __UI_PreviousFocus __UI_Focus = __UI_PreviousFocus
__UI_CloseAllMenus __UI_CloseAllMenus
__UI_ForceRedraw = True __UI_ForceRedraw = True

View file

@ -876,7 +876,7 @@ SUB SelectFontInList (FontSetup$)
END SUB END SUB
SUB LoseFocus SUB LoseFocus
IF __UI_ActiveMenu > 0 THEN __UI_DestroyControl Control(__UI_ActiveMenu) IF __UI_TotalActiveMenus > 0 THEN __UI_CloseAllMenus
IF __UI_ActiveDropdownList > 0 THEN __UI_DestroyControl Control(__UI_ActiveDropdownList) IF __UI_ActiveDropdownList > 0 THEN __UI_DestroyControl Control(__UI_ActiveDropdownList)
IF __UI_Focus > 0 THEN __UI_FocusOut __UI_Focus IF __UI_Focus > 0 THEN __UI_FocusOut __UI_Focus
__UI_Focus = 0 __UI_Focus = 0
@ -1221,7 +1221,7 @@ SUB __UI_BeforeUpdateDisplay
Answer = MessageBox("Icon couldn't be previewed. Make sure it's a valid icon file.", "", MsgBox_OkOnly + MsgBox_Exclamation) Answer = MessageBox("Icon couldn't be previewed. Make sure it's a valid icon file.", "", MsgBox_OkOnly + MsgBox_Exclamation)
ELSEIF CVI(b$) = -5 THEN ELSEIF CVI(b$) = -5 THEN
'Context menu was successfully shown on the preview 'Context menu was successfully shown on the preview
IF __UI_ActiveMenu > 0 THEN __UI_DestroyControl Control(__UI_ActiveMenu) IF __UI_TotalActiveMenus > 0 THEN __UI_CloseAllMenus
__UI_Focus = 0 __UI_Focus = 0
__UI_ForceRedraw = True __UI_ForceRedraw = True
ELSEIF CVI(b$) = -6 THEN ELSEIF CVI(b$) = -6 THEN

View file

@ -169,8 +169,8 @@ SUB __UI_BeforeUpdateDisplay
SendData b$, "SHOWINVISIBLECONTROLS" SendData b$, "SHOWINVISIBLECONTROLS"
END IF END IF
IF prevMenuPanelActive <> (__UI_ActiveMenu > 0 AND LEFT$(Control(__UI_ParentMenu).Name, 5) <> "__UI_") THEN IF prevMenuPanelActive <> (__UI_TotalActiveMenus > 0 AND LEFT$(Control(__UI_ParentMenu(__UI_TotalActiveMenus)).Name, 5) <> "__UI_") THEN
prevMenuPanelActive = (__UI_ActiveMenu > 0 AND LEFT$(Control(__UI_ParentMenu).Name, 5) <> "__UI_") prevMenuPanelActive = (__UI_TotalActiveMenus > 0 AND LEFT$(Control(__UI_ParentMenu(__UI_TotalActiveMenus)).Name, 5) <> "__UI_")
b$ = MKI$(prevMenuPanelActive) b$ = MKI$(prevMenuPanelActive)
SendData b$, "MENUPANELACTIVE" SendData b$, "MENUPANELACTIVE"
END IF END IF
@ -268,10 +268,10 @@ SUB __UI_BeforeUpdateDisplay
IF tempType = __UI_Type_MenuBar THEN IF tempType = __UI_Type_MenuBar THEN
TempValue = AddNewMenuBarControl TempValue = AddNewMenuBarControl
ELSEIF tempType = __UI_Type_MenuItem THEN ELSEIF tempType = __UI_Type_MenuItem THEN
IF __UI_ActiveMenu > 0 AND LEFT$(Control(__UI_ParentMenu).Name, 5) <> "__UI_" THEN IF __UI_TotalActiveMenus > 0 AND LEFT$(Control(__UI_ParentMenu(__UI_TotalActiveMenus)).Name, 5) <> "__UI_" THEN
TempValue = __UI_NewControl(tempType, "", 0, 0, 0, 0, __UI_ParentMenu) TempValue = __UI_NewControl(tempType, "", 0, 0, 0, 0, __UI_ParentMenu(__UI_TotalActiveMenus))
SetCaption TempValue, RTRIM$(Control(TempValue).Name) SetCaption TempValue, RTRIM$(Control(TempValue).Name)
__UI_ActivateMenu Control(__UI_ParentMenu), False __UI_ActivateMenu Control(__UI_ParentMenu(__UI_TotalActiveMenus)), False
END IF END IF
ELSE ELSE
TempValue = __UI_NewControl(TempValue, "", defW, defH, TempWidth \ 2 - defW \ 2, TempTop - defH \ 2, ThisContainer) TempValue = __UI_NewControl(TempValue, "", defW, defH, TempWidth \ 2 - defW \ 2, TempTop - defH \ 2, ThisContainer)
@ -287,8 +287,8 @@ SUB __UI_BeforeUpdateDisplay
__UI_ActivateMenu Control(TempValue), False __UI_ActivateMenu Control(TempValue), False
END SELECT END SELECT
IF __UI_ActiveMenu > 0 AND (Control(TempValue).Type <> __UI_Type_ContextMenu AND Control(TempValue).Type <> __UI_Type_MenuBar AND Control(TempValue).Type <> __UI_Type_MenuItem) THEN IF __UI_TotalActiveMenus > 0 AND (Control(TempValue).Type <> __UI_Type_ContextMenu AND Control(TempValue).Type <> __UI_Type_MenuBar AND Control(TempValue).Type <> __UI_Type_MenuItem) THEN
__UI_DestroyControl Control(__UI_ActiveMenu) __UI_CloseAllMenus
END IF END IF
SelectNewControl TempValue SelectNewControl TempValue
END IF END IF
@ -499,8 +499,8 @@ SUB __UI_BeforeUpdateDisplay
__UI_RestoreImageOriginalSize __UI_RestoreImageOriginalSize
ELSEIF TempValue = -8 THEN ELSEIF TempValue = -8 THEN
'Editor is manipulated, preview menus must be closed. 'Editor is manipulated, preview menus must be closed.
IF __UI_ActiveMenu > 0 AND LEFT$(Control(__UI_ParentMenu).Name, 5) = "__UI_" THEN IF __UI_TotalActiveMenus > 0 AND LEFT$(Control(__UI_ParentMenu(__UI_TotalActiveMenus)).Name, 5) = "__UI_" THEN
__UI_DestroyControl Control(__UI_ActiveMenu) __UI_CloseAllMenus
END IF END IF
ELSEIF TempValue = 214 THEN ELSEIF TempValue = 214 THEN
RestoreUndoImage RestoreUndoImage
@ -984,7 +984,7 @@ SUB __UI_BeforeUpdateDisplay
IF Control(i).ControlIsSelected THEN IF Control(i).ControlIsSelected THEN
ChangeHidden: ChangeHidden:
Control(i).Hidden = CVI(b$) Control(i).Hidden = CVI(b$)
IF Control(i).Type = __UI_Type_MenuItem AND __UI_ParentMenu = Control(i).ParentID THEN IF Control(i).Type = __UI_Type_MenuItem AND __UI_ParentMenu(__UI_TotalActiveMenus) = Control(i).ParentID THEN
__UI_ActivateMenu Control(Control(i).ParentID), False __UI_ActivateMenu Control(Control(i).ParentID), False
END IF END IF
IF LockedControlsGOSUB THEN RETURN IF LockedControlsGOSUB THEN RETURN
@ -1011,7 +1011,7 @@ SUB __UI_BeforeUpdateDisplay
Control(i).Align = CVI(b$) Control(i).Align = CVI(b$)
IF Control(i).Type = __UI_Type_MenuBar THEN IF Control(i).Type = __UI_Type_MenuBar THEN
IF Control(i).Align <> __UI_Left THEN Control(i).Align = __UI_Right IF Control(i).Align <> __UI_Left THEN Control(i).Align = __UI_Right
IF __UI_ActiveMenu > 0 THEN __UI_DestroyControl Control(__UI_ActiveMenu) IF __UI_TotalActiveMenus > 0 THEN __UI_CloseAllMenus
__UI_RefreshMenuBar __UI_RefreshMenuBar
END IF END IF
IF LockedControlsGOSUB THEN RETURN IF LockedControlsGOSUB THEN RETURN
@ -1348,11 +1348,11 @@ SUB __UI_BeforeUpdateDisplay
Control(i).ParentID = __UI_GetID(Control(i).ParentName) Control(i).ParentID = __UI_GetID(Control(i).ParentName)
NEXT NEXT
IF __UI_ActiveMenu > 0 AND LEFT$(Control(__UI_ParentMenu).Name, 5) <> "__UI_" THEN IF __UI_TotalActiveMenus > 0 AND LEFT$(Control(__UI_ParentMenu(__UI_TotalActiveMenus)).Name, 5) <> "__UI_" THEN
IF Control(CVL(a$)).Type = __UI_Type_MenuItem OR Control(CVL(b$)).Type = __UI_Type_MenuItem THEN IF Control(CVL(a$)).Type = __UI_Type_MenuItem OR Control(CVL(b$)).Type = __UI_Type_MenuItem THEN
__UI_ActivateMenu Control(__UI_ParentMenu), False __UI_ActivateMenu Control(__UI_ParentMenu(__UI_TotalActiveMenus)), False
ELSE ELSE
__UI_DestroyControl Control(__UI_ActiveMenu) __UI_CloseAllMenus
END IF END IF
END IF END IF
CASE 213 CASE 213
@ -1376,9 +1376,10 @@ SUB __UI_BeforeUpdateDisplay
Control(TempValue).Min = -32768 Control(TempValue).Min = -32768
Control(TempValue).Max = 32767 Control(TempValue).Max = 32767
IF __UI_ActiveMenu > 0 THEN IF __UI_TotalActiveMenus > 0 THEN
__UI_DestroyControl Control(__UI_ActiveMenu) __UI_CloseAllMenus
END IF END IF
FOR i = 1 TO UBOUND(Control) FOR i = 1 TO UBOUND(Control)
Control(i).ControlIsSelected = False Control(i).ControlIsSelected = False
NEXT NEXT
@ -1396,11 +1397,11 @@ SUB __UI_BeforeUpdateDisplay
LOOP LOOP
IF PropertyApplied THEN TotalLockedControls = 0 IF PropertyApplied THEN TotalLockedControls = 0
IF __UI_ActiveMenu > 0 AND LEFT$(Control(__UI_ParentMenu).Name, 5) = "__UI_" AND __UI_CantShowContextMenu THEN IF __UI_TotalActiveMenus > 0 AND LEFT$(Control(__UI_ParentMenu(__UI_TotalActiveMenus)).Name, 5) = "__UI_" AND __UI_CantShowContextMenu THEN
__UI_DestroyControl Control(__UI_ActiveMenu) __UI_CloseAllMenus
b$ = "SIGNAL>" + MKI$(-2) + "<END>" 'Signal to the editor that the preview can't show the context menu b$ = "SIGNAL>" + MKI$(-2) + "<END>" 'Signal to the editor that the preview can't show the context menu
PUT #Host, , b$ PUT #Host, , b$
ELSEIF __UI_ActiveMenu > 0 AND LEFT$(Control(__UI_ParentMenu).Name, 5) = "__UI_" THEN ELSEIF __UI_TotalActiveMenus > 0 AND LEFT$(Control(__UI_ParentMenu(__UI_TotalActiveMenus)).Name, 5) = "__UI_" THEN
STATIC LocalMenuShown AS _BYTE, LocalMenuShownSignalSent AS _BYTE STATIC LocalMenuShown AS _BYTE, LocalMenuShownSignalSent AS _BYTE
LocalMenuShown = True LocalMenuShown = True
ELSE ELSE
@ -1965,8 +1966,8 @@ SUB DeleteSelectedControls
END IF END IF
NEXT NEXT
END IF END IF
IF __UI_ActiveMenu > 0 AND __UI_ParentMenu = Control(i).ID THEN IF __UI_TotalActiveMenus > 0 AND __UI_ParentMenu(__UI_TotalActiveMenus) = Control(i).ID THEN
__UI_DestroyControl Control(__UI_ActiveMenu) __UI_CloseAllMenus
END IF END IF
__UI_DestroyControl Control(i) __UI_DestroyControl Control(i)
IF MustRefreshMenuBar THEN __UI_RefreshMenuBar IF MustRefreshMenuBar THEN __UI_RefreshMenuBar