Introjucer: Sorting Behaviour Choice


Hi Jules,

Would like the choice between sorting by group then files, or all alphabetically.


Something like this perhaps.

void GroupTreeViewItem::showPopupMenu()
    PopupMenu m;
    addCreateFileMenuItems (m);


    if (isOpen())
        m.addItem (5, "Collapse all Sub-groups");
        m.addItem (6, "Expand all Sub-groups");

    m.addItem (7, "Enable compiling of all enclosed files");
    m.addItem (8, "Disable compiling of all enclosed files");

    m.addItem (3, "Sort Contents Alphabetically");
    m.addItem (4, "Sort Contents Alphabetically (Groups at Start)");
    m.addItem (1, "Rename...");

    if (! isRoot())
        m.addItem (2, "Delete");

    launchPopupMenu (m);
void GroupTreeViewItem::handlePopupMenuResult (int resultCode)
    switch (resultCode)
        case 1:     triggerAsyncRename (item); break;
        case 2:     deleteAllSelectedItems(); break;
        case 3:     item.sortAlphabetically (false); break;
        case 4:     item.sortAlphabetically (true); break;
        case 5:     openOrCloseAllSubGroups (*this, false); break;
        case 6:     openOrCloseAllSubGroups (*this, true); break;
        case 7:     setFilesToCompile (item, true); break;
        case 8:     setFilesToCompile (item, false); break;
        default:    processCreateFileMenuItem (resultCode); break;


Along with that request; recursive sorting…