Ok this has got some initial support with ferite, currently you can only

assign ferite scripts to menus see data/scripts/build_app_menu_db.sh and look
at the exit menu item as an example. you will need ferite - i suggest that
you use cvs ferite as this is what I am developing this against. This, my
friends, is the first step of many :)


SVN revision: 5280
This commit is contained in:
boris 2001-08-25 19:51:48 +00:00 committed by boris
parent 69561bd136
commit bad5da3d33
14 changed files with 209 additions and 10 deletions

6
README
View File

@ -62,9 +62,9 @@ worked on. Just be happy it does as much as it already does.
Enlightenment RELIES on lots of libraires that have been written. Ecore,
Ebits, Evas, Edb, Imlib2, Efsd just to mention a few. Especially Ebits,
Ecore, Efsd and Evas change in CVS often - you will need the absolute latest
of these if you wish Enlightenment 0.17 code to run properly or compile. If
you update Enlightenment from CVS update these too to get any changes they
Ecore, Efsd ferite, and Evas change in CVS often - you will need the absolute
latest of these if you wish Enlightenment 0.17 code to run properly or compile.
If you update Enlightenment from CVS update these too to get any changes they
have in their trees.
If you plan on working on the code... STOP! don't rush in and work on it -

View File

@ -155,6 +155,22 @@ AC_PATH_GENERIC(efsd,, [
efsd_libs=`efsd-config --libs`
efsd_cflags=`efsd-config --cflags`
dnl Check for ferite.
AC_ARG_WITH(ferite,
[ --with-ferite=DIR use ferite in <DIR>],
[CFLAGS="$CFLAGS -I$withval/include"
LIBS="-L$withval/lib $LIBS"])
AC_PATH_GENERIC(ferite,, [
AC_SUBST(ferite_libs)
AC_SUBST(ferite_cflags)],
AC_MSG_ERROR(Cannot find ferite: Is ferite-config in path?))
ferite_libs=`ferite-config --libs`
ferite_cflags=`ferite-config --cflags`
AC_PATH_PROG(FEBUILDER, builder,,)
AC_SUBST(FEBUILDER)
AC_SUBST(CP_OPTIONS)
AC_CONFIG_FILES([

View File

@ -154,6 +154,22 @@ AC_PATH_GENERIC(efsd,, [
efsd_libs=`efsd-config --libs`
efsd_cflags=`efsd-config --cflags`
dnl Check for ferite.
AC_ARG_WITH(ferite,
[ --with-ferite=DIR use ferite in <DIR>],
[CFLAGS="$CFLAGS -I$withval/include"
LIBS="-L$withval/lib $LIBS"])
AC_PATH_GENERIC(ferite,, [
AC_SUBST(ferite_libs)
AC_SUBST(ferite_cflags)],
AC_MSG_ERROR(Cannot find ferite: Is ferite-config in path?))
ferite_libs=`ferite-config --libs`
ferite_cflags=`ferite-config --cflags`
AC_PATH_PROG(FEBUILDER, builder,,)
AC_SUBST(FEBUILDER)
AC_SUBST(CP_OPTIONS)
AC_OUTPUT([

View File

@ -65,9 +65,13 @@ entry ()
else if [ $1 = "separator" ]; then
edb_ed $DB add "/menu/"$MENUNUM"/"$ENTRYNUM"/separator" int 1
else if [ $1 = "script" ]; then
edb_ed $DB add "/menu/"$MENUNUM"/"$ENTRYNUM"/text" str "$2"
edb_ed $DB add "/menu/"$MENUNUM"/"$ENTRYNUM"/script" str "$3"
fi; fi; fi; fi
fi; fi; fi; fi; fi
ENTRYNUM=$[ $ENTRYNUM + 1 ];
}
@ -95,6 +99,7 @@ entry both 'XMag' '/usr/share/pixmaps/gnome-applets.png' 'xmag'
entry separator
entry text 'Network' 'sub' 1
entry text 'System' 'sub' 2
entry script 'Exit' 'e.shutdown();'
end_menu
menu 1
@ -107,4 +112,5 @@ entry text 'Shut Down' 'sudo -S /sbin/shutdown -h now'
entry text 'Reboot' 'sudo -S /sbin/shutdown -r now'
end_menu
finish

View File

@ -1,3 +1,19 @@
2001-08-25 gettextize <bug-gnu-utils@gnu.org>
* Makefile.in.in: Upgrade to gettext-0.10.39.
2001-08-25 gettextize <bug-gnu-utils@gnu.org>
* Makefile.in.in: Upgrade to gettext-0.10.39.
2001-08-25 gettextize <bug-gnu-utils@gnu.org>
* Makefile.in.in: Upgrade to gettext-0.10.39.
2001-08-25 gettextize <bug-gnu-utils@gnu.org>
* Makefile.in.in: Upgrade to gettext-0.10.39.
2001-08-23 gettextize <bug-gnu-utils@gnu.org>
* Makefile.in.in: Upgrade to gettext-0.10.39.

View File

@ -6,4 +6,5 @@ Makefile.in
Makefile
enlightenment
.libs
.deps
.deps
e_ferite_gen_*

View File

@ -1,8 +1,10 @@
## Process this file with automake to produce Makefile.in
CLEANFILES = e_ferite_gen_*
INCLUDES = \
-I$(top_srcdir)/intl \
@evas_cflags@ @edb_cflags@ @ebits_cflags@ @ecore_cflags@ @efsd_cflags@
@evas_cflags@ @edb_cflags@ @ebits_cflags@ @ecore_cflags@ @efsd_cflags@ @ferite_cflags@
bin_PROGRAMS = enlightenment
@ -14,6 +16,10 @@ enlightenment_SOURCES = \
desktops.h desktops.c \
entry.h entry.c \
exec.h exec.c \
e_ferite.h e_ferite.c \
e_ferite_gen_header.h e_ferite_gen_core.c \
e_ferite_gen_e.c \
e_ferite_gen_Window.c \
fs.h fs.c \
icccm.h icccm.c \
icons.c \
@ -31,5 +37,11 @@ enlightenment_SOURCES = \
view.h view.c \
e.h
enlightenment_LDADD = @evas_libs@ @edb_libs@ @ebits_libs@ @ecore_libs@ @efsd_libs@ -lm -lc -ldl $(INTLLIBS)
enlightenment_LDADD = @evas_libs@ @edb_libs@ @ebits_libs@ @ecore_libs@ @efsd_libs@ @ferite_libs@ -lm -lc -ldl $(INTLLIBS)
e_ferite_gen_core.c: e_ferite.fec
rm -f e_ferite_gen_* ; \
@FEBUILDER@ -m e_ferite_gen e_ferite.fec ; \
mv e_ferite_gen_core.c e_ferite_gen_core.c.old ; \
cat e_ferite_gen_core.c.old | sed -e "s/module_init/e_ferite_register/g" > e_ferite_gen_core.c ; \
rm e_ferite_gen_core.c.old

41
src/e_ferite.c Normal file
View File

@ -0,0 +1,41 @@
#include "e_ferite.h"
#include "e_ferite_gen_header.h"
void e_ferite_init(void)
{
printf( "Initialising ferite....\n" );
ferite_init( 0, NULL );
}
void e_ferite_deinit(void)
{
printf( "Deinitialising ferite....\n" );
ferite_deinit();
}
int e_ferite_script_error( FeriteScript *script, char *errmsg, int val )
{
fprintf( stderr, "e17: ferite error: %s\n", errmsg );
return 1;
}
int e_ferite_script_warning( FeriteScript *script, char *warnmsg )
{
fprintf( stderr, "e17: ferite warning: %s\n", warnmsg );
return 1;
}
void e_ferite_run( char *txt )
{
FeriteScript *script = NULL;
printf( "Compiling script `%s'\n", txt );
script = __ferite_compile_string( txt );
e_ferite_register( script, script->mainns );
script->error_cb = e_ferite_script_error;
script->warning_cb = e_ferite_script_warning;
printf( "Executing script.\n" );
ferite_script_execute( script );
printf( "Cleaning up.\n" );
ferite_script_delete( script );
}

54
src/e_ferite.fec Normal file
View File

@ -0,0 +1,54 @@
%{
#include "Ecore.h"
%}
class Window {
function getName();
function getTitle();
function getClass();
function getX();
function getY();
function getWidth();
function getHeight();
function move( number x, number y );
function resize( number width, number height );
function show();
function hide();
function isVisible();
function shade();
function unshade();
function isShaded();
function iconify();
function uniconify();
function isIconic();
function isMapped();
function isTransient();
function isShaped();
function delete();
function kill();
}
namespace e {
function flipToDesktop( number desk );
function getDesktopCount();
function getWidth();
function getHeight();
// shutdown enlightenment
function shutdown()
%{
e_event_loop_quit();
%}
}

13
src/e_ferite.h Normal file
View File

@ -0,0 +1,13 @@
#ifndef E_FERITE_H
#define E_FERITE_H
#include <ferite.h>
void e_ferite_init(void);
void e_ferite_deinit(void);
void e_ferite_run( char *script );
void e_ferite_register( FeriteScript *script, FeriteNamespace *ns );
int e_ferite_script_error( FeriteScript *script, char *errmsg, int val );
int e_ferite_script_warning( FeriteScript *script, char *warnmsg );
#endif /* E_FERITE_H */

View File

@ -9,6 +9,7 @@
#include "ipc.h"
#include "menu.h"
#include "view.h"
#include "e_ferite.h"
#include <X11/Xproto.h>
#ifdef E_PROF
@ -122,11 +123,14 @@ main(int argc, char **argv)
e_view_init();
e_entry_init();
e_keys_init();
e_ferite_init();
setup();
e_event_loop();
e_ferite_deinit();
return 0;
UN(argc);
UN(argv);

View File

@ -2,6 +2,7 @@
#include "menubuild.h"
#include "exec.h"
#include "util.h"
#include "e_ferite.h"
Evas_List build_menus = NULL;
@ -28,6 +29,18 @@ e_build_menu_cb_exec(E_Menu *m, E_Menu_Item *mi, void *data)
UN(mi);
}
static void
e_build_menu_cb_script(E_Menu *m, E_Menu_Item *mi, void *data)
{
char *script;
script = data;
e_ferite_run(script);
return;
UN(m);
UN(mi);
}
static void
e_build_menu_unbuild(E_Build_Menu *bm)
{
@ -126,7 +139,7 @@ e_build_menu_db_build_number(E_Build_Menu *bm, E_DB_File *db, int num)
for (i2 = 0; i2 < num2; i2++)
{
E_Menu_Item *menuitem;
char *text, *icon, *exe;
char *text, *icon, *exe, *script;
int ok, sub, sep;
sprintf(buf, "/menu/%i/%i/text", num, i2);
@ -135,6 +148,8 @@ e_build_menu_db_build_number(E_Build_Menu *bm, E_DB_File *db, int num)
icon = e_db_str_get(db, buf);
sprintf(buf, "/menu/%i/%i/command", num, i2);
exe = e_db_str_get(db, buf);
sprintf(buf, "/menu/%i/%i/script", num, i2);
script = e_db_str_get(db, buf);
sprintf(buf, "/menu/%i/%i/submenu", num, i2);
ok = e_db_int_get(db, buf, &sub);
sep = 0;
@ -161,6 +176,11 @@ e_build_menu_db_build_number(E_Build_Menu *bm, E_DB_File *db, int num)
e_menu_item_set_callback(menuitem, e_build_menu_cb_exec, exe);
bm->commands = evas_list_prepend(bm->commands, exe);
}
if( script )
{
e_menu_item_set_callback(menuitem, e_build_menu_cb_script, script);
bm->commands = evas_list_prepend(bm->commands, script);
}
e_menu_add_item(menu, menuitem);
}
bm->menus = evas_list_prepend(bm->menus, menu);

View File

@ -273,7 +273,7 @@ e_bg_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
e_view_selection_update(v);
}
if( _b == 2 && ev->double_click )
exit(0);
e_event_loop_quit();
UN(_e);
UN(_o);