git-svn-id: svn://svn.code.sf.net/p/xournal/svn/trunk@100 9fe2bcd3-a095-4d8b-a836-9b85dc8d7627

presentation
andreasb123 15 years ago
parent 6dee468442
commit d755676536
  1. 3
      src/control/Control.cpp
  2. 14
      src/control/XournalMain.cpp
  3. 1
      src/control/jobs/BlockingJob.cpp
  4. 61
      src/control/tools/EditSelection.cpp
  5. 12
      src/control/tools/EditSelection.h
  6. 7
      src/gui/pageposition/PageViewIndex.cpp
  7. 3
      src/pdf/PdfExport.cpp
  8. 10
      src/pdf/PdfWriter.cpp
  9. 7
      src/pdf/PdfWriter.h

@ -2074,6 +2074,9 @@ void Control::exportAsPdf() {
this->scheduler->addJob(job, JOB_PRIORITY_NONE);
} else {
delete job;
// The job blocked, so we have to unblock, because the job unblocks only after run
unblock();
}
}

@ -70,15 +70,17 @@ int XournalMain::run(int argc, char * argv[]) {
GOptionContext * context = context = g_option_context_new("FILE");
bool optNoWarnSVN = false;
bool optNoPdfCompress = false;
gchar ** optFilename = NULL;
gchar * pdfFilename = NULL;
int openAtPageNumber = -1;
GOptionEntry options[] = {
{ "no-warn-svn", 'w', 0, G_OPTION_ARG_NONE, &optNoWarnSVN, "Do not warn this is a development release", NULL },
{ "create-pdf", 'p', 0, G_OPTION_ARG_FILENAME, &pdfFilename, "PDF output filename" , NULL},
{ "page", 'n', 0, G_OPTION_ARG_INT, &openAtPageNumber, "Jump to Page (first Page: 1)", "N" },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &optFilename, "<input>" , NULL},
{ "no-warn-svn", 'w', 0, G_OPTION_ARG_NONE, &optNoWarnSVN, "Do not warn this is a development release", NULL },
{ "pdf-no-compress", 0, 0, G_OPTION_ARG_NONE, &optNoPdfCompress, "Don't compress PDF files (for debugging)", NULL },
{ "create-pdf", 'p', 0, G_OPTION_ARG_FILENAME, &pdfFilename, "PDF output filename", NULL },
{ "page", 'n', 0, G_OPTION_ARG_INT, &openAtPageNumber, "Jump to Page (first Page: 1)", "N" },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &optFilename, "<input>", NULL },
{ NULL }
};
@ -98,6 +100,10 @@ int XournalMain::run(int argc, char * argv[]) {
// Init threads (used for our Sheduler, Jobs)
g_thread_init(NULL);
if(optNoPdfCompress) {
PdfWriter::setCompressPdfOutput(false);
}
if (pdfFilename && optFilename && *optFilename) {
return exportPdf(*optFilename, pdfFilename);
}

@ -12,7 +12,6 @@ BlockingJob::BlockingJob(Control * control, const char * name) {
BlockingJob::~BlockingJob() {
XOJ_CHECK_TYPE(BlockingJob);
control->unblock();
this->control = NULL;
XOJ_RELEASE_TYPE(BlockingJob);

@ -11,8 +11,6 @@
#include "../../undo/FontUndoAction.h"
#include "../../gui/XournalView.h"
#include "../../gui/pageposition/PagePositionHandler.h"
// TODO: debug
#include "../../control/Control.h"
#include "../../model/Document.h"
@ -294,11 +292,6 @@ UndoAction * EditSelection::setSize(ToolSize size, const double * thiknessPen, c
}
if (found) {
double x1 = this->x;
double x2 = this->x + this->width;
double y1 = this->y;
double y2 = this->y + this->height;
this->deleteViewBuffer();
this->view->getXournal()->repaintSelection();
@ -332,11 +325,6 @@ UndoAction * EditSelection::setColor(int color) {
}
if (found) {
double x1 = this->x;
double x2 = this->x + this->width;
double y1 = this->y;
double y2 = this->y + this->height;
this->deleteViewBuffer();
this->view->getXournal()->repaintSelection();
@ -556,12 +544,49 @@ void EditSelection::mouseMove(double x, double y) {
int ry = this->getYOnViewAbsolute();
PageView * v = pp->getBestMatchingView(rx, ry, this->getViewWidth(), this->getViewHeight());
// TODO: Debug
if (v) {
int pageNr = this->view->getXournal()->getControl()->getDocument()->indexOf(v->getPage());
printf("best matching page: %i\n", pageNr);
} else {
printf("no matching page found\n");
if(v && v != this->view) {
XournalView * xournal = this->view->getXournal();
int pageNr = xournal->getControl()->getDocument()->indexOf(v->getPage());
xournal->pageSelected(pageNr);
translateToView(v);
}
}
/**
* Translate all coordinates which are relative to the current view to the new view,
* and set the attribute view to the new view
*/
void EditSelection::translateToView(PageView * v) {
double zoom = view->getXournal()->getZoom();
double absoluteX = getXOnViewAbsolute();
double absoluteY = getYOnViewAbsolute();
int aX1 = getXOnViewAbsolute();
int aY1 = getYOnViewAbsolute();
absoluteX -= v->getX();
absoluteY -= v->getY();
this->relativeX = absoluteX / zoom - this->x;
this->relativeY = absoluteY / zoom - this->y;
this->view = v;
int aX2 = getXOnViewAbsolute();
int aY2 = getYOnViewAbsolute();
if(aX1 != aX2) {
printf("aX1 != aX2!! %i / %i\n", aX1, aX2);
}
if(aY1 != aY2) {
printf("aY1 != aY2!! %i / %i\n", aY1, aY2);
}
}

@ -193,15 +193,25 @@ private:
*/
void finalizeSelection();
/**
* Translate all coordinates which are relative to the current view to the new view,
* and set the attribute view to the new view
*/
void translateToView(PageView * v);
private: // DATA
XOJ_TYPE_ATTRIB;
/**
* The size
* The position relative to the current view
*/
double x;
double y;
/**
* The size
*/
double width;
double height;

@ -91,21 +91,14 @@ PageView * PageViewIndex::getHighestIntersects() {
PageViewIndexEntry * b = NULL;
// TODO: Debug
printf("----------------\n");
for(GList * l = this->data; l != NULL;l = l->next) {
PageViewIndexEntry * e = (PageViewIndexEntry *)l->data;
printf("->%i\n", e->area);
if(b == NULL || b->area < e->area) {
b = e;
}
}
printf("\n");
if(b != NULL) {
return b->view;
}

@ -150,6 +150,7 @@ bool PdfExport::writePagesindex() {
for (GList * l = this->pageIds; l != NULL; l = l->next) {
int id = *((int *) l->data);
this->writer->writef("%i 0 R ", id);
pageCount++;
}
this->writer->write("]\n");
this->writer->writef("/Count %i\n", pageCount);
@ -538,7 +539,7 @@ String PdfExport::getLastError() {
bool PdfExport::createPdf(String uri, GList * range) {
XOJ_CHECK_TYPE(PdfExport);
// TODO: LOW PRIO: handle bookmakrs correct
// TODO: LOW PRIO: handle bookmarks correct
if (range == NULL) {
this->lastError = "No pages to export!";

@ -6,6 +6,8 @@
#include "../util/GzHelper.h"
bool PdfWriter::compressPdfOutput = true;
PdfWriter::PdfWriter(PdfXRef * xref) {
XOJ_INIT_TYPE(PdfWriter);
@ -15,8 +17,6 @@ PdfWriter::PdfWriter(PdfXRef * xref) {
this->dataCount = 0;
this->xref = xref;
this->objectId = 3;
this->compressOutput = true;
}
PdfWriter::~PdfWriter() {
@ -32,6 +32,10 @@ PdfWriter::~PdfWriter() {
XOJ_RELEASE_TYPE(PdfWriter);
}
void PdfWriter::setCompressPdfOutput(bool compress) {
PdfWriter::compressPdfOutput = compress;
}
void PdfWriter::close() {
XOJ_CHECK_TYPE(PdfWriter);
@ -224,7 +228,7 @@ void PdfWriter::endStream() {
GString * data = NULL;
GString * compressed = NULL;
if (this->compressOutput) {
if (PdfWriter::compressPdfOutput) {
compressed = GzHelper::gzcompress(this->stream);
}

@ -45,12 +45,15 @@ public:
int getNextObjectId();
int getDataCount();
public:
static void setCompressPdfOutput(bool compress);
private:
XOJ_TYPE_ATTRIB;
int dataCount;
bool compressOutput;
static bool compressPdfOutput;
int dataCount;
bool inStream;
GString * stream;

Loading…
Cancel
Save