source: branches/replacing_gnuplot/lib/css.cc @ 845

Last change on this file since 845 was 845, checked in by Jari Häkkinen, 14 years ago

Merged trunk changes -r782:844 to replacing_gnuplot branch.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.7 KB
Line 
1// $Id: css.cc 845 2009-11-16 22:27:19Z jari $
2
3/*
4  Copyright (C) 2006 Peter Johansson
5  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
6  Copyright (C) 2009 Peter Johansson
7
8  This file is part of svndigest, http://dev.thep.lu.se/svndigest
9
10  svndigest is free software; you can redistribute it and/or modify it
11  under the terms of the GNU General Public License as published by
12  the Free Software Foundation; either version 3 of the License, or
13  (at your option) any later version.
14
15  svndigest is distributed in the hope that it will be useful, but
16  WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  General Public License for more details.
19
20  You should have received a copy of the GNU General Public License
21  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
22*/
23
24#include "css.h"
25#include <config.h>
26
27#include <fstream>
28#include <string>
29
30namespace theplu{
31namespace svndigest{
32
33  void print_css(const std::string& str)
34  {
35    std::ofstream s(str.c_str());
36    s << "<-- svndigest.css generated by " << PACKAGE_STRING << "\n"
37
38      << "Copyright (C) 2006 Peter Johansson\n"
39      << "Copyright (C) 2007 Jari Häkkinen, Peter Johansson\n"
40      << "Copyright (C) 2009 Peter Johansson\n"
41      << "\nThis file is part of svndigest, " 
42      << "http://dev.thep.lu.se/svndigest\n\n"
43
44      << "svndigest is free software; you can redistribute it and/or " 
45      << "modify it\n"
46      << "under the terms of the GNU General Public License as published by\n"
47      << "the Free Software Foundation; either version 3 of the License, or\n"
48      << "(at your option) any later version.\n\n"
49
50      << "svndigest is distributed in the hope that it will be useful, but\n"
51      << "WITHOUT ANY WARRANTY; without even the implied warranty of\n"
52      << "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"
53      << "General Public License for more details.\n\n"
54
55      << "You should have received a copy of the GNU General Public License\n"
56      << "along with svndigest. If not, see <http://www.gnu.org/licenses/>.\n"
57
58      << "\n\nThis file was initially inspired by the cascading style sheet\n"
59      << "within the Trac open source project (http://trac.edgewall.org/)\n"
60      << "Copyright (C) 2003-2006 Edgewall Software\n"
61      << "All rights reserved.\n\n"
62
63      << "Redistribution and use in source and binary forms, with or without\n"
64      << "modification, are permitted provided that the following conditions\n"
65      << "are met:\n\n"
66     
67      << "1. Redistributions of source code must retain the above copyright\n"
68      << "   notice, this list of conditions and the following disclaimer.\n"
69      << "2. Redistributions in binary form must reproduce the above copyright\n"
70      << "   notice, this list of conditions and the following disclaimer in\n"
71      << "   the documentation and/or other materials provided with the\n"
72      << "   distribution.\n"
73      << "3. The name of the author may not be used to endorse or promote\n"
74      << "   products derived from this software without specific prior\n"
75      << "   written permission.\n\n"
76     
77      << "THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS\n"
78      << "OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n"
79      << "WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n"
80      << "ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\n"
81      << "DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n"
82      << "DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\n"
83      << "GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n"
84      << "INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n"
85      << "WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n"
86      << "NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n"
87      << "SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.-->\n";
88
89    s << "body {\n";
90    s << " background: #fff; \n";
91    s << " color: #000; \n";
92    s << " margin: 0px; \n";
93    s << " padding: 0; \n";
94    s << "} \n";
95    s << "\n";
96
97    s << "#menu {\n";
98    s << " background: #eee;\n";
99    s << " width: 100%;\n";
100    s << " margin: 0px;\n";
101    s << " padding: 0px;\n";
102    s << "}\n\n";
103    s << "#menu ul\n";
104    s << "{ \n";
105    s << "padding: 0px;\n";
106    s << "margin: 0px;list-style-type: none; text-align: center;"
107      << "border-bottom: 1px solid black;}\n";
108    s << "#menu ul li { display: inline; border-right: 1px solid black;}\n";
109    s << "#menu ul li a {text-decoration: none; padding-right: 1em;" 
110      << "padding-left: 1em; margin: 0px;}\n";
111    s << "#menu ul li a:hover{ color: #000; background: #ddd;}\n";
112    s << "#menu ul li.highlight a {color: #fff; background: #777; }";
113    s << "\n";
114    s << "#main {\n";
115    s << " margin: 10px; \n";
116    s << "}\n";
117    s << "\n";
118
119    s << "body, th, td {\n";
120    s << " font: normal 13px verdana,arial,'Bitstream Vera Sans',"
121      << "helvetica,sans-serif;\n";
122    s << "}\n";
123    s << ":link, :visited {\n";
124    s << " text-decoration: none;\n";
125    s << " color: #b00;\n";
126    s << "}\n";
127    s << "\n";
128
129    s << "div.main {\n";
130    s << "margin-top: 50px;\n";         
131    s << "margin-left: 50px;\n";
132    s << " \n";
133    s << "}\n";
134
135    s << "table.main {\n"; 
136    s << " text-align: left;\n";
137    s << " padding: 0 1em .1em 0;\n";
138    s << "}\n";
139    s << "table.main th {\n";
140    s << " text-align: left;\n";
141    s << " padding: 0 1em 0.5em 0;\n";
142    s << " font-size: 150%;\n";
143    s << " font-wheight: bold;\n";
144    s << "}\n";
145    s << "table.main td {\n";
146    s << " padding: 0 1em .1em 0;\n";
147    s << "}\n\n";
148
149
150    s << "p.plot { text-align: center; }\n";
151    s << "p.plot img { border: 0; }\n";
152
153    s << "p.footer {\n";
154    s << "text-align: center;\n";
155    s << "font-size: 70%;\n";
156    s << "}\n\n";
157
158    s << "table.blame {\n";
159    s << " border: 1px solid #ddd;\n";
160    s << " border-spacing: 0;\n";
161    s << " border-top: 0;\n";
162    s << " empty-cells: show;\n";
163    s << " font-size: 12px;\n";
164    s << " line-height: 130%;\n";
165    s << " padding: 0;\n";
166    s << " margin: 0 auto;\n";
167    s << " table-layout: fixed;\n";
168    s << " width: 100%;\n";
169    s << "}\n";
170    s << "table.blame th {\n";
171    s << " border-right: 1px solid #d7d7d7;\n";
172    s << " border-bottom: 1px solid #998;\n";
173    s << " font-size: 11px;\n";
174    s << "}\n";
175    s << "table.blame th.author { width: 5em; text-align:right }\n";
176    s << "table.blame th.date { width: 8em; text-align:center }\n";
177    s << "table.blame th.rev { width: 3em }\n";
178    s << "table.blame th.line { width: 3em }\n";
179    s << "table.blame thead th {\n";
180    s << " background: #eee;\n";
181    s << " border-top: 1px solid #d7d7d7;\n";
182    s << " color: #999;\n";
183    s << " padding: 0 .25em;\n";
184    s << " text-align: center;\n";
185    s << " white-space: nowrap;\n";
186    s << "}\n";
187    s << "table.blame tbody td {\n";
188    s << " border-right: 1px solid #f0f0f0;\n";
189    s << " font: normal 11px monospace;\n";
190    s << " overflow: hidden;\n";
191    s << " padding: 1px 2px;\n";
192    s << " vertical-align: top;\n";
193    s << "}\n";
194    s << "table.blame tbody td.author { text-align: right; }\n";
195    s << "table.blame tbody td.date {text-align:right;padding-right:1.45em;}\n";
196    s << "table.blame tbody td.rev { text-align: right; }\n";
197    std::string bg_lt_code("cfcfff");
198    std::string bg_lt_comment("e8e8ff");
199    std::string bg_lt_other("ffffff");
200    s << "table.blame tbody td.line-code { text-align: right; " 
201      << "background: #" << bg_lt_code << "; }\n";
202    s << "table.blame tbody td.line-comment { text-align: right; "
203      << "background: #" << bg_lt_comment << "; }\n";
204    s << "table.blame tbody td.line-other { text-align: right; "
205      << "background: #" << bg_lt_other << "; }\n";
206    s << "table.blame tbody tr:hover { background: #eed; }\n";
207    s << "table.blame tbody td a { display: block; }\n";
208    s << "\n";
209
210    s << "table.listings {\n";
211    s << " clear: both;\n";
212    s << " border-bottom: 1px solid #d7d7d7;\n";
213    s << " border-collapse: collapse;\n";
214    s << " border-spacing: 0;\n";
215    s << " margin-top: 1em;\n";
216    s << " width: 100%;\n";
217    s << "}\n";
218    s << "\n";
219    s << "table.listings th {\n";
220    s << " text-align: left;\n";
221    s << " padding: 0 1em .1em 0;\n";
222    s << " font-size: 12px\n";
223    s << "}\n";
224    s << "table.listings thead { background: #f7f7f0 }\n";
225    s << "table.listings thead th {\n";
226    s << " border: 1px solid #d7d7d7;\n";
227    s << " border-bottom-color: #999;\n";
228    s << " font-size: 11px;\n";
229    s << " font-wheight: bold;\n";
230    s << " padding: 2px .5em;\n";
231    s << " vertical-align: bottom;\n";
232    s << "}\n";
233    s << "\n";
234    s << "table.listings tbody td, table.listing tbody th {\n";
235    s << " border: 1px dotted #ddd;\n";
236    s << " padding: .33em .5em;\n";
237    s << " vertical-align: top;\n";
238    s << "}\n";
239    s << "\n";
240    s << "table.listings tbody tr { border-top: 1px solid #ddd }\n";
241    s << "table.listings tbody tr.light { background-color: #fcfcfc }\n";
242    s << "table.listings tbody tr.dark { background-color: #f7f7f7 }\n";
243    s << "table.listings tbody tr:hover { background: #eed }\n";
244    s << "table.listings tbody td { text-align: left }\n";
245    s << "table.listings tbody td a { display: block; }\n";
246    s << "table.listings tbody td.directory a { font-weight: bold }\n";
247    s << "\n";
248
249    s << ".sep { color: #666}\n";
250    s << "div.blame_legend .code { background: #" << bg_lt_code << "; }\n"
251      << "div.blame_legend .comment { background: #" << bg_lt_comment << "; }\n"
252      << "div.blame_legend .other { background: #" << bg_lt_other << "; }\n"
253      << "div.blame_legend {\n"
254      << "float: left;\n"
255      << "font-size: 9px;\n"
256      << "margin: 1em 0;\n"
257      << "padding: .5em;\n"
258      << "} \n"
259      << "div.blame_legend dt {\n"
260      << "background: #fff;\n"
261      << "border: 1px solid #999;\n"
262      << "float: left;\n"
263      << "margin: .1em .5em .1em 2em;\n"
264      << "overflow: hidden;\n"
265      << "width: .8em; height: .8em;\n"
266      << "}\n"
267      << "div.blame_legend dl, div.blame_legend dd {\n"
268      << "display: inline;\n"
269      << "float: left;\n"
270      << "padding: 0;\n"
271      << "margin: 0;\n"
272      << "margin-right: 1.5em;\n"
273      << "}\n";
274    s.close();
275  }
276
277}} // end of namespace svndigest and namespace theplu
Note: See TracBrowser for help on using the repository browser.