[rkward-cvs] rkward/rkward/dataeditor rkdrag.cpp,1.1,1.2 twintable.cpp,1.26,1.27

Thomas Friedrichsmeier tfry at users.sourceforge.net
Thu Sep 29 13:24:50 UTC 2005


Update of /cvsroot/rkward/rkward/rkward/dataeditor
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31991/rkward/dataeditor

Modified Files:
	rkdrag.cpp twintable.cpp 
Log Message:
Code cleanups, focus: wrap debug-output in RK_DO, add RK_TRACEs

Index: rkdrag.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/dataeditor/rkdrag.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** rkdrag.cpp	18 Aug 2004 12:14:24 -0000	1.1
--- rkdrag.cpp	29 Sep 2005 13:24:48 -0000	1.2
***************
*** 20,31 ****
--- 20,37 ----
  #include "twintable.h"
  
+ #include "../debug.h"
+ 
  RKDrag::RKDrag(TwinTable *dragSource, const char *name) : QDragObject (dragSource, name){
+ 	RK_TRACE (EDITOR);
+ 
  	data = dragSource->encodeSelection ();
  }
  
  RKDrag::~RKDrag(){
+ 	RK_TRACE (EDITOR);
  }
  
  const char* RKDrag::format (int i) const {
+ 	RK_TRACE (EDITOR);
  	if (i == 0) {
  		return "text/tab-separated-values";
***************
*** 38,48 ****
  
  QByteArray RKDrag::encodedData (const char * mimeType) const {
  	QString request = mimeType;
  	if (request == format (0)) {
- 		qDebug ("hit----------------------------");
  		return data;
  	}
  	if (request == format (1)) {
- 		qDebug ("hit++++++++++++++++++++++++++++");
  		return data;
  	}
--- 44,53 ----
  
  QByteArray RKDrag::encodedData (const char * mimeType) const {
+ 	RK_TRACE (EDITOR);
  	QString request = mimeType;
  	if (request == format (0)) {
  		return data;
  	}
  	if (request == format (1)) {
  		return data;
  	}
***************
*** 52,56 ****
  
  bool RKDrag::provides (const char *mimeType) {
! 	qDebug ("provides");
  	if ((mimeType == format (0)) || (mimeType == format (1))) {
  		return true;
--- 57,61 ----
  
  bool RKDrag::provides (const char *mimeType) {
! 	RK_TRACE (EDITOR);
  	if ((mimeType == format (0)) || (mimeType == format (1))) {
  		return true;

Index: twintable.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/dataeditor/twintable.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** twintable.cpp	21 Oct 2004 16:34:42 -0000	1.26
--- twintable.cpp	29 Sep 2005 13:24:48 -0000	1.27
***************
*** 48,60 ****
  
  
! TwinTable::TwinTable (QWidget *parent) : RKEditor (parent){
! 	QGridLayout *grid_layout = new QGridLayout(this);
! 
!     QSplitter *splitter = new QSplitter(this);
!     splitter->setOrientation(QSplitter::Vertical);
  
!     varview = new TwinTableMetaMember (splitter, this);
!     varview->setNumRows (5);
!     varview->setNumCols (5);
  	varview->verticalHeader ()->setLabel (LABEL_ROW, i18n ("Label"));
  	varview->verticalHeader ()->setLabel (TYPE_ROW, i18n ("Type"));
--- 48,62 ----
  
  
! TwinTable::TwinTable (QWidget *parent) : RKEditor (parent) {
! 	RK_TRACE (EDITOR);
  
! 	QGridLayout *grid_layout = new QGridLayout(this);
! 	
! 	QSplitter *splitter = new QSplitter(this);
! 	splitter->setOrientation(QSplitter::Vertical);
! 	
! 	varview = new TwinTableMetaMember (splitter, this);
! 	varview->setNumRows (5);
! 	varview->setNumCols (5);
  	varview->verticalHeader ()->setLabel (LABEL_ROW, i18n ("Label"));
  	varview->verticalHeader ()->setLabel (TYPE_ROW, i18n ("Type"));
***************
*** 64,81 ****
  	varview->setMinimumHeight (varview->horizontalHeader ()->height ());
  	varview->setMaximumHeight (varview->rowPos (NAME_ROW) + varview->rowHeight (NAME_ROW) + varview->horizontalHeader ()->height () + 5);
!     splitter->setResizeMode (varview, QSplitter::KeepSize);
  	varview->verticalHeader()->setResizeEnabled (false);
! 
!     dataview = new TwinTableDataMember (splitter, this);
!     dataview->setNumRows (1);
  	dataview->setNumCols (5);
!     dataview->verticalHeader()->setResizeEnabled (false);
! 
  	dataview->horizontalHeader ()->hide ();
  	dataview->setTopMargin (0);
  	dataview->setLeftMargin (varview->leftMargin ());
  	varview->setHScrollBarMode (QScrollView::AlwaysOff);
! 
!     grid_layout->addWidget (splitter, 0, 0);
  	
  	// these are to keep the two tables in sync
--- 66,83 ----
  	varview->setMinimumHeight (varview->horizontalHeader ()->height ());
  	varview->setMaximumHeight (varview->rowPos (NAME_ROW) + varview->rowHeight (NAME_ROW) + varview->horizontalHeader ()->height () + 5);
! 	splitter->setResizeMode (varview, QSplitter::KeepSize);
  	varview->verticalHeader()->setResizeEnabled (false);
! 	
! 	dataview = new TwinTableDataMember (splitter, this);
! 	dataview->setNumRows (1);
  	dataview->setNumCols (5);
! 	dataview->verticalHeader()->setResizeEnabled (false);
! 	
  	dataview->horizontalHeader ()->hide ();
  	dataview->setTopMargin (0);
  	dataview->setLeftMargin (varview->leftMargin ());
  	varview->setHScrollBarMode (QScrollView::AlwaysOff);
! 	
! 	grid_layout->addWidget (splitter, 0, 0);
  	
  	// these are to keep the two tables in sync
***************
*** 88,95 ****
  	connect (varview, SIGNAL (selectionChanged ()), this, SLOT (dataClearSelection ()));
  	connect (dataview, SIGNAL (selectionChanged ()), this, SLOT (viewClearSelection ()));
! 
  	// this is to catch right-clicks on the top header
  	connect (varview, SIGNAL (headerRightClick (int, int)), this, SLOT (headerRightClicked (int, int)));
! 
  	// which will be reacted upon by the following popup-menu:
  	top_header_menu = new QPopupMenu (this);
--- 90,97 ----
  	connect (varview, SIGNAL (selectionChanged ()), this, SLOT (dataClearSelection ()));
  	connect (dataview, SIGNAL (selectionChanged ()), this, SLOT (viewClearSelection ()));
! 	
  	// this is to catch right-clicks on the top header
  	connect (varview, SIGNAL (headerRightClick (int, int)), this, SLOT (headerRightClicked (int, int)));
! 	
  	// which will be reacted upon by the following popup-menu:
  	top_header_menu = new QPopupMenu (this);
***************
*** 97,101 ****
  	top_header_menu->insertItem (i18n ("Insert new variable right"), this, SLOT (insertColumnRight ()), 0, HEADER_MENU_ID_ADD_COL_RIGHT);
  	top_header_menu->insertItem (i18n ("Delete this variable"), this, SLOT (requestDeleteColumn ()), 0, HEADER_MENU_ID_DEL_COL);
! 
  	// and the same for the left header
  	connect (dataview, SIGNAL (headerRightClick (int, int)), this, SLOT (headerRightClicked (int, int)));
--- 99,103 ----
  	top_header_menu->insertItem (i18n ("Insert new variable right"), this, SLOT (insertColumnRight ()), 0, HEADER_MENU_ID_ADD_COL_RIGHT);
  	top_header_menu->insertItem (i18n ("Delete this variable"), this, SLOT (requestDeleteColumn ()), 0, HEADER_MENU_ID_DEL_COL);
! 	
  	// and the same for the left header
  	connect (dataview, SIGNAL (headerRightClick (int, int)), this, SLOT (headerRightClicked (int, int)));
***************
*** 104,112 ****
  	left_header_menu->insertItem (i18n ("Insert new case below"), this, SLOT (insertRowBelow ()), 0, HEADER_MENU_ID_ADD_ROW_BELOW);
  	left_header_menu->insertItem (i18n ("Delete this case"), this, SLOT (deleteRow ()), 0, HEADER_MENU_ID_DEL_ROW);
- 	
- 	qDebug ("Twintable created");
  }
  
! TwinTable::~TwinTable(){
  	delete top_header_menu;
  	delete left_header_menu;
--- 106,114 ----
  	left_header_menu->insertItem (i18n ("Insert new case below"), this, SLOT (insertRowBelow ()), 0, HEADER_MENU_ID_ADD_ROW_BELOW);
  	left_header_menu->insertItem (i18n ("Delete this case"), this, SLOT (deleteRow ()), 0, HEADER_MENU_ID_DEL_ROW);
  }
  
! TwinTable::~TwinTable() {
! 	RK_TRACE (EDITOR);
! 
  	delete top_header_menu;
  	delete left_header_menu;
***************
*** 120,123 ****
--- 122,127 ----
  
  void TwinTable::scrolled (int x, int) {
+ 	RK_TRACE (EDITOR);
+ 
  	disconnect (varview, SIGNAL (contentsMoving (int, int)), this, SLOT (autoScrolled (int, int)));
  	varview->setContentsPos (x, varview->contentsY ());
***************
*** 126,129 ****
--- 130,135 ----
  
  void TwinTable::autoScrolled (int x, int) {
+ 	RK_TRACE (EDITOR);
+ 
  	disconnect (dataview, SIGNAL (contentsMoving (int, int)), this, SLOT (scrolled (int, int)));
  	dataview->setContentsPos (x, dataview->contentsY ());
***************
*** 132,135 ****
--- 138,143 ----
  
  void TwinTable::deleteColumn (int column) {
+ 	RK_TRACE (EDITOR);
+ 
  	flushEdit ();
  	if ((column >= 0) && (column < numTrueCols ())) {
***************
*** 140,143 ****
--- 148,153 ----
  
  void TwinTable::insertNewColumn (int where) {
+ 	RK_TRACE (EDITOR);
+ 
  	flushEdit ();
  	if ((where < 0) || (where > varview->numCols ())) {
***************
*** 155,158 ****
--- 165,170 ----
  
  void TwinTable::insertNewRow (int where, TwinTableMember *table) {
+ 	RK_TRACE (EDITOR);
+ 
  	flushEdit ();
  	if (!table) table = dataview;
***************
*** 172,175 ****
--- 184,189 ----
  
  void TwinTable::deleteRow (int where, TwinTableMember *table) {
+ 	RK_TRACE (EDITOR);
+ 
  	flushEdit ();
  	if (!table) table = dataview;
***************
*** 189,192 ****
--- 203,208 ----
  
  void TwinTable::headerClicked (int col) {
+ 	RK_TRACE (EDITOR);
+ 
  	QTableSelection selection;
  	selection.init (0, col);
***************
*** 198,201 ****
--- 214,219 ----
  // TODO: handle situation when several entire rows/cols are selected!
  void TwinTable::headerRightClicked (int row, int col) {
+ 	RK_TRACE (EDITOR);
+ 
  	if (col >= 0) {
  			header_pos = col;
***************
*** 232,235 ****
--- 250,255 ----
  
  void TwinTable::viewClearSelection () {
+ 	RK_TRACE (EDITOR);
+ 
  	disconnect (varview, SIGNAL (selectionChanged ()), this, SLOT (dataClearSelection ()));
  	varview->clearSelection ();
***************
*** 238,241 ****
--- 258,263 ----
  
  void TwinTable::dataClearSelection () {
+ 	RK_TRACE (EDITOR);
+ 
  	disconnect (dataview, SIGNAL (selectionChanged ()), this, SLOT (viewClearSelection ()));
  	dataview->clearSelection ();
***************
*** 244,275 ****
--- 266,306 ----
  
  RKDrag *TwinTable::makeDrag () {
+ 	RK_TRACE (EDITOR);
  	return (new RKDrag (this));
  }
  
  void TwinTable::insertColumnRight () {
+ 	RK_TRACE (EDITOR);
  	insertNewColumn (header_pos+1);
  }
  
  void TwinTable::insertColumnLeft () {
+ 	RK_TRACE (EDITOR);
  	insertNewColumn (header_pos);
  }
  
  void TwinTable::requestDeleteColumn () {
+ 	RK_TRACE (EDITOR);
  	emit (deleteColumnRequest (header_pos));
  }
  
  void TwinTable::insertRowBelow () {
+ 	RK_TRACE (EDITOR);
  	insertNewRow (header_pos+1);
  }
  
  void TwinTable::insertRowAbove () {
+ 	RK_TRACE (EDITOR);
  	insertNewRow (header_pos);
  }
  
  void TwinTable::deleteRow () {
+ 	RK_TRACE (EDITOR);
  	deleteRow (header_pos);
  }
  
  QCString TwinTable::encodeSelection () {
+ 	RK_TRACE (EDITOR);
+ 
  	QCString encoded_data;
  	QTable *table = activeTable ();
***************
*** 305,308 ****
--- 336,341 ----
  
  void TwinTable::pasteEncoded (QByteArray content) {
+ 	RK_TRACE (EDITOR);
+ 
  	flushEdit ();
  	
***************
*** 408,411 ****
--- 441,446 ----
  
  TwinTableMember *TwinTable::activeTable () {
+ 	RK_TRACE (EDITOR);
+ 
  	if (varview->hasFocus ()) {
  		return varview;
***************
*** 418,421 ****
--- 453,458 ----
  
  void TwinTable::clearSelected () {
+ 	RK_TRACE (EDITOR);
+ 
  	QTable *table = activeTable ();
   	if (!table) return;
***************
*** 432,439 ****
--- 469,479 ----
  
  void TwinTable::setPasteMode (RKEditor::PasteMode mode) {
+ 	RK_TRACE (EDITOR);
  	paste_mode = mode;
  }
  
  void TwinTable::setRow (TwinTableMember* table, int row, int start_col, int end_col, char **data) {
+ 	RK_TRACE (EDITOR);
+ 
  	flushEdit ();
  	while (numTrueCols () <= end_col) {
***************
*** 448,451 ****
--- 488,493 ----
  
  void TwinTable::setColumn (TwinTableMember* table, int col, int start_row, int end_row, char **data) {
+ 	RK_TRACE (EDITOR);
+ 
  	flushEdit ();
  	while (table->numTrueRows () <= end_row) {
***************
*** 460,463 ****
--- 502,507 ----
  
  void TwinTable::flushEdit () {
+ 	RK_TRACE (EDITOR);
+ 
  	// flush pending edit operations
  	varview->stopEditing ();
***************
*** 466,469 ****
--- 510,514 ----
  
  int TwinTable::numTrueCols () {
+ //	RK_TRACE (EDITOR);
  	return varview->numTrueCols ();
  }





More information about the rkward-tracker mailing list