damiensellier / CtrlrX

CtlrX is an alternative fork of Roman Kubiak's Ctrlr. This project is ONLY aimed at delivering updates, a wiki, documentations, tutorials or anything that the community cannot share on the original Ctrlr github due to credential restrictions.
BSD 3-Clause "New" or "Revised" License
16 stars 3 forks source link

Menu bars not showing up for Log viewer and Midi Monitor in Exported Instance (both unrestricted and restricted) #19

Closed damiensellier closed 1 week ago

damiensellier commented 3 weeks ago

Log viewer's and Midi Monitor's Menu bars are not showing up in Exported Instance mode (both unrestricted and restricted).

Capture d’écran, le 2024-06-14 à 13 55 43 Capture d’écran, le 2024-06-14 à 13 55 57 Capture d’écran, le 2024-06-14 à 13 56 17 Capture d’écran, le 2024-06-14 à 13 56 26

damiensellier commented 1 week ago

SEE CtrlrEditorApplicationCommandsMenus.cpp L232
https://github.com/damiensellier/CtrlrX/blob/d1052344ce5a9768e9d3ea75e3a15b8203920ce9/Source/UIComponents/CtrlrApplicationWindow/CtrlrEditorApplicationCommandsMenus.cpp#L232 :

else if ((!isRestricted() && (topLevelMenuIndex == MenuTools)) || (isRestricted() && (topLevelMenuIndex == (hideProgramsMenu ? (MenuRestrictedTools - 1) : MenuRestrictedTools)))) // Tools
    {
        menu.addCommandItem (commandManager, showMidiMonitor);
        menu.addCommandItem (commandManager, showMidiCalculator);
        menu.addCommandItem (commandManager, showLogViewer);
        menu.addCommandItem (commandManager, showComparatorTables);
        if(!isRestricted())
        {
            menu.addCommandItem(commandManager, doRegisterExtension);
            menu.addCommandItem(commandManager, doKeyGenerator);
        }
    }
damiensellier commented 1 week ago

CtrlrEditor.cpp L134 :

hideProgramsMenu

if (isRestricted() && owner.getActivePanel())
    {
        hideProgramsMenu = owner.getActivePanel()->getEditor()->getProperty(Ids::uiPanelProgramsMenuHideOnExport);
        hideMidiControllerMenu = owner.getActivePanel()->getEditor()->getProperty(Ids::uiPanelMidiControllerMenuHideOnExport);
        hideMidiThruMenu = owner.getActivePanel()->getEditor()->getProperty(Ids::uiPanelMidiThruMenuHideOnExport);
        hideMidiChannelMenu = owner.getActivePanel()->getEditor()->getProperty(Ids::uiPanelMidiChannelMenuHideOnExport);
    }
damiensellier commented 1 week ago

SEE : CtrlrMidiMon.cpp

StringArray CtrlrMIDIMon::getMenuBarNames()
{
    const char* const names[] = { "File", "View", "Filter", nullptr };
    return StringArray (names);
}

PopupMenu CtrlrMIDIMon::getMenuForIndex(int topLevelMenuIndex, const String &menuName)
{
    PopupMenu menu;

    int opts = (int)owner.getProperty (Ids::ctrlrLogOptions);

    if (topLevelMenuIndex == 0)
    {
        menu.addItem (1, "Close");
    }
    else if (topLevelMenuIndex == 1)
    {
        menu.addItem (12, "Show name", true, getBitOption(opts,midiLogName));
        menu.addItem (14, "Show channel", true, getBitOption(opts,midiLogChannel));
        menu.addItem (18, "Show number", true, getBitOption(opts,midiLogNumber));
        menu.addItem (26, "Show value", true, getBitOption(opts,midiLogValue));
        menu.addItem (42, "Show RAW data", true, getBitOption(opts,midiLogRawData));
        menu.addItem (74, "Show timestamp", true, getBitOption(opts,midiLogTimestamp));
        menu.addItem (138, "RAW data in decimal", true, getBitOption(opts,midiLogRawDecimal));
        menu.addItem (1034, "Show device name", true, getBitOption(opts,midiLogDevice));
        menu.addItem  (4096+10, "Show RAW data size", true, getBitOption(opts,midiLogDataSize));
        menu.addSeparator();
        menu.addColouredItem (266, "Monitor input", Colour(0xff21c630), true, getBitOption(opts,midiLogInput));
        menu.addColouredItem (522, "Monitor output", Colour(0xffc62121), true, getBitOption(opts,midiLogOutput));
    }
    else if (topLevelMenuIndex == 2)
    {
        menu.addItem (8192, "Create new");
        menu.addSectionHeader ("Active filters");
    }

    return (menu);
}
damiensellier commented 1 week ago

CHECK :

CtrlrChildWindow.cpp CtrlrChildWindow.h

CtrlrChildWindowContainer.cpp CtrlrChildWindowContainer.h

CtrlrChildWindowContent.cpp CtrlrChildWindowContent.h

damiensellier commented 1 week ago

Could be related to the 24px offset issue on export. The menuBar is probably there but hidden behind the Native tittle bar. CHECK : try changing y position value to +24px to see if it shows up.

https://github.com/damiensellier/CtrlrX/blob/d1052344ce5a9768e9d3ea75e3a15b8203920ce9/Source/UIComponents/CtrlrWindowManagers/CtrlrChildWindowContainer.cpp

https://github.com/damiensellier/CtrlrX/blob/d1052344ce5a9768e9d3ea75e3a15b8203920ce9/Source/UIComponents/CtrlrWindowManagers/CtrlrChildWindowContainer.cpp#L78

void CtrlrChildWindowContainer::resized()
{
    menuBar->setBounds (0, 0, getWidth() - 0, owner.managerOwner.getProperty(Ids::ctrlrMenuBarHeight));
    //[UserResized] Add your own custom resize handling here..
    if (content)
    {
        content->setBounds (0, owner.managerOwner.getProperty(Ids::ctrlrMenuBarHeight), getWidth(), getHeight() - (int)owner.managerOwner.getProperty(Ids::ctrlrMenuBarHeight));
    }
    //[/UserResized]
}

Add setBounds for menuBar to constructor :

https://github.com/damiensellier/CtrlrX/blob/d1052344ce5a9768e9d3ea75e3a15b8203920ce9/Source/UIComponents/CtrlrWindowManagers/CtrlrChildWindowContainer.cpp#L39C1-L54C2

CtrlrChildWindowContainer::CtrlrChildWindowContainer (CtrlrWindowManager &_owner)
    : content(nullptr), owner(_owner),
      menuBar (0)
{
    addAndMakeVisible (menuBar = new MenuBarComponent (this));

    //[UserPreSize]
    //[/UserPreSize]

    setSize (600, 400);

    //[Constructor] You can add your own custom stuff here..
    //[/Constructor]
}
damiensellier commented 1 week ago

FIX :

https://github.com/damiensellier/CtrlrX/blob/d1052344ce5a9768e9d3ea75e3a15b8203920ce9/Source/UIComponents/CtrlrWindowManagers/CtrlrChildWindowContainer.cpp#L78

void CtrlrChildWindowContainer::resized()
{
    menuBar->setBounds (0, 0, getWidth(), (int)(owner.managerOwner.getProperty(Ids::ctrlrMenuBarHeight), 24)); // added v5.6.31. Fallback 24px value added to fix for hidden menuBar on exported instance
    addAndMakeVisible (menuBar);
    //[UserResized] Add your own custom resize handling here..
    if (content)
    {
        content->setBounds (0, (int)(owner.managerOwner.getProperty(Ids::ctrlrMenuBarHeight), 24), getWidth(), getHeight() - (int)(owner.managerOwner.getProperty(Ids::ctrlrMenuBarHeight), 24)); // added v5.6.31. Fallback 24px value added to fix for hidden menuBar on exported instance
    }
    //[/UserResized]
}

Capture d’écran, le 2024-06-25 à 14 35 01