Hi all

I am playing around a little with collapsing code blocks.

PROC
.IF
.WHILE
STRUCT
MACRO

Are all collapseable blocks. Also I'm testing out how you like that I included last line.
Give it a try and tell me if you like it.

KetilO

Edit:
New upload. Keeps .endif and .endw lines.
New upload. Keeps .elseif and .else lines. Includes full source.
Posted on 2003-07-20 10:57:58 by KetilO
Hi

Yeah this is great - just what i was wondering if you would add soon!
i like the way they all go to 1 line instead of the old 2 lines

Ossa
Posted on 2003-07-20 11:52:45 by Ossa
I think that the closing statement has to be shown as well. Like .IF/.ENDIF, showing the .ENDIF would allow you to quickly check a code block for unmatched statements and also see the structure of a block quickly. By hiding the .ENDIF it just makes the code look weird to me. Also there were cases where the wrong .ENDIF was chosen to collapse to:
.IF eax == hTrash && tvi.iImage != IMG_INSTALL

.IF tvi.iImage == IMG_FILE || tvi.iImage == IMG_REGKEY
invoke SendMessage, hSectionList, TVM_DELETEITEM, 0, tvi.hItem
.ELSEIF tvi.iImage == IMG_FOLDER
; Check to see if there is only one section
invoke SendMessage, hSectionList, TVM_GETNEXTITEM, TVGN_ROOT, NULL
mov hRoot,eax
invoke SendMessage, hSectionList, TVM_GETNEXTITEM, TVGN_CHILD, hRoot
invoke SendMessage, hSectionList, TVM_GETNEXTITEM, TVGN_NEXT, eax
[color=red][b].IF eax[/b][/color]
; Confirm delete section
invoke wsprintf, ADDR msgbuffer, OFFSET szmsgformat, ADDR buffer
invoke MsgBox,NULL, ADDR msgbuffer, OFFSET szconfirm, MB_OKCANCEL,1
.IF eax == IDOK
; Remove all the child items
invoke SendMessage, hSectionList, TVM_EXPAND, TVE_COLLAPSERESET OR TVE_COLLAPSE,tvi.hItem
; Remove the section
invoke SendMessage, hSectionList, TVM_DELETEITEM, 0, tvi.hItem
.ENDIF
.ELSE
invoke MsgBox, NULL, ADDR szLastSection, NULL, MB_OK, 1
.ENDIF
[color=red][b].endif[/b][/color]
.ENDIF

blahblah endp
This code block the .IF eax collapsed the block to the lower case (hilited) .endif this made the top .IF collapse the complete bottom of the proc including the endp statement.
Posted on 2003-07-20 12:21:36 by donkey
good point donkey - i wasnt thinking about if block, but mainly about MACROs, PROCs and STRUCTs - for these i think 1 line is good. For IFs, it should be multiline - this is especially true with those if with .elseifs

Ossa
Posted on 2003-07-20 13:42:11 by Ossa
Hi all

New upload.

.endif and .endw are no longer hidden.

KetilO
Posted on 2003-07-20 13:46:29 by KetilO
Looks great :alright:

Last suggestion is just to second the one from Ossa, that .ELSE/.ELSEIF statements are displayed in a collapsed .IF/.ENDIF.

Also, Simed has had a line hiliter and line lock in it for quite a few versions now, any plans on adding them to RadASM. I.E. we can select a line to hilite and it stays hilited even after an exit (saved to rap file) and the same for locking lines from editing (especially good for global replace).
Posted on 2003-07-20 14:06:24 by donkey
very nice. now i wait for the sources to see how you did it :)
so i can implement my C-- parsing.

thanks once again KetilO :alright:
Posted on 2003-07-21 02:12:36 by TBD
Hi TBD

I'm also including flags in RABLOCKDEF to better support C on REM_SETBLOCKS.
Still needs a little work to get it stable.

KetilO
Posted on 2003-07-21 02:22:36 by KetilO
Hi all

New upload at the top, includes full source.

KetilO
Posted on 2003-07-21 06:39:06 by KetilO
Hi,

Looking really good... 1 more suggestion though. I dont know if this is too difficult, but with the collapsing if/elseif/else/endif blocks, it would be nice to expand/collapse individual sections ie just between one elseif and the next instead of doing all of them at one.

Ossa
Posted on 2003-07-21 13:22:20 by Ossa

Hi,

Looking really good... 1 more suggestion though. I dont know if this is too difficult, but with the collapsing if/elseif/else/endif blocks, it would be nice to expand/collapse individual sections ie just between one elseif and the next instead of doing all of them at one.

Ossa


I second that suggestion. It would be an asset to view program flow situations, before you compile and discover a mistake.

:NaN:
Posted on 2003-07-21 23:22:11 by NaN