Compare commits
57 Commits
master
...
devs/devil
Author | SHA1 | Date |
---|---|---|
Chris Michael | a335b89f20 | |
Chris Michael | 7af99adfca | |
Chris Michael | 93624016d0 | |
Chris Michael | d1502a554f | |
Chris Michael | 8a618e9002 | |
Chris Michael | b6c73c8ee7 | |
Chris Michael | d481103e7d | |
Chris Michael | d105c5192a | |
Chris Michael | 8a862b04d5 | |
Chris Michael | 6ce4e68320 | |
Chris Michael | 42cb0c59ce | |
Chris Michael | c01a55a670 | |
Chris Michael | b35dffc768 | |
Chris Michael | 4e312f0215 | |
Chris Michael | e15332a589 | |
Chris Michael | 5ddf31e9b9 | |
Chris Michael | 4d5f3c222a | |
Chris Michael | 2555cbe5fa | |
Chris Michael | 851f255a13 | |
Chris Michael | 5e40171eac | |
Chris Michael | 9aa01ff4af | |
Chris Michael | 35f902ef5b | |
Chris Michael | f92d2f3a7d | |
Chris Michael | efbd02ec37 | |
Chris Michael | dc4846278c | |
Chris Michael | 3096dcb8c6 | |
Chris Michael | 4be2c0ba81 | |
Chris Michael | b15bc09649 | |
Chris Michael | f8f00e0b80 | |
Chris Michael | 6b7633ce67 | |
Chris Michael | b33d1a9f30 | |
Chris Michael | 1234788372 | |
Chris Michael | 7066f580f6 | |
Chris Michael | 669030eea9 | |
Chris Michael | 6b1be537bd | |
Chris Michael | 46302e1816 | |
Chris Michael | c73ea574cc | |
Chris Michael | a46f86f8a7 | |
Chris Michael | d3bd7bd09d | |
Chris Michael | 226de1beb7 | |
Chris Michael | a0428ab391 | |
Chris Michael | bc4f01387b | |
Chris Michael | 6f5e628ac6 | |
Chris Michael | d6da02c9b4 | |
Chris Michael | e63dccbd9f | |
Chris Michael | a73b810fdb | |
Chris Michael | c5707714bf | |
Chris Michael | d824954b29 | |
Chris Michael | 47f6465aa4 | |
Chris Michael | 0aaa054c8b | |
Chris Michael | 66b7c1fa42 | |
Chris Michael | 29e3c126ac | |
Chris Michael | 799d7d76af | |
Chris Michael | d103275506 | |
Chris Michael | 839b24e51a | |
Chris Michael | 43c0f987da | |
Chris Michael | 6eb8fca8ae |
43
autogen.sh
|
@ -2,23 +2,38 @@
|
|||
|
||||
test -n "$srcdir" || srcdir=`dirname "$0"`
|
||||
test -n "$srcdir" || srcdir=.
|
||||
(
|
||||
cd "$srcdir" &&
|
||||
(
|
||||
cd "$srcdir" &&
|
||||
(
|
||||
rm -rf autom4te.cache
|
||||
rm -f aclocal.m4 ltmain.sh
|
||||
touch README
|
||||
touch ABOUT-NLS
|
||||
rm -rf autom4te.cache
|
||||
rm -f aclocal.m4 ltmain.sh
|
||||
|
||||
echo "Running autopoint..." ; autopoint -f || :
|
||||
echo "Running aclocal..." ; aclocal -I m4 $ACLOCAL_FLAGS || exit 1
|
||||
echo "Running autoconf..." ; autoconf || exit 1
|
||||
echo "Running autoheader..." ; autoheader || exit 1
|
||||
echo "Running libtoolize..." ; (libtoolize --copy --automake || glibtoolize --automake) || exit 1
|
||||
echo "Running automake..." ; automake --add-missing --copy --gnu || exit 1
|
||||
)
|
||||
autoreconf -vif
|
||||
)
|
||||
|
||||
W=0
|
||||
|
||||
rm -f config.cache-env.tmp
|
||||
echo "OLD_PARM=\"$@\"" >> config.cache-env.tmp
|
||||
echo "OLD_CFLAGS=\"$CFLAGS\"" >> config.cache-env.tmp
|
||||
echo "OLD_PATH=\"$PATH\"" >> config.cache-env.tmp
|
||||
echo "OLD_PKG_CONFIG_PATH=\"$PKG_CONFIG_PATH\"" >> config.cache-env.tmp
|
||||
echo "OLD_LDFLAGS=\"$LDFLAGS\"" >> config.cache-env.tmp
|
||||
|
||||
cmp config.cache-env.tmp config.cache-env >> /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
W=1;
|
||||
fi
|
||||
|
||||
if [ $W -ne 0 ]; then
|
||||
echo "Cleaning configure cache...";
|
||||
rm -f config.cache config.cache-env
|
||||
mv config.cache-env.tmp config.cache-env
|
||||
else
|
||||
rm -f config.cache-env.tmp
|
||||
fi
|
||||
)
|
||||
|
||||
if [ -z "$NOCONFIGURE" ]; then
|
||||
$srcdir/configure "$@"
|
||||
exec $srcdir/configure -C "$@"
|
||||
fi
|
||||
|
|
38
configure.ac
|
@ -1,7 +1,7 @@
|
|||
|
||||
m4_define([v_maj], [0])
|
||||
m4_define([v_min], [0])
|
||||
m4_define([v_mic], [2])
|
||||
m4_define([v_mic], [1])
|
||||
m4_define([v_ver], [v_maj.v_min.v_mic])
|
||||
|
||||
m4_define([lt_cur], [m4_eval(v_maj + v_min)])
|
||||
|
@ -74,53 +74,38 @@ fi
|
|||
|
||||
AM_CONDITIONAL([HAVE_PO], [test "x${have_po}" = "xyes"])
|
||||
|
||||
AC_PROG_CC
|
||||
|
||||
PKG_PROG_PKG_CONFIG
|
||||
if test "x${PKG_CONFIG}" = "x" ; then
|
||||
AC_MSG_ERROR([pkg-config tool not found. Install it or set PKG_CONFIG environment variable to that path tool. Exiting...])
|
||||
fi
|
||||
|
||||
EFL_WITH_BIN([edje], [edje-cc], [edje_cc])
|
||||
### EFL_WITH_BIN([eolian], [eolian-gen])
|
||||
|
||||
### Checks for libraries
|
||||
|
||||
efl_version="1.12.0"
|
||||
efl_version="1.19.99"
|
||||
|
||||
if test "x${have_win32}" = "xyes" ; then
|
||||
requirements_libexpress_pc="evil >= ${efl_version}"
|
||||
fi
|
||||
|
||||
requirements_libexpress_pc="ecore-con >= ${efl_version} ecore >= ${efl_version} eina >= ${efl_version} ${requirements_libexpress_pc}"
|
||||
requirements_libexpress_pc="eo >= ${efl_version} efl >= ${efl_version} eina >= ${efl_version} ecore >= ${efl_version} ecore-con >= ${efl_version} ${requirements_libexpress_pc}"
|
||||
AC_SUBST([requirements_libexpress_pc])
|
||||
|
||||
PKG_CHECK_MODULES([LIBEXPRESS], [${requirements_libexpress_pc}])
|
||||
|
||||
PKG_CHECK_MODULES([ELDBUS], [eldbus],
|
||||
[
|
||||
AC_DEFINE(HAVE_ELDBUS, 1, [DBUS support])
|
||||
have_eldbus="yes"
|
||||
],
|
||||
[have_eldbus="no"]
|
||||
)
|
||||
|
||||
PKG_CHECK_MODULES([EXPRESS],
|
||||
[eina]
|
||||
[eet]
|
||||
[${requirements_libexpress_pc}]
|
||||
[evas]
|
||||
[edje]
|
||||
[efreet]
|
||||
[ecore-file]
|
||||
[elementary]
|
||||
)
|
||||
|
||||
requirements_libexpress_libs=""
|
||||
AC_SUBST([requirements_libexpress_libs])
|
||||
|
||||
if test "x${have_win32}" = "xyes" ; then
|
||||
requirements_libexpress_libs="-lws2_32 ${requirements_libexpress_libs}"
|
||||
fi
|
||||
|
||||
LIBEXPRESS_LIBS="${LIBEXPRESS_LIBS} ${requirements_libexpress_libs}"
|
||||
|
||||
|
||||
|
@ -128,9 +113,6 @@ LIBEXPRESS_LIBS="${LIBEXPRESS_LIBS} ${requirements_libexpress_libs}"
|
|||
|
||||
AC_HEADER_TIME
|
||||
|
||||
AC_CHECK_HEADERS([sys/socket.h netinet/in.h arpa/inet.h])
|
||||
|
||||
|
||||
### Checks for types
|
||||
|
||||
|
||||
|
@ -139,6 +121,10 @@ AC_CHECK_HEADERS([sys/socket.h netinet/in.h arpa/inet.h])
|
|||
|
||||
### Checks for compiler characteristics
|
||||
|
||||
AC_C_BIGENDIAN
|
||||
AC_C_INLINE
|
||||
|
||||
AC_PROG_CC
|
||||
AM_PROG_CC_C_O
|
||||
|
||||
EFL_ATTRIBUTE_VECTOR
|
||||
|
@ -149,7 +135,7 @@ EFL_CHECK_THREADS
|
|||
EFL_ENABLE_EO_API_SUPPORT
|
||||
EFL_ENABLE_BETA_API_SUPPORT
|
||||
|
||||
EFL_CHECK_COMPILER_FLAGS([EXP], [-Wall -Wextra -Wshadow -Wpointer-arith -fdata-sections -ffunction-sections])
|
||||
EFL_CHECK_COMPILER_FLAGS([EXP], [-Wall -Wextra -Wpointer-arith -Wno-missing-field-initializers -fvisibility=hidden -fdata-sections -ffunction-sections])
|
||||
|
||||
LIBEXPRESS_CFLAGS="${LIBEXPRESS_CFLAGS} ${EXP_CFLAGS}"
|
||||
EXPRESS_CFLAGS="${EXPRESS_CFLAGS} ${EXP_CFLAGS}"
|
||||
|
@ -167,7 +153,7 @@ EXPRESS_LIBS="${EXPRESS_LIBS} ${EXP_LIBS}"
|
|||
|
||||
AC_FUNC_ALLOCA
|
||||
|
||||
AC_CHECK_FUNCS([getuid geteuid mkstemps])
|
||||
### AC_CHECK_FUNCS([getuid geteuid mkstemps])
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
|
@ -180,8 +166,6 @@ data/desktop/Makefile
|
|||
data/fonts/Makefile
|
||||
data/images/Makefile
|
||||
data/themes/Makefile
|
||||
data/themes/images/Makefile
|
||||
data/themes/sounds/Makefile
|
||||
po/Makefile.in
|
||||
])
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
SUBDIRS = images sounds
|
||||
|
||||
EDJE_CC = @edje_cc@
|
||||
EDJE_FLAGS_VERBOSE_ =
|
||||
EDJE_FLAGS_VERBOSE_0 =
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
EXTRA_DIST = \
|
||||
bg_bevel.png \
|
||||
bg_shine.png \
|
||||
bg_glint.png \
|
||||
bg_glow_in.png \
|
||||
bg_led.png \
|
||||
bg_led_base.png \
|
||||
bg_led_glow.png \
|
||||
bg_led_strobe.png \
|
||||
bg_shadow.png \
|
||||
bg_shadow2.png \
|
||||
bg_shadow3.png \
|
||||
cr_glow.png \
|
||||
cr_key.png \
|
||||
cr_out.png \
|
||||
cr_pulse.png \
|
||||
fn_shadow.png \
|
||||
pm_fill.png \
|
||||
pm_overlay.png \
|
||||
pm_shadow.png \
|
||||
inset_shadow.png \
|
||||
icon_settings.png \
|
||||
lk_bottom.png \
|
||||
lk_left.png \
|
||||
lk_right.png \
|
||||
tab_base_bottom.png \
|
||||
tab_base_l0.png \
|
||||
tab_base_l1.png \
|
||||
tab_base_m.png \
|
||||
tab_base_r0.png \
|
||||
tab_base_r1.png \
|
||||
tab_bg_l0.png \
|
||||
tab_bg_l1.png \
|
||||
tab_bg_r0.png \
|
||||
tab_bg_r1.png \
|
||||
tab_other_l.png \
|
||||
tab_other_m.png \
|
||||
tab_other_r.png \
|
||||
tab_shad_l0.png \
|
||||
tab_shad_l1.png \
|
||||
tab_shad_l2.png \
|
||||
tab_shad_r0.png \
|
||||
tab_shad_r1.png \
|
||||
tab_shad_r2.png \
|
||||
media_bg.png \
|
||||
media_play.png \
|
||||
media_stop.png \
|
||||
media_pause.png \
|
||||
media_line.png \
|
||||
media_knob_vol.png \
|
||||
media_knob_pos.png
|
Before Width: | Height: | Size: 255 B |
Before Width: | Height: | Size: 343 B |
Before Width: | Height: | Size: 580 B |
Before Width: | Height: | Size: 1010 B |
Before Width: | Height: | Size: 529 B |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 160 KiB |
Before Width: | Height: | Size: 1.5 MiB |
Before Width: | Height: | Size: 392 KiB |
Before Width: | Height: | Size: 99 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 449 B |
Before Width: | Height: | Size: 463 B |
Before Width: | Height: | Size: 189 B |
Before Width: | Height: | Size: 474 B |
Before Width: | Height: | Size: 333 B |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 231 B |
Before Width: | Height: | Size: 257 B |
Before Width: | Height: | Size: 364 B |
Before Width: | Height: | Size: 338 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 721 B |
Before Width: | Height: | Size: 946 B |
Before Width: | Height: | Size: 660 B |
Before Width: | Height: | Size: 693 B |
Before Width: | Height: | Size: 471 B |
Before Width: | Height: | Size: 250 B |
Before Width: | Height: | Size: 293 B |
Before Width: | Height: | Size: 243 B |
Before Width: | Height: | Size: 254 B |
Before Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 137 B |
Before Width: | Height: | Size: 126 B |
Before Width: | Height: | Size: 169 B |
Before Width: | Height: | Size: 120 B |
Before Width: | Height: | Size: 85 B |
Before Width: | Height: | Size: 168 B |
Before Width: | Height: | Size: 415 B |
Before Width: | Height: | Size: 410 B |
Before Width: | Height: | Size: 414 B |
Before Width: | Height: | Size: 402 B |
Before Width: | Height: | Size: 287 B |
Before Width: | Height: | Size: 671 B |
Before Width: | Height: | Size: 301 B |
Before Width: | Height: | Size: 107 B |
Before Width: | Height: | Size: 263 B |
Before Width: | Height: | Size: 262 B |
Before Width: | Height: | Size: 107 B |
Before Width: | Height: | Size: 278 B |
Before Width: | Height: | Size: 274 B |
|
@ -1,8 +0,0 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
EXTRA_DIST = \
|
||||
bell.wav \
|
||||
kbd-tap2.wav \
|
||||
kbd-tap3.wav \
|
||||
kbd-tap4.wav \
|
||||
kbd-tap5.wav \
|
||||
kbd-tap.wav
|
|
@ -1,2 +0,0 @@
|
|||
src/bin/main.c
|
||||
src/bin/window.c
|
|
@ -14,65 +14,15 @@ express_CPPFLAGS = \
|
|||
@EXPRESS_CFLAGS@
|
||||
|
||||
EXPRESSHEADERS = \
|
||||
private.h \
|
||||
config.h \
|
||||
theme.h \
|
||||
colors.h \
|
||||
utils.h \
|
||||
dbus.h \
|
||||
window.h \
|
||||
channel.h \
|
||||
lz4/lz4.h \
|
||||
grid.h \
|
||||
grid_save.h \
|
||||
selector.h \
|
||||
callbacks.h \
|
||||
options.h \
|
||||
options_general.h \
|
||||
options_font.h \
|
||||
options_colors.h \
|
||||
options_video.h \
|
||||
options_networks.h \
|
||||
options_network.h \
|
||||
options_servers.h \
|
||||
options_channels.h \
|
||||
options_tools.h \
|
||||
gravatar.h \
|
||||
md5/md5.h \
|
||||
media.h \
|
||||
commands.h
|
||||
private.h
|
||||
|
||||
express_SOURCES = \
|
||||
$(EXPRESSHEADERS) \
|
||||
config.c \
|
||||
main.c \
|
||||
theme.c \
|
||||
colors.c \
|
||||
utils.c \
|
||||
dbus.c \
|
||||
window.c \
|
||||
channel.c \
|
||||
lz4/lz4.c \
|
||||
grid.c \
|
||||
grid_save.c \
|
||||
selector.c \
|
||||
callbacks.c \
|
||||
options.c \
|
||||
options_general.c \
|
||||
options_font.c \
|
||||
options_colors.c \
|
||||
options_video.c \
|
||||
options_networks.c \
|
||||
options_network.c \
|
||||
options_servers.c \
|
||||
options_channels.c \
|
||||
options_tools.c \
|
||||
gravatar.c \
|
||||
md5/md5.c \
|
||||
media.c \
|
||||
commands.c
|
||||
$(EXPRESSHEADERS) \
|
||||
config.c \
|
||||
win.c \
|
||||
main.c
|
||||
|
||||
express_LDADD = \
|
||||
$(top_builddir)/src/lib/libexpress.la \
|
||||
@EXPRESS_LIBS@ \
|
||||
@LTLIBINTL@
|
||||
$(top_builddir)/src/lib/libexpress.la \
|
||||
@EXPRESS_LIBS@ \
|
||||
@LTLIBINTL@
|
||||
|
|
|
@ -1,398 +0,0 @@
|
|||
#include "private.h"
|
||||
#include "callbacks.h"
|
||||
#include "window.h"
|
||||
#include "channel.h"
|
||||
#include <time.h>
|
||||
|
||||
#define COLOR_SYSTEM 76
|
||||
#define COLOR_TEXT 65
|
||||
#define COLOR_SERVER_NOTICE 14
|
||||
#define COLOR_CHANNEL_NOTICE 18
|
||||
#define COLOR_TOPIC 16
|
||||
#define COLOR_PART 74
|
||||
#define COLOR_JOIN 75
|
||||
#define COLOR_NICK_CHANGE 78
|
||||
|
||||
static int
|
||||
_find_crlf(const char *data, int length, int *lf)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
*lf = 0;
|
||||
for (; i < length; i++)
|
||||
{
|
||||
/* find crlf (\r\n) */
|
||||
if ((data[i] == 0x0D) &&
|
||||
(i < (length - 1)) && (data[i + 1] == 0x0A))
|
||||
{
|
||||
*lf = 2;
|
||||
return i;
|
||||
}
|
||||
|
||||
/* find just lf */
|
||||
if (data[i] == 0x0A)
|
||||
{
|
||||
*lf = 1;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
_callback_server_connected(Express_Network *net, const char *event EINA_UNUSED, const char *source, const char **params EINA_UNUSED, unsigned int count EINA_UNUSED, void *data EINA_UNUSED)
|
||||
{
|
||||
DBG("Server %s Connected", source);
|
||||
_window_network_channels_create(net);
|
||||
}
|
||||
|
||||
void
|
||||
_callback_server_motd(Express_Network *net EINA_UNUSED, const char *event EINA_UNUSED, const char *source EINA_UNUSED, const char **params, unsigned int count, void *data EINA_UNUSED)
|
||||
{
|
||||
Channel *chl;
|
||||
unsigned int i = 0;
|
||||
|
||||
/* DBG("Server Motd"); */
|
||||
/* DBG("\tServer: %s", source); */
|
||||
/* DBG("\tCount: %d", count); */
|
||||
/* DBG("\tUser: %s", params[0]); */
|
||||
/* DBG("\tMessage:"); */
|
||||
/* DBG("\t%s", params[1]); */
|
||||
|
||||
if (!(chl = _window_channel_find("Status"))) return;
|
||||
for (i = 1; i < count; i++)
|
||||
_channel_text_append(chl, NULL, params[i],
|
||||
_row_color_simple_create(COLOR_SYSTEM));
|
||||
}
|
||||
|
||||
void
|
||||
_callback_server_error(Express_Network *net EINA_UNUSED, const char *event EINA_UNUSED, const char *source EINA_UNUSED, const char **params, unsigned int count EINA_UNUSED, void *data EINA_UNUSED)
|
||||
{
|
||||
if (!strncasecmp(params[0], "Closing Link", 12))
|
||||
express_network_disconnect(net);
|
||||
}
|
||||
|
||||
void
|
||||
_callback_server_notice(Express_Network *net EINA_UNUSED, const char *event EINA_UNUSED, const char *source EINA_UNUSED, const char **params, unsigned int count EINA_UNUSED, void *data EINA_UNUSED)
|
||||
{
|
||||
Channel *chl;
|
||||
|
||||
/* DBG("Server Notice"); */
|
||||
/* DBG("\tServer: %s", source); */
|
||||
/* DBG("\tCount: %d", count); */
|
||||
/* DBG("\tUser: %s", params[0]); */
|
||||
/* DBG("\tMessage:"); */
|
||||
/* DBG("\t%s", params[1]); */
|
||||
|
||||
if (!(chl = _window_channel_active_get())) return;
|
||||
_channel_text_append(chl, NULL, params[1],
|
||||
_row_color_simple_create(COLOR_SERVER_NOTICE));
|
||||
}
|
||||
|
||||
void
|
||||
_callback_channel_message(Express_Network *net EINA_UNUSED, const char *event EINA_UNUSED, const char *source, const char **params, unsigned int count EINA_UNUSED, void *data EINA_UNUSED)
|
||||
{
|
||||
Channel *chl = NULL;
|
||||
|
||||
/* DBG("Channel Message: %s", params[0]); */
|
||||
/* DBG("\tCount: %d", count); */
|
||||
/* DBG("\tUser: %s", source); */
|
||||
/* DBG("\tMessage:"); */
|
||||
/* DBG("\t%s", params[1]); */
|
||||
|
||||
if (!(chl = _window_channel_find(params[0]))) return;
|
||||
_channel_text_append(chl, source, params[1],
|
||||
_row_color_simple_create(COLOR_TEXT));
|
||||
}
|
||||
|
||||
void
|
||||
_callback_channel_notice(Express_Network *net EINA_UNUSED, const char *event EINA_UNUSED, const char *source, const char **params, unsigned int count EINA_UNUSED, void *data EINA_UNUSED)
|
||||
{
|
||||
Channel *chl = NULL;
|
||||
|
||||
/* DBG("Channel Notice: %s", params[0]); */
|
||||
/* DBG("\tCount: %d", count); */
|
||||
/* DBG("\tServer: %s", source); */
|
||||
/* DBG("\tMessage:"); */
|
||||
/* DBG("\t%s", params[1]); */
|
||||
|
||||
if (!strcmp(params[0], "*"))
|
||||
{
|
||||
if (!(chl = _window_channel_find("Status")))
|
||||
{
|
||||
ERR("Could not find channel with server name: %s", source);
|
||||
if (!(chl = _window_channel_find("Status")))
|
||||
chl = _window_channel_active_get();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(chl = _window_channel_find(params[0])))
|
||||
chl = _window_channel_active_get();
|
||||
}
|
||||
|
||||
if (!chl) return;
|
||||
_channel_text_append(chl, NULL, params[1],
|
||||
_row_color_simple_create(COLOR_CHANNEL_NOTICE));
|
||||
}
|
||||
|
||||
void
|
||||
_callback_channel_topic(Express_Network *net EINA_UNUSED, const char *event EINA_UNUSED, const char *source EINA_UNUSED, const char **params, unsigned int count EINA_UNUSED, void *data EINA_UNUSED)
|
||||
{
|
||||
Channel *chl = NULL;
|
||||
char buff[PATH_MAX];
|
||||
|
||||
/* DBG("Channel Topic: %s", params[0]); */
|
||||
/* DBG("\tCount: %d", count); */
|
||||
/* DBG("\tUser: %s", source); */
|
||||
/* DBG("\tMessage:"); */
|
||||
/* DBG("\t%s", params[1]); */
|
||||
/* DBG("\t%s", params[2]); */
|
||||
|
||||
if (!(chl = _window_channel_find(params[1]))) return;
|
||||
snprintf(buff, sizeof(buff), "Topic for %s is: ", params[1]);
|
||||
_channel_text_append(chl, NULL, buff,
|
||||
_row_color_simple_create(COLOR_TOPIC));
|
||||
_channel_text_append(chl, NULL, params[2],
|
||||
_row_color_simple_create(COLOR_TOPIC));
|
||||
}
|
||||
|
||||
void
|
||||
_callback_channel_topic_time(Express_Network *net EINA_UNUSED, const char *event EINA_UNUSED, const char *source EINA_UNUSED, const char **params, unsigned int count EINA_UNUSED, void *data EINA_UNUSED)
|
||||
{
|
||||
Channel *chl = NULL;
|
||||
char buff[PATH_MAX], *strtime;
|
||||
time_t stamp;
|
||||
|
||||
/* DBG("Channel Topic Time: %s", params[0]); */
|
||||
/* DBG("\tCount: %d", count); */
|
||||
/* DBG("\tUser: %s", source); */
|
||||
/* DBG("\tMessage:"); */
|
||||
/* DBG("\t%s", params[1]); */
|
||||
/* DBG("\t%s", params[2]); */
|
||||
/* DBG("\t%s", params[3]); */
|
||||
|
||||
stamp = atol(params[3]);
|
||||
strtime = ctime(&stamp);
|
||||
strtime[24] = 0;
|
||||
|
||||
if (!(chl = _window_channel_find(params[1]))) return;
|
||||
snprintf(buff, sizeof(buff), "Topic for %s set by %s at %s\r\n",
|
||||
params[1], params[2], strtime);
|
||||
_channel_text_append(chl, NULL, buff,
|
||||
_row_color_simple_create(COLOR_TOPIC));
|
||||
}
|
||||
|
||||
void
|
||||
_callback_channel_names(Express_Network *net EINA_UNUSED, const char *event EINA_UNUSED, const char *source EINA_UNUSED, const char **params, unsigned int count EINA_UNUSED, void *data EINA_UNUSED)
|
||||
{
|
||||
Channel *chl = NULL;
|
||||
char **users;
|
||||
unsigned int n = 0, i = 0;
|
||||
int crlf = 0, lf = 0;
|
||||
|
||||
/* DBG("Channel Names: %s", params[0]); */
|
||||
/* DBG("\tCount: %d", count); */
|
||||
/* DBG("\tUser: %s", source); */
|
||||
/* DBG("\tMessage:"); */
|
||||
/* DBG("\t%s", params[1]); */
|
||||
/* DBG("\t%s", params[2]); */
|
||||
/* DBG("\t%s", params[3]); */
|
||||
|
||||
if (!(chl = _window_channel_find(params[2]))) return;
|
||||
|
||||
if (strlen(params[3]) > 0)
|
||||
_channel_userlist_show(chl);
|
||||
else
|
||||
_channel_userlist_hide(chl);
|
||||
|
||||
users = eina_str_split_full(params[3], " ", -1, &n);
|
||||
for (; i < n; i++)
|
||||
{
|
||||
char buff[PATH_MAX];
|
||||
|
||||
crlf = _find_crlf(users[i], strlen(users[i]), &lf);
|
||||
if (crlf > 0)
|
||||
eina_strlcpy(buff, users[i], crlf + lf);
|
||||
else
|
||||
eina_strlcpy(buff, users[i], strlen(users[i]) + 1);
|
||||
|
||||
if (buff[0] == '@')
|
||||
_channel_userlist_user_append(chl, buff + 1, EINA_TRUE);
|
||||
else
|
||||
_channel_userlist_user_append(chl, buff, EINA_FALSE);
|
||||
}
|
||||
|
||||
_channel_userlist_go(chl);
|
||||
|
||||
free(users);
|
||||
}
|
||||
|
||||
void
|
||||
_callback_command(Express_Network *net EINA_UNUSED, const char *event, const char *source EINA_UNUSED, const char **params, unsigned int count, void *data EINA_UNUSED)
|
||||
{
|
||||
Channel *chl = NULL;
|
||||
char buff[PATH_MAX];
|
||||
unsigned int i;
|
||||
|
||||
if (!(chl = _window_channel_active_get())) return;
|
||||
|
||||
if (!strncmp(event, "AWAY", 4))
|
||||
{
|
||||
snprintf(buff, sizeof(buff), "%s", params[1]);
|
||||
_channel_text_append(chl, NULL, params[1],
|
||||
_row_color_simple_create(COLOR_TEXT));
|
||||
}
|
||||
else if (!strncmp(event, "HELP", 4))
|
||||
{
|
||||
for (i = 2; i < count; i++)
|
||||
_channel_text_append(chl, NULL, params[i],
|
||||
_row_color_simple_create(COLOR_SYSTEM));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_callback_user_quit(Express_Network *net EINA_UNUSED, const char *event EINA_UNUSED, const char *source, const char **params, unsigned int count EINA_UNUSED, void *data EINA_UNUSED)
|
||||
{
|
||||
Eina_List *channels, *l;
|
||||
Channel *chl;
|
||||
char buff[PATH_MAX];
|
||||
|
||||
/* DBG("User Quit"); */
|
||||
/* DBG("\tCount: %d", count); */
|
||||
/* DBG("\tUser: %s", source); */
|
||||
/* DBG("\tMessage:"); */
|
||||
/* DBG("\t%s", params[0]); */
|
||||
|
||||
snprintf(buff, sizeof(buff), "%s has %s", source, params[0]);
|
||||
|
||||
channels = _window_channels_user_find(source);
|
||||
EINA_LIST_FOREACH(channels, l, chl)
|
||||
_channel_text_append(chl, "*", buff,
|
||||
_row_color_simple_create(COLOR_PART));
|
||||
}
|
||||
|
||||
void
|
||||
_callback_user_part(Express_Network *net EINA_UNUSED, const char *event EINA_UNUSED, const char *source, const char **params, unsigned int count EINA_UNUSED, void *data EINA_UNUSED)
|
||||
{
|
||||
Channel *chl = NULL;
|
||||
char buff[PATH_MAX];
|
||||
|
||||
/* DBG("User Part %s", params[0]); */
|
||||
/* DBG("\tCount: %d", count); */
|
||||
/* DBG("\tUser: %s", source); */
|
||||
/* DBG("\tMessage:"); */
|
||||
/* DBG("\t%s", params[1]); */
|
||||
|
||||
if (!(chl = _window_channel_find(params[0]))) return;
|
||||
|
||||
snprintf(buff, sizeof(buff), "%s has left %s: %s",
|
||||
source, params[0], params[1]);
|
||||
_channel_text_append(chl, NULL, buff, _row_color_simple_create(COLOR_PART));
|
||||
}
|
||||
|
||||
void
|
||||
_callback_user_join(Express_Network *net, const char *event EINA_UNUSED, const char *source, const char **params, unsigned int count EINA_UNUSED, void *data EINA_UNUSED)
|
||||
{
|
||||
Channel *chl = NULL;
|
||||
char buff[PATH_MAX], channel[PATH_MAX];
|
||||
int crlf = 0, lf = 0;
|
||||
|
||||
crlf = _find_crlf(params[0], strlen(params[0]), &lf);
|
||||
if (crlf > 0)
|
||||
eina_strlcpy(channel, params[0], crlf + lf - 1);
|
||||
else
|
||||
eina_strlcpy(channel, params[0], strlen(params[0]) + 1);
|
||||
|
||||
/* DBG("User Join %s", channel); */
|
||||
/* DBG("\tCount: %d", count); */
|
||||
/* DBG("\tUser: %s", source); */
|
||||
/* DBG("\tMessage:"); */
|
||||
/* DBG("\t%s", params[1]); */
|
||||
|
||||
/* find the channel */
|
||||
if (!(chl = _window_channel_find(channel)))
|
||||
{
|
||||
Express_Server *srv;
|
||||
|
||||
if ((srv = express_network_server_connected_get(net)))
|
||||
{
|
||||
const char *srv_name = NULL;
|
||||
|
||||
srv_name = express_network_server_realname_get(srv);
|
||||
chl = _window_channel_create(net, channel, srv_name);
|
||||
if (!chl) return;
|
||||
}
|
||||
}
|
||||
|
||||
/* skip user join messages for our own nick */
|
||||
if (!strcmp(source, express_network_nickname_get(net)))
|
||||
snprintf(buff, sizeof(buff), "Now talking on %s\r\n", channel);
|
||||
else
|
||||
snprintf(buff, sizeof(buff), "%s has joined %s\r\n", source, channel);
|
||||
|
||||
_channel_text_append(chl, "*", buff, _row_color_simple_create(COLOR_JOIN));
|
||||
}
|
||||
|
||||
void
|
||||
_callback_user_private(Express_Network *net, const char *event EINA_UNUSED, const char *source, const char **params, unsigned int count EINA_UNUSED, void *data EINA_UNUSED)
|
||||
{
|
||||
Channel * chl = NULL;
|
||||
|
||||
/* DBG("User Private %s", params[0]); */
|
||||
/* DBG("\tCount: %d", count); */
|
||||
/* DBG("\tUser: %s", source); */
|
||||
/* DBG("\tMessage:"); */
|
||||
/* DBG("\t%s", params[1]); // message */
|
||||
/* DBG("\t%s", params[2]); */
|
||||
/* DBG("\t%s", params[3]); */
|
||||
|
||||
if (!(chl = _window_channel_find(source)))
|
||||
{
|
||||
Express_Server *srv;
|
||||
|
||||
if ((srv = express_network_server_connected_get(net)))
|
||||
{
|
||||
const char *srv_name = NULL;
|
||||
|
||||
srv_name = express_network_server_realname_get(srv);
|
||||
chl = _window_channel_create(net, source, srv_name);
|
||||
if (!chl) return;
|
||||
}
|
||||
}
|
||||
|
||||
_channel_text_append(chl, source, params[1],
|
||||
_row_color_simple_create(COLOR_TEXT));
|
||||
}
|
||||
|
||||
void
|
||||
_callback_user_nick(Express_Network *net EINA_UNUSED, const char *event EINA_UNUSED, const char *source, const char **params, unsigned int count EINA_UNUSED, void *data EINA_UNUSED)
|
||||
{
|
||||
Eina_List *channels, *l;
|
||||
Channel *chl;
|
||||
char buff[PATH_MAX], user[PATH_MAX];
|
||||
int crlf = 0, lf = 0;
|
||||
|
||||
crlf = _find_crlf(params[0], strlen(params[0]), &lf);
|
||||
if (crlf > 0)
|
||||
eina_strlcpy(user, params[0], crlf + lf - 1);
|
||||
else
|
||||
eina_strlcpy(user, params[0], strlen(params[0]) + 1);
|
||||
|
||||
/* DBG("User Changed Nick %s", user); */
|
||||
/* DBG("\tCount: %d", count); */
|
||||
/* DBG("\tUser: %s", source); */
|
||||
/* DBG("\tMessage:"); */
|
||||
/* DBG("\t%s", params[1]); */
|
||||
/* DBG("\t%s", params[2]); */
|
||||
/* DBG("\t%s", params[3]); */
|
||||
|
||||
snprintf(buff, sizeof(buff), "%s is now known as %s\r\n", source, user);
|
||||
|
||||
/* find all channels that this user is in */
|
||||
channels = _window_channels_user_find(source);
|
||||
EINA_LIST_FOREACH(channels, l, chl)
|
||||
_channel_text_append(chl, "*", buff,
|
||||
_row_color_simple_create(COLOR_NICK_CHANGE));
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
#ifndef _CALLBACKS_H_
|
||||
# define _CALLBACKS_H_ 1
|
||||
|
||||
void _callback_server_connected(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data);
|
||||
void _callback_server_motd(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data);
|
||||
void _callback_server_notice(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data);
|
||||
void _callback_server_error(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data);
|
||||
|
||||
void _callback_channel_message(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data);
|
||||
void _callback_channel_notice(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data);
|
||||
void _callback_channel_topic(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data);
|
||||
void _callback_channel_topic_time(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data);
|
||||
void _callback_channel_names(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data);
|
||||
|
||||
void _callback_command(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data);
|
||||
void _callback_user_quit(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data);
|
||||
void _callback_user_part(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data);
|
||||
void _callback_user_join(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data);
|
||||
void _callback_user_private(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data);
|
||||
void _callback_user_nick(Express_Network *net, const char *event, const char *source, const char **params, unsigned int count, void *data);
|
||||
|
||||
#endif
|
1490
src/bin/channel.c
|
@ -1,73 +0,0 @@
|
|||
#ifndef _CHANNEL_H_
|
||||
# define _CHANNEL_H_ 1
|
||||
|
||||
Channel *_channel_create(Evas *evas, Evas_Object *win, const char *name, const char *server);
|
||||
void _channel_destroy(Channel *chl);
|
||||
void _channel_update(Channel *chl);
|
||||
void _channel_focused_set(Channel *chl, Eina_Bool focus);
|
||||
Eina_Bool _channel_focused_get(Channel *chl);
|
||||
void _channel_focus(Channel *chl);
|
||||
void _channel_unfocus(Channel *chl);
|
||||
|
||||
void _channel_active_set(Channel *chl, Eina_Bool active);
|
||||
Eina_Bool _channel_active_get(Channel *chl);
|
||||
|
||||
const char *_channel_name_get(Channel *chl);
|
||||
const char *_channel_server_name_get(Channel *chl);
|
||||
|
||||
void _channel_size_update(Channel *chl);
|
||||
void _channel_size_min_get(Channel *chl, int *w, int *h);
|
||||
void _channel_size_step_get(Channel *chl, int *w, int *h);
|
||||
void _channel_size_request_get(Channel *chl, int *w, int *h);
|
||||
Eina_Bool _channel_size_done_get(Channel *chl);
|
||||
void _channel_size_done_set(Channel *chl, Eina_Bool done);
|
||||
|
||||
Evas_Object *_channel_background_get(Channel *chl);
|
||||
void _channel_background_hide(Channel *chl);
|
||||
void _channel_background_show(Channel *chl);
|
||||
|
||||
Evas_Object *_channel_base_get(Channel *chl);
|
||||
void _channel_base_unswallow(Channel *chl);
|
||||
|
||||
Evas_Object *_channel_image_get(Channel *chl);
|
||||
void _channel_image_unset(Channel *chl);
|
||||
void _channel_image_create(Channel *chl);
|
||||
|
||||
Eina_Bool _channel_missed_get(Channel *chl);
|
||||
void _channel_missed_set(Channel *chl, Eina_Bool missed);
|
||||
void _channel_missed_count_set(Channel *chl, int count);
|
||||
void _channel_count_set(Channel *chl, int count, int total);
|
||||
|
||||
Eina_Bool _channel_unswallowed_get(Channel *chl);
|
||||
void _channel_unswallowed_set(Channel *chl, Eina_Bool swallowed);
|
||||
|
||||
void _channel_spacer_create(Channel *chl);
|
||||
|
||||
void _channel_text_append(Channel *chl, const char *user, const char *txt, Row_Color *color);
|
||||
|
||||
void _channel_window_set(Channel *chl, Evas_Object *win);
|
||||
void _channel_network_set(Channel *chl, Express_Network *net);
|
||||
Express_Network *_channel_network_get(Channel *chl);
|
||||
|
||||
void _channel_userlist_show(Channel *chl);
|
||||
void _channel_userlist_hide(Channel *chl);
|
||||
void _channel_userlist_user_append(Channel *chl, const char *user, Eina_Bool op);
|
||||
void _channel_userlist_go(Channel *chl);
|
||||
|
||||
void _channel_tabbar_lbox_create(Channel *chl, Evas_Object *win);
|
||||
void _channel_tabbar_rbox_create(Channel *chl, Evas_Object *win);
|
||||
void _channel_tabbar_lbox_append(Channel *chl, Evas_Object *o);
|
||||
void _channel_tabbar_rbox_append(Channel *chl, Evas_Object *o);
|
||||
void _channel_tabbar_clear(Channel *chl);
|
||||
void _channel_tabbar_update(Channel *chl);
|
||||
void _channel_tabspacer_create(Channel *chl, double v1, double v2);
|
||||
void _channel_tabspacer_destroy(Channel *chl);
|
||||
|
||||
void _channel_treeview_clear(Channel *chl);
|
||||
Elm_Object_Item *_channel_treeview_group_add(Channel *chl, const char *group);
|
||||
void _channel_treeview_group_item_add(Channel *pchl, Channel *chl, Elm_Object_Item *group);
|
||||
void _channel_treeview_item_add(Channel *pchl, Channel *chl);
|
||||
|
||||
Eina_Bool _channel_user_find(Channel *chl, const char *user);
|
||||
|
||||
#endif
|
464
src/bin/colors.c
|
@ -1,464 +0,0 @@
|
|||
#include "private.h"
|
||||
#include "colors.h"
|
||||
|
||||
static const Color colors[2][2][12] =
|
||||
{
|
||||
{ // normal
|
||||
{ // normal
|
||||
{ 0xaa, 0xaa, 0xaa, 0xff }, // COL_DEF
|
||||
{ 0x00, 0x00, 0x00, 0xff }, // COL_BLACK
|
||||
{ 0xc0, 0x00, 0x00, 0xff }, // COL_RED
|
||||
{ 0x00, 0xc0, 0x00, 0xff }, // COL_GREEN
|
||||
{ 0xc0, 0xc0, 0x00, 0xff }, // COL_YELLOW
|
||||
{ 0x00, 0x00, 0xc0, 0xff }, // COL_BLUE
|
||||
{ 0xc0, 0x00, 0xc0, 0xff }, // COL_MAGENTA
|
||||
{ 0x00, 0xc0, 0xc0, 0xff }, // COL_CYAN
|
||||
{ 0xc0, 0xc0, 0xc0, 0xff }, // COL_WHITE
|
||||
{ 0x00, 0x00, 0x00, 0x00 }, // COL_INVIS
|
||||
{ 0x22, 0x22, 0x22, 0xff }, // COL_INVERSE
|
||||
{ 0xaa, 0xaa, 0xaa, 0xff }, // COL_INVERSEBG
|
||||
},
|
||||
{ // bright/bold
|
||||
{ 0xee, 0xee, 0xee, 0xff }, // COL_DEF
|
||||
{ 0xcc, 0xcc, 0xcc, 0xff }, // COL_BLACK
|
||||
{ 0xcc, 0x88, 0x88, 0xff }, // COL_RED
|
||||
{ 0x88, 0xcc, 0x88, 0xff }, // COL_GREEN
|
||||
{ 0xcc, 0xaa, 0x88, 0xff }, // COL_YELLOW
|
||||
{ 0x88, 0x88, 0xcc, 0xff }, // COL_BLUE
|
||||
{ 0xcc, 0x88, 0xcc, 0xff }, // COL_MAGENTA
|
||||
{ 0x88, 0xcc, 0xcc, 0xff }, // COL_CYAN
|
||||
{ 0xcc, 0xcc, 0xcc, 0xff }, // COL_WHITE
|
||||
{ 0x00, 0x00, 0x00, 0x00 }, // COL_INVIS
|
||||
{ 0x11, 0x11, 0x11, 0xff }, // COL_INVERSE
|
||||
{ 0xee, 0xee, 0xee, 0xff }, // COL_INVERSEBG
|
||||
},
|
||||
},
|
||||
{ // intense
|
||||
{ // normal
|
||||
{ 0xdd, 0xdd, 0xdd, 0xff }, // COL_DEF
|
||||
{ 0x80, 0x80, 0x80, 0xff }, // COL_BLACK
|
||||
{ 0xff, 0x80, 0x80, 0xff }, // COL_RED
|
||||
{ 0x80, 0xff, 0x80, 0xff }, // COL_GREEN
|
||||
{ 0xff, 0xff, 0x80, 0xff }, // COL_YELLOW
|
||||
{ 0x80, 0x80, 0xff, 0xff }, // COL_BLUE
|
||||
{ 0xff, 0x80, 0xff, 0xff }, // COL_MAGENTA
|
||||
{ 0x80, 0xff, 0xff, 0xff }, // COL_CYAN
|
||||
{ 0xff, 0xff, 0xff, 0xff }, // COL_WHITE
|
||||
{ 0x00, 0x00, 0x00, 0x00 }, // COL_INVIS
|
||||
{ 0x11, 0x11, 0x11, 0xff }, // COL_INVERSE
|
||||
{ 0xcc, 0xcc, 0xcc, 0xff }, // COL_INVERSEBG
|
||||
},
|
||||
{ // bright/bold
|
||||
{ 0xff, 0xff, 0xff, 0xff }, // COL_DEF
|
||||
{ 0xcc, 0xcc, 0xcc, 0xff }, // COL_BLACK
|
||||
{ 0xff, 0xcc, 0xcc, 0xff }, // COL_RED
|
||||
{ 0xcc, 0xff, 0xcc, 0xff }, // COL_GREEN
|
||||
{ 0xff, 0xff, 0xcc, 0xff }, // COL_YELLOW
|
||||
{ 0xcc, 0xcc, 0xff, 0xff }, // COL_BLUE
|
||||
{ 0xff, 0xcc, 0xff, 0xff }, // COL_MAGENTA
|
||||
{ 0xcc, 0xff, 0xff, 0xff }, // COL_CYAN
|
||||
{ 0xff, 0xff, 0xff, 0xff }, // COL_WHITE
|
||||
{ 0x00, 0x00, 0x00, 0x00 }, // COL_INVIS
|
||||
{ 0x00, 0x00, 0x00, 0xff }, // COL_INVERSE
|
||||
{ 0xff, 0xff, 0xff, 0xff }, // COL_INVERSEBG
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static const Color colors256[256] =
|
||||
{
|
||||
// basic 16 repeated
|
||||
{ 0x00, 0x00, 0x00, 0xff }, // COL_BLACK
|
||||
{ 0xc0, 0x00, 0x00, 0xff }, // COL_RED
|
||||
{ 0x00, 0xc0, 0x00, 0xff }, // COL_GREEN
|
||||
{ 0xc0, 0xc0, 0x00, 0xff }, // COL_YELLOW
|
||||
{ 0x00, 0x00, 0xc0, 0xff }, // COL_BLUE
|
||||
{ 0xc0, 0x00, 0xc0, 0xff }, // COL_MAGENTA
|
||||
{ 0x00, 0xc0, 0xc0, 0xff }, // COL_CYAN
|
||||
{ 0xc0, 0xc0, 0xc0, 0xff }, // COL_WHITE
|
||||
|
||||
{ 0x80, 0x80, 0x80, 0xff }, // COL_BLACK
|
||||
{ 0xff, 0x80, 0x80, 0xff }, // COL_RED
|
||||
{ 0x80, 0xff, 0x80, 0xff }, // COL_GREEN
|
||||
{ 0xff, 0xff, 0x80, 0xff }, // COL_YELLOW
|
||||
{ 0x80, 0x80, 0xff, 0xff }, // COL_BLUE
|
||||
{ 0xff, 0x80, 0xff, 0xff }, // COL_MAGENTA
|
||||
{ 0x80, 0xff, 0xff, 0xff }, // COL_CYAN
|
||||
{ 0xff, 0xff, 0xff, 0xff }, // COL_WHITE
|
||||
|
||||
// pure 6x6x6 colorcube
|
||||
{ 0x00, 0x00, 0x00, 0xff },
|
||||
{ 0x00, 0x00, 0x2a, 0xff },
|
||||
{ 0x00, 0x00, 0x55, 0xff },
|
||||
{ 0x00, 0x00, 0x7f, 0xff },
|
||||
{ 0x00, 0x00, 0xaa, 0xff },
|
||||
{ 0x00, 0x00, 0xd4, 0xff },
|
||||
|
||||
{ 0x00, 0x2a, 0x00, 0xff },
|
||||
{ 0x00, 0x2a, 0x2a, 0xff },
|
||||
{ 0x00, 0x2a, 0x55, 0xff },
|
||||
{ 0x00, 0x2a, 0x7f, 0xff },
|
||||
{ 0x00, 0x2a, 0xaa, 0xff },
|
||||
{ 0x00, 0x2a, 0xd4, 0xff },
|
||||
|
||||
{ 0x00, 0x55, 0x00, 0xff },
|
||||
{ 0x00, 0x55, 0x2a, 0xff },
|
||||
{ 0x00, 0x55, 0x55, 0xff },
|
||||
{ 0x00, 0x55, 0x7f, 0xff },
|
||||
{ 0x00, 0x55, 0xaa, 0xff },
|
||||
{ 0x00, 0x55, 0xd4, 0xff },
|
||||
|
||||
{ 0x00, 0x7f, 0x00, 0xff },
|
||||
{ 0x00, 0x7f, 0x2a, 0xff },
|
||||
{ 0x00, 0x7f, 0x55, 0xff },
|
||||
{ 0x00, 0x7f, 0x7f, 0xff },
|
||||
{ 0x00, 0x7f, 0xaa, 0xff },
|
||||
{ 0x00, 0x7f, 0xd4, 0xff },
|
||||
|
||||
{ 0x00, 0xaa, 0x00, 0xff },
|
||||
{ 0x00, 0xaa, 0x2a, 0xff },
|
||||
{ 0x00, 0xaa, 0x55, 0xff },
|
||||
{ 0x00, 0xaa, 0x7f, 0xff },
|
||||
{ 0x00, 0xaa, 0xaa, 0xff },
|
||||
{ 0x00, 0xaa, 0xd4, 0xff },
|
||||
|
||||
{ 0x00, 0xd4, 0x00, 0xff },
|
||||
{ 0x00, 0xd4, 0x2a, 0xff },
|
||||
{ 0x00, 0xd4, 0x55, 0xff },
|
||||
{ 0x00, 0xd4, 0x7f, 0xff },
|
||||
{ 0x00, 0xd4, 0xaa, 0xff },
|
||||
{ 0x00, 0xd4, 0xd4, 0xff },
|
||||
|
||||
{ 0x2a, 0x00, 0x00, 0xff },
|
||||
{ 0x2a, 0x00, 0x2a, 0xff },
|
||||
{ 0x2a, 0x00, 0x55, 0xff },
|
||||
{ 0x2a, 0x00, 0x7f, 0xff },
|
||||
{ 0x2a, 0x00, 0xaa, 0xff },
|
||||
{ 0x2a, 0x00, 0xd4, 0xff },
|
||||
|
||||
{ 0x2a, 0x2a, 0x00, 0xff },
|
||||
{ 0x2a, 0x2a, 0x2a, 0xff },
|
||||
{ 0x2a, 0x2a, 0x55, 0xff },
|
||||
{ 0x2a, 0x2a, 0x7f, 0xff },
|
||||
{ 0x2a, 0x2a, 0xaa, 0xff },
|
||||
{ 0x2a, 0x2a, 0xd4, 0xff },
|
||||
|
||||
{ 0x2a, 0x55, 0x00, 0xff },
|
||||
{ 0x2a, 0x55, 0x2a, 0xff },
|
||||
{ 0x2a, 0x55, 0x55, 0xff },
|
||||
{ 0x2a, 0x55, 0x7f, 0xff },
|
||||
{ 0x2a, 0x55, 0xaa, 0xff },
|
||||
{ 0x2a, 0x55, 0xd4, 0xff },
|
||||
|
||||
{ 0x2a, 0x7f, 0x00, 0xff },
|
||||
{ 0x2a, 0x7f, 0x2a, 0xff },
|
||||
{ 0x2a, 0x7f, 0x55, 0xff },
|
||||
{ 0x2a, 0x7f, 0x7f, 0xff },
|
||||
{ 0x2a, 0x7f, 0xaa, 0xff },
|
||||
{ 0x2a, 0x7f, 0xd4, 0xff },
|
||||
|
||||
{ 0x2a, 0xaa, 0x00, 0xff },
|
||||
{ 0x2a, 0xaa, 0x2a, 0xff },
|
||||
{ 0x2a, 0xaa, 0x55, 0xff },
|
||||
{ 0x2a, 0xaa, 0x7f, 0xff },
|
||||
{ 0x2a, 0xaa, 0xaa, 0xff },
|
||||
{ 0x2a, 0xaa, 0xd4, 0xff },
|
||||
|
||||
{ 0x2a, 0xd4, 0x00, 0xff },
|
||||
{ 0x2a, 0xd4, 0x2a, 0xff },
|
||||
{ 0x2a, 0xd4, 0x55, 0xff },
|
||||
{ 0x2a, 0xd4, 0x7f, 0xff },
|
||||
{ 0x2a, 0xd4, 0xaa, 0xff },
|
||||
{ 0x2a, 0xd4, 0xd4, 0xff },
|
||||
|
||||
{ 0x55, 0x00, 0x00, 0xff },
|
||||
{ 0x55, 0x00, 0x2a, 0xff },
|
||||
{ 0x55, 0x00, 0x55, 0xff },
|
||||
{ 0x55, 0x00, 0x7f, 0xff },
|
||||
{ 0x55, 0x00, 0xaa, 0xff },
|
||||
{ 0x55, 0x00, 0xd4, 0xff },
|
||||
|
||||
{ 0x55, 0x2a, 0x00, 0xff },
|
||||
{ 0x55, 0x2a, 0x2a, 0xff },
|
||||
{ 0x55, 0x2a, 0x55, 0xff },
|
||||
{ 0x55, 0x2a, 0x7f, 0xff },
|
||||
{ 0x55, 0x2a, 0xaa, 0xff },
|
||||
{ 0x55, 0x2a, 0xd4, 0xff },
|
||||
|
||||
{ 0x55, 0x55, 0x00, 0xff },
|
||||
{ 0x55, 0x55, 0x2a, 0xff },
|
||||
{ 0x55, 0x55, 0x55, 0xff },
|
||||
{ 0x55, 0x55, 0x7f, 0xff },
|
||||
{ 0x55, 0x55, 0xaa, 0xff },
|
||||
{ 0x55, 0x55, 0xd4, 0xff },
|
||||
|
||||
{ 0x55, 0x7f, 0x00, 0xff },
|
||||
{ 0x55, 0x7f, 0x2a, 0xff },
|
||||
{ 0x55, 0x7f, 0x55, 0xff },
|
||||
{ 0x55, 0x7f, 0x7f, 0xff },
|
||||
{ 0x55, 0x7f, 0xaa, 0xff },
|
||||
{ 0x55, 0x7f, 0xd4, 0xff },
|
||||
|
||||
{ 0x55, 0xaa, 0x00, 0xff },
|
||||
{ 0x55, 0xaa, 0x2a, 0xff },
|
||||
{ 0x55, 0xaa, 0x55, 0xff },
|
||||
{ 0x55, 0xaa, 0x7f, 0xff },
|
||||
{ 0x55, 0xaa, 0xaa, 0xff },
|
||||
{ 0x55, 0xaa, 0xd4, 0xff },
|
||||
|
||||
{ 0x55, 0xd4, 0x00, 0xff },
|
||||
{ 0x55, 0xd4, 0x2a, 0xff },
|
||||
{ 0x55, 0xd4, 0x55, 0xff },
|
||||
{ 0x55, 0xd4, 0x7f, 0xff },
|
||||
{ 0x55, 0xd4, 0xaa, 0xff },
|
||||
{ 0x55, 0xd4, 0xd4, 0xff },
|
||||
|
||||
{ 0x7f, 0x00, 0x00, 0xff },
|
||||
{ 0x7f, 0x00, 0x2a, 0xff },
|
||||
{ 0x7f, 0x00, 0x55, 0xff },
|
||||
{ 0x7f, 0x00, 0x7f, 0xff },
|
||||
{ 0x7f, 0x00, 0xaa, 0xff },
|
||||
{ 0x7f, 0x00, 0xd4, 0xff },
|
||||
|
||||
{ 0x7f, 0x2a, 0x00, 0xff },
|
||||
{ 0x7f, 0x2a, 0x2a, 0xff },
|
||||
{ 0x7f, 0x2a, 0x55, 0xff },
|
||||
{ 0x7f, 0x2a, 0x7f, 0xff },
|
||||
{ 0x7f, 0x2a, 0xaa, 0xff },
|
||||
{ 0x7f, 0x2a, 0xd4, 0xff },
|
||||
|
||||
{ 0x7f, 0x55, 0x00, 0xff },
|
||||
{ 0x7f, 0x55, 0x2a, 0xff },
|
||||
{ 0x7f, 0x55, 0x55, 0xff },
|
||||
{ 0x7f, 0x55, 0x7f, 0xff },
|
||||
{ 0x7f, 0x55, 0xaa, 0xff },
|
||||
{ 0x7f, 0x55, 0xd4, 0xff },
|
||||
|
||||
{ 0x7f, 0x7f, 0x00, 0xff },
|
||||
{ 0x7f, 0x7f, 0x2a, 0xff },
|
||||
{ 0x7f, 0x7f, 0x55, 0xff },
|
||||
{ 0x7f, 0x7f, 0x7f, 0xff },
|
||||
{ 0x7f, 0x7f, 0xaa, 0xff },
|
||||
{ 0x7f, 0x7f, 0xd4, 0xff },
|
||||
|
||||
{ 0x7f, 0xaa, 0x00, 0xff },
|
||||
{ 0x7f, 0xaa, 0x2a, 0xff },
|
||||
{ 0x7f, 0xaa, 0x55, 0xff },
|
||||
{ 0x7f, 0xaa, 0x7f, 0xff },
|
||||
{ 0x7f, 0xaa, 0xaa, 0xff },
|
||||
{ 0x7f, 0xaa, 0xd4, 0xff },
|
||||
|
||||
{ 0x7f, 0xd4, 0x00, 0xff },
|
||||
{ 0x7f, 0xd4, 0x2a, 0xff },
|
||||
{ 0x7f, 0xd4, 0x55, 0xff },
|
||||
{ 0x7f, 0xd4, 0x7f, 0xff },
|
||||
{ 0x7f, 0xd4, 0xaa, 0xff },
|
||||
{ 0x7f, 0xd4, 0xd4, 0xff },
|
||||
|
||||
{ 0xaa, 0x00, 0x00, 0xff },
|
||||
{ 0xaa, 0x00, 0x2a, 0xff },
|
||||
{ 0xaa, 0x00, 0x55, 0xff },
|
||||
{ 0xaa, 0x00, 0x7f, 0xff },
|
||||
{ 0xaa, 0x00, 0xaa, 0xff },
|
||||
{ 0xaa, 0x00, 0xd4, 0xff },
|
||||
|
||||
{ 0xaa, 0x2a, 0x00, 0xff },
|
||||
{ 0xaa, 0x2a, 0x2a, 0xff },
|
||||
{ 0xaa, 0x2a, 0x55, 0xff },
|
||||
{ 0xaa, 0x2a, 0x7f, 0xff },
|
||||
{ 0xaa, 0x2a, 0xaa, 0xff },
|
||||
{ 0xaa, 0x2a, 0xd4, 0xff },
|
||||
|
||||
{ 0xaa, 0x55, 0x00, 0xff },
|
||||
{ 0xaa, 0x55, 0x2a, 0xff },
|
||||
{ 0xaa, 0x55, 0x55, 0xff },
|
||||
{ 0xaa, 0x55, 0x7f, 0xff },
|
||||
{ 0xaa, 0x55, 0xaa, 0xff },
|
||||
{ 0xaa, 0x55, 0xd4, 0xff },
|
||||
|
||||
{ 0xaa, 0x7f, 0x00, 0xff },
|
||||
{ 0xaa, 0x7f, 0x2a, 0xff },
|
||||
{ 0xaa, 0x7f, 0x55, 0xff },
|
||||
{ 0xaa, 0x7f, 0x7f, 0xff },
|
||||
{ 0xaa, 0x7f, 0xaa, 0xff },
|
||||
{ 0xaa, 0x7f, 0xd4, 0xff },
|
||||
|
||||
{ 0xaa, 0xaa, 0x00, 0xff },
|
||||
{ 0xaa, 0xaa, 0x2a, 0xff },
|
||||
{ 0xaa, 0xaa, 0x55, 0xff },
|
||||
{ 0xaa, 0xaa, 0x7f, 0xff },
|
||||
{ 0xaa, 0xaa, 0xaa, 0xff },
|
||||
{ 0xaa, 0xaa, 0xd4, 0xff },
|
||||
|
||||
{ 0xaa, 0xd4, 0x00, 0xff },
|
||||
{ 0xaa, 0xd4, 0x2a, 0xff },
|
||||
{ 0xaa, 0xd4, 0x55, 0xff },
|
||||
{ 0xaa, 0xd4, 0x7f, 0xff },
|
||||
{ 0xaa, 0xd4, 0xaa, 0xff },
|
||||
{ 0xaa, 0xd4, 0xd4, 0xff },
|
||||
|
||||
|
||||
{ 0xd4, 0x00, 0x00, 0xff },
|
||||
{ 0xd4, 0x00, 0x2a, 0xff },
|
||||
{ 0xd4, 0x00, 0x55, 0xff },
|
||||
{ 0xd4, 0x00, 0x7f, 0xff },
|
||||
{ 0xd4, 0x00, 0xaa, 0xff },
|
||||
{ 0xd4, 0x00, 0xd4, 0xff },
|
||||
|
||||
{ 0xd4, 0x2a, 0x00, 0xff },
|
||||
{ 0xd4, 0x2a, 0x2a, 0xff },
|
||||
{ 0xd4, 0x2a, 0x55, 0xff },
|
||||
{ 0xd4, 0x2a, 0x7f, 0xff },
|
||||
{ 0xd4, 0x2a, 0xaa, 0xff },
|
||||
{ 0xd4, 0x2a, 0xd4, 0xff },
|
||||
|
||||
{ 0xd4, 0x55, 0x00, 0xff },
|
||||
{ 0xd4, 0x55, 0x2a, 0xff },
|
||||
{ 0xd4, 0x55, 0x55, 0xff },
|
||||
{ 0xd4, 0x55, 0x7f, 0xff },
|
||||
{ 0xd4, 0x55, 0xaa, 0xff },
|
||||
{ 0xd4, 0x55, 0xd4, 0xff },
|
||||
|
||||
{ 0xd4, 0x7f, 0x00, 0xff },
|
||||
{ 0xd4, 0x7f, 0x2a, 0xff },
|
||||
{ 0xd4, 0x7f, 0x55, 0xff },
|
||||
{ 0xd4, 0x7f, 0x7f, 0xff },
|
||||
{ 0xd4, 0x7f, 0xaa, 0xff },
|
||||
{ 0xd4, 0x7f, 0xd4, 0xff },
|
||||
|
||||
{ 0xd4, 0xaa, 0x00, 0xff },
|
||||
{ 0xd4, 0xaa, 0x2a, 0xff },
|
||||
{ 0xd4, 0xaa, 0x55, 0xff },
|
||||
{ 0xd4, 0xaa, 0x7f, 0xff },
|
||||
{ 0xd4, 0xaa, 0xaa, 0xff },
|
||||
{ 0xd4, 0xaa, 0xd4, 0xff },
|
||||
|
||||
{ 0xd4, 0xd4, 0x00, 0xff },
|
||||
{ 0xd4, 0xd4, 0x2a, 0xff },
|
||||
{ 0xd4, 0xd4, 0x55, 0xff },
|
||||
{ 0xd4, 0xd4, 0x7f, 0xff },
|
||||
{ 0xd4, 0xd4, 0xaa, 0xff },
|
||||
{ 0xd4, 0xd4, 0xd4, 0xff },
|
||||
|
||||
// greyscale ramp (24 not including black and white, so 26 if included)
|
||||
{ 0x08, 0x08, 0x08, 0xff },
|
||||
{ 0x12, 0x12, 0x12, 0xff },
|
||||
{ 0x1c, 0x1c, 0x1c, 0xff },
|
||||
{ 0x26, 0x26, 0x26, 0xff },
|
||||
{ 0x30, 0x30, 0x30, 0xff },
|
||||
{ 0x3a, 0x3a, 0x3a, 0xff },
|
||||
{ 0x44, 0x44, 0x44, 0xff },
|
||||
{ 0x4e, 0x4e, 0x4e, 0xff },
|
||||
{ 0x58, 0x58, 0x58, 0xff },
|
||||
{ 0x62, 0x62, 0x62, 0xff },
|
||||
{ 0x6c, 0x6c, 0x6c, 0xff },
|
||||
{ 0x76, 0x76, 0x76, 0xff },
|
||||
{ 0x80, 0x80, 0x80, 0xff },
|
||||
{ 0x8a, 0x8a, 0x8a, 0xff },
|
||||
{ 0x94, 0x94, 0x94, 0xff },
|
||||
{ 0x9e, 0x9e, 0x9e, 0xff },
|
||||
{ 0xa8, 0xa8, 0xa8, 0xff },
|
||||
{ 0xb2, 0xb2, 0xb2, 0xff },
|
||||
{ 0xbc, 0xbc, 0xbc, 0xff },
|
||||
{ 0xc6, 0xc6, 0xc6, 0xff },
|
||||
{ 0xd0, 0xd0, 0xd0, 0xff },
|
||||
{ 0xda, 0xda, 0xda, 0xff },
|
||||
{ 0xe4, 0xe4, 0xe4, 0xff },
|
||||
{ 0xee, 0xee, 0xee, 0xff },
|
||||
};
|
||||
|
||||
void
|
||||
_colors_init(Evas_Object *obj, Evas_Object *bg)
|
||||
{
|
||||
int c, n;
|
||||
int r, g, b, a;
|
||||
char buf[32];
|
||||
|
||||
for (c = 0; c < 4 * 12; c++)
|
||||
{
|
||||
snprintf(buf, sizeof(buf) - 1, "c%i", c);
|
||||
|
||||
n = c + (24 * (c / 24));
|
||||
|
||||
if (edje_object_color_class_get(bg, buf,
|
||||
&r, &g, &b, &a,
|
||||
NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL))
|
||||
{
|
||||
/* normal */
|
||||
evas_object_textgrid_palette_set(obj,
|
||||
EVAS_TEXTGRID_PALETTE_STANDARD,
|
||||
n, r, g, b, a);
|
||||
/* faint */
|
||||
evas_object_textgrid_palette_set(obj,
|
||||
EVAS_TEXTGRID_PALETTE_STANDARD,
|
||||
n + 24,
|
||||
r / 2, g / 2, b / 2, a / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
Color color;
|
||||
|
||||
color = colors[c / 24][(c % 24) / 12][c % 12];
|
||||
|
||||
/* normal */
|
||||
evas_object_textgrid_palette_set(obj,
|
||||
EVAS_TEXTGRID_PALETTE_STANDARD,
|
||||
n, color.r, color.g, color.b,
|
||||
color.a);
|
||||
/* faint */
|
||||
evas_object_textgrid_palette_set(obj,
|
||||
EVAS_TEXTGRID_PALETTE_STANDARD,
|
||||
n + 24,
|
||||
color.r / 2, color.g / 2,
|
||||
color.b / 2, color.a / 2);
|
||||
}
|
||||
}
|
||||
|
||||
for (c = 0; c < 256; c++)
|
||||
{
|
||||
snprintf(buf, sizeof(buf) - 1, "C%i", c);
|
||||
|
||||
if (edje_object_color_class_get(bg, buf,
|
||||
&r, &g, &b, &a,
|
||||
NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL))
|
||||
{
|
||||
evas_object_textgrid_palette_set(obj,
|
||||
EVAS_TEXTGRID_PALETTE_EXTENDED,
|
||||
c, r, g, b, a);
|
||||
}
|
||||
else
|
||||
{
|
||||
Color color;
|
||||
|
||||
color = colors256[c];
|
||||
|
||||
evas_object_textgrid_palette_set(obj,
|
||||
EVAS_TEXTGRID_PALETTE_EXTENDED,
|
||||
c, color.r, color.g, color.b,
|
||||
color.a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_colors_standard_get(int set, int col, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a)
|
||||
{
|
||||
if ((set >= 0) && (set < 4))
|
||||
{
|
||||
int s1, s2;
|
||||
|
||||
s1 = set / 2;
|
||||
s2 = set % 2;
|
||||
*r = colors[s1][s2][col].r;
|
||||
*g = colors[s1][s2][col].g;
|
||||
*b = colors[s1][s2][col].b;
|
||||
*a = colors[s1][s2][col].a;
|
||||
return;
|
||||
}
|
||||
*r = 0;
|
||||
*g = 0;
|
||||
*b = 0;
|
||||
*a = 0;
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
#ifndef _COLORS_H_
|
||||
# define _COLORS_H_ 1
|
||||
|
||||
typedef struct _Color Color;
|
||||
|
||||
struct _Color
|
||||
{
|
||||
unsigned char r, g, b, a;
|
||||
};
|
||||
|
||||
void _colors_init(Evas_Object *obj, Evas_Object *bg);
|
||||
void _colors_standard_get(int set, int col, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a);
|
||||
|
||||
#endif
|
|
@ -1,45 +0,0 @@
|
|||
#include "private.h"
|
||||
#include "channel.h"
|
||||
|
||||
static Eina_Bool
|
||||
_txt_handle(Express_Network *net, const char *name, char *str, char *buff)
|
||||
{
|
||||
snprintf(buff, PATH_MAX, "%s\r\n", str);
|
||||
express_network_channel_priv_send(net, name, buff);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_cmd_handle(Express_Network *net, char *cmd, char *parameter, char *buff)
|
||||
{
|
||||
/* FIXME: We need to add support for lowercase command shortcuts
|
||||
* (ie: /j to join, etc) */
|
||||
cmd++;
|
||||
|
||||
if (parameter)
|
||||
snprintf(buff, PATH_MAX, "%s %s\r\n", cmd, parameter);
|
||||
else
|
||||
snprintf(buff, PATH_MAX, "%s\r\n", cmd);
|
||||
|
||||
express_network_command_send(net, buff);
|
||||
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
_cmd_txt_handle(Express_Network *net, const char *name, char *str, char *buff)
|
||||
{
|
||||
char **tokens;
|
||||
Eina_Bool ret;
|
||||
|
||||
tokens = eina_str_split(str, " ", 2);
|
||||
|
||||
if (tokens[0][0] == '/')
|
||||
ret = _cmd_handle(net, tokens[0], tokens[1], buff);
|
||||
else
|
||||
ret = _txt_handle(net, name, str, buff);
|
||||
|
||||
free(tokens);
|
||||
return ret;
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef _COMMANDS_H_
|
||||
# define _COMMANDS_H_ 1
|
||||
|
||||
Eina_Bool _cmd_txt_handle(Express_Network *channel_net, const char *channel_name, char *str, char *buff);
|
||||
|
||||
#endif
|
258
src/bin/config.c
|
@ -1,48 +1,39 @@
|
|||
#include "private.h"
|
||||
#include "config.h"
|
||||
#include "utils.h"
|
||||
#include "window.h"
|
||||
|
||||
# define EX_CONFIG_LIMIT(v, min, max) \
|
||||
#define EX_CONFIG_LIMIT(v, min, max) \
|
||||
if (v > max) v = max; else if (v < min) v = min;
|
||||
|
||||
# define EX_CONFIG_DD_NEW(str, typ) \
|
||||
_config_descriptor_new(str, sizeof(typ))
|
||||
#define EX_CONFIG_DD_NEW(str, typ) \
|
||||
_cfg_descriptor_new(str, sizeof(typ))
|
||||
|
||||
# define EX_CONFIG_DD_FREE(eed) \
|
||||
#define EX_CONFIG_DD_FREE(eed) \
|
||||
if (eed) { eet_data_descriptor_free(eed); (eed) = NULL; }
|
||||
|
||||
# define EX_CONFIG_VAL(edd, type, member, dtype) \
|
||||
#define EX_CONFIG_VAL(edd, type, member, dtype) \
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC(edd, type, #member, member, dtype)
|
||||
|
||||
# define EX_CONFIG_SUB(edd, type, member, eddtype) \
|
||||
#define EX_CONFIG_SUB(edd, type, member, eddtype) \
|
||||
EET_DATA_DESCRIPTOR_ADD_SUB(edd, type, #member, member, eddtype)
|
||||
|
||||
# define EX_CONFIG_LIST(edd, type, member, eddtype) \
|
||||
#define EX_CONFIG_LIST(edd, type, member, eddtype) \
|
||||
EET_DATA_DESCRIPTOR_ADD_LIST(edd, type, #member, member, eddtype)
|
||||
|
||||
# define EX_CONFIG_HASH(edd, type, member, eddtype) \
|
||||
#define EX_CONFIG_HASH(edd, type, member, eddtype) \
|
||||
EET_DATA_DESCRIPTOR_ADD_HASH(edd, type, #member, member, eddtype)
|
||||
|
||||
# define EX_CONFIG_FILE_EPOCH 0x0004
|
||||
# define EX_CONFIG_FILE_GENERATION 0x012d
|
||||
# define EX_CONFIG_FILE_VERSION \
|
||||
#define EX_CONFIG_FILE_EPOCH 0x0004
|
||||
#define EX_CONFIG_FILE_GENERATION 0x012d
|
||||
#define EX_CONFIG_FILE_VERSION \
|
||||
((EX_CONFIG_FILE_EPOCH << 16) | EX_CONFIG_FILE_GENERATION)
|
||||
|
||||
typedef Eet_Data_Descriptor Ex_Config_DD;
|
||||
|
||||
/* local variables */
|
||||
static Ex_Config_DD *_ex_cfg_edd = NULL;
|
||||
static Ex_Config_DD *_ex_cfg_srv_edd = NULL;
|
||||
static Ex_Config_DD *_ex_cfg_net_edd = NULL;
|
||||
static Ex_Config_DD *_ex_cfg_chl_edd = NULL;
|
||||
|
||||
/* external variables */
|
||||
Config *_ex_cfg = NULL;
|
||||
|
||||
/* local functions */
|
||||
static Ex_Config_DD *
|
||||
_config_descriptor_new(const char *name, int size)
|
||||
_cfg_descriptor_new(const char *name, int size)
|
||||
{
|
||||
Eet_Data_Descriptor_Class eddc;
|
||||
|
||||
|
@ -54,73 +45,30 @@ _config_descriptor_new(const char *name, int size)
|
|||
}
|
||||
|
||||
static void
|
||||
_config_cb_free(void)
|
||||
_cfg_cb_free(void)
|
||||
{
|
||||
Config_Network *net;
|
||||
|
||||
EINA_LIST_FREE(_ex_cfg->networks, net)
|
||||
{
|
||||
Config_Server *srv;
|
||||
Config_Channel *chl;
|
||||
|
||||
EINA_LIST_FREE(net->servers, srv)
|
||||
{
|
||||
if (srv->name) eina_stringshare_del(srv->name);
|
||||
free(srv);
|
||||
}
|
||||
|
||||
EINA_LIST_FREE(net->channels, chl)
|
||||
{
|
||||
if (chl->name) eina_stringshare_del(chl->name);
|
||||
if (chl->pass) eina_stringshare_del(chl->pass);
|
||||
free(chl);
|
||||
}
|
||||
|
||||
if (net->name) eina_stringshare_del(net->name);
|
||||
if (net->nickname) eina_stringshare_del(net->nickname);
|
||||
if (net->username) eina_stringshare_del(net->username);
|
||||
if (net->nick_passwd) eina_stringshare_del(net->nick_passwd);
|
||||
if (net->server_passwd) eina_stringshare_del(net->server_passwd);
|
||||
|
||||
free(net);
|
||||
}
|
||||
|
||||
if (_ex_cfg->font.name) eina_stringshare_del(_ex_cfg->font.name);
|
||||
|
||||
free(_ex_cfg);
|
||||
_ex_cfg = NULL;
|
||||
}
|
||||
|
||||
static void *
|
||||
_config_domain_load(const char *domain, Ex_Config_DD *edd)
|
||||
_cfg_domain_load(const char *domain, Ex_Config_DD *edd)
|
||||
{
|
||||
Eet_File *ef;
|
||||
char buff[PATH_MAX];
|
||||
|
||||
if (!domain) return NULL;
|
||||
snprintf(buff, sizeof(buff),
|
||||
"%s/%s.cfg", _util_user_dir_get(), domain);
|
||||
ef = eet_open(buff, EET_FILE_MODE_READ);
|
||||
if (ef)
|
||||
{
|
||||
void *data;
|
||||
|
||||
data = eet_data_read(ef, edd, "config");
|
||||
eet_close(ef);
|
||||
if (data) return data;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_config_domain_save(const char *domain, Ex_Config_DD *edd, const void *data)
|
||||
_cfg_domain_save(const char *domain, Ex_Config_DD *edd, const void *data)
|
||||
{
|
||||
Eet_File *ef;
|
||||
char buff[PATH_MAX];
|
||||
const char *userdir;
|
||||
|
||||
if (!domain) return 0;
|
||||
userdir = _util_user_dir_get();
|
||||
/* TODO */
|
||||
/* userdir = _util_user_dir_get(); */
|
||||
snprintf(buff, sizeof(buff), "%s/", userdir);
|
||||
if (!ecore_file_exists(buff)) ecore_file_mkpath(buff);
|
||||
snprintf(buff, sizeof(buff), "%s/%s.tmp", userdir, domain);
|
||||
|
@ -135,6 +83,7 @@ _config_domain_save(const char *domain, Ex_Config_DD *edd, const void *data)
|
|||
eet_close(ef);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
if (eet_close(ef) > 0) return EINA_FALSE;
|
||||
if (!ecore_file_mv(buff, buff2)) return EINA_FALSE;
|
||||
return EINA_TRUE;
|
||||
|
@ -143,169 +92,36 @@ _config_domain_save(const char *domain, Ex_Config_DD *edd, const void *data)
|
|||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
/* external functions */
|
||||
Eina_Bool
|
||||
_config_init(void)
|
||||
Eina_Bool
|
||||
_cfg_init(void)
|
||||
{
|
||||
elm_need_efreet();
|
||||
if (!efreet_init()) return EINA_FALSE;
|
||||
|
||||
_ex_cfg_chl_edd = EX_CONFIG_DD_NEW("Config_Channel", Config_Channel);
|
||||
#undef T
|
||||
#undef D
|
||||
#define T Config_Channel
|
||||
#define D _ex_cfg_chl_edd
|
||||
EX_CONFIG_VAL(D, T, name, EET_T_STRING);
|
||||
EX_CONFIG_VAL(D, T, pass, EET_T_STRING);
|
||||
|
||||
_ex_cfg_srv_edd = EX_CONFIG_DD_NEW("Config_Server", Config_Server);
|
||||
#undef T
|
||||
#undef D
|
||||
#define T Config_Server
|
||||
#define D _ex_cfg_srv_edd
|
||||
EX_CONFIG_VAL(D, T, name, EET_T_STRING);
|
||||
EX_CONFIG_VAL(D, T, port, EET_T_INT);
|
||||
|
||||
_ex_cfg_net_edd = EX_CONFIG_DD_NEW("Config_Network", Config_Network);
|
||||
#undef T
|
||||
#undef D
|
||||
#define T Config_Network
|
||||
#define D _ex_cfg_net_edd
|
||||
EX_CONFIG_VAL(D, T, name, EET_T_STRING);
|
||||
EX_CONFIG_VAL(D, T, nickname, EET_T_STRING);
|
||||
EX_CONFIG_VAL(D, T, username, EET_T_STRING);
|
||||
EX_CONFIG_VAL(D, T, nick_passwd, EET_T_STRING);
|
||||
EX_CONFIG_VAL(D, T, server_passwd, EET_T_STRING);
|
||||
EX_CONFIG_VAL(D, T, autoconnect, EET_T_UCHAR);
|
||||
EX_CONFIG_VAL(D, T, bypass_proxy, EET_T_UCHAR);
|
||||
EX_CONFIG_VAL(D, T, use_ssl, EET_T_UCHAR);
|
||||
EX_CONFIG_LIST(D, T, servers, _ex_cfg_srv_edd);
|
||||
EX_CONFIG_LIST(D, T, channels, _ex_cfg_chl_edd);
|
||||
|
||||
_ex_cfg_edd = EX_CONFIG_DD_NEW("Config", Config);
|
||||
#undef T
|
||||
#undef D
|
||||
#define T Config
|
||||
#define D _ex_cfg_edd
|
||||
EX_CONFIG_VAL(D, T, version, EET_T_INT);
|
||||
EX_CONFIG_VAL(D, T, font.name, EET_T_STRING);
|
||||
EX_CONFIG_VAL(D, T, font.size, EET_T_INT);
|
||||
EX_CONFIG_VAL(D, T, font.bitmap, EET_T_UCHAR);
|
||||
EX_CONFIG_VAL(D, T, font.use_entry, EET_T_UCHAR);
|
||||
EX_CONFIG_VAL(D, T, gui.translucent, EET_T_UCHAR);
|
||||
EX_CONFIG_VAL(D, T, gui.use_gravatar, EET_T_UCHAR);
|
||||
EX_CONFIG_VAL(D, T, gui.opacity, EET_T_INT);
|
||||
EX_CONFIG_VAL(D, T, gui.zoom, EET_T_DOUBLE);
|
||||
EX_CONFIG_VAL(D, T, gui.scrollback, EET_T_INT);
|
||||
EX_CONFIG_VAL(D, T, gui.tabs, EET_T_INT);
|
||||
EX_CONFIG_VAL(D, T, video.module, EET_T_INT);
|
||||
EX_CONFIG_VAL(D, T, video.muted, EET_T_UCHAR);
|
||||
EX_CONFIG_VAL(D, T, video.visualized, EET_T_UCHAR);
|
||||
EX_CONFIG_LIST(D, T, networks, _ex_cfg_net_edd);
|
||||
|
||||
_config_load();
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
_config_shutdown(void)
|
||||
Eina_Bool
|
||||
_cfg_shutdown(void)
|
||||
{
|
||||
_config_cb_free();
|
||||
_cfg_cb_free();
|
||||
|
||||
EX_CONFIG_DD_FREE(_ex_cfg_chl_edd);
|
||||
EX_CONFIG_DD_FREE(_ex_cfg_srv_edd);
|
||||
EX_CONFIG_DD_FREE(_ex_cfg_net_edd);
|
||||
EX_CONFIG_DD_FREE(_ex_cfg_edd);
|
||||
|
||||
efreet_shutdown();
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
_cfg_load(void)
|
||||
{
|
||||
_ex_cfg = _cfg_domain_load(PACKAGE_NAME, _ex_cfg_edd);
|
||||
if (_ex_cfg)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
_config_load(void)
|
||||
Eina_Bool
|
||||
_cfg_save(void)
|
||||
{
|
||||
Eina_Bool save = EINA_FALSE;
|
||||
|
||||
_ex_cfg = _config_domain_load(PACKAGE_NAME, _ex_cfg_edd);
|
||||
if (_ex_cfg)
|
||||
{
|
||||
Eina_Bool reload = EINA_FALSE;
|
||||
|
||||
if ((_ex_cfg->version >> 16) < EX_CONFIG_FILE_EPOCH)
|
||||
{
|
||||
/* config too old */
|
||||
reload = EINA_TRUE;
|
||||
}
|
||||
else if (_ex_cfg->version > EX_CONFIG_FILE_VERSION)
|
||||
{
|
||||
/* config too new, WTF ? */
|
||||
reload = EINA_TRUE;
|
||||
}
|
||||
|
||||
/* if too old or too new, clear it so we can create new */
|
||||
if (reload) _config_cb_free();
|
||||
}
|
||||
|
||||
if (!_ex_cfg)
|
||||
{
|
||||
_ex_cfg = malloc(sizeof(Config));
|
||||
save = EINA_TRUE;
|
||||
}
|
||||
|
||||
/* define some convenient macros */
|
||||
#define IFCFG(v) if ((_ex_cfg->version & 0xffff) < (v)) {
|
||||
#define IFCFGELSE } else {
|
||||
#define IFCFGEND }
|
||||
|
||||
/* setup defaults */
|
||||
IFCFG(0x008d);
|
||||
_ex_cfg->font.size = 10;
|
||||
_ex_cfg->font.bitmap = EINA_TRUE;
|
||||
_ex_cfg->font.name = eina_stringshare_add("nexus.pcf");
|
||||
_ex_cfg->gui.translucent = EINA_TRUE;
|
||||
_ex_cfg->gui.opacity = 70;
|
||||
_ex_cfg->gui.zoom = 0.5;
|
||||
_ex_cfg->gui.scrollback = 2000;
|
||||
_ex_cfg->networks = NULL;
|
||||
IFCFGEND;
|
||||
|
||||
IFCFG(0x009d);
|
||||
_ex_cfg->gui.tabs = 1;
|
||||
IFCFGEND;
|
||||
|
||||
IFCFG(0x010d);
|
||||
_ex_cfg->gui.use_gravatar = EINA_TRUE;
|
||||
IFCFGEND;
|
||||
|
||||
IFCFG(0x011d);
|
||||
_ex_cfg->font.use_entry = EINA_TRUE;
|
||||
IFCFGEND;
|
||||
|
||||
IFCFG(0x012d);
|
||||
_ex_cfg->video.module = 0;
|
||||
_ex_cfg->video.muted = EINA_FALSE;
|
||||
_ex_cfg->video.visualized = EINA_TRUE;
|
||||
IFCFGEND;
|
||||
|
||||
/* limit config values so they are sane */
|
||||
EX_CONFIG_LIMIT(_ex_cfg->font.size, 3, 400);
|
||||
EX_CONFIG_LIMIT(_ex_cfg->gui.zoom, 0.1, 1.0);
|
||||
EX_CONFIG_LIMIT(_ex_cfg->gui.scrollback, 0, 200000);
|
||||
EX_CONFIG_LIMIT(_ex_cfg->video.module, 0, 4);
|
||||
|
||||
_ex_cfg->version = EX_CONFIG_FILE_VERSION;
|
||||
|
||||
if (save) _config_save();
|
||||
}
|
||||
|
||||
void
|
||||
_config_save(void)
|
||||
{
|
||||
if (_config_domain_save(PACKAGE_NAME, _ex_cfg_edd, _ex_cfg))
|
||||
{
|
||||
/* update window, channels, etc */
|
||||
_window_update();
|
||||
}
|
||||
return _cfg_domain_save(PACKAGE_NAME, _ex_cfg_edd, _ex_cfg);
|
||||
}
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
#ifndef _CONFIG_H_
|
||||
# define _CONFIG_H_ 1
|
||||
|
||||
typedef struct _Config_Channel Config_Channel;
|
||||
typedef struct _Config_Server Config_Server;
|
||||
typedef struct _Config_Network Config_Network;
|
||||
typedef struct _Config Config;
|
||||
|
||||
struct _Config_Channel
|
||||
{
|
||||
const char *name;
|
||||
const char *pass;
|
||||
};
|
||||
|
||||
struct _Config_Server
|
||||
{
|
||||
int port;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
struct _Config_Network
|
||||
{
|
||||
const char *name;
|
||||
const char *nickname;
|
||||
const char *username;
|
||||
const char *nick_passwd;
|
||||
const char *server_passwd;
|
||||
Eina_Bool autoconnect;
|
||||
Eina_Bool bypass_proxy;
|
||||
Eina_Bool use_ssl;
|
||||
Eina_List *servers;
|
||||
Eina_List *channels;
|
||||
};
|
||||
|
||||
struct _Config
|
||||
{
|
||||
int version;
|
||||
|
||||
struct
|
||||
{
|
||||
int size;
|
||||
const char *name;
|
||||
Eina_Bool bitmap;
|
||||
Eina_Bool use_entry;
|
||||
} font;
|
||||
|
||||
struct
|
||||
{
|
||||
double zoom;
|
||||
int opacity;
|
||||
int scrollback;
|
||||
int tabs;
|
||||
Eina_Bool translucent;
|
||||
Eina_Bool use_gravatar;
|
||||
} gui;
|
||||
|
||||
struct
|
||||
{
|
||||
int module;
|
||||
Eina_Bool muted;
|
||||
Eina_Bool visualized;
|
||||
} video;
|
||||
|
||||
Eina_List *networks;
|
||||
};
|
||||
|
||||
extern Config *_ex_cfg;
|
||||
|
||||
Eina_Bool _config_init(void);
|
||||
Eina_Bool _config_shutdown(void);
|
||||
void _config_load(void);
|
||||
void _config_save(void);
|
||||
|
||||
#endif
|
139
src/bin/dbus.c
|
@ -1,139 +0,0 @@
|
|||
#include "private.h"
|
||||
#include "dbus.h"
|
||||
#ifdef HAVE_ELDBUS
|
||||
#include <Eldbus.h>
|
||||
|
||||
static Eldbus_Connection *_dbus_conn = NULL;
|
||||
static Eldbus_Object *_dbus_obj = NULL;
|
||||
static Eina_Stringshare *_curr_url = NULL;
|
||||
|
||||
void
|
||||
_dbus_init(void)
|
||||
{
|
||||
if (_dbus_conn) return;
|
||||
|
||||
eldbus_init();
|
||||
|
||||
if (!elm_need_sys_notify())
|
||||
WRN("Elementary does not have system notification support");
|
||||
|
||||
_dbus_conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION);
|
||||
_dbus_obj =
|
||||
eldbus_object_get(_dbus_conn,"org.enlightenment.wm.service",
|
||||
"/org/enlightenment/wm/RemoteObject");
|
||||
}
|
||||
|
||||
void
|
||||
_dbus_shutdown(void)
|
||||
{
|
||||
_dbus_link_hide();
|
||||
|
||||
if (_dbus_conn) eldbus_connection_unref(_dbus_conn);
|
||||
_dbus_conn = NULL;
|
||||
|
||||
_dbus_obj = NULL;
|
||||
|
||||
eldbus_shutdown();
|
||||
}
|
||||
|
||||
void
|
||||
_dbus_link_hide(void)
|
||||
{
|
||||
Eldbus_Message *msg;
|
||||
|
||||
if ((!_dbus_obj) || (!_curr_url)) return;
|
||||
|
||||
msg = eldbus_message_method_call_new("org.enlightenment.wm.service",
|
||||
"/org/enlightenment/wm/RemoteObject",
|
||||
"org.enlightenment.wm.Teamwork",
|
||||
"LinkHide");
|
||||
|
||||
eldbus_message_arguments_append(msg, "s", _curr_url);
|
||||
eldbus_object_send(_dbus_obj, msg, NULL, NULL, -1);
|
||||
|
||||
eina_stringshare_replace(&_curr_url, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
_dbus_link_mousein(uint64_t win, const char *url, int x, int y)
|
||||
{
|
||||
Eldbus_Message *msg;
|
||||
Eina_Stringshare *u;
|
||||
|
||||
if (!_dbus_obj) return;
|
||||
|
||||
u = eina_stringshare_add(url);
|
||||
/* if previous link exists, do MouseOut now */
|
||||
if (_curr_url && (u != _curr_url))
|
||||
_dbus_link_mouseout(win, _curr_url, x, y);
|
||||
eina_stringshare_del(_curr_url);
|
||||
_curr_url = u;
|
||||
|
||||
msg = eldbus_message_method_call_new("org.enlightenment.wm.service",
|
||||
"/org/enlightenment/wm/RemoteObject",
|
||||
"org.enlightenment.wm.Teamwork",
|
||||
"LinkMouseIn");
|
||||
|
||||
#if (ELM_VERSION_MAJOR > 1) || (ELM_VERSION_MINOR > 8) // not a typo
|
||||
eldbus_message_arguments_append(msg, "sutii", _curr_url,
|
||||
time(NULL), win, x, y);
|
||||
#else
|
||||
eldbus_message_arguments_append(msg, "suxii", _curr_url,
|
||||
time(NULL), (int64_t)win, x, y);
|
||||
#endif
|
||||
eldbus_object_send(_dbus_obj, msg, NULL, NULL, -1);
|
||||
}
|
||||
|
||||
void
|
||||
_dbus_link_mouseout(uint64_t win, const char *url, int x, int y)
|
||||
{
|
||||
Eldbus_Message *msg;
|
||||
|
||||
if (!_dbus_obj) return;
|
||||
|
||||
msg = eldbus_message_method_call_new("org.enlightenment.wm.service",
|
||||
"/org/enlightenment/wm/RemoteObject",
|
||||
"org.enlightenment.wm.Teamwork",
|
||||
"LinkMouseOut");
|
||||
#if (ELM_VERSION_MAJOR > 1) || (ELM_VERSION_MINOR > 8) // not a typo
|
||||
eldbus_message_arguments_append(msg, "sutii", url,
|
||||
time(NULL), win, x, y);
|
||||
#else
|
||||
eldbus_message_arguments_append(msg, "suxii", url,
|
||||
time(NULL), (int64_t)win, x, y);
|
||||
#endif
|
||||
eldbus_object_send(_dbus_obj, msg, NULL, NULL, -1);
|
||||
eina_stringshare_replace(&_curr_url, NULL);
|
||||
}
|
||||
|
||||
#else
|
||||
void
|
||||
_dbus_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
_dbus_shutdown(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
_dbus_link_hide(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
_dbus_link_mousein(uint64_t win EINA_UNUSED, const char *url EINA_UNUSED, int x EINA_UNUSED, int y EINA_UNUSED)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
_dbus_link_mouseout(uint64_t win EINA_UNUSED, const char *url EINA_UNUSED, int x EINA_UNUSED, int y EINA_UNUSED)
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
|
@ -1,10 +0,0 @@
|
|||
#ifndef _DBUS_H_
|
||||
# define _DBUS_H_ 1
|
||||
|
||||
void _dbus_init(void);
|
||||
void _dbus_shutdown(void);
|
||||
void _dbus_link_hide(void);
|
||||
void _dbus_link_mousein(uint64_t win, const char *url, int x, int y);
|
||||
void _dbus_link_mouseout(uint64_t win, const char *url, int x, int y);
|
||||
|
||||
#endif
|
|
@ -1,101 +0,0 @@
|
|||
#include "private.h"
|
||||
#include "gravatar.h"
|
||||
#include "theme.h"
|
||||
#include "media.h"
|
||||
#include "md5/md5.h"
|
||||
|
||||
/* specific log domain to help debug the gravatar module */
|
||||
int _gravatar_log_dom = -1;
|
||||
|
||||
#undef CRIT
|
||||
#undef ERR
|
||||
#undef WRN
|
||||
#undef INF
|
||||
#undef DBG
|
||||
|
||||
#define CRIT(...) EINA_LOG_DOM_CRIT(_gravatar_log_dom, __VA_ARGS__)
|
||||
#define ERR(...) EINA_LOG_DOM_ERR (_gravatar_log_dom, __VA_ARGS__)
|
||||
#define WRN(...) EINA_LOG_DOM_WARN(_gravatar_log_dom, __VA_ARGS__)
|
||||
#define INF(...) EINA_LOG_DOM_INFO(_gravatar_log_dom, __VA_ARGS__)
|
||||
#define DBG(...) EINA_LOG_DOM_DBG (_gravatar_log_dom, __VA_ARGS__)
|
||||
|
||||
#define GRAVATAR_URL_START "http://www.gravatar.com/avatar/"
|
||||
#define GRAVATAR_URL_END ""
|
||||
|
||||
typedef struct _Gravatar
|
||||
{
|
||||
const char *url;
|
||||
} Gravatar;
|
||||
|
||||
static Evas_Object *
|
||||
_tooltip_content(void *data, Evas_Object *obj, Evas_Object *tt EINA_UNUSED)
|
||||
{
|
||||
Gravatar *g;
|
||||
Evas_Object *o;
|
||||
|
||||
g = data;
|
||||
o = _media_add(obj, g->url, MEDIA_STRETCH, MEDIA_TYPE_IMG);
|
||||
evas_object_size_hint_min_set(o, 80, 80);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
static void
|
||||
_tooltip_del(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
Gravatar *g;
|
||||
|
||||
g = data;
|
||||
eina_stringshare_del(g->url);
|
||||
free(g);
|
||||
}
|
||||
|
||||
void
|
||||
gravatar_tooltip(Evas_Object *obj, char *email)
|
||||
{
|
||||
int n;
|
||||
MD5_CTX ctx;
|
||||
char md5out[(2 * MD5_HASHBYTES) + 1];
|
||||
unsigned char hash[MD5_HASHBYTES];
|
||||
static const char hex[] = "0123456789abcdef";
|
||||
Gravatar *g;
|
||||
|
||||
g = calloc(sizeof(Gravatar), 1);
|
||||
if (!g) return;
|
||||
|
||||
eina_str_tolower(&email);
|
||||
|
||||
MD5Init(&ctx);
|
||||
MD5Update(&ctx, (unsigned char const*)email, (unsigned)strlen(email));
|
||||
MD5Final(hash, &ctx);
|
||||
|
||||
for (n = 0; n < MD5_HASHBYTES; n++)
|
||||
{
|
||||
md5out[2 * n] = hex[hash[n] >> 4];
|
||||
md5out[2 * n + 1] = hex[hash[n] & 0x0f];
|
||||
}
|
||||
md5out[2 * MD5_HASHBYTES] = '\0';
|
||||
|
||||
g->url =
|
||||
eina_stringshare_printf(GRAVATAR_URL_START"%s"GRAVATAR_URL_END, md5out);
|
||||
|
||||
elm_object_tooltip_content_cb_set(obj, _tooltip_content, g, _tooltip_del);
|
||||
}
|
||||
|
||||
void
|
||||
gravatar_init(void)
|
||||
{
|
||||
if (_gravatar_log_dom >= 0) return;
|
||||
|
||||
_gravatar_log_dom = eina_log_domain_register("gravatar", NULL);
|
||||
if (_gravatar_log_dom < 0)
|
||||
EINA_LOG_CRIT(("Could not create logging domain '%s'."), "gravatar");
|
||||
}
|
||||
|
||||
void
|
||||
gravatar_shutdown(void)
|
||||
{
|
||||
if (_gravatar_log_dom < 0) return;
|
||||
eina_log_domain_unregister(_gravatar_log_dom);
|
||||
_gravatar_log_dom = -1;
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
#ifndef _GRAVATAR_H__
|
||||
#define _GRAVATAR_H__ 1
|
||||
|
||||
#include "config.h"
|
||||
|
||||
void
|
||||
gravatar_tooltip(Evas_Object *obj, char *email);
|
||||
|
||||
void gravatar_init(void);
|
||||
void gravatar_shutdown(void);
|
||||
|
||||
#endif
|
2571
src/bin/grid.c
193
src/bin/grid.h
|
@ -1,193 +0,0 @@
|
|||
#ifndef _GRID_H_
|
||||
# define _GRID_H_ 1
|
||||
|
||||
#define COL_DEF 0
|
||||
#define COL_BLACK 1
|
||||
#define COL_RED 2
|
||||
#define COL_GREEN 3
|
||||
#define COL_YELLOW 4
|
||||
#define COL_BLUE 5
|
||||
#define COL_MAGENTA 6
|
||||
#define COL_CYAN 7
|
||||
#define COL_WHITE 8
|
||||
#define COL_INVIS 9
|
||||
|
||||
#define COL_INVERSE 10
|
||||
#define COL_INVERSEBG 11
|
||||
|
||||
typedef struct _Grid_Att Grid_Att;
|
||||
struct _Grid_Att
|
||||
{
|
||||
unsigned char fg, bg;
|
||||
unsigned short bold : 1;
|
||||
unsigned short faint : 1;
|
||||
#if defined(SUPPORT_ITALIC)
|
||||
unsigned short italic : 1;
|
||||
#endif
|
||||
#if defined(SUPPORT_DBLWIDTH)
|
||||
unsigned short dblwidth : 1;
|
||||
#endif
|
||||
unsigned short underline : 1;
|
||||
unsigned short blink : 1;
|
||||
unsigned short blink2 : 1;
|
||||
unsigned short inverse : 1;
|
||||
unsigned short invisible : 1;
|
||||
unsigned short strike : 1;
|
||||
unsigned short fg256 : 1;
|
||||
unsigned short bg256 : 1;
|
||||
unsigned short fgintense : 1;
|
||||
unsigned short bgintense : 1;
|
||||
|
||||
unsigned short autowrapped : 1;
|
||||
unsigned short newline : 1;
|
||||
unsigned short tab : 1;
|
||||
unsigned short fraktur : 1;
|
||||
#if defined(SUPPORT_80_132_COLUMNS)
|
||||
unsigned short is_80_132_mode_allowed : 1;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct _Grid_Cell Grid_Cell;
|
||||
struct _Grid_Cell
|
||||
{
|
||||
int codepoint;
|
||||
Grid_Att att;
|
||||
};
|
||||
|
||||
typedef struct _Grid_Save Grid_Save;
|
||||
struct _Grid_Save
|
||||
{
|
||||
unsigned int gen : 8;
|
||||
unsigned int comp : 1;
|
||||
unsigned int z : 1;
|
||||
unsigned int w : 22;
|
||||
Grid_Cell cell[1];
|
||||
};
|
||||
|
||||
typedef struct _Grid_Save_Comp Grid_Save_Comp;
|
||||
struct _Grid_Save_Comp
|
||||
{
|
||||
unsigned int gen : 8;
|
||||
unsigned int comp : 1;
|
||||
unsigned int z : 1;
|
||||
unsigned int w : 22; // compressed size in bytes
|
||||
unsigned int wout; // output width in Grid_Cells
|
||||
};
|
||||
|
||||
typedef struct _Grid_State Grid_State;
|
||||
struct _Grid_State
|
||||
{
|
||||
int cx, cy;
|
||||
Grid_Att att;
|
||||
unsigned char charset;
|
||||
unsigned char charsetch;
|
||||
unsigned char chset[4];
|
||||
int scroll_y1, scroll_y2;
|
||||
int had_cr_x, had_cr_y;
|
||||
int margin_top; // soon, more to come...
|
||||
unsigned int multibyte : 1;
|
||||
unsigned int alt_kp : 1;
|
||||
unsigned int insert : 1;
|
||||
unsigned int appcursor : 1;
|
||||
unsigned int wrap : 1;
|
||||
unsigned int wrapnext : 1;
|
||||
unsigned int hidecursor : 1;
|
||||
unsigned int crlf : 1;
|
||||
unsigned int had_cr : 1;
|
||||
unsigned int send_bs : 1;
|
||||
unsigned int kbd_lock : 1;
|
||||
unsigned int reverse : 1;
|
||||
unsigned int no_autorepeat : 1;
|
||||
unsigned int cjk_ambiguous_wide : 1;
|
||||
};
|
||||
|
||||
typedef struct _Grid Grid;
|
||||
struct _Grid
|
||||
{
|
||||
Evas_Object_Smart_Clipped_Data __clipped_data;
|
||||
|
||||
Evas *evas;
|
||||
Evas_Object *obj;
|
||||
Evas_Object *win;
|
||||
Evas_Object *o_event;
|
||||
Evas_Object *o_theme;
|
||||
|
||||
int w, h;
|
||||
|
||||
Eina_Unicode *buff;
|
||||
int bufflen;
|
||||
unsigned char oldbuff[4];
|
||||
|
||||
int scroll;
|
||||
int circular_offset, circular_offset2;
|
||||
int backmax, backpos, backscroll_num;
|
||||
|
||||
Grid_Cell *cells, *cells2;
|
||||
Grid_Save **back;
|
||||
Grid_State state, save, swap;
|
||||
|
||||
struct
|
||||
{
|
||||
int size, chw, chh;
|
||||
const char *name;
|
||||
} font;
|
||||
|
||||
struct
|
||||
{
|
||||
int w, h;
|
||||
Evas_Object *obj;
|
||||
} grid;
|
||||
|
||||
struct
|
||||
{
|
||||
Eina_Bool active : 1;
|
||||
} selection;
|
||||
|
||||
struct
|
||||
{
|
||||
int cx, cy, button;
|
||||
} mouse;
|
||||
|
||||
struct
|
||||
{
|
||||
char *str;
|
||||
int suspend;
|
||||
int x1, y1, x2, y2;
|
||||
Eina_List *objs;
|
||||
Eina_Bool clicked : 1;
|
||||
struct
|
||||
{
|
||||
Evas_Object *dndobj;
|
||||
Evas_Coord x, y;
|
||||
Eina_Bool down : 1;
|
||||
Eina_Bool dnd: 1;
|
||||
Eina_Bool dndobjdel : 1;
|
||||
} down;
|
||||
} link;
|
||||
|
||||
int nicklen;
|
||||
unsigned int altbuf : 1;
|
||||
|
||||
Ecore_Job *mouse_move_job;
|
||||
Ecore_Animator *anim;
|
||||
Ecore_Timer *delayed_link_up_tmr;
|
||||
Ecore_Timer *delayed_size_tmr;
|
||||
Ecore_Timer *delayed_mouse_over_tmr;
|
||||
};
|
||||
|
||||
Evas_Object *_grid_add(Evas *evas);
|
||||
void _grid_update(Evas_Object *obj);
|
||||
void _grid_window_set(Evas_Object *obj, Evas_Object *win);
|
||||
void _grid_theme_set(Evas_Object *obj, Evas_Object *theme);
|
||||
void _grid_resize(Evas_Object *obj, int nw, int nh);
|
||||
void _grid_text_append(Evas_Object *obj, const char *txt, int len, Row_Color *color);
|
||||
void _grid_nicklen_set(Evas_Object *obj, int len);
|
||||
const char *_grid_link_get(Evas_Object *obj);
|
||||
|
||||
#define GRID_CELLS(SD, X, Y) \
|
||||
SD->cells[X + (((Y + SD->circular_offset) % SD->h) * SD->w)]
|
||||
|
||||
#define GRID_FMTCLR(ATT) \
|
||||
(ATT).autowrapped = (ATT).newline = (ATT).tab = 0
|
||||
|
||||
#endif
|
|
@ -1,448 +0,0 @@
|
|||
#include "private.h"
|
||||
#include "grid_save.h"
|
||||
#include "grid.h"
|
||||
#include "lz4/lz4.h"
|
||||
#include <sys/mman.h>
|
||||
|
||||
#if defined (__MacOSX__) || (defined (__MACH__) && defined (__APPLE__))
|
||||
# ifndef MAP_ANONYMOUS
|
||||
# define MAP_ANONYMOUS MAP_ANON
|
||||
# endif
|
||||
#elif _WIN32
|
||||
# define MAP_ANONYMOUS 0
|
||||
#endif
|
||||
|
||||
#define MEM_ALLOC_ALIGN 16
|
||||
#define MEM_BLOCKS 1024
|
||||
|
||||
#define GS_MMAP_SIZE 131072
|
||||
#define GS_ALLOC_MASK (TS_MMAP_SIZE - 1)
|
||||
|
||||
typedef struct _Alloc Alloc;
|
||||
|
||||
struct _Alloc
|
||||
{
|
||||
unsigned int size, last, count, allocated;
|
||||
short slot;
|
||||
unsigned char gen;
|
||||
unsigned char __pad;
|
||||
};
|
||||
|
||||
/* local variables */
|
||||
static int freeze = 0;
|
||||
static int comp = 0;
|
||||
static int uncomp = 0;
|
||||
static int freeops = 0;
|
||||
static int compfreeze = 0;
|
||||
static unsigned char cur_gen = 0;
|
||||
static Ecore_Idler *_save_idler = NULL;
|
||||
static Ecore_Timer *_save_timer = NULL;
|
||||
static Eina_List *_grids = NULL;
|
||||
static uint64_t _allocated = 0;
|
||||
static Alloc *alloc[MEM_BLOCKS] = { 0 };
|
||||
|
||||
static int
|
||||
_alloc_roundup_block_size(int sz)
|
||||
{
|
||||
return MEM_ALLOC_ALIGN * ((sz + MEM_ALLOC_ALIGN - 1) / MEM_ALLOC_ALIGN);
|
||||
}
|
||||
|
||||
static Alloc *
|
||||
_alloc_find(void *mem)
|
||||
{
|
||||
unsigned char *memptr;
|
||||
int i;
|
||||
|
||||
memptr = mem;
|
||||
for (i = 0; i < MEM_BLOCKS; i++)
|
||||
{
|
||||
unsigned char *al;
|
||||
|
||||
al = (unsigned char *)alloc[i];
|
||||
if (!al) continue;
|
||||
if (memptr < al) continue;
|
||||
if ((al + GS_MMAP_SIZE) <= memptr) continue;
|
||||
return alloc[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void *
|
||||
_alloc_new(int size, unsigned char gen)
|
||||
{
|
||||
Alloc *al;
|
||||
unsigned char *ptr;
|
||||
unsigned int newsize, sz;
|
||||
int i, firstnull = -1;
|
||||
|
||||
// allocations sized up to nearest size alloc alignment
|
||||
newsize = _alloc_roundup_block_size(size);
|
||||
for (i = 0; i < MEM_BLOCKS; i++)
|
||||
{
|
||||
if (!alloc[i])
|
||||
{
|
||||
if (firstnull < 0) firstnull = i;
|
||||
continue;
|
||||
}
|
||||
// if generation count matches
|
||||
if (alloc[i]->gen == gen)
|
||||
{
|
||||
// if there is space in the block
|
||||
if ((alloc[i]->size - alloc[i]->last) >= newsize)
|
||||
{
|
||||
ptr = (unsigned char *)alloc[i];
|
||||
ptr += alloc[i]->last;
|
||||
alloc[i]->last += newsize;
|
||||
alloc[i]->count++;
|
||||
alloc[i]->allocated += newsize;
|
||||
_allocated += newsize;
|
||||
return ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
// out of slots for new blocks - no null blocks
|
||||
if (firstnull < 0)
|
||||
{
|
||||
ERR("Cannot find new null blocks");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// so allocate a new block
|
||||
sz = GS_MMAP_SIZE;
|
||||
// get mmaped anonymous memory so when freed it goes away from the system
|
||||
ptr = mmap(NULL, sz, PROT_READ | PROT_WRITE,
|
||||
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
if (ptr == MAP_FAILED)
|
||||
{
|
||||
ERR("Cannot allocate more memory with mmap MAP_ANONYMOUS");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// note - we SHOULD memset to 0, but we are assuming mmap anon give 0 pages
|
||||
//memset(ptr, 0, newsize);
|
||||
|
||||
al = (Alloc *)ptr;
|
||||
al->size = sz;
|
||||
al->last = sizeof(Alloc) + newsize;
|
||||
al->count = 1;
|
||||
al->allocated = newsize;
|
||||
al->slot = firstnull;
|
||||
al->gen = gen;
|
||||
_allocated += newsize;
|
||||
alloc[al->slot] = al;
|
||||
ptr = (unsigned char *)al;
|
||||
ptr += sizeof(Alloc);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static void *
|
||||
_gs_new(int size)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
if (!size) return NULL;
|
||||
ptr = _alloc_new(size, cur_gen);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static void
|
||||
_gs_free(void *ptr)
|
||||
{
|
||||
Alloc *al;
|
||||
unsigned int sz;
|
||||
Grid_Save_Comp *gs;
|
||||
|
||||
if (!ptr) return;
|
||||
|
||||
gs = ptr;
|
||||
if (gs->comp)
|
||||
sz = sizeof(Grid_Save_Comp) + gs->w;
|
||||
else
|
||||
sz = sizeof(Grid_Save) + ((gs->w - 1) * sizeof(Grid_Cell));
|
||||
sz = _alloc_roundup_block_size(sz);
|
||||
_allocated -= sz;
|
||||
|
||||
al = _alloc_find(ptr);
|
||||
if (!al)
|
||||
{
|
||||
ERR("Cannot find %p in alloc blocks", ptr);
|
||||
return;
|
||||
}
|
||||
al->count--;
|
||||
al->allocated -= sz;
|
||||
if (al->count > 0) return;
|
||||
alloc[al->slot] = NULL;
|
||||
munmap(al, al->size);
|
||||
}
|
||||
|
||||
static void
|
||||
_mem_gen_next(void)
|
||||
{
|
||||
cur_gen++;
|
||||
}
|
||||
|
||||
static unsigned char
|
||||
_mem_gen_get(void)
|
||||
{
|
||||
return cur_gen;
|
||||
}
|
||||
|
||||
static void
|
||||
_mem_defrag(void)
|
||||
{
|
||||
int i, j = 0;
|
||||
Alloc *alloc2[MEM_BLOCKS];
|
||||
|
||||
for (i = 0; i < MEM_BLOCKS; i++)
|
||||
{
|
||||
if (alloc[i])
|
||||
{
|
||||
alloc2[j] = alloc[i];
|
||||
alloc2[j]->slot = j;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
// XXX: quicksort blocks with most space at start
|
||||
for (i = 0; i < j; i++) alloc[i] = alloc2[i];
|
||||
for (; i < MEM_BLOCKS; i++) alloc[i] = NULL;
|
||||
}
|
||||
|
||||
static Grid_Save *
|
||||
_grid_save_comp(Grid_Save *gs)
|
||||
{
|
||||
Grid_Save *gs2;
|
||||
Grid_Save_Comp *gsc;
|
||||
|
||||
if (gs->comp) return gs;
|
||||
|
||||
compfreeze++;
|
||||
if (!gs->z)
|
||||
{
|
||||
int bytes;
|
||||
char *buf;
|
||||
|
||||
buf = alloca(LZ4_compressBound(gs->w * sizeof(Grid_Cell)));
|
||||
bytes = LZ4_compress((char *)(&(gs->cell[0])), buf,
|
||||
gs->w * sizeof(Grid_Cell));
|
||||
gsc = _gs_new(sizeof(Grid_Save_Comp) + bytes);
|
||||
if (!gsc)
|
||||
{
|
||||
ERR("Big problem. Can't allocate backscroll compress buffer");
|
||||
gs2 = gs;
|
||||
goto done;
|
||||
}
|
||||
gsc->comp = 1;
|
||||
gsc->z = 1;
|
||||
gsc->gen = _mem_gen_get();
|
||||
gsc->w = bytes;
|
||||
gsc->wout = gs->w;
|
||||
memcpy(((char *)gsc) + sizeof(Grid_Save_Comp), buf, bytes);
|
||||
gs2 = (Grid_Save *)gsc;
|
||||
}
|
||||
else
|
||||
{
|
||||
gsc = (Grid_Save_Comp *)gs;
|
||||
gs2 = _gs_new(sizeof(Grid_Save_Comp) + gsc->w);
|
||||
if (!gs2)
|
||||
{
|
||||
ERR("Big problem. Can't allocate backscroll compress/copy buffer");
|
||||
gs2 = gs;
|
||||
goto done;
|
||||
}
|
||||
memcpy(gs2, gs, sizeof(Grid_Save_Comp) + gsc->w);
|
||||
gs2->gen = _mem_gen_get();
|
||||
gs2->comp = 1;
|
||||
}
|
||||
|
||||
_grid_save_free(gs);
|
||||
done:
|
||||
compfreeze--;
|
||||
return gs2;
|
||||
}
|
||||
|
||||
static void
|
||||
_grid_walk(Evas_Object *obj)
|
||||
{
|
||||
Grid *sd;
|
||||
int i = 0;
|
||||
|
||||
if (!(sd = evas_object_smart_data_get(obj))) return;
|
||||
|
||||
if (!sd->back) return;
|
||||
for (; i < sd->backmax; i++)
|
||||
{
|
||||
Grid_Save_Comp *gsc;
|
||||
|
||||
gsc = (Grid_Save_Comp *)sd->back[i];
|
||||
if (gsc)
|
||||
{
|
||||
sd->back[i] = _grid_save_comp(sd->back[i]);
|
||||
if (!sd->back[i]) continue;
|
||||
|
||||
gsc = (Grid_Save_Comp *)sd->back[i];
|
||||
if (gsc->comp) comp++;
|
||||
else uncomp++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_cb_save_idler(void *data EINA_UNUSED)
|
||||
{
|
||||
Eina_List *l;
|
||||
Evas_Object *obj;
|
||||
|
||||
_mem_gen_next();
|
||||
|
||||
comp = 0;
|
||||
uncomp = 0;
|
||||
|
||||
EINA_LIST_FOREACH(_grids, l, obj)
|
||||
_grid_walk(obj);
|
||||
|
||||
_mem_defrag();
|
||||
|
||||
freeops = 0;
|
||||
|
||||
_mem_gen_next();
|
||||
|
||||
_save_idler = NULL;
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_cb_save_timer(void *data EINA_UNUSED)
|
||||
{
|
||||
if (!_save_idler)
|
||||
_save_idler = ecore_idler_add(_cb_save_idler, NULL);
|
||||
_save_timer = NULL;
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static inline void
|
||||
_grid_save_compressor_check(Eina_Bool frozen)
|
||||
{
|
||||
if (freeze) return;
|
||||
if (_save_idler) return;
|
||||
|
||||
if ((uncomp > 256) || (freeops > 256))
|
||||
{
|
||||
if ((_save_timer) && (!frozen))
|
||||
ecore_timer_reset(_save_timer);
|
||||
else if (!_save_timer)
|
||||
_save_timer = ecore_timer_add(0.2, _cb_save_timer, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_grid_save_register(Evas_Object *obj)
|
||||
{
|
||||
_grid_save_freeze();
|
||||
_grids = eina_list_append(_grids, obj);
|
||||
_grid_save_thaw();
|
||||
}
|
||||
|
||||
void
|
||||
_grid_save_unregister(Evas_Object *obj)
|
||||
{
|
||||
_grid_save_freeze();
|
||||
_grids = eina_list_remove(_grids, obj);
|
||||
_grid_save_thaw();
|
||||
}
|
||||
|
||||
void
|
||||
_grid_save_freeze(void)
|
||||
{
|
||||
if (!freeze++)
|
||||
{
|
||||
if (_save_timer) ecore_timer_freeze(_save_timer);
|
||||
}
|
||||
|
||||
if (_save_idler) ecore_idler_del(_save_idler);
|
||||
_save_idler = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
_grid_save_thaw(void)
|
||||
{
|
||||
freeze--;
|
||||
if (freeze <= 0)
|
||||
{
|
||||
if (_save_timer) ecore_timer_thaw(_save_timer);
|
||||
_grid_save_compressor_check(EINA_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
Grid_Save *
|
||||
_grid_save_new(int w)
|
||||
{
|
||||
Grid_Save *gs;
|
||||
|
||||
gs = _gs_new(sizeof(Grid_Save) + ((w - 1) * sizeof(Grid_Cell)));
|
||||
if (!gs) return NULL;
|
||||
|
||||
gs->gen = _mem_gen_get();
|
||||
gs->w = w;
|
||||
if (!compfreeze) uncomp++;
|
||||
_grid_save_compressor_check(EINA_FALSE);
|
||||
|
||||
return gs;
|
||||
}
|
||||
|
||||
void
|
||||
_grid_save_free(Grid_Save *gs)
|
||||
{
|
||||
if (!gs) return;
|
||||
if (!compfreeze)
|
||||
{
|
||||
if (gs->comp) comp--;
|
||||
else uncomp--;
|
||||
freeops++;
|
||||
}
|
||||
_gs_free(gs);
|
||||
_grid_save_compressor_check(EINA_FALSE);
|
||||
}
|
||||
|
||||
Grid_Save *
|
||||
_grid_save_extract(Grid_Save *gs)
|
||||
{
|
||||
if (!gs) return NULL;
|
||||
|
||||
if (gs->z)
|
||||
{
|
||||
Grid_Save_Comp *gsc;
|
||||
Grid_Save *gs2;
|
||||
char *buf;
|
||||
int bytes;
|
||||
|
||||
gsc = (Grid_Save_Comp *)gs;
|
||||
|
||||
gs2 = _gs_new(sizeof(Grid_Save) + ((gsc->wout - 1) * sizeof(Grid_Cell)));
|
||||
if (!gs2) return NULL;
|
||||
|
||||
gs2->gen = _mem_gen_get();
|
||||
gs2->w = gsc->wout;
|
||||
buf = ((char *)gsc) + sizeof(Grid_Save_Comp);
|
||||
bytes = LZ4_uncompress(buf, (char *)(&(gs2->cell[0])),
|
||||
gsc->wout * sizeof(Grid_Cell));
|
||||
if (bytes < 0)
|
||||
{
|
||||
memset(&(gs2->cell[0]), 0, gsc->wout * sizeof(Grid_Cell));
|
||||
}
|
||||
if (gs->comp) comp--;
|
||||
else uncomp--;
|
||||
uncomp++;
|
||||
freeops++;
|
||||
compfreeze++;
|
||||
_gs_free(gs);
|
||||
compfreeze--;
|
||||
_grid_save_compressor_check(EINA_FALSE);
|
||||
return gs2;
|
||||
}
|
||||
|
||||
_grid_save_compressor_check(EINA_FALSE);
|
||||
return gs;
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
#ifndef _GRID_SAVE_H
|
||||
# define _GRID_SAVE_H 1
|
||||
|
||||
# include "grid.h"
|
||||
|
||||
void _grid_save_register(Evas_Object *obj);
|
||||
void _grid_save_unregister(Evas_Object *obj);
|
||||
void _grid_save_freeze(void);
|
||||
void _grid_save_thaw(void);
|
||||
Grid_Save *_grid_save_new(int w);
|
||||
void _grid_save_free(Grid_Save *gs);
|
||||
Grid_Save *_grid_save_extract(Grid_Save *gs);
|
||||
|
||||
#endif
|
|
@ -1,24 +0,0 @@
|
|||
LZ4 Library
|
||||
Copyright (c) 2011-2014, Yann Collet
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -1,54 +0,0 @@
|
|||
LZ4 - Extremely fast compression
|
||||
================================
|
||||
|
||||
LZ4 is lossless compression algorithm, providing compression speed at 400 MB/s per core, scalable with multi-cores CPU. It also features an extremely fast decoder, with speed in multiple GB/s per core, typically reaching RAM speed limits on multi-core systems.
|
||||
A high compression derivative, called LZ4_HC, is also provided. It trades CPU time for compression ratio.
|
||||
|
||||
|Branch |Status |
|
||||
|------------|---------|
|
||||
|master | [![Build Status](https://travis-ci.org/Cyan4973/lz4.svg?branch=master)](https://travis-ci.org/Cyan4973/lz4) |
|
||||
|dev | [![Build Status](https://travis-ci.org/Cyan4973/lz4.svg?branch=dev)](https://travis-ci.org/Cyan4973/lz4) |
|
||||
|
||||
This is an official mirror of LZ4 project, [hosted on Google Code](http://code.google.com/p/lz4/).
|
||||
The intention is to offer github's capabilities to lz4 users, such as cloning, branch, or source download.
|
||||
|
||||
The "master" branch will reflect, the status of lz4 at its official homepage. Other branches will also exist, typically to fix some open issues or new requirements, and be available for testing before merge into master.
|
||||
|
||||
|
||||
Benchmarks
|
||||
-------------------------
|
||||
|
||||
The benchmark uses the [Open-Source Benchmark program by m^2 (v0.14.2)](http://encode.ru/threads/1371-Filesystem-benchmark?p=33548&viewfull=1#post33548) compiled with GCC v4.6.1 on Linux Ubuntu 64-bits v11.10,
|
||||
The reference system uses a Core i5-3340M @2.7GHz.
|
||||
Benchmark evaluates the compression of reference [Silesia Corpus](http://sun.aei.polsl.pl/~sdeor/index.php?page=silesia) in single-thread mode.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Compressor</th><th>Ratio</th><th>Compression</th><th>Decompression</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>LZ4 (r101)</th><th>2.084</th><th>422 MB/s</th><th>1820 MB/s</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>LZO 2.06</th><th>2.106</th><th>414 MB/s</th><th>600 MB/s</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>QuickLZ 1.5.1b6</th><th>2.237</th><th>373 MB/s</th><th>420 MB/s</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Snappy 1.1.0</th><th>2.091</th><th>323 MB/s</th><th>1070 MB/s</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>LZF</th><th>2.077</th><th>270 MB/s</th><th>570 MB/s</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>zlib 1.2.8 -1</th><th>2.730</th><th>65 MB/s</th><th>280 MB/s</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>LZ4 HC (r101)</th><th>2.720</th><th>25 MB/s</th><th>2080 MB/s</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>zlib 1.2.8 -6</th><th>3.099</th><th>21 MB/s</th><th>300 MB/s</th>
|
||||
</tr>
|
||||
</table>
|
||||
|
1247
src/bin/lz4/lz4.c
|
@ -1,306 +0,0 @@
|
|||
/*
|
||||
LZ4 - Fast LZ compression algorithm
|
||||
Header File
|
||||
Copyright (C) 2011-2014, Yann Collet.
|
||||
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
You can contact the author at :
|
||||
- LZ4 source repository : http://code.google.com/p/lz4/
|
||||
- LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/**************************************
|
||||
Version
|
||||
**************************************/
|
||||
#define LZ4_VERSION_MAJOR 1 /* for major interface/format changes */
|
||||
#define LZ4_VERSION_MINOR 2 /* for minor interface/format changes */
|
||||
#define LZ4_VERSION_RELEASE 0 /* for tweaks, bug-fixes, or development */
|
||||
|
||||
|
||||
/**************************************
|
||||
Tuning parameter
|
||||
**************************************/
|
||||
/*
|
||||
* LZ4_MEMORY_USAGE :
|
||||
* Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB; etc.)
|
||||
* Increasing memory usage improves compression ratio
|
||||
* Reduced memory usage can improve speed, due to cache effect
|
||||
* Default value is 14, for 16KB, which nicely fits into Intel x86 L1 cache
|
||||
*/
|
||||
#define LZ4_MEMORY_USAGE 14
|
||||
|
||||
|
||||
/**************************************
|
||||
Simple Functions
|
||||
**************************************/
|
||||
|
||||
int LZ4_compress (const char* source, char* dest, int inputSize);
|
||||
int LZ4_decompress_safe (const char* source, char* dest, int compressedSize, int maxOutputSize);
|
||||
|
||||
/*
|
||||
LZ4_compress() :
|
||||
Compresses 'inputSize' bytes from 'source' into 'dest'.
|
||||
Destination buffer must be already allocated,
|
||||
and must be sized to handle worst cases situations (input data not compressible)
|
||||
Worst case size evaluation is provided by function LZ4_compressBound()
|
||||
inputSize : Max supported value is LZ4_MAX_INPUT_VALUE
|
||||
return : the number of bytes written in buffer dest
|
||||
or 0 if the compression fails
|
||||
|
||||
LZ4_decompress_safe() :
|
||||
compressedSize : is obviously the source size
|
||||
maxOutputSize : is the size of the destination buffer, which must be already allocated.
|
||||
return : the number of bytes decoded in the destination buffer (necessarily <= maxOutputSize)
|
||||
If the destination buffer is not large enough, decoding will stop and output an error code (<0).
|
||||
If the source stream is detected malformed, the function will stop decoding and return a negative result.
|
||||
This function is protected against buffer overflow exploits :
|
||||
it never writes outside of output buffer, and never reads outside of input buffer.
|
||||
Therefore, it is protected against malicious data packets.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
Note :
|
||||
Should you prefer to explicitly allocate compression-table memory using your own allocation method,
|
||||
use the streaming functions provided below, simply reset the memory area between each call to LZ4_compress_continue()
|
||||
*/
|
||||
|
||||
|
||||
/**************************************
|
||||
Advanced Functions
|
||||
**************************************/
|
||||
#define LZ4_MAX_INPUT_SIZE 0x7E000000 /* 2 113 929 216 bytes */
|
||||
#define LZ4_COMPRESSBOUND(isize) ((unsigned int)(isize) > (unsigned int)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)
|
||||
|
||||
/*
|
||||
LZ4_compressBound() :
|
||||
Provides the maximum size that LZ4 may output in a "worst case" scenario (input data not compressible)
|
||||
primarily useful for memory allocation of output buffer.
|
||||
macro is also provided when result needs to be evaluated at compilation (such as stack memory allocation).
|
||||
|
||||
isize : is the input size. Max supported value is LZ4_MAX_INPUT_SIZE
|
||||
return : maximum output size in a "worst case" scenario
|
||||
or 0, if input size is too large ( > LZ4_MAX_INPUT_SIZE)
|
||||
*/
|
||||
int LZ4_compressBound(int isize);
|
||||
|
||||
|
||||
/*
|
||||
LZ4_compress_limitedOutput() :
|
||||
Compress 'inputSize' bytes from 'source' into an output buffer 'dest' of maximum size 'maxOutputSize'.
|
||||
If it cannot achieve it, compression will stop, and result of the function will be zero.
|
||||
This function never writes outside of provided output buffer.
|
||||
|
||||
inputSize : Max supported value is LZ4_MAX_INPUT_VALUE
|
||||
maxOutputSize : is the size of the destination buffer (which must be already allocated)
|
||||
return : the number of bytes written in buffer 'dest'
|
||||
or 0 if the compression fails
|
||||
*/
|
||||
int LZ4_compress_limitedOutput (const char* source, char* dest, int inputSize, int maxOutputSize);
|
||||
|
||||
|
||||
/*
|
||||
LZ4_decompress_fast() :
|
||||
originalSize : is the original and therefore uncompressed size
|
||||
return : the number of bytes read from the source buffer (in other words, the compressed size)
|
||||
If the source stream is malformed, the function will stop decoding and return a negative result.
|
||||
Destination buffer must be already allocated. Its size must be a minimum of 'originalSize' bytes.
|
||||
note : This function is a bit faster than LZ4_decompress_safe()
|
||||
It provides fast decompression and fully respect memory boundaries for properly formed compressed data.
|
||||
It does not provide full protection against intentionnally modified data stream.
|
||||
Use this function in a trusted environment (data to decode comes from a trusted source).
|
||||
*/
|
||||
int LZ4_decompress_fast (const char* source, char* dest, int originalSize);
|
||||
|
||||
|
||||
/*
|
||||
LZ4_decompress_safe_partial() :
|
||||
This function decompress a compressed block of size 'compressedSize' at position 'source'
|
||||
into output buffer 'dest' of size 'maxOutputSize'.
|
||||
The function tries to stop decompressing operation as soon as 'targetOutputSize' has been reached,
|
||||
reducing decompression time.
|
||||
return : the number of bytes decoded in the destination buffer (necessarily <= maxOutputSize)
|
||||
Note : this number can be < 'targetOutputSize' should the compressed block to decode be smaller.
|
||||
Always control how many bytes were decoded.
|
||||
If the source stream is detected malformed, the function will stop decoding and return a negative result.
|
||||
This function never writes outside of output buffer, and never reads outside of input buffer. It is therefore protected against malicious data packets
|
||||
*/
|
||||
int LZ4_decompress_safe_partial (const char* source, char* dest, int compressedSize, int targetOutputSize, int maxOutputSize);
|
||||
|
||||
|
||||
/***********************************************
|
||||
Experimental Streaming Compression Functions
|
||||
***********************************************/
|
||||
|
||||
#define LZ4_STREAMSIZE_U32 ((1 << (LZ4_MEMORY_USAGE-2)) + 8)
|
||||
#define LZ4_STREAMSIZE (LZ4_STREAMSIZE_U32 * sizeof(unsigned int))
|
||||
/*
|
||||
* LZ4_stream_t
|
||||
* information structure to track an LZ4 stream.
|
||||
* important : set this structure content to zero before first use !
|
||||
*/
|
||||
typedef struct { unsigned int table[LZ4_STREAMSIZE_U32]; } LZ4_stream_t;
|
||||
|
||||
/*
|
||||
* If you prefer dynamic allocation methods,
|
||||
* LZ4_createStream
|
||||
* provides a pointer (void*) towards an initialized LZ4_stream_t structure.
|
||||
* LZ4_free just frees it.
|
||||
*/
|
||||
void* LZ4_createStream();
|
||||
int LZ4_free (void* LZ4_stream);
|
||||
|
||||
|
||||
/*
|
||||
* LZ4_loadDict
|
||||
* Use this function to load a static dictionary into LZ4_stream.
|
||||
* Any previous data will be forgotten, only 'dictionary' will remain in memory.
|
||||
* Loading a size of 0 is allowed (same effect as init).
|
||||
* Return : 1 if OK, 0 if error
|
||||
*/
|
||||
int LZ4_loadDict (void* LZ4_stream, const char* dictionary, int dictSize);
|
||||
|
||||
/*
|
||||
* LZ4_compress_continue
|
||||
* Compress data block 'source', using blocks compressed before as dictionary to improve compression ratio
|
||||
* Previous data blocks are assumed to still be present at their previous location.
|
||||
*/
|
||||
int LZ4_compress_continue (void* LZ4_stream, const char* source, char* dest, int inputSize);
|
||||
|
||||
/*
|
||||
* LZ4_compress_limitedOutput_continue
|
||||
* Same as before, but also specify a maximum target compressed size (maxOutputSize)
|
||||
* If objective cannot be met, compression exits, and returns a zero.
|
||||
*/
|
||||
int LZ4_compress_limitedOutput_continue (void* LZ4_stream, const char* source, char* dest, int inputSize, int maxOutputSize);
|
||||
|
||||
/*
|
||||
* LZ4_saveDict
|
||||
* If previously compressed data block is not guaranteed to remain at its previous memory location
|
||||
* save it into a safe place (char* safeBuffer)
|
||||
* Note : you don't need to call LZ4_loadDict() afterwards,
|
||||
* dictionary is immediately usable, you can therefore call again LZ4_compress_continue()
|
||||
* Return : 1 if OK, 0 if error
|
||||
* Note : any dictSize > 64 KB will be interpreted as 64KB.
|
||||
*/
|
||||
int LZ4_saveDict (void* LZ4_stream, char* safeBuffer, int dictSize);
|
||||
|
||||
|
||||
/************************************************
|
||||
Experimental Streaming Decompression Functions
|
||||
************************************************/
|
||||
|
||||
#define LZ4_STREAMDECODESIZE_U32 4
|
||||
#define LZ4_STREAMDECODESIZE (LZ4_STREAMDECODESIZE_U32 * sizeof(unsigned int))
|
||||
/*
|
||||
* LZ4_streamDecode_t
|
||||
* information structure to track an LZ4 stream.
|
||||
* important : set this structure content to zero before first use !
|
||||
*/
|
||||
typedef struct { unsigned int table[LZ4_STREAMDECODESIZE_U32]; } LZ4_streamDecode_t;
|
||||
|
||||
/*
|
||||
* If you prefer dynamic allocation methods,
|
||||
* LZ4_createStreamDecode()
|
||||
* provides a pointer (void*) towards an initialized LZ4_streamDecode_t structure.
|
||||
* LZ4_free just frees it.
|
||||
*/
|
||||
void* LZ4_createStreamDecode();
|
||||
int LZ4_free (void* LZ4_stream); /* yes, it's the same one as for compression */
|
||||
|
||||
/*
|
||||
*_continue() :
|
||||
These decoding functions allow decompression of multiple blocks in "streaming" mode.
|
||||
Previously decoded blocks must still be available at the memory position where they were decoded.
|
||||
If it's not possible, save the relevant part of decoded data into a safe buffer,
|
||||
and indicate where it stands using LZ4_setDictDecode()
|
||||
*/
|
||||
int LZ4_decompress_safe_continue (void* LZ4_streamDecode, const char* source, char* dest, int compressedSize, int maxOutputSize);
|
||||
int LZ4_decompress_fast_continue (void* LZ4_streamDecode, const char* source, char* dest, int originalSize);
|
||||
|
||||
/*
|
||||
* LZ4_setDictDecode
|
||||
* Use this function to instruct where to find the dictionary.
|
||||
* This function can be used to specify a static dictionary,
|
||||
* or to instruct where to find some previously decoded data saved into a different memory space.
|
||||
* Setting a size of 0 is allowed (same effect as no dictionary).
|
||||
* Return : 1 if OK, 0 if error
|
||||
*/
|
||||
int LZ4_setDictDecode (void* LZ4_streamDecode, const char* dictionary, int dictSize);
|
||||
|
||||
|
||||
/*
|
||||
Advanced decoding functions :
|
||||
*_usingDict() :
|
||||
These decoding functions work the same as
|
||||
a combination of LZ4_setDictDecode() followed by LZ4_decompress_x_continue()
|
||||
all together into a single function call.
|
||||
It doesn't use nor update an LZ4_streamDecode_t structure.
|
||||
*/
|
||||
int LZ4_decompress_safe_usingDict (const char* source, char* dest, int compressedSize, int maxOutputSize, const char* dictStart, int dictSize);
|
||||
int LZ4_decompress_fast_usingDict (const char* source, char* dest, int originalSize, const char* dictStart, int dictSize);
|
||||
|
||||
|
||||
|
||||
|
||||
/**************************************
|
||||
Obsolete Functions
|
||||
**************************************/
|
||||
/*
|
||||
Obsolete decompression functions
|
||||
These function names are deprecated and should no longer be used.
|
||||
They are only provided here for compatibility with older user programs.
|
||||
- LZ4_uncompress is the same as LZ4_decompress_fast
|
||||
- LZ4_uncompress_unknownOutputSize is the same as LZ4_decompress_safe
|
||||
*/
|
||||
int LZ4_uncompress (const char* source, char* dest, int outputSize);
|
||||
int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize, int maxOutputSize);
|
||||
|
||||
/* Obsolete functions for externally allocated state; use streaming interface instead */
|
||||
int LZ4_sizeofState(void);
|
||||
int LZ4_compress_withState (void* state, const char* source, char* dest, int inputSize);
|
||||
int LZ4_compress_limitedOutput_withState (void* state, const char* source, char* dest, int inputSize, int maxOutputSize);
|
||||
|
||||
/* Obsolete streaming functions; use new streaming interface whenever possible */
|
||||
void* LZ4_create (const char* inputBuffer);
|
||||
int LZ4_sizeofStreamState(void);
|
||||
int LZ4_resetStreamState(void* state, const char* inputBuffer);
|
||||
char* LZ4_slideInputBuffer (void* state);
|
||||
|
||||
/* Obsolete streaming decoding functions */
|
||||
int LZ4_decompress_safe_withPrefix64k (const char* source, char* dest, int compressedSize, int maxOutputSize);
|
||||
int LZ4_decompress_fast_withPrefix64k (const char* source, char* dest, int originalSize);
|
||||
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
|
@ -1,15 +1,9 @@
|
|||
#include "private.h"
|
||||
#include "config.h"
|
||||
#include "theme.h"
|
||||
#include "window.h"
|
||||
#include "dbus.h"
|
||||
#include "gravatar.h"
|
||||
|
||||
/* external variables */
|
||||
int _log_dom = -1;
|
||||
|
||||
/* public functions */
|
||||
EAPI_MAIN int
|
||||
EAPI_MAIN int
|
||||
elm_main(int argc, char **argv)
|
||||
{
|
||||
int i = 0;
|
||||
|
@ -29,19 +23,12 @@ elm_main(int argc, char **argv)
|
|||
if (_log_dom < 0)
|
||||
{
|
||||
EINA_LOG_CRIT("Could not create logging domain");
|
||||
elm_shutdown();
|
||||
return EXIT_FAILURE;
|
||||
goto log_err;
|
||||
}
|
||||
|
||||
/* try to init config subsystem */
|
||||
if (!_config_init()) goto config_err;
|
||||
|
||||
/* try to init express library */
|
||||
/* init express library */
|
||||
if (!express_init()) goto express_err;
|
||||
|
||||
_dbus_init();
|
||||
gravatar_init();
|
||||
|
||||
/* set elm policy */
|
||||
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
|
||||
|
||||
|
@ -54,30 +41,18 @@ elm_main(int argc, char **argv)
|
|||
elm_app_info_set(elm_main, PACKAGE_NAME, "themes/default.edj");
|
||||
elm_app_name_set("Express");
|
||||
|
||||
/* set elm theme overlay */
|
||||
elm_theme_overlay_add(NULL, _theme_default_get());
|
||||
|
||||
/* try to create main window */
|
||||
if (!_window_create()) goto win_err;
|
||||
/* create main window */
|
||||
if (!_win_create()) goto win_err;
|
||||
|
||||
/* start main loop */
|
||||
elm_run();
|
||||
|
||||
gravatar_shutdown();
|
||||
_dbus_shutdown();
|
||||
|
||||
/* destroy main window */
|
||||
_window_destroy();
|
||||
|
||||
/* clear elm theme overlay */
|
||||
elm_theme_overlay_del(NULL, _theme_default_get());
|
||||
_win_destroy();
|
||||
|
||||
/* shutdown express library */
|
||||
express_shutdown();
|
||||
|
||||
/* shutdown config subystem */
|
||||
_config_shutdown();
|
||||
|
||||
/* unregister log domain */
|
||||
eina_log_domain_unregister(_log_dom);
|
||||
_log_dom = -1;
|
||||
|
@ -88,23 +63,13 @@ elm_main(int argc, char **argv)
|
|||
return EXIT_SUCCESS;
|
||||
|
||||
win_err:
|
||||
/* clear elm theme overlay */
|
||||
elm_theme_overlay_del(NULL, _theme_default_get());
|
||||
|
||||
gravatar_shutdown();
|
||||
_dbus_shutdown();
|
||||
|
||||
/* shutdown express library */
|
||||
express_shutdown();
|
||||
express_err:
|
||||
/* shutdown config subystem */
|
||||
_config_shutdown();
|
||||
config_err:
|
||||
/* unregister log domain */
|
||||
eina_log_domain_unregister(_log_dom);
|
||||
_log_dom = -1;
|
||||
|
||||
/* shutdown elementary */
|
||||
log_err:
|
||||
elm_shutdown();
|
||||
|
||||
return EXIT_FAILURE;
|
||||
|
|
|
@ -1,252 +0,0 @@
|
|||
/*
|
||||
* This code implements the MD5 message-digest algorithm.
|
||||
* The algorithm is due to Ron Rivest. This code was
|
||||
* written by Colin Plumb in 1993, no copyright is claimed.
|
||||
* This code is in the public domain; do with it what you wish.
|
||||
*
|
||||
* Equivalent code is available from RSA Data Security, Inc.
|
||||
* This code has been tested against that, and is equivalent,
|
||||
* except that you don't need to include two pages of legalese
|
||||
* with every copy.
|
||||
*
|
||||
* To compute the message digest of a chunk of bytes, declare an
|
||||
* MD5Context structure, pass it to MD5Init, call MD5Update as
|
||||
* needed on buffers full of bytes, and then call MD5Final, which
|
||||
* will fill a supplied 16-byte array with the digest.
|
||||
*/
|
||||
|
||||
#include "Eina.h"
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <string.h> /* for memcpy() */
|
||||
#include "md5.h"
|
||||
|
||||
#if (__BYTE_ORDER == 1234)
|
||||
#define byteReverse(buf, len) /* Nothing */
|
||||
#else
|
||||
void byteReverse(unsigned char *buf, unsigned longs);
|
||||
|
||||
/*
|
||||
* Note: this code is harmless on little-endian machines.
|
||||
*/
|
||||
void byteReverse(unsigned char *buf, unsigned longs)
|
||||
{
|
||||
uint32_t t;
|
||||
do {
|
||||
t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
|
||||
((unsigned) buf[1] << 8 | buf[0]);
|
||||
*(uint32_t *) buf = t;
|
||||
buf += 4;
|
||||
} while (--longs);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
|
||||
* initialization constants.
|
||||
*/
|
||||
void MD5Init(MD5_CTX *ctx)
|
||||
{
|
||||
ctx->buf[0] = 0x67452301;
|
||||
ctx->buf[1] = 0xefcdab89;
|
||||
ctx->buf[2] = 0x98badcfe;
|
||||
ctx->buf[3] = 0x10325476;
|
||||
|
||||
ctx->bits[0] = 0;
|
||||
ctx->bits[1] = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Update context to reflect the concatenation of another buffer full
|
||||
* of bytes.
|
||||
*/
|
||||
void MD5Update(MD5_CTX *ctx, unsigned char const *buf, unsigned len)
|
||||
{
|
||||
uint32_t t;
|
||||
|
||||
/* Update bitcount */
|
||||
|
||||
t = ctx->bits[0];
|
||||
if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t)
|
||||
ctx->bits[1]++; /* Carry from low to high */
|
||||
ctx->bits[1] += len >> 29;
|
||||
|
||||
t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
|
||||
|
||||
/* Handle any leading odd-sized chunks */
|
||||
|
||||
if (t) {
|
||||
unsigned char *p = ctx->in.s + t;
|
||||
|
||||
t = 64 - t;
|
||||
if (len < t) {
|
||||
memcpy(p, buf, len);
|
||||
return;
|
||||
}
|
||||
memcpy(p, buf, t);
|
||||
byteReverse(ctx->in.s, 16);
|
||||
MD5Transform(ctx->buf, ctx->in.i);
|
||||
buf += t;
|
||||
len -= t;
|
||||
}
|
||||
/* Process data in 64-byte chunks */
|
||||
|
||||
while (len >= 64) {
|
||||
memcpy(ctx->in.s, buf, 64);
|
||||
byteReverse(ctx->in.s, 16);
|
||||
MD5Transform(ctx->buf, ctx->in.i);
|
||||
buf += 64;
|
||||
len -= 64;
|
||||
}
|
||||
|
||||
/* Handle any remaining bytes of data. */
|
||||
|
||||
memcpy(ctx->in.s, buf, len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Final wrapup - pad to 64-byte boundary with the bit pattern
|
||||
* 1 0* (64-bit count of bits processed, MSB-first)
|
||||
*/
|
||||
void MD5Final(unsigned char digest[16], MD5_CTX *ctx)
|
||||
{
|
||||
unsigned count;
|
||||
unsigned char *p;
|
||||
|
||||
/* Compute number of bytes mod 64 */
|
||||
count = (ctx->bits[0] >> 3) & 0x3F;
|
||||
|
||||
/* Set the first char of padding to 0x80. This is safe since there is
|
||||
always at least one byte free */
|
||||
p = ctx->in.s + count;
|
||||
*p++ = 0x80;
|
||||
|
||||
/* Bytes of padding needed to make 64 bytes */
|
||||
count = 64 - 1 - count;
|
||||
|
||||
/* Pad out to 56 mod 64 */
|
||||
if (count < 8) {
|
||||
/* Two lots of padding: Pad the first block to 64 bytes */
|
||||
memset(p, 0, count);
|
||||
byteReverse(ctx->in.s, 16);
|
||||
MD5Transform(ctx->buf, ctx->in.i);
|
||||
|
||||
/* Now fill the next block with 56 bytes */
|
||||
memset(ctx->in.s, 0, 56);
|
||||
} else {
|
||||
/* Pad block to 56 bytes */
|
||||
memset(p, 0, count - 8);
|
||||
}
|
||||
byteReverse(ctx->in.s, 14);
|
||||
|
||||
/* Append length in bits and transform */
|
||||
ctx->in.i[14] = ctx->bits[0];
|
||||
ctx->in.i[15] = ctx->bits[1];
|
||||
|
||||
MD5Transform(ctx->buf, ctx->in.i);
|
||||
byteReverse((unsigned char *) ctx->buf, 4);
|
||||
memcpy(digest, ctx->buf, 16);
|
||||
memset(ctx, 0, sizeof(MD5_CTX)); /* In case it's sensitive */
|
||||
}
|
||||
|
||||
/* The four core functions - F1 is optimized somewhat */
|
||||
|
||||
/* #define F1(x, y, z) (x & y | ~x & z) */
|
||||
#define F1(x, y, z) (z ^ (x & (y ^ z)))
|
||||
#define F2(x, y, z) F1(z, x, y)
|
||||
#define F3(x, y, z) (x ^ y ^ z)
|
||||
#define F4(x, y, z) (y ^ (x | ~z))
|
||||
|
||||
/* This is the central step in the MD5 algorithm. */
|
||||
#define MD5STEP(f, w, x, y, z, data, s) \
|
||||
( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
|
||||
|
||||
/*
|
||||
* The core of the MD5 algorithm, this alters an existing MD5 hash to
|
||||
* reflect the addition of 16 longwords of new data. MD5Update blocks
|
||||
* the data and converts bytes into longwords for this routine.
|
||||
*/
|
||||
void MD5Transform(uint32_t buf[4], uint32_t const in[16])
|
||||
{
|
||||
register uint32_t a, b, c, d;
|
||||
|
||||
a = buf[0];
|
||||
b = buf[1];
|
||||
c = buf[2];
|
||||
d = buf[3];
|
||||
|
||||
MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
|
||||
|
||||
MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
|
||||
|
||||
MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
|
||||
|
||||
MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
|
||||
|
||||
buf[0] += a;
|
||||
buf[1] += b;
|
||||
buf[2] += c;
|
||||
buf[3] += d;
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
#ifndef _MD5_H_
|
||||
#define _MD5_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define MD5_HASHBYTES 16
|
||||
|
||||
typedef struct MD5Context {
|
||||
uint32_t buf[4];
|
||||
uint32_t bits[2];
|
||||
union
|
||||
{
|
||||
unsigned char s[64];
|
||||
uint32_t i[16];
|
||||
} in;
|
||||
} MD5_CTX;
|
||||
|
||||
extern void MD5Init(MD5_CTX *context);
|
||||
extern void MD5Update(MD5_CTX *context,unsigned char const *buf,unsigned len);
|
||||
extern void MD5Final(unsigned char digest[MD5_HASHBYTES], MD5_CTX *context);
|
||||
|
||||
extern void MD5Transform(uint32_t buf[4], uint32_t const in[16]);
|
||||
extern char *MD5End(MD5_CTX *, char *);
|
||||
extern char *MD5File(const char *, char *);
|
||||
extern char *MD5Data (const unsigned char *, unsigned int, char *);
|
||||
|
||||
#endif
|
1463
src/bin/media.c
|
@ -1,41 +0,0 @@
|
|||
#ifndef _MEDIA_H__
|
||||
# define _MEDIA_H__ 1
|
||||
|
||||
# define MEDIA_SIZE_MASK 0x000f
|
||||
# define MEDIA_OPTIONS_MASK 0x00f0
|
||||
// enum list types
|
||||
# define MEDIA_BG 0x0000
|
||||
# define MEDIA_POP 0x0001
|
||||
# define MEDIA_STRETCH 0x0002
|
||||
# define MEDIA_THUMB 0x0003
|
||||
# define MEDIA_TOOLTIP 0x0004
|
||||
// bitmask for options - on or off
|
||||
# define MEDIA_RECOVER 0x0010
|
||||
# define MEDIA_SAVE 0x0020
|
||||
|
||||
typedef enum _Media_Type Media_Type;
|
||||
|
||||
enum _Media_Type
|
||||
{
|
||||
MEDIA_TYPE_UNKNOWN,
|
||||
MEDIA_TYPE_IMG,
|
||||
MEDIA_TYPE_SCALE,
|
||||
MEDIA_TYPE_EDJE,
|
||||
MEDIA_TYPE_MOV,
|
||||
MEDIA_TYPE_THUMB,
|
||||
};
|
||||
|
||||
Evas_Object *_media_add(Evas_Object *parent, const char *src, int mode, Media_Type type);
|
||||
void _media_mute_set(Evas_Object *obj, Eina_Bool mute);
|
||||
void _media_play_set(Evas_Object *obj, Eina_Bool play);
|
||||
Eina_Bool _media_play_get(Evas_Object *obj);
|
||||
void _media_position_set(Evas_Object *obj, double pos);
|
||||
void _media_volume_set(Evas_Object *obj, double vol);
|
||||
void _media_visualize_set(Evas_Object *obj, Eina_Bool visualize);
|
||||
void _media_stop(Evas_Object *obj);
|
||||
const char *_media_get(const Evas_Object *obj);
|
||||
Media_Type _media_src_type_get(const char *src);
|
||||
Evas_Object *_media_control_get(Evas_Object *obj);
|
||||
void _media_unknown_handle(const char *handler, const char *src);
|
||||
|
||||
#endif
|
|
@ -1,243 +0,0 @@
|
|||
#include "private.h"
|
||||
#include "options.h"
|
||||
#include "options_general.h"
|
||||
#include "options_font.h"
|
||||
#include "options_colors.h"
|
||||
#include "options_video.h"
|
||||
#include "options_networks.h"
|
||||
#include "options_tools.h"
|
||||
|
||||
/* local variables */
|
||||
static Evas_Object *o_win = NULL;
|
||||
static Evas_Object *o_base = NULL;
|
||||
static Evas_Object *o_frame = NULL;
|
||||
static Evas_Object *o_dismiss = NULL;
|
||||
static Evas_Object *o_box = NULL;
|
||||
static Evas_Object *o_tbr = NULL;
|
||||
static Ecore_Timer *_opts_del_timer = NULL;
|
||||
static Eina_Bool _opts_out = EINA_FALSE;
|
||||
static void (*_opts_cb_done)(void *data) = NULL;
|
||||
static void *_opts_cb_data = NULL;
|
||||
|
||||
static enum _opt_mode
|
||||
{
|
||||
OPTION_NONE = 0,
|
||||
OPTION_GENERAL,
|
||||
OPTION_FONT,
|
||||
OPTION_COLORS,
|
||||
OPTION_VIDEO,
|
||||
OPTION_NETWORKS
|
||||
} _mode = 0;
|
||||
|
||||
/* local functions */
|
||||
static void
|
||||
_cb_dismiss_mouse_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
|
||||
{
|
||||
_options_tools(o_box, o_base, NULL);
|
||||
_options_toggle(o_win, o_base, data, _opts_cb_done, _opts_cb_data);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_dismiss_del(void *data EINA_UNUSED, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
|
||||
{
|
||||
o_dismiss = NULL;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_cb_del_delay(void *data EINA_UNUSED)
|
||||
{
|
||||
if (o_tbr) evas_object_del(o_tbr);
|
||||
o_tbr = NULL;
|
||||
if (o_frame) evas_object_del(o_frame);
|
||||
o_frame = NULL;
|
||||
if (o_box) evas_object_del(o_box);
|
||||
o_box = NULL;
|
||||
|
||||
_opts_del_timer = NULL;
|
||||
elm_cache_all_flush();
|
||||
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_details_done(void *data, Evas_Object *obj EINA_UNUSED, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *grid;
|
||||
|
||||
if (!(grid = data)) return;
|
||||
|
||||
_options_tools(o_box, o_base, NULL);
|
||||
|
||||
elm_box_clear(o_box);
|
||||
|
||||
switch (_mode)
|
||||
{
|
||||
case OPTION_NONE:
|
||||
break;
|
||||
case OPTION_GENERAL:
|
||||
_options_general(o_box, grid);
|
||||
break;
|
||||
case OPTION_FONT:
|
||||
_options_font(o_box, grid);
|
||||
break;
|
||||
case OPTION_COLORS:
|
||||
_options_colors(o_box, grid);
|
||||
break;
|
||||
case OPTION_VIDEO:
|
||||
_options_video(o_box, grid);
|
||||
break;
|
||||
case OPTION_NETWORKS:
|
||||
_options_networks(o_box, o_base);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
edje_object_signal_emit(o_base, "options,details,show", PACKAGE_NAME);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_details_done2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
|
||||
{
|
||||
if (_opts_del_timer) ecore_timer_del(_opts_del_timer);
|
||||
_opts_del_timer = NULL;
|
||||
|
||||
_cb_del_delay(NULL);
|
||||
|
||||
edje_object_signal_callback_del(o_base, "options,details,hide,done",
|
||||
PACKAGE_NAME, _cb_details_done2);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_option(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
|
||||
{
|
||||
enum _opt_mode mode = (intptr_t)data;
|
||||
|
||||
if (_mode == mode) return;
|
||||
_mode = mode;
|
||||
edje_object_signal_emit(o_base, "options,details,hide", PACKAGE_NAME);
|
||||
}
|
||||
|
||||
/* external functions */
|
||||
void
|
||||
_options_toggle(Evas_Object *win, Evas_Object *base, Evas_Object *grid, void (*cb_done)(void *data), void *data)
|
||||
{
|
||||
Elm_Object_Item *o_itm = NULL;
|
||||
|
||||
_mode = OPTION_NONE;
|
||||
|
||||
if ((win != o_win) && (o_frame))
|
||||
{
|
||||
evas_object_del(o_dismiss);
|
||||
evas_object_del(o_tbr);
|
||||
evas_object_del(o_frame);
|
||||
evas_object_del(o_box);
|
||||
o_dismiss = NULL;
|
||||
o_tbr = NULL;
|
||||
o_frame = NULL;
|
||||
o_box = NULL;
|
||||
}
|
||||
|
||||
o_win = win;
|
||||
o_base = base;
|
||||
|
||||
if (!o_frame)
|
||||
{
|
||||
o_box = elm_box_add(win);
|
||||
elm_box_align_set(o_box, 0.0, 0.0);
|
||||
WEIGHT_SET(o_box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
ALIGN_SET(o_box, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
edje_object_part_swallow(base, "option_details", o_box);
|
||||
evas_object_show(o_box);
|
||||
|
||||
o_frame = elm_frame_add(win);
|
||||
WEIGHT_SET(o_frame, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
ALIGN_SET(o_frame, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
elm_object_text_set(o_frame, "Options");
|
||||
|
||||
o_tbr = elm_toolbar_add(win);
|
||||
elm_toolbar_menu_parent_set(o_tbr, win);
|
||||
elm_toolbar_horizontal_set(o_tbr, EINA_FALSE);
|
||||
elm_toolbar_shrink_mode_set(o_tbr, ELM_TOOLBAR_SHRINK_SCROLL);
|
||||
elm_toolbar_select_mode_set(o_tbr, ELM_OBJECT_SELECT_MODE_ALWAYS);
|
||||
WEIGHT_SET(o_tbr, 0.0, EVAS_HINT_EXPAND);
|
||||
ALIGN_SET(o_tbr, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
|
||||
#define TB_APPEND(_icon, _label, _opt_mode) \
|
||||
elm_toolbar_item_append(o_tbr, _icon, _label, _cb_option, \
|
||||
(void *) OPTION_##_opt_mode)
|
||||
|
||||
o_itm =
|
||||
TB_APPEND("preferences-system", "General", GENERAL);
|
||||
elm_toolbar_item_selected_set(o_itm, EINA_TRUE);
|
||||
|
||||
TB_APPEND("preferences-desktop-font", "Font", FONT);
|
||||
/* TB_APPEND("preferences-desktop-theme", "Colors", COLORS); */
|
||||
TB_APPEND("video-display", "Video", VIDEO);
|
||||
TB_APPEND("preferences-system-network", "Networks", NETWORKS);
|
||||
#undef TB_APPEND
|
||||
|
||||
elm_object_content_set(o_frame, o_tbr);
|
||||
evas_object_show(o_tbr);
|
||||
|
||||
edje_object_part_swallow(base, "options_details", o_box);
|
||||
edje_object_part_swallow(base, "options", o_frame);
|
||||
evas_object_show(o_frame);
|
||||
}
|
||||
else if ((o_box) && (!_opts_out))
|
||||
{
|
||||
edje_object_part_swallow(base, "options_details", o_box);
|
||||
edje_object_part_swallow(base, "options", o_frame);
|
||||
edje_object_signal_emit(base, "options,details,show", PACKAGE_NAME);
|
||||
edje_object_signal_emit(base, "options,show", PACKAGE_NAME);
|
||||
}
|
||||
|
||||
if (!_opts_out)
|
||||
{
|
||||
edje_object_signal_callback_add(base, "options,details,hide,done",
|
||||
PACKAGE_NAME, _cb_details_done, grid);
|
||||
|
||||
o_dismiss = evas_object_rectangle_add(evas_object_evas_get(win));
|
||||
evas_object_color_set(o_dismiss, 0, 0, 0, 0);
|
||||
evas_object_event_callback_add(o_dismiss, EVAS_CALLBACK_MOUSE_DOWN,
|
||||
_cb_dismiss_mouse_down, grid);
|
||||
evas_object_event_callback_add(o_dismiss, EVAS_CALLBACK_DEL,
|
||||
_cb_dismiss_del, NULL);
|
||||
edje_object_part_swallow(base, "dismiss", o_dismiss);
|
||||
evas_object_show(o_dismiss);
|
||||
|
||||
_opts_cb_done = cb_done;
|
||||
_opts_cb_data = data;
|
||||
|
||||
edje_object_signal_emit(base, "options,details,hide", PACKAGE_NAME);
|
||||
edje_object_signal_emit(base, "options,show", PACKAGE_NAME);
|
||||
elm_object_focus_set(o_tbr, EINA_TRUE);
|
||||
_opts_out = EINA_TRUE;
|
||||
|
||||
if (_opts_del_timer) ecore_timer_del(_opts_del_timer);
|
||||
_opts_del_timer = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
edje_object_signal_callback_del(o_base, "options,details,hide,done",
|
||||
PACKAGE_NAME, _cb_details_done);
|
||||
edje_object_signal_callback_add(o_base, "options,details,hide,done",
|
||||
PACKAGE_NAME, _cb_details_done2, NULL);
|
||||
|
||||
elm_object_focus_set(o_box, EINA_FALSE);
|
||||
elm_object_focus_set(o_tbr, EINA_FALSE);
|
||||
elm_object_focus_set(o_frame, EINA_FALSE);
|
||||
|
||||
if (_opts_cb_done) _opts_cb_done(_opts_cb_data);
|
||||
|
||||
if (o_dismiss) evas_object_del(o_dismiss);
|
||||
o_dismiss = NULL;
|
||||
|
||||
edje_object_signal_emit(o_base, "options,hide", PACKAGE_NAME);
|
||||
edje_object_signal_emit(o_base, "options,details,hide", PACKAGE_NAME);
|
||||
_opts_out = EINA_FALSE;
|
||||
|
||||
if (_opts_del_timer) ecore_timer_del(_opts_del_timer);
|
||||
_opts_del_timer = ecore_timer_add(10.0, _cb_del_delay, NULL);
|
||||
}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef _OPTIONS_H_
|
||||
# define _OPTIONS_H_ 1
|
||||
|
||||
void _options_toggle(Evas_Object *win, Evas_Object *base, Evas_Object *grid, void (*cb_done)(void *data), void *data);
|
||||
|
||||
#endif
|