void CDialogToDoHistory::UpdateItem( int iItem )
{
	DWORD dwId;
	m_listTodoHistory.GetItemData(iItem,dwId);
	ToDoTask todo = g_todoSet.GetToDo(dwId);
	ATLASSERT(todo.id!=ToDoTask::ERROR_TASKID);

	//改变的文字颜色
	COLORREF clrBgn,clrText;
	m_listTodoHistory.GetItemColours(iItem,m_iColCreateTime,clrBgn,clrText);
	m_listTodoHistory.SetItemColours(iItem,m_iColCreateTime,clrBgn,RGB(0X66,0X66,0X66));
	m_listTodoHistory.SetSubItemData(iItem,m_iColCreateTime,GlobeFuns::TimeToInt(todo.tmCreateTime));

	m_listTodoHistory.SetItemText(iItem,m_iColTitle,todo.strTask.c_str());

	m_listTodoHistory.SetItemText(iItem,m_iColPriority,ToDoTask::PriorityText(todo.priority));
	m_listTodoHistory.SetItemColours(iItem,m_iColPriority,RGB(10,170-todo.priority*25,10),RGB(0,0,0));
	m_listTodoHistory.SetSubItemData(iItem,m_iColPriority,todo.priority);

	CString strTime;
	if (todo.tmPlanFinshTime>=todo.tmCreateTime)
	{
		CTimeSpan ts = todo.tmPlanFinshTime-todo.tmCreateTime;

		CString strTmp;
		if (ts.GetDays()>0)
		{
			strTmp.Format("%d天",ts.GetDays());
			strTime += strTmp;
		}
		if (ts.GetHours()>0)
		{
			strTmp.Format("%d时",ts.GetHours());
			strTime += strTmp;
		}
		if (ts.GetDays()==0		//任务持续一天以上的,就不要精确到分钟了。
			&& ts.GetMinutes()>0)
		{
			strTmp.Format("%d分",ts.GetMinutes());
			strTime += strTmp;
		}
		if (strTime.IsEmpty())
		{
			strTmp.Format("%d秒",ts.GetSeconds());
			strTime += strTmp;
		}
		m_listTodoHistory.SetSubItemData(iItem,m_iColTotleHours,GlobeFuns::TimeToInt(CTime(0)+ts));
	}
	else
	{
		strTime = "(无数据)";
	}
	m_listTodoHistory.SetItemText(iItem,m_iColTotleHours,strTime);

	m_listTodoHistory.SetItemText(iItem,m_iColRemark,todo.strRemark.c_str());
}
void SaveBinaryNoParsingDlg::ShowDuration(CTimeSpan ts, UINT id)
{
  char buf[128];
  //CTimeSpan ts = CTime::GetCurrentTime() - startTime;
  if(ts.GetDays() > 0)
  {
    sprintf_s(buf, 128, "%d day(s) and %02d:%02d:%02d", (int)ts.GetDays(), (int)ts.GetHours(), (int)ts.GetMinutes(), (int)ts.GetSeconds());
  }
  else
  {
    sprintf_s(buf, 128, "%02d:%02d:%02d", (int)ts.GetHours(), (int)ts.GetMinutes(), (int)ts.GetSeconds());
  }
  GetDlgItem(id)->SetWindowText(buf);
}
Exemple #3
0
CString CTradeStatistic2::CalculateElapseTime()
{
	CString strElapsedTime;
	CTime tmNow = CTime::GetCurrentTime();
	CTimeSpan tElapsed = tmNow - m_tmBegin;
	strElapsedTime.Format("%d小时 %d分钟 %d秒", tElapsed.GetHours(), tElapsed.GetMinutes(), tElapsed.GetSeconds());
	return strElapsedTime;
}
Exemple #4
0
void DLLBuildDone()
{
  g_hToolThread = NULL;
  CTime tEnd = CTime::GetCurrentTime();
  CTimeSpan tElapsed = tEnd - g_tBegin;
  CString strElapsed;
  strElapsed.Format("Run time was %i hours, %i minutes and %i seconds", tElapsed.GetHours(), tElapsed.GetMinutes(), tElapsed.GetSeconds());
	Sys_Printf(strElapsed.GetBuffer(0));
	Pointfile_Check();

  if (g_PrefsDlg.m_bRunQuake == TRUE)
  {
    char cCurDir[1024];
    GetCurrentDirectory(1024, cCurDir);
    CString strExePath = g_PrefsDlg.m_strQuake2;
    CString strOrgPath;
    CString strOrgFile;
    ExtractPath_and_Filename(currentmap, strOrgPath, strOrgFile);
    if (g_PrefsDlg.m_bSetGame == TRUE) // run in place with set game.. don't copy map
    {
	    CString strBasePath = ValueForKey(g_qeglobals.d_project_entity, "basepath");
      strExePath += " +set game ";
      strExePath += strBasePath;
      WinExec(strExePath, SW_SHOW);
    }
    else
    {
      CString strCopyPath = strExePath;
      char* pBuffer = strCopyPath.GetBufferSetLength(_MAX_PATH + 1);
      pBuffer[strCopyPath.ReverseFind('\\') + 1] = '\0';
      strCopyPath.ReleaseBuffer();
      SetCurrentDirectory(strCopyPath);
      CString strOrgPath;
      CString strOrgFile;
      ExtractPath_and_Filename(currentmap, strOrgPath, strOrgFile);
      AddSlash(strCopyPath);
      FindReplace(strOrgFile, ".map", ".bsp");
      strCopyPath += "\\baseq2\\maps\\";
      strCopyPath += strOrgFile;
      AddSlash(strOrgPath);
      strOrgPath += strOrgFile;
      bool bRun = (strOrgPath.CompareNoCase(strCopyPath) == 0);
      if (!bRun)
        bRun = (CopyFile(strOrgPath, strCopyPath, FALSE) == TRUE);
      if (bRun)
      {
        FindReplace(strOrgFile, ".bsp", "");
        strExePath += " +map ";
        strExePath += strOrgFile;
        WinExec(strExePath, SW_SHOW);
      }
    }
    SetCurrentDirectory(cCurDir);
  }

}
string VirtualListCtrlFT::FormatElapsed(CTimeSpan &span)
{
	string ret;
	char buf[4096];

	if(span.GetTotalHours()==0)	// < hour
	{
		sprintf(buf,"%u:%02u",span.GetMinutes(),span.GetSeconds());
	}
	else	//	> hour
	{
		sprintf(buf,"%u:%02u:%02u",span.GetHours(),span.GetMinutes(),span.GetSeconds());
	}
			
	ret=buf;

	return ret;
}
Exemple #6
0
void CPMotion::SWait(short Seconds)				//waits n seconds
{
    //OK
    CTime WaitUntilTime = CTime::GetCurrentTime();
    WaitUntilTime += CTimeSpan(0, 0, 0, Seconds);
    bool done = false;

    while (!done)
    {
        m_Robot->DoWindowMessages();
        CTime StartTime = CTime::GetCurrentTime();
        CTimeSpan TimeDiff = WaitUntilTime - StartTime;

        if ((TimeDiff.GetHours() == 0) && (TimeDiff.GetMinutes() == 0) &&
                (TimeDiff.GetSeconds() <= 0))
        {
            done = true;
        }
    }
}
Exemple #7
0
bool CPMotion::RWait(short Seconds)				//waits n seconds or exit on nudge
{
    //OK
    CTime WaitUntilTime = CTime::GetCurrentTime();
    WaitUntilTime += CTimeSpan(0, 0, 0, Seconds);
    bool done = false;

    while ((!done) && (!(m_Robot->m_Nudged)))
    {
        m_Robot->DoWindowMessages();
        CTime StartTime = CTime::GetCurrentTime();
        CTimeSpan TimeDiff = WaitUntilTime - StartTime;

        if ((TimeDiff.GetHours() == 0) && (TimeDiff.GetMinutes() == 0) &&
                (TimeDiff.GetSeconds() <= 0))
        {
            done = true;
        }
    }

    return (done || (m_Robot->m_Nudged));	// ||boolean
}
Exemple #8
0
void CAddTimer::UpdateDuration()
{
	CTimeSpan aday(1,0,0,0);
	CTimeSpan tempduration;
	CTime end, start;
	UpdateData(TRUE);

	//m_endtime.GetTime(end);
	//m_starttime.GetTime(start);
	end = m_endtimex;
	start = m_starttimex;

	if (end < start) end += aday;

	tempduration = end - start;

	//Only enable ok button if duration is greater than 0
	if((tempduration.GetTotalSeconds() > 0) && (m_channellist.GetCurSel() != LB_ERR)){
		m_ok.EnableWindow(TRUE);
	}else{
		m_ok.EnableWindow(FALSE);
	}

	CString temp;
	if(tempduration.GetHours()>0) temp += tempduration.Format("%Hhr");
	if(tempduration.GetMinutes()>0)  temp += tempduration.Format("%Mmin");
	//temp += duration.Format("%Ssec");
	m_duration = temp;
	
	
	//Get programme name from guide
	CProgGuideDlg pgdlg(NULL,NULL);
	m_progname = pgdlg.getProg(m_channellist.GetCurSel(),m_starttimex);

	UpdateData(FALSE);

}
Exemple #9
0
void CDLGPlaywin::GetCurWndRecordTime(char *rtime)
{
	CTime nowtime=CTime::GetTickCount();
	CTimeSpan ts = nowtime - m_video.record[m_curScreen].starttime;
	sprintf(rtime,"%02d:%02d:%02d",ts.GetHours(),ts.GetMinutes(),ts.GetSeconds());
}
Exemple #10
0
void CheckBspProcess( void )
{
	char    outputpath[1024];
	char    temppath[512];
	DWORD   exitcode;
	char*   out;
	BOOL    ret;
	
	if ( !bsp_process )
		return;
		
	ret = GetExitCodeProcess( bsp_process, &exitcode );
	if ( !ret )
		Error( "GetExitCodeProcess failed" );
	if ( exitcode == STILL_ACTIVE )
		return;
		
	bsp_process = 0;
	
	GetTempPath( 512, temppath );
	sprintf( outputpath, "%sjunk.txt", temppath );
	
	LoadFile( outputpath, ( void** )&out );
	Sys_Printf( "%s", out );
	Sys_Printf( "\ncompleted.\n" );
	free( out );
	
	CTime tEnd = CTime::GetCurrentTime();
	CTimeSpan tElapsed = tEnd - g_tBegin;
	CString strElapsed;
	strElapsed.Format( "Run time was %i hours, %i minutes and %i seconds", tElapsed.GetHours(), tElapsed.GetMinutes(), tElapsed.GetSeconds() );
	Sys_Printf( strElapsed.GetBuffer( 0 ) );
	
	
	Sys_Beep();
	Pointfile_Check();
	// run game if no PointFile and pref is set
	//++timo needs to stop after BSP if leaked .. does run through vis and light instead ..
	if ( g_PrefsDlg.m_bRunQuake == TRUE  && !g_qeglobals.d_pointfile_display_list )
	{
		char cCurDir[1024];
		GetCurrentDirectory( 1024, cCurDir );
		CString strExePath = "../../qio.exe";
		//= g_PrefsDlg.m_strQuake2;
		CString strOrgPath;
		CString strOrgFile;
		ExtractPath_and_Filename( currentmap, strOrgPath, strOrgFile );
		if ( g_PrefsDlg.m_bSetGame == TRUE )  // run in place with set game.. don't copy map
		{
			CString strBasePath = ValueForKey( g_qeglobals.d_project_entity, "basepath" );
			strExePath += " +set game ";
			strExePath += strBasePath;
			WinExec( strExePath, SW_SHOW );
		}
		else
		{
			CString strCopyPath = strExePath;
			char* pBuffer = strCopyPath.GetBufferSetLength( _MAX_PATH + 1 );
			pBuffer[strCopyPath.ReverseFind( '\\' ) + 1] = '\0';
			strCopyPath.ReleaseBuffer();
			SetCurrentDirectory( strCopyPath );
			CString strOrgPath;
			CString strOrgFile;
			ExtractPath_and_Filename( currentmap, strOrgPath, strOrgFile );
			AddSlash( strCopyPath );
			FindReplace( strOrgFile, ".map", ".bsp" );
			//++timo modified for Quake3 !!
			strCopyPath += "baseq3\\maps\\";
			strCopyPath += strOrgFile;
			AddSlash( strOrgPath );
			strOrgPath += strOrgFile;
			bool bRun = ( strOrgPath.CompareNoCase( strCopyPath ) == 0 );
			if ( !bRun )
				bRun = ( CopyFile( strOrgPath, strCopyPath, FALSE ) == TRUE );
			if ( bRun )
			{
				FindReplace( strOrgFile, ".bsp", "" );
				strExePath += " +map ";
				strExePath += strOrgFile;
				WinExec( strExePath, SW_SHOW );
			}
		}
		SetCurrentDirectory( cCurDir );
	}
}
Exemple #11
0
void CActivityView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) 
{
bool bInserting = false;
POSITION pos;
int nDocCount;
CListCtrl & pList = GetListCtrl ();

// if we don't want list updated right now, then exit

  if (m_bUpdateLockout)
    return;

//  TRACE ("Activity window being updated\n");

  m_bUpdateLockout = TRUE;

  App.m_bUpdateActivity = FALSE;

  App.m_timeLastActivityUpdate = CTime::GetCurrentTime();

// if the list has the same number of worlds (and they are the same
// worlds), then we can not bother deleting the list and re-adding it

// first, count worlds

 	pos = App.m_pWorldDocTemplate->GetFirstDocPosition();
  for (nDocCount = 0; pos; nDocCount++)
       App.m_pWorldDocTemplate->GetNextDoc(pos);

// if count is the same, check world is the same as in the list

  if (nDocCount == pList.GetItemCount ())
    {
   	pos = App.m_pWorldDocTemplate->GetFirstDocPosition();
    while (pos)
      {
       CMUSHclientDoc* pDoc = (CMUSHclientDoc*) App.m_pWorldDocTemplate->GetNextDoc(pos);
       int nItem = pDoc->m_view_number - 1;
       if (nItem < 0)
         {
         bInserting = true;
         break;
         }
       if ((DWORD) pDoc != pList.GetItemData (nItem))
         {
         bInserting = true;
         break;
         }
      }   // end of looping through each world
    }     // end of world count being same as list count
  else
    bInserting = true;    // different counts, must re-do list

  if (bInserting)
    pList.DeleteAllItems ();

// add all documents to the list

 	pos = App.m_pWorldDocTemplate->GetFirstDocPosition();

	for (int nItem = 0; pos != NULL; nItem++)
	{
    CMUSHclientDoc* pDoc = (CMUSHclientDoc*) App.m_pWorldDocTemplate->GetNextDoc(pos);

    if (bInserting)
      pDoc->m_view_number = nItem + 1;    // so we can use Ctrl+1 etc.
    else
      nItem = pDoc->m_view_number - 1;    // use existing item number

    CString strSeq;
    CString strLines;
    CString strNewLines;
    CString strStatus;
    CString strSince;
    CString strDuration;

    strSeq.Format   ("%ld", pDoc->m_view_number);
    strNewLines.Format ("%ld", pDoc->m_new_lines);
    strLines.Format ("%ld", pDoc->m_total_lines);

// work out world status

    strStatus = GetConnectionStatus (pDoc->m_iConnectPhase);

// when they connected

    if (pDoc->m_iConnectPhase == eConnectConnectedToMud)
      strSince = pDoc->FormatTime (pDoc->m_tConnectTime, "%#I:%M %p, %d %b");
    else
      strSince.Empty ();

// work out world connection duration

    // first time spent in previous connections
    CTimeSpan ts = pDoc->m_tsConnectDuration;
    
    // now time spent connected in this session, if we are connected
    if (pDoc->m_iConnectPhase == eConnectConnectedToMud)
      ts += CTime::GetCurrentTime() - pDoc->m_tConnectTime;
  
    if (ts.GetDays () > 0)
      strDuration = ts.Format ("%Dd %Hh %Mm %Ss");
    else
      if (ts.GetHours () > 0)
        strDuration = ts.Format ("%Hh %Mm %Ss");
      else
        if (ts.GetMinutes () > 0)
          strDuration = ts.Format ("%Mm %Ss");
        else
          strDuration = ts.Format ("%Ss");
	
    // sequence
    if (bInserting)
      pList.InsertItem (nItem, strSeq);  //  eColumnSeq
	  pList.SetItemText(nItem, eColumnMush, pDoc->m_mush_name);
		pList.SetItemText(nItem, eColumnNew, strNewLines);
 		pList.SetItemText(nItem, eColumnLines, strLines);
  	pList.SetItemText(nItem, eColumnStatus, strStatus);
		pList.SetItemText(nItem, eColumnSince, strSince);
		pList.SetItemText(nItem, eColumnDuration, strDuration);

    if (bInserting)
      pList.SetItemData(nItem, (DWORD) pDoc);

    LVITEM lvitem;

    memset (&lvitem, 0, sizeof lvitem);

    // update where tick goes
    lvitem.iImage = 0;
    
    if (pDoc->m_pActiveCommandView || pDoc->m_pActiveOutputView)
      lvitem.iImage = 1;  // show the tick

    lvitem.mask = LVIF_IMAGE;
    lvitem.iItem = nItem;

    pList.SetItem (&lvitem);



   }    // end of searching for all documents

// make sure in same order that we left them

  pList.SortItems (CompareFunc, m_reverse << 8 | m_last_col); 

  m_bUpdateLockout = FALSE;

}     // end of CActivityView::OnUpdate
Exemple #12
0
void COscillogram::OnMouseMove(UINT nFlags, CPoint point) 
{
	CStringArray valArray;
	CDWordArray colArray;
	CString     strVal;
	CRect		mRect;
	CClientDC	dc(this);
	float		length;		//鼠标位置绝对象素数
	float		gValue;
	int			oldMode;
	int			curCell;	//所在单元格
	CPen pen(PS_SOLID,0,RGB(0,0,0));
	BOOL		PtState = FALSE;

	//(整个函数过程的功能)计算所有线所在单元格的数值
	oldMode = dc.SetMapMode(MM_LOMETRIC);
	SetOscillogramRect(&dc);
	dc.SelectObject(&pen);
	dc.SetROP2(R2_NOTXORPEN);
	dc.DPtoLP(&point);

	//如果 鼠标不在波形图内 或者 没有曲线 不做处理返回
	if(!(point.x >= m_GridRect.left  && point.x <= m_GridRect.right+3
		&& point.y <= m_GridRect.top && point.y >= m_GridRect.bottom)
		|| GetCurveCount() < 1 || m_showTitle == FALSE)
	{
		if(m_bPt.x != -1)
		{
			DrawMouseLine(&dc,m_bPt);
			m_bPt =-1;
		}
		m_TitleTip.ShowWindow(SW_HIDE);
		return;
	}
	
	//绘画跟随鼠标的十字线
	if(m_bPt.x == -1)
	{
		m_bPt = point;
		DrawMouseLine(&dc,point);
	}
	else
	{	
		DrawMouseLine(&dc,m_bPt);
		m_bPt = point;
		DrawMouseLine(&dc,point);
	}

	//计算个单元格数值
	length  = (float)( point.x - m_GridRect.left );
	curCell = (int)( length / m_xSpan );
	
	if(!m_showTime)
	{
		float n1 = (m_xMaxVal - m_xMinVal)/(m_xCount-1);
		float n2 = m_xMinVal + curCell*n1;
		strVal.Format("%s: %.2f",m_xText,n2);
	}
	else
	{
		CTimeSpan m_xTimeSpan = 0;
		CTimeSpan sc    = m_endTime - m_beginTime;
		CTime	cnTime  = m_beginTime;
		
		double secCount = (sc.GetDays()*86400) + (sc.GetHours()*3600) + 
			(sc.GetMinutes()*60) + sc.GetSeconds();
		secCount = secCount / (m_xCount-1);
		
		int day    = (int)secCount/86400;	//天
		secCount  -= day*86400;
		int hour   = (int)secCount/3600;	//小时
		secCount  -= hour*3600;
		int minute = (int)secCount/60;		//分钟
		secCount  -= minute*60;
		int second = (int)secCount;			//秒
		m_xTimeSpan = CTimeSpan(day,hour,minute,second);

		for(int j=0;j<curCell;j++)
			cnTime += m_xTimeSpan;
		strVal.Format("%s: %s",m_xText,cnTime.Format("%Y/%m/%d  %H:%M:%S"));
	}
	colArray.Add(RGB(0,0,0));
	valArray.Add(strVal);

	for(int i=0;i<GetCurveCount();i++)
	{
		gValue = GetCurve(i)->ptVal.GetPointValue(curCell,PtState);
		
		if(PtState)
			strVal.Format("%s: %.2f",GetCurveName(i),gValue);
		else
			strVal.Format("%s: ",GetCurveName(i));
		colArray.Add(GetCurve(i)->lColor);
		valArray.Add(strVal);
	}

	//显示浮动窗体
	dc.LPtoDP(&point);
	dc.SetMapMode(oldMode);

	//窗口跟随鼠标位置移动
	GetClientRect(mRect);
	mRect.left   += CS_LMARGIN;
	mRect.top    += CS_LMARGIN;
	mRect.right  -= CS_LMARGIN;
	mRect.bottom -= CS_LMARGIN;
	ClientToScreen(&point);
	ClientToScreen(&mRect);

	m_TitleTip.SetParentRect(mRect);
	m_TitleTip.SetStrArray(valArray,colArray);
	m_TitleTip.SetPos(&point);
	ScreenToClient(&point);
	
	CWnd::OnMouseMove(nFlags, point);
}
Exemple #13
0
void COscillogram::DrawGrid(CDC *dc)
{
	//_DrawGrid(dc);

	CString tempStr;
	CSize	tempSzie;
	int		tempPos;
	CFont	m_cFont, *oldFont;
	CPen	pen(PS_SOLID,6,m_GridColor);

	m_cFont.CreatePointFont(260,"宋体");//"Arial");
	oldFont = dc->SelectObject(&m_cFont);
	dc->SelectObject(&pen);
	dc->SetTextColor(m_xyTextColor);

	float m_xTemp = (float)m_GridRect.Width() / (m_xShowCount-1);
	float m_yTemp = (float)m_GridRect.Height() / (m_yShowCount-1);
	CTimeSpan m_xTimeSpan = 0;

	if(m_showTime)
	{
		CTimeSpan sc    = m_endTime - m_beginTime;

		double secCount = (sc.GetDays()*86400) + (sc.GetHours()*3600) + 
						  (sc.GetMinutes()*60) + sc.GetSeconds();
		secCount = secCount / (m_xShowCount-1);

		int day    = (int)secCount/86400;	//天
		secCount  -= day*86400;
		int hour   = (int)secCount/3600;	//小时
		secCount  -= hour*3600;
		int minute = (int)secCount/60;		//分钟
		secCount  -= minute*60;
		int second = (int)secCount;			//秒

		m_xTimeSpan = CTimeSpan(day,hour,minute,second);
	}
	
	for(int i=0;i<m_xShowCount;i++)
	{
		tempPos =   m_GridRect.left + (int)(m_xTemp*i);
		
		DotLine(dc, tempPos, 
			        m_GridRect.top ,
				    tempPos , 
				    m_GridRect.bottom ,
				    m_GridColor );
		
		if(!m_showTime)
			tempStr.Format("%.2f", 
					(m_xMaxVal-m_xMinVal)/(m_xShowCount-1) 
					* i	+ m_xMinVal );
		else
		{
			CTime cnTime = m_beginTime;;

			for(int j=0;j<i;j++)
				cnTime += m_xTimeSpan;

			tempStr = cnTime.Format("%H:%M:%S");//%Y/%m/%d 
		}

		tempSzie =  dc->GetTextExtent(tempStr);
		dc->TextOut(tempPos - tempSzie.cx/2 , 
					m_GridRect.bottom - 15 ,
					tempStr );
	}

	for(int j=0;j<m_yShowCount;j++)
	{
		tempPos = m_GridRect.top + (int)(m_yTemp*j);

		DotLine(dc, m_GridRect.left , 
			        tempPos ,
				    m_GridRect.right ,
				    tempPos ,
				    m_GridColor );
	
		tempStr.Format("%.2f",
					(m_yMaxVal-m_yMinVal)/(m_yShowCount-1)
					* (m_yShowCount-1-j) + m_yMinVal );

		tempSzie =  dc->GetTextExtent(tempStr);

		dc->TextOut(m_GridRect.left - tempSzie.cx-15 , 
					tempPos + tempSzie.cy/2 ,
					tempStr );
	}
	
	//X轴文本
	tempSzie = dc->GetTextExtent(m_xText);
	dc->TextOut(m_GridRect.right + 15,m_GridRect.bottom + tempSzie.cy/2,m_xText);
	//Y轴文本
	tempSzie = dc->GetTextExtent(m_yText);
	dc->TextOut(m_GridRect.left - tempSzie.cx/2,m_GridRect.top + tempSzie.cy + 15,m_yText);

	//XY轴线
	dc->MoveTo(m_GridRect.left,m_GridRect.top);
	dc->LineTo(m_GridRect.left,m_GridRect.bottom);
	dc->MoveTo(m_GridRect.left,m_GridRect.bottom);
	dc->LineTo(m_GridRect.right,m_GridRect.bottom);
	//上面小三角
	int i;
	for(i=1;i<12;i++)
	{
		dc->MoveTo(m_GridRect.left-i-3,m_GridRect.top-i);
		dc->LineTo(m_GridRect.left+i-3,m_GridRect.top-i);
	}
	//上面小三角
	for(i=1;i<12;i++)
	{
		dc->MoveTo(m_GridRect.right-i,m_GridRect.bottom-i);
		dc->LineTo(m_GridRect.right-i,m_GridRect.bottom+i);
	}
	
	dc->SelectObject(oldFont);
}
Exemple #14
0
void CWorldSocket::OnClose(int nErrorCode)
  {

bool bWasClosed = m_pDoc->m_iConnectPhase == eConnectNotConnected;

  TRACE1 ("CWorldSocket::OnClose, error code %i\n", nErrorCode);

  m_pDoc->m_iConnectPhase = eConnectDisconnecting;

  m_pDoc->UpdateAllViews (NULL);

  m_pDoc->MXP_Off (true);   // turn off MXP now

  // update button bar - make button red
  if (m_pDoc->m_view_number >= 1 &&
      m_pDoc->m_view_number <= 10)
    Frame.OnUpdateBtnWorlds (m_pDoc->m_view_number, NULL);

  // execute "disconnect" script
  if (m_pDoc->m_ScriptEngine)
    {
    if (m_pDoc->SeeIfHandlerCanExecute (m_pDoc->m_strWorldDisconnect))
      {
      DISPPARAMS params = { NULL, NULL, 0, 0 };
      long nInvocationCount = 0;

      m_pDoc->ExecuteScript (m_pDoc->m_dispidWorldDisconnect,  
                             m_pDoc->m_strWorldDisconnect,
                             eWorldAction,
                             "world disconnect", 
                             "disconnecting from world",
                             params, 
                             nInvocationCount); 
      }
    } // end of executing disconnect script

  m_pDoc->SendToAllPluginCallbacks (ON_PLUGIN_DISCONNECT);

  // close log file if we auto-opened it
  if (!m_pDoc->m_strAutoLogFileName.IsEmpty ())
    m_pDoc->CloseLog ();

  if (m_pDoc->m_bShowConnectDisconnect && !bWasClosed)
    {
    CTime theTime;
    theTime = CTime::GetCurrentTime();

    CString strConnected;
    strConnected = theTime.Format (TranslateTime ("--- Disconnected on %A, %B %d, %Y, %#I:%M %p ---"));

    m_pDoc->Note (strConnected);  

    // find time spent connected
    CTimeSpan ts = CTime::GetCurrentTime() - m_pDoc->m_tConnectTime;
      
    CString strDuration = TFormat ("--- Connected for %i day%s, %i hour%s, %i minute%s, %i second%s. ---",
                  PLURAL ((long) ts.GetDays()),
                  PLURAL ((long) ts.GetHours()),
                  PLURAL ((long) ts.GetMinutes()),
                  PLURAL ((long) ts.GetSeconds()));

    m_pDoc->Note (strDuration);  

    // and a horizontal rule

    m_pDoc->m_pCurrentLine->flags = HORIZ_RULE;  
    m_pDoc->StartNewLine (true, 0); 
    }  // end of message in world window wanted

  CString strInfo = TFormat ("--- Received %i line%s, sent %i line%s.",
                PLURAL (m_pDoc->m_nTotalLinesReceived),
                PLURAL (m_pDoc->m_nTotalLinesSent)
                );
  
  m_pDoc->Note (strInfo);  

  strInfo = TFormat ("--- Output buffer has %i/%i line%s in it (%.1f%% full).",
                m_pDoc->m_LineList.GetCount (),
                m_pDoc->m_maxlines,
                (m_pDoc->m_LineList.GetCount ()) == 1 ? "" : "s",
                (double) m_pDoc->m_LineList.GetCount () / (double) m_pDoc->m_maxlines * 100.0
                );

  m_pDoc->Note (strInfo);  

  strInfo = TFormat ("--- Matched %i trigger%s, %i alias%s, and %i timer%s fired.",
                PLURAL (m_pDoc->m_iTriggersMatchedThisSessionCount),   
                PLURALES (m_pDoc->m_iAliasesMatchedThisSessionCount),    
                PLURAL (m_pDoc->m_iTimersFiredThisSessionCount)       
                );

  m_pDoc->Note (strInfo);  

CString str;

  str = TFormat ("The \"%s\" server has closed the connection", 
              (const char *) m_pDoc->m_mush_name);

  if (App.m_bNotifyOnDisconnect && !m_pDoc->m_bDisconnectOK)
    {
    if (App.m_bErrorNotificationToOutputWindow)
      m_pDoc->Note (str);
    else
      ::UMessageBox (str, MB_ICONEXCLAMATION);
    }
  else
    Frame.SetStatusMessage (str);
  m_pDoc->m_iConnectPhase = eConnectNotConnected;

  m_pDoc->UpdateAllViews  (NULL);     // force window title to be redrawn

  } // end of OnClose