NCBI C++ ToolKit
remove_text_outside_string_panel.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: remove_text_outside_string_panel.cpp 41480 2018-08-03 14:36:21Z filippov $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Colleen Bollin
27  */
28 
29 
30 // Generated by DialogBlocks (unregistered), 15/07/2013 13:54:19
31 
32 #include <ncbi_pch.hpp>
33 
34 #include <wx/icon.h>
35 ////@begin includes
36 ////@end includes
37 
39 
40 ////@begin XPM images
41 ////@end XPM images
42 
44 
45 /*!
46  * CRemoveTextOutsideStringPanel type definition
47  */
48 
49 IMPLEMENT_DYNAMIC_CLASS( CRemoveTextOutsideStringPanel, wxPanel )
50 
51 
52 /*!
53  * CRemoveTextOutsideStringPanel event table definition
54  */
55 
56 BEGIN_EVENT_TABLE( CRemoveTextOutsideStringPanel, wxPanel )
57 
58 ////@begin CRemoveTextOutsideStringPanel event table entries
60 
61  EVT_RADIOBUTTON( ID_BEFORE_TEXT_BTN, CRemoveTextOutsideStringPanel::OnBeforeTextBtnSelected )
62 
63  EVT_RADIOBUTTON( ID_BEFORE_DIGITS_BTN, CRemoveTextOutsideStringPanel::OnBeforeDigitsBtnSelected )
64 
65  EVT_RADIOBUTTON( ID_BEFORE_LETTERS_BTN, CRemoveTextOutsideStringPanel::OnBeforeLettersBtnSelected )
66 
68 
69  EVT_RADIOBUTTON( ID_AFTER_TEXT_BTN, CRemoveTextOutsideStringPanel::OnAfterTextBtnSelected )
70 
71  EVT_RADIOBUTTON( ID_AFTER_DIGITS_BTN, CRemoveTextOutsideStringPanel::OnAfterDigitsBtnSelected )
72 
73  EVT_RADIOBUTTON( ID_AFTER_LETTERS_BTN, CRemoveTextOutsideStringPanel::OnAfterLettersBtnSelected )
74 
75 ////@end CRemoveTextOutsideStringPanel event table entries
76 
78 
79 
80 /*!
81  * CRemoveTextOutsideStringPanel constructors
82  */
83 
85 {
86  Init();
87 }
88 
89 CRemoveTextOutsideStringPanel::CRemoveTextOutsideStringPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
90 {
91  Init();
92  Create(parent, id, pos, size, style);
93 }
94 
95 
96 /*!
97  * CRemoveTextOutsideStringPanel creator
98  */
99 
100 bool CRemoveTextOutsideStringPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
101 {
102 ////@begin CRemoveTextOutsideStringPanel creation
103  wxPanel::Create( parent, id, pos, size, style );
104 
105  CreateControls();
106  if (GetSizer())
107  {
108  GetSizer()->SetSizeHints(this);
109  }
110  Centre();
111 ////@end CRemoveTextOutsideStringPanel creation
112  return true;
113 }
114 
115 
116 /*!
117  * CRemoveTextOutsideStringPanel destructor
118  */
119 
121 {
122 ////@begin CRemoveTextOutsideStringPanel destruction
123 ////@end CRemoveTextOutsideStringPanel destruction
124 }
125 
126 
127 /*!
128  * Member initialisation
129  */
130 
132 {
133 ////@begin CRemoveTextOutsideStringPanel member initialisation
146  m_CaseBtn = NULL;
148 ////@end CRemoveTextOutsideStringPanel member initialisation
149 }
150 
151 
152 /*!
153  * Control creation for CRemoveTextOutsideStringPanel
154  */
155 
157 {
158 ////@begin CRemoveTextOutsideStringPanel content construction
159  CRemoveTextOutsideStringPanel* itemPanel1 = this;
160 
161  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
162  itemPanel1->SetSizer(itemBoxSizer2);
163 
164  wxFlexGridSizer* itemFlexGridSizer3 = new wxFlexGridSizer(2, 6, 0, 0);
165  itemBoxSizer2->Add(itemFlexGridSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
166 
167  m_BeforeCheckbox = new wxCheckBox( itemPanel1, ID_BEFORE_CHECKBOX, _("Before"), wxDefaultPosition, wxDefaultSize, 0 );
168  m_BeforeCheckbox->SetValue(false);
169  itemFlexGridSizer3->Add(m_BeforeCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
170 
171  m_BeforeTextBtn = new wxRadioButton( itemPanel1, ID_BEFORE_TEXT_BTN, _("Text"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
172  m_BeforeTextBtn->SetValue(true);
173  itemFlexGridSizer3->Add(m_BeforeTextBtn, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
174 
175  m_BeforeTextTxt = new wxTextCtrl( itemPanel1, ID_BEFORE_TEXT_TXT, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
176  itemFlexGridSizer3->Add(m_BeforeTextTxt, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
177 
178  m_BeforeDigitsBtn = new wxRadioButton( itemPanel1, ID_BEFORE_DIGITS_BTN, _("Digits"), wxDefaultPosition, wxDefaultSize, 0 );
179  m_BeforeDigitsBtn->SetValue(false);
180  itemFlexGridSizer3->Add(m_BeforeDigitsBtn, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
181 
182  m_BeforeLettersBtn = new wxRadioButton( itemPanel1, ID_BEFORE_LETTERS_BTN, _("Letters"), wxDefaultPosition, wxDefaultSize, 0 );
183  m_BeforeLettersBtn->SetValue(false);
184  itemFlexGridSizer3->Add(m_BeforeLettersBtn, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
185 
186  m_AlsoRemoveBefore = new wxCheckBox( itemPanel1, ID_ALSO_REMOVE_BEFORE, _("Also remove search pattern"), wxDefaultPosition, wxDefaultSize, 0 );
187  m_AlsoRemoveBefore->SetValue(false);
188  itemFlexGridSizer3->Add(m_AlsoRemoveBefore, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
189 
190  m_AfterCheckbox = new wxCheckBox( itemPanel1, ID_AFTER_CHECKBOX, _("After"), wxDefaultPosition, wxDefaultSize, 0 );
191  m_AfterCheckbox->SetValue(false);
192  itemFlexGridSizer3->Add(m_AfterCheckbox, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
193 
194  m_AfterTextBtn = new wxRadioButton( itemPanel1, ID_AFTER_TEXT_BTN, _("Text"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
195  m_AfterTextBtn->SetValue(true);
196  itemFlexGridSizer3->Add(m_AfterTextBtn, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
197 
198  m_AfterTextTxt = new wxTextCtrl( itemPanel1, ID_AFTER_TEXT_TXT, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
199  itemFlexGridSizer3->Add(m_AfterTextTxt, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
200 
201  m_AfterDigitsBtn = new wxRadioButton( itemPanel1, ID_AFTER_DIGITS_BTN, _("Digits"), wxDefaultPosition, wxDefaultSize, 0 );
202  m_AfterDigitsBtn->SetValue(false);
203  itemFlexGridSizer3->Add(m_AfterDigitsBtn, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
204 
205  m_AfterLettersBtn = new wxRadioButton( itemPanel1, ID_AFTER_LETTERS_BTN, _("Letters"), wxDefaultPosition, wxDefaultSize, 0 );
206  m_AfterLettersBtn->SetValue(false);
207  itemFlexGridSizer3->Add(m_AfterLettersBtn, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
208 
209  m_AlsoRemoveAfter = new wxCheckBox( itemPanel1, ID_ALSO_REMOVE_AFTER, _("Also remove search pattern"), wxDefaultPosition, wxDefaultSize, 0 );
210  m_AlsoRemoveAfter->SetValue(false);
211  itemFlexGridSizer3->Add(m_AlsoRemoveAfter, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5);
212 
213  wxBoxSizer* itemBoxSizer16 = new wxBoxSizer(wxHORIZONTAL);
214  itemBoxSizer2->Add(itemBoxSizer16, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
215 
216  m_CaseBtn = new wxCheckBox( itemPanel1, ID_CASE_BTN, _("Case Insensitive"), wxDefaultPosition, wxDefaultSize, 0 );
217  m_CaseBtn->SetValue(false);
218  itemBoxSizer16->Add(m_CaseBtn, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
219 
220  m_WholeWordBtn = new wxCheckBox( itemPanel1, ID_WHOLE_WORD_BTN, _("Whole Word"), wxDefaultPosition, wxDefaultSize, 0 );
221  m_WholeWordBtn->SetValue(false);
222  itemBoxSizer16->Add(m_WholeWordBtn, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
223 
224 ////@end CRemoveTextOutsideStringPanel content construction
226 }
227 
229 {
230  m_BeforeCheckbox->SetValue(false);
231  m_BeforeTextBtn->SetValue(true);
232  m_BeforeTextTxt->SetValue(wxEmptyString);
233  m_BeforeDigitsBtn->SetValue(false);
234  m_BeforeLettersBtn->SetValue(false);
235  m_AlsoRemoveBefore->SetValue(false);
236  m_AfterCheckbox->SetValue(false);
237  m_AfterTextBtn->SetValue(true);
238  m_AfterTextTxt->SetValue(wxEmptyString);
239  m_AfterDigitsBtn->SetValue(false);
240  m_AfterLettersBtn->SetValue(false);
241  m_AlsoRemoveAfter->SetValue(false);
242  m_CaseBtn->SetValue(false);
243  m_WholeWordBtn->SetValue(false);
245 }
246 
247 /*!
248  * Should we show tooltips?
249  */
250 
252 {
253  return true;
254 }
255 
256 /*!
257  * Get bitmap resources
258  */
259 
260 wxBitmap CRemoveTextOutsideStringPanel::GetBitmapResource( const wxString& name )
261 {
262  // Bitmap retrieval
263 ////@begin CRemoveTextOutsideStringPanel bitmap retrieval
264  wxUnusedVar(name);
265  return wxNullBitmap;
266 ////@end CRemoveTextOutsideStringPanel bitmap retrieval
267 }
268 
269 /*!
270  * Get icon resources
271  */
272 
274 {
275  // Icon retrieval
276 ////@begin CRemoveTextOutsideStringPanel icon retrieval
277  wxUnusedVar(name);
278  return wxNullIcon;
279 ////@end CRemoveTextOutsideStringPanel icon retrieval
280 }
281 
282 
283 /*!
284  * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_BEFORE_CHECKBOX
285  */
286 
288 {
290 }
291 
292 
293 /*!
294  * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_BEFORE_TEXT_BTN
295  */
296 
298 {
300 }
301 
302 
303 /*!
304  * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_BEFORE_DIGITS_BTN
305  */
306 
308 {
310 }
311 
312 
313 /*!
314  * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_BEFORE_LETTERS_BTN
315  */
316 
318 {
320 }
321 
322 
323 
324 
325 /*!
326  * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_AFTER_CHECKBOX
327  */
328 
330 {
332 }
333 
334 
335 /*!
336  * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_AFTER_TEXT_BTN
337  */
338 
340 {
342 }
343 
344 
345 
346 
347 /*!
348  * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_AFTER_DIGITS_BTN
349  */
350 
352 {
354 }
355 
356 
357 /*!
358  * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_AFTER_LETTERS_BTN
359  */
360 
362 {
364 }
365 
366 
368 {
369  macro::CRemoveTextOptions::EMatchType before_match = macro::CRemoveTextOptions::eNone;
370  string before_text = "";
371  bool remove_before_match = false;
372  if (m_BeforeCheckbox->GetValue()) {
373  if (m_BeforeTextBtn->GetValue()) {
374  before_match = macro::CRemoveTextOptions::eText;
375  before_text = m_BeforeTextTxt->GetValue();
376  } else if (m_BeforeDigitsBtn->GetValue()) {
377  before_match = macro::CRemoveTextOptions::eDigits;
378  } else if (m_BeforeLettersBtn->GetValue()) {
379  before_match = macro::CRemoveTextOptions::eLetters;
380  }
381  remove_before_match = m_AlsoRemoveBefore->GetValue();
382  }
383  macro::CRemoveTextOptions::EMatchType after_match = macro::CRemoveTextOptions::eNone;
384  string after_text = "";
385  bool remove_after_match = false;
386  if (m_AfterCheckbox->GetValue()) {
387  if (m_AfterTextBtn->GetValue()) {
388  after_match = macro::CRemoveTextOptions::eText;
389  after_text = m_AfterTextTxt->GetValue();
390  } else if (m_AfterDigitsBtn->GetValue()) {
391  after_match = macro::CRemoveTextOptions::eDigits;
392  } else if (m_AfterLettersBtn->GetValue()) {
393  after_match = macro::CRemoveTextOptions::eLetters;
394  }
395  remove_after_match = m_AlsoRemoveAfter->GetValue();
396  }
397  bool case_insensitive = false;
398  bool whole_word = false;
399  if (m_CaseBtn->IsEnabled() && m_CaseBtn->GetValue()) {
400  case_insensitive = true;
401  }
402  if (m_WholeWordBtn->IsEnabled() && m_WholeWordBtn->GetValue()) {
403  whole_word = true;
404  }
405 
406 
408  remove_text(new macro::CRemoveTextOptions(before_match, before_text, remove_before_match,
409  after_match, after_text, remove_after_match,
410  case_insensitive, whole_word));
411  return remove_text;
412 }
413 
414 
416 {
417  bool enable_text_only_options = false;
418  if (m_BeforeCheckbox->GetValue()) {
419  m_BeforeTextBtn->Enable(true);
420  m_BeforeTextTxt->Enable(m_BeforeTextBtn->GetValue());
421  m_BeforeDigitsBtn->Enable(true);
422  m_BeforeLettersBtn->Enable(true);
423  m_AlsoRemoveBefore->Enable(true);
424  if (m_BeforeTextBtn->GetValue()) {
425  enable_text_only_options = true;
426  }
427  } else {
428  m_BeforeTextBtn->Enable(false);
429  m_BeforeTextTxt->Enable(false);
430  m_BeforeDigitsBtn->Enable(false);
431  m_BeforeLettersBtn->Enable(false);
432  m_AlsoRemoveBefore->Enable(false);
433  }
434  if (m_AfterCheckbox->GetValue()) {
435  m_AfterTextBtn->Enable(true);
436  m_AfterTextTxt->Enable(m_AfterTextBtn->GetValue());
437  m_AfterDigitsBtn->Enable(true);
438  m_AfterLettersBtn->Enable(true);
439  m_AlsoRemoveAfter->Enable(true);
440  if (m_AfterTextBtn->GetValue()) {
441  enable_text_only_options = true;
442  }
443  } else {
444  m_AfterTextBtn->Enable(false);
445  m_AfterTextTxt->Enable(false);
446  m_AfterDigitsBtn->Enable(false);
447  m_AfterLettersBtn->Enable(false);
448  m_AlsoRemoveAfter->Enable(false);
449  }
450  m_CaseBtn->Enable(enable_text_only_options);
451  m_WholeWordBtn->Enable(enable_text_only_options);
452 }
453 
EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX, CAdjustFeaturesForGaps::OnKnownUnknownSelected) EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX1
@ eNone
None specified.
Definition: blast_def.h:326
void OnBeforeTextBtnSelected(wxCommandEvent &event)
wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_BEFORE_TEXT_BTN
static bool ShowToolTips()
Should we show tooltips?
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
void OnBeforeCheckboxClick(wxCommandEvent &event)
wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_BEFORE_CHECKBOX
void CreateControls()
Creates the controls and sizers.
void Init()
Initialises member variables.
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
void OnAfterDigitsBtnSelected(wxCommandEvent &event)
wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_AFTER_DIGITS_BTN
void OnBeforeLettersBtnSelected(wxCommandEvent &event)
wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_BEFORE_LETTERS_BTN
void OnAfterCheckboxClick(wxCommandEvent &event)
wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_AFTER_CHECKBOX
bool Create(wxWindow *parent, wxWindowID id=ID_CREMOVETEXTOUTSIDESTRINGPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
Creation.
CRef< macro::CRemoveTextOptions > GetRemoveTextOptions()
void OnAfterTextBtnSelected(wxCommandEvent &event)
wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_AFTER_TEXT_BTN
void OnAfterLettersBtnSelected(wxCommandEvent &event)
wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_AFTER_LETTERS_BTN
void OnBeforeDigitsBtnSelected(wxCommandEvent &event)
wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_BEFORE_DIGITS_BTN
#define _(proto)
Definition: ct_nlmzip_i.h:78
static void Init(void)
Definition: cursor6.c:76
#define NULL
Definition: ncbistd.hpp:225
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
END_EVENT_TABLE()
@ eText
Definition: map_control.hpp:50
const struct ncbi::grid::netcache::search::fields::SIZE size
Modified on Sun Mar 03 03:13:04 2024 by modify_doxy.py rev. 669887