OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ResultDialog Class Reference

#include <ResultDialog.hh>

Inheritance diagram for ResultDialog:
Inheritance graph
Collaboration diagram for ResultDialog:
Collaboration graph

Public Member Functions

 ResultDialog (wxWindow *parent, std::vector< std::string > output, const std::string &title, const std::string &module="")
 
virtual ~ResultDialog ()
 

Private Types

enum  { ID_RESULT , ID_BUTTON_OPEN }
 

Private Member Functions

 ResultDialog (const ResultDialog &)
 Copying not allowed.
 
ResultDialog operator= (const ResultDialog &)
 Assignment not allowed.
 
wxSizer * createContents (wxWindow *parent, bool call_fit, bool set_sizer)
 
void setTexts ()
 
virtual bool TransferDataToWindow ()
 
void onOpen (wxCommandEvent &event)
 

Private Attributes

wxTextCtrl * result_
 Result window pointer.
 
std::vector< std::string > output_
 Output of compilation.
 
std::string module_
 Module which was compiled or empty string, if all modules were compiled.
 

Detailed Description

Dialog that shows operation build results.

Definition at line 44 of file ResultDialog.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Widget ids.

Enumerator
ID_RESULT 
ID_BUTTON_OPEN 

Definition at line 67 of file ResultDialog.hh.

Constructor & Destructor Documentation

◆ ResultDialog() [1/2]

ResultDialog::ResultDialog ( wxWindow *  parent,
std::vector< std::string >  output,
const std::string &  title,
const std::string &  module = "" 
)

Constructor.

Parameters
parentParent window.

Definition at line 60 of file ResultDialog.cc.

64 :
65 wxDialog(parent, -1, _T(""),
67 wxDefaultSize, wxRESIZE_BORDER),
68 output_(output), module_(module) {
69
70 createContents(this, true, true);
71 result_ = dynamic_cast<wxTextCtrl*>(FindWindow(ID_RESULT));
72 result_->SetEditable(false);
73
74 FindWindow(wxID_OK)->SetFocus();
75 SetTitle(WxConversion::toWxString(title));
76 if (module_ == "") {
77 FindWindow(ID_BUTTON_OPEN)->Disable();
78 }
79 setTexts();
80}
static wxPoint getPosition(Dialogs dialog)
@ DIALOG_RESULT
Result dialog.
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
std::string module_
Module which was compiled or empty string, if all modules were compiled.
wxTextCtrl * result_
Result window pointer.
std::vector< std::string > output_
Output of compilation.
static wxString toWxString(const std::string &source)

References WxConversion::toWxString().

Here is the call graph for this function:

◆ ~ResultDialog()

ResultDialog::~ResultDialog ( )
virtual

Destructor.

Definition at line 85 of file ResultDialog.cc.

85 {
86 int x, y;
87 GetPosition(&x, &y);
88 wxPoint point(x, y);
90}
static void setPosition(Dialogs dialog, wxPoint point)

References DialogPosition::DIALOG_RESULT, and DialogPosition::setPosition().

Here is the call graph for this function:

◆ ResultDialog() [2/2]

ResultDialog::ResultDialog ( const ResultDialog )
private

Copying not allowed.

Member Function Documentation

◆ createContents()

wxSizer * ResultDialog::createContents ( wxWindow *  parent,
bool  call_fit,
bool  set_sizer 
)
private

Creates the contents of the dialog.

NOTE! This function was generated by wxDesigner.

Parameters
parentParent window.
call_fitIf true fits the contents inside the dialog.
set_sizerIf true, sets the main sizer as contents of dialog.
Returns
The created sizer.

Definition at line 161 of file ResultDialog.cc.

164 {
165
166 wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
167
168 wxTextCtrl *item1 = new wxTextCtrl( parent, ID_RESULT, wxT(""), wxDefaultPosition, wxSize(400,100), wxTE_MULTILINE );
169 item0->Add( item1, 1, wxGROW|wxALL, 5 );
170
171 wxBoxSizer *item2 = new wxBoxSizer( wxHORIZONTAL );
172
173 wxButton *item3 = new wxButton( parent, ID_BUTTON_OPEN, wxT("Open"), wxDefaultPosition, wxDefaultSize, 0 );
174 item2->Add( item3, 0, wxALIGN_CENTER|wxALL, 5 );
175
176 wxButton *item4 = new wxButton( parent, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
177 item2->Add( item4, 0, wxALIGN_CENTER|wxALL, 5 );
178
179 item0->Add( item2, 0, wxALIGN_CENTER|wxALL, 5 );
180
181 if (set_sizer)
182 {
183 parent->SetSizer( item0 );
184 if (call_fit)
185 item0->SetSizeHints( parent );
186 }
187
188 return item0;
189}

References ID_BUTTON_OPEN, and ID_RESULT.

◆ onOpen()

void ResultDialog::onOpen ( wxCommandEvent &  event)
private

Handles the event when Open button is pushed.

Definition at line 126 of file ResultDialog.cc.

126 {
127
129 OSEdOptions* options = wxGetApp().options();
130 string editor = options->editor();
131 if (editor == "") {
133 ErrorDialog error(this, WxConversion::toWxString(fmt.str()));
134 error.ShowModal();
135 } else {
136 if (FileSystem::fileExists(editor)) {
137 string cmd = editor + " " + module_;
138 CommandThread* thread = new CommandThread(cmd);
139 thread->Create();
140 thread->Run();
141 } else {
142 format fmt = texts.text(OSEdTextGenerator::TXT_ERROR_OPEN);
143 fmt % editor;
144 ErrorDialog dialog(this, WxConversion::toWxString(fmt.str()));
145 dialog.ShowModal();
146 }
147 }
148}
static MachInfoCmdLineOptions options
Definition MachInfo.cc:46
static bool fileExists(const std::string fileName)
static OSEdTextGenerator & instance()
@ TXT_ERROR_OPEN
Error when opening fails.
@ TXT_ERROR_NO_EDITOR
Error when no editor is given.
virtual boost::format text(int textId)

References FileSystem::fileExists(), OSEdTextGenerator::instance(), module_, options, Texts::TextGenerator::text(), WxConversion::toWxString(), OSEdTextGenerator::TXT_ERROR_NO_EDITOR, and OSEdTextGenerator::TXT_ERROR_OPEN.

Here is the call graph for this function:

◆ operator=()

ResultDialog ResultDialog::operator= ( const ResultDialog )
private

Assignment not allowed.

◆ setTexts()

void ResultDialog::setTexts ( )
private

Set texts to widgets.

Definition at line 96 of file ResultDialog.cc.

96 {
97
100
101 // buttons
102 WidgetTools::setLabel(&guiText, FindWindow(wxID_OK),
104
107}
@ TXT_BUTTON_OK
Label for OK button.
static GUITextGenerator * instance()
@ TXT_BUTTON_OPEN
Open button label.
static void setLabel(Texts::TextGenerator *generator, wxWindow *widget, int textID)

References ID_BUTTON_OPEN, GUITextGenerator::instance(), OSEdTextGenerator::instance(), WidgetTools::setLabel(), GUITextGenerator::TXT_BUTTON_OK, and OSEdTextGenerator::TXT_BUTTON_OPEN.

Here is the call graph for this function:

◆ TransferDataToWindow()

bool ResultDialog::TransferDataToWindow ( )
privatevirtual

Transfer data to window.

Returns
True if transfer is successful.

Definition at line 115 of file ResultDialog.cc.

115 {
116 for (size_t i = 0; i < output_.size(); i++) {
118 }
119 return wxWindow::TransferDataToWindow();
120}

References output_, result_, and WxConversion::toWxString().

Here is the call graph for this function:

Member Data Documentation

◆ module_

std::string ResultDialog::module_
private

Module which was compiled or empty string, if all modules were compiled.

Definition at line 78 of file ResultDialog.hh.

Referenced by onOpen().

◆ output_

std::vector<std::string> ResultDialog::output_
private

Output of compilation.

Definition at line 75 of file ResultDialog.hh.

Referenced by TransferDataToWindow().

◆ result_

wxTextCtrl* ResultDialog::result_
private

Result window pointer.

Definition at line 73 of file ResultDialog.hh.

Referenced by TransferDataToWindow().


The documentation for this class was generated from the following files: