Page 8 of 29

Re: HMG 3.3.1 (Stable)

Posted: Tue Aug 26, 2014 4:07 pm
by Rathinagiri
Pablo César wrote:
mol wrote:I found a difference in h_HMG_HPDF.PRG source file.
In _HMG_HPDF_PRINT function definition, some piece of code from line 283 looks like that:

Code: Select all

 If HMG_UPPER( HB_USUBSTR( cFontName, HMG_LEN( cFontName ) - 3 ) ) == '.TTF' // load ttf font
In _HMG_HPDF_MULTILINE_PRINT function definition, adequate line (no. 372) differents from above:

Code: Select all

If HMG_UPPER( HB_USUBSTR( cFontName, HMG_LEN( cFontName ) - 4 ) ) == '.TTF' // load ttf font
Difference is in recognizing .TTF extension. First line is good, second is bad.
I've changed 4 to 3 in line 372, recompiled library, and it's work OK to me.
I'm testing forward.

It's a bug to correct in the next version of HMG, I think.

Regards, Marek
Yes Marek, you are right !

I have published this solution at viewtopic.php?p=35144#p35144 because EduardoLuis has appointed this same fail.
Screen_01.PNG
Even with solution in our hands, nothing happen at new releases.
Only strong discusions about this... :(
Pablo, this we will do in the next release. Thanks a lot.

Re: HMG 3.3.1 (Stable)

Posted: Wed Aug 27, 2014 5:41 am
by mol
I've modified h_controlmisc.prg to allow user to enter base filename for saving his prinouts:
Image

Code: Select all

Function _HMG_PRINTER_SavePages()
Local c , i , f , t , d , e, x, h, a := {}
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 hBitmap, nType
Local flag_PDF := .F.
local nWidth, nHeight, nDPI, cDocName

x := _HMG_PRINTER_GetOutFileType ( g )   /*          Returns following Array:
                                               ( x[1]=>Folder_Name | x[2]=>File_Type | x[3]=>Base file name)  */

if HMG_LEN(x)=0
   Return Nil
endif

IF x[ 2 ] == 1
   flag_PDF := .T.
endif

cDocName := alltrim(x[ 3 ])
if empty(cDocName)
	cDocName := "HMG_PrintFile_"
else
	// avoid to use special chars in filename
	cDocName := charrepl(":/.,|\@#$%&^*+ ",_HMG_SYSDATA [ 358 ],"_") + "_"
endif
	
If HB_URIGHT(x[1],1) != '\'
   e := x[1] + '\'
Else
   e := x[1]
endif

h := g[x[2]] // File_Type extension

nType := nTypePicture[ x[2] ]

t := gettempfolder() 
//MsgStop(_HMG_SYSDATA [ 358 ])

c := adir ( t + _HMG_SYSDATA [ 379 ] + "_hmg_print_preview_*.Emf")

asize ( a , c )

adir ( t + _HMG_SYSDATA [ 379 ]  + "_hmg_print_preview_*.Emf" , a )


For i := 1 To c
    f := t + a [i]
    d := e + cDocName + StrZero ( i , 4 )
	//MsgStop("f->"+f+chr(10)+"t->"+t+chr(10)+"d->"+d+chr(10)+"cDocName->"+ cDocName+ "len(a)->"+str(len(a)))
    IF HMG_UPPER (h) == "EMF"
       COPY FILE (F) TO (D+"."+h)
    ELSE 
          

      // by Dr. Claudio Soto, April 2014
       hBitmap = BT_BitmapLoadEMF ( f, WHITE )
       
       IF hBitmap <> 0 .AND. flag_PDF == .F.
          BT_BitmapSaveFile (hBitmap, d+"."+h, 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 ( d+".pdf", 1, 256, nHeight, nWidth, .f. )
            _hmg_hpdf_startdoc()
            _HMG_HPDF_SetCompression( 'ALL' )
            h := "JPG"
         endif

         _hmg_hpdf_startpage()
         BT_BitmapSaveFile (hBitmap, d+"."+h, BT_FILEFORMAT_JPG)
         BT_BitmapRelease (hBitmap)
         _HMG_HPDF_IMAGE ( d+"."+h, 0, 0, nHeight, nWidth, .t. , h )
         _hmg_hpdf_endpage()
         FERASE( d+"."+h )

         if i == c
            _hmg_hpdf_enddoc()
         endif

       ENDIF

    ENDIF
Next i
Return Nil



Function _HMG_PRINTER_GetOutFileType (aFiletype)   // by Pablo César, April 2014
Local cFolder_aux,cFolder:=GetCurrentFolder(), aRet:={}

DEFINE WINDOW Out_File AT 171 , 285 WIDTH 468 HEIGHT 179 ;
    TITLE "Output type file" MODAL NOSIZE NOSYSMENU
    
    ON KEY ESCAPE ACTION ThisWindow.Release()

    DEFINE LABEL Label_1
        ROW    22
        COL    20
        WIDTH  60
        HEIGHT 20
        VALUE "Folder:"
        FONTNAME "Arial"
        FONTSIZE 9
    END LABEL

    DEFINE TEXTBOX Text_1
        ROW    18
        COL    90
        WIDTH  320
        HEIGHT 22
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        READONLY .T.
        VALUE cFolder
    END TEXTBOX
    
    DEFINE BUTTON Button_1
        ROW    17
        COL    412
        WIDTH  30
        HEIGHT 24
        ACTION (cFolder_aux:=GetFolder(),cFolder := IIF (EMPTY(cFolder_aux),cFolder,cFolder_aux), SetProperty("Out_File","Text_1","Value",cFolder))
        FONTNAME "Arial"
        FONTSIZE 9
        PICTURE "HP_FOLDER"
        PICTALIGNMENT TOP
    END BUTTON

	DEFINE LABEL Label_OutFileName
        ROW    50
        COL    10
        WIDTH  79
        HEIGHT 40
        VALUE "Base filename:"
        FONTNAME "Arial"
        FONTSIZE 9
    END LABEL

    DEFINE TEXTBOX Text_OutFileName
        ROW    50
        COL    90
        WIDTH  320
        HEIGHT 22
        FONTNAME "Arial"
        FONTSIZE 9
        TOOLTIP ""
        READONLY .F.
        VALUE charrepl(":/.,|\@#$%&^*+ ",_HMG_SYSDATA [ 358 ],"_")
    END TEXTBOX
	
    DEFINE LABEL Label_2
        ROW    90
        COL    20
        WIDTH  60
        HEIGHT 20
        VALUE "File type:"
        FONTNAME "Arial"
        FONTSIZE 9
    END LABEL

    DEFINE COMBOBOX Combo_1
        ROW      86
        COL      90
        WIDTH    100
        HEIGHT   126
        ITEMS    aFiletype
        VALUE    1
        FONTNAME "Arial"
        FONTSIZE 9
    END COMBOBOX

    DEFINE BUTTON Button_2
        ROW    110
        COL    270
        WIDTH  80
        HEIGHT 24
        ACTION (aRet:={GetProperty("Out_File","Text_1","Value"),GetProperty("Out_File","Combo_1","Value"),GetProperty("Out_File","Text_OutFileName","Value")},ThisWindow.Release())
        CAPTION _HMG_SYSDATA [ 371 ] [11]
        FONTNAME "Arial"
        FONTSIZE 9
    END BUTTON

    DEFINE BUTTON Button_3
        ROW    110
        COL    360
        WIDTH  80
        HEIGHT 24
        ACTION ThisWindow.Release()
        CAPTION _HMG_SYSDATA [ 371 ] [12] 
        FONTNAME "Arial"
        FONTSIZE 9
    END BUTTON

END WINDOW
CENTER WINDOW Out_File
ACTIVATE WINDOW Out_File
Return aRet

Re: HMG 3.3.1 (Stable)

Posted: Wed Aug 27, 2014 10:43 am
by esgici
mol wrote:I've modified h_controlmisc.prg to allow user to enter base filename for saving his prinouts:
Good enhancement, thanks Marek 8-)

I hope will be implemented in next release of HMG :arrow:

Regards

Re: HMG 3.3.1 (Stable)

Posted: Wed Aug 27, 2014 2:01 pm
by Rathinagiri
Thank you Marek. Will use it.

Re: HMG 3.3.1 (Stable)

Posted: Wed Aug 27, 2014 2:09 pm
by mol
Save window is in English only. We should add national labels too.

Re: HMG 3.3.1 (Stable)

Posted: Thu Aug 28, 2014 1:07 pm
by Agil Abdullah
Many thanks to Mr. Rathi and his team and supporters.

Awaiting accomplished this new version.

-Agil-

Re: HMG 3.3.1 (Stable)

Posted: Thu Sep 04, 2014 2:23 pm
by srvet_claudio
Hi Friends,
please test this patch, main changes are:
1) internal change in Dynamic Back and Fore Color in Grid (now is more efficient, was removed the use of an array with an element for each cell, avoid create a huge array).
2) New Dynamic Font in Grid and Tree controls

New features:

Code: Select all

* GRID 
   - <ParentWindowName>.<GridControlName>.Image ( lTransparent ) := { "image1.png", "image2.bmp", ... }
   - <ParentWindowName>.<GridControlName>.ImageIndex ( nRow , nCol )
   - <ParentWindowName>.<GridControlName>.ImageList
   - <ParentWindowName>.<GridControlName>.ColumnDYNAMICFONT( nCol ) := {|| {cFontName, nFontSize, [ lBold, lItalic, lUnderline, lStrikeOut ]} }
   - <ParentWindowName>.<GridControlName>.HeaderImageIndex ( nCol ) [ := | -->] nIndex
   - <ParentWindowName>.<GridControlName>.ChangeFontSize := nSize | NIL  // Useful for use Dynamic Font with more (less) Height than the size of font the Grid/Tree control

// Dynamic Font (Grid/Tree)
ARRAY FONT <cFontName> SIZE <nFontSize> [ BOLD ] [ ITALIC ] [ UNDERLINE ] [ STRIKEOUT ] --> { cFontName, nFontSize, lBold, lIitalic, lUnderline, lStrikeout }

// Dynamic Font  (Grid/Tree)
CREATE ARRAY FONT <cFontName> SIZE <nFontSize> [ BOLD <lBold> ] [ ITALIC <lIitalic> ] [ UNDERLINE <lUnderline> ] [ STRIKEOUT <lStrikeout> ] --> { cFontName, nFontSize, lBold, lIitalic, lUnderline, lStrikeout }


* Tree Control
   - ON EXPAND
   - ON COLLAPSE
   
   - This.TreeItemValue
   
   - <ParentWindowName>.<TreeControlName>.DynamicForeColor := cBlock
   - <ParentWindowName>.<TreeControlName>.DynamicBackColor := cBlock
   - <ParentWindowName>.<TreeControlName>.DynamicFont      := cBlock
   - <ParentWindowName>.<TreeControlName>.ChangeFontSize   := nSize | NIL  // Useful for use Dynamic Font with more (less) Height than the size of font the Grid/Tree control

   - <ParentWindowName>.<TreeControlName>.IsExpand ( nValue ) --> lBoolean
   - <ParentWindowName>.<TreeControlName>.ImageList     [ := | --> ] hImageList
   - <ParentWindowName>.<TreeControlName>.HasLines      [ := | --> ] lBoolean
   - <ParentWindowName>.<TreeControlName>.FullRowSelect [ := | --> ] lBoolean
   - <ParentWindowName>.<TreeControlName>.HasButton ( nValue ) [ := | --> ] lBoolean
   - <ParentWindowName>.<TreeControlName>.Cargo ( nValue ) [ := | --> ] xData
   - <ParentWindowName>.<TreeControlName>.CargoScan ( xData ) -->  nValue | NIL
   - <ParentWindowName>.<TreeControlName>.GetPathValue     ( nValue ) --> anPathValue | NIL
   - <ParentWindowName>.<TreeControlName>.GetPathName      ( nValue ) --> acPathName | NIL
   - <ParentWindowName>.<TreeControlName>.GetDisplayLevel  ( nValue ) --> nDisplayColumn | NIL

Re: HMG 3.3.1 (Stable)

Posted: Thu Sep 04, 2014 3:07 pm
by danielmaximiliano
Gracias Claudio por el trabajo y tu tiempo para con HMG...

como siempre una admiración hacia tú persona...

HMG 3.3.1 (Stable)

Posted: Thu Sep 04, 2014 3:31 pm
by Pablo César
danielmaximiliano wrote:Gracias Claudio por el trabajo y tu tiempo para con HMG...

como siempre una admiración hacia tú persona...
+1

Very clever solution:

Code: Select all

* Dynamic Font
#xtranslate ARRAY ;
         FONT <fontname>;
         SIZE <fontsize>;
         [ <bold : BOLD> ] ;
         [ <italic : ITALIC> ] ;
         [ <underline : UNDERLINE> ] ;
         [ <strikeout : STRIKEOUT> ] ;
         => { <fontname>, <fontsize>, <.bold.>, <.italic.>, <.underline.>, <.strikeout.> }

Re: HMG 3.3.1 (Stable)

Posted: Thu Sep 04, 2014 7:10 pm
by mol
Thx!