├── COPYING ├── README.md ├── TODO.md ├── data ├── gresource.xml ├── icons │ ├── hicolor │ │ ├── 128x128 │ │ │ └── apps │ │ │ │ ├── io.github.mibi88.MibiMdEditor.Devel.png │ │ │ │ └── io.github.mibi88.MibiMdEditor.png │ │ ├── 48x48 │ │ │ └── apps │ │ │ │ ├── io.github.mibi88.MibiMdEditor.Devel.png │ │ │ │ └── io.github.mibi88.MibiMdEditor.png │ │ ├── scalable │ │ │ └── apps │ │ │ │ ├── io.github.mibi88.MibiMdEditor.Devel.svg │ │ │ │ └── io.github.mibi88.MibiMdEditor.svg │ │ └── symbolic │ │ │ └── apps │ │ │ └── io.github.mibi88.MibiMdEditor-symbolic.svg │ └── meson.build ├── io.github.mibi88.MibiMdEditor.appdata.xml.in ├── io.github.mibi88.MibiMdEditor.desktop.in ├── io.github.mibi88.MibiMdEditor.gschema.xml ├── meson.build ├── preferences.ui ├── preferencesswitch.ui ├── script_properties.ui └── window.ui ├── example_scripts ├── bbcode.py ├── markdown.py └── requirements.txt ├── meson.build ├── po ├── LINGUAS ├── MibiMdEditor.pot ├── POTFILES ├── de.po ├── fr.po ├── meson.build └── tr.po ├── screenshots ├── mibimdeditor_v04a1.png ├── mibimdeditor_v04a2.png └── mibimdeditor_v04b1.png └── src ├── application.vala ├── main.vala ├── meson.build └── ui ├── preferences.vala ├── preferencesswitch.vala ├── script_properties.vala └── window.vala /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | 341 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MibiMdEditor 2 | 3 | ## Description 4 | 5 | A simple Markdown editor written in Vala with GTK 4 6 | 7 | See TODO.md for upcoming features. 8 | 9 | ## Screenshots 10 | 11 | ### v.0.4-b1 : GTK4 + shotcuts + HTML generation using a script + preferences 12 | 13 | ![v.0.4-b1](screenshots/mibimdeditor_v04b1.png) 14 | 15 | ### v.0.4-a2 : Syntax highlighting and undo/redo buttons + shotcuts 16 | 17 | ![v.0.4-a2](screenshots/mibimdeditor_v04a2.png) 18 | 19 | ### v.0.4-a1 : First version of MibiMdEditor written in vala 20 | 21 | ![v.0.4-a1](screenshots/mibimdeditor_v04a1.png) 22 | 23 | ## Compiling 24 | 25 | This project requires 26 | 27 | * Vala 28 | * GTK 4 29 | * libadwaita 1 30 | * webkitgtk 6.0 31 | * gtksourceview 5 32 | 33 | Compile it using meson : 34 | 35 | ``` 36 | $ meson setup bin 37 | $ cd bin 38 | $ meson compile 39 | $ meson install 40 | ``` 41 | 42 | Then just run the binary in bin/src/. 43 | 44 | To get the preview working, you should add or write scripts as explained below. If you don't want to write a script yourself, you can try out the example scripts located in the example_script folder. 45 | 46 | ## Writing a script to generate HTML 47 | 48 | * The input text is in the first argument (the 2nd string of argv in C) 49 | * The output HTML will be grabbed from stdout 50 | 51 | When you finished your script 52 | 53 | * Go in Preferences > HTML Generation Scripts 54 | * Open "New Script" 55 | * Fill everything out 56 | * Click on the "Save" button 57 | * You should see your script in the list below 58 | * Then, close the Preferences Window 59 | * Check that your script is selected in the little dropdown menu on the bottom of the screen 60 | 61 | Then you're ready to write! 62 | -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | # MibiMdEditor TODO 2 | 3 | ## Main app 4 | 5 | - [x] Add shotcuts 6 | - [x] Add undo and redo 7 | - [ ] Allow HTML ToggleButton 8 | - [x] Choose language 9 | - [ ] Translations 10 | - [x] Syntax highlighting 11 | - [ ] 80 columns ruler? 12 | - [x] Preferences window 13 | - [x] Save preferences 14 | - [ ] Add custom CSS 15 | - [ ] Tabs, for editing multiple files 16 | - [ ] Give the file to open as an argument in command line 17 | 18 | ## GUI 19 | 20 | - [x] Use `icon-name` property instead of child `GtkImage`s in `GtkButton`s. 21 | 22 | -------------------------------------------------------------------------------- /data/gresource.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icons/hicolor/scalable/apps/io.github.mibi88.MibiMdEditor.svg 5 | window.ui 6 | preferences.ui 7 | preferencesswitch.ui 8 | script_properties.ui 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /data/icons/hicolor/128x128/apps/io.github.mibi88.MibiMdEditor.Devel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mibi88/MibiMdEditor/980fd9145d33988bf64fd52985b992cbd97cc63c/data/icons/hicolor/128x128/apps/io.github.mibi88.MibiMdEditor.Devel.png -------------------------------------------------------------------------------- /data/icons/hicolor/128x128/apps/io.github.mibi88.MibiMdEditor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mibi88/MibiMdEditor/980fd9145d33988bf64fd52985b992cbd97cc63c/data/icons/hicolor/128x128/apps/io.github.mibi88.MibiMdEditor.png -------------------------------------------------------------------------------- /data/icons/hicolor/48x48/apps/io.github.mibi88.MibiMdEditor.Devel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mibi88/MibiMdEditor/980fd9145d33988bf64fd52985b992cbd97cc63c/data/icons/hicolor/48x48/apps/io.github.mibi88.MibiMdEditor.Devel.png -------------------------------------------------------------------------------- /data/icons/hicolor/48x48/apps/io.github.mibi88.MibiMdEditor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mibi88/MibiMdEditor/980fd9145d33988bf64fd52985b992cbd97cc63c/data/icons/hicolor/48x48/apps/io.github.mibi88.MibiMdEditor.png -------------------------------------------------------------------------------- /data/icons/hicolor/scalable/apps/io.github.mibi88.MibiMdEditor.Devel.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /data/icons/hicolor/scalable/apps/io.github.mibi88.MibiMdEditor.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /data/icons/hicolor/symbolic/apps/io.github.mibi88.MibiMdEditor-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 13 | 15 | 34 | 46 | 47 | 52 | 57 | 61 | 65 | 69 | 70 | -------------------------------------------------------------------------------- /data/icons/meson.build: -------------------------------------------------------------------------------- 1 | application_id = 'io.github.mibi88.MibiMdEditor' 2 | 3 | scalable_dir = join_paths('hicolor', 'scalable', 'apps') 4 | install_data( 5 | join_paths(scalable_dir, ('@0@.svg').format(application_id)), 6 | install_dir: join_paths(get_option('datadir'), 'icons', scalable_dir) 7 | ) 8 | 9 | symbolic_dir = join_paths('hicolor', 'symbolic', 'apps') 10 | install_data( 11 | join_paths(symbolic_dir, ('@0@-symbolic.svg').format(application_id)), 12 | install_dir: join_paths(get_option('datadir'), 'icons', symbolic_dir) 13 | ) 14 | -------------------------------------------------------------------------------- /data/io.github.mibi88.MibiMdEditor.appdata.xml.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | io.github.mibi88.MibiMdEditor.desktop 4 | CC0-1.0 5 | GPL-2.0-or-later 6 | 7 |

Prepare your texts for the web.

8 |
9 |
10 | -------------------------------------------------------------------------------- /data/io.github.mibi88.MibiMdEditor.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=MibiMdEditor 3 | Exec=mibimdeditor 4 | Icon=io.github.mibi88.MibiMdEditor 5 | Terminal=false 6 | Type=Application 7 | Categories=GTK; 8 | StartupNotify=true 9 | -------------------------------------------------------------------------------- /data/io.github.mibi88.MibiMdEditor.gschema.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | Does the text editor has a grid background? 6 | 7 | If the text editor has a grid background. 8 | 9 | 10 | 11 | 12 | true 13 | Is current line highlighted in the text editor? 14 | 15 | If current line is highlighted in the text editor. 16 | 17 | 18 | 19 | 20 | true 21 | 22 | Does the text editor indents automatically the new line? 23 | 24 | 25 | If the text editor indents automatically a new line. 26 | 27 | 28 | 29 | 30 | true 31 | 32 | Does the text editor uses a monospaced font to display his content? 33 | 34 | 35 | If the text editor uses a monospaced font instead of a proportional one. 36 | 37 | 38 | 39 | 40 | [] 41 | 42 | Names of the different scripts to generate HTML. 43 | 44 | 45 | The names of the different scripts to generate HTML from other markup languages. 46 | 47 | 48 | 49 | 50 | [] 51 | 52 | Files of the different scripts to generate HTML. 53 | 54 | 55 | The files of the different scripts to generate HTML from other markup languages. 56 | 57 | 58 | 59 | 60 | [] 61 | 62 | Language name for the syntax highlighting for the markup languages parsed by the scripts to generate HTML. 63 | 64 | 65 | Language name for the syntax highlighting for the markup languages parsed by the scripts to generate HTML. 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /data/meson.build: -------------------------------------------------------------------------------- 1 | settings_schemas = [ 'io.github.mibi88.MibiMdEditor.gschema.xml' ] 2 | 3 | install_data(settings_schemas, install_dir: schemas_dir) 4 | 5 | gnome.compile_schemas( 6 | depend_files: files(settings_schemas)) 7 | mibimdeditor_sources = gnome.compile_resources( 8 | 'mibimdeditor-resources', 9 | 'gresource.xml', 10 | source_dir: 'data', 11 | ) 12 | 13 | meson.add_install_script(find_program('glib-compile-schemas'), schemas_dir) 14 | 15 | desktop_file = i18n.merge_file( 16 | input: 'io.github.mibi88.MibiMdEditor.desktop.in', 17 | output: 'io.github.mibi88.MibiMdEditor.desktop', 18 | type: 'desktop', 19 | po_dir: '../po', 20 | install: true, 21 | install_dir: join_paths(get_option('datadir'), 'applications') 22 | ) 23 | 24 | desktop_utils = find_program('desktop-file-validate', required: false) 25 | if desktop_utils.found() 26 | test('Validate desktop file', desktop_utils, args: [desktop_file]) 27 | endif 28 | 29 | appstream_file = i18n.merge_file( 30 | input: 'io.github.mibi88.MibiMdEditor.appdata.xml.in', 31 | output: 'io.github.mibi88.MibiMdEditor.appdata.xml', 32 | po_dir: '../po', 33 | install: true, 34 | install_dir: join_paths(get_option('datadir'), 'appdata') 35 | ) 36 | 37 | appstream_util = find_program('appstream-util', required: false) 38 | if appstream_util.found() 39 | test('Validate appstream file', appstream_util, args: ['validate', appstream_file]) 40 | endif 41 | 42 | subdir('icons') 43 | -------------------------------------------------------------------------------- /data/preferences.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 85 | 86 | -------------------------------------------------------------------------------- /data/preferencesswitch.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 20 | 21 | -------------------------------------------------------------------------------- /data/script_properties.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 66 | 67 | -------------------------------------------------------------------------------- /data/window.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 160 | 161 | True 162 | 163 | 164 |
165 | 166 | Save 167 | win.save 168 | 169 | 170 | Save as... 171 | win.save-as 172 | 173 |
174 |
175 | 176 |
177 | 178 | Preferences 179 | app.preferences 180 | 181 | 182 | About MibiMdEditor 184 | app.about 185 | 186 |
187 |
188 | 189 | MibiMdEditor 190 | 191 |
192 | -------------------------------------------------------------------------------- /example_scripts/bbcode.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | import bbcode 4 | import sys 5 | 6 | if len(sys.argv) > 1: 7 | parser = bbcode.Parser () 8 | html = parser.format (sys.argv[1]) 9 | sys.stdout.write (html) 10 | else: 11 | sys.stderr.write ("More arguments needed!\n") 12 | -------------------------------------------------------------------------------- /example_scripts/markdown.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | from markdown import * 4 | import sys 5 | 6 | if len(sys.argv) > 1: 7 | html = markdown(sys.argv[1], 8 | extensions=["extra", 9 | "toc", 10 | "smarty", 11 | "legacy_attrs", 12 | "meta"]) 13 | sys.stdout.write (html) 14 | else: 15 | sys.stdout.write ("More arguments needed!\n") 16 | -------------------------------------------------------------------------------- /example_scripts/requirements.txt: -------------------------------------------------------------------------------- 1 | markdown>=3.4.1 2 | bbcode>=1.1.0 3 | -------------------------------------------------------------------------------- /meson.build: -------------------------------------------------------------------------------- 1 | project('MibiMdEditor', ['c', 'vala'], 2 | version: 'v.0.4', 3 | meson_version: '>= 0.62.0', 4 | default_options: [ 'warning_level=2', 'werror=false', ], 5 | ) 6 | 7 | schemas_dir = get_option('prefix')/get_option('datadir')/'glib-2.0'/'schemas' 8 | 9 | gnome = import('gnome') 10 | i18n = import('i18n') 11 | 12 | subdir('data') 13 | subdir('src') 14 | subdir('po') 15 | 16 | gnome.post_install( 17 | glib_compile_schemas: true, 18 | gtk_update_icon_cache: true, 19 | update_desktop_database: true, 20 | ) 21 | -------------------------------------------------------------------------------- /po/LINGUAS: -------------------------------------------------------------------------------- 1 | de 2 | fr 3 | tr 4 | 5 | -------------------------------------------------------------------------------- /po/MibiMdEditor.pot: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | #, fuzzy 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: PACKAGE VERSION\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2023-09-10 18:05+0300\n" 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 | "Last-Translator: FULL NAME \n" 14 | "Language-Team: LANGUAGE \n" 15 | "Language: \n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | 20 | #: data/io.github.mibi88.MibiMdEditor.desktop.in:3 21 | msgid "MibiMdEditor" 22 | msgstr "" 23 | 24 | #: data/io.github.mibi88.MibiMdEditor.appdata.xml.in:7 25 | msgid "Prepare your texts for the web." 26 | msgstr "" 27 | 28 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:5 29 | msgid "Does the text editor has a grid background?" 30 | msgstr "" 31 | 32 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:6 33 | msgid "If the text editor has a grid background." 34 | msgstr "" 35 | 36 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:13 37 | msgid "Is current line highlighted in the text editor?" 38 | msgstr "" 39 | 40 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:14 41 | msgid "If current line is highlighted in the text editor." 42 | msgstr "" 43 | 44 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:21 45 | msgid "Does the text editor indents automatically the new line?" 46 | msgstr "" 47 | 48 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:24 49 | msgid "If the text editor indents automatically a new line." 50 | msgstr "" 51 | 52 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:31 53 | msgid "Does the text editor uses a monospaced font to display his content?" 54 | msgstr "" 55 | 56 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:34 57 | msgid "" 58 | "If the text editor uses a monospaced font instead of a proportional one." 59 | msgstr "" 60 | 61 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:41 62 | msgid "Names of the different scripts to generate HTML." 63 | msgstr "" 64 | 65 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:44 66 | msgid "" 67 | "The names of the different scripts to generate HTML from other markup " 68 | "languages." 69 | msgstr "" 70 | 71 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:51 72 | msgid "Files of the different scripts to generate HTML." 73 | msgstr "" 74 | 75 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:54 76 | msgid "" 77 | "The files of the different scripts to generate HTML from other markup " 78 | "languages." 79 | msgstr "" 80 | 81 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:61 82 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:64 83 | msgid "" 84 | "Language name for the syntax highlighting for the markup languages parsed by " 85 | "the scripts to generate HTML." 86 | msgstr "" 87 | 88 | #: data/preferences.ui:11 89 | msgid "Editor" 90 | msgstr "" 91 | 92 | #: data/preferences.ui:17 93 | msgid "Editor settings" 94 | msgstr "" 95 | 96 | #: data/preferences.ui:22 97 | msgid "Grid background" 98 | msgstr "" 99 | 100 | #: data/preferences.ui:23 101 | msgid "Get a grid background in the text editor" 102 | msgstr "" 103 | 104 | #: data/preferences.ui:30 105 | msgid "Line highlight" 106 | msgstr "" 107 | 108 | #: data/preferences.ui:31 109 | msgid "Highlight the line you're currently editing" 110 | msgstr "" 111 | 112 | #: data/preferences.ui:38 113 | msgid "Auto indent" 114 | msgstr "" 115 | 116 | #: data/preferences.ui:39 117 | msgid "Automatically indent the next line" 118 | msgstr "" 119 | 120 | #: data/preferences.ui:46 121 | msgid "Monospace font" 122 | msgstr "" 123 | 124 | #: data/preferences.ui:47 125 | msgid "Use a monospace font to display the text" 126 | msgstr "" 127 | 128 | #: data/preferences.ui:58 data/preferences.ui:79 129 | msgid "HTML generation scripts" 130 | msgstr "" 131 | 132 | #: data/preferences.ui:64 133 | msgid "New HTML generation script" 134 | msgstr "" 135 | 136 | #: data/preferences.ui:69 137 | msgid "New script" 138 | msgstr "" 139 | 140 | #: data/preferences.ui:70 141 | msgid "Create a new script to generate HTML" 142 | msgstr "" 143 | 144 | #: data/script_properties.ui:14 145 | msgid "Script name" 146 | msgstr "" 147 | 148 | #: data/script_properties.ui:21 149 | msgid "Path to the script" 150 | msgstr "" 151 | 152 | #: data/script_properties.ui:31 data/window.ui:39 153 | msgid "Open" 154 | msgstr "" 155 | 156 | #: data/script_properties.ui:40 157 | msgid "Syntax highlighting" 158 | msgstr "" 159 | 160 | #: data/script_properties.ui:51 data/window.ui:50 data/window.ui:166 161 | msgid "Save" 162 | msgstr "" 163 | 164 | #: data/script_properties.ui:62 165 | msgid "Delete" 166 | msgstr "" 167 | 168 | #: data/window.ui:29 169 | msgid "Add" 170 | msgstr "" 171 | 172 | #: data/window.ui:60 173 | msgid "Export" 174 | msgstr "" 175 | 176 | #: data/window.ui:79 177 | msgid "Main Menu" 178 | msgstr "" 179 | 180 | #: data/window.ui:89 181 | msgid "Redo" 182 | msgstr "" 183 | 184 | #: data/window.ui:99 185 | msgid "Undo" 186 | msgstr "" 187 | 188 | #: data/window.ui:152 189 | msgid "Refresh" 190 | msgstr "" 191 | 192 | #: data/window.ui:170 193 | msgid "Save as..." 194 | msgstr "" 195 | 196 | #: data/window.ui:178 197 | msgid "Preferences" 198 | msgstr "" 199 | 200 | #: data/window.ui:183 201 | msgid "About MibiMdEditor" 202 | msgstr "" 203 | 204 | #. dialog.documenters = null; 205 | #. Translators: Please enter your credits here 206 | #. (format: "Name https://example.com" or "Name ", no quotes, one name per line) 207 | #: src/application.vala:68 208 | msgid "translator-credits" 209 | msgstr "" 210 | 211 | #: src/application.vala:71 212 | msgid "Prepare your texts for the web" 213 | msgstr "" 214 | 215 | #: src/application.vala:72 216 | msgid "Copyright © 2023 mibi88" 217 | msgstr "" 218 | 219 | #: src/ui/script_properties.vala:105 220 | msgid "Do you really want to remove this script?" 221 | msgstr "" 222 | 223 | #: src/ui/script_properties.vala:106 src/ui/window.vala:130 224 | #: src/ui/window.vala:278 src/ui/window.vala:337 225 | msgid "OK" 226 | msgstr "" 227 | 228 | #: src/ui/script_properties.vala:106 src/ui/window.vala:130 229 | #: src/ui/window.vala:278 src/ui/window.vala:337 230 | msgid "Cancel" 231 | msgstr "" 232 | 233 | #. Subtitle of the window if no file is opened : 234 | #: src/ui/window.vala:38 235 | msgid "New file" 236 | msgstr "" 237 | 238 | #: src/ui/window.vala:128 239 | msgid "" 240 | "Your file isn't saved!\n" 241 | "Do you really want to quit?" 242 | msgstr "" 243 | 244 | #: src/ui/window.vala:252 245 | msgid "" 246 | "Please go to Preferences > HTML Generation scripts and add a new script to " 247 | "be able to generate html." 248 | msgstr "" 249 | 250 | #: src/ui/window.vala:276 251 | msgid "" 252 | "Your file isn't saved!\n" 253 | "Do you really want to create a new file?" 254 | msgstr "" 255 | 256 | #: src/ui/window.vala:335 257 | msgid "" 258 | "Your file isn't saved!\n" 259 | "Do you really want to open a file?" 260 | msgstr "" 261 | -------------------------------------------------------------------------------- /po/POTFILES: -------------------------------------------------------------------------------- 1 | data/io.github.mibi88.MibiMdEditor.desktop.in 2 | data/io.github.mibi88.MibiMdEditor.appdata.xml.in 3 | data/io.github.mibi88.MibiMdEditor.gschema.xml 4 | data/preferences.ui 5 | data/script_properties.ui 6 | data/window.ui 7 | src/application.vala 8 | src/ui/script_properties.vala 9 | src/ui/window.vala 10 | -------------------------------------------------------------------------------- /po/de.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: \n" 4 | "POT-Creation-Date: 2023-08-07 12:15+0200\n" 5 | "PO-Revision-Date: 2023-08-09 11:59+0200\n" 6 | "Last-Translator: Mibi88 \n" 7 | "Language-Team: \n" 8 | "Language: de\n" 9 | "MIME-Version: 1.0\n" 10 | "Content-Type: text/plain; charset=UTF-8\n" 11 | "Content-Transfer-Encoding: 8bit\n" 12 | "X-Generator: Poedit 3.3.1\n" 13 | "X-Poedit-Basepath: .\n" 14 | 15 | #: src/ui/window.ui:158 16 | msgid "Save" 17 | msgstr "Speichern" 18 | 19 | #: src/ui/window.ui:162 20 | msgid "Save as..." 21 | msgstr "Speichern unter..." 22 | 23 | #: src/ui/window.ui:170 24 | msgid "Preferences" 25 | msgstr "Einstellungen" 26 | 27 | #: src/ui/window.ui:175 28 | msgid "About MibiMdEditor" 29 | msgstr "Info zu MibiMdEditor" 30 | 31 | #: src/ui/window.vala:38 32 | msgid "New file" 33 | msgstr "Neue datei" 34 | 35 | #: src/ui/window.vala:130 36 | msgid "OK" 37 | msgstr "OK" 38 | 39 | #: src/ui/window.vala:130 40 | msgid "Cancel" 41 | msgstr "Abbrechen" 42 | 43 | #: src/ui/window.vala:252 44 | #, fuzzy 45 | msgid "" 46 | "Please go to Preferences > HTML Generation scripts and add a new script to " 47 | "be able to generate html." 48 | msgstr "" 49 | "Bitte gehen Sie in Einstellungen > HTML-Erstellung und fügen Sie ein neues " 50 | "Skript hinzu." 51 | 52 | #, fuzzy 53 | msgid "" 54 | "Your file isn't saved!\n" 55 | "Do you really want to create a new file?" 56 | msgstr "" 57 | "Diese Datei ist nicht gespeichert\n" 58 | "Wollen Sie wirklich eine neue erstellen?" 59 | 60 | msgid "" 61 | "Your file isn't saved!\n" 62 | "Do you really want to open a file?" 63 | msgstr "" 64 | "Diese Datei ist nicht gespeichert\n" 65 | "Wollen Sie wirklich eine öffnen?" 66 | 67 | #, fuzzy 68 | msgid "" 69 | "Your file isn't saved!\n" 70 | "Do you really want to quit?" 71 | msgstr "" 72 | "Diese Datei ist nicht gespeichert\n" 73 | "Wollen Sie wirklich MibiMdEditor schließen?" 74 | 75 | msgid "Do you really want to remove this script?" 76 | msgstr "Wollen sie wirklich dieses Skript löschen?" 77 | 78 | #, fuzzy 79 | msgid "Script named \"$name\" already exists." 80 | msgstr "Ein Skript mit dem Namen \"$name\" existiert schon." 81 | 82 | msgid "Grid background" 83 | msgstr "" 84 | 85 | msgid "Get a grid background in the text editor" 86 | msgstr "" 87 | 88 | msgid "Line highlight" 89 | msgstr "" 90 | 91 | msgid "Highlight the line you're currently editing" 92 | msgstr "" 93 | 94 | msgid "Auto indent" 95 | msgstr "Automatische Einrückung" 96 | 97 | #, fuzzy 98 | msgid "Automatically indent the next line" 99 | msgstr "Automatisch die neue Linien Einrücken" 100 | 101 | msgid "Monospace font" 102 | msgstr "Nichtproportionale Schriftart" 103 | 104 | #, fuzzy 105 | msgid "Use a monospace font to display the text" 106 | msgstr "Den Text mit einer nichtproportionale Schriftart anzeigen" 107 | 108 | #, fuzzy 109 | msgid "HTML generation scripts" 110 | msgstr "HTML erstellung Skripte" 111 | 112 | #, fuzzy 113 | msgid "New HTML generation script" 114 | msgstr "Neues HTML erstellung Skript" 115 | 116 | msgid "New script" 117 | msgstr "Neues Skript" 118 | 119 | #, fuzzy 120 | msgid "Create a new script to generate HTML" 121 | msgstr "Ein neues Skript erstellen um HTML zu erstellen" 122 | 123 | msgid "Delete" 124 | msgstr "Löschen" 125 | 126 | msgid "Syntax highlighting" 127 | msgstr "Syntaxhervorhebung" 128 | 129 | msgid "Path to the script" 130 | msgstr "Pfadname des Skripts" 131 | 132 | msgid "Script name" 133 | msgstr "Name des Skripts" 134 | 135 | #, fuzzy 136 | msgid "Editor" 137 | msgstr "Editor" 138 | -------------------------------------------------------------------------------- /po/fr.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: \n" 4 | "POT-Creation-Date: 2023-08-07 12:15+0200\n" 5 | "PO-Revision-Date: 2023-08-09 11:42+0200\n" 6 | "Last-Translator: Mibi88 \n" 7 | "Language-Team: \n" 8 | "Language: fr\n" 9 | "MIME-Version: 1.0\n" 10 | "Content-Type: text/plain; charset=UTF-8\n" 11 | "Content-Transfer-Encoding: 8bit\n" 12 | "X-Generator: Poedit 3.3.1\n" 13 | "X-Poedit-Basepath: .\n" 14 | 15 | #: src/ui/window.ui:158 16 | msgid "Save" 17 | msgstr "Enregistrer" 18 | 19 | #: src/ui/window.ui:162 20 | msgid "Save as..." 21 | msgstr "Enregistrer sous..." 22 | 23 | #: src/ui/window.ui:170 24 | msgid "Preferences" 25 | msgstr "Préférences" 26 | 27 | #: src/ui/window.ui:175 28 | msgid "About MibiMdEditor" 29 | msgstr "À propos de MibiMdEditor" 30 | 31 | #: src/ui/window.vala:38 32 | msgid "New file" 33 | msgstr "Nouveau fichier" 34 | 35 | #: src/ui/window.vala:130 36 | msgid "OK" 37 | msgstr "OK" 38 | 39 | #: src/ui/window.vala:130 40 | msgid "Cancel" 41 | msgstr "Annuler" 42 | 43 | #: src/ui/window.vala:252 44 | msgid "" 45 | "Please go to Preferences > HTML Generation scripts and add a new script to " 46 | "be able to generate html." 47 | msgstr "" 48 | "Allez dans Préférences > Génération du HTML et ajoutez un nouveau script " 49 | "pour pouvoir en générer." 50 | 51 | msgid "" 52 | "Your file isn't saved!\n" 53 | "Do you really want to create a new file?" 54 | msgstr "" 55 | "Ce fichier n'est pas enregistré.\n" 56 | "Voulez-vous vraiment créer un nouveau fichier ?" 57 | 58 | msgid "" 59 | "Your file isn't saved!\n" 60 | "Do you really want to open a file?" 61 | msgstr "" 62 | "Ce fichier n'est pas enregistré.\n" 63 | "Voulez-vous ouvrir un fichier ?" 64 | 65 | msgid "" 66 | "Your file isn't saved!\n" 67 | "Do you really want to quit?" 68 | msgstr "" 69 | "Ce fichier n'est pas enregistré.\n" 70 | "Voulez-vous vraiment quitter ?" 71 | 72 | msgid "Do you really want to remove this script?" 73 | msgstr "Voulez vous vraiment supprimer ce script ?" 74 | 75 | msgid "Script named \"$name\" already exists." 76 | msgstr "Un script nommé \"$name\" éxiste déjà." 77 | 78 | msgid "Grid background" 79 | msgstr "Arrière plan de grille" 80 | 81 | msgid "Get a grid background in the text editor" 82 | msgstr "Afficher une grille en arrière plan de l'éditeur de texte" 83 | 84 | msgid "Line highlight" 85 | msgstr "Surlignage de la ligne" 86 | 87 | msgid "Highlight the line you're currently editing" 88 | msgstr "Mise en évidence de la ligne en cours d'édition" 89 | 90 | msgid "Auto indent" 91 | msgstr "Indentation automatique" 92 | 93 | msgid "Automatically indent the next line" 94 | msgstr "Indentation automatique des nouvelles lignes" 95 | 96 | msgid "Monospace font" 97 | msgstr "Police d'écriture à chasse fixe" 98 | 99 | msgid "Use a monospace font to display the text" 100 | msgstr "Afficher le texte dans une police d'écriture à chasse fixe" 101 | 102 | msgid "HTML generation scripts" 103 | msgstr "Génération du code HTML" 104 | 105 | msgid "New HTML generation script" 106 | msgstr "Nouveau script de génération de code HTML" 107 | 108 | msgid "New script" 109 | msgstr "Nouveau script" 110 | 111 | msgid "Create a new script to generate HTML" 112 | msgstr "Créer un nouveau script pour générer du code HTML" 113 | 114 | msgid "Delete" 115 | msgstr "Supprimer" 116 | 117 | msgid "Syntax highlighting" 118 | msgstr "Coloration syntaxique" 119 | 120 | msgid "Path to the script" 121 | msgstr "Chemin vers le script" 122 | 123 | msgid "Script name" 124 | msgstr "Nom du script" 125 | 126 | msgid "Editor" 127 | msgstr "Éditeur" 128 | -------------------------------------------------------------------------------- /po/meson.build: -------------------------------------------------------------------------------- 1 | i18n.gettext('MibiMdEditor', preset: 'glib') 2 | -------------------------------------------------------------------------------- /po/tr.po: -------------------------------------------------------------------------------- 1 | # Turkish translation for MibiMdEditor. 2 | # Copyright (C) 2023 MibiMdEditor's COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the MibiMdEditor package. 4 | # 5 | # Sabri Ünal , 2023. 6 | # 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: \n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2023-09-10 17:50+0300\n" 12 | "PO-Revision-Date: 2023-09-10 18:01+0300\n" 13 | "Last-Translator: Sabri Ünal \n" 14 | "Language-Team: Türkçe \n" 15 | "Language: tr\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Plural-Forms: nplurals=1; plural=0;\n" 20 | "X-Generator: Poedit 3.3.1\n" 21 | 22 | #: data/io.github.mibi88.MibiMdEditor.desktop.in:3 23 | msgid "MibiMdEditor" 24 | msgstr "MibiMdEditor" 25 | 26 | #: data/io.github.mibi88.MibiMdEditor.appdata.xml.in:7 27 | msgid "Prepare your texts for the web." 28 | msgstr "Metinlerinizi web için hazırlayın." 29 | 30 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:5 31 | msgid "Does the text editor has a grid background?" 32 | msgstr "Metin düzenleyici ızgara arka plan kullansın mı?" 33 | 34 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:6 35 | msgid "If the text editor has a grid background." 36 | msgstr "Metin düzenleyicinin ızgara arka plan kullanma durumu." 37 | 38 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:13 39 | msgid "Is current line highlighted in the text editor?" 40 | msgstr "Geçerli satır metin düzenleyicide vurgulansın mı?" 41 | 42 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:14 43 | msgid "If current line is highlighted in the text editor." 44 | msgstr "Geçerli satırın metin düzenleyicide vurgulanma durumu." 45 | 46 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:21 47 | msgid "Does the text editor indents automatically the new line?" 48 | msgstr "Metin düzenleyici yeni satırı kendiliğinden girintilesin mi?" 49 | 50 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:24 51 | msgid "If the text editor indents automatically a new line." 52 | msgstr "Metin düzenleyicinin yeni satırı kendiliğinden girintileme durumu." 53 | 54 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:31 55 | msgid "Does the text editor uses a monospaced font to display his content?" 56 | msgstr "" 57 | "Metin düzenliyici içeriğini göstermek için eş aralıklı yazı tipi kullansın " 58 | "mı?" 59 | 60 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:34 61 | msgid "" 62 | "If the text editor uses a monospaced font instead of a proportional one." 63 | msgstr "Metin düzenleyicinin eş aralıklı yazı tipi kullanma durumu." 64 | 65 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:41 66 | msgid "Names of the different scripts to generate HTML." 67 | msgstr "HTML oluşturmak için kullanılan farklı betiklerin adları." 68 | 69 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:44 70 | msgid "" 71 | "The names of the different scripts to generate HTML from other markup " 72 | "languages." 73 | msgstr "" 74 | "Diğer işaretleme dillerinden HTML oluşturmak için kullanılan farklı komut " 75 | "dosyalarının adları." 76 | 77 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:51 78 | msgid "Files of the different scripts to generate HTML." 79 | msgstr "HTML oluşturmak için kullanılan farklı betiklerin dosyaları." 80 | 81 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:54 82 | msgid "" 83 | "The files of the different scripts to generate HTML from other markup " 84 | "languages." 85 | msgstr "" 86 | "Diğer işaretleme dillerinden HTML oluşturmak için betik dosyalarının " 87 | "dosyaları." 88 | 89 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:61 90 | #: data/io.github.mibi88.MibiMdEditor.gschema.xml:64 91 | msgid "" 92 | "Language name for the syntax highlighting for the markup languages parsed by " 93 | "the scripts to generate HTML." 94 | msgstr "" 95 | "HTML oluşturmak için betikler tarafından ayrıştırılan biçimlendirme " 96 | "dillerine yönelik söz dizimi vurgulamasının dil adı." 97 | 98 | #: data/preferences.ui:11 99 | msgid "Editor" 100 | msgstr "Düzenleyici" 101 | 102 | #: data/preferences.ui:17 103 | msgid "Editor settings" 104 | msgstr "Düzenleyici Ayarları" 105 | 106 | #: data/preferences.ui:22 107 | msgid "Grid background" 108 | msgstr "Izgara Arka Plan" 109 | 110 | #: data/preferences.ui:23 111 | msgid "Get a grid background in the text editor" 112 | msgstr "Metin düzenleyicide ızgara arka plan kullan" 113 | 114 | #: data/preferences.ui:30 115 | msgid "Line highlight" 116 | msgstr "Satır Vurgusu" 117 | 118 | #: data/preferences.ui:31 119 | msgid "Highlight the line you're currently editing" 120 | msgstr "Düzenlenmekte olan satırı vurgula" 121 | 122 | #: data/preferences.ui:38 123 | msgid "Auto indent" 124 | msgstr "Kendiliğinden Girintile" 125 | 126 | #: data/preferences.ui:39 127 | msgid "Automatically indent the next line" 128 | msgstr "Sonraki satırı kendiliğinden girintile" 129 | 130 | #: data/preferences.ui:46 131 | msgid "Monospace font" 132 | msgstr "Eş Aralıklı Yazı Tipi" 133 | 134 | #: data/preferences.ui:47 135 | msgid "Use a monospace font to display the text" 136 | msgstr "Metinleri görüntelemek için eş aralıklı yazı tipi kullan" 137 | 138 | #: data/preferences.ui:58 data/preferences.ui:79 139 | msgid "HTML generation scripts" 140 | msgstr "HTML Oluşturma Betikleri" 141 | 142 | #: data/preferences.ui:64 143 | msgid "New HTML generation script" 144 | msgstr "Yeni HTML Oluşturma Betiği" 145 | 146 | #: data/preferences.ui:69 147 | msgid "New script" 148 | msgstr "Yeni Betik" 149 | 150 | #: data/preferences.ui:70 151 | msgid "Create a new script to generate HTML" 152 | msgstr "HTML Oluşturmak İçin Yeni Betik Oluştur" 153 | 154 | #: data/script_properties.ui:14 155 | msgid "Script name" 156 | msgstr "Betik Adı" 157 | 158 | #: data/script_properties.ui:21 159 | msgid "Path to the script" 160 | msgstr "Betik Yolu" 161 | 162 | #: data/script_properties.ui:31 data/window.ui:39 163 | msgid "Open" 164 | msgstr "Aç" 165 | 166 | #: data/script_properties.ui:40 167 | msgid "Syntax highlighting" 168 | msgstr "Sözdizimi Vurgulaması" 169 | 170 | #: data/script_properties.ui:51 data/window.ui:50 data/window.ui:166 171 | msgid "Save" 172 | msgstr "Kaydet" 173 | 174 | #: data/script_properties.ui:62 175 | msgid "Delete" 176 | msgstr "Sil" 177 | 178 | #: data/window.ui:29 179 | msgid "Add" 180 | msgstr "Ekle" 181 | 182 | #: data/window.ui:60 183 | msgid "Export" 184 | msgstr "Dışa Aktar" 185 | 186 | #: data/window.ui:79 187 | msgid "Main Menu" 188 | msgstr "Ana Menü" 189 | 190 | #: data/window.ui:89 191 | msgid "Redo" 192 | msgstr "Yinele" 193 | 194 | #: data/window.ui:99 195 | msgid "Undo" 196 | msgstr "Geri Al" 197 | 198 | #: data/window.ui:152 199 | msgid "Refresh" 200 | msgstr "Yenile" 201 | 202 | #: data/window.ui:170 203 | msgid "Save as..." 204 | msgstr "Farklı Kaydet..." 205 | 206 | #: data/window.ui:178 207 | msgid "Preferences" 208 | msgstr "Tercihler" 209 | 210 | #: data/window.ui:183 211 | msgid "About MibiMdEditor" 212 | msgstr "MibiMdEditor Hakkında" 213 | 214 | #. dialog.documenters = null; 215 | #. Translators: Please enter your credits here 216 | #. (format: "Name https://example.com" or "Name ", no quotes, one name per line) 217 | #: src/application.vala:68 218 | msgid "translator-credits" 219 | msgstr "Sabri Ünal " 220 | 221 | #: src/application.vala:71 222 | msgid "Prepare your texts for the web" 223 | msgstr "Metinlerinizi web için hazırlayın" 224 | 225 | #: src/application.vala:72 226 | msgid "Copyright © 2023 mibi88" 227 | msgstr "Telif Hakkı © 2023 mibi88" 228 | 229 | #: src/ui/script_properties.vala:105 230 | msgid "Do you really want to remove this script?" 231 | msgstr "Bu betiği kaldırmak istediğinizden emin misiniz?" 232 | 233 | #: src/ui/script_properties.vala:106 src/ui/window.vala:130 234 | #: src/ui/window.vala:278 src/ui/window.vala:337 235 | msgid "OK" 236 | msgstr "Tamam" 237 | 238 | #: src/ui/script_properties.vala:106 src/ui/window.vala:130 239 | #: src/ui/window.vala:278 src/ui/window.vala:337 240 | msgid "Cancel" 241 | msgstr "İptal" 242 | 243 | #. Subtitle of the window if no file is opened : 244 | #: src/ui/window.vala:38 245 | msgid "New file" 246 | msgstr "Yeni Dosya" 247 | 248 | #: src/ui/window.vala:128 249 | msgid "" 250 | "Your file isn't saved!\n" 251 | "Do you really want to quit?" 252 | msgstr "" 253 | "Dosyanız kaydedilmemiş!\n" 254 | "Çıkmak istediğinize emin misiniz?" 255 | 256 | #: src/ui/window.vala:252 257 | msgid "" 258 | "Please go to Preferences > HTML Generation scripts and add a new script to " 259 | "be able to generate html." 260 | msgstr "" 261 | "Lütfen Tercihler > HTML Oluşturma betiklerine gidin ve HTML oluşturabilmek " 262 | "için yeni bir betik ekleyin." 263 | 264 | #: src/ui/window.vala:276 265 | msgid "" 266 | "Your file isn't saved!\n" 267 | "Do you really want to create a new file?" 268 | msgstr "" 269 | "Dosyanız kaydedilmemiş!\n" 270 | "Yeni dosya oluşturmak istediğinize emin misiniz?" 271 | 272 | #: src/ui/window.vala:335 273 | msgid "" 274 | "Your file isn't saved!\n" 275 | "Do you really want to open a file?" 276 | msgstr "" 277 | "Dosyanız kaydedilmemiş!\n" 278 | "Yeni dosya açmak istediğinize emin misiniz?" 279 | 280 | #~ msgid "Script named \"$name\" already exists." 281 | #~ msgstr "\"$name\" adlı betik zaten var." 282 | -------------------------------------------------------------------------------- /screenshots/mibimdeditor_v04a1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mibi88/MibiMdEditor/980fd9145d33988bf64fd52985b992cbd97cc63c/screenshots/mibimdeditor_v04a1.png -------------------------------------------------------------------------------- /screenshots/mibimdeditor_v04a2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mibi88/MibiMdEditor/980fd9145d33988bf64fd52985b992cbd97cc63c/screenshots/mibimdeditor_v04a2.png -------------------------------------------------------------------------------- /screenshots/mibimdeditor_v04b1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mibi88/MibiMdEditor/980fd9145d33988bf64fd52985b992cbd97cc63c/screenshots/mibimdeditor_v04b1.png -------------------------------------------------------------------------------- /src/application.vala: -------------------------------------------------------------------------------- 1 | /* application.vala 2 | * 3 | * Copyright 2023 Mibi88 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along 16 | * with this program; if not, write to the Free Software Foundation, Inc., 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * SPDX-License-Identifier: GPL-2.0-or-later 20 | */ 21 | 22 | using GLib; 23 | using Gtk; 24 | using Gdk; 25 | using WebKit; 26 | using Adw; 27 | 28 | class MibiMdEditorApplication : Gtk.Application { 29 | private MibiMdEditor window; 30 | public MibiMdEditorApplication () { 31 | Object (application_id: "io.github.mibi88.MibiMdEditor", 32 | flags: ApplicationFlags.FLAGS_NONE); 33 | ActionEntry[] action_entries = { 34 | { "about", this.about_dialog }, 35 | { "preferences", this.preferences_dialog }, 36 | }; 37 | this.add_action_entries (action_entries, this); 38 | this.set_accels_for_action ("app.preferences", {"comma"}); 39 | set_accels_for_action ("win.new", {"n"}); 40 | set_accels_for_action ("win.open", {"o"}); 41 | set_accels_for_action ("win.export", {"e"}); 42 | set_accels_for_action ("win.save", {"s"}); 43 | set_accels_for_action ("win.save-as", {"s"}); 44 | set_accels_for_action ("win.quit", {"q"}); 45 | } 46 | public override void activate () { 47 | base.activate (); 48 | if (this.active_window == null) { 49 | window = new MibiMdEditor (this); 50 | window.close_request.connect (() => { 51 | window.quit(); 52 | return true; 53 | }); 54 | window.present (); 55 | } 56 | } 57 | private void about_dialog () { 58 | Adw.AboutWindow dialog = new Adw.AboutWindow (); 59 | dialog.transient_for = window; 60 | dialog.modal = true; 61 | dialog.destroy_with_parent = true; 62 | dialog.artists = {"mibi88"}; 63 | dialog.developers = {"mibi88"}; 64 | //dialog.documenters = null; 65 | 66 | // Translators: Please enter your credits here 67 | // (format: "Name https://example.com" or "Name ", no quotes, one name per line) 68 | dialog.translator_credits = _("translator-credits"); 69 | dialog.application_name = MibiMdEditor.TITLE; 70 | dialog.application_icon = "io.github.mibi88.MibiMdEditor"; 71 | dialog.comments = _("Prepare your texts for the web"); 72 | dialog.copyright = _("Copyright © 2023 mibi88"); 73 | dialog.version = "v.0.4"; 74 | dialog.license_type = Gtk.License.GPL_2_0; 75 | dialog.website = "https://github.com/mibi88/MibiMdEditor"; 76 | dialog.issue_url = "https://github.com/mibi88/MibiMdEditor/issues/new"; 77 | dialog.present (); 78 | } 79 | private void preferences_dialog () { 80 | // Create the dialog 81 | PreferencesDialog dialog = new PreferencesDialog (window); 82 | // Show the dialog 83 | dialog.present (); 84 | dialog.close_request.connect(() => { 85 | // Save 86 | dialog.save (); 87 | // Reload the preferences 88 | window.load_preferences (); 89 | // Close the window 90 | dialog.destroy (); 91 | return true; 92 | }); 93 | dialog.refresh_scripts.connect (window.refresh_scripts_list); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/main.vala: -------------------------------------------------------------------------------- 1 | /* main.vala 2 | * 3 | * Copyright 2023 Mibi88 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along 16 | * with this program; if not, write to the Free Software Foundation, Inc., 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * SPDX-License-Identifier: GPL-2.0-or-later 20 | */ 21 | 22 | using GLib; 23 | using Gtk; 24 | using Gdk; 25 | using WebKit; 26 | using Adw; 27 | 28 | [CCode(cname="GETTEXT_PACKAGE")] 29 | extern const string GETTEXT_PACKAGE; 30 | [CCode(cname="LOCALE_INSTALL_DIR")] 31 | extern const string LOCALE_INSTALL_DIR; 32 | 33 | public static int main (string[] args) { 34 | Gtk.init (); 35 | Adw.init (); 36 | GtkSource.init (); 37 | Intl.setlocale (LocaleCategory.ALL, ""); 38 | Intl.bindtextdomain (GETTEXT_PACKAGE, LOCALE_INSTALL_DIR); 39 | Intl.bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); 40 | Intl.textdomain (GETTEXT_PACKAGE); 41 | var app = new MibiMdEditorApplication (); 42 | return app.run (args); 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/meson.build: -------------------------------------------------------------------------------- 1 | mibimdeditor_sources += [ 2 | 'ui/window.vala', 3 | 'main.vala', 4 | 'ui/preferencesswitch.vala', 5 | 'ui/script_properties.vala', 6 | 'ui/preferences.vala', 7 | 'application.vala', 8 | ] 9 | 10 | mibimdeditor_deps = [ 11 | dependency('glib-2.0'), 12 | dependency('gobject-2.0'), 13 | dependency('gtk4'), 14 | dependency('webkitgtk-6.0'), 15 | dependency('gtksourceview-5'), 16 | dependency('libadwaita-1'), 17 | ] 18 | 19 | executable('mibimdeditor', mibimdeditor_sources, 20 | vala_args: '--target-glib=2.58', 21 | c_args: [ 22 | '-DGETTEXT_PACKAGE="'+meson.project_name()+'"', 23 | '-DLOCALE_INSTALL_DIR="'+get_option('prefix')/get_option('localedir')+'"', 24 | ], 25 | dependencies: mibimdeditor_deps, 26 | install: true, 27 | ) 28 | 29 | -------------------------------------------------------------------------------- /src/ui/preferences.vala: -------------------------------------------------------------------------------- 1 | /* preferences.vala 2 | * 3 | * Copyright 2023 Mibi88 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along 16 | * with this program; if not, write to the Free Software Foundation, Inc., 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * SPDX-License-Identifier: GPL-2.0-or-later 20 | */ 21 | 22 | using GLib; 23 | using Gtk; 24 | using Adw; 25 | 26 | [GtkTemplate (ui = "/MibiMdEditor/preferences.ui")] 27 | public class PreferencesDialog : Adw.PreferencesWindow { 28 | // Some variables are commented because they are not used. Uncomment them if 29 | // you need them. 30 | // Editor settings 31 | // [GtkChild] 32 | // private unowned PreferencesPage editor; 33 | [GtkChild] 34 | public unowned PreferencesGroup text_edition; 35 | [GtkChild] 36 | public unowned PreferencesSwitch bg_grid; 37 | [GtkChild] 38 | public unowned PreferencesSwitch lhighlight; 39 | [GtkChild] 40 | public unowned PreferencesSwitch auto_indent; 41 | [GtkChild] 42 | public unowned PreferencesSwitch mono_font; 43 | // Generator settings 44 | // [GtkChild] 45 | // private unowned PreferencesPage generation; 46 | //[GtkChild] 47 | //public unowned ExpanderRow new_script_row; 48 | [GtkChild] 49 | private unowned PreferencesGroup scripts; 50 | [GtkChild] 51 | private unowned ExpanderRow new_script_row; 52 | private ScriptProperties new_script_properties; 53 | // Settings saving 54 | private GLib.Settings settings; 55 | // Script list widgets 56 | private Adw.ExpanderRow[] expanders; 57 | private ScriptProperties[] script_properties; 58 | public signal void refresh_scripts () { 59 | stdout.puts ("Nothing connected to script refreshing.\n"); 60 | } 61 | public void refresh_script_list () { 62 | // Remove all childs of scripts, the widget that will contain the list 63 | // of all the scripts. 64 | for (int i=0;i { 110 | try { 111 | if (cancel_dialog.choose.end (res) == 112 | cancel_dialog.cancel_button) { 113 | stdout.puts ("Removing cancelled\n"); 114 | } else { 115 | delete_script_action (); 116 | } 117 | } catch (Error error) { 118 | stderr.printf ("Error when removing script: %s\n", 119 | error.message); 120 | } 121 | }); 122 | } 123 | private void save_script () { 124 | Variant names_variant = settings.get_value ("script-names"); 125 | Variant files_variant = settings.get_value ("script-files"); 126 | Variant syntax_highlighting_variant = 127 | settings.get_value ("script-syntax-highlighting"); 128 | VariantIter iter = names_variant.iterator (); 129 | int script_amount = (int)iter.n_children (); 130 | stdout.puts (@"$script_amount scripts currently existing.\n"); 131 | if (new_script) { 132 | if (script_amount > 0) { 133 | for (int i=0;i { 223 | try { 224 | GLib.File file = file_chooser.open.end(res); 225 | script_path.text = file.get_path (); 226 | } catch (Error error) { 227 | stderr.printf ("Error when loading script: %s\n", 228 | error.message); 229 | } 230 | }); 231 | } 232 | public ScriptProperties (Gtk.Window _window, bool _new_script, 233 | int _script_position) { 234 | window = _window; 235 | new_script = _new_script; 236 | script_position = _script_position; 237 | // Get all available languages and let the user choose between them for 238 | // the syntax highlighting ComboRow. 239 | language_manager = new LanguageManager (); 240 | language_list = new StringList (language_manager.language_ids); 241 | syntax_highlighting.model = language_list; 242 | // Open a file dialog if the select_script Button is pressed 243 | select_script.clicked.connect (choose_script); 244 | save.clicked.connect (save_script); 245 | settings = new GLib.Settings ("io.github.mibi88.MibiMdEditor"); 246 | if (new_script) { 247 | delete_button.destroy (); 248 | stdout.puts ("Delete button destroyed!\n"); 249 | } else { 250 | delete_button.visible = true; 251 | delete_button.clicked.connect (delete_script); 252 | // Set the current value of the script item 253 | Variant names_variant = settings.get_value ("script-names"); 254 | Variant files_variant = settings.get_value ("script-files"); 255 | Variant syntax_highlighting_variant = settings.get_value ( 256 | "script-syntax-highlighting"); 257 | if (names_variant.n_children () > 0) { 258 | string str = names_variant.get_child_value ( 259 | script_position 260 | ).get_string (); 261 | script_name.text = str; 262 | str = files_variant.get_child_value ( 263 | script_position 264 | ).get_string (); 265 | script_path.text = str; 266 | string language = syntax_highlighting_variant.get_child_value ( 267 | script_position).get_string (); 268 | int i; 269 | for (i=0;i= language_manager.language_ids.length) i = 0; 275 | stdout.puts (@"Language position in list: $i\n"); 276 | syntax_highlighting.selected = i; 277 | } 278 | } 279 | } 280 | } 281 | 282 | -------------------------------------------------------------------------------- /src/ui/window.vala: -------------------------------------------------------------------------------- 1 | /* window.vala 2 | * 3 | * Copyright 2023 Mibi88 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along 16 | * with this program; if not, write to the Free Software Foundation, Inc., 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | * 19 | * SPDX-License-Identifier: GPL-2.0-or-later 20 | */ 21 | 22 | using GLib; 23 | using Gtk; 24 | using GtkSource; 25 | using Gdk; 26 | using WebKit; 27 | using Adw; 28 | 29 | [GtkTemplate (ui = "/MibiMdEditor/window.ui")] 30 | public class MibiMdEditor : Adw.ApplicationWindow { 31 | // Some constants of the app 32 | public const string TITLE = "MibiMdEditor"; // App title 33 | public const string APPICON = 34 | "/MibiMdEditor/icons/hicolor/scalable/apps/MibiMdEditor.svg"; 35 | private const int WIDTH = 640; 36 | private const int HEIGHT = 480; 37 | // Subtitle of the window if no file is opened : 38 | private const string NOTHING_OPEN_TEXT = _("New file"); 39 | //// WIDGETS //// 40 | // Some variables are commented because they are not used. Uncomment them if 41 | // you need them. 42 | // Box that contains everything 43 | // [GtkChild] 44 | // private unowned Gtk.Box vbox; 45 | // All widgets are in a horizontal box, except the headerbar 46 | [GtkChild] 47 | private unowned Gtk.Paned hbox; 48 | // SourceView that will contain the source text 49 | // [GtkChild] 50 | // private ScrolledWindow textwindow; 51 | public GtkSource.LanguageManager language; 52 | [GtkChild] 53 | public unowned GtkSource.Buffer text_buffer; 54 | [GtkChild] 55 | public unowned GtkSource.View text; 56 | // WebView that previews the rendered source text 57 | [GtkChild] 58 | private unowned WebView preview; 59 | // Headerbar 60 | // [GtkChild] 61 | // private unowned Adw.HeaderBar headerbar; 62 | // Title and subtitle labels 63 | [GtkChild] 64 | private unowned WindowTitle title_widget; 65 | // Headerbar new button 66 | [GtkChild] 67 | private unowned Button new_button; 68 | // Headerbar open button 69 | [GtkChild] 70 | private unowned Button open_button; 71 | // Headerbar save MenuButton 72 | // [GtkChild] 73 | // private unowned MenuButton save_menu; 74 | // Export button 75 | [GtkChild] 76 | private unowned Button export_button; 77 | // Headerbar saved icon 78 | [GtkChild] 79 | private unowned Image saved_icon; 80 | // File chooser dialog 81 | private FileDialog file_chooser; 82 | // Undo Button 83 | [GtkChild] 84 | private unowned Button undo_button; 85 | // Redo Button 86 | [GtkChild] 87 | private unowned Button redo_button; 88 | // Headerbar burger 89 | // [GtkChild] 90 | // private unowned MenuButton burger_menu; 91 | // Burger Menu 92 | // private GLib.Menu burger_popup; 93 | // Actionbar 94 | [GtkChild] 95 | private unowned Gtk.DropDown script; 96 | [GtkChild] 97 | private unowned Gtk.Button refresh; 98 | //// OTHER VARIABLES //// 99 | // True if a file is open 100 | private bool file_open = false; 101 | // True if the file is already saved 102 | private bool file_saved = true; 103 | // The file that is currently opened : 104 | private string file_name = NOTHING_OPEN_TEXT; 105 | // The html data 106 | private string html_data; 107 | // The opened file 108 | private GLib.File file = null; 109 | // If the window was closed 110 | private bool closed = false; 111 | // Variants of the scripts 112 | public Variant names_variant; 113 | public Variant files_variant; 114 | public Variant syntax_highlighting_variant; 115 | // Amount of scripts 116 | public int script_amount; 117 | // The parent folder of the file we're currently editing 118 | string working_dir; 119 | bool generation_finished = true; 120 | Subprocess subprocess; 121 | //// METHODS //// 122 | // DIALOGS // 123 | // WINDOW // 124 | public void quit() { 125 | stdout.puts ("User tried to quit.\n"); 126 | if (!file_saved) { 127 | Gtk.AlertDialog cancel_dialog = new Gtk.AlertDialog ( 128 | _("""Your file isn't saved! 129 | Do you really want to quit?""")); 130 | cancel_dialog.buttons = {_("OK"), _("Cancel")}; 131 | cancel_dialog.default_button = 1; 132 | cancel_dialog.cancel_button = 1; 133 | cancel_dialog.choose.begin (this, null, (obj, res) => { 134 | try { 135 | if (cancel_dialog.choose.end (res) == 136 | cancel_dialog.cancel_button) { 137 | stdout.puts ("Quit cancelled\n"); 138 | } else { 139 | destroy (); 140 | closed = true; 141 | } 142 | } catch (Error error) { 143 | stderr.printf ("Error when loading file: %s\n", 144 | error.message); 145 | } 146 | }); 147 | } else { 148 | destroy (); 149 | closed = true; 150 | } 151 | } 152 | // WIDGETS /// 153 | public void load_preferences () { 154 | GLib.Settings settings = 155 | new GLib.Settings ("io.github.mibi88.MibiMdEditor"); 156 | text.background_pattern = settings.get_boolean ("bg-grid") ? 157 | BackgroundPatternType.GRID : 158 | BackgroundPatternType.NONE; 159 | text.highlight_current_line = settings.get_boolean ("lhighlight"); 160 | text.auto_indent = settings.get_boolean ("auto-indent"); 161 | text.monospace = settings.get_boolean ("mono-font"); 162 | } 163 | public void refresh_scripts_list () { 164 | GLib.Settings settings = 165 | new GLib.Settings ("io.github.mibi88.MibiMdEditor"); 166 | names_variant = settings.get_value ("script-names"); 167 | files_variant = settings.get_value ("script-files"); 168 | syntax_highlighting_variant = 169 | settings.get_value ("script-syntax-highlighting"); 170 | script_amount = (int)names_variant.n_children (); 171 | if (script_amount <= script.selected) script.selected = 0; 172 | // Add all the scripts to the DropDown. 173 | if (script_amount > 0) { 174 | StringList script_list = new StringList (null); 175 | for (int i=0;i 0) { 203 | // Set the syntax highlighting language 204 | Variant lang_name_variant = 205 | syntax_highlighting_variant.get_child_value (script.selected); 206 | text_buffer.language = 207 | language.get_language (lang_name_variant.get_string ()); 208 | // Get the script path 209 | string script_path = 210 | files_variant.get_child_value (script.selected).get_string (); 211 | string[] argv = {script_path, text_buffer.text}; 212 | working_dir = "/"; 213 | if (file != null) { 214 | working_dir = file.get_parent ().get_path (); 215 | } 216 | stdout.puts (@"Working directory: $working_dir\n"); 217 | // Run the script to generate HTML 218 | try { 219 | string stdout_str = ""; 220 | string stderr_str = ""; 221 | html_data = ""; 222 | generation_finished = false; 223 | subprocess = new Subprocess.newv (argv, 224 | SubprocessFlags.STDOUT_PIPE | 225 | SubprocessFlags.STDERR_PIPE); 226 | subprocess.wait_async.begin (null, (obj, res) => { 227 | try { 228 | if (!subprocess.wait_async.end (res)) { 229 | subprocess.force_exit (); 230 | } 231 | subprocess.communicate_utf8 (null, null, out stdout_str, 232 | out stderr_str); 233 | stdout.puts ("Finished getting HTML!\n"); 234 | if (stderr_str != "") html_data += 235 | @"$stderr_str"; 236 | html_data += stdout_str; 237 | html_generation_end (); 238 | } catch (Error error) { 239 | stderr.printf ( 240 | "Error when waiting for script exit: %s\n", 241 | error.message); 242 | subprocess.force_exit (); 243 | generation_finished = true; 244 | } 245 | }); 246 | } catch (Error error) { 247 | html_data = @"Error when running script: $(error.message)"; 248 | html_generation_end (); 249 | generation_finished = true; 250 | } 251 | } else { 252 | html_data = _("Please go to Preferences > HTML Generation " + 253 | "scripts and add a new script to be able to generate html."); 254 | html_generation_end (); 255 | generation_finished = true; 256 | } 257 | } 258 | // Update the preview 259 | private void update_webview_content () { 260 | preview.load_html (html_data, @"file://$working_dir/index.html"); 261 | update_saved_icon (); 262 | } 263 | private void update_webview () { 264 | html_generation_end.connect (update_webview_content); 265 | generate_html (); 266 | } 267 | private void update_preview () { 268 | file_saved = false; 269 | update_webview (); 270 | } 271 | // FILE // 272 | // Create a new file 273 | public void new_file () { 274 | if (!file_saved) { 275 | Gtk.AlertDialog cancel_dialog = new Gtk.AlertDialog ( 276 | _("""Your file isn't saved! 277 | Do you really want to create a new file?""")); 278 | cancel_dialog.buttons = {_("OK"), _("Cancel")}; 279 | cancel_dialog.default_button = 1; 280 | cancel_dialog.cancel_button = 1; 281 | cancel_dialog.choose.begin (this, null, (obj, res) => { 282 | try { 283 | if (cancel_dialog.choose.end (res) == 284 | cancel_dialog.cancel_button) { 285 | stdout.puts ("New file creation cancelled\n"); 286 | } else { 287 | text.buffer.text = ""; 288 | file_open = false; 289 | file_saved = true; 290 | file_name = NOTHING_OPEN_TEXT; 291 | file = null; 292 | update_webview (); 293 | } 294 | } catch (Error error) { 295 | stderr.printf ("Error when loading file: %s\n", 296 | error.message); 297 | } 298 | }); 299 | } else { 300 | text.buffer.text = ""; 301 | file_open = false; 302 | file_saved = true; 303 | file_name = NOTHING_OPEN_TEXT; 304 | file = null; 305 | update_webview (); 306 | } 307 | update_saved_icon (); 308 | update_subtitle (); 309 | } 310 | // Open a file 311 | private void open_file_dialog () { 312 | file_chooser = new Gtk.FileDialog (); 313 | file_chooser.open.begin (this, null, (obj, res) => { 314 | try { 315 | uint8[] contents; 316 | string etag_out; 317 | file = file_chooser.open.end(res); 318 | file.load_contents (null, out contents, 319 | out etag_out); 320 | text.buffer.text = (string) contents; 321 | file_open = true; 322 | file_saved = true; 323 | update_webview (); 324 | } catch (Error error) { 325 | stderr.printf ("Error when loading file: %s\n", 326 | error.message); 327 | } 328 | update_saved_icon (); 329 | update_subtitle (); 330 | }); 331 | } 332 | public void open_file () { 333 | if (!file_saved) { 334 | Gtk.AlertDialog cancel_dialog = new Gtk.AlertDialog ( 335 | _("Your file isn't saved!\nDo you really want to open a file?") 336 | ); 337 | cancel_dialog.buttons = {_("OK"), _("Cancel")}; 338 | cancel_dialog.default_button = 1; 339 | cancel_dialog.cancel_button = 1; 340 | cancel_dialog.choose.begin (this, null, (obj, res) => { 341 | try { 342 | if (cancel_dialog.choose.end (res) == 343 | cancel_dialog.cancel_button) { 344 | stdout.puts ("New file creation cancelled\n"); 345 | } else { 346 | open_file_dialog (); 347 | } 348 | } catch (Error error) { 349 | stderr.printf ("Error when loading file: %s\n", 350 | error.message); 351 | } 352 | }); 353 | } else { 354 | open_file_dialog (); 355 | } 356 | } 357 | // Save the file 358 | public void save_file () { 359 | if (file != null) { 360 | try { 361 | file.replace_contents (text.buffer.text.data, null, true, 362 | FileCreateFlags.NONE, null, null); 363 | file_saved = true; 364 | } catch (Error error) { 365 | stderr.printf ("Error when saving file: %s\n", error.message); 366 | } 367 | } else { 368 | save_as_file (); 369 | } 370 | update_saved_icon (); 371 | update_subtitle (); 372 | } 373 | // Save as the file 374 | public void save_as_file () { 375 | file_chooser = new Gtk.FileDialog (); 376 | file_chooser.save.begin (this, null, (obj, res) => { 377 | try { 378 | GLib.File tmp_file = file_chooser.save.end (res); 379 | file = tmp_file; 380 | file.replace_contents (text.buffer.text.data, null, true, 381 | FileCreateFlags.NONE, null, null); 382 | file_open = true; 383 | file_saved = true; 384 | } catch (Error error) { 385 | stderr.printf ("Error when saving file: %s\n", error.message); 386 | } 387 | update_saved_icon (); 388 | update_subtitle (); 389 | }); 390 | } 391 | public void export_html_dialog () { 392 | html_generation_end.disconnect (export_html_dialog); 393 | file_chooser = new Gtk.FileDialog (); 394 | file_chooser.save.begin(this, null, (obj, res) => { 395 | try { 396 | GLib.File export_file = file_chooser.save.end (res); 397 | export_file.replace_contents (html_data.data, null, true, 398 | FileCreateFlags.NONE, null, null); 399 | } catch (Error error) { 400 | stderr.printf ("Error when saving file: %s\n", error.message); 401 | } 402 | }); 403 | } 404 | public void export_html () { 405 | html_generation_end.connect (export_html_dialog); 406 | generate_html (); 407 | } 408 | public void editor_undo () { 409 | text_buffer.undo (); 410 | } 411 | public void editor_redo () { 412 | text_buffer.redo (); 413 | } 414 | public MibiMdEditor (Gtk.Application app) { 415 | Object (application: app); 416 | language = new LanguageManager (); 417 | // Configure the sourceview and the sourcebuffer. 418 | text_buffer.language = language.get_language ("html"); 419 | text.wrap_mode = WrapMode.WORD; // Wrap on words 420 | text_buffer.end_user_action.connect (update_preview); 421 | // Add actions 422 | ActionEntry[] action_entries = { 423 | { "new", new_file }, 424 | { "open", open_file }, 425 | { "export", export_html }, 426 | { "save", save_file }, 427 | { "save-as", save_as_file }, 428 | { "quit", quit } 429 | }; 430 | add_action_entries (action_entries, this); 431 | // Buttons 432 | new_button.clicked.connect (new_file); 433 | open_button.clicked.connect (open_file); 434 | export_button.clicked.connect (export_html); 435 | undo_button.clicked.connect (editor_undo); 436 | redo_button.clicked.connect (editor_redo); 437 | // TODO: Handle reloading on the preview 438 | // Center the handle of hbox 439 | hbox.set_position(WIDTH/2); 440 | refresh_scripts_list (); 441 | update_webview (); 442 | load_preferences (); 443 | new_file (); 444 | // Set sensitive of the undo/redo buttons to can_undo and can_redo 445 | undo_button.sensitive = text_buffer.can_undo; 446 | redo_button.sensitive = text_buffer.can_redo; 447 | // Bind properties to disable undo/redo buttons if they should. 448 | text_buffer.bind_property ("can-undo", undo_button, "sensitive", 449 | BindingFlags.DEFAULT); 450 | text_buffer.bind_property ("can-redo", redo_button, "sensitive", 451 | BindingFlags.DEFAULT); 452 | refresh.clicked.connect (update_webview); 453 | } 454 | } 455 | 456 | --------------------------------------------------------------------------------