Esempio n. 1
0
QHexEdit::QHexEdit(ExecutableViewer *executableViewer, QWidget *parent) : QAbstractScrollArea(parent),
    executableViewer(executableViewer)
{
    _chunks = new Chunks();
    _undoStack = new UndoStack(_chunks, this);
#ifdef Q_OS_WIN32
    setFont(QFont("Courier", 10));
#else
    setFont(QFont("Monospace", 10));
#endif
    setAddressAreaColor(this->palette().alternateBase().color());
    setHighlightingColor(QColor(0xff, 0xff, 0x99, 0xff));
    setSelectionColor(this->palette().highlight().color());

    connect(&_cursorTimer, SIGNAL(timeout()), this, SLOT(updateCursor()));
    connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(adjust()));
    connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(adjust()));
    connect(_undoStack, SIGNAL(indexChanged(int)), this, SLOT(dataChangedPrivate(int)));

    _cursorTimer.setInterval(500);
    _cursorTimer.start();

    setAddressWidth(4);
    setAddressArea(true);
    setAsciiArea(true);
    setOverwriteMode(true);
    setHighlighting(true);
    setReadOnly(false);

    init();

    connect(this, SIGNAL(dataChanged()), executableViewer, SLOT(hexDataChanged()));
}
Esempio n. 2
0
QHexEdit::QHexEdit(QWidget *parent) : QAbstractScrollArea(parent)
{
    _undoStack = new UndoStack(this);
    setFont(QFont(Style::Monospace));
    
    setAddressAreaColor(this->palette().alternateBase().color());
    setHighlightingColor(QColor(0xff, 0xff, 0x99, 0xff));
    setSelectionColor(this->palette().highlight().color());

    connect(&_cursorTimer, SIGNAL(timeout()), this, SLOT(updateCursor()));
    connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(adjust()));
    connect(_undoStack, SIGNAL(indexChanged(int)), this, SLOT(dataChangedPrivate(int)));

    _cursorTimer.setInterval(500);
    _cursorTimer.start();

    setAddressWidth(4);
    setAddressArea(true);
    setAsciiArea(true);
    setHighlighting(true);
    setReadOnly(false);

    init();

}
QHexEdit::QHexEdit(QWidget *parent) : QAbstractScrollArea(parent)
{
    _chunks = new Chunks();
    _undoStack = new UndoStack(_chunks, this);
#ifdef Q_OS_WIN32
    setFont(QFont("Fixedsys", 12));
#else
    setFont(QFont("Monospace", 12));
#endif
    setAddressAreaColor(this->palette().alternateBase().color());
    setHighlightingColor(QColor(0, 0, 0, 0xff));
    setSelectionColor(QColor(0xff, 0xff, 0, 0xff));

    setStyleSheet(QString::fromUtf8("background-color:Black; color:green"));

    connect(&_cursorTimer, SIGNAL(timeout()), this, SLOT(updateCursor()));
    connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(adjust()));
    connect(_undoStack, SIGNAL(indexChanged(int)), this, SLOT(dataChangedPrivate(int)));

    _cursorTimer.setInterval(500);
    _cursorTimer.start();

    setAddressWidth(4);
    setAddressArea(true);
    setAsciiArea(true);
    setOverwriteMode(true);
    setHighlighting(true);
    setReadOnly(false);

    init();

}
Esempio n. 4
0
QHexEditPrivate::QHexEditPrivate(QScrollArea *parent) : QWidget(parent)
{
    _undoStack = new QUndoStack(this);

    _scrollArea = parent;
    setAddressWidth(4);
    setAddressOffset(0);
    setAddressArea(true);
    setAsciiArea(true);
    setHighlighting(true);
    setOverwriteMode(true);
    setReadOnly(false);
    setAddressAreaColor(QColor(0xd4, 0xd4, 0xd4, 0xff));
    setHighlightingColor(QColor(0xff, 0xff, 0x99, 0xff));
    setSelectionColor(QColor(0x6d, 0x9e, 0xff, 0xff));
    setFont(QFont("Courier", 10));

    _size = 0;
    resetSelection(0);

    setFocusPolicy(Qt::StrongFocus);

    connect(&_cursorTimer, SIGNAL(timeout()), this, SLOT(updateCursor()));
    _cursorTimer.setInterval(500);
    _cursorTimer.start();
}
void QgsPalettedRendererWidget::changeColor()
{
  QItemSelection sel = mTreeView->selectionModel()->selection();

  QModelIndex colorIndex = mModel->index( sel.first().top(), QgsPalettedRendererModel::ColorColumn );
  QColor currentColor = mModel->data( colorIndex, Qt::DisplayRole ).value<QColor>();

  QgsPanelWidget *panel = QgsPanelWidget::findParentPanel( qobject_cast< QWidget * >( parent() ) );
  if ( panel && panel->dockMode() )
  {
    QgsCompoundColorWidget *colorWidget = new QgsCompoundColorWidget( panel, currentColor, QgsCompoundColorWidget::LayoutVertical );
    colorWidget->setPanelTitle( tr( "Select Color" ) );
    colorWidget->setAllowOpacity( true );
    connect( colorWidget, &QgsCompoundColorWidget::currentColorChanged, this, [ = ]( const QColor & color ) { setSelectionColor( sel, color ); } );
    panel->openPanel( colorWidget );
  }
  else
  {
    // modal dialog version... yuck
    QColor newColor = QgsColorDialog::getColor( currentColor, this, QStringLiteral( "Change color" ), true );
    if ( newColor.isValid() )
    {
      setSelectionColor( sel, newColor );
    }
  }
}
Esempio n. 6
0
QgsProjectParser::QgsProjectParser( QDomDocument* xmlDoc, const QString& filePath ): QgsConfigParser(), mXMLDoc( xmlDoc ), mProjectPath( filePath )
{
  mOutputUnits = QgsMapRenderer::Millimeters;
  setLegendParametersFromProject();
  setSelectionColor();
  setMaxWidthHeight();

  //accelerate search for layers and groups
  if ( mXMLDoc )
  {
    QDomNodeList layerNodeList = mXMLDoc->elementsByTagName( "maplayer" );
    QDomElement currentElement;
    int nNodes = layerNodeList.size();
    for ( int i = 0; i < nNodes; ++i )
    {
      currentElement = layerNodeList.at( i ).toElement();
      mProjectLayerElements.push_back( currentElement );
      mProjectLayerElementsByName.insert( layerName( currentElement ), currentElement );
      mProjectLayerElementsById.insert( layerId( currentElement ), currentElement );
    }

    QDomElement legendElement = mXMLDoc->documentElement().firstChildElement( "legend" );
    if ( !legendElement.isNull() )
    {
      QDomNodeList groupNodeList = legendElement.elementsByTagName( "legendgroup" );
      for ( int i = 0; i < groupNodeList.size(); ++i )
      {
        mLegendGroupElements.push_back( groupNodeList.at( i ).toElement() );
      }
    }
  }
}
int GraphView::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = CommonView::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 6)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 6;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< GraphWidget::Orientation*>(_v) = orientation(); break;
        case 1: *reinterpret_cast< GraphWidget::Mode*>(_v) = mode(); break;
        case 2: *reinterpret_cast< int*>(_v) = timeLinesCount(); break;
        case 3: *reinterpret_cast< int*>(_v) = valueLinesCount(); break;
        case 4: *reinterpret_cast< QColor*>(_v) = cursorColor(); break;
        case 5: *reinterpret_cast< QColor*>(_v) = linesColor(); break;
        case 6: *reinterpret_cast< QColor*>(_v) = textColor(); break;
        case 7: *reinterpret_cast< QColor*>(_v) = backColor(); break;
        case 8: *reinterpret_cast< QColor*>(_v) = selectionColor(); break;
        case 9: *reinterpret_cast< Plots*>(_v) = plots(); break;
        }
        _id -= 10;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setOrientation(*reinterpret_cast< GraphWidget::Orientation*>(_v)); break;
        case 1: setMode(*reinterpret_cast< GraphWidget::Mode*>(_v)); break;
        case 2: setTimeLinesCount(*reinterpret_cast< int*>(_v)); break;
        case 3: setValueLinesCount(*reinterpret_cast< int*>(_v)); break;
        case 4: setCursorColor(*reinterpret_cast< QColor*>(_v)); break;
        case 5: setLinesColor(*reinterpret_cast< QColor*>(_v)); break;
        case 6: setTextColor(*reinterpret_cast< QColor*>(_v)); break;
        case 7: setBackColor(*reinterpret_cast< QColor*>(_v)); break;
        case 8: setSelectionColor(*reinterpret_cast< QColor*>(_v)); break;
        case 9: setPlots(*reinterpret_cast< Plots*>(_v)); break;
        }
        _id -= 10;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 10;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Esempio n. 8
0
//TODO: add a settings box to set size of resulting image.
Cropping::Cropping(QObject *parent)
{
    widget = new CroppingWidget();
    filterWidget = widget;
    connect(widget, SIGNAL(rectangleChanged()), this, SLOT(recalculate()));

    if (parent) {
        /* Connect slots to the filtercontainer */
        connect(parent, SIGNAL(selectionColorChanged(QColor)), widget, SLOT(setSelectionColor(QColor)));
    }
}
Esempio n. 9
0
UIDisasm::UIDisasm( QWidget* p )
	: QAbstractScrollArea( p )
{
   disassembleFunction = DisasmInstructionNull;
   address = 0;
   pc = 0xFFFFFFFF;
   instructionSize = 1;

   setSelectionColor(QColor(0x6d, 0x9e, 0xff, 0xff));

   adjustSettings();
}
Esempio n. 10
0
QHexEdit::QHexEdit(QWidget *parent) : QAbstractScrollArea(parent)
{
    _addressArea = true;
    _addressWidth = 4;
    _asciiArea = true;
    _overwriteMode = true;
    _highlighting = true;
    _readOnly = false;
    _cursorPosition = 0;
    _lastEventSize = 0;
    _hexCharsInLine = 47;
    _bytesPerLine = 16;
    _editAreaIsAscii = false;
    _hexCaps = false;
    _dynamicBytesPerLine = false;

    _chunks = new Chunks(this);
    _undoStack = new UndoStack(_chunks, this);
#ifdef Q_OS_WIN32
    setFont(QFont("Courier", 10));
#else
    setFont(QFont("Monospace", 10));
#endif
    setAddressAreaColor(this->palette().alternateBase().color());
    setHighlightingColor(QColor(0xff, 0xff, 0x99, 0xff));
    setSelectionColor(this->palette().highlight().color());

    connect(&_cursorTimer, SIGNAL(timeout()), this, SLOT(updateCursor()));
    connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(adjust()));
    connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(adjust()));
    connect(_undoStack, SIGNAL(indexChanged(int)), this, SLOT(dataChangedPrivate(int)));

    _cursorTimer.setInterval(500);
    _cursorTimer.start();

    setAddressWidth(4);
    setAddressArea(true);
    setAsciiArea(true);
    setOverwriteMode(true);
    setHighlighting(true);
    setReadOnly(false);

    init();

}
Esempio n. 11
0
//==============================================================================
// Constructor and Deconstructor.
//==============================================================================
ListItem::ListItem(string t, string f, int size, float x, float y, text_align a)
{
	name = t;
	text = new DrawText(t,f,size,x,y,a);
	
	xPos = x;
	yPos = y;
	width = text->getTextWidth();
	height = text->getTextHeight();
	
	selected = false;
	
	setHoverColor(1,1,1,.25);
	setSelectionColor(1,1,1,.5);
	
	setDefaultTextColor(text->getTextColor());
	setSelectedTextColor(0,0,0,1);
}
Esempio n. 12
0
SelectBox::SelectBox( const CRect& rcSize, CControlListener* listener, long tag ) :
    CControl (rcSize, listener, tag ),
    scrollbar_( NULL ),
    state_( 0 ),
    dropDir_( Dropdown ),
	font_( kSystemFont ),
    index_( 0 ), 
    indexSel_( 0 ),
    indexSaved_( 0 ),
    maxVisible_( 3 ),
    scrollOffset_( 0 )
{
    calcMetrics();

    CRect rcScrollbar( size.right-WidthButton, size.bottom, size.right, size.bottom+150 );
    scrollbar_ = new CScrollbar( rcScrollbar, this, 0, CScrollbar::kVertical, CRect( 0,0,0,0 ));

    setWantsFocus( true );
    setBackgroundColor( kWhiteCColor );
    setFrameColor( kBlackCColor );
    setTextColor( kBlackCColor );
    setSelectionColor( colOrange );
}
Esempio n. 13
0
void UITextEdit::onStyleApply(const std::string& styleName, const OTMLNodePtr& styleNode)
{
    UIWidget::onStyleApply(styleName, styleNode);

    for(const OTMLNodePtr& node : styleNode->children()) {
        if(node->tag() == "text") {
            setText(node->value());
            setCursorPos(m_text.length());
        } else if(node->tag() == "text-hidden")
            setTextHidden(node->value<bool>());
        else if(node->tag() == "shift-navigation")
            setShiftNavigation(node->value<bool>());
        else if(node->tag() == "multiline")
            setMultiline(node->value<bool>());
        else if(node->tag() == "max-length")
            setMaxLength(node->value<int>());
        else if(node->tag() == "editable")
            setEditable(node->value<bool>());
        else if(node->tag() == "selectable")
            setSelectable(node->value<bool>());
        else if(node->tag() == "selection-color")
            setSelectionColor(node->value<Color>());
        else if(node->tag() == "selection-background-color")
            setSelectionBackgroundColor(node->value<Color>());
        else if(node->tag() == "selection") {
            Point selectionRange = node->value<Point>();
            setSelection(selectionRange.x, selectionRange.y);
        }
        else if(node->tag() == "cursor-visible")
            setCursorVisible(node->value<bool>());
        else if(node->tag() == "change-cursor-image")
            setChangeCursorImage(node->value<bool>());
        else if(node->tag() == "auto-scroll")
            setAutoScroll(node->value<bool>());
    }
}
int QHexEdit::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QScrollArea::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: currentAddressChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: currentSizeChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 2: dataChanged(); break;
        case 3: overwriteModeChanged((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 4: setAddressWidth((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 5: setAddressArea((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 6: setAsciiArea((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 7: setHighlighting((*reinterpret_cast< bool(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 8;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QByteArray*>(_v) = data(); break;
        case 1: *reinterpret_cast< int*>(_v) = addressOffset(); break;
        case 2: *reinterpret_cast< QColor*>(_v) = addressAreaColor(); break;
        case 3: *reinterpret_cast< QColor*>(_v) = highlightingColor(); break;
        case 4: *reinterpret_cast< QColor*>(_v) = selectionColor(); break;
        case 5: *reinterpret_cast< bool*>(_v) = overwriteMode(); break;
        case 6: *reinterpret_cast< bool*>(_v) = isReadOnly(); break;
        case 7: *reinterpret_cast< QFont*>(_v) = font(); break;
        }
        _id -= 8;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setData(*reinterpret_cast< QByteArray*>(_v)); break;
        case 1: setAddressOffset(*reinterpret_cast< int*>(_v)); break;
        case 2: setAddressAreaColor(*reinterpret_cast< QColor*>(_v)); break;
        case 3: setHighlightingColor(*reinterpret_cast< QColor*>(_v)); break;
        case 4: setSelectionColor(*reinterpret_cast< QColor*>(_v)); break;
        case 5: setOverwriteMode(*reinterpret_cast< bool*>(_v)); break;
        case 6: setReadOnly(*reinterpret_cast< bool*>(_v)); break;
        case 7: setFont(*reinterpret_cast< QFont*>(_v)); break;
        }
        _id -= 8;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 8;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Esempio n. 15
0
int QDeclarativeTextEdit::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDeclarativeImplicitSizePaintedItem::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 47)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 47;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = text(); break;
        case 1: *reinterpret_cast< QColor*>(_v) = color(); break;
        case 2: *reinterpret_cast< QColor*>(_v) = selectionColor(); break;
        case 3: *reinterpret_cast< QColor*>(_v) = selectedTextColor(); break;
        case 4: *reinterpret_cast< QFont*>(_v) = font(); break;
        case 5: *reinterpret_cast< HAlignment*>(_v) = hAlign(); break;
        case 6: *reinterpret_cast< VAlignment*>(_v) = vAlign(); break;
        case 7: *reinterpret_cast< WrapMode*>(_v) = wrapMode(); break;
        case 8: *reinterpret_cast< int*>(_v) = lineCount(); break;
        case 9: *reinterpret_cast< qreal*>(_v) = paintedWidth(); break;
        case 10: *reinterpret_cast< qreal*>(_v) = paintedHeight(); break;
        case 11: *reinterpret_cast< TextFormat*>(_v) = textFormat(); break;
        case 12: *reinterpret_cast< bool*>(_v) = isReadOnly(); break;
        case 13: *reinterpret_cast< bool*>(_v) = isCursorVisible(); break;
        case 14: *reinterpret_cast< int*>(_v) = cursorPosition(); break;
        case 15: *reinterpret_cast< QRect*>(_v) = cursorRectangle(); break;
        case 16: *reinterpret_cast< QDeclarativeComponent**>(_v) = cursorDelegate(); break;
        case 17: *reinterpret_cast< int*>(_v) = selectionStart(); break;
        case 18: *reinterpret_cast< int*>(_v) = selectionEnd(); break;
        case 19: *reinterpret_cast< QString*>(_v) = selectedText(); break;
        case 20: *reinterpret_cast< bool*>(_v) = focusOnPress(); break;
        case 21: *reinterpret_cast< bool*>(_v) = persistentSelection(); break;
        case 22: *reinterpret_cast< qreal*>(_v) = textMargin(); break;
        case 23: *reinterpret_cast< Qt::InputMethodHints*>(_v) = inputMethodHints(); break;
        case 24: *reinterpret_cast< bool*>(_v) = selectByMouse(); break;
        case 25: *reinterpret_cast< SelectionMode*>(_v) = mouseSelectionMode(); break;
        case 26: *reinterpret_cast< bool*>(_v) = canPaste(); break;
        case 27: *reinterpret_cast< bool*>(_v) = isInputMethodComposing(); break;
        }
        _id -= 28;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setText(*reinterpret_cast< QString*>(_v)); break;
        case 1: setColor(*reinterpret_cast< QColor*>(_v)); break;
        case 2: setSelectionColor(*reinterpret_cast< QColor*>(_v)); break;
        case 3: setSelectedTextColor(*reinterpret_cast< QColor*>(_v)); break;
        case 4: setFont(*reinterpret_cast< QFont*>(_v)); break;
        case 5: setHAlign(*reinterpret_cast< HAlignment*>(_v)); break;
        case 6: setVAlign(*reinterpret_cast< VAlignment*>(_v)); break;
        case 7: setWrapMode(*reinterpret_cast< WrapMode*>(_v)); break;
        case 11: setTextFormat(*reinterpret_cast< TextFormat*>(_v)); break;
        case 12: setReadOnly(*reinterpret_cast< bool*>(_v)); break;
        case 13: setCursorVisible(*reinterpret_cast< bool*>(_v)); break;
        case 14: setCursorPosition(*reinterpret_cast< int*>(_v)); break;
        case 16: setCursorDelegate(*reinterpret_cast< QDeclarativeComponent**>(_v)); break;
        case 20: setFocusOnPress(*reinterpret_cast< bool*>(_v)); break;
        case 21: setPersistentSelection(*reinterpret_cast< bool*>(_v)); break;
        case 22: setTextMargin(*reinterpret_cast< qreal*>(_v)); break;
        case 23: setInputMethodHints(*reinterpret_cast< Qt::InputMethodHints*>(_v)); break;
        case 24: setSelectByMouse(*reinterpret_cast< bool*>(_v)); break;
        case 25: setMouseSelectionMode(*reinterpret_cast< SelectionMode*>(_v)); break;
        }
        _id -= 28;
    } else if (_c == QMetaObject::ResetProperty) {
        switch (_id) {
        case 5: resetHAlign(); break;
        }
        _id -= 28;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 28;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 28;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 28;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 28;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 28;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Esempio n. 16
0
QgsProjectParser::QgsProjectParser( QDomDocument* xmlDoc, const QString& filePath ): QgsConfigParser(), mXMLDoc( xmlDoc ), mProjectPath( filePath )
{
  mOutputUnits = QgsMapRenderer::Millimeters;
  setLegendParametersFromProject();
  setSelectionColor();
}
Esempio n. 17
0
void ListItem::setSelectionColor(float c[4])
{
	setSelectionColor(c[0],c[1],c[2],c[3]);
}