# Ayam, a free 3D modeler for the RenderMan interface.
#
# Ayam is copyrighted 1998-2009 by Randolf Schultz
# (randolf.schultz@gmail.com) and others.
#
# All rights reserved.
#
# See the file License for details.

# refcard.tcl - prettyprint current hot key configuration

# printHotKeys:
# creates a small (one page) LaTeX document containing some
# tables with the most important hot keys
# USAGE:
# in the Ayam console, type:
# >source refcard.tcl; printHotKeys refcard.tex
# then, in a real shell:
# >pdflatex refcard.tex
proc printHotKeys { filename } {
    global ay aymainshortcuts ayviewshortcuts

    set id [open $filename w]

    puts $id "\\documentclass\[10pt,a4paper\]\{article\}"
    puts $id "\\usepackage\[T1\]\{fontenc\}"
    puts $id "\\usepackage\[landscape,lmargin=5mm,rmargin=5mm,bmargin=10mm\]\{geometry\}"
    puts $id "\\usepackage\{multicol\}"
    puts $id "\\usepackage\{multirow\}"
    puts $id "\\usepackage\{lmodern\}"

    puts $id "\\title\{Ayam $ay(ay_version) Hot Keys\}"
    puts $id "\\date\{\}"
    puts $id "\\begin\{document\}"
    puts $id "\\topmargin -4cm"
    puts $id "\\maketitle\\thispagestyle\{empty\}\\vspace*\{-2cm\}"
    puts $id "\\begin\{multicols\}\{3\}"

################

    puts $id "\\noindent\{\\bf File Operations\} (Main Window):\\\\"
    puts $id "\\begin\{tabular\}\{\|l\|l\|\}"
    puts $id "\\hline"
    puts $id "Action & Key\\\\"
    puts $id "\\hline"
    puts $id "\\hline"
    puts $id "New & \\verb|<[remkpkr $aymainshortcuts(New)]>|\\\\"
    puts $id "\\hline"
    puts $id "Insert & \\verb|<[remkpkr $aymainshortcuts(Insert)]>|\\\\"
    puts $id "\\hline"
    puts $id "Open & \\verb|<[remkpkr $aymainshortcuts(Replace)]>|\\\\"
    puts $id "\\hline"
    puts $id "Save & \\verb|<[remkpkr $aymainshortcuts(Save)]>|\\\\"
    puts $id "\\hline"
    puts $id "Save as & \\verb|<[remkpkr $aymainshortcuts(SaveAs)]>|\\\\"
    puts $id "\\hline"
    puts $id "Export RIB & \\verb|<[remkpkr $aymainshortcuts(ExportRIB)]>|\\\\"
    puts $id "\\hline"
    puts $id "Quit & \\verb|<[remkpkr $aymainshortcuts(Quit)]>|\\\\"
    puts $id "\\hline"
    puts $id "\\end\{tabular\}"

    puts $id "\\vspace \{0.5cm\}\\\\"
################
    puts $id "\{\\bf Edit Operations\} (Main Window):\\\\"
    puts $id "\\begin\{tabular\}\{\|l\|l\|\}"
    puts $id "\\hline"
    puts $id "Action & Key\\\\"
    puts $id "\\hline"
    puts $id "\\hline"
    puts $id "Copy & \\verb|<[remkpkr $aymainshortcuts(Copy)]>|\\\\"
    puts $id "\\hline"
    puts $id "Cut & \\verb|<[remkpkr $aymainshortcuts(Cut)]>|\\\\"
    puts $id "\\hline"
    puts $id "Paste & \\verb|<[remkpkr $aymainshortcuts(Paste)]>|\\\\"
    puts $id "\\hline"
    puts $id "Copy Property & \\verb|<[remkpkr $aymainshortcuts(CopyP)]>|\\\\"
    puts $id "\\hline"
    puts $id "Paste Property& \\verb|<[remkpkr $aymainshortcuts(PasteP)]>|\\\\"
    puts $id "\\hline"
    puts $id "Select All& \\verb|<[remkpkr $aymainshortcuts(SelAll)]>|\\\\"
    puts $id "\\hline"
    puts $id "Select None& \\verb|<[remkpkr $aymainshortcuts(SelNone)]>|\\\\"
    puts $id "\\hline"

    puts $id "Create/Edit Material & \\verb|<[remkpkr $aymainshortcuts(Material)]>|\\\\"
    puts $id "\\hline"

    puts $id "Find Master& \\verb|<[remkpkr $aymainshortcuts(Master)]>|\\\\"
    puts $id "\\hline"

    puts $id "Preferences& \\verb|<[remkpkr $aymainshortcuts(Prefs)]>|\\\\"

    puts $id "\\hline"
    puts $id "Apply & \\verb|<[remkpkr $aymainshortcuts(Apply)]>|\\\\"
    puts $id "\\hline"
    puts $id "Switch Console & \\verb|<[remkpkr $aymainshortcuts(SwCon)]>|\\\\"
    puts $id "\\hline"
    puts $id "Repeat Tool& \\verb|<[remkpkr $aymainshortcuts(LastTool)]>|\\\\"
    puts $id "\\hline"
    puts $id "\\end\{tabular\}\\\\"

    puts $id "\\vspace \{0.5cm\}\\\\"
################
    puts $id "\{\\bf View Operations\} (View Windows):\\\\"
    puts $id "\\begin\{tabular\}\{\|l\|l\|\}"
    puts $id "\\hline"
    puts $id "Action & Key\\\\"
    puts $id "\\hline"
    puts $id "\\hline"
    puts $id "Quick Render& \\verb|<[remkpkr $ayviewshortcuts(QRender)]>|\\\\"
    puts $id "\\hline"
    puts $id "Render & \\verb|<[remkpkr $ayviewshortcuts(Render)]>|\\\\"
    puts $id "\\hline"
    puts $id "Redraw & \\verb|<[remkpkr $ayviewshortcuts(Redraw)]>|\\\\"
    puts $id "\\hline"
    puts $id "Export RIB & \\verb|<[remkpkr $aymainshortcuts(ExportRIB)]>|\\\\"
    puts $id "\\hline"
    puts $id "Close* & \\verb|<[remkpkr $ayviewshortcuts(Close)]>|\\\\"
    puts $id "\\hline"
    puts $id "\\hline"
    puts $id "Make Front* & \\verb|<[remkpkr $ayviewshortcuts(Front)]>|\\\\"
    puts $id "\\hline"
    puts $id "Make Side* & \\verb|<[remkpkr $ayviewshortcuts(Side)]>|\\\\"
    puts $id "\\hline"
    puts $id "Make Top* & \\verb|<[remkpkr $ayviewshortcuts(Top)]>|\\\\"
    puts $id "\\hline"
    puts $id "Make Perspective* & \\verb|<[remkpkr $ayviewshortcuts(Persp)]>|\\\\"
    puts $id "\\hline"
    puts $id "Make Trim* & \\verb|<[remkpkr $ayviewshortcuts(Trim)]>|\\\\"
    puts $id "\\hline"
    puts $id "\\end\{tabular\}\\\\"
    puts $id "\\vspace \{0.5cm\}\\\\"
## ## ##
    puts $id "\{\\small * - external views only\}\\\\"
    puts $id "\\vfill\\columnbreak"
## ## ##
    puts $id "\\noindent\{\\bf View Operations\} (View Windows):\\\\"
    puts $id "\\begin\{tabular\}\{\|l\|p\{4cm\}\|\}"
    puts $id "\\hline"
    puts $id "Action & Key\\\\"
    puts $id "\\hline"
    puts $id "\\hline"
    puts $id "Halve Size* & \\verb|<[remkpkr $ayviewshortcuts(Halve)]>|\\\\"
    puts $id "\\hline"
    puts $id "Double Size* & \\verb|<[remkpkr $ayviewshortcuts(Double)]>|\\\\"
    puts $id "\\hline"
    puts $id "\\hline"
    puts $id "Toggle Redraw & \\verb|<[remkpkr $ayviewshortcuts(Auto)]>|\\\\"
    puts $id "\\hline"
    puts $id "Toggle Shading* & \\verb|<[remkpkr $ayviewshortcuts(Shade)]>|\\\\"
    puts $id "\\hline"
    puts $id "Draw Grid & \\verb|<[remkpkr $ayviewshortcuts(DGrid)]>|\\\\"
    puts $id "\\hline"
    puts $id "Use Grid & \\verb|<[remkpkr $ayviewshortcuts(UGrid)]>|\\\\"
    puts $id "\\hline"
    puts $id "Set Gridsize & \\verb|<[remkpkr $ayviewshortcuts(SGrid)]>|\\\\"
    puts $id "\\hline"
    puts $id "Zoom to Object & \\verb|<[remkpkr $ayviewshortcuts(ZoomTO)]>* / <[remkpkr $ayviewshortcuts(ZoomTO2)]>|\\\\"
    puts $id "\\hline"
    puts $id "Align & \\verb|<[remkpkr $ayviewshortcuts(Align)]>* / <[remkpkr $ayviewshortcuts(Align2)]>|\\\\"
    puts $id "\\hline"
    puts $id "Toggle Local & \\verb|<[remkpkr $ayviewshortcuts(Local)]>* / <[remkpkr $ayviewshortcuts(Local2)]>|\\\\"
    puts $id "\\hline"
    puts $id "\\hline"
    puts $id "\\multirow\{2\}\{*\}\{Cycle Type\} & \\verb|<[remkpkr $ayviewshortcuts(TypeUp)]> /|\\\\"
    puts $id "& \\verb|<[remkpkr $ayviewshortcuts(TypeDown)]>|\\\\"
    puts $id "\\hline"
    puts $id "\\multirow\{2\}\{*\}\{Cycle DrawMode\} & \\verb|<[remkpkr $ayviewshortcuts(DMUp)]> /|\\\\"
    puts $id "&\\verb|<[remkpkr $ayviewshortcuts(DMDown)]>|\\\\"
    puts $id "\\hline"
    puts $id "\\end\{tabular\}"

    puts $id "\\vspace \{0.5cm\}\\\\"

################
    puts $id "\{\\bf Modelling Actions\} (View Windows):\\\\"
    puts $id "\\begin\{tabular\}\{\|l\|l\|\}"
    puts $id "\\hline"
    puts $id "Action & Key\\\\"
    puts $id "\\hline"
    puts $id "\\hline"
    puts $id "\\multirow\{2\}\{*\}\{Move (restrict to X, Y, Z)\} & \\verb|<[remkpkr $ayviewshortcuts(MoveO)]>|\\\\"
    puts $id "& (\\verb|<[remkpkr $ayviewshortcuts(MoveO)][remkpkr $ayviewshortcuts(RestrictX)]>|, \\verb|<[remkpkr $ayviewshortcuts(MoveO)][remkpkr $ayviewshortcuts(RestrictY)]>|, \\verb|<[remkpkr $ayviewshortcuts(MoveO)][remkpkr $ayviewshortcuts(RestrictZ)]>|)\\\\"
    puts $id "\\hline"
    puts $id "\\multirow\{2\}\{*\}\{Rotate (about Mark/Objs./Pnts.)\} & \\verb|<[remkpkr $ayviewshortcuts(RotO)]>|\\\\"
    puts $id "& (\\verb|<[remkpkr $ayviewshortcuts(RotO)][remkpkr $ayviewshortcuts(About)]>|/\\verb|<[remkpkr $ayviewshortcuts(RotO)][remkpkr $ayviewshortcuts(CenterO)]>|/\\verb|<[remkpkr $ayviewshortcuts(RotO)][remkpkr $ayviewshortcuts(CenterP)]>|)\\\\"
    puts $id "\\hline"
    puts $id "Scale 1D X (about Mark/Objs.)& \\verb|<[remkpkr $ayviewshortcuts(Scal2)][remkpkr $ayviewshortcuts(RestrictX)]>| (\\verb|<[remkpkr $ayviewshortcuts(Scal2)][remkpkr $ayviewshortcuts(RestrictX)][remkpkr $ayviewshortcuts(About)]>|/\\verb|<[remkpkr $ayviewshortcuts(Scal2)][remkpkr $ayviewshortcuts(RestrictX)][remkpkr $ayviewshortcuts(CenterO)]>|)\\\\"
    puts $id "\\hline"
    puts $id "Scale 1D Y (about Mark/Objs.)& \\verb|<[remkpkr $ayviewshortcuts(Scal2)][remkpkr $ayviewshortcuts(RestrictY)]>| (\\verb|<[remkpkr $ayviewshortcuts(Scal2)][remkpkr $ayviewshortcuts(RestrictY)][remkpkr $ayviewshortcuts(About)]>|/\\verb|<[remkpkr $ayviewshortcuts(Scal2)][remkpkr $ayviewshortcuts(RestrictY)][remkpkr $ayviewshortcuts(CenterO)]>|)\\\\"
    puts $id "\\hline"
    puts $id "Scale 1D Z (about Mark/Objs.)& \\verb|<[remkpkr $ayviewshortcuts(Scal2)][remkpkr $ayviewshortcuts(RestrictZ)]>| (\\verb|<[remkpkr $ayviewshortcuts(Scal2)][remkpkr $ayviewshortcuts(RestrictZ)][remkpkr $ayviewshortcuts(About)]>|/\\verb|<[remkpkr $ayviewshortcuts(Scal2)][remkpkr $ayviewshortcuts(RestrictZ)][remkpkr $ayviewshortcuts(CenterO)]>|)\\\\"
    puts $id "\\hline"
    puts $id "Scale 2D (about Mark/Objs.)& \\verb|<[remkpkr $ayviewshortcuts(Scal2)]>| (\\verb|<[remkpkr $ayviewshortcuts(Scal2)][remkpkr $ayviewshortcuts(About)]>|/\\verb|<[remkpkr $ayviewshortcuts(Scal2)][remkpkr $ayviewshortcuts(CenterO)]>|)\\\\"
    puts $id "\\hline"
    puts $id "Scale 3D (about Mark/Objs.)& \\verb|<[remkpkr $ayviewshortcuts(Scal3)]>| (\\verb|<[remkpkr $ayviewshortcuts(Scal3)][remkpkr $ayviewshortcuts(About)]>|/\\verb|<[remkpkr $ayviewshortcuts(Scal3)][remkpkr $ayviewshortcuts(CenterO)]>|)\\\\"
    puts $id "\\hline"
    puts $id "Stretch 2D (about Mark/Objs.)& \\verb|<[remkpkr $ayviewshortcuts(Stretch)]>| (\\verb|<[remkpkr $ayviewshortcuts(Stretch)][remkpkr $ayviewshortcuts(About)]>|/\\verb|<[remkpkr $ayviewshortcuts(Stretch)][remkpkr $ayviewshortcuts(CenterO)]>|)\\\\"
    puts $id "\\hline"
    puts $id "Mark (Objs. COG / Pnts. COG)& \\verb|<[remkpkr $ayviewshortcuts(About)]>| / \\verb|<[remkpkr $ayviewshortcuts(About)][remkpkr $ayviewshortcuts(CenterO)]>| / \\verb|<[remkpkr $ayviewshortcuts(About)][remkpkr $ayviewshortcuts(CenterP)]>|\\\\"
    puts $id "\\hline"
    puts $id "\\hline"
    puts $id "Edit Point (directly)& \\verb|<[remkpkr $ayviewshortcuts(Edit)]>| (\\verb|<[remkpkr $ayviewshortcuts(EditD)]>|)\\\\"
    puts $id "\\hline"
    puts $id "Edit Weight& \\verb|<[remkpkr $ayviewshortcuts(WeightE)]>|\\\\"
    puts $id "\\hline"
    puts $id "Reset all Weights& \\verb|<[remkpkr $ayviewshortcuts(WeightR)]>|\\\\"
    puts $id "\\hline"
    puts $id "Select (tag) Points& \\verb|<[remkpkr $ayviewshortcuts(Select)]>|\\\\"
    puts $id "\\hline"
    puts $id "Select all / no Points, Inv. Sel.& \\verb|<[remkpkr $ayviewshortcuts(SelAllP)]>| / \\verb|<[remkpkr $ayviewshortcuts(DeSelect)]>|, \\verb|<[remkpkr $ayviewshortcuts(InvSelP)]>|\\\\"
    puts $id "\\hline"
    puts $id "Insert Point & \\verb|<[remkpkr $ayviewshortcuts(InsertP)]>|\\\\"
    puts $id "\\hline"
    puts $id "Delete Point & \\verb|<[remkpkr $ayviewshortcuts(DeleteP)]>|\\\\"
    puts $id "\\hline"
    puts $id "Snap Points to Grid (2D / 3D)& \\verb|<[remkpkr $ayviewshortcuts(SnapGrid2D)]>| / \\verb|<[remkpkr $ayviewshortcuts(SnapGrid3D)]>|\\\\"
    puts $id "\\hline"
    puts $id "\\end\{tabular\}"

    puts $id "\\vspace \{0.5cm\}\\\\"

## ## ##
    puts $id "\\vfill\\columnbreak"
## ## ##

    puts $id "\\noindent\{\\bf Camera Actions\} (View Windows):\\\\"
    puts $id "\\begin\{tabular\}\{\|l\|l\|\}"
    puts $id "\\hline"
    puts $id "Action & Key\\\\"
    puts $id "\\hline"
    puts $id "\\hline"
    puts $id "Rotate View & \\verb|<[remkpkr $ayviewshortcuts(RotV)]>|\\\\"
    puts $id "\\hline"
    puts $id "Zoom View & \\verb|<[remkpkr $ayviewshortcuts(ZoomV)]>|\\\\"
    puts $id "\\hline"
    puts $id "Move View& \\verb|<[remkpkr $ayviewshortcuts(MoveV)]>|\\\\"
    puts $id "\\hline"
    puts $id "Move View (Z)& \\verb|<[remkpkr $ayviewshortcuts(MoveZV)]>|\\\\"
    puts $id "\\hline"
    puts $id "\\hline"
    puts $id "Rotate View & \\verb|<[remkpkr $ayviewshortcuts(RotMod)+Mouse-$ayviewshortcuts(RotButton)]>|\\\\"
    puts $id "\\hline"
    puts $id "Zoom into Region & \\verb|<[remkpkr $ayviewshortcuts(ZoomRMod)+Mouse-$ayviewshortcuts(ZoomRButton)]>|\\\\"
    puts $id "\\hline"
    puts $id "Zoom View & \\verb|Mouse-$ayviewshortcuts(ZoomVButton)|\\\\"
    puts $id "\\hline"
    puts $id "Move View & \\verb|Mouse-$ayviewshortcuts(MoveVButton)|\\\\"
    puts $id "\\hline"
    puts $id "\\end\{tabular\}"

    puts $id "\\vspace \{0.5cm\}\\\\"
################
    puts $id "\{\\bf Miscellaneous\} (View Windows):\\\\"
    puts $id "\\begin\{tabular\}\{\|l\|l\|\}"
    puts $id "\\hline"
    puts $id "Action & Key\\\\"
    puts $id "\\hline"
    puts $id "\\hline"
    puts $id "Break Action& \\verb|<[remkpkr $ayviewshortcuts(Break)]>|\\\\"
    puts $id "\\hline"
    puts $id "\\multirow\{2\}\{*\}\{Rotate View (Y)\}& \\verb|<[remkpkr $ayviewshortcuts(RotL)]>|\\\\"
    puts $id "& \\verb|<[remkpkr $ayviewshortcuts(RotR)]>|\\\\"
    puts $id "\\hline"
    puts $id "\\multirow\{2\}\{*\}\{Rotate View (X)\}& \\verb|<[remkpkr $ayviewshortcuts(RotU)]>|\\\\"
    puts $id "& \\verb|<[remkpkr $ayviewshortcuts(RotD)]>|\\\\"
    puts $id "\\hline"
    puts $id "\\multirow\{2\}\{*\}\{Pan View (X)\}& \\verb|<[remkpkr $ayviewshortcuts(PanL)]>|\\\\"
    puts $id "& \\verb|<[remkpkr $ayviewshortcuts(PanR)]>|\\\\"
    puts $id "\\hline"
    puts $id "\\multirow\{2\}\{*\}\{Pan View (Y)\}& \\verb|<[remkpkr $ayviewshortcuts(PanU)]>|\\\\"
    puts $id "& \\verb|<[remkpkr $ayviewshortcuts(PanD)]>|\\\\"
    puts $id "\\hline"
    puts $id "Zoom View In& \\verb|<[remkpkr $ayviewshortcuts(ZoomI)]>|\\\\"
    puts $id "\\hline"
    puts $id "Zoom View Out& \\verb|<[remkpkr $ayviewshortcuts(ZoomO)]>|\\\\"
    puts $id "\\hline"
    puts $id "\\hline"
    puts $id "Hide Object& \\verb|<[remkpkr $ayviewshortcuts(Hide)]>|\\\\"
    puts $id "Show Object& \\verb|<[remkpkr $ayviewshortcuts(Show)]>|\\\\"
    puts $id "\\hline"
    puts $id "Split Curve& \\verb|<[remkpkr $ayviewshortcuts(SplitNC)]>|\\\\"
    puts $id "\\hline"
    puts $id "Find Parameter& \\verb|<[remkpkr $ayviewshortcuts(FindU)]>|\\\\"
    puts $id "\\hline"
    puts $id "Collapse Points& \\verb|<[remkpkr $ayviewshortcuts(CollP)]>|\\\\"
    puts $id "Explode Points& \\verb|<[remkpkr $ayviewshortcuts(ExplP)]>|\\\\"
    puts $id "\\hline"
    puts $id "\\end\{tabular\}"

    puts $id "\\vspace \{0.3cm\}\\\\"

    puts $id "\{\\bf Global\} (All Windows):\\\\"
    puts $id "\\begin\{tabular\}\{\|l\|l\|\}"
    puts $id "\\hline"
    puts $id "Action & Key\\\\"
    puts $id "\\hline"
    puts $id "\\hline"
    puts $id "Show Property& \\verb|<0>-<9>|\\\\"
    puts $id "\\hline"
    puts $id "Zap (Hide) Ayam& \\verb|<[remkpkr $aymainshortcuts(Zap)]>|\\\\"
    puts $id "\\hline"
    puts $id "Help & \\verb|<[remkpkr $aymainshortcuts(Help)]>|\\\\"
    puts $id "\\hline"
    puts $id "Undo & \\verb|<[remkpkr $aymainshortcuts(Undo)]>|\\\\"
    puts $id "\\hline"
    puts $id "Redo & \\verb|<[remkpkr $aymainshortcuts(Redo)]>|\\\\"
    puts $id "\\hline"
    puts $id "\\end\{tabular\}"


    puts $id "\\end\{multicols\}"
    puts $id "\\end\{document\}"

    close $id

 return;
}
