[rkward-cvs] SF.net SVN: rkward: [2080] branches/KDE4_port/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue Oct 16 11:13:07 UTC 2007


Revision: 2080
          http://rkward.svn.sourceforge.net/rkward/?rev=2080&view=rev
Author:   tfry
Date:     2007-10-16 04:13:06 -0700 (Tue, 16 Oct 2007)

Log Message:
-----------
R console can be used with care

Modified Paths:
--------------
    branches/KDE4_port/rkward/rkconsole.cpp
    branches/KDE4_port/rkward/windows/rkcommandeditorwindow.cpp
    branches/KDE4_port/rkward/windows/rkcommandeditorwindow.h

Modified: branches/KDE4_port/rkward/rkconsole.cpp
===================================================================
--- branches/KDE4_port/rkward/rkconsole.cpp	2007-10-16 10:12:52 UTC (rev 2079)
+++ branches/KDE4_port/rkward/rkconsole.cpp	2007-10-16 11:13:06 UTC (rev 2080)
@@ -637,9 +637,8 @@
 	doc->clear ();
 	tryNextInBatch ();
 // KDE 4: still needed?
-/*	// need this HACK to remove empty line at start
-	selectionInterface (doc)->setSelection (0, 0, 1, 0);
-	selectionInterface (doc)->removeSelectedText (); */
+	// need this HACK to remove empty line at start
+	doc->removeText (KTextEditor::Range (0, 0, 1, 0));
 }
 
 void RKConsole::addCommandToHistory (const QString &command) {

Modified: branches/KDE4_port/rkward/windows/rkcommandeditorwindow.cpp
===================================================================
--- branches/KDE4_port/rkward/windows/rkcommandeditorwindow.cpp	2007-10-16 10:12:52 UTC (rev 2079)
+++ branches/KDE4_port/rkward/windows/rkcommandeditorwindow.cpp	2007-10-16 11:13:06 UTC (rev 2080)
@@ -35,7 +35,7 @@
 //Added by qt3to4:
 #include <Q3HBoxLayout>
 #include <QCloseEvent>
-#include <Q3Frame>
+#include <QFrame>
 #include <Q3ValueList>
 #include <QLabel>
 #include <QKeyEvent>
@@ -353,13 +353,17 @@
 		obj->installEventFilter (this);
 	}
 
-//KDE4: we could/should use KTextEditor::TextHintInterface
-	arghints_popup = new Q3VBox (0, 0, Qt::Popup);
-	arghints_popup->setFrameStyle (Q3Frame::Box | Q3Frame::Plain);
+	arghints_popup = new QFrame (0, Qt::ToolTip);
+	QVBoxLayout *layout = new QVBoxLayout (arghints_popup);
+	layout->setContentsMargins (2, 2, 2, 2);
+	arghints_popup->setFrameStyle (QFrame::Plain);
+	arghints_popup->setFrameShape (QFrame::Box);
 	arghints_popup->setLineWidth (1);
 	arghints_popup_text = new QLabel (arghints_popup);
+	layout->addWidget (arghints_popup_text);
 	arghints_popup->hide ();
 	arghints_popup->setFocusProxy (view);
+	//arghints_popup->setFocusPolicy (Qt::NoFocus);
 }
 
 RKFunctionArgHinter::~RKFunctionArgHinter () {
@@ -392,6 +396,14 @@
 	int brace_level = 1;
 	int i = cursor_pos;
 
+	// fix up seems to be needed
+	if (current_context.isEmpty ()) {
+		hideArgHint ();
+		return;
+	}
+	if (i >= current_context.size ()) i = current_context.size () -1;
+	if (i < 0) i = 0;
+
 	while (true) {
 		if (current_context.at (i) == QChar (')')) {
 			brace_level++;
@@ -403,9 +415,9 @@
 		--i;
 		if (i < 0) {
 			bool have_context = provider->provideContext (++line_rev, &current_line, &cursor_pos);
-			if (!have_context) break;
+			if ((!have_context) || (current_line.isEmpty ())) break;
 
-			RK_ASSERT (cursor_pos < 0);
+			RK_ASSERT (cursor_pos > 0);
 			current_context.prepend (current_line);
 			i = current_line.length () - 1;
 		}

Modified: branches/KDE4_port/rkward/windows/rkcommandeditorwindow.h
===================================================================
--- branches/KDE4_port/rkward/windows/rkcommandeditorwindow.h	2007-10-16 10:12:52 UTC (rev 2079)
+++ branches/KDE4_port/rkward/windows/rkcommandeditorwindow.h	2007-10-16 11:13:06 UTC (rev 2080)
@@ -30,7 +30,7 @@
 
 #include "../windows/rkmdiwindow.h"
 
-class Q3VBox;
+class QFrame;
 class QLabel;
 
 /** classes wishing to use RKFunctionArgHinter should derive from this, and implement provideContext () */
@@ -67,7 +67,7 @@
 	RKScriptContextProvider *provider;
 	KTextEditor::View *view;
 
-	Q3VBox *arghints_popup;
+	QFrame *arghints_popup;
 	QLabel *arghints_popup_text;
 };
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list