diff --git a/src/gaming/mapeditor/cmapeditor.cpp b/src/gaming/mapeditor/cmapeditor.cpp index 7478cdab8..7656bc50a 100644 --- a/src/gaming/mapeditor/cmapeditor.cpp +++ b/src/gaming/mapeditor/cmapeditor.cpp @@ -269,8 +269,12 @@ void cMapEditor::FillSGCombo() { std::vector items; + Uint32 Restricted1 = MakeHash( std::string( "global" ) ); + Uint32 Restricted2 = MakeHash( mTheme->ShapeGroup()->Name() ); + for ( std::list::iterator it = Res.begin(); it != Res.end(); it++ ) { - items.push_back( reinterpret_cast( *it )->Name() ); + if ( (*it)->Id() != Restricted1 && (*it)->Id() != Restricted2 ) + items.push_back( (*it)->Name() ); } if ( items.size() ) { @@ -293,7 +297,7 @@ void cMapEditor::FillShapeList() { std::vector items; for ( std::list::iterator it = Res.begin(); it != Res.end(); it++ ) { - items.push_back( (*it)->Name() ); + items.push_back( (*it)->Name() ); } if ( items.size() ) { @@ -322,6 +326,9 @@ void cMapEditor::CreateNewMap() { } void cMapEditor::MapCreated() { + mLayerList->ListBox()->Clear(); + FillSGCombo(); + mMapHScroll->Value( 0 ); mMapVScroll->Value( 0 ); OnMapSizeChange( NULL ); diff --git a/src/ui/cuicombobox.cpp b/src/ui/cuicombobox.cpp index 6d8addf55..08f2db877 100644 --- a/src/ui/cuicombobox.cpp +++ b/src/ui/cuicombobox.cpp @@ -74,4 +74,7 @@ Uint32 cUIComboBox::OnMouseClick( const eeVector2i& Pos, const Uint32 Flags ) { return 1; } +void cUIComboBox::OnControlClear( const cUIEvent *Event ) { +} + }} diff --git a/src/ui/cuicombobox.hpp b/src/ui/cuicombobox.hpp index f16baa1d7..a02754f71 100644 --- a/src/ui/cuicombobox.hpp +++ b/src/ui/cuicombobox.hpp @@ -20,6 +20,8 @@ class EE_API cUIComboBox : public cUIDropDownList { Uint32 OnMouseClick( const eeVector2i& Pos, const Uint32 Flags ); void CreateButton(); + + virtual void OnControlClear( const cUIEvent *Event ); }; }} diff --git a/src/ui/cuidropdownlist.cpp b/src/ui/cuidropdownlist.cpp index 5bf18d640..afc3743e1 100644 --- a/src/ui/cuidropdownlist.cpp +++ b/src/ui/cuidropdownlist.cpp @@ -31,6 +31,7 @@ cUIDropDownList::cUIDropDownList( cUIDropDownList::CreateParams& Params ) : mListBox->AddEventListener( cUIEvent::EventOnItemClicked, cb::Make1( this, &cUIDropDownList::OnItemClicked ) ); mListBox->AddEventListener( cUIEvent::EventOnItemKeyDown, cb::Make1( this, &cUIDropDownList::OnItemKeyDown ) ); mListBox->AddEventListener( cUIEvent::EventKeyDown , cb::Make1( this, &cUIDropDownList::OnItemKeyDown ) ); + mListBox->AddEventListener( cUIEvent::EventOnControlClear, cb::Make1( this, &cUIDropDownList::OnControlClear ) ); } cUIDropDownList::~cUIDropDownList() { @@ -100,6 +101,10 @@ void cUIDropDownList::ShowListBox() { } } +void cUIDropDownList::OnControlClear( const cUIEvent * Event ) { + Text( "" ); +} + void cUIDropDownList::OnItemKeyDown( const cUIEvent * Event ) { const cUIEventKey * KEvent = reinterpret_cast ( Event ); diff --git a/src/ui/cuidropdownlist.hpp b/src/ui/cuidropdownlist.hpp index 58ad7f2e1..8ec1e8f75 100644 --- a/src/ui/cuidropdownlist.hpp +++ b/src/ui/cuidropdownlist.hpp @@ -55,6 +55,8 @@ class EE_API cUIDropDownList : public cUITextInput { virtual void OnItemKeyDown( const cUIEvent * Event ); + virtual void OnControlClear( const cUIEvent * Event ); + Uint32 OnKeyDown( const cUIEventKey &Event ); virtual void OnSizeChange(); diff --git a/src/ui/cuievent.hpp b/src/ui/cuievent.hpp index ecef9cc23..26c4a1081 100644 --- a/src/ui/cuievent.hpp +++ b/src/ui/cuievent.hpp @@ -45,6 +45,7 @@ class EE_API cUIEvent { EventOnWindowMaximizeClick, EventOnWindowMinimizeClick, EventOpenFile, + EventOnControlClear, EventUser, EventForceDWord = 0xFFFFFFFF }; diff --git a/src/ui/cuilistbox.cpp b/src/ui/cuilistbox.cpp index 274efeaff..470386af5 100644 --- a/src/ui/cuilistbox.cpp +++ b/src/ui/cuilistbox.cpp @@ -227,6 +227,8 @@ void cUIListBox::Clear() { UpdateScroll(); FindMaxWidth(); UpdateListBoxItemsSize(); + + SendCommonEvent( cUIEvent::EventOnControlClear ); } Uint32 cUIListBox::RemoveListBoxItem( Uint32 ItemIndex ) {