private void btnAlignElements_Click(object sender, EventArgs e)//Ok { if (chkGridStore.Checked) { Map.AlignToGridAll((int)nudGridStepX.Value, (int)nudGridStepY.Value); } else { Map.AlignToGridAll(Options.Grid.StepX, Options.Grid.StepY); } Map.Draw(); Options.mainForm.Invalidate(); }
private xMap AddMap(String MapName)// { var page = tcMaps.TabPages[tcMaps.TabCount - 1]; // Get appendix number if (MapName == "") { tcMaps.Tag = ((tcMaps.Tag != null) ? (int)tcMaps.Tag : 1) + 1; MapName = "New " + (int)tcMaps.Tag; } // Make as map tab var map = new xMap(); Options.Maps.Add(map); page.Enter -= tpAddNew_Enter; page.Text = MapName; page.Tag = map; map.Tab = page; map.DoAutoSize(); map.Draw(); // Add new tab page = new TabPage("+"); tcMaps.TabPages.Add(page); page.Enter += tpAddNew_Enter; return(map); }
private void tsmiMapOptions_Click(object sender, EventArgs e)// { var mapOptionsForm = new MapOptionsForm(Map); if (mapOptionsForm.ShowDialog() == DialogResult.OK) { if (Map.AutoSize) { Map.DoAutoSize(); } else { Map.SetSize(Map.Width, Map.Height); } CheckScrollers(); Map.Draw(); Map.Changed = true; Map.UpdateTabName(); Invalidate(); } }
private void tcMaps_Selected(object sender, TabControlEventArgs e) { // Case new not "add new tab" xMap SelectedMap = (tcMaps.SelectedTab.Tag as xMap); if (SelectedMap == null || Map == SelectedMap) { return; } // Remove last map info if (Map != null) { foreach (ListViewItem lvItem in libraryForm.lvUsedObjects.Items) { (lvItem.Tag as xPrototype).lvItemUsed = null; } foreach (ListViewItem lvItem in libraryForm.lvUsedLinks.Items) { (lvItem.Tag as xPrototype).lvItemUsed = null; } foreach (ListViewItem lvItem in libraryForm.lvUsedBoxes.Items) { (lvItem.Tag as xPrototype).lvItemUsed = null; } libraryForm.lvUsedObjects.Items.Clear(); libraryForm.lvUsedLinks.Items.Clear(); libraryForm.lvUsedBoxes.Items.Clear(); Map.lv_PObjects = Map.lv_PLinks = Map.lv_PBoxes = null; } // Switching Map = SelectedMap; // Draw if (Map.DoAutoSize()) { Map.Draw(); } CheckScrollers(); CheckFrames(true); Invalidate(); // Add current map info libraryForm.lvUsedObjects.BeginUpdate(); libraryForm.lvUsedLinks.BeginUpdate(); libraryForm.lvUsedBoxes.BeginUpdate(); foreach (var PObject in Map.PObjects) { PObject.lvItemUsed = libraryForm.lvUsedObjects.Items.Add(""); PObject.lvItemUsed.SubItems.Add(""); PObject.lvItemUsed.SubItems.Add(""); PObject.lvItemUsed.Tag = PObject; Share.Library_UpdateNodeName(PObject); } foreach (var PLink in Map.PLinks) { PLink.lvItemUsed = libraryForm.lvUsedLinks.Items.Add(""); PLink.lvItemUsed.SubItems.Add(""); PLink.lvItemUsed.SubItems.Add(""); PLink.lvItemUsed.Tag = PLink; Share.Library_UpdateNodeName(PLink); } foreach (var PBox in Map.PBoxes) { PBox.lvItemUsed = libraryForm.lvUsedBoxes.Items.Add(""); PBox.lvItemUsed.SubItems.Add(""); PBox.lvItemUsed.SubItems.Add(""); PBox.lvItemUsed.Tag = PBox; Share.Library_UpdateNodeName(PBox); } libraryForm.lvUsedObjects.EndUpdate(); libraryForm.lvUsedLinks.EndUpdate(); libraryForm.lvUsedBoxes.EndUpdate(); Map.lv_PObjects = libraryForm.lvUsedObjects; Map.lv_PLinks = libraryForm.lvUsedLinks; Map.lv_PBoxes = libraryForm.lvUsedBoxes; }