diff --git a/.project b/.project index ea56805..db5b7ba 100644 --- a/.project +++ b/.project @@ -11,7 +11,6 @@ noveltree_templates noveltree_themes noveltree_timeline - noveltree_toolbar noveltree_updater noveltree_yw7 novxlib diff --git a/VERSION b/VERSION index c882030..75255e9 100644 --- a/VERSION +++ b/VERSION @@ -1,3 +1,3 @@ [LATEST] -version = 1.0.1 -download_link = https://github.com/peter88213/noveltree/raw/main/dist/noveltree_v1.0.1.zip \ No newline at end of file +version = 1.1.0 +download_link = https://github.com/peter88213/noveltree/raw/main/dist/noveltree_v1.1.0.zip \ No newline at end of file diff --git a/dist/noveltree_v1.0.1.zip b/dist/noveltree_v1.0.1.zip deleted file mode 100644 index 4f4a2d5..0000000 Binary files a/dist/noveltree_v1.0.1.zip and /dev/null differ diff --git a/dist/noveltree_v1.1.0.zip b/dist/noveltree_v1.1.0.zip new file mode 100644 index 0000000..9771818 Binary files /dev/null and b/dist/noveltree_v1.1.0.zip differ diff --git a/docs/changelog.md b/docs/changelog.md index 937a91d..2ccc406 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -8,6 +8,13 @@ See the [GitHub "Features" project](https://github.com/users/peter88213/projects/14). +### v1.1.0 + +- Integrate the toolbar. + If the *noveltree_toolbar* plugin is installed, please delete it with the Plugin manager. +- Refactor. +Based on novxlib v1.0.0 + ### v1.0.1 - Fix the plugin API version constant. diff --git a/docs/help/help.md b/docs/help/help.md index 5e39c45..d5e9302 100644 --- a/docs/help/help.md +++ b/docs/help/help.md @@ -52,6 +52,7 @@ With [arcs](arcs), you can link your plot to the narrative. - **[Import menu](import_menu)** - **[Tools menu](tools_menu)** - **[Tree view context menu](tree_context_menu)** +- **[The Toolbar](toolbar)** --- diff --git a/docs/help/toolbar.md b/docs/help/toolbar.md new file mode 100644 index 0000000..1f8ce62 --- /dev/null +++ b/docs/help/toolbar.md @@ -0,0 +1,47 @@ +[Project homepage](../index) > [Instructions for use](../usage) > [Online help](help) > Tree view context menu + +--- + +# The toolbar + +--- + +![Go back](icons/tb_goBack.png) Go back in the browsing history. + +![Go forward](icons/tb_goForward.png) Go forward in the browsing history. + +--- + +![Show Book](icons/tb_viewBook.png) Go to the "Book" branch and expand it. Same as **View > Show Book** or **F12**. + +![Show Characters](icons/tb_viewCharacters.png) Go to the "Characters" branch and expand it. Same as **View > Show Characters** or **F7**. + +![Show Locations](icons/tb_viewLocations.png) Go to the "Locations" branch and expand it. Same as **View > Show Locations** or **F8**. + +![Show Items](icons/tb_viewItems.png) Go to the "Items" branch and expand it. Same as **View > Show Items** or **F9**. + +![Show Arcs](icons/tb_viewArcs.png) Go to the "Arcs" branch and expand it. Same as **View > Show Arcs** or **F10**. + + +![Show Project notes](icons/tb_viewProjectnotes.png) Go to the "Project notes" branch and expand it. Same as **View > Show Project notes** or **F11**. + +--- + +![Save](icons/tb_save.png) Save the project. Same as **File > Save** or **Ctrl-S**. + +![Lock/Unlock](icons/tb_lock.png) Toggle the lock status of the project. + +![Export manuscript](icons/tb_manuscript.png) Export the manuscript for editing. Same as **Export > Manuscript for editing** or **F4**. + +![Update from manuscript](icons/tb_updateFromManuscript.png) Discard the current manuscript, if nes chapters or sections have been inserted. Same as selecting the manuscript under **Import**, or **F6**. + +--- + +![Toggle Text viewer](icons/tb_viewer.png) Toggle Text viewer. Same as **View > Toggle Text viewer** or **Ctrl-T**. + +![Toggle Properties](icons/tb_properties.png) Toggle Properties. Same as **View > Toggle Properties** or **Ctrl-Alt-T**. + +--- + + +[<< Previous](tree_context_menu) -- [First >>](file_menu) \ No newline at end of file diff --git a/docs/help/tree_context_menu.md b/docs/help/tree_context_menu.md index 3cb4cec..1c118a5 100644 --- a/docs/help/tree_context_menu.md +++ b/docs/help/tree_context_menu.md @@ -148,4 +148,4 @@ Sets the selected character's status. This can be *major* or *minor*. --- -[<< Previous](tools_menu) -- [First >>](file_menu) \ No newline at end of file +[<< Previous](tools_menu) -- [Nextt >>](toolbar_menu) \ No newline at end of file diff --git a/docs/icons/LICENSE.txt b/docs/icons/LICENSE.txt new file mode 100644 index 0000000..1c0c316 --- /dev/null +++ b/docs/icons/LICENSE.txt @@ -0,0 +1,23 @@ +The MIT License (MIT) + +Copyright (c) 2024 Peter Triesberger +Copyright (c) 2018 Akveo. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/docs/icons/README.md b/docs/icons/README.md new file mode 100644 index 0000000..9e2149b --- /dev/null +++ b/docs/icons/README.md @@ -0,0 +1,3 @@ +# Credits + +The Icons are based on the [Eva Icons](https://akveo.github.io/eva-icons/#/), published under the [MIT License](http://www.opensource.org/licenses/mit-license.php). The original black and white icons were colored for this plugin by the maintainer. \ No newline at end of file diff --git a/docs/icons/tb_goBack24.png b/docs/icons/tb_goBack24.png new file mode 100644 index 0000000..560b218 Binary files /dev/null and b/docs/icons/tb_goBack24.png differ diff --git a/docs/icons/tb_goForward24.png b/docs/icons/tb_goForward24.png new file mode 100644 index 0000000..eecc988 Binary files /dev/null and b/docs/icons/tb_goForward24.png differ diff --git a/docs/icons/tb_lock24.png b/docs/icons/tb_lock24.png new file mode 100644 index 0000000..4373906 Binary files /dev/null and b/docs/icons/tb_lock24.png differ diff --git a/docs/icons/tb_manuscript24.png b/docs/icons/tb_manuscript24.png new file mode 100644 index 0000000..9905cc2 Binary files /dev/null and b/docs/icons/tb_manuscript24.png differ diff --git a/docs/icons/tb_properties24.png b/docs/icons/tb_properties24.png new file mode 100644 index 0000000..a1a814f Binary files /dev/null and b/docs/icons/tb_properties24.png differ diff --git a/docs/icons/tb_save24.png b/docs/icons/tb_save24.png new file mode 100644 index 0000000..8f27b1a Binary files /dev/null and b/docs/icons/tb_save24.png differ diff --git a/docs/icons/tb_updateFromManuscript24.png b/docs/icons/tb_updateFromManuscript24.png new file mode 100644 index 0000000..fd3c022 Binary files /dev/null and b/docs/icons/tb_updateFromManuscript24.png differ diff --git a/docs/icons/tb_viewArcs24.png b/docs/icons/tb_viewArcs24.png new file mode 100644 index 0000000..980cc68 Binary files /dev/null and b/docs/icons/tb_viewArcs24.png differ diff --git a/docs/icons/tb_viewBook24.png b/docs/icons/tb_viewBook24.png new file mode 100644 index 0000000..0a132f2 Binary files /dev/null and b/docs/icons/tb_viewBook24.png differ diff --git a/docs/icons/tb_viewCharacters24.png b/docs/icons/tb_viewCharacters24.png new file mode 100644 index 0000000..f525c2e Binary files /dev/null and b/docs/icons/tb_viewCharacters24.png differ diff --git a/docs/icons/tb_viewItems24.png b/docs/icons/tb_viewItems24.png new file mode 100644 index 0000000..e8b1b18 Binary files /dev/null and b/docs/icons/tb_viewItems24.png differ diff --git a/docs/icons/tb_viewLocations24.png b/docs/icons/tb_viewLocations24.png new file mode 100644 index 0000000..5e824f2 Binary files /dev/null and b/docs/icons/tb_viewLocations24.png differ diff --git a/docs/icons/tb_viewProjectnotes24.png b/docs/icons/tb_viewProjectnotes24.png new file mode 100644 index 0000000..5576152 Binary files /dev/null and b/docs/icons/tb_viewProjectnotes24.png differ diff --git a/docs/icons/tb_viewer24.png b/docs/icons/tb_viewer24.png new file mode 100644 index 0000000..f21218a Binary files /dev/null and b/docs/icons/tb_viewer24.png differ diff --git a/docs/index.md b/docs/index.md index 496e448..163ee39 100644 --- a/docs/index.md +++ b/docs/index.md @@ -32,7 +32,6 @@ you might want to take a look at the [yw_novx conversion tools](https://github.c *noveltree's* functionality can be extended by plugins. Here are some examples: -- [A toolbar with buttons for frequently used commands](https://peter88213.github.io/noveltree_toolbar/) - [A yw7 file importer/exporter](https://peter88213.github.io/noveltree_yw7/) - [An on-demand update checker](https://peter88213.github.io/noveltree_updater/) - [A daily progress log viewer](https://peter88213.github.io/noveltree_progress/) @@ -65,9 +64,9 @@ I use the program myself and fix errors immediately if I notice any. As far as I ## Download and install -[Download the latest release (version 1.0.1)](https://github.com/peter88213/noveltree/raw/main/dist/noveltree_v1.0.1.zip) +[Download the latest release (version 1.1.0)](https://github.com/peter88213/noveltree/raw/main/dist/noveltree_v1.1.0.zip) -- Extract the "noveltree_v1.0.1" folder from the downloaded zipfile "noveltree_v1.0.1.zip". +- Extract the "noveltree_v1.1.0" folder from the downloaded zipfile "noveltree_v1.1.0.zip". - Move into this new folder and open "README.md" for further instructions. - You may wish to install plugins; the [section editor](https://peter88213.github.io/noveltree_editor/) is highly recommended. @@ -85,7 +84,9 @@ See the [instructions for use](usage) ## Credits -The icons are made using the free *Pusab* font by Ryoichi Tsunekawa, [Flat-it](http://flat-it.com/). +The app icons are made using the free *Pusab* font by Ryoichi Tsunekawa, [Flat-it](http://flat-it.com/). +The toolbar icons are based on the [Eva Icons](https://akveo.github.io/eva-icons/#/), published under the [MIT License](http://www.opensource.org/licenses/mit-license.php). The original black and white icons were colored for this plugin by the maintainer. + ## License diff --git a/docs/template/index.md b/docs/template/index.md index 83e609b..e24653c 100644 --- a/docs/template/index.md +++ b/docs/template/index.md @@ -32,7 +32,6 @@ you might want to take a look at the [yw_novx conversion tools](https://github.c *noveltree's* functionality can be extended by plugins. Here are some examples: -- [A toolbar with buttons for frequently used commands](https://peter88213.github.io/noveltree_toolbar/) - [A yw7 file importer/exporter](https://peter88213.github.io/noveltree_yw7/) - [An on-demand update checker](https://peter88213.github.io/noveltree_updater/) - [A daily progress log viewer](https://peter88213.github.io/noveltree_progress/) @@ -85,7 +84,9 @@ See the [instructions for use](usage) ## Credits -The icons are made using the free *Pusab* font by Ryoichi Tsunekawa, [Flat-it](http://flat-it.com/). +The app icons are made using the free *Pusab* font by Ryoichi Tsunekawa, [Flat-it](http://flat-it.com/). +The toolbar icons are based on the [Eva Icons](https://akveo.github.io/eva-icons/#/), published under the [MIT License](http://www.opensource.org/licenses/mit-license.php). The original black and white icons were colored for this plugin by the maintainer. + ## License diff --git a/i18n/de.po b/i18n/de.po index 9d7016f..2d54324 100644 --- a/i18n/de.po +++ b/i18n/de.po @@ -3,9 +3,9 @@ # msgid "" msgstr "" -"Project-Id-Version: 1.0.1\n" -"POT-Creation-Date: 2024-01-09 13:34:42\n" -"PO-Revision-Date: 2024-01-09 13:34:42\n" +"Project-Id-Version: 1.1.0\n" +"POT-Creation-Date: 2024-01-10 12:22:49\n" +"PO-Revision-Date: 2024-01-10 12:22:49\n" "Last-Translator: Peter Triesberger\n" "Language: de\n" "MIME-Version: 1.0\n" @@ -148,6 +148,9 @@ msgstr "Kann Datei nicht schreiben" msgid "Change Level" msgstr "Ebene ändern" +msgid "Change icon size" +msgstr "Symbolgröße ändern" + msgid "Chapter" msgstr "Kapitel" @@ -517,6 +520,9 @@ msgstr "Mit dem vorhergehenden zusammenfassen" msgid "Language code" msgstr "Sprachencode" +msgid "Large toolbar icons" +msgstr "Große Symbole in der Werkzeugleiste" + msgid "Latest backup successfully restored." msgstr "Letzte Sicherung erfolgreich wiederhergestellt." @@ -916,6 +922,9 @@ msgstr "Text" msgid "Text file" msgstr "Textdatei" +msgid "The change takes effect after next startup." +msgstr "Die Änderung wird beim nächsten Programmstart wirksam" + msgid "The plugin remains active until next start." msgstr "Das Plugin bleibt bis zum nächsten Start aktiv." diff --git a/i18n/locale/de/LC_MESSAGES/noveltree.mo b/i18n/locale/de/LC_MESSAGES/noveltree.mo index ed78245..1d6d7ed 100644 Binary files a/i18n/locale/de/LC_MESSAGES/noveltree.mo and b/i18n/locale/de/LC_MESSAGES/noveltree.mo differ diff --git a/i18n/messages.pot b/i18n/messages.pot index fd6d476..c8e886f 100644 --- a/i18n/messages.pot +++ b/i18n/messages.pot @@ -3,8 +3,8 @@ # msgid "" msgstr "" -"Project-Id-Version: 1.0.1\n" -"POT-Creation-Date: 2024-01-09 13:34:42\n" +"Project-Id-Version: 1.1.0\n" +"POT-Creation-Date: 2024-01-10 12:22:49\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language: LANGUAGE\n" @@ -149,6 +149,9 @@ msgstr "" msgid "Change Level" msgstr "" +msgid "Change icon size" +msgstr "" + msgid "Chapter" msgstr "" @@ -518,6 +521,9 @@ msgstr "" msgid "Language code" msgstr "" +msgid "Large toolbar icons" +msgstr "" + msgid "Latest backup successfully restored." msgstr "" @@ -917,6 +923,9 @@ msgstr "" msgid "Text file" msgstr "" +msgid "The change takes effect after next startup." +msgstr "" + msgid "The plugin remains active until next start." msgstr "" diff --git a/src/icons/toolbar/LICENSE.txt b/src/icons/toolbar/LICENSE.txt new file mode 100644 index 0000000..1c0c316 --- /dev/null +++ b/src/icons/toolbar/LICENSE.txt @@ -0,0 +1,23 @@ +The MIT License (MIT) + +Copyright (c) 2024 Peter Triesberger +Copyright (c) 2018 Akveo. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/src/icons/toolbar/README.md b/src/icons/toolbar/README.md new file mode 100644 index 0000000..9e2149b --- /dev/null +++ b/src/icons/toolbar/README.md @@ -0,0 +1,3 @@ +# Credits + +The Icons are based on the [Eva Icons](https://akveo.github.io/eva-icons/#/), published under the [MIT License](http://www.opensource.org/licenses/mit-license.php). The original black and white icons were colored for this plugin by the maintainer. \ No newline at end of file diff --git a/src/icons/toolbar/tb_goBack16.png b/src/icons/toolbar/tb_goBack16.png new file mode 100644 index 0000000..81606be Binary files /dev/null and b/src/icons/toolbar/tb_goBack16.png differ diff --git a/src/icons/toolbar/tb_goBack24.png b/src/icons/toolbar/tb_goBack24.png new file mode 100644 index 0000000..560b218 Binary files /dev/null and b/src/icons/toolbar/tb_goBack24.png differ diff --git a/src/icons/toolbar/tb_goForward16.png b/src/icons/toolbar/tb_goForward16.png new file mode 100644 index 0000000..c4d72ad Binary files /dev/null and b/src/icons/toolbar/tb_goForward16.png differ diff --git a/src/icons/toolbar/tb_goForward24.png b/src/icons/toolbar/tb_goForward24.png new file mode 100644 index 0000000..eecc988 Binary files /dev/null and b/src/icons/toolbar/tb_goForward24.png differ diff --git a/src/icons/toolbar/tb_lock16.png b/src/icons/toolbar/tb_lock16.png new file mode 100644 index 0000000..63c9788 Binary files /dev/null and b/src/icons/toolbar/tb_lock16.png differ diff --git a/src/icons/toolbar/tb_lock24.png b/src/icons/toolbar/tb_lock24.png new file mode 100644 index 0000000..4373906 Binary files /dev/null and b/src/icons/toolbar/tb_lock24.png differ diff --git a/src/icons/toolbar/tb_manuscript16.png b/src/icons/toolbar/tb_manuscript16.png new file mode 100644 index 0000000..97087c7 Binary files /dev/null and b/src/icons/toolbar/tb_manuscript16.png differ diff --git a/src/icons/toolbar/tb_manuscript24.png b/src/icons/toolbar/tb_manuscript24.png new file mode 100644 index 0000000..9905cc2 Binary files /dev/null and b/src/icons/toolbar/tb_manuscript24.png differ diff --git a/src/icons/toolbar/tb_properties16.png b/src/icons/toolbar/tb_properties16.png new file mode 100644 index 0000000..dca96b0 Binary files /dev/null and b/src/icons/toolbar/tb_properties16.png differ diff --git a/src/icons/toolbar/tb_properties24.png b/src/icons/toolbar/tb_properties24.png new file mode 100644 index 0000000..a1a814f Binary files /dev/null and b/src/icons/toolbar/tb_properties24.png differ diff --git a/src/icons/toolbar/tb_save16.png b/src/icons/toolbar/tb_save16.png new file mode 100644 index 0000000..5f619e8 Binary files /dev/null and b/src/icons/toolbar/tb_save16.png differ diff --git a/src/icons/toolbar/tb_save24.png b/src/icons/toolbar/tb_save24.png new file mode 100644 index 0000000..8f27b1a Binary files /dev/null and b/src/icons/toolbar/tb_save24.png differ diff --git a/src/icons/toolbar/tb_updateFromManuscript16.png b/src/icons/toolbar/tb_updateFromManuscript16.png new file mode 100644 index 0000000..58e80cb Binary files /dev/null and b/src/icons/toolbar/tb_updateFromManuscript16.png differ diff --git a/src/icons/toolbar/tb_updateFromManuscript24.png b/src/icons/toolbar/tb_updateFromManuscript24.png new file mode 100644 index 0000000..fd3c022 Binary files /dev/null and b/src/icons/toolbar/tb_updateFromManuscript24.png differ diff --git a/src/icons/toolbar/tb_viewArcs16.png b/src/icons/toolbar/tb_viewArcs16.png new file mode 100644 index 0000000..3d2d2ad Binary files /dev/null and b/src/icons/toolbar/tb_viewArcs16.png differ diff --git a/src/icons/toolbar/tb_viewArcs24.png b/src/icons/toolbar/tb_viewArcs24.png new file mode 100644 index 0000000..980cc68 Binary files /dev/null and b/src/icons/toolbar/tb_viewArcs24.png differ diff --git a/src/icons/toolbar/tb_viewBook16.png b/src/icons/toolbar/tb_viewBook16.png new file mode 100644 index 0000000..e50b18c Binary files /dev/null and b/src/icons/toolbar/tb_viewBook16.png differ diff --git a/src/icons/toolbar/tb_viewBook24.png b/src/icons/toolbar/tb_viewBook24.png new file mode 100644 index 0000000..0a132f2 Binary files /dev/null and b/src/icons/toolbar/tb_viewBook24.png differ diff --git a/src/icons/toolbar/tb_viewCharacters16.png b/src/icons/toolbar/tb_viewCharacters16.png new file mode 100644 index 0000000..bad225b Binary files /dev/null and b/src/icons/toolbar/tb_viewCharacters16.png differ diff --git a/src/icons/toolbar/tb_viewCharacters24.png b/src/icons/toolbar/tb_viewCharacters24.png new file mode 100644 index 0000000..f525c2e Binary files /dev/null and b/src/icons/toolbar/tb_viewCharacters24.png differ diff --git a/src/icons/toolbar/tb_viewItems16.png b/src/icons/toolbar/tb_viewItems16.png new file mode 100644 index 0000000..d125777 Binary files /dev/null and b/src/icons/toolbar/tb_viewItems16.png differ diff --git a/src/icons/toolbar/tb_viewItems24.png b/src/icons/toolbar/tb_viewItems24.png new file mode 100644 index 0000000..e8b1b18 Binary files /dev/null and b/src/icons/toolbar/tb_viewItems24.png differ diff --git a/src/icons/toolbar/tb_viewLocations16.png b/src/icons/toolbar/tb_viewLocations16.png new file mode 100644 index 0000000..027c054 Binary files /dev/null and b/src/icons/toolbar/tb_viewLocations16.png differ diff --git a/src/icons/toolbar/tb_viewLocations24.png b/src/icons/toolbar/tb_viewLocations24.png new file mode 100644 index 0000000..5e824f2 Binary files /dev/null and b/src/icons/toolbar/tb_viewLocations24.png differ diff --git a/src/icons/toolbar/tb_viewProjectnotes16.png b/src/icons/toolbar/tb_viewProjectnotes16.png new file mode 100644 index 0000000..cc88a6e Binary files /dev/null and b/src/icons/toolbar/tb_viewProjectnotes16.png differ diff --git a/src/icons/toolbar/tb_viewProjectnotes24.png b/src/icons/toolbar/tb_viewProjectnotes24.png new file mode 100644 index 0000000..5576152 Binary files /dev/null and b/src/icons/toolbar/tb_viewProjectnotes24.png differ diff --git a/src/icons/toolbar/tb_viewer16.png b/src/icons/toolbar/tb_viewer16.png new file mode 100644 index 0000000..6174531 Binary files /dev/null and b/src/icons/toolbar/tb_viewer16.png differ diff --git a/src/icons/toolbar/tb_viewer24.png b/src/icons/toolbar/tb_viewer24.png new file mode 100644 index 0000000..f21218a Binary files /dev/null and b/src/icons/toolbar/tb_viewer24.png differ diff --git a/src/noveltree_.py b/src/noveltree_.py index da847be..56d115d 100644 --- a/src/noveltree_.py +++ b/src/noveltree_.py @@ -75,7 +75,7 @@ arcs_width=55, points_width=300, column_order='wc;vp;sy;st;nt;dt;tm;dr;tg;po;ac;pt;ar' -) + ) OPTIONS = dict( show_contents=True, show_properties=True, @@ -94,7 +94,8 @@ show_cr_goals=True, detach_prop_win=False, discard_tmp_docs=True, -) + large_icons=False, + ) def main(): diff --git a/src/noveltreelib/view/contents_window/contents_viewer.py b/src/noveltreelib/view/contents_window/contents_viewer.py index a00adc3..22e837b 100644 --- a/src/noveltreelib/view/contents_window/contents_viewer.py +++ b/src/noveltreelib/view/contents_window/contents_viewer.py @@ -26,8 +26,10 @@ def __init__(self, parent, model, view, controller): """Put a text box to the specified window. Positional arguments: - view: NoveltreeUi -- The instanitating controller. parent: tk.Frame -- The parent window. + model -- reference to the main model instance of the application. + view -- reference to the main view instance of the application. + controller -- reference to the main controller instance of the application. Required keyword arguments: show_markup: bool diff --git a/src/noveltreelib/view/nv_view.py b/src/noveltreelib/view/nv_view.py index 3242a90..3f73655 100644 --- a/src/noveltreelib/view/nv_view.py +++ b/src/noveltreelib/view/nv_view.py @@ -45,6 +45,7 @@ from noveltreelib.view.view_options_window import ViewOptionsWindow from noveltreelib.view.contents_window.contents_viewer import ContentsViewer from noveltreelib.view.properties_window.properties_viewer import PropertiesViewer +from noveltreelib.view.toolbar import Toolbar class NvView: @@ -174,6 +175,10 @@ def __init__(self, model, controller, title): #--- Add commands and submenus to the main menu. self._build_menu() + #--- Add a toolbar. + self._toolbar = Toolbar(self, self._ctrl) + self.views.append(self._toolbar) + #--- tk root event bindings. self._bind_events() @@ -234,6 +239,11 @@ def disable_menu(self): self.fileMenu.entryconfig(_('Save'), state='disabled') self.fileMenu.entryconfig(_('Save as...'), state='disabled') self.fileMenu.entryconfig(_('Discard manuscript'), state='disabled') + for view in self.views: + try: + view.disable_menu() + except AttributeError: + pass def dock_properties_frame(self, event=None): """Dock the properties window at the right pane, if detached.""" @@ -257,12 +267,12 @@ def dock_properties_frame(self, event=None): pass return 'break' - def edit_settings(self, event=None): - """Open a toplevel window to edit the program settings.""" + def _view_options(self, event=None): + """Open a toplevel window to edit the view options.""" offset = 300 __, x, y = self.root.geometry().split('+') windowGeometry = f'+{int(x)+offset}+{int(y)+offset}' - ViewOptionsWindow(windowGeometry, self.tv) + ViewOptionsWindow(windowGeometry, self) return 'break' def enable_menu(self): @@ -285,6 +295,11 @@ def enable_menu(self): self.fileMenu.entryconfig(_('Save'), state='normal') self.fileMenu.entryconfig(_('Save as...'), state='normal') self.fileMenu.entryconfig(_('Discard manuscript'), state='normal') + for view in self.views: + try: + view.enable_menu() + except AttributeError: + pass def on_change_selection(self, nodeId): """Event handler for element selection. @@ -455,7 +470,10 @@ def refresh(self): self.pathBar.config(bg=self.root.cget('background')) self.pathBar.config(fg='black') for view in self.views: - view.refresh() + try: + view.refresh() + except AttributeError: + pass self.set_title() def _bind_events(self): @@ -537,7 +555,7 @@ def _build_menu(self): self.viewMenu.add_command(label=_('Toggle Properties'), accelerator=self._KEY_TOGGLE_PROPERTIES[1], command=self.toggle_properties_view) self.viewMenu.add_command(label=_('Detach/Dock Properties'), accelerator=self._KEY_DETACH_PROPERTIES[1], command=self.toggle_properties_window) self.viewMenu.add_separator() - self.viewMenu.add_command(label=_('Options'), command=self.edit_settings) + self.viewMenu.add_command(label=_('Options'), command=self._view_options) # Part self.partMenu = tk.Menu(self.mainMenu, tearoff=0) diff --git a/src/noveltreelib/view/toolbar.py b/src/noveltreelib/view/toolbar.py new file mode 100644 index 0000000..3d3ab15 --- /dev/null +++ b/src/noveltreelib/view/toolbar.py @@ -0,0 +1,225 @@ +"""Toolbar class for noveltree. + + +Copyright (c) 2024 Peter Triesberger +For further information see https://github.com/peter88213/noveltree +License: GNU GPLv3 (https://www.gnu.org/licenses/gpl-3.0.en.html) +""" +from tkinter import ttk +import sys +import os +from novxlib.novx_globals import AC_ROOT +from novxlib.novx_globals import CH_ROOT +from novxlib.novx_globals import CR_ROOT +from novxlib.novx_globals import IT_ROOT +from novxlib.novx_globals import LC_ROOT +from novxlib.novx_globals import MANUSCRIPT_SUFFIX +from novxlib.novx_globals import PN_ROOT +import tkinter as tk +from noveltreelib.noveltree_globals import prefs + + +class Toolbar: + """Toolbar plugin class.""" + + def __init__(self, view, controller): + """Add a toolbar. + + Positional arguments: + view -- reference to the main view instance of the application. + controller -- reference to the main controller instance of the application. + """ + self._ctrl = controller + self._ui = view + iconPath = f'{os.path.dirname(sys.argv[0])}/icons/toolbar' + if prefs.get('large_icons', False): + size = 24 + else: + size = 16 + + # Add a toolbar to the editor window. + self._buttonBar = tk.Frame(self._ui.mainWindow) + self._buttonBar.pack(expand=False, before=self._ui.appWindow, fill='both') + + # "Go back" button. + goBackIcon = tk.PhotoImage(file=f'{iconPath}/tb_goBack{size}.png') + self._goBackButton = ttk.Button( + self._buttonBar, + image=goBackIcon, + command=self._ui.tv.go_back + ) + self._goBackButton.pack(side='left') + self._goBackButton.image = goBackIcon + + # "Go forward" button. + goForwardIcon = tk.PhotoImage(file=f'{iconPath}/tb_goForward{size}.png') + self._goForwardButton = ttk.Button( + self._buttonBar, + image=goForwardIcon, + command=self._ui.tv.go_forward + ) + self._goForwardButton.pack(side='left') + self._goForwardButton.image = goForwardIcon + + # Separator. + tk.Frame(self._buttonBar, bg='light gray', width=1).pack(side='left', fill='y', padx=4) + + # "View Book" button. + viewBookIcon = tk.PhotoImage(file=f'{iconPath}/tb_viewBook{size}.png') + self._viewBookButton = ttk.Button( + self._buttonBar, + image=viewBookIcon, + command=lambda: self._ui.tv.show_branch(CH_ROOT) + ) + self._viewBookButton.pack(side='left') + self._viewBookButton.image = viewBookIcon + + # "View Characters" button. + viewCharactersIcon = tk.PhotoImage(file=f'{iconPath}/tb_viewCharacters{size}.png') + self._viewCharactersButton = ttk.Button( + self._buttonBar, + image=viewCharactersIcon, + command=lambda: self._ui.tv.show_branch(CR_ROOT) + ) + self._viewCharactersButton.pack(side='left') + self._viewCharactersButton.image = viewCharactersIcon + + # "View Locations" button. + viewLocationsIcon = tk.PhotoImage(file=f'{iconPath}/tb_viewLocations{size}.png') + self._viewLocationsButton = ttk.Button( + self._buttonBar, + image=viewLocationsIcon, + command=lambda: self._ui.tv.show_branch(LC_ROOT) + ) + self._viewLocationsButton.pack(side='left') + self._viewLocationsButton.image = viewLocationsIcon + + # "View Items" button. + viewItemsIcon = tk.PhotoImage(file=f'{iconPath}/tb_viewItems{size}.png') + self._viewItemsButton = ttk.Button( + self._buttonBar, + image=viewItemsIcon, + command=lambda: self._ui.tv.show_branch(IT_ROOT) + ) + self._viewItemsButton.pack(side='left') + self._viewItemsButton.image = viewItemsIcon + + # "View Arcs" button. + viewArcsIcon = tk.PhotoImage(file=f'{iconPath}/tb_viewArcs{size}.png') + self._viewArcsButton = ttk.Button( + self._buttonBar, + image=viewArcsIcon, + command=lambda: self._ui.tv.show_branch(AC_ROOT) + ) + self._viewArcsButton.pack(side='left') + self._viewArcsButton.image = viewArcsIcon + + # "View Projectnotes" button. + viewProjectnotesIcon = tk.PhotoImage(file=f'{iconPath}/tb_viewProjectnotes{size}.png') + self._viewProjectnotesButton = ttk.Button( + self._buttonBar, + image=viewProjectnotesIcon, + command=lambda: self._ui.tv.show_branch(PN_ROOT) + ) + self._viewProjectnotesButton.pack(side='left') + self._viewProjectnotesButton.image = viewProjectnotesIcon + + # Separator. + tk.Frame(self._buttonBar, bg='light gray', width=1).pack(side='left', fill='y', padx=4) + + # "Save" button. + saveIcon = tk.PhotoImage(file=f'{iconPath}/tb_save{size}.png') + self._saveButton = ttk.Button( + self._buttonBar, + image=saveIcon, + command=self._ctrl.save_project + ) + self._saveButton.pack(side='left') + self._saveButton.image = saveIcon + + # "Lock/Unlock" button. + lockIcon = tk.PhotoImage(file=f'{iconPath}/tb_lock{size}.png') + self._lockButton = ttk.Button( + self._buttonBar, + image=lockIcon, + command=self._ctrl.toggle_lock + ) + self._lockButton.pack(side='left') + self._lockButton.image = lockIcon + + # "Manuscript" button. + manuscriptIcon = tk.PhotoImage(file=f'{iconPath}/tb_manuscript{size}.png') + self._manuscriptButton = ttk.Button( + self._buttonBar, + image=manuscriptIcon, + command=lambda:self._ctrl.export_document(MANUSCRIPT_SUFFIX) + ) + self._manuscriptButton.pack(side='left') + self._manuscriptButton.image = manuscriptIcon + + # "Update from manuscript" button. + updateFromManuscriptIcon = tk.PhotoImage(file=f'{iconPath}/tb_updateFromManuscript{size}.png') + self._updateButton = ttk.Button( + self._buttonBar, + image=updateFromManuscriptIcon, + command=lambda: self._ctrl.update_from_odt(suffix=MANUSCRIPT_SUFFIX) + ) + self._updateButton.pack(side='left') + self._updateButton.image = updateFromManuscriptIcon + + # Reverse order (side='right'). + + # "Toggle properties" button. + propertiesIcon = tk.PhotoImage(file=f'{iconPath}/tb_properties{size}.png') + self._propertiesButton = ttk.Button( + self._buttonBar, + image=propertiesIcon, + command=self._ui.toggle_properties_view + ) + self._propertiesButton.pack(side='right') + self._propertiesButton.image = propertiesIcon + + # "Toggle content viewer" button. + viewerIcon = tk.PhotoImage(file=f'{iconPath}/tb_viewer{size}.png') + self._viewerButton = ttk.Button( + self._buttonBar, + image=viewerIcon, + command=self._ui.toggle_contents_view + ) + self._viewerButton.pack(side='right') + self._viewerButton.image = viewerIcon + + def disable_menu(self): + """Disable menu entries when no project is open.""" + self._saveButton.config(state='disabled') + self._lockButton.config(state='disabled') + self._updateButton.config(state='disabled') + self._manuscriptButton.config(state='disabled') + self._viewBookButton.config(state='disabled') + self._viewCharactersButton.config(state='disabled') + self._viewLocationsButton.config(state='disabled') + self._viewItemsButton.config(state='disabled') + self._viewArcsButton.config(state='disabled') + self._viewProjectnotesButton.config(state='disabled') + self._goBackButton.config(state='disabled') + self._goForwardButton.config(state='disabled') + self._propertiesButton.config(state='disabled') + self._viewerButton.config(state='disabled') + + def enable_menu(self): + """Enable menu entries when a project is open.""" + self._saveButton.config(state='normal') + self._lockButton.config(state='normal') + self._updateButton.config(state='normal') + self._manuscriptButton.config(state='normal') + self._viewBookButton.config(state='normal') + self._viewCharactersButton.config(state='normal') + self._viewLocationsButton.config(state='normal') + self._viewItemsButton.config(state='normal') + self._viewArcsButton.config(state='normal') + self._viewProjectnotesButton.config(state='normal') + self._goBackButton.config(state='normal') + self._goForwardButton.config(state='normal') + self._propertiesButton.config(state='normal') + self._viewerButton.config(state='normal') + diff --git a/src/noveltreelib/view/view_options_window.py b/src/noveltreelib/view/view_options_window.py index ea3a796..8075b5d 100644 --- a/src/noveltreelib/view/view_options_window.py +++ b/src/noveltreelib/view/view_options_window.py @@ -16,8 +16,14 @@ class ViewOptionsWindow(tk.Toplevel): """A pop-up window with view preference settings.""" - def __init__(self, size, tv, **kw): - self._tv = tv + def __init__(self, size, view, **kw): + """Open a pop-up window to edit the view options. + + Positional arguments: + size -- str: Window size and coordinates. + view -- Reference to the application's main view. + """ + self._ui = view super().__init__(**kw) self.title(_('Preferences')) self.geometry(size) @@ -31,12 +37,13 @@ def __init__(self, size, tv, **kw): ) frame1 = ttk.Frame(window) frame1.pack(fill='both', side='left') + ttk.Separator(window, orient='vertical').pack(fill='y', padx=10, side='left') frame2 = ttk.Frame(window) frame2.pack(fill='both', side='left') # Combobox for coloring mode setting. - self._coloringModeStr = tk.StringVar(value=self._tv.COLORING_MODES[self._tv.coloringMode]) + self._coloringModeStr = tk.StringVar(value=self._ui.tv.COLORING_MODES[self._ui.tv.coloringMode]) self._coloringModeStr.trace('w', self._change_colors) ttk.Label( frame1, @@ -45,19 +52,25 @@ def __init__(self, size, tv, **kw): ttk.Combobox( frame1, textvariable=self._coloringModeStr, - values=self._tv.COLORING_MODES, + values=self._ui.tv.COLORING_MODES, width=20 ).pack(padx=5, pady=5, anchor='w') ttk.Separator(frame1, orient='horizontal').pack(fill='x', pady=10) + # Checkbox for large toolbar buttons. + + self._largeIcons = tk.BooleanVar(frame1, value=prefs['large_icons']) + ttk.Checkbutton(frame1, text=_('Large toolbar icons'), variable=self._largeIcons).pack(padx=5, pady=5, anchor='w') + self._largeIcons.trace('w', self._change_icon_size) + # Listbox for column reordering. ttk.Label( frame2, text=_('Columns') ).pack(padx=5, pady=5, anchor='w') self._coIdsByTitle = {} - for coId, title, __ in self._tv.columns: + for coId, title, __ in self._ui.tv.columns: self._coIdsByTitle[title] = coId self._colEntries = tk.Variable(value=list(self._coIdsByTitle)) DragDropListbox( @@ -82,8 +95,8 @@ def __init__(self, size, tv, **kw): def _change_colors(self, *args, **kwargs): cmStr = self._coloringModeStr.get() - self._tv.coloringMode = self._tv.COLORING_MODES.index(cmStr) - self._tv.refresh() + self._ui.tv.coloringMode = self._ui.tv.COLORING_MODES.index(cmStr) + self._ui.tv.refresh() def _change_column_order(self, *args, **kwargs): srtColumns = [] @@ -91,6 +104,9 @@ def _change_column_order(self, *args, **kwargs): for title in titles: srtColumns.append(self._coIdsByTitle[title]) prefs['column_order'] = list_to_string(srtColumns) - self._tv.configure_columns() - self._tv.refresh() + self._ui.tv.configure_columns() + self._ui.tv.refresh() + def _change_icon_size(self, *args): + prefs['large_icons'] = self._largeIcons.get() + self._ui.show_info(_('The change takes effect after next startup.'), title=f'{_("Change icon size")}') diff --git a/src/plugin/nv_toolbar.py b/src/plugin/nv_toolbar.py deleted file mode 100644 index e69de29..0000000 diff --git a/tools/build.xml b/tools/build.xml index b8d4e85..5dfd80b 100644 --- a/tools/build.xml +++ b/tools/build.xml @@ -1,6 +1,6 @@ - +