<?xml version="1.0"?>
<metacity_theme>
<info>
  <name>Crux</name>
  <author>Anders Carlsson &lt;andersca@gnu.org&gt;</author>
  <copyright>&#194; Eazel Inc, 2000</copyright>
  <date>February 6, 2002</date>
  <description>A port of the Crux theme by Arlo Rose and John Harper</description>
</info>

<!-- define constants -->
<constant name="IconTitleSpacing" value="2"/> <!-- Space between menu button and title -->
<constant name="CenterTitlePieceWidth" value="48"/> <!-- Width of center title piece -->
<constant name="ButtonWidth" value="16"/> <!-- Button width -->

<frame_geometry name="normal">
  <distance name="left_width" value="5"/>
  <distance name="right_width" value="6"/>
  <distance name="bottom_height" value="6"/>
  <distance name="left_titlebar_edge" value="5"/>
  <distance name="right_titlebar_edge" value="6"/>
  <aspect_ratio name="button" value="1.0"/>
  <distance name="title_vertical_pad" value="0"/>
  <border name="title_border" left="0" right="0" top="3" bottom="3"/>
  <border name="button_border" left="0" right="0" top="3" bottom="3"/>
</frame_geometry>

<frame_geometry name="border" has_title="false">
  <distance name="left_width" value="5"/>
  <distance name="right_width" value="6"/>
  <distance name="bottom_height" value="6"/>
  <distance name="left_titlebar_edge" value="0"/>
  <distance name="right_titlebar_edge" value="0"/>
  <distance name="button_width" value="0"/>
  <distance name="button_height" value="0"/>
  <distance name="title_vertical_pad" value="5"/>
  <border name="title_border" left="0" right="0" top="0" bottom="0"/>
  <border name="button_border" left="0" right="0" top="0" bottom="0"/>
</frame_geometry>

<!-- Buttons -->

<draw_ops name="active_button">
  <image filename="active-button.png" x="0" y="0" width="width" height="height"/>
</draw_ops>

<draw_ops name="active_button_pressed">
  <image filename="active-button-pressed.png" x="0" y="0" width="width" height="height"/>
</draw_ops>

<draw_ops name="active_button_prelight">
  <image filename="active-button-prelight.png" x="0" y="0" width="width" height="height"/>
</draw_ops>

<draw_ops name="inactive_button">
  <image filename="inactive-button.png" x="0" y="0" width="width" height="height"/>
</draw_ops>

<draw_ops name="inactive_button_pressed">
  <image filename="inactive-button-pressed.png" x="0" y="0" width="width" height="height"/>
</draw_ops>

<draw_ops name="inactive_button_prelight">
  <image filename="inactive-button-prelight.png" x="0" y="0" width="width" height="height"/>
</draw_ops>

<!-- Inactive style -->
<frame_style name="normal" geometry="normal">
  <piece position="left_edge">
    <draw_ops>
      <image filename="inactive-left-border.png" x="0" y="0" width="object_width" height="height"/>
    </draw_ops>
  </piece>

  <piece position="right_edge">
    <draw_ops>
      <image filename="inactive-right-border.png" x="0" y="0" width="object_width" height="height"/>
    </draw_ops>
  </piece>

  <piece position="title">
    <draw_ops>
      <title color="gtk:fg[SELECTED]" x="IconTitleSpacing" y="0"/>
    </draw_ops>
  </piece>

  <piece position="titlebar">
    <draw_ops>

      <image filename="inactive-left-top-border.png" 
             x="0" y="0" width="object_width" height="height"/>
      <image filename="inactive-right-top-border.png" 
             x="width - object_width" y="0" width="object_width" height="height"/>

      <image filename="inactive-top-center-left.png" 
             x="4" y="0" 
             width="(left_width + ButtonWidth + IconTitleSpacing + title_width) `min`
                    (width - right_width - 3 * ButtonWidth - CenterTitlePieceWidth * height / 22 - 3)" 
             height="height"/>

      <image filename="inactive-top-center-mid.png" 
             x="((left_width + ButtonWidth + IconTitleSpacing + title_width) `min` (width - object_width * height / 22 - right_width - 3 * ButtonWidth)) + 1"
             y="0" width="object_width * height / 22" height="height"/>

      <image filename="inactive-top-center-right.png"
             x="((left_width + ButtonWidth + IconTitleSpacing + title_width + CenterTitlePieceWidth * height / 22) `min` (width - 3 * ButtonWidth - right_width)) + 1"
             y="0"
             width="(width - title_width - left_width - ButtonWidth - IconTitleSpacing - CenterTitlePieceWidth * height / 22 - right_width) `max` (3 * ButtonWidth)"
             height="height"/>

    </draw_ops>
  </piece>

  <!-- We have to draw the bottom edge in the background piece 
       because that's the only way we can get the correct window height -->
  <piece position="overlay">
    <draw_ops>
      <image filename="inactive-bottom-left-corner.png" 
             x="0" y="height - object_height" width="object_width" height="object_height"/>
      <image filename="inactive-bottom-left-border.png" x="5" y="height - object_height" 
             width="((title_width + height / 2 - 4) `min` (width - object_width - 26))"
             height="object_height"/>
      <image filename="inactive-bottom-mid-border.png" 
             x="((title_width + height / 2) `min` (width - object_width - 6)) + 1" 
             y="height - object_height" width="object_width" height="object_height"/>

      <image filename="inactive-bottom-right-border.png"
             x="((title_width + height / 2 + 32)) + 1" 
             y="height - object_height" 
             width="(width - title_width - height / 2 - 32 - 7) `max` 0"
             height="object_height"/>

      <image filename="inactive-bottom-right-corner.png" 
             x="width - object_width" y="height - object_height" width="object_height" height="object_height"/>

    </draw_ops>
  </piece>

  <button function="close" state="normal">
    <draw_ops>
      <include name="inactive_button"/>
      <image filename="inactive-close-button.png" x="2" y="2" width="width-4" height="height-4"/>
    </draw_ops>
  </button>

  <button function="close" state="pressed">
    <draw_ops>
      <include name="inactive_button_pressed"/>
      <image filename="inactive-close-button.png" x="2" y="2" width="width-4" height="height-4"/>
    </draw_ops>
  </button>

  <button function="close" state="prelight">
    <draw_ops>
      <include name="inactive_button_prelight"/>
      <image filename="inactive-close-button.png" x="2" y="2" width="width-4" height="height-4"/>
    </draw_ops>
  </button>

  <button function="minimize" state="normal">
    <draw_ops>
      <include name="inactive_button"/>
      <image filename="inactive-minimize-button.png" x="2" y="2" width="width-4" height="height-4"/>
    </draw_ops>
  </button>

  <button function="minimize" state="pressed">
    <draw_ops>
      <include name="inactive_button_pressed"/>
      <image filename="inactive-minimize-button.png" x="2" y="2" width="width-4" height="height-4"/>
    </draw_ops>
  </button>

  <button function="minimize" state="prelight">
    <draw_ops>
      <include name="inactive_button_prelight"/>
      <image filename="inactive-minimize-button.png" x="2" y="2" width="width-4" height="height-4"/>
    </draw_ops>
  </button>

  <button function="maximize" state="normal">
    <draw_ops>
      <include name="inactive_button"/>
      <image filename="inactive-maximize-button.png" x="2" y="2" width="width-4" height="height-4"/>
    </draw_ops>
  </button>

  <button function="maximize" state="pressed">
    <draw_ops>
      <include name="inactive_button_pressed"/>
      <image filename="inactive-maximize-button.png" x="2" y="2" width="width - 4" height="height - 4"/>
    </draw_ops>
  </button>

  <button function="maximize" state="prelight">
    <draw_ops>
      <include name="inactive_button_prelight"/>
      <image filename="inactive-maximize-button.png" x="2" y="2" width="width-4" height="height-4"/>
    </draw_ops>
  </button>

  <button function="menu" state="normal">
    <draw_ops>
      <image filename="inactive-menu-button.png" x="0" y="0" width="width" height="height"/>
    </draw_ops>
  </button>

  <button function="menu" state="pressed">
    <draw_ops>
      <image filename="inactive-menu-button-pressed.png" x="0" y="0" width="width" height="height"/>
    </draw_ops>
  </button>
  <button function="menu" state="prelight">
    <draw_ops>
      <image filename="inactive-menu-button-prelight.png" x="0" y="0" width="width" height="height"/>
    </draw_ops>
  </button>
</frame_style>

<frame_style name="normal_maximized" parent="normal">
  <button function="maximize" state="normal">
    <draw_ops>
      <include name="inactive_button"/>
      <image filename="inactive-restore-button.png" x="2" y="2" width="width-4" height="height-4"/>
    </draw_ops>
  </button>

  <button function="maximize" state="pressed">
    <draw_ops>
      <include name="inactive_button_pressed"/>
      <image filename="inactive-restore-button.png" x="2" y="2" width="width - 4" height="height - 4"/>
    </draw_ops>
  </button>

  <button function="maximize" state="prelight">
    <draw_ops>
      <include name="inactive_button_prelight"/>
      <image filename="inactive-restore-button.png" x="2" y="2" width="width-4" height="height-4"/>
    </draw_ops>
  </button>

</frame_style>

<!-- Active (focused) shaded style -->
	<frame_style name="normal_shaded" geometry="normal" parent="normal">
	  <piece position="left_titlebar_edge">
	    <draw_ops>
	      <image filename="inactive-left-top-border-shaded.png" x="0" y="3" width="object_width" height="object_height"/>
	    </draw_ops>
	  </piece>
	  <piece position="right_titlebar_edge">
	    <draw_ops>
	      <image filename="inactive-right-top-border-shaded.png" x="width - object_width" y="3" width="object_width" height="object_height"/>
	    </draw_ops>
	  </piece>
	</frame_style>


<!-- Active (focused) style -->
<frame_style name="focused" geometry="normal">
  <piece position="left_edge">
    <draw_ops>
      <image colorize="gtk:bg[SELECTED]" filename="active-left-border.png" x="0" y="0" width="object_width" height="height"/>
    </draw_ops>
  </piece>

  <piece position="right_edge">
    <draw_ops>
      <image filename="active-right-border.png" x="0" y="0" width="object_width" height="height"/>
    </draw_ops>
  </piece>

  <piece position="title">
    <draw_ops>
      <title color="gtk:fg[SELECTED]" x="IconTitleSpacing" y="((height - title_height) / 2) `max` 0"/>
    </draw_ops>
  </piece>

  <piece position="titlebar">
    <draw_ops>

      <image filename="active-left-top-border.png" 
             colorize="gtk:bg[SELECTED]"
             x="0" y="0" width="object_width" height="height"/>

      <image filename="active-right-top-border.png" 
             x="width - object_width" y="0" width="object_width" height="height"/>

      <image filename="active-top-center-left.png" 
             colorize="gtk:bg[SELECTED]"
             x="4" y="0" 
             width="(left_width + ButtonWidth + IconTitleSpacing + title_width) `min`
                    (width - right_width - 3 * ButtonWidth - CenterTitlePieceWidth * height / 22 - 3)" 
             height="height"/>

      <image filename="active-top-center-mid-left.png" 
             colorize="gtk:bg[SELECTED]"
             x="((left_width + ButtonWidth + IconTitleSpacing + title_width) `min` (width - object_width * height / 22 - right_width - 3 * ButtonWidth)) + 1"
             y="0" width="object_width * height / 22" height="height"/>

      <image filename="active-top-center-mid-right.png" 
             x="((left_width + ButtonWidth + IconTitleSpacing + title_width) `min` (width - object_width * height / 22 - right_width - 3 * ButtonWidth)) + 1"
             y="0" width="object_width * height / 22" height="height"/>

      <image filename="active-top-center-right.png"
             x="((left_width + ButtonWidth + IconTitleSpacing + title_width + CenterTitlePieceWidth * height / 22) `min` (width - 3 * ButtonWidth - right_width)) + 1"
             y="0"
             width="(width - title_width - left_width - ButtonWidth - IconTitleSpacing - CenterTitlePieceWidth * height / 22 - right_width) `max` (3 * ButtonWidth)"
             height="height"/>

    </draw_ops>
  </piece>

  <!-- We have to draw the bottom edge in the background piece 
       because that's the only way we can get the correct window height -->
  <piece position="overlay">
    <draw_ops>
      <image filename="active-bottom-left-corner.png" 
             colorize="gtk:bg[SELECTED]"
             x="0" y="height - object_height" width="object_width" height="object_height"/>
      <image filename="active-bottom-left-border.png" x="5" y="height - object_height" 
             colorize="gtk:bg[SELECTED]"
             width="((title_width + height / 2 - 4) `min` (width - object_width - 26))"
             height="object_height"/>
      <image filename="active-bottom-mid-left-border.png" 
             colorize="gtk:bg[SELECTED]"
             x="((title_width + height / 2) `min` (width - object_width - 6)) + 1" 
             y="height - object_height" width="object_width" height="object_height"/>
      <image filename="active-bottom-mid-right-border.png" 
             x="((title_width + height / 2) `min` (width - object_width - 6)) + 1" 
             y="height - object_height" width="object_width" height="object_height"/>

      <image filename="active-bottom-right-border.png"
             x="((title_width + height / 2 + 32)) + 1" 
             y="height - object_height" 
             width="(width - title_width - height / 2 - 32 - 7) `max` 0"
             height="object_height"/>

      <image filename="active-bottom-right-corner.png" 
             x="width - object_width" y="height - object_height" width="object_height" height="object_height"/>

    </draw_ops>
  </piece>

  <button function="close" state="normal">
    <draw_ops>
      <include name="active_button"/>
      <image filename="active-close-button.png" x="2" y="2" width="width-4" height="height-4"/>
    </draw_ops>
  </button>

  <button function="close" state="pressed">
    <draw_ops>
      <include name="active_button_pressed"/>
      <image filename="active-close-button.png" x="2" y="2" width="width-4" height="height-4"/>
    </draw_ops>
  </button>

  <button function="close" state="prelight">
    <draw_ops>
      <include name="active_button_prelight"/>
      <image filename="active-close-button.png" x="2" y="2" width="width-4" height="height-4"/>
    </draw_ops>
  </button>

  <button function="minimize" state="normal">
    <draw_ops>
      <include name="active_button"/>
      <image filename="active-minimize-button.png" x="2" y="2" width="width-4" height="height-4"/>
    </draw_ops>
  </button>

  <button function="minimize" state="pressed">
    <draw_ops>
      <include name="active_button_pressed"/>
      <image filename="active-minimize-button.png" x="2" y="2" width="width-4" height="height-4"/>
    </draw_ops>
  </button>

  <button function="minimize" state="prelight">
    <draw_ops>
      <include name="active_button_prelight"/>
      <image filename="active-minimize-button.png" x="2" y="2" width="width-4" height="height-4"/>
    </draw_ops>
  </button>

  <button function="maximize" state="normal">
    <draw_ops>
      <include name="active_button"/>
      <image filename="active-maximize-button.png" x="2" y="2" width="width-4" height="height-4"/>
    </draw_ops>
  </button>

  <button function="maximize" state="pressed">
    <draw_ops>
      <include name="active_button_pressed"/>
      <image filename="active-maximize-button.png" x="2" y="2" width="width-4" height="height-4"/>
    </draw_ops>
  </button>

  <button function="maximize" state="prelight">
    <draw_ops>
      <include name="active_button_prelight"/>
      <image filename="active-maximize-button.png" x="2" y="2" width="width-4" height="height-4"/>
    </draw_ops>
  </button>

  <button function="menu" state="normal">
    <draw_ops>
      <image colorize="gtk:bg[SELECTED]" filename="active-menu-button.png" x="0" y="0" width="width" height="height"/>
    </draw_ops>
  </button>

  <button function="menu" state="pressed">
    <draw_ops>
      <image colorize="gtk:bg[SELECTED]" filename="active-menu-button-pressed.png" x="0" y="0" width="width" height="height"/>
    </draw_ops>
  </button>
  <button function="menu" state="prelight">
    <draw_ops>
      <image colorize="gtk:bg[SELECTED]" filename="active-menu-button-prelight.png" x="0" y="0" width="width" height="height"/>
    </draw_ops>
  </button>
</frame_style>

<frame_style name="focused_maximized" geometry="normal" parent="focused">
  <button function="maximize" state="normal">
    <draw_ops>
      <include name="active_button"/>
      <image filename="active-restore-button.png" x="2" y="2" width="width-4" height="height-4"/>
    </draw_ops>
  </button>
  
  <button function="maximize" state="pressed">
    <draw_ops>
      <include name="active_button_pressed"/>
      <image filename="active-restore-button.png" x="2" y="2" width="width-4" height="height-4"/>
    </draw_ops>
  </button>

  <button function="maximize" state="prelight">
    <draw_ops>
      <include name="active_button_prelight"/>
      <image filename="active-restore-button.png" x="2" y="2" width="width-4" height="height-4"/>
    </draw_ops>
  </button>

</frame_style>

<!-- Active (focused) shaded style -->
<frame_style name="focused_shaded" geometry="normal" parent="focused">
  <piece position="left_titlebar_edge">
    <draw_ops>
      <image colorize="gtk:bg[SELECTED]" filename="active-left-top-border-shaded.png" x="0" y="3" width="object_width" height="object_height"/>
    </draw_ops>
  </piece>
  <piece position="right_titlebar_edge">
    <draw_ops>
      <image filename="active-right-top-border-shaded.png" x="width - object_width" y="3" width="object_width" height="object_height"/>
    </draw_ops>
  </piece>
</frame_style>

<!-- Inactive border style -->
<frame_style name="border_unfocused" geometry="border" parent="normal">
  <piece position="title"><draw_ops/></piece>
  <piece position="titlebar">
    <draw_ops>
      <image filename="inactive-top-left-corner.png" 
             x="0" y="0" width="object_width" height="object_height"/>
      <image filename="inactive-border-top-left-border.png" x="5" y="0" 
             width="((title_width + height / 2 - 4) `min` (width - object_width - 26))"
             height="object_height"/>
      <image filename="inactive-top-mid-border.png" 
             x="((title_width + height / 2) `min` (width - object_width - 6)) + 1" 
             y="0" width="object_width" height="object_height"/>
      <image filename="inactive-border-top-right-border.png"
             x="((title_width + height / 2 + 32)) + 1" 
             y="0" 
             width="(width - title_width - height / 2 - 32 - 7) `max` 0"
             height="object_height"/>
      <image filename="inactive-top-right-corner.png" 
             x="width - object_width" y="0" width="object_height" height="object_height"/>
    </draw_ops>
  </piece>
</frame_style>

<!-- Active (focused) border style -->
<frame_style name="border_focused" geometry="border" parent="focused">
  <piece position="title"><draw_ops/></piece>
  <piece position="titlebar">
    <draw_ops>
      <image filename="active-top-left-corner.png" 
             colorize="gtk:bg[SELECTED]"
             x="0" y="0" width="object_width" height="object_height"/>
      <image filename="active-border-top-left-border.png" 
             colorize="gtk:bg[SELECTED]" x="5" y="0"
             width="((title_width + height / 2 - 4) `min` (width - object_width - 26))"
             height="object_height"/>
      <image filename="active-top-mid-left-border.png" 
             colorize="gtk:bg[SELECTED]"
             x="((title_width + height / 2) `min` (width - object_width - 6)) + 1" 
             y="0" width="object_width" height="object_height"/>
      <image filename="active-top-mid-right-border.png" 
             x="((title_width + height / 2) `min` (width - object_width - 6)) + 1" 
             y="0" width="object_width" height="object_height"/>
      <image filename="active-border-top-right-border.png"
             x="((title_width + height / 2 + 32)) + 1" y="0" 
             width="(width - title_width - height / 2 - 32 - 7) `max` 0"
             height="object_height"/>
      <image filename="active-top-right-corner.png" 
             x="width - object_width" y="0" width="object_height" height="object_height"/>
    </draw_ops>
  </piece>
</frame_style>

<frame_style_set name="normal">
<frame focus="yes" state="shaded" style="focused_shaded"/>
<frame focus="yes" state="normal" resize="both" style="focused"/>
<frame focus="yes" state="maximized" style="focused_maximized"/>
<frame focus="yes" state="maximized_and_shaded" style="focused_maximized"/>
<frame focus="no" state="normal" resize="both" style="normal"/>
<frame focus="no" state="shaded" style="normal_shaded"/>
<frame focus="no" state="maximized" style="normal_maximized"/>
<frame focus="no" state="maximized_and_shaded" style="normal_maximized"/>
</frame_style_set>

<frame_style_set name="border">
<frame focus="yes" state="normal" resize="both" style="border_focused"/>
<frame focus="yes" state="maximized" style="border_focused"/>
<frame focus="yes" state="shaded" style="border_focused"/>
<frame focus="yes" state="maximized_and_shaded" style="border_focused"/>
<frame focus="no" state="normal" resize="both" style="border_unfocused"/>
<frame focus="no" state="maximized" style="border_unfocused"/>
<frame focus="no" state="shaded" style="border_unfocused"/>
<frame focus="no" state="maximized_and_shaded" style="border_unfocused"/>
</frame_style_set>

<window type="normal" style_set="normal"/>
<window type="dialog" style_set="normal"/>
<window type="modal_dialog" style_set="normal"/>
<window type="menu" style_set="normal"/>
<window type="utility" style_set="normal"/>
<window type="border" style_set="border"/>

<menu_icon function="close" state="normal">
  <draw_ops> 
    <image filename="active-close-button.png" 
           x="(width - object_width) / 2"
           y="(height - object_height) / 2"
           width="object_width" height="object_height"/>
  </draw_ops>
</menu_icon>

<menu_icon function="maximize" state="normal">
  <draw_ops>
    <image filename="active-maximize-button.png" 
           x="(width - object_width) / 2"
           y="(height - object_height) / 2"
           width="object_width" height="object_height"/>
  </draw_ops>
</menu_icon>


<menu_icon function="minimize" state="normal">
  <draw_ops>
    <image filename="active-minimize-button.png" 
           x="(width - object_width) / 2"
           y="(height - object_height) / 2"
           width="object_width" height="object_height"/>
  </draw_ops>
</menu_icon>

<menu_icon function="unmaximize" state="normal">
  <draw_ops>
  </draw_ops>
</menu_icon>

</metacity_theme>
