Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2909


Ignore:
Timestamp:
03/02/10 11:28:00 (15 years ago)
Author:
mkommend
Message:

added tooltips for graph visualization buttons and fixed layouting problems (ticket #867)

Location:
trunk/sources
Files:
4 edited

Legend:

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

    r2868 r2909  
    4949        this.Controller = new Controller(this);
    5050        this.Document = new Document();
    51         this.Document.Model.Selection = new Selection(this.Controller,this.Document.Model);
     51        this.Document.Model.Selection = new Selection(this.Controller, this.Document.Model);
    5252        this.View = new View(this);
    5353        this.AttachToDocument(Document);
     
    5959
    6060        this.SizeChanged += new EventHandler(NetronVisualization_SizeChanged);
    61         this.AllowDrop = true;
     61        this.UpdateView();
     62      }
     63    }
     64
     65    public Size PageSize {
     66      get { return this.View.PageSize; }
     67      set {
     68        this.View.PageSize = value;
     69        this.UpdateView();
     70      }
     71    }
     72
     73    private void UpdateView() {
     74      //zoom in to show scrollbars - code taken from ControllerBase line 1082
     75      SizeF s = this.View.Magnification;
     76      float alpha = 1.1F;
     77      View.Magnification = new SizeF(
     78          s.Width * alpha,
     79          s.Height * alpha);
     80
     81      float w = (float)this.AutoScrollPosition.X /
     82          (float)this.AutoScrollMinSize.Width;
     83
     84      float h = (float)this.AutoScrollPosition.Y /
     85          (float)this.AutoScrollMinSize.Height;
     86
     87      RectangleF pageBounds = this.Controller.Model.CurrentPage.Bounds;
     88      pageBounds.Inflate(s);
     89      SizeF deltaSize = new SizeF(
     90          pageBounds.Width - this.ClientRectangle.Width,
     91          pageBounds.Height - this.ClientRectangle.Height);
     92
     93      if ((deltaSize.Width > 0) && (deltaSize.Height > 0)) {
     94        this.AutoScrollMinSize = Size.Round(deltaSize);
    6295      }
    6396    }
     
    6598    private void NetronVisualization_SizeChanged(object sender, EventArgs e) {
    6699      //if (this.oldSize == INVALID_SIZE) {
    67         this.View.PageSize = new Size((int)(this.Size.Width * this.Magnification.Width), (int)(this.Size.Height * this.Magnification.Height));
     100      //this.View.PageSize = new Size((int)(this.Size.Width * this.Magnification.Width), (int)(this.Size.Height * this.Magnification.Height));
    68101      //  if (!this.DesignMode)
    69102      //    oldSize = this.Size;
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/GraphVisualizationInfoView.Designer.cs

    r2893 r2909  
    3939      this.graphVisualization.FileName = "";
    4040      this.graphVisualization.Location = new System.Drawing.Point(0, 0);
    41       this.graphVisualization.Magnification = new System.Drawing.SizeF(71F, 71F);
     41      this.graphVisualization.Magnification = new System.Drawing.SizeF(80F, 80F);
    4242      this.graphVisualization.Name = "graphVisualization";
    4343      this.graphVisualization.Origin = new System.Drawing.Point(0, 0);
     44      this.graphVisualization.PageSize = new System.Drawing.Size(100000, 100000);
    4445      this.graphVisualization.ShowConnectors = true;
    4546      this.graphVisualization.ShowRulers = false;
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/GraphVisualizationInfoView.cs

    r2899 r2909  
    3535using HeuristicLab.MainForm.WindowsForms;
    3636using HeuristicLab.Collections;
     37using System.Diagnostics;
     38using System.Threading;
    3739
    3840namespace HeuristicLab.Operators.Views.GraphVisualization {
     
    335337        this.graphVisualization.Controller.RunActivity(layoutName);
    336338        this.graphVisualization.Invalidate();
     339
     340        //fix to avoid negative shape positions after layouting
     341        Thread.Sleep(100);
     342        int minX = this.graphVisualization.Controller.Model.Shapes.Min(s => s.Location.X);
     343        int shiftX = minX < 0 ? Math.Abs(minX) + 50 : 0;
     344        int minY = this.graphVisualization.Controller.Model.Shapes.Min(s => s.Location.Y);
     345        int shiftY = minY < 0 ? Math.Abs(minY) + 50 : 0;
     346        if (minX < 0 || minY < 0) {
     347          foreach (IShape s in this.Controller.Model.Shapes)
     348            s.MoveBy(new Point(shiftX, shiftY));
     349        }
    337350      }
    338351    }
  • trunk/sources/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphView.Designer.cs

    r2899 r2909  
    4040      this.zoomInButton = new System.Windows.Forms.Button();
    4141      this.zoomOutButton = new System.Windows.Forms.Button();
     42      this.buttonToolTip = new System.Windows.Forms.ToolTip();
    4243      this.shapeContextMenu.SuspendLayout();
    4344      this.splitContainer.Panel1.SuspendLayout();
     
    5455      this.graphVisualizationInfoView.Caption = null;
    5556      this.graphVisualizationInfoView.Content = null;
    56       this.graphVisualizationInfoView.Location = new System.Drawing.Point(0, 27);
     57      this.graphVisualizationInfoView.Location = new System.Drawing.Point(3, 30);
    5758      this.graphVisualizationInfoView.Name = "graphVisualizationInfoView";
    58       this.graphVisualizationInfoView.Size = new System.Drawing.Size(665, 251);
     59      this.graphVisualizationInfoView.Size = new System.Drawing.Size(662, 248);
    5960      this.graphVisualizationInfoView.TabIndex = 0;
    6061      //
     
    138139      // selectButton
    139140      //
    140       this.selectButton.Image = HeuristicLab.Common.Resources.Resources.FlagGreenIcon;
     141      this.selectButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Pointer;
    141142      this.selectButton.Location = new System.Drawing.Point(3, 3);
    142143      this.selectButton.Name = "selectButton";
     
    145146      this.selectButton.UseVisualStyleBackColor = true;
    146147      this.selectButton.Click += new System.EventHandler(selectButton_Click);
     148      this.buttonToolTip.SetToolTip(this.selectButton, "Select Tool");
    147149      //
    148150      // panButton
    149151      //
    150       this.panButton.Image = HeuristicLab.Common.Resources.Resources.FlagRedIcon;
     152      this.panButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Breakpoint;
    151153      this.panButton.Location = new System.Drawing.Point(33, 3);
    152154      this.panButton.Name = "panButton";
     
    155157      this.panButton.UseVisualStyleBackColor = true;
    156158      this.panButton.Click += new System.EventHandler(panButton_Click);
     159      this.buttonToolTip.SetToolTip(this.panButton, "Pan Tool");
    157160      //
    158161      // connectButton
     
    165168      this.connectButton.UseVisualStyleBackColor = true;
    166169      this.connectButton.Click += new System.EventHandler(connectButton_Click);
     170      this.buttonToolTip.SetToolTip(this.connectButton, "Connection Tool");
    167171      //
    168172      // relayoutButton
     
    175179      this.relayoutButton.UseVisualStyleBackColor = true;
    176180      this.relayoutButton.Click += new System.EventHandler(relayoutButton_Click);
     181      this.buttonToolTip.SetToolTip(this.relayoutButton, "Relayout Graph");
    177182      //
    178183      // zoomAreaButton
     
    185190      this.zoomAreaButton.UseVisualStyleBackColor = true;
    186191      this.zoomAreaButton.Click += new System.EventHandler(zoomAreaButton_Click);
     192      this.buttonToolTip.SetToolTip(this.zoomAreaButton, "Zoom Area Tool");
    187193      //
    188194      // zoomInButton
    189195      //
    190       this.zoomInButton.Image = HeuristicLab.Common.Resources.Resources.ShowLargeIcons;
     196      this.zoomInButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.ZoomIn;
    191197      this.zoomInButton.Location = new System.Drawing.Point(183, 3);
    192198      this.zoomInButton.Name = "zoomInButton";
     
    195201      this.zoomInButton.UseVisualStyleBackColor = true;
    196202      this.zoomInButton.Click += new System.EventHandler(zoomInButton_Click);
     203      this.buttonToolTip.SetToolTip(this.zoomInButton, "Zoom In");
    197204      //
    198205      // zoomOutButton
    199206      //
    200       this.zoomOutButton.Image = HeuristicLab.Common.Resources.Resources.ShowSmallIcons;
     207      this.zoomOutButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.ZoomOut;
    201208      this.zoomOutButton.Location = new System.Drawing.Point(213, 3);
    202209      this.zoomOutButton.Name = "zoomOutButton";
     
    205212      this.zoomOutButton.UseVisualStyleBackColor = true;
    206213      this.zoomOutButton.Click += new System.EventHandler(zoomOutButton_Click);
     214      this.buttonToolTip.SetToolTip(this.zoomOutButton, "Zoom Out");
    207215      //
    208216      // OperatorGraphView
     
    241249    private System.Windows.Forms.Button connectButton;
    242250    private System.Windows.Forms.Button panButton;
     251    private System.Windows.Forms.ToolTip buttonToolTip;
    243252  }
    244253}
Note: See TracChangeset for help on using the changeset viewer.