minor bugfixing

svn path=/trunk/kdegraphics/kdvi/; revision=100499
remotes/origin/kdvi-2.2
Stefan Kebekus 25 years ago
parent 41918b2819
commit 8a005da82c
  1. 26
      dviwin.cpp
  2. 10
      dviwin.h
  3. 1
      dviwin_draw.cpp
  4. 23
      kdvi_multipage.cpp
  5. 2
      kdvi_multipage.h

@ -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());
}

@ -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);

@ -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;

@ -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);

@ -112,7 +112,7 @@ protected slots:
void bugform();
void preferencesChanged();
void goto_page(int page, int y);
void contents_of_dviwin_changed(void);
private:

Loading…
Cancel
Save