Пример #1
0
void DisasmWidget::highlightCurrentLine() {
    if(cursor_state == true) {
        extraHighlights.removeLast();
        addHighlight(QColor(Qt::yellow).lighter(160));
        updateAllHighlights();
    }
}
Пример #2
0
void DataWidget::highlightCurrentLine() {
    if (moveable) {
        if (!highlights.isEmpty()) {
            highlights.removeLast();
        }
        addHighlight(QColor(Qt::yellow).lighter(160));
        setExtraSelections(highlights);
        if (QApplication::keyboardModifiers().testFlag(Qt::ControlModifier)) {
            bool ok = true;

            QTextCursor cursor = textCursor();
            cursor.select(QTextCursor::WordUnderCursor);
            if (cursor.selectedText().isEmpty()) {
                return;
            }

            QString weird(QStringLiteral("[]()\",./\\-="));

            if (weird.contains(cursor.selectedText().at(0))) {
                cursor.movePosition(QTextCursor::WordLeft);
                cursor.movePosition(QTextCursor::WordLeft);
                cursor.select(QTextCursor::WordUnderCursor);
            }
            setTextCursor(cursor);

            QString equ = getAddressOfEquate(cursor.selectedText().toUpper().toStdString());
            uint32_t address;

            if (!equ.isEmpty()) {
                address = hex2int(equ);
            } else {
                address = textCursor().selectedText().toUInt(&ok, 16);
            }

            if (ok) {
                if (QApplication::keyboardModifiers().testFlag(Qt::ShiftModifier)) {
                    emit gotoMemoryAddress(address);
                } else {
                    emit gotoDisasmAddress(address);
                }
            }
        }
    }
}
Пример #3
0
void DataWidget::cursorState(bool state) {
    moveable = state;
    if (moveable) {
        addHighlight(QColor(Qt::yellow).lighter(160));
    }
}
Пример #4
0
/**
 * Main Application.  Currently, drawing styles are hardcoded in this method.
 * Future work may entail reading the styles from a .properties file.
 */
int main( int argc, const char* argv[] )
{
	FILE *pfile;
	LWGEOM *lwgeom;
	char line [2048];
	char *filename;
	int layerCount;
	int styleNumber;
	LAYERSTYLE *styles;

	getStyles(&styles);

	if ( argc != 2 )
	{
		lwerror("You must specifiy a wkt filename to convert.\n");
		return -1;
	}

	if ( (pfile = fopen(argv[1], "r")) == NULL)
	{
		perror ( argv[1] );
		return -1;
	}

	filename = malloc( strlen(argv[1])+11 );
	strncpy( filename, "../images/", 10 );
	strncat( filename, argv[1], strlen(argv[1])-3 );
	strncat( filename, "png", 3 );

	printf( "generating %s\n", filename );

	layerCount = 0;
	while ( fgets ( line, sizeof line, pfile ) != NULL && !isspace(*line) )
	{

		char output[2048];
		char *ptr = output;
		char *styleName;
		int useDefaultStyle;

		ptr += sprintf( ptr, "convert -size %s xc:none ", imageSize );

		useDefaultStyle = getStyleName(&styleName, line);
		LWDEBUGF( 4, "%s", styleName );

		if (useDefaultStyle)
		{
			printf("   Warning: using Default style for layer %d\n", layerCount);
			lwgeom = lwgeom_from_ewkt( line, PARSER_CHECK_NONE );
		}
		else
			lwgeom = lwgeom_from_ewkt( line+strlen(styleName)+1, PARSER_CHECK_NONE );
		LWDEBUGF( 4, "geom = %s", lwgeom_to_ewkt((LWGEOM*)lwgeom,0) );

		styleNumber = layerCount % length(styles);
		ptr += drawGeometry( ptr, lwgeom, getStyle(styles, styleName) );

		ptr += sprintf( ptr, "-flip tmp%d.png", layerCount );

		lwfree( lwgeom );

		LWDEBUGF( 4, "%s", output );
		system(output);

		addHighlight( layerCount );
		addDropShadow( layerCount );
		layerCount++;
		free(styleName);
	}

	flattenLayers(filename);
	optimizeImage(filename);

	fclose(pfile);
	free(filename);
	freeStyles(&styles);
	return 0;
}
Пример #5
0
void DisasmWidget::cursorState(bool moveable) {
    cursor_state = moveable;
    if (moveable) {
        addHighlight(QColor(Qt::yellow).lighter(160));
    }
}