QgsGrassFeatureIterator::QgsGrassFeatureIterator( QgsGrassProvider* p, const QgsFeatureRequest& request )
    : QgsAbstractFeatureIterator( request ), P( p )
{
  // make sure that only one iterator is active
  if ( P->mActiveIterator )
  {
    QgsMessageLog::logMessage( QObject::tr( "Already active iterator on this provider was closed." ), QObject::tr( "GRASS" ) );
    P->mActiveIterator->close();
  }
  P->mActiveIterator = this;

  // check if outdated and update if necessary
  P->ensureUpdated();

  // Init structures
  mPoints = Vect_new_line_struct();
  mCats = Vect_new_cats_struct();
  mList = Vect_new_list();

  // Create selection array
  allocateSelection( P->mMap );
  resetSelection( 1 );

  if ( request.filterType() == QgsFeatureRequest::FilterRect )
  {
    setSelectionRect( request.filterRect(), request.flags() & QgsFeatureRequest::ExactIntersect );
  }
  else
  {
    // TODO: implement fast lookup by feature id

    //no filter - use all features
    resetSelection( 1 );
  }
}
Esempio n. 2
0
QgsGrassFeatureIterator::QgsGrassFeatureIterator( QgsGrassFeatureSource* source, bool ownSource, const QgsFeatureRequest& request )
    : QgsAbstractFeatureIteratorFromSource<QgsGrassFeatureSource>( source, ownSource, request )
{
  sMutex.lock();

  // Init structures
  mPoints = Vect_new_line_struct();
  mCats = Vect_new_cats_struct();
  mList = Vect_new_list();

  // Create selection array
  allocateSelection( mSource->mMap );
  resetSelection( 1 );

  if ( request.filterType() == QgsFeatureRequest::FilterRect )
  {
    setSelectionRect( request.filterRect(), request.flags() & QgsFeatureRequest::ExactIntersect );
  }
  else
  {
    // TODO: implement fast lookup by feature id

    //no filter - use all features
    resetSelection( 1 );
  }
}
Esempio n. 3
0
void QHexEdit::selectData(int position, int size)
{
	setCursorPosition(position * 2 - 1);
	resetSelection(position * 2);
	setSelection(position * 2 + size * 2);
	ensureVisible();
}
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();
}
Esempio n. 5
0
void QHexEditPrivate::replace(int index, char ch)
{
    QUndoCommand *charCommand = new CharCommand(&_xData, CharCommand::replace, index, ch);
    _undoStack->push(charCommand);
    resetSelection();
    emit dataChanged();
}
Esempio n. 6
0
void QHexEditPrivate::replace(int index, const QByteArray & ba)
{
    QUndoCommand *arrayCommand= new ArrayCommand(&_xData, ArrayCommand::replace, index, ba, ba.length());
    _undoStack->push(arrayCommand);
    resetSelection();
    emit dataChanged();
}
Esempio n. 7
0
void QHexEditPrivate::replace(int pos, int len, const QByteArray &after)
{
    QUndoCommand *arrayCommand= new ArrayCommand(&_xData, ArrayCommand::replace, pos, after, len);
    _undoStack->push(arrayCommand);
    resetSelection();
    emit dataChanged();
}
Esempio n. 8
0
// ...
GLWidget::GLWidget(QWidget* parent) : QGLWidget(QGLFormat(QGL::DoubleBuffer | QGL::Rgba | QGL::DepthBuffer), parent)
{
	makeCurrent();
	initFont();
	resetSelection();

}
Esempio n. 9
0
void QHexEditPrivate::scrollToEnd()
{
    setCursorPos(_xData.size() * 2);
    resetSelection(_cursorPosition);
    _scrollArea->ensureVisible(_cursorX, _cursorY + _charHeight/2, 3, _charHeight/2 + 2);
    update();
}
Esempio n. 10
0
UIHexEditorWnd::UIHexEditorWnd( QWidget* p )
	: QAbstractScrollArea( p )
{
   gapSizeAddrHex = 10;
   gapSizeHexText = 16;
   bytesPerLine = 16;
   bytesPerGroup = 2;
   nibblesPerGroup = bytesPerGroup * 2;
   hexCharsInLine = bytesPerLine * 2 + (bytesPerLine / bytesPerGroup) - 1;

   textEdit = false;
   setStartAddress(0);
   setEndAddress(0xFFFFFFFF);
   setAddrAreaColor(this->palette().color(QPalette::AlternateBase));
   adjustSettings();
   resetSelection(0);
   goToAddress(0);

   connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(sliderUpdate(int)));

   connect(&cursorTimer, SIGNAL(timeout()), this, SLOT(updateCursor()));
   cursorTimer.setInterval(500);
   cursorTimer.start();

   connect(&autoScrollTimer, SIGNAL(timeout()), this, SLOT(autoScroll()));
   autoScrollTimer.setInterval(5);

   setMouseTracking(true);
}
Esempio n. 11
0
QGraphicsPixmapItem* ImageScene::addPixmap(QPixmap in_Pixmap) {
	if (m_pPixmap != NULL ) {
		QGraphicsScene::removeItem ( m_pPixmap);
	}
	m_pPixmap = QGraphicsScene::addPixmap(in_Pixmap);
	resetSelection();
	return m_pPixmap;
}
Esempio n. 12
0
//Removes all of the Characters from the list.
//Pre:  None.
//Post: Uses clear to remove all the elements from the list.
void CharacterList::deleteList(){

    deleteAddedLists();    

    charList.clear();

    resetSelection();
}
Esempio n. 13
0
void HotPointView::createActions()
{
	resetSelectionAct = new QAction( QString::fromUtf8( "Resetuj zaznaczenie" ), this );
	connect( resetSelectionAct, SIGNAL( triggered() ), this, SLOT( resetSelection() ) );

	beginSelectionAct = new QAction( QString::fromUtf8( "Wyznacz histogram" ), this );
	connect( beginSelectionAct, SIGNAL( triggered() ), this, SLOT( beginSelection() ) );
}
Esempio n. 14
0
void QHexEditPrivate::mousePressEvent(QMouseEvent * event)
{
    _blink = false;
    update();
    int cPos = cursorPos(event->pos());
    resetSelection(cPos);
    setCursorPos(cPos);
}
Esempio n. 15
0
void CSelectionManager::exclusiveSelection(RoomId id) 
{
    if (selection.contains(id)) 
        return;
    else {
        resetSelection();
        select(id);
    }   
}
Esempio n. 16
0
// ********************************************************************** Private utility functions
void QHexEdit::init()
{
    _undoStack->clear();
    setAddressOffset(0);
    resetSelection(0);
    setCursorPosition(0);
    verticalScrollBar()->setValue(0);
    _modified = false;
}
Esempio n. 17
0
//Sets the current selection to the specific character.
//Pre:  The Character is valid.
//Post: Iterates through the list. If the character is in the list,
//      currSelection is set to that character. If the character is not
//      found, currSelection is set to the beginning of the list.
void CharacterList::setCurrSelection(Character *character){

    resetSelection();

    while(currPosition < size){

        if(*currSelection == character){

            return;
        }

        else{
            moveSelectionDown();
        }
    }

    //Character not found, reset to the beginning.
    resetSelection();
}
Esempio n. 18
0
void UIHexEditorWnd::overwrite(s64 index, char ch)
{
   u8 data = MappedMemoryReadByte(index / 2);
   char str[2] = { ch, '\0' };
   ch = strtol(str, NULL, 16);
   if (index % 2 == 0)
      MappedMemoryWriteByte(index / 2, data & 0xF | (ch << 4));
   else
      MappedMemoryWriteByte(index / 2, data & 0xF0 | ch);
   resetSelection();
}
Esempio n. 19
0
void QHexEdit::mousePressEvent(QMouseEvent * event)
{
    _blink = false;
    viewport()->update();
    qint64 cPos = cursorPosition(event->pos());
    if (cPos >= 0)
    {
        resetSelection(cPos);
        setCursorPosition(cPos);
    }
}
Esempio n. 20
0
void UIHexEditorWnd::goToAddress(u32 address, bool setCursor)
{
   int height = viewport()->height();
   verticalScrollBar()->setValue(address/bytesPerLine);
   adjustSettings();
   if (setCursor)
   {
      setCursorPos(address * 2);
      resetSelection(address * 2);
   }
   viewport()->update();
}
Esempio n. 21
0
qint64 QHexEdit::lastIndexOf(const QByteArray &ba, qint64 from)
{
    qint64 pos = _chunks->lastIndexOf(ba, from);
    if (pos > -1)
    {
        qint64 curPos = pos*2;
        setCursorPosition(curPos - 1);
        resetSelection(curPos);
        setSelection(curPos + ba.length()*2);
        ensureVisible();
    }
    return pos;
}
Esempio n. 22
0
qint64 QHexEdit::indexOf(const QByteArray &ba, qint64 from)
{
    qint64 pos = _chunks->indexOf(ba, from);
    qDebug() << "Next is " << pos << "\n";
    if (pos > -1)
    {
        qint64 curPos = pos*2;
        setCursorPosition(curPos + ba.length()*2);
        resetSelection(curPos);
        setSelection(curPos + ba.length()*2);
        ensureVisible();
    }
    return pos;
}
Esempio n. 23
0
void UIHexEditorWnd::keyPressEdit(QKeyEvent *event, u64 posAddr)
{
   int key = int(event->text()[0].toLatin1());
   if (textEdit)
   {
      if ((key>='0' && key<='9') || (key>='a' && key <= 'z') || (key>='A' && key <= 'Z'))
      {
         if (getSelectionStart() != getSelectionEnd())
         {
            posAddr = getSelectionStart();
            clear(posAddr, getSelectionEnd() - posAddr);
            setCursorPos(2*posAddr);
            resetSelection(2*posAddr);
         }

         // Patch byte
         overwrite((u32)cursorAddr >> 1, (u8)key);
         setCursorPos(cursorAddr + 2);
         resetSelection(cursorAddr);
      }
   }
   else
   {
      if ((key>='0' && key<='9') || (key>='a' && key <= 'f') || (key>='A' && key <= 'F'))
Esempio n. 24
0
int QHexEditPrivate::indexOf(const QByteArray & ba, int from)
{
    if (from > (_xData.data().length() - 1))
        from = _xData.data().length() - 1;
    int idx = _xData.data().indexOf(ba, from);
    if (idx > -1)
    {
        int curPos = idx*2;
        setCursorPos(curPos + ba.length()*2);
        resetSelection(curPos);
        setSelection(curPos + ba.length()*2);
        ensureVisible();
    }
    return idx;
}
Esempio n. 25
0
void LLFlatListView::onItemMouseClick(item_pair_t* item_pair, MASK mask)
{
	if (!item_pair) return;

	if (!item_pair->first) 
	{
		llwarning("Attempt to selet an item pair containing null panel item", 0);
		return;
	}

	setFocus(TRUE);
	
	bool select_item = !isSelected(item_pair);

	//*TODO find a better place for that enforcing stuff
	if (mKeepOneItemSelected && numSelected() == 1 && !select_item) return;
	
	if (!(mask & MASK_CONTROL) || !mMultipleSelection) resetSelection();
	selectItemPair(item_pair, select_item);
}
//virtual
S32 LLAvatarList::notifyParent(const LLSD& info)
{
	if (info.has("sort") && &NAME_COMPARATOR == mItemComparator)
	{
		sort();
		return 1;
	}
// [SL:KB] - Patch: UI-AvatarListDndShare | Checked: 2011-06-19 (Catznip-2.6.0c) | Added: Catznip-2.6.0c
	else if ( (info.has("select")) && (info["select"].isUUID()) )
	{
		const LLSD& sdValue = getSelectedValue();
		const LLUUID idItem = info["select"].asUUID();
		if ( (!sdValue.isDefined()) || ((sdValue.isUUID()) && (sdValue.asUUID() != idItem)) )
		{
			resetSelection();
			selectItemByUUID(info["select"].asUUID());
		}
	}
// [/SL:KB]
	return LLFlatListViewEx::notifyParent(info);
}
Esempio n. 27
0
void LLFlatListView::clear()
{
	// This will clear mSelectedItemPairs, calling all appropriate callbacks.
	resetSelection();
	
	// do not use LLView::deleteAllChildren to avoid removing nonvisible items. drag-n-drop for ex.
	for (pairs_iterator_t it = mItemPairs.begin(); it != mItemPairs.end(); ++it)
	{
		mItemsPanel->removeChild((*it)->first);
		(*it)->first->die();
		delete *it;
	}
	mItemPairs.clear();

	// also set items panel height to zero. Reshape it to allow reshaping of non-item children
	LLRect rc = mItemsPanel->getRect();
	rc.mBottom = rc.mTop;
	mItemsPanel->reshape(rc.getWidth(), rc.getHeight());
	mItemsPanel->setRect(rc);

	setNoItemsCommentVisible(true);
	notifyParentItemsRectChanged();
}
Esempio n. 28
0
void UIHexEditorWnd::keyPressSelect(QKeyEvent *event)
{
   if (event->matches(QKeySequence::SelectAll))
   {
      resetSelection(0);
      setSelection(2*endAddress + 1);
   }
   if (event->matches(QKeySequence::SelectNextChar))
   {
      if (cursorY + (fontHeight*2) > viewport()->height() &&
         (cursorAddr + 2) % (bytesPerLine * 2) == 0)
         verticalScrollBar()->triggerAction(QAbstractSlider::SliderSingleStepAdd);
      s64 pos = (cursorAddr & ~1) + 2;
      setCursorPos(pos);
      setSelection(pos);
   }
   if (event->matches(QKeySequence::SelectPreviousChar))
   {
      if (cursorAddr <= (s64)verticalScrollBar()->value() * bytesPerLine * 2)
         verticalScrollBar()->triggerAction(QAbstractSlider::SliderSingleStepSub);
      s64 pos = (cursorAddr & ~1) - 2;
      setSelection(pos);
      setCursorPos(pos);
   }
   if (event->matches(QKeySequence::SelectEndOfLine))
   {
      s64 pos = (cursorAddr & ~1) - (cursorAddr % (2 * bytesPerLine)) + (2 * bytesPerLine);
      setCursorPos(pos);
      setSelection(pos);
   }
   if (event->matches(QKeySequence::SelectStartOfLine))
   {
      s64 pos = (cursorAddr & ~1) - (cursorAddr % (2 * bytesPerLine));
      setCursorPos(pos);
      setSelection(pos);
   }
   if (event->matches(QKeySequence::SelectPreviousLine))
   {
      if (cursorAddr <= (s64)verticalScrollBar()->value() * bytesPerLine * 2)
         verticalScrollBar()->triggerAction(QAbstractSlider::SliderSingleStepSub);
      s64 pos = (cursorAddr & ~1) - (2 * bytesPerLine);
      setCursorPos(pos);
      setSelection(pos);
   }
   if (event->matches(QKeySequence::SelectNextLine))
   {
      if (cursorY + (fontHeight*2) > viewport()->height())
         verticalScrollBar()->triggerAction(QAbstractSlider::SliderSingleStepAdd);
      s64 pos = (cursorAddr & ~1) + (2 * bytesPerLine);
      setCursorPos(pos);
      setSelection(pos);
   }
   if (event->matches(QKeySequence::SelectNextPage))
   {
      verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepAdd);
      s64 pos = (cursorAddr & ~1) + (verticalScrollBar()->pageStep() * 2 * bytesPerLine);
      setCursorPos(pos);
      setSelection(pos);
   }
   if (event->matches(QKeySequence::SelectPreviousPage))
   {
      verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepSub);
      int pos = (cursorAddr & ~1) - (verticalScrollBar()->pageStep() * 2 * bytesPerLine);
      setCursorPos(pos);
      setSelection(pos);
   }
   if (event->matches(QKeySequence::SelectEndOfDocument))
   {
      int pos = endAddress * 2;
      setCursorPos(pos);
      setSelection(pos);
   }
   if (event->matches(QKeySequence::SelectStartOfDocument))
   {
      int pos = 0;
      setCursorPos(pos);
      setSelection(pos);
   }
}
Esempio n. 29
0
void UIHexEditorWnd::keyPressCursor(QKeyEvent *event)
{
   if (event->matches(QKeySequence::MoveToNextChar))
   {
      if (cursorY + (fontHeight*2) > viewport()->height() &&
         (cursorAddr + 2) % (bytesPerLine * 2) == 0)
         verticalScrollBar()->triggerAction(QAbstractSlider::SliderSingleStepAdd);

      setCursorPos((cursorAddr & ~1) + 2);
      resetSelection(cursorAddr);
   }
   if (event->matches(QKeySequence::MoveToPreviousChar))
   {
      if (cursorAddr <= (s64)verticalScrollBar()->value() * bytesPerLine * 2)
         verticalScrollBar()->triggerAction(QAbstractSlider::SliderSingleStepSub);
      if (cursorAddr-startAddress < 2)
         setCursorPos(startAddress);
      else
         setCursorPos((cursorAddr & ~1) - 2);
      resetSelection(cursorAddr);
   }
   if (event->matches(QKeySequence::MoveToEndOfLine))
   {
      setCursorPos((cursorAddr & ~1) | (2 * bytesPerLine -2));
      resetSelection(cursorAddr);
   }
   if (event->matches(QKeySequence::MoveToStartOfLine))
   {
      setCursorPos((cursorAddr & ~1) - (cursorAddr % (2 * bytesPerLine)));
      resetSelection(cursorAddr);
   }
   if (event->matches(QKeySequence::MoveToPreviousLine))
   {
      if (cursorAddr <= (s64)verticalScrollBar()->value() * bytesPerLine * 2)
         verticalScrollBar()->triggerAction(QAbstractSlider::SliderSingleStepSub);
      if (cursorAddr-startAddress < (2 * bytesPerLine))
         setCursorPos(startAddress);
      else
         setCursorPos((cursorAddr & ~1) - (2 * bytesPerLine));
      resetSelection(cursorAddr);
   }
   if (event->matches(QKeySequence::MoveToNextLine))
   {
      if (cursorY + (fontHeight*2) > viewport()->height())
         verticalScrollBar()->triggerAction(QAbstractSlider::SliderSingleStepAdd);
      setCursorPos((cursorAddr & ~1) + (2 * bytesPerLine));
      resetSelection(cursorAddr);
   }
   if (event->matches(QKeySequence::MoveToNextPage))
   {
      verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepAdd);
      setCursorPos((cursorAddr & ~1) + (verticalScrollBar()->pageStep() * 2 * bytesPerLine));
      resetSelection(cursorAddr);
   }
   if (event->matches(QKeySequence::MoveToPreviousPage))
   {
      verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepSub);
      setCursorPos((cursorAddr & ~1) - (verticalScrollBar()->pageStep() * 2 * bytesPerLine));
      resetSelection(cursorAddr);
   }
   if (event->matches(QKeySequence::MoveToEndOfDocument))
   {
      setCursorPos(endAddress * 2);
      resetSelection(cursorAddr);
   }
   if (event->matches(QKeySequence::MoveToStartOfDocument))
   {
      setCursorPos(startAddress);
      resetSelection(cursorAddr);
   }
}
Esempio n. 30
0
void UIHexEditorWnd::overwrite(u32 addr, u8 data)
{
   MappedMemoryWriteByte(addr, data);
   resetSelection();
}