Beispiel #1
0
//////////////////////////////////////////////////////////////////////
// Function Name:	Refresh	
// Description:		
// Parameters:		
// Data IN/OUT:		
// Return:		
// Notes:		
//////////////////////////////////////////////////////////////////////
void CListFrame::refresh(void)
{
	if( m_pcWindow == NULL) return;
	//TRACE("[CListFrame]->Refresh\r\n");

	//Paint List
	refreshTitle();
	refreshScroll();
	refreshHeaderList();
	refreshList();
}
Beispiel #2
0
//////////////////////////////////////////////////////////////////////
// Function Name:	setSelectedLine	
// Description:		
// Parameters:		
// Data IN/OUT:		
// Return:		
// Notes:		
//////////////////////////////////////////////////////////////////////
bool CListFrame::setSelectedLine(int selection)
{
	//TRACE("[CListFrame]->setSelectedLine %d \r\n",selection);
	bool result = false;
	if(selection >= 0 && selection < m_nNrOfLines)
	{ 
		m_nSelectedLine = selection;
		m_nCurrentPage =  selection / m_nLinesPerPage;
		m_nCurrentLine = m_nCurrentPage * m_nLinesPerPage;
		refreshList();
		refreshScroll();  //NEW
		result = true;
		//TRACE(" selected line: %d,%d,%d \r\n",m_nSelectedLine,m_nCurrentPage,m_nCurrentLine);
	}
	
	return (result);
}
Beispiel #3
0
CodeEditor::CodeEditor(QWidget *parent) :
    QTextEdit(parent)
{


    setAcceptRichText(false);
    setTabStopWidth(40);
    SHL = new SyntaxHL(this); //Adding syntax highlighter.

    //Auto-complete setup:

    compList << "add"
             << "addu"
             << "sub"
             << "subu"
             << "and"
             << "or"
             << "xor"
             << "srlv"
             << "sllv"
             << "srav"
             << "slt"
             << "sltu"
             << "addi"
             << "addiu"
             << "andi"
             << "ori"
             << "nori"
             << "xori"
             << "srl"
             << "sll"
             << "sra"
             << "slti"
             << "sltiu"
             << "beq"
             << "bne"
             << "lui"
             << "sb"
             << "lb"
             << "lbu"
             << "sh"
             << "lh"
             << "lhu"
             << "sw"
             << "lw"
             << "lwl"
             << "lwr"
             << "swl"
             << "swr"
             <<"ll"
            << "sc"
            << "jr"
            << "jalr"
            << "mfhi"
            << "mflo"
            << "mthi"
            << "mtlo"
            << "mult"
            << "multu"
            << "div"
            << "divu"
            << "j"
            << "jal"
            << "syscall"
            << "nop";

    //for (int i = 0; i < 32; i++) compList.append(QString("$" + QString::number(i)));
    compList << "$0"
             << "$zero"
             << "$at"
             << "$v0"
             << "$v1"
             <<"$a0"
            << "$a1"
            << "$a2"
            << "$a3"
            << "$t0"
            << "$t1"
            << "$t2"
            << "$t3"
            << "$t4"
            << "$t5"
            << "$t6"
            << "$t7"
            << "$s0"
            << "$s1"
            << "$s2"
            << "$s3"
            << "$s4"
            << "$s5"
            << "$s6"
            << "$s7"
            << "$t8"
            << "$t9"
            << "$gp"
            << "$fp"
            << "$ra"
            << "$sp";

    compList << "blt"  <<  "bgt"
             <<  "ble"
             <<  "bge"
             <<  "bltu"
             <<  "bgtu"
             <<  "bleu"
             <<  "bgeu"
             <<  "blti"
             <<  "bgti"
             <<  "blei"
             <<  "bgei"
             <<  "bltiu"
             <<  "bgtiu"
             <<  "bleiu"
             <<  "bgeiu"
             <<  "beqz"
             <<  "bnez"
             <<  "bltz"
             <<  "bgtz"
             <<  "blez"
             <<  "bgez"
             <<  "li"
             <<  "ror"
             <<  "rol"
             <<  "not"
             <<  "neg"
             <<  "move"
             <<  "abs"
             <<  "mul"
             <<  "div"
             <<  "rem"
             <<  "clear"
             <<  "subi"
             <<  "la"
             << ".align" << ".ascii" << ".asciiz" << ".byte" << ".double" <<".float" << ".half" << ".space" << ".word";

    lCounter = NULL;

    model = new QStringListModel(compList, this);

    codeCompleter = new QCompleter(model, this);
    codeCompleter->setCompletionMode(QCompleter::PopupCompletion);
    CompleterList *cl = new CompleterList(this);
    codeCompleter->setPopup(cl);
    codeCompleter->setCaseSensitivity(Qt::CaseInsensitive);
    codeCompleter->setWidget(this);

    QObject::connect(codeCompleter, SIGNAL(activated(QString)), this, SLOT(insertCompletion(QString)));
    QObject::connect(this, SIGNAL(textChanged()), this, SLOT(updateCounter()));
    QObject::connect(this, SIGNAL(textChanged()), this, SLOT(refreshScroll()));
    QObject::connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(refreshScroll()));
    QObject::connect(this, SIGNAL(textChanged()), this, SLOT(completerPop()));    
    QObject::connect(this, SIGNAL(selectionChanged()), this, SLOT(highlightLine()));
    QObject::connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightLine()));
    QObject::connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(updateCounterFormat()));
    QObject::connect(this, SIGNAL(textChanged()), this, SLOT(updateCounterFormat()));
    selectionStart = selectionEnd = 0;

}