Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_grid.c ewl_table.c ewl_calendar.c 


Log Message:
*API BREAK* make the grid more c-ish

the functions concerning the columns and rows are now estimates now 
values starting to count from 0

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_grid.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- ewl_grid.c  10 Jul 2006 03:07:07 -0000      1.19
+++ ewl_grid.c  11 Jul 2006 01:24:24 -0000      1.20
@@ -330,23 +330,23 @@
        /*
         * check bounds
         */
-       if (start_col < 1) {
+       if (start_col < 0) {
                DWARNING("start_col out of bounds. min is 1\n");
                DLEAVE_FUNCTION(DLEVEL_STABLE);
        }
 
-       if (end_col > g->cols)
-               new_cols = end_col;
+       if (end_col >= g->cols)
+               new_cols = end_col + 1;
        else
                new_cols = g->cols;
        
-       if (start_row < 1) {
+       if (start_row < 0) {
                DWARNING("start_row out of bounds. min is 1\n");
                DLEAVE_FUNCTION(DLEVEL_STABLE);
        }
 
-       if (end_row > g->rows)
-               new_rows = end_row;
+       if (end_row >= g->rows)
+               new_rows = end_row + 1;
        else
                new_rows = g->rows;
 
@@ -401,17 +401,17 @@
        /*
         * check bounds
         */
-       if (col < 1) {
+       if (col < 0) {
                DWARNING("parameter 'col' is out of bounds\n");
                DLEAVE_FUNCTION(DLEVEL_STABLE);
        }
-       else if (col > g->cols) {
-               ewl_grid_dimensions_set(g, col, g->rows);
+       else if (col >= g->cols) {
+               ewl_grid_dimensions_set(g, col + 1, g->rows);
        }
 
-       g->col_size[col - 1].override = 1;
-       g->col_size[col - 1].size = width;
-       g->col_size[col - 1].rel_size = relw;
+       g->col_size[col].override = 1;
+       g->col_size[col].size = width;
+       g->col_size[col].rel_size = relw;
        g->data_dirty = TRUE;
 
        ewl_widget_configure(EWL_WIDGET(g));
@@ -437,13 +437,13 @@
        DCHECK_PARAM_PTR("width", width);
        DCHECK_TYPE("g", g, EWL_GRID_TYPE);
 
-       if ((col > g->cols) || (col < 1)) {
+       if ((col >= g->cols) || (col < 0)) {
                if (width) *width = 0;
                if (relw) *relw = 0.0;
        }
        else {
-               if (width) *width = g->col_size[col-1].size;
-               if (relw) *relw = g->col_size[col-1].rel_size;
+               if (width) *width = g->col_size[col].size;
+               if (relw) *relw = g->col_size[col].rel_size;
        }
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -465,16 +465,16 @@
        DCHECK_TYPE("g", g, EWL_GRID_TYPE);
 
        /* check bounds */
-       if (row < 1) {
+       if (row < 0) {
                DLEAVE_FUNCTION(DLEVEL_STABLE);
        }
-       else if (row > g->rows) {
-               ewl_grid_dimensions_set(g, g->cols, row);
+       else if (row >= g->rows) {
+               ewl_grid_dimensions_set(g, g->cols, row + 1);
        }
 
-       g->row_size[row - 1].override = 1;
-       g->row_size[row - 1].size = height;
-       g->row_size[row - 1].rel_size = relh;
+       g->row_size[row].override = 1;
+       g->row_size[row].size = height;
+       g->row_size[row].rel_size = relh;
 
        ewl_widget_configure(EWL_WIDGET(g));
 
@@ -499,13 +499,13 @@
        DCHECK_PARAM_PTR("height", height);
        DCHECK_TYPE("g", g, EWL_GRID_TYPE);
 
-       if ((row > g->rows) || (row < 1)) {
+       if ((row >= g->rows) || (row < 0)) {
                if (height) *height = 0;
                if (relh) *relh = 0.0;
        }
        else {
-               if (height) *height = g->row_size[row - 1].size;
-               if (relh) *relh = g->row_size[row - 1].rel_size;
+               if (height) *height = g->row_size[row].size;
+               if (relh) *relh = g->row_size[row].rel_size;
        }
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -573,19 +573,19 @@
                         */
                        
                        /* calculate child widgets width */
-                       for (i = (c->start_col - 1); i < c->end_col; i++)
+                       for (i = c->start_col; i <= c->end_col; i++)
                                c_w += g->col_size[i].current_size;
 
                        /* calculate child widgets height */
-                       for (i = (c->start_row - 1); i < c->end_row; i++)
+                       for (i = c->start_row; i <= c->end_row; i++)
                                c_h += g->row_size[i].current_size;
 
                        /* calculate child widgets x coordinate */
-                       for (i = 0; i < (c->start_col - 1); i++)
+                       for (i = 0; i < c->start_col; i++)
                                c_x += g->col_size[i].current_size;
 
                        /* calculate child widgets y coordinate */
-                       for (i = 0; i < (c->start_row - 1); i++)
+                       for (i = 0; i < c->start_row; i++)
                                c_y += g->row_size[i].current_size;
                }
                else {
@@ -671,8 +671,9 @@
                /* 
                 * mark all positions that content a  positioned widget 
                 */
-               for (l = (c->start_col - 1); l < c->end_col && l < g->cols; l++)
-                       for (k = c->start_row - 1; k < c->end_row && k < 
g->rows; k++)
+               for (l = c->start_col; l <= c->end_col && l < g->cols; l++)
+                       for (k = c->start_row; k <= c->end_row 
+                                                       && k < g->rows; k++)
                                g->map[g->cols * k + l]  = 1;
        }
        DLEAVE_FUNCTION(DLEVEL_STABLE);
@@ -746,10 +747,10 @@
                 * first calculate the current preferred size 
                 * of the cells 
                 */
-               for (i = (c->start_col - 1); i < c->end_col; i++)
+               for (i = c->start_col; i <= c->end_col; i++)
                        pref_w += g->col_size[i].preferred_size;
 
-               for (i = (c->start_row - 1); i < c->end_row; i++)
+               for (i = c->start_row; i <= c->end_row; i++)
                        pref_h += g->row_size[i].preferred_size;
                        
                pref_w = ewl_object_preferred_w_get(EWL_OBJECT(child)) - pref_w;
@@ -757,13 +758,13 @@
                        
                if (pref_w > 0) {
                        pref_w /= c->end_col - c->start_col + 1;
-                       for (i = (c->start_col - 1); i < c->end_col; i++)
+                       for (i = c->start_col; i <= c->end_col; i++)
                                g->col_size[i].preferred_size += pref_w;
                }
 
                if (pref_h > 0) {
                        pref_h /= c->end_row - c->start_row + 1;
-                       for (i = (c->start_row - 1); i < c->end_row; i++)
+                       for (i = c->start_row; i <= c->end_row; i++)
                                g->row_size[i].preferred_size += pref_h;
                }
        }
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_table.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- ewl_table.c 10 Jul 2006 09:14:08 -0000      1.18
+++ ewl_table.c 11 Jul 2006 01:24:24 -0000      1.19
@@ -119,7 +119,7 @@
  * @param table: the table
  * @param w: the cell to add
  * @param start_col: the start column
- * @param end_col: the end columnt
+ * @param end_col: the end column
  * @param start_row: the start row
  * @param end_row: the end row
  * @return Returns no value.
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_calendar.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -3 -r1.17 -r1.18
--- ewl_calendar.c      10 Jul 2006 02:43:24 -0000      1.17
+++ ewl_calendar.c      11 Jul 2006 01:24:24 -0000      1.18
@@ -272,8 +272,9 @@
                
                ewl_container_child_append(EWL_CONTAINER(cal->grid), day_label);
                ewl_grid_child_position_set(EWL_GRID(cal->grid), 
-                                               day_label, cur_col, cur_col,
-                                               cur_row, cur_row);
+                                               day_label, cur_col - 1, 
+                                               cur_col - 1, cur_row - 1, 
+                                               cur_row - 1);
                ewl_calendar_highlight_today(now, EWL_LABEL(day_label), cal);
                ewl_widget_show(day_label);
 
@@ -420,43 +421,43 @@
        day_label = ewl_label_new();
        ewl_label_text_set(EWL_LABEL(day_label), "M");
        ewl_container_child_append(EWL_CONTAINER(ib->grid), day_label);
-       ewl_grid_child_position_set(EWL_GRID(ib->grid), day_label, 1, 1, 1, 1);
+       ewl_grid_child_position_set(EWL_GRID(ib->grid), day_label, 0, 0, 0, 0);
        ewl_widget_show(day_label);
 
        day_label = ewl_label_new();
        ewl_label_text_set(EWL_LABEL(day_label), "T");
        ewl_container_child_append(EWL_CONTAINER(ib->grid), day_label);
-       ewl_grid_child_position_set(EWL_GRID(ib->grid), day_label, 2, 2, 1, 1);
+       ewl_grid_child_position_set(EWL_GRID(ib->grid), day_label, 1, 1, 0, 0);
        ewl_widget_show(day_label);
 
        day_label = ewl_label_new();
        ewl_label_text_set(EWL_LABEL(day_label), "W");
        ewl_container_child_append(EWL_CONTAINER(ib->grid), day_label);
-       ewl_grid_child_position_set(EWL_GRID(ib->grid), day_label, 3, 3, 1, 1);
+       ewl_grid_child_position_set(EWL_GRID(ib->grid), day_label, 2, 2, 0, 0);
        ewl_widget_show(day_label);
 
        day_label = ewl_label_new();
        ewl_label_text_set(EWL_LABEL(day_label), "T");
        ewl_container_child_append(EWL_CONTAINER(ib->grid), day_label);
-       ewl_grid_child_position_set(EWL_GRID(ib->grid), day_label, 4, 4, 1, 1);
+       ewl_grid_child_position_set(EWL_GRID(ib->grid), day_label, 3, 3, 0, 0);
        ewl_widget_show(day_label);
 
        day_label = ewl_label_new();
        ewl_label_text_set(EWL_LABEL(day_label), "F");
        ewl_container_child_append(EWL_CONTAINER(ib->grid), day_label);
-       ewl_grid_child_position_set(EWL_GRID(ib->grid), day_label, 5, 5, 1, 1);
+       ewl_grid_child_position_set(EWL_GRID(ib->grid), day_label, 4, 4, 0, 0);
        ewl_widget_show(day_label);
 
        day_label = ewl_label_new();
        ewl_label_text_set(EWL_LABEL(day_label), "S");
        ewl_container_child_append(EWL_CONTAINER(ib->grid), day_label);
-       ewl_grid_child_position_set(EWL_GRID(ib->grid), day_label, 6, 6, 1, 1);
+       ewl_grid_child_position_set(EWL_GRID(ib->grid), day_label, 5, 5, 0, 0);
        ewl_widget_show(day_label);
 
        day_label = ewl_label_new();
        ewl_label_text_set(EWL_LABEL(day_label), "S");
        ewl_container_child_append(EWL_CONTAINER(ib->grid), day_label);
-       ewl_grid_child_position_set(EWL_GRID(ib->grid), day_label, 7, 7, 1, 1);
+       ewl_grid_child_position_set(EWL_GRID(ib->grid), day_label, 6, 6, 0, 0);
        ewl_widget_show(day_label);
 
        DLEAVE_FUNCTION(DLEVEL_STABLE);




-------------------------------------------------------------------------
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

Reply via email to