Breakpoint widget patch

Downing, Thomas Thomas.Downing at ipc.com
Thu Jan 13 15:40:02 GMT 2005


Hi,

This is a patch against the 05-01-11 version of KDevelop.  It addresses
issues with breakpoint functionality in C++

- Fix operation of the Enable/Disable feature

- Change single click action to select only

- Add double click to go to FilePos break point in editor

- Add Context menu to break point items, Show, Edit, Disable/Enable, Delete

If there is interest, more fixes/enhancements to breakpoint functions for
C++ will be forthcoming.

Thomas Downig
-------------------------------------------------------------------------


diff -c kdevelop-050111/languages/cpp/debugger/gdbbreakpointwidget.cpp kdevelop-musrum/languages/cpp/debugger/gdbbreakpointwidget.cpp
*** kdevelop-050111/languages/cpp/debugger/gdbbreakpointwidget.cpp  Wed Dec 22 23:08:45 2004
--- kdevelop-musrum/languages/cpp/debugger/gdbbreakpointwidget.cpp  Thu Jan 13 09:42:28 2005
***************
*** 239,247 ****
      header->setLabel( IgnoreCount,  i18n("Ignore Count") );
      header->setLabel( Hits,         i18n("Hits") );

      m_table->show();

!     connect( addMenu,     SIGNAL(activated(int)),
               this,          SLOT(slotAddBlankBreakpoint(int)) );
      connect( m_delete,      SIGNAL(clicked()),
               this,          SLOT(slotRemoveBreakpoint()) );
--- 239,253 ----
      header->setLabel( IgnoreCount,  i18n("Ignore Count") );
      header->setLabel( Hits,         i18n("Hits") );

+     m_ctxMenu = new QPopupMenu( this );
+     m_ctxMenu->insertItem( i18n( "Show" ),    BW_ITEM_Show );
+     m_ctxMenu->insertItem( i18n( "Edit" ),    BW_ITEM_Edit );
+     m_ctxMenu->insertItem( i18n( "Disable" ), BW_ITEM_Disable );
+     m_ctxMenu->insertItem( i18n( "Delete" ),  BW_ITEM_Delete );
+
      m_table->show();

!     connect( addMenu,       SIGNAL(activated(int)),
               this,          SLOT(slotAddBlankBreakpoint(int)) );
      connect( m_delete,      SIGNAL(clicked()),
               this,          SLOT(slotRemoveBreakpoint()) );
***************
*** 250,259 ****
      connect( m_removeAll,   SIGNAL(clicked()),
               this,          SLOT(slotRemoveAllBreakpoints()) );

! //    connect( m_table,       SIGNAL(contextMenuRequested(int, int, const QPoint &)),
! //             this,          SLOT(slotEditRow(int, int, const QPoint &)));
!     connect( m_table,       SIGNAL(clicked(int, int, int, const QPoint &)),
!              this,          SLOT(slotRowSelected(int, int, int, const QPoint &)));
      connect( m_table,       SIGNAL(valueChanged(int, int)),
               this,          SLOT(slotNewValue(int, int)));

--- 256,269 ----
      connect( m_removeAll,   SIGNAL(clicked()),
               this,          SLOT(slotRemoveAllBreakpoints()) );

!     connect( m_table,       SIGNAL(contextMenuRequested(int, int, const QPoint &)),
!              this,          SLOT(slotContextMenuShow(int, int, const QPoint & )) );
!     connect( m_ctxMenu,     SIGNAL(activated(int)),
!              this,          SLOT(slotContextMenuSelect(int)) );
!
!     connect( m_table,       SIGNAL(doubleClicked(int, int, int, const QPoint &)),
!              this,          SLOT(slotRowDoubleClicked(int, int, int, const QPoint &)));
!
      connect( m_table,       SIGNAL(valueChanged(int, int)),
               this,          SLOT(slotNewValue(int, int)));

***************
*** 265,270 ****
--- 275,281 ----
               this,          SLOT(slotRemoveBreakpoint()));
      connect( m_table,       SIGNAL(insertPressed()),
               this,          SLOT(slotAddBreakpoint()));
+
  }

  /***************************************************************************/
***************
*** 417,423 ****
      if (btr)
      {
          Breakpoint* bp=btr->breakpoint();
!         bp->setEnabled(!isEnabled());
          emit publishBPState(*bp);
      }
  }
--- 428,434 ----
      if (btr)
      {
          Breakpoint* bp=btr->breakpoint();
!         bp->setEnabled(!bp->isEnabled());
          emit publishBPState(*bp);
      }
  }
***************
*** 683,689 ****

  /***************************************************************************/

! void GDBBreakpointWidget::slotRowSelected(int row, int col, int btn, const QPoint &)
  {
      if ( btn == Qt::LeftButton )
    {
--- 694,700 ----

  /***************************************************************************/

! void GDBBreakpointWidget::slotRowDoubleClicked(int row, int col, int btn, const QPoint &)
  {
      if ( btn == Qt::LeftButton )
    {
***************
*** 702,707 ****
--- 713,783 ----
      }
  }

+ void GDBBreakpointWidget::slotContextMenuShow( int row, int /*col*/, const QPoint &mousePos )
+ {
+     BreakpointTableRow *btr = (BreakpointTableRow *)m_table->item( row, Control );
+
+     if (btr != NULL)
+     {
+         m_ctxMenu->setItemEnabled( BW_ITEM_Show, (btr->breakpoint( )->type( ) == BP_TYPE_FilePos) );
+         if (btr->breakpoint( )->isEnabled( ))
+         {
+             m_ctxMenu->changeItem( BW_ITEM_Disable, i18n("Disable") );
+         }
+         else
+         {
+             m_ctxMenu->changeItem( BW_ITEM_Disable, i18n("Enable") );
+         }
+
+         //m_ctxMenu->popup( mapToGlobal( mousePos ) );
+         m_ctxMenu->popup( mousePos );
+     }
+ }
+
+ void GDBBreakpointWidget::slotContextMenuSelect( int item )
+ {
+     int                  row, col;
+     BreakpointTableRow  *btr;
+     Breakpoint          *bp;
+     FilePosBreakpoint   *fbp;
+
+     row= m_table->currentRow( );
+     if (row == -1)
+         return;
+     btr = (BreakpointTableRow *)m_table->item( row, Control );
+     if (btr == NULL)
+         return;
+     bp = btr->breakpoint( );
+     if (bp == NULL)
+         return;
+     fbp = dynamic_cast<FilePosBreakpoint*>(bp);
+
+     switch( item )
+     {
+         case BW_ITEM_Show:
+             if (fbp)
+                 emit gotoSourcePosition(fbp->fileName(), fbp->lineNum()-1);
+             break;
+         case BW_ITEM_Edit:
+             col = m_table->currentColumn( );
+             if (col == Location || col ==  Condition || col == IgnoreCount)
+                 m_table->editCell(row, col, false);
+             break;
+         case BW_ITEM_Disable:
+             bp->setEnabled( !bp->isEnabled( ) );
+             btr->setRow( );
+             emit publishBPState( *bp );
+             break;
+         case BW_ITEM_Delete:
+             slotRemoveBreakpoint( );
+             break;
+         default:
+             // oops, check it out! this case is not in sync with the
+             // m_ctxMenu.  Check the enum in the header file.
+             return;
+     }
+ }
+
  /***************************************************************************/

  void GDBBreakpointWidget::slotEditRow(int row, int col, const QPoint &)
diff -c kdevelop-050111/languages/cpp/debugger/gdbbreakpointwidget.h kdevelop-musrum/languages/cpp/debugger/gdbbreakpointwidget.h
*** kdevelop-050111/languages/cpp/debugger/gdbbreakpointwidget.h    Mon Jun 21 22:39:42 2004
--- kdevelop-musrum/languages/cpp/debugger/gdbbreakpointwidget.h    Wed Jan 12 13:49:01 2005
***************
*** 17,22 ****
--- 17,23 ----
  #define _GDBBreakpointWidget_H_

  #include <qhbox.h>
+ #include <qpopupmenu.h>

  class QDomElement;
  class QToolButton;
***************
*** 63,68 ****
--- 64,70 ----
      void slotRefreshBP(const KURL &filename);

  protected:
+     enum BW_ITEMS { BW_ITEM_Show, BW_ITEM_Edit, BW_ITEM_Disable, BW_ITEM_Delete };
      virtual void focusInEvent(QFocusEvent *e);

  private slots:
***************
*** 72,78 ****
      void slotEditBreakpoint();
      void slotAddBreakpoint();
      void slotAddBlankBreakpoint(int idx);
!     void slotRowSelected(int row, int col, int button, const QPoint & mousePos);
      void slotEditRow(int row, int col, const QPoint & mousePos);
      void slotNewValue(int row, int col);

--- 74,82 ----
      void slotEditBreakpoint();
      void slotAddBreakpoint();
      void slotAddBlankBreakpoint(int idx);
!     void slotRowDoubleClicked(int row, int col, int button, const QPoint & mousePos);
!     void slotContextMenuShow( int row, int col, const QPoint &mousePos );
!     void slotContextMenuSelect( int item );
      void slotEditRow(int row, int col, const QPoint & mousePos);
      void slotNewValue(int row, int col);

***************
*** 98,103 ****
--- 102,108 ----
      QToolButton*    m_delete;
      QToolButton*    m_edit;
      QToolButton*    m_removeAll;
+     QPopupMenu*     m_ctxMenu;
  };

  /***************************************************************************/




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop/attachments/20050113/437f75dc/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: musrum_1.patch.bz2
Type: application/x-bzip
Size: 1984 bytes
Desc: musrum_1.patch.bz2
URL: <http://mail.kde.org/pipermail/kdevelop/attachments/20050113/437f75dc/attachment.bin>


More information about the KDevelop mailing list