#!/boot/home/config/bin/yab
//******************* Verzeichnisse bestimmen *************************************
ProjectRoot$="/boot/home/.besly/PlaygroundED"
ProjectFolder$=ProjectRoot$+"/projects"
ProjectFolderTemp$=ProjectRoot$+"/temp"
BGFolder$=ProjectFolderTemp$+"/backgrounds"
OBFolder$=ProjectFolderTemp$+"/objects"

//******************* ExportVerzeichnis bestimmen ************************************
ProjectExport$="/boot/home/PlaygroundED/projects/export"
//WorkingDir$="/SharedBFS/projects/yab/PlaygroundEditor"
WorkingDir$="/Share/Projekte/yab_hpkg/PlaygroundEditor/"
SWFolder$=WorkingDir$+"/data/gfx/SW"
BTFolder$=WorkingDir$+"data/gfx/BT"
//******************* VerzeichnisPruefung  ************************************
if(IfExists(ProjectFolder$)) then
else
        Output$=System$("mkdir -p "+ProjectFolder$)
endif
if(IfExists(ProjectFolderTemp$)) then
else
        Output$=System$("mkdir -p "+ProjectFolderTemp$)
endif
if(IfExists(BGFolder$)) then
else
        Output$=System$("mkdir -p "+BGFolder$)
endif
if(IfExists(OBFolder$)) then
else
        Output$=System$("mkdir -p "+OBFolder$)
endif
//******************* VerzeichnisPruefung EXPORT ************************************
if(IfExists(ProjectExport$)) then
else
        Output$=System$("mkdir -p "+ProjectExport$)
endif
	
//******************* ProgrammVariablen definieren ************************************
//Ermittlung des Screengroesse
	screenWidth = peek("desktopwidth")
	screenHeight = peek("desktopheight")  
	
	HBPF =  500 //Halbe Breite Programmfenster
	HHPF =  400 //Halbe Hoehe Programmfenster
	ExportPreviewImage=0
	BITMAP 32, 32, "DrawBG"
        	BITMAP 32, 32, "DrawOB"
        	BITMAP 10, 10, "DrawSW"       	
//******************* Window ID definieren ************************************
	WindowID$="playgroundED"
//******************* Anzeigename des Programms definieren ************************************
	ProgrammName$="Playground Editor"
//******************* ViewNamen definieren ************************************
//Stackviews
SVplaygroundED$="SVPlaygroundED"

//******************* Erstelle ProgrammFenster ************************************
// Generate Window
WINDOW OPEN screenWidth/2-HBPF,screenHeight/2-HHPF to screenWidth/2+HBPF,screenHeight/2+HHPF , WindowID$, ProgrammName$
        WINDOW SET  WindowID$, "MinimumTo", HBPF*2,HHPF*2
        WINDOW SET  WindowID$, "flags", "not-zoomable, not-resizable"
//******************* Definition des Stackviews ************************************  
	width_window=WINDOW GET WindowID$, "Width"
        	height_window=WINDOW GET WindowID$, "Height"
        	BUTTON width_window-110,height_window-60 TO width_window-10, height_window-10, "BTAbout", "Info",  WindowID$
        	STACKVIEW 0,0 TO width_window,height_window, SVPlaygroundED$, 5,  WindowID$
        
        //Stack1 = View User Stack
        //Stack2 = Editor
        //Docu?
        //Stack4 = Export
        //Stack5 = Tiles
       
        //Stack 1
       
        STACKVIEW width_window/2-200,height_window/2-300 TO width_window/2+200,height_window/2+300, "VIUserMenu", 4, SVPlaygroundED$+"1"
       
        //User Stack1 = Load or Create
        //User Stack2 = Loading Project
        //User Stack3 = Creating project

        		STACKVIEW SET "VIUserMenu",1
        		
 		//User Stack 1		- Selecting loading of creating
 		BUTTON 400/2-150,600/2-50 TO 400/2+150,600/2-10, "BTLoadProject", "Load Project", "VIUserMenu1"
 			option set "BTLoadProject", "enabled", false
 		BUTTON 400/2-150,600/2+10 TO 400/2+150,600/2+50, "BTNewProject", "New Project", "VIUserMenu1"
 			option set "BTNewProject", "enabled", false
 			
 		//User Stack 2		- loading project
 		
 		//Stackview Open Project Button/Statusbar
 		STACKVIEW 400/2-150,600/2-200 TO 400/2+150,600/2-160, "SVOpenProject", 2, "VIUserMenu2"
 			//Stack 1 Open Project Button
 			BUTTON 0,0 TO 300,40, "BTOpenProject", "Open Project", "SVOpenProject1"
 				option set "BTOpenProject", "enabled", false
 			//Stack 2 Open Project Button - Statusbar
 			STATUSBAR 0, 0 to 300, 30, "SBOpenProject", "Loading project data", "", "SVOpenProject2"
 			
 			LISTBOX 400/2-150,600/2-140 TO 400/2+150,600/2+140, "LBProjects", 3, "VIUserMenu2"
 				LoadProjects()
 		
 			BUTTON 400/2-150,600/2+160 TO 400/2+150,600/2+200, "BTBack", "Back", "VIUserMenu2"
        
        		//User Stack 3		- create project
 		BUTTON 400/2-150,600/2-200 TO 400/2+150,600/2-160, "BTBack", "Back", "VIUserMenu3"
 		
 		TEXTCONTROL 400/2-150,600/2-110 TO 400/2+150,600/2-90, "TCProjectName", "Project name:", "",  "VIUserMenu3"
 			
 		DRAW TEXT 400/2-150,600/2-35, "Size of playground (Count of filelds):", "VIUserMenu3"
 		
 			SPINCONTROL 400/2-140,600/2-10, "SCPlaygroundSizeX", "Horizontal:", 1, 9999, 1, "VIUserMenu3"
 				SPINCONTROL SET "SCPlaygroundSizeX", 23
 			SPINCONTROL 400/2+26,600/2-10, "SCPlaygroundSizeY", "Vertical:", 1, 9999, 1, "VIUserMenu3"
 				SPINCONTROL SET "SCPlaygroundSizeY", 23
 		
 		DRAW TEXT 400/2-150,600/2+55, "Size of tiles:", "VIUserMenu3"		
 			
 			SPINCONTROL 400/2-140,600/2+80, "SCTileSizeX", "Height:", 1, 9999, 1, "VIUserMenu3"
 				SPINCONTROL SET "SCTileSizeX", 32
 			SPINCONTROL 400/2+30,600/2+80, "SCTileSizeY", "Width:", 1, 9999, 1, "VIUserMenu3"
 				SPINCONTROL SET "SCTileSizeY", 32	
 		
 		//Stackview Create Project Button/Statusbar
 		STACKVIEW 400/2-150,600/2+160 TO 400/2+150,600/2+200, "SVCreateProject", 2, "VIUserMenu3"
 			// Stack 1 Create Project Button - Statusbar
 			BUTTON 0,0 TO 300,40, "BTCreateProject", "Create Project", "SVCreateProject1"
        				//option set "BTCreateProject", "enabled", false
        			//Stack 2 Create Project Button - Statusbar
 			STATUSBAR 0, 0 to 300, 30, "SBCreateProject", "", "", "SVCreateProject2"
        		
        			
        //Stack 2		//Editor
        
        VIEW 0,3 TO 1000/2+200, 23, "VIMenu", SVPlaygroundED$+"2"
        	       	//MENU "App", "About", "A", "VIMenu"        
        		//MENU "Project", "Save", "S", "VIMenu"

        		//MENU "Project", "--", "", "VIMenu"
        		//MENU "Project", "Export", "E", "VIMenu"
        		//SUBMENU "Project", "Export", "Background", "", "VIMenu"    
        		//SUBMENU "Project", "Export", "Background with objects", "", "VIMenu"    
        		//SUBMENU "Project", "Export", "Background with switches", "", "VIMenu"    
        		//SUBMENU "Project", "Export", "Objects", "", "VIMenu"    
        		//SUBMENU "Project", "Export", "Objects with switches", "", "VIMenu"    
        		//SUBMENU "Project", "Export", "Switches", "", "VIMenu"    
        		//SUBMENU "Project", "Export", "All", "", "VIMenu"    
        		//SUBMENU "Project", "Export", "Export_playground", "E", "VIMenu"        		
        		//MENU "Project", "--", "", "VIMenu"
        		//MENU "Project", "Close", "", "VIMenu"
        		//MENU "Tileset", "Add", "", "VIMenu"
        		
        		//BUTTON 5,0 TO 45,20, "BTAbout", "About", "VIMenu"
        		BUTTON IMAGE 5,0, "BTAbout", BTFolder$+"/BTMenuAbouta.gif", BTFolder$+"/BTMenuAbouta.gif", Disabled$, "VIMenu"
        		//BUTTON 50,0 TO 90,20, "BTSave", "Save", "VIMenu"        	
        		BUTTON IMAGE 75,0, "BTSave", BTFolder$+"/BTMenuSavea.gif", BTFolder$+"/BTMenuSavea.gif", Disabled$, "VIMenu"	
        		//BUTTON 95,0 TO 135,20, "BTExport", "Export", "VIMenu"
        		BUTTON IMAGE 145,0, "BTExport", BTFolder$+"/BTMenuExporta.gif", BTFolder$+"/BTMenuExporta.gif", Disabled$, "VIMenu"	
        		//BUTTON 140,0 TO 180,20, "BTBack", "Close", "VIMenu"
        		BUTTON IMAGE 215,0, "BTBack", BTFolder$+"/BTMenuBacka.gif", BTFolder$+"/BTMenuBacka.gif", Disabled$, "VIMenu"	
        		//BUTTON 185,0 TO 225,20, "BTTiles", "Tiles", "VIMenu"
        		BUTTON IMAGE 285,0, "BTTiles", BTFolder$+"/BTMenuTilesa.gif", BTFolder$+"/BTMenuTilesa.gif", Disabled$, "VIMenu"
        
      	  	TEXTCONTROL 1000/2+201, 0 TO 970, 20, "TCInput", "", "", SVPlaygroundED$+"2"
      	  		OPTION SET "TCInput", "Enabled", false
       	 	BUTTON 974, 0 TO 994, 24, "BTSetDescription", "v",  SVPlaygroundED$+"2"
        			OPTION SET "BTSetDescription", "Enabled", false
          
       	 	BOXVIEW 5,25 TO 695,785, "BVEditor", "Playground", 3, SVPlaygroundED$+"2"
         	       		VIEW 5,5 to 665, 720, "VIEditor", "BVEditor"        	       		
         	               		DRAW SET "BGColor", 0,0,0, "VIEditor"
         	               		//LAYOUT "Right, Bottom" , "VIEd"
         	               		SCROLLBAR "SBEditor", 3, "VIEditor"
                
       	 	SPLITVIEW 705,25 TO 995,530, "SVList", 0, 1, SVPlaygroundED$+"2"
                		SPLITVIEW SET "SVList", "Divider", 250
        
        		LAYOUT "Top,Bottom", "SVList1"          
        		BOXVIEW 0,0 TO 288,245, "BGList", "Backgrounds", 3, "SVList1"
                		COLUMNBOX 5,5 TO 277,220, "CBBG", 3, "resizable", "BGList"
                        	COLUMNBOX COLUMN "CBBG", "Tile", 1, 64, 64, 64, "align-center,"
                        	COLUMNBOX COLUMN "CBBG", "Description", 2, 500, 190, 190, "align-left,"
        			
        		LAYOUT "Top, Bottom", "SVList2" 
        		BOXVIEW 0,0 TO 288,245, "OBList", "Objects", 3, "SVList2"
                		COLUMNBOX 5,5 TO 277,220, "CBOB", 3, "resizable", "OBList"
                        	COLUMNBOX COLUMN "CBOB", "Tile", 1, 64, 64, 64, "align-center,"
        		     	COLUMNBOX COLUMN "CBOB", "Description", 2, 500, 190, 190, "align-left,"
        
        		BOXVIEW 705,535 TO 995,785, "SWList", "Switches", 3, SVPlaygroundED$+"2"
        			COLUMNBOX 5,5 TO 277,220, "CBSW", 3, "resizable", "SWList"
                        		COLUMNBOX COLUMN "CBSW", "Key", 1, 64, 64, 64, "align-center,"
                        		COLUMNBOX COLUMN "CBSW", "Description", 2, 500, 190, 190, "align-left,"
     	
       	//Stack 3 - About
      		About()
       	
       	 //Stack 4	-  Export
       	
       		STACKVIEW 1000/2-150,800/2-200 TO 1000/2+150,800/2-160, "SVExportProject", 2, SVPlaygroundED$+"4"
 			//Stack 1 Export Project Button
 			BUTTON 0,0 TO 300,40, "BTExportPlayground", "Export", "SVExportProject1"
 				option set "BTExportPlayground", "enabled", false
 			//Stack 2 Export Project Button - Statusbar
 			STATUSBAR 0, 0 to 300, 30, "SBExportProject", "Export project data", "", "SVExportProject2"
       		LISTBOX 1000/2-150,800/2-140 TO 1000/2+150,800/2+140, "LBExport", 3, SVPlaygroundED$+"4"
       			LISTBOX ADD "LBExport", "Background only"
       			LISTBOX ADD "LBExport", "Background with objects"
       			LISTBOX ADD "LBExport", "Background wich switches"
       			LISTBOX ADD "LBExport", "Background with objects and switches"
       			LISTBOX ADD "LBExport", "Objects only"
       			LISTBOX ADD "LBExport", "Objects with switches"
       			LISTBOX ADD "LBExport", "Switches only"
       			
       			CHECKBOX 1000/2-150,800/2+160, "CBPreviewPicture", "Export with preview image", 0, SVPlaygroundED$+"4"
       			option set "CBPreviewPicture", "enabled", false
       			
       		BUTTON 1000/2-150,800/2+200 TO 1000/2+150,800/2+240, "BTExportBack", "Back", SVPlaygroundED$+"4"
       		
     
          //Stack 5	-  Tileset
          
           BOXVIEW 10,100 TO 490,700, "BVSystemFolder", "System", 3, SVPlaygroundED$+"5"
           	 COLUMNBOX 5,5 TO 470,575, "CBSystemFolder", 3, "resizable", "BVSystemFolder"
           	 	COLUMNBOX COLUMN "CBSystemFolder", "Icon", 1, 64, 64, 64, "align-center,"
                        	COLUMNBOX COLUMN "CBSystemFolder", "List", 2, 500, 190, 190, "align-left,"
                        	
                        	BUTTON 5,70 TO 205,90, "BTRefresh", "Refresh SystemFolder", SVPlaygroundED$+"5"
                        	//BUTTON 495,122 TO 515,335, "BTAddBackground", ">", SVPlaygroundED$+"5"
                        	BUTTON IMAGE 495,122, "BTAddBackground", BTFolder$+"/BTCopya.gif", BTFolder$+"/BTCopya.gif", BTFolder$+"/BTCopya.gif", SVPlaygroundED$+"5"
                        		option set "BTAddBackground", "enabled", false
                        	//BUTTON 495,340 TO 515,395, "BTRemoveBackground", "x", SVPlaygroundED$+"5"
                        	BUTTON IMAGE 495,340, "BTRemoveBackground", BTFolder$+"/BTRemovea.gif", BTFolder$+"/BTRemovea.gif", BTFolder$+"/BTRemovea.gif", SVPlaygroundED$+"5"
                        		option set "BTRemoveBackground", "enabled", false
                        	//BUTTON 495,427 TO 515,645, "BTAddObject", ">", SVPlaygroundED$+"5"
                        	BUTTON IMAGE 495,427, "BTAddObject", BTFolder$+"/BTCopya.gif", BTFolder$+"/BTCopya.gif", BTFolder$+"/BTCopya.gif", SVPlaygroundED$+"5"
                        		option set "BTAddObject", "enabled", false
                        	//BUTTON 495,650 TO 515,700, "BTRemoveObject", "x", SVPlaygroundED$+"5"
                        	BUTTON IMAGE 495,645, "BTRemoveObject", BTFolder$+"/BTRemovea.gif", BTFolder$+"/BTRemovea.gif", BTFolder$+"/BTRemovea.gif", SVPlaygroundED$+"5"
                        		option set "BTRemoveObject", "enabled", false
                        	
                        	BUTTON 495,710 TO 515,730, "BTBackToEditor", "Back", SVPlaygroundED$+"5"
                                             	
                        	
                        	
           BOXVIEW 520,100 TO 995,395, "BVBackgroundsFolder", "Backgrounds", 3, SVPlaygroundED$+"5"
           	COLUMNBOX 5,5 TO 464,270, "CBBackgroundsFolder", 3, "resizable", "BVBackgroundsFolder"
           		COLUMNBOX COLUMN "CBBackgroundsFolder", "Icon", 1, 64, 64, 64, "align-center,"
                        	COLUMNBOX COLUMN "CBBackgroundsFolder", "Background", 2, 500, 190, 190, "align-left,"
           BOXVIEW 520,405 TO 995,700, "BVObjectsFolder", "Objects", 3, SVPlaygroundED$+"5"            
           	COLUMNBOX 5,5 TO 464,270, "CBObjectsFolder", 3, "resizable", "BVObjectsFolder"      
           		COLUMNBOX COLUMN "CBObjectsFolder", "Icon", 1, 64, 64, 64, "align-center,"
                        	COLUMNBOX COLUMN "CBObjectsFolder", "Object", 2, 500, 190, 190, "align-left," 
               	//***** SUB Folder *****
	ProgramStart=1
	BGFolder(ProgramStart)
	OBFolder(ProgramStart)
	SWFolder(ProgramStart)
       	//********************             	
           ReadFolderSystem()
           ReadFolderBackgrounds()
           ReadFolderObjects()
                        	
                        	
          option set "BTNewProject", "enabled", true
 	option set "BTLoadProject", "enabled", true           
 	  	
//Main Loop
dim part$(1)
dim mouse$(1)
inloop = true
while(inloop)
        //General Messages
        msg$ = message$
        if (split(msg$, part$(), ":|") > 2) then
                PartOne$=part$(1)
                PartTwo$ = part$(2)
                PartThree$ = part$(3)
        fi
        if (split(msg$, part$(), ":|") > 3) then
                PartFour$ = part$(4)
        fi
        if (split(msg$, part$(), ":|") > 4) then
                PartFife$ = part$(5)
        fi
        if (msg$ <> "") print msg$
        
        switch msg$
        		
        		case "playgroundED:_QuitRequested|"
                        WINDOW CLOSE "playgroundED"
                        break
        		
        		//Load Project
        		
        		case "BTLoadProject|"
        			STACKVIEW SET "VIUserMenu",2
        			break
        			
        		case "LBProjects:_Select:"+PartThree$+"|"
        			option set "BTOpenProject", "enabled", true
        			ProjectName$ = LISTBOX GET$ "LBProjects", val(PartThree$)
        			break	
        			
        		case "BTOpenProject|"
        			//if (VIEW GET "VIEditor", "Exists") then
			//	VIEW REMOVE "VIEditor"
			//endif
			DRAW FLUSH "VIEditor"
			//VIEW 0,0 to 665, 720, "VIEditor", "VIEd"
				//DRAW SET "BGColor", 0,0,0, "VIEditor"
			      //SCROLLBAR "SBEditor", 3, "VIEditor"
        			option set "BTOpenProject", "enabled", false
        			option set "BTBack", "enabled", false
        			//print ProjectName$
        			PlaygroundSize_Rows=1
        			PlaygroundSize_Cols=1
        			TileSize_x=0
        			TileSize_y=0
        			STACKVIEW SET "SVOpenProject",2
        			//print ProjectFolderTemp$+"/projects/"+ProjectName$+".zip"
        			Output$=System$("rm -r "+ProjectFolderTemp$)
        			Output$=system$("cd /; unzip "+ProjectFolder$+"/"+ProjectName$+".zip")
        				
        				readout=open(ProjectFolderTemp$+"/project.info", "r")
				x=0
				while (not EOF(readout))
					x=x+1
					dim DocumentText$(x)
					line input #readout b$
						DocumentText$(x)=b$
						if(left$(DocumentText$(x), 11)= "ProjectName")then
							//dtleng=len(DocumentText$(x))
							ProjectName$=right$(DocumentText$(x), len(DocumentText$(x))-12)
							//print ProjectName$
						endif
						STATUSBAR SET "SBOpenProject", "Loading project data...", "", 5
						if(left$(DocumentText$(x), 15)= "Playground_Rows")then
							//dtleng=len(DocumentText$(x))
							//print mid$(DocumentText$(x), 17)
							PlaygroundSize_Rows=val(mid$(DocumentText$(x), 17))
							//print PlaygroundSize_Rows
						endif
						STATUSBAR SET "SBOpenProject", "Loading project data...", "", 10
        						if(left$(DocumentText$(x), 15)= "Playground_Cols")then
							//dtleng=len(DocumentText$(x))
							PlaygroundSize_Cols=val(mid$(DocumentText$(x), 17))
							//print PlaygroundSize_Cols
							//print "---------------------------------------"
						endif
						STATUSBAR SET "SBOpenProject", "Loading project data...", "", 15
        						if(left$(DocumentText$(x), 9)= "TileSizeX")then
							//dtleng=len(DocumentText$(x))
							TileSize_x=val(right$(DocumentText$(x), len(DocumentText$(x))-10))
						endif
						STATUSBAR SET "SBOpenProject", "Loading project data", "", 20
						if(left$(DocumentText$(x), 9)= "TileSizeY")then
							//dtleng=len(DocumentText$(x))
							TileSize_y=val(right$(DocumentText$(x), len(DocumentText$(x))-10))
						endif
						STATUSBAR SET "SBOpenProject", "Loading project data...", "", 25
        					wend
					close(readout)
					
				first=0	
				BGFolder(first)
      					STATUSBAR SET "SBOpenProject", "Loading project data...", "", 35
				OBFolder(first)
                				STATUSBAR SET "SBOpenProject", "Generating playground...", "", 45
                			SWFolder(first)
        				
        				TestePlayGroundFile()
        				//LoadPlayGround()
        				PlayGround()
        				draw_playground()
        				//print "playground: "+Playground$(0,0)
        			wait 3
        			
        			STATUSBAR SET "SBOpenProject", "Ready", "", 100
        			wait 1
        			STACKVIEW SET SVPlaygroundED$,2	
        			STACKVIEW SET "SVOpenProject",1
        			option set "BTBack", "enabled", true
        			break	
        			
        		//Create Project	
        
        		case "BTNewProject|"
        			STACKVIEW SET "VIUserMenu",3
        				first=0
        				BGFolder(first)
      				OBFolder(first)
                			SWFolder(first)
        			break        			
        		
       		
        		case "BTCreateProject|"
        			Output$=System$("rm -r "+ProjectFolderTemp$)
        			Output$=System$("mkdir "+ProjectFolderTemp$)
        			Output$=System$("mkdir -p /boot/home/.besly/PlaygroundED/temp/backgrounds")
        			Output$=System$("mkdir -p /boot/home/.besly/PlaygroundED/temp/objects")
        			COLUMNBOX CLEAR "CBBG"
        			COLUMNBOX CLEAR "CBOB"
        			
        			PlaygroundSize_Rows = SPINCONTROL GET "SCPlaygroundSizeY"        			
        			PlaygroundSize_Cols = SPINCONTROL GET "SCPlaygroundSizeX"
        			
        			TileSize_x = SPINCONTROL GET "SCTileSizeX"
        			TileSize_y = SPINCONTROL GET "SCTileSizeY"        		
        				
        			//Result_x= VIEW GET "VIEditor", "Width"
        		//	Result_y= VIEW GET "VIEditor", "Height"
        		//	SCROLLBAR SET "SBEditor", "Horizontal Range", 0,(PlaygroundSize_Cols*TileSize_y)-Result_x
        		//	SCROLLBAR SET "SBEditor", "Vertical Range", 0,(PlaygroundSize_Rows*TileSize_x)-Result_y
        			
			DRAW FLUSH "VIEditor"
						
        			STACKVIEW SET "SVCreateProject",2
        			OPTION SET "SCPlaygroundSizeX", "Focus", true
        			OPTION SET "SCPlaygroundSizeY", "Focus", true
        			OPTION SET "SCTileSizeX", "Focus", true
        			OPTION SET "SCTileSizeY", "Focus", true
        			STATUSBAR SET "SBCreateProject", "Catching data...", "", 20
        		
        			ProjectName$=TEXTCONTROL GET$ "TCProjectName"
        			
         			STATUSBAR SET "SBCreateProject", "Catching data...", "", 40        			
        			
        			if(trim$(ProjectName$)="")then
        				STATUSBAR SET "SBCreateProject", "Error", "", 0
        				ALERT "You need to define a project name first!", "Ok", "warning"
        			else
        				STATUSBAR SET "SBCreateProject", "Generating playground...", "", 50
        				PlayGround()
                      		
                      		
                      		STATUSBAR SET "SBCreateProject", "Ready", "", 100
        				wait 1
        				STACKVIEW SET SVPlaygtoundED$,2
        			endif        	
        			STACKVIEW SET "SVCreateProject",1		
        			break        			
                        
                case "CBBG:_Select:"+PartThree$+"|"
                		//OPTION SET "TCInput", "Enabled", false
                	     OPTION SET "CBBG", "Focus", true
                	     SelectedObject=val(PartThree$)
                	     
                        if (TileSize_x =0 ) then
                        else
                              //ItemBG$ = COLUMNBOX GET$ "CBBG", 1, val(PartThree$)
                              // ItemBG$=mid$(ItemBG$, 10)
                              ItemBG$="BG"+str$(SelectedObject)
                                
                                BITMAP REMOVE "DrawBG"
                                //BITMAP REMOVE "DrawOB"
                                //BITMAP REMOVE "DrawSW"
                                
                                BITMAP TileSize_x, TileSize_y, "DrawBG"
       			    //BITMAP TileSize_x, TileSize_y, "DrawOB"
      	 		    //BITMAP TileSize_x, TileSize_y, "DrawSW"
      	 		                              
                                ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, BGFolder$+"/"+ItemBG$, "DrawBG"
                                SelectedCB$=PartOne$
                        endif
                        break
                        
                case "CBOB:_Select:"+PartThree$+"|"
                		//OPTION SET "TCInput", "Enabled", false
                	     OPTION SET "CBOB", "Focus", true
                	     SelectedObject=val(PartThree$)
                        if (TileSize_x =0 ) then
                        else
                        
                                //ItemOB$ = COLUMNBOX GET$ "CBOB", 1, val(PartThree$)
                                //ItemOB$=mid$(ItemOB$, 10)
                                ItemOB$="OB"+str$(SelectedObject)
                                //BITMAP REMOVE "DrawBG"
                                BITMAP REMOVE "DrawOB"
                                //BITMAP REMOVE "DrawSW"
                                
                                //BITMAP TileSize_x, TileSize_y, "DrawBG"
       			    BITMAP TileSize_x, TileSize_y, "DrawOB"
      	 		    //BITMAP TileSize_x, TileSize_y, "DrawSW"
                                
                                ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, OBFolder$+"/"+ItemOB$, "DrawOB"
                                SelectedCB$=PartOne$
                        endif                           
                        break                   
                   
                   case "CBSW:_Select:"+PartThree$+"|"
                   	//OPTION SET "TCInput", "Enabled", false
                	     	OPTION SET "CBSW", "Focus", true
                	    	SelectedObject=val(PartThree$)
                        	if (TileSize_x =0 ) then
                        	else
                        	 	//ItemSW$ = COLUMNBOX GET$ "CBSW", 1, val(PartThree$)
                            	//ItemSW$=mid$(ItemSW$, 10)
                            	ItemSW$="SW"+str$(SelectedObject)
                                
                            	//BITMAP REMOVE "DrawBG"
                            	//BITMAP REMOVE "DrawOB"
                            	BITMAP REMOVE "DrawSW"
                                
                            	//BITMAP TileSize_x, TileSize_y, "DrawBG"
       			    	//BITMAP TileSize_x, TileSize_y, "DrawOB"
      	 		    	BITMAP TileSize_x, TileSize_y, "DrawSW"
      	 		    
                                	ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, SWFolder$+"/"+ItemSW$, "DrawSW"
                                	SelectedCB$=PartOne$
                        	endif                           
                        	break    
                        
                   case "TCInput|"     
 		case "BTSetDescription|"
 			Description$= TEXTCONTROL GET$ "TCInput"
 			print Description$
 			if(SelectedCB$="CBBG")then
 			ReadFolderObjects()
 				ATTRIBUTE SET "String", "PGED:DESC", Description$, BGFolder$+"/"+ItemBG$
 				COLUMNBOX ADD "CBBG", 2, SelectedObject, 20, Description$
 			elseif(SelectedCB$="CBOB")then
 				ATTRIBUTE SET "String", "PGED:DESC", Description$, OBFolder$+"/"+ItemOB$
 				COLUMNBOX ADD "CBOB", 2, SelectedObject, 20, Description$
 			elseif(SelectedCB$="CBSW")then
 				ATTRIBUTE SET "String", "PGED:DESC", Description$, SWFolder$+"/"+ItemSW$
 				COLUMNBOX ADD "CBSW", 2, SelectedObject, 20, Description$
 			endif
 			OPTION SET "TCInput", "Enabled", false
 			OPTION SET "BTSetDescription", "Enabled", false
 			break      
 			
 			
 		case "BTSave|" 			
 			if(IfExists(ProjectFolder$+"/"+ProjectName$+".zip")) then
				Output$=System$("rm -r "+ProjectFolder$+"/"+ProjectName$+".zip")
			endif
			WriteProjectInfo()
 			WritePlaygroundInfo() 		
 			Output$=System$("zip -r9yu "+ProjectFolder$+"/"+ProjectName$+" "+ProjectFolderTemp$)
 			LoadProjects()
 			break     
 			
		case "BTExport|"
 			STACKVIEW SET SVPlaygroundED$,4		
 			break

 		case "BTBack|"
 			SelectedAlert = ALERT "Do you really want to leave this project?\nHave you saved the last stand?", "Cancel", "", "Ok", "warning"	
 			print SelectedAlert
 			wait 2
 			if(SelectedAlert=2)then
 				COLUMNBOX CLEAR "CBBackgroundsFolder"
				COLUMNBOX CLEAR "CBObjectsFolder"
 				STACKVIEW SET "VIUserMenu",1
 				STACKVIEW SET SVPlaygtoundED$,1
 			else
 			endif
 			break    
 		case "BTRefresh|"
 			ReadFolderSystem()
 		break	
 		//About
 		
 		case "BTAbout|"
 			OPTION SET "BTAbout", "Enabled", 0 
 			PreviewStack = STACKVIEW GET SVPlaygtoundED$
 			STACKVIEW SET SVPlaygtoundED$,3
 			break
 		case "BTClose|"
 			OPTION SET "BTAbout", "Enabled", 1  
 			STACKVIEW SET SVPlaygtoundED$,PreviewStack
 			break	
 		//Export	"BTAbout"

 			
 		case "CBPreviewPicture:"+PartTwo$+"|"
 			if(PartTwo$="ON")then
 				ExportPreviewImage=1
 			else
 				ExportPreviewImage=0
 			endif
 			break
 			
 		case "LBExport:_Select:"+PartThree$+"|"
 		case "LBExport:_Invoke:"+PartThree$+"|"
 			option set "BTExportPlayground", "enabled", true
 			option set "CBPreviewPicture", "enabled", true
  			if(PartThree$="1")then
  				Type$="BG"
  			elseif(PartThree$="2")then
  				Type$="BGOB"
  			elseif(PartThree$="3")then
  				Type$="BGSW"
  			elseif(PartThree$="4")then
  				Type$="BGOBSW"
  			elseif(PartThree$="5")then
  				Type$="OB"
  			elseif(PartThree$="6")then
  				Type$="OBSW"
  			elseif(PartThree$="7")then
  				Type$="SW"
  			endif
 			break
 		
 		case "BTExportPlayground|" 			
 			option set "BTExportPlayground", "enabled", false
 			option set "BTExportBack", "enabled", false
 			option set "CBPreviewPicture", "enabled", false
 			STACKVIEW SET "SVExportProject",2
 			if(ExportPreviewImage=1)then
 				playground_preview_export()
 			endif
 			PlaygroundExport()	
 			option set "BTExportBack", "enabled", true
 			STATUSBAR SET "SBExportProject", "Export project data...", "", 0
 			STACKVIEW SET "SVExportProject",1
 			break
 			
 		case "BTExportBack|"
 			STACKVIEW SET SVPlaygroundED$,2	
 			break
 		
 		//Tilesets
  		
        		case "BTTiles|"
        			STACKVIEW SET SVPlaygroundED$,5
        			break
        		
        		case "CBSystemFolder:_Select:"+PartThree$+"|"
        			option set "BTAddBackground", "enabled", true
                        	option set "BTRemoveBackground", "enabled", false
                        	option set "BTAddObject", "enabled", true
                        	option set "BTRemoveObject", "enabled", false
        			SystemFolderItem$ = COLUMNBOX GET$ "CBSystemFolder", 2, val(PartThree$)
        			break
        			
        			
        		case "CBSystemFolder:_Invoke:"+PartThree$+"|"
        			option set "BTAddBackground", "enabled", false
                        	option set "BTRemoveBackground", "enabled", false
                        	option set "BTAddObject", "enabled", false
                        	option set "BTRemoveObject", "enabled", false
        			SystemFolderItem$ = COLUMNBOX GET$ "CBSystemFolder", 2, val(PartThree$)
        			if(IfDirectory(CurrentFolderSystem$+"/"+SystemFolderItem$))then
        			
        			else
        				LAUNCH CurrentFolderSystem$+"/"+SystemFolderItem$
        			endif
        			break
        		
        		case "CBBackgroundsFolder:_Select:"+PartThree$+"|"
        			option set "BTAddBackground", "enabled", false
                        	option set "BTRemoveBackground", "enabled", true
                        	option set "BTAddObject", "enabled", false
                        	option set "BTRemoveObject", "enabled", false
        			break        		
        		
        		case "CBBackgroundsFolder:_Invoke:"+PartThree$+"|"
        			option set "BTAddBackground", "enabled", false
                        	option set "BTRemoveBackground", "enabled", false
                        	option set "BTAddObject", "enabled", false
                        	option set "BTRemoveObject", "enabled", false
        			BackgroundsFolderItem$ = COLUMNBOX GET$ "CBBackgroundsFolder", 2, val(PartThree$)
        			LAUNCH BGFolder$+"/"+BackgroundsFolderItem$
        			break
        		
        		case "CBObjectsFolder:_Select:"+PartThree$+"|"
        			option set "BTAddBackground", "enabled", false
                        	option set "BTRemoveBackground", "enabled", false
                        	option set "BTAddObject", "enabled", false
                        	option set "BTRemoveObject", "enabled", true
        			break        
        		
        		case "CBObjectsFolder:_Invoke:"+PartThree$+"|"
        			option set "BTAddBackground", "enabled", false
                        	option set "BTRemoveBackground", "enabled", false
                        	option set "BTAddObject", "enabled", false
                        	option set "BTRemoveObject", "enabled", false
        			ObjectsFolderItem$ = COLUMNBOX GET$ "CBObjectsFolder", 2, val(PartThree$)
        			LAUNCH  OBFolder$+"/"+ObjectsFolderItem$
        			break
        		
        		case "BTAddBackground|"
        			print "BG"
        			CBBackgroundCount = COLUMNBOX COUNT "CBBackgroundsFolder"
        			output$=system$("cp -r "+CurrentFolderSystem$+"/"+SystemFolderItem$+" "+BGFolder$+"/BG"+str$(CBBackgroundCount+1))
        			ATTRIBUTE SET "String", "PGED:DESC", "", BGFolder$+"/BG"+str$(CBBackgroundCount+1)
 			
 			ReadFolderBackgrounds()
        			break
        			
        		case "BTAddObject|"
        			print "OB"
        			CBObjectsCount = COLUMNBOX COUNT "CBObjectsFolder"
        			output$=system$("cp -r "+CurrentFolderSystem$+"/"+SystemFolderItem$+"  "+OBFolder$+"/OB"+str$(CBObjectsCount+1))
        			ATTRIBUTE SET "String", "PGED:DESC", "", OBFolder$+"/OB"+str$(CBObjectsCount+1)
        			ReadFolderObjects()
        			break
        			
        		case "BTRemoveBackground|"
        			BackgroundsFolderItem$ = COLUMNBOX GET$ "CBBackgroundsFolder", 2, val(PartThree$)
        			output$=system$("rm -r "+BGFolder$+"/"+BackgroundsFolderItem$)
        			ReadFolderBackgrounds()
        			break
        		
        		case "BTRemoveObject|"
        			ObjectssFolderItem$ = COLUMNBOX GET$ "CBObjectsFolder", 2, val(PartThree$)
        			output$=system$("rm -r  "+OBFolder$+"/"+ObjectssFolderItem$)
        			ReadFolderObjects()
        			break
        			
        		case "BTBackToEditor|"
                		first=0	
			BGFolder(first)
      			OBFolder(first)
      			first=1
        			STACKVIEW SET SVPlaygroundED$,2
        			break
                       
        default:
        break
        end switch
        
        wait 0.05
        
        mmsg$ = MOUSE MESSAGE$
        if (mmsg$<>"" and mmsg$<>old_mmsg$) then
                //print mmsg$
                old_mmsg$= mmsg$ 
                nx = split(mmsg$, mouse$(), ":")
                Viewname$=mouse$(1)
                Xmouse  = val(mouse$(2))
                Ymouse  = val(mouse$(3))
                BLmouse = val(mouse$(4))
                BCmouse= val(mouse$(5))
                BRmouse= val(mouse$(6))
	      Array_Col=int(Xmouse/TileSize_x)
                Array_Row=int(Ymouse/TileSize_y)
         endif
         if(Viewname$="CBBG" AND BRmouse=1 AND PartTwo$="_Select")then         		
         		OPTION SET "BGList", "Focus", true
         		PopUpSelected$=POPUPMENU Xmouse,Ymouse, "Add description|--|Edit description", "BGList"  
         		
         		if(PopUpSelected$="Edit description")then
         			AttributeInfo$ = ATTRIBUTE GET$ "PGED:DESC", BGFolder$+"/"+ItemBG$
         			TEXTCONTROL SET "TCInput", AttributeInfo$ 
         		else
         		       	TEXTCONTROL SET "TCInput", "Enter description"
         		endif
         		OPTION SET "TCInput", "Enabled", true
         		OPTION SET "BTSetDescription", "Enabled", true
         		
     
         	elseif(Viewname$="CBOB" AND BRmouse=1 AND PartTwo$="_Select")then   
         		OPTION SET "OBList", "Focus", true      		
         		PopUpSelected$=POPUPMENU Xmouse,Ymouse, "Add description|--|Edit description", "OBList"    
         		
         		if(PopUpSelected$="Edit description")then
         			AttributeInfo$ = ATTRIBUTE GET$ "PGED:DESC", OBFolder$+"/"+ItemOB$
         			TEXTCONTROL SET "TCInput", AttributeInfo$ 
         		else
         			TEXTCONTROL SET "TCInput", "Enter description"
         		endif
         		
         		OPTION SET "TCInput", "Enabled", true
         		OPTION SET "BTSetDescription", "Enabled", true
         	elseif(Viewname$="CBSW" AND BRmouse=1)then         		
         		OPTION SET "SWList", "Focus", true
         		PopUpSelected$=POPUPMENU Xmouse,Ymouse, "Add description|--|Edit description", "SWList"       	
         		
         		if(PopUpSelected$="Edit description")then
         			AttributeInfo$ = ATTRIBUTE GET$ "PGED:DESC", SWFolder$+"/"+ItemSW$
         			TEXTCONTROL SET "TCInput", AttributeInfo$ 
         		else
         			TEXTCONTROL SET "TCInput", "Enter description"
         		endif
         		
         		OPTION SET "TCInput", "Enabled", true	
         		OPTION SET "BTSetDescription", "Enabled", true
         endif
        if(Viewname$="VIEditor")then
          if( Array_Col>PlaygroundSize_Cols AND Array_Row>PlaygroundSize_Rows OR Array_Col>PlaygroundSize_Cols OR Array_Row>PlaygroundSize_Rows) then
                else
                if (BLmouse=1) then
                
                        //DRAW SET "highColor", 0,255,0, "VIEditor"
                        //DRAW SET false, "HighSolidFill"
                        //print (Array_x*TileSize_x)+1: print (Array_x*TileSize_x)+TileSize_x-2
                        //draw rect (Array_x*TileSize_x)+1,(Array_y*TileSize_y)+1 to (Array_x*TileSize_x)+TileSize_x-1,(Array_y*TileSize_y)+TileSize_y-1 ,"VIEditor"
                      
                      dim elements$(1)						//Hintergrund
                       if(SelectedCB$="CBBG")then
                        		if(Playground$(Array_Row,Array_Col)="")then
                        			Playground$(Array_Row,Array_Col)="BG"+str$(SelectedObject)+":OB0:SW0"
                        			//print Playground$(Array_Row,Array_Col)
                        			DRAW BITMAP (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-1,(Array_Row*TileSize_y)+TileSize_y-1,"DrawBG", "copy", "VIEditor"
                        		else
                        			//draw rect 0*x,0*y to TileSize_x*x,TileSize_y*y ,"VIEditor"
                        			count_entries=split(Playground$(Array_Row,Array_Col), elements$(), ":")
                        			//ItemBG$=elements$(1)		//Wird beim Selektieren bestimmt
                        			ItemOB$=elements$(2)
                        			ItemSW$=elements$(3)
                        			
               			
                        			//ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, BGFolder$+"/BG"+str$(SelectedObject), "DrawBG"
                        			 
                        			Playground$(Array_Row,Array_Col)="BG"+str$(SelectedObject)+":"+ItemOB$+":"+ItemSW$
                        			//print Playground$(Array_Row,Array_Col)
                        			DRAW BITMAP (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-1,(Array_Row*TileSize_y)+TileSize_y-1,"DrawBG", "alpha", "VIEditor"
                        			 
                        			 if(ItemOB$="OB0")then                        			 	
                        			 else
                        			 	//BITMAP REMOVE "DrawOB"
                        			 	//BITMAP TileSize_x, TileSize_y, "DrawOB"
                               			
                        			 	ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, OBFolder$+"/"+ItemOB$, "DrawOB"
                        			 	DRAW BITMAP (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-1,(Array_Row*TileSize_y)+TileSize_y-1, "DrawOB", "alpha", "VIEditor"
                        			 endif
                        			 
                        			 if(ItemSW$="SW0")then
                        			 else
                        			 	//BITMAP REMOVE "DrawSW"
                        			 	//BITMAP TileSize_x, TileSize_y, "DrawSW"
                        			 	
                        			 	ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, SWFolder$+"/"+ItemSW$, "DrawSW"
                        			 	DRAW BITMAP (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-20,(Array_Row*TileSize_y)+TileSize_y-20,"DrawSW", "alpha", "VIEditor"    
                        			 endif                         			  
                        		endif
                  	
                        elseif(SelectedCB$="CBOB")then            				//Objekt
                        		if(Playground$(Array_Row,Array_Col)="")then
                        			Playground$(Array_Row,Array_Col)="BG0:OB"+str$(SelectedObject)+":SW0"
                        			//print Playground$(Array_x,Array_y)
                        			DRAW BITMAP (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-1,(Array_Row*TileSize_y)+TileSize_y-1, "DrawOB", "alpha", "VIEditor"
                        		else
                        			//draw rect 0*x,0*y to TileSize_x*x,TileSize_y*y ,"VIEditor"
                        			count_entries=split(Playground$(Array_Row,Array_Col), elements$(), ":")
                        			//print "Count Entries:"+str$(count_entries)
                        			ItemBG$=elements$(1)
                        			//ItemOB$=elements$(2)			//Wird beim Selektieren bestimmt
                        			ItemSW$=elements$(3)
                        			
                        			
                        			if(ItemBG$="BG0")then
                        			//	 draw rect (Array_x*TileSize_x)+1,(Array_y*TileSize_y)+1 to (Array_x*TileSize_x)+TileSize_x-1,(Array_y*TileSize_y)+TileSize_y-1 ,"VIEditor"
                        			else
                        				//BITMAP REMOVE "DrawBG"
                        			 	//BITMAP TileSize_x, TileSize_y, "DrawBG"
                        				ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, BGFolder$+"/"+ItemBG$, "DrawBG"
                        				DRAW BITMAP (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-1,(Array_Row*TileSize_y)+TileSize_y-1, "DrawBG", "alpha", "VIEditor"
                        			endif
                        			
                        			DRAW BITMAP (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-1,(Array_Row*TileSize_y)+TileSize_y-1, "DrawOB", "alpha", "VIEditor"
                        			 
                        			 if(ItemSW$="SW0")then
                        			 else
                        			 	//BITMAP REMOVE "DrawSW"
                        			 	//BITMAP TileSize_x, TileSize_y, "DrawSW"
                        			 	
                        			 	ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, SWFolder$+"/"+ItemSW$, "DrawSW"
                        			 	DRAW BITMAP (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-20,(Array_Row*TileSize_y)+TileSize_y-20,"DrawSW", "alpha", "VIEditor"           
                        			 endif
                        			Playground$(Array_Row,Array_Col)=ItemBG$+":OB"+str$(SelectedObject)+":"+ItemSW$
                        			//print Playground$(Array_Row,Array_Col)                              			    			
                        		endif
                         elseif(SelectedCB$="CBSW")then            				//Schalter
                         	
                        		if(Playground$(Array_Row,Array_Col)="")then
                        			Playground$(Array_Row,Array_Col)="BG0:OB0:SW"+str$(SelectedObject)
                        			
                        			DRAW BITMAP (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-20,(Array_Row*TileSize_y)+TileSize_y-20,"DrawSW", "alpha", "VIEditor"
                        		else
                        			//draw rect 0*x,0*y to TileSize_x*x,TileSize_y*y ,"VIEditor"
                        			count_entries=split(Playground$(Array_Row,Array_Col), elements$(), ":")
                        			//print "Count Entries:"+str$(count_entries)
                        			ItemBG$=elements$(1)
                        			ItemOB$=elements$(2)
                        			//ItemSW$=elements$(3)		//Wird beim Selektieren bestimmt
                        			
                        			if(ItemBG$="BG0")then
                        				 //draw rect (Array_x*TileSize_x)+1,(Array_y*TileSize_y)+1 to (Array_x*TileSize_x)+TileSize_x-1,(Array_y*TileSize_y)+TileSize_y-1 ,"VIEditor"
                        			else
                        				//BITMAP REMOVE "DrawBG"
                        			 	//BITMAP TileSize_x, TileSize_y, "DrawBG"
                        			 	
                        				ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, BGFolder$+"/"+ItemBG$, "DrawBG"
                        				DRAW BITMAP (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-1,(Array_Row*TileSize_y)+TileSize_y-1, "DrawBG", "alpha", "VIEditor"
                        			endif
                        			
                        			if(ItemOB$="OB0")then
                        			else
                        				//BITMAP REMOVE "DrawOB"
                        			 	//BITMAP TileSize_x, TileSize_y, "DrawOB"                        			 	
                        				ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, OBFolder$+"/"+ItemOB$, "DrawOB"
                        				DRAW BITMAP (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-1,(Array_Row*TileSize_y)+TileSize_y-1, "DrawOB", "alpha", "VIEditor"
                        			endif
                        			 
                        			Playground$(Array_Row,Array_Col)=ItemBG$+":"+ItemOB$+":SW"+str$(SelectedObject)
                        			//print Playground$(Array_x,Array_y)    
                          			DRAW BITMAP (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-20,(Array_Row*TileSize_y)+TileSize_y-20, "DrawSW", "alpha", "VIEditor"                    			
                        		endif                   
                        endif                
                       
                endif
                if (BRmouse=1) then
                        DRAW SET "highColor", 0,0,0, "VIEditor"
                        DRAW SET false, "HighSolidFill"
                       // print "löschen"
                        //print (Array_x*TileSize_x)+1: print (Array_x*TileSize_x)-2
                        Playground$(Array_Row,Array_Col)=""
                        draw rect (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-1,(Array_Row*TileSize_y)+TileSize_y-1 ,"VIEditor"
                endif
                endif
        endif
        switch (casestring$)
                
        end switch

        
        if(window count<1) inloop = false
        sleep 0.05
wend
//******************* Spielfeld  ************************************
sub PlayGround()
 //******************* Spielfeldarray leeren ************************************
 	dim Playground$(PlaygroundSize_Rows,PlaygroundSize_Cols)
 	for x=0 to PlaygroundSize_Rows-1
		for y=0 to PlaygroundSize_Cols-1
			Playground$(PlaygroundSize_Rows,PlaygroundSize_Cols)=""
		next y
	next x
//******************* Loesche Spielfeld ************************************
	DRAW FLUSH "VIEditor"
//******************* Setze Farben neu und erstelle Grid ************************************
	DRAW SET "highColor", 255,0,0, "VIEditor"
         	DRAW SET true, "HighSolidFill"
         	print PlaygroundSize_Rows
	print	PlaygroundSize_Cols
         for x=1 to PlaygroundSize_Rows
		for y=1 to PlaygroundSize_Cols
			draw rect 0*y,0*x to TileSize_y*y,TileSize_x*x ,"VIEditor"
		next y
	next x
//******************* erstelle Scrollbar Spielfeld ************************************
	wait 1
 	STATUSBAR SET "SBOpenProject", "Generating playground...", "", 55
 	x=0
 	y=0
	ViewBreite=VIEW GET "VIEditor", "Width"
  	ViewHoehe=VIEW GET "VIEditor", "Height"
  	SCROLLBAR SET "SBEditor", "Horizontal Range", 0,(PlaygroundSize_Cols*TileSize_y)-ViewBreite
        	SCROLLBAR SET "SBEditor", "Vertical Range", 0,(PlaygroundSize_Rows*TileSize_x)-ViewHoehe
	PlaygroundSize_Rows = PlaygroundSize_Rows-1        
   	PlaygroundSize_Cols = PlaygroundSize_Cols-1             		
	STATUSBAR SET "SBOpenProject", "Generating playground...", "", 75
end sub
//******************* Zeichne Spielfeld  ************************************
sub draw_playground()
	local row,col
	col=0
	row=0
	//print "Playground: "+Playground$(0,0)
	for row=0 to PlaygroundSize_Rows //Male pro Reihe
		for col=0 to PlaygroundSize_Cols //Male pro Zeile
			BITMAP REMOVE "DrawBG"
			BITMAP REMOVE "DrawOB"
			BITMAP REMOVE "DrawSW"
			BITMAP TileSize_x, TileSize_y, "DrawBG"
			BITMAP TileSize_x, TileSize_y, "DrawOB"
 			BITMAP TileSize_x, TileSize_y, "DrawSW"
      	 		                              
      	 		//print left$(Playground$(row,col),3)                       
      	 		//print mid$(Playground$(row,col),5,3)
      	 		//print mid$(Playground$(row,col),9,3)      
      	 		
		         ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, BGFolder$+"/"+left$(Playground$(row,col),3), "DrawBG"
			ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, OBFolder$+"/"+mid$(Playground$(row,col),5,3), "DrawOB"
			ErrCode = DRAW IMAGE 0,0 to  TileSize_x-20, TileSize_y-20, SWFolder$+"/"+mid$(Playground$(row,col),9,3),"DrawSW"
			//print col*TileSize_x
			DRAW BITMAP (col*TileSize_x),(row*TileSize_y) to (col*TileSize_x)+TileSize_x,(row*TileSize_y)+TileSize_y, "DrawBG", "alpha", "VIEditor"   //Spalte, dann Reihe
			DRAW BITMAP (col*TileSize_x),(row*TileSize_y) to (col*TileSize_x)+TileSize_x,(row*TileSize_y)+TileSize_y, "DrawOB", "alpha", "VIEditor"  //Spalte, dann Reihe
			DRAW BITMAP (col*TileSize_x),(row*TileSize_y) to (col*TileSize_x)+TileSize_x,(row*TileSize_y)+TileSize_y, "DrawSW", "alpha", "VIEditor"  //Spalte, dann Reihe     
			//print str$(col*TileSize_x)+","+str$(row*TileSize_y) +" to "+ str$(((col*TileSize_x)+TileSize_x))+","+str$(((row*TileSize_y)+TileSize_y))+" : "+Playground$(row,col)+" :"+str$(row)+":"+str$(col)
       		next col
       		col=0
       	next row
       
end sub
//******************* Projekte laden  ************************************
sub LoadProjects()
	LISTBOX CLEAR "LBProjects"
	Projects$=system$("ls -G -1 "+ProjectFolder$)
      	dim SplitDirProjects$(1) 
         		files = split(Projects$, SplitDirProjects$(), "\n")            
         		for pjf = 1 to files-1
         			projectnamelen=len(SplitDirProjects$(pjf))
         			LISTBOX ADD "LBProjects", left$(SplitDirProjects$(pjf), projectnamelen-4) 
         		next pjf
end sub    
//******************* Ueberpruefe Spielfeld auf Inhalt groesser 0  ************************************
sub TestePlayGroundFile()
	Result$=trim$(system$("stat -c %s "+ProjectFolderTemp$+"/playground.info"))
	if (Result$="0") then		
		Alert "The playground file is empty. Please generate a new one.", "Ok", "STOP"
		STACKVIEW SET "VIUserMenu",1
 		STACKVIEW SET SVPlaygtoundED$,1 		
	else	
		LoadPlayGround()
	endif
end sub

//******************* Lade Spielfeld  ************************************
sub LoadPlayGround()
	local playground_info_entry$
	local row,col, numElements
	playground_info_entry$=""
	numElements=0

	//readout=open(ProjectFolderTemp$+"/playground.info", "r")
	//while (not EOF(readout))		
	//	line input #readout playground_info_entry$
	//	redim file_rows$(1)
	//	redim elements$(1)
	//
	//	quantity_token=len(playground_info_entry$)
	//	numElements_rows = split(playground_info_entry$, file_rows$(),"\n")
		
	//	if (numElements_rows=1) then
	//		file_row=file_row+1
	//		print 	file_row
	//	endif				
	//	numElements = split(left$(playground_info_entry$,len(playground_info_entry$)-1), elements$(),"|")
	//	if (numElements>=1) then
	//		file_cols=file_cols+1	
				
	//	endif		
	//wend
	//close(readout)	
	//print "file_row:"+str$(file_row)
	//print "file_cols:"+str$(file_cols)
	//print	 "-rows-"+str$(PlaygroundSize_Rows)
	//print	 "-cols-"+str$(PlaygroundSize_Cols)
	dim Playground$(PlaygroundSize_Rows,PlaygroundSize_Cols)
	readoutA=open(ProjectFolderTemp$+"/playground.info", "r")	
	col=0
	row=0
	while (not EOF(readoutA))
		dim elements$(1)
		line input #readout playground_info_entry$
		
		numElements = split(left$(playground_info_entry$,len(playground_info_entry$)-1), elements$(),"|")
		print numElements
		if (numElements=0) then
		else
			for cols =1 to numElements
				//if (cols<numElements+1) then					
					Playground$(row,col) = elements$(cols)
					print "Playground: "+str$(row)+":"+str$(col)+":"+elements$(cols) //Playground$(row,col)
					col=col+1
				//else					
				//endif
			next cols	
			col=0
		row=row+1				
		endif
	wend
	close(readoutA)	
end sub

//******************* Schreibe Projekt File  ************************************
sub WriteProjectInfo()
	writefile = open(ProjectFolderTemp$+"/project.info", "w") 		
 	
 	print #writefile "ProjectName:"+ProjectName$	
 	print #writefile "Playground_Rows:"+str$(PlaygroundSize_Rows+1)		// +1 da der Array mit 0 beginnt
 	print #writefile "Playground_Cols:"+str$(PlaygroundSize_Cols+1)		// +1 da der Array mit 0 beginnt
 	print #writefile "TileSizeX:"+str$(TileSize_x)
 	print #writefile "TileSizeY:"+str$(TileSize_y)
 				
 	CountCBBG = COLUMNBOX COUNT "CBBG"
 	i=0
 	for i = 1 to CountCBBG
 		CBBGItem$ = COLUMNBOX GET$ "CBBG", 2, i
 		print #writefile "BG"+str$(i)+":"+CBBGItem$
 	next i
 	CountCBOB = COLUMNBOX COUNT "CBOB"
 	i=0
 	for i = 1 to CountCBOB
 		CBOBItem$ = COLUMNBOX GET$ "CBOB", 2, i
 		print #writefile "OB"+str$(i)+":"+CBOBItem$
 	next i
 	CountCBSW = COLUMNBOX COUNT "CBSW"
 	i=0
 	for i = 1 to CountCBSW
 		CBSWItem$ = COLUMNBOX GET$ "CBSW", 2, i
 		print #writefile "SW"+str$(i)+":"+CBSWItem$
 	next i
	close(writefile)
end sub
//******************* Schreibe Spielfeld ************************************
sub WritePlaygroundInfo()			
	//print PlaygroundSize_Rows
	//print PlaygroundSize_Cols
	//write playground field text file
	writefile = open(ProjectFolderTemp$+"/playground.info", "w")
	i=0
	run_x=0
	run_y=0
	LineEntries$=""
	//print "PlaygroundSize_Rows:"+str$(PlaygroundSize_Rows)
	//print "PlaygroundSize_Cols:"+str$(PlaygroundSize_Cols)
	for reihe = 0 to PlaygroundSize_Rows
		for spalte = 0 to PlaygroundSize_Cols
			if(Playground$(reihe,spalte)="")then
				LineEntries$=LineEntries$+"BG0:OB0:SW0|"
			else
				LineEntries$=LineEntries$+Playground$(reihe,spalte)+"|"
			endif			
		next spalte
		spalte=0
		print #writefile trim$(LineEntries$)
		//print LineEntries$
		LineEntries$=""
	next reihe
	close(writefile)
end sub
//******************* Spielfeld Export  ************************************
sub PlaygroundExport()			
	STATUSBAR SET "SBExportProject", "Export project data...", "", 10
	//write playground field text file	
	writefile = open(ProjectExport$+"/"+ProjectName$+"_"+Type$, "w")
	i=0
	run_x=0
	run_y=0
	LineEntries$=""
	STATUSBAR SET "SBExportProject", "Export project data...", "", 20	
	
	for reihe = 0 to PlaygroundSize_Rows
		for spalte = 0 to PlaygroundSize_Cols
			if(Playground$(run_x,spalte)="")then
				LineEntries$=LineEntries$+"BG0:OB0:SW0|"
			else
				if (Type$="BG") then
					LineEntries$=LineEntries$+mid$(Playground$(reihe,spalte),0,instr(Playground$(reihe,spalte),":"))+"|"				
				elseif (Type$="BGOB") then
					LineEntries$=LineEntries$+mid$(Playground$(reihe,spalte),0,instr(Playground$(reihe,spalte),":",instr(Playground$(reihe,spalte),":")+1))+"|"
				elseif (Type$="BGSW") then
					LineEntries$=LineEntries$+mid$(Playground$(reihe,spalte),0,instr(Playground$(reihe,spalte),":"))+":"+mid$(Playground$(reihe,spalte),rinstr(Playground$(reihe,spalte),":")+1)+"|"
				elseif (Type$="OB") then
					LineEntries$=LineEntries$+mid$(Playground$(reihe,spalte),instr(Playground$(reihe,spalte),":")+1,instr(Playground$(reihe,spalte),":")-1)+"|"
				elseif (Type$="OBSW") then
					LineEntries$=LineEntries$+mid$(Playground$(reihe,spalte),instr(Playground$(reihe,spalte),":")+1)+"|"
				elseif (Type$="SW") then
					LineEntries$=LineEntries$+mid$(Playground$(reihe,spalte),rinstr(Playground$(reihe,spalte),":")+1)+"|"
				elseif (Type$="BGOBSW") then
					LineEntries$=LineEntries$+Playground$(reihe,spalte)+"|"
				endif
			endif
			STATUSBAR SET "SBExportProject", "Export project data...", "", 70	
		next spalte
		spalte=0
		print #writefile trim$(LineEntries$)
		//print LineEntries$
		LineEntries$=""
	next reihe			
	
	STATUSBAR SET "SBExportProject", "Export project data...", "", 100	
	close(writefile)
end sub
//******************* Spielfeld Export als Bild  ************************************
sub playground_preview_export()		
	STATUSBAR SET "SBExportProject", "Export preview image...", "", 10
	if (VIEW GET "ExportCanvas", "Exists") then
		View Remove "ExportCanvas"		
	endif
		view 0,0 to  ((PlaygroundSize_Cols+1)*TileSize_x), ((PlaygroundSize_Rows+1)*TileSize_y), "ExportCanvas", SVPlaygtoundED$+"3"
	
		H_Canvas=(VIEW GET "ExportCanvas", "Height")+1
		B_Canvas=(VIEW GET "ExportCanvas", "Width")+1
	//CANVAS 0,0 to ((PlaygroundSize_x+1)*TileSize_x), ((PlaygroundSize_y+1)*TileSize_y), "ExportBitmap","ExportCanvas"	
	STATUSBAR SET "SBExportProject", "Export preview image...", "", 20
	CANVAS 0,0 to B_Canvas,H_Canvas, "ExportBitmap","ExportCanvas"	
		//DRAW SET "BGColor", 40,40,40, "ExportCanvas"
		DRAW SET "lowColor", 0,0,0, "ExportBitmap"
		DRAW SET false, "lowSolidFill"
		DRAW RECT 0,0 to ((PlaygroundSize_Cols+1)*TileSize_x)+50, ((PlaygroundSize_Rows+1)*TileSize_y)+50, "ExportBitmap"
		DRAW SET "HighColor", 255,0,0, "ExportBitmap"
		DRAW SET true, "HighSolidFill"
         		STATUSBAR SET "SBExportProject", "Export preview image...", "", 30
         		for x=0 to PlaygroundSize_Rows+1
			for y=0 to PlaygroundSize_Cols+1
				draw rect 0*y,0*x to TileSize_y*y,TileSize_x*x ,"ExportBitmap"
			next y
		next x
		STATUSBAR SET "SBExportProject", "Export preview image...", "", 50
		for row=0 to PlaygroundSize_Rows
			for col=0 to PlaygroundSize_Cols
				BITMAP REMOVE "DrawBG"
				BITMAP REMOVE "DrawOB"
				BITMAP REMOVE "DrawSW"
				BITMAP TileSize_x, TileSize_y, "DrawBG"
				BITMAP TileSize_x, TileSize_y, "DrawOB"
 				BITMAP TileSize_x, TileSize_y, "DrawSW"      	 		                              
      	 			ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, BGFolder$+"/"+left$(Playground$(row,col),3), "DrawBG"
				ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, OBFolder$+"/"+mid$(Playground$(row,col),5,3), "DrawOB"
				ErrCode = DRAW IMAGE 0,0 to  TileSize_x-20, TileSize_y-20, SWFolder$+"/"+mid$(Playground$(row,col),9,3),"DrawSW"
				DRAW BITMAP (col*TileSize_x)-1,(row*TileSize_y)-1 to (col*TileSize_x)+(TileSize_x)-1,(row*TileSize_y)+(TileSize_y)-1, "DrawBG", "alpha", "ExportBitmap"   
				DRAW BITMAP (col*TileSize_x)-1,(row*TileSize_y)-1 to (col*TileSize_x)+(TileSize_x)-1,(row*TileSize_y)+(TileSize_y)-1, "DrawOB", "alpha", "ExportBitmap"  
				DRAW BITMAP (col*TileSize_x)-1,(row*TileSize_y)-1 to (col*TileSize_x)+(TileSize_x)-1,(row*TileSize_y)+(TileSize_y)-1, "DrawSW", "alpha", "ExportBitmap"    
			next col
			col=0
		next row
		STATUSBAR SET "SBExportProject", "Export preview image...", "", 70
		Hoehe_Canvas=(VIEW GET "ExportBitmap", "Height")
		Breite_Canvas=(VIEW GET "ExportBitmap", "Width")
		//BITMAP GET 0, 0 to Breite_Canvas,Hoehe_Canvas, "Target_bitmap", "ExportBitmap"
		//ErrCode = BITMAP SAVE "Target_bitmap",ProjectExport$+"/"+ProjectName$+".jpg",".jpg"
		BITMAP GET 0, 0 to Breite_Canvas,Hoehe_Canvas, "Target_bitmap", "ExportBitmap"
		ErrCode = BITMAP SAVE "Target_bitmap",ProjectExport$+"/"+ProjectName$+"_Preview.png",".png"
		//BITMAP GET 0, 0 to Breite_Canvas,Hoehe_Canvas, "Target_bitmap", "ExportBitmap"
		//ErrCode = BITMAP SAVE "Target_bitmap",ProjectExport$+"/"+ProjectName$+"_Preview.bmp",".bmp"
		STATUSBAR SET "SBExportProject", "Export preview image...", "", 100
end sub
//******************* Columnboxen erstellen ************************************    
//******************* Background auslesen   ************************************           
sub BGFolder(first)
	if (first=1) then
	else
		COLUMNBOX CLEAR "CBBG"
	endif	
	Files$=system$("ls -G -1 "+BGFolder$)
        	dim SplitDirObjects$(1) 
		files = split(Files$, SplitDirObjects$(), "\n")            
                	for ibg = 1 to files-1
                   	objectlen=len(SplitDirObjects$(ibg))
                   	COLUMNBOX ADD "CBBG", 1, ibg, 32, "__Icon__="+BGFolder$+"/"+SplitDirObjects$(ibg)
                       	AttributeInfo$ = ATTRIBUTE GET$ "PGED:DESC",  BGFolder$+"/"+SplitDirObjects$(ibg)		//This attribute must be included the files by adding into the program
                       	if(AttributeInfo$="")then
                       		print "no entrie"
                       	else
                            	COLUMNBOX ADD "CBBG", 2, ibg, 32, AttributeInfo$
                       	endif                        
                	next ibg
end sub
//******************* Objectfolder auslesen   ************************************     
sub OBFolder(first)
	if (first=1) then
	else
		COLUMNBOX CLEAR "CBOB"
	endif	
	Files$=system$("ls -G -1 "+OBFolder$)
	dim SplitDirObjects$(1) 
		files = split(Files$, SplitDirObjects$(), "\n")            
         		for iob = 1 to files-1
			objectlen=len(SplitDirObjects$(iob))
			COLUMNBOX ADD "CBOB", 1, iob, 32, "__Icon__="+OBFolder$+"/"+SplitDirObjects$(iob)
			AttributeInfo$ = ATTRIBUTE GET$ "PGED:DESC", OBFolder$+"/"+SplitDirObjects$(iob)		//This attribute must be included the files by adding into the program
			COLUMNBOX ADD "CBOB", 2, iob, 32, AttributeInfo$   
                	next iob
end sub
//******************* Switchfolder auslesen   ************************************     
sub SWFolder(first)
	if (first=1) then
	else
		COLUMNBOX CLEAR "CBSW"
	endif	
	Files$=system$("ls -G -1 "+SWFolder$+"/")
       	dim SplitDirObjects$(1) 
		files = split(Files$, SplitDirObjects$(), "\n")            
               	for isw = 1 to files-1
                        	objectlen=len(SplitDirObjects$(isw))
                        	COLUMNBOX ADD "CBSW", 1, isw, 20, "__Icon__="+SWFolder$+"/"+SplitDirObjects$(isw)
                        	//AttributeInfo$ = ATTRIBUTE GET$ "PGED:DESC", SWFolder$+"/"+SplitDirObjects$(isw)	//This attribute must be included the files by adding into the program
 			COLUMNBOX ADD "CBSW", 2, isw, 32, AttributeInfo$   
                	next isw
end sub      
//******************* TILES  ************************************	
//******************* Background Folder auslesen  ************************************	
sub ReadFolderBackgrounds()
	COLUMNBOX CLEAR "CBBackgroundsFolder"
	ReadFolderBackgrounds$=system$("ls -GH -1 "+BGFolder$)
         CurrentFolderBackgrounds$=BGFolder$
				
	dim ReadBackroundsFolder$(1)
		files = split(ReadFolderBackgrounds$, ReadBackroundsFolder$(), "\n")
		i=0
		x=1
		for i = 1 to files-1
			COLUMNBOX ADD "CBBackgroundsFolder", 1, x, 40, "__Path__="+CurrentFolderBackgrounds$+"/"+ReadBackroundsFolder$(i)
			COLUMNBOX ADD "CBBackgroundsFolder", 2, x, 40, ReadBackroundsFolder$(i)
			x=x+1
		next i     	
end sub
//******************* Object Folder auslesen  ************************************
sub ReadFolderObjects()
	COLUMNBOX CLEAR "CBObjectsFolder"
	ReadFolderObjects$=system$("ls -GH -1 "+OBFolder$)
         CurrentFolderObjects$=OBFolder$
		
	dim ReadFolderObjects$(1)
		files = split(ReadFolderObjects$, ReadFolderObjects$(), "\n")
		i=0
		x=1
		for i = 1 to files-1
			COLUMNBOX ADD "CBObjectsFolder", 1, x, 40, "__Path__="+CurrentFolderObjects$+"/"+ReadFolderObjects$(i)
			COLUMNBOX ADD "CBObjectsFolder", 2, x, 40, ReadFolderObjects$(i)
			x=x+1
		next i     
end sub
//******************* System Folder auslesen  ************************************
sub ReadFolderSystem()
	COLUMNBOX CLEAR "CBSystemFolder"
	  CurrentFolderSystem$="/boot/home"
	ReadFolderSystem$=system$("ls -GH -1 "+ CurrentFolderSystem$)	
	dim ReadSystemFolder$(1)
		files = split(ReadFolderSystem$, ReadSystemFolder$(), "\n")
		i=0
		x=1
		for i = 1 to files-1
			if(right$(ReadSystemFolder$(i), 3)="bmp" or right$(ReadSystemFolder$(i), 3)="gif" or right$(ReadSystemFolder$(i), 3)="jpg" or right$(ReadSystemFolder$(i), 3)="png" or right$(ReadSystemFolder$(i), 4)="jpeg" or right$(ReadSystemFolder$(i), 4)="tiff")then
				COLUMNBOX ADD "CBSystemFolder", 1, x, 40, "__Path__="+CurrentFolderSystem$+"/"+ReadSystemFolder$(i)
				COLUMNBOX ADD "CBSystemFolder", 2, x, 40, ReadSystemFolder$(i)
				x=x+1
			endif
			if(IfDirectory(CurrentFolderSystem$+"/"+ReadSystemFolder$(i)))then
				COLUMNBOX ADD "CBSystemFolder", 1, x, 40, "__Path__="+CurrentFolderSystem$+"/"+ReadSystemFolder$(i)
				COLUMNBOX ADD "CBSystemFolder", 2, x, 40, ReadSystemFolder$(i)
				x=x+1
			endif
		next i     	
end sub
//******************* teste Verzeichnis  ************************************
sub IfDirectory(filename$)
	return not system("test -d "+filename$)
end sub
//******************* teste Dateien  ************************************
//Check if a file or folder already exisits
sub IfExists(filename$)
	return not system("test -e "+filename$)
end sub     
//******************* About  ************************************
sub About()
	View 0,0 to width_window,height_window, "View_About", SVPlaygroundED$+"3"
	
  	DRAW TEXT 10,30, "BeSly Software Solutions", "View_About"
  	DRAW LINE 0,40 TO View_breite_box,41, "View_About" 
  	 	  	
  	DRAW TEXT 10,60, "Name:", "View_About"
  	DRAW TEXT 10,80, "Version / Build:", "View_About"
  	DRAW TEXT 10,100, "Version Status:", "View_About"
  	DRAW TEXT 10,120, "Developers:", "View_About"  
  	DRAW TEXT 10,140, "Contact:", "View_About"
  	DRAW TEXT 10,160, "Website:", "View_About"
  	DRAW TEXT 10,180, "Bug-Reporting:", "View_About"	
   	
   	DRAW TEXT 150,60, ProgrammName$, "View_About"
  	DRAW TEXT 150,80, "0.0.1/ 24.12.2019", "View_About"
  	DRAW TEXT 150,100, "Alpha", "View_About"
  	DRAW TEXT 150,120, "Lorglas / Lelldorin", "View_About"
  	DRAW SET "system-plain,regular,16,regular,0,45" ,"View_About"
  	TEXTURL 150,130, "email", "webmaster@besly.de", "webmaster@besly.de", "View_About"  	
  	TEXTURL 150,150, "website", "http://software.besly.de", "http://software.besly.de", "View_About"   	
  	//TEXTURL 150,167, "Bug-Report", "http://trac.besly.de", "http://trac.besly.de", "View_About" 
  	
  	TEXTEDIT 10,220 TO width_window-10, height_window-100, "not_implemented", 0, "View_About"
  	TEXTEDIT SET "not_implemented", "bold", "12"
  	textedit add "not_implemented", "New in this Revision:\n"
  	TEXTEDIT SET "not_implemented", "plain", "12"
  	textedit add "not_implemented", "None\n"
  		//textedit add "not_implemented", "New in this Revision:\n"
  	TEXTEDIT SET "not_implemented", "editable", false
	button HBPF-50, height_window-60 to HBPF+50, height_window-10, "BTClose", "Close",  "View_About"	
end sub