54 #include <wx/stattext.h>
56 #include <wx/dcclient.h>
76 bool Create(wxWindow* parent);
78 void OnPaint(wxPaintEvent& event);
79 void OnMouseEnter(wxMouseEvent& event);
80 void OnMouseLeave(wxMouseEvent& event);
81 void OnLeftDown(wxMouseEvent& event);
86 wxSize x_GetTextAreaSize();
95 void x_OnSelectionEvent(
CEvent*);
109 : m_ActiveClient(
NULL)
111 , mf_AutoBroadcast(
true)
127 LOG_POST(
Info <<
"Finished initializing Selection Service");
158 LOG_POST(
Info <<
"Finished shutting down Selection Service");
167 client->SetSelectionService(
this);
173 ERR_POST(
"CSelectionService::AttachClient() - client already registered");
191 ERR_POST(
"CSelectionService::DetachClient() - client is not attached");
226 static bool fReentry =
false;
239 vector<CGBProjectHandle::TId> loaded = ws->GetLoadedProjects();
240 ITERATE(vector<CGBProjectHandle::TId>, it, loaded) {
254 }
NCBI_CATCH(
"CSelectionService::Broadcast()");
260 source->BroadcastSelection();
409 , m_SelectionService(
NULL)
417 if (selectionService) {
439 long style = wxCLIP_CHILDREN | wxBORDER_NONE;
441 if( wxPanel::Create(parent,
wxID_ANY, wxDefaultPosition, wxSize(), style) ){
443 SetBackgroundStyle(wxBG_STYLE_CUSTOM);
457 wxDefaultPosition, wxDefaultSize,
458 wxALIGN_CENTRE_HORIZONTAL | wxST_NO_AUTORESIZE
463 wxSize sz = GetSize();
483 wxClientDC dc(
this );
484 dc.SetFont( GetFont() );
488 dc.GetTextExtent( wx_s, &
size.x, &
size.y );
523 s +=
"Exact molecule id matching for selection broadcasting is set";
525 s +=
"Molecule versions not used for matching of selection broadcasts";
546 tooltip +=
wxT(
"\n\nClick to see Broadcast Options");
575 wxRect rc = GetRect();
578 wxBrush brush(back_cl);
580 dc.SetPen(*wxTRANSPARENT_PEN);
582 dc.DrawRectangle(rc);
586 rc = this->GetRect();
589 wxFont font = GetFont();
590 font.SetUnderlined(
m_Hot);
596 const wxColor& text_cl =
598 dc.SetTextForeground(text_cl);
605 dc.GetTextExtent(s, &w, &h);
607 int pos_y = rc.y + (rc.height - h) / 2;
608 #if defined(__WXOSX_CARBON__) || defined(__WXMAC_CARBON__)
612 dc.DrawText(s, pos_x, pos_y);
635 evt.SetEventObject(
this);
636 GetEventHandler()->ProcessEvent(evt);
User-defined methods of the data storage class.
CEvent - generic event implementation TODO TODO - Attachments.
TViews & x_GetViews(void)
vector< CIRef< IProjectView > > TViews
CRegistryWriteView GetWriteView(const string §ion)
get a read-write view at a particular level.
static CGuiRegistry & GetInstance()
access the application-wide singleton
CRegistryReadView GetReadView(const string §ion) const
get a read-only view at a particular level.
CProjectService - a service providing API for operations with Workspaces and Projects.
class CRegistryReadView provides a nested hierarchical view at a particular key.
int GetInt(const string &key, int default_val=0) const
access a named key at this level, with no recursion
bool GetBool(const string &key, bool default_val=false) const
bool HasField(const string &key) const
Does a field with this section and key exist in this view?
void GetStringVec(const string &key, vector< string > &val) const
void Set(const string &key, int val)
access a named key at this level, with no recursion
CSelectionBroadcastSlot - a Status Bar slot that displays information about tasks in Application Task...
void OnPaint(wxPaintEvent &event)
~CSelectionBroadcastSlot()
void OnMouseLeave(wxMouseEvent &event)
CSelectionService * m_SelectionService
wxStaticText * m_TextItem
string x_StatusText(CSelectionEvent::EObjMatchPolicy fObj, CSelectionEvent::EIdMatchPolicy fId)
void x_OnSelectionEvent(CEvent *)
void SetSelectionService(CSelectionService *selectionService)
bool Create(wxWindow *parent)
string x_StatusTooltip(CSelectionEvent::EObjMatchPolicy fObj, CSelectionEvent::EIdMatchPolicy fId)
wxSize x_GetTextAreaSize()
void OnMouseEnter(wxMouseEvent &event)
CSelectionBroadcastSlot()
void OnLeftDown(wxMouseEvent &event)
int x_GetPendingTasksCount()
CSelectionEvent CSelectionEvent is used for broadcasting selection between views.
static bool sm_MatchByProduct
static EObjMatchPolicy sm_ObjMatchPolicy
static bool sm_TreeBroadcastOneToOne
Node properties used to compare trees when broadcasting.
static bool sm_InterDocBroadcast
static bool sm_MatchAlnLocs
static bool sm_AutoBroadcast
static vector< string > sm_TreeBroadcastProperties
broadcast sel. between documents
static EIdMatchPolicy sm_IdMatchPolicy
objects::CScope & GetScope()
virtual void SetRegistryPath(const string &path)
void GetClients(TClients &clients)
virtual void AttachClient(ISelectionClient *client)
void x_Broadcast(CSelectionEvent &evt, ISelectionClient *source, CGBDocument::TViews &views)
vector< ISelectionClient * > TClients
virtual ~CSelectionService()
virtual void GetActiveObjects(TConstScopedObjects &sel)
returns objects currently active in the application, this function should be used for obtaining argum...
IServiceLocator * m_SrvLocator
virtual bool IsAttached(ISelectionClient *client) const
void SetAutoBroadcast(bool pAuto)
virtual void DetachClient(ISelectionClient *client)
virtual void InitService()
virtual void SaveSettings() const
CSelectionBroadcastSlot * m_StatusBarSlot
virtual void GetCurrentSelection(TConstScopedObjects &sel)
returns objects currently selected in the application, this function should be used for obtaining arg...
void InitStatusBar(wxWindow *parent)
virtual void Broadcast(CSelectionEvent &evt, ISelectionClient *source)
request broadcasting of the given event, Broadcast() notifies observers about changes in selection (d...
virtual void LoadSettings()
virtual void OnSelectionChanged(ISelectionClient *source)
notifies Service and its observers about changes in selection
ISelectionClient * m_ActiveClient
virtual void SetServiceLocator(IServiceLocator *locator)
virtual void ShutDownService()
virtual void OnActiveClientChanged(ISelectionClient *active)
this function is called by GUI components to notify server
static wxColour GetTextColor(bool hot)
static wxColour GetBackColor(bool hot)
class IProjectView defines the abstract interface for views observing projects.
ISelectionClient - represents an object that support a notion of selection.
virtual void SetSelection(CSelectionEvent &evt)=0
set broadcasted selection
virtual void GetSelection(TConstScopedObjects &objects) const =0
shall return data objects representing selected things, return one data object for every selected thi...
virtual void GetActiveObjects(TConstScopedObjects &objects) const
IServiceLocator - an abstract mechanism for locating services.
#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 ERR_POST(message)
Error posting with file, line number information but without error codes.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
#define NCBI_CATCH(message)
Catch CExceptions as well This macro is deprecated - use *_X or *_XX variant instead of it.
void Info(CExceptionArgs_Base &args)
CIRef< T > GetServiceByType()
retrieves a typed reference to a service, the name of C++ type is used as the name of the service.
virtual void InsertSlot(int index, wxWindow *slot, int width=50)=0
virtual void RemoveListener(CEventHandler *listener)
Remove a listener.
void Post(CRef< CEvent > evt, EDispatch disp_how=eDispatch_Default, int pool_name=ePool_Default)
Handles an event asynchronously (process and/or dispatch).
#define END_EVENT_MAP()
Ends definition of Command Map.
#define BEGIN_EVENT_MAP(thisClass, baseClass)
Begins definition of Command Map for CEventHandler-derived class.
virtual void AddListener(CEventHandler *listener, int pool_name=ePool_Default)
Add a listener.
vector< SConstScopedObject > TConstScopedObjects
virtual bool Send(CEvent *evt, EDispatch disp_how=eDispatch_Default, int pool_name=ePool_Default)
Sends an event synchronously.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define NCBI_GUICORE_EXPORT
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
const CharType(& source)[N]
wxEVT_COMMAND_MENU_SELECTED
static const int kTextOffX
static const char * kMatchByProduct
static const char * kTreeBroadcastProperties
static const int kTextOffY
static const char * kObjMatchPolicy
ON_EVENT_RANGE(CSelectionServiceEvent, CSelectionServiceEvent::eClientAttached, CSelectionServiceEvent::eSelectionChanged, &CSelectionBroadcastSlot::x_OnSelectionEvent) CSelectionBroadcastSlot
CSelectionBroadcastSlot.
static const char * kIdMatchPolicy
static const char * kInterDocBroadcast
static const char * kTreeBroadcastOneToOne
static const char * kAutoBroadcast
static const char * kMatchAlnLocs
static CNamedPipeClient * client
wxString ToWxString(const string &s)
wxString TruncateText(wxDC &dc, const wxString &s, int w, Ewx_Truncate trunc=ewxTruncate_Ellipsis)
truncates given string so that its length is less or equal "w" "trunc" controls truncation,...