コード例 #1
0
ファイル: qspeditor.cpp プロジェクト: nzarko/pascal-dev
void QSPEditor::print()
{
    QsciPrinter prn;
    QPrintDialog dlg(&prn, this);
    if (dlg.exec() == QDialog::Accepted) {
        prn.setWrapMode(QsciScintilla::WrapWord);

        int line1(-1), line2(-1), col1(-1), col2(-1);
        //        JuffScintilla* edit = getActiveEdit();
        //        if ( edit ) {
        //            QsciLexer* lexer = edit->lexer();
        //            if ( !PrintSettings::keepBgColor() ) {
        //                lexer->setDefaultPaper(Qt::white);
        //                lexer->setPaper(Qt::white);
        //                lexer->setDefaultColor(Qt::black);
        //            }
        //            if ( !PrintSettings::keepColors() ) {
        //                lexer->setColor(Qt::black);
        //            }
        getSelection(&line1, &col1, &line2, &col2);
        if (line1 >=0 && line2 >= 0 && col1 >= 0 && col2 >= 0) {
            //	We have selection. Print it.

            --line2;
            prn.printRange(this, line1, line2);
        }
        else {
            //	We don't have selection. Print the whole text.
            prn.printRange(this, 0);
        }
        //            QFont font = TextDocSettings::font();
        //            LexerStorage::instance()->updateLexers(font);
    }
}
コード例 #2
0
ファイル: SciDoc.cpp プロジェクト: MikeTekOn/juffed
void SciDoc::print() {
	QsciPrinter prn;
	QPrintDialog dlg(&prn, this);
	if (dlg.exec() == QDialog::Accepted) {
		prn.setWrapMode(EditorSettings::get(EditorSettings::WrapWords) || PrintSettings::get(PrintSettings::AlwaysWrap) ? QsciScintilla::WrapWord : QsciScintilla::WrapNone);

		int line1(-1), line2(-1), col1(-1), col2(-1);
		JuffScintilla* edit = int_->curEdit_;
		if ( edit ) {
			QsciLexer* lexer = edit->lexer();
			if ( !PrintSettings::get(PrintSettings::KeepBgColor) ) {
				lexer->setDefaultPaper(Qt::white);
				lexer->setPaper(Qt::white);
				lexer->setDefaultColor(Qt::black);
			}
			if ( !PrintSettings::get(PrintSettings::KeepColors) ) {
				lexer->setColor(Qt::black);
			}
			edit->getSelection(&line1, &col1, &line2, &col2);
			if (line1 >=0 && line2 >= 0 && col1 >= 0 && col2 >= 0) {
				//	We have selection. Print it.

				--line2;
				prn.printRange(edit, line1, line2);
			}
			else {
				//	We don't have selection. Print the whole text.
				prn.printRange(edit, 0);
			}
			QFont font = EditorSettings::font();
			LexerStorage::instance()->updateLexers(font);
		}
	}
}
コード例 #3
0
ファイル: document_editor.cpp プロジェクト: jzsun/raptor
void DocumentEditor::print(bool quick_) {
	// get printer
	QsciPrinter p;
	// set wrapmode
	p.setWrapMode(WrapWord);

	// if quick print
	if (quick_) {
		// check if default printer is set
		if ( p.printerName().isEmpty() ) {
			QMessageBox::warning(this, PACKAGE_NAME, tr( "There is no default printer, please set one before trying quick print" ));
			return;
		}

		// print and return
		p.printRange(this);
		return;
	}

	// printer dialog
	QPrintDialog d(&p);

	// if ok
	if (d.exec()) {
		// print
		int f = -1, t = -1, i;
		if ( d.printRange() == QPrintDialog::Selection )
			getSelection( &f, &i, &t, &i );
		p.printRange( this, f, t );
	}
}
コード例 #4
0
ファイル: pEditor.cpp プロジェクト: pasnox/monkeystudio2
void pEditor::print( bool b )
{
    // get printer
    QsciPrinter p;

    // set wrapmode
    p.setWrapMode( WrapWord );

    // if quick print
    if ( b )
    {
        // check if default printer is set
        if ( p.printerName().isEmpty() )
        {
            MonkeyCore::messageManager()->appendMessage( tr( "There is no default printer, please set one before trying quick print" ) );
            return;
        }
        
        // print and return
        p.printRange( this );
        return;
    }

    // printer dialog
    QPrintDialog d( &p );

    // if ok
    if ( d.exec() )
    {
        // print
        int f = -1, t = -1, i;
        if ( d.printRange() == QPrintDialog::Selection )
            getSelection( &f, &i, &t, &i );
        p.printRange( this, f, t );
    }
}