|
OpenASIP 2.2
|
#include <OSEdTreeView.hh>


Public Member Functions | |
| OSEdTreeView (wxWindow *parent, OSEdInfoView *infoView) | |
| virtual | ~OSEdTreeView () |
| Operation * | selectedOperation () |
| wxTreeItemId | selectedOperationId () |
| std::string | moduleOfOperation (wxTreeItemId id) |
| wxTreeItemId | moduleIdOfOperation (wxTreeItemId id) |
| std::string | pathOfModule (wxTreeItemId id) |
| wxTreeItemId | pathIdOfModule (wxTreeItemId id) |
| std::string | selectedPath () |
| wxTreeItemId | selectedPathId () |
| wxTreeItemId | selectedModuleId () |
| std::string | selectedModule () |
| OSEdInfoView * | infoView () const |
| std::vector< std::string > | constructTree () |
| void | addItem (wxTreeItemId parent, std::string item) |
| void | changeText (wxTreeItemId id, const std::string &text) |
| void | removeItem (wxTreeItemId id) |
| void | update () |
| bool | isPathSelected () const |
| bool | isModuleSelected () const |
| bool | isOperationSelected () const |
Private Types | |
| typedef std::map< std::string, wxTreeItemId >::value_type | ValType |
| Value type for the map. | |
| typedef std::map< std::string, wxTreeItemId >::iterator | Iter |
| Iterators for the maps. | |
| typedef std::multimap< std::string, wxTreeItemId >::iterator | IterM |
Private Member Functions | |
| OSEdTreeView (const OSEdTreeView &) | |
| Copying not allowed. | |
| OSEdTreeView & | operator= (const OSEdTreeView &) |
| Assignment not allowed. | |
| bool | isPath (wxTreeItemId id) const |
| bool | isModule (wxTreeItemId id) const |
| bool | isOperation (wxTreeItemId id) const |
| void | onItemClicked (wxTreeEvent &event) |
| void | onDropDownMenu (wxMouseEvent &event) |
| void | onItemSelected (wxTreeEvent &event) |
Private Attributes | |
| OSEdInfoView * | infoView_ |
| An info window controlled by tree view. | |
| std::map< std::string, wxTreeItemId > | paths_ |
| Paths of the operation data base. | |
| std::multimap< std::string, wxTreeItemId > | modules_ |
| Modules of the operation data base. | |
| std::multimap< std::string, wxTreeItemId > | operations_ |
| Operations of operation data base. | |
Models a tree view of the operation data base.
Shows a tree-like structure of search paths, operation modules, and operations.
Definition at line 54 of file OSEdTreeView.hh.
|
private |
Iterators for the maps.
Definition at line 85 of file OSEdTreeView.hh.
|
private |
Definition at line 86 of file OSEdTreeView.hh.
|
private |
Value type for the map.
Definition at line 83 of file OSEdTreeView.hh.
| OSEdTreeView::OSEdTreeView | ( | wxWindow * | parent, |
| OSEdInfoView * | infoView | ||
| ) |
Constructor.
| parent. | Parent window. |
| infoView | Info view controlled by tree view. |
Definition at line 71 of file OSEdTreeView.cc.
|
virtual |
|
private |
Copying not allowed.
| void OSEdTreeView::addItem | ( | wxTreeItemId | parent, |
| std::string | item | ||
| ) |
Adds an item to the tree.
| parent | Parent id. |
| item | The item to be added. |
Definition at line 573 of file OSEdTreeView.cc.
References assert, isModule(), isPath(), modules_, operations_, and WxConversion::toWxString().
Referenced by OSEdAddModuleCmd::Do(), and OSEdAddOperationCmd::Do().

| void OSEdTreeView::changeText | ( | wxTreeItemId | id, |
| const std::string & | text | ||
| ) |
Changes the text of the item.
| id | Id of the item to be changed. |
| text | New label. |
Definition at line 592 of file OSEdTreeView.cc.
References isModule(), isOperation(), isPath(), MapTools::keyForValue(), modules_, operations_, paths_, and WxConversion::toWxString().
Referenced by OSEdPropertiesCmd::Do().

| vector< string > OSEdTreeView::constructTree | ( | ) |
Constructs the tree structure.
If errors occurs while constructing the tree structure, the error messages are collected and returned.
Definition at line 90 of file OSEdTreeView.cc.
References ObjectState::child(), ObjectState::childCount(), Exception::errorMessage(), FileSystem::fileExists(), infoView_, NullOperationBehavior::instance(), Operation::loadState(), OperationIndex::module(), OperationIndex::moduleCount(), modules_, OperationModule::name(), OperationIndex::operationCount(), OperationContainer::operationIndex(), OperationIndex::operationName(), operations_, OperationContainer::operationSerializer(), Environment::osalPaths(), paths_, OSEdInfoView::pathView(), OperationModule::propertiesModule(), OperationSerializer::readState(), OperationSerializer::setSourceFile(), and WxConversion::toWxString().
Referenced by OSEd::OnInit().

| OSEdInfoView * OSEdTreeView::infoView | ( | ) | const |
Returns pointer to info view.
Definition at line 662 of file OSEdTreeView.cc.
References infoView_.
Referenced by OSEdRemoveModuleCmd::Do(), and OSEdRemoveOperationCmd::Do().
|
private |
Returns true if tree node with given id is a module.
| id | Id of the tree node. |
Definition at line 305 of file OSEdTreeView.cc.
References MapTools::containsValue(), and modules_.
Referenced by addItem(), changeText(), onDropDownMenu(), onItemSelected(), and removeItem().

| bool OSEdTreeView::isModuleSelected | ( | ) | const |
Returns true if a module is selected.
Definition at line 731 of file OSEdTreeView.cc.
References MapTools::containsValue(), infoView_, modules_, and OSEdInfoView::selectedModule().
Referenced by OSEdRemoveModuleCmd::isEnabled().

|
private |
Return true if tree node with given id is an operation.
| id | Id of the tree node. |
Definition at line 316 of file OSEdTreeView.cc.
References MapTools::containsValue(), and operations_.
Referenced by changeText(), onDropDownMenu(), onItemClicked(), onItemSelected(), and removeItem().

| bool OSEdTreeView::isOperationSelected | ( | ) | const |
Returns true if an operation is selected.
Definition at line 745 of file OSEdTreeView.cc.
References MapTools::containsValue(), infoView_, operations_, and OSEdInfoView::selectedOperation().
Referenced by OSEdModifyBehaviorCmd::isEnabled(), OSEdRemoveOperationCmd::isEnabled(), and OSEdSimulateCmd::isEnabled().

|
private |
Returns true if tree node with given id is a path.
| id | Id of the tree node. |
Definition at line 294 of file OSEdTreeView.cc.
References MapTools::containsValue(), and paths_.
Referenced by addItem(), changeText(), onDropDownMenu(), onItemSelected(), and removeItem().

| bool OSEdTreeView::isPathSelected | ( | ) | const |
Returns true if a path is selected.
Definition at line 716 of file OSEdTreeView.cc.
References MapTools::containsValue(), infoView_, paths_, and OSEdInfoView::selectedPath().

| wxTreeItemId OSEdTreeView::moduleIdOfOperation | ( | wxTreeItemId | id | ) |
Returns the id of the module of the operation with a given id.
| id | The id of the operation. |
Definition at line 420 of file OSEdTreeView.cc.
Referenced by OSEdModifyBehaviorCmd::Do(), OSEdPropertiesCmd::Do(), OSEdRemoveOperationCmd::Do(), OSEdSimulateCmd::Do(), OSEdModifyBehaviorCmd::isEnabled(), and OSEdRemoveOperationCmd::isEnabled().
| string OSEdTreeView::moduleOfOperation | ( | wxTreeItemId | id | ) |
Returns the module of an operation with a given id.
| id | The id of operation. |
Definition at line 407 of file OSEdTreeView.cc.
References MapTools::keyForValue(), and modules_.
Referenced by OSEdModifyBehaviorCmd::Do(), OSEdPropertiesCmd::Do(), OSEdRemoveOperationCmd::Do(), OSEdSimulateCmd::Do(), OSEdModifyBehaviorCmd::isEnabled(), and onItemSelected().

|
private |
Handles the event when right mouse button is clicked.
A different drop down menu is showed, depending on where mouse button is clicked.
| event | Event to be handled. |
Definition at line 243 of file OSEdTreeView.cc.
References OSEdTextGenerator::instance(), isModule(), isOperation(), isPath(), DropDownMenu::MENU_MODULE, DropDownMenu::MENU_OPERATION, DropDownMenu::MENU_PATH, OSEdMainFrame::statusBar(), Texts::TextGenerator::text(), WxConversion::toWxString(), OSEdTextGenerator::TXT_STATUS_MODULE_SELECTED, OSEdTextGenerator::TXT_STATUS_OPERATION_SELECTED, and OSEdTextGenerator::TXT_STATUS_PATH_SELECTED.

|
private |
Handles the event when item is selected on tree by double-clicking with mouse.
Double clicking an operation opens an operation property dialog, where operation properties can be modified.
| event | Event to be handled. |
Definition at line 220 of file OSEdTreeView.cc.
References OSEdConstants::CMD_PROPERTIES, CommandRegistry::createCommand(), GUICommand::Do(), isOperation(), OSEdMainFrame::registry(), and GUICommand::setParentWindow().

|
private |
Handles the event when item is selected on tree.
If selected item is a path, path view is shown. If selected item is a module, module view is shown. If selected item is an operation, operation view is shown.
| event | The event to be handled. |
Definition at line 171 of file OSEdTreeView.cc.
References infoView_, OSEdTextGenerator::instance(), isModule(), isOperation(), isPath(), MapTools::keyForValue(), moduleOfOperation(), modules_, OSEdInfoView::moduleView(), OSEdInfoView::operationPropertyView(), operations_, OSEdInfoView::operationView(), pathOfModule(), paths_, OSEdInfoView::pathView(), OSEdMainFrame::statusBar(), Texts::TextGenerator::text(), WxConversion::toWxString(), OSEdTextGenerator::TXT_STATUS_MODULE_SELECTED, OSEdTextGenerator::TXT_STATUS_OPERATION_SELECTED, and OSEdTextGenerator::TXT_STATUS_PATH_SELECTED.

|
private |
Assignment not allowed.
| wxTreeItemId OSEdTreeView::pathIdOfModule | ( | wxTreeItemId | id | ) |
Returns the id of the path in which module with given id belongs to.
| id | Id of the module. |
Definition at line 444 of file OSEdTreeView.cc.
| string OSEdTreeView::pathOfModule | ( | wxTreeItemId | id | ) |
Returns the path of the module with given id.
| id | The id of the module. |
Definition at line 431 of file OSEdTreeView.cc.
References MapTools::keyForValue(), and paths_.
Referenced by OSEdAddOperationCmd::Do(), OSEdBuildCmd::Do(), OSEdModifyBehaviorCmd::Do(), OSEdPropertiesCmd::Do(), OSEdRemoveModuleCmd::Do(), OSEdRemoveOperationCmd::Do(), OSEdSimulateCmd::Do(), OSEdAddOperationCmd::isEnabled(), OSEdBuildCmd::isEnabled(), OSEdModifyBehaviorCmd::isEnabled(), OSEdRemoveModuleCmd::isEnabled(), OSEdRemoveOperationCmd::isEnabled(), onItemSelected(), and selectedOperation().

| void OSEdTreeView::removeItem | ( | wxTreeItemId | id | ) |
Removes an item from the tree view.
Collapses the parent and set the parent selected.
| id | The id of the item to be removed. |
Definition at line 622 of file OSEdTreeView.cc.
References assert, isModule(), isOperation(), isPath(), MapTools::keyForValue(), modules_, and operations_.
Referenced by OSEdRemoveModuleCmd::Do(), and OSEdRemoveOperationCmd::Do().

| string OSEdTreeView::selectedModule | ( | ) |
Returns the selected module.
If no module is selected, an empty string is returned.
Definition at line 513 of file OSEdTreeView.cc.
References modules_.
Referenced by OSEdAddOperationCmd::Do(), OSEdBuildCmd::Do(), OSEdRemoveModuleCmd::Do(), OSEdAddOperationCmd::isEnabled(), OSEdBuildCmd::isEnabled(), and selectedOperation().
| wxTreeItemId OSEdTreeView::selectedModuleId | ( | ) |
Returns the id of selected module.
| NotAvailable | If no module is selected. |
Definition at line 537 of file OSEdTreeView.cc.
References __func__, assert, MapTools::containsValue(), and modules_.
Referenced by OSEdAddOperationCmd::Do(), OSEdBuildCmd::Do(), OSEdRemoveModuleCmd::Do(), OSEdAddOperationCmd::isEnabled(), OSEdBuildCmd::isEnabled(), OSEdRemoveModuleCmd::isEnabled(), and selectedOperation().

| Operation * OSEdTreeView::selectedOperation | ( | ) |
Returns the selected operation.
If no operation is selected, NULL is returned.
Definition at line 328 of file OSEdTreeView.cc.
References assert, infoView_, OperationContainer::operation(), operations_, pathOfModule(), selectedModule(), selectedModuleId(), OSEdInfoView::selectedOperation(), and WxConversion::toString().
Referenced by OSEdPropertiesCmd::Do(), OSEdRemoveOperationCmd::Do(), OSEdSimulateCmd::Do(), OSEdPropertiesCmd::isEnabled(), and OSEdSimulateCmd::isEnabled().

| wxTreeItemId OSEdTreeView::selectedOperationId | ( | ) |
Returns the id of selected operation.
| NotAvailable | If no operation is selected. |
Definition at line 379 of file OSEdTreeView.cc.
References __func__, infoView_, operations_, and OSEdInfoView::selectedOperation().
Referenced by OSEdModifyBehaviorCmd::Do(), OSEdPropertiesCmd::Do(), OSEdRemoveOperationCmd::Do(), OSEdSimulateCmd::Do(), OSEdModifyBehaviorCmd::isEnabled(), and OSEdRemoveOperationCmd::isEnabled().

| string OSEdTreeView::selectedPath | ( | ) |
Returns the selected path.
If not path is selected, an empty string is returned.
Definition at line 456 of file OSEdTreeView.cc.
References infoView_, paths_, and OSEdInfoView::selectedPath().
Referenced by OSEdAddModuleCmd::Do(), and OSEdAddModuleCmd::isEnabled().

| wxTreeItemId OSEdTreeView::selectedPathId | ( | ) |
Returns the id of selected path.
| NotAvailable | If path is not selected. |
Definition at line 480 of file OSEdTreeView.cc.
References __func__, assert, infoView_, paths_, and OSEdInfoView::selectedPath().
Referenced by OSEdAddModuleCmd::Do().

| void OSEdTreeView::update | ( | ) |
Updates the treeview.
Definition at line 670 of file OSEdTreeView.cc.
References infoView_, modules_, OSEdInfoView::moduleView(), OSEdInfoView::operationPropertyView(), operations_, OSEdInfoView::operationView(), paths_, OSEdInfoView::pathView(), and WxConversion::toString().
Referenced by OSEdAddModuleCmd::Do(), OSEdAddOperationCmd::Do(), and OSEdPropertiesCmd::Do().

|
private |
An info window controlled by tree view.
Definition at line 102 of file OSEdTreeView.hh.
Referenced by constructTree(), infoView(), isModuleSelected(), isOperationSelected(), isPathSelected(), onItemSelected(), selectedOperation(), selectedOperationId(), selectedPath(), selectedPathId(), and update().
|
private |
Modules of the operation data base.
Definition at line 106 of file OSEdTreeView.hh.
Referenced by addItem(), changeText(), constructTree(), isModule(), isModuleSelected(), moduleOfOperation(), onItemSelected(), removeItem(), selectedModule(), selectedModuleId(), and update().
|
private |
Operations of operation data base.
Definition at line 108 of file OSEdTreeView.hh.
Referenced by addItem(), changeText(), constructTree(), isOperation(), isOperationSelected(), onItemSelected(), removeItem(), selectedOperation(), selectedOperationId(), and update().
|
private |
Paths of the operation data base.
Definition at line 104 of file OSEdTreeView.hh.
Referenced by changeText(), constructTree(), isPath(), isPathSelected(), onItemSelected(), pathOfModule(), selectedPath(), selectedPathId(), and update().