Introjucer: Sorting Behaviour Choice


#1

Hi Jules,

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


#2

Something like this perhaps.

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

    m.addSeparator();

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

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

    m.addSeparator();
    m.addItem (3, "Sort Contents Alphabetically");
    m.addItem (4, "Sort Contents Alphabetically (Groups at Start)");
    m.addSeparator();
    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;
    }
}

#3

Along with that request; recursive sorting…