Author Topic: MAPVIEW  (Read 11503 times)

Offline MadHaTr

  • Sergeant
  • **
  • Posts: 18
    • View Profile
MAPVIEW
« on: April 21, 2017, 05:26:23 pm »
Edit - Am now working on the code and asking for help on a few things, see below.

Hello,

I am attempting to figure out how to use the program mapview. I seem to have it somewhat figured out.  I am curious about a few things which I consider to be bugs or just odd features.  I have compiled from the latest (as of 11:00 Atlantic Time April 21) KevL git (https://github.com/kevL/OpenXCOM.Tools).

When I open the first 3 UFO's in the vanilla OXC they seem to be corrupted. (attached files)

When I have any other window open (Tile view) the selction behaviour on the main window changes to selecting of rectangular areas (think drag selection of area) while only click different tiles, thus making it impossible for me to edit maps with the tile view window open.  Also I lose all control of the window, I can no longer select any buttons. (attached files)

Are there no hotkeys for the editing functions (fill, copy and cut) took me forever to realise I needed to be hitting these windows buttons up top to edit, I figured a good double click or a ctrl-v would be the way to do it.  (maybe this is a bug, related to previous said behaviour)

Is there no undo function?

Thanks guys, appreciate your help.



« Last Edit: April 22, 2017, 04:55:32 pm by MadHaTr »

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: MAPVIEW
« Reply #1 on: April 21, 2017, 06:24:40 pm »
Hello,

I am attempting to figure out how to use the program mapview. I seem to have it somewhat figured out.  I am curious about a few things which I consider to be bugs or just odd features.  I have compiled from the latest (as of 11:00 Atlantic Time April 21) KevL git (https://github.com/kevL/OpenXCOM.Tools).

Wasn't aware that someone is still working on Map View. I use this version, which isn't the latest one listed on that thread (since I prefer the older visual display)


Quote
When I open the first 3 UFO's in the vanilla OXC they seem to be corrupted. (attached files)

They are unused .map files that come included with the original game, so there's nothing wrong with them not working on Map View

Quote
When I have any other window open (Tile view) the selction behaviour on the main window changes to selecting of rectangular areas (think drag selection of area) while only click different tiles, thus making it impossible for me to edit maps with the tile view window open.  Also I lose all control of the window, I can no longer select any buttons. (attached files)

Are there no hotkeys for the editing functions (fill, copy and cut) took me forever to realise I needed to be hitting these windows buttons up top to edit, I figured a good double click or a ctrl-v would be the way to do it.  (maybe this is a bug, related to previous said behaviour)

Is there no undo function?

Thanks guys, appreciate your help.

There's no undo function and I've probably got so used to the other issues you mention that I don't notice them anymore. Map View is definitely not perfect, but I've been using it for more than 10 years and it is still a very useful tool (and the only one) for map editing

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11722
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: MAPVIEW
« Reply #2 on: April 21, 2017, 06:46:56 pm »
KevL is actually a very nice guy, his thread on the MapView (okay, I started it) is here: https://github.com/pmprog/OpenXCOM.Tools/issues/17

He's currently working on refactoring the program and probably wouldn't mind some more input.

Offline MadHaTr

  • Sergeant
  • **
  • Posts: 18
    • View Profile
Re: MAPVIEW
« Reply #3 on: April 22, 2017, 04:54:34 pm »
Okay cool,  it seems KevL has been pretty active on his fork which is nice to see.  I made my own fork (https://github.com/madhatr/OpenXCOM.Tools) to get more acquainted with the code.  Not going to give any illusions, this shit is above my paygrade.  Especially whatever is doing all the rendering and array setup for the pictures/tiles and what not.  What I am ok with is the forms part. Currently my goal is to add hotkey functionality, if you check the fork so far I've just been fixing cosmetic stuff, and some old code that doesn't seem to be needed anymore. 

I do need some help here though, I got stuck.  The(cut, copy, fill) buttons (toolstripbuttons) were all made manually in a separate .cs file. 
Spoiler EditButtonsFactory.cs:
Code: [Select]
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;

using MapView.Properties;


namespace MapView.Forms.MainWindow
{
internal sealed class EditButtonsFactory
{
private readonly MainViewPanel _mainViewPanel;

private readonly List<ToolStripButton> _pasteButtons = new List<ToolStripButton>();


public EditButtonsFactory(MainViewPanel panel)
{
_mainViewPanel = panel;
}

        /// <summary>
        /// Adds buttons for Up,Down,Cut,Copy,Paste and Fill to the specified
        /// toolstrip as well as sets some properties for the toolstrip.
        /// </summary>
        /// <param name="toolStrip"></param>
        public void BuildEditStrip(ToolStrip toolStrip)
{
//
// toolStripButtons
//
//var tssDivider1 = new ToolStripSeparator();
var tsbUp       = new ToolStripButton();
var tsbDown     = new ToolStripButton();
//var tssDivider2 = new ToolStripSeparator();
var tsbCut      = new ToolStripButton();
var tsbCopy     = new ToolStripButton();
var tsbPaste    = new ToolStripButton();
//var tssDivider3 = new ToolStripSeparator();
var tsbFill     = new ToolStripButton();
//var tssDivider4 = new ToolStripSeparator();
//
// toolStrip
//
var tsItems = new ToolStripItem[] // NOTE: c# cant figure out how to use 1 separator 3 times.  //Just created them on the fly in the array MadHaTr 4/21/2017
{
                new ToolStripSeparator(),
tsbUp,
tsbDown,
                new ToolStripSeparator(),
tsbCut,
tsbCopy,
tsbPaste,
                new ToolStripSeparator(),
tsbFill,
                new ToolStripSeparator()
            };
toolStrip.Items.AddRange(tsItems);
//
// tsbUp
//
tsbUp.AutoSize = false;
tsbUp.DisplayStyle = ToolStripItemDisplayStyle.Image;
tsbUp.ImageScaling = ToolStripItemImageScaling.None;
tsbUp.ImageTransparentColor = Color.Magenta;
tsbUp.Name = "tsbUp";
tsbUp.Size = new Size(25, 25);
// tsbUp.Text = "Level Up";
tsbUp.ToolTipText = "Level Up";
tsbUp.Click += OnUpClick;
//
// tsbDown
//
tsbDown.AutoSize = false;
tsbDown.DisplayStyle = ToolStripItemDisplayStyle.Image;
tsbDown.ImageScaling = ToolStripItemImageScaling.None;
tsbDown.ImageTransparentColor = Color.Magenta;
tsbDown.Name = "tsbDown";
tsbDown.Size = new Size(25, 25);
// tsbDown.Text = "Level Down";
tsbDown.ToolTipText = "Level Down";
tsbDown.Click += OnDownClick;
//
// tsbCut
//
tsbCut.AutoSize = false;
tsbCut.DisplayStyle = ToolStripItemDisplayStyle.Image;
tsbCut.ImageScaling = ToolStripItemImageScaling.None;
tsbCut.ImageTransparentColor = Color.Magenta;
tsbCut.Name = "tsbCut";
tsbCut.Size = new Size(25, 25);
// tsbCut.Text = "Cut";
tsbCut.ToolTipText = "Cut";
tsbCut.Click += (sender, e) =>
{
EnablePasteButton();
_mainViewPanel.OnCut(sender, e);
Refresh();
};
//
// tsbCopy
//
tsbCopy.AutoSize = false;
tsbCopy.DisplayStyle = ToolStripItemDisplayStyle.Image;
tsbCopy.ImageScaling = ToolStripItemImageScaling.None;
tsbCopy.ImageTransparentColor = Color.Magenta;
tsbCopy.Name = "tsbCopy";
tsbCopy.Size = new Size(25, 25);
// tsbCopy.Text = "Copy";
tsbCopy.ToolTipText = "Copy";
tsbCopy.Click += (sender, e) =>
{
EnablePasteButton();
_mainViewPanel.OnCopy(sender, e);
};
//
// tsbPaste
//
tsbPaste.AutoSize = false;
tsbPaste.DisplayStyle = ToolStripItemDisplayStyle.Image;
tsbPaste.ImageScaling = ToolStripItemImageScaling.None;
tsbPaste.ImageTransparentColor = Color.Magenta;
tsbPaste.Name = "tsbPaste";
tsbPaste.Size = new Size(25, 25);
// tsbPaste.Text = "Paste";
tsbPaste.ToolTipText = "Paste";
tsbPaste.Click += (sender, e) =>
{
_mainViewPanel.OnPaste(sender, e);
Refresh();
};
tsbPaste.Enabled = false;
_pasteButtons.Add(tsbPaste);
//
// tsbFill
//
tsbFill.AutoSize = false;
tsbFill.DisplayStyle = ToolStripItemDisplayStyle.Text;
tsbFill.Name = "tsbFill";
tsbFill.Size = new Size(25, 25);
tsbFill.Text = "Fill";
tsbFill.ToolTipText = "Fill";
tsbFill.Click += (sender, e) =>
{
_mainViewPanel.OnFill(sender, e);
Refresh();
};
tsbUp.Image    = Resources.up;
tsbDown.Image  = Resources.down;
tsbCut.Image   = Resources.cut;
tsbCopy.Image  = Resources.copy;
tsbPaste.Image = Resources.paste;
// tsbFill.Image  = ; // TODO: embed a Fill image.
}

private static void Refresh()
{
// MainViewPanel.Instance.Refresh(); // either this
MainViewPanel.Instance.MainView.Refresh(); // or this, both works

ViewerFormsManager.TopView.Refresh();
ViewerFormsManager.RouteView.Refresh();

// TODO: refresh TopRouteView (both Top & Route panels) also.
}

/// <summary>
/// Enables the paste button in each viewer after cut or copy is clicked.
/// </summary>
private void EnablePasteButton()
{
foreach (var tsb in _pasteButtons)
tsb.Enabled = true;
}

private void OnDownClick(object sender, EventArgs e)
{
if (MainViewPanel.Instance.MainView.Map != null)
MainViewPanel.Instance.MainView.Map.Down();
}

private void OnUpClick(object sender, EventArgs e)
{
if (MainViewPanel.Instance.MainView.Map != null)
MainViewPanel.Instance.MainView.Map.Up();
}
}
}
 

I am used to the designer creating the buttons and having them inside the main form class which I think of as the main program loop. In this case it would be XCMainWindow() inside this .cs file
Spoiler XCMainWindow.cs:

Hit the char limit of the forum, so here is the link to the next file.
https://github.com/madhatr/OpenXCOM.Tools/blob/master/MapView/Forms/MainWindow/XCMainWindow.cs

My problem is I have/had a couple lines of code to detect keypresses in the main form file, and if a key is pressed it would trigger the   .click functionality of the button.  Problem is since they are in different files they are in different scopes? so when I try to trigger the buttons .click from inside the main loop (XCMainWindow()) it had no idea what I am talking about cause in its eye it does not exist.

Usually I think anyway, you could just make these functions/variables public and they would be available to the other files(classes? methods?)  Though the EditButtonsFactory.cs class is declared in a way I do no understand I guess.  I've not very good with classes and it gets worse when they are across different files.

I can just redo all the buttons in main cs file but I don't want to get to far away from KevL's code if he wants to merge my other smaller cosmetic fixes in.  Also new to GitHub so not really sure how its controlled.

So anyway, anyone who thinks they can offer solution, feel free to do so.  I spent all day yesterday messing around with this stuff.  It can be fun.
« Last Edit: April 22, 2017, 04:56:17 pm by MadHaTr »

Offline mrcalzon02

  • Sergeant
  • **
  • Posts: 28
    • View Profile
Re: MAPVIEW
« Reply #4 on: August 27, 2017, 11:42:06 am »
*casts* Raise Dead.

um, im using mapeditor for the lateest master tools git, trying to buildsome xcom base maps, and well, how do i say this, how do i make off map links? for the pathing?
im slightly lost there, otherwise i'm poking along just fine...(Currently working on the XCom Hydroponics Tile From the sprite pack i just put up... in the mean time ill just keep building the maps till i can figure out the route links...
« Last Edit: August 27, 2017, 11:50:11 am by mrcalzon02 »

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11722
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: MAPVIEW
« Reply #5 on: August 27, 2017, 12:24:47 pm »
I suppose you're asking about this:



You just select ExitEast on the node.

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: MAPVIEW
« Reply #6 on: August 27, 2017, 03:41:16 pm »
I've just tried kevL's Map View 2 but I'm still suffering from the same issue as before: if any additional windows (Top, Route, etc.) are open I can only switch between maps on the main window if I close all the additional windows

This is annoying since I usually work on several maps at the same time so I'm wondering if anyone also suffering from this issue, or if there's a solution to it (tried already a ton of things)

PS - I suspect that this is related to the .NET version. I'm running Windows 10 and until last year I had no issues with MapView then suddenly this issue appeared. kevL's MapView 2 uses .NET 3.5 which is rather old (Microprose lists it for Windows XP) but it is impossible for me to switch to this .NET version because Windows 10 already has .NET included.
« Last Edit: August 27, 2017, 05:39:29 pm by Hobbes »

Offline SteamXCOM

  • Colonel
  • ****
  • Posts: 150
    • View Profile
Re: MAPVIEW
« Reply #7 on: August 27, 2017, 06:17:18 pm »
I've just tried kevL's Map View 2 but I'm still suffering from the same issue as before: if any additional windows (Top, Route, etc.) are open I can only switch between maps on the main window if I close all the additional windows
 

That goes back to what we were discussing here, Hobbes:
https://openxcom.org/forum/index.php/topic,1321.195.html

I have a windows 7 computer I purchased  specifically for other other older programs because of compatibility issues and migrated my OpenXcom install  specifically to escape that MapView issue that cropped up when I was editing the LIGHTNINGs.  Previously MapView was working fine on Win 8.1.

I do not know how well Mapview might work in a virtual install of XP or win 7, that could be an answer if you know how to use those  (the best answer of course is an update to have MAPview working again).

https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/create-virtual-machine

From what I gather you need a license for Win 7, which you probably already have. 

« Last Edit: August 27, 2017, 06:25:54 pm by SteamXCOM »

Offline mrcalzon02

  • Sergeant
  • **
  • Posts: 28
    • View Profile
Re: MAPVIEW
« Reply #8 on: August 28, 2017, 07:44:03 am »
So how do i  Get the link data tab to not be greyed out?
« Last Edit: August 28, 2017, 07:47:32 am by mrcalzon02 »

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11722
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: MAPVIEW
« Reply #9 on: August 28, 2017, 10:53:11 am »
So you click on the node and can't edit it?

Sorry, it's the first time I've seen this. What MapView version are you using?

Offline mrcalzon02

  • Sergeant
  • **
  • Posts: 28
    • View Profile
Re: MAPVIEW
« Reply #10 on: August 29, 2017, 12:46:03 am »
openxcom_git_master_2017_08_24_0001 that one, the things is , sometimes it seams to work exaclty as it should and i can edit link data just as you showed, but alot of the time its just greyed out for no describable reason. :( Sorry i may have broken space-time again.

Offline SteamXCOM

  • Colonel
  • ****
  • Posts: 150
    • View Profile
Re: MAPVIEW
« Reply #11 on: August 29, 2017, 02:25:55 am »
sometimes it seams to work exaclty as it should and i can edit link data just as you showed, but alot of the time its just greyed out for no describable reason.

What operating system are you using?

Offline mrcalzon02

  • Sergeant
  • **
  • Posts: 28
    • View Profile
Re: MAPVIEW
« Reply #12 on: August 29, 2017, 08:14:01 am »
Win7, also  how do i tell what my tile/tileset limits are at for the map i'm working on? is there a display or counter for that?