most of the 2.X->3.0 commit (up to rev 4299) except for gtk2_ardour/editor_canvas...
[ardour.git] / gtk2_ardour / about.cc
1 /*
2     Copyright (C) 2003 Paul Davis 
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #include <algorithm>
21 #include <unistd.h>
22 #include <sys/types.h>
23 #include <sys/wait.h>
24 #include <cstdio>
25 #include <ctime>
26 #include <cstdlib>
27
28 #include <pbd/file_utils.h>
29
30 #include <ardour/svn_revision.h>
31 #include <ardour/ardour.h>
32 #include <ardour/version.h>
33 #include <ardour/filesystem_paths.h>
34
35 #include "utils.h"
36 #include "version.h"
37
38 #include "about.h"
39 #include "rgb_macros.h"
40 #include "ardour_ui.h"
41
42 #include "i18n.h"
43
44 using namespace Gtk;
45 using namespace Gdk;
46 using namespace std;
47 using namespace sigc;
48 using namespace ARDOUR;
49 using namespace PBD;
50
51 #ifdef WITH_PAYMENT_OPTIONS
52
53 /* XPM */
54 static const gchar * paypal_xpm[] = {
55 "62 31 33 1",
56 "       c None",
57 ".      c #325781",
58 "+      c #154170",
59 "@      c #C1CDDA",
60 "#      c #4E6E92",
61 "$      c #D1D5DA",
62 "%      c #88A0B8",
63 "&      c #B4C4D3",
64 "*      c #C8D3DE",
65 "=      c #D7E1E9",
66 "-      c #002158",
67 ";      c #F6F8FA",
68 ">      c #44658B",
69 ",      c #E7ECF0",
70 "'      c #A4B7CA",
71 ")      c #9DB0C4",
72 "!      c #E3F1F7",
73 "~      c #708CA9",
74 "{      c #E1E7ED",
75 "]      c #567698",
76 "^      c #7C96B1",
77 "/      c #E7F5FA",
78 "(      c #EEF1F4",
79 "_      c #6883A2",
80 ":      c #244873",
81 "<      c #BBBBBB",
82 "[      c #E9E9E9",
83 "}      c #063466",
84 "|      c #22364D",
85 "1      c #94A7BD",
86 "2      c #000000",
87 "3      c #EAF7FC",
88 "4      c #FFFFFF",
89 "1'111111111111111111111111111111111111111111111111111111111%_#",
90 "%333333333333333333333333333333333333333333333333333333333333.",
91 "%444444444444444444444444444444444444444444444444444444444444:",
92 "_4333333!!!!!!33333333333333333333!!!!!!33333333333!%%%%1334[:",
93 "_444444@+}}}}+>)44444444444444444,:}}}}}.^(44444444@}..+.44($:",
94 "_433333^:&&&&)_}_33///33333333333&+)&&&'~+./3///333^.(;#]33($:",
95 "_444444>_444444'}_>...#%####~,]##..444444=+#]...>1;#_4;.144($:",
96 "_43333!+'4,>#=4(:+_%%%]}}#~#}_+~~:]44_>&44#}_%%%_+>:14=}@33($:",
97 "_44444*+$4&--)4(+%44444%-)4=--'4{+14,}-~44##44444&}}*4)+444($:",
98 "_433331:;4):_;4*}_]:.$4*-~4{}>44#-=4@.#{4;+>_:.&4,++;4_#333($:",
99 "_44444_#444444=.-.%&*,41-#4(:@4'-:(44444(_-:^&*,4*}#44.%444($:",
100 "_43333:%4;@@'~+-%44*&44]-.;;'4,:-#44*@&%:-];4{'(4)-%4{+&333($:",
101 "_4444{}@4*}}+>#:;4^-#4;.>+,444_+:^4(:}+.]}=4'-+(4_-&4&+{444($:",
102 "_4333'+(41:*=3'.44*)(4=+)+*44@}%+@4=}&=/@}{4{1{44:+,4^.3333($:",
103 "_4444~>,,]#444*})(;**,':*}'4;._@}=,%:444(+~(;{&,*}.,,>~4444($:",
104 "_4333>}}}}^3333~}::}}}}>].;4^+=~}}}}]3333'}+:}}}}}}}}}'3333($:",
105 "_4444$@@@@(44444$))@*@*^}$4=}14=@@@@{44444=))&*@@@@@@@;4444($:",
106 "_433333333333333333333=+:%%.>/33333333333333333333333333333($:",
107 "_4444444444444444444441....>=444444444444444444444444444444($:",
108 "_4333333333333333333333333333333333333333333333333333333333($:",
109 "_4444444444444444444444444444444444444444444444444444444444($:",
110 "_4333333333333333333333333333333333333333333333333333333333($:",
111 "_4444442222444222442444242444244222242444242222244222244444($:",
112 "_4333332333232333233232332232233233332233233323332333333333($:",
113 "_4444442222442222244424442424244222442424244424444222444444($:",
114 "_4333332333332333233323332333233233332332233323333333233333($:",
115 "_4444442444442444244424442444244222242444244424442222444444($:",
116 "_433333333333333333333333333333333333333333333333333333333344:",
117 "#4([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[=&:",
118 ".=&<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<1|",
119 "::||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"};
120 #endif
121
122 static const char* authors[] = {
123         N_("Brian Ahr"),
124         N_("John Anderson"),
125         N_("Marcus Andersson"),
126         N_("Nedko Arnaudov"),
127         N_("Hans Baier"),
128         N_("Ben Bell"),
129         N_("Sakari Bergen"),
130         N_("Chris Cannam"),
131         N_("Jesse Chappell"),
132         N_("Thomas Charbonnel"),
133         N_("Sam Chessman"),
134         N_("Paul Davis"),
135         N_("Gerard van Dongen"),
136         N_("Colin Fletcher"),
137         N_("Hans Fugal"),
138         N_("Christopher George"),
139         N_("Jeremy Hall"),
140         N_("Audun Halland"),
141         N_("Steve Harris"),
142         N_("Carl Hetherington"),
143         N_("Rob Holland"),
144         N_("Robert Jordens"),
145         N_("Stefan Kersten"),
146         N_("Armand Klenk"),
147         N_("Matt Krai"),
148         N_("Colin Law"),
149         N_("Joshua Leach"),
150         N_("Ben Loftis"),
151         N_("Nick Mainsbridge"),
152         N_("Tim Mayberry"),
153         N_("Doug Mclain"),
154         N_("Jack O'Quin"),
155         N_("Nimal Ratnayake"),
156         N_("Dave Robillard"),
157         N_("Taybin Rutkin"),
158         N_("Sampo Savolainen"),
159         N_("Per Sigmond"),
160         N_("Lincoln Spiteri"),
161         N_("Mark Stewart"),
162         N_("Roland Stigge"),
163         N_("Petter Sundlöf"),
164         N_("Mike Täht"),
165         N_("Thorsten Wilms"),
166 };
167
168 static const char* translators[] = {
169         N_("French:\n\tAlain Fréhel <alain.frehel@free.fr>\n\tChristophe Combelles <ccomb@free.fr>\n"),
170         N_("German:\n\tKarsten Petersen <kapet@kapet.de>\
171 \n\tSebastian Arnold <mail@sebastian-arnold.net>\
172 \n\tRobert Schwede<schwede@ironshark.com>\n"),
173         N_("Italian:\n\tFilippo Pappalardo <filippo@email.it>\n"),
174         N_("Portuguese:\n\tRui Nuno Capela <rncbc@rncbc.org>\n"),
175         N_("Brazilian Portuguese:\n\tAlexander da Franca Fernandes <alexander@nautae.eti.br>\
176 \n\tChris Ross <chris@tebibyte.org>\n"),
177         N_("Spanish:\n\t Alex Krohn <alexkrohn@fastmail.fm>\n"),
178         N_("Russian:\n\t Igor Blinov <pitstop@nm.ru>\n"),
179         N_("Greek:\n\t Klearchos Gourgourinis <muadib@in.gr>\n"),
180         N_("Swedish:\n\t Petter Sundlöf <petter.sundlof@gmail.com>\n"),
181         N_("Polish:\n\t Piotr Zaryk <pzaryk@gmail.com>\n"),
182         0
183 };
184
185
186 About::About ()
187 #ifdef WITH_PAYMENT_OPTIONS
188         : paypal_pixmap (paypal_xpm)
189 #endif
190 {
191         // set_type_hint(Gdk::WINDOW_TYPE_HINT_SPLASHSCREEN);
192
193         string path;
194         string t;
195
196         sys::path splash_file;
197
198         SearchPath spath(ardour_search_path() + system_data_search_path());
199
200         if (find_file_in_search_path (spath, "splash.png", splash_file)) {
201                 set_logo (Gdk::Pixbuf::create_from_file (splash_file.to_string()));
202         } else {
203                 error << "Could not find splash file" << endmsg;
204         }
205
206         set_authors (authors);
207
208         for (int n = 0; translators[n]; ++n) {
209                 t += translators[n];
210                 t += ' ';
211         }
212
213         set_translator_credits (t);
214         set_copyright (_("Copyright (C) 1999-2008 Paul Davis\n"));
215         set_license (_("Ardour comes with ABSOLUTELY NO WARRANTY\n"
216                        "This is free software, and you are welcome to redistribute it\n"
217                        "under certain conditions; see the file COPYING for details.\n"));
218         set_name (X_("ardour"));
219         set_website (X_("http://ardour.org/"));
220         set_website_label (_("visit http://www.ardour.org/"));
221         set_version ((string_compose(_("%1\n(built from revision %2)"),
222                                      VERSIONSTRING, 
223                                      svn_revision)));
224         
225
226 #ifdef WITH_PAYMENT_OPTIONS
227         paypal_button.add (paypal_pixmap);
228         
229         HBox *payment_box = manage (new HBox);
230         payment_box->pack_start (paypal_button, true, false);
231
232         subvbox.pack_start (*payment_box, false, false);
233 #endif
234
235 }
236
237 About::~About ()
238 {
239 }
240
241 #ifdef WITH_PAYMENT_OPTIONS
242 void
243 About::goto_paypal ()
244 {
245         char buf[PATH_MAX+16];
246         char *argv[4];
247         char *docfile = "foo";
248         int grandchild;
249         
250         if (fork() == 0) {
251
252                 /* child */
253
254                 if ((grandchild = fork()) == 0) {
255                         
256                         /* grandchild */
257                         
258                         argv[0] = "mozilla";
259                         argv[1] = "-remote";
260                         snprintf (buf, sizeof(buf), "openurl(%s)", docfile);
261                         argv[2] = buf;
262                         argv[3] = 0;
263
264                         execvp ("mozilla", argv);
265                         error << "could not start mozilla" << endmsg;
266
267                 } else {
268                         int status;
269                         waitpid (grandchild, &status, 0);
270                 }
271
272         } 
273 }
274 #endif