Exemplo n.º 1
0
            public void MouseMoveTile(MapEventInfo mei)
            {
                int _x0 = mei.start.tx;
                int _y0 = mei.start.ty;
                int _x1 = mei.current.tx;
                int _y1 = mei.current.ty;
                int x0  = Math.Min(_x0, _x1);
                int x1  = Math.Max(_x0, _x1);
                int y0  = Math.Min(_y0, _y1);
                int y1  = Math.Max(_y0, _y1);

                Map m = new Map();

                if (bMultilayer)
                {
                    m = mei.editedMap.tileCopyRange(x0, y0, x1 - x0 + 1, y1 - y0 + 1);
                }
                else
                {
                    MapLayer ml = mei.editedLayer.copyRange(x0, y0, x1 - x0 + 1, y1 - y0 + 1);
                    ml.parentmap = m;
                    m.AddLayer(ml);
                }
                m.IsBrush        = true;
                m.vsp            = mei.editedMap.vsp;
                Global.clipboard = m;
                mei.bDirty       = true;
            }
Exemplo n.º 2
0
            public void tweakMap(MapEventInfo mei)
            {
                if (Global.clipboard == null)
                {
                    return;
                }

                this.mei = mei;
                work(mei.current);
            }
Exemplo n.º 3
0
 public void MouseClick(MapEventInfo mei)
 {
     oldvalue = mei.getTile(mei.start.tx, mei.start.ty);
     newvalue = mei.tile;
     if (oldvalue != newvalue)
     {
         mei.opManager.beginGroup("Map: FloodFill");
         PrimitiveDrawer.FloodFill(mei.start.tx, mei.start.ty, new PrimitiveDrawer.CheckCallback(ccb), new PrimitiveDrawer.Callback(cb), mei);
         mei.opManager.endGroup();
     }
 }
Exemplo n.º 4
0
        public void MouseDown(MapEventInfo mei)
        {
            lastTile = mei.getTile(mei.current.tx, mei.current.ty);

            if (mei.lb)
            {
                mei.ltile = lastTile;
            }
            if (mei.rb)
            {
                mei.rtile = lastTile;
            }
        }
Exemplo n.º 5
0
            public void MouseUp(MapEventInfo mei)
            {
                if (Global.clipboard == null)
                {
                    return;
                }

                Global.opManager.beginGroup("Map: Clipboard Paste");
                this.mei = mei;
                work(mei.end);
                Global.opManager.endGroup();

                mei.bDirty = true;
            }
Exemplo n.º 6
0
        public void MouseMoveTile(MapEventInfo mei)
        {
            int tempTile = mei.getTile(mei.current.tx, mei.current.ty);

            if (tempTile != lastTile)
            {
                if (mei.lb)
                {
                    mei.ltile = tempTile;
                }
                if (mei.rb)
                {
                    mei.rtile = tempTile;
                }
            }
            lastTile = tempTile;
        }
Exemplo n.º 7
0
 protected virtual int getValue(MapEventInfo mei)
 {
     if (mei.editedLayer.type == LayerType.Tile || mei.editedLayer.type == LayerType.Obs || mei.editedLayer.type == LayerType.Zone)
     {
         if (mei.lb)
         {
             return(mei.ltile);
         }
         if (mei.rb)
         {
             return(mei.rtile);
         }
         //throw new Exception("wtf");
         return(0);
     }
     return(0);
 }
Exemplo n.º 8
0
            public void paintWindow(MapEventInfo mei, Graphics g)
            {
                int _x0 = (mei.start.tx * 16 - mei.xScroll);
                int _y0 = (mei.start.ty * 16 - mei.yScroll);
                int _x1 = (mei.current.tx * 16 - mei.xScroll);
                int _y1 = (mei.current.ty * 16 - mei.yScroll);
                int x0  = Math.Min(_x0, _x1);
                int x1  = Math.Max(_x0, _x1);
                int y0  = Math.Min(_y0, _y1);
                int y1  = Math.Max(_y0, _y1);

                x0 *= mei.zoom;
                x1 *= mei.zoom;
                y0 *= mei.zoom;
                y1 *= mei.zoom;
                System.Drawing.Rectangle r = new System.Drawing.Rectangle(x0, y0, x1 - x0 + mei.zoom * 16, y1 - y0 + mei.zoom * 16);


                Pen pen = new Pen(Color.White);

                pen.DashStyle = DashStyle.Dash;
                pen.Width     = 1;
                g.DrawRectangle(pen, r);
            }
Exemplo n.º 9
0
 public void MouseUp(MapEventInfo mei)
 {
 }
Exemplo n.º 10
0
 public void MouseDown(MapEventInfo mei)
 {
     Map.Note note = Poll(mei.editedMap, mei.current.px, mei.current.py);
     if (note != null)
     {
         if (mei.lb)
         {
             draggedNote = note;
             dx = draggedNote.x - mei.current.px;
             dy = draggedNote.y - mei.current.py;
             modified(mei);
         }
         else
         {
             mei.editedMap.Notes.Remove(note);
             modified(mei);
         }
     }
 }
Exemplo n.º 11
0
 public void paintWindow(MapEventInfo mei, Graphics g)
 {
 }
Exemplo n.º 12
0
 public void MouseDown(MapEventInfo mei)
 {
     //mei.opManager.beginGroup("Map: Brush");
     sx = Global.MainMapController.hScrollBar.Value;
     sy = Global.MainMapController.vScrollBar.Value;
 }
Exemplo n.º 13
0
        public void MouseUp(MapEventInfo mei)
        {
            if (!mei.editedLayer.canDraw)
            {
                return;
            }

            mei.opManager.endGroup();
            //mei.invalidate();
        }
Exemplo n.º 14
0
            public void MouseMoveTile(MapEventInfo mei)
            {
                int _x0 = mei.start.tx;
                int _y0 = mei.start.ty;
                int _x1 = mei.current.tx;
                int _y1 = mei.current.ty;
                int x0 = Math.Min(_x0, _x1);
                int x1 = Math.Max(_x0, _x1);
                int y0 = Math.Min(_y0, _y1);
                int y1 = Math.Max(_y0, _y1);

                Map m = new Map();

                if (bMultilayer)
                    m = mei.editedMap.tileCopyRange(x0, y0, x1 - x0 + 1, y1 - y0 + 1);
                else
                {
                    MapLayer ml = mei.editedLayer.copyRange(x0, y0, x1 - x0 + 1, y1 - y0 + 1);
                    ml.parentmap = m;
                    m.AddLayer(ml);
                }
                m.IsBrush = true;
                m.vsp = mei.editedMap.vsp;
                Global.clipboard = m;
                mei.bDirty = true;
            }
Exemplo n.º 15
0
 public void MouseDown(MapEventInfo mei)
 {
     mei.bDirty = true;
 }
Exemplo n.º 16
0
 public void MouseUp(MapEventInfo mei)
 {
     this.mei = mei;
     onSet();
     mei.opManager.endGroup();
 }
Exemplo n.º 17
0
 public void tweakLayer(MapEventInfo mei)
 {
 }
Exemplo n.º 18
0
 public void paintMap(MapEventInfo mei, pr2.IRenderImage img)
 {
 }
Exemplo n.º 19
0
 public void MouseUp(MapEventInfo mei)
 {
     mei.bDirty = true;
 }
Exemplo n.º 20
0
 public void tweakLayer(MapEventInfo mei)
 {
     this.mei = mei;
     onTweak();
 }
Exemplo n.º 21
0
 public void paintMap(MapEventInfo mei, pr2.IRenderImage img)
 {
     this.mei = mei;
     this.img = img;
     onPaint();
 }
Exemplo n.º 22
0
        public void MouseUp(MapEventInfo mei)
        {
            //foreach (var n in mei.editedMap.Notes)
            //{

            //  int xmin = n.tx * 16 + 1;
            //  int ymin = n.ty * 16 + 1;
            //  int xmax = (xmin + Render.measureText(n.note) / 16) * 16;
            //  int ymax = ymin + 16;
            //  if (mei.current.px >= xmin && mei.current.px < xmax && mei.current.py >= ymin && mei.current.py < ymax)
            //  {
            //    //edit existing note
            //    var ibr = winmaped2.pr2.InputBox.Show("Enter your note", "Note entry", n.note);
            //    if (ibr.ReturnCode == DialogResult.OK)
            //    {
            //      n.note = ibr.Text;
            //      if (n.note == "")
            //        mei.editedMap.Notes.Remove(n);
            //    }
            //    return;
            //  }
            //}

            if (draggedNote != null && mei.clicks == 2)
            {
                var ibr = winmaped2.pr2.InputBox.Show("Edit your note", "Note entry", draggedNote.note);
                if (ibr.ReturnCode == DialogResult.OK)
                {
                    draggedNote.note = ibr.Text;
                }
            }

            if(draggedNote == null && mei.lb)
            {
                var ibr = winmaped2.pr2.InputBox.Show("Enter your note", "Note entry", "default");
                if (ibr.ReturnCode == DialogResult.OK)
                {
                    var note = new Map.Note();
                    note.x = mei.current.px;
                    note.y = mei.current.py;
                    note.note = ibr.Text;

                    mei.editedMap.Notes.Add(note);
                    modified(mei);
                }
            }

            draggedNote = null;
        }
Exemplo n.º 23
0
            public void MouseUp(MapEventInfo mei)
            {
                if (Global.clipboard == null)
                    return;

                Global.opManager.beginGroup("Map: Clipboard Paste");
                this.mei = mei;
                work(mei.end);
                Global.opManager.endGroup();

                mei.bDirty = true;
            }
Exemplo n.º 24
0
 public void MouseDown(MapEventInfo mei)
 {
     mei.opManager.beginGroup("Map: " + name);
 }
Exemplo n.º 25
0
 public void paintWindow(MapEventInfo mei, Graphics g)
 {
 }
Exemplo n.º 26
0
 public void MouseMoveTile(MapEventInfo mei)
 {
     winmaped2.PrimitiveDrawer.DrawLine(mei.previous.tx, mei.previous.ty, mei.current.tx, mei.current.ty, new PrimitiveDrawer.Callback(cb), mei);
     //mei.invalidate();
 }
Exemplo n.º 27
0
            public void tweakMap(MapEventInfo mei)
            {
                if (Global.clipboard == null)
                    return;

                this.mei = mei;
                work(mei.current);
            }
Exemplo n.º 28
0
 protected virtual int getValue(MapEventInfo mei)
 {
     if (mei.editedLayer.type == LayerType.Tile || mei.editedLayer.type == LayerType.Obs || mei.editedLayer.type == LayerType.Zone)
     {
         if (mei.lb)
             return mei.ltile;
         if (mei.rb)
             return mei.rtile;
         //throw new Exception("wtf");
         return 0;
     }
     return 0;
 }
Exemplo n.º 29
0
 public void MouseMoveTile(MapEventInfo mei)
 {
     int tempTile = mei.getTileDropthrough(mei.current.tx, mei.current.ty);
     if (tempTile != lastTile)
     {
         if (mei.lb) { mei.ltile = tempTile; NotifyScroll(0); }
         if (mei.rb) { mei.rtile = tempTile; NotifyScroll(1); }
     }
     lastTile = tempTile;
 }
Exemplo n.º 30
0
            public void paintWindow(MapEventInfo mei, Graphics g)
            {
                int _x0 = (mei.start.tx * Global.TILE_SIZE - mei.xScroll);
                int _y0 = (mei.start.ty * Global.TILE_SIZE - mei.yScroll);
                int _x1 = (mei.current.tx * Global.TILE_SIZE - mei.xScroll);
                int _y1 = (mei.current.ty * Global.TILE_SIZE - mei.yScroll);
                int x0 = Math.Min(_x0, _x1);
                int x1 = Math.Max(_x0, _x1);
                int y0 = Math.Min(_y0, _y1);
                int y1 = Math.Max(_y0, _y1);
                x0 *= mei.zoom;
                x1 *= mei.zoom;
                y0 *= mei.zoom;
                y1 *= mei.zoom;
                System.Drawing.Rectangle r = new System.Drawing.Rectangle(x0, y0, x1 - x0 + mei.zoom * Global.TILE_SIZE, y1 - y0 + mei.zoom * Global.TILE_SIZE);

                Pen pen = new Pen(Color.White);
                pen.DashStyle = DashStyle.Dash;
                pen.Width = 1;
                g.DrawRectangle(pen, r);
            }
Exemplo n.º 31
0
 public void MouseMoveTile(MapEventInfo mei)
 {
     mei.bDirty = true;
 }
Exemplo n.º 32
0
 public void MouseMoveTile(MapEventInfo mei)
 {
     mei.bDirty = true;
 }
Exemplo n.º 33
0
 public void MouseUp(MapEventInfo mei)
 {
 }
Exemplo n.º 34
0
 public void paintMap(MapEventInfo mei, pr2.IRenderImage img)
 {
 }
Exemplo n.º 35
0
 public void MouseDown(MapEventInfo mei)
 {
     mei.opManager.beginGroup("Map: Brush");
 }
Exemplo n.º 36
0
 public void tweakLayer(MapEventInfo mei)
 {
 }
Exemplo n.º 37
0
 public void MouseMove(MapEventInfo mei)
 {
 }
Exemplo n.º 38
0
        public void MouseDown(MapEventInfo mei)
        {
            lastTile = mei.getTileDropthrough(mei.current.tx, mei.current.ty);

            if (mei.lb) { mei.ltile = lastTile; NotifyScroll(0); }
            if (mei.rb) { mei.rtile = lastTile; NotifyScroll(1); }
        }
Exemplo n.º 39
0
 public void MouseMoveTile(MapEventInfo mei)
 {
     winmaped2.PrimitiveDrawer.DrawLine(mei.previous.tx, mei.previous.ty, mei.current.tx, mei.current.ty, new PrimitiveDrawer.Callback(cb), mei);
     //mei.invalidate();
 }
Exemplo n.º 40
0
 public void MouseClick(MapEventInfo mei)
 {
     oldvalue = mei.getTile(mei.start.tx, mei.start.ty);
     newvalue = mei.tile;
     if (oldvalue != newvalue)
     {
         mei.opManager.beginGroup("Map: FloodFill");
         PrimitiveDrawer.FloodFill(mei.start.tx, mei.start.ty, new PrimitiveDrawer.CheckCallback(ccb), new PrimitiveDrawer.Callback(cb), mei);
         mei.opManager.endGroup();
     }
 }
Exemplo n.º 41
0
 public void MouseMoveTile(MapEventInfo mei)
 {
     int tempTile = mei.getTile(mei.current.tx, mei.current.ty);
     if (tempTile != lastTile) {
         if (mei.lb) mei.ltile = tempTile;
         if (mei.rb) mei.rtile = tempTile;
     }
     lastTile = tempTile;
 }
Exemplo n.º 42
0
 public void MouseMove(MapEventInfo mei)
 {
     int dx = mei.start.mx - mei.current.mx;
     int dy = mei.start.my - mei.current.my;
     dx /= Global.MainMapController.ZoomLevel;
     dy /= Global.MainMapController.ZoomLevel;
     int target_x = sx + dx;
     int target_y = sy + dy;
     if (target_x >= Global.MainMapController.hScrollBar.Maximum) target_x = Global.MainMapController.hScrollBar.Maximum;
     if (target_x < Global.MainMapController.hScrollBar.Minimum) target_x = Global.MainMapController.hScrollBar.Minimum;
     if (target_y >= Global.MainMapController.vScrollBar.Maximum) target_y = Global.MainMapController.vScrollBar.Maximum;
     if (target_y < Global.MainMapController.vScrollBar.Minimum) target_y = Global.MainMapController.vScrollBar.Minimum;
     Global.MainMapController.hScrollBar.Value = target_x;
     Global.MainMapController.vScrollBar.Value = target_y;
 }
Exemplo n.º 43
0
 public void MouseUp(MapEventInfo mei)
 {
     this.mei = mei;
     onSet();
     mei.opManager.endGroup();
 }
Exemplo n.º 44
0
 protected virtual int getValue(MapEventInfo mei)
 {
     return 0;
 }
Exemplo n.º 45
0
 public void paintMap(MapEventInfo mei, pr2.IRenderImage img)
 {
     this.mei = mei;
     this.img = img;
     onPaint();
 }
Exemplo n.º 46
0
 public void MouseMove(MapEventInfo mei)
 {
     if (draggedNote != null)
     {
         draggedNote.x = mei.current.px + dx;
         draggedNote.y = mei.current.py + dy;
     }
 }
Exemplo n.º 47
0
 public void tweakLayer(MapEventInfo mei)
 {
     this.mei = mei;
     onTweak();
 }
Exemplo n.º 48
0
 //todo
 void modified(MapEventInfo mei)
 {
     //mei.opManager.addExec(new Ops.SetTile(0, mli, x, y, val));
     mei.bDirty = true;
 }
Exemplo n.º 49
0
        public void MouseDown(MapEventInfo mei)
        {
            //mei.editedLayer. PENIS
            if (!mei.editedLayer.canDraw)
            {
                //MessageBox.Show("You're editing a hidden layer...");
            }

            mei.opManager.beginGroup("Map: Brush");
        }
Exemplo n.º 50
0
 public void MouseMove(MapEventInfo mei)
 {
 }
Exemplo n.º 51
0
 public void MouseUp(MapEventInfo mei)
 {
     mei.opManager.endGroup();
     //mei.invalidate();
 }