Finished making it possible to toggle line numbers in the basic ide

This commit is contained in:
August Sodora
2011-11-16 16:45:38 -05:00
committed by Norbert Thiebaud
parent a4074e3403
commit a1deac6043
4 changed files with 37 additions and 5 deletions

View File

@@ -1401,6 +1401,11 @@ sal_Bool ModulWindow::IsReadOnly()
return bReadOnly;
}
void ModulWindow::SetLineNumberDisplay(bool b)
{
aXEditorWindow.SetLineNumberDisplay(b);
}
sal_Bool ModulWindow::IsPasteAllowed()
{
sal_Bool bPaste = sal_False;

View File

@@ -290,6 +290,7 @@ private:
LineNumberWindow aLineNumberWindow;
EditorWindow aEdtWindow;
ScrollBar aEWVScrollBar;
bool bLineNumberDisplay;
virtual void DataChanged(DataChangedEvent const & rDCEvt);
@@ -304,6 +305,8 @@ public:
LineNumberWindow& GetLineNumberWindow() { return aLineNumberWindow; }
EditorWindow& GetEdtWindow() { return aEdtWindow; }
ScrollBar& GetEWVScrollBar() { return aEWVScrollBar; }
void SetLineNumberDisplay(bool b);
};
@@ -365,6 +368,8 @@ public:
virtual void SetReadOnly( sal_Bool bReadOnly );
virtual sal_Bool IsReadOnly();
void SetLineNumberDisplay(bool);
StarBASIC* GetBasic() { XModule(); return xBasic; }
SbModule* GetSbModule() { return xModule; }

View File

@@ -1630,13 +1630,13 @@ ComplexEditorWindow::ComplexEditorWindow( ModulWindow* pParent ) :
aBrkWindow( this ),
aLineNumberWindow( this, pParent ),
aEdtWindow( this ),
aEWVScrollBar( this, WB_VSCROLL | WB_DRAG )
aEWVScrollBar( this, WB_VSCROLL | WB_DRAG ),
bLineNumberDisplay(false)
{
aEdtWindow.SetModulWindow( pParent );
aBrkWindow.SetModulWindow( pParent );
aEdtWindow.Show();
aBrkWindow.Show();
aLineNumberWindow.Show();
aEWVScrollBar.SetLineSize( SCROLL_LINE );
aEWVScrollBar.SetPageSize( SCROLL_PAGE );
@@ -1659,8 +1659,16 @@ void ComplexEditorWindow::Resize()
Size aLnSz(aLineNumberWindow.GetWidth(), aSz.Height());
aLineNumberWindow.SetPosSizePixel(Point(DWBORDER+aBrkSz.Width() - 1, DWBORDER), aLnSz);
Size aEWSz(aSz.Width() - nBrkWidth - aLineNumberWindow.GetWidth() - nSBWidth + 2, aSz.Height());
aEdtWindow.SetPosSizePixel( Point( DWBORDER+aBrkSz.Width()+aLnSz.Width()-1, DWBORDER ), aEWSz );
if(bLineNumberDisplay)
{
Size aEWSz(aSz.Width() - nBrkWidth - aLineNumberWindow.GetWidth() - nSBWidth + 2, aSz.Height());
aEdtWindow.SetPosSizePixel( Point( DWBORDER+aBrkSz.Width()+aLnSz.Width()-1, DWBORDER ), aEWSz );
}
else
{
Size aEWSz(aSz.Width() - nBrkWidth - nSBWidth + 1, aSz.Height());
aEdtWindow.SetPosSizePixel(Point(DWBORDER + aBrkSz.Width() - 1, DWBORDER), aEWSz);
}
aEWVScrollBar.SetPosSizePixel( Point( aOutSz.Width()-DWBORDER-nSBWidth, DWBORDER ), Size( nSBWidth, aSz.Height() ) );
}
@@ -1696,6 +1704,20 @@ void ComplexEditorWindow::DataChanged(DataChangedEvent const & rDCEvt)
}
}
void ComplexEditorWindow::SetLineNumberDisplay(bool b)
{
if(b == bLineNumberDisplay)
return;
if(b)
aLineNumberWindow.Show();
else
aLineNumberWindow.Hide();
bLineNumberDisplay = b;
Resize();
}
uno::Reference< awt::XWindowPeer >
EditorWindow::GetComponentInterface(sal_Bool bCreate)
{

View File

@@ -114,7 +114,7 @@ void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq )
lcl_GetSourceLinesEnabledValue() = bValue;
if ( pCurWin && pCurWin->IsA( TYPE( ModulWindow ) ) )
{
// (ModuleWindow*)(pCurWin)->SetLineNumberDisplay( bValue );
dynamic_cast<ModulWindow*>(pCurWin)->SetLineNumberDisplay( bValue );
}
}
break;