public TutorialButtonRow(Control c) { checkSolution = new CheckSolutionButton(c); undo = new UndoButton(c); statusField = new StatusField(c); float width = 300f; position = new Rect(Screen.width/2-width/2,Screen.height-110,width,40); }
//adds UI buttons respective listeners void InitializeButtonListeners() { AddButton.GetComponent <Button>().onClick.AddListener(AddButtonClicked); RemoveButton.GetComponent <Button>().onClick.AddListener(RemoveButtonClicked); UndoButton.GetComponent <Button>().onClick.AddListener(UndoButtonClicked); DoneButton.GetComponent <Button>().onClick.AddListener(DoneButtonClicked); return; }
public ButtonRow(Control c) { endturn = new EndTurnButton(c); statusField = new StatusField(c); undo = new UndoButton(c); float width = 300f; position = new Rect(Screen.width/2-width/2,Screen.height-110,width,40); }
private ButtonRow(IGUIMessages receiver) { this.receiver = receiver; endturn = new EndTurnButton(receiver); statusField = new StatusField(); undo = new UndoButton(receiver); float width = 300f; position = new Rect(Screen.width/2-width/2,Screen.height-110,width,40); }
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) // Save spreadsheet using CTRL+S { if (keyData != (Keys.Control | Keys.Z)) { return(false); } UndoButton.Select(); return(true); }
private void ImportButton_Click(object sender, EventArgs e) { if (!File.Exists(SRCFilename.Text)) { SRCSelectButton_Click(sender, e); } string EAFilename = SRCFilename.Text; if (!File.Exists(SRCFilename.Text)) { return; } if (this.AutoReCompile.Checked) {//自動コンパイル string error = RunAutoReCompile(EAFilename); if (error != "") { R.ShowStopError(error); return; } } Undo.UndoData undodata = Program.Undo.NewUndoData(this); try { uint freearea = (uint)FREEAREA.Value; if (!this.FREEAREA_DEF.Checked) {//フリーエリアを利用しない. freearea = 0; } SymbolUtil.DebugSymbol storeSymbol = (SymbolUtil.DebugSymbol)(DebugSymbolComboBox.SelectedIndex); WriteEA(EAFilename, freearea, U.NOT_FOUND, undodata, storeSymbol); } catch (PatchForm.PatchException exception) { Program.Undo.Rollback(undodata); R.ShowStopError(exception.Message); return; } Program.Undo.Push(undodata); InputFormRef.ShowWriteNotifyAnimation(this, 0); UndoButton.Show(); // U.ForceUpdate(FREEAREA, InputFormRef.AllocBinaryData(1024 * 1024)); //とりあえず1MBの空きがあるところ. }
public void CreateUi() { var copyButton = new CopyButton(); copyButton.SetCommand(Execute(new CopyCommand(_activeEditor, this))); var cutButton = new CutButton(); cutButton.SetCommand(Execute(new CutCommand(_activeEditor, this))); var pasteButton = new PasteButton(); pasteButton.SetCommand(Execute(new PasteCommand(_activeEditor, this))); var undoButton = new UndoButton(); undoButton.SetCommand(Execute(new UndoCommand(_activeEditor, this))); }
public void Layout() { var x = (nfloat)XMargin; var withMargin = true; var size = Frame.Height - 2 * Margin; if (size <= 0) { size = Frame.Height; withMargin = false; } var y = withMargin ? Margin : 0; UndoButton.Frame = new CGRect(x, 0, 10, 10); Add(UndoButton); UndoButton.SizeToFit(); x += UndoButton.Frame.Width + XMargin; var i = 0; var currentColor = Context.SelectedColor; foreach (var colorVm in Context.PaletteColors) { var colorView = new PaletteColorView { DataContext = colorVm }; if (colorVm == currentColor || (i == 0 && currentColor == null)) { if (colorVm != null) { colorVm.IsSelected = true; } } colorView.Frame = new CGRect(x, y, size, size); Add(colorView); x += size + XMargin; if (x >= Frame.Width - size - XMargin) { break; } i++; } ThicknessSlider.Frame = new CGRect(x, y, Frame.Width - XMargin - x, size); Add(ThicknessSlider); }
private void UndoButton_Click(object sender, EventArgs e) { string text = R._("最後の動作を取り消してよろしいですか?"); string title = R._("UNDO確認"); DialogResult r = MessageBox.Show(text , title , MessageBoxButtons.YesNo , MessageBoxIcon.Exclamation); if (r != System.Windows.Forms.DialogResult.Yes) { return; } Program.Undo.RunUndo(); //操作の取り消し UndoButton.Hide(); InputFormRef.ShowWriteNotifyAnimation(this, 0); }
public void Initialize <TState>(ReduxStore <TState> store) where TState : class, new() { if (store.TimeTravelEnabled) { // TODO : Cannot activate History component } // Observe UI events UndoButton.Events().Click .Subscribe(_ => store.Undo()); RedoButton.Events().Click .Subscribe(_ => store.Redo()); ResetButton.Events().Click .Subscribe(_ => store.Reset()); PlayPauseButton.Events().Click .Subscribe(_ => _internalStore.Dispatch(new TogglePlayPauseAction())); Slider.Events().ValueChanged .Where(_ => Slider.FocusState != FocusState.Unfocused) .Subscribe(e => { int newPosition = (int)e.NewValue; _internalStore.Dispatch(new MoveToPositionAction { Position = newPosition }); }); // Observe changes on internal state _internalStore.Select(state => state.MaxPosition) .Subscribe(maxPosition => { Slider.Maximum = maxPosition; }); Observable.CombineLatest( _internalStore.Select(state => state.CurrentPosition), _internalStore.Select(state => state.PlaySessionActive), _internalStore.Select(state => state.MaxPosition), store.ObserveCanUndo(), store.ObserveCanRedo(), Tuple.Create ) .ObserveOnDispatcher() .Subscribe(x => { var(currentPosition, playSessionActive, maxPosition, canUndo, canRedo) = x; Slider.Value = currentPosition; if (playSessionActive) { UndoButton.IsEnabled = false; RedoButton.IsEnabled = false; ResetButton.IsEnabled = false; PlayPauseButton.IsEnabled = true; Slider.IsEnabled = false; PlayPauseButton.Content = "\xE769"; } else { UndoButton.IsEnabled = canUndo; RedoButton.IsEnabled = canRedo; ResetButton.IsEnabled = canUndo || canRedo; PlayPauseButton.IsEnabled = canRedo; Slider.IsEnabled = maxPosition > 0; PlayPauseButton.Content = "\xE768"; } }); _internalStore.ObserveAction <MoveToPositionAction>() .Subscribe(a => { if (a.Position < _internalStore.State.CurrentPosition) { for (int i = 0; i < _internalStore.State.CurrentPosition - a.Position; i++) { store.Undo(); } } if (a.Position > _internalStore.State.CurrentPosition) { for (int i = 0; i < a.Position - _internalStore.State.CurrentPosition; i++) { store.Redo(); } } }); // Observe changes on listened state var goForwardNormalActionOrigin = store.ObserveAction() .Select(action => new { Action = action, BreaksTimeline = true }); var goForwardRedoneActionOrigin = store.ObserveAction(ActionOriginFilter.Redone) .Select(action => new { Action = action, BreaksTimeline = false }); goForwardNormalActionOrigin.Merge(goForwardRedoneActionOrigin) .ObserveOnDispatcher() .Subscribe(x => { _internalStore.Dispatch(new GoForwardAction { Action = x.Action, BreaksTimeline = x.BreaksTimeline }); if (_internalStore.State.PlaySessionActive && !store.CanRedo) { _internalStore.Dispatch(new TogglePlayPauseAction()); } }); store.ObserveUndoneAction() .ObserveOnDispatcher() .Subscribe(_ => _internalStore.Dispatch(new GoBackAction())); store.ObserveReset() .ObserveOnDispatcher() .Subscribe(_ => _internalStore.Dispatch(new ResetAction())); _internalStore.Select(state => state.PlaySessionActive) .Select(playSessionActive => playSessionActive ? Observable.Interval(TimeSpan.FromSeconds(1)) : Observable.Empty <long>() ) .Switch() .ObserveOnDispatcher() .Subscribe(_ => { bool canRedo = store.Redo(); if (!canRedo) { _internalStore.Dispatch(new TogglePlayPauseAction()); } }); // Track redux actions _internalStore.ObserveAction() .Subscribe(action => { TrackReduxAction(action); }); }
// Start is called before the first frame update private void Awake() { current = this; }
/*Následují opět tlačítka z panelu nástrojů s vypsanou funkcí, * jsou zde funkce pracující s textem tj, Copy, Paste atp. Tlačítka * jsou k nalezenív rozklikávacím menu Edit. Je to následujících 6 metod.*/ private void undoToolStripMenuItem_Click(object sender, EventArgs e) { UndoButton.PerformClick(); }
internal void Initialize <TState>(ReduxStore <TState> store) where TState : class, new() { // Observe UI events UndoButton.Events().Click .Subscribe(_ => store.Undo()); RedoButton.Events().Click .Subscribe(_ => store.Redo()); ResetButton.Events().Click .Subscribe(_ => store.Reset()); PlayPauseButton.Events().Click .Subscribe(_ => _devToolsStore.Dispatch(new TogglePlayPauseAction())); Slider.Events().ValueChanged .Where(_ => Slider.FocusState != Windows.UI.Xaml.FocusState.Unfocused) .Select(e => (int)e.NewValue) .DistinctUntilChanged() .Subscribe(newPosition => { _devToolsStore.Dispatch(new MoveToPositionAction { Position = newPosition }); }); ReduxActionInfosListView.Events().ItemClick .Subscribe(e => { int index = ReduxActionInfosListView.Items.IndexOf(e.ClickedItem); _devToolsStore.Dispatch(new SelectPositionAction { Position = index }); }); // Observe changes on DevTools state Observable.CombineLatest( _devToolsStore.Select(SelectCurrentPosition), _devToolsStore.Select(SelectPlaySessionActive), _devToolsStore.Select(SelectMaxPosition), store.ObserveCanUndo(), store.ObserveCanRedo(), Tuple.Create ) .Subscribe(x => { var(currentPosition, playSessionActive, maxPosition, canUndo, canRedo) = x; Slider.Value = currentPosition; Slider.Maximum = maxPosition; if (playSessionActive) { UndoButton.IsEnabled = false; RedoButton.IsEnabled = false; ResetButton.IsEnabled = false; PlayPauseButton.IsEnabled = true; Slider.IsEnabled = false; PlayPauseButton.Content = "\xE769"; } else { UndoButton.IsEnabled = canUndo; RedoButton.IsEnabled = canRedo; ResetButton.IsEnabled = canUndo || canRedo; PlayPauseButton.IsEnabled = canRedo; Slider.IsEnabled = maxPosition > 0; PlayPauseButton.Content = "\xE768"; } }); _devToolsStore.Select( CombineSelectors(SelectCurrentActions, SelectSelectedActionPosition) ) .Subscribe(x => { var(actions, selectedPosition) = x; ReduxActionInfosListView.ItemsSource = actions; ReduxActionInfosListView.SelectedIndex = Math.Clamp(selectedPosition, -1, actions.Count - 1); }); _devToolsStore.Select(SelectSelectedReduxAction) .Subscribe(reduxActionOption => { reduxActionOption.Match() .Some().Do(reduxAction => { var serializerSettings = new JsonSerializerSettings { ContractResolver = SuccinctContractResolver.Instance, ReferenceLoopHandling = ReferenceLoopHandling.Ignore, Formatting = Formatting.Indented }; SelectedReduxActionDataTextBlock.Text = JsonConvert.SerializeObject( reduxAction.Data, serializerSettings ); SelectedStateTextBlock.Text = JsonConvert.SerializeObject( reduxAction.NextState, serializerSettings ); SelectedDiffStateTextBlock.Text = "This feature will be available soon..."; }) .None().Do(() => { SelectedReduxActionDataTextBlock.Text = string.Empty; SelectedStateTextBlock.Text = string.Empty; SelectedDiffStateTextBlock.Text = string.Empty; }) .Exec(); }); _devToolsStore.ObserveAction <MoveToPositionAction>() .WithLatestFrom( _devToolsStore.Select(SelectCurrentPosition), Tuple.Create ) .Subscribe(x => { var(action, currentPosition) = x; if (action.Position < currentPosition) { for (int i = 0; i < currentPosition - action.Position; i++) { store.Undo(); } } if (action.Position > currentPosition) { for (int i = 0; i < action.Position - currentPosition; i++) { store.Redo(); } } }); _devToolsStore.Select(SelectPlaySessionActive) .Select(playSessionActive => playSessionActive ? Observable.Interval(TimeSpan.FromSeconds(1)) : Observable.Empty <long>() ) .Switch() .ObserveOnDispatcher() .Subscribe(_ => { bool canRedo = store.Redo(); if (!canRedo) { _devToolsStore.Dispatch(new TogglePlayPauseAction()); } }); // Observe changes on listened state var storeHistoryAtInitialization = store.GetHistory(); store.ObserveHistory() .StartWith(storeHistoryAtInitialization) .Subscribe(historyInfos => { var mementosOrderedByDate = historyInfos.PreviousStates .OrderBy(reduxMemento => reduxMemento.Date) .ToList(); // Set list of current actions // Set list of future (undone) actions _devToolsStore.Dispatch(new HistoryUpdated { CurrentActions = mementosOrderedByDate .Select((reduxMemento, index) => { int nextIndex = index + 1; var nextState = nextIndex < mementosOrderedByDate.Count ? mementosOrderedByDate[nextIndex].PreviousState : store.State; return(new ReduxActionInfo { Date = reduxMemento.Date, Type = reduxMemento.Action.GetType(), Data = reduxMemento.Action, PreviousState = reduxMemento.PreviousState, NextState = nextState }); }) .ToImmutableList(), FutureActions = historyInfos.FutureActions .Select(action => { return(new ReduxActionInfo { Type = action.GetType(), Data = action }); }) .ToImmutableList() }); }); _devToolsStore.Dispatch( new SelectPositionAction { Position = storeHistoryAtInitialization.PreviousStates.Count - 1 } ); }
private void Awake() { instance = this; }
private void UndoFocus_MouseUp(object sender, MouseEventArgs e) { UndoButton.Focus(); }
internal void UpdateUndo(bool canUndo) { UndoButton.SetTitleColor(canUndo ? UIColor.White : UIColor.LightGray, UIControlState.Normal); }