예제 #1
0
        public TileEd()
        {
            InitializeComponent();

            throttleDisplay = new ThrottleBuffer(500, new EventHandler(postRedisplay));
        }
예제 #2
0
파일: mainWindow.cs 프로젝트: mcgrue/maped3
        public MainWindow()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            Global.toolPalette = toolPalette;
            Global.MainMapController = mapController;
            Global.ClipboardMapController = mcClipboard;
            Global.zoomChanged += new winmaped2.Global.SimpleEventHandler(Global_zoomChanged);
            Global.zoomChanged += new winmaped2.Global.SimpleEventHandler(zoomchanged);

            Global.FrameCalc.init();

            Plugins.IMapPlugin
                brush = null,
                rectfill = null,
                line = null,
                rectangle = null,
                floodfill = null,
                clipboard = null,
                noteTool = null;

            SetupButton(ref brush,      new winmaped2.map_plugins.BrushTool(),       radioButton1);
            SetupButton(ref rectfill,   new winmaped2.map_plugins.RectFill(),        radioButton2);
            SetupButton(ref line,       new winmaped2.map_plugins.Line(),            radioButton3);
            SetupButton(ref rectangle,  new winmaped2.map_plugins.Rectangle(),       radioButton4);
            SetupButton(ref floodfill,  new winmaped2.map_plugins.FloodFillTool(),   radioButton5);
            SetupButton(ref clipboard,  new winmaped2.map_plugins.ClipboardPlugin(),  radioButton6);

            SetupButton(ref noteTool,   winmaped2.map_plugins.NoteTool.noteTool,       radioButton7);

            ((Bitmap)b_runmap.Image).MakeTransparent(Color.Magenta);
            ((Bitmap)b_layeradd.Image).MakeTransparent(Color.Magenta);
            ((Bitmap)b_layerdel.Image).MakeTransparent(Color.Magenta);
            ((Bitmap)b_layerup.Image).MakeTransparent(Color.Magenta);
            ((Bitmap)b_layerdown.Image).MakeTransparent(Color.Magenta);
            ((Bitmap)b_layerproperties.Image).MakeTransparent(Color.Magenta);

            Images.ImagesInit();

            vspController.SetControllerMode(VSPController.ControllerMode.SelectorDual);
            vspController.SetControllerType(VSPController.ControllerType.VSP);
            vspController.SetTileViewers(TileViewA, TileViewB);
            vspController.VspView.SelectionChanged += new SEventHandler(VspView_SelectionChanged);

            vspc_obs.SetControllerMode(VSPController.ControllerMode.SelectorSingle);
            vspc_obs.SetControllerType(VSPController.ControllerType.Obstruction);
            vspc_obs.SetTileViewers(tv_obs);
            tv_obs.TileSourceType = TileViewer.SourceType.Obstruction;

            Global.SelectedZoneChanged += new winmaped2.Global.SimpleEventHandler(Global_SelectedZoneChanged);
            Global.vspController = vspController;
            Global.obsVspController = vspc_obs;
            Global.MiniMap = miniMap;
            Global.mainWindow = this;
            Global.TileViewerA = TileViewA;
            Global.TileViewerB = TileViewB;
            Global.layerTool = lPanel;

            if (Global.VspViewer != null) {
                Global.VspViewer.CalculateScrollValues();
            }

            Global.WriteDestChanged += new winmaped2.Global.LEventHandler(WriteDestChanged);
            Global.CursorLocationChanged += new winmaped2.Global.xyEventHandler(Global_CursorLocationChanged);
            Global.ActiveMapChanged += new winmaped2.Global.SimpleEventHandler(Global_ActiveMapChanged);
            Global.ClipboardChanged += new winmaped2.Global.SimpleEventHandler(Global_ClipboardChanged);

            miniMap.Controller = mapController;
            mapController.AssociateMinimap(miniMap);
            mcClipboard.ZoomLevel = 1;

            Global.zoom = Preferences.Current.DefaultZoomLevel;
            Global.FrameCalc.OnTick += new winmaped2.Global.SimpleEventHandler(FrameCalc_OnTick);

            ui_update();

            animTimer.Elapsed += new System.Timers.ElapsedEventHandler(animTimer_Elapsed);
            animTimer.Start();
            animTimer.Enabled = false;

            Global_zoomChanged();

            throttleDisplay = new ThrottleBuffer(500, new EventHandler(postRedisplay));

            sidebarPanel.ContextMenu = new ContextMenu();
            foreach (Control ctrl in sidebarPanel.Controls)
            {
                if (ctrl is CollapsiblePanel)
                {
                    CollapsiblePanel panel = (ctrl as CollapsiblePanel);
                    MenuItem toolbarItem = panel.MenuItem.CloneMenu();

                    panel.VisibleChanged += delegate(object sender, EventArgs e)
                    {
                        toolbarItem.Checked = panel.Visible;
                    };
                    miViewToolbars.MenuItems.Add(toolbarItem);

                    //this is the code that adds the contextmenu that is annoying
                    sidebarPanel.ContextMenu.MenuItems.Add(panel.MenuItem);
                }
            }

            // test
            //Preferences.Current.Save();

            radioButton1.Checked = true;

            //tilesPanel.CanLargeify = true;
            tilesPanel.OnLargeified = OnLargeifyTiles;
        }
예제 #3
0
파일: TileEd.cs 프로젝트: salviati/verge3
        public TileEd()
        {
            InitializeComponent();

            throttleDisplay = new ThrottleBuffer(500, new EventHandler(postRedisplay));
        }