// Use Output.utl // Sequential output to whatever #IFDEF IS$WINDOWS Use Aps #IFDEF USE$VPE #IFDEF IS$NEW$FMAC // VDF 6 Use VpeBase3 //JK: Now uses VPE 3.x #ELSE Use VpeBase #ENDIF Object oOutputVPE is a cVPE End_Object #ELSE Use DFWinRpt #ENDIF #ELSE // Character mode: Use App.utl // Character Mode classes Use Wait.utl // #ENDIF Use Dates.utl // Date manipulation for VDF and 3.2 Use Files.utl // Utilities for handling file related stuff Use MsgBox.utl // obs procedure Use Seq_Chnl // Defines global sequential device management operations (DAC) Use Language.pkg // Default language setup Use API_Attr.nui // Functions for querying API attributes (No User Interface) Use Strings.nui // String manipulation for VDF and 3.2 (No User Interface) // =========================================================================== // LANGUAGE DEPENDANT TEXT CONSTANTS // =========================================================================== #IF LNG_DEFAULT=lng_dutch define t.output.GoPg_Label for "Ga naar pagina" define t.output.Find for "Zoeken" define t.output.Search_string for "Zoektekst" define t.output.Case_sensitive for "Identieke Hoofd/kleine letters" define t.output.Searching for "Bezig met zoeken naar tekst..." define t.output.PressAnyKey for "Druk op een toets om te onderbreken" define t.output.CancelSearch for "Zoeken annuleren?" define t.output.TextNotFound for "' niet gevonden!" define t.output.NotToScreen for "Niet het scherm!" define t.output.Main1 for " &Einde" define t.output.Main1_1 for "&Einde\aEsc" define t.output.Main2 for " &Navigeren" define t.output.Main2_1 for "V&orige pagina \aPgUp" define t.output.Main2_2 for "&Volgende pagina \aPgDn" define t.output.Main2_3 for "16 regels Om&hoog\a-" define t.output.Main2_4 for "16 regels Om&laag\a+" define t.output.Main2_5 for "Eerste pagina \aCtrl+PgUp" define t.output.Main2_6 for "Laatste pagina \aCtrl+PgDn" define t.output.Main2_7 for "&Ga naar pagina\aAlt-G" define t.output.Main2_8 for "Regel begin\aHome" define t.output.Main2_9 for "Links" define t.output.Main2_10 for "Rechts" define t.output.Main2_11 for "Regel einde\aEnd" define t.output.Main3 for " &Zoeken" define t.output.Main3_1 for "&Zoeken\aF2" define t.output.Main3_2 for "Zoek &volgende\aSF2" define t.output.Main4 for " Af&drukken" define t.output.Main4_1 for "Af&drukken rapport" #ENDIF #IF LNG_DEFAULT=lng_spanish // 03/10/2002 25/01/2004 Pepe Guimares Moose Software pg@moose-software.com define t.output.GoPg_Label for "Ir a pagina" define t.output.Find for "Buscar" define t.output.Search_string for "Buscar cadena" define t.output.Case_sensitive for "Sensible Mayscula-Minscula" define t.output.Searching for "Buscando cadena..." define t.output.PressAnyKey for "Pulse tecla para interrumpir" define t.output.CancelSearch for "Cancelar Bsqueda?" define t.output.TextNotFound for "' no encontrado!" define t.output.NotToScreen for "No mostrar en Pantalla" define t.output.Main1 for " &Salir" define t.output.Main1_1 for "&Salir\aEsc" define t.output.Main2 for " &Navegar" define t.output.Main2_1 for "&Pgina Ant. \aPgUp" define t.output.Main2_2 for "Pgina S&ig. \aPgDn" define t.output.Main2_3 for "S&ubir 16 lneas\a-" define t.output.Main2_4 for "&Bajar 16 lneas\a+" define t.output.Main2_5 for "Pgina Inicial \aCtrl+PgUp" define t.output.Main2_6 for "Pgina Final \aCtrl+PgDn" define t.output.Main2_7 for "&Ir a pgina\aAlt-I" define t.output.Main2_8 for "Inicio de Lnea\aHome" define t.output.Main2_9 for "Izquierda" define t.output.Main2_10 for "Derecha" define t.output.Main2_11 for "Fin de Lnea\aEnd" define t.output.Main3 for " Bus&car" define t.output.Main3_1 for "Busc&ar" define t.output.Main3_2 for "Buscar Si&guiente\aSF2" define t.output.Main4 for " &Imprimir" define t.output.Main4_1 for "&Imprimir Informe" #ENDIF #IF LNG_DEFAULT=lng_english define t.output.GoPg_Label for "Go to page" define t.output.Find for "Find" define t.output.Search_string for "Search string" define t.output.Case_sensitive for "Case sensitive" define t.output.Searching for "Searching for string..." define t.output.PressAnyKey for "Press any key to interrupt" define t.output.CancelSearch for "Cancel search?" define t.output.TextNotFound for "' not found!" define t.output.NotToScreen for "Not screen!" define t.output.Main1 for " &Exit" define t.output.Main1_1 for "&Exit\aEsc" define t.output.Main2 for " &Navigate" define t.output.Main2_1 for "&Prev. page \aPgUp" define t.output.Main2_2 for "&Next page \aPgDn" define t.output.Main2_3 for "16 lines &Up\a-" define t.output.Main2_4 for "16 lines &Down\a+" define t.output.Main2_5 for "First page \aCtrl+PgUp" define t.output.Main2_6 for "Last page \aCtrl+PgDn" define t.output.Main2_7 for "&Go to page\aAlt-G" define t.output.Main2_8 for "Line start\aHome" define t.output.Main2_9 for "Left" define t.output.Main2_10 for "Right" define t.output.Main2_11 for "Linie end\aEnd" define t.output.Main3 for " &Search" define t.output.Main3_1 for "&Search\aF2" define t.output.Main3_2 for "&Find next\aSF2" define t.output.Main4 for " &Print" define t.output.Main4_1 for "&Print report" #ENDIF #IF LNG_DEFAULT=lng_danish define t.output.GoPg_Label for "G til side" define t.output.Find for "Sg" define t.output.Search_string for "Sgestreng" define t.output.Case_sensitive for "Case sensitive" define t.output.Searching for "Sger efter tekst..." define t.output.PressAnyKey for "Tryk p en tast for at afbryde" define t.output.CancelSearch for "Afbryd sgningen?" define t.output.TextNotFound for "' ikke fundet!" define t.output.NotToScreen for "Ikke skrm!" define t.output.Main1 for " &Afslut" define t.output.Main1_1 for "&Afslut\aEsc" define t.output.Main2 for " &Navigr" define t.output.Main2_1 for "&Forr. side \aPgUp" define t.output.Main2_2 for "&Nste side \aPgDn" define t.output.Main2_3 for "16 linier &Op\a-" define t.output.Main2_4 for "16 linier &Ned\a+" define t.output.Main2_5 for "Frste side \aCtrl+PgUp" define t.output.Main2_6 for "Sidste side \aCtrl+PgDn" define t.output.Main2_7 for "&G til side\aAlt-G" define t.output.Main2_8 for "Linie start\aHome" define t.output.Main2_9 for "Venstre" define t.output.Main2_10 for "Hjre" define t.output.Main2_11 for "Linie slut\aEnd" define t.output.Main3 for " &Sg" define t.output.Main3_1 for "&Sg\aF2" define t.output.Main3_2 for "&Find nste\aSF2" define t.output.Main4 for " &Udskriv" define t.output.Main4_1 for "&Udskriv rapport" #ENDIF #IF LNG_DEFAULT=lng_swedish define t.output.GoPg_Label for "G till sida" define t.output.Find for "Sk" define t.output.Search_string for "Sk strng" define t.output.Case_sensitive for "Case sensitive" define t.output.Searching for "Sker efter text..." define t.output.PressAnyKey for "Tryck p en tangent fr att avbryta skningen" define t.output.CancelSearch for "Avbryt skningen?" define t.output.TextNotFound for "' ej funnet!" define t.output.NotToScreen for "Ej skrm!" define t.output.Main1 for " &Exit" define t.output.Main1_1 for "&Avslut\aEsc" define t.output.Main2 for " &Navigr" define t.output.Main2_1 for "&Forr. sida \aPgUp" define t.output.Main2_2 for "&Nste sida \aPgDn" define t.output.Main2_3 for "16 linjer &Op\a-" define t.output.Main2_4 for "16 linjer &Ned\a+" define t.output.Main2_5 for "Frste sida \aCtrl+PgUp" define t.output.Main2_6 for "Sidste sida \aCtrl+PgDn" define t.output.Main2_7 for "&G till sida\aAlt-G" define t.output.Main2_8 for "Linje start\aHome" define t.output.Main2_9 for "Venstre" define t.output.Main2_10 for "Hjre" define t.output.Main2_11 for "Linje slut\aEnd" define t.output.Main3 for " &Sk" define t.output.Main3_1 for "&Sk\aF2" define t.output.Main3_2 for "&Finn nste\aSF2" define t.output.Main4 for " &Print" define t.output.Main4_1 for "&Print rapport" #ENDIF #IF LNG_DEFAULT=lng_norwegian define t.output.GoPg_Label for "G til side" define t.output.Find for "Sk" define t.output.Search_string for "Skestreng" define t.output.Case_sensitive for "Case sensitive" define t.output.Searching for "Sker etter tekst..." define t.output.PressAnyKey for "Trykk p en tast for avbryte skningen" define t.output.CancelSearch for "Avbryt skningen?" define t.output.TextNotFound for " ikke funnet!" define t.output.NotToScreen for "Ikke skjerm!" define t.output.Main1 for " &Avslutt" define t.output.Main1_1 for "&Avslutt\aEsc" define t.output.Main2 for " &Navigr" define t.output.Main2_1 for "&Forr. side \aPgUp" define t.output.Main2_2 for "&Neste side \aPgDn" define t.output.Main2_3 for "16 linjer &Opp\a-" define t.output.Main2_4 for "16 linjer &Ned\a+" define t.output.Main2_5 for "Frste side \aCtrl+PgUp" define t.output.Main2_6 for "siste side \aCtrl+PgDn" define t.output.Main2_7 for "&G til side\aAlt-G" define t.output.Main2_8 for "linje start\aHome" define t.output.Main2_9 for "Venstre" define t.output.Main2_10 for "Hyre" define t.output.Main2_11 for "linje slutt\aEnd" define t.output.Main3 for " &Sk" define t.output.Main3_1 for "&Sk\aF2" define t.output.Main3_2 for "&Finn neste\aSF2" define t.output.Main4 for " &Utskriv" define t.output.Main4_1 for "&Utskriv rapport" #ENDIF #IF LNG_DEFAULT=lng_german define t.output.GoPg_Label for "Gehe zu Seite" define t.output.Find for "Suchen" define t.output.Search_string for "Suchbegriff" define t.output.Case_sensitive for "Gro/Kleinschreibung" define t.output.Searching for "Suche luft..." define t.output.PressAnyKey for "Zum Unterbrechen eine Taste drcken" define t.output.CancelSearch for "Suche abbrechen?" define t.output.TextNotFound for "' nicht gefunden!" define t.output.NotToScreen for "Nicht auf Bildschirm!" define t.output.Main1 for " &Abbrechen" define t.output.Main1_1 for "&Beenden\aEsc" define t.output.Main2 for " &Navigation" define t.output.Main2_1 for "&Vorh. Seite \aPgUp" define t.output.Main2_2 for "&Nchste Seite \aPgDn" define t.output.Main2_3 for "16 Zeilen &Zurck\a-" define t.output.Main2_4 for "16 lines &Vor\a+" define t.output.Main2_5 for "Erste Seite \aCtrl+PgUp" define t.output.Main2_6 for "Letzte Seite \aCtrl+PgDn" define t.output.Main2_7 for "&Gehe zu Seite\aAlt-G" define t.output.Main2_8 for "Zeilenbeginn\aHome" define t.output.Main2_9 for "Links" define t.output.Main2_10 for "Rechts" define t.output.Main2_11 for "Zeilenende\aEnd" define t.output.Main3 for " &Suchen" define t.output.Main3_1 for "&Suchen\aF2" define t.output.Main3_2 for "&Nchsten Suchen\aSF2" define t.output.Main4 for " &Drucken" define t.output.Main4_1 for "&Drucken Bericht" #ENDIF #IF LNG_DEFAULT=lng_portuguese // by Claudio Rossoni (SP-Brasil) define t.output.GoPg_Label for "Ir para a pgina" //"Go to page" define t.output.Find for "Procurar" //"Find" define t.output.Search_string for "Procurar string" //"Search string" define t.output.Case_sensitive for "Sensibilidade a Maiuscula-Minuscula" //"Case sensitive" define t.output.Searching for "Procurando por..." //"Searching for string..." define t.output.PressAnyKey for "Pressione qq. tecla para interromper" //"Press any key to interrupt" define t.output.CancelSearch for "Cancelar a procura?" //"Cancel search?" define t.output.TextNotFound for "' no encontrado!" //"' not found!" define t.output.NotToScreen for "No mostrar em vdeo" //"Not screen!" define t.output.Main1 for " &Sair" //" &Exit" define t.output.Main1_1 for "&Sair\aEsc" //"&Exit\aEsc" define t.output.Main2 for " &Navegar" //" &Navigate" define t.output.Main2_1 for "&Pgina Ant. \aPgUp" //"&Prev. page" define t.output.Main2_2 for "P&rxima Pgina \aPgDn" //"&Next page" define t.output.Main2_3 for "S&ubir 16 linhas\a-" //"16 lines &Up\a-" define t.output.Main2_4 for "&Descer 16 linhas\a+" //"16 lines &Down\a+" define t.output.Main2_5 for "Pgina Inicial \aCtrl+PgUp" define t.output.Main2_6 for "Pgina Final \aCtrl+PgDn" define t.output.Main2_7 for "&Ir para a pgina\aAlt-I" //"&Go to page\aAlt-G" define t.output.Main2_8 for "Incio de &Linha\aHome" //"Line start\aHome" define t.output.Main2_9 for "Esquerda" //"Left" define t.output.Main2_10 for "Direita" //"Right" define t.output.Main2_11 for "Fim da Linha\aEnd" //"Linie end\aEnd" define t.output.Main3 for " &Procurar" //" &Search" define t.output.Main3_1 for "&Procurar\aF2" //"&Search\aF2" define t.output.Main3_2 for "Procurar Se&guinte\aSF2" //"&Find next\aSF2" define t.output.Main4 for " &Imprimir" //"&Print" define t.output.Main4_1 for "&Imprimir o Relatrio" //"&Print report" #ENDIF #IF LNG_DEFAULT=lng_french // French by Arnaud Mallick (Fr) (Arnaud.mallick@wanadoo.fr) define t.output.GoPg_Label For "Aller la page" define t.output.Find For "Trouve" define t.output.Search_string For "Rechercher" define t.output.Case_sensitive For "Repecter Maj/Min" define t.output.Searching For "Recherche..." define t.output.PressAnyKey For "Appuyer sur une touche pour arrter" define t.output.CancelSearch For "Annuler la recherche?" define t.output.TextNotFound For "' pas trouv!" define t.output.NotToScreen For "Pas affich!" define t.output.Main1 For " Quitt&er" define t.output.Main1_1 For "Quitt&er\aEsc" define t.output.Main2 For " &Naviguer" define t.output.Main2_1 For "Page &Prc. \aPgUp" define t.output.Main2_2 For "Page Suiva&nte \aPgDn" define t.output.Main2_3 For "Ha&usser de 16 lignes\a-" //Bof define t.output.Main2_4 For "&Descendre de 16 lignes\a+" define t.output.Main2_5 For "Premire page \aCtrl+PgUp" define t.output.Main2_6 For "Dernire page \aCtrl+PgDn" define t.output.Main2_7 For "Aller(&G) la page\aAlt-G" //pas trouv mieux avec un G define t.output.Main2_8 For "Ligne de dbut\aHome" define t.output.Main2_9 For "Gauche" define t.output.Main2_10 For "Droite" define t.output.Main2_11 For "Fin de ligne\aEnd" define t.output.Main3 For " Recherche&s" define t.output.Main3_1 For "Recherche&s\aF2" define t.output.Main3_2 For "Suivant\aSF2" define t.output.Main4 For " Im&prime" define t.output.Main4_1 For "Im&prime rapport" #ENDIF #IF LNG_DEFAULT=lng_italian // 05/03/04 Paolo Zanni (Italia) define t.output.GoPg_Label for "Vai alla pagina" define t.output.Find for "Trova" define t.output.Search_string for "Cerca stringa" define t.output.Case_sensitive for "Distinzione maiuscole/minuscole" define t.output.Searching for "Ricerca per stringa..." define t.output.PressAnyKey for "Premere un tasto per interrompere" define t.output.CancelSearch for "Cancella ricerca?" define t.output.TextNotFound for "' non trovato!" define t.output.NotToScreen for "Not screen!" define t.output.Main1 for " Uscita" define t.output.Main1_1 for "Uscita\aEsc" define t.output.Main2 for " Navigare" define t.output.Main2_1 for "Pagina precedente \aPgUp" define t.output.Main2_2 for "Pagina successiva \aPgDn" define t.output.Main2_3 for "16 linee su\a-" define t.output.Main2_4 for "16 linee giu'\a+" define t.output.Main2_5 for "Pagina iniziale \aCtrl+PgUp" define t.output.Main2_6 for "Pagina finale \aCtrl+PgDn" define t.output.Main2_7 for "Vai alla pagina\aAlt-G" define t.output.Main2_8 for "Line start\aHome" define t.output.Main2_9 for "Sinistra" define t.output.Main2_10 for "Destra" define t.output.Main2_11 for "Linie end\aEnd" define t.output.Main3 for " Ricerca" define t.output.Main3_1 for " Ricerca\aF2" define t.output.Main3_2 for " Cerca successivo\aSF2" define t.output.Main4 for " Stampa" define t.output.Main4_1 for " Stampa report" #ENDIF // =========================================================================== // CONSTANTS DECLARATIONS // =========================================================================== define DEST_NONE for 0 define DEST_PRINTER for 1 define DEST_SCREEN for 2 define DEST_FILE for 3 define DEST_HTML for 4 define DEST_EDITOR for 5 define DEST_EMAIL for 6 define FILEEXISTS_CANCEL for 0 define FILEEXISTS_APPEND for 1 define FILEEXISTS_OVERWRITE for 2 define FILEEXISTS_PROMPT for 3 // Ask the operator // =========================================================================== // BASIC OUTPUT CLASS // =========================================================================== indicator output$move_up? string output$code string output$symbollist 255 integer output$idx integer seq.object# #COMMAND OUTPUT.DEFINE_CODE string gl_code!1 #REPLACE code_symbol!1 !2 #REPLACE codebuild!Zt !2 define idx!1 [ output$move_up?] if output$idx eq idx!1 move gl_code!1 to output$code [~output$move_up?] if output$idx eq idx!1 move output$code to gl_code!1 #ENDCOMMAND goto output$skip_definition output$code_move: Enumeration_List output.define_code _nop "" output.define_code _initialize "" output.define_code _reset "" output.define_code _bold_on "" output.define_code _bold_off "" output.define_code _italics_on "" output.define_code _italics_off "" output.define_code _underline_on "" output.define_code _underline_off "" output.define_code _user_on "" output.define_code _user_off "" output.define_code _cpi10 "" output.define_code _cpi12 "" output.define_code _cpi17 "" output.define_code _lpi03 "" output.define_code _lpi06 "" output.define_code _lpi08 "" output.define_code _lpi12 "" output.define_code _lpi72 "" output.define_code _macro_def_pre "" output.define_code _macro_def_post "" output.define_code _macro_call_pre "" output.define_code _macro_call_post "" output.define_code _macro_kill_pre "" output.define_code _macro_kill_post "" output.define_code _paper_tray_1 "" output.define_code _paper_tray_2 "" output.define_code _paper_tray_3 "" output.define_code _paper_tray_4 "" output.define_code _pos_push "" output.define_code _pos_pop "" #REPLACE output$max_code (!Zt -1) End_Enumeration_List return output$skip_definition: #COMMAND BUILD_CODE_SYMBOLS #IFDEF codebuild!e move (OUTPUT$SYMBOLLIST+codebuild!e) to OUTPUT$SYMBOLLIST #SET E$ !E BUILD_CODE_SYMBOLS #ENDIF #ENDCOMMAND #PUSH !e #SET E$ 0 move "" to OUTPUT$SYMBOLLIST BUILD_CODE_SYMBOLS #POP E$ procedure output.get_code integer code# indicate output$move_up? true move code# to output$idx gosub output$code_move end_procedure procedure output.set_code integer code# indicate output$move_up? false move code# to output$idx gosub output$code_move end_procedure procedure output.zero_codes local integer code# move "" to output$code for code# from 0 to output$max_code send output.set_code code# loop end_procedure send output.zero_codes function output.replace_codes global string str# returns string local integer code# local string symb# if "<" in str# begin for code# from 0 to output$max_code send output.get_code code# move (replaces(mid(output$symbollist,5,code#*5+1),str#,output$code)) to str# loop end function_return str# end_function function output.remove_codes global string str# returns string local integer code# local string symb# if "<" in str# begin for code# from 0 to output$max_code move (replaces(mid(output$symbollist,5,code#*5+1),str#,"")) to str# loop end function_return str# end_function class cBasicSequentialOutputEMailRecipients is a cArray item_property_list item_property string psName.i item_property string psAddress.i end_item_property_list cBasicSequentialOutputEMailRecipients procedure add_recipient string lsName string lsAddress local integer liRow get row_count to liRow set psName.i liRow to lsName set psAddress.i liRow to lsAddress end_procedure end_class // cBasicSequentialOutputEMailRecipients class cBasicSequentialOutput is a cArray procedure construct_object integer img# forward send construct_object img# set delegation_mode to delegate_to_parent move self to seq.object# property string pTitle public "Un-titled" property date pInitDate public 0 property string pInitTime public "" property integer pDestination public DEST_SCREEN property integer pOutputChannel public -1 #IFDEF _UNIX_ property string pPrinterPort public "dbms.res" #ELSE property string pPrinterPort public "LPT1:" #ENDIF property string pOutFileName public "dataflex.txt" property string pScreenTmpFile public "" // Used when printing to screen AND *email* property integer pFileExistsAction public FILEEXISTS_OVERWRITE // If set to FILEEXISTS_CANCEL the report will refuse to print to an existing file! property integer pOmitFormFeed public 0 property integer pLineCount public 0 property integer pPageCount public 0 property integer pPageLength public 50 // 0 means continous property integer pBytesWritten public 0 property integer phMsg_Object public 0 property integer pHeader_image public 0 property integer pHeader_height public 0 // number of lines in header. property integer pHeader_msg public 0 property integer pSubHeader_image public 0 property integer pSubHeader_height public 0 // number of lines in subheader. property integer pSubHeader_msg public 0 property integer pFooter_image public 0 property integer pFooter_height public 0 // number of lines in footer. property integer pFooter_msg public 0 property integer pFooterFill_image public 0 property integer pOnceOnly_image public 0 property integer pOnceOnly_height public 0 property integer pOnceOnly_msg public 0 property integer pInUseState public false property integer pWidth public 77 property integer pbOemToAnsi public 0 object oPageOffSets is an array no_image end_object object oChannelAdmin is a cChannelAdmin no_image end_object #IFDEF USE$VPE property integer pOriginalVPE_Object public 0 #ENDIF object oEmailRecipients is a cBasicSequentialOutputEMailRecipients end_object // ". /dfds01/appl/scripts/sendfile #F# #A#" property string psSendMailProgramPath public "" end_procedure procedure add_recipient string lsName string lsAddress send add_recipient to (oEmailRecipients(self)) lsName lsAddress end_procedure procedure reset_recipients send delete_data to (oEmailRecipients(self)) end_procedure function iUseSequentialChannel returns integer #IFDEF IS$WINDOWS local integer destination# get pDestination to destination# function_return (destination#=DEST_FILE or destination#=DEST_HTML or destination#=DEST_EDITOR) #ELSE // Character mode: function_return 1 // If character mode we always need a channel #ENDIF end_function // iUseSequentialChannel function iPageBreakNeeded integer lines# returns integer local integer pageend# get pPageLength to pageend# if pageend# eq 0 function_return 0 function_return (lines#>(pageend#-pLineCount(self)-pFooter_height(self))) end_function function iAvailablePageLength returns integer local integer pageend# headerlines# subheaderlines# footerlines# get pPageLength to pageend# get pHeader_height to headerlines# get pSubHeader_height to subheaderlines# get pFooter_height to footerlines# function_return (pageend#-headerlines#-subheaderlines#-footerlines#) end_function function Remaining_Lines returns integer local integer pageend# linecount# footerlines# get pPageLength to pageend# get pLineCount to linecount# get pFooter_height to footerlines# function_return (pageend#-linecount#-footerlines#) end_function function iResource_Reserve returns integer local integer ch1# ch2# rval# UseSequentialChannel# get iUseSequentialChannel to UseSequentialChannel# // Do we need a channel? if UseSequentialChannel# get Seq_New_Channel to ch1# else move 0 to ch1# get Seq_New_Channel to ch2# move (ch1#>=0 and ch2#>=0) to rval# if rval# begin if UseSequentialChannel# set pOutputChannel to ch1# set pChannel of (oChannelAdmin(self)) to ch2# end else begin if UseSequentialChannel# if ch1# ge 0 send Seq_Release_Channel ch1# if ch2# ge 0 send Seq_Release_Channel ch2# end #IFDEF USE$VPE set pOriginalVPE_Object to oVPE# move (oOutputVPE(self)) to oVPE# #ENDIF function_return rval# end_function procedure Resource_Release if (iUseSequentialChannel(self)) ; send Seq_Release_Channel (pOutputChannel(self)) send Seq_Release_Channel (pChannel(oChannelAdmin(self))) #IFDEF USE$VPE get pOriginalVPE_Object to oVPE# #ENDIF end_procedure procedure Page_Eject_No_Footer.i integer ff# local integer obj# ch# Destination# local integer pos# UseSequentialChannel# if (pLineCount(self)) begin get iUseSequentialChannel to UseSequentialChannel# if UseSequentialChannel# begin get pOutputChannel to ch# get_channel_position ch# to pos# set pBytesWritten to pos# end get pDestination to Destination# if Destination# eq DEST_SCREEN begin //screen #IFDEF IS$WINDOWS #IFDEF USE$VPE if ff# send vpe_PageBreak to oVPE# #ELSE // winprint, newpage #ENDIF #ELSE move (oPageOffsets(self)) to obj# set array_value of obj# item (item_count(obj#)) to pos# #ENDIF end else begin if UseSequentialChannel# begin if ff# begin if Destination# eq DEST_HTML write channel ch# (replace("#",'

',string(pPageCount(self)))) else write channel ch# (character(12)) end end end set pPageCount to (pPageCount(self)+1) set pLineCount to 0 move 0 to linecount end end_procedure procedure page_eject.i integer ff# local integer line# linecount# pageend# footerlines# footer_img# footerfill_img# get pLineCount to linecount# if linecount# begin // only if something has been written get pFooter_image to footer_img# if footer_img# begin // If 'footer' has been set get pPageLength to pageend# get pFooter_height to footerlines# get pFooterFill_image to footerfill_img# for line# from linecount# to (pageend#-1-footerlines#) if footerfill_img# send output_image_aux footerfill_img# else send writeln_no_headers "" loop send message.i (pFooter_msg(self)) send output_image_aux footer_img# end send page_eject_no_footer.i ff# end end_procedure procedure new_page send page_eject.i 1 end_procedure procedure cmdline_start end_procedure procedure cmdline_stop end_procedure function iPreconditions_Direct_Output returns integer local integer rval# get iResource_Reserve to rval# function_return rval# end_function function iDirect_Output returns integer local integer rval# dest# exists_action# local string tmp_fn# fn# move 1 to rval# if (iPreconditions_Direct_Output(self)) begin get pDestination to dest# set pInitDate to (dSysDate()) set pInitTime to (sSysTime()) if dest# eq DEST_PRINTER begin // Printer #IFDEF IS$WINDOWS set pOmitFormFeed to true #IFDEF USE$VPE set pTitle of oVPE# to (pTitle(self)) send OpenDoc to oVPE# send obs "Hello (test)" #ELSE #ENDIF #ELSE send cmdline_start direct_output channel (pOutputChannel(self)) (pPrinterport(self)) #ENDIF end if dest# eq DEST_SCREEN begin // Screen #IFDEF IS$WINDOWS set pOmitFormFeed to true #IFDEF USE$VPE set pTitle of oVPE# to (pTitle(self)) send OpenDoc to oVPE# #ELSE // WinPrint #ENDIF #ELSE // Character mode: send delete_data to (oPageOffsets(self)) move (SEQ_UniqueFileName("scrf")) to tmp_fn# if tmp_fn# ne "" begin set pScreenTmpFile to tmp_fn# if (API_OtherAttr_Value(OA_OS_SHORT_NAME)="WIN32CM") begin direct_output channel (pOutputChannel(self)) tmp_fn# end else begin direct_output channel (pOutputChannel(self)) ("cr: 13 eol: 10 "+tmp_fn#) end end else begin send obs "Outfile failure (source: output.utl)" "(Screen)" move 0 to rval# end #ENDIF end if dest# eq DEST_FILE begin // File get pOutFileName to fn# move 2 to exists_action# // 0=cancel 1=append, 2=overwrite if (SEQ_FileExists(fn#)) begin get pFileExistsAction to exists_action# // if exists_action# eq FILEEXISTS_PROMPT move (SEQ_FileExistsAction(fn#,1)) to exists_action# end if exists_action# begin if exists_action# eq 1 append_output channel (pOutputChannel(self)) ("cr: 13 eol: 10 "+fn#) //append if exists_action# eq 2 direct_output channel (pOutputChannel(self)) ("cr: 13 eol: 10 "+fn#) //overwrite end else move 0 to rval# end if dest# eq DEST_EMAIL begin // EMAIL // get SEQ_UniqueFileName "mail" to fn# get SEQ_UniqueFileNamePathAndExt "" "mail" "txt" to fn# if fn# ne "" begin set pScreenTmpFile to fn# if (API_OtherAttr_Value(OA_OS_SHORT_NAME)="WIN32CM") begin direct_output channel (pOutputChannel(self)) fn# end else begin direct_output channel (pOutputChannel(self)) ("pc-text: "+fn#) end end else begin send obs "Outfile failure (source: output.utl)" "(E-mail)" move 0 to rval# end end if dest# eq DEST_HTML begin // HTML end set pPageCount to 0 set pBytesWritten to 0 set pLineCount to 0 end else move 0 to rval# if rval# begin set pInUseState to true send Report_Wait_On send Initialize_Output end else begin set pInUseState to false send Resource_Release end function_return rval# end_function function iDirect_Output_Title string title# returns integer local integer rval# set pTitle to title# get iDirect_Output to rval# if rval# begin set pHeader_image to 0 set pHeader_height to 0 set pHeader_msg to 0 set pSubHeader_image to 0 set pSubHeader_height to 0 set pSubHeader_msg to 0 set pFooter_image to 0 set pFooter_height to 0 set pFooter_msg to 0 set pFooterFill_image to 0 set pOnceOnly_image to 0 set pOnceOnly_height to 0 set pOnceOnly_msg to 0 end function_return rval# end_function procedure Initialize_Output end_procedure procedure DoSendEmails string lsFile local integer lhEmailRecipients liMax liRow local string lsName lsAddress lsSendMailProgramPath get psSendMailProgramPath to lsSendMailProgramPath if (lsSendMailProgramPath<>"") begin move (oEmailRecipients(self)) to lhEmailRecipients get row_count of lhEmailRecipients to liMax decrement liMax for liRow from 0 to liMax get psSendMailProgramPath to lsSendMailProgramPath move (replace("#A#",lsSendMailProgramPath,psAddress.i(lhEmailRecipients,liRow))) to lsSendMailProgramPath move (replace("#F#",lsSendMailProgramPath,lsFile)) to lsSendMailProgramPath //send obs lsSendMailProgramPath runprogram wait lsSendMailProgramPath loop end else send obs "E-mail program path not specified." end_procedure procedure Close_Output local integer ch# dest# pos# local string lsFileName if (pInUseState(self)) begin if (pLineCount(self)) send page_eject.i (not(pOmitFormFeed(self))) if (iUseSequentialChannel(self)) begin send write_no_headers "" get pOutputChannel to ch# get_channel_position ch# to pos# set pBytesWritten to pos# despool close_output channel ch# end get pDestination to dest# if dest# eq DEST_PRINTER begin send cmdline_stop #IFDEF IS$WINDOWS #IFDEF USE$VPE send PrintDoc to oVPE# #ELSE // WinPrint, print doc #ENDIF #ENDIF end if dest# eq DEST_EMAIL begin //send obs "Haps, min fine ven" send report_wait_update "Sending e-mails..." get pScreenTmpFile to lsFileName get SEQ_ConvertToAbsoluteFileName lsFileName to lsFileName send DoSendEmails lsFileName erasefile lsFileName end send report_wait_off if dest# eq DEST_SCREEN begin #IFDEF IS$WINDOWS #IFDEF USE$VPE send PreviewDoc to oVPE# #ELSE // WinPrint, print doc #ENDIF #ELSE send call_viewer get pScreenTmpFile to lsFileName get SEQ_ConvertToAbsoluteFileName lsFileName to lsFileName erasefile lsFileName #ENDIF end else send report_done set pInUseState to false send Resource_Release end end_procedure procedure message.i integer msg# local integer lhObj if msg# begin get phMsg_Object to lhObj if lhObj send msg# to lhObj else send msg# end end_procedure function replace_header_codes string str# returns string local integer pagecount# local date date# local string page# get pInitDate to date# move (pPageCount(self)+1) to pagecount# move (replaces("",str#,string(date#))) to str# move (replaces("",str#,pInitTime(self))) to str# //time if "" in str# begin // page number move pagecount# to page# if pagecount# le 999 insert " " in page# at 1 pad page# to page# 4 move (replaces("",str#,page#)) to str# //time end if "

" in str# begin // page number move pagecount# to page# if pagecount# le 99 insert " " in page# at 1 if pagecount# le 9 insert " " in page# at 1 move (replaces("

",str#,page#)) to str# end function_return str# end_function function replace_codes string str# returns string // If e-mail remove codes, else insert code values if (pDestination(self)=DEST_EMAIL) function_return (output.replace_codes(str#)) function_return (output.remove_codes(str#)) end_function procedure output_image_help integer img# integer header_codes# local integer seqeof# obj# ch# local string str# move (seqeof) to seqeof# move (oChannelAdmin(self)) to obj# get pChannel of obj# to ch# send direct_xput to obj# 1 ("image: "+string(img#)) repeat readln channel ch# str# [~seqeof] begin if header_codes# send writeln_no_headers (replace_header_codes(self,str#)) else send writeln str# end [~seqeof] loop send close_xput to obj# indicate seqeof as seqeof# end_procedure procedure output_image_aux integer img# send output_image_help img# 1 end_procedure procedure output_image integer img# integer check_space_tmp# local integer check_space# if num_arguments gt 1 move check_space_tmp# to check_space# else move 0 to check_space# if (iPageBreakNeeded(self,check_space#)) send page_eject.i 0 send output_image_help img# 0 end_procedure procedure output_image_wrap integer img# // Won't work! (BLANKFORM img#) send output_image_help img# 0 !A [] $20A img# indicate copy_122 as [ |122] send output_image img# !A [not copy_122] $1C4 img# !A [not copy_122] $20A img# indicate copy_122 as [ |122] [not copy_122] repeat send output_image img# !A [] $20A img# indicate copy_122 as [ |122] [not copy_122] loop end_procedure procedure write.i string str# integer do_headers# local integer header_img# subheader_img# onceonly_img# pagecount# pageend# local string page_init# if do_headers# begin get pHeader_image to header_img# get pSubHeader_image to subheader_img# get pOnceOnly_image to onceonly_img# get pPageCount to pagecount# get pPageLength to pageend# if (iPageBreakNeeded(self,1)) send page_eject.i 0 // if we are at the top of a new page print header and subheader: if (pLineCount(self)) eq 0 begin send message.i (pHeader_msg(self)) if header_img# send output_image_aux header_img# send message.i (pSubHeader_msg(self)) if subheader_img# send output_image_aux subheader_img# end if onceonly_img# begin send message.i (pOnceOnly_msg(self)) set pOnceOnly_image to 0 send output_image onceonly_img# end end #IFDEF IS$WINDOWS move (replace_codes(self,str#)) to str# #ELSE if (pbOemToAnsi(self)) begin if (pDestination(self)=DEST_FILE or pDestination(self)=DEST_EMAIL) begin get StringOemToAnsi str# to str# end end if (pDestination(self)<>DEST_SCREEN) move (replace_codes(self,str#)) to str# #ENDIF if (iUseSequentialChannel(self)) write channel (pOutputChannel(self)) str# else begin #IFDEF IS$WINDOWS #IFDEF USE$VPE send Write to oVPE# str# #ELSE #ENDIF #ENDIF end end_procedure procedure write_no_headers string str# send write.i str# 0 end_procedure procedure write string str# send write.i str# 1 end_procedure procedure writeln string str# send write.i str# 1 if (iUseSequentialChannel(self)) writeln channel (pOutputChannel(self)) (if(pDestination(self)=DEST_HTML,"
","")) else begin #IFDEF IS$WINDOWS #IFDEF USE$VPE send WriteLn to oVPE# " " #ELSE #ENDIF #ENDIF end set pLineCount to (pLineCount(self)+1) end_procedure procedure writeln_no_headers string str# send write.i str# 0 writeln channel (pOutputChannel(self)) set pLineCount to (pLineCount(self)+1) end_procedure procedure make_horizontal_line local integer destination# get pDestination to Destination# #IFDEF IS$WINDOWS #IFDEF USE$VPE if (destination#=DEST_PRINTER or destination#=DEST_SCREEN) send WriteLine to oVPE# // send writeln to oVPE# " " #ELSE // if (destination#=DEST_PRINTER or destination#=DEST_SCREEN) winprint, draw line #ENDIF #ELSE if (destination#=DEST_PRINTER or destination#=DEST_SCREEN) send writeln (repeat(" ",pWidth(self))) #ENDIF else begin if destination# eq DEST_HTML send writeln "


" // Horizontal ruler else send writeln (repeat(" ",pWidth(self))) end end_procedure procedure call_viewer local integer self# move self to self# send output.CallViewer (pScreenTmpFile(self)) self# end_procedure procedure Report_Wait_On end_procedure procedure Report_Wait_Off end_procedure procedure Report_Wait_Update string str# end_procedure procedure Report_Wait_Update2 string str# end_procedure function iReport_Cancel returns integer end_function procedure Report_Done send obs "Done" end_procedure end_class // cBasicSequentialOutput object oBasicSequentialOutput is a cBasicSequentialOutput NO_IMAGE end_object #COMMAND SEQ.DIRECT_OUTPUT #ENDCOMMAND // seq.output [lines] #COMMAND SEQ.OUTPUT R send output_image to seq.object# !1.N !2 #ENDCOMMAND #COMMAND SEQ.OUTPUT_WRAP R . send output_image_wrap to seq.object# !1.N #ENDCOMMAND #COMMAND SEQ.CLOSE_OUTPUT . send close_output to seq.object# #ENDCOMMAND #COMMAND SEQ.WRITE #IF !0=0 SEQ.WRITE "" #ELSE SEQ.WRITE$HELP !1 !2 !3 !4 !5 !6 !7 !8 !9 #ENDIF #ENDCOMMAND #COMMAND SEQ.WRITELN #IF !0=0 SEQ.WRITELN "" #ELSE SEQ.WRITE$HELP !1 !2 !3 !4 !5 !6 !7 !8 !9 send writeln to seq.object# "" #ENDIF #ENDCOMMAND #COMMAND SEQ.WRITE$HELP #IF !0>0 send write to seq.object# !1 SEQ.WRITE$HELP !2 !3 !4 !5 !6 !7 !8 !9 #ENDIF #ENDCOMMAND // =========================================================================== // ********************* CHARACTER MODE PREVIEW OBJECT ********************* // =========================================================================== #IFDEF IS$WINDOWS #ELSE // "GO TO" DIALOG (Character mode) ***************************************** /Output.GoPg.Hdr ͻ /Output.GoPg.Label ___________: /Output.GoPg.Frm ___. /Output.GoPg.Btn ____________ _____________ ͼ /* object output.GotoPage_Panel is a app.ModalClient Output.GoPg.Hdr set location to 10 25 absolute on_key kexit_application send cancel on_key ksave_record send ok object oLabel is a Form Output.GoPg.label set location to 1 0 relative set focus_mode to pointer_only item_list on_item t.output.GoPg_Label send next end_item_list set window_color item 0 to 2 end_object object oFrm is a Form Output.GoPg.frm set location to 1 18 relative item_list on_item "" send ok end_item_list end_object object oBtn is a app.Button Output.GoPg.Btn set location to 4 0 relative item_list on_item t.btn.ok send ok on_item t.btn.cancel send cancel end_item_list end_object function iRun returns integer local integer rval# ui_accept self to rval# if rval# eq msg_cancel function_return -1 function_return (value(oFrm(self),0)) end_function end_object function output.GotoPage global returns integer function_return (iRun(output.GotoPage_Panel(self))) end_function // "TEXT SEARCH" DIALOG (Character mode) ********************************** /Output.Search_Wait Ŀ ________________________________________________ ________________ ____________________ __________________________________________ 0% 25% 50% 75% 100% ________________________________________________ /Output.Search.Hdr ͻ _______________________________________ /Output.Search.Frm ___________________________________ ____________________ /Output.Search.Btn _____________ _____________ ͼ /* object output.Search_Panel is a app.ModalClient Output.Search.Hdr set location to 10 25 absolute on_key kcancel send cancel on_key kexit_application send cancel on_key ksave_record send ok set center_state item 0 to true set window_color item 0 to 2 set value item 0 to t.output.Search_string object oFrm is a form Output.Search.frm set location to 3 0 relative set select_mode to multi_select item_list on_item "" send next on_item t.output.Case_sensitive send next end_item_list set checkbox_item_state item 1 to true end_object object oBtn is a app.Button Output.Search.btn set location to 8 0 relative item_list on_item t.btn.ok send ok on_item t.btn.cancel send cancel end_item_list end_object function iSearchCase returns integer function_return (select_state(oFrm(self),1)) end_function function sRun returns string local integer msg# local string rval# ui_accept self to msg# if msg# eq msg_ok get value of (oFrm(self)) item 0 to rval# function_return rval# end_function End_Object function output.TextSearch global returns string function_return (sRun(output.Search_Panel(self))) end_function function output.TextSearchCase global returns integer function_return (iSearchCase(output.Search_Panel(self))) end_function object oOutputTextSearchWait is a cWait_Message Output.Search_Wait set location to 7 15 absolute set value item 0 to t.output.Searching set value item 1 to (t.output.Search_string+":") set value item 4 to t.output.PressAnyKey set center_state item 0 to true set center_state item 1 to true set center_state item 4 to true set pItem_Thermometer to 3 procedure display.s string str# set value item 2 to str# end_procedure end_object // =========================================================================== // VIEWER LIST CLASS (Character mode) // =========================================================================== class cPreViewList is a list procedure construct_object integer img# forward send construct_object img# property integer pCurLine public 0 property integer pMaxLine public 0 property integer pCurPage public 0 property integer pMaxPage public 0 property integer pPageLength public 63 property integer pOffSetBegin public 0 property integer pOffSetEnd public 0 property integer pHorOffset public 1 property integer pRepSize public 0 property integer pChannel public -1 property string pRepFileName public "" property integer pDisplay_Lines public 18 property integer pDisplay_Columns public 79 property string pSearchText public "" property integer pStripCodes public 1 property integer pServer public 0 object oPageContainer is an array end_object object oPageOffsets is an array end_object on_key key_pgup send pg_prev on_key key_pgdn send pg_next on_key key_minus send ln_screen_prev on_key key_plus send ln_screen_next on_key key_home send hz_left_most on_key key_left_arrow send hz_left on_key key_right_arrow send hz_right on_key key_end send hz_right_most on_key key_ctrl+key_home send ln_first on_key key_ctrl+key_end send ln_last on_key key_ctrl+key_pgup send pg_first on_key key_ctrl+key_pgdn send pg_last on_key key_f2 send search on_key key_ctrl+key_f send search on_key key_alt+key_f send search on_key key_ctrl+key_l send search_next on_key key_shift+key_f2 send search_next on_key key_alt+key_g send pg_goto on_key key_ctrl+key_p send display_page_info on_key key_up_arrow send ln_prev on_key key_down_arrow send ln_next on_key key_ctrl+key_r send toggle_ruler on_key key_alt+key_f3 send toggle_stripcodes end_procedure procedure toggle_ruler end_procedure procedure retrieve_page_offsets.i integer arr# local integer obj# itm# max# pos# move (oPageOffsets(self)) to obj# send delete_data to obj# if arr# begin get item_count of arr# to max# for itm# from 0 to (max#-1) get integer_value of arr# item itm# to pos# set array_value of obj# item itm# to pos# loop set pMaxPage to max# end end_procedure function sline_appearance.s string str# returns string if (pStripCodes(self)) function_return (replace_codes(pServer(self),str#)) function_return str# end_function // this read_page will fill the array 'oPageContainer' with the lines of // page pg#, and should only be called with a legal page number pg# procedure read_page integer pg# local integer obj# ofs1# ofs2# itm# ch# tmp# local string str# get pChannel to ch# move (oPageOffsets(self)) to obj# if pg# eq 1 move 0 to ofs1# else move (integer_value(obj#,pg#-2)) to ofs1# //page begins at byte ofs1# move (integer_value(obj#,pg#-1)) to ofs2# //page ends at byte ofs2#-1 move (oPageContainer(self)) to obj# send delete_data to obj# set_channel_position ch# to ofs1# move 0 to itm# repeat readln channel ch# str# get_channel_position ch# to tmp# if tmp# le ofs2# begin // still part of current_page? move (sline_appearance.s(self,str#)) to str# set array_value of obj# item itm# to str# increment itm# end until tmp# ge ofs2# set pMaxLine to itm# end_procedure procedure fill_list local integer itm# max# obj# local string str# set dynamic_update_state to false move (oPageContainer(self)) to obj# send delete_data get pMaxLine to max# for itm# from 0 to max# get string_value of obj# item itm# to str# send add_item msg_none (mid(str#,99,pHorOffset(self))) loop set dynamic_update_state to true end_procedure procedure RulerUpdate string lsRuler1 string lsRuler2 end_procedure procedure DoRuler integer liHorOffset integer liWidth local integer liPos liDecade local string lsRuler1 lsRuler2 lsValue lsOverstrikeValue // //.........10........20........30........40 // 123456789012345678901234567890123456789012345678901234567890 move (right(string(liHorOffset),1)) to lsValue move (pos(lsValue,"12345678901234567890")) to liPos move (mid("12345678901234567890",10,liPos)) to lsValue move (repeat(lsValue,liWidth/10+1)) to lsValue move (left(lsValue,liWidth)) to lsRuler2 move (repeat(".",liWidth)) to lsRuler1 move (liHorOffset/10*10) to liHorOffset move (pos("0",lsRuler2)) to liPos for liDecade from 0 to (liWidth/10) move (liDecade*10+liHorOffset+10) to lsOverstrikeValue move (overstrike(lsOverstrikeValue,lsRuler1,liDecade*10+liPos)) to lsRuler1 loop move (left(lsRuler1,liWidth)) to lsRuler1 send RulerUpdate lsRuler1 lsRuler2 //"12345678901234567890" end_procedure procedure hz_update local integer itm# max# pDisplay_Columns# liHorOffset local string str# get pDisplay_Columns to pDisplay_Columns# get pHorOffset to liHorOffset move (pMaxLine(self)) to max# for itm# from 0 to max# get string_value of (oPageContainer(self)) item itm# to str# set value item itm# to (mid(str#,pDisplay_Columns#,liHorOffset)) loop send DoRuler liHorOffset pDisplay_Columns# end_procedure procedure hz_left_most set pHorOffset to 1 send hz_update end_procedure procedure hz_right_most local string str# get string_value of (oPageContainer(self)) item (current_item(self)) to str# set pHorOffset to (length(str#)-pDisplay_Columns(self)+1) if (pHorOffset(self)) lt 1 set pHorOffset to 1 send hz_update end_procedure procedure hz_left set pHorOffset to (pHorOffset(self)-8) if (pHorOffset(self)) lt 1 set pHorOffset to 1 send hz_update end_procedure procedure hz_right set pHorOffset to (pHorOffset(self)+8) if (pHorOffset(self)) gt 1180 set pHorOffset to 1180 // 180 send hz_update end_procedure procedure ln_prev local integer itm# get current_item to itm# if itm# eq 0 begin if (pCurPage(self)) ne 1 begin send pg_prev set current_item to (pMaxLine(self)) end end else set current_item to (itm#-1) end_procedure procedure ln_next local integer itm# get current_item to itm# if itm# eq (pMaxLine(self)) begin if (pCurPage(self)) ne (pMaxPage(self)) begin send pg_next set current_item to 0 end end else set current_item to (itm#+1) end_procedure procedure ln_first set current_item to 0 end_procedure procedure ln_last set current_item to (pMaxLine(self)) end_procedure procedure ln_screen_prev local integer tmp# get current_item to tmp# send scroll upward_direction (pDisplay_Lines(self)) if (current_item(self)) eq tmp# begin if (pCurPage(self)) ne 1 begin send pg_prev set current_item to (pMaxLine(self)) end end end_procedure procedure ln_screen_next local integer tmp# get current_item to tmp# send scroll downward_direction (pDisplay_Lines(self)) if (current_item(self)) eq tmp# begin if (pCurPage(self)) ne (pMaxPage(self)) begin send pg_next set current_item to 0 end end end_procedure function pg_fork integer pg# returns integer if pg# gt (pMaxPage(self)) function_return (pMaxPage(self)) if pg# lt 1 function_return 1 function_return pg# end_function procedure pg_display integer pg# set pCurPage to pg# set pCurLine to 0 send read_page pg# send fill_list end_procedure procedure pg_prev local integer pg# get pCurPage to pg# move (pg_fork(self,pg#-1)) to pg# send pg_display pg# end_procedure procedure pg_next local integer pg# get pCurPage to pg# if pg# eq (pMaxPage(self)) send ln_last else begin move (pg_fork(self,pg#+1)) to pg# send pg_display pg# end end_procedure procedure pg_first send pg_display (pg_fork(self,1)) end_procedure procedure pg_last send pg_display (pg_fork(self,pMaxPage(self))) end_procedure function iopen.si string fn# integer arr# returns integer local integer ch# get Seq_New_Channel to ch# set pChannel to ch# set pRepFileName to fn# set pRepSize to (SEQ_FileSize(fn#)) send retrieve_page_offsets.i arr# direct_input channel ch# fn# set pHorOffset to 1 set pCurPage to 1 set pCurLine to 0 send DoRuler 1 79 send read_page 1 send fill_list send Seq_Release_Channel ch# function_return 1 end_procedure function iopen.sii string fn# integer arr# integer svr# returns integer set pserver to svr# function_return (iopen.si(self,fn#,arr#)) end_function procedure close local integer ch# get pChannel to ch# close_input channel ch# send Seq_Release_Channel ch# end_procedure function search_offset returns integer local integer rval# itm# max# ch# pg# local string str# get pChannel to ch# move (pCurPage(self)) to pg# if pg# eq 1 move 0 to rval# else get integer_value of (oPageOffsets(self)) item (pg#-2) to rval# set_channel_position ch# to rval# get current_item to max# for itm# from 0 to max# readln str# loop get_channel_position ch# to rval# function_return rval# end_function procedure search_for_it.sii string search_string# integer search_case# integer search_offset# local integer obj# pos# stop# pg# ln# tmp# ch# page_end# local string str# get pChannel to ch# move (oOutputTextSearchWait(self)) to obj# send display.s to obj# search_string# send wait_on to obj# 0 (pRepSize(self)) set_channel_position ch# to search_offset# ifnot search_case# move (uppercase(search_string#)) to search_string# move 0 to stop# repeat get_channel_position ch# to pos# send wait_update to obj# pos# if (MB_CancelOnKeypress(t.output.CancelSearch)) move 2 to stop# //cancel! ifnot stop# begin readln str# [seqeof] move 3 to stop# //not found! move (sline_appearance.s(self,str#)) to str# ifnot search_case# move (uppercase(str#)) to str# if search_string# in str# begin // restore channel position mechanism after having read beyond eof: if stop# eq 3 direct_input channel ch# (pRepFileName(self)) move 1 to stop# //found! end end until stop# send wait_off to obj# if stop# eq 1 begin //found! get_channel_position ch# to pos# move (oPageOffsets(self)) to obj# move 1 to pg# move 0 to stop# repeat move (integer_value(obj#,pg#-1)) to page_end# if (page_end#>=pos#) move 1 to stop# ifnot stop# increment pg# until stop# if pg# eq 1 set_channel_position ch# to 0 else set_channel_position ch# to (integer_value(obj#,pg#-2)) move 0 to ln# move 0 to stop# repeat readln str# get_channel_position ch# to tmp# if tmp# ge pos# move 1 to stop# ifnot stop# increment ln# [seqeof] move 1 to stop# [seqeof] direct_input channel ch# (pRepFileName(self)) until stop# if (pCurPage(self)) ne pg# send pg_display pg# set current_item to ln# end if stop# eq 3 begin //not found! send obs ("'"+(trim(search_string#))+t.output.TextNotFound) // restore channel position mechanism after having read beyond // end of file: direct_input channel ch# (pRepFileName(self)) end end_procedure procedure search_next if (pSearchText(self)) ne "" ; send search_for_it.sii (pSearchText(self)) (output.TextSearchCase()) (search_offset(self)) end_procedure procedure search local string str# move (output.TextSearch()) to str# if str# ne "" begin set pSearchText to str# send search_next end end_procedure procedure pg_goto local integer pg# move (output.GotoPage()) to pg# if pg# ne -1 begin move (pg_fork(self,pg#)) to pg# send pg_display pg# end end_procedure procedure display_page_info send obs ("Lines on this page: "+string(item_count(self))) ("Current line is: "+string(current_item(self)+1)) end_procedure procedure toggle_stripcodes set pStripCodes to (not(pStripCodes(self))) send read_page (pCurPage(self)) send hz_update end_procedure procedure print_page integer pg# local integer obj# ofs1# ofs2# chn# tmp# svr# local string str# get pChannel to chn# move (oPageOffsets(self)) to obj# get pServer to svr# if pg# eq 1 move 0 to ofs1# else move (integer_value(obj#,pg#-2)) to ofs1# //page begins at byte ofs1# move (integer_value(obj#,pg#-1)) to ofs2# //page ends at byte ofs2#-1 set_channel_position chn# to ofs1# repeat readln channel chn# str# get_channel_position chn# to tmp# if tmp# le ofs2# send writeln_no_headers to svr# str# // still part of current_page? until tmp# ge ofs2# send page_eject_no_footer.i to svr# 1 end_procedure procedure print_all local integer pg# max# svr# dest# fin# get pServer to svr# get pDestination of svr# to dest# set pDestination of svr# to DEST_PRINTER if (iDirect_Output(svr#)) begin send report_wait_on to svr# move 0 to fin# get pMaxPage to max# for pg# from 1 to max# move (iReport_Cancel(svr#)) to fin# ifnot fin# begin send print_page pg# send report_wait_update to svr# "" end else move max# to pg# // Dirty (break to loop) loop send close_output to svr# send report_wait_off to svr# send report_done to svr# end set pDestination of svr# to dest# // Restore destination end_procedure end_class /Output.Viewer.Ttl ________________________________________________________________________________ /Output.Viewer.Hdr ________________________________________________________________ ___. / ___. /Output.Viewer.Hdr2 ________________________________________________________________________________ ________________________________________________________________________________ /Output.Viewer.Lst _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ _______________________________________________________________________________ /Output.Viewer.Exit_PD Ŀ _________________ /Output.Viewer.Navigate_PD Ŀ ________________________ ________________________ ________________________ ________________________ ________________________ ________________________ ________________________ Ĵ ________________________ ________________________ ________________________ ________________________ /Output.Viewer.Search_PD Ŀ _________________ _________________ /Output.Viewer.Print_PD Ŀ _________________ /output.Viewer.Btn _________ _____ ____ ___ ___ ____ _____ ____ ___ ___ ____ __________ /* #IF LNG_DEFAULT=lng_dutch /Output.Viewer.Main_Menu _______ ___________ ________ ___________ /* #ENDIF #IF LNG_DEFAULT=lng_spanish /Output.Viewer.Main_Menu _______ _________ ________ __________ /* #ENDIF #IF LNG_DEFAULT=lng_english /Output.Viewer.Main_Menu ______ __________ ________ _______ /* #ENDIF #IF LNG_DEFAULT=lng_danish /Output.Viewer.Main_Menu ________ _________ _____ _________ /* #ENDIF #IF LNG_DEFAULT=lng_swedish /Output.Viewer.Main_Menu ______ _________ _____ _______ /* #ENDIF #IF LNG_DEFAULT=lng_norwegian /Output.Viewer.Main_Menu _________ _________ _____ _________ /* #ENDIF #IF LNG_DEFAULT=lng_german /Output.Viewer.Main_Menu ___________ ____________ ________ _________ /* #ENDIF #IF LNG_DEFAULT=lng_portuguese /Output.Viewer.Main_Menu ______ _________ _________ __________ /* #ENDIF #IF LNG_DEFAULT=lng_french /Output.Viewer.Main_Menu _______ __________ __________ _________ /* #ENDIF use pulldown // pulldown_menu class register_object lst object oOutputViewer is an entry_client Output.Viewer.Ttl set location to 0 0 absolute set scope_state to true set popup_state to true on_key key_alt+key_f8 send none // Do not call e_errrep while this on_key kexit_application send cancel property integer pbRulerActive public DFFALSE object oActionBar is an action_bar_menu Output.Viewer.Main_Menu set location to 1 0 relative item_list object exit_pd is a pull_down_menu Output.Viewer.Exit_PD item_list on_item t.output.main1_1 send cancel_display end_item_list end_object on_item t.output.main1 send activate_pull_down to (exit_pd(self)) object navigate_pd is a pull_down_menu Output.Viewer.Navigate_PD item_list on_item t.output.main2_1 send pg_prev to (lst(self)) on_item t.output.main2_2 send pg_next to (lst(self)) on_item t.output.main2_3 send ln_screen_prev to (lst(self)) on_item t.output.main2_4 send ln_screen_next to (lst(self)) on_item t.output.main2_5 send pg_first to (lst(self)) on_item t.output.main2_6 send pg_last to (lst(self)) on_item t.output.main2_7 send pg_goto to (lst(self)) on_item t.output.main2_8 send hz_left_most to (lst(self)) on_item t.output.main2_9 send hz_left to (lst(self)) on_item t.output.main2_10 send hz_right to (lst(self)) on_item t.output.main2_11 send hz_right_most to (lst(self)) end_item_list end_object on_item t.output.main2 send activate_pull_down to (navigate_pd(self)) object search_pd is a pull_down_menu Output.Viewer.Search_PD item_list on_item t.output.main3_1 send search to (lst(self)) on_item t.output.main3_2 send search_next to (lst(self)) end_item_list end_object on_item t.output.main3 send activate_pull_down to (search_pd(self)) object print_pd is a pull_down_menu Output.Viewer.Print_PD item_list on_item t.output.main4_1 send print_all end_item_list end_object on_item t.output.main4 send activate_pull_down to (print_pd(self)) end_item_list end_object set action_bar_id to (oActionBar(self)) procedure prt_Menu_Keys for desktop integer obj# on_key key_alt+key_a send activate to (exit_pd(obj#)) private on_key key_alt+key_e send activate to (exit_pd(obj#)) private on_key key_alt+key_n send activate to (navigate_pd(obj#)) private on_key key_alt+key_s send activate to (search_pd(obj#)) private on_key key_alt+key_p send activate to (print_pd(obj#)) private on_key key_alt+key_u send activate to (print_pd(obj#)) private end_procedure object hdr2 is a message Output.Viewer.Hdr2 set focus_mode to POINTER_ONLY set location to 2 0 relative set window_color item 0 to 2 set window_color item 1 to 2 procedure display.ss string lsRuler1 string lsRuler2 set value item 0 to lsRuler1 set value item 1 to lsRuler2 end_procedure end_object object hdr is a message Output.Viewer.Hdr set location to 2 0 relative set focus_mode to POINTER_ONLY procedure display.ii integer int1# integer int2# set value item 1 to int1# set value item 2 to int2# end_procedure end_object object lst is a cPreViewList Output.Viewer.Lst set Action_Bar_Keys_Msg of (oActionBar(self)) to Prt_Menu_Keys procedure RulerUpdate string lsRuler1 string lsRuler2 send display.ss to (hdr2(self)) lsRuler1 lsRuler2 end_procedure procedure toggle_ruler if (pbRulerActive(self)) begin send rotate_up to (hdr(self)) set pbRulerActive to DFFALSE end else begin send rotate_up to (hdr2(self)) set pbRulerActive to DFTRUE end end_procedure set location to 4 0 relative on_key key_escape send cancel_display procedure read_page integer pg# forward send read_page pg# send display.ii to (hdr(self)) pg# (pMaxPage(self)) end_procedure end_object object btn is a app.Button output.Viewer.Btn set location to 23 0 relative on_key kCancel send cancel_display // duplicate action bar colors  set object_color to (hi(object_color(oActionBar(self)))) (hi(object_color(oActionBar(self)))) item_list on_item t.btn.print send print_all to (lst(self)) on_item " " send pg_prev to (lst(self)) on_item " " send ln_first to (lst(self)) on_item " " send ln_screen_prev to (lst(self)) on_item " " send ln_screen_next to (lst(self)) on_item " " send ln_last to (lst(self)) on_item " " send pg_next to (lst(self)) on_item " " send hz_left_most to (lst(self)) on_item " " send hz_left to (lst(self)) on_item " " send hz_right to (lst(self)) on_item " " send hz_right_most to (lst(self)) on_item t.btn.close send cancel_display to (lst(self)) end_item_list End_Object // Navigate_Buttons procedure cancel_display send stop_ui end_procedure procedure run.si string fn# integer obj# local integer garbage# set pbRulerActive to DFFALSE set center_state item 0 to true set value item 0 to "Preview report" set value of (hdr(self)) item 0 to (pTitle(obj#)) if (iopen.sii(lst(self),fn#,oPageOffSets(obj#),obj#)) begin ui_accept self to garbage# send close to (lst(self)) end else send obs "Error! Viewer won't start." "Temporary file not found." fn# end_procedure end_object #ENDIF #IFDEF IS$WINDOWS use Aps // Auto Position and Sizing classes for Visual DataFlex 4.0 use file_dlg // OpenDialog class register_abstract_field_type aft_AppLinkPath50 50 ascii_window object WordPadLinkSetup is a aps.ModalPanel label "WordPad kommunikation" object FlDlg is a OpenDialog set NoChangeDir_State to true end_object object cont is a aps.container3D object frm1 is a aps.Form label "WordPadPath:" abstract aft_AppLinkPath50 set p_extra_internal_width to -100 set form_button item 0 to 1 set form_button_value item 0 to "..." procedure form_button_notification integer itm# local integer obj# move (FlDlg(self)) to obj# set Dialog_Caption of obj# to "Locate WORDPAD.EXE" Set Filter_String of obj# to ; "Standard (WORDPAD.EXE)|WORDPAD.EXE|EXE files|*.exe|All files|*.*" if (Show_Dialog(obj#)) set value item 0 to (File_Name(obj#)) end_procedure end_object end_object procedure activate ifnot (active_state(self)) send retrieve_values forward send activate end_procedure procedure retrieve_values local string str# get_profile_string "APPLICATION_LINKS" "WordPadPath" to str# set value of (frm1(cont(self))) item 0 to str# end_procedure procedure store_values set_profile_string "APPLICATION_LINKS" "WordPadPath" to (value(frm1(cont(self)),0)) send close_panel end_procedure object btn1 is a aps.multi_button on_item "OK" send store_values end_object object btn2 is a aps.multi_button on_item "Cancel" send close_panel end_object send aps_locate_multi_buttons end_object procedure activate_wordpad_setup send popup to (WordPadLinkSetup(self)) end_procedure #ENDIF procedure output.CallViewer global string fn# integer obj# #IFDEF IS$WINDOWS local string str# get_profile_string "APPLICATION_LINKS" "WordPadPath" to str# move (str#*fn#) to str# runprogram wait str# #ELSE send run.si to (oOutputViewer(self)) fn# obj# #ENDIF end_procedure procedure output.display_file global string fn# local integer ch# fin# liPos local integer liSearchPrnLine // Find this line (in .PRN file) local integer liFileLine // Line number currently being loaded local integer liResultLine // desired item found in this line in the file local string lsTmpPrnLine // local string str# dir# get Seq_New_Channel to ch# direct_input channel ch# fn# if [seqeof] send obs ("File not found ("+fn#+")") else begin get SEQ_ExtractPathFromFileName fn# to dir# if (dir#="") move (SEQ_FindFileAlongDFPath(fn#)) to dir# if (dir#=".") get_current_directory to dir# set pDestination of seq.object# to DEST_SCREEN if (iDirect_Output_Title(seq.object#,fn#+" "+"("+dir#+")")) begin move 0 to fin# move 0 to liFileLine move 0 to liResultLine repeat readln channel ch# str# move (seqeof) to fin# ifnot fin# begin increment liFileLine // *** PRN file search *** if liSearchPrnLine begin // If we're searching for a PRN line ifnot liResultLine begin // If we didn't find it yet if ("0123456789" contains left(str#,1)) begin move (pos(">",str#)) to liPos if (liPos>0 and liPos<8) begin move (left(str#,liPos-1)) to lsTmpPrnLine if (StringIsInteger(lsTmpPrnLine) and integer(lsTmpPrnLine)>=liSearchPrnLine) begin move liFileLine to liResultLine move 0 to liSearchPrnLine end end end end end seq.writeln str# end until fin# seq.close_output end end send Seq_Release_Channel ch# end_procedure procedure output.run_dfindex_all global #IFDEF MSG_run_dfindex_all send run_dfindex_all #ENDIF send output.display_file "dfsort.log" end_procedure