TheMonsterFromTheDeep / vague

Java-based image editor
0 stars 0 forks source link

Modules are a big mess right now #3

Closed TheMonsterFromTheDeep closed 8 years ago

TheMonsterFromTheDeep commented 9 years ago

The module system is workable, but needs a lot of work. The new plan is a system where there is a hierarchy of modules each contained in a container which is also a module. These containers are each split into to separate modules, which can either be more containers or individual modules. Right now the containers are being set up to hold two modules stacked either vertically or horizontally but I think I am going to expand them to hold more. However, I think stacking in one direction should work well. Each module container can then of course be split further.

I think mouse events should be passed through relative corners. Figuring out how to calculate this is messy so I am going to do some drawing.

I am not sure whether render position should be relative to window top corner or to each container's top corner. I think I might do container top corner but I am going to have to do more maths in that case - however it should overall be better.

All module enhancements are under the modules-enhance branch.

TheMonsterFromTheDeep commented 9 years ago

Modules are doing much better now. There is a basic system where modules can be resized and other things..

Now: Modules need to be cleaned up, and drawing code needs to be optimized. There is also a glitch where the resize arrows will not be drawn correctly when near an intersection between module containers.

Here is a screenshot of what modules look like so far: modules-enchance screenshot 1 All the modules in this image are "Editor" modules - the actual image editor. These modules are what are used to edit the images themselves. These are the only modules I have built so far aside from the module pane, so they are the ones that are used.

Most modules inside the application will be of a special type of module that has a bar at the bottom with an icon which can be used to switch what that module controls. It will also have controls to split the window into multiple other windows. It will then have a child module of the type that it is supposed to contain.

In terms of cleaning up code, there is a lot to be done. The module system is much better but still unbelievably messy. Most of the messiness comes from the way parenting works and how an overloaded ModulePane is used as the top-level pane. I am going to work out a better way to do the parenting system and implement it. I also think that I am going to make another overloaded class as the top-level pane which uses special methods in order to draw the window.

I also need to figure out how to make constant user input more efficient. Part of the problem is that running a constant loop is very memory-consuming, especially on the laptop I am using. I think just making the loop check for mouse moves and then communicating those might make things faster so that a bunch of unnecessary checks and other things don't have to be made and run every single loop - only those where the mouse is moved.

This, of course, will require a large re-implementation of how all the mouse event things are handled. This shouldn't be too difficult but will require a bit of rethinking.

I also don't like the MouseTracker class very much. I think I am going to try to think of a better way to implement tracking the mouse.

After I am done re-doing the parenting system and the mouse events, I think the next step is to make the modules that the user controls the display of.

For the parenting, I think it might be beneficial to implement a globally used parenting system, then a sort of container subclass, and then finally the different types of containers.

I'm going to merge module-enhance into master and then make a new branch called "container-system" where I will begin the parenting system changes.

TheMonsterFromTheDeep commented 8 years ago

This is really no longer relevant because of the new code system.