Debian Codegraph @

texk/xdvik/gui/search-dialog.h

raw
1 /*
2 * Copyright (c) 2003-2004 Stefan Ulrich
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to
6 * deal in the Software without restriction, including without limitation the
7 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 * sell copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE LIABLE FOR ANY CLAIM,
18 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22
23 #ifndef SEARCH_DIALOG_H_
24 #define SEARCH_DIALOG_H_
25
26 #include "xdvi.h"
27
28 typedef enum { SEARCH_UP = 0, SEARCH_DOWN, SEARCH_UNINITIALIZED } searchDirectionT;
29
30 /* bounding box info for words. */
31 struct bbox {
32 int ulx, uly, lrx, lry;
33 };
34
35 struct search_info {
36 Boolean have_match;
37 Boolean locked; /* to block multiple searches */
38 Boolean search_wrapped; /* if restarting from start (or end) */
39 int from_pos;
40 int to_pos;
41 int scan_page;
42 int page_offset; /* start of current scan */
43 };
44
45
46 struct search_settings {
47 const char *term; /* original search term */
48 char *utf8_term; /* term in UTF-8 encoding */
49 char *posix_term; /* utf8_term with Perl abbreviations mapped to POSIX */
50 Boolean use_regexp;
51 Boolean case_sensitive;
52 Boolean ignore_hyphens;
53 Boolean ignore_linebreaks;
54 Boolean wrap;
55 int wrapcnt; /* > 0 if search has wrapped */
56 char *isearchterm; /* non-NULL when doing isearch */
57 searchDirectionT direction;
58 struct search_info *searchinfo;
59 /* internal state management */
60 int x_pos, y_pos; /* position of the search popup window */
61 int from_page; /* page to start search from */
62 int curr_page; /* current page of search */
63 int to_page; /* highest page already scanned */
64 int hyphen_delta; /* difference in offsets when hyphenation is removed */
65 Widget message_window; /* warning popup, or NULL if it doesn't exist */
66 };
67
68 extern void dvi_find_string(const char *str, Boolean find_next);
69
70 #endif /* SEARCH_DIALOG_H_ */