63 , m_Attrs(fDefaultAttr)
74 "track_expand",
"track_collapse"));
94 if (settings.
empty()) {
95 profile = profile_str;
98 if (iter != settings.
end()) {
99 profile = iter->second;
100 settings.
erase(iter);
120 if (settings.
empty()) {
124 if (iter != settings.
end()) {
125 preset_style = iter->second;
168 bool consumed =
false;
176 if (idx >= 0 &&
m_Icons[idx].m_Enabled) {
191 rcm.
SetLeft(center_x - half_size);
207 bool consumed =
false;
246 if(pContainer ==
NULL) {
252 if((*iter)->GetTrack() ==
this) {
254 for(
auto annot: annots) {
259 if (!(*iter)->GetRemotePath().empty())
270 if(pContainer ==
nullptr)
275 for (
const auto& proxy : proxies) {
276 if(proxy->GetTrack() !=
this)
279 const auto &path = proxy->GetRemotePath();
286 if (host ==
"ftp.ncbi.nlm.nih.gov") {
310 (
TVPUnit)tb_height + (tb_height > 0.0 ? 2 : 0));
315 p_areas->push_back(area);
316 return &p_areas->back();
507 gl.
Color4f(0.6f, 0.6f, 0.9f, 0.4f);
546 int icon_num =
static_cast<int>(
m_Icons.size());
547 for (
int idx = 0; idx < icon_num; ++idx) {
550 }
else if (
config->GetShowCommentBg()) {
573 if (
config->GetShowComments()) {
606 repeat_dist =
max(repeat_dist, title_len);
609 if (
config->GetRepeatComment()) {
610 repeat_num = (
int)ceil(
fabs(rcm.
Width() / repeat_dist));
614 title = com_font->
Truncate(title, max_title_w);
619 for (
int i = 0;
i < repeat_num; ++
i) {
632 bool lite_version)
const
640 TModelRect rc_coord(0.0, 1.0, coord, 1.0 - coord);
657 gl.
Color4f(0.6f, 0.6f, 1.0f, 0.6f);
664 if (lite_version && !
m_Icons[idx].m_Icon1_lite.empty()) {
715 TIcons::iterator iter =
m_Icons.begin();
716 while (iter !=
m_Icons.end() && iter->m_Id != icon.
m_Id) {
728 TIcons::iterator iter =
m_Icons.begin();
729 while (iter !=
m_Icons.end() && iter->m_Id !=
id) {
741 TIcons::iterator iter =
m_Icons.begin();
742 while (iter !=
m_Icons.end() && iter->m_Id !=
id) {
746 iter->m_Enabled = enabled;
754 TIcons::iterator iter =
m_Icons.begin();
755 while (iter !=
m_Icons.end() && iter->m_Id !=
id) {
759 iter->m_Shown = shown;
768 int icon_num =
static_cast<int>(
m_Icons.size());
769 for (
int idx = 0; idx < icon_num; ++idx) {
819 size_y = min<int>(size_y, rcm.
Bottom() - off_seq.
m_Y);
820 off_seq.
m_X = rcm.
Right() - (idx * 3.0 + 2.0) * size_x;
822 rcm.
Init(-size_x, size_y, size_x, -size_y);
826 off_seq = pane->
UnProject(off_screen.
X(), off_screen.
Y());
827 rcm.
Offset(off_seq.
X(), off_seq.
Y());
835 TIcons::const_iterator iter =
m_Icons.begin();
837 while (iter !=
m_Icons.end() && iter->m_Id !=
id) {
868 const string& img_file)
881 tex->SetFilterMag(GL_NEAREST);
882 tex->SetFilterMin(GL_NEAREST);
883 tex->SetWrapS(GL_CLAMP);
884 tex->SetWrapT(GL_CLAMP);
885 tex->SetTexEnv(GL_REPLACE);
889 "cannot read image from file " << path.ToUTF8());
901 bool need_reload =
false;
903 if ( !iter->second )
return false;
905 if ( !iter->second->IsValid() ) {
912 iter->second->Load();
922 const vector<string>& target_annots,
923 const string& annot_type,
924 const string& track_type,
927 if (target_annots.empty() && annot_type.empty() && track_type.empty()) {
931 string track_type_l = track_type;
933 if (target_annots.empty()) {
936 if (
nullptr == iter->second)
938 bool matched = !annot_type.empty();
943 if (matched && !track_type_l.empty() &&
944 iter->second->m_Subtypes.count(track_type_l) == 0) {
950 iter->second->m_Name, iter->second->m_Title));
955 ITERATE (vector<string>, iter, target_annots) {
962 if (s_iter == src_annots.
end())
continue;
964 if (!annot_type.empty() && !s_iter->second->m_AnnotType.empty() &&
968 if (!track_type_l.empty() && !s_iter->second->m_Subtypes.empty() &&
969 s_iter->second->m_Subtypes.count(track_type_l) == 0) {
973 s_iter->second->m_Name, s_iter->second->m_Title));
982 const string& filter)
984 if (filter.empty()) {
995 if (pos != string::npos) {
996 return source.substr(0, pos);
1005 if (pos != string::npos) {
1013 vector<string> data_types{
"asn1",
"snp",
"vcf" };
1014 _ASSERT(data_type < data_types.size());
1015 return data_types[data_type];
CGlAttrGuard - guard class for restoring OpenGL attributes.
string m_Descr
description that can be used as label or tooltip
@ fNoNavigation
track title won't show navigation controls
@ fNoPin
tooltip is not pinnable
@ fNoHighlight
no highlighting on mouse over
@ fNoSelection
the object can't be selected
int m_Flags
area flags, will need to replace m_Type
TTrackErrorStatus m_TrackErrorStatus
virtual void x_RenderProgressBar() const
Method for rendering the job loading or layout generating progress.
void SetTrackAttr(TTrackAttrFlags flags)
virtual int x_GetIconState(TIconID id) const
Get current status for a given button.
int m_IndentLevel
track hierachy indentation level.
void x_DeregisterIcon(TIconID id)
deregister an icon if already registered.
virtual void x_UpdateBoundingBox()
Update the bounding box assuming children's sizes are fixed if any.
virtual void GetTooltip(const TModelPoint &p, ITooltipFormatter &tt, string &t_title) const
Get the tooltip if available.
bool m_Expanded
is this track in expanded state
bool isRemotePath() const
virtual bool x_ShowTitle() const
Need to preserve title space and show the title.
int x_HitIconTest(const TModelPoint &p) const
hit any icon?.
virtual bool OnLeftDblClick(const TModelPoint &p)
@ eIcon_Expand
expand/collapse icon
virtual void x_RenderContent() const =0
The content rendering must be implemented in the derived layout tracks.
static bool InitIconTextures()
initialize OpenGL ttexture objects for icons.
virtual bool NeedTooltip(const TModelPoint &p, ITooltipFormatter &tt, string &t_title) const
Check if need to show tooltip.
ILayoutTrackHost * m_LTHost
Top level host owning the tracks.
virtual void x_Expand(bool expand)
Collapse or expand the track.
string m_Msg
special message need to show on title bar
string m_Title
track title
static CFastMutex sm_Mutex
mutex guarding the icon texture map
virtual void x_GetTBRect(TModelRect &rc) const
Get title bar rectange exclude top margin.
bool m_ShowFrame
need to draw frame, not title
virtual void x_SaveSettings(const string &preset_style)
save the track settings to a profile string.
virtual void x_LoadSettings(const string &preset_style, const TKeyValuePairs &settings)
load the track settings.
virtual bool OnLeftDown(const TModelPoint &p)
bool m_On
is this track shown
CLayoutTrack * GetParentTrack()
void x_EnableIcon(TIconID id, bool enabled)
Enable/disable an existing icon.
void CloseMe()
close this track.
void x_OnLayoutChanged()
update the layout.
TTrackAttrFlags m_Attrs
various track attributes
virtual void x_RenderIcon(TIconID id, bool highlighted, bool lite_version=false) const
Render track icons.
virtual string x_GetHistMsg() const
Histogram configuration (linear, log, etc) is also on the title bar but multiple track types can have...
virtual void x_OnIconClicked(TIconID id)
Mouse left-click event handler on an icon.
void SetShow(bool shown)
set the flag only.
TIcons m_Icons
registered icon info
virtual bool x_Empty() const =0
void LoadProfile(const string &profile_str)
set track profile and load settings.
@ fNavigable
Track has navigation controls.
@ fFrameVisible
track frame will be rendered when triggered.
@ fShowAlways
always be rendered even for an empty track.
@ fFullTrack
track occupying the full horizontal screen.
@ fShowIcons
Track has control icons at the bottom.
@ fCollapsible
can be collpased and expanded.
string TIconAlias
the icon alias used as a key
const string & GetProfile() const
virtual void x_RenderTitleBar() const
Method for rendering the track title bar.
bool x_HitTitleBar(const TModelPoint &p) const
hit the title bar?.
TModelUnit x_GetTBHeight() const
Get title bar height including margin.
TTrackErrorStatus m_ErrorStatus
int x_GetIconIdxById(TIconID id) const
get icon index in the registed icons using its id.
static void RegisterIconImage(const TIconAlias &key, const string &img_file)
register the image for an icon.
int m_HighlightedIcon
the highlighted icon index
CConstRef< CSeqGraphicConfig > x_GetGlobalConfig() const
Method for getting global configuration from rendering context.
void SetProfile(const string &preset_style)
CLayoutTrack inline method implmentation.
int m_Progress
any job progress index (0 - 100)
static TTexMap sm_IconMap
only intialized once app-wise
bool OnMotion(const TModelPoint &pt)
bool x_IsNCBITrack() const
Indicates whether the track is NCBI track.
CRef< CSeqGraphicConfig > m_gConfig
global configuration.
int TIconID
use int as TIconID instead of EIconID.
TModelRect x_GetIconRect(int idx) const
string m_Id
track identifier
CLayoutTrack(CRenderingContext *r_cntx)
bool m_isBlast
true if the track is known to be generated and uploaded by BLAST
virtual string GetFullTitle() const
get a more meaningful title.
virtual void x_Draw() const
The default renderer for this layout object.
void x_ShowIcon(TIconID id, bool shown)
Show/hide an existing icon.
virtual CHTMLActiveArea * InitHTMLActiveArea(TAreaVector *p_areas) const
Initialize the HTML active area for a track.
static void RegisterCommonIconImages()
register images for the common icons.
void x_RegisterIcon(const SIconInfo &icon)
register track icons.
void x_RenderFrame() const
Method for rendering the track frame including the icons.
CRenderingContext offers the basic context and utility methods for rendering layout objects in featur...
void TextOut(const CGlTextureFont *font, const char *text, TModelUnit x, TModelUnit y, bool center, bool adjust_flip=true) const
CGlPane * GetGlPane()
inline method implementations
const TModelUnit & GetOffset() const
void DrawShadedQuad(const TModelRect &rcm, const CRgbaColor &c1, const CRgbaColor &c2, bool shade_vert=true) const
const TModelRange & GetVisibleRange() const
void DrawRect(const TModelRect &rc) const
void DrawQuad(const TModelRect &rc, bool border=false) const
bool IsSkipControls() const
TModelUnit SeqToScreen(const TModelUnit &size) const
convert from sequence positions to screen pixels
TModelUnit ScreenToSeq(const TModelUnit &size) const
convert from screen pixels to sequence positions
bool IsSkipContent() const
bool IsSkipTitleBar() const
void DrawTexture(const TModelRect &rc, const TModelRect &rc_coord) const
void AdjustToOrientation(TModelUnit &x) const
class CRgbaColor provides a simple abstraction for managing colors.
static void ParseProfileString(const string &profile_str, TKeyValuePairs &settings)
void x_InitHTMLActiveArea(CHTMLActiveArea &area) const
initialize the basic information for a given active area.
CRenderingContext * m_Context
the rendering context
virtual void x_OnLayoutChanged()
update the layout.
virtual void SetHeight(TModelUnit h)
virtual TModelUnit GetRight() const
static bool PointInRect(const TModelPoint &p, const TModelRect &rc)
virtual void SetWidth(TModelUnit w)
virtual void SetLeft(TModelUnit l)
virtual TModelUnit GetTop() const
virtual TModelUnit GetHeight() const
virtual void Update(bool)
Update content and layout including the bounding box.
bool x_Visible_V() const
is this glyph visible in vertical direction?
virtual TModelUnit GetLeft() const
vector< CHTMLActiveArea > TAreaVector
void x_World2Local(TModelPoint &p) const
Transform the coordiante from world coord. to local coord.
void SetRenderingContext(CRenderingContext *context)
Set the rendering context.
CRef< CGlTextureFont > GetCommentFont() const
const string & GetSizeLevel() const
bool AutoHideTrack() const
bool GetShowTrackMinusPlusSign() const
float GetCommentBottomMargin() const
bool GetShowMessage() const
float GetCommentTopMargin() const
static wxString ResolvePath(const wxString &path, const wxString &rel_name)
Utility function to hide the platform specifics of locating our standard directories and files.
CTrackContainer - a track container in the form of layout track.
const TTrackProxies & GetSubtrackProxies() const
CTrackContainer inline methods.
CTempTrackProxy::TTrackProxies TTrackProxies
static string DataTypeToString(EDataType data_type)
static string ExtractFilterName(const string &source)
extract filter name from a source string.
static string ExtractAnnotName(const string &source)
extract anntation name from a source string.
static string MergeAnnotAndFilter(const string &annot, const string &filter)
create a new name based on annotation name and fitler string.
static void GetMatchedAnnots(const TAnnotMetaDataList &src_annots, const vector< string > &target_annots, const string &annot_type, const string &track_type, TAnnotNameTitleMap &out_annots)
Help function to find matched annotations.
virtual void LTH_OnLayoutChanged()=0
provides mouse coords in OpenGL viewport coord system
ITrackContainer The interface for layout track that is also a container of tracks.
virtual void CloseTrack(int order)=0
Close a track.
container_type::const_iterator const_iterator
container_type::iterator iterator
const_iterator end() const
iterator_bool insert(const value_type &val)
container_type::value_type value_type
const_iterator find(const key_type &key) const
iterator_bool insert(const value_type &val)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
#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)
static bool IsNAA(const string &annot, bool isStrict=false)
check if a given annotation is a named annotation accession[.version][number] when isSctrict == false...
static bool isRmtAnnotName(const string &sAnnotname)
check if a given annotation was created by a remote file pipeline
static CGlResMgr & Instance()
virtual void Translatef(GLfloat x, GLfloat y, GLfloat z)=0
virtual void Enable(GLenum glstate)=0
virtual void Begin(GLenum mode)=0
Start rendering.
virtual void BeginClippingRect(GLint x, GLint y, GLsizei width, GLsizei height)=0
void Color3f(GLfloat r, GLfloat g, GLfloat b)
TModelPoint UnProject(TVPUnit m_x, TVPUnit m_y) const
void Offset(T d_x, T d_y)
IRender & GetGl()
convenience function for getting current render manager
void Vertex2d(GLdouble x, GLdouble y)
TVPRect & GetViewport(void)
virtual TModelUnit TextHeight(const CGlTextureFont *font) const =0
virtual TModelUnit TextWidth(const CGlTextureFont *font, const char *text) const =0
virtual void PopMatrix()=0
CGlPoint< T > CenterPoint() const
virtual void EndClippingRect()=0
virtual bool IsPrinterFriendly() const =0
virtual void End()=0
Finish rendering (create buffer and send to renderer)
void Color4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
virtual void Disable(GLenum glstate)=0
glDisable()
virtual void ColorC(const CRgbaColor &c)=0
Set current color (glColor{3,4}{f,d}{v,})
virtual void PushMatrix()=0
string Truncate(const char *text, TModelUnit w, ETruncate trunc=eTruncate_Ellipsis) const
Truncate text to the secified width.
TVPPoint Project(TModelUnit m_x, TModelUnit m_y) const
virtual void AddRow(const string &sContents="", unsigned colspan=2)=0
add a row with a cell, spanning across all columns
virtual bool IsEmpty() const =0
Indicates if the tooltip is empty.
void Reset(void)
Reset reference object.
position_type GetLength(void) const
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
static string Int8ToString(Int8 value, TNumToStringFlags flags=0, int base=10)
Convert Int8 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 & ToLower(string &str)
Convert string to lower case – string& version.
const string & GetHost(void) const
TFrom GetFrom(void) const
Get the From member data.
unsigned int
A callback function used to compare two keys in a database.
static const string kFilterSeparator
static const int kInvalidIcon
in pixel
const struct ncbi::grid::netcache::search::fields::KEY key
const CharType(& source)[N]
std::istream & in(std::istream &in_, double &x_)
A help struct for storing information about a icon.
TIconID m_Id
must be unique within the context