[rkward-cvs] rkward/rkward rkdocmanager.h,NONE,1.1 rkdocmanager.cpp,NONE,1.1 rkward.cpp,1.48,1.49 rkward.h,1.22,1.23 rkwatch.cpp,1.30,1.31 rkwatch.h,1.11,1.12

Pierre ecoch at users.sourceforge.net
Mon Oct 25 15:43:16 UTC 2004


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

Modified Files:
	rkward.cpp rkward.h rkwatch.cpp rkwatch.h 
Added Files:
	rkdocmanager.h rkdocmanager.cpp 
Log Message:
Using IDEAI to manage windows. Adding a RKDocManager class wich will some day handle .R files.


Index: rkwatch.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rkwatch.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** rkwatch.cpp	28 Sep 2004 16:53:28 -0000	1.30
--- rkwatch.cpp	25 Oct 2004 15:43:14 -0000	1.31
***************
*** 56,76 ****
  	
  	// add run & reset buttons
! 	QVBoxLayout *button_vbox = new QVBoxLayout (0, 0, 6);
! 	bottom_hbox->addLayout (button_vbox);
  	
  	submit = new QPushButton(i18n ("&Run"), layout_widget);
  	connect (submit, SIGNAL (clicked ()), this, SLOT (submitCommand ()));
! 	button_vbox->addWidget (submit);
! 	
! 	submit_selected = new QPushButton(i18n ("Run &selection"), layout_widget);
! 	connect (submit_selected, SIGNAL (clicked ()), this, SLOT (submitSelectedCommand ()));
! 	button_vbox->addWidget (submit_selected);
  	
! 	button_vbox->addStretch ();
  	
! 	interrupt_command = new QPushButton (i18n ("Interrupt command"), layout_widget);
  	connect (interrupt_command, SIGNAL (clicked ()), this, SLOT (interruptCommand ()));
  	interrupt_command->setEnabled (false);
! 	button_vbox->addWidget (interrupt_command);
  
  	// construct menu-bar
--- 56,72 ----
  	
  	// add run & reset buttons
! 	QHBoxLayout *button_hbox = new QHBoxLayout (0, 0, 6);
! 	bottom_hbox->addLayout (button_hbox);
  	
  	submit = new QPushButton(i18n ("&Run"), layout_widget);
  	connect (submit, SIGNAL (clicked ()), this, SLOT (submitCommand ()));
! 	button_hbox->addWidget (submit);
  	
! 
  	
! 	interrupt_command = new QPushButton (i18n ("&Interrupt"), layout_widget);
  	connect (interrupt_command, SIGNAL (clicked ()), this, SLOT (interruptCommand ()));
  	interrupt_command->setEnabled (false);
! 	button_hbox->addWidget (interrupt_command);
  
  	// construct menu-bar
***************
*** 204,221 ****
  	RK_TRACE (APP);
  	RKGlobals::editorManager ()->flushAll ();
! 	r_inter->issueCommand (user_command = new RCommand (commands->text (), RCommand::User));
! 	interrupt_command->setEnabled (true);
  	
  	commands->setFocus ();
  }
  
! void RKwatch::submitSelectedCommand () {
! 	RK_TRACE (APP);
! 	RKGlobals::editorManager ()->flushAll ();
! 	r_inter->issueCommand (user_command = new RCommand (commands->getSelection (), RCommand::User));
! 	interrupt_command->setEnabled (true);
! 	
! 	commands->setFocus ();
! }
  
  void RKwatch::configureWatch () {
--- 200,213 ----
  	RK_TRACE (APP);
  	RKGlobals::editorManager ()->flushAll ();
! 	if (! commands->text ().isEmpty()){
! 		r_inter->issueCommand (user_command = new RCommand (commands->text (), RCommand::User));
! 		interrupt_command->setEnabled (true);
! 	}
  	
+ 	commands->setText ("");
  	commands->setFocus ();
  }
  
! 
  
  void RKwatch::configureWatch () {

Index: rkwatch.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rkwatch.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** rkwatch.h	28 Sep 2004 16:53:39 -0000	1.11
--- rkwatch.h	25 Oct 2004 15:43:14 -0000	1.12
***************
*** 48,53 ****
  /** Submits commands in commands-textedit */
  	void submitCommand ();
- /** Submits selection in commands-textedit */
- 	void submitSelectedCommand ();
  /** configures the watch-window */
  	void configureWatch ();
--- 48,51 ----

--- NEW FILE: rkdocmanager.h ---
/***************************************************************************
                          rkward.cpp  -  description
                             -------------------
    begin                : Tue Oct 29 20:06:08 CET 2002
    copyright            : (C) 2002 by Thomas Friedrichsmeier 
    email                : tfry at users.sourceforge.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/


#ifndef RKDOCMANAGER_H
#define RKDOCMANAGER_H

#include <qobject.h>
#include <kate/document.h>
#include <kparts/factory.h>

/**
* This class handles Kate documents.
*
* @author Pierre Ecochard
*/
class RKDocManager : public QObject
{
Q_OBJECT
public:
    RKDocManager(QObject *parent = 0, const char *name = 0);

    ~RKDocManager();
    
    KTextEditor::Document *createDoc ();
    void deleteDoc (Kate::Document *doc);


    KTextEditor::Document *activeDocument ();

    KTextEditor::Document *firstDocument ();
    KTextEditor::Document *nextDocument ();    
    
    int findDocument (Kate::Document *doc);
    uint documents ();    
    
    
private:
    QPtrList<KTextEditor::Document> m_docList;
    KParts::Factory *m_factory;
};

#endif

Index: rkward.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rkward.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** rkward.h	6 Sep 2004 15:27:25 -0000	1.22
--- rkward.h	25 Oct 2004 15:43:14 -0000	1.23
***************
*** 28,32 ****
  // include files for KDE 
  #include <kapp.h>
! #include <kmainwindow.h>
  #include <kaccel.h>
  #include <kaction.h>
--- 28,32 ----
  // include files for KDE 
  #include <kapp.h>
! #include <kmdimainfrm.h>
  #include <kaccel.h>
  #include <kaction.h>
***************
*** 46,49 ****
--- 46,50 ----
  class RKEditorManager;
  class RKMenuList;
+ class RKDocManager;
  
  /**
***************
*** 61,65 ****
    * @version KDevelop version 1.2 code generation
    */
! class RKwardApp : public KMainWindow
  {
    Q_OBJECT
--- 62,68 ----
    * @version KDevelop version 1.2 code generation
    */
!   
!   //KMdiMainFrm( 0, "KMDITest_MainWindow", KMdi::IDEAlMode )
! class RKwardApp : public KMdiMainFrm, virtual public KParts::PartBase
  {
    Q_OBJECT
***************
*** 194,197 ****
--- 197,202 ----
       */
      RKwardDoc *doc;
+     
+     RKDocManager *m_docManager;
  
      // KAction pointers to enable/disable actions

Index: rkward.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rkward.cpp,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -d -r1.48 -r1.49
*** rkward.cpp	15 Sep 2004 15:03:31 -0000	1.48
--- rkward.cpp	25 Oct 2004 15:43:14 -0000	1.49
***************
*** 38,45 ****
--- 38,56 ----
  #include <kstdaction.h>
  #include <kinputdialog.h>
+ #include <kdockwidget.h>
+ 
+ // include files for the kate part. Some may not be useful
+ #include <ktexteditor/configinterface.h>
+ #include <ktexteditor/sessionconfiginterface.h>
+ #include <ktexteditor/viewcursorinterface.h>
+ #include <ktexteditor/printinterface.h>
+ #include <ktexteditor/encodinginterface.h>
+ #include <ktexteditor/editorchooser.h>
+ #include <ktexteditor/popupmenuinterface.h>
  
  // application specific includes
  #include "rkward.h"
  #include "rkeditormanager.h"
+ #include "rkdocmanager.h"
  #include "core/rkmodificationtracker.h"
  #include "dataeditor/rkeditor.h"
***************
*** 69,73 ****
  #define ID_R_STATUS_MSG 2
  
! RKwardApp::RKwardApp (KURL *load_url, QWidget* , const char* name) : KMainWindow (0, name) {
  	RK_TRACE (APP);
  	RKGlobals::app = this;
--- 80,86 ----
  #define ID_R_STATUS_MSG 2
  
! 
! 
! RKwardApp::RKwardApp (KURL *load_url, QWidget* , const char* name) : KMdiMainFrm (0, name, KMdi::IDEAlMode) {
  	RK_TRACE (APP);
  	RKGlobals::app = this;
***************
*** 93,99 ****
    editPaste->setEnabled(false); */
  
!   
! 	RKGlobals::manager = new RKEditorManager (this);
! 	setCentralWidget (RKGlobals::editorManager ());
  	connect (RKGlobals::editorManager (), SIGNAL (editorClosed ()), this, SLOT (slotEditorsChanged ()));
  	connect (RKGlobals::editorManager (), SIGNAL (editorOpened ()), this, SLOT (slotEditorsChanged ()));
--- 106,120 ----
    editPaste->setEnabled(false); */
  
! 
! 	
! 	RKGlobals::manager = new RKEditorManager ();
! 	KMdiChildView * editorManagerView = createWrapper(RKGlobals::editorManager (), i18n( "Object Editor"), i18n( "R Object Editor"));
! 	addWindow( editorManagerView );
! 	
! 	
! 
! 	
! 	
! 	
  	connect (RKGlobals::editorManager (), SIGNAL (editorClosed ()), this, SLOT (slotEditorsChanged ()));
  	connect (RKGlobals::editorManager (), SIGNAL (editorOpened ()), this, SLOT (slotEditorsChanged ()));
***************
*** 124,133 ****
  	
  	output = new RKOutputWindow (0);
! 	output->showMaximized ();
! 	output->hide ();
  
!     QString dummy = "Before you start bashing at it: Please note that this is merely a technology preview release. You might acutally be able to use it for some very simple tasks, but chances are it's of hardly any practical value so far. It does not do much good. It might do some very bad things (don't let it touch valuable data!). It's lacking in many respects. If you would like to help improve it, or simply get in contact, visit:\nhttp://rkward.sourceforge.net\nAll comments welcome.";
  	KMessageBox::information (this, dummy, "Before you complain...", "state_of_rkward");
! 
  	startR ();
  	menu_list = new RKMenuList (menuBar ());
--- 145,154 ----
  	
  	output = new RKOutputWindow (0);
! 	/*output->showMaximized ();
! 	output->hide ();*/
  
!     QString dummy = "Before you start bashing at it: Please note that this is merely a technology preview release. You might acutally be able to use it for some very simple tasks, but chances are it's of hardly any practical value so far. It does not do much good. It might do some very bad things (don't let it touch valuable data!). It's lacking in many respects. If you would like to help improve it, or simply get in contact, visit:\nhttp://rkward.sourceforge.net\nAll comments are welcome.";
  	KMessageBox::information (this, dummy, "Before you complain...", "state_of_rkward");
! 	
  	startR ();
  	menu_list = new RKMenuList (menuBar ());
***************
*** 147,151 ****
  			slotFileOpen ();
  		} else if (result->result == StartupDialog::EmptyTable) {
! 			RObject *object = RKGlobals::rObjectList ()->createNewChild ("my.data", 0, true, true);
  			RKGlobals::editorManager ()->editObject (object, true);
  		}
--- 168,172 ----
  			slotFileOpen ();
  		} else if (result->result == StartupDialog::EmptyTable) {
! 			RObject *object = RKGlobals::rObjectList ()->createNewChild (i18n ("my.data"), 0, true, true);
  			RKGlobals::editorManager ()->editObject (object, true);
  		}
***************
*** 155,159 ****
  	show ();
  	
! 	object_browser->show ();
  	
  	// just to initialize the window-actions according to whether they're shown on startup or not
--- 176,192 ----
  	show ();
  	
! 	//It's necessary to give a different name to all tool windows, or they won't be properly displayed
! 	object_browser->setName("object browser"); 
! 	object_browser->setIcon(SmallIcon("view_tree"));
! 	addToolWindow(object_browser,KDockWidget::DockLeft, getMainDockWidget(), 30 , i18n ("This is a list of the objects present in the R workspace.") , i18n ("Object browser"));
! 	
! 	RKGlobals::rInterface ()->watch->setName("R console");
! 	RKGlobals::rInterface ()->watch->setIcon(SmallIcon("konsole"));
! 	addToolWindow(RKGlobals::rInterface ()->watch,KDockWidget::DockBottom, getMainDockWidget(), 10);
! 	
! 	output->setIcon(SmallIcon("text_block"));
! 	output->setName("output"); 
! 	addToolWindow(output,KDockWidget::DockBottom, getMainDockWidget(), 10);
! 	
  	
  	// just to initialize the window-actions according to whether they're shown on startup or not
***************
*** 308,315 ****
    
    // use the absolute path to your rkwardui.rc file for testing purpose in createGUI();
!   createGUI("rkwardui.rc");
  
  // is there a better way to change the name of the "File" menu?
! 	menuBar ()->changeItem (menuBar ()->idAt (0), i18n ("Workspace"));
  }
  
--- 341,349 ----
    
    // use the absolute path to your rkwardui.rc file for testing purpose in createGUI();
!   setXMLFile( "rkwardui.rc" );
!   createShellGUI ( true );
  
  // is there a better way to change the name of the "File" menu?
! 	menuBar ()->changeItem (menuBar ()->idAt (0), i18n ("&Workspace"));
  }
  

--- NEW FILE: rkdocmanager.cpp ---
/***************************************************************************
                          rkward.cpp  -  description
                             -------------------
    begin                : Tue Oct 29 20:06:08 CET 2002
    copyright            : (C) 2002 by Thomas Friedrichsmeier 
    email                : tfry at users.sourceforge.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
 
#include "rkdocmanager.h"

#include <kate/document.h>
#include <kate/view.h>

#include <ktexteditor/configinterface.h>
#include <ktexteditor/sessionconfiginterface.h>
#include <ktexteditor/viewcursorinterface.h>
#include <ktexteditor/printinterface.h>
#include <ktexteditor/encodinginterface.h>
#include <ktexteditor/editorchooser.h>
#include <ktexteditor/popupmenuinterface.h>

#include "debug.h"

RKDocManager::RKDocManager(QObject *parent, const char *name)
 : QObject(parent, name)
{
  m_factory = (KParts::Factory *) KLibLoader::self()->factory ("libkatepart");


  
  createDoc();
}


RKDocManager::~RKDocManager()
{
	KTextEditor::Document *doc;
	for ( doc = m_docList.first(); doc; doc = m_docList.next() ) {
		m_docList.remove (doc);
		delete doc;
	}
}



KTextEditor::Document *RKDocManager::createDoc ()
{
  KTextEditor::Document *doc; /*= (KTextEditor::Document *) m_factory->createPart (0, "", this, "", "KTextEditor::Document");*/
  m_docList.append(doc);

  return doc;
}

void RKDocManager::deleteDoc (Kate::Document *doc)
{
  m_docList.remove (doc);
  delete doc;
}


KTextEditor::Document *RKDocManager::activeDocument ()
{
  return m_docList.current();
}


KTextEditor::Document *RKDocManager::firstDocument ()
{
  return m_docList.first();
}

KTextEditor::Document *RKDocManager::nextDocument ()
{
  return m_docList.next();
}


int RKDocManager::findDocument (Kate::Document *doc)
{
  return m_docList.find (doc);
}

uint RKDocManager::documents ()
{
  return m_docList.count ();
}



#include "rkdocmanager.moc"





More information about the rkward-tracker mailing list