コード例 #1
0
        protected virtual void OnButtonAddMimeTypeClicked(object sender, System.EventArgs e)
        {
            TreeIter it = storeMimeTypes.AppendValues("", "");

            treeMimeTypes.Selection.SelectIter(it);
            treeMimeTypes.SetCursor(storeMimeTypes.GetPath(it), treeMimeTypes.Columns [0], true);
        }
コード例 #2
0
        private int GetIndex(TreePath path)
        {
            TreeIter iter;

            TreeViewTable.GetIter(out iter, path);
            return(TreeViewTable.GetPath(iter).Indices[0]);
        }
コード例 #3
0
        void OnKeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.Event.Key == Gdk.Key.v && e.Event.State == Gdk.ModifierType.ControlMask)
            {
                // ctrl+v
                this.GetClipboard(Gdk.Selection.Clipboard).RequestText(OnPaste);
            }
            else if (e.Event.Key == Gdk.Key.r && e.Event.State == Gdk.ModifierType.ControlMask)
            {
                // ctrl+r, refresh list
                TreeIter selIter;
                instList.Selection.GetSelected(out selIter);
                string selPath = (instListStore.GetValue(selIter, 0) as Instance).path.FileName;

                Instance.RefreshList();

                instListStore.Clear();
                TreeIter nSelIter; instListStore.GetIterFirst(out nSelIter);
                foreach (Instance inst in Instance.list)
                {
                    var iter = instListStore.AppendValues(inst);
                    if (inst.path.FileName == selPath)
                    {
                        nSelIter = iter;
                    }
                }
                instList.Selection.SelectIter(nSelIter);
                instList.ScrollToCell(instListStore.GetPath(nSelIter), instList.Columns[0], false, 0, 0);
                UpdateButtonBar();

                SystemSounds.Asterisk.Play(); // signal that it at least did something
            }
        }
コード例 #4
0
        protected virtual void OnButtonRemoveClicked(object sender, System.EventArgs e)
        {
            TreeIter it;

            if (tree.Selection.GetSelected(out it))
            {
                object ob = store.GetValue(it, 1);
                if (ob is MonoRuntimeInfo)
                {
                    newInfos.Remove((MonoRuntimeInfo)ob);
                }
                else
                {
                    TargetRuntime tr = (TargetRuntime)ob;
                    if (tr.IsRunning)
                    {
                        return;
                    }
                    removedRuntimes.Add(tr);
                }
                if (store.GetPath(it).Equals(store.GetPath(defaultIter)))
                {
                    defaultIter = runningIter;
                    UpdateRow(defaultIter);
                }
                store.Remove(ref it);
            }
        }
コード例 #5
0
        protected void OnUpClicked(object ob, EventArgs args)
        {
            TreeModel model;
            TreeIter  iter;

            if (listSelected.Selection.GetSelected(out model, out iter))
            {
                TreePath iterPath = storeSelected.GetPath(iter);
                TreeIter oldIter;
                if (storeSelected.GetIterFirst(out oldIter))
                {
                    if (storeSelected.GetPath(oldIter).Equals(iterPath))
                    {
                        return;
                    }

                    TreeIter prevIter;

                    do
                    {
                        prevIter = oldIter;
                        if (!storeSelected.IterNext(ref oldIter))
                        {
                            return;
                        }
                    }while (!storeSelected.GetPath(oldIter).Equals(iterPath));
                    storeSelected.Swap(prevIter, iter);
                }

                storeSelected.Swap(oldIter, iter);
            }
        }
コード例 #6
0
        protected void OnButtonAddClicked(object sender, EventArgs e)
        {
            DialogSelectPrc dlSP = new DialogSelectPrc();
            ResponseType    resp = (ResponseType)dlSP.Run();

            if (Gtk.ResponseType.Ok == resp)
            {
                if (1 > lsPrcs.IterNChildren())                   // empty, add prc directly
                {
                    currentTsk.processes.Add(Group <Process> .GFindWithName(dlSP.selectedPrcName));
                    lsPrcs.AppendValues(dlSP.selectedPrcName);
                }
                else
                {
                    TreeIter ti;
                    if (this.treeviewProcesses.Selection.GetSelected(out ti))                        // add after the selected prc
                    {
                        TreePath tp = lsPrcs.GetPath(ti);
                        currentTsk.processes.Insert((tp.Indices [0] + 1), Group <Process> .GFindWithName(dlSP.selectedPrcName));
                        ti = lsPrcs.InsertAfter(ti);
                        lsPrcs.SetValue(ti, 0, dlSP.selectedPrcName);
                    }
                    else                         // Add at the end
                    {
                        currentTsk.processes.Add(Group <Process> .GFindWithName(dlSP.selectedPrcName));
                        lsPrcs.AppendValues(dlSP.selectedPrcName);
                    }
                }
            }
            dlSP.Destroy();
        }
コード例 #7
0
        protected virtual void OnButtonAddEntryClicked(object sender, System.EventArgs e)
        {
            TreeIter it = storeEntries.AppendValues("", "", "");

            treeEntries.Selection.SelectIter(it);
            entryKeyCell.Editable = true;
            treeEntries.SetCursor(storeEntries.GetPath(it), treeEntries.Columns [0], true);
        }
コード例 #8
0
        /// <summary>
        /// Carga una nueva imagen en la lista.
        /// </summary>
        /// <param name="image">
        /// La imagen a cargar.
        /// </param>
        private void LoadNewImage(Gdk.Pixbuf image)
        {
            Gdk.Pixbuf smallImage = ImageUtils.MakeThumbnail(image, 48);
            TreeIter   iter       = imagesStore.AppendValues(smallImage, image);

            imagesIV.ScrollToPath(imagesStore.GetPath(iter));
            imagesIV.SelectPath(imagesStore.GetPath(iter));
        }
コード例 #9
0
        protected virtual void DownClicked(object sender, EventArgs e)
        {
            TreeIter iter;

            if (treeColumns.Selection.GetSelected(out iter))
            {
                TreePath path = storeColumns.GetPath(iter);
                int      x    = path.Indices[0];
                columns.Swap(x, x + 1);
            }
        }
コード例 #10
0
        private void OnControllerTokenMatchingFinished(object sender,
                                                       TokenMatchingFinishedArgs _args)
        {
            Application.Invoke(sender,
                               _args,
                               delegate(object resender, EventArgs a)
            {
                TokenMatchingFinishedArgs args = (TokenMatchingFinishedArgs)a;

                string tokenType = args.ExpectedType;

                if (args.MatchedToken != null)
                {
                    int idx = SearchToken(args.MatchedToken);
                    remainingItemsStore.IterNthChild(out selectedRemainingItem,
                                                     idx);
                    TreePath selectedPath =
                        remainingItemsStore.GetPath(selectedRemainingItem);

                    remainingItemsIconView.SelectPath(selectedPath);
                    remainingItemsIconView.ScrollToPath(selectedPath, 0.5f, 0f);

                    this.MarkImage(args.MatchedToken);

                    parsingTaskLabel.Markup =
                        String.Format("<b>Se encontró un item válido del tipo <i>{0}</i>, <i>{1}</i> entre los items restantes</b>",
                                      GLib.Markup.EscapeText(tokenType),
                                      GLib.Markup.EscapeText(args.MatchedToken.Text));

                    currentNode.AddMatchedToken(args.MatchedToken);
                    currentNode.Select();

                    remainingItemsStore.Remove(ref selectedRemainingItem);

                    TreeIter first;
                    if (remainingItemsStore.GetIterFirst(out first))
                    {
                        remainingItemsIconView.ScrollToPath(remainingItemsStore.GetPath(first));
                    }
                }
                else
                {
                    parsingTaskLabel.Markup =
                        String.Format("<b>No se encotró un item válido del tipo <i>{0}</i> entre los items restantes</b>",
                                      GLib.Markup.EscapeText(tokenType));
                }

                if (controller.StepMode != ControllerStepMode.UntilEnd)
                {
                    parsingNextButtonsAlign.Sensitive = true;
                }
            });
        }
コード例 #11
0
ファイル: EditDebaters.cs プロジェクト: JLimperg/opdtab
        protected virtual void OnBtnDebaterAddClicked(object sender, EventArgs e)
        {
            if (newDebaterPath != null)
            {
                return;
            }
            entryDebatersFilter.Text = "";

            EditableDebater d = new EditableDebater();

            newDebaterPath = store.GetPath(store.AppendValues(d));
            treeDebaters.SetCursor(ConvertStorePathToModelPath(newDebaterPath), treeDebaters.Columns[0], true);
        }
コード例 #12
0
        /// <summary>
        /// Añade un icono representando un archivo de imagen a la vista
        /// de iconos del panel.
        /// </summary>
        /// <param name="image">
        /// The image to be added.
        /// </param>
        /// <param name="fileName">
        /// La ruta del archivo que se añade al conjunto de archivos.
        /// </param>
        public void AddImageFile(Gdk.Pixbuf image, string fileName)
        {
            // Aqui añadimos un icono al IconView.

            Gdk.Pixbuf icon = ImageUtils.MakeThumbnail(image, 48);

            TreeIter iter =
                fileStore.AppendValues(
                    icon, Path.GetFileName(fileName), fileName, image);

            filesIconView.ScrollToPath(fileStore.GetPath(iter));

            filesIconView.SelectPath(fileStore.GetPath(iter));
        }
コード例 #13
0
        /// <summary>
        /// Adds a rule to the rule list.
        /// </summary>
        /// <param name="rule">
        /// A <see cref="SyntacticalRule"/>
        /// </param>
        private void AddRule(SyntacticalRule rule)
        {
            string [] parts = rule.ToString().Split(':');

            TreeIter iter = synRulesModel.AppendValues(parts[0] + " :",
                                                       parts[1],
                                                       rule);

            synRulesTree.Selection.SelectIter(iter);


            synRulesTree.ScrollToCell(synRulesModel.GetPath(iter),
                                      synRulesTree.Columns[0],
                                      true, 0.5f, 0);
        }
コード例 #14
0
        private void FindListItem(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return;
            }
            TreeIter iter = TreeIter.Zero;

            _listStore.Foreach((model, path, it) =>
            {
                var item = ((BaseItem)model.GetValue(it, 0));
                if (string.Equals(item.ServerPath.ItemName, name, StringComparison.OrdinalIgnoreCase))
                {
                    iter = it;
                    return(true);
                }
                return(false);
            });
            if (iter.Equals(TreeIter.Zero))
            {
                return;
            }
            _listView.Selection.SelectIter(iter);
            var treePath = _listStore.GetPath(iter);

            _listView.ScrollToCell(treePath, _listView.Columns[0], false, 0, 0);
        }
コード例 #15
0
        public void ReloadStats(LMPlayer player)
        {
            PlayerStats playerStats;
            TreeIter    iter;
            TreePath    selected = null;

            playerStats = pstats.GetPlayerStats(player);

            treeview.Selection.GetSelected(out iter);
            if (store.IterIsValid(iter))
            {
                selected = store.GetPath(iter);
            }

            store.Clear();
            foreach (PlayerEventTypeStats petats in playerStats.PlayerEventStats)
            {
                store.AppendValues(petats, petats.EventType.Name);
            }

            /* Keep the selected category for when we reload the stats changing players */
            if (selected != null)
            {
                store.GetIter(out iter, selected);
            }
            else
            {
                store.GetIterFirst(out iter);
            }
            treeview.Selection.SelectIter(iter);
            categoryviewer.LoadStats(store.GetValue(iter, 0) as PlayerEventTypeStats);
        }
コード例 #16
0
ファイル: MeshList.cs プロジェクト: cyril12/Tr3Smoothing
        /// <summary>
        /// Called when the meshes in the scene have changed. Updates the displayed mesh list.
        /// </summary>
        private void OnMeshesChanged(IEnumerable <MeshInfo> meshes)
        {
            m_treeView.Selection.Changed -= OnListSelectionChanged;

            m_listStore.Clear();
            m_indexToMesh.Clear();
            m_meshToIndex.Clear();

            TreeIter iter = new TreeIter();

            foreach (MeshInfo mesh in meshes)
            {
                iter = m_listStore.AppendValues(mesh.IsVisible, mesh.Mesh.Name);
                TreePath path = m_listStore.GetPath(iter);

                if (mesh.IsSelected)
                {
                    m_treeView.Selection.SelectPath(path);
                }

                m_indexToMesh.Add(path.Indices[0], mesh);
                m_meshToIndex.Add(mesh, path.Indices[0]);
            }

            m_treeView.Selection.Changed += OnListSelectionChanged;
        }
コード例 #17
0
        protected void OnValueTableKeyPressEvent(object o, KeyPressEventArgs args)
        {
            try
            {
                if (args.Event.Key == Gdk.Key.Delete)
                {
                    TreeIter iter;
                    table.GetIter(out iter, ValueTable.Selection.GetSelectedRows()[0]);
                    int index = table.GetPath(iter).Indices[0];

                    if (index == 0 && fst.HasReferenceImage)
                    {
                        fst.RemovReferenceImage();
                    }
                    else if (fst.HasReferenceImage)
                    {
                        fst.RemoveFilterImage(index - 1);
                    }
                    else
                    {
                        fst.RemoveFilterImage(index);
                    }

                    saved = false;
                    UpdateTable();
                }
            }
            catch (Exception ex) { ErrorReport.ReportError("ValueTableKeyPress (Create Filterset)", ex); }
        }
コード例 #18
0
ファイル: CategoriesViewer.cs プロジェクト: kuggaa/longomatch
        public void ReloadStats()
        {
            TreeIter iter;
            TreePath selected = null;

            pstats.UpdateStats();

            treeview.Selection.GetSelected(out iter);
            if (store.IterIsValid(iter))
            {
                selected = store.GetPath(iter);
            }

            store.Clear();
            foreach (EventTypeStats cstats in pstats.EventTypeStats)
            {
                store.AppendValues(cstats, cstats.Name);
            }

            /* Keep the selected category for when we reload the stats changing players */
            if (selected != null)
            {
                store.GetIter(out iter, selected);
            }
            else
            {
                store.GetIterFirst(out iter);
            }
            treeview.Selection.SelectIter(iter);
            categoryviewer1.LoadStats(store.GetValue(iter, 0) as EventTypeStats);
        }
コード例 #19
0
        public void AddReference(ProjectReference pref)
        {
            TreeIter iter = FindReference(pref.ReferenceType, pref.Reference);

            if (!iter.Equals(TreeIter.Zero))
            {
                return;
            }

            TreeIter ni = AppendReference(pref);

            if (!ni.Equals(TreeIter.Zero))
            {
                ReferencesTreeView.ScrollToCell(refTreeStore.GetPath(ni), null, false, 0, 0);
            }
        }
コード例 #20
0
ファイル: EditModsDialog.cs プロジェクト: Jorch72/CS-MultiMC3
        public EditModsDialog(Window parent, Instance inst)
            : base("Edit Mods", parent)
        {
            this.inst = inst;

            XML gxml = new XML(null, "MultiMC.GTKGUI.EditModsDialog.glade",
                               "vboxEditMods", null);

            gxml.Autoconnect(this);

            this.VBox.PackStart(vboxEditMods);

            this.AddButton("_Cancel", ResponseType.Cancel);
            this.AddButton("_OK", ResponseType.Ok);

            WidthRequest  = 600;
            HeightRequest = 500;
            // the Jar page is active by default. FIXME: determine dynamically!
            currentMode = Mode.Jar;

            modStore         = new ListStore(typeof(string), typeof(Mod));
            jarModList.Model = modStore;
            jarModList.AppendColumn("Mod Name", new CellRendererText(), "text", 0);

            mlModStore      = new ListStore(typeof(string), typeof(Mod));
            mlModList.Model = mlModStore;
            mlModList.AppendColumn("Mod Name", new CellRendererText(), "text", 0);

            //mlModList.Selection.Mode = SelectionMode.Multiple;

            inst.InstMods.ModFileChanged += (o, args) => LoadModList();

            // Listen for key presses
            jarModList.KeyPressEvent += new KeyPressEventHandler(jarModList_KeyPressEvent);
            mlModList.KeyPressEvent  += new KeyPressEventHandler(mlModList_KeyPressEvent);

            // set up drag & drop
            jarModList.EnableModelDragDest(targetEntries, Gdk.DragAction.Default);
            jarModList.EnableModelDragSource(Gdk.ModifierType.Button1Mask, srcEntries, Gdk.DragAction.Move);
            jarModList.DragDataReceived += OnDragDataReceived;
            jarModList.DragDataGet      += (object o, DragDataGetArgs args) =>
            {
                TreeIter  iter;
                TreeModel model;
                if (!jarModList.Selection.GetSelected(out iter))
                {
                    return;
                }
                Gdk.Atom[] targets = args.Context.Targets;
                TreePath   tp      = modStore.GetPath(iter);
                int        idx     = tp.Indices[0];

                args.SelectionData.Set(targets[0], 0, System.Text.Encoding.UTF8.GetBytes(idx.ToString()));
            };

            Drag.DestSet(mlModList, DestDefaults.All, targetEntries, Gdk.DragAction.Default);
            mlModList.DragDataReceived += OnDragDataReceived;
            mlModList.EnableModelDragDest(targetEntries, Gdk.DragAction.Default);
        }
コード例 #21
0
ファイル: MainWindow.cs プロジェクト: yunatoomi/DGLE
        private void HandleRemoveAction()
        {
            if (fileSystem == null)
            {
                return;
            }

            List <TreeIter> selectedIters = packTreeView.GetSelected().ToList();

            if (selectedIters.Count == 0)
            {
                return;
            }

            TreePath path = folderStore.GetPath(selectedIters.Last());

            for (int i = 0; i < selectedIters.Count - 1; i++)
            {
                path.Prev();
            }

            selectedIters.ForEach(selectedInFolder =>
            {
                if (TreeIter.Zero.Equals(selectedInFolder))
                {
                    return;
                }

                Packer.Item selectedItem = folderStore.GetValue(selectedInFolder, 2) as Packer.Item;
                if (selectedItem.IsRoot)
                {
                    return;
                }

                TreeIter selectedInPack = FindInPack(selectedItem);
                if (!TreeIter.Zero.Equals(selectedInPack))
                {
                    List <TreeIter> iterInPack = packStore.GetTree(selectedInPack).ToList();
                    iterInPack.Select(iter => packStore.GetValue(iter, 0) as Packer.Item).ToList()
                    .ForEach(item =>
                    {
                        if (!item.IsFolder)
                        {
                            fileSystem.Remove(item);
                        }
                    });

                    packStore.Remove(ref selectedInPack);
                }
                folderStore.Remove(ref selectedInFolder);
            });

            while (path.Indices.Last() >= folderStore.IterNChildren() && path.Prev())
            {
                ;
            }
            packTreeView.SelectAndFocus(path);
        }
コード例 #22
0
    protected virtual void AddLineButton(object sender, System.EventArgs e)
    {
        int      page = 0;
        TreeIter lastItem;
        bool     got = tModel.IterNthChild(out lastItem, tModel.IterNChildren() - 1);

        if (got)
        {
            page = (int)tModel.GetValue(lastItem, (int)Columns.COL_PAGE);
        }

        TreeIter iter = tModel.AppendValues(CatalogueParser.GetInstance().UpdateHighestID(),
                                            "Test", page, true);

        mainTreeView.ScrollToCell(tModel.GetPath(iter),
                                  mainTreeView.GetColumn((int)Columns.COL_TITLE),
                                  true, .0F, .0F);
    }
コード例 #23
0
        public void AddSession(Session s)
        {
            TreeIter iter = Messages.AppendValues(s);

            if (AutoScroll)
            {
                ScrollToCell(Messages.GetPath(iter), null, true, 0, 0);
            }
        }
コード例 #24
0
        void OnAddResourceButtonClicked(object sender, EventArgs e)
        {
            var newKey = _textResourcesManager.CreateAvailableKey();

            _textResourcesManager.SaveValueInMainResource(newKey, "new_value");
            var newTreeIter = _resourcesListStore.InsertWithValues(0, newKey);
            var newTreePath = _resourcesListStore.GetPath(newTreeIter);

            _textResourcesTreeView.SetCursorOnCell(newTreePath, _textResourcesTreeView.Columns[0], _textResourcesTreeView.Columns[0].Cells[0], true);
        }
コード例 #25
0
        void UpdateStatus()
        {
            buttonAdd.Sensitive = !string.IsNullOrEmpty(folderentry.Path);
            TreeIter it;

            if (dirList.Selection.GetSelected(out it))
            {
                buttonUpdate.Sensitive = !string.IsNullOrEmpty(folderentry.Path);
                buttonRemove.Sensitive = true;
                TreeIter fi;
                store.GetIterFirst(out fi);
                buttonUp.Sensitive   = !(store.GetPath(it).Equals(store.GetPath(fi)));
                buttonDown.Sensitive = store.IterNext(ref it);
            }
            else
            {
                buttonUpdate.Sensitive = buttonRemove.Sensitive = buttonUp.Sensitive = buttonDown.Sensitive = false;
            }
        }
コード例 #26
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            TreeIter first;

            if (defNameList.GetIterFirst(out first))
            {
                lbDefaultNames.SelectPath(defNameList.GetPath(first));
            }
            lbDefaultNames.Visible = true;
            lbDefaultNames.GrabFocus();
        }
コード例 #27
0
        private void OnDeviceChanged(object o, EventArgs args)
        {
            Device   device = o as Device;
            TreeIter iter   = FindDevice(device.VolumeInfo.MountPoint);

            if (!iter.Equals(TreeIter.Zero))
            {
                store.SetValue(iter, 0, device.Name);
                store.EmitRowChanged(store.GetPath(iter), iter);
            }
        }
コード例 #28
0
        void UpdateButtons()
        {
            TreeIter iter;

            if (radioSingle.Active || !treeItems.Selection.GetSelected(out iter))
            {
                buttonUp.Sensitive   = false;
                buttonDown.Sensitive = false;
            }
            else
            {
                TreeIter first;
                listStore.GetIterFirst(out first);
                buttonUp.Sensitive   = !listStore.GetPath(iter).Equals(listStore.GetPath(first));
                buttonDown.Sensitive = listStore.IterNext(ref iter);
            }

            treeItems.Sensitive  = !radioSingle.Active;
            comboItems.Sensitive = radioSingle.Active;
        }
コード例 #29
0
        private void RemoveItem(object o, EventArgs args)
        {
            TreeIter  iter;
            TreeModel model;

            if (treeView.Selection.GetSelected(out model, out iter))
            {
                int position = store.GetPath(iter).Indices[0];
                store.Remove(ref iter);
                articles.RemoveAt(position);
            }
        }
コード例 #30
0
        void HandleTeamPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            var teamVM = sender as TeamVM;

            if (teamVM != null && teamVM.NeedsSync(e.PropertyName, "Model"))
            {
                TreeIter iter;
                if (GetIterFromTeam(teamVM, out iter))
                {
                    teamsStore.EmitRowChanged(teamsStore.GetPath(iter), iter);
                }
            }
        }