kcarmody wrote:srvet_claudio wrote:I repeat, please:
the best way to contribute is posted only the modified functions and commenting on the changes made and a small demo with the changes.
OK thanks, but this raises several other questions.
Sometimes a function that I have modified has also been modified in your beta version. An example is GetFile(). Should the modified function that I submit include the changes in your beta and indicate which changes are mine? Or should it not include the changes in your beta?
i have modified several dozen functions. In what form should I submit each modified function? Should I submit each modified function in a separate file? Or can all the modified functions go into one file? Or should make a file for each source code file that indicates the changes I made to the corresponding source code file? Should the file(s) themselves indicate the changes? Or should the description of changes be somewhere else?
How should I handle a small number of changes to a large procedure? For example, DoMethod() is 549 lines long, but I changed only 3 lines. In such a case, is it OK to submit changed lines only?
For changes to include files, is it OK to submit only the #defines that I have modified?
Do you handle changes to documentation? It seems that Pablo César handles these.
Does this policy apply to samples? I have completely overhauled the rich edit demo (SAMPLES\Controls\RichEditBox\demo.prg). It includes 59 functions and is 2009 lines long. Every function is rewritten. I think the only practical way to submit this is as a whole file. Is that OK?
Since I have modified several dozen source functions, it will take me weeks to develop small demos for each change. However, the rich edit demo uses all these changes. It is not exactly small, but it does demonstrate all the changes. Will it be OK to comment on each place in the demo where a source modification affects the behavior of the demo and indicate how to test this behavior in the demo?
TIA for your help on all these questions.
Kevin
An example is worth a thousand words.
In this case Rathinagiri (the other person responsible for the development of HMG together with me) sent me the following function where the code added is clearly marked with a small attached explanation (which of course was eliminated from the code) of how works the code.
Code: Select all
Function _HMG_PRINTER_SavePages ( lSaveAs )
Local i, nFiles, cFileEMF, cTempFolder, cPrintFileName, aFiles := {}
LOCAL g := {".PDF", ".BMP",".JPG",".GIF",".TIF",".PNG",".EMF"}
LOCAL nTypePicture := { Nil , BT_FILEFORMAT_BMP, BT_FILEFORMAT_JPG, BT_FILEFORMAT_GIF, BT_FILEFORMAT_TIF, BT_FILEFORMAT_PNG, Nil }
LOCAL acFilter := { {"PDF", "*.pdf"}, {"BMP", "*.bmp"}, {"JPG", "*.jpg"}, {"GIF", "*.gif"}, {"TIF", "*.tif"}, {"PNG", "*.png"}, {"EMF", "*.emf"} }
LOCAL cFullName, cPath, cName, cExt, cExtFile := ""
LOCAL cFileName := "HMG_PrintFile"
LOCAL cFolder := GetCurrentFolder()
Local hBitmap, nType
Local flag_PDF := .F.
local nWidth, nHeight, nDPI
IF ValType (_HMG_SYSDATA [ 506 ]) == "C"
hb_FNameSplit( _HMG_SYSDATA [ 506 ], @cFolder, @cFileName, NIL, NIL )
ENDIF
// by Dr. Claudio Soto, September 2014
IF ValType (lSaveAs) == "L" .AND. lSaveAs == .T.
IF ValType (_HMG_SYSDATA [ 507 ]) == "C"
cFullName := _HMG_SYSDATA [ 507 ] // SaveAs cFullFileName
ELSE
MsgStop ("SaveAs: Invalid File Name", "ERROR")
RETURN NIL
ENDIF
ELSE
cFullName := PutFile ( acFilter, NIL, cFolder, .F., cFileName, @cExtFile ) // Dialog cFileName
ENDIF
HB_FNameSplit (cFullName, @cPath, @cName, @cExt, NIL)
cExt := HMG_UPPER (AllTrim (cExt))
i := ASCAN (g, cExt)
If i == 0
MsgStop ("Invalid File Extension: "+cExt, "ERROR")
Return Nil
endif
nType := nTypePicture [ i ]
IF HMG_UPPER (cExt) == ".PDF"
flag_PDF := .T.
ENDIF
cTempFolder := GetTempFolder ()
nFiles := ADIR ( cTempFolder + _HMG_SYSDATA [ 379 ] + "_hmg_print_preview_*.Emf")
ASIZE ( aFiles , nFiles )
ADIR ( cTempFolder + _HMG_SYSDATA [ 379 ] + "_hmg_print_preview_*.Emf" , aFiles )
For i := 1 To nFiles
cFileEMF := cTempFolder + aFiles [i]
cPrintFileName := cPath + cName + "_" + StrZero ( i , 4 )
IF HMG_UPPER (cExt) == ".EMF"
COPY FILE (cFileEMF) TO (cPrintFileName + cExt)
ELSE
// by Dr. Claudio Soto, April 2014
hBitmap = BT_BitmapLoadEMF ( cFileEMF, WHITE )
IF hBitmap <> 0 .AND. flag_PDF == .F.
BT_BitmapSaveFile (hBitmap, cPrintFileName + cExt, nType)
BT_BitmapRelease (hBitmap)
ENDIF
IF hBitmap <> 0 .AND. flag_PDF == .T. // by Rathinagiri (May 2014)
if i == 1
nDPI := 300
nWidth := ( BT_BitmapWidth ( hBitmap ) / nDPI * 25.4 )
nHeight := ( BT_BitmapHeight( hBitmap ) / nDPI * 25.4 )
_HMG_HPDF_INIT ( cPath + cName + ".PDF", 1, 256, nHeight, nWidth, .f. )
_hmg_hpdf_startdoc()
_HMG_HPDF_SetCompression( 'ALL' )
endif
_hmg_hpdf_startpage()
BT_BitmapSaveFile (hBitmap, cPrintFileName + ".JPG", BT_FILEFORMAT_JPG)
BT_BitmapRelease (hBitmap)
_HMG_HPDF_IMAGE ( cPrintFileName + ".JPG", 0, 0, nHeight, nWidth, .t. , "JPG" )
_hmg_hpdf_endpage()
FERASE ( cPrintFileName + ".JPG" )
if i == nFiles
_hmg_hpdf_enddoc()
endif
ENDIF
ENDIF
Next i
Return Nil