Example #1
0
void QHimePlatformInputContext::setFocusObject(QObject* object)
{
    dbg("QHimePlatformInputContext::setFocusObject\n");
    QWindow *window = qApp->focusWindow();
    if (!window) {
        dbg("no window, focus out\n");
        focused_win = 0;
        char *rstr = NULL;
        hime_im_client_focus_out2(hime_ch, &rstr);
        if (rstr) {
            send_str(rstr);
        } else {
            dbg("no str in preedit\n");
        }
        return;
    }

    WId win = window->winId();

    if (focused_win && win != focused_win) {
        if (hime_ch) {
            hime_im_client_focus_out(hime_ch);
        }
    }

    focused_win = win;

    if (hime_ch) {
        hime_im_client_set_window(hime_ch, win);
        hime_im_client_focus_in(hime_ch);
        cursorMoved();
    }
}
Example #2
0
void TaskBroker::addTask( const char *task, long time )
{
	if( task == 0 )
		return;

	_taskList->append( new Task( task, time ) );

	emit cursorMoved( _taskList->at() );
}
Example #3
0
void
WPiano::setCursorPos(vmd_time_t time, int level)
{
	if (time != cursor_time_ || level != cursor_level_) {
		update(cursor_qrect());
		cursor_time_ = time;
		cursor_level_ = level;
		update(cursor_qrect());
		if (pivot_enabled_)
			update();
		emit cursorMoved();
	}
}
Example #4
0
int TaskBroker::moveCursor(int d)
{

        if( _taskList->count() == 0 
                || ((unsigned)(_taskList->at() + d) >=_taskList->count()))
                return 0;

	_taskList->at( _taskList->at() + d );

        emit cursorMoved( _taskList->at() );

        return _taskList->at();
}
Example #5
0
void QHimePlatformInputContext::update(Qt::InputMethodQueries queries )
{
    dbg("QHimePlatformInputContext::update\n");
    QObject *input = qApp->focusObject();
    if (!input)
        return;

    QInputMethodQueryEvent query(queries);
    QGuiApplication::sendEvent(input, &query);

    if (queries & Qt::ImCursorRectangle) {
        cursorMoved();
    }
}
void QFCompleterTextEditWidget::cursorChanged() {
    emit cursorMoved(getLineNumber(), getColumnNumber());
    QString s=validTextUnderCursor().trimmed();
    //std::cout<<s.toLatin1().data()<<std::endl;
    if (currentTextUnderCursor!=s) {
        currentTextUnderCursor=s;
        emit wordUnderCursorChanged(s);
    }

    /*std::cout<<"document()->documentLayout()->documentSize() = "<<document()->documentLayout()->documentSize().width()<<"   "<<document()->documentLayout()->documentSize().height()<<std::endl;
    std::cout<<"verticalScrollBar()->value() = "<<verticalScrollBar()->value()<<std::endl;
    std::cout<<"verticalScrollBar()->min  max = "<<verticalScrollBar()->minimum()<<"  "<<verticalScrollBar()->maximum()<<std::endl;
    std::cout<<"viewport()->height() = "<<viewport()->height()<<std::endl;
    std::cout<<"viewport()->width() = "<<viewport()->width()<<std::endl;*/
}
Example #7
0
void Editor::en_change(){
	if( fmtBusy ) return;

	fmtBusy=true;
	editCtrl.HideSelection( true,false );
	getSel();

	int begin=editCtrl.LineFromChar( selStart );
	int end=begin+1;

 	int lineCount=editCtrl.GetLineCount();
	int delta=lineCount-fmtLineCount;

	if( delta>0 ){
		begin-=delta;
		funcList.relocate( begin,delta );
		typeList.relocate( begin,delta );
		labsList.relocate( begin,delta );
		funcList.remove( begin,end );
		typeList.remove( begin,end );
		labsList.remove( begin,end );
	}else if( delta<0 ){
		int t=end-delta;
		funcList.remove( begin,t );
		typeList.remove( begin,t );
		labsList.remove( begin,t );
		funcList.relocate( t,delta );
		typeList.relocate( t,delta );
		labsList.relocate( t,delta );
	}else{
		funcList.remove( begin,end );
		typeList.remove( begin,end );
		labsList.remove( begin,end );
	}

	for( int n=begin;n<end;++n ) formatLine( n );

	setSel();editCtrl.HideSelection( false,false );
	fmtBusy=false;
	cursorMoved();
}
Example #8
0
void ScorePanel::FillGrid()
{
	CSchemeManager *pSchemes = gViewPort->GetSchemeManager();
	SchemeHandle_t hScheme = pSchemes->getSchemeHandle("Scoreboard Text");
	SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle("Scoreboard Title Text");
	SchemeHandle_t hSmallScheme = pSchemes->getSchemeHandle("Scoreboard Small Text");
	SchemeHandle_t hTinyScheme = pSchemes->getSchemeHandle("Scoreboard Tiny Text");

	Font *sfont = pSchemes->getFont(hScheme);
	Font *tfont = pSchemes->getFont(hTitleScheme);
	Font *smallfont = pSchemes->getFont(hSmallScheme);
	Font *tinyfont = pSchemes->getFont(hTinyScheme);

	// update highlight position
	int x, y;
	getApp()->getCursorPos(x, y);
	cursorMoved(x, y, this);
	
	// remove highlight row if we're not in squelch mode
	if (!GetClientVoiceMgr()->IsInSquelchMode())
	{
		m_iHighlightRow = -1;
	}
	
	bool bNextRowIsGap = false;
	
	for(int row=0; row < NUM_ROWS; row++)
	{
		CGrid *pGridRow = &m_PlayerGrids[row];
		pGridRow->SetRowUnderline(0, false, 0, 0, 0, 0, 0);
		
		if(row >= m_iRows)
		{
			for(int col=0; col < NUM_COLUMNS; col++)
				m_PlayerEntries[col][row].setVisible(false);
			
			continue;
		}
		
		bool bRowIsGap = false;
		if (bNextRowIsGap)
		{
			bNextRowIsGap = false;
			bRowIsGap = true;
		}
		
		// Get the player's data
		int theSortedRow = m_iSortedRows[row];
		hud_player_info_t* pl_info = &g_PlayerInfoList[theSortedRow];
		extra_player_info_t* theExtraPlayerInfo = &g_PlayerExtraInfo[theSortedRow];
		int thePlayerClass = theExtraPlayerInfo->playerclass;
		short theTeamNumber = theExtraPlayerInfo->teamnumber;
		string theCustomIcon = (string)theExtraPlayerInfo->customicon;
// puzl: 0001073
		short thePlayerAuthentication = theExtraPlayerInfo->auth;
		bool thePlayerIsDead = false;
		switch( thePlayerClass )
		{
		case PLAYERCLASS_DEAD_MARINE:
		case PLAYERCLASS_DEAD_ALIEN:
		case PLAYERCLASS_REINFORCING:
			thePlayerIsDead = true;
			break;
		}

		// Code to test DEBUG
#if 0
		#ifdef DEBUG
		extern int gGlobalDebugAuth;
		thePlayerAuthentication = 1;
		thePlayerAuthentication <<= gGlobalDebugAuth;
		#endif
#endif

		team_info_t* team_info = &g_TeamInfo[m_iSortedRows[row]];
		int theColorIndex = theTeamNumber % iNumberOfTeamColors;

        int theLocalPlayerTeam = 0;
        if(gEngfuncs.GetLocalPlayer())
        {
            theLocalPlayerTeam = gEngfuncs.GetLocalPlayer()->curstate.team;
        }
		
		for(int col=0; col < NUM_COLUMNS; col++)
		{
			CLabelHeader *pLabel = &m_PlayerEntries[col][row];

			pLabel->setVisible(true);
			pLabel->setText2("");
			pLabel->setImage(NULL);
			pLabel->setFont(sfont);
			pLabel->setTextOffset(0, 0);
			
			int rowheight = 13;
			if (ScreenHeight() > 480)
			{
				rowheight = YRES(rowheight);
			}
			else
			{
				// more tweaking, make sure icons fit at low res
				rowheight = 15;
			}
			pLabel->setSize(pLabel->getWide(), rowheight);
			pLabel->setBgColor(0, 0, 0, 255);
			
			char sz[128];

			Color gammaAdjustedTeamColor = BuildColor(kTeamColors[theColorIndex][0], kTeamColors[theColorIndex][1], kTeamColors[theColorIndex][2], gHUD.GetGammaSlope());
            pLabel->setFgColor(gammaAdjustedTeamColor[0], gammaAdjustedTeamColor[1], gammaAdjustedTeamColor[2], 0);

			if (m_iIsATeam[row] == TEAM_BLANK)
			{
				pLabel->setText(" ");
				continue;
			}
			else if ( m_iIsATeam[row] == TEAM_YES )
			{
				theColorIndex = team_info->teamnumber % iNumberOfTeamColors;

				// team color text for team names
				
				

				// different height for team header rows
				rowheight = 20;
				if (ScreenHeight() >= 480)
				{
					rowheight = YRES(rowheight);
				}
				pLabel->setSize(pLabel->getWide(), rowheight);
				pLabel->setFont(tfont);

				pGridRow->SetRowUnderline(	0,
											true,
											YRES(3),
											gammaAdjustedTeamColor[0],
											gammaAdjustedTeamColor[1],
											gammaAdjustedTeamColor[2],
											0 );
			}
			else if ( m_iIsATeam[row] == TEAM_SPECTATORS )
			{
				// grey text for spectators
				pLabel->setFgColor(100, 100, 100, 0);

				// different height for team header rows
				rowheight = 20;
				if (ScreenHeight() >= 480)
				{
					rowheight = YRES(rowheight);
				}
				pLabel->setSize(pLabel->getWide(), rowheight);
				pLabel->setFont(tfont);

				pGridRow->SetRowUnderline(0, true, YRES(3), 100, 100, 100, 0);
			}
			else
			{
				if(thePlayerIsDead)
				{
					pLabel->setFgColor(255, 0, 0, 0);
				}
				else
				{
					// team color text for player names
					pLabel->setFgColor(gammaAdjustedTeamColor[0], gammaAdjustedTeamColor[1], gammaAdjustedTeamColor[2], 0);
				}
				
				// Set background color
				if ( pl_info && pl_info->thisplayer ) // if it is their name, draw it a different color
				{
					// Highlight this player
					pLabel->setFgColor(Scheme::sc_white);
					pLabel->setBgColor(gammaAdjustedTeamColor[0], gammaAdjustedTeamColor[1], gammaAdjustedTeamColor[2], 196 );
				}
				else if ( theSortedRow == m_iLastKilledBy && m_fLastKillTime && m_fLastKillTime > gHUD.m_flTime )
				{
					// Killer's name
					pLabel->setBgColor( 255,0,0, 255 - ((float)15 * (float)(m_fLastKillTime - gHUD.m_flTime)) );
				}
			}				

			// Align 
            switch(col)
            {
            case COLUMN_NAME:
            case COLUMN_CLASS:
                pLabel->setContentAlignment( vgui::Label::a_west );
                break;

            case COLUMN_TRACKER:
            case COLUMN_RANK_ICON:
            case COLUMN_VOICE:
                pLabel->setContentAlignment( vgui::Label::a_center );
                break;

            case COLUMN_SCORE:
            case COLUMN_KILLS:
            case COLUMN_DEATHS:
            case COLUMN_LATENCY:
            default:
                pLabel->setContentAlignment( vgui::Label::a_east );
                break;
            }

			// Fill out with the correct data
			strcpy(sz, "");
			if ( m_iIsATeam[row] )
			{
				char sz2[128];

				switch (col)
				{
				case COLUMN_NAME:
					if ( m_iIsATeam[row] == TEAM_SPECTATORS )
					{
						sprintf( sz2, CHudTextMessage::BufferedLocaliseTextString( "#Spectators" ) );
					}
					else
					{
						if(team_info)
						{
							sprintf( sz2, gViewPort->GetTeamName(team_info->teamnumber) );
						}
					}

					strcpy(sz, sz2);

					// Append the number of players
					if ( m_iIsATeam[row] == TEAM_YES && team_info)
					{
						if (team_info->players == 1)
						{
							sprintf(sz2, "(%d %s)", team_info->players, CHudTextMessage::BufferedLocaliseTextString( "#Player" ) );
						}
						else
						{
							sprintf(sz2, "(%d %s)", team_info->players, CHudTextMessage::BufferedLocaliseTextString( "#Player_plural" ) );
						}

						pLabel->setText2(sz2);
						pLabel->setFont2(smallfont);
					}
					break;
				case COLUMN_VOICE:
					break;
				case COLUMN_CLASS:
					break;
                case COLUMN_SCORE:
                    // Don't show score for enemies unless spectating or in RR
                    if ((m_iIsATeam[row] == TEAM_YES) && team_info && ((theLocalPlayerTeam == 0) || (theLocalPlayerTeam == team_info->teamnumber)))
                        sprintf(sz, "%d",  team_info->score);
                    break;
				case COLUMN_KILLS:
					if ((m_iIsATeam[row] == TEAM_YES) && team_info) 
						sprintf(sz, "%d",  team_info->frags );
					break;
				case COLUMN_DEATHS:
					if ((m_iIsATeam[row] == TEAM_YES) && team_info)
						sprintf(sz, "%d",  team_info->deaths );
					break;
				case COLUMN_LATENCY:
					if ((m_iIsATeam[row] == TEAM_YES) && team_info)
						sprintf(sz, "%d", team_info->ping );
					break;
				default:
					break;
				}
			}
			else
			{
				// Are these stats for an enemy?  Score and other stats shouldn't be drawn for enemies.
				bool theIsForEnemy = false;

				int theLocalPlayerTeam = 0;
				if(gEngfuncs.GetLocalPlayer())
				{
					theLocalPlayerTeam = gEngfuncs.GetLocalPlayer()->curstate.team;
				}

				if((theLocalPlayerTeam != 0) && (theExtraPlayerInfo->teamnumber != theLocalPlayerTeam))
				{
					theIsForEnemy = true;
				}
				
				switch (col)
				{
				case COLUMN_NAME:
					
					if (g_pTrackerUser)
					{
						int playerSlot = m_iSortedRows[row];
						int trackerID = gEngfuncs.GetTrackerIDForPlayer(playerSlot);
						const char *trackerName = g_pTrackerUser->GetUserName(trackerID);
						if (trackerName && *trackerName)
						{
							sprintf(sz, "   (%s)", trackerName);
							pLabel->setText2(sz);
						}
					}
					
					if(pl_info)
					{
						sprintf(sz, "%s  ", pl_info->name);
					}
					break;
				case COLUMN_VOICE:
					sz[0] = 0;
					// in HLTV mode allow spectator to turn on/off commentator voice
					if (pl_info && (!pl_info->thisplayer || gEngfuncs.IsSpectateOnly()))
					{
						GetClientVoiceMgr()->UpdateSpeakerImage(pLabel, theSortedRow);
					}
					break;
				case COLUMN_CLASS:
					// No class for other team's members (unless allied or spectator, and make sure player is on our team)
					strcpy(sz, "");

					if(team_info && ((theLocalPlayerTeam == theTeamNumber) || (gHUD.GetPlayMode() == PLAYMODE_OBSERVER)))
					{
						switch(thePlayerClass)
						{
						case (int)(PLAYERCLASS_DEAD_MARINE):
						case (int)(PLAYERCLASS_DEAD_ALIEN):
							sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassDead));
							break;
						case (int)(PLAYERCLASS_REINFORCING):
							sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassReinforcing));
							break;
						case (int)(PLAYERCLASS_REINFORCINGCOMPLETE):
							sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassReinforcingComplete));
							break;
						case (int)(PLAYERCLASS_ALIVE_JETPACK_MARINE):
							sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassJetpackMarine));
							break;
						case (int)(PLAYERCLASS_ALIVE_HEAVY_MARINE):
							sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassHeavyMarine));
							break;
						case (int)(PLAYERCLASS_COMMANDER):
							sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassCommander));
							break;
						case (int)(PLAYERCLASS_ALIVE_LEVEL1):
							sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassLevel1));
							break;
						case (int)(PLAYERCLASS_ALIVE_LEVEL2):
							sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassLevel2));
							break;
						case (int)(PLAYERCLASS_ALIVE_LEVEL3):
							sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassLevel3));
							break;
						case (int)(PLAYERCLASS_ALIVE_LEVEL4):
							sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassLevel4));
							break;
						case (int)(PLAYERCLASS_ALIVE_LEVEL5):
							sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassLevel5));
							break;
						case (int)(PLAYERCLASS_ALIVE_DIGESTING):
							sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassDigesting));
							break;
						case (int)(PLAYERCLASS_ALIVE_GESTATING):
							sprintf(sz, "%s", CHudTextMessage::BufferedLocaliseTextString(kClassGestating));
							break;
						default:
							break;
						}
					}
					break;
						
				case COLUMN_RANK_ICON:
// puzl: 0001073
#ifdef USE_OLDAUTH
					// Check if we have authority.  Right now these override the tracker icons.  Listed in increasing order of "importance".
					if(thePlayerAuthentication & PLAYERAUTH_CHEATINGDEATH)
					{
						// Red
						pLabel->setImage(m_pCheatingDeathIcon);
						pLabel->setFgColorAsImageColor(false);
						m_pCheatingDeathIcon->setColor(BuildColor(255, 69, 9, gHUD.GetGammaSlope()));
					}
					if(thePlayerAuthentication & PLAYERAUTH_VETERAN)
					{
						// Yellow
						pLabel->setImage(m_pVeteranIcon);
						pLabel->setFgColorAsImageColor(false);
						m_pVeteranIcon->setColor(BuildColor(248, 252, 0, gHUD.GetGammaSlope()));
					}
					if(thePlayerAuthentication & PLAYERAUTH_BETASERVEROP)
					{
						// Whitish
						pLabel->setImage(m_pServerOpIcon);
						pLabel->setFgColorAsImageColor(false);
						m_pServerOpIcon->setColor(BuildColor(220, 220, 220, gHUD.GetGammaSlope()));
					}
					if(thePlayerAuthentication & PLAYERAUTH_CONTRIBUTOR)
					{
						// Light blue
						pLabel->setImage(m_pContribIcon);
						pLabel->setFgColorAsImageColor(false);
						m_pContribIcon->setColor(BuildColor(117, 214, 241, gHUD.GetGammaSlope()));
					}
					if(thePlayerAuthentication & PLAYERAUTH_GUIDE)
					{
						// Magenta
						pLabel->setImage(m_pGuideIcon);
						pLabel->setFgColorAsImageColor(false);
						m_pGuideIcon->setColor(BuildColor(208, 16, 190, gHUD.GetGammaSlope()));
					}
					if(thePlayerAuthentication & PLAYERAUTH_PLAYTESTER)
					{
						// Orange
						pLabel->setImage(m_pPTIcon);
						pLabel->setFgColorAsImageColor(false);
						m_pPTIcon->setColor(BuildColor(255, 167, 54, gHUD.GetGammaSlope()));
					}
					if(thePlayerAuthentication & PLAYERAUTH_DEVELOPER)
					{
						// TSA blue
						pLabel->setImage(m_pDevIcon);
						pLabel->setFgColorAsImageColor(false);
						m_pDevIcon->setColor(BuildColor(100, 215, 255, gHUD.GetGammaSlope()));
					}

					if(thePlayerAuthentication & PLAYERAUTH_SERVEROP)
					{
						// Bright green
						pLabel->setImage(m_pServerOpIcon);
						pLabel->setFgColorAsImageColor(false);
						m_pServerOpIcon->setColor(BuildColor(0, 255, 0, gHUD.GetGammaSlope()));
					}

					// Allow custom icons to override other general icons
					if(thePlayerAuthentication & PLAYERAUTH_CUSTOM)
					{
						if(theCustomIcon != "")
						{
							string theIconName = theCustomIcon.substr(0, strlen(theCustomIcon.c_str()) - 3);
							string theFullCustomIconString = string("gfx/vgui/640_") + theIconName + string(".tga");

							vgui::BitmapTGA *pIcon = GetIconPointer(theCustomIcon);

							//Icon hasnt been loaded, load it now and add it to list of icons.
							if(pIcon == NULL)
							{
								pIcon = vgui_LoadTGANoInvertAlpha(theFullCustomIconString.c_str());

								if(pIcon)
									m_CustomIconList.push_back( make_pair(pIcon, theCustomIcon) );
							}
							
							if(pIcon)
							{
								pLabel->setImage(pIcon);
								pLabel->setFgColorAsImageColor(false);

								// Parse color (last 3 bytes are the RGB values 1-9)
								string theColor = theCustomIcon.substr( strlen(theCustomIcon.c_str())-3, 3);
								int theRed = (MakeIntFromString(theColor.substr(0, 1))/9.0f)*255;
								int theGreen = (MakeIntFromString(theColor.substr(1, 1))/9.0f)*255;
								int theBlue = (MakeIntFromString(theColor.substr(2, 1))/9.0f)*255;

								pIcon->setColor(BuildColor(theRed, theGreen, theBlue, gHUD.GetGammaSlope()));
							}
						}
					}
					
					if(g_pTrackerUser)
					{
						int playerSlot = theSortedRow;
						int trackerID = gEngfuncs.GetTrackerIDForPlayer(playerSlot);

						if (g_pTrackerUser->IsFriend(trackerID) && trackerID != g_pTrackerUser->GetTrackerID())
						{
							pLabel->setImage(m_pTrackerIcon);
							pLabel->setFgColorAsImageColor(false);
							m_pTrackerIcon->setColor(Color(255, 255, 255, 0));
						}
					}
#else
					if( theExtraPlayerInfo->icon )
					{
						vgui::Bitmap* image = theExtraPlayerInfo->icon->getImage( this->GetIconFrame() );
						if( image ) { pLabel->setImage( image ); }
					}
#endif
					break;
                case COLUMN_SCORE:
                    if(!theIsForEnemy)
                    {
                        const float kDeltaDisplayTime = 3.0f;
                        float theTimeSinceChange = gHUD.GetTimeOfLastUpdate() - theExtraPlayerInfo->timeOfLastScoreChange;
                        if((theExtraPlayerInfo->score > theExtraPlayerInfo->lastScore) && (theTimeSinceChange > 0) && (theTimeSinceChange < kDeltaDisplayTime) && (theExtraPlayerInfo->teamnumber != 0))
                        {
                            // draw score with change
                            int theDelta = (theExtraPlayerInfo->score - theExtraPlayerInfo->lastScore);
                            sprintf(sz, "(+%d) %d",  theDelta, theExtraPlayerInfo->score);
                        }
                        else
                        {
                            sprintf(sz, "%d", theExtraPlayerInfo->score);
                        }
                        
                    }
                    break;

				case COLUMN_KILLS:
                    sprintf(sz, "%d", theExtraPlayerInfo->frags);
                    break;

				case COLUMN_DEATHS:
					sprintf(sz, "%d", theExtraPlayerInfo->deaths);
					break;
				case COLUMN_LATENCY:
					if(pl_info)
					{
						sprintf(sz, "%d", pl_info->ping );
					}
					break;
				default:
					break;
				}
			}

            pLabel->setText(sz);
		}
	}

	for(row=0; row < NUM_ROWS; row++)
	{
		CGrid *pGridRow = &m_PlayerGrids[row];

		pGridRow->AutoSetRowHeights();
		pGridRow->setSize(PanelWidth(pGridRow), pGridRow->CalcDrawHeight());
		pGridRow->RepositionContents();
	}

	// hack, for the thing to resize
	m_PlayerList.getSize(x, y);
	m_PlayerList.setSize(x, y);
}
Example #9
0
void ScorePanel::FillGrid()
{
	CSchemeManager *pSchemes = gViewPort->GetSchemeManager();
	SchemeHandle_t hScheme = pSchemes->getSchemeHandle("Scoreboard Text");
	SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle("Scoreboard Title Text");
	SchemeHandle_t hSmallScheme = pSchemes->getSchemeHandle("Scoreboard Small Text");

	Font *sfont = pSchemes->getFont(hScheme);
	Font *tfont = pSchemes->getFont(hTitleScheme);
	/* Font *smallfont = */
	pSchemes->getFont(hSmallScheme);
	int i = 0;

	// update highlight position
	int x, y;
	getApp()->getCursorPos(x, y);
	cursorMoved(x, y, this);

	// remove highlight row if we're not in squelch mode
	if (!GetClientVoiceMgr()->IsInSquelchMode())
	{
		m_iHighlightRow = -1;
	}

	for(int row=0; row < NUM_ROWS; row++)
	{
		CGrid *pGridRow = &m_PlayerGrids[row];
		pGridRow->SetRowUnderline(0, false, 0, 0, 0, 0, 0);

		if(row >= m_iRows)
		{
			for(int col=0; col < NUM_COLUMNS; col++)
				m_PlayerEntries[col][row].setVisible(false);
		
			continue;
		}

		for(int col=0; col < NUM_COLUMNS; col++)
		{
			CLabelHeader *pLabel = &m_PlayerEntries[col][row];

			pLabel->setVisible(true);
			pLabel->setText2("");
			pLabel->setImage(NULL);
			pLabel->setFont(sfont);
			pLabel->setTextOffset(0, 0);
			
			int rowheight = 13;
			if (ScreenHeight > 480)
			{
				rowheight = YRES(rowheight);
			}
			else
			{
				// more tweaking, make sure icons fit at low res
				rowheight = 15;
			}
			pLabel->setSize(pLabel->getWide(), rowheight);
			pLabel->setBgColor(0, 0, 0, 255);
			
			char sz[128];
			hud_player_info_t *pl_info = NULL;
			team_info_t *team_info = NULL;

			if (m_iIsATeam[row] == TEAM_SPECTATORS)
			{
				pLabel->setText(" ");
				continue;
			}
			else if ( m_iIsATeam[row] == TEAM_YES )
			{
				// Get the team's data
				team_info = &g_TeamInfo[ m_iSortedRows[row] ];

				// team color text for team names
				pLabel->setFgColor(	iTeamColors[team_info->teamnumber % 5][0],
									iTeamColors[team_info->teamnumber % 5][1],
									iTeamColors[team_info->teamnumber % 5][2],
									0 );

				// different height for team header rows
				rowheight = 20;
				if (ScreenHeight >= 480)
				{
					rowheight = YRES(rowheight);
				}
				pLabel->setSize(pLabel->getWide(), rowheight);
				pLabel->setFont(tfont);

				pGridRow->SetRowUnderline(	0,
											true,
											YRES(3),
											iTeamColors[team_info->teamnumber % 5][0],
											iTeamColors[team_info->teamnumber % 5][1],
											iTeamColors[team_info->teamnumber % 5][2],
											0 );
			}
			else if ( m_iIsATeam[row] == TEAM_SPECTATORS )
			{
				// grey text for spectators
				pLabel->setFgColor(100, 100, 100, 0);

				// different height for team header rows
				rowheight = 20;
				if (ScreenHeight >= 480)
				{
					rowheight = YRES(rowheight);
				}
				pLabel->setSize(pLabel->getWide(), rowheight);
				pLabel->setFont(tfont);

				pGridRow->SetRowUnderline(0, true, YRES(3), 100, 100, 100, 0);
			}
			else
			{
				// team color text for player names
				pLabel->setFgColor(	g_iaDiscColors[ g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber % iNumberOfTeamColors ][0],
									g_iaDiscColors[ g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber % iNumberOfTeamColors ][1],
									g_iaDiscColors[ g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber % iNumberOfTeamColors ][2],
									0 );

				// Get the player's data
				pl_info = &g_PlayerInfoList[ m_iSortedRows[row] ];

				// Set background color
				if ( pl_info->thisplayer ) // if it is their name, draw it a different color
				{
					// Highlight this player
					pLabel->setFgColor(Scheme::sc_white);
					pLabel->setBgColor(	g_iaDiscColors[ g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber % iNumberOfTeamColors ][0],
										g_iaDiscColors[ g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber % iNumberOfTeamColors ][1],
										g_iaDiscColors[ g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber % iNumberOfTeamColors ][2],
										196 );
				}
				else if ( m_iSortedRows[row] == m_iLastKilledBy && m_fLastKillTime && m_fLastKillTime > gHUD.m_flTime )
				{
					// Killer's name
					pLabel->setBgColor( 255,0,0, 255 - ((float)15 * (float)(m_fLastKillTime - gHUD.m_flTime)) );
				}
			}				

			// Align 
			if (col == COLUMN_NAME )
			{
				pLabel->setContentAlignment( vgui::Label::a_west );
			}
			else if (col == COLUMN_TRACKER)
			{
				pLabel->setContentAlignment( vgui::Label::a_center );
			}
			else
			{
				pLabel->setContentAlignment( vgui::Label::a_east );
			}

			// Fill out with the correct data
			strcpy(sz, "");
			if ( m_iIsATeam[row] )
			{
				char sz2[128];

				switch (col)
				{
				case COLUMN_NAME:
					if ( m_iIsATeam[row] == TEAM_UNASSIGNED )
					{
						sprintf( sz2, "%s", CHudTextMessage::BufferedLocaliseTextString( "#Queue" ) );
					}
					else if ( m_iIsATeam[row] == TEAM_SPECTATORS )
					{
						sprintf( sz2, "%s", CHudTextMessage::BufferedLocaliseTextString( "#Spectators" ) );
					}
					else
					{
						sprintf( sz2, "%s", CHudTextMessage::BufferedLocaliseTextString( team_info->name ) );
					}

					// Uppercase it
					for ( i = 0; i < (int)strlen(sz2); i++)
					{
						if ( *(sz2 + i) )
							sz[i] = toupper( *(sz2 + i) );
					}
					sz[i] = '\0';

					// Append the number of players
					if ( m_iIsATeam[row] == TEAM_YES )
					{
						const char *pszTemp = NULL;

						if ( team_info->players == 1 )
						{
							pszTemp = "#Player";
						}
						else
						{
							pszTemp = "#Player_plural";
						}

						sprintf(sz, "%s (%d %s)", sz, team_info->players, CHudTextMessage::BufferedLocaliseTextString( pszTemp ) );
					}
			
					break;
				case COLUMN_VOICE:
					break;
				case COLUMN_CLASS:
					break;
				case COLUMN_KILLS: //Wins
					if ( g_iArenaMode == FALSE )
						 strcpy ( sz, " " );
					else
					{
						if ( m_iIsATeam[row] == TEAM_YES )
							sprintf(sz, "%d",  team_info->deaths );
					}
					break;
				case COLUMN_DEATHS: //Points
					if ( m_iIsATeam[row] == TEAM_YES )
						sprintf(sz, "%d",  team_info->frags );
					break;
				case COLUMN_LATENCY:
					if ( m_iIsATeam[row] == TEAM_YES )
						sprintf(sz, "%d", team_info->ping );
					break;
				default:
					break;
				}
			}
			else
			{
				switch (col)
				{
				case COLUMN_NAME:
					/*
					if (g_pTrackerUser)
					{
						int playerSlot = m_iSortedRows[row];
						int trackerID = gEngfuncs.GetTrackerIDForPlayer(playerSlot);
						const char *trackerName = g_pTrackerUser->GetUserName(trackerID);
						if (trackerName && *trackerName)
						{
							sprintf(sz, "   (%s)", trackerName);
							pLabel->setText2(sz);
						}
					}
					*/
					sprintf(sz, "%s  ", pl_info->name);
					break;
				case COLUMN_VOICE:
					sz[0] = 0;
					GetClientVoiceMgr()->UpdateSpeakerImage(pLabel, m_iSortedRows[row]);
					break;
				case COLUMN_CLASS:
					
						if ( g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber == 0 && g_iArenaMode == TRUE )
						{
							sprintf(sz, "%d",  g_PlayerExtraInfo[ m_iSortedRows[row] ].playerclass );
						}
						else
						{
							strcpy(sz, "");
						}
					
					break;

				case COLUMN_TRACKER:
						/*
					if (g_pTrackerUser)
					{
						int playerSlot = m_iSortedRows[row];
						int trackerID = gEngfuncs.GetTrackerIDForPlayer(playerSlot);

						if (g_pTrackerUser->IsFriend(trackerID) && trackerID != g_pTrackerUser->GetTrackerID())
						{
							pLabel->setImage(m_pTrackerIcon);
							pLabel->setFgColorAsImageColor(false);
							m_pTrackerIcon->setColor(Color(255, 255, 255, 0));
						}
					}*/
					break;

				case COLUMN_KILLS: //Wins
			        if ( g_iArenaMode == TRUE )
					     sprintf(sz, "%d",  g_PlayerExtraInfo[ m_iSortedRows[row] ].deaths );
					break;
				case COLUMN_DEATHS: //Points
					sprintf(sz, "%d",  g_PlayerExtraInfo[ m_iSortedRows[row] ].frags );
					break;
				case COLUMN_LATENCY:
					sprintf(sz, "%d", g_PlayerInfoList[ m_iSortedRows[row] ].ping );
					break;
				default:
					break;
				}
			}

			pLabel->setText(sz);
		}
	}

	for(int row = 0; row < NUM_ROWS; row++)
	{
		CGrid *pGridRow = &m_PlayerGrids[row];

		pGridRow->AutoSetRowHeights();
		pGridRow->setSize(PanelWidth(pGridRow), pGridRow->CalcDrawHeight());
		pGridRow->RepositionContents();
	}

	// hack, for the thing to resize
	m_PlayerList.getSize(x, y);
	m_PlayerList.setSize(x, y);
}
Example #10
0
void Plot::onPickerMoved( const QPointF& pos )
{
    const int idx = frameAt( pos.x() );
    if ( idx >= 0 )
        Q_EMIT cursorMoved( idx );
}
Example #11
0
void ScorePanel::FillGrid()
{
	CSchemeManager *pSchemes = gViewPort->GetSchemeManager();
	SchemeHandle_t hScheme = pSchemes->getSchemeHandle("Scoreboard Text");
	SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle("Scoreboard Title Text");
	SchemeHandle_t hSmallScheme = pSchemes->getSchemeHandle("Scoreboard Small Text");

	Font *sfont = pSchemes->getFont(hScheme);
	Font *tfont = pSchemes->getFont(hTitleScheme);
	Font *smallfont = pSchemes->getFont(hSmallScheme);

	// update highlight position
	int x, y;
	getApp()->getCursorPos(x, y);
	cursorMoved(x, y, this);

	// remove highlight row if we're not in squelch mode
	if (!GetClientVoiceMgr()->IsInSquelchMode())
	{
		m_iHighlightRow = -1;
	}

	bool bNextRowIsGap = false;

	for(int row=0; row < NUM_ROWS; row++)
	{
		CGrid *pGridRow = &m_PlayerGrids[row];
		pGridRow->SetRowUnderline(0, false, 0, 0, 0, 0, 0);

		if(row >= m_iRows)
		{
			for(int col=0; col < NUM_COLUMNS; col++)
				m_PlayerEntries[col][row].setVisible(false);
		
			continue;
		}

		bool bRowIsGap = false;
		if (bNextRowIsGap)
		{
			bNextRowIsGap = false;
			bRowIsGap = true;
		}

		for(int col=0; col < NUM_COLUMNS; col++)
		{
			CLabelHeader *pLabel = &m_PlayerEntries[col][row];

			pLabel->setVisible(true);
			pLabel->setText2("");
			pLabel->setImage(NULL);
			pLabel->setFont(sfont);
			pLabel->setTextOffset(0, 0);
			
			int rowheight = 13;
			if (ScreenHeight > 480)
			{
				rowheight = YRES(rowheight);
			}
			else
			{
				// more tweaking, make sure icons fit at low res
				rowheight = 15;
			}
			pLabel->setSize(pLabel->getWide(), rowheight);
			pLabel->setBgColor(0, 0, 0, 255);
			
			char sz[128];
			hud_player_info_t *pl_info = NULL;
			team_info_t *team_info = NULL;

			if (m_iIsATeam[row] == TEAM_BLANK)
			{
				pLabel->setText(" ");
				continue;
			}
			else if ( m_iIsATeam[row] == TEAM_YES )
			{
				// Get the team's data
				team_info = &g_TeamInfo[ m_iSortedRows[row] ];

				// team color text for team names
				pLabel->setFgColor(	iTeamColors[team_info->teamnumber % iNumberOfTeamColors][0],
									iTeamColors[team_info->teamnumber % iNumberOfTeamColors][1],
									iTeamColors[team_info->teamnumber % iNumberOfTeamColors][2],
									0 );

				// different height for team header rows
				rowheight = 20;
				if (ScreenHeight >= 480)
				{
					rowheight = YRES(rowheight);
				}
				pLabel->setSize(pLabel->getWide(), rowheight);
				pLabel->setFont(tfont);

				pGridRow->SetRowUnderline(	0,
											true,
											YRES(3),
											iTeamColors[team_info->teamnumber % iNumberOfTeamColors][0],
											iTeamColors[team_info->teamnumber % iNumberOfTeamColors][1],
											iTeamColors[team_info->teamnumber % iNumberOfTeamColors][2],
											0 );
			}
			else if ( m_iIsATeam[row] == TEAM_SPECTATORS )
			{
				// grey text for spectators
				pLabel->setFgColor(100, 100, 100, 0);

				// different height for team header rows
				rowheight = 20;
				if (ScreenHeight >= 480)
				{
					rowheight = YRES(rowheight);
				}
				pLabel->setSize(pLabel->getWide(), rowheight);
				pLabel->setFont(tfont);

				pGridRow->SetRowUnderline(0, true, YRES(3), 100, 100, 100, 0);
			}
			else
			{
				// team color text for player names
				pLabel->setFgColor(	iTeamColors[ g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber % iNumberOfTeamColors ][0],
									iTeamColors[ g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber % iNumberOfTeamColors ][1],
									iTeamColors[ g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber % iNumberOfTeamColors ][2],
									0 );

				// Get the player's data
				pl_info = &g_PlayerInfoList[ m_iSortedRows[row] ];

				// Set background color
				if ( pl_info->thisplayer ) // if it is their name, draw it a different color
				{
					// Highlight this player
					pLabel->setFgColor(Scheme::sc_white);
					pLabel->setBgColor(	iTeamColors[ g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber % iNumberOfTeamColors ][0],
										iTeamColors[ g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber % iNumberOfTeamColors ][1],
										iTeamColors[ g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber % iNumberOfTeamColors ][2],
										196 );
				}
				else if ( m_iSortedRows[row] == m_iLastKilledBy && m_fLastKillTime && m_fLastKillTime > gHUD.m_flTime )
				{
					// Killer's name
					pLabel->setBgColor( 255,0,0, 255 - ((float)15 * (float)(m_fLastKillTime - gHUD.m_flTime)) );
				}
			}				

			// Align 
			if (col == COLUMN_NAME || col == COLUMN_CLASS)
			{
				pLabel->setContentAlignment( vgui::Label::a_west );
			}
			else if (col == COLUMN_TRACKER)
			{
				pLabel->setContentAlignment( vgui::Label::a_center );
			}
			else
			{
				pLabel->setContentAlignment( vgui::Label::a_east );
			}

			// Fill out with the correct data
			strcpy(sz, "");
			if ( m_iIsATeam[row] )
			{
				char sz2[128];

				switch (col)
				{
				case COLUMN_NAME:
					if ( m_iIsATeam[row] == TEAM_SPECTATORS )
					{
						sprintf( sz2, CHudTextMessage::BufferedLocaliseTextString( "#Spectators" ) );
					}
					else
					{
						sprintf( sz2, gViewPort->GetTeamName(team_info->teamnumber) );
					}

					strcpy(sz, sz2);

					// Append the number of players
					if ( m_iIsATeam[row] == TEAM_YES )
					{
						if (team_info->players == 1)
						{
							sprintf(sz2, "(%d %s)", team_info->players, CHudTextMessage::BufferedLocaliseTextString( "#Player" ) );
						}
						else
						{
							sprintf(sz2, "(%d %s)", team_info->players, CHudTextMessage::BufferedLocaliseTextString( "#Player_plural" ) );
						}

						pLabel->setText2(sz2);
						pLabel->setFont2(smallfont);
					}
					break;
				case COLUMN_VOICE:
					break;
				case COLUMN_CLASS:
					break;
				case COLUMN_KILLS:
					if ( m_iIsATeam[row] == TEAM_YES )
						sprintf(sz, "%d",  team_info->frags );
					break;
				case COLUMN_DEATHS:
					if ( m_iIsATeam[row] == TEAM_YES )
						sprintf(sz, "%d",  team_info->deaths );
					break;
				case COLUMN_LATENCY:
					if ( m_iIsATeam[row] == TEAM_YES )
						sprintf(sz, "%d", team_info->ping );
					break;
				default:
					break;
				}
			}
			else
			{
				bool bShowClass = false;

				switch (col)
				{
				case COLUMN_NAME:
					sprintf(sz, "%s  ", pl_info->name);
					break;
				case COLUMN_VOICE:
					sz[0] = 0;
					// in HLTV mode allow spectator to turn on/off commentator voice
					if (!pl_info->thisplayer || gEngfuncs.IsSpectateOnly() )
					{
						GetClientVoiceMgr()->UpdateSpeakerImage(pLabel, m_iSortedRows[row]);
					}
					break;
				case COLUMN_CLASS:
					// No class for other team's members (unless allied or spectator)
					if ( gViewPort && EV_TFC_IsAllyTeam( g_iTeamNumber, g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber )  )
						bShowClass = true;
					// Don't show classes if this client hasnt picked a team yet
					if ( g_iTeamNumber == 0 )
						bShowClass = false;

					if (bShowClass)
					{
						// Only print Civilian if this team are all civilians
						bool bNoClass = false;
						if ( g_PlayerExtraInfo[ m_iSortedRows[row] ].playerclass == 0 )
						{
							if ( gViewPort->GetValidClasses( g_PlayerExtraInfo[ m_iSortedRows[row] ].teamnumber ) != -1 )
								bNoClass = true;
						}

						if (bNoClass)
							sprintf(sz, "");
						else
							sprintf( sz, "%s", CHudTextMessage::BufferedLocaliseTextString( sLocalisedClasses[ g_PlayerExtraInfo[ m_iSortedRows[row] ].playerclass ] ) );
					}
					else
					{
						strcpy(sz, "");
					}
					break;

				case COLUMN_TRACKER:
					break;
				case COLUMN_KILLS:
					sprintf(sz, "%d",  g_PlayerExtraInfo[ m_iSortedRows[row] ].frags );
					break;
				case COLUMN_DEATHS:
					sprintf(sz, "%d",  g_PlayerExtraInfo[ m_iSortedRows[row] ].deaths );
					break;
				case COLUMN_LATENCY:
					sprintf(sz, "%d", g_PlayerInfoList[ m_iSortedRows[row] ].ping );
					break;
				default:
					break;
				}
			}

			pLabel->setText(sz);
		}
	}

	for(row=0; row < NUM_ROWS; row++)
	{
		CGrid *pGridRow = &m_PlayerGrids[row];

		pGridRow->AutoSetRowHeights();
		pGridRow->setSize(PanelWidth(pGridRow), pGridRow->CalcDrawHeight());
		pGridRow->RepositionContents();
	}

	// hack, for the thing to resize
	m_PlayerList.getSize(x, y);
	m_PlayerList.setSize(x, y);
}
Example #12
0
void Editor::en_selchange( NMHDR *nmhdr,LRESULT *result ){
	if( !fmtBusy ) fixFmt(false);
	cursorMoved();
	caret();
}
Example #13
0
int Editor::OnCreate( LPCREATESTRUCT cs ){
	CWnd::OnCreate( cs );

	CHARFORMAT fmt;fmt.cbSize=sizeof( fmt );
	fmt.dwMask=CFM_COLOR|CFM_PROTECTED;
	fmt.dwEffects=CFE_PROTECTED;
	fmt.crTextColor=prefs.rgb_default;

	PARAFORMAT pf;
	memset( &pf,0,sizeof( pf ) );
	pf.cbSize=sizeof( pf );
	pf.dwMask=PFM_TABSTOPS;
	pf.cTabCount=MAX_TAB_STOPS;
	int tabTwips=1440*8/GetDeviceCaps( ::GetDC(0),LOGPIXELSX ) * prefs.edit_tabs;
	for( int k=0;k<MAX_TAB_STOPS;++k ) pf.rgxTabs[k]=k*tabTwips;

	CRect r( 0,0,0,0 );

	editCtrl.Create(
		WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL|WS_BORDER|
		ES_MULTILINE|ES_AUTOHSCROLL|ES_AUTOVSCROLL|ES_NOHIDESEL,
		r,this,1 );
	editCtrl.SetFont( &prefs.editFont );
	editCtrl.SetBackgroundColor( false,prefs.rgb_bkgrnd );
	editCtrl.SetDefaultCharFormat( fmt );
	editCtrl.SetEventMask( ENM_CHANGE|ENM_PROTECTED|ENM_KEYEVENTS|ENM_MOUSEEVENTS|ENM_SELCHANGE );
	editCtrl.SetParaFormat( pf );
	editCtrl.LimitText( TEXTLIMIT );
	if( editCtrl.GetLimitText()!=TEXTLIMIT ) AfxMessageBox( "Unable to set editor text Limit" );
	editCtrl.SetModify(false);

	tabber.Create( WS_CHILD|WS_VISIBLE|TCS_BUTTONS|TCS_HOTTRACK,r,this,2 );
	tabber.SetFont( &prefs.tabsFont );
	tabber.SetPadding( CSize(3,3) );

	tabber.setListener( this );

	int bk=prefs.rgb_bkgrnd;
	int fg=prefs.rgb_ident;

	int ws=WS_CHILD|WS_BORDER;

	funcList.Create( ws|LVS_LIST|LVS_SHOWSELALWAYS,r,&tabber,1 );
	funcList.SetFont( &prefs.debugFont );
	funcList.SetBkColor( bk );
	funcList.SetTextColor( fg );
	funcList.SetTextBkColor( bk );

	typeList.Create( ws|LVS_LIST|LVS_SHOWSELALWAYS,r,&tabber,2 );
	typeList.SetFont( &prefs.debugFont );
	typeList.SetBkColor( bk );
	typeList.SetTextColor( fg );
	typeList.SetTextBkColor( bk );

	labsList.Create( ws|LVS_LIST|LVS_SHOWSELALWAYS,r,&tabber,3 );
	labsList.SetFont( &prefs.debugFont );
	labsList.SetBkColor( bk );
	labsList.SetTextColor( fg );
	labsList.SetTextBkColor( bk );

	tabber.insert( 0,&funcList,"funcs" );
	tabber.insert( 1,&typeList,"types" );
	tabber.insert( 2,&labsList,"labels" );

	cursorMoved();

	return 0;
}