Ejemplo n.º 1
0
/**
 * Sets a bookmark at the given line.
 * @param	nLine	The line to mark
 */
void EditorPage::addBookmark(uint nLine)
{
	KTextEditor::MarkInterface *pMarkIf = 
        qobject_cast<KTextEditor::MarkInterface *>(m_pDoc);
	if (pMarkIf)
		pMarkIf->setMark(nLine, KTextEditor::MarkInterface::markType01);
}
Ejemplo n.º 2
0
// Set/clear a mark in a document
void DebuggerManager::setMark(const QString& filename, long line, bool set, int mark)
{
  if((!filename.isEmpty()) && ViewManager::ref()->isOpened(filename))
  {
    ::Document* qdoc = ViewManager::ref()->isOpened(filename)->document();
    if(qdoc)
    {
      disconnectBreakpointSignals(qdoc);

      KTextEditor::Document* doc = qdoc->doc();
      if(doc)
      {
        KTextEditor::MarkInterface *markIf = dynamic_cast<KTextEditor::MarkInterface*>(doc);
        if(markIf)
        {
          if(set)
            markIf->addMark(line, mark);
          else
            markIf->removeMark(line, mark);
        }
      }
      connectBreakpointSignals(qdoc);
    }
  }
}
Ejemplo n.º 3
0
void EditorPage::getBookmarks(FileListLocation& fll)
{
    KTextEditor::MarkInterface* pMarkIf;
    QHash<int, KTextEditor::Mark*> plMarks;
    KTextEditor::Mark* pMark;

    // Get the marks interface
    pMarkIf = dynamic_cast<KTextEditor::MarkInterface*>(m_pDoc);
    if (!pMarkIf)
        return;

    // Find all bookmarks
    plMarks = pMarkIf->marks();

    QHashIterator<int, KTextEditor::Mark*> i(plMarks);
    while (i.hasNext()) {
        i.next();
        fll.append(getFilePath(), i.key(), 0);
    }

    /*
    for (pMark = plMarks.first(); pMark; pMark = plMarks.next()) {
    	if (pMark->type == KTextEditor::MarkInterface::markType01)
    		fll.append(new FileLocation(getFilePath(), pMark->line, 0));
    }
    */

}
Ejemplo n.º 4
0
void EditorTabWidget::loadMarks(Document_t& d, KTextEditor::Document* doc)
{
  /*
    QString s = "result: ";
    for(int i = 0; i < d.marks.count(); i++) {
      s += "(" + QString::number((*(d.marks.at(i))).line+1) + ")*" + QString::number((*(d.marks.at(i))).type) + "*; ";
    }
    kdDebug() << s;
  */

  d.marks.clear();

  KTextEditor::MarkInterface* imark =
    dynamic_cast<KTextEditor::MarkInterface*>(doc);

  //this 'for' doesn't use first()/next() because it modifies the current item in the list
  //and it is already being used in the 'for' of slotMarkChanged()

  //QString s = "result: ";
  int size = imark->marks().count();
  for(int i = 0; i < size; i++) {
    //s += "(" + QString::number(m->line+1) + ")*" + QString::number(m->type) + "*; ";
    d.marks.append((*imark->marks().at(i)));
  }
  //kdDebug() << s;
}
Ejemplo n.º 5
0
void QXsldbgDoc::deleteBreakPoint(uint lineNumber)
{
    if (locked)
	return;

    KTextEditor::MarkInterface *markIf = KTextEditor::markInterface(kDoc);
    if (markIf)
	markIf->clearMark(lineNumber);
}
Ejemplo n.º 6
0
void EditorTabWidget::unmarkExecutionPoint(const QString& filePath, int line)
{
  KTextEditor::MarkInterface* imark = documentMarkIf(filePath);
  if(!imark) return;
  #if (KDE_VERSION_MAJOR >= 3) &&  (KDE_VERSION_MINOR >= 3)
    imark->removeMark(line-1, KTextEditor::MarkInterface::Execution);
   #else
    imark->removeMark(line-1, KTextEditor::MarkInterface::markType05);
  #endif
}
Ejemplo n.º 7
0
void EditorTabWidget::markDisabledBreakpoint(const QString& filePath, int line)
{
  KTextEditor::MarkInterface* imark = documentMarkIf(filePath);
  m_markGuard = true;
  if(!imark) return;
  #if (KDE_VERSION_MAJOR >= 3) &&  (KDE_VERSION_MINOR >= 3)
    imark->addMark(line-1, KTextEditor::MarkInterface::BreakpointDisabled);
  #else
    imark->addMark(line-1, KTextEditor::MarkInterface::markType04);
  #endif
  m_markGuard = false;
}
Ejemplo n.º 8
0
void QXsldbgDoc::addBreakPoint(uint lineNumber, bool enabled)
{
    if (locked)
	return;

    KTextEditor::MarkInterface *markIf = KTextEditor::markInterface(kDoc);
    if (markIf){
        if (enabled)
            markIf->setMark(lineNumber, KTextEditor::MarkInterface::BreakpointActive);
        else
            markIf->setMark(lineNumber, KTextEditor::MarkInterface::BreakpointDisabled);
    }
}
Ejemplo n.º 9
0
void QXsldbgDoc::enableBreakPoint(uint lineNumber, bool state)
{
    if (locked)
	return;

    KTextEditor::MarkInterface *markIf = KTextEditor::markInterface(kDoc);
    if (markIf){
	if (state){
	    markIf->setMark(lineNumber, KTextEditor::MarkInterface::BreakpointActive);
        }else{
	    markIf->removeMark(lineNumber, KTextEditor::MarkInterface::BreakpointDisabled);
        }
    }
}
Ejemplo n.º 10
0
void QXsldbgDoc::selectBreakPoint(uint lineNumber, bool reachedBreakPoint)
{
    if (locked)
	return;

    clearMarks(false);
    KTextEditor::MarkInterface *markIf = KTextEditor::markInterface(kDoc);
    if (markIf){
        if (reachedBreakPoint){
            //markIf->setMark(lineNumber, KTextEditor::MarkInterface::BreakpointReached);
        }else{
            markIf->setMark(lineNumber, KTextEditor::MarkInterface::Execution);
        }
    }
}
Ejemplo n.º 11
0
bool EditorTabWidget::hasBreakpointAt(const QString& filePath, int line)
{
  KTextEditor::MarkInterface* imark = documentMarkIf(filePath);
  #if (KDE_VERSION_MAJOR >= 3) &&  (KDE_VERSION_MINOR >= 3)
  return
    imark->mark(line-1) &
      (KTextEditor::MarkInterface::BreakpointDisabled |
       KTextEditor::MarkInterface::BreakpointActive);
  #else
  return
    imark->mark(line-1) &
      (KTextEditor::MarkInterface::markType04 |
       KTextEditor::MarkInterface::markType02);
  #endif
}
Ejemplo n.º 12
0
/**
 * Retrieves a list of all bookmarks in this page.
 */
void EditorPage::getBookmarks(FileLocationList& fll)
{
	KTextEditor::MarkInterface* pMarkIf;
	QPtrList<KTextEditor::Mark> plMarks;
	KTextEditor::Mark* pMark;
	
	// Get the marks interface
	pMarkIf = dynamic_cast<KTextEditor::MarkInterface*>(m_pDoc);
	if (!pMarkIf)
		return;
	
	// Find all bookmarks
	plMarks = pMarkIf->marks();
	for (pMark = plMarks.first(); pMark; pMark = plMarks.next()) {
		if (pMark->type == KTextEditor::MarkInterface::markType01)
			fll.append(new FileLocation(getFilePath(), pMark->line, 0));
	}
}
Ejemplo n.º 13
0
/**
 * Retrieves a list of all bookmarks in this page.
 */
void EditorPage::getBookmarks(FileLocationList& fll)
{
	// Get the marks interface
	KTextEditor::MarkInterface* pMarkIf;
	pMarkIf = qobject_cast<KTextEditor::MarkInterface*>(m_pDoc);
	if (!pMarkIf)
		return;

	// Find all bookmarks
	KTextEditor::Mark* pMark;
	QHashIterator<int, KTextEditor::Mark*> hItr(pMarkIf->marks());
	while(hItr.hasNext()) {
		hItr.next();
		pMark = hItr.value();
		if (pMark->type == KTextEditor::MarkInterface::markType01)
			fll.append(new FileLocation(getFilePath(), pMark->line, 0));
	}
}
Ejemplo n.º 14
0
void QXsldbgDoc::clearMarks(bool allMarkTypes)
{
    if (locked)
	return;

    KTextEditor::MarkInterface *markIf = KTextEditor::markInterface(kDoc);
    if (markIf){
        if (!allMarkTypes){
            QPtrList<KTextEditor::Mark> marks = markIf->marks();
            while ( marks.current()) {
                markIf->removeMark(marks.current()->line, KTextEditor::MarkInterface::Execution);
                markIf->removeMark(marks.current()->line, KTextEditor::MarkInterface::BreakpointReached);
                marks.next();
            }
        }else {
            markIf->clearMarks();
        }
    }

}
Ejemplo n.º 15
0
/**
 * Retrieves a list of all bookmarks in this page.
 */
void EditorPage::getBookmarks(FileLocationList& fll)
{
	KTextEditor::MarkInterface* pMarkIf;
	QList<KTextEditor::Mark *> plMarks;
	KTextEditor::Mark* pMark;
	
	// Get the marks interface
	pMarkIf = qobject_cast<KTextEditor::MarkInterface*>(m_pDoc);
	if (!pMarkIf)
		return;

	// Find all bookmarks
    const QHash<int, KTextEditor::Mark *> marks = pMarkIf->marks();
    QHashIterator<int, KTextEditor::Mark *> i(marks);

    while (i.hasNext()) {
        i.next();
        pMark = i.value();
		if (pMark->type == KTextEditor::MarkInterface::markType01)
			fll.append(new FileLocation(getFilePath(), pMark->line, 0));
    }
}
Ejemplo n.º 16
0
void EditorTabWidget::unmarkPreExecutionPoint(const QString& filePath, int line)
{
  KTextEditor::MarkInterface* imark = documentMarkIf(filePath);
  if(!imark) return;
  imark->removeMark(line-1, KTextEditor::MarkInterface::markType08);
}