### Copyright (C) 1995, 1996, 1997 Jeppe Buk (buk@imada.sdu.dk)
### This program is free software; you can redistribute it and/or modify
### it under the terms of the GNU General Public License as published by
### the Free Software Foundation; either version 2 of the License, or
### (at your option) any later version.
###
### This program is distributed in the hope that it will be useful,
### but WITHOUT ANY WARRANTY; without even the implied warranty of
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
### GNU General Public License for more details.
###
### You should have received a copy of the GNU General Public License
### along with this program; if not, write to the Free Software
### Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

proc virtual {} {
  # Look-and-Feel / Virtual Desktop
  Desc "Configuration of the virtual desktop\n\n" \
      "On this page you configure the virtual desktop. You cannot configure" \
      "the number of virtual desktops, as that is calculated dynamically by" \
      "FVWM. You can configure the number of pages each desktop is divided" \
      "into."
  ShortDesc "Virtual desktop"

  Header virtH -text "Virtual Desktop" -frame:relief flat

  Help virtH \
      "On this page you control the configuration of the virtual desktop."

  Line deskL
  Header deskH -text "Desktop" -frame:relief flat

  Help deskH \
      "Here you configure the desktop."
  
  #######################################################################
  # DeskTopSize
  #
  CheckBox desktopSize -text "Change the virtual desktop size to"
  Int desktopSizeX -textafter "X"
  Int desktopSizeY -textafter "physical screens"
  Frame desktopSizeF -entries { desktopSize desktopSizeX desktopSizeY }

  Help desktopSize \
      "Here you can specify the number of physical screens (pages) that" \
      "every virtual desktop should consist of. The desktop is made up" \
      "of a grid of pages, and you specify the number of pages as" \
      "<horizontal> X <vertical>.\n\n" \
      "The number of desktops cannot be configured, since FVWM calculates" \
      "this dynamically."
  Help desktopSizeX \
      "The number entered here will be the number of pages in the" \
      "horizontal direction."
  Help desktopSizeY \
      "The number entered here will be the number of pages in the" \
      "vertical direction."

  Change {
    if { $changeElm == "desktopSize" } {
      if { $desktopSize == 1 } { Enable desktopSizeX desktopSizeY } else {
	Disable desktopSizeX desktopSizeY }
    }
  }

  PageEnd {
    if { $desktopSize == 1 } {
      if { $desktopSizeX == "" || $desktopSizeY == "" } {
	error "Invalid desktop size"
      }
    }
  }

  Save {
    if { $desktopSize == 1 } {
      print "DeskTopSize\t${desktopSizeX}x$desktopSizeY"
    }
  }
  #
  #######################################################################
  
  #######################################################################
  # EdgeResistance
  #
  Line edgeResL
  Header edgeResH -text "Changing Pages" -frame:relief flat
  CheckBox edgeRes -text "Change how hard it should be to change desktop\
\nby moving the mouse off the physical screen" -justify left
  Int edgeRes1 -text "     The number of milli seconds the mouse must be on\
 the\n     screen edge before FVWM will move the viewport:" \
      -label:justify left
  Int edgeRes2 -text "     The number of pixels over the edge of the screen\
 a window's\n     edge must move before it actually moves partially off\
 screen:" \
      -label:justify left

  Help edgeResH \
      "Here you configure how to change pages with the mouse."
  set edgeResHelp1 [concat \
      "If you find yourself accidentally flipping pages with the mouse" \
      "use this option to make it harder to change desktop. The resistance" \
      "is given by to values:" ]
  set edgeResHelp2 \
      "1) The delay in milli seconds to wait before flipping, and"
  set edgeResHelp3 [concat \
      "2) The number of pixels a window must be off screen before" \
      "actually flipping." ]
  set edgeResHelp "$edgeResHelp1\n\n$edgeResHelp2\n\n$edgeResHelp3"
  Help edgeRes  $edgeResHelp
  Help edgeRes1 $edgeResHelp
  Help edgeRes2 $edgeResHelp

  Change {
    if { $changeElm == "edgeRes" } {
      if { $edgeRes == 1 } { Enable edgeRes1 edgeRes2 } else {
	Disable edgeRes1 edgeRes2 }
    }
  }

  PageEnd {
    if { $edgeRes == 1 } {
      if { $edgeRes1 == "" || $edgeRes2 == "" } {
	error "Invalid edge resistance values"
      }
    }
  }

  Save {if {$edgeRes == 1} {print "EdgeResistance\t$edgeRes1 $edgeRes2"}}
  #
  #######################################################################

  #######################################################################
  # EdgeScroll
  #
  CheckBox edgeScroll -text "Change the percentage of a page to flip\n" \
      "when the mouse goes over the edge to:" -justify left
  Int xScroll -text "     " -textafter "% of the screen in the X direction"
  Int yScroll -text "     " -textafter "% of the screen in the Y direction"

  Help edgeScroll \
      "You can specify the percentage of the physical screen (a page)" \
      "FVWM will scroll your viewport at a time. A value of zero means" \
      "that this kind of flipping is impossible with the mouse, and a" \
      "value of 100 means that FVWM will flip the entire page."
  Help xScroll \
      "Here you enter the scroll amount in the X (horizontal) direction."
  Help yScroll \
      "Here you enter the scroll amount in the Y (vertical) direction."

  Change {
    if { $changeElm == "edgeScroll" } {
      if { $edgeScroll == 1 } { Enable xScroll yScroll } else {
	Disable xScroll yScroll }
    }
  }

  PageEnd {
    if { $edgeScroll == 1 } {
      if { $xScroll == "" || $yScroll == "" } {
	error "Invalid edge scroll values"
      }
    }
  }

  Save {if {$edgeScroll == 1} {print "EdgeScroll\t$xScroll $yScroll"}}
  #
  #######################################################################

}
