; #|

Minimized UI with sd-defdialog - Additional Example

Note: This is an example file showing concepts of the Integration Kit. The code itself is not supported and will never be supported.
|#
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(in-package  :dg-examples)
(use-package '( :oli))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; define a dialog with some buttons specified as ':minimal-ui T'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(sd-defdialog
 'present_minimized_ui_chances
 :dialog-control :parallel
 :dialog-title "Minimal UI example"
 :after-initialization-ui
 '(when (sd-control-visible-p "PRESENT_MINIMIZED_UI_CHANCES")
    (display "To see the possibilities of Minimized UI you should use the
Tools/Customize command to push the ICON 'Minimized UI' out of 'SolidDesigner/Test' group into a toolbar of your choice and call it from over there.")
    )
 :variables
 '(
   (ROT_ANGLE 
    ;; this variable will be visible in minimized UI
    :minimal-ui T
    :minimal-ui-title "Absolute Angle" 
    :minimal-ui-width  25 ;;  the width in GRID unit
    :title "Abs Angle" 
    :value-type :angle
    :proposals ()
    :auto-add-proposals T
    )
   (MOVE_LENGTH
    ;; this variable will be visible in minimized UI
    :minimal-ui T
    :title "Length" 
    :value-type :length
    :proposals '()
    :auto-add-proposals T
    )
   (COMMENT
    ;; this variable will NOT be visible in minimized UI, but will be shown 
    ;;   when user requests the complete UI
    :title "Comment" 
    :value-type :string
    :initial-optional T
    :prompt-text "What do you want to tell me?  [string]"
    :show-input-tool
    (sd-show-general-text-editor
     ;:title (sd-get-control-title (sd-get-variable-ui-properties 'present_minimized_ui_chances :comment :TB))
     :title "What do you want to tell me?"
     :initialText comment
     :position `(,(sd-get-variable-ui-properties 'present_minimized_ui_chances :comment :TB)
		 :leftcenter)
     )
    :hide-input-tool (sd-hide-general-text-editor)
    :after-input 
    (progn
      (pprint (format nil "I would like to tell you: ~A " comment))
      )
    :proposals '()
    :auto-add-proposals T
    )
   (HIDDEN_TEXT
    ;; this variable will NOT be visible at all! (regardless of minimized or not)
    :toggle-type :invisible
    :prompt-text "What additional thing do you want to tell me?  [string]"
    :value-type :string
    :after-input (pprint "There's only a hidden secret not to be told.... ")
    )
   )
 :ok-action
 '(display (format nil "You entered ~%~A ~A~%~A ~A~%~A ~A~%"
		 "a rotation angle of " (sd-num-to-string (sd-sys-to-user-units :angle rot_angle))
		 "a move length of " (sd-num-to-string (sd-sys-to-user-units :length move_length))
		 "and (may be) the comment " (or comment "")
		 ))
 )


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; to have access to the miminized UI the UI behaviour has
;;  to be set to :on-request. Therefore we add an available
;;  command now:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(sd-define-available-command "SolidDesigner" "Test" "Present Minimized UI"
			     :commandTitle    "Minimized UI"
			     :action          "present_minimized_ui_chances"
			     :description     "Show the possibilities of minimized UI of OSD 12.x"
			     :ui-behavior     :on-request
			     )

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; well these (normally default) settings have to be set 
;;  to work with UI on request and minimal UI's
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(ui_settings :USE-VP-BUTTONS :ON :OPTION-DIALOG-POS :LEFT)

;  END of Example