From: <jo...@us...> - 2014-02-25 19:18:44
|
Revision: 9297 http://sourceforge.net/p/planeshift/code/9297 Author: joelyon Date: 2014-02-25 19:18:40 +0000 (Tue, 25 Feb 2014) Log Message: ----------- - sort the palette of icons offered in the shortcut editing dialog Modified Paths: -------------- trunk/src/client/gui/shortcutwindow.cpp Modified: trunk/src/client/gui/shortcutwindow.cpp =================================================================== --- trunk/src/client/gui/shortcutwindow.cpp 2014-02-24 16:56:06 UTC (rev 9296) +++ trunk/src/client/gui/shortcutwindow.cpp 2014-02-25 19:18:40 UTC (rev 9297) @@ -412,16 +412,37 @@ iconPalette = dynamic_cast <pawsScrollMenu*> (subWidget->FindWidget("iconPalette")); if (iconPalette) { - //get a ptr to the txture manager so we can look at the elementList, which stores the icon names. + //get a ptr to the texture manager so we can look at the elementList, which stores the icon names. pawsTextureManager *tm = PawsManager::GetSingleton().GetTextureManager(); //build an array of the icon names csHash<csRef<iPawsImage>, csString>::GlobalIterator Iter(tm->elementList.GetIterator()); Iter.Reset(); - //build a lits of all PS icons + //build a sorted list of all PS icons while(Iter.HasNext()) { - allIcons.Push( Iter.Next()->GetName() ); + csString curr = csString(Iter.Next()->GetName()); +//fprintf(stderr, "pawsShortcutWindow::OnButtonReleased building icon palette, item %s\n", curr.GetData() ); + int i; + if( allIcons.IsEmpty() ) + { + allIcons.Push( curr.GetData() ); + continue; + } + for( i=0; i<allIcons.GetSize(); i++) //insertion sort + { +//fprintf(stderr, "......comparing to item %i - %s\n", i, allIcons[i].GetData() ); + if( allIcons[i] > curr ) + { +//fprintf(stderr, "......inserting\n" ); + allIcons.Insert(i, curr.GetData()); + break; + } + } + if( i>=allIcons.GetSize() ) + { + allIcons.Push( curr.GetData() ); + } } //pass the array of icon names to LoadArrays as both the icon and the tooltip, so we can see then names when we hover over one This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |