Example #1
0
 public UndoRedoHistory(int capacity, MapForm s)
 {
     this.capacity = capacity;
     this.undoStack = new CircularStack<Action>(this.capacity);
     this.redoStack = new CircularStack<Action>(this.capacity);
     this.subject = s;
 }
Example #2
0
 public override Action Restore(MapForm target)
 {
     MapEntity removed = entity;
     Action inverse = new EntityRemovedAction(layer, removed);
     target.RemoveEntity(layer, entity);
     return this;
 }
Example #3
0
 /// <summary>
 /// Restores the target
 /// </summary>
 /// <param name="target"></param>
 /// <returns></returns>
 public abstract Action Restore(MapForm target);
Example #4
0
        private void ShowNewForm(object sender, EventArgs e)
        {
            // Show the new map form
            NewMapForm newMapForm = new NewMapForm(childFormNumber++);
            newMapForm.Text = "New map";

            // Create a new instance of the child form.
            if (newMapForm.ShowDialog() == DialogResult.OK)
            {
                MapForm child = new MapForm();
                child.MdiParent = this;
                child.Text = newMapForm.MapName;
                child.MapData.Name = newMapForm.MapName;
                child.mapMouseMove += new MouseEventHandler(infoForm.MapMouseMove);
                child.mapMouseLeave += new EventHandler(infoForm.MapMouseLeave);
                child.mapViewportChange += new ViewportEventHandler(infoForm.MapViewportChange);
                child.mapMouseClick += new MouseEventHandler(toolboxForm.ExecuteClick);
                child.mapMouseMove += new MouseEventHandler(toolboxForm.ExecuteMove);
                child.onOpen += new ViewportEventHandler(infoForm.MapOpen);
                child.onFocus += new ViewportEventHandler(infoForm.MapOpen);
                child.onClose += new EventHandler(infoForm.MapClose);
                child.SetMapSize(newMapForm.MapWidth, newMapForm.MapHeight);
                child.Show();
            }
        }
Example #5
0
        private void OpenFile(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.InitialDirectory = Environment.CurrentDirectory;
            openFileDialog.Filter = FileTranslatorManager.BuildFileFilter();
            if (openFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                string FileName = openFileDialog.FileName;
                // TODO: Add code here to open the file.
                if (FileName != "")
                {
                    MapForm child = new MapForm();
                    child.MdiParent = this;
                    child.mapMouseMove += new MouseEventHandler(infoForm.MapMouseMove);
                    child.mapMouseLeave += new EventHandler(infoForm.MapMouseLeave);
                    child.mapViewportChange += new ViewportEventHandler(infoForm.MapViewportChange);
                    child.mapMouseClick += new MouseEventHandler(toolboxForm.ExecuteClick);
                    child.mapMouseMove += new MouseEventHandler(toolboxForm.ExecuteMove);
                    child.onOpen += new ViewportEventHandler(infoForm.MapOpen);
                    child.onFocus += new ViewportEventHandler(infoForm.MapOpen);
                    child.onClose += new EventHandler(infoForm.MapClose);

                    FileTranslatorManager.Import(FileName, child.MapData, false);

                    child.Text = FileName.Substring(FileName.LastIndexOf("\\") + 1);
                    child.SetMapSize(Convert.ToInt32(child.MapData.Width), Convert.ToInt32(child.MapData.Height));
                    child.Show();
                }
            }
        }
Example #6
0
 public override Action Restore(MapForm target)
 {
     Action inverse = new EntityAddedAction(layer, removed);
     target.AddEntity(layer, removed);
     return this;
 }