SetValues() public method

public SetValues ( Gtk.TreeIter iter ) : void
iter Gtk.TreeIter
return void
コード例 #1
0
ファイル: EditorPanel.cs プロジェクト: anthrax3/ide-1
        protected void OnBtnSaveClicked(object sender, EventArgs e)
        {
            /*	MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.YesNo, MainClass.Languages.Translate("are_you_sure"), "", Gtk.MessageType.Question,parentWindow);
             *      int result = md.ShowDialog();
             *      if (result != (int)Gtk.ResponseType.Yes)
             *              return;
             */
            TreeSelection ts = tvExtension.Selection;

            TreeIter ti = new TreeIter();

            ts.GetSelected(out ti);

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

            selectedExtensionSetting = (ExtensionSetting)tvExtension.Model.GetValue(ti, 1);

            int seltyp = (int)ddrbAction.CurrentItem;

            selectedExtensionSetting.OpenType = (ExtensionSetting.OpenTyp)seltyp;

            selectedExtensionSetting.Extension = entrExtension.Text;
            if (selectedExtensionSetting.OpenType == ExtensionSetting.OpenTyp.EXTERNAL)
            {
                selectedExtensionSetting.ExternalProgram = feExternalPRogram.Path;
                selectedExtensionSetting.Parameter       = entrParameters.Text;
            }

            resolStore.SetValues(ti, selectedExtensionSetting.Extension, selectedExtensionSetting);
        }
コード例 #2
0
        void HandleUpdateEntry(ImageImporter.ImageEntry entry)
        {
            var           tagString = entry.TagString;
            List <String> tags      = new List <string>(tagString.Split(" ".ToCharArray()));
            List <String> siteTags  = tags.FindAll((s) => s.StartsWith("known_on_") || s.StartsWith("not_on_"));

            tags.RemoveAll((s) => siteTags.Contains(s));

            siteTags.RemoveAll((s) => s.StartsWith("not_on_"));
            for (int i = 0; i < siteTags.Count; i++)
            {
                siteTags[i] = siteTags[i].Replace("known_on_", "");
            }

            string sites = string.Join(" ", siteTags);

            tagString = string.Join(" ", tags);

            string entryPath = System.IO.Path.GetFileName(System.IO.Path.GetDirectoryName(entry.path)) + "/" + System.IO.Path.GetFileName(entry.path);

            //Gtk.Application.Invoke ((o,a) => {
            BooruApp.BooruApplication.TaskRunner.StartTaskMainThread("Import update entry", () => {
                lock (entries) {
                    if (entries.ContainsKey(entry))
                    {
                        var rowRef = entries[entry];
                        Gtk.TreeIter iter;
                        if (rowRef.Model.GetIter(out iter, entries[entry].Path))
                        {
                            entryStore.SetValues(iter,
                                                 entry.Preview,
                                                 entryPath,
                                                 entry.MD5,
                                                 entry.Status,
                                                 tagString,
                                                 entry.LastUpdated,
                                                 sites
                                                 );
                            scrollToPath = this.ImageEntryView.Model.GetPath(iter);
                        }
                        else
                        {
                            BooruApp.BooruApplication.Log.Log(BooruLog.Category.Application, BooruLog.Severity.Warning, "Could not update import entry " + entry.MD5 + ", row reference was invalid");
                        }
                        scrollToPath = this.ImageEntryView.Model.GetPath(iter);
                    }
                    else
                    {
                        var iter = entryStore.AppendValues(
                            entry.Preview,
                            entryPath,
                            entry.MD5,
                            entry.Status,
                            tagString,
                            entry.LastUpdated,
                            sites
                            );
                        entries [entry] = new Gtk.TreeRowReference(entryStore, entryStore.GetPath(iter));
                    }
                }
            });
        }
コード例 #3
0
        protected virtual void OnBtnEditCond1Clicked(object sender, System.EventArgs e)
        {
            if (!MainClass.LicencesSystem.CheckFunction("conditions", parentWindow))
            {
                return;
            }

            TreeSelection ts = tvConditions.Selection;

            TreeIter ti = new TreeIter();

            ts.GetSelected(out ti);

            TreePath[] tp = ts.GetSelectedRows();
            if (tp.Length < 1)
            {
                return;
            }
            Condition cd = (Condition)tvConditions.Model.GetValue(ti, 2);

            if (cd == null)
            {
                return;
            }

            TreeSelection tsR = tvRules.Selection;
            TreeIter      tiR = new TreeIter();

            tsR.GetSelected(out tiR);

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

            Rule rl = (Rule)tvRules.Model.GetValue(tiR, 2);

            EntryDialog ed     = new EntryDialog(rl.Name, MainClass.Languages.Translate("new_name"));
            int         result = ed.Run();

            if (result == (int)ResponseType.Ok)
            {
                string newStr = ed.TextEntry;
                if (!String.IsNullOrEmpty(newStr))
                {
                    Rule rlFind = cd.Rules.Find(x => x.Name.ToUpper() == newStr.ToUpper());
                    if (rlFind != null)
                    {
                        MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("rule_is_exist", rlFind.Name), "", Gtk.MessageType.Error, parentWindow);
                        md.ShowDialog();
                        ed.Destroy();
                        return;
                    }


                    Condition cd2 = conditions.Find(x => x.Id == cd.Id);
                    cd2.Rules.Remove(rl);

                    rl.Name = newStr;
                    ruleStore.SetValues(tiR, rl.Id, rl.Name, rl);

                    cd2.Rules.Add(rl);
                    conditionStore.SetValues(ti, cd2.Id, cd2.Name, cd2);

                    //cd.Rules.Add(rl);
                }
            }
            ed.Destroy();
        }
コード例 #4
0
        protected virtual void OnBtnEditCondClicked(object sender, System.EventArgs e)
        {
            if (!MainClass.LicencesSystem.CheckFunction("conditions", parentWindow))
            {
                return;
            }

            TreeSelection ts = tvConditions.Selection;

            TreeIter ti = new TreeIter();

            ts.GetSelected(out ti);

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

            Condition cd = (Condition)tvConditions.Model.GetValue(ti, 2);

            if (cd == null)
            {
                return;
            }

            EntryDialog ed     = new EntryDialog(cd.Name, MainClass.Languages.Translate("new_conditions"), parentWindow);
            int         result = ed.Run();

            if (result == (int)ResponseType.Ok)
            {
                string newStr = ed.TextEntry;
                if (!String.IsNullOrEmpty(newStr))
                {
                    if (newStr == cd.Name)
                    {
                        return;
                    }

                    Condition cdFind = conditions.Find(x => x.Name.ToUpper() == newStr.ToUpper());
                    if (cdFind != null)
                    {
                        MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("conditions_is_exist", cdFind.Name), "", Gtk.MessageType.Error, parentWindow);
                        md.ShowDialog();
                        ed.Destroy();
                        return;
                    }

                    Condition cdEdited = conditions.Find(x => x.Id == cd.Id);

                    if (cdEdited == null)
                    {
                        MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("unspecified_error"), "", Gtk.MessageType.Error, parentWindow);
                        md.ShowDialog();
                        ed.Destroy();
                        return;
                    }

                    cdEdited.Name = newStr;

                    conditionStore.SetValues(ti, cdEdited.Id, cdEdited.Name, cdEdited);

                    //conditions.Find(cd).Name =ed.TextEntry;
                }
            }
            ed.Destroy();
        }
コード例 #5
0
ファイル: FilteringPanel.cs プロジェクト: anthrax3/ide-1
        protected virtual void OnBtnEditMaskClicked(object sender, System.EventArgs e)
        {
            TreeSelection ts = tvFilter.Selection;

            TreeIter ti = new TreeIter();

            ts.GetSelected(out ti);

            TreePath[] tp = ts.GetSelectedRows();
            if (tp.Length < 1)
            {
                return;
            }
            LogicalSystem cd = (LogicalSystem)tvFilter.Model.GetValue(ti, 1);

            if (cd == null)
            {
                return;
            }

            TreeSelection tsR = tvMask.Selection;
            TreeIter      tiR = new TreeIter();

            tsR.GetSelected(out tiR);

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

            string rl = (string)tvMask.Model.GetValue(tiR, 0);

            EntryDialog ed     = new EntryDialog(rl, MainClass.Languages.Translate("new_name"), parentWindow);
            int         result = ed.Run();

            if (result == (int)ResponseType.Ok)
            {
                string newStr = ed.TextEntry;
                if (!String.IsNullOrEmpty(newStr))
                {
                    if (rl.ToUpper() == newStr.ToUpper())
                    {
                        ed.Destroy();
                        return;
                    }

                    string rlFind = cd.Mask.Find(x => x.ToUpper() == newStr.ToUpper());
                    if (!String.IsNullOrEmpty(rlFind))
                    {
                        MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("mask_is_exist", rlFind), "", Gtk.MessageType.Error, parentWindow);
                        md.ShowDialog();
                        ed.Destroy();
                        return;
                    }


                    LogicalSystem cd2 = conditions.Find(x => x.Display.ToUpper() == cd.Display.ToUpper());
                    cd2.Mask.Remove(rlFind);

                    maskStore.SetValues(tiR, 0, newStr, newStr);

                    cd2.Mask.Add(newStr);
                    filterStore.SetValues(ti, cd2.Display, cd2);
                }
            }
            ed.Destroy();
        }
コード例 #6
0
ファイル: FilteringPanel.cs プロジェクト: anthrax3/ide-1
        protected virtual void OnBtnEditFilterClicked(object sender, System.EventArgs e)
        {
            TreeSelection ts = tvFilter.Selection;

            TreeIter ti = new TreeIter();

            ts.GetSelected(out ti);

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

            LogicalSystem cd = (LogicalSystem)tvFilter.Model.GetValue(ti, 1);

            if (cd == null)
            {
                return;
            }

            EntryDialog ed     = new EntryDialog(cd.Display, MainClass.Languages.Translate("new_filter"), parentWindow);
            int         result = ed.Run();

            if (result == (int)ResponseType.Ok)
            {
                string newStr = ed.TextEntry;
                if (!String.IsNullOrEmpty(newStr))
                {
                    if (newStr == cd.Display)
                    {
                        return;
                    }

                    LogicalSystem cdFind = conditions.Find(x => x.Display.ToUpper() == newStr.ToUpper());
                    if (cdFind != null)
                    {
                        MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("filter_is_exist", cdFind.Display), "", Gtk.MessageType.Error, parentWindow);
                        md.ShowDialog();
                        ed.Destroy();
                        return;
                    }

                    LogicalSystem cdEdited = conditions.Find(x => x.Display.ToUpper() == cd.Display.ToUpper());

                    if (cdEdited == null)
                    {
                        MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("unspecified_error"), "", Gtk.MessageType.Error, parentWindow);
                        md.ShowDialog();
                        ed.Destroy();
                        return;
                    }

                    cdEdited.Display = newStr;

                    filterStore.SetValues(ti, cdEdited.Display, cdEdited);

                    //conditions.Find(cd).Name =ed.TextEntry;
                }
            }
            ed.Destroy();
        }
コード例 #7
0
        private void EditRule()
        {
            TreeSelection ts = tvResolution.Selection;

            TreeIter ti = new TreeIter();

            ts.GetSelected(out ti);

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

            Rule cd = (Rule)tvResolution.Model.GetValue(ti, 3);

            if (cd == null)
            {
                return;
            }

            if (cd.Id == -1)
            {
                MessageDialogs mdError = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("edit_resolution_system"), "", Gtk.MessageType.Error, parentWindow);
                mdError.ShowDialog();
                return;
            }

            int width  = cd.Width;
            int height = cd.Height;

            ResolutionDialog ed = new ResolutionDialog(cd, parentWindow);
            int result          = ed.Run();

            if (result == (int)ResponseType.Ok)
            {
                Rule res = ed.Resolution;
                if (res != null)
                {
                    Rule cdFind = MainClass.Settings.Resolution.Rules.Find(x => x.Id == res.Id);
                    if (cdFind == null)
                    {
                        MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("resolution_is_exist", cdFind.Name), "", Gtk.MessageType.Error, parentWindow);
                        md.ShowDialog();
                        ed.Destroy();
                        return;
                    }
                    cdFind = res;
                    resolStore.SetValues(ti, cdFind.Id, cdFind.Name, cdFind.Specific, cdFind);

                    try{
                        string[] listFi = Directory.GetFiles(MainClass.Paths.DisplayDir, "*.ini");

                        foreach (string fi in listFi)
                        {
                            EmulatorDisplay dd = new EmulatorDisplay(fi);
                            if (dd.Load())
                            {
                                if (dd.Height == height && dd.Width == width)
                                {
                                    dd.Height = res.Height;
                                    dd.Width  = res.Width;
                                    dd.Save();
                                }
                            }
                        }
                    }catch (Exception ex) {
                        Tool.Logger.Error(ex.Message, null);
                        MessageDialogs ms = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, "Error", ex.Message, MessageType.Error, parentWindow);
                        ms.ShowDialog();
                        return;
                    }
                }
            }
            ed.Destroy();
        }