Author Topic: the upper panes are CDialogs?!?  (Read 3328 times)

Offline Nola

  • Active artist
  • *
  • Posts: 10
the upper panes are CDialogs?!?
« on: March 13, 2009, 13:16:52 »
Hello,

I've been doing some hacking on the MPT sources, but I've run into something that has me stumped.

in a regular MFC application, it is impossible [or at least i haven't figured out how yet] to get a CDialog to work as one of the panes of a CSplitterWnd.

I've provided an example visual studio 2008 project to demonstrate the problem. http://www.mediafire.com/?zwrjmnbxujn

HOWEVER! somehow, modplug manages to make the CModCtrlDlg's inherit literally from CDialog and yet still get drawn onscreen...
now, I don't mean regular updates.. like the OnUpdate and UpdateView.
but *only* the fact that it gets any WM_PAINT events at all.

in MFC, a CDialog inside a CSplitter simply doesn't get paint events whatsoever. You are supposed to use CFormView, which MPT does not.

If you look at the classes CModControlDlg, there is nothing there causing it to get painted.. if you comment out stuff like OnSize, you will see that's not causing it to get painted.

If you look at a class like CCtrlComments, you can see that stuff like RecalcLayout does not do any drawing, UpdateView does not do any drawing. Yes it still draws even if I comment out all the code in UpdateView.

I have tried commenting out tons of stuff like CModControlView::UpdateView which does //if ((pDlg) && (pObject != pDlg)) pDlg->UpdateView(lHint, pObject);
and STILL the dialog gets drawn... it just makes no sense how it's working

To make it short, please just check my solution and then you will wonder. How did MPT avoid that problem?

Offline Relabsoluness

  • OpenMPT Developers
  • *****
  • Posts: 709
the upper panes are CDialogs?!?
« Reply #1 on: March 17, 2009, 22:27:53 »
I don't have much to say about this, but this sounds like something that could explain why some controls in the upper panes are not drawn properly every now and then.

Offline Nola

  • Active artist
  • *
  • Posts: 10
the upper panes are CDialogs?!?
« Reply #2 on: March 20, 2009, 06:24:59 »
I can verify after looking into the problem a bit more, that the current implementation is wrong. It causes all kinds of problems with updates, graphic updates, command routing, etc. I don't know how Olivier managed to force it to work. They should be CFormViews.

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,795
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 10 x64
the upper panes are CDialogs?!?
« Reply #3 on: March 20, 2009, 10:15:45 »
Another Reason to switch to something different? :D
ยป No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

Offline Relabsoluness

  • OpenMPT Developers
  • *****
  • Posts: 709
the upper panes are CDialogs?!?
« Reply #4 on: March 21, 2009, 23:30:37 »
Quote from: "Nola"
I can verify after looking into the problem a bit more, that the current implementation is wrong. It causes all kinds of problems with updates, graphic updates, command routing, etc.

This is good to know; thanks for the information.

Offline Relabsoluness

  • OpenMPT Developers
  • *****
  • Posts: 709
the upper panes are CDialogs?!?
« Reply #5 on: March 23, 2009, 19:47:42 »
Quote from: "Nola"
I can verify after looking into the problem a bit more, that the current implementation is wrong. It causes all kinds of problems with updates, graphic updates, command routing, etc. I don't know how Olivier managed to force it to work. They should be CFormViews.

I noticed that the CSplitterWnd documentations says that a pane "can be any CWnd object that has the appropriate child window ID". To be more specific, is the problem in OpenMPT that the CDialogs that are used do not have the appropriate child window ID (and what is it in the first place)?

Offline doveraudio

  • Active artist
  • *
  • Posts: 25
the upper panes are CDialogs?!?
« Reply #6 on: April 01, 2009, 14:30:58 »
i've had fantasies of modplug with a gtk based interface...

(if it was skinnable... modplug would be the most gorgeous host out there... i'm not kidding)