diff --git a/src/conv/main.vala b/src/conv/main.vala index 0520644..50e9922 100644 --- a/src/conv/main.vala +++ b/src/conv/main.vala @@ -16,20 +16,41 @@ namespace LAview { * File format converter (lyx, tex, pdf). */ public class Converter : Object { + /** + * Path to the LyX executable. + */ public string lyx_path { get; construct; } + + /** + * Path to latexmk.pl executable. + */ public string latexmk_pl_path { get; construct; } + + /** + * Path to the Perl executable. + */ public string perl_path { get; construct; } /** * Constructs a new ``Converter``. */ public Converter () { Object(lyx_path: "lyx", latexmk_pl_path: "latexmk", perl_path: "perl"); } + + /** + * Constructs a new ``Converter``. + * @param lyx_path path to the LyX executable. + * @param latexmk_pl_path path to latexmk.pl executable. + * @param perl_path path to Perl executable. + */ public Converter.new_with_paths (string lyx_path, string latexmk_pl_path, string perl_path) { Object(lyx_path: lyx_path, latexmk_pl_path: latexmk_pl_path, perl_path: perl_path); } /** * LyX->TeX conversion. + * @param lyx_file path to LyX source. + * @param tex_path path to LaTeX output. + * @throws Error any conversion error. */ public Subprocess lyx2tex (string lyx_file, string tex_path) throws Error { /* check paths */ @@ -46,6 +67,9 @@ namespace LAview { /** * TeX->LyX conversion. + * @param tex_file path to LaTeX source. + * @param lyx_file_path path to LyX output. + * @throws Error any conversion error. */ public Subprocess tex2lyx (string tex_file, string lyx_file_path) throws Error { /* check paths */ @@ -66,6 +90,9 @@ namespace LAview { /** * LyX->PDF conversion. + * @param lyx_file path to LyX source. + * @param pdf_path path to PDF output. + * @throws Error any conversion error. */ public Subprocess lyx2pdf (string lyx_file, string pdf_path) throws Error { /* check paths */ @@ -82,6 +109,9 @@ namespace LAview { /** * TeX->PDF conversion. + * @param tex_file path to LaTeX source. + * @param pdf_path path to PDF output. + * @throws Error any conversion error. */ public Subprocess tex2pdf (string tex_file, string pdf_path) throws Error { /* check paths */ diff --git a/src/core-iface/CoreInterface.vala b/src/core-iface/CoreInterface.vala index e898508..1bb0625 100644 --- a/src/core-iface/CoreInterface.vala +++ b/src/core-iface/CoreInterface.vala @@ -19,6 +19,7 @@ namespace LAview.Core { /** * Get data object. + * @param name data object name. */ public abstract PluginData get_data_object (string name); } @@ -61,6 +62,9 @@ namespace LAview.Core { /** * Compose the object. + * @param parent parent Object/Window. + * @param answers answers values. + * @throws Error any compose error. */ public abstract bool compose (Object parent, Gee.HashMap answers) throws Error; @@ -74,31 +78,58 @@ namespace LAview.Core { * Request Answer Value. */ public abstract class AnswerValue : Object { + /** + * Constructs a new ``AnswerValue``. + */ + public AnswerValue () { } } /** - * String. + * String Answer. */ public class AnswerString : AnswerValue { + /** + * String value. + */ public string value; + /** + * Constructs a new ``AnswerString``. + * @param value string value. + */ public AnswerString (string value = "") { this.value = value; } } /** - * 1D Array. + * 1D Array Answer. */ public class AnswerArray1D : AnswerValue { + /** + * Array value. + */ public string[] value; + + /** + * Constructs a new ``AnswerArray1D``. + */ + public AnswerArray1D () { } } /** - * 2D Array; + * 2D Array Answer; */ public class AnswerArray2D : AnswerValue { + /** + * Array value. + */ public string[,] value; + + /** + * Constructs a new ``AnswerArray1D``. + */ + public AnswerArray2D () { } } /** diff --git a/src/core/AppDirs.vala b/src/core/AppDirs.vala index 83457d3..9ef6422 100644 --- a/src/core/AppDirs.vala +++ b/src/core/AppDirs.vala @@ -1,21 +1,76 @@ +/** + * System calls. + */ namespace Get { + /** + * Gets library path. + * @param so_path out path to shared library. + * @param addr initialization method source address. + */ extern void library_path (string so_path, void *addr); } +/** + * LaTeX view. + * + * Public system of data view in the LaTeX format. + */ namespace LAview.Core { + /** + * Application directories/paths. + */ class AppDirs { + /** + * Shared library path. + */ public static File so_path; + + /** + * Binary directory. + */ public static File exec_dir; + + /** + * Common directory (parent to binary and shared). + */ public static File common_dir; + + /** + * Data Plugins directory. + */ public static string data_plugins_dir; + + /** + * Object Plugins directory. + */ public static string object_plugins_dir; + + /** + * User Interface Glade files directory. + */ public static string ui_dir; + + /** + * Settings/GLib Schemas directory. + */ public static string settings_dir; + + /** + * Temporary directory. + */ public static string temp_dir; + + /** + * Cache in temporary directory. + */ public static string cache_dir; + /** + * Initialization. + * @throws FileError file i/o error. + */ public static void init () throws FileError { char _so_path[256]; Get.library_path ((string)_so_path, (void*)init); @@ -36,6 +91,10 @@ namespace LAview.Core { cache_dir = Path.build_path (Path.DIR_SEPARATOR_S, AppDirs.temp_dir, "cache"); } + /** + * Termination. + * @throws Error any error. + */ public static void terminate () throws Error { rm_rf (File.new_for_path(temp_dir)); } diff --git a/src/core/Core.vala b/src/core/Core.vala index 7858b68..79f8994 100644 --- a/src/core/Core.vala +++ b/src/core/Core.vala @@ -1,5 +1,10 @@ using GObject, Plugins; +/** + * LaTeX view. + * + * Public system of data view in the LaTeX format. + */ namespace LAview.Core { /** @@ -13,16 +18,25 @@ namespace LAview.Core { AppSettings settings; + /** + * Path to LyX source. + */ public string lyx_path { get { return settings.lyx_path; } set { settings.lyx_path = value; } } + /** + * Path to latexmk.pl executable. + */ public string latexmk_pl_path { get { return settings.latexmk_pl_path; } set { settings.latexmk_pl_path = value; } } + /** + * Path to Perl executable. + */ public string perl_path { get { return settings.perl_path; } set { settings.perl_path = value; } @@ -38,11 +52,19 @@ namespace LAview.Core { set { settings.object_path = value; } } + /** + * Data plugins. + */ public Gee.HashMap data_plugins = new Gee.HashMap(); + + /** + * Object plugins. + */ public Gee.HashMap object_plugins = new Gee.HashMap(); /** * Load Data Modules. + * @param dir_path directory with data modules. */ public void load_data_modules (string dir_path) { Gee.ArrayList tmp_modules = null; @@ -59,6 +81,7 @@ namespace LAview.Core { /** * Load Protocol Objects Modules. + * @param dir_path directory with object modules. */ public void load_object_modules (string dir_path) { Gee.ArrayList tmp_modules = null; @@ -81,6 +104,10 @@ namespace LAview.Core { GObject.Plugins.unload_modules (object_modules); } + /** + * Constructs a new ``Core``. + * @throws Error any error. + */ public Core () throws Error { /* Initialization */ @@ -100,10 +127,16 @@ namespace LAview.Core { clear_cache (); } + /** + * Gets cache directory. + */ public string get_cache_dir () { return AppDirs.cache_dir; } + /** + * Gets templates human readable names. + */ public string[] get_templates_readable_names () { string[] names = {}; foreach (var t in templates) @@ -111,10 +144,17 @@ namespace LAview.Core { return names; } + /** + * Gets template path by its index. + */ public string get_template_path_by_index (int index) { return templates[index].get_path (); } + /** + * Adds a new template. + * @param path new template path. + */ public void add_template (string path) { var file = File.new_for_path (path); if (!file.query_exists() || file.query_file_type(FileQueryInfoFlags.NONE) != FileType.REGULAR) @@ -131,12 +171,20 @@ namespace LAview.Core { save_templates_list (); } + /** + * Removes template by index. + * @param index template index. + */ public void remove_template (int index) { if (index < templates.size) templates.remove_at (index); save_templates_list (); } + /** + * Gets objects list. + * @param template_index template index. + */ public string[] get_objects_list (int template_index) throws Error { if (template_index == last_template_index) return objects_list; last_template_index = template_index; @@ -186,6 +234,11 @@ namespace LAview.Core { return objects_list; } + /** + * Compose/Construct the object. + * @param parent parent window. + * @param object_index object index. + */ public bool compose_object (Object parent, int object_index) throws Error { var cnt = object_index; foreach (var req in requests.entries) @@ -201,6 +254,10 @@ namespace LAview.Core { return composed_objects[object_index];; } + /** + * Generates PDF document. + * @throws Error any print error. + */ public Subprocess print_document () throws Error { foreach (var c in composed_objects) if (c == false) @@ -210,6 +267,10 @@ namespace LAview.Core { return converter.tex2pdf (doc_tex_path(), doc_pdf_path()); } + /** + * Gets out generated LyX document file path. + * @throws Error any error. + */ public string get_lyx_file_path () throws Error { foreach (var c in composed_objects) if (c == false) @@ -217,6 +278,10 @@ namespace LAview.Core { return generate_document_lyx(); } + /** + * Gets out generated PDF document file path. + * @throws Error any error. + */ public string get_pdf_file_path () throws Error { var pdf_path = Path.build_path (Path.DIR_SEPARATOR_S, AppDirs.cache_dir, "document.pdf"); if (!File.new_for_path(pdf_path).query_exists()) @@ -224,6 +289,10 @@ namespace LAview.Core { return pdf_path; } + /** + * Gets data object by its name. + * @param name data object name. + */ public PluginData get_data_object (string name) { return data_plugins2[name]; } diff --git a/src/core/FileUtils.vala b/src/core/FileUtils.vala index 1226650..719d162 100644 --- a/src/core/FileUtils.vala +++ b/src/core/FileUtils.vala @@ -1,3 +1,8 @@ +/** + * LaTeX view. + * + * Public system of data view in the LaTeX format. + */ namespace LAview.Core { void rm_rf (File directory) throws Error { var children = directory.enumerate_children ("standard::*", diff --git a/src/core/Templates.vala b/src/core/Templates.vala index ab7eda4..bd09490 100644 --- a/src/core/Templates.vala +++ b/src/core/Templates.vala @@ -1,5 +1,10 @@ using GObject, Plugins; +/** + * LaTeX view. + * + * Public system of data view in the LaTeX format. + */ namespace LAview.Core { /**