
%% Style file for mdframed for package option `framemethod=pstricks`
%%
%% This package may be distributed under the terms of the LaTeX Project
%% Public License, as described in lppl.txt in the base LaTeX distribution.
%% Either version 1.0 or, at your option, any later version.
%%
\def\mdframedIIpackagename{md-frame-2}
\ProvidesFile{md-frame-2.mdf}%
      [\mdfmaindate\ %
       \mdversion: \mdframedIIpackagename]
\def\mdf@ptlength@to@pscode#1{\pst@number{#1} \pst@number\psxunit div }
\def\mdf@ptlength@to@pscode@length#1{%
  \pst@number{\csname mdf@#1@length\endcsname}
  \pst@number\psxunit div\space}
\let\ptTps\mdf@ptlength@to@pscode\relax
\let\ptTpsL\mdf@ptlength@to@pscode@length\relax
\def\mdfpstricks@settings{%expand by \addtopsstyle
  \newpsstyle{mdfbackgroundstyle}%
    {linecolor=\mdf@backgroundcolor,fillstyle=solid,%
     fillcolor=\mdf@backgroundcolor,linestyle=none,%
    ,dimen=middle,%
    }%
  \newpsstyle{mdfframetitlebackgroundstyle}{%
     linecolor=\mdf@frametitlebackgroundcolor,
     fillcolor=\mdf@frametitlebackgroundcolor,
     fillstyle=solid,linestyle=none,
     linearc=\ifdimgreater{\mdf@roundcorner@length%
                          -\mdf@innerlinewidth@length%
                          -.5\mdf@middlelinewidth@length}
                         {\z@}{\dimexpr\mdf@roundcorner@length%
                          -\mdf@innerlinewidth@length%
                          -.5\mdf@middlelinewidth@length}{\z@},
  }
  \newpsstyle{mdfouterlinestyle}{linestyle=none}%
  \ifdimgreater{\mdf@outerlinewidth@length}{\z@}
    {\newpsstyle{mdfouterlinestyle}{%
      linecolor=\mdf@outerlinecolor,%
      linewidth=\dimexpr2\mdf@outerlinewidth@length
                        +\mdf@middlelinewidth@length\relax,
      dimen=middle,
      }}{}%
  \newpsstyle{mdfinnerlinestyle}{linestyle=none}%
  \ifdimgreater{\mdf@innerlinewidth@length}{\z@}%
    {\newpsstyle{mdfinnerlinestyle}{%
      linecolor=\mdf@innerlinecolor,%
      linewidth=\dimexpr2\mdf@innerlinewidth@length
                        +\mdf@middlelinewidth@length\relax,
      dimen=middle,
      }}{}%
  \newpsstyle{mdfmiddlelinestyle}{linestyle=none}%
  \newpsstyle{mdfshadow}{shadow=true,shadowcolor=\mdf@shadowcolor,
                         shadowsize=\mdf@shadowsize@length}%
  \ifdimgreater{\mdf@middlelinewidth@length}{\z@}%
    {\newpsstyle{mdfmiddlelinestyle}{%
      linewidth=\mdf@middlelinewidth@length,%
      linecolor=\mdf@middlelinecolor,dimen=middle
      }}{}%
\mdfpstricks@appendsettings
}%
\newrobustcmd*\mdf@pstricksbox@fl[2]{%four lines
  \psframe[style=mdfouterlinestyle](#1)(#2)%aussen=3mm
  \psframe[style=mdfbackgroundstyle](#1)(#2)%Hintergrund
  \psclip{\psframe[style=mdfmiddlelinestyle](#1)(#2)}
   \psframe[style=mdfinnerlinestyle](#1)(#2)%innere=3mm
  \endpsclip
  \psframe[style=mdfmiddlelinestyle](#1)(#2)%mittlere=2mm
  }%
\newrobustcmd*\mdf@pstricksbox@tl[1]{%three lines
  \psline[style=mdfouterlinestyle]#1%aussen=3mm
  \psline[style=mdfbackgroundstyle]#1%Hintergrund
  \psclip{\psline[style=mdfmiddlelinestyle]#1}
    \psline[style=mdfinnerlinestyle]#1%innere=3mm
  \endpsclip
  \psline[style=mdfmiddlelinestyle]#1%mittlere=2mm
  }%
\newrobustcmd*\mdf@pstricksbox@tcl[2]{%two combined lines
%%#1 background comple
%%#2 line path
  \psline[style=mdfouterlinestyle]#2%aussen=3mm
  \psline[style=mdfbackgroundstyle]#2%Hintergrund
  \psclip{\pscustom[linestyle=none]{
          \psline[style=mdfmiddlelinestyle]#2
          \psline[linestyle=none,linearc=0pt]#1}
          }
    \psframe[style=mdfbackgroundstyle,linearc=0pt](mdf@O)(mdf@P)%Hintergrund
    \psline[style=mdfinnerlinestyle]#2%innere=3mm
  \endpsclip
  \psline[style=mdfmiddlelinestyle]#2%mittlere=2mm
}%
\newrobustcmd*\mdf@pstricksbox@tncl[2]{%two not combined lines
 \begingroup
  \psset{linearc=0pt}
  \psline[style=mdfouterlinestyle](mdf@O)#1%aussen=3mm
  \psline[style=mdfouterlinestyle](mdf@P)#2%aussen=3mm
  \psclip{
    \pscustom[linestyle=none]{%
        \psline[style=mdfmiddlelinestyle](mdf@O)#1%mittlere=2mm
        \psline[linestyle=none](mdf@O)#2
        \psline[style=mdfmiddlelinestyle](mdf@P)#2%mittlere=2mm
        \psline[linestyle=none](mdf@P)#1
      }%
    }%
    \psframe[style=mdfbackgroundstyle,linearc=0pt](mdf@O)(mdf@P)%Hintergrund
    \psline[style=mdfinnerlinestyle](mdf@O)#1%innere=3mm
    \psline[style=mdfinnerlinestyle](mdf@P)#2%innere=3mm
  \endpsclip
  \psline[style=mdfmiddlelinestyle](mdf@O)#1%mittlere=2mm
  \psline[style=mdfmiddlelinestyle](mdf@P)#2%mittlere=2mm
 \endgroup
}%
\newrobustcmd*\mdf@pstricksbox@ol[1]{%one line
 \begingroup
  \psset{linearc=0pt}
  \psline[style=mdfouterlinestyle]#1%aussen=3mm
  \psline[style=mdfbackgroundstyle]#1%Hintergrund
  \psclip{\pscustom[linestyle=none]{
          \psline[style=mdfmiddlelinestyle]#1
          \psframe[linestyle=none,fillstyle=none,dimen=inner](mdf@O)(mdf@P)
          }}
    \psframe[style=mdfbackgroundstyle](mdf@O)(mdf@P)
    \psline[style=mdfinnerlinestyle]#1%innere=3mm
  \endpsclip
  \psline[style=mdfmiddlelinestyle]#1%mittlere=2mm
 \endgroup%
}%

\newpsstyle{mdfframetitlerule}{%
   linecolor=\mdf@frametitlerulecolor,%
   fillcolor=\mdf@frametitlerulecolor,%
   fillstyle=solid,dimen=outer,%
}
\def\mdf@@frametitlerule{%
  \ifbool{mdf@frametitlerule}{%
   \vbox{\hsize0pt
     \par\unskip\vskip\mdf@frametitlebelowskip@length
     \noindent\rlap{%
     \begingroup%
     \begin{pspicture}(0,0)(0,\mdf@frametitlerulewidth@length)
      \psframe[style=mdfframetitlerule]%
              (!\ptTpsL{innerleftmargin} neg 0)%
              (!\ptTpsL{innerrightmargin}
                \ptTps{\mdfframetitleboxwidth} add
                \ptTpsL{frametitlerulewidth})
     \end{pspicture}
     \endgroup}%
   }%
  }{%
   \vbox{\hsize0pt
     \par\unskip\vskip\mdf@frametitlebelowskip@length
     \noindent\rlap{}
   }%
  }%
  \iftoggle{mdf@notfirstframetitle}%
    {%
      \par\unskip\vskip\mdf@splittopskip@length%
    }%
    {%
      \par\unskip\vskip\mdf@innertopmargin@length%
    }%
}%
\def\mdf@drawsubtitleaboveline{%
 \rlap{%
  \hspace*{-\mdf@innerleftmargin@length}%
  \begin{pspicture}(0,0)(\mdf@templength,\mdf@subtitleabovelinewidth@length)
     \psframe[style=mdfsubtitleaboverule]%
              (0,0)(\mdf@templength,\mdf@subtitleabovelinewidth@length)%
  \end{psicture}%
 }%
}
\def\mdf@drawsubtitlebelowline{%
 \rlap{%
  \hspace*{-\mdf@innerleftmargin@length}%
  \begin{pspicture}(0,0)(\mdf@templength,\mdf@subtitlebelowlinewidth@length)
     \psframe[style=mdfsubtitlebelowrule]%
              (0,0)(\mdf@templength,\mdf@subtitleabovelinewidth@length)%
  \end{psicture}%
 }%
}
\def\mdf@drawsubtitlebackground{%
 \rlap{%
  \hspace*{-\mdf@innerleftmargin@length}%
  \begin{pspicture}(0,0)(0,0)
     \psframe[style=mdfsubtitlebackground]%
              (0,0)(\mdf@templength,-\mdfsubtitleheight)%
  \end{psicture}%
 }%
}

\newpsstyle{mdfsubtitleaboverule}{%
   linecolor=\mdf@subtitleabovelinecolor,
   fillcolor=\mdf@subtitleabovelinecolor,
   fillstyle=solid,dimen=outer,%
}

\newpsstyle{mdfsubtitlebelowrule}{%
   linecolor=\mdf@subtitlebelowlinecolor,
   fillcolor=\mdf@subtitlebelowlinecolor,
   fillstyle=solid,dimen=outer,%
}

\newpsstyle{mdfsubtitlebackground}{%
   linecolor=\mdf@subtitlebackgroundcolor,
   fillcolor=\mdf@subtitlebackgroundcolor,
   fillstyle=solid,linestyle=none,
}

\newpsstyle{mdfsubsubtitleaboverule}{%
   linecolor=\mdf@subtitleabovelinecolor,
   fillcolor=\mdf@subtitleabovelinecolor,
   fillstyle=solid,dimen=outer,%
}

\newpsstyle{mdfsubsubtitlebelowrule}{%
   linecolor=\mdf@subtitlebelowlinecolor,
   fillcolor=\mdf@subtitlebelowlinecolor,
   fillstyle=solid,dimen=outer,%
}

\newpsstyle{mdfsubsubtitlebackground}{%
   linecolor=\mdf@subtitlebackgroundcolor,
   fillcolor=\mdf@subtitlebackgroundcolor,
   fillstyle=solid,linestyle=none,
}

\def\mdf@putbox@single{%
  \ifvoid\mdf@splitbox@one\relax
  \else%
   \mdf@makebox@out{%
     \mdf@makeboxalign@left%
    \setlength\mdfboundingboxwidth{\wd\mdf@splitbox@one}%
    \advance\mdfboundingboxwidth by \mdf@innerleftmargin@length\relax%
    \advance\mdfboundingboxwidth by \mdf@innerrightmargin@length\relax%
    \ifbool{mdf@leftline}{%
      \advance\mdfboundingboxwidth by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@outerlinewidth@length\relax}{}%
    \ifbool{mdf@rightline}{%
      \advance\mdfboundingboxwidth by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@outerlinewidth@length\relax}{}%
    \setlength\mdfboundingboxheight%
              {\dimexpr\ht\mdf@splitbox@one+\dp\mdf@splitbox@one\relax}%
    \advance\mdfboundingboxheight by \mdf@innerbottommargin@length\relax%
    \advance\mdfboundingboxheight by \mdf@innertopmargin@length\relax%
    \ifbool{mdf@topline}{%
      \advance\mdfboundingboxheight by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@outerlinewidth@length\relax}{}%
    \ifbool{mdf@bottomline}{%
      \advance\mdfboundingboxheight by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@outerlinewidth@length\relax}{}%
   \setlength\mdftotallinewidth{\dimexpr\mdf@innerlinewidth@length%
                                +\mdf@middlelinewidth@length
                                +\mdf@outerlinewidth@length\relax}%
     \psset{unit=1truecm}%
     \mdf@makebox@in[\mdfboundingboxwidth]{%
       \null%
       \begin{pspicture}(0,0)(\mdfboundingboxwidth,\mdfboundingboxheight)
        \mdfpstricks@settings%
        \psset{linearc=\mdf@roundcorner@length,cornersize=absolut,}%
        \expandafter\psset\expandafter{\mdf@psset@local}%
        \pnode(\mdf@innerleftmargin@length,\mdf@innerbottommargin@length)
              {mdf@A}
        \pnode(0,0){mdf@O}
        \pnode(\mdfboundingboxwidth,\mdfboundingboxheight){mdf@P}
        \ifbool{mdf@leftline}%
          {%
          \nodexn{(mdf@A)+(\mdf@outerlinewidth@length,0)
                          +(\mdf@middlelinewidth@length,0)
                          +(\mdf@innerlinewidth@length,0)}{mdf@A}%
          \nodexn{(mdf@O)+(\mdf@outerlinewidth@length,0)
                          +0.5(\mdf@middlelinewidth@length,0)}{mdf@O}%
         }{}%
       \ifbool{mdf@rightline}%
         {%
          \nodexn{(mdf@P)-(\mdf@outerlinewidth@length,0)
                          -0.5(\mdf@middlelinewidth@length,0)}{mdf@P}%
         }{}%
       \ifbool{mdf@bottomline}%
         {%
          \nodexn{(mdf@A)+(0,\mdf@outerlinewidth@length)
                          +(0,\mdf@middlelinewidth@length)
                          +(0,\mdf@innerlinewidth@length)}{mdf@A}%
          \nodexn{(mdf@O)+(0,\mdf@outerlinewidth@length)
                          +0.5(0,\mdf@middlelinewidth@length)}{mdf@O}%
         }{}%
       \ifbool{mdf@topline}%
         {%
          \nodexn{(mdf@P)-(0,\mdf@outerlinewidth@length)
                          -0.5(0,\mdf@middlelinewidth@length)}{mdf@P}
         }{}%
       \ifbool{mdf@shadow}
           {\psframe[style=mdfshadow](mdf@O)(mdf@P)}{}
         %Four lines
          \mdf@test@ltrb{\mdf@pstricksbox@fl{mdf@O}{mdf@P}}{}
         %three lines
          \mdf@test@ltb{%
              \mdf@pstricksbox@tl{(mdf@P|mdf@O)(mdf@O)(mdf@O|mdf@P)(mdf@P)}}{}
          \mdf@test@trb{%
              \mdf@pstricksbox@tl{(mdf@O)(mdf@P|mdf@O)(mdf@P)(mdf@O|mdf@P)}}{}
          \mdf@test@ltr{%
              \mdf@pstricksbox@tl{(mdf@O)(mdf@O|mdf@P)(mdf@P)(mdf@P|mdf@O)}}{}%
          \mdf@test@lrb{%
              \mdf@pstricksbox@tl{(mdf@O|mdf@P)(mdf@O)(mdf@P|mdf@O)(mdf@P)}}{}%
         %two lines combinded
          \mdf@test@lb{\mdf@pstricksbox@tcl%
                           {(mdf@P|mdf@O)(mdf@P)(mdf@O|mdf@P)}%
                           {(mdf@O|mdf@P)(mdf@O)(mdf@P|mdf@O)}}{}
          \mdf@test@rb{\mdf@pstricksbox@tcl%
                           {(mdf@P)(mdf@O|mdf@P)(mdf@O)}%
                           {(mdf@O)(mdf@P|mdf@O)(mdf@P)}}{}
          \mdf@test@tr{\mdf@pstricksbox@tcl%
                           {(mdf@P|mdf@O)(mdf@O)(mdf@O|mdf@P)}%
                           {(mdf@O|mdf@P)(mdf@P)(mdf@P|mdf@O)}}{}
          \mdf@test@lt{\mdf@pstricksbox@tcl%
                           {(mdf@O)(mdf@P|mdf@O)(mdf@P)}%
                           {(mdf@O)(mdf@O|mdf@P)(mdf@P)}}{}
         %two lines not combinded combinded
          \mdf@test@lr{\mdf@pstricksbox@tncl{(mdf@O|mdf@P)}{(mdf@P|mdf@O)}
                      }{}
          \mdf@test@tb{\mdf@pstricksbox@tncl{(mdf@P|mdf@O)}{(mdf@O|mdf@P)}
                      }{}
        %single line
         \mdf@test@l{\mdf@pstricksbox@ol{(mdf@O)(mdf@O|mdf@P)}}{}
         \mdf@test@r{\mdf@pstricksbox@ol{(mdf@P)(mdf@P|mdf@O)}}{}
         \mdf@test@t{\mdf@pstricksbox@ol{(mdf@P)(mdf@O|mdf@P)}}{}
         \mdf@test@b{\mdf@pstricksbox@ol{(mdf@O)(mdf@P|mdf@O)}}{}
        %no line
         \mdf@test@noline{\psframe[style=mdfbackgroundstyle](mdf@O)(mdf@P)}{}
        %Frametitlebackground
          \drawbrackgroundframetitle@single
        %output%
          \rput[bl](mdf@A){\box\mdf@splitbox@one}
          \mdf@extra%
          \mdf@singleextra
       \end{pspicture}%
    }%
   \mdf@makeboxalign@right%
  }%
 \fi
}%
\def\drawbrackgroundframetitle@single{%
 \ifdefempty{\mdf@frametitle}{}{%
   \drawbrackgroundframetitle@@single%
 }%
}%
\def\drawbrackgroundframetitle@@single{%
 \begingroup%
  \ifbool{mdf@leftline}{%
       \nodexn{(mdf@O)+(\mdf@innerlinewidth@length,0)
               +0.5(\mdf@middlelinewidth@length,0)}{mdf@O}%
       }{}%
  \ifbool{mdf@rightline}{%
       \nodexn{(mdf@P)-(\mdf@innerlinewidth@length,0)
               -0.5(\mdf@middlelinewidth@length,0)}{mdf@P}%
       }{}%
  \ifbool{mdf@topline}{%
       \nodexn{(mdf@P)-(0,\mdf@innerlinewidth@length)
               -0.5(0,\mdf@middlelinewidth@length)}{mdf@P}%
       }{}%
  \nodexn{(mdf@P)-(0,\mdfframetitleboxtotalheight)}{mdf@F}%
  \psline[style=mdfframetitlebackgroundstyle](mdf@O|mdf@F)(mdf@O|mdf@P)
                                             (mdf@P)(mdf@P|mdf@F)%
 \endgroup
}
\def\mdf@putbox@first{%
  \ifvoid\mdf@splitbox@two
  \else%
   \mdf@makebox@out{%
     \mdf@makeboxalign@left%
     %\ifbool{mdf@leftline}{\hspace*{\mdf@middlelinewidth@length}}{}%
    \setlength\mdfboundingboxwidth{\wd\mdf@splitbox@two}%
    \advance\mdfboundingboxwidth by \mdf@innerleftmargin@length\relax%
    \advance\mdfboundingboxwidth by \mdf@innerrightmargin@length\relax%
    \ifbool{mdf@leftline}{%
      \advance\mdfboundingboxwidth by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@outerlinewidth@length\relax}{}%
    \ifbool{mdf@rightline}{%
      \advance\mdfboundingboxwidth by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@outerlinewidth@length\relax}{}%
    \setlength\mdfboundingboxheight%
              {\dimexpr\ht\mdf@splitbox@two+\dp\mdf@splitbox@two\relax}%
    \advance\mdfboundingboxheight by \mdf@innertopmargin@length\relax%
    \advance\mdfboundingboxheight by \mdf@splitbottomskip@length\relax%
    \ifbool{mdf@topline}{%
      \advance\mdfboundingboxheight by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@outerlinewidth@length\relax}{}%
%%%%%%%%%
    \ifbool{mdf@everyline}{%
     \ifbool{mdf@bottomline}{%
      \advance\mdfboundingboxheight by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@outerlinewidth@length\relax}{}%
     }{}%
%%%%%%%%%%%%%%
     \psset{linearc=\mdf@roundcorner@length,cornersize=absolute}%
     \expandafter\psset\expandafter{\mdf@psset@local}%
     \mdf@makebox@in[\mdfboundingboxwidth]{%
      \null%
      \psset{unit=1truecm}%
      \ifdimgreater{\mdfboundingboxheight}{\vsize}
       {\begin{pspicture}(0,0)(\mdfboundingboxwidth,\vsize)}
       {\begin{pspicture}(0,0)(\mdfboundingboxwidth,\mdfboundingboxheight)}
        \mdfpstricks@settings%
        \psset{linearc=\mdf@roundcorner@length,cornersize=absolut,}%
        \expandafter\psset\expandafter{\mdf@psset@local}%
        \pnode(\mdf@innerleftmargin@length,\mdf@splitbottomskip@length){mdf@A}
        \pnode(0,0){mdf@O}
        \pnode(\mdfboundingboxwidth,\mdfboundingboxheight){mdf@P}
        \ifbool{mdf@leftline}%
          {%
          \nodexn{(mdf@A)+(\mdf@outerlinewidth@length,0)
                          +(\mdf@middlelinewidth@length,0)
                          +(\mdf@innerlinewidth@length,0)}{mdf@A}
          \nodexn{(mdf@O)+(\mdf@outerlinewidth@length,0)
                          +0.5(\mdf@middlelinewidth@length,0)}{mdf@O}
         }{}%
       \ifbool{mdf@rightline}%
         {%
          \nodexn{(mdf@P)-(\mdf@outerlinewidth@length,0)
                          -0.5(\mdf@middlelinewidth@length,0)}{mdf@P}
         }{}%
       \ifbool{mdf@topline}%
         {%
          \nodexn{(mdf@P)-(0,\mdf@outerlinewidth@length)
                          -0.5(0,\mdf@middlelinewidth@length)}{mdf@P}
         }{}%
%%%%%%%%%%%
      \ifbool{mdf@everyline}{%
       \ifbool{mdf@bottomline}%
         {%
          \nodexn{(mdf@A)+(0,\mdf@outerlinewidth@length)
                          +(0,\mdf@middlelinewidth@length)
                          +(0,\mdf@innerlinewidth@length)}{mdf@A}%
          \nodexn{(mdf@O)+(0,\mdf@outerlinewidth@length)
                          +0.5(0,\mdf@middlelinewidth@length)}{mdf@O}%
         }{}%
      }{}%
%%%%%%%%%%
       \ifbool{mdf@shadow}
           {\pscustom[style=mdfshadow,linestyle=none]{%
                \psline[linejoin=2,linecap=1,]%
                       (mdf@P|mdf@O)(mdf@P)(mdf@O|mdf@P)%
                \psline[linejoin=2,linecap=1,linearc=\z@]%
                       (mdf@O|mdf@P)(mdf@O)(mdf@P|mdf@O)
                \closedshadow
                }
           }{}
%%%%%%%%%%%%%
    \ifbool{mdf@everyline}{%
         %Four lines
          \mdf@test@ltrb{\mdf@pstricksbox@fl{mdf@O}{mdf@P}}{}
         %three lines
          \mdf@test@ltb{%
              \mdf@pstricksbox@tl{(mdf@P|mdf@O)(mdf@O)(mdf@O|mdf@P)(mdf@P)}}{}
          \mdf@test@trb{%
              \mdf@pstricksbox@tl{(mdf@O)(mdf@P|mdf@O)(mdf@P)(mdf@O|mdf@P)}}{}
          \mdf@test@ltr{%
              \mdf@pstricksbox@tl{(mdf@O)(mdf@O|mdf@P)(mdf@P)(mdf@P|mdf@O)}}{}%
          \mdf@test@lrb{%
              \mdf@pstricksbox@tl{(mdf@O|mdf@P)(mdf@O)(mdf@P|mdf@O)(mdf@P)}}{}%
         %two lines combinded
          \mdf@test@lb{\mdf@pstricksbox@tcl%
                           {(mdf@P|mdf@O)(mdf@P)(mdf@O|mdf@P)}%
                           {(mdf@O|mdf@P)(mdf@O)(mdf@P|mdf@O)}}{}
          \mdf@test@rb{\mdf@pstricksbox@tcl%
                           {(mdf@P)(mdf@O|mdf@P)(mdf@O)}%
                           {(mdf@O)(mdf@P|mdf@O)(mdf@P)}}{}
          \mdf@test@tr{\mdf@pstricksbox@tcl%
                           {(mdf@P|mdf@O)(mdf@O)(mdf@O|mdf@P)}%
                           {(mdf@O|mdf@P)(mdf@P)(mdf@P|mdf@O)}}{}
          \mdf@test@lt{\mdf@pstricksbox@tcl%
                           {(mdf@O)(mdf@P|mdf@O)(mdf@P)}%
                           {(mdf@O)(mdf@O|mdf@P)(mdf@P)}}{}
         %two lines not combinded combinded
          \mdf@test@lr{\mdf@pstricksbox@tncl{(mdf@O|mdf@P)}{(mdf@P|mdf@O)}
                      }{}
          \mdf@test@tb{\mdf@pstricksbox@tncl{(mdf@P|mdf@O)}{(mdf@O|mdf@P)}
                      }{}
        %single line
         \mdf@test@l{\mdf@pstricksbox@ol{(mdf@O)(mdf@O|mdf@P)}}{}
         \mdf@test@r{\mdf@pstricksbox@ol{(mdf@P)(mdf@P|mdf@O)}}{}
         \mdf@test@t{\mdf@pstricksbox@ol{(mdf@P)(mdf@O|mdf@P)}}{}
         \mdf@test@b{\mdf@pstricksbox@ol{(mdf@O)(mdf@P|mdf@O)}}{}
        %no line
         \mdf@test@noline{\psframe[style=mdfbackgroundstyle](mdf@O)(mdf@P)}{}%
     }{%
      %Four or Three lines
       \ifboolexpr{test {\mdf@test@ltrb} or test {\mdf@test@ltr}}%
        {\mdf@pstricksbox@tl{(mdf@O)(mdf@O|mdf@P)(mdf@P)(mdf@P|mdf@O)}}%
        {}%
      %two combinded lines
      \ifboolexpr{test {\mdf@test@ltb} or test {\mdf@test@lt}}
                 {\mdf@pstricksbox@tcl{(mdf@O)(mdf@P|mdf@O)(mdf@P)}%
                                      {(mdf@O)(mdf@O|mdf@P)(mdf@P)}}{}
      \ifboolexpr{test {\mdf@test@trb} or test {\mdf@test@tr}}%
                 {\mdf@pstricksbox@tcl{(mdf@P|mdf@O)(mdf@O)(mdf@O|mdf@P)}%
                                      {(mdf@O|mdf@P)(mdf@P)(mdf@P|mdf@O)}}{}
      %two not combinded lines
      \ifboolexpr{test {\mdf@test@lrb} or test {\mdf@test@lr}}%
                 {\mdf@pstricksbox@tncl{(mdf@O|mdf@P)}{(mdf@P|mdf@O)}}{}
      %single line
      \ifboolexpr{test {\mdf@test@tb} or test {\mdf@test@t}}%
                 {\mdf@pstricksbox@ol{(mdf@P)(mdf@O|mdf@P)}}{}
      \ifboolexpr{test {\mdf@test@lb} or test {\mdf@test@l}}%
                 {\mdf@pstricksbox@ol{(mdf@O)(mdf@O|mdf@P)}}{}
      \ifboolexpr{test {\mdf@test@rb} or test {\mdf@test@r}}%
                 {\mdf@pstricksbox@ol{(mdf@P)(mdf@P|mdf@O)}}{}
      %no line
      \mdf@test@b{\psframe[style=mdfbackgroundstyle](mdf@O)(mdf@P)}{}%
      \mdf@test@noline{\psframe[style=mdfbackgroundstyle](mdf@O)(mdf@P)}{}%
     }%
     %Frametitlebackground
       \drawbrackgroundframetitle@first
      %output%
       \rput[bl](mdf@A){\box\mdf@splitbox@two}
      \mdf@extra%
      \mdf@firstextra%
     \end{pspicture}
    }%
   \mdf@makeboxalign@right%
  }%
 \fi
}%
\def\drawbrackgroundframetitle@first{%
 \ifdefempty{\mdf@frametitle}{}%
  {%
   \ifbool{mdf@repeatframetitle}%
     {%repeating title = true
      \drawbrackgroundframetitle@@@first
     }%
     {%
      \ifdimgreater{\mdfboundingboxheight}{\mdfframetitleboxtotalheight}%
        {%
         \drawbrackgroundframetitle@@first
         \global\mdfframetitleboxtotalheight=-\p@%
        }{\mdf@PackageWarning{You got a page break inside the frame
                              title\MessageBreak
                              Currently this isn't well supported}%
          \drawbrackgroundframetitle@@first
          \global\mdfframetitleboxtotalheight=\dimexpr
                          \mdfframetitleboxtotalheight
                          -\mdfboundingboxheight
                          -\mdf@innerlinewidth@length
                          -0.5\mdf@middlelinewidth@length%
                          +\mdf@frametitlebelowskip@length
                          +\mdf@splitbottomskip@length
                          +\mdf@splittopskip@length
                          +\dp\strutbox\relax%
        }%
     }%
  }%
}%
\def\drawbrackgroundframetitle@@first{%
 \begingroup%
  \ifbool{mdf@leftline}{%
       \nodexn{(mdf@O)+(\mdf@innerlinewidth@length,0)
               +0.5(\mdf@middlelinewidth@length,0)}{mdf@O}%
       }{}%
  \ifbool{mdf@rightline}{%
       \nodexn{(mdf@P)-(\mdf@innerlinewidth@length,0)
               -0.5(\mdf@middlelinewidth@length,0)}{mdf@P}%
       }{}%
  \ifbool{mdf@topline}{%
       \nodexn{(mdf@P)-(0,\mdf@innerlinewidth@length)
               -0.5(0,\mdf@middlelinewidth@length)}{mdf@P}%
       }{}%
 \ifdimgreater{\mdfboundingboxheight}{\mdfframetitleboxtotalheight}
    {\nodexn{(mdf@P)-(0,\mdfframetitleboxtotalheight)}{mdf@F}}%
    {\nodexn{(mdf@O)}{mdf@F}}%
  \psline[style=mdfframetitlebackgroundstyle](mdf@O|mdf@F)(mdf@O|mdf@P)
                                             (mdf@P)(mdf@P|mdf@F)%
 \endgroup
}
\def\drawbrackgroundframetitle@@@first{%
 \begingroup%
  \ifbool{mdf@leftline}{%
       \nodexn{(mdf@O)+(\mdf@innerlinewidth@length,0)
               +0.5(\mdf@middlelinewidth@length,0)}{mdf@O}%
       }{}%
  \ifbool{mdf@rightline}{%
       \nodexn{(mdf@P)-(\mdf@innerlinewidth@length,0)
               -0.5(\mdf@middlelinewidth@length,0)}{mdf@P}%
       }{}%
  \ifbool{mdf@topline}{%
       \nodexn{(mdf@P)-(0,\mdf@innerlinewidth@length)
               -0.5(0,\mdf@middlelinewidth@length)}{mdf@P}%
       }{}%
  \nodexn{(mdf@P)-(0,\mdfframetitleboxtotalheight)}{mdf@F}%
  \psline[style=mdfframetitlebackgroundstyle](mdf@O|mdf@F)(mdf@O|mdf@P)
                                             (mdf@P)(mdf@P|mdf@F)%
 \endgroup
}
\def\mdf@putbox@middle{%
  \ifvoid\mdf@splitbox@two
  \else%
   \mdf@makebox@out{%
    \mdf@makeboxalign@left%
    \setlength\mdfboundingboxwidth{\wd\mdf@splitbox@two}%
    \advance\mdfboundingboxwidth by \mdf@innerleftmargin@length\relax%
    \advance\mdfboundingboxwidth by \mdf@innerrightmargin@length\relax%
    \ifbool{mdf@leftline}{%
      \advance\mdfboundingboxwidth by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@outerlinewidth@length\relax}{}%
    \ifbool{mdf@rightline}{%
      \advance\mdfboundingboxwidth by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@outerlinewidth@length\relax}{}%
    \setlength\mdfboundingboxheight%
              {\dimexpr\ht\mdf@splitbox@two+\dp\mdf@splitbox@two\relax}%
    \advance\mdfboundingboxheight by \mdf@splitbottomskip@length\relax%
%%%%%%%%%
    \ifbool{mdf@everyline}{%
     \ifbool{mdf@topline}{%
      \advance\mdfboundingboxheight by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@outerlinewidth@length\relax}{}%
     \ifbool{mdf@bottomline}{%
      \advance\mdfboundingboxheight by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@outerlinewidth@length\relax}{}%
     }{}%
%%%%%%%%%%%%%%
     \psset{unit=1truecm}%
     \mdf@makebox@in[\mdfboundingboxwidth]{%
      \null%
      \ifdimgreater{\mdfboundingboxheight}{\vsize}
       {\begin{pspicture}(0,0)(\mdfboundingboxwidth,\vsize)}
       {\begin{pspicture}(0,0)(\mdfboundingboxwidth,\mdfboundingboxheight)}
        \mdfpstricks@settings%
        \psset{linearc=0pt,cornersize=absolut,}%
        \expandafter\psset\expandafter{\mdf@psset@local}%
        %%%%
        \pnode(\mdf@innerleftmargin@length,\mdf@splitbottomskip@length){mdf@A}
        \pnode(0,0){mdf@O}
        \pnode(\mdfboundingboxwidth,\mdfboundingboxheight){mdf@P}
        \ifbool{mdf@leftline}%
          {%
          \nodexn{(mdf@A)+(\mdf@outerlinewidth@length,0)
                          +(\mdf@middlelinewidth@length,0)
                          +(\mdf@innerlinewidth@length,0)}{mdf@A}
          \nodexn{(mdf@O)+(\mdf@outerlinewidth@length,0)
                          +0.5(\mdf@middlelinewidth@length,0)}{mdf@O}
         }{}%
       \ifbool{mdf@rightline}%
         {%
          \nodexn{(mdf@P)-(\mdf@outerlinewidth@length,0)
                          -0.5(\mdf@middlelinewidth@length,0)}{mdf@P}
         }{}%
      %%
%%%%%%%%%%%
      \ifbool{mdf@everyline}{%
       \ifbool{mdf@bottomline}%
         {%
          \nodexn{(mdf@A)+(0,\mdf@outerlinewidth@length)
                          +(0,\mdf@middlelinewidth@length)
                          +(0,\mdf@innerlinewidth@length)}{mdf@A}%
          \nodexn{(mdf@O)+(0,\mdf@outerlinewidth@length)
                          +0.5(0,\mdf@middlelinewidth@length)}{mdf@O}%
         }{}%
       \ifbool{mdf@topline}%
         {%
          \nodexn{(mdf@P)-(0,\mdf@outerlinewidth@length)
                          -0.5(0,\mdf@middlelinewidth@length)}{mdf@P}
         }{}%
       }{}%
%%%%%%%%%%
      %%
      \ifbool{mdf@shadow}
         {\psframe[style=mdfshadow](mdf@O)(mdf@P)}{}
%%%%%%%%%%%%%
    \ifbool{mdf@everyline}{%
         %Four lines
          \mdf@test@ltrb{\mdf@pstricksbox@fl{mdf@O}{mdf@P}}{}
         %three lines
          \mdf@test@ltb{%
              \mdf@pstricksbox@tl{(mdf@P|mdf@O)(mdf@O)(mdf@O|mdf@P)(mdf@P)}}{}
          \mdf@test@trb{%
              \mdf@pstricksbox@tl{(mdf@O)(mdf@P|mdf@O)(mdf@P)(mdf@O|mdf@P)}}{}
          \mdf@test@ltr{%
              \mdf@pstricksbox@tl{(mdf@O)(mdf@O|mdf@P)(mdf@P)(mdf@P|mdf@O)}}{}%
          \mdf@test@lrb{%
              \mdf@pstricksbox@tl{(mdf@O|mdf@P)(mdf@O)(mdf@P|mdf@O)(mdf@P)}}{}%
         %two lines combinded
          \mdf@test@lb{\mdf@pstricksbox@tcl%
                           {(mdf@P|mdf@O)(mdf@P)(mdf@O|mdf@P)}%
                           {(mdf@O|mdf@P)(mdf@O)(mdf@P|mdf@O)}}{}
          \mdf@test@rb{\mdf@pstricksbox@tcl%
                           {(mdf@P)(mdf@O|mdf@P)(mdf@O)}%
                           {(mdf@O)(mdf@P|mdf@O)(mdf@P)}}{}
          \mdf@test@tr{\mdf@pstricksbox@tcl%
                           {(mdf@P|mdf@O)(mdf@O)(mdf@O|mdf@P)}%
                           {(mdf@O|mdf@P)(mdf@P)(mdf@P|mdf@O)}}{}
          \mdf@test@lt{\mdf@pstricksbox@tcl{(mdf@O)(mdf@P|mdf@O)(mdf@P)}%
                                           {(mdf@O)(mdf@O|mdf@P)(mdf@P)}}{}
         %two lines not combinded combinded
          \mdf@test@lr{\mdf@pstricksbox@tncl{(mdf@O|mdf@P)}{(mdf@P|mdf@O)}
                      }{}
          \mdf@test@tb{\mdf@pstricksbox@tncl{(mdf@P|mdf@O)}{(mdf@O|mdf@P)}
                      }{}
        %single line
         \mdf@test@l{\mdf@pstricksbox@ol{(mdf@O)(mdf@O|mdf@P)}}{}
         \mdf@test@r{\mdf@pstricksbox@ol{(mdf@P)(mdf@P|mdf@O)}}{}
         \mdf@test@t{\mdf@pstricksbox@ol{(mdf@P)(mdf@O|mdf@P)}}{}
         \mdf@test@b{\mdf@pstricksbox@ol{(mdf@O)(mdf@P|mdf@O)}}{}
        %no line
         \mdf@test@noline{\psframe[style=mdfbackgroundstyle](mdf@O)(mdf@P)}{}%
     }{%
      \ifboolexpr{bool {mdf@leftline} and bool {mdf@rightline}}%
               {\mdf@pstricksbox@tncl{(mdf@O|mdf@P)}{(mdf@P|mdf@O)}}{}%
      \ifboolexpr{bool {mdf@leftline} and not (bool {mdf@rightline})}%
               {\mdf@pstricksbox@ol{(mdf@O)(mdf@O|mdf@P)}}{}%
      \ifboolexpr{not (bool {mdf@leftline}) and bool {mdf@rightline}}%
               {\mdf@pstricksbox@ol{(mdf@P)(mdf@P|mdf@O)}}{}%
      \ifboolexpr{not (bool {mdf@leftline}) and not (bool {mdf@rightline})}%
               {\psframe[style=mdfbackgroundstyle](mdf@O)(mdf@P)}{}%
    }%
     %Frametitlebackground
       \drawbrackgroundframetitle@middle
      %output%
       \rput[bl](mdf@A){\box\mdf@splitbox@two}
       %\psdot(mdf@A)\uput[90](mdf@A){mdf at A}
       %\psdot(mdf@P)\uput[90](mdf@P){mdf at P}
       %\psdot(mdf@O)\uput[90](mdf@O){mdf at O}
      \mdf@extra%
      \mdf@middleextra%
     \end{pspicture}%
    }%
   \mdf@makeboxalign@right%
  }%
 \fi
}%
\def\drawbrackgroundframetitle@middle{%
 \ifdefempty{\mdf@frametitle}{}%
  {%
   \ifbool{mdf@repeatframetitle}%
     {%repeating title = true
      \drawbrackgroundframetitle@@@middle
     }%
     {%
      \ifdimless{\mdfframetitleboxtotalheight}{\z@}
        {}%
        {%
          \drawbrackgroundframetitle@@middle
          \global\mdfframetitleboxtotalheight=-\p@\relax%
        }%
     }%
 }%
}%
\def\drawbrackgroundframetitle@@middle{%
 \begingroup%
  \ifbool{mdf@leftline}{%
       \nodexn{(mdf@O)+(\mdf@innerlinewidth@length,0)
               +0.5(\mdf@middlelinewidth@length,0)}{mdf@O}%
       }{}%
  \ifbool{mdf@rightline}{%
       \nodexn{(mdf@P)-(\mdf@innerlinewidth@length,0)
               -0.5(\mdf@middlelinewidth@length,0)}{mdf@P}%
       }{}%
  \nodexn{(mdf@P)-(0,\mdfframetitleboxtotalheight)}{mdf@F}%
  \psline[style=mdfframetitlebackgroundstyle,linearc=\z@]%
         (mdf@O|mdf@F)(mdf@O|mdf@P)(mdf@P)(mdf@P|mdf@F)%
 \endgroup
}
\def\drawbrackgroundframetitle@@@middle{%
 \begingroup%
  \ifbool{mdf@leftline}{%
       \nodexn{(mdf@O)+(\mdf@innerlinewidth@length,0)
               +0.5(\mdf@middlelinewidth@length,0)}{mdf@O}%
       }{}%
  \ifbool{mdf@rightline}{%
       \nodexn{(mdf@P)-(\mdf@innerlinewidth@length,0)
               -0.5(\mdf@middlelinewidth@length,0)}{mdf@P}%
       }{}%
  \ifbool{mdf@everyline}%
    {%
     \ifbool{mdf@topline}{%
        \nodexn{(mdf@P)-(0,\mdf@innerlinewidth@length)
                -0.5(0,\mdf@middlelinewidth@length)}{mdf@P}%
        }{}%
     }{}%
  \nodexn{(mdf@P)-(0,\mdfframetitleboxtotalheight)}{mdf@F}%
  \psline[style=mdfframetitlebackgroundstyle](mdf@O|mdf@F)(mdf@O|mdf@P)
                                             (mdf@P)(mdf@P|mdf@F)%
 \endgroup
}
\def\mdf@putbox@second{
  \ifvoid\mdf@splitbox@one
  \else%
   \mdf@makebox@out{%
     \mdf@makeboxalign@left%
    \setlength\mdfboundingboxwidth{\wd\mdf@splitbox@one}%
    \advance\mdfboundingboxwidth by \mdf@innerleftmargin@length\relax%
    \advance\mdfboundingboxwidth by \mdf@innerrightmargin@length\relax%
    \ifbool{mdf@leftline}{%
      \advance\mdfboundingboxwidth by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@outerlinewidth@length\relax}{}%
    \ifbool{mdf@rightline}{%
      \advance\mdfboundingboxwidth by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxwidth by \mdf@outerlinewidth@length\relax}{}%
    \setlength\mdfboundingboxheight%
              {\dimexpr\ht\mdf@splitbox@one+\dp\mdf@splitbox@one\relax}%
    \advance\mdfboundingboxheight by \mdf@innerbottommargin@length\relax%
    \ifbool{mdf@bottomline}{%
      \advance\mdfboundingboxheight by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@outerlinewidth@length\relax}{}%
%%%%%%%%%
    \ifbool{mdf@everyline}{%
     \ifbool{mdf@topline}{%
      \advance\mdfboundingboxheight by \mdf@innerlinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@middlelinewidth@length\relax%
      \advance\mdfboundingboxheight by \mdf@outerlinewidth@length\relax}{}%
     }{}%
%%%%%%%%%%%%%%
     \psset{unit=1truecm}%
   \mdf@makebox@in[\mdfboundingboxwidth]{%
       \null%
       \begin{pspicture}(0,0)(\mdfboundingboxwidth,\mdfboundingboxheight)
        \mdfpstricks@settings%
        \psset{linearc=\mdf@roundcorner@length,cornersize=absolut,}%
        \expandafter\psset\expandafter{\mdf@psset@local}%
        \pnode(\mdf@innerleftmargin@length,\mdf@innerbottommargin@length)
              {mdf@A}
        \pnode(0,0){mdf@O}
        \pnode(\mdfboundingboxwidth,\mdfboundingboxheight){mdf@P}
        \ifbool{mdf@leftline}%
          {%
          \nodexn{(mdf@A)+(\mdf@outerlinewidth@length,0)
                          +(\mdf@middlelinewidth@length,0)
                          +(\mdf@innerlinewidth@length,0)}{mdf@A}
          \nodexn{(mdf@O)+(\mdf@outerlinewidth@length,0)
                          +0.5(\mdf@middlelinewidth@length,0)}{mdf@O}
         }{}%
       \ifbool{mdf@rightline}%
         {%
          \nodexn{(mdf@P)-(\mdf@outerlinewidth@length,0)
                          -0.5(\mdf@middlelinewidth@length,0)}{mdf@P}
         }{}%
       \ifbool{mdf@bottomline}%
         {%
          \nodexn{(mdf@A)+(0,\mdf@outerlinewidth@length)
                          +(0,\mdf@middlelinewidth@length)
                          +(0,\mdf@innerlinewidth@length)}{mdf@A}
          \nodexn{(mdf@O)+(0,\mdf@outerlinewidth@length)
                          +0.5(0,\mdf@middlelinewidth@length)}{mdf@O}
         }{}%
%%%%%%%%%%%
      \ifbool{mdf@everyline}{%
       \ifbool{mdf@topline}%
         {%
          \nodexn{(mdf@P)-(0,\mdf@outerlinewidth@length)
                          -0.5(0,\mdf@middlelinewidth@length)}{mdf@P}
         }{}%
       }{}%
%%%%%%%%%%
      %%
       \ifbool{mdf@shadow}
           {\pscustom[style=mdfshadow,linestyle=none]{%
                \psline[linejoin=2,linecap=1,](mdf@O|mdf@P)(mdf@O)%
                                              (mdf@P|mdf@O)(mdf@P)%
                \psline[linejoin=2,linecap=1,linearc=\z@](mdf@O|mdf@P)(mdf@P)
                \closedshadow
                }
           }{}
%%%%%%%%%%%%%
    \ifbool{mdf@everyline}{%
         %Four lines
          \mdf@test@ltrb{\mdf@pstricksbox@fl{mdf@O}{mdf@P}}{}
         %three lines
          \mdf@test@ltb{%
              \mdf@pstricksbox@tl{(mdf@P|mdf@O)(mdf@O)(mdf@O|mdf@P)(mdf@P)}}{}
          \mdf@test@trb{%
              \mdf@pstricksbox@tl{(mdf@O)(mdf@P|mdf@O)(mdf@P)(mdf@O|mdf@P)}}{}
          \mdf@test@ltr{%
              \mdf@pstricksbox@tl{(mdf@O)(mdf@O|mdf@P)(mdf@P)(mdf@P|mdf@O)}}{}%
          \mdf@test@lrb{%
              \mdf@pstricksbox@tl{(mdf@O|mdf@P)(mdf@O)(mdf@P|mdf@O)(mdf@P)}}{}%
         %two lines combinded
          \mdf@test@lb{\mdf@pstricksbox@tcl%
                           {(mdf@P|mdf@O)(mdf@P)(mdf@O|mdf@P)}%
                           {(mdf@O|mdf@P)(mdf@O)(mdf@P|mdf@O)}}{}
          \mdf@test@rb{\mdf@pstricksbox@tcl%
                           {(mdf@P)(mdf@O|mdf@P)(mdf@O)}%
                           {(mdf@O)(mdf@P|mdf@O)(mdf@P)}}{}
          \mdf@test@tr{\mdf@pstricksbox@tcl%
                           {(mdf@P|mdf@O)(mdf@O)(mdf@O|mdf@P)}%
                           {(mdf@O|mdf@P)(mdf@P)(mdf@P|mdf@O)}}{}
          \mdf@test@lt{\mdf@pstricksbox@tcl%
                           {(mdf@O)(mdf@P|mdf@O)(mdf@P)}%
                           {(mdf@O)(mdf@O|mdf@P)(mdf@P)}}{}
         %two lines not combinded combinded
          \mdf@test@lr{\mdf@pstricksbox@tncl{(mdf@O|mdf@P)}{(mdf@P|mdf@O)}
                      }{}
          \mdf@test@tb{\mdf@pstricksbox@tncl{(mdf@P|mdf@O)}{(mdf@O|mdf@P)}
                      }{}
        %single line
         \mdf@test@l{\mdf@pstricksbox@ol{(mdf@O)(mdf@O|mdf@P)}}{}
         \mdf@test@r{\mdf@pstricksbox@ol{(mdf@P)(mdf@P|mdf@O)}}{}
         \mdf@test@t{\mdf@pstricksbox@ol{(mdf@P)(mdf@O|mdf@P)}}{}
         \mdf@test@b{\mdf@pstricksbox@ol{(mdf@O)(mdf@P|mdf@O)}}{}
        %no line
         \mdf@test@noline{\psframe[style=mdfbackgroundstyle](mdf@O)(mdf@P)}{}%
     }{%
      %Four + Three
      \ifboolexpr{test {\mdf@test@ltrb} or test {\mdf@test@lrb}}%
        {\mdf@pstricksbox@tl{(mdf@O|mdf@P)(mdf@O)(mdf@P|mdf@O)(mdf@P)}}{}%
     %Two combinded
      \ifboolexpr{test {\mdf@test@ltb} or test {\mdf@test@lb}}%
        {\mdf@pstricksbox@tcl{(mdf@P|mdf@O)(mdf@P)(mdf@O|mdf@P)}%
                             {(mdf@O|mdf@P)(mdf@O)(mdf@P|mdf@O)}}{}
      \ifboolexpr{test {\mdf@test@trb} or test {\mdf@test@rb}}%
        {\mdf@pstricksbox@tcl{(mdf@P)(mdf@O|mdf@P)(mdf@O)}%
                             {(mdf@O)(mdf@P|mdf@O)(mdf@P)}}{}
     %Two not combinded
      \ifboolexpr{test {\mdf@test@ltr} or test {\mdf@test@lr}}%
        {\mdf@pstricksbox@tncl{(mdf@O|mdf@P)}{(mdf@P|mdf@O)}}{}%
     %one line
      \ifboolexpr{test {\mdf@test@tb} or test {\mdf@test@b}}%
        {\mdf@pstricksbox@ol{(mdf@O)(mdf@P|mdf@O)}}{}
      \ifboolexpr{test {\mdf@test@lt} or test {\mdf@test@l}}%
        {\mdf@pstricksbox@ol{(mdf@O)(mdf@O|mdf@P)}}{}
      \ifboolexpr{test {\mdf@test@tr} or test {\mdf@test@r}}%
        {\mdf@pstricksbox@ol{(mdf@P)(mdf@P|mdf@O)}}{}
     %no line
      \mdf@test@t{\psframe[style=mdfbackgroundstyle](mdf@O)(mdf@P)}{}%
      \mdf@test@noline{\psframe[style=mdfbackgroundstyle](mdf@O)(mdf@P)}{}%
    }%
     %Frametitlebackground
       \drawbrackgroundframetitle@second
      %output%
       \rput[bl](mdf@A){\box\mdf@splitbox@one}
      \mdf@extra%
      \mdf@secondextra
     \end{pspicture}%
    }%
   \mdf@makeboxalign@right%
  }%
 \fi
}%
\def\drawbrackgroundframetitle@second{%
 \ifdefempty{\mdf@frametitle}{}%
  {%
   \ifbool{mdf@repeatframetitle}%
     {%repeating title = true
      \drawbrackgroundframetitle@@@second
     }%
     {%
      \ifdimless{\mdfframetitleboxtotalheight}{\z@}
        {}{%
          \drawbrackgroundframetitle@@second
        }%
     }%
 }%
}%
\def\drawbrackgroundframetitle@@second{%
 \begingroup%
  \ifbool{mdf@leftline}{%
       \nodexn{(mdf@O)+(\mdf@innerlinewidth@length,0)
               +0.5(\mdf@middlelinewidth@length,0)}{mdf@O}%
       }{}%
  \ifbool{mdf@rightline}{%
       \nodexn{(mdf@P)-(\mdf@innerlinewidth@length,0)
               -0.5(\mdf@middlelinewidth@length,0)}{mdf@P}%
       }{}%
  \nodexn{(mdf@P)-(0,\mdfframetitleboxtotalheight)}{mdf@F}%
  \psline[style=mdfframetitlebackgroundstyle,linearc=\z@]%
         (mdf@O|mdf@F)(mdf@O|mdf@P)(mdf@P)(mdf@P|mdf@F)%
 \endgroup
}
\def\drawbrackgroundframetitle@@@second{%
 \begingroup%
  \ifbool{mdf@leftline}{%
       \nodexn{(mdf@O)+(\mdf@innerlinewidth@length,0)
               +0.5(\mdf@middlelinewidth@length,0)}{mdf@O}%
       }{}%
  \ifbool{mdf@rightline}{%
       \nodexn{(mdf@P)-(\mdf@innerlinewidth@length,0)
               -0.5(\mdf@middlelinewidth@length,0)}{mdf@P}%
       }{}%
  \ifbool{mdf@everyline}%
    {%
     \ifbool{mdf@topline}{%
        \nodexn{(mdf@P)-(0,\mdf@innerlinewidth@length)
                -0.5(0,\mdf@middlelinewidth@length)}{mdf@P}%
        }{}%
     }{}%
  \nodexn{(mdf@P)-(0,\mdfframetitleboxtotalheight)}{mdf@F}%
  \psline[style=mdfframetitlebackgroundstyle](mdf@O|mdf@F)(mdf@O|mdf@P)
                                             (mdf@P)(mdf@P|mdf@F)%
 \endgroup
}
 \endinput
