; the markup for pictures automatically.

; this first one inserts a <figure> markup block.  It should be used
; for larger graphics elements.

(defun gdp-insert-figure (title filename)
  (interactive "MTitle: \nMFilename (no extension): ")
  (let ((point (point)))
    (insert 
" 	<figure>
	  <title></title>
	  <mediaobject>
	    <imageobject>
	      <imagedata fileref=\"\" format=\"PNG\"/>
	    </imageobject>
	    <imageobject>
	      <imagedata fileref=\"\" format=\"EPS\"/>
	    </imageobject>
	    <textobject>
	      <phrase></phrase>
	    </textobject>
	  </mediaobject>
	</figure>")
    (indent-region point (point) nil)
    (search-backward "</phrase>" point t)))
(define-key global-map [f7] 'gdp-insert-figure)

; this one inserts a <screenshot>.  Clearly, use this one for
; screenshots.  :-)

(defun gdp-insert-screenshot (title filename)
  (interactive "MTitle: \nMFilename (no extension): ")
  (let ((point (point)))
    (insert 
"   <screenshot>
    <mediaobject>
     <imageobject>
      <imagedata fileref=\"\" format=\"PNG\"/>
     </imageobject>
     <imageobject>
      <imagedata fileref=\"\" format=\"EPS\"/>
     </imageobject>
     <textobject>
      <phrase></phrase>
     </textobject>
     <caption>
      <para></para>
     </caption>
    </mediaobject>
   </screenshot>")
    (indent-region point (point) nil)
    (search-backward "</phrase>" point t)))
(define-key global-map [f8] 'gdp-insert-screenshot)


; This one inserts a media object.  Use this for small graphics, less
; than a figure and not a screenshot.

(defun gdp-insert-mediaobject (title filename)
  (interactive "MTitle: \nMFilename (no extension): ")
  (let ((point (point)))
    (insert 
"  <mediaobject>
   <imageobject>
    <imagedata fileref="" format="PNG"/>
   </imageobject>
   <imageobject>
    <imagedata fileref="" format="EPS"/>
   </imageobject>
   <textobject>
    <phrase></phrase>
   </textobject>
   <caption>
    <para></para>
   </caption>
  </mediaobject>")
    (indent-region point (point) nil)
    (search-backward "</phrase>" point t)))
(define-key global-map [f9] 'gdp-insert-mediaobject)