Kaydet (Commit) fa83f16b authored tarafından Noel Power's avatar Noel Power

better sizing of inputbar ( removed weird calculations I didn't understand )

gsoc input bar now (should) snuggly wrap the text when collapsed, if multilines exist then scrolling with the keys should be clean and no spill from upper or lower lines visible. Removed some strange ( pseudo padding ) apparently for taking into account the window border and reorganized the resize logic so the padding is added ( and commented why ) in just one place.
üst 400b4589
...@@ -864,7 +864,7 @@ ScInputBarGroup::ScInputBarGroup(Window* pParent) ...@@ -864,7 +864,7 @@ ScInputBarGroup::ScInputBarGroup(Window* pParent)
// too bad at the size from 'Settings' for me // too bad at the size from 'Settings' for me
// set button width to scrollbar width then for the moment // set button width to scrollbar width then for the moment
aButton.SetClickHdl ( LINK( this, ScInputBarGroup, ClickHdl ) ); aButton.SetClickHdl ( LINK( this, ScInputBarGroup, ClickHdl ) );
aButton.SetSizePixel(Size(GetSettings().GetStyleSettings().GetScrollBarSize(), TBX_WINDOW_HEIGHT) ); aButton.SetSizePixel(Size(GetSettings().GetStyleSettings().GetScrollBarSize(), aMultiTextWnd.GetPixelHeightForLines(1)) );
aButton.Enable(); aButton.Enable();
aButton.SetSymbol( SYMBOL_SPIN_DOWN ); aButton.SetSymbol( SYMBOL_SPIN_DOWN );
aButton.SetQuickHelpText( ScResId( SCSTR_QHELP_EXPAND_FORMULA ) ); aButton.SetQuickHelpText( ScResId( SCSTR_QHELP_EXPAND_FORMULA ) );
...@@ -1123,18 +1123,16 @@ void ScMultiTextWnd::Paint( const Rectangle& rRec ) ...@@ -1123,18 +1123,16 @@ void ScMultiTextWnd::Paint( const Rectangle& rRec )
} }
} }
long ScMultiTextWnd::GetPixelTextHeight()
long ScMultiTextWnd::GetPixelHeightForLines( long nLines )
{ {
long height = ( LogicToPixel(Size(0,GetTextHeight())).Height() ); long height = ( LogicToPixel(Size(0,GetTextHeight())).Height() );
// need to figure out why GetTextHeight is not set up when I need it // need to figure out why GetTextHeight is not set up when I need it
// some initialisation timing issue ? // some initialisation timing issue ?
return Max ( long( 14 ), height ); height = Max ( long( 14 ), height );
} // add padding ( for the borders of the window I guess ) otherwise we
// chop slightly the top and bottom of whatever is in the inputbox
return ( nLines * height ) + 4;
long ScMultiTextWnd::GetPixelHeightForLines( long nLines )
{
return nLines * GetPixelTextHeight();
} }
void ScMultiTextWnd::SetNumLines( long nLines ) void ScMultiTextWnd::SetNumLines( long nLines )
...@@ -1153,14 +1151,14 @@ void ScMultiTextWnd::Resize() ...@@ -1153,14 +1151,14 @@ void ScMultiTextWnd::Resize()
// parent/container window // parent/container window
Size aTextBoxSize = GetSizePixel(); Size aTextBoxSize = GetSizePixel();
aTextBoxSize.Height()=( GetPixelHeightForLines( mnLines ) ) + 8; aTextBoxSize.Height()=( GetPixelHeightForLines( mnLines ) );
SetSizePixel(aTextBoxSize);
if(pEditView) if(pEditView)
{ {
Size aOutputSize = GetOutputSizePixel(); Size aOutputSize = GetOutputSizePixel();
Size aLineSize = Size(0,GetPixelTextHeight()); Size aLineSize = Size(0,aTextBoxSize.Height());
int nDiff = (aOutputSize.Height() - ( mnLines *aLineSize.Height()))/2; Point aPos1(TEXT_STARTPOS,0);
Point aPos1(TEXT_STARTPOS,nDiff);
Point aPos2(aOutputSize.Width(),aOutputSize.Height()); Point aPos2(aOutputSize.Width(),aOutputSize.Height());
pEditView->SetOutputArea( pEditView->SetOutputArea(
...@@ -1170,7 +1168,6 @@ void ScMultiTextWnd::Resize() ...@@ -1170,7 +1168,6 @@ void ScMultiTextWnd::Resize()
} }
SetScrollBarRange(); SetScrollBarRange();
SetSizePixel(aTextBoxSize);
} }
IMPL_LINK(ScMultiTextWnd, ModifyHdl, EENotify*, pNotify) IMPL_LINK(ScMultiTextWnd, ModifyHdl, EENotify*, pNotify)
......
...@@ -176,7 +176,6 @@ public: ...@@ -176,7 +176,6 @@ public:
virtual void StopEditEngine( sal_Bool bAll ); virtual void StopEditEngine( sal_Bool bAll );
int GetLineCount(); int GetLineCount();
virtual void Resize(); virtual void Resize();
long GetPixelTextHeight();
long GetPixelHeightForLines( long nLines ); long GetPixelHeightForLines( long nLines );
long GetEditEngTxtHeight(); long GetEditEngTxtHeight();
...@@ -193,6 +192,7 @@ protected: ...@@ -193,6 +192,7 @@ protected:
DECL_LINK( NotifyHdl, EENotify* ); DECL_LINK( NotifyHdl, EENotify* );
DECL_LINK( ModifyHdl, EENotify* ); DECL_LINK( ModifyHdl, EENotify* );
private: private:
long GetPixelTextHeight();
ScInputBarGroup& mrGroupBar; ScInputBarGroup& mrGroupBar;
long mnLines; long mnLines;
long mnLastExpandedLines; long mnLastExpandedLines;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment