Author Topic: User regions/blocks  (Read 4789 times)

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2184
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
User regions/blocks
« on: April 09, 2010, 12:27:01 am »
Quote
<% 'Variable Definition Block
some asp codes
%>

If I can see this block in navigation bar with the name "Variable Definition Block" I can easily navigate to it.
Check link I already mentioned to post from Stefan. He gives good how to about user region concept in HE.

About free collapsible blocks, I have some more ideas inspired by this approach that  want to implement. But this is a big topic. Will come, but o not know when.

Theno

  • Guest
User regions/blocks
« Reply #1 on: April 09, 2010, 08:32:06 am »
Quote
Check link I already mentioned to post from Stefan. He gives good how to about user region concept in HE.

About free collapsible blocks, I have some more ideas inspired by this approach that  want to implement. But this is a big topic. Will come, but o not know when.

Hmmm that is really very interesting, but I am not sure I will like to work in such an enviroment :), I want to test it when released...

I checked Stefan's topic but he explains about scopes not blocks and as far as I know we can't give names to the blocks. I need to re-define it as a scope to do this and I don't know if I can define <% and %> as a scope and block at the same time?

Thanks...

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2184
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
User regions/blocks
« Reply #2 on: April 09, 2010, 10:39:56 am »
You can achieve the same by just surrounding your <%%> area with region scope.
You can use template for that and then call it or by shortcut or by format context menu.
So generally I do not see big challenges in adding special block comments if user can get this in other way and efforts for implementing are significant.

Theno

  • Guest
User regions/blocks
« Reply #3 on: April 10, 2010, 08:38:42 pm »
Hi Alex,

Sorry but I couldn't understand, what is a region scope? Is it an attribute of scopes?

Thanks...

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2184
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
User regions/blocks
« Reply #4 on: April 10, 2010, 09:56:33 pm »
Check this post form Stefan about details, how to create your own region in any syntax.
Generally trick is: you define some pair of tags as region - endregion in scope list of your syntax. With has_name attribute inform that scope has name (then it will be extracted) and then allow this scope only in pseudo comments (format_tag style) to not bother your syntax consumers (compiler or browser fex).

Add this to your asp_spec.xml
Code: [Select]
    <SCOPES>
      <Scope open="region" close="endregion" has_name="true">
        <Containers open="format_tag"/>
      </Scope>
    </SCOPES>
....
      <Style id="format_tag" name="Format tags" bold="2" italic="1" underline="0" clr="Format tag" bkclr="#FFFFFFFF">
        <Blocks>
          <Block open="&lt;!--$" close="--&gt;"/>
        </Blocks>
      </Style>
...

Now, if you will type something like this in ASP syntax (everything outside of <%%> and not in embedded syntax, so HTML):
Code: [Select]
<!--$ region MY_REGION_HERE -->
<center></center> some HTML
<% some vb %>
<!--$ endregion -->
Area between region and endregion will be collapsible.

You can create a template to insert it fast.

Theno

  • Guest
User regions/blocks
« Reply #5 on: April 11, 2010, 06:12:54 pm »
Thanks Alex but I think I couldn't explained well what I want to do. I don't want to take much time of you but I did what I want with labels. But I have a small problem with hierarchy bar. I'll appriciate if you can have a look at attachments.

I defined two labels "Block" and "TODO" They work correct but last label of these two in a block changes the name of the block instead of being showed under it.

Normally if there is a "if statement" under the asp block, hierarchy bar shows ASP -> If and this is correct.
But if there is one of the labels of "Block" of "TODO" I created lately, hierarchy bar shows TODO -> If. Although it is inside the ASP Block too, it doesn't show "ASP" in hiearachy bar. I draw the parts that I want to emphasize on the attachments.

My codes for the labels inside asp_spec.sml

Quote
   <LABELS>
        <Label group="TODO" match="TODO:\s*((\w*\s?)+)\s+-\s+(.*?)$" name="TODO: \1" descr="\3" image="15" scope="1">
          <Containers close="vb:normal"/>
          <Containers open="vb:comment"/>
     </Label>
        <Label group="Block" match="Block:\s*((\w*\s?)+)\s+-\s+(.*?)$" name="Block: \1" descr="\3" image="14" scope="1">
          <Containers close="vb:normal"/>
          <Containers open="vb:comment"/>
    </Label>
  </LABELS>

Thanks in advance...
« Last Edit: April 11, 2010, 06:14:58 pm by Theno »

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2184
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: User regions/blocks
« Reply #6 on: April 11, 2010, 11:14:10 pm »
Hello Theno, you have misused scope attribute:

Quote
scope (0|1|2) - defines relation of the label to any scope. 0 - not related to scope, 1 - label includes relevant scope start, 2 - scope includes relevant scope end. If label is related to scope (1|2) HippoEDIT would try to find appropriate scope and associate label with it. Then you would see label description as name of the scope while navigating in Navigation Bar and in Scroll Info Tip.
You labels intersects no scopes (check other definition, they usually includes scope start tag at the end).
For some reason, it works in your case, but behavior is undefined. If label finds corresponding scope, it bounds to it and overwrite its name. So in you case it was embedded syntax scope, and ti was overwritten.
So, just remove scope="1" from label definition.

The effect was interesting, I will check and maybe will leave it, but will verify that behavior will be strictly defined, and label will assign to current scope.
Checked. It is already strict defined. Always closest current taken, But because you have more then one label with scope=1 in same scope, last one wins.

Also, please next time in addition to screenshots paste here also code sample wich can be used for testing.

Best regards,
Alex.
« Last Edit: April 11, 2010, 11:23:00 pm by alex »

Theno

  • Guest
Re: User regions/blocks
« Reply #7 on: April 12, 2010, 12:01:16 pm »
Hi Alex I understood, thank you.
I will send the files to you again soon I made several changes and additions.

By the way I wonder if I can define a scope or block with the end tag \n.

   <SCOPES>
      <Scope open="Begin" close="\n" has_name="true" separator="true">
         <Containers open="format_tag"/>
      </Scope>
   </SCOPES>

I tried but didn't work.

Thanks...

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2184
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: User regions/blocks
« Reply #8 on: April 12, 2010, 01:11:32 pm »
No, this is not allowed.
You can have only explicit close tag or none. If you use none open scope tag is used for skip scopes.

Theno

  • Guest
Re: User regions/blocks
« Reply #9 on: April 12, 2010, 02:54:30 pm »
Ok, thank you very much Alex.

 

Related Topics

  Subject / Started by Replies Last post
17 Replies
9629 Views
Last post July 01, 2016, 02:11:32 pm
by alex
9 Replies
4673 Views
Last post January 22, 2009, 12:09:26 am
by alex
4 Replies
4262 Views
Last post April 20, 2010, 10:47:59 pm
by Theno
14 Replies
3650 Views
Last post September 10, 2014, 01:34:59 pm
by Andreas
0 Replies
1355 Views
Last post January 28, 2015, 02:10:32 am
by alex