void HistoryElementSettingsSection::undo()
{
    if(!m_scene)
        return;

    LvlScene* lvlScene;
    if(!(lvlScene = qobject_cast<LvlScene*>(m_scene)))
        return;

    int sectionID = m_sectionID;
    QVariant extraData = m_extraData;

    if(m_subtype == HistorySettings::SETTING_SECWRAPH){
        lvlScene->m_data->sections[sectionID].wrap_h = !extraData.toBool();
    }
    else
    if(m_subtype == HistorySettings::SETTING_SECWRAPV){
        lvlScene->m_data->sections[sectionID].wrap_v = !extraData.toBool();
    }
    else
    if(m_subtype == HistorySettings::SETTING_SECOFFSCREENEXIT){
        lvlScene->m_data->sections[sectionID].OffScreenEn = !extraData.toBool();
    }
    else
    if(m_subtype == HistorySettings::SETTING_SECNOBACK){
        lvlScene->m_data->sections[sectionID].lock_left_scroll = !extraData.toBool();
    }
    else
    if(m_subtype == HistorySettings::SETTING_SECUNDERWATER){
        lvlScene->m_data->sections[sectionID].underwater = !extraData.toBool();
    }
    else
    if(m_subtype == HistorySettings::SETTING_SECBACKGROUNDIMG){
        lvlScene->ChangeSectionBG(extraData.toList()[0].toInt(), m_sectionID);
    }
    else
    if(m_subtype == HistorySettings::SETTING_SECMUSIC){
        lvlScene->m_data->sections[sectionID].music_id = extraData.toList()[0].toInt();
    }
    else
    if(m_subtype == HistorySettings::SETTING_SECCUSTOMMUSIC){
        lvlScene->m_data->sections[sectionID].music_file = extraData.toList()[0].toString();
    }

    MainWinConnect::pMainWin->dock_LvlSectionProps->refreshFileData();
    LvlMusPlay::updateMusic();
    MainWinConnect::pMainWin->setMusic(LvlMusPlay::musicButtonChecked);
}
コード例 #2
0
void HistoryElementResizeSection::redo()
{
    if(!m_scene)
        return;

    LvlScene* lvlScene;
    if(!(lvlScene = qobject_cast<LvlScene*>(m_scene)))
        return;

    lvlScene->m_data->sections[m_sectionID].size_left = m_newSize.left();
    lvlScene->m_data->sections[m_sectionID].size_right = m_newSize.right();
    lvlScene->m_data->sections[m_sectionID].size_top = m_newSize.top();
    lvlScene->m_data->sections[m_sectionID].size_bottom = m_newSize.bottom();

    lvlScene->ChangeSectionBG(lvlScene->m_data->sections[m_sectionID].background, m_sectionID);
    if(m_sectionID == lvlScene->m_data->CurSection){
        lvlScene->drawSpace();
    }
}