Example #1
0
 private static string Search(string criteria, ICommandHistory history)
 {
     StringBuilder sb = new StringBuilder();
     history.GetMatching(criteria).ForEach(record => sb.AppendLine(record));
     sb.AppendLine("");
     return sb.ToString();
 }
Example #2
0
 public MoveCommand(IGame game, Direction direction, IManipulator manipulator, ICommandHistory history)
 {
     _game        = game;
     _direction   = direction;
     _manipulator = manipulator;
     _history     = history;
 }
Example #3
0
		public ResGroupEditor(IEditorEnvironment editorEnvironment, ICommandHistory history)
		{
			this.editorEnvironment = editorEnvironment;
			this.history = history;
			this.AutoSize = true;
			this.Padding = new Padding(10);

			this.SuspendLayout();

			this.split = new SplitContainer { Dock = DockStyle.Fill };
			this.split.Panel2Collapsed = true;
			this.Controls.Add(this.split);

			var sp = new StackPanel { Dock = DockStyle.Fill, AutoSize = true };
			this.split.Panel1.Controls.Add(sp);

			var collectionView = new CollectionView<IResourceFile>(a => editorEnvironment.EditorFor(a, history))
				{ AutoSize = true };
			collectionView.ItemsPanel.AutoSize = true;
			collectionView.ItemsPanel.AutoScroll = false;
			new PropertyBinding<ResGroup, IList<IResourceFile>>(collectionView, this.dataContext, m => m.ExternalResources, null);
			sp.Controls.Add(collectionView);

			var embCollectionView = new CollectionView<Managed>(a => this.CreateButtonForResource(a)) { AutoSize = true };
			embCollectionView.ItemsPanel.AutoSize = true;
			embCollectionView.ItemsPanel.AutoScroll = false;
			new PropertyBinding<ResGroup, IList<Managed>>(embCollectionView, this.dataContext, m => m.EmbeddedResources, null);
			sp.Controls.Add(embCollectionView);

			this.ResumeLayout();
			this.PerformLayout();
		}
Example #4
0
 public MenuEntry(ICommandHistory commandHistory, string name, Keys shortcutKeys)
 {
     CommandHistory = commandHistory;
     Name           = name;
     ShortcutKeys   = shortcutKeys;
     Enabled        = true;
 }
Example #5
0
        public CommandInputForm(ICommandProvider commandProvider, ICommandHistory history)
        {
            InitializeComponent();
            Width = Screen.PrimaryScreen.Bounds.Width;
            Font = new Font(Gentium.FontFamily, 30, FontStyle.Regular);

            DoubleBuffered = true;
            SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);

            _commandProvider = commandProvider;
            _commandHistory = history;
            _historicCommand = _commandHistory.GetEnumerator();

            _backBrush = new SolidBrush(BackColor);
            _foreBrush = new SolidBrush(Color.FromArgb(255, 10, 40));

            _dropDownForm = new DropDownForm();
            _dropDownForm.Font = Font;
            _dropDownForm.Top = Bottom;

            _mouseHook = new MouseHook();
            _mouseHook.MouseMove += new MouseMoveEventHandler(OnMouseMove);
            _mouseHook.MouseClick += new MouseClickEventHandler(Cancel);

            _inputTextBox.TextChanged += delegate { OnInputChanged(); };
            _inputTextBox.SelectionChanged += delegate { OnInputChanged(); };

            MakeForeground();
        }
Example #6
0
        public UndoMenuEntry(ICommandHistory commandHistory)
            : base(commandHistory, string.Format("Undo {0}", commandHistory.PreviousCommand), Keys.Control | Keys.Z)
        {
            var prevCommand = commandHistory.PreviousCommand;

            Enabled = prevCommand != null && prevCommand.HasUndo;
        }
Example #7
0
 public TLViewBase(TLModelBase model, TLViewBase parent)
 {
     FGroup.Transforms = new SvgTransformCollection();
     Parent            = parent;
     Model             = model;
     History           = Model.Mapper.Map <ICommandHistory>();
     FGroup.ID         = GetGroupID();
 }
 public DropObjectCommand(
     ICommandHistory commandHistory,
     IVariables variables,
     IObjectDroppedAction objectDropped)
 {
     _commandHistory = commandHistory;
     _variables      = variables;
     _objectDropped  = objectDropped;
 }
Example #9
0
		public ShaderEditor(IEditorEnvironment editorEnvironment, ICommandHistory history, IComponentContext context)
		{
			this.editorEnvironment = editorEnvironment;
			this.history = history;
			this.context = context;
			this.InitializeComponent();

			this.InitializeEditor();
		}
Example #10
0
        private static string List(ICommandHistory history)
        {
            StringBuilder sb = new StringBuilder();
            List<string> records = history.Records;

            records.ForEach(record => sb.AppendLine(record));
            sb.AppendLine("");
            sb.AppendLine(String.Format("{0} entries in history", records.Count));

            return sb.ToString();
        }
        public void SetUp()
        {
            _mocks = new MockRepository();

            _view = new AutoCompleteView();
            _attachedTo = new Control();
            _commandHistory = _mocks.DynamicMock<ICommandHistory>();
            _presenter = new AutoCompletePresenter(_view, _attachedTo, _commandHistory);

            _presenter.Init();
        }
Example #12
0
		public ResourceFileEditor(IEditorEnvironment editorEnvironment, IResourceManager resourceManager, TextResourceWriter textResourceWriter)
		{
			this.history = new CommandHistory();
			this.editorEnvironment = editorEnvironment;
			this.resourceManager = resourceManager;
			this.textResourceWriter = textResourceWriter;
			this.history.PropertyChanged += this.NotifyHistoryChanged;
			this.InitializeComponent();
			this.InitializeEditor();
			this.Dock = DockStyle.Fill;
		}
Example #13
0
        public Controller(IGameCreator gameCreator, IManipulator manipulator, ICommandHistory history,
                          ICommandManager commandManager, IGameMessageHolder gameMessageHolder, IConsoleManager console)
        {
            gameCreator.NotifyOnGameCreated     += OnNewGameCreated;
            manipulator.NotifyOnPlayfieldChange += OnPlayfieldChanged;

            _history           = history;
            _commandManager    = commandManager;
            _gameMessageHolder = gameMessageHolder;
            _console           = console;
        }
		public EditResourceReferenceView(
			IEditorEnvironment editorEnvironment,
			IResourceManager resourceManager,
			ICommandHistory history,
			IComponentContext context,
			bool fileReferencesAllowed)
			: this()
		{
			this.editorEnvironment = editorEnvironment;
			this.resourceManager = resourceManager;
			this.history = history;
			this.context = context;
			this.fileReferencesAllowed = fileReferencesAllowed;
		}
Example #15
0
		public IView EditorFor(object itemToEdit, ICommandHistory history)
		{
			var typedParameters = new Parameter[] { TypedParameter.From(history) };
			IView view = this.context.ResolveOptionalKeyed<IView>(itemToEdit.GetType(), typedParameters);
			if (view != null)
			{
				return view;
			}
			view = this.context.ResolveOptionalKeyed<IView>(itemToEdit.GetType().BaseType, typedParameters);
			if (view != null)
			{
				return view;
			}
			return new StringView();
		}
Example #16
0
		public GenericSceneEditor(
			IEditorEnvironment editorEnvironment,
			IComponentContext context,
			ToeGraphicsContext graphicsContext,
			IEditorOptions<Base3DEditorOptions> options)
		{
			this.editorEnvironment = editorEnvironment;
			this.context = context;
			this.graphicsContext = graphicsContext;
			this.options = options;
			this.history = new CommandHistory();
			this.InitializeComponent();

			this.InitializeEditor();
		}
Example #17
0
		public SkinEditor(
			IEditorEnvironment editorEnvironment,
			IResourceManager resourceManager,
			ICommandHistory history,
			ToeGraphicsContext graphicsContext,
			IComponentContext context)
		{
			this.editorEnvironment = editorEnvironment;
			this.resourceManager = resourceManager;
			this.history = history;
			this.graphicsContext = graphicsContext;
			this.context = context;
			this.InitializeComponent();

			this.InitializeEditor();
			this.base3DEditor1.RenderScene += this.RenderScene;
		}
Example #18
0
		public MaterialEditor(
			IEditorEnvironment editorEnvironment,
			IResourceManager resourceManager,
			ICommandHistory history,
			ToeGraphicsContext graphicsContext,
			IComponentContext context)
		{
			this.editorEnvironment = editorEnvironment;
			this.resourceManager = resourceManager;
			this.history = history;
			this.graphicsContext = graphicsContext;
			this.context = context;

			this.InitializeComponent();

			this.InitializeEditor();
		}
Example #19
0
		public ModelEditor(
			IEditorEnvironment editorEnvironment,
			IResourceManager resourceManager,
			IComponentContext context,
			ToeGraphicsContext graphicsContext,
			IEditorOptions<Base3DEditorOptions> options,
			ICommandHistory history)
		{
			this.editorEnvironment = editorEnvironment;
			this.resourceManager = resourceManager;
			this.context = context;
			this.graphicsContext = graphicsContext;
			this.options = options;
			this.history = history;
			this.dataContext.DataContextChanged += ResetModel;
			this.InitializeComponent();

			this.InitializeEditor();
		}
Example #20
0
 public RemoveMenuEntry(ICommandHistory commandHistory, TOwner owner, TItem item)
     : this(commandHistory, owner, item, "Remove")
 {
 }
Example #21
0
 public static void SetByCommand(this IEditableProperty property, object newValue, ICommandHistory history)
 {
     if (property.AcceptValueObject(newValue))
     {
         var command = Command.Set(property, newValue);
         history.Insert(command);
     }
 }
Example #22
0
 public SetPropertyMenuEntry(ICommandHistory commandHistory, IEditableProperty property)
     : base(commandHistory, "Change Value")
 {
     Property = property;
 }
Example #23
0
 public LoadMenuEntry(ICommandHistory history, IPersistent persistent, ILogger logger)
     : base(history, "Open")
 {
     FPersistent = persistent;
     FLogger     = logger;
 }
Example #24
0
 public ShellState(ICommandDispatcher commandDispatcher, ISuggestionManager suggestionManager = null, IInputManager inputManager = null, ICommandHistory commandHistory = null, IConsoleManager consoleManager = null)
 {
     InputManager      = inputManager ?? new InputManager();
     CommandHistory    = commandHistory ?? new CommandHistory();
     ConsoleManager    = consoleManager ?? new ConsoleManager();
     CommandDispatcher = commandDispatcher;
     SuggestionManager = suggestionManager ?? new SuggestionManager();
 }
Example #25
0
 public ReferencesViewProvider(IProject project, IEditableIDList <IReference> references)
 {
     FProject        = project;
     FReferences     = references;
     FCommandHistory = FReferences.Mapper.Map <ICommandHistory>();
 }
Example #26
0
 public RenameMenuEntry(ICommandHistory commandHistory, IRenameable renameable)
     : this(commandHistory, renameable, null)
 {
 }
Example #27
0
 public ReferenceProvider(ICommandHistory history)
 {
     FHistory = history;
 }
Example #28
0
 public RemoveMenuEntry(ICommandHistory commandHistory, TOwner owner, TItem item, string name)
     : base(commandHistory, name, Keys.Delete)
 {
     FOwner = owner;
     FItem  = item;
 }
Example #29
0
 public AddMenuEntry(ICommandHistory commandHistory)
     : base(commandHistory, "Add")
 {
 }
Example #30
0
        public TimelineView(TLDocument tl, ICommandHistory history, Timer timer)
        {
            History = history;
            History.CommandInserted += History_Changed;
            History.Undone          += History_Changed;
            History.Redone          += History_Changed;

            Document = tl;
            Timer    = timer;

            //replace id manager before any svg element was added
            var caller  = Document.Mapper.Map <ISvgEventCaller>();
            var manager = new SvgIdManager(SvgRoot, caller, Document.Mapper.Map <RemoteContext>());

            SvgRoot.ID = "svg";
            SvgRoot.OverwriteIdManager(manager);

            Background.Width   = new SvgUnit(SvgUnitType.Percentage, 100);
            Background.Height  = 500;
            Background.ID      = Document.GetID() + "_Background";
            Background.Opacity = 0;

            Background.MouseDown += Default_MouseDown;
            Background.MouseMove += Default_MouseMove;
            Background.MouseUp   += Default_MouseUp;

            Selection.ID = "Selection";
            Selection.CustomAttributes["pointer-events"] = "none";
            Selection.CustomAttributes["class"]          = "selection";

            Ruler = new RulerView(Document.Ruler, this);

            MouseTimeLine.ID     = "MouseTime";
            MouseTimeLine.StartX = 0;
            MouseTimeLine.StartY = 0;
            MouseTimeLine.EndX   = 0;

            TimeBar.ID         = "Timebar";
            TimeBar.Y          = -Ruler.Height;
            TimeBar.X          = -1;
            TimeBar.Width      = 2;
            TimeBar.MouseDown += Default_MouseDown;
            TimeBar.MouseMove += Default_MouseMove;
            TimeBar.MouseUp   += Default_MouseUp;

            MainMenu    = new SvgMenuWidget(120);
            MainMenu.ID = "MainMenu";

            var addValueTrack = new SvgButtonWidget(0, 20, "Add Value Track");

            addValueTrack.ValueChanged += AddValueTrack;

            var addStringTrack = new SvgButtonWidget(0, 20, "Add String Track");

            addStringTrack.ValueChanged += AddStringTrack;

            MainMenu.AddItem(addValueTrack, 0);
            MainMenu.AddItem(addStringTrack, 1);

            FRulerGroup.ID = "Ruler";
            FRulerGroup.CustomAttributes["class"] = "fixed";
            FRulerGroup.Transforms = new SvgTransformCollection();
            FRulerGroup.Transforms.Add(new SvgTranslate(0, 0));

            FTrackGroup.ID            = "Tracks";
            FTrackGroup.Transforms    = new SvgTransformCollection();
            FOverlaysGroup.ID         = "Overlays";
            FOverlaysGroup.Transforms = new SvgTransformCollection();

            //initialize svg tree
            BuildSVGRoot();

            Syncer = Tracks.SyncWith(Document.Tracks,
                                     tm =>
            {
                TrackView tv;
                if (tm is TLValueTrack)
                {
                    tv = new ValueTrackView(tm as TLValueTrack, this, Ruler);
                }
                else if (tm is TLStringTrack)
                {
                    tv = new StringTrackView(tm as TLStringTrack, this, Ruler);
                }
                else
                {
                    tv = new AudioTrackView(tm as TLAudioTrack, this, Ruler);
                }

                if (ActiveTrack == null)
                {
                    ActiveTrack = tv;
                }
                tv.AddToSceneGraphAt(FTrackGroup);

                //update Order on all tracks below the one added
                var order = tv.Model.Order.Value;
                foreach (var track in Tracks.Where(x => x.Model.Order.Value >= order))
                {
                    track.Model.Order.Value += 1;
                }

                return(tv);
            },
                                     tv =>
            {
                var order = tv.Model.Order.Value;
                tv.Dispose();

                //update Order on all tracks below the one removed
                foreach (var track in Tracks.Where(x => x.Model.Order.Value > order))
                {
                    track.Model.Order.Value -= 1;
                }
            });
        }
Example #31
0
 public MenuEntry(ICommandHistory commandHistory, string name)
     : this(commandHistory, name, Keys.None)
 {
 }
Example #32
0
 public UndoCommand(ICommandHistory history)
 {
     _history = history;
 }
Example #33
0
 public RedoMenuEntry(ICommandHistory commandHistory)
     : base(commandHistory, string.Format("Redo {0}", commandHistory.NextCommand), Keys.Control | Keys.Y)
 {
     Enabled = commandHistory.NextCommand != null;
 }
Example #34
0
 public UnloadMenuEntry(ICommandHistory history, /*IPersistent persistent,*/ ILogger logger)
     : base(history, "Close")
 {
     //FPersistent = persistent;
     FLogger = logger;
 }
Example #35
0
 public RenameMenuEntry(ICommandHistory commandHistory, IRenameable renameable, ILabelEditor labelEditor)
     : base(commandHistory, "Rename", Keys.F2)
 {
     Renameable  = renameable;
     LabelEditor = labelEditor;
 }
Example #36
0
 public BoardWorker(IManipulator manipulator, ICommandHistory history)
 {
     _manipulator = manipulator;
     _history     = history;
 }
 public CommandManager(IGameCreator creator, IManipulator manipulator, ICommandHistory history)
 {
     _gameCreator = creator;
     _manipulator = manipulator;
     _history     = history;
 }
Example #38
0
 public AddReferenceMenuEntry(ICommandHistory history, IProject project, IEditableIDList <IReference> references)
     : base(history, "Reference", Keys.Control | Keys.N)
 {
     FProject    = project;
     FReferences = references;
 }