<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.6944.0">
<TITLE>Breakpoint widget patch</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=2>Hi,<BR>
<BR>
This is a patch against the 05-01-11 version of KDevelop. It addresses<BR>
issues with breakpoint functionality in C++<BR>
<BR>
- Fix operation of the Enable/Disable feature<BR>
<BR>
- Change single click action to select only<BR>
<BR>
- Add double click to go to FilePos break point in editor<BR>
<BR>
- Add Context menu to break point items, Show, Edit, Disable/Enable, Delete<BR>
<BR>
If there is interest, more fixes/enhancements to breakpoint functions for<BR>
C++ will be forthcoming.<BR>
<BR>
Thomas Downig<BR>
-------------------------------------------------------------------------<BR>
<BR>
<BR>
diff -c kdevelop-050111/languages/cpp/debugger/gdbbreakpointwidget.cpp kdevelop-musrum/languages/cpp/debugger/gdbbreakpointwidget.cpp<BR>
*** kdevelop-050111/languages/cpp/debugger/gdbbreakpointwidget.cpp Wed Dec 22 23:08:45 2004<BR>
--- kdevelop-musrum/languages/cpp/debugger/gdbbreakpointwidget.cpp Thu Jan 13 09:42:28 2005<BR>
***************<BR>
*** 239,247 ****<BR>
header->setLabel( IgnoreCount, i18n("Ignore Count") );<BR>
header->setLabel( Hits, i18n("Hits") );<BR>
<BR>
m_table->show();<BR>
<BR>
! connect( addMenu, SIGNAL(activated(int)),<BR>
this, SLOT(slotAddBlankBreakpoint(int)) );<BR>
connect( m_delete, SIGNAL(clicked()),<BR>
this, SLOT(slotRemoveBreakpoint()) );<BR>
--- 239,253 ----<BR>
header->setLabel( IgnoreCount, i18n("Ignore Count") );<BR>
header->setLabel( Hits, i18n("Hits") );<BR>
<BR>
+ m_ctxMenu = new QPopupMenu( this );<BR>
+ m_ctxMenu->insertItem( i18n( "Show" ), BW_ITEM_Show );<BR>
+ m_ctxMenu->insertItem( i18n( "Edit" ), BW_ITEM_Edit );<BR>
+ m_ctxMenu->insertItem( i18n( "Disable" ), BW_ITEM_Disable );<BR>
+ m_ctxMenu->insertItem( i18n( "Delete" ), BW_ITEM_Delete );<BR>
+<BR>
m_table->show();<BR>
<BR>
! connect( addMenu, SIGNAL(activated(int)),<BR>
this, SLOT(slotAddBlankBreakpoint(int)) );<BR>
connect( m_delete, SIGNAL(clicked()),<BR>
this, SLOT(slotRemoveBreakpoint()) );<BR>
***************<BR>
*** 250,259 ****<BR>
connect( m_removeAll, SIGNAL(clicked()),<BR>
this, SLOT(slotRemoveAllBreakpoints()) );<BR>
<BR>
! // connect( m_table, SIGNAL(contextMenuRequested(int, int, const QPoint &)),<BR>
! // this, SLOT(slotEditRow(int, int, const QPoint &)));<BR>
! connect( m_table, SIGNAL(clicked(int, int, int, const QPoint &)),<BR>
! this, SLOT(slotRowSelected(int, int, int, const QPoint &)));<BR>
connect( m_table, SIGNAL(valueChanged(int, int)),<BR>
this, SLOT(slotNewValue(int, int)));<BR>
<BR>
--- 256,269 ----<BR>
connect( m_removeAll, SIGNAL(clicked()),<BR>
this, SLOT(slotRemoveAllBreakpoints()) );<BR>
<BR>
! connect( m_table, SIGNAL(contextMenuRequested(int, int, const QPoint &)),<BR>
! this, SLOT(slotContextMenuShow(int, int, const QPoint & )) );<BR>
! connect( m_ctxMenu, SIGNAL(activated(int)),<BR>
! this, SLOT(slotContextMenuSelect(int)) );<BR>
!<BR>
! connect( m_table, SIGNAL(doubleClicked(int, int, int, const QPoint &)),<BR>
! this, SLOT(slotRowDoubleClicked(int, int, int, const QPoint &)));<BR>
!<BR>
connect( m_table, SIGNAL(valueChanged(int, int)),<BR>
this, SLOT(slotNewValue(int, int)));<BR>
<BR>
***************<BR>
*** 265,270 ****<BR>
--- 275,281 ----<BR>
this, SLOT(slotRemoveBreakpoint()));<BR>
connect( m_table, SIGNAL(insertPressed()),<BR>
this, SLOT(slotAddBreakpoint()));<BR>
+<BR>
}<BR>
<BR>
/***************************************************************************/<BR>
***************<BR>
*** 417,423 ****<BR>
if (btr)<BR>
{<BR>
Breakpoint* bp=btr->breakpoint();<BR>
! bp->setEnabled(!isEnabled());<BR>
emit publishBPState(*bp);<BR>
}<BR>
}<BR>
--- 428,434 ----<BR>
if (btr)<BR>
{<BR>
Breakpoint* bp=btr->breakpoint();<BR>
! bp->setEnabled(!bp->isEnabled());<BR>
emit publishBPState(*bp);<BR>
}<BR>
}<BR>
***************<BR>
*** 683,689 ****<BR>
<BR>
/***************************************************************************/<BR>
<BR>
! void GDBBreakpointWidget::slotRowSelected(int row, int col, int btn, const QPoint &)<BR>
{<BR>
if ( btn == Qt::LeftButton )<BR>
{<BR>
--- 694,700 ----<BR>
<BR>
/***************************************************************************/<BR>
<BR>
! void GDBBreakpointWidget::slotRowDoubleClicked(int row, int col, int btn, const QPoint &)<BR>
{<BR>
if ( btn == Qt::LeftButton )<BR>
{<BR>
***************<BR>
*** 702,707 ****<BR>
--- 713,783 ----<BR>
}<BR>
}<BR>
<BR>
+ void GDBBreakpointWidget::slotContextMenuShow( int row, int /*col*/, const QPoint &mousePos )<BR>
+ {<BR>
+ BreakpointTableRow *btr = (BreakpointTableRow *)m_table->item( row, Control );<BR>
+<BR>
+ if (btr != NULL)<BR>
+ {<BR>
+ m_ctxMenu->setItemEnabled( BW_ITEM_Show, (btr->breakpoint( )->type( ) == BP_TYPE_FilePos) );<BR>
+ if (btr->breakpoint( )->isEnabled( ))<BR>
+ {<BR>
+ m_ctxMenu->changeItem( BW_ITEM_Disable, i18n("Disable") );<BR>
+ }<BR>
+ else<BR>
+ {<BR>
+ m_ctxMenu->changeItem( BW_ITEM_Disable, i18n("Enable") );<BR>
+ }<BR>
+<BR>
+ //m_ctxMenu->popup( mapToGlobal( mousePos ) );<BR>
+ m_ctxMenu->popup( mousePos );<BR>
+ }<BR>
+ }<BR>
+<BR>
+ void GDBBreakpointWidget::slotContextMenuSelect( int item )<BR>
+ {<BR>
+ int row, col;<BR>
+ BreakpointTableRow *btr;<BR>
+ Breakpoint *bp;<BR>
+ FilePosBreakpoint *fbp;<BR>
+<BR>
+ row= m_table->currentRow( );<BR>
+ if (row == -1)<BR>
+ return;<BR>
+ btr = (BreakpointTableRow *)m_table->item( row, Control );<BR>
+ if (btr == NULL)<BR>
+ return;<BR>
+ bp = btr->breakpoint( );<BR>
+ if (bp == NULL)<BR>
+ return;<BR>
+ fbp = dynamic_cast<FilePosBreakpoint*>(bp);<BR>
+<BR>
+ switch( item )<BR>
+ {<BR>
+ case BW_ITEM_Show:<BR>
+ if (fbp)<BR>
+ emit gotoSourcePosition(fbp->fileName(), fbp->lineNum()-1);<BR>
+ break;<BR>
+ case BW_ITEM_Edit:<BR>
+ col = m_table->currentColumn( );<BR>
+ if (col == Location || col == Condition || col == IgnoreCount)<BR>
+ m_table->editCell(row, col, false);<BR>
+ break;<BR>
+ case BW_ITEM_Disable:<BR>
+ bp->setEnabled( !bp->isEnabled( ) );<BR>
+ btr->setRow( );<BR>
+ emit publishBPState( *bp );<BR>
+ break;<BR>
+ case BW_ITEM_Delete:<BR>
+ slotRemoveBreakpoint( );<BR>
+ break;<BR>
+ default:<BR>
+ // oops, check it out! this case is not in sync with the<BR>
+ // m_ctxMenu. Check the enum in the header file.<BR>
+ return;<BR>
+ }<BR>
+ }<BR>
+<BR>
/***************************************************************************/<BR>
<BR>
void GDBBreakpointWidget::slotEditRow(int row, int col, const QPoint &)<BR>
diff -c kdevelop-050111/languages/cpp/debugger/gdbbreakpointwidget.h kdevelop-musrum/languages/cpp/debugger/gdbbreakpointwidget.h<BR>
*** kdevelop-050111/languages/cpp/debugger/gdbbreakpointwidget.h Mon Jun 21 22:39:42 2004<BR>
--- kdevelop-musrum/languages/cpp/debugger/gdbbreakpointwidget.h Wed Jan 12 13:49:01 2005<BR>
***************<BR>
*** 17,22 ****<BR>
--- 17,23 ----<BR>
#define _GDBBreakpointWidget_H_<BR>
<BR>
#include <qhbox.h><BR>
+ #include <qpopupmenu.h><BR>
<BR>
class QDomElement;<BR>
class QToolButton;<BR>
***************<BR>
*** 63,68 ****<BR>
--- 64,70 ----<BR>
void slotRefreshBP(const KURL &filename);<BR>
<BR>
protected:<BR>
+ enum BW_ITEMS { BW_ITEM_Show, BW_ITEM_Edit, BW_ITEM_Disable, BW_ITEM_Delete };<BR>
virtual void focusInEvent(QFocusEvent *e);<BR>
<BR>
private slots:<BR>
***************<BR>
*** 72,78 ****<BR>
void slotEditBreakpoint();<BR>
void slotAddBreakpoint();<BR>
void slotAddBlankBreakpoint(int idx);<BR>
! void slotRowSelected(int row, int col, int button, const QPoint & mousePos);<BR>
void slotEditRow(int row, int col, const QPoint & mousePos);<BR>
void slotNewValue(int row, int col);<BR>
<BR>
--- 74,82 ----<BR>
void slotEditBreakpoint();<BR>
void slotAddBreakpoint();<BR>
void slotAddBlankBreakpoint(int idx);<BR>
! void slotRowDoubleClicked(int row, int col, int button, const QPoint & mousePos);<BR>
! void slotContextMenuShow( int row, int col, const QPoint &mousePos );<BR>
! void slotContextMenuSelect( int item );<BR>
void slotEditRow(int row, int col, const QPoint & mousePos);<BR>
void slotNewValue(int row, int col);<BR>
<BR>
***************<BR>
*** 98,103 ****<BR>
--- 102,108 ----<BR>
QToolButton* m_delete;<BR>
QToolButton* m_edit;<BR>
QToolButton* m_removeAll;<BR>
+ QPopupMenu* m_ctxMenu;<BR>
};<BR>
<BR>
/***************************************************************************/<BR>
<BR>
<BR>
<BR>
</FONT>
</P>
</BODY>
</HTML>