Example #1
0
 protected void OnAddIcon(object ob, EventArgs args)
 {
     ProjectIconSet icon = new ProjectIconSet ();
     using (EditIconDialog dlg = new EditIconDialog (project, icon)) {
         if (dlg.Run () == (int) Gtk.ResponseType.Ok) {
             iconFactory.Icons.Add (icon);
             customIconList.Refresh ();
             customIconList.Selection = icon.Name;
             project.Modified = true;
         }
     }
 }
		protected void OnAddIcon (object ob, EventArgs args)
		{
			ProjectIconSet icon = new ProjectIconSet ();
			using (EditIconDialog dlg = new EditIconDialog (project, icon)) {
				if (parent != null)
					dlg.TransientFor = parent.Toplevel as Gtk.Window;
				if (dlg.Run () == (int) Gtk.ResponseType.Ok) {
					iconFactory.Icons.Add (icon);
					customIconList.Refresh ();
					customIconList.Selection = icon.Name;
//					project.Modified = true;
				}
			}
		}
Example #3
0
        protected void OnAddIcon(object ob, EventArgs args)
        {
            ProjectIconSet icon = new ProjectIconSet();

            using (EditIconDialog dlg = new EditIconDialog(project, icon)) {
                if (dlg.Run() == (int)Gtk.ResponseType.Ok)
                {
                    project.IconFactory.Icons.Add(icon);
                    customIconList.Refresh();
                    customIconList.Selection = icon.Name;
                    project.Modified         = true;
                }
            }
        }
Example #4
0
        protected void OnEditIcon(object ob, EventArgs args)
        {
            string         name = customIconList.Selection;
            ProjectIconSet icon = project.IconFactory.GetIcon(name);

            if (icon != null)
            {
                using (EditIconDialog dlg = new EditIconDialog(project, icon)) {
                    if (dlg.Run() == (int)Gtk.ResponseType.Ok)
                    {
                        customIconList.Refresh();
                        customIconList.Selection = icon.Name;
                        project.Modified         = true;
                    }
                }
            }
        }
Example #5
0
        protected void OnRemoveIcon(object ob, EventArgs args)
        {
            string         name = customIconList.Selection;
            ProjectIconSet icon = project.IconFactory.GetIcon(name);

            if (icon != null)
            {
                Gtk.MessageDialog md = new Gtk.MessageDialog(dialog, Gtk.DialogFlags.Modal, Gtk.MessageType.Question, Gtk.ButtonsType.YesNo, string.Format(Catalog.GetString("Are you sure you want to delete the icon '{0}'"), icon.Name));
                if (md.Run() == (int)Gtk.ResponseType.Yes)
                {
                    project.IconFactory.Icons.Remove(icon);
                    customIconList.Refresh();
                    project.Modified = true;
                }
                md.Destroy();
            }
        }
        protected void OnAddIcon(object ob, EventArgs args)
        {
            ProjectIconSet icon = new ProjectIconSet();

            using (EditIconDialog dlg = new EditIconDialog(project, icon)) {
                if (parent != null)
                {
                    dlg.TransientFor = parent.Toplevel as Gtk.Window;
                }
                if (dlg.Run() == (int)Gtk.ResponseType.Ok)
                {
                    project.IconFactory.Icons.Add(icon);
                    customIconList.Refresh();
                    customIconList.Selection = icon.Name;
//					project.Modified = true;
                }
            }
        }
Example #7
0
        public EditIconDialog(IProject project, ProjectIconSet iconSet)
        {
            Glade.XML xml = new Glade.XML(null, "stetic.glade", "EditIconDialog", null);
            xml.Autoconnect(this);
            dialog.Response += OnResponse;

            this.project = project;
            this.iconSet = iconSet;

            nameEntry.Text = iconSet.Name;

            if (iconSet.Sources.Count == 0)
            {
                radioSingle.Active = true;
                imageLabel.Text    = "";
            }
            else if (iconSet.Sources.Count == 1 && iconSet.Sources[0].AllWildcarded)
            {
                radioSingle.Active = true;
                singleIcon         = iconSet.Sources[0].Image;
                if (singleIcon != null)
                {
                    imageLabel.Text   = singleIcon.Label;
                    imageImage.Pixbuf = singleIcon.GetThumbnail(project, 16);
                }
                else
                {
                    imageLabel.Text = "";
                }
            }
            else
            {
                radioMultiple.Active = true;
            }

            hboxSingle.Sensitive   = radioSingle.Active;
            hboxMultiple.Sensitive = !radioSingle.Active;

            // Build the tree

            sourceListStore  = new Gtk.ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof(string), typeof(object));
            sourceList.Model = sourceListStore;

            Gtk.TreeViewColumn col = new Gtk.TreeViewColumn();

            Gtk.CellRendererPixbuf pr = new Gtk.CellRendererPixbuf();
            col.Title = Catalog.GetString("Image");
            col.PackStart(pr, false);
            col.AddAttribute(pr, "pixbuf", 0);

            Gtk.CellRendererText crt = new Gtk.CellRendererText();
            col.PackStart(crt, true);
            col.AddAttribute(crt, "text", 1);
            sourceList.AppendColumn(col);

            col        = new Gtk.TreeViewColumn();
            col.Expand = true;
            col.Title  = Catalog.GetString("Size");
            CellRendererComboBox crtb = new CellRendererComboBox();

            crtb.Changed += new ComboSelectionChangedHandler(OnSizeComboChanged);
            crtb.Values   = sizes;
            col.PackStart(crtb, true);
            col.AddAttribute(crtb, "text", 2);
            sourceList.AppendColumn(col);

            col           = new Gtk.TreeViewColumn();
            col.Expand    = true;
            col.Title     = Catalog.GetString("State");
            crtb          = new CellRendererComboBox();
            crtb.Changed += new ComboSelectionChangedHandler(OnStateComboChanged);
            crtb.Values   = states;
            col.PackStart(crtb, true);
            col.AddAttribute(crtb, "text", 3);
            sourceList.AppendColumn(col);

            col           = new Gtk.TreeViewColumn();
            col.Expand    = true;
            col.Title     = Catalog.GetString("Direction");
            crtb          = new CellRendererComboBox();
            crtb.Changed += new ComboSelectionChangedHandler(OnDirComboChanged);
            crtb.Values   = directions;
            col.PackStart(crtb, true);
            col.AddAttribute(crtb, "text", 4);
            sourceList.AppendColumn(col);

            foreach (ProjectIconSource source in iconSet.Sources)
            {
                AddSource(source);
            }

            UpdateButtons();
        }
Example #8
0
        public EditIconDialog(IProject project, ProjectIconSet iconSet)
        {
            Glade.XML xml = new Glade.XML (null, "stetic.glade", "EditIconDialog", null);
            xml.Autoconnect (this);
            dialog.Response += OnResponse;

            this.project = project;
            this.iconSet = iconSet;

            nameEntry.Text = iconSet.Name;

            if (iconSet.Sources.Count == 0) {
                radioSingle.Active = true;
                imageLabel.Text = "";
            }
            else if (iconSet.Sources.Count == 1 && iconSet.Sources[0].AllWildcarded) {
                radioSingle.Active = true;
                singleIcon = iconSet.Sources[0].Image;
                if (singleIcon != null) {
                    imageLabel.Text = singleIcon.Label;
                    imageImage.Pixbuf = singleIcon.GetThumbnail (project, 16);
                } else
                    imageLabel.Text = "";
            } else {
                radioMultiple.Active = true;
            }

            hboxSingle.Sensitive = radioSingle.Active;
            hboxMultiple.Sensitive = !radioSingle.Active;

            // Build the tree

            sourceListStore = new Gtk.ListStore (typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof(string), typeof(object));
            sourceList.Model = sourceListStore;

            Gtk.TreeViewColumn col = new Gtk.TreeViewColumn ();

            Gtk.CellRendererPixbuf pr = new Gtk.CellRendererPixbuf ();
            col.Title = Catalog.GetString ("Image");
            col.PackStart (pr, false);
            col.AddAttribute (pr, "pixbuf", 0);

            Gtk.CellRendererText crt = new Gtk.CellRendererText ();
            col.PackStart (crt, true);
            col.AddAttribute (crt, "text", 1);
            sourceList.AppendColumn (col);

            col = new Gtk.TreeViewColumn ();
            col.Expand = true;
            col.Title = Catalog.GetString ("Size");
            CellRendererComboBox crtb = new CellRendererComboBox ();
            crtb.Changed += new ComboSelectionChangedHandler (OnSizeComboChanged);
            crtb.Values = sizes;
            col.PackStart (crtb, true);
            col.AddAttribute (crtb, "text", 2);
            sourceList.AppendColumn (col);

            col = new Gtk.TreeViewColumn ();
            col.Expand = true;
            col.Title = Catalog.GetString ("State");
            crtb = new CellRendererComboBox ();
            crtb.Changed += new ComboSelectionChangedHandler (OnStateComboChanged);
            crtb.Values = states;
            col.PackStart (crtb, true);
            col.AddAttribute (crtb, "text", 3);
            sourceList.AppendColumn (col);

            col = new Gtk.TreeViewColumn ();
            col.Expand = true;
            col.Title = Catalog.GetString ("Direction");
            crtb = new CellRendererComboBox ();
            crtb.Changed += new ComboSelectionChangedHandler (OnDirComboChanged);
            crtb.Values = directions;
            col.PackStart (crtb, true);
            col.AddAttribute (crtb, "text", 4);
            sourceList.AppendColumn (col);

            foreach (ProjectIconSource source in iconSet.Sources)
                AddSource (source);

            UpdateButtons ();
        }