找回密码
 注册
搜索
查看: 1530|回复: 7

发个牢骚-看MTK源码有感

[复制链接]
发表于 2006-7-6 21:45:00 | 显示全部楼层 |阅读模式
这些天,需要对ShowCategoryxxxScreen()号窗口修改字体显示行距,所以看了看GUI部分的代码,真是看的晕晕的,满页的全局变量,就算是局部变量左一个x,右一个y,然后来一个X1,Y1,X2,Y2。。。。
帮助文件也写不好,不过有点奇怪,这么多gloab变量,都没有打架,这个比较奇怪。贴一个struct来给大家分析分析:
typedef struct****
{

U32     buf_count;//
s32     x,y;
s32     width,height;
UI_filled_area*  normal_filler;
UI_filled_area*  disabled_filler;
UI_filled_area*  focussed_filler;
color    special_text_color;
color    normal_text_color;
color    disabled_text_color;
color    focussed_text_color;
color    selected_text_color;
color    selector_color;
color    cursor_color;
color    boundary_color;
s8     text_gap;
UI_font_type  text_font;
dword    flags;
UI_buffer_type  text;
s32     text_length;
s32     allocated_length;
s32     available_length;
s32     edit_width;
s32     edit_height;
s32     text_x;
s32     text_y;
s32     text_offset_x;
s32     text_offset_y;
s32     cursor_x;
s32     cursor_y;
s32     n_lines;
s32     text_height;
s32     cursor_line_position_counter;
UI_buffer_type  line_before_cursor_line_p;
UI_buffer_type  cursor_line_p;
UI_buffer_type  cursor_p;
UI_buffer_type  line_after_cursor_line_p;
UI_buffer_type  line_after_cursor_line_last_p;
UI_buffer_type  last_position_p;
byte    mask_character;
s32     UCS2_count;
s32     GSM_ext_count;
void    (*overflow_callback)(void);
void    (*change_callback)(void);
*****
大家讨论讨论
 楼主| 发表于 2006-7-7 09:07:00 | 显示全部楼层
<P>是不是发错地方了?</P>
点评回复

使用道具 举报

发表于 2006-7-7 17:07:00 | 显示全部楼层
Ram比较浪费,但实现和小的修改容易
点评回复

使用道具 举报

发表于 2006-7-7 17:37:00 | 显示全部楼层
这样写出来的代码很难 读懂~个人感觉
点评回复

使用道具 举报

 楼主| 发表于 2006-7-10 13:27:00 | 显示全部楼层
不知道你看过没有,给我感觉就是只要能实现功能,只要不出问题,随便你怎么用多可以,看来软件工程是白学了。哈哈。
点评回复

使用道具 举报

发表于 2006-7-10 16:04:00 | 显示全部楼层
<P>这个struct的定义中又很多共性的东西,可以抽象出来重新定义个struct,  上面的struct 里包含这些struct就够了,目前的虽然能实现功能,但是一旦结构要修改,就麻烦了,而如果这个struct是递交给客户的,那确实做得不够商品化,不过,老实说,绝大部分中国公司都这样</P>
点评回复

使用道具 举报

发表于 2006-7-10 16:50:00 | 显示全部楼层
mtk的全局變量跟結構是一起的.
g_cntx_xxxx.content

xxxx為相關程序的名字
点评回复

使用道具 举报

发表于 2006-7-11 13:17:00 | 显示全部楼层
<P>还可以接受,是不是太长了点啦!</P>
点评回复

使用道具 举报

高级模式
B Color Image Link Quote Code Smilies

本版积分规则

Archiver|手机版|小黑屋|52RD我爱研发网 ( 沪ICP备2022007804号-2 )

GMT+8, 2024-5-23 11:19 , Processed in 0.047682 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表