Exemplo n.º 1
0
void CXTPSkinObjectTab::FillClient(CDC* pDC, CRect rc)
{
	FillBackground(pDC, rc);

	if (GetStyle() & TCS_BUTTONS)
		return;

	CXTPSkinManagerClass* pClass = GetSkinClass();

	CRect rcClient(rc);
	CRect rcHeader = GetHeaderRect();

	DWORD dwStyle = GetStyle();

	if (IsRight(dwStyle))
	{
		rcClient.right = rcHeader.left;
	}
	else if (IsLeft(dwStyle))
	{
		rcClient.left = rcHeader.right;
	}
	else if (IsBottom(dwStyle))
	{
		rcClient.bottom = rcHeader.top;
	}
	else
	{
		rcClient.top = rcHeader.bottom;
	}

	pClass->DrawThemeBackground(pDC, TABP_PANE, 0, &rcClient);
}
Exemplo n.º 2
0
std::string AclRightsToString(unsigned ulRights)
{
	if (ulRights == unsigned(-1))
		return "missing or invalid";
	
	if (IsRight(ulRights)) {
		const AclRightName *lpRightName = FindAclRight(ulRights);
		if (lpRightName == NULL)
			return stringify(ulRights, true);
		return lpRightName->szRight;
	}

	const AclRoleName *lpRoleName = FindAclRole(ulRights);
	if (lpRoleName != NULL)
		return lpRoleName->szRole;

	std::ostringstream ostr;
	bool empty = true;
	for (unsigned bit = 0, mask = 1; bit < 32; ++bit, mask <<= 1) {
		if (ulRights & mask) {
			if (!empty)
				ostr << ",";
			empty = false;
			ostr << AclRightsToString(mask);
		}
	}
	return ostr.str();
}
Exemplo n.º 3
0
CRect CXTPSkinObjectTab::GetHeaderRect()
{
	CRect rcHeader;
	GetClientRect(&rcHeader);

	CTabCtrl* pTabCtrl = (CTabCtrl*)this;

	// get the selected tab item rect.
	CRect rcItem;
	pTabCtrl->GetItemRect(pTabCtrl->GetCurSel(), &rcItem);

	DWORD dwStyle = GetStyle();

	if (IsRight(dwStyle))
	{
		rcHeader.left = rcItem.left;
	}
	else if (IsLeft(dwStyle))
	{
		rcHeader.right = rcItem.right;
	}
	else if (IsBottom(dwStyle))
	{
		rcHeader.top = rcItem.top;
	}
	else
	{
		rcHeader.bottom = (rcHeader.top + rcItem.Height()) * pTabCtrl->GetRowCount() + GetMetrics()->m_cyEdge;
	}
	return rcHeader;
}
Exemplo n.º 4
0
BOOL CGuiControlBar::IsLegal(UINT uAlin)
{
	m_First=GetFirstPos();
//	if (IsFloating()) return FALSE;
	switch(uAlin)
	{
		case HTLEFT:
			if (IsHorz() && m_pos >0 && (m_pos != m_Last && m_pos != m_First)) return TRUE;
			if (IsVert() && m_pos <= m_Last && IsRight() ) return TRUE;
			return FALSE;
			break;
		case HTTOP:
			if (m_pos != m_First && IsVert()) return TRUE;
			if (IsHorz() && m_pos <= m_Last && IsBottom() ) return TRUE;
			return FALSE;
			break;
		case HTRIGHT:
			if (m_pos <= m_Last && IsVert() && IsLeft() ) return TRUE;
			if (IsHorz() && m_pos >0 &&  m_pos != m_Last) return TRUE;
			return FALSE;
		case HTBOTTOM:
			if ((m_pos != m_Last && m_pos != m_First) && IsHorz() && IsBottom()) return TRUE;
			if (m_pos <= m_Last && IsHorz() && IsTop()) return TRUE;
			//if (IsVert() && m_pos >0 ) return TRUE;
			return FALSE;
			break;
	}
	return FALSE;
}
Exemplo n.º 5
0
static void search_ball(Info * info) {
        //info->destP.x = gety(info);
        //info->destP.y = getx(info)+50;
        //do_forward(info,DEFAULT_A);
       /*if (is_start == 0 && POSITI !=0) {
            run_rota(45,POSITI);
            run_forward(50,200);
            //run_rotaR(25);
            //run_forward(40,200);
            is_start = 1;        
        }*/                              //--- by hanlei
        if (IsBallCatch(info)) {
            info->state = BALL_CATCHED;
            info->sched_var.waitlost = 3;
            info->sched_var.doorseen = 0;            
            mylogfd(SCHFD, "[sche]State changing:SEARCH_BALL->ball_catched\n");
            if (!IsDoorSeen(info)) do_rota_with_ball(info, POSITI*360, 1);
            return;
        }  
        if (IsMiddle(info)) {            
            if (info->sched_var.waitforward -- == 0) {
                    info->sched_var.waitforward = SCHED_waitforward_TIME;
                    info->last_cmd = CMD_FORWARD;
                    info->state = FORWARDING_BALL;
                       
                    info->destP.x = gety(info);                
                    info->destP.y = - getx(info);
                    mylogfd(SCHFD, "[sche]SEARCH_BALL->forwarding_ball\n");
                    do_forward(info, DEFAULT_A);
                    return;
            }
        } else  {
			info->sched_var.count = 0;
			info->sched_var.door_count = 0;
			info->sched_var.door_dis = 10000;
			info->sched_var.max_green_sum = 0;
			info->sched_var.max_green_count = 0;
            if (IsBallAllSeen(info)) info->sched_var.wait = 0;
            else if (IsBallSeen(info)) info->sched_var.wait = 1;
            else info->sched_var.wait = 3;
            int dir ;
            if (START_FLAG == 0){
                START_FLAG = 1;
                dir = POSITI;
            }           
            dir = info->sched_var.search_dir;               //  search_ball -- redwalker
            if (IsBallSeen(info) && IsRight(info)) dir = -1; 
            if (IsBallSeen(info) && IsLeft(info)) dir = 1;
            info->state = SEARCHING_BALL;
            mylogfd(SCHFD, "[sche]SEARCH_BALL->search_ball\n");
            info->last_cmd = CMD_SEARCH_BALL;
            info->sched_var.search_dir = dir;
            do_search_ball(info, dir);
        }
}
Exemplo n.º 6
0
static void forwarding_ball(Info * info) {
        if (IsRight(info)) info->sched_var.search_dir = -2;
        if (IsLeft(info)) info->sched_var.search_dir = 2;
        if (IsBallCatch(info))   {
            mylogfd(SCHFD, "[sche]forwarding_ball->ball_catched\n");
            info->last_cmd = CMD_STOP; 
            info->state = BALL_CATCHED;
            info->sched_var.doorseen = 0;        
            do_stop(info);            //  delet // -- redwalker
            if (!IsDoorSeen(info)) do_rota_with_ball(info, POSITI*360, 1);
           return;
        }
        if (!IsBallSeen(info)) {  
            mylogfd(SCHFD, "[sche]forwarding_ball->stop when lose ball\n");
            info->state = SEARCH_BALL;
            do_stop(info);
            return;
        }
       /* else if (IsBallVeryNear(info))
        {
            mylogfd(SCHFD, "[sche]catching_ball->forwarding_ball\n");
            info->state = CATCHING_BALL;
            info->destP.x = gety(info);
            iinfo->destP.y = -getx(info);
            do_catch_ball(info);
        }*/
        if (IsMiddle(info)) {
            do_adjust(-1);
        }
        if (IsLeft(info)) {
            do_adjust(1);
        }
        if (IsRight(info)) {
            do_adjust(0);
        }
        if (checkDone ()) {
            mylogfd(SCHFD, "[sche]checkDone forwarding_ball\n");
            info->state = SEARCH_BALL;
            mylogfd(SCHFD, "[sche]forwarding_ball->SEARCH_BALL\n");
            return;
        }         
}
Exemplo n.º 7
0
void CXTPSkinObjectTab::OnDraw(CDC* pDC)
{
	CRect rc = GetHeaderRect();
	DWORD dwStyle = GetStyle();

	if (IsRight(dwStyle))
	{
		rc.left -= 2;
	}
	else if (IsLeft(dwStyle))
	{
		rc.right += 2;
	}
	else if (IsBottom(dwStyle))
	{
		rc.top -= 2;
	}
	else
	{
		rc.bottom += 2;
	}

	CXTPBufferDC dcMem(*pDC, rc);
	FillClient(&dcMem, CXTPClientRect(this));

	if (m_bActiveX)
	{
		m_bPaint = TRUE;
		CXTPBufferDC dcMem2(*pDC, rc);
		DefWindowProc(WM_PAINT, (WPARAM)dcMem2.GetSafeHdc(), 0);
		dcMem2.Discard();
		m_bPaint = FALSE;
	}

	CTabCtrl* pTabCtrl = (CTabCtrl*)this;

	CXTPFontDC font(&dcMem, GetFont());
	dcMem.SetBkMode(TRANSPARENT);

	for (int iItem = 0; iItem < pTabCtrl->GetItemCount(); ++iItem)
	{
		DrawTab(&dcMem, iItem);
	}

	DrawTab(&dcMem, pTabCtrl->GetCurSel());
}
Exemplo n.º 8
0
int MapOrientation(double cosThis, double cosNext, double cutOff){
    if(IsLeft(cosThis, cutOff) && IsLeft(cosNext, cutOff)){ return 0; }
    if(IsLeft(cosThis, cutOff) && IsRight(cosNext, cutOff)){ return 1; }
    if(IsLeft(cosThis, cutOff) && IsUndefined(cosNext, cutOff)){ return 2; }

    if(IsRight(cosThis, cutOff) && IsLeft(cosNext, cutOff)){ return 3; }
    if(IsRight(cosThis, cutOff) && IsRight(cosNext, cutOff)){ return 4; }
    if(IsRight(cosThis, cutOff) && IsUndefined(cosNext, cutOff)){ return 5; }

    if(IsUndefined(cosThis, cutOff) && IsLeft(cosNext, cutOff)){ return 6; }
    if(IsUndefined(cosThis, cutOff) && IsRight(cosNext, cutOff)){ return 7; }
    if(IsUndefined(cosThis, cutOff) && IsUndefined(cosNext, cutOff)){ return 8; }

    return 999;
}
Exemplo n.º 9
0
static void catching_ball(Info* info) {
        if (IsBallCatch(info)) {
            mylogfd(SCHFD, "[sche]State changing:catching_ball->ball_catched\n"); 
            info->state = BALL_CATCHED;
            info->sched_var.doorseen = 0;
            info->sched_var.waitlost = 3;       
            do_stop(info);
            if (!IsDoorSeen(info)) do_rota_with_ball(info, -POSITI*360, 1);    // get in a paramiter -- redwalker

        }
        else if (!IsBallAllSeen(info)) {
             mylogfd(SCHFD, "[sche]catching_ball->SEARCH_BALL\n");
             info->state = SEARCH_BALL;
             do_stop(info);
        }
        else if (!IsBallVeryNear(info))
        {
            mylogfd(SCHFD, "[sche]catching_ball->forwarding_ball\n");
            info->state = FORWARDING_BALL;
            info->destP.x = gety(info);
            info->destP.y = - getx(info);
            do_forward(info, DEFAULT_A);
        }
        else if (checkDone()) {
            mylogfd(SCHFD,"[sche]checkDone catching_ball \n");
            info->last_cmd = CMD_CATCH_BALL;
            info->destP.x = gety(info);
            info->destP.y = - getx(info); 
            do_catch_ball(info);
        }
        if (IsMiddle(info)) {
            do_adjust(-1);
        }
        if (IsLeft(info)) {
            do_adjust(1);
        }
        if (IsRight(info)) {
            do_adjust(0);
        }
}
Exemplo n.º 10
0
static void ball_catched(Info* info) {
        if (IsRight(info)) info->sched_var.search_dir = -1;
        if (IsLeft(info)) info->sched_var.search_dir = 1;
        if (IsDoorSeen(info)) {
            info->sched_var.doorseen = 1;
        }

     /*   if (info->sched_var.doorseen && !IsDoorSeen(info)) {
            info->sched_var.doorseen = 0;
            info->state = MOVING;
            do_rota_with_ball(info, 90, 1);
            return;
        }*/
     //   mylogfd(SCHFD, "%d %d %d\n", info->sched_var.is_door_seen, info->video_info->door_pos.x, info->video_info2->door_pos.x);

        if (IsDoorSeen(info)) {
			if (getDoorMidy(info) > 250) {
				info->destP.x = 50;
				info->destP.y = 0;
				info->state = MOVING;
				do_catch_ball(info);
			}
            mylogfd(SCHFD, "[sche]see door to face door\n");
			if (IsDoorLeft(info)) info->sched_var.search_door_dir = 1;
			else info->sched_var.search_door_dir = -1;
		//	do_stop(info);
			do_rota_with_ball(info, info->sched_var.search_door_dir * 90, 1);
            info->state = FACE_DOOR;
            return;
        }
        if (!IsBallCatch(info)) {
            mylogfd(SCHFD, "[sche]lose balll\n");
            info->last_cmd = CMD_STOP;
            do_stop(info);
            info->state = SEARCH_BALL;
            return;
        }
}
Exemplo n.º 11
0
void CTDCTaskListCtrl::OnNotifySplitterChange(int nSplitPos)
{
	// if split width exceeds client column width
	// extend column width to suit
	if (IsRight(m_lcTasks))
	{
		CRect rClient;
		CWnd::GetClientRect(rClient);

		nSplitPos = (rClient.Width() - nSplitPos);
	}

	if (nSplitPos > CLIENTCOLWIDTH)
	{
		m_lcTasks.SetColumnWidth(0, (nSplitPos + 4));
	}
	else if (m_lcTasks.GetColumnWidth(0) > CLIENTCOLWIDTH)
	{
		m_lcTasks.SetColumnWidth(0, CLIENTCOLWIDTH);
	}

	InvalidateAll(TRUE);
}
Exemplo n.º 12
0
BOOL CGuiControlBar::IsVert()
{
	if (IsLeft() || IsRight())	return TRUE;
	return FALSE;
}
Exemplo n.º 13
0
bool XMLMsg::IsInvalid() const
{
	return !IsRight();
}
Exemplo n.º 14
0
int CStockInfo::DigitBit( )
{
	if( IsFund() || IsRight() || CStock::typeshB == m_type)
		return 3;
	return 0;
}
bool Preprocessor::ConvertExpression( LexemList& expression, LexemList& output )
{
    if( expression.empty() )
    {
        PrintMessage( "Empty expression." );
        return true;
    }

    // Convert to RPN
    std::vector<Lexem> stack;
    for( LLITR it = expression.begin(); it != expression.end(); ++it )
    {
        PreprocessLexem( it, expression );
        Lexem& lexem = *it;
        if( IsIdentifier( lexem ) )
        {
            output.push_back( lexem );
        }
        else if( IsOperator( lexem ) )
        {
            while( stack.size() )
            {
                Lexem& lex = stack.back();
                if( IsOperator( lex ) &&
                    ( (OperLeftAssoc( lexem ) && ( OperPrecedence( lexem ) <= OperPrecedence( lex ))) ||
                      (OperPrecedence( lexem ) < OperPrecedence( lex )) ) )
                {
                    output.push_back( lex );
                    stack.pop_back();
                }
                else
                    break;
            }
            stack.push_back( lexem );
        }
        else if( IsLeft( lexem ) )
        {
            stack.push_back( lexem );
        }
        else if( IsRight( lexem ) )
        {
            bool foundLeft = false;
            while( stack.size() )
            {
                Lexem& lex = stack.back();
                if( IsLeft( lex ) )
                {
                    foundLeft = true;
                    break;
                }
                else
                {
                    output.push_back( lex );
                    stack.pop_back();
                }
            }

            if( !foundLeft )
            {
                PrintErrorMessage( "Mismatched parentheses." );
                return false;
            }

            stack.pop_back();
        }
        else
        {
            PrintErrorMessage( "Unknown token: " + lexem.Value );
            return false;
        }
    }

    // input end, flush the stack
    while( stack.size() )
    {
        Lexem& lex = stack.back();
        if( IsLeft( lex ) || IsRight( lex ) )
        {
            PrintErrorMessage( "Mismatched parentheses." );
            return false;
        }
        output.push_back( lex );
        stack.pop_back();
    }
    return true;
}
Exemplo n.º 16
0
AFX_INLINE BOOL IsVert(DWORD dwStyle)
{
	return (IsRight(dwStyle) || IsLeft(dwStyle));
}
Exemplo n.º 17
0
void CGuiControlBar::OnInvertTracker(const CRect& rect)
{
	ASSERT_VALID(this);
	ASSERT(!rect.IsRectEmpty());
		
	CRect rcWin=GetDockRect();
	
	CDC *pDC = m_pDockSite->GetDCEx(NULL,
        DCX_WINDOW|DCX_CACHE|DCX_LOCKWINDOWUPDATE);
	CRect rcBar;
	GetWindowRect(rcBar);
	if (IsVert())  //el sentido de las barras es vertical
	{

		
		
		if (m_SideMove==HTLEFT || m_SideMove==HTRIGHT) //el mouse esta en el borde izquierdo o derecho
		{
			rcWin.OffsetRect(-rect.left,-rect.top);
			rcWin.top+=10;
			rcWin.left=rect.left+2;
			rcWin.right=rect.right+2;
		}
		else  //el mouse esta el borde de arriba pero de una barra vertical
		{
			rcBar.OffsetRect(-rect.TopLeft());
			rcWin=rcBar;
			if (IsLeft() || IsRight())   //a la izquierda
			{
				
				rcWin.top=rect.top-2;
				rcWin.bottom=rect.bottom-2;
			}
			//
			
		}
	}
	else  //el sentido de las barras es horizontal
	{
		
		if (m_SideMove==HTTOP || m_SideMove==HTBOTTOM) //el mouse esta en el borde de arriba o abajo
		{
			rcWin.OffsetRect(-rect.left,-rect.top);
			rcWin.top=rect.top-2;
			rcWin.bottom=rect.bottom-2;
		}
		else		//el mouse esta en el borde derecho
		{
			rcBar.OffsetRect(-rect.TopLeft());
			rcWin=rcBar;
			if (IsBottom() || IsTop())	//abajo
			{		
				rcWin.left=rect.left+2;
				rcWin.right=rect.right+2;
			}
		}
	}
	ClientToScreen(&rcWin);
	GetParentFrame()->ScreenToClient(&rcWin);
	// invert the brush pattern (looks just like frame window sizing)
	CBrush* pBrush = CDC::GetHalftoneBrush();
	HBRUSH hOldBrush = NULL;
	if (pBrush != NULL)
		hOldBrush = (HBRUSH)SelectObject(pDC->m_hDC, pBrush->m_hObject);
	pDC->PatBlt(rcWin.left, rcWin.top, rcWin.Width(), rcWin.Height(), PATINVERT);
	if (hOldBrush != NULL)
		SelectObject(pDC->m_hDC, hOldBrush);
	m_pDockSite->ReleaseDC(pDC);
}
Exemplo n.º 18
0
BOOL CGuiToolBarWnd::IsVert()
{
	if (IsLeft() || IsRight())	return TRUE;
	return FALSE;
}