33 #include <wx/choice.h>
34 #include <wx/stattext.h>
35 #include <wx/bitmap.h>
37 #include <wx/textctrl.h>
38 #include <wx/button.h>
98 #ifdef __WXOSX_COCOA__
99 SetBackgroundStyle(wxBG_STYLE_COLOUR);
100 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_FRAMEBK));
103 wxPanel::Create( parent,
id, pos,
size, style );
108 GetSizer()->SetSizeHints(
this);
156 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
157 itemPanel1->SetSizer(itemBoxSizer2);
159 wxBoxSizer* itemBoxSizer3 =
new wxBoxSizer(wxHORIZONTAL);
160 itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_LEFT|wxALL, 5);
162 wxStaticText* itemStaticText4 =
new wxStaticText( itemPanel1, wxID_STATIC,
_(
"Find"), wxDefaultPosition, wxDefaultSize, 0 );
163 itemBoxSizer3->Add(itemStaticText4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
165 wxTextCtrl* itemTextCtrl5 =
new wxTextCtrl( itemPanel1,
ID_TEXTCTRL1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
166 itemBoxSizer3->Add(itemTextCtrl5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
169 itemBoxSizer3->Add(
m_BwdButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
172 itemBoxSizer3->Add(
m_FwdButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
176 itemBoxSizer3->Add(
m_StopButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
178 wxStaticText* itemStaticText9 =
new wxStaticText( itemPanel1, wxID_STATIC,
_(
"Current Position:"), wxDefaultPosition, wxDefaultSize, 0 );
179 itemBoxSizer3->Add(itemStaticText9, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
181 m_MousePos =
new wxStaticText( itemPanel1, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxSize(itemPanel1->ConvertDialogToPixels(wxSize(100, -1)).x, -1), wxNO_BORDER );
182 itemBoxSizer3->Add(
m_MousePos, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
184 wxStaticText* itemStaticText11 =
new wxStaticText( itemPanel1, wxID_STATIC,
_(
"Show"), wxDefaultPosition, wxDefaultSize, 0 );
185 itemBoxSizer3->Add(itemStaticText11, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
187 wxArrayString itemChoice12Strings;
188 itemChoice12Strings.Add(
_(
"None"));
189 itemChoice12Strings.Add(
_(
"Gene"));
190 itemChoice12Strings.Add(
_(
"CDS"));
191 itemChoice12Strings.Add(
_(
"mRNA"));
192 itemChoice12Strings.Add(
_(
"misc_RNA"));
193 itemChoice12Strings.Add(
_(
"STS"));
194 wxChoice* itemChoice12 =
new wxChoice( itemPanel1,
ID_CHOICE1, wxDefaultPosition, wxDefaultSize, itemChoice12Strings, 0 );
195 itemChoice12->SetStringSelection(
_(
"None"));
196 itemBoxSizer3->Add(itemChoice12, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
206 wxChoice* choice = (wxChoice*)FindWindow(
ID_CHOICE1);
209 case objects::CSeqFeatData::eSubtype_gene:
210 choice->SetSelection (1);
212 case objects::CSeqFeatData::eSubtype_cdregion:
213 choice->SetSelection (2);
215 case objects::CSeqFeatData::eSubtype_mRNA:
216 choice->SetSelection (3);
218 case objects::CSeqFeatData::eSubtype_misc_RNA:
219 choice->SetSelection (4);
221 case objects::CSeqFeatData::eSubtype_STS:
222 choice->SetSelection (5);
268 const CSeq_id*
id =
dynamic_cast<const CSeq_id*
>(
object.object.GetPointer());
296 const CSeq_loc* loc =
dynamic_cast<const CSeq_loc*
>(
object.object.GetPointer());
297 if (loc && loc->
GetId()) {
298 auto handle =
object.scope->GetBioseqHandle(*loc->
GetId());
322 objects::CSeqFeatData::ESubtype subtype = objects::CSeqFeatData::eSubtype_bad;
323 switch (event.GetInt()) {
325 subtype = objects::CSeqFeatData::eSubtype_gene;
328 subtype = objects::CSeqFeatData::eSubtype_cdregion;
331 subtype = objects::CSeqFeatData::eSubtype_mRNA;
334 subtype = objects::CSeqFeatData::eSubtype_misc_RNA;
337 subtype = objects::CSeqFeatData::eSubtype_STS;
376 struct SSeqSearchInput {
381 SSeqSearchInput(
const string& search_term,
bool forward,
CSeqTextWidget* widget)
382 : m_Term(search_term), m_Forward(forward), m_TextWidget(widget) {}
385 struct SSeqSearchOutput {
430 if (
input.m_Forward) {
455 catch (
const std::exception& e) {
466 const SSeqSearchOutput& res = jobResult->
GetData();
481 string err_msg =
"Failed: ";
482 if (!errMsg.empty()) {
486 err_msg +=
"Unknown fatal error";
497 wxTextCtrl* find = (wxTextCtrl*)FindWindow(
ID_TEXTCTRL1);
CSeqTextDataSource implements Adapter design pattern.
void FindSequenceFragmentList(const string &fragment, CSeqTextDefs::TSeqPosVector &locations, ICanceled *cancel)
CSeqTextDefs::TSeqPosVector m_FoundList
const CSeqTextSearch & GetTextSearchData() const
void SetTextSearchData(const CSeqTextSearch &data)
virtual TSeqPos STG_GetSequenceByWindow(int x, int y)
void ResetTextSearchData()
virtual void OnJobFailed(const string &, CJobAdapter &adapter)
void Init()
Initialises member variables.
virtual void OnJobResult(CObject *result, CJobAdapter &adapter)
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
CSeqTextWidget * m_SeqTextWidget
static bool ShowToolTips()
Should we show tooltips?
~CSeqTextPanel()
Destructor.
void OnFeatureTypeSelected(wxCommandEvent &event)
wxEVT_COMMAND_CHOICE_SELECTED event handler for ID_CHOICE1
CRef< CJobAdapter > m_JobAdapter
virtual void STWH_ReportMouseOverPos(TSeqPos pos)
void OnStopClick(wxCommandEvent &event)
bool InitObject(SConstScopedObject &object)
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
void CreateControls()
Creates the controls and sizers.
CRef< CSeqTextDataSource > m_DataSource
void OnFindBwdClick(wxCommandEvent &event)
@begin CSeqTextPanel event handler declarations
bool Create(wxWindow *parent, wxWindowID id=ID_CSEQTEXTPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
Creation.
void x_RestoreButtonStates()
void OnFindFwdClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON1
CSeqTextPanel()
Constructors.
void x_StartSearch(bool forward)
wxStaticText * m_MousePos
void SetHost(ISeqTextWidgetHost *pHost)
void UpdateLastSourcePos()
virtual CSeqTextDataSource * GetDS()
void ScrollToPosition(TSeqPos pos, bool notify=true)
int GetCaseFeatureSubtype()
virtual void SetDataSource(CSeqTextDataSource &ds)
void ChooseCaseFeature(objects::CSeqFeatData::ESubtype subtype)
Interface for testing cancellation request in a long lasting operation.
static SQLCHAR output[256]
static const char * str(char *buf, int n)
unsigned int TSeqPos
Type for sequence locations and lengths.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
const string & GetMsg(void) const
Get message string.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
void Info(CExceptionArgs_Base &args)
EDialogReturnValue NcbiInfoBox(const string &message, const string &title="Info")
specialized Message Box function for reporting general information messages
void NcbiErrorBox(const string &message, const string &title="Error")
specialized Message Box function for reporting critical errors
void GetLabel(string *label, ELabelType type=eDefault, TLabelFlags flags=fLabel_Default) const
Append a label for this Seq-id to the supplied string.
const CSeq_id * GetId(void) const
Get the id of the location return NULL if has multiple ids or no id at all.
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
virtual bool IsCanceled(void) const =0
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
static string TruncateSpaces(const string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string.
bool IsLocal(void) const
Check if variant Local is selected.
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
static bool s_SearchInSeqText(SSeqSearchInput &input, SSeqSearchOutput &output, string &error, ICanceled &canceled)
void ReportIDError(const string &id_label, bool is_local, const string &title="Error message")
wxString ToWxString(const string &s)
string ToStdString(const wxString &s)