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

Go to the SVN repository for this file.

1 /* $Id: apply_edit_convert_panel.cpp 43227 2019-05-30 16:00:26Z 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: Igor Filippov
27  */
28 
29 
30 // Generated by DialogBlocks (unregistered), 14/05/2014 15:44:27
31 
32 #include <ncbi_pch.hpp>
33 // Generated by DialogBlocks (unregistered), 16/05/2014 10:25:31
34 
35 // For compilers that support precompilation, includes "wx/wx.h".
36 #include "wx/wxprec.h"
37 
38 #ifdef __BORLANDC__
39 #pragma hdrstop
40 #endif
41 
42 #ifndef WX_PRECOMP
43 #include "wx/wx.h"
44 #endif
45 
46 ////@begin includes
47 ////@end includes
53 
54 ////@begin XPM images
55 ////@end XPM images
56 
58 
59 
60 /*
61  * CApplyEditconvertPanel type definition
62  */
63 
64 IMPLEMENT_DYNAMIC_CLASS( CApplyEditconvertPanel, wxPanel )
65 
66 
67 /*
68  * CApplyEditconvertPanel event table definition
69  */
70 
71 BEGIN_EVENT_TABLE( CApplyEditconvertPanel, wxPanel )
72 
73 ////@begin CApplyEditconvertPanel event table entries
74 
75  EVT_BUTTON( ID_AECR_BUTTON, CApplyEditconvertPanel::OnApplyToAllButtonClick )
76 
77  EVT_BUTTON( ID_AECR_BUTTON1, CApplyEditconvertPanel::OnApplyToSelButtonClick )
78 
79  EVT_BUTTON( ID_AECR_BUTTON2, CApplyEditconvertPanel::OnUndoButtonClick )
80 
81 ////@end CApplyEditconvertPanel event table entries
82 
84 
85 
86 /*
87  * CApplyEditconvertPanel constructors
88  */
89 
91 {
92  Init();
93 }
94 
95 CApplyEditconvertPanel::CApplyEditconvertPanel( wxWindow* parent, CSeqTableGridPanel* grid_panel, wxArrayString &choices,
96  int init_action, bool horizontal, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
97  : m_GridPanel(grid_panel), m_Grid(grid_panel->GetGrid()), m_Choices(&choices), m_init_action(init_action), m_Horizontal(horizontal)
98 {
99  Init();
100  Create(parent, id, pos, size, style);
101 }
102 
103 
104 /*
105  * CApplyEditconvertPanel creator
106  */
107 
108 bool CApplyEditconvertPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
109 {
110 ////@begin CApplyEditconvertPanel creation
111  wxPanel::Create( parent, id, pos, size, style );
112 
113  CreateControls();
114  if (GetSizer())
115  {
116  GetSizer()->SetSizeHints(this);
117  }
118  Centre();
119 ////@end CApplyEditconvertPanel creation
120  return true;
121 }
122 
123 
124 /*
125  * CApplyEditconvertPanel destructor
126  */
127 
129 {
130 ////@begin CApplyEditconvertPanel destruction
131 ////@end CApplyEditconvertPanel destruction
132 }
133 
134 
135 /*
136  * Member initialisation
137  */
138 
140 {
141 ////@begin CApplyEditconvertPanel member initialisation
142 ////@end CApplyEditconvertPanel member initialisation
143  m_Modified = false;
144 }
145 
146 
147 /*
148  * Control creation for CApplyEditconvertPanel
149  */
150 
152 {
153 ////@begin CApplyEditconvertPanel content construction
154  // Generated by DialogBlocks, 16/05/2014 14:02:36 (unregistered)
155 
156  CApplyEditconvertPanel* itemPanel1 = this;
157 
158  wxStaticBox* itemStaticBoxSizer2Static = new wxStaticBox(itemPanel1, wxID_ANY, _("Action"));
159  wxStaticBoxSizer* itemStaticBoxSizer2 = new wxStaticBoxSizer(itemStaticBoxSizer2Static, wxVERTICAL);
160  itemPanel1->SetSizer(itemStaticBoxSizer2);
161 
162  wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
163  itemStaticBoxSizer2->Add(itemBoxSizer3, 1, wxALIGN_LEFT|wxALL, 5);
164 
165  m_Notebook = new wxListbook( itemStaticBoxSizer2->GetStaticBox(), ID_AECR_CHOICE, wxDefaultPosition, wxDefaultSize, wxBK_LEFT);
166  itemBoxSizer3->Add(m_Notebook, 0, wxALIGN_TOP|wxALL, 5);
167 
168  CApplySubpanel *panel1 = new CApplySubpanel( m_Notebook, m_Grid, *m_Choices, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
169  m_Notebook->AddPage(panel1, _("Apply"));
170 
171  CEditSubpanel *panel2 = new CEditSubpanel( m_Notebook, m_Grid, *m_Choices, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
172  m_Notebook->AddPage(panel2, _("Edit"));
173 
174  CRemoveSubpanel *panel3 = new CRemoveSubpanel( m_Notebook, m_Grid, *m_Choices, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
175  m_Notebook->AddPage(panel3, _("Remove"));
176 
177  CSwapSubpanel *panel4 = new CSwapSubpanel( m_Notebook, m_Grid, *m_Choices, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
178  m_Notebook->AddPage(panel4, _("Swap"));
179 
180  CConvertSubpanel *panel5 = new CConvertSubpanel( m_Notebook, m_Grid, *m_Choices, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
181  m_Notebook->AddPage(panel5, _("Convert"));
182 
183  CParseSubpanel *panel6 = new CParseSubpanel(m_Notebook, m_Grid, *m_Choices, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
184  m_Notebook->AddPage(panel6, _("Parse"));
185 
186  CChangeCaseSubpanel *panel7 = new CChangeCaseSubpanel( m_Notebook, m_Grid, *m_Choices, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
187  m_Notebook->AddPage(panel7, _("Change Case"));
188 
189  wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxHORIZONTAL);
190  itemStaticBoxSizer2->Add(itemBoxSizer7, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
191 
192  wxButton* itemButton8 = new wxButton( itemStaticBoxSizer2->GetStaticBox(), ID_AECR_BUTTON, _("Apply To All"), wxDefaultPosition, wxDefaultSize, 0 );
193  itemBoxSizer7->Add(itemButton8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
194 
195  wxButton* itemButton9 = new wxButton( itemStaticBoxSizer2->GetStaticBox(), ID_AECR_BUTTON1, _("Apply To Selected"), wxDefaultPosition, wxDefaultSize, 0 );
196  itemBoxSizer7->Add(itemButton9, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
197 
198  m_UndoButton = new wxButton( itemStaticBoxSizer2->GetStaticBox(), ID_AECR_BUTTON2, _("Undo"), wxDefaultPosition, wxDefaultSize, 0 );
199  itemBoxSizer7->Add(m_UndoButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
200  m_UndoButton->Disable();
201 
202 ////@end CApplyEditconvertPanel content construction
203 }
204 
205 
206 /*
207  * Should we show tooltips?
208  */
209 
211 {
212  return true;
213 }
214 
215 /*
216  * Get bitmap resources
217  */
218 
219 wxBitmap CApplyEditconvertPanel::GetBitmapResource( const wxString& name )
220 {
221  // Bitmap retrieval
222 ////@begin CApplyEditconvertPanel bitmap retrieval
223  wxUnusedVar(name);
224  return wxNullBitmap;
225 ////@end CApplyEditconvertPanel bitmap retrieval
226 }
227 
228 /*
229  * Get icon resources
230  */
231 
232 wxIcon CApplyEditconvertPanel::GetIconResource( const wxString& name )
233 {
234  // Icon retrieval
235 ////@begin CApplyEditconvertPanel icon retrieval
236  wxUnusedVar(name);
237  return wxNullIcon;
238 ////@end CApplyEditconvertPanel icon retrieval
239 }
240 
242 {
243  wxWindow *win = m_Notebook->GetCurrentPage();
244  CSubpanel* panel = dynamic_cast<CSubpanel*>(win);
245  if (panel)
246  return panel->GetListBox();
247  return NULL;
248 }
249 
250 static SrcEditDialog *GetBulkSourceFrame(wxWindow *win)
251 {
252  while (win)
253  {
254  SrcEditDialog *base = dynamic_cast<SrcEditDialog*>(win);
255  if (base)
256  return base;
257  win = win->GetParent();
258  }
259  return NULL;
260 }
261 
262 
264 {
265  int col = -1;
266  int sel = GetListBox()->GetSelection();
267  if (sel == wxNOT_FOUND) return col;
268  for (int i=0; i < m_Grid->GetNumberCols(); i++)
269  if (m_Grid->GetColLabelValue(i) == GetListBox()->GetString(sel))
270  {
271  col = i;
272  break;
273  }
274  if (col == -1)
275  {
276  CApplyEditconvertPanel *parent = this;
277  if (parent)
278  {
279  SrcEditDialog* w = GetBulkSourceFrame(parent);
280  if (w)
281  col = w->GetNewColumn(GetListBox()->GetString(sel));
282  }
283  }
284  return col;
285 }
286 
287 void CApplyEditconvertPanel::GetSelectedRows(std::set<int> &selected)
288 {
289  wxArrayInt wx_selected = m_Grid->GetSelectedRows();
290  if (wx_selected.IsEmpty())
291  {
292  if (m_Grid->GetSelectionBlockTopLeft().size() == 1 && m_Grid->GetSelectionBlockTopLeft().size() == m_Grid->GetSelectionBlockBottomRight().size())
293  {
294  int top_row = m_Grid->GetSelectionBlockTopLeft()[0].GetRow();
295  int bot_row = m_Grid->GetSelectionBlockBottomRight()[0].GetRow();
296  for (int i = top_row; i <= bot_row; i++)
297  {
298  selected.insert(i);
299  }
300  }
301  }
302  else
303  {
304  for (unsigned int i = 0; i < wx_selected.GetCount(); i++)
305  {
306  selected.insert(wx_selected.Item(i));
307  }
308  }
309 }
310 
312 {
313  wxString value;
314  int collapsed_col = m_GridPanel->GetCollapseColAndExpand();
315  int col = GetColumn();
316  if (col < 0)
317  {
318  m_GridPanel->CollapseByCol(collapsed_col);
319  return value;
320  }
321 
322  if (m_Grid->IsSelection())
323  {
324  std::set<int> selected;
325  GetSelectedRows(selected);
326  for (std::set<int>::const_iterator i = selected.begin(); i != selected.end(); ++i)
327  {
328  value = m_Grid->GetCellValue(*i,col);
329  if (!value.IsEmpty())
330  break;
331  }
332  }
333  else
334  {
335  for (int i = 0; i < m_Grid->GetNumberRows(); i++)
336  {
337  value = m_Grid->GetCellValue(i,col);
338  if (!value.IsEmpty())
339  break;
340  }
341  }
342  m_GridPanel->CollapseByCol(collapsed_col);
343  return value;
344 }
345 
346 
347 /*
348  * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_AECR_BUTTON
349  */
350 
352 {
353  int collapsed_col = m_GridPanel->GetCollapseColAndExpand();
354 
355  int col = GetColumn();
356  if (col < 0)
357  {
358  m_GridPanel->CollapseByCol(collapsed_col);
359  return;
360  }
362 
363  wxWindow *win = m_Notebook->GetCurrentPage();
364  CSubpanel* panel = dynamic_cast<CSubpanel*>(win);
365  if (panel)
366  panel->ApplyToAll(col);
367 
368  m_GridPanel->CollapseByCol(collapsed_col);
369  if (!m_undo_values.empty())
370  {
371  m_UndoButton->Enable();
372  m_Modified = true;
373  m_Grid->Refresh();
374  }
375 }
376 
377 
378 /*
379  * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_AECR_BUTTON1
380  */
381 
383 {
384  int collapsed_col = m_GridPanel->GetCollapseColAndExpand();
385 
386  int col = GetColumn();
387  if (col < 0)
388  {
389  m_GridPanel->CollapseByCol(collapsed_col);
390  return;
391  }
392  if (!m_Grid->IsSelection())
393  {
394  m_GridPanel->CollapseByCol(collapsed_col);
395  return;
396  }
398  std::set<int> selected;
399  GetSelectedRows(selected);
400 
401  wxWindow *win = m_Notebook->GetCurrentPage();
402  CSubpanel* panel = dynamic_cast<CSubpanel*>(win);
403  if (panel)
404  panel->ApplyToSelected(col,selected);
405 
406  m_GridPanel->CollapseByCol(collapsed_col);
407  if (!m_undo_values.empty())
408  {
409  m_UndoButton->Enable();
410  m_Modified = true;
411  m_Grid->Refresh();
412  }
413 }
414 
416 {
417  for (int i=0; i<m_Notebook->GetPageCount(); i++)
418  {
419  wxWindow *win = m_Notebook->GetPage(i);
420  CSubpanel* panel = dynamic_cast<CSubpanel*>(win);
421  if (panel)
422  panel->SetColumns(columns);
423  }
424  Refresh();
425 }
426 
427 void CApplyEditconvertPanel::OnUndoButtonClick( wxCommandEvent& event )
428 {
429  int collapsed_col = m_GridPanel->GetCollapseColAndExpand();
430  for (map<int, map<int,string> >::iterator i = m_undo_values.begin(); i != m_undo_values.end(); ++i)
431  for (map<int,string>::iterator j = i->second.begin(); j != i->second.end(); ++j)
432  {
433  int row = i->first;
434  int col = j->first;
435  string val = j->second;
436  m_Grid->SetCellTextColour(row,col, m_Grid->GetDefaultCellTextColour());
437  m_Grid->SetCellValue(row,col,wxString(val));
438  }
439  m_UndoButton->Disable();
440  m_GridPanel->CollapseByCol(collapsed_col);
441 }
442 
443 /*
444  * CSubpanel type definition
445  */
446 
447 IMPLEMENT_DYNAMIC_CLASS( CSubpanel, wxPanel )
448 
449 
450 /*
451  * CSubpanel event table definition
452  */
453 
454 BEGIN_EVENT_TABLE( CSubpanel, wxPanel )
456 
457 objects::edit::EExistingText CSubpanel::GetExistingTextHandling(const string &field)
458 {
460 
461  string msg = "Do you want to overwrite existing values?";
462  int answer = wxMessageBox(ToWxString(msg), wxT("Existing Text"), wxYES_NO | wxCANCEL | wxICON_QUESTION, this);
463  if (answer == wxCANCEL) {
464  existing_text = objects::edit::eExistingText_cancel;
465  } else if (answer == wxYES) {
467  } else {
468  CExistingTextDlg dlg(this);
470  bool allow_add = column->AllowMultipleValues();
471  dlg.AllowAdditionalQual(allow_add);
472  if (dlg.ShowModal() == wxID_OK) {
473  existing_text = dlg.GetExistingTextHandler();
474  } else {
475  existing_text = objects::edit::eExistingText_cancel;
476  }
477  dlg.Close();
478  }
479 
480  return existing_text;
481 }
482 
484 {
485  wxWindow *win = GetParent();
486  while (win)
487  {
488  CApplyEditconvertPanel *base = dynamic_cast<CApplyEditconvertPanel*>(win);
489  if (base)
490  return base;
491  win = win->GetParent();
492  }
493  return NULL;
494 }
495 
496 void CSubpanel::ChangeValue(const string &new_value, int row, int col)
497 {
498  string old_value = this->m_Grid->GetCellValue(row,col).ToStdString();
499  if (old_value != new_value)
500  {
502  if (parent)
503  parent->AddUndo(row,col,old_value);
504  this->m_Grid->SetCellTextColour(row,col,wxColour(255, 160, 0));
505  this->m_Grid->SetCellValue(row,col,wxString(new_value));
506  }
507 }
508 
510 {
511  int col = -1;
512  if (!m_ListBox2)
513  return col;
514  int sel = m_ListBox2->GetSelection();
515  if (sel == wxNOT_FOUND) return col;
516  for (int i=0; i < this->m_Grid->GetNumberCols(); i++)
517  if (this->m_Grid->GetColLabelValue(i) == m_ListBox->GetString(sel))
518  {
519  col = i;
520  break;
521  }
522  if (col == -1)
523  {
525  if (parent)
526  {
527  SrcEditDialog* w = GetBulkSourceFrame(parent);
528  if (w)
529  col = w->GetNewColumn(m_ListBox->GetString(sel));
530  }
531  }
532  return col;
533 }
534 
535 
536 /*
537  * CApplySubpanel type definition
538  */
539 
540 IMPLEMENT_DYNAMIC_CLASS( CApplySubpanel, CSubpanel )
541 
542 
543 /*
544  * CApplySubpanel event table definition
545  */
546 
547 BEGIN_EVENT_TABLE( CApplySubpanel, CSubpanel )
548 
549 ////@begin CApplySubpanel event table entries
550  EVT_BUTTON( ID_APPLYSUB_AUTOPOPULATE, CApplySubpanel::OnApplysubAutopopulateClick )
551 
552  EVT_BUTTON( ID_APPLYSUB_CLEAR, CApplySubpanel::OnApplysubClearClick )
553 
554 ////@end CApplySubpanel event table entries
555 
557 
558 /*
559  * Control creation for CApplySubpanel
560  */
561 
562 void CApplySubpanel::CreateControls()
563 {
564 ////@begin CApplySubpanel content construction
565  // Generated by DialogBlocks, 16/05/2014 16:20:02 (unregistered)
566 
567  CApplySubpanel* itemPanel1 = this;
568 
569  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
570  itemPanel1->SetSizer(itemBoxSizer2);
571 
572  m_ListBox = new wxListBox( itemPanel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, *m_Choices, wxLB_SINGLE );
573  m_ListBox->SetSelection(0);
574  itemBoxSizer2->Add(m_ListBox, 0, wxALIGN_TOP|wxALL, 5);
575 
576  wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL);
577  itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_TOP, 0);
578 
579  m_TextCtrl = new wxTextCtrl( itemPanel1, ID_APPLYSUB_TEXTCTRL, wxEmptyString, wxDefaultPosition, wxSize(300, -1), 0 );
580  itemBoxSizer3->Add(m_TextCtrl, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
581 
582  wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
583  itemBoxSizer3->Add(itemBoxSizer4, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
584 
585  wxButton* itemButton5 = new wxButton( itemPanel1, ID_APPLYSUB_AUTOPOPULATE, _("Autopopulate"), wxDefaultPosition, wxDefaultSize, 0 );
586  itemBoxSizer4->Add(itemButton5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
587 
588  wxButton* itemButton6 = new wxButton( itemPanel1, ID_APPLYSUB_CLEAR, _("Clear"), wxDefaultPosition, wxDefaultSize, 0 );
589  itemBoxSizer4->Add(itemButton6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
590 
591 ////@end CApplySubpanel content construction
592 }
593 
594 /*
595  * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_APPLYSUB_AUTOPOPULATE
596  */
597 
598 void CApplySubpanel::OnApplysubAutopopulateClick( wxCommandEvent& event )
599 {
600  CApplyEditconvertPanel *parent = NULL;
601  wxWindow *win = this;
602  while (win && !parent)
603  {
604  win = win->GetParent();
605  parent = dynamic_cast<CApplyEditconvertPanel*>(win);
606  }
607  if (!parent)
608  return;
609  wxString value = parent-> GetAutopopulateValue();
610  m_TextCtrl->SetValue(value);
611 }
612 
613 
614 /*
615  * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_APPLYSUB_CLEAR
616  */
617 
618 void CApplySubpanel::OnApplysubClearClick( wxCommandEvent& event )
619 {
620  m_TextCtrl->Clear();
621 }
622 
624 {
626  string value = m_TextCtrl->GetValue().ToStdString();
627  if (value.empty())
628  {
629  wxMessageBox(_("Apply value is empty"), wxT("No value entered"), wxOK | wxICON_WARNING, this);
630  return;
631  }
632  bool first = true;
633  for (int i = 0; i < this->m_Grid->GetNumberRows(); i++)
634  if (!this->m_Grid->IsReadOnly(i,col) && this->m_Grid->IsRowShown(i) )
635  {
636  string new_value = this->m_Grid->GetCellValue(i,col).ToStdString();
637  if (!new_value.empty())
638  {
639  if (first)
640  {
641  method = GetExistingTextHandling(m_Grid->GetColLabelValue(col).ToStdString());
642  first = false;
643  }
644  }
646  {
647  AddValueToString(new_value,value,method);
648  ChangeValue(new_value, i, col);
649  }
650  }
651 }
652 
653 void CApplySubpanel::ApplyToSelected(int col, const std::set<int> &selected)
654 {
656  string value = m_TextCtrl->GetValue().ToStdString();
657  if (value.empty())
658  {
659  wxMessageBox(_("Apply value is empty"), wxT("No value entered"), wxOK | wxICON_WARNING, this);
660  return;
661  }
662  bool first = true;
663  for (std::set<int>::const_iterator i = selected.begin(); i != selected.end(); ++i)
664  if (!this->m_Grid->IsReadOnly(*i,col) && this->m_Grid->IsRowShown(*i))
665  {
666  string new_value = this->m_Grid->GetCellValue(*i,col).ToStdString();
667  if (!new_value.empty())
668  {
669  if (first)
670  {
671  method = GetExistingTextHandling(m_Grid->GetColLabelValue(col).ToStdString());
672  first = false;
673  }
674  }
676  {
677  AddValueToString(new_value,value,method);
678  ChangeValue(new_value, *i, col);
679  }
680  }
681 }
682 
683 /*
684  * CEditSubpanel type definition
685  */
686 
687 IMPLEMENT_DYNAMIC_CLASS( CEditSubpanel, CSubpanel )
688 
689 
690 /*
691  * CEditSubpanel event table definition
692  */
693 
694 BEGIN_EVENT_TABLE( CEditSubpanel, CSubpanel )
695 
696  EVT_BUTTON( ID_EDITSUB_AUTOPOPULATE, CEditSubpanel::OnEditsubAutopopulateClick )
697 
698  EVT_BUTTON( ID_EDITSUB_CLEAR, CEditSubpanel::OnEditsubClearClick )
699 
700 ////@begin CEditSubpanel event table entries
701  EVT_BUTTON( ID_EDITSUB_COPY, CEditSubpanel::OnEditsubCopyClick )
702 
703 ////@end CEditSubpanel event table entries
704 
706 
707 
708 /*
709  * Control creation for CEditSubpanel
710  */
711 
712 void CEditSubpanel::CreateControls()
713 {
714 ////@begin CEditSubpanel content construction
715  // Generated by DialogBlocks, 16/05/2014 18:06:49 (unregistered)
716 
717  CEditSubpanel* itemPanel1 = this;
718 
719  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
720  itemPanel1->SetSizer(itemBoxSizer2);
721 
722  m_ListBox = new wxListBox( itemPanel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, *m_Choices, wxLB_SINGLE );
723  m_ListBox->SetSelection(0);
724  itemBoxSizer2->Add(m_ListBox, 0, wxALIGN_TOP|wxALL, 5);
725 
726  wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL);
727  itemBoxSizer2->Add(itemBoxSizer4, 0, wxALIGN_TOP|wxALL, 0);
728 
729  wxStaticText* itemStaticText5 = new wxStaticText( itemPanel1, wxID_STATIC, _("Find"), wxDefaultPosition, wxDefaultSize, 0 );
730  itemBoxSizer4->Add(itemStaticText5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
731 
732  wxStaticText* itemStaticText6 = new wxStaticText( itemPanel1, wxID_STATIC, _("Replace"), wxDefaultPosition, wxDefaultSize, 0 );
733  itemBoxSizer4->Add(itemStaticText6, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
734 
735  wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxVERTICAL);
736  itemBoxSizer2->Add(itemBoxSizer7, 0, wxALIGN_TOP|wxALL, 0);
737 
738  m_Find = new wxTextCtrl( itemPanel1, ID_EDITSUB_FIND, wxEmptyString, wxDefaultPosition, wxSize(250, -1), 0 );
739  itemBoxSizer7->Add(m_Find, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
740 
741  m_Replace = new wxTextCtrl( itemPanel1, ID_EDITSUB_REPLACE, wxEmptyString, wxDefaultPosition, wxSize(250, -1), 0 );
742  itemBoxSizer7->Add(m_Replace, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
743 
744  wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxVERTICAL);
745  itemBoxSizer2->Add(itemBoxSizer10, 0, wxALIGN_TOP|wxALL, 0);
746 
747  wxButton* itemButton11 = new wxButton( itemPanel1, ID_EDITSUB_COPY, _("Copy"), wxDefaultPosition, wxDefaultSize, 0 );
748  itemBoxSizer10->Add(itemButton11, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
749 
750  wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxHORIZONTAL);
751  itemBoxSizer7->Add(itemBoxSizer12, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
752 
753  m_Anywhere = new wxRadioButton( itemPanel1, ID_EDITSUB_ANY, _("Anywhere"), wxDefaultPosition, wxDefaultSize, 0 );
754  m_Anywhere->SetValue(true);
755  itemBoxSizer12->Add(m_Anywhere, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
756 
757  m_AtBegin = new wxRadioButton( itemPanel1, ID_EDITSUB_BEG, _("At the beginning"), wxDefaultPosition, wxDefaultSize, 0 );
758  m_AtBegin->SetValue(false);
759  itemBoxSizer12->Add(m_AtBegin, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
760 
761  m_AtEnd = new wxRadioButton( itemPanel1, ID_EDITSUB_END, _("At the end"), wxDefaultPosition, wxDefaultSize, 0 );
762  m_AtEnd->SetValue(false);
763  itemBoxSizer12->Add(m_AtEnd, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
764 
765  wxBoxSizer* itemBoxSizer16 = new wxBoxSizer(wxHORIZONTAL);
766  itemBoxSizer7->Add(itemBoxSizer16, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 2);
767 
768  wxButton* itemButton17 = new wxButton( itemPanel1, ID_EDITSUB_AUTOPOPULATE, _("Autopopulate"), wxDefaultPosition, wxDefaultSize, 0 );
769  itemBoxSizer16->Add(itemButton17, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
770 
771  wxButton* itemButton18 = new wxButton( itemPanel1, ID_EDITSUB_CLEAR, _("Clear"), wxDefaultPosition, wxDefaultSize, 0 );
772  itemBoxSizer16->Add(itemButton18, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
773 
774 ////@end CEditSubpanel content construction
775 }
776 
777 /*
778  * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_EDITSUB_COPY
779  */
780 
781 void CEditSubpanel::OnEditsubCopyClick( wxCommandEvent& event )
782 {
783  wxString val = m_Find->GetValue();
784  m_Replace->SetValue(val);
785 }
786 
787 /*
788  * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_EDITSUB_AUTOPOPULATE
789  */
790 
791 void CEditSubpanel::OnEditsubAutopopulateClick( wxCommandEvent& event )
792 {
793  CApplyEditconvertPanel *parent = NULL;
794  wxWindow *win = this;
795  while (win && !parent)
796  {
797  win = win->GetParent();
798  parent = dynamic_cast<CApplyEditconvertPanel*>(win);
799  }
800 
801  if (!parent) return;
802  wxString value = parent-> GetAutopopulateValue();
803  m_Find->SetValue(value);
804 }
805 
806 
807 /*
808  * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_EDITSUB_CLEAR
809  */
810 
811 void CEditSubpanel::OnEditsubClearClick( wxCommandEvent& event )
812 {
813  m_Find->Clear();
814 }
815 
817 {
818  string find = m_Find->GetValue().ToStdString();
819  if (find.empty())
820  {
821  wxMessageBox(_("Find value is empty"), wxT("No value entered"), wxOK | wxICON_WARNING, this);
822  return;
823  }
824  string replace = m_Replace->GetValue().ToStdString();
825  bool any = m_Anywhere->GetValue();
826  bool start = m_AtBegin->GetValue();
827  bool end = m_AtEnd->GetValue();
828 
829  for (int i = 0; i < this->m_Grid->GetNumberRows(); i++)
830  if (!this->m_Grid->IsReadOnly(i,col) && this->m_Grid->IsRowShown(i))
831  {
832  string source = this->m_Grid->GetCellValue(i,col).ToStdString();
833  if (any)
834  {
835  string new_value = NStr::Replace(source,find,replace);
836  ChangeValue(new_value,i,col);
837  continue;
838  }
839  if (start && NStr::StartsWith(source,find))
840  {
841  string new_value = NStr::Replace(source,find,replace,0,1);
842  ChangeValue(new_value,i,col);
843  continue;
844  }
845  if (end && NStr::EndsWith(source,find))
846  {
847  size_t pos = source.length() - find.length();
848  string new_value = NStr::Replace(source,find,replace,pos,1);
849  ChangeValue(new_value,i,col);
850  continue;
851  }
852 
853  }
854 
855 }
856 
857 void CEditSubpanel::ApplyToSelected(int col, const std::set<int> &selected)
858 {
859  string find = m_Find->GetValue().ToStdString();
860  if (find.empty())
861  {
862  wxMessageBox(_("Find value is empty"), wxT("No value entered"), wxOK | wxICON_WARNING, this);
863  return;
864  }
865  string replace = m_Replace->GetValue().ToStdString();
866  bool any = m_Anywhere->GetValue();
867  bool start = m_AtBegin->GetValue();
868  bool end = m_AtEnd->GetValue();
869 
870  for (std::set<int>::const_iterator i = selected.begin(); i != selected.end(); ++i)
871  if (!this->m_Grid->IsReadOnly(*i,col) && this->m_Grid->IsRowShown(*i))
872  {
873  string source = this->m_Grid->GetCellValue(*i,col).ToStdString();
874  if (any)
875  {
876 
877  string new_value = NStr::Replace(source,find,replace);
878  ChangeValue(new_value,*i,col);
879  continue;
880  }
881  if (start && NStr::StartsWith(source,find))
882  {
883  string new_value = NStr::Replace(source,find,replace,0,1);
884  ChangeValue(new_value,*i,col);
885  continue;
886  }
887  if (end && NStr::EndsWith(source,find))
888  {
889  size_t pos = source.length() - find.length();
890  string new_value = NStr::Replace(source,find,replace,pos,1);
891  ChangeValue(new_value,*i,col);
892  continue;
893  }
894 
895  }
896 
897 }
898 
899 
900 /*
901  * CRemoveSubpanel type definition
902  */
903 
904 IMPLEMENT_DYNAMIC_CLASS( CRemoveSubpanel, CSubpanel )
905 
906 
907 /*
908  * CRemoveSubpanel event table definition
909  */
910 
911 BEGIN_EVENT_TABLE( CRemoveSubpanel, CSubpanel )
912 
914 
915 /*
916  * Control creation for CRemoveSubpanel
917  */
918 
919 void CRemoveSubpanel::CreateControls()
920 {
921 ////@begin CRemoveSubpanel content construction
922  // Generated by DialogBlocks, 16/05/2014 18:06:49 (unregistered)
923 
924  CRemoveSubpanel* itemPanel1 = this;
925 
926  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
927  itemPanel1->SetSizer(itemBoxSizer2);
928 
929  m_ListBox = new wxListBox( itemPanel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, *m_Choices, wxLB_SINGLE );
930  m_ListBox->SetSelection(0);
931  itemBoxSizer2->Add(m_ListBox, 0, wxALIGN_TOP|wxALL, 5);
932 
933 ////@end CRemoveSubpanel content construction
934 }
935 
936 
938 {
939  for (int i = 0; i < this->m_Grid->GetNumberRows(); i++)
940  if (!this->m_Grid->IsReadOnly(i,col) && this->m_Grid->IsRowShown(i))
941  {
942  ChangeValue(kEmptyStr,i,col);
943  }
944 }
945 
946 void CRemoveSubpanel::ApplyToSelected(int col, const std::set<int> &selected)
947 {
948 
949  for (std::set<int>::const_iterator i = selected.begin(); i != selected.end(); ++i)
950  if (!this->m_Grid->IsReadOnly(*i,col) && this->m_Grid->IsRowShown(*i))
951  {
952  ChangeValue(kEmptyStr,*i,col);
953  }
954 
955 }
956 
957 
958 
959 /*
960  * CSwapSubpanel type definition
961  */
962 
963 IMPLEMENT_DYNAMIC_CLASS( CSwapSubpanel, CSubpanel )
964 
965 BEGIN_EVENT_TABLE( CSwapSubpanel, CSubpanel )
966 
968 
969 void CSwapSubpanel::CreateControls()
970 {
971  CSwapSubpanel* itemPanel1 = this;
972 
973  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
974  itemPanel1->SetSizer(itemBoxSizer2);
975 
976  m_ListBox = new wxListBox( itemPanel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, *m_Choices, wxLB_SINGLE );
977  m_ListBox->SetSelection(0);
978  itemBoxSizer2->Add(m_ListBox, 0, wxALIGN_TOP|wxALL, 5);
979 
980  m_ListBox2 = new wxListBox( itemPanel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, *m_Choices, wxLB_SINGLE );
981  m_ListBox2->SetSelection(0);
982  itemBoxSizer2->Add(m_ListBox2, 0, wxALIGN_TOP|wxALL, 5);
983 }
984 
985 
987 {
988  int col2 = GetColumn2();
989  if (col2 < 0 ) return;
990  if (col == col2) return;
991 
992  for (int i = 0; i < this->m_Grid->GetNumberRows(); i++)
993  if (!this->m_Grid->IsReadOnly(i,col) && !this->m_Grid->IsReadOnly(i,col2) && this->m_Grid->IsRowShown(i))
994  {
995  wxString value = this->m_Grid->GetCellValue(i,col);
996  wxString value2 = this->m_Grid->GetCellValue(i,col2);
997  ChangeValue(value2.ToStdString(),i,col);
998  ChangeValue(value.ToStdString(),i,col2);
999  }
1000 }
1001 
1002 void CSwapSubpanel::ApplyToSelected(int col, const std::set<int> &selected)
1003 {
1004  int col2 = GetColumn2();
1005  if (col2 < 0 ) return;
1006  if (col == col2) return;
1007 
1008  for (std::set<int>::const_iterator i = selected.begin(); i != selected.end(); ++i)
1009  if (!this->m_Grid->IsReadOnly(*i,col) && !this->m_Grid->IsReadOnly(*i,col2) && this->m_Grid->IsRowShown(*i))
1010  {
1011  wxString value = this->m_Grid->GetCellValue(*i,col);
1012  wxString value2 = this->m_Grid->GetCellValue(*i,col2);
1013  ChangeValue(value2.ToStdString(),*i,col);
1014  ChangeValue(value.ToStdString(),*i,col2);
1015  }
1016 
1017 }
1018 
1019 
1020 /*
1021  * CConvertSubpanel type definition
1022  */
1023 
1024 IMPLEMENT_DYNAMIC_CLASS( CConvertSubpanel, CSubpanel )
1025 
1026 BEGIN_EVENT_TABLE( CConvertSubpanel, CSubpanel )
1027 
1029 
1030 void CConvertSubpanel::CreateControls()
1031 {
1032  CConvertSubpanel* itemPanel1 = this;
1033 
1034  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
1035  itemPanel1->SetSizer(itemBoxSizer2);
1036 
1037  wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
1038  itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_TOP|wxALL, 0);
1039 
1040  m_ListBox = new wxListBox( itemPanel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, *m_Choices, wxLB_SINGLE );
1041  m_ListBox->SetSelection(0);
1042  itemBoxSizer3->Add(m_ListBox, 0, wxALIGN_TOP|wxALL, 5);
1043 
1044  m_ListBox2 = new wxListBox( itemPanel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, *m_Choices, wxLB_SINGLE );
1045  m_ListBox2->SetSelection(0);
1046  itemBoxSizer3->Add(m_ListBox2, 0, wxALIGN_TOP|wxALL, 5);
1047 
1048  m_CheckBox = new wxCheckBox (itemPanel1, wxID_ANY, _("Leave on original"));
1049  itemBoxSizer2->Add(m_CheckBox, 0, wxALIGN_LEFT|wxALL, 5);
1050 }
1051 
1052 
1054 {
1055  int col2 = GetColumn2();
1056  if (col2 < 0 ) return;
1057 
1058  if (col == col2) return;
1059 
1060  bool first = true;
1062  for (int i = 0; i < this->m_Grid->GetNumberRows(); i++)
1063  if (!this->m_Grid->IsReadOnly(i,col) && !this->m_Grid->IsReadOnly(i,col2) && this->m_Grid->IsRowShown(i))
1064  {
1065  string value = this->m_Grid->GetCellValue(i,col).ToStdString();
1066  string existing_value = this->m_Grid->GetCellValue(i,col2).ToStdString();
1067  if (first && !existing_value.empty())
1068  {
1069  method = GetExistingTextHandling(m_Grid->GetColLabelValue(col2).ToStdString());
1070  first = false;
1071  }
1073  {
1074  AddValueToString(existing_value,value,method);
1075  ChangeValue(existing_value, i, col2);
1076  if (!m_CheckBox->GetValue())
1077  {
1078  ChangeValue(kEmptyStr,i,col);
1079  }
1080  }
1081  }
1082 }
1083 
1084 void CConvertSubpanel::ApplyToSelected(int col, const std::set<int> &selected)
1085 {
1086  int col2 = GetColumn2();
1087  if (col2 < 0 ) return;
1088  if (col == col2) return;
1089  bool first = true;
1091  for (std::set<int>::const_iterator i = selected.begin(); i != selected.end(); ++i)
1092  if (!this->m_Grid->IsReadOnly(*i,col) && !this->m_Grid->IsReadOnly(*i,col2) && this->m_Grid->IsRowShown(*i))
1093  {
1094  string value = this->m_Grid->GetCellValue(*i,col).ToStdString();
1095  string existing_value = this->m_Grid->GetCellValue(*i,col2).ToStdString();
1096  if (first && !existing_value.empty())
1097  {
1098  method = GetExistingTextHandling(m_Grid->GetColLabelValue(col2).ToStdString());
1099  first = false;
1100  }
1102  {
1103  AddValueToString(existing_value,value,method);
1104  ChangeValue(existing_value, *i, col2);
1105  this->m_Grid->SetCellTextColour(*i,col2,wxColour(255, 160, 0));
1106  this->m_Grid->SetCellValue(*i,col2,wxString(existing_value));
1107  if (!m_CheckBox->GetValue())
1108  {
1109  ChangeValue(kEmptyStr,*i,col);
1110  }
1111  }
1112  }
1113 
1114 }
1115 
1116 
1117 
1118 /*
1119  * CParseSubpanel type definition
1120  */
1121 
1122 IMPLEMENT_DYNAMIC_CLASS( CParseSubpanel, CSubpanel )
1123 
1124 BEGIN_EVENT_TABLE( CParseSubpanel, CSubpanel )
1125 
1127 
1128 void CParseSubpanel::CreateControls()
1129 {
1130  CParseSubpanel* itemPanel1 = this;
1131 
1132  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
1133  itemPanel1->SetSizer(itemBoxSizer2);
1134 
1135  wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
1136  itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_TOP|wxALL, 0);
1137 
1138  m_ListBox = new wxListBox( itemPanel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, *m_Choices, wxLB_SINGLE );
1139  m_ListBox->SetSelection(0);
1140  itemBoxSizer3->Add(m_ListBox, 0, wxALIGN_TOP|wxALL, 5);
1141 
1142  m_ListBox2 = new wxListBox( itemPanel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, *m_Choices, wxLB_SINGLE );
1143  m_ListBox2->SetSelection(0);
1144  itemBoxSizer3->Add(m_ListBox2, 0, wxALIGN_TOP|wxALL, 5);
1145 
1146  m_ParseOptions = new CParseTextOptionsDlg( itemPanel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER );
1147  itemBoxSizer2->Add(m_ParseOptions, 0, wxALIGN_LEFT|wxALL, 5);
1148 
1149 }
1150 
1152 {
1153  int col2 = GetColumn2();
1154  if (col2 < 0 ) return;
1155  if (col == col2) return;
1157  bool first = true;
1159  for (int i = 0; i < this->m_Grid->GetNumberRows(); i++)
1160  if (!this->m_Grid->IsReadOnly(i,col) && !this->m_Grid->IsReadOnly(i,col2) && this->m_Grid->IsRowShown(i))
1161  {
1162  string value = this->m_Grid->GetCellValue(i,col).ToStdString();
1163  string value2 = this->m_Grid->GetCellValue(i,col2).ToStdString();
1164  string new_val = m_ParseOptions->GetSelectedText(value);
1165  if (new_val.empty() || new_val == value2) continue;
1166  if (parse_options->ShouldRemoveFromParsed())
1167  parse_options->RemoveSelectedText(value);
1168 
1169  if (first && !value2.empty())
1170  {
1171  method = GetExistingTextHandling(m_Grid->GetColLabelValue(col2).ToStdString());
1172  first = false;
1173  }
1175  {
1176  AddValueToString(value2,new_val,method);
1177  ChangeValue(value2, i, col2);
1178  ChangeValue(value,i,col);
1179  }
1180  }
1181 }
1182 
1183 void CParseSubpanel::ApplyToSelected(int col, const std::set<int> &selected)
1184 {
1185  int col2 = GetColumn2();
1186  if (col2 < 0 ) return;
1187  if (col == col2) return;
1189  bool first = true;
1191  for (std::set<int>::const_iterator i = selected.begin(); i != selected.end(); ++i)
1192  if (!this->m_Grid->IsReadOnly(*i,col) && !this->m_Grid->IsReadOnly(*i,col2) && this->m_Grid->IsRowShown(*i))
1193  {
1194  string value = this->m_Grid->GetCellValue(*i,col).ToStdString();
1195  string value2 = this->m_Grid->GetCellValue(*i,col2).ToStdString();
1196  string new_val = m_ParseOptions->GetSelectedText(value);
1197  if (new_val.empty() || new_val == value2) continue;
1198  if (parse_options->ShouldRemoveFromParsed())
1199  parse_options->RemoveSelectedText(value);
1200  if (first && !value2.empty())
1201  {
1202  method = GetExistingTextHandling(m_Grid->GetColLabelValue(col2).ToStdString());
1203  first = false;
1204  }
1206  {
1207  AddValueToString(value2,new_val,method);
1208  ChangeValue(value2, *i, col2);
1209  ChangeValue(value,*i,col);
1210  }
1211  }
1212 
1213 }
1214 
1215 
1216 /*
1217  * CChangeCaseSubpanel type definition
1218  */
1219 
1220 IMPLEMENT_DYNAMIC_CLASS( CChangeCaseSubpanel, CSubpanel )
1221 
1222 BEGIN_EVENT_TABLE( CChangeCaseSubpanel, CSubpanel )
1223 
1225 
1226 void CChangeCaseSubpanel::CreateControls()
1227 {
1228  CChangeCaseSubpanel* itemPanel1 = this;
1229 
1230  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
1231  itemPanel1->SetSizer(itemBoxSizer2);
1232 
1233  m_ListBox = new wxListBox( itemPanel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, *m_Choices, wxLB_SINGLE );
1234  m_ListBox->SetSelection(0);
1235  itemBoxSizer2->Add(m_ListBox, 0, wxALIGN_LEFT|wxALL, 5);
1236 
1237  m_CapChangeOptions = new CCapChangePanel(itemPanel1);
1238  itemBoxSizer2->Add(m_CapChangeOptions, 0, wxALIGN_LEFT|wxALL, 5);
1239 }
1240 
1241 
1243 {
1244  for (int i = 0; i < this->m_Grid->GetNumberRows(); i++)
1245  if (!this->m_Grid->IsReadOnly(i,col) && this->m_Grid->IsRowShown(i))
1246  {
1247  string value = this->m_Grid->GetCellValue(i,col).ToStdString();
1249  objects::CSeq_entry_Handle seh;
1250  FixCapitalizationInString(seh, value, cap_change);
1251  ChangeValue(value,i,col);
1252  }
1253 }
1254 
1255 void CChangeCaseSubpanel::ApplyToSelected(int col, const std::set<int> &selected)
1256 {
1257  for (std::set<int>::const_iterator i = selected.begin(); i != selected.end(); ++i)
1258  if (!this->m_Grid->IsReadOnly(*i,col) && this->m_Grid->IsRowShown(*i))
1259  {
1260  string value = this->m_Grid->GetCellValue(*i,col).ToStdString();
1262  objects::CSeq_entry_Handle seh;
1263  FixCapitalizationInString(seh, value, cap_change);
1264  ChangeValue(value,*i,col);
1265  }
1266 
1267 }
1268 
static SrcEditDialog * GetBulkSourceFrame(wxWindow *win)
void Init()
Initialises member variables.
void GetSelectedRows(std::set< int > &selected)
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
map< int, map< int, string > > m_undo_values
void CreateControls()
Creates the controls and sizers.
void OnUndoButtonClick(wxCommandEvent &event)
static bool ShowToolTips()
Should we show tooltips?
void OnApplyToAllButtonClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_AECR_BUTTON
void AddUndo(int i, int j, const string &val)
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
void OnApplyToSelButtonClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_AECR_BUTTON1
void SetColumns(wxArrayString &columns)
bool Create(wxWindow *parent, wxWindowID id=ID_CAPPLYEDITCONVERTPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
Creation.
void OnApplysubAutopopulateClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_APPLYSUB_AUTOPOPULATE
void OnApplysubClearClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_APPLYSUB_CLEAR
virtual void ApplyToAll(int col)
virtual void ApplyToSelected(int col, const std::set< int > &selected)
objects::ECapChange GetCapitalizationRequest()
virtual void ApplyToAll(int col)
virtual void ApplyToSelected(int col, const std::set< int > &selected)
CCapChangePanel * m_CapChangeOptions
virtual void ApplyToSelected(int col, const std::set< int > &selected)
virtual void ApplyToAll(int col)
void OnEditsubCopyClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_EDITSUB_COPY
virtual void ApplyToAll(int col)
wxRadioButton * m_Anywhere
void OnEditsubAutopopulateClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_EDITSUB_AUTOPOPULATE
virtual void ApplyToSelected(int col, const std::set< int > &selected)
void OnEditsubClearClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_EDITSUB_CLEAR
objects::edit::EExistingText GetExistingTextHandler()
void AllowAdditionalQual(bool val)
CParseTextOptionsDlg * m_ParseOptions
virtual void ApplyToAll(int col)
virtual void ApplyToSelected(int col, const std::set< int > &selected)
string GetSelectedText(const string &input)
CRef< objects::edit::CParseTextOptions > GetParseOptions()
virtual void ApplyToSelected(int col, const std::set< int > &selected)
virtual void ApplyToAll(int col)
void CollapseByCol(int col)
int GetCollapseColAndExpand(void)
virtual void ApplyToAll(int col)
CApplyEditconvertPanel * GetBaseFrame()
void ChangeValue(const string &new_value, int row, int col)
wxListBox * GetListBox()
virtual void SetColumns(wxArrayString &columns)
objects::edit::EExistingText GetExistingTextHandling(const string &field)
virtual void ApplyToSelected(int col, const std::set< int > &selected)
virtual void ApplyToAll(int col)
virtual void ApplyToSelected(int col, const std::set< int > &selected)
int GetNewColumn(wxString new_col)
const_iterator begin() const
Definition: map.hpp:151
const_iterator end() const
Definition: map.hpp:152
bool empty() const
Definition: map.hpp:149
void clear()
Definition: map.hpp:169
Definition: map.hpp:338
#define _(proto)
Definition: ct_nlmzip_i.h:78
static auto & FixCapitalizationInString
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
Definition: dlist.tmpl.h:46
static char col2[256]
Definition: compute.c:13
static void Init(void)
Definition: cursor6.c:76
static const char * column
Definition: stats.c:23
static const column_t columns[]
Definition: utf8_2.c:22
#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
#define kEmptyStr
Definition: ncbistr.hpp:123
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
Definition: ncbistr.hpp:5430
static string & Replace(const string &src, const string &search, const string &replace, string &dst, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
Definition: ncbistr.cpp:3314
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
Definition: ncbistr.hpp:5412
END_EVENT_TABLE()
int i
#define wxT(x)
Definition: muParser.cpp:41
Definition: fix_pub.hpp:45
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
const CharType(& source)[N]
Definition: pointer.h:1149
static static static wxID_ANY
#define row(bind, expected)
Definition: string_bind.c:73
EExistingText
@ eExistingText_cancel
@ eExistingText_replace_old
bool AddValueToString(string &str, const string &value, EExistingText existing_text)
Add text to an existing string, using the "existing_text" directive to combine new text with existing...
wxString ToWxString(const string &s)
Definition: wx_utils.hpp:173
#define const
Definition: zconf.h:232
Modified on Sat Apr 13 11:47:19 2024 by modify_doxy.py rev. 669887