Skip to content

Commit

Permalink
添加TextBox部件(正在设计实现),其它做了相关修改
Browse files Browse the repository at this point in the history
  • Loading branch information
lc-soft committed Sep 17, 2012
1 parent dc6ccbb commit 48f37be
Show file tree
Hide file tree
Showing 16 changed files with 688 additions and 44 deletions.
20 changes: 10 additions & 10 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.68 for LCUI 0.12.5.
# Generated by GNU Autoconf 2.68 for LCUI 0.12.6.
#
# Report bugs to <lc-soft@live.cn>.
#
Expand Down Expand Up @@ -570,8 +570,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='LCUI'
PACKAGE_TARNAME='lcui'
PACKAGE_VERSION='0.12.5'
PACKAGE_STRING='LCUI 0.12.5'
PACKAGE_VERSION='0.12.6'
PACKAGE_STRING='LCUI 0.12.6'
PACKAGE_BUGREPORT='lc-soft@live.cn'
PACKAGE_URL=''

Expand Down Expand Up @@ -1306,7 +1306,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures LCUI 0.12.5 to adapt to many kinds of systems.
\`configure' configures LCUI 0.12.6 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

Expand Down Expand Up @@ -1377,7 +1377,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of LCUI 0.12.5:";;
short | recursive ) echo "Configuration of LCUI 0.12.6:";;
esac
cat <<\_ACEOF

Expand Down Expand Up @@ -1485,7 +1485,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
LCUI configure 0.12.5
LCUI configure 0.12.6
generated by GNU Autoconf 2.68

Copyright (C) 2010 Free Software Foundation, Inc.
Expand Down Expand Up @@ -2029,7 +2029,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by LCUI $as_me 0.12.5, which was
It was created by LCUI $as_me 0.12.6, which was
generated by GNU Autoconf 2.68. Invocation command line was

$ $0 $@
Expand Down Expand Up @@ -2960,7 +2960,7 @@ fi

# Define the identity of the package.
PACKAGE='lcui'
VERSION='0.12.5'
VERSION='0.12.6'


cat >>confdefs.h <<_ACEOF
Expand Down Expand Up @@ -16907,7 +16907,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by LCUI $as_me 0.12.5, which was
This file was extended by LCUI $as_me 0.12.6, which was
generated by GNU Autoconf 2.68. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -16973,7 +16973,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
LCUI config.status 0.12.5
LCUI config.status 0.12.6
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# http://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/index.html

AC_PREREQ([2.68])
AC_INIT(LCUI, 0.12.5, lc-soft@live.cn)
AC_INIT(LCUI, 0.12.6, lc-soft@live.cn)

# Check system type
AC_CANONICAL_TARGET
Expand Down
4 changes: 2 additions & 2 deletions include/LCUI/LCUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@
#define ture 1
#endif

enum _BOOL
typedef enum _BOOL
{
IS_FALSE = 0,
IS_TRUE = 1,
IS_ERROR = -1
};
}BOOL;

#define FORCE 2

Expand Down
6 changes: 6 additions & 0 deletions include/LCUI/LCUI_Misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ void Strcpy (LCUI_String * des, const char *src);
int Strcmp(LCUI_String *str1, const char *str2);
/* 功能:对比str1与str2 */

int LCUI_Strcmp(LCUI_String *str1, LCUI_String *str2);
/* LCUI_String 字符串对比 */

int LCUI_Strcpy(LCUI_String *str1, LCUI_String *str2);
/* LCUI_String 字符串拷贝 */

void Get_Moved_Rect_Refresh_Area (int new_x, int new_y, LCUI_Rect rect,
LCUI_Rect * rect_a, LCUI_Rect * rect_b);
/* 功能:获取一个矩形移动后需要刷新的残留区域,也就是A和B两个区域 */
Expand Down
2 changes: 1 addition & 1 deletion include/LCUI/LCUI_Queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void * Queue_Get (LCUI_Queue * queue, int pos);
* 注意:请勿对返回的指针进行free操作
* */

int Queue_Insert(const void *data, int pos, LCUI_Queue * queue);
int Queue_Insert(LCUI_Queue * queue, int pos, const void *data);
/* 功能:向队列中指定位置插入成员 */

int Queue_Move(LCUI_Queue *queue, int des_pos, int src_pos);
Expand Down
2 changes: 2 additions & 0 deletions include/LCUI/LCUI_Widget.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class LCUIWidget
int setAlign(LCUI_Align align, LCUI_Pos offset_pos);
int setBorder(LCUI_RGB color, LCUI_Border border);
int setBackgroundImage(LCUI_Graph *img, int flag);
//int connectDragEvent(void (*func)(LCUIWidget &obj, LCUI_DragEvent *event));
//int connectClickedEvent(void (*func)(LCUIWidget &obj, LCUI_DragEvent *event));
/* window widget class */
class _Window
{
Expand Down
2 changes: 1 addition & 1 deletion include/LCUI/LCUI_Work.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ typedef struct _LCUI_DragEvent LCUI_DragEvent;
/************ 部件事件 ************/
typedef enum _WidgetEvent_ID
{
EVENT_DRAG, /* 部件的拖动事件 */
EVENT_DRAG, /* 部件的拖动事件 */
EVENT_CLICKED /* 部件的点击事件 */
}WidgetEvent_ID;
/*********************************/
Expand Down
21 changes: 15 additions & 6 deletions src/LCUI_Font.c
Original file line number Diff line number Diff line change
Expand Up @@ -3292,10 +3292,14 @@ int Get_WChar_Bitmap(LCUI_Font *font_data, wchar_t ch, LCUI_Bitmap *out_bitmap)
slot = p_FT_Face->glyph;
if(ch == ' ') { /* 如果有空格,它的宽度就以字母a的宽度为准 */
error = FT_Load_Char( p_FT_Face, 'a', font_data->load_flags);
if(error) return error;
if(error) {
return error;
}

error = FT_Get_Glyph(p_FT_Face -> glyph, &glyph);
if(error) return error;
if(error) {
return error;
}

Free_Bitmap(out_bitmap);
/* 背景图形的高度,这个高度要大于字体的高度,所以是+3 */
Expand All @@ -3314,12 +3318,16 @@ int Get_WChar_Bitmap(LCUI_Font *font_data, wchar_t ch, LCUI_Bitmap *out_bitmap)
}
/* 这个函数只是简单地调用FT_Get_Char_Index和FT_Load_Glyph */
error = FT_Load_Char( p_FT_Face, ch, font_data->load_flags);
if(error) return error;
if(error) {
return error;
}

/* 从插槽中提取一个字形图像
* 请注意,创建的FT_Glyph对象必须与FT_Done_Glyph成对使用 */
error = FT_Get_Glyph(p_FT_Face->glyph, &glyph);
if(error) return error;
if(error) {
return error;
}

int bg_height;
Free_Bitmap(out_bitmap);
Expand All @@ -3336,10 +3344,11 @@ int Get_WChar_Bitmap(LCUI_Font *font_data, wchar_t ch, LCUI_Bitmap *out_bitmap)
ch_width = bitmap.width;
/* 处理字体位图在背景图中的范围 */
if(start_y < 0) start_y = 0;
if(bitmap.rows > bg_height)
if(bitmap.rows > bg_height) {
ch_height = font_data->size;
else
} else {
ch_height = bitmap.rows;
}

if(ch_height + start_y > bg_height)
ch_height = bg_height - start_y;
Expand Down
13 changes: 7 additions & 6 deletions src/LCUI_Graphics.c
Original file line number Diff line number Diff line change
Expand Up @@ -1257,9 +1257,10 @@ int Align_Image(LCUI_Graph *graph, LCUI_Graph *image, int flag)
LCUI_Pos pos;
pos.x = 0;
pos.y = 0;
if(!Valid_Graph(graph) || ! Valid_Graph(image))
/* 如果图片无效 */
if(!Valid_Graph(graph) || ! Valid_Graph(image)) {
return -1;
}

if((flag & ALIGN_TOP_LEFT) == ALIGN_TOP_LEFT);
/* 向左上角对齐 */
Expand Down Expand Up @@ -1321,29 +1322,29 @@ int Fill_Background_Image(LCUI_Graph *graph, LCUI_Graph *bg, int flag, LCUI_RGB
pos.y = 0;
Graph_Init(&temp_bg);
switch(flag) {
case LAYOUT_ZOOM:/* 缩放 */
case LAYOUT_ZOOM:/* 缩放 */
Zoom_Graph( bg, &temp_bg, DEFAULT,
Size(graph->width, graph->height)
);
pos.x = (graph->width - temp_bg.width) / 2.0;
pos.y = (graph->height - temp_bg.height) / 2.0;
Mix_Graph(graph, &temp_bg, pos);
break;
case LAYOUT_STRETCH:/* 拉伸 */
case LAYOUT_STRETCH:/* 拉伸 */
Zoom_Graph( bg, &temp_bg, CUSTOM,
Size(graph->width, graph->height)
);
Mix_Graph(graph, &temp_bg, pos);
break;
case LAYOUT_CENTER:/* 居中 */
case LAYOUT_CENTER:/* 居中 */
pos.x = (graph->width - bg->width) / 2;
pos.y = (graph->height - bg->height) / 2;
Mix_Graph(graph, bg, pos);
break;
case LAYOUT_TILE:/* 平铺 */
case LAYOUT_TILE:/* 平铺 */
Tile_Graph(bg, graph, graph->width, graph->height);
break;
default:
default:
Mix_Graph(graph, bg, pos);
break;
}
Expand Down
14 changes: 6 additions & 8 deletions src/LCUI_Input.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,8 @@ int Set_Raw(int t)
printf("\033[?25l");/* 隐藏光标 */
} else {
/* 以下值是通过获取正常终端属性得到的 */
tm.c_iflag = 11522;
tm.c_oflag = 5;
tm.c_cflag = 1215;
tm.c_lflag = 35387;
tm.c_lflag |= ICANON;
tm.c_lflag |= ECHO;
tm.c_cc[VMIN] = 1;
tm.c_cc[VTIME] = 0;
if(tcsetattr(fd,TCSANOW,&tm)<0)
Expand All @@ -396,13 +394,13 @@ int Check_Key(void)
* 2 无按键输入
* */
{
struct termios oldt, newt;
struct termios oldt;//, newt;
int ch;
int oldf;
tcgetattr(STDIN_FILENO, &oldt);
newt = oldt;
newt.c_lflag &= ~(ICANON | ECHO);
tcsetattr(STDIN_FILENO, TCSANOW, &newt);
//newt = oldt;
//newt.c_lflag &= ~(ICANON | ECHO);
//tcsetattr(STDIN_FILENO, TCSANOW, &newt);
oldf = fcntl(STDIN_FILENO, F_GETFL, 0);
fcntl(STDIN_FILENO, F_SETFL, oldf | O_NONBLOCK);
ch = getchar(); /* 获取一个字符 */
Expand Down
26 changes: 26 additions & 0 deletions src/LCUI_Misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,32 @@ int Strcmp(LCUI_String *str1, const char *str2)
else return -1;
}

int LCUI_Strcmp(LCUI_String *str1, LCUI_String *str2)
/* LCUI_String 字符串对比 */
{
if( str1->size > 0 && str2->size > 0 ) {
return strcmp(str1->string, str2->string);
}
return 0;
}

int LCUI_Strcpy(LCUI_String *str1, LCUI_String *str2)
/* LCUI_String 字符串拷贝 */
{
if( str2->size <= 0 ) {
return -1;
}
if(str1->size > 0) {
if( str2->size > str1->size ) {
free( str1->string );
str1->string = (char*)calloc(str2->size+1, sizeof(char));
}
}
strcpy( str1->string, str2->string );
str1->size = str2->size;
return 0;
}

void Get_Moved_Rect_Refresh_Area (int new_x, int new_y, LCUI_Rect rect,
LCUI_Rect * rect_a, LCUI_Rect * rect_b)
/* 功能:获取一个矩形移动后需要刷新的残留区域,也就是A和B两个区域。 */
Expand Down
4 changes: 2 additions & 2 deletions src/LCUI_Queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void Queue_Init (LCUI_Queue * queue, size_t element_size, void (*func) ())
/* 功能:初始化队列 */
{
thread_rwlock_init(&queue->lock);
queue->member_type = 0;
queue->member_type = 0;
queue->queue = NULL;
queue->total_num = 0;
queue->max_num = 0;
Expand Down Expand Up @@ -215,7 +215,7 @@ void * Queue_Get (LCUI_Queue * queue, int pos)
return data;
}

int Queue_Insert(const void *data, int pos, LCUI_Queue * queue)
int Queue_Insert( LCUI_Queue * queue, int pos, const void *data)
/* 功能:向队列中指定位置插入成员 */
{
int i, total;
Expand Down
Loading

0 comments on commit 48f37be

Please sign in to comment.