From c20d0cbbabdbd258a57ceb1fb6211f87ae341ec7 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Thu, 8 Jul 2010 01:48:10 +0000 Subject: [PATCH] 2010-07-07 18:44 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbide/idemisc.prg * contrib/hbide/idesaveload.prg * contrib/hbide/idestylesheets.prg * contrib/hbide/setup.ui + Implemented: application of constructed gradients to hbIDE components. Now n number of gradients can be defined to be applied to hbIDE. "Toggle Animation" respects these settings as well. provides you with necessary constructs to define and apply. Still the last applied is not saved: TODO. So next run will revert to defaults as per animation mode. --- harbour/ChangeLog | 12 ++++ harbour/contrib/hbide/idemisc.prg | 34 +++++++++++ harbour/contrib/hbide/idesaveload.prg | 78 +++++++++++++++++++----- harbour/contrib/hbide/idestylesheets.prg | 17 +++++- harbour/contrib/hbide/setup.ui | 52 +++++++++++++++- 5 files changed, 175 insertions(+), 18 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index da27b4576b..3d5e2d9dab 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,18 @@ The license applies to all entries newer than 2009-04-28. */ +2010-07-07 18:44 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbide/idemisc.prg + * contrib/hbide/idesaveload.prg + * contrib/hbide/idestylesheets.prg + * contrib/hbide/setup.ui + + Implemented: application of constructed gradients to hbIDE components. + Now n number of gradients can be defined to be applied to + hbIDE. "Toggle Animation" respects these settings as well. + provides you with necessary constructs + to define and apply. Still the last applied is not saved: TODO. + So next run will revert to defaults as per animation mode. + 2010-07-07 23:11 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * src/rdd/sdf1.c * src/rdd/delim1.c diff --git a/harbour/contrib/hbide/idemisc.prg b/harbour/contrib/hbide/idemisc.prg index 216ed8371b..c7c10539e6 100644 --- a/harbour/contrib/hbide/idemisc.prg +++ b/harbour/contrib/hbide/idemisc.prg @@ -1996,6 +1996,40 @@ FUNCTION hbide_parseKeywordsComponents( cStr ) /*----------------------------------------------------------------------*/ +FUNCTION hbide_parseThemeComponent( cComponent ) + LOCAL i, a_, n + + a_:= hb_aTokens( cComponent, "," ) + + aSize( a_, 6 ) + DEFAULT a_[ 1 ] TO "" + DEFAULT a_[ 2 ] TO "" + DEFAULT a_[ 3 ] TO "" + DEFAULT a_[ 4 ] TO "" + DEFAULT a_[ 5 ] TO "" + DEFAULT a_[ 6 ] TO "" + a_[ 1 ] := alltrim( a_[ 1 ] ) + a_[ 2 ] := alltrim( a_[ 2 ] ) + a_[ 3 ] := alltrim( a_[ 3 ] ) + a_[ 4 ] := alltrim( a_[ 4 ] ) + a_[ 5 ] := alltrim( a_[ 5 ] ) + a_[ 6 ] := alltrim( a_[ 6 ] ) + + FOR i := 2 TO 6 + IF !empty( a_[ i ] ) + a_[ i ] := hb_aTokens( a_[ i ], " " ) + FOR EACH n IN a_[ i ] + n := val( n ) + NEXT + ELSE + a_[ i ] := {} + ENDIF + NEXT + + RETURN a_ + +/*----------------------------------------------------------------------*/ + FUNCTION hbide_SetWrkFolderLast( cPathFile ) LOCAL cPth, cOldPath diff --git a/harbour/contrib/hbide/idesaveload.prg b/harbour/contrib/hbide/idesaveload.prg index 377007228b..978caf3f7c 100644 --- a/harbour/contrib/hbide/idesaveload.prg +++ b/harbour/contrib/hbide/idesaveload.prg @@ -847,6 +847,7 @@ CLASS IdeSetup INHERIT IdeObject METHOD fetchThemeColorsString( nSlot ) METHOD pushThemeColors( nTheme ) METHOD pushThemesData() + METHOD getThemeData( nTheme ) ENDCLASS @@ -903,7 +904,7 @@ METHOD IdeSetup:setIcons() ::oUI:q_buttonThmAdd : setIcon( hbide_image( "dc_plus" ) ) ::oUI:q_buttonThmDel : setIcon( hbide_image( "dc_delete" ) ) - ::oUI:q_buttonThmCpy : setIcon( hbide_image( "copy" ) ) + ::oUI:q_buttonThmApp : setIcon( hbide_image( "copy" ) ) ::oUI:q_buttonThmSav : setIcon( hbide_image( "save" ) ) RETURN Self @@ -935,6 +936,23 @@ METHOD IdeSetup:disConnectSlots() ::disconnect( ::oUI:q_checkHorzRuler , "stateChanged(int)" ) ::disconnect( ::oUI:q_checkLineNumbers, "stateChanged(int)" ) + ::disconnect( ::oUI:q_sliderRed , "valueChanged(int)" ) + ::disconnect( ::oUI:q_sliderGreen , "valueChanged(int)" ) + ::disconnect( ::oUI:q_sliderBlue , "valueChanged(int)" ) + + ::disconnect( ::oUI:q_radioSec1 , "clicked()" ) + ::disconnect( ::oUI:q_radioSec2 , "clicked()" ) + ::disconnect( ::oUI:q_radioSec3 , "clicked()" ) + ::disconnect( ::oUI:q_radioSec4 , "clicked()" ) + ::disconnect( ::oUI:q_radioSec5 , "clicked()" ) + + ::disconnect( ::oUI:q_buttonThmAdd , "clicked()" ) + ::disconnect( ::oUI:q_buttonThmDel , "clicked()" ) + ::disconnect( ::oUI:q_buttonThmApp , "clicked()" ) + ::disconnect( ::oUI:q_buttonThmSav , "clicked()" ) + + ::disconnect( ::oUI:q_listThemes , "currentRowChanged(int)" ) + RETURN Self /*----------------------------------------------------------------------*/ @@ -976,7 +994,7 @@ METHOD IdeSetup:connectSlots() ::connect( ::oUI:q_buttonThmAdd , "clicked()" , {| | ::execEvent( "buttonThmAdd_clicked" ) } ) ::connect( ::oUI:q_buttonThmDel , "clicked()" , {| | ::execEvent( "buttonThmDel_clicked" ) } ) - ::connect( ::oUI:q_buttonThmCpy , "clicked()" , {| | ::execEvent( "buttonThmCpy_clicked" ) } ) + ::connect( ::oUI:q_buttonThmApp , "clicked()" , {| | ::execEvent( "buttonThmApp_clicked" ) } ) ::connect( ::oUI:q_buttonThmSav , "clicked()" , {| | ::execEvent( "buttonThmSav_clicked" ) } ) ::connect( ::oUI:q_listThemes , "currentRowChanged(int)" , {|i| ::execEvent( "listThemes_currentRowChanged", i ) } ) @@ -1018,9 +1036,9 @@ METHOD IdeSetup:retrieve() s := substr( s, 1, len( s ) - 1 ) ::oINI:cTextFileExtensions := s - ::oINI:nTmpBkpPrd := val( ::oUI:q_editTmpBkpPrd : text() ) - ::oINI:cBkpPath := ::oUI:q_editBkpPath : text() - ::oINI:cBkpSuffix := ::oUI:q_editBkpSuffix : text() + ::oINI:nTmpBkpPrd := val( ::oUI:q_editTmpBkpPrd : text() ) + ::oINI:cBkpPath := ::oUI:q_editBkpPath : text() + ::oINI:cBkpSuffix := ::oUI:q_editBkpSuffix : text() ::oINI:lCompletionWithArgs := ::oUI:q_checkListlWithArgs : isChecked() ::oINI:lCompleteArgumented := ::oUI:q_checkCmplInclArgs : isChecked() @@ -1096,10 +1114,10 @@ METHOD IdeSetup:populate() ::oUI:q_editSec1:setReadOnly( .t. ) ::oUI:q_editSec5:setReadOnly( .t. ) - ::pushThemesData() - ::connectSlots() + ::pushThemesData() + RETURN Self /*----------------------------------------------------------------------*/ @@ -1355,7 +1373,11 @@ METHOD IdeSetup:execEvent( cEvent, p, p1 ) ::oUI:q_listThemes:setCurrentRow( len( ::oINI:aAppThemes ) - 1 ) ENDIF EXIT - CASE "buttonThmCpy_clicked" + CASE "buttonThmApp_clicked" + IF ( n := ::oUI:q_listThemes:currentRow() ) > -1 + hbide_setAppTheme( ::getThemeData( n + 1 ) ) + ::oDK:animateComponents( HBIDE_ANIMATION_GRADIENT ) + ENDIF EXIT CASE "buttonThmDel_clicked" EXIT @@ -1375,14 +1397,18 @@ METHOD IdeSetup:execEvent( cEvent, p, p1 ) METHOD IdeSetup:pushThemesData() LOCAL s, a_, qItem - FOR EACH s IN ::oINI:aAppThemes - a_:= hb_aTokens( s, "," ) - qItem := QListWidgetItem():new() - qItem:setText( a_[ 1 ] ) - ::oUI:q_listThemes:addItem_1( qItem ) - ::pushThemeColors( s:__enumIndex() ) - NEXT + IF ::nCurThemeSlot == 0 + FOR EACH s IN ::oINI:aAppThemes + a_:= hb_aTokens( s, "," ) + qItem := QListWidgetItem():new() + qItem:setText( a_[ 1 ] ) + ::oUI:q_listThemes:addItem_1( qItem ) + ::pushThemeColors( s:__enumIndex() ) + NEXT + ENDIF IF !empty( ::oINI:aAppThemes ) + ::oUI:q_listThemes:setCurrentRow( -1 ) + ::oUI:q_listThemes:setCurrentRow( len( ::oINI:aAppThemes ) - 1 ) ::oUI:q_listThemes:setCurrentRow( 0 ) ENDIF ::oUI:q_radioSec1:click() @@ -1391,6 +1417,23 @@ METHOD IdeSetup:pushThemesData() /*------------------------------------------------------------------------*/ +METHOD IdeSetup:getThemeData( nTheme ) + LOCAL a_, i, aTheme := {} + + IF nTheme >= 1 .AND. nTheme <= len( ::oINI:aAppThemes ) + a_:= hbide_parseThemeComponent( ::oINI:aAppThemes[ nTheme ] ) + + FOR i := 2 TO 6 + IF !empty( a_[ i ] ) + aadd( aTheme, a_[ i ] ) + ENDIF + NEXT + ENDIF + + RETURN aTheme + +/*----------------------------------------------------------------------*/ + METHOD IdeSetup:pushThemeColors( nTheme ) LOCAL n, a_, i, aRGB, nSlot @@ -1412,6 +1455,7 @@ METHOD IdeSetup:pushThemeColors( nTheme ) n := val( n ) NEXT { ::oUI:q_editSec1, ::oUI:q_editSec2, ::oUI:q_editSec3, ::oUI:q_editSec4, ::oUI:q_editSec5 }[ nSlot ]:setText( hb_ntos( aRGB[ 1 ] ) ) + ::populateThemeColors( nSlot, { aRGB[ 2 ], aRGB[ 3 ], aRGB[ 4 ] } ) ENDIF NEXT @@ -1423,11 +1467,15 @@ METHOD IdeSetup:pushThemeColors( nTheme ) /*------------------------------------------------------------------------*/ METHOD IdeSetup:populateThemeColors( nSlot, aRGB ) + LOCAL qFrame { ::oUI:q_editR1, ::oUI:q_editR2, ::oUI:q_editR3, ::oUI:q_editR4, ::oUI:q_editR5 }[ nSlot ]:setText( hb_ntos( aRGB[ 1 ] ) ) { ::oUI:q_editG1, ::oUI:q_editG2, ::oUI:q_editG3, ::oUI:q_editG4, ::oUI:q_editG5 }[ nSlot ]:setText( hb_ntos( aRGB[ 2 ] ) ) { ::oUI:q_editB1, ::oUI:q_editB2, ::oUI:q_editB3, ::oUI:q_editB4, ::oUI:q_editB5 }[ nSlot ]:setText( hb_ntos( aRGB[ 3 ] ) ) + qFrame := { ::oUI:q_frameSec1, ::oUI:q_frameSec2, ::oUI:q_frameSec3, ::oUI:q_frameSec4, ::oUI:q_frameSec5 }[ nSlot ] + qFrame:setStyleSheet( "background-color: " + hbide_rgbString( aRGB ) + ";" ) + RETURN Self /*------------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/idestylesheets.prg b/harbour/contrib/hbide/idestylesheets.prg index b55ffc87fb..f1bcd363aa 100644 --- a/harbour/contrib/hbide/idestylesheets.prg +++ b/harbour/contrib/hbide/idestylesheets.prg @@ -69,6 +69,17 @@ /*----------------------------------------------------------------------*/ +FUNCTION hbide_setAppTheme( aTheme ) + LOCAL oTheme + STATIC sTheme + oTheme := sTheme + IF hb_isArray( aTheme ) + sTheme := aTheme + ENDIF + RETURN oTheme + +/*----------------------------------------------------------------------*/ + FUNCTION GetStyleSheet( cWidget, nMode ) LOCAL txt_:= {} LOCAL s := "" @@ -487,7 +498,11 @@ STATIC FUNCTION hbide_loadIdeTheme( nTheme ) // DO CASE CASE nTheme == 1 - RETURN { {0,255,255,255}, {0.25,219,230,244}, {0.5,201,217,237}, {0.75,231,242,255} } + IF empty( hbide_setAppTheme() ) + RETURN { {0,255,255,255}, {0.25,219,230,244}, {0.5,201,217,237}, {0.75,231,242,255} } + ELSE + RETURN hbide_setAppTheme() + ENDIF CASE nTheme == 2 RETURN { {0,173,185,207}, {1,199,212,231} } ENDCASE diff --git a/harbour/contrib/hbide/setup.ui b/harbour/contrib/hbide/setup.ui index 6cde39b6a7..6f6d4d1220 100644 --- a/harbour/contrib/hbide/setup.ui +++ b/harbour/contrib/hbide/setup.ui @@ -1649,6 +1649,9 @@ 123 + + Horizontal Gradient + QFrame::StyledPanel @@ -1665,6 +1668,9 @@ 123 + + Vertical Gradient + QFrame::StyledPanel @@ -1693,6 +1699,9 @@ 20 + + Section at ? ( less than 1 ) + @@ -1703,6 +1712,9 @@ 20 + + Section at 0 edge + @@ -1713,6 +1725,9 @@ 20 + + Section at ? ( less than 1 ) + @@ -1723,6 +1738,9 @@ 20 + + Section at ? ( less than 1 ) + @@ -1733,6 +1751,9 @@ 20 + + Section at ? ( less than 1 ) + @@ -2023,6 +2044,9 @@ 20 + + Color at Section 1 + QFrame::StyledPanel @@ -2039,6 +2063,9 @@ 20 + + Color at Section 1 + QFrame::StyledPanel @@ -2055,6 +2082,9 @@ 20 + + Color at Section 2 + QFrame::StyledPanel @@ -2071,6 +2101,9 @@ 20 + + Color at Section 4 + QFrame::StyledPanel @@ -2087,6 +2120,9 @@ 20 + + Color at Section 5 + QFrame::StyledPanel @@ -2182,6 +2218,9 @@ 20 + + Add a new theme + ... @@ -2195,19 +2234,25 @@ 20 + + Delete current highlighted theme + ... - + 114 - 58 + 72 25 20 + + Apply theme to application + ... @@ -2221,6 +2266,9 @@ 20 + + Save current theme + ...