Compilando una rutina de menu

Re: Compilando una rutina de menu

Postby horacio » Sun Apr 26, 2015 7:58 pm

Cristobal, muchas gracias por tu ayuda. Funcionó perfectamente. Sería bueno poder ponerlo como una contribución, supongo que su autor estará de acuerdo en compartirlo como lo hizo en el 2007. Nuevamente gracias.

Saludos
horacio
 
Posts: 1358
Joined: Wed Jun 21, 2006 12:39 am
Location: Capital Federal Argentina

Re: Compilando una rutina de menu

Postby cnavarro » Sun Apr 26, 2015 8:27 pm

Ya solo quedaria poder cambiar el Font del menu :D :D

Code: Select all  Expand view

   Local cFont   := "Segoe UI Symbol"
   Local cFontH  := -14

   DEFINE FONT oFontMenu NAME cFont SIZE 0, cFontH
 


Image
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Compilando una rutina de menu

Postby horacio » Sun Apr 26, 2015 9:32 pm

Cristobal, además del font también seria bueno que la sombra asociada al control fuera opcional ya que Windows 8 no usa ni sombras ni degradados.

Saludos
horacio
 
Posts: 1358
Joined: Wed Jun 21, 2006 12:39 am
Location: Capital Federal Argentina

Re: Compilando una rutina de menu

Postby cnavarro » Sun Apr 26, 2015 9:44 pm

Horacio, precisamente por trabajar con Win8 es por lo que me interesa tanto este tema
En cuanto al sombreado exterior, ojo, habitualmente no tiene, pero mira los menus contextuales

Image
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Compilando una rutina de menu

Postby horacio » Sun Apr 26, 2015 10:41 pm

Cristobal, tenés razón. Se me ocurre entonces que el box del menú no tendría que tener ese borde gris que le da aspecto 3D, solo la sombra. Además faltaría la linea que separa las leyendas de los bitmaps. Con eso quedaría pipi cucu jajajajaja.

Saludos
horacio
 
Posts: 1358
Joined: Wed Jun 21, 2006 12:39 am
Location: Capital Federal Argentina

Re: Compilando una rutina de menu

Postby cnavarro » Sun May 03, 2015 9:22 am

horacio wrote:Cristobal, tenés razón. Se me ocurre entonces que el box del menú no tendría que tener ese borde gris que le da aspecto 3D, solo la sombra. Además faltaría la linea que separa las leyendas de los bitmaps. Con eso quedaría pipi cucu jajajajaja.

Saludos


Horacio, has avanzado en este tema?
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Compilando una rutina de menu

Postby MOISES » Sun May 03, 2015 9:42 am

Hola,

Mirad por favor este hilo, porque tenemos que estar preparados para Windows 10 cuanto antes:

viewtopic.php?f=6&t=30633

Saludos cordiales,
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Re: Compilando una rutina de menu

Postby cnavarro » Sun May 03, 2015 10:34 am

Poco a poco
De momento, ya cambia el Font, y el alto de la barra de menu, aunque aun queda para su total implementacion

Image

Image
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Compilando una rutina de menu

Postby horacio » Tue May 05, 2015 3:02 pm

Cristóbal, por falta de tiempo no he podido ponerme con estas rutinas. veré de ponerme la semana que viene.

Saludos
horacio
 
Posts: 1358
Joined: Wed Jun 21, 2006 12:39 am
Location: Capital Federal Argentina

Re: Compilando una rutina de menu

Postby sysctrl2 » Tue May 05, 2015 4:13 pm

Para los que usan o usaron alguna vez VERCE, de Juan Carlos Salinas Ojeda,

este programa utiliza este tipo de Menus,

y la class fue modificada por JCSO,

esperemos pueda compartir los fuentes si es que aun anda por estos foros,

saludos JCSO.

Cesar.
Cesar Cortes Cruz
SysCtrl Software
Mexico

' Sin +- FWH es mejor "
User avatar
sysctrl2
 
Posts: 951
Joined: Mon Feb 05, 2007 7:15 pm

Re: Compilando una rutina de menu

Postby ruben Dario » Thu May 07, 2015 11:30 pm

horacio wrote:Cristobal, muchas gracias por tu ayuda. Funcionó perfectamente. Sería bueno poder ponerlo como una contribución, supongo que su autor estará de acuerdo en compartirlo como lo hizo en el 2007. Nuevamente gracias.

Saludos



Seria factible una copia de de deste menu.
Ruben Dario Gonzalez
Cali-Colombia
rubendariogd@hotmail.com - rubendariogd@gmail.com
User avatar
ruben Dario
 
Posts: 1061
Joined: Thu Sep 27, 2007 3:47 pm
Location: Colombia

Re: Compilando una rutina de menu

Postby cnavarro » Sun May 17, 2015 8:44 pm

Sustituyendo recursos

Image

En este ejecutable se ve que puede haber distintos tipos de menus
Ojo, usa el Font Segoe UI Symbol

https://www.dropbox.com/s/hd53bjvmxj36d ... u.zip?dl=0
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Compilando una rutina de menu

Postby ruben Dario » Tue May 19, 2015 1:09 am

cnavarro wrote:Aqui tienes la ultima

Code: Select all  Expand view

//#include <WinTen.h>
#include <Windows.h>
//#include <ClipApi.h>
#include <HbApi.h>
#include <commctrl.h>
#include <StdLib.h>

//----------------------------------------------------------------------------//

void DegradColor( HDC hDC, RECT * rori, COLORREF cFrom, COLORREF cTo, int iType, int iRound )
{
   int clr1r, clr1g, clr1b, clr2r, clr2g, clr2b ;
   signed int iEle, iRed, iGreen, iBlue, iTot, iHalf ;
   BOOL bHorz = ( iType == 2 || iType == 4 ) ;
   BOOL bDir ;
   RECT rct ;
   HPEN hOldPen, hPen ;
   LOGBRUSH lb ;
   HBRUSH hOldBrush, hBrush, hNull ;

   rct.top = rori->top ;
   rct.left = rori->left ;
   rct.bottom = rori->bottom ;
   rct.right = rori->right ;

    iTot   = ( ! bHorz ? ( rct.bottom  - rct.top + 1 ) : ( rct.right - rct.left + 1 ) ) ;

   iHalf  = iTot / 2 ;
    lb.lbStyle = BS_NULL ;
    hNull  = CreateBrushIndirect(&lb) ;

   clr1r = GetRValue( cFrom ) ;
   clr1g = GetGValue( cFrom ) ;
   clr1b = GetBValue( cFrom ) ;

   clr2r = GetRValue( cTo ) ;
   clr2g = GetGValue( cTo ) ;
   clr2b = GetBValue( cTo ) ;

   iRed   =  abs( clr2r - clr1r ) ;
   iGreen =  abs( clr2g - clr1g ) ;
   iBlue  =  abs( clr2b - clr1b ) ;

   iRed   = ( iRed <= 0 ? 0 : ( iRed / iTot ) );
   iGreen = ( iGreen <= 0 ? 0 : ( iGreen / iTot ) ) ;
   iBlue  = ( iBlue <= 0 ? 0 : ( iBlue / iTot ) ) ;

   if( iType == 3 || iType == 4 )
   {
    iRed   *= 2 ;
      iGreen *= 2 ;
      iBlue  *= 2 ;
   }

   if( iType == 5 )
   {
      rct.top  += ( ( rct.bottom - rct.top ) / 2 ) ;
      rct.left += ( ( rct.right - rct.left ) / 2 ) ;
      rct.top  -= ( ( rct.bottom - rct.top ) / 3 ) ;
      rct.bottom = rct.top + 2 ;
      rct.right  = rct.left + 2 ;
   }
   else
   {
    if( ! bHorz )
        rct.bottom = rct.top + 1 ;
       else
        rct.right = rct.left + 1 ;
   }


   if( iType == 5 )
   {
       hPen      = CreatePen( PS_SOLID, 1, RGB( clr2r, clr2g, clr2b ) ) ;
    hOldPen   = SelectObject( hDC, hPen ) ;
        hBrush    = CreateSolidBrush( RGB( clr2r, clr2g, clr2b ) ) ;
    hOldBrush = SelectObject( hDC, hBrush ) ;
      if( iRound == 1 )
            Ellipse( hDC, rori->left, rori->top, rori->right, rori->bottom ) ;
      else
            RoundRect( hDC, rori->left, rori->top, rori->right, rori->bottom, 16, 16 ) ;

    SelectObject( hDC, hOldBrush ) ;
       DeleteObject( hBrush ) ;
    SelectObject( hDC, hOldPen ) ;
       DeleteObject( hPen ) ;
       hPen    = CreatePen( PS_SOLID, 2, RGB( clr1r, clr1g, clr1b ) ) ;
    hOldPen = SelectObject( hDC, hPen ) ;
    SelectObject( hDC, hNull ) ;
      if( iRound == 1 )
            Ellipse( hDC, rct.left, rct.top, rct.right, rct.bottom ) ;
      else
            RoundRect( hDC, rct.left, rct.top, rct.right, rct.bottom, 16, 16 ) ;

   }
   else
   {
       hPen      = CreatePen( PS_SOLID, 1, RGB( clr1r, clr1g, clr1b ) ) ;
    hOldPen   = SelectObject( hDC, hPen ) ;
        hBrush    = CreateSolidBrush( RGB( clr1r, clr1g, clr1b ) ) ;
    hOldBrush = SelectObject( hDC, hBrush ) ;
   }

   for( iEle = 1; iEle < iTot; iEle++ )
   {

        if( iType > 2 && iType < 5 && iEle > iHalf )
      {
        clr2r = GetRValue( cFrom ) ;
        clr2g = GetGValue( cFrom ) ;
        clr2b = GetBValue( cFrom ) ;
      }

      bDir = ( clr2r > clr1r ? TRUE : FALSE ) ;
      if( bDir )
        clr1r += iRed ;
      else
        clr1r -= iRed ;

      clr1r = ( clr1r < 0 ? 0 : clr1r > 255 ? 255 : clr1r ) ;

      bDir = ( clr2g > clr1g ? TRUE : FALSE  ) ;
      if( bDir )
        clr1g += iGreen ;
      else
        clr1g -= iGreen ;

      clr1g = ( clr1g < 0 ? 0 : clr1g > 255 ? 255 : clr1g ) ;

      bDir = ( clr2b > clr1b ? TRUE : FALSE  ) ;

      if( bDir )
        clr1b += iBlue ;
      else
        clr1b -= iBlue ;

      clr1b = ( clr1b < 0 ? 0 : clr1b > 255 ? 255 : clr1b ) ;

      if( iType == 5 )
      {
              SelectObject( hDC, hOldBrush ) ;
           DeleteObject( hNull ) ;
                hNull  = CreateBrushIndirect(&lb) ;
              SelectObject( hDC, hNull ) ;
          SelectObject( hDC, hOldPen ) ;
            DeleteObject( hPen ) ;
            hPen = CreatePen( PS_SOLID, 2, RGB( clr1r, clr1g, clr1b ) ) ;
            SelectObject( hDC, hPen ) ;
       if( iRound == 1 )
            Ellipse( hDC, rct.left, rct.top, rct.right + 1, rct.bottom + 1 ) ;
          else
            RoundRect( hDC, rct.left, rct.top, rct.right + 1, rct.bottom + 1, 16, 16 ) ;

          if( iRound == 1 )
            Ellipse( hDC, rct.left, rct.top, rct.right + 1, rct.bottom + 1 ) ;
        else
            RoundRect( hDC, rct.left, rct.top, rct.right + 1, rct.bottom + 1, 16, 16 ) ;

            rct.top    -= ( rct.top <= rori->top ? 0 : 1 ) ;
            rct.left   -= ( rct.left <= rori->left ? 0 : 1 );
            rct.bottom +=  ( rct.bottom >= rori->bottom ? 0 : 1 ) ;
            rct.right  +=  ( rct.right >= rori->right ? 0 : 1 ) ;
       }
      else
      {
          SelectObject( hDC, hOldBrush ) ;
       DeleteObject( hBrush ) ;
        hBrush = CreateSolidBrush( RGB( clr1r, clr1g, clr1b ) ) ;
          SelectObject( hDC, hBrush ) ;

        FillRect( hDC, &rct, hBrush ) ;

        if( ! bHorz )
        {
                rct.top++ ;
        rct.bottom++ ;
        }
        else
        {
            rct.left++ ;
            rct.right++ ;
        }
      }
   }
    SelectObject( hDC, hOldBrush ) ;
    SelectObject( hDC, hOldPen ) ;
   DeleteObject( hBrush ) ;
   DeleteObject( hPen ) ;
   DeleteObject( hNull ) ;
}

//---------------------------------------------------------------------------//

void DegardeFill( HDC hDC, RECT* rct, COLORREF crStart, COLORREF crEnd, int bVertical )
    {
       int nSegments = 100;
       COLORREF cr;
       int nR      = GetRValue(crStart);
       int nG      = GetGValue(crStart);
       int nB      = GetBValue(crStart);
       int neB     = GetBValue(crEnd);
       int neG     = GetGValue(crEnd);
       int neR     = GetRValue(crEnd);
       int nDiffR  = (neR - nR);
       int nDiffG  = (neG - nG);
       int nDiffB  = (neB - nB);
       int ndR ;
       int ndG ;
       int ndB ;
       int nCX ;
       int nCY ;
       int nTop    = rct->top;
       int nBottom ; //= rct->bottom;
       int nLeft   = rct->left;
       int nRight ; // = rct->right;
       HBRUSH hBrush;
       RECT rc;

       int i;

       if( !bVertical )
       {
          if( nSegments > ( rct->right - rct->left ) )
          {
            nSegments = ( rct->right - rct->left );
          }
       }
       else
       {
          if( nSegments > ( rct->bottom - rct->top ) )
          {
            nSegments = ( rct->bottom - rct->top );
          }
       }

       ndR = 256 * (nDiffR) / (max(nSegments,1));
       ndG = 256 * (nDiffG) / (max(nSegments,1));
       ndB = 256 * (nDiffB) / (max(nSegments,1));
       nCX = (rct->right-rct->left) / max(nSegments,1);
       nCY = (rct->bottom-rct->top) / max(nSegments,1);

       nR *= 256;
       nG *= 256;
       nB *= 256;

       for (i = 0; i < nSegments; i++, nR += ndR, nG += ndG, nB += ndB)
       {

               if(i == (nSegments - 1))
               {
                  nRight  = rct->right;
                  nBottom = rct->bottom;
               }
               else
               {
                  nBottom = nTop + nCY;
                  nRight = nLeft + nCX;
               }

               cr = RGB(nR / 256, nG / 256, nB / 256);

               {
                  hBrush = CreateSolidBrush( cr );
                  if( bVertical )
                  {
                     rc.top    = nTop;
                     rc.left   = rct->left;
                     rc.bottom = nBottom + 1;
                     rc.right  = rct->right;
                  }
                  else
                  {
                     rc.top    = rct->top;
                     rc.left   = nLeft;
                     rc.bottom = rct->bottom;
                     rc.right  = nRight+1;
                  }
                  FillRect(hDC, &rc, hBrush );
                  DeleteObject( hBrush );
               }

               nLeft = nRight;
               nTop = nBottom;
       }
    }

//----------------------------------------------------------------------------//

COLORREF MixedColor(COLORREF colorA,COLORREF colorB)
{
  // ( 86a + 14b ) / 100
  int red   = MulDiv(86,GetRValue(colorA),100) + MulDiv(14,GetRValue(colorB),100);
  int green = MulDiv(86,GetGValue(colorA),100) + MulDiv(14,GetGValue(colorB),100);
  int blue  = MulDiv(86,GetBValue(colorA),100) + MulDiv(14,GetBValue(colorB),100);

  return RGB( min(red,0xff),min(green,0xff), min(blue,0xff));
}

//----------------------------------------------------------------------------//

COLORREF MidColor(COLORREF colorA,COLORREF colorB)
{
  // (7a + 3b)/10
  int red   = MulDiv(7,GetRValue(colorA),10) + MulDiv(3,GetRValue(colorB),10);
  int green = MulDiv(7,GetGValue(colorA),10) + MulDiv(3,GetGValue(colorB),10);
  int blue  = MulDiv(7,GetBValue(colorA),10) + MulDiv(3,GetBValue(colorB),10);

  return RGB( min(red,0xff),min(green,0xff), min(blue,0xff));
}

//----------------------------------------------------------------------------//

COLORREF GrayColor(COLORREF crColor)
{
  int Gray  = (((int)GetRValue(crColor)) + GetGValue(crColor) + GetBValue(crColor))/3;

  return RGB( Gray,Gray,Gray);
}

//----------------------------------------------------------------------------//

BOOL IsLightColor(COLORREF crColor)
{
  return (((int)GetRValue(crColor)) + GetGValue(crColor) + GetBValue(crColor))>(3*128);
}

//----------------------------------------------------------------------------//

COLORREF BleachColor(int Add, COLORREF color)
{
  return RGB( min (GetRValue(color)+Add, 255),
              min (GetGValue(color)+Add, 255),
              min (GetBValue(color)+Add, 255));
}

//------------------------------------------------------//

HB_FUNC( DARKENCOLORXP ) //COLORREF lcolor)
{
  COLORREF lcolor = hb_parnl(1);
  hb_retnl( RGB( MulDiv(GetRValue(lcolor),7,10),
                 MulDiv(GetGValue(lcolor),7,10),
                 MulDiv(GetBValue(lcolor)+55,7,10)) );
}
//------------------------------------------------------//

HB_FUNC( DARKENCOLOR ) // long lScale, COLORREF lColor)
{
  COLORREF lColor = hb_parnl(2);
  LONG lScale = hb_parni(1);

  long red   = MulDiv(GetRValue(lColor),(255-lScale),255);
  long green = MulDiv(GetGValue(lColor),(255-lScale),255);
  long blue  = MulDiv(GetBValue(lColor),(255-lScale),255);

  hb_retnl( RGB(red, green, blue));
}

//----------------------------------------------------------------------------//

COLORREF DarkenColor(long lScale, COLORREF lColor)
{

  long red   = MulDiv(GetRValue(lColor),(255-lScale),255);
  long green = MulDiv(GetGValue(lColor),(255-lScale),255);
  long blue  = MulDiv(GetBValue(lColor),(255-lScale),255);

  return( RGB(red, green, blue));
}

//-------------------------------------------------------//

HB_FUNC( LIGHTCOLOR ) //long lScale, COLORREF lColor)
{
  COLORREF lColor = hb_parnl(2);
  LONG lScale = hb_parni(1);

  long R = MulDiv(255-GetRValue(lColor),lScale,255)+GetRValue(lColor);
  long G = MulDiv(255-GetGValue(lColor),lScale,255)+GetGValue(lColor);
  long B = MulDiv(255-GetBValue(lColor),lScale,255)+GetBValue(lColor);

  hb_retnl( RGB(R, G, B) );
}

//----------------------------------------------------------------------------//

COLORREF LightenColor( long lScale, COLORREF lColor)
{
  long R = MulDiv(255-GetRValue(lColor),lScale,255)+GetRValue(lColor);
  long G = MulDiv(255-GetGValue(lColor),lScale,255)+GetGValue(lColor);
  long B = MulDiv(255-GetBValue(lColor),lScale,255)+GetBValue(lColor);

  return( RGB(R, G, B) );
}

//-------------------------------------//

HB_FUNC( DEGRADADO )
   {
           RECT rct;

           rct.top      = hb_parvni( 2, 1 );
           rct.left     = hb_parvni( 2, 2 );
           rct.bottom   = hb_parvni( 2, 3 );
           rct.right    = hb_parvni( 2, 4 );

           DegardeFill( ( HDC ) hb_parnl( 1 ) , &rct, hb_parnl( 3 ), hb_parnl( 4 ), hb_parl(5) );
   }

 //----------------------------------------------------------------------------//

 


Saludos

Lol trato de complar menu.c y da este error

Como es el parametro de compilacion

Code: Select all  Expand view


K:\v_xharb_v3>k:\bcc582\bin\make -fproy_h.mak
MAKE Version 5.2  Copyright (c) 1987, 2000 Borland
    echo -c -tWM -D__HARBOUR__ -DHB_API_MACROS > tmp
    echo -I\harbour\include;\fwh\include >> tmp
    \bcc582\bin\bcc32 -o.\obj_h\menu @tmp .\lc\menu.c
Embarcadero C++ 6.80 for Win32 Copyright (c) 1993-2014 Embarcadero Technologies, Inc.
.\lc\menu.c:
Error E2141 .\lc\menu.c 591: Declaration syntax error
Error E2223 .\lc\menu.c 596: Too many decimal points
*** 2 errors in Compile ***

 
Ruben Dario Gonzalez
Cali-Colombia
rubendariogd@hotmail.com - rubendariogd@gmail.com
User avatar
ruben Dario
 
Posts: 1061
Joined: Thu Sep 27, 2007 3:47 pm
Location: Colombia

Re: Compilando una rutina de menu

Postby cnavarro » Tue May 19, 2015 5:02 am

Que utilizas Harbour o XHarbour?
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Compilando una rutina de menu

Postby cnavarro » Tue May 19, 2015 5:07 am

Actualizado con distincion de versiones

Editado - 24/05/2015

https://www.dropbox.com/s/hd53bjvmxj36d ... u.zip?dl=0
Last edited by cnavarro on Sun May 24, 2015 8:13 pm, edited 1 time in total.
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

PreviousNext

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 17 guests