From c1f0eb57706037ea01eea094e76a964a01f25b8e Mon Sep 17 00:00:00 2001 From: FellippeHeitor Date: Sun, 27 Nov 2016 18:26:12 -0200 Subject: [PATCH] UiEditor: Insert menu. --- UiEditor.bas | 26 ++++++++++++++++++++++++-- UiEditor.frm | 12 +++++++++++- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/UiEditor.bas b/UiEditor.bas index 724c268..2bd902d 100644 --- a/UiEditor.bas +++ b/UiEditor.bas @@ -23,8 +23,9 @@ CONST OffsetNewDataFromPreview = 17 CONST OffsetTotalControlsSelected = 19 CONST OffsetFormID = 23 CONST OffsetFirstSelectedID = 27 -CONST OffsetPropertyChanged = 31 -CONST OffsetPropertyValue = 33 +CONST OffsetMenuPanelIsON = 31 +CONST OffsetPropertyChanged = 33 +CONST OffsetPropertyValue = 35 REDIM SHARED PreviewCaptions(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 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" PreviewAttached = NOT PreviewAttached __UI_Controls(__UI_GetID("ViewMenuPreviewDetach")).Value = PreviewAttached @@ -458,6 +471,7 @@ END SUB SUB __UI_BeforeUpdateDisplay DIM b$, PreviewChanged AS _BYTE, SelectedProperty AS INTEGER, UiEditorFile AS INTEGER + DIM PreviewHasMenuActive AS INTEGER STATIC MidRead AS _BYTE IF NOT MidRead THEN @@ -494,9 +508,17 @@ SUB __UI_BeforeUpdateDisplay PreviewFormID = CVL(b$) b$ = SPACE$(4): GET #UiEditorFile, OffsetFirstSelectedID, b$ FirstSelected = CVL(b$) + b$ = SPACE$(2): GET #UiEditorFile, OffsetMenuPanelIsON, b$ + PreviewHasMenuActive = CVI(b$) 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 __UI_SetCaption "PropertiesFrame", "Control properties: " + RTRIM$(PreviewControls(PreviewFormID).Name) FirstSelected = PreviewFormID diff --git a/UiEditor.frm b/UiEditor.frm index 1b01b4f..d59cd8f 100644 --- a/UiEditor.frm +++ b/UiEditor.frm @@ -7,7 +7,7 @@ SUB __UI_LoadForm __UI_NewID = __UI_NewControl(__UI_Type_Form, "UiEditorForm", 598, 430, 0, 0, 0) __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_SetCaption "FileMenu", "&File" @@ -15,6 +15,9 @@ SUB __UI_LoadForm __UI_NewID = __UI_NewControl(__UI_Type_MenuBar, "ViewMenu", 44, 18, 52, 0, 0) __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_SetCaption "HelpMenu", "&Help" __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_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_SetCaption "HelpMenuHelp", "&What's all this?"