Enlightenment CVS committal Author : glassy Project : e17 Module : apps/engycad
Dir : e17/apps/engycad/src Modified Files: arc.c circle.c cl.c drawing.c earc.c ellipse.c image.c layer.c line.c point.c serv.c shell.c text.c arc.h circle.h earc.h ellipse.h image.h line.h point.h text.h Log Message: command-line history backported =================================================================== RCS file: /cvs/e/e17/apps/engycad/src/arc.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- arc.c 9 Jul 2007 17:19:54 -0000 1.3 +++ arc.c 16 Jul 2007 15:54:04 -0000 1.4 @@ -299,13 +299,27 @@ arc_redraw(arc); } -void +void arc_destroy(Arc * arc) { - Evas *e; Evas_List *l; - e = shell->evas; + for (l = drawing->layers; l; l = l->next) + { + Layer *layer; + + layer = (Layer *) l->data; + layer->objects = evas_list_remove(layer->objects, arc); + } + + arc_free(arc); +} + +void +arc_free(Arc * arc) +{ + Evas_List *l; + if (!arc) return; @@ -320,13 +334,6 @@ evas_object_del(l->data); arc->list = evas_list_free(arc->list); - for (l = drawing->layers; l; l = l->next) - { - Layer *layer; - - layer = (Layer *) l->data; - layer->objects = evas_list_remove(layer->objects, arc); - } FREE(arc); } =================================================================== RCS file: /cvs/e/e17/apps/engycad/src/circle.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- circle.c 9 Jul 2007 17:19:54 -0000 1.3 +++ circle.c 16 Jul 2007 15:54:04 -0000 1.4 @@ -253,13 +253,25 @@ ci_redraw(ci); } -void +void ci_destroy(Circle * ci) { - Evas *e; + Evas_List *l; + for (l = drawing->layers; l; l = l->next) + { + Layer *layer; + + layer = (Layer *) l->data; + layer->objects = evas_list_remove(layer->objects, ci); + } + ci_free(ci); +} + +void +ci_free(Circle * ci) +{ Evas_List *l; - e = shell->evas; if (!ci) return; @@ -274,13 +286,6 @@ evas_object_del(l->data); ci->list = evas_list_free(ci->list); - for (l = drawing->layers; l; l = l->next) - { - Layer *layer; - - layer = (Layer *) l->data; - layer->objects = evas_list_remove(layer->objects, ci); - } FREE(ci); } =================================================================== RCS file: /cvs/e/e17/apps/engycad/src/cl.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- cl.c 9 Jul 2007 17:19:54 -0000 1.3 +++ cl.c 16 Jul 2007 15:54:04 -0000 1.4 @@ -32,6 +32,8 @@ Evas_Object * o_cl; iconv_t dcd; Evas_Object * current_editbox; +Evas_List * history = NULL; +Evas_List * curr_h = NULL; Evas_Smart *smart; @@ -56,6 +58,10 @@ void cl_clip_set(Evas_Object *o, Evas_Object *clip); void cl_clip_unset(Evas_Object *o); +void cl_history_up(Evas_Object *o); +void cl_history_down(Evas_Object *o); +void cl_autocomplete(Evas_Object *o); + void bg_key_down_cb(void * data, Evas *e, Evas_Object *obj, @@ -501,12 +507,32 @@ cl_cursor_pos_set(oparent, 0); else if (!strcmp(ee->keyname, "End")) cl_cursor_pos_set(oparent, 0xffff); -// else if (!strcmp(ee->keyname, "Tab")) engy_panel_feed(ee); - else if (!strcmp(ee->keyname, "Return")) + else if (!strcmp(ee->keyname, "Tab")) + cl_autocomplete(oparent); + else if (!strcmp(ee->keyname, "Up")) + cl_history_up(oparent); + else if (!strcmp(ee->keyname, "Down")) + cl_history_down(oparent); + else if (!strcmp(ee->keyname, "Return") || + !strcmp(ee->keyname, "KP_Enter")) { char *p, *s, *al; cl_text_get(oparent, &p); + if(!curr_h) + { + s = DUP(p); + history = evas_list_prepend(history, s); + } + else + { + curr_h = history; + IF_FREE(curr_h->data); + curr_h->data = DUP(p); + } + + curr_h = NULL; + s = DUP(p); al = _alias(s); if(!al) @@ -521,10 +547,6 @@ cl_text_set(oparent, ""); } -// else if (!strcmp(ee->keyname, "KP_Enter")) engy_panel_feed(ee); -// else if (!strcmp(ee->keyname, "Up")) engy_panel_feed(ee); -// else if (!strcmp(ee->keyname, "Down")) engy_panel_feed(ee); -// else if (! ee->key_compose) engy_panel_feed(ee); else { // insert input char * nt; @@ -597,6 +619,75 @@ cl->bcpos = evas_string_char_prev_get(cl->text, pos, &d); } +void cl_history_up(Evas_Object *_o) +{ + char *s, *p; + cl_text_get(_o, &p); + + if(!curr_h) + { + s = DUP(p); + history = evas_list_prepend(history, s); + curr_h = history; + } + else + { + IF_FREE(curr_h->data); + curr_h->data = DUP(p); + } + + if(!curr_h->next) + return; + curr_h = curr_h->next; + cl_text_set(_o, curr_h->data); +} + +void cl_history_down(Evas_Object *_o) +{ + char *s, *p; + cl_text_get(_o, &p); + + if(!curr_h) + { + s = DUP(p); + history = evas_list_prepend(history, s); + curr_h = history; + } + else + { + IF_FREE(curr_h->data); + curr_h->data = DUP(p); + } + + if(!evas_list_prev(curr_h)) + return; + curr_h = evas_list_prev(curr_h); + cl_text_set(_o, curr_h->data); +} + +void cl_autocomplete(Evas_Object *_o) +{ + Evas_List *l; + char *s, *s1; + + if(!history) + return; + cl_text_get(_o, &s1); + if(!s1) + return; + + for(l = history; l; l = l->next) + { + s = l->data; + if(strncpy(s, s1, strlen(s1))) + continue; + + cl_text_set(_o, s); + return; + } +} + + void cl_hint_set(Evas_Object * _o, const char * str) { @@ -973,5 +1064,18 @@ void cl_shutdown(void) { + Evas_List *l; iconv_close(dcd); + + for(l = history; l; l = l->next) + { + IF_FREE(l->data); + } + + evas_list_free(history); } + + + + + =================================================================== RCS file: /cvs/e/e17/apps/engycad/src/drawing.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- drawing.c 10 Jul 2007 15:16:10 -0000 1.4 +++ drawing.c 16 Jul 2007 15:54:04 -0000 1.5 @@ -134,6 +134,11 @@ { layer_destroy((Layer *) l->data); } + + evas_list_free(drawing->layers); + IF_FREE(drawing->filein); + IF_FREE(drawing->fileout); + FREE(drawing); } Unit =================================================================== RCS file: /cvs/e/e17/apps/engycad/src/earc.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- earc.c 9 Jul 2007 17:19:54 -0000 1.3 +++ earc.c 16 Jul 2007 15:54:04 -0000 1.4 @@ -332,10 +332,24 @@ void earc_destroy(EArc * earc) { - Evas *e; Evas_List *l; - e = shell->evas; + for (l = drawing->layers; l; l = l->next) + { + Layer *layer; + + layer = (Layer *) l->data; + layer->objects = evas_list_remove(layer->objects, earc); + } + + earc_free(earc); +} + +void +earc_free(EArc * earc) +{ + Evas_List *l; + if (!earc) return; @@ -350,13 +364,6 @@ evas_object_del(l->data); earc->list = evas_list_free(earc->list); - for (l = drawing->layers; l; l = l->next) - { - Layer *layer; - - layer = (Layer *) l->data; - layer->objects = evas_list_remove(layer->objects, earc); - } FREE(earc); } =================================================================== RCS file: /cvs/e/e17/apps/engycad/src/ellipse.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- ellipse.c 9 Jul 2007 17:19:54 -0000 1.3 +++ ellipse.c 16 Jul 2007 15:54:04 -0000 1.4 @@ -283,8 +283,23 @@ Evas *e; Evas_List *l; - e = shell->evas; - if (!ell) + for (l = drawing->layers; l; l = l->next) + { + Layer *layer; + + layer = (Layer *) l->data; + layer->objects = evas_list_remove(layer->objects, ell); + } + + ell_free(ell); +} + +void +ell_free(Ellipse * ell) +{ + Evas_List *l; + + if(!ell) return; magnet_detach(ell); @@ -298,13 +313,6 @@ evas_object_del(l->data); ell->list = evas_list_free(ell->list); - for (l = drawing->layers; l; l = l->next) - { - Layer *layer; - - layer = (Layer *) l->data; - layer->objects = evas_list_remove(layer->objects, ell); - } FREE(ell); } =================================================================== RCS file: /cvs/e/e17/apps/engycad/src/image.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- image.c 9 Jul 2007 17:19:54 -0000 1.3 +++ image.c 16 Jul 2007 15:54:04 -0000 1.4 @@ -384,6 +384,22 @@ void image_destroy(Image * im) +{ + Evas_List *l; + for (l = drawing->layers; l; l = l->next) + { + Layer *layer; + + layer = (Layer *) l->data; + layer->objects = evas_list_remove(layer->objects, im); + } + + image_free(im); +} + + +void +image_free(Image * im) { Imlib_Image prev; =================================================================== RCS file: /cvs/e/e17/apps/engycad/src/layer.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- layer.c 10 Jul 2007 15:16:10 -0000 1.4 +++ layer.c 16 Jul 2007 15:54:04 -0000 1.5 @@ -250,8 +250,6 @@ { Evas_List *l; - return; - if (!layer) return; for (l = layer->objects; l; l = l->next) @@ -264,33 +262,36 @@ case OBJ_NONE: break; case OBJ_POINT: - point_destroy((Point *) o); + point_free((Point *) o); break; case OBJ_LINE: - line_destroy((Line *) o); + line_free((Line *) o); break; case OBJ_CIRCLE: - circle_destroy((Circle *) o); + ci_free((Circle *) o); break; case OBJ_ARC: - arc_destroy((Arc *) o); + arc_free((Arc *) o); break; case OBJ_ELLIPSE: - ell_destroy((Ellipse *) o); + ell_free((Ellipse *) o); break; case OBJ_EARC: - earc_destroy((EArc *) o); + earc_free((EArc *) o); break; case OBJ_IMAGE: - image_destroy((Image *) o); + image_free((Image *) o); case OBJ_TEXT: - text_destroy((Text *) o); + text_free((Text *) o); break; } } + evas_list_free(layer->objects); FREE(layer->line_style); FREE(layer->label); + IF_FREE(layer->old.line_style); + IF_FREE(layer->old.label); FREE(layer); } =================================================================== RCS file: /cvs/e/e17/apps/engycad/src/line.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- line.c 9 Jul 2007 17:19:54 -0000 1.3 +++ line.c 16 Jul 2007 15:54:04 -0000 1.4 @@ -356,12 +356,25 @@ } void -line_destroy(Line * line) +line_destroy(Line *line) +{ + Evas_List *l; + for (l = drawing->layers; l; l = l->next) + { + Layer *layer; + + layer = (Layer *) l->data; + layer->objects = evas_list_remove(layer->objects, line); + } + + line_free(line); +} + +void +line_free(Line * line) { - Evas *e; Evas_List *l; - e = shell->evas; if (!line) return; @@ -376,13 +389,6 @@ evas_object_del(l->data); line->list = evas_list_free(line->list); - for (l = drawing->layers; l; l = l->next) - { - Layer *layer; - - layer = (Layer *) l->data; - layer->objects = evas_list_remove(layer->objects, line); - } FREE(line); } =================================================================== RCS file: /cvs/e/e17/apps/engycad/src/point.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- point.c 9 Jul 2007 17:19:54 -0000 1.3 +++ point.c 16 Jul 2007 15:54:04 -0000 1.4 @@ -327,10 +327,24 @@ } } -void +void point_destroy(Point * point) { - Evas *e; + Evas_List *l; + for (l = drawing->layers; l; l = l->next) + { + Layer *layer; + + layer = (Layer *) l->data; + layer->objects = evas_list_remove(layer->objects, point); + } + + point_free(point); +} + +void +point_free(Point * point) +{ Evas_List *l; if (!point) @@ -338,21 +352,12 @@ magnet_detach(point); - e = shell->evas; IF_FREE(point->line_style); FREE(point->point_style); for (l = point->list; l; l = l->next) evas_object_del(l->data); point->list = evas_list_free(point->list); - - for (l = drawing->layers; l; l = l->next) - { - Layer *layer; - - layer = (Layer *) l->data; - layer->objects = evas_list_remove(layer->objects, point); - } FREE(point); } =================================================================== RCS file: /cvs/e/e17/apps/engycad/src/serv.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- serv.c 13 Jul 2007 06:20:28 -0000 1.4 +++ serv.c 16 Jul 2007 15:54:04 -0000 1.5 @@ -311,10 +311,6 @@ IFCMD("save_ps") serv_save_ps(); IFCMD("help") serv_help(); IFCMD("__exit") fl_shutdown = 1; - { - static long death_count = 0; - IFCMD("dummy") printf("%d\n", death_count++); - } FREE(s); } =================================================================== RCS file: /cvs/e/e17/apps/engycad/src/shell.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- shell.c 13 Jul 2007 06:20:28 -0000 1.5 +++ shell.c 16 Jul 2007 15:54:04 -0000 1.6 @@ -405,7 +405,6 @@ shell_init(); ecore_main_loop_begin(); shell_shutdown(); - ecore_evas_free(shell->ee); ecore_evas_shutdown(); return 0; } =================================================================== RCS file: /cvs/e/e17/apps/engycad/src/text.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- text.c 9 Jul 2007 17:19:54 -0000 1.3 +++ text.c 16 Jul 2007 15:54:04 -0000 1.4 @@ -498,10 +498,25 @@ void text_destroy(Text * te) { - Evas *e; Evas_List *l; - e = shell->evas; + for (l = drawing->layers; l; l = l->next) + { + Layer *layer; + + layer = (Layer *) l->data; + layer->objects = evas_list_remove(layer->objects, te); + } + + text_free(te); +} + + +void +text_free(Text * te) +{ + Evas_List *l; + if (!te) return; @@ -515,13 +530,6 @@ evas_object_del(te->item); - for (l = drawing->layers; l; l = l->next) - { - Layer *layer; - - layer = (Layer *) l->data; - layer->objects = evas_list_remove(layer->objects, te); - } FREE(te); } =================================================================== RCS file: /cvs/e/e17/apps/engycad/src/arc.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- arc.h 8 Jul 2007 04:15:49 -0000 1.1 +++ arc.h 16 Jul 2007 15:54:04 -0000 1.2 @@ -6,6 +6,7 @@ void arc_redraw(Arc *); void arc_sync(Arc *); void arc_destroy(Arc *); +void arc_free(Arc *); void arc_move(Arc *, double, double); void arc_scale(Arc *, double, double, double); =================================================================== RCS file: /cvs/e/e17/apps/engycad/src/circle.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- circle.h 8 Jul 2007 04:15:49 -0000 1.1 +++ circle.h 16 Jul 2007 15:54:04 -0000 1.2 @@ -6,6 +6,7 @@ void ci_redraw(Circle *); void ci_sync(Circle *); void ci_destroy(Circle *); +void ci_free(Circle *); void ci_move(Circle *, double, double); void ci_scale(Circle *, double, double, double); =================================================================== RCS file: /cvs/e/e17/apps/engycad/src/earc.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- earc.h 8 Jul 2007 04:15:49 -0000 1.1 +++ earc.h 16 Jul 2007 15:54:04 -0000 1.2 @@ -6,6 +6,7 @@ void earc_redraw(EArc *); void earc_sync(EArc *); void earc_destroy(EArc *); +void earc_free(EArc *); void earc_move(EArc *, double, double); void earc_scale(EArc *, double, double, double); =================================================================== RCS file: /cvs/e/e17/apps/engycad/src/ellipse.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- ellipse.h 8 Jul 2007 04:15:49 -0000 1.1 +++ ellipse.h 16 Jul 2007 15:54:04 -0000 1.2 @@ -6,6 +6,7 @@ void ell_redraw(Ellipse *); void ell_sync(Ellipse *); void ell_destroy(Ellipse *); +void ell_free(Ellipse *); void ell_move(Ellipse *, double, double); void ell_scale(Ellipse *, double, double, double); =================================================================== RCS file: /cvs/e/e17/apps/engycad/src/image.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- image.h 8 Jul 2007 04:15:49 -0000 1.1 +++ image.h 16 Jul 2007 15:54:04 -0000 1.2 @@ -5,6 +5,7 @@ void image_redraw(Image *); void image_sync(Image *); void image_destroy(Image *); +void image_free(Image *); void image_move(Image *, double, double); void image_scale(Image *, double, double, double); =================================================================== RCS file: /cvs/e/e17/apps/engycad/src/line.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- line.h 8 Jul 2007 04:15:49 -0000 1.1 +++ line.h 16 Jul 2007 15:54:04 -0000 1.2 @@ -6,6 +6,7 @@ void line_redraw(Line *); void line_sync(Line *); void line_destroy(Line *); +void line_free(Line *); void line_move(Line *, double, double); void line_scale(Line *, double, double, double); =================================================================== RCS file: /cvs/e/e17/apps/engycad/src/point.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- point.h 8 Jul 2007 04:15:49 -0000 1.1 +++ point.h 16 Jul 2007 15:54:04 -0000 1.2 @@ -4,6 +4,7 @@ void point_redraw(Point *); void point_sync(Point *); void point_destroy(Point *); +void point_free(Point *); void point_move(Point *, double, double); void point_scale(Point *, double, double, double); =================================================================== RCS file: /cvs/e/e17/apps/engycad/src/text.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- text.h 8 Jul 2007 04:15:49 -0000 1.1 +++ text.h 16 Jul 2007 15:54:04 -0000 1.2 @@ -5,6 +5,7 @@ void text_redraw(Text *); void text_sync(Text *); void text_destroy(Text *); +void text_free(Text *); void text_move(Text *, double, double); void text_scale(Text *, double, double, double); ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs