virtual
| 121 | |
| 122 | //virtual |
| 123 | TWSynchronizer::TeXSyncPoint TWSyncTeXSynchronizer::syncFromPDF(const TWSynchronizer::PDFSyncPoint & src, const Resolution resolution) const |
| 124 | { |
| 125 | TeXSyncPoint retVal; |
| 126 | retVal.line = -1; |
| 127 | retVal.col = -1; |
| 128 | retVal.len = -1; |
| 129 | |
| 130 | if (src.rects.length() != 1) |
| 131 | return retVal; |
| 132 | |
| 133 | if (SyncTeX::synctex_edit_query(_scanner, static_cast<page_type>(src.page), static_cast<float>(src.rects[0].left()), static_cast<float>(src.rects[0].top())) > 0) { |
| 134 | SyncTeX::synctex_node_p node{nullptr}; |
| 135 | while ((node = SyncTeX::synctex_scanner_next_result(_scanner))) { |
| 136 | retVal.filename = QString::fromLocal8Bit(SyncTeX::synctex_scanner_get_name(_scanner, SyncTeX::synctex_node_tag(node))); |
| 137 | retVal.line = SyncTeX::synctex_node_line(node); |
| 138 | if (retVal.line <= 0) |
| 139 | continue; |
| 140 | retVal.col = -1; |
| 141 | retVal.len = -1; |
| 142 | |
| 143 | // If we only need to match lines, we are done |
| 144 | if (resolution == LineResolution) |
| 145 | break; |
| 146 | |
| 147 | _syncFromPDFFine(src, retVal, resolution); |
| 148 | // If we found a (unique) match, we are done; otherwise, try other |
| 149 | // synctex_edit_query results (if any) |
| 150 | if (retVal.col > -1 && retVal.len > 0) |
| 151 | break; |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | return retVal; |
| 156 | } |
| 157 | |
| 158 | void TWSyncTeXSynchronizer::_syncFromTeXFine(const TWSynchronizer::TeXSyncPoint & src, TWSynchronizer::PDFSyncPoint & dest, const Resolution resolution) const |
| 159 | { |