[rkward-cvs] SF.net SVN: rkward:[2797] trunk/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Sun Mar 21 16:08:34 UTC 2010
Revision: 2797
http://rkward.svn.sourceforge.net/rkward/?rev=2797&view=rev
Author: tfry
Date: 2010-03-21 16:08:32 +0000 (Sun, 21 Mar 2010)
Log Message:
-----------
Make some of the katepart actions available in the console part
Modified Paths:
--------------
trunk/rkward/ChangeLog
trunk/rkward/rkward/rkconsole.cpp
trunk/rkward/rkward/rkconsole.h
trunk/rkward/rkward/rkconsolepart.rc
Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog 2010-03-21 13:16:16 UTC (rev 2796)
+++ trunk/rkward/ChangeLog 2010-03-21 16:08:32 UTC (rev 2797)
@@ -1,3 +1,4 @@
+- Make "print", "export as HTML", "dynamic word wrap", and "increase/descress font size" available for the console window
- Use a native menu, instead of the default TclTk-menu TODO: test, discuss the settings page, again
- Fixed: Newly created variables were not properly updated when closing and re-opening the editor
- Added "paste special" action to script editor and console for pasting R vectors and matrices from spreadsheets
Modified: trunk/rkward/rkward/rkconsole.cpp
===================================================================
--- trunk/rkward/rkward/rkconsole.cpp 2010-03-21 13:16:16 UTC (rev 2796)
+++ trunk/rkward/rkward/rkconsole.cpp 2010-03-21 16:08:32 UTC (rev 2797)
@@ -144,6 +144,43 @@
RKSettingsModuleConsole::saveCommandHistory (commands_history);
}
+QAction* RKConsole::addProxyAction (const QString& actionName, const QString& label) {
+ RK_TRACE (APP);
+ RK_ASSERT (getPart ());
+ RK_ASSERT (view);
+
+ // katepart has more than one actionCollection
+ QList<KActionCollection*> acs = view->findChildren<KActionCollection*>();
+ acs.append (view->actionCollection ());
+
+ QAction* found = 0;
+ foreach (KActionCollection* ac, acs) {
+ found = ac->action (actionName);
+ if (found) break;
+ }
+
+ if (found) {
+ QAction* ret = new KAction (getPart ());
+ if (label.isEmpty ()) ret->setText (found->text ());
+ else ret->setText (label);
+ ret->setIcon (found->icon ());
+ ret->setIconText (found->iconText ());
+ ret->setToolTip (found->toolTip ());
+ ret->setStatusTip (found->statusTip ());
+ ret->setCheckable (found->isCheckable ());
+ ret->setChecked (found->isChecked ());
+ // TODO: ideally, we'd also relay enabledness, checked state, etc. That would probably require a separate class,
+ // and is not currently needed for the actions that we copy
+ connect (ret, SIGNAL (triggered(bool)), found, SLOT (trigger()));
+ connect (ret, SIGNAL (toggled(bool)), found, SLOT (toggle()));
+
+ getPart ()->actionCollection ()->addAction (actionName, ret);
+ return ret;
+ } else {
+ return 0;
+ }
+}
+
void RKConsole::triggerEditAction (QString name) {
RK_TRACE (APP);
@@ -739,14 +776,6 @@
return(c.column ());
}
-//KDE4 still needed? (see ctor)
-void RKConsole::unplugAction(const QString &action, KActionCollection* ac) {
- QAction* a = ac->action (action);
- if( a ){
- a->setEnabled (false);
- }
-}
-
int RKConsole::currentCursorPositionInCommand(){
RK_TRACE (APP);
return(currentCursorPosition() - prefix.length());
@@ -819,6 +848,12 @@
paste_action = ac->addAction (KStandardAction::Paste, "rkconsole_paste", this, SLOT (paste()));
QAction *action = ac->addAction ("rkconsole_configure", this, SLOT (configure()));
action->setText (i18n ("Configure"));
+
+ addProxyAction ("file_print", i18n ("Print Console"));
+ addProxyAction ("file_export_html");
+ addProxyAction ("view_dynamic_word_wrap");
+ addProxyAction ("view_inc_font_sizes");
+ addProxyAction ("view_dec_font_sizes");
}
void RKConsole::pipeUserCommand (const QString &command) {
Modified: trunk/rkward/rkward/rkconsole.h
===================================================================
--- trunk/rkward/rkward/rkconsole.h 2010-03-21 13:16:16 UTC (rev 2796)
+++ trunk/rkward/rkward/rkconsole.h 2010-03-21 16:08:32 UTC (rev 2797)
@@ -128,11 +128,13 @@
const char *nprefix;
/** This string stores the continuation prefix. */
const char *iprefix;
-/** This function unplugs a KAction
-\param action the KAction to be unplugged
-\param ac the action collection from which to retrieve the KAction*/
- void unplugAction (const QString &action, KActionCollection* ac);
+/** Create a proxy for the katepart action of the same name. The action is added to the actioncollection, automatically. Also any icon and label (but not shorcut) is copied.
+ at param actionName Identifier of the action in katepartui.rc and rkconsolepart.rc
+ at param label Label for the proxy action. If empty (default) copy the label from the katepartui
+ at returns a pointer to the proxy action */
+ QAction* addProxyAction (const QString& actionName, const QString& label=QString ());
+
QString cleanedSelection ();
bool output_continuation;
Modified: trunk/rkward/rkward/rkconsolepart.rc
===================================================================
--- trunk/rkward/rkward/rkconsolepart.rc 2010-03-21 13:16:16 UTC (rev 2796)
+++ trunk/rkward/rkward/rkconsolepart.rc 2010-03-21 16:08:32 UTC (rev 2797)
@@ -1,6 +1,11 @@
<!DOCTYPE kpartgui>
<kpartgui name="rkward" version="53">
<MenuBar>
+ <Menu name="file"><text>&File</text>
+ <Action name="file_print"/>
+ <Separator group="print_merge" />
+ <Action name="file_export_html"/>
+ </Menu>
<Menu name="edit"><text>&Edit</text>
<Action name="rkconsole_copy" group="edit_paste_merge"/>
<Action name="rkconsole_copy_literal" group="edit_paste_merge"/>
@@ -9,6 +14,11 @@
<Separator/>
<Action name="rkconsole_clear"/>
</Menu>
+ <Menu name="view"><text>&View</text>
+ <Action name="view_dynamic_word_wrap" />
+ <Action name="view_inc_font_sizes" />
+ <Action name="view_dec_font_sizes" />
+ </Menu>
<Menu name="run"><text>&Run</text>
<Action name="interrupt" group="postrun_actions_merge"/>
</Menu>
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