wrong files

SVN revision: 2016
master
Mandrake 23 years ago
parent 64ce9c3f50
commit 28425bebaa
  1. 168
      Makefile
  2. 289
      menus.c
  3. 70
      menus.h
  4. 12
      viewer.c
  5. 3
      viewer.h

@ -0,0 +1,168 @@
# files in source that are needed
PACKAGE = efm-test
VERSION = 0.0.0
SRCS = \
viewer.c menus.c
HEADERS = \
viewer.h menus.h
DATA =
EXTRAS =
BUILD = \
LIB_DIRS = \
-L/usr/local/lib -L/usr/X11R6/lib -L/usr/X11/lib -L/usr/dt/lib
LIBS = \
`gtk-config --libs` -lgdbm -lgdk_imlib
CFLAGS = \
-O -g -D_GNU_SOURCE $(DEVFLAGS)
#CFLAGS = \
# -O -g -W -Wall -Wno-unused -pedantic -pedantic-errors -ansi -D_GNU_SOURCE
OPTFLAGS = \
-O6 -mpentium -mcpu=pentium -march=pentium -ffast-math -D_GNU_SOURCE
INCLUDES = \
`gtk-config --cflags` -I..
BIN = e16keyedit
# configurable stuff
BINARY_DESTINATION = /usr/local/enlightenment/bin
DATA_DESTINATION = /usr/local/enlightenment/share
# commands to do things
INSTALL = install
MKDIR = mkdir
RM = rm -f
RMRF = rm -rf
TAR = tar
GZIP = gzip
CD = cd
MAKE = make
STRIP = strip
SED = sed
MAKEDEP = gcc -MM $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDES) $(EXTRA_INCLUDES)
#MAKEDEP = makedepend -f- -s'\# CUT' -- -Y $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDES) $(EXTRA_INCLUDES) --
# piece together variables
OBJS = $(SRCS:.c=.o)
DIST = $(PACKAGE)-$(VERSION)
BLD = Makefile $(BUILD)
FILES = $(SRCS) $(HEADERS) $(DATA) $(BLD) $(EXTRAS)
all: e16keyedit
# show help
help:
@echo
@echo
# @echo "To build and install type:"
# @echo " make [options] install"
@echo "To only build the binaries:"
@echo " make [options] e16keyedit"
@echo
@echo "Options for building (zero or more of the following):"
@echo " BINARY_DESTINATION=/path/to/binary/dir [default="$(BINARY_DESTINATION)"]"
@echo " DATA_DESTINATION=/path/to/data/dir [default="$(DATA_DESTINATION)"]"
@echo " CFLAGS=\"flags for compiler\" [default="$(CFLAGS)"]"
@echo " INCLUDES=\"include directiors compiler\" [default="$(INCLUDES)"]"
@echo " EXTRA_CFLAGS=\"extra flags for compiler\" [default="$(EXTRA_CFLAGS)"]"
@echo " EXTRA_INCLUDES=\"extra include directiors compiler\" [default="$(EXTRA_INCLUDES)"]"
@echo " LIBS=\"libraries to link to\" [default="$(LIBS)"]"
@echo " LIB_DIRS=\"directories to find libraries\" [default="$(LIB_DIRS)"]"
@echo " EXTRA_LIBS=\"extra libraries to link to\" [default="$(EXTRA_LIBS)"]"
@echo " EXTRA_LIB_DIRS=\"extra directories to find libraries\" [default="$(EXTRA_LIB_DIRS)"]"
@echo
@echo
e16keyedit: e16keyedit
@echo
@echo
@echo "Don't bother with 'make install'. It's useless right now."
@echo "To run the editor and test stuff out try:"
@echo
@echo "./e16keyedit
@echo
bigcompile:
$(CC) $(SRCS) -o e16keyedit $(OPTFLAGS) $(EXTRA_CFLAGS) $(INCLUDES) $(EXTRA_INCLUDES) $(LIBS) $(EXTRA_LIBS) $(LIB_DIRS) $(EXTRA_LIB_DIRS)
$(STRIP) ./e16keyedit
optimized: bigcompile
# rules for source
e16keyedit: $(OBJS)
$(RM) $@
$(CC) -o $@ $(OBJS) $(LIBS) $(EXTRA_LIBS) $(LIB_DIRS) $(EXTRA_LIB_DIRS)
.c.o:
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDES) $(EXTRA_INCLUDES) -c $< -o $@
# clean out build crap
clean::
$(RMRF) $(BIN) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut $(DIST) $(DIST).tar $(DIST).tar.gz ./=build ./=install "#"*
# how to install
install:: e
@echo
@echo
@echo "You don't really want to do this. it doesn't work yet."
@echo
@echo
# for I in $(BIN); do $(INSTALL) -D -m 0775 $$I $(prefix)$(BINARY_DESTINATION)/$$I; done
# for I in $(DATA); do $(INSTALL) -D -m 0664 $$I $(prefix)$(DATA_DESTINATION)/$$I; done
# how to make a dist tarball
dist::
$(RMRF) $(DIST) $(DIST).tar $(DIST).tar.gz
$(MKDIR) $(DIST)
for I in $(FILES); do \
if [ -x $$I ]; then $(INSTALL) -D -m 0775 $$I $(DIST)/$$I; else \
if [ -f $$I ]; then $(INSTALL) -D -m 0664 $$I $(DIST)/$$I; else \
if [ -d $$I ]; then $(INSTALL) -D -m 0555 -d $$I $(DIST)/$$I; fi; fi; fi; \
done
$(TAR) -cf $(DIST).tar $(DIST)
$(GZIP) $(DIST).tar
$(RMRF) $(DIST)
# how to check the dist
distcheck: dist
$(RMRF) ./=build ./=install
$(MKDIR) ./=build
$(MKDIR) ./=install
($(CD) ./=build; $(GZIP) -d -c ../$(DIST).tar.gz | $(TAR) xvf -;)
($(CD) ./=build/$(PACKAGE)-$(VERSION); \
$(MAKE) prefix=../../=install install)
$(RMRF) ./=build ./=install $(DIST).tar.gz
# Update dependency info
dep depend:
$(SED) '/^# CUT/,$$d' Makefile > Makefile.tmp
echo "# CUT" >> Makefile.tmp
$(MAKEDEP) $(SRCS) >> Makefile.tmp && mv Makefile.tmp Makefile
# File dependencies. Do not remove the next line. sed needs it.
# CUT
batch.o: batch.c batch.h events.h x.h ev_filter.h str.h mem.h util.h \
file.h
db.o: db.c db.h mem.h util.h str.h
efm_view.o: efm_view.c x.h str.h mem.h util.h file.h events.h ev_x.h \
ev_filter.h efm_view.h db.h im_engine.h batch.h glob.h
ev_dispatch.o: ev_dispatch.c ev_dispatch.h events.h x.h str.h mem.h \
util.h
ev_filter.o: ev_filter.c ev_filter.h events.h x.h str.h mem.h util.h
ev_ipc.o: ev_ipc.c events.h x.h ev_ipc.h str.h mem.h util.h file.h
ev_session.o: ev_session.c str.h mem.h util.h
ev_signal.o: ev_signal.c events.h x.h ev_signal.h str.h mem.h util.h
ev_x.o: ev_x.c events.h x.h ev_x.h str.h mem.h util.h
events.o: events.c events.h x.h ev_filter.h str.h mem.h util.h
file.o: file.c file.h mem.h str.h events.h x.h db.h glob.h ev_ipc.h \
jobs.h util.h
glob.o: glob.c str.h glob.h
im_engine.o: im_engine.c util.h mem.h str.h x.h events.h ev_x.h \
im_engine.h db.h
jobs.o: jobs.c jobs.h
main.o: main.c events.h x.h ev_signal.h ev_x.h ev_ipc.h ev_filter.h \
batch.h efm_view.h file.h db.h im_engine.h mem.h util.h str.h
mem.o: mem.c mem.h
str.o: str.c str.h mem.h
util.o: util.c util.h mem.h str.h
x.o: x.c x.h mem.h str.h

@ -1,253 +1,76 @@
#include "first.h"
#include "x.h"
#include "str.h"
#include "mem.h"
#include "util.h"
#include <Imlib2.h>
#include "events.h"
#include "ev_x.h"
#include "ev_filter.h"
#include "menus.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
static E_Menu *open_menus = NULL;
static E_Menu_List *menus = NULL;
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
static void e_menu_idle_handler(void *data);
static void e_menu_event_handler(Eevent * ev);
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
E_Menu *
e_menu_new(void)
{
static char have_idle_handler = 0;
E_Menu *m;
E_Menu_List *l;
if (!have_idle_handler)
{
e_event_filter_handler_add(EV_MOUSE_MOVE, e_menu_event_handler);
e_event_filter_handler_add(EV_MOUSE_DOWN, e_menu_event_handler);
e_event_filter_handler_add(EV_MOUSE_UP, e_menu_event_handler);
e_event_filter_handler_add(EV_MOUSE_WHEEL, e_menu_event_handler);
e_event_filter_handler_add(EV_KEY_DOWN, e_menu_event_handler);
e_event_filter_handler_add(EV_KEY_UP, e_menu_event_handler);
e_event_filter_handler_add(EV_MOUSE_IN, e_menu_event_handler);
e_event_filter_handler_add(EV_MOUSE_OUT, e_menu_event_handler);
}
m = NEW(E_Menu, 1);
m->name = NULL;
m->win = e_window_override_new(0, 0, 0, 1, 1);
m->pmap = 0;
m->mask = 0;
m->x = 0;
m->y = 0;
m->w = 0;
m->h = 0;
m->visible = 0;
m->map_time = 0.0;
m->items = NULL;
m->next = NULL;
m->needs_redraw = 1;
l = NEW(E_Menu_List, 1);
l->menu = m;
l->next = menus;
menus = l;
return m;
}
#include "menus.h"
#include "viewer.h"
static void
e_menu_idle_handler(void *data)
{
E_Menu_List *l;
for (l = menus; l; l = l->next)
{
if (l->menu->needs_redraw)
e_menu_redraw(l->menu);
}
}
GtkWidget *
CreateBarSubMenu(GtkWidget *menu, char *szName) {
GtkWidget *menuitem;
GtkWidget *submenu;
static void
e_menu_event_handler(Eevent * ev)
{
E_Menu_List *l;
l = menus;
while (l)
{
E_Menu *m;
m = l->menu;
l = l->next;
e_menu_handle_event(m, ev);
}
}
menuitem = gtk_menu_item_new_with_label(szName);
gtk_menu_bar_append(GTK_MENU_BAR(menu), menuitem);
gtk_widget_show(menuitem);
submenu = gtk_menu_new();
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem),submenu);
void
e_menu_handle_event(E_Menu *m, Eevent * ev)
{
switch (ev->type)
{
case EV_MOUSE_MOVE:
{
Ev_Mouse_Move *e;
e = ev->event;
}
break;
case EV_MOUSE_DOWN:
{
Ev_Mouse_Down *e;
e = ev->event;
}
break;
case EV_MOUSE_UP:
{
Ev_Mouse_Up *e;
e = ev->event;
}
break;
case EV_MOUSE_WHEEL:
{
Ev_Wheel *e;
e = ev->event;
}
break;
case EV_KEY_DOWN:
{
Ev_Key_Down *e;
e = ev->event;
}
break;
case EV_KEY_UP:
{
Ev_Key_Up *e;
e = ev->event;
}
break;
case EV_MOUSE_IN:
{
Ev_Window_Enter *e;
e = ev->event;
}
break;
case EV_MOUSE_OUT:
{
Ev_Window_Leave *e;
e = ev->event;
}
break;
default:
break;
}
}
return submenu;
void
e_menu_show_at(E_Menu *m, int x, int y)
{
m->visible = 1;
e_window_move(m->win, x, y);
e_menu_redraw(m);
e_window_show(m->win);
}
void
e_menu_show_at_mouse_xy(E_Menu *m, int x, int y)
{
}
GtkWidget *
CreateRightAlignBarSubMenu(GtkWidget *menu, char *szName) {
GtkWidget *menuitem;
GtkWidget *submenu;
void
e_menu_show_at_submen(E_Menu *m, E_Menu *parent_m, int entry)
{
}
menuitem = gtk_menu_item_new_with_label(szName);
gtk_menu_item_right_justify (GTK_MENU_ITEM (menuitem));
gtk_menu_bar_append(GTK_MENU_BAR(menu), menuitem);
gtk_widget_show(menuitem);
submenu = gtk_menu_new();
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem),submenu);
void
e_menu_hide(E_Menu *m)
{
if (!m->visible)
return;
m->visible = 0;
e_window_hide(m->win);
if (m->next)
e_menu_hide(m->next);
}
return submenu;
void
e_menu_free(E_Menu *m)
{
IF_FREE(m->name);
e_window_destroy(m->win);
if (m->pmap)
e_pixmap_free(m->pmap);
if (m->mask)
e_pixmap_free(m->mask);
FREE(m);
}
E_Menu *
e_menu_find(char *name)
GtkWidget *
CreateMenuItem(GtkWidget *menu, char *szName, char *szAccel, char *szTip,
GtkSignalFunc func, gpointer data)
{
E_Menu_List *l;
for (l = menus; l; l = l->next)
{
if ((l->menu->name) && (e_string_cmp(l->menu->name, name)))
return l->menu;
}
return NULL;
}
GtkWidget *menuitem;
if(szName && strlen (szName)) {
menuitem = gtk_menu_item_new_with_label(szName);
gtk_signal_connect(GTK_OBJECT(menuitem),"activate",
GTK_SIGNAL_FUNC(func),data);
} else {
menuitem = gtk_menu_item_new();
}
gtk_menu_append(GTK_MENU(menu),menuitem);
gtk_widget_show(menuitem);
if(szAccel && szAccel[0] == '^') {
gtk_widget_add_accelerator(menuitem,"activate",accel_group,szAccel[1],
GDK_CONTROL_MASK,GTK_ACCEL_VISIBLE);
}
void
e_menu_add_entry(E_Menu *m, char *text, char *icon, char *submenu, int onoff, void (*func) (void *data), void *data, void (*func_free) (void *data))
{
E_Menu_Item *mi, *ptr;
mi = NEW(E_Menu_Item, 1);
mi->state = MENU_ITEM_STATE_NORMAL;
mi->icon = e_string_dup(icon);
mi->text = e_string_dup(text);
mi->submenu = e_string_dup(submenu);
if (onoff)
MENU_ITEM_SET_OFF(mi);
mi->func = func;
mi->func_free = func_free;
mi->data = data;
mi->next = NULL;
if (!m->items)
m->items = mi;
else
{
for (ptr = m->items; ptr; ptr = ptr->next)
{
if (!ptr->next)
{
ptr->next = mi;
break;
}
}
}
m->needs_redraw = 1;
}
if(szTip && strlen(szTip)) {
gtk_tooltips_set_tip(tooltips,menuitem,szTip,NULL);
}
void
e_menu_del_entry(E_Menu *m, E_Menu_Item *mi)
{
}
return menuitem;
void
e_menu_redraw(E_Menu *m)
{
if (!m->needs_redraw)
return;
m->needs_redraw = 0;
}

@ -1,67 +1,5 @@
#ifndef E_MENUS_H
#define E_MENUS_H 1
GtkWidget *CreateBarSubMenu(GtkWidget *menu, char *szName);
GtkWidget *CreateRightAlignBarSubMenu(GtkWidget *menu, char *szName);
GtkWidget * CreateMenuItem(GtkWidget *menu, char *szName, char *szAccel,
char *szTip, GtkSignalFunc func, gpointer data);
typedef struct _e_menu E_Menu;
typedef struct _e_menu_item E_Menu_Item;
typedef struct _e_menu_list E_Menu_List;
struct _e_menu_item
{
int state;
char *icon;
char *text;
char *submenu;
void (*func) (void *data);
void (*func_free) (void *data);
void *data;
E_Menu_Item *next;
};
struct _e_menu
{
char *name;
Window win;
Pixmap pmap, mask;
int x, y, w, h;
int visible;
double map_time;
E_Menu_Item *items;
E_Menu *next;
int needs_redraw;
};
struct _e_menu_list
{
E_Menu *menu;
E_Menu_List *next;
};
#define MENU_ITEM_STATE_NORMAL 0x00
#define MENU_ITEM_STATE_SELECTED 0x01
#define MENU_ITEM_STATE_OFF 0x02
#define MENU_ITEM_STATE_ON 0x04
#define MENU_ITEM_IS_BOOLEAN(item) \
((item)->state & (MENU_ITEM_STATE_OFF | MENU_ITEM_STATE_ON))
#define MENU_ITEM_SET_NORMAL(item) \
(item)->state = (item)->state & (~MENU_ITEM_STATE_SELECTED)
#define MENU_ITEM_SET_SELECTED(item) \
(item)->state = (item)->state | MENU_ITEM_STATE_SELECTED
#define MENU_ITEM_SET_OFF(item) \
(item)->state = ((item)->state | MENU_ITEM_STATE_OFF) & (~MENU_ITEM_STATE_ON)
#define MENU_ITEM_SET_ON(item) \
(item)->state = ((item)->state | MENU_ITEM_STATE_ON) & (~MENU_ITEM_STATE_OFF)
E_Menu *e_menu_new(void);
void e_menu_handle_event(E_Menu *m, Eevent * ev);
void e_menu_show_at(E_Menu *m, int x, int y);
void e_menu_show_at_mouse_xy(E_Menu *m, int x, int y);
void e_menu_show_at_submen(E_Menu *m, E_Menu *parent_m, int entry);
void e_menu_hide(E_Menu *m);
void e_menu_free(E_Menu *m);
E_Menu *e_menu_find(char *name);
void e_menu_add_entry(E_Menu *m, char *text, char *icon, char *submenu, int onoff, void (*func) (void *data), void *data, void (*func_free) (void *data));
void e_menu_del_entry(E_Menu *m, E_Menu_Item *mi);
void e_menu_redraw(E_Menu *m);
#endif

@ -4,5 +4,17 @@
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include "viewer.h"
extern GtkTooltips *tooltips;
extern GtkAccelGroup *accel_group;
int main(int argc, char *argv[])
{
GtkWidget *lister;
gtk_set_locale();
gtk_init(&argc, &argv);
}

@ -0,0 +1,3 @@
GtkTooltips *tooltips;
GtkAccelGroup *accel_group;
Loading…
Cancel
Save