Esempio n. 1
0
 private void menuNew_Click(object sender, EventArgs e)
 {
     if (CheckSpecieDB(""))
     {
         FrmReaction frm = new FrmReaction(m_nUntitledNo++, Log);
         RegisterForm(frm);
     }
 }
Esempio n. 2
0
 void frm_ReactionAdded(FrmReaction form, SimpleReaction reaction)
 {
     if (form == ActiveMdiChild)
         UpdateUsedSpecies();
     TreeNode newNode = new TreeNode(reaction.ToString());
     newNode.Tag = reaction;
     ((TreeNode)form.Tag).Nodes.Add(newNode);
 }
Esempio n. 3
0
 void frm_ReactionChanged(FrmReaction form, SimpleReaction reaction)
 {
     TreeNode frmNode = (TreeNode)form.Tag;
     TreeNode n = FindTreeNode(form, reaction);
     if (n != null)
         n.Text = reaction.ToString();
 }
Esempio n. 4
0
 void frm_ReactionRemoved(FrmReaction form, SimpleReaction reaction)
 {
     if (form == ActiveMdiChild)
         UpdateUsedSpecies();
     TreeNode t = FindTreeNode(form, reaction);
     if (t != null) t.Remove();
 }
Esempio n. 5
0
 protected TreeNode FindTreeNode(FrmReaction form, SimpleReaction reaction)
 {
     TreeNode f = (TreeNode)form.Tag;
     foreach (TreeNode r in f.Nodes)
         if (r.Tag == reaction)
             return r;
     return null;
 }
Esempio n. 6
0
 protected void Save(FrmReaction target)
 {
     try
     {
         if (!target.FileOpen)
             SaveAs(target);
         else
         {
             target.Save();
             RegisterRecentFile(target.Filename);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Save file", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Log.Message(ex.Message, MessageType.Error);
     }
 }
Esempio n. 7
0
 protected void SaveAs(FrmReaction target)
 {
     try
     {
         if (target.FileOpen)
             dlgSaveRxn.FileName = target.Filename;
         dlgSaveRxn.Title = "Save Reaction " + target.Title;
         if (dlgSaveRxn.ShowDialog(this) == DialogResult.OK)
             target.SaveAs(dlgSaveRxn.FileName);
         RegisterRecentFile(target.Filename);
         ((TreeNode)target.Tag).Text = target.Title;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Save file", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Log.Message(ex.Message, MessageType.Error);
     }
 }
Esempio n. 8
0
        protected void RegisterForm(FrmReaction frm)
        {
            if (Program.FrmAutobalanceExtraComps.Visible)
                frm.Enabled = false;
            frm.MdiParent = this;
            frm.Show();
            TreeNode newNode = new TreeNode(frm.Text);
            newNode.Tag = frm;
            newNode.ContextMenuStrip = menuReactionBlock;
            frm.Tag = newNode;
            newNode.Name = frm.Text;
            treeFiles.Nodes["RBs"].Nodes.Add(newNode);
            treeFiles.Nodes["RBs"].Expand();
            foreach (SimpleReaction r in frm.Reactions)
            {
                TreeNode subNode = new TreeNode(r.ToString());
                subNode.Tag = r;
                subNode.Name = r.ToString();
                newNode.Nodes.Add(subNode);
            }
            frm.NowChanged += new EventHandler(frm_NowChanged);
            frm.CompoundsChanged += new EventHandler(frm_CompoundsChanged);
            frm.SelectedReactionChanged += new EventHandler(frm_SelectedReactionChanged);
            frm.SourcesSinksChanged += new EventHandler(frm_SourcesSinksChanged);
            frm.ReactionAdded += new FrmReaction.ReactionHandler(frm_ReactionAdded);
            frm.ReactionRemoved += new FrmReaction.ReactionHandler(frm_ReactionRemoved);

            frm.FormClosing += new FormClosingEventHandler(frm_FormClosing);
            frm.FormClosed += new FormClosedEventHandler(frm_FormClosed);
            frm.RecheckCutCopyPaste += new EventHandler(frm_RecheckCutCopyPaste);
            frm.ReactionChanged += new FrmReaction.ReactionHandler(frm_ReactionChanged);
        }
Esempio n. 9
0
 protected Form Open(string filename)
 {
     try
     {
         Form f = AlreadyOpen(filename);
         if (f != null)
         {
             f.Activate();
             return f;
         }
         FrmReaction frm = new FrmReaction(filename, Log);
         RegisterForm(frm);
         RegisterRecentFile(filename);
         UpdateLastPath(Path.GetDirectoryName(filename));
         return frm;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Open file", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Log.Message(ex.Message, MessageType.Error);
         return null;
     }
 }
Esempio n. 10
0
 private void pnlLog_Leave(object sender, EventArgs e)
 {
     btnLogCollapse.FlatAppearance.BorderColor = btnLogCollapse.BackColor = pnlLogHeader.BackColor = SystemColors.InactiveCaption;
     lblLogHeader.ForeColor = SystemColors.InactiveCaptionText;
     if (ActiveMdiChild != null)
         Messaging.SendMessage(ActiveMdiChild.Handle, Messaging.WM_NCACTIVATE, (IntPtr)1, (IntPtr)0);
     if (LastChild is FrmReaction)
     {
         ((FrmReaction)LastChild).ActualActive = true;
         LastChild = null;
     }
 }
Esempio n. 11
0
 public MessageFrmReaction(string title, FrmReaction owner, SimpleReaction rxn)
   :
     base(title)
 {
   m_owner = owner;
   m_rxn = rxn;
 }
Esempio n. 12
0
 public CompoundDrag(Control _ctrl, int _startIndex, FrmReaction _frm)
 {
   ctrl = _ctrl;
   startIndex = _startIndex;
   frm = _frm;
 }