X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fsearch%2FfrmSearch.cpp;h=b2d1ac376a7e7eee9de958f30312c102b31d996d;hb=d078d1fbc762fbb62bd08fe80dfe726feb078543;hp=46d7d1e07dfcb7ebe02ced11e868cd6dd78c4f69;hpb=7d39a3bc455be1d64f151727fbb6a2a55f9ac8bb;p=xestiaab%2F.git diff --git a/source/search/frmSearch.cpp b/source/search/frmSearch.cpp index 46d7d1e..b2d1ac3 100644 --- a/source/search/frmSearch.cpp +++ b/source/search/frmSearch.cpp @@ -1,6 +1,6 @@ // frmSearch.cpp - Search form. // -// (c) 2012-2015 Xestia Software Development. +// (c) 2012-2017 Xestia Software Development. // // This file is part of Xestia Address Book. // @@ -59,6 +59,17 @@ frmSearch::frmSearch( wxWindow* parent ) frmSearchADT( parent ) { + // Setup the application icon. + + wxMemoryInputStream istream(bigimgs_searchicon_png, sizeof(bigimgs_searchicon_png)); + wxImage bigimgs_searchiconi(istream, wxBITMAP_TYPE_PNG); + wxBitmap searchiconbmp(bigimgs_searchiconi, -1); + wxIcon searchicon; + searchicon.CopyFromBitmap(searchiconbmp); + this->SetIcon(searchicon); + + // Setup the search window. + XABSearchPanel *InitPanel = new XABSearchPanel( tabSearch ); InitPanel->EnableButtons(TRUE, FALSE); InitPanel->SetupPointers(this); @@ -230,6 +241,15 @@ void frmSearch::ResetContacts( wxCommandEvent& event ) } + // Clear the status bar. + + wxCommandEvent statusResetEvent (SE_SBUPDATE); + + wxString *statusReset = new wxString(wxT("")); + + statusResetEvent.SetClientData(statusReset); + wxPostEvent(this, statusResetEvent); + // Add a search settings with the default things. ScrollGen = 0; @@ -255,7 +275,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 +321,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 +340,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 +378,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 +392,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); @@ -459,20 +481,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(); @@ -480,18 +506,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){