rework keyframe hide popup, keyframe auto render, textbox set_selection wide text
[goodguy/history.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.inc"
25 #include "language.h"
26 #include "libzmpeg3.h"
27 #include "mwindow.h"
28 #include "theme.h"
29 #include "vframe.h"
30 #include "versioninfo.h"
31
32
33
34 AboutPrefs::AboutPrefs(MWindow *mwindow, PreferencesWindow *pwindow)
35  : PreferencesDialog(mwindow, pwindow)
36 {
37 }
38
39 AboutPrefs::~AboutPrefs()
40 {
41         about.remove_all_objects();
42 }
43
44 void AboutPrefs::create_objects()
45 {
46         int x, y;
47
48
49         BC_Resources *resources = BC_WindowBase::get_resources();
50
51 //      add_subwindow(new BC_Title(mwindow->theme->preferencestitle_x,
52 //              mwindow->theme->preferencestitle_y,
53 //              _("About"),
54 //              LARGEFONT,
55 //              resources->text_default));
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 += get_text_height(MEDIUMFONT) * 3;
73
74 //      char versions[BCTEXTLEN];
75 //      sprintf(versions,
76 // _("Libmpeg3 version %d.%d.%d\n"),
77 // mpeg3_major(),
78 // mpeg3_minor(),
79 // mpeg3_release());
80 //      draw_text(x, y, versions);
81
82
83         char exe_path[BCTEXTLEN], msg_path[BCTEXTLEN];
84         get_exe_path(exe_path);
85         snprintf(msg_path, sizeof(msg_path), "%s/msg.txt", exe_path);
86         FILE *fp = fopen(msg_path, "r");
87         if( fp ) {
88                 set_font(LARGEFONT);
89                 draw_text(x, y, _("About:"));
90                 y += get_text_height(LARGEFONT);
91                 char msg[BCTEXTLEN];
92                 while( fgets(msg, sizeof(msg), fp) )
93                         about.append(new BC_ListBoxItem(msg));
94
95                 BC_ListBox *listbox;
96                 add_subwindow(listbox = new BC_ListBox(x, y, 300, 280,
97                         LISTBOX_TEXT, &about, 0, 0, 1));
98                 y += listbox->get_h() + get_text_height(LARGEFONT) + 10;
99         }
100         else
101                 y += 300 + get_text_height(LARGEFONT) + 10;
102
103         set_font(LARGEFONT);
104         set_color(resources->text_default);
105         draw_text(x, y, _("License:"));
106         y += get_text_height(LARGEFONT);
107         set_font(MEDIUMFONT);
108
109         char license3[BCTEXTLEN];
110         sprintf(license3, _(
111 "This program is free software; you can redistribute it and/or modify it under the terms\n"
112 "of the GNU General Public License as published by the Free Software Foundation; either version\n"
113 "2 of the License, or (at your option) any later version.\n"
114 "\n"
115 "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;\n"
116 "without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
117 "PURPOSE.  See the GNU General Public License for more details.\n"));
118         draw_text(x, y, license3);
119         y += get_text_height(MEDIUMFONT, license3);
120
121 #ifndef COMPILEDATE
122 #define COMPILEDATE "built: " __DATE__ " " __TIME__
123 #endif
124         draw_text(x, y, COMPILEDATE);
125 #if defined(REPOMAINTXT)
126         y += get_text_height(MEDIUMFONT, COMPILEDATE);
127         draw_text(x, y, REPOMAINTXT);
128 #endif
129
130         x = get_w() - mwindow->theme->about_bg->get_w() - 10;
131         y = mwindow->theme->preferencesoptions_y;
132         BC_Pixmap *temp_pixmap = new BC_Pixmap(this,
133                 mwindow->theme->about_bg,
134                 PIXMAP_ALPHA);
135         draw_pixmap(temp_pixmap,
136                 x,
137                 y);
138
139         delete temp_pixmap;
140
141
142         x += mwindow->theme->about_bg->get_w() + 10;
143         y += get_text_height(LARGEFONT) * 2;
144
145
146         flash();
147         flush();
148 }
149
150