summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authorAugust Sodora <augsod@gmail.com>2011-11-16 16:45:38 -0500
committerNorbert Thiebaud <nthiebaud@gmail.com>2011-11-17 18:41:21 -0600
commita1deac6043ffdc5fba454f92c42e46de0943f7f7 (patch)
treef5c6d48469504f32aab4cc32bdf0a18c6c97b94f /basctl
parenta4074e34039b0e570a3aa08cdffde1562892df17 (diff)
Finished making it possible to toggle line numbers in the basic ide
Diffstat (limited to 'basctl')
-rw-r--r--basctl/source/basicide/baside2.cxx5
-rw-r--r--basctl/source/basicide/baside2.hxx5
-rw-r--r--basctl/source/basicide/baside2b.cxx30
-rw-r--r--basctl/source/basicide/basides1.cxx2
4 files changed, 37 insertions, 5 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 98e1b74e3d59..e449ba9da000 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 1de34d7a3ad3..48a65c96e20e 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 be082689227a..2a4d8ce6d698 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 d7caa9541352..68eaaa4a0ba5 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -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;