From 8a005da82c86dc658fdc38c58b55a302f2aa886a Mon Sep 17 00:00:00 2001 From: Stefan Kebekus Date: Tue, 5 Jun 2001 07:25:25 +0000 Subject: [PATCH] minor bugfixing svn path=/trunk/kdegraphics/kdvi/; revision=100499 --- dviwin.cpp | 26 +++++++++++++++++++++++++- dviwin.h | 10 +++++++--- dviwin_draw.cpp | 1 - kdvi_multipage.cpp | 23 +++++++++++++++-------- kdvi_multipage.h | 2 +- 5 files changed, 48 insertions(+), 14 deletions(-) diff --git a/dviwin.cpp b/dviwin.cpp index c3e53a5f8..d581dfe8b 100644 --- a/dviwin.cpp +++ b/dviwin.cpp @@ -214,6 +214,28 @@ void dviWindow::exportPDF(void) if (dviFile == NULL) return; + // Is the dvipdfm-Programm available ?? + QStringList texList = QStringList::split(":", QString::fromLocal8Bit(getenv("PATH"))); + bool found = false; + for (QStringList::Iterator it=texList.begin(); it!=texList.end(); ++it) { + QString temp = (*it) + "/" + "dvipdfm"; + if (QFile::exists(temp)) { + found = true; + break; + } + } + if (found == false) { + KMessageBox::sorry(0, i18n("KDVI could not locate the program 'dvipdfm' on your computer. That program is\n" + "absolutely needed by the export function. You can, however, convert\n" + "the DVI-file to PDF using the print function of KDVI, but that will often\n" + "produce which print ok, but are of inferior quality if viewed in the \n" + "Acrobat Reader. It may be wise to upgrade to a more recent version of your\n" + "TeX distribution which includes the 'dvipdfm' program.\n\n" + "Hint to the perplexed system administrator: KDVI uses the shell's PATH variable\n" + "when looking for programs.")); + return; + } + QString fileName = KFileDialog::getSaveFileName(QString::null, "*.pdf|Portable Document Format (*.pdf)", this, i18n("Export File As")); if (fileName.isEmpty()) return; @@ -331,6 +353,7 @@ void dviWindow::exportPS(QString fname, QString options, KPrinter *printer) proc->clearArguments(); QFileInfo finfo(dviFile->filename); *proc << QString("cd %1; dvips").arg(KShellProcess::quote(finfo.dirPath(true))); + *proc << "-z"; // export Hyperlinks if (options.isEmpty() == false) *proc << options; *proc << QString("%1").arg(KShellProcess::quote(dviFile->filename)); @@ -461,7 +484,7 @@ void dviWindow::drawPage() setCursor(arrowCursor); - // Stop any animation may be in progress + // Stop any animation which may be in progress if (timerIdent != 0) { killTimer(timerIdent); timerIdent = 0; @@ -500,6 +523,7 @@ void dviWindow::drawPage() } resize(pixmap->width(), pixmap->height()); repaint(); + emit(contents_changed()); } diff --git a/dviwin.h b/dviwin.h index d6327087e..75de30a34 100644 --- a/dviwin.h +++ b/dviwin.h @@ -119,11 +119,15 @@ public slots: void dvips_terminated(KProcess *); signals: - /// Emitted to indicate that a hyperlink has been clicked on, and - //that the widget requests that the controlling program goes to the - //page and the coordinates specified. + /** Emitted to indicate that a hyperlink has been clicked on, and + that the widget requests that the controlling program goes to the + page and the coordinates specified. */ void request_goto_page(int page, int y); + /** Emitted to indicate the the contents of the widget has changed + and that the tumbnail image should be updated. */ + void contents_changed(void); + protected: void paintEvent(QPaintEvent *ev); diff --git a/dviwin_draw.cpp b/dviwin_draw.cpp index 6eb600f3c..cac2a541a 100644 --- a/dviwin_draw.cpp +++ b/dviwin_draw.cpp @@ -217,7 +217,6 @@ void dviWindow::set_char(unsigned int cmd, unsigned int ch) DVI_H += g->dvi_adv; } - void dviWindow::set_empty_char(unsigned int cmd, unsigned int ch) { return; diff --git a/kdvi_multipage.cpp b/kdvi_multipage.cpp index 76c6af17c..a9ab25a5f 100644 --- a/kdvi_multipage.cpp +++ b/kdvi_multipage.cpp @@ -91,6 +91,7 @@ KDVIMultiPage::KDVIMultiPage(QWidget *parentWidget, const char *widgetName, QObj scrollView()->addChild(window); connect(window, SIGNAL(request_goto_page(int, int)), this, SLOT(goto_page(int, int) ) ); + connect(window, SIGNAL(contents_changed(void)), this, SLOT(contents_of_dviwin_changed(void)) ); readSettings(); enableActions(false); @@ -113,20 +114,26 @@ bool KDVIMultiPage::openFile() bool r = window->setFile(m_file); window->gotoPage(1); window->changePageSize(); // This also calles drawPage(); - + emit numberOfPages(window->totalPages()); - scrollView()->resizeContents(window->width(), window->height()); - emit previewChanged(true); + // scrollView()->resizeContents(window->width(), window->height()); + // @@@emit previewChanged(true); enableActions(r); return r; } +void KDVIMultiPage::contents_of_dviwin_changed(void) +{ + emit previewChanged(true); +} + + bool KDVIMultiPage::closeURL() { window->setFile(""); // That means: close the file. Resize the widget to 0x0. - emit previewChanged(false); + //@@@ emit previewChanged(false); enableActions(false); return true; } @@ -144,7 +151,7 @@ bool KDVIMultiPage::gotoPage(int page) { window->gotoPage(page+1); - emit previewChanged(true); + //@@@ emit previewChanged(true); return true; } @@ -154,7 +161,7 @@ void KDVIMultiPage::goto_page(int page, int y) window->gotoPage(page+1, y); scrollView()->ensureVisible(scrollView()->width()/2, y ); - emit previewChanged(true); + //@@@ emit previewChanged(true); emit pageInfo(window->totalPages(), page ); } @@ -476,8 +483,8 @@ void KDVIMultiPage::reload() // exist. In that case, gotoPage already selected another page. emit pageInfo(window->totalPages(), window->curr_page()-1 ); - // scrollView()->resizeContents(window->width(), window->height()); - emit previewChanged(true); + //@@@ scrollView()->resizeContents(window->width(), window->height()); + //@@@ emit previewChanged(true); } else { if (timer_id == -1) timer_id = startTimer(1000); diff --git a/kdvi_multipage.h b/kdvi_multipage.h index 51bbff213..03ff5b774 100644 --- a/kdvi_multipage.h +++ b/kdvi_multipage.h @@ -112,7 +112,7 @@ protected slots: void bugform(); void preferencesChanged(); void goto_page(int page, int y); - + void contents_of_dviwin_changed(void); private: