// static
void LLPreferenceCore::onTabChanged(void* user_data, bool from_click)
{
	LLTabContainer* self = (LLTabContainer*)user_data;

	gSavedSettings.setS32("LastPrefTab", self->getCurrentPanelIndex());
}
// static
void LLPreferenceCore::onTabChanged(LLUICtrl* ctrl)
{
	LLTabContainer* self = (LLTabContainer*)ctrl;

	gSavedSettings.setS32("LastPrefTab", self->getCurrentPanelIndex());
}
////////////////////////////////////////////////////////////////////////////////
// static
void LLFloaterMediaSettings::onTabChanged(void* user_data, bool from_click)
{
	LLTabContainer* self = (LLTabContainer*)user_data;
	gSavedSettings.setS32("LastMediaSettingsTab", self->getCurrentPanelIndex());
}
// Checked: 2011-11-04 (RLVa-1.4.4a) | Modified: RLVa-1.4.4a
void RlvUIEnabler::onToggleShowInv(bool fQuitting)
{
    if (fQuitting)
        return;	// Nothing to do if the viewer is shutting down

    bool fEnable = !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWINV);

    //
    // When disabling, close any inventory floaters that may be open
    //
    if (!fEnable)
    {
        LLFloaterReg::const_instance_list_t lFloaters = LLFloaterReg::getFloaterList("inventory");
        for (LLFloaterReg::const_instance_list_t::const_iterator itFloater = lFloaters.begin(); itFloater != lFloaters.end(); ++itFloater)
            (*itFloater)->closeFloater();

        LLFloaterReg::const_instance_list_t lSecFloaters = LLFloaterReg::getFloaterList("secondary_inventory");
        for (LLFloaterReg::const_instance_list_t::const_iterator itSecFloater = lSecFloaters.begin(); itSecFloater != lSecFloaters.end(); ++itSecFloater)
            (*itSecFloater)->closeFloater();
    }

    //
    // Enable/disable the "My Outfits" panel on the "My Appearance" sidebar tab
    //
    LLPanelOutfitsInventory* pAppearancePanel = LLPanelOutfitsInventory::findInstance();
    RLV_ASSERT(pAppearancePanel);
    if (pAppearancePanel)
    {
        LLTabContainer* pAppearanceTabs = pAppearancePanel->getAppearanceTabs();
        LLOutfitsList* pMyOutfitsPanel = pAppearancePanel->getMyOutfitsPanel();
        if ( (pAppearanceTabs) && (pMyOutfitsPanel) )
        {
            S32 idxTab = pAppearanceTabs->getIndexForPanel(pMyOutfitsPanel);
            RLV_ASSERT(-1 != idxTab);
            pAppearanceTabs->enableTabButton(idxTab, fEnable);

            // When disabling, switch to the COF tab if "My Outfits" is currently active
            if ( (!fEnable) && (pAppearanceTabs->getCurrentPanelIndex() == idxTab) )
                pAppearanceTabs->selectTabPanel(pAppearancePanel->getCurrentOutfitPanel());
        }

        LLSidepanelAppearance* pCOFPanel = pAppearancePanel->getAppearanceSP();
        RLV_ASSERT(pCOFPanel);
        if ( (!fEnable) && (pCOFPanel) && (pCOFPanel->isOutfitEditPanelVisible()) )
        {
            // TODO-RLVa: we should really just be collapsing the "Add more..." inventory panel (and disable the button)
            pCOFPanel->showOutfitsInventoryPanel();
        }
    }

    //
    // Filter (or stop filtering) opening new inventory floaters
    //
    // <FS:Ansariel> Modified for FIRE-8804
    if (!fEnable)
    {
        addGenericFloaterFilter("inventory");
        addGenericFloaterFilter("secondary_inventory");
    }
    else
    {
        removeGenericFloaterFilter("inventory");
        removeGenericFloaterFilter("secondary_inventory");
    }
}