mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-25 02:45:38 +00:00
source code cleanup
svn path=/trunk/kdegraphics/kdvi/; revision=118480
This commit is contained in:
parent
3985abe351
commit
eee67d3fe5
|
@ -13,7 +13,7 @@ noinst_PROGRAMS = squeeze
|
|||
METASOURCES = AUTO
|
||||
|
||||
libkdvi_la_SOURCES = kdvi_multipage.cpp \
|
||||
dviwin.cpp \
|
||||
dviwin.cpp bigEndianByteReader.cpp \
|
||||
optiondialog.cpp infodialog.cpp\
|
||||
psheader.c dviwin_draw.cpp dvi_init.cpp\
|
||||
font.cpp fontpool.cpp fontprogress.cpp pk.cpp psgs.cpp\
|
||||
|
|
75
bigEndianByteReader.cpp
Normal file
75
bigEndianByteReader.cpp
Normal file
|
@ -0,0 +1,75 @@
|
|||
// Copyright notice missing.
|
||||
|
||||
#include "bigEndianByteReader.h"
|
||||
#include "dvi.h"
|
||||
|
||||
Q_UINT8 bigEndianByteReader::readUINT8(void)
|
||||
{
|
||||
// This check saveguards us against segmentation fault. It is also
|
||||
// necessary for virtual fonts, which do not end whith EOP.
|
||||
if (command_pointer >= end_pointer)
|
||||
return EOP;
|
||||
|
||||
return *(command_pointer++);
|
||||
}
|
||||
|
||||
Q_UINT16 bigEndianByteReader::readUINT16(void)
|
||||
{
|
||||
// This check saveguards us against segmentation fault. It is also
|
||||
// necessary for virtual fonts, which do not end whith EOP.
|
||||
if (command_pointer >= end_pointer)
|
||||
return EOP;
|
||||
|
||||
Q_UINT16 a;
|
||||
a = *(command_pointer++);
|
||||
a = (a << 8) | *(command_pointer++);
|
||||
return a;
|
||||
}
|
||||
|
||||
Q_UINT32 bigEndianByteReader::readUINT32(void)
|
||||
{
|
||||
// This check saveguards us against segmentation fault. It is also
|
||||
// necessary for virtual fonts, which do not end whith EOP.
|
||||
if (command_pointer >= end_pointer)
|
||||
return EOP;
|
||||
|
||||
Q_UINT32 a;
|
||||
a = *(command_pointer++);
|
||||
a = (a << 8) | *(command_pointer++);
|
||||
a = (a << 8) | *(command_pointer++);
|
||||
a = (a << 8) | *(command_pointer++);
|
||||
return a;
|
||||
}
|
||||
|
||||
Q_UINT32 bigEndianByteReader::readUINT(Q_UINT8 size)
|
||||
{
|
||||
// This check saveguards us against segmentation fault. It is also
|
||||
// necessary for virtual fonts, which do not end whith EOP.
|
||||
if (command_pointer >= end_pointer)
|
||||
return EOP;
|
||||
|
||||
Q_UINT32 a = 0;
|
||||
while (size > 0) {
|
||||
a = (a << 8) + *(command_pointer++);
|
||||
size--;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
Q_INT32 bigEndianByteReader::readINT(Q_UINT8 length)
|
||||
{
|
||||
// This check saveguards us against segmentation fault. It is also
|
||||
// necessary for virtual fonts, which do not end whith EOP.
|
||||
if (command_pointer >= end_pointer)
|
||||
return EOP;
|
||||
|
||||
Q_INT32 a = *(command_pointer++);
|
||||
|
||||
if (a & 0x80)
|
||||
a -= 0x100;
|
||||
|
||||
while ((--length) > 0)
|
||||
a = (a << 8) | *(command_pointer++);
|
||||
|
||||
return a;
|
||||
}
|
59
bigEndianByteReader.h
Normal file
59
bigEndianByteReader.h
Normal file
|
@ -0,0 +1,59 @@
|
|||
/* This file is part of KDVI (C) 2001 by Stefan Kebekus (kebekus@kde.org)
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License
|
||||
as published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Byte reading routines which read big endian numbers from memory and
|
||||
* convert them to native integers.
|
||||
*
|
||||
* @author Stefan Kebekus (kebekus@kde.org)
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef _bigEndianByteReader_H
|
||||
#define _bigEndianByteReader_H
|
||||
|
||||
#include <qglobal.h>
|
||||
|
||||
class bigEndianByteReader {
|
||||
public:
|
||||
/** Set this pointer to the location where the number resides which
|
||||
you want to read. */
|
||||
Q_UINT8 * command_pointer;
|
||||
|
||||
/** This pointer marks the end of the memory area where bytes can be
|
||||
read. It should point to the first byte which CANNOT be
|
||||
read. The idea is to have a safety net which protects us against
|
||||
SEGFAULTs. This is also used in virtual fonts, where the macro
|
||||
does not have an EOP command at the end of the macro. */
|
||||
Q_UINT8 * end_pointer;
|
||||
|
||||
/** If command_pointer >= end_pointer, this method return EOP (=140)
|
||||
and exists. Otherwise, the method returns the unsigned byte
|
||||
and increases the command_pointer by one. */
|
||||
Q_UINT8 readUINT8(void);
|
||||
|
||||
/** Similar to the method above, only that the method reads a big
|
||||
endian 2-byte word and increases the pointer by two. */
|
||||
Q_UINT16 readUINT16(void);
|
||||
|
||||
/** Similar to the method above, only that the method reads a big
|
||||
endian 4-byte word and increases the pointer by four. */
|
||||
Q_UINT32 readUINT32(void);
|
||||
|
||||
/** Similar to the method above, only that the method reads a big
|
||||
endian number of length size, where 1 <= size <= 4. Note that
|
||||
the value 3 is allowed (and is acually used in DVI files)!!! */
|
||||
Q_UINT32 readUINT(Q_UINT8 size);
|
||||
|
||||
/** Similar to the method above, only that the method reads a SIGNED
|
||||
number */
|
||||
Q_INT32 readINT(Q_UINT8);
|
||||
|
||||
};
|
||||
|
||||
#endif //ifndef _bigEndianByteReader_H
|
71
dvi_init.cpp
71
dvi_init.cpp
|
@ -74,55 +74,6 @@ extern "C" {
|
|||
#define dvi_oops(str) (dvi_oops_msg = (str.utf8()), longjmp(dvi_env, 1))
|
||||
|
||||
|
||||
Q_UINT8 dvifile::readUINT8(void)
|
||||
{
|
||||
return *(command_pointer++);
|
||||
}
|
||||
|
||||
Q_UINT16 dvifile::readUINT16(void)
|
||||
{
|
||||
Q_UINT16 a;
|
||||
a = *(command_pointer++);
|
||||
a = (a << 8) | *(command_pointer++);
|
||||
return a;
|
||||
}
|
||||
|
||||
Q_UINT32 dvifile::readUINT32(void)
|
||||
{
|
||||
Q_UINT32 a;
|
||||
a = *(command_pointer++);
|
||||
a = (a << 8) | *(command_pointer++);
|
||||
a = (a << 8) | *(command_pointer++);
|
||||
a = (a << 8) | *(command_pointer++);
|
||||
return a;
|
||||
}
|
||||
|
||||
Q_UINT32 dvifile::readUINT(Q_UINT8 size)
|
||||
{
|
||||
Q_UINT32 a = 0;
|
||||
while (size > 0) {
|
||||
a = (a << 8) + *(command_pointer++);
|
||||
size--;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
Q_INT32 dvifile::readINT(Q_UINT8 length)
|
||||
{
|
||||
Q_UINT32 a = 0;
|
||||
|
||||
|
||||
Q_UINT8 byte = *(command_pointer++);
|
||||
a = byte;
|
||||
if (a & 0x80)
|
||||
a -= 0x100;
|
||||
|
||||
while ((--length) > 0) {
|
||||
byte = *(command_pointer++);
|
||||
a = (a << 8) | byte;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
void dvifile::process_preamble(void)
|
||||
{
|
||||
|
@ -171,8 +122,8 @@ void dvifile::find_postamble(void)
|
|||
|
||||
// And this is finally the pointer to the beginning of the postamble
|
||||
command_pointer -= 4;
|
||||
long pos = readUINT32();
|
||||
command_pointer = dvi_Data + pos;
|
||||
beginning_of_postamble = readUINT32();
|
||||
command_pointer = dvi_Data + beginning_of_postamble;
|
||||
}
|
||||
|
||||
|
||||
|
@ -239,9 +190,15 @@ void dvifile::prepare_pages()
|
|||
kdDebug() << "prepare_pages" << endl;
|
||||
#endif
|
||||
|
||||
page_offset = new Q_UINT32[total_pages];
|
||||
Q_UINT16 i = total_pages-1;
|
||||
page_offset[i] = last_page_offset;
|
||||
page_offset = new Q_UINT32[total_pages+1];
|
||||
if (page_offset == 0) {
|
||||
kdError(4300) << "No memory for page list!" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
page_offset[total_pages] = beginning_of_postamble;
|
||||
Q_UINT16 i = total_pages-1;
|
||||
page_offset[i] = last_page_offset;
|
||||
|
||||
// Follow back pointers through pages in the DVI file, storing the
|
||||
// offsets in the page_offset table.
|
||||
|
@ -252,6 +209,8 @@ void dvifile::prepare_pages()
|
|||
dvi_oops(i18n("Page does not start with BOP"));
|
||||
command_pointer += 10 * 4;
|
||||
page_offset[i] = readUINT32();
|
||||
if ((dvi_Data+page_offset[i] < dvi_Data)||(dvi_Data+page_offset[i] > dvi_Data+size_of_file))
|
||||
page_offset[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -268,9 +227,13 @@ dvifile::dvifile(QString fname, fontPool *pool)
|
|||
sourceSpecialMarker = true;
|
||||
|
||||
QFile file(fname);
|
||||
filename = file.name();
|
||||
file.open( IO_ReadOnly );
|
||||
size_of_file = file.size();
|
||||
dvi_Data = new Q_UINT8[size_of_file];
|
||||
// Sets the end pointer for the bigEndianByteReader so that the
|
||||
// whole memory buffer is readable
|
||||
end_pointer = dvi_Data+size_of_file;
|
||||
if (dvi_Data == 0) {
|
||||
kdError() << i18n("Not enough memory to load the DVI-file.");
|
||||
return;
|
||||
|
|
20
dvi_init.h
20
dvi_init.h
|
@ -7,9 +7,12 @@
|
|||
#include <qfile.h>
|
||||
#include <qstring.h>
|
||||
|
||||
#include "bigEndianByteReader.h"
|
||||
|
||||
class fontPool;
|
||||
|
||||
class dvifile {
|
||||
class dvifile : public bigEndianByteReader
|
||||
{
|
||||
public:
|
||||
dvifile(QString fname, class fontPool *pool);
|
||||
~dvifile();
|
||||
|
@ -21,15 +24,8 @@ class dvifile {
|
|||
Q_UINT32 * page_offset;
|
||||
|
||||
Q_UINT8 * dvi_Data;
|
||||
Q_UINT8 * command_pointer;
|
||||
QIODevice::Offset size_of_file;
|
||||
|
||||
Q_UINT8 readUINT8(void);
|
||||
Q_UINT16 readUINT16(void);
|
||||
Q_UINT32 readUINT32(void);
|
||||
Q_UINT32 readUINT(Q_UINT8);
|
||||
Q_INT32 readINT(Q_UINT8);
|
||||
|
||||
/** This flag is set to "true" during the construction of the
|
||||
dvifile, and is never changed afterwards by the dvifile
|
||||
class. It is used in kdvi in conjuction with source-specials:
|
||||
|
@ -53,10 +49,6 @@ class dvifile {
|
|||
published by the TUG DVI driver standards committee. */
|
||||
double dimconv;
|
||||
|
||||
/** Offset in DVI file of last page, set in read_postamble(). */
|
||||
Q_UINT32 last_page_offset;
|
||||
|
||||
|
||||
private:
|
||||
/** process_preamble reads the information in the preamble and
|
||||
stores it into global variables for later use. */
|
||||
|
@ -67,6 +59,10 @@ class dvifile {
|
|||
void find_postamble(void);
|
||||
void read_postamble(void);
|
||||
void prepare_pages(void);
|
||||
|
||||
/** Offset in DVI file of last page, set in read_postamble(). */
|
||||
Q_UINT32 last_page_offset;
|
||||
Q_UINT32 beginning_of_postamble;
|
||||
};
|
||||
|
||||
#endif //ifndef _DVIFILE_H
|
||||
|
|
16
dviwin.cpp
16
dviwin.cpp
|
@ -314,6 +314,10 @@ void dviWindow::exportPDF(void)
|
|||
|
||||
void dviWindow::exportPS(QString fname, QString options, KPrinter *printer)
|
||||
{
|
||||
// Safety check.
|
||||
if (dviFile->page_offset == 0)
|
||||
return;
|
||||
|
||||
// It could perhaps happen that a kShellProcess, which runs an
|
||||
// editor for inverse search, is still running. In that case, we
|
||||
// ingore any further output of the editor by detaching the
|
||||
|
@ -828,11 +832,19 @@ bool dviWindow::setFile( const QString & fname )
|
|||
// We will also generate a list of hyperlink-anchors in the
|
||||
// document. So declare the existing list empty.
|
||||
numAnchors = 0;
|
||||
|
||||
|
||||
if (dviFile->page_offset == 0)
|
||||
return;
|
||||
|
||||
for(current_page=0; current_page < dviFile->total_pages; current_page++) {
|
||||
PostScriptOutPutString = new QString();
|
||||
|
||||
dviFile->command_pointer = dviFile->dvi_Data + dviFile->page_offset[current_page];
|
||||
if (current_page < dviFile->total_pages) {
|
||||
command_pointer = dviFile->dvi_Data + dviFile->page_offset[current_page];
|
||||
end_pointer = dviFile->dvi_Data + dviFile->page_offset[current_page+1];
|
||||
} else
|
||||
command_pointer = end_pointer = 0;
|
||||
|
||||
memset((char *) &currinf.data, 0, sizeof(currinf.data));
|
||||
currinf.fonttable = tn_table;
|
||||
currinf._virtual = NULL;
|
||||
|
|
3
dviwin.h
3
dviwin.h
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include <kviewpart.h>
|
||||
|
||||
#include "bigEndianByteReader.h"
|
||||
#include "fontpool.h"
|
||||
#include "psgs.h"
|
||||
#include "dvi_init.h"
|
||||
|
@ -61,7 +62,7 @@ struct framedata {
|
|||
};
|
||||
|
||||
|
||||
class dviWindow : public QWidget
|
||||
class dviWindow : public QWidget, bigEndianByteReader
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
|
104
dviwin_draw.cpp
104
dviwin_draw.cpp
|
@ -49,7 +49,7 @@
|
|||
* and Luis Miguel Silveira, MIT RLE.
|
||||
*/
|
||||
|
||||
// #define DEBUG_RENDER 0
|
||||
//#define DEBUG_RENDER 0
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -100,7 +100,7 @@ static void change_font(unsigned long n)
|
|||
void dviWindow::set_char(unsigned int cmd, unsigned int ch)
|
||||
{
|
||||
#ifdef DEBUG_RENDER
|
||||
kdDebug() << "set_char" << endl;
|
||||
kdDebug() << "set_char #" << ch << endl;
|
||||
#endif
|
||||
|
||||
glyph *g = currinf.fontp->glyphptr(ch);
|
||||
|
@ -137,7 +137,7 @@ void dviWindow::set_char(unsigned int cmd, unsigned int ch)
|
|||
}
|
||||
|
||||
// Are we drawing text for a source hyperlink? And are source
|
||||
// hyperlinks enabled? @@@@
|
||||
// hyperlinks enabled?
|
||||
if (source_href != NULL) {
|
||||
// Now set up a rectangle which is checked against every mouse
|
||||
// event.
|
||||
|
@ -177,28 +177,31 @@ void dviWindow::set_vf_char(unsigned int cmd, unsigned int ch)
|
|||
kdDebug() << "set_vf_char" << endl;
|
||||
#endif
|
||||
|
||||
macro *m;
|
||||
struct drawinf oldinfo;
|
||||
static unsigned char c;
|
||||
long dvi_h_sav;
|
||||
|
||||
if ((m = &currinf.fontp->macrotable[ch])->pos == NULL) {
|
||||
macro *m = &currinf.fontp->macrotable[ch];
|
||||
if (m->pos == NULL) {
|
||||
kdError() << "Character " << ch << " not defined in font" << currinf.fontp->fontname << endl;
|
||||
m->pos = m->end = &c;
|
||||
return;
|
||||
}
|
||||
|
||||
dvi_h_sav = DVI_H;
|
||||
long dvi_h_sav = DVI_H;
|
||||
if (PostScriptOutPutString == NULL) {
|
||||
oldinfo = currinf;
|
||||
struct drawinf oldinfo = currinf;
|
||||
WW = 0;
|
||||
XX = 0;
|
||||
YY = 0;
|
||||
ZZ = 0;
|
||||
|
||||
currinf.fonttable = currinf.fontp->vf_table;
|
||||
currinf._virtual = currinf.fontp;
|
||||
currinf.fonttable = currinf.fontp->vf_table;
|
||||
currinf._virtual = currinf.fontp;
|
||||
Q_UINT8 *command_ptr_sav = command_pointer;
|
||||
Q_UINT8 *end_ptr_sav = end_pointer;
|
||||
command_pointer = m->pos;
|
||||
end_pointer = m->end;
|
||||
draw_part(currinf.fontp->dimconv, true);
|
||||
command_pointer = command_ptr_sav;
|
||||
end_pointer = end_ptr_sav;
|
||||
currinf = oldinfo;
|
||||
}
|
||||
if (cmd == PUT1)
|
||||
|
@ -211,7 +214,7 @@ void dviWindow::set_vf_char(unsigned int cmd, unsigned int ch)
|
|||
void dviWindow::set_no_char(unsigned int cmd, unsigned int ch)
|
||||
{
|
||||
#ifdef DEBUG_RENDER
|
||||
kdDebug() << "set_no_char" << endl;
|
||||
kdDebug() << "set_no_char: #" << ch <<endl;
|
||||
#endif
|
||||
|
||||
if (currinf._virtual) {
|
||||
|
@ -234,15 +237,6 @@ static void set_rule(int h, int w)
|
|||
foreGroundPaint.fillRect( PXL_H - -currwin.base_x, PXL_V - h + 1 -currwin.base_y, w?w:1, h?h:1, Qt::black );
|
||||
}
|
||||
|
||||
void dviWindow::special(long len)
|
||||
{
|
||||
char *cmd = new char[len+1];
|
||||
strncpy(cmd, (char *)dviFile->command_pointer, len);
|
||||
dviFile->command_pointer += len;
|
||||
cmd[len] = '\0';
|
||||
applicationDoSpecial(cmd);
|
||||
delete [] cmd;
|
||||
}
|
||||
|
||||
#define xspell_conv(n) spell_conv0(n, current_dimconv)
|
||||
|
||||
|
@ -258,10 +252,10 @@ void dviWindow::draw_part(double current_dimconv, bool is_vfmacro)
|
|||
currinf.set_char_p = &dviWindow::set_no_char;
|
||||
|
||||
for (;;) {
|
||||
ch = dviFile->readUINT8();
|
||||
if (ch <= (unsigned char) (SETCHAR0 + 127))
|
||||
ch = readUINT8();
|
||||
if (ch <= (unsigned char) (SETCHAR0 + 127)) {
|
||||
(this->*currinf.set_char_p)(ch, ch);
|
||||
else
|
||||
} else
|
||||
if (FNTNUM0 <= ch && ch <= (unsigned char) (FNTNUM0 + 63))
|
||||
change_font((unsigned long) (ch - FNTNUM0));
|
||||
else {
|
||||
|
@ -270,7 +264,7 @@ void dviWindow::draw_part(double current_dimconv, bool is_vfmacro)
|
|||
switch (ch) {
|
||||
case SET1:
|
||||
case PUT1:
|
||||
(this->*currinf.set_char_p)(ch, dviFile->readUINT8());
|
||||
(this->*currinf.set_char_p)(ch, readUINT8());
|
||||
break;
|
||||
|
||||
case SETRULE:
|
||||
|
@ -278,8 +272,8 @@ void dviWindow::draw_part(double current_dimconv, bool is_vfmacro)
|
|||
word_boundary_encountered = true;
|
||||
/* Be careful, dvicopy outputs rules with height =
|
||||
0x80000000. We don't want any SIGFPE here. */
|
||||
a = dviFile->readUINT32();
|
||||
b = dviFile->readUINT32();
|
||||
a = readUINT32();
|
||||
b = readUINT32();
|
||||
b = xspell_conv(b);
|
||||
if (a > 0 && b > 0 && PostScriptOutPutString == NULL)
|
||||
set_rule(pixel_round(xspell_conv(a)), pixel_round(b));
|
||||
|
@ -289,8 +283,8 @@ void dviWindow::draw_part(double current_dimconv, bool is_vfmacro)
|
|||
case PUTRULE:
|
||||
if (is_vfmacro == false)
|
||||
word_boundary_encountered = true;
|
||||
a = dviFile->readUINT32();
|
||||
b = dviFile->readUINT32();
|
||||
a = readUINT32();
|
||||
b = readUINT32();
|
||||
a = xspell_conv(a);
|
||||
b = xspell_conv(b);
|
||||
if (a > 0 && b > 0 && PostScriptOutPutString == NULL)
|
||||
|
@ -303,7 +297,7 @@ void dviWindow::draw_part(double current_dimconv, bool is_vfmacro)
|
|||
case BOP:
|
||||
if (is_vfmacro == false)
|
||||
word_boundary_encountered = true;
|
||||
dviFile->command_pointer += 11 * 4;
|
||||
command_pointer += 11 * 4;
|
||||
DVI_H = basedpi << 16; // Reminder: DVI-coordinates start at (1",1") from top of page
|
||||
DVI_V = basedpi << 16;
|
||||
PXL_V = pixel_conv(DVI_V);
|
||||
|
@ -339,14 +333,14 @@ void dviWindow::draw_part(double current_dimconv, bool is_vfmacro)
|
|||
case RIGHT2:
|
||||
case RIGHT3:
|
||||
case RIGHT4:
|
||||
DVI_H += xspell_conv(dviFile->readINT(ch - RIGHT1 + 1));
|
||||
DVI_H += xspell_conv(readINT(ch - RIGHT1 + 1));
|
||||
break;
|
||||
|
||||
case W1:
|
||||
case W2:
|
||||
case W3:
|
||||
case W4:
|
||||
WW = xspell_conv(dviFile->readINT(ch - W0));
|
||||
WW = xspell_conv(readINT(ch - W0));
|
||||
case W0:
|
||||
DVI_H += WW;
|
||||
break;
|
||||
|
@ -355,7 +349,7 @@ void dviWindow::draw_part(double current_dimconv, bool is_vfmacro)
|
|||
case X2:
|
||||
case X3:
|
||||
case X4:
|
||||
XX = xspell_conv(dviFile->readINT(ch - X0));
|
||||
XX = xspell_conv(readINT(ch - X0));
|
||||
case X0:
|
||||
DVI_H += XX;
|
||||
break;
|
||||
|
@ -366,7 +360,7 @@ void dviWindow::draw_part(double current_dimconv, bool is_vfmacro)
|
|||
case DOWN4:
|
||||
if (is_vfmacro == false)
|
||||
word_boundary_encountered = true;
|
||||
DVI_V += xspell_conv(dviFile->readINT(ch - DOWN1 + 1));
|
||||
DVI_V += xspell_conv(readINT(ch - DOWN1 + 1));
|
||||
PXL_V = pixel_conv(DVI_V);
|
||||
break;
|
||||
|
||||
|
@ -374,7 +368,7 @@ void dviWindow::draw_part(double current_dimconv, bool is_vfmacro)
|
|||
case Y2:
|
||||
case Y3:
|
||||
case Y4:
|
||||
YY = xspell_conv(dviFile->readINT(ch - Y0));
|
||||
YY = xspell_conv(readINT(ch - Y0));
|
||||
case Y0:
|
||||
word_boundary_encountered = true;
|
||||
DVI_V += YY;
|
||||
|
@ -385,7 +379,7 @@ void dviWindow::draw_part(double current_dimconv, bool is_vfmacro)
|
|||
case Z2:
|
||||
case Z3:
|
||||
case Z4:
|
||||
ZZ = xspell_conv(dviFile->readINT(ch - Z0));
|
||||
ZZ = xspell_conv(readINT(ch - Z0));
|
||||
case Z0:
|
||||
if (is_vfmacro == false)
|
||||
word_boundary_encountered = true;
|
||||
|
@ -396,10 +390,15 @@ void dviWindow::draw_part(double current_dimconv, bool is_vfmacro)
|
|||
case FNT1:
|
||||
case FNT2:
|
||||
case FNT3:
|
||||
if (is_vfmacro == false)
|
||||
word_boundary_encountered = true;
|
||||
change_font(readUINT(ch - FNT1 + 1));
|
||||
break;
|
||||
|
||||
case FNT4:
|
||||
if (is_vfmacro == false)
|
||||
word_boundary_encountered = true;
|
||||
change_font(dviFile->readINT(ch - FNT1 + 1));
|
||||
change_font(readINT(ch - FNT1 + 1));
|
||||
break;
|
||||
|
||||
case XXX1:
|
||||
|
@ -408,9 +407,15 @@ void dviWindow::draw_part(double current_dimconv, bool is_vfmacro)
|
|||
case XXX4:
|
||||
if (is_vfmacro == false)
|
||||
word_boundary_encountered = true;
|
||||
a = dviFile->readINT(ch - XXX1 + 1);
|
||||
if (a > 0)
|
||||
special(a);
|
||||
a = readUINT(ch - XXX1 + 1);
|
||||
if (a > 0) {
|
||||
char *cmd = new char[a+1];
|
||||
strncpy(cmd, (char *)command_pointer, a);
|
||||
command_pointer += a;
|
||||
cmd[a] = '\0';
|
||||
applicationDoSpecial(cmd);
|
||||
delete [] cmd;
|
||||
}
|
||||
break;
|
||||
|
||||
case FNTDEF1:
|
||||
|
@ -420,9 +425,9 @@ void dviWindow::draw_part(double current_dimconv, bool is_vfmacro)
|
|||
if (is_vfmacro == false)
|
||||
word_boundary_encountered = true;
|
||||
{
|
||||
dviFile->command_pointer += 12 + ch - FNTDEF1 + 1;
|
||||
Q_UINT16 len = dviFile->readUINT8() + dviFile->readUINT8();
|
||||
dviFile->command_pointer += len;
|
||||
command_pointer += 12 + ch - FNTDEF1 + 1;
|
||||
Q_UINT16 len = readUINT8() + readUINT8();
|
||||
command_pointer += len;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -473,9 +478,16 @@ void dviWindow::draw_page(void)
|
|||
delete pxm;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Now really write the text
|
||||
dviFile->command_pointer = dviFile->dvi_Data + dviFile->page_offset[current_page];
|
||||
if (dviFile->page_offset == 0)
|
||||
return;
|
||||
if (current_page < dviFile->total_pages) {
|
||||
command_pointer = dviFile->dvi_Data + dviFile->page_offset[current_page];
|
||||
end_pointer = dviFile->dvi_Data + dviFile->page_offset[current_page+1];
|
||||
} else
|
||||
command_pointer = end_pointer = 0;
|
||||
|
||||
memset((char *) &currinf.data, 0, sizeof(currinf.data));
|
||||
currinf.fonttable = tn_table;
|
||||
currinf._virtual = 0;
|
||||
|
|
|
@ -235,7 +235,7 @@ void KDVIMultiPage::about()
|
|||
i18n("the KDVI plugin"),
|
||||
KAboutDialog::Close, KAboutDialog::Close);
|
||||
|
||||
ab->setProduct("kdvi", "0.9g", QString::null, QString::null);
|
||||
ab->setProduct("kdvi", "1.0alpha", QString::null, QString::null);
|
||||
ab->addTextPage (i18n("About"),
|
||||
i18n("A previewer for Device Independent files (DVI files) produced "
|
||||
"by the TeX typesetting system.<br>"
|
||||
|
@ -270,7 +270,7 @@ void KDVIMultiPage::about()
|
|||
|
||||
void KDVIMultiPage::bugform()
|
||||
{
|
||||
KAboutData *kab = new KAboutData("kdvi", I18N_NOOP("KDVI"), "0.9g", 0, 0, 0, 0, 0);
|
||||
KAboutData *kab = new KAboutData("kdvi", I18N_NOOP("KDVI"), "1.0alpha", 0, 0, 0, 0, 0);
|
||||
KBugReport *kbr = new KBugReport(0, true, kab );
|
||||
kbr->show();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue