public MapLocationSelectForm(Guid map_id, Guid map_location_id)
        {
            this.InitializeComponent();
            Application.Idle += new EventHandler(this.Application_Idle);
            this.MapBox.Items.Add("(no map)");
            foreach (RegionalMap regionalMap in Session.Project.RegionalMaps)
            {
                this.MapBox.Items.Add(regionalMap);
            }
            RegionalMap regionalMap1 = Session.Project.FindRegionalMap(map_id);

            if (regionalMap1 == null)
            {
                this.MapBox.SelectedIndex = 0;
                this.LocationBox.Items.Add("(no map)");
                this.LocationBox.SelectedIndex = 0;
                return;
            }
            this.MapBox.SelectedItem = regionalMap1;
            Masterplan.Data.MapLocation mapLocation = regionalMap1.FindLocation(map_location_id);
            if (mapLocation != null)
            {
                this.LocationBox.SelectedItem = mapLocation;
                return;
            }
            this.LocationBox.SelectedIndex = 0;
        }
Exemplo n.º 2
0
        public RegionalMapForm(RegionalMap map, MapLocation loc)
        {
            InitializeComponent();

            Application.Idle += new EventHandler(Application_Idle);

            fMap = map.Copy();

            NameBox.Text = fMap.Name;
            MapPanel.Map = fMap;

            if (loc != null)
            {
                // Disable editing

                NameBox.Enabled = false;
                Toolbar.Visible = false;

                OKBtn.Visible  = false;
                CancelBtn.Text = "Close";

                MapPanel.Mode = MapViewMode.Plain;
                MapPanel.HighlightedLocation = loc;
            }
        }
        private void Application_Idle(object sender, EventArgs e)
        {
            this.MapLbl.Enabled = Session.Project.RegionalMaps.Count != 0;
            this.MapBox.Enabled = Session.Project.RegionalMaps.Count != 0;
            RegionalMap selectedItem = this.MapBox.SelectedItem as RegionalMap;
            bool        flag         = (selectedItem == null ? false : selectedItem.Locations.Count != 0);

            this.LocationLbl.Enabled = flag;
            this.LocationBox.Enabled = flag;
            this.OKBtn.Enabled       = this.MapLocation != null;
        }
Exemplo n.º 4
0
        void Application_Idle(object sender, EventArgs e)
        {
            MapLbl.Enabled = (Session.Project.RegionalMaps.Count != 0);
            MapBox.Enabled = (Session.Project.RegionalMaps.Count != 0);

            RegionalMap m         = MapBox.SelectedItem as RegionalMap;
            bool        locations = ((m != null) && (m.Locations.Count != 0));

            LocationLbl.Enabled = locations;
            LocationBox.Enabled = locations;

            OKBtn.Enabled = (MapLocation != null);
        }
        private void show_map()
        {
            RegionalMap selectedItem = this.MapBox.SelectedItem as RegionalMap;

            if (selectedItem == null)
            {
                this.MapPanel.Map = null;
                return;
            }
            this.MapPanel.Map = selectedItem;
            Masterplan.Data.MapLocation mapLocation = this.LocationBox.SelectedItem as Masterplan.Data.MapLocation;
            this.MapPanel.HighlightedLocation = mapLocation;
        }
Exemplo n.º 6
0
 private void EditBtn_Click(object sender, EventArgs e)
 {
     if (this.SelectedMap != null)
     {
         int             map             = Session.Project.RegionalMaps.IndexOf(this.SelectedMap);
         RegionalMapForm regionalMapForm = new RegionalMapForm(this.SelectedMap, null);
         if (regionalMapForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             Session.Project.RegionalMaps[map] = regionalMapForm.Map;
             Session.Modified = true;
             this.update_maps();
             this.SelectedMap = regionalMapForm.Map;
         }
     }
 }
Exemplo n.º 7
0
        void show_map()
        {
            RegionalMap m = MapBox.SelectedItem as RegionalMap;

            if (m != null)
            {
                MapPanel.Map = m;

                MapLocation loc = LocationBox.SelectedItem as MapLocation;
                MapPanel.HighlightedLocation = loc;
            }
            else
            {
                MapPanel.Map = null;
            }
        }
        private void MapBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.LocationBox.Items.Clear();
            RegionalMap selectedItem = this.MapBox.SelectedItem as RegionalMap;

            if (selectedItem != null)
            {
                this.LocationBox.Items.Add("(entire map)");
                foreach (Masterplan.Data.MapLocation location in selectedItem.Locations)
                {
                    this.LocationBox.Items.Add(location);
                }
                this.LocationBox.SelectedIndex = 0;
            }
            this.show_map();
        }
Exemplo n.º 9
0
        private void AddBtn_Click(object sender, EventArgs e)
        {
            RegionalMap regionalMap = new RegionalMap()
            {
                Name = "New Map"
            };
            RegionalMapForm regionalMapForm = new RegionalMapForm(regionalMap, null);

            if (regionalMapForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Session.Project.RegionalMaps.Add(regionalMapForm.Map);
                Session.Modified = true;
                this.update_maps();
                this.SelectedMap = regionalMapForm.Map;
            }
        }
Exemplo n.º 10
0
 public RegionalMapForm(RegionalMap map, MapLocation loc)
 {
     this.InitializeComponent();
     Application.Idle += new EventHandler(this.Application_Idle);
     this.fMap         = map.Copy();
     this.NameBox.Text = this.fMap.Name;
     this.MapPanel.Map = this.fMap;
     if (loc != null)
     {
         this.NameBox.Enabled = false;
         this.Toolbar.Visible = false;
         this.OKBtn.Visible   = false;
         this.CancelBtn.Text  = "Close";
         this.MapPanel.Mode   = MapViewMode.Plain;
         this.MapPanel.HighlightedLocation = loc;
     }
 }
Exemplo n.º 11
0
        private void AddBtn_Click(object sender, EventArgs e)
        {
            RegionalMap m = new RegionalMap();

            m.Name = "New Map";

            RegionalMapForm dlg = new RegionalMapForm(m, null);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                Session.Project.RegionalMaps.Add(dlg.Map);
                Session.Modified = true;

                update_maps();

                SelectedMap = dlg.Map;
            }
        }
Exemplo n.º 12
0
        private void EditBtn_Click(object sender, EventArgs e)
        {
            if (SelectedMap != null)
            {
                int index = Session.Project.RegionalMaps.IndexOf(SelectedMap);

                RegionalMapForm dlg = new RegionalMapForm(SelectedMap, null);
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    Session.Project.RegionalMaps[index] = dlg.Map;
                    Session.Modified = true;

                    update_maps();

                    SelectedMap = dlg.Map;
                }
            }
        }
Exemplo n.º 13
0
        private void MapBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            LocationBox.Items.Clear();

            RegionalMap m = MapBox.SelectedItem as RegionalMap;

            if (m != null)
            {
                LocationBox.Items.Add("(entire map)");

                foreach (MapLocation loc in m.Locations)
                {
                    LocationBox.Items.Add(loc);
                }

                LocationBox.SelectedIndex = 0;
            }

            show_map();
        }
Exemplo n.º 14
0
        public MapLocationSelectForm(Guid map_id, Guid map_location_id)
        {
            InitializeComponent();

            Application.Idle += new EventHandler(Application_Idle);

            MapBox.Items.Add("(no map)");
            foreach (RegionalMap m in Session.Project.RegionalMaps)
            {
                MapBox.Items.Add(m);
            }

            RegionalMap map = Session.Project.FindRegionalMap(map_id);

            if (map != null)
            {
                MapBox.SelectedItem = map;

                MapLocation loc = map.FindLocation(map_location_id);
                if (loc != null)
                {
                    LocationBox.SelectedItem = loc;
                }
                else
                {
                    LocationBox.SelectedIndex = 0;
                }
            }
            else
            {
                MapBox.SelectedIndex = 0;

                LocationBox.Items.Add("(no map)");
                LocationBox.SelectedIndex = 0;
            }
        }
Exemplo n.º 15
0
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(RegionalMapForm));

            this.NameLbl               = new Label();
            this.NameBox               = new TextBox();
            this.Panel                 = new System.Windows.Forms.Panel();
            this.MapPanel              = new RegionalMapPanel();
            this.MapContext            = new System.Windows.Forms.ContextMenuStrip(this.components);
            this.MapContextAddLocation = new ToolStripMenuItem();
            this.toolStripSeparator2   = new ToolStripSeparator();
            this.MapContextRemove      = new ToolStripMenuItem();
            this.MapContextEdit        = new ToolStripMenuItem();
            this.Toolbar               = new ToolStrip();
            this.BrowseBtn             = new ToolStripButton();
            this.toolStripSeparator1   = new ToolStripSeparator();
            this.RemoveBtn             = new ToolStripButton();
            this.EditBtn               = new ToolStripButton();
            this.toolStripSeparator3   = new ToolStripSeparator();
            this.EntryBtn              = new ToolStripButton();
            this.OKBtn                 = new Button();
            this.CancelBtn             = new Button();
            this.PasteBtn              = new ToolStripButton();
            this.Panel.SuspendLayout();
            this.MapContext.SuspendLayout();
            this.Toolbar.SuspendLayout();
            base.SuspendLayout();
            this.NameLbl.AutoSize  = true;
            this.NameLbl.Location  = new Point(12, 15);
            this.NameLbl.Name      = "NameLbl";
            this.NameLbl.Size      = new System.Drawing.Size(62, 13);
            this.NameLbl.TabIndex  = 0;
            this.NameLbl.Text      = "Map Name:";
            this.NameBox.Anchor    = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            this.NameBox.Location  = new Point(80, 12);
            this.NameBox.Name      = "NameBox";
            this.NameBox.Size      = new System.Drawing.Size(515, 20);
            this.NameBox.TabIndex  = 1;
            this.Panel.Anchor      = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
            this.Panel.BorderStyle = BorderStyle.FixedSingle;
            this.Panel.Controls.Add(this.MapPanel);
            this.Panel.Controls.Add(this.Toolbar);
            this.Panel.Location               = new Point(12, 38);
            this.Panel.Name                   = "Panel";
            this.Panel.Size                   = new System.Drawing.Size(583, 352);
            this.Panel.TabIndex               = 2;
            this.MapPanel.AllowEditing        = true;
            this.MapPanel.ContextMenuStrip    = this.MapContext;
            this.MapPanel.Dock                = DockStyle.Fill;
            this.MapPanel.HighlightedLocation = null;
            this.MapPanel.Location            = new Point(0, 25);
            this.MapPanel.Map                 = null;
            this.MapPanel.Mode                = MapViewMode.Normal;
            this.MapPanel.Name                = "MapPanel";
            this.MapPanel.Plot                = null;
            this.MapPanel.SelectedLocation    = null;
            this.MapPanel.ShowLocations       = true;
            this.MapPanel.Size                = new System.Drawing.Size(581, 325);
            this.MapPanel.TabIndex            = 1;
            this.MapPanel.DoubleClick        += new EventHandler(this.MapPanel_DoubleClick);
            ToolStripItemCollection items = this.MapContext.Items;

            ToolStripItem[] mapContextAddLocation = new ToolStripItem[] { this.MapContextAddLocation, this.toolStripSeparator2, this.MapContextRemove, this.MapContextEdit };
            items.AddRange(mapContextAddLocation);
            this.MapContext.Name              = "MapContext";
            this.MapContext.Size              = new System.Drawing.Size(183, 76);
            this.MapContext.Opening          += new CancelEventHandler(this.MapContext_Opening);
            this.MapContextAddLocation.Name   = "MapContextAddLocation";
            this.MapContextAddLocation.Size   = new System.Drawing.Size(182, 22);
            this.MapContextAddLocation.Text   = "Add Location Here...";
            this.MapContextAddLocation.Click += new EventHandler(this.MapContextAddLocation_Click);
            this.toolStripSeparator2.Name     = "toolStripSeparator2";
            this.toolStripSeparator2.Size     = new System.Drawing.Size(179, 6);
            this.MapContextRemove.Name        = "MapContextRemove";
            this.MapContextRemove.Size        = new System.Drawing.Size(182, 22);
            this.MapContextRemove.Text        = "Remove Location";
            this.MapContextRemove.Click      += new EventHandler(this.MapContextRemove_Click);
            this.MapContextEdit.Name          = "MapContextEdit";
            this.MapContextEdit.Size          = new System.Drawing.Size(182, 22);
            this.MapContextEdit.Text          = "Edit Location";
            this.MapContextEdit.Click        += new EventHandler(this.MapContextEdit_Click);
            ToolStripItemCollection toolStripItemCollections = this.Toolbar.Items;

            ToolStripItem[] browseBtn = new ToolStripItem[] { this.BrowseBtn, this.PasteBtn, this.toolStripSeparator1, this.RemoveBtn, this.EditBtn, this.toolStripSeparator3, this.EntryBtn };
            toolStripItemCollections.AddRange(browseBtn);
            this.Toolbar.Location                = new Point(0, 0);
            this.Toolbar.Name                    = "Toolbar";
            this.Toolbar.Size                    = new System.Drawing.Size(581, 25);
            this.Toolbar.TabIndex                = 0;
            this.Toolbar.Text                    = "toolStrip1";
            this.BrowseBtn.DisplayStyle          = ToolStripItemDisplayStyle.Text;
            this.BrowseBtn.Image                 = (Image)componentResourceManager.GetObject("BrowseBtn.Image");
            this.BrowseBtn.ImageTransparentColor = Color.Magenta;
            this.BrowseBtn.Name                  = "BrowseBtn";
            this.BrowseBtn.Size                  = new System.Drawing.Size(105, 22);
            this.BrowseBtn.Text                  = "Select Map Image";
            this.BrowseBtn.Click                += new EventHandler(this.BrowseBtn_Click);
            this.toolStripSeparator1.Name        = "toolStripSeparator1";
            this.toolStripSeparator1.Size        = new System.Drawing.Size(6, 25);
            this.RemoveBtn.DisplayStyle          = ToolStripItemDisplayStyle.Text;
            this.RemoveBtn.Image                 = (Image)componentResourceManager.GetObject("RemoveBtn.Image");
            this.RemoveBtn.ImageTransparentColor = Color.Magenta;
            this.RemoveBtn.Name                  = "RemoveBtn";
            this.RemoveBtn.Size                  = new System.Drawing.Size(103, 22);
            this.RemoveBtn.Text                  = "Remove Location";
            this.RemoveBtn.Click                += new EventHandler(this.MapContextRemove_Click);
            this.EditBtn.DisplayStyle            = ToolStripItemDisplayStyle.Text;
            this.EditBtn.Image                   = (Image)componentResourceManager.GetObject("EditBtn.Image");
            this.EditBtn.ImageTransparentColor   = Color.Magenta;
            this.EditBtn.Name                    = "EditBtn";
            this.EditBtn.Size                    = new System.Drawing.Size(80, 22);
            this.EditBtn.Text                    = "Edit Location";
            this.EditBtn.Click                  += new EventHandler(this.MapContextEdit_Click);
            this.toolStripSeparator3.Name        = "toolStripSeparator3";
            this.toolStripSeparator3.Size        = new System.Drawing.Size(6, 25);
            this.EntryBtn.DisplayStyle           = ToolStripItemDisplayStyle.Text;
            this.EntryBtn.Image                  = (Image)componentResourceManager.GetObject("EntryBtn.Image");
            this.EntryBtn.ImageTransparentColor  = Color.Magenta;
            this.EntryBtn.Name                   = "EntryBtn";
            this.EntryBtn.Size                   = new System.Drawing.Size(111, 22);
            this.EntryBtn.Text                   = "Encyclopedia Entry";
            this.EntryBtn.Click                 += new EventHandler(this.EntryBtn_Click);
            this.OKBtn.Anchor                    = AnchorStyles.Bottom | AnchorStyles.Right;
            this.OKBtn.DialogResult              = System.Windows.Forms.DialogResult.OK;
            this.OKBtn.Location                  = new Point(439, 396);
            this.OKBtn.Name     = "OKBtn";
            this.OKBtn.Size     = new System.Drawing.Size(75, 23);
            this.OKBtn.TabIndex = 3;
            this.OKBtn.Text     = "OK";
            this.OKBtn.UseVisualStyleBackColor = true;
            this.OKBtn.Click                      += new EventHandler(this.OKBtn_Click);
            this.CancelBtn.Anchor                  = AnchorStyles.Bottom | AnchorStyles.Right;
            this.CancelBtn.DialogResult            = System.Windows.Forms.DialogResult.Cancel;
            this.CancelBtn.Location                = new Point(520, 396);
            this.CancelBtn.Name                    = "CancelBtn";
            this.CancelBtn.Size                    = new System.Drawing.Size(75, 23);
            this.CancelBtn.TabIndex                = 4;
            this.CancelBtn.Text                    = "Cancel";
            this.CancelBtn.UseVisualStyleBackColor = true;
            this.PasteBtn.DisplayStyle             = ToolStripItemDisplayStyle.Text;
            this.PasteBtn.Image                    = (Image)componentResourceManager.GetObject("PasteBtn.Image");
            this.PasteBtn.ImageTransparentColor    = Color.Magenta;
            this.PasteBtn.Name                     = "PasteBtn";
            this.PasteBtn.Size                     = new System.Drawing.Size(102, 22);
            this.PasteBtn.Text                     = "Paste Map Image";
            this.PasteBtn.Click                   += new EventHandler(this.PasteBtn_Click);
            base.AcceptButton                      = this.OKBtn;
            base.AutoScaleDimensions               = new SizeF(6f, 13f);
            base.AutoScaleMode                     = System.Windows.Forms.AutoScaleMode.Font;
            base.CancelButton                      = this.CancelBtn;
            base.ClientSize = new System.Drawing.Size(607, 431);
            base.Controls.Add(this.CancelBtn);
            base.Controls.Add(this.OKBtn);
            base.Controls.Add(this.Panel);
            base.Controls.Add(this.NameBox);
            base.Controls.Add(this.NameLbl);
            base.MinimizeBox   = false;
            base.Name          = "RegionalMapForm";
            base.ShowIcon      = false;
            base.ShowInTaskbar = false;
            base.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
            base.StartPosition = FormStartPosition.CenterParent;
            this.Text          = "Regional Map";
            this.Panel.ResumeLayout(false);
            this.Panel.PerformLayout();
            this.MapContext.ResumeLayout(false);
            this.Toolbar.ResumeLayout(false);
            this.Toolbar.PerformLayout();
            base.ResumeLayout(false);
            base.PerformLayout();
        }
Exemplo n.º 16
0
        void Application_Idle(object sender, EventArgs e)
        {
            MapLocation loc = null;

            if (fPoint.RegionalMapID != Guid.Empty)
            {
                RegionalMap map = Session.Project.FindRegionalMap(fPoint.RegionalMapID);
                if ((map != null) && (fPoint.MapLocationID != Guid.Empty))
                {
                    loc = map.FindLocation(fPoint.MapLocationID);
                }
            }

            int count = 0;

            foreach (RegionalMap map in Session.Project.RegionalMaps)
            {
                count += map.Locations.Count;
            }

            LocationBtn.Enabled      = (count != 0);
            LocationBtn.Text         = (loc != null) ? loc.Name : "Set Location";
            ClearLocationLbl.Visible = (loc != null);

            DateBtn.Enabled      = (Session.Project.Calendars.Count != 0);
            DateBtn.Text         = (fPoint.Date != null) ? fPoint.Date.ToString() : "Set Date";
            ClearDateLbl.Visible = (fPoint.Date != null);

            CopyElementBtn.Visible   = (fPoint.Element != null);
            RemoveElementBtn.Visible = (fPoint.Element != null);

            ParcelAddPredefined.Enabled = (Session.Project.TreasureParcels.Count != 0);
            ParcelAddItem.Enabled       = (Session.MagicItems.Count != 0);
            ParcelAddArtifact.Enabled   = (Session.Artifacts.Count != 0);
            ParcelRemoveBtn.Enabled     = (SelectedParcel != null);
            ParcelEditBtn.Enabled       = (SelectedParcel != null);

            if (SelectedParcel != null)
            {
                bool is_item          = SelectedParcel.MagicItemID != Guid.Empty;
                bool is_real_item     = is_item && !Treasure.PlaceholderIDs.Contains(SelectedParcel.MagicItemID);
                bool is_artifact      = SelectedParcel.ArtifactID != Guid.Empty;
                bool is_real_artifact = is_artifact && !Treasure.PlaceholderIDs.Contains(SelectedParcel.ArtifactID);

                ChangeItemBtn.Enabled    = (is_item || is_artifact);
                ItemStatBlockBtn.Enabled = (is_real_item || is_real_artifact);

                if (is_item)
                {
                    ChangeItemBtn.Text = "Select Magic Item";
                }
                else if (is_artifact)
                {
                    ChangeItemBtn.Text = "Select Artifact";
                }
                else
                {
                    ChangeItemBtn.Text = "Select";
                }
            }
            else
            {
                ChangeItemBtn.Enabled    = false;
                ItemStatBlockBtn.Enabled = false;
            }

            EncyclopediaRemoveBtn.Enabled = (SelectedEntry != null);
            EncPlayerViewBtn.Enabled      = (SelectedEntry != null);

            RemoveBtn.Enabled = (SelectedLink != null);
        }