home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a108 / 15.ddi / TRANSPRT.PR_ / TRANSPRT.bin
Encoding:
Text File  |  1994-03-10  |  381.1 KB  |  12,211 lines

  1. *:*****************************************************************************
  2. *:
  3. *: Procedure file: TRANSPRT.PRG
  4. *:         System: FoxPro 2.5 Transporter
  5. *:         Author: Microsoft Corp.
  6. *:*****************************************************************************
  7. *
  8. * TRANSPORT - FoxPro screen, report and label conversion utility.
  9. *
  10. *:*****************************************************************************
  11. * Copyright (c) 1993-94 Microsoft Corp.
  12. * One Microsoft Way
  13. * Redmond, WA 98052
  14. *
  15. * Notes:
  16. * In this program, for clarity/readability reasons, we use variable
  17. * names that are longer than 10 characters.  Note, however, that only
  18. * the first 10 characters are significant.
  19. *
  20. *
  21. * Revision History:
  22. * First written by Matt Pohle, John Beaver and Walt Kennamer for FoxPro 2.5
  23. *
  24.  
  25. PROCEDURE transprt
  26. PARAMETER m.g_scrndbf, m.tp_filetype, m.dummy, m.g_skipdlg
  27. * "g_crndbf" is the name of the file to transport.  It will usually be in some sort
  28. * of database format (e.g., SCX/PJX/MNX) but might also be a FoxBASE+ or FoxPro 1.02
  29. * report or label file, which is not a database.
  30. *
  31. * "tp_filetype" specifies what kind of file "g_scrndbf" is.  Allowable values are
  32. * found in the #DEFINE constants immediately below.  Note that the Transporter usually
  33. * does not use this value and instead figures out what kind of file it is being
  34. * presented with by counting the fields in the database.  For FoxBASE+ and FoxPro 1.02 files,
  35. * however, the Transporter does use this parameter to convert the report or label
  36. * data into 2.0 database format before transporting to Windows.  Note that the FoxBASE+
  37. * types are never actually passed in m.tp_filetype.  They are inferred in GetOldReportType
  38. * and GetOldLabelTypefrom the ID byte in the report/label files.
  39.  
  40. * The "dummy" parameter is not used.  At one point in the developement of the Transporter,
  41. * another parameter was passed.
  42.  
  43. * If g_skipdlg is .T., the Transporter does not display its dialogs and
  44. * assumes default values.  This mode is used by the Catalog Manager to transport
  45. * screens, reports, and labels which have never been modified on the current platform.
  46. * Only the main transporter dialogs are suppressed, so this is not a general
  47. * mechanism for skipping all the dialogs, especially those that are displayed for
  48. * projects, FoxBASE+ and early versions of FoxPro files. Further, the thermometer
  49. * is still displayed.
  50.  
  51.  
  52. PRIVATE ALL
  53.  
  54. IF SET("TALK") = "ON"
  55.    SET TALK OFF
  56.    m.talkset = "ON"
  57. ELSE
  58.    m.talkset = "OFF"
  59. ENDIF
  60. m.pcount = PARAMETERS()
  61.  
  62. *
  63. * Define Global Constants
  64. *
  65. #DEFINE debugversion     .T.    && enables asserts.  Should usually be .T.
  66.  
  67. * Filetype constants for FoxPro 2.0 and FoxPro 2.5 formats
  68. #DEFINE c_20pjxtype        1
  69. #DEFINE c_25scxtype       12
  70. #DEFINE c_20scxtype        2
  71. #DEFINE c_25frxtype       13
  72. #DEFINE c_20frxtype        3
  73. #DEFINE c_25lbxtype       14
  74. #DEFINE c_20lbxtype        4
  75.  
  76. * FoxPro 1.02 and FoxBASE+ formats.  Note that the FoxBASE+ types are never
  77. * actually passed in m.tp_filetype.  They are inferred in GetOldReportType and
  78. * GetOldLabelTypefrom the ID byte in the report/label files.  The suffix tells
  79. * us how the file was called, by REPORT FORM ... or by MODIFY REPORT ...
  80. #DEFINE c_frx102repo      23
  81. #DEFINE c_frx102modi      33
  82. #DEFINE c_fbprptrepo      43
  83. #DEFINE c_fbprptmodi      53
  84. #DEFINE c_lbx102repo      24
  85. #DEFINE c_lbx102modi      34
  86. #DEFINE c_fbplblrepo      44
  87. #DEFINE c_fbplblmodi      54
  88. #DEFINE c_db4type              70
  89.  
  90. * Definitions for Objtype fields in screens/reports/labels
  91. #DEFINE c_otheader         1
  92. #DEFINE c_otworkar         2
  93. #DEFINE c_otindex          3
  94. #DEFINE c_otrel            4
  95. #DEFINE c_ottext           5
  96. #DEFINE c_otline           6
  97. #DEFINE c_otbox            7
  98. #DEFINE c_otrepfld         8
  99. #DEFINE c_otband           9
  100. #DEFINE c_otgroup         10
  101. #DEFINE c_otlist          11
  102. #DEFINE c_ottxtbut        12
  103. #DEFINE c_otradbut        13
  104. #DEFINE c_otchkbox        14
  105. #DEFINE c_otfield         15
  106. #DEFINE c_otpopup         16
  107. #DEFINE c_otpicture       17
  108. #DEFINE c_otrepvar        18
  109. #DEFINE c_ot20lbxobj      19
  110. #DEFINE c_otinvbut        20
  111. #DEFINE c_otpdset         21
  112. #DEFINE c_otspinner       22
  113. #DEFINE c_otfontdata      23
  114.  
  115. * Window types
  116. #DEFINE c_user             1
  117. #DEFINE c_system           2
  118. #DEFINE c_dialog           3
  119. #DEFINE c_alert            4
  120.  
  121. * ObjCode definitions
  122. #DEFINE c_sgsay            0
  123. #DEFINE c_sgget            1
  124. #DEFINE c_sgedit           2
  125. #DEFINE c_sgfrom           3
  126. #DEFINE c_sgbox            4
  127. #DEFINE c_sgboxd           5
  128. #DEFINE c_sgboxp           6
  129. #DEFINE c_sgboxc           7
  130.  
  131. #DEFINE c_lnvertical       0
  132. #DEFINE c_lnhorizontal     1
  133.  
  134. #DEFINE c_ocboxgrp         1
  135.  
  136. * Attempt to preserve colors of text, lines and boxes when transporting to DOS?
  137. #DEFINE c_maptextcolor     .T.
  138.  
  139. * Field counts
  140. #DEFINE c_20scxfld        57
  141. #DEFINE c_scxfld          79
  142. #DEFINE c_20frxfld        36
  143. #DEFINE c_frxfld          74
  144. #DEFINE c_ot20label       30
  145. #DEFINE c_20lbxfld        17
  146. #DEFINE c_20pjxfld        33
  147. #DEFINE c_pjxfld          31
  148.  
  149. * Strings for product names
  150. #DEFINE c_foxwin   "FoxPro for Windows"
  151. #DEFINE c_foxmac   "FoxPro for Macintosh"
  152. #DEFINE c_foxdos   "FoxPro for MS-DOS"
  153. #DEFINE c_foxunix  "FoxPro for UNIX"
  154. #DEFINE c_winname  "WINDOWS"
  155. #DEFINE c_macname  "MAC"
  156. #DEFINE c_dosname  "DOS"
  157. #DEFINE c_unixname "UNIX"
  158. #DEFINE c_dosnum    1
  159. #DEFINE c_winnum    2
  160. #DEFINE c_macnum    3
  161. #DEFINE c_unixnum   4
  162.  
  163. * Metrics for various objects, report bands, etc.
  164. #DEFINE c_radhght      1.308
  165. #DEFINE c_chkhght      1.308
  166. #DEFINE c_listht       1.000
  167. #DEFINE c_adjfld       0.125
  168. #DEFINE c_adjlist      0.125
  169. #DEFINE c_adjtbtn      0.769
  170. #DEFINE c_adjrbtn      0.308
  171. #DEFINE c_vchkbox      0.154
  172. #DEFINE c_vradbtn      0.154
  173. #DEFINE c_vlist        0.500
  174. #DEFINE c_hpopup       1.000
  175. #DEFINE c_adjbox       0.500
  176. #DEFINE c_chkpixel        12
  177. DO CASE
  178. CASE _MAC
  179.    m.g_pophght      = 1.500    && popup height
  180.    m.g_vpopup       = 0.750    && vpos adjustment going from DOS to Mac
  181. CASE _WINDOWS
  182.    m.g_pophght      = 1.538
  183.    m.g_vpopup       = 0.906
  184. OTHERWISE
  185.    m.g_pophght      = 3.000
  186.    m.g_vpopup       = 0.906
  187. ENDCASE
  188.  
  189. IF _MAC
  190.    m.g_pixelsize  = 72       && logical pixels per inch
  191.    m.g_bandheight = ((14/m.g_pixelsize) * 10000)
  192.    m.g_bandfudge  =  3262
  193. ELSE
  194.    m.g_pixelsize  = 96       && logical pixels per inch
  195.    m.g_bandheight = ((19/m.g_pixelsize) * 10000)
  196.    m.g_bandfudge  =  4350
  197. ENDIF
  198. * Used in bandinfo() to adjust band vpos's when transporting to MS-DOS.
  199. * These calculations must match the ones immediately above.
  200. m.g_macbandheight = ((14/72) * 10000)
  201. m.g_winbandheight = ((19/96) * 10000)
  202.  
  203. #DEFINE c_charrptheight   66
  204. #DEFINE c_charrptwidth    80
  205. #DEFINE c_linesperinch    (66/11)
  206. #DEFINE c_charsperinch    13.71
  207.  
  208. #DEFINE c_pathsep ":"   && path separator character
  209.  
  210. #DEFINE c_mapfonts 3    && number of specially mapped fonts
  211.  
  212. * Version codes, put into Objcode fields in the header record
  213. #DEFINE c_25scx           63
  214. #DEFINE c_25frx           53
  215.  
  216. * Major file types
  217. #DEFINE c_report           0
  218. #DEFINE c_screen           1
  219. #DEFINE c_label            2
  220. #DEFINE c_project          3
  221.  
  222. * Error codes
  223. #DEFINE c_error1   "Minor"
  224. #DEFINE c_error2   "Serious"
  225. #DEFINE c_error3   "Fatal"
  226.  
  227. * Return values
  228. #DEFINE c_yes              1
  229. #DEFINE c_no               0
  230. #DEFINE c_cancel          -1
  231.  
  232. * Codepage translation.
  233. #DEFINE c_cptrans       .T.    && do special CP translation for FoxBASE+ and FoxPro 1.02?
  234. * The following four contants may need to be localized.
  235. #DEFINE c_doscp          437   && default DOS code page
  236. #DEFINE c_wincp         1252   && default Windows code page
  237. #DEFINE c_maccp        10000
  238. #DEFINE c_unixcp           0
  239.  
  240. * bands[] array indexes
  241. #DEFINE c_tobandvpos       1
  242. #DEFINE c_tobandheight     2
  243. #DEFINE c_fmbandvpos       3
  244. #DEFINE c_fmbandheight     4
  245.  
  246. * Frequently used strings.  Make them #DEFINES to simplify localization.
  247. #DEFINE c_converting   "Converting"
  248. #DEFINE c_transporting "Transporting"
  249.  
  250. * Check mark for selecting items to be transported
  251. IF _MAC
  252.    m.g_checkmark = "X"
  253. ELSE
  254.    m.g_checkmark = '√'
  255. ENDIF
  256.  
  257. * Defines used in converting FoxBASE+ reports
  258. #DEFINE maxliterals   55
  259. #DEFINE litpoolsize   1452
  260. #DEFINE maxrepflds   24
  261. #DEFINE h_page   1
  262. #DEFINE h_break 3
  263. #DEFINE l_item   4
  264. #DEFINE f_break 5
  265. #DEFINE f_page   7
  266. #DEFINE f_rpt   8
  267.  
  268. PUSH KEY CLEAR
  269.  
  270. *
  271. * Declare Environment Variables so that they are visible throughout the program
  272. *
  273. STORE "" TO m.cursor, m.consol, m.bell, m.exact, m.escape, m.onescape, m.safety, ;
  274.    m.fixed, m.print, m.unqset, m.udfparms, m.exclusive, m.onerror, ;
  275.    m.trbetween, m.comp, m.device, m.status, m.g_fromplatform, m.choice, ;
  276.    m.g_fromobjonlyalias, m.g_boxeditemsalias, m.g_tempalias, m.mtopic, m.rbord, m.mcollate, ;
  277.    m.mmacdesk, m.fields, mfieldsto
  278. STORE 0 TO m.deci, m.memowidth, m.currarea
  279. STORE .F. to m.g_char2grph, m.g_grph2char, m.g_grph2grph, m.g_char2char
  280.  
  281. DO setall
  282.  
  283. m.g_look2d           = .F.  && are buttons 2D or 3D?
  284.  
  285. m.g_filetype         =  0  && screen, report, label, etc.
  286.  
  287. * Set up these variables for scoping reasons here.  SetCtrl assigns them
  288. * their real values.
  289. m.g_ctrlfface        = ""
  290. m.g_ctrlfsize        = 0
  291. m.g_ctrlfstyle       = ""
  292. m.g_windfface        = ""
  293. m.g_windfsize        = 0
  294. m.g_windfstyle       = ""
  295. m.g_winbtnheight     = 0
  296. m.g_macbtnheight     = 0
  297. m.g_macbtnface       = ""
  298. m.g_macbtnsize       = 0
  299. m.g_macbtnstyle      = ""
  300. m.g_winbtnface       = ""
  301. m.g_winbtnsize       = 0
  302. m.g_winbtnstyle      = ""
  303. m.g_btnheight        = 0   && default btn height for the current platform
  304.  
  305. m.g_dfltfface        = ""
  306. m.g_dfltfsize        = 0
  307. m.g_dfltfstyle         = ""
  308. m.g_thermface        = ""
  309. m.g_thermsize        = 0
  310. m.g_thermstyle         = ""
  311.  
  312. * These fonts are not necessarily used in the report, but their cxChar and
  313. * cyChar are somewhat larger than the ones that are used.  This provides a
  314. * "fudge factor" to make sure the fields are wide and tall enough.
  315. IF _MAC
  316.    m.g_rptfface            = "Courier"
  317.    m.g_rptfsize            = 13
  318.    m.g_rptfstyle           = 0
  319.    m.g_rpttxtfontstyle     = ""
  320. ELSE
  321.    m.g_rptfface            = "Courier"
  322.    m.g_rptfsize            = 10
  323.    m.g_rptfstyle           = 0
  324.    m.g_rpttxtfontstyle     = ""
  325. ENDIF
  326. DO CASE
  327. CASE _WINDOWS
  328.    m.g_rptlinesize      = (FONTMETRIC(1, m.g_rptfface, m.g_rptfsize, m.g_rpttxtfontstyle) / m.g_pixelsize) * 10000
  329.    m.g_rptcharsize      = (FONTMETRIC(6, m.g_rptfface, m.g_rptfsize, m.g_rpttxtfontstyle) / m.g_pixelsize) * 10000
  330. CASE _MAC
  331.    * This factor is based on a cyChar of 13 for Geneva, 10 (Bold and regular)
  332.    * No fudge factor needed for cyChar.
  333.    m.g_rptlinesize      = (13/72) * 10000
  334.    * This factor is based on a cxChar of 7 for Geneva, 10 Bold,
  335.    * 72 pixels per inch for the Mac, and a 20% fudge factor.
  336.    m.g_rptcharsize      = ((7/72)  * 10000) * 1.2
  337. ENDCASE
  338.  
  339. DO setctrl   && set control/window measurement fonts, button height, etc.
  340.  
  341. * Font style for Transporter dialogs--not the converted screens, but the
  342. * dialogs in the Transporter itself.
  343. IF _MAC
  344.    m.g_tdlgface   = "Geneva"
  345.    m.g_tdlgsize   = 10.000
  346.    m.g_tdlgstyle  = "BT"
  347.    m.g_tdlgsty1   = "B"
  348.    m.g_tdlgsty2   = ""
  349.    m.g_tdlgbtn    = 1.500        && button height
  350.  
  351.    m.g_smface     = "Geneva"   && small font
  352.    m.g_smsize     = 10
  353.    m.g_smstyle    = "T"
  354.    m.g_smsty1     = ""
  355. ELSE
  356.    m.g_tdlgface   = "MS Sans Serif"
  357.    m.g_tdlgsize   = 8.000
  358.    m.g_tdlgstyle  = "BT"
  359.    m.g_tdlgsty1   = "BO"
  360.    m.g_tdlgsty2   = ""
  361.    m.g_tdlgbtn    = 1.769
  362.  
  363.    m.g_smface   = "MS Sans Serif"
  364.    m.g_smsize   = 8.000
  365.    m.g_smstyle  = "BT"
  366.    m.g_smsty1   = "BO"
  367. ENDIF
  368.  
  369. m.g_fontset          = .F.      && default font changed?
  370.  
  371. * Font for object selection list
  372. IF _MAC
  373.    m.g_foxfont          = "Courier"
  374.    m.g_foxfsize         = 10
  375. ELSE
  376.    m.g_foxfont          = "Foxfont"
  377.    m.g_foxfsize         = 9
  378. ENDIF
  379. m.g_normstylenum        = 0
  380. m.g_boldstylenum        = 1
  381.  
  382. m.g_fromplatform     = " "
  383. m.g_toplatform       = " "
  384. m.g_windheight       = 1
  385. m.g_windwidth        = 1
  386. m.g_thermwidth       = 0
  387. m.g_mercury          = 0
  388. m.g_20alias          = ""
  389. m.g_status           = 0    && records error status
  390. m.g_energize         = .F.  && does button say "Energize?"
  391. m.g_norepeat         = .F.
  392.  
  393. m.g_allobjects       = .T.  && what objects are we transporting?
  394. m.g_newobjects       = .T.
  395. m.g_snippets         = .T.
  396. m.g_newobjmode       = .F.
  397.  
  398. m.g_scrnalias        = ""
  399. m.g_updenviron       = .F.  && have we transported the environment records?
  400. m.g_tpselcnt         = 0    && number of entries in the tparray selection array
  401.  
  402. m.g_boxstrg = ['─','─','│','│','┌','┐','└','┘','─','─','│','│','┌','┐','└','┘']
  403.  
  404. m.g_returncode       = c_cancel
  405.  
  406. * Code pages we're translating to/from.
  407. m.g_tocodepage       = 0
  408. m.g_fromcodepage     = 0
  409.  
  410. * Dimension the array of records to be transported.  This is the picklist of new and
  411. * updated objects.
  412. DIMENSION tparray[1,2]
  413.  
  414. DIMENSION g_lastobjectline[2]
  415. g_lastobjectline = 0
  416. m.g_tempindex = "S" + SUBSTR(LOWER(SYS(3)),2,8) + ".cdx"
  417.  
  418. m.onerror = ON("ERROR")
  419. ON ERROR DO errorhandler WITH MESSAGE(), LINENO(), c_error3
  420.  
  421. IF m.pcount < 2
  422.    DO ErrorHandler WITH "The Transporter cannot be run as a standalone program.",LINENO(),c_error3
  423.    RETURN
  424. ENDIF
  425.  
  426. * Record fonts available on the current platform
  427. DIMENSION g_fontavail[1]
  428. =afont(g_fontavail)
  429.  
  430. DIMENSION g_fontmap[c_mapfonts,6]
  431. DO initfontmap   && initialize font mapping array
  432.  
  433. *
  434. * Make sure we have a file name we can deal with.  Prompt if the file cannot be found.
  435. *
  436. IF TYPE("m.g_scrndbf") != "C"
  437.    m.g_scrndbf = ""
  438.    DO assert WITH .T., "Invalid screen/report name."
  439. ENDIF
  440. m.g_scrndbf = UPPER(ALLTRIM(m.g_scrndbf))
  441. DO CASE
  442. CASE SUBSTR(m.g_scrndbf, RAT(".", m.g_scrndbf)+1, 3) = "SCX"
  443.    IF !FILE(m.g_scrndbf)
  444.       m.g_scrndbf = GETFILE("SCX", "Where is "+strippath(m.g_scrndbf))
  445.    ENDIF
  446. CASE SUBSTR(m.g_scrndbf, RAT(".", m.g_scrndbf)+1, 3) = "FRX"
  447.    IF !FILE(m.g_scrndbf)
  448.       m.g_scrndbf = GETFILE("FRX", "Where is "+strippath(m.g_scrndbf))
  449.    ENDIF
  450. CASE SUBSTR(m.g_scrndbf, RAT(".", m.g_scrndbf)+1, 3) = "LBX"
  451.    IF !FILE(m.g_scrndbf)
  452.       m.g_scrndbf = GETFILE("LBX", "Where is "+strippath(m.g_scrndbf))
  453.    ENDIF
  454. CASE SUBSTR(m.g_scrndbf, RAT(".", m.g_scrndbf)+1, 3) = "PJX"
  455.    IF !FILE(m.g_scrndbf)
  456.       m.g_scrndbf = GETFILE("PJX", "Where is "+strippath(m.g_scrndbf))
  457.    ENDIF
  458. OTHERWISE
  459.    IF !FILE(m.g_scrndbf)
  460.       m.g_scrndbf = GETFILE("SCX|FRX|LBX|PJX", "Select the file to transport", "Transport")
  461.    ENDIF
  462. ENDCASE
  463.  
  464. IF !FILE(m.g_scrndbf) OR EMPTY(m.g_scrndbf)
  465.    DO cleanup
  466.    RETURN .F.
  467. ENDIF
  468.  
  469. DO putwinmsg WITH "FoxPro Transporter: " + LOWER(strippath(m.g_scrndbf))
  470.  
  471. DO setversion  WITH m.g_toplatform
  472.  
  473. m.g_tocodepage = settocp()  && based on runtime platform
  474.  
  475. * If we've been passed an old format report or label form, see if it is a FoxPro 1.02
  476. * form, a FoxBASE+ form, or an unknown form.
  477. * Convert FoxPro 1.02 or FoxBASE+ DOS reports into 2.5 DOS reports
  478. IF INLIST(m.tp_filetype,c_frx102modi,c_frx102repo,c_lbx102modi, c_lbx102repo)
  479.    IF INLIST(m.tp_filetype,c_frx102modi,c_frx102repo)
  480.       m.tp_filetype = getoldreporttype()   && FoxPro 1.02 or FoxBASE+ report?
  481.    ELSE
  482.       m.tp_filetype = getoldlabeltype()    && FoxPro 1.02 or FoxBASE+ label?
  483.    ENDIF
  484.  
  485.    m.g_fromcodepage = c_doscp
  486.  
  487.    IF doupdate()           && prompt to convert to 2.5 format; sets m.g_filetype
  488.       DO CASE
  489.       CASE INLIST(m.tp_filetype,c_frx102modi,c_frx102repo)
  490.          * FoxPro 1.02 report
  491.          m.g_scrndbf = cvrt102frx(m.g_scrndbf, m.tp_filetype)
  492.       CASE INLIST(m.tp_filetype,c_fbprptmodi,c_fbprptrepo)
  493.          * FoxBASE+ report
  494.          m.g_scrndbf = cvrtfbprpt(m.g_scrndbf, m.tp_filetype)
  495.       CASE INLIST(m.tp_filetype,c_lbx102modi,c_lbx102repo)
  496.          * FoxPro 1.02 label
  497.          m.g_scrndbf = cvrt102lbx(m.g_scrndbf, m.tp_filetype)
  498.       CASE INLIST(m.tp_filetype,c_fbplblmodi,c_fbplblrepo)
  499.          * FoxBASE+ label
  500.          m.g_scrndbf = cvrtfbplbl(m.g_scrndbf, m.tp_filetype)
  501.         CASE m.tp_filetype = c_db4type
  502.          WAIT WINDOW "You must modify this dBASE IV file through the Catalog Manager" NOWAIT
  503.             DO cleanup WITH .T.
  504.       OTHERWISE
  505.          DO errorhandler WITH "Unknown report format",LINENO(),c_error3
  506.       ENDCASE
  507.    ELSE
  508.       DO cleanup
  509.       RETURN c_cancel
  510.    ENDIF
  511. ENDIF
  512.  
  513. * Open the screen/report/label/project file
  514. IF !opendbf(m.g_scrndbf)
  515.    m.g_returncode = c_cancel
  516. ENDIF
  517.  
  518. *
  519. * We have three basic conversion cases.  These are transporting a 2.0 file to a
  520. * graphical 2.5 platform (structure change and conversion), converting a 2.0 file
  521. * to a character 2.5 platform (structure change) and transporting a 2.5 platform
  522. * to another 2.5 platform (character/graphical conversion).  This case statement
  523. * calls the appropriate dialog routines and makes sure we have done all the
  524. * preparation (like creating the cursor we actually work with.)
  525. *
  526. * The 1.02 and FoxBASE+ reports/labels are handled in basically the same way.
  527. * They get their own cases in this construct since we don't want to prompt the
  528. * user twice for conversion.  Almost all of the actual conversion of these files
  529. * has already taken place, in the "cvrt102frx" procedure (and related procedures)
  530. * called above.
  531. *
  532. * Conversion of 2.0 project files is handled in its own case also.
  533. *
  534. DO CASE
  535. CASE INLIST(m.tp_filetype,c_frx102repo,c_fbprptrepo,c_lbx102repo,c_fbplblrepo) ;
  536.        AND (_WINDOWS OR _MAC)
  537.    * FoxPro 1.02 or FoxBASE+ report/label opened via REPORT/LABEL FORM.  At this point,
  538.    * we've already converted the old format form into FoxPro 2.5 DOS format.
  539.    * Finish conversion, but don't transport it to Windows.
  540.    m.g_fromplatform = c_dosname
  541.    m.g_fromcodepage = setfromcp(m.g_fromplatform)
  542.    m.g_returncode = c_yes
  543.    DO starttherm WITH c_converting,g_filetype
  544.    DO putwinmsg WITH c_converting + " " + LOWER(strippath(m.g_scrndbf))
  545.    DO converter
  546.  
  547. CASE INLIST(m.tp_filetype,c_frx102modi,c_fbprptmodi,c_lbx102modi,c_fbplblmodi) ;
  548.        AND (_WINDOWS OR _MAC)
  549.    * FoxPro 1.02 or FoxBASE+ report/label opened via MODIFY REPORT/LABEL. At this point,
  550.    *  we've already converted the old format form into FoxPro 2.5 DOS format.
  551.    * Finish conversion, and then transport it to Windows.
  552.    m.g_fromplatform = c_dosname
  553.    m.g_fromcodepage = setfromcp(m.g_fromplatform)
  554.    m.g_returncode = c_yes
  555.    DO putwinmsg WITH c_converting + " " + LOWER(strippath(m.g_scrndbf))
  556.    DO converter
  557.    DO putwinmsg WITH c_transporting + " " + LOWER(strippath(m.g_scrndbf))
  558.    DO import
  559.    DO synchtime WITH m.g_toplatform, m.g_fromplatform
  560.  
  561. CASE ((FCOUNT() = c_20scxfld OR FCOUNT() = c_20frxfld OR FCOUNT() = c_20lbxfld);
  562.       AND (_DOS OR _UNIX))
  563.    * Convert it to a DOS report, but don't transport it to Windows
  564.    DO CASE
  565.    CASE !doupdate()  && displays dialog and sets g_toPlatform
  566.       m.g_returncode = c_cancel
  567.    OTHERWISE
  568.       m.g_fromplatform = c_dosname
  569.       m.g_fromcodepage = setfromcp(m.g_fromplatform)
  570.       m.g_returncode = c_yes
  571.       DO starttherm WITH c_converting,g_filetype
  572.       DO converter
  573.    ENDCASE
  574.  
  575. CASE (FCOUNT() = c_20scxfld OR FCOUNT() = c_20frxfld ;
  576.       OR FCOUNT() = c_20lbxfld) AND (_WINDOWS OR _MAC)
  577.  
  578.    * Convert it to DOS and then transport it to Windows
  579.    m.choice = converttype(.T.)
  580.    m.g_fromcodepage = setfromcp(m.g_fromplatform)
  581.  
  582.    DO CASE
  583.    CASE m.choice = c_yes
  584.       m.g_returncode = c_yes
  585.       DO converter
  586.       DO import
  587.       DO synchtime WITH m.g_toplatform, m.g_fromplatform
  588.    CASE m.choice = c_no
  589.       m.g_returncode = c_no
  590.  
  591.    OTHERWISE
  592.       m.g_returncode = c_cancel
  593.    ENDCASE
  594.  
  595. CASE FCOUNT() = c_scxfld OR FCOUNT() = c_frxfld
  596.    m.choice = converttype(.F.)
  597.    DO CASE
  598.    CASE m.choice = c_yes
  599.       m.g_returncode = c_yes
  600.       DO makecursor
  601.       DO import
  602.       IF m.g_returncode <> c_cancel
  603.          * This might happen if the user picked "Cancel" on the screen that lets
  604.          * him/her uncheck specific items.
  605.          SELECT (m.g_scrnalias)
  606.          DO synchtime WITH m.g_toplatform, m.g_fromplatform
  607.       ENDIF
  608.    CASE m.choice = c_no
  609.       m.g_returncode = c_no
  610.  
  611.    OTHERWISE
  612.       m.g_returncode = c_cancel
  613.    ENDCASE
  614. CASE FCOUNT() = c_20pjxfld
  615.    IF versnum() > "2.5"
  616.       * Identify fields that contain binary data.  These should not be codepage-translated.
  617.       * Note that files opened via low level routines (e.g., FoxPro 1.02 reports) will not
  618.       * be codepage-translated automatically.  Strings in those files that require codepage
  619.       * translation will be codepage translated explicitly below.
  620.       SET NOCPTRANS TO arranged, object, symbols, devinfo
  621.    ENDIF
  622.  
  623.    * Converting a 2.0 project to 2.5 format
  624.    IF !doupdate()                 && displays dialog and sets g_toPlatform
  625.       m.g_returncode = c_cancel
  626.    ELSE
  627.       m.g_fromplatform = c_dosname
  628.       m.g_fromcodepage = setfromcp(m.g_fromplatform)
  629.       m.g_returncode = c_yes
  630.       DO putwinmsg WITH c_converting + " " + LOWER(strippath(m.g_scrndbf))
  631.       DO starttherm WITH c_converting,g_filetype
  632.       DO converter
  633.    ENDIF
  634. CASE FCOUNT() = c_pjxfld
  635.    * 2.5 project passed to us by mistake--shouldn't ever happen.
  636.    WAIT WINDOW "The transporter has nothing to do." NOWAIT
  637.    m.g_returncode = c_cancel
  638. OTHERWISE
  639.    DO errorhandler WITH "Unknown or invalid file format", LINENO(), c_error3
  640.    m.g_returncode = c_cancel
  641. ENDCASE
  642.  
  643. DO cleanup
  644.  
  645. RETURN m.g_returncode
  646.  
  647. *!*****************************************************************************
  648. *!
  649. *!       Function: OPENDBF
  650. *!
  651. *!      Called by: TRANSPRT.PRG
  652. *!
  653. *!*****************************************************************************
  654. FUNCTION opendbf
  655. PARAMETER fname
  656. m.g_scrnalias = "S"+SUBSTR(LOWER(SYS(3)),2,8)
  657. SELECT 0
  658. USE (m.fname) AGAIN ALIAS (m.g_scrnalias)
  659. IF RECCOUNT() = 0
  660.    WAIT WINDOW "No records to transport" NOWAIT
  661.    RETURN .F.
  662. ENDIF
  663. RETURN .T.
  664.  
  665. *
  666. * doupdate - Ask the user if a 2.0 screen/report/label should be updated to 2.5 format.
  667. *
  668. *!*****************************************************************************
  669. *!
  670. *!       Function: DOUPDATE
  671. *!
  672. *!      Called by: TRANSPRT.PRG
  673. *!
  674. *!          Calls: STRUCTDIALOG()     (function  in TRANSPRT.PRG)
  675. *!
  676. *!*****************************************************************************
  677. FUNCTION doupdate
  678. PRIVATE m.result
  679.  
  680. DO CASE
  681. CASE INLIST(m.tp_filetype,c_frx102modi, c_frx102repo)
  682.    m.g_filetype = c_report
  683.    m.result = structdialog("Convert 1.02 report file to 2.6 format?")
  684.  
  685. CASE INLIST(m.tp_filetype,c_fbprptmodi, c_fbprptrepo)
  686.    m.g_filetype = c_report
  687.    m.result = structdialog("Convert FoxBASE+ report file to FoxPro 2.6 format?")
  688.  
  689. CASE INLIST(m.tp_filetype,c_lbx102modi, c_lbx102repo)
  690.    m.g_filetype = c_label
  691.    m.result = structdialog("Convert 1.02 label file to 2.6 format?")
  692.  
  693. CASE INLIST(m.tp_filetype,c_fbplblmodi, c_fbplblrepo)
  694.    m.g_filetype = c_label
  695.    m.result = structdialog("Convert FoxBASE+ label file to FoxPro 2.6 format?")
  696.  
  697. CASE FCOUNT() = c_20scxfld
  698.    m.g_filetype = c_screen
  699.    m.result = structdialog("Convert 2.0 screen file to 2.6 format?")
  700.  
  701. CASE FCOUNT() = c_20frxfld
  702.    m.g_filetype = c_report
  703.    m.result = structdialog("Convert 2.0 report file to 2.6 format?")
  704.  
  705. CASE FCOUNT() = c_20lbxfld
  706.    RETURN .F.
  707.  
  708. CASE FCOUNT() = c_20pjxfld
  709.    m.g_filetype = c_project
  710.    m.result = structdialog("Convert 2.0 project file to 2.6 format?")
  711. CASE m.tp_filetype = c_db4type
  712.     m.result = .T.
  713.  
  714. OTHERWISE
  715.    DO errorhandler WITH "Unknown doupdate operation", LINENO(), c_error3
  716. ENDCASE
  717.  
  718. RETURN m.result
  719.  
  720. *
  721. * converttype - Display the dialog used when converting between 2.5 platforms
  722. *
  723. *!*****************************************************************************
  724. *!
  725. *!       Function: CONVERTTYPE
  726. *!
  727. *!      Called by: TRANSPRT.PRG
  728. *!
  729. *!          Calls: CLEANUP            (procedure in TRANSPRT.PRG)
  730. *!               : SCXFRXDIALOG()     (function  in TRANSPRT.PRG)
  731. *!
  732. *!           Uses: M.G_SCRNALIAS
  733. *!
  734. *!*****************************************************************************
  735. FUNCTION converttype
  736. PARAMETER m.twooh
  737. PRIVATE m.i, m.pcount, m.nplatforms
  738.  
  739. IF m.twooh  && If it's a 2.0 file, there is only one platform to convert from.
  740.    DIMENSION platforms[1]
  741.    platforms[1] = c_foxdos
  742.  
  743.    DO CASE                           && Remember the type of file we are converting
  744.    CASE INLIST(m.tp_filetype,c_frx102modi,c_frx102repo,c_fbprptmodi,c_fbprptrepo)
  745.       m.g_filetype = c_report
  746.  
  747.    CASE FCOUNT() = c_20scxfld
  748.       m.g_filetype = c_screen
  749.  
  750.    CASE FCOUNT() = c_20frxfld
  751.       m.g_filetype = c_report
  752.  
  753.    CASE FCOUNT() = c_20lbxfld
  754.       m.g_filetype = c_label
  755.  
  756.    CASE FCOUNT() = c_20pjxfld
  757.       m.g_filetype = c_project
  758.    ENDCASE
  759. ELSE
  760.    IF FCOUNT() = c_scxfld                && Remember the type of file we are converting
  761.       m.g_filetype = c_screen
  762.    ELSE
  763.       IF UPPER(RIGHT(m.g_scrndbf, 4)) = ".LBX"
  764.          LOCATE FOR objtype = c_ot20label OR ;
  765.             ((platform = c_winname OR platform = c_macname) AND ;
  766.             objtype = c_otheader AND BOTTOM)
  767.          IF FOUND()
  768.             m.g_filetype = c_label
  769.          ELSE
  770.             m.g_filetype = c_report
  771.          ENDIF
  772.       ELSE
  773.          m.g_filetype = c_report
  774.       ENDIF
  775.    ENDIF
  776.  
  777.    * See if this file has the special warning the Mac writes to reports
  778.     IF m.g_filetype = c_report
  779.        LOCATE FOR platform = "WINDOWS" AND iserrormsg(expr)
  780.         IF FOUND()
  781.             GOTO TOP
  782.             LOCATE FOR platform = "WINDOWS"
  783.             DELETE WHILE platform = "WINDOWS"
  784.             PACK
  785.         ENDIF
  786.         GOTO TOP
  787.     ENDIF
  788.  
  789.    * Get a list of the platforms in this file.
  790.    SELECT DISTINCT platform ;
  791.       FROM (m.g_scrnalias) ;
  792.       WHERE !DELETED() ;
  793.       INTO ARRAY availplatforms
  794.    m.nplatforms = _TALLY
  795.    m.pcount = 0
  796.  
  797.    IF m.nplatforms > 0
  798.       m.g_fromplatform = availplatforms[1]
  799.  
  800.       FOR i = 1 TO m.nplatforms
  801.          DO CASE
  802.          CASE ATC('DOS',availplatforms[m.i]) > 0 AND !_DOS
  803.             m.pcount = m.pcount + 1
  804.  
  805.          CASE ATC('WINDOWS',availplatforms[m.i]) > 0 AND !_WINDOWS
  806.             m.pcount = m.pcount + 1
  807.  
  808.          CASE ATC('UNIX',availplatforms[m.i]) > 0 AND !_UNIX
  809.             m.pcount = m.pcount + 1
  810.  
  811.          CASE ATC('MAC',availplatforms[m.i]) > 0 AND !_MAC
  812.             m.pcount = m.pcount + 1
  813.          ENDCASE
  814.       ENDFOR
  815.       RELEASE availplatforms
  816.    ENDIF
  817.  
  818.    IF m.nplatforms = 0 OR m.pcount = 0     && There isn't anything to convert from.
  819.       WAIT WINDOW "The transporter has nothing to do." NOWAIT
  820.       DO cleanup
  821.       RETURN c_cancel
  822.    ENDIF
  823. ENDIF
  824.  
  825. *   Call the dialog routine appropriate to this file type.
  826. DO CASE                        && Ask the user what we should do.
  827. CASE m.g_filetype = c_screen
  828.    RETURN scxfrxdialog("SCX")
  829. CASE m.g_filetype = c_report
  830.    DO setrptfont
  831.    RETURN scxfrxdialog("FRX")
  832. CASE m.g_filetype = c_label
  833.    DO setrptfont
  834.    RETURN scxfrxdialog("LBX")
  835. ENDCASE
  836. RETURN c_cancel
  837.  
  838. *
  839. * setversion - set global variable m.g_toPlatform with the name of the platform
  840. *            we are running on.
  841. *
  842. *!*****************************************************************************
  843. *!
  844. *!      Procedure: SETVERSION
  845. *!
  846. *!      Called by: TRANSPRT.PRG
  847. *!
  848. *!          Calls: ERRORHANDLER       (procedure in TRANSPRT.PRG)
  849. *!
  850. *!*****************************************************************************
  851. PROCEDURE setversion
  852. PARAMETER m.to
  853. DO CASE
  854. CASE _WINDOWS
  855.    m.to = c_winname
  856. CASE _MAC
  857.    m.to = c_macname
  858. CASE _UNIX
  859.    m.to = c_unixname
  860. CASE _DOS
  861.    m.to = c_dosname
  862. OTHERWISE
  863.    DO errorhandler WITH "Unknown Version of FoxPro.", LINENO(), c_error3
  864. ENDCASE
  865. *!*****************************************************************************
  866. *!
  867. *!      Procedure: settocp
  868. *!
  869. *!*****************************************************************************
  870. PROCEDURE settocp
  871. DO CASE
  872. CASE _WINDOWS
  873.    RETURN c_wincp
  874. CASE _MAC
  875.    RETURN c_maccp
  876. CASE _UNIX
  877.    RETURN c_unixcp
  878. CASE _DOS
  879.    RETURN c_doscp
  880. OTHERWISE
  881.    DO errorhandler WITH "Unknown Version of FoxPro.", LINENO(), c_error3
  882. ENDCASE
  883.  
  884. *
  885. * import - Do the import.
  886. *
  887. *!*****************************************************************************
  888. *!
  889. *!      Procedure: IMPORT
  890. *!
  891. *!      Called by: TRANSPRT.PRG
  892. *!
  893. *!          Calls: EMPTYPLATFORM()    (function  in TRANSPRT.PRG)
  894. *!               : GETCHARSUPPRESS()  (function  in TRANSPRT.PRG)
  895. *!               : CHARTOGRAPHIC      (procedure in TRANSPRT.PRG)
  896. *!               : GRAPHICTOCHAR      (procedure in TRANSPRT.PRG)
  897. *!
  898. *!           Uses: M.G_SCRNALIAS
  899. *!
  900. *!*****************************************************************************
  901. PROCEDURE import
  902.  
  903. IF m.g_fromplatform = m.g_toplatform
  904.    * This shouldn't be possible
  905.    DO assert WITH .T.,"To and from platforms are the same in line "+TRIM(STR(LINENO()))
  906.    RETURN
  907. ELSE
  908.    *   If we are converting everything, remove all records for the target
  909.    *   platform.
  910.    IF m.g_allobjects AND !emptyplatform(m.g_toplatform)
  911.       * We need to copy the records we want to a temporary file, clear our cursor
  912.       * and copy the records back since you can't pack a cursor and SELECT creates
  913.       * a read only cursor.
  914.       m.g_tempalias = "S" + SUBSTR(LOWER(SYS(3)),2,8)
  915.       SELECT * FROM (m.g_scrnalias) ;
  916.          WHERE !DELETED() AND platform <> m.g_toplatform ;
  917.          INTO TABLE (m.g_tempalias)
  918.       SELECT (m.g_scrnalias)
  919.       ZAP
  920.       APPEND FROM (m.g_tempalias)
  921.       SELECT (m.g_tempalias)
  922.       USE
  923.       DELETE FILE (m.g_tempalias+".dbf")
  924.       DELETE FILE (m.g_tempalias+".fpt")
  925.       SELECT (m.g_scrnalias)
  926.    ENDIF
  927.  
  928.    m.g_char2grph =  (m.g_toplatform = 'WINDOWS' OR m.g_toplatform = 'MAC') AND ;
  929.       (m.g_fromplatform = 'DOS' OR m.g_fromplatform = 'UNIX')
  930.    m.g_grph2grph =  (m.g_toplatform = 'WINDOWS' OR m.g_toplatform = 'MAC') AND ;
  931.           (m.g_fromplatform = 'WINDOWS' OR m.g_fromplatform = 'MAC')
  932.    m.g_grph2char =  (m.g_toplatform = 'DOS' OR m.g_toplatform = 'UNIX') AND ;
  933.       (m.g_fromplatform = 'WINDOWS' OR m.g_fromplatform = 'MAC')
  934.    m.g_char2char =  (m.g_toplatform = 'DOS' OR m.g_toplatform = 'UNIX') AND ;
  935.       (m.g_fromplatform = 'DOS' OR m.g_fromplatform = 'UNIX')
  936. ENDIF
  937.  
  938. IF g_filetype = c_report
  939.    m.g_norepeat = getcharsuppress()
  940. ENDIF
  941.  
  942. *  Pass control to the control routine appropriate for the direction we are converting.
  943. DO CASE
  944. CASE m.g_char2grph
  945.    DO chartographic
  946. CASE m.g_grph2char
  947.    DO graphictochar
  948. CASE m.g_grph2grph
  949.    DO graphictographic
  950. ENDCASE
  951. RETURN
  952.  
  953. *
  954. * GraphicToChar - Converts everything, new objects or changed snippets from a grpahical
  955. *      platform to a character platform.
  956. *
  957. *!*****************************************************************************
  958. *!
  959. *!      Procedure: GRAPHICTOCHAR
  960. *!
  961. *!      Called by: IMPORT             (procedure in TRANSPRT.PRG)
  962. *!
  963. *!          Calls: ALLGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  964. *!               : SELECTOBJ          (procedure in TRANSPRT.PRG)
  965. *!               : STARTTHERM         (procedure in TRANSPRT.PRG)
  966. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  967. *!               : UPDATESCREEN       (procedure in TRANSPRT.PRG)
  968. *!               : UPDATEREPORT       (procedure in TRANSPRT.PRG)
  969. *!               : NEWGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  970. *!
  971. *!*****************************************************************************
  972. PROCEDURE graphictochar
  973. IF m.g_allobjects
  974.    *  Start the thermometer with the appropriate message.
  975.    DO starttherm WITH c_transporting,m.g_filetype
  976.  
  977.    DO allgraphictochar
  978. ELSE
  979.    * Do a partial conversion, unless we're dealing with a label
  980.    IF m.g_filetype = c_label      && We only do complete label conversion
  981.       RETURN
  982.    ENDIF
  983.  
  984.    DO selectobj   && figure out which ones to transport
  985.  
  986.    *  Start the thermometer with the appropriate message.
  987.    DO starttherm WITH c_transporting,m.g_filetype
  988.  
  989.    m.g_mercury = 5
  990.    DO updtherm WITH m.g_mercury
  991.  
  992.    DO putwinmsg WITH c_transporting + " " + LOWER(strippath(m.g_scrndbf))
  993.  
  994.    SELECT (m.g_scrnalias)
  995.  
  996.    IF m.g_snippets
  997.       IF m.g_filetype = c_screen
  998.          DO updatescreen
  999.       ELSE
  1000.          DO updatereport
  1001.       ENDIF
  1002.    ENDIF
  1003.    IF m.g_newobjects
  1004.       DO newgraphictochar
  1005.    ENDIF
  1006. ENDIF
  1007.  
  1008. *
  1009. * CharToGraphic - Converts everything, new objects or changed snippets from a character
  1010. *      platform to a graphical platform.
  1011. *
  1012. *!*****************************************************************************
  1013. *!
  1014. *!      Procedure: CHARTOGRAPHIC
  1015. *!
  1016. *!      Called by: IMPORT             (procedure in TRANSPRT.PRG)
  1017. *!
  1018. *!          Calls: ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  1019. *!               : SELECTOBJ          (procedure in TRANSPRT.PRG)
  1020. *!               : STARTTHERM         (procedure in TRANSPRT.PRG)
  1021. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  1022. *!               : UPDATESCREEN       (procedure in TRANSPRT.PRG)
  1023. *!               : UPDATEREPORT       (procedure in TRANSPRT.PRG)
  1024. *!               : NEWCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  1025. *!
  1026. *!*****************************************************************************
  1027. PROCEDURE chartographic
  1028. IF m.g_allobjects
  1029.    *  Start the thermometer with the appropriate message.
  1030.    DO starttherm WITH c_transporting,m.g_filetype
  1031.  
  1032.    DO allchartographic
  1033. ELSE
  1034.    IF m.g_filetype = c_label      && We only do complete label convertsion
  1035.       RETURN
  1036.    ENDIF
  1037.  
  1038.    DO selectobj   && figure out which ones to transport
  1039.  
  1040.    *  Start the thermometer with the appropriate message.
  1041.    DO starttherm WITH c_transporting,m.g_filetype
  1042.  
  1043.    m.g_mercury = 5
  1044.    DO updtherm WITH m.g_mercury
  1045.  
  1046.    DO putwinmsg WITH c_transporting + " " + LOWER(strippath(m.g_scrndbf))
  1047.  
  1048.    SELECT (m.g_scrnalias)
  1049.  
  1050.    IF m.g_snippets
  1051.       IF m.g_filetype = c_screen
  1052.          DO updatescreen
  1053.       ELSE
  1054.          DO updatereport
  1055.       ENDIF
  1056.    ENDIF
  1057.    IF m.g_newobjects
  1058.       DO newchartographic
  1059.    ENDIF
  1060. ENDIF
  1061. *
  1062. * GraphicToGraphic - Converts everything, new objects or changed snippets from a graphic
  1063. *      platform to another graphical platform.
  1064. *
  1065. *!*****************************************************************************
  1066. *!
  1067. *!      Procedure: GRAPHICOGRAPHIC
  1068. *!
  1069. *!      Called by: IMPORT             (procedure in TRANSPRT.PRG)
  1070. *!
  1071. *!          Calls: ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  1072. *!               : SELECTOBJ          (procedure in TRANSPRT.PRG)
  1073. *!               : STARTTHERM         (procedure in TRANSPRT.PRG)
  1074. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  1075. *!               : UPDATESCREEN       (procedure in TRANSPRT.PRG)
  1076. *!               : UPDATEREPORT       (procedure in TRANSPRT.PRG)
  1077. *!               : NEWCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  1078. *!
  1079. *!*****************************************************************************
  1080. PROCEDURE graphictographic
  1081. IF m.g_allobjects
  1082.    *  Start the thermometer with the appropriate message.
  1083.    DO starttherm WITH c_transporting,m.g_filetype
  1084.  
  1085.    DO allgrphtogrph
  1086. ELSE
  1087.    IF m.g_filetype = c_label      && We only do complete label convertsion
  1088.       RETURN
  1089.    ENDIF
  1090.  
  1091.    DO selectobj   && figure out which ones to transport
  1092.  
  1093.    *  Start the thermometer with the appropriate message.
  1094.    DO starttherm WITH c_transporting,m.g_filetype
  1095.  
  1096.    m.g_mercury = 5
  1097.    DO updtherm WITH m.g_mercury
  1098.  
  1099.    DO putwinmsg WITH c_transporting + " " + LOWER(strippath(m.g_scrndbf))
  1100.  
  1101.    SELECT (m.g_scrnalias)
  1102.  
  1103.    IF m.g_snippets
  1104.       IF m.g_filetype = c_screen
  1105.          DO updatescreen
  1106.       ELSE
  1107.          DO updatereport
  1108.       ENDIF
  1109.    ENDIF
  1110.    IF m.g_newobjects
  1111.       DO newgrphtogrph
  1112.    ENDIF
  1113. ENDIF
  1114.  
  1115. *
  1116. * UpdateScreen - Copy any non-platform specific
  1117. *
  1118. *!*****************************************************************************
  1119. *!
  1120. *!      Procedure: UPDATESCREEN
  1121. *!
  1122. *!      Called by: GRAPHICTOCHAR      (procedure in TRANSPRT.PRG)
  1123. *!               : CHARTOGRAPHIC      (procedure in TRANSPRT.PRG)
  1124. *!
  1125. *!          Calls: GETSNIPFLAG()      (function  in TRANSPRT.PRG)
  1126. *!               : ISOBJECT()         (function  in TRANSPRT.PRG)
  1127. *!               : MAPBUTTON()        (function  in TRANSPRT.PRG)
  1128. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  1129. *!
  1130. *!           Uses: M.G_SCRNALIAS
  1131. *!
  1132. *!        Indexes: ID                     (tag)
  1133. *!
  1134. *!*****************************************************************************
  1135. PROCEDURE updatescreen
  1136. PRIVATE m.thermstep
  1137.  
  1138. COUNT TO m.thermstep FOR platform = m.g_toplatform
  1139. IF m.g_newobjects
  1140.    m.thermstep = 40/m.thermstep
  1141. ELSE
  1142.    m.thermstep = 80/m.thermstep
  1143. ENDIF
  1144.  
  1145. m.g_tempalias = "S" + SUBSTR(LOWER(SYS(3)),2,8)
  1146. SELECT * FROM (m.g_scrnalias) ;
  1147.    WHERE !DELETED() AND platform = m.g_fromplatform ;
  1148.    AND isselected(uniqueid,objtype,objcode) ;
  1149.    INTO CURSOR (m.g_tempalias)
  1150. INDEX ON uniqueid TAG id
  1151.  
  1152. SELECT (m.g_scrnalias)
  1153. SET RELATION TO uniqueid INTO (m.g_tempalias) ADDITIVE
  1154. LOCATE FOR .T.
  1155.  
  1156. SELECT (m.g_scrnalias)
  1157.  
  1158. * Check for flag to transport only code snippets
  1159. m.sniponly = .F.
  1160. LOCATE FOR platform = m.g_toplatform AND objtype = c_otheader
  1161. IF FOUND()
  1162.    m.sniponly = getsnipflag(setupcode)
  1163. ENDIF
  1164.  
  1165. IF !m.sniponly
  1166.    DO updenviron WITH .T.
  1167. ENDIF
  1168.  
  1169. * Update everything else
  1170. SCAN FOR platform = m.g_toplatform AND !DELETED() ;
  1171.       AND (isobject(objtype) OR objtype = c_otheader)
  1172.    IF &g_tempalias..timestamp > timestamp
  1173.       IF !m.sniponly
  1174.          REPLACE name WITH &g_tempalias..name
  1175.          REPLACE expr WITH &g_tempalias..expr
  1176.          REPLACE STYLE WITH &g_tempalias..style
  1177.          IF INLIST(objtype,c_otradbut,c_ottxtbut)
  1178.             * Don't zap the whole set of buttons if there are just some new ones
  1179.             REPLACE PICTURE WITH mapbutton(&g_tempalias..picture,PICTURE)
  1180.          ELSE
  1181.             REPLACE PICTURE WITH &g_tempalias..picture
  1182.          ENDIF
  1183.          IF objtype <> c_otheader OR m.g_grph2char OR EMPTY(order)
  1184.             * Icon file name is stored in Windows header, "order" field
  1185.             REPLACE ORDER WITH &g_tempalias..order
  1186.          ENDIF
  1187.          REPLACE UNIQUE WITH &g_tempalias..unique
  1188.          *REPLACE Environ WITH &g_tempalias..Environ
  1189.          REPLACE boxchar WITH &g_tempalias..boxchar
  1190.          REPLACE fillchar WITH &g_tempalias..fillchar
  1191.          REPLACE TAG WITH &g_tempalias..tag
  1192.          REPLACE tag2 WITH &g_tempalias..tag2
  1193.          REPLACE ruler WITH &g_tempalias..ruler
  1194.          REPLACE rulerlines WITH &g_tempalias..rulerlines
  1195.          REPLACE grid WITH &g_tempalias..grid
  1196.          REPLACE gridv WITH &g_tempalias..gridv
  1197.          REPLACE gridh WITH &g_tempalias..gridh
  1198.          REPLACE FLOAT WITH &g_tempalias..float
  1199.          REPLACE CLOSE WITH &g_tempalias..close
  1200.          REPLACE MINIMIZE WITH &g_tempalias..minimize
  1201.          REPLACE BORDER WITH &g_tempalias..border
  1202.          REPLACE SHADOW WITH &g_tempalias..shadow
  1203.          REPLACE CENTER WITH &g_tempalias..center
  1204.          REPLACE REFRESH WITH &g_tempalias..refresh
  1205.          REPLACE disabled WITH &g_tempalias..disabled
  1206.          REPLACE scrollbar WITH &g_tempalias..scrollbar
  1207.          REPLACE addalias WITH &g_tempalias..addalias
  1208.          REPLACE TAB WITH &g_tempalias..tab
  1209.          REPLACE initialval WITH &g_tempalias..initialval
  1210.          REPLACE initialnum WITH &g_tempalias..initialnum
  1211.          REPLACE spacing WITH &g_tempalias..spacing
  1212.          * Update width if it looks like a text object got longer in Windows
  1213.          IF m.g_grph2char AND objtype = c_ottext
  1214.             REPLACE width WITH MAX(width,LEN(CHRTRAN(expr,'"'+chr(39),'')))
  1215.          ENDIF
  1216.       ENDIF
  1217.       IF objtype = c_otfield  && watch out for SAYs changing to GETs
  1218.          REPLACE objcode WITH &g_tempalias..objcode
  1219.       ENDIF
  1220.       REPLACE lotype WITH &g_tempalias..lotype
  1221.       REPLACE rangelo WITH &g_tempalias..rangelo
  1222.       REPLACE hitype WITH &g_tempalias..hitype
  1223.       REPLACE rangehi WITH &g_tempalias..rangehi
  1224.       REPLACE whentype WITH &g_tempalias..whentype
  1225.       REPLACE WHEN WITH &g_tempalias..when
  1226.       REPLACE validtype WITH &g_tempalias..validtype
  1227.       REPLACE VALID WITH &g_tempalias..valid
  1228.       REPLACE errortype WITH &g_tempalias..errortype
  1229.       REPLACE ERROR WITH &g_tempalias..error
  1230.       REPLACE messtype WITH &g_tempalias..messtype
  1231.       REPLACE MESSAGE WITH &g_tempalias..message
  1232.       REPLACE showtype WITH &g_tempalias..showtype
  1233.       REPLACE SHOW WITH &g_tempalias..show
  1234.       REPLACE activtype WITH &g_tempalias..activtype
  1235.       REPLACE ACTIVATE WITH &g_tempalias..activate
  1236.       REPLACE deacttype WITH &g_tempalias..deacttype
  1237.       REPLACE DEACTIVATE WITH &g_tempalias..deactivate
  1238.       REPLACE proctype WITH &g_tempalias..proctype
  1239.       REPLACE proccode WITH &g_tempalias..proccode
  1240.       REPLACE setuptype WITH &g_tempalias..setuptype
  1241.       REPLACE setupcode WITH &g_tempalias..setupcode
  1242.  
  1243.       REPLACE timestamp WITH &g_tempalias..timestamp
  1244.       REPLACE platform WITH m.g_toplatform
  1245.    ENDIF
  1246.  
  1247.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  1248.    DO updtherm WITH m.g_mercury
  1249.  
  1250. ENDSCAN
  1251.  
  1252. SELECT (m.g_tempalias)
  1253. USE
  1254. SELECT (m.g_scrnalias)
  1255.  
  1256. RETURN
  1257.  
  1258. *
  1259. * UpdateReport - Copy any "non-platform specific" information from one platform to another
  1260. *
  1261. *!*****************************************************************************
  1262. *!
  1263. *!      Procedure: UPDATEREPORT
  1264. *!
  1265. *!      Called by: GRAPHICTOCHAR      (procedure in TRANSPRT.PRG)
  1266. *!               : CHARTOGRAPHIC      (procedure in TRANSPRT.PRG)
  1267. *!
  1268. *!          Calls: ADJRPTSUPPRESS     (procedure in TRANSPRT.PRG)
  1269. *!               : ADJRPTFLOAT        (procedure in TRANSPRT.PRG)
  1270. *!               : ADJRPTRESET        (procedure in TRANSPRT.PRG)
  1271. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  1272. *!
  1273. *!           Uses: M.G_SCRNALIAS
  1274. *!
  1275. *!        Indexes: ID                     (tag)
  1276. *!
  1277. *!*****************************************************************************
  1278. PROCEDURE updatereport
  1279. PRIVATE m.thermstep
  1280.  
  1281. COUNT TO m.thermstep FOR platform = m.g_toplatform
  1282. IF m.g_newobjects
  1283.    m.thermstep = 40/m.thermstep
  1284. ELSE
  1285.    m.thermstep = 80/m.thermstep
  1286. ENDIF
  1287.  
  1288. m.g_tempalias = "S" + SUBSTR(LOWER(SYS(3)),2,8)
  1289. SELECT * FROM (m.g_scrnalias) ;
  1290.    WHERE platform = m.g_fromplatform AND !DELETED();
  1291.    AND isselected(uniqueid,objtype,objcode) ;
  1292.    INTO CURSOR (m.g_tempalias)
  1293. INDEX ON uniqueid TAG id
  1294.  
  1295. SELECT (m.g_scrnalias)
  1296. SET RELATION TO uniqueid INTO (m.g_tempalias) ADDITIVE
  1297. LOCATE FOR .T.
  1298.  
  1299. SELECT (m.g_scrnalias)
  1300. DO updenviron WITH .T.
  1301.  
  1302. SCAN FOR platform = m.g_toplatform AND ;
  1303.       (objtype = c_otheader OR objtype = c_otfield OR objtype = c_otpicture OR ;
  1304.       objtype = c_otrepfld OR objtype = c_otband OR objtype = c_otrepvar OR ;
  1305.       objtype = c_ottext OR objtype = c_otline OR objtype = c_otbox) AND !DELETED()
  1306.    IF &g_tempalias..timestamp > timestamp
  1307.       REPLACE name WITH &g_tempalias..name
  1308.       IF objtype = c_otrepvar AND m.g_grph2char
  1309.          REPLACE name WITH UPPER(name)
  1310.       ENDIF
  1311.       REPLACE expr WITH &g_tempalias..expr
  1312.       REPLACE STYLE WITH &g_tempalias..style
  1313.       REPLACE PICTURE WITH &g_tempalias..picture
  1314.       REPLACE ORDER WITH &g_tempalias..order
  1315.       REPLACE UNIQUE WITH &g_tempalias..unique
  1316.       REPLACE ENVIRON WITH &g_tempalias..environ
  1317.       REPLACE boxchar WITH &g_tempalias..boxchar
  1318.       REPLACE fillchar WITH &g_tempalias..fillchar
  1319.       REPLACE TAG WITH &g_tempalias..tag
  1320.       REPLACE tag2 WITH &g_tempalias..tag2
  1321.       REPLACE mode WITH &g_tempalias..mode
  1322.       REPLACE ruler WITH &g_tempalias..ruler
  1323.       REPLACE rulerlines WITH &g_tempalias..rulerlines
  1324.       REPLACE grid WITH &g_tempalias..grid
  1325.       REPLACE gridv WITH &g_tempalias..gridv
  1326.       REPLACE gridh WITH &g_tempalias..gridh
  1327.       REPLACE FLOAT WITH &g_tempalias..float
  1328.       REPLACE STRETCH WITH &g_tempalias..stretch
  1329.       REPLACE stretchtop WITH &g_tempalias..stretchtop
  1330.       REPLACE TOP WITH &g_tempalias..top
  1331.       REPLACE BOTTOM WITH &g_tempalias..bottom
  1332.       REPLACE suptype WITH &g_tempalias..suptype
  1333.       REPLACE suprest WITH &g_tempalias..suprest
  1334.       REPLACE norepeat WITH &g_tempalias..norepeat
  1335.       REPLACE resetrpt WITH &g_tempalias..resetrpt
  1336.       REPLACE pagebreak WITH &g_tempalias..pagebreak
  1337.       REPLACE colbreak WITH &g_tempalias..colbreak
  1338.       REPLACE resetpage WITH &g_tempalias..resetpage
  1339.       REPLACE GENERAL WITH &g_tempalias..general
  1340.       REPLACE spacing WITH &g_tempalias..spacing
  1341.       REPLACE DOUBLE WITH &g_tempalias..double
  1342.       REPLACE swapheader WITH &g_tempalias..swapheader
  1343.       REPLACE swapfooter WITH &g_tempalias..swapfooter
  1344.       REPLACE ejectbefor WITH &g_tempalias..ejectbefor
  1345.       REPLACE ejectafter WITH &g_tempalias..ejectafter
  1346.       REPLACE PLAIN WITH &g_tempalias..plain
  1347.       REPLACE SUMMARY WITH &g_tempalias..summary
  1348.       REPLACE addalias WITH &g_tempalias..addalias
  1349.       REPLACE offset WITH &g_tempalias..offset
  1350.       REPLACE topmargin WITH &g_tempalias..topmargin
  1351.       REPLACE botmargin WITH &g_tempalias..botmargin
  1352.       REPLACE totaltype WITH &g_tempalias..totaltype
  1353.       REPLACE resettotal WITH &g_tempalias..resettotal
  1354.       REPLACE resoid WITH &g_tempalias..resoid
  1355.       REPLACE curpos WITH &g_tempalias..curpos
  1356.       REPLACE supalways WITH &g_tempalias..supalways
  1357.       REPLACE supovflow WITH &g_tempalias..supovflow
  1358.       REPLACE suprpcol WITH &g_tempalias..suprpcol
  1359.       REPLACE supgroup WITH &g_tempalias..supgroup
  1360.       REPLACE supvalchng WITH &g_tempalias..supvalchng
  1361.       REPLACE supexpr WITH &g_tempalias..supexpr
  1362.  
  1363.       REPLACE timestamp WITH &g_tempalias..timestamp
  1364.       REPLACE platform WITH m.g_toplatform
  1365.  
  1366.       * Update width if it looks like a text object got longer in Windows
  1367.       IF m.g_grph2char AND objtype = c_ottext
  1368.          REPLACE width WITH MAX(width,LEN(CHRTRAN(expr,'"'+chr(39),'')))
  1369.       ENDIF
  1370.  
  1371.       DO adjrptsuppress
  1372.       DO adjrptfloat
  1373.       IF objtype = c_otrepvar OR (objtype = c_otrepfld AND totaltype > 0)
  1374.          DO adjrptreset
  1375.       ENDIF
  1376.    ENDIF
  1377.  
  1378.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  1379.    DO updtherm WITH m.g_mercury
  1380. ENDSCAN
  1381.  
  1382. SELECT (m.g_tempalias)
  1383. USE
  1384. SELECT (m.g_scrnalias)
  1385.  
  1386. RETURN
  1387.  
  1388.  
  1389. *!*****************************************************************************
  1390. *!
  1391. *!      Procedure: UPDENVIRON
  1392. *!
  1393. *!*****************************************************************************
  1394. PROCEDURE updenviron
  1395. PARAMETER m.mustexist
  1396. * Update environment records if the user selected environment records for transport
  1397. * and if any of them have been updated.
  1398. IF EnvSelect() AND IsNewerEnv(m.mustexist)
  1399.    * Drop the old environment and put the new one in
  1400.    DELETE FOR IsEnviron(objtype) and platform = m.g_toplatform
  1401.    SCAN FOR platform = m.g_fromplatform AND IsEnviron(Objtype)
  1402.       SCATTER MEMVAR MEMO
  1403.       APPEND BLANK
  1404.       GATHER MEMVAR MEMO
  1405.       REPLACE platform WITH m.g_toplatform
  1406.       IF m.g_grph2char
  1407.          * DOS requires the alias name to be in upper case, while Windows doesn't
  1408.          REPLACE TAG WITH UPPER(TAG)
  1409.          REPLACE tag2 WITH UPPER(tag2)
  1410.       ENDIF
  1411.    ENDSCAN
  1412.    m.g_updenviron = .T.
  1413. ENDIF
  1414.  
  1415. *
  1416. * CONVERTPROJECT - Convert project file from 2.0 to 2.5 format
  1417. *
  1418. *!*****************************************************************************
  1419. *!
  1420. *!      Procedure: CONVERTPROJECT
  1421. *!
  1422. *!      Called by: CONVERTER          (procedure in TRANSPRT.PRG)
  1423. *!
  1424. *!*****************************************************************************
  1425. PROCEDURE convertproject
  1426. PRIVATE m.i
  1427.  
  1428. SELECT (m.g_scrnalias)
  1429. ZAP
  1430.  
  1431. SELECT (m.g_20alias)
  1432. SCAN FOR !DELETED()
  1433.    SCATTER MEMVAR MEMO
  1434.    m.wasarranged = arranged
  1435.    RELEASE m.arranged         && to avoid type mismatch at GATHER time
  1436.  
  1437.    SELECT (m.g_scrnalias)
  1438.    APPEND BLANK
  1439.    GATHER MEMVAR MEMO
  1440.    DO CASE
  1441.    CASE type == "H"
  1442.       IF !EMPTY(devinfo)
  1443.          * Adjust developer info to support wider state code
  1444.          REPLACE devinfo WITH STUFF(devinfo,162,0,CHR(0)+CHR(0)+CHR(0))
  1445.          REPLACE devinfo WITH STUFF(devinfo,176,0,REPLICATE(CHR(0),46))
  1446.       ENDIF
  1447.  
  1448.    CASE type == "s"   && must be lowercase S
  1449.       * Adjust for the new method of storing cross-platform arrangement info
  1450.       * (ScrnRow = -999 for centered screens)
  1451.       REPLACE arranged WITH ;
  1452.           PADR(c_dosname,8);
  1453.          +IIF(m.wasarranged,"T","F");
  1454.          +IIF(m.scrnrow=-999,"T","F");
  1455.          +PADL(LTRIM(STR(m.scrnrow,4)),8) ;
  1456.          +PADL(LTRIM(STR(m.scrncol,4)),8) ;
  1457.          +PADR(c_winname,8);
  1458.          +IIF(m.wasarranged,"T","F");
  1459.          +IIF(m.scrnrow=-999,"T","F");
  1460.          +PADL(LTRIM(STR(m.scrnrow,4)),8) ;
  1461.          +PADL(LTRIM(STR(m.scrncol,4)),8) ;
  1462.          +PADR(c_macname,8);
  1463.          +IIF(m.wasarranged,"T","F");
  1464.          +IIF(m.scrnrow=-999,"T","F");
  1465.          +PADL(LTRIM(STR(m.scrnrow,4)),8) ;
  1466.          +PADL(LTRIM(STR(m.scrncol,4)),8)
  1467.    ENDCASE
  1468.  
  1469.    * Adjust the symbol table
  1470.    IF !EMPTY(symbols)
  1471.       FOR i = 1 TO INT((LEN(symbols)-4)/14)
  1472.          * Format of a 2.0 symbol table is
  1473.          *   4 bytes of header information
  1474.          *   n occurrences of this structure:
  1475.          *      TEXT symName[11]
  1476.          *      TEXT symType
  1477.          *      TEXT flags[2]
  1478.          * Format of a 2.5 symbol table is the same, except symName is now 13 bytes long
  1479.          REPLACE symbols WITH STUFF(symbols,(m.i-1)*16+15,0,CHR(0)+CHR(0))
  1480.          REPLACE ckval WITH VAL(sys(2007,symbols))
  1481.       ENDFOR
  1482.    ENDIF
  1483.  
  1484.    * Blank out the timestamp
  1485.    REPLACE timestamp WITH 0
  1486. ENDSCAN
  1487.  
  1488. *
  1489. * NewCharToGraphic - Take any new objects from the character platform and copy them
  1490. *      to the graphical platform.
  1491. *
  1492. *!*****************************************************************************
  1493. *!
  1494. *!      Procedure: NEWCHARTOGRAPHIC
  1495. *!
  1496. *!      Called by: CHARTOGRAPHIC      (procedure in TRANSPRT.PRG)
  1497. *!
  1498. *!          Calls: GETWINDFONT        (procedure in TRANSPRT.PRG)
  1499. *!               : NEWBANDS           (procedure in TRANSPRT.PRG)
  1500. *!               : BANDINFO()         (function  in TRANSPRT.PRG)
  1501. *!               : ISOBJECT()         (function  in TRANSPRT.PRG)
  1502. *!               : PLATFORMDEFAULTS   (procedure in TRANSPRT.PRG)
  1503. *!               : FILLININFO         (procedure in TRANSPRT.PRG)
  1504. *!               : RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  1505. *!               : FINDLIKEVPOS       (procedure in TRANSPRT.PRG)
  1506. *!               : FINDLIKEHPOS       (procedure in TRANSPRT.PRG)
  1507. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  1508. *!
  1509. *!           Uses: M.G_SCRNALIAS
  1510. *!
  1511. *!*****************************************************************************
  1512. PROCEDURE newchartographic
  1513. PRIVATE m.thermstep, m.bandcount
  1514.  
  1515. m.g_newobjmode = .T.
  1516. SELECT (m.g_scrnalias)
  1517. SET ORDER TO
  1518.  
  1519. * Get the default font for the window in the "to" platform
  1520. IF m.g_char2grph
  1521.    DO getwindfont
  1522. ENDIF
  1523.  
  1524. * Update the environment if it is new
  1525. DO updenviron WITH .F.
  1526.  
  1527. * Remember the window default font
  1528. SELECT (m.g_scrnalias)
  1529. LOCATE FOR platform = m.g_toplatform AND objtype = c_otheader
  1530. IF FOUND()
  1531.    m.wfontface  = fontface
  1532.    m.wfontsize  = fontsize
  1533.    m.wfontstyle = fontstyle
  1534. ELSE
  1535.    m.wfontface  = m.g_dfltfface
  1536.    m.wfontsize  = m.g_dfltfsize
  1537.    m.wfontstyle = m.g_dfltfstyle
  1538. ENDIF
  1539.  
  1540. m.g_tempalias = "S" + SUBSTR(LOWER(SYS(3)),2,8)
  1541. SELECT * FROM (m.g_scrnalias) ;
  1542.    WHERE !DELETED() AND platform = m.g_fromplatform AND ;
  1543.    isselected(uniqueid,objtype,objcode) AND ;
  1544.    uniqueid NOT IN (SELECT uniqueid FROM (m.g_scrnalias) ;
  1545.    WHERE platform = m.g_toplatform) ;
  1546.    INTO CURSOR (m.g_tempalias)
  1547.  
  1548. IF m.g_snippets
  1549.    m.thermstep = 35/_TALLY
  1550. ELSE
  1551.    m.thermstep = 70/_TALLY
  1552. ENDIF
  1553.  
  1554. IF m.g_filetype = c_report
  1555.    DO newbands
  1556.  
  1557.    * We need to know where bands start and where they end in
  1558.    * both platforms.
  1559.    SELECT (m.g_scrnalias)
  1560.    COUNT TO m.bandcount FOR platform = m.g_toplatform AND objtype = c_otband
  1561.    DIMENSION bands[m.bandCount,4]
  1562.    m.bandcount = bandinfo()
  1563.    SELECT (m.g_tempalias)
  1564. ENDIF
  1565.  
  1566. m.rightmost = 0
  1567. m.bottommost = 0
  1568.  
  1569. SCAN
  1570.    IF isobject(objtype)
  1571.       SCATTER MEMVAR MEMO
  1572.       SELECT (m.g_scrnalias)
  1573.       APPEND BLANK
  1574.       GATHER MEMVAR MEMO
  1575.  
  1576.       REPLACE platform WITH m.g_toplatform
  1577.  
  1578.       DO platformdefaults WITH 0
  1579.       DO fillininfo
  1580.  
  1581.       DO CASE
  1582.       CASE INLIST(objtype,c_otbox, c_otline)
  1583.          DO adjbox WITH c_adjbox
  1584.       ENDCASE
  1585.  
  1586.       IF m.g_filetype = c_report
  1587.          DO rptobjconvert WITH m.bandcount
  1588.       ELSE
  1589.          REPLACE vpos WITH findlikevpos(vpos)
  1590.          REPLACE hpos WITH findlikehpos(hpos)
  1591.  
  1592.          m.rightmost = MAX(m.rightmost, hpos + width ;
  1593.           * FONTMETRIC(6,fontface,fontsize,num2style(fontstyle)) ;
  1594.           / FONTMETRIC(6,m.wfontface,m.wfontsize,num2style(m.wfontstyle)))
  1595.          m.bottommost = MAX(m.bottommost, vpos + height ;
  1596.           * FONTMETRIC(1,fontface,fontsize,num2style(fontstyle)) ;
  1597.           / FONTMETRIC(1,m.wfontface,m.wfontsize,num2style(m.wfontstyle)))
  1598.       ENDIF
  1599.    ENDIF
  1600.  
  1601.    SELECT (m.g_tempalias)
  1602.  
  1603.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  1604.    DO updtherm WITH m.g_mercury
  1605. ENDSCAN
  1606.  
  1607. SELECT (m.g_tempalias)
  1608. USE
  1609. SELECT (m.g_scrnalias)
  1610. * Update screen width/height if necessary to hold the new objects
  1611. IF m.g_filetype = c_screen
  1612.    LOCATE FOR platform = m.g_toplatform AND objtype = c_otheader
  1613.    IF FOUND()
  1614.       * If the screen/report isn't big enough to hold the widest/tallest object,
  1615.       * resize it.
  1616.       IF width < m.rightmost
  1617.          REPLACE width WITH m.rightmost + IIF(m.g_filetype = c_screen,2,2000)
  1618.       ENDIF
  1619.       IF height < m.bottommost AND m.g_filetype = c_screen
  1620.          REPLACE height WITH m.bottommost + IIF(m.g_filetype = c_screen,1,2000)
  1621.       ENDIF
  1622.    ENDIF
  1623. ENDIF
  1624. RETURN
  1625.  
  1626. *
  1627. * NewGraphicToChar - Take any new objects from the graphic platform and copy them
  1628. *      to the character platform.
  1629. *
  1630. *!*****************************************************************************
  1631. *!
  1632. *!      Procedure: NEWGRAPHICTOCHAR
  1633. *!
  1634. *!      Called by: GRAPHICTOCHAR      (procedure in TRANSPRT.PRG)
  1635. *!
  1636. *!          Calls: NEWBANDS           (procedure in TRANSPRT.PRG)
  1637. *!               : BANDINFO()         (function  in TRANSPRT.PRG)
  1638. *!               : ISOBJECT()         (function  in TRANSPRT.PRG)
  1639. *!               : PLATFORMDEFAULTS   (procedure in TRANSPRT.PRG)
  1640. *!               : FILLININFO         (procedure in TRANSPRT.PRG)
  1641. *!               : ADJHEIGHTANDWIDTH  (procedure in TRANSPRT.PRG)
  1642. *!               : RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  1643. *!               : FINDLIKEVPOS       (procedure in TRANSPRT.PRG)
  1644. *!               : FINDLIKEHPOS       (procedure in TRANSPRT.PRG)
  1645. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  1646. *!               : MAKECHARFIT        (procedure in TRANSPRT.PRG)
  1647. *!
  1648. *!           Uses: M.G_SCRNALIAS
  1649. *!
  1650. *!*****************************************************************************
  1651. PROCEDURE newgraphictochar
  1652. PRIVATE m.thermstep, m.bandcount
  1653.  
  1654. m.g_newobjmode = .T.
  1655. SELECT (m.g_scrnalias)
  1656. SET ORDER TO
  1657.  
  1658. * Update the environment if it is new
  1659. DO updenviron WITH .F.
  1660.  
  1661. m.g_tempalias = "S" + SUBSTR(LOWER(SYS(3)),2,8)
  1662. *
  1663. * Get a cursor containing the records in the "to" platform that do not have
  1664. * counterparts in the "from" platform.  Exclude Windows report column headers
  1665. * and column footers (objtype = 9, objcode = 2 or 6) since they have no DOS analogs.
  1666. * Exclude boxes that are filled black.  They are probably used for shadow effects.
  1667. *
  1668. SELECT * FROM (m.g_scrnalias) ;
  1669.    WHERE !DELETED() AND platform = m.g_fromplatform AND ;
  1670.    !(objtype = c_otband AND INLIST(objcode,2,6)) AND ;
  1671.    isselected(uniqueid,objtype,objcode) AND ;
  1672.    !blackbox(objtype,fillred,fillblue,fillgreen,fillpat) AND ;
  1673.    uniqueid NOT IN (SELECT uniqueid FROM (m.g_scrnalias) ;
  1674.    WHERE platform = m.g_toplatform) ;
  1675.    INTO CURSOR (m.g_tempalias)
  1676.  
  1677. IF m.g_snippets
  1678.    m.thermstep = 35/_TALLY
  1679. ELSE
  1680.    m.thermstep = 70/_TALLY
  1681. ENDIF
  1682.  
  1683. IF m.g_filetype = c_report
  1684.    DO newbands
  1685.  
  1686.    * We need to know where bands start and where they end in
  1687.    * both platforms.
  1688.    SELECT (m.g_scrnalias)
  1689.    COUNT TO m.bandcount FOR platform = m.g_toplatform AND objtype = c_otband
  1690.    DIMENSION bands[m.bandCount,4]
  1691.    m.bandcount = bandinfo()
  1692.    SELECT (m.g_tempalias)
  1693. ENDIF
  1694.  
  1695. LOCATE FOR .T.
  1696. DO WHILE !EOF()
  1697.    IF isobject(objtype) AND objtype <> c_otpicture
  1698.       SCATTER MEMVAR MEMO
  1699.       SELECT (m.g_scrnalias)
  1700.       APPEND BLANK
  1701.       GATHER MEMVAR MEMO
  1702.  
  1703.       REPLACE platform WITH m.g_toplatform
  1704.  
  1705.       DO platformdefaults WITH 0
  1706.       DO fillininfo
  1707.  
  1708.       IF m.g_filetype = c_screen
  1709.          DO adjheightandwidth
  1710.       ELSE
  1711.         DO rptobjconvert WITH m.bandcount
  1712.       ENDIF
  1713.  
  1714.       REPLACE vpos WITH findlikevpos(vpos)
  1715.       REPLACE hpos WITH findlikehpos(hpos)
  1716.    ENDIF
  1717.  
  1718.    SELECT (m.g_tempalias)
  1719.    SKIP
  1720.  
  1721.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  1722.    DO updtherm WITH m.g_mercury
  1723. ENDDO
  1724.  
  1725. SELECT (m.g_tempalias)
  1726. USE
  1727. SELECT (m.g_scrnalias)
  1728.  
  1729. DO makecharfit
  1730.  
  1731. RETURN
  1732.  
  1733. *
  1734. * NewGrphToGrph - Take any new objects from the graphic platform and copy them
  1735. *      to the other graphical platform.
  1736. *
  1737. *!*****************************************************************************
  1738. *!
  1739. *!      Procedure: NEWGRPHTOGRPH
  1740. *!
  1741. *!          Calls: NEWBANDS           (procedure in TRANSPRT.PRG)
  1742. *!               : BANDINFO()         (function  in TRANSPRT.PRG)
  1743. *!               : ISOBJECT()         (function  in TRANSPRT.PRG)
  1744. *!               : PLATFORMDEFAULTS   (procedure in TRANSPRT.PRG)
  1745. *!               : FILLININFO         (procedure in TRANSPRT.PRG)
  1746. *!               : ADJHEIGHTANDWIDTH  (procedure in TRANSPRT.PRG)
  1747. *!               : RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  1748. *!               : FINDLIKEVPOS       (procedure in TRANSPRT.PRG)
  1749. *!               : FINDLIKEHPOS       (procedure in TRANSPRT.PRG)
  1750. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  1751. *!               : MAKECHARFIT        (procedure in TRANSPRT.PRG)
  1752. *!
  1753. *!           Uses: M.G_SCRNALIAS
  1754. *!
  1755. *!*****************************************************************************
  1756. PROCEDURE newgrphtogrph
  1757. PRIVATE m.thermstep, m.bandcount
  1758.  
  1759. m.g_newobjmode = .T.
  1760.  
  1761. m.g_bandfudge = 0
  1762.  
  1763. SELECT (m.g_scrnalias)
  1764. SET ORDER TO
  1765.  
  1766. * Update the environment if it is new
  1767. DO updenviron WITH .F.
  1768.  
  1769. m.g_tempalias = "S" + SUBSTR(LOWER(SYS(3)),2,8)
  1770. *
  1771. * Get a cursor containing the records in the "to" platform that do not have
  1772. * counterparts in the "from" platform.
  1773. *
  1774. SELECT * FROM (m.g_scrnalias) ;
  1775.    WHERE !DELETED() AND platform = m.g_fromplatform AND ;
  1776.    isselected(uniqueid,objtype,objcode) AND ;
  1777.    uniqueid NOT IN (SELECT uniqueid FROM (m.g_scrnalias) ;
  1778.    WHERE platform = m.g_toplatform) ;
  1779.    INTO CURSOR (m.g_tempalias)
  1780.  
  1781. IF m.g_snippets
  1782.    m.thermstep = 35/_TALLY
  1783. ELSE
  1784.    m.thermstep = 70/_TALLY
  1785. ENDIF
  1786.  
  1787. IF m.g_filetype = c_report
  1788.  
  1789.    DO newbands
  1790.  
  1791.    * We need to know where bands start and where they end in
  1792.    * both platforms.
  1793.    SELECT (m.g_scrnalias)
  1794.    COUNT TO m.bandcount FOR platform = m.g_toplatform AND objtype = c_otband
  1795.    DIMENSION bands[m.bandCount,4]
  1796.    m.bandcount = bandinfo()
  1797.    SELECT (m.g_tempalias)
  1798. ENDIF
  1799.  
  1800. LOCATE FOR .T.
  1801. DO WHILE !EOF()
  1802.    IF isobject(objtype) AND objtype <> c_otpicture
  1803.       SCATTER MEMVAR MEMO
  1804.       SELECT (m.g_scrnalias)
  1805.       APPEND BLANK
  1806.       GATHER MEMVAR MEMO
  1807.  
  1808.       REPLACE platform WITH m.g_toplatform
  1809.  
  1810.       DO platformdefaults WITH 0
  1811.       DO fillininfo
  1812.  
  1813.       IF m.g_filetype = c_screen
  1814.          DO adjheightandwidth
  1815.       ELSE
  1816.         DO rptobjconvert WITH m.bandcount
  1817.       ENDIF
  1818.  
  1819.       REPLACE vpos WITH findlikevpos(vpos)
  1820.       REPLACE hpos WITH findlikehpos(hpos)
  1821.    ENDIF
  1822.  
  1823.    SELECT (m.g_tempalias)
  1824.    SKIP
  1825.  
  1826.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  1827.    DO updtherm WITH m.g_mercury
  1828. ENDDO
  1829.  
  1830. SELECT (m.g_tempalias)
  1831. USE
  1832. SELECT (m.g_scrnalias)
  1833.  
  1834. RETURN
  1835.  
  1836. *
  1837. * NewBands - Add any new band records.
  1838. *
  1839. *!*****************************************************************************
  1840. *!
  1841. *!      Procedure: NEWBANDS
  1842. *!
  1843. *!      Called by: NEWCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  1844. *!               : NEWGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  1845. *!
  1846. *!          Calls: RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  1847. *!               : BANDPOS()          (function  in TRANSPRT.PRG)
  1848. *!
  1849. *!*****************************************************************************
  1850. PROCEDURE newbands
  1851. PRIVATE m.prevband, m.bandstart, m.bandheight
  1852. * We need to have the groups in order to do report objects, so we do them seperately.
  1853.  
  1854. SCAN FOR objtype = c_otband
  1855.    SCATTER MEMVAR MEMO
  1856.    SELECT (m.g_scrnalias)
  1857.    LOCATE FOR platform = m.g_fromplatform AND uniqueid = m.uniqueid
  1858.    SKIP -1
  1859.    m.prevband = uniqueid
  1860.    LOCATE FOR platform = m.g_toplatform AND uniqueid = m.prevband
  1861.    INSERT BLANK
  1862.    GATHER MEMVAR MEMO
  1863.    REPLACE platform WITH m.g_toplatform
  1864.  
  1865.    DO rptobjconvert WITH 0
  1866.  
  1867.    DO CASE
  1868.    CASE m.g_char2grph
  1869.       m.bandheight = height + m.g_bandheight + (m.g_bandfudge/m.g_pixelsize)
  1870.    CASE m.g_grph2char
  1871.       m.bandheight = 0
  1872.    CASE m.g_grph2grph
  1873.       m.bandheight = height + m.g_bandheight + (m.g_bandfudge/m.g_pixelsize)
  1874.         IF _MAC AND objcode >= 4
  1875.            m.bandheight = m.bandheight + (1/m.g_pixelsize)*10000
  1876.         ENDIF
  1877.    ENDCASE
  1878.    m.bandstart = bandpos(m.uniqueid, m.g_toplatform)
  1879.  
  1880.     IF m.g_grph2grph
  1881.        * Because of the bandfudge adjustment, we need to allow some leeway on
  1882.        * the staring point of the band.  Allow 1/2 pixel.
  1883.        m.bandstart = m.bandstart - ((1/2) / m.g_pixelsize) * 10000
  1884.     ENDIF
  1885.  
  1886.    * Move all the lower bands down by the size of the one we just inserted.
  1887.    REPLACE ALL vpos WITH vpos + m.bandheight ;
  1888.       FOR platform = m.g_toplatform AND ;
  1889.       (objtype = c_otline OR objtype = c_otbox OR ;
  1890.       objtype = c_ottext OR objtype = c_otrepfld) AND ;
  1891.       vpos >= m.bandstart
  1892.    SELECT (m.g_tempalias)
  1893. ENDSCAN
  1894.  
  1895. *
  1896. * AllGraphicToChar - Convert from a graphic platform to a character platform assuming
  1897. *      that no records exist for the target platform.
  1898. *
  1899. *!*****************************************************************************
  1900. *!
  1901. *!      Procedure: ALLGRAPHICTOCHAR
  1902. *!
  1903. *!      Called by: GRAPHICTOCHAR      (procedure in TRANSPRT.PRG)
  1904. *!
  1905. *!          Calls: ALLENVIRONS        (procedure in TRANSPRT.PRG)
  1906. *!               : ALLOTHERS          (procedure in TRANSPRT.PRG)
  1907. *!               : ALLGROUPS          (procedure in TRANSPRT.PRG)
  1908. *!               : RPTCONVERT         (procedure in TRANSPRT.PRG)
  1909. *!               : MERGELABELOBJECTS  (procedure in TRANSPRT.PRG)
  1910. *!               : LINESBETWEEN       (procedure in TRANSPRT.PRG)
  1911. *!               : MAKECHARFIT        (procedure in TRANSPRT.PRG)
  1912. *!               : SUPPRESSBLANKLINES (procedure in TRANSPRT.PRG)
  1913. *!
  1914. *!           Uses: M.G_SCRNALIAS
  1915. *!
  1916. *!*****************************************************************************
  1917. PROCEDURE allgraphictochar
  1918. PRIVATE m.objindex
  1919.  
  1920. DO allenvirons
  1921.  
  1922. *
  1923. * Create a cursor with all the objects we have left to add.
  1924. *
  1925. m.g_fromobjonlyalias = "S" + SUBSTR(LOWER(SYS(3)),2,8)
  1926. SELECT *, RECNO() AS recnum FROM (m.g_scrnalias) ;
  1927.    WHERE !DELETED() AND platform = m.g_fromplatform AND ;
  1928.    objtype <> c_otrel AND objtype <> c_otworkar AND objtype <> c_otindex AND ;
  1929.    objtype <> c_otheader AND objtype <> c_otgroup AND ;
  1930.    objtype <> c_otpicture AND ;
  1931.    !blackbox(objtype,fillred,fillblue,fillgreen,fillpat) AND ;
  1932.    !(m.g_filetype = c_label AND objtype = c_ot20label) AND ;
  1933.    !(objtype = c_ot20lbxobj AND EMPTY(expr)) AND;
  1934.    oktransport(comment) ;
  1935.    INTO CURSOR (m.g_fromobjonlyalias)
  1936. m.objindex = _TALLY
  1937.  
  1938. DO allothers WITH 80
  1939. DO allgroups WITH 10
  1940.  
  1941. DO CASE
  1942. CASE m.g_filetype = c_label
  1943.    ** Trim any records the character platforms won't deal with.
  1944.    DELETE FOR platform = m.g_toplatform AND ;
  1945.       ((objtype = c_otband AND objcode != 4) OR ;
  1946.       objtype = c_otrepvar OR objtype = c_otpicture OR ;
  1947.       objtype = c_otline OR objtype = c_otbox)
  1948.    DO rptconvert
  1949.    DO mergelabelobjects
  1950.    DO linesbetween
  1951.  
  1952. CASE m.g_filetype = c_report
  1953.    ** Trim any records the character platforms won't deal with.
  1954.    DELETE FOR platform = m.g_toplatform AND (objtype = c_otpicture)
  1955.    DO rptconvert
  1956.    DO makecharfit
  1957.    DO suppressblanklines
  1958.  
  1959. CASE m.g_filetype = c_screen
  1960.    DO makecharfit
  1961. ENDCASE
  1962.  
  1963. SELECT (m.g_fromobjonlyalias)
  1964. USE
  1965. SELECT (m.g_scrnalias)
  1966.  
  1967. RETURN
  1968.  
  1969. *
  1970. * AllCharToGraphic - Convert from a character platform to a graphic platform assuming
  1971. *      that no records exist for the target platform.
  1972. *
  1973. *!*****************************************************************************
  1974. *!
  1975. *!      Procedure: ALLCHARTOGRAPHIC
  1976. *!
  1977. *!      Called by: CHARTOGRAPHIC      (procedure in TRANSPRT.PRG)
  1978. *!
  1979. *!          Calls: ALLENVIRONS        (procedure in TRANSPRT.PRG)
  1980. *!               : ALLOTHERS          (procedure in TRANSPRT.PRG)
  1981. *!               : ALLGROUPS          (procedure in TRANSPRT.PRG)
  1982. *!               : CALCWINDOWDIMENSION(procedure in TRANSPRT.PRG)
  1983. *!               : ADJITEMSINBOXES    (procedure in TRANSPRT.PRG)
  1984. *!               : ADJINVBTNS         (procedure in TRANSPRT.PRG)
  1985. *!               : JOINLINES          (procedure in TRANSPRT.PRG)
  1986. *!               : RPTCONVERT         (procedure in TRANSPRT.PRG)
  1987. *!               : SUPPRESSBLANKLINES (procedure in TRANSPRT.PRG)
  1988. *!               : ADDGRAPHICALLABELGR(procedure in TRANSPRT.PRG)
  1989. *!               : LABELBANDS         (procedure in TRANSPRT.PRG)
  1990. *!               : LABELLINES         (procedure in TRANSPRT.PRG)
  1991. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  1992. *!               : num2style()        (function  in TRANSPRT.PRG)
  1993. *!               : STRETCHLINESTOBORDE(procedure in TRANSPRT.PRG)
  1994. *!
  1995. *!           Uses: M.G_SCRNALIAS
  1996. *!
  1997. *!*****************************************************************************
  1998. PROCEDURE allchartographic
  1999. PRIVATE m.objindex
  2000.  
  2001. * Make equivalent screen/report records for the new platform.
  2002. DO allenvirons
  2003.  
  2004. m.g_fromobjonlyalias = "S" + SUBSTR(LOWER(SYS(3)),2,8)
  2005. SELECT *, RECNO() AS recnum FROM (m.g_scrnalias) ;
  2006.    WHERE !DELETED() AND platform = m.g_fromplatform AND objtype <> c_otrel AND ;
  2007.    objtype <> c_otworkar AND objtype <> c_otindex AND ;
  2008.    objtype <> c_otheader AND objtype <> c_otgroup AND ;
  2009.    !(m.g_filetype = c_label AND objtype = c_ot20label) AND ;
  2010.    !(objtype = c_ot20lbxobj AND EMPTY(expr)) AND;
  2011.    oktransport(comment) ;
  2012.    INTO CURSOR (m.g_fromobjonlyalias)
  2013.  
  2014. m.objindex = _TALLY
  2015. IF _TALLY = 0
  2016.    SELECT (m.g_fromobjonlyalias)
  2017.    USE
  2018.    SELECT (m.g_scrnalias)
  2019.    RETURN
  2020. ENDIF
  2021.  
  2022. DIMENSION objectpos[m.objindex, 9]
  2023.  
  2024. DO allothers WITH 25
  2025. DO allgroups WITH 5
  2026.  
  2027. * Attempt to adjust the position of objects to reflect the position
  2028. * in the previous platform.
  2029.  
  2030. DO CASE
  2031. CASE m.g_filetype = c_screen
  2032.    DO calcwindowdimensions
  2033.    DO adjitemsinboxes
  2034.    DO adjinvbtns
  2035.    SET ORDER TO
  2036.  
  2037.    DO joinlines
  2038.  
  2039. CASE m.g_filetype = c_report
  2040.    DO rptconvert
  2041.    DO joinlines
  2042.    DO suppressblanklines
  2043.  
  2044. CASE m.g_filetype = c_label
  2045.    DO addgraphicallabelgroups
  2046.    DO labelbands
  2047.    DO labellines
  2048. ENDCASE
  2049.  
  2050. m.g_mercury = MIN(m.g_mercury + 5, 95)
  2051. DO updtherm WITH m.g_mercury
  2052.  
  2053. IF m.g_filetype = c_screen
  2054.    IF m.g_allobjects
  2055.       LOCATE FOR platform = m.g_toplatform AND objtype = c_otheader AND STYLE != 0
  2056.       IF FOUND()
  2057.          IF m.g_windheight - g_lastobjectline[1] - 3 = 0
  2058.             m.adjustment = .5
  2059.          ELSE
  2060.             m.adjustment = m.g_windheight - g_lastobjectline[1] - 3
  2061.          ENDIF
  2062.  
  2063.          IF m.adjustment < 0
  2064.             m.adjustment = m.adjustment + 1.5
  2065.          ENDIF
  2066.  
  2067.          IF m.adjustment > 0
  2068.             REPLACE height WITH g_lastobjectline[2] + ;
  2069.                m.adjustment * (FONTMETRIC(1) / ;
  2070.                FONTMETRIC(1,fontface, fontsize, num2style(fontstyle)))
  2071.          ELSE
  2072.             REPLACE height WITH g_lastobjectline[2] + 1
  2073.          ENDIF
  2074.       ENDIF
  2075.       DO stretchlinestoborders
  2076.    ENDIF
  2077. ENDIF
  2078.  
  2079. m.g_mercury = MIN(m.g_mercury + 5, 95)
  2080. DO updtherm WITH m.g_mercury
  2081.  
  2082. SELECT (m.g_fromobjonlyalias)
  2083. USE
  2084. SELECT (m.g_scrnalias)
  2085.  
  2086. *
  2087. * AllGrphToGrph - Convert from a graphic platform to another graphic platform assuming
  2088. *      that no records exist for the target platform.
  2089. *
  2090. *!*****************************************************************************
  2091. *!
  2092. *!      Procedure: ALLGRPHTOGRPH
  2093. *!
  2094. *!          Calls: ALLENVIRONS        (procedure in TRANSPRT.PRG)
  2095. *!               : ALLOTHERS          (procedure in TRANSPRT.PRG)
  2096. *!               : ALLGROUPS          (procedure in TRANSPRT.PRG)
  2097. *!               : RPTCONVERT         (procedure in TRANSPRT.PRG)
  2098. *!               : MERGELABELOBJECTS  (procedure in TRANSPRT.PRG)
  2099. *!               : LINESBETWEEN       (procedure in TRANSPRT.PRG)
  2100. *!               : MAKECHARFIT        (procedure in TRANSPRT.PRG)
  2101. *!               : SUPPRESSBLANKLINES (procedure in TRANSPRT.PRG)
  2102. *!
  2103. *!           Uses: M.G_SCRNALIAS
  2104. *!
  2105. *!*****************************************************************************
  2106. PROCEDURE allgrphtogrph
  2107. PRIVATE m.objindex
  2108.  
  2109. DO allenvirons
  2110.  
  2111. *
  2112. * Create a cursor with all the objects we have left to add.
  2113. *
  2114. m.g_fromobjonlyalias = "S" + SUBSTR(LOWER(SYS(3)),2,8)
  2115. SELECT *, RECNO() AS recnum FROM (m.g_scrnalias) ;
  2116.    WHERE !DELETED() AND platform = m.g_fromplatform AND ;
  2117.    objtype <> c_otrel AND objtype <> c_otworkar AND objtype <> c_otindex AND ;
  2118.    objtype <> c_otheader AND objtype <> c_otgroup AND ;
  2119.    !(m.g_filetype = c_label AND objtype = c_ot20label) AND ;
  2120.    !(objtype = c_ot20lbxobj AND EMPTY(expr)) AND;
  2121.    oktransport(comment) ;
  2122.    INTO CURSOR (m.g_fromobjonlyalias)
  2123. m.objindex = _TALLY
  2124.  
  2125. DO allothers WITH 80
  2126. DO allgroups WITH 10
  2127.  
  2128. DO CASE
  2129. CASE m.g_filetype = c_label
  2130.    DO rptconvert
  2131.    DO mergelabelobjects
  2132.    DO linesbetween
  2133.  
  2134. CASE m.g_filetype = c_report
  2135.    DO rptconvert
  2136.  
  2137. CASE m.g_filetype = c_screen
  2138.    *DO makecharfit
  2139. ENDCASE
  2140.  
  2141. SELECT (m.g_fromobjonlyalias)
  2142. USE
  2143. SELECT (m.g_scrnalias)
  2144.  
  2145. RETURN
  2146.  
  2147.  
  2148. *
  2149. * cvrt102FRX - Converts a DOS 1.02 report to DOS 2.5 format
  2150. *
  2151. *!*****************************************************************************
  2152. *!
  2153. *!       Function: CVRT102FRX
  2154. *!
  2155. *!      Called by: TRANSPRT.PRG
  2156. *!
  2157. *!          Calls: DOCREATE           (procedure in TRANSPRT.PRG)
  2158. *!               : FORCEEXT()         (function  in TRANSPRT.PRG)
  2159. *!
  2160. *!*****************************************************************************
  2161. FUNCTION cvrt102frx
  2162. * Converts FoxPro 1.02 DOS report to FoxPro 2.5 DOS report
  2163. PARAMETER m.fname102, m.ftype
  2164. PRIVATE m.bakname, m.in_area
  2165.  
  2166. m.in_area = SELECT()
  2167. SELECT 0
  2168. * Create a database structure matching the tab delimited format
  2169. *  of a 1.02 report file.
  2170. CREATE CURSOR old ( ;
  2171.    objtype N(10,0), ;
  2172.    content N(10,0), ;
  2173.    fldcontent C(254), ;
  2174.    frmcontent C(254), ;
  2175.    vertpos N(10,0), ;
  2176.    horzpos N(10,0), ;
  2177.    height N(10,0), ;
  2178.    WIDTH N(10,0), ;
  2179.    FONT N(10,0), ;
  2180.    fontsize N(10,0), ;
  2181.    STYLE N(10,0), ;
  2182.    penred N(10,0), ;
  2183.    pengreen N(10,0), ;
  2184.    penblue N(10,0), ;
  2185.    fillred N(10,0), ;
  2186.    fillgreen N(10,0), ;
  2187.    fillblue N(10,0), ;
  2188.    PICTURE C(254), ;
  2189.    rangeup N(10,0), ;
  2190.    rangelow N(10,0), ;
  2191.    VALID N(10,0), ;
  2192.    initc N(10,0), ;
  2193.    calcexp N(10,0) ;
  2194.    )
  2195.  
  2196. * Replace quote marks with \" so that APPEND won't strip them out.  They are our only
  2197. * way of distinguishing quoted text from, say, field names.
  2198. m.fpin  = fopen(m.fname102,2)   && open for read access
  2199. m.outname = forceext(m.fname102,"TMP")
  2200. m.fpout = fcreate(m.outname)
  2201.  
  2202. IF m.fpin > 0 AND m.fpout > 0
  2203.    DO WHILE !FEOF(m.fpin)
  2204.       m.buf = fgets(m.fpin)
  2205.       m.buf = STRTRAN(m.buf,'"','\+')
  2206.       =fputs(m.fpout,m.buf)
  2207.    ENDDO
  2208.    =fclose(m.fpin)
  2209.    =fclose(m.fpout)
  2210.  
  2211.    APPEND FROM (m.outname) TYPE DELIMITED WITH TAB
  2212.  
  2213.    * Drop the temporary output file
  2214.    IF FILE(m.outname)
  2215.       DELETE FILE (m.outname)
  2216.    ENDIF
  2217.  
  2218.    * Replace quote markers with quotes in the character fields
  2219.    REPLACE ALL fldcontent WITH STRTRAN(fldcontent,'\+','"'), ;
  2220.                frmcontent WITH STRTRAN(frmcontent,'\+','"'), ;
  2221.                picture    WITH STRTRAN(picture,   '\+','"')  ;
  2222.       FOR objtype = 17
  2223.    * Strip quotes from other object types, such as quoted strings.
  2224.    REPLACE ALL fldcontent WITH STRTRAN(fldcontent,'\+',''), ;
  2225.                frmcontent WITH STRTRAN(frmcontent,'\+',''), ;
  2226.                picture    WITH STRTRAN(picture,   '\+','')  ;
  2227.       FOR objtype <> 17
  2228.  
  2229. ELSE
  2230.    APPEND FROM (m.fname102) TYPE DELIMITED WITH TAB
  2231. ENDIF
  2232.  
  2233. * Create an empty 2.5 report file
  2234. DO docreate WITH "new", c_report
  2235.  
  2236. SELECT old
  2237. SCAN
  2238.    DO CASE
  2239.    CASE objtype = 1  && report record
  2240.       SELECT new
  2241.       APPEND BLANK
  2242.       SELECT old
  2243.       REPLACE new.platform WITH c_dosname
  2244.       REPLACE new.objtype WITH 1
  2245.       REPLACE new.objcode WITH c_25frx
  2246.       REPLACE new.topmargin WITH old.vertpos
  2247.       REPLACE new.botmargin WITH old.horzpos
  2248.       REPLACE new.height WITH old.height
  2249.       REPLACE new.width WITH old.width
  2250.       REPLACE new.offset WITH old.fontsize
  2251.       IF (old.initc > 0)
  2252.          REPLACE new.environ WITH .T.
  2253.       ENDIF
  2254.       IF (old.calcexp = 1 OR old.calcexp = 3)
  2255.          REPLACE new.ejectbefor WITH .T.
  2256.       ENDIF
  2257.       IF (old.calcexp = 2 OR old.calcexp = 3)
  2258.          REPLACE new.ejectafter WITH .T.
  2259.       ENDIF
  2260.  
  2261.    CASE objtype = 5  && text record
  2262.       SELECT new
  2263.       APPEND BLANK
  2264.       SELECT old
  2265.       REPLACE new.platform WITH c_dosname
  2266.       REPLACE new.objtype WITH 5
  2267.       REPLACE new.vpos WITH old.vertpos
  2268.       REPLACE new.hpos WITH old.horzpos
  2269.       REPLACE new.height WITH 1
  2270.       REPLACE new.width WITH old.width
  2271.       IF (old.rangelow > 0)
  2272.          REPLACE new.float WITH .T.
  2273.       ENDIF
  2274.       REPLACE new.expr WITH '"' + CPTRANS(m.g_tocodepage,m.g_fromcodepage,ALLTRIM(old.fldcontent)) + '"'
  2275.  
  2276.    CASE objtype = 7 && box record
  2277.       SELECT new
  2278.       APPEND BLANK
  2279.       SELECT old
  2280.       REPLACE new.platform WITH c_dosname
  2281.       REPLACE new.objtype WITH 7
  2282.       REPLACE new.vpos WITH old.vertpos
  2283.       REPLACE new.hpos WITH old.horzpos
  2284.       REPLACE new.height WITH old.height
  2285.       REPLACE new.width WITH old.width
  2286.       REPLACE new.objcode WITH old.content + 4
  2287.       IF (old.rangelow > 0)
  2288.          REPLACE new.float WITH .T.
  2289.       ENDIF
  2290.       IF (old.fontsize > 0)
  2291.          REPLACE new.boxchar WITH CHR(old.fontsize / 256)
  2292.       ENDIF
  2293.  
  2294.    CASE objtype = 17 && field record
  2295.       SELECT new
  2296.       APPEND BLANK
  2297.       SELECT old
  2298.       REPLACE new.platform WITH c_dosname
  2299.       REPLACE new.objtype WITH 8
  2300.       REPLACE new.vpos WITH old.vertpos
  2301.       REPLACE new.hpos WITH old.horzpos
  2302.       REPLACE new.height WITH 1
  2303.       REPLACE new.width WITH old.width
  2304.       REPLACE new.expr WITH CPTRANS(m.g_tocodepage,m.g_fromcodepage,TRIM(old.fldcontent))
  2305.       IF !EMPTY(old.picture)
  2306.          REPLACE new.picture WITH '"' + CPTRANS(m.g_tocodepage,m.g_fromcodepage,ALLTRIM(old.picture)) + '"'
  2307.       ENDIF
  2308.       REPLACE new.totaltype WITH old.valid
  2309.       REPLACE new.resettotal WITH old.initc
  2310.       IF (old.rangeup > 0)
  2311.          REPLACE new.norepeat WITH .T.
  2312.       ENDIF
  2313.  
  2314.       IF (old.rangelow > 1)
  2315.          WRAP = MAX(old.rangelow - 3, 0)
  2316.       ELSE
  2317.          WRAP = old.rangelow
  2318.       ENDIF
  2319.  
  2320.       IF (WRAP > 0)
  2321.          REPLACE new.stretch WITH .T.
  2322.       ENDIF
  2323.  
  2324.       IF (old.rangelow = 3 OR old.rangelow = 4)
  2325.          REPLACE new.float WITH .T.
  2326.       ENDIF
  2327.  
  2328.       REPLACE new.fillchar WITH ALLTRIM(old.frmcontent)
  2329.  
  2330.    CASE objtype = 18 && band record
  2331.       SELECT new
  2332.       APPEND BLANK
  2333.       SELECT old
  2334.       REPLACE new.platform WITH c_dosname
  2335.       REPLACE new.objtype WITH 9
  2336.       REPLACE new.objcode WITH old.content
  2337.       REPLACE new.expr WITH CPTRANS(m.g_tocodepage,m.g_fromcodepage,old.fldcontent)
  2338.       REPLACE new.height WITH old.height
  2339.       IF (old.vertpos > 0)
  2340.          REPLACE new.pagebreak WITH .T.
  2341.       ENDIF
  2342.       IF (old.fontsize > 0)
  2343.          REPLACE new.swapheader WITH .T.
  2344.       ENDIF
  2345.       IF (old.style > 0)
  2346.          REPLACE new.swapfooter WITH .T.
  2347.       ENDIF
  2348.    ENDCASE
  2349. ENDSCAN
  2350.  
  2351. * Discard the temporary cursor
  2352. SELECT old
  2353. USE
  2354.  
  2355. IF m.ftype = c_frx102repo
  2356.    * Back up the original report and copy the new information to the original file name
  2357.    m.bakname = forceext(m.fname102,"TBK")
  2358.    RENAME (m.fname102) TO (m.bakname)
  2359. ENDIF
  2360.  
  2361. * Write the new information on top of the original 1.02 report
  2362. SELECT new
  2363. COPY TO (m.fname102)
  2364. USE
  2365. SELECT (m.in_area)
  2366. RETURN m.fname102
  2367.  
  2368. *!*****************************************************************************
  2369. *!
  2370. *!      Procedure: CVRTFBPRPT
  2371. *!
  2372. *!      Called by: TRANSPRT.PRG
  2373. *!
  2374. *!          Calls: ERRORHANDLER       (procedure in TRANSPRT.PRG)
  2375. *!               : CVTSHORT()         (function  in TRANSPRT.PRG)
  2376. *!               : CVTBYTE()          (function  in TRANSPRT.PRG)
  2377. *!               : DOCREATE           (procedure in TRANSPRT.PRG)
  2378. *!               : EVALIMPORTEXPR     (procedure in TRANSPRT.PRG)
  2379. *!               : INITBANDS          (procedure in TRANSPRT.PRG)
  2380. *!               : BLDBREAKS          (procedure in TRANSPRT.PRG)
  2381. *!               : BLDDETAIL          (procedure in TRANSPRT.PRG)
  2382. *!               : FORCEEXT()         (function  in TRANSPRT.PRG)
  2383. *!
  2384. *!*****************************************************************************
  2385. PROCEDURE cvrtfbprpt
  2386. * Convert a FoxBASE+ report to FoxPro 2.5 DOS format
  2387. PARAMETER m.fnamefbp, m.ftype
  2388. PRIVATE m.bakname, m.in_area, m.i, m.idbyte, m.objname, m.obj, m.rp_pool, ;
  2389.    m.rp_ltadr, m.rp_ltlen, m.rp_ssexno, m.rp_sbexno, m.rp_doublesp, ;
  2390.    m.rp_flds_width, m.rp_flds_exprno, m.rp_width, m.rp_flds_headno, ;
  2391.    m.rp_plain, m.band_rows, m.current_row, m.group_num, m.head_row
  2392.  
  2393. m.in_area = SELECT()
  2394. SELECT 0
  2395.  
  2396. m.objname       = ""
  2397. m.obj           = 0
  2398. m.rp_pool       = 0
  2399. m.rp_ltadr      = 0
  2400. m.rp_ltlen      = 0
  2401. m.rp_ssexno     = 0
  2402. m.rp_sbexno     = 0
  2403. m.rp_doublesp   = 0
  2404. m.rp_flds_width = 0
  2405. m.rp_flds_exprno= 0
  2406. m.rp_width      = 0
  2407. m.rp_flds_headno= 0
  2408. m.rp_plain      = 0
  2409. m.band_rows     = 0
  2410. m.current_row   = 0
  2411. m.group_num     = 0
  2412. m.head_row      = 0
  2413.  
  2414. * Create a set of parallel arrays to contain the report information we need to bring
  2415. * across to FoxPro 2.5 DOS.
  2416. DIMENSION rp_ltlen(maxliterals)
  2417. DIMENSION rp_ltadr(maxliterals)
  2418. DIMENSION rp_flds_width(maxrepflds)
  2419. DIMENSION rp_flds_type(maxrepflds)
  2420. DIMENSION rp_flds_totals(maxrepflds)
  2421. DIMENSION rp_flds_dp(maxrepflds)
  2422. DIMENSION rp_flds_exprno(maxrepflds)
  2423. DIMENSION rp_flds_headno(maxrepflds)
  2424. DIMENSION band_rows(10)
  2425. band_rows = 0
  2426.  
  2427. m.obj = FOPEN(m.g_scrndbf)
  2428. IF (m.obj < 1)
  2429.    DO errorhandler WITH "Could not open FoxBASE+ report form",LINENO(),c_error3
  2430. ENDIF
  2431.  
  2432. m.idbyte = cvtshort(FREAD(m.obj,2),0)
  2433.  
  2434. poolsize = cvtshort(FREAD(m.obj,2),0)
  2435. FOR i = 1 TO maxliterals
  2436.    rp_ltlen(i) = cvtshort(FREAD(m.obj,2),0)
  2437. ENDFOR
  2438. FOR i = 1 TO maxliterals
  2439.    rp_ltadr(i) = cvtshort(FREAD(m.obj,2),0)
  2440. ENDFOR
  2441. rp_pool = FREAD(m.obj,litpoolsize)
  2442. FOR i = 1 TO maxrepflds
  2443.    rp_flds_width(i) = cvtshort(FREAD(m.obj,2),0)
  2444.    =FREAD(m.obj,2)
  2445.    rp_flds_type(i) = FREAD(m.obj,1)
  2446.    rp_flds_totals(i) = FREAD(m.obj,1)
  2447.    rp_flds_dp(i) = cvtshort(FREAD(m.obj,2),0)
  2448.    rp_flds_exprno(i) = cvtshort(FREAD(m.obj,2),0)
  2449.    rp_flds_headno(i) = cvtshort(FREAD(m.obj,2),0)
  2450. ENDFOR
  2451. rp_pghdno = cvtshort(FREAD(m.obj,2),0)
  2452. rp_sbexno = cvtshort(FREAD(m.obj,2),0)
  2453. rp_ssexno = cvtshort(FREAD(m.obj,2),0)
  2454. rp_sbhdno = cvtshort(FREAD(m.obj,2),0)
  2455. rp_sshdno = cvtshort(FREAD(m.obj,2),0)
  2456. rp_width = cvtshort(FREAD(m.obj,2),0)
  2457. rp_length = cvtshort(FREAD(m.obj,2),0)
  2458. rp_lmarg = cvtshort(FREAD(m.obj,2),0)
  2459. rp_rmarg = cvtshort(FREAD(m.obj,2),0)
  2460. rp_fldcnt = cvtshort(FREAD(m.obj,2),0)
  2461. rp_doublesp = FREAD(m.obj,1)
  2462. rp_summary = FREAD(m.obj, 1)
  2463. rp_subeject = FREAD(m.obj,1)
  2464. rp_other = cvtbyte(FREAD(m.obj,1),0)
  2465. rp_pageno = cvtshort(FREAD(m.obj,2),0)
  2466. =FCLOSE(m.obj)
  2467. IF (rp_pageno != 2)
  2468.    =FCLOSE(m.obj)
  2469. ENDIF
  2470.  
  2471. * Create an empty 2.5 report file
  2472. DO docreate WITH "new", c_report
  2473.  
  2474. * Fill it in
  2475. DO evalimportexpr
  2476. DO initbands
  2477. DO bldbreaks
  2478. IF rp_fldcnt > 0
  2479.    DO blddetail
  2480. ENDIF
  2481.  
  2482. * Add the header data
  2483. SELECT new
  2484. GOTO TOP
  2485. REPLACE objtype WITH 1, objcode WITH c_25frx
  2486.  
  2487. IF m.ftype = c_fbprptrepo
  2488.    * Back up the original report and copy the new information to the original file name
  2489.    m.bakname = forceext(m.fnamefbp,"TBK")
  2490.    RENAME (m.fnamefbp) TO (m.bakname)
  2491. ENDIF
  2492.  
  2493. * Write the new information to a file with an FRX extension but the
  2494. * same base name as the original FoxBASE+ report
  2495. SELECT new
  2496. COPY TO (m.fnamefbp)
  2497. USE
  2498. SELECT (m.in_area)
  2499. RETURN m.fnamefbp
  2500.  
  2501.  
  2502. *!********************************************************************
  2503. *!
  2504. *!        Convert FoxPro 1.0 label to 2.0 format
  2505. *!
  2506. *!********************************************************************
  2507.  
  2508. PROCEDURE cvrt102lbx
  2509. PARAMETERS m.fname102, m.ftype
  2510. PRIVATE m.i, m.short, m.contlen, m.obj, m.remarks, m.height, m.lmargin, m.width, ;
  2511.    m.numacross, m.spacesbet, m.linesbet, m.bakname, m.in_area
  2512.  
  2513. m.in_area = SELECT()
  2514.  
  2515. m.lblname = m.fname102
  2516.  
  2517. m.obj = FOPEN(m.lblname)
  2518. =FREAD(m.obj,1)                && Skip revision
  2519. m.remarks = FREAD(m.obj,60)
  2520. m.height = cvtshort(FREAD(m.obj,2),0)
  2521. m.lmargin = cvtshort(FREAD(m.obj,2),0)
  2522. m.width = cvtshort(FREAD(m.obj,2),0)
  2523. m.numacross = cvtshort(FREAD(m.obj,2),0)
  2524. m.spacesbet = cvtshort(FREAD(m.obj,2),0)
  2525. m.linesbet = cvtshort(FREAD(m.obj,2),0)
  2526.  
  2527. * Read in label contents -- each line ends in a CR
  2528.  
  2529. m.contlen = cvtshort(FREAD(m.obj,2),0)
  2530. m.work = FREAD(m.obj, m.contlen)
  2531. =FCLOSE(m.obj)
  2532.  
  2533. DIMENSION lbllines[m.height]
  2534. m.start = 1
  2535. m.i = 1
  2536. FOR m.curlen = 1 TO m.contlen
  2537.    IF (SUBSTR(m.work, m.curlen, 1) = CHR(13))
  2538.       lbllines[m.i] = SUBSTR(m.work, m.start, m.curlen-m.start)
  2539.       m.start = m.curlen+1
  2540.       m.i = m.i + 1
  2541.    ENDIF
  2542. ENDFOR
  2543.  
  2544. DO WHILE (m.i <= m.height)
  2545.    lbllines[m.i] = ''
  2546.    m.i = m.i + 1
  2547. ENDDO
  2548.  
  2549. * Create an empty 2.0 label
  2550. CREATE CURSOR new (objtype N(2), objcode N(2), ;
  2551.    name m, expr m, STYLE m, HEIGHT N(3), WIDTH N(3), lmargin N(3), ;
  2552.    numacross N(3), spacesbet N(3), linesbet N(3), ENVIRON l, ;
  2553.    ORDER m, UNIQUE l, TAG m, tag2 m, addalias l)
  2554.  
  2555. * Add the header data
  2556. SELECT new
  2557. APPEND BLANK
  2558. REPLACE new.objtype WITH 30
  2559. REPLACE new.name WITH CPTRANS(m.g_tocodepage,m.g_fromcodepage,m.remarks)
  2560.  
  2561. REPLACE new.height WITH m.height
  2562. REPLACE new.width WITH m.width
  2563. REPLACE new.lmargin WITH m.lmargin
  2564. REPLACE new.numacross WITH m.numacross
  2565. REPLACE new.spacesbet WITH m.spacesbet
  2566. REPLACE new.linesbet WITH m.linesbet
  2567.  
  2568. * Add the label contents
  2569.  
  2570. FOR m.i = 1 TO m.height
  2571.    APPEND BLANK
  2572.    REPLACE new.objtype WITH 19
  2573.    REPLACE new.expr WITH CPTRANS(m.g_tocodepage,m.g_fromcodepage,lbllines[m.i])
  2574. ENDFOR
  2575.  
  2576. IF m.ftype = c_lbx102repo
  2577.    * Back up the original label and copy the new information to the original file name
  2578.    m.bakname = forceext(m.fname102,"TBK")
  2579.    RENAME (m.fname102) TO (m.bakname)
  2580. ENDIF
  2581.  
  2582. * Write the new information on top of the original 1.02 label
  2583. SELECT new
  2584. COPY TO (m.fname102)
  2585. USE
  2586. SELECT (m.in_area)
  2587. RETURN m.fname102
  2588.  
  2589.  
  2590. RETURN
  2591.  
  2592. *!********************************************************************
  2593. *!
  2594. *!        Convert FoxBase+ label to 2.0 format
  2595. *!
  2596. *!********************************************************************
  2597.  
  2598. PROCEDURE cvrtfbplbl
  2599. PARAMETERS m.fnamefbp, m.ftype
  2600.  
  2601. PRIVATE m.width, m.height, m.lmargin, m.spacesbet, m.linesbet, m.numacross, m.obj, ;
  2602.    m.i, m.lblname, m.in_area, m.dummy
  2603.  
  2604. m.in_area = SELECT()
  2605.  
  2606. m.lblname = m.fnamefbp
  2607.  
  2608. m.width = 0
  2609. m.height = 0
  2610. m.lmargin = 0
  2611. m.spacesbet = 0
  2612. m.linesbet = 0
  2613. m.numacross = 0
  2614.  
  2615. m.obj = FOPEN(m.lblname)
  2616. =FREAD(m.obj,1)                && Skip revision
  2617. m.remarks = FREAD(m.obj,60)
  2618. m.height = cvtshort(FREAD(m.obj,2),0)
  2619. m.width = cvtshort(FREAD(m.obj,2),0)
  2620. m.lmargin = cvtshort(FREAD(m.obj,2),0)
  2621. m.linesbet = cvtshort(FREAD(m.obj,2),0)
  2622. m.spacesbet = cvtshort(FREAD(m.obj,2),0)
  2623. m.numacross = cvtshort(FREAD(m.obj,2),0)
  2624.  
  2625. *******************************************************
  2626. * Read the label contents -- strip spaces and add a CR
  2627. *******************************************************
  2628.  
  2629. DIMENSION lbllines[m.height]
  2630. lbllines = '""'
  2631. m.lastline = 0
  2632. FOR m.i = 1 TO m.height
  2633.    m.olen = 60
  2634.    m.work = FREAD(m.obj,m.olen)
  2635.    DO WHILE ((m.olen > 0) AND (SUBSTR(m.work, m.olen, 1) = ' '))
  2636.       m.olen = m.olen - 1
  2637.    ENDDO
  2638.    =STUFF(m.work, m.olen, 1, '\n')
  2639.    lbllines[m.i] = SUBSTR(m.work, 1, m.olen+1)
  2640.    IF EMPTY(lbllines[m.i])
  2641.       lbllines[m.i] = '""'
  2642.    ELSE
  2643.       m.lastline = m.i
  2644.    ENDIF
  2645. ENDFOR
  2646.  
  2647. =FCLOSE(m.obj)
  2648.  
  2649. CREATE CURSOR new (objtype N(2), objcode N(2), ;
  2650.    name m, expr m, STYLE m, HEIGHT N(3), WIDTH N(3), lmargin N(3), ;
  2651.    numacross N(3), spacesbet N(3), linesbet N(3), ENVIRON l, ;
  2652.   ORDER m, UNIQUE l, TAG m, tag2 m, addalias l)
  2653.  
  2654. * Add the header data
  2655. SELECT new
  2656. APPEND BLANK
  2657. REPLACE new.objtype WITH 30
  2658. REPLACE new.name WITH CPTRANS(m.g_tocodepage,m.g_fromcodepage,m.remarks)
  2659.  
  2660. REPLACE new.height WITH m.height
  2661. REPLACE new.width WITH m.width
  2662. REPLACE new.lmargin WITH m.lmargin
  2663. REPLACE new.numacross WITH m.numacross
  2664. REPLACE new.spacesbet WITH m.spacesbet
  2665. REPLACE new.linesbet WITH m.linesbet
  2666.  
  2667. FOR m.i = 1 TO m.lastline
  2668.    APPEND BLANK
  2669.    REPLACE new.objtype WITH 19
  2670.    REPLACE new.expr WITH CPTRANS(m.g_tocodepage,m.g_fromcodepage,lbllines[m.i])
  2671. ENDFOR
  2672.  
  2673. IF m.ftype = c_fbprptrepo
  2674.    * Back up the original report and copy the new information to the original file name
  2675.    m.bakname = forceext(m.fnamefbp,"TBK")
  2676.    RENAME (m.fnamefbp) TO (m.bakname)
  2677. ENDIF
  2678.  
  2679. * Write the new information to a file with an LBX extension but the
  2680. * same base name as the original FoxBASE+ label.
  2681. SELECT new
  2682. COPY TO (m.fnamefbp)
  2683. USE
  2684. SELECT (m.in_area)
  2685. RETURN m.fnamefbp
  2686.  
  2687. *!*****************************************************************************
  2688. *!
  2689. *!      Procedure: INITBANDS
  2690. *!
  2691. *!      Called by: cvrtfbpRPT      (procedure in TRANSPRT.PRG)
  2692. *!
  2693. *!          Calls: GETLITEXPR()       (function  in TRANSPRT.PRG)
  2694. *!               : LINESFORHEADING()  (function  in TRANSPRT.PRG)
  2695. *!               : FLD_HEAD_EXIST()   (function  in TRANSPRT.PRG)
  2696. *!               : HOWMANYHEADINGS()  (function  in TRANSPRT.PRG)
  2697. *!               : MAKEBAND           (procedure in TRANSPRT.PRG)
  2698. *!               : TOTALS_EXIST()     (function  in TRANSPRT.PRG)
  2699. *!               : MAKETEXT           (procedure in TRANSPRT.PRG)
  2700. *!               : MAKEFIELD          (procedure in TRANSPRT.PRG)
  2701. *!               : GETHEADING()       (function  in TRANSPRT.PRG)
  2702. *!               : CENTER_COL()       (function  in TRANSPRT.PRG)
  2703. *!
  2704. *!*****************************************************************************
  2705. PROCEDURE initbands
  2706.  
  2707. APPEND BLANK
  2708. REPLACE new->platform WITH c_dosname
  2709. REPLACE new->WIDTH WITH m.rp_width
  2710. REPLACE new->HEIGHT WITH m.rp_length
  2711. REPLACE new->offset WITH m.rp_lmarg
  2712. REPLACE new->ejectbefor WITH .T.
  2713. m.rp_plain = 0
  2714. m.group_num = 0
  2715. IF ("Y" = m.rp_summary)
  2716.    REPLACE new->SUMMARY WITH .T.
  2717. ENDIF
  2718. IF (INLIST(m.rp_other,1,3,5,7))
  2719.    REPLACE new->ejectbefor WITH .F.
  2720. ENDIF
  2721. IF (INLIST(m.rp_other,3,6,7))
  2722.    REPLACE new->ejectafter WITH .T.
  2723. ENDIF
  2724. IF (INLIST(m.rp_other,4,5,6,7))
  2725.    REPLACE new->PLAIN WITH .T.
  2726.    m.rp_plain = 1
  2727. ENDIF
  2728. m.rp_totals = 0
  2729. m.current_row = 0
  2730.  
  2731. * header band
  2732.  
  2733. m.bandsize = 1
  2734. IF (m.rp_plain = 0)
  2735.    m.bandsize = m.bandsize + 2
  2736. ENDIF
  2737.  
  2738. m.string = ""
  2739. IF (getlitexpr(m.rp_pghdno, @m.string) <> 0)
  2740.    m.size = linesforheading(m.string)
  2741.    m.bandsize = m.bandsize + m.size
  2742. ENDIF
  2743.  
  2744. IF (fld_head_exist() = 1)
  2745.    m.size = howmanyheadings()
  2746.    m.bandsize = m.bandsize + m.size + 3
  2747. ELSE
  2748.    m.bandsize = m.bandsize + 3
  2749. ENDIF
  2750.  
  2751. DO makeband WITH h_page, m.bandsize, "", .F.
  2752.  
  2753. * group bands
  2754. m.bandstring = ""
  2755. IF (getlitexpr(m.rp_sbexno, @m.bandstring) <> 0)
  2756.    IF ("Y" = m.rp_subeject)
  2757.       m.newpage = .T.
  2758.    ELSE
  2759.       m.newpage = .F.
  2760.    ENDIF
  2761.    DO makeband WITH h_break, 2, m.bandstring, m.newpage
  2762.    m.rp_totals = m.rp_totals + 1
  2763.    IF (getlitexpr(m.rp_ssexno, @m.bandstring) <> 0)
  2764.       DO makeband WITH h_break, 2, m.bandstring, .F.
  2765.       m.rp_totals = m.rp_totals + 1
  2766.    ENDIF
  2767. ENDIF
  2768.  
  2769. group_num = rp_totals
  2770. m.numlines = 1
  2771. IF ("Y" = m.rp_doublesp)
  2772.    m.numlines = 2
  2773. ENDIF
  2774.  
  2775. * detail band
  2776. DO makeband WITH l_item, m.numlines, "", .F.
  2777.  
  2778. * break footer bands
  2779. IF (totals_exist() = 1)
  2780.    m.bandsize = 2
  2781. ELSE
  2782.    m.bandsize = 1
  2783. ENDIF
  2784.  
  2785. m.groupnum = m.rp_totals
  2786.  
  2787. FOR i = 1 TO m.rp_totals
  2788.    DO makeband WITH f_break, m.bandsize, "", .F.
  2789. ENDFOR
  2790.  
  2791. * page footer band
  2792. DO makeband WITH f_page, 1, "", .F.
  2793.  
  2794. * report footer band
  2795. DO makeband WITH f_rpt, m.bandsize, "", .F.
  2796.  
  2797. IF (rp_plain = 0)
  2798.    DO maketext WITH 9, 1, "PAGE NO. ", band_rows(h_page)+1, 0
  2799.    DO makefield WITH 5, 1, "_PAGENO", band_rows(h_page)+1, 9, "C", .F., .F., 0, 0
  2800.    DO makefield WITH 8, 1, "DATE()", band_rows(h_page)+2, 0, "D", .F., .F., 0, 0
  2801.    m.head_row = 3
  2802. ELSE
  2803.    m.head_row = 0
  2804. ENDIF
  2805.  
  2806. IF (getlitexpr(m.rp_pghdno,@m.string) <> 0)
  2807.    m.string = m.string + ";"
  2808.    m.heading = ""
  2809.    DO WHILE .T.
  2810.       IF (getheading(@m.heading, @m.string) > 0)
  2811.          DO maketext WITH LEN(m.heading), 1, m.heading, m.head_row, center_col(LEN(m.heading))
  2812.          m.head_row = m.head_row + 1
  2813.       ELSE
  2814.          EXIT
  2815.       ENDIF
  2816.    ENDDO
  2817. ENDIF
  2818.  
  2819. m.head_row = m.head_row + 1
  2820.  
  2821. RETURN
  2822.  
  2823. *!*****************************************************************************
  2824. *!
  2825. *!      Procedure: BLDBREAKEXP
  2826. *!
  2827. *!      Called by: BLDBREAKS          (procedure in TRANSPRT.PRG)
  2828. *!
  2829. *!          Calls: GETLITEXPR()       (function  in TRANSPRT.PRG)
  2830. *!               : MAKETEXT           (procedure in TRANSPRT.PRG)
  2831. *!               : MAKEFIELD          (procedure in TRANSPRT.PRG)
  2832. *!
  2833. *!*****************************************************************************
  2834. PROCEDURE bldbreakexp
  2835. PARAMETER m.exprno, m.headno, m.row, m.stars
  2836.  
  2837. PRIVATE m.string
  2838. m.string = ""
  2839. =getlitexpr(m.headno, @m.string)
  2840. m.string = m.stars + m.string
  2841. strlen = LEN(m.string)
  2842. DO maketext WITH m.strlen, 1, m.string, m.row, 0
  2843. =getlitexpr(m.exprno, @m.string)
  2844. DO makefield WITH rp_ltlen(m.exprno+1), 1, m.string, m.row, m.strlen + 1, "C", .F., .F., 0, 0
  2845. RETURN
  2846.  
  2847. *!*****************************************************************************
  2848. *!
  2849. *!      Procedure: BLDBREAKS
  2850. *!
  2851. *!      Called by: cvrtfbpRPT      (procedure in TRANSPRT.PRG)
  2852. *!
  2853. *!          Calls: LITEXIST()         (function  in TRANSPRT.PRG)
  2854. *!               : BLDBREAKEXP        (procedure in TRANSPRT.PRG)
  2855. *!
  2856. *!*****************************************************************************
  2857. PROCEDURE bldbreaks
  2858. IF (litexist(rp_sbexno) = 1)
  2859.    DO bldbreakexp WITH rp_sbexno, rp_sbhdno, band_rows(h_break) + 1, "** "
  2860.    IF (litexist(rp_ssexno) = 1)
  2861.       DO bldbreakexp WITH rp_ssexno, rp_sshdno, band_rows(h_break) + 3, "*"
  2862.    ENDIF
  2863. ENDIF
  2864. RETURN
  2865.  
  2866. *!*****************************************************************************
  2867. *!
  2868. *!      Procedure: BLDDETAIL
  2869. *!
  2870. *!      Called by: cvrtfbpRPT      (procedure in TRANSPRT.PRG)
  2871. *!
  2872. *!          Calls: GETLITEXPR()       (function  in TRANSPRT.PRG)
  2873. *!               : MAKEFIELD          (procedure in TRANSPRT.PRG)
  2874. *!               : ADDTOTAL           (procedure in TRANSPRT.PRG)
  2875. *!               : GETHEADING()       (function  in TRANSPRT.PRG)
  2876. *!               : MAKETEXT           (procedure in TRANSPRT.PRG)
  2877. *!
  2878. *!*****************************************************************************
  2879. PROCEDURE blddetail
  2880. PRIVATE m.i, m.pg_row, m.istotal, m.fcol, m.row, m.string, m.col, m.heading
  2881.  
  2882. m.pg_row = 0
  2883. m.istotal = 0
  2884. m.fcol = 0
  2885. m.row = band_rows(l_item)
  2886. m.string = ""
  2887. FOR m.i = 1 TO rp_fldcnt
  2888.    IF (getlitexpr(rp_flds_exprno(m.i), @m.string) <> 0)
  2889.       m.row = band_rows(l_item)
  2890.       IF (m.fcol + rp_flds_width(m.i) > m.rp_width - 1)
  2891.          rp_flds_width(m.i) = rp_flds_width(m.i) - (m.fcol + rp_flds_width(m.i) - m.rp_width)
  2892.          IF (rp_flds_width(m.i) < 0)
  2893.             EXIT
  2894.          ENDIF
  2895.       ENDIF
  2896.       DO makefield WITH rp_flds_width(m.i), 1, m.string, m.row, m.fcol, rp_flds_type(m.i), .T., .T., 0, 0
  2897.       IF ("Y" = rp_flds_totals(m.i))
  2898.          DO makefield WITH rp_flds_width(m.i), 1, m.string, band_rows(f_rpt) + 1, m.fcol, "N", .F., .F., 2, 0
  2899.          IF (m.group_num > 0)
  2900.             IF (m.group_num > 1)
  2901.                DO addtotal WITH m.istotal, band_rows(f_break), m.fcol, rp_flds_width(m.i), m.string, "* Subsubtotal *", 4
  2902.                DO addtotal WITH m.istotal, band_rows(f_break) + 2, m.fcol, rp_flds_width(m.i), m.string, "** Subtotal **", 3
  2903.             ELSE
  2904.                DO addtotal WITH m.istotal, band_rows(f_break), m.fcol, rp_flds_width(m.i), m.string, "** Subtotal **", 3
  2905.             ENDIF
  2906.          ENDIF
  2907.          m.istotal = 1
  2908.       ENDIF
  2909.    ENDIF
  2910.  
  2911.    IF (getlitexpr(rp_flds_headno(m.i), @m.string) <> 0)
  2912.       m.string = m.string + ";"
  2913.       m.heading = ""
  2914.       m.hrow = m.head_row
  2915.       DO WHILE .T.
  2916.          IF (getheading(@m.heading, @m.string) > 0)
  2917.             IF (rp_flds_type(m.i) = "N")
  2918.                m.col = (m.fcol + rp_flds_width(m.i)) - LEN(m.heading)
  2919.             ELSE
  2920.                m.col = m.fcol
  2921.             ENDIF
  2922.             DO maketext WITH LEN(m.heading), 1, m.heading, m.hrow, m.col
  2923.             m.hrow = m.hrow + 1
  2924.          ELSE
  2925.             EXIT
  2926.          ENDIF
  2927.       ENDDO
  2928.    ENDIF
  2929.    m.fcol = m.fcol + rp_flds_width(m.i) + 1
  2930. ENDFOR
  2931.  
  2932. IF (m.istotal = 1)
  2933.    DO maketext WITH 13, 1, "*** Total ***", band_rows(f_rpt), 0
  2934. ENDIF
  2935.  
  2936. RETURN
  2937.  
  2938. *!*****************************************************************************
  2939. *!
  2940. *!      Procedure: ADDTOTAL
  2941. *!
  2942. *!      Called by: BLDDETAIL          (procedure in TRANSPRT.PRG)
  2943. *!
  2944. *!          Calls: MAKETEXT           (procedure in TRANSPRT.PRG)
  2945. *!               : MAKEFIELD          (procedure in TRANSPRT.PRG)
  2946. *!
  2947. *!*****************************************************************************
  2948. PROCEDURE addtotal
  2949. PARAMETER m.isfirst, m.row, m.col, m.wt, m.workstr, m.totalstr, m.reset
  2950. IF (m.isfirst = 0)
  2951.    DO maketext WITH LEN(m.totalstr), 1, m.totalstr, m.row, 0
  2952. ENDIF
  2953. DO makefield WITH m.wt, 1, m.workstr, m.row+1, m.col, "N", .F., .F., 2, m.reset
  2954. RETURN
  2955.  
  2956.  
  2957. *!*****************************************************************************
  2958. *!
  2959. *!       Function: LITEXIST
  2960. *!
  2961. *!      Called by: BLDBREAKS          (procedure in TRANSPRT.PRG)
  2962. *!               : GETLITEXPR()       (function  in TRANSPRT.PRG)
  2963. *!               : FLD_HEAD_EXIST()   (function  in TRANSPRT.PRG)
  2964. *!
  2965. *!*****************************************************************************
  2966. FUNCTION litexist
  2967. PARAMETER m.idx
  2968. PRIVATE m.flag
  2969. m.flag = 0
  2970. IF m.idx != 65535
  2971.    IF "" <> SUBSTR(rp_pool, rp_ltadr(m.idx+1)+1, 1)
  2972.       m.flag = 1
  2973.    ENDIF
  2974. ENDIF
  2975. RETURN m.flag
  2976.  
  2977. *!*****************************************************************************
  2978. *!
  2979. *!       Function: GETLITEXPR
  2980. *!
  2981. *!      Called by: INITBANDS          (procedure in TRANSPRT.PRG)
  2982. *!               : BLDBREAKEXP        (procedure in TRANSPRT.PRG)
  2983. *!               : BLDDETAIL          (procedure in TRANSPRT.PRG)
  2984. *!               : HOWMANYHEADINGS()  (function  in TRANSPRT.PRG)
  2985. *!               : EVALIMPORTEXPR     (procedure in TRANSPRT.PRG)
  2986. *!
  2987. *!          Calls: LITEXIST()         (function  in TRANSPRT.PRG)
  2988. *!
  2989. *!*****************************************************************************
  2990. FUNCTION getlitexpr
  2991. PARAMETER m.idx, m.string
  2992. m.flag = 0
  2993. IF (litexist(m.idx) = 1)
  2994.    m.string = SUBSTR(m.rp_pool, rp_ltadr(m.idx+1)+1, rp_ltlen(m.idx+1) - 1)
  2995.    m.flag = 1
  2996. ELSE
  2997.    m.string = ""
  2998. ENDIF
  2999. RETURN m.flag
  3000.  
  3001. *!*****************************************************************************
  3002. *!
  3003. *!      Procedure: MAKEBAND
  3004. *!
  3005. *!      Called by: INITBANDS          (procedure in TRANSPRT.PRG)
  3006. *!
  3007. *!*****************************************************************************
  3008. PROCEDURE makeband
  3009. PARAMETER m.type, m.size, m.string, m.newpage
  3010. APPEND BLANK
  3011. REPLACE new->platform WITH c_dosname
  3012. REPLACE new->objtype WITH 9
  3013. REPLACE new->objcode WITH m.type
  3014. REPLACE new->expr WITH CPTRANS(m.g_tocodepage,m.g_fromcodepage,m.string)
  3015. REPLACE new->HEIGHT WITH m.size
  3016. REPLACE new->pagebreak WITH m.newpage
  3017. IF (band_rows(m.type) = 0)
  3018.    band_rows(m.type) = m.current_row
  3019. ENDIF
  3020. m.current_row = m.current_row + m.size
  3021. RETURN
  3022.  
  3023. *!*****************************************************************************
  3024. *!
  3025. *!      Procedure: MAKETEXT
  3026. *!
  3027. *!      Called by: INITBANDS          (procedure in TRANSPRT.PRG)
  3028. *!               : BLDBREAKEXP        (procedure in TRANSPRT.PRG)
  3029. *!               : BLDDETAIL          (procedure in TRANSPRT.PRG)
  3030. *!               : ADDTOTAL           (procedure in TRANSPRT.PRG)
  3031. *!
  3032. *!*****************************************************************************
  3033. PROCEDURE maketext
  3034. PARAMETER  wt, ht, string, ROW, COL
  3035. IF m.wt > 0
  3036.    APPEND BLANK
  3037.    REPLACE new->platform WITH c_dosname
  3038.    REPLACE new->expr WITH '"' + CPTRANS(m.g_tocodepage,m.g_fromcodepage,m.string) + '"'
  3039.    REPLACE new->objtype WITH 5
  3040.    REPLACE new->height WITH ht
  3041.    REPLACE new->WIDTH WITH wt
  3042.    REPLACE new->vpos WITH ROW
  3043.    REPLACE new->hpos WITH COL
  3044. ENDIF
  3045. RETURN
  3046.  
  3047. *!*****************************************************************************
  3048. *!
  3049. *!      Procedure: MAKEFIELD
  3050. *!
  3051. *!      Called by: INITBANDS          (procedure in TRANSPRT.PRG)
  3052. *!               : BLDBREAKEXP        (procedure in TRANSPRT.PRG)
  3053. *!               : BLDDETAIL          (procedure in TRANSPRT.PRG)
  3054. *!               : ADDTOTAL           (procedure in TRANSPRT.PRG)
  3055. *!
  3056. *!*****************************************************************************
  3057. PROCEDURE makefield
  3058. PARAMETER m.wt, m.ht, m.string, m.row, m.col, m.fldchar, m.strch, m.flt, m.total, m.reset
  3059.  
  3060. APPEND BLANK
  3061. REPLACE new->platform WITH c_dosname
  3062. REPLACE new->objtype WITH 8
  3063. REPLACE new->expr WITH CPTRANS(m.g_tocodepage,m.g_fromcodepage,m.string)
  3064. REPLACE new->height WITH m.ht
  3065. REPLACE new->WIDTH WITH m.wt
  3066. REPLACE new->vpos WITH m.row
  3067. REPLACE new->hpos WITH m.col
  3068. REPLACE new->fillchar WITH m.fldchar
  3069. REPLACE new->STRETCH WITH m.strch
  3070. REPLACE new->FLOAT WITH m.flt
  3071. REPLACE new->totaltype WITH m.total
  3072. REPLACE new->resettotal WITH m.reset
  3073. RETURN
  3074.  
  3075. *!*****************************************************************************
  3076. *!
  3077. *!       Function: GETHEADING
  3078. *!
  3079. *!      Called by: INITBANDS          (procedure in TRANSPRT.PRG)
  3080. *!               : BLDDETAIL          (procedure in TRANSPRT.PRG)
  3081. *!               : LINESFORHEADING()  (function  in TRANSPRT.PRG)
  3082. *!
  3083. *!*****************************************************************************
  3084. FUNCTION getheading
  3085. PARAMETER m.heading, m.string
  3086. PRIVATE m.flag, m.x, m.heading
  3087. m.flag = 0
  3088. m.x = AT(';',m.string)
  3089. m.heading = SUBSTR(m.string, 1, m.x-1)
  3090. m.string = SUBSTR(m.string, m.x+1)
  3091. IF (LEN(m.string) > 0)   && more left
  3092.    m.flag = 1
  3093. ENDIF
  3094. IF (LEN(m.heading) > 0)
  3095.    m.flag = 1
  3096. ENDIF
  3097. RETURN m.flag
  3098.  
  3099. *!*****************************************************************************
  3100. *!
  3101. *!       Function: LINESFORHEADING
  3102. *!
  3103. *!      Called by: INITBANDS          (procedure in TRANSPRT.PRG)
  3104. *!               : HOWMANYHEADINGS()  (function  in TRANSPRT.PRG)
  3105. *!
  3106. *!          Calls: GETHEADING()       (function  in TRANSPRT.PRG)
  3107. *!
  3108. *!*****************************************************************************
  3109. FUNCTION linesforheading
  3110. PARAMETER m.string
  3111. PRIVATE m.retval, m.string2, m.heading
  3112. m.string2 = m.string + ";"
  3113. m.heading = ""
  3114. m.retval = 0
  3115. DO WHILE .T.
  3116.    IF (getheading(@m.heading, @m.string2) > 0)
  3117.       m.retval = m.retval + 1
  3118.    ELSE
  3119.       EXIT
  3120.    ENDIF
  3121. ENDDO
  3122. RETURN m.retval
  3123.  
  3124. *!*****************************************************************************
  3125. *!
  3126. *!       Function: HOWMANYHEADINGS
  3127. *!
  3128. *!      Called by: INITBANDS          (procedure in TRANSPRT.PRG)
  3129. *!
  3130. *!          Calls: GETLITEXPR()       (function  in TRANSPRT.PRG)
  3131. *!               : LINESFORHEADING()  (function  in TRANSPRT.PRG)
  3132. *!
  3133. *!*****************************************************************************
  3134. FUNCTION howmanyheadings
  3135. PRIVATE m.retval, m.i, m.newval
  3136. m.retval = 0
  3137. FOR m.i = 1 TO m.rp_fldcnt
  3138.    IF (getlitexpr(rp_flds_headno, @m.string) <> 0)
  3139.       m.newval = linesforheading(m.string)
  3140.       m.retval = MAX(m.newval, m.retval)
  3141.    ENDIF
  3142. ENDFOR
  3143. RETURN m.retval
  3144.  
  3145. *!*****************************************************************************
  3146. *!
  3147. *!       Function: FLD_HEAD_EXIST
  3148. *!
  3149. *!      Called by: INITBANDS          (procedure in TRANSPRT.PRG)
  3150. *!
  3151. *!          Calls: LITEXIST()         (function  in TRANSPRT.PRG)
  3152. *!
  3153. *!*****************************************************************************
  3154. FUNCTION fld_head_exist
  3155. PRIVATE m.flag, m.i
  3156. m.flag = 0
  3157. FOR m.i = 1 TO m.rp_fldcnt
  3158.    IF (litexist(rp_flds_headno(m.i)) = 1)
  3159.       m.flag = 1
  3160.       EXIT
  3161.    ENDIF
  3162. ENDFOR
  3163. RETURN m.flag
  3164.  
  3165. *!*****************************************************************************
  3166. *!
  3167. *!       Function: TOTALS_EXIST
  3168. *!
  3169. *!      Called by: INITBANDS          (procedure in TRANSPRT.PRG)
  3170. *!
  3171. *!*****************************************************************************
  3172. FUNCTION totals_exist
  3173. PRIVATE m.flag, m.i
  3174. m.flag = 0
  3175. FOR m.i = 1 TO m.rp_fldcnt
  3176.    IF ("Y" = rp_flds_totals(m.i))
  3177.       m.flag = 1
  3178.       EXIT
  3179.    ENDIF
  3180. ENDFOR
  3181. RETURN m.flag
  3182.  
  3183. *!*****************************************************************************
  3184. *!
  3185. *!       Function: CENTER_COL
  3186. *!
  3187. *!      Called by: INITBANDS          (procedure in TRANSPRT.PRG)
  3188. *!
  3189. *!*****************************************************************************
  3190. FUNCTION center_col
  3191. PARAMETER m.length
  3192. RETURN (MAX(0, ((m.rp_width - m.rp_lmarg - m.rp_rmarg) - m.length)/2))
  3193.  
  3194. *!*****************************************************************************
  3195. *!
  3196. *!      Procedure: EVALIMPORTEXPR
  3197. *!
  3198. *!      Called by: cvrtfbpRPT      (procedure in TRANSPRT.PRG)
  3199. *!
  3200. *!          Calls: GETLITEXPR()       (function  in TRANSPRT.PRG)
  3201. *!
  3202. *!*****************************************************************************
  3203. PROCEDURE evalimportexpr
  3204. PRIVATE string
  3205. m.string = ""
  3206. FOR i = 1 TO rp_fldcnt
  3207.    IF (getlitexpr(rp_flds_exprno(i), @string) <> 0)
  3208.       rp_flds_type(i) = TYPE(m.string)
  3209.       IF ("U" = rp_flds_type(i))
  3210.          rp_flds_type = "C"
  3211.       ENDIF
  3212.    ENDIF
  3213. ENDFOR
  3214. RETURN
  3215.  
  3216. *!*****************************************************************************
  3217. *!
  3218. *!       Function: GETOLDREPORTTYPE
  3219. *!
  3220. *!      Called by: TRANSPRT.PRG
  3221. *!
  3222. *!          Calls: CVTSHORT()         (function  in TRANSPRT.PRG)
  3223. *!
  3224. *!*****************************************************************************
  3225. FUNCTION getoldreporttype
  3226. * Open the main file and see what kind of file it is.  At this point, all we know
  3227. * is that it is either a FoxPro 1.02 report or a FoxBASE+ report, or possibly
  3228. * a report from some other product.
  3229.  
  3230. PRIVATE m.fp, m.reptotals, m.retcode, m.tag
  3231. m.retcode = m.tp_filetype
  3232.  
  3233. m.fp = FOPEN(m.g_scrndbf)
  3234. IF fp > 0
  3235.    m.reptotals = cvtshort(FREAD(m.fp,2),0)
  3236.    DO CASE
  3237.    CASE (m.reptotals == 2)   && FoxBASE+ report
  3238.       DO CASE
  3239.       CASE m.tp_filetype = c_frx102modi
  3240.          m.retcode= c_fbprptmodi
  3241.       CASE m.tp_filetype = c_frx102repo
  3242.          m.retcode = c_fbprptrepo
  3243.       OTHERWISE
  3244.          m.retcode = c_fbprptrepo
  3245.       ENDCASE
  3246.    OTHERWISE
  3247.         * Check for alien report
  3248.         =FSEEK(m.fp,0)
  3249.         m.tag = FREAD(m.fp,8)
  3250.         IF UPPER(m.tag) == "DBASE IV"
  3251.             m.retcode = c_db4type
  3252.         ELSE
  3253.           m.retcode = m.tp_filetype
  3254.         ENDIF
  3255.    ENDCASE
  3256.    =FCLOSE(m.fp)
  3257. ENDIF
  3258. RETURN m.retcode
  3259.  
  3260. *!*****************************************************************************
  3261. *!
  3262. *!       Function: GETOLDLABELTYPE
  3263. *!
  3264. *!      Called by: TRANSPRT.PRG
  3265. *!
  3266. *!          Calls: CVTSHORT()         (function  in TRANSPRT.PRG)
  3267. *!
  3268. *!*****************************************************************************
  3269. FUNCTION getoldlabeltype
  3270. * Open the main file and see what kind of file it is.  At this point, all we know
  3271. * is that it is either a FoxPro 1.02 report or a FoxBASE+ label.
  3272.  
  3273. PRIVATE m.fp, m.reptotals, m.retcode
  3274. m.retcode = m.tp_filetype
  3275.  
  3276. m.fp = FOPEN(m.g_scrndbf)
  3277. IF fp > 0
  3278.    m.reptotals = cvtbyte(FREAD(m.fp,1),0)
  3279.    m.dummy     = FREAD(m.fp,1)   && skip this one
  3280.    DO CASE
  3281.    CASE (m.reptotals == 2)   && FoxBASE+ label
  3282.       DO CASE
  3283.       CASE m.tp_filetype = c_lbx102modi
  3284.          m.retcode= c_fbplblmodi
  3285.       CASE m.tp_filetype = c_lbx102repo
  3286.          m.retcode = c_fbplblrepo
  3287.       OTHERWISE
  3288.          m.retcode = c_fbplblrepo
  3289.       ENDCASE
  3290.    OTHERWISE
  3291.         * Check for alien report
  3292.         =FSEEK(m.fp,0)
  3293.         m.tag = FREAD(m.fp,8)
  3294.         IF UPPER(m.tag) == "DBASE IV"
  3295.             m.retcode = c_db4type
  3296.         ELSE
  3297.           m.retcode = m.tp_filetype
  3298.         ENDIF
  3299.    ENDCASE
  3300.    =FCLOSE(m.fp)
  3301. ENDIF
  3302. RETURN m.retcode
  3303.  
  3304. *
  3305. * MAPBUTTON - Compare two sets of buttons
  3306. *
  3307. *!*****************************************************************************
  3308. *!
  3309. *!       Function: MAPBUTTON
  3310. *!
  3311. *!      Called by: UPDATESCREEN       (procedure in TRANSPRT.PRG)
  3312. *!
  3313. *!          Calls: SCATTERBUTTONS     (procedure in TRANSPRT.PRG)
  3314. *!
  3315. *!*****************************************************************************
  3316. FUNCTION mapbutton
  3317. PARAMETER frombtn, tobtn
  3318. PRIVATE m.endpos, m.outstrg, m.topos, m.i. m.pictclau
  3319. m.pictclau = LEFT(m.tobtn,AT(' ',m.tobtn)-1)
  3320. DO CASE
  3321. CASE m.g_grph2char
  3322.    * Strip out the BMP extensions, if present
  3323.    m.frombtn = STRTRAN(m.frombtn,".BMP","")
  3324.    m.frombtn = STRTRAN(m.frombtn,".bmp","")
  3325.  
  3326. CASE ".BMP" $ UPPER(m.tobtn)
  3327.    * Add back in the bitmap extensions, if the to platform already has some.  The
  3328.    * strategy is to mark all existing bitmap extensions, then add one to each of the
  3329.    * atoms in the picture clause.
  3330.    DO CASE
  3331.    CASE RIGHT(m.tobtn,1) = '"' OR RIGHT(m.tobtn,1) = "'"
  3332.       m.tobtn = STUFF(m.tobtn,LEN(m.tobtn),0,';')
  3333.    OTHERWISE
  3334.       m.tobtn = m.tobtn + ';'
  3335.    ENDCASE
  3336.  
  3337.    * 'brlfq' is just a marker for where a semicolon needs to go.  Mark all the existing
  3338.    * BMP extensions.
  3339.    m.tobtn = STRTRAN(m.tobtn,".BMP;",".BMPbrlfq")
  3340.    m.tobtn = STRTRAN(m.tobtn,".bmp;",".BMPbrlfq")
  3341.  
  3342.    * Add a new BMP extension where there wasn't one before.
  3343.    m.tobtn = STRTRAN(m.tobtn,";",".BMPbrlfq")
  3344.  
  3345.    * Put the semicolons back
  3346.    m.tobtn = STRTRAN(m.tobtn,"brlfq",";")
  3347.  
  3348.    * Remove trailing semicolons
  3349.    DO WHILE RIGHT(m.tobtn,2) = ';"' OR RIGHT(m.tobtn,2) = ";'"
  3350.       m.tobtn = STUFF(m.tobtn,LEN(m.tobtn)-1,1,"")
  3351.    ENDDO
  3352.  
  3353.    * Now make sure there is a 'B' in the picture clause
  3354.    IF !("B" $ m.pictclau) AND ("@" $ m.pictclau)
  3355.       m.tobtn = STUFF(m.tobtn,AT("@",m.tobtn)+2,0,"B")
  3356.       m.pictclau = m.pictclau + "B"
  3357.    ENDIF
  3358. ENDCASE
  3359.  
  3360. DO CASE
  3361. CASE m.frombtn == m.tobtn
  3362.    RETURN m.frombtn
  3363. CASE OCCURS(';',m.frombtn) = OCCURS(';',m.tobtn)
  3364.    IF m.g_char2grph AND ("B" $ m.pictclau)
  3365.       * Return the newly modified "to" string in this case.
  3366.       RETURN m.tobtn
  3367.    ELSE
  3368.       RETURN m.frombtn
  3369.    ENDIF
  3370. CASE OCCURS(';',m.frombtn) > OCCURS(';',m.tobtn)
  3371.    * Are these bitmap buttons?
  3372.    IF ("B" $ m.pictclau)
  3373.       * Just add a blank one to the end
  3374.       m.endpos = RAT('"',m.tobtn)
  3375.       IF endpos > 1
  3376.          RETURN STUFF(m.tobtn,m.endpos,0,';NEW.BMP')
  3377.       ELSE
  3378.          RETURN m.tobtn + ';'
  3379.       ENDIF
  3380.    ELSE
  3381.       * Not bitmaps.
  3382.       RETURN m.frombtn
  3383.    ENDIF
  3384. OTHERWISE
  3385.    RETURN m.frombtn
  3386.  
  3387.    * An alternative strategy is to try to preserve as many as possible of the
  3388.    * destination buttons, especially since they might contain bitmaps, etc.
  3389.  
  3390.    * Populate two arrays with the button prompts.  Then scan through the
  3391.    * 'from' array seeing if we can match it up against something in the 'to'
  3392.    * array.  If so, emit the 'to' array picture.  Otherwise, emit the 'from'
  3393.    * one.
  3394.    DIMENSION fromarray[1], toarray[1]
  3395.    DO scatterbuttons WITH m.frombtn, fromarray
  3396.    DO scatterbuttons WITH m.tobtn, toarray
  3397.    outstrg = ""
  3398.    FOR m.i = 1 TO ALEN(fromarray)
  3399.       m.topos = ASCAN(toarray,fromarray[i])
  3400.       IF m.topos > 0
  3401.          m.outstrg = m.outstrg + IIF(EMPTY(m.outstrg),'',';') + toarray[m.topos]
  3402.       ELSE
  3403.          m.outstrg = m.outstrg + IIF(EMPTY(m.outstrg),'',';') + fromarray[m.i]
  3404.       ENDIF
  3405.    ENDFOR
  3406.    m.outstrg = LEFT(m.frombtn,AT(' ',m.frombtn)) + m.outstrg + '"'
  3407.    RETURN m.outstrg
  3408. ENDCASE
  3409.  
  3410. *!*****************************************************************************
  3411. *!
  3412. *!      Procedure: SCATTERBUTTONS
  3413. *!
  3414. *!      Called by: MAPBUTTON()        (function  in TRANSPRT.PRG)
  3415. *!
  3416. *!*****************************************************************************
  3417. PROCEDURE scatterbuttons
  3418. PARAMETERS btnlist, destarray
  3419. PRIVATE m.i, m.fromstrg, m.num, m.theword
  3420. m.fromstrg = SUBSTR(m.btnlist,AT(' ',m.btnlist)+1)
  3421. m.fromstrg = CHRTRAN(m.fromstrg,CHR(34)+CHR(39),"")
  3422. m.num = OCCURS(';',m.fromstrg)
  3423. DIMENSION destarray[m.num+1]
  3424. FOR m.i = 1 TO m.num + 1
  3425.    DO CASE
  3426.    CASE m.i = 1    && first button
  3427.       m.theword = LEFT(m.fromstrg,AT(';',m.fromstrg)-1)
  3428.    CASE m.i = m.num + 1   && last button
  3429.       m.theword = SUBSTR(m.fromstrg,AT(';',m.fromstrg,m.num)+1)
  3430.    OTHERWISE
  3431.       m.theword = SUBSTR(m.fromstrg,AT(';',m.fromstrg,m.i-1)+1, ;
  3432.          AT(';',m.fromstrg,m.i) - AT(';',m.fromstrg,m.i-1))
  3433.    ENDCASE
  3434.    destarray[m.i] = UPPER(ALLTRIM(m.theword))
  3435. ENDFOR
  3436. RETURN
  3437.  
  3438. *
  3439. * FindLikeVpos - Tries to find an object in the from platform with a vpos that matches the vpos
  3440. *      of a new object we are adding.  If it finds one, we return that objects Vpos in the to
  3441. *      platform.  This gives us a reasonable chance of coming close to where the user will want
  3442. *      an object that is being added to a pre-converted screen.
  3443. *
  3444. *!*****************************************************************************
  3445. *!
  3446. *!      Procedure: FINDLIKEVPOS
  3447. *!
  3448. *!      Called by: NEWCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  3449. *!               : NEWGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  3450. *!
  3451. *!          Calls: ISOBJECT()         (function  in TRANSPRT.PRG)
  3452. *!
  3453. *!*****************************************************************************
  3454. PROCEDURE findlikevpos
  3455. PARAMETER m.oldvpos
  3456. PRIVATE m.objid, m.saverec, m.retval
  3457. m.saverec = RECNO()
  3458. m.retval = m.oldvpos
  3459.  
  3460. LOCATE FOR platform = m.g_fromplatform AND vpos = m.oldvpos AND isobject(objtype)
  3461. IF FOUND()
  3462.    m.objid = uniqueid
  3463.    LOCATE FOR platform = m.g_toplatform AND uniqueid = m.objid
  3464.    IF FOUND()
  3465.       m.retval = vpos
  3466.    ENDIF
  3467. ENDIF
  3468.  
  3469. GOTO RECORD (m.saverec)
  3470. RETURN m.retval
  3471.  
  3472. *
  3473. * FindLikeHpos - Tries to find an object in the from platform with an hpos that matches the hpos
  3474. *      of a new object we are adding.  If it finds one, we return that objects Hpos in the to
  3475. *      platform.  This gives us a reasonable chance of coming close to where the user will want
  3476. *      an object that is being added to a pre-converted screen.
  3477. *
  3478. *!*****************************************************************************
  3479. *!
  3480. *!      Procedure: FINDLIKEHPOS
  3481. *!
  3482. *!      Called by: NEWCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  3483. *!               : NEWGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  3484. *!
  3485. *!          Calls: ISOBJECT()         (function  in TRANSPRT.PRG)
  3486. *!
  3487. *!*****************************************************************************
  3488. PROCEDURE findlikehpos
  3489. PARAMETER m.oldhpos
  3490. PRIVATE m.objid, m.saverec, m.retval
  3491. m.saverec = RECNO()
  3492. m.retval = m.oldhpos
  3493.  
  3494. LOCATE FOR platform = m.g_fromplatform AND hpos = m.oldhpos AND isobject(objtype)
  3495. IF FOUND()
  3496.    m.objid = uniqueid
  3497.    LOCATE FOR platform = m.g_toplatform AND uniqueid = m.objid
  3498.    IF FOUND()
  3499.       m.retval = hpos
  3500.    ENDIF
  3501. ENDIF
  3502.  
  3503. GOTO RECORD (m.saverec)
  3504. RETURN m.retval
  3505.  
  3506. *
  3507. * MakeCharFit - Makes sure that a report or screen is large enough to hold all of its objects.
  3508. *
  3509. *!*****************************************************************************
  3510. *!
  3511. *!      Procedure: MAKECHARFIT
  3512. *!
  3513. *!      Called by: NEWGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  3514. *!               : ALLGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  3515. *!
  3516. *!          Calls: GETRIGHTMOST       (procedure in TRANSPRT.PRG)
  3517. *!               : GETLOWEST          (procedure in TRANSPRT.PRG)
  3518. *!
  3519. *!*****************************************************************************
  3520. PROCEDURE makecharfit
  3521. PRIVATE m.right, m.bottom
  3522.  
  3523. m.right = CEILING(getrightmost(m.g_toplatform))+2
  3524. m.bottom = CEILING(getlowest(m.g_toplatform))+2
  3525.  
  3526. LOCATE FOR platform = m.g_toplatform AND objtype = c_otheader
  3527. IF FOUND()
  3528.    IF WIDTH < m.right
  3529.       REPLACE WIDTH WITH m.right
  3530.    ENDIF
  3531.  
  3532.    IF height < m.bottom AND m.g_filetype = c_screen
  3533.       REPLACE height WITH m.bottom
  3534.    ENDIF
  3535. ENDIF
  3536. RETURN
  3537.  
  3538. *
  3539. * allenvirons - Process all the screen and environment records first.
  3540. *
  3541. *!*****************************************************************************
  3542. *!
  3543. *!      Procedure: ALLENVIRONS
  3544. *!
  3545. *!      Called by: ALLGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  3546. *!               : ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  3547. *!
  3548. *!          Calls: ADJCOLOR           (procedure in TRANSPRT.PRG)
  3549. *!               : ADJOBJCODE         (procedure in TRANSPRT.PRG)
  3550. *!               : ADJFONT            (procedure in TRANSPRT.PRG)
  3551. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  3552. *!
  3553. *!*****************************************************************************
  3554. PROCEDURE allenvirons
  3555. PRIVATE m.recno
  3556.  
  3557. SCAN FOR platform = m.g_fromplatform AND !DELETED() AND ;
  3558.       (objtype = c_otheader OR objtype = c_otrel OR objtype = c_otworkar OR objtype = c_otindex OR ;
  3559.       (m.g_filetype = c_label AND objtype = c_ot20label))
  3560.    m.recno = RECNO()
  3561.  
  3562.    DO fixpen
  3563.  
  3564.    SCATTER MEMVAR MEMO
  3565.    APPEND BLANK
  3566.    GATHER MEMVAR MEMO
  3567.  
  3568.    REPLACE platform WITH m.g_toplatform
  3569.    IF IsEnviron(objtype) AND m.g_grph2char
  3570.       * DOS requires the alias name to be in upper case, while Windows doesn't
  3571.       REPLACE TAG WITH UPPER(TAG)
  3572.       REPLACE tag2 WITH UPPER(tag2)
  3573.    ENDIF
  3574.  
  3575.    IF objtype = c_otheader OR (m.g_filetype = c_label AND objtype = c_ot20label)
  3576.       m.g_windheight = HEIGHT
  3577.       m.g_windwidth = WIDTH
  3578.  
  3579.       DO CASE
  3580.       CASE m.g_filetype = c_screen
  3581.          DO adjcolor
  3582.  
  3583.       CASE m.g_filetype = c_report
  3584.          DO CASE
  3585.          CASE m.g_char2grph
  3586.             REPLACE vpos WITH 1,;
  3587.              WIDTH WITH -1.0,;
  3588.              ruler WITH 1,;
  3589.              rulerlines WITH 1,;
  3590.              gridv WITH 9,;
  3591.              gridh WITH 9,;
  3592.              penred   WITH 60,;
  3593.              pengreen WITH 80,;
  3594.              penblue    WITH 0
  3595.          CASE m.g_grph2char
  3596.             REPLACE height WITH c_charrptheight
  3597.             REPLACE WIDTH WITH c_charrptwidth
  3598.          ENDCASE
  3599.  
  3600.       CASE m.g_filetype = c_label
  3601.          DO CASE
  3602.          CASE m.g_char2grph
  3603.             REPLACE objtype WITH c_otheader,;
  3604.              ruler WITH 1,;
  3605.              rulerlines WITH 1,;
  3606.              grid WITH .T.,;
  3607.              gridv WITH 12,;
  3608.              gridh WITH 12,;
  3609.              penred   WITH -1,;
  3610.              pengreen WITH 65535,;
  3611.              stretchtop WITH .F.,;
  3612.              TOP WITH .F.,;
  3613.              BOTTOM WITH .T.,;
  3614.              curpos WITH .F.
  3615.          CASE m.g_grph2char
  3616.             REPLACE objtype WITH c_ot20label
  3617.             REPLACE hpos WITH (hpos * c_charsperinch)/10000
  3618.             REPLACE height WITH (height * c_linesperinch)/10000
  3619.             REPLACE WIDTH WITH (WIDTH * c_charsperinch)/10000
  3620.             IF WIDTH < 0
  3621.                REPLACE WIDTH WITH c_charrptwidth
  3622.             ENDIF
  3623.          ENDCASE
  3624.       ENDCASE
  3625.  
  3626.       DO adjobjcode
  3627.       DO adjfont
  3628.    ENDIF
  3629.  
  3630.    GOTO RECORD m.recno
  3631. ENDSCAN
  3632. m.g_mercury = MIN(m.g_mercury + 5, 95)
  3633. DO updtherm WITH m.g_mercury
  3634. RETURN
  3635.  
  3636. *
  3637. * allothers - Process all other records.
  3638. *
  3639. *!*****************************************************************************
  3640. *!
  3641. *!      Procedure: ALLOTHERS
  3642. *!
  3643. *!      Called by: ALLGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  3644. *!               : ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  3645. *!
  3646. *!          Calls: CALCPOSITIONS      (procedure in TRANSPRT.PRG)
  3647. *!               : FILLININFO         (procedure in TRANSPRT.PRG)
  3648. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  3649. *!
  3650. *!*****************************************************************************
  3651. PROCEDURE allothers
  3652. PARAMETER m.thermpart
  3653. PRIVATE m.recno, m.numothers, m.thermstep, m.i
  3654.  
  3655. m.thermstep = m.thermpart / m.objindex
  3656.  
  3657. SELECT (m.g_fromobjonlyalias)
  3658. SET RELATION TO recnum INTO m.g_scrnalias ADDITIVE
  3659. LOCATE FOR .T.
  3660. m.i = 1
  3661.  
  3662. SCAN FOR !DELETED()
  3663.  
  3664.    m.recno = RECNO()
  3665.  
  3666.    DO fixpen
  3667.  
  3668.    SCATTER MEMVAR MEMO
  3669.  
  3670.    IF m.g_char2grph
  3671.       DO calcpositions WITH m.i    && determine relative positions of objects
  3672.       m.i = m.i + 1
  3673.    ENDIF
  3674.  
  3675.    SELECT (m.g_scrnalias)
  3676.    APPEND BLANK
  3677.    GATHER MEMVAR MEMO
  3678.  
  3679.    REPLACE platform WITH m.g_toplatform
  3680.  
  3681.    DO fillininfo
  3682.  
  3683.    SELECT (m.g_fromobjonlyalias)
  3684.    GOTO RECORD m.recno
  3685.  
  3686.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  3687.    DO updtherm WITH m.g_mercury
  3688.  
  3689. ENDSCAN
  3690. RETURN
  3691.  
  3692. *
  3693. * FillInInfo - Fill in information for the fields in SCX/FRX database.
  3694. *
  3695. *!*****************************************************************************
  3696. *!
  3697. *!      Procedure: FILLININFO
  3698. *!
  3699. *!      Called by: NEWCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  3700. *!               : NEWGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  3701. *!               : ALLOTHERS          (procedure in TRANSPRT.PRG)
  3702. *!
  3703. *!          Calls: ADJRPTSUPPRESS     (procedure in TRANSPRT.PRG)
  3704. *!               : ADJRPTFLOAT        (procedure in TRANSPRT.PRG)
  3705. *!               : ADJRPTRESET        (procedure in TRANSPRT.PRG)
  3706. *!               : OBJ2BASEFONT()     (function  in TRANSPRT.PRG)
  3707. *!               : num2style()        (function  in TRANSPRT.PRG)
  3708. *!               : ADJPEN             (procedure in TRANSPRT.PRG)
  3709. *!               : ADJCOLOR           (procedure in TRANSPRT.PRG)
  3710. *!               : ADJFONT            (procedure in TRANSPRT.PRG)
  3711. *!               : ADJHEIGHTANDWIDTH  (procedure in TRANSPRT.PRG)
  3712. *!
  3713. *!*****************************************************************************
  3714. PROCEDURE fillininfo
  3715. IF m.g_filetype = c_report
  3716.    DO adjrptsuppress
  3717.    DO adjrptfloat
  3718. ENDIF
  3719.  
  3720. DO CASE
  3721. CASE m.g_char2grph
  3722.    * Handle 2D or 3D decision
  3723.    IF _MAC ;
  3724.          AND (INLIST(objtype, c_ottxtbut, c_otradbut, c_otchkbox, ;
  3725.              c_otspinner, c_otlist, c_otpopup) ;
  3726.           OR (objtype = c_otfield AND INLIST(objcode,c_sgget,c_sgedit)))
  3727.       * Applies to most objects and GET/EDIT fields (but not SAY fields)
  3728.       IF m.g_look2d
  3729.          * Add '2' to the control string
  3730.          REPLACE picture WITH addquote(make2d(picture))
  3731.       ELSE
  3732.          REPLACE picture WITH addquote(make3d(picture))
  3733.       ENDIF
  3734.    ENDIF
  3735.  
  3736.    DO CASE
  3737.    CASE objtype = c_otpopup
  3738.       * Popups are a special case since the arrow control counts against the width
  3739.       * under Windows.
  3740.       REPLACE WIDTH WITH WIDTH + 2
  3741.    CASE INLIST(objtype,c_otrepvar,c_otrepfld)
  3742.       DO adjrptreset
  3743.       IF fillchar = "N"
  3744.          REPLACE offset WITH 1      && Change alignment for numerics.
  3745.       ENDIF
  3746.    ENDCASE
  3747. CASE m.g_grph2char
  3748.    DO CASE
  3749.    CASE objtype = c_ottext
  3750.       REPLACE height WITH MAX(height,1), width WITH MAX(width,1)
  3751.    CASE objtype = c_otspinner
  3752.       * Map spinners to regular fields
  3753.       REPLACE objtype   WITH c_otfield, ;
  3754.          height    WITH 1, ;
  3755.          fillchar  WITH "N"
  3756.    CASE objtype = c_otline
  3757.       * Map Windows lines to DOS boxes
  3758.       REPLACE objtype WITH c_otbox
  3759.       REPLACE height  WITH MAX(height,1), WIDTH WITH MAX(WIDTH,1)
  3760.       IF pensize >= 6
  3761.          REPLACE boxchar WITH "█"
  3762.       ENDIF
  3763.    CASE INLIST(objtype,c_otradbut,c_ottxtbut)
  3764.       * Remove the BMP extension from bitmap buttons
  3765.       REPLACE PICTURE WITH STRTRAN(PICTURE,".BMP","")
  3766.       REPLACE PICTURE WITH STRTRAN(PICTURE,".bmp","")
  3767.    CASE objtype = c_otfield AND ;
  3768.          (objcode = c_sgedit  OR (INLIST(objcode,c_sgsay,c_sgget) AND WIDTH > 25))
  3769.       * Adjust widths of edit fields and very long GET/SAY fields to account
  3770.       * for font differences between the object and the base font.
  3771.       REPLACE WIDTH WITH MAX(obj2basefont(WIDTH,g_dfltfface,g_dfltfsize,g_dfltfstyle,;
  3772.          fontface,fontsize,num2style(fontstyle)),1)
  3773.    CASE objtype = c_otbox AND (objcode = 4)
  3774.       IF pensize >= 6
  3775.          REPLACE boxchar WITH "█"
  3776.       ENDIF
  3777.    CASE INLIST(objtype,c_otrepvar,c_otrepfld)
  3778.       DO adjrptreset
  3779.       IF objtype = c_otrepvar
  3780.          * DOS report variable names have to be in upper case
  3781.          REPLACE name WITH UPPER(name)
  3782.       ENDIF
  3783.    ENDCASE
  3784. CASE m.g_grph2grph
  3785.    * Handle 2D or 3D decision
  3786.    IF _MAC ;
  3787.          AND (INLIST(objtype, c_ottxtbut, c_otradbut, c_otchkbox, ;
  3788.              c_otspinner, c_otlist, c_otpopup) ;
  3789.           OR (objtype = c_otfield AND INLIST(objcode,c_sgget,c_sgedit)))
  3790.       * Applies to most objects and GET/EDIT fields (but not SAY fields)
  3791.       IF m.g_look2d
  3792.          * Add '2' to the control string
  3793.          REPLACE picture WITH addquote(make2d(picture))
  3794.       ELSE
  3795.          REPLACE picture WITH addquote(make3d(picture))
  3796.       ENDIF
  3797.    ENDIF
  3798.  
  3799.    DO CASE
  3800.    CASE objtype = c_ottxtbut
  3801.       * Preserve default button height across transportation sessions
  3802.       DO CASE
  3803.       CASE  _MAC AND height = m.g_winbtnheight
  3804.          REPLACE height WITH m.g_macbtnheight
  3805.       CASE  _WINDOWS AND INLIST(height,1.500,1.125,m.g_macbtnheight)
  3806.          * The Mac button might have been either 2D or 3D
  3807.          REPLACE height WITH m.g_winbtnheight
  3808.       ENDCASE
  3809.    CASE objtype = c_otpopup
  3810.       REPLACE height WITH m.g_pophght
  3811.    ENDCASE
  3812.  
  3813.     * Map Mac 3D lines/boxes back to Windows single line lines/boxes
  3814.     IF _WINDOWS AND INLIST(objtype,c_otbox,c_otline)
  3815.        IF pensize = 2 AND penpat = 100
  3816.            REPLACE pensize WITH 1, penpat WITH 8
  3817.         ENDIF
  3818.     ENDIF
  3819.  
  3820. ENDCASE
  3821.  
  3822. IF objtype <> c_otbox AND objtype <> c_otline
  3823.    DO adjpen
  3824. ENDIF
  3825.  
  3826. DO adjcolor
  3827. DO adjfont
  3828. IF m.g_filetype = c_screen
  3829.    DO adjheightandwidth
  3830. ENDIF
  3831. RETURN
  3832.  
  3833. *
  3834. * adjrptfloat - Convert float/stretch/relative postion types between
  3835. *      character and graphical positions
  3836. *
  3837. *!*****************************************************************************
  3838. *!
  3839. *!      Procedure: ADJRPTFLOAT
  3840. *!
  3841. *!      Called by: UPDATEREPORT       (procedure in TRANSPRT.PRG)
  3842. *!               : FILLININFO         (procedure in TRANSPRT.PRG)
  3843. *!
  3844. *!*****************************************************************************
  3845. PROCEDURE adjrptfloat
  3846. DO CASE
  3847. CASE m.g_char2grph
  3848.    DO CASE
  3849.    CASE FLOAT AND (objtype = c_otbox AND HEIGHT > 1)
  3850.       * Box or a vertical line--float as band stretches translates to Top--stretch w/ band.
  3851.       * Use the height > 1 test because DOS boxes haven't been translated into Windows
  3852.       * lines yet.
  3853.       REPLACE stretchtop WITH .T.
  3854.       REPLACE TOP WITH .F.
  3855.       REPLACE BOTTOM WITH .F.
  3856.    CASE FLOAT AND STRETCH
  3857.       REPLACE stretchtop WITH .T.
  3858.       REPLACE TOP WITH .F.
  3859.       REPLACE BOTTOM WITH .F.
  3860.    CASE FLOAT
  3861.       REPLACE BOTTOM WITH .T.
  3862.       REPLACE TOP WITH .F.
  3863.       REPLACE stretchtop WITH .F.
  3864.    ENDCASE
  3865. CASE m.g_grph2char
  3866.    DO CASE
  3867.    CASE objtype = c_otrepfld AND (stretchtop OR STRETCH)
  3868.       REPLACE FLOAT WITH .T.
  3869.       REPLACE STRETCH WITH .T.
  3870.    CASE BOTTOM
  3871.       REPLACE FLOAT WITH .T.
  3872.       REPLACE STRETCH WITH .F.
  3873.    CASE TOP
  3874.       REPLACE FLOAT WITH .F.
  3875.       REPLACE STRETCH WITH .F.
  3876.    CASE stretchtop OR STRETCH
  3877.       REPLACE FLOAT WITH .T.
  3878.       REPLACE STRETCH WITH .F.
  3879.    ENDCASE
  3880. ENDCASE
  3881. RETURN
  3882.  
  3883. *
  3884. * adjrptSuppress - Convert Suppression types between 2.5 platforms.
  3885. *
  3886. *!*****************************************************************************
  3887. *!
  3888. *!      Procedure: ADJRPTSUPPRESS
  3889. *!
  3890. *!      Called by: UPDATEREPORT       (procedure in TRANSPRT.PRG)
  3891. *!               : FILLININFO         (procedure in TRANSPRT.PRG)
  3892. *!
  3893. *!*****************************************************************************
  3894. PROCEDURE adjrptsuppress
  3895. * Handle suppression of repeated values.
  3896. *
  3897. * In DOS 2.0, the value of the detail record "norepeat" determines whether repeated values
  3898. * are suppressed, if this is a field object, or whether group headings are repeated,
  3899. * if this is a group header.  The main screen header record "norepeat" field determines
  3900. * whether blank lines are suppressed in the detail band.
  3901. *
  3902. * In 2.5, the norepeat field is used just for suppression of blank lines.
  3903. * We are positioned on a detail record now.
  3904. *
  3905. DO CASE
  3906. CASE m.g_char2grph
  3907.    IF objtype = c_otband
  3908.       * The meaning for DOS is reversed from Windows
  3909.       REPLACE norepeat WITH !norepeat
  3910.    ELSE
  3911.       IF norepeat            && suppress repeated values
  3912.          REPLACE supvalchng WITH .T.
  3913.          REPLACE supovflow WITH .F.
  3914.          DO CASE
  3915.          CASE resetrpt = 0
  3916.             REPLACE suprpcol WITH 0
  3917.             REPLACE supgroup WITH 0
  3918.          CASE resetrpt = 1
  3919.             REPLACE suprpcol WITH 3
  3920.             REPLACE supgroup WITH 0
  3921.          OTHERWISE
  3922.             REPLACE suprpcol WITH 0
  3923.             REPLACE supgroup WITH resetrpt+3
  3924.          ENDCASE
  3925.       ELSE                   && no suppression of repeated values
  3926.          REPLACE supalways WITH .T.
  3927.          REPLACE supvalchng WITH .F.
  3928.          REPLACE supovflow WITH .F.
  3929.          REPLACE suprpcol WITH 3
  3930.          REPLACE supgroup WITH 0
  3931.       ENDIF
  3932.    ENDIF
  3933. CASE m.g_grph2char
  3934.    IF supvalchng AND !supalways
  3935.       REPLACE norepeat WITH .T.
  3936.       IF supgroup > 0
  3937.          REPLACE resetrpt WITH supgroup - 3
  3938.       ELSE
  3939.          IF suprpcol = 3
  3940.             REPLACE resetrpt WITH 1
  3941.          ELSE
  3942.             REPLACE resetrpt WITH 0
  3943.          ENDIF
  3944.       ENDIF
  3945.    ELSE
  3946.       REPLACE norepeat WITH .F.
  3947.    ENDIF
  3948. ENDCASE
  3949. RETURN
  3950.  
  3951. *
  3952. * adjrptreset - Convert the reset values between 2.0 and 2.5.
  3953. *
  3954. *!*****************************************************************************
  3955. *!
  3956. *!      Procedure: ADJRPTRESET
  3957. *!
  3958. *!      Called by: UPDATEREPORT       (procedure in TRANSPRT.PRG)
  3959. *!               : FILLININFO         (procedure in TRANSPRT.PRG)
  3960. *!
  3961. *!*****************************************************************************
  3962. PROCEDURE adjrptreset
  3963. DO CASE
  3964. CASE m.g_char2grph
  3965.    DO CASE
  3966.    CASE resettotal = 0
  3967.       REPLACE resettotal WITH 1
  3968.    CASE resettotal = 1
  3969.       REPLACE resettotal WITH 2
  3970.    OTHERWISE
  3971.       REPLACE resettotal WITH resettotal+3
  3972.    ENDCASE
  3973. CASE m.g_grph2char
  3974.    DO CASE
  3975.    CASE resettotal = 1
  3976.       REPLACE resettotal WITH 0
  3977.    CASE resettotal = 2 OR resettotal = 3
  3978.       REPLACE resettotal WITH 1
  3979.    OTHERWISE
  3980.       REPLACE resettotal WITH resettotal-3
  3981.    ENDCASE
  3982. ENDCASE
  3983. RETURN
  3984.  
  3985. *
  3986. * GetCharSuppress - Gets the global setting of blank line Suppression for a report. (This is
  3987. *      only valid for character mode reports).
  3988. *
  3989. *!*****************************************************************************
  3990. *!
  3991. *!       Function: GETCHARSUPPRESS
  3992. *!
  3993. *!      Called by: IMPORT             (procedure in TRANSPRT.PRG)
  3994. *!
  3995. *!*****************************************************************************
  3996. FUNCTION getcharsuppress
  3997. LOCATE FOR platform = m.g_fromplatform AND objtype = c_otheader
  3998. IF FOUND()
  3999.    RETURN norepeat
  4000. ELSE
  4001.    RETURN .F.
  4002. ENDIF
  4003.  
  4004. *
  4005. * SuppressBlankLines - Looks through the from platform to see if any
  4006. *      object is marked to Suppress blank lines.  If one is, we
  4007. *      make the entire "to" report (which is assumed to be character)
  4008. *      Suppress blank lines.
  4009. *
  4010. *!*****************************************************************************
  4011. *!
  4012. *!      Procedure: SUPPRESSBLANKLINES
  4013. *!
  4014. *!      Called by: ALLGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  4015. *!               : ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  4016. *!
  4017. *!          Calls: GETBANDCODE()      (function  in TRANSPRT.PRG)
  4018. *!
  4019. *!*****************************************************************************
  4020. PROCEDURE suppressblanklines
  4021. PRIVATE m.supcount
  4022. DO CASE
  4023. CASE m.g_grph2char
  4024.    COUNT TO m.supcount FOR platform = m.g_fromplatform AND objtype = c_otrepfld
  4025.    IF m.supcount > 0
  4026.       LOCATE FOR platform = m.g_toplatform AND objtype = c_otheader
  4027.       IF FOUND()
  4028.          REPLACE norepeat WITH .T.
  4029.       ENDIF
  4030.    ENDIF
  4031. CASE m.g_char2grph
  4032.    * DOS suppression of blank lines only applies to detail lines.  Only mark graphical
  4033.    * objects in the detail band as suppressed.
  4034.    SCAN FOR platform = m.g_toplatform AND objtype <> c_otband AND objtype <> c_otheader
  4035.       myexpr = expr
  4036.       IF objtype = 8
  4037.          WAIT CLEAR
  4038.       ENDIF
  4039.       bcode  = getbandcode(vpos)
  4040.       IF bcode = 4     && detail band
  4041.          REPLACE norepeat WITH m.g_norepeat
  4042.       ELSE
  4043.          REPLACE norepeat WITH .F.
  4044.       ENDIF
  4045.    ENDSCAN
  4046. ENDCASE
  4047.  
  4048. *
  4049. * allGroups - Process all Group records.
  4050. *
  4051. *!*****************************************************************************
  4052. *!
  4053. *!      Procedure: ALLGROUPS
  4054. *!
  4055. *!      Called by: ALLGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  4056. *!               : ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  4057. *!
  4058. *!          Calls: UPDTHERM           (procedure in TRANSPRT.PRG)
  4059. *!
  4060. *!*****************************************************************************
  4061. PROCEDURE allgroups
  4062. PARAMETER m.thermpart
  4063. PRIVATE m.recno, m.numothers, m.thermstep
  4064.  
  4065. m.thermstep = m.thermpart / m.objindex
  4066. SELECT (m.g_scrnalias)
  4067.  
  4068. SCAN FOR platform = m.g_fromplatform AND objtype = c_otgroup
  4069.    m.recno = RECNO()
  4070.  
  4071.    SCATTER MEMVAR MEMO
  4072.    APPEND BLANK
  4073.    GATHER MEMVAR MEMO
  4074.  
  4075.    REPLACE platform WITH m.g_toplatform
  4076.  
  4077.    GOTO RECORD m.recno
  4078.  
  4079.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  4080.    DO updtherm WITH m.g_mercury
  4081. ENDSCAN
  4082.  
  4083. *
  4084. * RptConvert - Converts entire reports between platforms.
  4085. *
  4086. *!*****************************************************************************
  4087. *!
  4088. *!      Procedure: RPTCONVERT
  4089. *!
  4090. *!      Called by: ALLGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  4091. *!               : ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  4092. *!
  4093. *!          Calls: ISREPTOBJECT()     (function  in TRANSPRT.PRG)
  4094. *!               : RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  4095. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  4096. *!               : BANDINFO()         (function  in TRANSPRT.PRG)
  4097. *!               : CLONEBAND          (procedure in TRANSPRT.PRG)
  4098. *!
  4099. *!*****************************************************************************
  4100. PROCEDURE rptconvert
  4101. PRIVATE m.thermstep
  4102.  
  4103. COUNT TO m.thermstep FOR platform = m.g_toplatform AND ;
  4104.    (isreptobject(objtype) OR objtype = c_otband)
  4105.  
  4106. IF m.g_grph2char
  4107.    m.thermstep = 25 / m.thermstep
  4108. ELSE
  4109.    m.thermstep = 50 / m.thermstep
  4110. ENDIF
  4111.  
  4112. * We need to do bands before any other object.
  4113. SCAN FOR platform = m.g_toplatform AND objtype = c_otband
  4114.    DO rptobjconvert WITH 0
  4115.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  4116.    DO updtherm WITH m.g_mercury
  4117. ENDSCAN
  4118.  
  4119. * We need to know where bands start and where they end in
  4120. * both platforms.
  4121. COUNT TO m.bandcount FOR platform = m.g_toplatform AND objtype = c_otband
  4122. GOTO TOP
  4123.  
  4124. DIMENSION bands[m.bandCount,4]
  4125. m.bandcount = bandinfo()
  4126.  
  4127. * Make sure that the band headers and footers match on Windows
  4128. IF m.g_char2grph
  4129.    DO cloneband
  4130. ENDIF
  4131.  
  4132. SCAN FOR platform = m.g_toplatform ;
  4133.    AND INLIST(objtype, c_otrepfld, c_ottext,c_otbox, c_otline, c_otpicture)
  4134.  
  4135.    IF m.g_grph2grph OR objtype <> c_otpicture
  4136.        DO rptobjconvert WITH m.bandcount
  4137.    ENDIF
  4138.  
  4139.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  4140.    DO updtherm WITH m.g_mercury
  4141. ENDSCAN
  4142.  
  4143. *
  4144. * RptObjConvert - Converts the size and postion of a given record in a report/label
  4145. *
  4146. *!*****************************************************************************
  4147. *!
  4148. *!      Procedure: RPTOBJCONVERT
  4149. *!
  4150. *!      Called by: NEWCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  4151. *!               : NEWGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  4152. *!               : NEWBANDS           (procedure in TRANSPRT.PRG)
  4153. *!               : RPTCONVERT         (procedure in TRANSPRT.PRG)
  4154. *!
  4155. *!          Calls: EMPTYBAND()        (function  in TRANSPRT.PRG)
  4156. *!               : CVTREPORTVERTICAL()(function  in TRANSPRT.PRG)
  4157. *!               : ADJBOX             (procedure in TRANSPRT.PRG)
  4158. *!               : ADJCOLOR           (procedure in TRANSPRT.PRG)
  4159. *!               : ADJFONT            (procedure in TRANSPRT.PRG)
  4160. *!               : GETBANDINDEX       (procedure in TRANSPRT.PRG)
  4161. *!               : CVTREPORTHORIZONTAL(function  in TRANSPRT.PRG)
  4162. *!               : CVTRPTLINES()      (function  in TRANSPRT.PRG)
  4163. *!               : ADJTEXT            (procedure in TRANSPRT.PRG)
  4164. *!
  4165. *!*****************************************************************************
  4166. PROCEDURE rptobjconvert
  4167. PARAMETER m.bandcount
  4168. PRIVATE m.bandindex, m.endindex, m.posinband, m.saverec, m.objid, m.origvpos, m.lineheight
  4169.  
  4170. IF m.g_grph2grph
  4171.    DO grphrptcvt    && map Mac and Windows coordinates
  4172.     IF _MAC AND !m.g_newobjmode
  4173.        * We've already lined up all the Mac objects.
  4174.        RETURN
  4175.    ENDIF
  4176. ENDIF
  4177.  
  4178. DO CASE
  4179. CASE objtype = c_otband
  4180.    * Map height and width of band to proper values
  4181.  
  4182.    DO CASE
  4183.    CASE m.g_char2grph AND emptyband(uniqueid)
  4184.       REPLACE height WITH 0
  4185.    CASE m.g_grph2grph
  4186.       * No conversion necessary.
  4187.    OTHERWISE
  4188.       m.lineheight = cvtreportvertical(HEIGHT)
  4189.       IF m.g_grph2char AND BETWEEN(m.lineheight,1.00,1.10) AND objcode = 4
  4190.          * This is a heuristic rule to make quick reports and other reports with
  4191.          * a single-line detail band transport to DOS correctly.  Sometimes the bands
  4192.          * will be just a little larger than one line in Windows.
  4193.          REPLACE height WITH 1
  4194.       ELSE
  4195.          REPLACE height WITH CEILING(m.lineheight)
  4196.       ENDIF
  4197.    ENDCASE
  4198.  
  4199.    DO CASE
  4200.    CASE m.g_char2grph
  4201.       * Map DOS offset field to Windows "if lines less than".  These fields control
  4202.       * when the data grouping decides to start a new page.  This data is stored in "width".
  4203.       REPLACE WIDTH WITH 10000 * offset / c_linesperinch
  4204.    CASE m.g_grph2char
  4205.       REPLACE height WITH MAX(1, height)
  4206.       REPLACE offset WITH ROUND(WIDTH/10000, 0) * c_linesperinch
  4207.    ENDCASE
  4208. OTHERWISE
  4209.    * Converting a regular object such as a field or line.
  4210.    m.origvpos   = vpos
  4211.    m.origheight = height
  4212.  
  4213.    IF m.g_char2grph AND objtype = c_otbox
  4214.       DO adjbox WITH 0
  4215.       DO adjcolor
  4216.       DO adjfont
  4217.    ENDIF
  4218.  
  4219.    * Find which band in the "from" platform this object came from
  4220.    * Use a vpos expressed in "from" units for this function.
  4221.    m.bandindex = getbandindex(m.origvpos, m.bandcount)
  4222.  
  4223.    * Since keeping objects in the proper bands is our highest
  4224.    * priority, we calculate the new Vpos by determining how many
  4225.    * lines into its band an object lies and adding this
  4226.    * value (converted) to that band's Vpos in the from platform.
  4227.    m.posinband = MAX(cvtreportvertical((vpos - bands[m.bandIndex, c_fmbandvpos])),0)
  4228.    REPLACE vpos WITH bands[m.bandIndex, c_tobandvpos] + m.posinband
  4229.  
  4230.    * Since vertical lines and boxes can stretch across bands, we need to
  4231.    * watch their ending positions.
  4232.    IF (objtype = c_otbox AND cvtreportvertical(height) > 1) ;
  4233.          OR (objtype = c_otline AND WIDTH < height)
  4234.       m.endindex = getbandindex(IIF(m.g_char2grph,m.origvpos+m.origheight-1,;
  4235.          m.origvpos + m.origheight), m.bandcount)
  4236.       IF m.endindex <> m.bandindex
  4237.          *m.endinband = IIF(m.g_char2grph, m.origvpos+m.origheight-.25, m.origvpos+m.origheight) ;
  4238.          *   - bands[m.endIndex, c_fmbandvpos]
  4239.          m.endinband = m.origvpos+m.origheight - bands[m.endIndex, c_fmbandvpos]
  4240.          IF m.g_char2grph
  4241.             * Allow for the fact that box characters in DOS appear in the middle of
  4242.             * the line, but always stick out into the "end" band a little bit.
  4243.             m.endinband = MAX(m.endinband - 0.5,0.25)
  4244.          ENDIF
  4245.          m.endinband = cvtreportvertical(m.endinband)
  4246.          REPLACE height WITH bands[m.endIndex, c_tobandvpos] + m.endinband - vpos
  4247.       ELSE
  4248.          REPLACE height WITH cvtreportvertical(HEIGHT)
  4249.       ENDIF
  4250.    ELSE
  4251.       REPLACE height WITH cvtreportvertical(height)
  4252.    ENDIF
  4253.  
  4254.    REPLACE hpos WITH cvtreporthorizontal(hpos)
  4255.    REPLACE WIDTH WITH cvtreporthorizontal(WIDTH)
  4256.    DO CASE
  4257.    CASE m.g_char2grph
  4258.       IF objtype = c_otline AND WIDTH > height
  4259.          * Handle horizontal lines separately.  They are very sensitive to line
  4260.          * height.
  4261.          REPLACE height WITH cvtrptlines(height)
  4262.       ENDIF
  4263.    CASE m.g_grph2char
  4264.       IF objtype = c_otbox AND ROUND(height,0) <> 1
  4265.          DO adjbox WITH 0
  4266.       ENDIF
  4267.  
  4268.       REPLACE vpos WITH ROUND(vpos,0)
  4269.       REPLACE hpos WITH ROUND(hpos,0)
  4270.       REPLACE height WITH ROUND(height,0)
  4271.       REPLACE WIDTH WITH ROUND(WIDTH,0)
  4272.  
  4273.       * Make sure that this object will not extend past the end of the last
  4274.       * band, which leads to "invalid report" errors on DOS.
  4275.       IF m.bandindex = m.bandcount AND ;
  4276.             (vpos + height ;
  4277.             > bands[m.bandIndex,c_tobandvpos] ;
  4278.             + bands[m.bandIndex,c_tobandheight])
  4279.          * Can we move the object up so that it fits?
  4280.          IF height <= bands[m.bandIndex, c_tobandheight]
  4281.             * It will fit if we scootch it up a little.
  4282.             REPLACE vpos WITH vpos -;
  4283.                (bands[m.bandIndex,c_tobandheight] - height)
  4284.          ELSE
  4285.             * No room for it at all.  Crop the height.  Make as much fit as possible.
  4286.             REPLACE vpos   WITH bands[m.bandIndex,c_tobandvpos]
  4287.             REPLACE height WITH bands[m.bandIndex,c_tobandheight]
  4288.          ENDIF
  4289.       ENDIF
  4290.  
  4291.       DO CASE
  4292.       CASE objtype = c_ottext
  4293.          REPLACE height WITH 1
  4294.          DO adjtext WITH WIDTH
  4295.          REPLACE WIDTH WITH LEN(expr)-2
  4296.  
  4297.       CASE objtype = c_otrepfld AND height < 1
  4298.          REPLACE height WITH 1
  4299.  
  4300.       ENDCASE
  4301.       IF ROUND(hpos,0) = -1
  4302.          REPLACE hpos WITH 0
  4303.       ENDIF
  4304.    ENDCASE
  4305.  
  4306.    * Guarantee that we are in the right band.
  4307.    IF vpos > bands[m.bandIndex,c_tobandvpos] ;
  4308.          + bands[m.bandIndex,c_tobandheight] - 1
  4309.       REPLACE vpos WITH bands[m.bandIndex,c_tobandvpos] ;
  4310.          + bands[m.bandIndex,c_tobandheight] - 1
  4311.    ENDIF
  4312.  
  4313.    IF vpos < 0
  4314.       REPLACE vpos WITH 0
  4315.    ENDIF
  4316. ENDCASE
  4317.  
  4318. IF height <= 0
  4319.    REPLACE height WITH 1
  4320. ENDIF
  4321.  
  4322. RETURN
  4323.  
  4324. *
  4325. * GetBandIndex - Given a Vpos (from platform), this function returns the
  4326. *      index in the Band array of the band which this Vpos lies in.
  4327. *
  4328. *!*****************************************************************************
  4329. *!
  4330. *!      Procedure: GETBANDINDEX
  4331. *!
  4332. *!      Called by: RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  4333. *!
  4334. *!*****************************************************************************
  4335. PROCEDURE getbandindex
  4336. PARAMETER m.vpos, m.bandcount
  4337. PRIVATE m.loop
  4338. FOR m.loop = 1 TO m.bandcount
  4339.    IF m.vpos >= bands[m.loop,c_fmbandvpos] ;
  4340.          AND m.vpos < bands[m.loop,c_fmbandvpos]+bands[m.loop,c_fmbandheight]
  4341.       RETURN m.loop
  4342.    ENDIF
  4343. ENDFOR
  4344. RETURN m.bandcount    && drop them into the bottom band as a default
  4345.  
  4346. *
  4347. * BandInfo - Fills a predefined array named Band as follows.
  4348. *   bands[1] = Start Position in To platform.
  4349. *   bands[2] = Height in To platform.
  4350. *   bands[3] = Start Position in From platform.
  4351. *   bands[4] = Height in From platform.
  4352. *
  4353. *!*****************************************************************************
  4354. *!
  4355. *!       Function: BANDINFO
  4356. *!
  4357. *!      Called by: NEWCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  4358. *!               : NEWGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  4359. *!               : RPTCONVERT         (procedure in TRANSPRT.PRG)
  4360. *!
  4361. *!          Calls: RESIZEBAND         (procedure in TRANSPRT.PRG)
  4362. *!
  4363. *!*****************************************************************************
  4364. FUNCTION bandinfo
  4365. PRIVATE m.saverec, m.bandcount, m.loop, ;
  4366.    m.pagefooter, m.pageheader, m.colheader, m.colfooter, ;
  4367.    m.toposition, m.fromposition, m.objcode, m.expr
  4368.  
  4369. m.toposition   = 0
  4370. m.fromposition = 0
  4371. m.bandcount    = 0
  4372. m.colheader    = 0
  4373. m.colfooter    = 0
  4374. m.pageheader   = 0
  4375. m.pagefooter   = 0
  4376.  
  4377. SCAN FOR platform = m.g_toplatform AND objtype = c_otband
  4378.    m.bandcount = m.bandcount + 1
  4379.  
  4380.    DO CASE
  4381.    CASE objcode = 1
  4382.       m.pageheader = m.bandcount
  4383.    CASE objcode = 2
  4384.       m.colheader  = m.bandcount
  4385.    CASE objcode = 6
  4386.       m.colfooter  = m.bandcount
  4387.    CASE objcode = 7
  4388.       m.pagefooter = m.bandcount
  4389.    ENDCASE
  4390.  
  4391.    * The To fields are already converted at this point
  4392.    bands[m.bandCount,c_tobandvpos] = m.toposition
  4393.    DO CASE
  4394.    CASE m.g_char2grph
  4395.       bands[m.bandCount,c_tobandheight] ;
  4396.          = HEIGHT + m.g_bandheight + (m.g_bandfudge/m.g_pixelsize)
  4397.    CASE m.g_grph2char
  4398.       bands[m.bandCount,c_tobandheight] = height
  4399.    CASE m.g_grph2grph
  4400.       bands[m.bandCount,c_tobandheight] = height + ;
  4401.          m.g_bandheight + (m.g_bandfudge/m.g_pixelsize)
  4402.    ENDCASE
  4403.  
  4404.    m.objcode = objcode
  4405.    m.expr    = expr
  4406.    m.saverec = RECNO()
  4407.  
  4408.    IF !EMPTY(expr)
  4409.       LOCATE FOR platform = m.g_fromplatform AND ;
  4410.          objtype = c_otband AND objcode = m.objcode AND expr = m.expr
  4411.    ELSE
  4412.       * The expression is empty, which means this is probably a group footer.  There could
  4413.       * be many of them, all empty.  We have to find the right one.
  4414.       GOTO TOP
  4415.       * Figure out which occurrence this one is.
  4416.       COUNT TO m.seq FOR platform = m.g_toplatform AND ;
  4417.          objtype = c_otband AND objcode = m.objcode AND EMPTY(expr) ;
  4418.          AND RECNO() <= m.saverec
  4419.       GOTO TOP
  4420.       * Now find the corresponding band in the "from" platform
  4421.       LOCATE FOR platform = m.g_fromplatform AND ;
  4422.          objtype = c_otband AND objcode = m.objcode AND EMPTY(expr)
  4423.       m.i = 1
  4424.       DO WHILE FOUND() AND m.i < m.seq
  4425.          m.i = m.i + 1
  4426.          CONTINUE
  4427.       ENDDO
  4428.    ENDIF
  4429.    IF FOUND()
  4430.       bands[m.bandCount,c_fmbandvpos] = m.fromposition
  4431.       DO CASE
  4432.       CASE m.g_char2grph
  4433.          bands[m.bandCount,c_fmbandheight] = height
  4434.       CASE m.g_grph2char
  4435.          bands[m.bandCount,c_fmbandheight] = height ;
  4436.              + IIF(m.g_fromplatform = c_macname,m.g_macbandheight, m.g_winbandheight)
  4437.       CASE m.g_grph2grph
  4438.          bands[m.bandCount,c_fmbandheight] = height + m.g_bandheight
  4439.       ENDCASE
  4440.  
  4441.       m.fromposition = m.fromposition + bands[m.bandCount,c_fmbandheight]
  4442.  
  4443.       IF m.g_grph2char
  4444.          * Resize 'to' band if necessary to account for boxes that narrowly
  4445.          * surround text on a graphic platform.  Sometimes the box can be
  4446.          * tightly against the text such that the graphical band appears to
  4447.          * be only two rows high.  We need three rows to display the box in
  4448.          * a character platform
  4449.          bands[m.bandCount,c_tobandheight] = ;
  4450.             resizeband(bands[m.bandCount,c_tobandheight], ;
  4451.             bands[m.bandCount,c_fmbandvpos  ], ;
  4452.             bands[m.bandCount,c_fmbandheight])
  4453.       ENDIF
  4454.    ELSE
  4455.       bands[m.bandCount,c_fmbandvpos] = 9999999
  4456.       bands[m.bandCount,c_fmbandheight] = 9999999
  4457.    ENDIF
  4458.  
  4459.  
  4460.    m.toposition = m.toposition + bands[m.bandCount,c_tobandheight]
  4461.  
  4462.    GOTO RECORD (m.saverec)
  4463.  
  4464.    IF m.g_grph2char
  4465.       * Stuff the newly recomputed height into the DOS record
  4466.       REPLACE height WITH bands[m.bandCount,c_tobandheight]
  4467.    ENDIF
  4468.  
  4469. ENDSCAN
  4470.  
  4471.  
  4472. IF !m.g_grph2grph
  4473.    * We don't want to have any column headers/footers in the character
  4474.    * products so we need to combine them with the page headers/footers.
  4475.    IF m.colfooter > 0 AND m.pagefooter > 0
  4476.       bands[m.pageFooter,c_tobandvpos] = bands[m.colFooter,c_tobandvpos]
  4477.       bands[m.pageFooter,c_tobandheight];
  4478.          = bands[m.pageFooter,c_tobandheight] ;
  4479.          + bands[m.colFooter,c_tobandheight]
  4480.       bands[m.pageFooter,c_fmbandvpos] = bands[m.colFooter,c_fmbandvpos]
  4481.       bands[m.pageFooter,c_fmbandheight] ;
  4482.          = bands[m.pageFooter,c_fmbandheight] ;
  4483.          + bands[m.colFooter,c_fmbandheight]
  4484.  
  4485.       LOCATE FOR platform = m.g_toplatform ;
  4486.          AND objtype = c_otband AND objcode = 6
  4487.       IF FOUND()
  4488.          DELETE
  4489.       ENDIF
  4490.  
  4491.       LOCATE FOR platform = m.g_toplatform ;
  4492.          AND objtype = c_otband AND objcode = 7
  4493.       IF FOUND()
  4494.          REPLACE height WITH height + bands[m.colFooter,c_tobandheight]
  4495.       ENDIF
  4496.  
  4497.       =ADEL(bands,m.colfooter)
  4498.       m.bandcount = m.bandcount - 1
  4499.    ENDIF
  4500.  
  4501.    IF m.colheader > 0 AND m.pageheader > 0
  4502.       bands[m.pageHeader,c_tobandheight];
  4503.          = bands[m.pageHeader,c_tobandheight] ;
  4504.          + bands[m.colHeader,c_tobandheight]
  4505.       bands[m.pageHeader,c_fmbandheight] ;
  4506.          = bands[m.pageHeader,c_fmbandheight] ;
  4507.          + bands[m.colHeader,c_fmbandheight]
  4508.  
  4509.       LOCATE FOR platform = m.g_toplatform AND objtype = c_otband AND objcode = 2
  4510.       IF FOUND()
  4511.          DELETE
  4512.       ENDIF
  4513.  
  4514.       LOCATE FOR platform = m.g_toplatform AND objtype = c_otband AND objcode = 1
  4515.       IF FOUND()
  4516.          REPLACE height WITH height + bands[m.colHeader,c_tobandheight]
  4517.       ENDIF
  4518.  
  4519.       =ADEL(bands,m.colheader)
  4520.       m.bandcount = m.bandcount - 1
  4521.    ENDIF
  4522. ENDIF
  4523. RETURN m.bandcount
  4524.  
  4525.  
  4526. *!*****************************************************************************
  4527. *!
  4528. *!      Procedure: CLONEBAND
  4529. *!
  4530. *!      Called by: RPTCONVERT         (procedure in TRANSPRT.PRG)
  4531. *!
  4532. *!*****************************************************************************
  4533. PROCEDURE cloneband
  4534. * Copy the band header record data into the respective footer bands.  Data in band header
  4535. * and footer records must match on Windows.  The main data that needs to match is the
  4536. * group expression and things like how many spaces to require after a heading
  4537. * before doing a page break.
  4538. PRIVATE m.in_area, m.in_rec, m.pivot, m.ouniqid, m.ovpos, m.ohpos, m.owidth, m.oheight,;
  4539.    m.oobjcode, m.headband
  4540. IF m.g_char2grph
  4541.    m.in_area = SELECT()
  4542.    m.in_rec = RECNO()
  4543.    * First find the detail band.  It acts as a pivot.
  4544.    GOTO TOP
  4545.    LOCATE FOR platform = m.g_toplatform ;
  4546.       AND objtype = c_otband ;
  4547.       AND objcode = 4     && detail band has code = 4
  4548.    IF !FOUND()
  4549.       * Return and make the best of it
  4550.       RETURN
  4551.    ENDIF
  4552.    m.pivot = RECNO()
  4553.  
  4554.    * Scan for each of the header bands
  4555.    SCAN FOR platform = m.g_toplatform ;
  4556.          AND objtype = c_otband ;
  4557.          AND objcode < 4 AND objcode > 0
  4558.       SCATTER MEMVAR MEMO
  4559.  
  4560.       m.headband = RECNO()
  4561.  
  4562.       * Go to the matching footer band record
  4563.       GOTO (m.pivot + (m.pivot - RECNO()))
  4564.  
  4565.       * Store the values we don't want to copy from the header
  4566.       m.ouniqid  = uniqueid
  4567.       m.ovpos    = vpos
  4568.       m.ohpos    = hpos
  4569.       m.oheight  = height
  4570.       m.oobjcode = objcode
  4571.  
  4572.       * Stuff header data into this footer band
  4573.       GATHER MEMVAR MEMO
  4574.  
  4575.       * Restore the data we didn't want to copy from the header
  4576.       REPLACE vpos WITH m.ovpos, hpos WITH m.ohpos, ;
  4577.          height WITH m.oheight, objcode WITH m.oobjcode, ;
  4578.          uniqueid WITH m.ouniqid
  4579.  
  4580.       GOTO (m.headband)
  4581.  
  4582.    ENDSCAN
  4583.    SELECT (m.in_area)
  4584.    GOTO (MIN(m.in_rec,RECCOUNT()))
  4585. ENDIF
  4586.  
  4587. RETURN
  4588.  
  4589. *
  4590. * RESIZEBAND - Resize the character mode report band to accommodate
  4591. * boxes, etc.
  4592. *
  4593. *!*****************************************************************************
  4594. *!
  4595. *!      Procedure: RESIZEBAND
  4596. *!
  4597. *!      Called by: BANDINFO()         (function  in TRANSPRT.PRG)
  4598. *!
  4599. *!          Calls: CVTREPORTVERTICAL()(function  in TRANSPRT.PRG)
  4600. *!
  4601. *!*****************************************************************************
  4602. PROCEDURE resizeband
  4603. PARAMETER tobandheight, fmbandvpos, fmbandheight
  4604.  
  4605. PRIVATE in_rec, minbandheight
  4606. m.in_rec = RECNO()
  4607. m.minbandheight = m.tobandheight
  4608. IF m.g_grph2char
  4609.    * Search for boxes that lie entirely within this band.
  4610.    SCAN FOR platform = m.g_fromplatform ;
  4611.          AND objtype = c_otbox AND vpos >= m.fmbandvpos ;
  4612.          AND vpos + height <= m.fmbandvpos + m.fmbandheight
  4613.       * The box needs to be expanded
  4614.       m.minbandheight = MAX(m.minbandheight,cvtreportvertical(height)+1)
  4615.       * If there is a box in the band, always make it at least three rows
  4616.       m.minbandheight = MAX(m.minbandheight,3)
  4617.    ENDSCAN
  4618. ENDIF
  4619. GOTO RECORD (m.in_rec)
  4620. RETURN CEILING(m.minbandheight)
  4621.  
  4622. *
  4623. * BandHeight - Given a band ID and platform, this function reurns the band's
  4624. *      starting position in that platform.
  4625. *
  4626. *!*****************************************************************************
  4627. *!
  4628. *!       Function: BANDPOS
  4629. *!
  4630. *!      Called by: NEWBANDS           (procedure in TRANSPRT.PRG)
  4631. *!               : EMPTYBAND()        (function  in TRANSPRT.PRG)
  4632. *!
  4633. *!*****************************************************************************
  4634. FUNCTION bandpos
  4635. PARAMETER m.objid, m.platform
  4636. PRIVATE m.saverec, m.bandstart
  4637. m.saverec = RECNO()
  4638. m.bandstart = 0
  4639.  
  4640. SCAN FOR platform = m.platform AND objtype = c_otband
  4641.    IF uniqueid <> m.objid
  4642.       IF m.platform = c_dosname OR m.platform = c_unixname
  4643.          m.bandstart = m.bandstart + height
  4644.       ELSE
  4645.          m.bandstart = m.bandstart + height + m.g_bandheight + (m.g_bandfudge/m.g_pixelsize)
  4646.       ENDIF
  4647.    ELSE
  4648.       LOCATE FOR .F.
  4649.    ENDIF
  4650. ENDSCAN
  4651.  
  4652. GOTO RECORD (m.saverec)
  4653. RETURN m.bandstart
  4654.  
  4655. *
  4656. * EmptyBand - Given a band ID, this funtion determines if the band is empty.
  4657. *
  4658. *!*****************************************************************************
  4659. *!
  4660. *!       Function: EMPTYBAND
  4661. *!
  4662. *!      Called by: RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  4663. *!
  4664. *!          Calls: BANDPOS()          (function  in TRANSPRT.PRG)
  4665. *!
  4666. *!*****************************************************************************
  4667. FUNCTION emptyband
  4668. PARAMETER m.id
  4669. PRIVATE m.saverec, m.bandstart, m.bandheight, m.retval
  4670. IF m.g_toplatform = c_dosname OR m.g_toplatform = c_unixname
  4671.    RETURN .F.
  4672. ENDIF
  4673.  
  4674. m.saverec = RECNO()
  4675. m.retval = .F.
  4676.  
  4677. LOCATE FOR platform = m.g_fromplatform AND uniqueid = m.id
  4678. IF FOUND()
  4679.    m.bandheight = height
  4680.    m.bandstart = bandpos(m.id, m.g_fromplatform)
  4681.    * Look for objects in this band
  4682.    LOCATE FOR platform = m.g_fromplatform AND ;
  4683.       (objtype = c_otline OR objtype = c_otbox OR ;
  4684.       objtype = c_ottext OR objtype = c_otrepfld) AND ;
  4685.       vpos >= m.bandstart AND vpos < m.bandstart + m.bandheight
  4686.    IF !FOUND() AND m.g_char2grph
  4687.       * Look for a DOS box or line that ends in the band
  4688.       GOTO TOP
  4689.       LOCATE FOR platform = m.g_fromplatform AND ;
  4690.          INLIST(objtype,c_otbox, c_otline) AND ;
  4691.          vpos + height - 1 >= m.bandstart AND vpos + height - 1 < m.bandstart + m.bandheight
  4692.    ENDIF
  4693.    m.retval = !FOUND()
  4694. ENDIF
  4695.  
  4696. GOTO RECORD (m.saverec)
  4697. RETURN m.retval
  4698.  
  4699. *
  4700. * GETBANDCODE - returns band objcode given a vpos
  4701. *
  4702. *!*****************************************************************************
  4703. *!
  4704. *!       Function: GETBANDCODE
  4705. *!
  4706. *!      Called by: SUPPRESSBLANKLINES (procedure in TRANSPRT.PRG)
  4707. *!
  4708. *!*****************************************************************************
  4709. FUNCTION getbandcode
  4710. PARAMETER m.thisvpos
  4711. PRIVATE m.in_num, m.retcode
  4712. retcode = -1
  4713. m.in_num = RECNO()
  4714. m.startvpos = 0
  4715.  
  4716. IF INLIST(objtype,c_otheader, c_otband, c_otrel, c_otworkar, c_otindex)
  4717.    RETURN -1
  4718. ENDIF
  4719.  
  4720. SET FILTER TO platform = m.g_toplatform AND (objtype = c_otband)
  4721. GOTO TOP
  4722. DO WHILE m.startvpos <= m.thisvpos AND !EOF()
  4723.    IF m.startvpos + height +m.g_bandheight > m.thisvpos
  4724.       retcode = objcode
  4725.       EXIT
  4726.    ELSE
  4727.       m.startvpos = m.startvpos + height + m.g_bandheight
  4728.       SKIP
  4729.    ENDIF
  4730. ENDDO
  4731. SET FILTER TO
  4732. GOTO m.in_num
  4733. RETURN retcode
  4734.  
  4735.  
  4736. *!*****************************************************************************
  4737. *!
  4738. *!       Function: GRPHRPTCVT
  4739. *!
  4740. *!*****************************************************************************
  4741. PROCEDURE grphrptcvt
  4742. PRIVATE m.bandnum
  4743. * Convert single report object from one graphical platform to another
  4744. * The vpos adjustment reflects the fact that Windows report bands are
  4745. * 20 pixels high while Mac ones are 15 pixels high.
  4746. IF m.g_filetype = c_report    && labels don't require this conversion
  4747.     DO CASE
  4748.     CASE _WINDOWS
  4749.        IF objtype = c_ottext
  4750.           * Compute text object width exactly
  4751.           REPLACE width  WITH gettextwidth(expr)
  4752.        ENDIF
  4753.     CASE _MAC
  4754.         DO CASE
  4755.        CASE objtype = c_ottext
  4756.           * Compute text object width exactly
  4757.           REPLACE width  WITH gettextwidth(expr)
  4758.        CASE objtype = c_otpicture
  4759.           REPLACE width WITH width * 96 / 72
  4760.        ENDCASE
  4761.       IF !m.g_newobjmode OR objtype = c_otband
  4762.          m.bandnum = getbandnum(vpos,"WINDOWS")
  4763.          IF objtype <> c_otline OR height > width
  4764.             REPLACE height WITH height * 96 / 72
  4765.          ENDIF
  4766.          REPLACE vpos    WITH (vpos - ((m.bandnum-1) * (5/96) * 10000)) * 96 / 72
  4767.       ENDIF
  4768.    ENDCASE
  4769. ENDIF
  4770.  
  4771. *!*****************************************************************************
  4772. *!
  4773. *!       Function: GETBANDNUM
  4774. *!
  4775. *!*****************************************************************************
  4776. FUNCTION getbandnum
  4777. PARAMETER m.theVpos, m.thePlat
  4778. PRIVATE m.bandno, m.past, m.cumvpos, m.therec
  4779. * Returns the band number that an object falls into.
  4780. m.bandno = 0
  4781. m.past = .F.
  4782. m.cumvpos = 0
  4783. m.therec = RECNO()
  4784. SCAN FOR platform = m.thePlat AND objtype = c_otband AND !m.past
  4785.    m.cumvpos = m.cumvpos + height
  4786.    IF m.bandno > 0
  4787.       m.cumvpos = m.cumvpos + m.g_bandheight + (m.g_bandfudge/m.g_pixelsize)
  4788.    ENDIF
  4789.    IF m.cumvpos >= m.theVpos
  4790.       m.past = .T.
  4791.    ENDIF
  4792.    m.bandno = m.bandno + 1
  4793. ENDSCAN
  4794. GOTO m.therec
  4795. IF m.past
  4796.    RETURN m.bandno
  4797. ELSE
  4798.    RETURN -1    && couldn't find the band
  4799. ENDIF
  4800.  
  4801. *!*****************************************************************************
  4802. *!
  4803. *!       Function: GETTEXTWIDTH
  4804. *!
  4805. *!*****************************************************************************
  4806. FUNCTION gettextwidth
  4807. PARAMETER m.strg
  4808. * Figure out how many 10000-ths of an inch a text object requires
  4809.  
  4810. * Don't count the quotation marks
  4811. m.strg = ALLTRIM(CHRTRAN(expr,CHR(0),""))
  4812. IF LEFT(m.strg,1) = '"'
  4813.    m.strg = SUBSTR(m.strg,2)
  4814. ENDIF
  4815. IF RIGHT(m.strg,1) = '"'
  4816.    m.strg = SUBSTR(m.strg,1,LEN(m.strg)-1)
  4817. ENDIF
  4818.  
  4819. RETURN TXTWIDTH(m.strg,fontface,fontsize,num2style(fontstyle)) * ;
  4820.       FONTMETRIC(6,fontface,fontsize,num2style(fontstyle)) * 10000 / m.g_pixelsize
  4821.  
  4822. *
  4823. * CvtReportVertical - Convert report vertical dimensions between 10000ths of an inch and characters
  4824. *      depending on the to platform.  (This function is for vertical dimensions only).
  4825. *
  4826. *!*****************************************************************************
  4827. *!
  4828. *!       Function: CVTREPORTVERTICAL
  4829. *!
  4830. *!      Called by: RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  4831. *!               : RESIZEBAND         (procedure in TRANSPRT.PRG)
  4832. *!
  4833. *!*****************************************************************************
  4834. FUNCTION cvtreportvertical
  4835. PARAMETER m.units
  4836. DO CASE
  4837. CASE m.g_grph2char
  4838.    RETURN m.units/10000 * c_linesperinch
  4839. CASE m.g_char2grph
  4840.    RETURN (m.units * m.g_rptlinesize) + (5000/m.g_pixelsize)
  4841. OTHERWISE
  4842.    RETURN m.units
  4843. ENDCASE
  4844.  
  4845. *
  4846. * CvtReportWidth - Convert report horizontal dimensions between 10000ths of an inch
  4847. *      and chanracters depending on the to platform.
  4848. *
  4849. *!*****************************************************************************
  4850. *!
  4851. *!       Function: CVTREPORTHORIZONTAL
  4852. *!
  4853. *!      Called by: RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  4854. *!
  4855. *!*****************************************************************************
  4856. FUNCTION cvtreporthorizontal
  4857. PARAMETER m.units
  4858. DO CASE
  4859. CASE m.g_grph2char
  4860.    RETURN m.units/10000 * c_charsperinch
  4861. CASE m.g_char2grph
  4862.    RETURN m.units * m.g_rptcharsize
  4863. OTHERWISE
  4864.    RETURN m.units
  4865. ENDCASE
  4866. *!*****************************************************************************
  4867. *!
  4868. *!       Function: CVTRPTLINES
  4869. *!
  4870. *!      Called by: RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  4871. *!
  4872. *!*****************************************************************************
  4873. FUNCTION cvtrptlines
  4874. * Adjust the height of horizontal lines
  4875. PARAMETER m.height
  4876. IF _MAC
  4877.    * Adjust for 72 to 96 conversion
  4878.    m.height = m.height * 72 / 96
  4879. ENDIF
  4880. DO CASE
  4881. CASE g_char2grph
  4882.    DO CASE
  4883.    CASE BETWEEN(m.height,0,200)
  4884.       RETURN 104
  4885.    CASE BETWEEN(m.height,200,600)
  4886.       RETURN 520
  4887.    CASE BETWEEN(m.height,600,850)
  4888.       RETURN 850
  4889.    OTHERWISE
  4890.       RETURN m.height
  4891.    ENDCASE
  4892. OTHERWISE
  4893.    RETURN m.height
  4894. ENDCASE
  4895.  
  4896. *
  4897. * MergeLabelObjects - Combines report objects which lie on the same line
  4898. *      when going from a graphical platform to a character platform.
  4899. *
  4900. *!*****************************************************************************
  4901. *!
  4902. *!      Procedure: MERGELABELOBJECTS
  4903. *!
  4904. *!      Called by: ALLGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  4905. *!
  4906. *!          Calls: LABELOBJMERGE      (procedure in TRANSPRT.PRG)
  4907. *!
  4908. *!        Indexes: TEMP                   (tag)
  4909. *!
  4910. *!*****************************************************************************
  4911. PROCEDURE mergelabelobjects
  4912.  
  4913. IF !m.g_grph2grph
  4914.     INDEX ON platform+STR(vpos,3)+STR(hpos,3) TAG temp
  4915.  
  4916.     SCAN FOR platform = m.g_toplatform AND !DELETED() AND ;
  4917.           (objtype = c_otrepfld OR objtype = c_ottext OR objtype = c_otbox OR objtype = c_otline)
  4918.        DO labelobjmerge WITH RECNO()
  4919.     ENDSCAN
  4920.  
  4921.     DELETE TAG temp
  4922. ENDIF
  4923. RETURN
  4924.  
  4925. *
  4926. * LabelObjMerge - Given a record which is a report object, this function tries to find a label
  4927. *      object on the same line and combine them.  If no label object exists on the line, the
  4928. *      record is turned into one.
  4929. *
  4930. *!*****************************************************************************
  4931. *!
  4932. *!      Procedure: LABELOBJMERGE
  4933. *!
  4934. *!      Called by: MERGELABELOBJECTS  (procedure in TRANSPRT.PRG)
  4935. *!
  4936. *!*****************************************************************************
  4937. PROCEDURE labelobjmerge
  4938. PARAMETER m.recno
  4939. PRIVATE m.saverec, m.vpos, m.hpos, m.width, m.height, m.expr, m.type, m.picture
  4940.  
  4941. m.saverec = RECNO()
  4942. GOTO RECORD (m.recno)
  4943.  
  4944. m.vpos = vpos
  4945. m.width = WIDTH
  4946. m.expr = expr
  4947. m.type = fillchar
  4948. m.picture = PICTURE
  4949. DELETE
  4950.  
  4951. LOCATE FOR platform = m.g_toplatform AND !DELETED() AND ;
  4952.    objtype = c_ot20lbxobj AND vpos = m.vpos
  4953. IF FOUND()
  4954.    REPLACE expr WITH expr + "," + m.expr
  4955. ELSE
  4956.    GOTO RECORD (m.recno)
  4957.    RECALL
  4958.    REPLACE objtype WITH c_ot20lbxobj
  4959. ENDIF
  4960.  
  4961. GOTO RECORD (m.saverec)
  4962.  
  4963. *
  4964. * AddLabelBlanks - Adds sufficient blank lines to make the converted lines
  4965. *
  4966. *!*****************************************************************************
  4967. *!
  4968. *!      Procedure: ADDLABELBLANKS
  4969. *!
  4970. *!           Uses: M.G_SCRNALIAS
  4971. *!
  4972. *!*****************************************************************************
  4973. PROCEDURE addlabelblanks
  4974. PRIVATE m.linecount, m.last, m.scanloop
  4975. SELECT vpos FROM m.g_scrnalias ;
  4976.    WHERE !DELETED() AND platform = m.g_toplatform AND objtype = c_ot20lbxobj ;
  4977.    ORDER BY vpos ;
  4978.    INTO ARRAY lines
  4979.  
  4980. m.linecount = _TALLY
  4981. m.last = 0
  4982. FOR m.scanloop = 1 TO lines[m.linecount]
  4983.    IF ASCAN(lines, m.scanloop) = 0
  4984.       APPEND BLANK
  4985.       REPLACE platform WITH m.g_toplatform
  4986.       REPLACE objtype WITH c_ot20lbxobj
  4987.       REPLACE vpos WITH m.lines
  4988.    ENDIF
  4989. ENDFOR
  4990. RETURN
  4991.  
  4992. *
  4993. * LinesBetween - Removes all the whitespace from the bottom of the detail
  4994. *      band and puts it in lines between.
  4995. *
  4996. *!*****************************************************************************
  4997. *!
  4998. *!      Procedure: LINESBETWEEN
  4999. *!
  5000. *!      Called by: ALLGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  5001. *!
  5002. *!*****************************************************************************
  5003. PROCEDURE linesbetween
  5004. PRIVATE m.linecount, m.blanklines
  5005.  
  5006. IF !m.g_grph2grph
  5007.     COUNT TO m.linecount FOR platform = m.g_toplatform AND objtype = c_ot20lbxobj
  5008.  
  5009.     LOCATE FOR platform = m.g_toplatform AND objtype = c_otband AND objcode = 4
  5010.     IF FOUND() AND m.linecount < height
  5011.        m.blanklines = height - m.linecount
  5012.        REPLACE height WITH m.linecount
  5013.        LOCATE FOR platform = m.g_toplatform AND objtype = c_ot20label
  5014.        IF FOUND()
  5015.           REPLACE penblue WITH m.blanklines
  5016.        ENDIF
  5017.     ENDIF
  5018. ENDIF
  5019.  
  5020. *
  5021. * labelBands - Adds the group records needed by a graphical label
  5022. *
  5023. *!*****************************************************************************
  5024. *!
  5025. *!      Procedure: LABELBANDS
  5026. *!
  5027. *!      Called by: ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  5028. *!
  5029. *!*****************************************************************************
  5030. PROCEDURE labelbands
  5031. PRIVATE m.lbxheight, m.lbxwidth, m.lbxlinesbet
  5032.  
  5033. LOCATE FOR platform = m.g_fromplatform AND objtype = c_otband AND objcode = 4
  5034. IF FOUND()
  5035.    m.lbxheight = height
  5036. ENDIF
  5037.  
  5038. LOCATE FOR platform = m.g_fromplatform AND objtype = c_ot20label
  5039. IF FOUND()
  5040.    DO CASE
  5041.    CASE name = '3 1/2" x 15/16" x 1' AND penblue = 1 AND ;
  5042.          WIDTH = 35 AND m.lbxheight = 5 AND vpos = 1 AND hpos = 0 AND height = 0
  5043.       m.lbxheight = (15/16) * 10000
  5044.       m.lbxwidth = -1
  5045.       m.lbxlinesbet = m.lbxheight / 5
  5046.  
  5047.    CASE name = '3 1/2" x 15/16" x 2' AND penblue = 1 AND ;
  5048.          WIDTH = 35 AND m.lbxheight = 5 AND vpos = 2 AND hpos = 0 AND height = 2
  5049.       m.lbxheight = (15/16) * 10000
  5050.       m.lbxwidth = (3 + (1/2)) * 10000
  5051.       m.lbxlinesbet = m.lbxheight / 5
  5052.  
  5053.    CASE name = '3 1/2" x 15/16" x 3' AND penblue = 1 AND ;
  5054.          WIDTH = 35 AND m.lbxheight = 5 AND vpos = 3 AND hpos = 0 AND height = 2
  5055.       m.lbxheight = (15/16) * 10000
  5056.       m.lbxwidth = (3 + (1/2)) * 10000
  5057.       m.lbxlinesbet = m.lbxheight / 5
  5058.  
  5059.    CASE name = '3 2/10" x 11/12" x 3 (Cheshire)' AND penblue = 1 AND ;
  5060.          WIDTH = 32 AND m.lbxheight = 5 AND vpos = 3 AND hpos = 0 AND height = 2
  5061.       m.lbxheight = (11/12) * 10000
  5062.       m.lbxwidth = (3 + (2/10)) * 10000
  5063.       m.lbxlinesbet = m.lbxheight / 5
  5064.  
  5065.    CASE name = '3" x 5 Rolodex' AND penblue = 4 AND ;
  5066.          WIDTH = 50 AND m.lbxheight = 14 AND vpos = 1 AND hpos = 0 AND height = 0
  5067.       m.lbxheight = 5 * 10000
  5068.       m.lbxwidth = -1
  5069.       m.lbxlinesbet = 4 * (m.lbxheight / 14)
  5070.  
  5071.    CASE name = '4" x 1 7/16" x 1' AND penblue = 1 AND ;
  5072.          WIDTH = 40 AND m.lbxheight = 8 AND vpos = 1 AND hpos = 0 AND height = 0
  5073.       m.lbxheight = (1 + (7/16)) * 10000
  5074.       m.lbxwidth = -1
  5075.       m.lbxlinesbet = m.lbxheight / 8
  5076.  
  5077.    CASE name = '4" x 2 1/4 Rolodex' AND penblue = 1 AND ;
  5078.          WIDTH = 40 AND m.lbxheight = 10 AND vpos = 1 AND hpos = 0 AND height = 0
  5079.       m.lbxheight = (2 + (1/4)) * 10000
  5080.       m.lbxwidth = -1
  5081.       m.lbxlinesbet = m.lbxheight / 10
  5082.  
  5083.    CASE name = '6 1/2" x 3 5/8 Envelope' AND penblue = 8 AND ;
  5084.          WIDTH = 65 AND m.lbxheight = 14 AND vpos = 1 AND hpos = 0 AND height = 0
  5085.       m.lbxheight = (3 + (5/8)) * 10000
  5086.       m.lbxwidth = -1
  5087.       m.lbxlinesbet = 8 * (m.lbxheight / 14)
  5088.  
  5089.    CASE name = '9 7/8" x 7 1/8 Envelope' AND penblue = 8 AND ;
  5090.          WIDTH = 78 AND m.lbxheight = 17 AND vpos = 1 AND hpos = 0 AND height = 0
  5091.       m.lbxheight = (7 + (1/8)) * 10000
  5092.       m.lbxwidth = -1
  5093.       m.lbxlinesbet = 8 * (m.lbxheight / 17)
  5094.  
  5095.    OTHERWISE
  5096.       m.lbxheight = m.lbxheight * m.g_rptlinesize
  5097.       m.lbxwidth = IIF(vpos > 1, WIDTH * m.g_rptcharsize, -1)
  5098.       m.lbxlinesbet = penblue * m.g_rptlinesize
  5099.    ENDCASE
  5100. ELSE
  5101.    RETURN
  5102. ENDIF
  5103.  
  5104. LOCATE FOR platform = m.g_toplatform AND objtype = c_otheader
  5105. IF FOUND()
  5106.    REPLACE vpos WITH IIF(vpos > 1, vpos * m.g_rptlinesize, 1)
  5107.    REPLACE WIDTH WITH m.lbxwidth
  5108.    REPLACE hpos WITH hpos * m.g_rptcharsize      && Left margin
  5109.    REPLACE height WITH height * m.g_rptcharsize   && Spaces Between Columns
  5110. ENDIF
  5111.  
  5112. LOCATE FOR platform = m.g_toplatform AND objtype = c_otband AND objcode = 4
  5113. IF FOUND()
  5114.    REPLACE height WITH m.lbxheight + m.lbxlinesbet
  5115. ENDIF
  5116.  
  5117. *
  5118. * labelLines - Converts the character style label objects to graphical report objects
  5119. *
  5120. *!*****************************************************************************
  5121. *!
  5122. *!      Procedure: LABELLINES
  5123. *!
  5124. *!      Called by: ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  5125. *!
  5126. *!          Calls: ADJFONT            (procedure in TRANSPRT.PRG)
  5127. *!               : ADJCOLOR           (procedure in TRANSPRT.PRG)
  5128. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  5129. *!
  5130. *!*****************************************************************************
  5131. PROCEDURE labellines
  5132. PRIVATE m.bandstart, m.linecount, m.thermstep, m.lbxwidth, ;
  5133.    m.saverec, m.nextexpr, m.loop
  5134.  
  5135. COUNT TO m.thermstep FOR platform = m.g_toplatform AND objtype = c_ot20lbxobj
  5136. m.thermstep = 45 / m.thermstep
  5137. m.bandstart = 4166.667
  5138.  
  5139. LOCATE FOR platform = m.g_toplatform AND objtype = c_otheader
  5140. IF WIDTH != -1
  5141.    m.lbxwidth = WIDTH
  5142. ELSE
  5143.    LOCATE FOR platform = m.g_fromplatform AND objtype = c_ot20label
  5144.    m.lbxwidth = WIDTH * m.g_rptcharsize
  5145. ENDIF
  5146.  
  5147. m.linecount = 0
  5148.  
  5149. SCAN FOR platform = m.g_toplatform AND objtype = c_ot20lbxobj AND !DELETED()
  5150.    REPLACE expr WITH ALLTRIM(expr)
  5151.    REPLACE objtype WITH c_otrepfld
  5152.    REPLACE objcode WITH 0
  5153.    REPLACE vpos WITH m.bandstart + (m.linecount * m.g_rptlinesize)
  5154.    REPLACE hpos WITH 0
  5155.    REPLACE height WITH m.g_rptlinesize
  5156.    REPLACE WIDTH WITH m.lbxwidth
  5157.    REPLACE fillchar WITH "C"
  5158.    REPLACE FLOAT WITH .F.
  5159.    REPLACE STRETCH WITH .F.
  5160.    REPLACE spacing WITH 12
  5161.    REPLACE offset WITH 0
  5162.    REPLACE totaltype WITH 0
  5163.    REPLACE TOP WITH .T.
  5164.    REPLACE resettotal WITH 1
  5165.    REPLACE supalways WITH .T.
  5166.    REPLACE supovflow WITH .F.
  5167.    REPLACE suprpcol WITH 3
  5168.    REPLACE supgroup WITH 0
  5169.    REPLACE supvalchng WITH .F.
  5170.  
  5171.    DO adjfont
  5172.    DO adjcolor
  5173.  
  5174.    m.loop = (RIGHT(expr,1) = ";")
  5175.    DO WHILE m.loop
  5176.       m.saverec = RECNO()
  5177.       SKIP
  5178.       DO WHILE platform = m.g_toplatform AND objtype = c_ot20lbxobj AND DELETED()
  5179.          SKIP
  5180.       ENDDO
  5181.       IF platform = m.g_toplatform AND objtype = c_ot20lbxobj
  5182.          DELETE
  5183.          m.nextexpr = expr
  5184.          GOTO RECORD (m.saverec)
  5185.          REPLACE expr WITH expr + m.nextexpr
  5186.          REPLACE height WITH height + m.g_rptlinesize
  5187.          m.loop = (RIGHT(expr,1) = ";")
  5188.       ELSE
  5189.          GOTO RECORD (m.saverec)
  5190.          m.loop = .F.
  5191.       ENDIF
  5192.    ENDDO
  5193.  
  5194.    m.linecount = m.linecount + 1
  5195.  
  5196.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  5197.    DO updtherm WITH m.g_mercury
  5198. ENDSCAN
  5199.  
  5200. *
  5201. * calcpositions - Calculate each objects position as a percentage across
  5202. *            and down the window.
  5203. *
  5204. *!*****************************************************************************
  5205. *!
  5206. *!      Procedure: CALCPOSITIONS
  5207. *!
  5208. *!      Called by: ALLOTHERS          (procedure in TRANSPRT.PRG)
  5209. *!
  5210. *!*****************************************************************************
  5211. PROCEDURE calcpositions
  5212. PARAMETER m.index
  5213. PRIVATE m.record, m.vert, m.horiz, m.width, m.numothers, m.thermstep, m.i
  5214. *
  5215. * Search for the original platform records and establish the horizontal
  5216. * and vertical positioning percentages.
  5217. *
  5218.  
  5219. objectpos[m.index, 1] = hpos / m.g_windwidth
  5220. objectpos[m.index, 2] = vpos / m.g_windheight
  5221. objectpos[m.index, 3] = uniqueid
  5222. objectpos[m.index, 4] = objtype
  5223. objectpos[m.index, 5] = .F.                && right aligned with object above or below?
  5224. objectpos[m.index, 6] = hpos
  5225. objectpos[m.index, 7] = WIDTH
  5226. objectpos[m.index, 8] = spacing
  5227. objectpos[m.index, 9] = PICTURE
  5228.  
  5229. IF objtype = c_ottext
  5230.    m.record = RECNO()
  5231.    m.vert1 = vpos
  5232.    m.horiz = hpos
  5233.    m.endpos = hpos + WIDTH
  5234.  
  5235.    LOCATE FOR objtype = c_ottext AND hpos != m.horiz AND ;
  5236.       m.vert1 - 1 = vpos AND hpos + WIDTH = m.endpos
  5237.    IF FOUND()
  5238.       objectpos[m.index,5] = .T.
  5239.       DO WHILE FOUND()
  5240.          IF objectpos[m.index, 7] < WIDTH
  5241.             objectpos[m.index, 7] = WIDTH
  5242.          ENDIF
  5243.          m.vert = vpos
  5244.          LOCATE FOR objtype = c_ottext AND hpos != m.horiz AND ;
  5245.             m.vert - 1 = vpos AND hpos + WIDTH = m.endpos
  5246.       ENDDO
  5247.    ENDIF
  5248.    LOCATE FOR objtype = c_ottext AND hpos != m.horiz AND ;
  5249.       m.vert1 + 1 = vpos AND hpos + WIDTH = m.endpos
  5250.  
  5251.    IF FOUND()
  5252.       objectpos[m.index,5] = .T.
  5253.       DO WHILE FOUND()
  5254.          IF objectpos[m.index, 7] < WIDTH
  5255.             objectpos[m.index, 7] = WIDTH
  5256.          ENDIF
  5257.          m.vert = vpos
  5258.          LOCATE FOR objtype = c_ottext AND hpos != m.horiz AND ;
  5259.             m.vert + 1 = vpos AND hpos + WIDTH = m.endpos
  5260.       ENDDO
  5261.    ENDIF
  5262.  
  5263.    GOTO RECORD m.record
  5264.    IF objectpos[m.index, 5]
  5265.       objectpos[m.index, 6] = hpos + WIDTH - 1
  5266.       objectpos[m.index, 1] = (hpos + WIDTH) / m.g_windwidth
  5267.    ENDIF
  5268.  
  5269. ENDIF
  5270.  
  5271. *
  5272. * calcwindowdimensions - Calculate the needed Height and Width for the new window
  5273. *
  5274. *!*****************************************************************************
  5275. *!
  5276. *!      Procedure: CALCWINDOWDIMENSIONS
  5277. *!
  5278. *!      Called by: ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  5279. *!
  5280. *!          Calls: FINDWIDEROBJECTS   (procedure in TRANSPRT.PRG)
  5281. *!               : HORIZBUTTON()      (function  in TRANSPRT.PRG)
  5282. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  5283. *!               : REPOOBJECTS        (procedure in TRANSPRT.PRG)
  5284. *!
  5285. *!        Indexes: UNIQUEID               (tag)
  5286. *!
  5287. *!*****************************************************************************
  5288. PROCEDURE calcwindowdimensions
  5289. PRIVATE m.i, m.curline, m.largestobj, m.lineheight, m.adjwindowwidth, m.thermstep
  5290.  
  5291. INDEX ON uniqueid + platform TAG uniqueid OF (m.g_tempindex) ADDITIVE
  5292.  
  5293. SELECT (m.g_fromobjonlyalias)
  5294. SET RELATION OFF INTO (m.g_scrnalias)
  5295. SET RELATION TO uniqueid+m.g_toplatform INTO (m.g_scrnalias) ADDITIVE
  5296. SELECT (m.g_scrnalias)
  5297.  
  5298. m.adjwindwidth = 0
  5299. DO findwiderobjects WITH m.adjwindwidth
  5300.  
  5301. =ASORT(objectpos,2)
  5302. STORE 0 TO m.curline, m.largestobj, m.lineheight, m.adjheight
  5303. m.thermstep = 10 / m.objindex
  5304.  
  5305. FOR m.i = 1 TO m.objindex
  5306.  
  5307.    IF objectpos[m.i,2] != m.curline
  5308.       m.adjheight = m.adjheight + m.lineheight
  5309.       STORE 0 TO m.lineheight, m.largestobj
  5310.       m.curline = objectpos[m.i,2]
  5311.    ENDIF
  5312.  
  5313.    IF m.largestobj != 3
  5314.       DO CASE
  5315.       CASE objectpos[m.i, 4] = c_ottxtbut AND m.largestobj < 3
  5316.          IF !horizbutton(objectpos[m.i, 9])
  5317.             m.numitems = OCCURS(';',objectpos[m.i, 9]) + 1
  5318.             m.lineheight = c_adjtbtn * m.numitems
  5319.          ELSE
  5320.             m.lineheight = c_adjtbtn
  5321.          ENDIF
  5322.          m.largestobj = 3
  5323.  
  5324.       CASE (objectpos[m.i, 4] = c_otradbut AND m.largestobj < 2) ;
  5325.             OR (objectpos[m.i, 4] = c_otchkbox AND m.largestobj < 2)
  5326.          IF objectpos[m.i, 4] = c_otradbut AND !horizbutton(objectpos[m.i, 9])
  5327.             m.numitems = OCCURS(';',objectpos[m.i, 9]) + 1
  5328.             m.lineheight = c_adjrbtn * m.numitems
  5329.          ELSE
  5330.             m.lineheight = c_adjrbtn
  5331.          ENDIF
  5332.          m.largestobj = 2
  5333.  
  5334.       CASE (objectpos[m.i, 4] = c_otlist AND m.largestobj < 1) ;
  5335.             OR (objectpos[m.i, 4] = c_otfield AND m.largestobj < 1)
  5336.          m.lineheight = c_adjlist
  5337.          m.largestobj = 1
  5338.  
  5339.       ENDCASE
  5340.    ENDIF
  5341.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  5342.    DO updtherm WITH m.g_mercury
  5343.  
  5344. ENDFOR
  5345. m.adjheight = m.adjheight + m.lineheight
  5346. LOCATE FOR platform = m.g_toplatform AND objtype = 1
  5347. IF FOUND()
  5348.    REPLACE WIDTH WITH WIDTH + m.adjwindwidth
  5349.    DO repoobjects WITH HEIGHT + m.adjheight
  5350. ENDIF
  5351.  
  5352. RETURN
  5353.  
  5354. *
  5355. * findWiderObjects - Find objects which have changed in size
  5356. *
  5357. *!*****************************************************************************
  5358. *!
  5359. *!      Procedure: FINDWIDEROBJECTS
  5360. *!
  5361. *!      Called by: CALCWINDOWDIMENSION(procedure in TRANSPRT.PRG)
  5362. *!
  5363. *!          Calls: HORIZBUTTON()      (function  in TRANSPRT.PRG)
  5364. *!               : SGN()              (function  in TRANSPRT.PRG)
  5365. *!               : ADJHPOS            (procedure in TRANSPRT.PRG)
  5366. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  5367. *!
  5368. *!*****************************************************************************
  5369. PROCEDURE findwiderobjects
  5370. PARAMETER m.adjwindowwidth
  5371. PRIVATE m.curcol, m.adjcol, m.i, m.rightalignflag, m.numitems, ;
  5372.    m.olduniqueid, m.oldwidth, m.buttonflag, m.newwidth, m.adjust, m.thermstep
  5373.  
  5374. m.thermstep = 10 / m.objindex
  5375.  
  5376. =ASORT(objectpos,6)   && sort on hpos
  5377. STORE 0 TO m.curcol, m.adjcol
  5378. m.rightalignflag = .F.
  5379.  
  5380. FOR m.i = 1 TO m.objindex
  5381.    * Start at the leftmost object
  5382.    IF objectpos[m.i,6] != m.curcol
  5383.       m.adjcol = 0
  5384.       m.rightalignflag = .F.
  5385.       m.curcol = objectpos[m.i,6]
  5386.    ENDIF
  5387.  
  5388.    DO CASE
  5389.    CASE objectpos[m.i, 4] = c_ottxtbut OR objectpos[m.i, 4] = c_otradbut
  5390.       * Count the objects in push buttons and radio buttons
  5391.       m.numitems = OCCURS(';',objectpos[m.i, 9]) + 1
  5392.       m.olduniqueid = objectpos[m.i, 3]
  5393.  
  5394.       IF horizbutton(objectpos[m.i, 9])
  5395.          m.oldwidth = (objectpos[m.i, 7] * m.numitems) + ;
  5396.             (objectpos[m.i, 8] * (m.numitems - 1))
  5397.          m.buttonflag = .T.
  5398.       ELSE
  5399.          m.buttonflag = .F.
  5400.          m.oldwidth = objectpos[m.i, 7]
  5401.       ENDIF
  5402.  
  5403.    OTHERWISE
  5404.       m.buttonflag = .F.
  5405.       m.oldwidth = objectpos[m.i, 7]
  5406.       m.olduniqueid = objectpos[m.i, 3]
  5407.  
  5408.    ENDCASE
  5409.  
  5410.    LOCATE FOR uniqueid = m.olduniqueid AND platform = m.g_toplatform
  5411.    IF FOUND()
  5412.       IF m.buttonflag
  5413.          m.newwidth = (WIDTH * m.numitems) + ;
  5414.             (spacing * (m.numitems - 1))
  5415.       ELSE
  5416.          m.newwidth = WIDTH
  5417.       ENDIF
  5418.       IF m.oldwidth != m.newwidth AND ;
  5419.             !(objtype = c_ottext ;
  5420.             AND ASC(SUBSTR(expr,2,1))>=179 ;
  5421.             AND ASC(SUBSTR(expr,2,1))<=218)
  5422.          m.adjust = m.newwidth - m.oldwidth
  5423.          IF ABS(m.adjust) > ABS(m.adjcol) OR sgn(m.adjust) <> sgn(m.adjcol)
  5424.             IF (!objectpos[m.i,5] OR !m.rightalignflag) AND m.adjust > 0
  5425.                * Move everything over
  5426.                DO adjhpos WITH m.adjust - m.adjcol, ;
  5427.                   IIF(objectpos[m.i,5], objectpos[m.i, 6], ;
  5428.                   objectpos[m.i, 6] + objectpos[m.i, 7] - 1)
  5429.  
  5430.                * Expand the window
  5431.                m.adjwindowwidth = m.adjwindowwidth + m.adjust - m.adjcol
  5432.  
  5433.                * AdjCol contains the cumulative adjustment
  5434.                m.adjcol = m.adjust
  5435.  
  5436.                IF objectpos[m.i, 5]
  5437.                   m.rightalignflag = .T.
  5438.                   REPLACE hpos WITH hpos + m.adjust - m.adjcol
  5439.                ENDIF
  5440.             ENDIF
  5441.          ENDIF
  5442.       ENDIF
  5443.    ENDIF
  5444.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  5445.    DO updtherm WITH m.g_mercury
  5446. ENDFOR
  5447. RETURN
  5448.  
  5449. *
  5450. * adjHpos - Adjust the horizontal position of objects across as other objects
  5451. *       become bigger or smaller.
  5452. *
  5453. *!*****************************************************************************
  5454. *!
  5455. *!      Procedure: ADJHPOS
  5456. *!
  5457. *!      Called by: FINDWIDEROBJECTS   (procedure in TRANSPRT.PRG)
  5458. *!
  5459. *!*****************************************************************************
  5460. PROCEDURE adjhpos
  5461. PARAMETER m.adjustment, m.position
  5462.  
  5463. SELECT (m.g_fromobjonlyalias)
  5464. SCAN FOR platform = m.g_fromplatform AND hpos >= m.position
  5465.    REPLACE &g_scrnalias..hpos WITH &g_scrnalias..hpos + m.adjustment
  5466. ENDSCAN
  5467.  
  5468. * Stretch lines that begin before the wider object and end after it starts.
  5469. SCAN FOR platform = m.g_fromplatform AND objtype = c_otbox AND height = 1 AND ;
  5470.       hpos < m.position AND hpos + WIDTH - 1 >= m.position
  5471.    REPLACE &g_scrnalias..width WITH &g_scrnalias..width + m.adjustment
  5472. ENDSCAN
  5473. SELECT (m.g_scrnalias)
  5474.  
  5475. *!*****************************************************************************
  5476. *!
  5477. *!       Function: SGN
  5478. *!
  5479. *!      Called by: FINDWIDEROBJECTS   (procedure in TRANSPRT.PRG)
  5480. *!
  5481. *!*****************************************************************************
  5482. FUNCTION sgn
  5483. PARAMETER num
  5484. DO CASE
  5485. CASE num = 0
  5486.    RETURN 0
  5487. CASE num > 0
  5488.    RETURN 1
  5489. CASE num < 0
  5490.    RETURN -1
  5491. ENDCASE
  5492.  
  5493.  
  5494. *
  5495. * repoObjects - Reposition objects to the relative positions on the new window.
  5496. *      This procedure assumes that the array objectpos is sorted on rows ([m.i, 2]).
  5497. *
  5498. *!*****************************************************************************
  5499. *!
  5500. *!      Procedure: REPOOBJECTS
  5501. *!
  5502. *!      Called by: CALCWINDOWDIMENSION(procedure in TRANSPRT.PRG)
  5503. *!
  5504. *!          Calls: GETLASTOBJECTLINE()(function  in TRANSPRT.PRG)
  5505. *!               : HORIZBUTTON()      (function  in TRANSPRT.PRG)
  5506. *!               : ADJBOX             (procedure in TRANSPRT.PRG)
  5507. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  5508. *!
  5509. *!*****************************************************************************
  5510. PROCEDURE repoobjects
  5511. PARAMETER m.windheight
  5512. PRIVATE m.windwidth, m.thermstep, m.rightalign, m.saverec, ;
  5513.    m.adjust, m.buttonadjust, m.numrb
  5514.  
  5515. m.saverec = RECNO()
  5516. m.windwidth = WIDTH
  5517. m.thermstep = 10 / m.objindex
  5518. STORE 0 TO m.adjust, m.buttonadjust, m.numrb
  5519.  
  5520. FOR m.i = 1 TO m.objindex
  5521.  
  5522.    IF objectpos[m.i,2] != m.curline
  5523.       IF m.numrb > 0
  5524.          m.adjust = m.adjust + c_vradbtn
  5525.          m.numrb = m.numrb - 1
  5526.       ENDIF
  5527.       m.adjust = m.adjust + m.buttonadjust
  5528.       STORE 0 TO m.buttonadjust
  5529.       m.curline = objectpos[m.i,2]
  5530.    ENDIF
  5531.  
  5532.    LOCATE FOR platform = m.g_toplatform AND uniqueid = objectpos[m.i,3]
  5533.    IF FOUND()
  5534.  
  5535.       g_lastobjectline[1] = getlastobjectline(g_lastobjectline[1], ;
  5536.          m.windheight * objectpos[m.i, 2] + m.adjust)
  5537.  
  5538.       REPLACE vpos WITH m.windheight * objectpos[m.i, 2] + m.adjust
  5539.  
  5540.       IF objectpos[m.i,5]
  5541.          m.rightalign = (m.windwidth * objectpos[m.i,1]) - WIDTH
  5542.          REPLACE hpos WITH IIF(m.rightalign < 0, 0, m.rightalign)
  5543.       ENDIF
  5544.  
  5545.       DO CASE
  5546.       CASE objectpos[m.i,4] = c_otfield
  5547.          REPLACE hpos WITH hpos + c_adjfld
  5548.  
  5549.       CASE objectpos[m.i,4] = c_otlist
  5550.          REPLACE vpos WITH vpos + c_vlist
  5551.          REPLACE height WITH height - c_listht
  5552.  
  5553.       CASE objectpos[m.i,4] = c_ottxtbut
  5554.          IF horizbutton(objectpos[m.i, 9])
  5555.             m.buttonadjust = c_adjtbtn
  5556.          ENDIF
  5557.  
  5558.       CASE objectpos[m.i,4] = c_otradbut
  5559.          IF m.buttonadjust < c_adjrbtn
  5560.             m.buttonadjust = c_adjrbtn
  5561.          ENDIF
  5562.          REPLACE vpos WITH vpos - c_vradbtn
  5563.  
  5564.       CASE objectpos[m.i,4] = c_otchkbox
  5565.          REPLACE vpos WITH vpos - c_vchkbox
  5566.  
  5567.       CASE objectpos[m.i,4] = c_otpopup
  5568.          REPLACE vpos WITH MAX(vpos + m.g_vpopup,0)
  5569.          REPLACE hpos WITH MAX(hpos + c_hpopup,0)
  5570.  
  5571.       CASE objectpos[m.i,4] = c_otbox
  5572.          DO adjbox WITH m.adjust
  5573.       ENDCASE
  5574.    ENDIF
  5575.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  5576.    DO updtherm WITH m.g_mercury
  5577. ENDFOR
  5578. GOTO RECORD m.saverec
  5579.  
  5580. *
  5581. * adjItemsInBoxes - Adjust the location of objects within boxes
  5582. *
  5583. *!*****************************************************************************
  5584. *!
  5585. *!      Procedure: ADJITEMSINBOXES
  5586. *!
  5587. *!      Called by: ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  5588. *!
  5589. *!          Calls: ITEMSINBOXES       (procedure in TRANSPRT.PRG)
  5590. *!
  5591. *!*****************************************************************************
  5592. PROCEDURE adjitemsinboxes
  5593. PRIVATE m.subflag, m.emptybox, m.newlastline
  5594.  
  5595. DIMENSION boxdimension[4,2]
  5596. && 1 - Topmost
  5597. && 2 - Leftmost
  5598. && 3 - Bottommost
  5599. && 4 - Rightmost
  5600.  
  5601. SELECT (m.g_fromobjonlyalias)
  5602.  
  5603. SCAN FOR objtype = c_otbox AND HEIGHT != 1 AND WIDTH != 1
  5604.    STORE 999 TO boxdimension[1,1], boxdimension[2,1]
  5605.    STORE 0 TO boxdimension[3,1], boxdimension[4,1], boxdimension[4,2]
  5606.    STORE .F. TO m.subflag, m.emptybox, m.shrinkbox
  5607.  
  5608.    DO itemsinboxes WITH vpos, hpos, ;
  5609.       vpos + HEIGHT -1, hpos + WIDTH -1, m.emptybox, m.shrinkbox
  5610.  
  5611.    IF vpos + HEIGHT - 1 >= g_lastobjectline[1]
  5612.       m.newlastline = vpos + HEIGHT -1
  5613.       m.flag = .T.
  5614.       m.shrinkbox = .F.
  5615.    ELSE
  5616.       m.flag = .F.
  5617.    ENDIF
  5618.  
  5619.    boxdimension[1,1] = boxdimension[1,1] - vpos -.5
  5620.    boxdimension[2,1] = boxdimension[2,1] - hpos -.5
  5621.    boxdimension[3,1] = vpos + HEIGHT - 1 - boxdimension[3,1] - ;
  5622.       IIF(m.shrinkbox, .5 + m.g_vpopup, .5)
  5623.    boxdimension[4,1] = hpos + WIDTH - boxdimension[4,1] - 1.5
  5624.  
  5625.    SELECT (m.g_scrnalias)
  5626.    m.thisid = uniqueid
  5627.    LOCATE FOR uniqueid = m.thisid AND platform = m.g_toplatform
  5628.    IF FOUND() AND NOT m.emptybox
  5629.       REPLACE vpos WITH boxdimension[1,2] - boxdimension[1,1]
  5630.       REPLACE hpos WITH boxdimension[2,2] - boxdimension[2,1]
  5631.       REPLACE height WITH boxdimension[3,2] - vpos + boxdimension[3,1]
  5632.       REPLACE WIDTH WITH boxdimension[4,2] - hpos + boxdimension[4,1]
  5633.       IF m.flag AND vpos + HEIGHT >= g_lastobjectline[2]
  5634.          g_lastobjectline[1] = m.newlastline
  5635.          g_lastobjectline[2] = vpos + HEIGHT
  5636.       ENDIF
  5637.    ENDIF
  5638.  
  5639.    SELECT (m.g_fromobjonlyalias)
  5640.  
  5641. ENDSCAN
  5642. SELECT (m.g_scrnalias)
  5643.  
  5644. *
  5645. * itemsInBoxes - Adjust objects which are within a box
  5646. *
  5647. *!*****************************************************************************
  5648. *!
  5649. *!      Procedure: ITEMSINBOXES
  5650. *!
  5651. *!      Called by: ADJITEMSINBOXES    (procedure in TRANSPRT.PRG)
  5652. *!
  5653. *!          Calls: FINDOTHERSONLINE() (function  in TRANSPRT.PRG)
  5654. *!               : num2style()        (function  in TRANSPRT.PRG)
  5655. *!               : HORIZBUTTON()      (function  in TRANSPRT.PRG)
  5656. *!               : GETOBJWIDTH()      (function  in TRANSPRT.PRG)
  5657. *!
  5658. *!           Uses: M.G_FROMOBJONLYALIA
  5659. *!
  5660. *!*****************************************************************************
  5661. PROCEDURE itemsinboxes
  5662. PARAMETER m.top, m.left, m.bottom, m.right, m.emptybox, m.shrinkbox
  5663. PRIVATE m.rec, m.wasapopup, m.oldbottom, m.newbottom, m.twidth
  5664.  
  5665. m.rec = RECNO()
  5666. m.g_boxeditemsalias = "S" + SUBSTR(LOWER(SYS(3)),2,8)
  5667.  
  5668. SELECT vpos, hpos, HEIGHT, WIDTH, uniqueid, spacing, objtype, PICTURE, platform ;
  5669.    FROM (m.g_fromobjonlyalias) ;
  5670.    WHERE (vpos > m.top AND vpos < m.bottom) ;
  5671.    AND (hpos > m.left AND hpos < m.right) AND ;
  5672.    objtype <> c_otbox AND !(LEN(expr)=3 ;
  5673.    AND ASC(SUBSTR(CPTCOND(c_doscp,c_wincp,expr),2,1)) >= 179 ;
  5674.     AND ASC(SUBSTR(CPTCOND(c_doscp,c_wincp,expr),2,1)) <= 218);
  5675.    INTO CURSOR (m.g_boxeditemsalias)
  5676.  
  5677. STORE 0 TO m.oldbottom, m.newbottom
  5678. IF _TALLY > 0
  5679.    SET RELATION TO uniqueid+m.g_toplatform INTO (m.g_scrnalias) ADDITIVE
  5680.    LOCATE FOR .T.
  5681.    m.wasapopup = .F.
  5682.  
  5683.    DO WHILE NOT EOF()
  5684.       IF vpos < boxdimension[1,1] OR (m.wasapopup AND vpos = boxdimension[1,1])
  5685.          boxdimension[1,1] = vpos
  5686.          boxdimension[1,2] = &g_scrnalias..vpos
  5687.          IF objtype = c_otpopup
  5688.             m.wasapopup = .T.
  5689.          ELSE
  5690.             m.wasapopup = .F.
  5691.          ENDIF
  5692.       ENDIF
  5693.  
  5694.       IF hpos < boxdimension[2,1]
  5695.          boxdimension[2,1]= hpos
  5696.          boxdimension[2,2] = &g_scrnalias..hpos
  5697.       ENDIF
  5698.  
  5699.       DO CASE
  5700.       CASE objtype = c_ottext OR objtype = c_otchkbox ;
  5701.             OR (objtype = c_otfield AND height = 1)
  5702.          IF vpos > m.oldbottom
  5703.             m.shrinkbox = .F.
  5704.             IF !findothersonline(vpos, @m.newbottom, @m.oldbottom, objtype)
  5705.                m.oldbottom = vpos + HEIGHT
  5706.                m.newbottom = &g_scrnalias..vpos + &g_scrnalias..height
  5707.             ENDIF
  5708.          ENDIF
  5709.  
  5710.          * Check TXTWIDTH for text strings
  5711.          IF m.g_char2grph AND objtype = c_ottext
  5712.             m.twidth = TXTWIDTH(&g_scrnalias..expr,g_dfltfface,g_dfltfsize,num2style(g_boldstylenum))
  5713.          ELSE
  5714.             m.twidth = &g_scrnalias..width
  5715.          ENDIF
  5716.  
  5717.          IF &g_scrnalias..hpos + m.twidth > boxdimension[4,2]
  5718.             boxdimension[4,1] = hpos + WIDTH - 1
  5719.             boxdimension[4,2] = &g_scrnalias..hpos + m.twidth
  5720.          ENDIF
  5721.  
  5722.       CASE objtype = c_otradbut OR objtype = c_ottxtbut OR objtype = c_otinvbut
  5723.          m.numitems = OCCURS(';',PICTURE) + 1
  5724.  
  5725.          IF horizbutton(PICTURE)
  5726.  
  5727.             IF vpos > m.oldbottom
  5728.                m.shrinkbox = .F.
  5729.                IF findothersonline(vpos, @m.newbottom, @m.oldbottom, ;
  5730.                      objtype)
  5731.                   IF objtype = c_ottxtbut
  5732.                      REPLACE &g_scrnalias..vpos WITH &g_scrnalias..vpos - 0.312
  5733.                   ENDIF
  5734.                ENDIF
  5735.                m.oldbottom = vpos + HEIGHT - 1
  5736.                m.newbottom = &g_scrnalias..vpos + &g_scrnalias..height
  5737.             ENDIF
  5738.  
  5739.             IF (hpos -1 + (WIDTH +spacing) * m.numitems - spacing) >= ;
  5740.                   boxdimension[4,1]
  5741.                boxdimension[4,1] = hpos - 1 + ;
  5742.                   getobjwidth(objtype, ;
  5743.                   PICTURE, ;
  5744.                   WIDTH, ;
  5745.                   spacing, ;
  5746.                   m.g_toplatform)
  5747.                boxdimension[4,2] = &g_scrnalias..hpos + ;
  5748.                   getobjwidth(&g_scrnalias..objtype, ;
  5749.                   &g_scrnalias..picture, ;
  5750.                   &g_scrnalias..width, ;
  5751.                   &g_scrnalias..spacing, ;
  5752.                   m.g_toplatform)
  5753.             ENDIF
  5754.  
  5755.          ELSE
  5756.             m.shrinkbox = .F.
  5757.             IF (vpos -1 + m.numitems + (spacing * (m.numitems -1))) >= ;
  5758.                   m.oldbottom
  5759.                m.oldbottom = vpos -1 + m.numitems + ;
  5760.                   (spacing * (m.numitems -1)) - 1
  5761.                m.newbottom = &g_scrnalias..vpos  + m.numitems + ;
  5762.                   (&g_scrnalias..spacing * (m.numitems -1))
  5763.             ENDIF
  5764.  
  5765.             IF hpos -1 + WIDTH >= boxdimension[4,1]
  5766.                boxdimension[4,1] = hpos -1 + WIDTH
  5767.                boxdimension[4,2] = &g_scrnalias..hpos  + ;
  5768.                   &g_scrnalias..width
  5769.             ENDIF
  5770.          ENDIF
  5771.  
  5772.       CASE objtype = c_otpopup
  5773.          IF vpos + HEIGHT - 2 > m.oldbottom
  5774.             IF !findothersonline(vpos + 1, @m.newbottom, @m.oldbottom, objtype)
  5775.                m.oldbottom = vpos + HEIGHT - 2
  5776.                m.newbottom = &g_scrnalias..vpos + &g_scrnalias..height
  5777.             ENDIF
  5778.             m.shrinkbox = IIF(m.bottom -1 = vpos + HEIGHT -1, .T., .F.)
  5779.          ENDIF
  5780.  
  5781.          IF hpos + WIDTH - 1 > boxdimension[4,1]
  5782.             boxdimension[4,1] = hpos + WIDTH - 1
  5783.             boxdimension[4,2] = &g_scrnalias..hpos + &g_scrnalias..width
  5784.          ENDIF
  5785.  
  5786.       CASE objtype = c_otfield OR ;
  5787.             objtype = c_otlist OR objtype = c_otbox
  5788.  
  5789.          IF vpos + HEIGHT - 1 > m.oldbottom
  5790.             m.shrinkbox = .F.
  5791.             IF !findothersonline(vpos, @m.newbottom, @m.oldbottom, objtype)
  5792.                m.oldbottom = vpos + HEIGHT - 1
  5793.                m.newbottom = &g_scrnalias..vpos + &g_scrnalias..height
  5794.             ENDIF
  5795.          ENDIF
  5796.  
  5797.          IF hpos + WIDTH - 1 > boxdimension[4,1]
  5798.             boxdimension[4,1] = hpos + WIDTH - 1
  5799.             boxdimension[4,2] = &g_scrnalias..hpos + &g_scrnalias..width
  5800.          ENDIF
  5801.  
  5802.       ENDCASE
  5803.       SKIP
  5804.    ENDDO
  5805.  
  5806.    m.emptybox = .F.
  5807.    boxdimension[3,1] = m.oldbottom
  5808.    boxdimension[3,2] = m.newbottom
  5809. ELSE
  5810.    m.emptybox = .T.
  5811. ENDIF
  5812.  
  5813. USE
  5814. SELECT (m.g_fromobjonlyalias)
  5815. GOTO RECORD m.rec
  5816. RETURN
  5817.  
  5818. *
  5819. * findOthersOnLine - Find any other objects in the box and on the line with a text button
  5820. *
  5821. *!*****************************************************************************
  5822. *!
  5823. *!       Function: FINDOTHERSONLINE
  5824. *!
  5825. *!      Called by: ITEMSINBOXES       (procedure in TRANSPRT.PRG)
  5826. *!
  5827. *!*****************************************************************************
  5828. FUNCTION findothersonline
  5829. PARAMETER m.lineno, m.newbottom, m.oldbottom, m.curtype
  5830. PRIVATE m.saverec, m.prevtype, m.flag
  5831.  
  5832. m.prevtype = 0
  5833. m.flag = .F.
  5834. m.saverec = RECNO()
  5835. LOCATE FOR (objtype != c_otpopup AND vpos = m.lineno) OR ;
  5836.    (m.curtype != c_otpopup AND objtype = c_otpopup AND m.lineno = vpos + 1)
  5837.  
  5838. IF !FOUND()
  5839.    GOTO RECORD (m.saverec)
  5840.    RETURN m.flag
  5841. ENDIF
  5842.  
  5843. DO WHILE FOUND()
  5844.    DO CASE
  5845.    CASE objtype = c_ottxtbut
  5846.       IF m.curtype != objtype
  5847.          m.flag = .T.
  5848.          m.oldbottom = vpos + HEIGHT -1
  5849.          m.newbottom = &g_scrnalias..vpos + &g_scrnalias..height
  5850.          GOTO RECORD (m.saverec)
  5851.          RETURN m.flag
  5852.       ENDIF
  5853.  
  5854.    CASE objtype = c_otpopup
  5855.       m.flag = .T.
  5856.       m.oldbottom = vpos + HEIGHT - 2
  5857.       m.newbottom = &g_scrnalias..vpos + &g_scrnalias..height
  5858.       m.prevtype = c_otpopup
  5859.  
  5860.    CASE (objtype = c_otfield OR objtype = c_otlist OR objtype = c_otline) AND ;
  5861.          (m.prevtype != c_otpopup)
  5862.       m.flag = .T.
  5863.       m.oldbottom = vpos + HEIGHT - 1
  5864.       m.newbottom = &g_scrnalias..vpos + &g_scrnalias..height
  5865.       m.prevtype = objtype
  5866.  
  5867.    OTHERWISE
  5868.       m.flag = .T.
  5869.       m.oldbottom = vpos
  5870.       m.newbottom = &g_scrnalias..vpos + &g_scrnalias..height
  5871.  
  5872.    ENDCASE
  5873.  
  5874.    CONTINUE
  5875. ENDDO
  5876. GOTO RECORD (m.saverec)
  5877. RETURN m.flag
  5878.  
  5879. *
  5880. * StretchLinesToBorders - This procedure makes sure that any lines which stretched to the
  5881. *      edge of the from platform window will stretch to the edge of the to platform window.
  5882. *
  5883. *!*****************************************************************************
  5884. *!
  5885. *!      Procedure: ADJINVBTNS
  5886. *!
  5887. *!      Called by: ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  5888. *!
  5889. *!          Calls: HORIZBUTTON()      (function  in TRANSPRT.PRG)
  5890. *!               : ADJPOSTINV         (procedure in TRANSPRT.PRG)
  5891. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  5892. *!
  5893. *!*****************************************************************************
  5894. PROCEDURE adjinvbtns
  5895. PRIVATE m.saverec, m.loop, m.horizontal, m.btnid, m.objid, m.flag, m.thermstep, m.leftmost, ;
  5896.    m.label, m.btnvpos, m.btnhpos, m.btnwidth, m.btnheight, m.btnspacing, m.btncount, ;
  5897.    m.ybtn, m.vbtn, m.xbtn, m.hbtn, m.defwidth, m.defwidthindex, m.defheight, m.defheightindex, ;
  5898.    m.topmargin, m.bottommargin, m.leftmargin, m.rightmargin, m.adjustment, m.totadjust, m.newhpos
  5899.  
  5900. m.saverec = RECNO()
  5901. m.totadjust = 0
  5902. m.leftmost = 0
  5903.  
  5904. COUNT TO m.thermstep FOR platform = m.g_fromplatform AND objtype = c_otinvbut
  5905. m.thermstep = 5/m.thermstep
  5906.  
  5907. SCAN FOR platform = m.g_fromplatform AND objtype = c_otinvbut
  5908.    m.horizontal = horizbutton(PICTURE)
  5909.    m.btnvpos = vpos
  5910.    m.btnhpos = hpos
  5911.    m.btnheight = HEIGHT
  5912.    m.btnwidth = WIDTH
  5913.    m.btnspacing = spacing
  5914.    m.btncount = OCCURS(";", PICTURE) + 1
  5915.    m.btnid = uniqueid
  5916.  
  5917.    STORE 0 TO m.defwidth, m.defwidthindex, m.defheight, m.defheightindex
  5918.  
  5919.    * This array is used to keep track of the rectangle which bounds the objects which
  5920.    * lie on top of each invisible button in the set.
  5921.    *
  5922.    *   sizes[x,1] = Minimum row on the FROM platform.
  5923.    *   sizes[x,2] = Minimum colum on the FROM platform.
  5924.    *   sizes[x,3] = Maximum row on the FROM platform.
  5925.    *   sizes[x,4] = Maximum colum on the FROM platform.
  5926.    *   sizes[x,5] = Minimum row on the TO platform.
  5927.    *   sizes[x,6] = Minimum colum on the TO platform.
  5928.    *   sizes[x,7] = Maximum row on the TO platform.
  5929.    *   sizes[x,8] = Maximum colum on the TO platform.
  5930.    *   sizes[x,9] = Comma delimeted list of uniqueid's for objects positioned on
  5931.    *               the button face.
  5932.    DIMENSION sizes[m.btnCount,9]
  5933.  
  5934.    FOR m.loop = 1 TO m.btncount
  5935.       m.ybtn = IIF(m.horizontal, m.btnvpos, m.btnvpos + ((m.loop-1) * m.btnheight) + ((m.loop-1) * m.btnspacing))
  5936.       m.vbtn = m.ybtn + m.btnheight
  5937.       m.xbtn = IIF(m.horizontal, m.btnhpos + ((m.loop-1) * m.btnwidth) + ((m.loop-1) * m.btnspacing), m.btnhpos)
  5938.       m.hbtn = m.xbtn + m.btnwidth
  5939.  
  5940.       STORE 0 TO sizes[m.loop,3], sizes[m.loop,4], sizes[m.loop,7], sizes[m.loop,8]
  5941.       STORE 99999999 TO sizes[m.loop,1], sizes[m.loop,2], sizes[m.loop,5], sizes[m.loop,6]
  5942.  
  5943.       sizes[m.loop,9] = ""
  5944.  
  5945.       SCAN FOR platform = m.g_fromplatform AND (objtype = c_ottext OR objtype = c_otfield  OR ;
  5946.             objtype = c_otbox OR objtype = c_otline) AND ;
  5947.             vpos >= m.ybtn AND vpos+HEIGHT <= m.vbtn AND hpos >= m.xbtn AND hpos+WIDTH <= m.hbtn
  5948.          m.objid = uniqueid
  5949.          sizes[m.loop,1] = MIN(sizes[m.loop,1], vpos)
  5950.          sizes[m.loop,2] = MIN(sizes[m.loop,2], hpos)
  5951.          sizes[m.loop,3] = MAX(sizes[m.loop,3], vpos+HEIGHT)
  5952.          sizes[m.loop,4] = MAX(sizes[m.loop,4], hpos+WIDTH)
  5953.          sizes[m.loop,9] = sizes[m.loop,9] + ;
  5954.             IIF(LEN(sizes[m.loop,9]) = 0, uniqueid, ","+uniqueid)
  5955.  
  5956.          LOCATE FOR platform = m.g_toplatform AND uniqueid = m.objid
  5957.          IF FOUND()
  5958.             sizes[m.loop,5] = MIN(sizes[m.loop,5], IIF(objtype = c_otbox OR objtype = c_otline, ;
  5959.                vpos-c_adjbox, vpos))
  5960.             sizes[m.loop,6] = MIN(sizes[m.loop,6], IIF(objtype = c_otbox OR objtype = c_otline, ;
  5961.                hpos-c_adjbox, hpos))
  5962.             sizes[m.loop,7] = MAX(sizes[m.loop,7], IIF(objtype = c_otbox OR objtype = c_otline, ;
  5963.                vpos+HEIGHT+c_adjbox, vpos+HEIGHT))
  5964.             sizes[m.loop,8] = MAX(sizes[m.loop,8], IIF(objtype = c_otbox OR objtype = c_otline, ;
  5965.                hpos+WIDTH+c_adjbox, hpos+WIDTH))
  5966.          ENDIF
  5967.  
  5968.          LOCATE FOR platform = m.g_fromplatform AND uniqueid = m.objid
  5969.       ENDSCAN
  5970.  
  5971.       * The tallest button region will define where the button set gets
  5972.       * placed so we want to remember which region that was.
  5973.       IF (sizes[m.loop,7] - sizes[m.loop,5]) > m.defheight
  5974.          m.defheight      = sizes[m.loop,7] - sizes[m.loop,5]
  5975.          m.defheightindex = m.loop
  5976.          m.topmargin      = sizes[m.loop,1] - m.ybtn
  5977.          m.bottommargin   = m.vbtn - sizes[m.loop,3]
  5978.       ENDIF
  5979.  
  5980.       * The widest button region will define where the button set gets
  5981.       * placed so we want to remember which region that was.
  5982.       IF (sizes[m.loop,8] - sizes[m.loop,6]) > m.defwidth
  5983.          m.defwidth      = sizes[m.loop,8] - sizes[m.loop,6]
  5984.          m.defwidthindex = m.loop
  5985.          m.leftmargin    = sizes[m.loop,2] - m.xbtn
  5986.          m.rightmargin   = m.hbtn - sizes[m.loop,4]
  5987.       ENDIF
  5988.    ENDFOR
  5989.  
  5990.    IF m.defheightindex != 0 AND m.defwidthindex != 0
  5991.       LOCATE FOR platform = m.g_toplatform AND uniqueid = m.btnid
  5992.       IF FOUND()
  5993.          IF m.horizontal
  5994.             REPLACE vpos WITH sizes[m.defHeightIndex,5] - m.topmargin
  5995.          ELSE
  5996.             REPLACE hpos WITH sizes[m.defWidthIndex,6] - m.leftmargin
  5997.          ENDIF
  5998.  
  5999.          REPLACE height WITH (sizes[m.defHeightIndex,7] - sizes[m.defHeightIndex,5]) + m.topmargin + m.bottommargin
  6000.          REPLACE WIDTH WITH (sizes[m.defWidthIndex,8] - sizes[m.defWidthIndex,6]) + m.leftmargin + m.rightmargin
  6001.       ENDIF
  6002.  
  6003.       IF m.horizontal AND WIDTH > m.btnwidth
  6004.          m.adjustment = WIDTH - m.btnwidth
  6005.          IF spacing > 1
  6006.             IF m.adjustment <= spacing-1
  6007.                REPLACE spacing WITH spacing - m.adjustment
  6008.             ELSE
  6009.                m.adjustment = m.adjustment - (spacing-1)
  6010.                REPLACE spacing WITH 1
  6011.                m.leftmost = MAX(m.leftmost, hpos + (m.btncount*WIDTH) + ((m.btncount-1)*spacing))
  6012.  
  6013.                m.totadjust = MAX(m.totadjust, m.btncount * m.adjustment)
  6014.  
  6015.                DO adjpostinv WITH vpos, vpos+HEIGHT, ;
  6016.                   m.btnhpos + (m.btncount*m.btnwidth) + ((m.btncount-1)*m.btnspacing), ;
  6017.                   m.btncount * m.adjustment
  6018.  
  6019.                FOR m.loop = 2 TO m.btncount
  6020.                   DO WHILE LEN(sizes[m.loop,9]) > 0
  6021.                      IF AT(",", sizes[m.loop,9]) != 0
  6022.                         m.label = LEFT(sizes[m.loop,9], AT(",", sizes[m.loop,9])-1)
  6023.                         sizes[m.loop,9] = SUBSTR(sizes[m.loop,9], AT(",", sizes[m.loop,9])+1)
  6024.                      ELSE
  6025.                         m.label = sizes[m.loop,9]
  6026.                         sizes[m.loop,9] = ""
  6027.                      ENDIF
  6028.  
  6029.                      LOCATE FOR platform = m.g_fromplatform AND uniqueid = m.label
  6030.                      IF FOUND()
  6031.                         m.newhpos = hpos + (m.adjustment * (m.loop-1))
  6032.                         LOCATE FOR platform = m.g_toplatform AND uniqueid = m.label
  6033.                         IF FOUND()
  6034.                            REPLACE hpos WITH IIF(objtype = c_otbox OR objtype = c_otline, ;
  6035.                               m.newhpos+c_adjbox, m.newhpos)
  6036.                         ENDIF
  6037.                      ENDIF
  6038.                   ENDDO
  6039.                ENDFOR
  6040.             ENDIF
  6041.          ENDIF
  6042.       ENDIF
  6043.    ENDIF
  6044.  
  6045.    LOCATE FOR platform = m.g_toplatform AND objtype = c_otheader
  6046.    IF FOUND()
  6047.       IF m.totadjust > 0
  6048.          REPLACE WIDTH WITH WIDTH + m.totadjust
  6049.       ENDIF
  6050.  
  6051.       IF WIDTH < m.leftmost
  6052.          REPLACE WIDTH WITH m.leftmost + 1
  6053.       ENDIF
  6054.    ENDIF
  6055.  
  6056.  
  6057.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  6058.    DO updtherm WITH m.g_mercury
  6059.  
  6060.    LOCATE FOR platform = m.g_fromplatform AND uniqueid = m.btnid
  6061. ENDSCAN
  6062.  
  6063. IF m.saverec <= RECCOUNT()
  6064.    GOTO RECORD (m.saverec)
  6065. ELSE
  6066.    LOCATE FOR .F.
  6067. ENDIF
  6068.  
  6069. *
  6070. * adjPostInv - This procedure moves objects which lie to the right of a set of horizontal
  6071. *      invisible buttons so that they won't overlap.
  6072. *
  6073. *!*****************************************************************************
  6074. *!
  6075. *!      Procedure: ADJPOSTINV
  6076. *!
  6077. *!      Called by: ADJINVBTNS         (procedure in TRANSPRT.PRG)
  6078. *!
  6079. *!          Calls: FINDALIGNEND()     (function  in TRANSPRT.PRG)
  6080. *!
  6081. *!*****************************************************************************
  6082. PROCEDURE adjpostinv
  6083. PARAMETER m.ystart, m.yend, m.xstart, m.adjustment
  6084. PRIVATE m.saverec, m.saveid
  6085.  
  6086. m.saverec = RECNO()
  6087.  
  6088. m.ystart = findalignend(m.ystart, m.xstart, -1)
  6089. m.yend = findalignend(m.yend, m.xstart, 1)
  6090.  
  6091. SCAN FOR platform = m.g_fromplatform AND hpos >= m.xstart AND vpos >= m.ystart AND vpos <= m.yend AND ;
  6092.       (objtype = c_ottext   OR objtype = c_otline   OR objtype = c_otbox   OR objtype = c_list OR ;
  6093.       objtype = c_otradbut OR objtype = c_otchkbox OR objtype = c_otfield OR objtype = c_popup OR ;
  6094.       objtype = c_otinvbut)
  6095.    m.saveid = uniqueid
  6096.    LOCATE FOR platform = m.g_toplatform AND uniqueid = m.saveid
  6097.    IF FOUND()
  6098.       REPLACE hpos WITH hpos + m.adjustment
  6099.    ENDIF
  6100.  
  6101.    LOCATE FOR platform = m.g_fromplatform AND uniqueid = m.saveid
  6102. ENDSCAN
  6103.  
  6104. IF m.saverec <= RECCOUNT()
  6105.    GOTO RECORD m.saverec
  6106. ELSE
  6107.    LOCATE FOR .F.
  6108. ENDIF
  6109.  
  6110. *
  6111. * FindAlignEnd - Given a position to start with and a direction, this routine looks for the
  6112. *      last line where right aligned objects extend to from the starting position.
  6113. *
  6114. *!*****************************************************************************
  6115. *!
  6116. *!       Function: FINDALIGNEND
  6117. *!
  6118. *!      Called by: ADJPOSTINV         (procedure in TRANSPRT.PRG)
  6119. *!
  6120. *!*****************************************************************************
  6121. FUNCTION findalignend
  6122. PARAMETER m.ystart, m.xstart, m.increment
  6123. PRIVATE m.saverec, m.ytemp, m.xtemp, m.result
  6124.  
  6125. m.result = m.ystart
  6126.  
  6127. SCAN FOR platform = m.g_fromplatform AND hpos >= m.xstart AND vpos = m.ystart
  6128.    m.saverec = RECNO()
  6129.  
  6130.    m.ytemp = vpos + m.increment
  6131.    m.xtemp = hpos
  6132.    LOCATE FOR platform = m.g_fromplatform AND vpos = m.ytemp AND hpos = m.xtemp AND ;
  6133.       (objtype = c_ottext   OR objtype = c_otline   OR objtype = c_otbox   OR objtype = c_list OR ;
  6134.       objtype = c_otradbut OR objtype = c_otchkbox OR objtype = c_otfield OR objtype = c_popup OR ;
  6135.       objtype = c_otinvbut)
  6136.    DO WHILE FOUND()
  6137.       m.result = IIF(m.increment < 0, MIN(m.result, m.ytemp), MAX(m.result, m.ytemp))
  6138.       m.ytemp = m.ytemp + m.increment
  6139.       LOCATE FOR platform = m.g_fromplatform AND vpos = m.ytemp AND hpos = m.xtemp AND ;
  6140.          (objtype = c_ottext   OR objtype = c_otline   OR objtype = c_otbox   OR objtype = c_list OR ;
  6141.          objtype = c_otradbut OR objtype = c_otchkbox OR objtype = c_otfield OR objtype = c_popup OR ;
  6142.          objtype = c_otinvbut)
  6143.    ENDDO
  6144.    GOTO RECORD m.saverec
  6145. ENDSCAN
  6146.  
  6147. RETURN m.result
  6148.  
  6149. *
  6150. * StretchLinesToBorders - This procedure makes sure that any lines which stretched to the
  6151. *      edge of the from platform window will stretch to the edge of the to platform window.
  6152. *
  6153. *!*****************************************************************************
  6154. *!
  6155. *!      Procedure: STRETCHLINESTOBORDERS
  6156. *!
  6157. *!      Called by: ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  6158. *!
  6159. *!*****************************************************************************
  6160. PROCEDURE stretchlinestoborders
  6161. PRIVATE m.saverec, m.objid, m.objrec, m.objwidth, m.fromheight, m.fromwidth
  6162.  
  6163. IF m.g_filetype = c_report OR m.g_filetype = c_label
  6164.    RETURN
  6165. ENDIF
  6166.  
  6167. m.saverec = RECNO()
  6168.  
  6169. LOCATE FOR platform = m.g_fromplatform AND objtype = c_otheader
  6170. IF FOUND()
  6171.    IF BORDER = 0 OR STYLE = 0
  6172.       m.fromheight = HEIGHT
  6173.       m.fromwidth = WIDTH
  6174.    ELSE
  6175.       m.fromheight = HEIGHT - 2
  6176.       m.fromwidth = WIDTH - 2
  6177.    ENDIF
  6178.  
  6179.    SCAN FOR platform = m.g_fromplatform AND objtype = c_otbox AND ;
  6180.          ((WIDTH = 1 AND vpos+HEIGHT = m.fromheight) OR (HEIGHT = 1 AND hpos+WIDTH = m.fromwidth))
  6181.  
  6182.       m.objrec = RECNO()
  6183.       m.objid = uniqueid
  6184.       m.objwidth = WIDTH
  6185.       LOCATE FOR platform = m.g_toplatform AND objtype = c_otheader
  6186.       IF FOUND()
  6187.          m.toheight = HEIGHT
  6188.          m.towidth = WIDTH
  6189.  
  6190.          LOCATE FOR platform = m.g_toplatform AND uniqueid = m.objid
  6191.          IF FOUND()
  6192.             IF m.objwidth = 1
  6193.                REPLACE height WITH m.toheight-vpos
  6194.             ELSE
  6195.                REPLACE WIDTH WITH m.towidth-hpos
  6196.             ENDIF
  6197.          ENDIF
  6198.       ENDIF
  6199.  
  6200.       GOTO RECORD m.objrec
  6201.    ENDSCAN
  6202. ENDIF
  6203.  
  6204. IF m.saverec > RECCOUNT()
  6205.    LOCATE FOR .F.
  6206. ELSE
  6207.    GOTO RECORD m.saverec
  6208. ENDIF
  6209. RETURN
  6210.  
  6211. *
  6212. * JoinLines -This procedure examines each line to see where it meets other lines in the
  6213. *      from platform and constructs an array of these positons.  This array can then
  6214. *      be used to make the lines/boxes meet in the from platform.
  6215. *
  6216. *!*****************************************************************************
  6217. *!
  6218. *!      Procedure: JOINLINES
  6219. *!
  6220. *!      Called by: ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  6221. *!
  6222. *!          Calls: UPDTHERM           (procedure in TRANSPRT.PRG)
  6223. *!               : JOINHORIZONTAL     (procedure in TRANSPRT.PRG)
  6224. *!               : JOINVERTICAL       (procedure in TRANSPRT.PRG)
  6225. *!               : MEETBOXCHAR        (procedure in TRANSPRT.PRG)
  6226. *!               : ZAPBOXCHAR         (procedure in TRANSPRT.PRG)
  6227. *!               : REJOINBOXES        (procedure in TRANSPRT.PRG)
  6228. *!
  6229. *!*****************************************************************************
  6230. PROCEDURE joinlines
  6231. PRIVATE m.saverec, m.joincount, m.linerec, m.lineid, m.i, m.thermstep, ;
  6232.    m.objvpos, m.objhpos, m.objright, m.objbottom, m.objid, m.objrec, m.objcode, ;
  6233.    m.fromvpos, m.fromhpos, m.fromheight, m.fromwidth, m.fromend, m.fromcode, ;
  6234.    m.tovpos, m.tohpos, m.toheight, m.towidth, ;
  6235.    m.joinvpos, m.joinhpos, m.vlevel, m.hlevel
  6236.  
  6237. DIMENSION joins[1,5]
  6238. && Joins[X,2] - toVpos
  6239. && Joins[X,3] - toHpos
  6240. && Joins[X,4] - Vpos match level
  6241. && Joins[X,5] - Hpos match level
  6242. m.joincount = 0
  6243. m.saverec = RECNO()
  6244.  
  6245. COUNT TO m.thermstep FOR platform = m.g_fromplatform AND objtype = c_otbox AND (WIDTH=1 OR HEIGHT=1)
  6246. IF m.thermstep <> 0
  6247.    m.thermstep = 10 / m.thermstep
  6248. ELSE
  6249.    m.g_mercury = MIN(m.g_mercury + 10, 95)
  6250.    DO updtherm WITH m.g_mercury
  6251. ENDIF
  6252.  
  6253. SCAN FOR platform = m.g_fromplatform AND objtype = c_otbox AND (WIDTH=1 OR HEIGHT=1)
  6254.    m.fromvpos = vpos
  6255.    m.fromhpos = hpos
  6256.    m.fromheight = HEIGHT
  6257.    m.fromwidth = WIDTH
  6258.    m.fromcode = objcode
  6259.    m.lineid = uniqueid
  6260.    m.linerec = RECNO()
  6261.  
  6262.    LOCATE FOR platform = m.g_toplatform AND uniqueid = m.lineid
  6263.    IF FOUND()
  6264.       m.tovpos = vpos
  6265.       m.tohpos = hpos
  6266.       m.toheight = HEIGHT
  6267.       m.towidth = WIDTH
  6268.  
  6269.       SCAN FOR platform = m.g_fromplatform AND objtype = c_otbox AND uniqueid <> m.lineid
  6270.          IF m.fromheight = 1 AND HEIGHT <> 1 AND (m.fromvpos >= vpos AND m.fromvpos <= vpos+HEIGHT-1)
  6271.             m.fromend = m.fromhpos + m.fromwidth - 1
  6272.  
  6273.             ** Horizontal line which starts on a vertical line/box side.
  6274.             IF m.fromhpos = hpos OR m.fromhpos = hpos+WIDTH-1
  6275.                DO joinhorizontal WITH m.fromvpos, m.fromhpos, m.fromhpos, m.tovpos, m.toheight, m.fromcode
  6276.             ENDIF
  6277.  
  6278.             ** Horizontal line which ends on a vertical line/box side.
  6279.             IF m.fromend = hpos OR m.fromend = hpos+WIDTH-1
  6280.                DO joinhorizontal WITH m.fromvpos, m.fromend, m.fromend, m.tovpos, m.toheight, m.fromcode
  6281.             ENDIF
  6282.  
  6283.             ** Horizontal line which starts one to the right of a vertical line/box side
  6284.             IF m.fromhpos-1 = hpos OR m.fromhpos = hpos+WIDTH
  6285.                DO joinhorizontal WITH m.fromvpos, m.fromhpos-1, m.fromhpos, m.tovpos, m.toheight, m.fromcode
  6286.             ENDIF
  6287.  
  6288.             ** Horizontal line which ends one left of a vertical line/box side
  6289.             IF m.fromend+1 = hpos OR  m.fromend = hpos+WIDTH-2
  6290.                DO joinhorizontal WITH m.fromvpos, m.fromend+1, m.fromend, m.tovpos, m.toheight, m.fromcode
  6291.             ENDIF
  6292.          ENDIF
  6293.  
  6294.          IF m.fromwidth = 1 AND WIDTH <> 1 AND (m.fromhpos >= hpos AND m.fromhpos <= hpos+WIDTH-1)
  6295.             m.fromend = m.fromvpos + m.fromheight - 1
  6296.  
  6297.             ** Vertical line which starts on a horizontical line/box side.
  6298.             IF m.fromvpos = vpos OR m.fromvpos = vpos+HEIGHT-1
  6299.                DO joinvertical WITH m.fromvpos, m.fromvpos, m.fromhpos, m.tohpos, m.fromcode
  6300.             ENDIF
  6301.  
  6302.             ** Vertical line which ends on a horizontical line/box side.
  6303.             IF m.fromend = vpos OR m.fromend = vpos+HEIGHT-1
  6304.                DO joinvertical WITH m.fromend, m.fromend, m.fromhpos, m.tohpos, m.fromcode
  6305.             ENDIF
  6306.  
  6307.             ** Vertical line which starts one below a horizontal line/box side
  6308.             IF m.fromvpos-1 = vpos OR m.fromvpos = vpos+HEIGHT
  6309.                DO joinvertical WITH m.fromvpos-1, m.fromvpos, m.fromhpos, m.tohpos, m.fromcode
  6310.             ENDIF
  6311.  
  6312.             ** Vertical line which ends one above a horizontal line/box side
  6313.             IF m.fromend+1 = vpos OR m.fromend = vpos+HEIGHT-2
  6314.                DO joinvertical WITH m.fromend+1, m.fromend, m.fromhpos, m.tohpos, m.fromcode
  6315.             ENDIF
  6316.          ENDIF
  6317.       ENDSCAN
  6318.    ENDIF
  6319.  
  6320.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  6321.    DO updtherm WITH m.g_mercury
  6322.  
  6323.    GOTO RECORD m.linerec
  6324. ENDSCAN
  6325.  
  6326. DO meetboxchar
  6327. DO zapboxchar
  6328.  
  6329. m.thermstep = 10/m.joincount
  6330. FOR m.i = 1 TO m.joincount
  6331.    DO rejoinboxes WITH VAL(LEFT(joins[m.i, 1], 3)), VAL(RIGHT(joins[m.i, 1], 3)), joins[m.i, 2], joins[m.i, 3]
  6332.  
  6333.    m.g_mercury = MIN(m.g_mercury + m.thermstep, 95)
  6334.    DO updtherm WITH m.g_mercury
  6335. ENDFOR
  6336.  
  6337. IF m.saverec > RECCOUNT()
  6338.    LOCATE FOR .F.
  6339. ELSE
  6340.    GOTO RECORD m.saverec
  6341. ENDIF
  6342. RETURN
  6343.  
  6344. *
  6345. * joinHorizontal - This procedure adds a join for a horizontal line which has been determined to
  6346. *               intersect something vertical.
  6347. *
  6348. *!*****************************************************************************
  6349. *!
  6350. *!      Procedure: JOINHORIZONTAL
  6351. *!
  6352. *!      Called by: JOINLINES          (procedure in TRANSPRT.PRG)
  6353. *!
  6354. *!          Calls: GETLINEWIDTH()     (function  in TRANSPRT.PRG)
  6355. *!               : ADDJOIN            (procedure in TRANSPRT.PRG)
  6356. *!
  6357. *!*****************************************************************************
  6358. PROCEDURE joinhorizontal
  6359. PARAMETER m.fromvpos, m.oldhpos1, m.oldhpos2, m.tovpos, m.tothickness, m.fromcode
  6360. PRIVATE m.objvpos, m.objhpos, m.objright, m.objbottom, m.objcode, m.objid, m.objrec
  6361.  
  6362. m.objvpos = vpos
  6363. m.objhpos = hpos
  6364. m.objright = hpos + WIDTH - 1
  6365. m.objbottom = vpos + HEIGHT - 1
  6366. m.objcode = objcode
  6367. m.objid = uniqueid
  6368. m.objrec = RECNO()
  6369.  
  6370. LOCATE FOR platform = m.g_toplatform AND uniqueid = m.objid
  6371. IF FOUND()
  6372.    DO CASE
  6373.    CASE m.fromvpos = m.objvpos OR m.fromvpos = m.objbottom
  6374.       IF objtype = c_otline
  6375.          m.joinvpos = m.tovpos - c_adjbox + (m.tothickness/2)
  6376.          STORE 2 TO m.vlevel, m.hlevel
  6377.       ELSE
  6378.          IF m.fromvpos = m.objvpos
  6379.             m.joinvpos = vpos - c_adjbox + (getlinewidth(m.objcode, .T.)/2)
  6380.          ELSE
  6381.             m.joinvpos = vpos+HEIGHT - c_adjbox - (getlinewidth(m.objcode, .T.)/2)
  6382.          ENDIF
  6383.          STORE 4 TO m.vlevel, m.hlevel
  6384.       ENDIF
  6385.  
  6386.    OTHERWISE
  6387.       m.joinvpos = m.tovpos - c_adjbox + (getlinewidth(m.fromcode, .T.)/2)
  6388.       m.vlevel = 0
  6389.       m.hlevel = IIF(objtype = c_otline, 1, 3)
  6390.    ENDCASE
  6391.  
  6392.    IF m.oldhpos1 = m.objhpos OR objtype = c_otline
  6393.       m.joinhpos = hpos - c_adjbox + (getlinewidth(m.objcode, .F.)/2)
  6394.    ELSE
  6395.       m.joinhpos = hpos+WIDTH - c_adjbox - (getlinewidth(m.objcode, .F.)/2)
  6396.    ENDIF
  6397.  
  6398.    DO addjoin WITH m.fromvpos, m.oldhpos1, m.joinvpos, m.joinhpos, m.vlevel, m.hlevel
  6399.    IF m.oldhpos1 <> m.oldhpos2
  6400.       DO addjoin WITH m.fromvpos, m.oldhpos2, m.joinvpos, m.joinhpos, m.vlevel, m.hlevel
  6401.    ENDIF
  6402. ENDIF
  6403.  
  6404. GOTO RECORD m.objrec
  6405. RETURN
  6406.  
  6407. *
  6408. * joinVertical - This procedure adds a join for a vertical line which has been determined to
  6409. *               intersect something horizontal.
  6410. *
  6411. *!*****************************************************************************
  6412. *!
  6413. *!      Procedure: JOINVERTICAL
  6414. *!
  6415. *!      Called by: JOINLINES          (procedure in TRANSPRT.PRG)
  6416. *!
  6417. *!          Calls: GETLINEWIDTH()     (function  in TRANSPRT.PRG)
  6418. *!               : ADDJOIN            (procedure in TRANSPRT.PRG)
  6419. *!
  6420. *!*****************************************************************************
  6421. PROCEDURE joinvertical
  6422. PARAMETER m.oldvpos1, m.oldvpos2, m.fromhpos, m.tohpos, m.fromcode
  6423. PRIVATE m.objvpos, m.objhpos, m.objright, m.objbottom, m.objcode, m.objid, m.objrec
  6424.  
  6425. m.objvpos = vpos
  6426. m.objhpos = hpos
  6427. m.objright = hpos + WIDTH - 1
  6428. m.objbottom = vpos + HEIGHT - 1
  6429. m.objcode = objcode
  6430. m.objid = uniqueid
  6431. m.objrec = RECNO()
  6432.  
  6433. LOCATE FOR platform = m.g_toplatform AND uniqueid = m.objid
  6434. IF FOUND()
  6435.    DO CASE
  6436.    CASE m.fromhpos = m.objhpos OR m.fromhpos = m.objright
  6437.       IF objtype = c_otline
  6438.          m.joinhpos = IIF(m.fromhpos = m.objhpos, hpos, hpos+WIDTH-1)
  6439.          STORE 2 TO m.vlevel, m.hlevel
  6440.       ELSE
  6441.          IF m.fromhpos = m.objhpos
  6442.             m.joinhpos = hpos - c_adjbox + (getlinewidth(m.objcode, .F.)/2)
  6443.          ELSE
  6444.             m.joinhpos = hpos+WIDTH - c_adjbox - (getlinewidth(m.objcode, .F.)/2)
  6445.          ENDIF
  6446.          STORE 4 TO m.vlevel, m.hlevel
  6447.       ENDIF
  6448.  
  6449.    OTHERWISE
  6450.       m.joinhpos = m.tohpos - c_adjbox + (getlinewidth(m.fromcode, .F.)/2)
  6451.       m.vlevel = IIF(objtype = c_otline, 1, 3)
  6452.       m.hlevel = 0
  6453.    ENDCASE
  6454.  
  6455.    IF m.oldvpos1 = m.objvpos OR objtype = c_otline
  6456.       m.joinvpos = vpos - c_adjbox + (getlinewidth(m.objcode, .T.)/2)
  6457.    ELSE
  6458.       m.joinvpos = vpos+HEIGHT - c_adjbox - (getlinewidth(m.objcode, .T.)/2)
  6459.    ENDIF
  6460.  
  6461.    DO addjoin WITH m.oldvpos1, m.fromhpos, m.joinvpos, m.joinhpos, m.vlevel, m.hlevel
  6462.    IF m.oldvpos1 <> m.oldvpos2
  6463.       DO addjoin WITH m.oldvpos2, m.fromhpos, m.joinvpos, m.joinhpos, m.vlevel, m.hlevel
  6464.    ENDIF
  6465. ENDIF
  6466. GOTO RECORD m.objrec
  6467.  
  6468. *
  6469. * MeetBoxChar - This procedure looks at suspected box join characters and adds a join position for each
  6470. *            line which ends one short of it.
  6471. *
  6472. *!*****************************************************************************
  6473. *!
  6474. *!      Procedure: MEETBOXCHAR
  6475. *!
  6476. *!      Called by: JOINLINES          (procedure in TRANSPRT.PRG)
  6477. *!
  6478. *!          Calls: ADDJOIN            (procedure in TRANSPRT.PRG)
  6479. *!
  6480. *!*****************************************************************************
  6481. PROCEDURE meetboxchar
  6482. PRIVATE m.saverec, m.fromvpos, m.fromhpos, m.tovpos, m.tohpos, m.joinrec, m.joinid
  6483. m.saverec = RECNO()
  6484.  
  6485. SCAN FOR platform = m.g_fromplatform AND objtype = c_ottext AND LEN(expr)=3 AND ;
  6486.       ASC(SUBSTR(CPTCOND(c_doscp,c_wincp,expr),2,1)) >= 179 ;
  6487.       AND ASC(SUBSTR(CPTCOND(c_doscp,c_wincp,expr),2,1)) <= 218
  6488.    m.fromvpos = vpos
  6489.    m.fromhpos = hpos
  6490.    m.joinid = uniqueid
  6491.    m.joinrec = RECNO()
  6492.  
  6493.    LOCATE FOR platform = m.g_toplatform AND uniqueid = m.joinid
  6494.    IF FOUND()
  6495.       m.tovpos = vpos
  6496.       m.tohpos = hpos
  6497.  
  6498.       SCAN FOR platform = m.g_fromplatform AND objtype = c_otbox AND (WIDTH = 1 OR height = 1)
  6499.          IF WIDTH = 1 AND hpos = m.fromhpos
  6500.             DO CASE
  6501.             CASE vpos = m.fromvpos + 1
  6502.                DO addjoin WITH vpos, hpos, m.tovpos, m.tohpos, 2, 2
  6503.  
  6504.             CASE vpos+HEIGHT = m.fromvpos
  6505.                DO addjoin WITH vpos+HEIGHT-1, hpos, m.tovpos, m.tohpos, 2, 2
  6506.             ENDCASE
  6507.          ENDIF
  6508.  
  6509.          IF height = 1 AND vpos = m.fromvpos
  6510.             DO CASE
  6511.             CASE hpos = m.fromhpos + 1
  6512.                DO addjoin WITH vpos, hpos, m.tovpos, m.tohpos, 2, 2
  6513.  
  6514.             CASE hpos+WIDTH = m.fromhpos
  6515.                DO addjoin WITH vpos, hpos+WIDTH-1, m.tovpos, m.tohpos, 2, 2
  6516.             ENDCASE
  6517.          ENDIF
  6518.       ENDSCAN
  6519.    ENDIF
  6520.  
  6521.    GOTO RECORD m.joinrec
  6522. ENDSCAN
  6523.  
  6524. IF m.saverec > RECCOUNT()
  6525.    LOCATE FOR .F.
  6526. ELSE
  6527.    GOTO RECORD m.saverec
  6528. ENDIF
  6529. RETURN
  6530.  
  6531. *
  6532. * zapBoxChar - This procedure looks for any text record which is probably a box join
  6533. *            character and replaces it with a transparent space.
  6534. *
  6535. *!*****************************************************************************
  6536. *!
  6537. *!      Procedure: ZAPBOXCHAR
  6538. *!
  6539. *!      Called by: JOINLINES          (procedure in TRANSPRT.PRG)
  6540. *!
  6541. *!*****************************************************************************
  6542. PROCEDURE zapboxchar
  6543. PRIVATE m.recno, m.fromvpos, m.fromhpos
  6544. m.recno = RECNO()
  6545.  
  6546. * See if we can find any single text box/line joining characters in a group.
  6547. SCAN FOR platform = m.g_toplatform AND objtype = c_ottext ;
  6548.       AND boxjoin(objtype,recno(),platform)
  6549.    REPLACE expr WITH '" "'
  6550.    REPLACE mode WITH 1
  6551. ENDSCAN
  6552.  
  6553. IF m.recno > RECCOUNT()
  6554.    GOTO RECCOUNT()
  6555.    SKIP
  6556. ELSE
  6557.    GOTO RECORD m.recno
  6558. ENDIF
  6559. RETURN
  6560.  
  6561. *
  6562. * AddJoin - This routine adds the position for a join character, or modifies a previous join
  6563. *      at the same from position if it has a lower priority.
  6564. *
  6565. *!*****************************************************************************
  6566. *!
  6567. *!      Procedure: ADDJOIN
  6568. *!
  6569. *!      Called by: JOINHORIZONTAL     (procedure in TRANSPRT.PRG)
  6570. *!               : JOINVERTICAL       (procedure in TRANSPRT.PRG)
  6571. *!               : MEETBOXCHAR        (procedure in TRANSPRT.PRG)
  6572. *!
  6573. *!*****************************************************************************
  6574. PROCEDURE addjoin
  6575. PARAMETER m.fromvpos, m.fromhpos, m.tovpos, m.tohpos, m.vmatch, m.hmatch
  6576. PRIVATE m.row, m.key
  6577. m.key = STR(m.fromvpos, 3)+STR(m.fromhpos, 3)
  6578. m.row = ASCAN(joins, m.key)
  6579. IF m.row = 0
  6580.    m.joincount = m.joincount + 1
  6581.    DIMENSION joins[m.joinCount, 5]
  6582.    joins[m.joinCount, 1] = m.key
  6583.    joins[m.joinCount, 2] = m.tovpos
  6584.    joins[m.JoinCount, 3] = m.tohpos
  6585.    joins[m.JoinCount, 4] = m.vmatch
  6586.    joins[m.JoinCount, 5] = m.hmatch
  6587. ELSE
  6588.    m.row = ASUBSCRIPT(joins, m.row, 1)
  6589.  
  6590.    IF m.vmatch > joins[m.row, 4]
  6591.       joins[m.row, 2] = m.tovpos
  6592.       joins[m.row, 4] = m.vmatch
  6593.    ENDIF
  6594.  
  6595.    IF m.hmatch > joins[m.JoinCount, 5]
  6596.       joins[m.row, 3] = m.tohpos
  6597.       joins[m.row, 5] = m.hmatch
  6598.    ENDIF
  6599. ENDIF
  6600.  
  6601. RETURN
  6602.  
  6603. *
  6604. * RejoinBoxes - This routine stretches lines so that they meet the join characters
  6605. *      they did in the from platform.
  6606. *
  6607. *!*****************************************************************************
  6608. *!
  6609. *!      Procedure: REJOINBOXES
  6610. *!
  6611. *!      Called by: JOINLINES          (procedure in TRANSPRT.PRG)
  6612. *!
  6613. *!          Calls: JOINLINEWIDTH()    (function  in TRANSPRT.PRG)
  6614. *!               : GETLINEWIDTH()     (function  in TRANSPRT.PRG)
  6615. *!
  6616. *!*****************************************************************************
  6617. PROCEDURE rejoinboxes
  6618. PARAMETER m.fromvpos, m.fromhpos, m.tovpos, m.tohpos
  6619. PRIVATE m.objectcode, m.objend, m.saverecno, m.objid, m.joinwidth, m.objrec
  6620.  
  6621. m.saverecno = RECNO()
  6622.  
  6623. SCAN FOR platform = m.g_fromplatform AND objtype = c_otbox
  6624.    IF WIDTH = 1 OR height = 1
  6625.       m.objid = uniqueid
  6626.       m.objectcode = objcode
  6627.       m.objrec = RECNO()
  6628.  
  6629.       DO CASE
  6630.          ** A Vertical line which starts at a join character
  6631.       CASE m.fromvpos = vpos AND m.fromhpos = hpos AND WIDTH = 1
  6632.          LOCATE FOR platform = m.g_toplatform AND uniqueid = m.objid
  6633.          IF FOUND()
  6634.             m.objend = vpos + HEIGHT
  6635.             m.joinwidth = joinlinewidth(m.fromvpos, m.fromhpos, .T., m.objid)
  6636.             REPLACE vpos WITH m.tovpos + c_adjbox - (m.joinwidth/2)
  6637.             REPLACE height WITH m.objend - vpos
  6638.             REPLACE hpos WITH m.tohpos + c_adjbox - (getlinewidth(m.objectcode, .F.)/2)
  6639.          ENDIF
  6640.  
  6641.          ** A Horizontal line which starts at a join character
  6642.       CASE m.fromvpos = vpos AND m.fromhpos = hpos AND height = 1
  6643.          LOCATE FOR platform = m.g_toplatform AND uniqueid = m.objid
  6644.          IF FOUND()
  6645.             m.objend = hpos + WIDTH
  6646.             m.joinwidth = joinlinewidth(m.fromvpos, m.fromhpos, .F., m.objid)
  6647.             REPLACE hpos WITH m.tohpos + c_adjbox - (m.joinwidth/2)
  6648.             REPLACE WIDTH WITH m.objend - hpos
  6649.             REPLACE vpos WITH m.tovpos + c_adjbox - (getlinewidth(m.objectcode, .T.)/2)
  6650.          ENDIF
  6651.  
  6652.          ** A Vertical line which ends at a join character
  6653.       CASE m.fromvpos = (vpos+HEIGHT-1) AND m.fromhpos = hpos AND WIDTH = 1
  6654.          LOCATE FOR platform = m.g_toplatform AND uniqueid = m.objid
  6655.          IF FOUND()
  6656.             m.joinwidth = joinlinewidth(m.fromvpos, m.fromhpos, .T., m.objid)
  6657.             REPLACE height WITH (m.tovpos + c_adjbox + (m.joinwidth/2)) - vpos
  6658.             REPLACE hpos WITH m.tohpos + c_adjbox - (getlinewidth(m.objectcode, .F.)/2)
  6659.          ENDIF
  6660.  
  6661.          ** A Horizontal line which ends at a join character
  6662.       CASE m.fromhpos = (hpos+WIDTH-1) AND m.fromvpos = vpos AND height = 1
  6663.          LOCATE FOR platform = m.g_toplatform AND uniqueid = m.objid
  6664.          IF FOUND()
  6665.             m.joinwidth = joinlinewidth(m.fromvpos, m.fromhpos, .F., m.objid)
  6666.             REPLACE WIDTH WITH (m.tohpos + c_adjbox + (m.joinwidth/2)) - hpos
  6667.             REPLACE vpos WITH m.tovpos + c_adjbox - (getlinewidth(m.objectcode, .T.)/2)
  6668.          ENDIF
  6669.       ENDCASE
  6670.  
  6671.       GOTO RECORD m.objrec
  6672.    ENDIF
  6673. ENDSCAN
  6674.  
  6675. IF m.saverecno > RECCOUNT()
  6676.    LOCATE FOR .F.
  6677. ELSE
  6678.    GOTO RECORD m.saverecno
  6679. ENDIF
  6680.  
  6681. RETURN
  6682.  
  6683. *
  6684. * JoinLineWidth - Looks for the thickest line or box which goes through a given point and
  6685. *      Returns either its horizontal or vertical Width.
  6686. *
  6687. *!*****************************************************************************
  6688. *!
  6689. *!       Function: JOINLINEWIDTH
  6690. *!
  6691. *!      Called by: REJOINBOXES        (procedure in TRANSPRT.PRG)
  6692. *!
  6693. *!          Calls: GETLINEWIDTH()     (function  in TRANSPRT.PRG)
  6694. *!
  6695. *!*****************************************************************************
  6696. FUNCTION joinlinewidth
  6697. PARAMETERS m.joinvpos, m.joinhpos, m.horizontal, m.skipid
  6698. PRIVATE m.i, m.saverecno, m.thickness
  6699. m.saverecno = RECNO()
  6700. m.thickness = 0
  6701.  
  6702. SCAN FOR platform = m.g_fromplatform AND objtype = c_otbox AND uniqueid <> m.skipid
  6703.    DO CASE
  6704.    CASE m.horizontal AND WIDTH <> 1 AND ;
  6705.          (ABS(m.joinvpos - vpos) <= 1 OR ABS(m.joinvpos - (vpos+HEIGHT-1)) <= 1) AND ;
  6706.          (m.joinhpos >= hpos AND m.joinhpos <= (hpos+WIDTH-1))
  6707.       m.thickness = MAX(getlinewidth(objcode, .T.), m.thickness)
  6708.  
  6709.    CASE !m.horizontal AND HEIGHT <> 1 AND ;
  6710.          (ABS(m.joinhpos - hpos) <= 1 OR ABS(m.joinhpos - (hpos+WIDTH-1)) <= 1) AND ;
  6711.          (m.joinvpos >= vpos AND m.joinvpos <= (vpos+WIDTH-1))
  6712.       m.thickness = MAX(getlinewidth(objcode, .F.), m.thickness)
  6713.    ENDCASE
  6714. ENDSCAN
  6715.  
  6716. IF m.thickness = 0
  6717.    SCAN FOR platform = m.g_fromplatform AND objtype = c_otbox AND uniqueid <> m.skipid
  6718.       IF (HEIGHT = 1 OR WIDTH = 1) AND ;
  6719.             (ABS(m.joinvpos - vpos) <= 1 OR ABS(m.joinvpos - (vpos+HEIGHT-1)) <= 1) AND ;
  6720.             (ABS(m.joinhpos - hpos) <= 1 OR ABS(m.joinhpos - (hpos+WIDTH-1)) <= 1)
  6721.          m.thickness = MAX(getlinewidth(objcode, m.horizontal), m.thickness)
  6722.       ENDIF
  6723.    ENDSCAN
  6724. ENDIF
  6725.  
  6726. GOTO RECORD m.saverecno
  6727. RETURN m.thickness
  6728.  
  6729. *
  6730. * getLastObjectLine - Determine if this object is the lowest object.
  6731. *
  6732. *!*****************************************************************************
  6733. *!
  6734. *!       Function: GETLASTOBJECTLINE
  6735. *!
  6736. *!      Called by: REPOOBJECTS        (procedure in TRANSPRT.PRG)
  6737. *!
  6738. *!          Calls: HORIZBUTTON()      (function  in TRANSPRT.PRG)
  6739. *!
  6740. *!*****************************************************************************
  6741. FUNCTION getlastobjectline
  6742. PARAMETER m.currentlastline, m.newposition
  6743. PRIVATE m.numitems, m.max
  6744.  
  6745. DO CASE
  6746. CASE objtype = c_ottext OR objtype = c_otchkbox
  6747.    IF vpos > m.currentlastline
  6748.       g_lastobjectline[2] = m.newposition + HEIGHT
  6749.       RETURN vpos + HEIGHT
  6750.    ELSE
  6751.       RETURN m.currentlastline
  6752.    ENDIF
  6753.  
  6754. CASE objtype = c_otradbut OR objtype = c_ottxtbut OR objtype = c_otinvbut
  6755.    IF horizbutton(PICTURE)
  6756.       IF vpos + HEIGHT >= m.currentlastline
  6757.          g_lastobjectline[2] = m.newposition + HEIGHT
  6758.          RETURN vpos
  6759.       ELSE
  6760.          RETURN m.currentlastline
  6761.       ENDIF
  6762.    ELSE
  6763.       m.numitems = OCCURS(';',PICTURE)
  6764.       m.max = vpos + m.numitems + (m.numitems * spacing)
  6765.       IF m.max >= m.currentlastline AND (objtype = c_ottxtbut OR objtype = c_otinvbut) OR ;
  6766.             m.max > m.currentlastline AND objtype = c_otradbut
  6767.          g_lastobjectline[2] = m.newposition + (HEIGHT * (m.numitems + 1)) + ;
  6768.             (spacing * m.numitems)
  6769.          RETURN m.max + 1
  6770.       ELSE
  6771.          RETURN m.currentlastline
  6772.       ENDIF
  6773.    ENDIF
  6774.  
  6775. CASE objtype = c_otpopup
  6776.    IF vpos + 2 > m.currentlastline
  6777.       g_lastobjectline[2] = m.newposition + 2
  6778.       RETURN vpos +1
  6779.    ELSE
  6780.       RETURN m.currentlastline
  6781.    ENDIF
  6782.  
  6783. CASE objtype = c_otfield
  6784.    IF vpos + HEIGHT -1 > m.currentlastline
  6785.       g_lastobjectline[2] = m.newposition + HEIGHT
  6786.       RETURN vpos + HEIGHT -1
  6787.    ELSE
  6788.       RETURN m.currentlastline
  6789.    ENDIF
  6790.  
  6791. CASE objtype = c_otlist OR ;
  6792.       objtype = c_otbox OR objtype = c_otline
  6793.    IF vpos + HEIGHT - 1 > m.currentlastline
  6794.       g_lastobjectline[2] = m.newposition + HEIGHT
  6795.       RETURN vpos + HEIGHT - 1
  6796.    ELSE
  6797.       RETURN m.currentlastline
  6798.    ENDIF
  6799.  
  6800. OTHERWISE
  6801.    RETURN m.currentlastline
  6802.  
  6803. ENDCASE
  6804.  
  6805. *
  6806. * adjobjcode - Adjust object code field for Objtype = 1.
  6807. *
  6808. *!*****************************************************************************
  6809. *!
  6810. *!      Procedure: ADJOBJCODE
  6811. *!
  6812. *!      Called by: ALLENVIRONS        (procedure in TRANSPRT.PRG)
  6813. *!
  6814. *!*****************************************************************************
  6815. PROCEDURE adjobjcode
  6816. * Stuff the right version code into the object code field for the header record
  6817. DO CASE
  6818. CASE objtype = c_otheader OR (m.g_filetype=c_label AND objtype = c_ot20label)
  6819.    REPLACE objcode WITH IIF(m.g_filetype=c_screen,c_25scx,c_25frx)
  6820. CASE objtype = c_otgroup
  6821.    REPLACE objcode WITH 0
  6822. ENDCASE
  6823.  
  6824. *!*****************************************************************************
  6825. *!
  6826. *!      Procedure: GETWINDFONT
  6827. *!
  6828. *!      Called by: NEWCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  6829. *!
  6830. *!          Calls: num2style()        (function  in TRANSPRT.PRG)
  6831. *!
  6832. *!*****************************************************************************
  6833. PROCEDURE getwindfont
  6834. * Get the default font for this window, if one has been defined
  6835. IF m.g_char2grph
  6836.    * Get font information from header
  6837.    GOTO TOP
  6838.    LOCATE FOR platform = m.g_toplatform AND objtype = c_otheader
  6839.    IF FOUND() AND !EMPTY(fontface)
  6840.       m.g_dfltfface  = fontface
  6841.       m.g_dfltfsize  = fontsize
  6842.       m.g_dfltfstyle = num2style(fontstyle)
  6843.    ENDIF
  6844. ENDIF
  6845. RETURN
  6846.  
  6847. *
  6848. * adjHeightAndWidth - Adjust the Height and width of objects.
  6849. *
  6850. *!*****************************************************************************
  6851. *!
  6852. *!      Procedure: ADJHEIGHTANDWIDTH
  6853. *!
  6854. *!      Called by: NEWGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  6855. *!               : FILLININFO         (procedure in TRANSPRT.PRG)
  6856. *!
  6857. *!          Calls: num2style()        (function  in TRANSPRT.PRG)
  6858. *!               : DOSSIZE()          (function  in TRANSPRT.PRG)
  6859. *!               : COLUMNAR()         (function  in TRANSPRT.PRG)
  6860. *!               : ADJTEXT            (procedure in TRANSPRT.PRG)
  6861. *!               : ADJBITMAPCTRL      (procedure in TRANSPRT.PRG)
  6862. *!               : MAXBTNWIDTH()      (function  in TRANSPRT.PRG)
  6863. *!               : ADJBOX             (procedure in TRANSPRT.PRG)
  6864. *!
  6865. *!*****************************************************************************
  6866. PROCEDURE adjheightandwidth
  6867. PRIVATE m.txtwidthratio, m.boldtxtratio, m.chkboxwidth, m.saverec, ;
  6868.    m.oldwidth, m.newheight, m.newwidth, ;
  6869.    m.wndface, m.wndsize, m.wndstyle, m.alignment
  6870. * Only Screen objects come through this routine.
  6871.  
  6872. DO CASE
  6873. CASE m.g_char2grph
  6874.    m.saverec = RECNO()
  6875.    * Get font information from header
  6876.    LOCATE FOR platform = m.g_toplatform AND objtype = c_otheader
  6877.    IF FOUND()
  6878.       m.wndface  = fontface
  6879.       m.wndsize  = fontsize
  6880.       m.wndstyle = fontstyle
  6881.    ELSE
  6882.       m.wndface  = m.g_dfltfface
  6883.       m.wndsize  = m.g_dfltfsize
  6884.       m.wndstyle = m.g_dfltfstyle
  6885.    ENDIF
  6886.    GOTO m.saverec
  6887.  
  6888.    * This is the ratio of character size for the window font to that for the current object font
  6889.    m.txtwidthratio = FONTMETRIC(6, m.wndface, m.wndsize, num2style(m.wndstyle)) / ;
  6890.       FONTMETRIC(6,fontface,fontsize,num2style(fontstyle))
  6891.    m.boldtxtratio = FONTMETRIC(6, m.wndface, m.wndsize, num2style(m.wndstyle)) / ;
  6892.       FONTMETRIC(6,m.g_dfltfface,m.g_dfltfsize,num2style(m.g_boldstylenum))
  6893.    m.chkboxwidth = c_chkpixel / FONTMETRIC(6,m.g_dfltfface,m.g_dfltfsize,num2style(m.g_boldstylenum))
  6894.    m.chkboxwidth = m.chkboxwidth + (m.chkboxwidth / 2)
  6895. CASE m.g_grph2char
  6896.    m.saverec = RECNO()
  6897.    LOCATE FOR platform = m.g_fromplatform AND objtype = c_otheader
  6898.    IF FOUND()
  6899.       m.wndface = fontface
  6900.       m.wndsize = fontsize
  6901.       m.wndstyle = fontstyle
  6902.    ELSE
  6903.       m.wndface  = m.g_ctrlfface    && MS Sans Serif for Windows
  6904.       m.wndsize  = m.g_ctrlfsize
  6905.       m.wndstyle = m.g_ctrlfstyle
  6906.    ENDIF
  6907.    GOTO m.saverec
  6908. ENDCASE
  6909.  
  6910. DO CASE
  6911. CASE objtype = c_ottext
  6912.    DO CASE
  6913.    CASE m.g_char2grph
  6914.       m.oldwidth = WIDTH
  6915.       REPLACE WIDTH WITH TXTWIDTH(SUBSTR(expr, 2,LEN(expr)-2), fontface, ;
  6916.          fontsize, num2style(fontstyle)) && * m.txtwidthratio
  6917.    CASE m.g_grph2char
  6918.       m.oldwidth = ROUND(dossize(WIDTH, fontsize, m.wndsize), 0)
  6919.       m.newheight = 1
  6920.       m.newwidth = LEN(expr)-2
  6921.  
  6922.       m.alignment = columnar(vpos, hpos, WIDTH, objtype)
  6923.       DO CASE
  6924.       CASE m.alignment = 2
  6925.          REPLACE hpos WITH hpos + WIDTH - m.newwidth
  6926.  
  6927.       CASE m.alignment = 0
  6928.          REPLACE vpos WITH vpos + ((HEIGHT - m.newheight) / 2)
  6929.          REPLACE hpos WITH hpos + ((WIDTH - m.newwidth) / 2)
  6930.       ENDCASE
  6931.  
  6932.       REPLACE height WITH MAX(m.newheight,1)
  6933.       REPLACE WIDTH WITH MAX(m.newwidth,1)
  6934.  
  6935.       DO adjtext WITH m.oldwidth
  6936.    ENDCASE
  6937.  
  6938. CASE objtype = c_otchkbox
  6939.    DO CASE
  6940.    CASE m.g_char2grph
  6941.       m.oldwidth = WIDTH
  6942.       REPLACE WIDTH WITH (TXTWIDTH(SUBSTR(PICTURE, 6,LEN(PICTURE)-6) + SPACE(1), fontface, ;
  6943.          fontsize, num2style(fontstyle)) * m.boldtxtratio) + m.chkboxwidth
  6944.       REPLACE height WITH c_chkhght
  6945.    CASE m.g_grph2char
  6946.       DO adjbitmapctrl
  6947.  
  6948.       REPLACE height WITH 1
  6949.       REPLACE WIDTH WITH maxbtnwidth(PICTURE, "", "", "")+4
  6950.    ENDCASE
  6951.  
  6952. CASE objtype = c_otradbut
  6953.    DO CASE
  6954.    CASE m.g_char2grph
  6955.       m.oldwidth = WIDTH
  6956.       DO adjbitmapctrl
  6957.       REPLACE height WITH c_radhght
  6958.    CASE m.g_grph2char
  6959.       REPLACE height WITH 1
  6960.       REPLACE spacing WITH ROUND(dossize(spacing, fontsize, m.wndsize), 0)
  6961.       REPLACE WIDTH WITH MAX(maxbtnwidth(PICTURE, "", "", "")+4, dossize(WIDTH, fontsize, m.wndsize))
  6962.    ENDCASE
  6963.  
  6964. CASE objtype = c_otpopup
  6965.    DO CASE
  6966.    CASE m.g_char2grph
  6967.       * Force all popups to default height
  6968.       REPLACE height WITH m.g_pophght
  6969.    CASE m.g_grph2char
  6970.       m.newheight = 3
  6971.       REPLACE vpos WITH MAX(vpos + ((HEIGHT - m.newheight) / 2),0)
  6972.       REPLACE height WITH m.newheight
  6973.       REPLACE WIDTH WITH dossize(WIDTH, fontsize, m.wndsize)
  6974.    CASE m.g_grph2grph
  6975.       * Force all popups to default height
  6976.       REPLACE height WITH m.g_pophght
  6977.    ENDCASE
  6978.  
  6979. CASE objtype = c_ottxtbut
  6980.    DO CASE
  6981.    CASE m.g_char2grph
  6982.        * Force all push buttons to default height when coming from DOS
  6983.       REPLACE height WITH m.g_btnheight
  6984.    CASE m.g_grph2char
  6985.       DO adjbitmapctrl
  6986.  
  6987.       REPLACE height WITH 1
  6988.       REPLACE spacing WITH ROUND(dossize(spacing, fontsize, m.wndsize), 0)
  6989.       REPLACE WIDTH WITH MAX(maxbtnwidth(PICTURE, "", "", "")+2, dossize(WIDTH, fontsize, m.wndsize))
  6990.     CASE m.g_grph2grph
  6991.         * This case is handled in fillininfo
  6992.    ENDCASE
  6993.  
  6994. CASE objtype = c_otfield
  6995.    DO CASE
  6996.    CASE m.g_char2grph
  6997.       REPLACE height WITH height + c_adjfld
  6998.    CASE m.g_grph2char
  6999.       IF INLIST(objcode,c_sgsay, c_sgget)
  7000.          REPLACE height WITH 1
  7001.       ELSE
  7002.          REPLACE height WITH MAX(dossize(HEIGHT, fontsize, m.wndsize),1)
  7003.       ENDIF
  7004.       REPLACE WIDTH WITH MAX(dossize(WIDTH, fontsize, m.wndsize),1)
  7005.    ENDCASE
  7006.  
  7007. CASE objtype = c_otline OR objtype = c_otbox
  7008.    IF m.g_grph2char
  7009.       DO adjbox WITH 0
  7010.    ENDIF
  7011. ENDCASE
  7012.  
  7013. IF m.g_grph2char OR m.g_char2grph AND isobject(objtype)
  7014.       REPLACE hpos WITH MAX(hpos,0)
  7015.     REPLACE vpos WITH MAX(vpos,0)
  7016. ENDIF
  7017.  
  7018. RETURN
  7019.  
  7020. *
  7021. * Columnar - This function takes and object and checks to see if it
  7022. *      is right or left aligned with other objects in a column.
  7023. *      Return values are:
  7024. *         0 - Not aligned
  7025. *         1 - Left aligned
  7026. *         2 - Right aligned
  7027. *
  7028. *!*****************************************************************************
  7029. *!
  7030. *!       Function: COLUMNAR
  7031. *!
  7032. *!      Called by: ADJHEIGHTANDWIDTH  (procedure in TRANSPRT.PRG)
  7033. *!
  7034. *!*****************************************************************************
  7035. FUNCTION columnar
  7036. PARAMETER m.vpos, m.hpos, m.type, m.otype
  7037. PRIVATE m.saverec
  7038.  
  7039. m.saverec = RECNO()
  7040.  
  7041. LOCATE FOR platform = m.g_fromplatform AND objtype = m.type AND ;
  7042.    hpos = m.hpos AND ABS(vpos - m.vpos) < m.vpos * 2
  7043. IF FOUND()
  7044.    GOTO RECORD (m.saverec)
  7045.    RETURN 1
  7046. ENDIF
  7047.  
  7048. LOCATE FOR platform = m.g_fromplatform AND objtype = m.type AND ;
  7049.    hpos + WIDTH = m.hpos + m.width  AND ;
  7050.    ABS(vpos - m.vpos) < m.vpos * 2
  7051. IF FOUND()
  7052.    GOTO RECORD (m.saverec)
  7053.    RETURN 2
  7054. ENDIF
  7055.  
  7056. GOTO RECORD (m.saverec)
  7057. RETURN 0
  7058.  
  7059. *
  7060. * DOSSize - This function attempts to normalize a dimension of an object to the font used for the
  7061. *      window it lies in.  Unfortunately, we can't use FONTMETRIC since this needs to run on a character
  7062. *      platform.  We use the ratio of point sizes.
  7063. *
  7064. *!*****************************************************************************
  7065. *!
  7066. *!       Function: DOSSIZE
  7067. *!
  7068. *!      Called by: ADJHEIGHTANDWIDTH  (procedure in TRANSPRT.PRG)
  7069. *!
  7070. *!*****************************************************************************
  7071. FUNCTION dossize
  7072. PARAMETER m.size, m.objsize, m.scrnsize
  7073. RETURN m.size * (m.objsize / m.scrnsize)
  7074.  
  7075. *
  7076. * AdjBitmapCtrl - Take the Picture clause for a control, see if it is a bitmap and
  7077. *      turn it into something that a character platform can handle.
  7078. *
  7079. *!*****************************************************************************
  7080. *!
  7081. *!      Procedure: ADJBITMAPCTRL
  7082. *!
  7083. *!      Called by: ADJHEIGHTANDWIDTH  (procedure in TRANSPRT.PRG)
  7084. *!
  7085. *!          Calls: STRIPPATH()        (function  in TRANSPRT.PRG)
  7086. *!
  7087. *!*****************************************************************************
  7088. PROCEDURE adjbitmapctrl
  7089. PRIVATE m.function, m.oldpicture, m.newpicture, m.temp
  7090.  
  7091. m.function = ALLTRIM(SUBSTR(PICTURE, 1, AT(" ", PICTURE)))
  7092.  
  7093. IF AT("B", m.function) <> 0
  7094.    m.function = CHRTRAN(m.function, "B", "")
  7095.    m.oldpicture = ALLTRIM(SUBSTR(PICTURE, AT(" ", PICTURE)))
  7096.    m.newpicture = ""
  7097.  
  7098.    DO WHILE LEN(m.oldpicture) > 0
  7099.       IF AT(";", m.oldpicture) = 0
  7100.          m.temp = LEFT(m.oldpicture, LEN(m.oldpicture)-1)
  7101.          m.oldpicture = ""
  7102.       ELSE
  7103.          m.temp = LEFT(m.oldpicture, AT(";", m.oldpicture)-1)
  7104.          m.oldpicture = SUBSTR(m.oldpicture, AT(";", m.oldpicture)+1)
  7105.       ENDIF
  7106.  
  7107.       IF LEN(m.newpicture) = 0
  7108.          m.newpicture = ALLTRIM(strippath(m.temp))
  7109.       ELSE
  7110.          m.newpicture = m.newpicture + ";" + ALLTRIM(strippath(m.temp))
  7111.       ENDIF
  7112.    ENDDO
  7113.  
  7114.    REPLACE PICTURE WITH m.function + " " + m.newpicture + '"'
  7115. ENDIF
  7116.  
  7117. RETURN
  7118. *
  7119. * AdjColor - Adjust color fields in the database.
  7120. *
  7121. *!*****************************************************************************
  7122. *!
  7123. *!      Procedure: ADJCOLOR
  7124. *!
  7125. *!      Called by: ALLENVIRONS        (procedure in TRANSPRT.PRG)
  7126. *!               : FILLININFO         (procedure in TRANSPRT.PRG)
  7127. *!               : RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  7128. *!               : LABELLINES         (procedure in TRANSPRT.PRG)
  7129. *!
  7130. *!          Calls: CONVERTCOLORPAIR   (procedure in TRANSPRT.PRG)
  7131. *!               : RGBTOX()           (function  in TRANSPRT.PRG)
  7132. *!
  7133. *!*****************************************************************************
  7134. PROCEDURE adjcolor
  7135. DO CASE
  7136. CASE m.g_char2grph
  7137.    IF m.g_filetype = c_report OR m.g_filetype = c_label OR EMPTY(colorpair)
  7138.       IF m.g_filetype = c_screen
  7139.          REPLACE colorpair WITH ""
  7140.          REPLACE penred    WITH -1
  7141.          REPLACE pengreen  WITH -1
  7142.          REPLACE penblue   WITH -1
  7143.          REPLACE fillred   WITH -1
  7144.          REPLACE fillgreen WITH -1
  7145.          REPLACE fillblue  WITH -1
  7146.       ELSE
  7147.          REPLACE penred    WITH 0
  7148.          REPLACE pengreen  WITH 0
  7149.          REPLACE penblue   WITH 0
  7150.          IF objtype = c_otline
  7151.             REPLACE fillred   WITH 0
  7152.             REPLACE fillgreen WITH 0
  7153.             REPLACE fillblue  WITH 0
  7154.          ELSE
  7155.             REPLACE fillred   WITH 255
  7156.             REPLACE fillgreen WITH 255
  7157.             REPLACE fillblue  WITH 255
  7158.          ENDIF
  7159.       ENDIF
  7160.    ELSE
  7161.       DO convertcolorpair
  7162.    ENDIF
  7163. CASE m.g_grph2char
  7164.    IF m.g_filetype = c_screen
  7165.       DO CASE
  7166.       CASE objtype = c_otheader
  7167.          DO CASE
  7168.          CASE STYLE = c_user
  7169.             IF SCHEME + scheme2 = 0
  7170.                REPLACE SCHEME WITH 1
  7171.                REPLACE scheme2 WITH 2
  7172.             ENDIF
  7173.  
  7174.          CASE STYLE = c_system
  7175.             REPLACE SCHEME WITH 8
  7176.             REPLACE scheme2 WITH 9
  7177.  
  7178.          CASE STYLE = c_dialog
  7179.             REPLACE SCHEME WITH 5
  7180.             REPLACE scheme2 WITH 6
  7181.  
  7182.          CASE STYLE = c_alert
  7183.             REPLACE SCHEME WITH 7
  7184.             REPLACE SCHEME WITH 12
  7185.          ENDCASE
  7186.  
  7187.       CASE c_maptextcolor AND INLIST(objtype,c_otbox, c_otline,c_ottext)
  7188.          IF penred <> -1 OR fillred <> -1
  7189.             REPLACE colorpair WITH rgbtox(penred, penblue, pengreen) + "/" + ;
  7190.                rgbtox(fillred, fillblue, fillgreen)
  7191.             * Don't let it map to black on black
  7192.             IF colorpair = "N/N" OR TRIM(colorpair) == "/"
  7193.                REPLACE colorpair WITH ""
  7194.             ENDIF
  7195.          ENDIF
  7196.       OTHERWISE
  7197.           REPLACE scheme WITH 0   && default color scheme for everything else
  7198.       ENDCASE
  7199.    ENDIF
  7200. ENDCASE
  7201. RETURN
  7202.  
  7203. *
  7204. * RGBToX - Convert an RGB triplet to a traditional xBase color letter
  7205. *
  7206. *!*****************************************************************************
  7207. *!
  7208. *!       Function: RGBTOX
  7209. *!
  7210. *!      Called by: ADJCOLOR           (procedure in TRANSPRT.PRG)
  7211. *!
  7212. *!*****************************************************************************
  7213. FUNCTION rgbtox
  7214. PARAMETERS m.red, m.blue, m.green
  7215. PRIVATE m.color
  7216.  
  7217. *
  7218. * If it is automatic, we skip it.
  7219. *
  7220. IF m.red < 0 OR m.blue < 0 OR m.green < 0
  7221.    RETURN ""
  7222. ENDIF
  7223.  
  7224. *
  7225. * We use a special triplet for Light Gray which makes it a special case.
  7226. *
  7227. IF m.red = 192 AND m.blue = 192 AND m.green = 192
  7228.    RETURN "W"
  7229. ENDIF
  7230. IF _MAC AND m.red = 221 AND m.blue = 221 AND m.green = 221
  7231.    RETURN "W"
  7232. ENDIF
  7233.  
  7234. *
  7235. * This division makes sure that we give a letter for any possible triplet
  7236. *
  7237. m.red   = ROUND(m.red / 127, 0)
  7238. m.blue = ROUND(m.blue / 127, 0)
  7239. m.green = ROUND(m.green / 127, 0)
  7240.  
  7241. *
  7242. * Save some time by getting a number we can make a single comparison against
  7243. *
  7244. m.color = (m.red * 100) + (m.blue * 10) + m.green
  7245.  
  7246. DO CASE
  7247. CASE m.color = 222      && White
  7248.    RETURN "W+"
  7249. CASE m.color = 0        && Black
  7250.    RETURN "N"
  7251. CASE m.color = 111      && Dark Gray
  7252.    RETURN "N+"
  7253. CASE m.color = 200      && Light Red
  7254.    RETURN "R+"
  7255. CASE m.color = 100      && Dark Red
  7256.    RETURN "R"
  7257. CASE m.color = 220      && Yellow
  7258.    RETURN "GR+"
  7259. CASE m.color = 110      && Brown
  7260.    RETURN "GR"
  7261. CASE m.color = 2        && Light green
  7262.    RETURN "G+"
  7263. CASE m.color = 1        && Dark Green
  7264.    RETURN "G"
  7265. CASE m.color = 22       && Light Magenta
  7266.    RETURN "BG+"
  7267. CASE m.color = 11       && Dark Magenta
  7268.    RETURN "BG"
  7269. CASE m.color = 20       && Light Blue
  7270.    RETURN "B+"
  7271. CASE m.color = 10       && Dark Blue
  7272.    RETURN "B"
  7273. CASE m.color = 202      && Light Purple
  7274.    RETURN "RB+"
  7275. CASE m.color = 101      && Dark Purple
  7276.    RETURN "RB"
  7277. ENDCASE
  7278.  
  7279. RETURN ""      && It shouldn't be possible to reach this point.
  7280.  
  7281. *
  7282. * \ - Adjust pen attributes.
  7283. *
  7284. *!*****************************************************************************
  7285. *!
  7286. *!      Procedure: ADJPEN
  7287. *!
  7288. *!      Called by: FILLININFO         (procedure in TRANSPRT.PRG)
  7289. *!
  7290. *!*****************************************************************************
  7291. PROCEDURE adjpen
  7292. IF m.g_char2grph
  7293.    DO CASE
  7294.    CASE objtype = c_ottext
  7295.       REPLACE pensize WITH 1
  7296.       REPLACE penpat  WITH 0
  7297.       REPLACE fillpat WITH 0
  7298.  
  7299.    OTHERWISE
  7300.       REPLACE pensize WITH 0
  7301.       REPLACE penpat  WITH 0
  7302.       REPLACE fillpat WITH 0
  7303.    ENDCASE
  7304. ENDIF
  7305. RETURN
  7306. *
  7307. * adjfont - Adjust font fields in the SCX or FRX database.
  7308. *
  7309. *!*****************************************************************************
  7310. *!
  7311. *!      Procedure: ADJFONT
  7312. *!
  7313. *!      Called by: ALLENVIRONS        (procedure in TRANSPRT.PRG)
  7314. *!               : FILLININFO         (procedure in TRANSPRT.PRG)
  7315. *!               : RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  7316. *!               : LABELLINES         (procedure in TRANSPRT.PRG)
  7317. *!
  7318. *!*****************************************************************************
  7319. PROCEDURE adjfont
  7320. PRIVATE m.i, m.outface, m.outsize, m.outstyle
  7321. m.outface  = fontface
  7322. m.outsize  = fontsize
  7323. m.outstyle = num2style(fontstyle)
  7324. DO CASE
  7325. CASE m.g_char2grph OR m.g_grph2grph
  7326.    DO CASE
  7327.    CASE objtype = c_otheader
  7328.         DO CASE
  7329.         CASE m.g_fontset
  7330.             * User chose a font with the "font" push button.  Use it for the
  7331.             * measurement font regardless of what used to be there.
  7332.             REPLACE fontface  WITH m.g_dfltfface
  7333.              REPLACE fontsize  WITH m.g_dfltfsize
  7334.              REPLACE fontstyle WITH style2num(m.g_dfltfstyle)
  7335.         CASE commonfont(fontface)
  7336.             * Original measurement font was Arial, Courier, etc.  Leave it
  7337.             * alone.
  7338.         OTHERWISE
  7339.             * Use the defaults
  7340.             REPLACE fontface  WITH m.g_windfface
  7341.              REPLACE fontsize  WITH m.g_windfsize
  7342.              REPLACE fontstyle WITH style2num(m.g_windfstyle)
  7343.         ENDCASE
  7344.  
  7345.    CASE INLIST(objtype,c_ottxtbut,c_otradbut,c_otchkbox,c_otinvbut,c_otspinner)
  7346.         IF !commonfont(fontface)
  7347.           REPLACE fontface  WITH m.g_ctrlfface
  7348.           REPLACE fontsize  WITH m.g_ctrlfsize
  7349.           REPLACE fontstyle WITH style2num(m.g_ctrlfstyle)
  7350.         ENDIF
  7351.  
  7352.    CASE INLIST(objtype, c_otbox, c_otline)
  7353.         IF !commonfont(fontface)
  7354.              REPLACE fontface  WITH m.g_ctrlfface
  7355.              REPLACE fontsize  WITH m.g_ctrlfsize
  7356.              REPLACE fontstyle WITH style2num(m.g_ctrlfstyle)
  7357.         ENDIF
  7358.  
  7359.    CASE objtype = c_otpopup
  7360.         IF !commonfont(fontface)
  7361.           REPLACE fontface  WITH m.g_ctrlfface
  7362.           REPLACE fontsize  WITH m.g_ctrlfsize
  7363.           REPLACE fontstyle WITH m.g_normstylenum
  7364.       ENDIF
  7365.  
  7366.    CASE objtype = c_ottext
  7367.       DO CASE
  7368.         CASE m.g_char2grph OR (m.g_grph2grph AND m.g_fontset)
  7369.          REPLACE fontface  WITH m.g_dfltfface
  7370.          REPLACE fontsize  WITH m.g_dfltfsize
  7371.          REPLACE fontstyle WITH m.g_boldstylenum
  7372.         CASE !commonfont(fontface)
  7373.             DO mapfont WITH fontface, fontsize, num2style(fontstyle), m.outface, m.outsize, m.outstyle, _MAC
  7374.             REPLACE fontface  WITH m.outface
  7375.             REPLACE fontsize  WITH m.outsize
  7376.             REPLACE fontstyle WITH style2num(m.outstyle)
  7377.       ENDCASE
  7378.  
  7379.    CASE objtype = c_otfield
  7380.         DO CASE
  7381.       CASE m.g_char2grph OR (m.g_grph2grph AND m.g_fontset)
  7382.          REPLACE fontface  WITH m.g_dfltfface
  7383.          REPLACE fontsize  WITH m.g_dfltfsize
  7384.          REPLACE fontstyle WITH m.g_normstylenum
  7385.       CASE !commonfont(fontface)
  7386.             DO mapfont WITH fontface, fontsize, num2style(fontstyle), m.outface, m.outsize, m.outstyle, _MAC
  7387.             REPLACE fontface  WITH m.outface
  7388.             REPLACE fontsize  WITH m.outsize
  7389.             REPLACE fontstyle WITH style2num(m.outstyle)
  7390.       ENDCASE
  7391.  
  7392.    OTHERWISE
  7393.         DO CASE
  7394.       CASE m.g_char2grph OR (m.g_grph2grph AND m.g_fontset)
  7395.          REPLACE fontface  WITH m.g_dfltfface
  7396.          REPLACE fontsize  WITH m.g_dfltfsize
  7397.          REPLACE fontstyle WITH m.g_normstylenum
  7398.       CASE !commonfont(fontface)
  7399.             DO mapfont WITH fontface, fontsize, num2style(fontstyle), m.outface, m.outsize, m.outstyle, _MAC
  7400.             REPLACE fontface  WITH m.outface
  7401.             REPLACE fontsize  WITH m.outsize
  7402.             REPLACE fontstyle WITH style2num(m.outstyle)
  7403.         ENDCASE
  7404.    ENDCASE
  7405. ENDCASE
  7406. RETURN
  7407.  
  7408. *!*****************************************************************************
  7409. *!
  7410. *!      Function: COMMONFONT
  7411. *!
  7412. *!*****************************************************************************
  7413. FUNCTION commonfont
  7414. * Is the font one that is in common for Mac and Windows?
  7415. PARAMETER m.thefont
  7416. m.thefont = UPPER(ALLTRIM(m.thefont))
  7417. RETURN INLIST(m.thefont, "ARIAL", "COURIER NEW", "TIMES NEW ROMAN")
  7418.  
  7419. *
  7420. * convertColorPair - Convert the color pair to appropriate RGB pen
  7421. *               and fill values.
  7422. *
  7423. *!*****************************************************************************
  7424. *!
  7425. *!      Procedure: CONVERTCOLORPAIR
  7426. *!
  7427. *!      Called by: ADJCOLOR           (procedure in TRANSPRT.PRG)
  7428. *!
  7429. *!          Calls: GETCOLOR()         (function  in TRANSPRT.PRG)
  7430. *!
  7431. *!*****************************************************************************
  7432. PROCEDURE convertcolorpair
  7433. PRIVATE m.oldscheme, m.rgbvalue, m.comma, m.frg, m.bkg
  7434.  
  7435. * Translate foreground colors
  7436. m.frg = UPPER(CHRTRAN(LEFT(colorpair,AT('/',colorpair)-1),'-*/, ',''))
  7437. REPLACE penred    WITH -1
  7438. REPLACE pengreen  WITH -1
  7439. REPLACE penblue   WITH -1
  7440. IF "W" $ m.frg
  7441.    REPLACE penred    WITH IIF('+' $ m.frg,255,128)
  7442.    REPLACE pengreen  WITH IIF('+' $ m.frg,255,128)
  7443.    REPLACE penblue   WITH IIF('+' $ m.frg,255,128)
  7444. ENDIF
  7445. IF "N" $ m.frg
  7446.    REPLACE penred    WITH 0
  7447.    REPLACE pengreen  WITH 0
  7448.    REPLACE penblue   WITH 0
  7449. ENDIF
  7450. IF "R" $ m.frg    && red
  7451.    REPLACE penred    WITH IIF('+' $ m.frg,255,128)
  7452. ENDIF
  7453. IF "G" $ m.frg    && green
  7454.    REPLACE pengreen  WITH IIF('+' $ m.frg,255,128)
  7455. ENDIF
  7456. IF "B" $ m.frg    && blue
  7457.    REPLACE penblue   WITH IIF('+' $ m.frg,255,128)
  7458. ENDIF
  7459. REPLACE penred   WITH IIF(penred < 0,0,penred)
  7460. REPLACE pengreen WITH IIF(pengreen < 0,0,pengreen)
  7461. REPLACE penblue  WITH IIF(penblue < 0,0,penblue)
  7462.  
  7463. m.bkg = UPPER(CHRTRAN(SUBSTR(colorpair,AT('/',colorpair)+1,3),'-*/, ',''))
  7464. REPLACE fillred    WITH -1
  7465. REPLACE fillgreen  WITH -1
  7466. REPLACE fillblue   WITH -1
  7467. DO CASE
  7468. CASE m.bkg = "W" OR m.bkg = "W+"    && white
  7469.    REPLACE fillred    WITH IIF('+' $ m.bkg,255,128)
  7470.    REPLACE fillgreen  WITH IIF('+' $ m.bkg,255,128)
  7471.    REPLACE fillblue   WITH IIF('+' $ m.bkg,255,128)
  7472. CASE m.bkg = "N" OR m.bkg = "N+"    && black
  7473.    REPLACE fillred    WITH 0
  7474.    REPLACE fillgreen  WITH 0
  7475.    REPLACE fillblue   WITH 0
  7476. CASE "R" $ m.bkg OR "G" $ m.bkg OR "B" $ m.bkg
  7477.    IF "R" $ m.bkg    && red
  7478.       REPLACE fillred    WITH IIF('+' $ m.bkg,255,128)
  7479.    ENDIF
  7480.    IF "G" $ m.bkg    && green
  7481.       REPLACE fillgreen  WITH IIF('+' $ m.bkg,255,128)
  7482.    ENDIF
  7483.    IF "B" $ m.bkg    && blue
  7484.       REPLACE fillblue   WITH IIF('+' $ m.bkg,255,128)
  7485.    ENDIF
  7486.    REPLACE fillred   WITH IIF(fillred < 0,0,fillred)
  7487.    REPLACE fillgreen WITH IIF(fillgreen < 0,0,fillgreen)
  7488.    REPLACE fillblue  WITH IIF(fillblue < 0,0,fillblue)
  7489. ENDCASE
  7490. RETURN
  7491.  
  7492. * getColor - Return the color value for a specified RGB value.
  7493. *
  7494. *!*****************************************************************************
  7495. *!
  7496. *!       Function: GETCOLOR
  7497. *!
  7498. *!      Called by: CONVERTCOLORPAIR   (procedure in TRANSPRT.PRG)
  7499. *!
  7500. *!*****************************************************************************
  7501. FUNCTION getcolor
  7502. PARAMETER m.rgbstring, m.occurence
  7503. PRIVATE m.comma, m.value
  7504. m.comma = ATC(',', m.rgbstring, m.occurence)
  7505. m.value = SUBSTR(m.rgbstring, m.comma +1, ;
  7506.    ATC(',', m.rgbstring, m.occurence + 1)-m.comma -1)
  7507. RETURN m.value
  7508.  
  7509. *
  7510. *num2style - Return the style string which corresponds to the style
  7511. *         stored in screen database.
  7512. *
  7513. *!*****************************************************************************
  7514. *!
  7515. *!       Function: num2style
  7516. *!
  7517. *!      Called by: ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  7518. *!               : FILLININFO         (procedure in TRANSPRT.PRG)
  7519. *!               : ITEMSINBOXES       (procedure in TRANSPRT.PRG)
  7520. *!               : GETWINDFONT        (procedure in TRANSPRT.PRG)
  7521. *!               : ADJHEIGHTANDWIDTH  (procedure in TRANSPRT.PRG)
  7522. *!
  7523. *!*****************************************************************************
  7524. FUNCTION num2style
  7525. PARAMETER m.stylenum
  7526. PRIVATE m.i, m.strg, m.pow, m.stylechars, m.outstrg
  7527.  
  7528. DO CASE
  7529. CASE TYPE("m.stylenum") = "C"
  7530.    * already a character.  Do nothing.
  7531.    RETURN m.stylenum
  7532. CASE !EMPTY(m.stylenum)
  7533.     m.strg = ""
  7534.     * These are the style characters.  Their position in the string matches the bit
  7535.     * position in the num byte.
  7536.     m.stylechars = "BIUOSCE-"
  7537.  
  7538.     * Look at each of the bits in the stylenum byte
  7539.     FOR m.i = 8 TO 1 STEP -1
  7540.        m.pow = ROUND(2^(i-1),0)
  7541.         IF m.stylenum >= m.pow
  7542.            m.strg = m.strg + SUBSTR(stylechars,m.i,1)
  7543.         ENDIF
  7544.         IF m.pow <> 0
  7545.            m.stylenum = m.stylenum % m.pow
  7546.       ENDIF
  7547.     ENDFOR
  7548.  
  7549.     * Now reverse the string so that style codes appear in the traditional order
  7550.     m.outstrg = ""
  7551.     FOR m.i = 1 TO LEN(m.strg)
  7552.        m.outstrg = m.outstrg + SUBSTR(m.strg,LEN(m.strg)+1-m.i,1)
  7553.     ENDFOR
  7554.     RETURN m.outstrg
  7555. OTHERWISE
  7556.    RETURN ""
  7557. ENDCASE
  7558. *!*****************************************************************************
  7559. *!
  7560. *!       Function: style2num
  7561. *!
  7562. *!*****************************************************************************
  7563. FUNCTION style2num
  7564. * Map style code (e.g., "B") to screen/report numeric style code (e.g., 1)
  7565. PARAMETER m.strg
  7566. PRIVATE m.num, m.i
  7567. m.strg= UPPER(ALLTRIM(m.strg))
  7568. DO CASE
  7569. CASE TYPE("m.strg") $ "NF"
  7570.    * already a number. Do nothing.
  7571.    RETURN m.strg
  7572. CASE !EMPTY(strg)
  7573.     m.num = 0
  7574.     FOR m.i = 1 TO LEN(m.strg)
  7575.        DO CASE
  7576.        CASE SUBSTR(m.strg,i,1) = "B"      && bold
  7577.           m.num = m.num + 1
  7578.        CASE SUBSTR(m.strg,i,1) = "I"         && italic
  7579.           m.num = m.num + 2
  7580.        CASE SUBSTR(m.strg,i,1) = "U"      && underlined
  7581.           m.num = m.num + 4
  7582.        CASE SUBSTR(m.strg,i,1) = "O"      && outline
  7583.           m.num = m.num + 8
  7584.        CASE SUBSTR(m.strg,i,1) = "S"      && shadow
  7585.           m.num = m.num + 16
  7586.        CASE SUBSTR(m.strg,i,1) = "C"         && condensed
  7587.           m.num = m.num + 32
  7588.        CASE SUBSTR(m.strg,i,1) = "E"      && extended
  7589.           m.num = m.num + 64
  7590.        CASE SUBSTR(m.strg,i,1) = "-"      && strikeout
  7591.           m.num = m.num + 128
  7592.        ENDCASE
  7593.     ENDFOR
  7594.     RETURN m.num
  7595. OTHERWISE
  7596.    RETURN 0
  7597. ENDCASE
  7598.  
  7599. *
  7600. * AdjText - Takes the current record and, if it is a multi-line text object, converts it into
  7601. *      multiple single line text objects.
  7602. *
  7603. *!*****************************************************************************
  7604. *!
  7605. *!      Procedure: ADJTEXT
  7606. *!
  7607. *!      Called by: RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  7608. *!               : ADJHEIGHTANDWIDTH  (procedure in TRANSPRT.PRG)
  7609. *!
  7610. *!*****************************************************************************
  7611. PROCEDURE adjtext
  7612. PARAMETER m.oldwidth
  7613.  
  7614. PRIVATE m.saverec
  7615.  
  7616. IF objtype <> c_ottext OR AT(CHR(13), expr) = 0 OR !m.g_grph2char
  7617.    RETURN
  7618. ENDIF
  7619.  
  7620. m.saverec = RECNO()
  7621. SCATTER MEMVAR MEMO
  7622.  
  7623. * Update the original records
  7624. m.expr = SUBSTR(m.expr, 2, LEN(m.expr)-2)
  7625. m.pos = AT(CHR(13), m.expr)
  7626. REPLACE expr WITH '"' + LEFT(m.expr, m.pos-1) + '"'
  7627. REPLACE WIDTH WITH LEN(expr)-2
  7628. DO CASE
  7629. CASE m.picture = '"@J"'                        && Right aligned
  7630.    REPLACE hpos WITH hpos + m.oldwidth - WIDTH
  7631. CASE m.picture = '"@I"'                        && Centered
  7632.    REPLACE hpos WITH hpos + (m.oldwidth - WIDTH)/2
  7633. ENDCASE
  7634. m.expr = SUBSTR(m.expr, m.pos+1)
  7635. m.pos = AT(CHR(13), m.expr)
  7636. REPLACE hpos WITH MAX(0,hpos)
  7637.  
  7638. * Write all records but the last
  7639. DO WHILE m.pos > 0
  7640.    m.vpos = m.vpos + IIF(spacing = 1, m.height * 2, m.height)
  7641.    APPEND BLANK
  7642.    GATHER MEMVAR MEMO
  7643.    REPLACE platform WITH LOWER(platform)
  7644.    REPLACE uniqueid WITH SYS(2015)
  7645.    REPLACE expr WITH '"' + LEFT(m.expr, m.pos-1) + '"'
  7646.    REPLACE WIDTH WITH LEN(expr)-2
  7647.    DO CASE
  7648.    CASE m.picture = '"@J"'                     && Right aligned
  7649.       REPLACE hpos WITH hpos + m.oldwidth - WIDTH
  7650.    CASE m.picture = '"@I"'                     && Centered
  7651.       REPLACE hpos WITH hpos + (m.oldwidth - WIDTH)/2
  7652.    ENDCASE
  7653.  
  7654.    m.expr = SUBSTR(m.expr, m.pos+1)
  7655.    m.pos = AT(CHR(13), m.expr)
  7656.    REPLACE hpos WITH MAX(0,hpos)
  7657. ENDDO
  7658.  
  7659. * Write the last record.
  7660. IF LEN(ALLTRIM(m.expr)) <> 0
  7661.    m.vpos = m.vpos + IIF(spacing = 1, m.height * 2, m.height)
  7662.    APPEND BLANK
  7663.    GATHER MEMVAR MEMO
  7664.    REPLACE platform WITH LOWER(platform)
  7665.    REPLACE uniqueid WITH SYS(2015)
  7666.    REPLACE expr WITH '"' + m.expr + '"'
  7667.    REPLACE WIDTH WITH LEN(expr)-2
  7668.    DO CASE
  7669.    CASE m.picture = '"@J"'                     && Right aligned
  7670.       REPLACE hpos WITH hpos + m.oldwidth - WIDTH
  7671.    CASE m.picture = '"@I"'                     && Centered
  7672.       REPLACE hpos WITH hpos + (m.oldwidth - WIDTH)/2
  7673.    ENDCASE
  7674.    REPLACE hpos WITH MAX(0,hpos)
  7675. ENDIF
  7676.  
  7677. GOTO m.saverec
  7678. RETURN
  7679.  
  7680. *
  7681. *
  7682. * AdjBox - Converts a box/line record from character to graphic or graphic to character
  7683. *
  7684. *!*****************************************************************************
  7685. *!
  7686. *!      Procedure: ADJBOX
  7687. *!
  7688. *!      Called by: RPTOBJCONVERT      (procedure in TRANSPRT.PRG)
  7689. *!               : REPOOBJECTS        (procedure in TRANSPRT.PRG)
  7690. *!               : ADJHEIGHTANDWIDTH  (procedure in TRANSPRT.PRG)
  7691. *!
  7692. *!          Calls: GETLINEWIDTH()     (function  in TRANSPRT.PRG)
  7693. *!
  7694. *!*****************************************************************************
  7695. PROCEDURE adjbox
  7696. PARAMETER m.adjust
  7697. DO CASE
  7698. CASE m.g_char2grph
  7699.    DO CASE
  7700.    CASE objcode = c_sgboxd
  7701.       REPLACE pensize WITH 4
  7702.    CASE objcode = c_sgboxp
  7703.       REPLACE pensize WITH 6
  7704.    OTHERWISE
  7705.       REPLACE pensize WITH 1
  7706.    ENDCASE
  7707.  
  7708.    DO CASE
  7709.    CASE height = 1
  7710.       REPLACE height WITH getlinewidth(objcode, .T.)
  7711.       REPLACE vpos WITH vpos + c_adjbox - (HEIGHT/2)
  7712.       IF m.g_filetype = c_screen
  7713.          REPLACE STYLE WITH c_lnhorizontal
  7714.       ENDIF
  7715.  
  7716.       REPLACE penpat  WITH 8
  7717.       REPLACE fillpat WITH 0
  7718.       REPLACE objtype WITH c_otline
  7719.       REPLACE objcode WITH 0
  7720.  
  7721.    CASE WIDTH = 1
  7722.       REPLACE WIDTH WITH getlinewidth(objcode, .F.)
  7723.       REPLACE hpos WITH hpos + c_adjbox - (WIDTH/2)
  7724.       IF m.g_filetype = c_screen
  7725.          REPLACE STYLE WITH c_lnvertical
  7726.       ENDIF
  7727.  
  7728.       REPLACE penpat  WITH 8
  7729.       REPLACE fillpat WITH 0
  7730.       REPLACE objtype WITH c_otline
  7731.       REPLACE objcode WITH 0
  7732.  
  7733.    OTHERWISE
  7734.       REPLACE vpos WITH vpos + c_adjbox - (getlinewidth(objcode, .T.)/2) + m.adjust
  7735.       REPLACE hpos WITH hpos + c_adjbox - (getlinewidth(objcode, .F.)/2) + m.adjust
  7736.       REPLACE height WITH height + getlinewidth(objcode, .T.) - 1
  7737.       REPLACE WIDTH WITH WIDTH + getlinewidth(objcode, .F.) - 1
  7738.  
  7739.       REPLACE penpat  WITH 8
  7740.       REPLACE fillpat WITH 0
  7741.       REPLACE objcode WITH 4
  7742.    ENDCASE
  7743.  
  7744.    IF m.g_filetype = c_screen
  7745.       IF BORDER > 4
  7746.          REPLACE BORDER WITH 1
  7747.       ELSE
  7748.          REPLACE BORDER WITH 0
  7749.       ENDIF
  7750.    ENDIF
  7751. CASE m.g_grph2char
  7752.    ******************* Start Graphic to Character Conversion ******************
  7753.    IF fillpat = 0
  7754.       REPLACE fillchar WITH CHR(0)
  7755.    ELSE
  7756.       REPLACE fillchar WITH " "
  7757.    ENDIF
  7758.  
  7759.    DO CASE
  7760.    CASE pensize = 4
  7761.       REPLACE objcode WITH c_sgboxd
  7762.    CASE pensize = 6
  7763.       REPLACE objcode WITH c_sgboxp
  7764.    OTHERWISE
  7765.       REPLACE objcode WITH c_sgbox
  7766.    ENDCASE
  7767.  
  7768.    DO CASE
  7769.    CASE (m.g_filetype = c_screen AND objtype = c_otline and style = c_lnhorizontal) ;
  7770.         OR (objtype = c_otbox and height <=1)
  7771.       REPLACE vpos WITH vpos - c_adjbox
  7772.       REPLACE height WITH 1
  7773.    CASE (m.g_filetype = c_screen AND objtype = c_otline and style = c_lnvertical) ;
  7774.         OR (objtype = c_otbox and width <=1)
  7775.       REPLACE hpos WITH hpos-c_adjbox
  7776.       REPLACE width WITH 1
  7777.    OTHERWISE
  7778.       REPLACE vpos WITH vpos-c_adjbox
  7779.       REPLACE hpos WITH hpos-c_adjbox
  7780.       REPLACE height WITH height+(c_adjbox*2)
  7781.       REPLACE WIDTH WITH WIDTH+(c_adjbox*2)
  7782.    ENDCASE
  7783. ENDCASE
  7784. RETURN
  7785.  
  7786. *
  7787. * GetLineWidth - Given an object code for a box or line and a flag indicating
  7788. *      if we want the thickness of a horizontal or vertical size, we return
  7789. *      the thickness of the side.
  7790. *
  7791. *!*****************************************************************************
  7792. *!
  7793. *!       Function: GETLINEWIDTH
  7794. *!
  7795. *!      Called by: JOINHORIZONTAL     (procedure in TRANSPRT.PRG)
  7796. *!               : JOINVERTICAL       (procedure in TRANSPRT.PRG)
  7797. *!               : REJOINBOXES        (procedure in TRANSPRT.PRG)
  7798. *!               : JOINLINEWIDTH()    (function  in TRANSPRT.PRG)
  7799. *!               : ADJBOX             (procedure in TRANSPRT.PRG)
  7800. *!
  7801. *!*****************************************************************************
  7802. FUNCTION getlinewidth
  7803. PARAMETERS m.objcode, m.horizontal
  7804.  
  7805. IF _WINDOWS OR _MAC
  7806.    DO CASE
  7807.    CASE m.objcode = c_sgboxd
  7808.       IF m.g_filetype = c_report
  7809.          RETURN 4 / FONTMETRIC(IIF(m.horizontal, 1, 6), m.g_rptfface, m.g_rptfsize, m.g_rpttxtfontstyle)
  7810.       ELSE
  7811.          RETURN 4 / FONTMETRIC(IIF(m.horizontal, 1, 6), m.g_dfltfface, m.g_dfltfsize, "B")
  7812.       ENDIF
  7813.  
  7814.    CASE m.objcode = c_sgboxp
  7815.       IF m.g_filetype = c_report
  7816.          RETURN 6 / FONTMETRIC(IIF(m.horizontal, 1, 6), m.g_rptfface, m.g_rptfsize, m.g_rpttxtfontstyle)
  7817.       ELSE
  7818.          RETURN 6 / FONTMETRIC(IIF(m.horizontal, 1, 6), m.g_dfltfface, m.g_dfltfsize, "B")
  7819.       ENDIF
  7820.  
  7821.    OTHERWISE
  7822.       IF m.g_filetype = c_report
  7823.          RETURN 1 / FONTMETRIC(IIF(m.horizontal, 1, 6), m.g_rptfface, m.g_rptfsize, m.g_rpttxtfontstyle)
  7824.       ELSE
  7825.          RETURN 1 / FONTMETRIC(IIF(m.horizontal, 1, 6), m.g_dfltfface, m.g_dfltfsize, "B")
  7826.       ENDIF
  7827.    ENDCASE
  7828. ELSE
  7829.    RETURN 1
  7830. ENDIF
  7831.  
  7832. *
  7833. * HorizButton - Will return a .T. if the ojbect passed in is a series of
  7834. *            horizontal buttons.  If they are vertical buttons, it
  7835. *            returns .F.
  7836. *
  7837. *!*****************************************************************************
  7838. *!
  7839. *!       Function: HORIZBUTTON
  7840. *!
  7841. *!      Called by: CALCWINDOWDIMENSION(procedure in TRANSPRT.PRG)
  7842. *!               : FINDWIDEROBJECTS   (procedure in TRANSPRT.PRG)
  7843. *!               : REPOOBJECTS        (procedure in TRANSPRT.PRG)
  7844. *!               : ITEMSINBOXES       (procedure in TRANSPRT.PRG)
  7845. *!               : ADJINVBTNS         (procedure in TRANSPRT.PRG)
  7846. *!               : GETLASTOBJECTLINE()(function  in TRANSPRT.PRG)
  7847. *!               : GETOBJWIDTH()      (function  in TRANSPRT.PRG)
  7848. *!               : GETOBJHEIGHT()     (function  in TRANSPRT.PRG)
  7849. *!
  7850. *!*****************************************************************************
  7851. FUNCTION horizbutton
  7852. PARAMETER m.pictclause
  7853.  
  7854. IF OCCURS(';', m.pictclause) = 0 OR ;
  7855.       AT("H", LEFT(m.pictclause, AT(" ", m.pictclause))) != 0
  7856.    RETURN .T.
  7857. ELSE
  7858.    RETURN .F.
  7859. ENDIF
  7860.  
  7861. *
  7862. * MaxBtnWidth - Given the Picture clause for a set of buttons (text or
  7863. *      radio) along with its font information and returns the Width in
  7864. *      foxels of the widest label.
  7865. *
  7866. *!*****************************************************************************
  7867. *!
  7868. *!       Function: MAXBTNWIDTH
  7869. *!
  7870. *!      Called by: ADJHEIGHTANDWIDTH  (procedure in TRANSPRT.PRG)
  7871. *!
  7872. *!*****************************************************************************
  7873. FUNCTION maxbtnwidth
  7874. PARAMETERS m.picture, m.face, m.size, m.style
  7875. PRIVATE m.max, m.label
  7876.  
  7877. m.max = 0
  7878. m.picture = SUBSTR(m.picture, AT(" ", m.picture))
  7879.  
  7880. m.picture = STRTRAN(m.picture, "\\", "")
  7881. m.picture = STRTRAN(m.picture, "\<", "")
  7882. m.picture = STRTRAN(m.picture, "\!", "")
  7883. m.picture = STRTRAN(m.picture, "\?", "")
  7884.  
  7885. DO WHILE LEN(m.picture) != 0
  7886.    IF AT(";", m.picture) != 0
  7887.       m.label = ALLTRIM(LEFT(m.picture, AT(";", m.picture)-1))
  7888.       m.picture = SUBSTR(m.picture, AT(";", m.picture)+1)
  7889.    ELSE
  7890.       m.label = ALLTRIM(LEFT(m.picture, LEN(m.picture)-1))
  7891.       m.picture = ""
  7892.    ENDIF
  7893.  
  7894.    DO CASE
  7895.    CASE m.g_char2grph OR m.g_grph2grph
  7896.       m.max = MAX(m.max, TXTWIDTH(m.label, m.face, m.size, m.style))
  7897.    CASE m.g_grph2char
  7898.       m.max = MAX(m.max, LEN(m.label))
  7899.    ENDCASE
  7900. ENDDO
  7901.  
  7902. RETURN m.max
  7903.  
  7904. *
  7905. * GetObjWidth - Given a screen object, this function returns its Width.
  7906. *
  7907. *!*****************************************************************************
  7908. *!
  7909. *!       Function: GETOBJWIDTH
  7910. *!
  7911. *!      Called by: ITEMSINBOXES       (procedure in TRANSPRT.PRG)
  7912. *!               : GETRIGHTMOST       (procedure in TRANSPRT.PRG)
  7913. *!
  7914. *!          Calls: HORIZBUTTON()      (function  in TRANSPRT.PRG)
  7915. *!
  7916. *!*****************************************************************************
  7917. FUNCTION getobjwidth
  7918. PARAMETERS m.objtype, m.picture, m.width, m.spacing, m.platform
  7919. PRIVATE m.numitems
  7920.  
  7921. DO CASE
  7922. CASE m.objtype = c_ottext OR m.objtype = c_otfield OR ;
  7923.       m.objtype = c_otline OR m.objtype = c_otbox OR ;
  7924.       m.objtype = c_otlist OR m.objtype = c_otchkbox OR ;
  7925.       m.objtype = c_otpopup OR m.objtype = c_otpicture OR ;
  7926.       m.objtype = c_otspinner OR m.objtype = c_otrepfld
  7927.    RETURN m.width
  7928.  
  7929. CASE m.objtype = c_ottxtbut OR m.objtype = c_otradbut OR m.objtype = c_otinvbut
  7930.    m.numitems = OCCURS(";", m.picture) + 1
  7931.    IF !horizbutton(m.picture) OR m.numitems = 1
  7932.       RETURN m.width
  7933.    ELSE
  7934.       RETURN (m.width * m.numitems) + (m.spacing * (m.numitems - 1))
  7935.    ENDIF
  7936.  
  7937. CASE (m.objtype = c_otbox OR m.objtype = c_otline) AND ;
  7938.       (m.platform = c_macname OR m.platform = c_winname)
  7939.    RETURN m.width
  7940.  
  7941. CASE (m.objtype = c_otbox OR m.objtype = c_otline) AND ;
  7942.       (m.platform = c_dosname OR m.platform = c_unixname)
  7943.    RETURN m.width-1
  7944.  
  7945. OTHERWISE
  7946.    RETURN m.width
  7947. ENDCASE
  7948.  
  7949. *
  7950. * GetObjHeight - Given a screen object, this function returns its Height.
  7951. *
  7952. *!*****************************************************************************
  7953. *!
  7954. *!       Function: GETOBJHEIGHT
  7955. *!
  7956. *!      Called by: GETLOWEST          (procedure in TRANSPRT.PRG)
  7957. *!
  7958. *!          Calls: HORIZBUTTON()      (function  in TRANSPRT.PRG)
  7959. *!
  7960. *!*****************************************************************************
  7961. FUNCTION getobjheight
  7962. PARAMETERS m.objtype, m.picture, m.height, m.spacing, m.platform
  7963. PRIVATE m.numitems
  7964.  
  7965. DO CASE
  7966. CASE m.objtype = c_ottext OR m.objtype = c_otfield OR ;
  7967.       m.objtype = c_otline OR m.objtype = c_otbox OR ;
  7968.       m.objtype = c_otlist OR m.objtype = c_otchkbox OR ;
  7969.       m.objtype = c_otpopup OR m.objtype = c_otpicture OR ;
  7970.       m.objtype = c_otspinner OR m.objtype = c_otrepfld
  7971.    RETURN m.height
  7972.  
  7973. CASE m.objtype = c_ottxtbut OR m.objtype = c_otradbut OR ;
  7974.       m.objtype = c_otinvbut
  7975.    m.numitems = OCCURS(";", m.picture) + 1
  7976.  
  7977.    IF horizbutton(m.picture) OR m.numitems = 1
  7978.       RETURN m.height
  7979.    ELSE
  7980.       RETURN (m.height * m.numitems) + (m.spacing * (m.numitems - 1))
  7981.    ENDIF
  7982.  
  7983. CASE (m.objtype = c_otbox OR m.objtype = c_otline) AND ;
  7984.       (m.platform = c_macname OR m.platform = c_winname)
  7985.    RETURN m.height
  7986.  
  7987. CASE (m.objtype = c_otbox OR m.objtype = c_otline) AND ;
  7988.       (m.platform = c_dosname OR m.platform = c_unixname)
  7989.    RETURN m.height-1
  7990.  
  7991. OTHERWISE
  7992.    RETURN m.height
  7993. ENDCASE
  7994.  
  7995. *
  7996. * GetRightmost - Takes a platform and returns the rightmost position occupied by an object
  7997. *      in that platform
  7998. *!*****************************************************************************
  7999. *!
  8000. *!      Procedure: GETRIGHTMOST
  8001. *!
  8002. *!      Called by: MAKECHARFIT        (procedure in TRANSPRT.PRG)
  8003. *!
  8004. *!          Calls: GETOBJWIDTH()      (function  in TRANSPRT.PRG)
  8005. *!
  8006. *!*****************************************************************************
  8007. PROCEDURE getrightmost
  8008. PARAMETER m.platform
  8009. PRIVATE m.right
  8010.  
  8011. m.right = 0
  8012.  
  8013. SCAN FOR platform = m.platform AND !DELETED() AND ;
  8014.       (objtype = c_ottext OR objtype = c_otline OR ;
  8015.       objtype = c_otbox OR objtype = c_otrepfld OR ;
  8016.       objtype = c_otlist OR objtype = c_ottxtbut OR ;
  8017.       objtype = c_otradbut OR objtype = c_otchkbox OR ;
  8018.       objtype = c_otfield OR objtype = c_otpopup OR ;
  8019.       objtype = c_otpicture OR objtype = c_otinvbut OR ;
  8020.       objtype = c_otspinner)
  8021.    m.right = MAX(m.right, hpos + getobjwidth(objtype, PICTURE, WIDTH, spacing, m.g_toplatform))
  8022. ENDSCAN
  8023.  
  8024. RETURN m.right
  8025.  
  8026. *
  8027. * GetLowest - Takes a platform and returns the lowest position occupied by an object
  8028. *      in that platform
  8029. *!*****************************************************************************
  8030. *!
  8031. *!      Procedure: GETLOWEST
  8032. *!
  8033. *!      Called by: MAKECHARFIT        (procedure in TRANSPRT.PRG)
  8034. *!
  8035. *!          Calls: GETOBJHEIGHT()     (function  in TRANSPRT.PRG)
  8036. *!
  8037. *!*****************************************************************************
  8038. PROCEDURE getlowest
  8039. PARAMETER m.platform
  8040. PRIVATE m.bottom
  8041.  
  8042. m.bottom = 0
  8043.  
  8044. SCAN FOR platform = m.platform AND !DELETED() AND ;
  8045.       (objtype = c_ottext OR objtype = c_otline OR ;
  8046.       objtype = c_otbox OR objtype = c_otrepfld OR ;
  8047.       objtype = c_otlist OR objtype = c_ottxtbut OR ;
  8048.       objtype = c_otradbut OR objtype = c_otchkbox OR ;
  8049.       objtype = c_otfield OR objtype = c_otpopup OR ;
  8050.       objtype = c_otpicture OR objtype = c_otinvbut OR ;
  8051.       objtype = c_otspinner)
  8052.    m.bottom = MAX(m.bottom, vpos + getobjheight(objtype, PICTURE, HEIGHT, spacing, m.g_toplatform))
  8053. ENDSCAN
  8054.  
  8055. RETURN m.bottom
  8056.  
  8057. *
  8058. * DoCreate - Creates an empty cursor with either a report or screen structure and a given name.
  8059. *
  8060. *!*****************************************************************************
  8061. *!
  8062. *!      Procedure: DOCREATE
  8063. *!
  8064. *!      Called by: cvrt102FRX()    (function  in TRANSPRT.PRG)
  8065. *!               : cvrtfbpRPT      (procedure in TRANSPRT.PRG)
  8066. *!               : MAKECURSOR         (procedure in TRANSPRT.PRG)
  8067. *!               : WRITERESULT        (procedure in TRANSPRT.PRG)
  8068. *!
  8069. *!*****************************************************************************
  8070. PROCEDURE docreate
  8071. PARAMETER m.name, m.type
  8072. DO CASE
  8073. CASE m.type = c_screen
  8074.    CREATE CURSOR (m.name) (platform C(8), uniqueid C(10), timestamp N(10), objtype N(2), objcode N(3), ;
  8075.       name m, expr m, vpos N(7,3), hpos N(7,3), HEIGHT N(7,3), WIDTH N(7,3), ;
  8076.       STYLE N(2), PICTURE m, ORDER m, UNIQUE l, comment m, ENVIRON l, ;
  8077.       boxchar C(1), fillchar C(1), TAG m, tag2 m, penred N(5), pengreen N(5), ;
  8078.       penblue N(5), fillred N(5), fillgreen N(5), fillblue N(5), pensize N(5), ;
  8079.       penpat N(5), fillpat N(5), fontface m, fontstyle N(3), fontsize N(3), ;
  8080.       mode N(3), ruler N(1), rulerlines N(1), grid l, gridv N(2), gridh N(2), ;
  8081.       SCHEME N(2), scheme2 N(2), colorpair C(8), lotype N(1), rangelo m, ;
  8082.       hitype N(1), rangehi m, whentype N(1), WHEN m, validtype N(1), VALID m, ;
  8083.       errortype N(1), ERROR m, messtype N(1), MESSAGE m, showtype N(1), SHOW m, ;
  8084.       activtype N(1), ACTIVATE m, deacttype N(1), DEACTIVATE m, proctype N(1), ;
  8085.       proccode m, setuptype N(1), setupcode m, FLOAT l, CLOSE l, MINIMIZE l, ;
  8086.       BORDER N(1), SHADOW l, CENTER l, REFRESH l, disabled l, scrollbar l, ;
  8087.       addalias l, TAB l, initialval m, initialnum N(3), spacing N(6,3), curpos l)
  8088.  
  8089. CASE m.type = c_report OR m.type = c_label
  8090.    CREATE CURSOR (m.name) (platform C(8), uniqueid C(10), timestamp N(10), objtype N(2), objcode N(3), ;
  8091.       name m, expr m, vpos N(9,3), hpos N(9,3), HEIGHT N(9,3), WIDTH N(9,3), ;
  8092.       STYLE m, PICTURE m, ORDER m, UNIQUE l, comment m, ENVIRON l, ;
  8093.       boxchar C(1), fillchar C(1), TAG m, tag2 m, penred N(5), pengreen N(5), ;
  8094.       penblue N(5), fillred N(5), fillgreen N(5), fillblue N(5), pensize N(5), ;
  8095.       penpat N(5), fillpat N(5), fontface m, fontstyle N(3), fontsize N(3), ;
  8096.       mode N(3), ruler N(1), rulerlines N(1), grid l, gridv N(2), gridh N(2), ;
  8097.       FLOAT l, STRETCH l, stretchtop l, TOP l, BOTTOM l, suptype N(1), suprest N(1), ;
  8098.       norepeat l, resetrpt N(2), pagebreak l, colbreak l, resetpage l, GENERAL N(3), ;
  8099.       spacing N(3), DOUBLE l, swapheader l, swapfooter l, ejectbefor l, ejectafter l, ;
  8100.       PLAIN l, SUMMARY l, addalias l, offset N(3), topmargin N(3), botmargin N(3), ;
  8101.       totaltype N(2), resettotal N(2), resoid N(3), curpos l, supalways l, supovflow l, ;
  8102.       suprpcol N(1), supgroup N(2), supvalchng l, supexpr m)
  8103. CASE m.type = c_project
  8104.    CREATE CURSOR (m.name) ;
  8105.       (name m, ;
  8106.       TYPE C(1), ;
  8107.       timestamp N(10), ;
  8108.       outfile m, ;
  8109.       homedir m, ;
  8110.       setid N(4), ;
  8111.       exclude l, ;
  8112.       mainprog l, ;
  8113.       arranged m, ;
  8114.       savecode l, ;
  8115.       defname l, ;
  8116.       openfiles l, ;
  8117.       closefiles l, ;
  8118.       defwinds l, ;
  8119.       relwinds l, ;
  8120.       readcycle l, ;
  8121.       multreads l, ;
  8122.       NOLOCK l, ;
  8123.       MODAL l, ;
  8124.       assocwinds m, ;
  8125.       DEBUG l, ;
  8126.       ENCRYPT l, ;
  8127.       nologo l, ;
  8128.       scrnorder N(3), ;
  8129.       cmntstyle N(1), ;
  8130.       objrev N(5), ;
  8131.       commands m, ;
  8132.       devinfo m, ;
  8133.       symbols m, ;
  8134.       OBJECT m, ;
  8135.       ckval N(6) ;
  8136.       )
  8137. ENDCASE
  8138. RETURN
  8139.  
  8140. *
  8141. * makecursor - Create a cursor with the structure we need for this file on the 2.5 platform.
  8142. *
  8143. *!*****************************************************************************
  8144. *!
  8145. *!      Procedure: MAKECURSOR
  8146. *!
  8147. *!      Called by: TRANSPRT.PRG
  8148. *!               : CONVERTER          (procedure in TRANSPRT.PRG)
  8149. *!
  8150. *!          Calls: DOCREATE           (procedure in TRANSPRT.PRG)
  8151. *!
  8152. *!*****************************************************************************
  8153. PROCEDURE makecursor
  8154. PRIVATE m.temp20alias, m.in_del
  8155.  
  8156. m.temp20alias = "S"+SUBSTR(LOWER(SYS(3)),2,8)
  8157. DO docreate WITH m.temp20alias, m.g_filetype
  8158. m.in_del = SET("DELETED")
  8159. SET DELETED ON
  8160. APPEND FROM (m.g_scrndbf)
  8161. SET DELETED &in_del
  8162.  
  8163. m.g_20alias = m.g_scrnalias
  8164. m.g_scrnalias = m.temp20alias
  8165.  
  8166.  
  8167. *
  8168. * AddGraphicalLabelGroups - Add page and column header records for a label.
  8169. *
  8170. *!*****************************************************************************
  8171. *!
  8172. *!      Procedure: ADDGRAPHICALLABELGROUPS
  8173. *!
  8174. *!      Called by: ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  8175. *!               : UPDATELABELDATA    (procedure in TRANSPRT.PRG)
  8176. *!
  8177. *!*****************************************************************************
  8178. PROCEDURE addgraphicallabelgroups
  8179.  
  8180. IF m.g_char2grph
  8181.    * First make sure that we don't already have these headers.  Check for a page header.
  8182.    LOCATE FOR objtype = c_otband AND objcode = 1
  8183.    IF FOUND()
  8184.       * We already have a page header.  We don't want two.  Reports, like people, function
  8185.       * best with only a single head.
  8186.       RETURN
  8187.    ENDIF
  8188.  
  8189.    APPEND BLANK
  8190.    REPLACE objtype WITH c_otband
  8191.    REPLACE objcode WITH 1
  8192.    REPLACE height WITH 0
  8193.    REPLACE pagebreak WITH .F.
  8194.    REPLACE colbreak WITH .F.
  8195.    REPLACE resetpage WITH .F.
  8196.    REPLACE platform WITH m.g_toplatform
  8197.    REPLACE uniqueid WITH SYS(2015)
  8198.  
  8199.    APPEND BLANK
  8200.    REPLACE objtype WITH c_otband
  8201.    REPLACE objcode WITH 2
  8202.    REPLACE height WITH 0
  8203.    REPLACE pagebreak WITH .F.
  8204.    REPLACE colbreak WITH .F.
  8205.    REPLACE resetpage WITH .F.
  8206.    REPLACE platform WITH m.g_toplatform
  8207.    REPLACE uniqueid WITH SYS(2015)
  8208.  
  8209.    APPEND BLANK
  8210.    REPLACE objtype WITH c_otband
  8211.    REPLACE objcode WITH 6
  8212.    REPLACE height WITH 0
  8213.    REPLACE pagebreak WITH .F.
  8214.    REPLACE colbreak WITH .F.
  8215.    REPLACE resetpage WITH .F.
  8216.    REPLACE platform WITH m.g_toplatform
  8217.    REPLACE uniqueid WITH SYS(2015)
  8218.  
  8219.    APPEND BLANK
  8220.    REPLACE objtype WITH c_otband
  8221.    REPLACE objcode WITH 7
  8222.    REPLACE height WITH 0
  8223.    REPLACE pagebreak WITH .F.
  8224.    REPLACE colbreak WITH .F.
  8225.    REPLACE resetpage WITH .F.
  8226.    REPLACE platform WITH m.g_toplatform
  8227.    REPLACE uniqueid WITH SYS(2015)
  8228. ENDIF
  8229.  
  8230. *
  8231. * UpdateLabelData - Labels live in report dataases now and we need to add at least one band
  8232. *            record if we are coming from a 2.0 label.
  8233. *
  8234. *!*****************************************************************************
  8235. *!
  8236. *!      Procedure: UPDATELABELDATA
  8237. *!
  8238. *!      Called by: CONVERTER          (procedure in TRANSPRT.PRG)
  8239. *!
  8240. *!          Calls: ADDGRAPHICALLABELGR(procedure in TRANSPRT.PRG)
  8241. *!
  8242. *!*****************************************************************************
  8243. PROCEDURE updatelabeldata
  8244. PARAMETER m.lbxnumacross, m.lbxlmargin, m.lbxspacesbet, m.lbxlinesbet, m.lbxheight
  8245.  
  8246. DO addgraphicallabelgroups
  8247.  
  8248. * We need a detail band for any platform.
  8249. APPEND BLANK
  8250. REPLACE objtype WITH c_otband
  8251. REPLACE objcode WITH 4
  8252. REPLACE height WITH m.lbxheight
  8253. REPLACE pagebreak WITH .F.
  8254. REPLACE colbreak WITH .F.
  8255. REPLACE resetpage WITH .F.
  8256.  
  8257. LOCATE FOR objtype = c_ot20label
  8258. IF FOUND()
  8259.    REPLACE vpos WITH m.lbxnumacross
  8260.    REPLACE hpos WITH m.lbxlmargin
  8261.    REPLACE height WITH m.lbxspacesbet
  8262.    REPLACE penblue WITH m.lbxlinesbet
  8263. ENDIF
  8264.  
  8265. *
  8266. * PlatformDefaults - Writes information to a record that would not exist on the source platform and
  8267. *         we don't add elsewhere.
  8268. *
  8269. *!*****************************************************************************
  8270. *!
  8271. *!      Procedure: PLATFORMDEFAULTS
  8272. *!
  8273. *!      Called by: CONVERTER          (procedure in TRANSPRT.PRG)
  8274. *!               : NEWCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  8275. *!               : NEWGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  8276. *!
  8277. *!*****************************************************************************
  8278. PROCEDURE platformdefaults
  8279. PARAMETER m.timestamp
  8280.  
  8281. IF m.timestamp > 0
  8282.    REPLACE uniqueid WITH SYS(2015)
  8283.    REPLACE timestamp WITH m.timestamp
  8284.    REPLACE platform WITH m.g_fromplatform
  8285. ENDIF
  8286.  
  8287. IF m.g_char2grph
  8288.    REPLACE ruler WITH 1             && inches
  8289.    REPLACE rulerlines WITH 1
  8290.    REPLACE grid WITH .T.
  8291.    REPLACE gridv WITH 9
  8292.    REPLACE gridh WITH 9
  8293. ENDIF
  8294.  
  8295. *
  8296. * converter - Convert a 2.0 screen or report to 2.5 format and fill in the
  8297. *            appropriate fields.
  8298. *
  8299. *!*****************************************************************************
  8300. *!
  8301. *!      Procedure: CONVERTER
  8302. *!
  8303. *!      Called by: TRANSPRT.PRG
  8304. *!
  8305. *!          Calls: MAKECURSOR         (procedure in TRANSPRT.PRG)
  8306. *!               : UPDATELABELDATA    (procedure in TRANSPRT.PRG)
  8307. *!               : CONVERTPROJECT     (procedure in TRANSPRT.PRG)
  8308. *!               : STAMPVAL()         (function  in TRANSPRT.PRG)
  8309. *!               : PLATFORMDEFAULTS   (procedure in TRANSPRT.PRG)
  8310. *!               : UPDATEVERSION      (procedure in TRANSPRT.PRG)
  8311. *!
  8312. *!*****************************************************************************
  8313. PROCEDURE converter
  8314. PRIVATE m.lbxnumacross, m.lbxlmargin, m.lbxspacesbet, m.lbxlinesbet, m.lbxheight, m.timestamp
  8315.  
  8316. DO CASE
  8317. CASE m.g_filetype = c_label
  8318.    LOCATE FOR objtype = c_ot20label
  8319.    IF FOUND()
  8320.       m.lbxnumacross   = numacross
  8321.       m.lbxlmargin     = lmargin
  8322.       m.lbxspacesbet   = spacesbet
  8323.       m.lbxlinesbet    = linesbet
  8324.       m.lbxheight      = HEIGHT
  8325.    ENDIF
  8326. ENDCASE
  8327.  
  8328. DO makecursor
  8329.  
  8330. DO CASE
  8331. CASE m.g_filetype = c_label
  8332.    DO updatelabeldata WITH m.lbxnumacross, m.lbxlmargin, m.lbxspacesbet, m.lbxlinesbet, m.lbxheight
  8333. CASE m.g_filetype = c_project
  8334.    DO convertproject
  8335.    RETURN
  8336. ENDCASE
  8337.  
  8338. m.timestamp = stampval()
  8339. SCAN
  8340.    DO platformdefaults WITH m.timestamp
  8341. ENDSCAN
  8342.  
  8343. DO updateversion
  8344.  
  8345. *
  8346. * UpdateVersion - Places the correct version number in the m.g_fromPlatfrom
  8347. *      records.
  8348. *!*****************************************************************************
  8349. *!
  8350. *!      Procedure: UPDATEVERSION
  8351. *!
  8352. *!      Called by: CONVERTER          (procedure in TRANSPRT.PRG)
  8353. *!
  8354. *!*****************************************************************************
  8355. PROCEDURE updateversion
  8356. LOCATE FOR platform = c_dosname AND objtype = c_otheader
  8357. IF FOUND()
  8358.    DO CASE
  8359.    CASE m.g_filetype = c_screen
  8360.       REPLACE objcode WITH c_25scx
  8361.    OTHERWISE
  8362.       REPLACE objcode WITH c_25frx
  8363.    ENDCASE
  8364. ENDIF
  8365.  
  8366. *
  8367. * SynchTime - Takes the names of two platforms and makes the timestamp of the header (objectype = 1)
  8368. *      record for the first platfrom match the timestamp of the header record of the second.
  8369. *
  8370. *!*****************************************************************************
  8371. *!
  8372. *!      Procedure: SYNCHTIME
  8373. *!
  8374. *!      Called by: TRANSPRT.PRG
  8375. *!
  8376. *!*****************************************************************************
  8377. PROCEDURE synchtime
  8378. PARAMETER m.convertedplatform, m.matchplatform
  8379. PRIVATE m.timestamp
  8380. LOCATE FOR platform = m.matchplatform AND objtype = c_otheader
  8381. IF FOUND()
  8382.    m.timestamp = timestamp
  8383.    LOCATE FOR platform = m.convertedplatform AND objtype = c_otheader
  8384.    IF FOUND()
  8385.       REPLACE timestamp WITH m.timestamp
  8386.    ENDIF
  8387. ENDIF
  8388.  
  8389. *
  8390. * Get a timestamp value based on the current date and time.
  8391. *
  8392. *!*****************************************************************************
  8393. *!
  8394. *!       Function: STAMPVAL
  8395. *!
  8396. *!      Called by: CONVERTER          (procedure in TRANSPRT.PRG)
  8397. *!
  8398. *!          Calls: SHIFTL()           (function  in TRANSPRT.PRG)
  8399. *!               : SHIFTR()           (function  in TRANSPRT.PRG)
  8400. *!
  8401. *!*****************************************************************************
  8402. FUNCTION stampval
  8403. PRIVATE m.dateval, m.timeval
  8404.  
  8405. m.dateval = DAY(DATE()) + ;
  8406.    shiftl(MONTH(DATE()), 5) + ;
  8407.    shiftl(YEAR(DATE())-1980, 9)
  8408.  
  8409. m.timeval = shiftr(VAL(RIGHT(TIME(),2)),1) + ;
  8410.    shiftl(VAL(SUBSTR(TIME(),4,2)),5) + ;
  8411.    shiftl(VAL(LEFT(TIME(),2)),11)
  8412.  
  8413. RETURN shiftl(m.dateval,16)+m.timeval
  8414.  
  8415. *
  8416. * Shift a value x times to the left.  (This isn't a true match for
  8417. * a shift since we keep extending the value without truncating it,
  8418. * but it works for us.)
  8419. *
  8420. *!*****************************************************************************
  8421. *!
  8422. *!       Function: SHIFTL
  8423. *!
  8424. *!      Called by: STAMPVAL()         (function  in TRANSPRT.PRG)
  8425. *!
  8426. *!*****************************************************************************
  8427. FUNCTION shiftl
  8428. PARAMETER m.value, m.times
  8429. PRIVATE m.loop
  8430.  
  8431. FOR m.loop = 1 TO m.times
  8432.    m.value = m.value * 2
  8433. ENDFOR
  8434. RETURN m.value
  8435.  
  8436. *
  8437. * Shift a value x times to the right.  (This isn't a true match for
  8438. * a shift since we keep extending the value without truncating it,
  8439. * but it works for us.)
  8440. *
  8441. *!*****************************************************************************
  8442. *!
  8443. *!       Function: SHIFTR
  8444. *!
  8445. *!      Called by: STAMPVAL()         (function  in TRANSPRT.PRG)
  8446. *!
  8447. *!*****************************************************************************
  8448. FUNCTION shiftr
  8449. PARAMETER m.value, m.times
  8450. PRIVATE m.loop
  8451.  
  8452. FOR m.loop = 1 TO m.times
  8453.    m.value = INT(m.value / 2)
  8454. ENDFOR
  8455. RETURN m.value
  8456.  
  8457. *
  8458. * EmptyPlatform - Takes a platform ID and returns .T. if no records for that platform
  8459. *       are in the file or .F. if some are present.
  8460. *
  8461. *!*****************************************************************************
  8462. *!
  8463. *!       Function: EMPTYPLATFORM
  8464. *!
  8465. *!      Called by: IMPORT             (procedure in TRANSPRT.PRG)
  8466. *!
  8467. *!*****************************************************************************
  8468. FUNCTION emptyplatform
  8469. PARAMETER m.platform
  8470. PRIVATE m.count
  8471. SELECT (m.g_scrnalias)
  8472.  
  8473. IF (FCOUNT() = c_20scxfld OR FCOUNT() = c_20frxfld OR FCOUNT() = c_20lbxfld)
  8474.    RETURN .T.
  8475. ENDIF
  8476.  
  8477. COUNT TO m.count FOR platform = m.platform
  8478. IF m.count > 0
  8479.    RETURN .F.
  8480. ELSE
  8481.    RETURN .T.
  8482. ENDIF
  8483.  
  8484. **
  8485. ** Code Associated With Displaying the 2.0 to 2.5 conversion dialog.
  8486. **
  8487. *!*****************************************************************************
  8488. *!
  8489. *!       Function: STRUCTDIALOG
  8490. *!
  8491. *!      Called by: DOUPDATE()         (function  in TRANSPRT.PRG)
  8492. *!
  8493. *!          Calls: ERRORHANDLER       (procedure in TRANSPRT.PRG)
  8494. *!               : CURPOS()           (function  in TRANSPRT.PRG)
  8495. *!
  8496. *!*****************************************************************************
  8497. FUNCTION structdialog
  8498. PARAMETER m.textline
  8499. PRIVATE m.choice, m.ftype, m.dlgwidth, m.fnt_ratio
  8500.  
  8501. DO CASE
  8502. CASE m.g_filetype = c_screen
  8503.    m.ftype = "screen "
  8504. CASE m.g_filetype = c_report
  8505.    m.ftype = "report "
  8506. CASE m.g_filetype = c_label
  8507.    m.ftype = "label "
  8508. CASE m.g_filetype = c_project
  8509.    m.ftype = "project "
  8510. OTHERWISE
  8511.    m.ftype = ""
  8512. ENDCASE
  8513.  
  8514. m.dlgwidth = 60    && default
  8515. DO CASE
  8516. CASE _WINDOWS OR _MAC
  8517.    IF NOT WEXIST("tstructd")
  8518.         IF _MAC
  8519.             m.dlgwidth = 40
  8520.           DEFINE WINDOW tstructd ;
  8521.              AT 0,0 ;
  8522.              SIZE 5.076,m.dlgwidth ;
  8523.              TITLE "Converter" ;
  8524.              FONT m.g_tdlgface, m.g_tdlgsize ;
  8525.              STYLE m.g_tdlgstyle ;
  8526.              FLOAT ;
  8527.              NOCLOSE ;
  8528.              MINIMIZE ;
  8529.              SYSTEM  ;
  8530.              COLOR RGB(0, 0, 0, 221, 221, 221)
  8531.         ELSE
  8532.             m.dlgwidth = 58.333
  8533.           DEFINE WINDOW tstructd ;
  8534.              AT 0,0 ;
  8535.              SIZE 5.076,m.dlgwidth ;
  8536.              TITLE "Converter" ;
  8537.              FONT m.g_tdlgface, m.g_tdlgsize ;
  8538.              STYLE m.g_tdlgstyle ;
  8539.              FLOAT ;
  8540.              CLOSE ;
  8541.              MINIMIZE ;
  8542.              SYSTEM
  8543.         ENDIF
  8544.       MOVE WINDOW tstructd CENTER
  8545.    ENDIF
  8546.  
  8547.    IF WVISIBLE("tstructd")
  8548.       ACTIVATE WINDOW tstructd SAME
  8549.    ELSE
  8550.       ACTIVATE WINDOW tstructd NOSHOW
  8551.    ENDIF
  8552.  
  8553.     * Adjust for differences between dialog window font and text font
  8554.     m.fnt_ratio =     FONTMETRIC(6,m.g_tdlgface, m.g_tdlgsize, m.g_tdlgsty2) ;
  8555.                   / FONTMETRIC(6,m.g_tdlgface, m.g_tdlgsize, m.g_tdlgstyle)
  8556.  
  8557.    @ 1.000, (m.dlgwidth - TXTWIDTH(m.textline, m.g_tdlgface, m.g_tdlgsize, m.g_tdlgstyle) * m.fnt_ratio) / 2 ;
  8558.       SAY m.textline ;
  8559.       SIZE 1.154,TXTWIDTH(m.textline, m.g_tdlgface, m.g_tdlgsize, m.g_tdlgstyle) ;
  8560.       FONT m.g_tdlgface, m.g_tdlgsize ;
  8561.       STYLE m.g_tdlgsty2
  8562.  
  8563.    @ 2.750, m.dlgwidth/2 - (13.5*2+4.308)/2 GET m.choice ;
  8564.       PICTURE "@*HT3 \!\<Yes;\?\<Cancel" ;
  8565.       SIZE m.g_tdlgbtn,13.500,4.308 ;
  8566.       DEFAULT 1 ;
  8567.       FONT m.g_tdlgface, m.g_tdlgsize ;
  8568.       STYLE m.g_tdlgstyle
  8569.  
  8570. CASE _DOS OR _UNIX
  8571.    IF NOT WEXIST("tstructd")
  8572.       DEFINE WINDOW tstructd ;
  8573.          FROM INT((SROW()-7)/2),INT((SCOL()-47)/2) ;
  8574.          TO INT((SROW()-7)/2)+7,INT((SCOL()-47)/2)+46 ;
  8575.          FLOAT ;
  8576.          NOCLOSE ;
  8577.          SHADOW ;
  8578.          DOUBLE ;
  8579.          COLOR SCHEME 7
  8580.    ENDIF
  8581.  
  8582.    IF WVISIBLE("tstructd")
  8583.       ACTIVATE WINDOW tstructd SAME
  8584.    ELSE
  8585.       ACTIVATE WINDOW tstructd NOSHOW
  8586.    ENDIF
  8587.  
  8588.    * Format the file name for display
  8589.    m.msg = "File: "+m.g_scrndbf
  8590.    IF LEN(m.msg) > 44
  8591.       m.msg = m.g_scrndbf
  8592.       IF LEN(m.msg) > 44
  8593.          m.msg = justfname(m.g_scrndbf)
  8594.       ENDIF
  8595.    ENDIF
  8596.  
  8597.    @ 1,(WCOLS()-LEN(m.msg))/2 SAY m.msg
  8598.    @ 2,(WCOLS()-LEN(m.textline))/2 SAY m.textline
  8599.    @ 4,2 GET m.choice ;
  8600.       PICTURE "@*HT \<Yes;\!\?\<No" ;
  8601.       SIZE 1,12,18 ;
  8602.       DEFAULT 1
  8603.  
  8604. OTHERWISE
  8605.    DO errorhandler WITH "Unknown Version.", LINENO(), c_error3
  8606.    RETURN .F.
  8607. ENDCASE
  8608.  
  8609. IF NOT WVISIBLE("tstructd")
  8610.    ACTIVATE WINDOW tstructd
  8611. ENDIF
  8612.  
  8613. READ CYCLE MODAL WHEN curpos()
  8614.  
  8615. RELEASE WINDOW tstructd
  8616.  
  8617. IF m.choice = 1
  8618.    RETURN .T.
  8619. ELSE
  8620.    RETURN .F.
  8621. ENDIF
  8622. RETURN
  8623.  
  8624. *!*****************************************************************************
  8625. *!
  8626. *!       Function: CURPOS
  8627. *!
  8628. *!      Called by: STRUCTDIALOG()     (function  in TRANSPRT.PRG)
  8629. *!
  8630. *!*****************************************************************************
  8631. FUNCTION curpos
  8632. IF _DOS OR _UNIX
  8633.    _CUROBJ = 2
  8634. ENDIF
  8635. RETURN .T.
  8636.  
  8637. **
  8638. ** Code Associated With Displaying the Screen Convert Dialog Box
  8639. **
  8640. *!*****************************************************************************
  8641. *!
  8642. *!       Function: SCXFRXDIALOG
  8643. *!
  8644. *!      Called by: CONVERTTYPE()      (function  in TRANSPRT.PRG)
  8645. *!
  8646. *!          Calls: HASRECORDS()       (function  in TRANSPRT.PRG)
  8647. *!               : STRIPPATH()        (function  in TRANSPRT.PRG)
  8648. *!               : SCRNCTRL()         (function  in TRANSPRT.PRG)
  8649. *!               : TRANSPRMPT()       (function  in TRANSPRT.PRG)
  8650. *!               : PVALID()           (function  in TRANSPRT.PRG)
  8651. *!               : ASKFONT()          (function  in TRANSPRT.PRG)
  8652. *!               : ERRORHANDLER       (procedure in TRANSPRT.PRG)
  8653. *!               : RDVALID()          (function  in TRANSPRT.PRG)
  8654. *!               : DEACCLAU()         (function  in TRANSPRT.PRG)
  8655. *!               : SHOWCLAU()         (function  in TRANSPRT.PRG)
  8656. *!
  8657. *!*****************************************************************************
  8658. FUNCTION scxfrxdialog
  8659. PARAMETER ftype
  8660. PRIVATE m.choice, m.fromplatform, m.dlgnum
  8661. m.choice = 0
  8662. DO CASE
  8663. CASE _WINDOWS
  8664.    IF m.ftype <> "LBX" AND hasrecords(c_winname)
  8665.       * No partial transport of labels
  8666.  
  8667.       m.fromplatform = dfltplat()
  8668.       m.dlgnum = 1
  8669.       m.g_allobjects = .F.
  8670.  
  8671.       * already contains some records for Windows
  8672.       DEFINE WINDOW transdlg ;
  8673.          AT  0.000, 0.000  ;
  8674.          SIZE 22.385,76.167 ;
  8675.          TITLE " FoxPro Transporter" ;
  8676.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8677.          STYLE m.g_tdlgsty1;
  8678.          FLOAT ;
  8679.          CLOSE ;
  8680.          NOMINIMIZE ;
  8681.          DOUBLE
  8682.       MOVE WINDOW transdlg CENTER
  8683.  
  8684.       IF WVISIBLE("transdlg")
  8685.          ACTIVATE WINDOW transdlg SAME
  8686.       ELSE
  8687.          ACTIVATE WINDOW transdlg NOSHOW
  8688.       ENDIF
  8689.  
  8690.       @ 14.077,1.667 TO 21.385,50.167 ;
  8691.          PEN 1, 8 ;
  8692.          STYLE "T"
  8693.       @ 13.615,2.667 SAY "Transport" ;
  8694.          SIZE 1.000, 9.167, 0.000 ;
  8695.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8696.          STYLE m.g_tdlgsty1
  8697.       @ 1.000,2.667 SAY IIF(m.ftype = "SCX","Screen File:","Report File:") ;
  8698.          SIZE 1.000,13.500, 0.000 ;
  8699.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8700.          STYLE m.g_tdlgstyle
  8701.       @ 1.000,16.667 SAY LOWER(strippath(m.g_scrndbf)) ;
  8702.          SIZE 1.000,21.833 ;
  8703.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8704.          STYLE m.g_tdlgsty1
  8705.       @ 3.077,2.667 SAY "There are objects in this file defined " + CHR(13) + ;
  8706.          "for a platform other than "+versioncap(m.g_toplatform)+"." ;
  8707.          SIZE 2.000,35.000, 0.000 ;
  8708.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8709.          STYLE m.g_tdlgsty1
  8710.       @ 8.077,2.667 SAY "By transporting this file, you add, update, or " + CHR(13) + ;
  8711.          "replace "+versioncap(m.g_toplatform)+" definitions for objects in the file." ;
  8712.          SIZE 2.000,48.167, 0.000 ;
  8713.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8714.          STYLE m.g_tdlgsty1
  8715.       @ 11.385,2.667 SAY "Transport Objects From: " ;
  8716.          SIZE 1.000,23.500 ;
  8717.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8718.          STYLE m.g_tdlgsty1
  8719.       @ 5.615,2.667 SAY "The objects are new to "+versioncap(m.g_toplatform)+", or more " + CHR(13) + ;
  8720.          "recently modified than their "+versioncap(m.g_toplatform)+" equivalents." ;
  8721.          SIZE 2.000,47.833 ;
  8722.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8723.          STYLE m.g_tdlgsty1
  8724.       @ 17.846,7.500 SAY "Than "+versioncap(m.g_toplatform)+"Equivalent Objects" ;
  8725.          SIZE 1.000,32.667 ;
  8726.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8727.          STYLE m.g_tdlgsty1
  8728.       m.thepict = "@^ "+makepict(c_dosnum,c_macnum,c_unixnum, @m.fromplatform)
  8729.       @ 11.231,25.833 GET m.fromplatform ;
  8730.          PICTURE m.thepict ;
  8731.          SIZE 1.538,24.333 ;
  8732.          DEFAULT 1 ;
  8733.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8734.          STYLE m.g_tdlgsty1
  8735.       @ 14.923,4.500 GET m.g_newobjects ;
  8736.          PICTURE "@*C Objects New to "+versioncap(m.g_toplatform) ;
  8737.          SIZE 1.308,28.167 ;
  8738.          DEFAULT .T. ;
  8739.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8740.          STYLE m.g_tdlgsty1 ;
  8741.          VALID scrnctrl()
  8742.       @ 16.538,4.500 GET m.g_snippets ;
  8743.          PICTURE "@*C Objects More Recently Modified" ;
  8744.          SIZE 1.308,34.667 ;
  8745.          DEFAULT .T. ;
  8746.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8747.          STYLE m.g_tdlgsty1 ;
  8748.          VALID scrnctrl()
  8749.       @ 19.385,4.500 GET m.g_allobjects ;
  8750.          PICTURE "@*C All Objects -- Replace Existing Definitions" ;
  8751.          SIZE 1.308,43.833 ;
  8752.          DEFAULT .F. ;
  8753.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8754.          STYLE m.g_tdlgsty1 ;
  8755.          VALID scrnctrl()
  8756.       @ 0.615,51.667 GET m.choice ;
  8757.          PICTURE "@*VNT "+transprmpt()+";Open As Is;\?Cancel" ;
  8758.          SIZE 1.769,23.000,0.308 ;
  8759.          DEFAULT 1 ;
  8760.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8761.          STYLE m.g_tdlgsty1 ;
  8762.          VALID pvalid()
  8763.       @ 14.077,51.667 GET m.g_askfont ;
  8764.          PICTURE "@*VN Font..." ;
  8765.          SIZE 1.769,23.000,0.308 ;
  8766.          DEFAULT 1 ;
  8767.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8768.          STYLE m.g_tdlgsty1 ;
  8769.          VALID askfont()
  8770.    ELSE    && no existing WINDOWS records
  8771.       m.fromplatform = dfltplat()
  8772.       m.dlgnum = 2
  8773.       DEFINE WINDOW transdlg ;
  8774.          AT 0.000, 0.000 ;
  8775.          SIZE 13.077,65.167 ;
  8776.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8777.          STYLE m.g_tdlgsty1 ;
  8778.          TITLE " FoxPro Transporter" ;
  8779.          FLOAT ;
  8780.          CLOSE ;
  8781.          NOMINIMIZE ;
  8782.          DOUBLE
  8783.       MOVE WINDOW transdlg CENTER
  8784.  
  8785.       IF WVISIBLE("transdlg")
  8786.          ACTIVATE WINDOW transdlg SAME
  8787.       ELSE
  8788.          ACTIVATE WINDOW transdlg NOSHOW
  8789.       ENDIF
  8790.  
  8791.       @ 1.000,2.667 SAY IIF(m.ftype = "SCX","Screen File:",;
  8792.          IIF(m.ftype = "FRX","Report File:","Label File:")) ;
  8793.          SIZE 1.000,11.500, 0.000 ;
  8794.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8795.          STYLE m.g_tdlgstyle
  8796.       @ 1.000,14.667 SAY LOWER(strippath(m.g_scrndbf)) ;
  8797.          SIZE 1.000,21.833 ;
  8798.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8799.          STYLE m.g_tdlgsty1
  8800.       @ 3.077,2.667 SAY "There are objects in this file defined " + CHR(13) + ;
  8801.          "for a platform other than "+versioncap(m.g_toplatform)+"." ;
  8802.          SIZE 2.000,35.000, 0.000 ;
  8803.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8804.          STYLE m.g_tdlgstyle
  8805.       @ 5.923,2.667 SAY "By transporting this file, you create" + CHR(13) + ;
  8806.          versioncap(m.g_toplatform)+" definitions for these objects." ;
  8807.          SIZE 2.000,36.833, 0.000 ;
  8808.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8809.          STYLE m.g_tdlgstyle
  8810.       @ 8.923,2.667 SAY "Transport Objects From: " ;
  8811.          SIZE 1.000,23.500, 0.000 ;
  8812.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8813.          STYLE m.g_tdlgsty1
  8814.       m.thepict = "@^ "+makepict(c_dosnum,c_macnum,c_unixnum, @m.fromplatform)
  8815.       @ 10.154,2.667 GET m.fromplatform ;
  8816.          PICTURE m.thepict ;
  8817.          SIZE 1.538,24.333 ;
  8818.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8819.          STYLE m.g_tdlgsty1
  8820.       @ 7.846,40.833 GET m.g_askfont ;
  8821.          PICTURE "@*VN Font..." ;
  8822.          SIZE 1.769,23.000,0.308 ;
  8823.          DEFAULT 1 ;
  8824.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8825.          STYLE m.g_tdlgsty1 ;
  8826.          VALID askfont()
  8827.       @ 0.615,40.833 GET m.choice ;
  8828.          PICTURE "@*VNT "+transprmpt()+";\?Cancel" ;
  8829.          SIZE 1.769,23.000,0.308 ;
  8830.          DEFAULT 1 ;
  8831.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8832.          STYLE m.g_tdlgsty1 ;
  8833.          VALID pvalid()
  8834.    ENDIF
  8835. CASE  _MAC
  8836.    IF m.ftype <> "LBX" AND hasrecords(c_macname)
  8837.       * No partial transport of labels
  8838.  
  8839.       m.fromplatform = dfltplat()
  8840.  
  8841.       m.dlgnum = 1
  8842.       m.g_allobjects = .F.
  8843.  
  8844.       * already contains some Mac records
  8845.       DEFINE WINDOW transdlg ;
  8846.          AT  0.000, 0.000  ;
  8847.          SIZE 21.600,68.500 ;
  8848.          TITLE " FoxPro Transporter" ;
  8849.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8850.          STYLE m.g_tdlgsty1;
  8851.          FLOAT ;
  8852.          CLOSE ;
  8853.          NOMINIMIZE ;
  8854.          DOUBLE ;
  8855.          COLOR RGB(0, 0, 0, 221, 221, 221)
  8856.       MOVE WINDOW transdlg CENTER
  8857.  
  8858.       IF WVISIBLE("transdlg")
  8859.          ACTIVATE WINDOW transdlg SAME
  8860.       ELSE
  8861.          ACTIVATE WINDOW transdlg NOSHOW
  8862.       ENDIF
  8863.  
  8864.       @ 12.077,1.667 TO 19.385,50.167 ;
  8865.          PEN 1, 8 ;
  8866.          STYLE "T"
  8867.       @ 1.000,2.667 SAY IIF(m.ftype = "SCX","Screen File:","Report File:") ;
  8868.          SIZE 1.000,13.500, 0.000 ;
  8869.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8870.          STYLE m.g_tdlgstyle
  8871.       @ 1.000,16.667 SAY LOWER(strippath(m.g_scrndbf)) ;
  8872.          SIZE 1.000,21.833 ;
  8873.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8874.          STYLE m.g_tdlgsty1
  8875.       @ 0.615,52.667 GET m.choice ;
  8876.          PICTURE "@*VNTM "+transprmpt()+";Open As Is;\?Cancel" ;
  8877.          SIZE m.g_tdlgbtn,12.000,0.500 ;
  8878.          DEFAULT 1 ;
  8879.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8880.          STYLE m.g_tdlgsty1 ;
  8881.          VALID pvalid()
  8882.       @ 14.077,52.667 GET m.g_askfont ;
  8883.          PICTURE "@*VNM Font..." ;
  8884.          SIZE m.g_tdlgbtn,12.000,0.308 ;
  8885.          DEFAULT 1 ;
  8886.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8887.          STYLE m.g_tdlgsty1 ;
  8888.          VALID askfont()
  8889.         IF m.ftype = "SCX"
  8890.             @ 18.000, 52.667 GET m.g_look2d ;
  8891.                PICTURE "@*C3 2D Controls" ;
  8892.                 DEFAULT 0 ;
  8893.              FONT m.g_tdlgface, m.g_tdlgsize ;
  8894.              STYLE m.g_tdlgstyle ;
  8895.                 VALID setctrl()
  8896.        ENDIF
  8897.       @ 3.077,2.667 SAY "There are objects in this file defined " + CHR(13) + ;
  8898.          "for a platform other than "+versioncap(m.g_toplatform)+"." ;
  8899.          SIZE 2.000,50.000, 0.000 ;
  8900.          FONT m.g_smface, m.g_smsize ;
  8901.          STYLE m.g_smsty1
  8902.       @ 5.615,2.667 SAY "The objects are new to "+versioncap(m.g_toplatform)+", or more " + CHR(13) + ;
  8903.          "recently modified than their "+versioncap(m.g_toplatform)+" equivalents." ;
  8904.          SIZE 2.000,60.000 ;
  8905.          FONT m.g_smface, m.g_smsize ;
  8906.          STYLE m.g_smsty1
  8907.       @ 8.077,2.667 SAY "By transporting this file, you add, update, or " + CHR(13) + ;
  8908.          "replace "+versioncap(m.g_toplatform)+" definitions for objects in the file." ;
  8909.          SIZE 2.000,60.000, 0.000 ;
  8910.          FONT m.g_smface, m.g_smsize ;
  8911.          STYLE m.g_smsty1
  8912.       @ 10.385,2.667 SAY "Transport Objects From: " ;
  8913.          SIZE 1.000,28.000 ;
  8914.          FONT m.g_smface, m.g_smsize ;
  8915.          STYLE m.g_smsty1
  8916.       m.thepict = "@^3 "+makepict(c_winnum, c_dosnum, c_unixnum, @m.fromplatform)
  8917.       @ 10.231,22.833 GET m.fromplatform ;
  8918.          PICTURE m.thepict ;
  8919.          SIZE 1.538,24.333 ;
  8920.          DEFAULT 1 ;
  8921.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8922.          STYLE m.g_tdlgsty1
  8923.       @ 11.615,2.667 SAY "Transport" ;
  8924.          SIZE 1.000, 9.167, 0.000 ;
  8925.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8926.          STYLE m.g_tdlgsty1
  8927.       @ 12.923,4.500 GET m.g_newobjects ;
  8928.          PICTURE "@*C3 Objects New to "+versioncap(m.g_toplatform) ;
  8929.          SIZE 1.308,28.167 ;
  8930.          DEFAULT .T. ;
  8931.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8932.          STYLE m.g_tdlgstyle ;
  8933.          VALID scrnctrl()
  8934.       @ 14.538,4.500 GET m.g_snippets ;
  8935.          PICTURE "@*C3 Objects More Recently Modified" ;
  8936.          SIZE 1.308,34.667 ;
  8937.          DEFAULT .T. ;
  8938.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8939.          STYLE m.g_tdlgstyle ;
  8940.          VALID scrnctrl()
  8941.       @ 15.846,7.500 SAY "Than "+versioncap(m.g_toplatform)+" Equivalent Objects" ;
  8942.          SIZE 1.000,42.000 ;
  8943.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8944.          STYLE m.g_tdlgstyle
  8945.       @ 17.385,4.500 GET m.g_allobjects ;
  8946.          PICTURE "@*C3 All Objects -- Replace Existing Definitions" ;
  8947.          SIZE 1.308,43.833 ;
  8948.          DEFAULT .F. ;
  8949.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8950.          STYLE m.g_tdlgstyle ;
  8951.          VALID scrnctrl()
  8952.    ELSE    && no existing MAC records
  8953.  
  8954.       m.fromplatform = dfltplat()
  8955.       m.dlgnum = 2
  8956.       DEFINE WINDOW transdlg ;
  8957.          AT 0.000, 0.000 ;
  8958.          SIZE 13.077,58.000 ;
  8959.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8960.          STYLE m.g_tdlgsty1 ;
  8961.          TITLE " FoxPro Transporter" ;
  8962.          FLOAT ;
  8963.          CLOSE ;
  8964.          NOMINIMIZE ;
  8965.          DOUBLE ;
  8966.          COLOR RGB(0, 0, 0, 221, 221, 221)
  8967.       MOVE WINDOW transdlg CENTER
  8968.  
  8969.       IF WVISIBLE("transdlg")
  8970.          ACTIVATE WINDOW transdlg SAME
  8971.       ELSE
  8972.          ACTIVATE WINDOW transdlg NOSHOW
  8973.       ENDIF
  8974.  
  8975.       @ 1.000,2.667 SAY IIF(m.ftype = "SCX","Screen File:",;
  8976.          IIF(m.ftype = "FRX","Report File:","Label File:")) ;
  8977.          SIZE 1.000,11.500, 0.000 ;
  8978.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8979.          STYLE m.g_tdlgstyle
  8980.       @ 1.000,14.667 SAY LOWER(strippath(m.g_scrndbf)) ;
  8981.          SIZE 1.000,22.000 ;
  8982.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8983.          STYLE m.g_tdlgsty1
  8984.       @ 3.077,2.667 SAY "There are objects in this file defined " +CHR(13) ;
  8985.          + "for a platform other than "+versioncap(m.g_toplatform)+"." ;
  8986.          SIZE 2,45,0 ;
  8987.          FONT m.g_smface, m.g_smsize ;
  8988.          STYLE m.g_smstyle
  8989.       @ 5.923,2.667 SAY "By transporting this file, you create" +CHR(13)  ;
  8990.          + versioncap(m.g_toplatform)+" definitions for these objects." ;
  8991.          SIZE 2,45,0 ;
  8992.          FONT m.g_smface, m.g_smsize ;
  8993.          STYLE m.g_smstyle
  8994.       @ 8.923,2.667 SAY "Transport Objects From:" ;
  8995.          SIZE 1.000, 28.000, 0.000 ;
  8996.          FONT m.g_tdlgface, m.g_tdlgsize ;
  8997.          STYLE m.g_tdlgsty2
  8998.       @ 0.615,42.833 GET m.choice ;
  8999.          PICTURE "@*VNTM "+transprmpt()+";\?Cancel" ;
  9000.          SIZE m.g_tdlgbtn,12.000,1.000 ;
  9001.          DEFAULT 1 ;
  9002.          FONT m.g_tdlgface, m.g_tdlgsize ;
  9003.          STYLE m.g_tdlgsty1 ;
  9004.          VALID pvalid()
  9005.       @ 7.846,42.833 GET m.g_askfont ;
  9006.          PICTURE "@*VNM Font..." ;
  9007.          SIZE m.g_tdlgbtn,12.000,0.308 ;
  9008.          DEFAULT 1 ;
  9009.          FONT m.g_tdlgface, m.g_tdlgsize ;
  9010.          STYLE m.g_tdlgsty1 ;
  9011.          VALID askfont()
  9012.         IF m.ftype = "SCX"
  9013.             @ 11.000, 42.833 GET m.g_look2d ;
  9014.                PICTURE "@*C3 2D Controls" ;
  9015.                 DEFAULT 0 ;
  9016.              FONT m.g_tdlgface, m.g_tdlgsize ;
  9017.              STYLE m.g_tdlgstyle ;
  9018.                 VALID setctrl()
  9019.         ENDIF
  9020.       m.thepict = "@^3 "+makepict(c_winnum, c_dosnum, c_unixnum, @m.fromplatform)
  9021.       @ 10.154,2.667 GET m.fromplatform ;
  9022.          PICTURE m.thepict ;
  9023.          SIZE 1.538,24.333 ;
  9024.          FONT m.g_tdlgface, m.g_tdlgsize ;
  9025.          STYLE m.g_tdlgsty1
  9026.    ENDIF
  9027. CASE _DOS OR _UNIX
  9028.    m.fromplatform = c_foxwin
  9029.    IF m.ftype <> "LBX" AND (hasrecords(c_dosname) OR hasrecords(c_unixname))
  9030.       m.dlgnum = 1
  9031.       m.g_allobjects = .F.
  9032.  
  9033.       DEFINE WINDOW transdlg ;
  9034.          FROM INT((SROW()-21)/2),INT((SCOL()-67)/2) ;
  9035.          TO INT((SROW()-21)/2)+20,INT((SCOL()-67)/2)+66 ;
  9036.          FLOAT ;
  9037.          CLOSE ;
  9038.          SHADOW ;
  9039.          NOMINIMIZE ;
  9040.          DOUBLE ;
  9041.          COLOR SCHEME 5
  9042.  
  9043.       IF WVISIBLE("transdlg")
  9044.          ACTIVATE WINDOW transdlg SAME
  9045.       ELSE
  9046.          ACTIVATE WINDOW transdlg NOSHOW
  9047.       ENDIF
  9048.  
  9049.       @ 11,2 TO 16,52
  9050.       @ 1,2 SAY IIF(m.g_filetype = c_screen,"Screen File:","Report File:") ;
  9051.          SIZE 1,12, 0
  9052.       @ 1,15 SAY UPPER(strippath(m.g_scrndbf)) ;
  9053.          SIZE 1,19
  9054.       @ 3,2 SAY "There are objects in this file defined" ;
  9055.          SIZE 1,38, 0
  9056.       @ 4,2 SAY "for a platform other than MS-DOS." ;
  9057.          SIZE 1,33, 0
  9058.       @ 9,4 SAY "Transport Objects From:" ;
  9059.          SIZE 1,23, 0
  9060.       m.thepict = "@^ "+makepict(c_winnum, c_macnum, c_unixnum, @m.fromplatform)
  9061.       @ 8,29 GET m.fromplatform ;
  9062.          PICTURE m.thepict ;
  9063.          SIZE 3,24 ;
  9064.          COLOR SCHEME 5, 6
  9065.       @ 1,45 GET m.choice ;
  9066.          PICTURE "@*VNT \!Transport & Open;Open As Is;\?Cancel" ;
  9067.          SIZE 1,20,1 ;
  9068.          DEFAULT 1 ;
  9069.          VALID pvalid()
  9070.       @ 11,4 SAY "Transport" ;
  9071.          SIZE 1,9, 0
  9072.       @ 12,4 GET m.g_newobjects ;
  9073.          PICTURE "@*C Objects New to MS-DOS" ;
  9074.          SIZE 1,25 ;
  9075.          DEFAULT .T. ;
  9076.          VALID scrnctrl()
  9077.       @ 13,4 GET m.g_snippets ;
  9078.          PICTURE "@*C Objects More Recently Modified" ;
  9079.          SIZE 1,34 ;
  9080.          DEFAULT .T. ;
  9081.          VALID scrnctrl()
  9082.       @ 14,8 SAY "Than MS-DOS Equivalent Objects" ;
  9083.          SIZE 1,30, 0
  9084.       @ 15,4 GET m.g_allobjects ;
  9085.          PICTURE "@*C All Objects -- Replace Existing Definitions" ;
  9086.          SIZE 1,47 ;
  9087.          DEFAULT .F. ;
  9088.          VALID scrnctrl()
  9089.       @ 7,2 SAY "for objects in the file." ;
  9090.          SIZE 1,24, 0
  9091.       @ 5,2 SAY "By transporting this file, you add," ;
  9092.          SIZE 1,35, 0
  9093.       @ 6,2 SAY "update, or replace MS-DOS definitions" ;
  9094.          SIZE 1,37, 0
  9095.  
  9096.       IF NOT WVISIBLE("transdlg")
  9097.          ACTIVATE WINDOW transdlg
  9098.       ENDIF
  9099.    ELSE
  9100.       m.dlgnum = 2
  9101.  
  9102.       DEFINE WINDOW transdlg ;
  9103.          FROM INT((SROW()-15)/2),INT((SCOL()-68)/2) ;
  9104.          TO INT((SROW()-15)/2)+14,INT((SCOL()-68)/2)+67 ;
  9105.          FLOAT ;
  9106.          NOCLOSE ;
  9107.          SHADOW ;
  9108.          NOMINIMIZE ;
  9109.          DOUBLE ;
  9110.          COLOR SCHEME 5
  9111.  
  9112.       IF WVISIBLE("transdlg")
  9113.          ACTIVATE WINDOW transdlg SAME
  9114.       ELSE
  9115.          ACTIVATE WINDOW transdlg NOSHOW
  9116.       ENDIF
  9117.  
  9118.       @ 1,2 SAY IIF(m.g_filetype = c_screen,"Screen File:","Report File:") ;
  9119.          SIZE 1,12, 0
  9120.       @ 1,15 SAY UPPER(strippath(m.g_scrndbf)) ;
  9121.          SIZE 1,19
  9122.       @ 3,2 SAY "There are objects in this file defined" ;
  9123.          SIZE 1,38, 0
  9124.       @ 4,2 SAY "for a platform other than MS-DOS." ;
  9125.          SIZE 1,33, 0
  9126.       @ 8,4 SAY "Transport Objects From:" ;
  9127.          SIZE 1,23, 0
  9128.       m.thepict = "@^ "+makepict(c_winnum, c_macnum, c_unixnum, @m.fromplatform)
  9129.       @ 9,4 GET m.fromplatform ;
  9130.          PICTURE m.thepict ;
  9131.          SIZE 3,24 ;
  9132.          COLOR SCHEME 5, 6
  9133.       @ 1,45 GET m.choice ;
  9134.          PICTURE "@*VNT \!Transport & Open;\?Cancel" ;
  9135.          SIZE 1,20,1 ;
  9136.          DEFAULT 1 ;
  9137.          VALID pvalid()
  9138.       @ 5,2 SAY "By transporting this file, you create" ;
  9139.          SIZE 1,37, 0
  9140.       @ 6,2 SAY "MS-DOS definitions for these objects." ;
  9141.          SIZE 1,37, 0
  9142.  
  9143.       IF NOT WVISIBLE("transdlg")
  9144.          ACTIVATE WINDOW transdlg
  9145.       ENDIF
  9146.    ENDIF
  9147. OTHERWISE
  9148.    DO errorhandler WITH "Unknown FoxPro version.", LINENO(), c_error3
  9149.    RETURN .F.
  9150. ENDCASE
  9151.  
  9152. * The effect of this code is to skip the read entirely if g_skipdlg is
  9153. * TRUE. All of the variables in this dialog are set to their default
  9154. * values, the dialog isn't displayed, the warning about overwriting
  9155. * existing records isn't displayed, and processing continues.
  9156. IF !m.g_skipdlg
  9157.    IF NOT WVISIBLE("transdlg")
  9158.       ACTIVATE WINDOW transdlg
  9159.    ENDIF
  9160.    READ CYCLE MODAL ;
  9161.       VALID rdvalid(m.dlgnum) ;
  9162.       DEACTIVATE deacclau() ;
  9163.       SHOW showclau()
  9164. ELSE
  9165.    CLEAR GETS
  9166.    m.choice = 1    && pretend user said "Transport"
  9167. ENDIF
  9168.  
  9169.  
  9170. RELEASE WINDOW transdlg
  9171.  
  9172. *
  9173. * We could simply return m.choice, but this way we can mess with the dialog without changing
  9174. * the defines.
  9175. *
  9176. DO CASE
  9177. CASE m.choice = 1
  9178.    RETURN c_yes
  9179. CASE m.choice = 2 AND m.dlgnum = 1
  9180.    RETURN c_no
  9181. OTHERWISE
  9182.    RETURN c_cancel
  9183. ENDCASE
  9184. RETURN
  9185.  
  9186. *!*****************************************************************************
  9187. *!
  9188. *!       Function: dfltplat
  9189. *!
  9190. *!*****************************************************************************
  9191. FUNCTION dfltplat
  9192. * Return the default platform to transport from
  9193. PRIVATE m.plat
  9194. DO CASE
  9195. CASE hasrecords(c_winname) AND !_WINDOWS
  9196.    m.plat =   c_foxwin
  9197. CASE hasrecords(c_macname) AND !_MAC
  9198.    m.plat =   c_foxmac
  9199. CASE hasrecords(c_dosname) AND !_DOS
  9200.    m.plat =   c_foxdos
  9201. CASE hasrecords(c_unixname) AND !_UNIX
  9202.    m.plat =   c_foxunix
  9203. OTHERWISE
  9204.    m.plat =   c_foxwin
  9205. ENDCASE
  9206. RETURN m.plat
  9207.  
  9208. *!*****************************************************************************
  9209. *!
  9210. *!       Function: MAKEPICT
  9211. *!
  9212. *!*****************************************************************************
  9213. FUNCTION makepict
  9214. * Assemble picture clause for "from" platform popup.  This routine creates
  9215. * the popup entries and enables or disables them based on whether the
  9216. * candidate platform has any records in the screen/report file.
  9217. PARAMETER a,b,c, dfltitem
  9218. PRIVATE m.i, m.pictstrg
  9219. DECLARE a_plats[3]
  9220. a_plats[1] = m.a
  9221. a_plats[2] = m.b
  9222. a_plats[3] = m.c
  9223. m.pictstrg = ""
  9224.  
  9225. m.looptop = 3
  9226. m.found_dflt = .F.
  9227.  
  9228. FOR m.i = 1 TO m.looptop
  9229.    DO CASE
  9230.    CASE a_plats[m.i] = c_dosnum
  9231.         DO CASE
  9232.         CASE !hasrecords(c_dosname)
  9233.           m.pictstrg = m.pictstrg + "\"
  9234.         CASE !m.found_dflt
  9235.             m.dfltitem = c_foxdos
  9236.             m.found_dflt = .T.
  9237.         ENDCASE
  9238.          m.pictstrg = m.pictstrg + c_foxdos
  9239.    CASE a_plats[m.i] = c_winnum
  9240.         DO CASE
  9241.         CASE !hasrecords(c_winname)
  9242.           m.pictstrg = m.pictstrg + "\"
  9243.         CASE !m.found_dflt
  9244.             m.dfltitem = c_foxwin
  9245.             m.found_dflt = .T.
  9246.         ENDCASE
  9247.          m.pictstrg = m.pictstrg + c_foxwin
  9248.  
  9249.    CASE a_plats[m.i] = c_macnum
  9250.         DO CASE
  9251.         CASE !hasrecords(c_macname)
  9252.           m.pictstrg = m.pictstrg + "\"
  9253.         CASE !m.found_dflt
  9254.             m.dfltitem = c_foxmac
  9255.             m.found_dflt = .T.
  9256.         ENDCASE
  9257.          m.pictstrg = m.pictstrg + c_foxmac
  9258.    CASE a_plats[m.i] = c_unixnum
  9259.         DO CASE
  9260.         CASE !hasrecords(c_unixname)
  9261.           m.pictstrg = m.pictstrg + "\"
  9262.         CASE !m.found_dflt
  9263.             m.dfltitem = c_foxunix
  9264.             m.found_dflt = .T.
  9265.         ENDCASE
  9266.          m.pictstrg = m.pictstrg + c_foxunix
  9267.    ENDCASE
  9268.    m.pictstrg = m.pictstrg + iif(m.i < m.looptop,";","")
  9269. ENDFOR
  9270. RETURN m.pictstrg
  9271.  
  9272. *
  9273. * TRANSPRMPT - Determine the prompt for the transport button
  9274. *
  9275. *!*****************************************************************************
  9276. *!
  9277. *!       Function: TRANSPRMPT
  9278. *!
  9279. *!      Called by: SCXFRXDIALOG()     (function  in TRANSPRT.PRG)
  9280. *!
  9281. *!*****************************************************************************
  9282. FUNCTION transprmpt
  9283. HOUR = LEFT(TIME(),2)
  9284. DO CASE
  9285. CASE _MAC
  9286.    RETURN "\!Transport"
  9287. CASE (DOW(DATE()) = 7 AND HOUR >= "23" AND HOUR < "24") OR ATC("ENERGIZE",GETENV("TRANSPRT")) > 0
  9288.    * Debts must be paid
  9289.    g_energize = .T.
  9290.    RETURN "\!Energize"       && Beam me up
  9291. OTHERWISE
  9292.    RETURN "\!Transport and Open"
  9293. ENDCASE
  9294.  
  9295. *
  9296. * RDVALID() - Prompts for overwriting all objects if g_allobjects is true
  9297. *
  9298. *!*****************************************************************************
  9299. *!
  9300. *!       Function: RDVALID
  9301. *!
  9302. *!      Called by: SCXFRXDIALOG()     (function  in TRANSPRT.PRG)
  9303. *!
  9304. *!          Calls: VERSIONCAP()       (function  in TRANSPRT.PRG)
  9305. *!
  9306. *!*****************************************************************************
  9307. FUNCTION rdvalid
  9308. PARAMETER dlgnum
  9309. IF !m.g_skipdlg AND m.g_allobjects AND m.dlgnum = 1 AND m.choice = 1
  9310.    IF _WINDOWS OR _MAC
  9311.         IF _WINDOWS
  9312.           DEFINE WINDOW msgscrn ;
  9313.              AT 0.000, 0.000 ;
  9314.              SIZE 7.308,42.667 ;
  9315.              FONT m.g_tdlgface, m.g_tdlgsize ;
  9316.              STYLE m.g_tdlgsty1 ;
  9317.              NOFLOAT ;
  9318.              NOCLOSE ;
  9319.              NOMINIMIZE ;
  9320.              DOUBLE
  9321.         ELSE
  9322.           DEFINE WINDOW msgscrn ;
  9323.              AT 0.000, 0.000 ;
  9324.              SIZE 7.308,42.667 ;
  9325.              FONT m.g_tdlgface, m.g_tdlgsize ;
  9326.              STYLE m.g_tdlgsty1 ;
  9327.              NOFLOAT ;
  9328.              NOCLOSE ;
  9329.              NOMINIMIZE ;
  9330.              DOUBLE
  9331.         ENDIF
  9332.       MOVE WINDOW msgscrn CENTER
  9333.  
  9334.       IF WVISIBLE("msgscrn")
  9335.          ACTIVATE WINDOW msgscrn SAME
  9336.       ELSE
  9337.          ACTIVATE WINDOW msgscrn NOSHOW
  9338.       ENDIF
  9339.  
  9340.       @ 0.923,2.833 SAY "Transporting All Objects will overwrite " + CHR(13) + ;
  9341.          "all existing "+versioncap(m.g_toplatform)+" object definitions" + CHR(13) + ;
  9342.          "in the file." ;
  9343.          SIZE 3.000,36.833, 0.000 ;
  9344.          PICTURE "@I" ;
  9345.          FONT m.g_tdlgface, m.g_tdlgsize ;
  9346.          STYLE m.g_tdlgstyle
  9347.       @ 4.769,11.833 GET m.okcancl ;
  9348.          PICTURE "@*HNT OK;Cancel" ;
  9349.          SIZE m.g_tdlgbtn,8.667,0.667 ;
  9350.          DEFAULT 1 ;
  9351.          FONT m.g_tdlgface,m.g_tdlgsize ;
  9352.          STYLE m.g_tdlgstyle
  9353.    ELSE
  9354.       DEFINE WINDOW msgscrn ;
  9355.          FROM INT((SROWS()-8)/2),19 ;
  9356.          TO INT((SROWS()+8)/2),62 ;
  9357.          NOFLOAT ;
  9358.          NOCLOSE ;
  9359.          NOMINIMIZE ;
  9360.          DOUBLE ;
  9361.          COLOR SCHEME 7
  9362.       MOVE WINDOW msgscrn CENTER
  9363.  
  9364.       IF WVISIBLE("msgscrn")
  9365.          ACTIVATE WINDOW msgscrn SAME
  9366.       ELSE
  9367.          ACTIVATE WINDOW msgscrn NOSHOW
  9368.       ENDIF
  9369.  
  9370.       @ 1,0 SAY PADC("Transporting All Objects will overwrite",WCOLS())
  9371.       @ 2,0 SAY PADC("all existing "+versioncap(m.g_toplatform)+" object definitions",WCOLS())
  9372.       @ 3,0 SAY PADC("in the file.",WCOLS())
  9373.  
  9374.  
  9375.       @ 5,12 GET m.okcancl ;
  9376.          PICTURE "@*HNT OK;Cancel" ;
  9377.          SIZE 1,9 ;
  9378.          DEFAULT 1
  9379.    ENDIF
  9380.  
  9381.    IF NOT WVISIBLE("msgscrn")
  9382.       ACTIVATE WINDOW msgscrn
  9383.    ENDIF
  9384.  
  9385.    READ CYCLE
  9386.  
  9387.    RELEASE WINDOW msgscrn
  9388.  
  9389.    IF okcancl = 2
  9390.       RETURN .F.
  9391.    ELSE
  9392.       RETURN .T.
  9393.    ENDIF
  9394. ENDIF
  9395.  
  9396. *
  9397. * DEACCLAU - Deactivate clause code.  Clear current read if window closes.
  9398. *
  9399. *!*****************************************************************************
  9400. *!
  9401. *!       Function: DEACCLAU
  9402. *!
  9403. *!      Called by: SCXFRXDIALOG()     (function  in TRANSPRT.PRG)
  9404. *!
  9405. *!*****************************************************************************
  9406. FUNCTION deacclau
  9407. CLEAR READ
  9408. RETURN .T.
  9409.  
  9410. *
  9411. * SHOWCLAU - Refresh GETS
  9412. *
  9413. *!*****************************************************************************
  9414. *!
  9415. *!       Function: SHOWCLAU
  9416. *!
  9417. *!      Called by: SCXFRXDIALOG()     (function  in TRANSPRT.PRG)
  9418. *!
  9419. *!*****************************************************************************
  9420. FUNCTION showclau
  9421. IF m.dlgnum = 2
  9422.    RETURN
  9423. ENDIF
  9424.  
  9425. IF g_snippets=.T. OR g_newobjects = .T.
  9426.    SHOW GET g_allobjects DISABLE
  9427. ELSE
  9428.    SHOW GET g_allobjects ENABLE
  9429. ENDIF
  9430.  
  9431. m.thestring = "Than "+versioncap(m.g_toplatform)+" Equivalent Objects"
  9432. IF g_allobjects
  9433.    SHOW GET g_snippets   DISABLE
  9434.    SHOW GET g_newobjects DISABLE
  9435.    DO CASE
  9436.    CASE _WINDOWS AND RGBSCHEME(1,10) <> "RGB(0,0,0,255,255,255)"
  9437.       @ 17.846,7.500 SAY m.thestring ;
  9438.          COLOR (RGBSCHEME(1,10))
  9439.    CASE _WINDOWS AND RGBSCHEME(1,10) == "RGB(0,0,0,255,255,255)"
  9440.       @ 17.846,7.500 SAY m.thestring ;
  9441.          COLOR RGB(192,192,192,255,255,255)
  9442.    CASE  _MAC AND RGBSCHEME(1,10) <> "RGB(0,0,0,255,255,255)"
  9443.       @ 15.846,7.500 SAY m.thestring ;
  9444.          SIZE 1.000,42.000 ;
  9445.          FONT m.g_tdlgface, m.g_tdlgsize ;
  9446.          STYLE m.g_tdlgstyle ;
  9447.            COLOR (RGBSCHEME(1,10))
  9448.    CASE  _MAC AND RGBSCHEME(1,10) == "RGB(0,0,0,255,255,255)"
  9449.       @ 15.846,7.500 SAY m.thestring ;
  9450.          SIZE 1.000,42.000 ;
  9451.          FONT m.g_tdlgface, m.g_tdlgsize ;
  9452.          STYLE m.g_tdlgstyle    ;
  9453.          COLOR RGB(192,192,192,255,255,255)
  9454.    OTHERWISE
  9455.       @ 14,8 SAY m.thestring ;
  9456.          COLOR (SCHEME(5,10))
  9457.    ENDCASE
  9458. ELSE
  9459.    SHOW GET g_snippets   ENABLE
  9460.    SHOW GET g_newobjects ENABLE
  9461.    DO CASE
  9462.    CASE _WINDOWS
  9463.       @ 17.846,7.500 SAY m.thestring
  9464.    CASE _MAC
  9465.       @ 15.846,7.500 SAY m.thestring ;
  9466.          SIZE 1.000,42.000 ;
  9467.          FONT m.g_tdlgface, m.g_tdlgsize ;
  9468.          STYLE m.g_tdlgsty1
  9469.    OTHERWISE
  9470.       @ 14,8 SAY m.thestring
  9471.    ENDCASE
  9472. ENDIF
  9473.  
  9474. IF !g_allobjects AND g_snippets = .F. AND g_newobjects = .F.
  9475.    SHOW GET m.choice,1 DISABLE
  9476. ELSE
  9477.    SHOW GET m.choice,1 ENABLE
  9478. ENDIF
  9479.  
  9480. *
  9481. * SCRNCTRL - Called for check box validation from the first dialog
  9482. *
  9483. *!*****************************************************************************
  9484. *!
  9485. *!       Function: SCRNCTRL
  9486. *!
  9487. *!      Called by: SCXFRXDIALOG()     (function  in TRANSPRT.PRG)
  9488. *!
  9489. *!*****************************************************************************
  9490. FUNCTION scrnctrl
  9491. SHOW GETS OFF
  9492. RETURN .T.
  9493.  
  9494. *
  9495. * Makes sure the proper options are enabled based on the setting of m.g_allobjects
  9496. *
  9497. *!*****************************************************************************
  9498. *!
  9499. *!       Function: ENABLEPROC
  9500. *!
  9501. *!*****************************************************************************
  9502. FUNCTION enableproc
  9503. IF m.g_allobjects
  9504.    SHOW GET m.g_newobjects DISABLE
  9505.    SHOW GET m.g_snippets DISABLE
  9506. ELSE
  9507.    SHOW GET m.g_newobjects ENABLE
  9508.    SHOW GET m.g_snippets ENABLE
  9509. ENDIF
  9510.  
  9511. *
  9512. * Fills the m.g_fromplatform global variable when the user leaves the dialog.
  9513. *
  9514. *!*****************************************************************************
  9515. *!
  9516. *!       Function: PVALID
  9517. *!
  9518. *!      Called by: SCXFRXDIALOG()     (function  in TRANSPRT.PRG)
  9519. *!
  9520. *!*****************************************************************************
  9521. FUNCTION pvalid
  9522. DO CASE
  9523. CASE ATC('DOS',m.fromplatform) > 0
  9524.    m.g_fromplatform = 'DOS'
  9525. CASE ATC('WINDOWS',m.fromplatform) > 0
  9526.    m.g_fromplatform = 'WINDOWS'
  9527. CASE ATC('MAC',m.fromplatform) > 0
  9528.    m.g_fromplatform = 'MAC'
  9529. CASE ATC('UNIX',m.fromplatform) > 0
  9530.    m.g_fromplatform = 'UNIX'
  9531. ENDCASE
  9532.  
  9533. **
  9534. ** Code Associated With Displaying of the Thermometer
  9535. **
  9536.  
  9537. *!*****************************************************************************
  9538. *!
  9539. *!      Procedure: STARTTHERM
  9540. *!
  9541. *!      Called by: TRANSPRT.PRG
  9542. *!               : GRAPHICTOCHAR      (procedure in TRANSPRT.PRG)
  9543. *!               : CHARTOGRAPHIC      (procedure in TRANSPRT.PRG)
  9544. *!
  9545. *!          Calls: ACTTHERM           (procedure in TRANSPRT.PRG)
  9546. *!
  9547. *!*****************************************************************************
  9548. PROCEDURE starttherm
  9549. PARAMETER VERB,filetype
  9550. *  Start the thermometer with the appropriate message.
  9551. DO CASE
  9552. CASE m.filetype = c_screen
  9553.    DO acttherm WITH VERB+' screen: '
  9554. CASE m.filetype = c_report
  9555.    DO acttherm WITH VERB+' report: '
  9556. CASE m.filetype  = c_label
  9557.    DO acttherm WITH VERB+' label: '
  9558. ENDCASE
  9559.  
  9560.  
  9561. *!*****************************************************************************
  9562. *!
  9563. *!      Procedure: THERMFNAME
  9564. *!
  9565. *!*****************************************************************************
  9566. FUNCTION thermfname
  9567. PARAMETER m.fname
  9568. PRIVATE m.addelipse, m.g_pathsep, m.g_thermfface, m.g_thermfsize, m.g_thermfstyle
  9569.  
  9570. #define c_space 40
  9571. IF _MAC
  9572.     m.g_thermfface = "Geneva"
  9573.     m.g_thermfsize = 10
  9574.     m.g_thermfstyle = ""
  9575. ELSE
  9576.     m.g_thermfface = "MS Sans Serif"
  9577.     m.g_thermfsize = 8
  9578.     m.g_thermfstyle = "B"
  9579. ENDIF
  9580.  
  9581. * Translate the filename into Mac native format
  9582. IF _MAC
  9583.     m.g_pathsep = ":"
  9584.     m.fname = SYS(2027, m.fname)
  9585. ELSE
  9586.     m.g_pathsep = "\"
  9587. ENDIF
  9588.  
  9589. IF TXTWIDTH(m.fname,m.g_thermfface,m.g_thermfsize,m.g_thermfstyle) > c_space
  9590.     * Make it fit in c_space
  9591.     m.fname = partialfname(m.fname, c_space - 1)
  9592.  
  9593.     m.addelipse = .F.
  9594.     DO WHILE TXTWIDTH(m.fname+'...',m.g_thermfface,m.g_thermfsize,m.g_thermfstyle) > c_space
  9595.         m.fname = LEFT(m.fname, LEN(m.fname) - 1)
  9596.         m.addelipse = .T.
  9597.     ENDDO
  9598.     IF m.addelipse
  9599.         m.fname = m.fname + "..."
  9600.    ENDIF
  9601. ENDIF
  9602. RETURN m.fname
  9603.  
  9604.  
  9605.  
  9606. *!*****************************************************************************
  9607. *!
  9608. *!      Procedure: PARTIALFNAME
  9609. *!
  9610. *!*****************************************************************************
  9611. FUNCTION partialfname
  9612. PARAMETER m.filname, m.fillen
  9613. * Return a filname no longer than m.fillen characters.  Take some chars
  9614. * out of the middle if necessary.  No matter what m.fillen is, this function
  9615. * always returns at least the file stem and extension.
  9616. PRIVATE m.bname, m.elipse, m.remain
  9617. m.elipse = "..." + m.g_pathsep
  9618. IF _MAC
  9619.     m.bname = SUBSTR(m.filname, RAT(":",m.filname)+1)
  9620. ELSE
  9621.     m.bname = justfname(m.filname)
  9622. ENDIF
  9623. DO CASE
  9624. CASE LEN(m.filname) <= m.fillen
  9625.    m.retstr = m.filname
  9626. CASE LEN(m.bname) + LEN(m.elipse) >= m.fillen
  9627.    m.retstr = m.bname
  9628. OTHERWISE
  9629.    m.remain = MAX(m.fillen - LEN(m.bname) - LEN(m.elipse), 0)
  9630.    IF _MAC
  9631.        m.retstr = LEFT(SUBSTR(m.filname,1,RAT(":",m.filname)-1),m.remain) ;
  9632.             +m.elipse+m.bname
  9633.    ELSE
  9634.          m.retstr = LEFT(justpath(m.filname),m.remain)+m.elipse+m.bname
  9635.    ENDIF
  9636. ENDCASE
  9637. RETURN m.retstr
  9638.  
  9639.  
  9640. *
  9641. * ACTTHERM(<text>) - Activate thermometer.
  9642. *
  9643. * Activates thermometer.  Update the thermometer with UPDTHERM().
  9644. * Thermometer window is named "thermometer."  Be sure to RELEASE
  9645. * this window when done with thermometer.  Creates the global
  9646. * m.g_thermwidth.
  9647. *
  9648. *!*****************************************************************************
  9649. *!
  9650. *!      Procedure: ACTTHERM
  9651. *!
  9652. *!      Called by: STARTTHERM         (procedure in TRANSPRT.PRG)
  9653. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  9654. *!
  9655. *!*****************************************************************************
  9656. PROCEDURE acttherm
  9657. PARAMETER m.text
  9658. PRIVATE m.prompt
  9659.  
  9660. DO CASE
  9661. CASE _WINDOWS
  9662.    m.prompt = LOWER(m.g_scrndbf)
  9663.     m.prompt = thermfname(m.prompt)
  9664.    IF !WEXIST("thermomete")
  9665.       DEFINE WINDOW thermomete ;
  9666.          AT 0,0 ;
  9667.          SIZE 5.615,63.833 ;
  9668.          FONT m.g_tdlgface, m.g_tdlgsize ;
  9669.          STYLE m.g_tdlgstyle ;
  9670.          NOFLOAT ;
  9671.          NOCLOSE ;
  9672.          NONE ;
  9673.          COLOR RGB(0, 0, 0, 192, 192, 192)
  9674.    ENDIF
  9675.    MOVE WINDOW thermomete CENTER
  9676.    ACTIVATE WINDOW thermomete NOSHOW
  9677.  
  9678.    @ 0.5,3 SAY m.text FONT m.g_tdlgface, m.g_tdlgsize STYLE m.g_tdlgstyle
  9679.    @ 1.5,3 SAY m.prompt FONT m.g_tdlgface, m.g_tdlgsize STYLE m.g_tdlgstyle
  9680.    @ 0.000,0.000 TO 0.000,63.833 ;
  9681.       COLOR RGB(255, 255, 255, 255, 255, 255)
  9682.    @ 0.000,0.000 TO 5.615,0.000 ;
  9683.       COLOR RGB(255, 255, 255, 255, 255, 255)
  9684.    @ 0.385,0.667 TO 5.231,0.667 ;
  9685.       COLOR RGB(128, 128, 128, 128, 128, 128)
  9686.    @ 0.308,0.667 TO 0.308,63.167 ;
  9687.       COLOR RGB(128, 128, 128, 128, 128, 128)
  9688.    @ 0.385,63.000 TO 5.308,63.000 ;
  9689.       COLOR RGB(255, 255, 255, 255, 255, 255)
  9690.    @ 5.231,0.667 TO 5.231,63.167 ;
  9691.       COLOR RGB(255, 255, 255, 255, 255, 255)
  9692.    @ 5.538,0.000 TO 5.538,63.833 ;
  9693.       COLOR RGB(128, 128, 128, 128, 128, 128)
  9694.    @ 0.000,63.667 TO 5.615,63.667 ;
  9695.       COLOR RGB(128, 128, 128, 128, 128, 128)
  9696.    @ 3.000,3.333 TO 4.231,3.333 ;
  9697.       COLOR RGB(128, 128, 128, 128, 128, 128)
  9698.    @ 3.000,60.333 TO 4.308,60.333 ;
  9699.       COLOR RGB(255, 255, 255, 255, 255, 255)
  9700.    @ 3.000,3.333 TO 3.000,60.333 ;
  9701.       COLOR RGB(128, 128, 128, 128, 128, 128)
  9702.    @ 4.231,3.333 TO 4.231,60.333 ;
  9703.       COLOR RGB(255, 255, 255, 255, 255, 255)
  9704.    m.g_thermwidth = 56.269
  9705.  
  9706. CASE _MAC
  9707.    m.prompt = LOWER(m.g_scrndbf)
  9708.       m.prompt = thermfname(m.prompt)
  9709.    IF !WEXIST("thermomete")
  9710.       DEFINE WINDOW thermomete ;
  9711.          AT  INT((SROW() - (( 5.62 * ;
  9712.          FONTMETRIC(1, m.g_thermface, m.g_thermsize, m.g_thermstyle )) / ;
  9713.          FONTMETRIC(1, WFONT(1,""), WFONT( 2,""), WFONT(3,"")))) / 2), ;
  9714.          INT((SCOL() - (( 63.83 * ;
  9715.          FONTMETRIC(6, m.g_thermface, m.g_thermsize, m.g_thermstyle )) / ;
  9716.          FONTMETRIC(6, WFONT(1,""), WFONT( 2,""), WFONT(3,"")))) / 2) ;
  9717.          SIZE 5.62,63.83 ;
  9718.          FONT m.g_tdlgface, m.g_tdlgsize ;
  9719.          STYLE m.g_tdlgstyle ;
  9720.          NOFLOAT ;
  9721.          NOCLOSE ;
  9722.             NONE ;
  9723.          COLOR RGB(0, 0, 0, 221, 221, 221)
  9724.    ENDIF
  9725.    MOVE WINDOW thermomete CENTER
  9726.    ACTIVATE WINDOW thermomete NOSHOW
  9727.  
  9728.    IF ISCOLOR()
  9729.       @ 0.000,0.000 TO 5.62,63.83 PATTERN 1;
  9730.          COLOR RGB(221, 221, 221, 221, 221, 221)
  9731.        @ 0.000,0.000 TO 0.000,63.83 ;
  9732.           COLOR RGB(255, 255, 255, 255, 255, 255)
  9733.        @ 0.000,0.000 TO 5.62,0.000 ;
  9734.           COLOR RGB(255, 255, 255, 255, 255, 255)
  9735.        @ 0.385,0.67 TO 5.23,0.67 ;
  9736.           COLOR RGB(128, 128, 128, 128, 128, 128)
  9737.        @ 0.31,0.67 TO 0.31,63.17 ;
  9738.           COLOR RGB(128, 128, 128, 128, 128, 128)
  9739.        @ 0.385,63.000 TO 5.31,63.000 ;
  9740.           COLOR RGB(255, 255, 255, 255, 255, 255)
  9741.        @ 5.23,0.67 TO 5.23,63.17 ;
  9742.           COLOR RGB(255, 255, 255, 255, 255, 255)
  9743.        @ 5.54,0.000 TO 5.54,63.83 ;
  9744.           COLOR RGB(128, 128, 128, 128, 128, 128)
  9745.        @ 0.000,63.67 TO 5.62,63.67 ;
  9746.           COLOR RGB(128, 128, 128, 128, 128, 128)
  9747.        @ 3.000,3.33 TO 4.23,3.33 ;
  9748.           COLOR RGB(128, 128, 128, 128, 128, 128)
  9749.        @ 3.000,60.33 TO 4.31,60.33 ;
  9750.           COLOR RGB(255, 255, 255, 255, 255, 255)
  9751.        @ 3.000,3.33 TO 3.000,60.33 ;
  9752.           COLOR RGB(128, 128, 128, 128, 128, 128)
  9753.        @ 4.23,3.33 TO 4.23,60.33 ;
  9754.           COLOR RGB(255, 255, 255, 255, 255, 255)
  9755.    ELSE
  9756.       @ 0.000, 0.000 TO 5.62, 63.830  PEN 2
  9757.       @ 0.230, 0.430 TO 5.39, 63.400  PEN 1
  9758.    ENDIF
  9759.    @ 0.5,3 SAY m.text FONT m.g_thermface, m.g_thermsize STYLE m.g_thermstyle ;
  9760.       COLOR RGB(0,0,0,192,192,192)
  9761.    @ 1.5,3 SAY m.prompt FONT m.g_thermface, m.g_thermsize STYLE m.g_thermstyle ;
  9762.       COLOR RGB(0,0,0,192,192,192)
  9763.  
  9764.    m.g_thermwidth = 57.17
  9765.     IF !ISCOLOR()
  9766.        @ 3.000,3.33 TO 4.23,m.g_thermwidth + 3.33
  9767.     ENDIF
  9768.  
  9769.    SHOW WINDOW thermomete TOP
  9770. CASE _DOS OR _UNIX
  9771.    m.prompt = SUBSTR(SYS(2014,m.g_scrndbf),1,48)+;
  9772.       IIF(LEN(m.g_scrndbf)>48,"...","")
  9773.    IF !WEXIST("thermomete")
  9774.       DEFINE WINDOW thermomete;
  9775.          FROM INT((SROW()-7)/2), INT((SCOL()-57)/2) ;
  9776.          TO INT((SROW()-7)/2) + 6, INT((SCOL()-57)/2) + 57;
  9777.          DOUBLE COLOR SCHEME 5
  9778.    ENDIF
  9779.    ACTIVATE WINDOW thermomete NOSHOW
  9780.  
  9781.    m.g_thermwidth = 50
  9782.    @ 0,3 SAY m.text
  9783.    @ 1,3 SAY UPPER(m.prompt)
  9784.    @ 2,1 TO 4,m.g_thermwidth+4 &g_boxstrg
  9785.  
  9786.    SHOW WINDOW thermomete TOP
  9787. ENDCASE
  9788. RETURN
  9789.  
  9790. *
  9791. * UPDTHERM(<percent>) - Update thermometer.
  9792. *
  9793. *!*****************************************************************************
  9794. *!
  9795. *!      Procedure: UPDTHERM
  9796. *!
  9797. *!      Called by: TRANSPRT.PRG
  9798. *!               : GRAPHICTOCHAR      (procedure in TRANSPRT.PRG)
  9799. *!               : CHARTOGRAPHIC      (procedure in TRANSPRT.PRG)
  9800. *!               : UPDATESCREEN       (procedure in TRANSPRT.PRG)
  9801. *!               : UPDATEREPORT       (procedure in TRANSPRT.PRG)
  9802. *!               : NEWCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  9803. *!               : NEWGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  9804. *!               : ALLCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  9805. *!               : ALLENVIRONS        (procedure in TRANSPRT.PRG)
  9806. *!               : ALLOTHERS          (procedure in TRANSPRT.PRG)
  9807. *!               : ALLGROUPS          (procedure in TRANSPRT.PRG)
  9808. *!               : RPTCONVERT         (procedure in TRANSPRT.PRG)
  9809. *!               : LABELLINES         (procedure in TRANSPRT.PRG)
  9810. *!               : CALCWINDOWDIMENSION(procedure in TRANSPRT.PRG)
  9811. *!               : FINDWIDEROBJECTS   (procedure in TRANSPRT.PRG)
  9812. *!               : REPOOBJECTS        (procedure in TRANSPRT.PRG)
  9813. *!               : ADJINVBTNS         (procedure in TRANSPRT.PRG)
  9814. *!               : JOINLINES          (procedure in TRANSPRT.PRG)
  9815. *!               : WRITERESULT        (procedure in TRANSPRT.PRG)
  9816. *!
  9817. *!          Calls: ACTTHERM           (procedure in TRANSPRT.PRG)
  9818. *!
  9819. *!*****************************************************************************
  9820. PROCEDURE updtherm
  9821. PARAMETER m.percent
  9822. PRIVATE m.nblocks, m.percent
  9823.  
  9824. IF m.percent > 100
  9825.    m.percent = 100
  9826. ENDIF
  9827. IF m.percent < 0
  9828.    m.percent = 0
  9829. ENDIF
  9830.  
  9831. IF !WEXIST("thermomete")
  9832.    DO acttherm WITH ""
  9833. ENDIF
  9834. ACTIVATE WINDOW thermomete
  9835.  
  9836. m.nblocks = (m.percent/100) * (m.g_thermwidth)
  9837. DO CASE
  9838. CASE _WINDOWS
  9839.    @ 3.000,3.333 TO 4.231,m.nblocks + 3.333 ;
  9840.       PATTERN 1 COLOR RGB(128, 128, 128, 128, 128, 128)
  9841. CASE _MAC
  9842.    @ 3.000,3.33 TO 4.23,m.nblocks + 3.33 ;
  9843.       PATTERN 1 COLOR RGB(0, 0, 128, 0, 0, 128)
  9844. OTHERWISE
  9845.    @ 3,3 SAY REPLICATE("█",m.nblocks)
  9846. ENDCASE
  9847. RETURN
  9848.  
  9849. *
  9850. * deactTherm - Deactivate and Release thermometer window.
  9851. *
  9852. *!*****************************************************************************
  9853. *!
  9854. *!      Procedure: DEACTTHERM
  9855. *!
  9856. *!      Called by: CLEANUP            (procedure in TRANSPRT.PRG)
  9857. *!
  9858. *!*****************************************************************************
  9859. PROCEDURE deacttherm
  9860. IF WEXIST("thermomete")
  9861.    RELEASE WINDOW thermomete
  9862. ENDIF
  9863. RETURN
  9864.  
  9865. *
  9866. * ERRORHANDLER - Error Processing Center.
  9867. *
  9868. *!*****************************************************************************
  9869. *!
  9870. *!      Procedure: ERRORHANDLER
  9871. *!
  9872. *!      Called by: TRANSPRT.PRG
  9873. *!               : SETVERSION         (procedure in TRANSPRT.PRG)
  9874. *!               : cvrtfbpRPT      (procedure in TRANSPRT.PRG)
  9875. *!               : STRUCTDIALOG()     (function  in TRANSPRT.PRG)
  9876. *!               : SCXFRXDIALOG()     (function  in TRANSPRT.PRG)
  9877. *!
  9878. *!          Calls: CLEANUP            (procedure in TRANSPRT.PRG)
  9879. *!               : ERRSHOW            (procedure in TRANSPRT.PRG)
  9880. *!               : CLEANWIND          (procedure in TRANSPRT.PRG)
  9881. *!
  9882. *!*****************************************************************************
  9883. PROCEDURE errorhandler
  9884. PARAMETERS m.msg, m.linenum, errcode
  9885. IF ERROR() = 22
  9886.    ON ERROR &onerror
  9887.    m.g_status = 1
  9888.    DO cleanup
  9889.    CANCEL
  9890. ENDIF
  9891. SET MESSAGE TO
  9892. DO CASE
  9893. CASE errcode == c_error1
  9894.    m.g_status = 1
  9895. CASE errcode == c_error2
  9896.    DO errshow WITH m.msg, m.linenum
  9897.    m.g_status = 2
  9898.    ON ERROR &onerror
  9899. CASE errcode == c_error3
  9900.    ON ERROR &onerror
  9901.    DO errshow WITH m.msg, m.linenum
  9902.    DO cleanwind
  9903.    m.g_status = 3
  9904.    m.g_returncode = c_cancel
  9905.    DO cleanup WITH .T.
  9906. ENDCASE
  9907.  
  9908. *
  9909. * CLEANWIND - Release windows that might still be open
  9910. *
  9911. *!*****************************************************************************
  9912. *!
  9913. *!      Procedure: CLEANWIND
  9914. *!
  9915. *!      Called by: ERRORHANDLER       (procedure in TRANSPRT.PRG)
  9916. *!               : ESCHANDLER         (procedure in TRANSPRT.PRG)
  9917. *!
  9918. *!*****************************************************************************
  9919. PROCEDURE cleanwind
  9920. IF WEXIST("transdlg") AND WVISIBLE("transdlg")
  9921.    RELEASE WINDOW transdlg
  9922. ENDIF
  9923. IF WEXIST("lblwind") AND WVISIBLE("lblwind")
  9924.    RELEASE WINDOW lblwind
  9925. ENDIF
  9926. IF WEXIST("msgscrn") AND WVISIBLE("msgscrn")
  9927.    RELEASE WINDOW msgscrn
  9928. ENDIF
  9929. IF WEXIST("Thermomete") AND WVISIBLE("Thermomete")
  9930.    RELEASE WINDOW thermomete
  9931. ENDIF
  9932. IF WEXIST("tpselect") AND WVISIBLE("tpselect")
  9933.    RELEASE WINDOW tpselect
  9934. ENDIF
  9935.  
  9936. *
  9937. * ESCHANDLER - Escape handler.
  9938. *
  9939. *!*****************************************************************************
  9940. *!
  9941. *!      Procedure: ESCHANDLER
  9942. *!
  9943. *!      Called by: SETALL             (procedure in TRANSPRT.PRG)
  9944. *!
  9945. *!          Calls: CLEANWIND          (procedure in TRANSPRT.PRG)
  9946. *!               : CLEANUP            (procedure in TRANSPRT.PRG)
  9947. *!
  9948. *!*****************************************************************************
  9949. PROCEDURE eschandler
  9950. ON ERROR &onerror
  9951. m.g_status = 1
  9952. DO cleanwind
  9953. DO cleanup
  9954. CANCEL
  9955.  
  9956. *
  9957. * ERRSHOW - Show error in an alert box on the screen.
  9958. *
  9959. *!*****************************************************************************
  9960. *!
  9961. *!      Procedure: ERRSHOW
  9962. *!
  9963. *!      Called by: ERRORHANDLER       (procedure in TRANSPRT.PRG)
  9964. *!
  9965. *!*****************************************************************************
  9966. PROCEDURE errshow
  9967. PARAMETER m.msg, m.lineno
  9968. PRIVATE m.curcursor
  9969.  
  9970. DO CASE
  9971. CASE _WINDOWS
  9972.    DEFINE WINDOW ALERT ;
  9973.       AT 0,0 ;
  9974.       SIZE 5.615,63.833 ;
  9975.       FONT m.g_tdlgface, m.g_tdlgsize ;
  9976.       STYLE m.g_tdlgstyle ;
  9977.       NOCLOSE ;
  9978.       DOUBLE ;
  9979.       TITLE "Transporter Error"
  9980.    MOVE WINDOW ALERT CENTER
  9981.    ACTIVATE WINDOW ALERT NOSHOW
  9982.  
  9983.    m.msg = SUBSTR(m.msg,1,44)+IIF(LEN(m.msg)>44,"...","")
  9984.    @ 1,(WCOLS()-TXTWIDTH( m.msg ))/2 SAY m.msg
  9985.  
  9986.    m.msg = "Line Number: "+LTRIM(STR(m.lineno,5))
  9987.    @ 2,(WCOLS()-TXTWIDTH( m.msg ))/2 SAY m.msg
  9988.  
  9989.    m.msg = "Press any key to cleanup and exit..."
  9990.    @ 3,(WCOLS()-TXTWIDTH( m.msg ))/2 SAY m.msg
  9991. CASE _MAC
  9992.    DEFINE WINDOW ALERT ;
  9993.       AT 0,0 ;
  9994.       SIZE 5.615,63.833 ;
  9995.       FONT m.g_tdlgface, m.g_tdlgsize ;
  9996.       STYLE m.g_tdlgstyle ;
  9997.       NOCLOSE ;
  9998.       DOUBLE ;
  9999.       TITLE "Transporter Error"
  10000.    MOVE WINDOW ALERT CENTER
  10001.    ACTIVATE WINDOW ALERT NOSHOW
  10002.  
  10003.    m.msg = SUBSTR(m.msg,1,44)+IIF(LEN(m.msg)>44,"...","")
  10004.    @ 1,(WCOLS()-TXTWIDTH( m.msg ))/2 SAY m.msg
  10005.  
  10006.    m.msg = "Line Number: "+LTRIM(STR(m.lineno,5))
  10007.    @ 2,(WCOLS()-TXTWIDTH( m.msg ))/2 SAY m.msg
  10008.  
  10009.    m.msg = "Press any key to cleanup and exit..."
  10010.    @ 3,(WCOLS()-TXTWIDTH( m.msg ))/2 SAY m.msg
  10011. OTHERWISE
  10012.    DEFINE WINDOW ALERT;
  10013.       FROM INT((SROW()-6)/2), INT((SCOL()-50)/2) ;
  10014.       TO INT((SROW()-6)/2) + 6, INT((SCOL()-50)/2) + 50;
  10015.       FLOAT NOGROW NOCLOSE NOZOOM   SHADOW DOUBLE;
  10016.       COLOR SCHEME 7
  10017.  
  10018.    ACTIVATE WINDOW ALERT NOSHOW
  10019.  
  10020.    m.msg = SUBSTR(m.msg,1,44)+IIF(LEN(m.msg)>44,"...","")
  10021.    @ 1,(WCOLS()-LEN(m.msg))/2 SAY m.msg
  10022.  
  10023.    m.msg = "Line Number: "+STR(m.lineno, 5)
  10024.    @ 2,(WCOLS()-LEN(m.msg))/2 SAY m.msg
  10025.  
  10026.    m.msg = "Press any key to cleanup and exit..."
  10027.    @ 3,(WCOLS()-LEN(m.msg))/2 SAY m.msg
  10028. ENDCASE
  10029.  
  10030. m.curcursor = SET( "CURSOR" )
  10031. SET CURSOR OFF
  10032. SHOW WINDOW ALERT
  10033.  
  10034. =INKEY(0, "M")
  10035.  
  10036. RELEASE WINDOW ALERT
  10037. SET CURSOR &curcursor
  10038.  
  10039. *
  10040. * JUSTSTEM - Returns just the stem name of the file
  10041. *
  10042. *!*****************************************************************************
  10043. *!
  10044. *!       Function: JUSTSTEM
  10045. *!
  10046. *!*****************************************************************************
  10047. FUNCTION juststem
  10048. * Return just the stem name from "filname"
  10049. PARAMETERS m.filname
  10050. PRIVATE ALL
  10051. IF RAT('\',m.filname) > 0
  10052.    m.filname = SUBSTR(m.filname,RAT('\',m.filname)+1,255)
  10053. ENDIF
  10054. IF AT(':',m.filname) > 0
  10055.    m.filname = SUBSTR(m.filname,AT(':',m.filname)+1,255)
  10056. ENDIF
  10057. IF AT('.',m.filname) > 0
  10058.    m.filname = SUBSTR(m.filname,1,AT('.',m.filname)-1)
  10059. ENDIF
  10060. RETURN ALLTRIM(UPPER(m.filname))
  10061.  
  10062. *
  10063. * STRIPPATH - Strip the path from a file name.
  10064. *
  10065. * Description:
  10066. * Find positions of backslash in the name of the file.  If there is one
  10067. * take everything to the right of its position and make it the new file
  10068. * name.  If there is no slash look for colon.  Again if found, take
  10069. * everything to the right of it as the new name.  If neither slash
  10070. * nor colon are found then return the name unchanged.
  10071. *
  10072. * Parameters:
  10073. * filename - character string representing a file name
  10074. *
  10075. * Return value:
  10076. * The string "filename" with any path removed
  10077. *
  10078. *!*****************************************************************************
  10079. *!
  10080. *!       Function: STRIPPATH
  10081. *!
  10082. *!      Called by: TRANSPRT.PRG
  10083. *!               : ADJBITMAPCTRL      (procedure in TRANSPRT.PRG)
  10084. *!               : SCXFRXDIALOG()     (function  in TRANSPRT.PRG)
  10085. *!
  10086. *!*****************************************************************************
  10087. FUNCTION strippath
  10088. PARAMETER m.filename
  10089. PRIVATE m.slashpos, m.namelen, m.colonpos
  10090. m.slashpos = RAT("\", m.filename)
  10091. IF m.slashpos > 0
  10092.    m.namelen  = LEN(m.filename) - m.slashpos
  10093.    m.filename = RIGHT(m.filename, m.namelen)
  10094. ELSE
  10095.    m.colonpos = RAT(":", m.filename)
  10096.    IF m.colonpos > 0
  10097.       m.namelen  = LEN(m.filename) - m.colonpos
  10098.       m.filename = RIGHT(m.filename, m.namelen)
  10099.    ENDIF
  10100. ENDIF
  10101. RETURN m.filename
  10102.  
  10103. *
  10104. * ISOBJECT - Is otype a screen or report object?
  10105. *
  10106. *!*****************************************************************************
  10107. *!
  10108. *!       Function: ISOBJECT
  10109. *!
  10110. *!      Called by: UPDATESCREEN       (procedure in TRANSPRT.PRG)
  10111. *!               : NEWCHARTOGRAPHIC   (procedure in TRANSPRT.PRG)
  10112. *!               : NEWGRAPHICTOCHAR   (procedure in TRANSPRT.PRG)
  10113. *!               : FINDLIKEVPOS       (procedure in TRANSPRT.PRG)
  10114. *!               : FINDLIKEHPOS       (procedure in TRANSPRT.PRG)
  10115. *!               : SELECTOBJ          (procedure in TRANSPRT.PRG)
  10116. *!
  10117. *!*****************************************************************************
  10118. FUNCTION isobject
  10119. PARAMETER m.otype
  10120. RETURN INLIST(m.otype,c_otlist,c_ottxtbut,c_otbox,c_otradbut,c_otchkbox,c_otfield, ;
  10121.    c_otpopup,c_otinvbut,c_otspinner,c_otpicture,c_otline,c_otrepfld,c_otrepvar,c_ottext)
  10122.  
  10123.  
  10124. *
  10125. * ISREPTOBJECT - Is otype a report object?
  10126. *
  10127. *!*****************************************************************************
  10128. *!
  10129. *!       Function: ISREPTOBJECT
  10130. *!
  10131. *!      Called by: RPTCONVERT         (procedure in TRANSPRT.PRG)
  10132. *!
  10133. *!*****************************************************************************
  10134. FUNCTION isreptobject
  10135. PARAMETER m.otype
  10136. RETURN INLIST(m.otype,c_otrepfld,c_ottext,c_otbox,c_otline)
  10137.  
  10138. *
  10139. * ISGRAPHOBJ - Is otype an object that is present in graphics screens/reports but not
  10140. *              in character screens?
  10141. *
  10142. *!*****************************************************************************
  10143. *!
  10144. *!       Function: ISGRAPHOBJ
  10145. *!
  10146. *!*****************************************************************************
  10147. FUNCTION isgraphobj
  10148. PARAMETER m.otype
  10149. RETURN INLIST(m.otype,c_otpicture,c_otspinner)
  10150.  
  10151. *!*****************************************************************************
  10152. *!
  10153. *!       Function: ISENVIRON
  10154. *!
  10155. *!*****************************************************************************
  10156. FUNCTION isenviron
  10157. PARAMETER m.otype
  10158. RETURN INLIST(m.otype,c_otworkar,c_otindex,c_otrel)
  10159.  
  10160. *!*****************************************************************************
  10161. *!
  10162. *!       Function: IsNewerEnv
  10163. *!
  10164. *!*****************************************************************************
  10165. FUNCTION IsNewerEnv
  10166. PARAMETER m.mustexist    && does the "to" environment have to exist?
  10167. PRIVATE m.maxfromts, m.maxtots
  10168. * Is the "from" platform environment newer than the "to" platform environment
  10169. m.maxfromts = -1
  10170. SCAN FOR platform = m.g_fromplatform and IsEnviron(objtype)
  10171.    m.maxfromts = MAX(timestamp, m.maxfromts)
  10172. ENDSCAN
  10173. m.maxtots = -1
  10174. SCAN FOR platform = m.g_toplatform and IsEnviron(objtype)
  10175.    m.maxtots = MAX(timestamp, m.maxtots)
  10176. ENDSCAN
  10177. IF m.mustexist
  10178.    * The to platform had an environment, but it was out of date
  10179.    RETURN IIF(m.maxfromts > m.maxtots AND m.maxtots >= 0 , .T. , .F.)
  10180. ELSE
  10181.    * The to platform had no environment and the from platform does
  10182.    RETURN IIF(m.maxfromts >= 0 AND m.maxtots < 0  , .T. , .F.)
  10183. ENDIF
  10184.  
  10185. *
  10186. * HASRECORD - Does filname contain platform records for target?
  10187. *
  10188. *!*****************************************************************************
  10189. *!
  10190. *!       Function: HASRECORDS
  10191. *!
  10192. *!      Called by: SCXFRXDIALOG()     (function  in TRANSPRT.PRG)
  10193. *!
  10194. *!*****************************************************************************
  10195. FUNCTION hasrecords
  10196. PARAMETER m.target
  10197. PRIVATE m.inrec, m.retval
  10198. m.inrec = RECNO()
  10199. DO CASE
  10200. CASE TYPE("PLATFORM") <> "U"
  10201.    LOCATE FOR UPPER(ALLTRIM(platform)) == UPPER(ALLTRIM(m.target))
  10202.    m.retval = FOUND()
  10203. CASE UPPER(ALLTRIM(m.target)) == "DOS"
  10204.    m.retval = .T.   && assume DOS if no platform field
  10205. OTHERWISE
  10206.    m.retval = .F.
  10207. ENDCASE
  10208. GOTO m.inrec
  10209. RETURN m.retval
  10210.  
  10211.  
  10212. *!*****************************************************************************
  10213. *!
  10214. *!       Function: setctrl
  10215. *!
  10216. *!      Called by: SCXFRXDIALOG()     (function  in TRANSPRT.PRG)
  10217. *!
  10218. *!*****************************************************************************
  10219. FUNCTION setctrl
  10220. * This function is called during Transporter setup to initialize some of
  10221. * the font selections.  It is also called as the valid() routine when
  10222. * the 2D controls checkbox is checked.
  10223. DO CASE
  10224. CASE _MAC
  10225.     * Set fonts based on 2D/3D choice--Mac only
  10226.     IF m.g_look2d
  10227.        * Push button and controls font.  Font button does not override this.
  10228.        m.g_ctrlfface        = "Chicago"
  10229.        m.g_ctrlfsize        = 12
  10230.        m.g_ctrlfstyle       = ""
  10231.  
  10232.         * Window measurement font
  10233.        m.g_windfface        = "Chicago"
  10234.        m.g_windfsize        = 12
  10235.        m.g_windfstyle       = ""
  10236.  
  10237.         * Set default font for SCX/FRX objects (e.g., text).
  10238.         * The Font button may override this.
  10239.        m.g_dfltfface         = "Geneva"
  10240.        m.g_dfltfsize         = 10
  10241.        m.g_dfltfstyle        = ""
  10242.  
  10243.         m.g_macbtnheight = 1.125
  10244.         m.g_macbtnface   = "Chicago"
  10245.         m.g_macbtnsize   = 12
  10246.         m.g_macbtnstyle  = ""
  10247.     ELSE
  10248.        m.g_ctrlfface        = "Geneva"
  10249.        m.g_ctrlfsize        = 9
  10250.        m.g_ctrlfstyle       = "B"
  10251.  
  10252.         * The cxChar for Geneva, 10 nonbold is 6 pixels, just like
  10253.          * MS Sans Serif,8 bold.  This is a good mapping for screens coming
  10254.         * over from Windows.
  10255.        m.g_windfface        = "Geneva"
  10256.        m.g_windfsize        = 10
  10257.        m.g_windfstyle       = ""
  10258.  
  10259.         * Set default font for SCX objects.  The Font button may
  10260.          * override this.
  10261.        m.g_dfltfface         = "Geneva"
  10262.        m.g_dfltfsize         = 10
  10263.        m.g_dfltfstyle        = ""
  10264.  
  10265.         m.g_macbtnheight = 1.500
  10266.         m.g_macbtnface   = "Geneva"
  10267.         m.g_macbtnsize   = 10
  10268.         m.g_macbtnstyle  = "B"
  10269.     ENDIF
  10270.    m.g_winbtnheight = 1.769
  10271.     m.g_winbtnface   = "MS Sans Serif"
  10272.     m.g_winbtnsize   = 8
  10273.     m.g_winbtnstyle  = "B"
  10274.  
  10275.     m.g_thermface    = "Geneva"
  10276.     m.g_thermsize    = 10
  10277.     m.g_thermstyle   = "T"
  10278.     m.g_btnheight    = m.g_macbtnheight
  10279. OTHERWISE
  10280.    * Font for push buttons
  10281.    m.g_ctrlfface        = "MS Sans Serif"
  10282.    m.g_ctrlfsize        = 8
  10283.    m.g_ctrlfstyle       = "B"
  10284.  
  10285.     * Window measurement font
  10286.    m.g_windfface        = "MS Sans Serif"
  10287.    m.g_windfsize        = 8
  10288.    m.g_windfstyle       = "B"
  10289.  
  10290.    * Font selections for fields/text in the SCX/FRX itself.  May be overridden by user.
  10291.     m.g_dfltfface         = "MS Sans Serif"
  10292.    m.g_dfltfsize         = 8
  10293.    m.g_dfltfstyle        = "B"
  10294.  
  10295.    m.g_winbtnheight = 1.769
  10296.     m.g_macbtnheight = 1.500      && figure that most screens will be 3D
  10297.     m.g_macbtnface   = "Geneva"
  10298.     m.g_macbtnsize   = 10
  10299.     m.g_macbtnstyle  = "B"
  10300.     m.g_winbtnface   = "MS Sans Serif"
  10301.     m.g_winbtnsize   = 8
  10302.     m.g_winbtnstyle  = "B"
  10303.     m.g_btnheight    = m.g_winbtnheight
  10304.  
  10305. ENDCASE
  10306.  
  10307. *!*****************************************************************************
  10308. *!
  10309. *!       Function: SETRPTFONT
  10310. *!
  10311. *!*****************************************************************************
  10312. PROCEDURE setrptfont
  10313. * Set the default report font for a report coming to the Mac
  10314. * Disabled by WJK
  10315. IF .F. _MAC AND INLIST(m.g_filetype,c_report,c_label)
  10316.     m.g_windfface        = m.g_rptfface
  10317.     m.g_windfsize        = m.g_rptfsize
  10318.     m.g_windfstyle       = num2style(m.g_rptfstyle)
  10319.  
  10320.     * Set default font for FRX objects.  The Font button may
  10321.     * override this.
  10322.     m.g_dfltfface         = m.g_rptfface
  10323.     m.g_dfltfsize         = m.g_rptfsize
  10324.     m.g_dfltfstyle        = num2style(m.g_rptfstyle)
  10325. ENDIF
  10326.  
  10327. *
  10328. * ASKFONT - Prompt for a font
  10329. *
  10330. *!*****************************************************************************
  10331. *!
  10332. *!       Function: ASKFONT
  10333. *!
  10334. *!      Called by: SCXFRXDIALOG()     (function  in TRANSPRT.PRG)
  10335. *!
  10336. *!*****************************************************************************
  10337. FUNCTION askfont
  10338. PRIVATE m.fontstrg
  10339.  
  10340. * Set up a default font for reports
  10341. IF m.g_filetype = c_report AND (_WINDOWS OR _MAC)
  10342.    DEFINE WINDOW transtemp FROM 1,1 TO 2,2 FONT "&g_rptfface", m.g_rptfsize
  10343.    ACTIVATE WINDOW transtemp NOSHOW
  10344. ENDIF
  10345.  
  10346. m.fontstrg = GETFONT()
  10347.  
  10348. IF !EMPTY(m.fontstrg)
  10349.    m.g_dfltfface   =  LEFT(m.fontstrg,AT(',',m.fontstrg)-1)
  10350.    m.g_dfltfsize   =  VAL(SUBSTR(m.fontstrg,AT(',',m.fontstrg)+1,RAT(',',m.fontstrg)-AT(',',m.fontstrg)-1))
  10351.    m.g_dfltfstyle  =  SUBSTR(m.fontstrg,RAT(',',m.fontstrg)+1)
  10352.    IF _MAC OR _WINDOWS
  10353.       m.g_rptlinesize      = (FONTMETRIC(1, m.g_dfltfface, m.g_dfltfsize, m.g_rpttxtfontstyle) / m.g_pixelsize) * 10000
  10354.       m.g_rptcharsize      = (FONTMETRIC(6, m.g_dfltfface, m.g_dfltfsize, m.g_rpttxtfontstyle) / m.g_pixelsize) * 10000
  10355.    ENDIF
  10356.    m.g_fontset = .T.
  10357. ENDIF
  10358.  
  10359. IF m.g_filetype = c_report AND (_WINDOWS OR _MAC)
  10360.    RELEASE WINDOW transtemp
  10361. ENDIF
  10362.  
  10363. RETURN
  10364.  
  10365. *
  10366. * IS20SCX - Is the current database a 2.0 screen?
  10367. *
  10368. *!*****************************************************************************
  10369. *!
  10370. *!       Function: IS20SCX
  10371. *!
  10372. *!*****************************************************************************
  10373. FUNCTION is20scx
  10374. RETURN (FCOUNT() = c_20scxfld)
  10375. *
  10376. * IS20FRX - Is the current database a 2.0 report?
  10377. *
  10378. *!*****************************************************************************
  10379. *!
  10380. *!       Function: IS20FRX
  10381. *!
  10382. *!*****************************************************************************
  10383. FUNCTION is20frx
  10384. RETURN (FCOUNT() = c_20frxfld)
  10385. *
  10386. * IS20LBX - Is the current database a 2.0 screen?
  10387. *
  10388. *!*****************************************************************************
  10389. *!
  10390. *!       Function: IS20LBX
  10391. *!
  10392. *!*****************************************************************************
  10393. FUNCTION is20lbx
  10394. RETURN (FCOUNT() = c_20lbxfld)
  10395. IF WEXIST("lblwind")   AND WVISIBLE("lblwind")
  10396.    RELEASE WINDOW lblwind
  10397. ENDIF
  10398.  
  10399. *
  10400. * GETSNIPFLAG - See if we are just updating snippets
  10401. *
  10402. *!*****************************************************************************
  10403. *!
  10404. *!       Function: GETSNIPFLAG
  10405. *!
  10406. *!      Called by: UPDATESCREEN       (procedure in TRANSPRT.PRG)
  10407. *!
  10408. *!          Calls: WORDNUM()          (function  in TRANSPRT.PRG)
  10409. *!               : MATCH()            (function  in TRANSPRT.PRG)
  10410. *!
  10411. *!*****************************************************************************
  10412. FUNCTION getsnipflag
  10413. PARAMETER snippet
  10414. PRIVATE m.oldmline, m.retcode
  10415. * Format for directive is "#TRAN SNIPPET ONLY" in setup snippet
  10416. m.oldmline = _MLINE
  10417. m.retcode = .F.
  10418. IF AT('#',snippet) > 0
  10419.    _MLINE = 0
  10420.    m.sniplen = LEN(snippet)
  10421.    DO WHILE _MLINE < m.sniplen
  10422.       m.line = MLINE(snippet,1,_MLINE)
  10423.       m.upline = UPPER(LTRIM(m.line))
  10424.       IF '#TRAN' $ m.upline
  10425.          IF LEFT(wordnum(m.upline,1),5) = '#TRAN' ;
  10426.                AND match(wordnum(m.upline,2),'SNIPPETS') ;
  10427.                AND match(wordnum(m.upline,3),'ONLY')
  10428.             m.retcode = .T.
  10429.          ENDIF
  10430.       ENDIF
  10431.    ENDDO
  10432.    _MLINE = m.oldmline
  10433. ENDIF
  10434. RETURN m.retcode
  10435.  
  10436.  
  10437. *
  10438. * MATCH - Returns TRUE if candidate is a valid 4-or-more-character abbreviation of keyword
  10439. *
  10440. *!*****************************************************************************
  10441. *!
  10442. *!       Function: MATCH
  10443. *!
  10444. *!      Called by: GETSNIPFLAG()      (function  in TRANSPRT.PRG)
  10445. *!
  10446. *!*****************************************************************************
  10447. FUNCTION match
  10448. PARAMETER candidate, keyword
  10449. PRIVATE m.in_exact, m.retval
  10450.  
  10451. m.in_exact = SET("EXACT")
  10452. SET EXACT OFF
  10453. DO CASE
  10454. CASE EMPTY(m.candidate)
  10455.    m.retval = EMPTY(m.keyword)
  10456. CASE LEN(m.candidate) < 4
  10457.    m.retval = IIF(m.candidate == m.keyword,.T.,.F.)
  10458. OTHERWISE
  10459.    m.retval = IIF(m.keyword = m.candidate,.T.,.F.)
  10460. ENDCASE
  10461. IF m.in_exact != "OFF"
  10462.    SET EXACT ON
  10463. ENDIF
  10464. RETURN m.retval
  10465.  
  10466.  
  10467. *
  10468. * WORDNUM - Returns w_num-th word from string strg
  10469. *
  10470. *!*****************************************************************************
  10471. *!
  10472. *!       Function: WORDNUM
  10473. *!
  10474. *!      Called by: GETSNIPFLAG()      (function  in TRANSPRT.PRG)
  10475. *!
  10476. *!*****************************************************************************
  10477. FUNCTION wordnum
  10478. PARAMETERS strg,w_num
  10479. PRIVATE strg,s1,w_num,ret_str
  10480.  
  10481. m.s1 = ALLTRIM(m.strg)
  10482.  
  10483. * Replace tabs with spaces
  10484. m.s1 = CHRTRAN(m.s1,CHR(9)," ")
  10485.  
  10486. * Reduce multiple spaces to a single space
  10487. DO WHILE AT('  ',m.s1) > 0
  10488.    m.s1 = STRTRAN(m.s1,'  ',' ')
  10489. ENDDO
  10490.  
  10491. ret_str = ""
  10492. DO CASE
  10493. CASE m.w_num > 1
  10494.    DO CASE
  10495.    CASE AT(" ",m.s1,m.w_num-1) = 0   && No word w_num.  Past end of string.
  10496.       m.ret_str = ""
  10497.    CASE AT(" ",m.s1,m.w_num) = 0     && Word w_num is last word in string.
  10498.       m.ret_str = SUBSTR(m.s1,AT(" ",m.s1,m.w_num-1)+1,255)
  10499.    OTHERWISE                         && Word w_num is in the middle.
  10500.       m.strt_pos = AT(" ",m.s1,m.w_num-1)
  10501.       m.ret_str  = SUBSTR(m.s1,strt_pos,AT(" ",m.s1,m.w_num)+1 - strt_pos)
  10502.    ENDCASE
  10503. CASE m.w_num = 1
  10504.    IF AT(" ",m.s1) > 0               && Get first word.
  10505.       m.ret_str = SUBSTR(m.s1,1,AT(" ",m.s1)-1)
  10506.    ELSE                              && There is only one word.  Get it.
  10507.       m.ret_str = m.s1
  10508.    ENDIF
  10509. ENDCASE
  10510. RETURN ALLTRIM(m.ret_str)
  10511.  
  10512. *
  10513. * ADDBS - Add a backslash unless there is one already there.
  10514. *
  10515. *!*****************************************************************************
  10516. *!
  10517. *!       Function: ADDBS
  10518. *!
  10519. *!      Called by: FORCEEXT()         (function  in TRANSPRT.PRG)
  10520. *!
  10521. *!*****************************************************************************
  10522. FUNCTION addbs
  10523. * Add a backslash to a path name, if there isn't already one there
  10524. PARAMETER m.pathname
  10525. PRIVATE ALL
  10526. m.pathname = ALLTRIM(UPPER(m.pathname))
  10527. IF !(RIGHT(m.pathname,1) $ '\:') AND !EMPTY(m.pathname)
  10528.    m.pathname = m.pathname + '\'
  10529. ENDIF
  10530. RETURN m.pathname
  10531.  
  10532. *
  10533. * JUSTFNAME - Return just the filename (i.e., no path) from "filname"
  10534. *
  10535. *!*****************************************************************************
  10536. *!
  10537. *!       Function: JUSTFNAME
  10538. *!
  10539. *!      Called by: FORCEEXT()         (function  in TRANSPRT.PRG)
  10540. *!
  10541. *!*****************************************************************************
  10542. FUNCTION justfname
  10543. PARAMETERS m.filname
  10544. PRIVATE ALL
  10545. IF RAT('\',m.filname) > 0
  10546.    m.filname = SUBSTR(m.filname,RAT('\',m.filname)+1,255)
  10547. ENDIF
  10548. IF AT(':',m.filname) > 0
  10549.    m.filname = SUBSTR(m.filname,AT(':',m.filname)+1,255)
  10550. ENDIF
  10551. RETURN ALLTRIM(UPPER(m.filname))
  10552.  
  10553. *
  10554. * JUSTPATH - Returns just the pathname.
  10555. *
  10556. *!*****************************************************************************
  10557. *!
  10558. *!       Function: JUSTPATH
  10559. *!
  10560. *!      Called by: FORCEEXT()         (function  in TRANSPRT.PRG)
  10561. *!
  10562. *!*****************************************************************************
  10563. FUNCTION justpath
  10564. * Return just the path name from "filname"
  10565. PARAMETERS m.filname
  10566. PRIVATE ALL
  10567. m.filname = ALLTRIM(UPPER(m.filname))
  10568. IF '\' $ m.filname
  10569.    m.filname = SUBSTR(m.filname,1,RAT('\',m.filname))
  10570.    IF RIGHT(m.filname,1) = '\' AND LEN(m.filname) > 1 ;
  10571.          AND SUBSTR(m.filname,LEN(m.filname)-1,1) <> ':'
  10572.       m.filname = SUBSTR(m.filname,1,LEN(m.filname)-1)
  10573.    ENDIF
  10574.    RETURN m.filname
  10575. ELSE
  10576.    RETURN ''
  10577. ENDIF
  10578.  
  10579. *
  10580. * FORCEEXT - Force filename to have a paricular extension.
  10581. *
  10582. *!*****************************************************************************
  10583. *!
  10584. *!       Function: FORCEEXT
  10585. *!
  10586. *!      Called by: cvrt102FRX()       (function  in TRANSPRT.PRG)
  10587. *!               : cvrtfbpRPT      (procedure in TRANSPRT.PRG)
  10588. *!
  10589. *!          Calls: JUSTPATH()         (function  in TRANSPRT.PRG)
  10590. *!               : JUSTFNAME()        (function  in TRANSPRT.PRG)
  10591. *!               : ADDBS()            (function  in TRANSPRT.PRG)
  10592. *!
  10593. *!*****************************************************************************
  10594. FUNCTION forceext
  10595. * Force the extension of "filname" to be whatever ext is.
  10596. PARAMETERS m.filname,m.ext
  10597. PRIVATE ALL
  10598. IF SUBSTR(m.ext,1,1) = "."
  10599.    m.ext = SUBSTR(m.ext,2,3)
  10600. ENDIF
  10601.  
  10602. m.pname = justpath(m.filname)
  10603. m.filname = justfname(UPPER(ALLTRIM(m.filname)))
  10604. IF AT('.',m.filname) > 0
  10605.    m.filname = SUBSTR(m.filname,1,AT('.',m.filname)-1) + '.' + m.ext
  10606. ELSE
  10607.    m.filname = m.filname + '.' + m.ext
  10608. ENDIF
  10609. RETURN addbs(m.pname) + m.filname
  10610.  
  10611. *!*****************************************************************************
  10612. *!
  10613. *!       Function: CVTLONG
  10614. *!
  10615. *!          Calls: CVTSHORT()         (function  in TRANSPRT.PRG)
  10616. *!
  10617. *!*****************************************************************************
  10618. FUNCTION cvtlong
  10619. PARAMETER m.itext, m.ioff
  10620. RETURN cvtshort(m.itext,m.ioff) + (65536 * cvtshort(m.itext,m.ioff+2))
  10621.  
  10622. *!*****************************************************************************
  10623. *!
  10624. *!       Function: CVTSHORT
  10625. *!
  10626. *!      Called by: GETOLDREPORTTYPE() (function  in TRANSPRT.PRG)
  10627. *!               : cvrtfbpRPT      (procedure in TRANSPRT.PRG)
  10628. *!               : CVTLONG()          (function  in TRANSPRT.PRG)
  10629. *!
  10630. *!          Calls: CVTBYTE()          (function  in TRANSPRT.PRG)
  10631. *!
  10632. *!*****************************************************************************
  10633. FUNCTION cvtshort
  10634. PARAMETER m.itext, m.ioff
  10635. RETURN cvtbyte(m.itext,m.ioff) + (256 * cvtbyte(m.itext,m.ioff+1))
  10636.  
  10637. *!*****************************************************************************
  10638. *!
  10639. *!       Function: CVTBYTE
  10640. *!
  10641. *!      Called by: cvrtfbpRPT      (procedure in TRANSPRT.PRG)
  10642. *!               : CVTSHORT()         (function  in TRANSPRT.PRG)
  10643. *!
  10644. *!*****************************************************************************
  10645. FUNCTION cvtbyte
  10646. PARAMETER m.itext, m.ioff
  10647. RETURN ASC(SUBSTR(m.itext,m.ioff+1,1))
  10648.  
  10649. *!*****************************************************************************
  10650. *!
  10651. *!       Function: OBJ2BASEFONT
  10652. *!
  10653. *!      Called by: FILLININFO         (procedure in TRANSPRT.PRG)
  10654. *!
  10655. *!*****************************************************************************
  10656. FUNCTION obj2basefont
  10657. PARAMETER m.mwidth, m.bfontface, m.bfontsize, m.bfontstyle, m.ofontface, ;
  10658.    m.ofontsize, m.ofontstyle
  10659. * Map a width from one font to another one
  10660. DO CASE
  10661. CASE m.g_char2grph
  10662.    RETURN m.mwidth * FONTMETRIC(6,m.ofontface,m.ofontsize,m.ofontstyle) ;
  10663.       / FONTMETRIC(6,m.bfontface,m.bfontsize,m.bfontstyle)
  10664. CASE m.g_grph2char AND UPPER(m.ofontface) == "MS SANS SERIF" AND ;
  10665.       UPPER(m.bfontface) == "MS SANS SERIF" AND ;
  10666.       m.ofontsize = m.bfontsize AND ;
  10667.       !("B" $ m.ofontstyle) AND ;
  10668.       "B" $ m.bfontstyle
  10669.    * We can't use FONTMETRIC on DOS, so we use heuristics instead.  Most
  10670.    * of the time we will be converting between MS Sans Serif 8 Bold and
  10671.    * MS Sans Serif Regular.  If that is the case here, use the 5/6 conversion
  10672.    * factor that is the relative widths of the chars in these two font styles.
  10673.    RETURN m.mwidth * 5/6
  10674. OTHERWISE
  10675.    RETURN m.mwidth
  10676. ENDCASE
  10677.  
  10678.  
  10679. *!*****************************************************************************
  10680. *!
  10681. *!       Function: VERSIONCAP
  10682. *!
  10683. *!      Called by: RDVALID()          (function  in TRANSPRT.PRG)
  10684. *!               : SELECTOBJ          (procedure in TRANSPRT.PRG)
  10685. *!
  10686. *!*****************************************************************************
  10687. FUNCTION versioncap
  10688. * Map a platform name ("DOS") to its descriptive equivalent ("MS-DOS")
  10689. PARAMETER m.strg
  10690. DO CASE
  10691. CASE strg = c_dosname
  10692.    RETURN "MS-DOS"
  10693. CASE strg = c_winname
  10694.    RETURN "Windows"
  10695. CASE strg = c_macname
  10696.    RETURN "Macintosh"
  10697. CASE strg = c_unixname
  10698.    RETURN c_unixname
  10699. OTHERWISE
  10700.    RETURN strg
  10701. ENDCASE
  10702.  
  10703.  
  10704. *!*****************************************************************************
  10705. *!
  10706. *!       Function: BLACKBOX
  10707. *!
  10708. *!*****************************************************************************
  10709. FUNCTION blackbox
  10710. PARAMETER otype , mred, mblue, mgreen, mpattern
  10711. * Is this a black box?
  10712. IF m.g_grph2char AND m.otype = c_otbox AND ;
  10713.       m.mred = 0 AND m.mblue = 0 AND m.mgreen = 0 ;
  10714.       AND m.mpattern = 0
  10715.    RETURN .T.
  10716. ELSE
  10717.    RETURN .F.
  10718. ENDIF
  10719.  
  10720. *!*****************************************************************************
  10721. *!
  10722. *!      Procedure: SELECTOBJ
  10723. *!
  10724. *!      Called by: GRAPHICTOCHAR      (procedure in TRANSPRT.PRG)
  10725. *!               : CHARTOGRAPHIC      (procedure in TRANSPRT.PRG)
  10726. *!
  10727. *!          Calls: INITSEL            (procedure in TRANSPRT.PRG)
  10728. *!               : ISOBJECT()         (function  in TRANSPRT.PRG)
  10729. *!               : ADDSEL             (procedure in TRANSPRT.PRG)
  10730. *!               : VERSIONCAP()       (function  in TRANSPRT.PRG)
  10731. *!               : TPSELECT           (procedure in TRANSPRT.PRG)
  10732. *!
  10733. *!           Uses: M.G_SCRNALIAS
  10734. *!
  10735. *!        Indexes: ID                     (tag)
  10736. *!
  10737. *!*****************************************************************************
  10738. PROCEDURE selectobj
  10739. * Figure out what to transport
  10740. DO initsel
  10741.  
  10742. IF m.g_snippets
  10743.    m.g_tempalias = "S" + SUBSTR(LOWER(SYS(3)),2,8)
  10744.    SELECT * FROM (m.g_scrnalias) ;
  10745.       WHERE !DELETED() AND platform = m.g_fromplatform ;
  10746.          AND oktransport(comment) ;
  10747.       INTO CURSOR (m.g_tempalias)
  10748.    IF _TALLY > 0
  10749.       INDEX ON uniqueid TAG id
  10750.  
  10751.       SELECT (m.g_scrnalias)
  10752.       SET RELATION TO uniqueid INTO (m.g_tempalias) ADDITIVE
  10753.       LOCATE FOR .T.
  10754.       DO CASE
  10755.       CASE m.g_filetype = c_screen
  10756.          SCAN FOR platform = m.g_toplatform ;
  10757.                AND (isobject(objtype) OR objtype = c_otheader OR objtype = c_otworkar) ;
  10758.                AND &g_tempalias..timestamp > timestamp
  10759.             DO addsel WITH "Upd"
  10760.          ENDSCAN
  10761.       CASE m.g_filetype = c_report
  10762.          SCAN FOR platform = m.g_toplatform AND ;
  10763.                INLIST(objtype,c_otheader,c_otfield,c_otpicture, ;
  10764.                  c_otrepfld,c_otband,c_otrepvar,c_ottext,c_otline,c_otbox,c_otworkar) ;
  10765.                AND &g_tempalias..timestamp > timestamp
  10766.             DO addsel WITH "Upd"
  10767.          ENDSCAN
  10768.       ENDCASE
  10769.       SELECT (m.g_tempalias)
  10770.       USE
  10771.    ENDIF
  10772.    SELECT (m.g_scrnalias)
  10773. ENDIF
  10774.  
  10775. IF m.g_newobjects
  10776.    m.junk = "S" + SUBSTR(LOWER(SYS(3)),2,8)
  10777.    DO CASE
  10778.    CASE m.g_char2grph
  10779.       SELECT * FROM (m.g_scrnalias) ;
  10780.          WHERE !DELETED() AND platform = m.g_fromplatform AND ;
  10781.          !(objtype = c_otfontdata) AND ;
  10782.          uniqueid NOT IN (SELECT uniqueid FROM (m.g_scrnalias) ;
  10783.          WHERE platform = m.g_toplatform) ;
  10784.             AND oktransport(comment) ;
  10785.          ORDER BY objtype ;
  10786.          INTO CURSOR (m.junk)
  10787.    CASE m.g_grph2char
  10788.       SELECT * FROM (m.g_scrnalias) ;
  10789.          WHERE !DELETED() AND platform = m.g_fromplatform AND ;
  10790.          !(objtype = c_otband AND INLIST(objcode,2,6)) AND ;
  10791.          !(objtype = c_otpicture) AND ;
  10792.          !(objtype = c_otfontdata) AND ;
  10793.          !blackbox(objtype,fillred,fillblue,fillgreen,fillpat) AND ;
  10794.          uniqueid NOT IN (SELECT uniqueid FROM (m.g_scrnalias) ;
  10795.          WHERE platform = m.g_toplatform) ;
  10796.             AND oktransport(comment) ;
  10797.          INTO CURSOR (m.junk)
  10798.    CASE m.g_grph2grph
  10799.       SELECT * FROM (m.g_scrnalias) ;
  10800.          WHERE !DELETED() AND platform = m.g_fromplatform AND ;
  10801.          uniqueid NOT IN (SELECT uniqueid FROM (m.g_scrnalias) ;
  10802.          WHERE platform = m.g_toplatform) ;
  10803.             AND oktransport(comment) ;
  10804.          ORDER BY objtype ;
  10805.          INTO CURSOR (m.junk)
  10806.    ENDCASE
  10807.    IF _TALLY > 0
  10808.       SCAN
  10809.          DO addsel WITH "New"
  10810.       ENDSCAN
  10811.       USE  && discard the cursor
  10812.    ENDIF
  10813. ENDIF
  10814.  
  10815. IF m.g_tpselcnt > 0   && This variable is incremented in addsel()
  10816.    m.tpcancel = 1
  10817.  
  10818.    IF !m.g_skipdlg
  10819.       * Prompt user to designate at any items he does not want transported
  10820.       DO tpselect WITH tparray, m.tpcancel,versioncap(m.g_fromplatform),versioncap(m.g_toplatform)
  10821.    ELSE
  10822.       m.tpcancel = 1   && pretend like the OK button was pressed
  10823.    ENDIF
  10824.  
  10825.    DO CASE
  10826.    CASE m.tpcancel = 1   && user pressed OK, so let's get to it.
  10827.    CASE m.tpcancel = 2   && user pressed "cancel" on the selection dialog.
  10828.       m.g_status = 3
  10829.       m.g_returncode = c_cancel
  10830.       RETURN TO transprt
  10831.    CASE m.tpcancel > 2
  10832.       * There aren't any objects that qualify for transporting.  User deselected all of them.
  10833.       * Pretend like we're done.
  10834.       m.g_status = 3
  10835.       m.g_returncode = c_yes
  10836.       RETURN TO transprt
  10837.    ENDCASE
  10838. ELSE
  10839.    * There aren't any objects that qualify for transporting.
  10840.    * Pretend like we're done.
  10841.    m.g_status = 3
  10842.    m.g_returncode = c_yes
  10843.    RETURN TO transprt
  10844. ENDIF
  10845.  
  10846. RETURN
  10847.  
  10848. *!*****************************************************************************
  10849. *!
  10850. *!      Procedure: INITSEL
  10851. *!
  10852. *!      Called by: SELECTOBJ          (procedure in TRANSPRT.PRG)
  10853. *!
  10854. *!*****************************************************************************
  10855. PROCEDURE initsel
  10856. * Initialize the tparray selection array
  10857. m.g_tpselcnt = 0
  10858. RETURN
  10859.  
  10860. *!*****************************************************************************
  10861. *!
  10862. *!      Procedure: ADDSEL
  10863. *!
  10864. *!      Called by: SELECTOBJ          (procedure in TRANSPRT.PRG)
  10865. *!
  10866. *!          Calls: ASSEMBLE()         (function  in TRANSPRT.PRG)
  10867. *!
  10868. *!*****************************************************************************
  10869. PROCEDURE addsel
  10870. PARAMETER STATUS
  10871. * Don't use RECCOUNT() here since the open "database" will often be a cursor.
  10872. IF _WINDOWS OR _MAC
  10873.    m.g_tpselcnt = m.g_tpselcnt + 1
  10874.    DIMENSION tparray[m.g_tpselcnt,3]
  10875.    tparray[m.g_tpselcnt,1] = m.g_checkmark+' '+assemble(STATUS)
  10876.    tparray[m.g_tpselcnt,2] = uniqueid
  10877.    tparray[m.g_tpselcnt,3] = objtype
  10878.  
  10879. ELSE
  10880.    m.g_tpselcnt = m.g_tpselcnt + 1
  10881.    DIMENSION tparray[m.g_tpselcnt,3]
  10882.    tparray[m.g_tpselcnt,1] = m.g_checkmark+' '+assemble(STATUS)
  10883.    tparray[m.g_tpselcnt,2] = uniqueid
  10884.    tparray[m.g_tpselcnt,3] = objtype
  10885. ENDIF
  10886. RETURN
  10887.  
  10888. *!*****************************************************************************
  10889. *!
  10890. *!       Function: ISSELECTED
  10891. *!
  10892. *!*****************************************************************************
  10893. FUNCTION isselected
  10894. * Returns .T. if this uniqueid passed in idnum corresponds to an item
  10895. * marked on the tparray list.
  10896. PARAMETER idnum,mobjtype, mobjcode
  10897. DO CASE
  10898. CASE m.mobjtype = c_otfontdata
  10899.    RETURN .T.
  10900. OTHERWISE
  10901.    m.pos = ASCAN(tparray,m.idnum)
  10902.    IF m.pos > 0
  10903.       * Check pos-1 since this is a two dimensional array.  ASCAN returns an element number
  10904.       * but we are really interested in the column before the one that the match took place in.
  10905.       RETURN IIF(LEFT(tparray[m.pos-1],1) <> ' ',.T.,.F.)
  10906.    ELSE
  10907.       RETURN .F.
  10908.    ENDIF
  10909. ENDCASE
  10910.  
  10911. *!*****************************************************************************
  10912. *!
  10913. *!       Function: ASSEMBLE
  10914. *!
  10915. *!      Called by: ADDSEL             (procedure in TRANSPRT.PRG)
  10916. *!
  10917. *!          Calls: TYPE2NAME()        (function  in TRANSPRT.PRG)
  10918. *!               : CLEANPICT()        (function  in TRANSPRT.PRG)
  10919. *!
  10920. *!*****************************************************************************
  10921. FUNCTION assemble
  10922. * Form the string used for user selection of objects to transport
  10923. PARAMETER statstrg
  10924. PRIVATE m.strg
  10925. DO CASE
  10926. CASE INLIST(objtype,c_ottxtbut,c_otradbut,c_otchkbox)
  10927.    m.strg = PADR(statstrg,5);
  10928.       + PADR(type2name(objtype),15) ;
  10929.       + PADR(name,15) ;
  10930.       + PADR(cleanpict(PICTURE),30)
  10931. CASE objtype = c_otfield AND EMPTY(name)    && it's a SAY expression
  10932.    m.strg = PADR(statstrg,5);
  10933.       + PADR(type2name(objtype),15) ;
  10934.       + PADR(expr,45)
  10935. CASE INLIST(objtype,c_otbox,c_otline)
  10936.    DO CASE
  10937.    CASE m.g_char2grph OR m.g_grph2grph
  10938.       m.strg = PADR(statstrg,5);
  10939.          + PADR(type2name(objtype),15) ;
  10940.          + PADR("",15) ;
  10941.          + PADR("From "+ALLTRIM(STR(vpos,3))+","+ALLTRIM(STR(hpos,3))+" to " ;
  10942.          + ALLTRIM(STR(vpos+HEIGHT,3))+","+ALLTRIM(STR(hpos+WIDTH,3)),45)
  10943.    CASE m.g_grph2char
  10944.       m.strg = PADR(statstrg,5);
  10945.          + PADR(type2name(objtype),15) ;
  10946.          + PADR("",15) ;
  10947.          + PADR("At: " ;
  10948.          + ALLTRIM(STR(ROUND(cvtreportvertical(vpos),0),3));
  10949.          + ",";
  10950.          + ALLTRIM(STR(ROUND(cvtreportvertical(hpos),0),3));
  10951.          + ", Height: ";
  10952.          + ALLTRIM(STR(ROUND(cvtreportvertical(height),0),3));
  10953.          + ", Width: " ;
  10954.          + ALLTRIM(STR(ROUND(cvtreportvertical(width),0),3)),45)
  10955.    ENDCASE
  10956. OTHERWISE
  10957.    m.strg = PADR(statstrg,5);
  10958.       + PADR(type2name(objtype),15) ;
  10959.       + PADR(name,15) ;
  10960.       + PADR(expr,30)
  10961. ENDCASE
  10962.  
  10963. IF _WINDOWS OR _MAC
  10964.    RETURN LEFT(m.strg,5) + ansitooem(RIGHT(m.strg,LEN(m.strg)-5))
  10965. ELSE
  10966.    RETURN m.strg
  10967. ENDIF
  10968. *!*****************************************************************************
  10969. *!
  10970. *!       Function: TYPE2NAME
  10971. *!
  10972. *!      Called by: ASSEMBLE()         (function  in TRANSPRT.PRG)
  10973. *!
  10974. *!*****************************************************************************
  10975. FUNCTION type2name
  10976. PARAMETER N
  10977. PRIVATE strg
  10978. DO CASE
  10979. CASE m.n = c_otheader
  10980.    m.strg = "Header"
  10981. CASE INLIST(m.n,c_otworkar,c_otindex,c_otrel)
  10982.    m.strg = "Environment"
  10983. CASE m.n = c_ottext
  10984.    m.strg = "Text"
  10985. CASE m.n = c_otline
  10986.    m.strg = "Line"
  10987. CASE m.n = c_otbox
  10988.    m.strg = "Box"
  10989. CASE m.n = c_otrepfld
  10990.    m.strg = "Report field"
  10991. CASE m.n = c_otband
  10992.    m.strg = "Band"
  10993. CASE m.n = c_otgroup
  10994.    m.strg = "Group"
  10995. CASE m.n = c_otlist
  10996.    m.strg = "List"
  10997. CASE m.n = c_ottxtbut
  10998.    m.strg = "Push button"
  10999. CASE m.n = c_otradbut
  11000.    m.strg = "Radio button"
  11001. CASE m.n = c_otchkbox
  11002.    m.strg = "Check box"
  11003. CASE m.n = c_otfield
  11004.    DO CASE
  11005.    CASE EMPTY(name)
  11006.       IF !EMPTY(expr)
  11007.          m.strg = "SAY Expression"
  11008.       ELSE
  11009.          m.strg = "Field"
  11010.       ENDIF
  11011.    CASE EMPTY(expr)
  11012.       m.strg = "GET Field"
  11013.    OTHERWISE
  11014.       m.strg = "Field"
  11015.    ENDCASE
  11016. CASE m.n = c_otpopup
  11017.    m.strg = "Popup"
  11018. CASE m.n = c_otpicture
  11019.    m.strg = "Picture"
  11020. CASE m.n = c_otrepvar
  11021.    m.strg = "Rpt variable"
  11022. CASE m.n = c_otinvbut
  11023.    m.strg = "Inv button"
  11024. CASE m.n = c_otspinner
  11025.    m.strg = "Spinner"
  11026. CASE m.n = c_otpdset
  11027.    m.strg = "Printer driver"
  11028. CASE m.n = c_otfontdata
  11029.    m.strg = "Font data"
  11030. OTHERWISE
  11031.    m.strg = STR(objtype,4)
  11032. ENDCASE
  11033.  
  11034. RETURN m.strg
  11035.  
  11036.  
  11037. *!*****************************************************************************
  11038. *!
  11039. *!       Function: CLEANPICT
  11040. *!
  11041. *!      Called by: ASSEMBLE()         (function  in TRANSPRT.PRG)
  11042. *!
  11043. *!*****************************************************************************
  11044. FUNCTION cleanpict
  11045. PARAMETER m.strg
  11046. PRIVATE m.atsign
  11047.  
  11048. * Drop quotation marks
  11049. IF AT(LEFT(m.strg,1),CHR(34)+CHR(39)) > 0
  11050.    m.strg = SUBSTR(m.strg,2)
  11051. ENDIF
  11052. IF AT(RIGHT(m.strg,1),CHR(34)+CHR(39)) > 0
  11053.    m.strg = SUBSTR(m.strg,1,LEN(m.strg)-1)
  11054. ENDIF
  11055.  
  11056. m.atsign = AT("@",m.strg)
  11057. IF m.atsign > 0
  11058.    m.strg = LTRIM(SUBSTR(m.strg,m.atsign+AT(' ',SUBSTR(m.strg,m.atsign))))
  11059. ENDIF
  11060.  
  11061. IF LEN(m.strg) > 30
  11062.    m.strg = LEFT(m.strg,27) + '...'
  11063. ENDIF
  11064. RETURN m.strg
  11065.  
  11066.  
  11067. *!*****************************************************************************
  11068. *!
  11069. *!      Procedure: TPSELECT
  11070. *!
  11071. *!      Called by: SELECTOBJ          (procedure in TRANSPRT.PRG)
  11072. *!
  11073. *!          Calls: TOGGLE()           (function  in TRANSPRT.PRG)
  11074. *!               : OKVALID()          (function  in TRANSPRT.PRG)
  11075. *!               : WREADDEAC()        (function  in TRANSPRT.PRG)
  11076. *!
  11077. *!*****************************************************************************
  11078. PROCEDURE tpselect
  11079. PARAMETERS tparray, tpcancel, fromplat,toplat
  11080. DO CASE
  11081. CASE m.g_snippets AND m.g_newobjects
  11082.    ptext = "These objects are either new to the "+m.toplat+" platform or have "+;
  11083.       "been modified more recently on "+m.fromplat+"."
  11084. CASE m.g_newobjects
  11085.    ptext = "These objects are new to "+m.toplat+"."
  11086. CASE m.g_snippets
  11087.    ptext = "These objects have been modified more recently on "+m.fromplat+"."
  11088. ENDCASE
  11089.  
  11090. DO CASE
  11091. CASE _WINDOWS
  11092.    IF NOT WEXIST("tpselect")
  11093.       DEFINE WINDOW tpselect ;
  11094.          AT  0.000, 0.000  ;
  11095.          SIZE 25.538,116.000 ;
  11096.          TITLE "FoxPro Transporter" ;
  11097.          FONT m.g_smface, m.g_smsize ;
  11098.          FLOAT ;
  11099.          CLOSE ;
  11100.          NOMINIMIZE ;
  11101.          DOUBLE
  11102.       MOVE WINDOW tpselect CENTER
  11103.    ENDIF
  11104.    IF WVISIBLE("tpselect")
  11105.       ACTIVATE WINDOW tpselect SAME
  11106.    ELSE
  11107.       ACTIVATE WINDOW tpselect NOSHOW
  11108.    ENDIF
  11109.    @ 6.769,2.400 TO 8.154,113.000 ;
  11110.       PATTERN 1 ;
  11111.       PEN 1, 8 ;
  11112.       COLOR RGB(,,,192,192,192)
  11113.    @ 8.154,2.600 GET xsel ;
  11114.       PICTURE "@&N" ;
  11115.       FROM tparray ;
  11116.       SIZE 17.500,68.875 ;
  11117.       DEFAULT 1 ;
  11118.       FONT m.g_foxfont, m.g_foxfsize ;
  11119.       VALID toggle()
  11120.    @ 1.462,3.000 SAY ptext ;
  11121.       SIZE 4.000,33.833 ;
  11122.       FONT m.g_smface, m.g_smsize ;
  11123.       STYLE "B"
  11124.    @ 1.462,50.400 SAY "Uncheck any items you do" ;
  11125.       SIZE 1.000,28.000, 0.000 ;
  11126.       FONT m.g_smface, m.g_smsize ;
  11127.       STYLE "BT"
  11128.    @ 2.385,50.200 SAY "not" ;
  11129.       SIZE 1.000,4.167, 0.000 ;
  11130.       FONT m.g_smface, m.g_smsize ;
  11131.       STYLE "BIT"
  11132.    @ 2.385,55.000 SAY "want to be transported." ;
  11133.       SIZE 1.000,27.000, 0.000 ;
  11134.       FONT m.g_smface, m.g_smsize ;
  11135.       STYLE "BT"
  11136.    @ 0.923,93.600 GET tpcancel ;
  11137.       PICTURE "@*VT \!\<OK;\?\<Cancel" ;
  11138.       SIZE 1.846,16.333,0.308 ;
  11139.       DEFAULT 1 ;
  11140.       FONT m.g_tdlgface, m.g_tdlgsize ;
  11141.       STYLE m.g_tdlgstyle ;
  11142.       VALID okvalid()
  11143.    @ 6.923,5.800 SAY "Stat" ;
  11144.       SIZE 1.000,5.000, 0.000 ;
  11145.       FONT m.g_smface, m.g_smsize ;
  11146.       STYLE "BT"
  11147.    @ 6.923,14.000 SAY "Type" ;
  11148.       SIZE 1.000,6.000, 0.000 ;
  11149.       FONT m.g_smface, m.g_smsize ;
  11150.       STYLE "BT"
  11151.    @ 6.923,38.200 SAY "Variable" ;
  11152.       SIZE 1.000,10.000, 0.000 ;
  11153.       FONT m.g_smface, m.g_smsize ;
  11154.       STYLE "BT"
  11155.    @ 6.923,62.000 SAY "Expression/Prompt" ;
  11156.       SIZE 1.000,25.000, 0.000 ;
  11157.       FONT m.g_smface, m.g_smsize ;
  11158.       STYLE "BT"
  11159.  
  11160.    IF NOT WVISIBLE("tpselect")
  11161.       ACTIVATE WINDOW tpselect
  11162.    ENDIF
  11163.  
  11164.    READ CYCLE;
  11165.       MODAL;
  11166.       DEACTIVATE wreaddeac()
  11167.  
  11168.    RELEASE WINDOW tpselect
  11169. CASE _MAC
  11170.    IF NOT WEXIST("tpselect")
  11171.       DEFINE WINDOW tpselect ;
  11172.          AT  0.000, 0.000  ;
  11173.          SIZE 25.538,100.000 ;
  11174.          TITLE "FoxPro Transporter" ;
  11175.          FONT "Geneva",9 ;
  11176.             STYLE "" ;
  11177.          FLOAT ;
  11178.          CLOSE ;
  11179.          NOMINIMIZE ;
  11180.          DOUBLE
  11181.       MOVE WINDOW tpselect CENTER
  11182.    ENDIF
  11183.    IF WVISIBLE("tpselect")
  11184.       ACTIVATE WINDOW tpselect SAME
  11185.    ELSE
  11186.       ACTIVATE WINDOW tpselect NOSHOW
  11187.    ENDIF
  11188.    *@ 6.769,2.400 TO 8.154,97.800 ;
  11189.    *   PATTERN 1 ;
  11190.    *   PEN 1, 8 ;
  11191.    *   COLOR RGB(,,,192,192,192)
  11192.    @ 8.154,2.600 GET xsel ;
  11193.       PICTURE "@&N" ;
  11194.       FROM tparray ;
  11195.       SIZE 16.000,78.875 ;
  11196.       DEFAULT 1 ;
  11197.       FONT m.g_foxfont, m.g_foxfsize ;
  11198.       VALID toggle()
  11199.    @ 1.462,3.000 SAY ptext ;
  11200.       SIZE 4.000,33.833 ;
  11201.       FONT "Geneva", 9 ;
  11202.       STYLE m.g_smsty1
  11203.    @ 1.462,50.400 SAY "Uncheck any items you do" ;
  11204.       SIZE 1.000,28.000, 0.000 ;
  11205.       FONT "Geneva", 9 ;
  11206.       STYLE ""
  11207.    @ 2.385,50.200 SAY "not" ;
  11208.       SIZE 1.000,4.167, 0.000 ;
  11209.       FONT "Geneva", 9 ;
  11210.       STYLE ""+"I"
  11211.    @ 2.385,54.000 SAY "want to be transported." ;
  11212.       SIZE 1.000,27.000, 0.000 ;
  11213.       FONT "Geneva", 9 ;
  11214.       STYLE ""
  11215.    @ 0.923,83.600 GET tpcancel ;
  11216.       PICTURE "@*VT \!\<OK;\?\<Cancel" ;
  11217.       SIZE m.g_tdlgbtn,10.000,0.500 ;
  11218.       DEFAULT 1 ;
  11219.       FONT m.g_tdlgface, m.g_tdlgsize ;
  11220.       STYLE m.g_tdlgstyle ;
  11221.       VALID okvalid()
  11222.    @ 6.923,5.550 SAY "Stat" ;
  11223.       SIZE 1.000,5.000, 0.000 ;
  11224.       FONT "Geneva", 9 ;
  11225.       STYLE "TB"
  11226.    @ 6.923,11.500 SAY "Type" ;
  11227.       SIZE 1.000,5.500, 0.000 ;
  11228.       FONT "Geneva", 9 ;
  11229.       STYLE "TB"
  11230.    @ 6.923,29.200 SAY "Variable" ;
  11231.       SIZE 1.000,10.000, 0.000 ;
  11232.       FONT "Geneva", 9 ;
  11233.       STYLE "TB"
  11234.    @ 6.923,47.500 SAY "Expression/Prompt" ;
  11235.       SIZE 1.000,25.000, 0.000 ;
  11236.       FONT "Geneva", 9 ;
  11237.       STYLE "TB"
  11238.  
  11239.    IF NOT WVISIBLE("tpselect")
  11240.       ACTIVATE WINDOW tpselect
  11241.    ENDIF
  11242.  
  11243.    READ CYCLE;
  11244.       MODAL;
  11245.       DEACTIVATE wreaddeac()
  11246.  
  11247.    RELEASE WINDOW tpselect
  11248. CASE _DOS
  11249.    IF NOT WEXIST("tpselect")
  11250.       DEFINE WINDOW tpselect ;
  11251.          FROM INT((SROW()-23)/2),INT((SCOL()-77)/2) ;
  11252.          TO INT((SROW()-23)/2)+22,INT((SCOL()-77)/2)+76 ;
  11253.          TITLE "FoxPro Transporter" ;
  11254.          FLOAT ;
  11255.          CLOSE ;
  11256.          NOMINIMIZE ;
  11257.          DOUBLE ;
  11258.          COLOR SCHEME 5
  11259.    ENDIF
  11260.    IF WVISIBLE("tpselect")
  11261.       ACTIVATE WINDOW tpselect SAME
  11262.    ELSE
  11263.       ACTIVATE WINDOW tpselect NOSHOW
  11264.    ENDIF
  11265.    @ 0,0 CLEAR
  11266.    @ 8,1 GET xsel ;
  11267.       PICTURE "@&N" ;
  11268.       FROM tparray ;
  11269.       SIZE 13,72 ;
  11270.       DEFAULT 1 ;
  11271.       VALID toggle() ;
  11272.       COLOR SCHEME 6
  11273.    @ 1,30 SAY "Uncheck any items you do" ;
  11274.       SIZE 1,24, 0
  11275.    @ 2,30 SAY "not" ;
  11276.       SIZE 1,3, 0
  11277.    @ 2,34 SAY "want to be transported." ;
  11278.       SIZE 1,23, 0
  11279.    @ 1,62 GET tpcancel ;
  11280.       PICTURE "@*VT \!\<OK;\?\<Cancel" ;
  11281.       SIZE 1,10,0 ;
  11282.       DEFAULT 1 ;
  11283.       VALID okvalid()
  11284.    @ 7,10 SAY "Type" ;
  11285.       SIZE 1,4, 0
  11286.    @ 7,40 SAY "Expression/Prompt" ;
  11287.       SIZE 1,17, 0
  11288.    @ 7,25 SAY "Variable" ;
  11289.       SIZE 1,8, 0
  11290.    @ 7,5 SAY "Stat" ;
  11291.       SIZE 1,4, 0
  11292.    @ 1,2 SAY ptext ;
  11293.       SIZE 5,26
  11294.  
  11295.    IF NOT WVISIBLE("tpselect")
  11296.       ACTIVATE WINDOW tpselect
  11297.    ENDIF
  11298.  
  11299.    READ CYCLE ;
  11300.       MODAL ;
  11301.       DEACTIVATE wreaddeac()
  11302.  
  11303.    RELEASE WINDOW tpselect
  11304. ENDCASE
  11305.  
  11306. *!*****************************************************************************
  11307. *!
  11308. *!       Function: TOGGLE
  11309. *!
  11310. *!      Called by: TPSELECT           (procedure in TRANSPRT.PRG)
  11311. *!
  11312. *!*****************************************************************************
  11313. FUNCTION toggle
  11314. * Toggle mark
  11315. IF LEFT(tparray[xsel,1],1) <> ' '
  11316.    tparray[xsel,1] = STUFF(tparray[xsel,1],1,1,' ')
  11317. ELSE
  11318.    tparray[xsel,1] = STUFF(tparray[xsel,1],1,1,m.g_checkmark)
  11319. ENDIF
  11320. SHOW GETS
  11321. RETURN .F.
  11322.  
  11323. *!*****************************************************************************
  11324. *!
  11325. *!       Function: OKVALID
  11326. *!
  11327. *!      Called by: TPSELECT           (procedure in TRANSPRT.PRG)
  11328. *!
  11329. *!*****************************************************************************
  11330. FUNCTION okvalid
  11331. * Simulate a cancel if no objects were selected.
  11332. IF tpcancel = 1
  11333.    PRIVATE m.i
  11334.    m.cnt = 0
  11335.    FOR m.i = 1 TO m.g_tpselcnt
  11336.       IF LEFT(tparray[m.i,1],1) <> ' '
  11337.          m.cnt = m.cnt + 1
  11338.       ENDIF
  11339.    ENDFOR
  11340.    IF m.cnt = 0
  11341.       m.tpcancel = 3   && code that means, "just open as is."
  11342.    ENDIF
  11343. ENDIF
  11344.  
  11345. *!*****************************************************************************
  11346. *!
  11347. *!       Function: WREADDEAC
  11348. *!
  11349. *!      Called by: TPSELECT           (procedure in TRANSPRT.PRG)
  11350. *!
  11351. *!*****************************************************************************
  11352. FUNCTION wreaddeac
  11353. *
  11354. * Deactivate Code from screen: TP
  11355. *
  11356. CLEAR READ
  11357.  
  11358. *!*****************************************************************************
  11359. *!
  11360. *!       Function: EnvSelect
  11361. *!
  11362. *!*****************************************************************************
  11363. FUNCTION EnvSelect
  11364. PRIVATE m.i
  11365. * Was an environment record selected for transport?
  11366. FOR m.i = 1 TO m.g_tpselcnt
  11367.    IF IsEnviron(tparray[m.i,3]) AND LEFT(tparray[m.i,1],1) <> " "
  11368.       RETURN .T.
  11369.    ENDIF
  11370. ENDFOR
  11371. RETURN .F.
  11372.  
  11373. *!*****************************************************************************
  11374. *!
  11375. *!       Function: OutputOrd
  11376. *!
  11377. *!*****************************************************************************
  11378. FUNCTION outputord
  11379. PARAMETER m.otype, m.rno
  11380. * Function to sort screen and report files.  We want the header and environment
  11381. * records to be at the "top" of the platform, and other records to be in their
  11382. * original order.
  11383. IF objtype <= 4
  11384.    RETURN STR(m.otype,3)+STR(m.rno,3)
  11385. ELSE
  11386.    RETURN STR(m.rno,3)+STR(m.otype,3)
  11387. ENDIF
  11388.  
  11389. *!*****************************************************************************
  11390. *!
  11391. *!       Procedure: PUTWINMSG
  11392. *!
  11393. *!*****************************************************************************
  11394. PROCEDURE putwinmsg
  11395. PARAMETER m.msg
  11396. IF _WINDOWS OR _MAC
  11397.    SET MESSAGE TO m.msg
  11398. ENDIF
  11399.  
  11400. *
  11401. * SETALL - Create program's environment.
  11402. *
  11403. * Description:
  11404. * Save the user's environment that is being modified by the GENSCRN,
  11405. * then issue various SET commands.
  11406. *
  11407. *!*****************************************************************************
  11408. *!
  11409. *!      Procedure: SETALL
  11410. *!
  11411. *!      Called by: TRANSPRT.PRG
  11412. *!
  11413. *!          Calls: ESCHANDLER         (procedure in TRANSPRT.PRG)
  11414. *!
  11415. *!*****************************************************************************
  11416. PROCEDURE setall
  11417.  
  11418. CLEAR PROGRAM
  11419. CLEAR GETS
  11420.  
  11421. m.escape = SET("ESCAPE")
  11422. SET ESCAPE ON
  11423.  
  11424. m.onescape = ON("ESCAPE")
  11425. ON ESCAPE DO eschandler
  11426.  
  11427. *SET ESCAPE OFF
  11428. m.trbetween = SET("TRBET")
  11429. SET TRBET OFF
  11430. m.comp = SET("COMPATIBLE")
  11431. SET COMPATIBLE FOXPLUS
  11432. m.device = SET("DEVICE")
  11433. SET DEVICE TO SCREEN
  11434.  
  11435. m.rbord = SET("READBORDER")
  11436. SET READBORDER ON
  11437.  
  11438. m.status = SET("STATUS")
  11439. *SET STATUS OFF
  11440.  
  11441. m.currarea = SELECT()
  11442.  
  11443. m.udfparms = SET('UDFPARMS')
  11444. SET UDFPARMS TO VALUE
  11445.  
  11446. m.mtopic = SET("TOPIC")
  11447. IF SET("HELP") = "ON"
  11448.    DO CASE
  11449.    CASE ATC(".DBF",SET("HELP",1)) > 0
  11450.       SET TOPIC TO CHR(254)+" Transporter"
  11451.       ON KEY LABEL F1 HELP ■ Transporter
  11452.    CASE ATC(".HLP",SET("HELP",1)) > 0
  11453.       SET TOPIC TO Transporter Dialog
  11454.       ON KEY LABEL F1 HELP Transporter Dialog
  11455.    ENDCASE
  11456. ENDIF
  11457.  
  11458. m.mfieldsto = SET("FIELDS",1)
  11459. m.fields = SET("FIELDS")
  11460. SET FIELDS TO
  11461. SET FIELDS OFF
  11462.  
  11463. m.memowidth = SET("MEMOWIDTH")
  11464. SET MEMOWIDTH TO 256
  11465.  
  11466. m.cursor = SET("CURSOR")
  11467. SET CURSOR OFF
  11468.  
  11469. m.consol = SET("CONSOLE")
  11470. SET CONSOLE OFF
  11471.  
  11472. m.bell = SET("BELL")
  11473. SET BELL OFF
  11474.  
  11475. m.exact = SET("EXACT")
  11476. SET EXACT ON
  11477.  
  11478. m.deci = SET("DECIMALS")
  11479. SET DECIMALS TO 10
  11480.  
  11481. m.fixed = SET("FIXED")
  11482. SET FIXED ON
  11483.  
  11484. m.print = SET("PRINT")
  11485. SET PRINT OFF
  11486.  
  11487. m.unqset = SET("UNIQUE")
  11488. SET UNIQUE OFF
  11489.  
  11490. m.safety = SET("SAFETY")
  11491. SET SAFETY OFF
  11492.  
  11493. m.exclusive = SET("EXCLUSIVE")
  11494. SET EXCLUSIVE ON
  11495.  
  11496. IF versnum() > "2.5"
  11497.    m.mcollate = SET("COLLATE")
  11498.    SET COLLATE TO "machine"
  11499. ENDIF
  11500.  
  11501. #if "MAC" $ UPPER(VERSION(1))
  11502.    IF _MAC
  11503.       m.mmacdesk = SET("MACDESKTOP")
  11504.       SET MACDESKTOP ON
  11505.    ENDIF
  11506. #endif
  11507.  
  11508. *
  11509. * CLEANUP - Restore environment to pre-execution state.
  11510. *
  11511. * Description:
  11512. * Put SET command settings back the way we found them.
  11513. *
  11514. *!*****************************************************************************
  11515. *!
  11516. *!      Procedure: CLEANUP
  11517. *!
  11518. *!      Called by: TRANSPRT.PRG
  11519. *!               : ERRORHANDLER       (procedure in TRANSPRT.PRG)
  11520. *!               : CONVERTTYPE()      (function  in TRANSPRT.PRG)
  11521. *!               : ESCHANDLER         (procedure in TRANSPRT.PRG)
  11522. *!
  11523. *!          Calls: WRITERESULT        (procedure in TRANSPRT.PRG)
  11524. *!               : DEACTTHERM         (procedure in TRANSPRT.PRG)
  11525. *!
  11526. *!*****************************************************************************
  11527. PROCEDURE cleanup
  11528.  
  11529. PARAMETER m.cancafter
  11530. IF PARAMETERS() = 0
  11531.    m.cancafter = .F.
  11532. ENDIF
  11533. IF NOT EMPTY(m.g_20alias)
  11534.    IF m.g_status != 0
  11535.       IF USED(m.g_tempalias)
  11536.          SELECT (m.g_tempalias)
  11537.          USE
  11538.       ENDIF
  11539.       IF USED(m.g_fromobjonlyalias)
  11540.          SELECT (m.g_fromobjonlyalias)
  11541.          USE
  11542.       ENDIF
  11543.       IF USED(m.g_boxeditemsalias)
  11544.          SELECT (m.g_boxeditemsalias)
  11545.          USE
  11546.       ENDIF
  11547.       SELECT (m.g_20alias)
  11548.       USE
  11549.       SELECT (m.g_scrnalias)
  11550.    ELSE
  11551.       DO writeresult   && updates thermometer too
  11552.    ENDIF
  11553. ENDIF
  11554.  
  11555. ON ERROR &onerror
  11556. ON ESCAPE &onescape
  11557.  
  11558. IF m.consol = "ON"
  11559.    SET CONSOLE ON
  11560. ELSE
  11561.    SET CONSOLE OFF
  11562. ENDIF
  11563.  
  11564. IF m.escape = "ON"
  11565.    SET ESCAPE ON
  11566. ELSE
  11567.    SET ESCAPE OFF
  11568. ENDIF
  11569.  
  11570. IF m.bell = "ON"
  11571.    SET BELL ON
  11572. ELSE
  11573.    SET BELL OFF
  11574. ENDIF
  11575.  
  11576. SET FIELDS TO &mfieldsto
  11577. IF m.fields = "ON"
  11578.        SET FIELDS ON
  11579. ELSE
  11580.        SET FIELDS OFF
  11581. ENDIF
  11582.  
  11583. IF m.exact = "ON"
  11584.    SET EXACT ON
  11585. ELSE
  11586.    SET EXACT OFF
  11587. ENDIF
  11588.  
  11589. IF m.comp = "ON"
  11590.    SET COMPATIBLE ON
  11591. ENDIF
  11592.  
  11593. IF m.print = "ON"
  11594.    SET PRINT ON
  11595. ENDIF
  11596.  
  11597. IF m.fixed = "OFF"
  11598.    SET FIXED OFF
  11599. ENDIF
  11600.  
  11601. IF m.trbetween = "ON"
  11602.    SET TRBET ON
  11603. ENDIF
  11604.  
  11605. IF m.unqset = "ON"
  11606.    SET UNIQUE ON
  11607. ENDIF
  11608.  
  11609. IF m.rbord = "OFF"
  11610.    SET READBORDER OFF
  11611. ENDIF
  11612.  
  11613. IF m.status = "ON"
  11614.    SET STATUS ON
  11615. ENDIF
  11616.  
  11617. SET DECIMALS TO m.deci
  11618. SET MEMOWIDTH TO m.memowidth
  11619. SET DEVICE TO &device
  11620. SET UDFPARMS TO &udfparms
  11621. SET TOPIC TO &mtopic
  11622.  
  11623. IF versnum() > "2.5"
  11624.    SET COLLATE TO "&mcollate"
  11625. ENDIF
  11626.  
  11627. #if "MAC" $ UPPER(VERSION(1))
  11628.    IF _MAC
  11629.       SET MACDESKTOP &mmacdesk
  11630.     ENDIF
  11631. #endif
  11632.  
  11633. ON KEY LABEL F1
  11634. POP KEY
  11635.  
  11636. USE
  11637. DELETE FILE (m.g_tempindex)
  11638. SET MESSAGE TO
  11639.  
  11640. SELECT (m.currarea)
  11641.  
  11642. DO deacttherm
  11643.  
  11644. IF m.cursor = "ON"
  11645.    SET CURSOR ON
  11646. ELSE
  11647.    SET CURSOR OFF
  11648. ENDIF
  11649.  
  11650. IF m.safety = "ON"
  11651.    SET SAFETY ON
  11652. ENDIF
  11653.  
  11654. IF m.talkset = "ON"
  11655.    SET TALK ON
  11656. ENDIF
  11657.  
  11658. IF m.exclusive = "ON"
  11659.    SET EXCLUSIVE ON
  11660. ELSE
  11661.    SET EXCLUSIVE OFF
  11662. ENDIF
  11663. IF m.talkset = "ON"
  11664.    SET TALK ON
  11665. ENDIF
  11666.  
  11667. IF m.cancafter
  11668.    CANCEL
  11669. ENDIF
  11670.  
  11671. *
  11672. * WRITERESULT - Writes the converted cursor to the SCX/FRX/LBX/whatever.  The point of this is that we
  11673. *      need to write the records in their original order so we don't mees up any groups.  We also need
  11674. *      to keep records for a given platform contiguous.
  11675. *
  11676. *!*****************************************************************************
  11677. *!
  11678. *!      Procedure: WRITERESULT
  11679. *!
  11680. *!      Called by: CLEANUP            (procedure in TRANSPRT.PRG)
  11681. *!
  11682. *!          Calls: DOCREATE           (procedure in TRANSPRT.PRG)
  11683. *!               : UPDTHERM           (procedure in TRANSPRT.PRG)
  11684. *!
  11685. *!           Uses: M.G_SCRNALIAS
  11686. *!
  11687. *!        Indexes: TEMP                   (tag)
  11688. *!
  11689. *!*****************************************************************************
  11690. PROCEDURE writeresult
  11691. PRIVATE m.platforms, m.loop, m.thermstep
  11692.  
  11693. IF g_filetype = c_project
  11694.    SELECT (m.g_20alias)        && Close the database so we can replace it.
  11695.    USE
  11696.  
  11697.    SELECT (m.g_scrnalias)      && Copy the temporary cursor to the database and
  11698.    COPY TO (m.g_scrndbf)       &&      get rid of the cursor
  11699.    USE
  11700.    DO updtherm WITH 100
  11701. ELSE
  11702.    REPLACE ALL platform WITH UPPER(platform)
  11703.  
  11704.    * Get a list of the platforms we need to write.
  11705.    SELECT DISTINCT platform ;
  11706.       FROM (m.g_scrnalias) ;
  11707.       WHERE !DELETED() ;
  11708.       INTO ARRAY plist
  11709.    m.platforms = _TALLY
  11710.  
  11711.    * The following select creates a new cursor with the desired structure.  We write
  11712.    * into this and then dump the cursor to disk.  It's a bit cumbersome, but reduces
  11713.    * the chances of frying the original file.
  11714.    m.g_tempalias = "S"+SUBSTR(LOWER(SYS(3)),2,8)
  11715.    DO docreate WITH m.g_tempalias, m.g_filetype
  11716.  
  11717.    * We need to write DOS/UNIX label records in the order we want the objects to appear.
  11718.    * So, we create this index and set order to it when we want to write those records.
  11719.    IF m.g_filetype = c_label
  11720.       SELECT (m.g_scrnalias)
  11721.       INDEX ON platform + ;
  11722.          IIF(objtype = c_ot20label,CHR(1)+CHR(1), STR(objtype,2)) + ;
  11723.          STR(objcode,2) + ;
  11724.          STR(vpos,3) TAG temp
  11725.    ENDIF
  11726.  
  11727.    IF m.g_updenviron
  11728.       SELECT (m.g_scrnalias)
  11729.       INDEX ON outputord(objtype,recno()) TAG temp1
  11730.    ENDIF
  11731.  
  11732.    SELECT (m.g_scrnalias)
  11733.    IF RECCOUNT() > 0
  11734.       m.thermstep = (100 - m.g_mercury)/RECCOUNT()
  11735.    ELSE
  11736.       m.thermstep = 0
  11737.    ENDIF
  11738.  
  11739.    * Write the records for each platform.
  11740.    FOR m.loop = 1 TO m.platforms
  11741.       SELECT (m.g_scrnalias)
  11742.  
  11743.       DO CASE
  11744.       CASE m.g_filetype = c_label
  11745.          SET ORDER TO TAG temp
  11746.       CASE m.g_updenviron
  11747.          SET ORDER TO TAG temp1
  11748.       OTHERWISE
  11749.          SET ORDER TO
  11750.       ENDCASE
  11751.  
  11752.       SCAN FOR platform = plist[m.loop] AND !DELETED()
  11753.          SCATTER MEMVAR MEMO
  11754.          SELECT (m.g_tempalias)
  11755.          APPEND BLANK
  11756.          GATHER MEMVAR MEMO
  11757.          SELECT (m.g_scrnalias)
  11758.  
  11759.          m.g_mercury = MIN(m.g_mercury + m.thermstep, 100)
  11760.          DO updtherm WITH m.g_mercury
  11761.       ENDSCAN
  11762.    ENDFOR
  11763.  
  11764.    SELECT (m.g_20alias)        && Close the database so we can replace it.
  11765.    USE
  11766.  
  11767.    SELECT (m.g_tempalias)      && Copy the temporary cursor to the database and
  11768.    COPY TO (m.g_scrndbf)       &&      get rid of the cursor
  11769.    USE
  11770.  
  11771.    SELECT (m.g_scrnalias)      && Get rid of the master cursor
  11772.    USE
  11773.  
  11774.    DO updtherm WITH 100
  11775. ENDIF
  11776. *!*****************************************************************************
  11777. *!
  11778. *!      Function: VERSNUM
  11779. *!
  11780. *!*****************************************************************************
  11781. FUNCTION versnum
  11782. * Return string corresponding to FoxPro version number
  11783. RETURN wordnum(vers(),2)
  11784.  
  11785. *!*****************************************************************************
  11786. *!
  11787. *!      Function: CPTRANS
  11788. *!
  11789. *!*****************************************************************************
  11790. FUNCTION cptrans
  11791. * Translate from one codepage to another, if translation is in effect.  Note that
  11792. * this function takes parameters in a different order than CPCONVERT.
  11793. PARAMETER m.tocp, m.fromcp, m.strg
  11794. IF c_cptrans AND versnum() > "2.5"
  11795.    RETURN CPCONVERT(m.fromcp, m.tocp, m.strg)
  11796. ELSE
  11797.    RETURN m.strg
  11798. ENDIF
  11799. *!*****************************************************************************
  11800. *!
  11801. *!      Function: CPTCOND
  11802. *!
  11803. *!*****************************************************************************
  11804. FUNCTION cptcond
  11805. * Conditionally translate from one codepage to another, if translation is in effect.
  11806. * Note that this function takes parameters in a different order than CPCONVERT.
  11807. * Only translate if the current database isn't already the tocp.
  11808. PARAMETER m.tocp, m.fromcp, m.strg
  11809. IF c_cptrans AND cpdbf() <> m.tocp AND versnum() > "2.5"
  11810.    RETURN CPCONVERT(m.fromcp, m.tocp, m.strg)
  11811. ELSE
  11812.    RETURN m.strg
  11813. ENDIF
  11814.  
  11815. *!*****************************************************************************
  11816. *!
  11817. *!      Function: setfromcp
  11818. *!
  11819. *!*****************************************************************************
  11820. FUNCTION setfromcp
  11821. PARAMETER m.plat
  11822. DO CASE
  11823. CASE m.plat = c_dosname
  11824.    RETURN c_doscp
  11825. CASE m.plat = c_winname
  11826.    RETURN c_wincp
  11827. CASE m.plat = c_macname
  11828.    RETURN c_maccp
  11829. CASE m.plat = c_unixname
  11830.    RETURN c_unixcp
  11831. OTHERWISE
  11832.    RETURN c_doscp
  11833. ENDCASE
  11834.  
  11835. *!*****************************************************************************
  11836. *!
  11837. *!      Function: oktransport
  11838. *!
  11839. *!*****************************************************************************
  11840. FUNCTION oktransport
  11841. PARAMETER strg
  11842. DIMENSION plat_arry[4]
  11843. #DEFINE dos_code  1
  11844. #DEFINE win_code  2
  11845. #DEFINE mac_code  3
  11846. #DEFINE unix_code 4
  11847. plat_arry = 0
  11848. IF ATC("#DOSOBJ",m.strg) > 0
  11849.    plat_arry[dos_code] = 1
  11850. ENDIF
  11851. IF ATC("#WINOBJ",m.strg) > 0
  11852.    plat_arry[win_code] = 1
  11853. ENDIF
  11854. IF ATC("#MACOBJ",m.strg) > 0
  11855.    plat_arry[mac_code] = 1
  11856. ENDIF
  11857. IF ATC("#UNIXOBJ",m.strg) > 0
  11858.    plat_arry[unix_code] = 1
  11859. ENDIF
  11860.  
  11861. * If no platform-specific designations found, transport anywhere
  11862. IF plat_arry[1] + plat_arry[2] + plat_arry[3] + plat_arry[4] = 0
  11863.    plat_arry = 1
  11864. ENDIF
  11865.  
  11866. DO CASE
  11867. CASE m.g_toplatform = c_dosname
  11868.    RETURN IIF(plat_arry[dos_code] = 1, .T.,.F.)
  11869. CASE m.g_toplatform = c_winname
  11870.    RETURN IIF(plat_arry[win_code] = 1, .T.,.F.)
  11871. CASE m.g_toplatform = c_macname
  11872.    RETURN IIF(plat_arry[mac_code] = 1, .T.,.F.)
  11873. CASE m.g_toplatform = c_unixname
  11874.    RETURN IIF(plat_arry[unix_code] = 1, .T.,.F.)
  11875. ENDCASE
  11876.  
  11877. *!*****************************************************************************
  11878. *!
  11879. *!      Function: iserrormsg
  11880. *!
  11881. *!*****************************************************************************
  11882. FUNCTION iserrormsg
  11883. PARAMETER m.strg
  11884. * Was this an error message that the Mac RW added to a report file that
  11885. * didn't have any Windows records?  If so, don't transport it.
  11886. RETURN IIF(ATC("** ERROR", UPPER(m.strg)) > 0, .T., .F.)
  11887.  
  11888. *!*****************************************************************************
  11889. *!
  11890. *!      Function: boxjoin
  11891. *!
  11892. *!*****************************************************************************
  11893. FUNCTION boxjoin
  11894. PARAMETERS m.otype, m.rnum, m.pform
  11895. * Is this text object in a box group and thus boxjoin?
  11896. PRIVATE m.in_rec, m.retval, m.objpos
  11897. m.retval = .F.
  11898. IF m.otype = c_ottext
  11899.    m.in_rec = RECNO()
  11900.  
  11901.    * Get object position (position in linked list of objects) of current record
  11902.    m.objpos = GetObjPos(m.rnum, m.pform)
  11903.    IF m.objpos > 0
  11904.       * Look at all the box groups
  11905.       GOTO TOP
  11906.       SCAN FOR m.pform == platform AND objtype = c_otgroup AND objcode = 1 AND !m.retval
  11907.          * hpos has the starting object number for this group, vpos has the number of
  11908.          * objects the group includes.
  11909.          IF m.objpos >= hpos AND m.objpos <= hpos + vpos - 1
  11910.             m.retval = .T.
  11911.          ENDIF
  11912.       ENDSCAN
  11913.    ENDIF
  11914.    GOTO m.in_rec
  11915. ENDIF
  11916. RETURN m.retval
  11917.  
  11918. *!*****************************************************************************
  11919. *!
  11920. *!      Function: GetObjPos
  11921. *!
  11922. *!*****************************************************************************
  11923. FUNCTION getobjpos
  11924. PARAMETERS m.rnum, m.pform
  11925. PRIVATE m.objcount, m.retval
  11926.  
  11927. * Get ordinal number of this object
  11928. m.objcount = 0
  11929. m.retval = 0
  11930. SCAN FOR m.pform == platform AND isobject(objtype)
  11931.    m.objcount = m.objcount + 1
  11932.    IF RECNO() = m.rnum
  11933.       m.retval = m.objcount
  11934.    ENDIF
  11935. ENDSCAN
  11936. RETURN m.retval
  11937.  
  11938. *!*****************************************************************************
  11939. *!
  11940. *!      Procedure: InitFontMap
  11941. *!
  11942. *!*****************************************************************************
  11943. PROCEDURE initfontmap
  11944. * Initialize font mapping array.  Windows font characteristics are in the
  11945. * first three columns, Mac in the next three.  These functions are used
  11946. * mainly to map text fields and static text.
  11947. PRIVATE m.i
  11948.  
  11949. *****************************************************************************
  11950. * Font characteristic table for some common fonts (from FontMetric()):
  11951. *
  11952. *                     8     8B     9     9B     10     10B     12
  11953. *                ---------------------------------------------------
  11954. * Geneva                 4x11   5x11  5x12   6x12    6x13     7x13    7x16
  11955. * Chicago             4x11   5x11  5x12   6x12    6x13     7x13    7x16
  11956. * MS Sans Serif      5x13   6x13     5x13   6x13   7x16   8x16    8x20
  11957. * Arial              5x14   5x14  5x15   6x15   6x16   6x16    8x19
  11958. * FoxFont            7x9    8x9   8x12   9x12   8x12   9x12    8x12
  11959. * Courier New        7x14   7x14  7x15   7x16   8x16   8x16    10x18
  11960. *****************************************************************************
  11961.  
  11962. g_fontmap[1,1] = "MS Sans Serif"
  11963. g_fontmap[1,2] = 8
  11964. g_fontmap[1,3] = "B"
  11965. g_fontmap[1,4] = "Geneva"
  11966. g_fontmap[1,5] = 10
  11967. g_fontmap[1,6] = ""
  11968.  
  11969. g_fontmap[2,1] = "MS Sans Serif"
  11970. g_fontmap[2,2] = 8
  11971. g_fontmap[2,3] = ""
  11972. g_fontmap[2,4] = "Geneva"
  11973. g_fontmap[2,5] = 9
  11974. g_fontmap[2,6] = ""
  11975.  
  11976. g_fontmap[3,1] = "Courier New"
  11977. g_fontmap[3,2] = 0    && wildcard
  11978. g_fontmap[3,3] = "*"  && wildcard
  11979. g_fontmap[3,4] = "Courier"
  11980. g_fontmap[3,5] = 0
  11981. g_fontmap[3,6] = "*"
  11982.  
  11983. FOR m.i = 1 TO ALEN(g_fontmap,1)
  11984.    g_fontmap[m.i,1] = UPPER(ALLTRIM(g_fontmap[m.i,1]))
  11985.    g_fontmap[m.i,3] = UPPER(ALLTRIM(g_fontmap[m.i,3]))
  11986.    g_fontmap[m.i,4] = UPPER(ALLTRIM(g_fontmap[m.i,4]))
  11987.    g_fontmap[m.i,6] = UPPER(ALLTRIM(g_fontmap[m.i,6]))
  11988. ENDFOR
  11989. *!*****************************************************************************
  11990. *!
  11991. *!      Procedure: MapFont
  11992. *!
  11993. *!*****************************************************************************
  11994. PROCEDURE mapfont
  11995. PARAMETER m.inface, m.insize, m.instyle, m.outface, m.outsize, m.outstyle, m.win2mac
  11996. PRIVATE m.i, m.asterisk, m.aoff   && array offset
  11997.  
  11998. m.asterisk = "*"
  11999. m.aoff = IIF(m.win2mac,0,3)
  12000. FOR m.i = 1 TO ALEN(g_fontmap,1)
  12001.    IF g_fontmap[m.i,1+m.aoff] == UPPER(ALLTRIM(m.inface)) ;
  12002.          AND INLIST(g_fontmap[m.i,2+m.aoff],m.insize,0) ;
  12003.          AND INLIST(g_fontmap[m.i,3+m.aoff],UPPER(ALLTRIM(m.instyle)),m.asterisk)
  12004.       m.outface  = g_fontmap[m.i,4-m.aoff]
  12005.  
  12006.       IF g_fontmap[m.i,2+m.aoff] = 0   && wildcard match on size?
  12007.          m.outsize  = m.insize
  12008.       ELSE
  12009.          m.outsize  = g_fontmap[m.i,5-m.aoff]
  12010.       ENDIF
  12011.  
  12012.       IF g_fontmap[m.i,6-m.aoff] = m.asterisk   && wildcard match on style?
  12013.          m.outstyle = m.instyle
  12014.       ELSE
  12015.          m.outstyle = g_fontmap[m.i,6-m.aoff]
  12016.       ENDIF
  12017.       RETURN
  12018.    ENDIF
  12019. ENDFOR
  12020. * Let the operating system handle the font mapping
  12021. m.outface = m.inface
  12022. m.outsize = m.insize
  12023. m.outstyle = m.instyle
  12024. RETURN
  12025.  
  12026. *!*****************************************************************************
  12027. *!
  12028. *!      Procedure: REPLFONT
  12029. *!
  12030. *!*****************************************************************************
  12031. PROCEDURE replfont
  12032. PRIVATE m.theface, m.thesize, m.thestyle
  12033. * Replace the current font with a mapped one, if one matches
  12034. m.theface = ""
  12035. m.thesize = 0
  12036. m.thestyle = ""
  12037. DO mapfont WITH fontface, fontsize, num2style(fontstyle), ;
  12038.    m.theface, m.thesize, m.thestyle, _MAC
  12039. IF !EMPTY(m.theface)
  12040.    REPLACE fontface WITH m.theface, fontsize WITH m.thesize, ;
  12041.        fontstyle WITH style2num(m.thestyle)
  12042. ENDIF
  12043.  
  12044. *!*****************************************************************************
  12045. *!
  12046. *!      Procedure: MAKE2D
  12047. *!
  12048. *!*****************************************************************************
  12049. FUNCTION make2d
  12050. * Add a 2 to the control portion of the picture string
  12051. PARAMETER m.strg
  12052. m.strg = TRIM(m.strg)
  12053. PRIVATE m.sp_pos, m.ctrl
  12054. #DEFINE c_2dmark '2'
  12055.  
  12056. m.sp_pos = AT(" ",strg)
  12057. DO CASE
  12058. CASE m.sp_pos > 0 AND AT('@', m.strg) > 0
  12059.    m.ctrl = LEFT(m.strg, m.sp_pos - 1)
  12060.     IF AT(c_2dmark,m.ctrl) = 0
  12061.        m.ctrl = m.ctrl + c_2dmark
  12062.        m.strg = m.ctrl + SUBSTR(m.strg, m.sp_pos)
  12063.     ENDIF
  12064. CASE EMPTY(m.strg)
  12065.    m.strg = "@" + c_2dmark
  12066. CASE AT(c_2dmark,strg) = 0
  12067.     IF isquote(RIGHT(m.strg,1))
  12068.        IF SUBSTR(m.strg,2,1) = "@"
  12069.            * Something like "@!".  Make it "@!2"
  12070.          m.strg = SUBSTR(m.strg, 1, LEN(m.strg) - 1) + c_2dmark + RIGHT(m.strg,1)
  12071.         ELSE
  12072.            * Something like "!!!".  Make it "@2 !!!"
  12073.          m.strg = SUBSTR(m.strg, 1, 1) + "@" + c_2dmark + " "+SUBSTR(m.strg,2)
  12074.         ENDIF
  12075.      ELSE
  12076.        IF SUBSTR(m.strg,2,1) = "@"
  12077.            * Something like @!.  Make it @!2
  12078.          m.strg = m.strg + c_2dmark
  12079.         ELSE
  12080.            * Something like !!!.  Make it @2 !!!
  12081.          m.strg =  "@" + c_2dmark + " " + m.strg
  12082.         ENDIF
  12083.     ENDIF
  12084. ENDCASE
  12085. RETURN m.strg
  12086.  
  12087. *!*****************************************************************************
  12088. *!
  12089. *!      Procedure: MAKE3D
  12090. *!
  12091. *!*****************************************************************************
  12092. FUNCTION make3d
  12093. * Add a 3 to the control portion of the picture string
  12094. PARAMETER m.strg
  12095. m.strg = TRIM(m.strg)
  12096. PRIVATE m.sp_pos, m.ctrl
  12097. #DEFINE c_3dmark '3'
  12098.  
  12099. m.sp_pos = AT(" ",strg)
  12100. DO CASE
  12101. CASE m.sp_pos > 0 AND AT('@', m.strg) > 0
  12102.    m.ctrl = LEFT(m.strg, m.sp_pos - 1)
  12103.     IF AT(c_3dmark,m.ctrl) = 0
  12104.        m.ctrl = m.ctrl + c_3dmark
  12105.        m.strg = m.ctrl + SUBSTR(m.strg, m.sp_pos)
  12106.     ENDIF
  12107. CASE EMPTY(m.strg)
  12108.    m.strg = "@" + c_3dmark
  12109. CASE AT(c_3dmark,strg) = 0
  12110.     IF isquote(RIGHT(m.strg,1))
  12111.        IF SUBSTR(m.strg,2,1) = "@"
  12112.            * Something like "@!".  Make it "@!3"
  12113.          m.strg = SUBSTR(m.strg, 1, LEN(m.strg) - 1) + c_3dmark + RIGHT(m.strg,1)
  12114.         ELSE
  12115.            * Something like "!!!".  Make it "@3 !!!"
  12116.          m.strg = SUBSTR(m.strg, 1, 1) + "@" + c_3dmark + " "+SUBSTR(m.strg,2)
  12117.         ENDIF
  12118.      ELSE
  12119.        IF SUBSTR(m.strg,2,1) = "@"
  12120.            * Something like @!.  Make it @!3
  12121.          m.strg = m.strg + c_3dmark
  12122.         ELSE
  12123.            * Something like !!!.  Make it @3 !!!
  12124.          m.strg =  "@" + c_3dmark + " " + m.strg
  12125.         ENDIF
  12126.     ENDIF
  12127. ENDCASE
  12128. RETURN m.strg
  12129.  
  12130. *!*****************************************************************************
  12131. *!
  12132. *!      Function: ADDQUOTE
  12133. *!
  12134. *!*****************************************************************************
  12135. FUNCTION addquote
  12136. PARAMETER m.strg
  12137. * Add quotes if they aren't already there
  12138. IF !INLIST(LEFT(m.strg,1) , CHR(34) , CHR(39) , '[')
  12139.     DO CASE
  12140.     CASE AT('"', m.strg) = 0
  12141.        m.strg = '"' + m.strg + '"'
  12142.     CASE AT("'", m.strg) = 0
  12143.        m.strg = "'" + m.strg + "'"
  12144.    CASE AT('[', m.strg) = 0 AND AT(']', m.strg) = 0
  12145.         m.strg = '[' + m.strg + ']'
  12146.     OTHERWISE
  12147.        * Take our best shot
  12148.        m.strg = '"' + m.strg + '"'
  12149.     ENDCASE
  12150. ENDIF
  12151. RETURN m.strg
  12152. *!*****************************************************************************
  12153. *!
  12154. *!      Function: ISQUOTE
  12155. *!
  12156. *!*****************************************************************************
  12157. FUNCTION isquote
  12158. PARAMETER m.char
  12159. IF INLIST(m.char,CHR(34),CHR(39))
  12160.    RETURN .T.
  12161. ELSE
  12162.    RETURN .F.
  12163. ENDIF
  12164.  
  12165. *!*****************************************************************************
  12166. *!
  12167. *!      Procedure: FONTAVAIL
  12168. *!
  12169. *!*****************************************************************************
  12170. FUNCTION fontavail
  12171. PARAMETER m.thefont
  12172. m.thefont = UPPER(ALLTRIM(m.thefont))
  12173. IF ASCAN(g_fontavail, m.thefont) > 0
  12174.    RETURN .T.
  12175. ELSE
  12176.    RETURN .F.
  12177. ENDIF
  12178.  
  12179. *!*****************************************************************************
  12180. *!
  12181. *!      Procedure: FIXPEN
  12182. *!
  12183. *!*****************************************************************************
  12184. PROCEDURE fixpen
  12185. * Make sure that the pen_color fields don't overflow.  A bug in the beta
  12186. * version of FoxPro 2.5 sometimes caused this to happen.  It was corrected
  12187. * prior to release.
  12188. IF penred > 65536
  12189.    REPLACE penred WITH 0
  12190. ENDIF
  12191. IF pengreen > 65536
  12192.    REPLACE pengreen WITH 0
  12193. ENDIF
  12194. IF penblue > 65536
  12195.    REPLACE penblue WITH 0
  12196. ENDIF
  12197.  
  12198. *!*****************************************************************************
  12199. *!
  12200. *!      Procedure: ASSERT
  12201. *!
  12202. *!*****************************************************************************
  12203. PROCEDURE assert
  12204. PARAMETER condition, strg
  12205. IF debugversion
  12206.    IF !condition
  12207.       WAIT WINDOW "Assertion failed: "+strg
  12208.    ENDIF
  12209. ENDIF
  12210. *: EOF: TRANSPRT.PRG
  12211.