Guidance
指路人
g.yi.org
software / rapidq / Examples / Tools - IDE, Designer, Builder / FreeQ IDE src / inc ide / Menu_Subs.inc

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
'--------------------------subroutines for panels visibility-----------------------------------


     SUB mnuViewModeSimple_Click
       'this works by setting environment to reverse, then reset by toggle through menus
       '(keeps everything set correctly)
      IDE.ViewTopPanel = True                 :   mnuViewTopPanel_Click
        'set these top panel options though menus, need to have check marks set correctly
      IDE.ViewFileToolPanel = True        :   mnuViewFileToolBar_Click
      IDE.ViewEditToolPanel = True        :   mnuViewEditToolBar_Click
      IDE.ViewCompileToolPanel = True     :   mnuViewCompileToolBar_Click
      IDE.ViewViewToolPanel = True        :   mnuViewViewToolBar_Click
      IDE.ViewCodeFoldingToolPanel = True :   mnuViewCodeFoldToolBar_Click
      IDE.ViewFormatToolPanel = True      :   mnuViewFormatToolBar_Click
      IDE.ViewBookMarkToolPanel = True    :   mnuViewBookMarkToolBar_Click
      IDE.ViewWidgetToolPanel = True      :   mnuViewWidgetToolBar_Click
      IDE.ViewIconToolPanel = True        :   mnuViewIconToolBar_Click
      IDE.ViewLeftPanel = True                :   mnuViewLeftPanel_Click
      IDE.ViewBottomPanel = True              :   mnuViewBottomPanel_Click
      IDE.ViewRightPanel = True               :   mnuViewRightPanel_Click
      IDE.ViewQuickSearch  = True             :   VisibileQuickSearchClick
      IDE.ViewStatusBar = False               :   mnuViewStatusBar_Click
      Splitter_Moved
     END SUB

     SUB mnuViewModeNovice_Click
       'this works by setting environment to reverse, then reset by toggle through menus
       '(keeps everything set correctly)
      IDE.ViewTopPanel = False                :   mnuViewTopPanel_Click
        'set these top panel options though menus, need to have check marks set correctly
      IDE.ViewFileToolPanel = False       :   mnuViewFileToolBar_Click
      IDE.ViewEditToolPanel = False       :   mnuViewEditToolBar_Click
      IDE.ViewCompileToolPanel = False    :   mnuViewCompileToolBar_Click
      IDE.ViewViewToolPanel = True        :   mnuViewViewToolBar_Click
      IDE.ViewCodeFoldingToolPanel = True :   mnuViewCodeFoldToolBar_Click
      IDE.ViewFormatToolPanel = True      :   mnuViewFormatToolBar_Click
      IDE.ViewBookMarkToolPanel = True    :   mnuViewBookMarkToolBar_Click
      IDE.ViewWidgetToolPanel = True      :   mnuViewWidgetToolBar_Click
      IDE.ViewIconToolPanel = True        :   mnuViewIconToolBar_Click
      IDE.ViewLeftPanel = True                :   mnuViewLeftPanel_Click
      IDE.ViewBottomPanel = False             :   mnuViewBottomPanel_Click
      IDE.ViewRightPanel = True               :   mnuViewRightPanel_Click
      IDE.ViewQuickSearch  = True             :   VisibileQuickSearchClick
      IDE.ViewStatusBar = False               :   mnuViewStatusBar_Click
      Splitter_Moved
     END SUB

     SUB mnuViewModeIntermediate_Click
      IDE.ViewTopPanel = False                :   mnuViewTopPanel_Click
        'set these top panel options though menus, need to have check marks set correctly
      IDE.ViewFileToolPanel = False       :   mnuViewFileToolBar_Click
      IDE.ViewEditToolPanel = False       :   mnuViewEditToolBar_Click
      IDE.ViewCompileToolPanel = False    :   mnuViewCompileToolBar_Click
      IDE.ViewViewToolPanel = False       :   mnuViewViewToolBar_Click
      IDE.ViewCodeFoldingToolPanel = False:   mnuViewCodeFoldToolBar_Click
      IDE.ViewFormatToolPanel = False     :   mnuViewFormatToolBar_Click
      IDE.ViewBookMarkToolPanel = False   :   mnuViewBookMarkToolBar_Click
      IDE.ViewWidgetToolPanel = True      :   mnuViewWidgetToolBar_Click
      IDE.ViewIconToolPanel = False       :   mnuViewIconToolBar_Click
      IDE.ViewLeftPanel = True                :   mnuViewLeftPanel_Click
      IDE.ViewBottomPanel = False             :   mnuViewBottomPanel_Click
      IDE.ViewRightPanel = False              :   mnuViewRightPanel_Click
      IDE.ViewQuickSearch  = False            :   VisibileQuickSearchClick
      IDE.ViewStatusBar = False               :   mnuViewStatusBar_Click
      Splitter_Moved
     END SUB

     SUB mnuViewModeExpert_Click
      IDE.ViewTopPanel = False                :   mnuViewTopPanel_Click
        'set these top panel options though menus, need to have check marks set correctly
      IDE.ViewFileToolPanel = False       :   mnuViewFileToolBar_Click
      IDE.ViewEditToolPanel = False       :   mnuViewEditToolBar_Click
      IDE.ViewCompileToolPanel = False    :   mnuViewCompileToolBar_Click
      IDE.ViewViewToolPanel = False       :   mnuViewViewToolBar_Click
      IDE.ViewCodeFoldingToolPanel = False:   mnuViewCodeFoldToolBar_Click
      IDE.ViewFormatToolPanel = False     :   mnuViewFormatToolBar_Click
      IDE.ViewBookMarkToolPanel = False   :   mnuViewBookMarkToolBar_Click
      IDE.ViewWidgetToolPanel = False     :   mnuViewWidgetToolBar_Click
      IDE.ViewIconToolPanel = False       :   mnuViewIconToolBar_Click
      IDE.ViewLeftPanel = False               :   mnuViewLeftPanel_Click
      IDE.ViewBottomPanel = False             :   mnuViewBottomPanel_Click
      IDE.ViewRightPanel = False              :   mnuViewRightPanel_Click
      IDE.ViewQuickSearch  = False            :   VisibileQuickSearchClick
      IDE.ViewStatusBar = False               :   mnuViewStatusBar_Click
      Splitter_Moved
     END SUB



     SUB mnuViewTopPanel_Click
      IDE.ViewTopPanel = NOT!(IDE.ViewTopPanel)
      mnuViewTopPanel.Checked = IDE.ViewTopPanel
      TopPanel.visible = IDE.ViewTopPanel
      Splitter_Moved
     END SUB


     SUB mnuViewBottomPanel_Click
      IDE.ViewBottomPanel = NOT!(IDE.ViewBottomPanel)
      mnuViewBottomPanel.Checked = IDE.ViewBottomPanel
      BottomPanel.Visible = IDE.ViewBottomPanel
      BottomSplitter.Visible = IDE.ViewBottomPanel
      Splitter_Moved
     END SUB

       'controllo per visualizzare o cancellare i pannelli sulla form 'principale
     SUB mnuViewRightPanel_Click
      IDE.ViewRightPanel = NOT!(IDE.ViewRightPanel)
      mnuViewRightPanel.Checked = IDE.ViewRightPanel
      RightPanel.Visible = IDE.ViewRightPanel
      Splitter_Moved
     END SUB


     SUB mnuViewLeftPanel_Click
      IDE.ViewLeftPanel = NOT!(IDE.ViewLeftPanel)
      mnuViewLeftPanel.Checked = IDE.ViewLeftPanel
      LeftPanel.visible = IDE.ViewLeftPanel
      IF LeftPanel.Visible THEN LoadProjectTree(MFE_Tab.TabIndex, re.Text)         'reparse Qobjects
      Splitter_Moved
     END SUB


     SUB VisibileQuickSearchClick
      IDE.ViewQuickSearch = NOT!(IDE.ViewQuickSearch)
      QuickSearchMnu.checked = IDE.ViewQuickSearch
      PanelSearch.visible = IDE.ViewQuickSearch
      Splitter_Moved
     END SUB


     SUB mnuViewStatusBar_Click
      IDE.ViewStatusBar = NOT!(IDE.ViewStatusBar)
      mnuViewStatusBar.Checked = IDE.ViewStatusBar
      Stat.visible = IDE.ViewStatusBar
     END SUB

     SUB mnuViewFormDesigner_Click
      IF FILEEXISTS(Application.Path + "\RapidFRM.exe" ) THEN
       SHELL Quote$(Application.Path + "\RapidFRM.exe" )
      ELSE
       SHELL Quote$(Application.Path + "\tools\RapidFRM.exe" )
      END IF
     END SUB



     SUB mnuViewFileToolBar_Click
      IDE.ViewFileToolPanel = NOT!(IDE.ViewFileToolPanel)
      mnuViewFileToolBar.Checked = IDE.ViewFileToolPanel
      FileToolPanel.Visible = IDE.ViewFileToolPanel
      ManageTopPanel
     END SUB


     SUB mnuViewEditToolBar_Click
      IDE.ViewEditToolPanel = NOT!(IDE.ViewEditToolPanel)
      mnuViewEditToolBar.Checked = IDE.ViewEditToolPanel
      EditToolPanel.Visible = IDE.ViewEditToolPanel
      ManageTopPanel
     END SUB

     SUB mnuViewCompileToolBar_Click
      IDE.ViewCompileToolPanel = NOT!(IDE.ViewCompileToolPanel)
      mnuViewCompileToolBar.Checked = IDE.ViewCompileToolPanel
      CompileToolPanel.Visible = IDE.ViewCompileToolPanel
      ManageTopPanel
     END SUB

     SUB mnuViewViewToolBar_Click
      IDE.ViewViewToolPanel = NOT!(IDE.ViewViewToolPanel)
      mnuViewViewToolBar.Checked = IDE.ViewViewToolPanel
      ViewToolPanel.Visible = IDE.ViewViewToolPanel
      ManageTopPanel
     END SUB

     SUB mnuViewCodeFoldToolBar_Click
      IDE.ViewCodeFoldingToolPanel = NOT!(IDE.ViewCodeFoldingToolPanel)
      mnuViewCodeFoldToolBar.Checked = IDE.ViewCodeFoldingToolPanel
      CodeFoldingToolPanel.Visible = IDE.ViewCodeFoldingToolPanel
      ManageTopPanel
     END SUB

     SUB mnuViewFormatToolBar_Click
      IDE.ViewFormatToolPanel = NOT!(IDE.ViewFormatToolPanel)
      mnuViewFormatToolBar.Checked = IDE.ViewFormatToolPanel
      FormatToolPanel.Visible = IDE.ViewFormatToolPanel
      ManageTopPanel
     END SUB

     SUB mnuViewBookMarkToolBar_Click
      IDE.ViewBookMarkToolPanel = NOT!(IDE.ViewBookMarkToolPanel)
      mnuViewBookMarkToolBar.Checked = IDE.ViewBookMarkToolPanel
      BookMarkToolPanel.Visible = IDE.ViewBookMarkToolPanel
      ManageTopPanel
     END SUB

     SUB mnuViewIconToolBar_Click
      IDE.ViewIconToolPanel = NOT!(IDE.ViewIconToolPanel)
      mnuViewIconkToolBar.Checked = IDE.ViewIconToolPanel
      IconsetFlatButton.Visible = IDE.ViewIconToolPanel
      ManageTopPanel
     END SUB

     SUB mnuViewWidgetToolBar_Click
      IDE.ViewWidgetToolPanel = NOT!(IDE.ViewWidgetToolPanel)
      mnuViewWidgetToolBar.Checked = IDE.ViewWidgetToolPanel
      WidgetTab.Visible = IDE.ViewWidgetToolPanel
      ManageTopPanel
     END SUB



     SUB Mnu_HilightClick
      IDE.HiLighting = NOT!(IDE.HiLighting)
      Mnu_Hilight.Checked = IDE.HiLighting
      IF Mnu_Hilight.Checked THEN
       IDE_SetHighlighting(IDE.LexLanguage(MFE_Tab.TabIndex))
      ELSE
       re.SendEditor(SCI_STYLECLEARALL, 0, 0)                                          'quick clear all styles for off
       re.SetStyle(STYLE_LINENUMBER, IDE.LineNumbersFore, IDE.LineNumbersBack, 0,0,0)  'but reset line numbers
      END IF
     END SUB


     SUB mnu_SetHilightLanguage(Sender AS QMENUITEM)
      IDE.DefaultLexLanguage = Sender.Tag
      IDE.HiLighting = True             'turn it off by toggle through menu
      Mnu_HilightClick
      IDE.HiLighting = False             'turn it on by toggle through menu
      Mnu_HilightClick
     END SUB


     SUB Mnu_WordWrapClick
      IDE.WordWrap = NOT!(IDE.WordWrap)
      Mnu_WordWrap.Checked = IDE.WordWrap
      re.Set_WordWrap(IDE.WordWrap)
     END SUB


     SUB Mnu_SetLineNumbersClick
      IDE.LineNumbers = NOT!(IDE.LineNumbers)
      Mnu_SetLineNumbers.Checked = IDE.LineNumbers
      re.Set_LineNumbers(Mnu_SetLineNumbers.Checked)
     END SUB


     SUB Mnu_ViewLastTab_Click               'go back to the last one viewed
      IF (IDE.LastTab <> -1) AND (MFE_Tab.TabIndex <> IDE.LastTab) THEN MFE_ChangeToIndex(IDE.LastTab)
     END SUB


     SUB Mnu_AutoIndentClick
      IDE.AutoIndent = NOT!(IDE.AutoIndent)
      Mnu_AutoIndent.Checked = IDE.AutoIndent
      re.AutoIndent = IDE.AutoIndent
      Stat.Panel(0).CAPTION = "Indent " + IIF(IDE.AutoIndent, "on", "off")
     END SUB


     SUB Mnu_AutoCompleteClick
      IDE.AutoComplete = NOT!(IDE.AutoComplete)
      Mnu_AutoComplete.Checked = IDE.AutoComplete
      Stat.Panel(2).CAPTION = "Complete " + IIF(IDE.AutoComplete, "on", "off")
     END SUB



     SUB Mnu_CodeFolding_Click
      IDE.CodeFolding = NOT!(IDE.CodeFolding)
      Mnu_CodeFolding.Checked = IDE.CodeFolding
      IF Mnu_CodeFolding.Checked THEN
       re.Set_CodeFolding(1, 1)
       IF IDE.CodeFoldExpandAll THEN re.FoldExpandAll
       IF IDE.CodeFoldCollapseAll THEN re.FoldCollapseAll
      ELSE
       re.Set_CodeFolding(0, 0)
       re.FoldExpandAll                'need this after removing margin
      END IF
      Stat.Panel(1).CAPTION = "Fold " + IIF(IDE.CodeFolding, "on", "off")
     END SUB


     SUB Mnu_CodeFoldingExpandAll_Click
      IF Mnu_CodeFolding.Checked THEN
       IDE.CodeFoldExpandAll = NOT!(IDE.CodeFoldExpandAll)
       Mnu_CodeFoldingExpandAll.Checked = IDE.CodeFoldExpandAll
       IDE.CodeFoldCollapseAll = NOT!(IDE.CodeFoldExpandAll)           'toggle opposite
       Mnu_CodeFoldingCollapseAll.Checked = IDE.CodeFoldCollapseAll
       IF Mnu_CodeFoldingExpandAll.Checked THEN
        re.FoldExpandAll
       ELSE
        re.FoldCollapseAll
       END IF
      END IF
     END SUB


     SUB Mnu_CodeFoldingCollapseAll_Click
      IF Mnu_CodeFolding.Checked THEN
       IDE.CodeFoldCollapseAll = NOT!(IDE.CodeFoldCollapseAll)
       Mnu_CodeFoldingCollapseAll.Checked = IDE.CodeFoldCollapseAll
       IDE.CodeFoldExpandAll = NOT!(IDE.CodeFoldCollapseAll)           'toggle opposite
       Mnu_CodeFoldingExpandAll.Checked = IDE.CodeFoldExpandAll

       IF Mnu_CodeFoldingCollapseAll.Checked THEN
            're.Set_CodeFolding(1, 1)
            'IF IDE.CodeFoldExpandAll THEN re.FoldExpandAll
        re.FoldCollapseAll
       ELSE
        re.FoldExpandAll
       END IF
      END IF
     END SUB

     SUB Mnu_ViewIndentationClick
      IDE.ViewIndents = NOT!(IDE.ViewIndents)
      Mnu_ViewIndentation.Checked = IDE.ViewIndents
      re.ViewIndentation(IDE.ViewIndents)
     END SUB




     SUB Mnu_FontMenuClick
      FontDialog.GetFont(IDE.MainFont)
      IF FontDialog.EXECUTE THEN
       FontDialog.SetFont(IDE.MainFont)
       re.Set_Font(IDE.MainFont)
      END IF
     END SUB


     SUB mnuRecentClick(Sender AS QMENUITEM)
      DEFSTR S = RIGHT$(Sender.CAPTION, LEN(Sender.CAPTION)- 3) 'INSTR(Sender.Caption, "; ")-1)
      MFE_Load(S)
     END SUB


     SUB mnuRecentProjClick(Sender AS QMENUITEM)
      IF FILEEXISTS(TRIM$(Sender.CAPTION)) THEN
       MFE_LoadProject(TRIM$(Sender.CAPTION))
      ELSE
       SHOWMESSAGE "Project file: " + TRIM$(Sender.CAPTION) + " does not exist"
      END IF
     END SUB


     SUB Mnu_LowercaseClick
      IF re.SelText <> "" THEN re.Set_SelText(LCASE$(re.SelText)) ELSE re.Set_Text(LCASE$(re.Text))
     END SUB

     SUB Mnu_UppercaseClick
      IF re.SelText <> "" THEN re.Set_SelText(UCASE$(re.SelText)) ELSE re.Set_Text(UCASE$(re.Text))
     END SUB



     SUB mnuCommentBlockClick
      DEFSTR s
      IF re.SelText <> "" THEN
       s = re.SelText
      ELSE
       s = re.Text
      END IF
      tmpList.Text = s
      DEFINT i
      FOR i = 0 TO tmpList.ItemCount -1
       tmpList.Item(i) = sQuot + tmpList.Item(i)
      NEXT i
    'IF RIGHT$(tmpList.Text, 1) = CHR$(10) THEN tmpList.Text = LEFT$(tmpList.Text, LEN(tmpList.Text) -1)
      IF re.SelText <> "" THEN re.Set_SelText(tmpList.Text)  ELSE re.Set_Text(tmpList.Text)
      tmpList.Text = ""       'dealloc
      s = ""
     END SUB


     SUB mnuUnCommentBlockClick
      DEFSTR s
      IF re.SelText <> "" THEN
       s = re.SelText
      ELSE
       s = re.Text
      END IF
      tmpList.Text = s
      DEFINT i, x
      FOR i = 0 TO tmpList.ItemCount -1
       x = INSTR(tmpList.Item(i), sQuot)
       tmpList.Item(i) = SPACE$(x -1) + MID$(tmpList.Item(i), x+1, LEN(tmpList.Item(i)))
      NEXT i
'    IF RIGHT$(tmpList.Text, 1) = CHR$(10) THEN tmpList.Text = LEFT$(tmpList.Text, LEN(tmpList.Text) -1)
      IF re.SelText <> "" THEN re.Set_SelText(tmpList.Text)  ELSE re.Set_Text(tmpList.Text)
      tmpList.Text = ""       'dealloc
      s = ""
     END SUB



     SUB mnuTrimSpacesAtEnd_Click
      DEFINT i = 0
      DEFSTR s
      IF re.SelText <> "" THEN
       tmpList.Text = re.SelText
      ELSE
       tmpList.Text = re.Text
      END IF

      FOR i = 0 TO tmpList.ItemCount -1
       tmpList.Item(i) = RTRIM$(tmpList.Item(i))
      NEXT i
      IF re.SelText <> "" THEN re.Set_SelText(tmpList.Text)  ELSE re.Set_Text(tmpList.Text)
      tmpList.Text = ""                             'dealloc
     END SUB


     SUB mnuRemoveBlankLines_Click
      DEFINT i = 0
      IF re.SelText <> "" THEN
       tmpList.Text = re.SelText
      ELSE
       tmpList.Text = re.Text
      END IF
      DO
       IF TRIM$(tmpList.Item(i)) = "" THEN tmpList.DelItems(i) ELSE  i++
      LOOP UNTIL (i = tmpList.ItemCount-1)          'item count is modified all the time!!
      IF re.SelText <> "" THEN re.Set_SelText(tmpList.Text)  ELSE re.Set_Text(tmpList.Text)
      tmpList.Text = ""                             'dealloc
     END SUB


     SUB mnuTabsToSpaces_Click
      DEFSTR O = ""
      DEFSTR s = ""
      IF re.SelText <> "" THEN
       s = re.SelText
      ELSE
       s = re.Text
      END IF
      O = REPLACESUBSTR$(s, CHR$(9), SPACE$(IDE.TabSpaces))
      IF re.SelText <> "" THEN re.Set_SelText(O)  ELSE re.Set_Text(O)
      s = ""          'dealloc
      O = ""          'dealloc
     END SUB


     SUB Mnu_SetCodePage_Click (Sender AS QMENUITEM)
      IDE.CodePage = Sender.Tag
      re.SendEditor(SCI_SETCODEPAGE, Sender.Tag, 0&)
    'currently a simple hack
      Mnu_CodePageAnsi.Checked = False
      Mnu_CodePageUTF8.Checked = False
      Mnu_CodePageJIS.Checked = False
      Mnu_CodePageChinese.Checked = False
      Mnu_CodePageChinese2.Checked = False
      Mnu_CodePageKorean.Checked = False
      Sender.Checked = True
     END SUB


     SUB mnuDateTime_Click
      re.AddStrings(DATE$, " :  ", TIME$)
     END SUB


     SUB Mnu_IndentBlock_Click
      re.SendEditor(SCI_TAB, 0&, 0&)          ' If more than one line selected, indent the lines.
     END SUB

     SUB Mnu_UnIndentBlock_Click
      re.SendEditor(SCI_BACKTAB, 0&, 0&)      'Dedent the selected lines.
     END SUB


     SUB mnuMagnifyFont_Click
      re.SendEditor(SCI_ZOOMIN, 0&, 0&)      'each is 1 pt, so do it twice
      re.SendEditor(SCI_ZOOMIN, 0&, 0&)
     END SUB

     SUB mnuMinifyFont_Click
      re.SendEditor(SCI_ZOOMOUT, 0&, 0&)      'each is 1 pt, so do it twice
      re.SendEditor(SCI_ZOOMOUT, 0&, 0&)
     END SUB

     SUB mnuRestoreFontMagnification_Click
      IF GetAsyncKeyState(VK_CONTROL) THEN                        'ctrl-key down?
       keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0)             'set up
      END IF
'        keybd_event (VK_CONTROL, MapVirtualKey(VK_CONTROL, 0), 0, 0)'may need this
      re.SetFocus                                                 'activate scitilla control
      keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0)                  'signal release of keys
      keybd_event(VK_CONTROL, 0, 0, 0)                            'press Ctrl
      keybd_event(VK_DIVIDE, 0, 0, 0)                             'press numpad /
      keybd_event(VK_CONTROL, 0, &H02020202, 0)                   'signal release of keys
      DOEVENTS                                                    'process Windows messages
     END SUB


     SUB mnuSort_Click
      IF re.SelText <> "" THEN
       tmpList.Text = re.SelText
       tmpList.Sort
       re.Set_SelText(tmpList.Text)
      ELSE
       tmpList.Text = re.Text
       tmpList.Sort
       re.Set_Text(tmpList.Text)
      END IF
      tmpList.Clear
     END SUB


'---------   include files from outside source  -------------

     SUB mnuInsertFile_Click
      IF MFE_List.ItemCount > 0 THEN
       fDialog.CAPTION = "Insert File"
       fDialog.Filter = IDE.FileFilter
       fDialog.FileName= ""
       fDialog.Mode = fdOpen
       fDialog.MultiSelect = False
       IF fDialog.EXECUTE THEN
        IF FILEEXISTS (fDialog.FileName) = True THEN
         gFStream.OPEN(fDialog.FileName, fmOpenRead)
         DEFSTR s = gFStream.ReadBinStr(gFStream.Size)
         gFStream.CLOSE
         re.AddStrings(s)
         s = ""
        END IF
       END IF
      END IF
     END SUB



     FUNCTION IDE_InsertWebFile(srcFile AS STRING) AS INTEGER
      DEFSTR tmpFile = "~~~FreeqDLtmp~~"      'need to copy to local file
      RESULT = False
      IF 0 = URLDownloadToFile(0&, _
       srcFile, _
       tmpFile, _
       BINDF_GETNEWESTVERSION, _
       0&) THEN

       IF FILEEXISTS(tmpFile) THEN
        MFE_MakeNewFile(StripFileName(srcFile))         'make a new file
        tmpList.LoadFromFile (tmpFile)
        re.SetFocus
        re.AddStrings(tmpList.Text)
        KILL tmpFile
        tmpList.Clear           'dealloc
        RESULT = True
       ELSE
        SHOWMESSAGE "file at address not found"
       END IF
      END IF          'success on load
     END FUNCTION


     SUB mnuOpenFileFromWeb_Click
    'setup general dialog box....
      gDialogLabel.CAPTION = "Enter Web Address"
      gDialogEdit.Width = 300
      gDialogForm.Width = 420
      gDialogOKButton.Left = 310
      gDialogCancelButton.Left = 350
      gDialogForm.SHOWMODAL

      DEFSTR srcFile = TRIM$(gDialogEdit.Text)
      IF srcFile <> "" THEN IDE_InsertWebFile(srcFile)
     END SUB





'====================== Book Marks ==================================

     SUB mnuNViewBookMark_Click
      mnuNViewBookMark.Checked = NOT!(mnuNViewBookMark.Checked)
      IDE.ViewBookMarks = mnuNViewBookMark.Checked
      re.ViewBookMarks(IDE.ViewBookMarks)
     END SUB


     SUB mnuAddBookMark_Click
      IF IDE.ViewBookMarks = False THEN
       mnuNViewBookMark.Checked = False        'toggle to true
       mnuNViewBookMark_Click
      END IF
      re.AddBookMark(re.CurrentLineNumber)
      INC(IDE.BookMarkCount(MFE_Tab.TabIndex), 1)
      IDE.BookMark(MFE_Tab.TabIndex, IDE.BookMarkCount(MFE_Tab.TabIndex)) = re.CurrentLineNumber
     END SUB


     SUB mnuDelBookMark_Click
      IF re.BookmarkPresent(re.CurrentLineNumber) THEN re.DelBookMark(re.CurrentLineNumber)
      DEFINT i, y = re.CurrentLineNumber

      FOR i = 1 TO IDE.BookMarkCount(MFE_Tab.TabIndex)
       IF y = IDE.BookMark(MFE_Tab.TabIndex, i) THEN          'found match at index
        y = i
        EXIT FOR
       END IF
      NEXT i

      FOR i = y TO IDE.BookMarkCount(MFE_Tab.TabIndex) -1
       IDE.BookMark(MFE_Tab.TabIndex, i) = IDE.BookMark(MFE_Tab.TabIndex, i+1)       'shift down
      NEXT i
      DEC(IDE.BookMarkCount(MFE_Tab.TabIndex), 1)
      IF IDE.BookMarkCount(MFE_Tab.TabIndex) < 0 THEN IDE.BookMarkCount(MFE_Tab.TabIndex) = 0
     END SUB



     SUB mnuNextBookMark_Click
      IF IDE.ViewBookMarks = False THEN
       mnuNViewBookMark.Checked = False                    'toggle to true
       mnuNViewBookMark_Click
      END IF
      IF re.NextBookmark(True, False) = -1 THEN               'not found in this file
       DEFINT BrkLoop = False
       DEFINT j = MFE_Tab.TabIndex                         'which file we on?
       DEFINT i = j + 1                                    'start search in next file
       IF i > MFE_List.ItemCount-1 THEN i = 0              'wrap around if needed
       DO
        IF IDE.BookMarkCount(i) > 0 THEN
         MFE_ChangeToIndex(i)
         re.Set_Position(0)                          'start at top
         re.NextBookmark(True, False)                'go to it
         BrkLoop = True
        END IF
        i++
        IF i > MFE_List.ItemCount-1 THEN i = 0          'wrap around if needed
        IF i = j THEN BrkLoop = True: Stat.Panel(5).CAPTION = "no more bookmarks"
       LOOP UNTIL BrkLoop
      END IF
     END SUB


     SUB mnuPrevBookMark_Click
      IF IDE.ViewBookMarks = False THEN
       mnuNViewBookMark.Checked = False        'toggle to true
       mnuNViewBookMark_Click
      END IF
      IF re.NextBookmark(False, False) = -1 THEN              'not found in this file
       DEFINT BrkLoop = False
       DEFINT j = MFE_Tab.TabIndex                         'which file we on?
       DEFINT i = j - 1                                    'start search in prev file
       IF i < 0 THEN i = MFE_List.ItemCount-1              'wrap around if needed
       DO
        IF IDE.BookMarkCount(i) > 0 THEN
         MFE_ChangeToIndex(i)
         re.Set_Position(re.Size)                    'start at Bottom
         re.NextBookmark(False, False)               'go to it
         BrkLoop = True
        END IF
        i--
        IF i < 0 THEN i = MFE_List.ItemCount-1          'wrap around if needed
        IF i = j THEN BrkLoop = True: Stat.Panel(5).CAPTION = "no more bookmarks"
       LOOP UNTIL BrkLoop
      END IF
     END SUB


     SUB mnuGoToBookMark_Click

      IF MFE_List.ItemCount = 0 THEN EXIT SUB         'no tabs, so no bookmarks

      IF IDE.ViewBookMarks = False THEN
       mnuNViewBookMark.Checked = False            'toggle to true
       mnuNViewBookMark_Click
      END IF

      gListBox.Clear                                  'set up our global listbox
      gListOkButton.Tag = 1                           'set the action for the general list dialog box, 1= view bookmarks
      gListBox.Visible = True                         'we are going to work on a listbox
      gListLabel.Visible = True

    'add bookmarks of current tab
      DEFINT i
      FOR i = 1 TO IDE.BookMarkCount(MFE_Tab.TabIndex)
       gListBox.AddItems (re.Line(IDE.BookMark(MFE_Tab.TabIndex, i) +1))           'if user selects, then goes to GlistExecute
      NEXT i

    'add other tabs bookmarks
      IF MFE_List.ItemCount > 1 THEN
       DEFINT j, k
       i = MFE_Tab.TabIndex                                                            'what is current tab?
       FOR j = 0 TO MFE_List.ItemCount-1
        IF (j <> i) AND (IDE.BookMarkCount(j) > 0) THEN
         FOR k = 1 TO IDE.BookMarkCount(j)
          gListBox.AddItems ("<" + STR$(j) + "> " + MFE_Tab.Tab(j) + " line: " + STR$(IDE.BookMark(j, k) +1) )    'add for line offset in Scintilla
         NEXT k
        END IF
       NEXT j
      END IF

      gListForm.CAPTION = "Select bookmark"
      gListForm.Width = 500
      gListForm.Show
     END SUB


'======================Tools ==================================

     SUB mnuExternalApp1_Click
      Execute_ExternalApp(TRIM$(mnuExternalApp1.CAPTION))
     END SUB

     SUB mnuExternalApp2_Click
      Execute_ExternalApp(TRIM$(mnuExternalApp2.CAPTION))
     END SUB

     SUB mnuExternalApp3_Click
      Execute_ExternalApp(TRIM$(mnuExternalApp3.CAPTION))
     END SUB

     SUB mnuExternalApp4_Click
      Execute_ExternalApp(TRIM$(mnuExternalApp4.CAPTION))
     END SUB


     SUB mnuExternalApp_Click(theCmd AS STRING)
      Execute_ExternalApp(theCmd)
     END SUB



'' auto generate declare statements uses the global tmpList component
     SUB mnuAutoDeclare_Click
      DEFINT i, j =  MFE_Tab.TabIndex, k
      DEFSTR TotalDeclares = ""
      DEFSTR AutoDeclEndTag = "'---  end of FreeQ generated declare statments  -----"

      IF IDE.AutoDeclClipboardActiveFile THEN
       tmpList.Text = re.Text
       IDE_GenDeclares(tmpList, True)
       ClipBoard.OPEN
       ClipBoard.Clear
       ClipBoard.SetAsText(tmpList.Text)
       ClipBoard.CLOSE

'    ELSEIF IDE.AutoDeclClipboardAllFiles THEN
'        re.Visible = False
'        FOR i = 0 TO MFE_List.ItemCount - 1
'            MFE_ChangeToIndexSilent(i)
'            tmpList.Text = re.Text
'            IDE_GenDeclares(tmpList, True)
'            IF tmpList.ItemCount > 0 THEN
'                TotalDeclares = "' --  " + MFE_List.Item(i) + " --  " + CRLF + TotalDeclares + tmpList.Text + AutoDeclEndTag + CRLF
'            END IF
'        NEXT i
'        re.Visible = True
'        ClipBoard.Open
'        ClipBoard.Clear
'        ClipBoard.SetAsText(TotalDeclares)
'        ClipBoard.Close

      ELSEIF IDE.AutoDeclAtTopActiveFile THEN
       tmpList.Text = re.Text
       IDE_GenDeclares(tmpList, True)
       IF tmpList.ItemCount > 0 THEN
        re.Set_Position(0)
        i = re.Find(AutoDeclEndTag, 0, 1, 0)
        IF i >-1 THEN
         j = re.Find("declare ", 0, 1, 0)
         re.Set_AnchorPosition(j)
         re.Set_Position(i)
        END IF
        re.Set_SelText(tmpList.Text + AutoDeclEndTag + CRLF)
       END IF


      ELSEIF IDE.AutoDeclAtTopAllFiles THEN
       re.Visible = False
       FOR k = 0 TO MFE_List.ItemCount - 1
        MFE_ChangeToIndexSilent(k)
        tmpList.Text = re.Text
        IDE_GenDeclares(tmpList, True)
        IF tmpList.ItemCount > 0 THEN
         re.Set_Position(0)
         i = re.Find(AutoDeclEndTag, 0, 1, 0)
         IF i >-1 THEN
          j = re.Find("declare ", 0, 1, 0)
          re.Set_AnchorPosition(j)
          re.Set_Position(i)
         END IF
         re.Set_SelText(tmpList.Text + AutoDeclEndTag + CRLF )
        END IF
       NEXT k
       re.Visible = True

      ELSE        ' IDE.AutoDeclInFile OR IDE.AutoDeclClipboardAllFiles

        '*** All declares for project in header file ****

       re.Visible = False
       FOR i = 0 TO MFE_List.ItemCount - 1
        MFE_ChangeToIndexSilent(i)
        tmpList.Text = re.Text
        IDE_GenDeclares(tmpList, True)
        IF tmpList.ItemCount > 0 THEN
         TotalDeclares = CRLF + "' ----  " + MFE_List.Item(i) + " ----  " + CRLF + CRLF + _
          tmpList.Text + TotalDeclares
        END IF
       NEXT i
       re.Visible = True

       IF IDE.AutoDeclClipboardAllFiles THEN
        ClipBoard.OPEN
        ClipBoard.Clear
        ClipBoard.SetAsText(TotalDeclares)
        ClipBoard.CLOSE

       ELSE

        k = MFE_GetFileIndex(IDE.AutoDeclInFileName)
        IF k  >-1 THEN
         MFE_ChangeToIndex(k)
         re.SelectAll
         re.Set_SelText(TotalDeclares)
         re.Set_Position(0)
        ELSE
         MFE_MakeNewFile(IDE.AutoDeclInFileName)
         re.AddStrings (TotalDeclares + AutoDeclEndTag + CRLF)
        END IF
       END IF
      END IF
      MFE_ChangeToIndex(j)
      tmpList.Clear
     END SUB


     SUB mnuBeautifyCode_Click
      BeautifyForm_Show
     END SUB

     SUB mnuMenuDesigner_Click
      WinExec Application.Path + "\tools\Menudesigner.exe", 10
     END SUB


     SUB mnuCommandLine_Click
      ShellExecute (0, "Open", "cmd.exe", "", "", 1)
     END SUB

     SUB mnuCalcExe_Click
      WinExec "Calc.exe", 10        'SW_SHOWNORMAL
     END SUB

     SUB mnuCharMapExe_Click
      WinExec "CharMap.exe", 10     'SW_SHOWNORMAL
     END SUB

     SUB mnuColorPicker_Click
      ColorPicker_Show
     END SUB

     SUB mnuToolKey_Click
      ToolKey_Form_Show
     END SUB

     SUB NewWersionsMenuClick
      DEFSTR tmpFile = "~~~FreeqDLtmp~~"                                  'need to copy to local file
      IF 0 = URLDownloadToFile(0&, _
       "http://rapidq.phatcode.net/FreeQ/lastversion.txt", _
       tmpFile, _
       BINDF_GETNEWESTVERSION, _
       0&) THEN

       IF FILEEXISTS(tmpFile) THEN
        tmpList.LoadFromFile (tmpFile)
        KILL tmpFile
        DEFINT MyTag = INSTR(tmpList.Text , "FREEQ VERSION.")

        IF MyTag > 0 THEN
         MyTag = False                                                   'search for newer version
         IF (VAL(FIELD$(tmpList.Text, ".", 2)) > FREEQMAJORVERSION) THEN MyTag = True
         IF MyTag = False THEN
          IF (VAL(FIELD$(tmpList.Text, ".", 3)) > FREEQMINORVERSION) THEN MyTag = True
         END IF

         IF MyTag = True THEN                                            'serially increases in version
          IF MESSAGEDLG("A newer version is available. Would you like to download " + CRLF + _
           "version " + _
           FIELD$(tmpList.Text, ".", 2) + "." + _
           (FIELD$(tmpList.Text, ".", 3) - CHR$(13) - CHR$(10)) + "?" ,_
           mtWarning, mbYes OR mbNo, 0) = mrYes THEN
           ShellExecute (0, "open", "http://www.rapidq.phatcode.net/FreeQ/","","",1)
          END IF
         ELSE
          MESSAGEBOX("Your version is up to date" , "Update Info" , 64)
         END IF
         tmpList.Clear           'dealloc
         EXIT SUB
        END IF
        tmpList.Clear           'dealloc
        EXIT SUB
       END IF
      END IF          'success on load
      MESSAGEBOX("Update Error, no version detected on the internet" , "Update Info" , 16)
     END SUB


     SUB AboutMenu_Click
      Gaugestart.Visible = False
      SplashForm.Font.Size = 10
      SplashForm.Height = 500                     'need some space here!!
      SplashForm.Center
      AboutOkButtn.Top = SplashForm.Clientheight - AboutOkButtn.Height - 8
      AboutOkButtn.Visible = True                 'turn this on (not used in splash)
      SplashLabel1.Font.Size = 10
      SplashLabel1.CAPTION = "Forum: http://tech.groups.yahoo.com/group/rapidq/"
      SplashLabel1.Visible = True
      Labelstart.Top = Labelstart.Top + 16        'move it down a bit
      Labelstart.Font.Size = 10
      Labelstart.CAPTION = "GPL code by JohnK, Don Homans, Boris Holyguard, Andrew Shelkovenko," + CRLF + _
       "Natase Eodor, Jacques Philippe, Paul Ludgate, Oliver Ozohanics," + CRLF + _
       "David Burkley, Achilles Mina, V. Dobiasch, and " + _
       "the RapidQ community"
      Label_splash_version.Top = AboutOkButtn.Top - 120
      Label_splash_version.CAPTION = "Version: "+ FREEQVERSIONSTR + CRLF + CRLF + _
       " Scintilla(c) Neil Hodgson <neilh@scintilla.org>" + CRLF + _
       " UPX (c) Markus Oberhumer, Laszlo Molnar, John Reiser" + CRLF + _
       " http://upx.sourceforge.net" + CRLF + _
       " Resource Hacker v3.4 (c) Angus Johnson"  + CRLF + _
       " http://angusj.com/resourcehacker/"  + CRLF + _
       " GoRC by Jeremy Gordon, www.GoDevTool.com"
      SplashForm.Show
     END SUB

掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sat 2024-4-20  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2010-12-07 21:18:03