% Copyright (c) 2013-26 Stephane GALLAND <galland@arakhne.org>
%
% UTBM logo and name are registered and owned by the
% "Universite de Technologie de Belfort-Montbeliard".
%
% UBE logo and name are registered and owned by the
% "Universite Bourgogne Europe".
%
% CIAD logo and name are registered and owned by the
% "Laboratoire Connaissance et Intelligence Artificielle Distribuées".
% 
% This program is free library; you can redistribute it and/or modify
% it under the terms of the GNU Lesser General Public License as
% published by the Free Software Foundation; either version 3 of the
% License, or any later version.
%
% This library 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
% Lesser General Public License for more details.
%
% You should have received a copy of the GNU Lesser General Public
% License along with this library; see the file COPYING.  If not,
% write to the Free Software Foundation, Inc., 59 Temple Place - Suite
% 330, Boston, MA 02111-1307, USA.
%
\ProvidesPackage{beamercptpthemeCIAD}[2026/04/20]

% Insert the place of the conference
\gdef\insertplace{}

% Define the place of the conference presentation
% #1: the place name
\newcommand{\place}[1]{\gdef\insertplace{#1}}

% Logos for the front page
\IfFileExists{ciad-ciadlogo.pdf}{%
	\pgfdeclareimage[height=.7cm]{ciadlogooncptppage}{ciad-ciadlogo}%
}{%
	\pgfdeclareimage[height=.7cm]{ciadlogooncptppage}{ciadbeamer-nologo}%
}
\IfFileExists{ciad-utbmlogo.pdf}{%
	\pgfdeclareimage[height=.7cm]{utbmlogooncptppage}{ciad-utbmlogo}%
}{%
	\pgfdeclareimage[height=.7cm]{utbmlogooncptppage}{ciadbeamer-nologo}%
}
\IfFileExists{ciad-ubelogo.pdf}{%
	\pgfdeclareimage[height=.7cm]{ubelogooncptppage}{ciad-ubelogo}%
}{%
	\pgfdeclareimage[height=.7cm]{ubelogooncptppage}{ciadbeamer-nologo}%
}
\IfFileExists{ciad-carnotlogo.pdf}{%
	\pgfdeclareimage[height=.7cm]{carnotlogooncptppage}{ciad-carnotlogo}%
}{%
	\pgfdeclareimage[height=.7cm]{carnotlogooncptppage}{ciadbeamer-nologo}%
}

% Insert the list of the logos
\gdef\insertpresentationlogos{}

% Reset the list of logos on the front page with no logo
\newcommand{\resetpresentationlogo}{%
	\gdef\insertpresentationlogos{}%
}

% Reset the list of logos on the front page with the standard logos
\newcommand{\resetpresentationlogotodefault}{%
	\gdef\insertpresentationlogos{%
		\protect\pgfuseimage{ciadlogooncptppage}%
		\protect\hspace{.1cm}\protect\pgfuseimage{utbmlogooncptppage}%
		\protect\hspace{.1cm}\protect\pgfuseimage{ubelogooncptppage}%
		\protect\hspace{.1cm}\protect\pgfuseimage{carnotlogooncptppage}%
		\protect\hfill
	}%
}
\resetpresentationlogotodefault

% Add a logo to the list of logos on the front page
% #1: path to the image
\newcommand{\addpresentationlogo}[1]{%
	\pgfdeclareimage[height=.7cm]{#1oncptppage}{#1}%
	\protected@xdef\insertpresentationlogos{\insertpresentationlogos%
		\protect\hspace{.1cm}\protect\pgfuseimage{#1oncptppage}%
	}%	
}

% Insert the background picture of the front page with a TikZ \put
\gdef\insertpresentationbackground{}

% Change the background picture on the front page
% #1: x coordinate of the backgorund picture
% #2: y coordinate of the backgorund picture
% #3: the number of the registered background figure
\def\setpresentationbackground(#1,#2)#3{%
	\gdef\insertpresentationbackground{%
		\put(#1,#2){\insertslidebackgroundpicture{#3}}%
	}%
}
\setpresentationbackground(199,-147){1}


% Insert the list of affilitations
\gdef\insertaffiliations{}

% Reset the list of affilitations to empty
\newcommand{\resetaffiliations}{%
	\gdef\insertaffiliations{}%
}

% Definition of the affiliation
% #1: id
% #2: name of the affilitation
\newcommand{\affiliation}[2]{%
	\ifthenelse{\equal{a}{a\insertaffiliations}}{%
		\protected@xdef\insertaffiliations{%
			\protect\affilformat{#1} \protect{#2}%
		}%	
	}{%
		\protected@xdef\insertaffiliations{%
			\insertaffiliations,\protect\xspace%
			\protect\affilformat{#1} \protect{#2}%
		}%	
	}%
}

% Show the affiliation marker
% #1: id
\newcommand{\affilformat}[1]{\ensuremath{^{#1}}}

% Show the affiliation marker on side of the author names
% #1: id
\newcommand{\affil}[1]{{\smaller\affilformat{#1}}}

% Definition of the colors
\setbeamercolor{text in conference presentation title area}{fg=black}
\setbeamercolor{text in conference presentation author area}{fg=CIADdarkgreen}
\setbeamercolor{text in conference presentation date and place area}{fg=black}
\setbeamercolor{text in conference presentation conference area}{fg=black}

% Definition of the fonts
\setbeamerfont{text in conference presentation title area}{size=\Large,series=\bfseries}
\setbeamerfont{text in conference presentation author area}{size=\Large,series=\bfseries}
\setbeamerfont{text in conference presentation date and place area}{size=\scriptsize,series=\normalfont}
\setbeamerfont{text in conference presentation conference area}{size=\tiny,series=\normalfont}

% Title page with the CIAD Conference Presentation layout
\newcommand{\insertciadpresentationtitlepage}{%
	\expandafter\begin{picture}(0,0)(0,\beamer@theme@ciad@outer@offsety)%
		% Page background
		\insertpresentationbackground%
		% Partners logos
		\put(-20,-135){%
			\parbox[c]{.95\paperwidth}{%
				\centering\insertpresentationlogos%
			}%
		}%
		% 
		\put(-20,-80){%
			\parbox[c]{.95\paperwidth}{%
			}%
		}%
		% Title
		\put(-20,70){%
			\parbox[t]{.95\paperwidth}{\centering\nohyphens{%
				\usebeamercolor[fg]{text in conference presentation title area}%
				{\usebeamerfont{text in conference presentation title area}\@beamer@theme@ciad@wraptextformats{\inserttitle} \\[.25cm] \@beamer@theme@ciad@wraptextformats{\insertsubtitle}}%
			}}%
		}%
		% Talker
		\put(-20,-80){%
			\mbox{}\parbox[b]{.95\paperwidth}{\centering\nohyphens{%
				{\usebeamercolor[fg]{text in conference presentation author area}\usebeamerfont{text in conference presentation author area}\@beamer@theme@ciad@wraptextformats{\insertauthor}}%
				\ifthenelse{\equal{a}{a\inserteventname}}{}{%
					\\[.25cm]{\usebeamercolor[fg]{text in conference presentation date and place area}\usebeamerfont{text in conference presentation date and place area}\@beamer@theme@ciad@wraptextformats{\inserteventname}}%
				}%
				\ifthenelse{\equal{a}{a\insertdate}}{%
					\ifthenelse{\equal{a}{a\insertplace}}{}{%
						\\{\usebeamercolor[fg]{text in conference presentation date and place area}\usebeamerfont{text in conference presentation date and place area}\@beamer@theme@ciad@wraptextformats{\insertplace}}%
					}%
				}{%
					\ifthenelse{\equal{a}{a\insertplace}}{%
						\\{\usebeamercolor[fg]{text in conference presentation date and place area}\usebeamerfont{text in conference presentation date and place area}\@beamer@theme@ciad@wraptextformats{\insertdate}}%
					}{%
						\\{\usebeamercolor[fg]{text in conference presentation date and place area}\usebeamerfont{text in conference presentation date and place area}\@beamer@theme@ciad@wraptextformats{\insertdate\ - \insertplace}
						}%
					}%
				}%
				\ifthenelse{\equal{a}{a\insertaffiliations}}{}{%
					\\[.25cm]{\usebeamercolor[fg]{text in conference presentation date and place area}\usebeamerfont{text in conference presentation date and place area}\@beamer@theme@ciad@wraptextformats{\insertaffiliations}}%
				}%
			}}\mbox{}%
		}%
	\end{picture}%
}

\AtBeginDocument{
	\ifthenelse{\boolean{beamer@theme@ciad@conferencepresentationtitlepage}}{%
		\setbeamertemplate{title page}{\insertciadpresentationtitlepage}%
	}{}%
}

\mode
<all>
