Microsoft Small Basic

Program Listing: PXL193
author="SINE Soft"
version="2.4"
progversion="2.4.0"
SGSFversion="C1"
GraphicsWindow.CanResize="false"
GraphicsWindow.Title="SINE Soft Graphic Studio "+version
GraphicsWindow.Width=640
GraphicsWindow.Height=480
GraphicsWindow.DrawText(10,10," initialising ... ")

'default data:
shape="SQUARE"
color="Blue"
size=5
delay=0
topacity=2
tdirection="LR"
verifcolor="#010203"

'defined Y positions of texts on TP, easy to move them - u dont have to search for them in hundreds rows of code. The Y positions of buttons and Acf are also depending on these values.
headerY=51
shapeY=82
colorY=140
sizeY=235
ddY=295
transitionY=365
clearY=430

'check if all program data files are in the program directory
localpath=Program.Directory
CheckFiles()

'this is a file-reading operation. It will read help text from data file and environment colors from settings file
' The following line could be harmful and has been automatically commented.
' helptxt=File.ReadContents(localpath+"\help.data")
' The following line could be harmful and has been automatically commented.
' tipstxt=File.ReadContents(localpath+"\tips.data")
' The following line could be harmful and has been automatically commented.
' updates=File.ReadContents(localpath+"\updates.data")
' The following line could be harmful and has been automatically commented.
' updates2=File.ReadContents(localpath+"\updates2.data")
' The following line could be harmful and has been automatically commented.
' ToolPanel_bgcolor=File.ReadLine(localpath+"\settings.txt",2)
' The following line could be harmful and has been automatically commented.
' tp_text=File.ReadLine(localpath+"\settings.txt",4)
' The following line could be harmful and has been automatically commented.
' pcolor=File.ReadLine(localpath+"\settings.txt",6)
' The following line could be harmful and has been automatically commented.
' fcolor=File.ReadLine(localpath+"\settings.txt",8)
' The following line could be harmful and has been automatically commented.
' lastup=File.ReadLine(localpath+"\settings.txt",10)
'now prepare for saving images
ClearTempor()

'load pointer for making transitions
cursor=ImageList.LoadImage(localpath+"\pointer.gif")

'draw the window (I will fill the window with white color, because picking color will return black if picking from untouched background):
GetBtnInfo()
GetAcfInfo()
GraphicsWindow.BrushColor="White"
GraphicsWindow.FillRectangle(0,0,640,480)
DrawToolPanel()
watermark()
DrawAcf()
DrawButtons()
'Activate keyboard shortcuts:
GraphicsWindow.KeyDown=KeyActivity
'Activate buttons (drawing area is a button, too):
GraphicsWindow.MouseDown=OnClick

'Check for updates if it has not been already done
CheckForUpdates()








'--SUBS-- Sub drawing buttons:
Sub DrawButtons
GraphicsWindow.PenColor=pcolor
GraphicsWindow.BrushColor=fcolor

For w=1 To btncount
GraphicsWindow.DrawRectangle(btnx[w],btny[w],btnw[w],btnh[w])
GraphicsWindow.FillRectangle(btnx[w],btny[w],btnw[w],btnh[w])
EndFor

GraphicsWindow.FontSize=12

For x=1 To btncount
GraphicsWindow.BrushColor=btntc[x]
GraphicsWindow.DrawBoundText(btntx[x],btnty[x],btnw[x],btnt[x])
EndFor

EndSub



'Draw active color fields:
Sub DrawAcf
For acfy=acfy1 To acfy2 Step acfy2-acfy1
For acfx=acfx1 To acfx6 Step acfw+1
GraphicsWindow.DrawRectangle(acfx,acfy,acfw,acfh)
EndFor
EndFor

GraphicsWindow.BrushColor=acf1c
GraphicsWindow.FillRectangle(acfx1,acfy1,acfw,acfh)
GraphicsWindow.BrushColor=acf2c
GraphicsWindow.FillRectangle(acfx2,acfy1,acfw,acfh)
GraphicsWindow.BrushColor=acf3c
GraphicsWindow.FillRectangle(acfx3,acfy1,acfw,acfh)
GraphicsWindow.BrushColor=acf4c
GraphicsWindow.FillRectangle(acfx4,acfy1,acfw,acfh)
GraphicsWindow.BrushColor=acf5c
GraphicsWindow.FillRectangle(acfx5,acfy1,acfw,acfh)
GraphicsWindow.BrushColor=acf6c
GraphicsWindow.FillRectangle(acfx6,acfy1,acfw,acfh)
GraphicsWindow.BrushColor=acf7c
GraphicsWindow.FillRectangle(acfx1,acfy2,acfw,acfh)
GraphicsWindow.BrushColor=acf8c
GraphicsWindow.FillRectangle(acfx2,acfy2,acfw,acfh)
GraphicsWindow.BrushColor=acf9c
GraphicsWindow.FillRectangle(acfx3,acfy2,acfw,acfh)
GraphicsWindow.BrushColor=acf10c
GraphicsWindow.FillRectangle(acfx4,acfy2,acfw,acfh)
GraphicsWindow.BrushColor=acf11c
GraphicsWindow.FillRectangle(acfx5,acfy2,acfw,acfh)
GraphicsWindow.BrushColor=acf12c
GraphicsWindow.FillRectangle(acfx6,acfy2,acfw,acfh)
EndSub




'Set variable iMouseOn[?] on "on" or "off" depending on mouse position over buttons
Sub ButtonMaker

For i = 1 To btncount
mx=GraphicsWindow.MouseX-btnx[i]
my=GraphicsWindow.MouseY-btny[i]
If (mx>=0 And my>=0 And mx<=btnw[i] And my<=btnh[i]) Then
iMouseOnBtn[i]="on"
Else
iMouseOnBtn[i]="off"
EndIf
EndFor

mx2=GraphicsWindow.MouseX
my2=GraphicsWindow.MouseY
If (mx2>=0 And my2>=0 And mx2<=btnXw And my2<=btnXh) Then
iMouseOnBtnX="on"
Else
iMouseOnBtnX="off"
EndIf

EndPositionX=acfx1+(6*acfw)+5
EndPositionY=acfy1+(2*acfh)-1
mx6=GraphicsWindow.MouseX-acfx1
my6=GraphicsWindow.MouseY-acfy1
If (mx6>=0 And my6>=0 And mx6<=EndPositionX-acfx1 And my6<=EndPositionY-acfy1) Then
iMouseOnAcf="on"
Else
iMouseOnAcf="off"
EndIf

EndSub



'cancel making transition by pressing escape; create transition pressing space
Sub TransitionKeyDown
If(GraphicsWindow.LastKey="Escape") Then
GraphicsWindow.MouseDown=OnClick
GraphicsWindow.KeyDown=KeyActivity
GraphicsWindow.BrushColor=ToolPanel_bgcolor
GraphicsWindow.FillRectangle(511,transitionY-21,130,80)
Shapes.Remove(pointer)
Shapes.Remove(vl1)
Shapes.Remove(vl2)
Shapes.Remove(sl1)
Shapes.Remove(sl2)
GraphicsWindow.MouseMove=nothing
DrawButtons()
Mouse.ShowCursor()
color=prevcolor
ElseIf(GraphicsWindow.LastKey="Space" And transtatus="pos2" And selection=2) Then
Shapes.Remove(vl1)
Shapes.Remove(vl2)
Shapes.Remove(sl1)
Shapes.Remove(sl2)
GraphicsWindow.BrushColor=ToolPanel_bgcolor
GraphicsWindow.FillRectangle(511,transitionY-21,130,80)
GraphicsWindow.BrushColor=tp_text
GraphicsWindow.FontSize=14
GraphicsWindow.DrawBoundText(512,transitionY-20,128,"Drawing ...")
Program.Delay(400)
CreateTransition()
GraphicsWindow.MouseDown=OnClick
GraphicsWindow.KeyDown=KeyActivity
GraphicsWindow.BrushColor=ToolPanel_bgcolor
GraphicsWindow.FillRectangle(511,transitionY-21,122,80)
DrawButtons()
color=prevcolor
ElseIf(GraphicsWindow.LastKey="W" And transtatus="pos2" And selection=2) Then
GraphicsWindow.BrushColor=ToolPanel_bgcolor
GraphicsWindow.FillRectangle(511,transitionY-21,130,80)
GraphicsWindow.BrushColor=tp_text
GraphicsWindow.FontSize=12

If(tdirection="LR") Then
tdirection="UD"
GraphicsWindow.DrawBoundText(512,transitionY-20,128,transcolor[1]+" –> "+transcolor[2]+" Way: U/D (w) Opacity: "+Math.Round(topacity*50)+"% (+/-) Space=Continue")
Else
tdirection="LR"
GraphicsWindow.DrawBoundText(512,transitionY-20,128,transcolor[1]+" –> "+transcolor[2]+" Way: L/R (w) Opacity: "+Math.Round(topacity*50)+"% (+/-) Space=Continue")
EndIf

ElseIf(GraphicsWindow.LastKey="Add" And transtatus="pos2" And selection=2) Then

If(tdirection="LR") Then
tway="L/R"
Else
tway="U/D"
EndIf

topacity=topacity+0.1

If (topacity>2) Then
topacity=2
EndIf

GraphicsWindow.BrushColor=ToolPanel_bgcolor
GraphicsWindow.FillRectangle(511,transitionY-21,130,80)
GraphicsWindow.BrushColor=tp_text
GraphicsWindow.FontSize=12
GraphicsWindow.DrawBoundText(512,transitionY-20,128,transcolor[1]+" –> "+transcolor[2]+" Way: "+tway+" (w) Opacity: "+Math.Round(topacity*50)+"% (+/-) Space=Continue")

ElseIf(GraphicsWindow.LastKey="Subtract" And transtatus="pos2" And selection=2) Then

If(tdirection="LR") Then
tway="L/R"
Else
tway="U/D"
EndIf

topacity=topacity-0.1

If (topacity<0.1) Then
topacity=0.1
EndIf

GraphicsWindow.BrushColor=ToolPanel_bgcolor
GraphicsWindow.FillRectangle(511,transitionY-21,130,80)
GraphicsWindow.BrushColor=tp_text
GraphicsWindow.FontSize=12
GraphicsWindow.DrawBoundText(512,transitionY-20,128,transcolor[1]+" –> "+transcolor[2]+" Way: "+tway+" (w) Opacity: "+Math.Round(topacity*50)+"% (+/-) Space=Continue")

ElseIf(GraphicsWindow.LastKey="A" And transtatus="new" Or GraphicsWindow.LastKey="A" And transtatus="pos1") Then
transx[1]=0
transy[1]=0
transx[2]=499
transy[2]=480
GraphicsWindow.BrushColor=ToolPanel_bgcolor
GraphicsWindow.FillRectangle(511,transitionY-21,122,80)
GraphicsWindow.BrushColor=tp_text
GraphicsWindow.FontSize=14
GraphicsWindow.DrawBoundText(512,transitionY-20,120,"now select two colors on ActiveColorField")
GraphicsWindow.MouseMove=nothing
transtatus="pos2"
Shapes.Remove(vl1)
Shapes.Remove(vl2)
Shapes.Remove(sl1)
Shapes.Remove(sl2)
Shapes.Remove(pointer)
vl1=Shapes.AddLine(transx[1],transy[1],transx[2],transy[1])
vl2=Shapes.AddLine(transx[1],transy[2],transx[2],transy[2])
sl1=Shapes.AddLine(transx[1],transy[1],transx[1],transy[2])
sl2=Shapes.AddLine(transx[2],transy[1],transx[2],transy[2])
Mouse.ShowCursor()
EndIf
EndSub



'Control on which button is mouse now, and call the button activity -
Sub OnClick
ButtonMaker()

If(iMouseOnBtn[1]="on") Then
Sbtn1Activity()
ElseIf(iMouseOnBtn[2]="on") Then
Sbtn2Activity()
ElseIf(iMouseOnBtn[3]="on") Then
Sbtn3Activity()
ElseIf(iMouseOnBtn[4]="on") Then
Sbtn4Activity()
ElseIf(iMouseOnBtn[5]="on") Then
Sbtn5Activity()
ElseIf(iMouseOnBtn[6]="on") Then
Sbtn6Activity()
ElseIf(iMouseOnBtn[7]="on") Then
Sbtn7Activity()
ElseIf(iMouseOnBtn[8]="on") Then
Sbtn8Activity()
ElseIf(iMouseOnBtn[9]="on") Then
Sbtn9Activity()
ElseIf(iMouseOnBtn[10]="on") Then
Sbtn10Activity()
ElseIf(iMouseOnBtn[11]="on") Then
Sbtn11Activity()
ElseIf(iMouseOnBtn[12]="on") Then
Sbtn12Activity()
ElseIf(iMouseOnAcf="on") Then
SAcfActivity()
ElseIf(iMouseOnBtnX="on") Then
SbtnXActivity()
EndIf
EndSub



'Subs defining buttons activity:
Sub Sbtn1Activity
GraphicsWindow.BrushColor=ToolPanel_bgcolor
GraphicsWindow.FillRectangle(573,shapeY,70,18)
GraphicsWindow.BrushColor=tp_text
GraphicsWindow.FontSize=14
If(shape="SQUARE") Then
shape="CIRCLE"
GraphicsWindow.DrawText(573,shapeY,"CIRCLE")
Goto Sbtn1Activity_End
EndIf
If(shape="CIRCLE") Then
shape="TRIANGLE"
GraphicsWindow.FontSize=12
GraphicsWindow.DrawText(573,shapeY+2,"TRIANGLE")
GraphicsWindow.FontSize=14
Goto Sbtn1Activity_End
EndIf
If(shape="TRIANGLE") Then
shape="SQUARE"
GraphicsWindow.DrawText(573,shapeY,"SQUARE")
EndIf
Sbtn1Activity_End:
GraphicsWindow.BrushColor=color
EndSub




Sub Sbtn2Activity
GraphicsWindow.Hide()
TextWindow.Clear()
TextWindow.Show()
TextWindow.Title=" --- choose color --- "
TextWindow.WriteLine("EXAMPLE COLORS: Blue, Red, Yellow, Green, Lime, Aqua, Blue, Brown, Maroon, Black, Gray, White, Orange, Purple, Violet, Salmon, Gold, .....")
TextWindow.WriteLine("Colors can be inserted also in HEX (#FFFF00 or #FF0 -- Yellow)")
TextWindow.WriteLine("Wrongly written color is black")
TextWindow.WriteLine(" ")
TextWindow.ForegroundColor="Yellow"
TextWindow.Write("Write color and press ENTER: ")
color=TextWindow.Read()
TextWindow.Hide()
GraphicsWindow.Show()
GraphicsWindow.BrushColor=ToolPanel_bgcolor
GraphicsWindow.FillRectangle(566,colorY,100,17)
GraphicsWindow.BrushColor=color
GraphicsWindow.FontSize=14
GraphicsWindow.DrawText(566,colorY,color)
Endsub



Sub Sbtn3Activity
size=size-1
GraphicsWindow.BrushColor=ToolPanel_bgcolor
GraphicsWindow.FillRectangle(583,sizeY,70,18)
GraphicsWindow.BrushColor=tp_text
GraphicsWindow.FontSize=14
If(size<1) Then
size=1
EndIf
GraphicsWindow.DrawText(585,sizeY,size)
GraphicsWindow.BrushColor=color
EndSub




Sub Sbtn4Activity
size=size+1
GraphicsWindow.BrushColor=ToolPanel_bgcolor
GraphicsWindow.FillRectangle(583,sizeY,70,18)
GraphicsWindow.BrushColor=tp_text
GraphicsWindow.FontSize=14
If(size>50) Then
size=50
EndIf
GraphicsWindow.DrawText(585,sizeY,size)
GraphicsWindow.BrushColor=color
EndSub



Sub Sbtn5Activity
GraphicsWindow.BrushColor=ToolPanel_bgcolor
GraphicsWindow.FillRectangle(500,0,140,480)
GraphicsWindow.BrushColor="White"
GraphicsWindow.FillRectangle(0,0,499,480)

GraphicsWindow.FontSize=16
GraphicsWindow.FontBold="true"
GraphicsWindow.BrushColor="FireBrick"
GraphicsWindow.DrawText(542,headerY,"TOOLS")
GraphicsWindow.FontSize=14
GraphicsWindow.BrushColor=tp_text
If (shape="TRIANGLE") Then
GraphicsWindow.DrawText(516,shapeY,"Shape: ")
GraphicsWindow.FontSize=12
GraphicsWindow.DrawText(573,shapeY+2,"TRIANGLE")
Else
GraphicsWindow.FontSize=14
GraphicsWindow.DrawText(516,shapeY,"Shape: "+shape)
EndIf
GraphicsWindow.FontSize=14
GraphicsWindow.DrawText(516,colorY,"Color: ")
GraphicsWindow.DrawText(543,sizeY,"Size: "+size)
GraphicsWindow.FontSize=12
GraphicsWindow.DrawText(516,ddY,"Drawing delay:")
GraphicsWindow.DrawText(610,ddY,delay)
GraphicsWindow.FontSize=14
GraphicsWindow.BrushColor=color
GraphicsWindow.DrawText(566,colorY,color)
GraphicsWindow.PenWidth=2
GraphicsWindow.PenColor=verifcolor
GraphicsWindow.DrawLine(500,0,500,480)
GraphicsWindow.PenColor="Black"
GraphicsWindow.DrawLine(505,0,505,480)
DrawAcf()
DrawButtons()
watermark()
ClearTempor()
EndSub



Sub Sbtn6Activity
delay=delay-1
GraphicsWindow.BrushColor=ToolPanel_bgcolor
GraphicsWindow.FillRectangle(606,ddY,70,18)
GraphicsWindow.BrushColor=tp_text
GraphicsWindow.FontSize=12
If(delay<0) Then
delay=0
EndIf
GraphicsWindow.DrawText(610,ddY,delay)
GraphicsWindow.BrushColor=color
EndSub



Sub Sbtn7Activity
delay=delay+1
GraphicsWindow.BrushColor=ToolPanel_bgcolor
GraphicsWindow.FillRectangle(606,ddY,70,18)
GraphicsWindow.BrushColor=tp_text
GraphicsWindow.FontSize=12
If(delay>10) Then
delay=10
EndIf
GraphicsWindow.DrawText(610,ddY,delay)
GraphicsWindow.BrushColor=color
EndSub



Sub Sbtn8Activity
GraphicsWindow.ShowMessage(helptxt+progversion,"HELP")
EndSub



Sub Sbtn9Activity
transtatus="new"
GraphicsWindow.MouseDown=TransitionSelect
GraphicsWindow.KeyDown=TransitionKeyDownX
GraphicsWindow.BrushColor=ToolPanel_bgcolor
GraphicsWindow.FillRectangle(511,transitionY-21,122,80)
GraphicsWindow.BrushColor=tp_text
GraphicsWindow.FontSize=14
GraphicsWindow.DrawBoundText(512,transitionY-20,120,"click to select transition area a = Select all Esc = Cancel")
Mouse.HideCursor()
pointer=Shapes.AddImage(cursor)
GraphicsWindow.MouseMove=OnMove
selection=0
prevcolor=color
EndSub



Sub Sbtn10Activity
GraphicsWindow.ShowMessage("I will now check for updates, please click [OK] or close this window (it will do the same =)"," Update manager")
CheckUpdates()
EndSub




Sub Sbtn11Activity
' The following line could be harmful and has been automatically commented.
' sfiles=File.GetFiles(localpath+"/images/")
TextWindow.Clear()
GraphicsWindow.Hide()

TextWindow.ForegroundColor="Yellow"
TextWindow.WriteLine(" ")
TextWindow.WriteLine(" .: FILES IN THE IMAGE DIRECTORY :.")
TextWindow.WriteLine(" ")
For cc=1 To Array.GetItemCount(sfiles)
TextWindow.WriteLine( Text.GetSubTextToEnd(sfiles[cc],Text.GetLength(localpath)+9) )
EndFor
TextWindow.WriteLine(" ")
TextWindow.WriteLine("---")
TextWindow.WriteLine("Extension isn´t necessary - will be added automatically")
TextWindow.WriteLine("If you want to cancel this menu, just press ENTER without writing a letter")
TextWindow.WriteLine("Write your image name and press ENTER:")
TextWindow.Show()
stext=TextWindow.Read()
If (stext="") Then
TextWindow.Hide()
GraphicsWindow.Show()
EndIf
TextWindow.WriteLine("Saving...")
' The following line could be harmful and has been automatically commented.
' sfile=File.ReadContents(localpath+"/temporary.sgsf")
' The following line could be harmful and has been automatically commented.
' verif=File.WriteContents(localpath+"/images/"+stext+".sgsf",sfile)
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"/images/"+stext+".sgsf",si,"_END")
TextWindow.Hide()
GraphicsWindow.Show()
If (verif = "FAILED" ) Then
GraphicsWindow.ShowMessage("Error#5 - Saving image failed, probably because of some special character which cannot be used in file name. You can try it again.", " Error#5")
ElseIf (verif = "SUCCESS" ) Then
GraphicsWindow.ShowMessage("Your image has been successfully saved !", " Image saved")
EndIf
EndSub




Sub Sbtn12Activity
' The following line could be harmful and has been automatically commented.
' lfiles=File.GetFiles(localpath+"/images/")
TextWindow.Clear()
GraphicsWindow.Hide()

TextWindow.ForegroundColor="Yellow"
TextWindow.WriteLine(" ")
TextWindow.WriteLine(" .: FILES IN THE IMAGE DIRECTORY :.")
TextWindow.WriteLine(" ")
For dd=1 To Array.GetItemCount(lfiles)
TextWindow.WriteLine( Text.GetSubTextToEnd(lfiles[dd],Text.GetLength(localpath)+9) )
EndFor
TextWindow.WriteLine(" ")
TextWindow.WriteLine("---")
TextWindow.WriteLine("If you want to cancel this menu, just press ENTER without writing a letter")
TextWindow.WriteLine("Extension isn´t necessary - will be added automatically (.sgsf)")
TextWindow.WriteLine(" Choose file which has extension .sgsf and press ENTER: ")
TextWindow.Show()
reading:
ltext=TextWindow.Read()
If (ltext="") Then
TextWindow.Hide()
GraphicsWindow.Show()
EndIf

TextWindow.WriteLine("Loading...")
verif2=Text.EndsWith(ltext,".sgsf")
If (verif2 <> "true") Then
' The following line could be harmful and has been automatically commented.
' loadfile=File.ReadContents(localpath+"/images/"+ltext+".sgsf")
loadpath=localpath+"/images/"+ltext+".sgsf"
Else
' The following line could be harmful and has been automatically commented.
' loadfile=File.ReadContents(localpath+"/images/"+ltext)
loadpath=localpath+"/images/"+ltext
EndIf

If (loadfile="") Then
TextWindow.WriteLine("An error occured, requested file has not been found")
Goto reading
EndIf
' The following line could be harmful and has been automatically commented.
' firstline=File.ReadLine(loadpath,1)
If (Text.StartsWith(firstline,"SINE Soft GraphicStudio File")<>"true") Then
TextWindow.WriteLine("An error occured, requested file is not SGSF or is damaged")
Goto reading
EndIf

Program.Delay(500)

Sbtn5Activity()
GraphicsWindow.BrushColor="Black"
cover=Shapes.AddRectangle(640,480)
Shapes.SetOpacity(cover,60)
TextWindow.Hide()
GraphicsWindow.Show()
Program.Delay(300)
LoadFile()
EndSub




Sub SAcfActivity
mx5=GraphicsWindow.MouseX
my5=GraphicsWindow.MouseY
color=GraphicsWindow.GetPixel(mx5,my5)
ConvertColor()
GraphicsWindow.BrushColor=ToolPanel_bgcolor
GraphicsWindow.FillRectangle(566,colorY,100,17)
GraphicsWindow.BrushColor=color
GraphicsWindow.FontSize=14
GraphicsWindow.DrawText(566,colorY,color)
EndSub



Sub SbtnXActivity
mx3=GraphicsWindow.MouseX
my3=GraphicsWindow.MouseY
If(iMouseOnBtnX="on") Then
GraphicsWindow.BrushColor=color
truesize=size*10
halfsize=truesize/2
thirdsize=truesize/3

If(shape="CIRCLE") Then
GraphicsWindow.FillEllipse(mx3-halfsize,my3-halfsize,truesize,truesize)
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"/temporary.sgsf",si,"_cir-"+mx3+","+my3)
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"/temporary.sgsf",si+1,color)
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"/temporary.sgsf",si+2,size)
si=si+3
px=mx3
py=my3
circle_start:
DefineMouseXY()
If(Mouse.IsLeftButtonDown And iMouseOnPaper="on") Then
GraphicsWindow.FillEllipse(mx4-halfsize,my4-halfsize,truesize,truesize)
Program.Delay(delay)
If(px <> mx4 Or py <> my4) Then
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"/temporary.sgsf",si,"_cir-"+mx4+","+my4)
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"/temporary.sgsf",si+1,color)
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"/temporary.sgsf",si+2,size)
si=si+3
EndIf
px=mx4
py=my4
Goto circle_start
EndIf
EndIf

If(shape="SQUARE") Then
GraphicsWindow.FillRectangle(mx3-halfsize,my3-halfsize,truesize,truesize)
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"/temporary.sgsf",si,"_sq-"+mx3+","+my3)
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"/temporary.sgsf",si+1,color)
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"/temporary.sgsf",si+2,size)
si=si+3
px=mx3
py=my3
square_start:
DefineMouseXY()
If(Mouse.IsLeftButtonDown And iMouseOnPaper="on") Then
GraphicsWindow.FillRectangle(mx4-halfsize,my4-halfsize,truesize,truesize)
Program.Delay(delay)
If(px <> mx4 Or py <> my4) Then
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"/temporary.sgsf",si,"_sq-"+mx4+","+my4)
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"/temporary.sgsf",si+1,color)
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"/temporary.sgsf",si+2,size)
si=si+3
EndIf
px=mx4
py=my4
Goto square_start
EndIf
EndIf

If(shape="TRIANGLE") Then
GraphicsWindow.FillTriangle(mx3,my3-2*thirdsize,mx3-halfsize,my3+thirdsize,mx3+halfsize,my3+thirdsize)
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"/temporary.sgsf",si,"_tria-"+mx3+","+my3)
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"/temporary.sgsf",si+1,color)
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"/temporary.sgsf",si+2,size)
si=si+3
px=mx3
py=my3
triangle_start:
DefineMouseXY()
If(Mouse.IsLeftButtonDown And iMouseOnPaper="on") Then
GraphicsWindow.FillTriangle(mx4,my4-2*thirdsize,mx4-halfsize,my4+thirdsize,mx4+halfsize,my4+thirdsize)
Program.Delay(delay)
If(px <> mx4 Or py <> my4) Then
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"/temporary.sgsf",si,"_tria-"+mx4+","+my4)
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"/temporary.sgsf",si+1,color)
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"/temporary.sgsf",si+2,size)
si=si+3
EndIf
px=mx4
py=my4
Goto triangle_start
EndIf
EndIf
GraphicsWindow.MouseUp=DrawBtn5
CheckTP()
EndIf
EndSub




'Sub drawing Tool Panel:
Sub DrawToolPanel
GraphicsWindow.BrushColor=ToolPanel_bgcolor
GraphicsWindow.FillRectangle(500,0,140,480)
GraphicsWindow.FontSize=16
GraphicsWindow.FontBold="true"
GraphicsWindow.BrushColor="FireBrick"
GraphicsWindow.DrawText(542,headerY,"TOOLS")
GraphicsWindow.FontSize=14
GraphicsWindow.BrushColor=tp_text
If (shape="TRIANGLE") Then
GraphicsWindow.DrawText(516,shapeY,"Shape: ")
GraphicsWindow.FontSize=12
GraphicsWindow.DrawText(573,shapeY+2,"TRIANGLE")
Else
GraphicsWindow.FontSize=14
GraphicsWindow.DrawText(516,shapeY,"Shape: "+shape)
EndIf
GraphicsWindow.FontSize=14
GraphicsWindow.DrawText(516,colorY,"Color: ")
GraphicsWindow.DrawText(543,sizeY,"Size: "+size)
GraphicsWindow.FontSize=12
GraphicsWindow.DrawText(516,ddY,"Drawing delay:")
GraphicsWindow.DrawText(610,ddY,delay)
GraphicsWindow.FontSize=14
GraphicsWindow.BrushColor=color
GraphicsWindow.DrawText(566,colorY,color)
GraphicsWindow.PenWidth=2
GraphicsWindow.PenColor="Black"
GraphicsWindow.DrawLine(505,0,505,480)
GraphicsWindow.PenColor=verifcolor
GraphicsWindow.DrawLine(500,0,500,480)
GraphicsWindow.PenColor="Black"
EndSub


'Sub defining mouse X and Y for drawing lines:
Sub DefineMouseXY
mx4=GraphicsWindow.MouseX
my4=GraphicsWindow.MouseY
If (mx4>=0 And my4>=0 And mx4<=btnXw And my4<=btnXh) Then
iMouseOnPaper="on"
Else
iMouseOnPaper="off"
EndIf
EndSub



Sub OnMove
If(prevx<>GraphicsWindow.MouseX Or prevy<>GraphicsWindow.MouseY) Then
Shapes.Remove(vl1)
Shapes.Remove(vl2)
Shapes.Remove(sl1)
Shapes.Remove(sl2)
DefineMouseXY()
If(transtatus="new" And iMouseOnPaper="on") Then
Mouse.HideCursor()
Shapes.Move(pointer,GraphicsWindow.MouseX-3,GraphicsWindow.MouseY-3)
ElseIf(transtatus="new" And iMouseOnPaper="off") Then
Mouse.ShowCursor()
Shapes.Move(pointer,640,480)
EndIf
If(transtatus="pos1" And iMouseOnPaper="on") Then
vl1=Shapes.AddLine(transx[1],transy[1],GraphicsWindow.MouseX,transy[1])
vl2=Shapes.AddLine(transx[1],GraphicsWindow.MouseY,GraphicsWindow.MouseX,GraphicsWindow.MouseY)
sl1=Shapes.AddLine(transx[1],transy[1],transx[1],GraphicsWindow.MouseY)
sl2=Shapes.AddLine(GraphicsWindow.MouseX,transy[1],GraphicsWindow.MouseX,GraphicsWindow.MouseY)
EndIf
EndIf
prevx=GraphicsWindow.MouseX
prevy=GraphicsWindow.MouseY
EndSub



Sub TransitionSelect
DefineMouseXY()
If(transtatus="new") Then
mx7=GraphicsWindow.MouseX
my7=GraphicsWindow.MouseY
If (mx7>=0 And my7>=0 And mx7<=btnXw And my7<=btnXh) Then
transx[1]=GraphicsWindow.MouseX
transy[1]=GraphicsWindow.MouseY
transtatus="pos1"
Mouse.ShowCursor()
Shapes.Remove(pointer)
EndIf
ElseIf(transtatus="pos1" And iMouseOnPaper="on") Then
transx[2]=GraphicsWindow.MouseX
transy[2]=GraphicsWindow.MouseY
GraphicsWindow.BrushColor=ToolPanel_bgcolor
GraphicsWindow.FillRectangle(511,transitionY-21,122,80)
GraphicsWindow.BrushColor=tp_text
GraphicsWindow.FontSize=14
GraphicsWindow.DrawBoundText(512,transitionY-20,120,"now select two colors on ActiveColorField")
GraphicsWindow.MouseMove=nothing
transtatus="pos2"
ElseIf(transtatus="pos2") Then
EndPositionX=acfx1+(6*acfw)+5
EndPositionY=acfy1+(2*acfh)-1
mx6=GraphicsWindow.MouseX-acfx1
my6=GraphicsWindow.MouseY-acfy1
If (mx6>=0 And my6>=0 And mx6<=EndPositionX-acfx1 And my6<=EndPositionY-acfy1) Then
selection=selection+1
color=GraphicsWindow.GetPixel(GraphicsWindow.MouseX,GraphicsWindow.MouseY)
ConvertColor()
transcolor[selection]=color
GraphicsWindow.BrushColor=ToolPanel_bgcolor
GraphicsWindow.FillRectangle(511,transitionY-21,130,80)
GraphicsWindow.BrushColor=tp_text
GraphicsWindow.FontSize=12
If (selection=1) Then
GraphicsWindow.DrawBoundText(512,transitionY-20,120,transcolor[1]+" –>")
ElseIf(selection=2) Then
If(tdirection="LR") Then
tway="L/R"
Else
tway="U/D"
EndIf
GraphicsWindow.DrawBoundText(512,transitionY-20,128,transcolor[1]+" –> "+transcolor[2]+" Way: "+tway+" (w) Opacity: "+Math.Round(topacity*50)+"% (+/-) Space=Continue")
ElseIf(selection=3) Then
selection=1
transcolor[1]= transcolor[3]
GraphicsWindow.DrawBoundText(512,transitionY-20,120,transcolor[1]+" –>")
EndIf
EndIf
EndIf
EndSub



'Sub creating the transition
Sub CreateTransition
If(transx[2]=499 And tdirection="LR") Then
transx[2]=498
EndIf
clr[1]=transcolor[1]
clr[2]=transcolor[2]
GetRGB()
par[1] = Math.Abs(transx[1]-transx[2])
par[2] = Math.Abs(transy[1]-transy[2])
If(tdirection="LR") Then
rres = Math.Abs(cr[1]-cr[2]) / par[1]
gres = Math.Abs(cg[1]-cg[2]) / par[1]
bres = Math.Abs(cb[1]-cb[2]) / par[1]
tlimit=1
Else
rres = Math.Abs(cr[1]-cr[2]) / par[2]
gres = Math.Abs(cg[1]-cg[2]) / par[2]
bres = Math.Abs(cb[1]-cb[2]) / par[2]
tlimit=2
EndIf

GraphicsWindow.PenWidth=topacity
aa=1
bb=1
If(Math.Max(transx[1],transx[2]) = transx[1]) Then
aa=2
EndIf
If(Math.Max(transy[1],transy[2]) = transy[1]) Then
bb=2
EndIf



For z=0 To par[tlimit]
r=Math.Round(cr[1]+rres*z)
g=Math.Round(cg[1]+gres*z)
b=Math.Round(cb[1]+bres*z)
If(Math.Max(cr[1],cr[2])=cr[1]) Then
r=Math.Round(cr[1]-rres*z)
EndIf
If(Math.Max(cg[1],cg[2])=cg[1]) Then
g=Math.Round(cg[1]-gres*z)
EndIf
If(Math.Max(cb[1],cb[2])=cb[1]) Then
b=Math.Round(cb[1]-bres*z)
EndIf

GraphicsWindow.PenColor=GraphicsWindow.GetColorFromRGB(r,g,b)
If(tdirection="LR") Then
GraphicsWindow.DrawLine(transx[aa]+z,transy[1],transx[aa]+z,transy[2])
ElseIf(tdirection="UD") Then
GraphicsWindow.DrawLine(transx[1],transy[bb]+z,transx[2],transy[bb]+z)
EndIf
EndFor

GraphicsWindow.PenWidth=1.5

' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"/temporary.sgsf",si,"_transition-"+transx[1]+","+transy[1]+"/"+transx[2]+","+transy[2])
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"/temporary.sgsf",si+1,transcolor[1]+","+transcolor[2])
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"/temporary.sgsf",si+2,tdirection+","+Math.Round(topacity*50))
si=si+3

EndSub



'Sub converting acf colors to RGB
Sub GetRGB
For y=1 To 2
If(clr[y]="Black") Then
cr[y]=0
cg[y]=0
cb[y]=0
ElseIf(clr[y]="White") Then
cr[y]=255
cg[y]=255
cb[y]=255
ElseIf(clr[y]="Red") Then
cr[y]=255
cg[y]=0
cb[y]=0
ElseIf(clr[y]="Green") Then
cr[y]=0
cg[y]=128
cb[y]=0
ElseIf(clr[y]="Blue") Then
cr[y]=0
cg[y]=0
cb[y]=255
ElseIf(clr[y]="Lime") Then
cr[y]=0
cg[y]=255
cb[y]=0
ElseIf(clr[y]="Aqua") Then
cr[y]=0
cg[y]=255
cb[y]=255
ElseIf(clr[y]="Purple") Then
cr[y]=128
cg[y]=0
cb[y]=128
ElseIf(clr[y]="HotPink") Then
cr[y]=255
cg[y]=105
cb[y]=180
ElseIf(clr[y]="Brown") Then
cr[y]=165
cg[y]=42
cb[y]=42
ElseIf(clr[y]="Orange") Then
cr[y]=255
cg[y]=165
cb[y]=0
ElseIf(clr[y]="Yellow") Then
cr[y]=255
cg[y]=255
cb[y]=0
EndIf
EndFor
EndSub




'Sub which will draw button "CLEAR", used to draw it when mouse button is released:
Sub DrawBtn5
GraphicsWindow.PenColor=pcolor
GraphicsWindow.DrawRectangle(btnx[5],btny[5],btnw[5],btnh[5])
GraphicsWindow.BrushColor=fcolor
GraphicsWindow.FillRectangle(btnx[5],btny[5],btnw[5],btnh[5])
GraphicsWindow.FontSize=12
GraphicsWindow.BrushColor=btntc[5]
GraphicsWindow.DrawBoundText(btntx[5],btnty[5],btnw[5],btnt[5])
GraphicsWindow.BrushColor=color
EndSub



'Sub defining key activity for keyboard shortcuts:
Sub KeyActivity
If(GraphicsWindow.LastKey="F1") Then

Sbtn8Activity()

ElseIf(GraphicsWindow.LastKey="F12") Then

GraphicsWindow.ShowMessage(tipstxt," Tips")

ElseIf(GraphicsWindow.LastKey="S") Then

Sbtn1Activity()

ElseIf(GraphicsWindow.LastKey="C") Then

Sbtn2Activity()

ElseIf(GraphicsWindow.LastKey="Subtract") Then

Sbtn3Activity()

ElseIf(GraphicsWindow.LastKey="Add") Then

Sbtn4Activity()

ElseIf(GraphicsWindow.LastKey="Divide") Then

For Q=1 To 10
Sbtn3Activity()
EndFor

ElseIf(GraphicsWindow.LastKey="Multiply") Then

For W=1 To 10
Sbtn4Activity()
EndFor

ElseIf(GraphicsWindow.LastKey="Down") Then

Sbtn6Activity()

ElseIf(GraphicsWindow.LastKey="Up") Then

Sbtn7Activity()

ElseIf(GraphicsWindow.LastKey="Escape") Then

Sbtn5Activity()

ElseIf(GraphicsWindow.LastKey="P") Then

PickColor()

ElseIf(GraphicsWindow.LastKey="T") Then

Sbtn9Activity()

ElseIf(GraphicsWindow.LastKey="F2") Then

Sbtn11Activity()

ElseIf(GraphicsWindow.LastKey="F3") Then

Sbtn12Activity()

ElseIf(GraphicsWindow.LastKey="F4") Then

Sbtn10Activity()

ElseIf(GraphicsWindow.LastKey="F5") Then

DrawToolPanel()
watermark()
DrawAcf()
DrawButtons()

EndIf
EndSub




'Sub which will pick up a color from mouse position
Sub PickColor
color=GraphicsWindow.GetPixel(GraphicsWindow.MouseX,GraphicsWindow.MouseY)
GraphicsWindow.BrushColor=ToolPanel_bgcolor
GraphicsWindow.FillRectangle(566,colorY,100,17)
GraphicsWindow.BrushColor=color
GraphicsWindow.FontSize=14
GraphicsWindow.DrawText(566,colorY,color)
EndSub





'Sub defining variables of button parameters:
Sub GetBtnInfo
a=1
btnx[a]=541
btny[a]=shapeY+20
btnw[a]=60
btnh[a]=15
btnt[a]=" Change"
btntc[a]="Blue"
btntx[a]=btnx[a]
btnty[a]=btny[a]
a=2
btnx[a]=537
btny[a]=colorY+64
btnw[a]=66
btnh[a]=15
btnt[a]="User color"
btntc[a]="Blue"
btntx[a]=btnx[a]+2
btnty[a]=btny[a]
a=3
btnx[a]=539
btny[a]=sizeY+20
btnw[a]=30
btnh[a]=15
btnt[a]=" -"
btntc[a]="Blue"
btntx[a]=btnx[a]+2
btnty[a]=btny[a]
a=4
btnx[a]=572
btny[a]=sizeY+20
btnw[a]=30
btnh[a]=15
btnt[a]=" +"
btntc[a]="Blue"
btntx[a]=btnx[a]
btnty[a]=btny[a]
a=5
btnx[a]=525
btny[a]=clearY
btnw[a]=100
btnh[a]=20
btnt[a]=" CLEAR"
btntc[a]="Red"
btntx[a]=btnx[a]+18
btnty[a]=btny[a]+2
a=6
btnx[a]=539
btny[a]=ddY+20
btnw[a]=30
btnh[a]=15
btnt[a]=" -"
btntc[a]="Blue"
btntx[a]=btnx[a]+2
btnty[a]=btny[a]
a=7
btnx[a]=572
btny[a]=ddY+20
btnw[a]=30
btnh[a]=15
btnt[a]=" +"
btntc[a]="Blue"
btntx[a]=btnx[a]
btnty[a]=btny[a]
a=8
btnx[a]=585
btny[a]=3
btnw[a]=50
btnh[a]=15
btnt[a]=" HELP"
btntc[a]="Green"
btntx[a]=btnx[a]-2
btnty[a]=btny[a]
a=9
btnx[a]=512
btny[a]=transitionY
btnw[a]=120
btnh[a]=18
btnt[a]="Create transition"
btntc[a]="Blue"
btntx[a]=btnx[a]+9
btnty[a]=btny[a]+2
a=10
btnx[a]=511
btny[a]=3
btnw[a]=70
btnh[a]=15
btnt[a]="UPDATES"
btntc[a]="Blue"
btntx[a]=btnx[a]+6
btnty[a]=btny[a]
a=11
btnx[a]=511
btny[a]=22
btnw[a]=60
btnh[a]=15
btnt[a]="Save"
btntc[a]="DodgerBlue"
btntx[a]=btnx[a]+15
btnty[a]=btny[a]
a=12
btnx[a]=575
btny[a]=22
btnw[a]=60
btnh[a]=15
btnt[a]=" Load"
btntc[a]="Orange"
btntx[a]=btnx[a]+12
btnty[a]=btny[a]

btncount=a

btnXx=0
btnXy=0
btnXw=499
btnXh=480
EndSub





'Sub defining informations about the ActiveColorField:
Sub GetAcfInfo
acfw=20
acfh=20
acfy1=colorY+18
acfy2=acfy1+21

acfx1=510
acfx2=acfx1+acfw+1
acfx3=acfx2+acfw+1
acfx4=acfx3+acfw+1
acfx5=acfx4+acfw+1
acfx6=acfx5+acfw+1

acf1c="Black"
acf2c="Red"
acf3c="Green"
acf4c="Blue"
acf5c="Purple"
acf6c="Brown"
acf7c="White"
acf8c="Yellow"
acf9c="Lime"
acf10c="Aqua"
acf11c="HotPink"
acf12c="Orange"
EndSub


'Sub converting color from HEX to TEXT:
Sub ConvertColor
If(color="#FFFFFF") Then
color="White"
ElseIf(color="#FF0000") Then
color="Red"
ElseIf(color="#FFFF00") Then
color="Yellow"
ElseIf(color="#008000") Then
color="Green"
ElseIf(color="#00FF00") Then
color="Lime"
ElseIf(color="#0000FF") Then
color="Blue"
ElseIf(color="#00FFFF") Then
color="Aqua"
ElseIf(color="#800080") Then
color="Purple"
ElseIf(color="#FF69B4") Then
color="HotPink"
ElseIf(color="#A52A2A") Then
color="Brown"
ElseIf(color="#FFA500") Then
color="Orange"
Else
color="Black"
EndIf
EndSub




Sub nothing
'nothing to see here!
EndSub




Sub TransitionKeyDownX
TransitionKeyDown()
EndSub




'Check if the ToolPanel isn´t ovepainted
Sub CheckTP
If (size >= 15) Then
iistep=150
Else
iistep=size*10
EndIf

For ii=0 To 479 Step iistep

If ( GraphicsWindow.GetPixel(499,ii) <> verifcolor ) Then
DrawToolPanel()
watermark()
DrawAcf()
DrawButtons()
EndIf

EndFor
EndSub




'check if all program data files are in the program directory
Sub CheckFiles
' The following line could be harmful and has been automatically commented.
' parts=File.GetFiles(localpath)
enum3=0
For qq=0 To 100
If ( parts[qq]=localpath+"\help.data" Or parts[qq]=localpath+"\tips.data" Or parts[qq]=localpath+"\updates.data" Or parts[qq]=localpath+"\updates2.data" Or parts[qq]=localpath+"\pointer.gif") Then
enum3=enum3+1
EndIf
EndFor
qww=0
qww=qww+enum3

' The following line could be harmful and has been automatically commented.
' If ( File.ReadLine(localpath+"/settings.txt",1)<>"_____ToolPanel background color ?") Then
GraphicsWindow.ShowMessage(" Error#2 - File settings.txt have not been found. Program cannot start.","Error#2")
Program.End()
EndIf
If (qww <> 5 ) Then
GraphicsWindow.ShowMessage(" Error#3 - Some of the program´s DATA files are missing. Program will try to start without them.","Error#3")
EndIf
EndSub




'Check for updates if it has not been already done
Sub CheckForUpdates
If (lastup = "undefined" ) Then
GraphicsWindow.ShowMessage("You haven´t checked for updates yet. Let´s do it now!"," Update manager")
CheckUpdates()
Else
lastupl=Text.GetLength(lastup)
lastupd=Text.GetIndexOf(lastup,"/")
lastupm=Text.GetIndexOf(lastup,"_")
lastupday=Text.GetSubText(lastup,1,lastupd-1)
lastupmonth=Text.GetSubText(lastup,lastupd+1,lastupm-lastupd-1)
lastupyear=Text.GetSubText(lastup,lastupm+1,4)
remaind=(Clock.Month-lastupmonth)*30+(Clock.day-lastupday)

If(lastupd=-1 Or lastupm=-1 Or lastupl>10 Or lastupday>31 Or lastupmonth>12 Or lastupyear>2500) Then
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"\settings.txt",10,"undefined")
GraphicsWindow.ShowMessage(" Error#1 - Invalid date of last update // Returned to ´undefined´"," Update manager")
Goto cont
EndIf

If(lastupyear GraphicsWindow.ShowMessage("New Year! Time for update =D"," Update manager")
CheckUpdates()
ElseIf(remaind>=7) Then
GraphicsWindow.ShowMessage("A week passed... Time for update !"," Update manager")
CheckUpdates()
EndIf

EndIf
cont:
EndSub




'Check for updates
Sub CheckUpdates
infopage=Network.GetWebPageContents("http://vitek.sikora.cz/SINE_Soft/infopage.data")
' The following line could be harmful and has been automatically commented.
' File.WriteContents(localpath+"/infopage.data",infopage)

' The following line could be harmful and has been automatically commented.
' If (File.ReadLine(localpath+"/infopage.data",2) = progversion) Then
Addict="YOUR VERSION IS ACTUAL"
Else
Addict="!!! YOUR VERSION IS NOT ACTUAL !!!"
EndIf

GraphicsWindow.ShowMessage(updates+infopage+updates2+"Your current version is "+progversion+" "+Addict," Update manager")
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"\settings.txt",10,Clock.Day+"/"+Clock.Month+"_"+Clock.Year)
EndSub



Sub ClearTempor
' The following line could be harmful and has been automatically commented.
' dv=File.DeleteFile(localpath+"/temporary.sgsf")
If(dv="FAILED") Then
GraphicsWindow.ShowMessage("Error#4 - Progam was unable to delete old temporary file. Your next image should not be saved properly. If you want to solve this problem, restart program manually."," Error#4")
EndIf
si=4
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"/temporary.sgsf",1,"SINE Soft GraphicStudio File - Created : "+Clock.Day+"-"+Clock.Month+"_"+Clock.Year+"/"+Clock.Hour+"."+Clock.Minute+" - SGSF version : "+SGSFversion)
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"/temporary.sgsf",2,"w498")
' The following line could be harmful and has been automatically commented.
' File.WriteLine(localpath+"/temporary.sgsf",3,"h479")
EndSub




'sub for loading saved files
Sub LoadFile
li=4
newshape:
' The following line could be harmful and has been automatically commented.
' shp=File.ReadLine(loadpath,li)
If ( Text.StartsWith(shp,"_sq")) Then


' The following line could be harmful and has been automatically commented.
' GraphicsWindow.BrushColor=File.ReadLine(loadpath,li+1)
' The following line could be harmful and has been automatically commented.
' sz=File.ReadLine(loadpath,li+2)
xx=Text.GetSubText(shp,Text.GetIndexOf(shp,"-")+1,Text.GetIndexOf(shp,",")-Text.GetIndexOf(shp,"-")-1)
yy=Text.GetSubTextToEnd(shp,Text.GetIndexOf(shp,",")+1)
truesize=sz*10
halfsize=truesize/2
thirdsize=truesize/3
GraphicsWindow.FillRectangle(xx-halfsize,yy-halfsize,truesize,truesize)


ElseIf ( Text.StartsWith(shp,"_cir")) Then


' The following line could be harmful and has been automatically commented.
' GraphicsWindow.BrushColor=File.ReadLine(loadpath,li+1)
' The following line could be harmful and has been automatically commented.
' sz=File.ReadLine(loadpath,li+2)
xx=Text.GetSubText(shp,Text.GetIndexOf(shp,"-")+1,Text.GetIndexOf(shp,",")-Text.GetIndexOf(shp,"-")-1)
yy=Text.GetSubTextToEnd(shp,Text.GetIndexOf(shp,",")+1)
truesize=sz*10
halfsize=truesize/2
thirdsize=truesize/3
GraphicsWindow.FillEllipse(xx-halfsize,yy-halfsize,truesize,truesize)


ElseIf ( Text.StartsWith(shp,"_tria")) Then


' The following line could be harmful and has been automatically commented.
' GraphicsWindow.BrushColor=File.ReadLine(loadpath,li+1)
' The following line could be harmful and has been automatically commented.
' sz=File.ReadLine(loadpath,li+2)
xx=Text.GetSubText(shp,Text.GetIndexOf(shp,"-")+1,Text.GetIndexOf(shp,",")-Text.GetIndexOf(shp,"-")-1)
yy=Text.GetSubTextToEnd(shp,Text.GetIndexOf(shp,",")+1)
truesize=sz*10
halfsize=truesize/2
thirdsize=truesize/3
GraphicsWindow.FillTriangle(xx,yy-2*thirdsize,xx-halfsize,yy+thirdsize,xx+halfsize,yy+thirdsize)


ElseIf ( Text.StartsWith(shp,"_transition")) Then



transx[1]=Text.GetSubText(shp,Text.GetIndexOf(shp,"-")+1,Text.GetIndexOf(shp,",")-Text.GetIndexOf(shp,"-")-1)
transy[1]=Text.GetSubText(shp,Text.GetIndexOf(shp,",")+1,Text.GetIndexOf(shp,"/")-Text.GetIndexOf(shp,",")-1)
lftpart=Text.GetSubTextToEnd(shp,Text.GetIndexOf(shp,"/")+1)
transx[2]=Text.GetSubText(lftpart,1,Text.GetIndexOf(lftpart,",")-1)
transy[2]=Text.GetSubTextToEnd(lftpart,Text.GetIndexOf(lftpart,",")+1)
' The following line could be harmful and has been automatically commented.
' transcolor[1]=Text.GetSubText(File.ReadLine(loadpath,li+1),1,Text.GetIndexOf(File.ReadLine(loadpath,li+1),",")-1)
' The following line could be harmful and has been automatically commented.
' transcolor[2]=Text.GetSubTextToEnd(File.ReadLine(loadpath,li+1),Text.GetIndexOf(File.ReadLine(loadpath,li+1),",")+1)
' The following line could be harmful and has been automatically commented.
' tdirection=Text.GetSubText(File.ReadLine(loadpath,li+2),1,Text.GetIndexOf(File.ReadLine(loadpath,li+2),",")-1)
' The following line could be harmful and has been automatically commented.
' topacityk=Text.GetSubTextToEnd(File.ReadLine(loadpath,li+2),Text.GetIndexOf(File.ReadLine(loadpath,li+2),",")+1)
topacity=topacityk/50
CreateTransition()



ElseIf ( Text.StartsWith(shp,"_END")) Then

Goto enddrawing

EndIf

li=li+3

Goto newshape
enddrawing:
si=li
' The following line could be harmful and has been automatically commented.
' File.WriteContents(localpath+"/temporary.sgsf",loadfile)
If (loadpath=localpath+"/temporary.sgsf") Then
Program.Delay(500)
EndIf
Shapes.Remove(cover)
DrawToolPanel()
watermark()
DrawAcf()
DrawButtons()
EndSub




'Sub watermarking the window:
Sub watermark
GraphicsWindow.FontSize=14
GraphicsWindow.BrushColor="DeepSkyBlue"
GraphicsWindow.DrawText(548,462,"by "+author)
GraphicsWindow.BrushColor=color
EndSub
'total 1482 rows of code -- sorry for my bad english