Beispiel #1
0
        public override void Run(Altaxo.Graph.GUI.GraphController ctrl)
        {
            GraphDocument newDoc = new GraphDocument(ctrl.Doc);

            Current.Project.GraphDocumentCollection.Add(newDoc);
            Current.ProjectService.CreateNewGraph(newDoc);
        }
Beispiel #2
0
 public override void Run(Altaxo.Graph.GUI.GraphController ctrl)
 {
     ctrl.EnsureValidityOfCurrentLayerNumber();
     if (null != ctrl.ActiveLayer)
     {
         LayerController.ShowDialog(ctrl.ActiveLayer);
     }
 }
    public static void Rename(GraphController ctrl)
    {
      TextValueInputController tvctrl = new TextValueInputController(ctrl.Doc.Name,"Enter a name for the graph:");
      tvctrl.Validator = new GraphRenameValidator(ctrl.Doc, ctrl);

      if(Current.Gui.ShowDialog(tvctrl, "Rename graph", false))
        ctrl.Doc.Name = tvctrl.InputText.Trim();
    }
      public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
      {

        GraphController s = new GraphController(null,true);
        info.GetBaseValueEmbedded(s,typeof(GraphController),parent);

        return new SDGraphViewContent(s);
      }
Beispiel #5
0
        public override void Run(Altaxo.Graph.GUI.GraphController ctrl)
        {
            string result = Altaxo.Graph.Procedures.NonlinearFitting.Fit(ctrl);

            if (null != result)
            {
                Current.Gui.ErrorMessageBox(result);
            }
        }
Beispiel #6
0
 public override void Run(Altaxo.Graph.GUI.GraphController ctrl)
 {
     try
     {
         if (Current.Gui.ShowPageSetupDialog())
         {
             ctrl.Doc.SetGraphPageBoundsToPrinterSettings();
         }
     }
     catch (Exception exc)
     {
         MessageBox.Show(ctrl.View.Form, exc.ToString(), "Exception occured!");
     }
 }
Beispiel #7
0
        public override void Run(Altaxo.Graph.GUI.GraphController ctrl)
        {
            FitPolynomialDialogController dlg = new FitPolynomialDialogController(2, double.NegativeInfinity, double.PositiveInfinity, false);

            if (Current.Gui.ShowDialog(dlg, "Polynomial fit", false))
            {
                Altaxo.Graph.Procedures.PolynomialFitting.Fit(ctrl, dlg.Order, dlg.FitCurveXmin, dlg.FitCurveXmax, dlg.ShowFormulaOnGraph);
            }

            /*
             * if(DialogFactory.ShowPolynomialFitDialog(Current.MainWindow,dlg))
             * {
             * Altaxo.Graph.Procedures.PolynomialFitting.Fit(ctrl,dlg.Order,dlg.FitCurveXmin,dlg.FitCurveXmax,dlg.ShowFormulaOnGraph);
             * }
             */
        }
Beispiel #8
0
        public override void Run(Altaxo.Graph.GUI.GraphController ctrl)
        {
            System.IO.Stream myStream;
            SaveFileDialog   saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.Filter           = "Tiff files (*.tif)|*.tif|All files (*.*)|*.*";
            saveFileDialog1.FilterIndex      = 1;
            saveFileDialog1.RestoreDirectory = true;

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                if ((myStream = saveFileDialog1.OpenFile()) != null)
                {
                    ctrl.SaveAsBitmap(myStream, 300, System.Drawing.Imaging.ImageFormat.Tiff);
                    myStream.Close();
                } // end openfile ok
            }     // end dlgresult ok
        }
Beispiel #9
0
        public override void Run(Altaxo.Graph.GUI.GraphController ctrl)
        {
            System.IO.Stream myStream;
            SaveFileDialog   saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.Filter           = "Windows Metafiles (*.emf)|*.emf|All files (*.*)|*.*";
            saveFileDialog1.FilterIndex      = 1;
            saveFileDialog1.RestoreDirectory = true;

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                if ((myStream = saveFileDialog1.OpenFile()) != null)
                {
                    ctrl.SaveAsMetafile(myStream);
                    myStream.Close();
                } // end openfile ok
            }     // end dlgresult ok
        }
Beispiel #10
0
 public override void Run(Altaxo.Graph.GUI.GraphController ctrl)
 {
     try
     {
         System.Windows.Forms.PrintPreviewDialog dlg = new System.Windows.Forms.PrintPreviewDialog();
         Current.PrintingService.PrintDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(ctrl.EhPrintPage);
         dlg.Document = Current.PrintingService.PrintDocument;
         dlg.ShowDialog(ctrl.View.Form);
         dlg.Dispose();
     }
     catch (Exception ex)
     {
         System.Windows.Forms.MessageBox.Show(ctrl.View.Form, ex.ToString());
     }
     finally
     {
         Current.PrintingService.PrintDocument.PrintPage -= new System.Drawing.Printing.PrintPageEventHandler(ctrl.EhPrintPage);
     }
 }
Beispiel #11
0
        public override void Run(Altaxo.Graph.GUI.GraphController ctrl)
        {
            FunctionEvaluationScript script = null; //

            if (script == null)
            {
                script = new FunctionEvaluationScript();
            }

            object[] args = new object[] { script, new ScriptExecutionHandler(this.EhScriptExecution) };
            if (Current.Gui.ShowDialog(args, "Function script"))
            {
                ctrl.EnsureValidityOfCurrentLayerNumber();

                script = (FunctionEvaluationScript)args[0];
                XYFunctionPlotItem functItem = new XYFunctionPlotItem(new XYFunctionPlotData(script), new G2DPlotStyleCollection(LineScatterPlotStyleKind.Line));
                ctrl.Doc.Layers[ctrl.CurrentLayerNumber].PlotItems.Add(functItem);
            }
        }
Beispiel #12
0
        public override void Run(Altaxo.Graph.GUI.GraphController ctrl)
        {
            System.IO.Stream myStream;
            SaveFileDialog   saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.Filter           = "Altaxo graph files (*.axogrp)|*.axogrp|All files (*.*)|*.*";
            saveFileDialog1.FilterIndex      = 1;
            saveFileDialog1.RestoreDirectory = true;

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                if ((myStream = saveFileDialog1.OpenFile()) != null)
                {
                    Altaxo.Serialization.Xml.XmlStreamSerializationInfo info = new Altaxo.Serialization.Xml.XmlStreamSerializationInfo();
                    info.BeginWriting(myStream);
                    info.AddValue("Graph", ctrl.Doc);
                    info.EndWriting();
                    myStream.Close();
                }
            }
        }
Beispiel #13
0
 protected void EhWorkbenchContentChanged(object o, System.EventArgs e)
 {
     if (!object.ReferenceEquals(Controller, myCurrentGraphController))
     {
         if (null != myCurrentGraphController)
         {
             lock (this)
             {
                 this.myCurrentGraphController.CurrentGraphToolChanged -= new EventHandler(this.EhGraphToolChanged);
                 this.myCurrentGraphController = null;
             }
         }
         if (Controller != null)
         {
             lock (this)
             {
                 this.myCurrentGraphController = this.Controller;
                 this.myCurrentGraphController.CurrentGraphToolChanged += new EventHandler(this.EhGraphToolChanged);
             }
         }
     }
 }
Beispiel #14
0
 public override void Run(Altaxo.Graph.GUI.GraphController ctrl)
 {
     ctrl.Doc.Layers[ctrl.CurrentLayerNumber].RescaleXAxis();
     ctrl.Doc.Layers[ctrl.CurrentLayerNumber].RescaleYAxis();
 }
Beispiel #15
0
 public override void Run(Altaxo.Graph.GUI.GraphController ctrl)
 {
     ctrl.Doc.Layers[ctrl.CurrentLayerNumber].CreateNewLayerLegend();
 }
Beispiel #16
0
 public override void Run(Altaxo.Graph.GUI.GraphController ctrl)
 {
     ctrl.EnsureValidityOfCurrentLayerNumber();
     ctrl.Doc.Layers[ctrl.CurrentLayerNumber].PlotItems.Add(new XYFunctionPlotItem(new XYFunctionPlotData(new PolynomialFunction(new double[] { 0, 0, 1 })), new G2DPlotStyleCollection(LineScatterPlotStyleKind.Line)));
 }
 /// <summary>
 /// Copies the current graph as an bitmap image to the clipboard.
 /// </summary>
 /// <param name="ctrl">Controller controlling the current graph.</param>
 /// <param name="dpiResolution">Resolution of the bitmap in dpi. Determines the pixel size of the bitmap.</param>
 /// <param name="backbrush">Brush used to fill the background of the image. Can be <c>null</c>.</param>
 /// <param name="pixelformat">Specify the pixelformat here.</param>
 public static void CopyPageToClipboardAsBitmap(GraphController ctrl, int dpiResolution, Brush backbrush, PixelFormat pixelformat)
 {
   System.Windows.Forms.DataObject dao = new System.Windows.Forms.DataObject();
   System.Drawing.Bitmap bitmap = Altaxo.Graph.Procedures.Export.SaveAsBitmap(ctrl.Doc, dpiResolution, backbrush, pixelformat);
   dao.SetImage(bitmap);
   System.Windows.Forms.Clipboard.SetDataObject(dao);
 }
Beispiel #18
0
 /// <summary>
 /// Override this function for adding own worksheet commands. You will get
 /// the worksheet controller in the parameter.
 /// </summary>
 /// <param name="ctrl">The worksheet controller this command is applied to.</param>
 public abstract void Run(Altaxo.Graph.GUI.GraphController ctrl);
Beispiel #19
0
 public override void Run(Altaxo.Graph.GUI.GraphController ctrl)
 {
     ctrl.Doc.CreateNewLayerNormalBottomXLeftY();
 }
Beispiel #20
0
 public override void Run(Altaxo.Graph.GUI.GraphController ctrl)
 {
     Altaxo.Graph.Procedures.GraphCommands.CopyPageToClipboardAsBitmap(ctrl, 300, Brushes.White, PixelFormat.Format24bppRgb);
 }
Beispiel #21
0
 public override void Run(Altaxo.Graph.GUI.GraphController ctrl)
 {
     Altaxo.Graph.Procedures.GraphCommands.CopyPageToClipboardAsBitmap(ctrl, 300, null, PixelFormat.Format32bppArgb);
 }
Beispiel #22
0
 public override void Run(Altaxo.Graph.GUI.GraphController ctrl)
 {
     Altaxo.Graph.Procedures.GraphCommands.CopyPageToClipboard(ctrl);
 }
 public GraphRenameValidator(GraphDocument graphdoc, GraphController ctrl)
   : base("The graph's name must not be empty! Please enter a valid name.")
 {
   _doc = graphdoc;
   _controller = ctrl;
 }
 protected SDGraphViewContent(GraphController ctrl)
 {
   _controller = ctrl;
   _controller.TitleNameChanged += EhTitleNameChanged;
 }
 public override void Run(GraphController ctrl)
 {
   Altaxo.Graph.Procedures.ArrangeLayersDocument.ArrangeLayers(ctrl.Doc);
 }
 public override void Run(GraphController ctrl)
 {
   ctrl.ArrangeRight();
 }
Beispiel #27
0
 public override void Run(Altaxo.Graph.GUI.GraphController ctrl)
 {
     ctrl.Doc.CreateNewLayerLinkedTopXRightY_XAxisStraight(ctrl.CurrentLayerNumber);
 }
 public static void Refresh(GraphController ctrl)
 {
   ctrl.RefreshGraph();
 }
Beispiel #29
0
 public override void Run(Altaxo.Graph.GUI.GraphController ctrl)
 {
     Altaxo.Graph.Procedures.GraphCommands.Refresh(ctrl);
 }
 public override void Run(GraphController ctrl)
 {
   ctrl.ArrangeVerticalTable();
 }
 public override void Run(GraphController ctrl)
 {
   ctrl.ArrangeBottom();
 }
      /*
      [DllImport("user32.dll")]
      static extern bool OpenClipboard(IntPtr hWndNewOwner);
      [DllImport("user32.dll")]
      static extern bool EmptyClipboard();
      [DllImport("user32.dll")]
      static extern IntPtr SetClipboardData(uint uFormat, IntPtr hMem);
      [DllImport("user32.dll")]
      static extern bool CloseClipboard();
      [DllImport("gdi32.dll")]
      static extern IntPtr CopyEnhMetaFile(IntPtr hemfSrc, IntPtr hNULL);
      [DllImport("gdi32.dll")]
      static extern bool DeleteEnhMetaFile(IntPtr hemf);

      /// <summary>
      /// Microsoft Knowledge Base Article - 323530 PRB: Metafiles on Clipboard Are Not Visible to All Applications
      /// </summary>
      /// <param name="hWnd"></param>
      /// <param name="mf"></param>
      /// <returns></returns>
      static bool PutEnhMetafileOnClipboard(IntPtr hWnd, Metafile mf)
      {
        bool bResult = false;
        IntPtr hEMF, hEMF2;
        hEMF = mf.GetHenhmetafile(); // invalidates mf
        if (!hEMF.Equals(new IntPtr(0)))
        {
          hEMF2 = CopyEnhMetaFile(hEMF, new IntPtr(0));
          if (!hEMF2.Equals(new IntPtr(0)))
          {
            if (OpenClipboard(hWnd))
            {
              if (EmptyClipboard())
              {
                IntPtr hRes = SetClipboardData(14 , hEMF2); // 14==CF_ENHMETAFILE
                bResult = hRes.Equals(hEMF2);
                CloseClipboard();
             }
            }
          }
          DeleteEnhMetaFile(hEMF);
        }
        return bResult;
      }
      */


      static public void Run(GraphController ctrl)
      {
       // System.Drawing.Imaging.Metafile mf = Altaxo.Graph.Procedures.Export.GetMetafile(ctrl.Doc);
       // PutEnhMetafileOnClipboard(ctrl.View.Form.Handle, mf);

        System.Windows.Forms.DataObject dao = new System.Windows.Forms.DataObject();
        string filepath = System.IO.Path.GetTempPath();
        string filename = filepath + "AltaxoClipboardMetafile.emf";
        if (System.IO.File.Exists(filename))
          System.IO.File.Delete(filename);
        Metafile mf = Altaxo.Graph.Procedures.Export.SaveAsMetafile(ctrl.Doc, filename, 300);
        System.Collections.Specialized.StringCollection coll = new System.Collections.Specialized.StringCollection();
        coll.Add(filename);
        dao.SetFileDropList(coll);
        dao.SetData(typeof(Metafile), mf);
        System.Windows.Forms.Clipboard.SetDataObject(dao);

        
      }
 public override void Run(GraphController ctrl)
 {
   ctrl.ArrangeHorizontalTable();
 }
 public static void CopyPageToClipboard(GraphController ctrl)
 {
   CopyPageCommand.Run(ctrl);
 }
 protected void EhWorkbenchContentChanged(object o, System.EventArgs e)
 {
   if(!object.ReferenceEquals(Controller,myCurrentGraphController))
   {
     if(null!=myCurrentGraphController)
     {
       lock(this)
       {
         this.myCurrentGraphController.CurrentGraphToolChanged -= new EventHandler(this.EhGraphToolChanged);
         this.myCurrentGraphController = null;
       }
     }
     if(Controller!=null)
     {
       lock(this)
       {
         this.myCurrentGraphController = this.Controller;
         this.myCurrentGraphController.CurrentGraphToolChanged += new EventHandler(this.EhGraphToolChanged);
       }
     }
   }
 }
 protected SDGraphViewContent(GraphController ctrl)
 {
     _controller = ctrl;
     _controller.TitleNameChanged += EhTitleNameChanged;
 }