[rkward-cvs] SF.net SVN: rkward: [933] trunk/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Fri Nov 24 15:00:59 UTC 2006


Revision: 933
          http://svn.sourceforge.net/rkward/?rev=933&view=rev
Author:   tfry
Date:     2006-11-24 07:00:59 -0800 (Fri, 24 Nov 2006)

Log Message:
-----------
Cleanups for window activation
Give detached windows a reasonable size to start with

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/windows/detachedwindowcontainer.cpp
    trunk/rkward/rkward/windows/rkhtmlwindow.cpp
    trunk/rkward/rkward/windows/rkmdiwindow.cpp
    trunk/rkward/rkward/windows/rkmdiwindow.h
    trunk/rkward/rkward/windows/rkworkplace.cpp
    trunk/rkward/rkward/windows/rkworkplace.h

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2006-11-24 14:38:24 UTC (rev 932)
+++ trunk/rkward/ChangeLog	2006-11-24 15:00:59 UTC (rev 933)
@@ -1,3 +1,4 @@
+- when detaching a window, give it a more reasonable size
 - do not open the same script url twice (instead the corresponding window is raised on the second attempt)
 - fixed: when closing a detached script editor window, you would not be asked to save changes (if any)
 - fixed: occasional crash when re-attaching a script editor window

Modified: trunk/rkward/rkward/windows/detachedwindowcontainer.cpp
===================================================================
--- trunk/rkward/rkward/windows/detachedwindowcontainer.cpp	2006-11-24 14:38:24 UTC (rev 932)
+++ trunk/rkward/rkward/windows/detachedwindowcontainer.cpp	2006-11-24 15:00:59 UTC (rev 933)
@@ -38,6 +38,7 @@
 	createShellGUI ();
 
 // capture widget
+	resize (widget_to_capture->size ());
 	widget_to_capture->reparent (this, QPoint (0, 0));
 	setCentralWidget (widget_to_capture);
 	createGUI (widget_to_capture->getPart ());

Modified: trunk/rkward/rkward/windows/rkhtmlwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkhtmlwindow.cpp	2006-11-24 14:38:24 UTC (rev 932)
+++ trunk/rkward/rkward/windows/rkhtmlwindow.cpp	2006-11-24 15:00:59 UTC (rev 933)
@@ -245,7 +245,7 @@
 
 	if (current_output) {
 		if (raise) {
-			RKWorkplace::mainWorkplace ()->activateWindow (current_output);
+			current_output->activate ();
 		}
 		current_output->refresh ();
 	} else {

Modified: trunk/rkward/rkward/windows/rkmdiwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkmdiwindow.cpp	2006-11-24 14:38:24 UTC (rev 932)
+++ trunk/rkward/rkward/windows/rkmdiwindow.cpp	2006-11-24 15:00:59 UTC (rev 933)
@@ -18,6 +18,7 @@
 #include "rkmdiwindow.h"
 
 #include "rkworkplace.h"
+#include "rkworkplaceview.h"
 
 #include "../debug.h"
 
@@ -51,4 +52,15 @@
 	emit (captionChanged (this));
 }
 
+void RKMDIWindow::activate () {
+	RK_TRACE (APP);
+
+	if (isAttached ()) {
+		RKWorkplace::mainWorkplace ()->view ()->setActivePage (this);
+	} else {
+		topLevelWidget ()->show ();
+		topLevelWidget ()->raise ();
+	}
+}
+
 #include "rkmdiwindow.moc"

Modified: trunk/rkward/rkward/windows/rkmdiwindow.h
===================================================================
--- trunk/rkward/rkward/windows/rkmdiwindow.h	2006-11-24 14:38:24 UTC (rev 932)
+++ trunk/rkward/rkward/windows/rkmdiwindow.h	2006-11-24 15:00:59 UTC (rev 933)
@@ -64,6 +64,8 @@
 /** Is this window attached (or detached)?
 @returns true if attached, false if detached */
 	bool isAttached () { return (state == Attached); };
+/** Activate (raise) this window, regardless of whether it is attached or detached */
+	void activate ();
 signals:
 /** This signal is emitted, whenever the window caption was changed.
 @param RKMDIWindow* a pointer to this window */

Modified: trunk/rkward/rkward/windows/rkworkplace.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkworkplace.cpp	2006-11-24 14:38:24 UTC (rev 932)
+++ trunk/rkward/rkward/windows/rkworkplace.cpp	2006-11-24 15:00:59 UTC (rev 933)
@@ -101,8 +101,7 @@
 			if ((*it)->type == RKMDIWindow::CommandEditorWindow) {
 				KURL ourl = static_cast<RKCommandEditorWindow *> (*it)->url ();
 				if (url.equals (ourl, true)) {
-					(*it)->topLevelWidget ()->raise ();
-					if ((*it)->isAttached ()) view ()->setActivePage (*it);
+					(*it)->activate ();
 					return true;
 				}
 			}
@@ -199,12 +198,8 @@
 	}
 
 	if (existing_editor) {		// not strictly an else. existing_editor may be reset inside the above if
-		if (existing_editor->isAttached ()) {
-			view ()->setActivePage (existing_editor);
-		} else {
-			existing_editor->topLevelWidget ()->show ();
-			existing_editor->topLevelWidget ()->raise ();
-		}
+		existing_editor->activate ();
+		ed = existing_editor;
 	}
 	
 	return ed;
@@ -271,12 +266,6 @@
 	return (static_cast<RKMDIWindow *> (view ()->activePage ()));
 }
 
-void RKWorkplace::activateWindow (RKMDIWindow *window) {
-	RK_TRACE (APP);
-
-	window->raise ();		// Does this do the trick?
-}
-
 void RKWorkplace::saveWorkplace (RCommandChain *chain) {
 	RK_TRACE (APP);
 

Modified: trunk/rkward/rkward/windows/rkworkplace.h
===================================================================
--- trunk/rkward/rkward/windows/rkworkplace.h	2006-11-24 14:38:24 UTC (rev 932)
+++ trunk/rkward/rkward/windows/rkworkplace.h	2006-11-24 15:00:59 UTC (rev 933)
@@ -58,9 +58,6 @@
 	void detachWindow (RKMDIWindow *window);
 /** @returns a pointer to the current window. Detached windows are not considered, only those attached to the workplace(view) */
 	RKMDIWindow *activeAttachedWindow ();
-/** Activate the given window. TODO: is this needed? Does it work? 
- at param window the window to activate */
-	void activateWindow (RKMDIWindow *window);
 
 /** Opens a new script editor
 @param url URL to load. Default option is to open an empty document


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