David 'Dox' Shevitz wrote:
> I understand that Docbook includes a revisionflag attribute that allows 
> you to let others know that content has been added or changed. I was 
> hoping to put together a custom popup menu (or an addition to the 
> default popup menu) and a custom toolbar that allows you to quickly set 
> this flag to a specific value. For example a user right-clicks a para 
> element and has the following options available:
> 
> Track Changes: Added (sets revisionflag to Added)
> Track Changes: Changed (sets revisionflag to Changed)
> Track Changes: Deleted (sets revisionflag to Deleted)
> 
> It would be particularly useful if the menu had some intelligence behind 
> that detected if only text was selected and, if so, wrap the text in a 
> phrase element so that a flag could be added.
> 
> I've been reading through the Configuration and Deployment guide, but I 
> think I'm tackling a task that is more than I can handle, because I 
> can't seem to get things to work. Does anyone have any suggestions?

Normally DocBook has a context-sensitive Edit popup menu. This popup 
menu is special if you click on an svg:svg element.

I've sacrificied this feature for the sake of making what follows 
simpler to understand.

---
<command name="mydocb.setRevision">
   <macro undoable="true">
     <sequence>
       <choice>
        <sequence>
          <test expression="string-length($selectedChars) &gt; 0" />
          <get expression="$selectedChars" />
          <!-- Does not select what has been pasted
                but the caret is inside what has been pasted. -->
          <command name="paste"
           parameter="to
           &lt;?xml version='1.0'?&gt;&lt;phrase&gt;%_&lt;/phrase&gt;"/>
        </sequence>

        <test expression="$implicitElement" />
       </choice>

       <sequence>
        <set variable="selectedElement" expression="$implicitElement" />
        <command name="putAttribute" parameter="revisionflag %0" />
       </sequence>
     </sequence>
   </macro>
</command>

<command name="mydocb.editMenu">
   <menu>
     <item label="Track Changes: Added (sets revisionflag to added)"
          command="mydocb.setRevision" parameter="added" />
     <item label="Track Changes: Changed (sets revisionflag to changed)"
          command="mydocb.setRevision" parameter="changed" />
     <item label="Track Changes: Deleted (sets revisionflag to deleted)"
          command="mydocb.setRevision" parameter="deleted" />

     <editMenu />
   </menu>
</command>

<binding>
   <mousePressed button="3"/>
   <command name="mydocb.editMenu" />
</binding>
---

To test this, simply copy attached file to 
<XXE_user_preferences_dir>/config/ (<XXE_user_preferences_dir> is 
C:\Document and Settings\<user>\xxe2\ on Windows and ~/.xxe2/ on Unix).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mydocbook.xxe
Type: text/xml
Size: 1645 bytes
Desc: not available
Url : 
http://www.xmlmind.com/pipermail/xmleditor-support/attachments/20050419/874d0df1/attachment.xml
 

Reply via email to