|
|
|
@ -97,9 +97,7 @@ extern void qt_processEvents(void) |
|
|
|
|
|
|
|
|
|
|
|
//------ now comes the dviWindow class implementation ----------
|
|
|
|
//------ now comes the dviWindow class implementation ----------
|
|
|
|
|
|
|
|
|
|
|
|
dviWindow::dviWindow( int bdpi, const char *mfm, const char *ppr, |
|
|
|
dviWindow::dviWindow( int bdpi, const char *mfm, const char *ppr, int mkpk, QWidget *parent, const char *name ) : QScrollView( parent, name ) |
|
|
|
int mkpk, QWidget *parent, const char *name ) |
|
|
|
|
|
|
|
: QScrollView( parent, name ) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
ChangesPossible = 1; |
|
|
|
ChangesPossible = 1; |
|
|
|
FontPath = QString::null; |
|
|
|
FontPath = QString::null; |
|
|
|
@ -366,24 +364,23 @@ void dviWindow::initDVI() |
|
|
|
#include <setjmp.h> |
|
|
|
#include <setjmp.h> |
|
|
|
extern jmp_buf dvi_env; /* mechanism to communicate dvi file errors */ |
|
|
|
extern jmp_buf dvi_env; /* mechanism to communicate dvi file errors */ |
|
|
|
extern char *dvi_oops_msg; |
|
|
|
extern char *dvi_oops_msg; |
|
|
|
extern time_t dvi_time; |
|
|
|
extern QDateTime dvi_time; |
|
|
|
|
|
|
|
|
|
|
|
//------ this function calls the dvi interpreter ----------
|
|
|
|
//------ this function calls the dvi interpreter ----------
|
|
|
|
|
|
|
|
|
|
|
|
void dviWindow::drawDVI() |
|
|
|
|
|
|
|
|
|
|
|
void dviWindow::drawPage() |
|
|
|
{ |
|
|
|
{ |
|
|
|
psp_interrupt(); |
|
|
|
psp_interrupt(); |
|
|
|
if (filename.isEmpty()) // must call setFile first
|
|
|
|
if (filename.isEmpty()) // must call setFile first
|
|
|
|
return; |
|
|
|
return; |
|
|
|
if (!dvi_name) |
|
|
|
if (!dvi_name) { // dvi file not initialized yet
|
|
|
|
{ // dvi file not initialized yet
|
|
|
|
|
|
|
|
QApplication::setOverrideCursor( waitCursor ); |
|
|
|
QApplication::setOverrideCursor( waitCursor ); |
|
|
|
dvi_name = const_cast<char*>(filename.ascii()); |
|
|
|
dvi_name = const_cast<char*>(filename.ascii()); |
|
|
|
|
|
|
|
|
|
|
|
dvi_file = NULL; |
|
|
|
dvi_file = NULL; |
|
|
|
if (setjmp(dvi_env)) |
|
|
|
if (setjmp(dvi_env)) { // dvi_oops called
|
|
|
|
{ // dvi_oops called
|
|
|
|
dvi_time.setTime_t(0); // force init_dvi_file
|
|
|
|
dvi_time = 0; // force init_dvi_file
|
|
|
|
|
|
|
|
QApplication::restoreOverrideCursor(); |
|
|
|
QApplication::restoreOverrideCursor(); |
|
|
|
KMessageBox::error( this, |
|
|
|
KMessageBox::error( this, |
|
|
|
i18n("What's this? DVI problem!\n") |
|
|
|
i18n("What's this? DVI problem!\n") |
|
|
|
@ -392,7 +389,6 @@ void dviWindow::drawDVI() |
|
|
|
} |
|
|
|
} |
|
|
|
if ( !check_dvi_file() ) |
|
|
|
if ( !check_dvi_file() ) |
|
|
|
emit fileChanged(); |
|
|
|
emit fileChanged(); |
|
|
|
|
|
|
|
|
|
|
|
QApplication::restoreOverrideCursor(); |
|
|
|
QApplication::restoreOverrideCursor(); |
|
|
|
gotoPage(1); |
|
|
|
gotoPage(1); |
|
|
|
changePageSize(); |
|
|
|
changePageSize(); |
|
|
|
@ -405,25 +401,22 @@ void dviWindow::drawDVI() |
|
|
|
max_x = page_w; |
|
|
|
max_x = page_w; |
|
|
|
max_y = page_h; |
|
|
|
max_y = page_h; |
|
|
|
|
|
|
|
|
|
|
|
if ( !pixmap ) return; |
|
|
|
if ( !pixmap ) |
|
|
|
if ( !pixmap->paintingActive() ) |
|
|
|
return; |
|
|
|
{ |
|
|
|
if ( !pixmap->paintingActive() ) { |
|
|
|
QPainter paint; |
|
|
|
QPainter paint; |
|
|
|
paint.begin( pixmap ); |
|
|
|
paint.begin( pixmap ); |
|
|
|
QApplication::setOverrideCursor( waitCursor ); |
|
|
|
QApplication::setOverrideCursor( waitCursor ); |
|
|
|
dcp = &paint; |
|
|
|
dcp = &paint; |
|
|
|
if (setjmp(dvi_env)) |
|
|
|
if (setjmp(dvi_env)) { // dvi_oops called
|
|
|
|
{ // dvi_oops called
|
|
|
|
dvi_time.setTime_t(0); // force init_dvi_file
|
|
|
|
dvi_time = 0; // force init_dvi_file
|
|
|
|
|
|
|
|
QApplication::restoreOverrideCursor(); |
|
|
|
QApplication::restoreOverrideCursor(); |
|
|
|
paint.end(); |
|
|
|
paint.end(); |
|
|
|
KMessageBox::error( this, |
|
|
|
KMessageBox::error( this, |
|
|
|
i18n("What's this? DVI problem!\n")
|
|
|
|
i18n("What's this? DVI problem!\n")
|
|
|
|
+ dvi_oops_msg); |
|
|
|
+ dvi_oops_msg); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} else { |
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if ( !check_dvi_file() ) |
|
|
|
if ( !check_dvi_file() ) |
|
|
|
emit fileChanged(); |
|
|
|
emit fileChanged(); |
|
|
|
pixmap->fill( white ); |
|
|
|
pixmap->fill( white ); |
|
|
|
@ -432,13 +425,7 @@ void dviWindow::drawDVI() |
|
|
|
QApplication::restoreOverrideCursor(); |
|
|
|
QApplication::restoreOverrideCursor(); |
|
|
|
paint.end(); |
|
|
|
paint.end(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight(), FALSE); |
|
|
|
|
|
|
|
|
|
|
|
void dviWindow::drawPage() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
drawDVI(); |
|
|
|
|
|
|
|
repaintContents(contentsX(), contentsY(),
|
|
|
|
|
|
|
|
visibleWidth(), visibleHeight(), FALSE); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool dviWindow::changedDVI() |
|
|
|
bool dviWindow::changedDVI() |
|
|
|
@ -462,6 +449,7 @@ bool dviWindow::correctDVI() |
|
|
|
// We suppose now that the dvi file is complete and OK
|
|
|
|
// We suppose now that the dvi file is complete and OK
|
|
|
|
return TRUE; |
|
|
|
return TRUE; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void dviWindow::timerEvent() |
|
|
|
void dviWindow::timerEvent() |
|
|
|
{ |
|
|
|
{ |
|
|
|
static int changing = 0; |
|
|
|
static int changing = 0; |
|
|
|
@ -476,6 +464,7 @@ void dviWindow::timerEvent() |
|
|
|
changing = 0; |
|
|
|
changing = 0; |
|
|
|
emit statusChange( i18n("File reloaded.") ); |
|
|
|
emit statusChange( i18n("File reloaded.") ); |
|
|
|
changetime = QFileInfo(filename).lastModified(); |
|
|
|
changetime = QFileInfo(filename).lastModified(); |
|
|
|
|
|
|
|
|
|
|
|
drawPage(); |
|
|
|
drawPage(); |
|
|
|
emit fileChanged(); |
|
|
|
emit fileChanged(); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -630,9 +619,7 @@ void dviWindow::contentsMoving( int x, int y ) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void dviWindow::drawContents(QPainter *p,
|
|
|
|
void dviWindow::drawContents(QPainter *p, int clipx, int clipy, int clipw, int cliph )
|
|
|
|
int clipx, int clipy,
|
|
|
|
|
|
|
|
int clipw, int cliph )
|
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
if ( pixmap ) |
|
|
|
if ( pixmap ) |
|
|
|
p->drawPixmap(clipx, clipy, *pixmap, clipx, clipy, clipw, cliph); |
|
|
|
p->drawPixmap(clipx, clipy, *pixmap, clipx, clipy, clipw, cliph); |
|
|
|
|