コード例 #1
0
    private void removeTable()
    {
        Array buttons = table1.Children;

        foreach (Gtk.Button b in buttons)
        {
            table1.Remove(b);
        }
    }
コード例 #2
0
        /// <summary>
        /// Creates and shows samplePlot [index]
        /// </summary>
        private void ShowSample(int index)
        {
            layout.Remove(plotCanvas);                          // remove previous sample

            currentType   = sampleTypes [index];
            currentSample = (PlotSample)Activator.CreateInstance(currentType);
            plotCanvas    = currentSample.Canvas;

            infoBox.Buffer.Text = currentSample.InfoText;               // update info Text
            layout.Attach(plotCanvas, 0, 8, 0, 8);                      // attach new sample
            ShowAll();
        }
コード例 #3
0
		static void TableRemoveRow (Table table, uint row, Widget column1, Widget column2, bool destroy)
		{
			uint rows = table.NRows;
			
			foreach (var child in table.Children) {
				var tr = (Table.TableChild) table[child];
				uint bottom = tr.BottomAttach;
				uint top = tr.TopAttach;
				
				if (top >= row && top < rows) {
					tr.BottomAttach = bottom - 1;
					tr.TopAttach = top - 1;
				}
			}
			
			if (column1 != null) {
				table.Remove (column1);
				if (destroy)
					column1.Destroy ();
			}
			
			if (column2 != null) {
				table.Remove (column2);
				if (destroy)
					column2.Destroy ();
			}
			
			table.NRows--;
		}
コード例 #4
0
        private void LoadControlTable(Table table, bool advanced)
        {
            while(table.Children.Length > 0) {
                table.Remove(table.Children[0]);
            }

            table.Resize(1, 1);

            table.RowSpacing = 5;
            table.ColumnSpacing = 12;

            uint y = 0;

            foreach(PipelineVariable variable in profile.Pipeline) {
                if(advanced != variable.Advanced) {
                    continue;
                }

                Label label = new Label();
                label.Show();
                label.Markup = String.Format("<b>{0}:</b>", GLib.Markup.EscapeText(variable.Name));
                label.Xalign = 0.0f;

                try {
                    Widget control = BuildControl(variable);
                    if(control == null) {
                        throw new ApplicationException("Control could not be created");
                    }

                    variable_widgets.Add(variable.Id, control);

                    if(variable.ControlType != PipelineVariableControlType.Check) {
                        variable_widgets.Add(".label." + variable.Id, label);
                    }

                    control.Show();

                    table.Resize(y + 1, 2);

                    if(variable.ControlType != PipelineVariableControlType.Check) {
                        table.Attach(label, 0, 1, y, y + 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
                    }

                    table.Attach(control, 1, 2, y, y + 1,
                        control is ComboBox ? AttachOptions.Fill : AttachOptions.Fill | AttachOptions.Expand,
                        AttachOptions.Fill, 0,
                        (uint)(variable.ControlType == PipelineVariableControlType.Check ? 2 : 0));

                    y++;
                } catch {
                }
            }

            foreach(Widget widget in variable_widgets.Values) {
                if(widget is PipelineVariableComboBox) {
                    OnComboChanged(widget, EventArgs.Empty);
                } else if(widget is CheckButton) {
                    (widget as CheckButton).Toggle();
                }
            }

            table.Visible = y > 0;
        }
コード例 #5
0
ファイル: WarpEditor.cs プロジェクト: Drenn1/LynnaLab
        // Load the i'th warp in the current map.
        void SetWarpIndex(int i)
        {
            List<WarpSourceData> sourceDataList = sourceGroup.GetMapWarpSourceData(map);

            indexSpinButton.Adjustment.Lower = -1;
            indexSpinButton.Adjustment.Upper = sourceDataList.Count-1;

            if (i > indexSpinButton.Adjustment.Upper)
                i = (int)indexSpinButton.Adjustment.Upper;

            indexSpinButton.Value = i;

            valueEditorContainer.Remove(valueEditorContainer.Child);

            if (i == -1) {
                SetDestIndex(-1,-1);
                return;
            }

            Gtk.HBox hbox = new Gtk.HBox();

            WarpSourceData warpSourceData = sourceDataList[i];

            if (warpSourceData.WarpSourceType == WarpSourceType.StandardWarp)
                SetDestIndex(warpSourceData.DestGroup, warpSourceData.DestIndex);

            sourceEditor = new ValueReferenceEditor(Project,
                    warpSourceData);

            Alignment a = new Alignment(0,0,0,0);
            a.Add(sourceEditor);
            hbox.Add(a);

            if (warpSourceData.WarpSourceType == WarpSourceType.PointerWarp) {
                Table table = new Table(1, 1, false);
                table.ColumnSpacing = 6;
                table.RowSpacing = 6;

                SpinButton pointerSpinButton = new SpinButton(0,10,1);

                EventHandler valueChangedHandler = delegate(object sender, EventArgs e) {
                    WarpSourceData pointedData = warpSourceData.GetPointedWarp();

                    pointerSpinButton.Adjustment.Lower = 0;
                    pointerSpinButton.Adjustment.Upper = warpSourceData.GetPointedChainLength()-1;

                    if (pointerSpinButton.ValueAsInt > pointerSpinButton.Adjustment.Upper) {
                        pointerSpinButton.Value = pointerSpinButton.Adjustment.Upper;
                    }
                    int index = pointerSpinButton.ValueAsInt;

                    while (index > 0) {
                        pointedData = pointedData.GetNextWarp();
                        index--;
                    }

                    table.Remove(destEditor);

                    destEditor = new ValueReferenceEditor(Project, pointedData);

                    destEditor.AddDataModifiedHandler(delegate() {
                            SetDestIndex(pointedData.DestGroup, pointedData.DestIndex);
                        });

                    table.Attach(destEditor, 0, 2, 1, 2);

                    SetDestIndex(pointedData.DestGroup, pointedData.DestIndex);
                };

                pointerSpinButton.ValueChanged += valueChangedHandler;

                // Button which, when clicked, adds a new PointedData to the
                // "chain".
                Gtk.Button addPointedWarpButton =
                    new Gtk.Button(new Gtk.Image(Gtk.Stock.Add, Gtk.IconSize.Button));

                addPointedWarpButton.Clicked += delegate(object sender, EventArgs e) {
                    WarpSourceData pointedData = warpSourceData.GetPointedWarp();

                    while (pointedData.GetNextWarp() != null) {
                        pointedData = pointedData.GetNextWarp();
                    }

                    WarpSourceData nextData = new WarpSourceData(Project,
                            WarpSourceData.WarpCommands[(int)WarpSourceType.PointedWarp],
                            WarpSourceData.DefaultValues[(int)WarpSourceType.PointedWarp],
                            pointedData.FileParser,
                            new List<int>{-1});
                    pointedData.SetNextWarp(nextData);

                    pointerSpinButton.Adjustment.Upper++;
                    pointerSpinButton.Value = warpSourceData.GetPointedChainLength()-1;
                    valueChangedHandler(null, null);
                };

                // Button which removes a PointedData from the "chain", unless
                // there is only one remaining.
                Gtk.Button removePointedWarpButton =
                    new Gtk.Button(new Gtk.Image(Gtk.Stock.Remove, Gtk.IconSize.Button));

                removePointedWarpButton.Clicked += delegate(object sender, EventArgs e) {
                    int index = pointerSpinButton.ValueAsInt;
                    WarpSourceData pointedData = warpSourceData.GetPointedWarp();

                    if (pointedData.GetPointedChainLength() <= 1) // Don't delete the last one
                        return;

                    while (index > 0) {
                        pointedData = pointedData.GetNextWarp();
                        index--;
                    }

                    pointedData.FileParser.RemoveFileComponent(pointedData);

                    valueChangedHandler(null, null);
                };

                table.Attach(new Gtk.Label("Pointer index"), 0, 1, 0, 1);
                table.Attach(pointerSpinButton, 1, 2, 0, 1);
                table.Attach(addPointedWarpButton, 2, 3, 0, 1);
                table.Attach(removePointedWarpButton, 3, 4, 0, 1);

                // Invoke handler
                valueChangedHandler(pointerSpinButton, null);

                Frame frame = new Frame(warpSourceData.PointerString);
                frame.Add(table);

                hbox.Add(frame);
            }
            else { // Not pointerWarp
                sourceEditor.AddDataModifiedHandler(delegate() {
                        SetDestIndex(warpSourceData.DestGroup, warpSourceData.DestIndex);
                        });
            }

            valueEditorContainer.Add(hbox);
            valueEditorContainer.ShowAll();
        }