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

Go to the SVN repository for this file.

1 /* $Id: macro_applysrc_table.cpp 47464 2023-04-20 00:19:10Z evgeniev $
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: Andrea Asztalos
27 *
28 */
29 
30 #include <ncbi_pch.hpp>
31 #include <util/line_reader.hpp>
39 
40 #include <wx/sizer.h>
41 #include <wx/stattext.h>
42 #include <wx/statbox.h>
43 #include <wx/scrolwin.h>
44 #include <wx/textctrl.h>
45 #include <wx/filedlg.h>
46 #include <wx/radiobut.h>
47 #include <wx/listctrl.h>
48 
51 
52 /*
53  * CMacroApplySrcTablePanel type definition
54  */
55 
56 IMPLEMENT_DYNAMIC_CLASS( CMacroApplySrcTablePanel, wxPanel)
57 
58 
59 /*
60  * CMacroApplySrcTablePanel event table definition
61  */
62 
63 BEGIN_EVENT_TABLE( CMacroApplySrcTablePanel, wxPanel)
64 
71  EVT_TEXT(ID_APPLYSRCTBLFILE, CMacroApplySrcTablePanel::OnNewFileEntered)
72  EVT_TEXT(ID_APPLYTBLTXT1, CMacroApplySrcTablePanel::OnDelimiterSelected)
74 
75 
76 /*
77  * CMacroApplySrcTablePanel constructors
78  */
79 
81 {
82  Init();
83 }
84 
85 CMacroApplySrcTablePanel::CMacroApplySrcTablePanel( wxWindow* parent, EMacroFieldType field_type, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
86  : m_FieldType(field_type)
87 {
88  Init();
89  Create(parent, id, pos, size, style);
90 }
91 
92 
93 /*
94  * CMacroApplySrcTablePanel creator
95  */
96 
97 bool CMacroApplySrcTablePanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
98 {
99 ////@begin CMacroApplySrcTablePanel creation
100  SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
101  wxPanel::Create( parent, id, pos, size, style );
102 
103  CreateControls();
104  if (GetSizer())
105  {
106  GetSizer()->SetSizeHints(this);
107  }
108  Centre();
109 ////@end CMacroApplySrcTablePanel creation
110  return true;
111 }
112 
113 
114 /*
115  * CMacroApplySrcTablePanel destructor
116  */
117 
119 {
120 ////@begin CMacroApplySrcTablePanel destruction
121 ////@end CMacroApplySrcTablePanel destruction
122 }
123 
124 
125 /*
126  * Member initialisation
127  */
128 
130 {
131  m_ScrolledWindow = nullptr;
132  m_Sizer = nullptr;
133  m_TablePreview = nullptr;
134  m_Filename = nullptr;
135  m_QualLabel = nullptr;
136  m_Tabdel = nullptr;
137  m_Semidel = nullptr;
138  m_Commadel = nullptr;
139  m_Spacedel = nullptr;
140  m_Otherdel = nullptr;
141  m_OtherText = nullptr;
142  m_MergeDel = nullptr;
143  m_SplitFirstCol = nullptr;
144  m_ConvertMulti = m_MergeTwoCols = nullptr;
145 }
146 
147 /*
148  * Control creation for CMacroApplySrcTablePanel
149  */
150 
152 {
153 ////@begin CMacroApplySrcTablePanel content construction
154  CMacroApplySrcTablePanel* itemPanel1 = this;
155 
156  wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
157  itemPanel1->SetSizer(itemBoxSizer2);
158 
159  wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
160  itemBoxSizer2->Add(itemBoxSizer4, 0, wxGROW|wxALL, 0);
161 
162  wxFlexGridSizer* itemFlexGridSizer5 = new wxFlexGridSizer(0, 1, 0, 0);
163  itemBoxSizer4->Add(itemFlexGridSizer5, 0, wxGROW|wxALL, 0);
164 
165  wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxHORIZONTAL);
166  itemFlexGridSizer5->Add(itemBoxSizer6, 0, wxGROW|wxALL, 0);
167 
168  wxStaticText* itemStaticText7 = new wxStaticText( itemPanel1, wxID_STATIC, _("Table:"), wxDefaultPosition, wxDefaultSize, 0 );
169  itemBoxSizer6->Add(itemStaticText7, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxBOTTOM, 5);
170 
171  m_Filename = new wxTextCtrl( itemPanel1, ID_APPLYSRCTBLFILE, wxEmptyString, wxDefaultPosition, wxSize(261, -1), 0 );
172  itemBoxSizer6->Add(m_Filename, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5);
173 
174  wxBitmapButton* itemBitmapButton9 = new wxBitmapButton( itemPanel1, ID_APPLYSRCTBLBTMBTN, wxArtProvider::GetBitmap(wxT("menu::open")), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
175  itemBoxSizer6->Add(itemBitmapButton9, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxBOTTOM, 5);
176  itemBitmapButton9->Bind(wxEVT_BUTTON, &CMacroApplySrcTablePanel::OnOpenFile, this);
177 
178  wxBoxSizer* itemBoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
179  itemFlexGridSizer5->Add(itemBoxSizer1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 0);
180 
181  m_QualLabel = new wxStaticText( itemPanel1, wxID_STATIC, _("Qualifiers"), wxDefaultPosition, wxDefaultSize, 0 );
182  itemBoxSizer1->Add(m_QualLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5);
183 
184  itemBoxSizer1->Add(110, 5, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 0);
185 
186  wxStaticText* itemStaticText5 = new wxStaticText( itemPanel1, wxID_STATIC, _("Column"), wxDefaultPosition, wxDefaultSize, 0 );
187  itemBoxSizer1->Add(itemStaticText5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
188 
189  wxStaticText* itemStaticText8 = new wxStaticText( itemPanel1, wxID_STATIC, _("Match"), wxDefaultPosition, wxDefaultSize, 0 );
190  itemBoxSizer1->Add(itemStaticText8, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxBOTTOM|wxTOP, 5);
191 
192  wxHyperlinkCtrl* itemHyperlinkCtrl10 = new wxHyperlinkCtrl( itemPanel1, ID_APPLYSRCTBLADDQUAL, _("Add qualifier"), wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
193  itemBoxSizer1->Add(itemHyperlinkCtrl10, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
194  itemHyperlinkCtrl10->SetForegroundColour(wxColour(128, 128, 128));
195  itemHyperlinkCtrl10->Bind(wxEVT_HYPERLINK, &CMacroApplySrcTablePanel::OnHyperlinkClicked, this);
196 
197  m_ScrolledWindow = new wxScrolledWindow( itemPanel1, ID_APPLYSRCTBLWND, wxDefaultPosition, wxSize(110, 96), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL );
198  itemFlexGridSizer5->Add(m_ScrolledWindow, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 2);
199  m_Sizer = new wxFlexGridSizer(0, 2, 0, 0);
200  m_ScrolledWindow->SetSizer(m_Sizer);
201 
202  x_AddEmptyRow();
203 
204  wxStaticBox* itemStaticBoxSizer2Static = new wxStaticBox(itemPanel1, wxID_ANY, _("Delimiter"));
205  wxStaticBoxSizer* itemStaticBoxSizer2 = new wxStaticBoxSizer(itemStaticBoxSizer2Static, wxVERTICAL);
206  itemBoxSizer4->Add(itemStaticBoxSizer2, 0, wxALIGN_TOP|wxLEFT|wxRIGHT|wxBOTTOM, 5);
207 
208  m_Tabdel = new wxRadioButton( itemPanel1, ID_APPLYTBLRBTN1, _("Tab"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
209  m_Tabdel->SetValue(true);
210  itemStaticBoxSizer2->Add(m_Tabdel, 0, wxALIGN_LEFT|wxALL, 5);
211 
212  m_Semidel = new wxRadioButton( itemPanel1, ID_APPLYTBLRBTN2, _("Semicolon"), wxDefaultPosition, wxDefaultSize, 0 );
213  m_Semidel->SetValue(false);
214  itemStaticBoxSizer2->Add(m_Semidel, 0, wxALIGN_LEFT|wxALL, 5);
215 
216  m_Commadel = new wxRadioButton( itemPanel1, ID_APPLYTBLRBTN3, _("Comma"), wxDefaultPosition, wxDefaultSize, 0 );
217  m_Commadel->SetValue(false);
218  itemStaticBoxSizer2->Add(m_Commadel, 0, wxALIGN_LEFT|wxALL, 5);
219 
220  m_Spacedel = new wxRadioButton( itemPanel1, ID_APPLYTBLRBTN4, _("Space"), wxDefaultPosition, wxDefaultSize, 0 );
221  m_Spacedel->SetValue(false);
222  itemStaticBoxSizer2->Add(m_Spacedel, 0, wxALIGN_LEFT|wxALL, 5);
223 
224  wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxHORIZONTAL);
225  itemStaticBoxSizer2->Add(itemBoxSizer10, 0, wxALIGN_LEFT|wxALL, 0);
226 
227  m_Otherdel = new wxRadioButton( itemPanel1, ID_APPLYTBLRBTN5, _("Other"), wxDefaultPosition, wxDefaultSize, 0 );
228  m_Otherdel->SetValue(false);
229  itemBoxSizer10->Add(m_Otherdel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5);
230 
231  m_OtherText = new wxTextCtrl( itemPanel1, ID_APPLYTBLTXT1, wxEmptyString, wxDefaultPosition, wxSize(25, -1), 0 );
232  itemBoxSizer10->Add(m_OtherText, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5);
233 
234  wxStaticBox* itemStaticBoxSizer1Static = new wxStaticBox(itemPanel1, wxID_ANY, _("Options"));
235  wxStaticBoxSizer* itemStaticBoxSizer1 = new wxStaticBoxSizer(itemStaticBoxSizer1Static, wxVERTICAL);
236  itemBoxSizer4->Add(itemStaticBoxSizer1, 0, wxALIGN_TOP|wxRIGHT|wxBOTTOM, 5);
237 
238  m_MergeDel = new wxCheckBox( itemPanel1, ID_APPLYTBLCB1, _("Merge adjacent delimiters"), wxDefaultPosition, wxDefaultSize, 0 );
239  m_MergeDel->SetValue(false);
240  itemStaticBoxSizer1->Add(m_MergeDel, 0, wxALIGN_LEFT|wxALL, 5);
241 
242  m_SplitFirstCol = new wxCheckBox( itemPanel1, ID_APPLYTBLCB2, _("Split first column at first space"), wxDefaultPosition, wxDefaultSize, 0 );
243  m_SplitFirstCol->SetValue(false);
244  itemStaticBoxSizer1->Add(m_SplitFirstCol, 0, wxALIGN_LEFT|wxALL, 5);
245 
246  m_ConvertMulti = new wxCheckBox( itemPanel1, ID_APPLYTBLCB3, _("Convert multispaces to tabs"), wxDefaultPosition, wxDefaultSize, 0 );
247  m_ConvertMulti->SetValue(false);
248  itemStaticBoxSizer1->Add(m_ConvertMulti, 0, wxALIGN_LEFT|wxALL, 5);
249 
250  m_MergeTwoCols = new wxCheckBox( itemPanel1, ID_APPLYTBLCB4, _("Merge first two columns for ID"), wxDefaultPosition, wxDefaultSize, 0 );
251  m_MergeTwoCols->SetValue(false);
252  itemStaticBoxSizer1->Add(m_MergeTwoCols, 0, wxALIGN_LEFT|wxALL, 5);
253 
254  m_TablePreview = new wxListCtrl( itemPanel1, ID_APPLYSRCTBLPREVIEW, wxDefaultPosition, wxSize(300, 120), wxLC_REPORT |wxLC_HRULES |wxLC_VRULES);
255  itemBoxSizer2->Add(m_TablePreview, 0, wxGROW|wxTOP|wxBOTTOM, 5);
256 
257 ////@end CMacroApplySrcTablePanel content constructions
258 }
259 
261 {
263  if (m_RowHeight == 0) {
264  int row_width;
265  row->GetClientSize(&row_width, &m_RowHeight);
266  }
268  return row;
269 }
270 
272 {
273  m_Sizer->Add(row, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
274  wxHyperlinkCtrl* itemHyperLink = new CNoTabHyperlinkCtrl(m_ScrolledWindow, wxID_ANY, wxT("Delete"), wxT("delete"));
275  itemHyperLink->SetVisitedColour(itemHyperLink->GetNormalColour());
276  m_Sizer->Add(itemHyperLink, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 0);
277  m_ScrolledWindow->SetScrollRate(0, m_RowHeight);
278  m_ScrolledWindow->FitInside();
279  m_ScrolledWindow->Refresh();
280 }
281 
283 {
284  return ToStdString(m_Filename->GetValue());
285 }
286 
287 void CMacroApplySrcTablePanel::SetFilename(const string& fname)
288 {
289  m_Filename->ChangeValue(fname);
290  m_Filename->SetInsertionPoint(m_Filename->GetLastPosition());
291 }
292 
294 {
295  string delimiter;
296  if (m_Tabdel->GetValue()) delimiter = "\t";
297  else if (m_Semidel->GetValue()) delimiter = ";";
298  else if (m_Commadel->GetValue()) delimiter = ",";
299  else if (m_Spacedel->GetValue()) delimiter = " ";
300  else if (m_Otherdel->GetValue()) delimiter = ToStdString(m_OtherText->GetValue());
301  return delimiter;
302 }
303 
305 {
306  if (del == "\\t")
307  m_Tabdel->SetValue(true);
308  else if (del == ";")
309  m_Semidel->SetValue(true);
310  else if (del == ",")
311  m_Commadel->SetValue(true);
312  else if (del == " ")
313  m_Spacedel->SetValue(true);
314  else {
315  m_Otherdel->SetValue(true);
316  m_OtherText->ChangeValue(del);
317  }
318 }
319 
321 {
322  TStringPairsVector values;
323  auto list = m_ScrolledWindow->GetChildren();
324  bool found_match = false;
325  for (auto it = list.begin(); it != list.end(); ++it) {
326  CSingleQualPanel* row = dynamic_cast<CSingleQualPanel*>(*it);
327  if (row) {
328  if (row->IsMatchingRow()) {
329  if (found_match) {
330  // there are at least two columns labeled as a match_field
331  values.clear();
332  break;
333  }
334  found_match = true;
335  }
336  else {
337  auto field = row->m_FieldFirst->GetStringSelection();
338  auto col = row->m_Column->GetValue();
339  if (!field.empty() && !col.empty())
340  values.push_back(make_pair(ToStdString(field), ToStdString(col)));
341  }
342  }
343  }
344  return values;
345 }
346 
348 {
349  Freeze();
350  while (m_Sizer->GetItemCount() > 0) {
351  int pos = 0;
352  m_Sizer->GetItem(pos)->DeleteWindows();
353  m_Sizer->Remove(pos);
354  }
355 
356  bool all_set = true;
357  for (const auto& it : values) {
359  all_set = all_set && row->InsertField(get<0>(it), get<1>(it), get<2>(it), get<3>(it));
360  }
361 
362  if (!all_set) {
363  NcbiWarningBox("Some fieldnames could not be properly displayed");
364  }
365 
366  Thaw();
367  x_ProcessFirstLine(true);
368 }
369 
371 {
372  auto list = m_ScrolledWindow->GetChildren();
373  for (auto it = list.begin(); it != list.end(); ++it) {
374  CSingleQualPanel* row = dynamic_cast<CSingleQualPanel*>(*it);
375  if (row && row->IsMatchingRow()) {
376  return row->GetField();
377  }
378  }
379  return SFieldFromTable(kEmptyStr, kEmptyStr, kEmptyStr, false);
380 }
381 
382 /*
383  * Should we show tooltips?
384  */
385 
387 {
388  return true;
389 }
390 
391 /*
392  * Get bitmap resources
393  */
394 
395 wxBitmap CMacroApplySrcTablePanel::GetBitmapResource( const wxString& name )
396 {
397  // Bitmap retrieval
398 ////@begin CMacroApplySrcTablePanel bitmap retrieval
399  wxUnusedVar(name);
400  return wxNullBitmap;
401 ////@end CMacroApplySrcTablePanel bitmap retrieval
402 }
403 
404 /*
405  * Get icon resources
406  */
407 
408 wxIcon CMacroApplySrcTablePanel::GetIconResource( const wxString& name )
409 {
410  // Icon retrieval
411 ////@begin CMacroApplySrcTablePanel icon retrieval
412  wxUnusedVar(name);
413  return wxNullIcon;
414 ////@end CMacroApplySrcTablePanel icon retrieval
415 }
416 
417 void CMacroApplySrcTablePanel::OnOpenFile(wxCommandEvent& event)
418 {
419  if (event.GetId() != ID_APPLYSRCTBLBTMBTN)
420  return;
421 
422  wxFileDialog dlg(this, wxT("Select table file"), wxEmptyString, wxEmptyString, _("All files (*.*)|*.*"), wxFD_OPEN | wxFD_FILE_MUST_EXIST);
423 
424  if (dlg.ShowModal() == wxID_OK) {
425  auto mapped_path = GetAbsolutePath(dlg.GetPath());
426  m_Filename->SetValue(mapped_path);
427  m_Filename->SetInsertionPoint(m_Filename->GetLastPosition());
428  m_Tabdel->SetValue(true);
429  m_MergeDel->SetValue(false);
430  m_SplitFirstCol->SetValue(false);
431  m_ConvertMulti->SetValue(false);
432  m_MergeTwoCols->SetValue(false);
433  }
434 }
435 
437 {
438  m_Tabdel->SetValue(true);
439  m_MergeDel->SetValue(false);
440  m_SplitFirstCol->SetValue(false);
441  m_ConvertMulti->SetValue(false);
442  m_MergeTwoCols->SetValue(false);
443  if (!m_OtherText->IsEmpty() && !m_Otherdel->GetValue())
444  m_OtherText->Clear();
445 
447 }
448 
450 {
452  if (!m_OtherText->IsEmpty() && !m_Otherdel->GetValue())
453  m_OtherText->Clear();
454 
455  event.Skip();
456 }
457 
459 {
460  const string filename = ToStdString(m_Filename->GetValue());
461  CRef<ILineReader> line_reader;
462  try {
463  line_reader.Reset(ILineReader::New(filename));
464  if (line_reader.Empty()) {
465  return;
466  }
467  }
468  catch (const CException&) {
469  m_TablePreview->DeleteAllColumns();
470  m_TablePreview->DeleteAllItems();
471  return;
472  }
473 
474  string delimiter = GetDelimiter();
476 
477  vector<pair<string, int>> fields;
478  unsigned int nr_line = 0;
479 
480  size_t nr_cols = 0;
481  m_TablePreview->DeleteAllColumns();
482  m_TablePreview->DeleteAllItems();
483 
484  // TODO: handle empty values
485  while (!line_reader->AtEOF() && nr_line < 30) {
486  line_reader->ReadLine();
487  string line = line_reader->GetCurrentLine();
488  if (line.empty())
489  continue;
490 
491  if (m_ConvertMulti->IsChecked()) {
493  }
494 
495  vector<string> cols;
496  NStr::SplitByPattern(line, delimiter, cols, flags);
497  _ASSERT(!cols.empty());
498 
499 
500  if (m_MergeTwoCols->IsChecked()) {
501  cols[0] = cols[0] + "/" + cols[1];
502  cols.erase(cols.begin() + 1);
503  }
504 
505  if (m_SplitFirstCol->IsChecked()) {
506  string first, second;
507  NStr::SplitInTwo(cols[0], " ", first, second);
508  cols[0] = first;
509  cols.insert(cols.begin() + 1, second);
510  }
511 
512 
513  if (nr_line == 0) {
514  nr_cols = cols.size();
515 
516  for (size_t i = 0; i < cols.size(); ++i) {
517  fields.emplace_back(cols[i], i + 1);
518  m_TablePreview->AppendColumn(ToWxString(cols[i]));
519  }
520  } else {
521  auto row = m_TablePreview->InsertItem(nr_line, ToWxString(cols[0]));
522  for (size_t index = 1; index < nr_cols; ++index) {
523  if (index < cols.size())
524  m_TablePreview->SetItem(row, static_cast<int>(index), ToWxString(cols[index]));
525  }
526  }
527  ++nr_line;
528  }
529 
530  for (int index = 0; index < m_TablePreview->GetColumnCount(); ++index) {
531  m_TablePreview->SetColumnWidth(index, wxLIST_AUTOSIZE_USEHEADER);
532  }
533 
534  if (!update_only_table) {
535  Freeze();
536  while (m_Sizer->GetItemCount() > 0) {
537  int pos = 0;
538  m_Sizer->GetItem(pos)->DeleteWindows();
539  m_Sizer->Remove(pos);
540  }
541 
542  for (auto& it : fields) {
544  if (it.first == "organism") it.first = "taxname";
545  row->SetField(it.first, it.second);
546  }
547 
548  Thaw();
549  }
550 }
551 
552 
553 void CMacroApplySrcTablePanel::OnDelete(wxHyperlinkEvent& event)
554 {
555  if (event.GetURL() != wxT("delete")) {
556  event.Skip();
557  return;
558  }
559 
560  wxWindow *win = dynamic_cast<wxWindow*>(event.GetEventObject());
561  if (!win)
562  return;
563  wxWindowList& children = m_ScrolledWindow->GetChildren();
564  wxWindow* prev = nullptr;
565  for (wxWindowList::iterator child = children.begin(); child != children.end(); ++child) {
566  if (*child == win) {
567  wxSizer *sizer = win->GetContainingSizer();
568  win->Destroy();
569  prev->Destroy();
570  m_Sizer->Remove(sizer);
571  m_Sizer->Layout();
572  m_ScrolledWindow->FitInside();
573  break;
574  }
575  prev = *child;
576  }
577  event.Skip();
578 }
579 
580 void CMacroApplySrcTablePanel::OnHyperlinkClicked(wxHyperlinkEvent& event)
581 {
582  Freeze();
583  x_AddEmptyRow();
584  Thaw();
585 }
586 
587 
589 
EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX, CAdjustFeaturesForGaps::OnKnownUnknownSelected) EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX1
void x_AddRowToWindow(wxWindow *row)
SFieldFromTable GetMatchField() const
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
wxScrolledWindow * m_ScrolledWindow
void OnOpenFile(wxCommandEvent &event)
wxBitmap GetBitmapResource(const wxString &name)
@end CMacroApplySrcTablePanel event handler declarations
bool Create(wxWindow *parent, wxWindowID id=ID_CMACROAPPLYSRCTABLEPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
Creation.
void Init()
Initialises member variables.
TStringPairsVector GetValues() const
vector< tuple< string, int, EMacroFieldType, bool > > TAddValue
void SetDelimiter(const string &del)
CSingleQualPanel * x_AddEmptyRow()
void OnHyperlinkClicked(wxHyperlinkEvent &event)
static bool ShowToolTips()
Should we show tooltips?
void SetFilename(const string &fname)
void SetValues(const TAddValue &values)
void x_ProcessFirstLine(bool update_only_table=false)
void CreateControls()
Creates the controls and sizers.
void OnNewFileEntered(wxCommandEvent &event)
void OnDelete(wxHyperlinkEvent &event)
void OnDelimiterSelected(wxCommandEvent &event)
#define _(proto)
Definition: ct_nlmzip_i.h:78
static uch flags
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
Definition: dlist.tmpl.h:46
static DLIST_TYPE *DLIST_NAME() prev(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
Definition: dlist.tmpl.h:61
static void Init(void)
Definition: cursor6.c:76
void ConvertMultiSpaces(string &line, const string &delimiter)
replace any instance of 2 or more spaces with a single instance of 'delimiter'
Definition: macro_util.cpp:833
void NcbiWarningBox(const string &message, const string &title="Warning")
specialized Message Box function for reporting non-critical errors
CTempString GetCurrentLine(void) const
static CRef< ILineReader > New(const string &filename)
Return a new ILineReader object corresponding to the given filename, taking "-" (but not "....
Definition: line_reader.cpp:49
void ReadLine(void)
Definition: line_reader.hpp:88
virtual bool AtEOF(void) const =0
Indicates (negatively) whether there is any more input.
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
bool Empty(void) const THROWS_NONE
Check if CRef is empty – not pointing to any object, which means having a null value.
Definition: ncbiobj.hpp:719
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static list< string > & SplitByPattern(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Variation of Split() with fSplit_ByPattern flag applied by default.
Definition: ncbistr.cpp:3498
vector< pair< string, string > > TStringPairsVector
Definition: ncbistr.hpp:4804
#define kEmptyStr
Definition: ncbistr.hpp:123
int TSplitFlags
Bitwise OR of ESplitFlags.
Definition: ncbistr.hpp:2512
static bool SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)
Split a string into two pieces using the specified delimiters.
Definition: ncbistr.cpp:3545
@ fSplit_MergeDelimiters
Merge adjacent delimiters.
Definition: ncbistr.hpp:2500
END_EVENT_TABLE()
int i
Lightweight interface for getting lines of data with minimal memory copying.
USING_SCOPE(objects)
#define wxT(x)
Definition: muParser.cpp:41
const struct ncbi::grid::netcache::search::fields::SIZE size
static const char delimiter[]
static static static wxID_ANY
#define row(bind, expected)
Definition: string_bind.c:73
#define _ASSERT
wxString GetAbsolutePath(const wxString &localpath)
Definition: wx_utils.cpp:188
wxString ToWxString(const string &s)
Definition: wx_utils.hpp:173
string ToStdString(const wxString &s)
Definition: wx_utils.hpp:161
Modified on Fri Sep 20 14:58:13 2024 by modify_doxy.py rev. 669887