[Libreoffice-commits] .: Branch 'feature/line-numbers-in-basicIDE' - basctl/source
August Sodora
augsod at kemper.freedesktop.org
Wed Nov 16 13:47:51 PST 2011
basctl/source/basicide/baside2.cxx | 5 +++++
basctl/source/basicide/baside2.hxx | 5 +++++
basctl/source/basicide/baside2b.cxx | 30 ++++++++++++++++++++++++++----
basctl/source/basicide/basides1.cxx | 2 +-
4 files changed, 37 insertions(+), 5 deletions(-)
New commits:
commit 4a0a577c6198d207b18efa7aaeb7eb847ff7be2b
Author: August Sodora <augsod at gmail.com>
Date: Wed Nov 16 16:45:38 2011 -0500
Finished making it possible to toggle line numbers in the basic ide
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 98e1b74..e449ba9 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -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;
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index 1de34d7..48a65c9 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -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; }
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index be08268..2a4d8ce 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -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)
{
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index c10ff6d..7a500fe 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -113,7 +113,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;
More information about the Libreoffice-commits
mailing list