Beispiel #1
0
double UiNumericDisplay::getInputval(){
	double retval = 0.0;
	if(_l1str.Length()){
		swscanf(_l1str.C_Str(),L"%lf",&retval);
	}
	return retval;
}
Beispiel #2
0
bool MainWnd::Login(const CMzString& account,const CMzString& password)
{
	std::string s_account=ws2s(account.C_Str());
	std::string s_pass=ws2s(password.C_Str());

	ConfIni::setAccount(account.C_Str());

	m_twitter.SetApi(ws2s(ConfIni::getTwitterApi()));

	if(!AutoDialNet())
		return false;
	if(m_twitter.Login(s_account,s_pass))
		SetUserDir(s_account);
	else{
		return false;
	}

	if(ConfIni::isRememberPassword()){
		ConfIni::setPassword(password.C_Str());
	}

	ConfIni::save();

	m_account = account;
	LoadCache(_statusFile,_current_page);
	StartTimer(ConfIni::getUpdateInterval());
	
	m_Top.SetButton(1,true,true,m_account.C_Str());
	return true;
}
Beispiel #3
0
void UiNumericDisplay::removeChar1(){
	if(_l1str.Length() == 1){
		setText1(L"0");
		_isEmpty = true;
		return;
	}
	_l1str = _l1str.SubStr(0,_l1str.Length() - 1);
}
Beispiel #4
0
void UiNumericDisplay::addChar1(wchar_t chCharCode){
	//only accept 0-9,dot,-
	int inputlen = _l1str.Length();
	//排除连续输入0的问题
	if(inputlen == 1 && _l1str == L"0" && chCharCode == '0') return;
	//排除在输入运算符后输入dot的问题
	if(_isEmpty && chCharCode == '.'){
		_isEmpty = false;
		_l1str = L"0.";
		_dotPos = 2;
		return;
	}
	//only 2 digital after dot
	if(chCharCode != 0x08 && _dotPos != 0 && (inputlen - _dotPos > 1)) return;
	//only 8 digital before dot
	if(chCharCode != 0x08 &&  chCharCode != '.' && _dotPos == 0 && inputlen > 8) return;


	if(chCharCode < '0' || chCharCode > '9'){
		if(chCharCode != '.' && chCharCode != '-' && chCharCode != 0x08){
			return;
		}
		if(chCharCode == '-'){
			if(_isEmpty) return;
			if(_l1str.C_Str()[0] == '-'){
				_l1str = _l1str.SubStr(1,_l1str.Length() - 1);
			}else{
				CMzString Ssign = L"-";
				_l1str = Ssign + _l1str;
			}
			return;
		}
		if(chCharCode == '.'){
			if(_dotPos != 0){
				return;
			}else{
				_dotPos = inputlen + 1;
				chCharCode = '.';
			}
		}
		if(chCharCode == 0x08){ //backspace
			if(inputlen == _dotPos){
				_dotPos = 0;
			}
			removeChar1();
			return;
		}
	}
	addChar(chCharCode,_l1str);
	if(_isEmpty) _isEmpty = false;
}
Beispiel #5
0
/*
 *拆分短信发送
*/
bool CNewSmsWnd::SendSMS_Wrapper(IN CMzString&  Number)
{
	bool SendFlag = false;
	CMzString  NewNumber ;
	if(Number.C_Str()[0] ==L'1')
	{
		NewNumber = L"+86";
		NewNumber += Number;
	}
	else
	{
		NewNumber = Number;
	}


	CMzString  SMS_Content = m_SmsMsgEdit->GetText().C_Str();

	
	int length = SMS_Content.Length();
	if( length <= 69 )
	{
	 	SendFlag = SendSMS(NewNumber.C_Str(), m_SmsMsgEdit->GetText().C_Str());
		HRESULT	hr	=	smsInsert( NewNumber.C_Str(), m_SmsMsgEdit->GetText().C_Str() );
		if (FAILED(hr))
		{
			return	false;
		}
	}
	else
	{
		for(int i = 0; i < length; i+=69)
		{
			int count = ((length - i) < 69 ? (length-i): 69); 
			CMzString Single_Content =SMS_Content.SubStr(i,count);

			SendFlag = SendSMS(NewNumber.C_Str(), Single_Content.C_Str() );
			

		}
		HRESULT	hr	=	smsInsert( NewNumber.C_Str(), SMS_Content.C_Str() );
		if (FAILED(hr))
		{
			return	false;
		}
	}


	return SendFlag;

}
Beispiel #6
0
bool MainWnd::fakeLogin(const CMzString& account,const CMzString& password)
{
	std::string s_account=ws2s(account.C_Str());
	std::string s_pass=ws2s(password.C_Str());

	ConfIni::setAccount(account.C_Str());

	m_twitter.SetApi(ws2s(ConfIni::getTwitterApi()));
	m_twitter.fakeLogin(s_account,s_pass);

	if(ConfIni::isRememberPassword()){
		ConfIni::setPassword(password.C_Str());
	}

	ConfIni::save();

	m_account = account;
	return true;
}
Beispiel #7
0
bool loadAnyTexture(CMzString &filename, Texture* tex )
{
	TImage img;
	char strTexPath[_MAX_PATH];
	wcstombs(strTexPath, filename.C_Str(), _MAX_PATH);
	bool ret = false;

	if(img.LoadFromFile(strTexPath))
	{
		img.Bind2DTexture(tex->tex);
		ret = true;
	}
	tex->w = img.GetWidth() ;
	tex->h = img.GetHeight();
	return ret;
}
Beispiel #8
0
void UiLineGraph::PaintWin(HDC hdc, RECT* prcWin, RECT* prcUpdate){
	UiWin::PaintWin(hdc,prcWin,prcUpdate);
	m_x = 70;
	m_y = m_h - 20;

	if(_reqUpdate){
		_reqUpdate = false;

		SelectObject(pMemDC, pBitmap);
		HBRUSH myBrush = CreateSolidBrush(RGB(255-16,255-16,255-16));
		RECT rect;
		rect.top = 0;
		rect.bottom = m_nMaxY;
		rect.left = 0;
		rect.right = m_nMaxX;

		FillRect(pMemDC,&rect,myBrush);//画之前先擦除.
		SetTextColor(RGB(0,0,0));
		SetBkMode(pMemDC,TRANSPARENT);

		//无数据是显示提示
		if(m_items.size() == 0){
			HFONT font = FontHelper::GetFont(30);
			SelectObject(pMemDC,font);
			HPEN pen = CreatePen(PS_SOLID, 0,RGB(128,128,128));
			HPEN poldpen = (HPEN)SelectObject(pMemDC,pen);
			int cx = m_x + m_nMaxX / 2;
			int cy = m_y + m_nMaxY / 2 - 20 * 5;
			int ch = m_nMaxX / 2;
			int cw = m_nMaxY / 2;
			RECT textrect = {cx,cy,cx+cw,cy+ch};
			wchar_t text[16];
			wsprintf(text,LOADSTRING(IDS_STR_NO_DATA).C_Str());
			DrawText(pMemDC,text,lstrlen(text),&textrect,DT_TOP|DT_LEFT);
			SelectObject(pMemDC,poldpen);//恢复系统笔
			BitBlt(hdc,prcWin->left,prcWin->top,m_nMaxX,m_nMaxY,pMemDC,0,0,SRCCOPY);
			return;
		}
		
		
		HPEN poldpen;//用来保存系统笔

		//转换成相对值,用户只需直接输入数值就好了
		ReformatArray();
		//设置绘画高度和间隔
		int stepwidth = m_w / m_nItems;
		int viewRectHeight = (m_h/2 - 15);
		int sy = m_y/2 + 10;
		int stepheight = (m_h - 15) / 10;
		m_y = sy + stepheight*5;
		//绘制方格
		//竖线
		HBRUSH brush = CreateSolidBrush(RGB(128,128,128));
		SelectObject(pMemDC,brush);
		HPEN pen = CreatePen(PS_DASH, 1,RGB(128,128,128));
		SelectObject(pMemDC,pen);
		for(int i = 0; i <= m_nItems; i++){
			drawLine(m_x + i*stepwidth,sy - viewRectHeight,m_x + i*stepwidth,m_y);
		}
		
		int i = 0;
		drawLine(m_x,sy - viewRectHeight,m_x + m_nItems*stepwidth, sy - viewRectHeight);
		drawLine(m_x,m_y,m_x + m_nItems*stepwidth, m_y);
		while(1){
			int y1 = sy - stepheight*i;
			int y2 = sy + stepheight*i;
			if(y1 < sy - viewRectHeight || y2 > m_y) break;
			drawLine(m_x,y1,m_x + m_nItems*stepwidth, y1);
			drawLine(m_x,y2,m_x + m_nItems*stepwidth, y2);
			i++;
		}
		//横线
		DeleteObject(brush);
		DeleteObject(pen);
		//绘制折线
		//viewRectHeight -= 10;
		list<LineGraphInfo_ptr>::iterator it = m_items.begin();
		int gsy = sy + (m_B + 1);
		for(; it != m_items.end(); it++){
			LineGraphInfo_ptr lg = *it;
			if(lg->formatdata.size() == 0) continue;

			HBRUSH brush = CreateSolidBrush(lg->color);
			SelectObject(pMemDC,brush);
			HPEN pen = CreatePen(PS_SOLID, m_B,lg->color);
			SelectObject(pMemDC,pen);

			list<int>::iterator idt = lg->formatdata.begin();
			int predt = *idt++;
			int x0 = m_x;
			int y0 = gsy - ((viewRectHeight*predt)/100);
			int cnt = 1;
			for(; idt != lg->formatdata.end(); idt++){
				int dt = *idt;
				int x1 = m_x + cnt*stepwidth;
				int y1 = gsy - ((viewRectHeight*dt)/100);
				drawLine(x0,y0,x1,y1);
				x0 = x1;
				y0 = y1;
				cnt++;
			}
			DeleteObject(brush);
			DeleteObject(pen);
			gsy -= (m_B + 1);
		}

		//绘制y轴
		HFONT font = FontHelper::GetFont(15);
		SelectObject(pMemDC,font);
		pen = CreatePen(PS_SOLID, 4,RGB(0,0,0));
		poldpen = (HPEN)SelectObject(pMemDC,pen);

		RECT textrect = {0, sy - 10,65,sy + 10};
		wchar_t strval[36];
		strval[0] = '0';
		strval[1] = 0;
		DrawText(pMemDC,strval,1,&textrect,DT_VCENTER|DT_RIGHT);

		RECT textrect2;
		textrect2.left = textrect.left;
		textrect2.right = textrect.right;
		int maxYs = 5;
		if(maxval < 600){
			maxYs = maxval/100-1;
		}
		int stepval = maxval/(100*5);
		for(int i = 1; i <= maxYs; i++){
			textrect2.top = textrect.top - i * stepheight;
			textrect2.bottom = textrect2.top + 20;
			wsprintf(strval,L"%d",stepval*i);
			DrawText(pMemDC,strval,lstrlen(strval),&textrect2,DT_VCENTER|DT_RIGHT);
			textrect2.top = textrect.top + i * stepheight;
			textrect2.bottom = textrect2.top + 20;
			wsprintf(strval,L"%d",stepval*i*(-1));
			DrawText(pMemDC,strval,lstrlen(strval),&textrect2,DT_VCENTER|DT_RIGHT);
		}
		
		//m_x + i*stepwidth,sy - viewRectHeight,m_x + i*stepwidth,m_y
		textrect.top = m_y + 5;
		textrect.bottom = m_y + 20;
		list<CMzString>::iterator istr = m_xnames.begin();
		int cnt = 0;
		for(; istr != m_xnames.end(); istr++){
			if(cnt%2 == 0){
				textrect.left = m_x - stepwidth/2 + cnt * stepwidth;
				textrect.right = textrect.left + 60;
				CMzString s = *istr;
				DrawText(pMemDC,s.C_Str(),s.Length(),&textrect,DT_LEFT|DT_VCENTER);
			}
			cnt++;
		}
		DeleteObject(pen);

		if(_showLegend){
			////////////////
			//绘制图例标签:
			list<LineGraphInfo_ptr>::iterator it = m_items.begin();

			HFONT font = FontHelper::GetFont(15);
			SelectObject(pMemDC,font);
			int cnt = 0;
			int lsx = m_x + m_w - 200;
			int lsy = sy - viewRectHeight;
			for(;it != m_items.end();it++)
			{
				LineGraphInfo_ptr pitem = *it;
				int x1 = lsx;
				int y1 = lsy + 30 * cnt;
				int x2 = x1 + 30;
				int y2 = y1;

				HPEN pen = CreatePen(PS_SOLID, 4,pitem->color);
				poldpen = (HPEN)SelectObject(pMemDC,pen);
				drawLine(x1,y1 + 10,x2,y2 + 10);

				RECT textrect = {x1 + 35, y1,x1 + 200,y1 + 30};
				DrawText(pMemDC,pitem->name.C_Str(),pitem->name.Length(),&textrect,DT_TOP|DT_LEFT);
				cnt++;
				DeleteObject(pen);
			}
			/////////////////////////////////////////*/
			SelectObject(pMemDC,poldpen);//恢复系统笔
		}

	}
	BitBlt(hdc,prcWin->left,prcWin->top,m_nMaxX,m_nMaxY,pMemDC,0,0,SRCCOPY);
}
Beispiel #9
0
BOOL	CSmsLookCtorWnd::SubInitialize()
{
	//ini list
	
	m_list_base.SetID( MZ_IDC_SMSLOOKCTOR_LIST );
	AddUiWin( &m_list_base );
/////////////////////////////////////////////////////////////////	
//	ItemAttribute	clItemAttribute;
//	clItemAttribute.SetPsText1Param( 100, RGB(100, 100, 100), FW_MEDIUM, false, false, 
//							DT_TOP|DT_LEFT|DT_END_ELLIPSIS|DT_SINGLELINE|DT_NOPREFIX ); 

//	m_list_base.SetItemAttributeH( clItemAttribute );
///////////////////////////////////////////////////////////////////
	//ini alp
	m_AlpBar.SetID( MZ_IDC_SMSLOOKCTOR_ALPBAR );
	m_AlpBar.EnableZoomAlphabet( true );
	m_AlpBar.EnableNotifyMessage( true );
	m_AlpBar.SetPos( 350, 0, 50, GetHeight() );
	AddUiWin( &m_AlpBar );

	//ini toolbar
	m_toolBar_base.SetID( MZ_IDC_SMSLOOKCTOR_TOOLBAR );
	AddUiWin( &m_toolBar_base );


	/////////////test/////////////////////////////////////////////////////////////
	wchar_t	*pBuf		=	NULL;
	long	lSize		=	0;
	wchar_t	*pwcResult	=	NULL;

	HRESULT	hr	=	m_clCEasySmsUiCtrl.MakeCtorRltListReq( &pBuf, &lSize );
	if ( FAILED ( hr ) )									return	FALSE;

	CCoreService	*pCCoreService	=	CCoreService::GetInstance();
	if ( NULL == pCCoreService )							return	FALSE;

#ifdef	UI_TEST
		 pwcResult =	L"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
							L"<result>"
								L"<data type = \"contactors\">"
									L"<data type = \"list\" count = \"2\">"
										L"<rec encode = \"true\">"
											L"<name>张三</name>"
											L"<pid>2</pid>"										
											L"<address>13600000001</address>"
											L"<smscount>9</smscount>"
										L"</rec>"
										L"<rec encode = \"true\">"
											L"<name>李四</name>"
											L"<pid>3</pid>"
											L"<address>13600000002</address>"
											L"<smscount>88</smscount>"
										L"</rec>"
									L"</data>"
								L"</data>"
							L"</result>";
#else
	hr	=	pCCoreService->Request( pBuf, &pwcResult );
	if ( FAILED ( hr ) )									return	FALSE;
#endif

	hr	=	m_clCEasySmsUiCtrl.MakeCtorRltList( m_list_base, pwcResult );
#if 0	
	CMzString name = L"姓名%d";
//	CMzString content = L"短信内容 SmsContent%d:";
	CMzString stime = L"Count: 100";

	CMzString name1(10);
	CMzString content1(30);
	for (int i = 0; i < 100; i++)
	{
		swprintf(name1.C_Str(),name.C_Str(),i);
//		swprintf(content1.C_Str(),content.C_Str(),i);
		ListItemEx* item = new ListItemEx;
		
//		ItemAttribute	clItemAttribute;
//		clItemAttribute.SetPsText1Param( 100, RGB(100, 100, 100), FW_MEDIUM, false, false, 
//									DT_TOP|DT_END_ELLIPSIS|DT_SINGLELINE|DT_NOPREFIX ); 
//		item->m_pSpecialItemAttr	=	&clItemAttribute;

		
		item->m_pData = (void*)i;
		item->m_textTitle = name1.C_Str();

		item->m_textPostscript1 = stime.C_Str();


 		item->m_pImgFirst = m_imgContainer_base.LoadImage(MzGetInstanceHandle(), IDR_PNG_CTR_LIST_READ, true);

		m_list_base.AddItem(item);
	}

#endif

	if ( NULL != pBuf )
	{
		delete	pBuf, pBuf	=	NULL;
	}
/////////////test/////////////////////////////////////////////////////////////

	return	TRUE;
}