Ejemplo n.º 1
0
        void ProcDefBlock_FormalParamAdded(object sender, IProcDefBit newBit)
        {
            ProcDefBlock b    = (ProcDefBlock)sender;
            ProcDefView  v    = (ProcDefView)ViewFromBlock(b);
            DataType     type = DataType.Invalid;

            if (newBit is VarDefBlock)
            {
                VarDefBlock vb = (VarDefBlock)newBit;
                type = (vb).Type;
                int height            = ArgBitTextHeight(newBit);
                EditableVarDefView vv = new EditableVarDefView(vb,
                                                               MakeTextBitBitmap(vb.Name, height),
                                                               varb_parts,
                                                               textMetrics, textFont);
                blockViews[vb]  = vv;
                vb.TextChanged += new VarDefBlockTextChangedEvent(ProcDef_FormalParamTextChanged);
                v.AddFormalBit(vv, type);
            }
            else
            {
                ProcDefTextBit pb = (ProcDefTextBit)newBit;
                pb.TextChanged += new ProcDefTextBitTextChangedEvent(ProcDefTextBit_TextChanged);
                EditableLabelView lv = new EditableLabelView(MakeTextBitBitmap(pb.Text, ArgBitTextHeight(pb)),
                                                             (ProcDefTextBit)newBit);
                blockViews[pb] = lv;

                v.AddFormalBit(lv, DataType.Invalid);
            }
        }
Ejemplo n.º 2
0
        void eraseButton_Click(object sender, EventArgs e)
        {
            IProcDefBit b = (IProcDefBit)editedTextModel;

            ResetTextEditState();
            model.RemoveBit(b);
        }
Ejemplo n.º 3
0
        void ProcDefBlock_FormalParamChanged(object sender, int index, IProcDefBit newBit)
        {
            IBlockView  v      = ViewFromBlock((VarDefBlock)newBit);
            ProcDefView parent = (ProcDefView)ViewFromBlock((IBlock)sender);

            parent.SetFormalBit(index, v);
        }
Ejemplo n.º 4
0
        void ProcDefBlock_FormalParamRemoved(object sender, IProcDefBit bit)
        {
            ProcDefBlock b       = (ProcDefBlock)sender;
            ProcDefView  v       = (ProcDefView)ViewFromBlock(b);
            IBlockView   bitView = ViewFromBlock((IBlock)bit);

            v.RemoveFormalBit(bitView);
        }
Ejemplo n.º 5
0
 internal void RemoveBit(IProcDefBit bit)
 {
     if (Bits.Contains(bit))
     {
         Bits.Remove(bit);
     }
     FormalParamRemoved(this, bit);
 }
Ejemplo n.º 6
0
 public void TestAddArgPerformance()
 {
     for (int i = 0; i < 1500; ++i)
     {
         AddArg(DataType.Number);
         IProcDefBit b = model.Bits.Last();
         model.RemoveBit(b);
     }
 }
Ejemplo n.º 7
0
        private int ArgBitTextHeight(IProcDefBit bb)
        {
            string toMeasure;

            if (bb is VarDefBlock)
            {
                toMeasure = ((VarDefBlock)bb).Text;
            }
            else
            {
                toMeasure = ((ProcDefTextBit)bb).Text;
            }
            if (toMeasure == "")
            {
                toMeasure = "X";
            }
            return((int)textMetrics.MeasureString(toMeasure, textFont).Height);
        }
Ejemplo n.º 8
0
 void ProcDefBlock_FormalParamRemoved(object sender, IProcDefBit bit)
 {
     ProcDefBlock b = (ProcDefBlock)sender;
     ProcDefView v = (ProcDefView)ViewFromBlock(b);
     IBlockView bitView = ViewFromBlock((IBlock)bit);
     v.RemoveFormalBit(bitView);
 }
Ejemplo n.º 9
0
 void ProcDefBlock_FormalParamChanged(object sender, int index, IProcDefBit newBit)
 {
     IBlockView v = ViewFromBlock((VarDefBlock) newBit);
     ProcDefView parent = (ProcDefView)ViewFromBlock((IBlock)sender);
     parent.SetFormalBit(index, v);
 }
Ejemplo n.º 10
0
        void ProcDefBlock_FormalParamAdded(object sender, IProcDefBit newBit)
        {
            ProcDefBlock b = (ProcDefBlock) sender;
            ProcDefView v = (ProcDefView) ViewFromBlock(b);
            DataType type = DataType.Invalid;
            if (newBit is VarDefBlock)
            {
                VarDefBlock vb = (VarDefBlock)newBit;
                type = (vb).Type;
                int height = ArgBitTextHeight(newBit);
                EditableVarDefView vv = new EditableVarDefView(vb,
                       MakeTextBitBitmap(vb.Name, height),
                       varb_parts,
                       textMetrics, textFont);
                blockViews[vb] = vv;
                vb.TextChanged += new VarDefBlockTextChangedEvent(ProcDef_FormalParamTextChanged);
                v.AddFormalBit(vv, type);
            }
            else
            {
                ProcDefTextBit pb = (ProcDefTextBit)newBit;
                pb.TextChanged += new ProcDefTextBitTextChangedEvent(ProcDefTextBit_TextChanged);
                EditableLabelView lv = new EditableLabelView(MakeTextBitBitmap(pb.Text, ArgBitTextHeight(pb)),
                    (ProcDefTextBit) newBit);
                blockViews[pb] = lv;

                v.AddFormalBit(lv, DataType.Invalid);
            }
        }
Ejemplo n.º 11
0
 private int ArgBitTextHeight(IProcDefBit bb)
 {
     string toMeasure;
     if (bb is VarDefBlock)
         toMeasure = ((VarDefBlock)bb).Text;
     else
         toMeasure = ((ProcDefTextBit)bb).Text;
     if (toMeasure == "")
         toMeasure = "X";
     return (int)textMetrics.MeasureString(toMeasure, textFont).Height;
 }
Ejemplo n.º 12
0
 public void AddBit(IProcDefBit bit)
 {
     Bits.Add(bit);
     FormalParamAdded(this, bit);
 }
Ejemplo n.º 13
0
 public void AddBit(IProcDefBit bit)
 {
     Bits.Add(bit);
     FormalParamAdded(this, bit);
 }
Ejemplo n.º 14
0
 internal void RemoveBit(IProcDefBit bit)
 {
     if (Bits.Contains(bit))
     {
         Bits.Remove(bit);
     }
     FormalParamRemoved(this, bit);
 }