First thoughts on scriptkid's layout editor code

Use this forum for:
- Discussion regarding unofficial CEGUI related tools, scripts and utilities.
- User to user help for the obsoleted CELayoutEditor and CEImagesetEditor tools.

Moderators: CEGUI MVP, CEGUI Team

User avatar
sammydre
Just popping in
Just popping in
Posts: 14
Joined: Wed Jan 12, 2005 12:06
Location: Hamilton, New Zealand
Contact:

First thoughts on scriptkid's layout editor code

Postby sammydre » Tue Jan 25, 2005 09:53

I made some notes as I was editing the code. My mission was the implement alignment functionality - so you select a few controls, hit "Align left" and all the windows are moved to the X position of the first window selected.

I've got this working, but had to make a bit of a nasty change. The CSelection class didn't allow me to get at the selected window list as I wanted - because I wanted a reverse iterator, so I could get at the first window selected first. I modified this class to have a "SelectedWindows & getSelectedWindows ()" method. I'm wondering if there was a reason it wasn't implemented this way in the first place, though?

Would be nice to easily get at a resizer for a given window in the CSelection class. This isn't too much of an issue; it was just a thought as I was moving windows about in my alignment code.

An issue I noticed: redrawing problems - sometimes fails to redraw entirely and you have to quit. Also, after you've loaded a layout, it doesn't redraw immediately. Looking at the code, it looks as if it *should* redraw at this point. So I'm not sure why it isn't happening. Haven't looked into debugging this just yet.

I wasn't entirely sure where I should add further functionality - I added menu options for alignment, then added their message handler code in the CCELayoutEditorView class.

I'm thinking that the most useful feature to add right now would be "undo" functionality. I haven't thought about how this should be implemented just yet. Maybe someone else has some thoughts on this.

All in all, seems like a good codebase for further work. Well done on getting it this far!
Sam Jansen - Bung developer: http://bung.homeunix.net/

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Re: First thoughts on scriptkid's layout editor code

Postby scriptkid » Tue Jan 25, 2005 11:54

Hi,

indeed, the selection uses "push_front". Can't remember why. You can just change it to "push_back" if you want.

The re-draw problem is still a mistery to me as well. It *should* work ;-)

To keep the View maintainable, its maybe an idea to put a class between your handlers and the selection, e.g. a SelectionMover or something like that. We can later also use it to put keyboard moving through, which is an important request.

Thanks for you compliments on the codebase so far :-)

User avatar
sammydre
Just popping in
Just popping in
Posts: 14
Joined: Wed Jan 12, 2005 12:06
Location: Hamilton, New Zealand
Contact:

Re: First thoughts on scriptkid's layout editor code

Postby sammydre » Tue Jan 25, 2005 19:38

I think changing the CSelection class to allow others to get a reference to the list of selected windows is fine, that way we don't limit any code in the future from going forwards or backwards through the list.

SelectionMover sounds good to me. I'll look into that when I next get some time to code. Hopefully I should have some patches that add my alignment functionality in soon for you. Maybe in a few days time. Then adding the keyboard moving in will be trivial.

Oh, I remembered I had one more question:

I use MSVC 7.0, which has different project files to 6.0. At the moment I just had MSVC convert the existing 6.0 project files to an MSVC 7.0 solution. That is fine until I need to make changes to the project files - add new files or whatever.

I'm not sure how to maintain project files for multiple versions of MSVC. I notice CEGUI has project files for 6.0, 7.0 and 7.1. How does CEGUI keep these files up to date?
Sam Jansen - Bung developer: http://bung.homeunix.net/

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Re: First thoughts on scriptkid's layout editor code

Postby scriptkid » Tue Jan 25, 2005 20:39

I think changing the CSelection class to allow others to get a reference to the list of selected windows is fine, that way we don't limit any code in the future from going forwards or backwards through the list.


That's fine, but for the moment there already is a WindowIterator, right?

Patching it would be cool! However, you may also update the project yourself. You need to send me your sourceforge loginname then. Just let me know if you'd like that.

The MSVC question is a good one. I think Eddie has more than one version of VS.

Maybe it's best if you just commit new files and i'll make the project changes. I'll see if i can use the VS 7 copy from my work to solve this issue, ok?

User avatar
sammydre
Just popping in
Just popping in
Posts: 14
Joined: Wed Jan 12, 2005 12:06
Location: Hamilton, New Zealand
Contact:

Re: First thoughts on scriptkid's layout editor code

Postby sammydre » Tue Jan 25, 2005 22:33

That's fine, but for the moment there already is a WindowIterator, right?


Yeah, the problem was that it is a forward iterator not a reverse iterator. Might as well not limit this to just forwards.

Patching it would be cool! However, you may also update the project yourself. You need to send me your sourceforge loginname then. Just let me know if you'd like that.


Ok, I'll message you when I figure out what my username and login was. Been a while since I used it :)

The MSVC question is a good one. I think Eddie has more than one version of VS.

Maybe it's best if you just commit new files and i'll make the project changes. I'll see if i can use the VS 7 copy from my work to solve this issue, ok?


Yeah, ok. If I add any files I'll tell you and you can change the MSVC 6.0 project files. Doesn't sound like the most maintainable way of doing things, though.
Sam Jansen - Bung developer: http://bung.homeunix.net/

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: First thoughts on scriptkid's layout editor code

Postby CrazyEddie » Wed Jan 26, 2005 09:32

I think Eddie has more than one version of VS

Indeed I do. I have VC++ 6.0 and VS.NET 2003 (VC++ 7.1). VS.NET'03 is currently my primary development platform, I usually only use VC++ 6 when someone has been having problems for an extented time (just to check it isn't something I broke). I don't really have access to VC 7.0, though occasionally I have managed to, though that's a decidedly grey area.

I notice CEGUI has project files for 6.0, 7.0 and 7.1. How does CEGUI keep these files up to date?

Everything is done in the VC++ 7.1 'master' version, then the other projects are updated with a text editor afterwards - technical stuff, eh?! ;)

CE.

User avatar
TheGilb
Just popping in
Just popping in
Posts: 4
Joined: Fri Jan 28, 2005 11:17

Re: First thoughts on scriptkid's layout editor code

Postby TheGilb » Fri Jan 28, 2005 11:28

Hi there I'm just posting a little thing here about the undo functionality. I am aware of a design pattern called the command pattern which would work well here. The idea is that you make an interface (Command) and derive a subclass for every possible doable action and pop the code to perform the action in an abstract method such as 'exec'. The program keeps a stack of command objects as they get executed. Now when the user clicks undo, the first element on the stack is popped off and its 'unexec' command is executed which contains code to effectively undo the command.

It's a little bit more complex than that, but there it is in a nutshell :) My reference is Design Patterns (GoF)

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Re: First thoughts on scriptkid's layout editor code

Postby scriptkid » Fri Jan 28, 2005 13:09

Hi,

thanks for the suggestion :-)

I am aware of that pattern too, heck i'm using it at work ATM :-) But i never thought of it with regards to 'undo'ing. You're right, it gets complex soon, especially with deleting or pasting. But i / we will think about it.

User avatar
sammydre
Just popping in
Just popping in
Posts: 14
Joined: Wed Jan 12, 2005 12:06
Location: Hamilton, New Zealand
Contact:

Re: First thoughts on scriptkid's layout editor code

Postby sammydre » Mon Jan 31, 2005 10:28

scriptkid wrote:

I am aware of that pattern too, heck i'm using it at work ATM :-) But i never thought of it with regards to 'undo'ing. You're right, it gets complex soon, especially with deleting or pasting. But i / we will think about it.


It is the only way I had thought up of doing things. Seems like a fairly logical approach to take.

Well, I finally got around to comitting my code. Have a look. You'll need to add the SelectionMover.cpp code to the project files.

Is there any sort of TODO list or wish list for the layout editor yet?
Sam Jansen - Bung developer: http://bung.homeunix.net/

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Re: First thoughts on scriptkid's layout editor code

Postby scriptkid » Tue Feb 01, 2005 10:02

Hi!

Thanks for submitting your code. I'll certainly have a look :-)

I have an excel sheet which contains bugs and feature requests.

I'm not sure how it will behave in CVS though, since its binary. But i can check that file in.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: First thoughts on scriptkid's layout editor code

Postby CrazyEddie » Tue Feb 01, 2005 13:25

scriptkid wrote:
I have an excel sheet... I'm not sure how it will behave in CVS though, since its binary. But i can check that file in.

It should be okay so long as you check it in as a binary file as opposed to text.

CE

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Re: First thoughts on scriptkid's layout editor code

Postby scriptkid » Tue Feb 01, 2005 21:24

Hi,

i have had a look, but i couldn't compile. It seems that your forgot to commit "selection.h". I'm curious in seeing it work :-)

Now time for a little nagging ;-)

To avoid this compile errors, can you try to make a temporary clean checkout and see if compiles? I think it's possible considering the projects' size.

Which editor did you use, because your files only contain one carriage return, which makes the files pretty unreadable. Can you try to re-commit them?

Thanks so far and keep up the coding! :-)

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Re: First thoughts on scriptkid's layout editor code

Postby scriptkid » Tue Feb 01, 2005 21:31

Yeah, i wasn't clear enough. I know about the binary addition, but i'm not sure how it deals with differences in binary files.

It's checked in anyhow. In the Docs\Project folder, which can be used to add more project related files, such as design documents.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: First thoughts on scriptkid's layout editor code

Postby CrazyEddie » Wed Feb 02, 2005 09:24

scriptkid wrote:
Yeah, i wasn't clear enough. I know about the binary addition, but i'm not sure how it deals with differences in binary files.

As I understand things, updates to binary files are not done as diffs, so each time you update the file a new copy is stored in its entirety.

CE.

User avatar
sammydre
Just popping in
Just popping in
Posts: 14
Joined: Wed Jan 12, 2005 12:06
Location: Hamilton, New Zealand
Contact:

Re: First thoughts on scriptkid's layout editor code

Postby sammydre » Sun Feb 06, 2005 03:23

Yeah sorry, guess I rushed things a bit. That was silly of me! I'll try and fix everything up a bit later today.

Editor? I coded it all in MSVC 7.0. I didn't expect any problems with that.
Sam Jansen - Bung developer: http://bung.homeunix.net/


Return to “Unofficial CEGUI-Related Tools”

Who is online

Users browsing this forum: No registered users and 2 guests