diff --git a/harbour/ChangeLog b/harbour/ChangeLog index bc2444d63c..4a4b1f5388 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,14 @@ The license applies to all entries newer than 2009-04-28. */ +2010-07-07 10:49 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbide/idesaveload.prg + * contrib/hbide/idestylesheets.prg + * contrib/hbide/setup.ui + + Implemented: application themes - a work-in-progress yet for + final implementation. Just have a fun to play with it currently. + Next commit will see it to real fruitation. + 2010-07-07 19:02 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * src/pp/ppcore.c ! Extended one variable type to HB_ISIZ from int after diff --git a/harbour/contrib/hbide/idesaveload.prg b/harbour/contrib/hbide/idesaveload.prg index 7e9d2b1ef9..377007228b 100644 --- a/harbour/contrib/hbide/idesaveload.prg +++ b/harbour/contrib/hbide/idesaveload.prg @@ -165,6 +165,8 @@ CLASS IdeINI INHERIT IdeObject DATA lCompletionWithArgs INIT .f. DATA lCompleteArgumented INIT .f. + DATA aAppThemes INIT {} + METHOD new( oIde ) METHOD create( oIde ) METHOD load( cHbideIni ) @@ -377,6 +379,13 @@ METHOD IdeINI:save( cHbideIni ) NEXT aadd( txt_, " " ) + aadd( txt_, "[APPTHEMES]" ) + aadd( txt_, " " ) + FOR EACH s IN ::aAppThemes + aadd( txt_, "apptheme_" + hb_ntos( s:__enumIndex() ) + "=" + s ) + NEXT + aadd( txt_, " " ) + aadd( txt_, "[General]" ) aadd( txt_, " " ) @@ -448,6 +457,9 @@ METHOD IdeINI:load( cHbideIni ) CASE "[DBUPANELSINFO]" nPart := "INI_DBUPANELSINFO" EXIT + CASE "[APPTHEMES]" + nPart := "INI_APPTHEMES" + EXIT OTHERWISE DO CASE CASE Left( s, 1 ) $ '#[' @@ -598,6 +610,11 @@ METHOD IdeINI:load( cHbideIni ) aadd( ::aDbuPanelsInfo, cVal ) ENDIF + CASE nPart == "INI_APPTHEMES" + IF hbide_parseKeyValPair( s, @cKey, @cVal ) + aadd( ::aAppThemes, cVal ) + ENDIF + ENDCASE EXIT ENDSWITCH @@ -807,11 +824,13 @@ CLASS IdeSetup INHERIT IdeObject "windowsvista", "cde", "motif", "plastique", "macintosh" } DATA aKeyItems INIT {} + DATA nCurThemeSlot INIT 0 + METHOD new( oIde ) METHOD create( oIde ) METHOD destroy() METHOD show() - METHOD execEvent( cEvent, p ) + METHOD execEvent( cEvent, p, p1 ) METHOD buildTree() METHOD setSystemStyle( cStyle ) METHOD setBaseColor() @@ -823,6 +842,11 @@ CLASS IdeSetup INHERIT IdeObject METHOD eol() METHOD buildKeywords() METHOD populateKeyTableRow( nRow, cTxtCol1, cTxtCol2 ) + METHOD populateThemeColors( nSlot, aRGB ) + METHOD pullThemeColors( nSlot ) + METHOD fetchThemeColorsString( nSlot ) + METHOD pushThemeColors( nTheme ) + METHOD pushThemesData() ENDCLASS @@ -877,6 +901,11 @@ METHOD IdeSetup:setIcons() ::oUI:q_buttonSelFont : setIcon( hbide_image( "font" ) ) + ::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_buttonThmSav : setIcon( hbide_image( "save" ) ) + RETURN Self /*----------------------------------------------------------------------*/ @@ -935,6 +964,23 @@ METHOD IdeSetup:connectSlots() ::connect( ::oUI:q_checkHorzRuler , "stateChanged(int)" , {|i| ::execEvent( "checkHorzRuler_stateChanged" , i ) } ) ::connect( ::oUI:q_checkLineNumbers, "stateChanged(int)" , {|i| ::execEvent( "checkLineNumbers_stateChanged", i ) } ) + ::connect( ::oUI:q_sliderRed , "valueChanged(int)" , {|i| ::execEvent( "sliderValue_changed", i, "R" ) } ) + ::connect( ::oUI:q_sliderGreen , "valueChanged(int)" , {|i| ::execEvent( "sliderValue_changed", i, "G" ) } ) + ::connect( ::oUI:q_sliderBlue , "valueChanged(int)" , {|i| ::execEvent( "sliderValue_changed", i, "B" ) } ) + + ::connect( ::oUI:q_radioSec1 , "clicked()" , {| | ::execEvent( "radioSection_clicked", 1 ) } ) + ::connect( ::oUI:q_radioSec2 , "clicked()" , {| | ::execEvent( "radioSection_clicked", 2 ) } ) + ::connect( ::oUI:q_radioSec3 , "clicked()" , {| | ::execEvent( "radioSection_clicked", 3 ) } ) + ::connect( ::oUI:q_radioSec4 , "clicked()" , {| | ::execEvent( "radioSection_clicked", 4 ) } ) + ::connect( ::oUI:q_radioSec5 , "clicked()" , {| | ::execEvent( "radioSection_clicked", 5 ) } ) + + ::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_buttonThmSav , "clicked()" , {| | ::execEvent( "buttonThmSav_clicked" ) } ) + + ::connect( ::oUI:q_listThemes , "currentRowChanged(int)" , {|i| ::execEvent( "listThemes_currentRowChanged", i ) } ) + RETURN Self /*----------------------------------------------------------------------*/ @@ -1029,10 +1075,31 @@ METHOD IdeSetup:populate() ::oUI:q_editTmpBkpPrd : setText( hb_ntos( ::oINI:nTmpBkpPrd ) ) ::oUI:q_editBkpPath : setText( ::oINI:cBkpPath ) ::oUI:q_editBkpSuffix : setText( ::oINI:cBkpSuffix ) + + /* Selections - Code Completion */ ::oUI:q_checkListlWithArgs : setChecked( ::oINI:lCompletionWithArgs ) ::oUI:q_checkCmplInclArgs : setChecked( ::oINI:lCompleteArgumented ) + /* Themes */ + ::oUI:q_sliderRed:setMinimum( 0 ) + ::oUI:q_sliderRed:setMaximum( 255 ) + + ::oUI:q_sliderGreen:setMinimum( 0 ) + ::oUI:q_sliderGreen:setMaximum( 255 ) + + ::oUI:q_sliderBlue:setMinimum( 0 ) + ::oUI:q_sliderBlue:setMaximum( 255 ) + + ::oUI:q_editSec1:setText( "0" ) + ::oUI:q_editSec5:setText( "1" ) + + ::oUI:q_editSec1:setReadOnly( .t. ) + ::oUI:q_editSec5:setReadOnly( .t. ) + + ::pushThemesData() + ::connectSlots() + RETURN Self /*----------------------------------------------------------------------*/ @@ -1074,11 +1141,14 @@ METHOD IdeSetup:show() /*----------------------------------------------------------------------*/ -METHOD IdeSetup:execEvent( cEvent, p ) +METHOD IdeSetup:execEvent( cEvent, p, p1 ) LOCAL qItem, nIndex, qFontDlg, qFont, nOK, nRow, b_, q0, q1, nCol, w0, w1 -// LOCAL qEvent + LOCAL aRGB, nSlot, qFrame, aGrad, n, cCSS, cTheme + + HB_SYMBOL_UNUSED( p1 ) SWITCH cEvent + CASE "buttonSelFont_clicked" qFont := QFont():new( ::oINI:cFontName, ::oINI:nPointSize ) qFont:setFixedPitch( .t. ) @@ -1227,12 +1297,175 @@ METHOD IdeSetup:execEvent( cEvent, p ) #endif ENDIF + CASE "radioSection_clicked" + ::nCurThemeSlot := p + IF empty( aRGB := ::pullThemeColors( p ) ) + aRGB := { 0,0,0 } + ENDIF + ::oUI:q_sliderRed : setValue( aRGB[ 1 ] ) + ::oUI:q_sliderGreen : setValue( aRGB[ 2 ] ) + ::oUI:q_sliderBlue : setValue( aRGB[ 3 ] ) + EXIT + + CASE "sliderValue_changed" + #if 0 + nSlot := iif( ::oUI:q_radioSec1:isChecked(), 1, ; + iif( ::oUI:q_radioSec2:isChecked(), 2, ; + iif( ::oUI:q_radioSec3:isChecked(), 3, ; + iif( ::oUI:q_radioSec4:isChecked(), 4, ; + iif( ::oUI:q_radioSec5:isChecked(), 5, 0 ) ) ) ) ) + #endif + nSlot := ::nCurThemeSlot + + IF nSlot > 0 + qFrame := { ::oUI:q_frameSec1, ::oUI:q_frameSec2, ::oUI:q_frameSec3, ::oUI:q_frameSec4, ::oUI:q_frameSec5 }[ nSlot ] + + aRGB := { ::oUI:q_sliderRed:value(), ::oUI:q_sliderGreen:value(), ::oUI:q_sliderBlue:value() } + + ::populateThemeColors( nSlot, aRGB ) + + qFrame:setStyleSheet( "background-color: " + hbide_rgbString( aRGB ) + ";" ) + ENDIF + + aGrad := {} + FOR nSlot := 1 TO 5 + n := val( { ::oUI:q_editSec1, ::oUI:q_editSec2, ::oUI:q_editSec3, ::oUI:q_editSec4, ::oUI:q_editSec5 }[ nSlot ]:text() ) + + IF !empty( aRGB := ::pullThemeColors( nSlot ) ) + aadd( aGrad, { n, aRGB[ 1 ], aRGB[ 2 ], aRGB[ 3 ] } ) + ENDIF + NEXT + IF !empty( aGrad ) + cCSS := 'background-color: qlineargradient(x1:0, y1:0, x2:1, y2:0, ' + hbide_buildGradientString( aGrad ) + ");" + ::oUI:q_frameHorz:setStyleSheet( cCSS ) + cCSS := 'background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, ' + hbide_buildGradientString( aGrad ) + ");" + ::oUI:q_frameVert:setStyleSheet( cCSS ) + ENDIF + EXIT + + CASE "listThemes_currentRowChanged" + ::pushThemeColors( p + 1 ) + EXIT + CASE "buttonThmAdd_clicked" + IF !empty( cTheme := hbide_fetchAString( ::oDlg:oWidget, cTheme, "Name the Theme", "New Theme" ) ) + aadd( ::oINI:aAppThemes, cTheme + "," + "," + "," + "," ) + qItem := QListWidgetItem():new() + qItem:setText( cTheme ) + ::oUI:q_listThemes:addItem_1( qItem ) + ::oUI:q_listThemes:setCurrentRow( len( ::oINI:aAppThemes ) - 1 ) + ENDIF + EXIT + CASE "buttonThmCpy_clicked" + EXIT + CASE "buttonThmDel_clicked" + EXIT + CASE "buttonThmSav_clicked" + IF ( n := ::oUI:q_listThemes:currentRow() ) > -1 + ::oINI:aAppThemes[ n + 1 ] := QListWidgetItem():from( ::oUI:q_listThemes:currentItem() ):text() + "," + ; + ::fetchThemeColorsString() + ENDIF + EXIT + ENDSWITCH RETURN nRow //Self /*----------------------------------------------------------------------*/ +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 !empty( ::oINI:aAppThemes ) + ::oUI:q_listThemes:setCurrentRow( 0 ) + ENDIF + ::oUI:q_radioSec1:click() + + RETURN Self + +/*------------------------------------------------------------------------*/ + +METHOD IdeSetup:pushThemeColors( nTheme ) + LOCAL n, a_, i, aRGB, nSlot + + IF nTheme >= 1 .AND. nTheme <= len( ::oINI:aAppThemes ) + a_:= hb_aTokens( ::oINI:aAppThemes[ nTheme ], "," ) + 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 "" + + FOR i := 2 TO 6 + nSlot := i - 1 + IF !empty( a_[ i ] ) + aRGB := hb_aTokens( a_[ i ], " " ) + FOR EACH n IN aRGB + 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 + { ::oUI:q_radioSec1, ::oUI:q_radioSec2, ::oUI:q_radioSec3, ::oUI:q_radioSec4, ::oUI:q_radioSec5 }[ nSlot ]:click() + ENDIF + + RETURN Self + +/*------------------------------------------------------------------------*/ + +METHOD IdeSetup:populateThemeColors( nSlot, aRGB ) + + { ::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 ] ) ) + + RETURN Self + +/*------------------------------------------------------------------------*/ + +METHOD IdeSetup:fetchThemeColorsString( nSlot ) + LOCAL s := "" + + IF empty( nSlot ) + FOR nSlot := 1 TO 5 + s += { ::oUI:q_editSec1, ::oUI:q_editSec2, ::oUI:q_editSec3, ::oUI:q_editSec4, ::oUI:q_editSec5 }[ nSlot ]:text() + " " + + s += { ::oUI:q_editR1, ::oUI:q_editR2, ::oUI:q_editR3, ::oUI:q_editR4, ::oUI:q_editR5 }[ nSlot ]:text() + " " + s += { ::oUI:q_editG1, ::oUI:q_editG2, ::oUI:q_editG3, ::oUI:q_editG4, ::oUI:q_editG5 }[ nSlot ]:text() + " " + s += { ::oUI:q_editB1, ::oUI:q_editB2, ::oUI:q_editB3, ::oUI:q_editB4, ::oUI:q_editB5 }[ nSlot ]:text() + + s += "," + NEXT + ELSE + + ENDIF + + RETURN s + +/*------------------------------------------------------------------------*/ + +METHOD IdeSetup:pullThemeColors( nSlot ) + LOCAL aRGB := {} + + IF !empty( { ::oUI:q_editSec1, ::oUI:q_editSec2, ::oUI:q_editSec3, ::oUI:q_editSec4, ::oUI:q_editSec5 }[ nSlot ]:text() ) + aadd( aRGB, val( { ::oUI:q_editR1, ::oUI:q_editR2, ::oUI:q_editR3, ::oUI:q_editR4, ::oUI:q_editR5 }[ nSlot ]:text() ) ) + aadd( aRGB, val( { ::oUI:q_editG1, ::oUI:q_editG2, ::oUI:q_editG3, ::oUI:q_editG4, ::oUI:q_editG5 }[ nSlot ]:text() ) ) + aadd( aRGB, val( { ::oUI:q_editB1, ::oUI:q_editB2, ::oUI:q_editB3, ::oUI:q_editB4, ::oUI:q_editB5 }[ nSlot ]:text() ) ) + ENDIF + + RETURN aRGB + +/*------------------------------------------------------------------------*/ + METHOD IdeSetup:populateKeyTableRow( nRow, cTxtCol1, cTxtCol2 ) LOCAL lAppend := len( ::aKeyItems ) < nRow LOCAL q0, q1 diff --git a/harbour/contrib/hbide/idestylesheets.prg b/harbour/contrib/hbide/idestylesheets.prg index 44f13c9db5..b55ffc87fb 100644 --- a/harbour/contrib/hbide/idestylesheets.prg +++ b/harbour/contrib/hbide/idestylesheets.prg @@ -461,12 +461,17 @@ FUNCTION hbide_cssColorString( cPart ) /*----------------------------------------------------------------------*/ -STATIC FUNCTION hbide_rgbString( nR, nG, nB ) - RETURN "rgb(" + hb_ntos( nR ) + "," + hb_ntos( nG ) + "," + hb_ntos( nB ) + ")" +FUNCTION hbide_rgbString( nR, nG, nB ) + IF hb_isArray( nR ) + RETURN "rgb(" + hb_ntos( nR[ 1 ] ) + "," + hb_ntos( nR[ 2 ] ) + "," + hb_ntos( nR[ 3 ] ) + ")" + ELSE + RETURN "rgb(" + hb_ntos( nR ) + "," + hb_ntos( nG ) + "," + hb_ntos( nB ) + ")" + ENDIF + RETURN "" /*----------------------------------------------------------------------*/ -STATIC FUNCTION hbide_buildGradientString( aGrands ) +FUNCTION hbide_buildGradientString( aGrands ) LOCAL a_, s := "" FOR EACH a_ IN aGrands diff --git a/harbour/contrib/hbide/setup.ui b/harbour/contrib/hbide/setup.ui index efff41225c..6cde39b6a7 100644 --- a/harbour/contrib/hbide/setup.ui +++ b/harbour/contrib/hbide/setup.ui @@ -1636,33 +1636,17 @@ 10 8 99 - 135 + 123 - - - - 118 - 8 - 65 - 135 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - 193 - 9 - 149 - 133 + 144 + 8 + 53 + 123 @@ -1672,75 +1656,451 @@ QFrame::Raised - + - 12 - 174 - 49 - 20 + 207 + 8 + 135 + 123 + + QFrame::StyledPanel + + + QFrame::Raised + - + - 12 - 152 - 53 - 16 + 10 + 138 + 331 + 155 - - Sections + + + + + + 50 + 128 + 49 + 20 + + + + + + + 50 + 16 + 49 + 20 + + + + + + + 50 + 44 + 49 + 20 + + + + + + + 50 + 100 + 49 + 20 + + + + + + + 50 + 72 + 49 + 20 + + + + + + + 8 + 18 + 43 + 16 + + + + Sec 0 + + + + + + 8 + 130 + 43 + 16 + + + + Sec 1 + + + + + + 8 + 48 + 37 + 16 + + + + Sec ? + + + + + + 8 + 76 + 37 + 16 + + + + Sec ? + + + + + + 8 + 104 + 37 + 16 + + + + Sec ? + + + + + + 198 + 16 + 29 + 20 + + + + + + + 242 + 16 + 29 + 20 + + + + + + + 284 + 16 + 29 + 20 + + + + + + + 242 + 44 + 29 + 20 + + + + + + + 284 + 44 + 29 + 20 + + + + + + + 198 + 44 + 29 + 20 + + + + + + + 242 + 72 + 29 + 20 + + + + + + + 284 + 72 + 29 + 20 + + + + + + + 198 + 72 + 29 + 20 + + + + + + + 242 + 100 + 29 + 20 + + + + + + + 284 + 100 + 29 + 20 + + + + + + + 198 + 100 + 29 + 20 + + + + + + + 242 + 128 + 29 + 20 + + + + + + + 284 + 128 + 29 + 20 + + + + + + + 196 + 128 + 31 + 20 + + + + + + + 110 + 16 + 19 + 23 + + + + + + + + + + 110 + 44 + 19 + 19 + + + + + + + + + + 110 + 72 + 19 + 19 + + + + + + + + + + 110 + 100 + 19 + 19 + + + + + + + + + + 110 + 128 + 19 + 19 + + + + + + + + + + 134 + 16 + 51 + 20 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + 134 + 44 + 51 + 20 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + 134 + 72 + 51 + 20 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + 134 + 100 + 51 + 20 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + 134 + 128 + 51 + 20 + + + + QFrame::StyledPanel + + + QFrame::Raised + + - + - 12 - 202 - 49 - 20 - - - - - - - 12 - 230 - 49 - 20 - - - - - - - 12 - 258 - 49 - 20 - - - - - - - 12 - 286 - 49 - 20 - - - - - - - 118 - 176 - 65 + 60 + 300 + 277 16 @@ -1748,12 +2108,12 @@ Qt::Horizontal - + - 196 - 176 - 65 + 60 + 322 + 277 16 @@ -1761,168 +2121,12 @@ Qt::Horizontal - + - 274 - 176 - 65 - 16 - - - - Qt::Horizontal - - - - - - 118 - 204 - 65 - 16 - - - - Qt::Horizontal - - - - - - 196 - 204 - 65 - 16 - - - - Qt::Horizontal - - - - - - 274 - 204 - 65 - 16 - - - - Qt::Horizontal - - - - - - 118 - 232 - 65 - 16 - - - - Qt::Horizontal - - - - - - 196 - 232 - 65 - 16 - - - - Qt::Horizontal - - - - - - 274 - 232 - 65 - 16 - - - - Qt::Horizontal - - - - - - 118 - 260 - 65 - 16 - - - - Qt::Horizontal - - - - - - 196 - 260 - 65 - 16 - - - - Qt::Horizontal - - - - - - 274 - 260 - 65 - 16 - - - - Qt::Horizontal - - - - - - 118 - 288 - 65 - 16 - - - - Qt::Horizontal - - - - - - 196 - 288 - 65 - 16 - - - - Qt::Horizontal - - - - - - 274 - 288 - 65 + 60 + 344 + 277 16 @@ -1933,10 +2137,10 @@ - 144 - 156 - 27 - 16 + 12 + 302 + 46 + 14 @@ -1946,10 +2150,10 @@ - 216 - 156 - 37 - 16 + 12 + 322 + 46 + 14 @@ -1959,16 +2163,68 @@ - 298 - 156 - 31 - 16 + 12 + 342 + 46 + 14 Blue + + + + 114 + 8 + 25 + 20 + + + + ... + + + + + + 114 + 32 + 25 + 20 + + + + ... + + + + + + 114 + 58 + 25 + 20 + + + + ... + + + + + + 114 + 110 + 25 + 20 + + + + ... + +