Inheritance: TableWidgetBase
コード例 #1
0
ファイル: MainWindow.cs プロジェクト: spegelref/ScoobyRom
    void Show2D(Tables.Denso.Table2D table)
    {
        if (table == null)
        {
            return;
        }

        navbarwidget.CurrentPos = table.Location;
        navbarwidget.SetMarkedPositions(new int[] { table.RangeX.Pos, table.RangeY.Pos });

        // plot
        plot2D.Draw(table);

        // table data as text
        var values  = table.GetValuesYasFloats();
        var tableUI = new GtkWidgets.TableWidget2D(coloring, table.ValuesX, values, table.Xmin, table.Xmax, table.Ymin, table.Ymax);

        tableUI.HeaderAxisMarkup   = Util.Markup.Unit(table.UnitX);
        tableUI.HeaderValuesMarkup = Util.Markup.Unit(table.UnitY);
        tableUI.AxisXMarkup        = Util.Markup.NameUnit(table.NameX, table.UnitX);
        tableUI.ValuesMarkup       = Util.Markup.NameUnit(table.Title, table.UnitY);
        tableUI.FormatValues       = ScoobyRom.Data.AutomaticValueFormat(values, table.Ymin, table.Ymax);

        // Viewport needed for ScrolledWindow to work as generated table widget has no scroll support
        var viewPort = new Gtk.Viewport();

        viewPort.Add(tableUI.Create());

        Gtk.Widget previous = this.scrolledwindowTable2D.Child;
        if (previous != null)
        {
            this.scrolledwindowTable2D.Remove(previous);
        }
        // previous.Dispose () or previous.Destroy () cause NullReferenceException!

        this.scrolledwindowTable2D.Add(viewPort);
        this.scrolledwindowTable2D.ShowAll();
    }
コード例 #2
0
    void Show2D(Tables.Denso.Table2D table)
    {
        if (table == null)
            return;

        navbarwidget.CurrentPos = table.Location;
        navbarwidget.SetMarkedPositions (new int[] { table.RangeX.Pos, table.RangeY.Pos });

        // plot
        plot2D.Draw (table);

        // table data as text
        var values = table.GetValuesYasFloats ();
        var tableUI = new GtkWidgets.TableWidget2D (coloring, table.ValuesX, values, table.Xmin, table.Xmax, table.Ymin, table.Ymax);
        tableUI.HeaderAxisMarkup = Util.Markup.Unit (table.UnitX);
        tableUI.HeaderValuesMarkup = Util.Markup.Unit (table.UnitY);
        tableUI.AxisXMarkup = Util.Markup.NameUnit (table.NameX, table.UnitX);
        tableUI.ValuesMarkup = Util.Markup.NameUnit (table.Title, table.UnitY);
        tableUI.FormatValues = ScoobyRom.Data.AutomaticValueFormat (values, table.Ymin, table.Ymax);

        // Viewport needed for ScrolledWindow to work as generated table widget has no scroll support
        var viewPort = new Gtk.Viewport ();
        viewPort.Add (tableUI.Create ());

        Gtk.Widget previous = this.scrolledwindowTable2D.Child;
        if (previous != null)
            this.scrolledwindowTable2D.Remove (previous);
        // previous.Dispose () or previous.Destroy () cause NullReferenceException!

        this.scrolledwindowTable2D.Add (viewPort);
        this.scrolledwindowTable2D.ShowAll ();
    }