Exemplo n.º 1
0
        /// <summary>
        /// Setup controls based on selected category.
        /// </summary>
        /// <param name="sender">system parameter</param>
        /// <param name="e">system parameter</param>
        /// <history>
        /// [Curtis_Beard]	   11/11/2014	CHG: use FilterItem
        /// </history>
        private void cboCategories_SelectedIndexChanged(object sender, EventArgs e)
        {
            cboTypes.Items.Clear();
            cboTypes.DisplayMember = "DisplayName";
            cboOptions.Items.Clear();
            chkIgnoreCase.Checked = false;
            fvtValue.ResetValue();

            if (cboCategories.SelectedIndex == cboCategories.FindStringExact(Language.GetGenericText("Exclusions." + FilterType.Categories.File.ToString())))
            {
                var fileList = from l in defaultFilterTypes where l.Category == FilterType.Categories.File select l;
                foreach (var entry in fileList)
                {
                    ComboBoxEntry cbEntry = new ComboBoxEntry();
                    cbEntry.DisplayName = Language.GetGenericText("Exclusions." + entry.SubCategory.ToString());
                    cbEntry.ValueName   = entry.SubCategory.ToString();
                    cbEntry.Value       = entry;
                    cboTypes.Items.Add(cbEntry);
                }
            }
            else if (cboCategories.SelectedIndex == cboCategories.FindStringExact(Language.GetGenericText("Exclusions." + FilterType.Categories.Directory.ToString())))
            {
                var dirList = from l in defaultFilterTypes where l.Category == FilterType.Categories.Directory select l;
                foreach (var entry in dirList)
                {
                    ComboBoxEntry cbEntry = new ComboBoxEntry();
                    cbEntry.DisplayName = Language.GetGenericText("Exclusions." + entry.SubCategory.ToString());
                    cbEntry.ValueName   = entry.SubCategory.ToString();
                    cbEntry.Value       = entry;
                    cboTypes.Items.Add(cbEntry);
                }
            }
        }
Exemplo n.º 2
0
        static void StoreHistory(string propertyName, ComboBoxEntry comboBox)
        {
            var      store   = (ListStore)comboBox.Model;
            var      history = new List <string> ();
            TreeIter iter;

            if (store.GetIterFirst(out iter))
            {
                do
                {
                    history.Add((string)store.GetValue(iter, 0));
                } while (store.IterNext(ref iter));
            }
            const int limit = 20;

            if (history.Count > limit)
            {
                history.RemoveRange(history.Count - (history.Count - limit), history.Count - limit);
            }
            if (history.Contains(comboBox.Entry.Text))
            {
                history.Remove(comboBox.Entry.Text);
            }
            history.Insert(0, comboBox.Entry.Text);
            PropertyService.Set(propertyName, string.Join(historySeparator.ToString(), history.ToArray()));
        }
Exemplo n.º 3
0
        public ToolBarComboBox(int width, int activeIndex, bool allowEntry, params string[] contents)
        {
            if (allowEntry)
                ComboBox = new ComboBoxEntry (contents);
            else {
                Model = new ListStore (typeof(string), typeof (object));
                if (contents != null) {
                    foreach (string entry in contents) {
                        Model.AppendValues (entry, null);
                    }
                }
                ComboBox = new ComboBox ();
                ComboBox.Model = Model;
                CellRendererText = new CellRendererText();
                ComboBox.PackStart(CellRendererText, false);
                ComboBox.AddAttribute(CellRendererText,"text",0);
            }

            ComboBox.AddEvents ((int)Gdk.EventMask.ButtonPressMask);
            ComboBox.WidthRequest = width;

            if (activeIndex >= 0)
                ComboBox.Active = activeIndex;

            ComboBox.Show ();

            Add (ComboBox);
            Show ();
        }
Exemplo n.º 4
0
        public ToolBarComboBox(int width, int activeIndex, bool allowEntry, params string[] contents)
        {
            if (allowEntry)
            {
                ComboBox = new ComboBoxEntry(contents);
            }
            else
            {
                Model = new ListStore(typeof(string), typeof(object));

                if (contents != null)
                {
                    foreach (string entry in contents)
                    {
                        Model.AppendValues(entry, null);
                    }
                }

                ComboBox = CreateComboBox(Model);
                //ComboBox.Model = Model;
            }

            ComboBox.AddEvents((int)Gdk.EventMask.ButtonPressMask);
            ComboBox.WidthRequest = width;

            if (activeIndex >= 0)
            {
                ComboBox.Active = activeIndex;
            }

            ComboBox.Show();

            Add(ComboBox);
            Show();
        }
Exemplo n.º 5
0
		public ToolBarComboBox (int width, int activeIndex, bool allowEntry, params string[] contents)
		{
			if (allowEntry)
				ComboBox = new ComboBoxEntry (contents);
			else {
				Model = new ListStore (typeof(string), typeof (object));

				if (contents != null)
					foreach (string entry in contents)
						Model.AppendValues (entry, null);

				ComboBox = CreateComboBox ();
				ComboBox.Model = Model;
			}

			ComboBox.AddEvents ((int)Gdk.EventMask.ButtonPressMask);
			ComboBox.WidthRequest = width;
			
			if (activeIndex >= 0)
				ComboBox.Active = activeIndex;
			
			ComboBox.Show ();
			
			Add (ComboBox);
			Show ();
		}
Exemplo n.º 6
0
    private void OnComboBoxChanged(object o, EventArgs args)
    {
        try {
            ComboBoxEntry comboBox = (ComboBoxEntry)o;
            string        s        = comboBox.ActiveText;

            // strip off comments from licenseTemplateTexts
            if (s == "non-redistributable (forbid sharing and modification of this level)")
            {
                s = s.Substring(0, s.IndexOf(" ("));
            }
            if (s == "GPL 2+ / CC-by-sa 3.0 (allow sharing and modification of this level)")
            {
                s = s.Substring(0, s.IndexOf(" ("));
            }

            if (s != (string)Field.GetValue(Object))                    //no change => no undo item
            {
                PropertyChangeCommand command = new PropertyChangeCommand(
                    "Changed value of " + Field.Name,
                    Field,
                    Object,
                    s);
                command.Do();
                UndoManager.AddCommand(command);
            }
        } catch (Exception e) {
            ErrorDialog.Exception(e);
        }
    }
Exemplo n.º 7
0
        public override Widget GetEditWidget()
        {
            //get existing method names
            ICollection IColl = evtBind.GetCompatibleMethods(evtBind.GetEvent(parentRow.PropertyDescriptor));

            string[] methods = new string [IColl.Count + 1];
            IColl.CopyTo(methods, 1);

            //add a suggestion
            methods [0] = evtBind.CreateUniqueMethodName((IComponent)parentRow.ParentGrid.CurrentObject, evtBind.GetEvent(parentRow.PropertyDescriptor));

            ComboBoxEntry combo = new ComboBoxEntry(methods);

            if (parentRow.PropertyValue != null)
            {
                combo.Entry.Text = (string)parentRow.PropertyValue;
            }

            combo.WidthRequest = 30;             //Don't artificially inflate the width. It expands anyway.
            //TODO: do we want events created even if not activated?
            combo.Entry.Destroyed += new EventHandler(entry_Changed);
            combo.Entry.Activated += new EventHandler(entry_Activated);
            combo.Changed         += new EventHandler(combo_Activated);

            return(combo);
        }
Exemplo n.º 8
0
        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();
        }
Exemplo n.º 9
0
 private void InitEditor()
 {
     this.buttonOk.Label      = LanguageInfo.Dialog_ButtonOK;
     this.buttonOk.Name       = "MainButton";
     this.buttonCancel.Label  = LanguageInfo.Dialog_ButtonCancel;
     this.combox              = new ComboBoxEntry();
     this.combox.WidthRequest = 60;
     this.hbox1.Add((Widget)this.combox);
     Box.BoxChild boxChild1 = (Box.BoxChild) this.hbox1[(Widget)this.combox];
     this.colorButtonGtk = new ColorEx();
     this.colorButtonGtk.WidthRequest = 105;
     this.hbox1.Add((Widget)this.colorButtonGtk);
     Box.BoxChild boxChild2 = (Box.BoxChild) this.hbox1[(Widget)this.colorButtonGtk];
     this.textEntry = new Entry();
     this.textEntry.WidthRequest = 278;
     this.vbox2.Add((Widget)this.textEntry);
     ((Box.BoxChild) this.vbox2[(Widget)this.textEntry]).Position = 0;
     if (Platform.IsMac)
     {
         Box.BoxChild boxChild3 = (Box.BoxChild) this.hbox1[(Widget)this.buttonOk];
         Box.BoxChild boxChild4 = (Box.BoxChild) this.hbox1[(Widget)this.buttonCancel];
         boxChild1.Position = 1;
         boxChild2.Position = 2;
         boxChild3.Position = 3;
         boxChild4.Position = 4;
     }
     this.fontSizeSpinButton.SetRange(5.0, 100.0);
     this.ShowAll();
     this.fontSizeSpinButton.Hide();
     this.FontSizeComboxInit();
     this.InitText();
     this.InitEvent();
     this.textview.AcceptsTab = false;
 }
Exemplo n.º 10
0
        public OpenLocationDialog() : base(Catalog.GetString("Open Location"))
        {
            var location_box = new HBox()
            {
                Spacing = 6
            };

            address_entry = ComboBoxEntry.NewText();
            address_entry.Entry.Activated += (o, e) => Respond(ResponseType.Ok);

            var browse_button = new Button(Catalog.GetString("Browse..."));

            browse_button.Clicked += OnBrowseClicked;

            location_box.PackStart(address_entry, true, true, 0);
            location_box.PackStart(browse_button, false, false, 0);

            VBox.Spacing = 6;
            VBox.PackStart(new Label()
            {
                Xalign = 0.0f,
                Text   = Catalog.GetString(
                    "Enter the address of the file you would like to open:")
            }, false, false, 0);
            VBox.PackStart(location_box, false, false, 0);
            VBox.ShowAll();

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

            LoadHistory();

            address_entry.Entry.HasFocus = true;
        }
Exemplo n.º 11
0
        void SelectPrivilege(ProfilePrivilege_t privilege)
        {
            ComboBoxEntry item = m_cbPrivilege.Items.Cast <ComboBoxEntry>().
                                 Single(x => x.Privilege == privilege);

            m_cbPrivilege.SelectedItem = item;
        }
Exemplo n.º 12
0
        public Widget ResolveEditor(PropertyItem item = null)
        {
            if (this._propertyItem.DiaplayName != "Display_FontSize")
            {
                this.widget = (Widget) new UndoEntryIntEx();
                (this.widget as UndoEntryIntEx).SetEntryPRoperty(true, 0, 1.0);
                if (this._propertyItem.InstanceCount > 1)
                {
                    this.widget.Sensitive = false;
                }
                else
                {
                    this.SetControl();
                    if (this._propertyItem.ValueRangeDescriptor != null)
                    {
                        (this.widget as UndoEntryIntEx).MaxValue  = this._propertyItem.ValueRangeDescriptor.MaxValue;
                        (this.widget as UndoEntryIntEx).MinValue  = this._propertyItem.ValueRangeDescriptor.MinValue;
                        (this.widget as UndoEntryIntEx).ScrollNum = this._propertyItem.ValueRangeDescriptor.Step;
                    }
                    (this.widget as UndoEntryIntEx).EntryValueChanged += new EventHandler <EntryIntEventArgs>(this.IntEditor_Changed);
                }
                return(this.widget);
            }
            ComboBoxEntry comboBoxEntry = new ComboBoxEntry();
            ListStore     listStore     = new ListStore(new Type[1] {
                typeof(string)
            });

            foreach (int combox in this.comboxList)
            {
                listStore.AppendValues(new object[1]
                {
                    (object)combox.ToString()
                });
            }
            comboBoxEntry.Model = (TreeModel)listStore;
            CellRendererText cellRendererText = new CellRendererText();

            comboBoxEntry.PackStart((CellRenderer)cellRendererText, true);
            comboBoxEntry.AddAttribute((CellRenderer)cellRendererText, "text", 0);
            object obj   = this._propertyItem.PropertyData.GetValue(this._propertyItem.Instance, (object[])null);
            int    index = this.IndexCombox((int)obj);

            if (index == -1)
            {
                comboBoxEntry.Entry.Text = obj.ToString();
            }
            else
            {
                comboBoxEntry.Active     = index;
                comboBoxEntry.Entry.Text = this.comboxList[index].ToString();
            }
            this.widget = (Widget)comboBoxEntry;
            (this.widget as ComboBoxEntry).Changed += new EventHandler(this.combox_Changed);
            (this.widget as ComboBoxEntry).Entry.KeyReleaseEvent += new KeyReleaseEventHandler(this.Entry_KeyReleaseEvent);
            (this.widget as ComboBoxEntry).Entry.FocusOutEvent   += new FocusOutEventHandler(this.Entry_FocusOutEvent);
            (this.widget as ComboBoxEntry).Entry.Changed         += new EventHandler(this.Entry_Changed);
            this.widget = (Widget)comboBoxEntry;
            return(this.widget);
        }
Exemplo n.º 13
0
        static void LoadHistory(string propertyName, ComboBoxEntry entry)
        {
            entry.Entry.Completion = new EntryCompletion();
            var store = new ListStore(typeof(string));

            entry.Entry.Completion.Model = store;
            entry.Model = store;
            entry.Entry.ActivatesDefault = true;
            entry.TextColumn             = 0;
            var history = PropertyService.Get <string> (propertyName);

            if (!string.IsNullOrEmpty(history))
            {
                string[] items = history.Split(historySeparator);
                foreach (string item in items)
                {
                    if (string.IsNullOrEmpty(item))
                    {
                        continue;
                    }
                    store.AppendValues(item);
                }
                entry.Entry.Text = items[0];
            }
        }
Exemplo n.º 14
0
        public OpenLocationDialog () : base (Catalog.GetString ("Open Location"))
        {
            var location_box = new HBox () {
                Spacing = 6
            };

            address_entry = ComboBoxEntry.NewText();
            address_entry.Entry.Activated += (o, e) => Respond (ResponseType.Ok);

            var browse_button = new Button(Catalog.GetString("Browse..."));
            browse_button.Clicked += OnBrowseClicked;

            location_box.PackStart(address_entry, true, true, 0);
            location_box.PackStart(browse_button, false, false, 0);

            VBox.Spacing = 6;
            VBox.PackStart (new Label () {
                Xalign = 0.0f,
                Text = Catalog.GetString (
                    "Enter the address of the file you would like to open:")
                }, false, false, 0);
            VBox.PackStart (location_box, false, false, 0);
            VBox.ShowAll ();

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

            LoadHistory();

            address_entry.Entry.HasFocus = true;
        }
        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();
        }
Exemplo n.º 16
0
        public EditPlantWindow(Plant plant, bool create = false) : base(create ? "Create new plant" : "Edit plant '" + plant.Name + "'", plant)
        {
            Plant  = plant;
            Create = create;

            FeederComboBox        = new ComboBoxEntry(System.Enum.GetNames(typeof(FeederType)));
            FeederComboBox.Active = (int)plant.FeederType;
            AddEntry("Feeder", FeederComboBox);

            SowAnywhereButton = new RadioButton("anywhere");
            SowInsideButton   = new RadioButton(SowAnywhereButton, "inside");
            SowOutsideButton  = new RadioButton(SowInsideButton, "outside");

            if (!plant.MustBeSownInside && !plant.MustBeSownOutside)
            {
                SowAnywhereButton.Active = true;
            }
            else if (plant.MustBeSownInside)
            {
                SowInsideButton.Active = true;
            }
            else if (plant.MustBeSownOutside)
            {
                SowOutsideButton.Active = true;
            }

            AddEntry("Sow", new VBox()
            {
                SowAnywhereButton,
                SowInsideButton,
                SowOutsideButton
            });

            SowInsideDateRangeLabel           = new Label(plant.SowInsideDateRange.ToString());
            SowInsideDateRangeButton.Clicked += (sender, e) =>
            {
            };

            AddEntry("Sow inside", new HBox()
            {
                SowInsideDateRangeLabel, SowInsideDateRangeButton
            });

            SowOutsideDateRangeLabel           = new Label(plant.PlantOutsideDateRange.ToString());
            SowOutsideDateRangeButton.Clicked += (sender, e) =>
            {
            };

            AddEntry("Plant/sow outside", new HBox()
            {
                SowOutsideDateRangeLabel, SowOutsideDateRangeButton
            });

            AddEntry("Days until it can be planted", DaysUntilPlantSpinButton);
            DaysUntilPlantSpinButton.Value = plant.DaysUntilPlantOutside;
            AddEntry("Days until germination", DaysUntilGerminationSpinButton);
            DaysUntilGerminationSpinButton.Value = plant.DaysUntilGermination;
        }
Exemplo n.º 17
0
        private void combox_Changed(object sender, EventArgs e)
        {
            ComboBoxEntry comboBoxEntry = sender as ComboBoxEntry;

            if (comboBoxEntry.Active != -1)
            {
                this.combox.Entry.Text = this.comboxList[comboBoxEntry.Active].ToString();
            }
        }
Exemplo n.º 18
0
        public ReceiptSaveDialog(Window parent, string rawFileName) : base()
        {
            mRawFileName = rawFileName;

            // Laying out

            Title = "Save receipt for " + System.IO.Path.GetFileName(mRawFileName);
            SetPosition(WindowPosition.Center);
            SetSizeRequest(450, 180);
            //this.AllowGrow = false;
            this.SkipPagerHint   = true;
            this.SkipTaskbarHint = true;
            this.HasSeparator    = false;
            Parent        = parent;
            mCancelButton = (Button)AddButton("Cancel", ResponseType.Cancel);
            mSaveButton   = (Button)AddButton("Save", ResponseType.Accept);
            this.Default  = mSaveButton;

            VBox radio_buttons_box = new VBox(false, 2);

            radio_buttons_box.BorderWidth = 6;
            mDefault = new RadioButton("Default receipt for this photo (no name)");
            mCustom  = new RadioButton(mDefault, "Custom receipt for this photo");
            mClass   = new RadioButton(mDefault, "A common receipt for all photos in the same folder");
            radio_buttons_box.PackStart(mDefault);
            radio_buttons_box.PackStart(mCustom);
            radio_buttons_box.PackStart(mClass);
            VBox.Add(radio_buttons_box);

            HBox name_box = new HBox(false, 8);

            name_box.BorderWidth = 6;
            Image receipt_icon = new Image();

            receipt_icon.Pixbuf = Gdk.Pixbuf.LoadFromResource("CatEye.UI.Gtk.res.png.cestage-small-24x24.png");

            Label name_label = new Label("Name:");

            ListStore name_store = new ListStore(typeof(string));

            mNameComboBoxEntry = new ComboBoxEntry(name_store, 0);

            name_box.PackStart(receipt_icon, false, false, 0);
            name_box.PackStart(name_label, false, false, 0);
            name_box.PackStart(mNameComboBoxEntry, true, true, 0);
            VBox.PackStart(name_box, false, false, 0);

            // Adding events

            Shown            += HandleUIChange;
            mDefault.Clicked += HandleUIChange;
            mCustom.Clicked  += HandleUIChange;
            mClass.Clicked   += HandleUIChange;
            mNameComboBoxEntry.Entry.Changed += HandleUIChange;

            this.ShowAll();
        }
Exemplo n.º 19
0
        private void SetUpVarieties(Planting planting)
        {
            string[] labels = new string[Varieties.Count];
            keys = new VarietyKeySeq[Varieties.Count];
            var en = Varieties.Keys.GetEnumerator();

            for (int i = 0; en.MoveNext() && i < Varieties.Count; i++)
            {
                keys[i]   = en.Current;
                labels[i] = GardenData.LoadedData.GetVariety(en.Current).Name + " x " + Varieties[en.Current].Count;
            }
            VarityBox = new ComboBoxEntry(labels);


            VarityBox.Changed += (object sender, EventArgs e) =>
            {
                VarietyRemoveButton.Sensitive = VarityBox.Active >= 0;
                VarietyEditButton.Sensitive   = VarityBox.Active >= 0;
            };


            if (VarietiesLabeledHBox != null)
            {
                VarietiesInnerHBox.Remove(VarietyRemoveButton);
                VarietiesInnerHBox.Remove(VarietyEditButton);
                RemoveLabeledEntry(VarietiesLabeledHBox);
            }

            VarietyRemoveButton           = new Button("Remove");
            VarietyRemoveButton.Sensitive = false;

            VarietyRemoveButton.Clicked += (object sender, EventArgs e) =>
            {
                Varieties.Remove(keys[VarityBox.Active]);
                SetUpVarieties(planting);
            };

            VarietyEditButton           = new Button("Edit");
            VarietyEditButton.Sensitive = false;
            VarietyEditButton.Clicked  += (sender, e) =>
            {
                EditPlantingInfoWindow.ShowPlantingInfoWindow(Varieties[keys[VarityBox.Active]], (plantingInfo) =>
                {
                    GardenDrawingArea area = GardenDrawingArea.ActiveInstance;
                    area.Draw();
                    MainWindow.GetInstance().ShowAreaSelectionInfo(area.SelectedArea);
                }, planting, GardenData.LoadedData.GetVariety(keys[VarityBox.Active]).Name);
            };

            VarietiesInnerHBox = new HBox();
            VarietiesInnerHBox.Add(VarityBox);

            VarietiesInnerHBox.Add(VarietyEditButton);
            VarietiesInnerHBox.Add(VarietyRemoveButton);
            VarietiesLabeledHBox = AddLabeledEntry("Varieties", VarietiesInnerHBox);
            ShowAll();
        }
Exemplo n.º 20
0
		public void Initialize (EditSession session)
		{
			this.session = session;
			
			//if standard values are supported by the converter, then 
			//we list them in a combo
			if (session.Property.Converter.GetStandardValuesSupported (session))
			{
				ListStore store = new ListStore (typeof (string));
				ComboBoxEntry combo = new ComboBoxEntry (store, 0);
				PackStart (combo, true, true, 0);
				combo.Changed += TextChanged;
				entry = combo.Entry;
				entry.HeightRequest = combo.SizeRequest ().Height;
				
				//but if the converter doesn't allow nonstandard values, 
				// then we make the entry uneditable
				if (session.Property.Converter.GetStandardValuesExclusive (session)) {
					entry.IsEditable = false;
					entry.CanFocus = false;
				}
				
				//fill the list
				foreach (object stdValue in session.Property.Converter.GetStandardValues (session)) {
					store.AppendValues (session.Property.Converter.ConvertToString (session, stdValue));
				}
				
				//a value of "--" gets rendered as a --, if typeconverter marked with UsesDashesForSeparator
				object[] atts = session.Property.Converter.GetType ()
					.GetCustomAttributes (typeof (StandardValuesSeparatorAttribute), true);
				if (atts.Length > 0) {
					string separator = ((StandardValuesSeparatorAttribute)atts[0]).Separator;
					combo.RowSeparatorFunc = delegate (TreeModel model, TreeIter iter) {
						return separator == ((string) model.GetValue (iter, 0));
					};
				}
			}
			// no standard values, so just use an entry
			else {
				entry = new Entry ();
				PackStart (entry, true, true, 0);
			}
			
			//either way we have an entry to play with
			entry.HasFrame = false;
			entry.Activated += TextChanged;
			
			if (ShouldShowDialogButton ()) {
				Button button = new Button ("...");
				PackStart (button, false, false, 0);
				button.Clicked += ButtonClicked;
			}
			
			Spacing = 3;
			ShowAll ();
		}
Exemplo n.º 21
0
        /// <summary>
        /// Setup the form.
        /// </summary>
        /// <param name="sender">system parameter</param>
        /// <param name="e">system parameter</param>
        /// <history>
        /// [Curtis_Beard]	   03/07/2012	ADD: 3131609, exclusions
        /// [Curtis_Beard]	   11/11/2014	CHG: use FilterItem
        /// </history>
        private void frmExclusions_Load(object sender, EventArgs e)
        {
            // reset the controls here since the BaseForm could change the font and thus the size of the controls
            fvtValue.ResetControls();

            Language.ProcessForm(this);

            cboCategories.DisplayMember = "DisplayName";
            foreach (string name in Enum.GetNames(typeof(FilterType.Categories)))
            {
                ComboBoxEntry entry = new ComboBoxEntry();
                entry.DisplayName = Language.GetGenericText("Exclusions." + name);
                entry.ValueName   = name;
                cboCategories.Items.Add(entry);
            }

            // load fields with values if in edit mode.
            if (_item != null)
            {
                cboCategories.SelectedIndex = cboCategories.FindStringExact(Language.GetGenericText("Exclusions." + _item.FilterType.Category.ToString()));
                cboTypes.SelectedIndex      = cboTypes.FindStringExact(Language.GetGenericText("Exclusions." + _item.FilterType.SubCategory.ToString()));
                switch (_item.FilterType.ValueType)
                {
                case FilterType.ValueTypes.DateTime:
                    fvtValue.SetViewType(FilterValueType.ViewTypes.DateTime);
                    break;

                case FilterType.ValueTypes.Long:
                    fvtValue.SetViewType(FilterValueType.ViewTypes.Numeric);
                    break;

                case FilterType.ValueTypes.Size:
                    fvtValue.SetViewType(FilterValueType.ViewTypes.Size);
                    fvtValue.SetSizeDropDown(_item.ValueSizeOption);
                    break;

                case FilterType.ValueTypes.String:
                    fvtValue.SetViewType(FilterValueType.ViewTypes.String);
                    break;
                }
                if (_item.FilterType.ValueType != FilterType.ValueTypes.Null)
                {
                    if (_item.FilterType.ValueType == FilterType.ValueTypes.Size)
                    {
                        fvtValue.Value = AstroGrep.Core.Convertors.ConvertFileSizeForDisplay(_item.Value, _item.ValueSizeOption);
                    }
                    else
                    {
                        fvtValue.Value = _item.Value;
                    }
                }
                cboOptions.SelectedIndex = cboOptions.FindStringExact(Language.GetGenericText("Exclusions." + _item.ValueOption.ToString()));
                chkIgnoreCase.Checked    = _item.ValueIgnoreCase;
            }
        }
Exemplo n.º 22
0
        void addEntry(Table table, int line, string label, EntryType type)
        {
            table.Add(new Label(label), 0, line, hpos: WidgetPlacement.End, hexpand: true);

            Widget entry;

            switch (type)
            {
            case EntryType.Text:
                entry = new TextEntry()
                {
                    Text = "Name"
                };
                break;

            case EntryType.Readonly:
                entry = new TextEntry()
                {
                    Text      = "Obj",
                    Sensitive = false
                };
                break;

            case EntryType.LongText:
                entry = new LongTextEntry("this is a long text");
                break;

            case EntryType.Color:
                entry = new ColorEntry();
                break;

            case EntryType.Combo:
                var cbe = new ComboBoxEntry();
                cbe.Items.Add("One");
                cbe.Items.Add("Two");
                cbe.Items.Add("Three");
                //cbe.SelectedIndex = 0;
                entry = cbe;
                break;

            case EntryType.Check:
                entry = new CheckBox()
                {
                    Active = true
                };
                break;

            default:
                // Shouldn't get here
                entry = null;
                break;
            }

            table.Add(entry, 1, line, hpos: WidgetPlacement.Fill, hexpand: true);
        }
Exemplo n.º 23
0
    private void OnSignupResponse(object o, ResponseArgs args)
    {
        ((Dialog)o).Hide();

        if (args.ResponseId != ResponseType.Ok)
        {
            return;
        }

        Hashtable           form   = (Hashtable)this.signupdata;
        NameValueCollection fields = (NameValueCollection)form["fields"];

        Widget [] wgs = ((Dialog)o).VBox.Children;
        wgs = ((HBox)wgs[0]).Children;
        wgs = ((VBox)wgs[1]).Children;
        foreach (Widget wg in wgs)
        {
            switch (wg.GetType().Name)
            {
            case "Entry":
                fields[wg.Name] = ((Entry)wg).Text;
                break;

            case "ComboBox":
                ComboBox  cbox = (ComboBox)wg;
                Hashtable data = (Hashtable)form["data"];
                Hashtable fd   = (Hashtable)data[wg.Name];
                if (fd["reqString"] != null)
                {
                    TreeIter iter;
                    cbox.GetActiveIter(out iter);
                    fields[wg.Name] =
                        (string)cbox.Model.GetValue(iter, 0);
                }
                else
                {
                    fields[wg.Name] =
                        Convert.ToString(cbox.Active + 1);
                }
                break;

            case "ComboBoxEntry":
                ComboBoxEntry cboxe = (ComboBoxEntry)wg;
                fields[wg.Name] = ((Entry)cboxe.Child).Text;
                break;

            case "CheckButton":
                CheckButton cbtn = (CheckButton)wg;
                fields[wg.Name] = cbtn.Active ? "1" : "0";
                break;
            }
        }

        ThreadPool.QueueUserWorkItem(new WaitCallback(SignupThread), form);
    }
Exemplo n.º 24
0
        private void combox_Changed(object sender, EventArgs e)
        {
            ComboBoxEntry comboBoxEntry = sender as ComboBoxEntry;

            (this.widget as ComboBoxEntry).Changed -= new EventHandler(this.combox_Changed);
            if (comboBoxEntry.Active != -1)
            {
                (this.widget as ComboBoxEntry).Entry.Text = this.comboxList[comboBoxEntry.Active].ToString();
            }
            (this.widget as ComboBoxEntry).Changed += new EventHandler(this.combox_Changed);
        }
Exemplo n.º 25
0
        private void cbCellList_SelectedIndexChanged(object sender, EventArgs e)
        {
            ICell         _cell = null;
            ComboBox      cb    = (sender as ComboBox);
            ComboBoxEntry entry = (cb.SelectedItem as ComboBoxEntry);

            switch (entry.ID)
            {
            case -1:
                _cell = new AllDeadCell(GRID_SIZE);
                break;

            case 0:
                _cell = new SimpleCustomCell(GRID_SIZE);
                break;

            case 1:
                _cell = new GliderCell(GRID_SIZE);
                break;

            case 2:
                _cell = new SmallExploderCell(GRID_SIZE, 20);
                break;

            case 3:
                _cell = new ExploderCell(GRID_SIZE, 20);
                break;

            case 4:
                _cell = new TenCellRowCell(GRID_SIZE, 20);
                break;

            case 5:
                _cell = new TumblerCell(GRID_SIZE, 20);
                break;

            case 6:
                _cell = new GosperGliderGunCell(GRID_SIZE, 7);
                break;

            case 7:
                _cell = new RandomCell(GRID_SIZE);
                break;

            default:
                break;
            }
            if (_cell != null)
            {
                this.grid1.GridBits = _cell.ToGrid();
                this.generation     = 0;
                this.lblGenNum.Text = generation.ToString();
            }
        }
Exemplo n.º 26
0
        public ReceiptSaveDialog(Window parent, string rawFileName)
            : base()
        {
            mRawFileName = rawFileName;

            // Laying out

            Title = "Save receipt for " + System.IO.Path.GetFileName(mRawFileName);
            SetPosition(WindowPosition.Center);
            SetSizeRequest(450, 180);
            //this.AllowGrow = false;
            this.SkipPagerHint = true;
            this.SkipTaskbarHint = true;
            this.HasSeparator = false;
            Parent = parent;
            mCancelButton = (Button)AddButton("Cancel", ResponseType.Cancel);
            mSaveButton = (Button)AddButton("Save", ResponseType.Accept);
            this.Default = mSaveButton;

            VBox radio_buttons_box = new VBox(false, 2);
            radio_buttons_box.BorderWidth = 6;
            mDefault = new RadioButton("Default receipt for this photo (no name)");
            mCustom = new RadioButton(mDefault, "Custom receipt for this photo");
            mClass = new RadioButton(mDefault, "A common receipt for all photos in the same folder");
            radio_buttons_box.PackStart(mDefault);
            radio_buttons_box.PackStart(mCustom);
            radio_buttons_box.PackStart(mClass);
            VBox.Add(radio_buttons_box);

            HBox name_box = new HBox(false, 8);
            name_box.BorderWidth = 6;
            Image receipt_icon = new Image();
            receipt_icon.Pixbuf = Gdk.Pixbuf.LoadFromResource("CatEye.UI.Gtk.res.png.cestage-small-24x24.png");

            Label name_label = new Label("Name:");

            ListStore name_store = new ListStore(typeof(string));
            mNameComboBoxEntry = new ComboBoxEntry(name_store, 0);

            name_box.PackStart(receipt_icon, false, false, 0);
            name_box.PackStart(name_label, false, false, 0);
            name_box.PackStart(mNameComboBoxEntry, true, true, 0);
            VBox.PackStart(name_box, false, false, 0);

            // Adding events

            Shown += HandleUIChange;
            mDefault.Clicked += HandleUIChange;
            mCustom.Clicked += HandleUIChange;
            mClass.Clicked += HandleUIChange;
            mNameComboBoxEntry.Entry.Changed += HandleUIChange;

            this.ShowAll();
        }
Exemplo n.º 27
0
        void ShowDirectoryPathUI()
        {
            if (labelPath != null)
            {
                return;
            }

            // We want to add the Path combo box right below the Scope
            uint row = TableGetRowForItem(tableFindAndReplace, labelScope) + 1;

            // DirectoryScope
            labelPath = new Label {
                LabelProp    = GettextCatalog.GetString("_Path:"),
                UseUnderline = true,
                Xalign       = 0f
            };
            labelPath.Show();

            hboxPath                     = new HBox();
            comboboxentryPath            = new ComboBoxEntry();
            comboboxentryPath.Destroyed += ComboboxentryPathDestroyed;
            LoadHistory("MonoDevelop.FindReplaceDialogs.PathHistory", comboboxentryPath);
            comboboxentryPath.Show();
            hboxPath.PackStart(comboboxentryPath);

            labelPath.MnemonicWidget = comboboxentryPath;

            buttonBrowsePaths = new Button {
                Label = "…"
            };
            buttonBrowsePaths.Clicked += ButtonBrowsePathsClicked;
            buttonBrowsePaths.Show();
            hboxPath.PackStart(buttonBrowsePaths, false, false, 0);
            hboxPath.Show();

            // Add the Directory Path row to the table
            TableAddRow(tableFindAndReplace, row++, labelPath, hboxPath);

            // Add a checkbox for searching the directory recursively...
            checkbuttonRecursively = new CheckButton {
                Label        = GettextCatalog.GetString("Re_cursively"),
                Active       = properties.Get("SearchPathRecursively", true),
                UseUnderline = true
            };

            checkbuttonRecursively.Destroyed += CheckbuttonRecursivelyDestroyed;
            checkbuttonRecursively.Show();

            TableAddRow(tableFindAndReplace, row, null, checkbuttonRecursively);

            SetupAccessibilityForPath();
        }
Exemplo n.º 28
0
        private void Entry_KeyReleaseEvent(object o, KeyReleaseEventArgs args)
        {
            this.isKeyPress = true;
            Gdk.Key       key    = args.Event.Key;
            ComboBoxEntry widget = this.widget as ComboBoxEntry;

            if (key != Gdk.Key.Return && key != Gdk.Key.KP_Enter && key != Gdk.Key.ISO_Enter || !widget.Entry.IsFocus || string.IsNullOrEmpty(widget.Entry.Text))
            {
                return;
            }
            widget.Changed -= new EventHandler(this.combox_Changed);
            this._propertyItem.SetValue(this._propertyItem.Instance, (object)Convert.ToInt32(widget.Entry.Text), (object[])null);
            widget.Changed += new EventHandler(this.combox_Changed);
        }
Exemplo n.º 29
0
 private void Entry_FocusOutEvent(object o, FocusOutEventArgs args)
 {
     if (this.isKeyPress)
     {
         ComboBoxEntry widget = this.widget as ComboBoxEntry;
         if (string.IsNullOrEmpty(widget.Entry.Text))
         {
             return;
         }
         widget.Changed -= new EventHandler(this.combox_Changed);
         this._propertyItem.SetValue(this._propertyItem.Instance, (object)Convert.ToInt32(widget.Entry.Text), (object[])null);
         widget.Changed += new EventHandler(this.combox_Changed);
     }
     this.isKeyPress = false;
 }
Exemplo n.º 30
0
        public StationDialog(Stations stations, Station station)
        {
            glade = new Glade.XML(null, "radio.glade", "StationDialog", "banshee");
            glade.Autoconnect(this);
            dialog = (Dialog)glade.GetWidget("StationDialog");
            Banshee.Base.IconThemeUtils.SetWindowIcon(dialog);

            if (station == null)
            {
                is_new  = true;
                station = new Station();
            }

            this.stations = stations;
            this.station  = station;

            link_store          = new LinkStore(station);
            view                = new NodeView(link_store);
            view.HeadersVisible = true;

            CellRendererToggle active_renderer = new CellRendererToggle();

            active_renderer.Activatable = true;
            active_renderer.Radio       = true;
            active_renderer.Toggled    += OnLinkToggled;

            view.AppendColumn(Catalog.GetString("Active"), active_renderer, ActiveDataFunc);
            view.AppendColumn(Catalog.GetString("Type"), new CellRendererText(), TypeDataFunc);
            view.AppendColumn(Catalog.GetString("Title"), EditTextRenderer(), "text", 1);
            view.AppendColumn(Catalog.GetString("URI"), EditTextRenderer(), "text", 2);
            view.Show();

            (glade["link_view_container"] as ScrolledWindow).Add(view);

            group_combo = ComboBoxEntry.NewText();
            group_combo.Show();
            (glade["group_combo_container"] as Box).PackStart(group_combo, true, true, 0);

            title_entry.Text       = station.Title == null ? String.Empty : station.Title;
            description_entry.Text = station.Description == null ? String.Empty : station.Description;
            group_combo.Entry.Text = station.Group == null ? String.Empty : station.Group;

            foreach (string group in stations.Groups)
            {
                group_combo.AppendText(group);
            }
        }
Exemplo n.º 31
0
		public void set_setting (Setting s)
		{
			if(_s != null)
				throw new Exception("set_setting may only be used once per instance!");
			_s = s;

			name_label.Text = _s.Name;

			if (_s.Choices != null && _s.Limited) {

				// TODO: This is broken, code was originally written to store a string
				// but in this particular case there is a setting with string type
				// and you are given an array of choices, so what should really be
				// stored is a value between 0 and the length of the array; to 
				// indicate which choice is selected. As I am changing User-Agent
				// switcher to "Un Limited" I do not have a use case for this yet.
				ComboBox cobo = new ComboBox ((String[])_s.Choices);
				cobo.SetSizeRequest (100, 20);
				cobo.Name = _s.Name;
				cobo.Changed += cobo_changed;
				vbox2.Add (cobo);
			} else if (_s.Choices != null && !_s.Limited) {
				ComboBoxEntry combo = new ComboBoxEntry ((String[])_s.Choices);
				combo.SetSizeRequest (100, 20);
				combo.Name = _s.Name;
				combo.Entry.Text = (String)_s.Value;
				combo.Changed += combo_changed;
				vbox2.Add (combo);
			} else {
				Entry e = new Entry ((string)_s.Value);
				e.Name = _s.Name;
				e.Changed += e_changed;
				vbox2.Add (e);
			}
			Label l = new Label (_s.Description);
			l.SetSizeRequest (315, 100);
			l.SetAlignment (0, 0);
			l.LineWrap = true;
			l.SingleLineMode = false;
			l.SetPadding (10, 2);
			Pango.FontDescription pf2 = new Pango.FontDescription ();
			pf2.Weight = Pango.Weight.Light;
			l.ModifyFont (pf2);
			vbox2.Add(l);
		}
Exemplo n.º 32
0
        void AppendCombobox(List <string> items)
        {
            ListStore store = new ListStore(typeof(string));

            foreach (string i in items)
            {
                store.AppendValues(i);
            }

            ComboBoxEntry cb   = new ComboBoxEntry(store, 0);
            HBox          hbox = new HBox();
            // btnOk
            Button btnOk = new Button();
            Image  im    = new Image();

            im.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-apply", IconSize.Menu);
            btnOk.Add(im);
            btnOk.Clicked += delegate {
                try {
                    pattern = DebaterPattern.Parse(pattern + "; " + cb.ActiveText);
                }
                catch (Exception ex) {
                    MiscHelpers.ShowMessage(this,
                                            "Could not add pattern: " + ex.Message,
                                            MessageType.Error);
                    return;
                }
                UpdateGui();
            };
            hbox.PackStart(btnOk, false, false, 0);
            // btnCancel
            Button btnCancel = new Button();

            im        = new Image();
            im.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-cancel", IconSize.Menu);
            btnCancel.Add(im);
            btnCancel.Clicked += delegate {
                UpdateGui();
            };
            hbox.PackStart(btnCancel, false, false, 0);
            // cb as last element
            hbox.PackStart(cb, false, false, 0);
            hbox.ShowAll();
            vbox.PackStart(hbox, false, false, 0);
        }
Exemplo n.º 33
0
        public ToolBarComboBox(int width, int activeIndex, bool allowEntry, params string[] contents)
        {
            if (allowEntry)
                ComboBox = new ComboBoxEntry (contents);
            else
                ComboBox = new ComboBox (contents);

            ComboBox.AddEvents ((int)Gdk.EventMask.ButtonPressMask);
            ComboBox.WidthRequest = width;

            if (activeIndex >= 0)
                ComboBox.Active = activeIndex;

            ComboBox.Show ();

            Add (ComboBox);
            Show ();
        }
Exemplo n.º 34
0
        public OpenLocationDialog() : base("OpenLocationDialog")
        {
            address_entry = ComboBoxEntry.NewText();
            address_entry.Show();
            address_entry.Entry.Activated += OnEntryActivated;

            browse_button          = new Button(Catalog.GetString("Browse..."));
            browse_button.Clicked += OnBrowseClicked;
            browse_button.Show();

            location_box.PackStart(address_entry, true, true, 0);
            location_box.PackStart(browse_button, false, false, 0);

            Dialog.Response += OnResponse;
            LoadHistory();

            address_entry.Entry.HasFocus = true;
        }
Exemplo n.º 35
0
        private void Entry_Changed(object sender, EventArgs e)
        {
            ComboBoxEntry widget = this.widget as ComboBoxEntry;

            if (!widget.Entry.IsFocus)
            {
                this._propertyItem.SetValue(this._propertyItem.Instance, (object)Convert.ToInt32(widget.Entry.Text), (object[])null);
            }
            else
            {
                for (int startIndex = 0; startIndex < widget.Entry.Text.Length; ++startIndex)
                {
                    if ((int)widget.Entry.Text[startIndex] < 48 || (int)widget.Entry.Text[startIndex] > 57)
                    {
                        widget.Entry.Text = widget.Entry.Text.Remove(startIndex, 1);
                    }
                }
            }
        }
Exemplo n.º 36
0
        void HideDirectoryPathUI()
        {
            if (labelPath == null)
            {
                return;
            }

            uint row = TableGetRowForItem(tableFindAndReplace, checkbuttonRecursively);

            TableRemoveRow(tableFindAndReplace, row, null, checkbuttonRecursively, true);
            checkbuttonRecursively = null;

            row = TableGetRowForItem(tableFindAndReplace, labelPath);
            TableRemoveRow(tableFindAndReplace, row, labelPath, hboxPath, true);
            // comboboxentryPath and buttonBrowsePaths are destroyed with hboxPath
            buttonBrowsePaths = null;
            comboboxentryPath = null;
            labelPath         = null;
            hboxPath          = null;
        }
Exemplo n.º 37
0
        private void OnLoad(object sender, EventArgs e)
        {
            // Credit: These "starting" cells are borrowed from http://www.bitstorm.org/gameoflife/

            object dflt = new ComboBoxEntry(-1, "Reset [Empty]");

            this.cbCellList.Items.Add(dflt);
            this.cbCellList.SelectedItem = dflt;

            this.cbCellList.Items.Add(new ComboBoxEntry(0, "Simple Custom [Flipping Line]"));
            this.cbCellList.Items.Add(new ComboBoxEntry(1, "Glider"));
            this.cbCellList.Items.Add(new ComboBoxEntry(2, "Small Exploder"));
            this.cbCellList.Items.Add(new ComboBoxEntry(3, "Exploder"));
            this.cbCellList.Items.Add(new ComboBoxEntry(4, "Ten Cell Row"));

            this.cbCellList.Items.Add(new ComboBoxEntry(5, "Tumbler"));
            this.cbCellList.Items.Add(new ComboBoxEntry(6, "Gosper Glider Gun"));

            this.cbCellList.Items.Add(new ComboBoxEntry(7, "Random [Expiremental]"));
        }
    public override Widget Create(object caller)
    {
        List<String> licenseTemplateTexts = new List<String>();
        licenseTemplateTexts.Add("non-redistributable (forbid sharing and modification of this level)");
        licenseTemplateTexts.Add("GPL 2+ / CC-by-sa 3.0 (allow sharing and modification of this level)");

        comboBox = new ComboBoxEntry(licenseTemplateTexts.ToArray());

        OnFieldChanged(Field);	//same code for initialization

        comboBox.Changed += OnComboBoxChanged;

        HBox box = new HBox();
        box.PackStart(comboBox, true, true, 0);
        box.Name = Field.Name;

        CreateToolTip(caller, comboBox);

        return box;
    }
Exemplo n.º 39
0
        void ShowReplaceUI()
        {
            if (replaceMode)
            {
                return;
            }

            labelReplace = new Label {
                Text = GettextCatalog.GetString("_Replace:"), Xalign = 0f, UseUnderline = true
            };
            comboboxentryReplace = new ComboBoxEntry();
            LoadHistory("MonoDevelop.FindReplaceDialogs.ReplaceHistory", comboboxentryReplace);
            comboboxentryReplace.Show();
            labelReplace.Show();
            SetupAccessibilityForReplace();

            TableAddRow(tableFindAndReplace, 1, labelReplace, comboboxentryReplace);

            buttonReplace = new Button()
            {
                Label        = "gtk-find-and-replace",
                UseUnderline = true,
                CanDefault   = true,
                UseStock     = true,
            };
            // Note: We override the stock label text instead of using SetButtonIcon() because the
            // theme may override whether or not the icons are shown. Using SetButtonIcon() would
            // break the theme by forcing icons even if the theme says "no".
            OverrideStockLabel(buttonReplace, GettextCatalog.GetString("R_eplace"));
            buttonReplace.Clicked += HandleReplaceClicked;
            buttonReplace.Show();

            AddActionWidget(buttonReplace, 0);
            buttonReplace.GrabDefault();

            replaceMode = true;

            Requisition req = SizeRequest();

            Resize(req.Width, req.Height);
        }
Exemplo n.º 40
0
		void ShowDirectoryPathUI ()
		{
			if (labelPath != null)
				return;
			
			// We want to add the Path combo box right below the Scope 
			uint row = TableGetRowForItem (tableFindAndReplace, labelScope) + 1;
			
			// DirectoryScope
			labelPath = new Label {
				LabelProp = GettextCatalog.GetString ("_Path:"),
				UseUnderline = true, 
				Xalign = 0f
			};
			labelPath.Show ();
			
			hboxPath = new HBox ();
			comboboxentryPath = new ComboBoxEntry ();
			comboboxentryPath.Destroyed += ComboboxentryPathDestroyed;
			LoadHistory ("MonoDevelop.FindReplaceDialogs.PathHistory", comboboxentryPath);
			comboboxentryPath.Show ();
			hboxPath.PackStart (comboboxentryPath);
			
			labelPath.MnemonicWidget = comboboxentryPath;
			
			buttonBrowsePaths = new Button { Label = "..." };
			buttonBrowsePaths.Clicked += ButtonBrowsePathsClicked;
			buttonBrowsePaths.Show ();
			hboxPath.PackStart (buttonBrowsePaths, false, false, 0);
			hboxPath.Show ();
			
			// Add the Directory Path row to the table
			TableAddRow (tableFindAndReplace, row++, labelPath, hboxPath);
			
			// Add a checkbox for searching the directory recursively...
			checkbuttonRecursively = new CheckButton {
				Label = GettextCatalog.GetString ("Re_cursively"),
				Active = properties.Get ("SearchPathRecursively", true),
				UseUnderline = true
			};
			
			checkbuttonRecursively.Destroyed += CheckbuttonRecursivelyDestroyed;
			checkbuttonRecursively.Show ();
			
			TableAddRow (tableFindAndReplace, row, null, checkbuttonRecursively);
		}
Exemplo n.º 41
0
		void HideReplaceUI ()
		{
			if (!replaceMode)
				return;
			
			buttonReplace.Destroy ();
			buttonReplace = null;
			
			buttonSearch.GrabDefault ();
			
			StoreHistory ("MonoDevelop.FindReplaceDialogs.ReplaceHistory", comboboxentryReplace);
			TableRemoveRow (tableFindAndReplace, 1, labelReplace, comboboxentryReplace, true);
			comboboxentryReplace = null;
			labelReplace = null;
			
			replaceMode = false;
			
			Requisition req = SizeRequest ();
			Resize (req.Width, req.Height);
		}
Exemplo n.º 42
0
		void ShowReplaceUI ()
		{
			if (replaceMode)
				return;
			
			labelReplace = new Label { Text = GettextCatalog.GetString ("_Replace:"), Xalign = 0f, UseUnderline = true };
			comboboxentryReplace = new ComboBoxEntry ();
			LoadHistory ("MonoDevelop.FindReplaceDialogs.ReplaceHistory", comboboxentryReplace);
			comboboxentryReplace.Show ();
			labelReplace.Show ();
			
			TableAddRow (tableFindAndReplace, 1, labelReplace, comboboxentryReplace);
			
			buttonReplace = new Button () {
				Label = "gtk-find-and-replace",
				UseUnderline = true,
				CanDefault = true,
				UseStock = true,
			};
			// Note: We override the stock label text instead of using SetButtonIcon() because the
			// theme may override whether or not the icons are shown. Using SetButtonIcon() would
			// break the theme by forcing icons even if the theme says "no".
			OverrideStockLabel (buttonReplace, GettextCatalog.GetString ("R_eplace"));
			buttonReplace.Clicked += HandleReplaceClicked;
			buttonReplace.Show ();
			
			AddActionWidget (buttonReplace, 0);
			buttonReplace.GrabDefault ();
			
			replaceMode = true;
			
			Requisition req = SizeRequest ();
			Resize (req.Width, req.Height);
		}
Exemplo n.º 43
0
        /// <summary>
        /// Initializes all GUI components.
        /// </summary>
        /// <history>
        /// [Curtis_Beard]      11/03/2006  Created
        /// </history>
        private void InitializeComponent()
        {
            this.SetDefaultSize (Core.GeneralSettings.WindowWidth, Core.GeneralSettings.WindowHeight);
             if (Core.GeneralSettings.WindowLeft == -1 && Core.GeneralSettings.WindowTop == -1)
            this.SetPosition(WindowPosition.Center);
             else
            this.Move(Core.GeneralSettings.WindowLeft, Core.GeneralSettings.WindowTop);

             this.DeleteEvent += new DeleteEventHandler(OnWindowDelete);
             this.Title = Constants.ProductName;
             this.Icon = Images.GetPixbuf("AstroGrep_Icon.ico");

             MainTooltips = new Tooltips();

             VBox vbox = new VBox();
             vbox.BorderWidth = 0;

             Frame leftFrame = new Frame();
             leftFrame.Shadow = ShadowType.In;
             leftFrame.WidthRequest = 200;

             VBox searchBox = new VBox();
             VBox searchOptionsBox = new VBox();
             searchBox.BorderWidth = 3;
             searchOptionsBox.BorderWidth = 3;
             lblSearchStart = new Label("Search Path");
             lblSearchStart.SetAlignment(0,0);

             btnBrowse = new Button();
             btnBrowse.SetSizeRequest(32, 20);
             Gtk.Image img = new Image();
             img.Pixbuf = Images.GetPixbuf("folder-open.png");
             VBox browseBox = new VBox();
             browseBox.PackStart(img, false, false, 0);
             MainTooltips.SetTip(btnBrowse, "Select the folder to start the search", "");
             btnBrowse.Clicked += new EventHandler(btnBrowse_Clicked);
             btnBrowse.Add(browseBox);

             cboSearchStart = ComboBoxEntry.NewText();
             cboSearchFilter = ComboBoxEntry.NewText();
             cboSearchText = ComboBoxEntry.NewText();

             LoadComboBoxEntry(cboSearchStart, Core.GeneralSettings.SearchStarts, true);
             LoadComboBoxEntry(cboSearchFilter, Core.GeneralSettings.SearchFilters, false);
             LoadComboBoxEntry(cboSearchText, Core.GeneralSettings.SearchTexts, false);

             cboSearchStart.Changed += new EventHandler(cboSearchStart_Changed);
             lblSearchFilter = new Label("File Types");
             lblSearchFilter.SetAlignment(0,0);
             lblSearchText = new Label("Search Text");
             lblSearchText.SetAlignment(0,0);

             // search path
             VBox startVBox = new VBox();
             startVBox.BorderWidth = 0;
             cboSearchStart.WidthRequest = 100;
             SetActiveComboBoxEntry(cboSearchStart);

             HBox startHBox = new HBox();
             startHBox.BorderWidth = 0;
             startHBox.PackStart(cboSearchStart, true, true, 0);
             startHBox.PackEnd(btnBrowse, false, false, 0);

             startVBox.PackStart(lblSearchStart, false, false, 0);
             startVBox.PackStart(startHBox, true, false, 0);
             searchBox.PackStart(startVBox, true, false, 0);

             // search filter
             VBox filterVBox = new VBox();
             cboSearchFilter.Active = 0;
             filterVBox.BorderWidth = 0;
             filterVBox.PackStart(lblSearchFilter, false, false, 0);
             filterVBox.PackStart(cboSearchFilter, true, false, 0);
             searchBox.PackStart(filterVBox, true, false, 0);

             // search text
             VBox textVBox = new VBox();
             cboSearchText.Active = 0;
             textVBox.BorderWidth = 0;
             textVBox.PackStart(lblSearchText, false, false, 0);
             textVBox.PackStart(cboSearchText, true, false, 0);
             searchBox.PackStart(textVBox, true, false, 0);

             // Search/Cancel buttons
             searchBox.PackStart(CreateButtons(), false, false, 0);

             // Search Options
             chkRegularExpressions = new CheckButton("Regular Expressions");
             chkCaseSensitive = new CheckButton("Case Sensitive");
             chkWholeWord = new CheckButton("Whole Word");
             chkRecurse = new CheckButton("Recurse");
             chkFileNamesOnly = new CheckButton("Show File Names Only");
             chkFileNamesOnly.Clicked += new EventHandler(chkFileNamesOnly_Clicked);
             chkNegation = new CheckButton("Negation");
             chkNegation.Clicked += new EventHandler(chkNegation_Clicked);
             chkLineNumbers = new CheckButton("Line Numbers");
             cboContextLines = ComboBox.NewText();
             cboContextLines.WidthRequest = 100;
             cboContextLines.WrapWidth = 3;
             for (int i = 0; i <= Constants.MAX_CONTEXT_LINES; i++)
            cboContextLines.AppendText(i.ToString());
             lblContextLines = new Label("Context Lines");
             HBox cxtBox = new HBox();
             cxtBox.BorderWidth = 0;
             cxtBox.PackStart(cboContextLines, false, false, 3);
             cxtBox.PackStart(lblContextLines, false, false, 3);

             searchOptionsBox.PackStart(chkRegularExpressions, true, false, 0);
             searchOptionsBox.PackStart(chkCaseSensitive, true, false, 0);
             searchOptionsBox.PackStart(chkWholeWord, true, false, 0);
             searchOptionsBox.PackStart(chkRecurse, true, false, 0);
             searchOptionsBox.PackStart(chkFileNamesOnly, true, false, 0);
             searchOptionsBox.PackStart(chkNegation, true, false, 0);
             searchOptionsBox.PackStart(chkLineNumbers, true, false, 0);
             searchOptionsBox.PackStart(cxtBox, true, false, 0);
             searchBox.PackEnd(searchOptionsBox, true, true, 0);

             leftFrame.Add(searchBox);

             panelLeft = new HPaned();
             panelLeft.BorderWidth = 0;
             panelRight = new VPaned();
             panelRight.BorderWidth = 0;

             // File List
             Gtk.Frame treeFrame = new Gtk.Frame();
             treeFrame.Shadow = ShadowType.In;
             Gtk.ScrolledWindow treeWin = new Gtk.ScrolledWindow();
             tvFiles = new Gtk.TreeView ();
             SetColumnsText();

             tvFiles.Model = new ListStore(typeof (string), typeof (string), typeof (string), typeof (string), typeof (int));
             (tvFiles.Model as ListStore).DefaultSortFunc = new TreeIterCompareFunc(DefaultTreeIterCompareFunc);
             tvFiles.Selection.Changed += new EventHandler(Tree_OnSelectionChanged);
             tvFiles.RowActivated += new RowActivatedHandler(tvFiles_RowActivated);

             tvFiles.RulesHint = true;
             tvFiles.HeadersClickable = true;
             tvFiles.HeadersVisible = true;
             tvFiles.Selection.Mode = SelectionMode.Multiple;

             SetSortingFunctions();

             treeWin.Add(tvFiles);
             treeFrame.BorderWidth = 0;
             treeFrame.Add(treeWin);

             // txtHits
             Gtk.Frame ScrolledWindowFrm = new Gtk.Frame();
             ScrolledWindowFrm.Shadow = ShadowType.In;
             Gtk.ScrolledWindow TxtViewWin = new Gtk.ScrolledWindow();
             txtViewer = new Gtk.TextView();
             txtViewer.Buffer.Text = "";
             txtViewer.Editable = false;
             TxtViewWin.Add(txtViewer);
             ScrolledWindowFrm.BorderWidth = 0;
             ScrolledWindowFrm.Add(TxtViewWin);

             // Add file list and txtHits to right panel
             panelRight.Pack1(treeFrame, true, true);
             panelRight.Pack2(ScrolledWindowFrm, true, true);

            // TLW

            //Notebook notebook = new Notebook();
            //    Table table = new Table(3, 6);

            // Create a new notebook, place the position of the tabs
              //  table.attach(notebook, 0, 6, 0, 1);

             // Status Bar
             sbStatus = new Statusbar();

             #region Menu bar

             agMenuAccel = new AccelGroup();
             this.AddAccelGroup(agMenuAccel);

             mbMain = new Gtk.MenuBar();

             // File menu
             mnuFile = new Menu();
             MenuItem mnuFileItem = new MenuItem("_File");
             mnuFileItem.Submenu = mnuFile;
             mnuFile.AccelGroup = agMenuAccel;
             mnuFile.Shown += new EventHandler(mnuFile_Shown);

             // Edit menu
             mnuEdit = new Menu();
             MenuItem mnuEditItem = new MenuItem("_Edit");
             mnuEditItem.Submenu = mnuEdit;
             mnuEdit.AccelGroup = agMenuAccel;
             mnuEdit.Shown += new EventHandler(mnuEdit_Shown);

             // Tools menu
             mnuTools = new Menu();
             MenuItem mnuToolsItem = new MenuItem("_Tools");
             mnuToolsItem.Submenu = mnuTools;
             mnuTools.AccelGroup = agMenuAccel;

             // Help menu
             mnuHelp = new Menu();
             MenuItem mnuHelpItem = new MenuItem("_Help");
             mnuHelpItem.Submenu = mnuHelp;
             mnuHelp.AccelGroup = agMenuAccel;

             // File Save menu item
             SaveMenuItem = new ImageMenuItem(Stock.Save, agMenuAccel);
             SaveMenuItem.Activated += new EventHandler(SaveMenuItem_Activated);
             mnuFile.Append(SaveMenuItem);

             // File Print menu item
             PrintMenuItem = new ImageMenuItem(Stock.Print, agMenuAccel);
             PrintMenuItem.Activated += new EventHandler(PrintMenuItem_Activated);
             mnuFile.Append(PrintMenuItem);

             // File Separator menu item
             SeparatorMenuItem Separator1MenuItem = new SeparatorMenuItem();
             mnuFile.Append(Separator1MenuItem);

             // File Exit menu item
             ExitMenuItem = new ImageMenuItem(Stock.Quit, agMenuAccel);
             ExitMenuItem.Activated += new EventHandler(ExitMenuItem_Activated);
             mnuFile.Append(ExitMenuItem);

             // Edit Select All menu item
             SelectAllMenuItem = new ImageMenuItem("_Select All Files", agMenuAccel);
             SelectAllMenuItem.Activated += new EventHandler(SelectAllMenuItem_Activated);
             mnuEdit.Append(SelectAllMenuItem);

             // Edit Open Selected menu item
             OpenSelectedMenuItem = new ImageMenuItem("_Open Selected Files", agMenuAccel);
             OpenSelectedMenuItem.Activated += new EventHandler(OpenSelectedMenuItem_Activated);
             mnuEdit.Append(OpenSelectedMenuItem);

             // Create preferences for every other os except windows
             if (!Common.IsWindows)
             {
            Separator1MenuItem = new SeparatorMenuItem();
            mnuEdit.Append(Separator1MenuItem);

            // Preferences
            Gtk.ImageMenuItem OptionsMenuItem = new ImageMenuItem(Stock.Preferences, agMenuAccel);
            OptionsMenuItem.Activated += new EventHandler(OptionsMenuItem_Activated);
            mnuEdit.Append(OptionsMenuItem);
             }

             // Clear MRU List
             Gtk.ImageMenuItem ClearMRUsMenuItem = new ImageMenuItem("_Clear Most Recently Used Lists", agMenuAccel);
             ClearMRUsMenuItem.Activated += new EventHandler(ClearMRUsMenuItem_Activated);
             mnuTools.Append(ClearMRUsMenuItem);

             Separator1MenuItem = new SeparatorMenuItem();
             mnuTools.Append(Separator1MenuItem);

             // Save Search Options
             Gtk.ImageMenuItem SaveOptionsMenuItem = new ImageMenuItem("_Save Search Options", agMenuAccel);
             SaveOptionsMenuItem.Activated += new EventHandler(SaveOptionsMenuItem_Activated);
             mnuTools.Append(SaveOptionsMenuItem);

             // Create Options menu for windows
             if (Common.IsWindows)
             {
            // Options menu item
            Gtk.ImageMenuItem OptionsMenuItem = new ImageMenuItem("_Options...", agMenuAccel);
            OptionsMenuItem.Activated += new EventHandler(OptionsMenuItem_Activated);
            OptionsMenuItem.Image = new Gtk.Image(Stock.Preferences, IconSize.Menu);
            mnuTools.Append(OptionsMenuItem);
             }

             // Help About menu item
             MenuItem AboutMenuItem = new ImageMenuItem(Stock.About, agMenuAccel);
             AboutMenuItem.Activated += new EventHandler(AboutMenuItem_Activated);
             mnuHelp.Append(AboutMenuItem);

             // Add the menus to the menubar
             mbMain.Append(mnuFileItem);
             mbMain.Append(mnuEditItem);
             mbMain.Append(mnuToolsItem);
             mbMain.Append(mnuHelpItem);

             // Add the menubar to the Menu panel
             vbox.PackStart(mbMain, false, false, 0);

             #endregion

             // add items to container
             panelLeft.Pack1(leftFrame, true, false);

             // TLW
             //panelLeft.Pack2(tabControl, true, false);
             panelLeft.Pack2(panelRight, true, false);

             // set starting position of splitter
             panelLeft.Position = Core.GeneralSettings.WindowSearchPanelWidth;
             panelRight.Position = Core.GeneralSettings.WindowFilePanelHeight;

             vbox.PackStart(panelLeft, true, true, 0);
             vbox.PackEnd(sbStatus, false, true, 3);

             this.Add (vbox);

             this.ShowAll ();
        }
Exemplo n.º 44
0
        public ImageToolBarControl(ImageCanvas ic)
        {
            this.ic = ic;
            btnShowHideBarier = new ToggleToolButton("barier-show.png");//RadioToolButton(group1);//,"barier-show.png");
            btnShowHideBarier.Label = MainClass.Languages.Translate("show_barier_layer");
            btnShowHideBarier.Name = "btnShowHideBarier";
            //btnShowHideBarier.Relief = ReliefStyle.None;
            btnShowHideBarier.CanFocus = false;
            btnShowHideBarier.BorderWidth = 1;
            //btnShowHideBarier.WidthRequest = 75;
            btnShowHideBarier.TooltipText = MainClass.Languages.Translate("show_barier_layer_tt");

            btnShowHideBarier.Events = Gdk.EventMask.AllEventsMask;// | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask
            btnShowHideBarier.Toggled+= delegate(object sender, EventArgs e) {

                this.ic.ShowBarierLayer =  btnShowHideBarier.Active;
                SetSensitive(btnShowHideBarier.Active);
                //Console.WriteLine("btnShowHideBarier.Toggled");

            };

            btnEditBarierPoint =  new ToggleToolButton("barier-add.png");//new RadioToolButton(group2,"barier-add.png");
            btnEditBarierPoint.Name = "btnEditBarierPoint";
            btnEditBarierPoint.Label = MainClass.Languages.Translate("edit_barier_point");
            //btnEditBarierPoint.Relief = ReliefStyle.None;
            btnEditBarierPoint.CanFocus = false;
            btnEditBarierPoint.BorderWidth = 1;
            btnEditBarierPoint.TooltipText = MainClass.Languages.Translate("edit_barier_point_tt");
            btnEditBarierPoint.Toggled+= delegate(object sender, EventArgs e) {
                if(btnEditBarierPoint.Active){
                    btnDeleteBarierPoint.Active = false;
                    //btnMovieBarierPoint.Active = false;
                }
            };

            btnDeleteBarierPoint = new ToggleToolButton("barier-delete.png");//new RadioToolButton(group2,"barier-delete.png");
            btnDeleteBarierPoint.Name = "btnDeleteBarierPoint";
            btnDeleteBarierPoint.Label = MainClass.Languages.Translate("delete_barier_point");
            //btnDeleteBarierPoint.Relief = ReliefStyle.None;
            btnDeleteBarierPoint.CanFocus = false;
            btnDeleteBarierPoint.BorderWidth = 1;
            btnDeleteBarierPoint.TooltipText = MainClass.Languages.Translate("delete_barier_point_tt");
            btnDeleteBarierPoint.Toggled+= delegate(object sender, EventArgs e) {
                if(btnDeleteBarierPoint.Active){
                    btnEditBarierPoint.Active = false;
                    //btnAddBarierPoint.Active = false;
                    //btnMovieBarierPoint.Active = false;
                }
            };

            btnDeleteBarier = new ToolButton("barier-delete-all.png");
            btnDeleteBarier.Name = "btnDeleteBarier";

            btnDeleteBarier.Label =MainClass.Languages.Translate("delete_barier");
            btnDeleteBarier.CanFocus = false;
            btnDeleteBarier.BorderWidth = 1;
            btnDeleteBarier.TooltipText = MainClass.Languages.Translate("delete_barier_tt");
            btnDeleteBarier.Clicked += delegate(object sender, EventArgs e) {
                MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo, "", MainClass.Languages.Translate("delete_barier_question"), Gtk.MessageType.Question);
                int result = md.ShowDialog();

                if (result != (int)Gtk.ResponseType.Yes){
                    return;
                }

                if(DeleteBarierLayerEvent!= null)
                    DeleteBarierLayerEvent(null,null);

            };

            SetSensitive(false);

            this.Insert (btnShowHideBarier, 0);

            this.Insert (btnEditBarierPoint, 1);
            this.Insert (btnDeleteBarierPoint, 2);
            this.Insert (btnDeleteBarier, 3);

            Gtk.ToolButton btnZoomIn = new Gtk.ToolButton("zoom-in.png");
            btnZoomIn.Label = MainClass.Languages.Translate("zoom_in");
            btnZoomIn.TooltipText = MainClass.Languages.Translate("zoom_in");
            //btnZoomIn.Relief = Gtk.ReliefStyle.None;
            btnZoomIn.CanFocus = false;
            btnZoomIn.Clicked+= delegate {
                ZoomIn();
            };

            Gtk.ToolButton btnZoomOriginal = new Gtk.ToolButton("zoom-original.png");
            btnZoomOriginal.Label = MainClass.Languages.Translate("zoom_original");
            btnZoomOriginal.TooltipText = MainClass.Languages.Translate("zoom_original");
            //btnZoomOriginal.Relief = Gtk.ReliefStyle.None;
            btnZoomOriginal.CanFocus = false;
            btnZoomOriginal.Clicked+= delegate {
                cbeZoom.Active = 11;
            };
            //btnZoomOriginal.WidthRequest = btnZoomOriginal.HeightRequest = 19;

            Gtk.ToolButton btnZoomOut = new Gtk.ToolButton("zoom-out.png");
            btnZoomOut.TooltipText = MainClass.Languages.Translate("zoom_out");
            btnZoomOut.Label = MainClass.Languages.Translate("zoom_out");
            //btnZoomOut.Relief = Gtk.ReliefStyle.None;
            btnZoomOut.CanFocus = false;
            btnZoomOut.Clicked+= delegate {
                ZoomOut();

            };

            string[] zoomCollection = new string[] { "3600%", "2400%", "1600%", "1200%", "800%", "700%", "600%", "500%", "400%", "300%", "200%", "100%", "66%", "50%", "33%", "25%", "16%", "12%", "8%", "5%" };
            cbeZoom = new ComboBoxEntry(zoomCollection);
            cbeZoom.Active = 11;
            cbeZoom.WidthRequest = 70;
            cbeZoom.Changed+= delegate(object sender, EventArgs e) {
                UpdateScale();
            };

            cbeZoom.Entry.FocusOutEvent+= delegate(object o, FocusOutEventArgs args) {
                //Console.WriteLine("FocusOutEvent");
                UpdateScale();
            };

            cbeZoom.Entry.FocusInEvent+= delegate(object o, FocusInEventArgs args) {

            };
            cbeZoom.Entry.Changed+= delegate(object sender, EventArgs e) {

                //UpdateScale();
            };

            ToolItem tic = new ToolItem();
            tic.Add(cbeZoom);

            this.Insert(new SeparatorToolItem(),4);
            this.Insert(btnZoomIn,5);
            this.Insert(btnZoomOut,6);
            this.Insert(tic,7);
            this.Insert(btnZoomOriginal,8);
        }
Exemplo n.º 45
0
		FindInFilesDialog (bool showReplace)
		{
			this.showReplace = showReplace;
			Build ();
			Title = showReplace ? GettextCatalog.GetString ("Replace in Files") : GettextCatalog.GetString ("Find in Files");
			TransientFor = IdeApp.Workbench.RootWindow;
			if (!showReplace)
				buttonReplace.Destroy();

			if (showReplace) {
				tableFindAndReplace.NRows = 4;
				labelReplace = new Label {Text = GettextCatalog.GetString("_Replace:"), Xalign = 0f, UseUnderline = true};
				tableFindAndReplace.Add (labelReplace);

				comboboxentryReplace = new ComboBoxEntry ();
				tableFindAndReplace.Add (comboboxentryReplace);

				var childLabel = (Table.TableChild)tableFindAndReplace[labelReplace];
				childLabel.TopAttach = 1;
				childLabel.BottomAttach = 2;
				childLabel.XOptions = childLabel.YOptions = (AttachOptions)4;

				var childCombo = (Table.TableChild)tableFindAndReplace[comboboxentryReplace];
				childCombo.TopAttach = 1;
				childCombo.BottomAttach = 2;
				childCombo.LeftAttach = 1;
				childCombo.RightAttach = 2;
				childCombo.XOptions = childCombo.YOptions = (AttachOptions)4;

				childLabel = (Table.TableChild)tableFindAndReplace[labelScope];
				childLabel.TopAttach = 2;
				childLabel.BottomAttach = 3;

				childCombo = (Table.TableChild)tableFindAndReplace[hbox2];
				childCombo.TopAttach = 2;
				childCombo.BottomAttach = 3;

				childCombo = (Table.TableChild)tableFindAndReplace[labelFileMask];
				childCombo.TopAttach = 3;
				childCombo.BottomAttach = 4;

				childCombo = (Table.TableChild)tableFindAndReplace[searchentry1];
				childCombo.TopAttach = 3;
				childCombo.BottomAttach = 4;

				Child.ShowAll ();
			}

			comboboxentryFind.Entry.Activated += delegate { buttonSearch.Click (); };

			buttonReplace.Clicked += HandleReplaceClicked;
			buttonSearch.Clicked += HandleSearchClicked;
			buttonClose.Clicked += (sender, e) => Destroy ();
			DeleteEvent += (o, args) => Destroy ();
			buttonStop.Clicked += ButtonStopClicked;
			var scopeStore = new ListStore (typeof(string));
			scopeStore.AppendValues (GettextCatalog.GetString ("Whole solution"));
			scopeStore.AppendValues (GettextCatalog.GetString ("Current project"));
			scopeStore.AppendValues (GettextCatalog.GetString ("All open files"));
			scopeStore.AppendValues (GettextCatalog.GetString ("Directories"));
			scopeStore.AppendValues (GettextCatalog.GetString ("Current document"));
			scopeStore.AppendValues (GettextCatalog.GetString ("Selection"));
			
			comboboxScope.Model = scopeStore;
		
			comboboxScope.Changed += HandleScopeChanged;

			InitFromProperties ();

			if (IdeApp.Workbench.ActiveDocument != null) {
				var view = IdeApp.Workbench.ActiveDocument.GetContent<ITextBuffer> ();
				if (view != null) {
					string selectedText = view.SelectedText;
					if (!string.IsNullOrEmpty (selectedText)) {
						if (selectedText.Any (c => c == '\n' || c == '\r')) {
//							comboboxScope.Active = ScopeSelection; 
						} else {
							if (comboboxScope.Active == ScopeSelection)
								comboboxScope.Active = ScopeCurrentDocument;
							comboboxentryFind.Entry.Text = selectedText;
						}
					} else if (comboboxScope.Active == ScopeSelection) {
						comboboxScope.Active = ScopeCurrentDocument;
					}
					
				}
			}
			comboboxentryFind.Entry.SelectRegion (0, comboboxentryFind.ActiveText.Length);
			
			DeleteEvent += delegate { Destroy (); };
			UpdateStopButton ();
			searchentry1.Ready = true;
			searchentry1.Visible = true;
			searchentry1.IsCheckMenu = true;
			
			var properties = PropertyService.Get ("MonoDevelop.FindReplaceDialogs.SearchOptions", new Properties ());
			
			CheckMenuItem checkMenuItem = searchentry1.AddFilterOption (0, GettextCatalog.GetString ("Include binary files"));
			checkMenuItem.DrawAsRadio = false;
			checkMenuItem.Active = properties.Get ("IncludeBinaryFiles", false);
			checkMenuItem.Toggled += delegate {
				properties.Set ("IncludeBinaryFiles", checkMenuItem.Active);
			};
			
			CheckMenuItem checkMenuItem1 = searchentry1.AddFilterOption (1, GettextCatalog.GetString ("Include hidden files and directories"));
			checkMenuItem1.DrawAsRadio = false;
			checkMenuItem1.Active = properties.Get ("IncludeHiddenFiles", false);
			checkMenuItem1.Toggled += delegate {
				properties.Set ("IncludeHiddenFiles", checkMenuItem1.Active);
			};
			
			Child.Show ();
		}
Exemplo n.º 46
0
		void HideDirectoryPathUI ()
		{
			if (labelPath == null)
				return;
			
			uint row = TableGetRowForItem (tableFindAndReplace, checkbuttonRecursively);
			TableRemoveRow (tableFindAndReplace, row, null, checkbuttonRecursively, true);
			checkbuttonRecursively = null;
			
			row = TableGetRowForItem (tableFindAndReplace, labelPath);
			TableRemoveRow (tableFindAndReplace, row, labelPath, hboxPath, true);
			// comboboxentryPath and buttonBrowsePaths are destroyed with hboxPath
			buttonBrowsePaths = null;
			comboboxentryPath = null;
			labelPath = null;
			hboxPath = null;
		}
Exemplo n.º 47
0
		static void StoreHistory (string propertyName, ComboBoxEntry comboBox)
		{
			var store = (ListStore)comboBox.Model;
			var history = new List<string> ();
			TreeIter iter;
			if (store.GetIterFirst (out iter)) {
				do {
					history.Add ((string)store.GetValue (iter, 0));
				} while (store.IterNext (ref iter));
			}
			const int limit = 20;
			if (history.Count > limit) {
				history.RemoveRange (history.Count - (history.Count - limit), history.Count - limit);
			}
			if (history.Contains (comboBox.Entry.Text))
				history.Remove (comboBox.Entry.Text);
			history.Insert (0, comboBox.Entry.Text);
			PropertyService.Set (propertyName, string.Join (historySeparator.ToString (), history.ToArray ()));
		}
Exemplo n.º 48
0
        /// <summary>
        /// Setup controls based on selected category.
        /// </summary>
        /// <param name="sender">system parameter</param>
        /// <param name="e">system parameter</param>
        /// <history>
        /// [Curtis_Beard]	   11/11/2014	CHG: use FilterItem
        /// </history>
        private void cboCategories_SelectedIndexChanged(object sender, EventArgs e)
        {
            cboTypes.Items.Clear();
             cboTypes.DisplayMember = "DisplayName";
             cboOptions.Items.Clear();
             chkIgnoreCase.Checked = false;
             fvtValue.ResetValue();

             if (cboCategories.SelectedIndex == cboCategories.FindStringExact(Language.GetGenericText("Exclusions." + FilterType.Categories.File.ToString())))
             {
            var fileList = from l in defaultFilterTypes where l.Category == FilterType.Categories.File select l;
            foreach (var entry in fileList)
            {
               ComboBoxEntry cbEntry = new ComboBoxEntry();
               cbEntry.DisplayName = Language.GetGenericText("Exclusions." + entry.SubCategory.ToString());
               cbEntry.ValueName = entry.SubCategory.ToString();
               cbEntry.Value = entry;
               cboTypes.Items.Add(cbEntry);
            }
             }
             else if (cboCategories.SelectedIndex == cboCategories.FindStringExact(Language.GetGenericText("Exclusions." + FilterType.Categories.Directory.ToString())))
             {
            var dirList = from l in defaultFilterTypes where l.Category == FilterType.Categories.Directory select l;
            foreach (var entry in dirList)
            {
               ComboBoxEntry cbEntry = new ComboBoxEntry();
               cbEntry.DisplayName = Language.GetGenericText("Exclusions." + entry.SubCategory.ToString());
               cbEntry.ValueName = entry.SubCategory.ToString();
               cbEntry.Value = entry;
               cboTypes.Items.Add(cbEntry);
            }
             }
        }
Exemplo n.º 49
0
        public NavigationBar(NavigationType navigationType)
        {
            this.navigationType = navigationType;
            cbeNavigation = new ComboBoxEntry();
            cbeNavigation.Entry.Completion = new EntryCompletion ();

            cbeNavigation.Entry.KeyReleaseEvent += cbeNavigationKeyReleas;

            cbeNavigation.Events = EventMask.AllEventsMask;

            cbeNavigation.Entry.Completion.Model = navigationStore;
            cbeNavigation.Model = navigationStore;
            cbeNavigation.Entry.ActivatesDefault = true;
            cbeNavigation.TextColumn = 0;

            IList<RecentFile> lRecentProjects;
            switch (this.navigationType)
            {
               case NavigationType.favorites:
                lRecentProjects = MainClass.Settings.RecentFiles.GetFavorite();
                break;
               case NavigationType.libs:
                lRecentProjects = MainClass.Settings.FavoriteFiles.GetLibsFavorite();
                break;
               case NavigationType.publish:
                lRecentProjects = MainClass.Settings.FavoriteFiles.GetPublishFavorite();
                break;
               case NavigationType.emulator:
                lRecentProjects = MainClass.Settings.FavoriteFiles.GetEmulatorFavorite();
                break;
               default:
                  	lRecentProjects = MainClass.Settings.RecentFiles.GetFavorite();
                break;
            }

                //= this.recentFiles.GetFavorite();//MainClass.Settings.RecentFiles.GetFavorite();
            foreach(RecentFile rf in lRecentProjects){
                navigationStore.AppendValues(rf.FileName);

            }
            cbeNavigation.Changed+= cbeNavigationChanged;

            pixbufYes = null;
            string fileYes = System.IO.Path.Combine(MainClass.Paths.ResDir, "starSelect.png");
            string fileNo = System.IO.Path.Combine(MainClass.Paths.ResDir, "starUnselect.png");

            if (System.IO.File.Exists(fileYes)) {
                pixbufYes = new Pixbuf(fileYes);
                btnFavorite = new Button(new Gtk.Image(pixbufYes));
            }
            if (System.IO.File.Exists(fileNo)) {
                pixbufNo = new Pixbuf(fileNo);
                btnFavorite = new Button(new Gtk.Image(pixbufNo));
            } else {
                btnFavorite = new Button();
            }

            btnFavorite.TooltipText = MainClass.Languages.Translate("close");
            btnFavorite.Relief = ReliefStyle.None;
            btnFavorite.CanFocus = false;
            btnFavorite.WidthRequest = btnFavorite.HeightRequest =24;

            btnFavorite.Clicked+= btnFavoriteClick;

            PackEnd (cbeNavigation, true, true, 0);
            PackStart (btnFavorite, false, false, 0);
        }
Exemplo n.º 50
0
		void Build ()
		{
			DefaultWidth = 470;
			DefaultHeight = 380;
			BorderWidth = 6;
			Resizable = false;

			VBox.Spacing = 6;

			buttonCancel = new Button (Gtk.Stock.Cancel);
			AddActionWidget (buttonCancel, ResponseType.Cancel);
			buttonOk = new Button (Gtk.Stock.Ok);
			AddActionWidget (buttonOk, ResponseType.Ok);

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

			nameEntry = new Entry { WidthRequest = 350 };
			viewEngineCombo = ComboBox.NewText ();
			templateCombo = ComboBox.NewText ();

			var nameLabel = new Label (GettextCatalog.GetString ("_Name")) {
				MnemonicWidget = nameEntry,
				Xalign = 0
			};
			var templateLabel = new Label (GettextCatalog.GetString ("_Template:")) {
				MnemonicWidget = nameEntry,
				Xalign = 0
			};
			var engineLabel = new Label (GettextCatalog.GetString ("_View Engine:")) {
				MnemonicWidget = nameEntry,
				Xalign = 0
			};

			const AttachOptions expandFill = AttachOptions.Expand | AttachOptions.Fill;
			const AttachOptions fill = AttachOptions.Fill;

			table.Attach (nameLabel,       0, 1, 0, 1, fill,       0, 0, 0);
			table.Attach (nameEntry,       1, 2, 0, 1, expandFill, 0, 0, 0);
			table.Attach (templateLabel,   0, 1, 1, 2, fill,       0, 0, 0);
			table.Attach (templateCombo,   1, 2, 1, 2, expandFill, 0, 0, 0);
			table.Attach (engineLabel,     0, 1, 2, 3, fill,       0, 0, 0);
			table.Attach (viewEngineCombo, 1, 2, 2, 3, expandFill, 0, 0, 0);

			VBox.PackStart (table, false, false, 0);

			var frame = new Frame (GettextCatalog.GetString ("Options")) { BorderWidth = 2 };
			var optionsVBox = new VBox { Spacing = 6 };
			var optionsAlignment = new Alignment (0.5f, 0.5f, 1f, 1f) {
				Child = optionsVBox,
				TopPadding = 4,
				BottomPadding = 4,
				RightPadding = 4,
				LeftPadding = 4
			};
			frame.Add (optionsAlignment);

			partialCheck = new CheckButton (GettextCatalog.GetString ("_Partial view")) { UseUnderline = true };
			stronglyTypedCheck = new CheckButton (GettextCatalog.GetString ("_Strongly typed")) { UseUnderline = true };
			masterCheck = new CheckButton (GettextCatalog.GetString ("Has _master page or layout")) { UseUnderline = true };

			dataClassCombo = ComboBoxEntry.NewText ();
			masterEntry = new Entry { WidthRequest = 250 };
			placeholderCombo = ComboBoxEntry.NewText ();
			masterButton = new Button ("...");

			optionsVBox.PackStart (partialCheck);
			optionsVBox.PackStart (stronglyTypedCheck);
			typePanel = WithLabelAndLeftPadding (dataClassCombo, GettextCatalog.GetString ("_Data class:"), true, 24);
			optionsVBox.PackStart (typePanel);
			optionsVBox.PackStart (masterCheck);


			var masterLabel = new Label (GettextCatalog.GetString ("_File:")) {
				MnemonicWidget = masterEntry,
				Xalign = 0,
				UseUnderline = true
			};

			placeholderLabel = new Label (GettextCatalog.GetString ("P_rimary placeholder:")) {
				MnemonicWidget = placeholderCombo,
				Xalign = 0,
				UseUnderline = true
			};

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

			masterTable.Attach (masterLabel,      0, 1, 0, 1, fill,       0, 0, 0);
			masterTable.Attach (masterEntry,      1, 3, 0, 1, expandFill, 0, 0, 0);
			masterTable.Attach (placeholderLabel, 0, 1, 1, 2, expandFill, 0, 0, 0);
			masterTable.Attach (placeholderCombo, 1, 2, 1, 2, fill,       0, 0, 0);
			masterTable.Attach (masterButton,     2, 3, 1, 2, fill,       0, 0, 0);

			masterPanel = new Alignment (0.5f, 0.5f, 1f, 1f) { LeftPadding = 24, Child = masterTable };
			optionsVBox.PackStart (masterPanel);

			VBox.PackStart (frame, false, false, 0);

			Child.ShowAll ();

			viewEngineCombo.Changed += ViewEngineChanged;
			templateCombo.Changed += Validate;
			nameEntry.Changed += Validate;
			partialCheck.Toggled += UpdateMasterPanelSensitivity;
			stronglyTypedCheck.Toggled += UpdateTypePanelSensitivity;
			dataClassCombo.Changed += DataClassChanged;
			masterCheck.Toggled += UpdateMasterPanelSensitivity;
			masterEntry.Changed += MasterChanged;
			masterButton.Clicked += ShowMasterSelectionDialog;
			placeholderCombo.Changed += Validate;

		}
Exemplo n.º 51
0
 private void SelIterCmb(ComboBoxEntry cmb, string itemtoselect)
 {
     Boolean isSelected = false;
     TreeIter cmbiter;
     cmb.Model.GetIterFirst (out cmbiter);
     do {
         GLib.Value value = new GLib.Value();
         cmb.Model.GetValue(cmbiter,0,ref value);
         if ((value.Val as string).Equals(itemtoselect, StringComparison.CurrentCultureIgnoreCase)){
             cmb.SetActiveIter(cmbiter);
             isSelected = true;
         }
     } while (cmb.Model.IterNext(ref cmbiter));
     if (!isSelected) {
         cmb.AppendText (itemtoselect);
         this.SelIterCmb (cmb, itemtoselect);
     }
 }
Exemplo n.º 52
0
 // Version 1.0.0
 public static void SetText(ComboBoxEntry cbWidget, string strText)
 {
     cbWidget.InsertText(0, strText);
     cbWidget.Active = 0;
 }
Exemplo n.º 53
0
 private Widget CreateiFolderActionButtonArea()
 {
     EventBox buttonArea = new EventBox();
        VBox actionsVBox = new VBox(false, 0);
        actionsVBox.WidthRequest = 100;
        buttonArea.ModifyBg(StateType.Normal, this.Style.Background(StateType.Normal));
        buttonArea.Add(actionsVBox);
        buttontips = new Tooltips();
     HBox ButtonControl = new HBox (false, 0);
        actionsVBox.PackStart(ButtonControl, false, false, 0);
        Image stopImage = new Image(Stock.Stop, Gtk.IconSize.Menu);
        stopImage.SetAlignment(0.5F, 0F);
        CancelSearchButton = new Button(stopImage);
        CancelSearchButton.Sensitive = false;
        CancelSearchButton.Clicked +=
     new EventHandler(OnCancelSearchButton);
        CancelSearchButton.Visible = false;
        HBox spacerHBox = new HBox(false, 0);
        ButtonControl.PackStart(spacerHBox, false, false, 0);
        HBox vbox = new HBox(false, 0);
        spacerHBox.PackStart(vbox, true, true, 0);
        HBox hbox = new HBox(false, 0);
        AddiFolderButton = new Button(hbox);
        vbox.PackStart(AddiFolderButton, false, false, 0);
        Label buttonText = new Label(
     string.Format("<span>{0}</span>",
      Util.GS("Upload a folder...")));
        hbox.PackStart(buttonText, false, false, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        AddiFolderButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("ifolder48.png")));
        AddiFolderButton.Clicked +=
     new EventHandler(AddiFolderHandler);
        buttontips.SetTip(AddiFolderButton, Util.GS("Create iFolder"),"");
        hbox = new HBox(false, 0);
        ShowHideAllFoldersButton = new Button(hbox);
        vbox.PackStart(ShowHideAllFoldersButton, false, false, 0);
        ShowHideAllFoldersButtonText = new Label(
     string.Format("<span>{0}</span>",
      Util.GS("View available iFolders")));
        hbox.PackStart(ShowHideAllFoldersButtonText, false, false, 4);
        ShowHideAllFoldersButtonText.UseMarkup = true;
        ShowHideAllFoldersButtonText.UseUnderline = false;
        ShowHideAllFoldersButtonText.Xalign = 0;
        ShowHideAllFoldersButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("ifolder48.png")));
        ShowHideAllFoldersButton.Clicked +=
     new EventHandler(ShowHideAllFoldersHandler);
        buttontips.SetTip(ShowHideAllFoldersButton, Util.GS("Show or Hide iFolder"),"");
        hbox = new HBox(false, 0);
        DownloadAvailableiFolderButton = new Button(hbox);
        vbox.PackStart(DownloadAvailableiFolderButton, false, false, 0);
        buttonText = new Label(
     string.Format("<span>{0}</span>",
      Util.GS("Download...")));
        hbox.PackStart(buttonText, true, true, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        DownloadAvailableiFolderButton.Sensitive = false;
        DownloadAvailableiFolderButton.Image= new Image(new Gdk.Pixbuf(Util.ImagesPath("ifolder-download48.png")));
        DownloadAvailableiFolderButton.Clicked +=
     new EventHandler(DownloadAvailableiFolderHandler);
        buttontips.SetTip(DownloadAvailableiFolderButton, Util.GS("Download"),"");
        hbox = new HBox(false, 0);
        MergeAvailableiFolderButton = new Button(hbox);
        vbox.PackStart(MergeAvailableiFolderButton, false, false, 0);
        buttonText = new Label(
     string.Format("<span>{0}</span>",
      Util.GS("Merge")));
        hbox.PackStart(buttonText, true, true, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        MergeAvailableiFolderButton.Sensitive = false;
        MergeAvailableiFolderButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("merge48.png")));
        MergeAvailableiFolderButton.Clicked +=
     new EventHandler(MergeAvailableiFolderHandler);
        buttontips.SetTip(MergeAvailableiFolderButton, Util.GS("Merge"),"");
        hbox = new HBox(false, 0);
        RemoveMembershipButton = new Button(hbox);
        vbox.PackStart(RemoveMembershipButton, false, false, 0);
        buttonText = new Label(
     string.Format("<span>{0}</span>",
      Util.GS("Remove My Membership")));
        hbox.PackStart(buttonText, true, true, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        RemoveMembershipButton.Sensitive = false;
        RemoveMembershipButton.Visible = false;
        RemoveMembershipButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("ifolder-error48.png")));
        RemoveMembershipButton.Clicked += new EventHandler(RemoveMembershipHandler);
        buttontips.SetTip(RemoveMembershipButton, Util.GS("Remove My Membership"),"");
        hbox = new HBox(false, 0);
        DeleteFromServerButton = new Button(hbox);
        vbox.PackStart(DeleteFromServerButton, false, false, 0);
        buttonText = new Label(
     string.Format("<span>{0}</span>",
      Util.GS("Delete from server")));
        hbox.PackStart(buttonText, true, true, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        DeleteFromServerButton.Sensitive = false;
        DeleteFromServerButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("delete_48.png")));
        DeleteFromServerButton.Clicked +=
     new EventHandler(DeleteFromServerHandler);
        buttontips.SetTip(DeleteFromServerButton, Util.GS("Delete from server"),"");
        hbox = new HBox(false, 0);
        ShareSynchronizedFolderButton = new Button(hbox);
        vbox.PackStart(ShareSynchronizedFolderButton, false, false, 0);
        buttonText = new Label(
     string.Format("<span>{0}</span>",
      Util.GS("Share with...")));
        hbox.PackStart(buttonText, true, true, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        ShareSynchronizedFolderButton.Sensitive= false;
       ShareSynchronizedFolderButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("ifolder_share48.png")));
        ShareSynchronizedFolderButton.Clicked +=
     new EventHandler(OnShareSynchronizedFolder);
        buttontips.SetTip(ShareSynchronizedFolderButton, Util.GS("Share with"),"");
        hbox = new HBox(false, 0);
        ResolveConflictsButton = new Button(hbox);
        vbox.PackStart(ResolveConflictsButton, false, false, 0);
        buttonText = new Label(
     string.Format("<span>{0}</span>",
      Util.GS("Resolve conflicts...")));
        hbox.PackStart(buttonText, false, false, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        ResolveConflictsButton.Sensitive = false;
        ResolveConflictsButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("ifolder-conflict48.png")));
        ResolveConflictsButton.Clicked +=
     new EventHandler(OnResolveConflicts);
        buttontips.SetTip(ResolveConflictsButton, Util.GS("Resolve conflicts"),"");
        SynchronizedFolderTasks = new VBox(false, 0);
        ButtonControl.PackStart(SynchronizedFolderTasks, false, false, 0);
        spacerHBox = new HBox(false, 0);
        SynchronizedFolderTasks.PackStart(spacerHBox, false, false, 0);
        hbox = new HBox(false, 0);
        OpenSynchronizedFolderButton = new Button(hbox);
        vbox.PackStart(OpenSynchronizedFolderButton, false, false, 0);
        buttonText = new Label(
     string.Format("<span>{0}</span>",
      Util.GS("Open...")));
        hbox.PackStart(buttonText, false, false, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        OpenSynchronizedFolderButton.Visible = false;
        OpenSynchronizedFolderButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("ifolder48.png")));
        OpenSynchronizedFolderButton.Clicked +=
     new EventHandler(OnOpenSynchronizedFolder);
        buttontips.SetTip(OpenSynchronizedFolderButton, Util.GS("Open iFolder"),"");
        hbox = new HBox(false, 0);
        SynchronizeNowButton = new Button(hbox);
        vbox.PackStart(SynchronizeNowButton, false, false, 0);
        buttonText = new Label(
     string.Format("<span>{0}</span>",
      Util.GS("Synchronize Now")));
        hbox.PackStart(buttonText, true, true, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        SynchronizeNowButton.Sensitive = false;
       SynchronizeNowButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("ifolder-sync48.png")));
        SynchronizeNowButton.Clicked +=
     new EventHandler(OnSynchronizeNow);
        buttontips.SetTip(SynchronizeNowButton, Util.GS("Synchronize Now"),"");
        hbox = new HBox(false, 0);
        RemoveiFolderButton = new Button(hbox);
        vbox.PackStart(RemoveiFolderButton, false, false, 0);
        buttonText = new Label(
     string.Format("<span>{0}</span>",
      Util.GS("Revert to a Normal Folder")));
        hbox.PackStart(buttonText, true, true, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        RemoveiFolderButton.Sensitive = false;
        RemoveiFolderButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("revert48.png")));
        RemoveiFolderButton.Clicked +=
     new EventHandler(RemoveiFolderHandler);
        buttontips.SetTip(RemoveiFolderButton, Util.GS("Revert to a Normal Folder"),"");
        hbox = new HBox(false, 0);
        ViewFolderPropertiesButton = new Button(hbox);
        vbox.PackStart(ViewFolderPropertiesButton, false, false, 0);
        buttonText = new Label(
     string.Format("<span>{0}</span>",
      Util.GS("Properties...")));
        hbox.PackStart(buttonText, true, true, 4);
        buttonText.UseMarkup = true;
        buttonText.UseUnderline = false;
        buttonText.Xalign = 0;
        ViewFolderPropertiesButton.Visible = false;
        ViewFolderPropertiesButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("ifolder48.png")));
        ViewFolderPropertiesButton.Clicked +=
     new EventHandler(OnShowFolderProperties);
        buttontips.SetTip(ViewFolderPropertiesButton, Util.GS("Properties"),"");
        ButtonControl.PackStart(new Label(""), false, false, 4);
        HBox searchHBox = new HBox(false, 4);
        searchHBox.WidthRequest = 110;
        ButtonControl.PackEnd(searchHBox, false, false, 0);
        SearchEntry = new Entry();
        searchHBox.PackStart(SearchEntry, true, true, 0);
        SearchEntry.SelectRegion(0, -1);
        SearchEntry.CanFocus = true;
        SearchEntry.Changed +=
     new EventHandler(OnSearchEntryChanged);
        Label l = new Label("<span size=\"small\"></span>");
        l = new Label(
     string.Format(
      "<span size=\"large\">{0}</span>",
      Util.GS("Filter")));
        ButtonControl.PackEnd(l, false, false, 0);
        l.UseMarkup = true;
        l.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
        l.Xalign = 0.0F;
       VBox viewChanger = new VBox(false,0);
        string[] list = {Util.GS("Open Panel"),Util.GS("Close Panel"),Util.GS("Thumbnail View"),Util.GS("List View") };
       viewList = new ComboBoxEntry (list);
        viewList.Active = 0;
        viewList.WidthRequest = 110;
        viewList.Changed += new EventHandler(OnviewListIndexChange);
        VBox dummyVbox = new VBox(false,0);
       Label labeldummy = new Label( string.Format( ""));
       labeldummy.UseMarkup = true;
        dummyVbox.PackStart(labeldummy,false,true,0);
        viewChanger.PackStart(dummyVbox,false,true,0);
        viewChanger.PackStart(viewList,false,true,0);
        ButtonControl.PackEnd(viewChanger, false, true,0);
        return buttonArea;
 }
Exemplo n.º 54
0
            public GameEditor(GameViewer viewer)
                : base(Catalog.
								    GetString
								    ("Rating"))
            {
                this.viewer = viewer;
                viewer.ChessGameWidget.GameLoadedEvent +=
                    OnGameLoaded;
                combo = new ComboBox (new string[]
                              {
                              Catalog.
                              GetString
                              ("Not interested"),
                              Catalog.
                              GetString
                              ("Average Game"),
                              Catalog.
                              GetString ("Good Game"),
                              Catalog.
                              GetString
                              ("Excellent Game"),
                              Catalog.
                              GetString ("Must Have")}
                );
                save = new Button (Stock.Save);
                save.Sensitive = false;
                save.Clicked += OnSave;
                combo.Changed +=
                    delegate (object o, EventArgs args)
                {
                    save.Sensitive = true;
                };

                ratings = new GameRating[]
                {
                GameRating.Ignore,
                        GameRating.Average,
                        GameRating.Good,
                        GameRating.Excellent,
                        GameRating.MustHave};
                tagsStore = new ListStore (typeof (string));
                tagsCombo = new ComboBoxEntry (tagsStore, 0);
                tagsCombo.Entry.Activated +=
                    OnTagsComboActivated;

                Table table = new Table (3, 2, false);
                table.RowSpacing = 2;
                table.ColumnSpacing = 2;
                uint row = 0, col = 0;
                Label label =
                    new Label (Catalog.
                           GetString ("My Rating"));
                label.Xalign = 0;
                label.Yalign = 0;
                table.Attach (label, col, col + 1, row,
                          row + 1);
                col++;
                table.Attach (combo, col, col + 1, row,
                          row + 1);

                label = new Label (Catalog.
                           GetString ("Tags"));
                label.Xalign = 0;
                label.Yalign = 0;
                col = 0;
                row++;
                table.Attach (label, col, col + 1, row,
                          row + 1);
                col++;
                table.Attach (tagsCombo, col, col + 1, row,
                          row + 1);

                col = 1;
                row++;
                Alignment align = new Alignment (1, 0, 0, 0);
                align.Add (save);
                table.Attach (align, col, col + 1, row,
                          row + 1);

                Add (table);

                ShowAll ();
            }
Exemplo n.º 55
0
		static void LoadHistory (string propertyName, ComboBoxEntry entry)
		{
			entry.Entry.Completion = new EntryCompletion ();
			var store = new ListStore (typeof(string));
			entry.Entry.Completion.Model = store;
			entry.Model = store;
			entry.Entry.ActivatesDefault = true;
			entry.TextColumn = 0;
			var history = PropertyService.Get<string> (propertyName);
			if (!string.IsNullOrEmpty (history)) {
				string[] items = history.Split (historySeparator);
				foreach (string item in items) {
					if (string.IsNullOrEmpty (item))
						continue;
					store.AppendValues (item);
				}
				entry.Entry.Text = items[0];
			}
		}
Exemplo n.º 56
0
        /// <summary>
        /// Setup controls based on selected type.
        /// </summary>
        /// <param name="sender">system parameter</param>
        /// <param name="e">system parameter</param>
        /// <history>
        /// [Curtis_Beard]	   03/07/2012	ADD: 3131609, exclusions
        /// [Curtis_Beard]	   08/13/2014	ADD: 78, add binary files exclusion
        /// [Curtis_Beard]	   11/11/2014	CHG: use FilterItem
        /// </history>
        private void cboTypes_SelectedIndexChanged(object sender, EventArgs e)
        {
            var cboItem = cboTypes.SelectedItem as ComboBoxEntry;
             var et = cboItem.Value as FilterType;

             // default value field to string and clear values
             fvtValue.SetViewType(FilterValueType.ViewTypes.String);
             fvtValue.ResetValue();

             // set ignore case checkbox
             chkIgnoreCase.Checked = false;
             chkIgnoreCase.Enabled = et.SupportsIgnoreCase;

             // setup options drop down
             cboOptions.Items.Clear();
             cboOptions.DisplayMember = "DisplayName";
             if (et.SupportedValueOptions == null || (et.SupportedValueOptions.Count == 1 && et.SupportedValueOptions[0] == FilterType.ValueOptions.None))
             {
            cboOptions.Enabled = false;
             }
             else
             {
            cboOptions.Enabled = true;
            foreach (var item in et.SupportedValueOptions)
            {
               ComboBoxEntry entry = new ComboBoxEntry();
               entry.DisplayName = Language.GetGenericText(string.Format("Exclusions.{0}", item));
               entry.ValueName = item.ToString();
               cboOptions.Items.Add(entry);
            }
             }

             // set value type/view
             switch (et.ValueType)
             {
            case FilterType.ValueTypes.Null:
               fvtValue.Enabled = false;
               fvtValue.SetViewType(FilterValueType.ViewTypes.String);
               break;

            case FilterType.ValueTypes.String:
               fvtValue.Enabled = true;
               fvtValue.SetViewType(FilterValueType.ViewTypes.String);
               break;

            case FilterType.ValueTypes.DateTime:
               fvtValue.Enabled = true;
               fvtValue.SetViewType(FilterValueType.ViewTypes.DateTime);
               break;

            case FilterType.ValueTypes.Long:
               fvtValue.Enabled = true;
               fvtValue.SetViewType(FilterValueType.ViewTypes.Numeric);
               break;

            case FilterType.ValueTypes.Size:
               fvtValue.Enabled = true;
               fvtValue.SetViewType(FilterValueType.ViewTypes.Size);
               break;
             }
        }
Exemplo n.º 57
0
		void HandleScopeChanged (object sender, EventArgs e)
		{
			if (hboxPath != null) {
				// comboboxentryPath and buttonBrowsePaths are destroyed with hboxPath
				foreach (Widget w in new Widget[] {
					labelPath,
					hboxPath,
					checkbuttonRecursively
				}) {
					tableFindAndReplace.Remove (w);
					w.Destroy ();
				}
				labelPath = null;
				hboxPath = null;
				comboboxentryPath = null;
				buttonBrowsePaths = null;
				checkbuttonRecursively = null;

				//tableFindAndReplace.NRows = showReplace ? 4u : 3u;

				var childCombo = (Table.TableChild)tableFindAndReplace[labelFileMask];
				childCombo.TopAttach = tableFindAndReplace.NRows - 3;
				childCombo.BottomAttach = tableFindAndReplace.NRows - 2;

				childCombo = (Table.TableChild)tableFindAndReplace[searchentry1];
				childCombo.TopAttach = tableFindAndReplace.NRows - 3;
				childCombo.BottomAttach = tableFindAndReplace.NRows - 2;
			}

			if (comboboxScope.Active == ScopeDirectories) {
				// DirectoryScope
				tableFindAndReplace.NRows = showReplace ? 6u : 5u;
				labelPath = new Label {
					LabelProp = GettextCatalog.GetString("_Path:"),
					UseUnderline = true, 
					Xalign = 0f
				};

				tableFindAndReplace.Add (labelPath);

				var childCombo = (Table.TableChild)tableFindAndReplace[labelPath];
				childCombo.TopAttach = tableFindAndReplace.NRows - 3;
				childCombo.BottomAttach = tableFindAndReplace.NRows - 2;
				childCombo.XOptions = childCombo.YOptions = (AttachOptions)4;

				hboxPath = new HBox ();
				var properties = PropertyService.Get ("MonoDevelop.FindReplaceDialogs.SearchOptions", new Properties ());
				comboboxentryPath = new ComboBoxEntry ();
				comboboxentryPath.Destroyed += ComboboxentryPathDestroyed;
				LoadHistory ("MonoDevelop.FindReplaceDialogs.PathHistory", comboboxentryPath);
				hboxPath.PackStart (comboboxentryPath);

				labelPath.MnemonicWidget = comboboxentryPath;

				var boxChild = (Box.BoxChild)hboxPath[comboboxentryPath];
				boxChild.Position = 0;
				boxChild.Expand = boxChild.Fill = true;

				buttonBrowsePaths = new Button { Label = "..." };
				buttonBrowsePaths.Clicked += ButtonBrowsePathsClicked;
				hboxPath.PackStart (buttonBrowsePaths);
				boxChild = (Box.BoxChild)hboxPath[buttonBrowsePaths];
				boxChild.Position = 1;
				boxChild.Expand = boxChild.Fill = false;

				tableFindAndReplace.Add (hboxPath);
				childCombo = (Table.TableChild)tableFindAndReplace[hboxPath];
				childCombo.TopAttach = tableFindAndReplace.NRows - 3;
				childCombo.BottomAttach = tableFindAndReplace.NRows - 2;
				childCombo.LeftAttach = 1;
				childCombo.RightAttach = 2;
				childCombo.XOptions = childCombo.YOptions = (AttachOptions)4;

				checkbuttonRecursively = new CheckButton {
					Label = GettextCatalog.GetString ("Re_cursively"),
					Active = properties.Get ("SearchPathRecursively", true),
					UseUnderline = true
				};

				checkbuttonRecursively.Destroyed += CheckbuttonRecursivelyDestroyed;
				tableFindAndReplace.Add (checkbuttonRecursively);
				childCombo = (Table.TableChild)tableFindAndReplace[checkbuttonRecursively];
				childCombo.TopAttach = tableFindAndReplace.NRows - 2;
				childCombo.BottomAttach = tableFindAndReplace.NRows - 1;
				childCombo.LeftAttach = 1;
				childCombo.RightAttach = 2;
				childCombo.XOptions = childCombo.YOptions = (AttachOptions)4;

				childCombo = (Table.TableChild)tableFindAndReplace[labelFileMask];
				childCombo.TopAttach = tableFindAndReplace.NRows - 1;
				childCombo.BottomAttach = tableFindAndReplace.NRows;

				childCombo = (Table.TableChild)tableFindAndReplace[searchentry1];
				childCombo.TopAttach = tableFindAndReplace.NRows - 1;
				childCombo.BottomAttach = tableFindAndReplace.NRows;
			}
			Requisition req = SizeRequest ();
			Resize (req.Width, req.Height);
			//	this.QueueResize ();
			ShowAll ();
		}
Exemplo n.º 58
0
        public StationEditor (DatabaseTrackInfo track) : base()
        {
            AccelGroup accel_group = new AccelGroup ();
            AddAccelGroup (accel_group);

            Title = String.Empty;
            SkipTaskbarHint = true;
            Modal = true;

            this.track = track;

            string title = track == null
                ? Catalog.GetString ("Add new radio station")
                : Catalog.GetString ("Edit radio station");

            BorderWidth = 6;
            HasSeparator = false;
            DefaultResponse = ResponseType.Ok;
            Modal = true;

            VBox.Spacing = 6;

            HBox split_box = new HBox ();
            split_box.Spacing = 12;
            split_box.BorderWidth = 6;

            Image image = new Image ();
            image.IconSize = (int)IconSize.Dialog;
            image.IconName = "radio";
            image.Yalign = 0.0f;
            image.Show ();

            VBox main_box = new VBox ();
            main_box.BorderWidth = 5;
            main_box.Spacing = 10;

            Label header = new Label ();
            header.Markup = String.Format ("<big><b>{0}</b></big>", GLib.Markup.EscapeText (title));
            header.Xalign = 0.0f;
            header.Show ();

            Label message = new Label ();
            message.Text = Catalog.GetString ("Enter the Genre, Title and URL of the radio station you wish to add. A description is optional.");
            message.Xalign = 0.0f;
            message.Wrap = true;
            message.Show ();

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

            genre_entry = ComboBoxEntry.NewText ();

            foreach (string genre in ServiceManager.DbConnection.QueryEnumerable<string> ("SELECT DISTINCT Genre FROM CoreTracks ORDER BY Genre")) {
                if (!String.IsNullOrEmpty (genre)) {
                    genre_entry.AppendText (genre);
                }
            }

            if (track != null && !String.IsNullOrEmpty (track.Genre)) {
                genre_entry.Entry.Text = track.Genre;
            }

            AddRow (Catalog.GetString ("Station Genre:"), genre_entry);

            name_entry        = AddEntryRow (Catalog.GetString ("Station Name:"));
            stream_entry      = AddEntryRow (Catalog.GetString ("Stream URL:"));
            creator_entry     = AddEntryRow (Catalog.GetString ("Station Creator:"));
            description_entry = AddEntryRow (Catalog.GetString ("Description:"));

            rating_entry = new RatingEntry ();
            HBox rating_box = new HBox ();
            rating_box.PackStart (rating_entry, false, false, 0);
            AddRow (Catalog.GetString ("Rating:"), rating_box);

            table.ShowAll ();

            main_box.PackStart (header, false, false, 0);
            main_box.PackStart (message, false, false, 0);
            main_box.PackStart (table, false, false, 0);
            main_box.Show ();

            split_box.PackStart (image, false, false, 0);
            split_box.PackStart (main_box, true, true, 0);
            split_box.Show ();

            VBox.PackStart (split_box, true, true, 0);

            Button cancel_button = new Button (Stock.Cancel);
            cancel_button.CanDefault = false;
            cancel_button.UseStock = true;
            cancel_button.Show ();
            AddActionWidget (cancel_button, ResponseType.Close);

            cancel_button.AddAccelerator ("activate", accel_group, (uint)Gdk.Key.Escape,
                0, Gtk.AccelFlags.Visible);

            save_button = new Button (Stock.Save);
            save_button.CanDefault = true;
            save_button.UseStock = true;
            save_button.Sensitive = false;
            save_button.Show ();
            AddActionWidget (save_button, ResponseType.Ok);

            save_button.AddAccelerator ("activate", accel_group, (uint)Gdk.Key.Return,
                0, Gtk.AccelFlags.Visible);

            name_entry.HasFocus = true;

            if (track != null) {
                if (!String.IsNullOrEmpty (track.TrackTitle)) {
                    name_entry.Text = track.TrackTitle;
                }

                if (!String.IsNullOrEmpty (track.Uri.AbsoluteUri)) {
                    stream_entry.Text = track.Uri.AbsoluteUri;
                }

                if (!String.IsNullOrEmpty (track.Comment)) {
                    description_entry.Text = track.Comment;
                }

                if (!String.IsNullOrEmpty (track.ArtistName)) {
                    creator_entry.Text = track.ArtistName;
                }

                rating_entry.Value = track.Rating;
            }

            error_container = new Alignment (0.0f, 0.0f, 1.0f, 1.0f);
            error_container.TopPadding = 6;
            HBox error_box = new HBox ();
            error_box.Spacing = 4;

            Image error_image = new Image ();
            error_image.Stock = Stock.DialogError;
            error_image.IconSize = (int)IconSize.Menu;
            error_image.Show ();

            error = new Label ();
            error.Xalign = 0.0f;
            error.Show ();

            error_box.PackStart (error_image, false, false, 0);
            error_box.PackStart (error, true, true, 0);
            error_box.Show ();

            error_container.Add (error_box);

            table.Attach (error_container, 0, 2, 4, 5, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

            genre_entry.Entry.Changed += OnFieldsChanged;
            name_entry.Changed += OnFieldsChanged;
            stream_entry.Changed += OnFieldsChanged;

            OnFieldsChanged (this, EventArgs.Empty);
        }
Exemplo n.º 59
0
        public NewProjectWizzard_New(Window parent)
        {
            if (parent != null)
                this.TransientFor =parent;
            else
                this.TransientFor = MainClass.MainWindow;

            this.Build();

            atrApplication = new FileTemplate.Attribute();
            atrApplication.Name = "application";
            atrApplication.Type = "text";

            this.DefaultHeight = 390 ;
            this.Title = MainClass.Languages.Translate("moscrif_ide_title_f1");
            ntbWizzard.ShowTabs = false;

            Pango.FontDescription customFont = lblNewProject.Style.FontDescription.Copy();//  Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont);
            customFont.Size = customFont.Size+(int)(customFont.Size/2);
            customFont.Weight = Pango.Weight.Bold;
            lblNewProject.ModifyFont(customFont);

            storeTyp = new ListStore (typeof (string), typeof (string), typeof (Gdk.Pixbuf), typeof (string),typeof(ProjectTemplate),typeof (bool));
            storeOrientation = new ListStore (typeof (string), typeof (string), typeof (Gdk.Pixbuf), typeof (string));

            storeOutput = new ListStore (typeof (string), typeof (string), typeof (Gdk.Pixbuf));

            nvOutput.Model = storeOutput;
            nvOutput.AppendColumn ("", new Gtk.CellRendererText (), "text", 0);
            nvOutput.AppendColumn ("", new Gtk.CellRendererText (), "text", 1);
            nvOutput.AppendColumn ("", new Gtk.CellRendererPixbuf (), "pixbuf", 2);
            nvOutput.Columns[1].Expand = true;

            ivSelectTyp.Model = storeTyp;
            ivSelectTyp.SelectionMode = SelectionMode.Single;
            ivSelectTyp.Orientation = Orientation.Horizontal;

            CellRendererText rendererSelectTyp = new CellRendererText();
            rendererSelectTyp.Ypad =0;
            ivSelectTyp.PackEnd(rendererSelectTyp,false);
            ivSelectTyp.SetCellDataFunc(rendererSelectTyp, new Gtk.CellLayoutDataFunc(RenderTypProject));
            ivSelectTyp.PixbufColumn = COL_PIXBUF;
            ivSelectTyp.TooltipColumn = COL_DISPLAY_TEXT;
            ivSelectTyp.AddAttribute(rendererSelectTyp, "sensitive", 5);

            Gdk.Pixbuf icon0 = MainClass.Tools.GetIconFromStock("project.png",IconSize.LargeToolbar);
            storeTyp.AppendValues ("New Empty Project", "Create empty application", icon0, "", null,true);

            DirectoryInfo[] diTemplates = GetDirectory(MainClass.Paths.FileTemplateDir);
            foreach (DirectoryInfo di in diTemplates) {

                string name = di.Name;

                string iconFile = System.IO.Path.Combine(di.FullName,"icon.png");
                string descFile = System.IO.Path.Combine(di.FullName,"description.xml");
                if(!File.Exists(iconFile) || !File.Exists(descFile))
                    continue;

                string descr = name;
                ProjectTemplate pt = null;

                if(File.Exists(descFile)){
                    pt = ProjectTemplate.OpenProjectTemplate(descFile);
                    if((pt!= null))
                        descr = pt.Description;
                }
                Gdk.Pixbuf icon = new Gdk.Pixbuf(iconFile);
                DirectoryInfo[] templates = di.GetDirectories();
                bool sensitive = true;

                if(templates.Length<1)
                    sensitive = false;
                else
                    sensitive = true;

                storeTyp.AppendValues (name, descr, icon, di.FullName,pt,sensitive);
            }

            ivSelectTyp.SelectionChanged+= delegate(object sender, EventArgs e)
            {
                Gtk.TreePath[] selRow = ivSelectTyp.SelectedItems;
                if(selRow.Length<1){
                    lblHint.Text = " ";
                    btnNext.Sensitive = false;
                    return;
                }

                Gtk.TreePath tp = selRow[0];
                TreeIter ti = new TreeIter();
                storeTyp.GetIter(out ti,tp);

                if(tp.Equals(TreeIter.Zero))return;

                //string typ = storeTyp.GetValue (ti, 3).ToString();
                string text1 = (string) storeTyp.GetValue (ti, 0);
                string text2 = (string) storeTyp.GetValue (ti, 1);
                bool sensitive = Convert.ToBoolean(storeTyp.GetValue (ti, 5));
                if(!sensitive){
                    ivSelectTyp.SelectPath(selectedTypPrj);
                    return;
                }
                selectedTypPrj = selRow[0];

                lblHint.Text = text1+" - "+text2;
                btnNext.Sensitive = true;
            };
            CellRendererText rendererOrientation = new CellRendererText();

            selectedTypPrj = new TreePath("0");
            ivSelectTyp.SelectPath(selectedTypPrj);

            ivSelectOrientation.Model = storeOrientation;
            ivSelectOrientation.SelectionMode = SelectionMode.Single;
            ivSelectOrientation.Orientation = Orientation.Horizontal;

            ivSelectOrientation.PackEnd(rendererOrientation,false);
            ivSelectOrientation.SetCellDataFunc(rendererOrientation, new Gtk.CellLayoutDataFunc(RenderOrientationProject));
            ivSelectOrientation.PixbufColumn = COL_PIXBUF;
            ivSelectOrientation.TooltipColumn = COL_DISPLAY_TEXT;

            foreach(SettingValue ds in MainClass.Settings.DisplayOrientations){
                storeOrientation.AppendValues (ds.Display,ds.Display,null,ds.Value);
            }
            ivSelectOrientation.SelectPath(new TreePath("0"));
            storeWorkspace = new ListStore(typeof(string), typeof(string), typeof(int));
            cbeWorkspace = new ComboBoxEntry();
            cbeWorkspace.Model = storeWorkspace;
            cbeWorkspace.TextColumn = 0;
            cbeWorkspace.Changed+= OnCbeWorkspaceChanged;

            this.feLocation = new FileEntry();
            this.table3.Attach (this.feLocation,1,2,2,3);
            Gtk.Table.TableChild w9 = ((Gtk.Table.TableChild)(this.table3 [this.feLocation]));
            w9.XOptions = ((Gtk.AttachOptions)(4));
            w9.YOptions = ((Gtk.AttachOptions)(4));

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

            CellRendererText rendererWorkspace = new CellRendererText();
            cbeWorkspace.PackStart(rendererWorkspace, true);
            cbeWorkspace.SetCellDataFunc(rendererWorkspace, new Gtk.CellLayoutDataFunc(RenderWorkspacePath));
            cbeWorkspace.WidthRequest = 125;

            cbeWorkspace.SetCellDataFunc(cbeWorkspace.Cells[0], new Gtk.CellLayoutDataFunc(RenderWorkspaceName));

            string currentWorkspace ="";
            if((MainClass.Workspace!= null) && !string.IsNullOrEmpty(MainClass.Workspace.FilePath))
            {
                string name = System.IO.Path.GetFileNameWithoutExtension(MainClass.Workspace.FilePath);
                storeWorkspace.AppendValues (name,MainClass.Workspace.FilePath,1);
                currentWorkspace = MainClass.Workspace.FilePath;
            }
            IList<RecentFile> lRecentProjects = MainClass.Settings.RecentFiles.GetWorkspace();

            foreach(RecentFile rf in lRecentProjects){

                if(rf.FileName == currentWorkspace) continue;
                if(File.Exists(rf.FileName)){
                    string name = System.IO.Path.GetFileNameWithoutExtension(rf.FileName);
                    storeWorkspace.AppendValues(name,rf.FileName,0);
                }
            }
                //storeWorkspace.AppendValues("","-------------",-1);

            worksDefaultName = "Workspace"+MainClass.Settings.WorkspaceCount.ToString();
            TreeIter tiNewW = storeWorkspace.AppendValues(worksDefaultName,MainClass.Paths.WorkDir,2);

            if(!String.IsNullOrEmpty(currentWorkspace)){
                cbeWorkspace.Active =0;
            }
            else {
                feLocation.DefaultPath = MainClass.Paths.WorkDir;
                cbeWorkspace.SetActiveIter(tiNewW);
                //storeWorkspace.AppendValues(worksDefaultName,MainClass.Paths.WorkDir,2);

            }
            prjDefaultName = "Project"+MainClass.Settings.ProjectCount.ToString();
            entrProjectName.Text = prjDefaultName;
            cbeWorkspace.ShowAll();
            feLocation.ShowAll();

            CellRendererText rendererTemplate = new CellRendererText();
            cbTemplate.PackStart(rendererTemplate, true);

            storeTemplate = new ListStore(typeof(string), typeof(string), typeof(string));
            cbTemplate.Model = storeTemplate;

            cbTemplate.Changed+= delegate(object sender, EventArgs e) {

                if(cbTemplate.Active <0) return;

                if(cbTemplate.ActiveText != KEY_CUSTOM){

                    tblLibraries.Sensitive = false;
                    tblScreens.Sensitive = false;
                    ivSelectOrientation.Sensitive = false;
                } else {
                    ivSelectOrientation.Sensitive = true;
                    tblLibraries.Sensitive = true;
                    tblScreens.Sensitive = true;
                }

                TreeIter tiChb = new TreeIter();
                cbTemplate.GetActiveIter(out tiChb);

                if(tiChb.Equals(TreeIter.Zero))return;

                string appPath = storeTemplate.GetValue(tiChb, 2).ToString();
                if(File.Exists(appPath)){
                    AppFile app = new AppFile(appPath);
                    List<string> libs = new List<string>(app.Libs);

                    Widget[] widgets = tblLibraries.Children;
                    foreach (Widget w in widgets ){
                        int indx = libs.FindIndex(x=>x==w.Name);
                        if(indx>-1) {
                            (w as CheckButton).Active = true;
                        } else {
                            (w as CheckButton).Active = false;
                        }
                    }
                }
            };
            btnBack.Sensitive = false;
        }
Exemplo n.º 60
0
        /// <summary>
        /// Setup the form.
        /// </summary>
        /// <param name="sender">system parameter</param>
        /// <param name="e">system parameter</param>
        /// <history>
        /// [Curtis_Beard]	   03/07/2012	ADD: 3131609, exclusions
        /// [Curtis_Beard]	   11/11/2014	CHG: use FilterItem
        /// </history>
        private void frmExclusions_Load(object sender, EventArgs e)
        {
            Language.ProcessForm(this);

             cboCategories.DisplayMember = "DisplayName";
             foreach (string name in Enum.GetNames(typeof(FilterType.Categories)))
             {
            ComboBoxEntry entry = new ComboBoxEntry();
            entry.DisplayName = Language.GetGenericText("Exclusions." + name);
            entry.ValueName = name;
            cboCategories.Items.Add(entry);
             }

             // load fields with values if in edit mode.
             if (_item != null)
             {
            cboCategories.SelectedIndex = cboCategories.FindStringExact(Language.GetGenericText("Exclusions." + _item.FilterType.Category.ToString()));
            cboTypes.SelectedIndex = cboTypes.FindStringExact(Language.GetGenericText("Exclusions." + _item.FilterType.SubCategory.ToString()));
            switch (_item.FilterType.ValueType)
            {
               case FilterType.ValueTypes.DateTime:
                  fvtValue.SetViewType(FilterValueType.ViewTypes.DateTime);
                  break;
               case FilterType.ValueTypes.Long:
                  fvtValue.SetViewType(FilterValueType.ViewTypes.Numeric);
                  break;
               case FilterType.ValueTypes.Size:
                  fvtValue.SetViewType(FilterValueType.ViewTypes.Size);
                  fvtValue.SetSizeDropDown(_item.ValueSizeOption);
                  break;
               case FilterType.ValueTypes.String:
                  fvtValue.SetViewType(FilterValueType.ViewTypes.String);
                  break;
            }
            if (_item.FilterType.ValueType != FilterType.ValueTypes.Null)
            {
               if (_item.FilterType.ValueType == FilterType.ValueTypes.Size)
               {
                  fvtValue.Value = AstroGrep.Core.Convertors.ConvertFileSizeForDisplay(_item.Value, _item.ValueSizeOption);
               }
               else
               {
                  fvtValue.Value = _item.Value;
               }
            }
            cboOptions.SelectedIndex = cboOptions.FindStringExact(Language.GetGenericText("Exclusions." + _item.ValueOption.ToString()));
            chkIgnoreCase.Checked = _item.ValueIgnoreCase;
             }
        }