diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..309b0cd --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "cmake/backbone"] + path = cmake/backbone + url = git@git.backbone.ws:cmake/backbone.git +[submodule "util/backbone"] + path = util/backbone + url = git@git.backbone.ws:cmake/backbone-utils.git diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..609258d --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ +Kolan Sh diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..542fec4 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,24 @@ +PROJECT (LAviewDesktop C) + +CMAKE_MINIMUM_REQUIRED (VERSION 2.8) + +SET (PROJECT_LOWERCASE_NAME "laview-desktop") +SET (PROJECT_DESCRIPTION "LAview Desktop Application.") + +SET (MAJOR 1) +SET (MINOR 0) +SET (PATCH 0) + +LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/backbone) + +ADD_SUBDIRECTORY (config) +ADD_SUBDIRECTORY (src) +ADD_SUBDIRECTORY (po) +ADD_SUBDIRECTORY (pkg-config) +ADD_SUBDIRECTORY (test) +ADD_SUBDIRECTORY (cpack) +ADD_SUBDIRECTORY (ui) +ADD_SUBDIRECTORY (res) + +# enable testing +ENABLE_TESTING () diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..65c5ca8 --- /dev/null +++ b/COPYING @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..067530d --- /dev/null +++ b/INSTALL @@ -0,0 +1,85 @@ + Requirements + ------------ + + Build-Time Dependencies + +LAview-Core: https://redmine.backbone.ws/projects/laview-core +GTK+-3:http://www.gtk.org/ +CMake: http://www.cmake.org +NSIS (W32): http://nsis.sourceforge.net + + Run-Time Dependencies + +GTK+-3:http://www.gtk.org/ +LAview-Core: https://redmine.backbone.ws/projects/laview-core + + Operation Systems + + * GNU/Linux (Gentoo, Debian, etc.) + * MS Windows (Windows 5.1 aka XP) + * BSD-based (FreeBSD, OpenBSD, NetBSD, Mac OS X) + +If you need support of one more OS, be free in writing of patches and sending +pull-requests to the mainstream. + + + Compilation + ----------- + + Compilation under GNU/Linux + +$ mkdir build-gcc && cd build-gcc +$ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr +$ make -j$((`getconf _NPROCESSORS_ONLN`+1)) + + Compilation under MS Windows + +$ mkdir build-mingw && cd build-mingw +$ cmake -G "MSYS Makefiles" .. -DCMAKE_BUILD_TYPE=Release +$ make -j$((NUMBER_OF_PROCESSORS + 1)) + + Compilation under BSD-based Systems. + +TODO: add description here. + + + Packing/Installation + -------------------- + + Packing/Installation under GNU/Linux + +$ cpack +Install using System Package Manager. + + Packing/Installation under MS Windows + +$ cpack +Install using generated by NSIS executable. + + Packing/Installation under BSD-based + +$ cpack +Install using System Package Manager. + + + Testing + ------- + + Testing under GNU/Linux + +$ ctest -j$((`getconf _NPROCESSORS_ONLN`+1)) + +Automated tests for memory leaks: +$ ctest -j$((NUMBER_OF_PROCESSORS + 1)) -D NightlyMemCheck && grep definitely Testing/Temporary/LastDynamicAnalysis_*.log + + Testing under MS Windows + +$ ctest -j$((NUMBER_OF_PROCESSORS + 1)) +Automated tests for memory leaks are not available as far as Valgrind not +present on this platform. + + Testing under BSD-based + +$ ctest +Automated tests for memory leaks are not available as far as Valgrind not +present on this platform. diff --git a/MAINTAINERS b/MAINTAINERS new file mode 100644 index 0000000..f2b408a --- /dev/null +++ b/MAINTAINERS @@ -0,0 +1,2 @@ +Kolan Sh +email: backbone@backbone.ws diff --git a/README b/README index 92cf5e3..54f23d0 100644 --- a/README +++ b/README @@ -1 +1 @@ -Desktop LAview Application. +LAview Desktop Application. diff --git a/cmake/backbone b/cmake/backbone new file mode 160000 index 0000000..126f4cc --- /dev/null +++ b/cmake/backbone @@ -0,0 +1 @@ +Subproject commit 126f4cc3fecf5f9c8ad3dd55edc164801f64482a diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt new file mode 100644 index 0000000..fed903d --- /dev/null +++ b/config/CMakeLists.txt @@ -0,0 +1,5 @@ +SET (GSchemaFile "ws.backbone.laview.desktop") +INCLUDE (GSchemaCommonRules) + +CONFIGURE_FILE ("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in" + "${CMAKE_CURRENT_BINARY_DIR}/config.h") diff --git a/config/Config.vapi b/config/Config.vapi new file mode 100644 index 0000000..24a890f --- /dev/null +++ b/config/Config.vapi @@ -0,0 +1,6 @@ +[CCode (cheader_filename = "config.h")] +namespace Config { + static const int VERSION_MAJOR; + static const int VERSION_MINOR; + static const int VERSION_PATCH; +} diff --git a/config/config.h.in b/config/config.h.in new file mode 100644 index 0000000..3c66f33 --- /dev/null +++ b/config/config.h.in @@ -0,0 +1,3 @@ +#define CONFIG_VERSION_MAJOR @MAJOR@ +#define CONFIG_VERSION_MINOR @MINOR@ +#define CONFIG_VERSION_PATCH @PATCH@ diff --git a/config/ws.backbone.laview.desktop.gschema.xml b/config/ws.backbone.laview.desktop.gschema.xml new file mode 100644 index 0000000..5b04dfa --- /dev/null +++ b/config/ws.backbone.laview.desktop.gschema.xml @@ -0,0 +1,23 @@ + + + + + "Hello, earthlings" + A greeting + Greeting of the invading martians + + + + 99 + Bottles of beer + Number of bottles of beer on the wall + + + + false + Is the light switched on? + State of an imaginary light switch. + + + + diff --git a/cpack/CMakeLists.txt b/cpack/CMakeLists.txt new file mode 100644 index 0000000..19d42ae --- /dev/null +++ b/cpack/CMakeLists.txt @@ -0,0 +1,14 @@ +SET (CONTACT "backbone@backbone.ws") +SET (DEBIAN_DEPENDENCIES "laview-core-0 >= 0.0.0") +SET (DEBIAN_SECTION "TeX") +SET (REDHAT_DEPENDENCIES "laview-core-0 >= 0.0.0") +SET (REDHAT_SECTION "Applications/Publishing") +SET (LICENSE "LGPLv3+") +SET (WIN32_UNINSTALL_NAME "LAvDesk") # <= 8 symbols for the name + +SET (CPACK_PACKAGE_EXECUTABLES "${PROJECT_LOWERCASE_NAME}-${MAJOR};LAview Desktop") +SET (CPACK_NSIS_INSTALLED_ICON_NAME bin\\\\${PROJECT_LOWERCASE_NAME}-${MAJOR}.exe) +SET (CPACK_CREATE_DESKTOP_LINKS "${PROJECT_LOWERCASE_NAME}-${MAJOR}") +SET (CPACK_NSIS_MENU_LINKS "https://redmine.backbone.ws/projects/laview/wiki" "Homepage for LAview Desktop") + +INCLUDE (CPackCommonRules) diff --git a/pkg-config/CMakeLists.txt b/pkg-config/CMakeLists.txt new file mode 100644 index 0000000..d349889 --- /dev/null +++ b/pkg-config/CMakeLists.txt @@ -0,0 +1,6 @@ +INCLUDE (PkgConfigCommonRules) + +CONFIGURE_FILE ( + "${CMAKE_SOURCE_DIR}/cmake/backbone/templates/pkg-config.pc.in" + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_LOWERCASE_NAME}-${MAJOR}.pc" +) diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt new file mode 100644 index 0000000..c191c1b --- /dev/null +++ b/po/CMakeLists.txt @@ -0,0 +1 @@ +INCLUDE (GettextCommonRules) diff --git a/po/de/CMakeLists.txt b/po/de/CMakeLists.txt new file mode 100644 index 0000000..0b6020c --- /dev/null +++ b/po/de/CMakeLists.txt @@ -0,0 +1 @@ +INCLUDE (GettextLangRules) diff --git a/po/de/laview-desktop.po b/po/de/laview-desktop.po new file mode 100644 index 0000000..1a3abfa --- /dev/null +++ b/po/de/laview-desktop.po @@ -0,0 +1,196 @@ +# German translations for laview-desktop package. +# Copyright (C) 2015 THE laview-desktop'S COPYRIGHT HOLDER +# This file is distributed under the same license as the laview-desktop package. +# , 2015. +# +msgid "" +msgstr "" +"Project-Id-Version: laview-desktop\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-12-27 19:03+0300\n" +"PO-Revision-Date: 2015-10-24 20:19+0300\n" +"Last-Translator: \n" +"Language-Team: German\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: config/ws.backbone.laview.desktop.gschema.xml.h:1 +msgid "\"Hello, earthlings\"" +msgstr "" + +#: config/ws.backbone.laview.desktop.gschema.xml.h:2 +msgid "A greeting" +msgstr "" + +#: config/ws.backbone.laview.desktop.gschema.xml.h:3 +msgid "Greeting of the invading martians" +msgstr "" + +#: config/ws.backbone.laview.desktop.gschema.xml.h:4 +msgid "Bottles of beer" +msgstr "" + +#: config/ws.backbone.laview.desktop.gschema.xml.h:5 +msgid "Number of bottles of beer on the wall" +msgstr "" + +#: config/ws.backbone.laview.desktop.gschema.xml.h:6 +msgid "Is the light switched on?" +msgstr "" + +#: config/ws.backbone.laview.desktop.gschema.xml.h:7 +msgid "State of an imaginary light switch." +msgstr "" + +#: src/MainWindow.vala:84 +msgid "Select templates" +msgstr "" + +#: src/MainWindow.vala:86 +msgid "_Cancel" +msgstr "" + +#: src/MainWindow.vala:87 +msgid "_Open" +msgstr "" + +#: src/main.vala:33 +msgid "Show the application's version" +msgstr "" + +#: src/main.vala:52 +msgid "[FILE]" +msgstr "" + +#: src/main.vala:64 +#, c-format +msgid "Error: %s\n" +msgstr "" + +#: src/main.vala:65 +#, c-format +msgid "Run '%s --help' to see a full list of available command line options.\n" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:1 +msgid "Kolan Sh (backbone@backbone.ws)" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:2 +msgid "LaTeX View or View Data in LaTeX." +msgstr "" + +#: ui/glade/laview-desktop.glade.h:3 +msgid "LAview" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:4 +msgid "Kolan Sh" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:5 +msgid "LAview Preferences" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:6 +msgid "Paths" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:7 +msgid "LyX path on Windows" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:8 +msgid "pdfLaTeX path on Windows" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:9 +msgid "Common" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:10 +msgid "Protocol Plugins" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:11 +msgid "Protocol plugins" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:12 +msgid "Data Plugins" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:13 +msgid "Data plugins" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:14 +msgid "LAview Desktop" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:15 +msgid "_Template" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:16 +msgid "_Document" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:17 +msgid "_Application" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:18 +msgid "_Help" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:19 +msgid "Create a new template" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:20 +msgid "Open a template" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:21 +msgid "Change selected template" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:22 +msgid "Delete selected template" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:23 +msgid "Document object preparing" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:24 +msgid "View and print the document" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:25 +msgid "Edit the result document" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:26 +msgid "Application preferences" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:27 +msgid "Help and reference" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:28 +msgid "Close the application" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:29 +msgid "Templates" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:30 +msgid "Document Objects" +msgstr "" diff --git a/po/laview-desktop.pot b/po/laview-desktop.pot new file mode 100644 index 0000000..93e18f7 --- /dev/null +++ b/po/laview-desktop.pot @@ -0,0 +1,196 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the laview-desktop package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: laview-desktop\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-12-27 19:04+0300\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: config/ws.backbone.laview.desktop.gschema.xml.h:1 +msgid "\"Hello, earthlings\"" +msgstr "" + +#: config/ws.backbone.laview.desktop.gschema.xml.h:2 +msgid "A greeting" +msgstr "" + +#: config/ws.backbone.laview.desktop.gschema.xml.h:3 +msgid "Greeting of the invading martians" +msgstr "" + +#: config/ws.backbone.laview.desktop.gschema.xml.h:4 +msgid "Bottles of beer" +msgstr "" + +#: config/ws.backbone.laview.desktop.gschema.xml.h:5 +msgid "Number of bottles of beer on the wall" +msgstr "" + +#: config/ws.backbone.laview.desktop.gschema.xml.h:6 +msgid "Is the light switched on?" +msgstr "" + +#: config/ws.backbone.laview.desktop.gschema.xml.h:7 +msgid "State of an imaginary light switch." +msgstr "" + +#: src/MainWindow.vala:84 +msgid "Select templates" +msgstr "" + +#: src/MainWindow.vala:86 +msgid "_Cancel" +msgstr "" + +#: src/MainWindow.vala:87 +msgid "_Open" +msgstr "" + +#: src/main.vala:33 +msgid "Show the application's version" +msgstr "" + +#: src/main.vala:52 +msgid "[FILE]" +msgstr "" + +#: src/main.vala:64 +#, c-format +msgid "Error: %s\n" +msgstr "" + +#: src/main.vala:65 +#, c-format +msgid "Run '%s --help' to see a full list of available command line options.\n" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:1 +msgid "Kolan Sh (backbone@backbone.ws)" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:2 +msgid "LaTeX View or View Data in LaTeX." +msgstr "" + +#: ui/glade/laview-desktop.glade.h:3 +msgid "LAview" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:4 +msgid "Kolan Sh" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:5 +msgid "LAview Preferences" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:6 +msgid "Paths" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:7 +msgid "LyX path on Windows" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:8 +msgid "pdfLaTeX path on Windows" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:9 +msgid "Common" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:10 +msgid "Protocol Plugins" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:11 +msgid "Protocol plugins" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:12 +msgid "Data Plugins" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:13 +msgid "Data plugins" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:14 +msgid "LAview Desktop" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:15 +msgid "_Template" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:16 +msgid "_Document" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:17 +msgid "_Application" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:18 +msgid "_Help" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:19 +msgid "Create a new template" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:20 +msgid "Open a template" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:21 +msgid "Change selected template" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:22 +msgid "Delete selected template" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:23 +msgid "Document object preparing" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:24 +msgid "View and print the document" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:25 +msgid "Edit the result document" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:26 +msgid "Application preferences" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:27 +msgid "Help and reference" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:28 +msgid "Close the application" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:29 +msgid "Templates" +msgstr "" + +#: ui/glade/laview-desktop.glade.h:30 +msgid "Document Objects" +msgstr "" diff --git a/po/ru/CMakeLists.txt b/po/ru/CMakeLists.txt new file mode 100644 index 0000000..0b6020c --- /dev/null +++ b/po/ru/CMakeLists.txt @@ -0,0 +1 @@ +INCLUDE (GettextLangRules) diff --git a/po/ru/laview-desktop.po b/po/ru/laview-desktop.po new file mode 100644 index 0000000..c3d622b --- /dev/null +++ b/po/ru/laview-desktop.po @@ -0,0 +1,197 @@ +# Russian translations for laview-desktop package. +# Copyright (C) 2015 THE laview-desktop'S COPYRIGHT HOLDER +# This file is distributed under the same license as the laview-desktop package. +# , 2015. +# +msgid "" +msgstr "" +"Project-Id-Version: laview-desktop\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-12-27 19:03+0300\n" +"PO-Revision-Date: 2015-10-24 20:19+0300\n" +"Last-Translator: \n" +"Language-Team: Russian\n" +"Language: ru\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" + +#: config/ws.backbone.laview.desktop.gschema.xml.h:1 +msgid "\"Hello, earthlings\"" +msgstr "\"Привет, земляне\"" + +#: config/ws.backbone.laview.desktop.gschema.xml.h:2 +msgid "A greeting" +msgstr "Приветствие" + +#: config/ws.backbone.laview.desktop.gschema.xml.h:3 +msgid "Greeting of the invading martians" +msgstr "Приветствие вторгнувшихся марсиан" + +#: config/ws.backbone.laview.desktop.gschema.xml.h:4 +msgid "Bottles of beer" +msgstr "Бутылки пива" + +#: config/ws.backbone.laview.desktop.gschema.xml.h:5 +msgid "Number of bottles of beer on the wall" +msgstr "Число бутылок пива на стене" + +#: config/ws.backbone.laview.desktop.gschema.xml.h:6 +msgid "Is the light switched on?" +msgstr "Включен ли свет?" + +#: config/ws.backbone.laview.desktop.gschema.xml.h:7 +msgid "State of an imaginary light switch." +msgstr "Состояние воображаемого выключателя света." + +#: src/MainWindow.vala:84 +msgid "Select templates" +msgstr "Выберите шаблоны" + +#: src/MainWindow.vala:86 +msgid "_Cancel" +msgstr "_Отмена" + +#: src/MainWindow.vala:87 +msgid "_Open" +msgstr "_Открыть" + +#: src/main.vala:33 +msgid "Show the application's version" +msgstr "Показать версию приложения" + +#: src/main.vala:52 +msgid "[FILE]" +msgstr "[ФАЙЛ]" + +#: src/main.vala:64 +#, c-format +msgid "Error: %s\n" +msgstr "Ошибка: %s\n" + +#: src/main.vala:65 +#, c-format +msgid "Run '%s --help' to see a full list of available command line options.\n" +msgstr "Запустите '%s --help', чтобы увидеть весь список доступных опций.\n" + +#: ui/glade/laview-desktop.glade.h:1 +msgid "Kolan Sh (backbone@backbone.ws)" +msgstr "Николай Ш (backbone@backbone.ws)" + +#: ui/glade/laview-desktop.glade.h:2 +msgid "LaTeX View or View Data in LaTeX." +msgstr "LaTeX вид или Представление данных в LaTeX." + +#: ui/glade/laview-desktop.glade.h:3 +msgid "LAview" +msgstr "LAview" + +#: ui/glade/laview-desktop.glade.h:4 +msgid "Kolan Sh" +msgstr "Николай Ш" + +#: ui/glade/laview-desktop.glade.h:5 +msgid "LAview Preferences" +msgstr "Параметры LAview" + +#: ui/glade/laview-desktop.glade.h:6 +msgid "Paths" +msgstr "Пути" + +#: ui/glade/laview-desktop.glade.h:7 +msgid "LyX path on Windows" +msgstr "Путь к LyX под Windows" + +#: ui/glade/laview-desktop.glade.h:8 +msgid "pdfLaTeX path on Windows" +msgstr "Путь к pdfLaTeX под Windows" + +#: ui/glade/laview-desktop.glade.h:9 +msgid "Common" +msgstr "Общие" + +#: ui/glade/laview-desktop.glade.h:10 +msgid "Protocol Plugins" +msgstr "Плагины протоколов" + +#: ui/glade/laview-desktop.glade.h:11 +msgid "Protocol plugins" +msgstr "Плагины протоколов" + +#: ui/glade/laview-desktop.glade.h:12 +msgid "Data Plugins" +msgstr "Плагины данных" + +#: ui/glade/laview-desktop.glade.h:13 +msgid "Data plugins" +msgstr "Плагины данных" + +#: ui/glade/laview-desktop.glade.h:14 +msgid "LAview Desktop" +msgstr "Рабочее окно LAview" + +#: ui/glade/laview-desktop.glade.h:15 +msgid "_Template" +msgstr "_Шаблон" + +#: ui/glade/laview-desktop.glade.h:16 +msgid "_Document" +msgstr "_Документ" + +#: ui/glade/laview-desktop.glade.h:17 +msgid "_Application" +msgstr "_Приложение" + +#: ui/glade/laview-desktop.glade.h:18 +msgid "_Help" +msgstr "_Помощь" + +#: ui/glade/laview-desktop.glade.h:19 +msgid "Create a new template" +msgstr "Создать новый шаблон" + +#: ui/glade/laview-desktop.glade.h:20 +msgid "Open a template" +msgstr "Открыть шаблон" + +#: ui/glade/laview-desktop.glade.h:21 +msgid "Change selected template" +msgstr "Изменить выбранный шаблон" + +#: ui/glade/laview-desktop.glade.h:22 +msgid "Delete selected template" +msgstr "Удалить выбранный шаблон" + +#: ui/glade/laview-desktop.glade.h:23 +msgid "Document object preparing" +msgstr "Подготовка объекта документа" + +#: ui/glade/laview-desktop.glade.h:24 +msgid "View and print the document" +msgstr "Просмотр и печать документа" + +#: ui/glade/laview-desktop.glade.h:25 +msgid "Edit the result document" +msgstr "Редактировать полученный документ" + +#: ui/glade/laview-desktop.glade.h:26 +msgid "Application preferences" +msgstr "Параметры приложения" + +#: ui/glade/laview-desktop.glade.h:27 +msgid "Help and reference" +msgstr "Помощь и справка" + +#: ui/glade/laview-desktop.glade.h:28 +msgid "Close the application" +msgstr "Закрыть приложение" + +#: ui/glade/laview-desktop.glade.h:29 +msgid "Templates" +msgstr "Шаблоны" + +#: ui/glade/laview-desktop.glade.h:30 +msgid "Document Objects" +msgstr "Объекты документа" diff --git a/res/CMakeLists.txt b/res/CMakeLists.txt new file mode 100644 index 0000000..5b562a0 --- /dev/null +++ b/res/CMakeLists.txt @@ -0,0 +1,7 @@ +INCLUDE (GResourceCommonRules) + +CONFIGURE_FILE ("${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_LOWERCASE_NAME}.desktop.in" + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_LOWERCASE_NAME}-${MAJOR}.desktop") +INSTALL (FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_LOWERCASE_NAME}-${MAJOR}.desktop" + DESTINATION "share/applications") +INSTALL (FILES "laview-desktop.png" DESTINATION "share/pixmaps") diff --git a/res/about.svg b/res/about.svg new file mode 100644 index 0000000..bd12d95 --- /dev/null +++ b/res/about.svg @@ -0,0 +1,262 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/laview-desktop.desktop.in b/res/laview-desktop.desktop.in new file mode 100644 index 0000000..122e7c1 --- /dev/null +++ b/res/laview-desktop.desktop.in @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=LAview Desktop @MAJOR@.@MINOR@.@PATCH@ +Comment=LAview Desktop Application +Exec=laview-desktop-@MAJOR@ %u +Icon=laview-desktop +Terminal=false +Type=Application +MimeType=laview/lyx; +Categories=Office; diff --git a/res/laview-desktop.gresource.xml b/res/laview-desktop.gresource.xml new file mode 100644 index 0000000..9dca2f5 --- /dev/null +++ b/res/laview-desktop.gresource.xml @@ -0,0 +1,8 @@ + + + + about.svg + + + + diff --git a/res/laview-desktop.ico b/res/laview-desktop.ico new file mode 100644 index 0000000..03bbdfb Binary files /dev/null and b/res/laview-desktop.ico differ diff --git a/res/laview-desktop.png b/res/laview-desktop.png new file mode 100644 index 0000000..157c4bd Binary files /dev/null and b/res/laview-desktop.png differ diff --git a/res/laview-desktop.rc b/res/laview-desktop.rc new file mode 100644 index 0000000..6d8da22 --- /dev/null +++ b/res/laview-desktop.rc @@ -0,0 +1 @@ +IDR_MAINFRAME ICON "laview-desktop.ico" diff --git a/src/AboutWindow.vala b/src/AboutWindow.vala new file mode 100644 index 0000000..d686768 --- /dev/null +++ b/src/AboutWindow.vala @@ -0,0 +1,37 @@ +namespace LAview.Desktop { + + using Gtk; + + /** + * About dialog. + */ + public class AboutDialogWindow { + AboutDialog dialog; + + public AboutDialogWindow (Window parent) throws Error { + var builder = new Builder (); + builder.add_from_file (AppDirs.ui_dir + "/laview-desktop.glade"); + builder.connect_signals (this); + + dialog = builder.get_object ("aboutdialog_window") as AboutDialog; + dialog.set_destroy_with_parent (true); + dialog.set_transient_for (parent); + dialog.set_modal (true); + dialog.delete_event.connect ((source) => {return true;}); + + dialog.version = @" $(Config.VERSION_MAJOR).$(Config.VERSION_MINOR).$(Config.VERSION_PATCH)"; + + dialog.response.connect ((response_id) => { + if (response_id == Gtk.ResponseType.CANCEL || response_id == Gtk.ResponseType.DELETE_EVENT) { + dialog.hide_on_delete (); + } + }); + + dialog.logo = new Gdk.Pixbuf.from_resource_at_scale ("/ws/backbone/laview/desktop/about.svg", 256, 256, true); + } + + public void show_all () { + dialog.show_all (); + } + } +} diff --git a/src/AppCore.vala b/src/AppCore.vala new file mode 100644 index 0000000..cb8a9bc --- /dev/null +++ b/src/AppCore.vala @@ -0,0 +1,10 @@ +namespace LAview.Desktop { + + class AppCore { + public static LAview.Core.Core core; + + public static void init (string[] args) throws Error { + core = new LAview.Core.Core(); + } + } +} diff --git a/src/AppDirs.vala b/src/AppDirs.vala new file mode 100644 index 0000000..bf33f3e --- /dev/null +++ b/src/AppDirs.vala @@ -0,0 +1,31 @@ +namespace LAview.Desktop { + + class AppDirs { + private const string DEFAULT_DATA_DIR = ".texreport-gtk"; + + public static File exec_file; + public static File exec_dir; + public static File common_dir; + public static string resource_dir; + public static string ui_dir; + public static string locale_dir; + public static string settings_dir; + + public static void init (string[] args) { + exec_file = File.new_for_path (Environment.find_program_in_path (args[0])); + exec_dir = exec_file.get_parent (); + common_dir = exec_dir.get_parent (); + resource_dir = Path.build_path (Path.DIR_SEPARATOR_S, common_dir.get_path(), + "share/laview-desktop-"+Config.VERSION_MAJOR.to_string()); + ui_dir = resource_dir + "/ui"; + locale_dir = Path.build_path (Path.DIR_SEPARATOR_S, common_dir.get_path(), "share/locale"); + settings_dir = Path.build_path (Path.DIR_SEPARATOR_S, common_dir.get_path(), "share/glib-2.0/schemas"); + string w32dhack_sdir = settings_dir+"/laview-desktop-"+Config.VERSION_MAJOR.to_string(); + if (File.new_for_path(w32dhack_sdir+"/gschemas.compiled").query_exists ()) + settings_dir = w32dhack_sdir; + } + + public static void terminate () { + } + } +} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..0b30aea --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,16 @@ +SET (BinName laview-desktop-${MAJOR}) +FILE (GLOB_RECURSE BinSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.vala) +SET (BinPackages gtk+-3.0 gee-0.8 gobject-plugin-iface-0 laview-core-iface-0 laview-core-0 posix) +SET (BinPkgModules gtk+-3.0 gee-0.8 laview-core-0) +SET (BinCustomVapis ${CMAKE_SOURCE_DIR}/config/Config.vapi) +INCLUDE_DIRECTORIES ("${CMAKE_BINARY_DIR}/config") +SET (BinInstall ON) +SET (BinExtraSources "${CMAKE_SOURCE_DIR}/res/laview-desktop.rc") +IF (WIN32) + SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mwindows") + SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--export-all-symbols") + SET (BinValaOpts -D WINDOWS) +ELSE (WIN32) + SET (BinValaOpts -D UNIX) +ENDIF (WIN32) +INCLUDE (ValaBinCommonRules) diff --git a/src/MainWindow.vala b/src/MainWindow.vala new file mode 100644 index 0000000..099d49c --- /dev/null +++ b/src/MainWindow.vala @@ -0,0 +1,256 @@ +namespace LAview.Desktop { + + using Gtk, LAview, Core; + + /** + * Main LAview Desktop window. + */ + public class MainWindow { + + Window window; + PreferencesDialog pref_dialog; + AboutDialogWindow about_dialog; + SubprocessDialog subprocess_dialog; + Gtk.Statusbar statusbar; + Gtk.ListStore liststore_templates; + Gtk.ListStore liststore_doc_objects; + TreeView treeview_templates; + TreeView treeview_objects; + + public MainWindow () throws Error { + var builder = new Builder (); + builder.add_from_file (AppDirs.ui_dir + "/laview-desktop.glade"); + builder.connect_signals (this); + + window = builder.get_object ("main_window") as Window; + statusbar = builder.get_object ("statusbar") as Statusbar; + liststore_templates = builder.get_object ("liststore_templates") as Gtk.ListStore; + liststore_doc_objects = builder.get_object ("liststore_objects") as Gtk.ListStore; + treeview_templates = builder.get_object ("treeview_templates") as TreeView; + treeview_objects = builder.get_object ("treeview_objects") as TreeView; + window.title = "LAview Desktop" + + @" $(Config.VERSION_MAJOR).$(Config.VERSION_MINOR).$(Config.VERSION_PATCH)"; + + pref_dialog = new PreferencesDialog (window); + subprocess_dialog = new SubprocessDialog (window); + about_dialog = new AboutDialogWindow (window); + + fill_liststore_templates (); + } + + void fill_liststore_templates () { + var templates = AppCore.core.get_templates_readable_names (); + liststore_templates.clear(); + Gtk.TreeIter iter = Gtk.TreeIter(); + foreach (var t in templates) { + liststore_templates.append (out iter); + liststore_templates.set (iter, 0, t); + } + } + + void statusbar_show (string str) { + var context_id = statusbar.get_context_id ("common_context"); + statusbar.push (context_id, str); + } + + public void show_all () { + window.show_all (); + statusbar_show ("We're ready, Commander! Select or create a template. :-)"); + } + + [CCode (instance_pos = -1)] + public void menu_about_activate (Gtk.ImageMenuItem item) { + about_dialog.show_all (); + } + + [CCode (instance_pos = -1)] + public void action_new_activate (Gtk.Action action) { + string[] argv = { AppCore.core.lyx_path, "--execute", "buffer-new" }; + try { + var subprocess = new SubprocessLauncher( SubprocessFlags.STDIN_PIPE + | SubprocessFlags.STDOUT_PIPE + | SubprocessFlags.STDERR_PIPE); + subprocess.spawnv(argv); + } catch (Error err) { + var msg = new MessageDialog (window, DialogFlags.MODAL, MessageType.ERROR, + ButtonsType.CLOSE, @"Error: $(err.message)."); + msg.response.connect ((response_id) => { msg.destroy (); } ); + msg.show (); + } + } + + [CCode (instance_pos = -1)] + public void action_open_activate (Gtk.Action action) { + FileChooserDialog chooser = new Gtk.FileChooserDialog (_("Select templates"), window, + FileChooserAction.OPEN, + _("_Cancel"), ResponseType.CANCEL, + _("_Open"), ResponseType.ACCEPT); + chooser.select_multiple = true; + FileFilter filter = new FileFilter (); + chooser.set_filter (filter); + filter.add_mime_type ("application/x-tex"); + filter.add_mime_type ("application/x-latex"); + filter.add_mime_type ("application/x-lyx"); + filter.add_pattern ("*.tex"); + filter.add_pattern ("*.latex"); + filter.add_pattern ("*.lyx"); + + if (chooser.run () == ResponseType.ACCEPT) { + SList paths = chooser.get_filenames (); + + foreach (unowned string path in paths) + AppCore.core.add_template (path); + + fill_liststore_templates (); + } + + chooser.close (); + } + + void edit_lyx_files (string[] paths) { + string[] args = { AppCore.core.lyx_path, "--remote" }; + foreach (var p in paths) args += p; + try { + var subprocess = new SubprocessLauncher( SubprocessFlags.STDIN_PIPE + | SubprocessFlags.STDOUT_PIPE + | SubprocessFlags.STDERR_PIPE); + subprocess.spawnv(args); + } catch (Error err) { + var msg = new MessageDialog (window, DialogFlags.MODAL, MessageType.ERROR, + ButtonsType.CLOSE, @"Error: $(err.message)."); + msg.response.connect ((response_id) => { msg.destroy (); } ); + msg.show (); + } + } + + int[] get_template_indices () { + var selection = treeview_templates.get_selection (); + var selected_rows = selection.get_selected_rows (null); + int[] indices = {}; + foreach (var r in selected_rows) { + indices += r.get_indices()[0]; + } + return indices; + } + + [CCode (instance_pos = -1)] + public void action_edit_template_activate (Gtk.Action action) { + edit_selected_templates (); + } + + [CCode (instance_pos = -1)] + public void action_delete_activate (Gtk.Action action) { + var indices = get_template_indices (); + for (int i = indices.length; i > 0; ) + AppCore.core.remove_template (indices[--i]); + fill_liststore_templates (); + } + + int[] get_objects_indices () { + var selection = treeview_objects.get_selection (); + var selected_rows = selection.get_selected_rows (null); + int[] indices = {}; + foreach (var r in selected_rows) { + indices += r.get_indices()[0]; + } + return indices; + } + + [CCode (instance_pos = -1)] + public void action_compose_activate (Gtk.Action action) { + var t_indices = get_template_indices (); + var o_indices = get_objects_indices (); + if (t_indices.length != 0 && o_indices.length != 0) { + AppCore.core.compose_object (t_indices[0], o_indices[0]); + } + statusbar_show ("After composing all objects print the document."); + } + + [CCode (instance_pos = -1)] + public void action_edit_result_activate (Gtk.Action action) { + var indices = get_template_indices(); + if (indices.length != 0) { + var lyx_path = AppCore.core.get_lyx_file_path (indices[0]); + edit_lyx_files ({ lyx_path }); + } + } + + void post_print () { + var indices = get_template_indices(); + var pdf_file = AppCore.core.get_pdf_file_path (indices[0]); + Utils.open_document (pdf_file, window); + } + + [CCode (instance_pos = -1)] + public void action_print_activate (Gtk.Action action) { + var indices = get_template_indices(); + if (indices.length != 0) { + try { + subprocess_dialog.show_all (AppCore.core.print_document (indices[0]), + "=== Print to PDF file... ===\n", + post_print); + } catch (Error err) { + var msg = new MessageDialog (window, DialogFlags.MODAL, MessageType.ERROR, + ButtonsType.CLOSE, @"Error: $(err.message)."); + msg.response.connect ((response_id) => { msg.destroy (); } ); + msg.show (); + } + } + } + + [CCode (instance_pos = -1)] + public void action_preferences_activate (Gtk.Action action) { + pref_dialog.show_all (); + } + + [CCode (instance_pos = -1)] + public void action_ref_activate (Gtk.Action action) { + try { + show_uri (null, "https://redmine.backbone.ws/projects/laview/wiki", Gdk.CURRENT_TIME); + } catch (Error err) { + var msg = new MessageDialog (window, DialogFlags.MODAL, MessageType.ERROR, + ButtonsType.CLOSE, @"Error: $(err.message)."); + msg.response.connect ((response_id) => { msg.destroy (); } ); + msg.show (); + } + } + + void edit_selected_templates () { + var indices = get_template_indices (); + if (indices.length != 0) { + string[] paths = {}; + foreach (var i in indices) { + paths += AppCore.core.get_template_path_by_index (i); + } + edit_lyx_files (paths); + } + } + + [CCode (instance_pos = -1)] + public void templates_row_activated (Gtk.TreeView treeview, + Gtk.TreePath path, + Gtk.TreeViewColumn column) { + edit_selected_templates (); + } + + [CCode (instance_pos = -1)] + public void templates_cursor_changed (Gtk.TreeView treeview) { + var indices = get_template_indices (); + if (indices.length != 0) { + var doc_objects = AppCore.core.get_objects_list (indices[0]); + liststore_doc_objects.clear(); + Gtk.TreeIter iter = Gtk.TreeIter(); + foreach (var t in doc_objects) { + liststore_doc_objects.append (out iter); + liststore_doc_objects.set (iter, 0, t); + } + } + statusbar_show ("Document analized, select an object and set it's properties."); + } + + [CCode (instance_pos = -1)] + public void objects_cursor_changed (Gtk.TreeView treeview) { + statusbar_show ("Press 'Properties' button to compose the object."); + } + } +} diff --git a/src/PreferencesWindow.vala b/src/PreferencesWindow.vala new file mode 100644 index 0000000..75022c1 --- /dev/null +++ b/src/PreferencesWindow.vala @@ -0,0 +1,77 @@ +namespace LAview.Desktop { + + using Gtk; + + /** + * Preferences window. + */ + public class PreferencesDialog { + Dialog dialog; + Gtk.ListStore liststore_data; + Gtk.ListStore liststore_protocols; + FileChooserButton filechooserbutton_lyx; + FileChooserButton filechooserbutton_pdflatex; + + public PreferencesDialog (Window parent) throws Error { + var builder = new Builder (); + builder.add_from_file (AppDirs.ui_dir + "/laview-desktop.glade"); + builder.connect_signals (this); + + dialog = builder.get_object ("preferences_window") as Dialog; + dialog.set_transient_for (parent); + dialog.set_modal (true); + dialog.delete_event.connect ((source) => {return true;}); + liststore_data = builder.get_object ("liststore_data") as Gtk.ListStore; + liststore_protocols = builder.get_object ("liststore_protocols") as Gtk.ListStore; + filechooserbutton_lyx = builder.get_object ("filechooserbutton_lyx") as FileChooserButton; + filechooserbutton_pdflatex = builder.get_object ("filechooserbutton_pdflatex") as FileChooserButton; + + fill_liststore_data (); + fill_liststore_protocols (); + + filechooserbutton_lyx.set_filename (AppCore.core.lyx_path); + filechooserbutton_pdflatex.set_filename (AppCore.core.pdflatex_path); + } + + void fill_liststore_data () { + var data_plugins = AppCore.core.get_data_plugins (); + + liststore_data.clear(); + TreeIter iter = TreeIter(); + foreach (var p in data_plugins.entries) { + liststore_data.append (out iter); + liststore_data.set (iter, 0, p.value.get_readable_name ()); + } + } + + void fill_liststore_protocols () { + var protocol_plugins = AppCore.core.get_protocol_plugins (); + + liststore_protocols.clear(); + TreeIter iter = TreeIter(); + foreach (var p in protocol_plugins.entries) { + liststore_protocols.append (out iter); + liststore_protocols.set (iter, 0, p.value.get_readable_name ()); + } + } + + public void show_all () { + dialog.show_all (); + } + + [CCode (instance_pos = -1)] + public void button_close_clicked (Button button) { + dialog.hide (); + } + + [CCode (instance_pos = -1)] + public void lyx_file_set (FileChooserButton chooser) { + AppCore.core.lyx_path = chooser.get_filename (); + } + + [CCode (instance_pos = -1)] + public void pdflatex_file_set (FileChooserButton chooser) { + AppCore.core.pdflatex_path = chooser.get_filename (); + } + } +} diff --git a/src/Resources.vala b/src/Resources.vala new file mode 100644 index 0000000..75e495a --- /dev/null +++ b/src/Resources.vala @@ -0,0 +1,11 @@ +namespace LAview.Desktop { + class Resources { + public static Resource resource; + + public static void init (string[] args) throws Error { + var resource_file = AppDirs.resource_dir+"/laview-desktop.gresource"; + resource = Resource.load (resource_file); + resource._register(); + } + } +} diff --git a/src/Settings.vala b/src/Settings.vala new file mode 100644 index 0000000..fb43e15 --- /dev/null +++ b/src/Settings.vala @@ -0,0 +1,15 @@ +namespace LAview.Desktop { + + class AppSettings { + //public static GLib.Settings settings; + + public static void init (string[] args) throws Error { + SettingsSchemaSource sss = new SettingsSchemaSource.from_directory (AppDirs.settings_dir, null, false); + //SettingsSchema schema = sss.lookup ("ws.backbone.laview.desktop-"+Config.VERSION_MAJOR.to_string(), false); + if (sss.lookup == null) + throw new FileError.NOENT ("Schema ID not found"); + + //settings = new Settings.full (schema, null, null); + } + } +} diff --git a/src/SubprocessDialog.vala b/src/SubprocessDialog.vala new file mode 100644 index 0000000..45ed139 --- /dev/null +++ b/src/SubprocessDialog.vala @@ -0,0 +1,69 @@ +namespace LAview.Desktop { + + using Gtk; + + /** + * Subprocess window. + */ + public class SubprocessDialog { + Dialog dialog; + TextView textview_stderrout; + Subprocess sp; + unowned PostProcessDelegate ppdelegate; + + public delegate void PostProcessDelegate (); + + public SubprocessDialog (Window parent) throws Error { + var builder = new Builder (); + builder.add_from_file (AppDirs.ui_dir + "/laview-desktop.glade"); + builder.connect_signals (this); + + dialog = builder.get_object ("subprocess_dialog") as Dialog; + dialog.set_transient_for (parent); + dialog.set_modal (true); + dialog.delete_event.connect ((source) => {return true;}); + textview_stderrout = builder.get_object ("textview_stderrout") as TextView; + } + + async void subprocess_async () { + try { + var ds_out = new DataInputStream(sp.get_stdout_pipe()); + try { + for (string s = yield ds_out.read_line_async(); s != null; s = yield ds_out.read_line_async()) + textview_stderrout.buffer.text += s + "\n"; + } catch (IOError err) { + assert_not_reached(); + } + if ((sp.wait_check()) == false) throw new IOError.FAILED("Error running subprocess."); + ppdelegate (); + dialog.hide (); + + } catch (Error err) { + textview_stderrout.buffer.text += @"Error: $(err.message)"; + if (sp != null) { + var ds_err = new DataInputStream(sp.get_stderr_pipe()); + try { + for (string s = yield ds_err.read_line_async(); s != null; s = yield ds_err.read_line_async()) + textview_stderrout.buffer.text += s + "\n"; + } catch (IOError err) { + assert_not_reached(); + } + } + } + } + + public void show_all (Subprocess sp, string message, PostProcessDelegate ppdelegate) { + this.sp = sp; + textview_stderrout.buffer.text = message; + this.ppdelegate = ppdelegate; + dialog.show_all (); + subprocess_async.begin (); + } + + [CCode (instance_pos = -1)] + public void button_stop_clicked (Button button) { + sp.force_exit (); + dialog.hide (); + } + } +} diff --git a/src/Utils.vala b/src/Utils.vala new file mode 100644 index 0000000..24c8668 --- /dev/null +++ b/src/Utils.vala @@ -0,0 +1,72 @@ +namespace LAview.Desktop { + + namespace Utils { + + using Gtk; + + /** + * Resolve a path beginning with "~" + * Look at: https://github.com/ssokolow/gvrun/blob/master/process_runner.vala#L86 + */ + #if (linux || UNIX || __unix__) + static string expand_tilde (string path) { + if (!path.has_prefix ("~")) return path; // Just pass paths through if they don't start with ~ + + // Split the ~user portion from the path (Use / for the path if not present) + string parts[2]; + if (!(Path.DIR_SEPARATOR_S in path)) { + parts = { path.substring(1), Path.DIR_SEPARATOR_S }; + } else { + string trimmed = path.substring(1); + parts = trimmed.split(Path.DIR_SEPARATOR_S, 2); + } + warn_if_fail(parts.length == 2); + + // Handle both "~" and "~user" forms + string home_path; + if (parts[0] == "") { + home_path = Environment.get_variable("HOME") ?? Environment.get_home_dir(); + } else { + unowned Posix.Passwd _pw = Posix.getpwnam(parts[0]); + home_path = (_pw == null) ? null : _pw.pw_dir; + } + + // Fail safely if we couldn't look up a homedir + if (home_path == null) { + warning("Could not get homedir for user: %s", parts[0].length > 0 ? parts[0] : ""); + return path; + } else { + return home_path + Path.DIR_SEPARATOR_S + parts[1]; + } + } + #endif + + /** + * Open document. + * Idea borrowed from: https://github.com/ssokolow/gvrun/blob/master/process_runner.vala + */ + void open_document (string path, Window? parent_window = null) { + #if (UNIX) + const string[] OPENERS = {"xdg-open", "mimeopen", "open"}; + foreach (var opener in OPENERS) { + if (Environment.find_program_in_path (opener) != null) { + try { + string[] argv = { opener, expand_tilde (path) }; + Process.spawn_async(null, argv, null, SpawnFlags.SEARCH_PATH, null, null); + } catch (SpawnError err) { + var msg = new MessageDialog (parent_window, DialogFlags.MODAL, MessageType.ERROR, + ButtonsType.CLOSE, @"Error: $(err.message)."); + msg.response.connect ((response_id) => { msg.destroy (); } ); + msg.show (); + } + break; + } + } + #elif (WINDOWS) + Posix.system (@"start $path"); + #else + assert_not_reached (); + #endif + } + } +} diff --git a/src/main.vala b/src/main.vala new file mode 100644 index 0000000..b140d9b --- /dev/null +++ b/src/main.vala @@ -0,0 +1,72 @@ +extern const string GETTEXT_PACKAGE; + +namespace LAview.Desktop { + + using Gtk, LAview.Desktop; + + namespace CommandlineOptions { + // bool no_startup_progress = false; + // string data_dir = null; + bool show_version = false; + // bool no_runtime_monitoring = false; + + OptionEntry[]? entries = null; + + OptionEntry[] get_options() { + if (entries != null) + return entries; + + // OptionEntry datadir = { "datadir", 'd', 0, OptionArg.FILENAME, &data_dir, + // N_("Path to LAview-Desktop's private data"), N_("DIRECTORY") }; + // entries += datadir; + + // OptionEntry no_monitoring = { "no-runtime-monitoring", 0, 0, OptionArg.NONE, &no_runtime_monitoring, + // N_("Do not monitor library directory at runtime for changes"), null }; + // entries += no_monitoring; + + // OptionEntry no_startup = { "no-startup-progress", 0, 0, OptionArg.NONE, + // &no_startup_progress, + // N_("Don't display startup progress meter"), null }; + // entries += no_startup; + + OptionEntry version = { "version", 'V', 0, OptionArg.NONE, &show_version, + N_("Show the application's version"), null }; + entries += version; + + OptionEntry terminator = { null, 0, 0, 0, null, null, null }; + entries += terminator; + + return entries; + } + } + + void main (string[] args) { + + try { + + AppDirs.init (args); + AppSettings.init (args); + AppCore.init (args); + Resources.init (args); + + Gtk.init_with_args (ref args, _("[FILE]"), CommandlineOptions.get_options (), GETTEXT_PACKAGE); + + // Internationalization + Intl.bindtextdomain (GETTEXT_PACKAGE, AppDirs.locale_dir); + Intl.bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + + var main_window = new MainWindow (); + main_window.show_all (); + + Gtk.main (); + + } catch (Error e) { + stderr.printf (_("Error: %s\n"), e.message); + stderr.printf (_("Run '%s --help' to see a full list of available command line options.\n"), args[0]); + } + + AppDirs.terminate(); + + return; + } +} diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..e69de29 diff --git a/ui/CMakeLists.txt b/ui/CMakeLists.txt new file mode 100644 index 0000000..fc14716 --- /dev/null +++ b/ui/CMakeLists.txt @@ -0,0 +1 @@ +ADD_SUBDIRECTORY (glade) diff --git a/ui/glade/CMakeLists.txt b/ui/glade/CMakeLists.txt new file mode 100644 index 0000000..548088d --- /dev/null +++ b/ui/glade/CMakeLists.txt @@ -0,0 +1,2 @@ +SET (GladeFile ${PROJECT_LOWERCASE_NAME}) +INCLUDE (GladeCommonRules) diff --git a/ui/glade/laview-desktop.glade b/ui/glade/laview-desktop.glade new file mode 100644 index 0000000..01cfc9c --- /dev/null +++ b/ui/glade/laview-desktop.glade @@ -0,0 +1,1134 @@ + + + + + + False + dialog + LAview Desktop + Kolan Sh (backbone@backbone.ws) + LaTeX View or View Data in LaTeX. + https://redmine.backbone.ws/projects/laview + LAview + Kolan Sh + Kolan Sh + Kolan Sh + Kolan Sh + image-missing + lgpl-3-0 + + + False + vertical + 2 + + + False + end + + + False + False + 0 + + + + + + + + + + + + drive-optical + True + + + + + + True + + + + + + True + + + + + + True + + + + + + True + + + + + + True + + + + + + True + + + + + + True + + + + + + True + + + + + + + *.lyx + *.tex + + + + + + + + + + + + + + + + + + + + + + 640 + 480 + False + LAview Preferences + dialog + + + False + vertical + 2 + + + False + end + + + gtk-close + True + True + True + True + + + + True + True + 0 + + + + + False + False + 0 + + + + + True + True + True + True + + + True + False + 8 + 8 + 8 + 8 + + + True + False + + + True + False + Paths + 0 + + + + + + 0 + 0 + 2 + + + + + True + False + LyX path on Windows + 0 + + + 0 + 1 + + + + + True + False + pdfLaTeX path on Windows + 0 + + + 0 + 2 + + + + + True + False + True + + + + 1 + 1 + + + + + True + False + True + + + + 1 + 2 + + + + + + + + + True + False + Common + + + False + + + + + True + False + vertical + + + True + True + in + + + True + True + liststore_protocols + + + + + + Protocol Plugins + + + + 0 + + + + + + + + + True + True + 0 + + + + + 1 + + + + + True + False + Protocol plugins + + + 1 + False + + + + + True + False + vertical + + + True + True + in + + + True + True + liststore_data + + + + + + Data Plugins + + + + 0 + + + + + + + + + True + True + 0 + + + + + 2 + + + + + True + False + Data plugins + + + 2 + False + + + + + True + True + 1 + + + + + + + + + + + + + 640 + 480 + False + 3 + 4 + LAview Desktop + + + + True + False + vertical + + + True + False + + + False + True + False + _Template + True + + + True + False + + + gtk-new + False + action_new + True + False + True + True + True + + + + + gtk-open + False + action_open + True + False + True + True + True + + + + + gtk-edit + False + action_edit_template + True + False + True + True + True + + + + + gtk-delete + False + action_delete + True + False + True + True + True + + + + + False + True + False + + + + + gtk-quit + False + True + False + True + True + True + + + + + + + + + + False + True + False + _Document + True + + + True + False + + + gtk-properties + False + action_prepare + True + False + 0.97999999999999998 + True + True + True + + + + + gtk-print + False + action_print + True + False + True + True + True + + + + + gtk-edit + False + action_edit_result + True + False + True + True + True + + + + + + + + + False + True + False + _Application + True + + + True + False + + + gtk-preferences + False + action_preferences + True + False + True + True + True + + + + + + + + + False + True + False + _Help + True + + + True + False + + + gtk-help + False + action_ref + True + False + True + True + True + + + + + gtk-about + False + True + False + True + True + True + + + + + + + + + + False + True + 0 + + + + + True + False + both + + + False + action_new + True + False + Create a new template + True + gtk-new + + + False + True + + + + + False + action_open + True + False + Open a template + True + gtk-open + + + False + True + + + + + False + action_edit_template + True + False + Change selected template + _Template + True + gtk-edit + + + False + True + + + + + False + action_delete + True + False + Delete selected template + True + gtk-delete + + + False + True + + + + + True + False + + + False + False + + + + + False + action_prepare + True + False + Document object preparing + True + gtk-properties + + + False + True + + + + + False + action_print + True + False + View and print the document + True + gtk-print + + + False + True + + + + + False + action_edit_result + True + False + Edit the result document + _Document + True + gtk-edit + + + False + True + + + + + True + False + + + False + False + + + + + False + action_preferences + True + False + Application preferences + True + gtk-preferences + + + False + True + + + + + False + action_ref + True + False + Help and reference + True + gtk-help + + + False + True + + + + + True + False + + + False + False + + + + + True + False + Close the application + True + gtk-quit + + + + False + True + + + + + False + True + 1 + + + + + True + False + True + + + True + False + vertical + + + True + True + 2 + in + + + True + True + liststore_templates + + + + + multiple + + + + + Templates + + + + 0 + + + + + + + + + True + True + 0 + + + + + True + False + 3 + 3 + immediate + True + + + gtk-new + False + action_new + True + True + True + True + True + + + True + True + 0 + + + + + gtk-open + False + action_open + True + True + True + True + True + + + True + True + 1 + + + + + gtk-edit + False + action_edit_template + True + True + True + True + True + + + True + True + 2 + + + + + gtk-delete + False + action_delete + True + True + True + immediate + True + True + + + True + True + 3 + + + + + False + True + 1 + + + + + True + True + 0 + + + + + True + False + vertical + + + True + True + 2 + in + + + True + True + liststore_objects + + + + + + + Document Objects + + + + 0 + + + + + + + + + True + True + 0 + + + + + True + False + 3 + 3 + True + + + gtk-properties + False + action_prepare + True + True + True + True + True + 0.44999998807907104 + True + + + True + True + 0 + + + + + gtk-print + False + action_print + True + True + True + True + True + + + True + True + 1 + + + + + gtk-edit + False + action_edit_result + True + True + True + True + True + + + False + True + 2 + + + + + False + True + 1 + + + + + True + True + 1 + + + + + True + True + 2 + + + + + True + False + vertical + 2 + + + False + True + end + 3 + + + + + + + 640 + 480 + False + dialog + + + False + vertical + 2 + + + False + end + + + gtk-stop + True + True + True + True + True + + + + True + True + 0 + + + + + False + False + 0 + + + + + True + True + in + + + True + True + False + False + False + + + + + True + True + 1 + + + + + + diff --git a/util/backbone b/util/backbone new file mode 160000 index 0000000..11c998a --- /dev/null +++ b/util/backbone @@ -0,0 +1 @@ +Subproject commit 11c998aca2aa1b787286b336e579e5a4e31f471a diff --git a/valadoc_env b/valadoc_env new file mode 100644 index 0000000..0a8c6c7 --- /dev/null +++ b/valadoc_env @@ -0,0 +1,2 @@ +BASEDIR=src config +PKGS=gtk+-3.0 laview-core-0 laview-core-iface-0 gobject-plugin-iface-0 gobject-plugin-loader-0 gmodule-2.0 gee-0.8