Ignore:
Timestamp:
02/06/11 18:24:35 (2 years ago)
Author:
jylam
Message:
  • Moved table's stuff to render/table.c
File:
1 edited

Legend:

Unmodified
Added
Removed
  • gaycko/trunk/src/render/position.c

    r4760 r4761  
    108108 
    109109 
    110 void gaycko_fix_table(gNode *table) { 
    111         unsigned int tr = 0; 
    112     unsigned int e  = 0; 
    113     gNode *last_tr = NULL; 
    114     table->specific.table->tr_count = 0; 
    115      
    116     /* Count TD by TR, and TR by TABLE */ 
    117     for(tr = 0 ; tr < table->children_count; tr++) { 
    118         if(table->children[tr]->type == ELEM_TR) { 
    119             gaycko_fix_tr(table->children[tr]); 
    120             table->specific.table->tr_count++;  
    121             last_tr = table->children[tr]; 
    122         } 
    123     } 
    124      
    125      
    126     /* Scan TD's and set each correspondants to the max width */ 
    127     unsigned int td = 0; 
    128     for(td = 0; td < last_tr->specific.tr->td_count; td++) { 
    129         unsigned int biggest_td = 0; 
    130          
    131         for(e = 0 ; e < table->children_count; e++) { 
    132             if(table->children[e]->type == ELEM_TR) { 
    133                 unsigned int td_width = gaycko_get_td_width(table->children[e], td); 
    134                 if(biggest_td < td_width) { 
    135                     biggest_td = td_width; 
    136                 } 
    137             } 
    138         } 
    139         for(e = 0 ; e < table->children_count; e++) { 
    140             if(table->children[e]->type == ELEM_TR) { 
    141                 gaycko_set_td_width(table->children[e], td, biggest_td); 
    142             } 
    143         } 
    144          
    145     } 
    146      
    147 } 
    148  
    149 void gaycko_fix_tr(gNode *tr) { 
    150         unsigned int td = 0; 
    151     tr->specific.tr->td_count = 0; 
    152      
    153     for(td = 0 ; td < tr->children_count; td++) { 
    154         if(tr->children[td]->type == ELEM_TD) { 
    155             tr->specific.tr->td_count++;  
    156         } 
    157     } 
    158 }     
    159      
    160 unsigned int gaycko_get_td_width(gNode *tr, unsigned int td_index) { 
    161     unsigned int e = 0; 
    162     unsigned int td = 0; 
    163     for(e = 0 ; e < tr->children_count; e++) { 
    164         if(tr->children[e]->type == ELEM_TD) { 
    165             if(td == td_index) return tr->children[e]->properties->width; 
    166             td++; 
    167         } 
    168     } 
    169     return 0; 
    170 } 
    171      
    172 void gaycko_set_td_width(gNode *tr, unsigned td_index, unsigned int width) { 
    173     unsigned int e = 0; 
    174     unsigned int td = 0; 
    175     unsigned int add_width = 0; 
    176      
    177     for(e = 0 ; e < tr->children_count; e++) { 
    178         if(tr->children[e]->type == ELEM_TD) { 
    179             if(td == td_index) { 
    180                 add_width = width - tr->children[e]->properties->width; 
    181             } else { 
    182                 gaycko_add_node_x(tr->children[e], add_width); 
    183             } 
    184             td++; 
    185         } 
    186     } 
    187 } 
    188  
    189110 
    190111void gaycko_add_node_x(gNode *node, unsigned int add) { 
Note: See TracChangeset for help on using the changeset viewer.