Enlightenment CVS committal Author : pfritz Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_grid.c ewl_grid.h Log Message: save some loops =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_grid.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -3 -r1.26 -r1.27 --- ewl_grid.c 14 Aug 2006 21:00:11 -0000 1.26 +++ ewl_grid.c 16 Aug 2006 18:57:41 -0000 1.27 @@ -929,20 +929,12 @@ ecore_dlist_goto_first(EWL_CONTAINER(w)->children); while ((child = ecore_dlist_next(EWL_CONTAINER(w)->children))) { - /* - * reset geometry values for the next child - */ - c_x = CURRENT_X(EWL_OBJECT(w)); - c_y = CURRENT_Y(EWL_OBJECT(w)); - c_w = 0; - c_h = 0; - c = (Ewl_Grid_Child *)ewl_widget_data_get(child, (void *) g); if (c) { + c_h = c_w = 0; /* * calculate the geometry of the fixed widgets */ - /* calculate child widgets width */ for (i = c->start_col; i <= c->end_col; i++) c_w += g->col_size[i].current_size; @@ -952,12 +944,10 @@ c_h += g->row_size[i].current_size; /* calculate child widgets x coordinate */ - for (i = 0; i < c->start_col; i++) - c_x += g->col_size[i].current_size; + c_x = g->col_size[c->start_col].current_pos; /* calculate child widgets y coordinate */ - for (i = 0; i < c->start_row; i++) - c_y += g->row_size[i].current_size; + c_y = g->row_size[c->start_row].current_pos; } else { /* @@ -965,14 +955,8 @@ */ c_w = g->col_size[col].current_size; c_h = g->row_size[row].current_size; - - /* calculate child widgets x coordinate */ - for (i = 0; i < col; i++) - c_x += g->col_size[i].current_size; - - /* calculate child widgets y coordinate */ - for (i = 0; i < row; i++) - c_y += g->row_size[i].current_size; + c_x = g->col_size[col].current_pos; + c_y = g->row_size[row].current_pos; go_next(g, &col, &row); } @@ -1220,6 +1204,7 @@ { int i, new_w = 0, new_h = 0; int left_over, left_over2; + int pos; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR("g", g); @@ -1373,6 +1358,21 @@ g->row_size[left_over2 % g->rows].current_size -= 1; left_over++; } + } + + /* + * calculate the positions + */ + pos = CURRENT_X(g); + for (i = 0; i < g->cols; i++) { + g->col_size[i].current_pos = pos; + pos += g->col_size[i].current_size; + } + + pos = CURRENT_Y(g); + for (i = 0; i < g->rows; i++) { + g->row_size[i].current_pos = pos; + pos += g->row_size[i].current_size; } DLEAVE_FUNCTION(DLEVEL_STABLE); =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_grid.h,v retrieving revision 1.20 retrieving revision 1.21 diff -u -3 -r1.20 -r1.21 --- ewl_grid.h 24 Jul 2006 05:50:19 -0000 1.20 +++ ewl_grid.h 16 Aug 2006 18:57:41 -0000 1.21 @@ -30,6 +30,7 @@ struct Ewl_Grid_Info { int current_size; /**< the current size */ + int current_pos; /**< the current position */ int preferred_size; /**< The greatest preferred size of a widget inside */ union { int size; /**< The size set by the user */ ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs