Back to index

tetex-bin  3.0
search-dialog.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2003-2004 Stefan Ulrich
00003  * 
00004  * Permission is hereby granted, free of charge, to any person obtaining a copy
00005  * of this software and associated documentation files (the "Software"), to
00006  * deal in the Software without restriction, including without limitation the
00007  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
00008  * sell copies of the Software, and to permit persons to whom the Software is
00009  * furnished to do so, subject to the following conditions:
00010  * 
00011  * The above copyright notice and this permission notice shall be included in
00012  * all copies or substantial portions of the Software.
00013  * 
00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00017  * PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE LIABLE FOR ANY CLAIM,
00018  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00020  * OTHER DEALINGS IN THE SOFTWARE.
00021  */
00022 
00023 #ifndef SEARCH_DIALOG_H_
00024 #define SEARCH_DIALOG_H_
00025 
00026 #include "xdvi-config.h"
00027 #include "xdvi.h"
00028 
00029 typedef enum { SEARCH_UP = 0, SEARCH_DOWN, SEARCH_UNINITIALIZED } searchDirectionT;
00030 
00031 /* bounding box info for words. */
00032 struct bbox {
00033     int ulx, uly, lrx, lry;
00034 };
00035 
00036 struct search_info {
00037     Boolean have_match;
00038     Boolean locked;  /* to block multiple searches */
00039     Boolean search_wrapped; /* if restarting from start (or end) */
00040     int from_pos;
00041     int to_pos;
00042     int scan_page;
00043     int page_offset; /* start of current scan */
00044 };
00045 
00046 
00047 struct search_settings {
00048     const char *term; /* original search term */
00049     char *utf8_term;  /* term in UTF-8 encoding */
00050     char *posix_term; /* utf8_term with Perl abbreviations mapped to POSIX */
00051     Boolean use_regexp;
00052     Boolean case_sensitive;
00053     Boolean ignore_hyphens;
00054     Boolean ignore_linebreaks;
00055     searchDirectionT direction;
00056     struct search_info *searchinfo;
00057     /* internal state management */
00058     int x_pos, y_pos;       /* position of the search popup window */
00059     int from_page;   /* page to start search from */
00060     int curr_page;   /* current page of search search from */
00061     int to_page;     /* highest page already scanned */
00062     int hyphen_delta;       /* difference in offsets when hyphenation is removed */
00063     Widget message_window; /* warning popup, or NULL if it doesn't exist */
00064 };
00065 
00066 extern void dvi_find_string(const char *str, Boolean find_next);
00067 
00068 #endif /* SEARCH_DIALOG_H_ */