[rkward-cvs] rkward/rkward/windows rkcommandeditorwindow.cpp,1.23,1.24 rkcommandeditorwindow.h,1.16,1.17 rkcommandeditorwindowpart.rc,1.2,1.3

Thomas Friedrichsmeier tfry at users.sourceforge.net
Sat Sep 17 19:23:54 UTC 2005


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

Modified Files:
	rkcommandeditorwindow.cpp rkcommandeditorwindow.h 
	rkcommandeditorwindowpart.rc 
Log Message:
added part for RKConsole. Provide context help for console, too.

Index: rkcommandeditorwindow.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/rkcommandeditorwindow.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** rkcommandeditorwindow.cpp	17 Sep 2005 18:25:51 -0000	1.23
--- rkcommandeditorwindow.cpp	17 Sep 2005 19:23:52 -0000	1.24
***************
*** 35,40 ****
  #include <qtabwidget.h>
  #include <qfile.h>
- #include <qstringlist.h>
- #include <qregexp.h>
  
  #include <klocale.h>
--- 35,38 ----
***************
*** 47,54 ****
  #include <klibloader.h>
  
- #include "../rbackend/rinterface.h"
  #include "../rkeditormanager.h"
  #include "../rkglobals.h"
  #include "../rkward.h"
  #include "rkcommandeditorwindowpart.h"
  
--- 45,52 ----
  #include <klibloader.h>
  
  #include "../rkeditormanager.h"
  #include "../rkglobals.h"
  #include "../rkward.h"
+ #include "../khelpdlg.h"
  #include "rkcommandeditorwindowpart.h"
  
***************
*** 152,192 ****
  }
  
- 
  void RKCommandEditorWindow::showHelp () {
- 	// step 1: find out word under cursor
  	uint para=0; uint p=0;
  	m_view->cursorPosition (&para, &p);
  
! 	QString line=m_view->currentTextLine() + " ";
! 	if (line.isEmpty () || line.isNull ()) return;
! 	
! 	// We want to match any valid R name, that is, everything composed of letters, 0-9, '.'s and '_'s..
! 	QRegExp rx_no_word ("[^A-Za-z0-9\\._]");
! 
! 	// find out the next non-word stuff left and right of the current cursor position
! 	int current_word_start = line.findRev (rx_no_word, p-1) + 1;
! 	int current_word_end = line.find (rx_no_word, p);
! 
! 	// if both return the same position, we're on a non-word.
! 	if (current_word_start == current_word_end) return;
! 
! 	QString result = line.mid (current_word_start, current_word_end - current_word_start);
! 
! 	// step 2: retrieve help
! 	RKGlobals::rInterface ()->issueCommand ("help(\"" + result + "\", htmlhelp=TRUE)[1]", RCommand::App | RCommand::Sync | RCommand::GetStringVector, "", this, GET_HELP_URL, 0);
! }
  
! void RKCommandEditorWindow::rCommandDone (RCommand *command) {
! 	KURL url;
! 	
! 	if (command->getFlags () == GET_HELP_URL) {
! 		url.setPath(command->getStringVector ()[0]);
! 		if (QFile::exists( url.path() )) {
! 			RKGlobals::rkApp ()->openHTML (url);
! 			return;
! 		}
! 	} else {
! 		RK_ASSERT (false);
! 	}
  }
  
--- 150,160 ----
  }
  
  void RKCommandEditorWindow::showHelp () {
  	uint para=0; uint p=0;
  	m_view->cursorPosition (&para, &p);
  
! 	QString line = m_view->currentTextLine() + " ";
  
! 	RKGlobals::helpDialog ()->getContextHelp (line, p);
  }
  

Index: rkcommandeditorwindowpart.rc
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/rkcommandeditorwindowpart.rc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** rkcommandeditorwindowpart.rc	15 Sep 2005 21:03:27 -0000	1.2
--- rkcommandeditorwindowpart.rc	17 Sep 2005 19:23:52 -0000	1.3
***************
*** 8,15 ****
  			<Separator/>
  		</Menu>
  	</MenuBar>
- 	<Menu name="help"><text>&Help</text>
- 		<Action name="function_reference"></Action>
- 	</Menu>
  	<ToolBar fullWidth="true" name="runToolBar">
  		<Action name="run_line"/>
--- 8,15 ----
  			<Separator/>
  		</Menu>
+ 		<Menu name="help"><text>&Help</text>
+ 			<Action name="function_reference"></Action>
+ 		</Menu>
  	</MenuBar>
  	<ToolBar fullWidth="true" name="runToolBar">
  		<Action name="run_line"/>

Index: rkcommandeditorwindow.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/rkcommandeditorwindow.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** rkcommandeditorwindow.h	17 Sep 2005 18:04:00 -0000	1.16
--- rkcommandeditorwindow.h	17 Sep 2005 19:23:52 -0000	1.17
***************
*** 26,32 ****
  #include <kmdichildview.h>
  
- #include "../rbackend/rcommandreceiver.h"
- 
- 
  class RKCommandEditor;
  class KAction;
--- 26,29 ----
***************
*** 42,46 ****
  @author Pierre Ecochard
  */
! class RKCommandEditorWindow : public KMdiChildView, public RCommandReceiver {
  // we need the Q_OBJECT thing for some inherits ("RKCommandEditorWindow")-calls in rkward.cpp.
  	Q_OBJECT
--- 39,43 ----
  @author Pierre Ecochard
  */
! class RKCommandEditorWindow : public KMdiChildView {
  // we need the Q_OBJECT thing for some inherits ("RKCommandEditorWindow")-calls in rkward.cpp.
  	Q_OBJECT
***************
*** 67,72 ****
  /** Show help about the current word. */
  	void showHelp();
- /** re-implemented from \ref RCommandReceiver. */
- 	void rCommandDone (RCommand *command);
  private:
  	Kate::Document *m_doc;
--- 64,67 ----
***************
*** 78,82 ****
  /** update Tab caption according to the given url. Display the filename-component of the URL, or - if not available - a more elaborate description of the url */
  	void updateTabCaption(const KURL &url);
- 	RCommandChain *chain;
  };
  
--- 73,76 ----





More information about the rkward-tracker mailing list