<extension implements="::fwServices::registry::AppConfig">
    <id>tuto15MultithreadConfig</id>
    <type>parameters</type>
    <parameters>
        <param name="GENERIC_UID" default="g"/>
    </parameters>
    <config>


        <!-- In tutoComChannel, the main data object type is ::fwData::Mesh. -->
        <object type="::fwData::Mesh">

            <service uid="${GENERIC_UID}_frame" impl="::gui::frame::DefaultFrame" >
                <gui>
                    <frame>
                        <name>Tuto15Multithread</name>
                        <icon>Bundles/Tuto15Multithread_0-1/tuto.ico</icon>
                        <minSize width="720" height="600" />
                    </frame>
                    <menuBar />
                </gui>
                <registry>
                    <menuBar sid="${GENERIC_UID}_menuBar" start="yes" />
                    <view sid="${GENERIC_UID}_view" start="yes" />
                </registry>
            </service>

            <service uid="${GENERIC_UID}_menuBar" impl="::gui::aspect::DefaultMenuBarSrv" >
                <gui>
                    <layout>
                        <menu name="File" />
                        <menu name="Deformation" />
                    </layout>
                </gui>
                <registry>
                    <menu sid="${GENERIC_UID}_fileMenu" start="yes" />
                    <menu sid="${GENERIC_UID}_deformationMenu" start="yes" />
                </registry>
            </service>

            <!-- The application contains three different views. The different views are characterized by their 
            associated service uid. Furthermore, a minimum window height and a width are given to the last two views.-->
            <service uid="${GENERIC_UID}_view" impl="::gui::view::DefaultView" >
                <gui>
                    <layout type="::fwGui::LineLayoutManager">
                        <orientation value="horizontal" />
                        <view proportion="1" />
                        <view proportion="1" />
                    </layout>
                </gui>
                <registry>
                    <view sid="${GENERIC_UID}_rendering1" start="yes" />
                    <view sid="${GENERIC_UID}_rendering2" start="yes" />
                </registry>
            </service>

            <service uid="${GENERIC_UID}_fileMenu" impl="::gui::aspect::DefaultMenuSrv" >
                <gui>
                    <layout>
                        <menuItem name="Open file" shortcut="Ctrl+O" />
                        <separator />
                        <menuItem name="Quit" specialAction="QUIT" shortcut="Ctrl+Q" />
                    </layout>
                </gui>
                <registry>
                    <menuItem sid="${GENERIC_UID}_openFileAction" start="yes" />
                    <menuItem sid="${GENERIC_UID}_quitAction" start="yes" />
                </registry>
            </service>

            <service uid="${GENERIC_UID}_deformationMenu" impl="::gui::aspect::DefaultMenuSrv" >
                <gui>
                    <layout>
                        <menuItem name="Start deformation" shortcut="Ctrl+D" />
                        <menuItem name="Stop deformation" shortcut="Ctrl+F" />
                    </layout>
                </gui>
                <registry>
                    <menuItem sid="${GENERIC_UID}_startDeformationAction" start="yes" />
                    <menuItem sid="${GENERIC_UID}_stopDeformationAction" start="yes" />
                </registry>
            </service>


            <service uid="${GENERIC_UID}_openFileAction" impl="::gui::action::StarterActionService" >
                <start uid="${GENERIC_UID}_reader" />
            </service>

            <service uid="${GENERIC_UID}_quitAction" impl="::gui::action::QuitAction"  />

            <service uid="${GENERIC_UID}_startDeformationAction" impl="::gui::action::SSlotCaller" >
                <slots>
                    <slot>${GENERIC_UID}_meshDeformation/startDeformation</slot>
                </slots>
            </service>

            <service uid="${GENERIC_UID}_stopDeformationAction" impl="::gui::action::SSlotCaller" >
                <slots>
                    <slot>${GENERIC_UID}_meshDeformation/stopDeformation</slot>
                </slots>
            </service>

            <service uid="${GENERIC_UID}_reader" impl="::uiIO::editor::IOSelectorService" >
                <type mode="reader" />
            </service>

            <!-- Visualization service for the first window. -->
            <service uid="${GENERIC_UID}_rendering1" impl="::vtkSimpleMesh::RendererService" autoConnect="yes" />


            <!-- Visualization service for the second window -->
            <service uid="${GENERIC_UID}_rendering2" impl="::vtkSimpleMesh::RendererService" autoConnect="yes" />

            <!-- Mesh deformation service. -->
            <service uid="${GENERIC_UID}_meshDeformation" impl="::vtkSimpleMesh::SSimpleMeshDeformation"  worker="DEFORMATION_WORKER" />


            <!-- Connect the signal slot of the service to receive the updating of camera position -->
            <connect>
                <signal>${GENERIC_UID}_rendering1/camUpdated</signal>
                <slot>${GENERIC_UID}_rendering2/updateCamPosition</slot>
            </connect>

            <connect>
                <signal>${GENERIC_UID}_rendering2/camUpdated</signal>
                <slot>${GENERIC_UID}_rendering1/updateCamPosition</slot>
            </connect>


            <start uid="${GENERIC_UID}_frame" />
            <start uid="${GENERIC_UID}_meshDeformation" />

        </object>

    </config>
</extension>