示例#1
0
void BufferWidget::doSetEncoding(const QByteArray &e)
{
	editor::Buffer *buf = currentBuffer();
	if(buf == nullptr)
		return;
	buf->setEncoding(e);
}
示例#2
0
文件: Document.cpp 项目: wibbe/zum
  bool undo()
  {
    if (!currentBuffer().undoStack_.empty())
    {
      currentBuffer().redoStack_.emplace_back(currentDoc(), cursorPos(), EditAction::UndoRedo);

      UndoState const& state = currentBuffer().undoStack_.back();
      currentDoc() = state.doc_;
      cursorPos() = state.cursor_;

      currentBuffer().undoStack_.pop_back();
      return true;
    }

    return false;
  }
示例#3
0
void BufferWidget::doSaveAs()
{
	editor::Buffer *buf = currentBuffer();
	if(buf == nullptr)
		return;
	buf->saveAs();
}
示例#4
0
void TreeWidget::closeBuffer(IrcBuffer* buffer)
{
    if (!buffer)
        buffer = currentBuffer();
    if (buffer)
        emit bufferClosed(buffer);
}
示例#5
0
文件: Document.cpp 项目: wibbe/zum
  Index selectionIndex(Index const& idx)
  {
    Index const& start = currentBuffer().selectionStart_;
    if (start.x < 0)
      return Index();

    return Index(idx.x - start.x, idx.y - start.y);
  }
示例#6
0
void BufferWidget::doLineWrapping(bool enabled)
{
	editor::Buffer *buf = currentBuffer();

	if(buf == NULL)
		return;

	buf->setLineWrapping(enabled);
}
示例#7
0
void BufferWidget::doDecreaseIndent()
{
	editor::Buffer *buf = currentBuffer();

	if(buf == NULL)
		return;

	buf->decreaseSelectionIndent();
}
示例#8
0
void BufferWidget::doDeselect()
{
	editor::Buffer *buf = currentBuffer();

	if(buf == NULL)
		return;

	buf->deselect();
}
示例#9
0
void BufferWidget::doSelectAll()
{
	editor::Buffer *buf = currentBuffer();

	if(buf == NULL)
		return;

	buf->selectAll();
}
示例#10
0
void BufferWidget::doDuplicateLine()
{
	editor::Buffer *buf = currentBuffer();

	if(buf == NULL)
		return;

	buf->duplicateLine();
}
示例#11
0
void BufferWidget::doPaste()
{
	editor::Buffer *buf = currentBuffer();

	if(buf == NULL)
		return;

	buf->paste();
}
示例#12
0
void BufferWidget::doCopy()
{
	editor::Buffer *buf = currentBuffer();

	if(buf == NULL)
		return;

	buf->copy();
}
示例#13
0
void BufferWidget::doRedo()
{
	editor::Buffer *buf = currentBuffer();

	if(buf == NULL)
		return;

	buf->redo();
}
示例#14
0
void BufferWidget::doGoTo(int l)
{
	editor::Buffer *buf = currentBuffer();

	if(buf == NULL)
		return;

	buf->goToLine(l);
}
示例#15
0
void BufferWidget::doPrint(QPrinter *p)
{
	editor::Buffer *buf = currentBuffer();

	if(buf == NULL)
		return;

	buf->print(p);
}
示例#16
0
文件: Document.cpp 项目: wibbe/zum
  static void takeUndoSnapshot(EditAction action, bool canMerge)
  {
    bool createNew = true;

    if (!currentBuffer().undoStack_.empty())
    {
      UndoState & state = currentBuffer().undoStack_.back();

      if (state.action_ == action && (canMerge || forceUndoMerge_))
        createNew = false;
    }

    if (createNew)
    {
      currentBuffer().undoStack_.emplace_back(currentDoc(), cursorPos(), action);
      currentBuffer().redoStack_.clear();
    }
  }
示例#17
0
editor::search::FindResult
BufferWidget::doReplaceAll(editor::search::ReplaceQuery const &q)
{
	editor::Buffer *buf = currentBuffer();

	if(buf == NULL)
		return editor::search::FindResult::NoDocument;

	return buf->replaceAll(q);
}
示例#18
0
editor::search::FindResult
BufferWidget::doFindPrevious(editor::search::FindQuery const &q)
{
	editor::Buffer *buf = currentBuffer();

	if(buf == NULL)
		return editor::search::FindResult::NoDocument;

	return buf->findPrevious(q);
}
示例#19
0
void BufferWidget::doClose()
{
	editor::Buffer *buf = currentBuffer();
	if(buf == nullptr)
		return;

	if(buf->prepareToClose())
	{
		doTabClosing(tabWidget->indexOf(buf));
		removeCurrentBuffer();
	}
}
示例#20
0
文件: Document.cpp 项目: wibbe/zum
  std::vector<Index> selectedRows()
  {
    std::vector<Index> selection;

    Index const& start = currentBuffer().selectionStart_;
    const int height = currentBuffer().selectionEnd_.y - start.y;

    if (height == 0)
    {
      selection.push_back(currentBuffer().cursorPos_);
    }
    else
    {
      selection.reserve(height);

      for (int y = 0; y <= height; ++y)
        selection.emplace_back(start.x, start.y + y);
    }

    return selection;
  }
示例#21
0
文件: Document.cpp 项目: wibbe/zum
  std::vector<Index> selectedColumns()
  {
    std::vector<Index> selection;

    Index const& start = currentBuffer().selectionStart_;
    const int width = currentBuffer().selectionEnd_.x - start.x;

    if (width == 0)
    {
      selection.push_back(currentBuffer().cursorPos_);
    }
    else
    {
      selection.reserve(width);

      for (int x = 0; x <= width; ++x)
        selection.emplace_back(start.x + x, start.y);
    }

    return selection;
  }
示例#22
0
void BufferWidget::doBufferEncodingChanged(const QByteArray &e)
{
	const editor::Buffer *b =
	        dynamic_cast<const editor::Buffer *>(sender());
	if(b == nullptr)
		return;

	const editor::Buffer *current = currentBuffer();

	if(b == current)
		Q_EMIT(encodingChanged(e));
}
示例#23
0
void BufferWidget::doTabPathChanged(const QString &p)
{
	editor::Buffer *b = dynamic_cast<editor::Buffer *>(sender());

	if(b != NULL)
	{
		if(b == currentBuffer())
		{
			Q_EMIT pathChanged(p);
		}
	}
}
示例#24
0
uint SurfaceItem::textureId()
{
    if (advance()) {
        if (m_textureId)
            glDeleteTextures(1, &m_textureId);

        glGenTextures(1, &m_textureId);
        glBindTexture(GL_TEXTURE_2D, m_textureId);
        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
        currentBuffer().bindToTexture();
    }

    return m_textureId;
}
示例#25
0
文件: Document.cpp 项目: wibbe/zum
  std::vector<Index> selectedCells()
  {
    std::vector<Index> selection;

    Index const& start = currentBuffer().selectionStart_;

    const int width = currentBuffer().selectionEnd_.x - start.x;
    const int height = currentBuffer().selectionEnd_.y - start.y;

    selection.reserve(width * height);

    if (width == 0 && height == 0)
    {
      selection.push_back(currentBuffer().cursorPos_);
    }
    else
    {
      for (int y = 0; y <= height; ++y)
        for (int x = 0; x <= width; ++x)
          selection.emplace_back(start.x + x, start.y + y);
    }

      return selection;
  }
示例#26
0
文件: Document.cpp 项目: wibbe/zum
 static Document & currentDoc()
 {
   return currentBuffer().doc_;
 }
示例#27
0
文件: Document.cpp 项目: wibbe/zum
 bool hasSelection()
 {
   return currentBuffer().selectionStart_.x >= 0 && currentBuffer().selectionStart_.y >= 0;
 }
示例#28
0
文件: Document.cpp 项目: wibbe/zum
 Index & selectionEnd()
 {
   return currentBuffer().selectionEnd_;
 }
示例#29
0
文件: Document.cpp 项目: wibbe/zum
 Index & selectionStart()
 {
   return currentBuffer().selectionStart_;
 }
示例#30
0
文件: Document.cpp 项目: wibbe/zum
 Index & scroll()
 {
   return currentBuffer().scroll_;
 }