Minor style changes.

This commit is contained in:
hiker 2015-10-07 08:22:02 +11:00
parent ccf8fd4e68
commit 14e84ed96b

View File

@ -35,25 +35,25 @@ using namespace GUIEngine;
DEFINE_SCREEN_SINGLETON( EditGPScreen ); DEFINE_SCREEN_SINGLETON( EditGPScreen );
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
EditGPScreen::EditGPScreen() EditGPScreen::EditGPScreen() : Screen("gpedit.stkgui"), m_gp(NULL),
: Screen("gpedit.stkgui"), m_gp(NULL), m_list(NULL), m_icon_bank(NULL), m_list(NULL), m_icon_bank(NULL),
m_selected(-1), m_modified(false) m_selected(-1), m_modified(false)
{ {
} } // EditGPScreen
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
EditGPScreen::~EditGPScreen() EditGPScreen::~EditGPScreen()
{ {
delete m_icon_bank; delete m_icon_bank;
} } // ~EditGPScreen
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void EditGPScreen::setSelectedGP(GrandPrixData* gp) void EditGPScreen::setSelectedGP(GrandPrixData* gp)
{ {
assert(gp != NULL); assert(gp != NULL);
m_gp = gp; m_gp = gp;
} } // setSelectedGP
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void EditGPScreen::loadedFromFile() void EditGPScreen::loadedFromFile()
@ -66,11 +66,12 @@ void EditGPScreen::loadedFromFile()
m_list->addColumn(_("Track"), 3); m_list->addColumn(_("Track"), 3);
m_list->addColumn(_("Laps"), 1); m_list->addColumn(_("Laps"), 1);
m_list->addColumn(_("Reversed"), 1); m_list->addColumn(_("Reversed"), 1);
} } // loadedFromFile
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void EditGPScreen::eventCallback(GUIEngine::Widget* widget, const std::string& name, void EditGPScreen::eventCallback(GUIEngine::Widget* widget,
const int playerID) const std::string& name,
const int playerID)
{ {
setSelected(m_list->getSelectionID()); setSelected(m_list->getSelectionID());
@ -146,7 +147,7 @@ void EditGPScreen::eventCallback(GUIEngine::Widget* widget, const std::string& n
back(); back();
} }
} }
} } // eventCallback
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void EditGPScreen::init() void EditGPScreen::init()
@ -191,7 +192,7 @@ void EditGPScreen::init()
m_action.clear(); m_action.clear();
} }
enableButtons(); enableButtons();
} } // init
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void EditGPScreen::onConfirm() void EditGPScreen::onConfirm()
@ -210,7 +211,7 @@ void EditGPScreen::onConfirm()
save(); save();
back(); back();
} }
} } // onConfirm
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void EditGPScreen::onCancel() void EditGPScreen::onCancel()
@ -221,7 +222,7 @@ void EditGPScreen::onCancel()
m_gp->reload(); // Discard changes m_gp->reload(); // Discard changes
back(); back();
} }
} } // onCancel
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void EditGPScreen::loadList(const int selected) void EditGPScreen::loadList(const int selected)
@ -268,7 +269,7 @@ void EditGPScreen::loadList(const int selected)
{ {
enableButtons(); enableButtons();
} }
} } // loadList
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void EditGPScreen::setModified(const bool modified) void EditGPScreen::setModified(const bool modified)
@ -285,14 +286,14 @@ void EditGPScreen::setModified(const bool modified)
header->setText(modified ? _(L"%s (+)", m_gp->getName()) : L"", true); header->setText(modified ? _(L"%s (+)", m_gp->getName()) : L"", true);
enableButtons(); enableButtons();
} } // setModified
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void EditGPScreen::setSelected(const int selected) void EditGPScreen::setSelected(const int selected)
{ {
m_selected = selected; m_selected = selected;
enableButtons(); enableButtons();
} } // setSelected
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void EditGPScreen::edit() void EditGPScreen::edit()
@ -308,7 +309,7 @@ void EditGPScreen::edit()
m_gp->getReverse((unsigned int)m_selected)); m_gp->getReverse((unsigned int)m_selected));
edit_screen->push(); edit_screen->push();
} }
} } // edit
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
bool EditGPScreen::save() bool EditGPScreen::save()
@ -325,7 +326,7 @@ bool EditGPScreen::save()
MessageDialog::MESSAGE_DIALOG_OK, NULL, false); MessageDialog::MESSAGE_DIALOG_OK, NULL, false);
return false; return false;
} }
} } // save
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void EditGPScreen::back() void EditGPScreen::back()
@ -333,19 +334,19 @@ void EditGPScreen::back()
m_action.clear(); m_action.clear();
m_modified = false; m_modified = false;
StateManager::get()->popMenu(); StateManager::get()->popMenu();
} } // back
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
bool EditGPScreen::canMoveUp() const bool EditGPScreen::canMoveUp() const
{ {
return (0 < m_selected && m_selected < m_list->getItemCount()); return (0 < m_selected && m_selected < m_list->getItemCount());
} } // canMoveUp
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
bool EditGPScreen::canMoveDown() const bool EditGPScreen::canMoveDown() const
{ {
return (0 <= m_selected && m_selected < m_list->getItemCount() - 1); return (0 <= m_selected && m_selected < m_list->getItemCount() - 1);
} } // canMoveDown
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void EditGPScreen::enableButtons() void EditGPScreen::enableButtons()
@ -365,4 +366,4 @@ void EditGPScreen::enableButtons()
edit_button->setActive(m_selected >= 0); edit_button->setActive(m_selected >= 0);
remove_button->setActive(m_selected >= 0); remove_button->setActive(m_selected >= 0);
} } // enableButtons