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