#-----------------------------------------------------------------------
# File:         decor
# Version:      0.1.1
# Licence:      GPL 2
#
# Description:  decor parts (titlebar, buttons, menus) of Rocken theme
#               by Thibaut28
#               http://thibaut28.deviantart.com/art/Rocken-v0-3-179136929
#
# Author:       Thomas Funk <t.funk@web.de>
#
# Created:      05/06/2014
# Changed:      08/15/2014
#-----------------------------------------------------------------------

Piperead "echo InfoStoreAdd button_width `perl -e 'printf \"%.0f\",1.9*$[infostore.fontsize]'`"

#***********************************************************************
# General
#***********************************************************************
# HandleWidth takes a numeric argument which is the width of the border
Style * Borderwidth 2, HandleWidth 2
Style * Colorset 1

Style * HilightColorset 2
Style * BorderColorset 3
Style * HilightBorderColorset 4

Style * Button 2, Button 4, Button 6, Button 8
Style * IconTitleColorset 10
Style * HilightIconTitleColorset 11


DestroyDecor Default
AddToDecor Default
#***********************************************************************
# Titlebar
#***********************************************************************
+ TitleStyle AllActive (TiledPixmap $[FNS_THEMEDIR]/images/title.svg:1x$[infostore.button_width] -- Flat)
+ TitleStyle AllInactive (TiledPixmap $[FNS_THEMEDIR]/images/title.svg:1x$[infostore.button_width] -- Flat)
+ TitleStyle LeftJustified Height $[infostore.button_width] -- flat

#***********************************************************************
# Border
#***********************************************************************
+ BorderStyle    Simple -- HiddenHandles NoInset

#***********************************************************************
# Buttons
#***********************************************************************

# +----------------------------------------------------------+
# | X  X  X                                       X  X  X  X |
# +----------------------------------------------------------+
# | 1  3  5                                       8  6  4  2 |
# |                                                          |
#                                                                  
#


+ ButtonStyle 8 ActiveUp    Pixmap $[FNS_THEMEDIR]/images/desk.svg:$[infostore.button_width]x$[infostore.button_width] -- flat
+ ButtonStyle 8 ActiveDown  Pixmap $[FNS_THEMEDIR]/images/desk_down.svg:$[infostore.button_width]x$[infostore.button_width] -- flat
+ ButtonStyle 8 InactiveUp  Pixmap $[FNS_THEMEDIR]/images/desk_inactive.svg:$[infostore.button_width]x$[infostore.button_width] -- flat

+ ButtonStyle 2 ActiveUp    Pixmap $[FNS_THEMEDIR]/images/close.svg:$[infostore.button_width]x$[infostore.button_width] -- flat
+ ButtonStyle 2 ActiveDown  Pixmap $[FNS_THEMEDIR]/images/close_down.svg:$[infostore.button_width]x$[infostore.button_width] -- flat
+ ButtonStyle 2 InactiveUp  Pixmap $[FNS_THEMEDIR]/images/close_inactive.svg:$[infostore.button_width]x$[infostore.button_width] -- flat

+ ButtonStyle 4 ActiveUp    Pixmap $[FNS_THEMEDIR]/images/maximize.svg:$[infostore.button_width]x$[infostore.button_width] -- flat
+ ButtonStyle 4 ActiveDown  Pixmap $[FNS_THEMEDIR]/images/maximize_down.svg:$[infostore.button_width]x$[infostore.button_width] -- flat
+ ButtonStyle 4 InactiveUp  Pixmap $[FNS_THEMEDIR]/images/maximize_inactive.svg:$[infostore.button_width]x$[infostore.button_width] -- flat

+ ButtonStyle 6 ActiveUp    Pixmap $[FNS_THEMEDIR]/images/minimize.svg:$[infostore.button_width]x$[infostore.button_width] -- flat
+ ButtonStyle 6 ActiveDown  Pixmap $[FNS_THEMEDIR]/images/minimize_down.svg:$[infostore.button_width]x$[infostore.button_width] -- flat
+ ButtonStyle 6 InactiveUp  Pixmap $[FNS_THEMEDIR]/images/minimize_inactive.svg:$[infostore.button_width]x$[infostore.button_width] -- flat

+ ButtonStyle All -- UseTitleStyle
+ ButtonStyle All ActiveUp (-- flat) Inactive (-- flat)

#=======================================================================
# Menus
#=======================================================================
# The MenuStyle command allows almost full control over menu look and feel.
# We use the preconfigured 'Fvwm' default. This resets most other options
# and must be set first. We also define a menu called winops for the windows
# operations menus and very long one. The menus which use this style are 
# (and must) be defined in the end of the menus.

#***********************************************************************
# Root menu
#***********************************************************************
MenuStyle * fvwm
MenuStyle * Greyed gray45
MenuStyle * BorderWidth 1, HilightBack, ActiveFore, HilightTitleBack
MenuStyle * font "xft:$[infostore.used_font]:pixelsize=$[infostore.fontsize]"
MenuStyle * MenuColorset 5, ActiveColorset 6, TitleColorset 7
MenuStyle * Hilight3DThickness 0, TrianglesSolid, !Animation
MenuStyle * PopupDelay 300, PopdownImmediately, PopupOffset 0 100
MenuStyle * ItemFormat "%s%|%5.i%5.5l%5.5r%.5>%|"
MenuStyle * VerticalItemSpacing 2 3, VerticalTitleSpacing 1 2

#***********************************************************************
# WinOps menu
#***********************************************************************
CopyMenuStyle * winops

MenuStyle winops TitleWarpOff
MenuStyle winops VerticalItemSpacing 1 2, VerticalTitleSpacing 1 2


#=======================================================================
# Mouse bindings
#=======================================================================
# Handle some Mouse bindings now...
# Recall that mouse formats look like this:
#
# +------------+
# | ||  ||  || |
# |            |
# +------------+
#   1   2   3

#-----------------------------------------------------------------------
# Contexts:                                  Desktop
#     R = Root Window                 rrrrrrrrrrrrrrrrrrrrrr
#     W = Application Window          rIrrrrFSSSSSSSSSFrrrrr
#     F = Frame Corners               rrrrrrS13TTTT642Srrrrr
#     S = Frame Sides                 rIrrrrSwwwwwwwwwSrrrrr
#     T = Title Bar                   rrrrrrSwwwwwwwwwSrrrrr
#     I = Icon                        rIrrrrFSSSSSSSSSFrrrrr
#                                     rrrrrrrrrrrrrrrrrrrrrr
# Numbers are buttons: 1 3 5 7 9   0 8 6 4 2
#
# Modifiers: (A)ny, (C)ontrol, (S)hift, (M)eta, (N)othing
#-----------------------------------------------------------------------
# Buttons:
# +----------------------------------------------------------+
# | X  X  X  X  X                              X  X  X  X  X |
# +----------------------------------------------------------+
# | 1  3  5  7  9                              0  8  6  4  2 |
# |                                                          |
#

#***********************************************************************
# Pointer in Window Buttons
#***********************************************************************
#     Button    Context     Modifi  Function

# dot button (8)
# Button 1 shows MenuWindowOpsTrimmed menu <- click
Mouse 1         8           A       Menu MenuWindowOpsTrimmed
# Button 2 shows Move to page menu <- click
Mouse 2         8           A       Menu MenuWindowMoveTo
# Button 3 shows WindowOps group menu <- click
Mouse 3         8           A       Menu MenuWindowGroupOps

# Close button (2)
# Every button close window <- click
Mouse 0         2           A       FuncDeleteOrDestroy

# Maximize button (4)
# Button 1 maximize window <- click
Mouse 1         4           A       FuncMaximize
# Button 2 maximize window vertically <- click
Mouse 2         4           A       FuncMaximizeVertically
# Button 2 + Alt key maximize window horizontally <- click
Mouse 2         4           M       FuncMaximizeHorizontally
# Button 3 maximize window horizontally <- click
Mouse 3         4           A       SendToModule FvwmSmartMaximize IgnoreMaxWindows screen

# Minimize button (6)
# Button 1 iconify window <- click
Mouse 1         6           A       FuncIconify
# Button 2 iconify group of same window resources <- click ???
Mouse 2         6           A       FuncIconifySameResource on
# Button 3 iconify group of same window resources <- click ???
Mouse 3         6           A       FuncIconifySameResource toggle

#-----------------------------------------------------------------------
# Help info with SHIFT-CTRL-ALT to Window Button Pointer
#-----------------------------------------------------------------------
#     Button    Context     Modifi  Function
Mouse 0         8           SCM     FuncShowMessage  "Left Button Bindings" \
"Mouse 1:  WindowOps menu" \
"Mouse 2:  Move to page menu" \
"Mouse 3:  WindowGroupOps menu"
                                                      
Mouse 0         2           SCM     FuncShowMessage  "Close Button Bindings" \
"Mouse 1:  Delete on click" \
"          Destroy on double click"
                                                      
Mouse 0         4           SCM     FuncShowMessage  "Maximize Button Bindings" \
"Mouse 1:       Maximize fully on click" \
"               Maximize menu on double click" \
"Mouse 2:       Maximize vertically" \
"Mouse 2 + Alt: Maximize horizontally" \
"Mouse 3:       Maximize smart"
                                                      
Mouse 0         6           SCM     FuncShowMessage  "Minimize Button Bindings" \
"Mouse 1:  Iconify" \
"Mouse 2:  Iconify on resource group" \
"Mouse 3:  Iconify toggle resource group"


DestroyFunc FuncRemoveAllButtonBindings
AddToFunc   FuncRemoveAllButtonBindings
#   Button      Context     Modifi  Function
+ I Mouse 1     1           A       -
+ I Mouse 2     1           A       -
+ I Mouse 3     1           A       -
+ I Mouse 0     2           A       -
+ I Mouse 1     4           A       -
+ I Mouse 2     4           A       -
+ I Mouse 2     4           M       -
+ I Mouse 3     4           A       -
+ I Mouse 1     6           A       -
+ I Mouse 2     6           A       -
+ I Mouse 3     6           A       -
+ I Mouse 1     8           A       -
+ I Mouse 2     8           A       -
+ I Mouse 3     8           A       -
+ I Mouse 0     3           SCM     -
+ I Mouse 0     2           SCM     -
+ I Mouse 0     4           SCM     -
+ I Mouse 0     6           SCM     -
+ I Mouse 0     8           SCM     -
