[rkward-cvs] rkward/rkward/windows rkcommandeditorwindow.cpp,1.17,1.18 rkcommandeditorwindow.h,1.12,1.13 rkhelpwindow.cpp,1.10,1.11 rkhelpwindow.h,1.8,1.9

Thomas Friedrichsmeier tfry at users.sourceforge.net
Wed Sep 14 12:06:04 UTC 2005


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

Modified Files:
	rkcommandeditorwindow.cpp rkcommandeditorwindow.h 
	rkhelpwindow.cpp rkhelpwindow.h 
Log Message:
Implemented R_EditFile and R_ShowFile. Not pretty yet, but working. Some more code cleanups

Index: rkhelpwindow.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/rkhelpwindow.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** rkhelpwindow.cpp	29 Apr 2005 16:47:29 -0000	1.10
--- rkhelpwindow.cpp	14 Sep 2005 12:06:02 -0000	1.11
***************
*** 37,50 ****
   : KMdiChildView(parent, name)
  {
! 	scrollPosition=0;
  	
  	khtmlpart = new KHTMLPart(this,0,0,0,KHTMLPart::BrowserViewGUI);
  	khtmlpart->setSelectable(true);
  	
! 	iShowOutput=output;
  
  	(RKGlobals::rkApp()->m_manager)->addPart(khtmlpart,false);
  	khtmlpart->widget()->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
! 	pLayout = new QHBoxLayout( this, 0, -1, "layout");
  	pLayout->addWidget(khtmlpart->widget());
  
--- 37,50 ----
   : KMdiChildView(parent, name)
  {
! 	scroll_position=0;
  	
  	khtmlpart = new KHTMLPart(this,0,0,0,KHTMLPart::BrowserViewGUI);
  	khtmlpart->setSelectable(true);
  	
! 	window_is_output=output;
  
  	(RKGlobals::rkApp()->m_manager)->addPart(khtmlpart,false);
  	khtmlpart->widget()->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
! 	QHBoxLayout *pLayout = new QHBoxLayout( this, 0, -1, "layout");
  	pLayout->addWidget(khtmlpart->widget());
  
***************
*** 61,74 ****
  }
  
! 
! #include "rkhelpwindow.moc"
! 
! 
! 
! bool RKHelpWindow::openURL(KURL url)
  {
  	if (QFile::exists( url.path() )) {
  		khtmlpart->openURL(url);
! 		if (iShowOutput) {
  			setTabCaption(i18n("Output"));
  			setCaption(i18n("Output"));
--- 61,69 ----
  }
  
! bool RKHelpWindow::openURL(const KURL &url)
  {
  	if (QFile::exists( url.path() )) {
  		khtmlpart->openURL(url);
! 		if (window_is_output) {
  			setTabCaption(i18n("Output"));
  			setCaption(i18n("Output"));
***************
*** 80,84 ****
  		}
  		currentURL=url;
! 		scrollPosition=0;
  		return(true);
  	}
--- 75,79 ----
  		}
  		currentURL=url;
! 		scroll_position=0;
  		return(true);
  	}
***************
*** 114,118 ****
  	int pos = khtmlpart->view()->contentsY();
  	openURL (currentURL);
! 	scrollPosition=pos;
  }
  
--- 109,113 ----
  	int pos = khtmlpart->view()->contentsY();
  	openURL (currentURL);
! 	scroll_position=pos;
  }
  
***************
*** 124,128 ****
  void RKHelpWindow::loadDone()
  {
! 	khtmlpart->view()->setContentsPos ( 0, scrollPosition );
  }
  
--- 119,123 ----
  void RKHelpWindow::loadDone()
  {
! 	khtmlpart->view()->setContentsPos ( 0, scroll_position );
  }
  
***************
*** 136,137 ****
--- 131,134 ----
  	khtmlpart->view()->setContentsPos ( 0, khtmlpart->view()->contentsHeight() );
  }
+ 
+ #include "rkhelpwindow.moc"

Index: rkcommandeditorwindow.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/rkcommandeditorwindow.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** rkcommandeditorwindow.cpp	12 Sep 2005 20:39:46 -0000	1.17
--- rkcommandeditorwindow.cpp	14 Sep 2005 12:06:02 -0000	1.18
***************
*** 56,67 ****
  #define GET_HELP_URL 1
  
! 
! RKCommandEditorWindow::RKCommandEditorWindow (QWidget *parent) : KMdiChildView (parent) {
  	RK_TRACE (COMMANDEDITOR);
      KParts::ReadWritePart *m_katepart;
  
  	KLibFactory *factory = KLibLoader::self()->factory( "libkatepart" );
! 	if (factory)
! 	{
  		// Create the part
  		m_katepart = (KParts::ReadWritePart *)factory->create( this,
--- 56,65 ----
  #define GET_HELP_URL 1
  
! RKCommandEditorWindow::RKCommandEditorWindow (QWidget *parent, bool use_r_highlighting) : KMdiChildView (parent) {
  	RK_TRACE (COMMANDEDITOR);
      KParts::ReadWritePart *m_katepart;
  
  	KLibFactory *factory = KLibLoader::self()->factory( "libkatepart" );
! 	if (factory) {
  		// Create the part
  		m_katepart = (KParts::ReadWritePart *)factory->create( this,
***************
*** 69,73 ****
  	}
  	(RKGlobals::rkApp()->m_manager)->addPart((KParts::Part*)m_katepart,false);
- 	//m_katepart->widget()->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
  
  	m_doc = (Kate::Document *) m_katepart;
--- 67,70 ----
***************
*** 78,82 ****
  
  	m_view->setName("Kate Part View");
! 	setRHighlighting(m_doc);
  }
  
--- 75,79 ----
  
  	m_view->setName("Kate Part View");
! 	if (use_r_highlighting) setRHighlighting(m_doc);
  }
  
***************
*** 89,99 ****
  void RKCommandEditorWindow::setRHighlighting (Kate::Document *doc) {
  	// set syntax-highlighting for R
! 	int modes_count = highlightingInterface(doc)->hlModeCount ();
  	bool found_mode = false;
  	int i;
- 	//RK_DO (qDebug ("%s", "Looking for syntax highlighting definition"), COMMANDEDITOR, DL_INFO);
  	for (i = 0; i < modes_count; ++i) {
! 		//RK_DO (qDebug ("%s", highlightingInterface(doc)->hlModeName(i).lower().latin1 ()), COMMANDEDITOR, DL_DEBUG);
! 		if (highlightingInterface(doc)->hlModeName(i).lower() == "r script") {
  			found_mode = true;
  			break;
--- 86,94 ----
  void RKCommandEditorWindow::setRHighlighting (Kate::Document *doc) {
  	// set syntax-highlighting for R
! 	int modes_count = highlightingInterface (doc)->hlModeCount ();
  	bool found_mode = false;
  	int i;
  	for (i = 0; i < modes_count; ++i) {
! 		if (highlightingInterface (doc)->hlModeName (i).lower() == "r script") {
  			found_mode = true;
  			break;
***************
*** 101,107 ****
  	}
  	if (found_mode) {
! 		highlightingInterface(doc)->setHlMode(i);
  	} else {
! 		//RK_DO (qDebug ("%s", highlightingInterface(doc)->hlModeName(i).lower().latin1 ()), COMMANDEDITOR, DL_WARNING);
  	}
  }
--- 96,102 ----
  	}
  	if (found_mode) {
! 		highlightingInterface (doc)->setHlMode (i);
  	} else {
! 		RK_DO (qDebug ("No syntax highlighting definition found for r script."), COMMANDEDITOR, DL_WARNING);
  	}
  }
***************
*** 130,144 ****
  
  
! bool RKCommandEditorWindow::openURL(const KURL &url){
! 	if (m_doc->openURL(url)){
! 		setRHighlighting(m_doc);
! 		
! 		updateTabCaption(url);
! 		
  		return true;
  	}
  	return false;
- 	
- 
  }
  
--- 125,138 ----
  
  
! bool RKCommandEditorWindow::openURL (const KURL &url, bool use_r_highlighting, bool read_only){
! 	if (m_doc->openURL (url)){
! 		if (use_r_highlighting) setRHighlighting (m_doc);
! 		m_doc->setReadWrite (!read_only);
! 
! 		updateTabCaption (url);
! 
  		return true;
  	}
  	return false;
  }
  
***************
*** 198,228 ****
  
  
- void RKCommandEditorWindow::cut(){
- 	m_view->cut();
- }
- 
- 
- void RKCommandEditorWindow::copy(){
- 	 m_view->copy();
- }
- 
- 
- 
- void RKCommandEditorWindow::paste(){
- 	 m_view->paste();
- }
- 
- 
- void RKCommandEditorWindow::undo(){
- 	 m_doc->undo();
- }
- 
- 
- void RKCommandEditorWindow::redo(){
- 	 m_doc->redo();
- }
- 
- 
- 
  void RKCommandEditorWindow::insertText(QString text)
  {
--- 192,195 ----
***************
*** 293,298 ****
  	
  	RKGlobals::rInterface ()->issueCommand (s, RCommand::App | RCommand::Sync | RCommand::GetStringVector, "", this, GET_HELP_URL, chain);
- 
- 		
  }
  
--- 260,263 ----

Index: rkhelpwindow.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/rkhelpwindow.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** rkhelpwindow.h	19 Apr 2005 06:48:06 -0000	1.8
--- rkhelpwindow.h	14 Sep 2005 12:06:02 -0000	1.9
***************
*** 36,43 ****
  Q_OBJECT
  public:
!     RKHelpWindow(QWidget *parent = 0, const char *name = 0, bool output=false);
  
      ~RKHelpWindow();
!     bool openURL(KURL url);
      void refresh();
      void scrollToBottom();
--- 36,43 ----
  Q_OBJECT
  public:
!     RKHelpWindow (QWidget *parent = 0, const char *name = 0, bool output=false);
  
      ~RKHelpWindow();
!     bool openURL(const KURL &url);
      void refresh();
      void scrollToBottom();
***************
*** 46,60 ****
  private:
      KHTMLPart * khtmlpart;
-     QBoxLayout* pLayout;
-     KParts::ReadOnlyPart *m_khtmlpart;
  
!     /** Are we showing the output? */
!     bool iShowOutput;
      KURL currentURL;
  private slots:
      void loadDone();
  protected:
! 	/** Here we store the position of the scroll bar before refresh */
!     int scrollPosition;
  };
  
--- 46,58 ----
  private:
      KHTMLPart * khtmlpart;
  
! /** Are we showing the output? (Rather than some other, non-special HTML-file */
!     bool window_is_output;
      KURL currentURL;
  private slots:
      void loadDone();
  protected:
! /** Here we store the position of the scroll bar before refresh */
!     int scroll_position;
  };
  

Index: rkcommandeditorwindow.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/rkcommandeditorwindow.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** rkcommandeditorwindow.h	12 Sep 2005 20:39:46 -0000	1.12
--- rkcommandeditorwindow.h	14 Sep 2005 12:06:02 -0000	1.13
***************
*** 38,44 ****
  
  /**
! 	\brief Provides an editor window for R-commands.
  
! This is an MDI child that is added to the main window.
  
  @author Pierre Ecochard
--- 38,47 ----
  
  /**
! 	\brief Provides an editor window for R-commands, as well as a text-editor window in general.
  
! While being called RKCommandEditorWindow, this class handles all sort of text-files, both read/write and read-only. It is an MDI child that is added to the main window, based on KatePart.
! 
! TODO: find out, whether save (), saveAs (), and some others are still needed. Clean up includes after that.
! TODO: once ShowEditTextFileWindow is done, derive this class from that.
  
  @author Pierre Ecochard
***************
*** 46,50 ****
  class RKCommandEditorWindow : public KMdiChildView, public RCommandReceiver {
  public:
!     RKCommandEditorWindow (QWidget *parent = 0);
  
      ~RKCommandEditorWindow();
--- 49,53 ----
  class RKCommandEditorWindow : public KMdiChildView, public RCommandReceiver {
  public:
!     RKCommandEditorWindow (QWidget *parent = 0, bool use_r_highlighting=true);
  
      ~RKCommandEditorWindow();
***************
*** 52,66 ****
      QString getLine();
      QString getText();
!     bool openURL(const KURL &url);
      KURL url();
      bool save();
-     Kate::View *m_view;
      bool saveAs(const KURL &url);
      bool isModified();
-     void cut();
-     void copy();
-     void paste();
-     void undo();
-     void redo();
      void insertText(QString text);
      /** Show help about the current word. */
--- 55,63 ----
      QString getLine();
      QString getText();
!     bool openURL(const KURL &url, bool use_r_highlighting=true, bool read_only=false);
      KURL url();
      bool save();
      bool saveAs(const KURL &url);
      bool isModified();
      void insertText(QString text);
      /** Show help about the current word. */
***************
*** 69,72 ****
--- 66,70 ----
  private:
  	Kate::Document *m_doc;
+ 	Kate::View *m_view;
  	
  	void setRHighlighting (Kate::Document *doc);





More information about the rkward-tracker mailing list