[cairo-commit] cairo-demo/cairo_snippets ChangeLog, 1.40,
1.41 Makefile.am, 1.4, 1.5 cairo_snippets_html.c, 1.7,
1.8 cairo_snippets_ps.c, 1.5, 1.6 prepare_snippets.c, 1.9, 1.10
Kristian Hogsberg
commit at pdx.freedesktop.org
Fri Jun 3 12:09:37 PDT 2005
Committed by: krh
Update of /cvs/cairo/cairo-demo/cairo_snippets
In directory gabe:/tmp/cvs-serv25241
Modified Files:
ChangeLog Makefile.am cairo_snippets_html.c
cairo_snippets_ps.c prepare_snippets.c
Log Message:
2005-06-03 Kristian Høgsberg <krh at redhat.com>
* cairo_snippets_html.c: Update html snippets.
* snippets/pattern_fill.cairo: Remove this, was accidentally
committed.
Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/ChangeLog,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- ChangeLog 16 May 2005 19:10:42 -0000 1.40
+++ ChangeLog 3 Jun 2005 19:09:35 -0000 1.41
@@ -1,3 +1,10 @@
+2005-06-03 Kristian Høgsberg <krh at redhat.com>
+
+ * cairo_snippets_html.c: Update html snippets.
+
+ * snippets/pattern_fill.cairo: Remove this, was accidentally
+ committed.
+
2005-05-16 Kristian Høgsberg <krh at redhat.com>
* cairo_snippets_pdf.c (main): Use new PDF constructor (filename
Index: Makefile.am
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Makefile.am 3 May 2005 02:22:48 -0000 1.4
+++ Makefile.am 3 Jun 2005 19:09:35 -0000 1.5
@@ -54,6 +54,7 @@
## webpage at http://cairographics.org/samples/
html : pngs snippets.html
+ cp html/cairo_snippets.css snippets
snippets.html : cairo_snippets_html
./cairo_snippets_html
Index: cairo_snippets_html.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/cairo_snippets_html.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- cairo_snippets_html.c 13 Oct 2004 18:24:11 -0000 1.7
+++ cairo_snippets_html.c 3 Jun 2005 19:09:35 -0000 1.8
@@ -4,6 +4,9 @@
#include "snippets.h"
+#define TEMPLATE_DIR "html/"
+#define OUTPUT_DIR "snippets/"
+
void
write_index (void);
@@ -41,9 +44,9 @@
*/
for (i=0;i<snippet_count;i++) {
if (i==active)
- fprintf (file, "<div id='snippet_list_entry_selected'><a href='%s.html'> %s\n</a></div>", snippet_name[i], snippet_name[i]);
+ fprintf (file, "<div id='snippet_list_entry_selected'><a href='%s.html'>%s\n</a></div>", snippet_name[i], snippet_name[i]);
else
- fprintf (file, "<div id='snippet_list_entry'><a href='%s.html'> %s</a>\n</div>",
+ fprintf (file, "<div id='snippet_list_entry'><a href='%s.html'>%s</a>\n</div>",
snippet_name[i], snippet_name[i]);
}
@@ -53,12 +56,12 @@
void
write_index(void)
{
- FILE *file= fopen ("index.html", "w");
+ FILE *file= fopen (OUTPUT_DIR "index.html", "w");
- embed_file (file, "header.html_template");
+ embed_file (file, TEMPLATE_DIR "header.html_template");
do_index (file, -2);
- embed_file (file, "index.html_template");
- embed_file (file, "footer.html_template");
+ embed_file (file, TEMPLATE_DIR "index.html_template");
+ embed_file (file, TEMPLATE_DIR "footer.html_template");
fclose (file);
}
@@ -66,9 +69,9 @@
write_all(void)
{
int i=0;
- FILE *file= fopen ("snippets.html", "w");
+ FILE *file= fopen (OUTPUT_DIR "snippets.html", "w");
- embed_file (file, "header.html_template");
+ embed_file (file, TEMPLATE_DIR "header.html_template");
fprintf (file, "<p>Renderings done using the cairo api, and their corresponding drawing instructions.</p>\n");
fprintf (file, "<table>\n");
fprintf (file, "<div id='snippets'>");
@@ -102,7 +105,7 @@
fprintf (file, "</div><br clear='all'/>\n");
}
fprintf (file, "</div>");
- embed_file (file, "footer.html_template");
+ embed_file (file, TEMPLATE_DIR "footer.html_template");
fclose (file);
}
@@ -114,10 +117,10 @@
const char *name=snippet_name[snippet_no];
char htmlfile[1024];
- sprintf (htmlfile, "%s.html", name);
+ sprintf (htmlfile, OUTPUT_DIR "%s.html", name);
file = fopen (htmlfile, "w");
- embed_file (file, "header.html_template");
+ embed_file (file, TEMPLATE_DIR "header.html_template");
do_index (file, snippet_no);
if (snippet_no>0) {
fprintf (file, "<div id='snippet_prev'><a href='%s.html'>prev</a></div>\n",
@@ -157,7 +160,7 @@
}
- embed_file (file, "footer.html_template");
+ embed_file (file, TEMPLATE_DIR "footer.html_template");
fclose (file);
}
Index: cairo_snippets_ps.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/cairo_snippets_ps.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- cairo_snippets_ps.c 11 May 2005 21:15:31 -0000 1.5
+++ cairo_snippets_ps.c 3 Jun 2005 19:09:35 -0000 1.6
@@ -22,14 +22,10 @@
main (void)
{
int i;
- FILE *file;
cairo_surface_t *surface;
cairo_t *cr;
- file = fopen ("snippets.ps", "w");
- surface = cairo_ps_surface_create (file,
- X_INCHES, Y_INCHES,
- X_PPI, Y_PPI);
+ surface = cairo_ps_surface_create ("snippets.ps", WIDTH, HEIGHT);
cr = cairo_create (surface);
for (i=0;i<snippet_count;i++)
@@ -37,7 +33,6 @@
cairo_destroy (cr);
cairo_surface_destroy (surface);
- fclose (file);
return 0;
}
Index: prepare_snippets.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/prepare_snippets.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- prepare_snippets.c 11 May 2005 21:15:31 -0000 1.9
+++ prepare_snippets.c 3 Jun 2005 19:09:35 -0000 1.10
@@ -6,6 +6,8 @@
#include <stdlib.h>
#include <string.h>
+#define SNIPPETS_DIR "snippets/"
+
#define MAX_SNIPPETS 512
char *snippet_name[MAX_SNIPPETS];
@@ -56,7 +58,7 @@
fprintf (out, "\n");
fprintf (out, " case %i:{ /* %s */\n\n\n", i, snippet_name[i]);
- sprintf (filename, "%s.cairo", snippet_name[i]);
+ sprintf (filename, SNIPPETS_DIR "%s.cairo", snippet_name[i]);
file = fopen (filename, "r");
while ((read=fread (&c, 1,1, file))){
@@ -90,7 +92,7 @@
fprintf (out, "\"");
- sprintf (filename, "%s.cairo", snippet_name[i]);
+ sprintf (filename, SNIPPETS_DIR "%s.cairo", snippet_name[i]);
file = fopen (filename, "r");
while ((read=fread (&c, 1,1, file))){
@@ -183,6 +185,7 @@
main (int argc, char **argv)
{
char **cur_arg;
+ char *basename, *slash;
out = fopen ("snippets.c", "w");
@@ -197,9 +200,14 @@
}
if (name) {
+ slash = strrchr (name, '/');
+ if (slash != NULL)
+ basename = slash + 1;
+ else
+ basename = name;
*strstr (name, ".cairo")='\0';
- snippet_name[snippet_count++]=strdup (name);
- free (name);
+ snippet_name[snippet_count++]=strdup (basename);
+ free (name);
}
}
cur_arg++;
More information about the cairo-commit
mailing list