Example #1
0
        /// <summary>
        /// Add a new location
        /// </summary>
        private void miAdd_Click(object sender, EventArgs e)
        {
            TheBox.Forms.Editors.QuickLocation form = new TheBox.Forms.Editors.QuickLocation();

            if (form.ShowDialog() == DialogResult.OK)
            {
                Location loc = form.CurrentLocation;

                m_Locations.Add(loc);
                RebuildMenu();
            }
        }
Example #2
0
		/// <summary>
		/// Edit selected location
		/// </summary>
		private void mLocEdit_Click(object sender, System.EventArgs e)
		{
			TheBox.Data.Location location = tLoc.SelectedNode.Tag as TheBox.Data.Location;

			TheBox.Forms.Editors.QuickLocation quickLoc = new TheBox.Forms.Editors.QuickLocation();

			EnsureMap();

			quickLoc.MapFile = m_Map;
			quickLoc.CurrentLocation = location;

			if ( quickLoc.ShowDialog() == DialogResult.OK )
			{
				// Issue 10 - Update the code to Net Framework 3.5 - http://code.google.com/p/pandorasbox3/issues/detail?id=10 - Smjert
				( tCat.SelectedNode.Tag as List<object> ).Sort();
				
				int index = ( tCat.SelectedNode.Tag as List<object> ).IndexOf( location );
				// Issue 10 - End

				TreeNode node = tCat.SelectedNode;
				tCat.SelectedNode = null;
				tCat.SelectedNode = node;

				tLoc.SelectedNode = tLoc.Nodes[ index ];

				UpdateMap();
			}
		}
Example #3
0
		/// <summary>
		/// Create a new location. It's assumed a cat/subsection is already selected
		/// </summary>
		private void mLocNew_Click(object sender, System.EventArgs e)
		{
			TheBox.Data.Location location = new Location();
			location.X = (short) m_X;
			location.Y = (short) m_Y;
			location.Z = (sbyte) m_Z;

			TheBox.Forms.Editors.QuickLocation quickLoc = new TheBox.Forms.Editors.QuickLocation();

			EnsureMap();

			quickLoc.MapFile = m_Map;
			quickLoc.CurrentLocation = location;

			if ( quickLoc.ShowDialog() == DialogResult.OK )
			{
				// Issue 10 - Update the code to Net Framework 3.5 - http://code.google.com/p/pandorasbox3/issues/detail?id=10 - Smjert
				List<object> list = tCat.SelectedNode.Tag as List<object>;
				// Issue 10 - End

				if ( list != null )
				{
					list.Add( quickLoc.CurrentLocation );
					list.Sort();

					int index = list.IndexOf( quickLoc.CurrentLocation );

					TreeNode node = tCat.SelectedNode;
					tCat.SelectedNode = null;
					tCat.SelectedNode = node;

					tLoc.SelectedNode = tLoc.Nodes[ index ];

					UpdateMap();
				}
				else
				{
					Pandora.Log.WriteError( null, string.Format( "Couldn't add location because the tCat node wasn't a subsection node" ) );
					MessageBox.Show( Pandora.Localization.TextProvider[ "Messages.NewLocErr" ] );
				}
			}
		}
Example #4
0
		/// <summary>
		/// Add a new location
		/// </summary>
		private void miAdd_Click(object sender, EventArgs e)
		{
			TheBox.Forms.Editors.QuickLocation form = new TheBox.Forms.Editors.QuickLocation();

			if ( form.ShowDialog() == DialogResult.OK )
			{
				Location loc = form.CurrentLocation;

				m_Locations.Add( loc );
				RebuildMenu();
			}
		}