OpenASIP  2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
OSEdMainFrame Class Reference

#include <OSEdMainFrame.hh>

Inheritance diagram for OSEdMainFrame:
Inheritance graph
Collaboration diagram for OSEdMainFrame:
Collaboration graph

Public Member Functions

 OSEdMainFrame (const wxString &title, const wxPoint &pos, const wxSize &size)
 
virtual ~OSEdMainFrame ()
 
OSEdTreeViewtreeView () const
 
CommandRegistryregistry () const
 
OSEdInformerinformer () const
 
wxStatusBar * statusBar () const
 
void updateMenuBar ()
 
void onCommandEvent (wxCommandEvent &event)
 

Private Member Functions

 OSEdMainFrame (const OSEdMainFrame &)
 Copying not allowed. More...
 
OSEdMainFrameoperator= (const OSEdMainFrame &)
 Assignment not allowed. More...
 

Private Attributes

CommandRegistryregistry_
 Command registry. More...
 
OSEdTreeViewtreeView_
 Tree view. More...
 
OSEdInformerinformer_
 Informs listener classes for events that occurs. More...
 
wxStatusBar * statusBar_
 Status bar of the main window. More...
 

Detailed Description

Main window of the application.

Contains a splitted window for showing data and a menu bar for executing actions.

Definition at line 49 of file OSEdMainFrame.hh.

Constructor & Destructor Documentation

◆ OSEdMainFrame() [1/2]

OSEdMainFrame::OSEdMainFrame ( const wxString &  title,
const wxPoint &  pos,
const wxSize &  size 
)

Constructor.

Parameters
titleWindow title.
posWindow position.
sizeWindow size.

Definition at line 82 of file OSEdMainFrame.cc.

85  : wxFrame((wxFrame *)NULL, -1, title, pos, size),
86  registry_(NULL), treeView_(NULL), informer_(NULL) {
87 
88  wxImage::AddHandler(new wxPNGHandler);
89  // set logo
90  string logoPath =
93  logoPath += FileSystem::DIRECTORY_SEPARATOR +
95  wxBitmap bmp;
96  bmp.LoadFile(WxConversion::toWxString(logoPath), wxBITMAP_TYPE_PNG);
97  wxIcon logo;
98  logo.CopyFromBitmap(bmp);
99  SetIcon(logo);
100 
102 
103  // create default menu bar
104  wxMenu* menu = new wxMenu;
105  format fmt = texts.text(OSEdTextGenerator::TXT_MENU_OPTIONS);
106  menu->Append(
109  menu->Append(OSEdConstants::CMD_QUIT, WxConversion::toWxString(fmt.str()));
110 
111  wxMenuBar* menuBar = new wxMenuBar;
113  menuBar->Append(menu, WxConversion::toWxString(fmt.str()));
114 
115  menu = new wxMenu;
117  menu->Append(
119 
121  menu->Append(
123  WxConversion::toWxString(fmt.str()));
124 
126  menu->Append(
128 
130  menu->Append(
132 
134  menu->Append(
136 
138  menu->Append(
140  WxConversion::toWxString(fmt.str()));
141 
143  menu->Append(
145 
147  menu->Append(
149 
151  menu->Append(
153 
155  menu->Append(
157 
159  menuBar->Append(menu, WxConversion::toWxString(fmt.str()));
160 
161  menu = new wxMenu;
163  menu->Append(
165 
167  menu->Append(
169 
171  menuBar->Append(menu, WxConversion::toWxString(fmt.str()));
172 
173  SetMenuBar(menuBar);
174  statusBar_ = CreateStatusBar();
175 
176  // add all custom commands to command registry
177  registry_ = new CommandRegistry();
192 
193  // create splitted window
194  wxSplitterWindow* splitter = new wxSplitterWindow(
195  this, -1, wxPoint(0, 0), wxSize(900, 500), wxSP_3D);
196 
197  OSEdInfoView* infoView = new OSEdInfoView(splitter);
198  treeView_ = new OSEdTreeView(splitter, infoView);
199 
200  splitter->SplitVertically(treeView_, infoView);
201 
202  informer_ = new OSEdInformer();
203 }

References OSEdConstants::APPLICATION_NAME, Environment::bitmapsDirPath(), OSEdConstants::CMD_ABOUT, OSEdConstants::CMD_ADD_MODULE, OSEdConstants::CMD_ADD_OPERATION, OSEdConstants::CMD_BUILD, OSEdConstants::CMD_BUILD_ALL, OSEdConstants::CMD_MEMORY, OSEdConstants::CMD_MODIFY_BEHAVIOR, OSEdConstants::CMD_OPTIONS, OSEdConstants::CMD_PROPERTIES, OSEdConstants::CMD_QUIT, OSEdConstants::CMD_REMOVE_MODULE, OSEdConstants::CMD_REMOVE_OPERATION, OSEdConstants::CMD_SIMULATE, UserManualCmd::COMMAND_ID, FileSystem::DIRECTORY_SEPARATOR, OSEdTextGenerator::instance(), OSEdConstants::LOGO_NAME, Texts::TextGenerator::text(), WxConversion::toString(), WxConversion::toWxString(), OSEdTextGenerator::TXT_MENU_ABOUT, OSEdTextGenerator::TXT_MENU_ADD_MODULE, OSEdTextGenerator::TXT_MENU_ADD_OPERATION, OSEdTextGenerator::TXT_MENU_BUILD, OSEdTextGenerator::TXT_MENU_BUILD_ALL, OSEdTextGenerator::TXT_MENU_FILE, OSEdTextGenerator::TXT_MENU_HELP, OSEdTextGenerator::TXT_MENU_MEMORY, OSEdTextGenerator::TXT_MENU_MODIFY_BEHAVIOR, OSEdTextGenerator::TXT_MENU_MODIFY_PROPERTIES, OSEdTextGenerator::TXT_MENU_OPTIONS, OSEdTextGenerator::TXT_MENU_QUIT, OSEdTextGenerator::TXT_MENU_REMOVE_MODULE, OSEdTextGenerator::TXT_MENU_REMOVE_OPERATION, OSEdTextGenerator::TXT_MENU_SIMULATE, OSEdTextGenerator::TXT_MENU_TOOLS, and OSEdTextGenerator::TXT_MENU_USER_MANUAL.

Here is the call graph for this function:

◆ ~OSEdMainFrame()

OSEdMainFrame::~OSEdMainFrame ( )
virtual

Destructor.

Definition at line 208 of file OSEdMainFrame.cc.

208  {
209  delete registry_;
210  registry_ = NULL;
211  delete informer_;
212  informer_ = NULL;
213 }

References informer_, and registry_.

◆ OSEdMainFrame() [2/2]

OSEdMainFrame::OSEdMainFrame ( const OSEdMainFrame )
private

Copying not allowed.

Member Function Documentation

◆ informer()

OSEdInformer * OSEdMainFrame::informer ( ) const

Returns informer instance.

Returns
The informer instance.

Definition at line 261 of file OSEdMainFrame.cc.

261  {
262  return informer_;
263 }

References informer_.

◆ onCommandEvent()

void OSEdMainFrame::onCommandEvent ( wxCommandEvent &  event)

Handles menu events.

Parameters
eventEvent to be handled.

Definition at line 221 of file OSEdMainFrame.cc.

221  {
222  GUICommand* command = registry_->createCommand(event.GetId());
223  if (command == NULL) {
225  format fmt = texts.text(OSEdTextGenerator::TXT_ERROR_NO_HANDLER);
226  ErrorDialog dialog(this, WxConversion::toWxString(fmt.str()));
227  dialog.ShowModal();
228  return;
229  }
230  command->setParentWindow(this);
231  command->Do();
232  delete command;
233 }

References CommandRegistry::createCommand(), GUICommand::Do(), OSEdTextGenerator::instance(), registry_, GUICommand::setParentWindow(), Texts::TextGenerator::text(), WxConversion::toWxString(), and OSEdTextGenerator::TXT_ERROR_NO_HANDLER.

Here is the call graph for this function:

◆ operator=()

OSEdMainFrame& OSEdMainFrame::operator= ( const OSEdMainFrame )
private

Assignment not allowed.

◆ registry()

CommandRegistry * OSEdMainFrame::registry ( ) const

Returns the command registry.

Returns
the command registry.

Definition at line 251 of file OSEdMainFrame.cc.

251  {
252  return registry_;
253 }

References registry_.

Referenced by OSEdTreeView::onItemClicked().

◆ statusBar()

wxStatusBar * OSEdMainFrame::statusBar ( ) const

Returns status bar of the frame.

Returns
Status bar.

Definition at line 271 of file OSEdMainFrame.cc.

271  {
272  return statusBar_;
273 }

References statusBar_.

Referenced by OSEdInfoView::onDropDownMenu(), OSEdTreeView::onDropDownMenu(), OSEdTreeView::onItemSelected(), and OSEdInfoView::onSelection().

◆ treeView()

OSEdTreeView * OSEdMainFrame::treeView ( ) const

Returns pointer to the tree view.

Returns
Pointer to the tree view.

Definition at line 241 of file OSEdMainFrame.cc.

241  {
242  return treeView_;
243 }

References treeView_.

Referenced by OSEdAddModuleCmd::Do(), OSEdSimulateCmd::Do(), OSEdPropertiesCmd::Do(), OSEdAddOperationCmd::Do(), OSEdBuildCmd::isEnabled(), and OSEd::OnInit().

◆ updateMenuBar()

void OSEdMainFrame::updateMenuBar ( )

Updates the menu bar disabled/enabled states.

Definition at line 279 of file OSEdMainFrame.cc.

279  {
280  wxMenuBar* menubar = GetMenuBar();
281  GUICommand* command = registry_->firstCommand();
282  while (command != NULL) {
283  if (menubar->FindItem(command->id()) != NULL) {
284  if (command->isEnabled()) {
285  menubar->Enable(command->id(), true);
286  } else {
287  menubar->Enable(command->id(), false);
288  }
289  }
290  command = registry_->nextCommand();
291  }
292 }

References CommandRegistry::firstCommand(), GUICommand::id(), GUICommand::isEnabled(), CommandRegistry::nextCommand(), and registry_.

Referenced by OSEd::OnInit(), and OSEdInfoView::onSelection().

Here is the call graph for this function:

Member Data Documentation

◆ informer_

OSEdInformer* OSEdMainFrame::informer_
private

Informs listener classes for events that occurs.

Definition at line 77 of file OSEdMainFrame.hh.

Referenced by informer(), and ~OSEdMainFrame().

◆ registry_

CommandRegistry* OSEdMainFrame::registry_
private

Command registry.

Definition at line 73 of file OSEdMainFrame.hh.

Referenced by onCommandEvent(), registry(), updateMenuBar(), and ~OSEdMainFrame().

◆ statusBar_

wxStatusBar* OSEdMainFrame::statusBar_
private

Status bar of the main window.

Definition at line 79 of file OSEdMainFrame.hh.

Referenced by statusBar().

◆ treeView_

OSEdTreeView* OSEdMainFrame::treeView_
private

Tree view.

Definition at line 75 of file OSEdMainFrame.hh.

Referenced by treeView().


The documentation for this class was generated from the following files:
GUICommand::setParentWindow
void setParentWindow(wxWindow *view)
Definition: GUICommand.cc:64
OSEdTextGenerator::TXT_MENU_USER_MANUAL
@ TXT_MENU_USER_MANUAL
User manual menu label.
Definition: OSEdTextGenerator.hh:176
OSEdConstants::CMD_QUIT
@ CMD_QUIT
Quit command id.
Definition: OSEdConstants.hh:91
OSEdConstants::APPLICATION_NAME
static const wxString APPLICATION_NAME
The name of the application.
Definition: OSEdConstants.hh:110
OSEdQuitCmd
Definition: OSEdQuitCmd.hh:43
WxConversion::toWxString
static wxString toWxString(const std::string &source)
GUICommand::isEnabled
virtual bool isEnabled()=0
OSEdConstants::CMD_ADD_OPERATION
@ CMD_ADD_OPERATION
Add operation command id.
Definition: OSEdConstants.hh:93
OSEdOptionsCmd
Definition: OSEdOptionsCmd.hh:43
OSEdAboutCmd
Definition: OSEdAboutCmd.hh:43
OSEdConstants::CMD_MEMORY
@ CMD_MEMORY
Memory command id.
Definition: OSEdConstants.hh:104
OSEdAddModuleCmd
Definition: OSEdAddModuleCmd.hh:43
OSEdConstants::CMD_BUILD
@ CMD_BUILD
Build command id.
Definition: OSEdConstants.hh:98
OSEdConstants::CMD_REMOVE_OPERATION
@ CMD_REMOVE_OPERATION
Remove operation command id.
Definition: OSEdConstants.hh:96
OSEdBuildAllCmd
Definition: OSEdBuildAllCmd.hh:43
OSEdConstants::CMD_PROPERTIES
@ CMD_PROPERTIES
Operation properties command id.
Definition: OSEdConstants.hh:94
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
GUICommand::Do
virtual bool Do()=0
CommandRegistry::createCommand
GUICommand * createCommand(const int id)
Definition: CommandRegistry.cc:69
OSEdConstants::CMD_SIMULATE
@ CMD_SIMULATE
Simulate command id.
Definition: OSEdConstants.hh:100
Environment::bitmapsDirPath
static std::string bitmapsDirPath(const std::string &prog)
Definition: Environment.cc:201
OSEdMainFrame::informer_
OSEdInformer * informer_
Informs listener classes for events that occurs.
Definition: OSEdMainFrame.hh:77
OSEdTextGenerator::TXT_MENU_FILE
@ TXT_MENU_FILE
File menu label.
Definition: OSEdTextGenerator.hh:166
GUICommand
Definition: GUICommand.hh:43
ErrorDialog
Definition: ErrorDialog.hh:42
OSEdConstants::CMD_REMOVE_MODULE
@ CMD_REMOVE_MODULE
Remove module command id.
Definition: OSEdConstants.hh:95
OSEdRemoveOperationCmd
Definition: OSEdRemoveOperationCmd.hh:43
OSEdTreeView
Definition: OSEdTreeView.hh:54
OSEdTextGenerator::TXT_MENU_MODIFY_PROPERTIES
@ TXT_MENU_MODIFY_PROPERTIES
Modify properties menu label.
Definition: OSEdTextGenerator.hh:170
OSEdRemoveModuleCmd
Definition: OSEdRemoveModuleCmd.hh:43
OSEdBuildCmd
Definition: OSEdBuildCmd.hh:43
CommandRegistry
Definition: CommandRegistry.hh:47
OSEdInfoView
Definition: OSEdInfoView.hh:47
OSEdTextGenerator::TXT_MENU_ADD_OPERATION
@ TXT_MENU_ADD_OPERATION
Add operation menu label.
Definition: OSEdTextGenerator.hh:167
UserManualCmd
Definition: UserManualCmd.hh:40
OSEdConstants::CMD_OPTIONS
@ CMD_OPTIONS
Option command id.
Definition: OSEdConstants.hh:102
OSEdTextGenerator::TXT_MENU_ADD_MODULE
@ TXT_MENU_ADD_MODULE
Add module menu label.
Definition: OSEdTextGenerator.hh:169
OSEdModifyBehaviorCmd
Definition: OSEdModifyBehaviorCmd.hh:43
OSEdMainFrame::treeView_
OSEdTreeView * treeView_
Tree view.
Definition: OSEdMainFrame.hh:75
OSEdTextGenerator::TXT_MENU_OPTIONS
@ TXT_MENU_OPTIONS
Option menu label.
Definition: OSEdTextGenerator.hh:164
CommandRegistry::nextCommand
GUICommand * nextCommand()
Definition: CommandRegistry.cc:120
OSEdConstants::CMD_ADD_MODULE
@ CMD_ADD_MODULE
Add module command id.
Definition: OSEdConstants.hh:92
FileSystem::DIRECTORY_SEPARATOR
static const std::string DIRECTORY_SEPARATOR
Definition: FileSystem.hh:189
OSEdTextGenerator::TXT_ERROR_NO_HANDLER
@ TXT_ERROR_NO_HANDLER
Error when custom command handler is not found.
Definition: OSEdTextGenerator.hh:153
OSEdTextGenerator::TXT_MENU_QUIT
@ TXT_MENU_QUIT
Quit menu label.
Definition: OSEdTextGenerator.hh:165
OSEdTextGenerator::TXT_MENU_TOOLS
@ TXT_MENU_TOOLS
Tools menu label.
Definition: OSEdTextGenerator.hh:174
OSEdTextGenerator::TXT_MENU_HELP
@ TXT_MENU_HELP
Help menu label.
Definition: OSEdTextGenerator.hh:177
OSEdTextGenerator::TXT_MENU_BUILD_ALL
@ TXT_MENU_BUILD_ALL
Build all menu label.
Definition: OSEdTextGenerator.hh:172
OSEdConstants::CMD_ABOUT
@ CMD_ABOUT
About command id.
Definition: OSEdConstants.hh:101
UserManualCmd::COMMAND_ID
static const int COMMAND_ID
Command ID.
Definition: UserManualCmd.hh:58
OSEdTextGenerator::TXT_MENU_REMOVE_MODULE
@ TXT_MENU_REMOVE_MODULE
Remove module menu label.
Definition: OSEdTextGenerator.hh:178
OSEdTextGenerator::instance
static OSEdTextGenerator & instance()
Definition: OSEdTextGenerator.cc:214
OSEdTextGenerator::TXT_MENU_MODIFY_BEHAVIOR
@ TXT_MENU_MODIFY_BEHAVIOR
Modify behavior menu label.
Definition: OSEdTextGenerator.hh:179
OSEdConstants::CMD_BUILD_ALL
@ CMD_BUILD_ALL
Build all command id.
Definition: OSEdConstants.hh:99
OSEdTextGenerator
Definition: OSEdTextGenerator.hh:42
OSEdTextGenerator::TXT_MENU_REMOVE_OPERATION
@ TXT_MENU_REMOVE_OPERATION
Remove operation menu label.
Definition: OSEdTextGenerator.hh:168
GUICommand::id
virtual int id() const =0
CommandRegistry::firstCommand
GUICommand * firstCommand()
Definition: CommandRegistry.cc:104
OSEdConstants::LOGO_NAME
static const std::string LOGO_NAME
Name of the logo.
Definition: OSEdConstants.hh:116
OSEdTextGenerator::TXT_MENU_ABOUT
@ TXT_MENU_ABOUT
About menu label.
Definition: OSEdTextGenerator.hh:175
OSEdInformer
Definition: OSEdInformer.hh:47
OSEdTextGenerator::TXT_MENU_MEMORY
@ TXT_MENU_MEMORY
Memory menu label.
Definition: OSEdTextGenerator.hh:180
OSEdMainFrame::statusBar_
wxStatusBar * statusBar_
Status bar of the main window.
Definition: OSEdMainFrame.hh:79
WxConversion::toString
static std::string toString(const wxString &source)
OSEdTextGenerator::TXT_MENU_SIMULATE
@ TXT_MENU_SIMULATE
Simulate menu label.
Definition: OSEdTextGenerator.hh:173
OSEdMainFrame::registry_
CommandRegistry * registry_
Command registry.
Definition: OSEdMainFrame.hh:73
OSEdTextGenerator::TXT_MENU_BUILD
@ TXT_MENU_BUILD
Build menu label.
Definition: OSEdTextGenerator.hh:171
CommandRegistry::addCommand
void addCommand(GUICommand *command)
OSEdConstants::CMD_MODIFY_BEHAVIOR
@ CMD_MODIFY_BEHAVIOR
Modify operation behavior command id.
Definition: OSEdConstants.hh:97
OSEdSimulateCmd
Definition: OSEdSimulateCmd.hh:43
OSEdAddOperationCmd
Definition: OSEdAddOperationCmd.hh:43
OSEdPropertiesCmd
Definition: OSEdPropertiesCmd.hh:43
OSEdMemoryCmd
Definition: OSEdMemoryCmd.hh:43