Hi,

When you say it's no nice, does it mean it's not a good idea or it's difficult to implement this ?

I made something that seems to work fine (see the Attached file).

Would somebody try this and tell me if he's interrested by this functionnality ?

Thierry

Ps : I've had 2 messages in RAEdit.
Posted on 2004-06-15 06:31:10 by golemxiii
Hi Thierry

Very nice. :alright:

Only problem I can see is the .ask files it needs to save the state data.

KetilO
Posted on 2004-06-15 09:12:17 by KetilO
Hi KetilO,

If you want to keep structure of a file (asm, inc, etc..), you must save it somewhere, are'n you ?

Could you explain what you said ?

I must admit that saved file is about 1/6 of original file size :grin:.But it's optionnal :-)

Also, I can adapt my code to fit what you desire.

Thierry
Posted on 2004-06-15 18:04:31 by golemxiii
there is a small bug i nthe test editor,



[-].if <something here> ; if no code above this line, the if will no fold
lalala
.else
lalala
.endif
Posted on 2004-06-15 19:01:01 by wizzra
Hi wizzra,

The editor is just here to test the memorising of the code folded. It can contain some bugs :-)

Did you try the memorizing of code folding ?

Thierry
Posted on 2004-06-15 19:29:57 by golemxiii
Hi golemxiii

It would be nice to implement this in RadASM, but making an . ask file is not an option.
Saving the data in the project file is the way to go. But to do this the size of the data must be small.

Idea:

RAEdit should NOT store anything to files. It should be decided by the application how to store the data.

REM_SAVESTRUCTURE
;wParam=size of bitarray
;lParam=pointer to bitarray
; return value :
; ok = 0 to n
; general err = -1

Loop throug the lines using the function GetBookMark.
If bookmark = 1 (not collapsed) store a 0 bit in the array.
If bookmark = 2 (collapsed) store a 1 bit in the array.
Ignore all other bookmarks.

An array of 32 bytes can hold the state of 256 bookmarks. Should be enough in most cases.

REM_RESTORESTRUCTURE
;wParam=size of bitarray
;lParam=pointer to bitarray
; return value :
; ok = 0 to n
; general err = -1

Assuming all bookmarks in the collapsed state.
Loop throug the lines and the bit array.
If bit array = 0 then expand using the function Expand.

Since syncronization is not critical there is no need to save / check filetimes.

KetilO
Posted on 2004-06-16 02:22:46 by KetilO
Hi KetilO,

Before continuing arging what is the best solution, I must tell you all the solutions I've tried, and you'll understand the way I chose :-) ...

First I've tried your solution (for the first test I use byte in place of bit). I though that was the bes solution. I collapsed all the text, then I expanded some of them. But the expand function doesn't work properly. For example, if you try to expand a collapsed block in another collapsed block, it does'n work.

Next, I've tried something equivalent. I expanded all the text and I collapse some block, begining by the end. It doesn't work properly.

Next, I decided to hide/show the lines one by one. But it was not good, because the I've not restored "folding info" :-)

Next I decided to save all is necessary to restore correctly the structure, ie :
- the id of the line
- the state of the line

Et voil? !

When I say an option about ask files, I mean that user can choose if want save/restore structure of asm files.

I know my solution is a "beuuurk" one, but I could make a better function, If i undestood how the "collapsing functiun" (id) works.. :-) Perhapse you can help me.

Thierry
Posted on 2004-06-16 06:39:23 by golemxiii
Hi golemxiii

Yes you are right. Expanding in the middle of a nesting does not work. I guess that problem have to be solved first.

The bmid is simply to keep track of nested collapse.

KetilO
Posted on 2004-06-16 12:10:02 by KetilO