// TH3FileMenu.mn // Use cCJCommandBarSystem.pkg Use cCJStandardMenuItemClasses.pkg Register_Function isFileViewWindow Integer hoID Returns Integer Class cCJRecentFileMenuItem is a cCJMenuItem Procedure OnExecute Variant vCommandBarControl String sFile sAmp Handle hoClient Get Client_Id to hoClient Get psCaption to sFile Move (Left(sFile, Pos(" ", sFile))) to sAmp Move (Trim(Replace(sAmp, sFile, ""))) to sFile Send CAOpenFile to hoClient sFile End_Procedure End_Class Class cCJRecentWSMenuItem is a cCJMenuItem Procedure Construct_Object Forward Send Construct_Object Property String psWorkspace "" Property String psVersion "" End_Procedure Procedure OnExecute Variant vCommandBarControl String sWorkspace sVersion Handle hoClient Get Client_Id to hoClient Get psWorkspace to sWorkspace Get psVersion to sVersion Send CAChangeWorkspace to hoClient sWorkspace sVersion End_Procedure End_Class Object oFileMenu is a cCJMenuItem Set peControlType to xtpControlPopup Set psCaption to "&File" Set psDescription to "Open, Save, Close source file" Set psCategory to "File" Object oNewItem is a cCJMenuItem Set pbAddToDesignerMenu to True Set psCaption to "&New" Set psToolTip to "Create a new file within the current workspace" Set psDescription to "New file" Set psImage to "ActionNew.ico" Procedure OnExecute Variant vCommandBarControl Handle hoClient Get Client_Id to hoClient Send CANewFile to hoClient End_Procedure End_Object Object oOpenItem is a cCJMenuItem Set pbAddToDesignerMenu to True Set psCaption to "&Open" Set psToolTip to "Open a source file" Set psDescription to "Open file" Set psImage to "ActionOpen.ico" Procedure OnExecute Variant vCommandBarControl Handle hoClient Get Client_Id to hoClient Send CAOpenMultipleFiles to hoClient End_Procedure End_Object Object oOpenPkgItem is a cCJMenuItem Set pbAddToDesignerMenu to True //Set psImage to "New16.bmp" Set psCaption to "Open PKG File" Set psToolTip to "Open a source file from workspace packages folder (if defined)" Set psDescription to "Open PKG file" Procedure OnExecute Variant vCommandBarControl Handle hoClient Get Client_Id to hoClient Send CAOpenFile_Pkg to hoClient End_Procedure End_Object Object oOpenDDItem is a cCJMenuItem Set pbAddToDesignerMenu to True Set psCaption to "Open DD File" Set psToolTip to "Open DD file" Set psDescription to "Open a Data Dictionary source file" Procedure OnExecute Variant vCommandBarControl Handle hoClient Get Client_Id to hoClient Send CAOpenFile_DD to hoClient End_Procedure End_Object Object oOpenWebItem is a cCJMenuItem Set pbAddToDesignerMenu to True Set psCaption to "Open Web File" Set psToolTip to "Open a Web File" Set psDescription to "Open a Web source file (HTML, JS, ASP etc.)" Procedure OnExecute Variant vCommandBarControl Handle hoClient Get Client_Id to hoClient Send CAOpenFile_Html to hoClient End_Procedure End_Object Object oOpenDFPkgItem is a cCJMenuItem Set pbAddToDesignerMenu to True Set psCaption to "Open DataFlex Package" Set psToolTip to "Opens DataFlex standard package file" Set psDescription to "Open DataFlex Package" Procedure OnExecute Variant vCommandBarControl Handle hoClient Get Client_Id to hoClient Send CAOpenPkg to hoClient End_Procedure End_Object Object oRecentPopupMenu is a cCJMenuItem Property Handle[] phArrayOfWindows Set peControlType to xtpControlPopup Set psCaption to "Recent Files" Set psDescription to "Recently opened files" Set psImage to "RecentFiles16.ico" Procedure OnPopupInit Variant vCommandBarControl Handle hCommandBarControls String sLabel sC sDesc Integer iC iCount iWindows Handle[] hArrayOfWindows Variant vItem // delete all windows actions and menu items. Assume we have an array of DF action objects for the windows // also assume that destroying an action removes all menu instances of that action Get phArrayOfWindows to hArrayOfWindows Move (SizeOfArray(hArrayOfWindows)) to iWindows For iC from 0 to (iWindows-1) Send Destroy of hArrayOfWindows[iC] // assume this removes all menu items of this action Loop Move (ResizeArray(hArrayOfWindows,0)) to hArrayOfWindows Move (psRecentFiles.Count(ghoEditorProperties)) To iCount For iC from 0 to (iCount-1) Move (Right("00"+String(iC+1), 2)) to sC If ((iC+1)<10) Move (sC+" ") to sC Move "" to sLabel Move (sLabel+sC*(psRecentFiles(ghoEditorProperties,iCount-1-iC))) to sLabel Get Create U_cCJRecentFileMenuItem to hArrayOfWindows[iC] Set psCaption of hArrayOfWindows[iC] to sLabel #IFDEF TH_TRANSLATION Move (Replace("%1", gILanguage[23], psRecentFiles(ghoEditorProperties,iCount-1-iC))) to sDesc #ELSE Move ("Open '" - psRecentFiles(ghoEditorProperties,iCount-1-iC) - "' file.") to sDesc #ENDIF Set psDescription of hArrayOfWindows[iC] to sDesc Get AddDynamicControl of hArrayOfWindows[iC] hCommandBarControls to vItem End Set phArrayOfWindows to hArrayOfWindows End_Procedure End_Object Object oWorkspacePopupMenu is a cCJMenuItem Property Handle[] phArrayOfWindows Set peControlType to xtpControlPopup Set psCaption to "Workspaces" Set psDescription to "Workspace" Set psImage to "RecentWS16.ico" Object oWorkspaceItem is a cCJMenuItem Set pbAddToDesignerMenu to True Set psCaption to "Select Workspace..." Set psToolTip to "Select a different workspace to work in" Set psDescription to "Select workspace" Procedure OnExecute Variant vCommandBarControl Handle hoClient Get Client_Id to hoClient Send CASelectWorkspace of hoClient End_Procedure End_Object Object oDirectoryItem is a cCJMenuItem Set pbAddToDesignerMenu to True Set psCaption to "Working Directory..." Set psToolTip to "Set the current working directory" Set psDescription to "Set working directory" Procedure OnExecute Variant vCommandBarControl Handle hoClient Get Client_Id to hoClient Send SelectWorkingDirectory End_Procedure End_Object Object oConfigureItem is a cCJMenuItem Set pbAddToDesignerMenu to True Set psCaption to "Configure Workspace..." Set psToolTip to "Configure Project Workspace" Set psImage to "Configure16.ico" Procedure OnExecute Variant vCommandBarControl Send Popup to oTH3WorkspaceConfigure If ghoWorkspaceFilesTree ; Send LoadWorkspaceStructure to ghoWorkspaceFilesTree End_Procedure End_Object Procedure OnPopupInit Variant vCommandBarControl Handle hCommandBarControls String sLabel sC sDesc Integer iC iCount iWindows Handle[] hArrayOfWindows Variant vItem // delete all windows actions and menu items. Assume we have an array of DF action objects for the windows // also assume that destroying an action removes all menu instances of that action Get phArrayOfWindows to hArrayOfWindows Move (SizeOfArray(hArrayOfWindows)) to iWindows For iC from 0 to (iWindows-1) Send Destroy of hArrayOfWindows[iC] // assume this removes all menu items of this action Loop Move (ResizeArray(hArrayOfWindows,0)) to hArrayOfWindows Move (psRecentWorkspaces.Count(ghoEditorProperties)) to iCount For iC from 0 to (iCount-1) Move "" to sLabel Move (psRecentWorkspaces.sDescription(ghoEditorProperties,iCount-1-iC)) to sLabel Get Create U_cCJRecentWSMenuItem to hArrayOfWindows[iC] Set psWorkspace of hArrayOfWindows[iC] to (psRecentWorkspaces(ghoEditorProperties,iCount-1-iC)) Set psVersion of hArrayOfWindows[iC] to (psRecentWorkspaces.sVersion(ghoEditorProperties,iCount-1-iC)) Set psCaption of hArrayOfWindows[iC] to sLabel Set psImage of hArrayOfWindows[iC] to "Default.ico" #IFDEF TH_TRANSLATION Move (Replace("%1", gILanguage[34], psRecentWorkspaces(ghoEditorProperties,iCount-1-iC))) to sDesc #ELSE Move ("Open '" - psRecentWorkspaces(ghoEditorProperties,iCount-1-iC) - "' workspace.") to sDesc #ENDIF Set psDescription of hArrayOfWindows[iC] to sDesc If (iC=0) ; Set pbControlBeginGroup of hArrayOfWindows[iC] to True Get AddDynamicControl of hArrayOfWindows[iC] hCommandBarControls to vItem End Set phArrayOfWindows to hArrayOfWindows End_Procedure End_Object Object oSaveItem is a cCJMenuItem Set pbAddToDesignerMenu to True Set pbControlBeginGroup to True Set psCaption to "&Save" Set psToolTip to "Save changes to the current source file" Set psDescription to "Save source file" Set psImage to "ActionSave.ico" Procedure OnExecute Variant vCommandBarControl Handle hoClient Get Client_Id to hoClient Send CASaveFile to hoClient End_Procedure Function IsEnabled Returns Boolean Handle hoCA hoID hoID2 Boolean bEnabled Integer iFlag iDel Get Client_Id to hoCA Move (Focus(Desktop)) to hoID If hoID Begin Move (Parent(hoID)) to hoID Get Delegation_Mode of hoID to iDel Set Delegation_Mode of hoID to no_delegate_or_error Get GetEditViewID of hoID to hoID2 Set Delegation_Mode of hoID to iDel End If hoID2 Move (isFileViewWindow(hoCA,hoID2)) to bEnabled Else Move 0 to bEnabled Function_Return bEnabled End_Function End_Object Object oSaveAsItem is a cCJMenuItem Set pbAddToDesignerMenu to True Set psCaption to "Save As..." Set psToolTip to "Save current source file with a new name" Set psDescription to "Save as file" Procedure OnExecute Variant vCommandBarControl Handle hoClient Get Client_Id to hoClient Send CASaveFileAs to hoClient End_Procedure Function IsEnabled Returns Boolean Handle hoCA hoID hoID2 Boolean bEnabled Integer iFlag iDel Get Client_Id to hoCA Move (Focus(Desktop)) to hoID If hoID Begin Move (Parent(hoID)) to hoID Get Delegation_Mode of hoID to iDel Set Delegation_Mode of hoID to no_delegate_or_error Get GetEditViewID of hoID to hoID2 Set Delegation_Mode of hoID to iDel End If hoID2 Move (isFileViewWindow(hoCA,hoID2)) to bEnabled Else Move 0 to bEnabled Function_Return bEnabled End_Function End_Object Object oSaveAllItem is a cCJMenuItem Set pbAddToDesignerMenu to True Set psCaption to "Save All" Set psToolTip to "Save changes within all opened files" Set psDescription to "Save All source files" Set psImage to "SaveAll16.ico" Procedure OnExecute Variant vCommandBarControl Handle hoClient Get Client_Id to hoClient Send CASaveAllFiles to hoClient End_Procedure Function IsEnabled Returns Boolean Handle hoCA hoID hoID2 Boolean bEnabled Integer iFlag iDel Get Client_Id to hoCA Move (Focus(Desktop)) to hoID If hoID Begin Move (Parent(hoID)) to hoID Get Delegation_Mode of hoID to iDel Set Delegation_Mode of hoID to no_delegate_or_error Get GetEditViewID of hoID to hoID2 Set Delegation_Mode of hoID to iDel End If hoID2 Move (isFileViewWindow(hoCA,hoID2)) to bEnabled Else Move 0 to bEnabled Function_Return bEnabled End_Function End_Object Object oCloseItem is a cCJMenuItem Set pbAddToDesignerMenu to True Set pbControlBeginGroup to True Set psImage to "Close16.ico" Set psCaption to "Close" Set psToolTip to "Close current opened file" Set psDescription to "Close source file" Procedure OnExecute Variant vCommandBarControl Handle hoClient Get Client_Id to hoClient Send CACloseFile to hoClient End_Procedure Function IsEnabled Returns Boolean Handle hoCA hoID hoID2 Boolean bEnabled Integer iFlag iDel Get Client_Id to hoCA Move (Focus(Desktop)) to hoID If hoID Begin Move (Parent(hoID)) to hoID Get Delegation_Mode of hoID to iDel Set Delegation_Mode of hoID to no_delegate_or_error Get GetEditViewID of hoID to hoID2 Set Delegation_Mode of hoID to iDel End If hoID2 Move (isFileViewWindow(hoCA,hoID2)) to bEnabled Else Move 0 to bEnabled Function_Return bEnabled End_Function End_Object Object oCloseAllItem is a cCJMenuItem Set pbAddToDesignerMenu to True Set psCaption to "Close All" Set psToolTip to "Close all currently opened files" Set psDescription to "Close All files" Procedure OnExecute Variant vCommandBarControl Handle hoClient Get Client_Id to hoClient Send CACloseAllFiles to hoClient End_Procedure Function IsEnabled Returns Boolean Handle hoCA hoID hoID2 Boolean bEnabled Integer iFlag iDel Get Client_Id to hoCA Move (Focus(Desktop)) to hoID If hoID Begin Move (Parent(hoID)) to hoID Get Delegation_Mode of hoID to iDel Set Delegation_Mode of hoID to no_delegate_or_error Get GetEditViewID of hoID to hoID2 Set Delegation_Mode of hoID to iDel End If hoID2 Move (isFileViewWindow(hoCA,hoID2)) to bEnabled Else Move 0 to bEnabled Function_Return bEnabled End_Function End_Object Object oPrintItem is a cCJMenuItem Set pbAddToDesignerMenu to True Set pbControlBeginGroup to True Set psCaption to "Print..." Set psToolTip to "Print current source file" Set psDescription to "Print current file" Set psImage to "ActionPrint.ico" Procedure OnExecute Variant vCommandBarControl Handle hoClient Get Client_Id to hoClient Send CAPrintFile to hoClient End_Procedure End_Object Object oOptionsItem is a cCJMenuItem Set pbAddToDesignerMenu to True Set psCaption to "Hammer Options..." Set psToolTip to "Activates The Hammer System Parameters dialog" Set psDescription to "Hammer options" Set psImage to "Options16.ico" Register_Object oTHParameters Procedure OnExecute Variant vCommandBarControl Handle hoClient Get Client_Id to hoClient Send Popup of (oTHParameters(hoClient)) End_Procedure End_Object // Should not be used (TH Parameters must be used all the time) // Object oPropertiesItem is a cCJMenuItem // Set pbAddToDesignerMenu to True // Set psCaption to "Editor Properties..." // Set psToolTip to "Activates the code editor properties (hot keys, colors, scope...)" // Set psDescription to "Editor properties" // Set psImage to "Properties16.ico" // Procedure OnExecute Variant vCommandBarControl // Handle hoClient // Get Client_Id to hoClient // Send Properties to hoClient // End_Procedure // End_Object Object oExitMenu is a cCJExitMenuItem Set pbControlBeginGroup to True End_Object #IFDEF TH_TRANSLATION Procedure Translate Set psCaption of oNewItem to gILanguage[3] Set psToolTip of oNewItem to gILanguage[4] Set psDescription of oNewItem to gILanguage[5] Set psCaption of oOpenItem to gILanguage[6] Set psToolTip of oOpenItem to gILanguage[7] Set psDescription of oOpenItem to gILanguage[8] Set psCaption of oOpenPkgItem to gILanguage[9] Set psToolTip of oOpenPkgItem to gILanguage[10] Set psDescription of oOpenPkgItem to gILanguage[11] Set psCaption of oOpenDDItem to gILanguage[12] Set psToolTip of oOpenDDItem to gILanguage[13] Set psDescription of oOpenDDItem to gILanguage[14] Set psCaption of oOpenWebItem to gILanguage[15] Set psToolTip of oOpenWebItem to gILanguage[16] Set psDescription of oOpenWebItem to gILanguage[17] Set psCaption of oOpenDFPkgItem to gILanguage[18] Set psToolTip of oOpenDFPkgItem to gILanguage[19] Set psDescription of oOpenDFPkgItem to gILanguage[20] Set psCaption of oRecentPopupMenu to gILanguage[21] Set psDescription of oRecentPopupMenu to gILanguage[22] Set psCaption of oWorkspacePopupMenu to gILanguage[24] Set psDescription of oWorkspacePopupMenu to gILanguage[25] Set psCaption of oWorkspaceItem to gILanguage[26] Set psToolTip of oWorkspaceItem to gILanguage[27] Set psDescription of oWorkspaceItem to gILanguage[28] Set psCaption of oDirectoryItem to gILanguage[29] Set psToolTip of oDirectoryItem to gILanguage[30] Set psDescription of oDirectoryItem to gILanguage[31] Set psCaption of oConfigureItem to gILanguage[32] Set psToolTip of oConfigureItem to gILanguage[33] Set psCaption of oSaveItem to gILanguage[35] Set psToolTip of oSaveItem to gILanguage[36] Set psDescription of oSaveItem to gILanguage[37] Set psCaption of oSaveAsItem to gILanguage[38] Set psToolTip of oSaveAsItem to gILanguage[39] Set psDescription of oSaveAsItem to gILanguage[40] Set psCaption of oSaveAllItem to gILanguage[41] Set psToolTip of oSaveAllItem to gILanguage[42] Set psDescription of oSaveAllItem to gILanguage[43] Set psCaption of oCloseItem to gILanguage[44] Set psToolTip of oCloseItem to gILanguage[45] Set psDescription of oCloseItem to gILanguage[46] Set psCaption of oCloseAllItem to gILanguage[47] Set psToolTip of oCloseAllItem to gILanguage[48] Set psDescription of oCloseAllItem to gILanguage[49] Set psCaption of oPrintItem to gILanguage[50] Set psToolTip of oPrintItem to gILanguage[51] Set psDescription of oPrintItem to gILanguage[52] Set psCaption of oOptionsItem to gILanguage[53] Set psToolTip of oOptionsItem to gILanguage[54] Set psDescription of oOptionsItem to gILanguage[55] Set psCaption of oExitMenu to gILanguage[56] Set psToolTip of oExitMenu to gILanguage[57] Set psDescription of oExitMenu to gILanguage[58] End_Procedure #ENDIF Procedure OnPopupInit Forward Send OnPopupInit Send AddCJKeyStringToMenuItem (oNewItem (Self)) CMD_FileNewFile Send AddCJKeyStringToMenuItem (oOpenItem (Self)) CMD_FileOpenFile Send AddCJKeyStringToMenuItem (oSaveItem (Self)) CMD_FileSaveFile Send AddCJKeyStringToMenuItem (oSaveAsItem (Self)) CMD_FileSaveFileAs Send AddCJKeyStringToMenuItem (oSaveAllItem (Self)) CMD_FileSaveAll Send AddCJKeyStringToMenuItem (oCloseItem (Self)) CMD_FileCloseFile Send AddCJKeyStringToMenuItem (oCloseAllItem(Self)) CMD_FileCloseAllFiles End_Procedure End_Object