#include "Ribbon.ch"
#include "xBrowse.ch"
Static cActualTheme
//------------------------------------------------------------------------------------------------------------------------//
Function Main()
local oWnd
local oRibbon
local oGroup
local aDlgs
local bAction
local nOption
local nWidth
local nHeight
local nTopMargin
local cFont
local nFontSize
local cTheme
local cIniFile
local aBtn := Array(10)
local nBtnWidth
local nBtnHeight
local nRow, nCol
DEFINE WINDOW oWnd TITLE "Fivewin Ribbonbar" COLOR CLR_BLACK, RGB( 223, 223, 223 )
aDlgs := { ' File ', ' Home ', ' Insert ', ' Design ', ' Layout ', ' References ', ' Mailings ', ' Review ', ' View ' }
bAction := NIL
nOption := NIL
nWidth := NIL
nHeight := 120 // 135
nTopMargin := 40
cFont := "Segoe UI"
nFontSize := 14
cTheme := "RBarBlue"
cActualTheme := cTheme
cIniFile := ".\xRBar.ini"
oRibbon := TRibbonBar():New( oWnd, aDlgs, bAction, nOption, nWidth, nHeight, nTopMargin )
WITH OBJECT oRibbon
:nHeightFld := 24
:hSeparation := 4
:nLeftMargin := 10
:CalcPos()
END
oGroup := oRibbon:AddGroup( 240, "Theme", 1 )
nBtnWidth := 60
nBtnHeight := oGroup:nBottom - oGroup:nTop - 23
nRow := 5
nCol := 5
// oGroup:l2010 := .T.
@ nRow, nCol RBBTN aBtn[1];
PROMPT "Edit()";
SIZE nBtnWidth, nBtnHeight;
OF oGroup;
BORDER;
ROUND RSIZE 3;
TRANSPARENT;
ACTION ( EditTheme( .F., oRibbon, cActualTheme, cIniFile ),;
SetRibbonTheme( oRibbon, cActualTheme, cIniFile, cFont, nFontSize ),;
oRibbon:Refresh( .F. ) )
nCol += nBtnWidth + 4
@ nRow, nCol RBBTN aBtn[2];
PROMPT "New()";
SIZE nBtnWidth, nBtnHeight;
OF oGroup;
BORDER;
ROUND RSIZE 3;
TRANSPARENT;
ACTION EditTheme( .T., oRibbon,, cIniFile )
nCol += nBtnWidth + 4
@ nRow, nCol RBBTN aBtn[2];
PROMPT "Select()";
SIZE nBtnWidth, nBtnHeight;
OF oGroup;
BORDER;
ROUND RSIZE 3;
TRANSPARENT;
ACTION SelectTheme( cIniFile, cTheme, oRibbon, @cActualTheme )
oGroup := oRibbon:AddGroup( 260, "Font", 1 )
oGroup := oRibbon:AddGroup( 221, "Paragraph", 1 )
oGroup := oRibbon:addGroup( 320, "Styles", 1 )
SetRibbonTheme( oRibbon, cTheme, cIniFile, cFont, nFontSize )
oWnd:SetSize( 1000, 400 )
ACTIVATE WINDOW oWnd CENTER
Return NIL
//------------------------------------------------------------------------------------------------------------------------//
Function SetRibbonTheme( oRB, cTheme, cFile, cFont, nFontSize )
Local oDlg
Local oGroup
Local aTheme := GetRBTheme( cTheme, cFile )
DEFAULT cFont := "Segoe UI"
DEFAULT nFontSize := 14
If EmptY( aTheme )
MsgStop( "Theme " + cTheme + " not exist!" )
Return NIL
EndIf
oRb:oFont:End()
oRb:SetFont( TFont():New( cFont, 0, -nFontSize ) )
oRb:nClrPaneRB := aTheme[1]
oRb:nClrBoxOut := aTheme[4]
oRb:nClrBoxIn := aTheme[5]
oRb:nClrBoxSelOut := aTheme[6]
oRb:nClrBoxSelIn := aTheme[7]
oRb:aGrad := { { 1, aTheme[8], aTheme[9] } }
oRb:aGradFld := { |nOpt| If( nOpt == oRb:nStart, { { 1, aTheme[10], aTheme[11] } }, { { 1, aTheme[12], aTheme[13] } } ) }
oRb:aGradHigh := { { 1, aTheme[14], aTheme[15] } }
oRb:aGradOver := { { 1, aTheme[16], aTheme[17] } }
oRb:l2010 := .F.
oRb:l2013 := .F.
oRb:l2015 := .F.
oRb:l2016 := .F.
// Tabs colors
// aFill( oRb:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, aTheme[3], aTheme[2] ) } )
aFill( oRb:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, aTheme[3], If( oSelf:nOverPrompt( ScreenToClient( oRb:hWnd, GetCursorPos() )[ 1 ], ScreenToClient( oRb:hWnd, GetCursorPos() )[ 2 ] ) == nPrompt, aTheme[3], aTheme[2] ) ) } )
DeleteObject( oRb:hBmpBrushEx )
DeleteObject( oRb:hBrushEx )
oRb:hBmpBrushEx := GradientBmp( oRb, oRb:nRight - oRb:nRightMargin - 3, oRb:nBottom - oRb:nTopMargin + 1, oRb:aGrad )
oRb:hBrushEx := CreatePatternBrush( oRb:hBmpBrushEx )
FOR EACH oDlg IN oRb:aDialogs
oDlg:hBack := oRb:hBrushEx
oDlg:Refresh()
FOR EACH oGroup IN oDlg:aControls
If oGroup:IsKindOf( "TRBGROUP" )
oGroup:oFont:End()
oGroup:SetFont( TFont():New( cFont, 0, - ( nFontSize - 3 ) ) )
oGroup:nClrTxt := aTheme[18]
oGroup:nClrBoxIn := aTheme[19]
oGroup:nClrBoxOut := aTheme[20]
oGroup:aGradCaption := { { 1, aTheme[21], aTheme[22] } }
oGroup:aGradSel := { { 0.1, aTheme[23], aTheme[24] }, { 0.9, aTheme[25], aTheme[26] } }
oGroup:aGradDisable := { { 0.17, aTheme[27], aTheme[28] }, { 0.83, aTheme[29], aTheme[30] } }
oGroup:aGradDisableCaption := { { 1, aTheme[31], aTheme[32] } }
DeleteObject( oGroup:hBrushSel )
DeleteObject( oGroup:hBrushUnSel )
DeleteObject( oGroup:hBack )
oGroup:hBrushUnSel := oDlg:hBack
oGroup:hBack := oDlg:hBack
oGroup:Refresh()
EndIf
NEXT
NEXT
Return NIL
//------------------------------------------------------------------------------------------------------------------------//
Static Function GetRBTheme( cTheme, cFile )
Local aClr
Local uVal, n
Local cName
DEFAULT cTheme := "RBarBlue"
DEFAULT cFile := ".\RBar.ini"
If !File( cFile )
aClr := {}
cName := "RBarBlue"
aAdd( aClr, 10706986 )
aAdd( aClr, 16777215 )
aAdd( aClr, 0 )
aAdd( aClr, 10706986 )
aAdd( aClr, 12632256 )
aAdd( aClr, 10706986 )
aAdd( aClr, 12632256 )
aAdd( aClr, 14671839 )
aAdd( aClr, 14671839 )
aAdd( aClr, 12026427 )
aAdd( aClr, 12026427 )
aAdd( aClr, 12026427 )
aAdd( aClr, 16777143 )
aAdd( aClr, 10706986 )
aAdd( aClr, 10706986 )
aAdd( aClr, 12094016 )
aAdd( aClr, 16777215 )
aAdd( aClr, 0 )
aAdd( aClr, 16777215 )
aAdd( aClr, 12632256 )
aAdd( aClr, 13677677 )
aAdd( aClr, 16777215 )
aAdd( aClr, 16777215 )
aAdd( aClr, 16777215 )
aAdd( aClr, 16777215 )
aAdd( aClr, 16777215 )
aAdd( aClr, 12632256 )
aAdd( aClr, 12632256 )
aAdd( aClr, 16777215 )
aAdd( aClr, 16777215 )
aAdd( aClr, 12632256 )
aAdd( aClr, 12632256 )
WriteTheme( cName, aClr, cFile )
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
cName := "RBarDark"
aClr := {}
aAdd( aClr, 2039583 )
aAdd( aClr, 16777215 )
aAdd( aClr, 0 )
aAdd( aClr, 986895 )
aAdd( aClr, 12632256 )
aAdd( aClr, 986895 )
aAdd( aClr, 986895 )
aAdd( aClr, 9408399 )
aAdd( aClr, 11513775 )
aAdd( aClr, 4144959 )
aAdd( aClr, 9408399 )
aAdd( aClr, 4144959 )
aAdd( aClr, 9408399 )
aAdd( aClr, 2039583 )
aAdd( aClr, 986895 )
aAdd( aClr, 4144959 )
aAdd( aClr, 8355711 )
aAdd( aClr, 0 )
aAdd( aClr, 12566463 )
aAdd( aClr, 9408399 )
aAdd( aClr, 6250335 )
aAdd( aClr, 11513775 )
aAdd( aClr, 8355711 )
aAdd( aClr, 8355711 )
aAdd( aClr, 8355711 )
aAdd( aClr, 8355711 )
aAdd( aClr, 11513775 )
aAdd( aClr, 11513775 )
aAdd( aClr, 16777215 )
aAdd( aClr, 16777215 )
aAdd( aClr, 12632256 )
aAdd( aClr, 12632256 )
WriteTheme( cName, aClr, cFile )
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
cName := "RBarGreen"
aClr := {}
aAdd( aClr, 4616993 )
aAdd( aClr, 16777215 )
aAdd( aClr, 0 )
aAdd( aClr, 4616993 )
aAdd( aClr, 12632256 )
aAdd( aClr, 4616993 )
aAdd( aClr, 12632256 )
aAdd( aClr, 9698774 )
aAdd( aClr, 16777215 )
aAdd( aClr, 4616993 )
aAdd( aClr, 4616993 )
aAdd( aClr, 2855244 )
aAdd( aClr, 9698774 )
aAdd( aClr, 4616993 )
aAdd( aClr, 4616993 )
aAdd( aClr, 2855244 )
aAdd( aClr, 16777215 )
aAdd( aClr, 0 )
aAdd( aClr, 16777215 )
aAdd( aClr, 12632256 )
aAdd( aClr, 2335595 )
aAdd( aClr, 16777215 )
aAdd( aClr, 16777215 )
aAdd( aClr, 16777215 )
aAdd( aClr, 16777215 )
aAdd( aClr, 16777215 )
aAdd( aClr, 12632256 )
aAdd( aClr, 12632256 )
aAdd( aClr, 16777215 )
aAdd( aClr, 16777215 )
aAdd( aClr, 12632256 )
aAdd( aClr, 12632256 )
WriteTheme( cName, aClr, cFile )
EndIf
aClr := {}
n := 0
Do While .T.
n++
uVal := GetPvProfString( cTheme, StrZero( n, 2 ), "", cFile )
If !Empty( uVal )
aAdd( aClr, Val( uVal ) )
Else
EXIT
EndIf
EndDo
Return aClr
//------------------------------------------------------------------------------------------------------------------------//
Function EditTheme( lNew, oRb, cTheme, cIniFile )
Local aTheme
Local aTemp
Local oFont
Local oDlg
Local oBrw
Local oIni
Local n
DEFAULT lNew := .F.
DEFAULT cTheme := "RBarBlue"
If lNew
aTheme := GetRBTheme( "RBarBlue", cIniFile ) // A copy
oIni := TIni():New( cIniFile )
aTemp := oIni:Sections()
cTheme := PadR( "Theme " + StrZero( Len( aTemp ) + 1, 2 ), 20 )
If !MsgGet( "Theme name", "Theme editor", @cTheme )
Return NIL
EndIf
WriteTheme( cTheme, aTheme, cIniFile )
EndIf
aTheme := GetRBTheme( cTheme, cIniFile )
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 370, 400 PIXEL TRUEPIXEL FONT oFont TITLE "Theme: " + cTheme
@ 20,20 XBROWSE oBrw;
SIZE -20,-20;
PIXEL;
OF oDlg ;
DATASOURCE aTheme;
AUTOCOLS;
HEADERS "Colors";
CELL LINES NOBORDER FASTEDIT
WITH OBJECT oBrw
WITH OBJECT :AddCol()
:cHeader := "Number"
:bStrData := {|| StrZero( oBrw:nArrayAt, 2 ) }
:nDataStrAlign := AL_CENTER
END
WITH OBJECT :AddCol()
:cHeader := "Data"
:bStrData := { || DataNames()[ oBrw:nArrayAt ] }
END
WITH OBJECT :AddCol()
:cHeader := "Modify"
:nEditType := EDIT_BUTTON
:bEditBlock := { || ChangeColor( oBrw, oRb, cTheme, cIniFile ) }
END
:nStretchCol := STRETCHCOL_LAST
:bClrStd := {|| { CLR_HRED, oBrw:aArrayData[ oBrw:nArrayAt ] } }
:lHScroll := .F.
:nMarqueeStyle := 0
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED NOMODAL
RELEASE FONT oFont
Return NIL
//------------------------------------------------------------------------------------------------------------------------//
Static Function ChangeColor( oBrw, oRb, cTheme, cIniFile )
Local n := oBrw:nArrayAt
oBrw:aArrayData[n] := ChooseColor( oBrw:aArrayData[n] )
WriteTheme( cTheme, oBrw:aArrayData, cIniFile )
SetRibbonTheme( oRb, cTheme, cIniFile )
oRb:Refresh( .F. )
Return NIL
//------------------------------------------------------------------------------------------------------------------------//
Static Function WriteTheme( cTheme, aClr, cFile )
Local n
FOR n := 1 TO Len( aClr )
WritePProString( cTheme, StrZero( n, 2 ), cValToChar( aClr[n] ), cFile )
NEXT
SysRefresh()
Return NIL
//------------------------------------------------------------------------------------------------------------------------//
Static Function DataNames()
Local aTemp := { "nClrPaneRB",;
"aClrTabTxt - 1",;
"aClrTabTxt - 2",;
"nClrBoxOut",;
"nClrBoxIn",;
"nClrBoxSelOut",;
"nClrBoxSelIn",;
"aGrad - 1",;
"aGrad - 2",;
"aGradFld - 1",;
"aGradFld - 2",;
"aGradFld - 3",;
"aGradFld - 4",;
"aGradHigh - 1",;
"aGradHigh - 2",;
"aGradOver - 1",;
"aGradOver - 2",;
"nClrTxt",;
"nClrBoxIn",;
"nClrBoxOut",;
"aGradCaption - 1",;
"aGradCaption - 2",;
"aGradSel - 1",;
"aGradSel - 2",;
"aGradSel - 3",;
"aGradSel - 4",;
"aGradDisable - 1",;
"aGradDisable - 2",;
"aGradDisable - 3",;
"aGradDisable - 4",;
"aGradDisableCaption - 1",;
"aGradDisableCaption - 2" }
Return aTemp
//------------------------------------------------------------------------------------------------------------------------//
Function SelectTheme( cIniFile, cTheme, oRb, cActual )
local oDlg
local oIni := TIni():New( cIniFile )
local aItems := oIni:Sections()
DEFINE DIALOG oDlg FROM 5,10 TO 24, 55 TITLE "Select theme"
@ 1, 2 LISTBOX cTheme ITEMS aItems SIZE 145, 95 OF oDlg
@ 7, 7 BUTTON "&OK" OF oDlg SIZE 40, 12 ;
ACTION oDlg:End() DEFAULT
@ 7, 17 BUTTON "&Cancel" OF oDlg SIZE 40, 12 ;
ACTION ( cTheme := NIL, oDlg:End() )
ACTIVATE DIALOG oDlg CENTERED
If !Empty( cTheme )
cActual := cTheme
SetRibbonTheme( oRb, cTheme, cIniFile )
oRb:Refresh( .F. )
EndIf
Return NIL
//------------------------------------------------------------------------------------------------------------------------//
Silvio.Falconi wrote:I noticed that the rbtn buttons are not colored according to the color of the selected style, did you think of creating a special system for the buttons too?
#include "FiveWin.ch"
#include "Ribbon.ch"
#include "xBrowse.ch"
Static cActualTheme
//------------------------------------------------------------------------------------------------------------------------//
Function Main()
local oWnd
local oRibbon
local oGroup
local aDlgs
local bAction
local nOption
local nWidth
local nHeight
local nTopMargin
local cFont
local nFontSize
local cTheme
local cIniFile
local aBtn := Array(10)
local nBtnWidth
local nBtnHeight
local nRow, nCol
DEFINE WINDOW oWnd TITLE "Fivewin Ribbonbar" COLOR CLR_BLACK, RGB( 223, 223, 223 )
aDlgs := { ' File ', ' Home ', ' Insert ', ' Design ', ' Layout ', ' References ', ' Mailings ', ' Review ', ' View ' }
bAction := NIL
nOption := NIL
nWidth := NIL
nHeight := 120 // 135
nTopMargin := 40
cFont := "Segoe UI"
nFontSize := 14
cTheme := "RBarBlue"
cActualTheme := cTheme
cIniFile := ".\xRBar.ini"
oRibbon := TRibbonBar():New( oWnd, aDlgs, bAction, nOption, nWidth, nHeight, nTopMargin )
WITH OBJECT oRibbon
:nHeightFld := 24
:hSeparation := 4
:nLeftMargin := 10
:CalcPos()
END
oGroup := oRibbon:AddGroup( 240, "Theme", 1 )
nBtnWidth := 60
nBtnHeight := oGroup:nBottom - oGroup:nTop - 23
nRow := 5
nCol := 5
// oGroup:l2010 := .T.
@ nRow, nCol RBBTN aBtn[1];
PROMPT "Edit()";
SIZE nBtnWidth, nBtnHeight;
OF oGroup;
BORDER;
ROUND RSIZE 3;
TRANSPARENT;
ACTION ( EditTheme( .F., oRibbon, cActualTheme, cIniFile ),;
SetRibbonTheme( oRibbon, cActualTheme, cIniFile, cFont, nFontSize ),;
oRibbon:Refresh( .F. ) )
nCol += nBtnWidth + 4
@ nRow, nCol RBBTN aBtn[2];
PROMPT "New()";
SIZE nBtnWidth, nBtnHeight;
OF oGroup;
BORDER;
ROUND RSIZE 3;
TRANSPARENT;
ACTION EditTheme( .T., oRibbon,, cIniFile )
nCol += nBtnWidth + 4
@ nRow, nCol RBBTN aBtn[2];
PROMPT "Select()";
SIZE nBtnWidth, nBtnHeight;
OF oGroup;
BORDER;
ROUND RSIZE 3;
TRANSPARENT;
ACTION SelectTheme( cIniFile, cTheme, oRibbon, @cActualTheme )
oGroup := oRibbon:AddGroup( 260, "Font", 1 )
oGroup := oRibbon:AddGroup( 221, "Paragraph", 1 )
oGroup := oRibbon:addGroup( 320, "Styles", 1 )
SetRibbonTheme( oRibbon, cTheme, cIniFile, cFont, nFontSize )
oWnd:SetSize( 1000, 400 )
ACTIVATE WINDOW oWnd CENTER
Return NIL
//------------------------------------------------------------------------------------------------------------------------//
Function SetRibbonTheme( oRB, cTheme, cFile, cFont, nFontSize )
Local oDlg
Local oGroup
Local oBtn
Local aTheme := GetRBTheme( cTheme, cFile )
DEFAULT cFont := "Segoe UI"
DEFAULT nFontSize := 14
If EmptY( aTheme )
MsgStop( "Theme " + cTheme + " not exist!" )
Return NIL
EndIf
oRb:oFont:End()
oRb:SetFont( TFont():New( cFont, 0, -nFontSize ) )
oRb:nClrPaneRB := aTheme[1]
oRb:nClrBoxOut := aTheme[4]
oRb:nClrBoxIn := aTheme[5]
oRb:nClrBoxSelOut := aTheme[6]
oRb:nClrBoxSelIn := aTheme[7]
oRb:aGrad := { { 1, aTheme[8], aTheme[9] } }
oRb:aGradFld := { |nOpt| If( nOpt == oRb:nStart, { { 1, aTheme[10], aTheme[11] } }, { { 1, aTheme[12], aTheme[13] } } ) }
oRb:aGradHigh := { { 1, aTheme[14], aTheme[15] } }
oRb:aGradOver := { { 1, aTheme[16], aTheme[17] } }
oRb:l2010 := .F.
oRb:l2013 := .F.
oRb:l2015 := .F.
oRb:l2016 := .F.
// Tabs colors
// aFill( oRb:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, aTheme[3], aTheme[2] ) } )
aFill( oRb:aClrTabTxt, { | oSelf, nPrompt | If( nPrompt == oSelf:nOption, aTheme[3], If( oSelf:nOverPrompt( ScreenToClient( oRb:hWnd, GetCursorPos() )[ 1 ], ScreenToClient( oRb:hWnd, GetCursorPos() )[ 2 ] ) == nPrompt, aTheme[3], aTheme[2] ) ) } )
DeleteObject( oRb:hBmpBrushEx )
DeleteObject( oRb:hBrushEx )
oRb:hBmpBrushEx := GradientBmp( oRb, oRb:nRight - oRb:nRightMargin - 3, oRb:nBottom - oRb:nTopMargin + 1, oRb:aGrad )
oRb:hBrushEx := CreatePatternBrush( oRb:hBmpBrushEx )
FOR EACH oDlg IN oRb:aDialogs
oDlg:hBack := oRb:hBrushEx
oDlg:Refresh()
FOR EACH oGroup IN oDlg:aControls
If oGroup:IsKindOf( "TRBGROUP" )
oGroup:oFont:End()
oGroup:SetFont( TFont():New( cFont, 0, - ( nFontSize - 3 ) ) )
oGroup:nClrTxt := aTheme[18]
oGroup:nClrBoxIn := aTheme[19]
oGroup:nClrBoxOut := aTheme[20]
oGroup:aGradCaption := { { 1, aTheme[21], aTheme[22] } }
oGroup:aGradSel := { { 0.1, aTheme[23], aTheme[24] }, { 0.9, aTheme[25], aTheme[26] } }
oGroup:aGradDisable := { { 0.17, aTheme[27], aTheme[28] }, { 0.83, aTheme[29], aTheme[30] } }
oGroup:aGradDisableCaption := { { 1, aTheme[31], aTheme[32] } }
DeleteObject( oGroup:hBrushSel )
DeleteObject( oGroup:hBrushUnSel )
DeleteObject( oGroup:hBack )
oGroup:hBrushUnSel := oDlg:hBack
oGroup:hBack := oDlg:hBack
FOR EACH oBtn IN oGroup:aControls
If oBtn:IsKindOf( "TRBTN" )
oBtn:oFont:End()
oBtn:SetFont( TFont():New( cFont, 0, - ( nFontSize - 3 ) ) )
oBtn:bClrGradNormal := { | lPressed | If( lPressed, { { 1, aTheme[10], aTheme[11] } }, { { 1, aTheme[12], aTheme[13] } } ) }
oBtn:aClrGradBack := oRb:aGrad
oBtn:nClrBoxIn := oGroup:nClrBoxIn
oBtn:nClrBoxOut := oGroup:nClrBoxOut
oBtn:Refresh()
EndIf
NEXT
oGroup:Refresh()
EndIf
NEXT
NEXT
Return NIL
//------------------------------------------------------------------------------------------------------------------------//
Static Function GetRBTheme( cTheme, cFile )
Local aClr
Local uVal, n
Local cName
DEFAULT cTheme := "RBarBlue"
DEFAULT cFile := ".\RBar.ini"
If !File( cFile )
aClr := {}
cName := "RBarBlue"
aAdd( aClr, 10706986 )
aAdd( aClr, 16777215 )
aAdd( aClr, 0 )
aAdd( aClr, 10706986 )
aAdd( aClr, 12632256 )
aAdd( aClr, 10706986 )
aAdd( aClr, 12632256 )
aAdd( aClr, 14671839 )
aAdd( aClr, 14671839 )
aAdd( aClr, 12026427 )
aAdd( aClr, 12026427 )
aAdd( aClr, 12026427 )
aAdd( aClr, 16777143 )
aAdd( aClr, 10706986 )
aAdd( aClr, 10706986 )
aAdd( aClr, 12094016 )
aAdd( aClr, 16777215 )
aAdd( aClr, 0 )
aAdd( aClr, 16777215 )
aAdd( aClr, 12632256 )
aAdd( aClr, 13677677 )
aAdd( aClr, 16777215 )
aAdd( aClr, 16777215 )
aAdd( aClr, 16777215 )
aAdd( aClr, 16777215 )
aAdd( aClr, 16777215 )
aAdd( aClr, 12632256 )
aAdd( aClr, 12632256 )
aAdd( aClr, 16777215 )
aAdd( aClr, 16777215 )
aAdd( aClr, 12632256 )
aAdd( aClr, 12632256 )
WriteTheme( cName, aClr, cFile )
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
cName := "RBarDark"
aClr := {}
aAdd( aClr, 2039583 )
aAdd( aClr, 16777215 )
aAdd( aClr, 0 )
aAdd( aClr, 986895 )
aAdd( aClr, 12632256 )
aAdd( aClr, 986895 )
aAdd( aClr, 986895 )
aAdd( aClr, 9408399 )
aAdd( aClr, 11513775 )
aAdd( aClr, 4144959 )
aAdd( aClr, 9408399 )
aAdd( aClr, 4144959 )
aAdd( aClr, 9408399 )
aAdd( aClr, 2039583 )
aAdd( aClr, 986895 )
aAdd( aClr, 4144959 )
aAdd( aClr, 8355711 )
aAdd( aClr, 0 )
aAdd( aClr, 12566463 )
aAdd( aClr, 9408399 )
aAdd( aClr, 6250335 )
aAdd( aClr, 11513775 )
aAdd( aClr, 8355711 )
aAdd( aClr, 8355711 )
aAdd( aClr, 8355711 )
aAdd( aClr, 8355711 )
aAdd( aClr, 11513775 )
aAdd( aClr, 11513775 )
aAdd( aClr, 16777215 )
aAdd( aClr, 16777215 )
aAdd( aClr, 12632256 )
aAdd( aClr, 12632256 )
WriteTheme( cName, aClr, cFile )
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
cName := "RBarGreen"
aClr := {}
aAdd( aClr, 4616993 )
aAdd( aClr, 16777215 )
aAdd( aClr, 0 )
aAdd( aClr, 4616993 )
aAdd( aClr, 12632256 )
aAdd( aClr, 4616993 )
aAdd( aClr, 12632256 )
aAdd( aClr, 9698774 )
aAdd( aClr, 16777215 )
aAdd( aClr, 4616993 )
aAdd( aClr, 4616993 )
aAdd( aClr, 2855244 )
aAdd( aClr, 9698774 )
aAdd( aClr, 4616993 )
aAdd( aClr, 4616993 )
aAdd( aClr, 2855244 )
aAdd( aClr, 16777215 )
aAdd( aClr, 0 )
aAdd( aClr, 16777215 )
aAdd( aClr, 12632256 )
aAdd( aClr, 2335595 )
aAdd( aClr, 16777215 )
aAdd( aClr, 16777215 )
aAdd( aClr, 16777215 )
aAdd( aClr, 16777215 )
aAdd( aClr, 16777215 )
aAdd( aClr, 12632256 )
aAdd( aClr, 12632256 )
aAdd( aClr, 16777215 )
aAdd( aClr, 16777215 )
aAdd( aClr, 12632256 )
aAdd( aClr, 12632256 )
WriteTheme( cName, aClr, cFile )
EndIf
aClr := {}
n := 0
Do While .T.
n++
uVal := GetPvProfString( cTheme, StrZero( n, 2 ), "", cFile )
If !Empty( uVal )
aAdd( aClr, Val( uVal ) )
Else
EXIT
EndIf
EndDo
Return aClr
//------------------------------------------------------------------------------------------------------------------------//
Function EditTheme( lNew, oRb, cTheme, cIniFile )
Local aTheme
Local aTemp
Local oFont
Local oDlg
Local oBrw
Local oIni
Local n
DEFAULT lNew := .F.
DEFAULT cTheme := "RBarBlue"
If lNew
aTheme := GetRBTheme( "RBarBlue", cIniFile ) // A copy
oIni := TIni():New( cIniFile )
aTemp := oIni:Sections()
cTheme := PadR( "Theme " + StrZero( Len( aTemp ) + 1, 2 ), 20 )
If !MsgGet( "Theme name", "Theme editor", @cTheme )
Return NIL
EndIf
WriteTheme( cTheme, aTheme, cIniFile )
EndIf
aTheme := GetRBTheme( cTheme, cIniFile )
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 370, 400 PIXEL TRUEPIXEL FONT oFont TITLE "Theme: " + cTheme
@ 20,20 XBROWSE oBrw;
SIZE -20,-20;
PIXEL;
OF oDlg ;
DATASOURCE aTheme;
AUTOCOLS;
HEADERS "Colors";
CELL LINES NOBORDER FASTEDIT
WITH OBJECT oBrw
WITH OBJECT :AddCol()
:cHeader := "Number"
:bStrData := {|| StrZero( oBrw:nArrayAt, 2 ) }
:nDataStrAlign := AL_CENTER
END
WITH OBJECT :AddCol()
:cHeader := "Data"
:bStrData := { || DataNames()[ oBrw:nArrayAt ] }
END
WITH OBJECT :AddCol()
:cHeader := "Modify"
:nEditType := EDIT_BUTTON
:bEditBlock := { || ChangeColor( oBrw, oRb, cTheme, cIniFile ) }
END
:nStretchCol := STRETCHCOL_LAST
:bClrStd := {|| { CLR_HRED, oBrw:aArrayData[ oBrw:nArrayAt ] } }
:lHScroll := .F.
:nMarqueeStyle := 0
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED NOMODAL
RELEASE FONT oFont
Return NIL
//------------------------------------------------------------------------------------------------------------------------//
Static Function ChangeColor( oBrw, oRb, cTheme, cIniFile )
Local n := oBrw:nArrayAt
oBrw:aArrayData[n] := ChooseColor( oBrw:aArrayData[n] )
WriteTheme( cTheme, oBrw:aArrayData, cIniFile )
SetRibbonTheme( oRb, cTheme, cIniFile )
oRb:Refresh( .F. )
Return NIL
//------------------------------------------------------------------------------------------------------------------------//
Static Function WriteTheme( cTheme, aClr, cFile )
Local n
FOR n := 1 TO Len( aClr )
WritePProString( cTheme, StrZero( n, 2 ), cValToChar( aClr[n] ), cFile )
NEXT
SysRefresh()
Return NIL
//------------------------------------------------------------------------------------------------------------------------//
Static Function DataNames()
Local aTemp := { "nClrPaneRB",;
"aClrTabTxt - 1",;
"aClrTabTxt - 2",;
"nClrBoxOut",;
"nClrBoxIn",;
"nClrBoxSelOut",;
"nClrBoxSelIn",;
"aGrad - 1",;
"aGrad - 2",;
"aGradFld - 1",;
"aGradFld - 2",;
"aGradFld - 3",;
"aGradFld - 4",;
"aGradHigh - 1",;
"aGradHigh - 2",;
"aGradOver - 1",;
"aGradOver - 2",;
"nClrTxt",;
"nClrBoxIn",;
"nClrBoxOut",;
"aGradCaption - 1",;
"aGradCaption - 2",;
"aGradSel - 1",;
"aGradSel - 2",;
"aGradSel - 3",;
"aGradSel - 4",;
"aGradDisable - 1",;
"aGradDisable - 2",;
"aGradDisable - 3",;
"aGradDisable - 4",;
"aGradDisableCaption - 1",;
"aGradDisableCaption - 2" }
Return aTemp
//------------------------------------------------------------------------------------------------------------------------//
Function SelectTheme( cIniFile, cTheme, oRb, cActual )
local oDlg
local oIni := TIni():New( cIniFile )
local aItems := oIni:Sections()
DEFINE DIALOG oDlg FROM 5,10 TO 24, 55 TITLE "Select theme"
@ 1, 2 LISTBOX cTheme ITEMS aItems SIZE 145, 95 OF oDlg
@ 7, 7 BUTTON "&OK" OF oDlg SIZE 40, 12 ;
ACTION oDlg:End() DEFAULT
@ 7, 17 BUTTON "&Cancel" OF oDlg SIZE 40, 12 ;
ACTION ( cTheme := NIL, oDlg:End() )
ACTIVATE DIALOG oDlg CENTERED
If !Empty( cTheme )
cActual := cTheme
SetRibbonTheme( oRb, cTheme, cIniFile )
oRb:Refresh( .F. )
EndIf
Return NIL
//------------------------------------------------------------------------------------------------------------------------//
METHOD SetStyles( l2010, l2013, l2015, nTopMargin, nClrPaneRB, nClrBoxOut, nClrBoxIn,;
nClrBoxSelOut, nClrBoxSelIn, aGrad, aGradFld, aGradHigh, aGradOver, l2016 ) CLASS TRibbonBar
#Include "FiveWin.ch"
#define CLR_MSPURPLE RGB( 0, 120, 215 )
#define CLR_MSRED RGB( 232, 17, 35 )
#define CLR_MSGRAY RGB( 229, 229, 229 )
STATIC oFontMenu, oFont, oWnd
FUNCTION Main()
LOCAL oImage
LOCAL ScreenWidth := GetSysMetrics(0), ScreenHeight := GetSysMetrics(1)
LOCAL cFont := "Tahoma"
LOCAL cFontH := -14
LOCAL oBar
DEFINE FONT oFontMenu NAME cFont SIZE 0, cFontH WEIGHT 300
DEFINE FONT oFont NAME cFont SIZE 0, cFontH - 2 // WEIGHT 300
DEFINE WINDOW oWnd STYLE WS_POPUP FROM 0, 0 TO ScreenHeight, ScreenWidth ;
PIXEL NOSYSMENU NOICONIZE COLOR CLR_RED,CLR_RED ;
MENU MyMenu()
DEFINE BUTTONBAR oBar LEFT SIZE 100,100 COLOR RGB(1,1,1) NOBORDER OF oWnd FLAT
oImage := TImage():Define( , "..\BITMAPS\brush1.bmp", oWnd )
//oWnd:bPainted := {|hDC| PalBmpDraw( hDC, 0, 0, oImage:hBitmap, oImage:hPalette, ScreenWidth, ScreenHeight, , .T., Chr(0) ) }
oWnd:SetFont( oFont )
oWnd:Center()
ACTIVATE WINDOW oWnd MAXIMIZED
RETURN NIL
FUNCTION MyMenu()
LOCAL oMenu
MENU oMenu HEIGHT -4.8 FLAT COLORMENU RGB(1,1,1), CLR_MSPURPLE ;
COLORLINEBOTTOM RGB(1,1,1) FONT oFontMenu NOBORDER // 2013
MENUITEM "&Archivos"
MENU FLAT NOBORDER
MENUITEM "&Clientes" // ACTION Clientes(user)
MENUITEM "&Proveedores" // ACTION Proveed()
MENUITEM "&Stocks" // ACTION Stock()
MENUITEM "&Componentes" // ACTION iStock()
MENUITEM "&Cuentas Corrientes por Cliente" // ACTION CtacteT()
MENUITEM "&Vendedores" // ACTION Vendedor()
MENUITEM "&Comprobantes Emitidos" // ACTION Facremit()
MENUITEM "&Cobranzas" // ACTION Vfacrem()
MENUITEM "&Recibos" // ACTION Recibo1()
MENUITEM "&Transporte" // ACTION Tra()
MENUITEM "&Generar Etiquetas Precios y Cod. Barr." // ACTION mainprub()
MENUITEM "&Generar Etiquetas Precios y Cod. Barr." // ACTION pruebax()
ENDMENU
MENUITEM "&Ventas"
MENU
MENUITEM oemtoansi("&Facturaci¢n") // Action (xtipo:= "factura",GRID())
MENUITEM oemtoansi("&Facturaci¢n PRUEBA") // Action (xtipo:= "factura",SBARRAY())
MENUITEM oemtoansi("&Remitos") // Action ( xtipo:= "remito",RGRID())
MENUITEM oemtoansi("&Pedidos") // Action (xtipo:= "pedido",PGRID())
ENDMENU
MENUITEM "&Compras"
MENU
MENUITEM oemtoansi("&Compras") // Action cGRID()
MENUITEM oemtoansi("&Consultas Compras x Proveedores Facturas") // Action ( compras() )
MENUITEM oemtoansi("&Consultas Compras x Proveedores Totales ") // Action ( comprasp() )
MENUITEM oemtoansi("&Cuentas Corrientes Proveedores") // Action ( CTACTET1() )
ENDMENU
MENUITEM "Caja"
MENU
MENUITEM "&Caja" // ACTION Caja()
MENUITEM "Tarjetas de &credito" // ACTION TARJETA()
ENDMENU
MENUITEM "Cheques"
MENU
MENUITEM "C&heques" // ACTION CHEQUE()
MENUITEM "Vencimietos de C&heques" // ACTION cCHEck()
ENDMENU
MENUITEM "Bancos"
MENU
MENUITEM "&Cuentas " // ACTION CUENTAS()
MENUITEM "&Movimientos Bancarios " // ACTION Movban()
MENUITEM "&Cuentas/Saldos " // ACTION Salban()
MENUITEM "&Importar desde Excel " // action (rBancosS(),impoexcel1c())
ENDMENU
MENUITEM "&Libros IVA"
MENU
MENUITEM "&IVA Ventas" // ACTION livav()
MENUITEM "&Exportar a Regimen Informacion Ventas Comprobantes" // ACTION CITIVC()
MENUITEM "&Exportar a Regimen Informacion Ventas Alicuotas" // ACTION CITIVCA()
MENUITEM oemtoansi("&IVA Compras") // Action livac()
MENUITEM "&Exportar a Regimen Informacion Compras Comprobantes" // ACTION CITICC()
MENUITEM "&Exportar a Regimen Informacion Compras Alicuotas" // ACTION CITICCA()
ENDMENU
MENUITEM "&Informes y Estadisticas"
MENU
MENUITEM "&Ventas Diarias y Mensuales" // action Vdym()
*MENUITEM "&Ventas Diarias y Mensuales por horario" // *action Vdymh()
MENUITEM "&Ventas Diarias y Mensuales Por Rubro" // action Vdym2()
MENUITEM "&Ventas Diarias y Mensuales Por Vendedor" // action Vdymv()
MENUITEM "&Presupuestos / Pedidos Diarios y Mensuales Por Cliente detallada" // action Vdyp()
MENUITEM "&Presupuestos / Pedidos diarios y mensuales" // action Vdymp()
MENUITEM "&Listado de Precios 1 " // action (repLPRE(),lstoc())
MENUITEM "&Listado de Precios 2 " // action (repLPRE(),lstoc1())
MENUITEM "&Listado de Precios 3 " // action (repLPRE(),lstoc2())
MENUITEM "&Listado de Precios 4 " // action (repLPRE(),lstoc3())
ENDMENU
MENUITEM OEMTOANSI("Configuraci¢n")
MENU
MENUITEM "&Empresa" // ACTION empresa()
MENUITEM "&Back Up de Archivos" // ACTION czip()
MENUITEM "&Restaurar Archivos" // ACTION dzip()
MENUITEM "&Numeracion de Comprobantes" // ACTION talonar()
MENUITEM "&Rubros" // ACTION Rubro()
MENUITEM "&Rubros Compras" // ACTION Rubroc()
MENUITEM "&Cotizacion Monedas" // ACTION Cotiz()
MENUITEM "&Usuarios" // ACTION User()
MENUITEM "&Reorganizacion de archivos" // ACTION Indexa()
MENUITEM "&Modificacion de Codigo Stock" // ACTION Mstock()
MENUITEM "&Texto" // ACTION clausula()
MENUITEM "&Datos Conexion" // ACTION Dconex()
MENUITEM "&Aumento de Precios" // ACTION Aumento()
ENDMENU
MENUITEM "&Salir" ACTION ( oWnd:End() )
MENUITEM ""
MENUITEM ""
MENUITEM ""
MENUITEM ""
MENUITEM ""
MENUITEM ""
MENUITEM ""
MENUITEM ""
// MENUITEM "-" //FONT oFont
// MENUITEM "x" //FONT oFont
ENDMENU
RETURN( oMenu )
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 66 guests