| 1005 | } |
| 1006 | |
| 1007 | void UIEditorPanel::LoadFormList( const wxString &sel ) |
| 1008 | { |
| 1009 | |
| 1010 | wxArrayString list; |
| 1011 | |
| 1012 | wxDir dir( SamApp::GetRuntimePath() + "/ui" ); |
| 1013 | if ( dir.IsOpened() ) |
| 1014 | { |
| 1015 | wxString file; |
| 1016 | #ifdef UI_BINARY |
| 1017 | bool has_more = dir.GetFirst( &file, "*.ui", wxDIR_FILES ); |
| 1018 | #elif defined(__LOAD_AS_JSON__) |
| 1019 | bool has_more = dir.GetFirst(&file, "*.json", wxDIR_FILES); |
| 1020 | #else |
| 1021 | bool has_more = dir.GetFirst(&file, "*.txt", wxDIR_FILES); |
| 1022 | #endif |
| 1023 | while( has_more ) |
| 1024 | { |
| 1025 | wxFileName fn( file ); |
| 1026 | list.Add( fn.GetName() ); |
| 1027 | has_more = dir.GetNext( &file ); |
| 1028 | } |
| 1029 | } |
| 1030 | |
| 1031 | list.Sort(); |
| 1032 | |
| 1033 | m_formList->Freeze(); |
| 1034 | m_formList->Clear(); |
| 1035 | m_formList->Append( list ); |
| 1036 | m_formList->Thaw(); |
| 1037 | |
| 1038 | if ( !sel.IsEmpty() ) |
| 1039 | m_formList->SetStringSelection( sel ); |
| 1040 | } |
| 1041 | |
| 1042 | void UIEditorPanel::OnCallbackGoto( wxCommandEvent &evt ) |
| 1043 | { |