├── .editorconfig ├── .github └── workflows │ └── main.yml ├── .gitignore ├── COPYING ├── README.md ├── com.github.ryonakano.writer.yml ├── data ├── Application.css ├── com.github.ryonakano.writer.appdata.xml.in ├── com.github.ryonakano.writer.desktop.in ├── com.github.ryonakano.writer.gresource.xml ├── com.github.ryonakano.writer.gschema.xml ├── icons │ ├── format-indent-less-symbolic.svg │ ├── format-indent-more-symbolic.svg │ ├── format-justify-center-symbolic.svg │ ├── format-justify-fill-symbolic.svg │ ├── format-justify-left-symbolic.svg │ ├── format-justify-right-symbolic.svg │ ├── format-text-bold-symbolic.svg │ ├── format-text-italic-symbolic.svg │ ├── format-text-strikethrough-symbolic.svg │ └── format-text-underline-symbolic.svg ├── main_icons │ ├── 16 │ │ └── com.github.ryonakano.writer.svg │ ├── 24 │ │ └── com.github.ryonakano.writer.svg │ ├── 32 │ │ └── com.github.ryonakano.writer.svg │ ├── 48 │ │ └── com.github.ryonakano.writer.svg │ ├── 64 │ │ └── com.github.ryonakano.writer.svg │ └── 128 │ │ └── com.github.ryonakano.writer.svg └── meson.build ├── meson.build ├── po ├── LINGUAS ├── POTFILES ├── README.md ├── com.github.ryonakano.writer.pot ├── extra │ ├── LINGUAS │ ├── POTFILES │ ├── extra.pot │ ├── fr.po │ ├── meson.build │ ├── nl.po │ └── pt_BR.po ├── fr.po ├── meson.build ├── nl.po └── pt_BR.po └── src ├── Application.vala ├── MainWindow.vala ├── Utils ├── RTFParser.vala ├── RTFWriter.vala ├── TextEditor.vala └── TextRange.vala ├── Views ├── EditorView.vala └── WelcomeView.vala ├── Widgets ├── ActionBar.vala ├── Choosers │ └── TableChooser.vala ├── PreferenceDialog.vala ├── TitleBar.vala ├── ToolBar.vala └── ToolBars │ ├── ImageToolBar.vala │ ├── TableToolBar.vala │ ├── TextToolBar.vala │ └── ToolBarImage.vala └── config.vala.in /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig 2 | root = true 3 | 4 | # elementary defaults 5 | [*] 6 | charset = utf-8 7 | end_of_line = lf 8 | indent_size = tab 9 | indent_style = space 10 | insert_final_newline = true 11 | max_line_length = 80 12 | tab_width = 4 13 | 14 | # Markup files 15 | [{*.html,*.xml,*.xml.in,*.yml}] 16 | tab_width = 2 17 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: [pull_request] 4 | 5 | jobs: 6 | deploy_flatpak: 7 | name: Deploy Flatpak 8 | runs-on: ubuntu-latest 9 | 10 | container: 11 | image: ghcr.io/elementary/flatpak-platform/runtime:8.1 12 | options: --privileged 13 | 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@v4 17 | 18 | - name: Build 19 | uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v6.4 20 | with: 21 | bundle: writer.flatpak 22 | manifest-path: com.github.ryonakano.writer.yml 23 | run-tests: true 24 | repository-name: appcenter 25 | repository-url: https://flatpak.elementary.io/repo.flatpakrepo 26 | cache-key: "flatpak-builder-${{ github.sha }}" 27 | 28 | lint: 29 | name: Lint 30 | runs-on: ubuntu-latest 31 | 32 | container: 33 | image: valalang/lint 34 | 35 | steps: 36 | - name: Checkout 37 | uses: actions/checkout@v4 38 | 39 | - name: Lint 40 | run: io.elementary.vala-lint -d . 41 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .flatpak-builder 2 | build* 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Writer 2 | 3 | Writer is a word processor designed for elementary OS that lets you create simple and beautiful documents with ease. 4 | 5 | ## Installation 6 | 7 | **Writer is still in the early development and is not available on AppCenter at the present**, but in the future it may be. If you would like to test it now, you can do by building it. 8 | 9 | ## Building and Installation 10 | 11 | You'll need the following dependencies: 12 | 13 | * libgtk-3.0-dev (>= 3.22) 14 | * libgtksourceview-4-dev 15 | * libgranite-dev (>= 6.0.0) 16 | * meson (>= 0.57.0) 17 | * valac 18 | 19 | Run `meson build` to configure the build environment. Change to the build directory and run `ninja` to build 20 | 21 | meson build --prefix=/usr 22 | cd build 23 | ninja 24 | 25 | To install, use `ninja install`, then execute with `com.github.ryonakano.writer` 26 | 27 | ninja install 28 | com.github.ryonakano.writer 29 | 30 | ## Contributing 31 | 32 | There are many ways you can contribute, even if you don't know how to code. 33 | 34 | ### Reporting Bugs or Suggesting Improvements 35 | 36 | Simply [create a new issue](https://github.com/ryonakano/writer/issues/new) describing your problem and how to reproduce or your suggestion. If you are not used to do, [this section](https://docs.elementary.io/contributor-guide/feedback/reporting-issues) is for you. 37 | 38 | ### Writing Some Code 39 | 40 | We follow [the coding style of elementary OS](https://docs.elementary.io/develop/writing-apps/code-style) and [its Human Interface Guidelines](https://docs.elementary.io/hig/). Try to respect them. 41 | 42 | ### Translating This App 43 | 44 | I accept translations through Pull Requests. If you're not sure how to do, [the guideline I made](po/README.md) might be helpful. 45 | 46 | ## The Story Behind This App 47 | 48 | Actually this repository is a fork of the [original Writer](https://launchpad.net/writer). One day I found the original one and was very impressed, but it didn't seem to be updated at that time and wasn't released to AppCenter. Then I felt I would like to fork it and continue the development. 49 | 50 | So this repository would not exist without the work of the developers of the original one Tuur Dutoit, Anthony Huben, Ryan Riffle and [its mockup designer](https://www.deviantart.com/spiceofdesign/art/Writer-Concept-351501580) spiceofdesign. I would like to say thank you very much for them! 51 | -------------------------------------------------------------------------------- /com.github.ryonakano.writer.yml: -------------------------------------------------------------------------------- 1 | id: com.github.ryonakano.writer 2 | runtime: io.elementary.Platform 3 | runtime-version: '8.1' 4 | sdk: io.elementary.Sdk 5 | command: com.github.ryonakano.writer 6 | finish-args: 7 | - '--share=ipc' 8 | - '--socket=wayland' 9 | - '--socket=fallback-x11' 10 | - '--device=dri' 11 | - '--filesystem=xdg-documents' 12 | build-options: 13 | libdir: /app/lib 14 | modules: 15 | # FIXME Remove when porting to GTK 4 16 | - name: gtksourceview-4 17 | buildsystem: meson 18 | sources: 19 | - type: archive 20 | url: https://download.gnome.org/sources/gtksourceview/4.8/gtksourceview-4.8.4.tar.xz 21 | sha256: 7ec9d18fb283d1f84a3a3eff3b7a72b09a10c9c006597b3fbabbb5958420a87d 22 | 23 | - name: writer 24 | buildsystem: meson 25 | sources: 26 | - type: dir 27 | path: . 28 | -------------------------------------------------------------------------------- /data/Application.css: -------------------------------------------------------------------------------- 1 | .writer-toolbar { 2 | background: @base_color; 3 | border-top: none; 4 | border-left: none; 5 | border-right: none; 6 | } 7 | 8 | .page-decoration { 9 | background-color: #ffffff; 10 | border: none; 11 | border-color: transparent; 12 | box-shadow: 13 | 0 0 0 1px alpha (#000, 0.05), 14 | 0 3px 3px alpha (#000, 0.22); 15 | transition: all 150ms ease-in-out; 16 | } 17 | 18 | .page-decoration text { 19 | color: #333333; 20 | } 21 | 22 | .page-decoration text selection { 23 | color: #444444; 24 | } 25 | -------------------------------------------------------------------------------- /data/com.github.ryonakano.writer.appdata.xml.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | com.github.ryonakano.writer 5 | CC0 6 | GPL-3.0 7 | Writer 8 | Create simple and beautiful documents 9 | 10 |

11 | Writer is a word processor designed for elementary OS that lets you create simple and beautiful documents with ease. 12 |

13 |
14 | 15 | 16 | https://raw.githubusercontent.com/ryonakano/writer/master/data/Screenshot.png 17 | 18 | 19 | 20 | 21 | none 22 | none 23 | none 24 | none 25 | none 26 | none 27 | none 28 | none 29 | none 30 | none 31 | none 32 | none 33 | none 34 | none 35 | none 36 | none 37 | none 38 | none 39 | none 40 | none 41 | none 42 | mild 43 | none 44 | none 45 | none 46 | none 47 | none 48 | 49 | 50 | Writer Developers 51 | https://github.com/ryonakano/writer 52 | https://github.com/ryonakano/writer/issues 53 | 54 | 55 | #50a4f4 56 | #fafafa 57 | 58 |
59 | -------------------------------------------------------------------------------- /data/com.github.ryonakano.writer.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Writer 3 | GenericName=Word Processor 4 | Comment=Create simple and beautiful documents 5 | Categories=Office;WordProcessor; 6 | Exec=com.github.ryonakano.writer %U 7 | Icon=com.github.ryonakano.writer 8 | Terminal=false 9 | Type=Application 10 | -------------------------------------------------------------------------------- /data/com.github.ryonakano.writer.gresource.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Application.css 5 | 6 | 7 | -------------------------------------------------------------------------------- /data/com.github.ryonakano.writer.gschema.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | '' 6 | File destination 7 | The location to save files 8 | 9 | 10 | false 11 | Include spaces to count characters 12 | Whether include spaces to count characters 13 | 14 | 15 | (-1, -1) 16 | Window position 17 | Position of last closed window 18 | 19 | 20 | (950, 800) 21 | Window size 22 | Size of last closed window 23 | 24 | 25 | false 26 | Open window maximized 27 | If true, window opens maximized 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /data/icons/format-indent-less-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | Moka Symbolic Icon Theme 18 | 20 | 21 | 23 | image/svg+xml 24 | 26 | Moka Symbolic Icon Theme 27 | 28 | 29 | 30 | 32 | 34 | 38 | 39 | 42 | 46 | 47 | 48 | 52 | 56 | 60 | 64 | 68 | 72 | 76 | 80 | 84 | 91 | 98 | 105 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /data/icons/format-indent-more-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | Moka Symbolic Icon Theme 18 | 20 | 21 | 23 | image/svg+xml 24 | 26 | Moka Symbolic Icon Theme 27 | 28 | 29 | 30 | 32 | 34 | 38 | 39 | 42 | 46 | 47 | 48 | 52 | 56 | 60 | 64 | 68 | 72 | 76 | 80 | 84 | 91 | 98 | 105 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /data/icons/format-justify-center-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | image/svg+xml 8 | 9 | Gnome Symbolic Icon Theme 10 | 11 | 12 | 13 | Gnome Symbolic Icon Theme 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /data/icons/format-justify-fill-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | image/svg+xml 8 | 9 | Gnome Symbolic Icon Theme 10 | 11 | 12 | 13 | Gnome Symbolic Icon Theme 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /data/icons/format-justify-left-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | image/svg+xml 8 | 9 | Gnome Symbolic Icon Theme 10 | 11 | 12 | 13 | Gnome Symbolic Icon Theme 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /data/icons/format-justify-right-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | image/svg+xml 8 | 9 | Gnome Symbolic Icon Theme 10 | 11 | 12 | 13 | Gnome Symbolic Icon Theme 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /data/icons/format-text-bold-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | image/svg+xml 8 | 9 | Gnome Symbolic Icon Theme 10 | 11 | 12 | 13 | Gnome Symbolic Icon Theme 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /data/icons/format-text-italic-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | image/svg+xml 8 | 9 | Gnome Symbolic Icon Theme 10 | 11 | 12 | 13 | Gnome Symbolic Icon Theme 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /data/icons/format-text-strikethrough-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | image/svg+xml 8 | 9 | Gnome Symbolic Icon Theme 10 | 11 | 12 | 13 | Gnome Symbolic Icon Theme 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /data/icons/format-text-underline-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | image/svg+xml 8 | 9 | Gnome Symbolic Icon Theme 10 | 11 | 12 | 13 | Gnome Symbolic Icon Theme 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /data/main_icons/128/com.github.ryonakano.writer.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 21 | 31 | 33 | 37 | 41 | 42 | 52 | 54 | 58 | 62 | 63 | 73 | 75 | 79 | 83 | 84 | 95 | 97 | 101 | 105 | 109 | 113 | 114 | 123 | 125 | 129 | 133 | 134 | 144 | 146 | 150 | 154 | 158 | 162 | 163 | 173 | 175 | 179 | 183 | 184 | 194 | 196 | 200 | 204 | 208 | 212 | 213 | 223 | 225 | 229 | 233 | 234 | 236 | 240 | 244 | 245 | 247 | 251 | 255 | 256 | 266 | 268 | 272 | 276 | 280 | 281 | 291 | 302 | 313 | 323 | 334 | 344 | 354 | 364 | 374 | 383 | 385 | 389 | 393 | 394 | 403 | 405 | 409 | 413 | 414 | 424 | 426 | 430 | 434 | 438 | 442 | 443 | 454 | 456 | 460 | 464 | 468 | 472 | 473 | 484 | 494 | 496 | 500 | 504 | 508 | 512 | 513 | 524 | 525 | 543 | 550 | 551 | 553 | 554 | 556 | image/svg+xml 557 | 559 | 560 | 561 | 562 | 563 | 568 | 570 | 577 | 585 | 592 | 593 | 603 | 613 | 623 | 626 | 633 | 640 | 647 | 654 | 661 | 666 | 671 | 672 | 673 | -------------------------------------------------------------------------------- /data/main_icons/64/com.github.ryonakano.writer.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 21 | 31 | 33 | 37 | 41 | 42 | 52 | 54 | 58 | 62 | 63 | 73 | 75 | 79 | 83 | 84 | 95 | 97 | 101 | 105 | 109 | 113 | 114 | 123 | 125 | 129 | 133 | 134 | 144 | 146 | 150 | 154 | 158 | 162 | 163 | 173 | 175 | 179 | 183 | 184 | 194 | 196 | 200 | 204 | 208 | 212 | 213 | 223 | 225 | 229 | 233 | 234 | 236 | 240 | 244 | 245 | 247 | 251 | 255 | 256 | 266 | 268 | 272 | 276 | 280 | 281 | 291 | 302 | 313 | 323 | 334 | 344 | 354 | 364 | 374 | 383 | 385 | 389 | 393 | 394 | 403 | 405 | 409 | 413 | 414 | 424 | 426 | 430 | 434 | 438 | 442 | 443 | 454 | 456 | 460 | 464 | 468 | 472 | 473 | 484 | 494 | 496 | 500 | 504 | 508 | 512 | 513 | 524 | 525 | 543 | 550 | 551 | 553 | 554 | 556 | image/svg+xml 557 | 559 | 560 | 561 | 562 | 563 | 568 | 571 | 578 | 586 | 593 | 594 | 604 | 614 | 624 | 627 | 634 | 641 | 648 | 655 | 662 | 667 | 672 | 673 | 674 | 675 | -------------------------------------------------------------------------------- /data/meson.build: -------------------------------------------------------------------------------- 1 | icon_sizes = ['16', '24', '32', '48', '64', '128'] 2 | 3 | foreach i : icon_sizes 4 | install_data( 5 | 'main_icons' / i / meson.project_name() + '.svg', 6 | install_dir: get_option('datadir') / 'icons' / 'hicolor' / i + 'x' + i / 'apps' 7 | ) 8 | endforeach 9 | 10 | 11 | i18n.merge_file( 12 | input: meson.project_name() + '.desktop.in', 13 | output: meson.project_name() + '.desktop', 14 | po_dir: meson.project_source_root() / 'po' / 'extra', 15 | type: 'desktop', 16 | install: true, 17 | install_dir: get_option('datadir') / 'applications' 18 | ) 19 | 20 | i18n.merge_file( 21 | input: meson.project_name() + '.appdata.xml.in', 22 | output: meson.project_name() + '.appdata.xml', 23 | po_dir: meson.project_source_root() / 'po' / 'extra', 24 | install: true, 25 | install_dir: get_option('datadir') / 'metainfo' 26 | ) 27 | 28 | install_data( 29 | meson.project_name() + '.gschema.xml', 30 | install_dir: get_option('datadir') / 'glib-2.0' / 'schemas' 31 | ) 32 | -------------------------------------------------------------------------------- /meson.build: -------------------------------------------------------------------------------- 1 | project( 2 | 'com.github.ryonakano.writer', 3 | 'vala', 'c', 4 | version: '0.1.0', 5 | meson_version: '>=0.57.0' 6 | ) 7 | 8 | gnome = import('gnome') 9 | i18n = import('i18n') 10 | add_project_arguments( 11 | '-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()), 12 | language: 'c' 13 | ) 14 | 15 | asresources = gnome.compile_resources( 16 | 'as-resources', 17 | 'data' / meson.project_name() + '.gresource.xml', 18 | source_dir: 'data', 19 | c_name: 'as' 20 | ) 21 | 22 | conf_data = configuration_data() 23 | conf_data.set_quoted('LOCALEDIR', get_option('prefix') / get_option('localedir')) 24 | conf_data.set_quoted('GETTEXT_PACKAGE', meson.project_name()) 25 | conf_data.set_quoted('PROJECT_NAME', meson.project_name()) 26 | config_header = configure_file( 27 | input: 'src' / 'config.vala.in', 28 | output: 'config.vala', 29 | configuration: conf_data 30 | ) 31 | 32 | sources = files( 33 | 'src' / 'Utils' / 'RTFParser.vala', 34 | 'src' / 'Utils' / 'RTFWriter.vala', 35 | 'src' / 'Utils' / 'TextEditor.vala', 36 | 'src' / 'Utils' / 'TextRange.vala', 37 | 'src' / 'Views' / 'EditorView.vala', 38 | 'src' / 'Views' / 'WelcomeView.vala', 39 | 'src' / 'Widgets' / 'Choosers' / 'TableChooser.vala', 40 | 'src' / 'Widgets' / 'ToolBars' / 'ImageToolBar.vala', 41 | 'src' / 'Widgets' / 'ToolBars' / 'TableToolBar.vala', 42 | 'src' / 'Widgets' / 'ToolBars' / 'TextToolBar.vala', 43 | 'src' / 'Widgets' / 'ToolBars' / 'ToolBarImage.vala', 44 | 'src' / 'Widgets' / 'ActionBar.vala', 45 | 'src' / 'Widgets' / 'PreferenceDialog.vala', 46 | 'src' / 'Widgets' / 'TitleBar.vala', 47 | 'src' / 'Widgets' / 'ToolBar.vala', 48 | 'src' / 'Application.vala', 49 | 'src' / 'MainWindow.vala' 50 | ) 51 | 52 | executable( 53 | meson.project_name(), 54 | asresources, 55 | config_header, 56 | sources, 57 | dependencies: [ 58 | dependency('gee-0.8'), 59 | dependency('glib-2.0'), 60 | dependency('granite', version: '>=6.0.0'), 61 | dependency('gtk+-3.0', version: '>=3.22'), 62 | dependency('gtksourceview-4') 63 | ], 64 | install: true 65 | ) 66 | 67 | subdir('data') 68 | subdir('po') 69 | 70 | gnome.post_install( 71 | glib_compile_schemas: true, 72 | gtk_update_icon_cache: true 73 | ) 74 | -------------------------------------------------------------------------------- /po/LINGUAS: -------------------------------------------------------------------------------- 1 | fr 2 | nl 3 | pt_BR 4 | -------------------------------------------------------------------------------- /po/POTFILES: -------------------------------------------------------------------------------- 1 | src/Views/WelcomeView.vala 2 | 3 | src/Widgets/Choosers/TableChooser.vala 4 | src/Widgets/ToolBars/ImageToolBar.vala 5 | src/Widgets/ToolBars/TableToolBar.vala 6 | src/Widgets/ToolBars/TextToolBar.vala 7 | src/Widgets/ActionBar.vala 8 | src/Widgets/PreferenceDialog.vala 9 | src/Widgets/TitleBar.vala 10 | 11 | src/Application.vala 12 | src/MainWindow.vala 13 | -------------------------------------------------------------------------------- /po/README.md: -------------------------------------------------------------------------------- 1 | # How to Add a Translation of This App 2 | 3 | ## Fork and Clone the Repository 4 | 5 | First of all, fork this repository on GitHub. Next, clone the forked repository to local: 6 | 7 | git clone https://github.com/your-username/writer.git 8 | 9 | ## Add Your Language Code to LINGUAS Files 10 | 11 | Search for your language code (e.g. en = English, zh_CN = Chinese Simplified). See https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes if needed. Then add it to `po/LINGUAS` and `po/extra/LINGUAS`. Please make sure language codes sort alphabetically. For example, if a LINGUAS file contains `ko`, `mr` and `zh_TW`, its content should be sorted like this: 12 | 13 | ko 14 | mr 15 | zh_TW 16 | 17 | ## Translate .po Files 18 | 19 | Now what you've been waiting for! Copy `po/com.github.ryonakano.writer.pot` and name `po/.po` and copy `po/extra/extra.pot` and name `po/extra/.po`. Then translate these created .po files using a .po file editor of your choice (e.g. Poedit). The former file contains strings for the app itself and the latter is for metadata files (.appdata.xml and .desktop files). 20 | 21 | ## Commit Your Translation Works 22 | 23 | After saving the .po files, open a terminal in the folder you've cloned this repository in and type: 24 | 25 | git checkout -b add-translation 26 | 27 | Then add the .po files of your language and LINGUAS files. **Do not add other files!** 28 | 29 | git add po/LINGUAS po/extra/LINGUAS po/.po po/extra/.po 30 | 31 | Next, create a commit and push it to your cloned repository on GitHub: 32 | 33 | git commit -m "Add translation" 34 | git push origin add-translation 35 | 36 | Type your GitHub username and password if asked. 37 | 38 | Finally, open your cloned repository on GitHub, select "Compare & Pull Request", and create a new pull request. 39 | 40 | And that's all! I'll check whether there is no problem in your pull request and if so I'll approve and merge your pull request! Your translation is released every time I release a new version of the app to AppCenter, so it is not always reflected when your pull request is merged. Please be patient. 41 | 42 | # How to Update an Existing Translation 43 | 44 | You can also create a pull request that updates existing translations. In this case, you don't have to edit LINGUAS files. Open existing .po files with any .po file editor and commit them when completed. 45 | 46 | # Note 47 | 48 | * **If you find some issue (e.g. typo) in the source strings, create another pull request that fixes it. Do NOT fix it in your translation pull request.** If you don't know how to fix it, create a new issue about it. I'll fix it. 49 | * **If you would like to translate the app into multiple languages, please make separated PRs per languages.** It's not a good thing to include translations of more than 2 languages in your one pull request. 50 | * Edit and commit only `po/LINGUAS`, `po/extra/LINGUAS`, `po/.po` and `po/extra/.po`. Do NOT include other files in your pull request. 51 | 52 | # References 53 | 54 | This file was created by referring the following reference: 55 | 56 | * https://github.com/lainsce/notejot/blob/master/po/README.md 57 | -------------------------------------------------------------------------------- /po/com.github.ryonakano.writer.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 com.github.ryonakano.writer package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | #, fuzzy 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: com.github.ryonakano.writer\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2021-06-16 21:39+0900\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 | "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" 20 | 21 | #: src/Views/WelcomeView.vala:23 22 | msgid "No Documents Open" 23 | msgstr "" 24 | 25 | #: src/Views/WelcomeView.vala:24 26 | msgid "Open a document to begin editing." 27 | msgstr "" 28 | 29 | #: src/Views/WelcomeView.vala:30 30 | msgid "New File" 31 | msgstr "" 32 | 33 | #: src/Views/WelcomeView.vala:30 34 | msgid "Create a new document." 35 | msgstr "" 36 | 37 | #: src/Views/WelcomeView.vala:31 38 | msgid "Open File" 39 | msgstr "" 40 | 41 | #: src/Views/WelcomeView.vala:31 42 | msgid "Open a saved document." 43 | msgstr "" 44 | 45 | #: src/Widgets/Choosers/TableChooser.vala:35 46 | msgid "Insert Table" 47 | msgstr "" 48 | 49 | #: src/Widgets/Choosers/TableChooser.vala:37 50 | msgid "Table" 51 | msgstr "" 52 | 53 | #: src/Widgets/Choosers/TableChooser.vala:39 54 | msgid "Columns:" 55 | msgstr "" 56 | 57 | #: src/Widgets/Choosers/TableChooser.vala:41 58 | msgid "Rows:" 59 | msgstr "" 60 | 61 | #: src/Widgets/ToolBars/ImageToolBar.vala:34 62 | msgid "In line of text" 63 | msgstr "" 64 | 65 | #: src/Widgets/ToolBars/ImageToolBar.vala:35 66 | msgid "Float above text" 67 | msgstr "" 68 | 69 | #: src/Widgets/ToolBars/ImageToolBar.vala:37 70 | msgid "Set how to wrap text" 71 | msgstr "" 72 | 73 | #: src/Widgets/ToolBars/ImageToolBar.vala:39 74 | msgid "Lock aspect ratio" 75 | msgstr "" 76 | 77 | #: src/Widgets/ToolBars/ImageToolBar.vala:43 78 | msgid "Allow to resize images without changing aspect ratio" 79 | msgstr "" 80 | 81 | #: src/Widgets/ToolBars/ImageToolBar.vala:49 82 | msgid "Align image left" 83 | msgstr "" 84 | 85 | #: src/Widgets/ToolBars/ImageToolBar.vala:50 86 | msgid "Center image" 87 | msgstr "" 88 | 89 | #: src/Widgets/ToolBars/ImageToolBar.vala:51 90 | msgid "Align image right" 91 | msgstr "" 92 | 93 | #: src/Widgets/ToolBars/ImageToolBar.vala:53 94 | msgid "Crop" 95 | msgstr "" 96 | 97 | #: src/Widgets/ToolBars/ImageToolBar.vala:57 98 | msgid "Remove unnecessary part of image" 99 | msgstr "" 100 | 101 | #: src/Widgets/ToolBars/ImageToolBar.vala:59 102 | msgid "Delete Image" 103 | msgstr "" 104 | 105 | #: src/Widgets/ToolBars/ImageToolBar.vala:63 106 | msgid "Delete selected image" 107 | msgstr "" 108 | 109 | #: src/Widgets/ToolBars/TableToolBar.vala:31 110 | msgid "Table Properties" 111 | msgstr "" 112 | 113 | #: src/Widgets/ToolBars/TableToolBar.vala:34 114 | msgid "Set properties of selected table" 115 | msgstr "" 116 | 117 | #: src/Widgets/ToolBars/TableToolBar.vala:42 118 | #: src/Widgets/ToolBars/TextToolBar.vala:58 119 | msgid "Choose font family and font size" 120 | msgstr "" 121 | 122 | #: src/Widgets/ToolBars/TableToolBar.vala:49 123 | #: src/Widgets/ToolBars/TextToolBar.vala:65 124 | msgid "Choose font color" 125 | msgstr "" 126 | 127 | #: src/Widgets/ToolBars/TableToolBar.vala:52 128 | #: src/Widgets/ToolBars/TextToolBar.vala:68 129 | msgid "Toggle bold" 130 | msgstr "" 131 | 132 | #: src/Widgets/ToolBars/TableToolBar.vala:56 133 | #: src/Widgets/ToolBars/TextToolBar.vala:72 134 | msgid "Toggle italic" 135 | msgstr "" 136 | 137 | #: src/Widgets/ToolBars/TableToolBar.vala:60 138 | #: src/Widgets/ToolBars/TextToolBar.vala:76 139 | msgid "Toggle underline" 140 | msgstr "" 141 | 142 | #: src/Widgets/ToolBars/TableToolBar.vala:64 143 | #: src/Widgets/ToolBars/TextToolBar.vala:80 144 | msgid "Toggle strikethrough" 145 | msgstr "" 146 | 147 | #: src/Widgets/ToolBars/TableToolBar.vala:81 148 | msgid "Align table left" 149 | msgstr "" 150 | 151 | #: src/Widgets/ToolBars/TableToolBar.vala:82 152 | msgid "Center table" 153 | msgstr "" 154 | 155 | #: src/Widgets/ToolBars/TableToolBar.vala:83 156 | msgid "Align table right" 157 | msgstr "" 158 | 159 | #: src/Widgets/ToolBars/TableToolBar.vala:84 160 | msgid "Justify table" 161 | msgstr "" 162 | 163 | #: src/Widgets/ToolBars/TableToolBar.vala:86 164 | msgid "Add" 165 | msgstr "" 166 | 167 | #: src/Widgets/ToolBars/TableToolBar.vala:90 168 | msgid "Add a new table" 169 | msgstr "" 170 | 171 | #: src/Widgets/ToolBars/TableToolBar.vala:92 172 | msgid "Delete" 173 | msgstr "" 174 | 175 | #: src/Widgets/ToolBars/TableToolBar.vala:96 176 | msgid "Delete selected table" 177 | msgstr "" 178 | 179 | #: src/Widgets/ToolBars/TextToolBar.vala:43 180 | msgid "Paragraph" 181 | msgstr "" 182 | 183 | #: src/Widgets/ToolBars/TextToolBar.vala:44 184 | msgid "Title" 185 | msgstr "" 186 | 187 | #: src/Widgets/ToolBars/TextToolBar.vala:45 188 | msgid "Subtitle" 189 | msgstr "" 190 | 191 | #: src/Widgets/ToolBars/TextToolBar.vala:46 192 | msgid "Bullet List" 193 | msgstr "" 194 | 195 | #: src/Widgets/ToolBars/TextToolBar.vala:47 196 | msgid "Numbered List" 197 | msgstr "" 198 | 199 | #: src/Widgets/ToolBars/TextToolBar.vala:48 200 | msgid "Two-Column" 201 | msgstr "" 202 | 203 | #: src/Widgets/ToolBars/TextToolBar.vala:50 204 | msgid "Set text style" 205 | msgstr "" 206 | 207 | #: src/Widgets/ToolBars/TextToolBar.vala:97 208 | msgid "Align text left" 209 | msgstr "" 210 | 211 | #: src/Widgets/ToolBars/TextToolBar.vala:98 212 | msgid "Center text" 213 | msgstr "" 214 | 215 | #: src/Widgets/ToolBars/TextToolBar.vala:99 216 | msgid "Align text right" 217 | msgstr "" 218 | 219 | #: src/Widgets/ToolBars/TextToolBar.vala:100 220 | msgid "Justify text" 221 | msgstr "" 222 | 223 | #: src/Widgets/ToolBars/TextToolBar.vala:103 224 | msgid "Increase indent" 225 | msgstr "" 226 | 227 | #: src/Widgets/ToolBars/TextToolBar.vala:105 228 | msgid "Decrease indent" 229 | msgstr "" 230 | 231 | #: src/Widgets/ToolBars/TextToolBar.vala:115 232 | msgid "Insert text" 233 | msgstr "" 234 | 235 | #: src/Widgets/ToolBars/TextToolBar.vala:117 236 | msgid "Insert link" 237 | msgstr "" 238 | 239 | #: src/Widgets/ToolBars/TextToolBar.vala:119 240 | msgid "Insert image" 241 | msgstr "" 242 | 243 | #: src/Widgets/ToolBars/TextToolBar.vala:121 244 | msgid "Insert table" 245 | msgstr "" 246 | 247 | #: src/Widgets/ActionBar.vala:47 248 | #, c-format 249 | msgid "%d character with spaces" 250 | msgid_plural "%d characters with spaces" 251 | msgstr[0] "" 252 | msgstr[1] "" 253 | 254 | #: src/Widgets/ActionBar.vala:61 255 | #, c-format 256 | msgid "%d character without spaces" 257 | msgid_plural "%d characters without spaces" 258 | msgstr[0] "" 259 | msgstr[1] "" 260 | 261 | #: src/Widgets/PreferenceDialog.vala:27 src/Widgets/TitleBar.vala:62 262 | #: src/Widgets/TitleBar.vala:68 263 | msgid "Preferences" 264 | msgstr "" 265 | 266 | #: src/Widgets/PreferenceDialog.vala:33 267 | msgid "Document folder location:" 268 | msgstr "" 269 | 270 | #: src/Widgets/PreferenceDialog.vala:37 271 | msgid "Select Document Folder…" 272 | msgstr "" 273 | 274 | #: src/Widgets/PreferenceDialog.vala:43 275 | msgid "Include spaces to count characters:" 276 | msgstr "" 277 | 278 | #: src/Widgets/PreferenceDialog.vala:64 279 | msgid "Close" 280 | msgstr "" 281 | 282 | #. /TRANSLATORS: The string shown in the titlebar. "Writer" is the name of this app. 283 | #: src/Widgets/TitleBar.vala:31 src/MainWindow.vala:78 284 | msgid "Writer" 285 | msgstr "" 286 | 287 | #: src/Widgets/TitleBar.vala:38 288 | msgid "Open a file" 289 | msgstr "" 290 | 291 | #: src/Widgets/TitleBar.vala:41 292 | msgid "Save this file with a different name" 293 | msgstr "" 294 | 295 | #: src/Widgets/TitleBar.vala:44 296 | msgid "Restore this file" 297 | msgstr "" 298 | 299 | #: src/Widgets/TitleBar.vala:47 300 | msgid "Print this file" 301 | msgstr "" 302 | 303 | #: src/Widgets/TitleBar.vala:51 304 | msgid "Find" 305 | msgstr "" 306 | 307 | #: src/Widgets/TitleBar.vala:57 308 | msgid "Undo" 309 | msgstr "" 310 | 311 | #: src/Widgets/TitleBar.vala:60 312 | msgid "Redo" 313 | msgstr "" 314 | 315 | #: src/Application.vala:198 316 | #, c-format 317 | msgid "Untitled Document %i" 318 | msgstr "" 319 | 320 | #: src/Application.vala:219 321 | msgid "Choose a file to open" 322 | msgstr "" 323 | 324 | #: src/Application.vala:221 src/Application.vala:296 325 | msgid "Rich Text Format (.rtf)" 326 | msgstr "" 327 | 328 | #: src/Application.vala:224 src/Application.vala:299 329 | msgid "Cancel" 330 | msgstr "" 331 | 332 | #: src/Application.vala:225 333 | msgid "Open" 334 | msgstr "" 335 | 336 | #: src/Application.vala:291 337 | msgid "Save file with a different name" 338 | msgstr "" 339 | 340 | #: src/Application.vala:300 341 | msgid "Save" 342 | msgstr "" 343 | 344 | #: src/Application.vala:326 345 | msgid "Are you sure you want to revret this file?" 346 | msgstr "" 347 | 348 | #: src/Application.vala:327 349 | msgid "Changes you made will be discarded." 350 | msgstr "" 351 | 352 | #: src/Application.vala:333 353 | msgid "Revert" 354 | msgstr "" 355 | 356 | #. /TRANSLATORS: The string shown in the titlebar. "%s" represents the name of an opened file. 357 | #. /The latter string "Writer" is the name of this app. 358 | #: src/MainWindow.vala:75 359 | #, c-format 360 | msgid "%s — Writer" 361 | msgstr "" 362 | -------------------------------------------------------------------------------- /po/extra/LINGUAS: -------------------------------------------------------------------------------- 1 | fr 2 | nl 3 | pt_BR 4 | -------------------------------------------------------------------------------- /po/extra/POTFILES: -------------------------------------------------------------------------------- 1 | data/com.github.ryonakano.writer.desktop.in 2 | data/com.github.ryonakano.writer.appdata.xml.in 3 | -------------------------------------------------------------------------------- /po/extra/extra.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 extra package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | #, fuzzy 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: extra\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2021-06-16 21:39+0900\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=CHARSET\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | 20 | #: data/com.github.ryonakano.writer.desktop.in:3 21 | #: data/com.github.ryonakano.writer.appdata.xml.in:7 22 | msgid "Writer" 23 | msgstr "" 24 | 25 | #: data/com.github.ryonakano.writer.desktop.in:4 26 | msgid "Word Processor" 27 | msgstr "" 28 | 29 | #: data/com.github.ryonakano.writer.desktop.in:5 30 | #: data/com.github.ryonakano.writer.appdata.xml.in:8 31 | msgid "Create simple and beautiful documents" 32 | msgstr "" 33 | 34 | #: data/com.github.ryonakano.writer.desktop.in:8 35 | msgid "com.github.ryonakano.writer" 36 | msgstr "" 37 | 38 | #: data/com.github.ryonakano.writer.appdata.xml.in:10 39 | msgid "" 40 | "Writer is a word processor designed for elementary OS that lets you create " 41 | "simple and beautiful documents with ease." 42 | msgstr "" 43 | 44 | #: data/com.github.ryonakano.writer.appdata.xml.in:50 45 | msgid "Writer Developers" 46 | msgstr "" 47 | -------------------------------------------------------------------------------- /po/extra/fr.po: -------------------------------------------------------------------------------- 1 | # French translations for extra package. 2 | # Copyright (C) 2019 THE extra'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the extra package. 4 | # NathanBnm, 2019. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: extra\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2021-06-16 21:39+0900\n" 11 | "PO-Revision-Date: 2019-06-21 17:11+0200\n" 12 | "Last-Translator: NathanBnm\n" 13 | "Language-Team: none\n" 14 | "Language: fr\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" 19 | 20 | #: data/com.github.ryonakano.writer.desktop.in:3 21 | #: data/com.github.ryonakano.writer.appdata.xml.in:7 22 | msgid "Writer" 23 | msgstr "Writer" 24 | 25 | #: data/com.github.ryonakano.writer.desktop.in:4 26 | msgid "Word Processor" 27 | msgstr "Logiciel de traitement de texte" 28 | 29 | #: data/com.github.ryonakano.writer.desktop.in:5 30 | #: data/com.github.ryonakano.writer.appdata.xml.in:8 31 | msgid "Create simple and beautiful documents" 32 | msgstr "Créez des documents simples et beaux" 33 | 34 | #: data/com.github.ryonakano.writer.desktop.in:8 35 | msgid "com.github.ryonakano.writer" 36 | msgstr "com.github.ryonakano.writer" 37 | 38 | #: data/com.github.ryonakano.writer.appdata.xml.in:10 39 | msgid "" 40 | "Writer is a word processor designed for elementary OS that lets you create " 41 | "simple and beautiful documents with ease." 42 | msgstr "" 43 | "Writer est un logiciel de traitement de texte conçu pour elementary OS qui " 44 | "vous permet de créer facilement des documents simples et beaux." 45 | 46 | #: data/com.github.ryonakano.writer.appdata.xml.in:50 47 | msgid "Writer Developers" 48 | msgstr "" 49 | -------------------------------------------------------------------------------- /po/extra/meson.build: -------------------------------------------------------------------------------- 1 | i18n.gettext('extra', 2 | args: [ 3 | '--directory=' + meson.project_source_root(), 4 | '--from-code=UTF-8', 5 | '-cTRANSLATORS' 6 | ], 7 | preset: 'glib', 8 | install: false 9 | ) 10 | -------------------------------------------------------------------------------- /po/extra/nl.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the extra package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: extra\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2021-06-16 21:39+0900\n" 11 | "PO-Revision-Date: 2020-08-22 13:09+0200\n" 12 | "Last-Translator: Heimen Stoffels \n" 13 | "Language-Team: \n" 14 | "Language: nl\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "X-Generator: Poedit 2.4.1\n" 19 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 20 | 21 | #: data/com.github.ryonakano.writer.desktop.in:3 22 | #: data/com.github.ryonakano.writer.appdata.xml.in:7 23 | msgid "Writer" 24 | msgstr "Tekstverwerker" 25 | 26 | #: data/com.github.ryonakano.writer.desktop.in:4 27 | msgid "Word Processor" 28 | msgstr "Word-achtige toepassing" 29 | 30 | #: data/com.github.ryonakano.writer.desktop.in:5 31 | #: data/com.github.ryonakano.writer.appdata.xml.in:8 32 | msgid "Create simple and beautiful documents" 33 | msgstr "Maak eenvoudige, maar mooie documenten" 34 | 35 | #: data/com.github.ryonakano.writer.desktop.in:8 36 | msgid "com.github.ryonakano.writer" 37 | msgstr "com.github.ryonakano.writer" 38 | 39 | #: data/com.github.ryonakano.writer.appdata.xml.in:10 40 | msgid "" 41 | "Writer is a word processor designed for elementary OS that lets you create " 42 | "simple and beautiful documents with ease." 43 | msgstr "" 44 | "Tekstverwerker is een Word-achtige toepassing, ontworpen voor elementary OS. " 45 | "Hiermee kun je eenvoudig mooie documenten maken." 46 | 47 | #: data/com.github.ryonakano.writer.appdata.xml.in:50 48 | msgid "Writer Developers" 49 | msgstr "Tekstverwerker-ontwikkelaars" 50 | -------------------------------------------------------------------------------- /po/extra/pt_BR.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the extra package. 4 | # Matheus T. Ricci, 2021 5 | # 6 | #, fuzzy 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: extra\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2021-06-16 21:39+0900\n" 12 | "PO-Revision-Date: 2021-08-18 22:34+0900\n" 13 | "Last-Translator: Matheus T. Ricci\n" 14 | "Language:pt_BR \n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Language-Team: \n" 19 | 20 | #: data/com.github.ryonakano.writer.desktop.in:3 21 | #: data/com.github.ryonakano.writer.appdata.xml.in:7 22 | msgid "Writer" 23 | msgstr "Writer" 24 | 25 | #: data/com.github.ryonakano.writer.desktop.in:4 26 | msgid "Word Processor" 27 | msgstr "Editor de Texto" 28 | 29 | #: data/com.github.ryonakano.writer.desktop.in:5 30 | #: data/com.github.ryonakano.writer.appdata.xml.in:8 31 | msgid "Create simple and beautiful documents" 32 | msgstr "Criar documentos simples e bonitos" 33 | 34 | #: data/com.github.ryonakano.writer.desktop.in:8 35 | msgid "com.github.ryonakano.writer" 36 | msgstr "com.github.ryonakano.writer" 37 | 38 | #: data/com.github.ryonakano.writer.appdata.xml.in:10 39 | msgid "" 40 | "Writer is a word processor designed for elementary OS that lets you create " 41 | "simple and beautiful documents with ease." 42 | msgstr "Writer é um editor de texto desenhado para elementary OS que permite que você crie documentos simples e bonitos facilmente." 43 | 44 | #: data/com.github.ryonakano.writer.appdata.xml.in:50 45 | msgid "Writer Developers" 46 | msgstr "Desenvolvedores do Writer" 47 | -------------------------------------------------------------------------------- /po/fr.po: -------------------------------------------------------------------------------- 1 | # French translations for com.github.ryonakano.writer package. 2 | # Copyright (C) 2019 THE com.github.ryonakano.writer'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the com.github.ryonakano.writer package. 4 | # NathanBnm, 2019. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: com.github.ryonakano.writer\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2021-06-16 21:39+0900\n" 11 | "PO-Revision-Date: 2019-06-21 17:11+0200\n" 12 | "Last-Translator: NathanBnm\n" 13 | "Language-Team: none\n" 14 | "Language: fr\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" 19 | 20 | #: src/Views/WelcomeView.vala:23 21 | msgid "No Documents Open" 22 | msgstr "Aucun document ouvert" 23 | 24 | #: src/Views/WelcomeView.vala:24 25 | msgid "Open a document to begin editing." 26 | msgstr "Ouvrir un document pour commencer l'édition." 27 | 28 | #: src/Views/WelcomeView.vala:30 29 | msgid "New File" 30 | msgstr "Nouveau fichier" 31 | 32 | #: src/Views/WelcomeView.vala:30 33 | msgid "Create a new document." 34 | msgstr "Créer un nouveau document." 35 | 36 | #: src/Views/WelcomeView.vala:31 37 | msgid "Open File" 38 | msgstr "Ouvrir un fichier" 39 | 40 | #: src/Views/WelcomeView.vala:31 41 | msgid "Open a saved document." 42 | msgstr "Ouvrir un document enregistré." 43 | 44 | #: src/Widgets/Choosers/TableChooser.vala:35 45 | msgid "Insert Table" 46 | msgstr "Insérer un tableau" 47 | 48 | #: src/Widgets/Choosers/TableChooser.vala:37 49 | msgid "Table" 50 | msgstr "Tableau" 51 | 52 | #: src/Widgets/Choosers/TableChooser.vala:39 53 | msgid "Columns:" 54 | msgstr "Colonnes :" 55 | 56 | #: src/Widgets/Choosers/TableChooser.vala:41 57 | msgid "Rows:" 58 | msgstr "Lignes :" 59 | 60 | #: src/Widgets/ToolBars/ImageToolBar.vala:34 61 | msgid "In line of text" 62 | msgstr "Aligner au texte" 63 | 64 | #: src/Widgets/ToolBars/ImageToolBar.vala:35 65 | msgid "Float above text" 66 | msgstr "Flotter au-dessus du texte" 67 | 68 | #: src/Widgets/ToolBars/ImageToolBar.vala:37 69 | msgid "Set how to wrap text" 70 | msgstr "" 71 | 72 | #: src/Widgets/ToolBars/ImageToolBar.vala:39 73 | msgid "Lock aspect ratio" 74 | msgstr "Verrouiller le ratio" 75 | 76 | #: src/Widgets/ToolBars/ImageToolBar.vala:43 77 | msgid "Allow to resize images without changing aspect ratio" 78 | msgstr "" 79 | 80 | #: src/Widgets/ToolBars/ImageToolBar.vala:49 81 | msgid "Align image left" 82 | msgstr "" 83 | 84 | #: src/Widgets/ToolBars/ImageToolBar.vala:50 85 | #, fuzzy 86 | msgid "Center image" 87 | msgstr "Supprimer l'image" 88 | 89 | #: src/Widgets/ToolBars/ImageToolBar.vala:51 90 | msgid "Align image right" 91 | msgstr "" 92 | 93 | #: src/Widgets/ToolBars/ImageToolBar.vala:53 94 | msgid "Crop" 95 | msgstr "Rogner" 96 | 97 | #: src/Widgets/ToolBars/ImageToolBar.vala:57 98 | msgid "Remove unnecessary part of image" 99 | msgstr "" 100 | 101 | #: src/Widgets/ToolBars/ImageToolBar.vala:59 102 | msgid "Delete Image" 103 | msgstr "Supprimer l'image" 104 | 105 | #: src/Widgets/ToolBars/ImageToolBar.vala:63 106 | #, fuzzy 107 | msgid "Delete selected image" 108 | msgstr "Supprimer l'image" 109 | 110 | #: src/Widgets/ToolBars/TableToolBar.vala:31 111 | msgid "Table Properties" 112 | msgstr "Propriétés du tableau" 113 | 114 | #: src/Widgets/ToolBars/TableToolBar.vala:34 115 | msgid "Set properties of selected table" 116 | msgstr "" 117 | 118 | #: src/Widgets/ToolBars/TableToolBar.vala:42 119 | #: src/Widgets/ToolBars/TextToolBar.vala:58 120 | msgid "Choose font family and font size" 121 | msgstr "" 122 | 123 | #: src/Widgets/ToolBars/TableToolBar.vala:49 124 | #: src/Widgets/ToolBars/TextToolBar.vala:65 125 | msgid "Choose font color" 126 | msgstr "" 127 | 128 | #: src/Widgets/ToolBars/TableToolBar.vala:52 129 | #: src/Widgets/ToolBars/TextToolBar.vala:68 130 | msgid "Toggle bold" 131 | msgstr "" 132 | 133 | #: src/Widgets/ToolBars/TableToolBar.vala:56 134 | #: src/Widgets/ToolBars/TextToolBar.vala:72 135 | msgid "Toggle italic" 136 | msgstr "" 137 | 138 | #: src/Widgets/ToolBars/TableToolBar.vala:60 139 | #: src/Widgets/ToolBars/TextToolBar.vala:76 140 | msgid "Toggle underline" 141 | msgstr "" 142 | 143 | #: src/Widgets/ToolBars/TableToolBar.vala:64 144 | #: src/Widgets/ToolBars/TextToolBar.vala:80 145 | msgid "Toggle strikethrough" 146 | msgstr "" 147 | 148 | #: src/Widgets/ToolBars/TableToolBar.vala:81 149 | msgid "Align table left" 150 | msgstr "" 151 | 152 | #: src/Widgets/ToolBars/TableToolBar.vala:82 153 | #, fuzzy 154 | msgid "Center table" 155 | msgstr "Insérer un tableau" 156 | 157 | #: src/Widgets/ToolBars/TableToolBar.vala:83 158 | msgid "Align table right" 159 | msgstr "" 160 | 161 | #: src/Widgets/ToolBars/TableToolBar.vala:84 162 | msgid "Justify table" 163 | msgstr "" 164 | 165 | #: src/Widgets/ToolBars/TableToolBar.vala:86 166 | msgid "Add" 167 | msgstr "Ajouter" 168 | 169 | #: src/Widgets/ToolBars/TableToolBar.vala:90 170 | msgid "Add a new table" 171 | msgstr "" 172 | 173 | #: src/Widgets/ToolBars/TableToolBar.vala:92 174 | msgid "Delete" 175 | msgstr "Supprimer" 176 | 177 | #: src/Widgets/ToolBars/TableToolBar.vala:96 178 | msgid "Delete selected table" 179 | msgstr "" 180 | 181 | #: src/Widgets/ToolBars/TextToolBar.vala:43 182 | msgid "Paragraph" 183 | msgstr "Paragraphe" 184 | 185 | #: src/Widgets/ToolBars/TextToolBar.vala:44 186 | msgid "Title" 187 | msgstr "Titre" 188 | 189 | #: src/Widgets/ToolBars/TextToolBar.vala:45 190 | msgid "Subtitle" 191 | msgstr "Sous-titre" 192 | 193 | #: src/Widgets/ToolBars/TextToolBar.vala:46 194 | msgid "Bullet List" 195 | msgstr "Liste à puces" 196 | 197 | #: src/Widgets/ToolBars/TextToolBar.vala:47 198 | msgid "Numbered List" 199 | msgstr "Liste numérotée" 200 | 201 | #: src/Widgets/ToolBars/TextToolBar.vala:48 202 | msgid "Two-Column" 203 | msgstr "Deux colonnes" 204 | 205 | #: src/Widgets/ToolBars/TextToolBar.vala:50 206 | msgid "Set text style" 207 | msgstr "" 208 | 209 | #: src/Widgets/ToolBars/TextToolBar.vala:97 210 | msgid "Align text left" 211 | msgstr "" 212 | 213 | #: src/Widgets/ToolBars/TextToolBar.vala:98 214 | msgid "Center text" 215 | msgstr "" 216 | 217 | #: src/Widgets/ToolBars/TextToolBar.vala:99 218 | msgid "Align text right" 219 | msgstr "" 220 | 221 | #: src/Widgets/ToolBars/TextToolBar.vala:100 222 | msgid "Justify text" 223 | msgstr "" 224 | 225 | #: src/Widgets/ToolBars/TextToolBar.vala:103 226 | msgid "Increase indent" 227 | msgstr "" 228 | 229 | #: src/Widgets/ToolBars/TextToolBar.vala:105 230 | msgid "Decrease indent" 231 | msgstr "" 232 | 233 | #: src/Widgets/ToolBars/TextToolBar.vala:115 234 | #, fuzzy 235 | msgid "Insert text" 236 | msgstr "Insérer un tableau" 237 | 238 | #: src/Widgets/ToolBars/TextToolBar.vala:117 239 | #, fuzzy 240 | msgid "Insert link" 241 | msgstr "Insérer un tableau" 242 | 243 | #: src/Widgets/ToolBars/TextToolBar.vala:119 244 | #, fuzzy 245 | msgid "Insert image" 246 | msgstr "Insérer un tableau" 247 | 248 | #: src/Widgets/ToolBars/TextToolBar.vala:121 249 | #, fuzzy 250 | msgid "Insert table" 251 | msgstr "Insérer un tableau" 252 | 253 | #: src/Widgets/ActionBar.vala:47 254 | #, c-format 255 | msgid "%d character with spaces" 256 | msgid_plural "%d characters with spaces" 257 | msgstr[0] "" 258 | msgstr[1] "" 259 | 260 | #: src/Widgets/ActionBar.vala:61 261 | #, c-format 262 | msgid "%d character without spaces" 263 | msgid_plural "%d characters without spaces" 264 | msgstr[0] "" 265 | msgstr[1] "" 266 | 267 | #: src/Widgets/PreferenceDialog.vala:27 src/Widgets/TitleBar.vala:62 268 | #: src/Widgets/TitleBar.vala:68 269 | msgid "Preferences" 270 | msgstr "Préférences" 271 | 272 | #: src/Widgets/PreferenceDialog.vala:33 273 | msgid "Document folder location:" 274 | msgstr "Emplacement des documents :" 275 | 276 | #: src/Widgets/PreferenceDialog.vala:37 277 | msgid "Select Document Folder…" 278 | msgstr "Sélectionnez l'emplacement des documents…" 279 | 280 | #: src/Widgets/PreferenceDialog.vala:43 281 | msgid "Include spaces to count characters:" 282 | msgstr "" 283 | 284 | #: src/Widgets/PreferenceDialog.vala:64 285 | msgid "Close" 286 | msgstr "Fermer" 287 | 288 | #. /TRANSLATORS: The string shown in the titlebar. "Writer" is the name of this app. 289 | #: src/Widgets/TitleBar.vala:31 src/MainWindow.vala:78 290 | msgid "Writer" 291 | msgstr "Writer" 292 | 293 | #: src/Widgets/TitleBar.vala:38 294 | msgid "Open a file" 295 | msgstr "Ouvrir un fichier" 296 | 297 | #: src/Widgets/TitleBar.vala:41 298 | msgid "Save this file with a different name" 299 | msgstr "Enregistrer ce fichier avec un nom différent" 300 | 301 | #: src/Widgets/TitleBar.vala:44 302 | msgid "Restore this file" 303 | msgstr "Restaurer ce fichier" 304 | 305 | #: src/Widgets/TitleBar.vala:47 306 | msgid "Print this file" 307 | msgstr "Imprimer ce fichier" 308 | 309 | #: src/Widgets/TitleBar.vala:51 310 | msgid "Find" 311 | msgstr "Rechercher" 312 | 313 | #: src/Widgets/TitleBar.vala:57 314 | msgid "Undo" 315 | msgstr "" 316 | 317 | #: src/Widgets/TitleBar.vala:60 318 | msgid "Redo" 319 | msgstr "" 320 | 321 | #: src/Application.vala:198 322 | #, c-format 323 | msgid "Untitled Document %i" 324 | msgstr "Document sans titre %i" 325 | 326 | #: src/Application.vala:219 327 | msgid "Choose a file to open" 328 | msgstr "Choisissez un fichier à ouvrir" 329 | 330 | #: src/Application.vala:221 src/Application.vala:296 331 | msgid "Rich Text Format (.rtf)" 332 | msgstr "Format Rich Text (.rtf)" 333 | 334 | #: src/Application.vala:224 src/Application.vala:299 335 | msgid "Cancel" 336 | msgstr "Annuler" 337 | 338 | #: src/Application.vala:225 339 | msgid "Open" 340 | msgstr "Ouvrir" 341 | 342 | #: src/Application.vala:291 343 | msgid "Save file with a different name" 344 | msgstr "Enregistrer avec un nom différent" 345 | 346 | #: src/Application.vala:300 347 | msgid "Save" 348 | msgstr "Enregistrer" 349 | 350 | #: src/Application.vala:326 351 | msgid "Are you sure you want to revret this file?" 352 | msgstr "" 353 | 354 | #: src/Application.vala:327 355 | msgid "Changes you made will be discarded." 356 | msgstr "" 357 | 358 | #: src/Application.vala:333 359 | msgid "Revert" 360 | msgstr "" 361 | 362 | #. /TRANSLATORS: The string shown in the titlebar. "%s" represents the name of an opened file. 363 | #. /The latter string "Writer" is the name of this app. 364 | #: src/MainWindow.vala:75 365 | #, fuzzy, c-format 366 | msgid "%s — Writer" 367 | msgstr "Writer" 368 | 369 | #~ msgid "Zeitgeist Datasource for Writer" 370 | #~ msgstr "Source de données Zeitgeist pour Writer" 371 | 372 | #~ msgid "A data source which logs Open, Close, Save and Move Events" 373 | #~ msgstr "" 374 | #~ "Une source de données qui enregistre les événements Ouvrir, Fermer, " 375 | #~ "Enregistrer et Déplacer" 376 | -------------------------------------------------------------------------------- /po/meson.build: -------------------------------------------------------------------------------- 1 | i18n.gettext(meson.project_name(), 2 | args: [ 3 | '--directory=' + meson.project_source_root(), 4 | '--from-code=UTF-8', 5 | '-cTRANSLATORS' 6 | ], 7 | preset: 'glib' 8 | ) 9 | 10 | subdir('extra') 11 | -------------------------------------------------------------------------------- /po/nl.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the com.github.ryonakano.writer package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: com.github.ryonakano.writer\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2021-06-16 21:39+0900\n" 11 | "PO-Revision-Date: 2020-08-22 13:07+0200\n" 12 | "Last-Translator: Heimen Stoffels \n" 13 | "Language-Team: \n" 14 | "Language: nl\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 19 | "X-Generator: Poedit 2.4.1\n" 20 | 21 | #: src/Views/WelcomeView.vala:23 22 | msgid "No Documents Open" 23 | msgstr "Geen geopende documenten" 24 | 25 | #: src/Views/WelcomeView.vala:24 26 | msgid "Open a document to begin editing." 27 | msgstr "Open een document om aan de slag te gaan." 28 | 29 | #: src/Views/WelcomeView.vala:30 30 | msgid "New File" 31 | msgstr "Nieuw bestand" 32 | 33 | #: src/Views/WelcomeView.vala:30 34 | msgid "Create a new document." 35 | msgstr "Maak een nieuw document." 36 | 37 | #: src/Views/WelcomeView.vala:31 38 | msgid "Open File" 39 | msgstr "Bestand openen" 40 | 41 | #: src/Views/WelcomeView.vala:31 42 | msgid "Open a saved document." 43 | msgstr "Open een opgeslagen document." 44 | 45 | #: src/Widgets/Choosers/TableChooser.vala:35 46 | msgid "Insert Table" 47 | msgstr "Tabel invoegen" 48 | 49 | #: src/Widgets/Choosers/TableChooser.vala:37 50 | msgid "Table" 51 | msgstr "Tabel" 52 | 53 | #: src/Widgets/Choosers/TableChooser.vala:39 54 | msgid "Columns:" 55 | msgstr "Kolommen:" 56 | 57 | #: src/Widgets/Choosers/TableChooser.vala:41 58 | msgid "Rows:" 59 | msgstr "Rijen:" 60 | 61 | #: src/Widgets/ToolBars/ImageToolBar.vala:34 62 | msgid "In line of text" 63 | msgstr "Tussen tekst" 64 | 65 | #: src/Widgets/ToolBars/ImageToolBar.vala:35 66 | msgid "Float above text" 67 | msgstr "Boven tekst" 68 | 69 | #: src/Widgets/ToolBars/ImageToolBar.vala:37 70 | msgid "Set how to wrap text" 71 | msgstr "Stel in hoe tekst moet worden omgeslagen" 72 | 73 | #: src/Widgets/ToolBars/ImageToolBar.vala:39 74 | msgid "Lock aspect ratio" 75 | msgstr "Beeldverhouding vergrendelen" 76 | 77 | #: src/Widgets/ToolBars/ImageToolBar.vala:43 78 | msgid "Allow to resize images without changing aspect ratio" 79 | msgstr "" 80 | "Sta toe dat afbeeldingen andere afmetingen krijgen zonder de beeldverhouding " 81 | "aan te passen" 82 | 83 | #: src/Widgets/ToolBars/ImageToolBar.vala:49 84 | msgid "Align image left" 85 | msgstr "Afbeelding links uitlijnen" 86 | 87 | #: src/Widgets/ToolBars/ImageToolBar.vala:50 88 | msgid "Center image" 89 | msgstr "Afbeelding centreren" 90 | 91 | #: src/Widgets/ToolBars/ImageToolBar.vala:51 92 | msgid "Align image right" 93 | msgstr "Afbeelding rechts uitlijnen" 94 | 95 | #: src/Widgets/ToolBars/ImageToolBar.vala:53 96 | msgid "Crop" 97 | msgstr "Bijsnijden" 98 | 99 | #: src/Widgets/ToolBars/ImageToolBar.vala:57 100 | msgid "Remove unnecessary part of image" 101 | msgstr "Verwijder onnodige delen van de afbeelding" 102 | 103 | #: src/Widgets/ToolBars/ImageToolBar.vala:59 104 | msgid "Delete Image" 105 | msgstr "Afbeelding verwijderen" 106 | 107 | #: src/Widgets/ToolBars/ImageToolBar.vala:63 108 | msgid "Delete selected image" 109 | msgstr "Verwijder de geselecteerde afbeelding" 110 | 111 | #: src/Widgets/ToolBars/TableToolBar.vala:31 112 | msgid "Table Properties" 113 | msgstr "Tabeleigenschappen" 114 | 115 | #: src/Widgets/ToolBars/TableToolBar.vala:34 116 | msgid "Set properties of selected table" 117 | msgstr "Stel de eigenschappen van de geselecteerde tabel in" 118 | 119 | #: src/Widgets/ToolBars/TableToolBar.vala:42 120 | #: src/Widgets/ToolBars/TextToolBar.vala:58 121 | msgid "Choose font family and font size" 122 | msgstr "Lettertype en -grootte instellen" 123 | 124 | #: src/Widgets/ToolBars/TableToolBar.vala:49 125 | #: src/Widgets/ToolBars/TextToolBar.vala:65 126 | msgid "Choose font color" 127 | msgstr "Letterkleur instellen" 128 | 129 | #: src/Widgets/ToolBars/TableToolBar.vala:52 130 | #: src/Widgets/ToolBars/TextToolBar.vala:68 131 | msgid "Toggle bold" 132 | msgstr "Vetgedrukt aan/uit" 133 | 134 | #: src/Widgets/ToolBars/TableToolBar.vala:56 135 | #: src/Widgets/ToolBars/TextToolBar.vala:72 136 | msgid "Toggle italic" 137 | msgstr "Cursief aan/uit" 138 | 139 | #: src/Widgets/ToolBars/TableToolBar.vala:60 140 | #: src/Widgets/ToolBars/TextToolBar.vala:76 141 | msgid "Toggle underline" 142 | msgstr "Onderstrepen aan/uit" 143 | 144 | #: src/Widgets/ToolBars/TableToolBar.vala:64 145 | #: src/Widgets/ToolBars/TextToolBar.vala:80 146 | msgid "Toggle strikethrough" 147 | msgstr "Doorhalen aan/uit" 148 | 149 | #: src/Widgets/ToolBars/TableToolBar.vala:81 150 | msgid "Align table left" 151 | msgstr "Tabel links uitlijnen" 152 | 153 | #: src/Widgets/ToolBars/TableToolBar.vala:82 154 | msgid "Center table" 155 | msgstr "Tabel centreren" 156 | 157 | #: src/Widgets/ToolBars/TableToolBar.vala:83 158 | msgid "Align table right" 159 | msgstr "Tabel rechts uitlijnen" 160 | 161 | #: src/Widgets/ToolBars/TableToolBar.vala:84 162 | msgid "Justify table" 163 | msgstr "Tabel uitvullen" 164 | 165 | #: src/Widgets/ToolBars/TableToolBar.vala:86 166 | msgid "Add" 167 | msgstr "Toevoegen" 168 | 169 | #: src/Widgets/ToolBars/TableToolBar.vala:90 170 | msgid "Add a new table" 171 | msgstr "Voeg een tabel toe" 172 | 173 | #: src/Widgets/ToolBars/TableToolBar.vala:92 174 | msgid "Delete" 175 | msgstr "Verwijderen" 176 | 177 | #: src/Widgets/ToolBars/TableToolBar.vala:96 178 | msgid "Delete selected table" 179 | msgstr "Verwijder de geselecteerde tabel" 180 | 181 | #: src/Widgets/ToolBars/TextToolBar.vala:43 182 | msgid "Paragraph" 183 | msgstr "Paragraaf" 184 | 185 | #: src/Widgets/ToolBars/TextToolBar.vala:44 186 | msgid "Title" 187 | msgstr "Titel" 188 | 189 | #: src/Widgets/ToolBars/TextToolBar.vala:45 190 | msgid "Subtitle" 191 | msgstr "Ondertitel" 192 | 193 | #: src/Widgets/ToolBars/TextToolBar.vala:46 194 | msgid "Bullet List" 195 | msgstr "Opsomming" 196 | 197 | #: src/Widgets/ToolBars/TextToolBar.vala:47 198 | msgid "Numbered List" 199 | msgstr "Genummerde lijst" 200 | 201 | #: src/Widgets/ToolBars/TextToolBar.vala:48 202 | msgid "Two-Column" 203 | msgstr "Twee kolommen" 204 | 205 | #: src/Widgets/ToolBars/TextToolBar.vala:50 206 | msgid "Set text style" 207 | msgstr "Tekststijl instellen" 208 | 209 | #: src/Widgets/ToolBars/TextToolBar.vala:97 210 | msgid "Align text left" 211 | msgstr "Tekst links uitlijnen" 212 | 213 | #: src/Widgets/ToolBars/TextToolBar.vala:98 214 | msgid "Center text" 215 | msgstr "Tekst centreren" 216 | 217 | #: src/Widgets/ToolBars/TextToolBar.vala:99 218 | msgid "Align text right" 219 | msgstr "Tekst rechts uitlijnen" 220 | 221 | #: src/Widgets/ToolBars/TextToolBar.vala:100 222 | msgid "Justify text" 223 | msgstr "Tekst uitvullen" 224 | 225 | #: src/Widgets/ToolBars/TextToolBar.vala:103 226 | msgid "Increase indent" 227 | msgstr "Inspringing vergroten" 228 | 229 | #: src/Widgets/ToolBars/TextToolBar.vala:105 230 | msgid "Decrease indent" 231 | msgstr "Inspringing verkleinen" 232 | 233 | #: src/Widgets/ToolBars/TextToolBar.vala:115 234 | msgid "Insert text" 235 | msgstr "Tekst invoegen" 236 | 237 | #: src/Widgets/ToolBars/TextToolBar.vala:117 238 | msgid "Insert link" 239 | msgstr "Link invoegen" 240 | 241 | #: src/Widgets/ToolBars/TextToolBar.vala:119 242 | msgid "Insert image" 243 | msgstr "Afbeelding invoegen" 244 | 245 | #: src/Widgets/ToolBars/TextToolBar.vala:121 246 | msgid "Insert table" 247 | msgstr "Tabel invoegen" 248 | 249 | #: src/Widgets/ActionBar.vala:47 250 | #, fuzzy, c-format 251 | msgid "%d character with spaces" 252 | msgid_plural "%d characters with spaces" 253 | msgstr[0] "%d teken" 254 | msgstr[1] "%d tekens" 255 | 256 | #: src/Widgets/ActionBar.vala:61 257 | #, fuzzy, c-format 258 | msgid "%d character without spaces" 259 | msgid_plural "%d characters without spaces" 260 | msgstr[0] "%d teken" 261 | msgstr[1] "%d tekens" 262 | 263 | #: src/Widgets/PreferenceDialog.vala:27 src/Widgets/TitleBar.vala:62 264 | #: src/Widgets/TitleBar.vala:68 265 | msgid "Preferences" 266 | msgstr "Voorkeuren" 267 | 268 | #: src/Widgets/PreferenceDialog.vala:33 269 | msgid "Document folder location:" 270 | msgstr "Locatie van documentenmap:" 271 | 272 | #: src/Widgets/PreferenceDialog.vala:37 273 | msgid "Select Document Folder…" 274 | msgstr "Documentenmap kiezen…" 275 | 276 | #: src/Widgets/PreferenceDialog.vala:43 277 | msgid "Include spaces to count characters:" 278 | msgstr "" 279 | 280 | #: src/Widgets/PreferenceDialog.vala:64 281 | msgid "Close" 282 | msgstr "Sluiten" 283 | 284 | #. /TRANSLATORS: The string shown in the titlebar. "Writer" is the name of this app. 285 | #: src/Widgets/TitleBar.vala:31 src/MainWindow.vala:78 286 | msgid "Writer" 287 | msgstr "Tekstverwerker" 288 | 289 | #: src/Widgets/TitleBar.vala:38 290 | msgid "Open a file" 291 | msgstr "Open een bestand" 292 | 293 | #: src/Widgets/TitleBar.vala:41 294 | msgid "Save this file with a different name" 295 | msgstr "Sla dit bestand op onder een andere naam" 296 | 297 | #: src/Widgets/TitleBar.vala:44 298 | msgid "Restore this file" 299 | msgstr "Herstel dit bestand" 300 | 301 | #: src/Widgets/TitleBar.vala:47 302 | msgid "Print this file" 303 | msgstr "Druk dit bestand af" 304 | 305 | #: src/Widgets/TitleBar.vala:51 306 | msgid "Find" 307 | msgstr "Zoeken" 308 | 309 | #: src/Widgets/TitleBar.vala:57 310 | msgid "Undo" 311 | msgstr "" 312 | 313 | #: src/Widgets/TitleBar.vala:60 314 | msgid "Redo" 315 | msgstr "" 316 | 317 | #: src/Application.vala:198 318 | #, c-format 319 | msgid "Untitled Document %i" 320 | msgstr "Naamloos document %i" 321 | 322 | #: src/Application.vala:219 323 | msgid "Choose a file to open" 324 | msgstr "Kies een te openen bestand" 325 | 326 | #: src/Application.vala:221 src/Application.vala:296 327 | msgid "Rich Text Format (.rtf)" 328 | msgstr "Rich Text Format (.rtf)" 329 | 330 | #: src/Application.vala:224 src/Application.vala:299 331 | msgid "Cancel" 332 | msgstr "Annuleren" 333 | 334 | #: src/Application.vala:225 335 | msgid "Open" 336 | msgstr "Openen" 337 | 338 | #: src/Application.vala:291 339 | msgid "Save file with a different name" 340 | msgstr "Bestand opslaan onder een andere naam" 341 | 342 | #: src/Application.vala:300 343 | msgid "Save" 344 | msgstr "Opslaan" 345 | 346 | #: src/Application.vala:326 347 | msgid "Are you sure you want to revret this file?" 348 | msgstr "" 349 | 350 | #: src/Application.vala:327 351 | msgid "Changes you made will be discarded." 352 | msgstr "" 353 | 354 | #: src/Application.vala:333 355 | msgid "Revert" 356 | msgstr "" 357 | 358 | #. /TRANSLATORS: The string shown in the titlebar. "%s" represents the name of an opened file. 359 | #. /The latter string "Writer" is the name of this app. 360 | #: src/MainWindow.vala:75 361 | #, c-format 362 | msgid "%s — Writer" 363 | msgstr "%s - Tekstverwerker" 364 | 365 | #~ msgid "Zeitgeist Datasource for Writer" 366 | #~ msgstr "Zeitgeist-gegevensbron voor Tekstverwerker" 367 | 368 | #~ msgid "A data source which logs Open, Close, Save and Move Events" 369 | #~ msgstr "" 370 | #~ "Een gegevensbron die gebeurtenissen vastlegt, zoals openen, sluiten, " 371 | #~ "opslaan en verplaatsen" 372 | -------------------------------------------------------------------------------- /po/pt_BR.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the com.github.ryonakano.writer package. 4 | # Matheus T. Ricci, 2021 5 | # 6 | #, fuzzy 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: com.github.ryonakano.writer\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2021-06-16 21:39+0900\n" 12 | "PO-Revision-Date: 2021-08-18 22:30+0900\n" 13 | "Last-Translator: Matheus T. Ricci\n" 14 | "Language:pt_BR\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" 19 | 20 | #: src/Views/WelcomeView.vala:23 21 | msgid "No Documents Open" 22 | msgstr "Nenhum documento aberto" 23 | 24 | #: src/Views/WelcomeView.vala:24 25 | msgid "Open a document to begin editing." 26 | msgstr "Abra um documento para começar a editar." 27 | 28 | #: src/Views/WelcomeView.vala:30 29 | msgid "New File" 30 | msgstr "Novo arquivo" 31 | 32 | #: src/Views/WelcomeView.vala:30 33 | msgid "Create a new document." 34 | msgstr "Criar um novo documento." 35 | 36 | #: src/Views/WelcomeView.vala:31 37 | msgid "Open File" 38 | msgstr "Abrir arquivo" 39 | 40 | #: src/Views/WelcomeView.vala:31 41 | msgid "Open a saved document." 42 | msgstr "Abrir um documento salvo." 43 | 44 | #: src/Widgets/Choosers/TableChooser.vala:35 45 | msgid "Insert Table" 46 | msgstr "Inserir tabela" 47 | 48 | #: src/Widgets/Choosers/TableChooser.vala:37 49 | msgid "Table" 50 | msgstr "Tabela" 51 | 52 | #: src/Widgets/Choosers/TableChooser.vala:39 53 | msgid "Columns:" 54 | msgstr "Colunas:" 55 | 56 | #: src/Widgets/Choosers/TableChooser.vala:41 57 | msgid "Rows:" 58 | msgstr "Linhas:" 59 | 60 | #: src/Widgets/ToolBars/ImageToolBar.vala:34 61 | msgid "In line of text" 62 | msgstr "Alinhado com o texto" 63 | 64 | #: src/Widgets/ToolBars/ImageToolBar.vala:35 65 | msgid "Float above text" 66 | msgstr "Flutuar sobre o texto" 67 | 68 | #: src/Widgets/ToolBars/ImageToolBar.vala:37 69 | msgid "Set how to wrap text" 70 | msgstr "Definir como cortar texto" 71 | 72 | #: src/Widgets/ToolBars/ImageToolBar.vala:39 73 | msgid "Lock aspect ratio" 74 | msgstr "Travar proporções" 75 | 76 | #: src/Widgets/ToolBars/ImageToolBar.vala:43 77 | msgid "Allow to resize images without changing aspect ratio" 78 | msgstr "Permitir redimensionar imagens sem mudar proporções" 79 | 80 | #: src/Widgets/ToolBars/ImageToolBar.vala:49 81 | msgid "Align image left" 82 | msgstr "Alinhar imagem à esquerda" 83 | 84 | #: src/Widgets/ToolBars/ImageToolBar.vala:50 85 | msgid "Center image" 86 | msgstr "Centralizar imagem" 87 | 88 | #: src/Widgets/ToolBars/ImageToolBar.vala:51 89 | msgid "Align image right" 90 | msgstr "Alinhar imagem à direita" 91 | 92 | #: src/Widgets/ToolBars/ImageToolBar.vala:53 93 | msgid "Crop" 94 | msgstr "Cortar" 95 | 96 | #: src/Widgets/ToolBars/ImageToolBar.vala:57 97 | msgid "Remove unnecessary part of image" 98 | msgstr "Remover parte desnecessária da imagem" 99 | 100 | #: src/Widgets/ToolBars/ImageToolBar.vala:59 101 | msgid "Delete Image" 102 | msgstr "Deletar imagem" 103 | 104 | #: src/Widgets/ToolBars/ImageToolBar.vala:63 105 | msgid "Delete selected image" 106 | msgstr "Deletar imagem selecionada" 107 | 108 | #: src/Widgets/ToolBars/TableToolBar.vala:31 109 | msgid "Table Properties" 110 | msgstr "Propriedades da Tabela" 111 | 112 | #: src/Widgets/ToolBars/TableToolBar.vala:34 113 | msgid "Set properties of selected table" 114 | msgstr "Definir propriedades da tabela selecionada" 115 | 116 | #: src/Widgets/ToolBars/TableToolBar.vala:42 117 | #: src/Widgets/ToolBars/TextToolBar.vala:58 118 | msgid "Choose font family and font size" 119 | msgstr "Escolher estilo e tamanho da fonte" 120 | 121 | #: src/Widgets/ToolBars/TableToolBar.vala:49 122 | #: src/Widgets/ToolBars/TextToolBar.vala:65 123 | msgid "Choose font color" 124 | msgstr "Escolher cor da fonte" 125 | 126 | #: src/Widgets/ToolBars/TableToolBar.vala:52 127 | #: src/Widgets/ToolBars/TextToolBar.vala:68 128 | msgid "Toggle bold" 129 | msgstr "Negrito" 130 | 131 | #: src/Widgets/ToolBars/TableToolBar.vala:56 132 | #: src/Widgets/ToolBars/TextToolBar.vala:72 133 | msgid "Toggle italic" 134 | msgstr "Itálico" 135 | 136 | #: src/Widgets/ToolBars/TableToolBar.vala:60 137 | #: src/Widgets/ToolBars/TextToolBar.vala:76 138 | msgid "Toggle underline" 139 | msgstr "Sublinhado" 140 | 141 | #: src/Widgets/ToolBars/TableToolBar.vala:64 142 | #: src/Widgets/ToolBars/TextToolBar.vala:80 143 | msgid "Toggle strikethrough" 144 | msgstr "Tachado" 145 | 146 | #: src/Widgets/ToolBars/TableToolBar.vala:81 147 | msgid "Align table left" 148 | msgstr "Alinhar tabela à esquerda" 149 | 150 | #: src/Widgets/ToolBars/TableToolBar.vala:82 151 | msgid "Center table" 152 | msgstr "Centralizar tabela" 153 | 154 | #: src/Widgets/ToolBars/TableToolBar.vala:83 155 | msgid "Align table right" 156 | msgstr "Alinhar tabela à direita" 157 | 158 | #: src/Widgets/ToolBars/TableToolBar.vala:84 159 | msgid "Justify table" 160 | msgstr "Justificar tabela" 161 | 162 | #: src/Widgets/ToolBars/TableToolBar.vala:86 163 | msgid "Add" 164 | msgstr "Adicionar" 165 | 166 | #: src/Widgets/ToolBars/TableToolBar.vala:90 167 | msgid "Add a new table" 168 | msgstr "Adicionar uma nova tabela" 169 | 170 | #: src/Widgets/ToolBars/TableToolBar.vala:92 171 | msgid "Delete" 172 | msgstr "Deletar" 173 | 174 | #: src/Widgets/ToolBars/TableToolBar.vala:96 175 | msgid "Delete selected table" 176 | msgstr "Deletar tabela selecionada" 177 | 178 | #: src/Widgets/ToolBars/TextToolBar.vala:43 179 | msgid "Paragraph" 180 | msgstr "Parágrafo" 181 | 182 | #: src/Widgets/ToolBars/TextToolBar.vala:44 183 | msgid "Title" 184 | msgstr "Título" 185 | 186 | #: src/Widgets/ToolBars/TextToolBar.vala:45 187 | msgid "Subtitle" 188 | msgstr "Subtítulo" 189 | 190 | #: src/Widgets/ToolBars/TextToolBar.vala:46 191 | msgid "Bullet List" 192 | msgstr "Lista pontuada" 193 | 194 | #: src/Widgets/ToolBars/TextToolBar.vala:47 195 | msgid "Numbered List" 196 | msgstr "Lista numerada" 197 | 198 | #: src/Widgets/ToolBars/TextToolBar.vala:48 199 | msgid "Two-Column" 200 | msgstr "Duas colunas" 201 | 202 | #: src/Widgets/ToolBars/TextToolBar.vala:50 203 | msgid "Set text style" 204 | msgstr "Definir estilo do texto" 205 | 206 | #: src/Widgets/ToolBars/TextToolBar.vala:97 207 | msgid "Align text left" 208 | msgstr "Alinhar texto à esquerda" 209 | 210 | #: src/Widgets/ToolBars/TextToolBar.vala:98 211 | msgid "Center text" 212 | msgstr "Centralizar texto" 213 | 214 | #: src/Widgets/ToolBars/TextToolBar.vala:99 215 | msgid "Align text right" 216 | msgstr "Alinhar texto à direita" 217 | 218 | #: src/Widgets/ToolBars/TextToolBar.vala:100 219 | msgid "Justify text" 220 | msgstr "Justificar texto" 221 | 222 | #: src/Widgets/ToolBars/TextToolBar.vala:103 223 | msgid "Increase indent" 224 | msgstr "Aumentar recuo" 225 | 226 | #: src/Widgets/ToolBars/TextToolBar.vala:105 227 | msgid "Decrease indent" 228 | msgstr "Diminuir recuo" 229 | 230 | #: src/Widgets/ToolBars/TextToolBar.vala:115 231 | msgid "Insert text" 232 | msgstr "Inserir texto" 233 | 234 | #: src/Widgets/ToolBars/TextToolBar.vala:117 235 | msgid "Insert link" 236 | msgstr "Inserir link" 237 | 238 | #: src/Widgets/ToolBars/TextToolBar.vala:119 239 | msgid "Insert image" 240 | msgstr "Inserir imagem" 241 | 242 | #: src/Widgets/ToolBars/TextToolBar.vala:121 243 | msgid "Insert table" 244 | msgstr "Inserir tabela" 245 | 246 | #: src/Widgets/ActionBar.vala:47 247 | #, c-format 248 | msgid "%d character with spaces" 249 | msgid_plural "%d characters with spaces" 250 | msgstr[0] "%d caractere com espaços" 251 | msgstr[1] "%d caracteres com espaços" 252 | 253 | #: src/Widgets/ActionBar.vala:61 254 | #, c-format 255 | msgid "%d character without spaces" 256 | msgid_plural "%d characters without spaces" 257 | msgstr[0] "%d caractere sem espaços" 258 | msgstr[1] "%d caracteres sem espaços" 259 | 260 | #: src/Widgets/PreferenceDialog.vala:27 src/Widgets/TitleBar.vala:62 261 | #: src/Widgets/TitleBar.vala:68 262 | msgid "Preferences" 263 | msgstr "Preferências" 264 | 265 | #: src/Widgets/PreferenceDialog.vala:33 266 | msgid "Document folder location:" 267 | msgstr "Localização da pasta de Documentos:" 268 | 269 | #: src/Widgets/PreferenceDialog.vala:37 270 | msgid "Select Document Folder…" 271 | msgstr "Selecionar pasta de Documentos…" 272 | 273 | #: src/Widgets/PreferenceDialog.vala:43 274 | msgid "Include spaces to count characters:" 275 | msgstr "Incluir espaços na contagem de caracteres:" 276 | 277 | #: src/Widgets/PreferenceDialog.vala:64 278 | msgid "Close" 279 | msgstr "Fechar" 280 | 281 | #. /TRANSLATORS: The string shown in the titlebar. "Writer" is the name of this app. 282 | #: src/Widgets/TitleBar.vala:31 src/MainWindow.vala:78 283 | msgid "Writer" 284 | msgstr "Writer" 285 | 286 | #: src/Widgets/TitleBar.vala:38 287 | msgid "Open a file" 288 | msgstr "Abrir arquivo" 289 | 290 | #: src/Widgets/TitleBar.vala:41 291 | msgid "Save this file with a different name" 292 | msgstr "Salvar esse arquivo com outro nome" 293 | 294 | #: src/Widgets/TitleBar.vala:44 295 | msgid "Restore this file" 296 | msgstr "Restaurar esse arquivo" 297 | 298 | #: src/Widgets/TitleBar.vala:47 299 | msgid "Print this file" 300 | msgstr "Imprimir esse arquivo" 301 | 302 | #: src/Widgets/TitleBar.vala:51 303 | msgid "Find" 304 | msgstr "Encontrar" 305 | 306 | #: src/Widgets/TitleBar.vala:57 307 | msgid "Undo" 308 | msgstr "Desfazer" 309 | 310 | #: src/Widgets/TitleBar.vala:60 311 | msgid "Redo" 312 | msgstr "Refazer" 313 | 314 | #: src/Application.vala:198 315 | #, c-format 316 | msgid "Untitled Document %i" 317 | msgstr "Documento Sem Título %i" 318 | 319 | #: src/Application.vala:219 320 | msgid "Choose a file to open" 321 | msgstr "Escolher um arquivo para abrir" 322 | 323 | #: src/Application.vala:221 src/Application.vala:296 324 | msgid "Rich Text Format (.rtf)" 325 | msgstr "Rich Text Format (.rtf)" 326 | 327 | #: src/Application.vala:224 src/Application.vala:299 328 | msgid "Cancel" 329 | msgstr "Cancelar" 330 | 331 | #: src/Application.vala:225 332 | msgid "Open" 333 | msgstr "Abrir" 334 | 335 | #: src/Application.vala:291 336 | msgid "Save file with a different name" 337 | msgstr "Salvar arquivo com outro nome" 338 | 339 | #: src/Application.vala:300 340 | msgid "Save" 341 | msgstr "Salvar" 342 | 343 | #: src/Application.vala:326 344 | msgid "Are you sure you want to revret this file?" 345 | msgstr "Você tem certeza que deseja reverter esse arquivo?" 346 | 347 | #: src/Application.vala:327 348 | msgid "Changes you made will be discarded." 349 | msgstr "As alterações que você fez serão descartadas." 350 | 351 | #: src/Application.vala:333 352 | msgid "Revert" 353 | msgstr "Reverter" 354 | 355 | #. /TRANSLATORS: The string shown in the titlebar. "%s" represents the name of an opened file. 356 | #. /The latter string "Writer" is the name of this app. 357 | #: src/MainWindow.vala:75 358 | #, c-format 359 | msgid "%s — Writer" 360 | msgstr "%s — Writer" 361 | -------------------------------------------------------------------------------- /src/Application.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2020 Writer Developers 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | public class Writer.Application : Gtk.Application { 19 | private MainWindow window; 20 | public TextEditor editor { get; private set; } 21 | public static Settings settings; 22 | private bool has_open_file; 23 | private string destination = ""; 24 | private string file_name = ""; 25 | private string path = ""; 26 | private File? opened_file = null; 27 | private File? backedup_file = null; 28 | 29 | public Application () { 30 | Object ( 31 | application_id: Constants.PROJECT_NAME, 32 | flags: ApplicationFlags.FLAGS_NONE 33 | ); 34 | } 35 | 36 | construct { 37 | Intl.setlocale (LocaleCategory.ALL, ""); 38 | GLib.Intl.bindtextdomain (Constants.GETTEXT_PACKAGE, Constants.LOCALEDIR); 39 | GLib.Intl.bind_textdomain_codeset (Constants.GETTEXT_PACKAGE, "UTF-8"); 40 | GLib.Intl.textdomain (Constants.GETTEXT_PACKAGE); 41 | 42 | destination = settings.get_string ("destination"); 43 | 44 | if (destination == "") { 45 | destination = Environment.get_user_special_dir (UserDirectory.DOCUMENTS); 46 | 47 | if (destination != null) { 48 | DirUtils.create_with_parents (destination, 0775); 49 | } else { 50 | destination = Environment.get_home_dir (); 51 | } 52 | 53 | settings.set_string ("destination", destination); 54 | } 55 | } 56 | 57 | static construct { 58 | settings = new Settings (Constants.PROJECT_NAME); 59 | } 60 | 61 | public override void activate () { 62 | if (get_windows () != null) { 63 | window.present (); 64 | return; 65 | } 66 | 67 | int window_x, window_y, window_width, window_height; 68 | settings.get ("window-position", "(ii)", out window_x, out window_y); 69 | settings.get ("window-size", "(ii)", out window_width, out window_height); 70 | var is_maximized = settings.get_boolean ("is-maximized"); 71 | 72 | editor = new TextEditor (); 73 | editor.changed.connect (() => { 74 | save (); 75 | }); 76 | 77 | window = new MainWindow (this, editor); 78 | window.set_default_size (window_width, window_height); 79 | 80 | if (window_x == -1 || window_y == -1) { 81 | window.window_position = Gtk.WindowPosition.CENTER; 82 | } else { 83 | window.move (window_x, window_y); 84 | } 85 | 86 | if (is_maximized) { 87 | window.maximize (); 88 | } 89 | 90 | window.show_welcome (); 91 | window.show_all (); 92 | 93 | var open_file_action = new SimpleAction ("open", null); 94 | add_action (open_file_action); 95 | set_accels_for_action ("app.open", {"o"}); 96 | open_file_action.activate.connect (() => { 97 | if (window != null) { 98 | open_file_dialog (); 99 | } 100 | }); 101 | 102 | var save_file_action = new SimpleAction ("save", null); 103 | add_action (save_file_action); 104 | set_accels_for_action ("app.save", {"s"}); 105 | save_file_action.activate.connect (() => { 106 | if (window != null && window.stack.visible_child_name == "editor") { 107 | save (); 108 | } 109 | }); 110 | 111 | var save_as_file_action = new SimpleAction ("save_as", null); 112 | add_action (save_as_file_action); 113 | set_accels_for_action ("app.save_as", {"s"}); 114 | save_as_file_action.activate.connect (() => { 115 | if (window != null && window.stack.visible_child_name == "editor") { 116 | save_as (); 117 | } 118 | }); 119 | 120 | bool revertable = false; 121 | 122 | var revert_file_action = new SimpleAction ("revert", null); 123 | add_action (revert_file_action); 124 | set_accels_for_action ("app.revert", {"o"}); 125 | revert_file_action.activate.connect (() => { 126 | if (window != null && window.stack.visible_child_name == "editor") { 127 | if (revertable) { 128 | revertable = !revert (); 129 | } 130 | 131 | editor.changed.connect (() => { 132 | revertable = true; 133 | }); 134 | } 135 | }); 136 | 137 | var close_file_action = new SimpleAction ("close", null); 138 | add_action (close_file_action); 139 | set_accels_for_action ("app.close", {"w"}); 140 | close_file_action.activate.connect (() => { 141 | if (window != null && window.stack.visible_child_name == "editor") { 142 | close_file (); 143 | } 144 | }); 145 | 146 | var quit_action = new SimpleAction ("quit", null); 147 | add_action (quit_action); 148 | set_accels_for_action ("app.quit", {"q"}); 149 | quit_action.activate.connect (() => { 150 | if (window != null) { 151 | window.destroy (); 152 | } 153 | }); 154 | 155 | var bold_action = new SimpleAction ("bold", null); 156 | add_action (bold_action); 157 | set_accels_for_action ("app.bold", {"b"}); 158 | bold_action.activate.connect (() => { 159 | if (window != null && window.stack.visible_child_name == "editor") { 160 | editor.toggle_style ("bold"); 161 | } 162 | }); 163 | 164 | var italic_action = new SimpleAction ("italic", null); 165 | add_action (italic_action); 166 | set_accels_for_action ("app.italic", {"i"}); 167 | italic_action.activate.connect (() => { 168 | if (window != null && window.stack.visible_child_name == "editor") { 169 | editor.toggle_style ("italic"); 170 | } 171 | }); 172 | 173 | var underline_action = new SimpleAction ("underline", null); 174 | add_action (underline_action); 175 | set_accels_for_action ("app.underline", {"u"}); 176 | underline_action.activate.connect (() => { 177 | if (window != null && window.stack.visible_child_name == "editor") { 178 | editor.toggle_style ("underline"); 179 | } 180 | }); 181 | 182 | var strikethrough_action = new SimpleAction ("strikethrough", null); 183 | add_action (strikethrough_action); 184 | set_accels_for_action ("app.strikethrough", {"h"}); 185 | strikethrough_action.activate.connect (() => { 186 | if (window != null && window.stack.visible_child_name == "editor") { 187 | editor.toggle_style ("strikethrough"); 188 | } 189 | }); 190 | } 191 | 192 | public void new_file () { 193 | int id = 1; 194 | string name = ""; 195 | string suffix = ""; 196 | 197 | do { 198 | name = _("Untitled Document %i").printf (id++); 199 | suffix = ".rtf"; 200 | opened_file = File.new_for_path ("%s/%s%s".printf (destination, name, suffix)); 201 | } while (opened_file.query_exists ()); 202 | 203 | path = opened_file.get_path (); 204 | file_name = opened_file.get_basename (); 205 | save (); 206 | open_file (); 207 | create_backup (); 208 | } 209 | 210 | private void open_file () { 211 | has_open_file = true; 212 | editor.set_text (new Utils.RTFParser ().read_all (path), -1); 213 | window.set_header_title (path); 214 | window.show_editor (); 215 | editor.text_view.grab_focus (); 216 | } 217 | 218 | public void open_file_dialog () { 219 | var rtf_files_filter = new Gtk.FileFilter (); 220 | rtf_files_filter.set_filter_name (_("Rich Text Format (.rtf)")); 221 | rtf_files_filter.add_mime_type ("text/rtf"); 222 | 223 | var filech = new Gtk.FileChooserNative ( 224 | _("Choose a file to open"), 225 | window, 226 | Gtk.FileChooserAction.OPEN, 227 | _("Open"), _("Cancel") 228 | ) { 229 | select_multiple = false, 230 | filter = rtf_files_filter 231 | }; 232 | 233 | if (filech.run () == Gtk.ResponseType.ACCEPT) { 234 | path = filech.get_filename (); 235 | file_name = filech.get_file ().get_basename (); 236 | open_file (); 237 | create_backup (); 238 | } 239 | } 240 | 241 | private void close_file () { 242 | path = ""; 243 | delete_backup (); 244 | editor.set_text (""); 245 | window.set_header_title (""); 246 | window.show_welcome (); 247 | } 248 | 249 | private void create_backup () { 250 | // Take a backup in /tmp 251 | opened_file = File.new_for_path (path); 252 | backedup_file = File.new_for_path ("%s/%s".printf (Environment.get_tmp_dir (), file_name)); 253 | 254 | try { 255 | opened_file.copy (backedup_file, FileCopyFlags.OVERWRITE, null, (current_num_bytes, total_num_bytes) => { 256 | debug ("Opened file backuped"); 257 | }); 258 | } catch (Error err) { 259 | warning (err.message); 260 | } 261 | } 262 | 263 | public void delete_backup () { 264 | if (!has_open_file) { 265 | return; 266 | } 267 | 268 | try { 269 | backedup_file.delete (); 270 | } catch (Error err) { 271 | warning (err.message); 272 | } 273 | } 274 | 275 | public void save () { 276 | if (path != "") { 277 | Utils.RTFWriter.get_default ().write_to_file (path, editor.text); 278 | } 279 | } 280 | 281 | public void save_as () { 282 | var rtf_files_filter = new Gtk.FileFilter (); 283 | rtf_files_filter.set_filter_name (_("Rich Text Format (.rtf)")); 284 | rtf_files_filter.add_mime_type ("text/rtf"); 285 | 286 | var filech = new Gtk.FileChooserNative ( 287 | _("Save file with a different name"), 288 | window, 289 | Gtk.FileChooserAction.SAVE, 290 | _("Save"), _("Cancel") 291 | ) { 292 | select_multiple = false, 293 | filter = rtf_files_filter, 294 | do_overwrite_confirmation = true 295 | }; 296 | 297 | if (filech.run () == Gtk.ResponseType.ACCEPT) { 298 | path = filech.get_filename (); 299 | if (!path.has_suffix (".rtf")) { 300 | path += ".rtf"; 301 | } 302 | 303 | file_name = filech.get_current_name (); 304 | if (!file_name.has_suffix (".rtf")) { 305 | file_name += ".rtf"; 306 | } 307 | 308 | save (); 309 | open_file (); 310 | } 311 | } 312 | 313 | public bool revert () { 314 | var revert_dialog = new Granite.MessageDialog.with_image_from_icon_name ( 315 | _("Are you sure you want to revret this file?"), 316 | _("Changes you made will be discarded."), 317 | "dialog-warning", 318 | Gtk.ButtonsType.CANCEL 319 | ); 320 | revert_dialog.transient_for = window; 321 | 322 | var revert_button = revert_dialog.add_button (_("Revert"), Gtk.ResponseType.ACCEPT); 323 | revert_button.get_style_context ().add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION); 324 | 325 | if (revert_dialog.run () == Gtk.ResponseType.ACCEPT) { 326 | try { 327 | backedup_file.copy (opened_file, FileCopyFlags.OVERWRITE, null, (current_num_bytes, total_num_bytes) => { 328 | // Report copy-status 329 | debug ("%" + int64.FORMAT + " bytes of %" + int64.FORMAT + " bytes copied.", 330 | current_num_bytes, total_num_bytes); 331 | }); 332 | 333 | // Refresh the text view 334 | open_file (); 335 | } catch (Error err) { 336 | warning (err.message); 337 | } 338 | 339 | revert_dialog.destroy (); 340 | return true; 341 | } 342 | 343 | revert_dialog.destroy (); 344 | return false; 345 | } 346 | 347 | public void print_file () { 348 | print ("print\n"); 349 | } 350 | 351 | public void search (string text) { 352 | // TODO: When tabs will be added, first get the active Editor 353 | editor.search (text); 354 | } 355 | 356 | public void undo () { 357 | if (editor.can_undo) { 358 | editor.undo (); 359 | } 360 | 361 | editor.text_view.grab_focus (); 362 | } 363 | 364 | public void redo () { 365 | if (editor.can_redo) { 366 | editor.redo (); 367 | } 368 | 369 | editor.text_view.grab_focus (); 370 | } 371 | 372 | public void preferences () { 373 | var preference_dialog = new Widgets.PreferenceDialog (window); 374 | preference_dialog.show_all (); 375 | } 376 | 377 | public static void main (string [] args) { 378 | var app = new Writer.Application (); 379 | app.run (args); 380 | } 381 | } 382 | -------------------------------------------------------------------------------- /src/MainWindow.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2020 Writer Developers 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | public class Writer.MainWindow : Gtk.ApplicationWindow { 19 | public Application app { get; construct; } 20 | public TextEditor editor { get; construct; } 21 | private Widgets.TitleBar title_bar; 22 | public Gtk.Stack stack { get; private set; } 23 | public Views.EditorView editor_view { get; private set; } 24 | private uint configure_id; 25 | 26 | public MainWindow (Application app, TextEditor editor) { 27 | Object ( 28 | application: app, 29 | app: app, 30 | editor: editor 31 | ); 32 | } 33 | 34 | construct { 35 | // Import CSS 36 | var cssprovider = new Gtk.CssProvider (); 37 | cssprovider.load_from_resource ("/com/github/ryonakano/writer/Application.css"); 38 | Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default (), 39 | cssprovider, 40 | Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); 41 | 42 | // Follow elementary OS-wide dark preference 43 | var granite_settings = Granite.Settings.get_default (); 44 | var gtk_settings = Gtk.Settings.get_default (); 45 | 46 | gtk_settings.gtk_application_prefer_dark_theme = granite_settings.prefers_color_scheme == Granite.Settings.ColorScheme.DARK; 47 | 48 | granite_settings.notify["prefers-color-scheme"].connect (() => { 49 | gtk_settings.gtk_application_prefer_dark_theme = granite_settings.prefers_color_scheme == Granite.Settings.ColorScheme.DARK; 50 | }); 51 | 52 | add_events (Gdk.EventMask.BUTTON_PRESS_MASK); 53 | 54 | stack = new Gtk.Stack (); 55 | stack.transition_duration = 200; 56 | stack.transition_type = Gtk.StackTransitionType.SLIDE_LEFT_RIGHT; 57 | 58 | editor_view = new Views.EditorView (editor); 59 | var welcome_view = new Views.WelcomeView (app); 60 | 61 | stack.add_named (welcome_view, "welcome"); 62 | stack.add_named (editor_view, "editor"); 63 | add (stack); 64 | 65 | title_bar = new Widgets.TitleBar (app); 66 | set_titlebar (title_bar); 67 | 68 | destroy.connect (app.delete_backup); 69 | } 70 | 71 | public void show_editor () { 72 | title_bar.set_active (true); 73 | stack.visible_child_name = "editor"; 74 | } 75 | 76 | public void show_welcome () { 77 | title_bar.set_active (false); 78 | stack.visible_child_name = "welcome"; 79 | } 80 | 81 | public void set_header_title (string path) { 82 | if (path != "") { 83 | ///TRANSLATORS: The string shown in the titlebar. "%s" represents the name of an opened file. 84 | ///The latter string "Writer" is the name of this app. 85 | title_bar.title = _("%s — Writer").printf (Path.get_basename (path)); 86 | } else { 87 | ///TRANSLATORS: The string shown in the titlebar. "Writer" is the name of this app. 88 | title_bar.title = _("Writer"); 89 | } 90 | } 91 | 92 | protected override bool configure_event (Gdk.EventConfigure event) { 93 | if (configure_id != 0) { 94 | GLib.Source.remove (configure_id); 95 | } 96 | 97 | configure_id = Timeout.add (100, () => { 98 | configure_id = 0; 99 | 100 | Application.settings.set_boolean ("is-maximized", is_maximized); 101 | 102 | if (!is_maximized) { 103 | int x, y, w, h; 104 | get_position (out x, out y); 105 | get_size (out w, out h); 106 | Application.settings.set ("window-position", "(ii)", x, y); 107 | Application.settings.set ("window-size", "(ii)", w, h); 108 | } 109 | 110 | return false; 111 | }); 112 | 113 | // Redraw document_view when window is resized or maximized/unmaximized, otherwise the view will be broken 114 | editor_view.document_view.queue_draw (); 115 | editor_view.document_view_wrapper.queue_draw (); 116 | 117 | return base.configure_event (event); 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /src/Utils/RTFParser.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2020 Writer Developers 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | public class Writer.Utils.RTFParser : Object { 19 | 20 | public RTFParser () { 21 | } 22 | 23 | public string read_all (string path) { 24 | try { 25 | string content; 26 | FileUtils.get_contents (path, out content); 27 | int start = content.index_of ("{\\rtf\n") + "{\\rtf\n".length; 28 | int end = content.index_of ("\n}\n"); 29 | string res = content.substring (start, end - start); 30 | return res; 31 | } catch (Error err) { 32 | print ("Error reading file: " + err.message); 33 | return ""; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Utils/RTFWriter.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2020 Writer Developers 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | public class Writer.Utils.RTFWriter : Object { 19 | private RTFWriter () { 20 | } 21 | 22 | private static RTFWriter _instance; 23 | public static RTFWriter get_default () { 24 | if (_instance == null) { 25 | _instance = new RTFWriter (); 26 | } 27 | 28 | return _instance; 29 | } 30 | 31 | private string to_string (string contents) { 32 | string rtf = ""; 33 | rtf += "{\\rtf\n" + contents + "\n}\n"; 34 | return rtf; 35 | } 36 | 37 | public void write_to_file (string path, string contents) { 38 | try { 39 | FileUtils.set_contents (path, to_string (contents)); 40 | } catch (Error err) { 41 | print ("Error writing file: " + err.message); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Utils/TextEditor.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2020 Writer Developers 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | public class Writer.TextEditor : Gtk.SourceBuffer { 19 | public Gtk.SourceView text_view { get; private set; } 20 | private bool style_bold; 21 | private bool style_italic; 22 | private bool style_underline; 23 | private bool style_strikethrough; 24 | 25 | public signal void cursor_moved (); 26 | public signal void text_inserted (); 27 | 28 | public TextEditor () { 29 | setup_tagtable (this); 30 | text_view = new Gtk.SourceView.with_buffer (this); 31 | text_view.pixels_below_lines = 20; 32 | text_view.wrap_mode = Gtk.WrapMode.WORD_CHAR; 33 | text_view.hexpand = true; 34 | text_view.vexpand = true; 35 | text_view.margin = 48; 36 | 37 | text_view.key_press_event.connect (key_press_callback); 38 | text_view.move_cursor.connect (cursor_moved_callback); 39 | text_view.button_release_event.connect (editor_clicked_callback); 40 | insert_text.connect_after (text_inserted_callback); 41 | } 42 | 43 | // Get a TextTagTable with all the default tags 44 | private void setup_tagtable (Gtk.TextBuffer buffer) { 45 | buffer.create_tag ("bold", "weight", 700); 46 | buffer.create_tag ("italic", "style", Pango.Style.ITALIC); 47 | buffer.create_tag ("underline", "underline", Pango.Underline.SINGLE); 48 | buffer.create_tag ("strikethrough", "strikethrough", true); 49 | 50 | buffer.create_tag ("align-left", "justification", Gtk.Justification.LEFT); 51 | buffer.create_tag ("align-center", "justification", Gtk.Justification.CENTER); 52 | buffer.create_tag ("align-right", "justification", Gtk.Justification.RIGHT); 53 | buffer.create_tag ("align-fill", "justification", Gtk.Justification.FILL); 54 | } 55 | 56 | 57 | /* 58 | * Styles (apply, remove, check) 59 | */ 60 | 61 | public void apply_style (string name) { 62 | if (has_selection) { 63 | get_selection_range ().apply_style (name); 64 | } 65 | 66 | switch (name) { 67 | case "bold": 68 | style_bold = true; 69 | break; 70 | case "italic": 71 | style_italic = true; 72 | break; 73 | case "underline": 74 | style_underline = true; 75 | break; 76 | case "strikethrough": 77 | style_strikethrough = true; 78 | break; 79 | } 80 | } 81 | 82 | public void remove_style (string name) { 83 | if (has_selection) { 84 | get_selection_range ().remove_style (name); 85 | } 86 | 87 | switch (name) { 88 | case "bold": 89 | style_bold = false; 90 | break; 91 | case "italic": 92 | style_italic = false; 93 | break; 94 | case "underline": 95 | style_underline = false; 96 | break; 97 | case "strikethrough": 98 | style_strikethrough = false; 99 | break; 100 | } 101 | } 102 | 103 | public void toggle_style (string name) { 104 | if (has_selection) { 105 | get_selection_range ().toggle_style (name); 106 | } 107 | 108 | switch (name) { 109 | case "bold": 110 | style_bold = !style_bold; 111 | break; 112 | case "italic": 113 | style_italic = !style_italic; 114 | break; 115 | case "underline": 116 | style_underline = !style_underline; 117 | break; 118 | case "strikethrough": 119 | style_strikethrough = !style_strikethrough; 120 | break; 121 | } 122 | } 123 | 124 | public bool has_style (string name) { 125 | if (has_selection) { 126 | return get_selection_range ().has_style (name); 127 | } else { 128 | return iter_has_style (get_cursor (), name); 129 | } 130 | } 131 | 132 | 133 | public Gtk.Justification get_justification () { 134 | if (has_selection) { 135 | return get_selection_range ().get_justification (); 136 | } else { 137 | return get_justification_at_iter (get_cursor ()); 138 | } 139 | } 140 | 141 | public Gtk.Justification get_justification_at_iter (Gtk.TextIter iter) { 142 | if (iter_has_style (iter, "align-center")) { 143 | return Gtk.Justification.CENTER; 144 | } else if (iter_has_style (iter, "align-right")) { 145 | return Gtk.Justification.RIGHT; 146 | } else if (iter_has_style (iter, "align-fill")) { 147 | return Gtk.Justification.FILL; 148 | } else { 149 | return Gtk.Justification.LEFT; 150 | } 151 | } 152 | 153 | public int get_justification_as_int () { 154 | if (has_selection) { 155 | return get_selection_range ().get_justification_as_int (); 156 | } else { 157 | return get_justification_as_int_at_iter (get_cursor ()); 158 | } 159 | } 160 | 161 | public int get_justification_as_int_at_iter (Gtk.TextIter iter) { 162 | if (iter_has_style (iter, "align-center")) { 163 | return 1; 164 | } else if (iter_has_style (iter, "align-right")) { 165 | return 2; 166 | } else if (iter_has_style (iter, "align-fill")) { 167 | return 3; 168 | } else { 169 | return 0; 170 | } 171 | } 172 | 173 | public void set_justification (string align) { 174 | get_paragraph (get_cursor ()).set_justification (align); 175 | } 176 | 177 | 178 | public void set_font (Pango.FontDescription font) { 179 | get_selection_range ().set_font (font); 180 | } 181 | 182 | public void set_font_from_string (string font) { 183 | get_selection_range ().set_font_from_string (font); 184 | } 185 | 186 | 187 | public void set_font_color (Gdk.RGBA rgba) { 188 | get_selection_range ().set_font_color (rgba); 189 | } 190 | 191 | public void set_font_color_from_string (string rgba) { 192 | get_selection_range ().set_font_color_from_string (rgba); 193 | } 194 | 195 | 196 | /* 197 | * Inserts 198 | */ 199 | 200 | public void insert_comment () { 201 | print ("Insert Comment\n"); 202 | } 203 | 204 | public void insert_image () { 205 | print ("Insert Image\n"); 206 | } 207 | 208 | public void insert_link () { 209 | print ("Insert Link\n"); 210 | } 211 | 212 | public void insert_table (int cols, int rows) { 213 | print ("Insert Table of %d columns by %d rows\n", cols, rows); 214 | } 215 | 216 | 217 | public void insert_line () { 218 | Gtk.TextIter insert_cursor = get_cursor (); 219 | insert_line_at_iter (insert_cursor); 220 | } 221 | 222 | public void insert_paragraph () { 223 | Gtk.TextIter cursor = get_cursor (); 224 | insert_paragraph_at_iter (cursor); 225 | } 226 | 227 | public void insert_line_at_iter (Gtk.TextIter iter) { 228 | // TODO 229 | // Cursor does not move to next line 230 | // Only happens when inserting at the end of the buffer 231 | // Bug reported in GTK+ 232 | 233 | insert (ref iter, "\u2028", -1); 234 | } 235 | 236 | public void insert_paragraph_at_iter (Gtk.TextIter iter) { 237 | insert (ref iter, "\n", -1); 238 | } 239 | 240 | 241 | /* 242 | * Paragraphs 243 | */ 244 | 245 | // Moves iter to the start of the paragraph it is located in 246 | public Gtk.TextIter get_paragraph_start (Gtk.TextIter iter) { 247 | iter.backward_find_char ((char) => { 248 | if (char.to_string () == "\n") { 249 | return true; 250 | } else { 251 | return false; 252 | } 253 | }, null); 254 | return iter; 255 | } 256 | 257 | // Moves iter to the end of the paragraph it is located in 258 | public Gtk.TextIter get_paragraph_end (Gtk.TextIter iter) { 259 | iter.forward_find_char ((char) => { 260 | if (char.to_string () == "\n") { 261 | return true; 262 | } else { 263 | return false; 264 | } 265 | }, null); 266 | return iter; 267 | } 268 | 269 | public Writer.Utils.TextRange get_paragraph (Gtk.TextIter iter) { 270 | Gtk.TextIter start = get_paragraph_start (iter); 271 | Gtk.TextIter end = get_paragraph_end (iter); 272 | 273 | return new Writer.Utils.TextRange (this, start, end); 274 | } 275 | 276 | 277 | /* 278 | * Search 279 | */ 280 | 281 | public void search (string text) { 282 | if (text.length > 0) { 283 | search_string (text); 284 | } else { 285 | clear_search (); 286 | } 287 | } 288 | 289 | public void search_string (string text) { 290 | print ("Searching for: %s\n", text); 291 | } 292 | 293 | public void clear_search () { 294 | print ("Clearing search"); 295 | } 296 | 297 | 298 | /* 299 | * Utilities 300 | */ 301 | 302 | public Gtk.TextIter get_cursor () { 303 | Gtk.TextIter iter; 304 | get_iter_at_mark (out iter, get_insert ()); 305 | return iter; 306 | } 307 | 308 | public Writer.Utils.TextRange get_cursor_as_range () { 309 | var cursor = get_cursor (); 310 | return new Writer.Utils.TextRange (this, cursor, cursor); 311 | } 312 | 313 | public Writer.Utils.TextRange get_selection_range () { 314 | Gtk.TextIter start; Gtk.TextIter end; 315 | get_selection_bounds (out start, out end); 316 | return new Writer.Utils.TextRange (this, start, end); 317 | } 318 | 319 | public bool iter_has_tag (Gtk.TextIter iter, Gtk.TextTag tag) { 320 | return iter.has_tag (tag) || iter.starts_tag (tag) || iter.ends_tag (tag); 321 | } 322 | 323 | public bool iter_has_style (Gtk.TextIter iter, string name) { 324 | var tag = tag_table.lookup (name); 325 | return iter_has_tag (iter, tag); 326 | } 327 | 328 | public Gtk.TextIter copy_iter (Gtk.TextIter iter) { 329 | Gtk.TextIter copy; 330 | get_iter_at_offset (out copy, iter.get_offset ()); 331 | return copy; 332 | } 333 | 334 | 335 | private void update_styles () { 336 | var iter = get_cursor (); 337 | 338 | style_bold = iter_has_style (iter, "bold"); 339 | style_italic = iter_has_style (iter, "italic"); 340 | style_underline = iter_has_style (iter, "underline"); 341 | style_strikethrough = iter_has_style (iter, "strikethrough"); 342 | } 343 | 344 | 345 | /* 346 | * Signal callbacks 347 | */ 348 | 349 | private void cursor_moved_callback () { 350 | // Emit 'cursor_moved' signal 351 | update_styles (); 352 | cursor_moved (); 353 | } 354 | 355 | private void text_inserted_callback (Gtk.TextIter cursor, string new_text, int length) { 356 | Gtk.TextIter previous; 357 | get_iter_at_offset (out previous, cursor.get_offset () - length); 358 | 359 | if (style_bold) { 360 | apply_tag_by_name ("bold", previous, cursor); 361 | } 362 | if (style_italic) { 363 | apply_tag_by_name ("italic", previous, cursor); 364 | } 365 | if (style_underline) { 366 | apply_tag_by_name ("underline", previous, cursor); 367 | } 368 | if (style_strikethrough) { 369 | apply_tag_by_name ("strikethrough", previous, cursor); 370 | } 371 | 372 | // Emit signals 373 | text_inserted (); 374 | cursor_moved (); 375 | } 376 | 377 | private bool key_press_callback (Gdk.EventKey event) { 378 | if (Gdk.keyval_name (event.keyval) == "Return") { 379 | Gdk.ModifierType modifiers = Gtk.accelerator_get_default_mod_mask (); 380 | 381 | if ((event.state & modifiers) == Gdk.ModifierType.SHIFT_MASK) { 382 | insert_line (); 383 | } else { 384 | insert_paragraph (); 385 | } 386 | 387 | return true; 388 | } else { 389 | return false; 390 | } 391 | } 392 | 393 | private bool editor_clicked_callback (Gdk.EventButton event) { 394 | update_styles (); 395 | cursor_moved (); 396 | 397 | return false; 398 | } 399 | } 400 | -------------------------------------------------------------------------------- /src/Utils/TextRange.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2020 Writer Developers 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | public class Writer.Utils.TextRange : Object { 19 | public Gtk.TextBuffer buffer { get; construct; } 20 | public Gtk.TextIter start { get; construct; } 21 | public Gtk.TextIter end { get; construct; } 22 | private int start_offset; 23 | private int end_offset; 24 | 25 | public TextRange (Gtk.TextBuffer buffer, Gtk.TextIter start, Gtk.TextIter end) { 26 | Object ( 27 | buffer: buffer, 28 | start: start, 29 | end: end 30 | ); 31 | } 32 | 33 | construct { 34 | start_offset = start.get_offset (); 35 | end_offset = end.get_offset (); 36 | } 37 | 38 | 39 | /* 40 | * Style and Tag checks 41 | * ==================== 42 | */ 43 | 44 | // Check if every Iter in the range has the given tag 45 | private bool has_tag (Gtk.TextTag tag) { 46 | Gtk.TextIter temp; 47 | for (int i = start_offset; i < end_offset; i++) { 48 | temp = get_iter_at_offset (i); 49 | 50 | if (! temp.has_tag (tag)) { 51 | return false; 52 | } 53 | } 54 | 55 | return true; 56 | } 57 | 58 | public bool has_style (string name) { 59 | var tag = buffer.tag_table.lookup (name); 60 | return has_tag (tag); 61 | } 62 | 63 | // Check if at least one Iter in the range has the given tag 64 | private bool contains_tag (Gtk.TextTag tag) { 65 | Gtk.TextIter temp; 66 | for (int i = start_offset; i < end_offset; i++) { 67 | temp = get_iter_at_offset (i); 68 | 69 | if (temp.has_tag (tag)) { 70 | return true; 71 | } 72 | } 73 | 74 | return false; 75 | } 76 | 77 | public bool contains_style (string name) { 78 | var tag = buffer.tag_table.lookup (name); 79 | return contains_tag (tag); 80 | } 81 | 82 | // Check if the range wraps the given tag, i.e. if the tag begins and ends within the range 83 | private bool wraps_tag (Gtk.TextTag tag) { 84 | if ( (!start.has_tag (tag) || start.starts_tag (tag)) && 85 | (!end.has_tag (tag) || end.ends_tag (tag)) && 86 | (contains_tag (tag))) { 87 | return true; 88 | } else { 89 | return false; 90 | } 91 | } 92 | 93 | public bool wraps_style (string name) { 94 | var tag = buffer.tag_table.lookup (name); 95 | return wraps_tag (tag); 96 | } 97 | 98 | // Check if the range wraps the given tag exactly, i.e. if the tag begins and ends at the bounds of the range 99 | private bool wraps_tag_exact (Gtk.TextTag tag) { 100 | var range = new TextRange (buffer, 101 | get_iter_at_offset (start_offset + 1), 102 | get_iter_at_offset (end_offset - 1)); 103 | 104 | if ( (!start.has_tag (tag) || start.starts_tag (tag)) && 105 | (!end.has_tag (tag) || end.ends_tag (tag)) && 106 | (range.has_tag (tag)) 107 | ) { 108 | return true; 109 | } else { 110 | return false; 111 | } 112 | } 113 | 114 | public bool wraps_style_exact (string name) { 115 | var tag = buffer.tag_table.lookup (name); 116 | return wraps_tag_exact (tag); 117 | } 118 | 119 | 120 | // Check if the range wraps the tag, with the bounds beginning and ending the tag 121 | private bool wraps_tag_with_bounds (Gtk.TextTag tag) { 122 | if ( (start.starts_tag (tag)) && 123 | (end.ends_tag (tag)) && 124 | (has_tag (tag)) 125 | ) { 126 | return true; 127 | } else { 128 | return false; 129 | } 130 | } 131 | 132 | public bool wraps_style_with_bounds (string name) { 133 | var tag = buffer.tag_table.lookup (name); 134 | return wraps_tag_with_bounds (tag); 135 | } 136 | 137 | // Check if the range wraps the tag, with the offset next to start beginning the tag, 138 | // and the offset preceding end ending the tag 139 | private bool wraps_tag_without_bounds (Gtk.TextTag tag) { 140 | var range = new TextRange (buffer, 141 | get_iter_at_offset (start_offset + 1), 142 | get_iter_at_offset (end_offset - 1)); 143 | 144 | if ( (!start.has_tag (tag)) && 145 | (!end.has_tag (tag)) && 146 | (range.has_tag (tag)) 147 | ) { 148 | return true; 149 | } else { 150 | return false; 151 | } 152 | } 153 | 154 | public bool wraps_style_without_bounds (string name) { 155 | var tag = buffer.tag_table.lookup (name); 156 | return wraps_tag_without_bounds (tag); 157 | } 158 | 159 | 160 | /* 161 | * Apply/Remove Tags/Styles 162 | * ======================== 163 | */ 164 | 165 | private void apply_tag (Gtk.TextTag tag) { 166 | buffer.apply_tag (tag, start, end); 167 | } 168 | 169 | public void apply_style (string name) { 170 | var tag = buffer.tag_table.lookup (name); 171 | apply_tag (tag); 172 | } 173 | 174 | private void remove_tag (Gtk.TextTag tag) { 175 | buffer.remove_tag (tag, start, end); 176 | } 177 | 178 | public void remove_style (string name) { 179 | var tag = buffer.tag_table.lookup (name); 180 | remove_tag (tag); 181 | } 182 | 183 | public void toggle_tag (Gtk.TextTag tag) { 184 | if (has_tag (tag)) { 185 | remove_tag (tag); 186 | } else { 187 | apply_tag (tag); 188 | } 189 | } 190 | 191 | public void toggle_style (string name) { 192 | if (has_style (name)) { 193 | remove_style (name); 194 | } else { 195 | apply_style (name); 196 | } 197 | } 198 | 199 | 200 | /* 201 | * Justification 202 | * ============= 203 | */ 204 | 205 | public Gtk.Justification get_justification () { 206 | if (has_style ("align-center")) { 207 | return Gtk.Justification.CENTER; 208 | } else if (has_style ("align-right")) { 209 | return Gtk.Justification.RIGHT; 210 | } else if (has_style ("align-fill")) { 211 | return Gtk.Justification.FILL; 212 | } else { 213 | return Gtk.Justification.LEFT; 214 | } 215 | } 216 | 217 | public int get_justification_as_int () { 218 | if (has_style ("align-center")) { 219 | return 1; 220 | } else if (has_style ("align-right")) { 221 | return 2; 222 | } else if (has_style ("align-fill")) { 223 | return 3; 224 | } else { 225 | return 0; 226 | } 227 | } 228 | 229 | public void set_justification (string align) { 230 | remove_style ("align-left"); 231 | remove_style ("align-center"); 232 | remove_style ("align-right"); 233 | remove_style ("align-fill"); 234 | 235 | apply_style ("align-" + align); 236 | } 237 | 238 | 239 | /* 240 | * Fonts 241 | * ===== 242 | */ 243 | 244 | public void set_font (Pango.FontDescription font) { 245 | var font_name = font.to_string (); 246 | set_font_from_string (font_name); 247 | } 248 | 249 | public void set_font_from_string (string font) { 250 | if (buffer.tag_table.lookup (font) == null) { 251 | buffer.create_tag (font, "font", font); 252 | } 253 | 254 | apply_style (font); 255 | } 256 | 257 | public void set_font_color (Gdk.RGBA rgba) { 258 | var name = rgba.to_string (); 259 | set_font_color_from_string (name); 260 | } 261 | 262 | public void set_font_color_from_string (string rgba) { 263 | if (buffer.tag_table.lookup (rgba) == null) { 264 | buffer.create_tag (rgba, "foreground", rgba); 265 | } 266 | 267 | apply_style (rgba); 268 | } 269 | 270 | 271 | /* 272 | * Utilities 273 | */ 274 | 275 | public Gtk.TextIter get_iter_at_offset (int offset) { 276 | Gtk.TextIter iter; 277 | buffer.get_iter_at_offset (out iter, offset); 278 | return iter; 279 | } 280 | } 281 | -------------------------------------------------------------------------------- /src/Views/EditorView.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2020 Writer Developers 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | * 17 | * The way to show writing area as a page is inspired from 18 | * https://github.com/aggalex/OfficeWorks-Author/blob/master/src/views/EditView.vala 19 | */ 20 | 21 | public class Writer.Views.EditorView : Gtk.Box { 22 | public TextEditor editor { get; construct; } 23 | public Gtk.Grid document_view { get; private set; } 24 | public Gtk.Grid document_view_wrapper { get; private set; } 25 | public Widgets.ActionBar action_bar { get; private set; } 26 | 27 | public EditorView (TextEditor editor) { 28 | Object ( 29 | orientation: Gtk.Orientation.VERTICAL, 30 | spacing: 0, 31 | editor: editor 32 | ); 33 | } 34 | 35 | construct { 36 | var toolbar = new Widgets.ToolBar (editor); 37 | 38 | document_view = new Gtk.Grid (); 39 | document_view.get_style_context ().add_class ("page-decoration"); 40 | document_view.margin = 24; 41 | // Set document_view size to A4 size 42 | document_view.height_request = 1123; 43 | document_view.width_request = 794; 44 | document_view.add (editor.text_view); 45 | 46 | document_view_wrapper = new Gtk.Grid (); 47 | document_view_wrapper.halign = Gtk.Align.CENTER; 48 | document_view_wrapper.valign = Gtk.Align.CENTER; 49 | document_view_wrapper.add (document_view); 50 | 51 | var scrolled_window = new Gtk.ScrolledWindow (null, null); 52 | scrolled_window.add (document_view_wrapper); 53 | 54 | action_bar = new Widgets.ActionBar (editor); 55 | 56 | pack_end (action_bar, false, false, 0); 57 | pack_start (toolbar, false, false, 0); 58 | pack_start (scrolled_window, true, true, 0); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/Views/WelcomeView.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2020 Writer Developers 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | public class Writer.Views.WelcomeView : Granite.Widgets.Welcome { 19 | public Application app { get; construct; } 20 | 21 | public WelcomeView (Application app) { 22 | Object ( 23 | title: _("No Documents Open"), 24 | subtitle: _("Open a document to begin editing."), 25 | app: app 26 | ); 27 | } 28 | 29 | construct { 30 | append ("document-new", _("New File"), _("Create a new document.")); 31 | append ("document-open", _("Open File"), _("Open a saved document.")); 32 | 33 | activated.connect ((index) => { 34 | // TODO 35 | // Open recent 36 | if (index == 0) { 37 | app.new_file (); 38 | } else { 39 | app.open_file_dialog (); 40 | } 41 | }); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Widgets/ActionBar.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2020 Writer Developers 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | public class Writer.Widgets.ActionBar : Gtk.ActionBar { 19 | public TextEditor editor { get; construct; } 20 | private Gtk.Label char_count_label; 21 | 22 | public ActionBar (TextEditor editor) { 23 | Object ( 24 | editor: editor 25 | ); 26 | } 27 | 28 | construct { 29 | char_count_label = new Gtk.Label (null); 30 | 31 | update_char_count (); 32 | 33 | pack_end (char_count_label); 34 | 35 | editor.changed.connect (() => { 36 | Idle.add (() => { 37 | update_char_count (); 38 | }); 39 | }); 40 | } 41 | 42 | public void update_char_count () { 43 | string text_to_count = editor.text; 44 | 45 | if (Application.settings.get_boolean ("count-include-spaces")) { 46 | int char_count_with_spaces = text_to_count.char_count (); 47 | char_count_label.label = ngettext ("%d character with spaces", "%d characters with spaces", char_count_with_spaces).printf (char_count_with_spaces); 48 | } else { 49 | int char_count_without_spaces = 0; 50 | MatchInfo match_info; 51 | 52 | try { 53 | var regex = new Regex ("\\S"); 54 | for (regex.match (text_to_count, 0, out match_info); match_info.matches (); match_info.next ()) { 55 | char_count_without_spaces++; 56 | } 57 | } catch (RegexError err) { 58 | warning (err.message); 59 | } 60 | 61 | char_count_label.label = ngettext ("%d character without spaces", "%d characters without spaces", char_count_without_spaces).printf (char_count_without_spaces); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/Widgets/Choosers/TableChooser.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2020 Writer Developers 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | public class Writer.Widgets.TableChooser : Gtk.Grid { 19 | public int columns; 20 | public int rows; 21 | 22 | public signal void selected (int columns, int rows); 23 | 24 | public TableChooser () { 25 | Object ( 26 | column_spacing: 6, 27 | row_spacing: 4 28 | ); 29 | } 30 | 31 | construct { 32 | var cols_spin = new Gtk.SpinButton.with_range (1, 10, 1); 33 | var rows_spin = new Gtk.SpinButton.with_range (1, 10, 1); 34 | 35 | var insert_button = new Gtk.Button.with_label (_("Insert Table")); 36 | 37 | var main_label = new Gtk.Label (_("Table")); 38 | main_label.xalign = 0; 39 | var cols_label = new Gtk.Label (_("Columns:")); 40 | cols_label.xalign = 0; 41 | var rows_label = new Gtk.Label (_("Rows:")); 42 | rows_label.xalign = 0; 43 | 44 | attach (main_label, 0, 0, 2, 1); 45 | attach (cols_label, 0, 1, 1, 1); 46 | attach (cols_spin, 1, 1, 1, 1); 47 | attach (rows_label, 0, 2, 1, 1); 48 | attach (rows_spin, 1, 2, 1, 1); 49 | attach (insert_button, 0, 3, 2, 1); 50 | 51 | insert_button.clicked.connect (() => { 52 | columns = cols_spin.get_value_as_int (); 53 | rows = rows_spin.get_value_as_int (); 54 | selected (columns, rows); 55 | }); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/Widgets/PreferenceDialog.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2020 Writer Developers 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | public class Writer.Widgets.PreferenceDialog : Granite.Dialog { 19 | public MainWindow window { get; construct; } 20 | 21 | public PreferenceDialog (MainWindow parent) { 22 | Object ( 23 | window: parent, 24 | transient_for: parent, 25 | resizable: false, 26 | modal: true, 27 | title: _("Preferences"), 28 | window_position: Gtk.WindowPosition.CENTER_ON_PARENT 29 | ); 30 | } 31 | 32 | construct { 33 | var destination_label = new Gtk.Label (_("Document folder location:")); 34 | destination_label.halign = Gtk.Align.END; 35 | 36 | var destination_chooser_button = new Gtk.FileChooserButton ( 37 | _("Select Document Folder…"), 38 | Gtk.FileChooserAction.SELECT_FOLDER 39 | ); 40 | destination_chooser_button.halign = Gtk.Align.START; 41 | destination_chooser_button.set_current_folder (Application.settings.get_string ("destination")); 42 | 43 | var count_include_spaces_label = new Gtk.Label (_("Include spaces to count characters:")); 44 | count_include_spaces_label.halign = Gtk.Align.END; 45 | 46 | var count_include_spaces_switch = new Gtk.Switch (); 47 | count_include_spaces_switch.halign = Gtk.Align.START; 48 | count_include_spaces_switch.state_flags_changed.connect (() => { 49 | window.editor_view.action_bar.update_char_count (); 50 | }); 51 | 52 | var main_grid = new Gtk.Grid (); 53 | main_grid.margin = 12; 54 | main_grid.column_spacing = 6; 55 | main_grid.row_spacing = 6; 56 | main_grid.attach (destination_label, 0, 0, 1, 1); 57 | main_grid.attach (destination_chooser_button, 1, 0, 1, 1); 58 | main_grid.attach (count_include_spaces_label, 0, 1, 1, 1); 59 | main_grid.attach (count_include_spaces_switch, 1, 1, 1, 1); 60 | 61 | var content = (Gtk.Box) get_content_area (); 62 | content.add (main_grid); 63 | 64 | var close_button = add_button (_("Close"), Gtk.ResponseType.CLOSE); 65 | ((Gtk.Button) close_button).clicked.connect (() => destroy ()); 66 | 67 | destination_chooser_button.file_set.connect (() => { 68 | Application.settings.set_string ("destination", destination_chooser_button.get_filename ()); 69 | }); 70 | 71 | Application.settings.bind ("count-include-spaces", count_include_spaces_switch, "active", SettingsBindFlags.DEFAULT); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/Widgets/TitleBar.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2020 Writer Developers 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | public class Writer.Widgets.TitleBar : Gtk.HeaderBar { 19 | public Application app { get; construct; } 20 | private Gtk.Button open_button; 21 | private Gtk.Button save_as_button; 22 | private Gtk.Button revert_button; 23 | private Gtk.Button print_button; 24 | private Gtk.SearchEntry search_field; 25 | private Gtk.Button undo_button; 26 | private Gtk.Button redo_button; 27 | 28 | public TitleBar (Application app) { 29 | Object ( 30 | app: app, 31 | title: _("Writer"), 32 | show_close_button: true 33 | ); 34 | } 35 | 36 | construct { 37 | open_button = new Gtk.Button.from_icon_name ("document-open", Gtk.IconSize.LARGE_TOOLBAR); 38 | open_button.tooltip_markup = Granite.markup_accel_tooltip ({"O"}, _("Open a file")); 39 | 40 | save_as_button = new Gtk.Button.from_icon_name ("document-save-as", Gtk.IconSize.LARGE_TOOLBAR); 41 | save_as_button.tooltip_markup = Granite.markup_accel_tooltip ({"S"}, _("Save this file with a different name")); 42 | 43 | revert_button = new Gtk.Button.from_icon_name ("document-revert", Gtk.IconSize.LARGE_TOOLBAR); 44 | revert_button.tooltip_markup = Granite.markup_accel_tooltip ({"O"}, _("Restore this file")); 45 | 46 | print_button = new Gtk.Button.from_icon_name ("document-export", Gtk.IconSize.LARGE_TOOLBAR); 47 | print_button.tooltip_markup = Granite.markup_accel_tooltip ({"P"}, _("Print this file")); 48 | 49 | search_field = new Gtk.SearchEntry (); 50 | search_field.valign = Gtk.Align.CENTER; 51 | search_field.placeholder_text = _("Find"); 52 | search_field.search_changed.connect (() => { 53 | app.search (search_field.text); 54 | }); 55 | 56 | undo_button = new Gtk.Button.from_icon_name ("edit-undo", Gtk.IconSize.LARGE_TOOLBAR); 57 | undo_button.tooltip_markup = Granite.markup_accel_tooltip ({"Z"}, _("Undo")); 58 | 59 | redo_button = new Gtk.Button.from_icon_name ("edit-redo", Gtk.IconSize.LARGE_TOOLBAR); 60 | redo_button.tooltip_markup = Granite.markup_accel_tooltip ({"Z"}, _("Redo")); 61 | 62 | var preferences_item = new Gtk.MenuItem.with_label (_("Preferences")); 63 | var app_menu_menu = new Gtk.Menu (); 64 | app_menu_menu.add (preferences_item); 65 | var app_menu = new Gtk.MenuButton (); 66 | app_menu.set_popup (app_menu_menu); 67 | app_menu.set_image (new Gtk.Image.from_icon_name ("open-menu", Gtk.IconSize.LARGE_TOOLBAR)); 68 | app_menu.tooltip_text = _("Preferences"); 69 | app_menu_menu.show_all (); 70 | 71 | pack_start (open_button); 72 | pack_start (save_as_button); 73 | pack_start (revert_button); 74 | pack_end (print_button); 75 | pack_end (app_menu); 76 | pack_end (redo_button); 77 | pack_end (undo_button); 78 | pack_end (search_field); 79 | 80 | open_button.clicked.connect (app.open_file_dialog); 81 | save_as_button.clicked.connect (app.save_as); 82 | revert_button.clicked.connect (() => { 83 | revert_button.sensitive = !app.revert (); 84 | }); 85 | print_button.clicked.connect (app.print_file); 86 | undo_button.clicked.connect (app.undo); 87 | redo_button.clicked.connect (app.redo); 88 | 89 | preferences_item.activate.connect (app.preferences); 90 | 91 | app.editor.changed.connect (() => { 92 | if (!revert_button.sensitive) { 93 | revert_button.sensitive = true; 94 | } 95 | }); 96 | } 97 | 98 | public void set_active (bool active) { 99 | save_as_button.sensitive = active; 100 | revert_button.sensitive = false; 101 | print_button.sensitive = active; 102 | undo_button.sensitive = active; 103 | redo_button.sensitive = active; 104 | search_field.sensitive = active; 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src/Widgets/ToolBar.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2020 Writer Developers 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | public class Writer.Widgets.ToolBar : Gtk.Stack { 19 | public TextEditor editor { get; construct; } 20 | 21 | public ToolBar (TextEditor editor) { 22 | Object ( 23 | editor: editor, 24 | transition_type: Gtk.StackTransitionType.NONE 25 | ); 26 | } 27 | 28 | construct { 29 | var text_toolbar = new TextToolBar (editor); 30 | var image_toolbar = new ImageToolBar (editor); 31 | var table_toolbar = new TableToolBar (editor); 32 | 33 | add_named (text_toolbar, "text"); 34 | add_named (image_toolbar, "image"); 35 | add_named (table_toolbar, "table"); 36 | } 37 | 38 | public void show_text_toolbar () { 39 | visible_child_name = "text"; 40 | } 41 | 42 | public void show_image_toolbar () { 43 | visible_child_name = "image"; 44 | } 45 | 46 | public void show_table_toolbar () { 47 | visible_child_name = "table"; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Widgets/ToolBars/ImageToolBar.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2020 Writer Developers 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | public class Writer.Widgets.ImageToolBar : Gtk.Grid { 19 | public TextEditor editor { get; construct; } 20 | 21 | public ImageToolBar (TextEditor editor) { 22 | Object ( 23 | editor: editor 24 | ); 25 | } 26 | 27 | construct { 28 | get_style_context ().add_class ("writer-toolbar"); 29 | get_style_context ().add_class ("frame"); 30 | 31 | var wrap_combobox = new Gtk.ComboBoxText (); 32 | wrap_combobox.margin = 12; 33 | wrap_combobox.margin_end = 6; 34 | wrap_combobox.append ("in-line", _("In line of text")); 35 | wrap_combobox.append ("float", _("Float above text")); 36 | wrap_combobox.set_active_id ("in-line"); 37 | wrap_combobox.tooltip_text = _("Set how to wrap text"); 38 | 39 | var lock_aspect_check = new Gtk.CheckButton.with_label (_("Lock aspect ratio")); 40 | lock_aspect_check.margin = 12; 41 | lock_aspect_check.margin_start = 6; 42 | lock_aspect_check.margin_end = 6; 43 | lock_aspect_check.tooltip_text = _("Allow to resize images without changing aspect ratio"); 44 | 45 | var align_button = new Granite.Widgets.ModeButton (); 46 | align_button.margin = 12; 47 | align_button.margin_start = 6; 48 | align_button.margin_end = 6; 49 | align_button.append (new ToolBarImage ("format-justify-left-symbolic", _("Align image left"))); 50 | align_button.append (new ToolBarImage ("format-justify-center-symbolic", _("Center image"))); 51 | align_button.append (new ToolBarImage ("format-justify-right-symbolic", _("Align image right"))); 52 | 53 | var edit_image_button = new Gtk.Button.with_label (_("Crop")); 54 | edit_image_button.margin = 12; 55 | edit_image_button.margin_start = 6; 56 | edit_image_button.margin_end = 6; 57 | edit_image_button.tooltip_text = _("Remove unnecessary part of image"); 58 | 59 | var delete_image_button = new Gtk.Button.with_label (_("Delete Image")); 60 | delete_image_button.margin = 12; 61 | delete_image_button.margin_start = 6; 62 | delete_image_button.get_style_context ().add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION); 63 | delete_image_button.tooltip_text = _("Delete selected image"); 64 | 65 | attach (wrap_combobox, 0, 0, 1, 1); 66 | attach (lock_aspect_check, 1, 0, 1, 1); 67 | attach (align_button, 2, 0, 1, 1); 68 | attach (edit_image_button, 3, 0, 1, 1); 69 | attach (delete_image_button, 4, 0, 1, 1); 70 | 71 | align_button.mode_changed.connect (() => { 72 | change_align (align_button.selected); 73 | }); 74 | } 75 | 76 | private void change_align (int index) { 77 | switch (index) { 78 | case 1: 79 | editor.set_justification ("center"); 80 | break; 81 | case 2: 82 | editor.set_justification ("right"); 83 | break; 84 | default: 85 | editor.set_justification ("left"); 86 | break; 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/Widgets/ToolBars/TableToolBar.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2020 Writer Developers 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | public class Writer.Widgets.TableToolBar : Gtk.Grid { 19 | public TextEditor editor { get; construct; } 20 | 21 | public TableToolBar (TextEditor editor) { 22 | Object ( 23 | editor: editor 24 | ); 25 | } 26 | 27 | construct { 28 | get_style_context ().add_class ("writer-toolbar"); 29 | get_style_context ().add_class ("frame"); 30 | 31 | var table_properties_button = new Gtk.Button.with_label (_("Table Properties")); 32 | table_properties_button.margin = 12; 33 | table_properties_button.margin_end = 6; 34 | table_properties_button.tooltip_text = _("Set properties of selected table"); 35 | 36 | var font_button = new Gtk.FontButton (); 37 | font_button.margin = 12; 38 | font_button.margin_start = 6; 39 | font_button.margin_end = 6; 40 | font_button.use_font = true; 41 | font_button.use_size = true; 42 | font_button.tooltip_text = _("Choose font family and font size"); 43 | 44 | var font_color_button = new Gtk.ColorButton (); 45 | font_color_button.margin = 12; 46 | font_color_button.margin_start = 6; 47 | font_color_button.margin_end = 6; 48 | font_color_button.use_alpha = false; 49 | font_color_button.tooltip_text = _("Choose font color"); 50 | 51 | var bold_button = new Gtk.ToggleButton (); 52 | bold_button.add (new ToolBarImage ("format-text-bold-symbolic", _("Toggle bold"), "B")); 53 | bold_button.focus_on_click = false; 54 | 55 | var italic_button = new Gtk.ToggleButton (); 56 | italic_button.add (new ToolBarImage ("format-text-italic-symbolic", _("Toggle italic"), "I")); 57 | italic_button.focus_on_click = false; 58 | 59 | var underline_button = new Gtk.ToggleButton (); 60 | underline_button.add (new ToolBarImage ("format-text-underline-symbolic", _("Toggle underline"), "U")); 61 | underline_button.focus_on_click = false; 62 | 63 | var strikethrough_button = new Gtk.ToggleButton (); 64 | strikethrough_button.add (new ToolBarImage ("format-text-strikethrough-symbolic", _("Toggle strikethrough"), "H")); 65 | strikethrough_button.focus_on_click = false; 66 | 67 | var styles_buttons = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); 68 | styles_buttons.margin = 12; 69 | styles_buttons.margin_start = 6; 70 | styles_buttons.margin_end = 6; 71 | styles_buttons.get_style_context ().add_class (Gtk.STYLE_CLASS_LINKED); 72 | styles_buttons.pack_start (bold_button); 73 | styles_buttons.pack_start (italic_button); 74 | styles_buttons.pack_start (underline_button); 75 | styles_buttons.pack_start (strikethrough_button); 76 | 77 | var align_button = new Granite.Widgets.ModeButton (); 78 | align_button.margin = 12; 79 | align_button.margin_start = 6; 80 | align_button.margin_end = 6; 81 | align_button.append (new ToolBarImage ("format-justify-left-symbolic", _("Align table left"))); 82 | align_button.append (new ToolBarImage ("format-justify-center-symbolic", _("Center table"))); 83 | align_button.append (new ToolBarImage ("format-justify-right-symbolic", _("Align table right"))); 84 | align_button.append (new ToolBarImage ("format-justify-fill-symbolic", _("Justify table"))); 85 | 86 | var add_table_button = new Gtk.Button.with_label (_("Add")); 87 | add_table_button.margin = 12; 88 | add_table_button.margin_start = 6; 89 | add_table_button.margin_end = 6; 90 | add_table_button.tooltip_text = _("Add a new table"); 91 | 92 | var delete_table_button = new Gtk.Button.with_label (_("Delete")); 93 | delete_table_button.margin = 12; 94 | delete_table_button.margin_start = 6; 95 | delete_table_button.get_style_context ().add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION); 96 | delete_table_button.tooltip_text = _("Delete selected table"); 97 | 98 | attach (table_properties_button, 0, 0, 1, 1); 99 | attach (font_button, 1, 0, 1, 1); 100 | attach (font_color_button, 2, 0, 1, 1); 101 | attach (styles_buttons, 3, 0, 1, 1); 102 | attach (align_button, 4, 0, 1, 1); 103 | attach (add_table_button, 5, 0, 1, 1); 104 | attach (delete_table_button, 6, 0, 1, 1); 105 | 106 | font_button.font_set.connect (() => { 107 | string name = font_button.font; 108 | stdout.printf ("Selected font: %s\n", name); 109 | }); 110 | 111 | align_button.mode_changed.connect (() => { 112 | change_align (align_button.selected); 113 | }); 114 | 115 | bold_button.button_press_event.connect ((event) => { 116 | if (event.type == Gdk.EventType.BUTTON_PRESS) { 117 | editor.toggle_style ("bold"); 118 | } 119 | 120 | return false; 121 | }); 122 | 123 | italic_button.button_press_event.connect ((event) => { 124 | if (event.type == Gdk.EventType.BUTTON_PRESS) { 125 | editor.toggle_style ("italic"); 126 | } 127 | 128 | return false; 129 | }); 130 | 131 | underline_button.button_press_event.connect ((event) => { 132 | if (event.type == Gdk.EventType.BUTTON_PRESS) { 133 | editor.toggle_style ("underline"); 134 | } 135 | 136 | return false; 137 | }); 138 | 139 | strikethrough_button.button_press_event.connect ((event) => { 140 | if (event.type == Gdk.EventType.BUTTON_PRESS) { 141 | editor.toggle_style ("strikethrough"); 142 | } 143 | 144 | return false; 145 | }); 146 | } 147 | 148 | private void change_align (int index) { 149 | switch (index) { 150 | case 1: 151 | editor.set_justification ("center"); 152 | break; 153 | case 2: 154 | editor.set_justification ("right"); 155 | break; 156 | case 3: 157 | editor.set_justification ("fill"); 158 | break; 159 | default: 160 | editor.set_justification ("left"); 161 | break; 162 | } 163 | } 164 | } 165 | -------------------------------------------------------------------------------- /src/Widgets/ToolBars/TextToolBar.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2020 Writer Developers 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | public class Writer.Widgets.TextToolBar : Gtk.Grid { 19 | public TextEditor editor { get; construct; } 20 | private Gtk.ToggleButton bold_button; 21 | private Gtk.ToggleButton italic_button; 22 | private Gtk.ToggleButton underline_button; 23 | private Gtk.ToggleButton strikethrough_button; 24 | private Gtk.Button indent_more_button; 25 | private Gtk.Button indent_less_button; 26 | public Granite.Widgets.ModeButton align_button; 27 | 28 | public TextToolBar (TextEditor editor) { 29 | Object ( 30 | editor: editor 31 | ); 32 | } 33 | 34 | construct { 35 | get_style_context ().add_class ("writer-toolbar"); 36 | get_style_context ().add_class ("frame"); 37 | 38 | editor.cursor_moved.connect (cursor_moved); 39 | 40 | var paragraph_combobox = new Gtk.ComboBoxText (); 41 | paragraph_combobox.margin = 12; 42 | paragraph_combobox.margin_end = 6; 43 | paragraph_combobox.append ("paragraph", _("Paragraph")); 44 | paragraph_combobox.append ("title", _("Title")); 45 | paragraph_combobox.append ("subtitle", _("Subtitle")); 46 | paragraph_combobox.append ("bullet-list", _("Bullet List")); 47 | paragraph_combobox.append ("numbered-List", _("Numbered List")); 48 | paragraph_combobox.append ("two-column", _("Two-Column")); 49 | paragraph_combobox.set_active_id ("paragraph"); 50 | paragraph_combobox.tooltip_text = _("Set text style"); 51 | 52 | var font_button = new Gtk.FontButton (); 53 | font_button.margin = 12; 54 | font_button.margin_start = 6; 55 | font_button.margin_end = 6; 56 | font_button.use_font = true; 57 | font_button.use_size = true; 58 | font_button.tooltip_text = _("Choose font family and font size"); 59 | 60 | var font_color_button = new Gtk.ColorButton (); 61 | font_color_button.margin = 12; 62 | font_color_button.margin_start = 6; 63 | font_color_button.margin_end = 6; 64 | font_color_button.use_alpha = false; 65 | font_color_button.tooltip_text = _("Choose font color"); 66 | 67 | bold_button = new Gtk.ToggleButton (); 68 | bold_button.add (new ToolBarImage ("format-text-bold-symbolic", _("Toggle bold"), "B")); 69 | bold_button.focus_on_click = false; 70 | 71 | italic_button = new Gtk.ToggleButton (); 72 | italic_button.add (new ToolBarImage ("format-text-italic-symbolic", _("Toggle italic"), "I")); 73 | italic_button.focus_on_click = false; 74 | 75 | underline_button = new Gtk.ToggleButton (); 76 | underline_button.add (new ToolBarImage ("format-text-underline-symbolic", _("Toggle underline"), "U")); 77 | underline_button.focus_on_click = false; 78 | 79 | strikethrough_button = new Gtk.ToggleButton (); 80 | strikethrough_button.add (new ToolBarImage ("format-text-strikethrough-symbolic", _("Toggle strikethrough"), "H")); 81 | strikethrough_button.focus_on_click = false; 82 | 83 | var styles_buttons = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); 84 | styles_buttons.margin = 12; 85 | styles_buttons.margin_start = 6; 86 | styles_buttons.margin_end = 6; 87 | styles_buttons.get_style_context ().add_class (Gtk.STYLE_CLASS_LINKED); 88 | styles_buttons.pack_start (bold_button); 89 | styles_buttons.pack_start (italic_button); 90 | styles_buttons.pack_start (underline_button); 91 | styles_buttons.pack_start (strikethrough_button); 92 | 93 | align_button = new Granite.Widgets.ModeButton (); 94 | align_button.margin = 12; 95 | align_button.margin_start = 6; 96 | align_button.margin_end = 6; 97 | align_button.append (new ToolBarImage ("format-justify-left-symbolic", _("Align text left"))); 98 | align_button.append (new ToolBarImage ("format-justify-center-symbolic", _("Center text"))); 99 | align_button.append (new ToolBarImage ("format-justify-right-symbolic", _("Align text right"))); 100 | align_button.append (new ToolBarImage ("format-justify-fill-symbolic", _("Justify text"))); 101 | 102 | indent_more_button = new Gtk.Button.from_icon_name ("format-indent-more-symbolic", Gtk.IconSize.BUTTON); 103 | indent_more_button.tooltip_text = _("Increase indent"); 104 | indent_less_button = new Gtk.Button.from_icon_name ("format-indent-less-symbolic", Gtk.IconSize.BUTTON); 105 | indent_less_button.tooltip_text = _("Decrease indent"); 106 | var indent_button = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); 107 | indent_button.margin = 12; 108 | indent_button.margin_start = 6; 109 | indent_button.margin_end = 6; 110 | indent_button.get_style_context ().add_class (Gtk.STYLE_CLASS_LINKED); 111 | indent_button.add (indent_more_button); 112 | indent_button.add (indent_less_button); 113 | 114 | var insert_comment_button = new Gtk.Button.from_icon_name ("insert-text-symbolic", Gtk.IconSize.BUTTON); 115 | insert_comment_button.tooltip_text = _("Insert text"); 116 | var insert_link_button = new Gtk.Button.from_icon_name ("insert-link-symbolic", Gtk.IconSize.BUTTON); 117 | insert_link_button.tooltip_text = _("Insert link"); 118 | var insert_image_button = new Gtk.Button.from_icon_name ("insert-image-symbolic", Gtk.IconSize.BUTTON); 119 | insert_image_button.tooltip_text = _("Insert image"); 120 | var insert_table_button = new Gtk.Button.from_icon_name ("insert-object-symbolic", Gtk.IconSize.BUTTON); 121 | insert_table_button.tooltip_text = _("Insert table"); 122 | var insert_button = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); 123 | insert_button.margin = 12; 124 | insert_button.margin_start = 6; 125 | insert_button.get_style_context ().add_class (Gtk.STYLE_CLASS_LINKED); 126 | insert_button.add (insert_comment_button); 127 | insert_button.add (insert_link_button); 128 | insert_button.add (insert_image_button); 129 | insert_button.add (insert_table_button); 130 | 131 | attach (paragraph_combobox, 0, 0, 1, 1); 132 | attach (font_button, 1, 0, 1, 1); 133 | attach (font_color_button, 2, 0, 1, 1); 134 | attach (styles_buttons, 3, 0, 1, 1); 135 | attach (align_button, 4, 0, 1, 1); 136 | attach (indent_button, 5, 0, 1, 1); 137 | attach (insert_button, 6, 0, 1, 1); 138 | 139 | align_button.mode_changed.connect (() => { 140 | change_align (align_button.selected); 141 | }); 142 | 143 | font_button.font_set.connect (() => { 144 | editor.set_font_from_string (font_button.font); 145 | }); 146 | 147 | font_color_button.color_set.connect (() => { 148 | var rgba = Gdk.RGBA (); 149 | rgba = font_color_button.rgba; 150 | editor.set_font_color (rgba); 151 | }); 152 | 153 | bold_button.button_press_event.connect ((event) => { 154 | if (event.type == Gdk.EventType.BUTTON_PRESS) { 155 | editor.toggle_style ("bold"); 156 | } 157 | 158 | return false; 159 | }); 160 | 161 | italic_button.button_press_event.connect ((event) => { 162 | if (event.type == Gdk.EventType.BUTTON_PRESS) { 163 | editor.toggle_style ("italic"); 164 | } 165 | 166 | return false; 167 | }); 168 | 169 | underline_button.button_press_event.connect ((event) => { 170 | if (event.type == Gdk.EventType.BUTTON_PRESS) { 171 | editor.toggle_style ("underline"); 172 | } 173 | 174 | return false; 175 | }); 176 | 177 | strikethrough_button.button_press_event.connect ((event) => { 178 | if (event.type == Gdk.EventType.BUTTON_PRESS) { 179 | editor.toggle_style ("strikethrough"); 180 | } 181 | 182 | return false; 183 | }); 184 | } 185 | 186 | /* 187 | * Signal callbacks 188 | */ 189 | 190 | private void change_align (int index) { 191 | switch (index) { 192 | case 1: 193 | editor.set_justification ("center"); 194 | break; 195 | case 2: 196 | editor.set_justification ("right"); 197 | break; 198 | case 3: 199 | editor.set_justification ("fill"); 200 | break; 201 | default: 202 | editor.set_justification ("left"); 203 | break; 204 | } 205 | } 206 | 207 | private void cursor_moved () { 208 | bold_button.active = editor.has_style ("bold"); 209 | italic_button.active = editor.has_style ("italic"); 210 | underline_button.active = editor.has_style ("underline"); 211 | strikethrough_button.active = editor.has_style ("strikethrough"); 212 | 213 | align_button.selected = editor.get_justification_as_int (); 214 | 215 | // TODO 216 | // Update font and color Gtk.Buttons 217 | } 218 | } 219 | -------------------------------------------------------------------------------- /src/Widgets/ToolBars/ToolBarImage.vala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2020 Writer Developers 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | public class Writer.Widgets.ToolBarImage : Gtk.Image { 19 | public string tooltip { get; construct; } 20 | public string markup_key { get; construct; } 21 | 22 | public ToolBarImage (string icon_name, string tooltip, string? markup_key = null) { 23 | Object ( 24 | icon_name: icon_name, 25 | tooltip: tooltip, 26 | markup_key: markup_key, 27 | icon_size: Gtk.IconSize.BUTTON 28 | ); 29 | } 30 | 31 | construct { 32 | if (markup_key != null) { 33 | tooltip_markup = Granite.markup_accel_tooltip ({markup_key}, tooltip); 34 | } else { 35 | tooltip_text = tooltip; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/config.vala.in: -------------------------------------------------------------------------------- 1 | namespace Constants { 2 | public const string GETTEXT_PACKAGE = @GETTEXT_PACKAGE@; 3 | public const string LOCALEDIR = @LOCALEDIR@; 4 | public const string PROJECT_NAME = @PROJECT_NAME@; 5 | } 6 | --------------------------------------------------------------------------------