diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d7c36afab9..9cc21bb282 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,30 @@ The license applies to all entries newer than 2009-04-28. */ +2012-10-02 03:08 UTC+0200 Viktor Szakats (harbour syenar.net) + * utils/hbmk2/hbmk2.prg + + added tricky feature which attempts to autodetect whether + a script is meant to be run on an interactive CUI as + opposed to the default command line (CLI, aka GTCGI) mode. + It makes it possible to keep cmdline oriented scripts + running using GTCGI, while full-screen apps are run + using GTWIN and friends without code changes. F.e. + /tests apps can be run this way easily. + ; scripts can force to use CLI by using: + 'REQUEST HB_GT_CGI_DEFAULT' + ; scripts can switch to CUI mode explicitly by running + this code: + #ifdef __HBSCRIPT__HBSHELL + hbshell_gtInteractive() + #endif + Experimental, might change to something more elegant. + + * tests/db_brows.prg + ! fixed CUI for unicode and readded CUI drawing elements + + * tests/sbartest.prg + * comment deleted + 2012-10-02 01:29 UTC+0200 Viktor Szakats (harbour syenar.net) * ChangeLog * deleted TODO from 2012-10-02 01:10, C level box drawing diff --git a/harbour/tests/db_brows.prg b/harbour/tests/db_brows.prg index d4b4e353dd..1bbf3b5b56 100644 --- a/harbour/tests/db_brows.prg +++ b/harbour/tests/db_brows.prg @@ -78,6 +78,7 @@ #define LI_MSED mslist[ 41 ] #define LI_COLCOUNT mslist[ 42 ] +MEMVAR str_barbox MEMVAR str_bar //+-------------------------------------------------------------------- @@ -138,13 +139,17 @@ FUNCTION DBFLIST( mslist, x1, y1, x2, y2, title, maskey ) LOCAL fbar1, fbar2, vartmp, varbuf, razmer LOCAL GetList := {} + MEMVAR str_barbox MEMVAR str_bar IF mslist == Nil mslist := InitList() ENDIF + IF !( Type( "str_barbox" ) == "C" ) + PRIVATE str_barbox := hb_UTF8ToStrBox( "│" ) + ENDIF IF !( Type( "str_bar" ) == "C" ) - PRIVATE str_bar := "-v^o" + PRIVATE str_bar := hb_UTF8ToStr( "■" ) ENDIF LI_Y1 := y1 LI_X1 := x1 @@ -241,15 +246,15 @@ FUNCTION DBFLIST( mslist, x1, y1, x2, y2, title, maskey ) SetColor( LI_CLR ) // #ifdef RDD_AX - @ LI_Y1 + 2, LI_X2, LI_Y2 - 2, LI_X2 BOX Left( str_bar, 1 ) + @ LI_Y1 + 2, LI_X2, LI_Y2 - 2, LI_X2 BOX str_barbox @ LI_Y1 + 1, LI_X2 SAY SubStr( str_bar, 2, 1 ) - @ LI_Y2 - 1, LI_X2 SAY SubStr( str_bar, 2, 1 ) + @ LI_Y2 - 1, LI_X2 SAY SubStr( str_bar, 1, 1 ) @ LI_Y1 + 2 + Int( iif( LI_PRFLT, LI_TEKZP, Ax_Keyno() ) * ( LI_Y2 - LI_Y1 - 4 ) / iif( LI_PRFLT, LI_KOLZ, Ax_KeyCount() ) ), LI_X2 SAY Right( str_bar, 1 ) #else IF ! ( Type( "Sx_Keyno()" ) == "U" ) - @ LI_Y1 + 2, LI_X2, LI_Y2 - 2, LI_X2 BOX Left( str_bar, 1 ) + @ LI_Y1 + 2, LI_X2, LI_Y2 - 2, LI_X2 BOX str_barbox @ LI_Y1 + 1, LI_X2 SAY SubStr( str_bar, 2, 1 ) - @ LI_Y2 - 1, LI_X2 SAY SubStr( str_bar, 2, 1 ) + @ LI_Y2 - 1, LI_X2 SAY SubStr( str_bar, 1, 1 ) fbar1 := "Sx_Keyno()" fbar2 := "Sx_KeyCount()" @ LI_Y1 + 2 + Int( iif( LI_PRFLT, LI_TEKZP, &fbar1 ) * ( LI_Y2 - LI_Y1 - 4 ) / iif( LI_PRFLT, LI_KOLZ, &fbar2 ) ), LI_X2 SAY Right( str_bar, 1 ) diff --git a/harbour/tests/sbartest.prg b/harbour/tests/sbartest.prg index 7f0af6fa90..1c6b63023d 100644 --- a/harbour/tests/sbartest.prg +++ b/harbour/tests/sbartest.prg @@ -58,7 +58,7 @@ FUNCTION InitScrlBar() filesScroll:total := Len( aFileList ) - filesScroll:colorSpec( "W+/W, W+/W" ) // New method! + filesScroll:colorSpec( "W+/W, W+/W" ) SET COLOR TO "N/W*, W+/B,,,W/N" filesScroll:display() diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 672ac36d13..1b91fc36b6 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -12277,6 +12277,7 @@ STATIC PROCEDURE __hbshell( cFile, ... ) LOCAL tmp LOCAL l_cHB_INSTALL_PREFIX LOCAL aINCPATH + LOCAL hHRB s_cDirBase_hbshell := hb_DirBase() s_cProgName_hbshell := hb_ProgName() @@ -12377,8 +12378,12 @@ STATIC PROCEDURE __hbshell( cFile, ... ) CASE ".hrb" s_lInteractive := .F. __hbshell_ext_init( aExtension ) + hHRB := hb_hrbLoad( cFile ) + IF __hbshell_detect_CUI( hHRB ) + hbshell_gtInteractive() + ENDIF hb_argShift( .T. ) - hb_hrbRun( cFile, ... ) + hb_hrbDo( hHRB, ... ) EXIT CASE ".dbf" __hbshell_ext_init( aExtension ) @@ -13163,6 +13168,81 @@ STATIC FUNCTION __hbshell_win_reg_app( lRegister, lAllUser, cAppPath ) #endif +/* List of Harbour RTL function typically used in + a full-screen CUI ("interactive") app */ +STATIC FUNCTION __hbshell_detect_CUI_extern_positive() + RETURN {; + "COL" => NIL ,; + "DISPBEGIN" => NIL ,; + "DISPBOX" => NIL ,; + "DISPCOUNT" => NIL ,; + "DISPEND" => NIL ,; + "DISPOUT" => NIL ,; + "DISPOUTAT" => NIL ,; + "HB_CLRAREA" => NIL ,; + "HB_DISPBOX" => NIL ,; + "HB_DISPOUTAT" => NIL ,; + "HB_DISPOUTATBOX" => NIL ,; + "HB_SCRMAXCOL" => NIL ,; + "HB_SCRMAXROW" => NIL ,; + "HB_SCROLL" => NIL ,; + "HB_SHADOW" => NIL ,; + "MAXCOL" => NIL ,; + "MAXROW" => NIL ,; + "HB_MMIDDLEDOWN" => NIL ,; + "MCOL" => NIL ,; + "MDBLCLK" => NIL ,; + "MHIDE" => NIL ,; + "MLEFTDOWN" => NIL ,; + "MMIDDLEDOWN" => NIL ,; + "MPRESENT" => NIL ,; + "MRESTSTATE" => NIL ,; + "MRIGHTDOWN" => NIL ,; + "MROW" => NIL ,; + "MSAVESTATE" => NIL ,; + "MSETBOUNDS" => NIL ,; + "MSETCURSOR" => NIL ,; + "MSETPOS" => NIL ,; + "MSHOW" => NIL ,; + "RESTSCREEN" => NIL ,; + "ROW" => NIL ,; + "SAVESCREEN" => NIL ,; + "SCROLL" => NIL ,; + "SETMODE" => NIL ,; + "SETPOS" => NIL ,; + "SETPOSBS" => NIL } + +STATIC FUNCTION __hbshell_detect_CUI_extern_negative() + RETURN {; + "HB_GT_CGI_DEFAULT" => NIL } + +STATIC FUNCTION __hbshell_detect_CUI( hHRB ) + LOCAL aFunction + LOCAL cFunction + LOCAL hFilter + + /* Detect based on function usage */ + + aFunction := hb_hrbGetFunList( hHRB, HB_HRB_FUNC_EXTERN ) + + hFilter := __hbshell_detect_CUI_extern_negative() + + FOR EACH cFunction IN aFunction + IF cFunction $ hFilter + RETURN .F. + ENDIF + NEXT + + hFilter := __hbshell_detect_CUI_extern_positive() + + FOR EACH cFunction IN aFunction + IF cFunction $ hFilter + RETURN .T. + ENDIF + NEXT + + RETURN .F. + /* ------------------------------------------------------------- */ /* for interactive shell and running .hrb. Though it'd be