[rkward-cvs] rkward/rkward rkcommandeditor.h,1.3,1.4 rkeditormanager.cpp,1.6,1.7 rkeditormanager.h,1.5,1.6 rkward.cpp,1.91,1.92 rkward.h,1.40,1.41

Thomas Friedrichsmeier tfry at users.sourceforge.net
Wed Sep 14 21:07:09 UTC 2005


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

Modified Files:
	rkcommandeditor.h rkeditormanager.cpp rkeditormanager.h 
	rkward.cpp rkward.h 
Log Message:
RKEditorDataFrame is a KMdiChildView, now, and wrapped in a Part.

Index: rkward.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rkward.cpp,v
retrieving revision 1.91
retrieving revision 1.92
diff -C2 -d -r1.91 -r1.92
*** rkward.cpp	14 Sep 2005 16:32:25 -0000	1.91
--- rkward.cpp	14 Sep 2005 21:07:06 -0000	1.92
***************
*** 17,24 ****
  
  // include files for QT
- #include <qdir.h>
  #include <qprinter.h>
  #include <qpainter.h>
- #include <qclipboard.h>
  #include <qcheckbox.h>
  #include <qpushbutton.h>
--- 17,22 ----
***************
*** 56,61 ****
  #include "rkdocmanager.h" 
  #include "core/rkmodificationtracker.h"
- #include "dataeditor/rkeditor.h"
- #include "dataeditor/rkdrag.h"
  #include "rkwatch.h"
  #include "misc/rkmenu.h"
--- 54,57 ----
***************
*** 119,126 ****
  
  	RKGlobals::manager = new RKEditorManager ();
! 	KMdiChildView * editorManagerView = createWrapper(RKGlobals::editorManager (), i18n( "Data editor"), i18n( "Data editor"));
  	editorManagerView->setIcon(SmallIcon("spreadsheet"));
  	editorManagerView->setName("dataeditor");
! 	addWindow( editorManagerView );
  	
  	
--- 115,122 ----
  
  	RKGlobals::manager = new RKEditorManager ();
! /*	KMdiChildView * editorManagerView = createWrapper(RKGlobals::editorManager (), i18n( "Data editor"), i18n( "Data editor"));
  	editorManagerView->setIcon(SmallIcon("spreadsheet"));
  	editorManagerView->setName("dataeditor");
! 	addWindow( editorManagerView ); */
  	
  	
***************
*** 128,136 ****
  	
  	connect (this, SIGNAL (childWindowCloseRequest (KMdiChildView *)), this, SLOT (slotChildWindowCloseRequest (KMdiChildView *)));
! 	connect (this, SIGNAL (viewActivated (KMdiChildView *)), this, SLOT (slotViewActivated (KMdiChildView *)));
  
  
- 	connect (RKGlobals::editorManager (), SIGNAL (editorClosed ()), this, SLOT (slotEditorsChanged ()));
- 	connect (RKGlobals::editorManager (), SIGNAL (editorOpened ()), this, SLOT (slotEditorsChanged ()));
  	RKGlobals::mtracker = new RKModificationTracker (this);
  	RKGlobals::cmap = new RKComponentMap ();
--- 124,130 ----
  	
  	connect (this, SIGNAL (childWindowCloseRequest (KMdiChildView *)), this, SLOT (slotChildWindowCloseRequest (KMdiChildView *)));
! //	connect (this, SIGNAL (viewActivated (KMdiChildView *)), this, SLOT (slotViewActivated (KMdiChildView *)));
  
  
  	RKGlobals::mtracker = new RKModificationTracker (this);
  	RKGlobals::cmap = new RKComponentMap ();
***************
*** 154,164 ****
  }
  
  RKwardApp::~RKwardApp() {
  	RK_TRACE (APP);
! 	slotCloseAllEditors ();
  	delete RKGlobals::rInterface ();
  	delete RKGlobals::rObjectList ();
  	delete object_browser;
  	delete RKGlobals::tracker ();
  }
  
--- 148,164 ----
  }
  
+ void RKwardApp::activateGUI (KParts::Part *part) {
+ 	RK_TRACE (APP);
+ 	createGUI (part);
+ }
+ 
  RKwardApp::~RKwardApp() {
  	RK_TRACE (APP);
! 	RKGlobals::editorManager()->closeAll ();
  	delete RKGlobals::rInterface ();
  	delete RKGlobals::rObjectList ();
  	delete object_browser;
  	delete RKGlobals::tracker ();
+ 	delete RKGlobals::editorManager ();
  }
  
***************
*** 194,197 ****
--- 194,215 ----
  	initPlugins ();
  	
+ 	//It's necessary to give a different name to all tool windows, or they won't be properly displayed
+ 	object_browser->setName("workspace"); 
+ 	object_browser->setIcon(SmallIcon("view_tree"));
+ 	addToolWindow(object_browser,KDockWidget::DockLeft, getMainDockWidget(), 30 , i18n ("Existing objects in your workspace.") , i18n ("Workspace"));
+ 	
+ 	RKGlobals::rInterface ()->watch->setName("Command log");
+ 	RKGlobals::rInterface ()->watch->setIcon(SmallIcon("text_block"));
+ 	addToolWindow(RKGlobals::rInterface ()->watch,KDockWidget::DockBottom, getMainDockWidget(), 10);
+ 
+ 	console = new RKConsole(0);
+ 	console->setIcon(SmallIcon("konsole"));
+ 	console->setName("r_console");
+ 	addToolWindow(console,KDockWidget::DockBottom, getMainDockWidget(), 10);
+ 	
+ 	helpDlg = new KHelpDlg(0);
+ 	helpDlg->setIcon(SmallIcon("help"));
+ 	addToolWindow(helpDlg,KDockWidget::DockBottom, getMainDockWidget(), 10);
+ 
  	if (initial_url) {
  		openWorkspace (*initial_url);
***************
*** 214,235 ****
  	
  	show ();
- 	
- 	//It's necessary to give a different name to all tool windows, or they won't be properly displayed
- 	object_browser->setName("workspace"); 
- 	object_browser->setIcon(SmallIcon("view_tree"));
- 	addToolWindow(object_browser,KDockWidget::DockLeft, getMainDockWidget(), 30 , i18n ("Existing objects in your workspace.") , i18n ("Workspace"));
- 	
- 	RKGlobals::rInterface ()->watch->setName("Command log");
- 	RKGlobals::rInterface ()->watch->setIcon(SmallIcon("text_block"));
- 	addToolWindow(RKGlobals::rInterface ()->watch,KDockWidget::DockBottom, getMainDockWidget(), 10);
- 
- 	console = new RKConsole(0);
- 	console->setIcon(SmallIcon("konsole"));
- 	console->setName("r_console");
- 	addToolWindow(console,KDockWidget::DockBottom, getMainDockWidget(), 10);
- 	
- 	helpDlg = new KHelpDlg(0);
- 	helpDlg->setIcon(SmallIcon("help"));
- 	addToolWindow(helpDlg,KDockWidget::DockBottom, getMainDockWidget(), 10);
  }
  
--- 232,235 ----
***************
*** 250,254 ****
  	}
  
! 	slotStatusMsg(i18n("Ready."));
  }
  
--- 250,254 ----
  	}
  
! 	slotStatusReady ();
  }
  
***************
*** 312,324 ****
  	filePrint->setEnabled (false);
  	fileQuit = KStdAction::quit(this, SLOT(slotFileQuit()), actionCollection(), "file_quitx");
- 	
- 	editCut = KStdAction::cut(this, SLOT(slotEditCut()), actionCollection(), "cut");
- 	editCopy = KStdAction::copy(this, SLOT(slotEditCopy()), actionCollection(), "copy");
- 	editPaste = KStdAction::paste(this, SLOT(slotEditPaste()), actionCollection(), "paste");
- 	editPasteToTable = new KAction(i18n("Paste inside Table"), 0, 0, this, SLOT(slotEditPasteToTable()), actionCollection(), "paste_to_table");
- 	editPasteToTable->setIcon("frame_spreadsheet");
- 	editPasteToSelection = new KAction(i18n("Paste inside Selection"), 0, 0, this, SLOT(slotEditPasteToSelection()), actionCollection(), "paste_to_selection");
- 	editPasteToSelection->setIcon("frame_edit");
- 
  
  	outputShow= new KAction (i18n ("&Show / Refresh"), 0, 0, this, SLOT (slotOutputShow ()), actionCollection (), "output_show");
--- 312,315 ----
***************
*** 357,365 ****
  	filePrint ->setStatusText(i18n("Prints out the actual document"));
  	fileQuit->setStatusText(i18n("Quits the application"));
- 	editCut->setStatusText(i18n("Cuts the selected section and puts it to the clipboard"));
- 	editCopy->setStatusText(i18n("Copies the selected section to the clipboard"));
- 	editPaste->setStatusText(i18n("Pastes the clipboard contents to actual position"));
- 	editPasteToTable->setStatusText(i18n("Pastes the clipboard contents to actual position, but not beyond the table's boundaries"));
- 	editPasteToSelection->setStatusText(i18n("Pastes the clipboard contents to actual position, but not beyond the boundaries of the current selection"));
  	viewToolBar->setStatusText(i18n("Enables/disables the toolbar"));
  	viewStatusBar->setStatusText(i18n("Enables/disables the statusbar"));
--- 348,351 ----
***************
*** 541,548 ****
  /////////////////////////////////////////////////////////////////////
  
  void RKwardApp::slotEditorsChanged () {
  	RK_TRACE (APP);
! 	close_editor->setEnabled (RKGlobals::editorManager ()->numEditors ());
! 	close_all_editors->setEnabled (RKGlobals::editorManager ()->numEditors ());
  }
  
--- 527,535 ----
  /////////////////////////////////////////////////////////////////////
  
+ // TODO: remove
  void RKwardApp::slotEditorsChanged () {
  	RK_TRACE (APP);
! //	close_editor->setEnabled (RKGlobals::editorManager ()->numEditors ());
! //	close_all_editors->setEnabled (RKGlobals::editorManager ()->numEditors ());
  }
  
***************
*** 572,576 ****
  		openWorkspace (lurl);
  	}
! 	slotStatusMsg(i18n("Ready."));
  }
  
--- 559,563 ----
  		openWorkspace (lurl);
  	}
! 	slotStatusReady ();
  }
  
***************
*** 621,632 ****
  void RKwardApp::slotCloseEditor () {
  	RK_TRACE (APP);
! 	RKGlobals::editorManager ()->closeEditor (RKGlobals::editorManager ()->currentEditor ());
  }
  
  void RKwardApp::slotCloseAllEditors () {
  	RK_TRACE (APP);
! 	while (RKGlobals::editorManager ()->numEditors ()) {
  		RKGlobals::editorManager ()->closeEditor (RKGlobals::editorManager ()->currentEditor ());
! 	}
  }
  
--- 608,619 ----
  void RKwardApp::slotCloseEditor () {
  	RK_TRACE (APP);
! 	//RKGlobals::editorManager ()->closeEditor (RKGlobals::editorManager ()->currentEditor ());
  }
  
  void RKwardApp::slotCloseAllEditors () {
  	RK_TRACE (APP);
! /*	while (RKGlobals::editorManager ()->numEditors ()) {
  		RKGlobals::editorManager ()->closeEditor (RKGlobals::editorManager ()->currentEditor ());
! 	}*/
  }
  
***************
*** 642,646 ****
  	}
  	
! 	slotStatusMsg(i18n("Ready."));
  }
  
--- 629,633 ----
  	}
  	
! 	slotStatusReady ();
  }
  
***************
*** 652,740 ****
  }
  
- void RKwardApp::slotEditCut()
- {
- 	RK_TRACE (APP);
- 	
- 	if ((QString) activeWindow()->name()!="dataeditor"){
- 		return;
- 	}
- 	
- 	slotStatusMsg(i18n("Cutting selection..."));
- 	slotEditCopy ();
- 	RKGlobals::editorManager ()->currentEditor ()->clearSelected ();
- 	slotStatusMsg(i18n("Ready."));
- 	
- }
- 
- void RKwardApp::slotEditCopy() {
- 	RK_TRACE (APP);
- 	
- 	if ((QString) activeWindow()->name()!="dataeditor"){
- 		return;
- 	}
- 	
- 	slotStatusMsg(i18n("Copying selection to clipboard..."));
- 	QApplication::clipboard()->setData(RKGlobals::editorManager ()->currentEditor ()->makeDrag ());
- 	slotStatusMsg(i18n("Ready."));
- 	
- }
- 
- void RKwardApp::doPaste () {
- 	RK_TRACE (APP);
- 	
- 	if ((QString) activeWindow()->name()!="dataeditor"){
- 		return;
- 	}
- 	
- 	
- 	slotStatusMsg(i18n("Inserting clipboard contents..."));
- 
- 	// actually, we don't care, whether tsv or plain gets pasted - it's both
- 	// treated the same. We should however encourage external senders to
- 	// provided the two in order.
- 	if (QApplication::clipboard()->data()->provides ("text/tab-separated-values")) {
- 		qDebug ("paste tsv");
- 		RKGlobals::editorManager ()->currentEditor ()->paste (QApplication::clipboard()->data()->encodedData ("text/tab-separated-values"));
- 	} else if (QApplication::clipboard()->data()->provides ("text/plain")) {
- 		qDebug ("paste plain");
- 		RKGlobals::editorManager ()->currentEditor ()->paste (QApplication::clipboard()->data()->encodedData ("text/plain"));
- 	}
- 
- 	slotStatusMsg(i18n("Ready."));
- }
- 
- void RKwardApp::slotEditPaste() {
- 	if ((QString) activeWindow()->name()!="dataeditor"){
- 		return;
- 	}
- 	
- 	RK_TRACE (APP);
- 	RKGlobals::editorManager ()->currentEditor ()->setPasteMode (RKEditor::PasteEverywhere);
-  	doPaste ();
- 	
- 
- }
- 
- void RKwardApp::slotEditPasteToTable() {
- 	RK_TRACE (APP);
- 	if ((QString) activeWindow()->name()!="dataeditor"){
- 		return;
- 	}
- 		
- 	
- 	RKGlobals::editorManager ()->currentEditor ()->setPasteMode (RKEditor::PasteToTable);
- 	doPaste();
- }
- void RKwardApp::slotEditPasteToSelection() {
- 	RK_TRACE (APP);
- 	
- 	if ((QString) activeWindow()->name()!="dataeditor"){
- 		return;
- 	}
- 
- 	RKGlobals::editorManager ()->currentEditor ()->setPasteMode (RKEditor::PasteToSelection);
- 	doPaste();
- }
- 
  void RKwardApp::slotViewToolBar()
  {
--- 639,642 ----
***************
*** 756,760 ****
    }		
  
!   slotStatusMsg(i18n("Ready."));
  }
  
--- 658,662 ----
    }		
  
!   slotStatusReady ();
  }
  
***************
*** 774,784 ****
    }
  
!   slotStatusMsg(i18n("Ready."));
  }
  
  
! void RKwardApp::slotStatusMsg(const QString &text)
! {
  	RK_TRACE (APP);
    ///////////////////////////////////////////////////////////////////
    // change status message permanently
--- 676,686 ----
    }
  
!   slotStatusReady ();
  }
  
  
! void RKwardApp::slotStatusMsg(const QString &text) {
  	RK_TRACE (APP);
+ 
    ///////////////////////////////////////////////////////////////////
    // change status message permanently
***************
*** 787,790 ****
--- 689,698 ----
  }
  
+ void RKwardApp::slotStatusReady () {
+ 	RK_TRACE (APP);
+ 
+ 	slotStatusMsg (i18n ("Ready"));
+ }
+ 
  void RKwardApp::slotShowRKWatch () {
  	RK_TRACE (APP);
***************
*** 1031,1035 ****
  
  void RKwardApp::slotRunAll() {
! 	if (! activeWindow()->inherits("RKCommandEditorWindow"))
  		return;
  	if(((RKCommandEditorWindow*) activeWindow())->getText().isEmpty() || ((RKCommandEditorWindow*) activeWindow())->getText().isNull())
--- 939,943 ----
  
  void RKwardApp::slotRunAll() {
! 	if (!activeWindow()->inherits("RKCommandEditorWindow"))
  		return;
  	if(((RKCommandEditorWindow*) activeWindow())->getText().isEmpty() || ((RKCommandEditorWindow*) activeWindow())->getText().isNull())
***************
*** 1040,1043 ****
--- 948,952 ----
  
  
+ // TODO: remove this!!!
  void RKwardApp::slotViewActivated (KMdiChildView * window)
  {
***************
*** 1066,1074 ****
  {
  	if (objectEditor) {
-   		editCut->setEnabled(true);
-   		editCopy->setEnabled(true);
-   		editPaste->setEnabled(true);
-     		editPasteToSelection->setEnabled(true);
-     		editPasteToTable->setEnabled(true);
  		fileSave->setEnabled(false);
  		fileSaveAs->setEnabled(false);
--- 975,978 ----
***************
*** 1079,1087 ****
  	}
  	else{
- 		editCut->setEnabled(false);
- 		editCopy->setEnabled(false);
- 		editPaste->setEnabled(false);
- 		editPasteToSelection->setEnabled(false);
- 		editPasteToTable->setEnabled(false);
  		fileSave->setEnabled(true);
  		fileSaveAs->setEnabled(true);
--- 983,986 ----

Index: rkward.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rkward.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** rkward.h	14 Sep 2005 16:32:25 -0000	1.40
--- rkward.h	14 Sep 2005 21:07:06 -0000	1.41
***************
*** 102,105 ****
--- 102,108 ----
  
  	KParts::PartManager *m_manager;
+ 
+ /** it seems, sometimes, when creating a new part-object, we need to help the partmanager a little to notice... */
+ 	void activateGUI (KParts::Part *part);
  protected:
  	void openWorkspace (const KURL &url);
***************
*** 164,183 ****
  	*/
  	void slotFileQuit();
- 	/** put the marked text/object into the clipboard and remove
- 	*	it from the document
- 	*/
- 	void slotEditCut();
- 	/** put the marked text/object into the clipboard
- 	*/
- 	void slotEditCopy();
- 	/** paste the clipboard into the document
- 	*/
- 	void slotEditPaste();
- 	/** paste the clipboard into the document, but not beyond table boundaries
- 	*/
- 	void slotEditPasteToTable();
- 	/** paste the clipboard into the document, but not beyond selection boundaries
- 	*/
- 	void slotEditPasteToSelection();
  	/** toggles the toolbar
  	*/
--- 167,170 ----
***************
*** 190,193 ****
--- 177,181 ----
  	*/
  	void slotStatusMsg(const QString &text);
+ 	void slotStatusReady ();
  
  	/** shows/hides the RKWatch-window */
***************
*** 255,263 ****
  	KAction* editUndo;
  	KAction* editRedo;
- 	KAction* editCut;
- 	KAction* editCopy;
- 	KAction* editPaste;
- 	KAction* editPasteToSelection;
- 	KAction* editPasteToTable;
  
  	KAction* outputShow;
--- 243,246 ----
***************
*** 283,289 ****
  	friend class RKSettings;
  
- 	/** Does pasting (called from the respective slots) */
- 	void doPaste ();
- 
  	/** Finds plugins and inserts them into the menu-structure */
  	void initPlugins ();
--- 266,269 ----

Index: rkeditormanager.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rkeditormanager.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** rkeditormanager.h	25 Oct 2004 15:55:56 -0000	1.5
--- rkeditormanager.h	14 Sep 2005 21:07:06 -0000	1.6
***************
*** 20,31 ****
  #include <qwidget.h>
  #include <qmap.h>
  
  #include "rbackend/rcommandreceiver.h"
  
- class QTabWidget;
  class RKEditor;
  class RObject;
  class RCommandChain;
  class RCommand;
  
  /**
--- 20,32 ----
  #include <qwidget.h>
  #include <qmap.h>
+ #include <qvaluelist.h>
  
  #include "rbackend/rcommandreceiver.h"
  
  class RKEditor;
  class RObject;
  class RCommandChain;
  class RCommand;
+ class RKEditorDataFrame;
  
  /**
***************
*** 34,44 ****
  @author Thomas Friedrichsmeier
  */
! class RKEditorManager : public QWidget, public RCommandReceiver {
  Q_OBJECT
  public:
!     RKEditorManager(QWidget *parent);
!     RKEditorManager();
!     
!     ~RKEditorManager();
  
  	RKEditor *editObject (RObject *object, bool initialize_to_empty=false);
--- 35,44 ----
  @author Thomas Friedrichsmeier
  */
! class RKEditorManager : public QObject, public RCommandReceiver {
  Q_OBJECT
  public:
! 	RKEditorManager();
! 
! 	~RKEditorManager();
  
  	RKEditor *editObject (RObject *object, bool initialize_to_empty=false);
***************
*** 49,60 ****
  
  	void flushAll ();
  	
  	bool canEditObject (RObject *object);
  
  /// returns the currently active editor
! 	RKEditor *currentEditor ();
  	void setEditorName (RKEditor *editor, const QString &new_name);
  	
! 	int numEditors ();
  signals:
  	void editorClosed ();
--- 49,61 ----
  
  	void flushAll ();
+ 	void closeAll ();
  	
  	bool canEditObject (RObject *object);
  
  /// returns the currently active editor
! //	RKEditor *currentEditor ();
  	void setEditorName (RKEditor *editor, const QString &new_name);
  	
! //	int numEditors ();
  signals:
  	void editorClosed ();
***************
*** 63,68 ****
  	void rCommandDone (RCommand *command);
  private:
- 	QTabWidget *tabbook;
  	RCommandChain *restore_chain;
  };
  
--- 64,70 ----
  	void rCommandDone (RCommand *command);
  private:
  	RCommandChain *restore_chain;
+ 	RKEditorDataFrame *newRKEditorDataFrame ();
+ 	QValueList<RKEditor*> editors;
  };
  

Index: rkeditormanager.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rkeditormanager.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** rkeditormanager.cpp	25 Oct 2004 15:55:56 -0000	1.6
--- rkeditormanager.cpp	14 Sep 2005 21:07:06 -0000	1.7
***************
*** 17,23 ****
  #include "rkeditormanager.h"
  
- #include <qtabwidget.h>
- #include <qlayout.h>
- 
  #include "dataeditor/rkeditor.h"
  #include "dataeditor/rkeditordataframe.h"
--- 17,20 ----
***************
*** 27,50 ****
  #include "rbackend/rinterface.h"
  #include "rkglobals.h"
  
  #include "debug.h"
  
  #define RESTORE_COMMAND 1
  
! RKEditorManager::RKEditorManager (QWidget *parent) : QWidget (parent) {
  	RK_TRACE (APP);
- 	QGridLayout *grid = new QGridLayout (this, 1, 1);
- 	tabbook = new QTabWidget (this);
- 	grid->addWidget (tabbook, 0, 0);
- 	
- 	restore_chain = 0;
- }
  
- RKEditorManager::RKEditorManager ()   {
- 	RK_TRACE (APP);
- 	QGridLayout *grid = new QGridLayout (this, 1, 1);
- 	tabbook = new QTabWidget (this);
- 	grid->addWidget (tabbook, 0, 0);
- 	
  	restore_chain = 0;
  }
--- 24,38 ----
  #include "rbackend/rinterface.h"
  #include "rkglobals.h"
+ #include "rkward.h"
  
  #include "debug.h"
  
+ #include <kiconloader.h>
+ 
  #define RESTORE_COMMAND 1
  
! RKEditorManager::RKEditorManager () : QObject () {
  	RK_TRACE (APP);
  
  	restore_chain = 0;
  }
***************
*** 58,64 ****
  	RObject *iobj = object;
  	RKEditor *ed = 0;
! 	if (!object->objectOpened()) {
  		if (object->isDataFrame ()) {
! 			ed = new RKEditorDataFrame (tabbook);
  			// TODO: add child objects, too?
  			ed->openObject (object, initialize_to_empty);
--- 46,52 ----
  	RObject *iobj = object;
  	RKEditor *ed = 0;
! 	if (!object->objectOpened ()) {
  		if (object->isDataFrame ()) {
! 			ed = newRKEditorDataFrame ();
  			// TODO: add child objects, too?
  			ed->openObject (object, initialize_to_empty);
***************
*** 66,90 ****
  			if (!object->getContainer ()->objectOpened ()) { 
  				iobj = object->getContainer ();
! 				ed = new RKEditorDataFrame (tabbook);
  				// TODO: add child objects, too?
  				ed->openObject (iobj, initialize_to_empty);
  				// ed->focusObject (obj);
  			} else {
! 				tabbook->showPage (object->getContainer ()->objectOpened ());
  			}
  		}
  
  		if (ed) {
! 			hide ();
! 			tabbook->insertTab (ed, iobj->getShortName ());
! 			tabbook->showPage (ed);
! 			show ();
  			emit (editorOpened ());
! 			
  			RCommand *command = new RCommand (".rk.editor.opened (" + iobj->getFullName() + ")", RCommand::App | RCommand::Sync);
  			RKGlobals::rInterface ()->issueCommand (command, restore_chain);
  		}
  	} else {
! 		tabbook->showPage (object->objectOpened ());
  	}
  	
--- 54,79 ----
  			if (!object->getContainer ()->objectOpened ()) { 
  				iobj = object->getContainer ();
! 				ed = newRKEditorDataFrame ();
  				// TODO: add child objects, too?
  				ed->openObject (iobj, initialize_to_empty);
  				// ed->focusObject (obj);
  			} else {
! 				if (object->getContainer ()->objectOpened ()) {
! 					object->getContainer ()->objectOpened ()->show ();
! 					object->getContainer ()->objectOpened ()->raise ();
! 				}
  			}
  		}
  
  		if (ed) {
! 			setEditorName (ed, iobj->getShortName ());
  			emit (editorOpened ());
! 
  			RCommand *command = new RCommand (".rk.editor.opened (" + iobj->getFullName() + ")", RCommand::App | RCommand::Sync);
  			RKGlobals::rInterface ()->issueCommand (command, restore_chain);
  		}
  	} else {
! 		object->objectOpened ()->show ();
! 		object->objectOpened ()->raise ();
  	}
  	
***************
*** 118,131 ****
  }
  
- RKEditor *RKEditorManager::currentEditor () {
- 	RK_TRACE (APP);	
- 	return static_cast<RKEditor*> (tabbook->currentPage ());
- }
- 
- int RKEditorManager::numEditors () {
- 	RK_TRACE (APP);	
- 	return tabbook->count ();
- }
- 
  void RKEditorManager::closeEditor (RKEditor *editor) {
  	RK_TRACE (APP);
--- 107,110 ----
***************
*** 134,138 ****
  	
  	RObject *object = editor->getObject ();
! 	delete editor;
  
  	RCommand *command = new RCommand (".rk.editor.closed (" + object->getFullName() + ")", RCommand::App | RCommand::Sync);
--- 113,117 ----
  	
  	RObject *object = editor->getObject ();
! 	RKGlobals::rkApp ()->closeWindow (editor);
  
  	RCommand *command = new RCommand (".rk.editor.closed (" + object->getFullName() + ")", RCommand::App | RCommand::Sync);
***************
*** 145,153 ****
  	RK_TRACE (APP);
  
! 	for (int i=0; i < tabbook->count (); ++i) {
! 		static_cast<RKEditor*> (tabbook->page (i))->flushChanges ();
  	}
  }
  
  bool RKEditorManager::canEditObject (RObject *object) {
  	RK_TRACE (APP);
--- 124,142 ----
  	RK_TRACE (APP);
  
! 	for (QValueList<RKEditor*>::const_iterator it = editors.begin (); it != editors.end (); ++it) {
! 		(*it)->flushChanges ();
  	}
  }
  
+ void RKEditorManager::closeAll () {
+ 	RK_TRACE (APP);
+ 
+ 	for (QValueList<RKEditor*>::const_iterator it = editors.begin (); it != editors.end (); ++it) {
+ 		closeEditor (*it);
+ 	}
+ 
+ 	editors.clear ();
+ }
+ 
  bool RKEditorManager::canEditObject (RObject *object) {
  	RK_TRACE (APP);
***************
*** 162,166 ****
  
  void RKEditorManager::setEditorName (RKEditor *editor, const QString &new_name) {
! 	tabbook->setTabLabel (editor, new_name);
  }
  
--- 151,169 ----
  
  void RKEditorManager::setEditorName (RKEditor *editor, const QString &new_name) {
! 	RK_TRACE (APP);
! 	editor->setMDICaption (new_name);
! }
! 
! RKEditorDataFrame *RKEditorManager::newRKEditorDataFrame () {
! 	RK_TRACE (APP);
! 
! 	RKEditorDataFrame *ed = new RKEditorDataFrame (0);
! 	(RKGlobals::rkApp()->m_manager)->addPart (ed->getPart (), false);
! 	RKGlobals::rkApp ()->addWindow (ed);
! 	ed->setIcon (SmallIcon ("spreadsheet"));
! 	editors.append (ed);
! 	RKGlobals::rkApp ()->activateGUI (ed->getPart ());
! 
! 	return ed;
  }
  

Index: rkcommandeditor.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rkcommandeditor.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** rkcommandeditor.h	31 Aug 2004 14:18:31 -0000	1.3
--- rkcommandeditor.h	14 Sep 2005 21:07:06 -0000	1.4
***************
*** 29,32 ****
--- 29,34 ----
  Provides a wrapper around the Kate-part used for syntax-highlighting
  
+ TODO: This class seems to be obsolete! Check whether RCommandEditorWindow provides all required functionality, and use that instead.
+ 
  @author Thomas Friedrichsmeier
  */





More information about the rkward-tracker mailing list