Fixed wrong item being focused when selecting random track then pressing escape

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7499 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria
2011-01-23 02:48:46 +00:00
parent 7b1bb38b9f
commit f0369ad670
4 changed files with 21 additions and 12 deletions

View File

@@ -128,7 +128,7 @@ void ArenasScreen::eventCallback(Widget* widget, const std::string& name, const
{
ITexture* screenshot = irr_driver->getTexture( clickedTrack->getScreenshotFile().c_str() );
new TrackInfoDialog( clickedTrack->getIdent(), clickedTrack->getName().c_str(),
new TrackInfoDialog(selection, clickedTrack->getIdent(), clickedTrack->getName().c_str(),
screenshot, 0.8f, 0.7f);
}
@@ -147,8 +147,8 @@ void ArenasScreen::eventCallback(Widget* widget, const std::string& name, const
{
ITexture* screenshot = irr_driver->getTexture( clickedTrack->getScreenshotFile().c_str() );
new TrackInfoDialog( clickedTrack->getIdent(), clickedTrack->getName().c_str(),
screenshot, 0.8f, 0.7f);
new TrackInfoDialog(selection, clickedTrack->getIdent(), clickedTrack->getName().c_str(),
screenshot, 0.8f, 0.7f);
} // clickedTrack != NULL
} // if random_track

View File

@@ -43,8 +43,9 @@ using namespace GUIEngine;
// ------------------------------------------------------------------------------------------------------
TrackInfoDialog::TrackInfoDialog(const std::string& trackIdent, const irr::core::stringw& trackName,
ITexture* screenshot, const float w, const float h) : ModalDialog(w, h)
TrackInfoDialog::TrackInfoDialog(const std::string& ribbonItem, const std::string& trackIdent,
const irr::core::stringw& trackName, ITexture* screenshot,
const float w, const float h) : ModalDialog(w, h)
{
const bool has_laps = race_manager->modeHasLaps();
const bool has_highscores = race_manager->modeHasHighscores();
@@ -54,6 +55,7 @@ TrackInfoDialog::TrackInfoDialog(const std::string& trackIdent, const irr::core:
const int y3 = m_area.getHeight()*6/7;
m_track_ident = trackIdent;
m_ribbon_item = ribbonItem;
// ---- Track title
core::rect< s32 > area_top(0, 0, m_area.getWidth(), y1);
@@ -172,7 +174,7 @@ TrackInfoDialog::~TrackInfoDialog()
Screen* curr_screen = GUIEngine::getCurrentScreen();
if (curr_screen->getName() == "tracks.stkgui")
{
((TracksScreen*)curr_screen)->setFocusOnTrack(m_track_ident);
((TracksScreen*)curr_screen)->setFocusOnTrack(m_ribbon_item);
}
}

View File

@@ -33,6 +33,7 @@ namespace irr { namespace gui { class IGUIImage; class IGUIStaticText; } }
class TrackInfoDialog : public GUIEngine::ModalDialog
{
std::string m_track_ident;
std::string m_ribbon_item;
// When there is no need to tab through / click on images/labels, we can add directly
// irrlicht labels (more complicated uses require the use of our widget set)
@@ -45,10 +46,16 @@ class TrackInfoDialog : public GUIEngine::ModalDialog
public:
/**
* Creates a modal dialog with given percentage of screen width and height
* \brief Creates a track info modal dialog with given percentage of screen width and height
* \param ribbonItem identifier name of the ribbon item that was clicked in the track selection
* screen to get there (often will be 'trackIdent' but may also be the random item)
* \param trackIdent identifier name of the track to show information about
* \param trackName human-readable, possibly translated, name of the track to show information about
* \param screenshot screenshot of the track to show information about
*/
TrackInfoDialog(const std::string& trackIdent, const irr::core::stringw& trackName,
irr::video::ITexture* screenshot, const float percentWidth, const float percentHeight);
TrackInfoDialog(const std::string& ribbonItem, const std::string& trackIdent,
const irr::core::stringw& trackName, irr::video::ITexture* screenshot,
const float percentWidth, const float percentHeight);
virtual ~TrackInfoDialog();
void onEnterPressedInternal();

View File

@@ -116,7 +116,7 @@ void TracksScreen::eventCallback(Widget* widget, const std::string& name, const
{
ITexture* screenshot = irr_driver->getTexture( clickedTrack->getScreenshotFile().c_str() );
new TrackInfoDialog( clickedTrack->getIdent(), clickedTrack->getName().c_str(),
new TrackInfoDialog(selection, clickedTrack->getIdent(), clickedTrack->getName().c_str(),
screenshot, 0.8f, 0.7f);
}
@@ -135,8 +135,8 @@ void TracksScreen::eventCallback(Widget* widget, const std::string& name, const
{
ITexture* screenshot = irr_driver->getTexture( clickedTrack->getScreenshotFile().c_str() );
new TrackInfoDialog( clickedTrack->getIdent(), clickedTrack->getName().c_str(),
screenshot, 0.8f, 0.7f);
new TrackInfoDialog(selection, clickedTrack->getIdent(), clickedTrack->getName().c_str(),
screenshot, 0.8f, 0.7f);
}
}
}