Skip to content

Commit

Permalink
apply style to Input cells when printing/exporting to pdf
Browse files Browse the repository at this point in the history
fix some other minor things
add short cut (Alt+P) for PDF export
  • Loading branch information
hkiel committed Jun 14, 2017
1 parent 3bfdad9 commit 48a8d49
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
8 changes: 0 additions & 8 deletions OMNotebook/OMNotebookGUI/cellfactory.cpp
Expand Up @@ -236,14 +236,6 @@ namespace IAEX
QObject::connect(text->output_, SIGNAL(undoAvailable(bool)), doc_, SIGNAL(undoAvailable(bool)));
QObject::connect(text->output_, SIGNAL(redoAvailable(bool)), doc_, SIGNAL(redoAvailable(bool)));

// if(CellDocument* d = dynamic_cast<CellDocument*>(doc_))
QObject::connect(doc_, SIGNAL(setAutoIndent(bool)), text->input_, SLOT(setAutoIndent(bool)));
QObject::connect(doc_, SIGNAL(setAutoIndent(bool)), text->output_, SLOT(setAutoIndent(bool)));

//QObject::connect(doc_, SIGNAL(evaluate()), text->input_, SIGNAL(eval()));
text->input_->setAutoIndent(dynamic_cast<CellDocument*>(doc_)->autoIndent);
text->output_->setAutoIndent(dynamic_cast<CellDocument*>(doc_)->autoIndent);

return text;
}

Expand Down
21 changes: 12 additions & 9 deletions OMNotebook/OMNotebookGUI/graphcell.cpp
Expand Up @@ -816,8 +816,8 @@ namespace IAEX {
//2005-12-29 AF
connect( input_, SIGNAL( textChanged() ), this, SLOT( addToHighlighter() ));
// 2006-01-17 AF, new...
connect( input_, SIGNAL( currentCharFormatChanged(const QTextCharFormat &) ),
this, SLOT( charFormatChanged(const QTextCharFormat &) ));
//connect( input_, SIGNAL( currentCharFormatChanged(const QTextCharFormat &) ),
// this, SLOT( charFormatChanged(const QTextCharFormat &) ));
// 2006-04-27 AF,
connect( input_, SIGNAL( forwardAction(int) ), this, SIGNAL( forwardAction(int) ));

Expand Down Expand Up @@ -962,13 +962,16 @@ namespace IAEX {
*/
QString GraphCell::textHtml()
{
QString content;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
content = input_->toPlainText().toHtmlEscaped();
#else
content = Qt::escape(input_->toPlainText());
#endif
return "<html><body><pre>"+content+"</pre></body></html>";
Stylesheet *sheet = Stylesheet::instance( "stylesheet.xml" );
CellStyle style = sheet->getStyle( "Input" );

QTextEdit te;
te.setPlainText(input_->toPlainText());
te.selectAll();
te.mergeCurrentCharFormat( (*style_.textCharFormat()) );
te.document()->rootFrame()->setFrameFormat( (*style_.textFrameFormat()) );

return te.toHtml();
}

/*!
Expand Down
1 change: 0 additions & 1 deletion OMNotebook/OMNotebookGUI/latexcell.h
Expand Up @@ -165,7 +165,6 @@ namespace IAEX
public slots:
void updatePosition();
void setModified();
void setAutoIndent(bool) {};

signals:
void clickOnCell();
Expand Down
1 change: 1 addition & 0 deletions OMNotebook/OMNotebookGUI/notebook.cpp
Expand Up @@ -565,6 +565,7 @@ void NotebookWindow::createFileMenu()

// PDF
pdfAction = new QAction( tr("P&DF"), this );
pdfAction->setShortcut( QKeySequence("Alt+P") );
pdfAction->setStatusTip( tr("Export the document to PDF") );
connect(pdfAction, SIGNAL(triggered()), this, SLOT(pdf()));
exportMenu->addAction(pdfAction);
Expand Down

0 comments on commit 48a8d49

Please sign in to comment.