summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Caldwell <inc@inc-omplete.org>2008-09-01 23:43:27 +0000
committerIan Caldwell <inc@inc-omplete.org>2008-09-01 23:43:27 +0000
commite052256c9a043e4db07201581105d330f6efd4a2 (patch)
tree5f93f6d77ce5117b625922937fa93d14e9b2e907
Moving exchange.enlightenment.org application to svn in order to allow
the e community to further as needed. SVN revision: 35786
-rw-r--r--AUTHORS2
-rw-r--r--COPYING20
-rw-r--r--ChangeLog0
-rw-r--r--Makefile.am7
-rw-r--r--NEWS0
-rw-r--r--README2
-rwxr-xr-xautogen.sh16
-rw-r--r--configure.in33
-rw-r--r--src/Makefile.am4
-rw-r--r--src/bin/Makefile.am16
-rw-r--r--src/bin/main.c406
-rw-r--r--src/bin/main.h31
12 files changed, 537 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..5c674e7
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,2 @@
1Sthithaprajna Garapaty (iamsthitha)
2and whoever wrote edje_thumb \ No newline at end of file
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..25562c5
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,20 @@
1Copyright (C) 2008 Sthithaprajna Garapaty
2
3Permission is hereby granted, free of charge, to any person obtaining a copy
4of this software and associated documentation files (the "Software"), to
5deal in the Software without restriction, including without limitation the
6rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7sell copies of the Software, and to permit persons to whom the Software is
8furnished to do so, subject to the following conditions:
9
10The above copyright notice and this permission notice shall be included in
11all copies of the Software, its documentation and marketing & publicity
12materials, and acknowledgment shall be given in the documentation, materials
13and software packages that this Software was used.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ChangeLog
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..bc44e24
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,7 @@
1
2SUBDIRS = src
3
4MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess \
5 config.h.in config.sub configure install-sh \
6 ltconfig ltmain.sh missing mkinstalldirs \
7 stamp-h.in depcomp
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/NEWS
diff --git a/README b/README
new file mode 100644
index 0000000..d38fa0b
--- /dev/null
+++ b/README
@@ -0,0 +1,2 @@
1This is a thumbnailing app written specifically for themes for the enlightenment WM.
2Lots of code taken from edje_thumb. \ No newline at end of file
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..995ff2f
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,16 @@
1#!/bin/sh
2
3rm -rf autom4te.cache
4rm -f aclocal.m4 ltmain.sh
5
6touch README
7
8echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS -I m4 || exit 1
9echo "Running autoheader..." ; autoheader || exit 1
10echo "Running autoconf..." ; autoconf || exit 1
11echo "Running libtoolize..." ; (libtoolize --copy --automake || glibtoolize --automake) || exit 1
12echo "Running automake..." ; automake --add-missing --copy --gnu || exit 1
13
14if [ -z "$NOCONFIGURE" ]; then
15 ./configure "$@"
16fi
diff --git a/configure.in b/configure.in
new file mode 100644
index 0000000..5cefd82
--- /dev/null
+++ b/configure.in
@@ -0,0 +1,33 @@
1dnl Process this file with autoconf to produce a configure script.
2
3AC_INIT(edje_smart_thumb, 0.0.1, enlightenment-devel@lists.sourceforge.net)
4AC_PREREQ(2.52)
5AC_CONFIG_SRCDIR(configure.in)
6
7AM_INIT_AUTOMAKE
8AM_CONFIG_HEADER(config.h)
9
10AC_PROG_CC
11AM_PROG_CC_STDC
12AC_HEADER_STDC
13AC_C_CONST
14
15define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
16define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
17AC_PROG_LIBTOOL
18
19PKG_CHECK_MODULES(EVAS, [evas >= 0.9.9])
20
21PKG_CHECK_MODULES(EDJE, [edje >= 0.5.0])
22
23
24PKG_CHECK_MODULES(ECORE, [
25 ecore
26 ecore-evas
27])
28
29AC_OUTPUT([
30Makefile
31src/Makefile
32src/bin/Makefile
33])
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..c296d8c
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,4 @@
1
2SUBDIRS = bin
3
4MAINTAINERCLEANFILES = Makefile.in
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
new file mode 100644
index 0000000..cbe6575
--- /dev/null
+++ b/src/bin/Makefile.am
@@ -0,0 +1,16 @@
1
2MAINTAINERCLEANFILES = Makefile.in
3
4AM_CPPFLAGS = \
5-I$(top_builddir) \
6-I$(top_srcdir) \
7-I$(top_srcdir)/src/bin \
8@EDJE_CFLAGS@ @EVAS_CFLAGS@
9
10bin_PROGRAMS = edje_smart_thumb
11
12edje_smart_thumb_SOURCES = \
13main.c \
14main.h
15
16edje_smart_thumb_LDADD = @EDJE_LIBS@ @EVAS_LIBS@
diff --git a/src/bin/main.c b/src/bin/main.c
new file mode 100644
index 0000000..54af83a
--- /dev/null
+++ b/src/bin/main.c
@@ -0,0 +1,406 @@
1#include "main.h"
2
3static void args_parse(void);
4static void help_show(void);
5static int signal_exit(void *data, int ev_type, void *ev);
6static int thumb_grab(void *data);
7
8Ecore_Evas *ee = NULL, *ee_im = NULL, *ee_im2 = NULL;
9Evas *evas = NULL, *evas_im = NULL, *evas_im2 = NULL;
10Evas_Object *edje = NULL, *im = NULL, *im2 = NULL;
11char *file = NULL;
12char *group = NULL;
13char *outfile = NULL;
14int w = 640;
15int h = 480;
16int outw = 160;
17int outh = 120;
18
19int
20main(int argc, char **argv)
21{
22 if (!ecore_init()) return -1;
23 ecore_app_args_set(argc, (const char **)argv);
24 ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, signal_exit, NULL);
25 if (!ecore_evas_init()) return -1;
26 if (!edje_init()) return -1;
27
28 args_parse();
29
30 ee = ecore_evas_buffer_new(outw, outh);
31 if (!ee)
32 {
33 fprintf(stderr, "Error. cannot create buffer engine canvas for image save.\n");
34 exit(-1);
35 }
36 evas = ecore_evas_get(ee);
37
38 im = ecore_evas_object_image_new(ee);
39 if (!im)
40 {
41 fprintf(stderr, "Error. cannot create buffer canvas image object for scaling.\n");
42 exit(-1);
43 }
44 evas_object_move(im, 0, 0);
45 evas_object_resize(im, outw, outh);
46 evas_object_image_fill_set(im, 0, 0, outw, outh);
47 evas_object_show(im);
48 evas_object_image_size_set(im, outw, outh);
49 ee_im = evas_object_data_get(im, "Ecore_Evas");
50 evas_im = ecore_evas_get(ee_im);
51
52 im2 = ecore_evas_object_image_new(ee_im);
53 if (!im2)
54 {
55 fprintf(stderr, "Error. cannot create buffer canvas image for scaling.\n");
56 exit(-1);
57 }
58 evas_object_move(im2, 0, 0);
59 evas_object_resize(im2, outw, outh);
60 evas_object_image_fill_set(im2, 0, 0, outw, outh);
61 evas_object_show(im2);
62 evas_object_image_size_set(im2, w, h);
63 ee_im2 = evas_object_data_get(im2, "Ecore_Evas");
64 evas_im2 = ecore_evas_get(ee_im2);
65
66 setup_scene();
67
68 edje_message_signal_process();
69
70 ecore_timer_add(2.0, thumb_grab, NULL);
71 ecore_main_loop_begin();
72
73 evas_object_del(edje);
74 ecore_evas_free(ee);
75 edje_shutdown();
76 ecore_evas_shutdown();
77 ecore_shutdown();
78 return 0;
79}
80
81static void
82setup_scene(void)
83{
84 if (!strcmp(group, "e/desktop/background"))
85 {
86 edje = edje_object_add(evas_im2);
87 if (!edje_object_file_set(edje, file, group))
88 {
89 fprintf(stderr, "Error. cannot load file %s, group %s\n", file, group);
90 exit(-1);
91 }
92 evas_object_move(edje, 0, 0);
93 evas_object_resize(edje, w, h);
94 evas_object_show(edje);
95 }
96 else if (!strcmp(group, "e/fileman"))
97 {
98
99 }
100 else if (!strcmp(group, "e/gadman"))
101 {
102
103 }
104 else if (!strcmp(group, "e/icons"))
105 {
106
107 }
108 else if (!strcmp(group, "e/modules/battery"))
109 {
110
111 }
112 else if (!strcmp(group, "e/modules/clock"))
113 {
114
115 }
116 else if (!strcmp(group, "e/modules/cpufreq"))
117 {
118
119 }
120 else if (!strcmp(group, "e/modules/ibar"))
121 {
122
123 }
124 else if (!strcmp(group, "e/modules/ibox"))
125 {
126
127 }
128 else if (!strcmp(group, "e/modules/pager"))
129 {
130
131 }
132 else if (!strcmp(group, "e/modules/start"))
133 {
134
135 }
136 else if (!strcmp(group, "e/modules/temperature"))
137 {
138
139 }
140 else if (!strcmp(group, "e/modules/winlist"))
141 {
142
143 }
144 else if (!strcmp(group, "e/pointer"))
145 {
146
147 }
148 else if (!strcmp(group, "e/shelf"))
149 {
150
151 }
152 else if (!strcmp(group, "e/theme/about"))
153 {
154
155 }
156 else if (!strcmp(group, "e/widgets/border"))
157 {
158
159 }
160 else if (!strcmp(group, "e/widgets/border/default"))
161 {
162
163 }
164 else if (!strcmp(group, "e/widgets/border/dialog"))
165 {
166
167 }
168 else if (!strcmp(group, "e/widgets/border/noresize"))
169 {
170
171 }
172 else if (!strcmp(group, "e/widgets/border/noresize_dialog"))
173 {
174
175 }
176 else if (!strcmp(group, "e/widgets/border/pixel"))
177 {
178
179 }
180 else if (!strcmp(group, "e/widgets/border/shaped"))
181 {
182
183 }
184 else if (!strcmp(group, "e/widgets/about"))
185 {
186
187 }
188 else if (!strcmp(group, "e/widgets/button"))
189 {
190
191 }
192 else if (!strcmp(group, "e/widgets/check"))
193 {
194
195 }
196 else if (!strcmp(group, "e/widgets/color_well"))
197 {
198
199 }
200 else if (!strcmp(group, "e/widgets/configure"))
201 {
202
203 }
204 else if (!strcmp(group, "e/widgets/cslider"))
205 {
206
207 }
208 else if (!strcmp(group, "e/widgets/deskpreview"))
209 {
210
211 }
212 else if (!strcmp(group, "e/widgets/dialog"))
213 {
214
215 }
216 else if (!strcmp(group, "e/widgets/entry"))
217 {
218
219 }
220 else if (!strcmp(group, "e/widgets/exebuf"))
221 {
222
223 }
224 else if (!strcmp(group, "e/widgets/fileselector"))
225 {
226
227 }
228 else if (!strcmp(group, "e/widgets/fontpreview"))
229 {
230
231 }
232 else if (!strcmp(group, "e/widgets/frame"))
233 {
234
235 }
236 else if (!strcmp(group, "e/widgets/gradpreview"))
237 {
238
239 }
240 else if (!strcmp(group, "e/widgets/ilist"))
241 {
242
243 }
244 else if (!strcmp(group, "e/widgets/label"))
245 {
246
247 }
248 else if (!strcmp(group, "e/widgets/menu"))
249 {
250
251 }
252 else if (!strcmp(group, "e/widgets/pager"))
253 {
254
255 }
256 else if (!strcmp(group, "e/widgets/preview"))
257 {
258
259 }
260 else if (!strcmp(group, "e/widgets/radio"))
261 {
262
263 }
264 else if (!strcmp(group, "e/widgets/scrollframe"))
265 {
266
267 }
268 else if (!strcmp(group, "e/widgets/slider"))
269 {
270
271 }
272 else if (!strcmp(group, "e/widgets/spectrum"))
273 {
274
275 }
276 else if (!strcmp(group, "e/widgets/textblock"))
277 {
278
279 }
280 else if (!strcmp(group, "e/widgets/tlist"))
281 {
282
283 }
284 else if (!strcmp(group, "e/widgets/winlist"))
285 {
286
287 }
288 else
289 {
290 edje = edje_object_add(evas_im2);
291 if (!edje_object_file_set(edje, file, group))
292 {
293 fprintf(stderr, "Error. cannot load file %s, group %s\n", file, group);
294 exit(-1);
295 }
296 evas_object_move(edje, 0, 0);
297 evas_object_resize(edje, w, h);
298 evas_object_show(edje);
299 }
300}
301
302static void
303args_parse(void)
304{
305 int argc;
306 char **argv;
307 int i;
308
309 ecore_app_args_get(&argc, &argv);
310 for (i = 1; i < argc; i++)
311 {
312 if ((!strcmp(argv[i], "-h")) ||
313 (!strcmp(argv[i], "-help")) ||
314 (!strcmp(argv[i], "--help")))
315 {
316 help_show();
317 exit(-1);
318 }
319 else if (((!strcmp(argv[i], "-g")) ||
320 (!strcmp(argv[i], "-geometry")) ||
321 (!strcmp(argv[i], "--geometry"))) && (i < (argc - 1)))
322 {
323 int n;
324 char buf[16], buf2[16];
325
326 n = sscanf(argv[i +1], "%10[^x]x%10s", buf, buf2);
327 if (n == 2)
328 {
329 w = atoi(buf);
330 h = atoi(buf2);
331 }
332 i++;
333 }
334 else if (((!strcmp(argv[i], "-og")) ||
335 (!strcmp(argv[i], "-out-geometry")) ||
336 (!strcmp(argv[i], "--out-geometry"))) && (i < (argc - 1)))
337 {
338 int n;
339 char buf[16], buf2[16];
340
341 n = sscanf(argv[i +1], "%10[^x]x%10s", buf, buf2);
342 if (n == 2)
343 {
344 outw = atoi(buf);
345 outh = atoi(buf2);
346 }
347 i++;
348 }
349 else if (!file)
350 {
351 file = argv[i];
352 }
353 else if (!group)
354 {
355 group = argv[i];
356 }
357 else if (!outfile)
358 {
359 outfile = argv[i];
360 }
361 }
362 if ((!file) || (!group) || (!outfile))
363 {
364 help_show();
365 exit(-1);
366 }
367}
368
369static void
370help_show(void)
371{
372 printf("Usage: edje_thumb INPUT_EDJE GROUP_TO_LOAD OUT_FILE [OPTIONS]\n"
373 "\n"
374 "Where required parameters are:\n"
375 " INPUT_EDJE the edje file to look at\n"
376 " GROUP_TO_LOAD the group name in the edge\n"
377 " OUT_FILE the output file or format\n"
378 "\n"
379 "Where optional OPTIONS are:\n"
380 " -h this help\n" " -g WxH rendering geometry\n"
381 " -og WxH output file geometry\n"
382 );
383}
384
385static int
386signal_exit(void *data, int ev_type, void *ev)
387{
388 ecore_main_loop_quit();
389 return 1;
390}
391
392static int
393thumb_grab(void *data)
394{
395 char buf[4096];
396
397 snprintf(buf, sizeof(buf), outfile);
398 ecore_evas_buffer_pixels_get(ee);
399 if (!evas_object_image_save(im, buf, NULL, "quality=100 compress=9"))
400 {
401 fprintf(stderr, "Error. cannot load file \"%s\". Missing saver module for Evas or literally cannot write the file (permissions or directory doesnt exist).\n", buf);
402 exit(-1);
403 }
404 ecore_main_loop_quit();
405 return 0;
406}
diff --git a/src/bin/main.h b/src/bin/main.h
new file mode 100644
index 0000000..99fd087
--- /dev/null
+++ b/src/bin/main.h
@@ -0,0 +1,31 @@
1#include "config.h"
2
3#include <stdio.h>
4#include <string.h>
5#include <Evas.h>
6#include <Ecore.h>
7#include <Ecore_Evas.h>
8#include <Edje.h>
9
10#ifdef EAPI
11#undef EAPI
12#endif
13#ifdef WIN32
14# ifdef BUILDING_DLL
15# define EAPI __declspec(dllexport)
16# else
17# define EAPI __declspec(dllimport)
18# endif
19#else
20# ifdef __GNUC__
21# if __GNUC__ >= 4
22// BROKEN in gcc 4 on amd64
23//# pragma GCC visibility push(hidden)
24# define EAPI __attribute__ ((visibility("default")))
25# else
26# define EAPI
27# endif
28# else
29# define EAPI
30# endif
31#endif