]> git.lyx.org Git - lyx.git/blob - src/credits.C
white-space changes, removed definitions.h several enum changes because of this,...
[lyx.git] / src / credits.C
1 /* This file is part of
2  * ====================================================== 
3  * 
4  *           LyX, The Document Processor
5  *       
6  *           Copyright 1995 Matthias Ettrich
7  *           Copyright 1995-1999 The LyX Team.
8  *
9  * ====================================================== */
10
11 #include <config.h>
12
13 #include FORMS_H_LOCATION
14 #include <cstdlib>
15
16 #include "credits.h"
17 #include "credits_form.h"
18
19 #include "LString.h"
20 #include "support/filetools.h"
21 #include "lyx_gui_misc.h" // CancelCloseBoxCB
22 #include "gettext.h"
23
24 extern string system_lyxdir;
25
26 /**** Forms and Objects ****/
27
28 static FD_form_credits *fd_form_credits = 0;
29 static FD_copyright *fd_form_copyright = 0;
30
31 void CreditsOKCB(FL_OBJECT *, long) {
32       fl_hide_form(fd_form_credits->form_credits);
33       fl_free_form(fd_form_credits->form_credits);
34       fd_form_credits->form_credits = 0;
35 }
36
37 /*---------------------------------------*/
38 /* read credits from file and display them */
39 void ShowCredits()
40 {
41         /* generate the credits form if it doesn't exist */
42         if (!fd_form_credits || !fd_form_credits->form_credits) {
43                 
44                 /* read the credits into the browser */ 
45                 
46                 /* try file LYX_DIR/CREDITS */ 
47                 string real_file = AddName (system_lyxdir, "CREDITS");
48                 fd_form_credits = create_form_form_credits();
49                 fl_set_form_atclose(fd_form_credits->form_credits,
50                                     CancelCloseBoxCB, 0);
51
52                 if (!fl_load_browser(fd_form_credits->browser_credits, 
53                                      real_file.c_str())) {
54                         fl_add_browser_line(fd_form_credits->browser_credits,
55                                             _("ERROR: LyX wasn't able to read"
56                                             " CREDITS file"));
57                         fl_add_browser_line(fd_form_credits->browser_credits, "");
58                         fl_add_browser_line(fd_form_credits->browser_credits,
59                                             _("Please install correctly to estimate"
60                                             " the great"));
61                         fl_add_browser_line(fd_form_credits->browser_credits,
62                                             _("amount of work other people have done"
63                                             " for the LyX project."));
64                 }
65         }
66
67         if (fd_form_credits->form_credits->visible) {
68                 fl_raise_form(fd_form_credits->form_credits);
69         } else {
70                 fl_show_form(fd_form_credits->form_credits,
71                              FL_PLACE_MOUSE | FL_FREE_SIZE, FL_FULLBORDER,
72                              _("Credits"));
73         }
74 }
75
76 // Callback for copyright and warranty form
77 void CopyrightOKCB(FL_OBJECT *, long) {
78         fl_hide_form(fd_form_copyright->copyright);
79         fl_free_form(fd_form_copyright->copyright);
80         fd_form_copyright->copyright = 0;
81 }
82
83 // Show copyright and warranty form
84 void ShowCopyright()
85 {
86         if (!fd_form_copyright || !fd_form_copyright->copyright) {
87                 fd_form_copyright = create_form_copyright();
88                 fl_set_form_atclose(fd_form_copyright->copyright, 
89                                     CancelCloseBoxCB, 0);
90         }
91
92         // Funny emotional remark by Asger deleted. (Lgb)
93         
94         if (fd_form_copyright->copyright->visible) {
95                 fl_raise_form(fd_form_copyright->copyright);
96         } else {
97                 fl_show_form(fd_form_copyright->copyright,
98                              FL_PLACE_MOUSE, FL_FULLBORDER,
99                              _("Copyright and Warranty"));
100         }
101 }