diff options
author | Stephan Bergmann <sb@openoffice.org> | 2002-07-09 12:25:24 +0000 |
---|---|---|
committer | Stephan Bergmann <sb@openoffice.org> | 2002-07-09 12:25:24 +0000 |
commit | 1d8201fcb58320a9aaa023b52528e6784b38b19b (patch) | |
tree | b26769409011888cf208c4715dc3fbe770048cb3 /basctl | |
parent | bd678678dfc3b4460ed849ae66457dd1cef6dd66 (diff) |
#99377# Modified BreakPointList so that BreakPointDialog can hold a copy and have proper OK/Cancel semantics.
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/baside2b.cxx | 7 | ||||
-rw-r--r-- | basctl/source/basicide/bastypes.cxx | 38 | ||||
-rw-r--r-- | basctl/source/basicide/brkdlg.cxx | 49 | ||||
-rw-r--r-- | basctl/source/basicide/brkdlg.hxx | 7 |
4 files changed, 55 insertions, 46 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 012263652970..cf49d4fdb0fd 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -2,9 +2,9 @@ * * $RCSfile: baside2b.cxx,v $ * - * $Revision: 1.23 $ + * $Revision: 1.24 $ * - * last change: $Author: sb $ $Date: 2002-07-05 10:22:53 $ + * last change: $Author: sb $ $Date: 2002-07-09 13:25:21 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1009,7 +1009,7 @@ void EditorWindow::ParagraphInsertedDeleted( ULONG nPara, BOOL bInserted ) if ( !bInserted && ( nPara == TEXT_PARA_ALL ) ) { - pModulWindow->GetBreakPoints().Reset(); + pModulWindow->GetBreakPoints().reset(); pModulWindow->GetBreakPointWindow().Invalidate(); aHighlighter.initialize( HIGHLIGHT_BASIC ); } @@ -1098,7 +1098,6 @@ BreakPointWindow::BreakPointWindow( Window* pParent ) : __EXPORT BreakPointWindow::~BreakPointWindow() { - aBreakPointList.Reset(); } diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx index 2c7a0606dfb4..a1e0f3bc4a3c 100644 --- a/basctl/source/basicide/bastypes.cxx +++ b/basctl/source/basicide/bastypes.cxx @@ -2,9 +2,9 @@ * * $RCSfile: bastypes.cxx,v $ * - * $Revision: 1.17 $ + * $Revision: 1.18 $ * - * last change: $Author: sb $ $Date: 2002-07-08 14:14:21 $ + * last change: $Author: sb $ $Date: 2002-07-09 13:25:22 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -316,15 +316,33 @@ SfxUndoManager* __EXPORT IDEBaseWindow::GetUndoManager() return NULL; } -void BreakPointList::Reset() +BreakPointList::BreakPointList() +{} + +BreakPointList::BreakPointList(BreakPointList const & rList): + BreakPL(rList.Count()) { - BreakPoint* pBrk = First(); - while ( pBrk ) - { - delete pBrk; - pBrk = Next(); - } - Clear(); + for (ULONG i = 0; i < rList.Count(); ++i) + Insert(new BreakPoint(*rList.GetObject(i)), i); +} + +BreakPointList::~BreakPointList() +{ + reset(); +} + +void BreakPointList::reset() +{ + while (Count() > 0) + delete Remove(Count() - 1); +} + +void BreakPointList::transfer(BreakPointList & rList) +{ + reset(); + for (ULONG i = 0; i < rList.Count(); ++i) + Insert(rList.GetObject(i), i); + rList.Clear(); } void BreakPointList::InsertSorted( BreakPoint* pNewBrk ) diff --git a/basctl/source/basicide/brkdlg.cxx b/basctl/source/basicide/brkdlg.cxx index f41e12163b10..d520e5c1ec6d 100644 --- a/basctl/source/basicide/brkdlg.cxx +++ b/basctl/source/basicide/brkdlg.cxx @@ -2,9 +2,9 @@ * * $RCSfile: brkdlg.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: sb $ $Date: 2002-07-09 08:53:12 $ + * last change: $Author: sb $ $Date: 2002-07-09 13:25:22 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -111,19 +111,20 @@ BreakPointDialog::BreakPointDialog( Window* pParent, BreakPointList& rBrkPntList aBrkText( this, IDEResId( RID_FT_BRKPOINTS ) ), aPassText( this, IDEResId( RID_FT_PASS ) ), aNumericField( this, IDEResId( RID_FLD_PASS ) ), - rBrkPointList( rBrkPntList ) + m_rOriginalBreakPointList(rBrkPntList), + m_aModifiedBreakPointList(rBrkPntList) { FreeResource(); aComboBox.SetUpdateMode( FALSE ); - BreakPoint* pBrk = rBrkPointList.First(); + BreakPoint* pBrk = m_aModifiedBreakPointList.First(); BreakPoint* pFirstBrk = pBrk; while ( pBrk ) { String aEntryStr( RTL_CONSTASCII_USTRINGPARAM( "# " ) ); aEntryStr += String::CreateFromInt32( pBrk->nLine ); aComboBox.InsertEntry( aEntryStr, COMBOBOX_APPEND ); - pBrk = rBrkPointList.Next(); + pBrk = m_aModifiedBreakPointList.Next(); } aComboBox.SetUpdateMode( TRUE ); @@ -158,23 +159,12 @@ void BreakPointDialog::SetCurrentBreakPoint( const BreakPoint& rBrk ) void BreakPointDialog::CheckButtons() { - BOOL bEnableAdd = FALSE; - - String aEditText( aComboBox.GetText() ); - if ( aEditText.Len() ) - bEnableAdd = TRUE; // es besteht die Moeglichkeit. - - for ( USHORT i = 0; i < aComboBox.GetEntryCount(); i++ ) - { - String aStr( aComboBox.GetEntry( i ) ); - if ( aStr.CompareIgnoreCaseToAscii( aEditText ) == COMPARE_EQUAL ) - { - bEnableAdd = FALSE; - break; - } - } - - if ( bEnableAdd ) + // "New" button is enabled if the combo box edit contains a valid line + // number that is not already present in the combo box list; otherwise + // "OK" and "Delete" buttons are enabled: + USHORT nLine; + if (lcl_ParseText(aComboBox.GetText(), nLine) + && m_aModifiedBreakPointList.FindBreakPoint(nLine) == 0) { aNewButton.Enable(); aOKButton.Disable(); @@ -188,8 +178,6 @@ void BreakPointDialog::CheckButtons() } } - - IMPL_LINK_INLINE_START( BreakPointDialog, CheckBoxHdl, CheckBox *, pChkBx ) { BreakPoint* pBrk = GetSelectedBreakPoint(); @@ -209,7 +197,7 @@ IMPL_LINK( BreakPointDialog, ComboBoxHighlightHdl, ComboBox *, pBox ) aDelButton.Enable(); USHORT nEntry = pBox->GetEntryPos( pBox->GetText() ); - BreakPoint* pBrk = rBrkPointList.GetObject( nEntry ); + BreakPoint* pBrk = m_aModifiedBreakPointList.GetObject( nEntry ); DBG_ASSERT( pBrk, "Kein passender Breakpoint zur Liste ?" ); UpdateFields( pBrk ); @@ -236,7 +224,10 @@ IMPL_LINK( BreakPointDialog, EditModifyHdl, Edit *, pEdit ) IMPL_LINK( BreakPointDialog, ButtonHdl, Button *, pButton ) { if ( pButton == &aOKButton ) + { + m_rOriginalBreakPointList.transfer(m_aModifiedBreakPointList); EndDialog( 1 ); + } else if ( pButton == &aNewButton ) { // Checkbox beruecksichtigen! @@ -248,7 +239,7 @@ IMPL_LINK( BreakPointDialog, ButtonHdl, Button *, pButton ) BreakPoint* pBrk = new BreakPoint( nLine ); pBrk->bEnabled = aCheckBox.IsChecked(); pBrk->nStopAfter = aNumericField.GetValue(); - rBrkPointList.InsertSorted( pBrk ); + m_aModifiedBreakPointList.InsertSorted( pBrk ); String aEntryStr( RTL_CONSTASCII_USTRINGPARAM( "# " ) ); aEntryStr += String::CreateFromInt32( pBrk->nLine ); aComboBox.InsertEntry( aEntryStr, COMBOBOX_APPEND ); @@ -271,10 +262,10 @@ IMPL_LINK( BreakPointDialog, ButtonHdl, Button *, pButton ) else if ( pButton == &aDelButton ) { USHORT nEntry = aComboBox.GetEntryPos( aComboBox.GetText() ); - BreakPoint* pBrk = rBrkPointList.GetObject( nEntry ); + BreakPoint* pBrk = m_aModifiedBreakPointList.GetObject( nEntry ); if ( pBrk ) { - delete rBrkPointList.Remove( pBrk ); + delete m_aModifiedBreakPointList.Remove( pBrk ); aComboBox.RemoveEntry( nEntry ); if ( nEntry && !( nEntry < aComboBox.GetEntryCount() ) ) nEntry--; @@ -314,7 +305,7 @@ void BreakPointDialog::UpdateFields( BreakPoint* pBrk ) BreakPoint* BreakPointDialog::GetSelectedBreakPoint() { USHORT nEntry = aComboBox.GetEntryPos( aComboBox.GetText() ); - BreakPoint* pBrk = rBrkPointList.GetObject( nEntry ); + BreakPoint* pBrk = m_aModifiedBreakPointList.GetObject( nEntry ); return pBrk; } diff --git a/basctl/source/basicide/brkdlg.hxx b/basctl/source/basicide/brkdlg.hxx index ca3f9b389ee9..55088dc682d6 100644 --- a/basctl/source/basicide/brkdlg.hxx +++ b/basctl/source/basicide/brkdlg.hxx @@ -2,9 +2,9 @@ * * $RCSfile: brkdlg.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mh $ $Date: 2000-09-29 11:02:36 $ + * last change: $Author: sb $ $Date: 2002-07-09 13:25:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -97,7 +97,8 @@ private: FixedText aPassText; NumericField aNumericField; - BreakPointList& rBrkPointList; + BreakPointList & m_rOriginalBreakPointList; + BreakPointList m_aModifiedBreakPointList; protected: void CheckButtons(); |