OpenASIP 2.2
Loading...
Searching...
No Matches
OSEdAboutDialog.cc
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2009 Tampere University.
3
4 This file is part of TTA-Based Codesign Environment (TCE).
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24/**
25 * @file OSEdAboutDialog.cc
26 *
27 * Definition of OSEdAboutDialog class.
28 *
29 * @author Jussi Nyk�nen 2004 (nykanen-no.spam-cs.tut.fi)
30 * @note rating: red
31 */
32
33#include <boost/format.hpp>
34#include <string>
35#include <wx/statline.h>
36
37#include "OSEdAboutDialog.hh"
38#include "WidgetTools.hh"
39#include "Environment.hh"
40#include "FileSystem.hh"
41#include "WxConversion.hh"
42#include "OSEdTextGenerator.hh"
43#include "GUITextGenerator.hh"
44#include "OSEdConstants.hh"
45#include "DialogPosition.hh"
46#include "tce_config.h"
47
48using boost::format;
49using std::string;
50
51/**
52 * Constructor.
53 *
54 * @param parent Parent window.
55 */
57 wxDialog(parent, -1, _T(""),
58 DialogPosition::getPosition(DialogPosition::DIALOG_ABOUT),
59 wxDefaultSize) {
60
61 createContents(this, true, true);
62 setTexts();
63}
64
65/**
66 * Destructor.
67 */
69 int x, y;
70 GetPosition(&x, &y);
71 wxPoint point(x, y);
73}
74
75/**
76 * Sets the texts for the dialog.
77 */
78void
80
83
84 // title
85 format fmt = osedTexts.text(OSEdTextGenerator::TXT_ABOUT_DIALOG_TITLE);
86 SetTitle(WxConversion::toWxString(fmt.str()));
87
88 // static texts
91
92 // buttons
93 WidgetTools::setLabel(&guiTexts, FindWindow(wxID_OK),
95}
96
97/**
98 * Creates the contents of the dialog.
99 *
100 * @param parent Parent window.
101 * @param call_fit If true fits the contents inside the dialog.
102 * @param set_sizer If true, sets the sizer as dialog contents.
103 * @return The created sizer.
104 */
105wxSizer*
107 wxWindow *parent, bool call_fit, bool set_sizer) {
108
109 wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
110 wxBitmap logo;
111
112 string dir = Environment::bitmapsDirPath(
114
115 string fileName = dir + FileSystem::DIRECTORY_SEPARATOR +
117
118 logo.LoadFile(WxConversion::toWxString(fileName), wxBITMAP_TYPE_PNG);
119 wxStaticBitmap* dialogLogo = new wxStaticBitmap(parent, -1, logo);
120
121 item0->Add(dialogLogo, 0, wxALIGN_CENTER|wxALL, 5 );
122 wxBoxSizer *item3 = new wxBoxSizer( wxVERTICAL );
123 wxStaticText *item4 =
124 new wxStaticText(parent, ID_ABOUT_TEXT, wxT("Operation Set Editor"),
125 wxDefaultPosition, wxDefaultSize, 0);
126 item3->Add( item4, 0, wxALIGN_CENTER|wxALL, 5 );
127 wxStaticText *item5 =
128 new wxStaticText(parent, -1, _T("OpenASIP ") + WxConversion::toWxString(VERSION),
129 wxDefaultPosition, wxDefaultSize, 0);
130 item3->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 );
131
132 wxStaticText *item6 =
133 new wxStaticText(parent, -1, OSEdConstants::OSED_COPYRIGHT,
134 wxDefaultPosition, wxDefaultSize, 0);
135 item3->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );
136
137 item0->Add( item3, 0, wxALIGN_CENTER|wxALL, 5 );
138 wxStaticLine *item7 =
139 new wxStaticLine(parent, -1, wxDefaultPosition,
140 wxSize(20,-1), wxLI_HORIZONTAL);
141 item0->Add( item7, 0, wxGROW|wxALL, 5 );
142 wxButton *item8 =
143 new wxButton(parent, wxID_OK, wxT("&OK"), wxDefaultPosition,
144 wxDefaultSize, 0);
145 item0->Add( item8, 0, wxALIGN_CENTER|wxALL, 5 );
146 if (set_sizer) {
147 parent->SetAutoLayout( TRUE );
148 parent->SetSizer( item0 );
149 if (call_fit)
150 {
151 item0->Fit( parent );
152 item0->SetSizeHints( parent );
153 }
154 }
155
156 return item0;
157}
const string TRUE
Value used for true in attribute and element values.
static void setPosition(Dialogs dialog, wxPoint point)
@ DIALOG_ABOUT
About dialog.
static std::string bitmapsDirPath(const std::string &prog)
static const std::string DIRECTORY_SEPARATOR
@ TXT_BUTTON_OK
Label for OK button.
static GUITextGenerator * instance()
virtual ~OSEdAboutDialog()
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
OSEdAboutDialog(wxWindow *parent)
static const std::string LOGO_NAME
Name of the logo.
static const wxString APPLICATION_NAME
The name of the application.
static const wxString OSED_COPYRIGHT
Copyright string.
static OSEdTextGenerator & instance()
@ TXT_ABOUT_DIALOG_TITLE
About dialog title.
virtual boost::format text(int textId)
static void setLabel(Texts::TextGenerator *generator, wxWindow *widget, int textID)
static wxString toWxString(const std::string &source)
static std::string toString(const wxString &source)