1
1
Fork 0
mirror of https://github.com/FellippeHeitor/InForm.git synced 2025-01-15 11:59:34 +00:00

UiEditor: Insert menu.

This commit is contained in:
FellippeHeitor 2016-11-27 18:26:12 -02:00
parent 62e3c47b4e
commit c1f0eb5770
2 changed files with 35 additions and 3 deletions

View file

@ -23,8 +23,9 @@ CONST OffsetNewDataFromPreview = 17
CONST OffsetTotalControlsSelected = 19 CONST OffsetTotalControlsSelected = 19
CONST OffsetFormID = 23 CONST OffsetFormID = 23
CONST OffsetFirstSelectedID = 27 CONST OffsetFirstSelectedID = 27
CONST OffsetPropertyChanged = 31 CONST OffsetMenuPanelIsON = 31
CONST OffsetPropertyValue = 33 CONST OffsetPropertyChanged = 33
CONST OffsetPropertyValue = 35
REDIM SHARED PreviewCaptions(0) AS STRING REDIM SHARED PreviewCaptions(0) AS STRING
REDIM SHARED PreviewTexts(0) AS STRING REDIM SHARED PreviewTexts(0) AS STRING
@ -125,6 +126,18 @@ SUB __UI_Click (id AS LONG)
DIM Answer AS _BYTE, Dummy AS LONG, b$, UiEditorFile AS INTEGER DIM Answer AS _BYTE, Dummy AS LONG, b$, UiEditorFile AS INTEGER
SELECT EVERYCASE UCASE$(RTRIM$(__UI_Controls(id).Name)) SELECT EVERYCASE UCASE$(RTRIM$(__UI_Controls(id).Name))
CASE "INSERTMENUMENUBAR"
UiEditorFile = FREEFILE
OPEN "UiEditor.dat" FOR BINARY AS #UiEditorFile
b$ = MKI$(__UI_Type_MenuBar)
PUT #UiEditorFile, OffsetNewControl, b$
CLOSE #UiEditorFile
CASE "INSERTMENUMENUITEM"
UiEditorFile = FREEFILE
OPEN "UiEditor.dat" FOR BINARY AS #UiEditorFile
b$ = MKI$(__UI_Type_MenuItem)
PUT #UiEditorFile, OffsetNewControl, b$
CLOSE #UiEditorFile
CASE "VIEWMENUPREVIEWDETACH" CASE "VIEWMENUPREVIEWDETACH"
PreviewAttached = NOT PreviewAttached PreviewAttached = NOT PreviewAttached
__UI_Controls(__UI_GetID("ViewMenuPreviewDetach")).Value = PreviewAttached __UI_Controls(__UI_GetID("ViewMenuPreviewDetach")).Value = PreviewAttached
@ -458,6 +471,7 @@ END SUB
SUB __UI_BeforeUpdateDisplay SUB __UI_BeforeUpdateDisplay
DIM b$, PreviewChanged AS _BYTE, SelectedProperty AS INTEGER, UiEditorFile AS INTEGER DIM b$, PreviewChanged AS _BYTE, SelectedProperty AS INTEGER, UiEditorFile AS INTEGER
DIM PreviewHasMenuActive AS INTEGER
STATIC MidRead AS _BYTE STATIC MidRead AS _BYTE
IF NOT MidRead THEN IF NOT MidRead THEN
@ -494,9 +508,17 @@ SUB __UI_BeforeUpdateDisplay
PreviewFormID = CVL(b$) PreviewFormID = CVL(b$)
b$ = SPACE$(4): GET #UiEditorFile, OffsetFirstSelectedID, b$ b$ = SPACE$(4): GET #UiEditorFile, OffsetFirstSelectedID, b$
FirstSelected = CVL(b$) FirstSelected = CVL(b$)
b$ = SPACE$(2): GET #UiEditorFile, OffsetMenuPanelIsON, b$
PreviewHasMenuActive = CVI(b$)
SelectedProperty = __UI_Controls(__UI_GetID("PropertiesList")).Value SelectedProperty = __UI_Controls(__UI_GetID("PropertiesList")).Value
IF PreviewHasMenuActive THEN
__UI_Controls(__UI_GetID("InsertMenuMenuItem")).Disabled = __UI_False
ELSE
__UI_Controls(__UI_GetID("InsertMenuMenuItem")).Disabled = __UI_True
END IF
IF TotalSelected = 0 THEN IF TotalSelected = 0 THEN
__UI_SetCaption "PropertiesFrame", "Control properties: " + RTRIM$(PreviewControls(PreviewFormID).Name) __UI_SetCaption "PropertiesFrame", "Control properties: " + RTRIM$(PreviewControls(PreviewFormID).Name)
FirstSelected = PreviewFormID FirstSelected = PreviewFormID

View file

@ -7,7 +7,7 @@ SUB __UI_LoadForm
__UI_NewID = __UI_NewControl(__UI_Type_Form, "UiEditorForm", 598, 430, 0, 0, 0) __UI_NewID = __UI_NewControl(__UI_Type_Form, "UiEditorForm", 598, 430, 0, 0, 0)
__UI_SetCaption "UiEditorForm", UiEditorTitle$ __UI_SetCaption "UiEditorForm", UiEditorTitle$
__UI_Controls(__UI_NewID).Font = __UI_Font("InForm\NotoMono-Regular.ttf", 12, "") __UI_Controls(__UI_NewID).Font = __UI_Font("segoeui.ttf", 12, "")
__UI_NewID = __UI_NewControl(__UI_Type_MenuBar, "FileMenu", 44, 18, 8, 0, 0) __UI_NewID = __UI_NewControl(__UI_Type_MenuBar, "FileMenu", 44, 18, 8, 0, 0)
__UI_SetCaption "FileMenu", "&File" __UI_SetCaption "FileMenu", "&File"
@ -15,6 +15,9 @@ SUB __UI_LoadForm
__UI_NewID = __UI_NewControl(__UI_Type_MenuBar, "ViewMenu", 44, 18, 52, 0, 0) __UI_NewID = __UI_NewControl(__UI_Type_MenuBar, "ViewMenu", 44, 18, 52, 0, 0)
__UI_SetCaption "ViewMenu", "&View" __UI_SetCaption "ViewMenu", "&View"
__UI_NewID = __UI_NewControl(__UI_Type_MenuBar, "InsertMenu", 44, 18, 52, 0, 0)
__UI_SetCaption "InsertMenu", "&Insert"
__UI_NewID = __UI_NewControl(__UI_Type_MenuBar, "HelpMenu", 44, 18, 545, 0, 0) __UI_NewID = __UI_NewControl(__UI_Type_MenuBar, "HelpMenu", 44, 18, 545, 0, 0)
__UI_SetCaption "HelpMenu", "&Help" __UI_SetCaption "HelpMenu", "&Help"
__UI_Controls(__UI_NewID).Align = __UI_Right __UI_Controls(__UI_NewID).Align = __UI_Right
@ -47,6 +50,13 @@ SUB __UI_LoadForm
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "ViewMenuLoadedFonts", 56, 18, 0, 40, __UI_GetID("ViewMenu")) __UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "ViewMenuLoadedFonts", 56, 18, 0, 40, __UI_GetID("ViewMenu"))
__UI_SetCaption "ViewMenuLoadedFonts", "&Loaded fonts" __UI_SetCaption "ViewMenuLoadedFonts", "&Loaded fonts"
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "InsertMenuMenuBar", 0, 0, 0, 0, __UI_GetID("InsertMenu"))
__UI_SetCaption "InsertMenuMenuBar", "Menu &Bar"
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "InsertMenuMenuItem", 0, 0, 0, 0, __UI_GetID("InsertMenu"))
__UI_SetCaption "InsertMenuMenuItem", "Menu &Item"
__UI_Controls(__UI_NewID).Disabled = __UI_True
__UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "HelpMenuHelp", 0, 0, 0, 0, __UI_GetID("HelpMenu")) __UI_NewID = __UI_NewControl(__UI_Type_MenuItem, "HelpMenuHelp", 0, 0, 0, 0, __UI_GetID("HelpMenu"))
__UI_SetCaption "HelpMenuHelp", "&What's all this?" __UI_SetCaption "HelpMenuHelp", "&What's all this?"