<!--
// ---- file   : NodeModularEditor.xfm
// ---- author : Bastian Spiegel <bs@tkscript.de>
// ---- legal  : (c) 2021 by Bastian Spiegel. 
// ----          Distributed under terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL). See 
// ----          http://www.gnu.org/licenses/licenses.html#LGPL or COPYING for further information.
// ----
// ---- info   : This is part of the "syntracker" midi/audio sequencer.
// ----
// ---- created: 26Mar2021
// ---- changed: 27Mar2021, 29Mar2021, 13May2021
// ----
// ----
// ----
-->

<xfm align=expand>
  <Panel dir=CENTER align=expand padding=0;2;0;2 alpha=255>

    <TabSwitch id=ts_groups dir=CENTER align=expand
               name="Tabs"
               font=big6
               fontActiveTab=big5
               keepParent=1
               cacheLayout=1
               mouseWheel=0
               active=1
               >

      <!-- 0: Pattern -->
      <View caption="Pattern">
        <Panel align=expand><Panel align=expand padLeft=10>

            <SizeGroupX id=sgx_pat_lbc1/>
            <SizeGroupX id=sgx_pat_cmc1/>
            <SizeGroupX id=sgx_pat_lbc2/>
            <SizeGroupX id=sgx_pat_cmc2/>
            <SizeGroupX id=sgx_pat_lbc3/>
            <SizeGroupX id=sgx_pat_cmc3/>

            <!-- Pattern alloc/free -->
            <Panel dir=TOP align=expandx padding=16;8;0;8>
              <SizeGroupX id=sgx_bt_pat/>

              <Button id=bt_pat_tools
                      style=flat
                      name="Pat.Tools.."
                      dir=CENTER
                      caption="Tools.."
                      icon=tools
                      iconMono=tools_mono
                      font=big5
                      innerPadLeft=30
                      innerPadRight=30
                      toolTipCaption="Show pattern tools menu"
                      align=centerY
                      sizeGroup=sgx_bt_pat
                      />

              <Button id=bt_pat_alloc
                      style=flat
                      name="Pat.Alloc"
                      dir=LEFT
                      caption="New"
                      icon=add
                      iconMono=add_mono
                      font=big5
                      innerPadLeft=30
                      innerPadRight=30
                      hold=1
                      toolTipCaption="Allocate new pattern (lctrl-n).\n\n (note) If the currently selected pattern is unused, it will be allocated.\n\n (note) If the currently selected pattern is in use, the next unused pattern will be allocated.\n\n (note) Hold-click to clone the current pattern (lctrl-r)"
                      align=centerY
                      sizeGroup=sgx_bt_pat
                      />

              <Button id=bt_pat_free
                      style=flat
                      name="Pat.Free"
                      dir=RIGHT
                      caption="Free"
                      icon=remove
                      iconMono=remove_mono
                      font=big5
                      innerPadLeft=30
                      innerPadRight=30
                      toolTipCaption="Free pattern.\n\n (note) lctrl-x F3"
                      align=centerY
                      sizeGroup=sgx_bt_pat
                      />
            </Panel>

            <Panel dir=TOP align=expandx padTop=16 padBottom=0>

              <TextField id=tf_pat_name dir=LEFT
                         name="Name"
                         cols=7
                         font=big6
                         align=centerY
                         toolTipCaption="Pattern name"
                         />

              <Label dir=LEFT caption="Name:" padLeft=16
                     textPlacement=RIGHT
                     font=big7
                     align=centerY
                     fillBG=0
                     sizeGroup=sgx_pat_lbc2
                     />

              <ComboBox id=cm_pattern_nr dir=LEFT
                        name="PatNr"
                        font=big4
                        align=centerY
                        arrowSx=32
                        reverseWheelDir=1
                        sizeGroup=sgx_pat_cmc1
                        arrowIcon=arr2x_d
                        toolTipCaption="Current pattern"
                        />

              <Label dir=LEFT caption="Pattern:\n  (127)"
                     id=lb_pat_nr
                     font=big7
                     align=centerY
                     fillBG=1
                     textPlacement=RIGHT
                     sizeGroup=sgx_pat_lbc1
                     />

            </Panel>

            <Panel></Panel> <!-- grab all available space -->

        </Panel></Panel>
      </View>


      <!-- 1: I/O -->
      <View caption="I/O">
        <Panel align=expandx><Panel dir=TOP align=expandx>

            <!-- Input/output devices -->
            <Panel dir=TOP padTop=0 padBottom=0 align=expandx>

              <SizeGroupX id=sgx_io_lb/>

              <!-- Port 1 -->
              <Panel dir=BOTTOM align=expandx>
                <CtlIOForm id=p_1 dir=CENTER align=centery;expandx  autoresolve=0 />
                <Label dir=LEFT caption="1:"
                       padLeft=0
                       textPlacement=RIGHT
                       font=big7
                       align=centerY
                       fillBG=0
                       sizeGroup=sgx_io_lb
                       />
              </Panel>

              <!-- Port 2 -->
              <Panel dir=BOTTOM align=expandx>
                <CtlIOForm id=p_2 dir=CENTER align=centery;expandx  autoresolve=0 />
                <Label dir=LEFT caption="2:"
                       padLeft=0
                       textPlacement=RIGHT
                       font=big7
                       align=centerY
                       fillBG=0
                       sizeGroup=sgx_io_lb
                       />
                </Panel>

              <!-- Port 3 -->
              <Panel dir=BOTTOM align=expandx>
                <CtlIOForm id=p_3 dir=CENTER align=centery;expandx  autoresolve=0 />
                <Label dir=LEFT caption="3:"
                       padLeft=0
                       textPlacement=RIGHT
                       font=big7
                       align=centerY
                       fillBG=0
                       sizeGroup=sgx_io_lb
                       />
              </Panel>

              <!-- Port 4 -->
              <Panel dir=BOTTOM align=expandx>
                <CtlIOForm id=p_4 dir=CENTER align=centery;expandx  autoresolve=0 />
                <Label dir=LEFT caption="4:"
                       padLeft=0
                       textPlacement=RIGHT
                       font=big7
                       align=centerY
                       fillBG=0
                       sizeGroup=sgx_io_lb
                       />
              </Panel>

              <!-- Port 5 -->
              <Panel dir=BOTTOM align=expandx>
                <CtlIOForm id=p_5 dir=CENTER align=centery;expandx  autoresolve=0 />
                <Label dir=LEFT caption="5:"
                       padLeft=0
                       textPlacement=RIGHT
                       font=big7
                       align=centerY
                       fillBG=0
                       sizeGroup=sgx_io_lb
                       />
              </Panel>

              <!-- Port 6 -->
              <Panel dir=BOTTOM align=expandx>
                <CtlIOForm id=p_6 dir=CENTER align=centery;expandx  autoresolve=0 />
                <Label dir=LEFT caption="6:"
                       padLeft=0
                       textPlacement=RIGHT
                       font=big7
                       align=centerY
                       fillBG=0
                       sizeGroup=sgx_io_lb
                       />
              </Panel>

              <!-- Port 7 -->
              <Panel dir=BOTTOM align=expandx>
                <CtlIOForm id=p_7 dir=CENTER align=centery;expandx  autoresolve=0 />
                <Label dir=LEFT caption="7:"
                       padLeft=0
                       textPlacement=RIGHT
                       font=big7
                       align=centerY
                       fillBG=0
                       sizeGroup=sgx_io_lb
                       />
              </Panel>

              <!-- Port 8 -->
              <Panel dir=BOTTOM align=expandx>
                <CtlIOForm id=p_8 dir=CENTER align=centery;expandx  autoresolve=0 />
                <Label dir=LEFT caption="8:"
                       padLeft=0
                       textPlacement=RIGHT
                       font=big7
                       align=centerY
                       fillBG=0
                       sizeGroup=sgx_io_lb
                       />
              </Panel>

            </Panel>
          
        </Panel></Panel>
      </View>


      <!-- 2: Patch -->
      <View caption="Patch">
        <Panel align=expand>
          <ModularRack align=expand id=rack/>
        </Panel>
      </View>


      <!-- 5: Play -->
      <View caption="Play">
        <Panel align=expand><Panel align=expand>

            <SizeGroupX id=sgx_play_lbc1/>
            <SizeGroupX id=sgx_play_cmc1/>

            <!-- Output to frameRec -->
            <Panel dir=TOP align=expandx padTop=8>
              <CheckBox id=cb_play_framerec
                        name="FrRec"
                        dir=LEFT
                        caption="Output to FrameRec"
                        toolTipCaption="When checked, redirect node output to frameRec instead of framePlay\n\n (note) useful for controller-type patches"
                        font=big7
                        iconPrefix=chb2x
                        padLeft=20
                        />

              <Spacer dir=LEFT
                     align=centerY
                     sizeGroup=sgx_play_lbc1
                     />
            </Panel>

            <!-- Change Reset -->
            <Panel dir=TOP align=expandx padTop=8>
              <CheckBox id=cb_play_change_reset
                        name="ChgRst"
                        dir=LEFT
                        caption="Reset"
                        toolTipCaption="When checked, reset all modules when pattern has changed"
                        font=big7
                        iconPrefix=chb2x
                        padLeft=20
                        />

              <Spacer dir=LEFT
                     align=centerY
                     sizeGroup=sgx_play_lbc1
                     />
            </Panel>

            <!-- Node Class / Show in arranger -->
            <Panel dir=TOP align=expandx padTop=16 padBottom=0>

              <ComboBox id=cm_node_class_show_in
                        name="InArr"
                        dir=LEFT
                        font=big9
                        align=centerY
                        toolTipCaption="Show node in selected arranger (* = show in all arrangers)"
                        />

              <CheckBox id=cb_node_class_show
                        name="Class: Show"
                        dir=LEFT
                        caption="Show in Arranger"
                        toolTipCaption="When checked, show node in arranger."
                        font=big7
                        iconPrefix=chb2x
                        padLeft=10
                        />

              <ComboBox id=cm_node_class
                        name="Class"
                        dir=LEFT
                        font=big5
                        align=centerY
                        arrowSx=24
                        arrowIcon=arr2x_d
                        sizeGroup=sgx_play_cmc1
                        />
              
              <Label dir=LEFT font=big6 caption="Class:"
                     textPlacement=RIGHT
                     align=centerY
                     fillBG=0
                     sizeGroup=sgx_play_lbc1
                     />
            </Panel>

            <AutoDeviceForm id=f_autodev dir=BOTTOM align=expandx/>

		  </Panel></Panel>
      </View>

    </TabSwitch>

  </Panel>
  
</xfm>
