コード例 #1
0
void RenderMultiColumnFlowThread::evacuateAndDestroy()
{
    RenderBlockFlow* multicolContainer = multiColumnBlockFlow();
    m_beingEvacuated = true;

    // Delete the line box tree.
    deleteLines();

    LayoutStateDisabler layoutStateDisabler(&view());

    // First promote all children of the flow thread. Before we move them to the flow thread's
    // container, we need to unregister the flow thread, so that they aren't just re-added again to
    // the flow thread that we're trying to empty.
    multicolContainer->setMultiColumnFlowThread(nullptr);
    moveAllChildrenTo(multicolContainer, true);

    // Move spanners back to their original DOM position in the tree, and destroy the placeholders.
    SpannerMap::iterator it;
    while ((it = m_spannerMap.begin()) != m_spannerMap.end()) {
        RenderBox* spanner = it->key;
        RenderMultiColumnSpannerPlaceholder* placeholder = it->value;
        RenderBlockFlow* originalContainer = toRenderBlockFlow(placeholder->parent());
        multicolContainer->removeChild(*spanner);
        originalContainer->addChild(spanner, placeholder);
        placeholder->destroy();
        m_spannerMap.remove(it);
    }

    // Remove all sets.
    while (RenderMultiColumnSet* columnSet = firstMultiColumnSet())
        columnSet->destroy();

    destroy();
}
コード例 #2
0
ファイル: cmd_ed.c プロジェクト: xiajunt/sashExtension
/*
 * Finish editing.
 */
static void
termEdit(void)
{
	if (bufBase)
		free(bufBase);

	bufBase = NULL;
	bufPtr = NULL;
	bufSize = 0;
	bufUsed = 0;

	if (fileName)
		free(fileName);

	fileName = NULL;

	searchString[0] = '\0';

	if (lastNum)
		deleteLines(1, lastNum);

	lastNum = 0;
	curNum = 0;
	curLine = NULL;
}
コード例 #3
0
int TriangulationSidebar::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: drawLine((*reinterpret_cast< QPointF(*)>(_a[1])),(*reinterpret_cast< QPointF(*)>(_a[2]))); break;
        case 1: intersectLines(); break;
        case 2: selectPoint((*reinterpret_cast< QPointF(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break;
        case 3: clearSelectedPoints(); break;
        case 4: selectLines((*reinterpret_cast< QList<QPair<QPointF,QPointF> >(*)>(_a[1]))); break;
        case 5: clearSelectedLines(); break;
        case 6: deletePoints(); break;
        case 7: deleteLines(); break;
        case 8: addPoint((*reinterpret_cast< QPointF(*)>(_a[1]))); break;
        case 9: addLine((*reinterpret_cast< QPointF(*)>(_a[1])),(*reinterpret_cast< QPointF(*)>(_a[2]))); break;
        case 10: addLandmark((*reinterpret_cast< QPointF(*)>(_a[1]))); break;
        case 11: on_landmarksListWidget_itemSelectionChanged(); break;
        case 12: on_deleteLines_clicked(); break;
        case 13: on_deletePoints_clicked(); break;
        case 14: on_intersectLinesButton_clicked(); break;
        case 15: on_linesListWidget_itemSelectionChanged(); break;
        case 16: on_drawLinesButton_clicked(); break;
        case 17: on_pointsListWidget_itemSelectionChanged(); break;
        case 18: recalculateDistanceAltitiude(); break;
        case 19: newBarometerData((*reinterpret_cast< ushort(*)>(_a[1])),(*reinterpret_cast< ulong(*)>(_a[2]))); break;
        case 20: newAccelerometerData((*reinterpret_cast< short(*)>(_a[1])),(*reinterpret_cast< short(*)>(_a[2])),(*reinterpret_cast< short(*)>(_a[3]))); break;
        case 21: newRobotElevation((*reinterpret_cast< double(*)>(_a[1])),(*reinterpret_cast< double(*)>(_a[2]))); break;
        default: ;
        }
        _id -= 22;
    }
    return _id;
}
コード例 #4
0
ファイル: NavigationWidget.cpp プロジェクト: StephenCEI/2011
NavigationWidget::NavigationWidget(QWidget *parent) :
		QWidget(parent)
{
	setupUi(this);

        //navView = new NavigationView(this);
        //verticalLayout->insertWidget(0, navView);
	connect(navView, SIGNAL(mouseAtGeoPos(QPointF)), this, SLOT(displayCoordinates(QPointF)));

	triangulationWidget = new TriangulationWidget();
	connect(triangulationButton, SIGNAL(clicked()), triangulationWidget, SLOT(show()));
        connect(connectLineButton, SIGNAL(clicked()), navView, SLOT(plotLineForSelected()));
        connect(markIsectButton, SIGNAL(clicked()), navView, SLOT(plotLineIntersection()));

        connect(requestGPSButton, SIGNAL(clicked()), this, SLOT(sendGPSRequest()));

        connect(RobotController::gpsController(), SIGNAL(gotPositionUpdate(GPSPositionData)), this, SLOT(gotGPSUpdate(GPSPositionData)));

        connect(navView, SIGNAL(newPointAdded(QPointF)), triangulationSidebar, SLOT(addPoint(QPointF)));
        connect(navView, SIGNAL(newLineAdded(QPointF,QPointF)), triangulationSidebar, SLOT(addLine(QPointF,QPointF)));
        connect(navView, SIGNAL(newLandmarkAdded(QPointF)), triangulationSidebar, SLOT(addLandmark(QPointF)));

        connect(triangulationSidebar, SIGNAL(selectPoint(QPointF, bool)), navView, SLOT(selectPoint(QPointF, bool)));
        connect(triangulationSidebar, SIGNAL(clearSelectedPoints()), navView, SLOT(clearSelectedPoints()));

        connect(triangulationSidebar, SIGNAL(drawLine(QPointF,QPointF)), navView, SLOT(plotLineForPoints(QPointF,QPointF)));
        connect(triangulationSidebar, SIGNAL(selectLines(QList<QPair<QPointF,QPointF> >)), navView, SLOT(selectLines(QList<QPair<QPointF,QPointF> >)));
        connect(triangulationSidebar, SIGNAL(clearSelectedLines()), navView, SLOT(clearSelectedLines()));
        connect(triangulationSidebar, SIGNAL(intersectLines()), navView, SLOT(plotLineIntersection()));

        connect(triangulationSidebar, SIGNAL(deleteLines()), navView, SLOT(deleteSelectedLines()));
        connect(triangulationSidebar, SIGNAL(deletePoints()), navView, SLOT(deleteSelectedPoints()));
	
	// Test rover slots
        /*navView->setRoverPosition(QPointF(-110.791497, 38.406392));
	navView->setRoverPosition(QPointF(-110.790889, 38.406158));
	navView->setRoverPosition(QPointF(-110.790469, 38.405850));
	navView->setRoverPosition(QPointF(-110.790257, 38.405575));
	navView->setRoverPosition(QPointF(-110.790161, 38.405359));
	navView->setRoverPosition(QPointF(-110.790177, 38.405195));
	navView->setRoverPosition(QPointF(-110.790037, 38.404941));
        navView->setRoverPosition(QPointF(-110.789840, 38.404890));
	navView->setRoverPosition(QPointF(-110.789420, 38.404986));
	navView->setRoverPosition(QPointF(-110.789219, 38.404973));
        navView->setRoverHeading(92.334915);*/

        //navView->setRoverPosition(QPointF(-123.212968,44.674917)); // adair
        //navView->setRoverPosition(QPointF(-123.274951,44.567328)); // covell parking lot
}
コード例 #5
0
ファイル: RenderRubyRun.cpp プロジェクト: Zirias/webkitfltk
RenderObject* RenderRubyRun::removeChild(RenderObject& child)
{
    // If the child is a ruby text, then merge the ruby base with the base of
    // the right sibling run, if possible.
    if (!beingDestroyed() && !documentBeingDestroyed() && child.isRubyText()) {
        RenderRubyBase* base = rubyBase();
        RenderObject* rightNeighbour = nextSibling();
        if (base && rightNeighbour && rightNeighbour->isRubyRun()) {
            // Ruby run without a base can happen only at the first run.
            RenderRubyRun* rightRun = toRenderRubyRun(rightNeighbour);
            if (rightRun->hasRubyBase()) {
                RenderRubyBase* rightBase = rightRun->rubyBaseSafe();
                // Collect all children in a single base, then swap the bases.
                rightBase->mergeChildrenWithBase(base);
                moveChildTo(rightRun, base);
                rightRun->moveChildTo(this, rightBase);
                // The now empty ruby base will be removed below.
                ASSERT(!rubyBase()->firstChild());
            }
        }
    }

    RenderObject* next = RenderBlockFlow::removeChild(child);

    if (!beingDestroyed() && !documentBeingDestroyed()) {
        // Check if our base (if any) is now empty. If so, destroy it.
        RenderBlock* base = rubyBase();
        if (base && !base->firstChild()) {
            next = RenderBlockFlow::removeChild(*base);
            base->deleteLines();
            base->destroy();
        }

        // If any of the above leaves the run empty, destroy it as well.
        if (isEmpty()) {
            parent()->removeChild(*this);
            deleteLines();
            destroy();
            next = nullptr;
        }
    }
    
    return next;
}
コード例 #6
0
WidgetTableProgression::~WidgetTableProgression() {
    deleteLines();
}
コード例 #7
0
void WidgetTableProgression::updateWithEasing(SystemProgressionTable*
    progression, QChartView *chartView, int finalLevel)
{
    int start = progression->initialValue()->kind() == PrimitiveValueKind
        ::Number ? progression->initialValue()->numberValue() : 0;
    int change = (progression->finalValue()->kind() == PrimitiveValueKind
        ::Number ? progression->finalValue()->numberValue() : 0) - start;
    int duration = finalLevel - 1;
    int value = 0;
    double x;
    bool specificValue;
    QTableWidgetItem *itemLevel, * itemProgression;

    // Chart lines initialization
    deleteLines();
    m_line = new QLineSeries();
    m_horizontalLine = new QLineSeries();
    QVector<QPointF> expList;
    *m_line<< QPointF(0, 0);

    // Update according to equation
    for (int i = 0; i < finalLevel; i++) {
        x = i;
        value = m_table->value(i + 1, -1);
        specificValue = value != -1;
        if (!specificValue) {
            switch (progression->equation()) {
            case 0:
                value = easingLinear(x, start, change, duration); break;
            case -1:
                value = easingQuadraticIn(x, start, change, duration); break;
            case 1:
                value = easingQuadraticOut(x, start, change, duration); break;
            case -2:
                value = easingCubicIn(x, start, change, duration); break;
            case 2:
                value = easingCubicOut(x, start, change, duration); break;
            case -3:
                value = easingQuarticIn(x, start, change, duration); break;
            case 3:
                value = easingQuarticOut(x, start, change, duration); break;
            case -4:
                value = easingQuinticIn(x, start, change, duration); break;
            case 4:
                value = easingQuinticOut(x, start, change, duration); break;
            default:
                value = 0;
            }
        }

        itemLevel = new QTableWidgetItem(QString::number(i + 1));
        itemProgression = new QTableWidgetItem(QString::number(value));
        if (specificValue) {
            itemProgression->setForeground(m_editedColor);
        }

        setItem(i, 0, itemLevel);
        setItem(i, 1, itemProgression);
        *m_line << QPoint(i + 1, value);
    }

    // Chart config
    *m_horizontalLine << QPointF(1, 0) << QPointF(finalLevel, 0);
    QAreaSeries *series = new QAreaSeries(m_line, m_horizontalLine);
    QPen pen(0x4f0a5b);
    pen.setWidth(2);
    series->setPen(pen);
    QLinearGradient gradient(QPointF(0, 0), QPointF(0, 1));
    gradient.setColorAt(0.0, 0x9234a3);
    gradient.setColorAt(1.0, 0x9234a3);
    gradient.setCoordinateMode(QGradient::ObjectBoundingMode);
    series->setBrush(gradient);
    QChart *chart = chartView->chart();
    chart->removeAllSeries();
    chart->addSeries(series);
    chart->createDefaultAxes();
    QValueAxis *axisX = reinterpret_cast<QValueAxis *>(chart->axes(Qt
        ::Horizontal).first());
    QValueAxis *axisY = reinterpret_cast<QValueAxis *>(chart->axes(Qt
        ::Vertical).first());
    axisX->setRange(1, finalLevel);
    axisY->setRange(0, value);
    axisX->setTickCount(5);
    axisX->setLabelFormat("%d");
    axisY->setTickCount(5);
    axisY->setLabelFormat("%d");
    chart->legend()->setVisible(false);
    chartView->setRenderHint(QPainter::Antialiasing);

    m_completing = false;
}
コード例 #8
0
ファイル: ed.c プロジェクト: Crobisaur/busybox
/*
 * Read commands until we are told to stop.
 */
static void doCommands(void)
{
	const char *cp;
	char *endbuf, buf[USERSIZE];
	int len, num1, num2;
	smallint have1, have2;

	while (TRUE) {
		/* Returns:
		 * -1 on read errors or EOF, or on bare Ctrl-D.
		 * 0  on ctrl-C,
		 * >0 length of input string, including terminating '\n'
		 */
		len = read_line_input(NULL, ": ", buf, sizeof(buf), /*timeout*/ -1);
		if (len <= 0)
			return;
		endbuf = &buf[len - 1];
		while ((endbuf > buf) && isblank(endbuf[-1]))
			endbuf--;
		*endbuf = '\0';

		cp = skip_blank(buf);
		have1 = FALSE;
		have2 = FALSE;

		if ((curNum == 0) && (lastNum > 0)) {
			curNum = 1;
			curLine = lines.next;
		}

		if (!getNum(&cp, &have1, &num1))
			continue;

		cp = skip_blank(cp);

		if (*cp == ',') {
			cp++;
			if (!getNum(&cp, &have2, &num2))
				continue;
			if (!have1)
				num1 = 1;
			if (!have2)
				num2 = lastNum;
			have1 = TRUE;
			have2 = TRUE;
		}
		if (!have1)
			num1 = curNum;
		if (!have2)
			num2 = num1;

		switch (*cp++) {
		case 'a':
			addLines(num1 + 1);
			break;

		case 'c':
			deleteLines(num1, num2);
			addLines(num1);
			break;

		case 'd':
			deleteLines(num1, num2);
			break;

		case 'f':
			if (*cp && !isblank(*cp)) {
				bb_error_msg("bad file command");
				break;
			}
			cp = skip_blank(cp);
			if (*cp == '\0') {
				if (fileName)
					printf("\"%s\"\n", fileName);
				else
					puts("No file name");
				break;
			}
			free(fileName);
			fileName = xstrdup(cp);
			break;

		case 'i':
			addLines(num1);
			break;

		case 'k':
			cp = skip_blank(cp);
			if ((*cp < 'a') || (*cp > 'z') || cp[1]) {
				bb_error_msg("bad mark name");
				break;
			}
			marks[*cp - 'a'] = num2;
			break;

		case 'l':
			printLines(num1, num2, TRUE);
			break;

		case 'p':
			printLines(num1, num2, FALSE);
			break;

		case 'q':
			cp = skip_blank(cp);
			if (have1 || *cp) {
				bb_error_msg("bad quit command");
				break;
			}
			if (!dirty)
				return;
			len = read_line_input(NULL, "Really quit? ", buf, 16, /*timeout*/ -1);
			/* read error/EOF - no way to continue */
			if (len < 0)
				return;
			cp = skip_blank(buf);
			if ((*cp | 0x20) == 'y') /* Y or y */
				return;
			break;

		case 'r':
			if (*cp && !isblank(*cp)) {
				bb_error_msg("bad read command");
				break;
			}
			cp = skip_blank(cp);
			if (*cp == '\0') {
				bb_error_msg("no file name");
				break;
			}
			if (!have1)
				num1 = lastNum;
			if (readLines(cp, num1 + 1))
				break;
			if (fileName == NULL)
				fileName = xstrdup(cp);
			break;

		case 's':
			subCommand(cp, num1, num2);
			break;

		case 'w':
			if (*cp && !isblank(*cp)) {
				bb_error_msg("bad write command");
				break;
			}
			cp = skip_blank(cp);
			if (!have1) {
				num1 = 1;
				num2 = lastNum;
			}
			if (*cp == '\0')
				cp = fileName;
			if (cp == NULL) {
				bb_error_msg("no file name specified");
				break;
			}
			writeLines(cp, num1, num2);
			break;

		case 'z':
			switch (*cp) {
			case '-':
				printLines(curNum - 21, curNum, FALSE);
				break;
			case '.':
				printLines(curNum - 11, curNum + 10, FALSE);
				break;
			default:
				printLines(curNum, curNum + 21, FALSE);
				break;
			}
			break;

		case '.':
			if (have1) {
				bb_error_msg("no arguments allowed");
				break;
			}
			printLines(curNum, curNum, FALSE);
			break;

		case '-':
			if (setCurNum(curNum - 1))
				printLines(curNum, curNum, FALSE);
			break;

		case '=':
			printf("%d\n", num1);
			break;
		case '\0':
			if (have1) {
				printLines(num2, num2, FALSE);
				break;
			}
			if (setCurNum(curNum + 1))
				printLines(curNum, curNum, FALSE);
			break;

		default:
			bb_error_msg("unimplemented command");
			break;
		}
	}
}
コード例 #9
0
ファイル: ed.c プロジェクト: AlickHill/Lantern
/*
 * Read commands until we are told to stop.
 */
static void doCommands(void)
{
	const char *cp;
	char *endbuf, *newname, buf[USERSIZE];
	int len, num1, num2, have1, have2;

	while (TRUE) {
		printf(": ");
		fflush(stdout);

		if (fgets(buf, sizeof(buf), stdin) == NULL)
			return;

		len = strlen(buf);

		if (len == 0)
			return;

		endbuf = &buf[len - 1];

		if (*endbuf != '\n') {
			bb_error_msg("command line too long");

			do {
				len = fgetc(stdin);
			} while ((len != EOF) && (len != '\n'));

			continue;
		}

		while ((endbuf > buf) && isblank(endbuf[-1]))
			endbuf--;

		*endbuf = '\0';

		cp = buf;

		while (isblank(*cp))
			cp++;

		have1 = FALSE;
		have2 = FALSE;

		if ((curNum == 0) && (lastNum > 0)) {
			curNum = 1;
			curLine = lines.next;
		}

		if (!getNum(&cp, &have1, &num1))
			continue;

		while (isblank(*cp))
			cp++;

		if (*cp == ',') {
			cp++;

			if (!getNum(&cp, &have2, &num2))
				continue;

			if (!have1)
				num1 = 1;

			if (!have2)
				num2 = lastNum;

			have1 = TRUE;
			have2 = TRUE;
		}

		if (!have1)
			num1 = curNum;

		if (!have2)
			num2 = num1;

		switch (*cp++) {
			case 'a':
				addLines(num1 + 1);
				break;

			case 'c':
				deleteLines(num1, num2);
				addLines(num1);
				break;

			case 'd':
				deleteLines(num1, num2);
				break;

			case 'f':
				if (*cp && !isblank(*cp)) {
					bb_error_msg("bad file command");
					break;
				}

				while (isblank(*cp))
					cp++;

				if (*cp == '\0') {
					if (fileName)
						printf("\"%s\"\n", fileName);
					else
						printf("No file name\n");
					break;
				}

				newname = strdup(cp);

				if (newname == NULL) {
					bb_error_msg("no memory for file name");
					break;
				}

				if (fileName)
					free(fileName);

				fileName = newname;
				break;

			case 'i':
				addLines(num1);
				break;

			case 'k':
				while (isblank(*cp))
					cp++;

				if ((*cp < 'a') || (*cp > 'a') || cp[1]) {
					bb_error_msg("bad mark name");
					break;
				}

				marks[*cp - 'a'] = num2;
				break;

			case 'l':
				printLines(num1, num2, TRUE);
				break;

			case 'p':
				printLines(num1, num2, FALSE);
				break;

			case 'q':
				while (isblank(*cp))
					cp++;

				if (have1 || *cp) {
					bb_error_msg("bad quit command");
					break;
				}

				if (!dirty)
					return;

				printf("Really quit? ");
				fflush(stdout);

				buf[0] = '\0';
				fgets(buf, sizeof(buf), stdin);
				cp = buf;

				while (isblank(*cp))
					cp++;

				if ((*cp == 'y') || (*cp == 'Y'))
					return;

				break;

			case 'r':
				if (*cp && !isblank(*cp)) {
					bb_error_msg("bad read command");
					break;
				}

				while (isblank(*cp))
					cp++;

				if (*cp == '\0') {
					bb_error_msg("no file name");
					break;
				}

				if (!have1)
					num1 = lastNum;

				if (readLines(cp, num1 + 1))
					break;

				if (fileName == NULL)
					fileName = strdup(cp);

				break;

			case 's':
				subCommand(cp, num1, num2);
				break;

			case 'w':
				if (*cp && !isblank(*cp)) {
					bb_error_msg("bad write command");
					break;
				}

				while (isblank(*cp))
					cp++;

				if (!have1) {
					num1 = 1;
					num2 = lastNum;
				}

				if (*cp == '\0')
					cp = fileName;

				if (cp == NULL) {
					bb_error_msg("no file name specified");
					break;
				}

				writeLines(cp, num1, num2);
				break;

			case 'z':
				switch (*cp) {
				case '-':
					printLines(curNum-21, curNum, FALSE);
					break;
				case '.':
					printLines(curNum-11, curNum+10, FALSE);
					break;
				default:
					printLines(curNum, curNum+21, FALSE);
					break;
				}
				break;

			case '.':
				if (have1) {
					bb_error_msg("no arguments allowed");
					break;
				}

				printLines(curNum, curNum, FALSE);
				break;

			case '-':
				if (setCurNum(curNum - 1))
					printLines(curNum, curNum, FALSE);

				break;

			case '=':
				printf("%d\n", num1);
				break;

			case '\0':
				if (have1) {
					printLines(num2, num2, FALSE);
					break;
				}

				if (setCurNum(curNum + 1))
					printLines(curNum, curNum, FALSE);

				break;

			default:
				bb_error_msg("unimplemented command");
				break;
		}
	}
}