// cOutputDialog.pkg // Use Dftreevw.pkg Use Menu\TH3OutputContextMenu.mn Use cEditorHotKey_Mixin.pkg Class cOutputImageList is a cImageList32 Procedure OnCreate // add the images Integer iImage Get AddBitmap 'Run16.bmp' clFuchsia to iImage Get AddBitmap 'Include16.bmp' clFuchsia to iImage End_Procedure End_Class Class cOutputMessages is a TreeView Procedure Construct_Object Forward Send Construct_Object Property Integer piCanCancel False Property Integer piCombineOutput False Property String[] psLines Property String[] psFiles Property Handle[] phFiles Set Size to 200 200 Set Location to 0 0 Set peAnchors to anAll Object oOutputImageList is a cOutputImageList Set piMaxImages to 8 End_Object Set ImageListObject to (oOutputImageList(Self)) On_Key kEnter Send OnItemClicked On_Key KCLOSE_PANEL Send OutputMessageRemoveTab Set piTextColor to gtColorer[EC_TEXT].iForeC Set piBackColor to gtColorer[EC_TEXT].iBackC Set piLineColor to gtColorer[EC_TEXT].iForeC End_Procedure Procedure CutCopy Handle hItem Integer iData String sData String[] saLines saFiles Get CurrentTreeItem to hItem Get ItemData hItem to iData Get ItemLabel hItem to sData If (piCombineOutput(Self)) Begin If (iData) Begin Get psFiles to saFiles Move (saFiles[Low(iData)]*'at'*sData) to sData End End // Direct_Output channel 9 "Clipboard:" Writeln channel 9 sData Close_Output channel 9 End_Procedure Procedure Cut Send CutCopy End_Procedure Procedure Copy Send CutCopy End_Procedure Function CanCopy Returns Boolean Function_Return True End_Function Function CanCut Returns Boolean Function_Return True End_Function Procedure OnItemRClick Handle hItem Set phInvokingObject of (oOutputContextMenu(Self)) to (Object_Id(Self)) Set phInvokingItem of (oOutputContextMenu(Self)) to hItem Send Popup to (oOutputContextMenu(Self)) End_Procedure Procedure OutputMessages String sFile String[] saLines Integer iLine iLines Get psLines to saLines Move (SizeOfArray(saLines)) to iLines Direct_Output channel 9 sFile For iLine from 0 to (iLines-1) Writeln channel 9 saLines[iLine] Loop Close_Output channel 9 End_Procedure Procedure OutputMessageCopy String[] saLines Get psLines to saLines If (SizeOfArray(saLines)) Send OutputMessages "Clipboard:" End_Procedure Procedure OutputMessageSave Handle hoFile hoClient Integer iLine iLines bSave String[] saLines String sFile Get psLines to saLines Move (SizeOfArray(saLines)) to iLines If (iLines) Begin Get Client_Id to hoClient Get Create U_SaveAsDialog to hoFile If (hoFile) Begin Set Dialog_Caption of hoFile to (_T("Please select the file", 468)) Set FileMustExist_State of hoFile to False Set NoChangeDir_State of hoFile to False End Get Show_Dialog of hoFile to bSave If bSave Get File_Name of hoFile to sFile // Send Destroy to hoFile If (sFile="") Procedure_Return // Send OutputMessages sFile // Send CAOpenFile to hoClient sFile End End_Procedure Procedure OutputMessageOpenFile String sFile Integer iLine Handle hoClient hoEditor Integer iOK Get Client_Id to hoClient Send CAOpenFile of hoClient sFile Get FindViewByFileName of hoClient sFile to hoEditor If (hoEditor) Begin Send Activate to (oEdit(hoEditor)) If (iLine) Begin Send GotoLine to (oEdit(hoEditor)) (iLine-1) Get CM_SetHighlightedLine of (oEdit(hoEditor)) (iLine-1) to iOK End End End_Procedure Procedure OutputMessageRemoveTab Handle hPage Get Parent to hPage Delegate Send Remove_Output_Page hPage End_Procedure Procedure OutputMessageCancel Handle hoClient Get Client_Id to hoClient If (piCanCancel(Self)) Send RequestCancelFileFind to hoClient End_Procedure Procedure Mouse_Up Integer iP1 Send OnItemClicked End_Procedure Procedure OnItemClicked Integer iData Handle hItem Get CurrentTreeItem to hItem Get ItemData hItem to iData String[] saFiles If (iData) Begin Get psFiles to saFiles If (iData) Send OutputMessageOpenFile saFiles[Low(iData)] (Hi(iData)) End End_Procedure Procedure Add_Line String sLine Handle hRoot hFile String sFile sPosition sOutput sLineNo String sOcc sFF sScan String[] saLines String[] saFiles Handle[] haFiles Get psLines to saLines Get psFiles to saFiles Get phFiles to haFiles Integer iLine iFile iData Move sLine to saLines[SizeOfArray(saLines)] Move sLine to sOutput #IFDEF TH_TRANSLATION If (Uppercase(Left(sLine, 13))="SEARCHING FOR") Begin Move (Replace(Left(sLine, 13), sLine, gILanguage[471])) to sOutput End If (sLine contains "occurrence(s) have been found in") Begin Move (Left(sLine, Pos(' ', sLine)-1)) to sOcc Move (Replace(sOcc * "occurrence(s) have been found in ", sLine, "")) to sLine Move (Trim(Left(sLine, Pos(' ', sLine)-1))) to sFF Move (Replace(sFF * "file(s) of ", sLine, "")) to sLine Move (Trim(Left(sLine, Pos(' ', sLine)-1))) to sScan Move gILanguage[472] to sOutput Move (Replace("%1", sOutput, sOcc)) to sOutput Move (Replace("%2", sOutput, sFF)) to sOutput Move (Replace("%3", sOutput, sScan)) to sOutput End #ENDIF Move (_T("Line #", 473)) to sLineNo If ( (Pos('<', sLine)>0) and (Pos('>:', sLine)>0) ) Begin Move (Left(sLine, Pos("<", sLine)-1)) to sFile Move (Replace(sFile, sLine, "")) to sLine Move (Left(sLine, Pos(">:", sLine)+1)) to sPosition Move (Replace(sPosition, sLine, "")) to sLine Move (Replace('<', sPosition, "")) to sPosition Move (Replace('>:', sPosition, "")) to sPosition Move (SearchArray(sFile, saFiles)) to iFile If (iFile<0) Begin Move (SizeOfArray(saFiles)) to iFile Move sFile to saFiles[iFile] If (piCombineOutput(Self)) ; Get AddTreeItem sFile 0 0 0 0 to hFile Move hFile to haFiles[iFile] End Else Move haFiles[iFile] to hFile If (piCombineOutput(Self)) Move (sLineNo*sPosition+": "+sLine) to sOutput Else Begin Move 0 To hFile // show all results not checked, show on same line, but format a bit Move (sFile*"-"*sLineNo*sPosition+": "+ltrim(sLine)) to sOutput End Move sPosition to iLine Move (iFile + (65536 * iLine)) to iData End // Get AddTreeItem sOutput hFile 0 1 1 to hRoot Set ItemData hRoot to iData // Set psFiles to saFiles Set phFiles to haFiles Set psLines to saLines End_Procedure End_Class Class cOutputPage is a TabPage Procedure Construct_Object Forward Send Construct_Object Object oMessages is a cOutputMessages End_Object End_Procedure End_Class Class cOutputImageList32 is a cImageList32 Procedure Construct_Object Forward Send Construct_Object Set piMaxImages to 8 End_Procedure Procedure OnCreate // add the images Integer iImage Get AddImage 'OutputTabDlg16.bmp' clFuchsia to iImage End_Procedure End_Class Class cOutputDialog is a TabDialog Import_Class_Protocol cEditorHotKey_Mixin // override of the import Function IsInEditorView Returns Boolean Function_Return False End_Function // override of the import Function RerouteHotKeys Returns Boolean Function_Return True End_Function Procedure Construct_Object Forward Send Construct_Object Set Size to 204 181 Set Location to 0 0 Set Rotate_Mode to RM_Rotate Set peAnchors to anAll Set peTabStyle to tsFlatButtons Set peTabPosition to tpBottom Set TabWidth_Mode to twRaggedRight //twFixedWidth Set pbFlatSeparators to True Send Define_cEditorHotKey_Mixin On_Key KCLOSE_PANEL Send Remove_Current_TabPage Object oAppImageList is a cOutputImageList32 End_Object Set phoImageList to (oAppImageList(Self)) End_Procedure Procedure Remove_Current_TabPage Integer iTab Integer hoTab Get Current_Tab to iTab Get Tab_Page_Id iTab To hoTab If (hoTab) Begin Send Remove_Output_Page hoTab End End_Procedure Function Output_Area Handle hPage Returns Handle Function_Return (oMessages(hPage)) End_Function Function Add_Output_Page String sLabel Returns Handle Handle hPage Integer iTab Get Create U_cOutputPage to hPage Get Button_Count to iTab Set Label of hPage to (sLabel * String(iTab)) Set piImageIndex of hPage to 1 If (iTab>0) ; Send Request_Switch_To_Tab (iTab-1) 2 Function_Return hPage End_Function Procedure Remove_Tab_Page Integer iTab Integer hTabObj iIc Get Item_Count to iIC Decrement iIC If (iIC Gt 0) Begin // don't delete last Tab Get tab_page_id item iTab to hTabObj Send windows_Message TCM_DELETEITEM iTab 0 Send Deactivate to hTabObj 0 Send delete_item iTab Send Rebuild_Items If (active_state(Self)) Begin If iTab Eq iIC Send Request_switch_to_tab (iTab -1) 2 Else Send Request_switch_to_tab iTab 2 Set current_item to (current_item(Self)) End Send Request_destroy_object to hTabObj End End_Procedure Procedure Remove_Output_Page Integer hPage Handle hTabPage Integer iItem iItems Get Button_Count to iItems For iItem from 0 to (iItems-1) Get tab_page_id item iItem to hTabPage If (hTabPage Eq hPage) Begin Send Remove_Tab_Page iItem Procedure_Return End Loop End_Procedure Procedure Rebuild_Items Integer iItm hTabPg iItems Get Button_Count to iItems For iItm from 0 to (iItems-1) Get tab_page_id item iItm to hTabPg Set Tab_Button_item of hTabPg to iItm Loop End_Procedure Procedure End_Construct_Object Forward Send End_Construct_Object Get Object_Id to ghoOutputDialog End_Procedure End_Class