private void HandleFaceButtonClicked(object sender, EventArgs args)
            {
                if (m_list.Count > 0)
                {
                    return;                                // we already did detection for that image
                }
                Face[]    face_list;
                GLib.List g_list;
                Photo     photo = (Photo)View.Item.Current;

                face_list = face_store.GetFacesByPhotoId(photo.Id);

                foreach (Face f in face_list)
                {
                    m_list.Add(f);
                }

                if (face_list.Length == 0)
                {
                    g_list = View.BoxFrame();
                    System.Collections.IEnumerator rect_num = g_list.GetEnumerator();

                    for (int i = 1; i < g_list.Count; i++)
                    {
                        rect_num.MoveNext();
                        m_list.Add(new Face((Gdk.Rectangle)rect_num.Current));
                    }
                }

                m_spin.SetRange(1, m_list.Count);
                m_face = (Face)m_list[0];
                if (m_face.TagId > 0)
                {
                    tag_entry.Text = m_face.Tag.Name;
                }
                else
                {
                    tag_entry.Text = "";
                }
                m_spin.Spin(SpinType.End, 0.0);                 // do this so the event gets fired and proper m_rect selected

                m_newtag_button.Sensitive = true;
                m_spin.Sensitive          = true;
                tag_entry.Sensitive       = true;
            }
        // 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);
        }
        // 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;
        }
        /// <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;
        }
        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;
        }
 public void SetSpinDouble2Range(double min, double max)
 {
     spin_double2.SetRange(min, max);
 }
 public void SetSpin3Range(int min, int max)
 {
     spin_int3.SetRange(min, max);
 }
 public void SetSpin2Range(int min, int max)
 {
     spin_int2.SetRange(min, max);
 }
Example #9
0
        private Widget CreateWidget(DependencyObject o, PropertyInfo info)
        {
            HBox b = new HBox(true, 0);
            Adjustment adj = null;
            SpinButton spin = null;
            Label l  = new Label(info.PropertyData.ShortName);
            l.SetAlignment(0.0f, 0.5f);
            b.PackStart(l);

            switch(info.Type)
            {

            case PropertyType.Double:
            case PropertyType.Integer:
                adj = new Adjustment (0.0, 0.0, Int32.MaxValue, 1.0, 10.0, 100.0);
                spin = new SpinButton (adj, 1.0, 0);
                spin.SetRange (0.0, (double) Int32.MaxValue);
                spin.Numeric = true;
                if(info.Type == PropertyType.Integer)
                {
                    spin.Value = (int)o.GetValue(info.PropertyData.Property);
                    spin.ValueChanged += delegate (object sender, EventArgs e) {
                        Toolbox.ChangeProperty((UIElement) o, o, info.PropertyData.Property, spin.ValueAsInt);
                    };
                }
                else
                {
                    spin.Value = (double)o.GetValue(info.PropertyData.Property);
                    spin.ValueChanged += delegate (object sender, EventArgs e) {
                        Toolbox.ChangeProperty((UIElement) o, o, info.PropertyData.Property, spin.Value);
                    };
                }
                b.PackEnd(spin);
                break;

            case PropertyType.Percent:
                adj = new Adjustment (0.0, 0.0, 1.0, 0.01, 0.1, 1.0);
                spin = new SpinButton (adj, 0.01, 2);
                spin.Numeric = true;
                spin.SetRange (0.0, 1.0);
                spin.Value = (double)o.GetValue(info.PropertyData.Property);
                spin.ValueChanged += delegate (object sender, EventArgs e) {
                    Toolbox.ChangeProperty((UIElement) o, o, info.PropertyData.Property, spin.Value);
                };
                b.PackEnd(spin);
                break;

            case PropertyType.PenLineCap:
                b.PackEnd(CreateEnumPropertyWidget(o, info, typeof(PenLineCap)));
                break;

            case PropertyType.PenLineJoin:
                b.PackEnd(CreateEnumPropertyWidget(o, info, typeof(PenLineJoin)));
                break;

            case PropertyType.Visibility:
                b.PackEnd(CreateEnumPropertyWidget(o, info, typeof(Visibility)));
                break;

            case PropertyType.Stretch:
                b.PackEnd(CreateEnumPropertyWidget(o, info, typeof(Stretch)));
                break;

            case PropertyType.String:
                Entry entry = new Entry(o.GetValue(info.PropertyData.Property).ToString());
                entry.Changed += delegate (object sender, EventArgs e) {
                    Toolbox.ChangeProperty((UIElement)o, o, info.PropertyData.Property, ((Entry)sender).Text);
                };
                b.PackEnd(entry);
                break;

            case PropertyType.DashArray:
            case PropertyType.Data:
                b.PackEnd(new Entry());
                break;

            case PropertyType.Point:
                b.PackEnd(CreatePointPropertyWidget(o, info));
                break;

            case PropertyType.Brush:
                b.PackEnd(CreateBrushPropertyWidget(o, info));
                break;

            default:
                b.PackEnd(new Label(string.Format("Unsupported: {0}", info.Type)));
                break;
            }

            return b;
        }
Example #10
0
        private MainWindow(Gtk.Builder builder) : base(builder.GetObject("MainWindow").Handle)
        {
            builder.Autoconnect(this);
            DeleteEvent += Window_DeleteEvent;

            // Create a status bar context
            _fpsStatusbarContextID = _appStatusbar.GetContextId("FPS");

            // Create the scene editor
            _sceneGLWidget            = new SceneEditorWidget();
            _sceneGLWidget.FpsChange += SceneGLWidgetOnFpsChange;

            // Add the GL widget to the UI
            _sceneGLAlignement.Add(_sceneGLWidget);

            // AlienEngine logo
            _alienEngineLogoSquare.Pixbuf = new Gdk.Pixbuf(typeof(Program).Assembly, "Windows.Resources.Images.AlienEngineLogo");
            _alienEngineLogoSquare.Pixbuf = _alienEngineLogoSquare.Pixbuf.ScaleSimple(36, 36, Gdk.InterpType.Bilinear);

            // Command buttons
            _commandButtonMoveImage.Pixbuf       = new Gdk.Pixbuf(typeof(Program).Assembly, "Windows.Resources.Images.commandButtonMove");
            _commandButtonRotateImage.Pixbuf     = new Gdk.Pixbuf(typeof(Program).Assembly, "Windows.Resources.Images.commandButtonRotate");
            _commandButtonScaleImage.Pixbuf      = new Gdk.Pixbuf(typeof(Program).Assembly, "Windows.Resources.Images.commandButtonScale");
            _commandButtonGlobalViewImage.Pixbuf = new Gdk.Pixbuf(typeof(Program).Assembly, "Windows.Resources.Images.commandButtonGlobal");
            _commandButtonLocalViewImage.Pixbuf  = new Gdk.Pixbuf(typeof(Program).Assembly, "Windows.Resources.Images.commandButtonLocal");

            // Toolbar buttons
            _commandButtonUndoImage.Pixbuf = new Gdk.Pixbuf(typeof(Program).Assembly, "Windows.Resources.Images.commandButtonUndo");
            _commandButtonRedoImage.Pixbuf = new Gdk.Pixbuf(typeof(Program).Assembly, "Windows.Resources.Images.commandButtonRedo");

            // Options buttons
            _optionButtonHelpImage.Pixbuf     = new Gdk.Pixbuf(typeof(Program).Assembly, "Windows.Resources.Images.commandButtonHelp");
            _optionButtonSettingsImage.Pixbuf = new Gdk.Pixbuf(typeof(Program).Assembly, "Windows.Resources.Images.commandButtonSettings");
            _optionButtonProjectsImage.Pixbuf = new Gdk.Pixbuf(typeof(Program).Assembly, "Windows.Resources.Images.commandButtonProjects");

            _sceneEditorGameElementsTreeView.RowActivated += _sceneEditorGameElementsTreeView_RowActivated;

            _sceneEditorTransformComponentTranstateSpinX.SetRange(double.MinValue, double.MaxValue);
            _sceneEditorTransformComponentTranstateSpinY.SetRange(double.MinValue, double.MaxValue);
            _sceneEditorTransformComponentTranstateSpinZ.SetRange(double.MinValue, double.MaxValue);

            _sceneEditorTransformComponentRotateSpinX.SetRange(double.MinValue, double.MaxValue);
            _sceneEditorTransformComponentRotateSpinY.SetRange(double.MinValue, double.MaxValue);
            _sceneEditorTransformComponentRotateSpinZ.SetRange(double.MinValue, double.MaxValue);

            _sceneEditorTransformComponentScaleSpinX.SetRange(double.MinValue, double.MaxValue);
            _sceneEditorTransformComponentScaleSpinY.SetRange(double.MinValue, double.MaxValue);
            _sceneEditorTransformComponentScaleSpinZ.SetRange(double.MinValue, double.MaxValue);

            _sceneEditorTransformComponentRevealerSwitchImage.Pixbuf = new Gdk.Pixbuf(typeof(Program).Assembly, "Windows.Resources.Images.Components.Transform");
            _sceneEditorTransformComponentRevealerSwitch.Clicked    += (sender, args) => _sceneEditorTransformComponentRevealer.RevealChild = !_sceneEditorTransformComponentRevealer.RevealChild;

            _sceneEditorTransformComponentTranslateImage.Pixbuf = new Gdk.Pixbuf(typeof(Program).Assembly, "Windows.Resources.Images.Icons.move");
            _sceneEditorTransformComponentRotateImage.Pixbuf    = new Gdk.Pixbuf(typeof(Program).Assembly, "Windows.Resources.Images.Icons.rotate");
            _sceneEditorTransformComponentScaleImage.Pixbuf     = new Gdk.Pixbuf(typeof(Program).Assembly, "Windows.Resources.Images.Icons.scale");

            _sceneEditorTransformComponentTranstateSpinX.ValueChanged += _sceneEditorTransformComponentChanged;
            _sceneEditorTransformComponentTranstateSpinY.ValueChanged += _sceneEditorTransformComponentChanged;
            _sceneEditorTransformComponentTranstateSpinZ.ValueChanged += _sceneEditorTransformComponentChanged;

            _sceneEditorTransformComponentRotateSpinX.ValueChanged += _sceneEditorTransformComponentChanged;
            _sceneEditorTransformComponentRotateSpinY.ValueChanged += _sceneEditorTransformComponentChanged;
            _sceneEditorTransformComponentRotateSpinZ.ValueChanged += _sceneEditorTransformComponentChanged;

            _sceneEditorTransformComponentScaleSpinX.ValueChanged += _sceneEditorTransformComponentChanged;
            _sceneEditorTransformComponentScaleSpinY.ValueChanged += _sceneEditorTransformComponentChanged;
            _sceneEditorTransformComponentScaleSpinZ.ValueChanged += _sceneEditorTransformComponentChanged;

            SceneEditorGameElementsTree.SetTree(ref _sceneEditorGameElementsTreeStore, ref _sceneEditorGameElementsTreeView);
        }
		/// <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;
			
		}