Add line numbers to basic ide

This commit is contained in:
August Sodora 2011-11-11 14:22:11 -05:00 committed by Norbert Thiebaud
parent 9d2807cc9d
commit 291bd1f0bf
3 changed files with 28 additions and 8 deletions

View file

@ -94,6 +94,7 @@ $(eval $(call gb_Library_add_exception_objects,basctl,\
basctl/source/basicide/docsignature \ basctl/source/basicide/docsignature \
basctl/source/basicide/documentenumeration \ basctl/source/basicide/documentenumeration \
basctl/source/basicide/iderdll \ basctl/source/basicide/iderdll \
basctl/source/basicide/linenumberwindow \
basctl/source/basicide/localizationmgr \ basctl/source/basicide/localizationmgr \
basctl/source/basicide/macrodlg \ basctl/source/basicide/macrodlg \
basctl/source/basicide/moduldl2 \ basctl/source/basicide/moduldl2 \

View file

@ -42,6 +42,7 @@ class SvxSearchItem;
#include <svtools/headbar.hxx> #include <svtools/headbar.hxx>
#include <vcl/button.hxx> #include <vcl/button.hxx>
#include <basic/sbstar.hxx>
#include <basic/sbmod.hxx> #include <basic/sbmod.hxx>
#include <vcl/split.hxx> #include <vcl/split.hxx>
#include "svl/lstner.hxx" #include "svl/lstner.hxx"
@ -50,6 +51,8 @@ class SvxSearchItem;
#include <sfx2/progress.hxx> #include <sfx2/progress.hxx>
#include <svtools/syntaxhighlight.hxx> #include <svtools/syntaxhighlight.hxx>
#include "linenumberwindow.hxx"
DBG_NAMEEX( ModulWindow ) DBG_NAMEEX( ModulWindow )
#define MARKER_NOMARKER 0xFFFF #define MARKER_NOMARKER 0xFFFF
@ -284,6 +287,7 @@ class ComplexEditorWindow : public Window
{ {
private: private:
BreakPointWindow aBrkWindow; BreakPointWindow aBrkWindow;
LineNumberWindow aLineNumberWindow;
EditorWindow aEdtWindow; EditorWindow aEdtWindow;
ScrollBar aEWVScrollBar; ScrollBar aEWVScrollBar;
@ -297,6 +301,7 @@ public:
ComplexEditorWindow( ModulWindow* pParent ); ComplexEditorWindow( ModulWindow* pParent );
BreakPointWindow& GetBrkWindow() { return aBrkWindow; } BreakPointWindow& GetBrkWindow() { return aBrkWindow; }
LineNumberWindow& GetLineNumberWindow() { return aLineNumberWindow; }
EditorWindow& GetEdtWindow() { return aEdtWindow; } EditorWindow& GetEdtWindow() { return aEdtWindow; }
ScrollBar& GetEWVScrollBar() { return aEWVScrollBar; } ScrollBar& GetEWVScrollBar() { return aEWVScrollBar; }
}; };
@ -402,6 +407,7 @@ public:
EditorWindow& GetEditorWindow() { return aXEditorWindow.GetEdtWindow(); } EditorWindow& GetEditorWindow() { return aXEditorWindow.GetEdtWindow(); }
BreakPointWindow& GetBreakPointWindow() { return aXEditorWindow.GetBrkWindow(); } BreakPointWindow& GetBreakPointWindow() { return aXEditorWindow.GetBrkWindow(); }
LineNumberWindow& GetLineNumberWindow() { return aXEditorWindow.GetLineNumberWindow(); }
ScrollBar& GetEditVScrollBar() { return aXEditorWindow.GetEWVScrollBar(); } ScrollBar& GetEditVScrollBar() { return aXEditorWindow.GetEWVScrollBar(); }
ExtTextEngine* GetEditEngine() { return GetEditorWindow().GetEditEngine(); } ExtTextEngine* GetEditEngine() { return GetEditorWindow().GetEditEngine(); }
ExtTextView* GetEditView() { return GetEditorWindow().GetEditView(); } ExtTextView* GetEditView() { return GetEditorWindow().GetEditView(); }

View file

@ -580,6 +580,7 @@ void EditorWindow::CreateEditEngine()
pModulWindow->GetLayout()->GetWatchWindow().Update(); pModulWindow->GetLayout()->GetWatchWindow().Update();
pModulWindow->GetLayout()->GetStackWindow().Update(); pModulWindow->GetLayout()->GetStackWindow().Update();
pModulWindow->GetBreakPointWindow().Update(); pModulWindow->GetBreakPointWindow().Update();
pModulWindow->GetLineNumberWindow().Update();
pEditView->ShowCursor( sal_True, sal_True ); pEditView->ShowCursor( sal_True, sal_True );
@ -660,6 +661,7 @@ void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
pModulWindow->GetEditVScrollBar().SetThumbPos( pEditView->GetStartDocPos().Y() ); pModulWindow->GetEditVScrollBar().SetThumbPos( pEditView->GetStartDocPos().Y() );
pModulWindow->GetBreakPointWindow().DoScroll pModulWindow->GetBreakPointWindow().DoScroll
( 0, pModulWindow->GetBreakPointWindow().GetCurYOffset() - pEditView->GetStartDocPos().Y() ); ( 0, pModulWindow->GetBreakPointWindow().GetCurYOffset() - pEditView->GetStartDocPos().Y() );
pModulWindow->GetLineNumberWindow().Invalidate();
} }
else if( rTextHint.GetId() == TEXT_HINT_TEXTHEIGHTCHANGED ) else if( rTextHint.GetId() == TEXT_HINT_TEXTHEIGHTCHANGED )
{ {
@ -669,6 +671,8 @@ void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
long nTextHeight = pEditEngine->GetTextHeight(); long nTextHeight = pEditEngine->GetTextHeight();
if ( nTextHeight < nOutHeight ) if ( nTextHeight < nOutHeight )
pEditView->Scroll( 0, pEditView->GetStartDocPos().Y() ); pEditView->Scroll( 0, pEditView->GetStartDocPos().Y() );
pModulWindow->GetLineNumberWindow().Invalidate();
} }
SetScrollBarRanges(); SetScrollBarRanges();
@ -792,7 +796,10 @@ void EditorWindow::ImplSetFont()
aFont = GetFont(); aFont = GetFont();
if ( pModulWindow ) if ( pModulWindow )
{
pModulWindow->GetBreakPointWindow().SetFont( aFont ); pModulWindow->GetBreakPointWindow().SetFont( aFont );
pModulWindow->GetLineNumberWindow().SetFont( aFont );
}
if ( pEditEngine ) if ( pEditEngine )
{ {
@ -873,6 +880,7 @@ void EditorWindow::ParagraphInsertedDeleted( sal_uLong nPara, sal_Bool bInserted
{ {
pModulWindow->GetBreakPoints().reset(); pModulWindow->GetBreakPoints().reset();
pModulWindow->GetBreakPointWindow().Invalidate(); pModulWindow->GetBreakPointWindow().Invalidate();
pModulWindow->GetLineNumberWindow().Invalidate();
aHighlighter.initialize( HIGHLIGHT_BASIC ); aHighlighter.initialize( HIGHLIGHT_BASIC );
} }
else else
@ -886,6 +894,11 @@ void EditorWindow::ParagraphInsertedDeleted( sal_uLong nPara, sal_Bool bInserted
aInvRec.Top() = nY; aInvRec.Top() = nY;
pModulWindow->GetBreakPointWindow().Invalidate( aInvRec ); pModulWindow->GetBreakPointWindow().Invalidate( aInvRec );
Size aLnSz(pModulWindow->GetLineNumberWindow().GetWidth(),
GetOutputSizePixel().Height() - 2 * DWBORDER);
pModulWindow->GetLineNumberWindow().SetPosSizePixel(Point(DWBORDER + 19, DWBORDER), aLnSz);
pModulWindow->GetLineNumberWindow().Invalidate();
if ( bDoSyntaxHighlight ) if ( bDoSyntaxHighlight )
{ {
String aDummy; String aDummy;
@ -1612,12 +1625,10 @@ void StackWindow::UpdateCalls()
aTreeListBox.SetUpdateMode( sal_True ); aTreeListBox.SetUpdateMode( sal_True );
} }
ComplexEditorWindow::ComplexEditorWindow( ModulWindow* pParent ) : ComplexEditorWindow::ComplexEditorWindow( ModulWindow* pParent ) :
Window( pParent, WB_3DLOOK | WB_CLIPCHILDREN ), Window( pParent, WB_3DLOOK | WB_CLIPCHILDREN ),
aBrkWindow( this ), aBrkWindow( this ),
aLineNumberWindow( this, pParent ),
aEdtWindow( this ), aEdtWindow( this ),
aEWVScrollBar( this, WB_VSCROLL | WB_DRAG ) aEWVScrollBar( this, WB_VSCROLL | WB_DRAG )
{ {
@ -1625,6 +1636,7 @@ ComplexEditorWindow::ComplexEditorWindow( ModulWindow* pParent ) :
aBrkWindow.SetModulWindow( pParent ); aBrkWindow.SetModulWindow( pParent );
aEdtWindow.Show(); aEdtWindow.Show();
aBrkWindow.Show(); aBrkWindow.Show();
aLineNumberWindow.Show();
aEWVScrollBar.SetLineSize( SCROLL_LINE ); aEWVScrollBar.SetLineSize( SCROLL_LINE );
aEWVScrollBar.SetPageSize( SCROLL_PAGE ); aEWVScrollBar.SetPageSize( SCROLL_PAGE );
@ -1632,8 +1644,6 @@ ComplexEditorWindow::ComplexEditorWindow( ModulWindow* pParent ) :
aEWVScrollBar.Show(); aEWVScrollBar.Show();
} }
void ComplexEditorWindow::Resize() void ComplexEditorWindow::Resize()
{ {
Size aOutSz = GetOutputSizePixel(); Size aOutSz = GetOutputSizePixel();
@ -1643,11 +1653,14 @@ void ComplexEditorWindow::Resize()
long nBrkWidth = 20; long nBrkWidth = 20;
long nSBWidth = aEWVScrollBar.GetSizePixel().Width(); long nSBWidth = aEWVScrollBar.GetSizePixel().Width();
Size aBrkSz( Size( nBrkWidth, aSz.Height() ) ); Size aBrkSz(nBrkWidth, aSz.Height());
aBrkWindow.SetPosSizePixel( Point( DWBORDER, DWBORDER ), aBrkSz ); aBrkWindow.SetPosSizePixel( Point( DWBORDER, DWBORDER ), aBrkSz );
Size aEWSz( Size( aSz.Width() - nBrkWidth - nSBWidth + 2, aSz.Height() ) ); Size aLnSz(aLineNumberWindow.GetWidth(), aSz.Height());
aEdtWindow.SetPosSizePixel( Point( DWBORDER+aBrkSz.Width()-1, DWBORDER ), aEWSz ); 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 );
aEWVScrollBar.SetPosSizePixel( Point( aOutSz.Width()-DWBORDER-nSBWidth, DWBORDER ), Size( nSBWidth, aSz.Height() ) ); aEWVScrollBar.SetPosSizePixel( Point( aOutSz.Width()-DWBORDER-nSBWidth, DWBORDER ), Size( nSBWidth, aSz.Height() ) );
} }