;Liquid War 6 is a unique multiplayer wargame.
;Copyright (C)  2005, 2006, 2007, 2008, 2009  Christian Mauduit <ufoot@ufoot.org>
;
;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 3 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, see <http://www.gnu.org/licenses/>.
;
;
;Liquid War 6 homepage : http://www.gnu.org/software/liquidwar6/
;Contact author        : ufoot@ufoot.org

(define lw6-system-options-menu-display-fps-item-label
  (lambda ()
    (if (lw6-config-is-true? lw6def-display-fps)
	(_ "Display FPS")
	(_ "FPS hidden"))))

(define lw6-system-options-menu-display-fps-item-toggle
  (lambda (menuitem)
    (begin
      (lw6-config-set-boolean! lw6def-display-fps (not (lw6-config-is-true? lw6def-display-fps)))
      (lw6-display-param-set! lw6def-display-fps (lw6-config-is-true? lw6def-display-fps))
      (lw6-display-update)
      )))

(define lw6-system-options-menu-display-fps-item
  (lambda ()
    (lw6-menu-item-template-switch 
     lw6-system-options-menu-display-fps-item-label 
     lw6-system-options-menu-display-fps-item-toggle 
     lw6-system-options-menu-display-fps-item-toggle)))

(define lw6-system-options-menu-display-rps-item-label
  (lambda ()
    (if (lw6-config-is-true? lw6def-display-rps)
	(_ "Display RPS")
	(_ "RPS hidden"))))

(define lw6-system-options-menu-display-rps-item-toggle
  (lambda (menuitem)
    (begin
      (lw6-config-set-boolean! lw6def-display-rps (not (lw6-config-is-true? lw6def-display-rps)))
      (lw6-display-param-set! lw6def-display-rps (lw6-config-is-true? lw6def-display-rps))
      (lw6-display-update)
      )))

(define lw6-system-options-menu-display-rps-item
  (lambda ()
    (lw6-menu-item-template-switch 
     lw6-system-options-menu-display-rps-item-label 
     lw6-system-options-menu-display-rps-item-toggle 
     lw6-system-options-menu-display-rps-item-toggle)))

(define lw6-system-options-menu-display-console-item-label
  (lambda ()
    (if (lw6-config-is-true? lw6def-display-console)
	(_ "Console enabled")
	(_ "Console disabled"))))

(define lw6-system-options-menu-display-console-item-toggle
  (lambda (menuitem)
    (begin
      (if (lw6-config-is-true? lw6def-display-console)
	  (begin (lw6-config-set-boolean! lw6def-display-console #f)
		 (c-lw6cns-quit))
	  (begin (lw6-config-set-boolean! lw6def-display-console #t)
		 (c-lw6cns-init))
	  ))))

(define lw6-system-options-menu-display-console-item
  (lambda ()
    (lw6-menu-item-template-switch 
     lw6-system-options-menu-display-console-item-label 
     lw6-system-options-menu-display-console-item-toggle 
     lw6-system-options-menu-display-console-item-toggle)))

(define lw6-system-options-menu
  (lambda()
    (let (
	  (menu (lw6-menu-template (_ "System options")))
	  )
      (begin
	(lw6-append-menuitem! menu (lw6-system-options-menu-display-fps-item))
	(lw6-append-menuitem! menu (lw6-system-options-menu-display-rps-item))
	(if (c-lw6cns-support)
	    (lw6-append-menuitem! menu (lw6-system-options-menu-display-console-item)))
	menu
	))))
