コード例 #1
0
ファイル: MainWindow.cs プロジェクト: thatdamnranga/ScoobyRom
    void Show3D(Table3D table)
    {
        if (table == null)
        {
            return;
        }
        var valuesZ = table.GetValuesZasFloats();
        var tableUI = new GtkWidgets.TableWidget(coloring, table.ValuesX, table.ValuesY, valuesZ, table.Zmin, table.Zmax);

        tableUI.TitleMarkup = GtkWidgets.TableWidget.MakeTitleMarkup(table.Title, table.UnitZ);
        tableUI.AxisMarkupX = GtkWidgets.TableWidget.MakeMarkup(table.NameX, table.UnitX);
        tableUI.AxisMarkupY = GtkWidgets.TableWidget.MakeMarkup(table.NameY, table.UnitY);

        // HACK FormatValues, no good digits algorithm yet
        int digits = ScoobyRom.Data.AutomaticMinDigits(valuesZ);

        if (digits <= 3)
        {
            tableUI.FormatValues = ScoobyRom.Data.ValueFormat(digits);
        }
        else
        {
            tableUI.FormatValues = table.Zmax < 30 ? "0.00" : "0.0";
            if (table.Zmax < 10)
            {
                tableUI.FormatValues = "0.000";
            }
        }


        // 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.scrolledwindowTable3D.Child;
        if (previous != null)
        {
            this.scrolledwindowTable3D.Remove(previous);
        }
        // previous.Dispose () or previous.Destroy () cause NullReferenceException!

        this.scrolledwindowTable3D.Add(viewPort);
        this.scrolledwindowTable3D.ShowAll();
    }
コード例 #2
0
ファイル: MainWindow.cs プロジェクト: dschultzca/ScoobyRom
    void Show3D(Table3D table)
    {
        if (table == null)
            return;
        var valuesZ = table.GetValuesZasFloats ();
        var tableUI = new GtkWidgets.TableWidget (coloring, table.ValuesX, table.ValuesY, valuesZ, table.Zmin, table.Zmax);
        tableUI.TitleMarkup = GtkWidgets.TableWidget.MakeTitleMarkup (table.Title, table.UnitZ);
        tableUI.AxisMarkupX = GtkWidgets.TableWidget.MakeMarkup (table.NameX, table.UnitX);
        tableUI.AxisMarkupY = GtkWidgets.TableWidget.MakeMarkup (table.NameY, table.UnitY);

        // HACK FormatValues, no good digits algorithm yet
        int digits = ScoobyRom.Data.AutomaticMinDigits(valuesZ);
        if (digits <= 3)
        {
            tableUI.FormatValues = ScoobyRom.Data.ValueFormat(digits);
        }
        else{
            tableUI.FormatValues = table.Zmax < 30 ? "0.00" : "0.0";
            if (table.Zmax < 10)
                tableUI.FormatValues = "0.000";
        }

        // 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.scrolledwindowTable3D.Child;
        if (previous != null)
            this.scrolledwindowTable3D.Remove (previous);
        // previous.Dispose () or previous.Destroy () cause NullReferenceException!

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