Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/11/10 17:44:21 (15 years ago)
Author:
mkommend
Message:

added test application for netron (ticket #867)

Location:
trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/HeuristicLab.Netron-3.0.2672.12446
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/HeuristicLab.Netron-3.0.2672.12446/Controller.cs

    r2781 r2782  
    1919      TextEditor.Show();
    2020      return true;
    21     } 
     21    }
     22
     23    public ILayout StandardTreeLayout {
     24      get {
     25        return (ILayout)this.FindActivity("Standard TreeLayout");
     26      }
     27    }
    2228  }
    2329}
  • trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/HeuristicLab.Netron-3.0.2672.12446/HeuristicLab.Netron-3.0.2672.12446.csproj

    r2781 r2782  
    5050  </ItemGroup>
    5151  <ItemGroup>
     52    <Compile Include="NetronForm.cs">
     53      <SubType>Form</SubType>
     54    </Compile>
     55    <Compile Include="NetronForm.Designer.cs">
     56      <DependentUpon>NetronForm.cs</DependentUpon>
     57    </Compile>
     58    <Compile Include="NetronTestApplication.cs" />
    5259    <Compile Include="NetronVisualization.cs">
    5360      <SubType>Component</SubType>
  • trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/HeuristicLab.Netron-3.0.2672.12446/NetronVisualization.cs

    r2781 r2782  
    1313  [ToolboxItem(true)]
    1414  public partial class NetronVisualization : DiagramControlBase {
     15    private static Size INVALID_SIZE = new Size(-1,-1);
     16    private Size oldSize;
    1517    public NetronVisualization()
    1618      : base() {
    1719      InitializeComponent();
     20      this.oldSize = INVALID_SIZE;
    1821
    1922      SetStyle(ControlStyles.AllPaintingInWmPaint, true);
     
    3437        View.OnBackColorChange += new EventHandler<ColorEventArgs>(View_OnBackColorChange);
    3538
    36         this.SizeChanged += new EventHandler(AlgorithmVisualization_SizeChanged);
     39        this.SizeChanged += new EventHandler(NetronVisualization_SizeChanged);
    3740        this.AllowDrop = true;
    3841      }
    3942    }
    4043
    41     void AlgorithmVisualization_SizeChanged(object sender, EventArgs e) {
    42       Size newSize = new Size((int) (this.Size.Width * this.View.Magnification.Width),
    43         (int) (this.Size.Height * this.View.Magnification.Height));
    44       this.View.PageSize = newSize;
     44    private void NetronVisualization_SizeChanged(object sender, EventArgs e) {
     45      if (this.oldSize == INVALID_SIZE) {
     46        this.View.PageSize = new Size((int)(this.Size.Width * this.Magnification.Width), (int)(this.Size.Height * this.Magnification.Height));
     47        oldSize = this.Size;
     48        return;
     49      }
     50
     51      SizeF magnificationChanges = new SizeF();
     52      magnificationChanges.Width = ((float)this.Size.Width) / oldSize.Width;
     53      magnificationChanges.Height = ((float)this.Size.Height) / oldSize.Height;
     54
     55      SizeF newMagnification = new SizeF();
     56      newMagnification.Width = this.View.Magnification.Width * magnificationChanges.Width;
     57      newMagnification.Height = this.View.Magnification.Height * magnificationChanges.Height;
     58
     59      this.Magnification = newMagnification;
     60      this.oldSize = this.Size;
    4561    }
    4662
     
    5369        Origin = new Point(Origin.X, se.NewValue);
    5470        //System.Diagnostics.Trace.WriteLine(se.NewValue);
    55       } 
     71      }
    5672    }
    5773
Note: See TracChangeset for help on using the changeset viewer.