void CPlayerLoop::ShowFrame()
{
    // для простоты удаляем все нарисованные объекты
    m_Scene->clear();
    setBackgroundBrush(QBrush(QColor(255,255,255), QPixmap("../player/ground.jpg")));     // сделал траву фоном


    int picPosX = 0;
    int picPosY = 0;
    int infoPosY = 1;
    int textPosX = 0;
   // int textPosY = 2;
  //  qreal Size = picSize/30;
    textPosX = m_Map.GetMapSizeX();


    QGraphicsTextItem* Info = m_Scene->addText("Press 'Space' for start/stop \nPress '+'('-') for to increase (decrease) a speed\n(After this press space twice)");
    Info->setPos(picSize * textPosX, picSize*16);

#if 0
    //  рисуем заново
    QGraphicsPixmapItem* ant = m_Scene->addPixmap(QPixmap("../player/worker.png"));
    ant->scale(2, 2);
    ant->setPos(rand() % m_GameStep, rand() % m_GameStep);

#endif

    for(size_t i = 0; i < m_Map.GetNumberOfAnts(); i++)
        {
            CAnt &ant = m_Map.GetAnt(i);
            std::stringstream sstream;
            sstream  << "AntPosX = "<< ant.GetAntPosX() << ", AntPosY = "<< ant.GetAntPosY() << ",  AntStatus = "<<ant.GetAntStatus();
            QString QStr = QString::fromStdString(sstream.str());

            switch(ant.GetAntType())
            {
            case AtQueen:
            {
                infoPosY++;
                QGraphicsPixmapItem* Queen = m_Scene->addPixmap(QPixmap("../player/queen.png"));
                Queen->setPos(picSize * (ant.GetAntPosX()), picSize *(ant.GetAntPosY()));
                QGraphicsTextItem* Queen_info =  m_Scene->addText(QStr);
                Queen_info->setPos((textPosX+4)*picSize, picSize*infoPosY);
                Queen->scale(Size, Size);
                QGraphicsPixmapItem* Queen2 = m_Scene->addPixmap(QPixmap("../player/queen.png"));
                Queen2->setPos(picSize * textPosX, picSize*infoPosY);
                Queen2->scale(Size, Size);
                QGraphicsTextItem* Queen_name = m_Scene->addText("- Queen");
                Queen_name->setPos(textPosX*(picSize+1)+1, picSize*infoPosY);
                break;
            }
            case  AtWorker:    // 1 - рабочий
            {
                infoPosY++;
                QGraphicsPixmapItem* Worker = m_Scene->addPixmap(QPixmap("../player/worker.jpeg"));
                Worker->setPos(picSize * (ant.GetAntPosX()), picSize *(ant.GetAntPosY()));
                QGraphicsTextItem* Worker_info =  m_Scene->addText(QStr);
                Worker_info->setPos((textPosX+4)*picSize, picSize*infoPosY);
               Worker->scale(Size, Size);
                QGraphicsPixmapItem* Worker2 = m_Scene->addPixmap(QPixmap("../player/worker.jpeg"));
                Worker2->setPos(picSize * textPosX, picSize*(infoPosY));
                  Worker2->scale(Size, Size);
                QGraphicsTextItem* Worker_name = m_Scene->addText("- Worker");
                Worker_name->setPos(textPosX*(picSize+1)+1, picSize*(infoPosY));
                break;
            }
            case AtScout:      // 2 - разведчик
            {
                infoPosY++;
                QGraphicsPixmapItem* Scout = m_Scene->addPixmap(QPixmap("../player/scout.png"));
                Scout->setPos(picSize * (ant.GetAntPosX()), picSize *(ant.GetAntPosY()));
                QGraphicsTextItem* Scout_info =  m_Scene->addText(QStr);
                Scout_info->setPos((textPosX+4)*picSize, picSize*infoPosY);
                Scout->scale(Size, Size);
                QGraphicsPixmapItem* Scout2 = m_Scene->addPixmap(QPixmap("../player/scout.png"));
                Scout2->setPos(picSize * textPosX, infoPosY*picSize);
                 Scout2->scale(Size, Size);
                QGraphicsTextItem* Scout_name = m_Scene->addText("- Scout");
                Scout_name->setPos(textPosX*(picSize+1)+1, infoPosY*picSize);
                break;
            }
            case AtTracker:       // 3 - следопыт
            {
                infoPosY++;
                QGraphicsPixmapItem* Tracker = m_Scene->addPixmap(QPixmap("../player/tracker.png"));
                Tracker->setPos(picSize * (ant.GetAntPosX()), picSize *(ant.GetAntPosY()));
                QGraphicsTextItem* Tracker_info =  m_Scene->addText(QStr);
                Tracker_info->setPos((textPosX+4)*picSize, picSize*infoPosY);
                Tracker->scale(Size, Size);
                QGraphicsPixmapItem* Tracker2 = m_Scene->addPixmap(QPixmap("../player/tracker.png"));
                Tracker2->setPos(picSize * textPosX, infoPosY*picSize);
                   Tracker2->scale(Size, Size);
                QGraphicsTextItem* Tracker_info2 = m_Scene->addText("- Tracker");
                Tracker_info2->setPos(textPosX*(picSize+1)+1, infoPosY*picSize);
                break;
            }
            case   AtSapper:       // 4 - сапер
            {
                infoPosY++;
                QGraphicsPixmapItem* Sapper = m_Scene->addPixmap(QPixmap("../player/sapper.jpeg"));
                Sapper->setPos(picSize * (ant.GetAntPosX()), picSize *(ant.GetAntPosY()));
                 Sapper->scale(0.2*Size, Size*0.2);
                QGraphicsTextItem* Sapper_info =  m_Scene->addText(QStr);
                Sapper_info->setPos((textPosX+4)*picSize, picSize*infoPosY);
                QGraphicsPixmapItem* Sapper2 = m_Scene->addPixmap(QPixmap("../player/sapper.jpeg"));
                Sapper2->setPos(picSize * textPosX, infoPosY*picSize);
                QGraphicsTextItem* Sapper_info2 = m_Scene->addText("- Sapper");
                Sapper_info2->setPos(textPosX*(picSize+1)+1, infoPosY*picSize);
                Sapper2->scale(0.2*Size, 0.2*Size);
                break;
            }
            case   AtDoctor:       // 5 - врач
            {
                infoPosY++;
                QGraphicsPixmapItem* Doctor = m_Scene->addPixmap(QPixmap("../player/doctor.png"));
                Doctor->setPos(picSize * (ant.GetAntPosX()), picSize *(ant.GetAntPosY()));
                QGraphicsTextItem* Doctor_info =  m_Scene->addText(QStr);
                Doctor_info->setPos((textPosX+4)*picSize, picSize*infoPosY);
                Doctor->scale(Size, Size);
                QGraphicsPixmapItem* Doctor2 = m_Scene->addPixmap(QPixmap("../player/doctor.png"));
                Doctor2->setPos(picSize * textPosX, picSize *infoPosY);
                 Doctor2->scale(Size, Size);
                QGraphicsTextItem* Doctor_info2 = m_Scene->addText("- Doctor");
                Doctor_info2->setPos(textPosX*(picSize+1)+1, picSize*infoPosY);
                break;
            }
            case   AtTutor:       // 6 - воспитатель
            {
                infoPosY++;
                QGraphicsPixmapItem* Tutor = m_Scene->addPixmap(QPixmap("../player/tutor.jpeg"));
                Tutor->setPos(picSize * (ant.GetAntPosX()), picSize *(ant.GetAntPosY()));
                Tutor->scale(TrapScale*Size, TrapScale*Size);
                QGraphicsTextItem* Tutor_info =  m_Scene->addText(QStr);
                Tutor_info->setPos((textPosX+4)*picSize, picSize*infoPosY);
                QGraphicsPixmapItem* Tutor2 = m_Scene->addPixmap(QPixmap("../player/tutor.jpeg"));
                Tutor2->setPos(picSize * textPosX,infoPosY*picSize);
                QGraphicsTextItem* Tutor_info2 = m_Scene->addText("- Tutor");
                Tutor_info2->setPos(textPosX*(picSize+1)+1, infoPosY*picSize);
                Tutor2->scale(TrapScale*Size, Size*TrapScale);
                break;
            }
            case AtFarmer:       // 7 - фермер
            {
                infoPosY++;
                QGraphicsPixmapItem* Farmer = m_Scene->addPixmap(QPixmap("../player/farmer.png"));
                Farmer->setPos(picSize * (ant.GetAntPosX()), picSize *(ant.GetAntPosY()));
                QGraphicsTextItem* Farmer_info =  m_Scene->addText(QStr);
                Farmer_info->setPos((textPosX+4)*picSize, picSize*infoPosY);
                Farmer->scale(Size, Size);
                QGraphicsPixmapItem* Farmer2 = m_Scene->addPixmap(QPixmap("../player/farmer.jpg"));
                Farmer2->setPos(picSize * textPosX, infoPosY*picSize);
                Farmer2->scale(Size, Size);
                QGraphicsTextItem* Farmer_info2 = m_Scene->addText("- Farmer");
                Farmer_info2->setPos(textPosX*(picSize+1)+1, infoPosY*picSize);
                break;
            }
            case AtHunter:     // 8 - охотник
            {
                infoPosY++;
                QGraphicsPixmapItem* Hunter = m_Scene->addPixmap(QPixmap("../player/hunter.png"));
                Hunter->setPos(picSize * (ant.GetAntPosX()), picSize *(ant.GetAntPosY()));
                QGraphicsTextItem* Hunter_info =  m_Scene->addText(QStr);
                Hunter_info->setPos((textPosX+4)*picSize, picSize*infoPosY);
                Hunter->scale(0.188*Size, 0.188*Size);
                QGraphicsPixmapItem* Hunter2 = m_Scene->addPixmap(QPixmap("../player/hunter.jpeg"));
                Hunter2->setPos(picSize * textPosX, infoPosY*picSize);
                QGraphicsTextItem* Hunter_info2 = m_Scene->addText("- Hunter");
                Hunter_info2->setPos(textPosX*(picSize+1)+1, infoPosY*picSize);
                Hunter2->scale(0.188*Size, 0.188*Size);
                break;
            }
            case  AtManager:      // 9 - завхоз
            {
                infoPosY++;
                QGraphicsPixmapItem* Manager = m_Scene->addPixmap(QPixmap("../player/manager.gif"));
                Manager->setPos(picSize * (ant.GetAntPosX()), picSize *(ant.GetAntPosY()));
                Manager->scale(0.08*Size, 0.08*Size);
                QGraphicsTextItem* Manager_info =  m_Scene->addText(QStr);
                Manager_info->setPos((textPosX+4)*picSize, picSize*infoPosY);
                QGraphicsPixmapItem* Manager2 = m_Scene->addPixmap(QPixmap("../player/manager.gif"));
                Manager2->setPos(picSize * textPosX, picSize *infoPosY);
                QGraphicsTextItem* Manager_info2 = m_Scene->addText("- Manager");
                Manager_info2->setPos(textPosX*(picSize+1)+1, infoPosY*picSize);
                Manager2->scale(0.08*Size, 0.08*Size);

                break;
            }
            case   AtCowboy:     // 10 - пастух
            {
                infoPosY++;
                QGraphicsPixmapItem* Cowboy = m_Scene->addPixmap(QPixmap("../player/cowboy.png"));
                Cowboy->setPos(picSize * (ant.GetAntPosX()), picSize *(ant.GetAntPosY()));
                QGraphicsTextItem* Cowboy_info =  m_Scene->addText(QStr);
                Cowboy_info->setPos((textPosX+4)*picSize, picSize*infoPosY);
                Cowboy->scale(1*Size,Size*0.7);
                QGraphicsPixmapItem* Cowboy2 = m_Scene->addPixmap(QPixmap("../player/cowboy.png"));
                Cowboy2->setPos(picSize * textPosX, picSize *infoPosY);
                QGraphicsTextItem* Cowboy_info2 = m_Scene->addText("- Cowboy");
                Cowboy_info2->setPos(textPosX*(picSize+1)+1, infoPosY*picSize);
                Cowboy2->scale(1*Size,0.7*Size);
                break;
            }
            case  AtCow:     // 11 - коровка
            {
                infoPosY++;
                QGraphicsPixmapItem* Cow = m_Scene->addPixmap(QPixmap("../player/cow.jpeg"));
                Cow->setPos(picSize * (ant.GetAntPosX()), picSize *(ant.GetAntPosY()));
                QGraphicsTextItem* Cow_info =  m_Scene->addText(QStr);
                Cow_info->setPos((textPosX+4)*picSize, picSize*infoPosY);
                Cow->scale(0.1875*Size, 0.1875*Size);

                QGraphicsPixmapItem* Cow2 = m_Scene->addPixmap(QPixmap("../player/cow.jpeg"));
                Cow2->setPos(picSize * textPosX, picSize*infoPosY);
                QGraphicsTextItem* Cow_name = m_Scene->addText("- Cow");
                Cow_name->setPos(textPosX*(picSize+1)+1, picSize*infoPosY);
                Cow2->scale(0.1875*Size, 0.1875*Size);
                break;
            }
            case   AtLion:
            {
                infoPosY++;
                QGraphicsPixmapItem* Lion = m_Scene->addPixmap(QPixmap("../player/lion.png"));
                Lion->setPos(picSize * (ant.GetAntPosX()), picSize *(ant.GetAntPosY()));
                QGraphicsTextItem* Lion_info =  m_Scene->addText(QStr);
                Lion_info->setPos((textPosX+4)*picSize, picSize*infoPosY);
                Lion->scale(Size, Size);
                QGraphicsPixmapItem* Lion2 = m_Scene->addPixmap(QPixmap("../player/lion.png"));
                Lion2->setPos(picSize * textPosX, picSize *infoPosY);
                Lion2->scale(Size, Size);
                QGraphicsTextItem* Lion_info2 = m_Scene->addText("- Lion");
                Lion_info2->setPos(textPosX*(picSize+1)+1, infoPosY*picSize);
                break;
            }
            case   AtUnknown:
            {
                QGraphicsPixmapItem* Unknown = m_Scene->addPixmap(QPixmap("../player/unknown.png"));
                Unknown->setPos(picSize * (ant.GetAntPosX()), picSize *(ant.GetAntPosY()));
                break;
            }
            case   AtCount:
            {
                QGraphicsPixmapItem* Count = m_Scene->addPixmap(QPixmap("../player/ant.png"));
                Count->setPos(picSize * (ant.GetAntPosX()), picSize *(ant.GetAntPosY()));
                break;
            }
            }

        }
       infoPosY = 1;
    for(int i=0;i<m_Map.GetMapSizeX()*m_Map.GetMapSizeY();i++)
        {

            switch(m_Map.Cell(picPosX, picPosY))
            {

            case McTrap:
            {
                QGraphicsPixmapItem* Trap = m_Scene->addPixmap(QPixmap("../player/trap.jpeg"));
                Trap->setPos(picSize * picPosX, picSize * picPosY);
                picPosX = picPosX + 1;
                Trap->scale(0.133*Size,0.133*Size);

                if(picPosX == m_Map.GetMapSizeX())
                {
                    picPosX = 0;
                    picPosY = picPosY + 1;
                }
                break;
            }
            case McUnknown:
            {
                QGraphicsPixmapItem* Unknown = m_Scene->addPixmap(QPixmap("../player/unknown.png"));
                Unknown->setPos(picSize * picPosX, picSize * picPosY);
                picPosX = picPosX + 1;
                if(picPosX == m_Map.GetMapSizeX())
                {
                    picPosX = 0;
                    picPosY = picPosY + 1;
                }
                break;
            }
            case McWater:
            {
                QGraphicsPixmapItem* Water = m_Scene->addPixmap(QPixmap("../player/water.png"));
                Water->setPos(picSize*picPosX, picSize*picPosY);
                Water->scale(Size, Size);
                picPosX = picPosX + 1;
                if(picPosX == m_Map.GetMapSizeX())
                {
                    picPosX = 0;
                    picPosY = picPosY + 1;
                }
                break;
            }
            case McWall:
            {
                QGraphicsPixmapItem* Wall = m_Scene->addPixmap(QPixmap("../player/wall.png"));
                Wall->setPos(picSize*picPosX, picSize*picPosY);
                Wall->scale(Size, Size);
                picPosX = picPosX + 1;
                if(picPosX==m_Map.GetMapSizeX())
                {
                    picPosX = 0;
                    picPosY = picPosY + 1;
                }
                break;
            }
            case McHill:
            {
                QGraphicsPixmapItem* Hill = m_Scene->addPixmap(QPixmap("../player/hill.png"));
                Hill->setPos(picSize * picPosX, picSize * picPosY);
                picPosX = picPosX + 1;
                Hill->scale(Size, Size);
                if(picPosX == m_Map.GetMapSizeX())
                {
                    picPosX = 0;
                    picPosY = picPosY + 1;
                }
                break;
            }
            case McGround:
            {
                // сделал траву фоном (строка 43)
                // QGraphicsPixmapItem* Ground = m_Scene->addPixmap(QPixmap("../player/ground.jpg"));
                //  Ground->setPos(picSize * picPosX, picSize * picPosY);
                picPosX = picPosX + 1;
                if(picPosX == m_Map.GetMapSizeX())
                {
                    picPosX = 0;
                    picPosY = picPosY + 1;
                }
                break;
            }
            case McFood:
            {
                QGraphicsPixmapItem*  Food = m_Scene->addPixmap(QPixmap("../player/food.png"));
                Food->setPos(picSize * picPosX, picSize * picPosY);
                picPosX = picPosX + 1;
                Food->scale(Size, Size);
                if(picPosX == m_Map.GetMapSizeX())
                {
                    picPosX = 0;
                    picPosY = picPosY + 1;
                }

                break;
            }
            case McStick:
            {
                QGraphicsPixmapItem* Stick = m_Scene->addPixmap(QPixmap("../player/stick.png"));
                Stick->setPos(picSize * picPosX, picSize * picPosY);
                picPosX = picPosX + 1;
                Stick->scale(Size, Size);
                if(picPosX == m_Map.GetMapSizeX())
                {
                    picPosX = 0;
                    picPosY = picPosY + 1;
                }
                break;
            }
            case McStock:
            {
                QGraphicsPixmapItem* Stock = m_Scene->addPixmap(QPixmap("../player/stock.jpeg"));
                Stock->setPos(picSize * picPosX, picSize * picPosY);
                picPosX = picPosX + 1;
                Stock->scale(Size/4, Size/4);
                if(picPosX == m_Map.GetMapSizeX())
                {
                    picPosX = 0;
                    picPosY = picPosY + 1;
                }
                break;
            }

            case McWay:
            {
                QGraphicsPixmapItem* Way = m_Scene->addPixmap(QPixmap("../player/ground.jpg"));
                Way->setPos(picSize * picPosX, picSize * picPosY);
                picPosX = picPosX + 1;
                if(picPosX == m_Map.GetMapSizeX())
                {
                    picPosX = 0;
                    picPosY = picPosY + 1;
                }
                break;
            }

            case McError:
            {
                QGraphicsPixmapItem* Error = m_Scene->addPixmap(QPixmap("../player/unknown.png"));
                Error->setPos(picSize * picPosX, picSize * picPosY);
                picPosX = picPosX + 1;
                if(picPosX == m_Map.GetMapSizeX())
                {
                    picPosX = 0;
                    picPosY = picPosY + 1;
                }
                break;
            }

            }
        }


    std::stringstream sstream;
    sstream  << "MapSize = "<<m_Map.GetMapSizeX() << "\nGame step = " << m_GameStep;
    QString QStr = QString::fromStdString(sstream.str());
    QGraphicsTextItem* Size_of_Map = m_Scene->addText(QStr);
    Size_of_Map->setPos((m_Map.GetMapSizeX()+1)*picSize, 1);



    // перерисовываем окно вывода
    repaint();

}
Beispiel #2
0
void GLWidget::setDisplayTexture(GLuint texture)
{
    m_displayTexture = texture;
    repaint();
}
Beispiel #3
0
void GLWidget::setTransparencyGrid(TRANSPARENCYGRID_TYPE type)
{
    m_transparencyGridType = type;
    repaint();
}
Beispiel #4
0
void FieldViewerPainter::handleZoomOut()
{
    scaleFactor -= .1;
    repaint();
}
Beispiel #5
0
void FieldViewerPainter::paintOfflineLocationAction(bool state) {

    shouldPaintLocationOffline = state;
    repaint();
}
Beispiel #6
0
void GcWindow::setSubTitle(QString x)
{
    _subtitle = x;
    emit subtitleChanged(_title);
    repaint();
}
Beispiel #7
0
void
StatsGauge::setPercentage( float percentage )
{
    m_percentage = percentage;
    repaint();
}
void NMainFrameWidget::dynamicPosChanged(int val) {

    currentVoice_->getCurrentElement()->dynamic_ = val;
    repaint();
    
}
Beispiel #9
0
void SearchLineEdit::setMessageVisible( bool on )
{
    message = on;
    repaint();
    return;
}
Beispiel #10
0
Datei: much.c Projekt: gabc/much
int
main(int argc, char **argv)
{
        FILE *fp;
        FILE *in;

        if(argc == 2){
                fp = fopen(argv[1], "r");
                in = stdin;
        } else {
                fp = stdin;
                in = fopen("/dev/tty", "r");
        }
        if(!fp || !in)
                err(1, "Cannot open files");


        signal(SIGINT, finish);

        (void) initscr();
        (void) keypad(stdscr, TRUE);
        (void) nonl();
        (void) cbreak();
        (void) noecho();

        (void) read_file(fp);

        v_end = LINES;
        (void) repaint();

	lastreg = malloc(80 * sizeof(char*));
	if(!lastreg)
		err(1, "can't lastreg");

        for(;;){
                int c = getch();
                switch(c){
                case 'j':
                        godown();
                        break;
                case 'k':
                        goup();
                        break;
                case '<':
                        gostart();
                        break;
                case '>':
                        goend();
                        break;
                case 'q':
                        finish(0);
                        break;
		case KEY_NPAGE:
		case ' ':
			downpage();
			break;
		case KEY_PPAGE:
		case KEY_BACKSPACE:
			uppage();
			break;
		case '/':
			dosearch();
			break;
		case '?':
			dobacksearch();
			break;
		case 12: /* ^L */
			repaint();
			break;
                }
        }
}
void NMainFrameWidget::dynamicSwitch() {

    currentVoice_->getCurrentElement()->dynamicAlign_ = this->dynamicAlignment_->isChecked();
    repaint();

}
Beispiel #12
0
void Hruler::mouseMoveEvent(QMouseEvent *m)
{
	if (m_doc->isLoading())
		return;
	if (textEditMode)
	{
		double ColWidth = (textWidth() - ColGap * (Cols - 1)) / Cols;
		int ColEnd, ColStart;
		double oldInd;
		if (RulerCode == rc_leftFrameDist || RulerCode == rc_rightFrameDist)
		{
			ColStart = 0; //textPosToLocal(0);
			ColEnd   = width(); //textPosToLocal(textWidth());
		}
		else
		{
			ColStart = textPosToLocal((ColWidth+ColGap)*(ActCol-1));
			ColEnd   = textPosToLocal((ColWidth+ColGap)*(ActCol-1) + ColWidth);
		}
		if ((Mpressed) && (m->y() < height()) && (m->y() > 0) && (m->x() > ColStart - m_doc->guidesPrefs().grabRadius) && (m->x() < ColEnd + m_doc->guidesPrefs().grabRadius))
		{
			qApp->changeOverrideCursor(QCursor(Qt::SizeHorCursor));
			double toplimit = textWidth() + RExtra - (ColGap * (Cols - 1))-1;
			double toplimit2 = textWidth() + Extra - (ColGap * (Cols - 1))-1;
			switch (RulerCode)
			{
				case rc_leftFrameDist:
					Extra -= (MouseX - m->x()) / Scaling;
					if (Extra < 0)
						Extra = 0;
					if (Extra > toplimit2)
						Extra = toplimit2;
					emit MarkerMoved(currItem->xPos(), textBase()-currItem->xPos());
					repaint();
					break;
				case rc_rightFrameDist:
					RExtra += (MouseX - m->x()) / Scaling;
					if (RExtra < 0)
						RExtra = 0;
					if (RExtra > toplimit)
						RExtra = toplimit;
					emit MarkerMoved(textBase(), toplimit -RExtra);
					repaint();
					break;
				case rc_indentFirst:
					First -= (MouseX - m->x()) / Scaling;
					if (First+Indent < 0)
						First = -Indent;
					if (First+Indent > ColWidth)
						First  = ColWidth-Indent;
					emit MarkerMoved(textBase(), First+Indent);
					repaint();
					break;
				case rc_leftMargin:
					oldInd = Indent+First;
					Indent -= (MouseX - m->x()) / Scaling;
					if (Indent < 0)
						Indent = 0;
					if (Indent > ColWidth-1)
						Indent  = ColWidth-1;
					First = oldInd - Indent;
					emit MarkerMoved(textBase(), Indent);
					repaint();
					break;
				case rc_rightMargin:
					RMargin -= (MouseX - m->x()) / Scaling;
					if (RMargin < 0)
						RMargin = 0;
					if (RMargin > ColWidth-1)
						RMargin  = ColWidth-1;
					emit MarkerMoved(textBase(), RMargin);
					repaint();
					break;
				case rc_tab:
					TabValues[ActTab].tabPosition -= (MouseX - m->x()) / Scaling;
					if (TabValues[ActTab].tabPosition < 0)
						TabValues[ActTab].tabPosition = 0;
					if (TabValues[ActTab].tabPosition > ColWidth-1)
						TabValues[ActTab].tabPosition  = ColWidth-1;
					emit MarkerMoved(textBase(), TabValues[ActTab].tabPosition);
					UpdateTabList();
					repaint();
					break;
				default:
					break;
			}
			MouseX = m->x();
/*			if (RulerCode != rc_none)
			{
				QPoint py = m_view->viewport()->mapFromGlobal(m->globalPos());
				QPainter p;
				p.begin(m_view->viewport());
				p.setCompositionMode(QPainter::CompositionMode_Xor);
				p.setPen(QPen(Qt::white, 1, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
				QPoint out = m_view->contentsToViewport(QPoint(0, qRound(m_doc->currentPage()->yOffset() * Scaling)));
				p.drawLine(Markp, out.y(), Markp, out.y()+qRound(m_doc->currentPage()->height() * Scaling));
				p.drawLine(py.x(), out.y(), py.x(), out.y()+qRound(m_doc->currentPage()->height() * Scaling));
				p.end(); 
				Markp = py.x();
			}*/
			return;
		}
		if ((!Mpressed) && (m->y() < height()) && (m->y() > 0) && (m->x() > ColStart - 2*m_doc->guidesPrefs().grabRadius) && (m->x() < ColEnd + 2*m_doc->guidesPrefs().grabRadius))
		{
			setCursor(IconManager::instance()->loadCursor("tab.png", 3));
			switch(findRulerHandle(m->pos(), m_doc->guidesPrefs().grabRadius))
			{
				case rc_leftFrameDist: 
					setCursor(QCursor(Qt::SplitHCursor));
					break;
				case rc_rightFrameDist:
					setCursor(QCursor(Qt::SplitHCursor));
					break;
				case rc_indentFirst:
					setCursor(QCursor(Qt::SizeHorCursor));
					break;
				case rc_leftMargin:
					setCursor(QCursor(Qt::SizeHorCursor));
					break;
				case rc_rightMargin:
					setCursor(QCursor(Qt::SizeHorCursor));
					break;
				case rc_tab:
					setCursor(QCursor(Qt::SizeHorCursor));
					break;
			}
			Draw(m->x());
			double marker = localToTextPos(m->x());
			emit MarkerMoved(textBase(), marker);
			return;
		}
		if ((Mpressed) && (RulerCode == rc_tab) && ((m->y() > height()) || (m->y() < 0)))
		{
			setCursor(IconManager::instance()->loadCursor("DelPoint.png", 1, 1));
			return;
		}
		setCursor(QCursor(Qt::ArrowCursor));
	}
	else
	{
		if (Mpressed)
		{
			rulerGesture->mouseMoveEvent(m);
		}
		else
			setCursor(QCursor(Qt::ArrowCursor));
	}
}
Beispiel #13
0
void KPathPointTypeCommand::redo()
{
    QUndoCommand::redo();
    repaint(false);
    m_additionalPointData.clear();

    QList<PointData>::iterator it(m_oldPointData.begin());
    for (; it != m_oldPointData.end(); ++it) {
        KPathPoint *point = it->m_pointData.pathShape->pointByIndex(it->m_pointData.pointIndex);
        KPathPoint::PointProperties properties = point->properties();

        switch (m_pointType) {
        case Line: {
            point->removeControlPoint1();
            point->removeControlPoint2();
            break;
        }
        case Curve: {
            KoPathPointIndex pointIndex = it->m_pointData.pointIndex;
            KoPathPointIndex prevIndex;
            KoPathPointIndex nextIndex;
            KPathShape * path = it->m_pointData.pathShape;
            // get previous path node
            if (pointIndex.second > 0)
                prevIndex = KoPathPointIndex(pointIndex.first, pointIndex.second - 1);
            else if (pointIndex.second == 0 && path->isClosedSubpath(pointIndex.first))
                prevIndex = KoPathPointIndex(pointIndex.first, path->subpathPointCount(pointIndex.first) - 1);
            // get next node
            if (pointIndex.second < path->subpathPointCount(pointIndex.first) - 1)
                nextIndex = KoPathPointIndex(pointIndex.first, pointIndex.second + 1);
            else if (pointIndex.second < path->subpathPointCount(pointIndex.first) - 1
                     && path->isClosedSubpath(pointIndex.first))
                nextIndex = KoPathPointIndex(pointIndex.first, 0);

            KPathPoint * prevPoint = path->pointByIndex(prevIndex);
            KPathPoint * nextPoint = path->pointByIndex(nextIndex);

            if (prevPoint && ! point->activeControlPoint1() && appendPointData(KPathPointData(path, prevIndex))) {
                KPathSegment cubic = KPathSegment(prevPoint, point).toCubic();
                if (prevPoint->activeControlPoint2()) {
                    prevPoint->setControlPoint2(cubic.first()->controlPoint2());
                    point->setControlPoint1(cubic.second()->controlPoint1());
                } else
                    point->setControlPoint1(cubic.second()->controlPoint1());
            }
            if (nextPoint && ! point->activeControlPoint2() && appendPointData(KPathPointData(path, nextIndex))) {
                KPathSegment cubic = KPathSegment(point, nextPoint).toCubic();
                if (nextPoint->activeControlPoint1()) {
                    point->setControlPoint2(cubic.first()->controlPoint2());
                    nextPoint->setControlPoint1(cubic.second()->controlPoint1());
                } else
                    point->setControlPoint2(cubic.first()->controlPoint2());
            }
            break;
        }
        case Symmetric: {
            properties &= ~KPathPoint::IsSmooth;
            properties |= KPathPoint::IsSymmetric;

            // calculate vector from node point to first control point and normalize it
            QPointF directionC1 = point->controlPoint1() - point->point();
            qreal dirLengthC1 = sqrt(directionC1.x() * directionC1.x() + directionC1.y() * directionC1.y());
            directionC1 /= dirLengthC1;
            // calculate vector from node point to second control point and normalize it
            QPointF directionC2 = point->controlPoint2() - point->point();
            qreal dirLengthC2 = sqrt(directionC2.x() * directionC2.x() + directionC2.y() * directionC2.y());
            directionC2 /= dirLengthC2;
            // calculate the average distance of the control points to the node point
            qreal averageLength = 0.5 * (dirLengthC1 + dirLengthC2);
            // compute position of the control points so that they lie on a line going through the node point
            // the new distance of the control points is the average distance to the node point
            point->setControlPoint1(point->point() + 0.5 * averageLength * (directionC1 - directionC2));
            point->setControlPoint2(point->point() + 0.5 * averageLength * (directionC2 - directionC1));
        }
        break;
        case Smooth: {
            properties &= ~KPathPoint::IsSymmetric;
            properties |= KPathPoint::IsSmooth;

            // calculate vector from node point to first control point and normalize it
            QPointF directionC1 = point->controlPoint1() - point->point();
            qreal dirLengthC1 = sqrt(directionC1.x() * directionC1.x() + directionC1.y() * directionC1.y());
            directionC1 /= dirLengthC1;
            // calculate vector from node point to second control point and normalize it
            QPointF directionC2 = point->controlPoint2() - point->point();
            qreal dirLengthC2 = sqrt(directionC2.x() * directionC2.x() + directionC2.y() * directionC2.y());
            directionC2 /= dirLengthC2;
            // compute position of the control points so that they lie on a line going through the node point
            // the new distance of the control points is the average distance to the node point
            point->setControlPoint1(point->point() + 0.5 * dirLengthC1 * (directionC1 - directionC2));
            point->setControlPoint2(point->point() + 0.5 * dirLengthC2 * (directionC2 - directionC1));
        }
        break;
        case Corner:
        default:
            properties &= ~KPathPoint::IsSymmetric;
            properties &= ~KPathPoint::IsSmooth;
            break;
        }
        point->setProperties(properties);
    }
    repaint(true);
}
Beispiel #14
0
void WFormWidget::propagateSetEnabled(bool enabled)
{
  flags_.set(BIT_ENABLED_CHANGED);
  repaint();
  WInteractWidget::propagateSetEnabled(enabled);
}
Beispiel #15
0
void GameBoard::timerEvent(QTimerEvent *event)
{
    movementMario();
    removeDestroyed();
    repaint();
}
Beispiel #16
0
void HoldLine::timerEvent(QTimerEvent *event){
   if(event->timerId() == timeridProt){
      if(!protect->isDestroyed()){
          if(XLOC == 38) protect->setPositive(true);
          else if(XLOC == -38) protect->setPositive(false);

          if(protect->getPositive()) XLOC -= 2;
          else if(!protect->getPositive()) XLOC+=2;
    
          protect->calculatePosition(prot->getRect().left(),prot->getRect().top()+10, XLOC);
          protect->move();
          checkCollision();
      }

      if(moving){
         prot->move();
         checkCollision();
      }

   }

   if(event->timerId() == timeridShoot){
      EnemyObject* a;
      int indexBullet = 0;

      if(bulletList[0]->isDestroyed()){
          for(int i = 0; i < enemyList.size(); i++){
              a = dynamic_cast <Enemy2*> (enemyList[i]);

              if(a != NULL && !enemyList[i]->isDestroyed()){
                 bulletList[indexBullet]->setDestroyed(false);
                 bulletList[indexBullet]->resetState(enemyList[i]->getRect().left(),enemyList[i]->getRect().top());
                 bulletList[indexBullet]->setlastLocation(enemyList[i]->getRect().left(),enemyList[i]->getRect().top());
                 bulletList[indexBullet]->determineDirection(prot->getRect().left(),prot->getRect().top());
                 indexBullet++;
              }
          }
      }
   } 

   if(event->timerId() == timeridShoot2){
      EnemyObject *g;
      int indexBullet = 3;

      if(bulletList[3]->isDestroyed()){
          for(int i = 0; i < enemyList.size(); i++){
	      g = dynamic_cast <Enemy3*> (enemyList[i]);

              if(g != NULL && !enemyList[i]->isDestroyed()){
                 bulletList[indexBullet]->setDestroyed(false);
                 bulletList[indexBullet]->resetState(enemyList[i]->getRect().left(),enemyList[i]->getRect().top());
                 indexBullet++;
              }
           }
       }
    }

   if(event->timerId() == timeridskBullet){
      EnemyBullet* c;

      for(int i = 0; i < bulletList.size(); i++){
          c = dynamic_cast <SeekerBullet*> (bulletList[i]);

          if(c != NULL){
              bulletList[i]->setlastLocation(bulletList[i]->getRect().left(),bulletList[i]->getRect().top());
              bulletList[i]->determineDirection(prot->getRect().left(),prot->getRect().top());
              bulletList[i]->move();
          }
      }

   }

   if(event->timerId() == timeridDisappear){
      EnemyObject* d;

      for(int i = 0; i < enemyList.size(); i++){
              d = dynamic_cast <Enemy3*> (enemyList[i]);

              if(d != NULL){
                  enemyList[i]->resetState();
              }
      }

   }


   if(event->timerId() == timeridEnemy){
     for(int i = 0; i < enemyList.size(); i++)
        enemyList[i]->move();
     checkCollision(); 
     checkCrossLine();
   }

   if(event->timerId() == timeridArrow){
     for(int i = 0; i < arrowList.size(); i++)
        arrowList[i]->move();
     checkCollision();

     for(int i = 0; i < arrowList.size(); i++){
         if(!arrowList[i]->isDestroyed())
            break;

         if(i == arrowList.size()-1){
             if(arrowList.size() != 8){
                deleteArrows();
                arrowList.resize(0);
                createArrows(8);
                arrowCount = 0;
             }
         }
     }
   }

   if(event->timerId() == timeridItem){
       protectItem->setDestroyed(true);
       killTimer(timeridItem);
   }

   if(event->timerId() == timeridInvincible){
      protect->setDestroyed(true);
      killTimer(timeridInvincible);
   }

  if(event->timerId() == timeridBullet){
      EnemyBullet* e;

      for(int i = 0; i < bulletList.size(); i++){

         e = dynamic_cast <Bullet*> (bulletList[i]);

         if(e != NULL)
            bulletList[i]->move();
      }
   }

   if(event->timerId() == timeridAnimation)
       repaint();
}
Beispiel #17
0
void MidiPad::setColour(const juce::Colour &colour) {
    bgColour = colour;
	repaint();
}
Beispiel #18
0
void HoldLine::stopGame(){
      killTimers();
      gameOver = true;
      gameStarted = false;
      repaint();
}
Beispiel #19
0
void
StatsGauge::setText( const QString& text )
{
    m_text = text;
    repaint();
}
void DBoxFE_Splash::animate() {
  state = (( state + 1 ) % ( 2 * progress_bar_size - 1 ) );
  repaint();
}
Beispiel #21
0
void FieldViewerPainter::handleZoomIn()
{
    scaleFactor += .1;
    repaint();
}
Beispiel #22
0
void AssassinWar::initRepainter()
{
    m_pRepaintTimer = new QTimer(this);
    connect(m_pRepaintTimer, SIGNAL(timeout()), this, SLOT(repaint()));
    m_pRepaintTimer->start(200);
}
Beispiel #23
0
void FieldViewerPainter::paintOfflineParticleAction(bool state) {

    shouldPaintParticlesOffline = state;
    repaint();
}
Beispiel #24
0
// initialize the sky object and connect it into our scene graph
ssgBranch * cGrSkyDome::build( double hscale, double vscale )
{
  sgVec4 color;
  double theta;
  int i;

  // clean-up previous
  ssgDeRefDelete( dome_transform );

  // create new
  dome_transform = new ssgTransform;
  dome_transform->ref();

  // set up the state
  dome_state = new ssgSimpleState();
  dome_state->setShadeModel( GL_SMOOTH );
  dome_state->disable( GL_LIGHTING );
  dome_state->disable( GL_CULL_FACE );
  dome_state->disable( GL_TEXTURE_2D );
  dome_state->enable( GL_COLOR_MATERIAL );
  dome_state->setColourMaterial( GL_AMBIENT_AND_DIFFUSE );
  dome_state->setMaterial( GL_EMISSION, 0, 0, 0, 1 );
  dome_state->setMaterial( GL_SPECULAR, 0, 0, 0, 1 );
  dome_state->disable( GL_BLEND );
  dome_state->disable( GL_ALPHA_TEST );

  // initialize arrays
  center_disk_vl = new ssgVertexArray( 14 );
  center_disk_cl = new ssgColourArray( 14 );

  upper_ring_vl = new ssgVertexArray( 26 );
  upper_ring_cl = new ssgColourArray( 26 );

  middle_ring_vl = new ssgVertexArray( 26 );
  middle_ring_cl = new ssgColourArray( 26 );

  lower_ring_vl = new ssgVertexArray( 26 );
  lower_ring_cl = new ssgColourArray( 26 );

  // initially seed to all blue
  sgSetVec4( color, 0.0, 0.0, 1.0, 1.0 );

  // generate the raw vertex data
  sgVec3 center_vertex;
  sgVec3 upper_vertex[12];
  sgVec3 middle_vertex[12];
  sgVec3 lower_vertex[12];
  sgVec3 bottom_vertex[12];

  sgSetVec3( center_vertex, 0.0, 0.0, (float)(center_elev * vscale));

  for ( i = 0; i < 12; i++ ) 
  {
    theta = (i * 30.0) * SGD_DEGREES_TO_RADIANS;

    sgSetVec3( upper_vertex[i],
      (float)(cos(theta) * upper_radius * hscale),
      (float)(sin(theta) * upper_radius * hscale),
      (float)(upper_elev * vscale));

    sgSetVec3( middle_vertex[i],
      (float)(cos(theta) * middle_radius * hscale),
      (float)(sin(theta) * middle_radius * hscale),
      (float)(middle_elev * vscale));

    sgSetVec3( lower_vertex[i],
      (float)(cos(theta) * lower_radius * hscale),
      (float)(sin(theta) * lower_radius * hscale),
      (float)(lower_elev * vscale));

    sgSetVec3( bottom_vertex[i],
      (float)(cos(theta) * bottom_radius * hscale),
      (float)(sin(theta) * bottom_radius * hscale),
      (float)(bottom_elev * vscale));
  }

  // generate the center disk vertex/color arrays
  center_disk_vl->add( center_vertex );
  center_disk_cl->add( color );
  for ( i = 11; i >= 0; i-- ) 
  {
    center_disk_vl->add( upper_vertex[i] );
    center_disk_cl->add( color );
  }
  center_disk_vl->add( upper_vertex[11] );
  center_disk_cl->add( color );

  // generate the upper ring
  for ( i = 0; i < 12; i++ ) 
  {
    upper_ring_vl->add( middle_vertex[i] );
    upper_ring_cl->add( color );

    upper_ring_vl->add( upper_vertex[i] );
    upper_ring_cl->add( color );
  }
  upper_ring_vl->add( middle_vertex[0] );
  upper_ring_cl->add( color );

  upper_ring_vl->add( upper_vertex[0] );
  upper_ring_cl->add( color );

  // generate middle ring
  for ( i = 0; i < 12; i++ ) 
  {
    middle_ring_vl->add( lower_vertex[i] );
    middle_ring_cl->add( color );

    middle_ring_vl->add( middle_vertex[i] );
    middle_ring_cl->add( color );
  }
  middle_ring_vl->add( lower_vertex[0] );
  middle_ring_cl->add( color );

  middle_ring_vl->add( middle_vertex[0] );
  middle_ring_cl->add( color );

  // generate lower ring
  for ( i = 0; i < 12; i++ ) 
  {
    lower_ring_vl->add( bottom_vertex[i] );
    lower_ring_cl->add( color );

    lower_ring_vl->add( lower_vertex[i] );
    lower_ring_cl->add( color );
  }
  lower_ring_vl->add( bottom_vertex[0] );
  lower_ring_cl->add( color );

  lower_ring_vl->add( lower_vertex[0] );
  lower_ring_cl->add( color );

  // force a repaint of the sky colors with ugly defaults
  sgVec3 fog_color;
  sgSetVec3( fog_color, 1.0, 1.0, 1.0 );
  repaint( color, fog_color, 0.0, 5000.0 );

  // build the ssg scene graph sub tree for the sky and connected
  // into the provide scene graph branch
  ssgVtxTable *center_disk, *upper_ring, *middle_ring, *lower_ring;

  center_disk = new ssgVtxTable( GL_TRIANGLE_FAN, 
  center_disk_vl, NULL, NULL, center_disk_cl );

  upper_ring = new ssgVtxTable( GL_TRIANGLE_STRIP, 
  upper_ring_vl, NULL, NULL, upper_ring_cl );

  middle_ring = new ssgVtxTable( GL_TRIANGLE_STRIP, 
  middle_ring_vl, NULL, NULL, middle_ring_cl );

  lower_ring = new ssgVtxTable( GL_TRIANGLE_STRIP, 
  lower_ring_vl, NULL, NULL, lower_ring_cl );

  center_disk->setState( dome_state );
  upper_ring->setState( dome_state );
  middle_ring->setState( dome_state );
  lower_ring->setState( dome_state );

  dome_transform->addKid( center_disk );
  dome_transform->addKid( upper_ring );
  dome_transform->addKid( middle_ring );
  dome_transform->addKid( lower_ring );

  // not entirely satisfying.  We are depending here that the first
  // thing we add to a parent is the first drawn
  center_disk->setCallback( SSG_CALLBACK_PREDRAW, grSkyDomePreDraw );
  center_disk->setCallback( SSG_CALLBACK_POSTDRAW, grSkyDomePostDraw );

  upper_ring->setCallback( SSG_CALLBACK_PREDRAW, grSkyDomePreDraw );
  upper_ring->setCallback( SSG_CALLBACK_POSTDRAW, grSkyDomePostDraw );

  middle_ring->setCallback( SSG_CALLBACK_PREDRAW, grSkyDomePreDraw );
  middle_ring->setCallback( SSG_CALLBACK_POSTDRAW, grSkyDomePostDraw );

  lower_ring->setCallback( SSG_CALLBACK_PREDRAW, grSkyDomePreDraw );
  lower_ring->setCallback( SSG_CALLBACK_POSTDRAW, grSkyDomePostDraw );

  return dome_transform;
}
Beispiel #25
0
void FieldViewerPainter::paintOfflineObsvAction(bool state) {
    shouldPaintObsvOffline = state;
    repaint();
}
Beispiel #26
0
void RenderProgress::animationTimerFired(Timer<RenderProgress>*)
{
    repaint();
    if (!m_animationTimer.isActive() && m_animating)
        m_animationTimer.startOneShot(m_animationRepeatInterval, FROM_HERE);
}
Beispiel #27
0
void GLWidget::setShowTransparency(bool show)
{
    m_showTransparency = show;
    repaint();
}
void DirectShowComponent::recreateNativeWindowAsync()
{
    needToRecreateNativeWindow = true;
    repaint();
}
Beispiel #29
0
void UserTabBar::slotRepaint()
{
    repaint();
}
Beispiel #30
0
void Schedule::setInterval( int weeks ) {
    interval = weeks;
    repaint();
}