97 m_Formatter(&formatter),
98 m_BioseqEditor(bioseqEditor)
101 m_BioseqEditor->SetCallBack(
this);
129 : m_Editor(editor), m_ShowIcons(showIcons) {}
131 virtual bool ProcessItem(
CTextItem& textItem)
143 flatTextItem->
SetEditFlags(m_Editor.GetEditFlags(*flatItem));
160 int flags = m_Editor.GetEditFlags(*flatItem);
163 if (
flags != 0 && m_ShowIcons)
233 static bool registered =
false;
238 "Expand All Features",
239 "Expand All Features",
242 "Command expands(opens) All Features of a FlatFile view");
244 "Collapse All Features",
245 "Collapse All Features",
248 "Command collapses(closes) All Features of a FlatFile view");
254 "Command expands(opens) All Sequence Blocks of a FlatFile view");
260 "Command collapses(closes) Sequence Blocks of a FlatFile view");
262 "Collapse Sequences",
263 "Collapse Sequences",
266 "Command collapses(closes) Sequence Sections of a FlatFile view");
281 wxMenu* menu = cmd_reg.
CreateMenu(kFlatFileContextMenu);
282 if (m_BioseqEditor) {
283 unique_ptr<wxMenu> editorMenu(m_BioseqEditor->CreateContextMenu());
284 if (editorMenu.get()) {
285 Merge(*menu, *editorMenu);
443 pos = m_Panel->CalcScrolledPosition(pos);
446 unique_ptr<wxMenu> menu(cmd_reg.
CreateMenu(kFlatFileBioseqMenu));
449 unique_ptr<wxMenu> editorMenu(m_BioseqEditor->CreateBioseqMenu());
450 if (editorMenu.get()) {
451 Merge(*menu, *editorMenu);
458 m_Panel->PopupMenu(menu.get(), pos);
471 return CEditObject(*odesc,
ctx->GetHandle().GetSeq_entry_Handle());
481 return CEditObject(*ofeat,
ctx->GetHandle().GetSeq_entry_Handle());
532 if (sourceFeatureItem) {
544 if (
data.IsBiosrc()) {
551 if (&bioSource2 == &bioSource) {
579 for (; dsrc_it; ++dsrc_it) {
595 return CEditObject(*desc,
ctx->GetHandle().GetSeq_entry_Handle());
605 titleEdit->SetTitle(defLineItem->
GetDefline());
631 if (seqDesc && seqDesc->
IsPub())
658 if (genomeProjectItem) {
744 for (TEditObjectList::iterator it2 =
objects.begin(); it2 !=
objects.end();) {
745 const CObject* pobj = it2->m_Obj.GetPointer();
746 if (objSet.
find(pobj) != objSet.
end()) {
774 if (
text.empty())
return false;
777 size_t findLength =
text.length();
778 if (findLength > 60) {
784 string block1 = *it, block2;
791 buffer += block2.substr(0, findLength - 1);
793 if (
buffer.length() >= findLength) {
796 if (pos != string::npos) {
818 static CSeqMarkertModifier _inst;
821 virtual void SetStyle(wxDC& dc)
826 dc.SetBackgroundMode(wxSOLID);
827 dc.SetTextForeground(wxColor(0,0,0));
828 dc.SetTextBackground(wxColor(175,238,238));
845 if (startRow == endRow) {
852 startRow, 80, &seqMarker);
853 for (
int i = startRow + 1;
i < endRow; ++
i)
ITextItem * GetItem(size_t index)
virtual void UpdatePositions()
virtual bool Traverse(ICompositeTraverser &traverser)
size_t GetItemCount() const
const string & GetDefline(void) const
void AddMarker(int startRow, int startCol, int endRow, int endCol, IStyleModifier *style)
CConstRef< CObject > m_Obj
virtual void Toggle(CTextPanelContext *context, bool update)
void AddGlyph(CGlyph *glyph)
void SetSelectable(bool selectable=true)
virtual bool IsExpanded() const
CTextItem * GetExpandedItem()
CTextItem * GetCollapsedItem()
virtual bool ProcessItem(CExpandItem &expandItem)
virtual bool ProcessItem(CTextItem &)
CExpandSeqsTraverser(CTextPanelContext &context, bool expand)
CTextPanelContext & m_Context
virtual bool ProcessItem(CExpandItem &expandItem)
CFindLocusTraverser(TConstScopedObjects &objects)
virtual bool ProcessItem(CTextItem &textItem)
TConstScopedObjects & m_SeqLocs
SConstScopedObject GetSeqLoc()
bool NextSequence() const
const objects::IFlatItem * GetFlatItem() const
CConstRef< objects::IFlatItem > m_Item
void SetEditFlags(int flags)
void OnCollapseSeqBlocks(wxCommandEvent &event)
virtual void GetVisibleObjects(TConstScopedObjects &objects)
bool ShowEditIcons() const
virtual int GetLeftMargin() const
virtual void GetCurrentSelection(TEditObjectList &objects)
virtual void EditItem(ITextItem *item, bool controlDown, bool shiftDown)
void OnCollapseAllFeatures(wxCommandEvent &event)
void OnCollapseSequences(wxCommandEvent &event)
void OnExpandAll(wxCommandEvent &event)
objects::CBioseq_Handle m_CurBioseq
void OnExpandAllFeatures(wxCommandEvent &event)
virtual void SetPanel(CTextItemPanel *panel)
CEditObject GetEditObject(CFlatFileTextItem &ffItem)
virtual wxString GetWorkDir() const
static void RegisterCommands(CUICommandRegistry &cmd_reg, wxFileArtProvider &provider)
virtual objects::CBioseq_Handle GetCurrentBioseq()
virtual void GetItemSelection(TFlatItemList &itemList)
virtual void InitDrawStream(CDrawTextOStream &stream, int startLine)
virtual void RootInitialized()
virtual bool FindSequence(const wxString &text)
CIRef< IBioseqEditor > m_BioseqEditor
void OnExpandSeqBlocks(wxCommandEvent &event)
CBioseqContext * GetContext(void)
const CSerialObject * GetObject(void) const
namespace ncbi::objects::
TSeqPos GetTo(void) const
TSeqPos GetFrom(void) const
Base class for all serializable objects.
CTextPosition GetEnd() const
CTextPosition GetStart() const
CTextBlock Normalized() const
void MakePosVisible(const CTextPosition &pos)
ITextItem * GetRootItem()
CTextBlock GetTextSelection() const
void SetSelection(const CTextBlock &selection)
virtual void SetPanel(CTextItemPanel *panel)
set< ITextItem * > m_SelectedItems
CUICommandRegistry is a centralized registry where all application commands should be registered.
static CUICommandRegistry & GetInstance()
the main instance associated with the application
wxMenu * CreateMenu(const SwxMenuItemRec *items)
create a menu from a static definition (see WX_*_MENU macros)
int RegisterCommand(CUICommand *cmd)
assumes ownership of the given object returns a command id (useful when registry is used for auto id ...
virtual bool Traverse(ICompositeTraverser &)=0
iterator_bool insert(const value_type &val)
const_iterator find(const key_type &key) const
const_iterator end() const
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
CConstRef< CObject > object
vector< SConstScopedObject > TConstScopedObjects
CSeq_entry_Handle GetSeq_entry_Handle(void) const
Get parent Seq-entry handle.
CConstRef< CSeq_feat > GetOriginalSeq_feat(void) const
CRef< CSeq_loc > GetRangeSeq_loc(TSeqPos start, TSeqPos stop, ENa_strand strand=eNa_strand_unknown) const
Return CSeq_loc referencing the given range and strand on the bioseq If start == 0,...
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string (in-place)
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 & ToUpper(string &str)
Convert string to upper case – string& version.
bool IsStr(void) const
Check if variant Str is selected.
const TStr & GetStr(void) const
Get the variant data.
const TType & GetType(void) const
Get the Type member data.
const TData & GetData(void) const
Get the Data member data.
const TSource & GetSource(void) const
Get the variant data.
bool IsSource(void) const
Check if variant Source is selected.
bool IsPub(void) const
Check if variant Pub is selected.
const TMolinfo & GetMolinfo(void) const
Get the variant data.
@ e_User
user defined object
@ e_Molinfo
info on the molecule and techniques
@ e_Title
a title for this sequence
@ e_Source
source of materials, includes Org-ref
vector< CEditObject > TEditObjectList
vector< CConstRef< objects::IFlatItem > > TFlatItemList
static void text(MDB_val *v)
ViewerWindowBase::OnEditMenu ViewerWindowBase::OnJustification EVT_MENU(MID_SHOW_GEOM_VLTNS, ViewerWindowBase::OnShowGeomVltns) EVT_MENU(MID_FIND_PATTERN
#define WX_DEFINE_MENU(name)
New macros for defining menus for use with CUICommandRegistry.
#define WX_SUBMENU(label)
#define WX_MENU_SEPARATOR_L(label)
#define WX_MENU_ITEM(cmd)
static CS_CONTEXT * context
wxMenu * CreateMenu(const CMenuItem *item)
Creates a wxMenu object replicating the structure of CMenuItem.
void Merge(wxMenu &menu_1, const wxMenu &menu_2)
merges all items form menu_2 into menu_1, preserving the structure if possible
string ToStdString(const wxString &s)
void CleanupSeparators(wxMenu &menu)
Removes extra separators (in the begining or at the end of the menu, ot those that precede other sepa...