TCHAR * GetParamNT(char * string, TCHAR * buf, int buflen, BYTE paramN, char Delim, BOOL SkipSpaces) { #ifdef UNICODE char *ansibuf=mir_alloc(buflen/sizeof(TCHAR)); GetParamN(string, ansibuf, buflen/sizeof(TCHAR), paramN, Delim, SkipSpaces); MultiByteToWideChar(CP_UTF8,0,ansibuf,-1,buf,buflen); mir_free(ansibuf); return buf; #else return GetParamN(string, buf, buflen, paramN, Delim, SkipSpaces); #endif }
LPCSTR CPharseCmdline::GetNextParam() { if(m_nCountCur >= m_nCountTotal) { // すでに、全てのパラメータを出し終わっているとき m_sOneParam = ""; return (LPCSTR)m_sOneParam; } GetParamN(m_nCountCur + 1); // 結果は m_sOneParam に入っている m_nCountCur++; // 現在のパラメータ番号をインクリメント // ********* // 先頭と末尾のダブルクォーテーションを取る // ********* if(m_sOneParam.GetAt(0) == (char)'\"') m_sOneParam.Delete(0,1); // 0 文字目からの1文字を削除 long i = m_sOneParam.GetLength(); if(m_sOneParam.GetAt(i-1) == (char)'\"') m_sOneParam.Delete(i-1,1); // 最後の文字を削除 return (LPCSTR)m_sOneParam; }
//Parse DB string and add object // Params is: // Glyph,None // Glyph,Solid,<ColorR>,<ColorG>,<ColorB>,<Alpha> // Glyph,Image,Filename,(TileBoth|TileVert|TileHor|StretchBoth),<MarginLeft>,<MarginTop>,<MarginRight>,<MarginBottom>,<Alpha> int RegisterObjectByParce(char * ObjectName, char * Params) { if (!ObjectName || !Params) return 0; { int res=0; SKINOBJECTDESCRIPTOR obj={0}; char buf[250]; obj.szObjectID=mir_strdup(ObjectName); GetParamN(Params,buf, sizeof(buf),0,',',0); if (boolstrcmpi(buf,"Glyph")) obj.bType=OT_GLYPHOBJECT; else if (boolstrcmpi(buf,"Font")) obj.bType=OT_FONTOBJECT; switch (obj.bType) { case OT_GLYPHOBJECT: { GLYPHOBJECT gl={0}; GetParamN(Params,buf, sizeof(buf),1,',',0); if (boolstrcmpi(buf,"Solid")) { //Solid int r,g,b; gl.Style=ST_BRUSH; r=atoi(GetParamN(Params,buf, sizeof(buf),2,',',0)); g=atoi(GetParamN(Params,buf, sizeof(buf),3,',',0)); b=atoi(GetParamN(Params,buf, sizeof(buf),4,',',0)); gl.dwAlpha=atoi(GetParamN(Params,buf, sizeof(buf),5,',',0)); gl.dwColor=RGB(r,g,b); } else if (boolstrcmpi(buf,"Image")) { //Image gl.Style=ST_IMAGE; gl.szFileName=mir_strdup(GetParamN(Params,buf, sizeof(buf),2,',',0)); gl.dwLeft=atoi(GetParamN(Params,buf, sizeof(buf),4,',',0)); gl.dwTop=atoi(GetParamN(Params,buf, sizeof(buf),5,',',0)); gl.dwRight=atoi(GetParamN(Params,buf, sizeof(buf),6,',',0)); gl.dwBottom=atoi(GetParamN(Params,buf, sizeof(buf),7,',',0)); gl.dwAlpha =atoi(GetParamN(Params,buf, sizeof(buf),8,',',0)); GetParamN(Params,buf, sizeof(buf),3,',',0); if (boolstrcmpi(buf,"TileBoth")) gl.FitMode=FM_TILE_BOTH; else if (boolstrcmpi(buf,"TileVert")) gl.FitMode=FM_TILE_VERT; else if (boolstrcmpi(buf,"TileHorz")) gl.FitMode=FM_TILE_HORZ; else gl.FitMode=0; } else { //None gl.Style=ST_SKIP; } obj.Data=≷ res=AddObjectDescriptorToSkinObjectList(&obj,NULL); mir_free(obj.szObjectID); if (gl.szFileName) mir_free(gl.szFileName); return res; } break; } } return 0; }
//Parse DB string and add buttons int RegisterButtonByParce(char * ObjectName, char * Params) { char buf [255]; int res; GetParamN(Params,buf, sizeof(buf),0,',',0); // if (boolstrcmpi("Push",buf) { //Push type char buf2[20]={0}; char pServiceName[255]={0}; char pStatusServiceName[255]={0}; int Left, Top,Right,Bottom; int MinWidth, MinHeight; char TL[9]={0}; TCHAR Hint[250]={0}; char Section[250]={0}; char Type[250]={0}; DWORD alingnto; int a=((int)boolstrcmpi(buf,"Switch"))*2; GetParamN(Params,pServiceName, sizeof(pServiceName),1,',',0); // if (a) GetParamN(Params,pStatusServiceName, sizeof(pStatusServiceName),a+1,',',0); Left=atoi(GetParamN(Params,buf2, sizeof(buf2),a+2,',',0)); Top=atoi(GetParamN(Params,buf2, sizeof(buf2),a+3,',',0)); Right=atoi(GetParamN(Params,buf2, sizeof(buf2),a+4,',',0)); Bottom=atoi(GetParamN(Params,buf2, sizeof(buf2),a+5,',',0)); GetParamN(Params,TL, sizeof(TL),a+6,',',0); MinWidth=atoi(GetParamN(Params,buf2, sizeof(buf2),a+7,',',0)); MinHeight=atoi(GetParamN(Params,buf2, sizeof(buf2),a+8,',',0)); GetParamNT(Params,Hint, sizeof(Hint),a+9,',',0); if (a) { GetParamN(Params,Section, sizeof(Section),2,',',0); GetParamN(Params,Type, sizeof(Type),3,',',0); } alingnto= (TL[0]=='R') +2*(TL[0]=='C') +4*(TL[1]=='B') +8*(TL[1]=='C') +16*(TL[2]=='R') +32*(TL[2]=='C') +64*(TL[3]=='B') +128*(TL[3]=='C') +256*(TL[4]=='I'); if (a) res=AddButton(hwndContactList,ObjectName+1,pServiceName,pStatusServiceName,"\0",Left,Top,Right,Bottom,alingnto,Hint,Section,Type,MinWidth,MinHeight); else res=AddButton(hwndContactList,ObjectName+1,pServiceName,pStatusServiceName,"\0",Left,Top,Right,Bottom,alingnto,Hint,NULL,NULL,MinWidth,MinHeight); } return res; }
void SetControls(HWND hwndDlg, char * str) { char buf[250]; int Type=0; if (!str) { SetAppropriateGroups(hwndDlg,-1); return; } GetParamN(str,buf,SIZEOF(buf),1,',',TRUE); if (mir_bool_strcmpi(buf,"Solid")) Type=1; else if (mir_bool_strcmpi(buf,"Image")) Type=2; else if (mir_bool_strcmpi(buf,"Fragment")) Type=3; SendDlgItemMessage(hwndDlg,IDC_TYPE,CB_SETCURSEL,(WPARAM)Type,(LPARAM)0); SetAppropriateGroups(hwndDlg,Type); switch (Type) { case 1: { int r,g,b,a; r=g=b=200; a=255; r=atoi(GetParamN(str,buf,SIZEOF(buf),2,',',TRUE)); g=atoi(GetParamN(str,buf,SIZEOF(buf),3,',',TRUE)); b=atoi(GetParamN(str,buf,SIZEOF(buf),4,',',TRUE)); a=atoi(GetParamN(str,buf,SIZEOF(buf),5,',',TRUE)); SendDlgItemMessage(hwndDlg,IDC_COLOR,CPM_SETCOLOUR,(WPARAM)0,(LPARAM)RGB(r,g,b)); SendDlgItemMessage(hwndDlg,IDC_COLOR,CPM_SETDEFAULTCOLOUR,(WPARAM)0,(LPARAM)RGB(r,g,b)); SendDlgItemMessage(hwndDlg,IDC_SPIN_ALPHA,UDM_SETPOS,0,MAKELONG(a,0)); } break; case 2: { int a; int l,t,r,b; int fitmode=0; l=t=r=b=0; a=255; l=atoi(GetParamN(str,buf,SIZEOF(buf),4,',',TRUE)); t=atoi(GetParamN(str,buf,SIZEOF(buf),5,',',TRUE)); r=atoi(GetParamN(str,buf,SIZEOF(buf),6,',',TRUE)); b=atoi(GetParamN(str,buf,SIZEOF(buf),7,',',TRUE)); a=atoi(GetParamN(str,buf,SIZEOF(buf),8,',',TRUE)); SendDlgItemMessage(hwndDlg,IDC_SPIN_ALPHA,UDM_SETPOS,0,MAKELONG(a,0)); SendDlgItemMessage(hwndDlg,IDC_SPIN_LEFT,UDM_SETPOS,0,MAKELONG(l,0)); SendDlgItemMessage(hwndDlg,IDC_SPIN_TOP,UDM_SETPOS,0,MAKELONG(t,0)); SendDlgItemMessage(hwndDlg,IDC_SPIN_RIGHT,UDM_SETPOS,0,MAKELONG(r,0)); SendDlgItemMessage(hwndDlg,IDC_SPIN_BOTTOM,UDM_SETPOS,0,MAKELONG(b,0)); GetParamN(str,buf,SIZEOF(buf),2,',',TRUE); SendDlgItemMessageA(hwndDlg,IDC_FILE,WM_SETTEXT,0,(LPARAM)buf); GetParamN(str,buf,SIZEOF(buf),3,',',TRUE); if (mir_bool_strcmpi(buf,"TileBoth")) fitmode=FM_TILE_BOTH; else if (mir_bool_strcmpi(buf,"TileVert")) fitmode=FM_TILE_VERT; else if (mir_bool_strcmpi(buf,"TileHorz")) fitmode=FM_TILE_HORZ; else fitmode=0; SendDlgItemMessage(hwndDlg,IDC_FIT,CB_SETCURSEL,(WPARAM)fitmode,(LPARAM)0); } break; case 3: { int a; int l,t,r,b; int x,y,w,h; int fitmode=0; l=t=r=b=0; x=y=w=h=0; a=255; x=atoi(GetParamN(str,buf,SIZEOF(buf),3,',',TRUE)); y=atoi(GetParamN(str,buf,SIZEOF(buf),4,',',TRUE)); w=atoi(GetParamN(str,buf,SIZEOF(buf),5,',',TRUE)); h=atoi(GetParamN(str,buf,SIZEOF(buf),6,',',TRUE)); l=atoi(GetParamN(str,buf,SIZEOF(buf),8,',',TRUE)); t=atoi(GetParamN(str,buf,SIZEOF(buf),9,',',TRUE)); r=atoi(GetParamN(str,buf,SIZEOF(buf),10,',',TRUE)); b=atoi(GetParamN(str,buf,SIZEOF(buf),11,',',TRUE)); a=atoi(GetParamN(str,buf,SIZEOF(buf),12,',',TRUE)); SendDlgItemMessage(hwndDlg,IDC_SPIN_ALPHA,UDM_SETPOS,0,MAKELONG(a,0)); SendDlgItemMessage(hwndDlg,IDC_SPIN_LEFT,UDM_SETPOS,0,MAKELONG(l,0)); SendDlgItemMessage(hwndDlg,IDC_SPIN_TOP,UDM_SETPOS,0,MAKELONG(t,0)); SendDlgItemMessage(hwndDlg,IDC_SPIN_RIGHT,UDM_SETPOS,0,MAKELONG(r,0)); SendDlgItemMessage(hwndDlg,IDC_SPIN_BOTTOM,UDM_SETPOS,0,MAKELONG(b,0)); SendDlgItemMessage(hwndDlg,IDC_SPIN_POSLEFT,UDM_SETPOS,0,MAKELONG(x,0)); SendDlgItemMessage(hwndDlg,IDC_SPIN_POSTOP,UDM_SETPOS,0,MAKELONG(y,0)); SendDlgItemMessage(hwndDlg,IDC_SPIN_WIDTH,UDM_SETPOS,0,MAKELONG(w,0)); SendDlgItemMessage(hwndDlg,IDC_SPIN_HEIGHT,UDM_SETPOS,0,MAKELONG(h,0)); GetParamN(str,buf,SIZEOF(buf),2,',',TRUE); SendDlgItemMessageA(hwndDlg,IDC_FILE,WM_SETTEXT,0,(LPARAM)buf); GetParamN(str,buf,SIZEOF(buf),7,',',TRUE); if (mir_bool_strcmpi(buf,"TileBoth")) fitmode=FM_TILE_BOTH; else if (mir_bool_strcmpi(buf,"TileVert")) fitmode=FM_TILE_VERT; else if (mir_bool_strcmpi(buf,"TileHorz")) fitmode=FM_TILE_HORZ; else fitmode=0; SendDlgItemMessage(hwndDlg,IDC_FIT,CB_SETCURSEL,(WPARAM)fitmode,(LPARAM)0); } break; } }