Beispiel #1
0
 /// <summary>
 /// Save into an another file
 /// </summary>
 /// <param name="sender">sender</param>
 /// <param name="e">arg</param>
 private void appSaveAsItem_Click(object sender, EventArgs e)
 {
     if (FunLab.SaveAs(ref this.path, ref this.fileName, po))
     {
         this.Text = "Editor - " + this.fileName;
     }
 }
Beispiel #2
0
 /// <summary>
 /// Load a file
 /// </summary>
 /// <param name="sender">sender</param>
 /// <param name="e">arg</param>
 private void appLoadItem_Click(object sender, EventArgs e)
 {
     if (FunLab.IsDirty)
     {
         DialogResult dr = MessageBox.Show("Save current ?", "Not saved", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dr == DialogResult.Yes)
         {
             FunLab.Save(ref this.path, ref this.fileName, po);
         }
     }
     try
     {
         if (FunLab.Load(ref this.path, ref this.fileName, ref po))
         {
             this.Text = "Editor - " + this.fileName;
             this.stored.ForEach(x => { x.Close(); x.Dispose(); });
             this.stored.Clear();
             this.undoPos = 0;
             vars.BeginUpdate();
             vars.Items.Clear();
             FunLab.FillVars(vars, po);
             vars.EndUpdate();
             datas.BeginUpdate();
             datas.Items.Clear();
             FunLab.FillData(datas, po);
             datas.EndUpdate();
             txtSource.Text = po.ToString();
             this.AddUndo();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Not loaded", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Beispiel #3
0
 /// <summary>
 /// Copy data
 /// </summary>
 /// <param name="sender">sender</param>
 /// <param name="e">arg</param>
 private void editCopyDataItem_Click(object sender, EventArgs e)
 {
     if (FunLab.CopyData(datas, po))
     {
         this.AddUndo();
         txtSource.Text = po.ToString();
         this.Text      = "Editor - " + this.fileName + " *";
     }
 }
Beispiel #4
0
 /// <summary>
 /// Insert after
 /// </summary>
 /// <param name="sender">sender</param>
 /// <param name="e">arg</param>
 private void datasInsertAfterItem_Click(object sender, EventArgs e)
 {
     if (FunLab.InsertAfter(datas, po))
     {
         this.AddUndo();
         txtSource.Text = po.ToString();
         this.Text      = "Editor - " + this.fileName + " *";
     }
 }
Beispiel #5
0
 /// <summary>
 /// Remove variable
 /// </summary>
 /// <param name="sender">sender</param>
 /// <param name="e">arg</param>
 private void varsRemoveItem_Click(object sender, EventArgs e)
 {
     if (FunLab.DeleteVariables(vars, po))
     {
         this.AddUndo();
         txtSource.Text = po.ToString();
         this.Text      = "Editor - " + this.fileName + " *";
     }
 }
Beispiel #6
0
 /// <summary>
 /// When closing (avoid not saved)
 /// </summary>
 /// <param name="sender">sender</param>
 /// <param name="e">arg</param>
 private void Editor_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (FunLab.IsDirty)
     {
         DialogResult dr = MessageBox.Show("Save current ?", "Not saved", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dr == DialogResult.Yes)
         {
             FunLab.Save(ref this.path, ref this.fileName, po);
         }
     }
 }
Beispiel #7
0
        /// <summary>
        /// Redo
        /// </summary>
        /// <param name="sender">sender</param>
        /// <param name="e">arg</param>
        private void editRedoItem_Click(object sender, EventArgs e)
        {
            if (this.undoPos < this.stored.Count)
            {
                MemoryStream mem = this.stored[this.undoPos];
                ++this.undoPos;
                mem.Seek(0, SeekOrigin.Begin);
                PrinterObject previous = PrinterObject.Load(mem);

                po = previous as PrinterObject;
                vars.BeginUpdate();
                vars.Items.Clear();
                FunLab.FillVars(vars, po);
                vars.EndUpdate();
                datas.BeginUpdate();
                datas.Items.Clear();
                FunLab.FillData(datas, po);
                datas.EndUpdate();
                txtSource.Text = po.ToString();
                FunLab.IsDirty = true;
                this.Text      = "Editor - " + this.fileName + " *";
            }
        }
Beispiel #8
0
 private void Variable_Load(object sender, EventArgs e)
 {
     FunLab.FillVars(vars, pv);
 }
Beispiel #9
0
 /// <summary>
 /// When delete button clicked
 /// </summary>
 /// <param name="sender">object</param>
 /// <param name="e">arg</param>
 private void btnDelete_Click(object sender, EventArgs e)
 {
     this.Hide();
     FunLab.DeleteVariables(vars, pv);
     this.Show();
 }
Beispiel #10
0
 /// <summary>
 /// When edit button clicked
 /// </summary>
 /// <param name="sender">object</param>
 /// <param name="e">arg</param>
 private void btnEdit_Click(object sender, EventArgs e)
 {
     this.Hide();
     FunLab.EditVariable(vars, pv);
     this.Show();
 }
Beispiel #11
0
 /// <summary>
 /// When add button clicked
 /// </summary>
 /// <param name="sender">object</param>
 /// <param name="e">arg</param>
 private void btnAdd_Click(object sender, EventArgs e)
 {
     this.Hide();
     FunLab.AddNewVariable(vars, pv);
     this.Show();
 }
Beispiel #12
0
 private void Config_Load(object sender, EventArgs e)
 {
     FunLab.FillConfigs(this.configs, this.conf);
 }