public TextSelectionCommand(ITextViewReadonly textViewReader, SelectionView selectionView, CaretView caretView)
 {
     this.textViewReader = textViewReader;
     this.selectionView  = selectionView;
     this.caretView      = caretView;
     algorithm           = new TextSelectionAlgorithm(caretView, textViewReader, selectionView);
 }
        /// <summary>
        /// Setup View for the gameplay
        /// </summary>
        private void SetupView()
        {
            view         = new XnaUIFrame(this);
            view.DrawBox = new Rectangle(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT);
            MapView mainView = new MapView(this);

            mainView.DrawBox = new Rectangle(0, 0, 1280, 720);

            SelectionState selectionState = model.GetSelectionState();
            SelectionView  selectionView  = new SelectionView(this, selectionState);

            selectionView.DrawBox = new Rectangle(275, 520, 730, 200);
            SameSizeChildrenFlowLayout selectedEntityUIHolder = new SameSizeChildrenFlowLayout(this);

            selectedEntityUIHolder.DrawBox = new Rectangle(215, 25, 450, 150);
            selectionView.AddChild(selectedEntityUIHolder);

            CommandView commandView = new CommandView(this);

            commandView.DrawBox = new Rectangle(1005, 445, 275, 275);
            SameSizeChildrenFlowLayout commandViewButtonBox = new SameSizeChildrenFlowLayout(this);

            selectionView.commandBar = commandView;             // Register commandView to selection View

            view.AddChild(mainView);
            view.AddChild(selectionView);
            view.AddChild(commandView);
        }
Example #3
0
        public EditorContext()
        {
            Postbox = Postbox.InstanceFor(EditorCode);
            Configuration.ConfigManager.AddEditorConfig(EditorCode, new Configuration.Config {
                Language       = SupportedLanguages.JS,
                FormattingType = FormattingType.BRACKETS
            });

            TextsToEnter      = new List <string>();
            CaretView         = new CaretView();
            TextView          = new TextView(CaretView);
            SelectionView     = new SelectionView(TextView);
            LinesView         = new LinesView();
            FoldingView       = new FoldingView();
            EnterTextCommand  = new EnterTextCommand(TextView, CaretView, SelectionView);
            RemoveTextCommand = new RemoveTextCommand(TextView, CaretView, SelectionView);
            CaretMoveCommand  = new CaretMoveCommand(CaretView, TextView);
            SelectionCommand  = new TextSelectionCommand(TextView, SelectionView, CaretView);

            CaretView.EditorCode     = EditorCode;
            CaretView.Postbox        = Postbox;
            TextView.EditorCode      = EditorCode;
            TextView.Postbox         = Postbox;
            SelectionView.EditorCode = EditorCode;
            SelectionView.Postbox    = Postbox;
            LinesView.EditorCode     = EditorCode;
            LinesView.Postbox        = Postbox;
            FoldingView.EditorCode   = EditorCode;
            FoldingView.Postbox      = Postbox;

            InitEvents();
            ForceDraw();
        }
        private void Handle_MultipleSelectionView(object sender, EventArgs e)
        {
            SelectionView page = new SelectionView(dogs)
            {
                Title             = "Select Multiple Item",
                MultipleSelection = true
            };

            page.OnItemsSelected += Handle_OnItemsSelected;

            Navigation.PushAsync(page);
        }
    public void StartSelection(/*List<GameObject> sT, ISelectionModel iSM*/)
    {
        //selectionModel = iSM;
        //RepopulateSelections(sT);
        gameObject.SetActive(true);
        selectionModel = GetComponent <GeneralSelectionModel>();
        selections     = selectionModel.GetSelections();
        indx           = 0;

        selectionView = GetComponent <SelectionView>();
        selectionView.OpenView(selections);
        Unpause();
        // selectionView.MoveCursorToIndex(indx);
    }
        private void SetupViews()
        {
            var editorCode = this.GetEditor().GetHashCode();

            caretView     = new CaretView();
            textView      = new TextView(caretView);
            selectionView = new SelectionView(textView);

            foreach (var view in new LocalViewBase[] { selectionView, textView, caretView })
            {
                view.Margin = new Thickness(2, 0, 0, 0);
                view.HorizontalAlignment = HorizontalAlignment.Left;
                view.VerticalAlignment   = VerticalAlignment.Top;

                views.Add(view);
                Children.Add(view);

                view.EditorCode = editorCode;
                view.Postbox    = postbox;
            }
        }
Example #7
0
        /// <summary>
        /// Check for old poorly named settings that don't directly match setting property names
        /// </summary>
        /// <param name="settings">The node that holds all the settings nodes</param>
        public void ApplyLegacySettings(List <XElement> settings)
        {
            for (int i = 0; i < settings.Count; i++)
            {
                XElement setting = settings[i];
                switch (setting.Name.LocalName)
                {
                //put legacy names here to direct name change
                case "backupModFolder":
                    BackupModFolder = bool.Parse(setting.Value);
                    break;

                case "cleanInstallation":
                    CleanInstallation = bool.Parse(setting.Value);
                    break;

                case "forceManuel":
                    ForceManuel = bool.Parse(setting.Value);
                    break;

                case "saveLastConfig":
                    SaveLastSelection = bool.Parse(setting.Value);
                    break;

                case "saveUserData":
                    SaveUserData = bool.Parse(setting.Value);
                    break;

                case "EnableChildColorChangeLegacyView":
                    EnableColorChangeLegacyView = bool.Parse(setting.Value);
                    break;

                case "EnableChildColorChangeDefaultV2View":
                    EnableColorChangeDefaultV2View = bool.Parse(setting.Value);
                    break;

                case "clearCache":
                    ClearCache = bool.Parse(setting.Value);
                    break;

                case "deleteLogs":
                    DeleteLogs = bool.Parse(setting.Value);
                    break;

                case "modSelectionHeight":
                    ModSelectionHeight = int.Parse(setting.Value);
                    break;

                case "modSelectionWidth":
                    ModSelectionWidth = int.Parse(setting.Value);
                    break;

                case "previewX":
                    PreviewX = int.Parse(setting.Value);
                    break;

                case "previewY":
                    PreviewY = int.Parse(setting.Value);
                    break;

                case "language":
                    Language = (Languages)int.Parse(setting.Value);
                    break;

                case "SelectionView":
                    ModSelectionView = (SelectionView)int.Parse(setting.Value);
                    break;

                case "BetaApplication":
                    if (CommonUtils.ParseBool(setting.Value, false))
                    {
                        ApplicationDistroVersion = ApplicationVersions.Beta;
                    }
                    else
                    {
                        ApplicationDistroVersion = ApplicationVersions.Stable;
                    }
                    break;

                case "BetaDatabase":
                    if (CommonUtils.ParseBool(setting.Value, false))
                    {
                        DatabaseDistroVersion = DatabaseVersions.Beta;
                    }
                    else
                    {
                        DatabaseDistroVersion = DatabaseVersions.Stable;
                    }
                    break;

                case "SuperExtraction":
                    MulticoreExtraction = CommonUtils.ParseBool(setting.Value, false);
                    break;

                case "InstantExtraction":
                    InstallWhileDownloading = CommonUtils.ParseBool(setting.Value, false);
                    break;
                }
            }
        }
Example #8
0
 //loads settings from xml file
 public static void LoadSettings()
 {
     //Settings declared here are set for what their default values should be, then later modified in the settings xml file
     //i.e. when new features are added
     FirstLoad = false;
     Logging.Manager("Loading application settings");
     if (!File.Exists(SettingsXmlFile))
     {
         Logging.Manager("WARNING:Settings xml not found, defaults used");
         //also specify that this is the first load
         FirstLoad = true;
         Logging.Manager("Language: " + CultureInfo.CurrentCulture.DisplayName);
         string lang = CultureInfo.InstalledUICulture.Name.Split('-')[0].ToLower();
         switch (lang)
         {
             case "de":
                 Translations.language = Translations.Languages.German;
                 break;
             case "pl":
                 Translations.language = Translations.Languages.Polish;
                 break;
             case "fr":
                 Translations.language = Translations.Languages.French;
                 break;
             default:
                 Translations.language = Translations.Languages.English;
                 break;
         }
     }
     else
     {
         Logging.Manager("Loading xml file");
         XmlDocument doc = new XmlDocument();
         doc.Load(SettingsXmlFile);
         XmlNodeList settingsList = doc.ChildNodes[0].ChildNodes;
         foreach (XmlNode n in settingsList)
         {
             switch (n.Name)
             {
                 case "comicSans":
                     ComicSans = bool.Parse(n.InnerText);
                     break;
                 case "backupModFolder":
                     BackupModFolder = bool.Parse(n.InnerText);
                     break;
                 case "cleanInstallation":
                     CleanInstallation = bool.Parse(n.InnerText);
                     break;
                 case "loadingGif":
                     GIF = (LoadingGifs)int.Parse(n.InnerText);
                     break;
                 case "forceManuel":
                     ForceManuel = bool.Parse(n.InnerText);
                     break;
                 case "modSelectionHeight":
                     ModSelectionHeight = int.Parse(n.InnerText);
                     break;
                 case "modSelectionWidth":
                     ModSelectionWidth = int.Parse(n.InnerText);
                     break;
                 case "saveLastConfig":
                     SaveLastConfig = bool.Parse(n.InnerText);
                     break;
                 case "saveUserData":
                     SaveUserData = bool.Parse(n.InnerText);
                     break;
                 case "clearCache":
                     ClearCache = bool.Parse(n.InnerText);
                     break;
                 case "darkUI":
                     DarkUI = bool.Parse(n.InnerText);
                     break;
                 case "EnableBordersDefaultView":
                     EnableBordersDefaultView = bool.Parse(n.InnerText);
                     break;
                 case "EnableBordersLegacyView":
                     EnableBordersLegacyView = bool.Parse(n.InnerText);
                     break;
                 case "EnableBordersDefaultV2View":
                     EnableBordersDefaultV2View = bool.Parse(n.InnerText);
                     break;
                 case "EnableChildColorChangeDefaultView":
                     EnableColorChangeDefaultView = bool.Parse(n.InnerText);
                     break;
                 case "EnableChildColorChangeLegacyView":
                     EnableColorChangeLegacyView = bool.Parse(n.InnerText);
                     break;
                 case "EnableChildColorChangeDefaultV2View":
                     EnableColorChangeDefaultV2View = bool.Parse(n.InnerText);
                     break;
                 case "deleteLogs":
                     DeleteLogs = bool.Parse(n.InnerText);
                     break;
                 case "language":
                     Translations.language = (Translations.Languages)int.Parse(n.InnerText);
                     break;
                 case "ModSelectionFullscreen":
                     ModSelectionFullscreen = bool.Parse(n.InnerText);
                     break;
                 case "NotifyIfSameDatabase":
                     NotifyIfSameDatabase = bool.Parse(n.InnerText);
                     break;
                 case "ShowInstallCompleteWindow":
                     ShowInstallCompleteWindow = bool.Parse(n.InnerText);
                     break;
                 case "previewX":
                     PreviewX = int.Parse(n.InnerText);
                     break;
                 case "previewY":
                     PreviewY = int.Parse(n.InnerText);
                     break;
                 case "customModInfoPath":
                     CustomModInfoPath = n.InnerText;
                     break; 
                 case "SelectionView":
                     SView = (SelectionView)int.Parse(n.InnerText);
                     break;
                 case "FontSizeForum":
                     FontSizeforum = (FontSize)int.Parse(n.InnerText);
                     break;
                 case "CreateShortcuts":
                     CreateShortcuts = bool.Parse(n.InnerText);
                     break;
                 case "InstantExtraction":
                     InstantExtraction = bool.Parse(n.InnerText);
                     break;
                 case "UninstallMode":
                     UninstallMode = (UninstallModes)int.Parse(n.InnerText);
                     break;
                 case "SuperExtraction":
                     SuperExtraction = bool.Parse(n.InnerText);
                     break;
                 case "PreviewFullscreen":
                     PreviewFullscreen = bool.Parse(n.InnerText);
                     break;
                 case "PreviewWidth":
                     PreviewWidth = int.Parse(n.InnerText);
                     break;
                 case "PreviewHeight":
                     PreviewHeight = int.Parse(n.InnerText);
                     break;
                 case "ExportMode":
                     ExportMode = bool.Parse(n.InnerText);
                     break;
                 case "UseAlternateUpdateMethod":
                     UseAlternateUpdateMethod = bool.Parse(n.InnerText);
                     break;
                 case "BetaApplication":
                     if(!Program.betaAppSetFromCommandLine)
                         BetaApplication = bool.Parse(n.InnerText);
                     break;
                 case "BetaDatabase":
                     if(!Program.betaDBSetFromCommandLine)
                         BetaDatabase = bool.Parse(n.InnerText);
                     break;
                 case "priorityBrowser":
                     PriorityBrowser = n.InnerText;
                     break;
             }
         }
     }
     ApplyInternalProperties();
     Logging.Manager("Settings loaded successfully");
 }
Example #9
0
 public TextSelectionAlgorithm(ICaretViewReadonly caretViewReader, ITextViewReadonly textViewReader, SelectionView parent)
 {
     this.caretViewReader = caretViewReader;
     this.textViewReader  = textViewReader;
     this.parent          = parent;
 }
 public SelectionViewManager(MultiSelector attachedElement, SelectionView selectionView)
 {
     this.attachedElement = attachedElement;
     this.selectionView   = selectionView;
     //selectionView.SelectionChanged += selectionView_SelectionChanged;
 }
Example #11
0
        /// <summary>
        /// This method run when Selection button clicked
        /// </summary>
        private void selectionBT_Click(object sender, EventArgs e)
        {
            if (filePath != string.Empty)
            {
                string[]      selectionArray = new string[3];
                SelectionView selectionView  = new SelectionView();
                selectionView.ShowDialog();
                if (selectionView.DialogResult == DialogResult.OK)
                {
                    List <KeysObjects> keysObjects = new List <KeysObjects>();
                    selectionArray = selectionView.GetSelection();
                    int    cell     = 0;
                    string type     = selectionArray[1];
                    string withCell = selectionArray[0];
                    switch (withCell)
                    {
                    case "PLATFORM":
                        cell = 0;
                        break;

                    case "LOGIN":
                        cell = 1;
                        break;

                    case "PASSWORD":
                        cell = 2;
                        break;

                    case "DESCRIPTION":
                        cell = 3;
                        break;
                    }
                    for (int i = 0; i < dataDGV.RowCount; i++)
                    {
                        string value = dataDGV.Rows[i].Cells[cell].Value.ToString();
                        if (type == "CONTAIN")
                        {
                            if (value.Contains(selectionArray[2]))
                            {
                                keysObjects.Add(new KeysObjects(dataDGV.Rows[i].Cells[0].Value.ToString(), dataDGV.Rows[i].Cells[1].Value.ToString(), dataDGV.Rows[i].Cells[2].Value.ToString(), dataDGV.Rows[i].Cells[3].Value.ToString()));
                            }
                        }
                        else if (type == "EQUAL")
                        {
                            if (value == selectionArray[2])
                            {
                                keysObjects.Add(new KeysObjects(dataDGV.Rows[i].Cells[0].Value.ToString(), dataDGV.Rows[i].Cells[1].Value.ToString(), dataDGV.Rows[i].Cells[2].Value.ToString(), dataDGV.Rows[i].Cells[3].Value.ToString()));
                            }
                        }
                    }
                    dataDGV.Rows.Clear();
                    dataDGV.Refresh();
                    foreach (var keyObject in keysObjects)
                    {
                        int RowIndex = dataDGV.Rows.Add();
                        dataDGV.Rows[RowIndex].Cells[0].Value = keyObject.platform;
                        dataDGV.Rows[RowIndex].Cells[1].Value = keyObject.login;
                        dataDGV.Rows[RowIndex].Cells[2].Value = keyObject.password;
                        dataDGV.Rows[RowIndex].Cells[3].Value = keyObject.description;
                    }
                }
            }
            else
            {
                MessageBox.Show("First load or create keys file !", "Error status", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #12
0
 public TextDeselectionCommand(SelectionView selectionView)
 {
     this.selectionView = selectionView;
 }
Example #13
0
        /// <summary>
        /// Check for old poorly named settings that don't directly match setting property names
        /// </summary>
        /// <param name="settings">The node that holds all the settings nodes</param>
        public static void ApplyOldSettings(XmlNodeList settings)
        {
            for (int i = 0; i < settings.Count; i++)
            {
                XmlNode setting = settings[i];
                switch (setting.Name)
                {
                //put legacy names here to direct name change
                //TODO: super extraction and instant extraction?
                case "backupModFolder":
                    BackupModFolder = bool.Parse(setting.InnerText);
                    break;

                case "cleanInstallation":
                    CleanInstallation = bool.Parse(setting.InnerText);
                    break;

                case "forceManuel":
                    ForceManuel = bool.Parse(setting.InnerText);
                    break;

                case "saveLastConfig":
                    SaveLastSelection = bool.Parse(setting.InnerText);
                    break;

                case "saveUserData":
                    SaveUserData = bool.Parse(setting.InnerText);
                    break;

                case "EnableChildColorChangeLegacyView":
                    EnableColorChangeLegacyView = bool.Parse(setting.InnerText);
                    break;

                case "EnableChildColorChangeDefaultV2View":
                    EnableColorChangeDefaultV2View = bool.Parse(setting.InnerText);
                    break;

                case "clearCache":
                    ClearCache = bool.Parse(setting.InnerText);
                    break;

                case "deleteLogs":
                    DeleteLogs = bool.Parse(setting.InnerText);
                    break;

                case "modSelectionHeight":
                    ModSelectionHeight = int.Parse(setting.InnerText);
                    break;

                case "modSelectionWidth":
                    ModSelectionWidth = int.Parse(setting.InnerText);
                    break;

                case "previewX":
                    PreviewX = int.Parse(setting.InnerText);
                    break;

                case "previewY":
                    PreviewY = int.Parse(setting.InnerText);
                    break;

                case "language":
                    Language = (Languages)int.Parse(setting.InnerText);
                    break;

                case "SelectionView":
                    ModSelectionView = (SelectionView)int.Parse(setting.InnerText);
                    break;

                case "BetaApplication":
                    ApplicationDistroVersion = ApplicationVersions.Beta;
                    break;

                case "BetaDatabase":
                    DatabaseDistroVersion = DatabaseVersions.Beta;
                    break;
                }
            }
        }
Example #14
0
        /* après avoir coché une case, il y a plusieurs conditions à gérer
         * si un nouveau nœud (et valide) a été vérifié, mettre à jour les paramètres
         * annule lorsque le nœud vérifié était un paramètre précédemment sélectionné
         */
        private void SelectionView_AfterCheck(object sender, System.Windows.Forms.TreeViewEventArgs e)
        {
            // bloquer le contrôle jusqu'à la fin du rafraîchissement
            SelectionView.Enabled = false;
            SelectionView.Refresh();

            // si l'action n'a pas été activée par la souris, ignore-la
            // empêche cette fonction de boucler indéfiniment
            if (e.Action != TreeViewAction.ByMouse)
            {
                SelectionView.Enabled = true;
                return;
            }

            // si le nœud est de niveau 0, c'est-à-dire avec les noms des paramètres, décoche-le et retourne-le
            if (e.Node.Level != 1)
            {
                e.Node.Checked        = false;
                SelectionView.Enabled = true;
                return;
            }

            /* si le nœud est de niveau 1 et vient d'être vérifié par la souris:
             * 1) décochez
             * 2) restauration si nécessaire
             * 3) effectuer la mise à jour
             */
            if (e.Node.Checked)
            {
                bool siblingWasChecked = false;

                // décochez chaque case
                foreach (TreeNode node in e.Node.Parent.Nodes)
                {
                    if (e.Node != node)
                    {
                        if (node.Checked)
                        {
                            siblingWasChecked = true;
                            node.Checked      = false;
                        }
                    }
                }

                // si une cse n'a pas été cochée, annuler
                if (siblingWasChecked == true)
                {
                    // supprimer les nœuds enfants successifs de la case parent
                    // des options qui n'existent plus en raison de la restauration
                    TreeNode node = e.Node.Parent.NextNode;
                    while (node != null)
                    {
                        if (node.Nodes != null && node.Nodes.Count > 0)
                        {
                            for (int i = node.Nodes.Count - 1; i >= 0; i--)
                            {
                                node.Nodes[i].Remove();
                            }
                        }
                        node = node.NextNode;
                    }
                    // dire à refreshHandler de supprimer les informations de l'index et plus
                    refreshHandler.pop(e.Node.Parent.Index);
                }

                // effectuer une demande de mise à jour sur le serveur en fonction du nom de ce nœud
                string selection = e.Node.Name;
                refreshHandler.updateParameter(e.Node.Parent.Index, selection, SelectionView, TraceBox);
            }

            // fin de la mise à jour de l'arborescence, réactivation du contrôle
            SelectionView.Enabled = true;

            return;
        }