CODICE
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
Dim $Caratteri_da_Eliminare[63] = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "\", "|", "!", '"', "£", "$", "%", "&", "/", "(", ")", "=", "'", "?", "ì", "^", "*", "+", "è", "é", "[", "]", "ò", "ç", "@", "à", "°", "#", "ù", "§", "_", ",", ";", ":", "<", ">", " "]
$nome=""
$nomeprvd=@desktopdir&"\"
$indirizzo=""
$title="(Senza Titolo) - 3Designer v 1.0.0"
GUICreate("(Senza Titolo) - 3Designer v 1.0.0", 785, 565, 320, 284)
GuiSetIcon(@ScriptDir & "\icona.ico", 0)
$file=GUICtrlCreateMenu("File")
$help=GUICtrlCreateMenu("Help")
$file1=GUICtrlCreateMenuitem("New",$file)
$file2=GUICtrlCreateMenuitem("Open...",$file)
$file3=GUICtrlCreateMenuitem("Close",$file)
$file4=GUICtrlCreateMenuitem("Save",$file)
$file5=GUICtrlCreateMenuitem("Save As...",$file)
$file6=GUICtrlCreateMenuitem("Sava A Copy...",$file)
$help3=GUICtrlCreateMenuitem("About",$help)
GUICtrlCreateSlider(250, 510, 150, 29)
GUICtrlCreateSlider(5, 180, 29, 150,$TBS_VERT)
global $Graphic1 = GUICtrlCreateGraphic(50, 5, 550, 500)
GUICtrlSetBkColor(-1, 0xA6CAF0)
global $Button1 = GUICtrlCreateButton("Genera", 656, 504, 75, 25, 0)
global $edit1 = GUICtrlCreateEdit("", 616, 32, 161, 465)
GUISetState()
hotkeyset("{esc}","end")
hotkeyset("^n","new")
hotkeyset("^o","open")
hotkeyset("^w","close")
hotkeyset("^s","save")
hotkeyset("^+s","saveas")
hotkeyset("^+p","savecopy")
While 1
global $nMsg = GUIGetMsg()
Switch $nMsg
Case -3
end()
Case $Button1
Global $cordn=guictrlread($Edit1)
Global $coordn=$cordn
#Region ---Eliminazione commenti---
For $i = 0 To UBound ($Caratteri_da_Eliminare) - 1
$coordn = StringReplace ($coordn, $Caratteri_da_Eliminare[$i], "")
Next
$coordn = StringReplace ($coordn, @CRLF & "" & @CRLF, @CRLF)
#EndRegion
GUICtrlDelete($Graphic1)
Global $Graphic1 = GUICtrlCreateGraphic(50, 5, 550, 500)
GUICtrlSetBkColor(-1, 0xA6CAF0)
While $coordn <> ""
$1x=StringLeft($coordn,3)
$coordn=StringTrimLeft($coordn,4)
$1y=StringLeft($coordn,3)/2
$coordn=StringTrimLeft($coordn,4)
$1z=StringLeft($coordn,3)
$coordn=StringTrimLeft($coordn,4)
$2x=StringLeft($coordn,3)
$coordn=StringTrimLeft($coordn,4)
$2y=StringLeft($coordn,3)/2
$coordn=StringTrimLeft($coordn,4)
$2z=StringLeft($coordn,3)
$coordn=StringTrimLeft($coordn,3)
if $coordn<>"" then $coordn=StringTrimLeft($coordn,2)
$x1=225+$1x+Round(Sqrt($1y*$1y/2))
$y1=300-$1z+Round(Sqrt($1y*$1y/2))
$x2=225+$2x+Round(Sqrt($2y*$2y/2))
$y2=300-$2z+Round(Sqrt($2y*$2y/2))
GUICtrlSetGraphic($Graphic1, $GUI_GR_MOVE, $x1, $y1)
GUICtrlSetGraphic($Graphic1, $GUI_GR_LINE, $x2, $y2)
wend
GUICtrlSetGraphic($Graphic1,$GUI_GR_REFRESH)
Case $file1
new()
case $file2
open()
Case $file3
close()
case $file4
save()
Case $file5
saveas()
case $file6
savecopy()
Case $help3
msgbox(0,"About","3Designer® ©2010"&@crlf&"Questo programma è stato creato da erma96,"&@crlf&" Ed è protetto da una licenza Creative Commons ©"&@cRlf&"Tu puoi modificare questo file solo con il permesso di erma96.")
EndSwitch
WEnd
func end()
exit
EndFunc
func new()
$MSGBOX=msgbox(4,"Attenzione!","Se inizi un nuovo progetto, Perderai i dati non salvati."&@crlf&" Vuoi continuare?")
If $MSGBOX=6 Then
GUICtrlSetData($edit1,"120")
WinSetTitle ( $title, "", "(Senza Titolo) - 3Designer v 1.0.0" )
$title="(Senza Titolo) - 3Designer v 1.0.0"
endif
EndFunc
func open()
$MSGBOX=msgbox(4,"Attenzione!","Se apri un altro progetto, perderai i dati non salvati."&@crlf&" Vuoi continuare?")
If $MSGBOX=6 Then
$indirizzo = FileOpenDialog("Apri File", @desktopDir & "\", "3Designer Files (*.ige)", 1+2 )
if @error then
else
GUICtrlSetData($edit1,fileread($indirizzo))
WinSetTitle ( $title, "", $indirizzo&" - 3Designer v 1.0.0" )
$title=$indirizzo&" - 3Designer v 1.0.0"
$nomeprvd=$indirizzo
while stringright($nomeprvd,1)<>"\"
$nome=stringright($nomeprvd,1)&$nome
$nomeprvd=StringTrimRight($nomeprvd,1)
wend
endif
endif
EndFunc
func close()
$MSGBOX=msgbox(4,"Attenzione!","Se chiudi il progetto, perderai i dati non salvati."&@crlf&" Vuoi continuare?")
If $MSGBOX=6 Then
GUICtrlSetData($edit1,"")
endif
EndFunc
func save()
if $indirizzo="" Then
saveas()
Else
FileDelete ($indirizzo)
filewrite($indirizzo,GUICtrlRead($edit1))
msgbox(0,"Salvato!","Il file è stato salvato!")
endif
EndFunc
func saveas()
$indirizzo=FileSaveDialog("Salva File",$nomeprvd,"3Designer Files (*.ige)",2,$nome)
if @error then
else
If stringright($indirizzo,4)<>".ige" then $indirizzo=$indirizzo&".ige"
if Fileexists($indirizzo)=1 then
$MSGBOX=msgbox(4,"Attenzione!","Il file esiste già, vuoi sovrascriverlo?")
If $MSGBOX=6 Then FileDelete ($indirizzo)
endif
filewrite($indirizzo,GUICtrlRead($edit1))
msgbox(0,"Salvato!","Il file è stato salvato!")
WinSetTitle ( $title, "", $indirizzo&" - 3Designer v 1.0.0" )
$nomeprvd=$indirizzo
$title=$indirizzo&" - 3Designer v 1.0.0"
while stringright($nomeprvd,1)<>"\"
$nome=stringright($nomeprvd,1)&$nome
$nomeprvd=StringTrimRight($nomeprvd,1)
wend
endif
EndFunc
func savecopy()
if $indirizzo="" Then
saveas()
Else
$indirizzo2=FileSaveDialog("Salva copia",$nomeprvd,"",2,$nome)
if @error then
else
If stringright($indirizzo2,4)<>".ige" then $indirizzo2=$indirizzo2&".ige"
if Fileexists($indirizzo2)=1 then
$MSGBOX=msgbox(4,"Attenzione!","Il file esiste già, vuoi sovrascriverlo?")
If $MSGBOX=6 Then
FileDelete ($indirizzo2)
filewrite($indirizzo2,GUICtrlRead($edit1))
msgbox(0,"Salvato!","La copia è stata salvata!")
endif
endif
endif
ENDIF
EndFunc