HMG 3.3.1 (Stable)

HMG Unicode versions 3.1.x related

Moderator: Rathinagiri

User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: HMG 3.3.1 (Stable)

Post 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.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: HMG 3.3.1 (Stable)

Post 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
Last edited by mol on Mon Sep 08, 2014 12:28 pm, edited 1 time in total.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: HMG 3.3.1 (Stable)

Post 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
Viva INTERNATIONAL HMG :D
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: HMG 3.3.1 (Stable)

Post by Rathinagiri »

Thank you Marek. Will use it.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: HMG 3.3.1 (Stable)

Post by mol »

Save window is in English only. We should add national labels too.
User avatar
Agil Abdullah
Posts: 204
Joined: Mon Aug 25, 2014 11:57 am
Location: Jakarta, Indonesia
Contact:

Re: HMG 3.3.1 (Stable)

Post by Agil Abdullah »

Many thanks to Mr. Rathi and his team and supporters.

Awaiting accomplished this new version.

-Agil-
Agil Abdullah Albatati (just call me Agil)
Programmer Never Surrender
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG 3.3.1 (Stable)

Post 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
Attachments
Demo_patch1.rar
(9.51 KiB) Downloaded 541 times
HMG.3.3.1_patch1.rar
(793.53 KiB) Downloaded 605 times
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
danielmaximiliano
Posts: 2611
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: HMG 3.3.1 (Stable)

Post by danielmaximiliano »

Gracias Claudio por el trabajo y tu tiempo para con HMG...

como siempre una admiración hacia tú persona...
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

HMG 3.3.1 (Stable)

Post 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.> }
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Post Reply