SUB ParseSubIncRes(indx AS INTEGER, SourceText AS STRING)
DEFINT i, Cnt = 0, SubsFound = 0, CommFound = 0
DEFSTR Search
SCREEN.Cursor = crHourGlass
tmpList.Text = SourceText
MainListBoxIncludes.Clear
IDE.ListIncludes(indx).Clear
MainListBoxResources.Clear
IDE.ListResources(indx).Clear
SubFuncListView(indx).Clear
SubFuncListView(indx).SortType = stNone
DEFSTR InclStr = "$"
IF IDE.ModuleType(MFE_Tab.TabIndex) > 0 THEN InclStr = "#"
InclStr = InclStr + "INCLUDE "
FOR i = 0 TO tmpList.ItemCount - 1
Search = LTRIM$(UCASE$(tmpList.Item(i)))
IF (LEFT$(Search, 4) = "SUB ") THEN
SubFuncListView(indx).AddItems DELETE$(LTRIM$(tmpList.Item(i)), 1, 4) + SPACE$(90) + LineNumDelimitr + STR$(i) + LineNumDelimitr + "0"
Cnt++
SubsFound++
ELSEIF (LEFT$(Search, 9) = "FUNCTION ") THEN
SubFuncListView(indx).AddItems DELETE$(LTRIM$(tmpList.Item(i)), 1, 9) + SPACE$(90) + LineNumDelimitr + STR$(i) + LineNumDelimitr + "1"
Cnt++
SubsFound++
ELSEIF (LEFT$(Search, 9) = InclStr) THEN
Search = DELETE$(TRIM$( tmpList.Item(i) ), 1, 9)
CommFound = RINSTR(Search, sQuot)
IF CommFound > 0 THEN Search = RTRIM$(LEFT$(Search, CommFound-1))
CommFound = RINSTR(Search, Quot$)
IF CommFound > 0 THEN
MainListBoxIncludes.AddItems REPLACESUBSTR$(Search , Quot$ , "")
IDE.ListIncludes(indx).AddItems REPLACESUBSTR$(Search , Quot$ , "")
ELSE
CommFound = RINSTR(Search, ">")
IF CommFound > 0 THEN
Search = REPLACESUBSTR$(Search , "<" , "")
Search = REPLACESUBSTR$(Search , ">" , "")
IF FILEEXISTS(Search) THEN
MainListBoxIncludes.AddItems Search
IDE.ListIncludes(indx).AddItems Search
ELSE
IF FILEEXISTS(StripPath(IDE.MFEActiveFile) + Search) THEN
MainListBoxIncludes.AddItems (StripPath(IDE.MFEActiveFile) + Search)
IDE.ListIncludes(indx).AddItems (StripPath(IDE.MFEActiveFile) + Search)
ELSE
MainListBoxIncludes.AddItems IDE.CompilerIncPath + "\" + Search
IDE.ListIncludes(indx).AddItems IDE.CompilerIncPath + "\" + Search
END IF
END IF
END IF
END IF
ELSEIF (LEFT$(Search, 10) = "$RESOURCE ") THEN
Search = DELETE$(TRIM$( tmpList.Item(i) ), 1, 10)
CommFound = RINSTR(Search, sQuot)
IF CommFound > 0 THEN Search = RTRIM$(LEFT$(Search, CommFound-1))
CommFound = RINSTR(Search, Quot$)
IF CommFound > 0 THEN
MainListBoxResources.AddItems REPLACESUBSTR$(Search , Quot$ , "")
IDE.ListResources(indx).AddItems REPLACESUBSTR$(Search , Quot$ , "")
END IF
ELSEIF (LEFT$(Search, 8) = "PRIVATE ") OR (LEFT$(Search, 7) = "PUBLIC ") THEN
IF INSTR( LEFT$(Search, 12), " SUB ") THEN
SubFuncListView(indx).AddItems DELETE$(LTRIM$(tmpList.Item(i)), 1, 11) + SPACE$(90) + LineNumDelimitr + STR$(i) + LineNumDelimitr + "0"
Cnt++
SubsFound++
ELSE
IF INSTR( LEFT$(Search, 18), " FUNCTION ") THEN
SubFuncListView(indx).AddItems DELETE$(LTRIM$(tmpList.Item(i)), 1, 16) + SPACE$(90) + LineNumDelimitr + STR$(i) + LineNumDelimitr + "1"
Cnt++
SubsFound++
END IF
END IF
END IF
NEXT i
tmpList.Text = ""
MainListBoxIncludes.ItemIndex = 0
MainListBoxResources.ItemIndex = 0
IF IDE.SortSubs THEN SubFuncListView(indx).SortType = stText
FOR i = 0 TO SubFuncListView(indx).ItemCount-1
SubFuncListView(indx).Item(i).ImageIndex = VAL(FIELD$(SubFuncListView(indx).Item(i).CAPTION, LineNumDelimitr, 3))
NEXT i
IF IDE.ShowSubsAfterLoad THEN
ProjPanel.Visible = False
IncResPanel.Visible = False
FindAllPanel.Visible = False
SubFuncsPanel.Visible = True
TabControl3.TabIndex = 3
SubFuncListView(indx).Visible = True
SubFuncListView(indx).ItemIndex = 0
END IF
SCREEN.Cursor = 0
END SUB
SUB SubsCombo_Change_objects(Sender AS QCOMBOBOX)
DEFSTR tmp = FIELD$(Sender.Item(Sender.ItemIndex), LineNumDelimitr, 2)
DEFINT TheLineNum = VAL(tmp)
re.GotoLine(TheLineNum)
re.ActiveLineColor(RGB(255,200,128), 0)
IDE.HiLightTurnOFF = True
re.SetFocus
END SUB
SUB IDE_GotoLineNumber
gDialogLabel.CAPTION = "Go to line number:"
gListOkButton.Tag = 1
gDialogEdit.Text = ""
gDialogEdit.Width = 150
gDialogForm.Width = 270
gDialogOKButton.Left = 160
gDialogCancelButton.Left = 200
gDialogForm.Show
SetFocus gDialogEdit.Handle
END SUB
SUB IDE_NextParagraph
re.SetFocus
re.FindLocation(CRLF+CRLF, 0, 0, 0)
re.SetFocus
END SUB
SUB IDE_PrevParagraph
re.SetFocus
re.FindLocation(CRLF+CRLF, 0, 1, 1)
re.SetFocus
END SUB
SUB IDE_CopyNameToClip
Clipboard.OPEN
ClipBoard.Text = IDE.MFEActiveFile
ClipBoard.CLOSE
END SUB
SUB IDE_ExploreFolder_Click
ShellExecute (0, "Open", StripPath(IDE.MFEActiveFile), "", "", 1)
END SUB
SUB RedoClick
re.SendEditor(SCI_REDO, 0, 0)
IF re.GetEditor(SCI_CANREDO, 0, 0) = 0 THEN RedoMenu.Enabled = False ELSE RedoMenu.Enabled = True
END SUB
SUB UndoClick
re.SendEditor(SCI_UNDO, 0, 0)
END SUB
SUB CutClick
re.CutToClipboard
END SUB
SUB CopyClick
re.CopyToClipboard
END SUB
SUB PasteClick
re.PasteFromClipboard
re.Set_LineNumbers(Mnu_SetLineNumbers.Checked)
END SUB
SUB SelectAllClick
re.SelectAll
END SUB
SUB PrintClick
LPRINT re.Text
LFLUSH
END SUB
SUB IconsetClick
IF MESSAGEDLG("Set to default icon?", mtConfirmation, mbYes OR mbNo, 0) = mrNo THEN
DIM OpenDialog AS QOPENDIALOG
OpenDialog.CAPTION = "Open icon for application"
OpenDialog.FileName = IDE.IconName
OpenDialog.Filter = "Icon Files (*.ico)|*.ico"
IF OpenDialog.EXECUTE THEN
IF FILEEXISTS(OpenDialog.FileName) THEN
IDE.IconName = OpenDialog.FileName
IconsetFlatButton.Hint = IDE.IconName
IconsetFlatButton.Stretch = True
IconsetFlatButton.AutoSize = True
IconsetFlatButton.Icon = IDE.IconName
END IF
END IF
ELSE
IDE.IconName = ""
IconsetFlatButton.ICOHandle = RapidQ_ico
END IF
END SUB
SUB FBDLLClick
DEFSTR tmp = IDE.FBCommandLine
IDE.FBCommandLine = "-s gui -dll -b "
FBCompileClick
IDE.FBCommandLine = tmp
END SUB
SUB FBCompileClick
DEFSTR TheCurrDir = CURDIR$
DIM TheCompilerScript AS STRING
IDE.CompiledOK = False
IF IDE.SaveAllBeforeCompile THEN
MFE_SaveAll
ELSE
IF IDE.SaveFileBeforeCompile THEN MFE_Save
END IF
RichEditCompile.Clear
IF TRIM$(IDE.ScriptBeforeCompile) <> "" THEN Execute_ExternalApp(IDE.ScriptBeforeCompile)
TheCompilerScript = Quot$
IF IDE.FBCompilerPath <> "" THEN
TheCompilerScript = TheCompilerScript + IDE.FBCompilerPath + Quot$
ELSE
TheCompilerScript = TheCompilerScript + IDE_Conf_FBHelpFilePathEdit.Text + Quot$
END IF
DEFSTR TheExeName = IDE.MFEActiveFile
IF IDE.MainFileForCompiler <> "" THEN TheExeName = MFE_List.Item(MFE_GetFileIndex(IDE.MainFileForCompiler))
IF TRIM$(IDE.FBCommandLine) <> "" THEN
TheCompilerScript = TheCompilerScript + " " + TRIM$(IDE.FBCommandLine) + " " + Quote$(TheExeName) + " >DUMP.$$$"
ELSE
TheCompilerScript = TheCompilerScript + " " + Quote$(TheExeName) + " >DUMP.$$$"
END IF
RichEditCompile.AddStrings "Please wait, compiling..."
SetCompileDirectory(StripPath(TheExeName))
CHDIR IDE.Path
tmpList.Text = TheCompilerScript
RichEditCompile.AddStrings tmpList.Text
DOEVENTS
tmplist.SaveTofile "~~dump$$$.bat"
DEFINT PID = SHELL("~~dump$$$.bat" , 0)
RichEditCompile.AddStrings "Process ID Compiler = " + STR$(PID)
WaitForSingleObject(PID , &HFFFF)
DOEVENTS
tmpList.LoadFromFile "DUMP.$$$"
KILL "DUMP.$$$"
KILL "~~dump$$$.bat"
RichEditCompile.AddStrings tmpList.Text
DOEVENTS
DEFINT LineInDump = -1
DEFSTR TheErrLine = ""
DEFINT i
FOR i = 0 TO tmpList.ItemCount -1
TheErrLine = tmpList.Item(i)
IF (INSTR(TheErrLine, "(") ) < (INSTR(2, TheErrLine, ") error")) THEN
LineInDump = INSTR(TheErrLine, "(")
LineInDump = VAL(MID$(TheErrLine, LineInDump +1, INSTR(TheErrLine, ")") - LineInDump ) )
TheErrLine = TRIM$(LEFT$(TheErrLine, INSTR(TheErrLine, "(") -1))
TheErrLine = REPLACESUBSTR$(TheErrLine, "/", "\")
EXIT FOR
END IF
NEXT i
IF IDE.HiLightCompileErr THEN
IF (LineInDump > -1) THEN
i = MFE_GetFileIndex(TheErrLine)
IF i <> -1 THEN
MFE_ChangeToIndex(i)
RichEditCompile.AddStrings "Alt + <right click> to go to line"
re.GotoLine(LineInDump -1)
re.ActiveLineColor(RGB(255,200,128), 0)
IDE.HiLightTurnOFF = True
re.SetFocus
ELSE
SHOWMESSAGE "module " + TheErrLine + " not found in project"
END IF
END IF
END IF
CHDIR TheCurrDir
SCREEN.Cursor = crDefault
tmpList.Text = ""
tmpList.Clear
IDE.CompiledOK = True
END SUB
SUB FBrunClick
FBCompileClick
IF IDE.CompiledOK = False THEN EXIT SUB
DIM exeName AS STRING
IF IDE.MainFileForCompiler <> "" THEN
exeName = REPLACE$(IDE.MainFileForCompiler , ".exe" , LEN(IDE.MainFileForCompiler) - 3)
ELSE
exeName = REPLACE$(IDE.MFEActiveFile , ".exe" , LEN(IDE.MFEActiveFile) - 3)
END IF
SetCompileDirectory(StripPath(exeName))
CHDIR IDE.Path
RUN "rundll32.exe url.dll,FileProtocolHandler " & exename
END SUB
SUB CompileClick
IDE.CompiledOK = False
IF MFE_List.ItemCount = 0 THEN EXIT SUB
DEFSTR TheExeName = ""
DEFSTR TheCompilerScript = ""
DEFSTR TheCurrDir = CURDIR$
DEFINT PID = 0
DEFINT AddIcoAfterCompile = False
DEFINT i
SCREEN.Cursor = crHourGlass
IF IDE.TypeCheckOn THEN
IF IDE.MainFileForCompiler <> "" THEN
i = MFE_GetFileIndex(IDE.MainFileForCompiler)
ELSE
i = MFE_Tab.TabIndex
END IF
IF IDE.ModuleType(i) = 0 THEN IDE_InsertTypeCheck(i)
END IF
IF IDE.SaveAllBeforeCompile THEN
MFE_SaveAll
ELSE
IF IDE.SaveFileBeforeCompile THEN MFE_Save
END IF
IF IDE.DebugFileName = "" THEN
IF IDE.MainFileForCompiler <> "" THEN
IF FILEEXISTS(IDE.MainFileForCompiler) = False THEN
SHOWMESSAGE "File " + IDE.MainFileForCompiler + " does not exist"
SCREEN.Cursor = crDefault
EXIT SUB
END IF
TheExeName = MFE_List.Item( MFE_GetFileIndex(IDE.MainFileForCompiler) )
ELSE
TheExeName = IDE.MFEActiveFile
END IF
ELSE
TheExeName = IDE.DebugFileName
END IF
RichEditCompile.Clear
IF TRIM$(IDE.ScriptBeforeCompile) <> "" THEN
RichEditCompile.AddStrings "executing pre-script..."
Execute_ExternalApp(IDE.ScriptBeforeCompile)
END IF
TheCompilerScript = Quot$
IF IDE.CompilerPath <> "" THEN
TheCompilerScript = TheCompilerScript + IDE.CompilerPath + Quot$ + " "
ELSE
TheCompilerScript = TheCompilerScript + "rc.exe" + Quot$ + " "
END IF
TheCompilerScript = TheCompilerScript + "-r "
IF IDE.OptimizeOn THEN TheCompilerScript = TheCompilerScript + "-opt "
IF IDE.VerboseOn THEN TheCompilerScript = TheCompilerScript + "-vON "
IF IDE.ByteCodeOn THEN TheCompilerScript = TheCompilerScript + "-b "
IF IDE.CompilerLibPath <> "" THEN TheCompilerScript = TheCompilerScript + Quote$("-L" + IDE.CompilerLibPath) + " "
IF IDE.CompilerIncPath <> "" THEN TheCompilerScript = TheCompilerScript + Quote$("-I" + IDE.CompilerIncPath) + " "
IF IDE.IconName <> "" THEN
gFStream.OPEN(IDE.IconName , fmOpenRead)
i = gFStream.Size
gFStream.CLOSE
IF i = 766 THEN
TheCompilerScript = TheCompilerScript + "-g" + Quote$(IDE.IconName) + " "
ELSE
AddIcoAfterCompile = True
END IF
END IF
TheCompilerScript = TheCompilerScript + Quote$( TheExeName)
RichEditCompile.AddStrings "Please wait, compiling..." + TheCompilerScript
SetCompileDirectory(StripPath(TheExeName))
CHDIR IDE.Path
IF INSTR(TheExeName, ".") THEN TheExeName = FileNameNoExt(TheExeName) + ".exe"
DOEVENTS
PID = SHELL(TheCompilerScript , 1)
IF PID THEN
RichEditCompile.AddStrings "Process ID Compiler =" + STR$(PID)
DOEVENTS
WaitForSingleObject(PID , &HFFFF)
ELSE
SHOWMESSAGE "Error: cannot start compiler. Process already active?"
SCREEN.Cursor = crDefault
EXIT SUB
END IF
IF FILEEXISTS ("DUMP.$$$") = False THEN
RichEditCompile.AddStrings "Error, could not complete compile..."
EXIT SUB
END IF
tmpList.LoadFromFile "DUMP.$$$"
KILL "DUMP.$$$"
RichEditCompile.Text = tmpList.Text
DOEVENTS
DEFINT LineInDump = -1
DEFINT ColInDump
DEFSTR delimt$ = "", TheErrLine = ""
FOR i = 0 TO tmpList.ItemCount -1
TheErrLine = tmpList.Item(i)
IF (LEFT$(TheErrLine, 5) = "Line ") AND (INSTR(TheErrLine, ": ") > 0) THEN
TheErrLine = TheErrLine - "Line "
IF INSTR(TheErrLine, Comma) THEN delimt$ = Comma ELSE delimt$ = ":"
LineInDump = VAL(FIELD$(TheErrLine, delimt$, 1)) -1
ColInDump = VAL(FIELD$(TheErrLine, delimt$, 2))
END IF
IF (LEFT$(TheErrLine, 11) = "Can't open ") THEN
SHOWMESSAGE "Cannot open source or executable" + CRLF + "Current build already running?"
SCREEN.Cursor = crDefault
EXIT SUB
END IF
IF (LineInDump > -1) AND (MFE_List.ItemCount > 1) THEN
TheErrLine = tmpList.Item(i)
IF (LEFT$(TheErrLine, 15) = "File in error: ") THEN
TheErrLine = TRIM$(RIGHT$(TheErrLine, LEN(TheErrLine) - 15))
EXIT FOR
END IF
END IF
NEXT i
DEFINT FndIt
IF IDE.HiLightCompileErr THEN
FndIt = False
IF (LineInDump > -1) AND (MFE_List.ItemCount > 1) THEN
i = MFE_GetFileIndex(TheErrLine)
IF i <> -1 THEN
MFE_ChangeToIndex(i)
FndIt = True
ELSE
FOR i = 0 TO MFE_List.ItemCount -1
IF UCASE$(StripFileName(TheErrLine)) = UCASE$(StripFileName(MFE_List.Item(i))) THEN
MFE_ChangeToIndex(i)
FndIt = True
EXIT FOR
END IF
NEXT i
END IF
ELSE
FndIt = True
END IF
IF FndIt THEN
IF LineInDump > -1 THEN
RichEditCompile.AddStrings "Alt + <right click> to go to line"
re.GotoLine(LineInDump)
re.Set_Position(re.Position + ColInDump)
re.ActiveLineColor(RGB(255,200,128), 0)
IDE.HiLightTurnOFF = True
re.SetFocus
END IF
ELSE
SHOWMESSAGE "Cannot locate file " + TheErrLine + " in project"
END IF
IF (LineInDump > -1) THEN
CHDIR TheCurrDir
SCREEN.Cursor = crDefault
tmpList.Text = ""
tmpList.Clear
EXIT SUB
END IF
END IF
IF IDE.GenerateManifest OR IDE_Conf_ManifestEmbedCheckBox.Checked THEN
RichEditCompile.AddStrings "Generating Manifest..."
GenerateManifest (TheExeName)
END IF
DEFSTR myUPX = REPLACESUBSTR$(IDE.upx, "%CURRPATH%", CURDIR$)
myUPX = REPLACESUBSTR$(myUPX, "%APPPATH%", Application.Path)
myUPX = REPLACESUBSTR$(myUPX, "%PATH%", StripPath(IDE.MFEActiveFile))
DEFSTR myResHacker = REPLACESUBSTR$(IDE.ResHacker, "%CURRPATH%", CURDIR$)
myResHacker = REPLACESUBSTR$(myResHacker, "%APPPATH%", Application.Path)
myResHacker = REPLACESUBSTR$(myResHacker, "%PATH%", StripPath(IDE.MFEActiveFile))
IF (FILEEXISTS(myUPX)) AND (FILEEXISTS(myResHacker)) THEN
IF IDE.DecompressEXE = True THEN
RichEditCompile.AddStrings "decompressing file..."
PID = SHELL(Quote$(myUPX) + " -d " + Quote$(TheExeName) , 4)
DOEVENTS
IF PID THEN WaitForSingleObject(PID , &HFFFF)
DOEVENTS
SLEEP .100
END IF
IF (AddIcoAfterCompile OR IDE_Conf_VersionInfoCheckBox.Checked) THEN
IF IDE.DecompressEXE = False THEN
RichEditCompile.AddStrings "decompressing file..."
PID = SHELL(Quote$(myUPX) + " -d " + Quote$(TheExeName) , 4)
DOEVENTS
IF PID THEN WaitForSingleObject(PID , &HFFFF)
DOEVENTS
SLEEP .100
END IF
RichEditCompile.AddStrings "modifying resources..."
IF AddIcoAfterCompile THEN
RichEditCompile.AddStrings "Please Wait. Inserting icon..."
PID = SHELL(Quote$(myResHacker) + " -addoverwrite " + _
Quote$(TheExeName) + " , " + _
Quote$(TheExeName) + " , " + _
Quote$(IDE.IconName) + " , ICONGROUP,MAINICON,0" , 4)
DOEVENTS
IF PID THEN WaitForSingleObject(PID , &HFFFF)
DOEVENTS
SLEEP .100
END IF
IF IDE_Conf_VersionInfoCheckBox.Checked OR IDE_Conf_ManifestEmbedCheckBox.Checked THEN
IF FILEEXISTS(Application.Path + "\tools\gorc.exe") THEN
RichEditCompile.AddStrings "Please Wait. Creating resource script..."
IDE_GenerateResourceScript (TheExeName)
DEFSTR tmp2 = CURDIR$+"\"+TheExeName - ".exe" + ".rc"
IF FILEEXISTS(tmp2) = False THEN
SHOWMESSAGE "unable to generate compiled resource"
ELSE
SHELL(Application.Path + "\tools\gorc /r " + Quote$(tmp2))
KILL tmp2
tmp2 = CURDIR$+"\"+TheExeName - ".exe" + ".res"
PID = SHELL(CHR$(34)+IDE.ResHacker +CHR$(34)+ _
" -addoverwrite " + Quote$(TheExeName) + "," + _
Quote$(TheExeName) + "," +_
Quote$(tmp2) + ",,,")
IF PID THEN WaitForSingleObject(PID , &HFFFF)
DOEVENTS
KILL tmp2
KILL (tmp2 - ".res" + ".aps")
IF IDE_Conf_ManifestEmbedCheckBox.Checked THEN KILL TheExeName + ".manifest.xml"
END IF
END IF
END IF
IF IDE.DecompressExe = False THEN
RichEditCompile.AddStrings "compressing file..."
PID = SHELL(Quote$(IDE.upx) + " -9 " + Quote$(TheExeName) , 4)
IF PID THEN WaitForSingleObject(PID , &HFFFF)
DOEVENTS
SLEEP .100
END IF
END IF
ELSE
IF AddIcoAfterCompile THEN MESSAGEBOX("Cannot add icon: "+ IDE.IconName + CRLF + _
"Please set the location of UPX.exe and ResHacker.exe in Options." , MainForm.CAPTION , 48)
END IF
CHDIR TheCurrDir
SCREEN.Cursor = crDefault
tmpList.Text = ""
tmpList.Clear
IDE.CompiledOK = True
END SUB
SUB Runclick
IF MFE_List.ItemCount = 0 THEN EXIT SUB
IF IDE.MainFileForCompiler <> "" THEN
CompileClick
ELSE
SELECT CASE IDE.ModuleType(MFE_Tab.TabIndex)
CASE 0
CompileClick
CASE 1
FBCompileClick
CASE 2
FBDLLClick
CASE ELSE
SHOWMESSAGE "Module Type Error"
END SELECT
END IF
IF IDE.CompiledOK = False THEN EXIT SUB
IF (IDE.MainFileForCompiler = "") AND_
(IDE.ModuleType(MFE_Tab.TabIndex) = 2) THEN EXIT SUB
DIM exeName AS STRING
IF IDE.MainFileForCompiler <> "" THEN
IF INSTR(IDE.MainFileForCompiler, ".") THEN
exeName = FileNameNoExt(IDE.MainFileForCompiler) + ".exe"
ELSE
exeName = IDE.MainFileForCompiler + ".exe"
END IF
ELSE
IF INSTR(IDE.MFEActiveFile, ".") THEN
exeName = FileNameNoExt(IDE.MFEActiveFile) + ".exe"
ELSE
exeName = IDE.MFEActiveFile + ".exe"
END IF
END IF
CHDIR IDE.Path
RUN "rundll32.exe url.dll,FileProtocolHandler " & exename
END SUB
FUNCTION IsProjectFile(InFileName AS STRING) AS INTEGER
DEFSTR s = UCASE$(MFE_list.Text) , token
RESULT = False
IF INSTR(s, UCASE$(InFileName)) THEN RESULT = True
END FUNCTION
SUB DebugCompileClick
DEFSTR TheDebugScript = ""
DEFINT i = 0, j, k, brkptOffset = 0
DEFINT curTab = MFE_Tab.TabIndex
IF IDE.MainFileForCompiler <> "" THEN
i = MFE_GetFileIndex(IDE.MainFileForCompiler)
IF i = -1 THEN SHOWMESSAGE "File " + IDE.MainFileForCompiler + " not open": EXIT SUB
IF i <> curTab THEN MFE_ChangeToIndexSilent(i)
ELSE
i = curTab
END IF
tmpList.Clear
tmpList.Text = re.Text
IF tmpList.ItemCount < 1 THEN SHOWMESSAGE "no source code to compile" : EXIT SUB
RichEditCompile.AddStrings "starting debugger..."
IF FILEEXISTS(Application.Path + "\RapidDBG.exe") = True THEN
TheDebugScript = Application.Path + "\RapidDBG.exe"
ELSE
IF FILEEXISTS(Application.Path + "\tools\RapidDBG.exe") = True THEN
TheDebugScript = Application.Path + "\tools\RapidDBG.exe"
ELSE
SHOWMESSAGE "debugger not found," + CRLF + "please place RapidDBG.exe in the IDE folder"
EXIT SUB
END IF
END IF
SetCompileDirectory(StripPath(IDE.MFEActiveFile))
CHDIR IDE.Path
DEFSTR TheFilename = ""
DIM appendList AS QSTRINGLIST
appendList.Clear
DEFSTR TheSrcCode = ""
SetCompileDirectory(StripPath(IDE.MFEActiveFile))
FOR k = 0 TO tmpList.ItemCount -1
IF UCASE$(LEFT$(LTRIM$(tmpList.Item(k)), 9)) = "$INCLUDE " THEN
TheFilename = DELETE$(LTRIM$(tmpList.Item(k) ), 1, 9)
j = INSTR(TheFilename, Quot$)
IF j THEN
TheFilename = FIELD$(TheFilename, Quot$, 2)
ELSE
j = INSTR(TheFilename, "<")
IF j > 0 THEN
TheFilename = FIELD$(TheFilename, ">", 1)
TheFilename = TRIM$(REPLACESUBSTR$(TheFilename , "<" , ""))
END IF
END IF
TheFilename = UCASE$(TheFilename)
IF (TheFilename <> "RAPIDQ2.INC") AND (TheFilename <> "RAPIDQ.INC") AND _
(TheFilename <> "WINDOWS.INC") AND NOT!(IsProjectFile(TheFileName)) THEN
appendList.Clear
IF FILEEXISTS(TheFilename) THEN
appendList.LoadFromFile(TheFilename)
RichEditCompile.AddStrings "adding include file: " + TheFilename
ELSE
IF FILEEXISTS(IDE.CompilerIncPath + "\" + TheFilename) THEN
appendList.LoadFromFile(IDE.CompilerIncPath + "\" + TheFilename)
RichEditCompile.AddStrings "adding include file: " + TheFilename
ELSE
RichEditCompile.AddStrings "cannot find include file: " + IDE.CompilerIncPath + "\" + TheFilename
RichEditCompile.AddStrings "..."
END IF
END IF
TheSrcCode = TheSrcCode + appendList.Text
brkptOffset = brkptOffset + appendList.ItemCount
ELSE
TheSrcCode = TheSrcCode + tmpList.Item(k) + CRLF
END IF
ELSE
TheSrcCode = TheSrcCode + tmpList.Item(k) + CRLF
END IF
NEXT k
tmpList.Clear
tmplist.Text = TheSrcCode
tmpList.SaveToFile IDE.Path + cDebugFileName + ".bas"
tmpList.Clear
appendList.Text = RichEditCompile.Text
IDE.DebugFileName = IDE.Path + cDebugFileName + ".bas"
CompileClick
IDE.DebugFileName = ""
IF IDE.CompiledOK = False THEN EXIT SUB
RichEditCompile.Text = appendList.Text
appendList.Clear
RichEditCompile.AddStrings "First compile pass OK..."
DOEVENTS
TheDebugScript = TheDebugScript + " -d " + Quot$ + IDE.Path + cDebugFileName + ".bas" + Quot$
IF IDE.BookMarkCount(i) > 0 THEN
TheDebugScript = TheDebugScript + " -b "
FOR j = 1 TO IDE.BookMarkCount(i) -1
TheDebugScript = TheDebugScript + STR$(IDE.BookMark(i, j)+1) +","
NEXT j
TheDebugScript = TheDebugScript + STR$(IDE.BookMark(i, IDE.BookMarkCount(i))+1)
END IF
RichEditCompile.AddStrings TheDebugScript
SHELL TheDebugScript
RichEditCompile.AddStrings "cleaning up files..."
IF FILEEXISTS(IDE.Path + cDebugFileName + ".bas") THEN KILL IDE.Path + cDebugFileName + ".bas"
IF FILEEXISTS(IDE.Path + cDebugFileName + ".exe") THEN KILL IDE.Path + cDebugFileName + ".exe"
IF FILEEXISTS(IDE.Path + cDebugFileName + ".exe.manifest") THEN KILL IDE.Path + cDebugFileName + ".exe.manifest"
IF FILEEXISTS(IDE.Path + "~" + cDebugFileName + ".bas") THEN KILL IDE.Path + "~" + cDebugFileName + ".bas"
IF FILEEXISTS(IDE.Path + "~" + cDebugFileName + ".exe") THEN KILL IDE.Path + "~" + cDebugFileName + ".exe"
IF FILEEXISTS(IDE.Path + "~" + cDebugFileName + ".exe.manifest") THEN KILL IDE.Path + "~" + cDebugFileName + ".exe.manifest"
IF FILEEXISTS(IDE.Path + "DebugMap.txt") THEN KILL IDE.Path + "DebugMap.txt"
IF FILEEXISTS(IDE.Path + "RapidDBG.ico") THEN KILL IDE.Path + "RapidDBG.ico"
IF FILEEXISTS(IDE.Path + "RapidDBG.bmp") THEN KILL IDE.Path + "RapidDBG.bmp"
END SUB
SUB IDE_InsertTypeCheck(TheIndex AS INTEGER)
DEFINT i, j = MFE_Tab.TabIndex
MFE_ChangeToIndexSilent(TheIndex)
tmpList.Text = re.Text
i = 0
DEFINT FndIt = False
DO
IF UCASE$(LEFT$(tmpList.Item(i), 13)) = "$TYPECHECK ON" THEN FndIt = True
i++
LOOP UNTIL (i > 39) OR (i > tmpList.ItemCount-1) OR FndIt
IF FndIt = False THEN
MFE_GetCursor
re.Set_Position(0)
re.AddStrings("")
re.AddStrings("")
re.AddStrings("$TYPECHECK ON" + CRLF)
MFE_SetCursor
END IF
MFE_ChangeToIndex(j)
END SUB
SUB GenerateManifest (TheManifestExeName AS STRING)
DEFSTR TheFileName = TheManifestExeName
IF TheFileName = "" THEN TheFileName = IDE.MFEActiveFile
TheFileName = TheFileName + ".manifest"
IF FILEEXISTS(TheFileName) THEN KILL TheFileName
WITH tmpList
.Clear
.AddItems "<?xml version="+Quot$+"1.0"+Quot$+" encoding="+Quot$+"UTF-8"+Quot$+" standalone="+Quot$+"yes"+Quot$+"?>"
.AddItems "<assembly xmlns="+Quot$+"urn:schemas-microsoft-com:asm.v1"+Quot$+" manifestVersion="+Quot$+"1.0"+Quot$+">"
.AddItems "<assemblyIdentity"
.AddItems "version = "+Quot$+"1.0.0.0"+Quot$+""
.AddItems "processorArchitecture = "+Quot$+"X86"+Quot$+""
.AddItems "name = "+Quot$+"[].[].[]"+Quot$+""
.AddItems "type="+Quot$+"win32"+Quot$+""
.AddItems "/>"
.AddItems "<description></description>"
.AddItems "<dependency>"
.AddItems "<dependentAssembly>"
.AddItems "<assemblyIdentity"
.AddItems "type="+Quot$+"win32"+Quot$+""
.AddItems "name = "+Quot$+"Microsoft.Windows.Common-Controls"+Quot$+""
.AddItems "version = "+Quot$+"6.0.0.0"+Quot$+""
.AddItems "processorArchitecture = "+Quot$+"X86"+Quot$+""
.AddItems "publicKeyToken = "+Quot$+"6595b64144ccf1df"+Quot$+""
.AddItems "language = "+Quot$+"*"+Quot$+""
.AddItems "/>"
.AddItems "</dependentAssembly>"
.AddItems "</dependency>"
.AddItems "</assembly>"
.SaveToFile(TheFileName)
.Clear
END WITH
END SUB
SUB IDE_GenerateResourceScript(TheExeName AS STRING)
DEFSTR TheFileName = TheExeName
DEFSTR TheManifestName = TheExeName + ".manifest.xml"
IF UCASE$(RIGHT$(TheFileName, 3)) <> ".RC" THEN TheFileName = TheFileName - ".exe" + ".rc"
IF FILEEXISTS(TheFileName) THEN KILL TheFileName
WITH tmpList
.Clear
IF IDE_Conf_ManifestEmbedCheckBox.Checked THEN
RENAME TheExeName + ".manifest", TheManifestName
.AddItems "1 MANIFEST " + Quote$(TheManifestName)
.AddItems ""
END IF
IF IDE_Conf_VersionInfoCheckBox.Checked THEN
.AddItems "1 VERSIONINFO "
.AddItems "FILEVERSION " + IDE_Conf_VersionInfoGrid.Cell(1,1)
.AddItems "PRODUCTVERSION " + IDE_Conf_VersionInfoGrid.Cell(1,2)
.AddItems "FILEFLAGSMASK 0x0000003FL "
.AddItems "FILEFLAGS 0x0000000BL "
.AddItems "FILEOS " + IDE_Conf_VersionInfoGrid.Cell(1,3)
.AddItems "FILETYPE " + IDE_Conf_VersionInfoGrid.Cell(1,4)
.AddItems "FILESUBTYPE 0x00000000L "
.AddItems "BEGIN "
.AddItems "BLOCK " + Quote$("StringFileInfo")
.AddItems "BEGIN "
.AddItems "BLOCK " + Quote$("040904E4")
.AddItems "BEGIN "
.AddItems "VALUE " + Quote$("CompanyName") + ", " + Quote$(IDE_Conf_VersionInfoGrid.Cell(1,6))
IF IDE_Conf_VersionInfoGrid.Cell(1,7) <> "" THEN .AddItems "VALUE " + Quote$ ("Contact e-mail") + ", " + Quote$(IDE_Conf_VersionInfoGrid.Cell(1,7))
IF IDE_Conf_VersionInfoGrid.Cell(1,8) <> "" THEN .AddItems "VALUE " + Quote$("FileDescription") + ", " + Quote$(IDE_Conf_VersionInfoGrid.Cell(1,8))
IF IDE_Conf_VersionInfoGrid.Cell(1,9) <> "" THEN .AddItems "VALUE " + Quote$("FileVersion") + ", " + Quote$(IDE_Conf_VersionInfoGrid.Cell(1,9))
IF IDE_Conf_VersionInfoGrid.Cell(1,10) <> "" THEN .AddItems "VALUE " + Quote$("DevelopmentFile") + ", " + Quote$(IDE_Conf_VersionInfoGrid.Cell(1,10))
IF IDE_Conf_VersionInfoGrid.Cell(1,11) <> "" THEN .AddItems "VALUE " + Quote$("LegalCopyright") + ", " + Quote$(IDE_Conf_VersionInfoGrid.Cell(1,11))
IF IDE_Conf_VersionInfoGrid.Cell(1,12) <> "" THEN .AddItems "VALUE " + Quote$(IDE_Conf_VersionInfoGrid.Cell(0,12)) + "," + Quote$(IDE_Conf_VersionInfoGrid.Cell(1,11))
.AddItems "END"
.AddItems "END"
.AddItems "BLOCK " + Quote$("VarFileInfo")
.AddItems "BEGIN"
.AddItems "VALUE " + Quote$("Translation") + ", 0x0409,1252"
.AddItems "END"
.AddItems "END"
END IF
.SaveToFile(TheFileName)
.Clear
END WITH
END SUB
SUB RightPanelCollapse_Click
IF FindAllPanel.Visible THEN FindTreeView.FullCollapse
END SUB
SUB RightPanelExpand_Click
IF FindAllPanel.Visible THEN FindTreeView.FullExpand
END SUB
SUB ExportPanelText_Click(Sender AS QBUTTON)
DEFSTR TxtToAdd = ""
DEFINT i
IF Sender.Handle = RightPanelExportBut.Handle THEN
IF ProjPanel.Visible THEN
FOR i = 0 TO ProjFileList.ItemCount -1
TxtToAdd = TxtToAdd + ProjFileList.Item(i) + CRLF
NEXT i
END IF
IF IncResPanel.Visible THEN
TxtToAdd = MainListBoxIncludes.Text
TxtToAdd = TxtToAdd + CRLF + CRLF + CRLF
TxtToAdd = TxtToAdd + MainListBoxResources.Text
END IF
IF FindAllPanel.Visible THEN
FOR i = 0 TO FindTreeView.ItemCount -1
TxtToAdd = TxtToAdd + RTRIM$(FIELD$(FindTreeView.Item(i).Text, "]", 2)) + CRLF
NEXT i
END IF
IF SubFuncsPanel.Visible THEN
FOR i = 0 TO SubFuncListView(MFE_Tab.TabIndex).ItemCount -1
TxtToAdd = TxtToAdd + RTRIM$(FIELD$(SubFuncListView(MFE_Tab.TabIndex).Item(i).CAPTION, LineNumDelimitr, 1)) + CRLF
NEXT i
END IF
ELSE
TxtToAdd = SubsCombo_objects.Text
END IF
IF TxtToAdd <> "" THEN
MFE_NewFile
re.AddStrings TxtToAdd
END IF
END SUB
SUB RightTabChange
DEFINT i
SELECT CASE TabControl3.TabIndex
CASE 0
ProjPanel.Visible = True
IncResPanel.Visible = False
FindAllPanel.Visible = False
SubFuncsPanel.Visible = False
CASE 1
ProjPanel.Visible = False
IncResPanel.Visible = True
FindAllPanel.Visible = False
SubFuncsPanel.Visible = False
MainListBoxIncludes.Text = IDE.ListIncludes(MFE_Tab.TabIndex).Text
MainListBoxResources.Text = IDE.ListResources(MFE_Tab.TabIndex).Text
CASE 2
ProjPanel.Visible = False
IncResPanel.Visible = False
FindAllPanel.Visible = True
FindAllPanel.Width = RightPanel.ClientWidth - RightSplitter.Width
SubFuncsPanel.Visible = False
CASE 3
ProjPanel.Visible = False
IncResPanel.Visible = False
FindAllPanel.Visible = False
SubFuncsPanel.Visible = True
SubFuncsPanel.Width = RightPanel.ClientWidth - RightSplitter.Width
SubFuncsPanel.Height = TabControl3.ClientHeight
FOR i = 0 TO IDE_MAX_FILES
SubFuncListView(i).Visible = False
NEXT i
SubFuncListView(MFE_Tab.TabIndex).Visible = True
END SELECT
END SUB
SUB ChangeDirectories
ProjFileList.Directory = DirTree.Directory
IF (IDE.UseAppDirectory = False) AND (IDE.ConstPath = "") THEN
IDE.Path = DirTree.Directory
END IF
END SUB
SUB SetCompileDirectory(TheDefaultDir AS STRING)
IF IDE.UseAppDirectory THEN IDE.Path = TheDefaultDir : EXIT SUB
IF IDE.ConstPath <> "" THEN
IDE.Path = IDE.ConstPath
IF RIGHT$(IDE.Path, 1) <> "\" THEN IDE.Path = IDE.Path + "\"
EXIT SUB
END IF
IDE.Path = CURDIR$ + "\"
END SUB
FUNCTION GetResourceFileName (inText AS STRING) AS STRING
DEFINT i = INSTR(UCASE$(inText), " AS ") + 4
IF i > 0 THEN inText = TRIM$(MID$(inText, i, LEN(inText) -i +1))
RESULT = ""
IF FILEEXISTS(inText) THEN RESULT = inText :EXIT FUNCTION
IF FILEEXISTS(CURDIR$ + "\" + inText) THEN
RESULT = CURDIR$ + "\" + inText
EXIT FUNCTION
END IF
IF LEFT$(inText, 2) = ".\" THEN
IF FILEEXISTS(Application.Path + RIGHT$(inText, LEN(inText)-1)) THEN
RESULT = Application.Path + RIGHT$(inText, LEN(inText)-1)
EXIT FUNCTION
END IF
END IF
IF LEFT$(inText, 3) = "..\" THEN
IF FILEEXISTS(CURDIR$ + RIGHT$(inText, LEN(inText)-2)) THEN
RESULT = CURDIR$ + RIGHT$(inText, LEN(inText)-2)
EXIT FUNCTION
END IF
END IF
IF FILEEXISTS(StripPath(IDE.MFEActiveFile) + inText) THEN
RESULT = StripPath(IDE.MFEActiveFile) + inText
EXIT FUNCTION
END IF
IF FILEEXISTS(IDE.CompilerIconPath + inText) THEN
RESULT = IDE.CompilerIconPath + inText
EXIT FUNCTION
END IF
END FUNCTION
SUB ResourceListFileSelect
DEFSTR s = MainListBoxResources.Item(MainListBoxResources.ItemIndex)
DEFSTR totalfilename = UCASE$(GetResourceFileName(s))
DEFSTR theExt = StripFileExt(totalfilename)
IF (totalfileName <> "") AND INSTR(".BMP.JPG.JPEG.ICO.GIF.RLE.DIB.TGA.PCX", theExt) THEN
Stat.Panel(5).CAPTION = "Viewing: " + totalfilename
ImageViewerLoad(totalfilename)
ELSE
IDEimageViewerForm.CLOSE
Stat.Panel(5).CAPTION = "Not found or not image: " + totalfilename
END IF
END SUB
SUB ResourceListFileEdit
DEFSTR s = TRIM$(MainListBoxResources.Item(MainListBoxResources.ItemIndex))
DEFSTR totalfilename = GetResourceFileName(s)
DEFSTR theExt = UCASE$(StripFileExt(totalfilename))
IF INSTR(".BMP.JPG.JPEG.PNG.ICO.GIF.DIB.TGA.PCX", theExt) THEN
Stat.Panel(5).CAPTION = "Editing: " + totalfilename
WinExec "mspaint.exe " + totalfilename, 10
END IF
END SUB
SUB IncludeListFileSelect
DEFINT i
DEFSTR totalfilename = TRIM$(MainListBoxIncludes.Item(MainListBoxIncludes.ItemIndex))
i = INSTR(totalfilename, "'")
IF i > 0 THEN
totalfilename = LEFT$(totalfilename, i-1)
totalfilename = TRIM$(totalfilename)
END IF
IF LEFT$(totalfilename, 1) = "<" THEN
totalfilename = MID$(totalfilename, 2, INSTR(totalfilename, ">") -2)
IF FILEEXISTS(IDE.CompilerIncPath + "\" + totalfilename) THEN
totalfilename = IDE.CompilerIncPath + "\" + totalfilename
END IF
END IF
IF FILEEXISTS(totalfilename) = False THEN
IF FILEEXISTS(CURDIR$ + "\" + totalfilename) THEN
totalfilename = CURDIR$ + "\" + totalfilename
ELSEIF LEFT$(totalfilename, 2) = ".\" THEN
IF FILEEXISTS(Application.Path + RIGHT$(totalfilename, LEN(totalfilename)-1)) THEN
totalfilename = Application.Path + RIGHT$(totalfilename, LEN(totalfilename)-1)
END IF
ELSEIF LEFT$(totalfilename, 3) = "..\" THEN
IF FILEEXISTS(CURDIR$ + RIGHT$(totalfilename, LEN(totalfilename)-2)) THEN
totalfilename = CURDIR$ + RIGHT$(totalfilename, LEN(totalfilename)-2)
END IF
ELSEIF FILEEXISTS(StripPath(IDE.MFEActiveFile) + totalfilename) THEN
totalfilename = StripPath(IDE.MFEActiveFile) + totalfilename
ELSEIF FILEEXISTS(IDE.CompilerIncPath + "\" + totalfilename) THEN
totalfilename = IDE.CompilerIncPath + "\" + totalfilename
ELSE
totalFileName = ""
END IF
END IF
IF totalfileName <> "" THEN
MFE_Load(totalfilename)
Stat.Panel(5).CAPTION = "Loaded: " + totalfilename
ELSE
IF MESSAGEDLG("Include file not found, attempt download?", mtInformation, mbYes OR mbNo, 0) = mrYes THEN
totalfilename = "http://rapidq.phatcode.net/include/" + MainListBoxIncludes.Item(MainListBoxIncludes.ItemIndex)
IF IDE_InsertWebFile(totalfilename) = False THEN ShellExecute(0,"open","http://rapidq.phatcode.net/include/","","",1)
END IF
END IF
END SUB
SUB DirListFileSelect
DEFSTR Thefilename = ProjFileList.Filename
IF FILEEXISTS(Thefilename) THEN MFE_Load(Thefilename)
Splitter_Moved
END SUB
SUB MFE_NewFile
MFE_MakeNewFile("")
re.SetFocus
END SUB
SUB MFE_MakeNewFile(TheNewName AS STRING)
IF MFE_list.ItemCount -1 > IDE_MAX_FILES THEN
SHOWMESSAGE "Sorry, maximum open files reached"
EXIT SUB
END IF
IF CenterPanel.Visible = False THEN CenterPanel.Visible = True
IDE.NewFileIndex++
IF TheNewName = "" THEN TheNewName = CURDIR$ + "\" + IDE.NewFileName + STR$(IDE.NewFileIndex) + ".bas"
IDE.MFEActiveFile = TheNewName
MFE_Tab.AddTabs StripFilename(IDE.MFEActiveFile)
MFE_List.AddItems IDE.MFEActiveFile
MFE_Tab.TabIndex = MFE_List.ItemCount - 1
IF MFE_Tab.TabIndex = 0 THEN
IDE.DocPtr(MFE_Tab.TabIndex) = re.GetEditor(SCI_GETDOCPOINTER, 0, 0)
re.SendEditor(SCI_ADDREFDOCUMENT, 0, IDE.DocPtr(MFE_Tab.TabIndex))
ELSE
IDE.LastTab = IDE.CurrTab
IDE.DocPtr(MFE_Tab.TabIndex) = re.GetEditor(SCI_CREATEDOCUMENT, 0, 0)
re.SendEditor(SCI_SETDOCPOINTER, 0, IDE.DocPtr(MFE_Tab.TabIndex))
END IF
IF IDE.DocPtr(MFE_Tab.TabIndex) = 0 THEN
SHOWMESSAGE "Unknown Scintilla load Error"
MFE_List.DelItems(MFE_Tab.TabIndex)
MFE_Delete(MFE_tab , MFE_Tab.TabIndex)
EXIT SUB
ELSE
re.Clear
re.Set_Selstart(0)
Splitter_Moved
IF Mnu_SetLineNumbers.Checked THEN re.Set_LineNumbers(1000)
re.Set_TabWidth(IDE.TabSpaces)
re.Set_WantTabs(IDE.UseTabs)
re.Set_CodePage(IDE.CodePage)
IDE.LexLanguage(MFE_Tab.TabIndex) = IDE.DefaultLexLanguage
IDE_SetModuleType
IF IDE.HiLighting THEN
IDE_SetHighlighting(IDE.LexLanguage(MFE_Tab.TabIndex))
END IF
ParseSubIncRes(MFE_Tab.TabIndex, re.Text)
IDE.CurrTab = MFE_Tab.TabIndex
END IF
LeftPanelRefresh
END SUB
SUB MFE_Backup
WITH gFStream
.OPEN(Fullpathnoext(IDE.MFEActiveFile) + IDE.BackupFilesExt , fmCreate)
.WriteStr(re.Text , LEN(re.Text))
.CLOSE
Stat.Panel(5).CAPTION = "Backup: " + IDE.MFEActiveFile + IDE.BackupFilesExt
END WITH
END SUB
SUB MFE_UpdateSaveButton
IF re.Modified THEN
SaveToolBtn.Enabled = True
ELSE
SaveToolBtn.Enabled = False
END IF
END SUB
SUB MFE_ChangeActive
IDE.LastTab = IDE.CurrTab
IDE.CurrTab = MFE_Tab.TabIndex
DEFINT pDoc = re.GetEditor(SCI_GETDOCPOINTER, 0, 0)
re.SendEditor(SCI_ADDREFDOCUMENT, 0, pDoc)
IDE.MFEActiveFile = MFE_List.Item(MFE_Tab.TabIndex)
re.SendEditor(SCI_SETDOCPOINTER, 0, IDE.DocPtr(MFE_Tab.TabIndex))
MFE_SetCursor
RightTabChange
IF LeftPanel.Visible THEN LoadProjectTree(MFE_Tab.TabIndex, re.Text)
re.SetFocus
MFE_UpdateSaveButton
re.Set_LineNumbers(Mnu_SetLineNumbers.Checked)
END SUB
SUB MFE_ChangeToIndexSilent(TheIndex AS INTEGER)
DEFINT pDoc = re.GetEditor(SCI_GETDOCPOINTER, 0, 0)
re.SendEditor(SCI_ADDREFDOCUMENT, 0, pDoc)
MFE_Tab.TabIndex = TheIndex
re.SendEditor(SCI_SETDOCPOINTER, 0, IDE.DocPtr(TheIndex))
END SUB
SUB MFE_ChangeToIndex(TheIndex AS INTEGER)
IF MFE_Tab.TabIndex <> IDE.LastTab THEN IDE.LastTab = IDE.CurrTab : IDE.CurrTab =TheIndex
MFE_ChangeToIndexSilent(TheIndex)
IDE.MFEActiveFile = MFE_List.Item(TheIndex)
MFE_SetCursor
RightTabChange
IF LeftPanel.Visible THEN LoadProjectTree(MFE_Tab.TabIndex, re.Text)
re.SetFocus
MFE_UpdateSaveButton
re.Set_LineNumbers(Mnu_SetLineNumbers.Checked)
END SUB
FUNCTION MFE_Load(TheFileName AS STRING) AS INTEGER
IF MFE_list.ItemCount -1 > IDE_MAX_FILES THEN
SHOWMESSAGE "Sorry, maximum open files reached"
EXIT FUNCTION
END IF
DEFINT i = MFE_GetFileIndex(TheFileName)
IF i <> -1 THEN
MFE_ChangeToIndex(i)
RESULT = False
EXIT FUNCTION
END IF
IF FILEEXISTS(TheFileName) THEN
IF CenterPanel.Visible = False THEN CenterPanel.Visible = True
MFE_Tab.AddTabs StripFilename(TheFileName)
MFE_List.AddItems TheFileName
MFE_Tab.TabIndex = MFE_List.ItemCount - 1
IF MFE_Tab.TabIndex = 0 THEN
re.LoadFromFile TheFileName
re.SendEditor(SCI_EMPTYUNDOBUFFER, 0, 0)
IDE.DocPtr(MFE_Tab.TabIndex) = re.GetEditor(SCI_GETDOCPOINTER, 0, 0)
re.SendEditor(SCI_ADDREFDOCUMENT, 0, IDE.DocPtr(MFE_Tab.TabIndex))
ELSE
IDE.DocPtr(MFE_Tab.TabIndex) = re.GetEditor(SCI_CREATEDOCUMENT, 0, 0)
re.SendEditor(SCI_SETDOCPOINTER, 0, IDE.DocPtr(MFE_Tab.TabIndex))
re.LoadFromFile TheFileName
re.SendEditor(SCI_EMPTYUNDOBUFFER, 0, 0)
END IF
IF IDE.DocPtr(MFE_Tab.TabIndex) = 0 THEN
SHOWMESSAGE "Unknown Scintilla load Error"
RESULT = False
EXIT FUNCTION
END IF
IDE.MFEActiveFile = TheFileName
IF IDE.BackupFiles THEN MFE_Backup
IDE_UpdateRecentList
re.Set_LineNumbers(Mnu_SetLineNumbers.Checked)
re.Set_TabWidth(IDE.TabSpaces)
re.Set_WantTabs(IDE.UseTabs)
re.Set_CodePage(IDE.CodePage)
IDE_SetModuleType
IF = UCASE$(StripFileExt(TheFileName)) = ".BI" THEN
IDE.ModuleType(MFE_Tab.TabIndex) = 1
END IF
IDE.LexLanguage(MFE_Tab.TabIndex) = GetLanguageFromFile(TheFileName)
IF IDE.HiLighting THEN
IDE_SetHighlighting(IDE.LexLanguage(MFE_Tab.TabIndex))
END IF
ParseSubIncRes(MFE_Tab.TabIndex, re.Text)
IF LeftPanel.Visible THEN LoadProjectTree(MFE_Tab.TabIndex, re.Text)
Splitter_Moved
IDE.CurrTab = MFE_Tab.TabIndex
RESULT = True
ELSE
Stat.Panel(5).CAPTION = TheFileName + " not found..."
RESULT = False
END IF
END FUNCTION
SUB MFE_Open
DIM i AS INTEGER
fDialog.CAPTION = "Open Files"
fDialog.Filter = IDE.FileFilter
fDialog.FileName = ""
fDialog.InitialDir = Strippath(IDE.MFEActiveFile)
fDialog.Mode = fdOpen
fDialog.MultiSelect = True
IF fDialog.EXECUTE THEN
FOR i = 1 TO fDialog.SelCount
MFE_Load(fDialog.Files(0)+fDialog.Files(i))
NEXT i
Splitter_Moved
END IF
END SUB
FUNCTION MFE_SaveCopyAs() AS STRING
DIM SavDialog AS QSAVEDIALOG
SavDialog.FileName = IDE.MFEActiveFile
SavDialog.Filter = IDE.FileFilter
RESULT = ""
IF SavDialog.EXECUTE THEN
re.SaveToFile(SavDialog.FileName)
re.SendEditor(SCI_SETSAVEPOINT, 0&, 0&)
RESULT = SavDialog.FileName
MFE_UpdateSaveButton
END IF
END FUNCTION
SUB MFE_Save
IF IDE.NewFileAutoSave = False THEN
DEFSTR tmp = FileNameNoExt(IDE.MFEActiveFile)
IF (LEFT$(tmp, LEN(IDE.NewFileName)) = IDE.NewFileName) AND (LEN(tmp) <= LEN(IDE.NewFileName)+1) THEN
tmp = MFE_SaveCopyAs
IF tmp <> "" THEN
IDE.MFEActiveFile = tmp
MFE_Tab.Tab(MFE_Tab.TabIndex) = Stripfilename(IDE.MFEActiveFile)
MFE_List.Item(MFE_Tab.TabIndex) = tmp
END IF
END IF
END IF
re.SaveToFile(IDE.MFEActiveFile)
re.SendEditor(SCI_SETSAVEPOINT, 0&, 0&)
Stat.Panel(5).CAPTION = "Saved " + IDE.MFEActiveFile
MFE_UpdateSaveButton
END SUB
SUB MFE_SaveAs
IF MFE_List.ItemCount > 0 THEN
DIM sDialog AS QSAVEDIALOG
sDialog.FileName = IDE.MFEActiveFile
sDialog.Filter = IDE.FileFilter + "|Html|*.htm;*.html"
IF sDialog.EXECUTE THEN
DEFSTR myExt = UCASE$(StripFileExt(sDialog.FileName))
IF myExt <> ".HTML" AND myExt <> ".HTM" THEN
re.SaveToFile(sDialog.FileName)
re.SendEditor(SCI_SETSAVEPOINT, 0&, 0&)
IDE.MFEActiveFile = sDialog.FileName
MFE_Tab.Tab(MFE_Tab.TabIndex) = StripFileName(sDialog.FileName)
MFE_List.Item(MFE_Tab.TabIndex) = sDialog.FileName
ELSE
File2Html(re.Text, sDialog.FileName, False)
END IF
Stat.Panel(5).CAPTION = "Saved as " + sDialog.FileName
IDE_UpdateRecentList
MFE_UpdateSaveButton
END IF
END IF
END SUB
SUB MFE_SaveAll
DEFINT i, lastIndx = MFE_Tab.TabIndex
DEFSTR tmp
MFE_SetCursor
re.Visible = False
FOR i = 0 TO MFE_List.ItemCount-1
MFE_ChangeToIndexSilent(i)
IF re.Modified THEN
IF IDE.NewFileAutoSave = False THEN
tmp = FileNameNoExt(MFE_List.Item(i))
IF (LEFT$(tmp, LEN(IDE.NewFileName)) = IDE.NewFileName) AND (LEN(tmp) <= LEN(IDE.NewFileName)+1) THEN
tmp = MFE_SaveCopyAs
IF tmp <> "" THEN
IDE.MFEActiveFile = tmp
MFE_TAb.Tab(MFE_Tab.TabIndex) = Stripfilename(IDE.MFEActiveFile)
MFE_List.Item(MFE_Tab.TabIndex) = tmp
re.SaveToFile(IDE.MFEActiveFile)
re.SendEditor(SCI_SETSAVEPOINT, 0&, 0&)
END IF
END IF
END IF
re.SaveToFile(MFE_List.Item(i))
re.SendEditor(SCI_SETSAVEPOINT, 0&, 0&)
END IF
NEXT i
re.Visible = True
Stat.Panel(5).CAPTION = "Saved all"
MFE_UpdateSaveButton
MFE_ChangeToIndex(lastIndx)
MFE_SetCursor
END SUB
FUNCTION MFE_GetFileIndex(name AS STRING) AS INTEGER
DEFINT i, res = -1
FOR i = 0 TO MFE_List.ItemCount-1
IF UCASE$(name) = UCASE$(MFE_List.Item(i)) THEN res = i: EXIT FOR
NEXT i
RESULT = res
END FUNCTION
SUB MFE_Delete(tc AS QTABCONTROL , id AS INTEGER)
tc.DelTabs id
END SUB
SUB MFE_Close
IF MFE_List.ItemCount = 0 THEN EXIT SUB
IF MFE_Tab.TabIndex < 0 THEN EXIT SUB
DEFINT i
IDE.CancelOnClose = False
IF (re.Modified) THEN
DEFINT MyVis = re.Visible
DEFINT MyEnable = re.Enabled
IF MyVis = False THEN re.Visible = True
IF MyEnable = False THEN re.Enabled = True
i = MESSAGEDLG(IDE.MFEActiveFile + " has changed. Save Changes ?" , mtConfirmation , mbYes OR mbNo OR mbCancel , 0)
IF MyVis = False THEN re.Visible = MyVis
IF MyEnable = False THEN re.Enabled = MyEnable
IF i = mrYes THEN MFE_Save
IF i = mrCancel THEN IDE.CancelOnClose = True: EXIT SUB
END IF
DEFINT pDoc, indx = MFE_Tab.TabIndex
IF MFE_List.ItemCount-1 = 0 THEN
IDE.DocPtr(MFE_Tab.TabIndex) = 0
MFE_Delete(MFE_tab , indx)
MFE_List.DelItems(indx)
IDE.MFEActiveFile = ""
IDE.CursorPos(indx) = 0 :IDE.AnchorPos(indx) = 0 :IDE.FirstLine(indx) = 0
IDE.BookMarkCount(indx) = 0
MEMSET(VARPTR(IDE.BookMark(indx, 0)), -1, (IDE_MAX_FILES+1) * SIZEOF(INTEGER))
SubFuncListView(indx).Clear
IDE.ListIncludes(indx).Clear
IDE.ListResources(indx).Clear
IDE.LexLanguage(indx) = IDE.DefaultLexLanguage
IDE.ModuleType(indx) = 0
CenterPanel.Visible = False
re.Clear
ELSE
SELECT CASE MFE_Tab.TabIndex
CASE -1
CASE (MFE_List.ItemCount -1)
re.SendEditor(SCI_SETDOCPOINTER, 0, IDE.DocPtr(MFE_Tab.TabIndex-1))
pDoc = IDE.DocPtr(MFE_Tab.TabIndex)
re.SendEditor(SCI_RELEASEDOCUMENT, 0, pDoc)
IDE.DocPtr(MFE_Tab.TabIndex) = 0
IDE.CursorPos(MFE_Tab.TabIndex) = 0
IDE.AnchorPos(MFE_Tab.TabIndex) = 0
IDE.FirstLine(MFE_Tab.TabIndex) = 0
IDE.BookMarkCount(MFE_Tab.TabIndex) = 0
MEMSET(VARPTR(IDE.BookMark(MFE_Tab.TabIndex, 0)), -1, (IDE_MAX_FILES+1) * SIZEOF(INTEGER))
MFE_Delete(MFE_tab , indx)
MFE_List.DelItems(indx)
IDE.MFEActiveFile = MFE_List.Item(indx-1)
MFE_Tab.TabIndex = indx-1
SubFuncListView(indx).Clear
IDE.ListIncludes(indx).Clear
IDE.ListResources(indx).Clear
IDE.LexLanguage(MFE_Tab.TabIndex) = IDE.DefaultLexLanguage
IDE_SetModuleType
MFE_SetCursor
CASE ELSE
DEFINT j, k, n
DEFSTR lne
MFE_Delete(MFE_tab , indx)
pDoc = IDE.DocPtr(indx)
FOR i = indx TO (MFE_List.ItemCount -2)
IDE.DocPtr(i) = IDE.DocPtr(i+1)
MFE_List.Item(i) = MFE_List.Item(i+1)
IDE.CursorPos(i) = IDE.CursorPos(i+1)
IDE.AnchorPos(i) = IDE.AnchorPos(i+1)
IDE.FirstLine(i) = IDE.FirstLine(i+1)
IDE.BookMarkCount(i) = IDE.BookMarkCount(i+1)
FOR k = 0 TO IDE_MAX_FILES
IDE.BookMark(i,k) = IDE.BookMark(i+1,k)
NEXT k
IDE.ListIncludes(i).Text = IDE.ListIncludes(i+1).Text
IDE.ListResources(i).Text = IDE.ListResources(i+1).Text
IDE.LexLanguage(i) = IDE.LexLanguage(i+1)
IDE.ModuleType(i) = IDE.ModuleType(i+1)
n = SubFuncListView(i+1).ItemCount
SubFuncListView(i).Clear
SubFuncListView(i).Tag = SubFuncListView(i+1).Tag
FOR j = 0 TO n-1
lne = SubFuncListView(i+1).Item(j).CAPTION
SubFuncListView(i).AddItems lne
SubFuncListView(i).Item(j).ImageIndex = VAL(FIELD$(lne, LineNumDelimitr, 3))
NEXT j
NEXT i
IDE.DocPtr(MFE_List.ItemCount -1) = 0
SubFuncListView(MFE_List.ItemCount -1).Clear
SubFuncListView(MFE_List.ItemCount -1).Tag = MFE_List.ItemCount -1
IDE.ListIncludes(MFE_List.ItemCount -1).Clear
IDE.ListResources(MFE_List.ItemCount -1).Clear
MFE_List.DelItems(MFE_List.ItemCount -1)
re.SendEditor(SCI_SETDOCPOINTER, 0, IDE.DocPtr(indx))
re.SendEditor(SCI_RELEASEDOCUMENT, 0, pDoc)
IDE.MFEActiveFile = MFE_List.Item(indx)
MFE_Tab.TabIndex = indx
END SELECT
END IF
IF LeftPanel.Visible THEN Properties_Clear
re.Set_LineNumbers(Mnu_SetLineNumbers.Checked)
MFE_GetCursor
RightTabChange
IDE.CurrTab = MFE_Tab.TabIndex
END SUB
SUB MFE_CloseAllExceptActive
IF MFE_Tab.TabIndex > -1 THEN
DEFSTR TheTabFile = MFE_List.Item(MFE_Tab.TabIndex)
DIM i AS INTEGER
MFE_ChangeToIndex(MFE_List.ItemCount - 1)
DO
FOR i = (MFE_List.ItemCount - 1) TO 0 STEP -1
MFE_ChangeToIndexSilent(i)
IF MFE_List.Item(i) <> TheTabFile THEN MFE_Close
IF IDE.CancelOnClose THEN EXIT FOR
NEXT i
IF IDE.CancelOnClose THEN EXIT DO
LOOP UNTIL MFE_List.ItemCount = 1
END IF
re.Set_LineNumbers(Mnu_SetLineNumbers.Checked)
IDE.CurrTab = MFE_Tab.TabIndex
END SUB
SUB MFE_CloseAll
IF MFE_List.ItemCount = 0 THEN EXIT SUB
MFE_ChangeToIndex(MFE_List.ItemCount - 1)
DIM i AS INTEGER
re.Enabled = False
re.Visible = False
FOR i = 0 TO MFE_List.ItemCount - 1
MFE_Close
IF IDE.CancelOnClose THEN EXIT FOR
NEXT i
re.Visible = True
re.Enabled = True
IF IDE.CancelOnClose THEN EXIT SUB
MainListBoxResources.Clear
MainListBoxIncludes.Clear
FindTreeView.Clear
CenterPanel.Visible = False
IDE.LastTab = -1
IDE.CurrTab = -1
IDE.MainFileForCompiler = ""
IDE.MFEActiveProject = ""
IDE.MFEActiveFile = ""
END SUB
SUB MFE_LoadProject(TheFileName AS STRING)
DEFSTR OrigName = ini.FileName
ini.FileName = TheFileName
IF (ini.Exist = 0) THEN
SHOWMESSAGE "Project file: " + TheFileName + " not found"
ini.FileName = OrigName
EXIT SUB
END IF
IF MFE_List.ItemCount > 0 THEN
IF MESSAGEDLG("Close All files?", mtWarning, mbYes OR mbNo, 0) = mrYes THEN MFE_CloseAll
END IF
DEFINT i = 0, j = 0, n = 0
DEFSTR tmpStr, MyFileName
ini.FileName = TheFileName
ReadIDEVariables
DO
ini.FileName = TheFileName
ini.Section = "Open project files"
TmpStr = ini.GET(STR$(i), "")
IF TmpStr <> "" THEN
MyFileName = FIELD$(TmpStr, ",", 1)
MFE_Load(MyFileName)
IDE.CursorPos(MFE_List.ItemCount-1) = VAL(FIELD$(TmpStr, ",", 2))
IDE.AnchorPos(MFE_Tab.TabIndex) = VAL(FIELD$(TmpStr, ",", 2))
IDE.BookMarkCount(MFE_Tab.TabIndex) = 0
n = TALLY(TmpStr, ",")
IF n > 2 THEN
FOR j = 3 TO n+1
re.AddBookMark(VAL(FIELD$(TmpStr, ",", j)))
INC(IDE.BookMarkCount(MFE_Tab.TabIndex), 1)
IDE.BookMark(MFE_Tab.TabIndex, IDE.BookMarkCount(MFE_Tab.TabIndex)) = VAL(FIELD$(TmpStr, ",", j))
NEXT j
END IF
IDE.ModuleType(MFE_Tab.TabIndex) = VAL(FIELD$(TmpStr, ",", n+2))
i++
END IF
MFE_SetCursor
re.Set_AnchorPosition(IDE.CursorPos(MFE_Tab.TabIndex))
LOOP UNTIL TmpStr = ""
IF i > 0 THEN
ini.Section = "Selected Project Files"
TmpStr = ini.GET("Main", "")
IF TmpStr <> "" THEN IDE.MainFileForCompiler = TmpStr
ini.Section = "Selected"
TmpStr = ini.GET("Main", "")
IF TmpStr <> "" THEN
i = MFE_GetFileIndex(TmpStr)
IF i > -1 THEN MFE_ChangeToIndex(i)
END IF
END IF
MFE_UpdateRecentProj(TheFileName)
IDE.MFEActiveProject = TheFileName
ini.FileName = OrigName
END SUB
SUB MFE_OpenProject
fDialog.CAPTION = "Open FreeQ Project"
fDialog.Filter = "FreeQ proj|*.QProj|All Files|*.*"
fDialog.FileName= ""
fDialog.Mode = fdOpen
fDialog.MultiSelect = False
IF fDialog.EXECUTE THEN
MFE_LoadProject(fDialog.FileName)
Splitter_Moved
END IF
END SUB
SUB MFE_CloseProjectFiles
IF MESSAGEDLG("Save Project?", mtConfirmation, mbYes OR mbNo, 0) = mrYes THEN MFE_SaveProject
MFE_CloseAll
IDE.MainFileForCompiler = ""
IDE.MFEActiveProject = ""
IDE.MFEActiveFile = ""
ini.FileName = TheMainIniFile
ReadIDEVariables
END SUB
SUB MFE_UpdateRecentProj(TheFileNam AS STRING)
tmpList.Clear
tmpList.AddItems(TheFileNam)
IF mnuRecentProj0.CAPTION <> "" THEN tmpList.AddItems(mnuRecentProj0.CAPTION)
IF mnuRecentProj1.CAPTION <> "" THEN tmpList.AddItems(mnuRecentProj1.CAPTION)
IF mnuRecentProj2.CAPTION <> "" THEN tmpList.AddItems(mnuRecentProj2.CAPTION)
IF tmpList.ItemCount > 1 THEN
DEFINT i
FOR i = (tmpList.ItemCount -1) TO 1 STEP -1
IF TheFileNam = tmpList.Item(i) THEN tmpList.DelItems(i)
NEXT i
END IF
IF tmpList.ItemCount > 0 THEN mnuRecentProj0.CAPTION = tmpList.Item(0)
IF tmpList.ItemCount > 1 THEN mnuRecentProj1.CAPTION = tmpList.Item(1)
IF tmpList.ItemCount > 2 THEN mnuRecentProj2.CAPTION = tmpList.Item(2)
ini.FileName = TheMainIniFile
ini.Section = "RecentProjects"
ini.write("File0", mnuRecentProj0.CAPTION)
ini.write("File1", mnuRecentProj1.CAPTION)
ini.write("File2", mnuRecentProj2.CAPTION)
END SUB
SUB MFE_SaveProject
IF MFE_List.ItemCount > 0 THEN
fDialog.FileName = ""
fDialog.CAPTION = "Save Project"
fDialog.Filter = "FreeQ proj|*.QProj|All Files|*.*"
fDialog.Mode = fdSave
fDialog.MultiSelect = False
fDialog.FileName = IDE.MFEActiveProject
IF fDialog.EXECUTE THEN
MFE_UpdateRecentProj(fDialog.FileName)
DEFSTR OrigName = ini.FileName
IF INSTR(StripFileExt(fDialog.FileName), ".") = 0 THEN fDialog.FileName = fDialog.FileName + ".Qproj"
ini.FileName = fDialog.FileName
IDE.MFEActiveProject = fDialog.FileName
IF ini.Exist THEN ClearIni
WriteIDE_FormVariables
IDE_Conf_VersionInfoForm_Close
WriteIDEVariables(False)
DEFINT i, j
DEFSTR TmpStr = ""
ini.Section = "Open project files"
FOR i = 0 TO MFE_List.ItemCount -1
TmpStr = MFE_List.Item(i) + "," + STR$(IDE.CursorPos(i))
IF IDE.BookMarkCount(i) > 0 THEN
FOR j = 1 TO IDE.BookMarkCount(i)
TmpStr = TmpStr + "," + STR$(IDE.BookMark(i, j))
NEXT j
END IF
TmpStr = TmpStr + "," + STR$(IDE.ModuleType(i))
ini.write(STR$(i), TmpStr)
NEXT i
ini.Section = "Selected Project Files"
IF IDE.MainFileForCompiler <> "" THEN ini.write("Main", IDE.MainFileForCompiler)
ini.Section = "Selected"
ini.Write("Main", IDE.MFEActiveFile)
ini.FileName = OrigName
Stat.Panel(5).CAPTION = "Saved Project"
END IF
END IF
END SUB
SUB MFE_GetCursor
IDE.FirstLine(MFE_Tab.TabIndex) = re.GetEditor(SCI_GETFIRSTVISIBLELINE, 0&, 0&)
IDE.CursorPos(MFE_Tab.TabIndex) = re.Position
IDE.AnchorPos(MFE_Tab.TabIndex) = re.AnchorPosition
END SUB
SUB MFE_SetCursor
re.Set_AnchorPosition(IDE.AnchorPos(MFE_Tab.TabIndex))
re.Set_Position (IDE.CursorPos(MFE_Tab.TabIndex))
DEFINT i = re.GetEditor(SCI_LINEFROMPOSITION, re.Position, 0&)
re.EnsureLineVisible(i)
END SUB
SUB MFE_SetActiveAsMainFileForCompiler
IDE.MainFileForCompiler = ""
END SUB
SUB MFE_SetAsMainFileForCompiler
IDE.MainFileForCompiler = MFE_List.Item(MFE_Tab.TabIndex)
Stat.Panel(5).CAPTION = "Main file for compile: " + IDE.MainFileForCompiler
END SUB
SUB mnuSetAsDefaultCompilerFile_Click
IDE.ModuleType(MFE_Tab.TabIndex) = 0
END SUB
SUB mnuSetAsFBAppFile_Click
IDE.ModuleType(MFE_Tab.TabIndex) = 1
END SUB
SUB mnuSetAsFBDLLFile_Click
IDE.ModuleType(MFE_Tab.TabIndex) = 2
END SUB
SUB RightPanelRefresh
IF MFE_List.ItemCount > 0 THEN ParseSubIncRes(MFE_Tab.TabIndex, re.Text)
ProjFileList.Update
DirTree.Reload
END SUB
SUB LeftPanelRefresh
LoadProjectTree(MFE_Tab.TabIndex, re.Text)
END SUB
SUB SubFuncListView_Click(Sender AS QLISTVIEW)
IF Sender.ItemIndex > -1 THEN
DEFSTR tmp = FIELD$(Sender.Item(Sender.ItemIndex).CAPTION, LineNumDelimitr, 2)
DEFINT TheLineNum = VAL(tmp)
re.GotoLine(TheLineNum)
re.ActiveLineColor(RGB(255,200,128), 0)
IDE.HiLightTurnOFF = True
re.SetFocus
END IF
END SUB
SUB Widget_Click(Button%, X%, Y%, Shift%, Sender AS QCOOLBTN)
tmpList.Clear
DEFSTR TheObjName = TRIM$(LCASE$(Sender.Hint))
IF TheObjName = "new application" THEN TheObjName = "new_application"
TheObjName = TheObjName + ".tpl"
DEFSTR s = IDE.CompilerTemplatePath + TheObjName
Stat.Panel(5).CAPTION = "Loading template: " + s
IF FILEEXISTS(s) = False THEN
s = IDE.CompilerTemplatePath + "q" + TheObjName
IF FILEEXISTS(s) = False THEN
IF MESSAGEDLG("Template: " + Sender.Hint + " not found." + CRLF + _
"Do you want to set the template directory?", mtWarning, mbYes OR mbNo, 0) = mrYes THEN
IDE_Conf_CompileOpt_Show
EXIT SUB
END IF
END IF
END IF
IF Button% = MouseLtButton THEN
tmpList.LoadFromFile(s)
IF tmpList.Text <> "" THEN re.AddStrings(tmpList.Text)
tmpList.Clear
ELSE
MFE_Load(s)
Stat.Panel(5).CAPTION = "Editing template: " + s
END IF
END SUB
SUB Execute_ExternalApp(TheCommand AS STRING)
DEFSTR s = TheCommand
s = REPLACESUBSTR$(s, "%FILENAME%", IDE.MFEActiveFile)
s = REPLACESUBSTR$(s, "%FILE%", StripFileName(IDE.MFEActiveFile))
s = REPLACESUBSTR$(s, "%EXT%", StripFileExt(IDE.MFEActiveFile))
s = REPLACESUBSTR$(s, "%CURRPATH%", CURDIR$)
s = REPLACESUBSTR$(s, "%PATH%", StripPath(IDE.MFEActiveFile))
s = REPLACESUBSTR$(s, "%APPPATH%", Application.Path)
Stat.Panel(5).CAPTION = "exec... " + s
ShellExecute(0,"open", s, "","",1)
END SUB
FUNCTION IDE_GetKeywordFromText(inTxt AS STRING, RemovList AS STRING) AS STRING
DEFSTR s = inTxt
s = TRIM$(s)
s = s - CHR$(13)
s = s - CHR$(10)
IF RemovList <> "" THEN
DEFINT i
IF INSTR(RemovList, ".") > 0 THEN
IF INSTR(s, ".") THEN s = RIGHT$(s, LEN(s) - INSTR(s, "."))
END IF
IF INSTR(RemovList, "(") > 0 THEN
IF INSTR(s, "(") THEN s = LEFT$(s, INSTR(s, "(") -1)
END IF
FOR i = 1 TO LEN(RemovList)
s = s - RemovList[i]
NEXT i
END IF
RESULT = s
END FUNCTION
FUNCTION GetLanguageFromFile(TheFileName AS STRING) AS INTEGER
RESULT = IDE.DefaultLexLanguage
IF INSTR(".BAS.INC.RQB" , UCASE$(StripFileExt(TheFileName))) THEN
RESULT = SCLEX_VB
EXIT FUNCTION
END IF
IF INSTR(".BI" , UCASE$(StripFileExt(TheFileName))) THEN
RESULT = SCLEX_FREEBASIC
EXIT FUNCTION
END IF
IF INSTR(".H.CPP.CS.CXX.JAVA" , UCASE$(StripFileExt(TheFileName))) THEN
RESULT = SCLEX_CPP
EXIT FUNCTION
END IF
IF INSTR(".HTML.HTM.SHTML.JS" , UCASE$(StripFileExt(TheFileName))) THEN
RESULT = SCLEX_HTML
EXIT FUNCTION
END IF
IF INSTR(".TXT.INI.DOC.README" , UCASE$(StripFileExt(TheFileName))) THEN
RESULT = SCLEX_NULL
EXIT FUNCTION
END IF
IF UCASE$(StripFileExt(TheFileName)) = ".ASM" THEN
RESULT = SCLEX_ASM
EXIT FUNCTION
END IF
IF UCASE$(StripFileExt(TheFileName)) = ".PAS.DPR " THEN
RESULT = SCLEX_PASCAL
EXIT FUNCTION
END IF
IF UCASE$(StripFileExt(TheFileName)) = ".VBS" THEN
RESULT = SCLEX_VBSCRIPT
EXIT FUNCTION
END IF
IF UCASE$(StripFileExt(TheFileName)) = ".ISS" THEN
RESULT = SCLEX_INNOSETUP
EXIT FUNCTION
END IF
IF UCASE$(StripFileExt(TheFileName)) = ".XML" THEN
RESULT = SCLEX_XML
EXIT FUNCTION
END IF
IF UCASE$(StripFileExt(TheFileName)) = ".BAT" THEN
RESULT = SCLEX_BATCH
EXIT FUNCTION
END IF
IF UCASE$(StripFileExt(TheFileName)) = ".PY" THEN
RESULT = SCLEX_PYTHON
EXIT FUNCTION
END IF
IF UCASE$(StripFileExt(TheFileName)) = ".ASP" THEN
RESULT = SCLEX_ASP
EXIT FUNCTION
END IF
IF UCASE$(StripFileExt(TheFileName)) = ".PHP" THEN
RESULT = SCLEX_PHP
EXIT FUNCTION
END IF
IF UCASE$(StripFileExt(TheFileName)) = ".CSS" THEN
RESULT = SCLEX_CSS
EXIT FUNCTION
END IF
END FUNCTION
SUB IDE_SetFileLanguage(Sender AS QMENUITEM)
IDE.LexLanguage(MFE_Tab.TabIndex) = Sender.Tag
IDE_SetModuleType
IF IDE.HiLighting THEN
IDE_SetHighlighting(IDE.LexLanguage(MFE_Tab.TabIndex))
END IF
END SUB
SUB IDE_SetLanguage
IDE.DefaultLexLanguage = VAL(RIGHT$(IDE_Conf_MainLanguage.Item(IDE_Conf_MainLanguage.ItemIndex), 4))
IDE_SetHighlighting(IDE.DefaultLexLanguage)
END SUB
SUB IDE_SetHighlighting(TheLanguage AS INTEGER)
re.SetStyle(SCE_B_DEFAULT, IDE.MainFont.COLOR, IDE.BackGround)
re.Set_Language(TheLanguage)
IF TheLanguage = SCLEX_VB THEN
IF IDE.KeyWordList.ItemCount > 0 THEN re.LoadKeywordList(0, IDE.KeyWordList)
IF IDE.KeyWordList2.ItemCount > 0 THEN re.LoadKeywordList(1, IDE.KeyWordList2)
IF IDE.KeyWordList3.ItemCount > 0 THEN re.LoadKeywordList(2, IDE.KeyWordList3)
END IF
re.SetStyle(SCE_B_COMMENT, IDE.CommentFore, IDE.CommentBack, IDE.CommentBold, IDE.CommentItalic, IDE.CommentUnderL )
re.SetStyle(SCE_B_NUMBER, IDE.NumberFore, IDE.NumberBack, IDE.NumberBold, IDE.NumberItalic, IDE.NumberUnderL )
re.SetStyle(SCE_B_STRING, IDE.StringFore, IDE.StringBack, IDE.StringBold, IDE.StringItalic, IDE.StringUnderL )
re.SetStyle(SCE_B_PREPROCESSOR, IDE.PreProcessorFore, IDE.PreProcessorBack, IDE.PreProcessorBold, IDE.PreProcessorItalic, IDE.PreProcessorUnderL )
re.SetStyle(SCE_B_OPERATOR, IDE.OperatorFore, IDE.OperatorBack, IDE.OperatorBold, IDE.OperatorItalic, IDE.OperatorUnderL )
re.SetStyle(SCE_B_KEYWORD, IDE.KeywordFore, IDE.KeywordBack, IDE.KeywordBold, IDE.KeywordItalic, IDE.KeywordUnderL )
re.SetStyle(SCE_B_KEYWORD2, IDE.Keyword2Fore, IDE.Keyword2Back, IDE.Keyword2Bold, IDE.Keyword2Italic, IDE.Keyword2UnderL )
re.SetStyle(SCE_B_KEYWORD3, IDE.Keyword3Fore, IDE.Keyword3Back, IDE.Keyword3Bold, IDE.Keyword3Italic, IDE.Keyword3UnderL )
END SUB
SUB IDE_SetModuleType
IF IDE_Conf_MainLanguage.ItemIndex <> 1 THEN
IDE.ModuleType(MFE_Tab.TabIndex) = 0
ELSE
IDE.ModuleType(MFE_Tab.TabIndex) = 1
END IF
END SUB
|
|