Author Topic: MAPVIEW upgrade  (Read 257686 times)

Offline kevL

  • Colonel
  • ****
  • Posts: 466
  • pitchforks and torches
    • View Profile
Re: MAPVIEW upgrade
« Reply #570 on: January 17, 2024, 10:09:50 am »
I request an option for directly reading a OXC(E) terrain .rul file in MapView.
Instead of having to use the RulesetConverter initally and re-convert whenever something in the .rul file changes.

hiya, good idea,

unfortunately my flagging health is putting me behind on a bunch of stuff (already) ...

imo, Mapview should get a means of loading (user choice) "MapTilesets" -- if that were done, it'd be a good time to also put in loading a Terrain.rul file. One thing that strikes me right away is disabling a bunch of maptree stuff (so a maptree that's based on a .rul file can't be changed, as you note).

automagically changing the Mapview (global) Basepath is also something to consider (though this can already be done with the Configurator it would be a nice feature, which however necessitates a mechanism to automagically change it back ...) etc.


Personally im glad that Mv2 seems to be stable in its current state, but (for me) this would be a fairly big new feature to implement,

Offline luke83

  • Commander
  • *****
  • Posts: 1558
    • View Profile
    • openxcommods
Re: MAPVIEW upgrade
« Reply #571 on: January 26, 2024, 06:14:10 am »
Good to see your still keeping this dream alive  @kevL i grabbed the newest version last night and shes working great :)

Offline kevL

  • Colonel
  • ****
  • Posts: 466
  • pitchforks and torches
    • View Profile
Re: MAPVIEW upgrade
« Reply #572 on: January 26, 2024, 04:05:59 pm »
luuuuuuuuke !

Offline GumChewer

  • Sergeant
  • **
  • Posts: 38
    • View Profile
Re: MAPVIEW upgrade
« Reply #573 on: January 29, 2024, 08:29:36 pm »
unfortunately my flagging health is putting me behind on a bunch of stuff (already) ...
Hey,

good luck with the health!

I will see what I can code myself and open a pull request. But I'm very short on spare time, so this will not happen soon, sadly.

Offline GumChewer

  • Sergeant
  • **
  • Posts: 38
    • View Profile
Re: MAPVIEW upgrade
« Reply #574 on: March 02, 2024, 12:25:14 pm »
MapView cannot open the options menu for me, on Linux/Mono6/libgdiplus.
Stacktrace attached, but the error seems to be too complicated for me.
It works without the options window too, but I'd love if you find the time to have a look (Sorry for the work...).

Code: [Select]
System.NullReferenceException: Object reference not set to an instance of an object
  at MapView.OptionsF..ctor (System.Object o, MapView.Options options, MapView.OptionableType oType) [0x0006d] in <0a0656103b894489b35d71dc5339306a>:0
  at (wrapper remoting-invoke-with-check) MapView.OptionsF..ctor(object,MapView.Options,MapView.OptionableType)
  at MapView.MainViewF.OnOptionsClick (System.Object sender, System.EventArgs e) [0x00063] in <0a0656103b894489b35d71dc5339306a>:0
  at System.Windows.Forms.MenuItem.OnClick (System.EventArgs e) [0x00019] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at System.Windows.Forms.MenuItem.PerformClick () [0x00000] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.MenuItem.PerformClick()
  at System.Windows.Forms.MenuTracker.OnMouseUp (System.Windows.Forms.MouseEventArgs args) [0x000bf] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at System.Windows.Forms.Control.ProcessActiveTracker (System.Windows.Forms.Message& m) [0x00091] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at System.Windows.Forms.Control.WmLButtonUp (System.Windows.Forms.Message& m) [0x00015] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x001b4] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at System.Windows.Forms.ScrollableControl.WndProc (System.Windows.Forms.Message& m) [0x00000] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at System.Windows.Forms.ContainerControl.WndProc (System.Windows.Forms.Message& m) [0x00027] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at System.Windows.Forms.Form.WndProc (System.Windows.Forms.Message& m) [0x00166] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x0000b] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at System.Windows.Forms.NativeWindow.WndProc (System.IntPtr hWnd, System.Windows.Forms.Msg msg, System.IntPtr wParam, System.IntPtr lParam) [0x00085] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
#
« Last Edit: March 02, 2024, 12:29:02 pm by GumChewer »

Offline GumChewer

  • Sergeant
  • **
  • Posts: 38
    • View Profile
Re: MAPVIEW upgrade
« Reply #575 on: March 02, 2024, 12:27:36 pm »
And ...  ;D ... it also crashes when I use the mouse wheel.

Code: [Select]
Unhandled Exception:
System.EntryPointNotFoundException: WindowFromPoint assembly:<unknown assembly> type:<unknown type> member:(null)
  at (wrapper managed-to-native) MapView.MainViewF.WindowFromPoint(System.Drawing.Point)
  at MapView.MainViewF.PreFilterMessage (System.Windows.Forms.Message& m) [0x00020] in <0a0656103b894489b35d71dc5339306a>:0
  at System.Windows.Forms.Application.FilterMessage (System.Windows.Forms.Message& message) [0x0001f] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at System.Windows.Forms.Application.RunLoop (System.Boolean Modal, System.Windows.Forms.ApplicationContext context) [0x000e9] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at System.Windows.Forms.Application.Run (System.Windows.Forms.ApplicationContext context) [0x00011] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at System.Windows.Forms.Application.Run (System.Windows.Forms.Form mainForm) [0x00006] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at MapView.Start.Start_init () [0x00021] in <0a0656103b894489b35d71dc5339306a>:0
  at MapView.Program.Main (System.String[] args) [0x00033] in <0a0656103b894489b35d71dc5339306a>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.EntryPointNotFoundException: WindowFromPoint assembly:<unknown assembly> type:<unknown type> member:(null)
  at (wrapper managed-to-native) MapView.MainViewF.WindowFromPoint(System.Drawing.Point)
  at MapView.MainViewF.PreFilterMessage (System.Windows.Forms.Message& m) [0x00020] in <0a0656103b894489b35d71dc5339306a>:0
  at System.Windows.Forms.Application.FilterMessage (System.Windows.Forms.Message& message) [0x0001f] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at System.Windows.Forms.Application.RunLoop (System.Boolean Modal, System.Windows.Forms.ApplicationContext context) [0x000e9] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at System.Windows.Forms.Application.Run (System.Windows.Forms.ApplicationContext context) [0x00011] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at System.Windows.Forms.Application.Run (System.Windows.Forms.Form mainForm) [0x00006] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at MapView.Start.Start_init () [0x00021] in <0a0656103b894489b35d71dc5339306a>:0
  at MapView.Program.Main (System.String[] args) [0x00033] in <0a0656103b894489b35d71dc5339306a>:0

Offline kevL

  • Colonel
  • ****
  • Posts: 466
  • pitchforks and torches
    • View Profile
Re: MAPVIEW upgrade
« Reply #576 on: March 02, 2024, 12:56:18 pm »
sorry i don't warantee Mono, but if you find a solution ...

Offline kevL

  • Colonel
  • ****
  • Posts: 466
  • pitchforks and torches
    • View Profile
Re: MAPVIEW upgrade
« Reply #577 on: March 02, 2024, 01:08:22 pm »
And ...  ;D ... it also crashes when I use the mouse wheel.

Code: [Select]
Unhandled Exception:
System.EntryPointNotFoundException: WindowFromPoint assembly:<unknown assembly> type:<unknown type> member:(null)
  at (wrapper managed-to-native) MapView.MainViewF.WindowFromPoint(System.Drawing.Point)
  at MapView.MainViewF.PreFilterMessage (System.Windows.Forms.Message& m) [0x00020] in <0a0656103b894489b35d71dc5339306a>:0
  at System.Windows.Forms.Application.FilterMessage (System.Windows.Forms.Message& message) [0x0001f] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at System.Windows.Forms.Application.RunLoop (System.Boolean Modal, System.Windows.Forms.ApplicationContext context) [0x000e9] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at System.Windows.Forms.Application.Run (System.Windows.Forms.ApplicationContext context) [0x00011] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at System.Windows.Forms.Application.Run (System.Windows.Forms.Form mainForm) [0x00006] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at MapView.Start.Start_init () [0x00021] in <0a0656103b894489b35d71dc5339306a>:0
  at MapView.Program.Main (System.String[] args) [0x00033] in <0a0656103b894489b35d71dc5339306a>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.EntryPointNotFoundException: WindowFromPoint assembly:<unknown assembly> type:<unknown type> member:(null)
  at (wrapper managed-to-native) MapView.MainViewF.WindowFromPoint(System.Drawing.Point)
  at MapView.MainViewF.PreFilterMessage (System.Windows.Forms.Message& m) [0x00020] in <0a0656103b894489b35d71dc5339306a>:0
  at System.Windows.Forms.Application.FilterMessage (System.Windows.Forms.Message& message) [0x0001f] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at System.Windows.Forms.Application.RunLoop (System.Boolean Modal, System.Windows.Forms.ApplicationContext context) [0x000e9] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at System.Windows.Forms.Application.Run (System.Windows.Forms.ApplicationContext context) [0x00011] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at System.Windows.Forms.Application.Run (System.Windows.Forms.Form mainForm) [0x00006] in <b2f5ba339bd244a2a072fe9fd5539e2f>:0
  at MapView.Start.Start_init () [0x00021] in <0a0656103b894489b35d71dc5339306a>:0
  at MapView.Program.Main (System.String[] args) [0x00033] in <0a0656103b894489b35d71dc5339306a>:0

The mousewheel issue likely has to do with Forms/MainView/MainViewF (near the top). I don't have Mono and I'm not absolutely positive about the __MonoCS__ flag. This bit of code (and associated stuff perhaps) allows windows to capture the mousewheel even if a control is not currently focused. Did you build against mono yourself, because if you're relying on a build against .NET well ... this is the kind of stuff that would throw ... or so it seems to me

Code: [Select]
#if !__MonoCS__
#region P/Invoke declarations
[DllImport("user32.dll")]
static extern IntPtr WindowFromPoint(Point pt);

[DllImport("user32.dll")]
static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp);
#endregion P/Invoke declarations

#region IMessageFilter
/// <summary>
/// Sends mousewheel messages to the control that the mouse-cursor is
/// hovering over.
/// </summary>
/// <param name="m">the message</param>
/// <returns>true if a mousewheel message was handled successfully</returns>
/// <remarks>https://stackoverflow.com/questions/4769854/windows-forms-capturing-mousewheel#4769961</remarks>
public bool PreFilterMessage(ref Message m)
{
if (m.Msg == 0x20a)
{
// WM_MOUSEWHEEL - find the control at screen position m.LParam
var pos = new Point(m.LParam.ToInt32());

IntPtr hWnd = WindowFromPoint(pos);
if (hWnd != IntPtr.Zero && hWnd != m.HWnd && Control.FromHandle(hWnd) != null)
{
SendMessage(hWnd, m.Msg, m.WParam, m.LParam);
return true;
}
}
return false;
}
#endregion IMessageFilter
#endif

Offline GumChewer

  • Sergeant
  • **
  • Posts: 38
    • View Profile
Re: MAPVIEW upgrade
« Reply #578 on: March 02, 2024, 06:08:24 pm »
sorry i don't warantee Mono, but if you find a solution ...

Thanks for the fast answer and sorry for forgetting about the warranty!

Offline GumChewer

  • Sergeant
  • **
  • Posts: 38
    • View Profile
Re: MAPVIEW upgrade
« Reply #579 on: March 02, 2024, 06:11:40 pm »
The mousewheel issue likely has to do with Forms/MainView/MainViewF (near the top). I don't have Mono and I'm not absolutely positive about the __MonoCS__ flag. This bit of code (and associated stuff perhaps) allows windows to capture the mousewheel even if a control is not currently focused. Did you build against mono yourself, because if you're relying on a build against .NET well ... this is the kind of stuff that would throw ... or so it seems to me

Code: [Select]
#if !__MonoCS__
#region P/Invoke declarations
[DllImport("user32.dll")]
static extern IntPtr WindowFromPoint(Point pt);

[DllImport("user32.dll")]
static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp);
#endregion P/Invoke declarations

#region IMessageFilter
/// <summary>
/// Sends mousewheel messages to the control that the mouse-cursor is
/// hovering over.
/// </summary>
/// <param name="m">the message</param>
/// <returns>true if a mousewheel message was handled successfully</returns>
/// <remarks>https://stackoverflow.com/questions/4769854/windows-forms-capturing-mousewheel#4769961</remarks>
public bool PreFilterMessage(ref Message m)
{
if (m.Msg == 0x20a)
{
// WM_MOUSEWHEEL - find the control at screen position m.LParam
var pos = new Point(m.LParam.ToInt32());

IntPtr hWnd = WindowFromPoint(pos);
if (hWnd != IntPtr.Zero && hWnd != m.HWnd && Control.FromHandle(hWnd) != null)
{
SendMessage(hWnd, m.Msg, m.WParam, m.LParam);
return true;
}
}
return false;
}
#endregion IMessageFilter
#endif
__MonoCS__ is no longer defined, by the default compiler, since Mono version 5.
Even if, as you already noted, compiler and runtime might differ.

I have opened a pull-request which checks for Mono at runtime. If, it does not activate the mouse wheel filtering and prints a message to the console.

This needs reconsidering if ever WindowFromPoint, and maybe sendMessage, gets to works with Mono.
It would be safer to runtime-check if that function exists or implement the mouse wheeling differently.
But that is totally out of my league/time at the moment.

It should work flawlessly on Windows / .Net, but I cannot test that.

Anyway, have a nice weekend!
« Last Edit: March 02, 2024, 06:14:27 pm by GumChewer »

Offline kevL

  • Colonel
  • ****
  • Posts: 466
  • pitchforks and torches
    • View Profile
Re: MAPVIEW upgrade
« Reply #580 on: March 02, 2024, 11:13:36 pm »
Thanks, you too.

ps. good luck with the other one (i cant make heads or tails of it)

if u really can't access options, the config files can be edited ... I suspect that the problem is not with Options per se, but with instantiating the propertypanel for user input
« Last Edit: March 02, 2024, 11:20:40 pm by kevL »