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