本文主要是介绍MiniGUI移植总结,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Gal engine option
选择
GAL and its engines:NEWGAL
Include Advanced 2D Graphics APIs
NEWGAL dummy engine
NEWGAL engine on Linux FrameBuffer console
Have console on
IAL engine options
选择
Dummy IAL engine
Font options
选择
Raw bitmap font
Image option
选择
GIF file support
Appearance options
选择
Flat
Ext library options
选择
TreeView control
ListView control
MonthCalendor control
SpinBox control
CoolBar control
Animation control
IconView control
Grid control
Development environment options
The target operating system:uClinux
Compiler:arm-elf-gcc
Libc:uClibc
uClinux-dist directory:/opt/uClinux-dist //uClinux-dist 的位置
Path prefix:/usr/local/arm-elf //arm-elf-gcc 的位置
CFLAGS和LDFLAGS I 不填。
Tarball baler options
选择
uClinux
保存退出
make
make install
安装到/usr/local/arm-elf-gcc/
2.2 移植配置文件和资源
1) 配置文件 MiniGUI.cfg
配置文件的名称必需是MiniGUI.cfg,放在/etc/ 下。
由于DRAM的大小限制,我对MiniGUI的资源进行了裁减,主要是字体部分。fbcon 表示采用Framebuffer,dummy表示没有输入设备,如触摸屏。
[varbitmapfonts]
font_number=0
表示没有varbitmapfonts,会忽略该字段下的资源引用。
/******************************************************************************
[system]
# GAL engine
gal_engine=fbcon
# IAL engine
ial_engine=dummy
mdev=none
mtype=none
[fbcon]
defaultmode=320x240-8bpp
[qvfb]
defaultmode=320x240-8bpp
display=0
# The first system font must be a logical font using RBF device font.
[systemfont]
font_number=1
font0=rbf-fixed-rrncnn-8-16-ISO8859-1
#font1=*-fixed-rrncnn-*-16-GB2312
#font2=*-Courier-rrncnn-*-16-GB2312
#font3=*-Times-rrncnn-*-16-GB2312
#font4=*-Helvetica-rrncnn-*-16-GB2312
default=0
wchar_def=0
fixed=0
caption=0
menu=0
control=0
[rawbitmapfonts]
font_number=1
name0=rbf-fixed-rrncnn-8-16-ISO8859-1
fontfile0=/usr/res/font/8x16-iso8859-1.bin
#name1=rbf-fixed-rrncnn-16-16-GB2312.1980-0
#fontfile1=/usr/res/font/song-16-gb2312.bin
[varbitmapfonts]
font_number=0
name0=vbf-Courier-rrncnn-10-15-ISO8859-1
fontfile0=/usr/res/font/Courier-rr-10-15.vbf
name1=vbf-Helvetica-rrncnn-15-16-ISO8859-1
fontfile1=/usr/res/font/Helvetica-rr-15-16.vbf
name2=vbf-Times-rrncnn-13-15-ISO8859-1
fontfile2=/usr/res/font/Times-rr-13-15.vbf
[mouse]
dblclicktime=300
[event]
timeoutusec=300000
repeatusec=50000
[cursorinfo]
# Edit following line to specify cursor files path
cursorpath=/usr/res/cursor/
cursornumber=4
cursor0=d_arrow.cur
cursor1=d_beam.cur
cursor2=d_pencil.cur
cursor3=d_cross.cur
[iconinfo]
# Edit following line to specify icon files path
iconpath=/usr/res/icon/
# Note that max number defined in source code is 5.
iconnumber=5
icon0=form.ico
icon1=w95mbx01.ico
icon2=w95mbx02.ico
icon3=w95mbx03.ico
icon4=w95mbx04.ico
[bitmapinfo]
# Edit following line to specify bitmap files path
bitmappath=/usr/res/bmp/
# Note that max number defined in source code is 7
bitmapnumber=2
bitmap0=capbtns.bmp
# bitmap1=arrows.bmp
# use large bitmap if your default font is 16 pixel height.
bitmap1=arrows16.bmp
bitmap2=none
bitmap3=none
bitmap4=none
bitmap5=none
# background picture, use your favirate photo
bitmap6=none
# bitmap used by BUTTON control
button=button.bmp
pushbutton=none
pushedbutton=none
# bitmap used by LISTBOX control
checkmark=checkmark.bmp
# bitmap used by COMBOBOX control
downarrow=downarrow.bmp
updownarrow=updownarrow.bmp
leftrightarrow=leftrightarrow.bmp
# bitmap used by IME window
IMEctrlbtn=shurufa.bmp
# bitmap used by About dialog box
logo=MiniGUI256.bmp
# logo=MiniGUI16.bmp
[bgpicture]
position=center
# position=upleft
# position=downleft
# position=upright
# position=downright
# position=upcenter
# position=downcenter
# position=vcenterleft
# position=vcenterright
# position=none
[mainwinmetrics]
minwidth=50
minheight=50
border=2
thickframe=2
thinframe=1
captiony=+4
iconx=16
icony=16
menubary=+0
menubaroffx=8
menubaroffy=5
menuitemy=+0
intermenuitemx=12
intermenuitemy=2
menuitemoffx=18
menutopmargin=4
menubottommargin=4
menuleftmargin=4
menurightmargin=4
menuitemminx=64
menuseparatory=4
menuseparatorx=4
sb_height=14
sb_width=16
sb_interx=2
cxvscroll=16
cyvscroll=16
cxhscroll=16
cyhscroll=16
minbarlen=9
defbarlen=18
[windowelementcolors]
bkc_caption_normal=0x00808080
fgc_caption_normal=0x 00C 0C 0C 0
bkc_caption_actived=0x00800000
fgc_caption_actived=0x00FFFFFF
bkc_caption_disabled=0x00808080
fgc_caption_disabled=0x 00C 0C 0C 0
wec_frame_normal=0x00000000
wec_frame_actived=0x00FF0000
wec_frame_disabled=0x00000000
bkc_menubar_normal=0x 00C 0C 0C 0
fgc_menubar_normal=0x00000000
bkc_menubar_hilite=0x00800000
fgc_menubar_hilite=0x00FFFFFF
fgc_menubar_disabled=0x00808080
bkc_menuitem_normal=0x 00C 0C 0C 0
fgc_menuitem_normal=0x00000000
bkc_menuitem_hilite=0x00800000
fgc_menuitem_hilite=0x00FFFFFF
fgc_menuitem_disabled=0x00808080
bkc_pppmenutitle=0x 00C 0C 0C 0
fgc_pppmenutitle=0x00FF0000
fgc_menuitem_frame=0x 00C 66931
wec_3dbox_normal=0x 00C 0C 0C 0
wec_3dbox_reverse=0x00000000
wec_3dbox_light=0x00FFFFFF
wec_3dbox_dark=0x00808080
wec_flat_border=0x00808080
bkc_control_def=0x 00C 0C 0C 0
fgc_control_normal=0x00000000
fgc_control_disabled=0x 00C 0C 0C 0
bkc_hilight_normal=0x00FF0000
bkc_hilight_lostfocus=0x00BDA 69C
fgc_hilight_normal=0x00FFFFFF
fgc_hilight_disabled=0x 00C 0C 0C 0
bkc_desktop=0x00FF0000
bkc_dialog=0x 00C 0C 0C 0
bkc_tip=0x 00C 8FCF8
[imeinfo]
imetabpath=/usr/res/imetab/
imenumber=0
ime0=pinyin
[appinfo]
apprespath=/usr/local/lib/shared/miniguiapps/
********************************************************************/
2) 资源包 res
res/ 放在/usr/ 下。
RES/
BMP/ 包含位图文件
CURSOR/ 包含光标文件
FONT/ 包含字体文件
ICON/ 包含图标文件
IMETAB/ 包含输入法文件
FONT/ 里只放8x16-iso8859-1.bin文件,由于字体只有一种,所以下面都选0.
default=0
wchar_def=0
fixed=0
caption=0
menu=0
control=0
资源文件不要配置得太多,如果DRAM不够,而配置资源多的话,会出现如下错误:
Allocation of length 1259251 from process 16 failed
Buffer memory: 356kB
Cache memory: 344kB
Free pages: 2384kB ( 0kB HighMem)
Zone:DMA freepages: 0kB
Zone: Normal freepages: 2384kB
Zone:HighMem freepages: 0kB
( Active: 138, inactive: 37, free: 596 )
= 0kB)
0*4kB 0*8kB 1*16kB 0*32kB 1*64kB 0*128kB 1*256kB 0*512kB 0*1024kB 1*2048kB = 23)= 0kB)
Unable to allocate RAM for process text/data, errno 12
或者
pid 16: failed 4
或者
直接重启
3 测试程序
Hello.c
/**********************************************************************************
#include <minigui/common.h>
#include <minigui/minigui.h>
#include <minigui/gdi.h>
#include <minigui/window.h>
#include <minigui/control.h>
//#pragma comment(lib,"minigui.lib")
//#pragma comment(lib,"pthreadVC1.lib") 用于VC编译
static int MainWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
switch (message)
{
case MSG_CREATE:
break;
case MSG_PAINT:
hdc = BeginPaint (hWnd);//得到绘图设备
EndPaint (hWnd, hdc);//结束绘图
break;
case MSG_CLOSE://当窗口关闭时该消息产生
DestroyMainWindow (hWnd);//注销窗口
PostQuitMessage (hWnd);
return 0;
}
return DefaultMainWinProc(hWnd, message, wParam, lParam);//未处理的函数在此默认处理
}
int MiniGUIMain (int argc, const char* argv[])//main函数对应Windows的WinMain和c中main
{
MSG Msg;//定义消息
HWND hMainWnd;//生成主窗口句柄
MAINWINCREATE CreateInfo;//定义主窗口结构
#ifdef _LITE_VERSION//预处理:判断是否Lite版本
SetDesktopRect(0, 0, 1024, 768);
#endif
CreateInfo.dwStyle = WS_VISIBLE| WS_BORDER | WS_CAPTION;//设置主窗口风格
CreateInfo.dwExStyle = WS_EX_NONE;//设置主窗口扩展风格
CreateInfo.spCaption = "Sk.坤";//设置主窗口标题
CreateInfo.hMenu = 0; //设置主窗口菜单
CreateInfo.hCursor = GetSystemCursor(0); //设置主窗口鼠标光标
CreateInfo.hIcon = 0; //设置主窗口图标
CreateInfo.MainWindowProc = MainWinProc; //设置主窗口消息处理函数过程
CreateInfo.lx = 0; //设置主窗口位置x坐标
CreateInfo.ty = 0; //设置主窗口位置y坐标
CreateInfo.rx = 320; //设置主窗口宽度
CreateInfo.by = 240; //设置主窗口高度
CreateInfo.iBkColor = COLOR_green; //设置主窗口客户区背景色
CreateInfo.dwAddData = 0; //设置主窗口的附加数据,通常不需要
CreateInfo.hHosting = NULL; //设置主窗口的托管窗口,通常为桌面DESKTOP
hMainWnd = CreateMainWindow (&CreateInfo);//创建主窗口
if (hMainWnd == HWND_INVALID)//失败则退出
return -1;
ShowWindow(hMainWnd, SW_SHOWNORMAL);//显示主窗口
while (GetMessage(&Msg, hMainWnd))
{//进入消息处理
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
MainWindowThreadCleanup (hMainWnd);
return 0;
}
**********************************************************************************/
编译 arm-elf-gcc –elf2flt –fno-pic –fno-PIC –o hello hello.c –lminigui –lpthread –lm
在配置minigui采用newgal方式 时,编译程序必须加上-lm,不然会出现 sin ,cos 之类没定义的错误。
-l 是lmn的l。
这篇关于MiniGUI移植总结的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!