-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathpdfviewerwidget.h
161 lines (149 loc) · 4.72 KB
/
pdfviewerwidget.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/****************************************************************************
**
** copyright : (C) 2003-2011 by Pascal Brachet
** http://www.xm1math.net/texmaker/
**
** Parts of this file come from Texworks (GPL) Copyright (C) 2007-2010 Jonathan Kew
** Parts of this file come from the documentation of Qt. It was originally
** published as part of Qt Quarterly.
** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information ([email protected])
**
**
****************************************************************************/
#ifndef PDFVIEWERWIDGET_H
#define PDFVIEWERWIDGET_H
#include <QtGui>
#include <QDockWidget>
#include <QListWidget>
#include <QScrollArea>
#include <QComboBox>
#include <QLineEdit>
#include <QPushButton>
#include <QAction>
#include <QListWidgetItem>
#include <QProcess>
#include <QPointer>
#include <QKeyEvent>
#include <QPainterPath>
#include <QFrame>
#include <QHBoxLayout>
#include <QMutex>
#include <QStackedWidget>
#include <QTreeWidget>
#include <QToolBar>
#include <QStack>
#include <QKeySequence>
#include "pdfdocumentwidget.h"
#include "pdfscrollarea.h"
#include "synctex_parser.h"
#include "paperdialog.h"
#include "minisplitter.h"
#include "browser.h"
class PdfViewerWidget : public QWidget {
Q_OBJECT
public:
PdfViewerWidget( const QString fileName, const QString externalCommand, const QString ghostscriptCommand, const QString psize,const QKeySequence edfocus, const QString SpellLang, const qreal startScale, QWidget* parent = 0);
~PdfViewerWidget();
QString pdf_file;
QToolBar *centralToolBarBis;
public slots:
void openFile(QString fn, QString ec,QString pc);
void jumpToPdfFromSource(QString sourceFile,int source_line);
void getFocus();
void setKeyEditorFocus(QKeySequence s);
qreal getScale() {
return currentScale;
};
private:
QKeySequence KeySequenceEditorFocus;
//void closeEvent(QCloseEvent *e);
PaperDialog *dlg;
MiniSplitter *splitter;
QTreeWidget *StructureTreeWidget;
QList<PdfDocumentWidget*> listPdfWidgets, templist;
Poppler::Document *doc;
QAction *upAct, *downAct, *fitWithAct, *fitPageAct, *zoominAct, *zoomoutAct, *findAct, *historyBackAct, *printAct, *externAct, *historyForwardAct, *toggleStructAct, *checkerAct;
QHBoxLayout *CentralLayout;
QVBoxLayout *CentralLayoutBis;
QListWidget *listpagesWidget;
#if defined(Q_WS_WIN)
QComboBox *comboBoxPaper;
#endif
PdfScrollArea *scrollArea;
QList<int> listPdfWidgetsPos;
QList<int> listPdfWidgetsStatus;
QComboBox *scaleComboBox;
QLineEdit *searchLineEdit;
QPushButton *findButton;
QString viewpdf_command, gswin32c_command, paper_size, spell_lang;
int currentPage;
qreal currentScale, lastScale, previousScale;
bool fileLoaded;
QPointer<QProcess> proc;
QString lastFile;
int lastPage, altern;
synctex_scanner_t scanner;
QStringList scalePercents;
QLineEdit *zoomCustom;
QRectF searchLocation;
QMutex pageMutex;
bool canDisplayPixmap;
int scrollMax, deltaMax;
QPainterPath path;
QStack<int> stack;
QStack<int> forwardStack;
bool showingStructure;
int lastHpos;
QPointer<Browser> browserWindow;
private slots:
void connectActions();
void disconnectActions();
void setScrollMax();
void initPages(bool checkScale);
void initPagesWithNewScale();
void displayPage(int page);
void displayNewPage();
void updatePageStatus(int page);
void slotHighlight();
void gotoPage(int page);
void checkPage(int value);
void updateCurrentPage();
void jumpToDest(int page,int left, int top);
void userZoom();
void scaleDocumentZoom(QString zoom);
void searchDocument();
void enableSearch();
void pageUp();
void pageDown();
void fitWidth();
void fitPage();
void zoomIn();
void zoomOut();
void runExternalViewer();
void printPdf();
void slotItemClicked(QListWidgetItem* item);
void jumpToEditor(int page, const QPointF& pos);
//QRectF searchBackwards(const QString &text);
void searchForwards(const QString &text);
void ToggleStructure();
//void ShowListPages();
void ParseToc(const QDomNode &parent, QTreeWidget *tree, QTreeWidgetItem *parentItem);
void ClickedOnStructure(QTreeWidgetItem* item,int c);
void historyBack();
void historyForward();
void clearHistory();
void updateHistory(int pos);
void setHpos(int pos);
void checkSpellGrammarPage();
void jumptoHpos();
protected:
void keyPressEvent ( QKeyEvent * e );
signals:
void openDocAtLine(const QString&, int,bool);
void sendFocusToEditor();
void sendPaperSize(const QString&);
void backwardAvailable(bool);
void forwardAvailable(bool);
};
#endif