Changeset 4761


Ignore:
Timestamp:
Feb 6, 2011, 6:24:35 PM (10 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Moved table's stuff to render/table.c
Location:
gaycko/trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • gaycko/trunk/XCode_Project/XCode_Project.xcodeproj/project.pbxproj

    r4753 r4761  
    99/* Begin PBXFileReference section */
    1010                E6382BDC12FEDA660075A5CA /* position.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = position.c; sourceTree = "<group>"; };
     11                E6382D3812FF10830075A5CA /* table.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = table.c; sourceTree = "<group>"; };
    1112                E6545FB112FC91A000CB46A8 /* renderer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = renderer.c; sourceTree = "<group>"; };
    1213                E6545FB212FC91A000CB46A8 /* renderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = renderer.h; sourceTree = "<group>"; };
     
    5657                                E6545FB112FC91A000CB46A8 /* renderer.c */,
    5758                                E6382BDC12FEDA660075A5CA /* position.c */,
     59                                E6382D3812FF10830075A5CA /* table.c */,
    5860                        );
    5961                        path = render;
  • gaycko/trunk/src/Makefile.am

    r4752 r4761  
    1313         window/window.c   window/window.h   \
    1414                 render/renderer.c render/renderer.h \
    15          render/position.c
     15         render/position.c render/table.c   
    1616         
    1717Gaycko_CFLAGS  = @CACA_INCLUDES@ @XML2_INCLUDES@ @CURL_INCLUDES@ @TIDY_INCLUDES@
  • 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.