Advertisement
Guest User

Untitled

a guest
Oct 10th, 2010
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.59 KB | None | 0 0
  1. static bool skin_render_line(struct skin_element* line, struct skin_draw_info *info)
  2. {
  3. bool needs_update = false;
  4. int last_value, value;
  5. bool in_changed_alternator = false;
  6. struct skin_element *child;
  7. struct conditional *conditional;
  8. int old_refresh_mode = info->refresh_type;
  9.  
  10. if (line->type == LINE_ALTERNATOR)
  11. {
  12. line = line->children[alternator_change_line(line, info,
  13. &in_changed_alternator)];
  14. if (line->children_count == 0)
  15. return in_changed_alternator;
  16. if (in_changed_alternator)
  17. {
  18. info->refresh_type = SKIN_REFRESH_ALL;
  19. info->force_redraw = true;
  20. }
  21.  
  22. }
  23.  
  24. if (line->children_count == 0)
  25. return false; /* empty line, do nothing */
  26. child = line->children[0];
  27.  
  28. while (child)
  29. {
  30. switch (child->type)
  31. {
  32. case CONDITIONAL:
  33. conditional = (struct conditional*)child->data;
  34. last_value = conditional->last_value;
  35. value = evaluate_conditional(info->gwps, info->offset,
  36. conditional, child->children_count);
  37. conditional->last_value = value;
  38. if (child->children_count == 1)
  39. {
  40. /* special handling so
  41. * %?aa<true> and %?<true|false> need special handlng here */
  42.  
  43. if (value == -1) /* tag is false */
  44. {
  45. /* we are in a false branch of a %?aa<true> conditional */
  46. if (last_value == 0)
  47. do_tags_in_hidden_conditional(child->children[0], info);
  48. break;
  49. }
  50. }
  51. else
  52. {
  53. if (last_value >= 0 && value != last_value && last_value < child->children_count)
  54. do_tags_in_hidden_conditional(child->children[last_value], info);
  55. }
  56. if (value != last_value)
  57. {
  58. info->refresh_type = SKIN_REFRESH_ALL;
  59. info->force_redraw = true;
  60. }
  61. if (skin_render_line(child->children[value], info))
  62. needs_update = true;
  63. else
  64. needs_update = needs_update || (last_value != value);
  65.  
  66. info->refresh_type = old_refresh_mode;
  67. break;
  68. case TAG:
  69. if (child->tag->flags & NOBREAK)
  70. info->no_line_break = true;
  71. if (child->tag->type == SKIN_TOKEN_SUBLINE_SCROLL)
  72. info->line_scrolls = true;
  73.  
  74. fix_line_alignment(info, child);
  75.  
  76. if (!child->data)
  77. {
  78. break;
  79. }
  80. if (!do_non_text_tags(info->gwps, info, child, &info->skin_vp->vp))
  81. {
  82. static char tempbuf[128];
  83. const char *value = get_token_value(info->gwps, child->data,
  84. info->offset, tempbuf,
  85. sizeof(tempbuf), NULL);
  86. if (value)
  87. {
  88. #if CONFIG_RTC
  89. if (child->tag->flags&SKIN_RTC_REFRESH)
  90. needs_update = needs_update || info->refresh_type&SKIN_REFRESH_DYNAMIC;
  91. #endif
  92. needs_update = needs_update ||
  93. ((child->tag->flags&info->refresh_type)!=0);
  94. strlcat(info->cur_align_start, value,
  95. info->buf_size - (info->cur_align_start-info->buf));
  96. }
  97. }
  98. break;
  99. case TEXT:
  100. strlcat(info->cur_align_start, child->data,
  101. info->buf_size - (info->cur_align_start-info->buf));
  102. needs_update = needs_update ||
  103. (info->refresh_type&SKIN_REFRESH_STATIC) != 0;
  104. break;
  105. case COMMENT:
  106. default:
  107. break;
  108. }
  109.  
  110. child = child->next;
  111. }
  112. if (in_changed_alternator)
  113. {
  114. info->refresh_type = old_refresh_mode;
  115. info->force_redraw = false;
  116. needs_update = true;
  117. }
  118. return needs_update;
  119. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement