AboutDialog_main.cpp 14.8 KB
Newer Older
1 2 3 4 5 6 7 8
/***************************************************************
 * Name:      AboutDialog_main.cpp
 * Purpose:   Code for Application Class
 * Author:    Rafael Sokolowski (rafael.sokolowski@web.de)
 * Created:   2010-08-06
 * Copyright: Rafael Sokolowski ()
 * License:
 **************************************************************/
9 10
#include <dialog_about.h>
#include <aboutinfo.h>
11 12 13 14 15
#include <wx/aboutdlg.h>
#include <wx/textctrl.h>


/* Used icons:
16 17
 *  lang_xx_xpm[];      // Icons of various national flags
 *  show_3d_xpm[];      // 3D icon
18
 *  edit_module_xpm[];
19
 *  icon_kicad_xpm[];   // Icon of the application
20
 */
21 22 23 24 25
#include <bitmaps.h>
#include <wxstruct.h>
#include <common.h>
#include <appl_wxstruct.h>
#include <build_version.h>
26 27 28


#include <wx/arrimpl.cpp>
jean-pierre charras's avatar
jean-pierre charras committed
29
WX_DEFINE_OBJARRAY( Contributors )
30 31 32 33 34 35 36 37 38

// Helper functions:
static wxString HtmlHyperlink( const wxString& url, const wxString& description = wxEmptyString );
static wxString HtmlNewline( const unsigned int amount = 1 );


/**
 * Initializes the <code>AboutAppInfo</code> object with applicaion specific information.
 *
39
 * This the object which holds all information about the application
40 41 42
 */
static void InitKiCadAboutNew( AboutAppInfo& info )
{
43
    // Set application specific icon
44
    const wxTopLevelWindow * const tlw = wxDynamicCast(::wxGetApp().GetTopWindow(), wxTopLevelWindow);
45

46 47 48
    if( tlw )
        info.SetIcon( tlw->GetIcon() );
    else
49 50 51 52 53 54 55 56
    {
        wxBitmap    bitmap = KiBitmap( icon_kicad_xpm  );
        wxIcon      icon;

        icon.CopyFromBitmap( bitmap );

        info.SetIcon( icon );
    }
57 58 59 60 61

    /* Set title */
    info.SetAppName( wxT( ".: " ) + wxGetApp().GetTitle() + wxT( " :." ) );

    /* Copyright information */
62
    info.SetCopyright( wxT( "(C) 1992-2012 KiCad Developers Team" ) );
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83

    /* KiCad build version */
    wxString version;
    version << wxT( "Build: " ) << GetBuildVersion();
    info.SetBuildVersion( version );

    /* wxWidgets version */
    wxString libVersion;
    libVersion
        << wxT( "wxWidgets " )
        << wxMAJOR_VERSION << wxT( "." )
        << wxMINOR_VERSION << wxT( "." )
        << wxRELEASE_NUMBER

    /* Unicode or Ansi version */
#if wxUSE_UNICODE
        << wxT( " Unicode " );
#else
        << wxT( " Ansi " );
#endif

84 85
    libVersion << wxT( "and boost C++ libraries" );

86
    libVersion << wxT( "\n" );
87 88 89

    /* Operating System Information */

90
#if defined __WIN64__
91
    libVersion << wxT( "on 64 Bits Windows" );
92 93 94

#   elif defined __WINDOWS__
    libVersion << wxT( "on 32 Bits Windows" );
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149

    /* Check for wxMAC */
#   elif defined __WXMAC__
    libVersion << wxT( "on Macintosh" );

    /* Linux 64 bits */
#   elif defined _LP64 && __LINUX__
    libVersion << wxT( "on 64 Bits GNU/Linux" );

    /* Linux 32 bits */
#   elif defined __LINUX__
    libVersion << wxT( "on 32 Bits GNU/Linux" );

    /* OpenBSD */
#   elif defined __OpenBSD__
    libVersion << wxT( "on OpenBSD" );

    /* FreeBSD */
#   elif defined __FreeBSD__
    libVersion << wxT( "on FreeBSD" );

#endif

    info.SetLibVersion( libVersion );


    /* info/description part HTML formatted */

    wxString description;

    /* short description */
    description << wxT( "<p>" );
    description << wxT( "<b><u>" ) << _( "Description" ) << wxT( "</u></b>" ); // bold & underlined font for caption

    description << wxT( "<p>" ) <<
    _(
        "The KiCad EDA Suite is a set of open source applications for the creation of electronic schematics and to design printed circuit boards." )
                << wxT( "</p>" );

    description << wxT( "</p>" );

    /* websites */
    description << wxT( "<p>" );
    description << wxT( "<b><u>" ) << _( "KiCad on the web" ) << wxT( "</u></b>" ); // bold & underlined font for caption

    // bulletet list with some http links
    description << wxT( "<ul>" );
    description << wxT( "<li>" ) << HtmlHyperlink( wxT(
                                                      "http://iut-tice.ujf-grenoble.fr/kicad" ),
                                                  _( "The original site of the initiator of Kicad" ) )
                << wxT( "</li>" );
    description << wxT( "<li>" ) <<
    HtmlHyperlink( wxT( "https://launchpad.net/kicad" ), _( "Project on Launchpad" ) ) << wxT(
        "</li>" );
    description << wxT( "<li>" ) <<
150 151
    HtmlHyperlink( wxT( "http://www.kicad-pcb.org" ),
                  _( "The new KiCad site" ) ) << wxT( "</li>" );
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
    description << wxT( "<li>" ) <<
    HtmlHyperlink( wxT( "http://www.kicadlib.org" ),
                  _( "Repository with additional component libraries" ) ) << wxT( "</li>" );
    description << wxT( "</ul>" );

    description << wxT( "</p>" );

    description << wxT( "<p>" );
    description << wxT( "<b><u>" ) << _( "Contribute to KiCad" ) << wxT( "</u></b>" ); // bold & underlined font caption

    // bulletet list with some http links
    description << wxT( "<ul>" );
    description << wxT( "<li>" ) <<
    HtmlHyperlink( wxT( "https://bugs.launchpad.net/kicad" ),
                  _( "Report bugs if you found any" ) ) << wxT( "</li>" );
    description << wxT( "<li>" ) << HtmlHyperlink( wxT(
                                                      "https://blueprints.launchpad.net/kicad" ),
                                                  _( "File an idea for improvement" ) ) << wxT(
        "</li>" );
    description << wxT( "<li>" ) <<
    HtmlHyperlink( wxT( "http://www.kicadlib.org/Kicad_related_links.html" ),
                  _( "KiCad links to user groups, tutorials and much more" ) ) << wxT( "</li>" );
    description << wxT( "</ul>" );

    description << wxT( "</p>" );

    info.SetDescription( description );


    /* License information also HTML formatted */
    wxString license;
    license
        << wxT( "<div align='center'>" )
        << HtmlNewline( 4 )
        << _( "The complete KiCad EDA Suite is released under the" ) << HtmlNewline( 2 )
        << HtmlHyperlink( wxT( "http://www.gnu.org/licenses" ),
                         _( "GNU General Public License (GPL) version 2" ) )
        << wxT( "</div>" );

    info.SetLicense( license );


    /* A contributor consists of the following information:
     * Mandatory:
     * - Name
     * - EMail address
     * Optional:
     * - Category
     * - Category specific icon
     *
     * All contributors of the same category will be enumerated under this category
     * which should be represented by the same icon.
     */

    /* The developers */
    info.AddDeveloper( new Contributor( wxT( "Jean-Pierre Charras" ),
208
                                        wxT( "jean-pierre.charras@gipsa-lab.inpg.fr" ) ) );
209
    info.AddDeveloper( new Contributor( wxT( "Dick Hollenbeck" ), wxT( "dick@softplc.com" ) ) );
210
    info.AddDeveloper( new Contributor( wxT( "Frank Bennett" ), wxT( "bennett78@lpbroadband.net" ) ) );
211 212
    info.AddDeveloper( new Contributor( wxT( "Hauptmech" ), wxT( "hauptmech@gmail.com" ) ) );
    info.AddDeveloper( new Contributor( wxT( "Jerry Jacobs" ),
213
                                        wxT( "xor.gate.engineering@gmail.com" ) ) );
214 215
    info.AddDeveloper( new Contributor( wxT( "Jonas Diemer" ), wxT( "diemer@gmx.de" ) ) );
    info.AddDeveloper( new Contributor( wxT( "KBool Library" ),
216
                                        wxT( "http://boolean.klaasholwerda.nl/bool.html" ) ) );
217
    info.AddDeveloper( new Contributor( wxT( "Lorenzo Marcantonio" ), wxT( "lomarcan@tin.it" ) ) );
218 219
    info.AddDeveloper( new Contributor( wxT( "Marco Serantoni" ),
                                        wxT( "marco.serantoni@gmail.com" ) ) );
220 221
    info.AddDeveloper( new Contributor( wxT( "Marco Mattila" ), wxT( "marcom99@gmail.com" ) ) );
    info.AddDeveloper( new Contributor( wxT( "Rafael Sokolowski" ),
222
                                        wxT( "rafael.sokolowski@web.de" ) ) );
223 224 225
    info.AddDeveloper( new Contributor( wxT( "Rok Markovic" ), wxT( "rok@kanardia.eu" ) ) );
    info.AddDeveloper( new Contributor( wxT( "Tim Hanson" ), wxT( "sideskate@gmail.com" ) ) );
    info.AddDeveloper( new Contributor( wxT( "Vesa Solonen" ), wxT( "vesa.solonen@hut.fi" ) ) );
226 227
    info.AddDeveloper( new Contributor( wxT( "Wayne Stambaugh" ),
                                        wxT( "stambaughw@verizon.net" ) ) );
228 229 230

    /* The document writers */
    info.AddDocWriter( new Contributor( wxT( "Jean-Pierre Charras" ),
231 232 233 234 235
                                        wxT( "jean-pierre.charras@gipsa-lab.inpg.fr" ) ) );
    info.AddDocWriter( new Contributor( wxT( "Igor Plyatov" ),
                                        wxT( "plyatov@gmail.com" ) ) );
    info.AddDocWriter( new Contributor( wxT( "Fabrizio Tappero" ),
                                        wxT( "fabrizio.tappero@gmail.com" ) ) );
236 237 238 239 240 241

    /* The translators
     * As category the language to which the translation was done is used
     * and as icon the national flag of the corresponding country.
     */
    info.AddTranslator( new Contributor( wxT( "Martin Kratoška" ), wxT( "martin@ok1rr.com" ),
242
                                         wxT( "Czech (CZ)" ), KiBitmapNew( lang_cs_xpm ) ) );
243
    info.AddTranslator( new Contributor( wxT( "Jerry Jacobs" ),
244 245
                                         wxT( "xor.gate.engineering@gmail.com" ), wxT( "Dutch (NL)" ),
                                         KiBitmapNew( lang_nl_xpm ) ) );
246
    info.AddTranslator( new Contributor( wxT( "Vesa Solonen" ), wxT( "vesa.solonen@hut.fi" ),
247
                                         wxT( "Finnish (FI)" ), KiBitmapNew( lang_fi_xpm ) ) );
248
    info.AddTranslator( new Contributor( wxT( "Jean-Pierre Charras" ),
249 250
                                         wxT( "jean-pierre.charras@gipsa-lab.inpg.fr" ),
                                         wxT( "French (FR)" ), KiBitmapNew( lang_fr_xpm ) ) );
251
    info.AddTranslator( new Contributor( wxT( "Mateusz Skowroński" ), wxT( "skowri@gmail.com" ),
252
                                         wxT( "Polish (PL)" ), KiBitmapNew( lang_pl_xpm ) ) );
253
    info.AddTranslator( new Contributor( wxT( "Renie Marquet" ), wxT( "reniemarquet@uol.com.br" ),
254
                                         wxT( "Portuguese (PT)" ), KiBitmapNew( lang_pt_xpm ) ) );
255
    info.AddTranslator( new Contributor( wxT( "Igor Plyatov" ), wxT( "plyatov@gmail.com" ),
256
                                         wxT( "Russian (RU)" ), KiBitmapNew( lang_ru_xpm ) ) );
257
    info.AddTranslator( new Contributor( wxT( "Andrey Fedorushkov" ), wxT( "<andrf@mail.ru>" ),
258
                                         wxT( "Russian (RU)" ), KiBitmapNew( lang_ru_xpm ) ) );
259
    info.AddTranslator( new Contributor( wxT( "Pedro Martin del Valle" ), wxT( "pkicad@yahoo.es" ),
260
                                         wxT( "Spanish (ES)" ), KiBitmapNew( lang_es_xpm ) ) );
261
    info.AddTranslator( new Contributor( wxT( "Iñigo Zuluaga" ), wxT( "inigo_zuluaga@yahoo.es" ),
262
                                         wxT( "Spanish (ES)" ), KiBitmapNew( lang_es_xpm ) ) );
263
    info.AddTranslator( new Contributor( wxT( "Rafael Sokolowski" ),
264 265
                                         wxT( "rafael.sokolowski@web.de" ), wxT( "German (DE)" ),
                                         KiBitmapNew( lang_de_xpm ) ) );
266
    info.AddTranslator( new Contributor( wxT( "Kenta Yonekura" ),
267 268
                                         wxT( "midpika@hotmail.com" ), wxT( "Japanese (JA)" ),
                                         KiBitmapNew( lang_jp_xpm ) ) );
269
    info.AddTranslator( new Contributor( wxT( "Manolis Stefanis, Athanasios Vlastos and Milonas Kostas" ),
270 271
                                         wxT( "milonas.ko@gmail.com" ), wxT( "Greek (el_GR)" ),
                                         KiBitmapNew( lang_gr_xpm ) ) );
272
    info.AddTranslator( new Contributor( wxT( "Massimo Cioce" ),
273 274
                                         wxT( "ciocemax@alice.it" ), wxT( "Italian (IT)" ),
                                         KiBitmapNew( lang_it_xpm ) ) );
275
    info.AddTranslator( new Contributor( wxT( "Evgeniy Ivanov" ),
276 277
                                         wxT( "evgeniy_p_ivanov@yahoo.ca" ), wxT( "Bulgarian (BG)" ),
                                         KiBitmapNew( lang_bg_xpm ) ) );
278

279 280 281
    // TODO: are these all russian translators,
    // placed them here now,
    // or else align them below other language maintainer with mail adress
282 283 284 285 286 287 288
    info.AddTranslator( new Contributor( wxT( "Remy Halvick" ), wxEmptyString, wxT( "Others" ) ) );
    info.AddTranslator( new Contributor( wxT( "David Briscoe" ), wxEmptyString, wxT( "Others" ) ) );
    info.AddTranslator( new Contributor( wxT( "Dominique Laigle" ), wxEmptyString, wxT( "Others" ) ) );
    info.AddTranslator( new Contributor( wxT( "Paul Burke" ), wxEmptyString, wxT( "Others" ) ) );

    /* Programm credits for icons */
    info.AddArtist( new Contributor( wxT( "Iñigo Zuluagaz" ), wxT( "inigo_zuluaga@yahoo.es" ),
289
                                     wxT( "Icons by" ), KiBitmapNew( edit_module_xpm ) ) );
290
    info.AddArtist( new Contributor( wxT( "Fabrizio Tappero" ), wxT( "fabrizio.tappero@gmail.com" ),
291
                                     wxT( "New icons by" ), KiBitmapNew( edit_module_xpm ) ) );
292
    info.AddArtist( new Contributor( wxT( "Renie Marquet" ), wxT( "reniemarquet@uol.com.br" ),
293
                                     wxT( "3D modules by" ), KiBitmapNew( three_d_xpm ) ) );
294
    info.AddArtist( new Contributor( wxT( "Christophe Boschat" ), wxT( "nox454@hotmail.fr" ),
295
                                     wxT( "3D modules by" ), KiBitmapNew( three_d_xpm ) ) );
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320
}


bool ShowAboutDialog( wxWindow* parent )
{
    AboutAppInfo info;

    InitKiCadAboutNew( info );

    dialog_about* dlg = new dialog_about( parent, info );
    dlg->SetIcon( info.GetIcon() );
    dlg->Show();

    return true;
}


///////////////////////////////////////////////////////////////////////////////
/// Helper functions
///////////////////////////////////////////////////////////////////////////////

/**
 * Wraps the given url with a HTML anchor tag containing a hyperlink text reference
 * to form a HTML hyperlink.
 *
321 322
 * @param url the url that will be embedded in an anchor tag containing a hyperlink reference
 * @param description the optional describing text that will be represented as a hyperlink.
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341
 *  If not specified the url will be used as hyperlink.
 * @return a HTML conform hyperlink like <a href='url'>description</a>
 */
static wxString HtmlHyperlink( const wxString& url, const wxString& description )
{
    wxString hyperlink = wxEmptyString;

    if( description.IsEmpty() )
        hyperlink << wxT( "<a href='" ) << url << wxT( "'>" ) << url << wxT( "</a>" );
    else
        hyperlink << wxT( "<a href='" ) << url << wxT( "'>" ) << description << wxT( "</a>" );

    return hyperlink;
}


/**
 * Creates a HTML newline character sequence.
 *
342 343
 * @param amount - the amount of HTML newline tags to concatenate, default is to return just
 *                  one <br> tag
344 345 346 347 348 349 350 351 352 353 354
 * @return the concatenated amount of HTML newline tag(s) <br>
 */
static wxString HtmlNewline( const unsigned int amount )
{
    wxString newlineTags = wxEmptyString;

    for( size_t i = 0; i<amount; ++i )
        newlineTags << wxT( "<br>" );

    return newlineTags;
}