<xfm>

  <Panel dir=TOP sizex="100%">

    <SizeGroupX id=sgx_lb/>
    <SizeGroupX id=sgx_combo/>

    <Panel dir=BOTTOM>
      <Label dir=LEFT icon=textinput caption="Create new instrument"/>
    </Panel>

    <TitledPanel dir=BOTTOM caption="General" align=expandx>
      <!-- Name -->
      <Panel dir=BOTTOM>
	<Label dir=LEFT caption="Name:" textPlacement=RIGHT sizeGroup=sgx_lb/>
	<TextField id=tf_name dir=right text="new" sizeGroup=sgx_combo maxCols=256
		   toolTipCaption="Name of the new instrument."
		   />
      </Panel>

      <!-- Polyphony -->
      <Panel dir=BOTTOM>
	<Label dir=LEFT caption="Polyphony:" textPlacement=RIGHT sizeGroup=sgx_lb/>
	<FloatParam id=fp_polyphony min=1 max=256 value=4 
		    dir=RIGHT
		    toolTipCaption="Maximum instrument polyphony."
		    />
      </Panel>

      <!-- Default note duration -->
      <Panel dir=BOTTOM>
	<Label dir=LEFT caption="Default note duration:" textPlacement=RIGHT sizeGroup=sgx_lb/>
	<FloatParam id=fp_notelen dir=right min=0 max=255 precision=0 value=24 
		    toolTipCaption="Default note duration.\n  Used for instrument keyjazz / pattern editor."
		    />
      </Panel>

      <!-- Default note-on velocity -->
      <Panel dir=BOTTOM>
	<Label dir=LEFT caption="Default note-on velocity:" textPlacement=RIGHT sizeGroup=sgx_lb/>
	<FloatParam id=fp_velocity dir=right min=0 max=127 precision=5 value=64 
		    toolTipCaption="Default note-on velocity.\n Used for instrument keyjazz / pattern editor."
		    />
      </Panel>

      <!-- Type -->
      <Panel dir=BOTTOM>
	<Label dir=LEFT caption="Type:" textPlacement=RIGHT sizeGroup=sgx_lb/>
	<ComboBox id=cm_type dir=right options="MIDI;MIDI/Korg Radias;AUDIO;FX" selectedOption=0
		  sizeGroup=sgx_combo
		  toolTipCaption="Instrument / generator type"
		  />
      </Panel>
    </TitledPanel>


    <!-- Type-dependent panels -->
    <TitledPanel id=tp_typename dir=BOTTOM align=expandx caption="MIDI">
      <LayerSwitch id=ls_type dir=BOTTOM align=expandx calcsizeonlycurrent=1>

	<!-- Type: MIDI -->
	<Panel>
	  <Panel dir=TOP align=expandx>

	    <!-- MIDI : Generator -->
	    <Panel dir=BOTTOM>
	      <Label dir=left caption="Generator:" textPlacement=RIGHT sizeGroup=sgx_lb/>
	      <ComboBox id=cm_midi_gen dir=RIGHT options="<Create new generator>" sizeGroup=sgx_combo/>
	    </Panel>

	    <LayerSwitch dir=BOTTOM id=ls_midi_gen calcsizeonlycurrent=1>
	      <Panel>
		<Panel dir=BOTTOM>
		  <Label dir=left caption="MIDI output device:" textPlacement=RIGHT sizeGroup=sgx_lb/>
		  <ComboBox id=cm_midi_gen_outdev dir=RIGHT options="-" 
			    sizeGroup=sgx_combo 
			    />
		</Panel>
		
		<Panel dir=BOTTOM>
		  <Label dir=left caption="MIDI channel:" textPlacement=RIGHT sizeGroup=sgx_lb/>
		  <ComboBox id=cm_midi_gen_outch dir=RIGHT options="1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16" 
			    sizeGroup=sgx_combo
			    />
		</Panel>
	      </Panel>

	      <Panel>
		<Spacer/>
	      </Panel>

	    </LayerSwitch>
	    
	  </Panel>
	</Panel>


	<!-- Type: MIDI/Korg Radias -->
	<Panel>
	  <Panel dir=TOP align=expandx>

	    <Panel dir=BOTTOM>
	      <Label dir=left caption="Generator:" textPlacement=RIGHT sizeGroup=sgx_lb/>
	      <ComboBox id=cm_midikorgradias_gen dir=RIGHT options="<Create new generator>" 
			sizeGroup=sgx_combo
			/>
	    </Panel>

	    <LayerSwitch dir=BOTTOM id=ls_midikorgradias_gen calcsizeonlycurrent=1>
	      <!-- Subpanel: Create new generator options -->
	      <Panel>
		<Panel dir=BOTTOM>
		  <Label dir=left caption="MIDI output device:" textPlacement=RIGHT sizeGroup=sgx_lb/>
		  <ComboBox id=cm_midikorgradias_gen_outdev dir=RIGHT options="-" 
			    sizeGroup=sgx_combo
			    />
		</Panel>
		
		<Panel dir=BOTTOM>
		  <Label dir=left caption="MIDI channel:" textPlacement=RIGHT sizeGroup=sgx_lb/>
		  <ComboBox id=cm_midikorgradias_gen_outch dir=RIGHT options="1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16" 
			    sizeGroup=sgx_combo
			    />
		</Panel>
	      </Panel>

	      <!-- Subpanel: Use selected generator -->
	      <Panel>
		<Spacer/>
	      </Panel>

	    </LayerSwitch>
	  </Panel>
	</Panel>

	<!-- Type: AUDIO -->
	<Panel>
	  <Panel dir=TOP align=expandx>

	    <!-- AUDIO : Generator -->
	    <Panel dir=BOTTOM>
	      <Label dir=LEFT caption="Generator:" textPlacement=RIGHT sizeGroup=sgx_lb/>
	      <ComboBox id=cm_audio_gen dir=RIGHT options="<Create new generator>" 
			sizeGroup=sgx_combo
			/>
	    </Panel>

	    <LayerSwitch dir=BOTTOM id=ls_audio_gen calcsizeonlycurrent=1>
	      <!-- Subpanel: Create new generator options -->
	      <Panel>
		<Panel dir=BOTTOM>
		  <Label dir=left caption=" " textPlacement=RIGHT sizeGroup=sgx_lb/>
		  <CheckBox id=cb_audio_gen_copyname dir=RIGHT caption="Copy generator name from sample" selected=1 />
		</Panel>
	      </Panel>

	      <!-- Subpanel: Use selected generator -->
	      <Panel>
		<Spacer/>
	      </Panel>

	    </LayerSwitch>

	    <!-- Audio : Sample/Waveform -->
	    <Panel dir=BOTTOM>
	      <Label dir=LEFT caption="Sample:" textPlacement=RIGHT sizeGroup=sgx_lb/>
	      <ComboBox id=cm_audio_sample dir=RIGHT 
			options="<Create waveform+sample from file>;<Create sample from existing waveform>;<Create empty sample bank>;" 
			sizeGroup=sgx_combo
			/>
	    </Panel>

	    <LayerSwitch dir=BOTTOM id=ls_audio_sample align=expandx calcsizeonlycurrent=1>

	      <!-- Sample subpanel: Create waveform+sample from file -->
	      <Panel dir=TOP align=expandx>

		<Panel dir=BOTTOM align=expandx>
		  <Label dir=LEFT caption="Selected file:" textPlacement=RIGHT sizeGroup=sgx_lb/>
		  <Panel dir=RIGHT sizex="100%" align=expandx>
		    <Panel dir=TOP align=expandx alpha=255>
		      <Label id=lb_audio_sample_filename caption="-"              dir=LEFT padLeft=0 innerPadding="2;0;0;0" textPlacement=LEFT />
		      <Label                             caption="/"              dir=LEFT padLeft=0 padRight=0 innerPadding="2;0;0;0"/>
		      <Label id=lb_audio_sample_dirname  caption="-"              dir=LEFT padLeft=0 innerPadding="2;0;0;0" textPlacement=LEFT abbrev=1/>
		    </Panel>
		    <Button id=bt_audio_sample_selectfile dir=BOTTOM align=expandx caption="Select file.." 
			    sizeGroup=sgx_combo
			    />
		  </Panel>
		</Panel>

		<Panel dir=BOTTOM>
		  <Label dir=LEFT caption=" " textPlacement=RIGHT sizeGroup=sgx_lb/>
		  <CheckBox id=cb_audio_sample_autodialog dir=RIGHT selected=1 caption="Automatically open file selection dialog" selected=0/>
		</Panel>

		<Panel dir=BOTTOM>
		  <Label dir=LEFT caption=" " textPlacement=RIGHT sizeGroup=sgx_lb/>
		  <CheckBox id=cb_audio_sample_copyname dir=RIGHT selected=1 caption="Copy instrument name from sample/waveform"/>
		</Panel>

	      </Panel>

	      <!-- Sample subpanel: Create sample from existing waveform -->
	      <Panel>
		<Panel dir=TOP align=expandx>
		  <Panel dir=BOTTOM >
		    <Label dir=LEFT caption="Waveform:" textPlacement=RIGHT sizeGroup=sgx_lb/>
		    <ComboBox id=cm_audio_sample_waveform dir=RIGHT options="???" 
			      sizeGroup=sgx_combo
			      />
		  </Panel>
		</Panel>
	      </Panel>

	      <!-- Sample subpanel: Create empty sample bank -->
	      <Panel dir=TOP >
		<Spacer reqSize="1;1"/>
	      </Panel>

	    </LayerSwitch>

	  </Panel>
	</Panel>


	<!-- Type: FX -->
	<Panel>
	  <Panel dir=TOP align=expandx>

	    <!-- FX : Generator -->
	    <Panel dir=BOTTOM>
	      <Label dir=LEFT caption="Generator:" textPlacement=RIGHT sizeGroup=sgx_lb/>
	      <ComboBox id=cm_fx_gen dir=RIGHT options="<Create new generator>" 
			sizeGroup=sgx_combo
			/>
	    </Panel>
	    
	  </Panel>
	</Panel>


      </LayerSwitch>

    </TitledPanel> <!-- end type-specific options -->

  </Panel>

  <Panel dir=bottom align=center padding="10;0;10;0">
    <Button id=bt_create dir=LEFT caption="Create instrument" padRight=10/>
    <Button id=bt_cancel dir=RIGHT caption="Cancel" padLeft=10/>
  </Panel>

</xfm>