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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Fri Feb 16 00:16:07 UTC 2007


Revision: 1399
          http://svn.sourceforge.net/rkward/?rev=1399&view=rev
Author:   tfry
Date:     2007-02-15 16:16:06 -0800 (Thu, 15 Feb 2007)

Log Message:
-----------
Options controlling display of code window in plugin dialogs.

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/plugin/rkstandardcomponentgui.cpp
    trunk/rkward/rkward/settings/rksettingsmoduleplugins.cpp
    trunk/rkward/rkward/settings/rksettingsmoduleplugins.h

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2007-02-15 21:43:15 UTC (rev 1398)
+++ trunk/rkward/ChangeLog	2007-02-16 00:16:06 UTC (rev 1399)
@@ -1,3 +1,5 @@
+- new options for plugin dialogs: Configure whether code display is by default, and at what size
+
 --- Version 0.4.6 - Feb-15-2007
 - make sure any LC_ALL environment setting will not be applied by SCIM plugin (if installed on the system)
 - fix crash after changing storage type of an object in the data editor

Modified: trunk/rkward/rkward/plugin/rkstandardcomponentgui.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkstandardcomponentgui.cpp	2007-02-15 21:43:15 UTC (rev 1398)
+++ trunk/rkward/rkward/plugin/rkstandardcomponentgui.cpp	2007-02-16 00:16:06 UTC (rev 1399)
@@ -34,15 +34,17 @@
 #include "../windows/rkcommandeditorwindow.h"
 #include "../rbackend/rinterface.h"
 #include "../misc/rkerrordialog.h"
+#include "../settings/rksettingsmoduleplugins.h"
 #include "../rkglobals.h"
 #include "../debug.h"
 
-
 /////////////////////////////////////// RKStandardComponentGUI ////////////////////////////////////////////////
 
 RKStandardComponentGUI::RKStandardComponentGUI (RKStandardComponent *component, RKComponentPropertyCode *code_property, bool enslaved) {
 	RK_TRACE (PLUGIN);
 
+	splitter = 0;
+
 	// create an error-dialog
 	error_dialog = new RKRErrorDialog (i18n ("The R-backend has reported one or more error(s) while processing the plugin '%1'.\nThis may lead to an incorrect output and is likely due to a bug in the plugin.\nA transcript of the error message(s) is shown below.").arg (component->getFilename ()), i18n ("R-Error"), false);
 
@@ -116,15 +118,19 @@
 	
 	toggle_code_button = new QPushButton (i18n ("Code"), upper_widget);
 	toggle_code_button->setToggleButton (true);
-	toggle_code_button->setOn (true);
+	toggle_code_button->setOn (RKSettingsModulePlugins::showCodeByDefault ());
 	connect (toggle_code_button, SIGNAL (clicked ()), this, SLOT (toggleCode ()));
 	vbox->addWidget (toggle_code_button);
 	if (enslaved) toggle_code_button->hide ();
 	
 	// code display
 	code_display = new RKCommandEditorWindow (splitter, true);
+	code_display->setMinimumHeight (RKSettingsModulePlugins::defaultCodeHeight ());
 	splitter->setResizeMode (code_display, QSplitter::Stretch);
-	if (enslaved) code_display->hide ();
+	code_display->hide ();
+	if (!enslaved) {
+		QTimer::singleShot (0, this, SLOT (toggleCode ()));
+	}
 }
 
 void RKStandardComponentGUI::ok () {
@@ -151,8 +157,20 @@
 
 void RKStandardComponentGUI::toggleCode () {
 	RK_TRACE (PLUGIN);
+	RK_ASSERT (splitter);
 
-	code_display->setShown (toggle_code_button->isOn ());
+	QValueList<int> splitter_sizes = splitter->sizes ();
+	splitter_sizes.pop_back ();
+
+	if (toggle_code_button->isOn ()) {
+		splitter_sizes.append (RKSettingsModulePlugins::defaultCodeHeight ());
+		code_display->show ();
+	} else {
+		splitter_sizes.append (0);
+		code_display->hide ();
+	}
+	splitter->setSizes (splitter_sizes);
+
 	updateCode ();
 }
 

Modified: trunk/rkward/rkward/settings/rksettingsmoduleplugins.cpp
===================================================================
--- trunk/rkward/rkward/settings/rksettingsmoduleplugins.cpp	2007-02-15 21:43:15 UTC (rev 1398)
+++ trunk/rkward/rkward/settings/rksettingsmoduleplugins.cpp	2007-02-16 00:16:06 UTC (rev 1399)
@@ -2,7 +2,7 @@
                           rksettingsmoduleplugins  -  description
                              -------------------
     begin                : Wed Jul 28 2004
-    copyright            : (C) 2004 by Thomas Friedrichsmeier
+    copyright            : (C) 2004, 2006, 2007 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -25,15 +25,21 @@
 #include <qlabel.h>
 #include <qbuttongroup.h>
 #include <qradiobutton.h>
+#include <qvgroupbox.h>
+#include <qcheckbox.h>
+#include <qhbox.h>
 
 #include "../rkward.h"
 #include "../rkglobals.h"
 #include "../misc/multistringselector.h"
 #include "../misc/rkcommonfunctions.h"
+#include "../misc/rkspinbox.h"
 
 // static members
 QStringList RKSettingsModulePlugins::plugin_maps;
 RKSettingsModulePlugins::PluginPrefs RKSettingsModulePlugins::interface_pref;
+bool RKSettingsModulePlugins::show_code;
+int RKSettingsModulePlugins::code_size;
 
 RKSettingsModulePlugins::RKSettingsModulePlugins (RKSettings *gui, QWidget *parent) : RKSettingsModule (gui, parent) {
 	QVBoxLayout *main_vbox = new QVBoxLayout (this, RKGlobals::marginHint ());
@@ -53,11 +59,25 @@
 	group_layout->addWidget (new QRadioButton (i18n ("Prefer recommended interface"), button_group));
 	group_layout->addWidget (new QRadioButton (i18n ("Always prefer wizards"), button_group));
 	button_group->setButton (static_cast<int> (interface_pref));
-	connect (button_group, SIGNAL (clicked (int)), this, SLOT (buttonClicked (int)));
+	connect (button_group, SIGNAL (clicked (int)), this, SLOT (settingChanged (int)));
 	main_vbox->addWidget (button_group);
 	
 	main_vbox->addSpacing (2*RKGlobals::spacingHint ());
+
+	QVGroupBox *code_frame = new QVGroupBox (i18n ("R syntax display (in dialogs)"), this);
+	show_code_box = new QCheckBox (i18n ("Code shown by default"), code_frame);
+	show_code_box->setChecked (show_code);
+	connect (show_code_box, SIGNAL (stateChanged (int)), this, SLOT (settingChanged (int)));
+
+	QHBox *code_size_hbox = new QHBox (code_frame);
+	new QLabel (i18n ("Default height of code display (pixels)"), code_size_hbox);
+	code_size_box = new RKSpinBox (code_size_hbox);
+	code_size_box->setIntMode (20, 5000, code_size);
+	connect (code_size_box, SIGNAL (valueChanged (int)), this, SLOT (settingChanged (int)));
+	main_vbox->addWidget (code_frame);
 	
+	main_vbox->addSpacing (2*RKGlobals::spacingHint ());
+
 	map_choser = new MultiStringSelector (i18n ("Select .pluginmap file(s)"), this);
 	map_choser->setValues (plugin_maps);
 	connect (map_choser, SIGNAL (getNewStrings (QStringList*)), this, SLOT (browseRequest (QStringList*)));
@@ -74,7 +94,7 @@
 	change ();
 }
 
-void RKSettingsModulePlugins::buttonClicked (int) {
+void RKSettingsModulePlugins::settingChanged (int) {
 	change ();
 }
 
@@ -97,6 +117,9 @@
 #else
 	interface_pref = static_cast<PluginPrefs> (button_group->selectedId ());
 #endif
+	show_code = show_code_box->isChecked ();
+	code_size = code_size_box->value ();
+
 	RKWardMainWindow::getMain ()->initPlugins();
 }
 
@@ -108,6 +131,8 @@
 	config->setGroup ("Plugin Settings");
 	config->writeEntry ("Plugin Maps", plugin_maps);
 	config->writeEntry ("Interface Preferences", static_cast<int> (interface_pref));
+	config->writeEntry ("Code display default", show_code);
+	config->writeEntry ("Code display size", code_size);
 }
 
 void RKSettingsModulePlugins::loadSettings (KConfig *config) {
@@ -131,6 +156,8 @@
 // END
 
 	interface_pref = static_cast<PluginPrefs> (config->readNumEntry ("Interface Preferences", static_cast<int> (PreferWizard)));
+	show_code = config->readBoolEntry ("Code display default", true);
+	code_size = config->readNumEntry ("Code display size", 40);
 }
 
 #include "rksettingsmoduleplugins.moc"

Modified: trunk/rkward/rkward/settings/rksettingsmoduleplugins.h
===================================================================
--- trunk/rkward/rkward/settings/rksettingsmoduleplugins.h	2007-02-15 21:43:15 UTC (rev 1398)
+++ trunk/rkward/rkward/settings/rksettingsmoduleplugins.h	2007-02-16 00:16:06 UTC (rev 1399)
@@ -2,7 +2,7 @@
                           rksettingsmoduleplugins  -  description
                              -------------------
     begin                : Wed Jul 28 2004
-    copyright            : (C) 2004 by Thomas Friedrichsmeier
+    copyright            : (C) 2004, 2006, 2007 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -23,6 +23,8 @@
 
 class MultiStringSelector;
 class QButtonGroup;
+class QCheckBox;
+class RKSpinBox;
 
 /** The settings-module for plugin specific settings
 @author Thomas Friedrichsmeier
@@ -47,16 +49,22 @@
 	
 	static QStringList &pluginMaps () { return plugin_maps; };
 	static PluginPrefs getInterfacePreference () { return interface_pref; };
+	static bool showCodeByDefault () { return show_code; };
+	static int defaultCodeHeight () { return code_size; };
 public slots:
 	void pathsChanged ();
-	void buttonClicked (int);
+	void settingChanged (int);
 	void browseRequest (QStringList* strings);
 private:
 	MultiStringSelector *map_choser;
 	QButtonGroup *button_group;
+	QCheckBox *show_code_box;
+	RKSpinBox *code_size_box;
 	
 	static QStringList plugin_maps;
 	static PluginPrefs interface_pref;
+	static bool show_code;
+	static int code_size;
 };
 
 #endif


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