| 1 | #ifndef _ManPage_h_ |
| 2 | #define _ManPage_h_ |
| 3 | /* ManPage.h |
| 4 | * |
| 5 | * Copyright (C) 1996-2008,2011,2012,2014-2020,2023,2024 Paul Boersma |
| 6 | * |
| 7 | * This code is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or (at |
| 10 | * your option) any later version. |
| 11 | * |
| 12 | * This code is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 15 | * See the GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #include "Graphics.h" |
| 22 | |
| 23 | #include "ManPage_enums.h" |
| 24 | |
| 25 | Thing_declare (SoundList); |
| 26 | |
| 27 | typedef struct structManPage_Paragraph { |
| 28 | enum kManPage_type type; |
| 29 | conststring32 text; // not an autostring32, because it could be a string literal (if not dynamic) |
| 30 | double width, height; // for machine-code pictures and script chunks with pictures |
| 31 | void (*draw) (Graphics g); // for machine-code pictures |
| 32 | autoGraphics cacheGraphics; // for script chunks that output a picture |
| 33 | autoMelderString cacheInfo; // for script chunks that output info text |
| 34 | SoundList cacheAudio; // for script chunks with playable output |
| 35 | void invalidateCache () noexcept { |
| 36 | our cacheGraphics. reset(); |
| 37 | } |
| 38 | bool couldVerbatim () const noexcept { |
| 39 | return our type == kManPage_type::SCRIPT || our type == kManPage_type::CODE || |
| 40 | our type >= kManPage_type::CODE1 && our type <= kManPage_type::CODE5; |
| 41 | } |
| 42 | } *ManPage_Paragraph; |
| 43 | |
| 44 | Thing_define (ManPage, Thing) { |
| 45 | autostring32 title, signature; |
| 46 | autovector <structManPage_Paragraph> paragraphs; |
| 47 | autoINTVEC linksHither, linksThither; |
| 48 | double recordingTime; |
| 49 | bool verbatimAware; |
| 50 | void invalidateCache () noexcept { |
| 51 | for (integer i = 1; i <= our paragraphs.size; i ++) |
| 52 | our paragraphs [i]. invalidateCache (); |
| 53 | } |
| 54 | }; |
| 55 | |
| 56 | Thing_declare (Interpreter); |
| 57 | Thing_declare (PraatApplication); |
| 58 | Thing_declare (PraatObjects); |
| 59 | Thing_declare (PraatPicture); |
| 60 | |
| 61 | void ManPage_runAllChunksToCache ( |
| 62 | ManPage me, |
| 63 | Interpreter optionalInterpreterReference, |
| 64 | const kGraphics_font font, |
| 65 | const double fontSize, |
| 66 | PraatApplication praatApplication, |
| 67 | PraatObjects praatObjects, |
| 68 | PraatPicture praatPicture, |
| 69 | MelderFolder rootDirectory |
| 70 | ); |
| 71 | |
| 72 | /* End of file ManPage.h */ |
| 73 | #endif |