Exemple #1
0
static int
test_report_ops(MENU_ARGS)
{
    char *report;
    int row = 3;
    int col = 10;

    vt_move(1,1);
    println("Test of Window reporting.");
    set_tty_raw(TRUE);
    set_tty_echo(FALSE);

    vt_move(row++,1);
    println("Report icon label:");
    vt_move(row, col);
    brc(20, 't'); /* report icon label */
    report = instr();
    row = chrprint2(report, row, col);

    vt_move(row++,1);
    println("Report window label:");
    vt_move(row, col);
    brc(21, 't'); /* report window label */
    report = instr();
    row = chrprint2(report, row, col);

    vt_move(row++,1);
    println("Report size of window (chars):");
    vt_move(row++, col);
    brc(18, 't'); /* report window's text-size */
    report = instr();
    chrprint(report);

    vt_move(row++,1);
    println("Report size of window (pixels):");
    vt_move(row++, col);
    brc(14, 't'); /* report window's pixel-size */
    report = instr();
    chrprint(report);

    vt_move(row++,1);
    println("Report position of window (pixels):");
    vt_move(row++, col);
    brc(13, 't'); /* report window's pixel-size */
    report = instr();
    chrprint(report);

    vt_move(row++,1);
    println("Report state of window (normal/iconified):");
    vt_move(row, col);
    brc(11, 't'); /* report window's pixel-size */
    report = instr();
    chrprint(report);

    vt_move(20,1);
    restore_ttymodes();
    return MENU_HOLD;
}
Exemple #2
0
QGeoBoundingBox QGeoTiledMapObjectInfo::boundingBox() const
{
    if (!graphicsItem || !tiledMapData)
        return QGeoBoundingBox();

    QGeoMapObjectEngine *e = tiledMapDataPrivate->oe;

    QGeoMapObject *object = mapObject();

    e->updateTransforms();

    if (e->latLonExact.contains(object)) {
        QList<QGraphicsItem*> items = e->latLonExact.values(object);
        QGeoBoundingBox box;
        foreach (QGraphicsItem *item, items) {
            QRectF latLonBounds = item->boundingRect();
            QPointF topLeft = latLonBounds.bottomLeft();
            if (topLeft.x() >= 180.0 * 3600.0)
                topLeft.setX(topLeft.x() - 360.0 * 3600.0);
            if (topLeft.x() < -180.0 * 3600.0)
                topLeft.setX(topLeft.x() + 360.0 * 3600.0);

            QPointF bottomRight = latLonBounds.topRight();
            if (bottomRight.x() >= 180.0 * 3600.0)
                bottomRight.setX(bottomRight.x() - 360.0 * 3600.0);
            if (bottomRight.x() < -180.0 * 3600.0)
                bottomRight.setX(bottomRight.x() + 360.0 * 3600.0);

            QGeoCoordinate tlc(topLeft.y() / 3600.0, topLeft.x() / 3600.0);
            QGeoCoordinate brc(bottomRight.y() / 3600.0, bottomRight.x() / 3600.0);

            return QGeoBoundingBox(tlc, brc);

            // it looks like the following is overkill
//            if (box.isValid()) {
//                box |= QGeoBoundingBox(tlc, brc);
//            } else {
//                box = QGeoBoundingBox(tlc, brc);
//            }
        }
Exemple #3
0
static int
test_modify_ops(MENU_ARGS)
{
    int n;
    int wide, high;
    char temp[100];

    vt_move(1,1);
    println("Test of Window modifying.");

    brc(2, 't'); /* iconify window */
    println("Iconify");
    fflush(stdout);
    sleep(2);

    brc(1, 't'); /* de-iconify window */
    println("De-Iconify");
    fflush(stdout);
    sleep(1);

    ed(2);
    for (n = 0; n <= 200; n += 5) {
        sprintf(temp, "Position (%d,%d)", n, n*2);
        println(temp);
        esc("K"); /* Erase to end of line */
        brc3(3, n, n*2, 't');
        fflush(stdout);
    }
    holdit();

    ed(2);
    brc3(3, 0, 0, 't');

    for (n = 0; n <= 200; n += 10) {
        wide = n+20;
        high = n+50;
        brc3(4, high, wide, 't');
        sprintf(temp, "%d x %d pixels", high, wide);
        println(temp);
        fflush(stdout);
    }
    holdit();

    ed(2);
    for (n = 0; n <= 200; n += 10) {
        high = n+50;
        brc3(4, high, 0, 't');
        sprintf(temp, "%d x (screen-width) pixels", high);
        println(temp);
        fflush(stdout);
    }
    holdit();

    ed(2);
    for (n = 0; n <= 300; n += 10) {
        wide = n+50;
        brc3(4, 0, wide, 't');
        sprintf(temp, "(screen-height) x %d pixels", wide);
        println(temp);
        fflush(stdout);
    }
    holdit();

    while (n >= 200) {
        wide = n+50;
        high = 500 - n;
        brc3(4, high, wide, 't');
        sprintf(temp, "%d x %d pixels", high, wide);
        println(temp);
        fflush(stdout);
        n -= 5;
    }
    holdit();

    while (n <= 300) {
        wide = n+50;
        high = 500 - n;
        brc3(4, high, wide, 't');
        sprintf(temp, "%d x %d pixels", high, wide);
        println(temp);
        fflush(stdout);
        n += 5;
    }
    holdit();

    ed(2);
    for (n = 5; n <= 20; n++) {
        wide = n*4;
        high = n+5;
        brc3(8, high, wide, 't');
        sprintf(temp, "%d x %d chars", high, wide);
        while ((int)strlen(temp) < wide - 1)
            strcat(temp, ".");
        println(temp);
        fflush(stdout);
    }
    holdit();

    ed(2);
    for (n = 5; n <= 24; n++) {
        high = n;
        brc3(8, high, 0, 't');
        sprintf(temp, "%d x (screen-width) chars", high);
        println(temp);
        fflush(stdout);
    }
    holdit();

    ed(2);
    for (n = 5; n <= 80; n++) {
        wide = n;
        brc3(8, 0, wide, 't');
        sprintf(temp, "(screen-height) x %d chars", wide);
        println(temp);
        fflush(stdout);
    }
    holdit();

    brc3(3, 200, 200, 't');
    brc3(8, 24, 80, 't');
    println("Reset to 24 x 80");

    ed(2);
    println("Lower");
    brc(6, 't');
    holdit();

    ed(2);
    println("Raise");
    brc(5, 't');
    return MENU_HOLD;
}