private void endToken() { var @string = new string(_characters.ToArray()); _tokens.Add(@string); _mode = new Searching(this); }
public void RaiseSwitchedMode(IMode mode) { if ( SwitchedMode != null ) { SwitchedMode(this, mode); } }
private void KeyInputEventComplete() { _inKeyInputEvent = false; try { if (!String.IsNullOrEmpty(_message)) { _margin.StatusLine = _message; } else if (_modeSwitch != null) { UpdateForSwitchMode(_modeSwitch); } else { UpdateForNoEvent(); } } finally { _message = null; _modeSwitch = null; } }
internal static string GetStatus(IVimBuffer vimBuffer, IMode currentMode, bool forModeSwitch) { if (forModeSwitch) { return GetStatusCommon(vimBuffer, currentMode); } return GetStatusOther(vimBuffer, currentMode); }
private void cbModes_SelectedIndexChanged(object sender, EventArgs e) { selectedMode = modes[cbModes.SelectedIndex]; if (plowMashine != null) { btnCalculate.Enabled = true; parametersView.Params = ParametersHelper.GetParams(selectedMode.InputParams, plowMashine); } }
public void CreateBuffer(params string[] lines) { _view = Utils.EditorUtil.CreateView(lines); _host = new Mock<IVimHost>(MockBehavior.Strict); _buffer = _view.TextBuffer; _data = Utils.MockObjectFactory.CreateVimBuffer( _view, vim: Utils.MockObjectFactory.CreateVim(host : _host.Object).Object); _operations = new Mock<ICommonOperations>(MockBehavior.Strict); _broker = new Mock<ICompletionWindowBroker>(MockBehavior.Strict); _modeRaw = new Vim.Modes.Insert.InsertMode(Tuple.Create<IVimBuffer,ICommonOperations,ICompletionWindowBroker>(_data.Object,_operations.Object,_broker.Object)); _mode = _modeRaw; }
/// <summary> /// Pushes and activated a mode. /// </summary> /// <param name="mode"></param> public void Push(IMode mode) { // We can't handle nulls if (mode == null) throw new ArgumentNullException("mode"); // See if we have a current mode if (modes.Count != 0) // Deactivate the mode CurrentMode.Deactivate(false); // Add it modes.Insert(0, mode); mode.Activate(true); }
public void CreateBuffer(params string[] lines) { _view = Utils.EditorUtil.CreateView(lines); _buffer = _view.TextBuffer; _vim = new Mock<IVim>(); _globalSettings = new Mock<IVimGlobalSettings>(MockBehavior.Strict); _localSettings = new Mock<IVimLocalSettings>(MockBehavior.Strict); _localSettings.SetupGet(x => x.GlobalSettings).Returns(_globalSettings.Object); _data = Utils.MockObjectFactory.CreateVimBuffer( _view, settings:_localSettings.Object, vim:_vim.Object); _operations = new Mock<ICommonOperations>(MockBehavior.Strict); _broker = new Mock<IDisplayWindowBroker>(MockBehavior.Strict); _modeRaw = new Vim.Modes.Insert.InsertMode(Tuple.Create<IVimBuffer,ICommonOperations,IDisplayWindowBroker>(_data.Object,_operations.Object,_broker.Object)); _mode = _modeRaw; }
private static string GetStatusOther(IVimBuffer vimBuffer, IMode currentMode) { var search = vimBuffer.IncrementalSearch; if (search.InSearch) { var searchText = search.CurrentSearchText; var prefix = search.CurrentSearchData.Path.IsForward ? "/" : "?"; if (InPasteWait(vimBuffer)) { searchText += "\""; } return prefix + searchText; } string status; switch (currentMode.ModeKind) { case ModeKind.Command: status = ":" + vimBuffer.CommandMode.Command + (InPasteWait(vimBuffer) ? "\"" : ""); break; case ModeKind.Normal: status = vimBuffer.NormalMode.Command; break; case ModeKind.SubstituteConfirm: status = GetStatusSubstituteConfirm(vimBuffer.SubstituteConfirmMode); break; case ModeKind.VisualBlock: status = GetStatusWithRegister(Resources.VisualBlockBanner, vimBuffer.VisualBlockMode.CommandRunner); break; case ModeKind.VisualCharacter: status = GetStatusWithRegister(Resources.VisualCharacterBanner, vimBuffer.VisualCharacterMode.CommandRunner); break; case ModeKind.VisualLine: status = GetStatusWithRegister(Resources.VisualLineBanner, vimBuffer.VisualLineMode.CommandRunner); break; default: status = GetStatusCommon(vimBuffer, currentMode); break; } return status; }
private void OnSwitchMode(object sender, IMode mode) { _margin.RightStatusLine = String.Empty; switch (mode.ModeKind) { case ModeKind.Normal: case ModeKind.Command: case ModeKind.Insert: _margin.StatusLine = String.Empty; break; case ModeKind.VisualBlock: _margin.StatusLine = Resources.VisualBlockBanner; break; case ModeKind.VisualCharacter: _margin.StatusLine = Resources.VisualCharacterBanner; break; case ModeKind.VisualLine: _margin.StatusLine = Resources.VisualLineBanner; break; default: _margin.StatusLine = String.Empty; break; } }
private void Create2( ModeKind kind = ModeKind.VisualCharacter, params string[] lines) { _textView = CreateTextView(lines); _textBuffer = _textView.TextBuffer; var vimTextBuffer = Vim.CreateVimTextBuffer(_textBuffer); var vimBufferData = CreateVimBufferData(vimTextBuffer, _textView); var visualKind = VisualKind.OfModeKind(kind).Value; _selection = _textView.Selection; _factory = new MockRepository(MockBehavior.Strict); _tracker = _factory.Create<ISelectionTracker>(); _tracker.Setup(x => x.Start()); _tracker.Setup(x => x.UpdateSelection()); _tracker.Setup(x => x.RecordCaretTrackingPoint(It.IsAny<ModeArgument>())); _tracker.SetupGet(x => x.IsRunning).Returns(true); _operations = _factory.Create<ICommonOperations>(); _operations.SetupGet(x => x.TextView).Returns(_textView); _operations.Setup(x => x.MoveCaretToPoint(It.IsAny<SnapshotPoint>(), ViewFlags.Standard)); _commandUtil = _factory.Create<ICommandUtil>(); var motionUtil = new MotionUtil(vimBufferData, _operations.Object); var capture = new MotionCapture(vimBufferData, new IncrementalSearch(vimBufferData, _operations.Object)); var runner = new CommandRunner( _textView, Vim.RegisterMap, capture, vimBufferData.LocalSettings, _commandUtil.Object, (new Mock<IStatusUtil>()).Object, VisualKind.Character, KeyRemapMode.Visual); _modeRaw = new VisualMode(vimBufferData, _operations.Object, motionUtil, visualKind, runner, capture, _tracker.Object); _mode = _modeRaw; _mode.OnEnter(ModeArgument.None); }
public void Create2( ModeKind kind=ModeKind.VisualCharacter, params string[] lines) { _buffer = EditorUtil.CreateBuffer(lines); _caret = new Mock<ITextCaret>(MockBehavior.Strict); _view = new Mock<IWpfTextView>(MockBehavior.Strict); _selection = new Mock<ITextSelection>(MockBehavior.Strict); _view.SetupGet(x => x.Caret).Returns(_caret.Object); _view.SetupGet(x => x.Selection).Returns(_selection.Object); _view.SetupGet(x => x.TextBuffer).Returns(_buffer); _view.SetupGet(x => x.TextSnapshot).Returns(() => _buffer.CurrentSnapshot); _map = new RegisterMap(); _tracker = new Mock<ISelectionTracker>(MockBehavior.Strict); _tracker.Setup(x => x.Start()); _operations = new Mock<IOperations>(MockBehavior.Strict); _operations.SetupGet(x => x.SelectionTracker).Returns(_tracker.Object); _bufferData = MockObjectFactory.CreateVimBuffer( _view.Object, "test", MockObjectFactory.CreateVim(_map).Object); var capture = new MotionCapture(_view.Object, new MotionUtil(_view.Object, _bufferData.Object.Settings.GlobalSettings)); var runner = new CommandRunner(Tuple.Create((ITextView)_view.Object, _map, (IMotionCapture)capture, (new Mock<IStatusUtil>()).Object)); _modeRaw = new Vim.Modes.Visual.VisualMode(_bufferData.Object, _operations.Object, kind, runner, capture); _mode = _modeRaw; _mode.OnEnter(); }
/// <summary> /// Constructor /// </summary> /// <param name="mode"> /// The mode settings. /// </param> /// <param name="bigKeyShuffle"> /// The new big key shuffle setting. /// </param> public ChangeBigKeyShuffle(IMode mode, bool bigKeyShuffle) { _mode = mode; _bigKeyShuffle = bigKeyShuffle; }
/// <summary> /// Constructor /// </summary> /// <param name="mode"> /// The mode settings. /// </param> /// <param name="keyDropShuffle"> /// The new key drp shuffle setting. /// </param> public ChangeKeyDropShuffle(IMode mode, bool keyDropShuffle) { _mode = mode; _keyDropShuffle = keyDropShuffle; }
public void Create2( ModeKind kind=ModeKind.VisualCharacter, IVimHost host= null, params string[] lines) { _buffer = EditorUtil.CreateBuffer(lines); _caret = new Mock<ITextCaret>(MockBehavior.Strict); _view = new Mock<IWpfTextView>(MockBehavior.Strict); _selection = new Mock<ITextSelection>(MockBehavior.Strict); _view.SetupGet(x => x.Caret).Returns(_caret.Object); _view.SetupGet(x => x.Selection).Returns(_selection.Object); _view.SetupGet(x => x.TextBuffer).Returns(_buffer); _view.SetupGet(x => x.TextSnapshot).Returns(() => _buffer.CurrentSnapshot); _map = new RegisterMap(); _editOpts = new Mock<IEditorOperations>(MockBehavior.Strict); _tracker = new Mock<ISelectionTracker>(MockBehavior.Strict); _tracker.Setup(x => x.Start()); _operations = new Mock<IOperations>(MockBehavior.Strict); _operations.SetupGet(x => x.SelectionTracker).Returns(_tracker.Object); host = host ?? new FakeVimHost(); _bufferData = MockObjectFactory.CreateVimBuffer( _view.Object, "test", MockObjectFactory.CreateVim(_map,host:host).Object, _editOpts.Object); _modeRaw = new Vim.Modes.Visual.VisualMode(Tuple.Create<IVimBuffer, IOperations, ModeKind>(_bufferData.Object, _operations.Object, kind)); _mode = _modeRaw; _mode.OnEnter(); }
private void UpdateForSwitchMode(IMode currentMode) { var status = CommandMarginUtil.GetStatus(_vimBuffer, currentMode, forModeSwitch: true); UpdateCommandLine(status); }
public BandMaster(): base() { Content.RootDirectory = "Content"; // Services GraphicsDeviceManager graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferHeight = height; graphics.PreferredBackBufferWidth = width; graphics.IsFullScreen = true; IManageInput inputManager; try { inputManager = new KinectInputManager(this); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message.ToString()); inputManager = new AlternativeInputManager(this); } inputManager.OnExit += OnExit; Components.Add(inputManager); Services.AddService(typeof(IManageInput), inputManager); Midi.Player player = new Midi.Player(this); Components.Add(player); Services.AddService(typeof(Midi.Player), player); AudioFx fx = new AudioFx(this); Components.Add(fx); Services.AddService(typeof(AudioFx), fx); Helpers.Game = this; // Game modes Play = new Logic.BandMasterMode(this); Pause = new Logic.PauseMenuMode(this); Menu = new Logic.MainMenuMode(this); Tutorial = new Logic.TutorialMode(this); HighScore = new Logic.HighScoreMode(this); Components.Add(Play); Components.Add(Pause); Components.Add(Menu); Components.Add(Tutorial); Components.Add(HighScore); // Graphics Graphics.SplashText splasher = new Graphics.SplashText(this); Components.Add(splasher); Services.AddService(typeof(Graphics.SplashText), splasher); Graphics.FlyingNotes notes = new Graphics.FlyingNotes(this); Components.Add(notes); Services.AddService(typeof(Graphics.FlyingNotes), notes); Components.Add(new Graphics.HandVisualizer(this)); Components.Add(new Graphics.Stage(this)); }
public void DecryptFile(string inputFile, string outputFile, byte[] key, string mode) { FileStream instream; FileStream outstream; try { double percent = 0.0; long current = 0; long sizeFile = 0; var cipher = new GOST28147Engine(); cipher.Init(false, new KeyParameter(key.ToArray())); IMode chosenMode = ChooseMode(mode, key, cipher); outstream = File.Open(outputFile, FileMode.Create); int chunkSize = 1024 * 1024; using (instream = File.OpenRead(inputFile)) { sizeFile = instream.Length; ProgressChanged?.Invoke(0.0); int byteRead = 0; byte[] input = new byte[chunkSize]; byte[] output = new byte[chunkSize]; byte lastByte = 0; while (true) { byteRead = instream.Read(input, 0, chunkSize); if (byteRead == chunkSize) { chosenMode.Process(input, output); lastByte = output[output.Length - 1]; outstream.Write(output, 0, chunkSize); } else { if (byteRead != 0) { byte[] temp = new byte[byteRead]; Array.Copy(input, 0, temp, 0, byteRead); input = temp; output = new byte[input.Length]; chosenMode.Process(input, output); lastByte = output[output.Length - 1]; //output = RemovePadding( output.ToArray() ); outstream.Write(output, 0, output.Length); } break; } current += byteRead; percent = (double)current / sizeFile; percent *= 100; ProgressChanged?.Invoke(percent); } var size = outstream.Length; long sizeOfFill = Convert.ToInt64(lastByte) + 8; outstream.SetLength(size - sizeOfFill); outstream.Close(); instream.Close(); } } catch (Exception) { throw new Exception("Ошибка!"); } outstream?.Close(); instream?.Close(); }
/// <summary> /// 添加一个mode /// </summary> /// <param name="mode"></param> public void AddMode(IMode mode) { mModes.Add(mode); }
/// <summary> /// Constructor /// </summary> /// <param name="worldState"> /// The new world state setting. /// </param> public ChangeWorldState(IMode mode, WorldState worldState) { _mode = mode; _worldState = worldState; }
public void Configure(IMode mode) { Configurator.Configure(Data, mode, LifeCycle.Stage); }
public virtual void ExitState(IMode context) { }
public virtual void EnterState(IMode context) { }
public virtual void SpecialB(IMode context) { }
public virtual void DumpName(IMode context) { }
private void UpdateForSwitchMode(IMode mode) { switch (mode.ModeKind) { case ModeKind.Normal: _margin.StatusLine = _buffer.NormalMode.OneTimeMode.Is(ModeKind.Insert) ? Resources.PendingInsertBanner : String.Empty; break; case ModeKind.Command: _margin.StatusLine = ":" + _buffer.CommandMode.Command; break; case ModeKind.Insert: _margin.StatusLine = Resources.InsertBanner; break; case ModeKind.Replace: _margin.StatusLine = Resources.ReplaceBanner; break; case ModeKind.VisualBlock: _margin.StatusLine = Resources.VisualBlockBanner; break; case ModeKind.VisualCharacter: _margin.StatusLine = Resources.VisualCharacterBanner; break; case ModeKind.VisualLine: _margin.StatusLine = Resources.VisualLineBanner; break; case ModeKind.ExternalEdit: _margin.StatusLine = Resources.ExternalEditBanner; break; case ModeKind.Disabled: _margin.StatusLine = _buffer.DisabledMode.HelpMessage; break; case ModeKind.SubstituteConfirm: UpdateSubstituteConfirmMode(); break; default: _margin.StatusLine = String.Empty; break; } }
/// <summary> /// Constructor /// </summary> /// <param name="mode"> /// The mode settings data. /// </param> /// <param name="factory"> /// The factory for creating small item controls. /// </param> public HorizontalSmallItemPanelVM(IMode mode, ISmallItemVMFactory factory) : base(mode, factory) { }
private void OnSwitchMode(object sender, IMode mode) { switch (mode.ModeKind) { case ModeKind.Normal: case ModeKind.Command: _margin.StatusLine = String.Empty; break; case ModeKind.Insert: _margin.StatusLine = Resources.InsertBanner; break; case ModeKind.VisualBlock: _margin.StatusLine = Resources.VisualBlockBanner; break; case ModeKind.VisualCharacter: _margin.StatusLine = Resources.VisualCharacterBanner; break; case ModeKind.VisualLine: _margin.StatusLine = Resources.VisualLineBanner; break; case ModeKind.Disabled: _margin.StatusLine = _buffer.DisabledMode.HelpMessage; break; default: _margin.StatusLine = String.Empty; break; } }
public void RaiseSwitchedMode(IMode mode) { RaiseSwitchedMode(new SwitchModeEventArgs(FSharpOption <IMode> .None, mode)); }
public static bool CanProcess(this IMode mode, VimKey key) { return(mode.CanProcess(KeyInputUtil.VimKeyToKeyInput(key))); }
public CommaTokenParser() { _mode = new Searching(this); }
private void UpdateForSwitchMode(IMode mode) { /// Calculate the argument string if we are in one time command mode string oneTimeArgument = null; if (_buffer.InOneTimeCommand.IsSome()) { if (_buffer.InOneTimeCommand.Is(ModeKind.Insert)) { oneTimeArgument = "insert"; } else if (_buffer.InOneTimeCommand.Is(ModeKind.Replace)) { oneTimeArgument = "replace"; } } switch (mode.ModeKind) { case ModeKind.Normal: _margin.StatusLine = String.IsNullOrEmpty(oneTimeArgument) ? String.Empty : String.Format(Resources.NormalOneTimeCommandBanner, oneTimeArgument); break; case ModeKind.Command: _margin.StatusLine = ":" + _buffer.CommandMode.Command; break; case ModeKind.Insert: _margin.StatusLine = Resources.InsertBanner; break; case ModeKind.Replace: _margin.StatusLine = Resources.ReplaceBanner; break; case ModeKind.VisualBlock: _margin.StatusLine = String.IsNullOrEmpty(oneTimeArgument) ? Resources.VisualBlockBanner : String.Format(Resources.VisualBlockOneTimeCommandBanner, oneTimeArgument); break; case ModeKind.VisualCharacter: _margin.StatusLine = String.IsNullOrEmpty(oneTimeArgument) ? Resources.VisualCharacterBanner : String.Format(Resources.VisualCharacterOneTimeCommandBanner, oneTimeArgument); break; case ModeKind.VisualLine: _margin.StatusLine = String.IsNullOrEmpty(oneTimeArgument) ? Resources.VisualLineBanner : String.Format(Resources.VisualLineOneTimeCommandBanner, oneTimeArgument); break; case ModeKind.ExternalEdit: _margin.StatusLine = Resources.ExternalEditBanner; break; case ModeKind.Disabled: _margin.StatusLine = _buffer.DisabledMode.HelpMessage; break; case ModeKind.SubstituteConfirm: UpdateSubstituteConfirmMode(); break; default: _margin.StatusLine = String.Empty; break; } }
/// <summary> /// This pops off every element from the mode and sets a new one. /// </summary> /// <param name="mode"></param> public void Set(IMode mode) { // Remove everything while (modes.Count > 0) Pop(); // Add this one Push(mode); }
/// <summary> /// 打开数据录入模式窗口,编辑 /// </summary> private void OpenInputMode(TaskInfoModel data) { IMode mode = PluginLoader.CreateMode((ModeInfoModel)cbInputMode.SelectedItem); mode.RunEdit(data); }
private void OnSwitchedMode(object sender, IMode newMode) { if (_inExternalEdit) { // If we're in the middle of an external edit and the mode switches then we // need to record the current edit markers so we can ignore them going // forward. Further updates which cause these markers to be rendered shouldn't // cause us to re-enter external edit mode SaveCurrentEditorMarkersForIgnore(); } }
public void SetUp(bool insertMode) { _factory = new MockRepository(MockBehavior.Strict); _factory.DefaultValue = DefaultValue.Mock; _textView = _factory.Create<ITextView>(); _vim = _factory.Create<IVim>(MockBehavior.Loose); _editorOptions = _factory.Create<IEditorOptions>(MockBehavior.Loose); _globalSettings = _factory.Create<IVimGlobalSettings>(); _localSettings = _factory.Create<IVimLocalSettings>(); _localSettings.SetupGet(x => x.GlobalSettings).Returns(_globalSettings.Object); _data = MockObjectFactory.CreateVimBuffer( _textView.Object, settings: _localSettings.Object, vim: _vim.Object, factory: _factory); _operations = _factory.Create<ICommonOperations>(); _broker = _factory.Create<IDisplayWindowBroker>(); _modeRaw = new Vim.Modes.Insert.InsertMode(_data.Object, _operations.Object, _broker.Object, _editorOptions.Object, _isReplace: !insertMode); _mode = _modeRaw; }
/// <summary> /// Constructor /// </summary> /// <param name="mode"> /// The game mode data. /// </param> /// <param name="bossShuffle"> /// A boolean representing the new boss shuffle setting. /// </param> public ChangeBossShuffle(IMode mode, bool bossShuffle) { _mode = mode; _bossShuffle = bossShuffle; }
private void UpdateForSwitchMode(IMode previousMode, IMode currentMode) { // Calculate the argument string if we are in one time command mode string oneTimeArgument = null; if (_vimBuffer.InOneTimeCommand.IsSome()) { if (_vimBuffer.InOneTimeCommand.Is(ModeKind.Insert)) { oneTimeArgument = "insert"; } else if (_vimBuffer.InOneTimeCommand.Is(ModeKind.Replace)) { oneTimeArgument = "replace"; } } // Check if we can enable the command line to accept user input var search = _vimBuffer.IncrementalSearch; switch (currentMode.ModeKind) { case ModeKind.Normal: _margin.StatusLine = String.IsNullOrEmpty(oneTimeArgument) ? String.Empty : String.Format(Resources.NormalOneTimeCommandBanner, oneTimeArgument); break; case ModeKind.Command: _margin.StatusLine = ":" + _vimBuffer.CommandMode.Command; break; case ModeKind.Insert: _margin.StatusLine = Resources.InsertBanner; break; case ModeKind.Replace: _margin.StatusLine = Resources.ReplaceBanner; break; case ModeKind.VisualBlock: _margin.StatusLine = String.IsNullOrEmpty(oneTimeArgument) ? Resources.VisualBlockBanner : String.Format(Resources.VisualBlockOneTimeCommandBanner, oneTimeArgument); break; case ModeKind.VisualCharacter: _margin.StatusLine = String.IsNullOrEmpty(oneTimeArgument) ? Resources.VisualCharacterBanner : String.Format(Resources.VisualCharacterOneTimeCommandBanner, oneTimeArgument); break; case ModeKind.VisualLine: _margin.StatusLine = String.IsNullOrEmpty(oneTimeArgument) ? Resources.VisualLineBanner : String.Format(Resources.VisualLineOneTimeCommandBanner, oneTimeArgument); break; case ModeKind.SelectBlock: _margin.StatusLine = Resources.SelectBlockBanner; break; case ModeKind.SelectCharacter: _margin.StatusLine = Resources.SelectCharacterBanner; break; case ModeKind.SelectLine: _margin.StatusLine = Resources.SelectLineBanner; break; case ModeKind.ExternalEdit: _margin.StatusLine = Resources.ExternalEditBanner; break; case ModeKind.Disabled: _margin.StatusLine = _vimBuffer.DisabledMode.HelpMessage; break; case ModeKind.SubstituteConfirm: UpdateSubstituteConfirmMode(); break; default: _margin.StatusLine = String.Empty; break; } }
private static string GetStatusCommon(IVimBuffer vimBuffer, IMode currentMode) { // Calculate the argument string if we are in one time command mode string oneTimeArgument = null; if (vimBuffer.InOneTimeCommand.IsSome()) { if (vimBuffer.InOneTimeCommand.Is(ModeKind.Insert)) { oneTimeArgument = "insert"; } else if (vimBuffer.InOneTimeCommand.Is(ModeKind.Replace)) { oneTimeArgument = "replace"; } } // Check if we can enable the command line to accept user input var search = vimBuffer.IncrementalSearch; string status; switch (currentMode.ModeKind) { case ModeKind.Normal: status = string.IsNullOrEmpty(oneTimeArgument) ? string.Empty : string.Format(Resources.NormalOneTimeCommandBanner, oneTimeArgument); break; case ModeKind.Command: status = ":" + vimBuffer.CommandMode.Command; break; case ModeKind.Insert: status = Resources.InsertBanner; break; case ModeKind.Replace: status = Resources.ReplaceBanner; break; case ModeKind.VisualBlock: status = string.IsNullOrEmpty(oneTimeArgument) ? Resources.VisualBlockBanner : string.Format(Resources.VisualBlockOneTimeCommandBanner, oneTimeArgument); break; case ModeKind.VisualCharacter: status = string.IsNullOrEmpty(oneTimeArgument) ? Resources.VisualCharacterBanner : string.Format(Resources.VisualCharacterOneTimeCommandBanner, oneTimeArgument); break; case ModeKind.VisualLine: status = string.IsNullOrEmpty(oneTimeArgument) ? Resources.VisualLineBanner : string.Format(Resources.VisualLineOneTimeCommandBanner, oneTimeArgument); break; case ModeKind.SelectBlock: status = Resources.SelectBlockBanner; break; case ModeKind.SelectCharacter: status = Resources.SelectCharacterBanner; break; case ModeKind.SelectLine: status = Resources.SelectLineBanner; break; case ModeKind.ExternalEdit: status = Resources.ExternalEditBanner; break; case ModeKind.Disabled: status = vimBuffer.DisabledMode.HelpMessage; break; case ModeKind.SubstituteConfirm: status = GetStatusSubstituteConfirm(vimBuffer.SubstituteConfirmMode); break; default: status = string.Empty; break; } return(status); }
public virtual void GoNext(IMode context) { }
private void startToken(IMode mode) { _mode = mode; _characters = new List<char>(); }
/// <summary> /// Constructor /// </summary> /// <param name="mode"> /// The mode settings. /// </param> /// <param name="genericKeys"> /// The new generic keys setting. /// </param> public ChangeGenericKeys(IMode mode, bool genericKeys) { _mode = mode; _genericKeys = genericKeys; }
private void Create2( ModeKind kind = ModeKind.VisualCharacter, params string[] lines) { _textView = CreateTextView(lines); _textBuffer = _textView.TextBuffer; var vimTextBuffer = Vim.CreateVimTextBuffer(_textBuffer); var vimBufferData = CreateVimBufferData(vimTextBuffer, _textView); _selection = _textView.Selection; _factory = new MockRepository(MockBehavior.Strict); _tracker = _factory.Create<ISelectionTracker>(); _tracker.Setup(x => x.Start()); _tracker.Setup(x => x.UpdateSelection()); _tracker.SetupGet(x => x.IsRunning).Returns(true); _operations = _factory.Create<ICommonOperations>(); _operations.SetupGet(x => x.TextView).Returns(_textView); _commandUtil = _factory.Create<ICommandUtil>(); var motionUtil = new MotionUtil(vimBufferData); var capture = new MotionCapture(vimBufferData, new IncrementalSearch(vimBufferData, _operations.Object)); var runner = new CommandRunner( _textView, Vim.RegisterMap, capture, _commandUtil.Object, (new Mock<IStatusUtil>()).Object, VisualKind.Character); _modeRaw = new VisualMode(vimBufferData, _operations.Object, motionUtil, kind, runner, capture, _tracker.Object); _mode = _modeRaw; _mode.OnEnter(ModeArgument.None); }
private void PushMode([NotNull] IMode mode) { Debug.ArgumentNotNull(mode, nameof(mode)); stack.Push(mode); }
private static string GetStatusCommon(IVimBuffer vimBuffer, IMode currentMode) { // Calculate the argument string if we are in one time command mode string oneTimeArgument = null; if (vimBuffer.InOneTimeCommand.IsSome()) { if (vimBuffer.InOneTimeCommand.Is(ModeKind.Insert)) { oneTimeArgument = "insert"; } else if (vimBuffer.InOneTimeCommand.Is(ModeKind.Replace)) { oneTimeArgument = "replace"; } } // Check if we can enable the command line to accept user input var search = vimBuffer.IncrementalSearch; string status; switch (currentMode.ModeKind) { case ModeKind.Normal: status = String.IsNullOrEmpty(oneTimeArgument) ? String.Empty : String.Format(Resources.NormalOneTimeCommandBanner, oneTimeArgument); break; case ModeKind.Command: status = ":" + vimBuffer.CommandMode.Command; break; case ModeKind.Insert: status = Resources.InsertBanner; break; case ModeKind.Replace: status = Resources.ReplaceBanner; break; case ModeKind.VisualBlock: status = String.IsNullOrEmpty(oneTimeArgument) ? Resources.VisualBlockBanner : String.Format(Resources.VisualBlockOneTimeCommandBanner, oneTimeArgument); break; case ModeKind.VisualCharacter: status = String.IsNullOrEmpty(oneTimeArgument) ? Resources.VisualCharacterBanner : String.Format(Resources.VisualCharacterOneTimeCommandBanner, oneTimeArgument); break; case ModeKind.VisualLine: status = String.IsNullOrEmpty(oneTimeArgument) ? Resources.VisualLineBanner : String.Format(Resources.VisualLineOneTimeCommandBanner, oneTimeArgument); break; case ModeKind.SelectBlock: status = Resources.SelectBlockBanner; break; case ModeKind.SelectCharacter: status = Resources.SelectCharacterBanner; break; case ModeKind.SelectLine: status = Resources.SelectLineBanner; break; case ModeKind.ExternalEdit: status = Resources.ExternalEditBanner; break; case ModeKind.Disabled: status = vimBuffer.DisabledMode.HelpMessage; break; case ModeKind.SubstituteConfirm: status = GetStatusSubstituteConfirm(vimBuffer.SubstituteConfirmMode); break; default: status = String.Empty; break; } return status; }
private void UnapplyMode([NotNull] IMode mode) { Debug.ArgumentNotNull(mode, nameof(mode)); mode.IsReadyChanged -= IsReady; }
private void OnSwitchMode(object sender, IMode mode) { if (_inKeyInputEvent) { _modeSwitch = mode; } else { UpdateForSwitchMode(mode); } }
public void ModeChanged(IMode newMode) { }
public void Create2( ModeKind kind = ModeKind.VisualCharacter, params string[] lines) { _textView = EditorUtil.CreateTextView(lines); _textBuffer = _textView.TextBuffer; _selection = _textView.Selection; _factory = new MockRepository(MockBehavior.Strict); _map = VimUtil.CreateRegisterMap(MockObjectFactory.CreateClipboardDevice(_factory).Object); _markMap = new MarkMap(new TrackingLineColumnService()); _tracker = _factory.Create<ISelectionTracker>(); _tracker.Setup(x => x.Start()); _tracker.Setup(x => x.ResetCaret()); _tracker.Setup(x => x.UpdateSelection()); _jumpList = _factory.Create<IJumpList>(MockBehavior.Loose); _undoRedoOperations = _factory.Create<IUndoRedoOperations>(); _foldManager = _factory.Create<IFoldManager>(); _editorOperations = _factory.Create<IEditorOperations>(); _operations = _factory.Create<ICommonOperations>(); _operations.SetupGet(x => x.UndoRedoOperations).Returns(_undoRedoOperations.Object); _operations.SetupGet(x => x.EditorOperations).Returns(_editorOperations.Object); _operations.SetupGet(x => x.TextView).Returns(_textView); _host = _factory.Create<IVimHost>(MockBehavior.Loose); _commandUtil = _factory.Create<ICommandUtil>(); _incrementalSearch = MockObjectFactory.CreateIncrementalSearch(factory: _factory); var globalSettings = new GlobalSettings(); var localSettings = new LocalSettings(globalSettings, EditorUtil.GetEditorOptions(_textView), _textView); var motionUtil = VimUtil.CreateTextViewMotionUtil( _textView, _markMap, localSettings); _bufferData = MockObjectFactory.CreateVimBuffer( _textView, "test", MockObjectFactory.CreateVim(_map, host: _host.Object, settings: globalSettings).Object, incrementalSearch: _incrementalSearch.Object, jumpList: _jumpList.Object, motionUtil: motionUtil); var capture = new MotionCapture( _host.Object, _textView, _incrementalSearch.Object, localSettings); var runner = new CommandRunner( _textView, _map, capture, _commandUtil.Object, (new Mock<IStatusUtil>()).Object, VisualKind.Character); _modeRaw = new VisualMode(_bufferData.Object, _operations.Object, kind, runner, capture, _tracker.Object); _mode = _modeRaw; _mode.OnEnter(ModeArgument.None); }
public void RaiseSwitchedMode(IMode mode) { RaiseSwitchedMode(new SwitchModeEventArgs(mode, mode)); }
private void OnSwitchMode(object sender, SwitchModeEventArgs args) { if (_inKeyInputEvent) { _modeSwitch = args.CurrentMode; } else { UpdateForSwitchMode(args.CurrentMode); } }
public virtual void SetActiveMode([NotNull] IMode mode) { Assert.ArgumentNotNull(mode, nameof(mode)); }
public override void DoChecks(Data.IProject project, Ares.ModelInfo.IModelErrors errors, CancellationToken ct) { System.Windows.Forms.KeysConverter converter = new System.Windows.Forms.KeysConverter(); for (int i = 0; i < project.GetModes().Count; ++i) { IMode mode = project.GetModes()[i]; // check: no empty key if (mode.KeyCode == 0) { /* * AddError(errors, ModelError.ErrorSeverity.Warning, * String.Format(StringResources.ModeNoKey, mode.Title), mode); */ } else { // check: no globally reserved key if (s_GlobalReservedKeys.ContainsKey(mode.KeyCode)) { AddError(errors, Ares.ModelInfo.ModelError.ErrorSeverity.Error, String.Format(StringResources.ModeKeyGloballyReserved, converter.ConvertToString((System.Windows.Forms.Keys)mode.KeyCode)), mode); } // check: key not used by another mode for (int j = i + 1; j < project.GetModes().Count; ++j) { if (project.GetModes()[j].KeyCode == mode.KeyCode) { AddError(errors, Ares.ModelInfo.ModelError.ErrorSeverity.Error, String.Format(StringResources.DuplicateModeKey, converter.ConvertToString((System.Windows.Forms.Keys)mode.KeyCode), mode.Title, project.GetModes()[j].Title), mode); } } } // check mode elements for (int j = 0; j < mode.GetElements().Count; ++j) { IModeElement modeElement = mode.GetElements()[j]; // get key code, if there is one int keyCode = 0; if (modeElement.Trigger != null) { if (modeElement.Trigger.TriggerType == TriggerType.Key) { keyCode = ((IKeyTrigger)modeElement.Trigger).KeyCode; } else { // no key trigger, no checks continue; } } // check: no empty key if (keyCode == 0) { /* * AddError(errors, ModelError.ErrorSeverity.Warning, * String.Format(StringResources.ModeElementNoKey, modeElement.Title), modeElement); */ } else { // check: no globally reserved key if (s_GlobalReservedKeys.ContainsKey(keyCode)) { AddError(errors, Ares.ModelInfo.ModelError.ErrorSeverity.Error, String.Format(StringResources.ModeElementKeyGloballyReserved, converter.ConvertToString((System.Windows.Forms.Keys)keyCode)), modeElement); } // check: key not used by a mode for (int k = 0; k < project.GetModes().Count; ++k) { if (project.GetModes()[k].KeyCode == keyCode) { AddError(errors, Ares.ModelInfo.ModelError.ErrorSeverity.Error, String.Format(StringResources.ModeElementKeyUsedByMode, converter.ConvertToString((System.Windows.Forms.Keys)keyCode), modeElement.Title, project.GetModes()[k].Title), modeElement); } } // check: key not used by another element in the same mode for (int k = j + 1; k < mode.GetElements().Count; ++k) { IModeElement other = mode.GetElements()[k]; if (other.Trigger != null && other.Trigger.TriggerType == TriggerType.Key) { if (((IKeyTrigger)other.Trigger).KeyCode == keyCode) { AddError(errors, Ares.ModelInfo.ModelError.ErrorSeverity.Error, String.Format(StringResources.DuplicateModeElementKey, converter.ConvertToString((System.Windows.Forms.Keys)keyCode), modeElement.Title, other.Title), modeElement); } } } } ct.ThrowIfCancellationRequested(); } } }
public TokenParser() { _mode = new Searching(this); }
private void startToken(IMode mode) { _mode = mode; _characters = new List <char>(); }
public void RaiseSwitchedMode(IMode mode) { RaiseSwitchedMode(new SwitchModeEventArgs(FSharpOption<IMode>.None, mode)); }
/// <summary> /// Constructor /// </summary> /// <param name="mode"> /// The mode settings. /// </param> /// <param name="guaranteedBossItems"> /// The new guaranteed boss items setting. /// </param> public ChangeGuaranteedBossItems(IMode mode, bool guaranteedBossItems) { _mode = mode; _guaranteedBossItems = guaranteedBossItems; }