SetValue() public method

public SetValue ( Gtk iter, int column, bool value ) : void
iter Gtk
column int
value bool
return void
Ejemplo n.º 1
0
        // we need to manually set the toggle when selected otherwise
        // it won't show in the gui.
        public void toggle_it(object o, Gtk.ToggledArgs args)
        {
            store.GetIterFromString(out iter, args.Path);
            bool tog = (bool)store.GetValue(iter, 0);

            store.SetValue(iter, 0, !tog);
        }
Ejemplo n.º 2
0
        private void UpdateFromConf()
        {
            Console.WriteLine("Reading settings from Config");
            // FIXME: there might be weird cases with multiple screens,
            // multiple monitors, resolution related problems that might
            // cause problem is remapping the stored values to current
            // screen coordinates
            int res_x  = GD.Screen.Default.Width;
            int res_y  = GD.Screen.Default.Height;
            int pos_x  = (int)(Conf.Searching.BestPosX * res_x / 100);
            int pos_y  = (int)(Conf.Searching.BestPosY * res_y / 100);
            int width  = (int)(Conf.Searching.BestWidth * res_x / 100);
            int height = (int)(Conf.Searching.BestHeight * res_y / 100);

            if (pos_x != 0 || pos_y != 0)
            {
                posX = pos_x;
                posY = pos_y;
                Move(pos_x, pos_y);
            }
            if (width != 0)
            {
                DefaultWidth = width;
            }
            if (height != 0)
            {
                DefaultHeight = height;
            }
            Gtk.TreeIter iter;
            foreach (string search in Conf.Searching.SearchHistory)
            {
                iter = history.Append();
                history.SetValue(iter, 0, search);
            }
        }
        void UpdateList()
        {
            if (displayedHashCode == ComponentManager.Localization.GetCurrentHashcode())
            {
                return;
            }
            displayedHashCode = ComponentManager.Localization.GetCurrentHashcode();
            listStore.Clear();

            Dictionary <string, Localization.Node> dn = ComponentManager.Localization.GetDefaultNodes();

            foreach (Localization.Node node in dn.Values)
            {
                Gtk.TreeIter iter = listStore.Append();
                listStore.SetValue(iter, nodeIndex, node);
                listStore.SetValue(iter, keyIndex, node.Key);
                listStore.SetValue(iter, usValueIndex, node.Value);

                Localization.Node ln = ComponentManager.Localization.FindCurrentNode(node.Key);
                if (ln != null)
                {
                    listStore.SetValue(iter, localValueIndex, ln.Value);
                }
            }
        }
Ejemplo n.º 4
0
        public void AddServer(IServer server)
        {
            TreeIter iter = Store.Append();

            //Store.SetValue(iter, 0, new Gdk.Pixbuf...)
            Store.SetValue(iter, 1, server.Name);
            Store.SetValue(iter, 2, server);
        }
        void OnRowClicked(object o, RowActivatedArgs args)
        {
            TreeIter Iter;

            if ((o as TreeView).Selection.GetSelected(out Iter))
            {
                bool OldValue = (bool)MusicListStore.GetValue(Iter, 0);
                MusicListStore.SetValue(Iter, 0, !OldValue);
                Log.DebugFormat("Setting Selection Value For Row {0} -> {1}", MusicListStore.GetStringFromIter(Iter), !OldValue);
            }
        }
Ejemplo n.º 6
0
        private void on_item_updated(object sender, ListUpdateEventArgs args)
        {
            //updateaza itemul din store
            Gtk.TreeIter iter;
            this.Model.GetIterFromString(out iter, args.Index.ToString());
            //change the value
            bool is_checked = (checked_items.IndexOf(args.Index) != -1);

            Console.WriteLine("era checkuit:" + is_checked);
            //store.SetValues( iter, is_checked, args.NewValue );
            store.SetValue(iter, 0, is_checked);
            store.SetValue(iter, 1, args.NewValue);

            this.QueueDraw();
        }
Ejemplo n.º 7
0
        public void on_open1_activate(object o, EventArgs args)
        {
            FileSelection fs = new FileSelection("Select a PDF file...");

            // TODO: This doesn't filter the file list...
            fs.Complete("*.pdf");
            fs.Run();
            fs.Hide();

            appbar1.Push("Opening document...");
            m_doc = new Pdf(fs.Filename);
            appbar1.Push(m_doc.PageCount + " page document");

            // Populate the pages list
            Gtk.ListStore model = new Gtk.ListStore(typeof(string));
            Gtk.TreeIter  iter  = new Gtk.TreeIter();
            Console.WriteLine("List has " + model.NColumns + " columns");
            for (int i = 0; i < m_doc.PageCount; i++)
            {
                iter = model.Append();
                GLib.Value v = new GLib.Value((i + 1).ToString());
                model.SetValue(iter, 0, v);
            }
            pages.Model = model;
            pages.Show();
        }
Ejemplo n.º 8
0
        void RenameCurrentPreset(string newName)
        {
            if (configuration == null)
            {
                CreateNewPreset(newName);
                return;
            }

            if (configuration.Vendor == newName || !CanUseNewName(newName))
            {
                return;
            }

            // If default compiler affected, update the default compiler's name, too
            if (defaultCompilerVendor == configuration.Vendor)
            {
                defaultCompilerVendor = newName;
            }

            // Apply new name to the cfg object
            configuration.Vendor = newName;

            // + to the compiler store model
            compilerStore.Foreach((TreeModel tree, TreePath path, TreeIter iter) =>
            {
                if (compilerStore.GetValue(iter, 1) == configuration)
                {
                    compilerStore.SetValue(iter, 0, configuration.Vendor);
                    return(true);
                }

                return(false);
            });
        }
Ejemplo n.º 9
0
        private void ChangeEntryText(TreeIter it, String str)
        {
            Gtk.Application.Invoke(delegate {
                Gtk.ListStore ls = (Gtk.ListStore)treeview1.Model;

                ls.SetValue(it, 0, str);
            });
        }
Ejemplo n.º 10
0
        // <summary>
        // Same as GetTag () but will create a new tag if one doesn't already exist.
        // </summary>
        public static Tag GetOrCreateTag(string tag_name)
        {
            if (tag_name == null)
            {
                throw new ArgumentNullException("TagManager.GetOrCreateTag () called with a null tag name.");
            }

            string normalized_tag_name = tag_name.Trim().ToLower();

            if (normalized_tag_name == String.Empty)
            {
                throw new ArgumentException("TagManager.GetOrCreateTag () called with an empty tag name.");
            }

            if (normalized_tag_name.StartsWith(Tag.SYSTEM_TAG_PREFIX) || normalized_tag_name.Split(':').Length > 2)
            {
                lock (locker) {
                    if (internal_tags.ContainsKey(normalized_tag_name))
                    {
                        return(internal_tags[normalized_tag_name]);
                    }
                    else
                    {
                        Tag t = new Tag(tag_name);
                        internal_tags [t.NormalizedName] = t;
                        return(t);
                    }
                }
            }
            Gtk.TreeIter iter      = Gtk.TreeIter.Zero;
            bool         tag_added = false;
            Tag          tag       = GetTag(normalized_tag_name);

            if (tag == null)
            {
                lock (locker) {
                    tag = GetTag(normalized_tag_name);
                    if (tag == null)
                    {
                        tag  = new Tag(tag_name.Trim());
                        iter = tags.Append();
                        tags.SetValue(iter, 0, tag);
                        tag_map [tag.NormalizedName] = iter;

                        tag_added = true;
                    }
                }
            }

            if (tag_added && TagAdded != null)
            {
                TagAdded(tag, iter);
            }

            return(tag);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 更新一条数据到任务状态列表中。
        /// </summary>
        /// <param name="rowidx">Rowidx.</param>
        /// <param name="columnidx">Columnidx.</param>
        /// <param name="value">Value.</param>
        public void UpdateRowForTheListView(int rowidx, int columnidx, object value)
        {
            TreeIter iter;

            ListStore.GetIter(out iter, new TreePath(rowidx.ToString()));
            if (columnidx == 1)
            {
                ListStore.SetValue(iter, columnidx, Convert.ToInt32(value));
            }
        }
Ejemplo n.º 12
0
        private void preferenceToggled(object o, ToggledArgs args)
        {
            TreeIter iter;

            if (PolicyTreeStore.GetIter(out iter, new TreePath(args.Path)))
            {
                bool old = (bool)PolicyTreeStore.GetValue(iter, 0);
                notificationTypes type = (notificationTypes)PolicyTreeStore.GetValue(iter, 2);
                setNotificationState(type, !old);
                PolicyTreeStore.SetValue(iter, 0, !old);
            }
        }
Ejemplo n.º 13
0
        public void UpdateCurrentFrame()
        {
            TreeIter it;

            if (store.GetIterFirst(out it))
            {
                int n = 0;
                do
                {
                    if (n == DebuggingService.CurrentFrameIndex)
                    {
                        store.SetValue(it, 0, Gtk.Stock.GoForward);
                    }
                    else
                    {
                        store.SetValue(it, 0, null);
                    }
                    n++;
                } while (store.IterNext(ref it));
            }
        }
Ejemplo n.º 14
0
        void HandleButtonPressEvent(object sender, ButtonPressEventArgs args)
        {
            TreeViewColumn col;
            CellRenderer   cr;
            TreePath       path;
            TreeIter       iter;

            if (args.Event.Button != 1 || !GetCellAtPos((int)args.Event.X, (int)args.Event.Y, out path, out col, out cr))
            {
                return;
            }

            if (!store.GetIter(out iter, path))
            {
                return;
            }

            if (cr == refresh)
            {
                var options = DebuggingService.DebuggerSession.Options.EvaluationOptions.Clone();
                options.AllowMethodEvaluation = true;
                options.AllowToStringCalls    = true;

                var frame  = (StackFrame)store.GetValue(iter, 7);
                var method = EvaluateMethodName(frame, options);

                store.SetValue(iter, 1, method);
                store.SetValue(iter, 8, false);
            }
        }
Ejemplo n.º 15
0
        void crt_toggled(object o, ToggledArgs args)
        {
            TreeIter iter;

            Console.WriteLine("Toggled");
            Gtk.ListStore store = (Gtk.ListStore)tvBar.Model;

            if (store.GetIter(out iter, new TreePath(args.Path)))
            {
                bool old = (bool)store.GetValue(iter, 3);
                store.SetValue(iter, 3, !old);
            }
        }
Ejemplo n.º 16
0
        protected virtual void OnBtnRemoveClicked(object sender, System.EventArgs e)
        {
            TreeSelection ts = tvFiles.Selection;

            TreeIter ti = new TreeIter();

            ts.GetSelected(out ti);

            TreePath[] tp = ts.GetSelectedRows();
            if (tp.Length < 1)
            {
                return;
            }

            EmulatorDisplay dd = (EmulatorDisplay)tvFiles.Model.GetValue(ti, 2);


            MessageDialogs md     = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo, MainClass.Languages.Translate("question_delete_file", dd.FilePath), "", Gtk.MessageType.Question, parentWindow);
            int            result = md.ShowDialog();

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

            if (!System.IO.File.Exists(dd.FilePath))
            {
                return;
            }

            try {
                //fileListStore
                fileListStore.SetValue(ti, 2, null);
                fileListStore.Remove(ref ti);
                System.IO.File.Delete(dd.FilePath);
            } catch {
                return;
            }
        }
Ejemplo n.º 17
0
        void fillStore()
        {
            int      count    = 0;
            TreeIter lastIter = TreeIter.Zero;

            foreach (WebDeployTarget target in project.WebDeployTargets)
            {
                if (target.ValidForDeployment)
                {
                    lastIter = targetStore.AppendValues(target.GetMarkup(), target, false);
                    count++;
                }
            }

            //select some targets by default if appropriate
            if (count == 1)
            {
                targetStore.SetValue(lastIter, LISTCOL_Checked, true);
            }
            //FIXME: store/load other selections in .userprefs file
            UpdateButtonState();
        }
Ejemplo n.º 18
0
        }        // OnOmitCBToggled

        public BranchSelectionDialog(ICollection <string> branchLocations, string defaultLocation, string localDirectory, bool enableLocalPathSelection, bool enableRemember, bool enableOverwrite, bool enableOmitHistory)
        {
            this.Build();

            Parent = MonoDevelop.Ide.IdeApp.Workbench.RootWindow;
            Gtk.CellRendererText textRenderer = new Gtk.CellRendererText();
            textRenderer.Editable = true;
            textRenderer.Edited  += delegate(object o, EditedArgs args) {
                try {
                    Gtk.TreeIter eiter;
                    branchStore.GetIterFromString(out eiter, args.Path);
                    branchStore.SetValue(eiter, 0, args.NewText);
                } catch {}
            };

            branchTreeView.Model          = branchStore;
            branchTreeView.HeadersVisible = false;
            branchTreeView.AppendColumn("Branch", textRenderer, "text", 0);

            Gtk.TreeIter iter,
                         defaultIter = default(Gtk.TreeIter);
            bool found = false;

            foreach (string location in branchLocations)
            {
                iter = branchStore.AppendValues(location);
                if (location == defaultLocation)
                {
                    defaultIter = iter;
                    found       = true;
                }
            }
            iter = branchStore.AppendValues(string.Empty);

            if (1 == branchLocations.Count)
            {
                branchStore.GetIterFirst(out iter);
            }            // when only one branch is known, default to it

            branchTreeView.Selection.SelectIter(found? defaultIter: iter);

            if (!string.IsNullOrEmpty(localDirectory))
            {
                localPathButton.SetCurrentFolder(localDirectory);
            }
            localPathButton.Sensitive = enableLocalPathSelection;
            omitCB.Visible            = enableOmitHistory;
            defaultCB.Sensitive       = enableRemember;
            overwriteCB.Sensitive     = enableOverwrite;
        }        // constructor
Ejemplo n.º 19
0
 void HandleProgressChanged(object sender, JobInformationEventArgs e)
 {
     Gtk.Application.Invoke(delegate
     {
         lock (listStore)
         {
             TreeIter iter = FindJob(e.JobInformation);
             if (!iter.Equals(TreeIter.Zero))
             {
                 listStore.SetValue(iter, COLUMN_STATUS, e.JobInformation.Progress);
             }
         }
     });
 }
Ejemplo n.º 20
0
        private void SetPatternIconToStop(Pattern pattern)
        {
            TreeIter iterator;

            PatternListStore.GetIterFirst(out iterator);

            do
            {
                if (pattern == (Pattern)PatternListStore.GetValue(iterator, PatternColumn))
                {
                    PatternListStore.SetValue(iterator, 0, "icon-dark-play");
                    break;
                }
            }while (PatternListStore.IterNext(ref iterator));
        }
Ejemplo n.º 21
0
        public EditModsDialog(Instance inst, Gtk.Window parent = null)
            : base("Edit Mods", parent, DialogFlags.Modal)
        {
            Inst = inst;

            this.Build();

            #region We have to make the treeview ourselves since monodevelop is absolute shit...
            this.editModScroll = new ScrolledWindow();
            this.editModScroll.HscrollbarPolicy = PolicyType.Never;
            this.modView = new Gtk.TreeView();
            this.modView.CanFocus = true;
            this.modView.Name = "modView";
            this.editModScroll.Add(this.modView);
            this.VBox.Add(this.editModScroll);
            Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.VBox[this.editModScroll]));
            w3.Position = 0;
            this.ShowAll();
            #endregion

            modList = new ListStore(typeof(string), typeof(string), typeof(bool), typeof(DateTime));
            modView.Model = modList;
            modView.AppendColumn("File", new CellRendererText(), "text", 0);
            modView.AppendColumn("Install Date", new CellRendererText(), "text", 1);

            CellRendererToggle toggleRenderer = new CellRendererToggle();
            toggleRenderer.Activatable = true;
            toggleRenderer.Sensitive = true;
            toggleRenderer.Toggled += (object o, ToggledArgs args) =>
            {
                TreeIter iter;
                if (modList.GetIter(out iter, new TreePath(args.Path)))
                    modList.SetValue(iter, 2, !(bool)modList.GetValue(iter, 2));
            };
            modView.AppendColumn("Delete?", toggleRenderer, "active", 2);

            modView.Columns[0].Alignment = 0.0f;
            modView.Columns[0].Expand = true;
            modView.Columns[1].Alignment = 1.0f;
            modView.Columns[2].Alignment = 1.0f;

            LoadMods();
        }
Ejemplo n.º 22
0
        public EditModsDialog(Instance inst, Gtk.Window parent = null)
            : base("Edit Mods", parent, DialogFlags.Modal)
        {
            Inst = inst;

            using (Button buttonRefresh = new Button("gtk-refresh"))
            {
                buttonRefresh.Clicked += (sender, e) =>
                {
                    LoadMods();
                };
                ActionArea.Homogeneous = false;
                ActionArea.PackEnd(buttonRefresh, false, true, 0);
                buttonRefresh.Visible = true;
            }

            this.Build();

            #region We have to make the treeview ourselves since monodevelop is absolute shit...
            this.editModScroll = new ScrolledWindow();
            this.editModScroll.HscrollbarPolicy = PolicyType.Never;
            this.modView = new Gtk.TreeView();
            this.modView.CanFocus = true;
            this.modView.Name = "modView";
            this.editModScroll.Add(this.modView);
            this.VBox.Add(this.editModScroll);
            Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.VBox[this.editModScroll]));
            w3.Position = 0;
            this.ShowAll();
            #endregion

            modList = new ListStore(typeof(string), typeof(int), typeof(bool));
            modView.Model = modList;
            using (CellRendererText cr = new CellRendererText())
                modView.AppendColumn("Index", cr, "text", 1);
            using (CellRendererText cr = new CellRendererText())
                modView.AppendColumn("File", cr, "text", 0);

            CellRendererToggle toggleRenderer = new CellRendererToggle();
            toggleRenderer.Activatable = true;
            toggleRenderer.Sensitive = true;
            toggleRenderer.Toggled += (object o, ToggledArgs args) =>
            {
                TreeIter iter;
                using (TreePath tp = new TreePath(args.Path))
                    if (modList.GetIter(out iter, tp))
                        modList.SetValue(iter, 2, !(bool) modList.GetValue(iter, 2));
            };
            modView.AppendColumn("Delete?", toggleRenderer, "active", 2);

            modView.Columns[0].Alignment = 0.0f;
            modView.Columns[1].Alignment = 0.0f;
            modView.Columns[1].Expand = true;
            modView.Columns[2].Alignment = 1.0f;

            modView.Reorderable = true;

            LoadMods();

            // Auto-refresh
            Inst.InstMods.ModFileChanged += (sender, e) =>
                Application.Invoke((sender2, e2) => LoadMods());
        }
Ejemplo n.º 23
0
        public MainWindow()
        {
            XML gxml = new XML(null, "MultiMC.GTKGUI.MainWindow.glade",
                "mainVBox", null);
            gxml.Toplevel = this;
            gxml.Autoconnect(this);

            XML gxml2 = new XML(null, "MultiMC.GTKGUI.InstContextMenu.glade",
                "instContextMenu", null);
            gxml2.Autoconnect(this);

            /*
             * HACK: the nested menu isn't picked up by the first gxml object. It is probably a GTK# bug.
             * This is the fix - manually asking for the menu and connecting it.
             */
            XML gxml3 = new XML(null, "MultiMC.GTKGUI.MainWindow.glade",
                "menunew", null);
            gxml3.Autoconnect(this);
            newInstButton.Menu = menunew;

            this.Add(mainVBox);

            ShowAll();

            this.WidthRequest = 620;
            this.HeightRequest = 380;

            DeleteEvent += (o, args) => Application.Quit();

            // Set up the instance icon view
            instListStore = new ListStore(
                typeof(string), typeof(Gdk.Pixbuf), typeof(Instance));

            instView.Model = instListStore;
            instView.TextColumn = 0;
            instView.PixbufColumn = 1;
            instView.ItemWidth = -1;

            Gtk.CellRendererText crt = instView.Cells[0] as CellRendererText;
            crt.Editable = true;
            crt.Edited += (object o, EditedArgs args) =>
            {
                int EditedIndex = int.Parse(args.Path);
                TreeIter iter;
                // don't allow bad names
                if(!Instance.NameIsValid(args.NewText))
                    return;
                System.Console.WriteLine("Path: " + args.Path + " New text: " + args.NewText);
                if(instListStore.GetIterFromString(out iter,args.Path))
                {
                    instListStore.SetValue(iter, 0, args.NewText);
                    Instance inst = instListStore.GetValue(iter, 2) as Instance;
                    inst.Name = args.NewText;
                }

            };

            instView.Orientation = Orientation.Vertical;
            instView.ButtonPressEvent += (o, args) =>
                {
                    if (args.Event.Button == 3 &&
                        instView.GetPathAtPos((int)args.Event.X,
                                              (int)args.Event.Y) != null)
                    {
                        instView.SelectPath(instView.GetPathAtPos(
                            (int)args.Event.X, (int)args.Event.Y));
                        instContextMenu.Popup();
                    }
                };
            instView.KeyPressEvent += (object o, KeyPressEventArgs args) =>
                {
                    if(args.Event.Key == Gdk.Key.F2)
                    {
                        if(instView.SelectedItems.Count() != 0)
                            instView.SetCursor(instView.SelectedItems[0], instView.Cells[0], true);
                    }
                    else if(args.Event.Key == Gdk.Key.Escape)
                    {
                        if(EscPressed != null)
                            EscPressed(this, EventArgs.Empty);
                    }
                };

            // Set up the task list
            EventfulList<Task> tList = new EventfulList<Task>();
            tList.Added += TaskAdded;
            tList.Removed += TaskRemoved;

            TaskList = tList;
            taskProgBars = new Dictionary<int, Box>();

            // Set up the instance list
            EventfulList<Instance> iList = new EventfulList<Instance>();
            iList.Added += InstAdded;
            iList.Removed += InstRemoved;

            InstanceList = iList;

            helpButton.Sensitive = false;
            if(OSUtils.OS == OSEnum.Linux)
            {
                Gtk.MenuItem openalRemoveItem = gxml2.GetWidget("removeOpenALMenuItem") as Gtk.MenuItem;
                openalRemoveItem.Visible = true;
            }
        }
Ejemplo n.º 24
0
 public void SetColumnValue(TreeIter iter, int column, string value)
 {
     GLib.Value cell = new GLib.Value(value);
     store.SetValue(iter, column, cell);
 }
Ejemplo n.º 25
0
		public Gtk.Widget MakeSyncPane ()
		{
			Gtk.VBox vbox = new Gtk.VBox (false, 0);
			vbox.Spacing = 4;
			vbox.BorderWidth = 8;

			Gtk.HBox hbox = new Gtk.HBox (false, 4);

			Gtk.Label label = new Gtk.Label (Catalog.GetString ("Ser_vice:"));
			label.Xalign = 0;
			label.Show ();
			hbox.PackStart (label, false, false, 0);

			// Populate the store with all the available SyncServiceAddins
			syncAddinStore = new Gtk.ListStore (typeof (SyncServiceAddin));
			syncAddinIters = new Dictionary<string,Gtk.TreeIter> ();
			SyncServiceAddin [] addins = Tomboy.DefaultNoteManager.AddinManager.GetSyncServiceAddins ();
			Array.Sort (addins, CompareSyncAddinsByName);
			foreach (SyncServiceAddin addin in addins) {
				Gtk.TreeIter iter = syncAddinStore.Append ();
				syncAddinStore.SetValue (iter, 0, addin);
				syncAddinIters [addin.Id] = iter;
			}

			syncAddinCombo = new Gtk.ComboBox (syncAddinStore);
			label.MnemonicWidget = syncAddinCombo;
			Gtk.CellRendererText crt = new Gtk.CellRendererText ();
			syncAddinCombo.PackStart (crt, true);
			syncAddinCombo.SetCellDataFunc (crt,
			                                new Gtk.CellLayoutDataFunc (ComboBoxTextDataFunc));

			// Read from Preferences which service is configured and select it
			// by default.  Otherwise, just select the first one in the list.
			string addin_id = Preferences.Get (
			                          Preferences.SYNC_SELECTED_SERVICE_ADDIN) as String;

			Gtk.TreeIter active_iter;
			if (addin_id != null && syncAddinIters.ContainsKey (addin_id)) {
				active_iter = syncAddinIters [addin_id];
				syncAddinCombo.SetActiveIter (active_iter);
			} else {
				if (syncAddinStore.GetIterFirst (out active_iter) == true) {
					syncAddinCombo.SetActiveIter (active_iter);
				}
			}

			syncAddinCombo.Changed += OnSyncAddinComboChanged;

			syncAddinCombo.Show ();
			hbox.PackStart (syncAddinCombo, true, true, 0);

			hbox.Show ();
			vbox.PackStart (hbox, false, false, 0);

			// Get the preferences GUI for the Sync Addin
			if (active_iter.Stamp != Gtk.TreeIter.Zero.Stamp)
				selectedSyncAddin = syncAddinStore.GetValue (active_iter, 0) as SyncServiceAddin;

			if (selectedSyncAddin != null)
				syncAddinPrefsWidget = selectedSyncAddin.CreatePreferencesControl (OnSyncAddinPrefsChanged);
			if (syncAddinPrefsWidget == null) {
				Gtk.Label l = new Gtk.Label (Catalog.GetString ("Not configurable"));
				l.Yalign = 0.5f;
				l.Yalign = 0.5f;
				syncAddinPrefsWidget = l;
			}
			if (syncAddinPrefsWidget != null && addin_id != null &&
			                syncAddinIters.ContainsKey (addin_id) && selectedSyncAddin.IsConfigured)
				syncAddinPrefsWidget.Sensitive = false;

			syncAddinPrefsWidget.Show ();
			syncAddinPrefsContainer = new Gtk.VBox (false, 0);
			syncAddinPrefsContainer.PackStart (syncAddinPrefsWidget, false, false, 0);
			syncAddinPrefsContainer.Show ();
			vbox.PackStart (syncAddinPrefsContainer, true, true, 10);

			// Autosync preference
			int timeout = (int) Preferences.Get (Preferences.SYNC_AUTOSYNC_TIMEOUT);
			if (timeout > 0 && timeout < 5) {
				timeout = 5;
				Preferences.Set (Preferences.SYNC_AUTOSYNC_TIMEOUT, 5);
			}
			Gtk.HBox autosyncBox = new Gtk.HBox (false, 5);
			// Translators: This is and the next string go together.
			// Together they look like "Automatically Sync in Background Every [_] Minutes",
			// where "[_]" is a GtkSpinButton.
			autosyncCheck =
				new Gtk.CheckButton (Catalog.GetString ("Automaticall_y Sync in Background Every"));
			autosyncSpinner = new Gtk.SpinButton (5, 1000, 1);
			autosyncSpinner.Value = timeout >= 5 ? timeout : 10;
			Gtk.Label autosyncExtraText =
				// Translators: See above comment for details on
				// this string.
				new Gtk.Label (Catalog.GetString ("Minutes"));
			autosyncCheck.Active = autosyncSpinner.Sensitive = timeout >= 5;
			EventHandler updateTimeoutPref = (o, e) => {
				Preferences.Set (Preferences.SYNC_AUTOSYNC_TIMEOUT,
				                 autosyncCheck.Active ? (int) autosyncSpinner.Value : -1);
			};
			autosyncCheck.Toggled += (o, e) => {
				autosyncSpinner.Sensitive = autosyncCheck.Active;
				updateTimeoutPref (o, e);
			};
			autosyncSpinner.ValueChanged += updateTimeoutPref;

			autosyncBox.PackStart (autosyncCheck);
			autosyncBox.PackStart (autosyncSpinner);
			autosyncBox.PackStart (autosyncExtraText);
			vbox.PackStart (autosyncBox, false, true, 0);

			Gtk.HButtonBox bbox = new Gtk.HButtonBox ();
			bbox.Spacing = 4;
			bbox.LayoutStyle = Gtk.ButtonBoxStyle.End;

			// "Advanced..." button to bring up extra sync config dialog
			Gtk.Button advancedConfigButton = new Gtk.Button (Catalog.GetString ("_Advanced..."));
			advancedConfigButton.Clicked += OnAdvancedSyncConfigButton;
			advancedConfigButton.Show ();
			bbox.PackStart (advancedConfigButton, false, false, 0);
			bbox.SetChildSecondary (advancedConfigButton, true);

			resetSyncAddinButton = new Gtk.Button (Gtk.Stock.Clear);
			resetSyncAddinButton.Clicked += OnResetSyncAddinButton;
			resetSyncAddinButton.Sensitive =
			        (selectedSyncAddin != null &&
			         addin_id == selectedSyncAddin.Id &&
			         selectedSyncAddin.IsConfigured);
			resetSyncAddinButton.Show ();
			bbox.PackStart (resetSyncAddinButton, false, false, 0);

			// TODO: Tabbing should go directly from sync prefs widget to here
			// TODO: Consider connecting to "Enter" pressed in sync prefs widget
			saveSyncAddinButton = new Gtk.Button (Gtk.Stock.Save);
			saveSyncAddinButton.Clicked += OnSaveSyncAddinButton;
			saveSyncAddinButton.Sensitive =
			        (selectedSyncAddin != null &&
			         (addin_id != selectedSyncAddin.Id || !selectedSyncAddin.IsConfigured));
			saveSyncAddinButton.Show ();
			bbox.PackStart (saveSyncAddinButton, false, false, 0);

			syncAddinCombo.Sensitive =
			        (selectedSyncAddin == null ||
			         addin_id != selectedSyncAddin.Id ||
			         !selectedSyncAddin.IsConfigured);

			bbox.Show ();
			vbox.PackStart (bbox, false, false, 0);

			vbox.ShowAll ();
			return vbox;
		}
Ejemplo n.º 26
0
		static void SetLogSearchFilter (ListStore store, string filter)
		{
			TreeIter iter;
			if (store.GetIterFirst (out iter))
				store.SetValue (iter, 1, filter);
		}
        void UpdateTextForIter(TreeIter iter)
        {
            WebDeployTarget target = (WebDeployTarget)targetList.GetValue(iter, LISTCOL_TARGET);

            targetList.SetValue(iter, LISTCOL_TEXT, target.GetMarkup());
        }
		static void UpdateName (ListStore itemStore, TreeIter iter)
		{
			if (iter.Equals (TreeIter.Zero))
				return;

			object item = itemStore.GetValue (iter, 0);
			string name = item.ToString ();
			if (string.IsNullOrEmpty (name))
				name = Mono.Unix.Catalog.GetString ("(Empty)");;

			itemStore.SetValue(iter, 2, name);
		}
Ejemplo n.º 29
0
        private void GenerateNotebookPages()
        {
            string platformName = MainClass.Settings.Platform.Name;

            foreach(Rule rl in MainClass.Settings.Platform.Rules){

                bool iOsNoMac = false;

                if( (rl.Tag == -1 ) && !MainClass.Settings.ShowUnsupportedDevices) continue;
                if( (rl.Tag == -2 ) && !MainClass.Settings.ShowDebugDevices) continue;

                bool validDevice = true;

                if(!Device.CheckDevice(rl.Specific) ){
                    Tool.Logger.Debug("Invalid Device " + rl.Specific);
                    validDevice = false;
                }

                ScrolledWindow sw= new ScrolledWindow();
                sw.ShadowType = ShadowType.EtchedOut;

                TreeView tvList = new TreeView();

                List<CombinePublish> lcp =  project.ProjectUserSetting.CombinePublish.FindAll(x=> x.combineRule.FindIndex(y=>y.ConditionName==platformName && y.RuleId == rl.Id) >-1);
                List<CombinePublish> lcpDennied = new List<CombinePublish>();
                string deviceName = rl.Name;
                int deviceTyp = rl.Id;

                ListStore ls = new ListStore(typeof(bool),typeof(string),typeof(CombinePublish),typeof(string),typeof(bool));

                string ico="empty.png";
                switch (deviceTyp) {
                case (int)DeviceType.Android_1_6:{
                    ico = "android.png";
                    break;}
                case (int)DeviceType.Android_2_2:{
                    ico = "android.png";
                    break;}
                case (int)DeviceType.Bada_1_0:
                case (int)DeviceType.Bada_1_1:
                case (int)DeviceType.Bada_1_2:
                case (int)DeviceType.Bada_2_0:{
                    ico = "bada.png";
                    break;}
                case (int)DeviceType.Symbian_9_4:{
                    ico = "symbian.png";
                    break;}
                case (int)DeviceType.iOS_5_0:{
                    ico = "apple.png";
                    if(!MainClass.Platform.IsMac){
                        iOsNoMac = true;
                    }

                    break;
                }
                case (int)DeviceType.PocketPC_2003SE:
                case (int)DeviceType.WindowsMobile_5:
                case (int)DeviceType.WindowsMobile_6:{
                    ico = "windows.png";
                    break;}
                case (int)DeviceType.Windows:{
                    ico = "win32.png";
                    break;}
                case (int)DeviceType.MacOs:{
                    ico = "macos.png";
                    break;}
                }

                List<CombinePublish> tmp =  lcp.FindAll(x=>x.IsSelected == true);

                NotebookLabel nl = new NotebookLabel(ico,String.Format("{0} ({1})",deviceName,tmp.Count ));
                nl.Tag=deviceTyp;

                if(iOsNoMac){
                    Label lbl=new Label(MainClass.Languages.Translate("ios_available_Mac"));

                    Pango.FontDescription customFont =  Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont);
                    customFont.Weight = Pango.Weight.Bold;
                    lbl.ModifyFont(customFont);

                    notebook.AppendPage(lbl, nl);
                    continue;
                }
                if(!validDevice){
                    Label lbl=new Label(MainClass.Languages.Translate("publish_tool_missing"));

                    Pango.FontDescription customFont =  Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont);
                    customFont.Weight = Pango.Weight.Bold;
                    lbl.ModifyFont(customFont);

                    notebook.AppendPage(lbl, nl);
                    continue;
                }

                ;
                CellRendererToggle crt = new CellRendererToggle();
                crt.Activatable = true;
                crt.Sensitive = true;
                tvList.AppendColumn ("", crt, "active", 0);

                Gtk.CellRendererText fileNameRenderer = new Gtk.CellRendererText();
                Gtk.CellRendererText collumnResolRenderer = new Gtk.CellRendererText();

                tvList.AppendColumn(MainClass.Languages.Translate("file_name"),fileNameRenderer, "text", 1);
                tvList.AppendColumn(MainClass.Languages.Translate("resolution_f1"), collumnResolRenderer, "text", 1);

                tvList.Columns[1].SetCellDataFunc(fileNameRenderer, new Gtk.TreeCellDataFunc(RenderCombine));
                tvList.Columns[2].SetCellDataFunc(collumnResolRenderer, new Gtk.TreeCellDataFunc(RenderResolution));

                // povolene resolution pre danu platformu
                PlatformResolution listPR = MainClass.Settings.PlatformResolutions.Find(x=>x.IdPlatform ==deviceTyp);

                Device dvc  = project.DevicesSettings.Find(x=>x.TargetPlatformId ==deviceTyp);

                string stringTheme = "";
                List<System.IO.DirectoryInfo> themeResolution = new List<System.IO.DirectoryInfo>(); // resolution z adresara themes po novom

                if((project.NewSkin) && (dvc != null)){
                    Skin skin =dvc.Includes.Skin;
                    if((skin != null) && ( !String.IsNullOrEmpty(skin.Name)) && (!String.IsNullOrEmpty(skin.Theme)) ){
                        string skinDir = System.IO.Path.Combine(MainClass.Workspace.RootDirectory,  MainClass.Settings.SkinDir);
                        stringTheme = System.IO.Path.Combine(skinDir,skin.Name);
                        stringTheme = System.IO.Path.Combine(stringTheme, "themes");
                        stringTheme = System.IO.Path.Combine(stringTheme, skin.Theme);

                        if (System.IO.Directory.Exists(stringTheme)){
                            System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(stringTheme);
                            themeResolution = new List<System.IO.DirectoryInfo>(di.GetDirectories());
                        }
                    }
                }

                crt.Toggled += delegate(object o, ToggledArgs args) {
                    if((deviceTyp == (int)DeviceType.Windows)||(deviceTyp == (int)DeviceType.MacOs)){
                        if(!MainClass.LicencesSystem.CheckFunction("windowsandmac",this)){
                            return;
                        }
                    }

                    TreeIter iter;
                    if (ls.GetIter (out iter, new TreePath(args.Path))) {
                        bool old = (bool) ls.GetValue(iter,0);
                        CombinePublish cp =(CombinePublish) ls.GetValue(iter,2);
                        cp.IsSelected = !old;
                        ls.SetValue(iter,0,!old);

                        List<CombinePublish> tmp2 =  lcp.FindAll(x=>x.IsSelected == true);
                        nl.SetLabel (String.Format("{0} ({1})",deviceName,tmp2.Count ));

                        //if(dvc == null) return;
                        //if(dvc.Includes == null) return;
                        if(dvc.Includes.Skin == null) return;
                        if(String.IsNullOrEmpty(dvc.Includes.Skin.Name) || String.IsNullOrEmpty(dvc.Includes.Skin.Theme)) return;

                        if(cp.IsSelected){
                            // Najdem ake je rozlisenie v danej combinacii
                            CombineCondition cc = cp.combineRule.Find(x=>x.ConditionId == MainClass.Settings.Resolution.Id);

                            if(cc == null) return; /// nema ziadne rozlisenie v combinacii

                            int indxResol = themeResolution.FindIndex(x=>x.Name.ToLower() == cc.RuleName.ToLower());
                            if(indxResol<0){
                                // theme chyba prislusne rozlisenie
                                string error =String.Format("Invalid {0} Skin and {1} Theme, using in {2}. Missing resolutions: {3}. ",dvc.Includes.Skin.Name,dvc.Includes.Skin.Theme,deviceName,cc.RuleName.ToLower());
                                MainClass.MainWindow.OutputConsole.WriteError(error+"\n");
                                List<string> lst = new List<string>();
                                lst.Add(error);
                                MainClass.MainWindow.ErrorWritte("","",lst);
                            }
                        }
                    }
                };

                int cntOfAdded = 0;
                foreach (CombinePublish cp in lcp){
                    bool isValid = cp.IsSelected;

                    if (!validDevice) isValid = false;

                    // Najdem ake je rozlisenie v danej combinacii
                    CombineCondition cc = cp.combineRule.Find(x=>x.ConditionId == MainClass.Settings.Resolution.Id);

                    if(cc == null) continue; /// nema ziadne rozlisenie v combinacii

                    int indx = MainClass.Settings.Resolution.Rules.FindIndex(x=> x.Id == cc.RuleId );
                    if(indx<0) continue; /// rozlisenie pouzite v danej combinacii nexistuje

                    if(cc!= null){
                        bool isValidResolution = false;

                        //ak nema definovane ziadne povolenia, tak povolene su vsetky
                        if((listPR==null) || (listPR.AllowResolution == null) ||
                           (listPR.AllowResolution.Count<1)){
                            isValidResolution = true;
                        } else {
                            isValidResolution = listPR.IsValidResolution(cc.RuleId);
                        }

                        if(isValidResolution){
                            // po novom vyhodom aj tie ktore niesu v adresaru themes - pokial je thema definovana
                            if((project.NewSkin) && (themeResolution.Count > 0)){
                                //cntResolution = 0;
                                int indxResol = themeResolution.FindIndex(x=>x.Name.ToLower() == cc.RuleName.ToLower());
                                if(indxResol>-1){
                                    ls.AppendValues(isValid,cp.ProjectName,cp,cp.ProjectName,true);
                                    cntOfAdded++;
                                } else {
                                    lcpDennied.Add(cp);
                                }
                            } else {
                                ls.AppendValues(isValid,cp.ProjectName,cp,cp.ProjectName,true);
                                cntOfAdded++;
                            }

                        } else {
                            lcpDennied.Add(cp);
                        }
                    }
                    //}
                }
                // pridam tie zakazane, ktore su vybrate na publish
                foreach (CombinePublish cp in lcpDennied){
                    if(cp.IsSelected){
                        ls.AppendValues(cp.IsSelected,cp.ProjectName,cp,cp.ProjectName,false);
                        cntOfAdded++;
                    }
                }

                if(cntOfAdded == 0){
                    MainClass.MainWindow.OutputConsole.WriteError(String.Format("Missing publish settings for {0}.\n",deviceName));
                }

                bool showAll = false;
                tvList.ButtonReleaseEvent += delegate(object o, ButtonReleaseEventArgs args){

                    if (args.Event.Button == 3) {
                        TreeSelection ts = tvList.Selection;
                        Gtk.TreePath[] selRow = ts.GetSelectedRows();

                        if(selRow.Length<1){
                            TreeIter tiFirst= new TreeIter();
                            ls.GetIterFirst(out tiFirst);

                            tvList.Selection.SelectIter(tiFirst);
                            selRow = ts.GetSelectedRows();
                        }
                        if(selRow.Length<1) return;

                        Gtk.TreePath tp = selRow[0];
                        TreeIter ti = new TreeIter();

                        ls.GetIter(out ti,tp);

                        CombinePublish combinePublish= (CombinePublish)ls.GetValue(ti,2);

                        if(combinePublish!=null){

                            Menu popupMenu = new Menu();
                            if(!showAll){
                                MenuItem miShowDenied = new MenuItem( MainClass.Languages.Translate("show_denied" ));
                                miShowDenied.Activated+= delegate(object sender, EventArgs e) {

                                    // odoberem zakazane, ktore sa zobrazuju kedze su zaceknute na publish
                                    List<TreeIter> lst= new List<TreeIter>();
                                    ls.Foreach((model, path, iterr) => {

                                        bool cp =(bool) ls.GetValue(iterr,4);
                                        bool selected =(bool) ls.GetValue(iterr,0);
                                        if(!cp && selected){
                                            lst.Add(iterr);
                                        }
                                        return false;
                                    });

                                    foreach(TreeIter ti2 in lst){
                                        TreeIter ti3 =ti2;
                                        ls.Remove(ref ti3);
                                    }

                                    // pridam zakazane
                                    if( (lcpDennied==null) || (lcpDennied.Count<1))
                                        return;

                                    foreach (CombinePublish cp in lcpDennied){
                                        ls.AppendValues(cp.IsSelected,cp.ProjectName,cp,cp.ProjectName,false);
                                    }
                                    showAll = true;
                                };
                                popupMenu.Append(miShowDenied);
                            } else {
                                MenuItem miHideDenied = new MenuItem( MainClass.Languages.Translate("hide_denied" ));
                                miHideDenied.Activated+= delegate(object sender, EventArgs e) {

                                    List<TreeIter> lst= new List<TreeIter>();
                                    ls.Foreach((model, path, iterr) => {

                                        bool cp =(bool) ls.GetValue(iterr,4);
                                        bool selected =(bool) ls.GetValue(iterr,0);
                                        if(!cp && !selected){
                                            lst.Add(iterr);
                                        }
                                        return false;
                                    });

                                    foreach(TreeIter ti2 in lst){
                                        TreeIter ti3 =ti2;
                                        ls.Remove(ref ti3);
                                    }

                                    showAll = false;
                                };
                                popupMenu.Append(miHideDenied);
                            }
                            popupMenu.Append(new SeparatorMenuItem());

                            MenuItem miCheckAll = new MenuItem( MainClass.Languages.Translate("check_all" ));
                            miCheckAll.Activated+= delegate(object sender, EventArgs e) {
                                if((deviceTyp == (int)DeviceType.Windows)||(deviceTyp == (int)DeviceType.MacOs)){
                                    if(!MainClass.LicencesSystem.CheckFunction("windowsandmac",this)){
                                        return;
                                    }
                                }

                                int cnt = 0;
                                ls.Foreach((model, path, iterr) => {
                                    CombinePublish cp =(CombinePublish) ls.GetValue(iterr,2);
                                    cp.IsSelected = true;
                                    ls.SetValue(iterr,0,true);
                                    cnt ++;
                                    return false;
                                });
                                nl.SetLabel (String.Format("{0} ({1})",deviceName,cnt ));

                            };
                            popupMenu.Append(miCheckAll);

                            MenuItem miUnCheckAll = new MenuItem( MainClass.Languages.Translate("uncheck_all" ));
                            miUnCheckAll.Activated+= delegate(object sender, EventArgs e) {
                                ls.Foreach((model, path, iterr) => {
                                    CombinePublish cp =(CombinePublish) ls.GetValue(iterr,2);
                                    cp.IsSelected = false;
                                    ls.SetValue(iterr,0,false);
                                    return false;
                                });
                                nl.SetLabel (String.Format("{0} ({1})",deviceName,0 ));
                            };
                            popupMenu.Append(miUnCheckAll);

                            popupMenu.Popup();
                            popupMenu.ShowAll();
                        }
                    }
                };

                tvList.Model = ls;

                if (!validDevice) tvList.Sensitive = false;

                sw.Add(tvList);
                notebook.AppendPage(sw, nl);
            }
        }
Ejemplo n.º 30
0
        public RenderablesList(string file_name)
        {
            m_unit_file = new UnitFile (file_name);

            m_renderables_names = new List<string> (m_unit_file.renderables_names());
            m_renderables = new List<Renderable> (m_unit_file.renderables());

            Console.Write (m_renderables_names[0]);
            m_renderables_store = new ListStore (typeof (string), typeof (string), typeof (string), typeof(string), typeof(bool));

            TreeView tree = new TreeView ();
            this.Add (tree);

            TreeViewColumn nameColumn = new TreeViewColumn ();
            nameColumn.Title = "Name";
            nameColumn.Alignment = 0.5f;

            TreeViewColumn nodeColumn = new TreeViewColumn ();
            nodeColumn.Title = "Node";
            nodeColumn.Alignment = 0.5f;

            TreeViewColumn typeColumn = new TreeViewColumn ();
            typeColumn.Title = "Type";
            typeColumn.Alignment = 0.5f;

            TreeViewColumn resourceColumn = new TreeViewColumn ();
            resourceColumn.Title = "Resource";
            resourceColumn.Alignment = 0.5f;

            TreeViewColumn visibleColumn = new TreeViewColumn ();
            visibleColumn.Title = "Visible";
            visibleColumn.Alignment = 0.5f;

            // Assign the model to the TreeView
            tree.Model = m_renderables_store;

            CellRendererText nameCell = new CellRendererText ();
            nameCell.Editable = true;
            nameCell.Edited += delegate (object o, EditedArgs e) {
                TreePath path = new TreePath (e.Path);
                TreeIter iter;
                m_renderables_store.GetIter (out iter, path);
                int i = path.Indices[0];

                string r = e.NewText;
                m_renderables_names[i] = r;
                m_renderables_store.SetValue (iter, 0, r);
            };
            nameColumn.PackStart (nameCell, true);

            CellRendererText nodeCell = new CellRendererText ();
            nodeCell.Editable = true;
            nodeCell.Edited += delegate (object o, EditedArgs e) {
                TreePath path = new TreePath (e.Path);
                TreeIter iter;
                m_renderables_store.GetIter (out iter, path);
                int i = path.Indices[0];

                Renderable r = m_renderables[i];
                r.node = e.NewText;
                m_renderables_store.SetValue (iter, 1, r.node);
            };
            nodeColumn.PackStart (nodeCell, true);

            CellRendererText typeCell = new CellRendererText ();
            typeCell.Editable = true;
            typeCell.Edited += delegate (object o, EditedArgs e) {
                TreePath path = new TreePath (e.Path);
                TreeIter iter;
                m_renderables_store.GetIter (out iter, path);
                int i = path.Indices[0];

                Renderable r = m_renderables[i];
                r.type = e.NewText;
                m_renderables_store.SetValue (iter, 2, r.type);
            };
            typeColumn.PackStart (typeCell, true);

            CellRendererText resourceCell = new CellRendererText ();
            resourceCell.Editable = true;
            resourceCell.Edited += delegate (object o, EditedArgs e) {
                TreePath path = new TreePath (e.Path);
                TreeIter iter;
                m_renderables_store.GetIter (out iter, path);
                int i = path.Indices[0];

                Renderable r = m_renderables[i];
                r.resource = e.NewText;
                m_renderables_store.SetValue (iter, 3, r.resource);
            };
            resourceColumn.PackStart (resourceCell, true);

            CellRendererToggle visibleCell = new CellRendererToggle ();
            visibleCell.Activatable = true;
            visibleCell.Toggled += delegate (object o, ToggledArgs e) {
                TreePath path = new TreePath (e.Path);
                TreeIter iter;
                m_renderables_store.GetIter (out iter, path);
                int i = path.Indices[0];

                Renderable r = m_renderables[i];
                bool old = (bool) m_renderables_store.GetValue(iter, 4);
                r.visible = !old;
                m_renderables_store.SetValue(iter, 4, !old);
            };
            visibleColumn.PackStart (visibleCell, true);

            // Add the columns to the TreeView
            nameColumn.AddAttribute (nameCell, "text", 0);
            nodeColumn.AddAttribute (nodeCell, "text", 1);
            typeColumn.AddAttribute (typeCell, "text", 2);
            resourceColumn.AddAttribute (resourceCell, "text", 3);
            visibleColumn.AddAttribute (visibleCell, "active", 4);

            tree.AppendColumn (nameColumn);
            tree.AppendColumn (nodeColumn);
            tree.AppendColumn (typeColumn);
            tree.AppendColumn (resourceColumn);
            tree.AppendColumn (visibleColumn);

            create_model ();

            // Show the window and everything on it
            ShowAll ();
        }
Ejemplo n.º 31
0
        public LibsManagerDialog(string libsInProject, Gtk.Window parentWindow)
        {
            this.TransientFor = parentWindow;
            this.Build();

            if (!String.IsNullOrEmpty(libsInProject))
            {
                libsInProject = libsInProject.Replace(",", " ");
                libsInProject = libsInProject.Replace(";", " ");
                string[] libs = libsInProject.Split(' ');
                projectLibs = new List <string>(libs);
            }
            else
            {
                projectLibs = new List <string>();
            }
            tvLibs.Model = libstListStore;

            CellRendererToggle crt = new CellRendererToggle();

            crt.Activatable = true;
            crt.Toggled    += delegate(object o, ToggledArgs args) {
                TreeIter iter;
                if (libstListStore.GetIter(out iter, new TreePath(args.Path)))
                {
                    bool   old              = (bool)libstListStore.GetValue(iter, 2);
                    string libSelect        = (string)libstListStore.GetValue(iter, 0);
                    bool   libMissing       = (bool)libstListStore.GetValue(iter, 3);
                    string frameworkLibPath = (string)libstListStore.GetValue(iter, 4);
                    string state            = (string)libstListStore.GetValue(iter, 1);

                    if (!MainClass.LicencesSystem.CheckFunction(libSelect, this))
                    {
                        return;
                    }

                    int resultAction = 0;

                    if (old)
                    {
                        projectLibs.Remove(libSelect);
                    }
                    else
                    {
                        if (libMissing)
                        {
                            MessageDialogs md =
                                new MessageDialogs(new string[] { MainClass.Languages.Translate("as_link"), MainClass.Languages.Translate("copy_f2"), MainClass.Languages.Translate("cancel") }, MainClass.Languages.Translate("add_library_to_workspace", libSelect), "", Gtk.MessageType.Question, this);
                            resultAction = md.ShowDialog();

                            //Console.WriteLine("resultAction->{0}",resultAction);

                            switch (resultAction)
                            {
                            case -1:                                 //"As Link"
                                try{
                                    MainClass.Tools.CreateLinks(frameworkLibPath, MainClass.Workspace.RootDirectory, true, true);
                                    state = MainClass.Languages.Translate("linked");
                                } catch (Exception ex) {
                                    MessageDialogs mdEror =
                                        new MessageDialogs(MessageDialogs.DialogButtonType.Ok, ex.Message, "", Gtk.MessageType.Error);
                                    mdEror.ShowDialog();
                                    return;
                                }
                                break;

                            case -2:                                //"Copy"
                                string fullLibDir = System.IO.Path.Combine(MainClass.Workspace.RootDirectory, libSelect);
                                MainClass.Tools.CopyDirectory(frameworkLibPath, fullLibDir, true, true);
                                state = MainClass.Languages.Translate("copied");
                                break;

                            default:                                 //"Cancel"
                                break;
                            }
                        }
                        projectLibs.Add(libSelect);
                    }
                    //LoadLibs();
                    libstListStore.SetValue(iter, 2, !old);
                    libstListStore.SetValue(iter, 1, state);
                    //}
                }
            };


            tvLibs.AppendColumn("", crt, "active", 2);
            tvLibs.AppendColumn(MainClass.Languages.Translate("lib_name"), new Gtk.CellRendererText(), "text", 0);
            tvLibs.AppendColumn(MainClass.Languages.Translate("workspace_location"), new Gtk.CellRendererText(), "text", 1);

            LoadLibs();
        }
Ejemplo n.º 32
0
        private void AddTagsTab()
        {
            Table tags_table = new Table(1, 2, false);
            tags_table.BorderWidth = 5;
            tags_table.ColumnSpacing = 10;
            tags_table.RowSpacing = 10;

            ScrolledWindow tags_swin = new ScrolledWindow();
            tags_swin.ShadowType = ShadowType.In;
            tags_swin.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
            tags_table.Attach(tags_swin, 0, 1, 0, 1);

            cr_toggle = new CellRendererToggle();
            cr_toggle.Activatable = true;
            cr_toggle.Toggled += new ToggledHandler(OnCrToggleToggled);
            tv_tags = new TreeView();
            tags_swin.Add(tv_tags);

            store_tags = new ListStore(typeof(bool), typeof(string));
            tv_tags.Model = store_tags;

            // set up the columns for the view
            TreeViewColumn column_Read = new TreeViewColumn("Use", cr_toggle, "active", 0);
            tv_tags.AppendColumn(column_Read);

            TreeViewColumn column_Name = new TreeViewColumn("Title", new CellRendererText(), "text", 1);
            tv_tags.AppendColumn(column_Name);

            foreach ( string tag in Feeds.GetTags() ) {
                TreeIter iter = store_tags.Append();
                if ( feed.Tags.Contains(tag) ) {
                    store_tags.SetValue(iter, 0, true);
                } else {
                    store_tags.SetValue(iter, 0, false);
                }
                store_tags.SetValue(iter, 1, tag);
            }

            ButtonBox tags_bbox = new HButtonBox();
            tags_bbox.Layout = ButtonBoxStyle.End;
            tags_table.Attach(tags_bbox, 0, 1, 1, 2);

            Button add_button = new Button(Stock.Add);
            add_button.Clicked += new EventHandler(OnAddButtonClicked);
            tags_bbox.PackStart(add_button);

            notebook.AppendPage(tags_table, new Label("Tags"));
        }
    public static void Copy(TreeModel tree, TreeIter tree_iter, ListStore list, bool first)
    {
        // Copy this iter's values to the list
                TreeIter list_iter = list.Append();
                for (int i = 0; i < list.NColumns; i++) {
                        list.SetValue(list_iter, i, tree.GetValue(tree_iter, i));
                        if (i == 1) {
                                //Console.WriteLine("Copying {0}", list.GetValue(list_iter, i));
                        }
                }

                // Copy the first child, which will trigger the copy if its siblings (and their children)
                TreeIter child_iter;
                if (tree.IterChildren(out child_iter, tree_iter)) {
                        Copy(tree, child_iter, list, true);
                }

                // Add siblings and their children if we are the first child, otherwise doing so would repeat
                if (first) {
                        while (tree.IterNext(ref tree_iter)) {
                                Copy(tree, tree_iter, list, false);
                        }
                }
    }
Ejemplo n.º 34
0
		private Container ICSelector ()
		{
			ScrolledWindow sw = new ScrolledWindow ();
			ICStore = new ListStore ((int) GLib.TypeFundamentals.TypeString, (int) GLib.TypeFundamentals.TypeInt);
			ICView = new TreeView (ICStore);
			TreeViewColumn col = new TreeViewColumn ();
			TreeIter iter;
			CellRenderer renderer = new CellRendererText ();

			col.Title = "MemberType";
			col.PackStart (renderer, true);
			col.AddAttribute (renderer, "markup", 0);
			ICView.AppendColumn (col);
			ICView.HeadersVisible = false;

			ICStore.Append (out iter);
			ICStore.SetValue (iter, 0, new GLib.Value (ICLabel ("all", factory.staticCount + factory.instanceCount)));
			ICStore.SetValue (iter, 1, new GLib.Value ((int) (BindingFlags.Static | BindingFlags.Instance)));
			ICStore.Append (out iter);
			ICStore.SetValue (iter, 0, new GLib.Value (ICLabel ("instance", factory.instanceCount)));
			ICStore.SetValue (iter, 1, new GLib.Value ((int) BindingFlags.Instance));
			ICStore.Append (out iter);
			ICStore.SetValue (iter, 0, new GLib.Value (ICLabel ("class", factory.staticCount)));
			ICStore.SetValue (iter, 1, new GLib.Value ((int) BindingFlags.Static));

			ICView.Selection.SelectPath (new TreePath ("0"));
			ICView.Selection.Changed += new EventHandler (ICSelectionChanged);
			ICView.BorderWidth = 5;

			sw.Add (ICView);
			return sw;
		}
Ejemplo n.º 35
0
		public IPhoneBuildOptionsWidget ()
		{
			this.Build ();
			extraArgsEntry.AddOptions (menuOptions);
			
			linkCombo.AppendText ("Don't link"); //MtouchLinkMode.None
			linkCombo.AppendText ("Link SDK assemblies only"); //MtouchLinkMode.SdkOnly
			linkCombo.AppendText ("Link all assemblies"); //MtouchLinkMode.All
			
			foreach (var v in IPhoneFramework.InstalledSdkVersions)
				sdkComboEntry.AppendText (v.ToString ());
			
			sdkComboEntry.Changed += HandleSdkComboEntryChanged;
			
			store = new ListStore (typeof (string), typeof (bool));
			i18nTreeView.Model = store;
			
			var toggle = new CellRendererToggle ();
			i18nTreeView.AppendColumn ("", toggle, "active", 1);
			i18nTreeView.AppendColumn ("", new CellRendererText (), "text", 0);
			i18nTreeView.HeadersVisible = false;
			toggle.Toggled += delegate (object o, ToggledArgs args) {
				TreeIter iter;
				if (store.GetIter (out iter, new TreePath (args.Path)))
					store.SetValue (iter, 1, !(bool)store.GetValue (iter, 1));
			};
			
			this.ShowAll ();
		}
Ejemplo n.º 36
0
		private Container MemberSelector ()
		{
			ScrolledWindow sw = new ScrolledWindow ();
			memberStore = new ListStore ((int) GLib.TypeFundamentals.TypeString, (int) GLib.TypeFundamentals.TypeInt);
			MTView = new TreeView (memberStore);
			TreeViewColumn col = new TreeViewColumn ();
			TreeIter iter;
			CellRenderer renderer = new CellRendererText ();

			col.Title = "MemberType";
			col.PackStart (renderer, true);
			col.AddAttribute (renderer, "markup", 0);
			MTView.AppendColumn (col);
			MTView.HeadersVisible = false;

			foreach (MemberRecordFactory rv in recordFactory) {
				memberStore.Append (out iter);
				memberStore.SetValue (iter, 0, new GLib.Value (rv.FullTitle));
			}

			MTView.Selection.SelectPath (new TreePath ("0"));
			MTView.Selection.Changed += new EventHandler (MemberFilterSelectionChanged);
			MTView.BorderWidth = 5;

			sw.Add (MTView);

			return sw;
		}
		static void UpdateIndices (ListStore itemStore)
		{
			TreeIter iter;
			int i = 0;
			if (!itemStore.GetIterFirst (out iter))
				return;
			
			do {
				itemStore.SetValue (iter, 1, i);
				i++;
			} while (itemStore.IterNext (ref iter));
		}
Ejemplo n.º 38
0
		private void AddToStore (ListStore store, GLib.Value field, GLib.Value value, GLib.Value details, GLib.Value icon)
		{
			TreeIter iter = store.Append ();
			store.SetValue (iter, 0, field);
			store.SetValue (iter, 1, value);
			store.SetValue (iter, 2, details);
			store.SetValue (iter, 3, icon);
		}
		public override void LaunchDialogue ()
		{
			//the Type in the collection
			IList collection = (IList) Value;
			string displayName = Property.DisplayName;

			//populate list with existing items
			ListStore itemStore = new ListStore (typeof (object), typeof (int), typeof (string));
			for (int i=0; i<collection.Count; i++)
				itemStore.AppendValues(collection [i], i, collection [i].ToString ());

			#region Building Dialogue
			
			TreeView itemTree;
			PropertyGrid grid;
			TreeIter previousIter = TreeIter.Zero;

			//dialogue and buttons
			Dialog dialog = new Dialog () {
				Title = displayName + " Editor",
				Modal = true,
				AllowGrow = true,
				AllowShrink = true,
			};
			var toplevel = this.Container.Toplevel as Window;
			if (toplevel != null)
				dialog.TransientFor = toplevel;
			
			dialog.AddActionWidget (new Button (Stock.Cancel), ResponseType.Cancel);
			dialog.AddActionWidget (new Button (Stock.Ok), ResponseType.Ok);
			
			//three columns for items, sorting, PropGrid
			HBox hBox = new HBox ();
			dialog.VBox.PackStart (hBox, true, true, 5);

			//propGrid at end
			grid = new PropertyGrid (base.EditorManager) {
				CurrentObject = null,
				WidthRequest = 200,
				ShowHelp = false
			};
			hBox.PackEnd (grid, true, true, 5);

			//followed by a ButtonBox
			VBox buttonBox = new VBox ();
			buttonBox.Spacing = 6;
			hBox.PackEnd (buttonBox, false, false, 5);
			
			//add/remove buttons
			Button addButton = new Button (new Image (Stock.Add, IconSize.Button));
			buttonBox.PackStart (addButton, false, false, 0);
			if (types [0].IsAbstract)
				addButton.Sensitive = false;
			Button removeButton = new Button (new Gtk.Image (Stock.Remove, IconSize.Button));
			buttonBox.PackStart (removeButton, false, false, 0);
			
			//sorting buttons
			Button upButton = new Button (new Image (Stock.GoUp, IconSize.Button));
			buttonBox.PackStart (upButton, false, false, 0);
			Button downButton = new Button (new Image (Stock.GoDown, IconSize.Button));
			buttonBox.PackStart (downButton, false, false, 0);

			//Third column has list (TreeView) in a ScrolledWindow
			ScrolledWindow listScroll = new ScrolledWindow ();
			listScroll.WidthRequest = 200;
			listScroll.HeightRequest = 320;
			hBox.PackStart (listScroll, false, false, 5);
			
			itemTree = new TreeView (itemStore);
			itemTree.Selection.Mode = SelectionMode.Single;
			itemTree.HeadersVisible = false;
			listScroll.AddWithViewport (itemTree);

			//renderers and attribs for TreeView
			CellRenderer rdr = new CellRendererText ();
			itemTree.AppendColumn (new TreeViewColumn ("Index", rdr, "text", 1));
			rdr = new CellRendererText ();
			itemTree.AppendColumn (new TreeViewColumn ("Object", rdr, "text", 2));

			#endregion

			#region Events

			addButton.Clicked += delegate {
				//create the object
				object instance = System.Activator.CreateInstance (types[0]);
				
				//get existing selection and insert after it
				TreeIter oldIter, newIter;
				if (itemTree.Selection.GetSelected (out oldIter))
					newIter = itemStore.InsertAfter (oldIter);
				//or append if no previous selection 
				else
					newIter = itemStore.Append ();
				itemStore.SetValue (newIter, 0, instance);
				
				//select, set name and update all the indices
				itemTree.Selection.SelectIter (newIter);
				UpdateName (itemStore, newIter);
				UpdateIndices (itemStore);
			};
			
			removeButton.Clicked += delegate {
				//get selected iter and the replacement selection
				TreeIter iter, newSelection;
				if (!itemTree.Selection.GetSelected (out iter))
					return;
				
				newSelection = iter;
				if (!IterPrev (itemStore, ref newSelection)) {
					newSelection = iter;
					if (!itemStore.IterNext (ref newSelection))
						newSelection = TreeIter.Zero;
				}
				
				//new selection. Zeroing previousIter prevents trying to update name of deleted iter.
				previousIter = TreeIter.Zero;
				if (itemStore.IterIsValid (newSelection))
					itemTree.Selection.SelectIter (newSelection);
				
				//and the removal and index update
				itemStore.Remove (ref iter);
				UpdateIndices (itemStore);
			};
			
			upButton.Clicked += delegate {
				TreeIter iter, prev;
				if (!itemTree.Selection.GetSelected (out iter))
					return;
	
				//get previous iter
				prev = iter;
				if (!IterPrev (itemStore, ref prev))
					return;
	
				//swap the two
				itemStore.Swap (iter, prev);
	
				//swap indices too
				object prevVal = itemStore.GetValue (prev, 1);
				object iterVal = itemStore.GetValue (iter, 1);
				itemStore.SetValue (prev, 1, iterVal);
				itemStore.SetValue (iter, 1, prevVal);
			};
			
			downButton.Clicked += delegate {
				TreeIter iter, next;
				if (!itemTree.Selection.GetSelected (out iter))
					return;
	
				//get next iter
				next = iter;
				if (!itemStore.IterNext (ref next))
					return;
				
				//swap the two
				itemStore.Swap (iter, next);
	
				//swap indices too
				object nextVal = itemStore.GetValue (next, 1);
				object iterVal = itemStore.GetValue (iter, 1);
				itemStore.SetValue (next, 1, iterVal);
				itemStore.SetValue (iter, 1, nextVal);
			};
			
			itemTree.Selection.Changed += delegate {
				TreeIter iter;
				if (!itemTree.Selection.GetSelected (out iter)) {
					removeButton.Sensitive = false;
					return;
				}
				removeButton.Sensitive = true;
	
				//update grid
				object obj = itemStore.GetValue (iter, 0);
				grid.CurrentObject = obj;
				
				//update previously selected iter's name
				UpdateName (itemStore, previousIter);
				
				//update current selection so we can update
				//name next selection change
				previousIter = iter;
			};
			
			grid.Changed += delegate {
				TreeIter iter;
				if (itemTree.Selection.GetSelected (out iter))
					UpdateName (itemStore, iter);
			};
			
			TreeIter selectionIter;
			removeButton.Sensitive = itemTree.Selection.GetSelected (out selectionIter);
			
			dialog.ShowAll ();
			grid.ShowToolbar = false;
			
			#endregion
			
			//if 'OK' put items back in collection
			//if (MonoDevelop.Ide.MessageService.ShowCustomDialog (dialog, toplevel) == (int)ResponseType.Ok)
			{
				DesignerTransaction tran = CreateTransaction (Instance);
				object old = collection;
			
				try {
					collection.Clear();
					foreach (object[] o in itemStore)
						collection.Add (o[0]);
					EndTransaction (Instance, tran, old, collection, true);
				}
				catch {
					EndTransaction (Instance, tran, old, collection, false);
					throw;
				}
			}
		}
Ejemplo n.º 40
0
        void UpdateAttachments()
        {
            var task = SelectedTask;
            var model = new ListStore (typeof (Gdk.Pixbuf),
                                       typeof (String),
                                       typeof (String));

            if (task != null && task.Attachments != null) {
                foreach (string item in task.Attachments) {
                    var iter = model.Append ();
                    var info = new System.IO.FileInfo (item);
                    model.SetValue (iter, 0, GetPixbuf (Stock.File));
                    model.SetValue (iter, 1, info.Name);
                    model.SetValue (iter, 2, item);
                }
            }

            m_tasksIconView.Model = model;
        }
Ejemplo n.º 41
0
        private Gtk.ComboBox FilterComboBox()
        {
            filter_data = new Gtk.ListStore(new Type[] { typeof(string), typeof(string) });

            Gtk.TreeIter iter;

            iter = filter_data.Append();
            filter_data.SetValue(iter, 0, Catalog.GetString("Anywhere"));
            filter_data.SetValue(iter, 1, null);

            iter = filter_data.Append();
            filter_data.SetValue(iter, 0, Catalog.GetString("in Files"));
            filter_data.SetValue(iter, 1, "File");

            iter = filter_data.Append();
            filter_data.SetValue(iter, 0, Catalog.GetString("in Addressbook"));
            filter_data.SetValue(iter, 1, "Contact");

            iter = filter_data.Append();
            filter_data.SetValue(iter, 0, Catalog.GetString("in Mail"));
            filter_data.SetValue(iter, 1, "MailMessage");

            iter = filter_data.Append();
            filter_data.SetValue(iter, 0, Catalog.GetString("in Web Pages"));
            filter_data.SetValue(iter, 1, "WebHistory");

            iter = filter_data.Append();
            filter_data.SetValue(iter, 0, Catalog.GetString("in Chats"));
            filter_data.SetValue(iter, 1, "IMLog");

            Gtk.ComboBox combo = new Gtk.ComboBox(filter_data);
            combo.Active = 0;

            Gtk.CellRendererText renderer = new Gtk.CellRendererText();
            combo.PackStart(renderer, false);
            combo.SetAttributes(renderer, new object[] { "text", 0 });

            return(combo);
        }
Ejemplo n.º 42
0
		private Gtk.ComboBox FilterComboBox ()
		{
			filter_data = new Gtk.ListStore (new Type[] { typeof (string), typeof (string) });
			
			Gtk.TreeIter iter;

			iter = filter_data.Append ();
			filter_data.SetValue (iter, 0, Catalog.GetString ("Anywhere"));
			filter_data.SetValue (iter, 1, null);

			iter = filter_data.Append ();
			filter_data.SetValue (iter, 0, Catalog.GetString ("in Files"));
			filter_data.SetValue (iter, 1, "File");

			iter = filter_data.Append ();
			filter_data.SetValue (iter, 0, Catalog.GetString ("in Addressbook"));
			filter_data.SetValue (iter, 1, "Contact");

			iter = filter_data.Append ();
			filter_data.SetValue (iter, 0, Catalog.GetString ("in Mail"));
			filter_data.SetValue (iter, 1, "MailMessage");

			iter = filter_data.Append ();
			filter_data.SetValue (iter, 0, Catalog.GetString ("in Web Pages"));
			filter_data.SetValue (iter, 1, "WebHistory");

			iter = filter_data.Append ();
			filter_data.SetValue (iter, 0, Catalog.GetString ("in Chats"));
			filter_data.SetValue (iter, 1, "IMLog");

			Gtk.ComboBox combo = new Gtk.ComboBox (filter_data);
			combo.Active = 0;

			Gtk.CellRendererText renderer = new Gtk.CellRendererText ();
			combo.PackStart (renderer, false);
			combo.SetAttributes (renderer, new object[] { "text", 0 });

			return combo;
		}
Ejemplo n.º 43
0
		private void Append (ListStore store, MemberRecord mr, Type type)
		{
			TreeIter iter;
			store.Append (out iter);

			store.SetValue (iter, 0, new GLib.Value (mr.Label));
			store.SetValue (iter, 1, new GLib.Value (type.FullName));
			store.SetValue (iter, 2, new GLib.Value (mr.Icon));
			store.SetValue (iter, 3, new GLib.Value (mr.GetType () == typeof (TypeRecord)));
		}
Ejemplo n.º 44
0
        public static void ShowContributors(TreeView treeview)
        {
            #if DEBUG
            Console.WriteLine("TreeViewHelper.ShowContributors");
            #endif
            string helpFile = FileHelper.FindSupportFile("bygfoot_help", true);
            if (string.IsNullOrEmpty(helpFile))
            {
                GameGUI.ShowWarning(Mono.Unix.Catalog.GetString("Didn't find file 'bygfoot_help'."));
                return;
            }
            OptionList helpList = null;
            FileHelper.LoadOptFile(helpFile, ref helpList, false);

            // Set treeview properties
            treeview.Selection.Mode = SelectionMode.None;
            treeview.RulesHint = false;
            treeview.HeadersVisible = false;

            TreeViewColumn column = new TreeViewColumn();
            treeview.AppendColumn(column);
            CellRenderer cell = TreeViewHelper.TextCellRenderer();
            column.PackStart(cell, true);
            column.AddAttribute(cell, "markup", 0);

            ListStore ls = new ListStore(typeof(string));
            for (int i = 0; i < helpList.list.Count; i++)
            {
                TreeIter iter = ls.Append();
                OptionStruct option = (OptionStruct)helpList.list[i];
                if (option.name.StartsWith("string_contrib_title"))
                {
                    string value = string.Format("\n<span {0}>{1}</span>", Option.ConstApp("string_help_window_title_attribute"), option.stringValue);
                    ls.SetValue(iter, 0, value);
                }
                else
                {
                    ls.SetValue(iter, 0, option.stringValue);
                }
            }

            treeview.Model = ls;
        }