void CollectionsPanel::OnMyCollectionsBeginLabelEdit( wxTreeEvent& event ) { // this just makes the code below more generic in case we want to abstract it later SortTreeCtrl* treeCtrl = m_MyCollectionsTreeCtrl; wxTreeItemId item = event.GetItem(); if ( !item ) { event.Veto(); return; } AssetCollectionItemData* baseData = GetItemData( m_MyCollectionsTreeCtrl, item ); if ( !baseData ) { event.Veto(); return; } AssetCollection* collection = baseData->GetCollection<AssetCollection>(); if ( !collection || !collection->CanRename() ) { event.Veto(); return; } treeCtrl->SetItemText( item, collection->GetName() ); //treeCtrl->EditLabel( item ); event.Skip(); }
void VaultSearchPanel::PopulateCollectionsChoice() { u32 numAdded = 0; std::vector< tstring > tableData; for ( M_AssetCollections::const_iterator itr = m_CollectionManager->GetCollections().begin(), end = m_CollectionManager->GetCollections().end(); itr != end; ++itr ) { AssetCollection* collection = itr->second; if ( collection && !collection->GetAssetPaths().empty() ) { tableData.push_back( collection->GetName() ); ++numAdded; } } if ( numAdded > 0 ) { tableData.push_back( TXT( "" ) ); PopulateChoiceControl( (wxControlWithItems*) m_CollectionChoice, tableData ); m_SearchCollectionRadio->Enable( true ); m_CollectionChoice->Enable( true ); } else { m_SearchVaultRadio->SetValue( true ); m_SearchCollectionRadio->SetValue( false ); m_SearchCollectionRadio->Enable( false ); m_CollectionChoice->Enable( false ); } }
void CollectionsPanel::ConnectCollectionListeners() { for ( M_AssetCollections::const_iterator itr = m_CollectionManager->GetCollections().begin(), end = m_CollectionManager->GetCollections().end(); itr != end; ++itr ) { AssetCollection* collection = itr->second; collection->AddChangedListener( Reflect::ElementChangeSignature::Delegate( this, &CollectionsPanel::OnCollectionModified ) ); } }
void CollectionsPanel::OnClearAllCollections( const CollectionManagerArgs& args ) { for ( M_AssetCollections::const_iterator collectionItr = m_CollectionManager->GetCollections().begin(), collectionEnd = m_CollectionManager->GetCollections().end(); collectionItr != collectionEnd; ++collectionItr ) { AssetCollection* collection = collectionItr->second; collection->RemoveChangedListener( Reflect::ElementChangeSignature::Delegate( this, &CollectionsPanel::OnCollectionModified ) ); } }
void CollectionsPanel::UpdateCollections() { m_CollectionToItemIDs.clear(); PrePopulateTreeCtrl( m_TempCollectionsTreeCtrl ); PrePopulateTreeCtrl( m_MyCollectionsTreeCtrl ); { u32 tempItemsAdded = 0; u32 myItemsAdded = 0; for ( M_AssetCollections::const_iterator itr = m_CollectionManager->GetCollections().begin(), end = m_CollectionManager->GetCollections().end(); itr != end; ++itr ) { AssetCollection* collection = itr->second; HELIUM_ASSERT( collection ); if ( !collection ) continue; int iconIndex = m_ContainerImageIndex; if ( collection->GetType() == Reflect::GetType< Editor::AssetCollection >() ) { iconIndex = m_ContainerImageIndex; } SortTreeCtrl* treeCtrl = NULL; if ( collection->IsTemporary() ) { treeCtrl = m_TempCollectionsTreeCtrl; ++tempItemsAdded; } else { treeCtrl = m_MyCollectionsTreeCtrl; ++myItemsAdded; } wxTreeItemId itemID = treeCtrl->AppendItem( treeCtrl->GetRootItem(), collection->GetDisplayName(), iconIndex, -1, new AssetCollectionItemData( collection ) ); m_CollectionToItemIDs.insert( M_CollectionToItemID::value_type( collection->GetPath().Hash(), itemID ) ); } m_TempCollectionsTreeCtrl->Enable( tempItemsAdded > 0 ); if ( tempItemsAdded < 1 ) { wxTreeItemId itemID = m_TempCollectionsTreeCtrl->AppendItem( m_TempCollectionsTreeCtrl->GetRootItem(), TXT( "None Available" ) ); } } PostPopulateTreeCtrl( m_MyCollectionsTreeCtrl ); PostPopulateTreeCtrl( m_TempCollectionsTreeCtrl ); }
void CollectionsPanel::OnAssetCollectionsChanged( const Reflect::ElementChangeArgs& args ) { HELIUM_ASSERT( m_CollectionManager == args.m_Element ); for ( M_AssetCollections::const_iterator collectionItr = m_CollectionManager->GetCollections().begin(), collectionEnd = m_CollectionManager->GetCollections().end(); collectionItr != collectionEnd; ++collectionItr ) { AssetCollection* collection = collectionItr->second; collection->AddChangedListener( Reflect::ElementChangeSignature::Delegate( this, &CollectionsPanel::OnCollectionModified ) ); } UpdateCollections(); }
void SearchHistory::PushHistory( const SearchQuery* query ) { // we should always have a query here HELIUM_ASSERT( query ); if ( m_Active || !query ) { return; } if ( m_Current && (*m_Current) == (*query) ) { return; } //if ( m_BatchState > 0 ) //{ // m_Batch->Push( query ); // return; //} // we have a new query, so delete all subsequent queries from our current position m_Forward.clear(); // if we have a finite length and we are full, remove the oldest query while ( m_MaxHistory > 0 && GetLength() >= m_MaxHistory ) { m_Back.erase( m_Back.begin() ); } // if we have a current, move that to the Back list if ( m_Current ) { // append our query to the queue m_Back.push_back( m_Current ); AssetCollection* oldCollection = m_Current->GetCollection(); if ( oldCollection ) { oldCollection->RemoveChangedListener( Reflect::ElementChangeSignature::Delegate( this, &SearchHistory::OnCollectionChanged ) ); } } m_Current = query; AssetCollection* collection = m_Current->GetCollection(); if ( collection ) { collection->AddChangedListener( Reflect::ElementChangeSignature::Delegate( this, &SearchHistory::OnCollectionChanged ) ); } // fire an event to interested listeners m_Changed.Raise( SearchHistoryChangeArgs( this, query ) ); }
void SearchHistory::Forward( int historyIndex ) { m_Active = true; int index = historyIndex < 0 ? (int)m_Forward.size() - 1 : historyIndex; // if the forward stack is not empty if ( (int)m_Forward.size() > index ) { // get the query at the next position SearchQueryPtr query = NULL; while ( m_Forward.size() && (int)m_Forward.size() > index ) { query = m_Forward.back(); m_Forward.pop_back(); //if there's something in Current, move it to the back list if ( m_Current ) { m_Back.push_back( m_Current ); AssetCollection* oldCollection = m_Current->GetCollection(); if ( oldCollection ) { oldCollection->RemoveChangedListener( Reflect::ElementChangeSignature::Delegate( this, &SearchHistory::OnCollectionChanged ) ); } } m_Current = query; AssetCollection* collection = m_Current->GetCollection(); if ( collection ) { collection->AddChangedListener( Reflect::ElementChangeSignature::Delegate( this, &SearchHistory::OnCollectionChanged ) ); } } if ( query ) { PushMRU( query ); if ( m_VaultSearch ) { m_VaultSearch->RequestSearch( query ); } m_GoForward.Raise( SearchHistoryChangeArgs( this, query.Ptr() ) ); } } m_Active = false; }
/////////////////////////////////////////////////////////////////////////////// // Callback for when a drag operation is occurring over this control. Highlights // the tree item that will receive the drop if one were to take place. // wxDragResult CollectionsPanel::DragOver( const Inspect::DragArgs& args ) { SortTreeCtrl* treeCtrl = m_MyCollectionsTreeCtrl; wxDragResult result = args.m_Default; wxTreeItemId item = DragHitTest( treeCtrl, wxPoint( args.m_X, args.m_Y ) ); if ( item != m_DragOverItem ) { if ( m_DragOverItem.IsOk() && !treeCtrl->IsSelected( m_DragOverItem ) ) { treeCtrl->SetItemDropHighlight( m_DragOverItem, false ); } m_DragOverItem = item; if ( m_DragOverItem.IsOk() && !treeCtrl->IsSelected( m_DragOverItem ) ) { treeCtrl->SetItemDropHighlight( m_DragOverItem, true ); } } if ( item.IsOk() ) { if ( m_DragOriginatedHere && treeCtrl->IsSelected( item ) ) { // You can't drop on an item that is already selected (it's the same as what you are dragging!) result = wxDragNone; } else { AssetCollectionItemData* baseData = GetItemData( treeCtrl, item ); if ( baseData ) { AssetCollection* collection = baseData->GetCollection<AssetCollection>(); if ( !collection || !collection->CanHandleDragAndDrop() ) { result = wxDragNone; } } else { result = wxDragNone; } } } else { result = wxDragNone; } return result; }
void CollectionsPanel::OnMyCollectionsEndLabelEdit( wxTreeEvent& event ) { // this just makes the code below more generic in case we want to abstract it later SortTreeCtrl* treeCtrl = m_MyCollectionsTreeCtrl; event.Veto(); if( event.IsEditCancelled() ) { return; } wxTreeItemId item = event.GetItem(); if ( !item ) { return; } AssetCollectionItemData* baseData = GetItemData( treeCtrl, item ); if ( !baseData ) { return; } AssetCollection* collection = baseData->GetCollection<AssetCollection>(); if ( !collection || !collection->CanRename() ) { return; } wxString labelValue = event.GetLabel(); labelValue.Trim(true); // trim white-space right labelValue.Trim(false); // trim white-space left if ( labelValue.empty() ) { return; } tstring errors; collection->Freeze(); bool renameResult = m_CollectionManager->RenameCollection( collection, (const wxChar*)labelValue.c_str(), errors ); collection->Thaw(); if ( !renameResult ) { wxMessageBox( errors.c_str(), TXT( "MyCollection Name Already In Use" ), wxCENTER | wxICON_WARNING | wxOK, this ); //treeCtrl->EditLabel( item ); return; } }
CollectionsPanel::~CollectionsPanel() { Disconnect( wxEVT_SIZE, wxSizeEventHandler( CollectionsPanel::OnSizeCollectionsPanel ), NULL, this ); // wxGetApp().GetSettings()->GetVaultSettings()->RemoveSettingsLoadedListener( Core::SettingsLoadedSignature::Delegate( this, &CollectionsPanel::OnSettingsLoaded ) ); wxGetApp().GetSettings()->GetVaultSettings()->RemoveChangedListener( Reflect::ElementChangeSignature::Delegate( this, &CollectionsPanel::OnPrefrencesChanged ) ); for ( M_AssetCollections::const_iterator itr = m_CollectionManager->GetCollections().begin(), end = m_CollectionManager->GetCollections().end(); itr != end; ++itr ) { AssetCollection* collection = itr->second; collection->RemoveChangedListener( Reflect::ElementChangeSignature::Delegate( this, &CollectionsPanel::OnCollectionModified ) ); } DisconnectCollectionManagerListeners(); m_CollectionToItemIDs.clear(); }
void CollectionsPanel::OnCloseCollection( wxCommandEvent& event ) { SortTreeCtrl* treeCtrl = m_MyCollectionsTreeCtrl; wxTreeItemId rootID = treeCtrl->GetRootItem(); wxTreeItemId item = treeCtrl->GetSelection(); if( !item || item == rootID ) { return; } AssetCollectionItemData* baseData = GetItemData( treeCtrl, item ); if ( !baseData ) { return; } AssetCollection* collection = baseData->GetCollection<AssetCollection>(); if ( collection && !collection->IsTemporary() ) { if ( event.GetId() == ID_DeleteCollection ) { tstring warning = TXT( "Are you sure you'd like permenantly delete your collection \"" ); warning += collection->GetName() + TXT( "\"?" ); if ( wxYES == wxMessageBox( warning, TXT( "Delete Colleciton?" ), wxCENTER | wxYES_NO | wxICON_WARNING, this ) ) { m_CollectionManager->DeleteCollection( collection ); } } else { m_CollectionManager->CloseCollection( collection ); } } }
void CollectionsPanel::OnNewCollection( wxCommandEvent& event ) { int eventID = event.GetId(); AssetCollection* collection = NULL; switch ( eventID ) { default: collection = NULL; break; case ID_NewCollection: collection = NewCollection( m_CollectionManager, Reflect::GetType< Editor::AssetCollection >() ); break; } M_CollectionToItemID::iterator findItem = m_CollectionToItemIDs.find( collection->GetPath().Hash() ); if ( findItem != m_CollectionToItemIDs.end() && findItem->second.IsOk() ) { m_MyCollectionsTreeCtrl->EditLabel( findItem->second ); } }
void CollectionsPanel::OnImportIntoCollection( wxCommandEvent& event ) { SortTreeCtrl* treeCtrl = m_MyCollectionsTreeCtrl; wxTreeItemId rootID = treeCtrl->GetRootItem(); wxTreeItemId item = treeCtrl->GetSelection(); if( !item || item == rootID ) { return; } AssetCollectionItemData* baseData = GetItemData( treeCtrl, item ); if ( !baseData ) { return; } AssetCollection* collection = baseData->GetCollection<AssetCollection>(); if ( !collection || collection->IsDynamic() ) { return; } Helium::FileDialog browserDlg( this, VaultMenu::Label( ID_ImportIntoCollection ), TXT( "" ), TXT( "" ), TXT( "" ), Helium::FileDialogStyles::DefaultOpen | Helium::FileDialogStyles::ShowAllFilesFilter | Helium::FileDialogStyles::ExportFile ); std::vector< tstring > filters; AssetCollection::GetFileFilters( filters ); browserDlg.AddFilters( filters ); if ( browserDlg.ShowModal() == wxID_OK ) { collection->Freeze(); m_CollectionManager->ImportIntoStaticCollection( collection, (const wxChar*)browserDlg.GetPath().c_str() ); collection->Thaw(); } }
void CollectionsPanel::OnMyCollectionsMenu( wxTreeEvent& event ) { SortTreeCtrl* treeCtrl = m_MyCollectionsTreeCtrl; wxTreeItemId item = event.GetItem(); if ( !item ) { return; } wxTreeItemId rootID = treeCtrl->GetRootItem(); if( item != rootID ) { treeCtrl->SelectItem( item ); AssetCollectionItemData* baseData = GetItemData( treeCtrl, item ); if ( !baseData ) { return; } AssetCollection* collection = baseData->GetCollection<AssetCollection>(); if ( collection ) { std::set< Helium::Path > paths; m_VaultFrame->GetSelectedPaths( paths ); wxMenu menu; menu.Append( ID_ShowCollection, VaultMenu::Label( ID_ShowCollection ), VaultMenu::Label( ID_ShowCollection ), wxITEM_NORMAL ); menu.AppendSeparator(); menu.Append( ID_AddToCollection, VaultMenu::Label( ID_AddToCollection ), VaultMenu::Label( ID_AddToCollection ), wxITEM_NORMAL ); menu.Append( ID_RemoveFromCollection, VaultMenu::Label( ID_RemoveFromCollection ), VaultMenu::Label( ID_RemoveFromCollection ), wxITEM_NORMAL ); menu.AppendSeparator(); menu.Append( ID_ImportIntoCollection, VaultMenu::Label( ID_ImportIntoCollection ), VaultMenu::Label( ID_ImportIntoCollection ), wxITEM_NORMAL ); menu.Append( ID_SaveCollection, VaultMenu::Label( ID_SaveCollection ), VaultMenu::Label( ID_SaveCollection ), wxITEM_NORMAL ); menu.AppendSeparator(); menu.Append( ID_RenameCollection, VaultMenu::Label( ID_RenameCollection ), VaultMenu::Label( ID_RenameCollection ), wxITEM_NORMAL ); //menu.Append( ID_CloseCollection, VaultMenu::Label( ID_CloseCollection ), VaultMenu::Label( ID_CloseCollection ), wxITEM_NORMAL ); menu.Append( ID_DeleteCollection, VaultMenu::Label( ID_DeleteCollection ), VaultMenu::Label( ID_DeleteCollection ), wxITEM_NORMAL ); menu.Enable( ID_AddToCollection, !collection->IsDynamic() && !paths.empty() ); menu.Enable( ID_RemoveFromCollection, !collection->IsDynamic() && !paths.empty() ); menu.Enable( ID_ImportIntoCollection, !collection->IsDynamic() ); menu.Enable( ID_SaveCollection, true ); menu.Enable( ID_RenameCollection, collection->CanRename() ); //menu.Enable( ID_CloseCollection, !collection->IsTemporary() ); menu.Enable( ID_DeleteCollection, !collection->IsTemporary() ); // Show the menu PopupMenu( &menu ); } } }
void CollectionsPanel::OnSaveCollection( wxCommandEvent& event ) { SortTreeCtrl* treeCtrl = m_MyCollectionsTreeCtrl; wxTreeItemId rootID = treeCtrl->GetRootItem(); wxTreeItemId item = treeCtrl->GetSelection(); if( !item || item == rootID ) { return; } AssetCollectionItemData* baseData = GetItemData( treeCtrl, item ); if ( !baseData ) { return; } AssetCollection* collection = baseData->GetCollection<AssetCollection>(); if ( collection ) { tstring defaultDir( collection->GetPath().Directory() ); tstring defaultFile( collection->GetPath().Filename() ); Helium::FileDialog browserDlg( this, VaultMenu::Label( ID_SaveCollection ), defaultDir.c_str(), defaultFile.c_str(), TXT( "" ), Helium::FileDialogStyles::DefaultSave | Helium::FileDialogStyles::ShowAllFilesFilter | Helium::FileDialogStyles::ExportFile ); std::vector< tstring > filters; AssetCollection::GetFileFilters( filters ); browserDlg.AddFilters( filters ); if ( browserDlg.ShowModal() == wxID_OK ) { m_CollectionManager->SaveCollection( collection, (const wxChar*)browserDlg.GetPath().c_str() ); } } }
void CollectionsPanel::UpdateCollection( CollectionAction action ) { SortTreeCtrl* treeCtrl = m_MyCollectionsTreeCtrl; wxTreeItemId rootID = treeCtrl->GetRootItem(); wxTreeItemId item = treeCtrl->GetSelection(); if( !item || item == rootID ) { return; } AssetCollectionItemData* baseData = GetItemData( treeCtrl, item ); if ( !baseData ) { return; } AssetCollection* collection = baseData->GetCollection<AssetCollection>(); if ( !collection || collection->IsDynamic() ) { return; } std::set< Helium::Path > paths; m_VaultFrame->GetSelectedPaths( paths ); if ( !paths.empty() ) { collection->Freeze(); for ( std::set< Helium::Path >::const_iterator itr = paths.begin(), end = paths.end(); itr != end; ++itr ) { if ( (*itr).IsFile() ) { switch ( action ) { case CollectionActions::Add: collection->AddAsset( *itr ); break; case CollectionActions::Remove: collection->RemoveAsset( *itr ); break; default: HELIUM_BREAK(); break; } } } collection->Thaw(); } }
/////////////////////////////////////////////////////////////////////////////// // Collects and error checks the search criteria from the form, and populates // the struct m_SearchCriteria. Returns true if no errors were found. Also // stores the MRU for combo box form fields // // Parse: Fields // Update: MRUs // Set: m_GeneratedQueryTextCtrl // bool VaultSearchPanel::ProcessForm() { wxBusyCursor bc; #pragma TODO( "Rachel: Need more error checking in VaultSearchPanel::GetQueryString" ) tstring queryString = TXT( "" ); AssetCollection* collection = NULL; wxString fieldStringValue; tstring cleanFieldValue; // ----------------------------------------- if ( m_SearchCollectionRadio->GetValue() ) { fieldStringValue = m_CollectionChoice->GetStringSelection(); fieldStringValue.Trim(true); // trim white-space right fieldStringValue.Trim(false); // trim white-space left if ( !fieldStringValue.empty() ) { collection = m_CollectionManager->FindCollection( (const wxChar*)fieldStringValue.c_str() ); if ( collection ) { queryString += queryString.empty() ? TXT( "" ) : TXT( " " ); queryString += collection->GetQueryString(); } else { return false; } } } // ----------------------------------------- // Asset File Path/Name // wxTextCtrl* m_WordsTextCtrl; fieldStringValue = m_WordsTextCtrl->GetValue(); fieldStringValue.Trim(true); // trim white-space right fieldStringValue.Trim(false); // trim white-space left if ( !fieldStringValue.empty() ) { std::vector< tstring > splitValue; Tokenize( (const wxChar*)fieldStringValue.c_str(), splitValue, TXT( " " ) ); std::vector< tstring >::const_iterator itr = splitValue.begin(); std::vector< tstring >::const_iterator end = splitValue.end(); for ( ; itr != end ; ++itr ) { const tstring& value = (*itr); cleanFieldValue = value; Helium::Path::Normalize( cleanFieldValue ); bool isPath = true; //( cleanFieldValue.find( '/' ) != tstring::npos ) ? true : false; queryString += queryString.empty() ? TXT( "" ) : TXT( " " ); queryString += isPath ? TXT( "path" ) : TXT( "name" ); queryString += TXT( ":" ); queryString += cleanFieldValue; queryString += TXT( "" ); } } // wxTextCtrl* m_PhraseTextCtrl; fieldStringValue = m_PhraseTextCtrl->GetValue(); fieldStringValue.Trim(true); // trim white-space right fieldStringValue.Trim(false); // trim white-space left if ( !fieldStringValue.empty() ) { cleanFieldValue = fieldStringValue.c_str(); Helium::Path::Normalize( cleanFieldValue ); bool isPath = true; //( cleanFieldValue.find( '/' ) != tstring::npos ) ? true : false; bool needsQuotes = ( cleanFieldValue.find( ' ' ) != tstring::npos ) ? true : false; queryString += queryString.empty() ? TXT( "" ) : TXT( " " ); queryString += isPath ? TXT( "path" ) : TXT( "name" ); queryString += TXT( ":" ); queryString += needsQuotes ? TXT( "\"" ) : TXT( "" ); queryString += cleanFieldValue; queryString += needsQuotes ? TXT( "\"" ) : TXT( "" ); } // File type filter------------------------------- // wxComboBox* m_FileTypeChoice; fieldStringValue = m_FileTypeChoice->GetStringSelection().c_str(); fieldStringValue.Trim(true); // trim white-space right fieldStringValue.Trim(false); // trim white-space left if ( !fieldStringValue.empty() && _tcsicmp( fieldStringValue.c_str(), s_FileTypeDefaultText ) != 0 && _tcsicmp( fieldStringValue.c_str(), TXT( "All files (*.*)" ) ) != 0 ) { const Filter* foundFilter = FindFilter( (const wxChar*)fieldStringValue.c_str() ); if ( foundFilter != NULL && !foundFilter->GetExtensions().empty() ) { queryString += queryString.empty() ? TXT( "" ) : TXT( " " ); queryString += TXT( "fileType:" ); queryString += TXT( "\"*" ); queryString += *(foundFilter->GetExtensions().begin()); queryString += TXT( "\"" ); } else { wxMessageBox( TXT( "The file extension you specified is not valid." ), TXT( "Error" ), wxCENTER | wxOK | wxICON_ERROR, GetParent() ); return false; } } // wxChoice* m_FolderChoice; fieldStringValue = m_FolderChoice->GetStringSelection(); fieldStringValue.Trim(true); // trim white-space right fieldStringValue.Trim(false); // trim white-space left if ( !fieldStringValue.empty() ) { cleanFieldValue = fieldStringValue.c_str(); Helium::Path::Normalize( cleanFieldValue ); #pragma TODO( "support getting the asset root from the settings for the project to strip it" ) // FileSystem::StripPrefix( File::GlobalManager().GetManagedAssetsRoot(), cleanFieldValue ); if ( !cleanFieldValue.empty() ) { bool needsQuotes = ( cleanFieldValue.find( ' ' ) != tstring::npos ) ? true : false; queryString += queryString.empty() ? TXT( "" ) : TXT( " " ); queryString += TXT( "path:" ); queryString += needsQuotes ? TXT( "\"" ) : TXT( "" ); queryString += cleanFieldValue; queryString += TXT( "*\"" ); } } // ----------------------------------------- // Additional search criteria // wxComboBox* m_CreatedByComboBox; fieldStringValue = m_CreatedByComboBox->GetStringSelection(); fieldStringValue.Trim(true); // trim white-space right fieldStringValue.Trim(false); // trim white-space left if ( !fieldStringValue.empty() && _tcsicmp( fieldStringValue.c_str(), s_CreatedByDefaultText ) != 0 ) { queryString += queryString.empty() ? TXT( "" ) : TXT( " " ); queryString += TXT( "rcsUser:"******"" ); } // ----------------------------------------- // wxChoice* m_AssetTypeChoice; fieldStringValue = m_AssetTypeChoice->GetStringSelection(); fieldStringValue.Trim(true); // trim white-space right fieldStringValue.Trim(false); // trim white-space left if ( !fieldStringValue.empty() && _tcsicmp( fieldStringValue.c_str(), s_AssetTypeDefaultText ) != 0 ) { bool needsQuotes = ( fieldStringValue.find( ' ' ) != -1 ) ? true : false; queryString += queryString.empty() ? TXT( "" ) : TXT( " " ); queryString += TXT( "assetType:" ); queryString += needsQuotes ? TXT( "\"" ) : TXT( "" ); queryString += fieldStringValue.c_str(); queryString += needsQuotes ? TXT( "\"" ) : TXT( "" ); } // ----------------------------------------- // wxTextCtrl* m_FileIDTextCtrl; fieldStringValue = m_FileIDTextCtrl->GetValue(); fieldStringValue.Trim(true); // trim white-space right fieldStringValue.Trim(false); // trim white-space left if ( !fieldStringValue.empty() && _tcsicmp( fieldStringValue.c_str(), s_FileIDDefaultText ) != 0 ) { queryString += queryString.empty() ? TXT( "" ) : TXT( " " ); queryString += TXT( "pathHash:" ); queryString += fieldStringValue.c_str(); queryString += TXT( "" ); } // ----------------------------------------- // wxChoice* m_ComponentNameChoice; // wxTextCtrl* m_ComponentValueTextCtrl fieldStringValue = m_ComponentNameChoice->GetStringSelection(); fieldStringValue.Trim(true); // trim white-space right fieldStringValue.Trim(false); // trim white-space left if ( !fieldStringValue.empty() && _tcsicmp( fieldStringValue.c_str(), s_ComponentNameDefaultText ) != 0 ) { cleanFieldValue = fieldStringValue.c_str(); fieldStringValue = m_ComponentValueTextCtrl->GetValue(); fieldStringValue.Trim(true); // trim white-space right fieldStringValue.Trim(false); // trim white-space left if ( !fieldStringValue.empty() && _tcsicmp( fieldStringValue.c_str(), s_ComponentValueDefaultText ) != 0 ) { bool needsQuotes = ( fieldStringValue.find( ' ' ) != -1 ) ? true : false; queryString += queryString.empty() ? TXT( "" ) : TXT( " " ); queryString += cleanFieldValue + TXT( ":" ); queryString += needsQuotes ? TXT( "\"" ) : TXT( "" ); queryString += fieldStringValue.c_str(); queryString += needsQuotes ? TXT( "\"" ) : TXT( "" ); } else { wxMessageBox( TXT( "Please specify an attribute value to search for." ), TXT( "Error" ), wxCENTER | wxOK | wxICON_ERROR, GetParent() ); return false; } } // ----------------------------------------- // wxTextCtrl* m_LevelTextCtrl; fieldStringValue = m_LevelTextCtrl->GetValue(); fieldStringValue.Trim(true); // trim white-space right fieldStringValue.Trim(false); // trim white-space left if ( !fieldStringValue.empty() && _tcsicmp( fieldStringValue.c_str(), s_LevelDefaultText ) != 0 ) { cleanFieldValue = fieldStringValue.c_str(); Helium::Path::Normalize( cleanFieldValue ); bool needsQuotes = ( cleanFieldValue.find( ' ' ) != tstring::npos ) ? true : false; queryString += queryString.empty() ? TXT( "" ) : TXT( " " ); queryString += TXT( "level:" ); queryString += needsQuotes ? TXT( "\"" ) : TXT( "" ); queryString += cleanFieldValue; queryString += needsQuotes ? TXT( "\"" ) : TXT( "" ); } // ----------------------------------------- // wxTextCtrl* m_ShaderTextCtrl; fieldStringValue = m_ShaderTextCtrl->GetValue(); fieldStringValue.Trim(true); // trim white-space right fieldStringValue.Trim(false); // trim white-space left if ( !fieldStringValue.empty() && _tcsicmp( fieldStringValue.c_str(), s_ShaderDefaultText ) != 0 ) { cleanFieldValue = fieldStringValue.c_str(); Helium::Path::Normalize( cleanFieldValue ); bool needsQuotes = ( cleanFieldValue.find( ' ' ) != tstring::npos ) ? true : false; queryString += queryString.empty() ? TXT( "" ) : TXT( " " ); queryString += TXT( "shader:" ); queryString += needsQuotes ? TXT( "\"" ) : TXT( "" ); queryString += cleanFieldValue; queryString += needsQuotes ? TXT( "\"" ) : TXT( "" ); } m_VaultFrame->Search( queryString, collection ); return true; }