public RelayTournamentsView(ICSClient c)
            {
                client = c;
                tournamentIter = TreeIter.Zero;
                store = new TreeStore (typeof (int),
                               typeof (string),
                               typeof (string));
                  create_tree ();
                  refreshButton = new Button (Stock.Refresh);
                  refreshButton.Clicked += OnClicked;
                  infoLabel = new Label ();
                  infoLabel.UseMarkup = true;
                  infoLabel.Xalign = 0;
                  infoLabel.Xpad = 4;
                //infoLabel.Yalign = 0;
                //infoLabel.Ypad = 4;
                HBox box = new HBox ();
                  box.PackStart (infoLabel, true, true, 4);
                  box.PackStart (refreshButton, false, false,
                         4);
                  PackStart (box, false, true, 4);

                ScrolledWindow scroll = new ScrolledWindow ();
                  scroll.HscrollbarPolicy =
                    scroll.VscrollbarPolicy =
                    PolicyType.Automatic;
                  scroll.Add (tree);
                  PackStart (scroll, true, true, 4);
                  client.AuthEvent += OnAuth;
                  ShowAll ();
            }
Esempio n. 2
0
 public TaskBeingEdited(ITask task, TreeIter iter, TreePath path)
 {
     if (path == null)
         throw new ArgumentNullException ("path");
     if (task == null)
         throw new ArgumentNullException ("task");
     Task = task;
     Iter = iter;
     Path = path;
 }
Esempio n. 3
0
 public TaskRowEditingEventArgs(ITask task, TreeIter iter, TreePath path)
 {
     if (task == null)
         throw new ArgumentNullException ("task");
     ITask = task;
     if (path == null)
         throw new ArgumentNullException ("path");
     Path = path;
     Iter = iter;
 }
		/// <summary>
		/// Returns next iter
		/// </summary>
		/// <param name="aIter">
		/// Iterator <see cref="TreeIter"/>
		/// </param>
		/// <returns>
		/// true if successful <see cref="System.Boolean"/>
		/// </returns>
		public override bool IterNext (ref TreeIter aIter)
		{
			object node = NodeFromIter (aIter);
			if ((node == null) || (Items == null) || (Items.Rows.Count == 0))
				return (false);
			int idx = Items.Rows.IndexOf(node as DataRow);
			if ((idx < 0) || ((idx+1) >= Items.Rows.Count))
				return (false);
			aIter = IterFromNode (Items.Rows[idx+1]);
			return (true);
		}
            private void PluginInfoCellDataFunc(TreeViewColumn
							     col,
							     CellRenderer
							     cell,
							     TreeModel model,
							     TreeIter iter)
            {
                CellRendererText r = (CellRendererText) cell;
                PluginInfo info =
                    (PluginInfo) model.GetValue (iter, 0);
                r.Markup =
                    String.Format ("<b>{0}</b>\n{1}",
                               info.Plugin.Name,
                               info.Plugin.
                               Description);
            }
Esempio n. 6
0
        static void ImageDataFunc(TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
        {
            var isError  = (bool)tree_model.GetValue(iter, 2);
            var crpixbuf = (CellRendererPixbuf)cell;

            crpixbuf.Visible = isError;
            crpixbuf.Pixbuf  = isError ? errorPixbuf.Value : null;
        }
Esempio n. 7
0
        void TaskNameTextCellDataFunc(TreeViewColumn treeColumn, CellRenderer cell,
		                               TreeModel treeModel, TreeIter iter)
        {
            var crt = cell as CellRendererText;
            crt.Ellipsize = Pango.EllipsizeMode.End;
            var task = model.GetValue (iter, 0) as ITask;
            if (task == null) {
                crt.Text = string.Empty;
                return;
            }

            var formatString = "{0}";
            var todayTasksColor = preferences.Get (PreferencesKeys.TodayTaskTextColor);
            var overdueTaskColor = preferences.Get (PreferencesKeys.OverdueTaskTextColor);

            if (!task.IsComplete && task.DueDate.Date == DateTime.Today.Date)
                crt.Foreground = todayTasksColor;
            // Overdue and the task has a date assigned to it.
            else if (!task.IsComplete && task.DueDate < DateTime.Today
                     && task.DueDate != DateTime.MinValue)
                crt.Foreground = overdueTaskColor;

            switch (task.State) {
            // TODO: Reimplement the feature below
            //			case TaskState.Active:
            //				// Strikeout the text
            //				var timer = timerCol.GetTimer (task);
            //				if (timer != null && timer.State == TaskCompleteTimerState.Running)
            //					formatString = "<span strikethrough=\"true\">{0}</span>";
            //				break;
            case TaskState.Discarded:
            case TaskState.Completed:
                // Gray out the text and add strikeout
                // TODO: Determine the grayed-out text color appropriate for the current theme
                formatString = "<span strikethrough=\"true\">{0}</span>";
                crt.Foreground = "#AAAAAA";
                break;
            }

            crt.Markup = string.Format (formatString, Markup.EscapeText (task.Text));
        }
            void OnRelayTournament(object o, Tournament t)
            {
                //addsample();
                if (t != null)
                  {
                      tree.Show ();

                      tournamentIter =
                          store.AppendValues (0,
                                      String.
                                      Format
                                      ("<span color=\"#702020\"><b>{0}</b>\n<small><i>{1}</i></small></span>",
                                       t.Name,
                                       t.
                                       RoundInfo),
                                      "");
                      ntourneys++;
                      infoLabel.Markup =
                          String.Format (Catalog.
                                 GetString
                                 ("<b>Tournaments: {0}, Games {1} ...</b>"),
                                 ntourneys,
                                 ngames);
                      return;
                  }
                getter.RelayTournamentEvent -=
                    OnRelayTournament;
                getter.RelayGameEvent -=
                    OnRelayTournamentGame;
                if (ntourneys == 0)
                  {
                      infoLabel.Markup =
                          String.
                          Format
                          ("<span color=\"#800000\"><big><b>{0}</b></big></span>",
                           Catalog.
                           GetString
                           ("There are no relay tournaments"));
                      tree.Hide ();
                      relay_pending = false;
                      return;
                  }
                infoLabel.Markup =
                    String.
                    Format (Catalog.
                        GetString
                        ("<b>Tournaments: {0}, Games {1}</b>"),
                        ntourneys, ngames);
                relay_pending = false;
                if (!sendnotification)
                    return;
                ICSDetailsWidget ics =
                    ICSDetailsWidget.Instance;
                ics.NotificationWidget.
                    SetNotification (new
                             TournamentInfoNotification
                             (ics,
                              ntourneys
                              +
                              " tournaments available. Show?"),
                             TOURNAMENTS_NOTIFICATION_TIMEOUT);
                sendnotification = false;
            }
 private void FillInterfaces(Dictionary <string, InterfaceProperties> interfces, TreeIter parentIter)
 {
     foreach (var cls in interfces)
     {
         var iter = widget.metricStore.AppendValues(parentIter,
                                                    ImageService.GetPixbuf("md-interface", Gtk.IconSize.Menu),
                                                    cls.Value.FullName,
                                                    cls.Value.CyclometricComplexity.ToString(),
                                                    cls.Value.ClassCoupling.ToString(),
                                                    cls.Value.LOCReal.ToString(),
                                                    cls.Value.LOCComments.ToString(),
                                                    cls.Value);
         // Add recursive field for members of interfaces
     }
 }
Esempio n. 10
0
        public MainToolbar()
        {
            WidgetFlags |= Gtk.WidgetFlags.AppPaintable;

            AddWidget(button);
            AddSpace(8);

            configurationCombosBox = new HBox(false, 8);

            var ctx = new Gtk.CellRendererText();

            runConfigurationCombo       = new Gtk.ComboBox();
            runConfigurationCombo.Model = runConfigurationStore;
            runConfigurationCombo.PackStart(ctx, true);
            runConfigurationCombo.AddAttribute(ctx, "text", 0);

            var runConfigurationComboVBox = new VBox();

            runConfigurationComboVBox.PackStart(runConfigurationCombo, true, false, 0);
            configurationCombosBox.PackStart(runConfigurationComboVBox, false, false, 0);

            configurationCombo       = new Gtk.ComboBox();
            configurationCombo.Model = configurationStore;
            configurationCombo.PackStart(ctx, true);
            configurationCombo.AddAttribute(ctx, "text", 0);

            var configurationComboVBox = new VBox();

            configurationComboVBox.PackStart(configurationCombo, true, false, 0);
            configurationCombosBox.PackStart(configurationComboVBox, false, false, 0);

            // bold attributes for running runtime targets / (emulators)
            boldAttributes.Insert(new Pango.AttrWeight(Pango.Weight.Bold));

            runtimeCombo       = new Gtk.ComboBox();
            runtimeCombo.Model = runtimeStore;
            ctx = new Gtk.CellRendererText();
            if (Platform.IsWindows)
            {
                ctx.Ellipsize = Pango.EllipsizeMode.Middle;
            }
            runtimeCombo.PackStart(ctx, true);
            runtimeCombo.SetCellDataFunc(ctx, RuntimeRenderCell);
            runtimeCombo.RowSeparatorFunc = RuntimeIsSeparator;

            var runtimeComboVBox = new VBox();

            runtimeComboVBox.PackStart(runtimeCombo, true, false, 0);
            configurationCombosBox.PackStart(runtimeComboVBox, false, false, 0);
            AddWidget(configurationCombosBox);

            buttonBarBox             = new Alignment(0.5f, 0.5f, 0, 0);
            buttonBarBox.LeftPadding = (uint)7;
            buttonBarBox.Add(buttonBar);
            buttonBarBox.NoShowAll = true;
            AddWidget(buttonBarBox);
            AddSpace(24);

            statusArea = new StatusArea();
            statusArea.ShowMessage(BrandingService.ApplicationName);

            var statusAreaAlign = new Alignment(0, 0, 1, 1);

            statusAreaAlign.Add(statusArea);
            contentBox.PackStart(statusAreaAlign, true, true, 0);
            AddSpace(24);

            statusAreaAlign.SizeAllocated += (object o, SizeAllocatedArgs args) => {
                Gtk.Widget toplevel = this.Toplevel;
                if (toplevel == null)
                {
                    return;
                }

                int  windowWidth   = toplevel.Allocation.Width;
                int  center        = windowWidth / 2;
                int  left          = Math.Max(center - 300, args.Allocation.Left);
                int  right         = Math.Min(left + 600, args.Allocation.Right);
                uint left_padding  = (uint)(left - args.Allocation.Left);
                uint right_padding = (uint)(args.Allocation.Right - right);

                if (left_padding != statusAreaAlign.LeftPadding || right_padding != statusAreaAlign.RightPadding)
                {
                    statusAreaAlign.SetPadding(0, 0, (uint)left_padding, (uint)right_padding);
                }
            };

            matchEntry = new SearchEntry();

            matchEntry.ForceFilterButtonVisible = true;
            matchEntry.Entry.FocusOutEvent     += (o, e) => {
                if (SearchEntryLostFocus != null)
                {
                    SearchEntryLostFocus(o, e);
                }
            };

            matchEntry.Ready        = true;
            matchEntry.Visible      = true;
            matchEntry.IsCheckMenu  = true;
            matchEntry.WidthRequest = 240;
            if (!Platform.IsMac && !Platform.IsWindows)
            {
                matchEntry.Entry.ModifyFont(Pango.FontDescription.FromString("Sans 9"));                   // TODO: VV: "Segoe UI 9"
            }
            matchEntry.RoundedShape         = true;
            matchEntry.Entry.Changed       += HandleSearchEntryChanged;
            matchEntry.Activated           += HandleSearchEntryActivated;
            matchEntry.Entry.KeyPressEvent += HandleSearchEntryKeyPressed;
            SizeAllocated += (o, e) => {
                if (SearchEntryResized != null)
                {
                    SearchEntryResized(o, e);
                }
            };

            contentBox.PackStart(matchEntry, false, false, 0);

            var align = new Gtk.Alignment(0, 0, 1f, 1f);

            align.Show();
            align.TopPadding    = (uint)5;
            align.LeftPadding   = (uint)9;
            align.RightPadding  = (uint)18;
            align.BottomPadding = (uint)10;
            align.Add(contentBox);

            Add(align);
            SetDefaultSizes(-1, 21);

            configurationCombo.Changed += (o, e) => {
                if (ConfigurationChanged != null)
                {
                    ConfigurationChanged(o, e);
                }
            };
            runConfigurationCombo.Changed += (o, e) => {
                if (RunConfigurationChanged != null)
                {
                    RunConfigurationChanged(o, e);
                }
            };
            runtimeCombo.Changed += (o, e) => {
                var ea = new HandledEventArgs();
                if (RuntimeChanged != null)
                {
                    RuntimeChanged(o, ea);
                }

                TreeIter it;
                if (runtimeCombo.GetActiveIter(out it))
                {
                    if (ea.Handled)
                    {
                        runtimeCombo.SetActiveIter(lastSelection);
                        return;
                    }
                    lastSelection = it;
                }
            };

            button.Clicked += HandleStartButtonClicked;

            IdeApp.CommandService.ActiveWidgetChanged += (sender, e) => {
                lastCommandTarget = new WeakReference(e.OldActiveWidget);
            };

            this.ShowAll();
            this.statusArea.statusIconBox.HideAll();
        }
		/// <summary>
		/// Returns parent for iterator
		/// </summary>
		/// <param name="aParent">
		/// Parent node <see cref="TreeIter"/>
		/// </param>
		/// <param name="aChild">
		/// Iterator <see cref="TreeIter"/>
		/// </param>
		/// <returns>
		/// true if successful, false if not <see cref="System.Boolean"/>
		/// </returns>
		public override bool IterParent (out TreeIter aParent, TreeIter aChild)
		{
			aParent = TreeIter.Zero;
			return (false);
		}
Esempio n. 12
0
        void FileNameDataFunc(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            if (TreeIter.Zero.Equals(iter))
            {
                return;
            }
            var  fileNameRenderer = (CellRendererText)cell;
            bool didRead          = (bool)store.GetValue(iter, DidReadColumn);
            var  searchResult     = (SearchResult)store.GetValue(iter, SearchResultColumn);

            if (searchResult == null)
            {
                return;
            }
            Document doc = GetDocument(searchResult);

            if (doc == null)
            {
                return;
            }
            int lineNr = doc.OffsetToLineNumber(searchResult.Offset);

            fileNameRenderer.Markup = MarkupText(System.IO.Path.GetFileName(searchResult.FileName) + ":" + lineNr, didRead);
        }
            private bool FindMoveRow(int movenumber,
						  out TreePath path,
						  out TreeIter iter)
            {
                iter = TreeIter.Zero;
                if (total_rows <= 0)
                  {
                      path = null;
                      return false;
                  }

                path = new TreePath (new int[]
                             {
                             total_rows - 1});
                do
                  {
                      store.GetIter (out iter, path);
                      int number =
                          (int) store.GetValue (iter,
                                    0);
                      if (number == movenumber)
                          return true;
                      if (number < movenumber)
                          return false;
                  }
                while (path.Prev ());

                return false;
            }
Esempio n. 14
0
        SectionPage CreatePage(TreeIter it, OptionsDialogSection section, object dataObject)
        {
            SectionPage page;

            if (pages.TryGetValue(section, out page))
            {
                return(page);
            }

            page            = new SectionPage();
            page.Iter       = it;
            page.Panels     = new List <PanelInstance> ();
            pages [section] = page;

            List <OptionsPanelNode> nodes = new List <OptionsPanelNode> ();

            if (!string.IsNullOrEmpty(section.TypeName) || section.CustomNode)
            {
                nodes.Add(section);
            }

            if (!section.CustomNode)
            {
                foreach (ExtensionNode nod in section.ChildNodes)
                {
                    OptionsPanelNode node = nod as OptionsPanelNode;
                    if (node != null && !(node is OptionsDialogSection))
                    {
                        nodes.Add(node);
                    }
                }
            }

            foreach (OptionsPanelNode node in nodes)
            {
                PanelInstance pi = null;
                if (panels.TryGetValue(node, out pi))
                {
                    if (pi.DataObject == dataObject)
                    {
                        // The panel can be reused
                        if (!pi.Panel.IsVisible())
                        {
                            continue;
                        }
                    }
                    else
                    {
                        // If the data object has changed, this panel instance can't be
                        // reused anymore. Destroy it.
                        panels.Remove(node);
                        if (pi.Widget != null)
                        {
                            pi.Widget.Destroy();
                        }
                        IDisposable d = pi.Panel as IDisposable;
                        if (d != null)
                        {
                            d.Dispose();
                        }
                        pi = null;
                    }
                }
                if (pi == null)
                {
                    IOptionsPanel panel = node.CreatePanel();
                    pi            = new PanelInstance();
                    pi.Panel      = panel;
                    pi.Node       = node;
                    pi.DataObject = dataObject;
                    page.Panels.Add(pi);
                    panel.Initialize(this, dataObject);
                    if (!panel.IsVisible())
                    {
                        page.Panels.Remove(pi);
                        continue;
                    }
                    panels [node] = pi;
                }
                else
                {
                    page.Panels.Add(pi);
                }
            }
            return(page);
        }
Esempio n. 15
0
        void FileIconDataFunc(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            if (TreeIter.Zero.Equals(iter))
            {
                return;
            }
            var fileNamePixbufRenderer = (CellRendererPixbuf)cell;
            var searchResult           = (SearchResult)store.GetValue(iter, SearchResultColumn);

            if (searchResult == null)
            {
                return;
            }
            fileNamePixbufRenderer.Pixbuf = DesktopService.GetPixbufForFile(searchResult.FileName, IconSize.Menu);
        }
Esempio n. 16
0
        void TextCellDataFunc(TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            TreeIter parent;
            bool     toplevel = !model.IterParent(out parent, iter);

            var crt     = (CellRendererText)cell;
            var section = (OptionsDialogSection)model.GetValue(iter, 0);

            if (toplevel)
            {
                crt.Markup = "<b>" + GLib.Markup.EscapeText(section.Label) + "</b>";
            }
            else
            {
                crt.Text = section.Label;
            }
        }
Esempio n. 17
0
        void PixbufCellDataFunc(TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            TreeIter parent;
            bool     toplevel = !model.IterParent(out parent, iter);

            var crp = (CellRendererImage)cell;

            crp.Visible = !toplevel;

            if (toplevel)
            {
                return;
            }

            var section = (OptionsDialogSection)model.GetValue(iter, 0);

            //HACK: The mimetype panels can't register a single fake stock ID for all the possible image size.
            // Instead, give this some awareness of the mime system.
            var mimeSection = section as MonoDevelop.Ide.Projects.OptionPanels.MimetypeOptionsDialogSection;

            if (mimeSection != null && !string.IsNullOrEmpty(mimeSection.MimeType))
            {
                var pix = DesktopService.GetIconForType(mimeSection.MimeType, treeIconSize);
                if (pix != null)
                {
                    crp.Image = pix;
                }
                else
                {
                    crp.Image = ImageService.GetIcon(emptyCategoryIcon, treeIconSize);
                }
            }
            else
            {
                string icon = section.Icon.IsNull? emptyCategoryIcon : section.Icon.ToString();
                crp.Image = ImageService.GetIcon(icon, treeIconSize);
            }
        }
Esempio n. 18
0
        private SettingsWindow(MainWindow parent, Builder builder, VirtualFileSystem virtualFileSystem, ContentManager contentManager) : base(builder.GetObject("_settingsWin").Handle)
        {
            Icon = new Gdk.Pixbuf(Assembly.GetAssembly(typeof(ConfigurationState)), "Ryujinx.Ui.Common.Resources.Logo_Ryujinx.png");

            _parent = parent;

            builder.Autoconnect(this);

            _timeZoneContentManager = new TimeZoneContentManager();
            _timeZoneContentManager.InitializeInstance(virtualFileSystem, contentManager, IntegrityCheckLevel.None);

            _validTzRegions = new HashSet <string>(_timeZoneContentManager.LocationNameCache.Length, StringComparer.Ordinal); // Zone regions are identifiers. Must match exactly.

            // Bind Events.
            _configureController1.Pressed      += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player1);
            _configureController2.Pressed      += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player2);
            _configureController3.Pressed      += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player3);
            _configureController4.Pressed      += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player4);
            _configureController5.Pressed      += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player5);
            _configureController6.Pressed      += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player6);
            _configureController7.Pressed      += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player7);
            _configureController8.Pressed      += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player8);
            _configureControllerH.Pressed      += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Handheld);
            _systemTimeZoneEntry.FocusOutEvent += TimeZoneEntry_FocusOut;

            _resScaleCombo.Changed += (sender, args) => _resScaleText.Visible = _resScaleCombo.ActiveId == "-1";
            _galThreading.Changed  += (sender, args) =>
            {
                if (_galThreading.ActiveId != ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString())
                {
                    GtkDialog.CreateInfoDialog("Warning - Backend Threading", "Ryujinx must be restarted after changing this option for it to apply fully. Depending on your platform, you may need to manually disable your driver's own multithreading when using Ryujinx's.");
                }
            };

            // Setup Currents.
            if (ConfigurationState.Instance.Logger.EnableTrace)
            {
                _traceLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableFileLog)
            {
                _fileLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableError)
            {
                _errorLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableWarn)
            {
                _warningLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableInfo)
            {
                _infoLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableStub)
            {
                _stubLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableDebug)
            {
                _debugLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableGuest)
            {
                _guestLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableFsAccessLog)
            {
                _fsAccessLogToggle.Click();
            }

            foreach (GraphicsDebugLevel level in Enum.GetValues <GraphicsDebugLevel>())
            {
                _graphicsDebugLevel.Append(level.ToString(), level.ToString());
            }

            _graphicsDebugLevel.SetActiveId(ConfigurationState.Instance.Logger.GraphicsDebugLevel.Value.ToString());

            if (ConfigurationState.Instance.System.EnableDockedMode)
            {
                _dockedModeToggle.Click();
            }

            if (ConfigurationState.Instance.EnableDiscordIntegration)
            {
                _discordToggle.Click();
            }

            if (ConfigurationState.Instance.CheckUpdatesOnStart)
            {
                _checkUpdatesToggle.Click();
            }

            if (ConfigurationState.Instance.ShowConfirmExit)
            {
                _showConfirmExitToggle.Click();
            }

            if (ConfigurationState.Instance.HideCursorOnIdle)
            {
                _hideCursorOnIdleToggle.Click();
            }

            if (ConfigurationState.Instance.Graphics.EnableVsync)
            {
                _vSyncToggle.Click();
            }

            if (ConfigurationState.Instance.Graphics.EnableShaderCache)
            {
                _shaderCacheToggle.Click();
            }

            if (ConfigurationState.Instance.System.EnablePtc)
            {
                _ptcToggle.Click();
            }

            if (ConfigurationState.Instance.System.EnableInternetAccess)
            {
                _internetToggle.Click();
            }

            if (ConfigurationState.Instance.System.EnableFsIntegrityChecks)
            {
                _fsicToggle.Click();
            }

            switch (ConfigurationState.Instance.System.MemoryManagerMode.Value)
            {
            case MemoryManagerMode.SoftwarePageTable:
                _mmSoftware.Click();
                break;

            case MemoryManagerMode.HostMapped:
                _mmHost.Click();
                break;

            case MemoryManagerMode.HostMappedUnsafe:
                _mmHostUnsafe.Click();
                break;
            }

            if (ConfigurationState.Instance.System.ExpandRam)
            {
                _expandRamToggle.Click();
            }

            if (ConfigurationState.Instance.System.IgnoreMissingServices)
            {
                _ignoreToggle.Click();
            }

            if (ConfigurationState.Instance.Hid.EnableKeyboard)
            {
                _directKeyboardAccess.Click();
            }

            if (ConfigurationState.Instance.Hid.EnableMouse)
            {
                _directMouseAccess.Click();
            }

            if (ConfigurationState.Instance.Ui.EnableCustomTheme)
            {
                _custThemeToggle.Click();
            }

            // Custom EntryCompletion Columns. If added to glade, need to override more signals
            ListStore tzList = new ListStore(typeof(string), typeof(string), typeof(string));

            _systemTimeZoneCompletion.Model = tzList;

            CellRendererText offsetCol = new CellRendererText();
            CellRendererText abbrevCol = new CellRendererText();

            _systemTimeZoneCompletion.PackStart(offsetCol, false);
            _systemTimeZoneCompletion.AddAttribute(offsetCol, "text", 0);
            _systemTimeZoneCompletion.TextColumn = 1; // Regions Column
            _systemTimeZoneCompletion.PackStart(abbrevCol, false);
            _systemTimeZoneCompletion.AddAttribute(abbrevCol, "text", 2);

            int maxLocationLength = 0;

            foreach (var(offset, location, abbr) in _timeZoneContentManager.ParseTzOffsets())
            {
                var hours   = Math.DivRem(offset, 3600, out int seconds);
                var minutes = Math.Abs(seconds) / 60;

                var abbr2 = (abbr.StartsWith('+') || abbr.StartsWith('-')) ? string.Empty : abbr;

                tzList.AppendValues($"UTC{hours:+0#;-0#;+00}:{minutes:D2} ", location, abbr2);
                _validTzRegions.Add(location);

                maxLocationLength = Math.Max(maxLocationLength, location.Length);
            }

            _systemTimeZoneEntry.WidthChars = Math.Max(20, maxLocationLength + 1); // Ensure minimum Entry width
            _systemTimeZoneEntry.Text       = _timeZoneContentManager.SanityCheckDeviceLocationName(ConfigurationState.Instance.System.TimeZone);

            _systemTimeZoneCompletion.MatchFunc = TimeZoneMatchFunc;

            _systemLanguageSelect.SetActiveId(ConfigurationState.Instance.System.Language.Value.ToString());
            _systemRegionSelect.SetActiveId(ConfigurationState.Instance.System.Region.Value.ToString());
            _galThreading.SetActiveId(ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString());
            _resScaleCombo.SetActiveId(ConfigurationState.Instance.Graphics.ResScale.Value.ToString());
            _anisotropy.SetActiveId(ConfigurationState.Instance.Graphics.MaxAnisotropy.Value.ToString());
            _aspectRatio.SetActiveId(((int)ConfigurationState.Instance.Graphics.AspectRatio.Value).ToString());

            _custThemePath.Buffer.Text           = ConfigurationState.Instance.Ui.CustomThemePath;
            _resScaleText.Buffer.Text            = ConfigurationState.Instance.Graphics.ResScaleCustom.Value.ToString();
            _resScaleText.Visible                = _resScaleCombo.ActiveId == "-1";
            _graphicsShadersDumpPath.Buffer.Text = ConfigurationState.Instance.Graphics.ShadersDumpPath;
            _fsLogSpinAdjustment.Value           = ConfigurationState.Instance.System.FsGlobalAccessLogMode;
            _systemTimeOffset = ConfigurationState.Instance.System.SystemTimeOffset;

            _gameDirsBox.AppendColumn("", new CellRendererText(), "text", 0);
            _gameDirsBoxStore  = new ListStore(typeof(string));
            _gameDirsBox.Model = _gameDirsBoxStore;

            foreach (string gameDir in ConfigurationState.Instance.Ui.GameDirs.Value)
            {
                _gameDirsBoxStore.AppendValues(gameDir);
            }

            if (_custThemeToggle.Active == false)
            {
                _custThemePath.Sensitive      = false;
                _custThemePathLabel.Sensitive = false;
                _browseThemePath.Sensitive    = false;
            }

            //Setup system time spinners
            UpdateSystemTimeSpinners();

            _audioBackendStore = new ListStore(typeof(string), typeof(AudioBackend));

            TreeIter openAlIter  = _audioBackendStore.AppendValues("OpenAL", AudioBackend.OpenAl);
            TreeIter soundIoIter = _audioBackendStore.AppendValues("SoundIO", AudioBackend.SoundIo);
            TreeIter sdl2Iter    = _audioBackendStore.AppendValues("SDL2", AudioBackend.SDL2);
            TreeIter dummyIter   = _audioBackendStore.AppendValues("Dummy", AudioBackend.Dummy);

            _audioBackendSelect = ComboBox.NewWithModelAndEntry(_audioBackendStore);
            _audioBackendSelect.EntryTextColumn  = 0;
            _audioBackendSelect.Entry.IsEditable = false;

            switch (ConfigurationState.Instance.System.AudioBackend.Value)
            {
            case AudioBackend.OpenAl:
                _audioBackendSelect.SetActiveIter(openAlIter);
                break;

            case AudioBackend.SoundIo:
                _audioBackendSelect.SetActiveIter(soundIoIter);
                break;

            case AudioBackend.SDL2:
                _audioBackendSelect.SetActiveIter(sdl2Iter);
                break;

            case AudioBackend.Dummy:
                _audioBackendSelect.SetActiveIter(dummyIter);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            _audioBackendBox.Add(_audioBackendSelect);
            _audioBackendSelect.Show();

            _previousVolumeLevel            = ConfigurationState.Instance.System.AudioVolume;
            _audioVolumeLabel               = new Label("Volume: ");
            _audioVolumeSlider              = new Scale(Orientation.Horizontal, 0, 100, 1);
            _audioVolumeLabel.MarginStart   = 10;
            _audioVolumeSlider.ValuePos     = PositionType.Right;
            _audioVolumeSlider.WidthRequest = 200;

            _audioVolumeSlider.Value         = _previousVolumeLevel * 100;
            _audioVolumeSlider.ValueChanged += VolumeSlider_OnChange;
            _audioBackendBox.Add(_audioVolumeLabel);
            _audioBackendBox.Add(_audioVolumeSlider);
            _audioVolumeLabel.Show();
            _audioVolumeSlider.Show();

            bool openAlIsSupported  = false;
            bool soundIoIsSupported = false;
            bool sdl2IsSupported    = false;

            Task.Run(() =>
            {
                openAlIsSupported  = OpenALHardwareDeviceDriver.IsSupported;
                soundIoIsSupported = SoundIoHardwareDeviceDriver.IsSupported;
                sdl2IsSupported    = SDL2HardwareDeviceDriver.IsSupported;
            });

            // This function runs whenever the dropdown is opened
            _audioBackendSelect.SetCellDataFunc(_audioBackendSelect.Cells[0], (layout, cell, model, iter) =>
            {
                cell.Sensitive = ((AudioBackend)_audioBackendStore.GetValue(iter, 1)) switch
                {
                    AudioBackend.OpenAl => openAlIsSupported,
                    AudioBackend.SoundIo => soundIoIsSupported,
                    AudioBackend.SDL2 => sdl2IsSupported,
                    AudioBackend.Dummy => true,
                    _ => throw new ArgumentOutOfRangeException()
                };
            });
		/// <summary>
		/// Returns child count from iterator
		/// </summary>
		/// <param name="aIter">
		/// Iterator <see cref="TreeIter"/>
		/// </param>
		/// <returns>
		/// Child count <see cref="System.Int32"/>
		/// </returns>
		public override int IterNChildren (TreeIter aIter)
		{
			if ((DataSource == null) || (GetItemCount() == 0))
				return (0);
			if (aIter.UserData == IntPtr.Zero)
				return (GetItemCount());
			return (0);
		}
Esempio n. 20
0
 static int DefaultSortFunc(TreeModel model, TreeIter first, TreeIter second)
 {
     return(0);
 }
            private void SetHighlighted(TreeIter iter, int row,
						     int col)
            {
                ClearHighlighting ();

                int idx =
                    col ==
                    WHITE_MOVE_COL ?
                    WHITE_MOVE_DETAILS_COL :
                    BLACK_MOVE_DETAILS_COL;
                MoveDetails details =
                    (MoveDetails) store.GetValue (iter,
                                      idx);
                if (details == null)
                    return;
                store.SetValue (iter, col,
                        GetHighlightedMove (details));
                ScrollToCell (store.GetPath (iter),
                          GetColumn (col), false, 0, 0);
                last_row = row;
                last_col = col;
            }
Esempio n. 22
0
        void ResultPathDataFunc(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            if (TreeIter.Zero.Equals(iter))
            {
                return;
            }
            var pathRenderer = (CellRendererText)cell;
            var searchResult = (SearchResult)store.GetValue(iter, SearchResultColumn);

            if (searchResult == null)
            {
                return;
            }
            bool didRead = (bool)store.GetValue(iter, DidReadColumn);

            pathRenderer.Markup = MarkupText(System.IO.Path.GetDirectoryName(searchResult.FileName), didRead);
        }
		/// <summary>
		/// Returns child count from iterator
		/// </summary>
		/// <param name="aIter">
		/// Iterator <see cref="TreeIter"/>
		/// </param>
		/// <returns>
		/// Child count <see cref="System.Int32"/>
		/// </returns>
		public override int IterNChildren (TreeIter aIter)
		{
			if ((Items == null) || (Items.Rows.Count == 0))
				return (0);
			if (aIter.UserData == IntPtr.Zero)
				return (Items.Rows.Count);
			return (0);
		}
Esempio n. 24
0
//		void ResultLineDataFunc (TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
//		{
//			if (TreeIter.Zero.Equals (iter))
//				return;
//			var lineRenderer = (CellRendererText)cell;
//			var searchResult = (SearchResult)store.GetValue (iter, SearchResultColumn);
//			if (searchResult == null)
//				return;
//
//			Document doc = GetDocument (searchResult);
//			int lineNr = doc.OffsetToLineNumber (searchResult.Offset) + 1;
//			bool didRead = (bool)store.GetValue (iter, DidReadColumn);
//			lineRenderer.Markup = MarkupText (lineNr.ToString (), didRead);
//		}
//
        void ResultTextDataFunc(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            if (TreeIter.Zero.Equals(iter))
            {
                return;
            }
            var textRenderer = (CellRendererText)cell;
            var searchResult = (SearchResult)store.GetValue(iter, SearchResultColumn);

            if (searchResult == null || searchResult.Offset < 0)
            {
                textRenderer.Markup = "Invalid search result";
                return;
            }

            Document doc = GetDocument(searchResult);

            if (doc == null)
            {
                textRenderer.Markup = "Can't create document for:" + searchResult.FileName;
                return;
            }
            int         lineNr = doc.OffsetToLineNumber(searchResult.Offset);
            LineSegment line   = doc.GetLine(lineNr);

            if (line == null)
            {
                textRenderer.Markup = "Invalid line number " + lineNr + " from offset: " + searchResult.Offset;
                return;
            }
            bool   isSelected = treeviewSearchResults.Selection.IterIsSelected(iter);
            int    indent     = line.GetIndentation(doc).Length;
            string markup     = doc.SyntaxMode != null?
                                doc.SyntaxMode.GetMarkup(doc, new TextEditorOptions(), highlightStyle, line.Offset + indent, line.EditableLength - indent, true, !isSelected, false) :
                                    GLib.Markup.EscapeText(doc.GetTextAt(line.Offset, line.EditableLength));

            if (!isSelected)
            {
                int    col = searchResult.Offset - line.Offset - indent;
                string tag;
                int    pos1 = FindPosition(markup, col, out tag);
                int    pos2 = FindPosition(markup, col + searchResult.Length, out tag);
                if (pos1 >= 0 && pos2 >= 0)
                {
                    markup = tag.StartsWith("span") ? markup.Insert(pos2, "</span></span><" + tag + ">") : markup.Insert(pos2, "</span>");
                    Color  searchColor = Mono.TextEditor.Highlighting.ColorSheme.ToGdkColor(highlightStyle.SearchTextBg);
                    double b1          = Mono.TextEditor.HslColor.Brightness(searchColor);
                    double b2          = Mono.TextEditor.HslColor.Brightness(AdjustColor(Style.Base(StateType.Normal), highlightStyle.Default.Color));
                    double delta       = Math.Abs(b1 - b2);
                    if (delta < 0.1)
                    {
                        Mono.TextEditor.HslColor color1 = highlightStyle.SearchTextBg;
                        if (color1.L + 0.5 > 1.0)
                        {
                            color1.L -= 0.5;
                        }
                        else
                        {
                            color1.L += 0.5;
                        }
                        searchColor = color1;
                    }
                    markup = markup.Insert(pos1, "<span background=\"" + SyntaxMode.ColorToPangoMarkup(searchColor) + "\">");
                }
            }
            string markupText = AdjustColors(markup.Replace("\t", new string (' ', TextEditorOptions.DefaultOptions.TabSize)));

            try {
                textRenderer.Markup = markupText;
            } catch (Exception e) {
                LoggingService.LogError("Error whil setting the text renderer markup to: " + markup, e);
            }
        }
		/// <summary>
		/// Returns child count from iterator
		/// </summary>
		/// <param name="aIter">
		/// Iterator <see cref="TreeIter"/>
		/// </param>
		/// <returns>
		/// Child count <see cref="System.Int32"/>
		/// </returns>
		public override int IterNChildren (TreeIter aIter)
		{
			return (0);
		}
Esempio n. 26
0
 bool IsIterSelected(TreePath selPath, TreeIter iter)
 {
     return(selPath != null && store.GetPath(iter).Equals(selPath));
 }
		/// <summary>
		/// Returns first iterator in specified parent
		/// </summary>
		/// <param name="aChild">
		/// Child iterator <see cref="TreeIter"/>
		/// </param>
		/// <param name="aParent">
		/// Parent <see cref="TreeIter"/>
		/// </param>
		/// <returns>
		/// true if successful, false if not <see cref="System.Boolean"/>
		/// </returns>
		public override bool IterChildren (out TreeIter aChild, TreeIter aParent)
		{
			aChild = TreeIter.Zero;
			return (false);
		}
            private void AddCategoryIters(int type,
						       TreeIter parent)
            {
                string[]names = new string[]
                {
                Catalog.GetString ("Blitz"),
                        Catalog.
                        GetString
                        ("Standard"),
                        Catalog.
                        GetString
                        ("Lightning"),
                        Catalog.GetString ("Others")};

                for (int i = 0; i < names.Length; i++)
                  {
                      iters[type, i] =
                          store.AppendValues (parent,
                                      "", 0,
                                      String.
                                      Format
                                      ("<b><i>{0}</i></b>",
                                       names
                                       [i]),
                                      "", "");
                      if (i < names.Length - 1)
                        {
                            gamesView.
                                ExpandRow (store.
                                       GetPath
                                       (iters
                                    [type,
                                     i]),
                                       false);
                        }
                  }
            }
Esempio n. 29
0
        void RuntimeRenderCell(CellLayout layout, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            var runtime  = (IRuntimeModel)model.GetValue(iter, 0);
            var renderer = (CellRendererText)cell;

            if (runtime == null || runtime.IsSeparator)
            {
                renderer.Xpad = (uint)0;
                return;
            }

            using (var mutableModel = runtime.GetMutableModel()) {
                renderer.Visible   = mutableModel.Visible;
                renderer.Sensitive = mutableModel.Enabled;
                renderer.Xpad      = (uint)(runtime.IsIndented ? 18 : 3);

                if (!runtimeCombo.PopupShown)
                {
                    // no need to ident text when the combo dropdown is not showing
                    if (Platform.IsWindows)
                    {
                        renderer.Xpad = 3;
                    }
                    renderer.Text       = mutableModel.FullDisplayString;
                    renderer.Attributes = normalAttributes;
                }
                else
                {
                    renderer.Text       = mutableModel.DisplayString;
                    renderer.Attributes = runtime.Notable ? boldAttributes : normalAttributes;
                }
            }
        }
            private void GetIter(GameDetails details,
					      out TreeIter iter,
					      out bool needs_expansion)
            {
                int x = details.Examined ? 2 : details.
                    Rated ? 0 : 1;
                int y;
                switch (details.GameCategory)
                  {
                  case GameCategory.Blitz:
                      y = 0;
                      needs_expansion = true;
                      break;
                  case GameCategory.Standard:
                      y = 1;
                      needs_expansion = true;
                      break;
                  case GameCategory.Lightning:
                      y = 2;
                      needs_expansion = false;
                      break;
                  default:
                      y = 3;
                      needs_expansion = false;
                      break;
                  }
                iter = iters[x, y];
            }
Esempio n. 31
0
 public TreeVisitor(TreeStore store, TreeIter curIter) : base(SyntaxWalkerDepth.Trivia)
 {
     this.store   = store;
     this.curIter = curIter;
 }
Esempio n. 32
0
        static bool RuntimeIsSeparator(TreeModel model, TreeIter iter)
        {
            var runtime = (IRuntimeModel)model.GetValue(iter, 0);

            return(runtime == null || runtime.IsSeparator);
        }
            protected bool FilterFunc(TreeModel model,
						   TreeIter iter)
            {
                TreePath path = model.GetPath (iter);
                if (path.Depth <= 2)
                  {
                      return true;
                  }
                if (path.Indices[1] != OTHER_CATEGORY_IDX
                    && path.Indices[1] !=
                    LIGHTNING_CATEGORY_IDX)
                  {
                      path.Up ();
                      gamesView.ExpandRow (path, false);
                  }

                string filterstr = filterEntry.Text.Trim ();
                if (filterstr.Length == 0)
                    return true;

                string str =
                    model.GetValue (iter, 0) as string;

                if (str.IndexOf (filterstr.ToLower ()) >= 0)
                    return true;

                return false;
            }
        static bool Search(TreeModel model, int column, string key, TreeIter iter)
        {
            string value = (string)model.GetValue(iter, column);

            return(!value.Contains(key));
        }
Esempio n. 35
0
        void TaskToggleCellDataFunc(TreeViewColumn treeColumn, CellRenderer cell,
		                             TreeModel treeModel, TreeIter iter)
        {
            var crt = cell as CellRendererToggle;
            var task = model.GetValue (iter, 0) as ITask;
            if (task == null)
                crt.Active = false;
            else {
                var timerCol = (TimerColumn) view.GetColumn (typeof (TimerColumn));
                crt.Active = !(task.State == TaskState.Active && timerCol.GetTimer (task) == null);
            }
        }
Esempio n. 36
0
        void CategoryDataFunc(CellLayout layout, CellRenderer renderer, TreeModel model, TreeIter iter)
        {
            string name = (string)model.GetValue(iter, 1);

            (renderer as CellRendererText).Text = name;
        }
		/// <summary>
		/// Returns next iter
		/// </summary>
		/// <param name="aIter">
		/// Iterator <see cref="TreeIter"/>
		/// </param>
		/// <returns>
		/// true if successful <see cref="System.Boolean"/>
		/// </returns>
		public override bool IterNext (ref TreeIter aIter)
		{
			object node = NodeFromIter (aIter);
			if ((node == null) || (DataSource == null) || (GetItemCount() == 0))
				return (false);
			int idx = GetItemIndex (node);
			if ((idx < 0) || ((idx+1) >= GetItemCount()))
				return (false);
			aIter = IterFromNode (GetItemAtIndex (idx+1));
			return (true);
		}
Esempio n. 38
0
        private void TransferNameFunc(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            IFileTransfer transfer = (IFileTransfer)model.GetValue(iter, 0);

            ((CellRendererText)cell).Text = transfer.File.Name;
        }
		/// <summary>
		/// Returns n-th child for specified parent
		/// </summary>
		/// <param name="aChild">
		/// N-th child node <see cref="TreeIter"/>
		/// </param>
		/// <param name="aParent">
		/// Parent node <see cref="TreeIter"/>
		/// </param>
		/// <param name="n">
		/// Index of specifie node <see cref="System.Int32"/>
		/// </param>
		/// <returns>
		/// true if successful, false if not <see cref="System.Boolean"/>
		/// </returns>
		public override bool IterNthChild (out TreeIter aChild, TreeIter aParent, int n)
		{
			aChild = TreeIter.Zero;

			if ((DataSource == null) || (GetItemCount() == 0))
				return (false);
			
			if (aParent.UserData == IntPtr.Zero) {
				if (GetItemCount() <= n)
					return (false);
				aChild = IterFromNode (GetItemAtIndex (n));
				return (true);
			}
			return (false);
		}
Esempio n. 40
0
        private void TransferDownSpeedFunc(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            IFileTransfer transfer = (IFileTransfer)model.GetValue(iter, 0);

            if (transfer.Status == FileTransferStatus.Transfering)
            {
                ((CellRendererText)cell).Text = Common.Utils.FormatBytes(transfer.TotalDownloadSpeed) + "/s";
            }
            else
            {
                ((CellRendererText)cell).Text = string.Empty;
            }
        }
            private bool GetIterAndCol(out TreeIter iter,
						    out int row, out int col)
            {
                iter = TreeIter.Zero;
                row = col = -1;

                TreeViewColumn column;
                TreePath path;
                GetCursor (out path, out column);

                if (path == null || column == null)
                    return false;

                if (column.Equals (GetColumn (0)))
                    return false;

                row = path.Indices[0];
                store.GetIter (out iter, path);
                col = column.
                    Equals (GetColumn (WHITE_MOVE_COL)) ?
                    WHITE_MOVE_COL : BLACK_MOVE_COL;
                return true;
            }
Esempio n. 42
0
        private void TransferIconFunc(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            IFileTransfer transfer = (IFileTransfer)model.GetValue(iter, 0);

            if (transfer.Direction == FileTransferDirection.Download)
            {
                ((CellRendererPixbuf)cell).Pixbuf = downloadImage;
            }
            else
            {
                ((CellRendererPixbuf)cell).Pixbuf = uploadImage;
            }
        }
		/// <summary>
		/// Returns first iterator in specified parent
		/// </summary>
		/// <param name="aChild">
		/// Child iterator <see cref="TreeIter"/>
		/// </param>
		/// <param name="aParent">
		/// Parent <see cref="TreeIter"/>
		/// </param>
		/// <returns>
		/// true if successful, false if not <see cref="System.Boolean"/>
		/// </returns>
		public override bool IterChildren (out TreeIter aChild, TreeIter aParent)
		{
			aChild = TreeIter.Zero;
			if ((Items == null) || (Items.Rows.Count == 0))
			    return (false);
			if (aParent.UserData == IntPtr.Zero) {
				aChild = IterFromNode (Items.Rows[0]);
				return (true);
			}				
			return (false);
		}
Esempio n. 44
0
        private void TransferProgressFunc(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            IFileTransfer transfer = (IFileTransfer)model.GetValue(iter, 0);

            CellRendererProgress progressCell = (CellRendererProgress)cell;

            if (transfer.Progress >= 0)
            {
                progressCell.Value   = Convert.ToInt32(transfer.Progress);
                progressCell.Visible = true;
            }
            else
            {
                progressCell.Value   = 0;
                progressCell.Visible = false;
            }
            progressCell.Text = string.Format("{0}%", progressCell.Value);
        }
		/// <summary>
		/// Returns n-th child for specified parent
		/// </summary>
		/// <param name="aChild">
		/// N-th child node <see cref="TreeIter"/>
		/// </param>
		/// <param name="aParent">
		/// Parent node <see cref="TreeIter"/>
		/// </param>
		/// <param name="n">
		/// Index of specifie node <see cref="System.Int32"/>
		/// </param>
		/// <returns>
		/// true if successful, false if not <see cref="System.Boolean"/>
		/// </returns>
		public override bool IterNthChild (out TreeIter aChild, TreeIter aParent, int n)
		{
			aChild = TreeIter.Zero;

			if ((Items == null) || (Items.Rows.Count == 0))
				return (false);
			
			if (aParent.UserData == IntPtr.Zero) {
				if (Items.Rows.Count <= n)
					return (false);
				aChild = IterFromNode (Items.Rows[n]);
				return (true);
			}
			return (false);
		}
Esempio n. 46
0
        private void TransferStatusFunc(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            IFileTransfer    transfer = (IFileTransfer)model.GetValue(iter, 0);
            CellRendererText textCell = (CellRendererText)cell;

            if (!string.IsNullOrEmpty(transfer.StatusDetail))
            {
                textCell.Text = string.Format("{0} - {1}", transfer.Status, transfer.StatusDetail);
            }
            else
            {
                textCell.Text = transfer.Status.ToString();
            }

            string color = null;

            switch (transfer.Status)
            {
            //case FileTransferStatus.Failed:
            case FileTransferStatus.Canceled:
                color = "red";
                break;

            case FileTransferStatus.Transfering:
                color = "black";
                break;

            case FileTransferStatus.Completed:
                color = "darkgreen";
                break;

            case FileTransferStatus.AllPeersBusy:
            case FileTransferStatus.Hashing:
            case FileTransferStatus.Paused:
            case FileTransferStatus.Queued:
                color = "gold";
                break;
            }

            textCell.Foreground = color;
        }
		/// <summary>
		/// Checks if iterator has child or not
		/// </summary>
		/// <param name="aIter">
		/// Iterator <see cref="TreeIter"/>
		/// </param>
		/// <returns>
		/// true if children are present, false if not <see cref="System.Boolean"/>
		/// </returns>
		public override bool IterHasChild (TreeIter aIter)
		{
			return (false);
		}
Esempio n. 48
0
    bool FilterTree(TreeModel model, TreeIter iter)
    {
        if (model.GetValue(iter, 0) == null)
        {
            return(false);
        }

        var cco          = model.GetValue(iter, 0).ToString();
        var situacao     = model.GetValue(iter, 1).ToString();
        var codigo       = model.GetValue(iter, 3).ToString();
        var nome         = model.GetValue(iter, 4).ToString();
        var mae          = model.GetValue(iter, 6).ToString();
        var cpf          = model.GetValue(iter, 7).ToString();
        var cns          = model.GetValue(iter, 8).ToString();
        var dtNascimento = model.GetValue(iter, 9).ToString();
        var planoAns     = model.GetValue(iter, 10).ToString();
        var cnpj         = model.GetValue(iter, 11).ToString();

        if (filterEntryCodigo.Text.Length > 0 && !codigo.Contains(filterEntryCodigo.Text))
        {
            return(false);
        }

        if (filterEntryNome.Text.Length > 0 && !nome.ToUpper().Contains(filterEntryNome.Text.ToUpper()))
        {
            return(false);
        }

        if (filterEntryMae.Text.Length > 0 && !mae.ToUpper().Contains(filterEntryMae.Text.ToUpper()))
        {
            return(false);
        }

        if (filterEntryCPF.Text.Length > 0 && !cpf.Contains(filterEntryCPF.Text))
        {
            return(false);
        }

        if (filterCbApenasAtivos.Active && situacao.Equals("INATIVO"))
        {
            return(false);
        }

        if (filterEntryCCO.Text.Length > 0 && !cco.Contains(filterEntryCCO.Text))
        {
            return(false);
        }

        if (filterEntryCNS.Text.Length > 0 && !cns.Contains(filterEntryCNS.Text))
        {
            return(false);
        }

        if (filterEntryPlanoAns.Text.Length > 0 && !planoAns.Contains(filterEntryPlanoAns.Text))
        {
            return(false);
        }

        if (filterEntryDtNascimento.Text.Length > 0 && !dtNascimento.Contains(filterEntryDtNascimento.Text))
        {
            return(false);
        }

        if (filterEntryPlanoAns.Text.Length > 0 && !planoAns.Contains(filterEntryPlanoAns.Text))
        {
            return(false);
        }

        if (filterEntryCNPJ.Text.Length > 0 && !cnpj.Contains(filterEntryCNPJ.Text))
        {
            return(false);
        }

        countFiltered++;
        return(true);
    }
		/// <summary>
		/// Returns n-th child for specified parent
		/// </summary>
		/// <param name="aChild">
		/// N-th child node <see cref="TreeIter"/>
		/// </param>
		/// <param name="aParent">
		/// Parent node <see cref="TreeIter"/>
		/// </param>
		/// <param name="n">
		/// Index of specifie node <see cref="System.Int32"/>
		/// </param>
		/// <returns>
		/// true if successful, false if not <see cref="System.Boolean"/>
		/// </returns>
		public override bool IterNthChild (out TreeIter aChild, TreeIter aParent, int n)
		{
			aChild = TreeIter.Zero;
			return (false);
		}
        void SetTemplateTextCellData(TreeViewColumn col, CellRenderer renderer, TreeModel model, TreeIter it)
        {
            var template = (SolutionTemplate)model.GetValue(it, TemplateColumn);

            templateTextRenderer.Template = template;
        }
		/// <summary>
		/// Returns next iter
		/// </summary>
		/// <param name="aIter">
		/// Iterator <see cref="TreeIter"/>
		/// </param>
		/// <returns>
		/// true if successful <see cref="System.Boolean"/>
		/// </returns>
		public override bool IterNext (ref TreeIter aIter)
		{
			return (false);
		}
Esempio n. 52
0
        void OnCellLayoutDataFunc(CellLayout cell_layout, CellRenderer cell, TreeModel tree_model, TreeIter iter)
        {
            var    cityName     = (string)tree_model.GetValue(iter, (int)columns.City);
            var    district     = (string)tree_model.GetValue(iter, (int)columns.District);
            var    localityType = (LocalityType)(tree_model.GetValue(iter, (int)columns.Locality) ?? default(LocalityType));
            string pattern      = String.Format("\\b{0}", Regex.Escape(Text.ToLower()));

            cityName = Regex.Replace(cityName, pattern, (match) => String.Format("<b>{0}</b>", match.Value), RegexOptions.IgnoreCase);
            (cell as CellRendererText).Markup = String.IsNullOrWhiteSpace(district) ?
                                                String.Format("{0} {1}", localityType.GetEnumTitle(), cityName) :
                                                String.Format("{0} {1} ({2})", localityType.GetEnumTitle(), cityName, district);
        }
            public void UpdateTournaments()
            {
                if (relay_pending)
                    return;
                relay_pending = true;
                store.Clear ();
                tournamentIter = TreeIter.Zero;
                ntourneys = 0;
                ngames = 0;
                infoLabel.Markup =
                    Catalog.
                    GetString
                    ("<b>Getting tournament info...</b>");

                getter = new RelayGetter (client);
                getter.RelayTournamentEvent +=
                    OnRelayTournament;
                getter.RelayGameEvent +=
                    OnRelayTournamentGame;
                getter.Start ();
            }
Esempio n. 54
0
        void DueDateCellDataFunc(TreeViewColumn treeColumn, CellRenderer cell,
		                          TreeModel treeModel, TreeIter iter)
        {
            var crc = cell as CellRendererCombo;
            var task = model.GetValue (iter, 0) as ITask;
            if (task == null)
                return;

            var date = task.State == TaskState.Completed ? task.CompletionDate : task.DueDate;
            if (date == DateTime.MinValue || date == DateTime.MaxValue) {
                crc.Text = "-";
                return;
            }

            if (date.Year == DateTime.Today.Year)
                crc.Text = date.ToString (Catalog.GetString ("M/d - ddd"));
            else
                crc.Text = date.ToString (Catalog.GetString ("M/d/yy - ddd"));
        }
Esempio n. 55
0
        private SettingsWindow(Builder builder, VirtualFileSystem virtualFileSystem, HLE.FileSystem.Content.ContentManager contentManager) : base(builder.GetObject("_settingsWin").Handle)
        {
            builder.Autoconnect(this);

            this.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.Icon.png");

            _virtualFileSystem = virtualFileSystem;

            _timeZoneContentManager = new TimeZoneContentManager();
            _timeZoneContentManager.InitializeInstance(virtualFileSystem, contentManager, LibHac.FsSystem.IntegrityCheckLevel.None);

            _validTzRegions = new HashSet <string>(_timeZoneContentManager.LocationNameCache.Length, StringComparer.Ordinal); // Zone regions are identifiers. Must match exactly.

            //Bind Events
            _configureController1.Pressed      += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player1);
            _configureController2.Pressed      += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player2);
            _configureController3.Pressed      += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player3);
            _configureController4.Pressed      += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player4);
            _configureController5.Pressed      += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player5);
            _configureController6.Pressed      += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player6);
            _configureController7.Pressed      += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player7);
            _configureController8.Pressed      += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player8);
            _configureControllerH.Pressed      += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Handheld);
            _systemTimeZoneEntry.FocusOutEvent += TimeZoneEntry_FocusOut;

            _resScaleCombo.Changed += (sender, args) => _resScaleText.Visible = _resScaleCombo.ActiveId == "-1";

            //Setup Currents
            if (ConfigurationState.Instance.Logger.EnableFileLog)
            {
                _fileLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableError)
            {
                _errorLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableWarn)
            {
                _warningLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableInfo)
            {
                _infoLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableStub)
            {
                _stubLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableDebug)
            {
                _debugLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableGuest)
            {
                _guestLogToggle.Click();
            }

            if (ConfigurationState.Instance.Logger.EnableFsAccessLog)
            {
                _fsAccessLogToggle.Click();
            }

            foreach (GraphicsDebugLevel level in Enum.GetValues(typeof(GraphicsDebugLevel)))
            {
                _graphicsDebugLevel.Append(level.ToString(), level.ToString());
            }

            _graphicsDebugLevel.SetActiveId(ConfigurationState.Instance.Logger.GraphicsDebugLevel.Value.ToString());

            if (ConfigurationState.Instance.System.EnableDockedMode)
            {
                _dockedModeToggle.Click();
            }

            if (ConfigurationState.Instance.EnableDiscordIntegration)
            {
                _discordToggle.Click();
            }

            if (ConfigurationState.Instance.CheckUpdatesOnStart)
            {
                _checkUpdatesToggle.Click();
            }

            if (ConfigurationState.Instance.Graphics.EnableVsync)
            {
                _vSyncToggle.Click();
            }

            if (ConfigurationState.Instance.Graphics.EnableShaderCache)
            {
                _shaderCacheToggle.Click();
            }

            if (ConfigurationState.Instance.System.EnablePtc)
            {
                _ptcToggle.Click();
            }

            if (ConfigurationState.Instance.System.EnableFsIntegrityChecks)
            {
                _fsicToggle.Click();
            }

            if (ConfigurationState.Instance.System.IgnoreMissingServices)
            {
                _ignoreToggle.Click();
            }

            if (ConfigurationState.Instance.Hid.EnableKeyboard)
            {
                _directKeyboardAccess.Click();
            }

            if (ConfigurationState.Instance.Ui.EnableCustomTheme)
            {
                _custThemeToggle.Click();
            }

            // Custom EntryCompletion Columns. If added to glade, need to override more signals
            ListStore tzList = new ListStore(typeof(string), typeof(string), typeof(string));

            _systemTimeZoneCompletion.Model = tzList;

            CellRendererText offsetCol = new CellRendererText();
            CellRendererText abbrevCol = new CellRendererText();

            _systemTimeZoneCompletion.PackStart(offsetCol, false);
            _systemTimeZoneCompletion.AddAttribute(offsetCol, "text", 0);
            _systemTimeZoneCompletion.TextColumn = 1; // Regions Column
            _systemTimeZoneCompletion.PackStart(abbrevCol, false);
            _systemTimeZoneCompletion.AddAttribute(abbrevCol, "text", 2);

            int maxLocationLength = 0;

            foreach (var(offset, location, abbr) in _timeZoneContentManager.ParseTzOffsets())
            {
                var hours   = Math.DivRem(offset, 3600, out int seconds);
                var minutes = Math.Abs(seconds) / 60;

                var abbr2 = (abbr.StartsWith('+') || abbr.StartsWith('-')) ? string.Empty : abbr;

                tzList.AppendValues($"UTC{hours:+0#;-0#;+00}:{minutes:D2} ", location, abbr2);
                _validTzRegions.Add(location);

                maxLocationLength = Math.Max(maxLocationLength, location.Length);
            }

            _systemTimeZoneEntry.WidthChars = Math.Max(20, maxLocationLength + 1); // Ensure minimum Entry width
            _systemTimeZoneEntry.Text       = _timeZoneContentManager.SanityCheckDeviceLocationName();

            _systemTimeZoneCompletion.MatchFunc = TimeZoneMatchFunc;

            _systemLanguageSelect.SetActiveId(ConfigurationState.Instance.System.Language.Value.ToString());
            _systemRegionSelect.SetActiveId(ConfigurationState.Instance.System.Region.Value.ToString());
            _resScaleCombo.SetActiveId(ConfigurationState.Instance.Graphics.ResScale.Value.ToString());
            _anisotropy.SetActiveId(ConfigurationState.Instance.Graphics.MaxAnisotropy.Value.ToString());
            _aspectRatio.SetActiveId(((int)ConfigurationState.Instance.Graphics.AspectRatio.Value).ToString());

            _custThemePath.Buffer.Text           = ConfigurationState.Instance.Ui.CustomThemePath;
            _resScaleText.Buffer.Text            = ConfigurationState.Instance.Graphics.ResScaleCustom.Value.ToString();
            _resScaleText.Visible                = _resScaleCombo.ActiveId == "-1";
            _graphicsShadersDumpPath.Buffer.Text = ConfigurationState.Instance.Graphics.ShadersDumpPath;
            _fsLogSpinAdjustment.Value           = ConfigurationState.Instance.System.FsGlobalAccessLogMode;
            _systemTimeOffset = ConfigurationState.Instance.System.SystemTimeOffset;

            _gameDirsBox.AppendColumn("", new CellRendererText(), "text", 0);
            _gameDirsBoxStore  = new ListStore(typeof(string));
            _gameDirsBox.Model = _gameDirsBoxStore;

            foreach (string gameDir in ConfigurationState.Instance.Ui.GameDirs.Value)
            {
                _gameDirsBoxStore.AppendValues(gameDir);
            }

            if (_custThemeToggle.Active == false)
            {
                _custThemePath.Sensitive      = false;
                _custThemePathLabel.Sensitive = false;
                _browseThemePath.Sensitive    = false;
            }

            //Setup system time spinners
            UpdateSystemTimeSpinners();

            _audioBackendStore = new ListStore(typeof(string), typeof(AudioBackend));

            TreeIter openAlIter  = _audioBackendStore.AppendValues("OpenAL", AudioBackend.OpenAl);
            TreeIter soundIoIter = _audioBackendStore.AppendValues("SoundIO", AudioBackend.SoundIo);
            TreeIter dummyIter   = _audioBackendStore.AppendValues("Dummy", AudioBackend.Dummy);

            _audioBackendSelect = ComboBox.NewWithModelAndEntry(_audioBackendStore);
            _audioBackendSelect.EntryTextColumn  = 0;
            _audioBackendSelect.Entry.IsEditable = false;

            switch (ConfigurationState.Instance.System.AudioBackend.Value)
            {
            case AudioBackend.OpenAl:
                _audioBackendSelect.SetActiveIter(openAlIter);
                break;

            case AudioBackend.SoundIo:
                _audioBackendSelect.SetActiveIter(soundIoIter);
                break;

            case AudioBackend.Dummy:
                _audioBackendSelect.SetActiveIter(dummyIter);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            _audioBackendBox.Add(_audioBackendSelect);
            _audioBackendSelect.Show();

            bool openAlIsSupported  = false;
            bool soundIoIsSupported = false;

            Task.Run(() =>
            {
                openAlIsSupported  = OpenALAudioOut.IsSupported;
                soundIoIsSupported = SoundIoAudioOut.IsSupported;
            });

            // This function runs whenever the dropdown is opened
            _audioBackendSelect.SetCellDataFunc(_audioBackendSelect.Cells[0], (layout, cell, model, iter) =>
            {
                cell.Sensitive = ((AudioBackend)_audioBackendStore.GetValue(iter, 1)) switch
                {
                    AudioBackend.OpenAl => openAlIsSupported,
                    AudioBackend.SoundIo => soundIoIsSupported,
                    AudioBackend.Dummy => true,
                    _ => throw new ArgumentOutOfRangeException()
                };
            });
 private void FillDelegates(Dictionary <string, DelegateProperties> dlgtes, TreeIter parentIter)
 {
     foreach (var cls in dlgtes)
     {
         var iter = widget.metricStore.AppendValues(parentIter,
                                                    ImageService.GetPixbuf("md-method", Gtk.IconSize.Menu),
                                                    cls.Value.FullName,
                                                    cls.Value.CyclometricComplexity.ToString(),
                                                    cls.Value.ClassCoupling.ToString(),
                                                    cls.Value.LOCReal.ToString(),
                                                    cls.Value.LOCComments.ToString(),
                                                    cls.Value);
     }
 }
            private void LoadedStatusCellDataFunc(TreeViewColumn
							       col,
							       CellRenderer
							       cell,
							       TreeModel
							       model,
							       TreeIter iter)
            {
                CellRendererToggle r =
                    (CellRendererToggle) cell;
                PluginInfo info =
                    (PluginInfo) model.GetValue (iter, 0);
                r.Active = info.Loaded;
            }
        static void OutlineTreeIconFunc(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            var    pixRenderer = (CellRendererImage)cell;
            object o           = model.GetValue(iter, 0);

            if (o is SyntaxNode)
            {
                pixRenderer.Image = ImageService.GetIcon(((SyntaxNode)o).GetStockIcon(), IconSize.Menu);
            }
            else if (o is SyntaxTrivia)
            {
                pixRenderer.Image = ImageService.GetIcon(Ide.Gui.Stock.Add, IconSize.Menu);
            }
        }
            protected bool SearchFilterFunc(TreeModel model,
							 TreeIter iter)
            {
                string search = searchEntry.Text.Trim ();
                if (search.Length == 0)
                    return true;
                search = search.ToLower ();

                PGNChessGame game =
                    (PGNChessGame) model.GetValue (iter,
                                       0);

                string str;
                if ((str =
                     game.GetTagValue ("White", null)) != null
                    && str.ToLower ().IndexOf (search) >= 0)
                    return true;
                if ((str =
                     game.GetTagValue ("Black", null)) != null
                    && str.ToLower ().IndexOf (search) >= 0)
                    return true;
                if ((str =
                     game.GetTagValue ("Event", null)) != null
                    && str.ToLower ().IndexOf (search) >= 0)
                    return true;
                if ((str =
                     game.GetTagValue ("Result",
                               null)) != null
                    && str.ToLower ().Equals (search))
                    return true;
                return false;
            }
        void OutlineTreeTextFunc(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            var    txtRenderer = (CellRendererText)cell;
            object o           = model.GetValue(iter, 0);
            var    syntaxNode  = o as SyntaxNode;

            if (syntaxNode != null)
            {
                txtRenderer.Text = astAmbience.GetEntityMarkup(syntaxNode);
            }
            else if (o is SyntaxTrivia)
            {
                txtRenderer.Text = ((SyntaxTrivia)o).ToString();
            }
        }