Author Topic: ThreadSearch layout modification  (Read 13387 times)

Offline ironhead

  • Almost regular
  • **
  • Posts: 210
Re: ThreadSearch layout modification
« Reply #15 on: September 20, 2009, 03:14:42 pm »
Thank you again for the patch!

The second issue can half be solved easily:
Insert after the line 740 in ThreadSearchView.cpp (rev. 5813):
Code: [Select]
m_pToolBar->Update();
The contents of the other toolbars reappear, the dots on the left side don't.

It's odd that dots and the bevel don't reappear, but at least I don't loose the other toolbar's icons.

Cheers!

Offline ironhead

  • Almost regular
  • **
  • Posts: 210
Re: ThreadSearch layout modification
« Reply #16 on: September 21, 2009, 04:48:05 pm »
I've updated to svn 5815, which I believe contains a modified version of yesno's patch.  I've discovered another issue, in that if I hit the stop button to stop the search, C::B silently crashes.  There isn't any .RPT file generated.

Offline yesno

  • Multiple posting newcomer
  • *
  • Posts: 19
Re: ThreadSearch layout modification
« Reply #17 on: September 21, 2009, 08:07:31 pm »
Hello,

I have found the reason for the crash: it's a stack overflow from an endless recursion of ThreadSearch::OnBtnSearchClick(wxCommandEvent), same problem as ThreadSearch::OnBtnOptionsClick(wxCommandEvent) described in post #12.

The patch would be:
Code: [Select]
In ThreadSearch.cpp in line 646 (rev. 5815)
replace
m_pThreadSearchView->ProcessEvent(event);
by
m_pThreadSearchView->OnBtnSearchClick(event);

Hope that helps

With kind regards

Offline ironhead

  • Almost regular
  • **
  • Posts: 210
Re: ThreadSearch layout modification
« Reply #18 on: September 21, 2009, 08:52:57 pm »
Hello,

I have found the reason for the crash: it's a stack overflow from an endless recursion of ThreadSearch::OnBtnSearchClick(wxCommandEvent), same problem as ThreadSearch::OnBtnOptionsClick(wxCommandEvent) described in post #12.

The patch would be:
Code: [Select]
In ThreadSearch.cpp in line 646 (rev. 5815)
replace
m_pThreadSearchView->ProcessEvent(event);
by
m_pThreadSearchView->OnBtnSearchClick(event);

Hope that helps

Thank you once again, this works nicely!

Chris

Offline ironhead

  • Almost regular
  • **
  • Posts: 210
Re: ThreadSearch layout modification
« Reply #19 on: September 25, 2009, 08:06:47 am »
I've run the last nightly (5731) and noticed that it doesn't exhibit the same behaviour (being the fact that the toolbar blanks out any adjoining 'gripper' dots and the options icon doesn't do the 'reverse video' effect).  Is there anyway this behaviour can be restored in the latest revision?

Offline yesno

  • Multiple posting newcomer
  • *
  • Posts: 19
Re: ThreadSearch layout modification
« Reply #20 on: September 27, 2009, 07:56:38 pm »
Hello,

there is a way to restore the revision before the buttons on the logwindow (and the toolbar tools) were introduced. This is the diff file, for two files:

Code: [Select]
Index: ThreadSearch.cpp
===================================================================
--- ThreadSearch.cpp (Revision 5824)
+++ ThreadSearch.cpp (Arbeitskopie)
@@ -76,8 +76,8 @@
     EVT_MENU      (idMenuEditCopy,           ThreadSearch::OnMnuEditCopy)
     EVT_UPDATE_UI (idMenuEditCopy,           ThreadSearch::OnMnuEditCopyUpdateUI)
     EVT_MENU      (idMenuEditPaste,          ThreadSearch::OnMnuEditPaste)
-    EVT_TOOL      (idBtnOptions,             ThreadSearch::OnBtnOptionsClick)
-    EVT_TOOL      (idBtnSearch,              ThreadSearch::OnBtnSearchClick)
+    EVT_BUTTON    (idBtnOptions,             ThreadSearch::OnBtnOptionsClick)
+    EVT_BUTTON    (idBtnSearch,              ThreadSearch::OnBtnSearchClick)
     EVT_TEXT_ENTER(idCboSearchExpr,          ThreadSearch::OnCboSearchExprEnter)
     EVT_TEXT      (idCboSearchExpr,          ThreadSearch::OnCboSearchExprEnter)
 // ---------------------------------------------------------------------------
@@ -605,13 +605,19 @@
         m_pToolbar->SetToolBitmapSize(wxSize(22,22));
     }
     m_pCboSearchExpr               = new wxComboBox    (toolBar, idCboSearchExpr, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN);
+    wxBitmapButton* pBtnSearch     = new wxBitmapButton(toolBar, idBtnSearch, wxBitmap(prefix + wxT("findf.png"), wxBITMAP_TYPE_PNG));
+    wxBitmapButton* pBtnOptions    = new wxBitmapButton(toolBar, idBtnOptions, wxBitmap(prefix + wxT("options.png"), wxBITMAP_TYPE_PNG));
 
     m_pCboSearchExpr->SetToolTip(_("Text to search"));
+    pBtnSearch->SetToolTip(_("Run search"));
+    pBtnOptions->SetToolTip(_("Show options window"));
 
+    pBtnSearch->SetBitmapDisabled(wxBitmap(prefix + wxT("findfdisabled.png"), wxBITMAP_TYPE_PNG));
+    pBtnOptions->SetBitmapDisabled(wxBitmap(prefix + wxT("optionsdisabled.png"), wxBITMAP_TYPE_PNG));
 
     toolBar->AddControl(m_pCboSearchExpr);
-    toolBar->AddTool(idBtnSearch,_(""),wxBitmap(prefix + wxT("findf.png"), wxBITMAP_TYPE_PNG),wxBitmap(prefix + wxT("findfdisabled.png"), wxBITMAP_TYPE_PNG),wxITEM_NORMAL,_("Run search")); //Control(pBtnSearch);
-    toolBar->AddTool(idBtnOptions,_(""),wxBitmap(prefix + wxT("options.png"), wxBITMAP_TYPE_PNG),wxBitmap(prefix + wxT("optionsdisabled.png"), wxBITMAP_TYPE_PNG),wxITEM_NORMAL,_("Show options window")); //Control(pBtnSearch);
+    toolBar->AddControl(pBtnSearch);
+    toolBar->AddControl(pBtnOptions);
 
     toolBar->Realize();
     #if wxCHECK_VERSION(2, 8, 0)
@@ -629,7 +635,7 @@
     if ( !IsAttached() )
         return;
 
-    m_pThreadSearchView->OnBtnOptionsClick(event);
+    m_pThreadSearchView->ProcessEvent(event);
 }
 
 
@@ -643,7 +649,7 @@
     {
         // In this case, user wants to stops search,
         // we just transmit event
-        m_pThreadSearchView->OnBtnSearchClick(event);
+        m_pThreadSearchView->ProcessEvent(event);
 
     }
     else
Index: ThreadSearchView.cpp
===================================================================
--- ThreadSearchView.cpp (Revision 5824)
+++ ThreadSearchView.cpp (Arbeitskopie)
@@ -716,6 +716,7 @@
     };
 
     long toolBarIdsArray[] = {
+        idBtnOptions,
         idCboSearchExpr
     };
 
@@ -737,9 +738,6 @@
     {
         m_pToolBar->FindControl(toolBarIdsArray[i])->Enable(enable);
     }
-
-    m_pToolBar->EnableTool(idBtnOptions,enable);
-    m_pToolBar->Update();
 }
 
 
@@ -871,6 +869,7 @@
                                             wxEmptyString};
 
     // Gets toolbar search button pointer
+    wxBitmapButton* pToolBarSearchBtn = static_cast<wxBitmapButton*>(m_pToolBar->FindControl(idBtnSearch));
     // Changes label/bitmap only if requested
     if ( label != skip )
     {
@@ -878,14 +877,14 @@
         m_pBtnSearch->SetBitmapLabel   (wxBitmap(searchButtonPathsEnabled [label], wxBITMAP_TYPE_PNG));
         m_pBtnSearch->SetBitmapDisabled(wxBitmap(searchButtonPathsDisabled[label], wxBITMAP_TYPE_PNG));
         //{ Toolbar buttons
-        m_pToolBar->SetToolNormalBitmap(idBtnSearch,wxBitmap(searchButtonPathsEnabled [label], wxBITMAP_TYPE_PNG));
-        m_pToolBar->SetToolDisabledBitmap(idBtnSearch,wxBitmap(searchButtonPathsDisabled[label], wxBITMAP_TYPE_PNG));
+        pToolBarSearchBtn->SetBitmapLabel   (wxBitmap(searchButtonPathsEnabled [label], wxBITMAP_TYPE_PNG));
+        pToolBarSearchBtn->SetBitmapDisabled(wxBitmap(searchButtonPathsDisabled[label], wxBITMAP_TYPE_PNG));
         //}
     }
 
     // Sets enable state
     m_pBtnSearch->Enable(enable);
-    m_pToolBar->EnableTool(idBtnSearch,enable);
+    pToolBarSearchBtn->Enable(enable);
 }

I think it's complete because the functions for the button handling occur in these files only (not in the headers)

With kind regards
« Last Edit: September 27, 2009, 07:58:30 pm by yesno »