13
0
livetrax/gtk2_ardour/about.cc

247 lines
6.7 KiB
C++
Raw Normal View History

/*
Copyright (C) 2003 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id$
*/
#include <algorithm>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <cstdio>
#include <ctime>
#include <cstdlib>
#include <ardour/ardour.h>
#include <ardour/version.h>
#include "utils.h"
#include "version.h"
#include "about.h"
#include "rgb_macros.h"
#include "ardour_ui.h"
#include "i18n.h"
using namespace Gtk;
using namespace Gdk;
using namespace std;
using namespace sigc;
using namespace ARDOUR;
Large nasty commit in the form of a 5000 line patch chock-full of completely unecessary changes. (Sorry, doing a "sprint" based thing, this is the end of the first one) Achieved MIDI track and bus creation, associated Jack port and diskstream creation, and minimal GUI stuff for creating them. Should be set to start work on actually recording and playing midi to/from disk now. Relevant (significant) changes: - Creation of a Buffer class. Base class is type agnostic so things can point to a buffer but not care what kind it is (otherwise it'd be a template). Derived into AudioBuffer and MidiBuffer, with a type tag because checking type is necessary in parts of the code where dynamic_cast wouldn't be wise. Originally I considered this a hack, but passing around a type proved to be a very good solution to all the other problems (below). There is a 1:1 mapping between jack port data types and ardour Buffer types (with a conversion function), but that's easily removed if it ever becomes necessary. Having the type scoped in the Buffer class is maybe not the best spot for it, but whatever (this is proof of concept kinda stuff right now...) - IO now has a "default" port type (passed to the constructor and stored as a member), used by ensure_io (and similar) to create n ports. IO::register_***_port has a type argument that defaults to the default type if not passed. Rationale: previous IO API is identical, no changes needed to existing code, but path is paved for multiple port types in one IO, which we will need for eg synth plugin inserts, among other things. This is not quite ideal (best would be to only have the two port register functions and have them take a type), but the alternative is a lot of work (namely destroying the 'ensure' functions and everything that uses them) for very little gain. (I am convinced after quite a few tries at the whiteboard that subclassing IO in any way is not a feasible option, look at it's inheritance diagram in Doxygen and you can see why) - AudioEngine::register_audio_input_port is now register_input_port and takes a type argument. Ditto for output. - (Most significant change) AudioDiskstream abstracted into Distream, and sibling MidiDiskstream created. Very much still a work in progress, but Diskstream is there to switch references over to (most already are), which is the important part. It is still unclear what the MIDI diskstream's relation to channels is, but I'm pretty sure they will be single channel only (so SMF Type 0) since noone can come up with a reason otherwise. - MidiTrack creation. Same thing as AudioTrack but with a different default type basically. No big deal here. - Random cleanups and variable renamings etc. because I have OCD and can't help myself. :) Known broken: Loading of sessions containing MIDI tracks. git-svn-id: svn://localhost/ardour2/branches/midi@641 d708f5d6-7413-0410-9779-e7cbd77b26cf
2006-06-26 12:01:34 -04:00
using namespace PBD;
#ifdef WITH_PAYMENT_OPTIONS
/* XPM */
static const gchar * paypal_xpm[] = {
"62 31 33 1",
" c None",
". c #325781",
"+ c #154170",
"@ c #C1CDDA",
"# c #4E6E92",
"$ c #D1D5DA",
"% c #88A0B8",
"& c #B4C4D3",
"* c #C8D3DE",
"= c #D7E1E9",
"- c #002158",
"; c #F6F8FA",
"> c #44658B",
", c #E7ECF0",
"' c #A4B7CA",
") c #9DB0C4",
"! c #E3F1F7",
"~ c #708CA9",
"{ c #E1E7ED",
"] c #567698",
"^ c #7C96B1",
"/ c #E7F5FA",
"( c #EEF1F4",
"_ c #6883A2",
": c #244873",
"< c #BBBBBB",
"[ c #E9E9E9",
"} c #063466",
"| c #22364D",
"1 c #94A7BD",
"2 c #000000",
"3 c #EAF7FC",
"4 c #FFFFFF",
"1'111111111111111111111111111111111111111111111111111111111%_#",
"%333333333333333333333333333333333333333333333333333333333333.",
"%444444444444444444444444444444444444444444444444444444444444:",
"_4333333!!!!!!33333333333333333333!!!!!!33333333333!%%%%1334[:",
"_444444@+}}}}+>)44444444444444444,:}}}}}.^(44444444@}..+.44($:",
"_433333^:&&&&)_}_33///33333333333&+)&&&'~+./3///333^.(;#]33($:",
"_444444>_444444'}_>...#%####~,]##..444444=+#]...>1;#_4;.144($:",
"_43333!+'4,>#=4(:+_%%%]}}#~#}_+~~:]44_>&44#}_%%%_+>:14=}@33($:",
"_44444*+$4&--)4(+%44444%-)4=--'4{+14,}-~44##44444&}}*4)+444($:",
"_433331:;4):_;4*}_]:.$4*-~4{}>44#-=4@.#{4;+>_:.&4,++;4_#333($:",
"_44444_#444444=.-.%&*,41-#4(:@4'-:(44444(_-:^&*,4*}#44.%444($:",
"_43333:%4;@@'~+-%44*&44]-.;;'4,:-#44*@&%:-];4{'(4)-%4{+&333($:",
"_4444{}@4*}}+>#:;4^-#4;.>+,444_+:^4(:}+.]}=4'-+(4_-&4&+{444($:",
"_4333'+(41:*=3'.44*)(4=+)+*44@}%+@4=}&=/@}{4{1{44:+,4^.3333($:",
"_4444~>,,]#444*})(;**,':*}'4;._@}=,%:444(+~(;{&,*}.,,>~4444($:",
"_4333>}}}}^3333~}::}}}}>].;4^+=~}}}}]3333'}+:}}}}}}}}}'3333($:",
"_4444$@@@@(44444$))@*@*^}$4=}14=@@@@{44444=))&*@@@@@@@;4444($:",
"_433333333333333333333=+:%%.>/33333333333333333333333333333($:",
"_4444444444444444444441....>=444444444444444444444444444444($:",
"_4333333333333333333333333333333333333333333333333333333333($:",
"_4444444444444444444444444444444444444444444444444444444444($:",
"_4333333333333333333333333333333333333333333333333333333333($:",
"_4444442222444222442444242444244222242444242222244222244444($:",
"_4333332333232333233232332232233233332233233323332333333333($:",
"_4444442222442222244424442424244222442424244424444222444444($:",
"_4333332333332333233323332333233233332332233323333333233333($:",
"_4444442444442444244424442444244222242444244424442222444444($:",
"_433333333333333333333333333333333333333333333333333333333344:",
"#4([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[=&:",
".=&<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<1|",
"::||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"};
#endif
static const char* authors[] = {
N_("Paul Davis"),
N_("Jesse Chappell"),
N_("Taybin Rutkin"),
N_("Marcus Andersson"),
N_("Jeremy Hall"),
N_("Steve Harris"),
N_("Tim Mayberry"),
N_("Mark Stewart"),
N_("Sam Chessman"),
N_("Jack O'Quin"),
N_("Matt Krai"),
N_("Ben Bell"),
N_("Gerard van Dongen"),
N_("Thomas Charbonnel"),
N_("Nick Mainsbridge"),
N_("Colin Law"),
N_("Sampo Savolainen"),
N_("Joshua Leach"),
N_("Rob Holland"),
N_("Per Sigmond"),
N_("Doug Mclain"),
N_("Petter Sundlöf"),
0
};
static const char* translators[] = {
N_("French:\n\tAlain Fréhel <alain.frehel@free.fr>\n"),
N_("German:\n\tKarsten Petersen <kapet@kapet.de>\n"),
N_("Italian:\n\tFilippo Pappalardo <filippo@email.it>\n"),
N_("Portuguese:\n\tRui Nuno Capela <rncbc@rncbc.org>\n"),
N_("Brazilian Portuguese:\n\tAlexander da Franca Fernandes <alexander@nautae.eti.br>\
\n\tChris Ross <chris@tebibyte.org>\n"),
N_("Spanish:\n\t Alex Krohn <alexkrohn@fastmail.fm>\n"),
N_("Russian:\n\t Igor Blinov <pitstop@nm.ru>\n"),
0
};
About::About ()
#ifdef WITH_PAYMENT_OPTIONS
: paypal_pixmap (paypal_xpm)
#endif
{
set_type_hint(Gdk::WINDOW_TYPE_HINT_SPLASHSCREEN);
string path;
string t;
path = find_data_file ("splash.ppm");
Glib::RefPtr<Pixbuf> pixbuf = Gdk::Pixbuf::create_from_file (path);
set_logo (Gdk::Pixbuf::create_from_file (path));
set_authors (authors);
for (int n = 0; translators[n]; ++n) {
t += translators[n];
t += ' ';
}
set_translator_credits (t);
set_copyright (_("Copyright (C) 1999-2005 Paul Davis\n"));
set_license (_("Ardour comes with ABSOLUTELY NO WARRANTY\n"
"This is free software, and you are welcome to redistribute it\n"
"under certain conditions; see the file COPYING for details.\n"));
set_name (X_("ardour"));
set_website (X_("http://ardour.org/"));
set_website_label (X_("ardour.org"));
set_version ((string_compose(_("%1\n(built with ardour/gtk %2.%3.%4 libardour: %5.%6.%7)"),
VERSIONSTRING,
gtk_ardour_major_version,
gtk_ardour_minor_version,
gtk_ardour_micro_version,
libardour_major_version,
libardour_minor_version,
libardour_micro_version)));
#ifdef WITH_PAYMENT_OPTIONS
paypal_button.add (paypal_pixmap);
HBox *payment_box = manage (new HBox);
payment_box->pack_start (paypal_button, true, false);
subvbox.pack_start (*payment_box, false, false);
#endif
}
About::~About ()
{
}
#ifdef WITH_PAYMENT_OPTIONS
void
About::goto_paypal ()
{
char buf[PATH_MAX+16];
char *argv[4];
char *docfile = "foo";
int grandchild;
if (fork() == 0) {
/* child */
if ((grandchild = fork()) == 0) {
/* grandchild */
argv[0] = "mozilla";
argv[1] = "-remote";
snprintf (buf, sizeof(buf), "openurl(%s)", docfile);
argv[2] = buf;
argv[3] = 0;
execvp ("mozilla", argv);
error << "could not start mozilla" << endmsg;
} else {
int status;
waitpid (grandchild, &status, 0);
}
}
}
#endif