views:

72

answers:

1

I'm asking this because I'm in the process of writing two such editors for my Mega Man engine, one a tileset editor, and another a level editor.

When I say document editor, I mean the superset application type for things like image editors and text editors. All of these share things like toolbars, menu options, and in the case of image editors, and my apps, tool panes. We all know there's tons of advice out there for interface design in these apps, but I'm wondering about programming advice.

Specifically, I'm doubting my code designs with the following things:

  • Many menu options toggle various behaviors. What's the proper way to reliably tie the checked state of the option with the status of the behavior? Sometimes it's more complicated, like options being disabled when there's no document loaded.
  • More and more consensus seems to be against using MDI, but how should I control tool panes? For example, I can't figure out how to get the panels to minimize and maximize along with the main window, like Photoshop does.
  • When tool panels are responsible for a particular part of the document, who actually owns that thing? The main window, or the panel class?
  • How do you do communication between the tool panels and the main window? Currently mine is all event based but it seems like there could be a better way.

This seems to be a common class of gui application, but I've never seen specific pointers on code design for them. Could you please offer whatever advice or experience you have for writing them?

+1  A: 

I guess your "panels" are Windows.Forms.Form's:

If you set their Owner to your main window, they'll automatically minimize when your main window does.

Conrad Albrecht
If I do that, they get constricted to stay within the bounds of the main form. Photoshop panels are free to stay anywhere on the screen, even if the main window is not maximized. I know Photoshop was written in C++ though, maybe there's no way in C#?
Tesserex
No, you're confusing Owner with Parent.
Conrad Albrecht
ah thanks! Exactly what I needed.
Tesserex
Great, now mark my answer "accepted answer" to give me some SO juice. :)
Conrad Albrecht