1 # The Ring Notepad Application (RNote)
2 # Author : Mahmoud Fayed <msfclipper@yahoo.com>
4 class RNoteTreeViewEvents
6 func CheckSaveBeforeChange
7 if cActiveFileName = NULL return ok
11 CheckSaveBeforeChange() # To ask to saving a file
13 oItem = tree1.currentindex()
18 cOldActiveFileName = cActiveFileName
19 # Open Form Designer File
20 lActivateFormDesigner = False
21 if right(ofile.filepath(oItem),6) = ".rform"
22 StatusMessage("Open the form file...")
23 if ofile.filepath(oItem) != cFormFile
24 cFormFile = ofile.filepath(oItem)
25 FormDesigner().OpenFile(ofile.filepath(oItem))
27 StatusMessage("Ready!")
28 oDockFormDesigner.raise()
29 cSourceFile = substr(cFormFile,".rform","Controller.ring")
30 if fexists(FileNameEncoding(cSourceFile))
31 cActiveFileName = cSourceFile
35 lActivateFormDesigner = True
37 cActiveFileName = ofile.filepath(oItem)
39 # We get nLine before using textedit1.settext() to get the value before aFilesLines update
40 nLine = aFilesLines[cActiveFileName]
42 textedit1.setPlaintext(read(FileNameEncoding(cActiveFileName)))
44 msginfo("Sorry","Can't open the file " + cActiveFileName)
45 cActiveFileName = cOldActiveFileName
49 CursorPositionChanged()
56 cTextHash = sha256(textedit1.toplaintext())
57 oDockFunctionsList.setWindowTitle("Functions (Loading...)")
58 oDockClassesList.setWindowTitle("Classes (Loading...)")
59 DisplayFunctionsList()
61 if lActivateFormDesigner
62 oDockFormDesigner.raise()
64 oDockSourceCode.raise()
67 StatusMessage("Ready!")