//--- OBJECT WRITE BEGIN ---
%guiContent = new GuiControl(ChooseLevelDlg) {
   position = "0 0";
   extent = "1024 768";
   minExtent = "8 8";
   horizSizing = "width";
   vertSizing = "height";
   profile = "GuiOverlayProfile";
   visible = "1";
   active = "1";
   tooltipProfile = "GuiToolTipProfile";
   hovertime = "1000";
   isContainer = "1";
   canSave = "1";
   canSaveDynamicFields = "1";
      enabled = "1";
      launchInEditor = "0";

   new GuiWindowCtrl(ChooseLevelWindow) {
      text = "Choisir Map";
      resizeWidth = "0";
      resizeHeight = "0";
      canMove = "1";
      canClose = "1";
      canMinimize = "0";
      canMaximize = "0";
      canCollapse = "0";
      closeCommand = "Canvas.popDialog(ChooseLevelDlg);";
      edgeSnap = "1";
      margin = "0 0 0 0";
      padding = "0 0 0 0";
      anchorTop = "1";
      anchorBottom = "0";
      anchorLeft = "1";
      anchorRight = "0";
      position = "212 167";
      extent = "600 433";
      minExtent = "8 8";
      horizSizing = "center";
      vertSizing = "center";
      profile = "GuiWindowProfile";
      visible = "1";
      active = "1";
      tooltipProfile = "GuiToolTipProfile";
      hovertime = "1000";
      isContainer = "1";
      canSave = "1";
      canSaveDynamicFields = "0";

      new GuiBitmapCtrl() {
         bitmap = "levels/Empty Room_preview";
         wrap = "0";
         position = "10 31";
         extent = "400 300";
         minExtent = "8 2";
         horizSizing = "right";
         vertSizing = "bottom";
         profile = "GuiDefaultProfile";
         visible = "1";
         active = "1";
         tooltipProfile = "GuiToolTipProfile";
         hovertime = "1000";
         isContainer = "0";
         internalName = "CurrentPreview";
         canSave = "1";
         canSaveDynamicFields = "1";
            enabled = "1";
      };
      new GuiTextCtrl() {
         text = "Empty Room";
         maxLength = "255";
         margin = "0 0 0 0";
         padding = "0 0 0 0";
         anchorTop = "1";
         anchorBottom = "0";
         anchorLeft = "1";
         anchorRight = "0";
         position = "420 31";
         extent = "165 18";
         minExtent = "8 8";
         horizSizing = "right";
         vertSizing = "bottom";
         profile = "GuiMediumTextProfile";
         visible = "1";
         active = "1";
         tooltipProfile = "GuiToolTipProfile";
         hovertime = "1000";
         isContainer = "0";
         internalName = "levelName";
         canSave = "1";
         canSaveDynamicFields = "0";
      };
      new GuiTextCtrl() {
         text = "Description:";
         maxLength = "255";
         margin = "0 0 0 0";
         padding = "0 0 0 0";
         anchorTop = "1";
         anchorBottom = "0";
         anchorLeft = "1";
         anchorRight = "0";
         position = "420 50";
         extent = "72 18";
         minExtent = "8 8";
         horizSizing = "right";
         vertSizing = "bottom";
         profile = "GuiTextProfile";
         visible = "1";
         active = "1";
         tooltipProfile = "GuiToolTipProfile";
         hovertime = "1000";
         isContainer = "0";
         canSave = "1";
         canSaveDynamicFields = "0";
      };
      new GuiMLTextCtrl() {
         lineSpacing = "2";
         allowColorChars = "0";
         maxChars = "-1";
         useURLMouseCursor = "0";
         position = "420 76";
         extent = "165 28";
         minExtent = "8 8";
         horizSizing = "right";
         vertSizing = "bottom";
         profile = "GuiMLTextProfile";
         visible = "1";
         active = "1";
         tooltipProfile = "GuiToolTipProfile";
         hovertime = "1000";
         isContainer = "0";
         internalName = "LevelDescription";
         canSave = "1";
         canSaveDynamicFields = "0";
      };
      new GuiCheckBoxCtrl() {
         text = "Multiplayer";
         groupNum = "-1";
         buttonType = "ToggleButton";
         useMouseEvents = "0";
         position = "424 219";
         extent = "72 23";
         minExtent = "8 8";
         horizSizing = "right";
         vertSizing = "bottom";
         profile = "GuiCheckBoxProfile";
         visible = "1";
         active = "1";
         variable = "pref::HostMultiPlayer";
         tooltipProfile = "GuiToolTipProfile";
         hovertime = "1000";
         isContainer = "0";
         canSave = "1";
         canSaveDynamicFields = "0";
      };
      new GuiButtonCtrl(ChooseLevelDlgGoBtn) {
         text = "Lancer";
         groupNum = "-1";
         buttonType = "PushButton";
         useMouseEvents = "1";
         position = "458 287";
         extent = "143 56";
         minExtent = "8 8";
         horizSizing = "right";
         vertSizing = "bottom";
         profile = "GuiMenuButtonProfile";
         visible = "1";
         active = "1";
         tooltipProfile = "GuiToolTipProfile";
         hovertime = "1000";
         isContainer = "0";
         canSave = "1";
         canSaveDynamicFields = "0";
      };
      new GuiBitmapButtonCtrl() {
         bitmap = "art/gui/previous-button";
         bitmapMode = "Stretched";
         autoFitExtents = "0";
         useModifiers = "0";
         useStates = "1";
         groupNum = "-1";
         buttonType = "PushButton";
         useMouseEvents = "0";
         position = "10 343";
         extent = "11 81";
         minExtent = "8 2";
         horizSizing = "right";
         vertSizing = "bottom";
         profile = "GuiDefaultProfile";
         visible = "0";
         active = "1";
         command = "ChooseLevelWindow.previousPreviews();";
         tooltipProfile = "GuiToolTipProfile";
         hovertime = "1000";
         isContainer = "0";
         internalName = "PreviousSmallPreviews";
         hidden = "1";
         canSave = "1";
         canSaveDynamicFields = "1";
            enabled = "1";
            wrap = "0";
      };
      new GuiDynamicCtrlArrayControl() {
         colCount = "5";
         colSize = "108";
         rowCount = "1";
         rowSize = "81";
         rowSpacing = "0";
         colSpacing = "10";
         frozen = "0";
         autoCellSize = "1";
         fillRowFirst = "1";
         dynamicSize = "0";
         padding = "0 0 0 0";
         position = "10 343";
         extent = "600 81";
         minExtent = "8 2";
         horizSizing = "right";
         vertSizing = "bottom";
         profile = "GuiDefaultProfile";
         visible = "1";
         active = "1";
         tooltipProfile = "GuiToolTipProfile";
         hovertime = "1000";
         isContainer = "1";
         internalName = "SmallPreviews";
         canSave = "1";
         canSaveDynamicFields = "0";

         new GuiBitmapButtonCtrl() {
            bitmap = "levels/Empty Room_preview";
            bitmapMode = "Stretched";
            autoFitExtents = "0";
            useModifiers = "0";
            useStates = "1";
            groupNum = "-1";
            buttonType = "PushButton";
            useMouseEvents = "0";
            position = "0 0";
            extent = "108 81";
            minExtent = "8 2";
            horizSizing = "right";
            vertSizing = "bottom";
            profile = "GuiDefaultProfile";
            visible = "1";
            active = "1";
            command = "ChooseLevelWindow.previewSelected(ChooseLevelWindow->SmallPreviews->SmallPreview0);";
            tooltipProfile = "GuiToolTipProfile";
            hovertime = "1000";
            isContainer = "0";
            internalName = "SmallPreview0";
            canSave = "1";
            canSaveDynamicFields = "0";
         };
         new GuiBitmapButtonCtrl() {
            bitmap = "art/gui/no-preview";
            bitmapMode = "Stretched";
            autoFitExtents = "0";
            useModifiers = "0";
            useStates = "1";
            groupNum = "-1";
            buttonType = "PushButton";
            useMouseEvents = "0";
            position = "118 0";
            extent = "108 81";
            minExtent = "8 2";
            horizSizing = "right";
            vertSizing = "bottom";
            profile = "GuiDefaultProfile";
            visible = "1";
            active = "1";
            command = "ChooseLevelWindow.previewSelected(ChooseLevelWindow->SmallPreviews->SmallPreview1);";
            tooltipProfile = "GuiToolTipProfile";
            hovertime = "1000";
            isContainer = "0";
            internalName = "SmallPreview1";
            canSave = "1";
            canSaveDynamicFields = "0";
         };
         new GuiBitmapButtonCtrl() {
            bitmap = "art/gui/no-preview";
            bitmapMode = "Stretched";
            autoFitExtents = "0";
            useModifiers = "0";
            useStates = "1";
            groupNum = "-1";
            buttonType = "PushButton";
            useMouseEvents = "0";
            position = "236 0";
            extent = "108 81";
            minExtent = "8 2";
            horizSizing = "right";
            vertSizing = "bottom";
            profile = "GuiDefaultProfile";
            visible = "1";
            active = "1";
            command = "ChooseLevelWindow.previewSelected(ChooseLevelWindow->SmallPreviews->SmallPreview2);";
            tooltipProfile = "GuiToolTipProfile";
            hovertime = "1000";
            isContainer = "0";
            internalName = "SmallPreview2";
            canSave = "1";
            canSaveDynamicFields = "0";
         };
         new GuiBitmapButtonCtrl() {
            bitmap = "levels/Empty Terrain_preview";
            bitmapMode = "Stretched";
            autoFitExtents = "0";
            useModifiers = "0";
            useStates = "1";
            groupNum = "-1";
            buttonType = "PushButton";
            useMouseEvents = "0";
            position = "354 0";
            extent = "108 81";
            minExtent = "8 2";
            horizSizing = "right";
            vertSizing = "bottom";
            profile = "GuiDefaultProfile";
            visible = "1";
            active = "1";
            command = "ChooseLevelWindow.previewSelected(ChooseLevelWindow->SmallPreviews->SmallPreview3);";
            tooltipProfile = "GuiToolTipProfile";
            hovertime = "1000";
            isContainer = "0";
            internalName = "SmallPreview3";
            canSave = "1";
            canSaveDynamicFields = "0";
         };
      };
      new GuiBitmapButtonCtrl() {
         bitmap = "art/gui/next-button";
         bitmapMode = "Stretched";
         autoFitExtents = "0";
         useModifiers = "0";
         useStates = "1";
         groupNum = "-1";
         buttonType = "PushButton";
         useMouseEvents = "0";
         position = "579 343";
         extent = "11 81";
         minExtent = "8 2";
         horizSizing = "right";
         vertSizing = "bottom";
         profile = "GuiDefaultProfile";
         visible = "0";
         active = "1";
         command = "ChooseLevelWindow.nextPreviews();";
         tooltipProfile = "GuiToolTipProfile";
         hovertime = "1000";
         isContainer = "0";
         internalName = "NextSmallPreviews";
         hidden = "1";
         canSave = "1";
         canSaveDynamicFields = "1";
            enabled = "1";
            wrap = "0";
      };
      new GuiTextListCtrl(CL_levelList) {
         columns = "0";
         fitParentWidth = "1";
         clipColumnText = "0";
         position = "1 1";
         extent = "80 120";
         minExtent = "8 8";
         horizSizing = "right";
         vertSizing = "bottom";
         profile = "GuiTextArrayProfile";
         visible = "0";
         active = "1";
         tooltipProfile = "GuiToolTipProfile";
         hovertime = "1000";
         isContainer = "1";
         hidden = "1";
         canSave = "1";
         canSaveDynamicFields = "0";
      };
   };
};
//--- OBJECT WRITE END ---

// Do this onMouseUp not via Command which occurs onMouseDown so we do
// not have a lingering mouseUp event lingering in the ether.
function ChooseLevelDlgGoBtn::onMouseUp( %this )
{
   // So we can't fire the button when loading is in progress.
   if ( isObject( ServerGroup ) )
      return;

   // Launch the chosen level with the editor open?
   if ( ChooseLevelDlg.launchInEditor )
   {
      activatePackage( "BootEditor" );
      ChooseLevelDlg.launchInEditor = false; 
      StartLevel("", "SinglePlayer");
   }
   else
   {
      StartLevel(); 
   }
}
