prevent popup deactivation while button_down
[goodguy/history.git] / cinelerra-5.0 / 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
31
32
33 AboutPrefs::AboutPrefs(MWindow *mwindow, PreferencesWindow *pwindow)
34  : PreferencesDialog(mwindow, pwindow)
35 {
36 }
37
38 AboutPrefs::~AboutPrefs()
39 {
40         about.remove_all_objects();
41 }
42
43 void AboutPrefs::create_objects()
44 {
45         int x, y;
46
47
48         BC_Resources *resources = BC_WindowBase::get_resources();
49
50 //      add_subwindow(new BC_Title(mwindow->theme->preferencestitle_x, 
51 //              mwindow->theme->preferencestitle_y, 
52 //              _("About"), 
53 //              LARGEFONT, 
54 //              resources->text_default));
55         
56         x = mwindow->theme->preferencesoptions_x;
57         y = mwindow->theme->preferencesoptions_y +
58                 get_text_height(LARGEFONT);
59
60         char license1[BCTEXTLEN];
61         sprintf(license1, "%s %s", PROGRAM_NAME, CINELERRA_VERSION);
62
63         set_font(LARGEFONT);
64         set_color(resources->text_default);
65         draw_text(x, y, license1);
66
67         y += get_text_height(LARGEFONT);
68         char license2[BCTEXTLEN];
69         sprintf(license2, 
70                 _("(C) %d Adam Williams\n\nheroinewarrior.com"), 
71                 COPYRIGHT_DATE);
72         set_font(MEDIUMFONT);
73         draw_text(x, y, license2);
74
75
76
77         y += get_text_height(MEDIUMFONT) * 3;
78
79 //      char versions[BCTEXTLEN];
80 //      sprintf(versions, 
81 // _("Libmpeg3 version %d.%d.%d\n"),
82 // mpeg3_major(),
83 // mpeg3_minor(),
84 // mpeg3_release());
85 //      draw_text(x, y, versions);
86
87
88         char exe_path[BCTEXTLEN], msg_path[BCTEXTLEN];
89         get_exe_path(exe_path);
90         snprintf(msg_path, sizeof(msg_path), "%s/msg.txt", exe_path);
91         FILE *fp = fopen(msg_path, "r");
92         if( fp ) {
93                 set_font(LARGEFONT);
94                 draw_text(x, y, _("About:"));
95                 y += get_text_height(LARGEFONT);
96                 char msg[BCTEXTLEN];
97                 while( fgets(msg, sizeof(msg), fp) )
98                         about.append(new BC_ListBoxItem(msg));
99
100                 BC_ListBox *listbox;
101                 add_subwindow(listbox = new BC_ListBox(x, y, 300, 300,
102                         LISTBOX_TEXT, &about, 0, 0, 1));
103                 y += listbox->get_h() + get_text_height(LARGEFONT) + 10;
104         }
105         else
106                 y += 300 + get_text_height(LARGEFONT) + 10;
107
108         set_font(LARGEFONT);
109         set_color(resources->text_default);
110         draw_text(x, y, _("License:"));
111         y += get_text_height(LARGEFONT);
112         set_font(MEDIUMFONT);
113
114         char license3[BCTEXTLEN];
115         sprintf(license3, _(
116 "This program is free software; you can redistribute it and/or modify it under the terms\n"
117 "of the GNU General Public License as published by the Free Software Foundation; either version\n"
118 "2 of the License, or (at your option) any later version.\n"
119 "\n"
120 "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;\n"
121 "without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\n"
122 "PURPOSE.  See the GNU General Public License for more details.\n"
123 "\n"));
124         draw_text(x, y, license3);
125
126         x = get_w() - mwindow->theme->about_bg->get_w() - 10;
127         y = mwindow->theme->preferencesoptions_y;
128         BC_Pixmap *temp_pixmap = new BC_Pixmap(this, 
129                 mwindow->theme->about_bg,
130                 PIXMAP_ALPHA);
131         draw_pixmap(temp_pixmap, 
132                 x, 
133                 y);
134
135         delete temp_pixmap;
136
137
138         x += mwindow->theme->about_bg->get_w() + 10;
139         y += get_text_height(LARGEFONT) * 2;
140
141
142         flash();
143         flush();
144 }
145
146