X-Git-Url: http://Server1/repobrowser/?p=xestiaab%2F.git;a=blobdiff_plain;f=source%2Fsearch%2FfrmSearch.cpp;h=9e4d8aa6a0622cf705b0f5a9faac4f3172c5bbcc;hp=56ae1edcb2ca2a9d55aa20fea531cef9cfaaad20;hb=9802970e8be1fe9511ad9a9d0eb9ffe8d2cfea41;hpb=17855e4229758abd623d7f2236b389bfff0fbbff diff --git a/source/search/frmSearch.cpp b/source/search/frmSearch.cpp index 56ae1ed..9e4d8aa 100644 --- a/source/search/frmSearch.cpp +++ b/source/search/frmSearch.cpp @@ -59,6 +59,8 @@ frmSearch::frmSearch( wxWindow* parent ) frmSearchADT( parent ) { + // Setup the search window. + XABSearchPanel *InitPanel = new XABSearchPanel( tabSearch ); InitPanel->EnableButtons(TRUE, FALSE); InitPanel->SetupPointers(this); @@ -255,7 +257,6 @@ void frmSearch::AddSearchSetting( wxCommandEvent& event ) NewPanel->SetupPointers(this); NewPanel->SetupInteger(ScrollGen); szrSearch->Add(NewPanel, 1, wxEXPAND|wxGROW, 5); - //szrSearch->Fit(tabSearch); szrSearch->FitInside(tabSearch); szrSearch->Layout(); szrSearch->RecalcSizes(); @@ -302,13 +303,13 @@ void frmSearch::AddSearchSetting( wxCommandEvent& event ) void frmSearch::RemoveSearchSetting( wxCommandEvent& event ) { + // Remove a search setting frame from the list. + // Get the integer from the event. std::map::iterator iter; iter = SearchFrames.find(event.GetInt()); - // Remove a search setting frame from the list. - XABSearchPanel *XABSPPtr; XABSPPtr = static_cast(iter->second); @@ -321,8 +322,6 @@ void frmSearch::RemoveSearchSetting( wxCommandEvent& event ) delete XABSPPtr; XABSPPtr = NULL; - //szrSearch->Fit(tabSearch); - if (SearchFrames.size() < SEARCHSETTINGS_MAX && SearchFrames.size() > 1){ for (std::map::iterator iter = SearchFrames.begin(); @@ -361,7 +360,9 @@ void frmSearch::ReloadAccountList( wxCommandEvent& event ){ } void frmSearch::SearchBarUpdate( wxCommandEvent& event ){ - + + // Update the status bar. + wxString *SBData = (wxString*)event.GetClientData(); stbBottom->SetStatusText(*SBData, 0); @@ -373,6 +374,9 @@ void frmSearch::SearchBarUpdate( wxCommandEvent& event ){ void frmSearch::SearchFinished( wxCommandEvent& event ){ + // Reset the search button and unlock the search + // panel buttons. + StopMode = FALSE; btnSearch->SetLabel(_("Search")); DisableAllSearchSettings(FALSE); @@ -382,7 +386,7 @@ void frmSearch::SearchFinished( wxCommandEvent& event ){ void frmSearch::DisableAllSearchSettings(bool Enable){ // Check if there is only one search value. If there is, only enable - // the add button. + // the add button if this is the case. if (SearchFrames.size() == 1){ @@ -392,6 +396,22 @@ void frmSearch::DisableAllSearchSettings(bool Enable){ } + // Check if there is SEARCHSETTINGS_MAX controls set or more, only + // enable the remove button if this is the case. + + if (SearchFrames.size() >= SEARCHSETTINGS_MAX){ + + for (std::map::iterator siter = SearchFrames.begin(); + siter != SearchFrames.end(); siter++){ + + XABSearchPanel *XABSPPtr = static_cast(SearchFrames.begin()->second); + XABSPPtr->EnableButtons(FALSE, TRUE); + + } + return; + + } + // More than one control, so process them. for (std::map::iterator siter = SearchFrames.begin(); @@ -443,20 +463,24 @@ void frmSearch::CloseWindow( wxCloseEvent& event ){ // Close window. - WindowData *WData = new WindowData; + if (SearchMode == false){ + + WindowData *WData = new WindowData; - WData->DataType = 2; - WData->WindowPointer = this; - WData->WindowID = SearchUID; + WData->DataType = 2; + WData->WindowPointer = this; + WData->WindowID = SearchUID; - wxCommandEvent delevent(WINDOW_CLOSE); - delevent.SetClientData(WData); - wxPostEvent(GetParent(), delevent); + wxCommandEvent delevent(WINDOW_CLOSE); + delevent.SetClientData(WData); + wxPostEvent(GetParent(), delevent); - wxCommandEvent rs(CE_REMOVESEARCH); - wxPostEvent(this, rs); + wxCommandEvent rs(CE_REMOVESEARCH); + wxPostEvent(this, rs); - WData = NULL; + WData = NULL; + + } this->Destroy(); @@ -464,18 +488,24 @@ void frmSearch::CloseWindow( wxCloseEvent& event ){ void frmSearch::CloseWindow( wxCommandEvent& event ){ + // Close this window. + this->Close(); } void frmSearch::SetUID(int UID){ + // Set the UID of the search window. + SearchUID = UID; } void frmSearch::SetSearchMode(bool SearchModeIn){ + // Set the search mode of the window. + SearchMode = SearchModeIn; if (SearchMode == TRUE){