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); } }
void eraseButton_Click(object sender, EventArgs e) { IProcDefBit b = (IProcDefBit)editedTextModel; ResetTextEditState(); model.RemoveBit(b); }
void ProcDefBlock_FormalParamChanged(object sender, int index, IProcDefBit newBit) { IBlockView v = ViewFromBlock((VarDefBlock)newBit); ProcDefView parent = (ProcDefView)ViewFromBlock((IBlock)sender); parent.SetFormalBit(index, v); }
void ProcDefBlock_FormalParamRemoved(object sender, IProcDefBit bit) { ProcDefBlock b = (ProcDefBlock)sender; ProcDefView v = (ProcDefView)ViewFromBlock(b); IBlockView bitView = ViewFromBlock((IBlock)bit); v.RemoveFormalBit(bitView); }
internal void RemoveBit(IProcDefBit bit) { if (Bits.Contains(bit)) { Bits.Remove(bit); } FormalParamRemoved(this, bit); }
public void TestAddArgPerformance() { for (int i = 0; i < 1500; ++i) { AddArg(DataType.Number); IProcDefBit b = model.Bits.Last(); model.RemoveBit(b); } }
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); }
void ProcDefBlock_FormalParamRemoved(object sender, IProcDefBit bit) { ProcDefBlock b = (ProcDefBlock)sender; ProcDefView v = (ProcDefView)ViewFromBlock(b); IBlockView bitView = ViewFromBlock((IBlock)bit); v.RemoveFormalBit(bitView); }
void ProcDefBlock_FormalParamChanged(object sender, int index, IProcDefBit newBit) { IBlockView v = ViewFromBlock((VarDefBlock) newBit); ProcDefView parent = (ProcDefView)ViewFromBlock((IBlock)sender); parent.SetFormalBit(index, v); }
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); } }
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; }
public void AddBit(IProcDefBit bit) { Bits.Add(bit); FormalParamAdded(this, bit); }
public void AddBit(IProcDefBit bit) { Bits.Add(bit); FormalParamAdded(this, bit); }
internal void RemoveBit(IProcDefBit bit) { if (Bits.Contains(bit)) { Bits.Remove(bit); } FormalParamRemoved(this, bit); }