コード例 #1
1
        public PlayerScoreController(GUILauncher launcher)
            : base(launcher)
        {
            hBox = new HBox();

            mySpinButtons = new List<SpinButton>();
            GameState state = launcher.OurGameApp.GameState;

            for (int i = 0; i < state.NumPlayers; i++ )
            {
                Label player = new Label("Score joueur " + (i+1).ToString() + ":");
                hBox.Add(player);

                SpinButton playerSpinButton = new SpinButton(0, 9999999d, 1);
                mySpinButtons.Add(playerSpinButton);

                playerSpinButton.ValueChanged += this.OnPlayerScoreEntryChanged;

                playerSpinButton.Digits = 0;
                playerSpinButton.Numeric = true;
                playerSpinButton.Wrap = true;
                playerSpinButton.SnapToTicks = true;
                hBox.Add(playerSpinButton);
            }

            this.Add(hBox);
            this.ShowAll();
        }
コード例 #2
0
    private void create_list_d_spinbutton()
    {
        /*
         * adjustment definition:
         * initial value
         * minimum value
         * maximum value
         * increment for a single step (e.g. one click on an arrow)
         * increment for a page-up or page-down keypress
         * page size (using any value other than 0 for this parameter is deprecated)
         *
         * spinbutton creation (adjustment, climb rate, decimals)
         */
        spin_d_0 = new Gtk.SpinButton(new Adjustment(4, .5f, 80.0f, .01f, 10.0f, 0f), 1, 2);
        spin_d_1 = new Gtk.SpinButton(new Adjustment(4, .5f, 80.0f, .01f, 10.0f, 0f), 1, 2);
        spin_d_2 = new Gtk.SpinButton(new Adjustment(4, .5f, 80.0f, .01f, 10.0f, 0f), 1, 2);
        spin_d_3 = new Gtk.SpinButton(new Adjustment(4, .5f, 80.0f, .01f, 10.0f, 0f), 1, 2);
        spin_d_4 = new Gtk.SpinButton(new Adjustment(4, .5f, 80.0f, .01f, 10.0f, 0f), 1, 2);
        spin_d_5 = new Gtk.SpinButton(new Adjustment(4, .5f, 80.0f, .01f, 10.0f, 0f), 1, 2);
        spin_d_6 = new Gtk.SpinButton(new Adjustment(4, .5f, 80.0f, .01f, 10.0f, 0f), 1, 2);
        spin_d_7 = new Gtk.SpinButton(new Adjustment(4, .5f, 80.0f, .01f, 10.0f, 0f), 1, 2);
        spin_d_8 = new Gtk.SpinButton(new Adjustment(4, .5f, 80.0f, .01f, 10.0f, 0f), 1, 2);
        spin_d_9 = new Gtk.SpinButton(new Adjustment(4, .5f, 80.0f, .01f, 10.0f, 0f), 1, 2);

        combo_d_num.Active = 0;

        reset_hbox_list_d(1);
    }
コード例 #3
0
ファイル: OpenRemoteServer.cs プロジェクト: gclark916/banshee
        public OpenRemoteServer () : base (Catalog.GetString ("Open remote DAAP server"), null)
        {
            VBox.Spacing = 6;
            VBox.PackStart (new Label () {
                Xalign = 0.0f,
                Text = Catalog.GetString ("Enter server IP address and port:")
            }, true, true, 0);

            HBox box = new HBox ();
            box.Spacing = 12;
            VBox.PackStart (box, false, false, 0);

            address_entry = ComboBoxEntry.NewText ();
            address_entry.Entry.Activated += OnEntryActivated;
            address_entry.Entry.WidthChars = 30;
            address_entry.Show ();

            port_entry = new SpinButton (1d, 65535d, 1d);
            port_entry.Value = 3689;
            port_entry.Show ();

            box.PackStart (address_entry, true, true, 0);
            box.PackEnd (port_entry, false, false, 0);

            address_entry.HasFocus = true;

            VBox.ShowAll ();

            AddStockButton (Stock.Cancel, ResponseType.Cancel);
            AddStockButton (Stock.Add, ResponseType.Ok, true);

            LoadHistory();
        }
コード例 #4
0
ファイル: ConfigurationDialog.cs プロジェクト: h0rm/No.Noise
        public ConfigurationDialog (LCDService plugin)
        {
            this.plugin = plugin;
            Title = AddinManager.CurrentLocalizer.GetString ("LCD configuration");
            BorderWidth = 5;
            HasSeparator = false;
            Resizable = false;

            VBox lcdproc_box = new VBox ();

            HBox host_box = new HBox ();
            host_box.PackStart (new Label (AddinManager.CurrentLocalizer.GetString ("Hostname:")), false, false, 3);
            host_entry = new Entry ();
            host_box.PackStart (host_entry, true, true, 3);
            host_entry.Text = this.plugin.Host;
            host_entry.Changed += new EventHandler (Host_Changed);

            HBox port_box = new HBox ();
            port_box.PackStart (new Label (AddinManager.CurrentLocalizer.GetString ("Port:")), false, false, 3);
            port_spin = new SpinButton (1, 65535, 1);
            port_box.PackStart (port_spin, true, true, 3);
            port_spin.Value = this.plugin.Port;
            port_spin.Changed += new EventHandler (Port_Changed);

            Frame lcdproc_frame = new Frame (AddinManager.CurrentLocalizer.GetString ("LCDProc Daemon:"));
            lcdproc_box.PackStart (host_box);
            lcdproc_box.PackStart (port_box);
            lcdproc_frame.Add (lcdproc_box);
            lcdproc_frame.ShowAll ();

            VBox.PackStart (lcdproc_frame, false, false, 3);
            AddButton (Stock.Close, ResponseType.Close);
        }
コード例 #5
0
        private void BuildWidget()
        {
            sleepHour = new SpinButton (0,23,1);
            sleepMin  = new SpinButton (0,59,1);

            sleepHour.WidthChars = 2;
            sleepMin.WidthChars  = 2;

            int remainder = 0;
            sleepHour.Value = Math.DivRem (service.SleepTimerDuration, 60, out remainder);
            sleepMin.Value = remainder;

            sleepHour.ValueChanged += OnSleepValueChanged;
            sleepMin.ValueChanged += OnSleepValueChanged;

            Label prefix    = new Label (AddinManager.CurrentLocalizer.GetString ("Sleep Timer :"));
            Label separator = new Label (":");

            HBox topbox     = new HBox (false, 10);

            topbox.PackStart (prefix, true, true, 2);
            topbox.PackStart (sleepHour, true, true, 2);
            topbox.PackStart (separator, true, true, 2);
            topbox.PackStart (sleepMin, true, true, 2);

            AddStockButton (Stock.Cancel, ResponseType.Cancel);
            start_button = AddButton (AddinManager.CurrentLocalizer.GetString ("Start Timer"), ResponseType.Ok, true);

            VBox.PackStart (topbox, true, true, 2);

            Update ();
        }
コード例 #6
0
        public ErrorMatrixPanel(uint rows, uint cols)
            : base(4, 2, false)
        {
            divisorSpinButton = new SpinButton(1, 10000, 1);
            sourceOffsetXSpinButton = new SpinButton(1, cols, 1);
            customDivisorCheckButton = new CheckButton("Use a custom divisor?");
            customDivisorCheckButton.Toggled += delegate
            {
                divisorSpinButton.Sensitive = customDivisorCheckButton.Active;
            };

            matrixPanel = new MatrixPanel(rows, cols);
            matrixPanel.MatrixResized += delegate
            {
                sourceOffsetXSpinButton.Adjustment.Upper =
                    matrixPanel.Columns;
            };

            presets = new List<ErrorMatrix>(ErrorMatrix.Samples.listMatrices());
            var presetsNames = from preset in presets select preset.Name;
            presetComboBox = new ComboBox(presetsNames.ToArray());
            presetComboBox.Changed += delegate
            {
                int active = presetComboBox.Active;
                if (active >= 0) {
                    Matrix = presets[active];
                }
            };

            ColumnSpacing = 2;
            RowSpacing = 2;
            BorderWidth = 2;

            Attach(new Label("Preset:") { Xalign = 0.0f }, 0, 1, 0, 1,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Shrink, 0, 0);
            Attach(presetComboBox, 1, 2, 0, 1,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Shrink, 0, 0);

            Attach(matrixPanel, 0, 2, 1, 2,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Fill | AttachOptions.Expand, 0, 0);

            Attach(new Label("Source offset X:") { Xalign = 0.0f },
                0, 1, 2, 3, AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Shrink, 0, 0);
            Attach(sourceOffsetXSpinButton, 1, 2, 2, 3,
                AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

            Attach(customDivisorCheckButton, 0, 2, 3, 4,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Shrink, 0, 0);

            Attach(new Label("Divisor:") { Xalign = 0.0f }, 0, 1, 4, 5,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Shrink, 0, 0);
            Attach(divisorSpinButton, 1, 2, 4, 5,
                AttachOptions.Fill, AttachOptions.Shrink, 0, 0);
        }
コード例 #7
0
        private void BuildWidget()
        {
            sleepHour = new SpinButton (0,23,1);
            sleepMin  = new SpinButton (0,59,1);

            sleepHour.Value = (int) plugin.GetSleepTimer () / 60 ;
            sleepMin.Value = plugin.GetSleepTimer () - (sleepHour.Value * 60);

            sleepHour.WidthChars = 2;
            sleepMin.WidthChars  = 2;

            Label prefix    = new Label (Catalog.GetString ("Sleep Timer :"));
            Label separator = new Label (":");
            Label comment   = new Label (Catalog.GetString ("<i>(set to 0:00 to disable)</i>"));
            comment.UseMarkup = true;

            Button OK = new Button (Gtk.Stock.Ok);
            OK.Clicked += new EventHandler (OnSleepTimerOK);

            HBox topbox     = new HBox (false, 10);

            topbox.PackStart (prefix);
            topbox.PackStart (sleepHour);
            topbox.PackStart (separator);
            topbox.PackStart (sleepMin);

            this.AddActionWidget (OK, 0);

            this.VBox.PackStart (topbox);
            this.VBox.PackStart (comment);
        }
コード例 #8
0
        /// <summary>
        /// Creates the config widget.
        /// </summary>
        /// <returns>The config widget.</returns>
        public override Gtk.Widget CreateConfigWidget()
        {
            var container = new VBox();
            var citiesNumber = new SpinButton(2, 10000, 2);
            citiesNumber.Text = "Number of cities";
            citiesNumber.Value = m_numberOfCities;
            citiesNumber.ValueChanged += delegate
            {
                m_numberOfCities = citiesNumber.ValueAsInt - (citiesNumber.ValueAsInt % 2);
                citiesNumber.Value = m_numberOfCities;
                OnReconfigured();
            };
            container.Add(citiesNumber);

            var generateButton = new Button();
            generateButton.Label = "Generate cities";
            generateButton.Clicked += delegate
            {
                m_numberOfCities = citiesNumber.ValueAsInt;
                OnReconfigured();
            };
            container.Add(generateButton);

            var showIndexes = new CheckButton();
            showIndexes.Active = m_showIndexes;
            showIndexes.Label = "Show indexes";
            showIndexes.Toggled += delegate
            {
                m_showIndexes = showIndexes.Active;
            };

            container.Add(showIndexes);

            return container;
        }
コード例 #9
0
        public override bool GetPreferenceTabWidget(PreferencesDialog parent,
                                                    out string tabLabel,
                                                    out Gtk.Widget preferenceWidget)
        {
            Gtk.Label      label;
            Gtk.SpinButton menuNoteCountSpinner;
            Gtk.Alignment  align;
            int            menuNoteCount;

            // Addin's tab caption
            tabLabel = Catalog.GetString("Advanced");

            Gtk.VBox opts_list = new Gtk.VBox(false, 12);
            opts_list.BorderWidth = 12;
            opts_list.Show();

            align = new Gtk.Alignment(0.5f, 0.5f, 0.0f, 1.0f);
            align.Show();
            opts_list.PackStart(align, false, false, 0);

            Gtk.Table table = new Gtk.Table(1, 2, false);
            table.ColumnSpacing = 6;
            table.RowSpacing    = 6;
            table.Show();
            align.Add(table);


            // Menu Note Count option
            label = new Gtk.Label(Catalog.GetString("Minimum number of notes to show in Recent list (maximum 18)"));

            label.UseMarkup = true;
            label.Justify   = Gtk.Justification.Left;
            label.SetAlignment(0.0f, 0.5f);
            label.Show();

            table.Attach(label, 0, 1, 0, 1);

            menuNoteCount = (int)Preferences.Get(Preferences.MENU_NOTE_COUNT);
            // we have a hard limit of 18 set, thus not allowing anything bigger than 18
            menuNoteCountSpinner       = new Gtk.SpinButton(1, 18, 1);
            menuNoteCountSpinner.Value = menuNoteCount <= 18 ? menuNoteCount : 18;

            menuNoteCountSpinner.Show();
            table.Attach(menuNoteCountSpinner, 1, 2, 0, 1);

            menuNoteCountSpinner.ValueChanged += UpdateMenuNoteCountPreference;

            if (opts_list != null)
            {
                preferenceWidget = opts_list;
                return(true);
            }
            else
            {
                preferenceWidget = null;
                return(false);
            }
        }
コード例 #10
0
        public SetupDialog()
            : base("Setup Map")
        {
            cellSizeSpin = new SpinButton (0.1, 1.0, 0.1);
            cellSizeSpin.Value = 0.3;
            cellSizeSpin.Changed += CellSizeSpin_Changed;

            widthSpin = new SpinButton (3.0, 10.0, 0.3);
            widthSpin.Value = 9.9;

            heightSpin = new SpinButton (3.0, 10.0, 0.3);
            heightSpin.Value = 4.5;

            portEntry = new Entry ("/dev/tty");
            portEntry.Activated += PortEntry_Activated;

            createButton = new Button ("Create");
            createButton.Clicked += CreateButton_Clicked;

            HBox widthHBox = new HBox (false, 60);
            widthHBox.Add (new Label ("Width: "));
            widthHBox.Add (widthSpin);

            HBox heightHBox = new HBox (false, 60);
            heightHBox.Add (new Label ("Height: "));
            heightHBox.Add (heightSpin);

            HBox cellHBox = new HBox (false, 60);
            cellHBox.Add (new Label ("Cell Size: "));
            cellHBox.Add (cellSizeSpin);

            HBox portHBox = new HBox (false, 60);
            portHBox.Add (new Label ("Port: "));
            portHBox.Add (portEntry);

            HBox createHbox = new HBox (false, 0);
            createHbox.Add (createButton);

            VBox vBox = new VBox (false, 10);
            vBox.BorderWidth = 10;
            vBox.Add (widthHBox);
            vBox.Add (heightHBox);
            vBox.Add (cellHBox);
            vBox.Add (portHBox);
            vBox.Add (createHbox);

            Add (vBox);

            SetPosition (WindowPosition.Center);
            Resizable = false;

            DeleteEvent += delegate
            {
                Application.Quit ();
            };

            Shown += OnShown;
        }
コード例 #11
0
 static void Wrapped_cb(IntPtr inst)
 {
     try {
         SpinButton __obj = GLib.Object.GetObject(inst, false) as SpinButton;
         __obj.OnWrapped();
     } catch (Exception e) {
         GLib.ExceptionManager.RaiseUnhandledException(e, false);
     }
 }
コード例 #12
0
 static void ChangeValue_cb(IntPtr inst, int scroll)
 {
     try {
         SpinButton __obj = GLib.Object.GetObject(inst, false) as SpinButton;
         __obj.OnChangeValue((Gtk.ScrollType)scroll);
     } catch (Exception e) {
         GLib.ExceptionManager.RaiseUnhandledException(e, false);
     }
 }
コード例 #13
0
        public IntegerQueryValueEntry () : base ()
        {
            spin_button = new SpinButton (0.0, 1.0, 1.0);
            spin_button.Digits = 0;
            spin_button.WidthChars = 4;
            spin_button.ValueChanged += HandleValueChanged;

            Add (spin_button);
        }
コード例 #14
0
        private void BindToWidget()
        {
            foreach (var p in GetObjectProperties(m_objectType))
            {
                var hbox = new HBox();

                var label = new Label(p.Name);
                hbox.Add(label);
                var value = p.GetValue(ObjectInstance, null);
                Widget input = null;

                if (p.PropertyType == typeof(int))
                {
                    var spinButton = new SpinButton(0, int.MaxValue, 1);
                    spinButton.Value = Convert.ToDouble(value);
                    input = spinButton;
                }

                if (p.PropertyType == typeof(bool))
                {
                    var toggle = new ToggleButton();
                    toggle.Active = Convert.ToBoolean(value);
                    input = toggle;
                }
                else if (p.PropertyType == typeof(float) || p.PropertyType == typeof(double))
                {
                    var horizontalScale = new HScale(0, 1, 0.05);

                    if (ObjectInstance != null)
                    {
                        horizontalScale.Value = Convert.ToDouble(value);
                    }

                    input = horizontalScale;
                }
                else if (p.PropertyType == typeof(TimeSpan))
                {
                    var secondsHBox = new HBox();
                    var seconds = new SpinButton(0, int.MaxValue, 1);
                    seconds.Value = ((TimeSpan)value).TotalSeconds;
                    secondsHBox.Add(seconds);

                    var secondsLabel = new Label("seconds");
                    secondsHBox.Add(secondsLabel);

                    input = secondsHBox;
                }

                if (input != null)
                {
                    m_widgetMap.Add(p, input);
                    hbox.Add(input);
                }

                VBox.Add(hbox);
            }
        }
コード例 #15
0
 public ToolBarSpinButton(int width,double min, double max, double step )
 {
     SpinButton = new SpinButton (min,max,1);
     SpinButton.AddEvents ((int)Gdk.EventMask.ButtonPressMask);
     SpinButton.WidthRequest = width;
     SpinButton.Show ();
     Add (SpinButton);
     Show ();
 }
コード例 #16
0
		public override bool GetPreferenceTabWidget (	PreferencesDialog parent,
								out string tabLabel,
								out Gtk.Widget preferenceWidget)
		{
			
			Gtk.Label label;
			Gtk.SpinButton menuNoteCountSpinner;
			Gtk.Alignment align;
			int menuNoteCount;

			// Addin's tab caption
			tabLabel = Catalog.GetString ("Advanced");
			
			Gtk.VBox opts_list = new Gtk.VBox (false, 12);
			opts_list.BorderWidth = 12;
			opts_list.Show ();
			
			align = new Gtk.Alignment (0.5f, 0.5f, 0.0f, 1.0f);
			align.Show ();
			opts_list.PackStart (align, false, false, 0);

			Gtk.Table table = new Gtk.Table (1, 2, false);
			table.ColumnSpacing = 6;
			table.RowSpacing = 6;
			table.Show ();
			align.Add (table);


			// Menu Note Count option
			label = new Gtk.Label (Catalog.GetString ("Minimum number of notes to show in Recent list (maximum 18)"));

			label.UseMarkup = true;
			label.Justify = Gtk.Justification.Left;
			label.SetAlignment (0.0f, 0.5f);
			label.Show ();
			
			table.Attach (label, 0, 1, 0, 1);
		
			menuNoteCount = (int) Preferences.Get (Preferences.MENU_NOTE_COUNT);
			// we have a hard limit of 18 set, thus not allowing anything bigger than 18
			menuNoteCountSpinner = new Gtk.SpinButton (1, 18, 1);
			menuNoteCountSpinner.Value = menuNoteCount <= 18 ? menuNoteCount : 18;
			
			menuNoteCountSpinner.Show ();
			table.Attach (menuNoteCountSpinner, 1, 2, 0, 1);
			
			menuNoteCountSpinner.ValueChanged += UpdateMenuNoteCountPreference;
			
			if (opts_list != null) {
				preferenceWidget = opts_list;
				return true;
			} else {
				preferenceWidget = null;
				return false;
			}
		}
コード例 #17
0
        // This one is an event handler for a SpinButton, used to set the menu Max note count
        private void UpdateMenuMaxNoteCountPreference(object source, EventArgs args)
        {
            Gtk.SpinButton spinner = source as SpinButton;
            Preferences.Set(Preferences.MENU_MAX_NOTE_COUNT, spinner.ValueAsInt);
            // We need to update upper limit for menuMinNoteCountSpinner in view of this change
            double min, max;

            menuMinNoteCountSpinner.GetRange(out min, out max);
            menuMinNoteCountSpinner.SetRange(min, spinner.Value);
        }
コード例 #18
0
		public FormDatabasePreferences() : base(7, 3, false)
		{	
			typeLabel = new Gtk.Label("Type :");
			serverLabel = new Gtk.Label("Server :");
			portLabel = new Gtk.Label("Port :");
			userLabel = new Gtk.Label("Username :"******"Password :"******"Database :");
			mediaLabel = new Gtk.Label("Medias path :");
			typeCombo = ComboBox.NewText();
			serverEntry = new Entry();
			portSpinButton = new SpinButton(0f,65536f,1f);
			userEntry = new Entry();
			passEntry = new Entry();
			dbEntry = new Entry();
			passCheck = new CheckButton("Save password");
			dbButton= new Button(Stock.Open);
			mediaButton= new FileChooserButton("Choose the media directory", FileChooserAction.SelectFolder);
						
			typeLabel.SetAlignment(0, (float)0.5);
			serverLabel.SetAlignment(0, (float)0.5);
			portLabel.SetAlignment(0, (float)0.5);
			userLabel.SetAlignment(0, (float)0.5);
			passLabel.SetAlignment(0, (float)0.5);
			dbLabel.SetAlignment(0, (float)0.5);
			mediaLabel.SetAlignment(0, (float)0.5);
			
			typeCombo.AppendText("SQLite");
			typeCombo.AppendText("PostgreSQL");
			typeCombo.Changed += OnTypeComboChanged;
			
			passEntry.Visibility = false;
			dbButton.Clicked += OnDbButton; 
			
			this.Attach(typeLabel, 0, 1, 0, 1);
			this.Attach(serverLabel, 0, 1, 1, 2);
			this.Attach(portLabel, 0, 1, 2, 3);
			this.Attach(userLabel, 0, 1, 3, 4);
			this.Attach(passLabel, 0, 1, 4, 5);
			this.Attach(dbLabel, 0, 1, 5, 6);
			this.Attach(mediaLabel, 0, 1, 6, 7);
			
			this.Attach(typeCombo, 1, 3, 0, 1);
			
			this.Attach(serverEntry, 1, 3, 1, 2);
			this.Attach(portSpinButton, 1, 3, 2, 3);
			this.Attach(userEntry, 1, 3, 3, 4);
			this.Attach(passEntry, 1, 2, 4, 5);
			this.Attach(dbEntry, 1, 2, 5, 6);
			
			this.Attach(passCheck, 2, 3, 4, 5);			
			this.Attach(dbButton, 2, 3, 5, 6);		
			this.Attach(mediaButton, 1, 3, 6, 7);
			
		}
コード例 #19
0
ファイル: Sharpener.cs プロジェクト: f-spot/f-spot-xplat
        protected override void BuildUI()
        {
            base.BuildUI();

            string title = Strings.Sharpen;

            dialog = new Gtk.Dialog(title, (Gtk.Window) this, DialogFlags.DestroyWithParent, new object[0])
            {
                BorderWidth = 12
            };
            dialog.VBox.Spacing = 6;

            var table = new Gtk.Table(3, 2, false)
            {
                ColumnSpacing = 6,
                RowSpacing    = 6
            };

            table.Attach(SetFancyStyle(new Gtk.Label(Strings.AmountColon)), 0, 1, 0, 1);
            table.Attach(SetFancyStyle(new Gtk.Label(Strings.RadiusColon)), 0, 1, 1, 2);
            table.Attach(SetFancyStyle(new Gtk.Label(Strings.ThresholdColon)), 0, 1, 2, 3);

            SetFancyStyle(amount_spin    = new Gtk.SpinButton(0.00, 100.0, .01));
            SetFancyStyle(radius_spin    = new Gtk.SpinButton(1.0, 50.0, .01));
            SetFancyStyle(threshold_spin = new Gtk.SpinButton(0.0, 50.0, .01));
            amount_spin.Value            = .5;
            radius_spin.Value            = 5;
            threshold_spin.Value         = 0.0;

            amount_spin.ValueChanged    += HandleSettingsChanged;
            radius_spin.ValueChanged    += HandleSettingsChanged;
            threshold_spin.ValueChanged += HandleSettingsChanged;

            table.Attach(amount_spin, 1, 2, 0, 1);
            table.Attach(radius_spin, 1, 2, 1, 2);
            table.Attach(threshold_spin, 1, 2, 2, 3);

            var cancel_button = new Gtk.Button(Gtk.Stock.Cancel);

            cancel_button.Clicked += HandleCancelClicked;
            dialog.AddActionWidget(cancel_button, Gtk.ResponseType.Cancel);

            var ok_button = new Gtk.Button(Gtk.Stock.Ok);

            ok_button.Clicked += HandleOkClicked;
            dialog.AddActionWidget(ok_button, Gtk.ResponseType.Cancel);

            dialog.DeleteEvent += HandleCancelClicked;

            Destroyed += HandleLoupeDestroyed;

            table.ShowAll();
            dialog.VBox.PackStart(table);
            dialog.ShowAll();
        }
コード例 #20
0
ファイル: ResizeEditor.cs プロジェクト: h4ck3rm1k3/f-spot
        public override Widget ConfigurationWidget()
        {
            int max;
            using (var img = ImageFile.Create (State.Items[0].DefaultVersion.Uri))
                using (Pixbuf p = img.Load ())
                    max = Math.Max (p.Width, p.Height);

            size = new SpinButton (128, max, 10);
            size.Value = max;
            return size;
        }
コード例 #21
0
        public CalculatorPreferences()
        {
            // TextLabel
            Gtk.Label method_label = new Gtk.Label (Catalog.GetString (
                "Choose calculation method:"));
            method_label.Wrap = true;
            method_label.Xalign = 0;
            PackStart (method_label);

            // Radio buttons
            auto_radio = new Gtk.RadioButton (Catalog.GetString (
                "Automatic"));
            PackStart (auto_radio);

            alternate_radio = new Gtk.RadioButton (auto_radio, Catalog.GetString("Manual"));
            PackStart(alternate_radio);

            //Check if the preferences have been set earlier and adjust buttons
            if (Preferences.Get(CalculatorAddin.CALCULATOR_AUTOMATIC_MODE) == null) {
                alternate_radio.Active = true;;
            }else if((bool) Preferences.Get(CalculatorAddin.CALCULATOR_AUTOMATIC_MODE)) {
                auto_radio.Active = true;
            }else{
                alternate_radio.Active = true;
            }

            auto_radio.Toggled += OnSelectedRadioToggled;

            //Decimal settings

            Gtk.Label decimal_label = new Gtk.Label (Catalog.GetString (
                "Choose number of decimals:"));
            decimal_label.Wrap = true;
            decimal_label.Xalign = 0;
            PackStart (decimal_label);

            Gtk.SpinButton decimal_spinner = new Gtk.SpinButton (1, 12, 1);

            int decimal_count;
            try {
                decimal_count = (int) Preferences.Get (CalculatorAddin.CALCULATOR_DECIMAL_COUNT);
            } catch (Exception) {
                Logger.Debug("CalcAddin: Couldn't find a preference for decimal count.");
                decimal_count = 3;				//Defaults to 3 if no preference is set.
            }

            decimal_spinner.Value = decimal_count <= 12 ? decimal_count : 3;

            PackStart (decimal_spinner);
            decimal_spinner.Show();

            decimal_spinner.ValueChanged += OnDecimalValueChanged;
        }
コード例 #22
0
 static int Output_cb(IntPtr inst)
 {
     try {
         SpinButton __obj = GLib.Object.GetObject(inst, false) as SpinButton;
         int        __result;
         __result = __obj.OnOutput();
         return(__result);
     } catch (Exception e) {
         GLib.ExceptionManager.RaiseUnhandledException(e, true);
         // NOTREACHED: above call does not return.
         throw e;
     }
 }
コード例 #23
0
ファイル: PacksWindow.cs プロジェクト: omarkhd/gymk
        private void CustomBuild()
        {
            this.PaymentSpin = new SpinButton(0, 1000, 0.01);
            this.MembershipSpin = new SpinButton(0, 1000, 0.01);
            this.SpinBox1.Add(this.PaymentSpin);
            this.SpinBox2.Add(this.MembershipSpin);

            this.PacksNodeView.AppendColumn("Nombre", new CellRendererText(), "text", 0);
            this.PacksNodeView.AppendColumn("Costo", new CellRendererText(), "text", 1);
            this.PacksNodeView.AppendColumn("Inscripción", new CellRendererText(), "text", 2);
            this.ShowAll();
            //this.SelectedAreas = new LinkedList<long>();
        }
コード例 #24
0
		public MenuMinMaxNoteCountPreference ()
		{
			table = new Gtk.Table (2, 2, false);
			table.ColumnSpacing = 6;
			table.RowSpacing = 6;
			table.Show ();

			// Menu Min Note Count option
			menuMinNoteCountLabel = new Gtk.Label (Catalog.GetString ("Minimum number of notes to show in Recent list"));

			menuMinNoteCountLabel.UseMarkup = true;
			menuMinNoteCountLabel.Justify = Gtk.Justification.Left;
			menuMinNoteCountLabel.SetAlignment (0.0f, 0.5f);
			menuMinNoteCountLabel.Show ();
			table.Attach (menuMinNoteCountLabel, 0, 1, 0, 1);

			menuMinNoteCount = (int) Preferences.Get (Preferences.MENU_NOTE_COUNT);
			menuMaxNoteCount = (int) Preferences.Get (Preferences.MENU_MAX_NOTE_COUNT);
			// This is to avoid having Max bigger than absolute maximum if someone changed the setting
			// outside of the Tomboy using e.g. gconf
			menuMaxNoteCount = (menuMaxNoteCount <= int.MaxValue ? menuMaxNoteCount : int.MaxValue);
			// This is to avoid having Min bigger than Max if someone changed the setting
			// outside of the Tomboy using e.g. gconf
			menuMinNoteCount = (menuMinNoteCount <= menuMaxNoteCount ? menuMinNoteCount : menuMaxNoteCount);

			menuMinNoteCountSpinner = new Gtk.SpinButton (1, menuMaxNoteCount, 1);
			menuMinNoteCountSpinner.Value = menuMinNoteCount;
			menuMinNoteCountSpinner.Show ();
			table.Attach (menuMinNoteCountSpinner, 1, 2, 0, 1);
			menuMinNoteCountSpinner.ValueChanged += UpdateMenuMinNoteCountPreference;

			// Menu Max Note Count option
			menuMaxNoteCountLabel = new Gtk.Label (Catalog.GetString ("Maximum number of notes to show in Recent list"));

			menuMaxNoteCountLabel.UseMarkup = true;
			menuMaxNoteCountLabel.Justify = Gtk.Justification.Left;
			menuMaxNoteCountLabel.SetAlignment (0.0f, 0.5f);
			menuMaxNoteCountLabel.Show ();
			table.Attach (menuMaxNoteCountLabel, 0, 1, 1, 2);

			menuMaxNoteCountSpinner = new Gtk.SpinButton (menuMinNoteCount, int.MaxValue, 1);
			menuMaxNoteCountSpinner.Value = menuMaxNoteCount;
			menuMaxNoteCountSpinner.Show ();
			table.Attach (menuMaxNoteCountSpinner, 1, 2, 1, 2);
			menuMaxNoteCountSpinner.ValueChanged += UpdateMenuMaxNoteCountPreference;

			align = new Gtk.Alignment (0.0f, 0.0f, 0.0f, 1.0f);
			align.Show ();
			align.Add (table);
		}
コード例 #25
0
ファイル: NumberEditor.cs プロジェクト: deck05/aspeditor
        void spin_ValueChanged(object sender, EventArgs e)
        {
            Gtk.SpinButton spin = (SpinButton)sender;

            object newValue = Convert.ChangeType(spin.Value, parentRow.PropertyDescriptor.PropertyType);

            parentRow.PropertyValue = newValue;

            //if there's an error such as out-of-range, and value not accepted by parent, restore old value
            if (parentRow.PropertyValue != newValue)
            {
                spin.Value = Convert.ToDouble(parentRow.PropertyValue);
            }
        }
コード例 #26
0
        public MenuMinMaxNoteCountPreference()
        {
            table = new Gtk.Table(2, 2, false);
            table.ColumnSpacing = 6;
            table.RowSpacing    = 6;
            table.Show();

            // Menu Min Note Count option
            menuMinNoteCountLabel = new Gtk.Label(Catalog.GetString("Minimum number of notes to show in Recent list"));

            menuMinNoteCountLabel.UseMarkup = true;
            menuMinNoteCountLabel.Justify   = Gtk.Justification.Left;
            menuMinNoteCountLabel.SetAlignment(0.0f, 0.5f);
            menuMinNoteCountLabel.Show();
            table.Attach(menuMinNoteCountLabel, 0, 1, 0, 1);

            menuMinNoteCount = (int)Preferences.Get(Preferences.MENU_NOTE_COUNT);
            menuMaxNoteCount = (int)Preferences.Get(Preferences.MENU_MAX_NOTE_COUNT);
            // This is to avoid having Max bigger than absolute maximum if someone changed the setting
            // outside of the Tomboy using e.g. gconf
            menuMaxNoteCount = (menuMaxNoteCount <= int.MaxValue ? menuMaxNoteCount : int.MaxValue);
            // This is to avoid having Min bigger than Max if someone changed the setting
            // outside of the Tomboy using e.g. gconf
            menuMinNoteCount = (menuMinNoteCount <= menuMaxNoteCount ? menuMinNoteCount : menuMaxNoteCount);

            menuMinNoteCountSpinner       = new Gtk.SpinButton(1, menuMaxNoteCount, 1);
            menuMinNoteCountSpinner.Value = menuMinNoteCount;
            menuMinNoteCountSpinner.Show();
            table.Attach(menuMinNoteCountSpinner, 1, 2, 0, 1);
            menuMinNoteCountSpinner.ValueChanged += UpdateMenuMinNoteCountPreference;

            // Menu Max Note Count option
            menuMaxNoteCountLabel = new Gtk.Label(Catalog.GetString("Maximum number of notes to show in Recent list"));

            menuMaxNoteCountLabel.UseMarkup = true;
            menuMaxNoteCountLabel.Justify   = Gtk.Justification.Left;
            menuMaxNoteCountLabel.SetAlignment(0.0f, 0.5f);
            menuMaxNoteCountLabel.Show();
            table.Attach(menuMaxNoteCountLabel, 0, 1, 1, 2);

            menuMaxNoteCountSpinner       = new Gtk.SpinButton(menuMinNoteCount, int.MaxValue, 1);
            menuMaxNoteCountSpinner.Value = menuMaxNoteCount;
            menuMaxNoteCountSpinner.Show();
            table.Attach(menuMaxNoteCountSpinner, 1, 2, 1, 2);
            menuMaxNoteCountSpinner.ValueChanged += UpdateMenuMaxNoteCountPreference;

            align = new Gtk.Alignment(0.0f, 0.0f, 0.0f, 1.0f);
            align.Show();
            align.Add(table);
        }
コード例 #27
0
ファイル: LabelFrame.cs プロジェクト: unhammer/gimp-sharp
        void CreateColorAndOpacityWidget()
        {
            var hbox = new HBox(false, 12);

              _color = new GimpColorButton("", 16, 16, new RGB(0, 0, 0),
                   ColorAreaType.Flat);
              _color.Update = true;
              hbox.Add(_color);

              _opacity = new SpinButton(0, 100, 1);
              hbox.Add(new Label(_("Opacity:")));
              hbox.Add(_opacity);
              hbox.Add(new Label("%"));
              AttachAligned(0, 3, _("Color:"), 0.0, 0.5, hbox, 1, true);
        }
コード例 #28
0
	public SubtitleEditSpinButtons () {
		/* Assign */
		startSpinButton = Base.GetWidget(WidgetNames.StartSpinButton) as SpinButton;
		endSpinButton = Base.GetWidget(WidgetNames.EndSpinButton) as SpinButton;
		durationSpinButton = Base.GetWidget(WidgetNames.DurationSpinButton) as SpinButton;

		/* Initialize */
		startSpinButton.WidthChars = Util.SpinButtonTimeWidthChars;
		endSpinButton.WidthChars = Util.SpinButtonTimeWidthChars;
		durationSpinButton.WidthChars = Util.SpinButtonTimeWidthChars;

    	/* Set timing mode to Times */
    	SetTimingMode(TimingMode.Times); //Initial timing mode is Times

    	Base.InitFinished += OnBaseInitFinished;
	}
コード例 #29
0
ファイル: Sharpener.cs プロジェクト: iainlane/f-spot
        protected override void BuildUI()
        {
            base.BuildUI ();

            string title = Catalog.GetString ("Sharpen");
            dialog = new Gtk.Dialog (title, (Gtk.Window) this,
                         DialogFlags.DestroyWithParent, new object [0]);
            dialog.BorderWidth = 12;
            dialog.VBox.Spacing = 6;

            Gtk.Table table = new Gtk.Table (3, 2, false);
            table.ColumnSpacing = 6;
            table.RowSpacing = 6;

            table.Attach (SetFancyStyle (new Gtk.Label (Catalog.GetString ("Amount:"))), 0, 1, 0, 1);
            table.Attach (SetFancyStyle (new Gtk.Label (Catalog.GetString ("Radius:"))), 0, 1, 1, 2);
            table.Attach (SetFancyStyle (new Gtk.Label (Catalog.GetString ("Threshold:"))), 0, 1, 2, 3);

            SetFancyStyle (amount_spin = new Gtk.SpinButton (0.00, 100.0, .01));
            SetFancyStyle (radius_spin = new Gtk.SpinButton (1.0, 50.0, .01));
            SetFancyStyle (threshold_spin = new Gtk.SpinButton (0.0, 50.0, .01));
            amount_spin.Value = .5;
            radius_spin.Value = 5;
            threshold_spin.Value = 0.0;

            amount_spin.ValueChanged += HandleSettingsChanged;
            radius_spin.ValueChanged += HandleSettingsChanged;
            threshold_spin.ValueChanged += HandleSettingsChanged;

            table.Attach (amount_spin, 1, 2, 0, 1);
            table.Attach (radius_spin, 1, 2, 1, 2);
            table.Attach (threshold_spin, 1, 2, 2, 3);

            Gtk.Button cancel_button = new Gtk.Button (Gtk.Stock.Cancel);
            cancel_button.Clicked += HandleCancelClicked;
            dialog.AddActionWidget (cancel_button, Gtk.ResponseType.Cancel);

            Gtk.Button ok_button = new Gtk.Button (Gtk.Stock.Ok);
            ok_button.Clicked += HandleOkClicked;
            dialog.AddActionWidget (ok_button, Gtk.ResponseType.Cancel);

            Destroyed += HandleLoupeDestroyed;

            table.ShowAll ();
            dialog.VBox.PackStart (table);
            dialog.ShowAll ();
        }
コード例 #30
0
ファイル: QueryLimitBox.cs プロジェクト: knocte/hyena
        public QueryLimitBox(QueryOrder [] orders, QueryLimit [] limits)
            : base()
        {
            this.orders = orders;
            this.limits = limits;

            Spacing = 5;

            enabled_checkbox = new CheckButton (Catalog.GetString ("_Limit to"));
            enabled_checkbox.Toggled += OnEnabledToggled;

            count_spin = new SpinButton (0, Double.MaxValue, 1);
            count_spin.Numeric = true;
            count_spin.Digits = 0;
            count_spin.Value = 25;
            count_spin.SetSizeRequest (60, -1);

            limit_combo = new ComboBoxText ();
            foreach (QueryLimit limit in limits) {
                limit_combo.AppendText (limit.Label);
            }

            order_combo = new ComboBoxText ();
            order_combo.RowSeparatorFunc = IsRowSeparator;
            foreach (QueryOrder order in orders) {
                if (order == null) {
                    order_combo.AppendText (String.Empty);
                } else {
                    order_combo.AppendText (order.Label);
                }
            }

            PackStart (enabled_checkbox, false, false, 0);
            PackStart (count_spin, false, false, 0);
            PackStart (limit_combo, false, false, 0);
            PackStart (new Label (Catalog.GetString ("selected by")), false, false, 0);
            PackStart (order_combo, false, false, 0);

            enabled_checkbox.Active = false;
            limit_combo.Active = 0;
            order_combo.Active = 0;

            OnEnabledToggled (null, null);

            ShowAll ();
        }
コード例 #31
0
		public NumericEditor(object @object, PropertyInfo info) : base(@object, info) {
			RangeAttribute range = Util.GetAttribute<RangeAttribute>(info, false);
			
			double min, max;
			
			if (range == null) {
				FieldInfo field = info.PropertyType.GetField("MinValue",
				                                             BindingFlags.Public |
				                                             BindingFlags.Static);
				
				if (field == null)
					min = double.MinValue;
				else
					min = Convert.ToDouble(field.GetValue(null));
				
				field = info.PropertyType.GetField("MaxValue",
				                                   BindingFlags.Public |
				                                   BindingFlags.Static);
				
				if (field == null)
					max = double.MaxValue;
				else
					max = Convert.ToDouble(field.GetValue(null));
			} else {
				min = range.Minimum;
				max = range.Maximum;
			}
			
			this.mSpin = new SpinButton(min, max, 1);
			
			if (info.PropertyType == typeof(float) ||
			    info.PropertyType == typeof(double))
				this.mSpin.Digits = 5;
			else
				this.mSpin.Digits = 0;
			
			this.Revert();
			
			this.mSpin.Changed += this.OnSpinChanged;
			this.mSpin.ValueChanged += this.OnSpinChanged;
			
			this.mSpin.Show();
			this.Add(this.mSpin);
		}
コード例 #32
0
        public SpotFunctionPanel()
            : base(4, 2, false)
        {
            // TODO: use degrees instead of radians
            angleHScale = new HScale(0, 2, 0.01);
            distanceSpinButton = new SpinButton(1, 1000, 1);

            presets = new List<SpotFunction>(SpotFunction.Samples.list());
            presetsNames = (from preset in presets select preset.Name).ToList();
            presetComboBox = new ComboBox(presetsNames.ToArray());
            presetComboBox.Changed += delegate
            {
                int active = presetComboBox.Active;
                if (active >= 0) {
                    module = (SpotFunction)presets[active].deepCopy();
                }
            };

            ColumnSpacing = RowSpacing = BorderWidth = 5;

            Attach(new Label("Preset:") { Xalign = 0.0f }, 0, 1, 0, 1,
                AttachOptions.Fill,
                AttachOptions.Shrink, 0, 0);
            Attach(presetComboBox, 1, 2, 0, 1,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Shrink, 0, 0);

            Attach(new Label("Screen angle (rad):") { Xalign = 0.0f }, 0, 1, 1, 2,
                AttachOptions.Fill,
                AttachOptions.Shrink, 0, 0);
            Attach(angleHScale, 1, 2, 1, 2,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Shrink, 0, 0);

            Attach(new Label("Screen line distance (px):") { Xalign = 0.0f },
                0, 1, 2, 3,
                AttachOptions.Fill,
                AttachOptions.Shrink, 0, 0);
            Attach(distanceSpinButton, 1, 2, 2, 3,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Shrink, 0, 0);

            ShowAll();
        }
コード例 #33
0
ファイル: NumberEditor.cs プロジェクト: mono/aspeditor
        public override Gtk.Widget GetEditWidget()
        {
            Gtk.SpinButton spin;

            if (parentRow.PropertyDescriptor.PropertyType == typeof (Int16))
                spin = new SpinButton(Int16.MinValue, Int16.MaxValue, 1);
            else if (parentRow.PropertyDescriptor.PropertyType == typeof (Int32))
                spin = new SpinButton(Int32.MinValue, Int32.MaxValue, 1);
            else if (parentRow.PropertyDescriptor.PropertyType == typeof (Int64))
                spin = new SpinButton(Int64.MinValue, Int64.MaxValue, 1);
            else  //TODO: process floats etc nicely
                spin = new SpinButton(Int64.MinValue, Int64.MaxValue, 1);

            spin.HasFrame = false;
            spin.Value = Convert.ToDouble (parentRow.PropertyValue);
            spin.ValueChanged += new EventHandler (spin_ValueChanged);

            return spin;
        }
コード例 #34
0
        // Relative: [<|>] [num] [minutes|hours] ago
        // TODO: Absolute: [>|>=|=|<|<=] [date/time]
        public FileSizeQueryValueEntry () : base ()
        {
            spin_button = new SpinButton (0.0, 1.0, 1.0);
            spin_button.Digits = 1;
            spin_button.WidthChars = 4;
            spin_button.SetRange (0.0, Double.MaxValue);
            Add (spin_button);

            combo = ComboBox.NewText ();
            combo.AppendText (Catalog.GetString ("bytes"));
            combo.AppendText (Catalog.GetString ("KB"));
            combo.AppendText (Catalog.GetString ("MB"));
            combo.AppendText (Catalog.GetString ("GB"));
            combo.Realized += delegate { if (!combo_set) { combo.Active = 2; } };
            Add (combo);

            spin_button.ValueChanged += HandleValueChanged;
            combo.Changed += HandleValueChanged;
        }
コード例 #35
0
ファイル: BpmEntry.cs プロジェクト: gclark916/banshee
        private void BuildWidgets ()
        {
            Spacing = 6;

            bpm_entry = new SpinButton (0, 9999, 1);
            bpm_entry.MaxLength = bpm_entry.WidthChars = 4;
            bpm_entry.Digits = 0;
            bpm_entry.Numeric = true;
            bpm_entry.ValueChanged += OnChanged;
            bpm_entry.Output += OnOutput;
            Add (bpm_entry);

            if (detector != null) {
                detect_button = new Button (Catalog.GetString ("D_etect"));
                detect_button.Clicked += OnDetectClicked;
                Add (detect_button);
            }

            Image play = new Image ();
            play.IconName = "media-playback-start";;
            play.IconSize = (int)IconSize.Menu;
            Button play_button = new Button (play);
            play_button.Clicked += OnPlayClicked;
            Add (play_button);

            Button tap_button = new Button (Catalog.GetString ("T_ap"));
            tap_adapter = new BpmTapAdapter (tap_button);
            tap_adapter.BpmChanged += OnTapBpmChanged;
            Add (tap_button);

            object tooltip_host = TooltipSetter.CreateHost ();

            TooltipSetter.Set (tooltip_host, detect_button,
                Catalog.GetString ("Have Banshee attempt to auto-detect the BPM of this song"));

            TooltipSetter.Set (tooltip_host, play_button, Catalog.GetString ("Play this song"));

            TooltipSetter.Set (tooltip_host, tap_button,
                Catalog.GetString ("Tap this button to the beat to set the BPM for this song manually"));

            ShowAll ();
        }
コード例 #36
0
        public SpinButtonEntryDialog(string title, Window parent, string label, int min, int max, int current)
            : base(title, parent, DialogFlags.Modal, Stock.Cancel, ResponseType.Cancel, Stock.Ok, ResponseType.Ok)
        {
            BorderWidth = 6;
            VBox.Spacing = 3;
            HBox hbox = new HBox ();
            hbox.Spacing = 6;

            Label lbl = new Label (label);
            lbl.Xalign = 0;
            hbox.PackStart (lbl);

            spinButton = new SpinButton (min, max, 1);
            spinButton.Value = current;
            hbox.PackStart (spinButton);

            hbox.ShowAll ();
            VBox.Add (hbox);
            DefaultResponse = ResponseType.Ok;
            AlternativeButtonOrder = new int[] { (int) ResponseType.Ok, (int) ResponseType.Cancel };
        }
コード例 #37
0
            // FIXME clicking the spinbutton too fast seems to switch the view to browse

            public FaceBox(Gtk.Box tb, PhotoImageView vw) : base()
            {
                m_list     = new ArrayList();
                face_store = Core.Database.Faces;
                View       = vw;
                tag_store  = FSpot.Core.Database.Tags;

                Gtk.Label lab = new Gtk.Label("Face det:");
                lab.Show();
                tb.PackStart(lab, false, true, 0);

                face_button = new ToolbarButton();
                face_button.Add(new Gtk.Image("f-spot-sepia", IconSize.Button));
                tb.PackStart(face_button, false, true, 0);

                face_button.Clicked += HandleFaceButtonClicked;

                tag_entry = new Gtk.Entry("test");
                tag_entry.Show();
                tag_entry.Sensitive = false;
                tb.PackStart(tag_entry, false, true, 0);

                m_newtag_button = new  ToolbarButton();
                m_newtag_button.Add(new Gtk.Image("f-spot-new-tag", IconSize.Button));
                m_newtag_button.Show();
                m_newtag_button.Sensitive = false;
                tb.PackStart(m_newtag_button, false, true, 0);

                m_newtag_button.Clicked += HandleNewTagButtonClicked;

                m_spin = new SpinButton(1, 1, 1);
                m_spin.Show();
                m_spin.Sensitive = false;
                tb.PackStart(m_spin, false, true, 0);

                m_spin.Changed += HandleSpinChanged;

                //m.spin.ValueChanged += jesli w bazie, to pokaz jego tag
                //this.Add(tag_widget);
            }
コード例 #38
0
        public TimeSpanQueryValueEntry () : base ()
        {
            spin_button = new SpinButton (0.0, 1.0, 1.0);
            spin_button.Digits = 1;
            spin_button.WidthChars = 4;
            spin_button.SetRange (0.0, Double.MaxValue);
            Add (spin_button);

            combo = ComboBox.NewText ();
            combo.AppendText (Catalog.GetString ("seconds"));
            combo.AppendText (Catalog.GetString ("minutes"));
            combo.AppendText (Catalog.GetString ("hours"));
            combo.AppendText (Catalog.GetString ("days"));
            combo.AppendText (Catalog.GetString ("weeks"));
            combo.AppendText (Catalog.GetString ("months"));
            combo.AppendText (Catalog.GetString ("years"));
            combo.Realized += delegate { combo.Active = set_combo; };
            Add (combo);

            spin_button.ValueChanged += HandleValueChanged;
            combo.Changed += HandleValueChanged;
        }
コード例 #39
0
        /// <summary>
        /// Crea el control para los parametros de tipo <c>int</c>.
        /// </summary>
        /// <param name="desc">
        /// A <see cref="BitmapProcessPropertyDescription"/>
        /// </param>
        private void CreateIntWidget(BitmapProcessPropertyDescription desc)
        {
            layout.Add(new Label(desc.Description + ":"));



            SpinButton spin = new Gtk.SpinButton(0, 1000, 1);

            spin.Numeric = false;

            if (desc.Min != -1 && desc.Max != -1)
            {
                spin.SetRange(desc.Min, desc.Max);
            }


            int val = (int)info.GetValue(process, null);

            spin.Value = val;

            widget = spin;
        }
コード例 #40
0
        private void build()
        {
            //this.img1 = new Image(Stock.Dnd);
            this.sbutton1               = new SpinButton(0.0, 200.0, 1.0);
            this.sbutton1.Value         = this.vital;
            this.sbutton1.WidthRequest  = 50;
            this.sbutton1.ValueChanged += delegate(object sender, EventArgs e) {
                this.calc_total();
            };
            this.label1 = new Label(this.vitalname);
            this.label1.WidthRequest = 100;
            this.label2 = new Label("racial");
            this.label2.WidthRequest = 50;
            this.label3 = new Label("total");
            this.label3.WidthRequest = 50;
            this.entry2              = new Entry("0");
            this.entry2.IsEditable   = false;
            this.entry2.WidthRequest = 50;
            this.entry3              = new Entry(this.sbutton1.Value.ToString());
            this.entry3.IsEditable   = false;
            this.entry3.WidthRequest = 50;

            this.sbutton1.TooltipText = "Player's value";
            this.entry2.TooltipText   = this.label1.Text + " racial bonus";
            this.entry3.TooltipText   = this.label1.Text + " total (racial + player)";

            this.hbox1             = new HBox(false, 1);
            this.hbox1.Homogeneous = false;
            this.hbox1.PackStart(this.label1, false, false, 0);
            this.hbox1.PackStart(this.sbutton1, false, false, 0);
            this.hbox1.PackStart(new HSeparator(), false, false, 2);
            this.hbox1.PackStart(this.label2, false, false, 0);
            this.hbox1.PackStart(this.entry2, false, false, 0);
            this.hbox1.PackStart(new HSeparator(), false, false, 2);
            this.hbox1.PackStart(this.label3, false, false, 0);
            this.hbox1.PackStart(this.entry3, false, false, 0);
            this.Add(hbox1);
        }
コード例 #41
0
ファイル: Connection.cs プロジェクト: hadi77ir/monodm
        void InitializeComponent()
        {
            Gtk.Table table = new Gtk.Table(4, 2, false);
            // num retry delay
            numRetryDelay        = new Gtk.SpinButton(0, 10000, 1);
            numRetryDelay.Digits = 0;             //int only
            table.Attach(new Gtk.Label("Delay between retries: "), 0, 1, 0, 1);
            table.Attach(numRetryDelay, 1, 2, 0, 1);

            numMaxRetries        = new Gtk.SpinButton(0, 10, 1);
            numMaxRetries.Digits = 0;             //int only
            table.Attach(new Gtk.Label("Maximum number of retries: "), 0, 1, 1, 2);
            table.Attach(numMaxRetries, 1, 2, 1, 2);

            numMaxSegments = new SpinButton(0, 32, 1);
            table.Attach(new Gtk.Label("Maximum number of segments: "), 0, 1, 2, 3);
            table.Attach(numMaxSegments, 1, 2, 2, 3);

            numMinSegSize = new Gtk.SpinButton(100, double.MaxValue, 1);
            table.Attach(new Gtk.Label("Minimum size of a segment (bytes): "), 0, 1, 3, 4);
            table.Attach(numMinSegSize, 1, 2, 3, 4);

            PackStart(table, false, false, 0);
        }
コード例 #42
0
ファイル: FormOrderDetail.cs プロジェクト: hpbaotho/supos
		public FormOrderDetail() : base(3, 2, false)
		{
			
			
			Label labeltax;
			labeltax = new Label("Tax :");
			labeltax.SetAlignment(0, 0.5f);
			
			Label labelprice;
			labelprice = new Label("Price :");
			labelprice.SetAlignment(0, 0.5f);
			
			Label labelquant;
			labelquant = new Label("Quantity :");
			labelquant.SetAlignment(0, 0.5f);
			
			combotax = new ComboBoxTaxes();
			
			spinprice = new SpinButton(0.0f, (double)System.Decimal.MaxValue, 0.01f);
			spinprice.Digits = 2;
			
			spinquant = new SpinButton(0.0f, (double)System.Int64.MaxValue, 1.0f);
			spinquant.Digits = 0;
			
			this.BorderWidth = 6;
			this.ColumnSpacing = 6;
			
			this.Attach(labeltax, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
			this.Attach(labelprice, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
			this.Attach(labelquant, 0, 1, 2, 3, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
			this.Attach(combotax, 1, 2, 0, 1, AttachOptions.Expand|AttachOptions.Fill, AttachOptions.Expand|AttachOptions.Fill, 0, 0);
			this.Attach(spinprice, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
			this.Attach(spinquant, 1, 2, 2, 3, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
			
			this.ShowAll();
		}
コード例 #43
0
ファイル: MatrixPanel.cs プロジェクト: bzamecnik/HalftoneLab
 /// <summary>
 /// Create a new matrix panel.
 /// </summary>
 /// <param name="rows">Number of rows (>0)</param>
 /// <param name="columns">Number of columns (>0)</param>
 /// <param name="resizable">True if the matrix dimensions are allowed
 /// to be changed</param>
 public MatrixPanel(uint rows, uint columns, bool resizable)
 {
     scroll = new ScrolledWindow();
     resize(rows, columns);
     if (resizable) {
         Table table = new Table(2, 1, false);
         matrixRows = new SpinButton(1, 16, 1) { Value = rows };
         matrixCols = new SpinButton(1, 16, 1) { Value = columns };
         Button resizeButton = new Button("Resize");
         resizeButton.Clicked += delegate
         {
             // Preserve values from the original matrix if possible.
             int[,] origMatrix = Matrix;
             resize((uint)matrixRows.ValueAsInt,
                    (uint)matrixCols.ValueAsInt);
             if (origMatrix != null) {
                 setMatrix(origMatrix, false);
             }
         };
         table.Attach(scroll, 0, 1, 0, 1,
             AttachOptions.Fill | AttachOptions.Expand,
             AttachOptions.Fill | AttachOptions.Expand, 0, 0);
         HBox hbox = new HBox(false, 2) { BorderWidth = 2 };
         hbox.PackStart(new Label("Rows:"));
         hbox.PackStart(matrixRows);
         hbox.PackStart(new Label("Columns:"));
         hbox.PackStart(matrixCols);
         hbox.PackStart(resizeButton);
         table.Attach(hbox, 0, 1, 1, 2,
             AttachOptions.Fill, AttachOptions.Shrink, 0, 0);
         table.ShowAll();
         Add(table);
     } else {
         Add(scroll);
     }
 }
コード例 #44
0
    public static void Main()
    {
        app = new EventApp();

        ClutterRun.Init();
        Gtk.Application.Init();

        Gtk.Window window = new Gtk.Window(WindowType.Toplevel);
        window.Title        = "Gtk-Clutter Interaction Demo";
        window.Resizable    = true;
        window.BorderWidth  = 12;
        window.DeleteEvent += HandleDelete;
        app.window          = window;

        Gtk.VBox vbox = new Gtk.VBox(false, 12);
        window.Add(vbox);

        Gtk.Entry gtk_entry = new Gtk.Entry();
        app.gtk_entry      = gtk_entry;
        gtk_entry.Text     = "Enter some text";
        gtk_entry.Changed += delegate { app.clutter_entry.Text = app.gtk_entry.Text; };
        vbox.PackStart(gtk_entry, false, false, 0);

        Gtk.HBox hbox = new Gtk.HBox(false, 12);
        vbox.PackStart(hbox, true, true, 0);

        /* Clutter stage */
        Embed widget = new Embed();

        hbox.PackStart(widget, true, true, 0);
        app.stage       = widget.Stage as Stage;
        app.stage.Color = new Clutter.Color(125, 125, 125, 255);

        /* Main texture*/
        Texture texture = new Texture("redhand.png");

        app.hand = texture;
        app.stage.AddActor(texture);
        uint width, height;

        texture.GetSize(out width, out height);
        texture.SetPosition((int)((app.stage.Width / 2) - (width / 2)), (int)((app.stage.Height / 2) - (height / 2)));

        /* Clutter entry */
        app.clutter_entry = new Clutter.Entry("Sans 10", "", new Clutter.Color(255, 255, 255, 255));
        app.stage.AddActor(app.clutter_entry);
        app.clutter_entry.SetPosition(0, 0);
        app.clutter_entry.SetSize(500, 20);

        /* Adjustment widgets */
        vbox = new Gtk.VBox(false, 6);
        hbox.PackStart(vbox, false, false, 0);

        Gtk.VBox box = new Gtk.VBox(true, 6);
        vbox.PackStart(box, false, true, 0);

        Gtk.Label x_label = new Gtk.Label("Rotate x-axis");
        box.PackStart(x_label, true, true, 0);
        Gtk.SpinButton x_button = new Gtk.SpinButton(0, 360, 1);
        box.PackStart(x_button, true, true, 0);
        x_button.ValueChanged += delegate { app.hand.SetRotation(RotateAxis.XAxis,
                                                                 (float)app.x_button.Value,
                                                                 (int)app.hand.Height, 0, 0); };
        app.x_button = x_button;

        Gtk.Label y_label = new Gtk.Label("Rotate y-axis");
        box.PackStart(y_label, true, true, 0);
        Gtk.SpinButton y_button = new Gtk.SpinButton(0, 360, 1);
        box.PackStart(y_button, true, true, 0);
        y_button.ValueChanged += delegate { app.hand.SetRotation(RotateAxis.YAxis,
                                                                 (float)app.y_button.Value,
                                                                 0, (int)app.hand.Width / 2, 0); };
        app.y_button = y_button;

        Gtk.Label z_label = new Gtk.Label("Rotate z-axis");
        box.PackStart(z_label, true, true, 0);
        Gtk.SpinButton z_button = new Gtk.SpinButton(0, 360, 1);
        box.PackStart(z_button, true, true, 0);
        z_button.ValueChanged += delegate { app.hand.SetRotation(RotateAxis.ZAxis,
                                                                 (float)app.z_button.Value,
                                                                 (int)app.hand.Width / 2, (int)app.hand.Height / 2, 0); };
        app.z_button = z_button;

        Gtk.Label op_label = new Gtk.Label("Adjust opacity");
        box.PackStart(op_label, true, true, 0);
        Gtk.SpinButton op_button = new Gtk.SpinButton(0, 255, 1);
        op_button.Value = 255;
        box.PackStart(op_button, true, true, 0);
        op_button.ValueChanged += delegate { app.hand.Opacity = (byte)app.op_button.Value; };
        app.op_button           = op_button;

        app.stage.ShowAll();
        app.window.SetDefaultSize(800, 600);
        app.window.ShowAll();

        Gtk.Application.Run();
    }
コード例 #45
0
        /// <summary>
        /// Set up the widgets
        /// </summary>
        /// <returns>
        /// Widget to display
        /// </returns>
        private void InitializeWidgets()
        {
            this.Spacing     = Util.SectionSpacing;
            this.BorderWidth = Util.DefaultBorderWidth;

            //------------------------------
            // Application Settings
            //------------------------------
            // create a section box
            VBox appSectionBox = new VBox();

            appSectionBox.Spacing = Util.SectionTitleSpacing;
            this.PackStart(appSectionBox, false, true, 0);
            Label appSectionLabel = new Label("<span weight=\"bold\">" +
                                              Util.GS("Application") +
                                              "</span>");

            appSectionLabel.UseMarkup = true;
            appSectionLabel.Xalign    = 0;
            appSectionBox.PackStart(appSectionLabel, false, true, 0);

            // create a hbox to provide spacing
            HBox appSpacerBox = new HBox();

            appSectionBox.PackStart(appSpacerBox, false, true, 0);
            Label appSpaceLabel = new Label("    ");             // four spaces

            appSpacerBox.PackStart(appSpaceLabel, false, true, 0);

            // create a vbox to actually place the widgets in for section
            VBox appWidgetBox = new VBox();

            appSpacerBox.PackStart(appWidgetBox, false, true, 0);
            appWidgetBox.Spacing = Util.SectionTitleSpacing;


            ShowConfirmationButton =
                new CheckButton(Util.GS(
                                    "_Display confirmation dialog on successful creation of iFolder"));
            appWidgetBox.PackStart(ShowConfirmationButton, false, true, 0);
            ShowConfirmationButton.Toggled +=
                new EventHandler(OnShowConfButton);


/*			ShowNetworkstatusButton =
 *                              new CheckButton(Util.GS(
 *                                      "Show _Network Events  messages when iFolder is started"));
 *                      appWidgetBox.PackStart(ShowNetworkstatusButton, false, true, 0);
 *                      ShowNetworkstatusButton.Toggled +=
 *                                              new EventHandler(OnShowNetworkButton); */


            Label strtlabel = new Label("<span style=\"italic\">" + Util.GS("To start up iFolder at login, leave iFolder running when you log out and save your current setup.") + "</span>");

            strtlabel.UseMarkup = true;
            strtlabel.LineWrap  = true;
            appWidgetBox.PackStart(strtlabel, false, true, 0);

            HideMainWindowButton =
                new CheckButton(Util.GS("Hide ifolder _main window at startup"));
            appWidgetBox.PackStart(HideMainWindowButton, false, true, 0);
            HideMainWindowButton.Toggled +=
                new EventHandler(OnHideMainWindowButton);

            HideSyncLogButton =
                new CheckButton(Util.GS("Display synchronization _logs"));
            appWidgetBox.PackStart(HideSyncLogButton, false, true, 0);

            HideSyncLogButton.Toggled +=
                new EventHandler(OnHideSyncLogButton);


            //------------------------------
            // Notifications
            //------------------------------
            // create a section box
            VBox notifySectionBox = new VBox();

            notifySectionBox.Spacing = Util.SectionTitleSpacing;
            this.PackStart(notifySectionBox, true, true, 0);
            Label notifySectionLabel = new Label("<span weight=\"bold\">" +
                                                 Util.GS("Notification") +
                                                 "</span>");

            notifySectionLabel.UseMarkup = true;
            notifySectionLabel.Xalign    = 0;
            notifySectionBox.PackStart(notifySectionLabel, false, true, 0);

            // create a hbox to provide spacing
            HBox notifySpacerBox = new HBox();

            notifySectionBox.PackStart(notifySpacerBox, true, true, 0);
            Label notifySpaceLabel = new Label("    ");             // four spaces

            notifySpacerBox.PackStart(notifySpaceLabel, false, true, 0);

            // create a vbox to actually place the widgets in for section
            VBox notifyWidgetBox = new VBox();

            notifySpacerBox.PackStart(notifyWidgetBox, true, true, 0);
            notifyWidgetBox.Spacing = 5;

            VBox notificationPreferences = new NotificationPrefsBox(this.topLevelWindow);

            notifyWidgetBox.PackStart(notificationPreferences, true, true, 0);

            //------------------------------
            // Sync Settings
            //------------------------------
            // create a section box
            VBox syncSectionBox = new VBox();

            syncSectionBox.Spacing = Util.SectionTitleSpacing;
            this.PackStart(syncSectionBox, false, true, 0);
            Label syncSectionLabel = new Label("<span weight=\"bold\">" +
                                               Util.GS("Synchronization") +
                                               "</span>");

            syncSectionLabel.UseMarkup = true;
            syncSectionLabel.Xalign    = 0;
            syncSectionBox.PackStart(syncSectionLabel, false, true, 0);

            // create a hbox to provide spacing
            HBox syncSpacerBox = new HBox();

            syncSectionBox.PackStart(syncSpacerBox, false, true, 0);
            Label syncSpaceLabel = new Label("    ");             // four spaces

            syncSpacerBox.PackStart(syncSpaceLabel, false, true, 0);

            // create a vbox to actually place the widgets in for section
            VBox syncWidgetBox = new VBox();

            syncSpacerBox.PackStart(syncWidgetBox, false, true, 0);
            syncWidgetBox.Spacing = 10;

            HBox syncHBox0 = new HBox();

            syncWidgetBox.PackStart(syncHBox0, false, true, 0);
            syncHBox0.Spacing   = 10;
            AutoSyncCheckButton =
                new CheckButton(Util.GS("Automatically S_ynchronize iFolders"));
            syncHBox0.PackStart(AutoSyncCheckButton, false, false, 0);

            HBox syncHBox = new HBox();

            syncHBox.Spacing = 10;
            syncWidgetBox.PackStart(syncHBox, true, true, 0);

            Label spacerLabel = new Label("  ");

            syncHBox.PackStart(spacerLabel, true, true, 0);

            Label syncEveryLabel = new Label(Util.GS("Synchronize iFolders Every"));

            syncEveryLabel.Xalign = 1;
            syncHBox.PackStart(syncEveryLabel, false, false, 0);

            SyncSpinButton = new SpinButton(1, Int32.MaxValue, 1);

            syncHBox.PackStart(SyncSpinButton, false, false, 0);

            SyncUnitsComboBox = ComboBox.NewText();
            syncHBox.PackStart(SyncUnitsComboBox, false, false, 0);

            SyncUnitsComboBox.AppendText(Util.GS("seconds"));
            SyncUnitsComboBox.AppendText(Util.GS("minutes"));
            SyncUnitsComboBox.AppendText(Util.GS("hours"));
            SyncUnitsComboBox.AppendText(Util.GS("days"));

            SyncUnitsComboBox.Active = (int)SyncUnit.Minutes;
            currentSyncUnit          = SyncUnit.Minutes;
        }
コード例 #46
0
        private void modify_job(ArrayList al, string id)
        {
            string jobid  = null;
            string number = null;
            string status = null;
            string user   = null;
            string pages  = null;
            string dials  = null;
            object sendat = null;
            string error  = null;

            IEnumerator enu = al.GetEnumerator();

            while (enu.MoveNext())
            {
                enu.MoveNext();
                jobid = (string)enu.Current;
                enu.MoveNext();
                number = (string)enu.Current;
                enu.MoveNext();
                status = (string)enu.Current;
                enu.MoveNext();
                user = (string)enu.Current;
                enu.MoveNext();
                pages = (string)enu.Current;
                enu.MoveNext();
                int idx = ((string)enu.Current).LastIndexOf(':');
                dials = ((string)enu.Current).Substring(idx + 1);
                enu.MoveNext();
                sendat = (object)enu.Current;
                enu.MoveNext();
                error = (string)enu.Current;
            }

                        #if DEBUG
            Console.WriteLine("[ModifyJob] Date is {0}", sendat);
                        #endif

            Glade.XML xml = new Glade.XML(null, "gfax.glade", "vbox74", null);
            Dialog    mjd = new Dialog();
            mjd.VBox.Add(xml.GetWidget("vbox74"));
            Gtk.Entry      mje  = (Gtk.Entry)xml.GetWidget("ModifyJobNumberEntry");
            Gnome.DateEdit mjde = (Gnome.DateEdit)xml.GetWidget("ModifyJobDate");
            Gtk.SpinButton mjmd = (Gtk.SpinButton)xml.GetWidget("MaxDialsSpinbutton");

            mjd.AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel);
            mjd.AddButton(Gtk.Stock.Ok, Gtk.ResponseType.Ok);

            // this is to re-enable the entry for editing so it won't be selected
            // to begin with???  Maybe something to do with re-parenting or something.
            mje.FocusInEvent +=
                new FocusInEventHandler(on_ModifyJobNumberEntry_focus_in_event);

            mje.IsEditable = false;
            mje.Text       = number.Trim();

            mjde.Time = sendat == null ? new DateTime(): (DateTime)sendat;

            mjmd.Value = Convert.ToDouble(dials.Trim());

            ResponseType result = (ResponseType)mjd.Run();

            if (result == ResponseType.Ok)
            {
                DateTime newsend = (mjde.Time).ToUniversalTime();

                // Format time to send - timezone is in UTC format.
                string tts = String.Format("{0}{1:00}{2:00}{3:00}{4:00}",
                                           newsend.Year,
                                           newsend.Month,
                                           newsend.Day,
                                           newsend.Hour,
                                           newsend.Minute);

                if (id == "sendq")
                {
                    Fax.modify_job(jobid, mje.Text, tts, (mjmd.ValueAsInt).ToString());
                }
                else                 // "doneq"
                {
                    Fax.resubmit_job(jobid, mje.Text, tts, (mjmd.ValueAsInt).ToString());
                }

                mjd.Destroy();
            }
            else
            {
                mjd.Destroy();
            }

            async_update_queue_status("sendq");
            ModifyJobButton.Sensitive = false;
            DeleteJobButton.Sensitive = false;
        }
コード例 #47
0
        /// <summary>Crea las hojas de las opciones, la parte central
        /// del diálogo.</summary>
        /// <returns>El notebook de las opciones.</returns>

        private Gtk.Widget CrearNotebook()
        {
            Gtk.Notebook notebook = new Gtk.Notebook();
            notebook.BorderWidth = 10;

            // Panel de configuración del ensamblador.

            cbAdvertencias = new Gtk.CheckButton(
                Ventana.GetText("D_Conf_MostrarAdv"));

            Gtk.Frame frmEnsamblador =
                new Gtk.Frame(Ventana.GetText("D_Conf_Ensamblador"));
            VBox panelEnsamblador = new VBox(false, 5);

            panelEnsamblador.PackStart(cbAdvertencias);
            frmEnsamblador.Add(panelEnsamblador);

            // Panel de Memoria de control.

            rbMemoriaDef = new RadioButton(null,
                                           Ventana.GetText("D_Conf_MemDef"));
            rbMemoriaUsu = new RadioButton(rbMemoriaDef,
                                           Ventana.GetText("D_Conf_MemUsu"));

            rbMemoriaDef.Toggled   += new EventHandler(rbToggled1);
            rbMemoriaUsu.Toggled   += new EventHandler(rbToggled2);
            lblMemoriaAlt           = new Gtk.Entry("");
            lblMemoriaAlt.Sensitive = false;
            btnFichero          = new Gtk.Button(Ventana.GetText("D_Conf_Explorar"));
            btnFichero.Clicked += new EventHandler(btnFicheroClicked);

            Gtk.Frame frmMemoria =
                new Gtk.Frame(Ventana.GetText("D_Conf_Memoria"));
            VBox panelMemoria = new Gtk.VBox(false, 5);

            panelMemoria.PackStart(rbMemoriaDef);
            panelMemoria.PackStart(rbMemoriaUsu);
            panelMemoria.PackStart(lblMemoriaAlt);
            panelMemoria.PackStart(btnFichero);
            frmMemoria.Add(panelMemoria);


            // Panel del simulador.

            Gtk.Frame frmSimulador =
                new Gtk.Frame(Ventana.GetText("D_Conf_Simulador"));
            VBox panelSimulador = new VBox(false, 5);

            panelSimulador.PackStart(
                new Gtk.Label(Ventana.GetText("D_Conf_Tiempo")));

            sbTiempo = new Gtk.SpinButton(
                new Adjustment(1000.0, 50.0, 5000.0, 10.0, 100.0, 1.0),
                1.0,
                0);
            sbTiempo.Numeric = true;

            panelSimulador.PackStart(sbTiempo);
            frmSimulador.Add(panelSimulador);


            //  ----

            notebook.AppendPage(
                frmSimulador,
                new Gtk.Label(Ventana.GetText("D_Conf_Simulador")));

            notebook.AppendPage(
                frmEnsamblador,
                new Gtk.Label(Ventana.GetText("D_Conf_Ensamblador")));

            notebook.AppendPage(
                frmMemoria,
                new Gtk.Label(Ventana.GetText("D_Conf_Memoria")));

            return(notebook);
        }
コード例 #48
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Scrabble.GUI.StartWindow"/> class.
        /// </summary>
        public StartWindow() : base(Gtk.WindowType.Toplevel)
        {
            #region Basic window properties
            // Basic window properties
            this.Title        = "Scrabble - Základní nastavení";
            this.Name         = "ConfigWindow";
            this.DeleteEvent += OnDeleteEvent;
            this.SetPosition(WindowPosition.Center);
            this.DefaultWidth  = 410;
            this.DefaultHeight = 280;
            this.Icon          = Scrabble.Game.InitialConfig.icon;
            #endregion

            this.numberOfPlayers = 2;

            // Own thread for loading dictionary
            this.statusb = new Gtk.Statusbar();
            this.statusb.Push(statusb.GetContextId("Slovník"), "Načítám slovník");
            this.tdic = new Thread(LoadDictionary);
            this.tdic.Start();

            // infoText (top)
            this.infoText = new Gtk.Label("Základní nastavení hry.\n" +
                                          "Nastavte prosím počet hráčů, jejich jména a určete zda za ně bude hrát umělá inteligence. " +
                                          "Také můžete nastavit, kteří hráči se připojují vzdáleně.");
            this.infoText.Wrap = true;

            // First config line (number of players, client)
            this.upperHbox = new HBox(false, 5);
            this.l1        = new Label("Počet hráčů");
            this.upperHbox.PackStart(l1);
            this.l2                = new Label(", nebo:");
            this.entryNum          = new SpinButton(2, 5, 1);
            this.entryNum.Changed += OnNumberOfPlayerChange;
            client             = new CheckButton();
            client.Clicked    += IamClient;
            client.Label       = "připojit se ke vzdálené hře";
            client.TooltipText = "Pokud zaškrnete, tak se program bude chovat pouze jako client a připojí se k hře vedené na jiném PC.";
            upperHbox.Add(entryNum);
            upperHbox.Add(l2);
            upperHbox.PackEnd(client);
            upperHbox.BorderWidth  = 10;
            upperHbox.WidthRequest = 20;

            // Table with config for each player (dynamic size)
            table = new Gtk.Table(5, 7, false);
            table.Attach(new Gtk.Label("Jméno hráče:"), 1, 2, 0, 1);
            table.Attach(new Gtk.Label("CPU"), 2, 3, 0, 1);
            table.Attach(new Gtk.Label("Network"), 3, 4, 0, 1);
            ipLabel = new Gtk.Label("IP");
            table.Attach(ipLabel, 4, 5, 0, 1);

            labels    = new Gtk.Label[5];
            entryes   = new Gtk.Entry[5];
            CPUchecks = new Gtk.CheckButton[5];
            MPchecks  = new Gtk.CheckButton[5];
            IPs       = new Gtk.Entry[5];
            for (int i = 0; i < 5; i++)
            {
                labels [i]      = new Gtk.Label((i + 1).ToString());
                labels [i].Name = string.Format("l {0}", i);
                table.Attach(labels [i], 0, 1, (uint)i + 1, (uint)i + 2);
                entryes [i]             = new Gtk.Entry(12);
                entryes [i].Text        = "Hráč " + (i + 1).ToString();
                entryes [i].TooltipText = "Vložte jméno hráče.";
                table.Attach(entryes [i], 1, 2, (uint)i + 1, (uint)i + 2);
                CPUchecks [i]             = new Gtk.CheckButton();
                CPUchecks [i].Name        = string.Format("c {0}", i);
                CPUchecks [i].TooltipText = "Pokud je zaškrtnuto, tak za hráče bude hrát počítač.";
                ((Gtk.CheckButton)CPUchecks [i]).Clicked += OnCpuChange;
                table.Attach(CPUchecks [i], 2, 3, (uint)i + 1, (uint)i + 2);
                MPchecks [i]             = new Gtk.CheckButton();
                MPchecks [i].Name        = string.Format("n {0}", i);
                MPchecks [i].TooltipText = "Pokud je zaškrtnuto, tak se počítá s tím, že se tento hráč připojí vzdáleně. ";
                ((Gtk.CheckButton)MPchecks [i]).Clicked += OnNetChange;
                table.Attach(MPchecks [i], 3, 4, (uint)i + 1, (uint)i + 2);
                IPs [i]            = new Gtk.Entry(15);
                IPs [i].Text       = "192.168.0.X";
                IPs [i].WidthChars = 15;
                IPs [i].Sensitive  = false;
                table.Attach(IPs [i], 4, 5, (uint)i + 1, (uint)i + 2);
            }
            this.CPUchecks[0].Hide();

            ok             = new Button("Hotovo");
            ok.Clicked    += Done;
            ok.BorderWidth = 5;
            ok.TooltipText = "Potvrzením začne hra. Může se stát, že program bude ještě chvíli načítat slovník.";
            table.Attach(ok, 0, 5, 6, 7);

            // Main vbox (where all is)
            this.mainVbox = new Gtk.VBox(false, 5);

            this.mainVbox.PackStart(infoText);
            this.mainVbox.Add(upperHbox);
            this.mainVbox.Spacing = 5;
            this.mainVbox.Add(table);
            this.mainVbox.PackEnd(statusb);

            this.mainVbox.BorderWidth = 9;
            this.Add(mainVbox);
            this.mainVbox.ShowAll();

            for (int i = 2; i < numberOfPlayers + 3; i++)
            {
                labels [i].Hide();
                entryes [i].Hide();
                CPUchecks [i].Hide();
                MPchecks [i].Hide();
                IPs [i].Hide();
            }
            ipLabel.Hide();

            foreach (Gtk.Entry e in IPs)
            {
                e.Hide();
            }

            this.CPUchecks[0].Hide();
            this.MPchecks[0].Hide();
        }
コード例 #49
0
 // This one is an event handler for a SpinButton, used to set the menu note count
 private void UpdateMenuNoteCountPreference(object source, EventArgs args)
 {
     Gtk.SpinButton spinner = source as SpinButton;
     Preferences.Set(Preferences.MENU_NOTE_COUNT, spinner.ValueAsInt);
 }
コード例 #50
0
    public MainWindow(string directory)
    {
        log.Debug("Beginning Program");

        Gtk.Window.DefaultIcon = new Gdk.Pixbuf(Helper.GetResourceStream("LynnaLab.icon.ico"));

        Gtk.Builder builder = new Builder();
        builder.AddFromString(Helper.ReadResourceFile("LynnaLab.Glade.MainWindow.ui"));
        builder.Autoconnect(this);

        mainWindow                 = (builder.GetObject("mainWindow") as Gtk.Window);
        menubar1                   = (Gtk.MenuBar)builder.GetObject("menubar1");
        editMenuItem               = (Gtk.MenuItem)builder.GetObject("editMenuItem");
        actionMenuItem             = (Gtk.MenuItem)builder.GetObject("actionMenuItem");
        debugMenuItem              = (Gtk.MenuItem)builder.GetObject("debugMenuItem");
        minimapNotebook            = (Gtk.Notebook)builder.GetObject("minimapNotebook");
        contextNotebook            = (Gtk.Notebook)builder.GetObject("contextNotebook");
        worldSpinButton            = (Gtk.SpinButton)builder.GetObject("worldSpinButton");
        viewObjectsCheckButton     = (Gtk.CheckButton)builder.GetObject("viewObjectsCheckButton");
        viewWarpsCheckButton       = (Gtk.CheckButton)builder.GetObject("viewWarpsCheckButton");
        darkenDungeonRoomsCheckbox = (Gtk.CheckButton)builder.GetObject("darkenDungeonRoomsCheckbox");
        dungeonSpinButton          = (Gtk.SpinButton)builder.GetObject("dungeonSpinButton");
        floorSpinButton            = (Gtk.SpinButton)builder.GetObject("floorSpinButton");
        roomVreHolder              = (Gtk.Box)builder.GetObject("roomVreHolder");
        chestAddHolder             = (Gtk.Box)builder.GetObject("chestAddHolder");
        chestEditorBox             = (Gtk.Box)builder.GetObject("chestEditorBox");
        chestVreHolder             = (Gtk.Box)builder.GetObject("chestVreHolder");
        treasureVreHolder          = (Gtk.Box)builder.GetObject("treasureVreHolder");
        nonExistentTreasureHolder  = (Gtk.Box)builder.GetObject("nonExistentTreasureHolder");
        overallEditingContainer    = (Gtk.Box)builder.GetObject("overallEditingContainer");
        treasureDataFrame          = (Gtk.Widget)builder.GetObject("treasureDataFrame");
        treasureDataLabel          = (Gtk.Label)builder.GetObject("treasureDataLabel");

        editTilesetButton          = new Gtk.Button("Edit");
        editTilesetButton.Clicked += OnTilesetEditorButtonClicked;

        roomSpinButton        = new SpinButtonHexadecimal();
        roomSpinButton.Digits = 3;
        objectgroupeditor1    = new ObjectGroupEditor();
        tilesetViewer1        = new TilesetViewer();
        roomeditor1           = new RoomEditor();
        worldMinimap          = new HighlightingMinimap();
        dungeonMinimap        = new Minimap();
        warpEditor            = new WarpEditor(this);
        statusbar1            = new PriorityStatusbar();
        seasonComboBox        = new ComboBoxFromConstants(showHelp: false);
        seasonComboBox.SpinButton.Adjustment.Upper = 3;

        ((Gtk.Box)builder.GetObject("roomSpinButtonHolder")).Add(roomSpinButton);
        ((Gtk.Box)builder.GetObject("objectGroupEditorHolder")).Add(objectgroupeditor1);
        ((Gtk.Box)builder.GetObject("tilesetViewerHolder")).Add(tilesetViewer1);
        ((Gtk.Box)builder.GetObject("roomEditorHolder")).Add(roomeditor1);
        ((Gtk.Box)builder.GetObject("worldMinimapHolder")).Add(worldMinimap);
        ((Gtk.Box)builder.GetObject("dungeonMinimapHolder")).Add(dungeonMinimap);
        ((Gtk.Box)builder.GetObject("warpEditorHolder")).Add(warpEditor);
        ((Gtk.Box)builder.GetObject("statusbarHolder")).Add(statusbar1);
        ((Gtk.Box)builder.GetObject("seasonComboBoxHolder")).Add(seasonComboBox);

        mainWindow.Title = "LynnaLab " + Helper.ReadResourceFile("LynnaLab.version.txt");

        roomeditor1.Scale             = 2;
        roomeditor1.TilesetViewer     = tilesetViewer1;
        roomeditor1.ObjectGroupEditor = objectgroupeditor1;
        roomeditor1.WarpEditor        = warpEditor;

        eventGroup.Lock();


        // Event handlers from widgets

        roomSpinButton.ValueChanged += eventGroup.Add(OnRoomSpinButtonValueChanged);

        worldSpinButton.ValueChanged   += eventGroup.Add(OnWorldSpinButtonValueChanged);
        dungeonSpinButton.ValueChanged += eventGroup.Add(OnDungeonSpinButtonValueChanged);
        floorSpinButton.ValueChanged   += eventGroup.Add(OnFloorSpinButtonValueChanged);
        seasonComboBox.Changed         += eventGroup.Add(OnSeasonComboBoxChanged);
        minimapNotebook.SwitchPage     += new SwitchPageHandler(eventGroup.Add <SwitchPageArgs>(OnMinimapNotebookSwitchPage));
        contextNotebook.SwitchPage     += new SwitchPageHandler(eventGroup.Add <SwitchPageArgs>(OnContextNotebookSwitchPage));

        roomeditor1.RoomChangedEvent += eventGroup.Add <RoomChangedEventArgs>((sender, args) => {
            eventGroup.Lock();
            OnRoomChanged();

            // Only update minimap if the room editor did a "follow warp". Otherwise, we'll decide
            // whether to update the minimap from whatever code changed the room.
            if (args.fromFollowWarp)
            {
                UpdateMinimapFromRoom(args.fromFollowWarp);
            }

            eventGroup.Unlock();
        });

        dungeonMinimap.AddTileSelectedHandler(eventGroup.Add <int>(delegate(object sender, int index) {
            OnMinimapTileSelected(sender, dungeonMinimap.SelectedIndex);
        }));
        worldMinimap.AddTileSelectedHandler(eventGroup.Add <int>(delegate(object sender, int index) {
            OnMinimapTileSelected(sender, worldMinimap.SelectedIndex);
        }));

        tilesetViewer1.HoverChangedEvent += eventGroup.Add <int>((sender, tile) => {
            if (tilesetViewer1.HoveringIndex != -1)
            {
                statusbar1.Set((uint)StatusbarMessage.TileHovering,
                               "Hovering Tile: 0x" + tilesetViewer1.HoveringIndex.ToString("X2"));
            }
            else
            {
                statusbar1.RemoveAll((uint)StatusbarMessage.TileHovering);
            }
        });
        tilesetViewer1.AddTileSelectedHandler(eventGroup.Add <int>(delegate(object sender, int index) {
            statusbar1.RemoveAll((uint)StatusbarMessage.TileHovering);
            statusbar1.Set((uint)StatusbarMessage.TileSelected, "Selected Tile: 0x" + index.ToString("X2"));
        }));

        roomeditor1.HoverChangedEvent += eventGroup.Add <int>((sender, tile) => {
            if (roomeditor1.HoveringIndex != -1)
            {
                statusbar1.Set((uint)StatusbarMessage.TileHovering, string.Format(
                                   "Hovering Pos: {0},{1} (${1:X}{0:X})", roomeditor1.HoveringX, roomeditor1.HoveringY));
            }
            else
            {
                statusbar1.RemoveAll((uint)StatusbarMessage.TileHovering);
            }
        });
        roomeditor1.WarpDestEditModeChangedEvent += eventGroup.Add <bool>((sender, activated) => {
            if (activated)
            {
                statusbar1.Set((uint)StatusbarMessage.WarpDestEditMode,
                               "Entered warp destination editing mode. To exit this mode, right-click on the warp destination and select \"Done\".");
            }
            else
            {
                statusbar1.RemoveAll((uint)StatusbarMessage.WarpDestEditMode);
            }
        });
        statusbar1.Set((uint)StatusbarMessage.TileSelected, "Selected Tile: 0x00");

        OnDarkenDungeonRoomsCheckboxToggled(null, null);


        // Event handlers from underlying data

        chestEventWrapper.Bind <ValueModifiedEventArgs>("ModifiedEvent", (sender, args) => UpdateChestData());
        chestEventWrapper.Bind <EventArgs>("DeletedEvent", (sender, args) => UpdateChestData());


        // Load "plugins"

        pluginCore = new PluginCore(this);
        LoadPlugins();

        mainWindow.ShowAll();

        eventGroup.UnlockAndClear();


        overallEditingContainer.Sensitive = false;

        if (directory != "")
        {
            OpenProject(directory);
        }
    }