Exemple #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;
            }
Exemple #2
0
            public void tweakMap(MapEventInfo mei)
            {
                if (Global.clipboard == null)
                {
                    return;
                }

                this.mei = mei;
                work(mei.current);
            }
Exemple #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();
     }
 }
Exemple #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;
            }
        }
Exemple #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;
            }
Exemple #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;
        }
Exemple #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);
 }
Exemple #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);
            }
Exemple #9
0
 public void MouseUp(MapEventInfo mei)
 {
 }
Exemple #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);
         }
     }
 }
Exemple #11
0
 public void paintWindow(MapEventInfo mei, Graphics g)
 {
 }
Exemple #12
0
 public void MouseDown(MapEventInfo mei)
 {
     //mei.opManager.beginGroup("Map: Brush");
     sx = Global.MainMapController.hScrollBar.Value;
     sy = Global.MainMapController.vScrollBar.Value;
 }
Exemple #13
0
        public void MouseUp(MapEventInfo mei)
        {
            if (!mei.editedLayer.canDraw)
            {
                return;
            }

            mei.opManager.endGroup();
            //mei.invalidate();
        }
Exemple #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;
            }
Exemple #15
0
 public void MouseDown(MapEventInfo mei)
 {
     mei.bDirty = true;
 }
Exemple #16
0
 public void MouseUp(MapEventInfo mei)
 {
     this.mei = mei;
     onSet();
     mei.opManager.endGroup();
 }
Exemple #17
0
 public void tweakLayer(MapEventInfo mei)
 {
 }
Exemple #18
0
 public void paintMap(MapEventInfo mei, pr2.IRenderImage img)
 {
 }
Exemple #19
0
 public void MouseUp(MapEventInfo mei)
 {
     mei.bDirty = true;
 }
Exemple #20
0
 public void tweakLayer(MapEventInfo mei)
 {
     this.mei = mei;
     onTweak();
 }
Exemple #21
0
 public void paintMap(MapEventInfo mei, pr2.IRenderImage img)
 {
     this.mei = mei;
     this.img = img;
     onPaint();
 }
Exemple #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;
        }
Exemple #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;
            }
Exemple #24
0
 public void MouseDown(MapEventInfo mei)
 {
     mei.opManager.beginGroup("Map: " + name);
 }
Exemple #25
0
 public void paintWindow(MapEventInfo mei, Graphics g)
 {
 }
Exemple #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();
 }
Exemple #27
0
            public void tweakMap(MapEventInfo mei)
            {
                if (Global.clipboard == null)
                    return;

                this.mei = mei;
                work(mei.current);
            }
Exemple #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;
 }
Exemple #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;
 }
Exemple #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);
            }
Exemple #31
0
 public void MouseMoveTile(MapEventInfo mei)
 {
     mei.bDirty = true;
 }
Exemple #32
0
 public void MouseMoveTile(MapEventInfo mei)
 {
     mei.bDirty = true;
 }
Exemple #33
0
 public void MouseUp(MapEventInfo mei)
 {
 }
Exemple #34
0
 public void paintMap(MapEventInfo mei, pr2.IRenderImage img)
 {
 }
Exemple #35
0
 public void MouseDown(MapEventInfo mei)
 {
     mei.opManager.beginGroup("Map: Brush");
 }
Exemple #36
0
 public void tweakLayer(MapEventInfo mei)
 {
 }
Exemple #37
0
 public void MouseMove(MapEventInfo mei)
 {
 }
Exemple #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); }
        }
Exemple #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();
 }
Exemple #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();
     }
 }
 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;
 }
Exemple #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;
 }
Exemple #43
0
 public void MouseUp(MapEventInfo mei)
 {
     this.mei = mei;
     onSet();
     mei.opManager.endGroup();
 }
Exemple #44
0
 protected virtual int getValue(MapEventInfo mei)
 {
     return 0;
 }
Exemple #45
0
 public void paintMap(MapEventInfo mei, pr2.IRenderImage img)
 {
     this.mei = mei;
     this.img = img;
     onPaint();
 }
Exemple #46
0
 public void MouseMove(MapEventInfo mei)
 {
     if (draggedNote != null)
     {
         draggedNote.x = mei.current.px + dx;
         draggedNote.y = mei.current.py + dy;
     }
 }
Exemple #47
0
 public void tweakLayer(MapEventInfo mei)
 {
     this.mei = mei;
     onTweak();
 }
Exemple #48
0
 //todo
 void modified(MapEventInfo mei)
 {
     //mei.opManager.addExec(new Ops.SetTile(0, mli, x, y, val));
     mei.bDirty = true;
 }
Exemple #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");
        }
Exemple #50
0
 public void MouseMove(MapEventInfo mei)
 {
 }
Exemple #51
0
 public void MouseUp(MapEventInfo mei)
 {
     mei.opManager.endGroup();
     //mei.invalidate();
 }