1 //========================================================================
5 // Copyright 2002-2003 Glyph & Cog, LLC
7 //========================================================================
14 #ifdef USE_GCC_PRAGMAS
18 #define Object XtObject
24 #if (XmVERSION <= 1) && !defined(__sgi)
25 #define DISABLE_OUTLINE
28 #if (XmVERSION >= 2 && !defined(LESSTIF_VERSION))
29 # define USE_COMBO_BOX 1
40 //------------------------------------------------------------------------
42 // NB: this must match the defn of zoomMenuBtnInfo in XPDFViewer.cc
43 #define nZoomMenuItems 10
45 //------------------------------------------------------------------------
47 //------------------------------------------------------------------------
52 XPDFViewer(XPDFApp
*appA
, GString
*fileName
,
53 int pageA
, GString
*destName
,
54 GString
*ownerPassword
, GString
*userPassword
);
55 GBool
isOk() { return ok
; }
58 void open(GString
*fileName
, int pageA
, GString
*destName
);
62 Widget
getWindow() { return win
; }
66 //----- load / display
67 GBool
loadFile(GString
*fileName
, GString
*ownerPassword
= NULL
,
68 GString
*userPassword
= NULL
);
69 void displayPage(int pageA
, double zoomA
, int rotateA
,
70 GBool scrollToTop
, GBool addToHist
);
71 void displayDest(LinkDest
*dest
, double zoomA
, int rotateA
,
73 void getPageAndDest(int pageA
, GString
*destName
,
74 int *pageOut
, LinkDest
**destOut
);
77 static void actionCbk(void *data
, char *action
);
79 //----- keyboard/mouse input
80 static void keyPressCbk(void *data
, char *s
, KeySym key
,
82 static void mouseCbk(void *data
, XEvent
*event
);
84 //----- GUI code: main window
86 void addToolTip(Widget widget
, char *text
);
90 void setZoomIdx(int idx
);
91 void setZoomVal(double z
);
92 static void prevPageCbk(Widget widget
, XtPointer ptr
,
94 static void prevTenPageCbk(Widget widget
, XtPointer ptr
,
96 static void nextPageCbk(Widget widget
, XtPointer ptr
,
98 static void nextTenPageCbk(Widget widget
, XtPointer ptr
,
100 static void backCbk(Widget widget
, XtPointer ptr
,
102 static void forwardCbk(Widget widget
, XtPointer ptr
,
105 static void zoomComboBoxCbk(Widget widget
, XtPointer ptr
,
108 static void zoomMenuCbk(Widget widget
, XtPointer ptr
,
111 static void findCbk(Widget widget
, XtPointer ptr
,
113 static void printCbk(Widget widget
, XtPointer ptr
,
115 static void aboutCbk(Widget widget
, XtPointer ptr
,
117 static void quitCbk(Widget widget
, XtPointer ptr
,
119 static void openCbk(Widget widget
, XtPointer ptr
,
121 static void openInNewWindowCbk(Widget widget
, XtPointer ptr
,
123 static void reloadCbk(Widget widget
, XtPointer ptr
,
125 static void saveAsCbk(Widget widget
, XtPointer ptr
,
127 static void continuousModeToggleCbk(Widget widget
, XtPointer ptr
,
129 static void rotateCCWCbk(Widget widget
, XtPointer ptr
,
131 static void rotateCWCbk(Widget widget
, XtPointer ptr
,
133 static void closeCbk(Widget widget
, XtPointer ptr
,
135 static void closeMsgCbk(Widget widget
, XtPointer ptr
,
137 static void pageNumCbk(Widget widget
, XtPointer ptr
,
139 static void updateCbk(void *data
, GString
*fileName
,
140 int pageNum
, int numPages
, char *linkString
);
142 //----- GUI code: outline
143 #ifndef DISABLE_OUTLINE
145 void setupOutlineItems(GList
*items
, Widget parent
, UnicodeMap
*uMap
);
146 static void outlineSelectCbk(Widget widget
, XtPointer ptr
,
150 //----- GUI code: "about" dialog
151 void initAboutDialog();
153 //----- GUI code: "open" dialog
154 void initOpenDialog();
155 void mapOpenDialog(GBool openInNewWindowA
);
156 static void openOkCbk(Widget widget
, XtPointer ptr
,
159 //----- GUI code: "find" dialog
160 void initFindDialog();
161 static void findFindCbk(Widget widget
, XtPointer ptr
,
163 void mapFindDialog();
164 void doFind(GBool next
);
165 static void findCloseCbk(Widget widget
, XtPointer ptr
,
168 //----- GUI code: "save as" dialog
169 void initSaveAsDialog();
170 void mapSaveAsDialog();
171 static void saveAsOkCbk(Widget widget
, XtPointer ptr
,
174 //----- GUI code: "print" dialog
175 void initPrintDialog();
176 void setupPrintDialog();
177 static void printWithCmdBtnCbk(Widget widget
, XtPointer ptr
,
179 static void printToFileBtnCbk(Widget widget
, XtPointer ptr
,
181 static void printPrintCbk(Widget widget
, XtPointer ptr
,
184 //----- Motif support
185 XmFontList
createFontList(char *xlfd
);
192 Widget win
; // top-level window
195 #ifndef DISABLE_OUTLINE
196 Widget outlineScroll
;
198 Widget
*outlineLabels
;
199 int outlineLabelsLength
;
200 int outlineLabelsSize
;
205 Widget prevTenPageBtn
;
208 Widget nextTenPageBtn
;
211 Widget pageCountLabel
;
216 Widget zoomMenuBtns
[nZoomMenuItems
];
226 XmFontList aboutBigFont
, aboutVersionFont
, aboutFixedFont
;
229 GBool openInNewWindow
;
233 Widget findBackwardToggle
;
234 Widget findCaseSensitiveToggle
;
239 Widget printWithCmdBtn
;
240 Widget printToFileBtn
;
242 Widget printFileText
;
243 Widget printFirstPage
;
244 Widget printLastPage
;