public Debug(L2A.UTIL.ParameterList parameter_list, string return_xml) : base(return_xml) { InitializeComponent(); // Get the creation type. extra_label.Text = ""; string creation_type = parameter_list.options_["creation_type"]; if ("create" == creation_type) { button_cancel.Text = "Cancel item creation"; } else if ("edit" == creation_type) { button_cancel.Text = "Cancel edit item"; } else if ("redo_all" == creation_type) { extra_label.Text = "Could not create the combined Latex file for the redo mode." + Environment.NewLine + "This usually happens when something in the header changes " + Environment.NewLine + "or the document is compiled on a different system than before."; button_cancel.Text = "Continue"; button_ok.Visible = false; } else { L2A.ERR.ExceptionClass.Exception("The creation type \"" + creation_type + "\" is not defiend."); } latex_log_file_ = parameter_list.options_["log_file"]; }
public Options(L2A.UTIL.ParameterList parameter_list, string return_xml) : base(return_xml) { InitializeComponent(); // Add the available latex commands to the dropdown list. latex_command.Items.Add("pdflatex"); latex_command.Items.Add("lualatex"); latex_command.Items.Add("xelatex"); // Store the default list. default_list_ = parameter_list.sub_lists_["default_options"]; // Set the git sha. git_sha.Text = parameter_list.options_["git_sha"]; git_sha.ReadOnly = true; git_sha.BorderStyle = 0; git_sha.BackColor = BackColor; git_sha.TabStop = false; git_sha.TextAlign = HorizontalAlignment.Right; // Set the document header path. header_path_ = parameter_list.options_["document_header_path"]; document_header.ReadOnly = true; document_header.BorderStyle = 0; document_header.BackColor = BackColor; document_header.TabStop = false; document_header.Enabled = false; if (header_path_ == "no_documents") { // In this case there are no open documents in Illustrator -> we can do nothing with the header. document_header.Text = "No active documents in Illustrator"; document_header.ForeColor = Color.Gray; header_button.Visible = false; } else if (header_path_ == "not_saved") { // In this case the current opened document in Illustrator is not saved -> we can do nothing with the header. document_header.Text = "Current document not saved"; document_header.ForeColor = Color.Gray; header_button.Visible = false; } else if (File.Exists(header_path_)) { // In this case the document header exists -> allow the user to open it with the open header button. document_header.Text = header_path_; header_button.Text = "Open"; document_header.Enabled = true; } else { // In this case the document header does not exists -> allow the user to create it with the header button. document_header.Text = "No header in the document directory"; header_button.Text = "Create Default"; } // Load the current options. SetFromParameterList(parameter_list); }
private bool FormIsChanged() { StoreValues(); L2A.UTIL.ParameterList property_list = input_parameter_list_.sub_lists_["property_list"]; return(return_parameter_list_.options_["text_align_horizontal"] != property_list.options_["text_align_horizontal"] || return_parameter_list_.options_["text_align_vertical"] != property_list.options_["text_align_vertical"] || return_parameter_list_.options_["placed_option"] != property_list.options_["placed_option"] || return_parameter_list_.sub_lists_["latex"].main_option_ != property_list.sub_lists_["latex"].main_option_); }
private void SetFromParameterList(L2A.UTIL.ParameterList parameter_list) { // Set the latex path and options. latex_command.SelectedItem = parameter_list.options_["command_latex"]; latex_path.Text = parameter_list.options_["path_latex"]; latex_command_options.Text = parameter_list.options_["command_latex_options"]; // Set the ghostscript path. gs_path.Text = parameter_list.options_["command_gs"]; }
public BaseForm(string return_xml) : base() { // Set the members and form items. return_xml_ = return_xml; // Default form result. form_result_ = "cancel"; // Create an empty parameter list with values to return. return_parameter_list_ = new L2A.UTIL.ParameterList(); }
public BaseForm(string return_xml) : base() { // Set the members and form items. return_xml_ = return_xml; // Default form result. form_result_ = "cancel"; // Create an empty parameter list with values to return. return_parameter_list_ = new L2A.UTIL.ParameterList(); // Set the icon. this.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath); }
private void SetFromParameterList(L2A.UTIL.ParameterList parameter_list) { // Set the latex path and options. latex_command.SelectedItem = parameter_list.options_["command_latex"]; latex_path.Text = parameter_list.options_["path_latex"]; latex_command_options.Text = parameter_list.options_["command_latex_options"]; // Set the ghostscript path. gs_path.Text = parameter_list.options_["command_gs"]; // Set the warning flags. check_box_save.Checked = Convert.ToBoolean(Int32.Parse(parameter_list.options_["warning_ai_not_saved"])); check_box_boundary.Checked = Convert.ToBoolean(Int32.Parse(parameter_list.options_["warning_boundary_boxes"])); }
/// <summary> /// This is a very basic test where simply "ok" is returned. /// </summary> static private void CheckForms(string return_xml) { var return_parameter_list = new L2A.UTIL.ParameterList(); return_parameter_list.options_["form_result"] = "ok"; // Write the parameter list to string. string xml_string = return_parameter_list.ToString("LaTeX2AI_form_result"); using (System.IO.StreamWriter file = new System.IO.StreamWriter(return_xml, false)) { file.WriteLine(xml_string); } }
public Redo(L2A.UTIL.ParameterList parameter_list, string return_xml) : base(return_xml) { InitializeComponent(); // Set the checkbox items. check_box_latex.Checked = false; check_box_boundary.Checked = true; all_items.Checked = true; selected_items.Checked = false; // Add number to form. string n_all_items = parameter_list.options_["n_all_items"]; string n_selected_items = parameter_list.options_["n_selected_items"]; all_items.Text = "All LaTeX2AI Items in the document (" + n_all_items + ")"; selected_items.Text = "Selected LaTeX2AI Items (" + n_selected_items + ")"; RedoCheckedChanged(); }
public virtual void ThisFormClosed(object sender, FormClosedEventArgs e) { // When the form is closed, write the result xml. // Add the form result value. L2A.UTIL.ParameterList root_parameter_list = new L2A.UTIL.ParameterList(); root_parameter_list.options_["form_result"] = form_result_; // If a option parameter list exits, add it. if (return_parameter_list_ != null) { root_parameter_list.sub_lists_["LaTeX2AI_form_result"] = return_parameter_list_; } // Write the parameter list to string. string xml_string = root_parameter_list.ToString("LaTeX2AI_form_result"); using (System.IO.StreamWriter file = new System.IO.StreamWriter(return_xml_, false)) { file.WriteLine(xml_string); } }
public Item(L2A.UTIL.ParameterList parameter_list, string return_xml) : base(return_xml) { InitializeComponent(); // Set the position item. SetPosition(parameter_list.options_["text_align_horizontal"], parameter_list.options_["text_align_vertical"]); // Set the placement options. SetPlacementOption(parameter_list.options_["placed_option"]); // Set the latex code. textbox.Text = parameter_list.sub_lists_["latex"].main_option_; // Set the position of the cursor in the text box. int cursor_position = Int32.Parse(parameter_list.sub_lists_["latex"].options_["cursor_position"]); textbox.SelectionStart = cursor_position; textbox.SelectionLength = 0; // Set the textbox to be active. ActiveControl = textbox; }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Check if correct number of arguments are given. string[] arguments = Environment.GetCommandLineArgs(); if (arguments.Length != 6) { L2A.ERR.ExceptionClass.Exception("Exactly 6 input arguments are expected."); } // Convert the xml to a parameter list. L2A.UTIL.ParameterList parameter_list = new L2A.UTIL.ParameterList(arguments[2]); // Check the git sha and the build type. if (arguments[4] != L2A.Constants.l2a_version_git_sha_head_) { L2A.ERR.ExceptionClass.Exception( "The git sha of the forms application: " + L2A.Constants.l2a_version_git_sha_head_ + " does not match with the one from the LaTeX2AI plug-in: " + arguments[4]); } #if DEBUG string build_type = "debug"; #else string build_type = "release"; #endif if (arguments[5] != build_type) { L2A.ERR.ExceptionClass.Exception( "The build types of the forms application: " + build_type + " does not match with the one from the LaTeX2AI plug-in: " + arguments[5]); } // Get the path of the return xml file. string return_path = arguments[3]; // Open the desired form. if (arguments[1] == "l2a_test_forms") { TestForms(parameter_list, return_path); } else if (arguments[1] == "l2a_item") { Application.Run(new L2A.FORMS.Item(parameter_list, return_path)); } else if (arguments[1] == "l2a_redo") { Application.Run(new L2A.FORMS.Redo(parameter_list, return_path)); } else if (arguments[1] == "l2a_debug") { Application.Run(new L2A.FORMS.Debug(parameter_list, return_path)); } else if (arguments[1] == "l2a_options") { Application.Run(new L2A.FORMS.Options(parameter_list, return_path)); } else { L2A.ERR.ExceptionClass.Exception("The form type \"" + arguments[1] + "\" is not defiend."); } }
public Item(L2A.UTIL.ParameterList parameter_list, string return_xml) : base(return_xml) { InitializeComponent(); input_parameter_list_ = parameter_list; L2A.UTIL.ParameterList property_list = input_parameter_list_.sub_lists_["property_list"]; // Set the position item. SetPosition(property_list.options_["text_align_horizontal"], property_list.options_["text_align_vertical"]); // Set the placement options. SetPlacementOption(property_list.options_["placed_option"]); // Set the latex code. textbox.Text = property_list.sub_lists_["latex"].main_option_; // Set the position of the cursor in the text box. int cursor_position = Int32.Parse(property_list.sub_lists_["latex"].options_["cursor_position"]); textbox.SelectionStart = cursor_position; textbox.SelectionLength = 0; // Set the textbox to be active. ActiveControl = textbox; // Set the redo boundary box relatex stuff in the form. string boundary_box_state = input_parameter_list_.options_["boundary_box_state"]; if (boundary_box_state == "none") { group_boundary_box.Visible = false; } else { group_boundary_box.Visible = true; if (boundary_box_state == "ok") { boundary_box_status.Text = "Ok"; rebo_boundary_box.Enabled = false; } else if (boundary_box_state == "streched") { boundary_box_status.Text = "Streched"; } else if (boundary_box_state == "diamond") { boundary_box_status.Text = "Bend"; } } // Set the redo latex related stuff. string latex_exists = input_parameter_list_.options_["latex_exists"]; if (latex_exists == "0") { group_latex.Visible = false; } else { group_latex.Visible = true; } }