33#include <boost/format.hpp>
72 wxTreeCtrl(parent,
OSEdConstants::CMD_TREE_ITEM), infoView_(infoView) {
92 vector<string> results;
97 wxTreeItemId root = AddRoot(_T(
"root"));
100 for (
size_t i = 0; i < paths.size(); i++) {
102 string pathName = paths[i];
118 for (
int j = 0; j < modules; j++) {
121 wxTreeItemId
module =
122 AppendItem(path, WxConversion::toWxString(mod.name()));
124 modules_.insert(std::pair<std::string, wxTreeItemId>(mod.
name(), module));
141 results.push_back(
"\n");
144 for (
int k = 0; k < operations; k++) {
153 SortChildren(module);
175 wxTreeItemId
id =
event.GetItem();
203 mainFrame->
statusBar()->SetStatusText(_T(
""));
207 wxGetApp().mainFrame()->updateMenuBar();
221 wxTreeItemId
id =
event.GetItem();
248 wxPoint pos =
event.GetPosition();
249 int flags = wxTREE_HITTEST_ONITEMLABEL;
250 wxTreeItemId
id = HitTest(pos, flags);
265 PopupMenu(menu, pos);
272 PopupMenu(menu, pos);
280 PopupMenu(menu, pos);
282 mainFrame->
statusBar()->SetStatusText(_T(
"Cannot open"));
333 string pathName =
"";
337 if (IsSelected((*it).second)) {
338 opName = (*it).first;
339 wxTreeItemId opId = (*it).second;
341 wxTreeItemId moduleId = GetItemParent(opId);
342 wxTreeItemId pathId = GetItemParent(moduleId);
383 if (IsSelected((*it).second)) {
392 if ((*it).first == name) {
408 wxTreeItemId modId = GetItemParent(
id);
421 return GetItemParent(
id);
432 wxTreeItemId pathId = GetItemParent(
id);
445 return GetItemParent(
id);
461 while (it !=
paths_.end()) {
462 if (IsSelected((*it).second)) {
484 while (it !=
paths_.end()) {
485 if (IsSelected((*it).second)) {
495 wxTreeItemId
id =
paths_[path];
519 if (IsSelected((*it).second)) {
526 string module = infoView_->selectedModule();
539 return GetSelection();
545 if (IsSelected((*it).second)) {
552 string module = infoView_->selectedModule();
556 wxTreeItemId
id = it->second;
576 modules_.insert(std::pair<std::string, wxTreeItemId>(item,
id));
578 operations_.insert(std::pair<std::string, wxTreeItemId>(item,
id));
598 operations_.insert(std::pair<std::string, wxTreeItemId>(text,
id));
604 modules_.insert(std::pair<std::string, wxTreeItemId>(text,
id));
624 wxTreeItemId parent = GetItemParent(
id);
641 if (GetItemParent((*ot).second) ==
id) {
673 while (it !=
paths_.end()) {
674 if (IsSelected((*it).second)) {
683 if (IsSelected((*itm).second)) {
684 wxTreeItemId pathId = GetItemParent((*itm).second);
694 if (IsSelected((*it).second)) {
695 wxTreeItemId modId = GetItemParent((*it).second);
696 wxTreeItemId pathId = GetItemParent(modId);
#define assert(condition)
END_EVENT_TABLE() using namespace IDF
GUICommand * createCommand(const int id)
static std::vector< std::string > osalPaths()
std::string errorMessage() const
static bool fileExists(const std::string fileName)
void setParentWindow(wxWindow *view)
static NullOperationBehavior & instance()
@ CMD_TREE_ITEM
Id for tree events.
@ CMD_PROPERTIES
Operation properties command id.
std::string selectedOperation()
void operationView(const std::string &path, const std::string &mod)
void moduleView(const std::string &name)
std::string selectedModule()
void operationPropertyView(const std::string &opName, const std::string &modName, const std::string &pathName)
std::string selectedPath()
CommandRegistry * registry() const
wxStatusBar * statusBar() const
static OSEdTextGenerator & instance()
@ TXT_STATUS_MODULE_SELECTED
Status bar text when module is selected.
@ TXT_STATUS_OPERATION_SELECTED
Status bar text when operation is selected.
@ TXT_STATUS_PATH_SELECTED
Status bar text when path is selected.
bool isModuleSelected() const
wxTreeItemId selectedModuleId()
std::string pathOfModule(wxTreeItemId id)
std::multimap< std::string, wxTreeItemId > operations_
Operations of operation data base.
std::vector< std::string > constructTree()
void changeText(wxTreeItemId id, const std::string &text)
void onItemClicked(wxTreeEvent &event)
bool isOperationSelected() const
wxTreeItemId selectedOperationId()
void addItem(wxTreeItemId parent, std::string item)
Operation * selectedOperation()
OSEdInfoView * infoView() const
bool isPathSelected() const
std::map< std::string, wxTreeItemId > paths_
Paths of the operation data base.
std::string selectedPath()
void onDropDownMenu(wxMouseEvent &event)
std::map< std::string, wxTreeItemId >::iterator Iter
Iterators for the maps.
bool isPath(wxTreeItemId id) const
bool isOperation(wxTreeItemId id) const
wxTreeItemId selectedPathId()
void removeItem(wxTreeItemId id)
bool isModule(wxTreeItemId id) const
OSEdInfoView * infoView_
An info window controlled by tree view.
std::string selectedModule()
wxTreeItemId moduleIdOfOperation(wxTreeItemId id)
void onItemSelected(wxTreeEvent &event)
wxTreeItemId pathIdOfModule(wxTreeItemId id)
std::multimap< std::string, wxTreeItemId > modules_
Modules of the operation data base.
std::multimap< std::string, wxTreeItemId >::iterator IterM
std::string moduleOfOperation(wxTreeItemId id)
ObjectState * child(int index) const
static OperationSerializer & operationSerializer()
static Operation * operation(const std::string &path, const std::string &module, const std::string &oper)
static OperationIndex & operationIndex()
std::string operationName(int i, const OperationModule &om)
OperationModule & module(int i)
int operationCount(const OperationModule &om)
virtual std::string name() const
virtual std::string propertiesModule() const
void setSourceFile(const std::string &filename)
virtual ObjectState * readState()
virtual void loadState(const ObjectState *state)
virtual boost::format text(int textId)
static wxString toWxString(const std::string &source)
static std::string toString(const wxString &source)