private void SetupTree()
            {
                tree = new TreeView ();
                this.store = new ListStore (typeof (object));
                tree.Model = store;

                TreeViewColumn col = new TreeViewColumn ();
                col.Sizing = TreeViewColumnSizing.Fixed;
                col.Spacing = 4;

                CellRendererText text_renderer =
                    new CellRendererText ();
                text_renderer.WrapMode = Pango.WrapMode.Word;
                col.PackStart (text_renderer, true);
                col.SetCellDataFunc (text_renderer,
                             new
                             TreeCellDataFunc
                             (PluginInfoCellDataFunc));

                CellRendererToggle loaded_renderer =
                    new CellRendererToggle ();
                loaded_renderer.Activatable = false;
                col.PackStart (loaded_renderer, false);
                col.SetCellDataFunc (loaded_renderer,
                             new
                             TreeCellDataFunc
                             (LoadedStatusCellDataFunc));

                col.Title = Catalog.GetString("Plugins Details");
                tree.AppendColumn (col);
            }
Example #2
0
        private void UpdateColumns()
        {
            foreach (TreeViewColumn column in _gameTable.Columns)
            {
                _gameTable.RemoveColumn(column);
            }

            CellRendererToggle favToggle = new CellRendererToggle();

            favToggle.Toggled += FavToggle_Toggled;

            if (ConfigurationState.Instance.Ui.GuiColumns.FavColumn)
            {
                _gameTable.AppendColumn("Fav", favToggle, "active", 0);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.IconColumn)
            {
                _gameTable.AppendColumn("Icon", new CellRendererPixbuf(), "pixbuf", 1);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.AppColumn)
            {
                _gameTable.AppendColumn("Application", new CellRendererText(), "text", 2);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.DevColumn)
            {
                _gameTable.AppendColumn("Developer", new CellRendererText(), "text", 3);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.VersionColumn)
            {
                _gameTable.AppendColumn("Version", new CellRendererText(), "text", 4);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.TimePlayedColumn)
            {
                _gameTable.AppendColumn("Time Played", new CellRendererText(), "text", 5);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.LastPlayedColumn)
            {
                _gameTable.AppendColumn("Last Played", new CellRendererText(), "text", 6);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.FileExtColumn)
            {
                _gameTable.AppendColumn("File Ext", new CellRendererText(), "text", 7);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.FileSizeColumn)
            {
                _gameTable.AppendColumn("File Size", new CellRendererText(), "text", 8);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.PathColumn)
            {
                _gameTable.AppendColumn("Path", new CellRendererText(), "text", 9);
            }

            foreach (TreeViewColumn column in _gameTable.Columns)
            {
                if (column.Title == "Fav" && ConfigurationState.Instance.Ui.GuiColumns.FavColumn)
                {
                    column.SortColumnId = 0;
                }
                else if (column.Title == "Application" && ConfigurationState.Instance.Ui.GuiColumns.AppColumn)
                {
                    column.SortColumnId = 2;
                }
                else if (column.Title == "Developer" && ConfigurationState.Instance.Ui.GuiColumns.DevColumn)
                {
                    column.SortColumnId = 3;
                }
                else if (column.Title == "Version" && ConfigurationState.Instance.Ui.GuiColumns.VersionColumn)
                {
                    column.SortColumnId = 4;
                }
                else if (column.Title == "Time Played" && ConfigurationState.Instance.Ui.GuiColumns.TimePlayedColumn)
                {
                    column.SortColumnId = 5;
                }
                else if (column.Title == "Last Played" && ConfigurationState.Instance.Ui.GuiColumns.LastPlayedColumn)
                {
                    column.SortColumnId = 6;
                }
                else if (column.Title == "File Ext" && ConfigurationState.Instance.Ui.GuiColumns.FileExtColumn)
                {
                    column.SortColumnId = 7;
                }
                else if (column.Title == "File Size" && ConfigurationState.Instance.Ui.GuiColumns.FileSizeColumn)
                {
                    column.SortColumnId = 8;
                }
                else if (column.Title == "Path" && ConfigurationState.Instance.Ui.GuiColumns.PathColumn)
                {
                    column.SortColumnId = 9;
                }
            }
        }
Example #3
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;

            //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);

            _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();
            }

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

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

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

            if (ConfigurationState.Instance.System.EnableMulticoreScheduling)
            {
                _multiSchedToggle.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();
            }

            TimeZoneContentManager timeZoneContentManager = new TimeZoneContentManager();

            timeZoneContentManager.InitializeInstance(virtualFileSystem, contentManager, LibHac.FsSystem.IntegrityCheckLevel.None);

            List <string> locationNames = timeZoneContentManager.LocationNameCache.ToList();

            locationNames.Sort();

            foreach (string locationName in locationNames)
            {
                _systemTimeZoneSelect.Append(locationName, locationName);
            }

            _audioBackendSelect.Append(AudioBackend.Dummy.ToString(), AudioBackend.Dummy.ToString());
            if (SoundIoAudioOut.IsSupported)
            {
                _audioBackendSelect.Append(AudioBackend.SoundIo.ToString(), "SoundIO");
            }
            if (OpenALAudioOut.IsSupported)
            {
                _audioBackendSelect.Append(AudioBackend.OpenAl.ToString(), "OpenAL");
            }

            _systemLanguageSelect.SetActiveId(ConfigurationState.Instance.System.Language.Value.ToString());
            _systemRegionSelect.SetActiveId(ConfigurationState.Instance.System.Region.Value.ToString());
            _audioBackendSelect.SetActiveId(ConfigurationState.Instance.System.AudioBackend.Value.ToString());
            _systemTimeZoneSelect.SetActiveId(timeZoneContentManager.SanityCheckDeviceLocationName());
            _resScaleCombo.SetActiveId(ConfigurationState.Instance.Graphics.ResScale.Value.ToString());
            _anisotropy.SetActiveId(ConfigurationState.Instance.Graphics.MaxAnisotropy.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();
        }
Example #4
0
        private DlcWindow(Builder builder, VirtualFileSystem virtualFileSystem, string titleId, string titleName) : base(builder.GetObject("_dlcWindow").Handle)
        {
            builder.Autoconnect(this);

            _titleId                 = titleId;
            _virtualFileSystem       = virtualFileSystem;
            _dlcJsonPath             = System.IO.Path.Combine(AppDataManager.GamesDirPath, _titleId, "dlc.json");
            _baseTitleInfoLabel.Text = $"DLC Available for {titleName} [{titleId.ToUpper()}]";

            try
            {
                _dlcContainerList = JsonHelper.DeserializeFromFile <List <DownloadableContentContainer> >(_dlcJsonPath);
            }
            catch
            {
                _dlcContainerList = new List <DownloadableContentContainer>();
            }

            _dlcTreeView.Model = new TreeStore(typeof(bool), typeof(string), typeof(string));

            CellRendererToggle enableToggle = new CellRendererToggle();

            enableToggle.Toggled += (sender, args) =>
            {
                _dlcTreeView.Model.GetIter(out TreeIter treeIter, new TreePath(args.Path));
                bool newValue = !(bool)_dlcTreeView.Model.GetValue(treeIter, 0);
                _dlcTreeView.Model.SetValue(treeIter, 0, newValue);

                if (_dlcTreeView.Model.IterChildren(out TreeIter childIter, treeIter))
                {
                    do
                    {
                        _dlcTreeView.Model.SetValue(childIter, 0, newValue);
                    }while (_dlcTreeView.Model.IterNext(ref childIter));
                }
            };

            _dlcTreeView.AppendColumn("Enabled", enableToggle, "active", 0);
            _dlcTreeView.AppendColumn("TitleId", new CellRendererText(), "text", 1);
            _dlcTreeView.AppendColumn("Path", new CellRendererText(), "text", 2);

            foreach (DownloadableContentContainer dlcContainer in _dlcContainerList)
            {
                if (File.Exists(dlcContainer.ContainerPath))
                {
                    // The parent tree item has its own "enabled" check box, but it's the actual
                    // nca entries that store the enabled / disabled state. A bit of a UI inconsistency.
                    // Maybe a tri-state check box would be better, but for now we check the parent
                    // "enabled" box if all child NCAs are enabled. Usually fine since each nsp has only one nca.
                    bool     areAllContentPacksEnabled = dlcContainer.DownloadableContentNcaList.TrueForAll((nca) => nca.Enabled);
                    TreeIter parentIter = ((TreeStore)_dlcTreeView.Model).AppendValues(areAllContentPacksEnabled, "", dlcContainer.ContainerPath);
                    using FileStream containerFile = File.OpenRead(dlcContainer.ContainerPath);
                    PartitionFileSystem pfs = new PartitionFileSystem(containerFile.AsStorage());
                    _virtualFileSystem.ImportTickets(pfs);

                    foreach (DownloadableContentNca dlcNca in dlcContainer.DownloadableContentNcaList)
                    {
                        using var ncaFile = new UniqueRef <IFile>();

                        pfs.OpenFile(ref ncaFile.Ref(), dlcNca.FullPath.ToU8Span(), OpenMode.Read).ThrowIfFailure();
                        Nca nca = TryCreateNca(ncaFile.Get.AsStorage(), dlcContainer.ContainerPath);

                        if (nca != null)
                        {
                            ((TreeStore)_dlcTreeView.Model).AppendValues(parentIter, dlcNca.Enabled, nca.Header.TitleId.ToString("X16"), dlcNca.FullPath);
                        }
                    }
                }
                else
                {
                    // DLC file moved or renamed. Allow the user to remove it without crashing the whole dialog.
                    TreeIter parentIter = ((TreeStore)_dlcTreeView.Model).AppendValues(false, "", $"(MISSING) {dlcContainer.ContainerPath}");
                }
            }
        }
Example #5
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.Graphics.EnableVsync)
            {
                _vSyncToggle.Click();
            }

            if (ConfigurationState.Instance.System.EnableMulticoreScheduling)
            {
                _multiSchedToggle.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());

            _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()
                };
            });
Example #6
0
        void Build()
        {
            BorderWidth   = 0;
            DefaultWidth  = 901;
            DefaultHeight = 632;

            Name  = "wizard_dialog";
            Title = GettextCatalog.GetString("New Project");

            projectConfigurationWidget      = new GtkProjectConfigurationWidget();
            projectConfigurationWidget.Name = "projectConfigurationWidget";

            // Top banner of dialog.
            var topLabelEventBox = new EventBox();

            topLabelEventBox.Accessible.SetShouldIgnore(true);
            topLabelEventBox.Name          = "topLabelEventBox";
            topLabelEventBox.HeightRequest = 52;
            topLabelEventBox.ModifyBg(StateType.Normal, bannerBackgroundColor);
            topLabelEventBox.ModifyFg(StateType.Normal, whiteColor);
            topLabelEventBox.BorderWidth = 0;

            var topBannerBottomEdgeLineEventBox = new EventBox();

            topBannerBottomEdgeLineEventBox.Accessible.SetShouldIgnore(true);
            topBannerBottomEdgeLineEventBox.Name          = "topBannerBottomEdgeLineEventBox";
            topBannerBottomEdgeLineEventBox.HeightRequest = 1;
            topBannerBottomEdgeLineEventBox.ModifyBg(StateType.Normal, bannerLineColor);
            topBannerBottomEdgeLineEventBox.BorderWidth = 0;

            topBannerLabel                 = new Label();
            topBannerLabel.Name            = "topBannerLabel";
            topBannerLabel.Accessible.Name = "topBannerLabel";
            Pango.FontDescription font = topBannerLabel.Style.FontDescription.Copy();              // UNDONE: VV: Use FontService?
            font.Size   = (int)(font.Size * 2.0);
            font.Weight = Pango.Weight.Bold;
            topBannerLabel.ModifyFont(font);
            topBannerLabel.ModifyFg(StateType.Normal, whiteColor);
            var topLabelHBox = new HBox();

            topLabelHBox.Accessible.SetShouldIgnore(true);
            topLabelHBox.Name = "topLabelHBox";
            topLabelHBox.PackStart(topBannerLabel, false, false, 20);
            topLabelEventBox.Add(topLabelHBox);

            VBox.PackStart(topLabelEventBox, false, false, 0);
            VBox.PackStart(topBannerBottomEdgeLineEventBox, false, false, 0);

            // Main templates section.
            centreVBox = new VBox();
            centreVBox.Accessible.SetShouldIgnore(true);
            centreVBox.Name = "centreVBox";
            VBox.PackStart(centreVBox, true, true, 0);
            templatesHBox = new HBox();
            templatesHBox.Accessible.SetShouldIgnore(true);
            templatesHBox.Name = "templatesHBox";
            centreVBox.PackEnd(templatesHBox, true, true, 0);

            // Template categories.
            var templateCategoriesBgBox = new EventBox();

            templateCategoriesBgBox.Accessible.SetShouldIgnore(true);
            templateCategoriesBgBox.Name        = "templateCategoriesVBox";
            templateCategoriesBgBox.BorderWidth = 0;
            templateCategoriesBgBox.ModifyBg(StateType.Normal, categoriesBackgroundColor);
            templateCategoriesBgBox.WidthRequest = 220;
            var templateCategoriesScrolledWindow = new ScrolledWindow();

            templateCategoriesScrolledWindow.Name             = "templateCategoriesScrolledWindow";
            templateCategoriesScrolledWindow.HscrollbarPolicy = PolicyType.Never;

            // Template categories tree view.
            templateCategoriesTreeView                 = new TreeView();
            templateCategoriesTreeView.Name            = "templateCategoriesTreeView";
            templateCategoriesTreeView.Accessible.Name = "templateCategoriesTreeView";
            templateCategoriesTreeView.Accessible.SetTitle(GettextCatalog.GetString("Project Categories"));
            templateCategoriesTreeView.Accessible.Description = GettextCatalog.GetString("Select the project category to see all possible project templates");
            templateCategoriesTreeView.BorderWidth            = 0;
            templateCategoriesTreeView.HeadersVisible         = false;
            templateCategoriesTreeView.Model         = templateCategoriesTreeStore;
            templateCategoriesTreeView.SearchColumn  = -1;            // disable the interactive search
            templateCategoriesTreeView.ShowExpanders = false;

            templateCategoriesTreeView.AppendColumn(CreateTemplateCategoriesTreeViewColumn());
            templateCategoriesScrolledWindow.Add(templateCategoriesTreeView);
            templateCategoriesBgBox.Add(templateCategoriesScrolledWindow);
            templatesHBox.PackStart(templateCategoriesBgBox, false, false, 0);

            // Templates.
            var templatesBgBox = new EventBox();

            templatesBgBox.Accessible.SetShouldIgnore(true);
            templatesBgBox.ModifyBg(StateType.Normal, templateListBackgroundColor);
            templatesBgBox.Name         = "templatesVBox";
            templatesBgBox.WidthRequest = 400;
            templatesHBox.PackStart(templatesBgBox, false, false, 0);
            var templatesScrolledWindow = new ScrolledWindow();

            templatesScrolledWindow.Name             = "templatesScrolledWindow";
            templatesScrolledWindow.HscrollbarPolicy = PolicyType.Never;

            // Templates tree view.
            templatesTreeView                 = new TreeView();
            templatesTreeView.Name            = "templatesTreeView";
            templatesTreeView.Accessible.Name = "templatesTreeView";
            templatesTreeView.Accessible.SetTitle(GettextCatalog.GetString("Project Templates"));
            templatesTreeView.Accessible.Description = GettextCatalog.GetString("Select the project template");
            templatesTreeView.HeadersVisible         = false;
            templatesTreeView.Model         = templatesTreeStore;
            templatesTreeView.SearchColumn  = -1;            // disable the interactive search
            templatesTreeView.ShowExpanders = false;
            templatesTreeView.AppendColumn(CreateTemplateListTreeViewColumn());
            templatesScrolledWindow.Add(templatesTreeView);
            templatesBgBox.Add(templatesScrolledWindow);

            // Accessibilityy
            templateCategoriesTreeView.Accessible.AddLinkedUIElement(templatesTreeView.Accessible);

            // Template
            var templateEventBox = new EventBox();

            templateEventBox.Accessible.SetShouldIgnore(true);
            templateEventBox.Name = "templateEventBox";
            templateEventBox.ModifyBg(StateType.Normal, templateBackgroundColor);
            templatesHBox.PackStart(templateEventBox, true, true, 0);
            templateVBox = new VBox();
            templateVBox.Accessible.SetShouldIgnore(true);
            templateVBox.Visible     = false;
            templateVBox.BorderWidth = 20;
            templateVBox.Spacing     = 10;
            templateEventBox.Add(templateVBox);

            // Template large image.
            templateImage = new ImageView();
            templateImage.Accessible.SetShouldIgnore(true);
            templateImage.Name          = "templateImage";
            templateImage.HeightRequest = 140;
            templateImage.WidthRequest  = 240;
            templateVBox.PackStart(templateImage, false, false, 10);

            // Template description.
            templateNameLabel                        = new Label();
            templateNameLabel.Name                   = "templateNameLabel";
            templateNameLabel.Accessible.Name        = "templateNameLabel";
            templateNameLabel.Accessible.Description = GettextCatalog.GetString("The name of the selected template");
            templateNameLabel.WidthRequest           = 240;
            templateNameLabel.Wrap                   = true;
            templateNameLabel.Xalign                 = 0;
            templateNameLabel.Markup                 = MarkupTemplateName("TemplateName");
            templateVBox.PackStart(templateNameLabel, false, false, 0);
            templateDescriptionLabel                 = new Label();
            templateDescriptionLabel.Name            = "templateDescriptionLabel";
            templateDescriptionLabel.Accessible.Name = "templateDescriptionLabel";
            templateDescriptionLabel.Accessible.SetLabel(GettextCatalog.GetString("The description of the selected template"));
            templateDescriptionLabel.WidthRequest = 240;
            templateDescriptionLabel.Wrap         = true;
            templateDescriptionLabel.Xalign       = 0;
            templateVBox.PackStart(templateDescriptionLabel, false, false, 0);

            var tempLabel = new Label();

            tempLabel.Accessible.SetShouldIgnore(true);
            templateVBox.PackStart(tempLabel, true, true, 0);

            templatesTreeView.Accessible.AddLinkedUIElement(templateNameLabel.Accessible);
            templatesTreeView.Accessible.AddLinkedUIElement(templateDescriptionLabel.Accessible);

            // Template - button separator.
            var templateSectionSeparatorEventBox = new EventBox();

            templateSectionSeparatorEventBox.Accessible.SetShouldIgnore(true);
            templateSectionSeparatorEventBox.Name          = "templateSectionSeparatorEventBox";
            templateSectionSeparatorEventBox.HeightRequest = 1;
            templateSectionSeparatorEventBox.ModifyBg(StateType.Normal, templateSectionSeparatorColor);
            VBox.PackStart(templateSectionSeparatorEventBox, false, false, 0);

            // Buttons at bottom of dialog.
            var bottomHBox = new HBox();

            bottomHBox.Accessible.SetShouldIgnore(true);
            bottomHBox.Name = "bottomHBox";
            VBox.PackStart(bottomHBox, false, false, 0);

            // Cancel button - bottom left.
            var cancelButtonBox = new HButtonBox();

            cancelButtonBox.Accessible.SetShouldIgnore(true);
            cancelButtonBox.Name        = "cancelButtonBox";
            cancelButtonBox.BorderWidth = 16;
            cancelButton                        = new Button();
            cancelButton.Name                   = "cancelButton";
            cancelButton.Accessible.Name        = "cancelButton";
            cancelButton.Accessible.Description = GettextCatalog.GetString("Cancel the dialog");
            cancelButton.Label                  = GettextCatalog.GetString("Cancel");
            cancelButton.UseStock               = true;
            cancelButtonBox.PackStart(cancelButton, false, false, 0);
            bottomHBox.PackStart(cancelButtonBox, false, false, 0);

            // Previous button - bottom right.
            var previousNextButtonBox = new HButtonBox();

            previousNextButtonBox.Accessible.SetShouldIgnore(true);
            previousNextButtonBox.Name        = "previousNextButtonBox";
            previousNextButtonBox.BorderWidth = 16;
            previousNextButtonBox.Spacing     = 9;
            bottomHBox.PackStart(previousNextButtonBox);
            previousNextButtonBox.Layout = ButtonBoxStyle.End;

            previousButton                        = new Button();
            previousButton.Name                   = "previousButton";
            previousButton.Accessible.Name        = "previousButton";
            previousButton.Accessible.Description = GettextCatalog.GetString("Return to the previous page");
            previousButton.Label                  = GettextCatalog.GetString("Previous");
            previousButton.Sensitive              = false;
            previousNextButtonBox.PackEnd(previousButton);

            // Next button - bottom right.
            nextButton                        = new Button();
            nextButton.Name                   = "nextButton";
            nextButton.Accessible.Name        = "nextButton";
            nextButton.Accessible.Description = GettextCatalog.GetString("Move to the next page");
            nextButton.Label                  = GettextCatalog.GetString("Next");
            previousNextButtonBox.PackEnd(nextButton);

            // Remove default button action area.
            VBox.Remove(ActionArea);

            if (Child != null)
            {
                Child.ShowAll();
            }

            templatesTreeView.HasFocus = true;
            Resizable = false;
        }
Example #7
0
        public AddinView()
        {
            var hbox = new HBox()
            {
                Spacing = 6
            };

            var filter_label = new Label(Catalog.GetString("Show:"));
            var filter_combo = ComboBox.NewText();

            filter_combo.AppendText(Catalog.GetString("All"));
            filter_combo.AppendText(Catalog.GetString("Enabled"));
            filter_combo.AppendText(Catalog.GetString("Not Enabled"));
            filter_combo.Active = 0;

            var search_label = new Label(Catalog.GetString("Search:"));
            var search_entry = new Banshee.Widgets.SearchEntry()
            {
                WidthRequest = 160,
                Visible      = true,
                Ready        = true
            };

            hbox.PackStart(filter_label, false, false, 0);
            hbox.PackStart(filter_combo, false, false, 0);
            hbox.PackEnd(search_entry, false, false, 0);
            hbox.PackEnd(search_label, false, false, 0);

            var model = new TreeStore(typeof(bool), typeof(bool), typeof(string), typeof(Addin));

            var addins = AddinManager.Registry.GetAddins().Where(a => { return
                                                                        (a.Name != a.Id && a.Description != null &&
                                                                         !String.IsNullOrEmpty(a.Description.Category) && !a.Description.Category.StartsWith("required:") &&
                                                                         (!a.Description.Category.Contains("Debug") || ApplicationContext.Debugging)); });

            var categorized_addins = addins.GroupBy <Addin, string> (a => a.Description.Category)
                                     .Select(c => new {
                Addins        = c.OrderBy(a => Catalog.GetString(a.Name)).ToList(),
                Name          = c.Key,
                NameLocalized = Catalog.GetString(c.Key)
            })
                                     .OrderBy(c => c.NameLocalized)
                                     .ToList();

            tree_view = new TreeView()
            {
                FixedHeightMode = false,
                HeadersVisible  = false,
                SearchColumn    = 1,
                RulesHint       = true,
                Model           = model
            };

            var update_model = new System.Action(() => {
                string search = search_entry.Query;
                bool?enabled  = filter_combo.Active > 0 ? (bool?)(filter_combo.Active == 1 ? true : false) : null;
                model.Clear();
                foreach (var cat in categorized_addins)
                {
                    var cat_iter = model.AppendValues(false, false, String.Format("<b>{0}</b>", GLib.Markup.EscapeText(cat.NameLocalized)), null);
                    bool any     = false;
                    foreach (var a in cat.Addins.Matching(search))
                    {
                        if (enabled == null || (a.Enabled == enabled.Value))
                        {
                            model.AppendValues(cat_iter, true,
                                               a.Enabled,
                                               String.Format(
                                                   "<b>{0}</b>\n<small>{1}</small>",
                                                   GLib.Markup.EscapeText(Catalog.GetString(a.Name)),
                                                   GLib.Markup.EscapeText(Catalog.GetString(a.Description.Description))),
                                               a
                                               );
                            any = true;
                        }
                    }

                    if (!any)
                    {
                        model.Remove(ref cat_iter);
                    }
                }
                tree_view.ExpandAll();
            });

            var txt_cell = new CellRendererText()
            {
                WrapMode = Pango.WrapMode.Word
            };

            tree_view.AppendColumn("Name", txt_cell, "markup", Columns.Name);

            var check_cell = new CellRendererToggle()
            {
                Activatable = true
            };

            tree_view.AppendColumn("Enable", check_cell, "visible", Columns.IsAddin, "active", Columns.IsEnabled);
            check_cell.Toggled += (o, a) => {
                TreeIter iter;
                if (model.GetIter(out iter, new TreePath(a.Path)))
                {
                    var  addin   = model.GetValue(iter, 3) as Addin;
                    bool enabled = (bool)model.GetValue(iter, 1);
                    addin.Enabled = !enabled;
                    model.SetValue(iter, 1, addin.Enabled);
                    model.Foreach(delegate(TreeModel current_model, TreePath path, TreeIter current_iter) {
                        var an = current_model.GetValue(current_iter, 3) as Addin;
                        if (an != null)
                        {
                            current_model.SetValue(current_iter, 1, an.Enabled);
                        }
                        return(false);
                    });
                }
            };

            update_model();
            search_entry.Changed += (o, a) => update_model();
            filter_combo.Changed += (o, a) => update_model();

            var tree_scroll = new Hyena.Widgets.ScrolledWindow()
            {
                HscrollbarPolicy = PolicyType.Never
            };

            tree_scroll.AddWithFrame(tree_view);

            Spacing = 6;
            PackStart(hbox, false, false, 0);
            PackStart(tree_scroll, true, true, 0);
            ShowAll();
            search_entry.InnerEntry.GrabFocus();

            txt_cell.WrapWidth = 300;
        }
Example #8
0
        public TodoOutput()
        {
            this.ShadowType         = ShadowType.Out;
            treeView                = new TreeView();
            treeView.Selection.Mode = Gtk.SelectionMode.Single;

            treeView.Model = outputModel;

            FontDescription customFont = Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont);

            treeView.ModifyFont(customFont);

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

            TreeViewColumn tvcName = new TreeViewColumn(MainClass.Languages.Translate("description"), fileNameRenderer, "text", 0);

            tvcName.MinWidth  = 350;
            tvcName.Resizable = true;
            treeView.AppendColumn(tvcName);

            TreeViewColumn tvcState = new TreeViewColumn(MainClass.Languages.Translate("file"), fileNameRenderer, "text", 3);

            tvcState.MinWidth  = 50;
            tvcState.Resizable = true;
            treeView.AppendColumn(tvcState);

            TreeViewColumn tvcMessage = new TreeViewColumn(MainClass.Languages.Translate("line"), fileNameRenderer, "text", 2);

            tvcMessage.MinWidth  = 25;
            tvcMessage.Resizable = true;
            tvcMessage.Visible   = false;
            treeView.AppendColumn(tvcMessage);

            treeView.HeadersVisible  = true;
            treeView.EnableTreeLines = true;

            treeView.RowActivated += new RowActivatedHandler(OnRowActivate);
            treeView.EnableSearch  = false;
            treeView.HasFocus      = false;

            treeView.ButtonReleaseEvent += delegate(object o, ButtonReleaseEventArgs args) {
                if (args.Event.Button != 3)
                {
                    return;
                }

                Menu popupMenu = new Menu();

                /*
                 * MenuItem miClear = new MenuItem( MainClass.Languages.Translate("clear" ));
                 * miClear.Activated+= delegate(object sender, EventArgs e) {
                 *      Clear();
                 * };
                 * popupMenu.Append(miClear);*/

                TreeSelection  ts     = treeView.Selection;
                Gtk.TreePath[] selRow = ts.GetSelectedRows();

                MenuItem miCopy = new MenuItem(MainClass.Languages.Translate("copy_f2"));
                miCopy.Activated += delegate(object sender, EventArgs e) {
                    Gtk.TreePath tp = selRow[0];
                    TreeIter     ti = new TreeIter();
                    outputModel.GetIter(out ti, tp);
                    string type      = outputModel.GetValue(ti, 0).ToString();
                    string timeStamp = outputModel.GetValue(ti, 1).ToString();
                    //string message = outputModel.GetValue(ti, 2).ToString();

                    Gtk.Clipboard clipboard = this.GetClipboard(Gdk.Selection.Clipboard);
                    string        txt       = type + "\t" + timeStamp;   //+"\t"+message;

                    clipboard.Text = txt;
                };
                popupMenu.Append(miCopy);

                if (selRow.Length < 1)
                {
                    miCopy.Sensitive = false;
                }
                popupMenu.Popup();
                popupMenu.ShowAll();
            };

            outputDispatcher = new GLib.TimeoutHandler(OutputDispatchHandler);

            this.Add(treeView);

            oldError = new List <TaskMessage>();

            this.ShowAll();
        }
Example #9
0
        public UserInfoDialog(Window parent, Network network, Node node) : base(parent, "UserInfoDialog")
        {
            this.node    = node;
            this.network = network;

            base.Window.Title = node.ToString();

            avatarImage.Pixbuf = Gui.AvatarManager.GetAvatar(node);

            nickNameLabel.Markup = string.Format("<span weight=\"bold\" size=\"x-large\">{0}</span> on <i>{1}</i>\n<span font=\"monospace\" size=\"small\">{2}</span>",
                                                 node.NickName, network.NetworkName, Common.Utils.FormatFingerprint(node.NodeID, 4));

            realNameLabel.Text = node.RealName;
            emailLabel.Text    = node.Email;

            TreeViewColumn column;

            column = addressesTreeView.AppendColumn("Protocol", new CellRendererText(), "text", 0);

            column        = addressesTreeView.AppendColumn("Address Details", new CellRendererText(), "text", 1);
            column.Expand = true;

            addressesTreeView.AppendColumn("Supported", new CellRendererText(), "text", 2);
            addressesTreeView.AppendColumn("Open Externally", new CellRendererText(), "text", 3);
            addressesTreeView.AppendColumn("Connectable", new CellRendererText(), "text", 4);

            addressListStore = new ListStore(typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));

            IDestination[]    destinations = null;
            DestinationInfo[] destinationInfos;
            if (node.IsMe)
            {
                destinationInfos = Runtime.Core.DestinationManager.DestinationInfos;
            }
            else
            {
                destinationInfos = node.GetTrustedNode().DestinationInfos.ToArray();
                destinations     = node.GetTrustedNode().GetDestinations(Runtime.Core);
            }

            if (destinations != null)
            {
                foreach (IDestination destination in destinations)
                {
                    addressListStore.AppendValues(destination.FriendlyTypeName, destination.ToString(), "True", destination.IsOpenExternally.ToString(), destination.CanConnect.ToString());
                }
            }

            foreach (DestinationInfo info in destinationInfos)
            {
                if ((!info.IsSupported(Runtime.Core)) || destinations == null)
                {
                    if (node.IsMe)
                    {
                        addressListStore.AppendValues(info.FriendlyName, string.Join(", ", info.Data), info.IsSupported(Runtime.Core).ToString(), info.IsOpenExternally.ToString(), string.Empty);
                    }
                    else
                    {
                        addressListStore.AppendValues(info.FriendlyName, string.Join(", ", info.Data), "False", info.IsOpenExternally.ToString(), "False");
                    }
                }
            }

            addressesTreeView.Model = addressListStore;

            clientNameLabel.Text      = node.ClientName;
            clientVersionLabel.Text   = node.ClientVersion;
            operatingSystemLabel.Text = node.OperatingSystem;
        }
Example #10
0
        public WindowBuilder()
        {
            _columnFilter = 0;
            _textToFilter = "";

            _processIdToKill = new List <int>();
            _listStore       = new ListStore(typeof(string), typeof(string), typeof(string), typeof(string),
                                             typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));

            Application.Init();

            _window = new Window("Label sample");
            _window.Resize(1300, 600);
            _window.Title = "Process Watch";
            _window.SetIconFromFile("icons/processIconSmall.png");
            _window.BorderWidth  = 5;
            _window.DeleteEvent += OnWindowClose;

            var aboutButton = new Button();
            var aboutIcon   = new Image();

            aboutIcon.Pixbuf        = new Pixbuf("icons/information.png");
            aboutButton.Image       = aboutIcon;
            aboutButton.TooltipText = "About Process Watch";
            aboutButton.Clicked    += (sender, args) =>
            {
                _aboutDialog.Show();
            };

            _aboutDialog = CreateAboutDialog();

            var filterButton = new Button();

            filterButton.Image       = new Image(Stock.Find, IconSize.Button);
            filterButton.TooltipText = "Filtration utilities";
            filterButton.Clicked    += (sender, args) =>
            {
                if (_filtrationHBox.IsVisible)
                {
                    _filtrationHBox.Hide();
                }
                else
                {
                    _filtrationHBox.ShowAll();
                }
            };

            var windowHBox = new HBox(false, 5);

            windowHBox.PackEnd(aboutButton, false, false, 0);
            windowHBox.PackEnd(filterButton, false, false, 0);

            _processNameEntry          = new Entry();
            _processNameEntry.Changed += OnChanged;

            _processIdEntry               = new Entry();
            _processIdEntry.Changed      += OnChanged;
            _processIdEntry.TextInserted += OnlyNumerical;

            // String values for the combobox - filtration direction
            _filtrationDirectionOptions = new[]
            {
                ">",
                "≥",
                "=",
                "≤",
                "<"
            };

            // String values for the combobox - memory usage units
            _memoryFiltrationDirectionUnits = new[]
            {
                "B",
                "KB",
                "MB",
                "GB"
            };


            _memoryFiltrationEntry = new Entry();
            _memoryFiltrationEntry.MaxWidthChars = 7;
            _memoryFiltrationEntry.WidthChars    = 7;
            _memoryFiltrationEntry.Changed      += OnChanged;
            _memoryFiltrationEntry.TextInserted += OnlyNumerical;

            _memoryFiltrationDirectionComboBox          = new ComboBox(_filtrationDirectionOptions);
            _memoryFiltrationDirectionComboBox.Changed += OnChanged;

            _memoryFiltrationUnitsComboBox          = new ComboBox(_memoryFiltrationDirectionUnits);
            _memoryFiltrationUnitsComboBox.Changed += OnChanged;

            _memoryFiltrationHbox = new HBox();
            _memoryFiltrationHbox.PackStart(_memoryFiltrationDirectionComboBox, false, false, 0);
            _memoryFiltrationHbox.PackStart(_memoryFiltrationEntry, false, false, 0);
            _memoryFiltrationHbox.PackStart(_memoryFiltrationUnitsComboBox, false, false, 0);


            _cpuFiltrationEntry = new Entry();
            _cpuFiltrationEntry.MaxWidthChars = 7;
            _cpuFiltrationEntry.WidthChars    = 7;
            _cpuFiltrationEntry.Changed      += OnChanged;
            _cpuFiltrationEntry.TextInserted += OnlyNumerical;

            _cpuFiltrationDirectionComboBox          = new ComboBox(_filtrationDirectionOptions);
            _cpuFiltrationDirectionComboBox.Changed += OnChanged;

            var cpuFiltrationLabel = new Label("%");

            _cpuFiltrationHbox = new HBox();
            _cpuFiltrationHbox.PackStart(_cpuFiltrationDirectionComboBox, false, false, 0);
            _cpuFiltrationHbox.PackStart(_cpuFiltrationEntry, false, false, 0);
            _cpuFiltrationHbox.PackStart(cpuFiltrationLabel, false, false, 0);


            _filtrationOptions = new[]
            {
                "All processes",
                "Filter by PID",
                "Filter by Process Name",
                "Filter by Memory Usage",
                "Filter by CPU usage",
            };

            var filtrationCombo = new ComboBox(_filtrationOptions);

            filtrationCombo.Changed += ComboOnChanged;

            _filtrationHBox = new HBox(false, 5);
            _filtrationHBox.PackStart(filtrationCombo, false, false, 0);


            string[] columnLabels =
            {
                "PID",
                "Process name",
                "Memory usage",
                "Priority",
                "User CPU Time",
                "Privileged CPU Time",
                "Total CPU Time",
                "CPU usage",
                "Threads",
                "Start Time"
            };


            _treeModelFilter             = new TreeModelFilter(_listStore, null);
            _treeModelFilter.VisibleFunc = Filter;

            var treeModelSort = new TreeModelSort(_treeModelFilter);

            treeModelSort.SetSortFunc(0, WindowBuilderHelper.IdSortFunc);
            treeModelSort.SetSortFunc(1, WindowBuilderHelper.ProcessNameSortFunc);
            treeModelSort.SetSortFunc(2, WindowBuilderHelper.MemoryUsageSortFunc);
            treeModelSort.SetSortFunc(3, WindowBuilderHelper.PrioritySortFunc);
            treeModelSort.SetSortFunc(4, WindowBuilderHelper.UserCpuTimeSortFunc);
            treeModelSort.SetSortFunc(5, WindowBuilderHelper.PrivilegedCpuTimeSortFunc);
            treeModelSort.SetSortFunc(6, WindowBuilderHelper.TotalCpuTimeSortFunc);
            treeModelSort.SetSortFunc(7, WindowBuilderHelper.CpuUsageSortFunc);
            treeModelSort.SetSortFunc(8, WindowBuilderHelper.ThreadCountSortFunc);
            treeModelSort.SetSortFunc(9, WindowBuilderHelper.StartTimeSortFunc);

            var treeView = new TreeView();

            treeView.Model              = treeModelSort;
            treeView.Selection.Mode     = SelectionMode.Multiple;
            treeView.Selection.Changed += OnSelectionChanged;
            treeView.TooltipColumn      = 1;

            // Create a scrollable window
            var scrolledWindow = new ScrolledWindow();

            scrolledWindow.Add(treeView);

            // Create a CellRendererText responsible for proper rendering cell data
            var cellRendererText = new CellRendererText();

            cellRendererText.Alignment = Pango.Alignment.Right;
            cellRendererText.Xalign    = 0.5f;

            // Load the _treeView with TreeViewColumns
            for (int i = 0; i < 10; i++)
            {
                var treeViewColumn = new TreeViewColumn();
                treeViewColumn.Clickable     = true;
                treeViewColumn.Resizable     = true;
                treeViewColumn.Title         = columnLabels[i];
                treeViewColumn.SortIndicator = true;
                treeViewColumn.Alignment     = 0.5f;
                treeViewColumn.Expand        = true;
                treeViewColumn.SortColumnId  = i;
                treeViewColumn.PackStart(cellRendererText, true);
                treeViewColumn.AddAttribute(cellRendererText, "text", i);

                switch (i)
                {
                case 0:
                    break;

                case 1:
                    _window.GetSize(out int width, out int height);
                    treeViewColumn.MaxWidth = Math.Abs(width / 2);
                    break;

                case 2:
                    treeViewColumn.SetCellDataFunc(cellRendererText, WindowBuilderHelper.MemoryUsageFormatter);
                    break;

                case 3:
                    break;

                case 4:
                    treeViewColumn.SetCellDataFunc(cellRendererText, WindowBuilderHelper.UserCpuTimeFormatter);
                    break;

                case 5:
                    treeViewColumn.SetCellDataFunc(cellRendererText, WindowBuilderHelper.PrivilegedCpuTimeFormatter);
                    break;

                case 6:
                    treeViewColumn.SetCellDataFunc(cellRendererText, WindowBuilderHelper.TotalCpuTimeFormatter);
                    break;

                case 7:
                    treeViewColumn.SetCellDataFunc(cellRendererText, WindowBuilderHelper.CpuUsageFormatter);
                    break;

                case 8:
                    break;

                case 9:
                    treeViewColumn.SetCellDataFunc(cellRendererText, WindowBuilderHelper.StartTimeFormatter);
                    break;
                }

                treeView.AppendColumn(treeViewColumn);
            }

            var killButton = new Button("Kill process");

            killButton.Clicked += KillProcess;

            var windowVBox = new VBox(false, 5);

            windowVBox.PackStart(windowHBox, false, false, 0);
            windowVBox.PackStart(_filtrationHBox, false, false, 0);
            windowVBox.PackStart(scrolledWindow, true, true, 0);
            windowVBox.PackStart(killButton, false, false, 0);

            _window.Add(windowVBox);

            // Create an instance of the object Updater
            _processGrabber = new ProcessGrabber();
            // Add a callback executed when _processGrabber takes process data.
            // The callback clears the _treeView content and loads new data
            // Before clearing the _treeView content the callback saves the current scroll position
            _processGrabber.OnResult += (sender, processList) =>
            {
                Application.Invoke(delegate
                {
                    _currentScrollPosition = treeView.Vadjustment.Value;
                    StoreClear();
                    LoadStore(processList);

                    treeView.ShowAll();
                });
            };

            // Add a callback executed after 'Changed' event raised after changing the position of the _treeView
            // When the _treeView content is reloaded the previous scroll position is updated
            treeView.Vadjustment.Changed += (sender, args) =>
            {
                treeView.Vadjustment.Value = _currentScrollPosition;
            };

            // Start the Timer process responsible for grabbing process data periodically
            _processGrabber.Run();

            treeView.ShowAll();
            _window.ShowAll();

            // Hide widgets related to process filtration
            _filtrationHBox.Hide();
        }
Example #11
0
        public void PrepareTransactionList()
        {
            // Create a column for the artist name
            TreeViewColumn trStatus = new TreeViewColumn();

            trStatus.Title      = "Status";
            trStatus.FixedWidth = 100;

            TreeViewColumn trDesc = new TreeViewColumn();

            trDesc.Title  = "Description";
            trDesc.Expand = true;

            TreeViewColumn trDate = new TreeViewColumn();

            trDate.Title = "Date";

            TreeViewColumn trPayee = new TreeViewColumn();

            trPayee.Title  = "Payee";
            trPayee.Expand = true;

            TreeViewColumn trAmount = new TreeViewColumn();

            trAmount.Title    = "Amount";
            trAmount.MinWidth = 128;

            // Add the columns to the TreeView
            transactionList.AppendColumn(trStatus);
            transactionList.AppendColumn(trDesc);
            transactionList.AppendColumn(trDate);
            transactionList.AppendColumn(trPayee);
            transactionList.AppendColumn(trAmount);

            // Create the text cell that will display the artist name
            CellRendererText trStatusCell = new CellRendererText();

            trStatus.PackStart(trStatusCell, true);

            CellRendererText trDescCell = new CellRendererText();

            trDesc.PackStart(trDescCell, true);

            CellRendererText trDateCell = new CellRendererText();

            trDate.PackStart(trDateCell, true);

            CellRendererText trPayeeCell = new CellRendererText();

            trPayee.PackStart(trPayeeCell, true);

            CellRendererText trAmountCell = new CellRendererText();

            trAmount.PackStart(trAmountCell, true);

            // Tell the Cell Renderers which items in the model to display
            trStatus.AddAttribute(trStatusCell, "text", 0);
            trDesc.AddAttribute(trDescCell, "text", 1);
            trDate.AddAttribute(trDateCell, "text", 2);
            trPayee.AddAttribute(trPayeeCell, "text", 3);
            trAmount.AddAttribute(trAmountCell, "text", 4);
        }
Example #12
0
        public RenderablesList(string file_name)
        {
            m_unit_file = new UnitFile(file_name);

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

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

            TreeView tree = new TreeView();

            this.Add(tree);

            TreeViewColumn nameColumn = new TreeViewColumn();

            nameColumn.Title     = "Name";
            nameColumn.Alignment = 0.5f;

            TreeViewColumn nodeColumn = new TreeViewColumn();

            nodeColumn.Title     = "Node";
            nodeColumn.Alignment = 0.5f;

            TreeViewColumn typeColumn = new TreeViewColumn();

            typeColumn.Title     = "Type";
            typeColumn.Alignment = 0.5f;

            TreeViewColumn resourceColumn = new TreeViewColumn();

            resourceColumn.Title     = "Resource";
            resourceColumn.Alignment = 0.5f;

            TreeViewColumn visibleColumn = new TreeViewColumn();

            visibleColumn.Title     = "Visible";
            visibleColumn.Alignment = 0.5f;

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

            CellRendererText nameCell = new CellRendererText();

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

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

            CellRendererText nodeCell = new CellRendererText();

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

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

            CellRendererText typeCell = new CellRendererText();

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

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

            CellRendererText resourceCell = new CellRendererText();

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

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

            CellRendererToggle visibleCell = new CellRendererToggle();

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

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

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

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

            create_model();

            // Show the window and everything on it
            ShowAll();
        }
        private void BuildGui()
        {
            HBox headerBox = new HBox();

            headerBox.PackStart(new Label(GettextCatalog.GetString("Workspace") + ":"), false, false, 0);

            _workspaceComboBox.Model = _workspaceStore;
            var workspaceTextRenderer = new CellRendererText();

            _workspaceComboBox.PackStart(workspaceTextRenderer, true);
            _workspaceComboBox.SetAttributes(workspaceTextRenderer, "text", 1);

            headerBox.PackStart(_workspaceComboBox, false, false, 0);
            headerBox.PackStart(manageButton, false, false, 0);
            headerBox.PackStart(refreshButton, false, false, 0);
            _view.PackStart(headerBox, false, false, 0);

            HPaned mainBox = new HPaned();

            VBox treeViewBox = new VBox();

            TreeViewColumn treeColumn = new TreeViewColumn();

            treeColumn.Title = "Folders";
            var repoImageRenderer = new CellRendererPixbuf();

            treeColumn.PackStart(repoImageRenderer, false);
            treeColumn.SetAttributes(repoImageRenderer, "pixbuf", 1);
            var folderTextRenderer = new CellRendererText();

            treeColumn.PackStart(folderTextRenderer, true);
            treeColumn.SetAttributes(folderTextRenderer, "text", 2);
            _treeView.AppendColumn(treeColumn);

            treeViewBox.WidthRequest = 250;
            ScrolledWindow scrollContainer = new ScrolledWindow();

            scrollContainer.Add(_treeView);
            treeViewBox.PackStart(scrollContainer, true, true, 0);
            mainBox.Pack1(treeViewBox, false, false);


            VBox rightBox       = new VBox();
            HBox headerRightBox = new HBox();

            headerRightBox.PackStart(new Label(GettextCatalog.GetString("Local Path") + ":"), false, false, 0);
            Alignment leftAlign = new Alignment(0, 0, 0, 0);

            _localFolder.Justify = Justification.Left;
            leftAlign.Add(_localFolder);
            headerRightBox.PackStart(leftAlign);
            rightBox.PackStart(headerRightBox, false, false, 0);

            var itemNameColumn = new TreeViewColumn();

            itemNameColumn.Title = "Name";
            var itemIconRenderer = new CellRendererPixbuf();

            itemNameColumn.PackStart(itemIconRenderer, false);
            itemNameColumn.SetAttributes(itemIconRenderer, "pixbuf", 1);
            var itemNameRenderer = new CellRendererText();

            itemNameColumn.PackStart(itemNameRenderer, true);
            itemNameColumn.SetAttributes(itemNameRenderer, "text", 2);
            _listView.AppendColumn(itemNameColumn);

            _listView.AppendColumn("Pending Change", new CellRendererText(), "text", 3);
            _listView.AppendColumn("User", new CellRendererText(), "text", 4);
            _listView.AppendColumn("Latest", new CellRendererText(), "text", 5);
            _listView.AppendColumn("Last Check-in", new CellRendererText(), "text", 6);

            _listView.Selection.Mode = SelectionMode.Multiple;
            _listView.Model          = _listStore;
            var listViewScollWindow = new ScrolledWindow();

            listViewScollWindow.Add(_listView);
            rightBox.PackStart(listViewScollWindow, true, true, 0);
            mainBox.Pack2(rightBox, true, true);
            _view.PackStart(mainBox, true, true, 0);
            AttachEvents();
            _view.ShowAll();
        }
Example #14
0
        public void SetLevel(LevelDescription desc)
        {
            GtkHelpers.FlushAllDeferredEvents();

            Destroyed += LevelAnalysisLayout_Destroyed;

            if (null != Layout)
            {
                Layout.Hide();
                Layout.Destroy();
                Layout             = null;
                SaveSolutionColumn = null;
                LoadSolutionColumn = null;
            }

            LevelDesc = desc;
            LoadAndValidateLevelDesc();

            Solution = LevelManager.ReadLevelSolution(desc.Name);
            if (null == Solution)
            {
                Solution = new LevelSolution();
                Solution.AssumedHandMissileFrequency    = HandMissileFreqency;
                Solution.AssumedHandMissileAvgDamagePct = HandMissileDamantPctAverage;
            }

            TurretSelections = new Dictionary <int, int>();
            RecalculateAllStats();

            Layout = new VBox(false, 0);
            AddWithViewport(Layout);

            HBox field = GtkHelpers.ReadOnlyTextField("Level Name", desc.Name);

            Layout.PackStart(field, false, false, 0);
            field.Show();

            field = GtkHelpers.ReadOnlyTextField("Lives", desc.Lives.ToString());
            Layout.PackStart(field, false, false, 0);
            field.Show();

            field = GtkHelpers.ReadOnlyTextField("Starting Coins", desc.StartingCoins.ToString());
            Layout.PackStart(field, false, false, 0);
            field.Show();


            field = GtkHelpers.TextEntryField("Hand Missile Frequency (sec)", HandMissileFreqency.ToString(), AssumedFireRatePerSecChanged_Changed, true, GtkHelpers.ValueType.Float);
            Layout.PackStart(field, false, false, 0);
            field.Show();


            field = GtkHelpers.TextEntryField("Hand Missile Average Accuracy Handicap", HandMissileDamantPctAverage.ToString(), AssumedHandMissileAccuracyHandicap_Changed, true, GtkHelpers.ValueType.Float);
            Layout.PackStart(field, false, false, 0);
            field.Show();


            WavesTree = new TreeView();
            Layout.PackStart(WavesTree, false, false, 0);
            WavesTree.Show();
            WavesTree.ButtonReleaseEvent += WavesTree_ButtonReleaseEvent;

            List <EnemyDescription> enemies  = LevelManager.GetEnemies();
            ComboBoxText            comboBox = new ComboBoxText();

            foreach (EnemyDescription enemy in enemies)
            {
                comboBox.AppendText(enemy.Name);
            }
            comboBox.Active = 0;


            TreeViewColumn enemyCoumn          = new TreeViewColumn();
            TreeViewColumn countColumn         = new TreeViewColumn();
            TreeViewColumn difficultyColumn    = new TreeViewColumn();
            TreeViewColumn singleEnemyColumn   = new TreeViewColumn();
            TreeViewColumn maxHPPSColumn       = new TreeViewColumn();
            TreeViewColumn maxDPSColumn        = new TreeViewColumn();
            TreeViewColumn simColumn           = new TreeViewColumn();
            TreeViewColumn turretCostVsMaxCoin = new TreeViewColumn();
            TreeViewColumn issuesColumn        = new TreeViewColumn();


            CellRendererText textCellRenderer = new CellRendererText();

            textCellRenderer.Editable = false;

            enemyCoumn.PackStart(textCellRenderer, true);
            enemyCoumn.Title = "Enemy";
            enemyCoumn.AddAttribute(textCellRenderer, "text", 1);
            WavesTree.AppendColumn(enemyCoumn);

            countColumn.PackStart(textCellRenderer, true);
            countColumn.Title = "Count";
            countColumn.AddAttribute(textCellRenderer, "text", 2);
            WavesTree.AppendColumn(countColumn);

            difficultyColumn.PackStart(textCellRenderer, true);
            difficultyColumn.Title = "Difficulty Multiplier";
            difficultyColumn.AddAttribute(textCellRenderer, "text", 3);
            WavesTree.AppendColumn(difficultyColumn);

            //
            // Add column:  Max damage that can be dished to a single enemy given turret coverage + enemy speed
            //

            singleEnemyColumn.PackStart(textCellRenderer, true);
            singleEnemyColumn.Title = "Single Enemy Damage";
            singleEnemyColumn.AddAttribute(textCellRenderer, "text", 4);
            WavesTree.AppendColumn(singleEnemyColumn);

            //
            // Add column: Max hit points of the wave
            //

            maxHPPSColumn.PackStart(textCellRenderer, true);
            maxHPPSColumn.Title = "Max Hitpoints/s";
            maxHPPSColumn.AddAttribute(textCellRenderer, "text", 5);
            WavesTree.AppendColumn(maxHPPSColumn);

            //
            // Add column: Max damage of all the turrets combined firing at full capacity
            //

            maxDPSColumn.PackStart(textCellRenderer, true);
            maxDPSColumn.Title = "Max DPS overall";
            maxDPSColumn.AddAttribute(textCellRenderer, "text", 6);
            WavesTree.AppendColumn(maxDPSColumn);


            //
            // Add column: Simulated damage / kills
            //

            simColumn.PackStart(textCellRenderer, true);
            simColumn.Title = "Sim damage/kills";
            simColumn.AddAttribute(textCellRenderer, "text", 7);
            WavesTree.AppendColumn(simColumn);


            //
            // Add column: Max coin earned by start of wave
            //


            turretCostVsMaxCoin.PackStart(textCellRenderer, true);
            turretCostVsMaxCoin.Title = "Coin Need/Avail";
            turretCostVsMaxCoin.AddAttribute(textCellRenderer, "text", 8);
            WavesTree.AppendColumn(turretCostVsMaxCoin);

            //
            // Solution save/load
            //


            SaveSolutionColumn = new TreeViewColumn();
            LoadSolutionColumn = new TreeViewColumn();;

            SaveSolutionColumn.PackStart(textCellRenderer, true);
            SaveSolutionColumn.Title = "Save Solution";
            SaveSolutionColumn.AddAttribute(textCellRenderer, "text", 9);
            WavesTree.AppendColumn(SaveSolutionColumn);


            LoadSolutionColumn.PackStart(textCellRenderer, true);
            LoadSolutionColumn.Title = "Load Solution";
            LoadSolutionColumn.AddAttribute(textCellRenderer, "text", 10);
            WavesTree.AppendColumn(LoadSolutionColumn);


            //
            // Add column: Issues
            //


            issuesColumn.PackStart(textCellRenderer, true);
            issuesColumn.Title = "Issues";
            issuesColumn.AddAttribute(textCellRenderer, "markup", 11);
            WavesTree.AppendColumn(issuesColumn);

            WavesModel               = new ListStore(typeof(int), typeof(string), typeof(int), typeof(float), typeof(float), typeof(float), typeof(float), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));
            WavesTree.Model          = WavesModel;
            WavesTree.Selection.Mode = SelectionMode.Single;


            PopulateTreeWithWaves(desc);


            Table map = GetFieldTable(desc);

            Layout.PackStart(map, false, true, 0);
            map.Show();


            //
            // Allowed turrets
            //

            field = new HBox(true, 10);
            Layout.PackStart(field, true, false, 0);
            field.Show();

            AllowedTurretTree = new TreeView();

            TreeViewColumn availCol   = new TreeViewColumn();
            TreeViewColumn allowedCol = new TreeViewColumn();


            allowedCol.PackStart(textCellRenderer, true);
            allowedCol.Title = "Allowed Turrets";
            allowedCol.AddAttribute(textCellRenderer, "text", 1);
            AllowedTurretTree.AppendColumn(allowedCol);

            AllowedTurretModel               = new ListStore(typeof(int), typeof(string));
            AllowedTurretTree.Model          = AllowedTurretModel;
            AllowedTurretTree.Selection.Mode = SelectionMode.Multiple;

            field.PackEnd(AllowedTurretTree, true, true, 0);
            AllowedTurretTree.Show();

            PopulateTurretTrees(desc);


            Show();
            ShowAll();
        }
Example #15
0
        new protected void InitUI()
        {
            VBox vbox = new VBox(false, 1);

            //ScrolledWindow
            ScrolledWindow scrolledWindowProfile = new ScrolledWindow();

            scrolledWindowProfile.ShadowType = ShadowType.EtchedIn;
            scrolledWindowProfile.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);

            //StatusBar
            if (_showStatusBar)
            {
                _statusbar = new Statusbar()
                {
                    HasResizeGrip = false
                };
                _statusbar.Push(0, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_statusbar"));
            }
            ;

            //Treeview
            TreeView = new TreeView(_listStoreModelFilterSort);

            //_treeView.RulesHint = true;
            TreeView.EnableSearch = true;
            TreeView.SearchColumn = 1;
            TreeView.ModifyCursor(new Gdk.Color(100, 100, 100), new Gdk.Color(200, 200, 200));
            //Add Columns
            AddColumns();

            //Navigator
            Navigator = new GenericTreeViewNavigator <XPCollection, XPGuidObject>(_sourceWindow, this, _navigatorMode);

            //TODO:THEME
            //if (GlobalApp.ScreenSize.Width >= 800)
            //{
            TouchButtonIconWithText buttonApplyPrivileges = Navigator.GetNewButton("touchButtonApplyPrivileges_DialogActionArea", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_user_apply_privileges"), @"Icons/icon_pos_nav_refresh.png");

            //buttonApplyPrivileges.WidthRequest = 110;
            //Apply Permissions
            buttonApplyPrivileges.Sensitive = FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_USER_PRIVILEGES_APPLY");
            //Event
            buttonApplyPrivileges.Clicked += delegate
            {
                GlobalApp.WindowBackOffice.Accordion.UpdateMenuPrivileges();
                //Force Update MainWindow Pos Privilegs ex TollBar Buttons etc
                GlobalApp.WindowPos.TicketList.UpdateTicketListButtons();
            };
            //Add to Extra Slot
            Navigator.ExtraSlot.PackStart(buttonApplyPrivileges, false, false, 0);
            //}

            //Pack components
            scrolledWindowProfile.Add(TreeView);

            HBox hbox = new HBox(false, 1);

            hbox.PackStart(scrolledWindowProfile);

            vbox.PackStart(hbox, true, true, 0);
            vbox.PackStart(Navigator, false, false, 0);

            if (_showStatusBar)
            {
                vbox.PackStart(_statusbar, false, false, 0);
            }

            //Final Pack
            PackStart(vbox);

            //Required Always Start in First Record, and get Iter XPGuidObject, Ready for Update Action
            try
            {
                if (_dataSource.Count > 0)
                {
                    TreeView.Model.GetIterFirst(out _treeIter);
                    _treePath = ListStoreModelFilter.GetPath(_treeIter);
                    TreeView.SetCursor(_treePath, null, false);
                    _dataSourceRow = (sys_userprofile)_dataSource.Lookup(new Guid(Convert.ToString(TreeView.Model.GetValue(_treeIter, _modelFirstCustomFieldIndex))));
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }

            //Events
            TreeView.CursorChanged            += _treeView_CursorChanged;
            TreeView.RowActivated             += delegate { Update(); };
            TreeView.Vadjustment.ValueChanged += delegate { UpdatePages(); };
            TreeView.Vadjustment.Changed      += delegate { UpdatePages(); };

            //****************************************************************************

            _treeViewPermissionItem.Model = _listStoreModelPermissionItem;

            TreeViewColumn tmpColId = _treeViewPermissionItem.AppendColumn("ID", new CellRendererText(), "text", 0);

            tmpColId.Visible = false;

            TreeViewColumn tmpColProperty = _treeViewPermissionItem.AppendColumn(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_privilege_property"), new CellRendererText()
            {
                FontDesc = _fontDesc
            }, "text", 1);
            //Config Column Title
            Label labelPropertyTitle = new Label(tmpColProperty.Title);

            labelPropertyTitle.Show();
            labelPropertyTitle.ModifyFont(_fontDescTitle);
            tmpColProperty.Widget = labelPropertyTitle;

            TreeViewColumn tmpColActivo = _treeViewPermissionItem.AppendColumn(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_privilege_active"), _cellRendererTogglePermissionItem, "active", 2);

            tmpColActivo.MaxWidth = 100;
            //Config Column Title
            Label labelActivoTitle = new Label(tmpColActivo.Title);

            labelActivoTitle.Show();
            labelActivoTitle.ModifyFont(_fontDescTitle);
            tmpColActivo.Widget = labelActivoTitle;
            //Event
            _cellRendererTogglePermissionItem.Toggled += ToggleEvent;

            ScrolledWindow scrolledWindowPermissionItem = new ScrolledWindow()
            {
                WidthRequest = 500
            };

            scrolledWindowPermissionItem.Add(_treeViewPermissionItem);

            hbox.Add(scrolledWindowPermissionItem);
        }
Example #16
0
        public TaskView(Gtk.TreeModel model, IPreferences preferences)
        {
            if (preferences == null)
            {
                throw new ArgumentNullException("preferences");
            }

            TreeView = new TreeView();

                        #if GTK_2_12
            // set up the timing for the tooltips
            TreeView.Settings.SetLongProperty("gtk-tooltip-browse-mode-timeout", 0, "Tasque:TaskTreeView");
            TreeView.Settings.SetLongProperty("gtk-tooltip-browse-timeout", 750, "Tasque:TaskTreeView");
            TreeView.Settings.SetLongProperty("gtk-tooltip-timeout", 750, "Tasque:TaskTreeView");

            ConnectEvents();
                        #endif

            // TODO: Modify the behavior of the TreeView so that it doesn't show
            // the highlighted row.  Then, also tie in with the mouse hovering
            // so that as you hover the mouse around, it will automatically
            // select the row that the mouse is hovered over.  By doing this,
            // we should be able to not require the user to click on a task
            // to select it and THEN have to click on the column item they want
            // to modify.

            filterTaskList = null;

            modelFilter             = new Gtk.TreeModelFilter(model, null);
            modelFilter.VisibleFunc = FilterFunc;

            modelFilter.RowInserted += OnRowInsertedHandler;
            modelFilter.RowDeleted  += OnRowDeletedHandler;
            Refilter();

            //Model = modelFilter

            TreeView.Selection.Mode = Gtk.SelectionMode.Single;
            TreeView.RulesHint      = false;
            TreeView.HeadersVisible = false;
            TreeView.HoverSelection = true;

            // TODO: Figure out how to turn off selection highlight

            columns = new List <ITaskColumn> ();
            var nodeList = AddinManager.GetExtensionNodes(typeof(ITaskColumn)).Cast <TaskColNode> ();
            var nodes    = new List <TaskColNode> (nodeList);
            foreach (var node in nodes)
            {
                AddColumn(node, nodes);
            }

            rowEditingDictionary = new ConcurrentDictionary <ITaskColumn, TaskRowEditingEventArgs> ();
            columns.Sort((x, y) => x.DefaultPosition.CompareTo(y.DefaultPosition));
            foreach (var col in columns)
            {
                col.Initialize(Model, this, preferences);

                col.CellEditingStarted += (sender, e) => {
                    if (rowEditingDictionary.IsEmpty)
                    {
                        IsTaskBeingEdited = true;
                    }

                    if (!rowEditingDictionary.Any(v => v.Value.ITask == e.ITask))
                    {
                        if (RowEditingStarted != null)
                        {
                            RowEditingStarted(this, e);
                        }
                    }
                    rowEditingDictionary.TryAdd((ITaskColumn)sender, e);
                };

                col.CellEditingFinished += (sender, e) => {
                    TaskRowEditingEventArgs args;
                    rowEditingDictionary.TryRemove((ITaskColumn)sender, out args);
                    if (!rowEditingDictionary.Any(v => v.Value.ITask == e.ITask))
                    {
                        if (RowEditingFinished != null)
                        {
                            RowEditingFinished(this, e);
                        }
                    }

                    if (rowEditingDictionary.IsEmpty)
                    {
                        IsTaskBeingEdited = false;
                    }
                };

                TreeView.AppendColumn(col.TreeViewColumn);
            }
        }
Example #17
0
        public CoverageView(string fileName, ProgressBar status)
        {
            store = new TreeStore(typeof(string), typeof(string), typeof(string), typeof(string), typeof(object));
            tree  = new TreeView(store);

            CellRendererText renderer         = new CellRendererText();
            CellRendererText coverageRenderer = new CellRendererText();

            // LAME: Why is this property a float instead of a double ?
            renderer.Xalign = 0.5f;

            tree.AppendColumn("Classes", new CellRendererText(), "text", 0);
            tree.AppendColumn("Lines Hit", renderer, "text", 1);
            tree.AppendColumn("Lines Missed", renderer, "text", 2);
            tree.AppendColumn("Coverage", coverageRenderer, "text", 3);

            tree.GetColumn(0).Resizable = true;
            tree.GetColumn(1).Alignment = 0.0f;
            tree.GetColumn(1).Resizable = true;
            tree.GetColumn(2).Alignment = 0.0f;
            tree.GetColumn(2).Resizable = true;
            tree.GetColumn(3).Alignment = 0.0f;
            tree.GetColumn(3).Resizable = true;
            tree.GetColumn(3).SetCellDataFunc(coverageRenderer, new TreeCellDataFunc(RenderCoverage));

            tree.HeadersVisible = true;

            model = new CoverageModel();
            foreach (string filter in DEFAULT_FILTERS)
            {
                model.AddFilter(filter);
            }
            this.status     = status;
            model.Progress += Progress;
            model.ReadFromFile(fileName);

            TreeItem root = new TreeItem(store, null, model, "PROJECT");

            Hashtable classes2 = model.Classes;

            namespaces = new Hashtable();
            string[] sorted_names = new string [classes2.Count];
            classes2.Keys.CopyTo(sorted_names, 0);
            Array.Sort(sorted_names);
            Progress("Building tree", 0.95);
            foreach (string name in sorted_names)
            {
                ClassCoverageItem klass = (ClassCoverageItem)classes2 [name];

                if (klass.filtered)
                {
                    continue;
                }

                string   namespace2 = klass.name_space;
                TreeItem nsItem     = (TreeItem)namespaces [namespace2];
                if (nsItem == null)
                {
                    nsItem = new TreeItem(store, root, (CoverageItem)model.Namespaces [namespace2], namespace2);
                    //				nsItem.SetPixmap (0, namespaceOpenPixmap);
                    namespaces [namespace2] = nsItem;
                }

                if (nsItem.model.filtered)
                {
                    continue;
                }

                ClassItem classItem = new ClassItem(store, nsItem, klass, klass.name);

                if (klass.ChildCount != 0)
                {
                    TreeIter treeIter = store.AppendNode(classItem.iter);
                    store.SetValues(treeIter, "<loading>");
                }
            }

            tree.ExpandRow(store.GetPath(root.Iter), false);

            // it becomes very hard to navigate if everything is expanded
            //foreach (string ns in namespaces.Keys)
            //	tree.ExpandRow (store.GetPath (((TreeItem)namespaces [ns]).Iter), false);

            tree.RowExpanded      += new RowExpandedHandler(OnRowExpanded);
            tree.RowCollapsed     += new RowCollapsedHandler(OnRowCollapsed);
            tree.ButtonPressEvent += new ButtonPressEventHandler(OnButtonPress);
            tree.Selection.Mode    = SelectionMode.Single;

            source_views = new Hashtable();
            window_maps  = new Hashtable();
            Progress("Done", 1.0);
            // LAME: Why doesn't widgets visible by default ???
            tree.Show();
        }
Example #18
0
        private void Build()
        {
            SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
            ShadowType = ShadowType.EtchedIn;

            d_treeview = new TreeView <Node>();
            d_treeview.Show();

            d_treeview.EnableSearch = false;

            d_treeview.RulesHint      = true;
            d_treeview.Selection.Mode = SelectionMode.Multiple;
            d_treeview.ShowExpanders  = false;

            d_treeview.ButtonPressEvent += OnTreeViewButtonPressEvent;
            d_treeview.KeyPressEvent    += OnTreeViewKeyPressEvent;

            d_treeview.TooltipColumn = (int)Node.Columns.Tooltip;

            CellRendererText renderer;
            TreeViewColumn   column;

            // Setup renderer for the name of the property
            renderer          = new CellRendererText();
            renderer.Editable = true;

            column           = d_treeview.AppendColumn("Name", renderer, "text", Node.Columns.Name);
            column.Resizable = true;
            column.MinWidth  = 75;

            column.SetCellDataFunc(renderer, VisualizeProperties);

            CellRenderer rname = renderer;

            renderer.EditingStarted += delegate(object o, EditingStartedArgs args) {
                d_editingEntry = args.Editable as Entry;
                d_editingPath  = args.Path;

                Node node = d_treeview.NodeStore.FindPath(new TreePath(args.Path));

                if (node.Variable == null && !(node is InterfaceNode))
                {
                    d_editingEntry.Text = "";
                }

                d_editingEntry.KeyPressEvent += delegate(object source, KeyPressEventArgs a)
                {
                    OnEntryKeyPressed(a, rname, NameEdited);
                };
            };

            renderer.EditingCanceled += delegate(object sender, EventArgs e) {
                if (d_editingEntry != null && Utils.GetCurrentEvent() is Gdk.EventButton)
                {
                    // Still do it actually
                    NameEdited(d_editingEntry.Text, d_editingPath);
                }
            };

            renderer.Edited += DoNameEdited;

            // Setup renderer for expression of the property
            renderer = new Gtk.CellRendererText();
            column   = d_treeview.AppendColumn("Expression", renderer,
                                               "text", Node.Columns.Expression,
                                               "editable", Node.Columns.Editable);

            column.Resizable = true;
            column.Expand    = true;

            column.SetCellDataFunc(renderer, VisualizeProperties);

            CellRenderer rexpr = renderer;

            renderer.EditingStarted += delegate(object o, EditingStartedArgs args) {
                d_editingEntry = args.Editable as Entry;
                d_editingPath  = args.Path;

                d_editingEntry.KeyPressEvent += delegate(object source, KeyPressEventArgs a)
                {
                    OnEntryKeyPressed(a, rexpr, ExpressionEdited);
                };
            };

            renderer.EditingCanceled += delegate(object sender, EventArgs e) {
                if (d_editingEntry != null && Utils.GetCurrentEvent() is Gdk.EventButton)
                {
                    // Still do it actually
                    ExpressionEdited(d_editingEntry.Text, d_editingPath);
                }
            };

            renderer.Edited += DoExpressionEdited;

            // Setup renderer for integrated toggle
            CellRendererToggle toggle;

            toggle = new Gtk.CellRendererToggle();
            column = d_treeview.AppendColumn(" ∫", toggle,
                                             "active", Node.Columns.Integrated,
                                             "activatable", Node.Columns.Editable);
            column.Resizable = false;

            toggle.Toggled += DoIntegratedToggled;

            // Setup renderer for flags
            CellRendererCombo combo;

            combo = new Gtk.CellRendererCombo();

            column = d_treeview.AppendColumn("Flags", combo,
                                             "text", Node.Columns.Flags,
                                             "editable", Node.Columns.Editable);
            column.Resizable = true;
            column.Expand    = false;

            combo.EditingStarted += DoEditingStarted;
            combo.Edited         += DoFlagsEdited;

            combo.HasEntry = false;

            d_flagsStore     = new ListStore(typeof(string));
            combo.Model      = d_flagsStore;
            combo.TextColumn = 0;

            column.MinWidth = 50;

            if (d_wrapper != null && d_wrapper is Wrappers.Node)
            {
                renderer = new Gtk.CellRendererText();

                column = d_treeview.AppendColumn("Interface", renderer,
                                                 "text", Node.Columns.Target);

                renderer.Editable = true;

                column.SetCellDataFunc(renderer, VisualizeProperties);

                CellRenderer riface = renderer;

                renderer.EditingStarted += delegate(object o, EditingStartedArgs args) {
                    d_editingEntry = args.Editable as Entry;
                    d_editingPath  = args.Path;

                    d_editingEntry.KeyPressEvent += delegate(object source, KeyPressEventArgs a)
                    {
                        OnEntryKeyPressed(a, riface, InterfaceEdited);
                    };
                };

                renderer.EditingCanceled += delegate(object sender, EventArgs e) {
                    if (d_editingEntry != null && Utils.GetCurrentEvent() is Gdk.EventButton)
                    {
                        // Still do it actually
                        InterfaceEdited(d_editingEntry.Text, d_editingPath);
                    }
                };

                renderer.Edited += DoInterfaceEdited;
            }

            Populate();
            InitializeFlagsList();

            Add(d_treeview);
        }
        public override void LaunchDialogue()
        {
            //the Type in the collection
            IList  collection  = (IList)Value;
            string displayName = Property.DisplayName;

            //populate list with existing items
            ListStore itemStore = new ListStore(typeof(object), typeof(int), typeof(string));

            for (int i = 0; i < collection.Count; i++)
            {
                itemStore.AppendValues(collection [i], i, collection [i].ToString());
            }

            #region Building Dialogue

            TreeView     itemTree;
            PropertyGrid grid;
            TreeIter     previousIter = TreeIter.Zero;

            //dialogue and buttons
            Dialog dialog = new Dialog()
            {
                Title       = displayName + " Editor",
                Modal       = true,
                AllowGrow   = true,
                AllowShrink = true,
            };
            var toplevel = this.Container.Toplevel as Window;
            if (toplevel != null)
            {
                dialog.TransientFor = toplevel;
            }

            dialog.AddActionWidget(new Button(Stock.Cancel), ResponseType.Cancel);
            dialog.AddActionWidget(new Button(Stock.Ok), ResponseType.Ok);

            //three columns for items, sorting, PropGrid
            HBox hBox = new HBox();
            dialog.VBox.PackStart(hBox, true, true, 5);

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

            //followed by a ButtonBox
            VBox buttonBox = new VBox();
            buttonBox.Spacing = 6;
            hBox.PackEnd(buttonBox, false, false, 5);

            //add/remove buttons
            Button addButton = new Button(new Image(Stock.Add, IconSize.Button));
            buttonBox.PackStart(addButton, false, false, 0);
            if (types [0].IsAbstract)
            {
                addButton.Sensitive = false;
            }
            Button removeButton = new Button(new Gtk.Image(Stock.Remove, IconSize.Button));
            buttonBox.PackStart(removeButton, false, false, 0);

            //sorting buttons
            Button upButton = new Button(new Image(Stock.GoUp, IconSize.Button));
            buttonBox.PackStart(upButton, false, false, 0);
            Button downButton = new Button(new Image(Stock.GoDown, IconSize.Button));
            buttonBox.PackStart(downButton, false, false, 0);

            //Third column has list (TreeView) in a ScrolledWindow
            ScrolledWindow listScroll = new ScrolledWindow();
            listScroll.WidthRequest  = 200;
            listScroll.HeightRequest = 320;
            hBox.PackStart(listScroll, false, false, 5);

            itemTree = new TreeView(itemStore);
            itemTree.Selection.Mode = SelectionMode.Single;
            itemTree.HeadersVisible = false;
            listScroll.AddWithViewport(itemTree);

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

            #endregion

            #region Events

            addButton.Clicked += delegate {
                //create the object
                object instance = System.Activator.CreateInstance(types[0]);

                //get existing selection and insert after it
                TreeIter oldIter, newIter;
                if (itemTree.Selection.GetSelected(out oldIter))
                {
                    newIter = itemStore.InsertAfter(oldIter);
                }
                //or append if no previous selection
                else
                {
                    newIter = itemStore.Append();
                }
                itemStore.SetValue(newIter, 0, instance);

                //select, set name and update all the indices
                itemTree.Selection.SelectIter(newIter);
                UpdateName(itemStore, newIter);
                UpdateIndices(itemStore);
            };

            removeButton.Clicked += delegate {
                //get selected iter and the replacement selection
                TreeIter iter, newSelection;
                if (!itemTree.Selection.GetSelected(out iter))
                {
                    return;
                }

                newSelection = iter;
                if (!IterPrev(itemStore, ref newSelection))
                {
                    newSelection = iter;
                    if (!itemStore.IterNext(ref newSelection))
                    {
                        newSelection = TreeIter.Zero;
                    }
                }

                //new selection. Zeroing previousIter prevents trying to update name of deleted iter.
                previousIter = TreeIter.Zero;
                if (itemStore.IterIsValid(newSelection))
                {
                    itemTree.Selection.SelectIter(newSelection);
                }

                //and the removal and index update
                itemStore.Remove(ref iter);
                UpdateIndices(itemStore);
            };

            upButton.Clicked += delegate {
                TreeIter iter, prev;
                if (!itemTree.Selection.GetSelected(out iter))
                {
                    return;
                }

                //get previous iter
                prev = iter;
                if (!IterPrev(itemStore, ref prev))
                {
                    return;
                }

                //swap the two
                itemStore.Swap(iter, prev);

                //swap indices too
                object prevVal = itemStore.GetValue(prev, 1);
                object iterVal = itemStore.GetValue(iter, 1);
                itemStore.SetValue(prev, 1, iterVal);
                itemStore.SetValue(iter, 1, prevVal);
            };

            downButton.Clicked += delegate {
                TreeIter iter, next;
                if (!itemTree.Selection.GetSelected(out iter))
                {
                    return;
                }

                //get next iter
                next = iter;
                if (!itemStore.IterNext(ref next))
                {
                    return;
                }

                //swap the two
                itemStore.Swap(iter, next);

                //swap indices too
                object nextVal = itemStore.GetValue(next, 1);
                object iterVal = itemStore.GetValue(iter, 1);
                itemStore.SetValue(next, 1, iterVal);
                itemStore.SetValue(iter, 1, nextVal);
            };

            itemTree.Selection.Changed += delegate {
                TreeIter iter;
                if (!itemTree.Selection.GetSelected(out iter))
                {
                    removeButton.Sensitive = false;
                    return;
                }
                removeButton.Sensitive = true;

                //update grid
                object obj = itemStore.GetValue(iter, 0);
                grid.CurrentObject = obj;

                //update previously selected iter's name
                UpdateName(itemStore, previousIter);

                //update current selection so we can update
                //name next selection change
                previousIter = iter;
            };

            grid.Changed += delegate {
                TreeIter iter;
                if (itemTree.Selection != null)
                {
                    if (itemTree.Selection.GetSelected(out iter))
                    {
                        UpdateName(itemStore, iter);
                    }
                }
            };

            TreeIter selectionIter;
            removeButton.Sensitive = itemTree.Selection.GetSelected(out selectionIter);

            dialog.ShowAll();
            grid.ShowToolbar = false;

            #endregion

            //if 'OK' put items back in collection
            // 3tk
            if (MessageService.ShowCustomDialog(dialog, toplevel) == (int)ResponseType.Ok)
            {
                DesignerTransaction tran = CreateTransaction(Instance);
                object old = collection;

                try {
                    collection.Clear();
                    foreach (object[] o in itemStore)
                    {
                        collection.Add(o[0]);
                    }
                    EndTransaction(Instance, tran, old, collection, true);
                }
                catch {
                    EndTransaction(Instance, tran, old, collection, false);
                    throw;
                }
            }
        }
Example #20
0
        public DirtyFilesDialog() : base(GettextCatalog.GetString("Save Files"), IdeApp.Workbench.RootWindow, DialogFlags.Modal)
        {
            tsFiles = new TreeStore(typeof(string), typeof(bool), typeof(SdiWorkspaceWindow), typeof(bool));
            tvFiles = new TreeView(tsFiles);
            TreeIter  topCombineIter = TreeIter.Zero;
            Hashtable projectIters   = new Hashtable();

            foreach (Document doc in IdeApp.Workbench.Documents)
            {
                if (!doc.IsDirty)
                {
                    continue;
                }

                IViewContent viewcontent = doc.Window.ViewContent;

                if (viewcontent.Project != null)
                {
                    TreeIter projIter = TreeIter.Zero;
                    if (projectIters.ContainsKey(viewcontent.Project))
                    {
                        projIter = (TreeIter)projectIters [viewcontent.Project];
                    }
                    else
                    {
                        if (topCombineIter.Equals(TreeIter.Zero))
                        {
                            projIter = tsFiles.AppendValues(GettextCatalog.GetString("Project: {0}", viewcontent.Project.Name), true, null, false);
                        }
                        else
                        {
                            projIter = tsFiles.AppendValues(topCombineIter, GettextCatalog.GetString("Project: {0}", viewcontent.Project.Name), true, null, false);
                        }
                        projectIters [viewcontent.Project] = projIter;
                    }
                    tsFiles.AppendValues(projIter, viewcontent.PathRelativeToProject, true, viewcontent.WorkbenchWindow);
                }
                else
                {
                    if (viewcontent.ContentName == null)
                    {
                        viewcontent.ContentName = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), viewcontent.UntitledName);
                    }
                    tsFiles.AppendValues(viewcontent.ContentName, true, viewcontent.WorkbenchWindow);
                }
            }
            if (!topCombineIter.Equals(TreeIter.Zero))
            {
                if (!tsFiles.IterHasChild(topCombineIter))
                {
                    tsFiles.Remove(ref topCombineIter);
                }
            }

            TreeViewColumn mainColumn = new TreeViewColumn();

            mainColumn.Title = "header";

            togRender          = new CellRendererToggle();
            togRender.Toggled += toggled;
            mainColumn.PackStart(togRender, false);
            mainColumn.AddAttribute(togRender, "active", 1);
            mainColumn.AddAttribute(togRender, "inconsistent", 3);

            textRender = new CellRendererText();
            mainColumn.PackStart(textRender, true);
            mainColumn.AddAttribute(textRender, "text", 0);

            tvFiles.AppendColumn(mainColumn);
            tvFiles.HeadersVisible = false;
            tvFiles.ExpandAll();

            ScrolledWindow sc = new ScrolledWindow();

            sc.Add(tvFiles);
            sc.ShadowType = ShadowType.In;

            sc.BorderWidth = 6;
            this.VBox.PackStart(sc, true, true, 6);

            btnSaveAndQuit = new Button(GettextCatalog.GetString("_Save and Close"));
            btnQuit        = new Button(Gtk.Stock.Quit);
            btnQuit.Label  = GettextCatalog.GetString("_Close");
            btnCancel      = new Button(Gtk.Stock.Cancel);

            btnSaveAndQuit.Clicked += SaveAndQuit;
            btnQuit.Clicked        += Quit;
            btnCancel.Clicked      += Cancel;

            this.ActionArea.PackStart(btnCancel);
            this.ActionArea.PackStart(btnQuit);
            this.ActionArea.PackStart(btnSaveAndQuit);
            this.SetDefaultSize(300, 200);
            this.Child.ShowAll();
        }
            public ICSGameObserverWidget(ICSClient
						      client)
                : base()
            {
                split = new HPaned ();
                this.client = client;
                currentGames = new Hashtable ();
                gamesBook = new Notebook ();
                gamesBook.ShowTabs = false;

                gamesList = new TreeView ();
                gamesStore =
                    new ListStore (typeof (string),
                               typeof (string));
                gamesList.Model = gamesStore;
                gamesList.AppendColumn ("Games",
                            new
                            CellRendererText (),
                            "markup", 0);
                ScrolledWindow scroll = new ScrolledWindow ();
                scroll.HscrollbarPolicy =
                    scroll.VscrollbarPolicy =
                    PolicyType.Automatic;
                scroll.Add (gamesList);

                gamesList.CursorChanged +=
                    OnGamesListCursorChanged;
                split.Add1 (scroll);
                split.Add2 (gamesBook);

                split.ShowAll ();
                PackStart (split, true, true, 2);
                client.GameMessageEvent += OnGameMessage;
            }
        void Build()
        {
            BorderWidth   = 0;
            WidthRequest  = 901;
            HeightRequest = 632;

            Modal          = true;
            Name           = "wizard_dialog";
            Title          = GettextCatalog.GetString("New Project");
            WindowPosition = WindowPosition.CenterOnParent;
            TransientFor   = IdeApp.Workbench.RootWindow;

            projectConfigurationWidget      = new GtkProjectConfigurationWidget();
            projectConfigurationWidget.Name = "projectConfigurationWidget";

            // Top banner of dialog.
            var topLabelEventBox = new EventBox();

            topLabelEventBox.Name          = "topLabelEventBox";
            topLabelEventBox.HeightRequest = 52;
            topLabelEventBox.ModifyBg(StateType.Normal, bannerBackgroundColor);
            topLabelEventBox.ModifyFg(StateType.Normal, whiteColor);
            topLabelEventBox.BorderWidth = 0;

            var topBannerTopEdgeLineEventBox = new EventBox();

            topBannerTopEdgeLineEventBox.Name          = "topBannerTopEdgeLineEventBox";
            topBannerTopEdgeLineEventBox.HeightRequest = 1;
            topBannerTopEdgeLineEventBox.ModifyBg(StateType.Normal, bannerLineColor);
            topBannerTopEdgeLineEventBox.BorderWidth = 0;

            var topBannerBottomEdgeLineEventBox = new EventBox();

            topBannerBottomEdgeLineEventBox.Name          = "topBannerBottomEdgeLineEventBox";
            topBannerBottomEdgeLineEventBox.HeightRequest = 1;
            topBannerBottomEdgeLineEventBox.ModifyBg(StateType.Normal, bannerLineColor);
            topBannerBottomEdgeLineEventBox.BorderWidth = 0;

            topBannerLabel      = new Label();
            topBannerLabel.Name = "topBannerLabel";
            Pango.FontDescription font = topBannerLabel.Style.FontDescription.Copy();
            font.Size = (int)(font.Size * 1.8);
            topBannerLabel.ModifyFont(font);
            topBannerLabel.ModifyFg(StateType.Normal, whiteColor);
            var topLabelHBox = new HBox();

            topLabelHBox.Name = "topLabelHBox";
            topLabelHBox.PackStart(topBannerLabel, false, false, 20);
            topLabelEventBox.Add(topLabelHBox);

            VBox.PackStart(topBannerTopEdgeLineEventBox, false, false, 0);
            VBox.PackStart(topLabelEventBox, false, false, 0);
            VBox.PackStart(topBannerBottomEdgeLineEventBox, false, false, 0);

            // Main templates section.
            centreVBox      = new VBox();
            centreVBox.Name = "centreVBox";
            VBox.PackStart(centreVBox, true, true, 0);
            templatesHBox      = new HBox();
            templatesHBox.Name = "templatesHBox";
            centreVBox.PackEnd(templatesHBox, true, true, 0);

            // Template categories.
            var templateCategoriesVBox = new VBox();

            templateCategoriesVBox.Name         = "templateCategoriesVBox";
            templateCategoriesVBox.BorderWidth  = 0;
            templateCategoriesVBox.WidthRequest = 220;
            var templateCategoriesScrolledWindow = new ScrolledWindow();

            templateCategoriesScrolledWindow.Name             = "templateCategoriesScrolledWindow";
            templateCategoriesScrolledWindow.HscrollbarPolicy = PolicyType.Never;

            // Template categories tree view.
            templateCategoriesTreeView                = new TreeView();
            templateCategoriesTreeView.Name           = "templateCategoriesTreeView";
            templateCategoriesTreeView.BorderWidth    = 0;
            templateCategoriesTreeView.HeadersVisible = false;
            templateCategoriesTreeView.Model          = templateCategoriesListStore;
            templateCategoriesTreeView.ModifyBase(StateType.Normal, categoriesBackgroundColor);
            templateCategoriesTreeView.AppendColumn(CreateTemplateCategoriesTreeViewColumn());
            templateCategoriesScrolledWindow.Add(templateCategoriesTreeView);
            templateCategoriesVBox.PackStart(templateCategoriesScrolledWindow, true, true, 0);
            templatesHBox.PackStart(templateCategoriesVBox, false, false, 0);

            // Templates.
            var templatesVBox = new VBox();

            templatesVBox.Name         = "templatesVBox";
            templatesVBox.WidthRequest = 400;
            templatesHBox.PackStart(templatesVBox, false, false, 0);
            var templatesScrolledWindow = new ScrolledWindow();

            templatesScrolledWindow.Name             = "templatesScrolledWindow";
            templatesScrolledWindow.HscrollbarPolicy = PolicyType.Never;

            // Templates tree view.
            templatesTreeView                = new TreeView();
            templatesTreeView.Name           = "templatesTreeView";
            templatesTreeView.HeadersVisible = false;
            templatesTreeView.Model          = templatesListStore;
            templatesTreeView.ModifyBase(StateType.Normal, templateListBackgroundColor);
            templatesTreeView.AppendColumn(CreateTemplateListTreeViewColumn());
            templatesScrolledWindow.Add(templatesTreeView);
            templatesVBox.PackStart(templatesScrolledWindow, true, true, 0);

            // Template
            var templateEventBox = new EventBox();

            templateEventBox.Name = "templateEventBox";
            templateEventBox.ModifyBg(StateType.Normal, templateBackgroundColor);
            templatesHBox.PackStart(templateEventBox, true, true, 0);
            templateVBox             = new VBox();
            templateVBox.Visible     = false;
            templateVBox.BorderWidth = 20;
            templateVBox.Spacing     = 10;
            templateEventBox.Add(templateVBox);

            // Template large image.
            templateImage               = new ImageView();
            templateImage.Name          = "templateImage";
            templateImage.HeightRequest = 140;
            templateImage.WidthRequest  = 240;
            templateVBox.PackStart(templateImage, false, false, 10);

            // Template description.
            templateNameLabel              = new Label();
            templateNameLabel.Name         = "templateNameLabel";
            templateNameLabel.WidthRequest = 240;
            templateNameLabel.Wrap         = true;
            templateNameLabel.Xalign       = 0;
            templateNameLabel.Markup       = MarkupTemplateName("TemplateName");
            templateVBox.PackStart(templateNameLabel, false, false, 0);
            templateDescriptionLabel              = new Label();
            templateDescriptionLabel.Name         = "templateDescriptionLabel";
            templateDescriptionLabel.WidthRequest = 240;
            templateDescriptionLabel.Wrap         = true;
            templateDescriptionLabel.Xalign       = 0;
            templateVBox.PackStart(templateDescriptionLabel, false, false, 0);
            templateVBox.PackStart(new Label(), true, true, 0);

            // Template - button separator.
            var templateSectionSeparatorEventBox = new EventBox();

            templateSectionSeparatorEventBox.Name          = "templateSectionSeparatorEventBox";
            templateSectionSeparatorEventBox.HeightRequest = 1;
            templateSectionSeparatorEventBox.ModifyBg(StateType.Normal, templateSectionSeparatorColor);
            VBox.PackStart(templateSectionSeparatorEventBox, false, false, 0);

            // Buttons at bottom of dialog.
            var bottomHBox = new HBox();

            bottomHBox.Name = "bottomHBox";
            VBox.PackStart(bottomHBox, false, false, 0);

            // Cancel button - bottom left.
            var cancelButtonBox = new HButtonBox();

            cancelButtonBox.Name        = "cancelButtonBox";
            cancelButtonBox.BorderWidth = 16;
            cancelButton          = new Button();
            cancelButton.Label    = "gtk-cancel";
            cancelButton.UseStock = true;
            cancelButtonBox.PackStart(cancelButton, false, false, 0);
            bottomHBox.PackStart(cancelButtonBox, false, false, 0);

            // Previous button - bottom right.
            var previousNextButtonBox = new HButtonBox();

            previousNextButtonBox.Name        = "previousNextButtonBox";
            previousNextButtonBox.BorderWidth = 16;
            previousNextButtonBox.Spacing     = 9;
            bottomHBox.PackStart(previousNextButtonBox);
            previousNextButtonBox.Layout = ButtonBoxStyle.End;

            previousButton           = new Button();
            previousButton.Name      = "previousButton";
            previousButton.Label     = GettextCatalog.GetString("Previous");
            previousButton.Sensitive = false;
            previousNextButtonBox.PackEnd(previousButton);

            // Next button - bottom right.
            nextButton       = new Button();
            nextButton.Name  = "nextButton";
            nextButton.Label = GettextCatalog.GetString("Next");
            previousNextButtonBox.PackEnd(nextButton);

            // Remove default button action area.
            VBox.Remove(ActionArea);

            if (Child != null)
            {
                Child.ShowAll();
            }

            Show();

            templatesTreeView.HasFocus = true;
            Resizable = false;
        }
Example #23
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.Graphics.EnableTextureRecompression)
            {
                _textureRecompressionToggle.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());
            _graphicsBackend.SetActiveId(((int)ConfigurationState.Instance.Graphics.GraphicsBackend.Value).ToString());

            UpdatePreferredGpuComboBox();

            _graphicsBackend.Changed += (sender, e) => UpdatePreferredGpuComboBox();

            _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()
                };
            });
Example #24
0
        public PaymentsWindow()
        {
            Window window = new Window("Haushaltsplan");

            window.SetSizeRequest(500, 200);
            window.DeleteEvent += DeleteEvent;
            window.BorderWidth  = 20;

            Table table = new Table(2, 2, true);

            window.Add(table);


            ListStore expensesStore = new ListStore(
                typeof(string),
                typeof(Frequency),
                typeof(DateTime),
                typeof(DateTime)
                );
            TreeView expensesView = new TreeView(expensesStore);

            expensesView.AppendColumn("Beschreibung", new CellRendererText(), "text", 0);
            ListStore frequencyStore = new ListStore(typeof(Frequency), typeof(string));

            frequencyStore.AppendValues(Frequency.Once, "einmalig");
            frequencyStore.AppendValues(Frequency.Daily, "täglich");
            CellRendererCombo frequencyCell = new CellRendererCombo
            {
                Model      = frequencyStore,
                Editable   = true,
                HasEntry   = false,
                TextColumn = 1
            };

            frequencyCell.Edited += HandleEditedHandler;
            frequencyCell.AddNotification("Text", FrequencyTextChanged);
            TreeViewColumn frequencyColumn = new TreeViewColumn
            {
                Title = "Frequenz"
            };

            frequencyColumn.PackStart(frequencyCell, false);
            frequencyColumn.AddAttribute(frequencyCell, "text", 1);
            frequencyColumn.SetCellDataFunc(frequencyCell, HandleTreeCellDataFunc);
            expensesView.AppendColumn(frequencyColumn);

            expensesStore.AppendValues("Zahlung 1", Frequency.Once, DateTime.Parse("2018-12-24"));


            table.Attach(expensesView, 0, 1, 0, 1);

            expensesView.Show();

            /* Create second button */

            Button button2 = new Button("button 2");

            /* When the button is clicked, we call the "callback" function
             * with a pointer to "button 2" as its argument */

            button2.Clicked += Callback;

            /* Insert button 2 into the upper right quadrant of the table */
            table.Attach(button2, 1, 2, 0, 1);

            button2.Show();

            /* Create "Quit" button */
            Button quitbutton = new Button("Quit");

            /* When the button is clicked, we call the "delete_event" function
             * and the program exits */
            quitbutton.Clicked += ExitEvent;

            /* Insert the quit button into the both
             * lower quadrants of the table */
            table.Attach(quitbutton, 0, 2, 1, 2);

            quitbutton.Show();

            table.Show();
            window.ShowAll();
        }
Example #25
0
        private SwitchSettings(Builder builder, HLE.FileSystem.VirtualFileSystem virtualFileSystem, HLE.FileSystem.Content.ContentManager contentManager) : base(builder.GetObject("_settingsWin").Handle)
        {
            builder.Autoconnect(this);

            _settingsWin.Icon        = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.Icon.png");
            _controller1Image.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.JoyCon.png", 500, 500);

            //Bind Events
            _lStickUp1.Clicked       += (sender, args) => Button_Pressed(sender, args, _lStickUp1);
            _lStickDown1.Clicked     += (sender, args) => Button_Pressed(sender, args, _lStickDown1);
            _lStickLeft1.Clicked     += (sender, args) => Button_Pressed(sender, args, _lStickLeft1);
            _lStickRight1.Clicked    += (sender, args) => Button_Pressed(sender, args, _lStickRight1);
            _lStickButton1.Clicked   += (sender, args) => Button_Pressed(sender, args, _lStickButton1);
            _dpadUp1.Clicked         += (sender, args) => Button_Pressed(sender, args, _dpadUp1);
            _dpadDown1.Clicked       += (sender, args) => Button_Pressed(sender, args, _dpadDown1);
            _dpadLeft1.Clicked       += (sender, args) => Button_Pressed(sender, args, _dpadLeft1);
            _dpadRight1.Clicked      += (sender, args) => Button_Pressed(sender, args, _dpadRight1);
            _minus1.Clicked          += (sender, args) => Button_Pressed(sender, args, _minus1);
            _l1.Clicked              += (sender, args) => Button_Pressed(sender, args, _l1);
            _zL1.Clicked             += (sender, args) => Button_Pressed(sender, args, _zL1);
            _rStickUp1.Clicked       += (sender, args) => Button_Pressed(sender, args, _rStickUp1);
            _rStickDown1.Clicked     += (sender, args) => Button_Pressed(sender, args, _rStickDown1);
            _rStickLeft1.Clicked     += (sender, args) => Button_Pressed(sender, args, _rStickLeft1);
            _rStickRight1.Clicked    += (sender, args) => Button_Pressed(sender, args, _rStickRight1);
            _rStickButton1.Clicked   += (sender, args) => Button_Pressed(sender, args, _rStickButton1);
            _a1.Clicked              += (sender, args) => Button_Pressed(sender, args, _a1);
            _b1.Clicked              += (sender, args) => Button_Pressed(sender, args, _b1);
            _x1.Clicked              += (sender, args) => Button_Pressed(sender, args, _x1);
            _y1.Clicked              += (sender, args) => Button_Pressed(sender, args, _y1);
            _plus1.Clicked           += (sender, args) => Button_Pressed(sender, args, _plus1);
            _r1.Clicked              += (sender, args) => Button_Pressed(sender, args, _r1);
            _zR1.Clicked             += (sender, args) => Button_Pressed(sender, args, _zR1);
            _controller1Type.Changed += (sender, args) => Controller_Changed(sender, args, _controller1Type.ActiveId, _controller1Image);

            //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();
            }

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

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

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

            if (ConfigurationState.Instance.System.EnableMulticoreScheduling)
            {
                _multiSchedToggle.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();
            }

            TimeZoneContentManager timeZoneContentManager = new TimeZoneContentManager();

            timeZoneContentManager.InitializeInstance(virtualFileSystem, contentManager, LibHac.FsSystem.IntegrityCheckLevel.None);

            List <string> locationNames = timeZoneContentManager.LocationNameCache.ToList();

            locationNames.Sort();

            foreach (string locationName in locationNames)
            {
                _systemTimeZoneSelect.Append(locationName, locationName);
            }

            _systemLanguageSelect.SetActiveId(ConfigurationState.Instance.System.Language.Value.ToString());
            _systemRegionSelect.SetActiveId(ConfigurationState.Instance.System.Region.Value.ToString());
            _systemTimeZoneSelect.SetActiveId(timeZoneContentManager.SanityCheckDeviceLocationName());
            _controller1Type.SetActiveId(ConfigurationState.Instance.Hid.ControllerType.Value.ToString());
            Controller_Changed(null, null, _controller1Type.ActiveId, _controller1Image);

            _lStickUp1.Label     = ConfigurationState.Instance.Hid.KeyboardControls.Value.LeftJoycon.StickUp.ToString();
            _lStickDown1.Label   = ConfigurationState.Instance.Hid.KeyboardControls.Value.LeftJoycon.StickDown.ToString();
            _lStickLeft1.Label   = ConfigurationState.Instance.Hid.KeyboardControls.Value.LeftJoycon.StickLeft.ToString();
            _lStickRight1.Label  = ConfigurationState.Instance.Hid.KeyboardControls.Value.LeftJoycon.StickRight.ToString();
            _lStickButton1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.LeftJoycon.StickButton.ToString();
            _dpadUp1.Label       = ConfigurationState.Instance.Hid.KeyboardControls.Value.LeftJoycon.DPadUp.ToString();
            _dpadDown1.Label     = ConfigurationState.Instance.Hid.KeyboardControls.Value.LeftJoycon.DPadDown.ToString();
            _dpadLeft1.Label     = ConfigurationState.Instance.Hid.KeyboardControls.Value.LeftJoycon.DPadLeft.ToString();
            _dpadRight1.Label    = ConfigurationState.Instance.Hid.KeyboardControls.Value.LeftJoycon.DPadRight.ToString();
            _minus1.Label        = ConfigurationState.Instance.Hid.KeyboardControls.Value.LeftJoycon.ButtonMinus.ToString();
            _l1.Label            = ConfigurationState.Instance.Hid.KeyboardControls.Value.LeftJoycon.ButtonL.ToString();
            _zL1.Label           = ConfigurationState.Instance.Hid.KeyboardControls.Value.LeftJoycon.ButtonZl.ToString();
            _rStickUp1.Label     = ConfigurationState.Instance.Hid.KeyboardControls.Value.RightJoycon.StickUp.ToString();
            _rStickDown1.Label   = ConfigurationState.Instance.Hid.KeyboardControls.Value.RightJoycon.StickDown.ToString();
            _rStickLeft1.Label   = ConfigurationState.Instance.Hid.KeyboardControls.Value.RightJoycon.StickLeft.ToString();
            _rStickRight1.Label  = ConfigurationState.Instance.Hid.KeyboardControls.Value.RightJoycon.StickRight.ToString();
            _rStickButton1.Label = ConfigurationState.Instance.Hid.KeyboardControls.Value.RightJoycon.StickButton.ToString();
            _a1.Label            = ConfigurationState.Instance.Hid.KeyboardControls.Value.RightJoycon.ButtonA.ToString();
            _b1.Label            = ConfigurationState.Instance.Hid.KeyboardControls.Value.RightJoycon.ButtonB.ToString();
            _x1.Label            = ConfigurationState.Instance.Hid.KeyboardControls.Value.RightJoycon.ButtonX.ToString();
            _y1.Label            = ConfigurationState.Instance.Hid.KeyboardControls.Value.RightJoycon.ButtonY.ToString();
            _plus1.Label         = ConfigurationState.Instance.Hid.KeyboardControls.Value.RightJoycon.ButtonPlus.ToString();
            _r1.Label            = ConfigurationState.Instance.Hid.KeyboardControls.Value.RightJoycon.ButtonR.ToString();
            _zR1.Label           = ConfigurationState.Instance.Hid.KeyboardControls.Value.RightJoycon.ButtonZr.ToString();

            _custThemePath.Buffer.Text           = ConfigurationState.Instance.Ui.CustomThemePath;
            _graphicsShadersDumpPath.Buffer.Text = ConfigurationState.Instance.Graphics.ShadersDumpPath;
            _fsLogSpinAdjustment.Value           = ConfigurationState.Instance.System.FsGlobalAccessLogMode;

            _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;
            }

            _listeningForKeypress = false;
        }
Example #26
0
        private void UpdateColumns()
        {
            foreach (TreeViewColumn column in _gameTable.Columns)
            {
                _gameTable.RemoveColumn(column);
            }

            CellRendererToggle favToggle = new CellRendererToggle();

            favToggle.Toggled += FavToggle_Toggled;

            if (ConfigurationState.Instance.Ui.GuiColumns.FavColumn)
            {
                _gameTable.AppendColumn("Fav", favToggle, "active", 0);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.IconColumn)
            {
                _gameTable.AppendColumn("Icon", new CellRendererPixbuf(), "pixbuf", 1);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.AppColumn)
            {
                _gameTable.AppendColumn("Application", new CellRendererText(), "text", 2);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.DevColumn)
            {
                _gameTable.AppendColumn("Developer", new CellRendererText(), "text", 3);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.VersionColumn)
            {
                _gameTable.AppendColumn("Version", new CellRendererText(), "text", 4);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.TimePlayedColumn)
            {
                _gameTable.AppendColumn("Time Played", new CellRendererText(), "text", 5);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.LastPlayedColumn)
            {
                _gameTable.AppendColumn("Last Played", new CellRendererText(), "text", 6);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.FileExtColumn)
            {
                _gameTable.AppendColumn("File Ext", new CellRendererText(), "text", 7);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.FileSizeColumn)
            {
                _gameTable.AppendColumn("File Size", new CellRendererText(), "text", 8);
            }
            if (ConfigurationState.Instance.Ui.GuiColumns.PathColumn)
            {
                _gameTable.AppendColumn("Path", new CellRendererText(), "text", 9);
            }

            foreach (TreeViewColumn column in _gameTable.Columns)
            {
                switch (column.Title)
                {
                case "Fav":
                    column.SortColumnId = 0;
                    column.Clicked     += Column_Clicked;
                    break;

                case "Application":
                    column.SortColumnId = 2;
                    column.Clicked     += Column_Clicked;
                    break;

                case "Developer":
                    column.SortColumnId = 3;
                    column.Clicked     += Column_Clicked;
                    break;

                case "Version":
                    column.SortColumnId = 4;
                    column.Clicked     += Column_Clicked;
                    break;

                case "Time Played":
                    column.SortColumnId = 5;
                    column.Clicked     += Column_Clicked;
                    break;

                case "Last Played":
                    column.SortColumnId = 6;
                    column.Clicked     += Column_Clicked;
                    break;

                case "File Ext":
                    column.SortColumnId = 7;
                    column.Clicked     += Column_Clicked;
                    break;

                case "File Size":
                    column.SortColumnId = 8;
                    column.Clicked     += Column_Clicked;
                    break;

                case "Path":
                    column.SortColumnId = 9;
                    column.Clicked     += Column_Clicked;
                    break;
                }
            }
        }
Example #27
0
        public override void Initialize(NodeBuilder[] builders, TreePadOption[] options, string menuPath)
        {
            base.Initialize(builders, options, menuPath);

            testService.TestSuiteChanged += OnTestSuiteChanged;
            paned = new VPaned();

            VBox            vbox       = new VBox();
            DockItemToolbar topToolbar = Window.GetToolbar(DockPositionType.Top);

            var hbox = new HBox {
                Spacing = 6
            };

            hbox.PackStart(new ImageView(ImageService.GetIcon("md-execute-all", IconSize.Menu)), false, false, 0);
            hbox.PackStart(new Label(GettextCatalog.GetString("Run All")), false, false, 0);
            buttonRunAll             = new Button(hbox);
            buttonRunAll.Clicked    += new EventHandler(OnRunAllClicked);
            buttonRunAll.Sensitive   = true;
            buttonRunAll.TooltipText = GettextCatalog.GetString("Run all tests");
            topToolbar.Add(buttonRunAll);

            buttonStop             = new Button(new ImageView(Ide.Gui.Stock.Stop, IconSize.Menu));
            buttonStop.Clicked    += new EventHandler(OnStopClicked);
            buttonStop.Sensitive   = false;
            buttonStop.TooltipText = GettextCatalog.GetString("Cancel running test");
            topToolbar.Add(buttonStop);
            topToolbar.ShowAll();

            vbox.PackEnd(base.Control, true, true, 0);
            vbox.FocusChain = new Gtk.Widget [] { base.Control };

            paned.Pack1(vbox, true, true);

            detailsPad = new VBox();

            EventBox eb     = new EventBox();
            HBox     header = new HBox();

            eb.Add(header);

            detailLabel         = new HeaderLabel();
            detailLabel.Padding = 6;

            Button hb = new Button(new ImageView("gtk-close", IconSize.SmallToolbar));

            hb.Relief   = ReliefStyle.None;
            hb.Clicked += new EventHandler(OnCloseDetails);
            header.PackEnd(hb, false, false, 0);

            hb          = new Button(new ImageView("gtk-go-back", IconSize.SmallToolbar));
            hb.Relief   = ReliefStyle.None;
            hb.Clicked += new EventHandler(OnGoBackTest);
            header.PackEnd(hb, false, false, 0);

            header.Add(detailLabel);
            Gdk.Color hcol = eb.Style.Background(StateType.Normal);
            hcol.Red   = (ushort)(((double)hcol.Red) * 0.9);
            hcol.Green = (ushort)(((double)hcol.Green) * 0.9);
            hcol.Blue  = (ushort)(((double)hcol.Blue) * 0.9);
            //	eb.ModifyBg (StateType.Normal, hcol);

            detailsPad.PackStart(eb, false, false, 0);

            VPaned panedDetails = new VPaned();

            panedDetails.BorderWidth = 3;
            VBox boxPaned1 = new VBox();

            chart = new TestChart();
            chart.SelectionChanged += new EventHandler(OnChartDateChanged);

            var chartWidget = chart.GetNativeWidget <Widget> ();

            chartWidget.ButtonPressEvent += OnChartButtonPress;
            chartWidget.HeightRequest     = 50;

            Toolbar toolbar = new Toolbar();

            toolbar.IconSize     = IconSize.SmallToolbar;
            toolbar.ToolbarStyle = ToolbarStyle.Icons;
            toolbar.ShowArrow    = false;
            ToolButton but = new ToolButton("gtk-zoom-in");

            but.Clicked += new EventHandler(OnZoomIn);
            toolbar.Insert(but, -1);

            but          = new ToolButton("gtk-zoom-out");
            but.Clicked += new EventHandler(OnZoomOut);
            toolbar.Insert(but, -1);

            but          = new ToolButton("gtk-go-back");
            but.Clicked += new EventHandler(OnChartBack);
            toolbar.Insert(but, -1);

            but          = new ToolButton("gtk-go-forward");
            but.Clicked += new EventHandler(OnChartForward);
            toolbar.Insert(but, -1);

            but          = new ToolButton("gtk-goto-last");
            but.Clicked += new EventHandler(OnChartLast);
            toolbar.Insert(but, -1);

            boxPaned1.PackStart(toolbar, false, false, 0);
            boxPaned1.PackStart(chart, true, true, 0);

            panedDetails.Pack1(boxPaned1, false, false);

            // Detailed test information --------

            infoBook = new ButtonNotebook();
            infoBook.PageLoadRequired += new EventHandler(OnPageLoadRequired);

            // Info - Group summary

            Frame          tf = new Frame();
            ScrolledWindow sw = new ScrolledWindow();

            detailsTree = new TreeView();

            detailsTree.HeadersVisible = true;
            detailsTree.RulesHint      = true;
            detailsStore = new ListStore(typeof(object), typeof(string), typeof(string), typeof(string), typeof(string));

            CellRendererText trtest = new CellRendererText();
            CellRendererText tr;

            TreeViewColumn col3 = new TreeViewColumn();

            col3.Expand = false;
//			col3.Alignment = 0.5f;
            col3.Widget = new ImageView(TestStatusIcon.Success);
            col3.Widget.Show();
            tr = new CellRendererText();
//			tr.Xalign = 0.5f;
            col3.PackStart(tr, false);
            col3.AddAttribute(tr, "markup", 2);
            detailsTree.AppendColumn(col3);

            TreeViewColumn col4 = new TreeViewColumn();

            col4.Expand = false;
//			col4.Alignment = 0.5f;
            col4.Widget = new ImageView(TestStatusIcon.Failure);
            col4.Widget.Show();
            tr = new CellRendererText();
//			tr.Xalign = 0.5f;
            col4.PackStart(tr, false);
            col4.AddAttribute(tr, "markup", 3);
            detailsTree.AppendColumn(col4);

            TreeViewColumn col5 = new TreeViewColumn();

            col5.Expand = false;
//			col5.Alignment = 0.5f;
            col5.Widget = new ImageView(TestStatusIcon.NotRun);
            col5.Widget.Show();
            tr = new CellRendererText();
//			tr.Xalign = 0.5f;
            col5.PackStart(tr, false);
            col5.AddAttribute(tr, "markup", 4);
            detailsTree.AppendColumn(col5);

            TreeViewColumn col1 = new TreeViewColumn();

//			col1.Resizable = true;
//			col1.Expand = true;
            col1.Title = "Test";
            col1.PackStart(trtest, true);
            col1.AddAttribute(trtest, "markup", 1);
            detailsTree.AppendColumn(col1);

            detailsTree.Model = detailsStore;

            sw.Add(detailsTree);
            tf.Add(sw);
            tf.ShowAll();

            TestSummaryPage = infoBook.AddPage(GettextCatalog.GetString("Summary"), tf);

            // Info - Regressions list

            tf = new Frame();
            sw = new ScrolledWindow();
            tf.Add(sw);
            regressionTree = new TreeView();
            regressionTree.HeadersVisible = false;
            regressionTree.RulesHint      = true;
            regressionStore = new ListStore(typeof(object), typeof(string), typeof(Xwt.Drawing.Image));

            CellRendererText trtest2 = new CellRendererText();
            var pr = new CellRendererImage();

            TreeViewColumn col = new TreeViewColumn();

            col.PackStart(pr, false);
            col.AddAttribute(pr, "image", 2);
            col.PackStart(trtest2, false);
            col.AddAttribute(trtest2, "markup", 1);
            regressionTree.AppendColumn(col);
            regressionTree.Model = regressionStore;
            sw.Add(regressionTree);
            tf.ShowAll();

            TestRegressionsPage = infoBook.AddPage(GettextCatalog.GetString("Regressions"), tf);

            // Info - Failed tests list

            tf = new Frame();
            sw = new ScrolledWindow();
            tf.Add(sw);
            failedTree = new TreeView();
            failedTree.HeadersVisible = false;
            failedTree.RulesHint      = true;
            failedStore = new ListStore(typeof(object), typeof(string), typeof(Xwt.Drawing.Image));

            trtest2 = new CellRendererText();
            pr      = new CellRendererImage();

            col = new TreeViewColumn();
            col.PackStart(pr, false);
            col.AddAttribute(pr, "image", 2);
            col.PackStart(trtest2, false);
            col.AddAttribute(trtest2, "markup", 1);
            failedTree.AppendColumn(col);
            failedTree.Model = failedStore;
            sw.Add(failedTree);
            tf.ShowAll();

            TestFailuresPage = infoBook.AddPage(GettextCatalog.GetString("Failed tests"), tf);

            // Info - results

            tf = new Frame();
            sw = new ScrolledWindow();
            tf.Add(sw);
            resultView          = new TextView();
            resultView.Editable = false;
            sw.Add(resultView);
            tf.ShowAll();
            TestResultPage = infoBook.AddPage(GettextCatalog.GetString("Result"), tf);

            // Info - Output

            tf = new Frame();
            sw = new ScrolledWindow();
            tf.Add(sw);
            outputView          = new TextView();
            outputView.Editable = false;
            sw.Add(outputView);
            tf.ShowAll();
            TestOutputPage = infoBook.AddPage(GettextCatalog.GetString("Output"), tf);

            panedDetails.Pack2(infoBook, true, true);
            detailsPad.PackStart(panedDetails, true, true, 0);
            paned.Pack2(detailsPad, true, true);

            paned.ShowAll();

            infoBook.HidePage(TestResultPage);
            infoBook.HidePage(TestOutputPage);
            infoBook.HidePage(TestSummaryPage);
            infoBook.HidePage(TestRegressionsPage);
            infoBook.HidePage(TestFailuresPage);

            detailsPad.Sensitive = false;
            detailsPad.Hide();

            detailsTree.RowActivated    += new Gtk.RowActivatedHandler(OnTestActivated);
            regressionTree.RowActivated += new Gtk.RowActivatedHandler(OnRegressionTestActivated);
            failedTree.RowActivated     += new Gtk.RowActivatedHandler(OnFailedTestActivated);

            foreach (UnitTest t in testService.RootTests)
            {
                TreeView.AddChild(t);
            }
        }
Example #28
0
        private QueueSchedulerDialog(Builder builder, Window parent, WindowGroup group) : base(builder.GetRawOwnedObject("dialog"))
        {
            builder.Autoconnect(this);
            Modal = true;
            SetPosition(WindowPosition.CenterAlways);
            TransientFor = parent;
            this.group   = group;
            this.group.AddWindow(this);

            GtkHelper.AttachSafeDispose(this);
            Title = TextResource.GetText("DESC_Q_TITLE");
            SetDefaultSize(700, 500);
            LoadTexts();
            queueListStore = new ListStore(typeof(string), typeof(DownloadQueue));
            LbQueues.Model = queueListStore;

            var queueNameRendererText = new CellRendererText();
            var queueNameColumn       = new TreeViewColumn("", queueNameRendererText, "text", 0)
            {
                Resizable   = false,
                Reorderable = false,
                Sizing      = TreeViewColumnSizing.Autosize,
                Expand      = true
            };

            LbQueues.HeadersVisible = false;
            LbQueues.AppendColumn(queueNameColumn);
            queueScroll.SetSizeRequest(150, 100);

            filesListStore = new ListStore(typeof(string), typeof(string), typeof(string), typeof(InProgressDownloadItem));
            lvFiles.Model  = filesListStore;

            var k = 0;

            foreach (var key in new string[] { "ND_FILE", "SORT_SIZE", "SORT_STATUS" })
            {
                var cellRendererText = new CellRendererText();
                var treeViewColumn   = new TreeViewColumn(TextResource.GetText(key), cellRendererText, "text", k++)
                {
                    Resizable   = true,
                    Reorderable = false,
                    Sizing      = TreeViewColumnSizing.Fixed,
                    FixedWidth  = 150
                };
                lvFiles.AppendColumn(treeViewColumn);
            }

            this.SchedulerPanel = new SchedulerPanelControl(
                chkEveryday,
                new CheckButton[] { chkSun, chkMon, chkTue, chkWed, chkThu, chkFri, chkSat },
                new TimePickerControl(CmbHour1, CmbMinute1, CmbAmPm1, LblQueueStart),
                new TimePickerControl(CmbHour2, CmbMinute2, CmbAmPm2, LblQueueStop)
                );

            this.SchedulerPanel.Schedule = defaultSchedule;

            this.SchedulerPanel.ValueChanged += (_, _) =>
            {
                DownloadSchedule?schedule = null;
                if (ChkEnableScheduler.Active)
                {
                    schedule = this.SchedulerPanel.Schedule;
                }
                if (GtkHelper.GetSelectedValue <DownloadQueue>(LbQueues, 1) is DownloadQueue queue)
                {
                    queue.Schedule = schedule;
                }
            };

            this.LbQueues.Selection.Changed += (_, _) =>
            {
                var selected = GtkHelper.GetSelectedValue <DownloadQueue>(LbQueues, 1);
                if (selected != null)
                {
                    UpdateControls(selected);
                }
            };

            this.lvFiles.Selection.Changed += (_, _) => ListSelectionChanged();

            this.ChkEnableScheduler.Toggled += (_, _) =>
            {
                SchedulerPanel.Enabled = this.ChkEnableScheduler.Active;
                if (GtkHelper.GetSelectedValue <DownloadQueue>(LbQueues, 1) is DownloadQueue queue)
                {
                    queue.Schedule = this.ChkEnableScheduler.Active ? this.SchedulerPanel.Schedule : null;
                }
            };

            Hidden            += QueueSchedulerDialog_Hidden;
            BtnNew.Clicked    += BtnNew_Clicked;
            BtnStart.Clicked  += BtnStart_Clicked;
            BtnStop.Clicked   += BtnStop_Clicked;
            BtnDel.Clicked    += BtnDel_Clicked;
            BtnCancel.Clicked += BtnCancel_Clicked;
            BtnAdd.Clicked    += BtnAdd_Clicked;
            BtnRemove.Clicked += BtnRemove_Clicked;
            BtnUp.Clicked     += BtnUp_Clicked;
            BtnDown.Clicked   += BtnDown_Clicked;
            BtnMoveTo.Clicked += BtnMoveTo_Clicked;
            BtnSave.Clicked   += BtnSave_Clicked;

            lvFiles.Selection.Mode = SelectionMode.Multiple;

            SchedulerPanel.Enabled = false;
        }
        public DemoStockBrowser() : base("Stock Icons and Items")
        {
            SetDefaultSize(-1, 500);
            BorderWidth = 8;

            HBox hbox = new HBox(false, 8);

            Add(hbox);

            ScrolledWindow sw = new ScrolledWindow();

            sw.SetPolicy(PolicyType.Never, PolicyType.Automatic);
            hbox.PackStart(sw, false, false, 0);

            ListStore model = CreateModel();

            TreeView treeview = new TreeView(model);

            sw.Add(treeview);

            TreeViewColumn column = new TreeViewColumn();

            column.Title = "Name";
            CellRenderer renderer = new CellRendererPixbuf();

            column.PackStart(renderer, false);
            column.SetAttributes(renderer, "stock_id", Column.Id);
            renderer = new CellRendererText();
            column.PackStart(renderer, true);
            column.SetAttributes(renderer, "text", Column.Name);

            treeview.AppendColumn(column);
            treeview.AppendColumn("Label", new CellRendererText(), "text", Column.Label);
            treeview.AppendColumn("Accel", new CellRendererText(), "text", Column.Accel);
            treeview.AppendColumn("ID", new CellRendererText(), "text", Column.Id);

            Alignment align = new Alignment(0.5f, 0.0f, 0.0f, 0.0f);

            hbox.PackEnd(align, false, false, 0);

            Frame frame = new Frame("Selected Item");

            align.Add(frame);

            VBox vbox = new VBox(false, 8);

            vbox.BorderWidth = 8;
            frame.Add(vbox);

            typeLabel = new Label();
            vbox.PackStart(typeLabel, false, false, 0);
            iconImage = new Gtk.Image();
            vbox.PackStart(iconImage, false, false, 0);
            accelLabel = new Label();
            vbox.PackStart(accelLabel, false, false, 0);
            nameLabel = new Label();
            vbox.PackStart(nameLabel, false, false, 0);
            idLabel = new Label();
            vbox.PackStart(idLabel, false, false, 0);

            treeview.Selection.Mode     = Gtk.SelectionMode.Single;
            treeview.Selection.Changed += new EventHandler(SelectionChanged);

            ShowAll();
        }
Example #30
0
        protected virtual void Build()
        {
            Alignment      align;
            TreeViewColumn column;
            CellRenderer   cell;
            HBox           hbox;

            KeepAbove    = true;
            AppPaintable = true;
            AcceptFocus  = false;
            // This typehint gets the window to raise all the way to top.
            TypeHint = WindowTypeHint.Splashscreen;

            SetColormap();

            frame            = new Frame();
            frame.DrawFill   = true;
            frame.DrawFrame  = true;
            frame.FillColor  = frame.FrameColor = backgroundColor;
            frame.FillAlpha  = .55;
            frame.FrameAlpha = .7;
            frame.Radius     = 0;
            frame.Show();

            vbox = new VBox(false, 0);
            Add(frame);
            frame.Add(vbox);
            vbox.BorderWidth = 3;
            vbox.Show();

            //---------The breadcrum bar---------
            hbox         = new HBox();
            toolbar      = new Toolbar();
            align        = new Alignment(0, .5f, 0, 0);
            resultsLabel = new Label();
            queryLabel   = new Label();
            align.Add(queryLabel);
            hbox.PackStart(align, true, true, 4);
            hbox.PackStart(resultsLabel, false, false, 0);
            hbox.WidthRequest = DefaultWindowWidth - 10;
            toolbar.Add(hbox);
            toolbar.ShowAll();
            vbox.PackStart(toolbar, false, false, 0);


            //---------Results Window
            resultsScrolledWindow = new ScrolledWindow();
            resultsScrolledWindow.SetPolicy(PolicyType.Never, PolicyType.Never);
            resultsScrolledWindow.ShadowType = ShadowType.None;
            vbox.PackStart(resultsScrolledWindow, true, true, 0);
            resultsScrolledWindow.Show();

            resultsTreeview = new TreeView();
            resultsTreeview.EnableSearch   = false;
            resultsTreeview.HeadersVisible = false;
            // If this is not set the tree will call IconDataFunc for all rows to
            // determine the total height of the tree
            resultsTreeview.FixedHeightMode = true;

            resultsScrolledWindow.Add(resultsTreeview);
            resultsTreeview.Show();

            resultsTreeview.Model = new ListStore(new Type[] {
                typeof(Do.Universe.Item),
                typeof(string),
            });

            column        = new TreeViewColumn();
            column.Sizing = Gtk.TreeViewColumnSizing.Fixed;
            // because resultsTreeview.FixedHeightMode = true:

            cell = new CellRendererPixbuf();
            cell.SetFixedSize(-1, 4 + DefaultResultIconSize - (int)cell.Ypad);

            int width, height;

            cell.GetFixedSize(out width, out height);

            column.PackStart(cell, false);
            column.SetCellDataFunc(cell, new TreeCellDataFunc(IconDataFunc));

            vbox.SetSizeRequest(DefaultWindowWidth,
                                (height + 2) * NumberResultsDisplayed +
                                (int)(vbox.BorderWidth * 2) + 20);

            cell = new CellRendererText();
            (cell as CellRendererText).Ellipsize = Pango.EllipsizeMode.End;
            column.PackStart(cell, true);
            column.AddAttribute(cell, "markup", (int)Column.NameColumn);

            resultsTreeview.AppendColumn(column);

            resultsTreeview.Selection.Changed += OnResultRowSelected;
            Shown += OnShown;
        }
            private void create_tree()
            {
                tree = new TreeView ();
                tree.Model = store;
                tree.HeadersVisible = false;
                //tree.HeadersClickable = true;

                CellRendererText renderer =
                    new CellRendererText ();
                renderer.Yalign = 0;

                TreeViewColumn col = new TreeViewColumn ();
                //col.Title = Catalog.GetString ("Tournament");
                col.PackStart (renderer, false);
                col.SetAttributes (renderer, "markup", 1);
                CellRendererText resultRenderer =
                    new CellRendererText ();
                resultRenderer.Xpad = 5;
                resultRenderer.Yalign = 0;
                col.PackStart (resultRenderer, false);
                col.SetAttributes (resultRenderer, "markup",
                           2);

                tree.AppendColumn (col);
                tree.RowActivated += OnRowActivated;
            }
Example #32
0
        private DlcWindow(Builder builder, VirtualFileSystem virtualFileSystem, string titleId, string titleName) : base(builder.GetObject("_dlcWindow").Handle)
        {
            builder.Autoconnect(this);

            _titleId                 = titleId;
            _virtualFileSystem       = virtualFileSystem;
            _dlcJsonPath             = System.IO.Path.Combine(AppDataManager.GamesDirPath, _titleId, "dlc.json");
            _baseTitleInfoLabel.Text = $"DLC Available for {titleName} [{titleId.ToUpper()}]";

            try
            {
                _dlcContainerList = JsonHelper.DeserializeFromFile <List <DlcContainer> >(_dlcJsonPath);
            }
            catch
            {
                _dlcContainerList = new List <DlcContainer>();
            }

            _dlcTreeView.Model = new TreeStore(typeof(bool), typeof(string), typeof(string));

            CellRendererToggle enableToggle = new CellRendererToggle();

            enableToggle.Toggled += (sender, args) =>
            {
                _dlcTreeView.Model.GetIter(out TreeIter treeIter, new TreePath(args.Path));
                bool newValue = !(bool)_dlcTreeView.Model.GetValue(treeIter, 0);
                _dlcTreeView.Model.SetValue(treeIter, 0, newValue);

                if (_dlcTreeView.Model.IterChildren(out TreeIter childIter, treeIter))
                {
                    do
                    {
                        _dlcTreeView.Model.SetValue(childIter, 0, newValue);
                    }while (_dlcTreeView.Model.IterNext(ref childIter));
                }
            };

            _dlcTreeView.AppendColumn("Enabled", enableToggle, "active", 0);
            _dlcTreeView.AppendColumn("TitleId", new CellRendererText(), "text", 1);
            _dlcTreeView.AppendColumn("Path", new CellRendererText(), "text", 2);

            foreach (DlcContainer dlcContainer in _dlcContainerList)
            {
                TreeIter parentIter = ((TreeStore)_dlcTreeView.Model).AppendValues(false, "", dlcContainer.Path);

                using FileStream containerFile = File.OpenRead(dlcContainer.Path);
                PartitionFileSystem pfs = new PartitionFileSystem(containerFile.AsStorage());
                _virtualFileSystem.ImportTickets(pfs);

                foreach (DlcNca dlcNca in dlcContainer.DlcNcaList)
                {
                    pfs.OpenFile(out IFile ncaFile, dlcNca.Path.ToU8Span(), OpenMode.Read).ThrowIfFailure();
                    Nca nca = TryCreateNca(ncaFile.AsStorage(), dlcContainer.Path);

                    if (nca != null)
                    {
                        ((TreeStore)_dlcTreeView.Model).AppendValues(parentIter, dlcNca.Enabled, nca.Header.TitleId.ToString("X16"), dlcNca.Path);
                    }
                }
            }
        }
            public OpeningBrowserUI(OpeningsDb db)
                : base()
            {
                menubar = new AppMenuBar ();
                title = Catalog.GetString ("Opening Browser");
                accel = new AccelGroup ();
                menubar.quitMenuItem.
                    AddAccelerator ("activate", accel,
                            new AccelKey (Gdk.Key.
                                      q,
                                      Gdk.
                                      ModifierType.
                                      ControlMask,
                                      AccelFlags.
                                      Visible));
                toolbutton = new ToolButton (Stock.Info);
                toolbutton.Label =
                    Catalog.GetString ("Openings");
                toolbutton.ShowAll ();

                this.db = db;
                store = new TreeStore (typeof (string),
                               typeof (int),
                               typeof (string));
                this.db.PopulateTree (store);
                view = new TreeView ();
                view.Model = store;
                view.AppendColumn (Catalog.
                           GetString ("Moves"),
                           new CellRendererText (),
                           "text", 0);
                view.AppendColumn (Catalog.
                           GetString ("Variations"),
                           new CellRendererText (),
                           "text", 1);
                view.AppendColumn (Catalog.
                           GetString ("Name"),
                           new CellRendererText (),
                           "markup", 2);

                ScrolledWindow win = new ScrolledWindow ();
                win.SetPolicy (PolicyType.Automatic,
                           PolicyType.Automatic);
                win.Add (view);

                boardWidget = new GameViewerBoard ();
                HPaned split = new HPaned ();
                VBox box = new VBox ();
                box.PackStart (boardWidget, true, true, 2);
                split.Pack1 (box, false, true);	// resize, shrink
                split.Pack2 (win, true, true);
                split.ShowAll ();
                //split.Position = 400;
                int width, height;
                CsBoardApp.Instance.Window.GetSize (out width,
                                    out
                                    height);
                split.Position =
                    (int) Math.Round (width * 0.5f);
                split.PositionSet = true;
                PackStart (split, true, true, 2);

                view.CursorChanged += OnCursorChanged;
                ShowAll ();
            }
Example #34
0
        void Init()
        {
            ui = new Glade.XML(null, "lat.glade", "profileDialog", null);
            ui.Autoconnect(this);

            Gdk.Pixbuf pb = Gdk.Pixbuf.LoadFromResource("x-directory-remote-server-48x48.png");
            image7.Pixbuf = pb;

            createCombo();
            noEncryptionRadioButton.Active = true;

            // views
            pluginStore = new ListStore(typeof(bool), typeof(string));

            CellRendererToggle crt = new CellRendererToggle();

            crt.Activatable = true;
            crt.Toggled    += OnClassToggled;

            pluginTreeView.AppendColumn("Enabled", crt, "active", 0);
            pluginTreeView.AppendColumn("Name", new CellRendererText(), "text", 1);

            pluginTreeView.Model = pluginStore;

            foreach (ViewPlugin vp in Global.Plugins.ServerViewPlugins)
            {
                if (conn.ServerViews.Contains(vp.GetType().ToString()))
                {
                    pluginStore.AppendValues(true, vp.Name);
                }
                else
                {
                    pluginStore.AppendValues(false, vp.Name);
                }
            }

            attrPluginStore = new ListStore(typeof(bool), typeof(string));

            crt             = new CellRendererToggle();
            crt.Activatable = true;
            crt.Toggled    += OnAttributeViewerToggled;

            attrViewPluginTreeView.AppendColumn("Enabled", crt, "active", 0);
            attrViewPluginTreeView.AppendColumn("Name", new CellRendererText(), "text", 1);

            attrViewPluginTreeView.Model = attrPluginStore;

            if (conn.AttributeViewers.Count == 0)
            {
                conn.SetDefaultAttributeViewers();
            }

            foreach (AttributeViewPlugin avp in Global.Plugins.AttributeViewPlugins)
            {
                if (conn.AttributeViewers.Contains(avp.GetType().ToString()))
                {
                    attrPluginStore.AppendValues(true, avp.Name);
                }
                else
                {
                    attrPluginStore.AppendValues(false, avp.Name);
                }
            }

            profileDialog.Icon = Global.latIcon;
        }