DECLARE SUB RePopInsert(Sender AS QMENUITEM)
CREATE RecentFilePopup AS QPOPUPMENU
CREATE RecentPopItem0 AS QMENUITEM: OnClick = mnuRecentClick: END CREATE
CREATE RecentPopItem1 AS QMENUITEM: OnClick = mnuRecentClick : END CREATE
CREATE RecentPopItem2 AS QMENUITEM: OnClick = mnuRecentClick : END CREATE
CREATE RecentPopItem3 AS QMENUITEM: OnClick = mnuRecentClick : END CREATE
CREATE RecentPopItem4 AS QMENUITEM: OnClick = mnuRecentClick : END CREATE
CREATE RecentPopItem5 AS QMENUITEM: OnClick = mnuRecentClick : END CREATE
CREATE RecentPopItem6 AS QMENUITEM: OnClick = mnuRecentClick : END CREATE
CREATE RecentPopItem7 AS QMENUITEM: OnClick = mnuRecentClick : END CREATE
CREATE RecentPopItem8 AS QMENUITEM: OnClick = mnuRecentClick : END CREATE
CREATE RecentPopItem9 AS QMENUITEM: OnClick = mnuRecentClick : END CREATE
CREATE RecentPopItem10 AS QMENUITEM: OnClick = mnuRecentClick : END CREATE
CREATE RecentPopItem11 AS QMENUITEM: OnClick = mnuRecentClick : END CREATE
CREATE RecentPopItem12 AS QMENUITEM: OnClick = mnuRecentClick : END CREATE
CREATE RecentPopItem13 AS QMENUITEM: OnClick = mnuRecentClick : END CREATE
CREATE RecentPopItem14 AS QMENUITEM: OnClick = mnuRecentClick : END CREATE
CREATE RecentPopItem15 AS QMENUITEM: OnClick = mnuRecentClick : END CREATE
END CREATE
SUB RecentFilePopup_Popup
RecentPopItem0.CAPTION = mnuRecent0.CAPTION
RecentPopItem1.CAPTION = mnuRecent1.CAPTION
RecentPopItem2.CAPTION = mnuRecent2.CAPTION
RecentPopItem3.CAPTION = mnuRecent3.CAPTION
RecentPopItem4.CAPTION = mnuRecent4.CAPTION
RecentPopItem5.CAPTION = mnuRecent5.CAPTION
RecentPopItem6.CAPTION = mnuRecent6.CAPTION
RecentPopItem7.CAPTION = mnuRecent7.CAPTION
RecentPopItem8.CAPTION = mnuRecent8.CAPTION
RecentPopItem9.CAPTION = mnuRecent9.CAPTION
RecentPopItem10.CAPTION = mnuRecent10.CAPTION
RecentPopItem11.CAPTION = mnuRecent11.CAPTION
RecentPopItem12.CAPTION = mnuRecent12.CAPTION
RecentPopItem13.CAPTION = mnuRecent13.CAPTION
RecentPopItem14.CAPTION = mnuRecent14.CAPTION
RecentPopItem15.CAPTION = mnuRecent15.CAPTION
RecentPopItem0.Visible = mnuRecent0.Visible
RecentPopItem1.Visible = mnuRecent1.Visible
RecentPopItem2.Visible = mnuRecent2.Visible
RecentPopItem3.Visible = mnuRecent3.Visible
RecentPopItem4.Visible = mnuRecent4.Visible
RecentPopItem5.Visible = mnuRecent5.Visible
RecentPopItem6.Visible = mnuRecent6.Visible
RecentPopItem7.Visible = mnuRecent7.Visible
RecentPopItem8.Visible = mnuRecent8.Visible
RecentPopItem9.Visible = mnuRecent9.Visible
RecentPopItem10.Visible = mnuRecent10.Visible
RecentPopItem11.Visible = mnuRecent11.Visible
RecentPopItem12.Visible = mnuRecent12.Visible
RecentPopItem13.Visible = mnuRecent13.Visible
RecentPopItem14.Visible = mnuRecent14.Visible
RecentPopItem15.Visible = mnuRecent15.Visible
RecentFilePopup.Popup(Screen.MOUSEX, Screen.MOUSEY)
END SUB
CREATE RecentProjPopup AS QPOPUPMENU
CREATE RecentProjItem0 AS QMENUITEM: OnClick = mnuRecentProjClick: END CREATE
CREATE RecentProjItem1 AS QMENUITEM: OnClick = mnuRecentProjClick : END CREATE
CREATE RecentProjItem2 AS QMENUITEM: OnClick = mnuRecentProjClick : END CREATE
END CREATE
SUB RecentProj_Popup
RecentProjItem0.CAPTION = mnuRecentProj0.CAPTION
RecentProjItem0.Visible = mnuRecentProj0.Visible
RecentProjItem1.CAPTION = mnuRecentProj1.CAPTION
RecentProjItem1.Visible = mnuRecentProj1.Visible
RecentProjItem2.CAPTION = mnuRecentProj2.CAPTION
RecentProjItem2.Visible = mnuRecentProj2.Visible
RecentProjPopup.Popup(Screen.MOUSEX, Screen.MOUSEY)
END SUB
CREATE MFE_Tab_PopupMenu AS QPOPUPMENU
OnPopup = MFE_Tab_OnPopup
CREATE MFE_Tab_Menu1 AS QMENUITEM
OnClick = MFE_Close
END CREATE
CREATE MFE_Tab_Menu2 AS QMENUITEM
OnClick = MFE_CloseAllExceptActive
END CREATE
CREATE MFE_Tab_Menu2a AS QMENUITEM
CAPTION = "-"
Enabled = False
END CREATE
CREATE MFE_Tab_Menu3 AS QMENUITEM
OnClick = MFE_Save
END CREATE
CREATE MFE_Tab_Menu3b AS QMENUITEM
CAPTION = "Save As ..."
OnClick = MFE_SaveAs
END CREATE
CREATE MFE_Tab_Menu3c AS QMENUITEM
CAPTION = "-"
Enabled = False
END CREATE
CREATE MFE_Tab_Menu4 AS QMENUITEM
CAPTION = "Set Default for Compiler"
OnClick = MFE_SetAsMainFileForCompiler
END CREATE
CREATE MFE_Tab_Menu5 AS QMENUITEM
CAPTION = "Refresh Sub/Func List"
OnClick = RightPanelRefresh
END CREATE
CREATE MFE_Tab_Menu5a AS QMENUITEM
CAPTION = "-"
Enabled = False
END CREATE
CREATE MFE_Tab_Menu6 AS QMENUITEM
CAPTION = "Copy full name to Clipboard"
OnClick = IDE_CopyNameToClip
END CREATE
CREATE MFE_Tab_Menu7 AS QMENUITEM
CAPTION = "Open File Folder"
OnClick = IDE_ExploreFolder_Click
END CREATE
CREATE mnuSetAsDefaultCompileFile2 AS QMENUITEM
OnClick = mnuSetAsDefaultCompilerFile_Click
END CREATE
CREATE mnuSetAsFBAppFile2 AS QMENUITEM
CAPTION = "Set File as FreeBasic app"
OnClick = mnuSetAsFBAppFile_Click
END CREATE
END CREATE
MFE_Tab.PopupMenu = MFE_Tab_PopupMenu
SUB MFE_Tab_OnPopup
DEFSTR tmp = StripFileName(MFE_List.Item(MFE_Tab.TabIndex))
MFE_Tab_Menu1.CAPTION = "Close " + tmp
MFE_Tab_Menu2.CAPTION = "Close All except this Tab"
MFE_Tab_Menu3.CAPTION = "Save " + tmp
mnuSetAsDefaultCompileFile2.CAPTION = mnuSetAsDefaultCompileFile.CAPTION
END SUB
CREATE RE_PopupMenu AS QPOPUPMENU
AutoPopup = 1
OnPopup = RE_PopupMenu_OnPopup
CREATE REpopupCut AS QMENUITEM
CAPTION = "Cut"
OnClick = CutClick
END CREATE
CREATE REpopupCopy AS QMENUITEM
CAPTION = "Copy"
OnClick = CopyClick
END CREATE
CREATE REpopupPaste AS QMENUITEM
CAPTION = "Paste"
OnClick = PasteClick
END CREATE
CREATE REpopupSelectAll AS QMENUITEM
CAPTION = "Select All"
OnClick = SelectAllClick
END CREATE
CREATE REpopupBrk0 AS QMENUITEM
CAPTION = "-"
Enabled = False
END CREATE
CREATE REpopupSetAsMain AS QMENUITEM
CAPTION = "Set as default for Compiler"
OnClick = MFE_SetAsMainFileForCompiler
END CREATE
CREATE REpopupRefreshSubs AS QMENUITEM
CAPTION = "Refresh Sub/Func List"
OnClick = RightPanelRefresh
END CREATE
CREATE REpopupAutoDecl AS QMENUITEM
CAPTION = "Generate Declare Statements"
OnClick = mnuAutoDeclare_Click
END CREATE
CREATE REpopupBrk1 AS QMENUITEM
CAPTION = "-"
Enabled = False
END CREATE
CREATE REpopupHelpWord AS QMENUITEM
CAPTION = ""
OnClick = HelpOnTopicClick
END CREATE
CREATE REpopupSearchWeb4Word AS QMENUITEM
CAPTION = "Web Search : "
OnClick = REpopupSearchWeb4Word_Click
END CREATE
CREATE REpopupFindDecl AS QMENUITEM
CAPTION = "Find definition"
OnClick = mnuFindDecl_Click
END CREATE
CREATE REpopupInsertPropMain AS QMENUITEM
CAPTION = "Insert Property"
CREATE REpopupInsertTop AS QMENUITEM
CAPTION = ".Top"
OnClick = RePopInsert
END CREATE
CREATE REpopupInsertleft AS QMENUITEM
CAPTION = ".Left"
OnClick = RePopInsert
END CREATE
CREATE REpopupInsertWidth AS QMENUITEM
CAPTION = ".Width"
OnClick = RePopInsert
END CREATE
CREATE REpopupInsertHeight AS QMENUITEM
CAPTION = ".Height"
OnClick = RePopInsert
END CREATE
CREATE REpopupInsertCaption AS QMENUITEM
CAPTION = ".Caption"
OnClick = RePopInsert
END CREATE
CREATE REpopupInsertText AS QMENUITEM
CAPTION = ".Text"
OnClick = RePopInsert
END CREATE
CREATE REpopupInsertChecked AS QMENUITEM
CAPTION = ".Checked"
OnClick = RePopInsert
END CREATE
CREATE REpopupInsertOnClick AS QMENUITEM
CAPTION = ".OnClick ="
OnClick = RePopInsert
END CREATE
CREATE REpopupInsertOnMouseDown AS QMENUITEM
CAPTION = ".OnMouseDown ="
OnClick = RePopInsert
END CREATE
CREATE REpopupInsertOnKeyDown AS QMENUITEM
CAPTION = ".OnKeyDown ="
OnClick = RePopInsert
END CREATE
END CREATE
CREATE REpopupInsertMain AS QMENUITEM
CAPTION = "Insert Code"
CREATE REpopupInsertIf AS QMENUITEM
CAPTION = "If...Then...Else"
OnClick = RePopInsert
END CREATE
CREATE REpopupInsertFor AS QMENUITEM
CAPTION = "For...Next"
OnClick = RePopInsert
END CREATE
CREATE REpopupInsertDo AS QMENUITEM
CAPTION = "Do...Loop"
OnClick = RePopInsert
END CREATE
CREATE REpopupInsertSelectCase AS QMENUITEM
CAPTION = "Select Case..."
OnClick = RePopInsert
END CREATE
CREATE REpopupBrk2 AS QMENUITEM
CAPTION = "-"
Enabled = False
END CREATE
CREATE REpopupInsertSub AS QMENUITEM
CAPTION = "Sub...End Sub"
OnClick = RePopInsert
END CREATE
CREATE REpopupInsertFunc AS QMENUITEM
CAPTION = "Function...End Function"
OnClick = RePopInsert
END CREATE
CREATE REpopupInsertWith AS QMENUITEM
CAPTION = "With...End With"
OnClick = RePopInsert
END CREATE
CREATE REpopupInsertWhile AS QMENUITEM
CAPTION = "While..Wend"
OnClick = RePopInsert
END CREATE
CREATE REpopupBrk3 AS QMENUITEM
CAPTION = "-"
Enabled = False
END CREATE
CREATE REpopupInsertOnKeyDownSub AS QMENUITEM
CAPTION = "SUB OnKeyDown(Key AS Word, Shift AS INTEGER)"
OnClick = RePopInsert
END CREATE
CREATE REpopupInsertOnKeyPressSub AS QMENUITEM
CAPTION = "SUB OnKeyPress(Key AS BYTE)"
OnClick = RePopInsert
END CREATE
CREATE REpopupInsertOnMouseDownSub AS QMENUITEM
CAPTION = "SUB OnMouseDown(Button%, X%, Y%, Shift%)"
OnClick = RePopInsert
END CREATE
CREATE REpopupInsertOnMouseMoveSub AS QMENUITEM
CAPTION = "SUB OnMouseMove (X%, Y%, Shift%) "
OnClick = RePopInsert
END CREATE
END CREATE
END CREATE
SUB RePopInsert(Sender AS QMENUITEM)
DIM cs AS STRING
SELECT CASE LCASE$(LEFT$(Sender.CAPTION, 4))
CASE "if.."
cs = "" + CRLF + "IF" + CRLF + "THEN" + CRLF + "ELSE" + CRLF + "END IF" + CRLF
re.Set_SelText(cs)
CASE "sele"
cs = "" + CRLF + "SELECT CASE" + CRLF + _
SPACE$(IDE.TabSpaces) + "CASE : " + CRLF + _
SPACE$(IDE.TabSpaces) + "CASE : " + CRLF + _
"CASE ELSE " + CRLF + "END SELECT" + CRLF
re.Set_SelText(cs)
CASE "for."
cs = "" + CRLF + "FOR = TO " + CRLF + CRLF + "NEXT" + CRLF
re.Set_SelText(cs)
CASE "whil"
cs = "" + CRLF + "WHILE " + CRLF + "WEND" + CRLF
re.Set_SelText(cs)
CASE "do.."
cs = "" + CRLF + "DO " + CRLF + "LOOP UNTIL" + CRLF
re.Set_SelText(cs)
CASE "with"
cs = "" + CRLF + "WITH " + CRLF + SPACE$(IDE.TabSpaces) + "." + CRLF + SPACE$(IDE.TabSpaces) + "." + CRLF + "END WITH" + CRLF
re.Set_SelText(cs)
CASE "crea"
cs = "" + CRLF + "CREATE " + CRLF + "END CREATE" + CRLF
re.Set_SelText(cs)
CASE "sub."
cs = "" + CRLF + "SUB " + CRLF + "END SUB"
re.Set_SelText(cs)
CASE "func"
cs = "" + CRLF + "FUNCTION " + CRLF + "END FUNCTION"
re.Set_SelText(cs)
CASE ELSE
IF UCASE$(LEFT$(Sender.CAPTION, 4)) = "SUB " THEN
re.Set_SelText(Sender.CAPTION + CRLF + "END SUB" + CRLF)
ELSE
re.Set_SelText(Sender.CAPTION)
END IF
END SELECT
END SUB
SUB REpopupSearchWeb4Word_Click(Sender AS QMENUITEM)
IDE_SearchWeb4Word(Sender.CAPTION - "Web Search : " - CHR$(10) - CHR$(13))
END SUB
SUB RE_PopupMenu_OnPopup
re.SetFocus
DEFSTR s = re.SelText
IF s <> "" THEN
IF re.SelLength > 60 THEN s = LEFT$(s, 60)
ELSE
s = re.WordAtCursor()
END IF
s = IDE_GetKeywordFromText(s, "(." + Quot$ + sQuot)
REpopupHelpWord.CAPTION = "Help with " + s
REpopupSearchWeb4Word.CAPTION = "Web Search : " + s
s = ""
END SUB
SUB IDE_ShowQuickTip
DEFSTR s = re.SelText
IF s <> "" THEN
IF re.SelLength > 60 THEN s = LEFT$(s, 60)
ELSE
s = re.WordAtCursor()
END IF
DEFINT i, L, k
s = IDE_GetKeywordFromText(s, "(_" + Quot$ + sQuot)
s = UCASE$(s) + "="
L = LEN(s)
Stat.Panel(5).CAPTION = "looking up keyword..."
i = 0
DEFSTR s2
DO
IF s = LEFT$(IDE.KeyWordLookUp.Item(i), L) THEN
k = INSTR(IDE.KeyWordLookUp.Item(i), "=")
s2 = MID$(IDE.KeyWordLookUp.Item(i), k, LEN(IDE.KeyWordLookUp.Item(i)) - k + 1)
re.SendEditor(SCI_CALLTIPSETBACK, 11599871, 0)
re.SendEditor(SCI_CALLTIPSHOW, re.Position, VARPTR(s2))
Stat.Panel(5).CAPTION = MID$(IDE.KeyWordLookUp.Item(i), k, LEN(IDE.KeyWordLookUp.Item(i)) - k + 1)
EXIT DO
END IF
i++
LOOP UNTIL (i > IDE.KeyWordLookUp.ItemCount-1) OR (LEFT$(IDE.KeyWordLookUp.Item(i), 1) > LEFT$(s, 1))
Stat.Panel(5).CAPTION = "finished keyword search..."
s = ""
s2 = ""
END SUB
SUB mnuFindDecl_Click
DEFSTR s = re.SelText
DEFSTR TheLine = ""
IF s <> "" THEN
IF re.SelLength > 80 THEN EXIT SUB
ELSE
s = re.WordAtCursor()
END IF
s = IDE_GetKeywordFromText(s, "." + Quot$ + sQuot)
IF s = "" THEN EXIT SUB
DEFINT CurrTabIndx = MFE_Tab.TabIndex
MFE_GetCursor
DEFINT r = -1
DEFINT i, v1, v2, TheLoc, FoundInFile = False
FOR i = 0 TO MFE_List.ItemCount-1
MFE_ChangeToIndex(i)
MFE_GetCursor
re.Set_Position(0)
DO
r = re.Find(s, SCFIND_WHOLEWORD, 0, 0)
IF r <> -1 THEN
TheLine = UCASE$(re.Line(re.CurrentLineNumber + 1))
IF INSTR(TheLine, sQuot) THEN TheLine = LEFT$(TheLine, INSTR(TheLine, sQuot) -1)
TheLine = LTRIM$(TheLine)
TheLoc = INSTR(TheLine, UCASE$(s))
IF (INSTR(TheLine, "SUB ") = 1) THEN FoundInFile = True : EXIT DO
IF (INSTR(TheLine, "FUNCTION ") = 1) THEN FoundInFile = True : EXIT DO
v1 = INSTR(TheLine, "DIM ")
v2 = INSTR(TheLine, " AS ")
IF v1 THEN
IF (v2 >0) AND (TheLoc > v1) AND (TheLoc < v2) THEN FoundInFile = True : EXIT DO
END IF
v1 = INSTR(TheLine, "CREATE ")
v2 = INSTR(TheLine, " AS ")
IF v1 THEN
IF (v2 >0) AND (TheLoc > v1) AND (TheLoc < v2) THEN FoundInFile = True : EXIT DO
END IF
v1 = INSTR(TheLine, "CONST ")
v2 = INSTR(TheLine, "=")
IF v1 THEN
IF (v2 >0) AND (TheLoc > v1) AND (TheLoc < v2) THEN FoundInFile = True : EXIT DO
END IF
v1 = (INSTR(TheLine, "DEFINT ")) OR _
(INSTR(TheLine, "DEFLNG ")) OR _
(INSTR(TheLine, "DEFSHORT ")) OR _
(INSTR(TheLine, "DEFSNG ")) OR _
(INSTR(TheLine, "DEFSTR ")) OR _
(INSTR(TheLine, "DEFWORD ")) OR _
(INSTR(TheLine, "DEFSTR ")) OR _
(INSTR(TheLine, "DEFDBL ")) OR _
(INSTR(TheLine, "DEFDWORD ")) OR _
(INSTR(TheLine, "DEFBYTE "))
IF v1 THEN
IF TheLoc > v1 THEN FoundInFile = True : EXIT DO
END IF
IF (INSTR(TheLine, "TYPE ") = 1) THEN FoundInFile = True : EXIT DO
IF (INSTR(TheLine, "PROPERTY SET ") = 1) THEN FoundInFile = True : EXIT DO
END IF
LOOP UNTIL (r < 0)
IF FoundInFile THEN EXIT FOR
MFE_SetCursor
NEXT i
IF FoundInFile THEN
s = "File: " + StripFileName(MFE_List.Item(MFE_Tab.TabIndex)) + _
CRLF + CRLF + re.Line(re.CurrentLineNumber +1) + _
CRLF + CRLF + "return back to last location?"
IF MESSAGEDLG(s, mtConfirmation, mbYes OR mbNo, 0) = mrNo THEN
re.EnsureLineVisible(re.CurrentLineNumber)
re.GotoLine(re.CurrentLineNumber)
re.SetFocus
EXIT SUB
END IF
ELSE
SHOWMESSAGE "Cannot locate definition of " + s
END IF
MFE_SetCursor
MFE_ChangeToIndex(CurrTabIndx)
re.SetFocus
END SUB
|
|