Credit Andrew - fix vorbis audio which was scratchy and ensure aging plugin does...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / aboutprefs.C
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #include "aboutprefs.h"
23 #include "bcsignals.h"
24 #include "file.h"
25 #include "language.h"
26 #include "mwindow.h"
27 #include "theme.h"
28 #include "vframe.h"
29 #include "versioninfo.h"
30
31
32 #ifndef COMPILEDATE
33 #define COMPILEDATE "built: " __DATE__ " " __TIME__
34 #endif
35 const char *AboutPrefs::build_timestamp = COMPILEDATE;
36 const char *AboutPrefs::ffmpeg_version  = CINELERRA_LIBAV_VERSION;
37
38 AboutPrefs::AboutPrefs(MWindow *mwindow, PreferencesWindow *pwindow)
39  : PreferencesDialog(mwindow, pwindow)
40 {
41 // *** CONTEXT_HELP ***
42         context_help_set_keyword("About");
43 }
44
45 AboutPrefs::~AboutPrefs()
46 {
47         about.remove_all_objects();
48 }
49
50 void AboutPrefs::create_objects()
51 {
52         lock_window("AboutPrefs::create_objects");
53         int x, y;
54         BC_Resources *resources = BC_WindowBase::get_resources();
55
56
57         x = mwindow->theme->preferencesoptions_x;
58         y = mwindow->theme->preferencesoptions_y +
59                 get_text_height(LARGEFONT);
60
61         set_font(LARGEFONT);
62         set_color(resources->text_default);
63         draw_text(x, y, PROGRAM_NAME " " CINELERRA_VERSION);
64         y += 2*get_text_height(MEDIUMFONT);
65
66         set_font(MEDIUMFONT);
67         draw_text(x, y, COPYRIGHTTEXT1
68 #if defined(COPYRIGHTTEXT2)
69         COPYRIGHTTEXT2
70 #endif
71         );
72         y += 2*get_text_height(MEDIUMFONT);
73         draw_text(x,y, COPYRIGHTTEXT3);
74         y += get_text_height(MEDIUMFONT);
75         draw_text(x,y, COPYRIGHTTEXT4);
76         
77         y += get_text_height(MEDIUMFONT) * 2;
78
79
80         const char *cfg_path = File::get_cindat_path();
81         char msg_path[BCTEXTLEN];
82         FILE *fp = 0;
83         if( BC_Resources::language[0] ) {
84                 snprintf(msg_path, sizeof(msg_path), "%s/msg/%s",
85                         cfg_path, BC_Resources::language);
86                 fp = fopen(msg_path, "r");
87         }
88         if( !fp ) {
89                 snprintf(msg_path, sizeof(msg_path), "%s/msg/txt",
90                         cfg_path);
91                 fp = fopen(msg_path, "r");
92         }
93         if( fp ) {
94                 set_font(LARGEFONT);
95                 draw_text(x, y, _("About:"));
96                 y += get_text_height(LARGEFONT);
97                 char msg[BCTEXTLEN];
98                 while( fgets(msg, sizeof(msg), fp) ) {
99                         int len = strlen(msg);
100                         if( len > 0 && msg[len-1] == '\n' ) msg[len-1] = 0;
101                         about.append(new BC_ListBoxItem(msg));
102                 }
103                 BC_ListBox *listbox;
104                 add_subwindow(listbox = new BC_ListBox(x, y, xS(450), yS(250),
105                         LISTBOX_TEXT, &about, 0, 0, 1));
106                 y += listbox->get_h() + get_text_height(LARGEFONT) + yS(10);
107         }
108         else
109                 y += yS(300) + get_text_height(LARGEFONT) + yS(10);
110
111         set_font(LARGEFONT);
112         set_color(resources->text_default);
113         draw_text(x, y, _("License:"));
114         y += get_text_height(LARGEFONT);
115         set_font(MEDIUMFONT);
116
117         char license3[BCTEXTLEN];
118         sprintf(license3, _(
119 "This program is free software; you can redistribute it and/or modify it under the terms\n"
120 "of the GNU General Public License as published by the Free Software Foundation; either version\n"
121 "2 of the License, or (at your option) any later version.\n"
122 "  This software uses libraries from the FFmpeg project under the LGPLv2.1.\n"
123 "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;\n"
124 "without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
125 "PURPOSE.  See the GNU General Public License for more details.\n"));
126         draw_text(x, y, license3);
127         y += get_text_height(MEDIUMFONT, license3);
128
129         draw_text(x, y, build_timestamp);
130         x += get_text_width(MEDIUMFONT, build_timestamp);
131         draw_text(x,y, " ");
132         x += get_text_width(MEDIUMFONT, " ");
133         draw_text(x,y, ffmpeg_version);
134         x -= get_text_width(MEDIUMFONT, build_timestamp);
135         x -= get_text_width(MEDIUMFONT, " ");
136 #if defined(REPOMAINTXT)
137         y += get_text_height(MEDIUMFONT, build_timestamp);
138         draw_text(x, y, REPOMAINTXT);
139 #endif
140
141         x = get_w() - mwindow->theme->about_bg->get_w() - xS(10);
142         y = mwindow->theme->preferencesoptions_y;
143         BC_Pixmap *temp_pixmap = new BC_Pixmap(this,
144                 mwindow->theme->about_bg,
145                 PIXMAP_ALPHA);
146         draw_pixmap(temp_pixmap, x, y);
147         delete temp_pixmap;
148
149         x += mwindow->theme->about_bg->get_w() + xS(10);
150         y += get_text_height(LARGEFONT) * 2;
151
152         flash();
153         flush();
154         unlock_window();
155 }
156
157