AM_CONDITIONAL(ENABLE_QXGRAPHVIEWER, [test "$DISABLE_QXGRAPHVIEWER" = no])
AM_CONDITIONAL(ENABLE_TESTRECORDER, [test "$ENABLE_TESTRECORDER" = yes])
+if test "$DISABLE_PYCONSOLE" = "no" ; then
+ AC_DEFINE(SUIT_ENABLE_PYTHON)
+fi
+
+
echo
echo ---------------------------------------------
echo generating Makefiles and configure files
doc/salome/Makefile \
doc/salome/gui/Makefile \
doc/salome/gui/doxyfile \
+ doc/salome/gui/static/header.html \
doc/salome/tui/Makefile \
doc/salome/tui/doxyfile \
+ doc/salome/tui/static/header.html \
src/Makefile \
src/CASCatch/Makefile \
src/Qtx/Makefile \
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
-EXTRA_DIST += images input static
+EXTRA_DIST += images input static/footer.html static/doxygen.css
+
+guidocdir = $(docdir)/gui/GUI
+guidoc_DATA = images/head.png
usr_docs: doxyfile
echo "Running doxygen in directory: "`pwd`; \
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
-PROJECT_NAME = "GUI Module Reference Manual v.@VERSION@"
+PROJECT_NAME = "SALOME GUI User's Guide"
OUTPUT_DIRECTORY = GUI
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = .
-HTML_HEADER = @srcdir@/static/header.html
+HTML_HEADER = @builddir@/static/header.html
HTML_FOOTER = @srcdir@/static/footer.html
-#HTML_STYLESHEET = @srcdir@/static/doxygen.css
+HTML_STYLESHEET = @srcdir@/static/doxygen.css
TOC_EXPAND = YES
DISABLE_INDEX = NO
GENERATE_TREEVIEW = YES
<li><b>Cycled animation</b> - allows to start a cycled animation of the presentation.</li>
<li><b>Use proportional timing</b> - allows to render the animation with proportional periods of time between every frame (not depending on the time stamps).</li>
<li><b>Clean memory at each frame</b> - this option allows to optimize the performance of the operation.</li>
+<li><b>Dump mode</b> - this option allows to choose a mode of dumping
+the animation process. Three modes are available:
+<ul>
+<li><b>No dump</b> - disables dumping.</li>
+<li><b>Save pictures to directory</b> - dumps the animation
+to set of pictures corresponding to each timestamp.</li>
+<li><b>Save animation to AVI file</b> - generates a movie that
+reproduces the animation process.</li>
+</ul></li>
+<li><b>Time stamp frequency</b> - this option is available if
+<b>Save animation to AVI file</b> mode is turned on. It provides a
+possibility to capture only timestamps with indices divisable by the
+specified frequency, that allows to generate less voluminous films.</li>
</ul>
<li><b>Sweeping preferences</b></li>
--- /dev/null
+body {
+ font-family: Arial, Helvetica, sans-serif;
+ background-color: #ffffff;
+}
+
+h1 {
+ text-align: center;
+ text-decoration: none;
+ border: none;
+ line-height: 25px;
+ text-align: center;
+// text-transform:uppercase;
+ background: #D9f4fd;
+ font-size: 12pt;
+ font-weight: bold;
+ border: 1px solid #CCCCCC;
+ -moz-border-radius: 8px;
+ -moz-box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15);
+}
+
+h2 {
+ font-size: 12pt;
+ font-weight: bold;
+}
+
+table {
+ font-size: 10pt;
+}
+
+CAPTION {
+ font-weight: bold
+}
+
+/* Link in the top navbar */
+A.qindex {}
+
+A.qindexRef {}
+
+/* Link to any cross-referenced Doxygen element inside a code section
+ (ex: header)
+*/
+A.code {
+ text-decoration: none;
+ font-weight: normal;
+ color: #4444ee
+}
+
+A.codeRef {
+ font-weight: normal;
+ color: #4444ee
+}
+
+A:hover {
+ text-decoration: none;
+ background-color: lightblue;
+}
+
+div.contents {
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 10pt;
+}
+
+div.navpath {
+ font-size: 11pt;
+}
+
+div.version {
+ background-color:#ffffde;
+ border:1px solid #cccccc;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 9pt;
+ text-align: center;
+ width:100px;
+ -moz-border-radius: 8px;
+// -moz-box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15);
+}
+
+div.header {
+ background: url("head.png");
+ background-color: #175783;
+ border: 1px solid;
+ height: 80px;
+ background-repeat: no-repeat;
+ margin-bottom: 10px;
+}
+
+div.tabs {
+ display: none;
+}
+
+div.footer {
+ background-color: #D9f4fd;
+ border: 1px solid #AAAAAA;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 11px;
+ padding: 10px;
+ margin-top: 15px;
+}
+
+DL.el {
+ margin-left: -1cm
+}
+
+/* A code fragment (ex: header) */
+div.fragment {
+ border: none;
+}
+
+/* In the alpha list (coumpound index), style of an alphabetical index letter */
+DIV.ah {
+ background-color: #CCCCCC;
+ font-weight: bold;
+ color: #ffffff;
+ margin-bottom: 3px;
+ margin-top: 3px
+}
+
+/* Method name (+ type) */
+TD.md {
+ background-color: lightblue;
+ font-weight: bold;
+}
+
+/* Method parameter (some of them) */
+TD.mdname1 {
+ background-color: lightblue;
+ font-weight: bold; color: #602020;
+}
+
+/* Method parameter (some of them) */
+TD.mdname {
+ background-color: lightblue;
+ font-weight: bold;
+ color: #602020;
+ width: 600px;
+}
+
+/* Separator between methods group (usually empty, seems not supported by IE) */
+DIV.groupHeader {
+ margin-left: 16px;
+ margin-top: 12px;
+ margin-bottom: 6px;
+ font-weight: bold
+}
+
+DIV.groupText {
+ margin-left: 16px;
+ font-style: italic;
+ font-size: smaller
+}
+
+/*div.div-page {
+ background-color: #FFFFFF;
+ margin-left: 1em;
+ margin-right: 1em;
+ margin-top: 1em;
+ margin-bottom: 0.1em;
+
+ padding-left: 1em;
+ padding-right: 1em;
+ padding-top: 0.5em;
+ padding-bottom: 0.5em;
+
+ border: 2px solid #0D299A;
+ border-width: 2px;
+ border-color: #0D299A;
+}*/
+
+div.tabs {
+ text-align: justify;
+ margin-left : 2px;
+ margin-right : 2px;
+ margin-top : 2px;
+ margin-bottom : 2px
+ font-weight: bold;
+ color: #FFFFFF;
+}
+
+DIV.div-footer {
+ margin-left: 1em;
+ margin-right: 1em;
+ margin-bottom: 0.2em;
+ text-align: right;
+ font-size: 9pt;
+}
+
+/* In File List, Coumpound List, etc, 1st column of the index */
+TD.indexkey {
+ background-color: #CCCCCC;
+ font-weight: bold;
+ padding-right : 10px;
+ padding-top : 2px;
+ padding-left : 10px;
+ padding-bottom : 2px;
+ margin-left : 0px;
+ margin-right : 0px;
+ margin-top : 2px;
+ margin-bottom : 2px
+}
+
+/* In File List, Coumpound List, etc, 2nd column of the index */
+TD.indexvalue {
+ background-color: #CCCCCC;
+ font-style: italic;
+ padding-right : 10px;
+ padding-top : 2px;
+ padding-left : 10px;
+ padding-bottom : 2px;
+ margin-left : 0px;
+ margin-right : 0px;
+ margin-top : 2px;
+ margin-bottom : 2px
+}
+
+span.keyword { color: #008000 }
+span.keywordtype { color: #604020 }
+span.keywordflow { color: #e08000 }
+span.comment { color: #800000 }
+span.preprocessor { color: #806020 }
+span.stringliteral { color: #002080 }
+span.charliteral { color: #008080 }
+
+/* @group Code Colorization */
+
+.fragment {
+ font-family: monospace, fixed;
+ font-size: 10pt;
+}
+
+pre.fragment {
+ width: 95%;
+ border: 1px solid #CCCCCC;
+ -moz-border-radius: 8px;
+ -moz-box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15);
+ background-color:#EEF3F5;
+ padding: 4px 6px;
+ margin: 4px 1px 4px 1px;
+}
+
+/* Top Navigation style */
+
+div.navigation {
+ margin-bottom:20px;
+}
+
+/* Left navigation panel style */
+
+body.ftvtree {
+ background-color: #D9f4fd;
+ margin: 10px;
+}
+
+div.directory {
+ margin: 0;
+}
+
+div.directory.p {
+ margin: 0;
+}
+
+h3.swap {
+ font-size: 10pt;
+ margin-bottom: 0;
+}
+
+/* Link to any cross-referenced Doxygen element */
+a.el {
+ text-decoration: none;
+ font-family: Arial, Helvetica, sans-serif;
+ font-weight: bold;
+ font-size: 9pt;
+ color: #551a8b;
+}
+
+a.el:hover {
+ background-color: transparent;
+}
+
+a.elRef {
+ font-weight: normal;
+}
+
+
+#MSearchBox {
+ -moz-border-radius:8px 8px 8px 8px;
+ background-color:white;
+ border:1px solid #84B0C7;
+ margin:0;
+ padding:0;
+ white-space:nowrap;
+}
+
+div.directory img {
+ vertical-align:-30%;
+}
+
+div.directory p {
+ white-space:nowrap;
+ margin: 0;
+}
+
+div.directory-alt div {
+ display: none;
+ margin: 0px;
+}
+
+
+div.directory div {
+ display: none;
+ margin: 0px;
+}
+
+div.version {
+ background-color:#ffffde;
+ border:1px solid #cccccc;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 9pt;
+ text-align: center;
+ width:100px;
+ -moz-border-radius: 8px;
+// -moz-box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15);
+}
<head>
</head>
<body>
-<hr style="width: 100%; height: 2px;">
+<div class="footer">
<div style="text-align: center;">
-Copyright © 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE<br>
-Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS<br>
+Copyright © 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE<br>
+Copyright © 2003-2010 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS<br>
+</div>
</div>
</body>
</html>
+++ /dev/null
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>$title</title>
- <link href="doxygen.css" rel="stylesheet" type="text/css">
-</head>
-<hr>
-<center>
-SALOME documentation central
-</center>
-<hr>
--- /dev/null
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <title>$title</title>
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+</head>
+<div class="header"></div>
+<div align="right"><div class="version">Version: @VERSION@</div></div>
+
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
-EXTRA_DIST += images static
+EXTRA_DIST += images input static/footer.html static/doxygen.css
+
+tuidocdir = $(docdir)/tui/GUI
+tuidoc_DATA = images/head.png
dev_docs: doxyfile
echo "Running doxygen in directory: "`pwd`; \
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
-PROJECT_NAME = "GUI Module Programming Guide v.@VERSION@"
+PROJECT_NAME = "SALOME GUI Developer"
PROJECT_NUMBER =
OUTPUT_DIRECTORY = GUI
CREATE_SUBDIRS = NO
INPUT = @top_srcdir@/src \
@top_srcdir@/bin \
@top_srcdir@/idl \
- @top_builddir@/bin
-FILE_PATTERNS = *.idl *.hxx *.cxx *.h *.c *.hh *.cc @DOXYGEN_PYTHON_EXTENSION@
+ @top_builddir@/bin \
+ @srcdir@/input
+FILE_PATTERNS = *.idl *.hxx *.cxx *.h *.c *.hh *.cc @DOXYGEN_PYTHON_EXTENSION@ *.doc
RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
GENERATE_HTML = YES
HTML_OUTPUT = .
HTML_FILE_EXTENSION = .html
-HTML_HEADER = @srcdir@/static/myheader.html
+HTML_HEADER = @builddir@/static/header.html
HTML_FOOTER = @srcdir@/static/footer.html
HTML_STYLESHEET = @srcdir@/static/doxygen.css
HTML_ALIGN_MEMBERS = YES
-H1 {
+body {
+ font-family: Arial, Helvetica, sans-serif;
+ background-color: #ffffff;
+}
+
+h1 {
text-align: center;
+ text-decoration: none;
+ border: none;
+ line-height: 25px;
+ text-align: center;
+// text-transform:uppercase;
+ background: #D9f4fd;
+ font-size: 12pt;
+ font-weight: bold;
+ border: 1px solid #CCCCCC;
+ margin-top: 50px;
+ -moz-border-radius: 8px;
+ -moz-box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15);
+}
+
+h2 {
+ font-size: 12pt;
+ font-weight: bold;
+}
+
+table {
+ font-size: 10pt;
+ padding-left: 20px;
}
CAPTION {
A.qindexRef {}
-/* Link to any cross-referenced Doxygen element */
-A.el {
- text-decoration: none;
- font-weight: bold
-}
-
-A.elRef {
- font-weight: bold
-}
-
/* Link to any cross-referenced Doxygen element inside a code section
(ex: header)
*/
A:hover {
text-decoration: none;
- background-color: lightblue
+ background-color: lightblue;
+}
+
+div.contents {
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 10pt;
+ padding: 20px;
+}
+
+div.navpath {
+ font-size: 11pt;
+}
+
+div.header {
+ background: url("head.png");
+ background-color: #175783;
+ border: 1px solid;
+ height: 80px;
+ background-repeat: no-repeat;
+ margin-bottom:20px;
+}
+
+div.tabs {
+ text-align: justify;
+ margin-left : 2px;
+ margin-right : 2px;
+ margin-top : 2px;
+ margin-bottom : 2px
+ font-weight: bold;
+ color: #FFFFFF;
+}
+
+div.footer {
+ background-color: #D9f4fd;
+ border: 1px solid #AAAAAA;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 11px;
+ padding: 10px;
+}
+
+div.div-footer {
+ background-color: #D9f4fd;
+ border: 1px solid #AAAAAA;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 11px;
+ padding: 10px;
+ text-align: center;
}
DL.el {
}
/* A code fragment (ex: header) */
-DIV.fragment {
- width: 100%;
+div.fragment {
border: none;
- background-color: #CCCCCC
}
/* In the alpha list (coumpound index), style of an alphabetical index letter */
font-size: smaller
}
-BODY { background: #FFFFFF
-}
+/*div.div-page {
+ background-color: #FFFFFF;
+ margin-left: 1em;
+ margin-right: 1em;
+ margin-top: 1em;
+ margin-bottom: 0.1em;
+
+ padding-left: 1em;
+ padding-right: 1em;
+ padding-top: 0.5em;
+ padding-bottom: 0.5em;
-/* BODY {
- background: url(sources/bg_salome.gif)
-} */
+ border: 2px solid #0D299A;
+ border-width: 2px;
+ border-color: #0D299A;
+}*/
div.tabs {
text-align: justify;
+ margin-left : 2px;
+ margin-right : 2px;
+ margin-top : 2px;
+ margin-bottom : 2px
font-weight: bold;
color: #FFFFFF;
}
-DIV.div-footer {
- margin-left: 1em;
- margin-right: 1em;
- margin-bottom: 0.2em;
- text-align: right;
- font-size: 9pt;
-}
-
/* In File List, Coumpound List, etc, 1st column of the index */
TD.indexkey {
- background-color: #CCCCCC;
+ background-color: #DDDDEE;
font-weight: bold;
padding-right : 10px;
padding-top : 2px;
/* In File List, Coumpound List, etc, 2nd column of the index */
TD.indexvalue {
- background-color: #CCCCCC;
+ background-color: #EEEEFF;
font-style: italic;
padding-right : 10px;
padding-top : 2px;
span.preprocessor { color: #806020 }
span.stringliteral { color: #002080 }
span.charliteral { color: #008080 }
+
+/* @group Code Colorization */
+
+.fragment {
+ font-family: monospace, fixed;
+ font-size: 10pt;
+}
+
+pre.fragment {
+ width: 95%;
+ border: 1px solid #CCCCCC;
+ -moz-border-radius: 8px;
+ -moz-box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15);
+ background-color:#EEF3F5;
+ padding: 4px 6px;
+ margin: 20px;
+}
+
+/* Top Navigation style */
+
+div.navigation {
+ margin-bottom:20px;
+}
+
+/* Left navigation panel style */
+
+body.ftvtree {
+ background-color: #D9f4fd;
+ margin: 10px;
+}
+
+div.directory {
+ margin: 0;
+}
+
+div.directory.p {
+ margin: 0;
+}
+
+h3.swap {
+ font-size: 10pt;
+ margin-bottom: 0;
+}
+
+/* Link to any cross-referenced Doxygen element */
+a.el {
+ text-decoration: none;
+ font-family: Arial, Helvetica, sans-serif;
+ font-weight: bold;
+ font-size: 10pt;
+ color: #551a8b;
+}
+
+a.el:hover {
+ background-color: transparent;
+ color: #551acc;
+}
+
+a {
+// text-decoration: none;
+ font-family: Arial, Helvetica, sans-serif;
+ font-weight: bold;
+ font-size: 10pt;
+ color: #551a8b;
+}
+
+a:hover {
+ background-color: transparent;
+ color: #551acc;
+}
+
+a.elRef {
+ font-weight: normal;
+}
+
+
+#MSearchBox {
+ -moz-border-radius:8px 8px 8px 8px;
+ background-color:white;
+ border:1px solid #84B0C7;
+ margin:0;
+ padding:0;
+ white-space:nowrap;
+}
+
+div.directory img {
+ vertical-align:-30%;
+}
+
+div.directory p {
+ white-space:nowrap;
+ margin: 0;
+}
+
+div.directory-alt div {
+ display: none;
+ margin: 0px;
+}
+
+
+div.directory div {
+ display: none;
+ margin: 0px;
+}
+
+div.version {
+ background-color:#ffffde;
+ border:1px solid #cccccc;
+ font-family: Arial, Helvetica, sans-serif;
+ font-size: 9pt;
+ text-align: center;
+ width:100px;
+ -moz-border-radius: 8px;
+ // -moz-box-shadow:5px 5px 5px rgba(0, 0, 0, 0.15);
+}
\ No newline at end of file
-</DIV>
-<DIV class="div-footer">
-Generated on $datetime for $projectname by <A href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></A> $doxygenversion</DIV>
-</BODY>
-</HTML>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+</head>
+<body>
+<div class="footer">
+<div style="text-align: center;">
+Copyright © 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE<br>
+Copyright © 2003-2010 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS<br>
+</div>
+</div>
+</body>
+</html>
--- /dev/null
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.73 [en] (WinNT; I) [Netscape]">
+ <title>SALOME Geometry Developer Guide</title>
+<link href="doxygen.css" rel="stylesheet" type="text/css">
+<link href="tabs.css" rel="stylesheet" type="text/css">
+</head>
+<body>
+<div class="header"></div>
+<div align="right"><div class="version">Version: @VERSION@</div></div>
+</body>
+</html>
+++ /dev/null
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="GENERATOR" content="Mozilla/4.73 [en] (WinNT; I) [Netscape]">
- <title>Main Page</title>
-<link href="doxygen.css" rel="stylesheet" type="text/css">
-<link href="tabs.css" rel="stylesheet" type="text/css">
-</head>
-<body>
-
-</body>
-</html>
// E.A. : On windows with python 2.6, there is a conflict
// E.A. : between pymath.h and Standard_math.h which define
// E.A. : some same symbols : acosh, asinh, ...
-#include <Standard_math.hxx>
-#include <pymath.h>
+ #include <Standard_math.hxx>
+ #ifndef DISABLE_PYCONSOLE
+ #include <pymath.h>
+ #endif
#endif
#ifndef DISABLE_PYCONSOLE
#ifndef DISABLE_PLOT2DVIEWER
#include <Plot2d_ViewManager.h>
#include <Plot2d_ViewModel.h>
+ #include <Plot2d_ViewWindow.h>
+ #include <Plot2d_ViewFrame.h>
#include "LightApp_Plot2dSelector.h"
#ifndef DISABLE_SALOMEOBJECT
#include <SPlot2d_ViewModel.h>
*/
void LightApp_Application::onSelectionChanged()
{
+ LightApp_Module* m = dynamic_cast<LightApp_Module*>( activeModule() );
+ bool canCopy = m ? m->canCopy() : false;
+ bool canPaste = m ? m->canPaste() : false;
+
+ action( EditCopyId )->setEnabled(canCopy);
+ action( EditPasteId )->setEnabled(canPaste);
}
/*!
removeViewManager(aMgr);
}
}
+
+/*!
+ Copy of current selection
+ */
+void LightApp_Application::onCopy()
+{
+ LightApp_Module* m = dynamic_cast<LightApp_Module*>( activeModule() );
+ if( m )
+ m->copy();
+}
+
+/*!
+ Paste of current data in clipboard
+ */
+void LightApp_Application::onPaste()
+{
+ LightApp_Module* m = dynamic_cast<LightApp_Module*>( activeModule() );
+ if( m )
+ m->paste();
+}
virtual void onOpenDoc();
virtual void onHelpAbout();
virtual bool onOpenDoc( const QString& );
+ virtual void onCopy();
+ virtual void onPaste();
+ virtual void onSelectionChanged();
protected:
virtual void createActions();
virtual void setActiveStudy( SUIT_Study* );
virtual void updateCommandsStatus();
- virtual void onSelectionChanged();
virtual void beforeCloseDoc( SUIT_Study* );
virtual void afterCloseDoc();
return true;
}
+/*!
+ virtual method
+ \return true if module can copy the current selection
+*/
+bool LightApp_Module::canCopy() const
+{
+ return false;
+}
+
+/*!
+ virtual method
+ \return true if module can paste previously copied data
+*/
+bool LightApp_Module::canPaste() const
+{
+ return false;
+}
+
+/*!
+ virtual method
+ \brief Copies the current selection into clipboard
+*/
+void LightApp_Module::copy()
+{
+}
+
+/*!
+ virtual method
+ \brief Pastes the current data in the clipboard
+*/
+void LightApp_Module::paste()
+{
+}
int LightApp_Module::createMenu( const QString& subMenu, const int menu, const int id, const int group, const int idx )
virtual LightApp_Displayer* displayer();
virtual LightApp_Selection* createSelection() const;
+ virtual bool canCopy() const;
+ virtual bool canPaste() const;
+ virtual void copy();
+ virtual void paste();
+
int createMenu( const QString&, const int, const int = -1, const int = -1, const int = -1 );
int createMenu( const QString&, const QString&, const int = -1, const int = -1, const int = -1 );
int createMenu( const int, const int, const int = -1, const int = -1 );
if ( !cb )
return;
+ bool blocked = cb->blockSignals( true );
int curId = mySet->moduleId( active() );
QList<QAction*> alist = mySet->actions();
cb->clear();
}
cb->setCurrentId( curId );
+ cb->blockSignals( blocked );
}
/*!
/*!
Constructor
*/
-LightApp_Plot2dSelector::LightApp_Plot2dSelector( SPlot2d_Viewer* v, SUIT_SelectionMgr* mgr )
+LightApp_Plot2dSelector::LightApp_Plot2dSelector( Plot2d_Viewer* v, SUIT_SelectionMgr* mgr )
: SUIT_Selector( mgr, v )
{
if ( v )
#include <SUIT_Selector.h>
#include <SUIT_DataOwner.h>
-#include <SPlot2d_ViewModel.h>
+#include <Plot2d_ViewModel.h>
class LightApp_DataObject;
Q_OBJECT
public:
- LightApp_Plot2dSelector( SPlot2d_Viewer*, SUIT_SelectionMgr* );
+ LightApp_Plot2dSelector( Plot2d_Viewer*, SUIT_SelectionMgr* );
virtual ~LightApp_Plot2dSelector();
/*!Return "ObjectBrowser"*/
OCCViewer_ClippingDlg.h \
OCCViewer_AxialScaleDlg.h \
OCCViewer_SetRotationPointDlg.h \
- OCCViewer_Trihedron.h
+ OCCViewer_Trihedron.h \
+ OCCViewer_ToolTip.h
dist_libOCCViewer_la_SOURCES = \
OCCViewer_AISSelector.cxx \
if ( myOperation != ZOOMVIEW ) {
QPixmap zoomPixmap (imageZoomCursor);
QCursor zoomCursor (zoomPixmap);
- setTransformRequested ( ZOOMVIEW );
- myViewPort->setCursor( zoomCursor );
+ if( setTransformRequested ( ZOOMVIEW ) )
+ myViewPort->setCursor( zoomCursor );
}
}
if ( myOperation != PANVIEW ) {
QCursor panCursor (Qt::SizeAllCursor);
- setTransformRequested ( PANVIEW );
- myViewPort->setCursor( panCursor );
+ if( setTransformRequested ( PANVIEW ) )
+ myViewPort->setCursor( panCursor );
}
}
if ( myOperation != ROTATE ) {
QPixmap rotatePixmap (imageRotateCursor);
QCursor rotCursor (rotatePixmap);
- setTransformRequested ( ROTATE );
- myViewPort->setCursor( rotCursor );
+ if( setTransformRequested ( ROTATE ) )
+ myViewPort->setCursor( rotCursor );
}
}
aView3d->FitAll(0.01, false);
myCursor = cursor(); // save old cursor
myViewPort->fitAll(); // fits view before selecting a new scene center
- setTransformRequested( PANGLOBAL );
- myViewPort->setCursor( glPanCursor );
+ if( setTransformRequested( PANGLOBAL ) )
+ myViewPort->setCursor( glPanCursor );
}
}
if ( myOperation != WINDOWFIT ) {
QCursor handCursor (Qt::PointingHandCursor);
- setTransformRequested ( WINDOWFIT );
- myViewPort->setCursor ( handCursor );
- myCursorIsHand = true;
+ if( setTransformRequested ( WINDOWFIT ) )
+ {
+ myViewPort->setCursor ( handCursor );
+ myCursorIsHand = true;
+ }
}
}
/*!
\brief Start delayed viewer operation.
*/
-void OCCViewer_ViewWindow::setTransformRequested( OperationType op )
+bool OCCViewer_ViewWindow::setTransformRequested( OperationType op )
{
- myOperation = op;
- myViewPort->setMouseTracking( myOperation == NOTHING );
+ bool ok = transformEnabled( op );
+ myOperation = ok ? op : NOTHING;
+ myViewPort->setMouseTracking( myOperation == NOTHING );
+ return ok;
}
-
/*!
\brief Handle mouse move event.
\param theEvent mouse event
{
myEventStarted = bOn;
}
+
+/*!
+ Set enabled state of transformation (rotate, zoom, etc)
+*/
+void OCCViewer_ViewWindow::setTransformEnabled( const OperationType id, const bool on )
+{
+ if ( id != NOTHING ) myStatus.insert( id, on );
+}
+
+/*!
+ \return enabled state of transformation (rotate, zoom, etc)
+*/
+bool OCCViewer_ViewWindow::transformEnabled( const OperationType id ) const
+{
+ return myStatus.contains( id ) ? myStatus[ id ] : true;
+}
int interactionStyle() const;
void setInteractionStyle( const int );
+ void setTransformEnabled( const OperationType, const bool );
+ bool transformEnabled( const OperationType ) const;
+
public slots:
void onFrontView();
void onViewFitAll();
/* Transformation selected but not started yet */
bool transformRequested() const;
- void setTransformRequested ( OperationType );
+ bool setTransformRequested ( OperationType );
/* Transformation is selected and already started */
bool transformInProcess() const;
QtxRectRubberBand* myRectBand; //!< selection rectangle rubber band
int myInteractionStyle;
+
+ typedef QMap<OperationType, bool> MapOfTransformStatus;
+ MapOfTransformStatus myStatus;
};
#ifdef WIN32
"................................",
"................................"};
+const char* yAxisLeft[] = {
+ "12 12 2 1",
+ " c None",
+ ". c #000000",
+ " ",
+ " . ",
+ " ... ",
+ " . . . ",
+ " . ",
+ " . ",
+ " . . ",
+ " . . ",
+ " ........ ",
+ " . ",
+ " . ",
+ " "};
+
+const char* yAxisRight[] = {
+ "12 12 2 1",
+ " c None",
+ ". c #000000",
+ " ",
+ " . ",
+ " ... ",
+ " . . . ",
+ " . ",
+ " . ",
+ " . . ",
+ " . . ",
+ " ........ ",
+ " . ",
+ " . ",
+ " "};
+
/*!
Constructor
if ( !prs || prs->IsNull() )
return;
- if (prs->isSecondY()) {
- myPlot->enableAxis(QwtPlot::yRight, true);
- mySecondY = true;
- }
- else {
- myPlot->enableAxis(QwtPlot::yRight, false);
- mySecondY = false;
- }
+ mySecondY = prs->isSecondY();
// display all curves from presentation
curveList aCurves = prs->getCurves();
if ( !curve )
return;
+ if ( curve->getYAxis() == QwtPlot::yRight )
+ mySecondY = true;
+
// san -- Protection against QwtCurve bug in Qwt 0.4.x:
// it crashes if switched to X/Y logarithmic mode, when one or more points have
// non-positive X/Y coordinate
updateCurve( curve, update );
}
else {
- QwtPlotCurve* aPCurve = new QwtPlotCurve( curve->getVerTitle() );
+ Plot2d_QwtPlotCurve* aPCurve = new Plot2d_QwtPlotCurve( curve->getVerTitle(), curve->getYAxis() );
aPCurve->attach( myPlot );
- //myPlot->setCurveYAxis(curveKey, curve->getYAxis());
+ aPCurve->setYAxis( curve->getYAxis() );
myPlot->getCurves().insert( aPCurve, curve );
if ( curve->isAutoAssign() ) {
aPCurve->setData( curve->horData(), curve->verData(), curve->nbPoints() );
}
updateTitles();
+ myPlot->updateYAxisIdentifiers();
if ( update )
myPlot->replot();
}
aPCurve->detach();
myPlot->getCurves().remove( aPCurve );
updateTitles();
+ myPlot->updateYAxisIdentifiers();
if ( update )
myPlot->replot();
}
if (mySecondY) {
myPlot->setAxisAutoScale( QwtPlot::yRight );
myPlot->replot();
- QwtScaleMap yMap2 = myPlot->canvasMap( QwtPlot::yRight );
myPlot->setAxisScale( QwtPlot::yRight, y2min, y2max );
}
myPlot->replot();
double& y2Min, double& y2Max)
{
CurveDict cdict = getCurves();
- bool empty = true;
+ bool emptyV1 = true, emptyV2 = true;
if ( !cdict.isEmpty() ) {
CurveDict::const_iterator it = myPlot->getCurves().begin();
for ( ; it != myPlot->getCurves().end(); it++ ) {
+ bool isV2 = it.value()->getYAxis() == QwtPlot::yRight;
if ( !it.value()->isEmpty() ) {
- if ( empty ) {
- xMin = yMin = y2Min = 1e150;
- xMax = yMax = y2Max = -1e150;
+ if ( emptyV1 && emptyV2 ) {
+ xMin = 1e150;
+ xMax = -1e150;
+ }
+ if ( emptyV1 ) {
+ yMin = 1e150;
+ yMax = -1e150;
}
- empty = false;
+ if ( emptyV2 ) {
+ y2Min = 1e150;
+ y2Max = -1e150;
+ }
+ isV2 ? emptyV2 = false : emptyV1 = false;
xMin = qMin( xMin, it.value()->getMinX() );
xMax = qMax( xMax, it.value()->getMaxX() );
- yMin = qMin( yMin, it.value()->getMinY() );
- yMax = qMax( yMax, it.value()->getMaxY() );
+ if ( isV2 ) {
+ y2Min = qMin( y2Min, it.value()->getMinY() );
+ y2Max = qMax( y2Max, it.value()->getMaxY() );
+ }
+ else {
+ yMin = qMin( yMin, it.value()->getMinY() );
+ yMax = qMax( yMax, it.value()->getMaxY() );
+ }
}
}
if ( xMin == xMax ) {
yMin = yMin == 0. ? -1. : yMin - yMin/10.;
yMax = yMax == 0. ? 1 : yMax + yMax/10.;
}
- y2Min = yMin;
- y2Max = yMax;
+ if ( y2Min == y2Max ) {
+ y2Min = y2Min == 0. ? -1. : y2Min - y2Min/10.;
+ y2Max = y2Max == 0. ? 1 : y2Max + y2Max/10.;
+ }
}
- if ( empty ) {
- // default values
+ // default values
+ if ( emptyV1 && emptyV2 ) {
xMin = isModeHorLinear() ? 0. : 1.;
xMax = isModeHorLinear() ? 1000. : 1e5;
- yMin = y2Min = isModeVerLinear() ? 0. : 1.;
- yMax = y2Max = isModeVerLinear() ? 1000 : 1e5;
+ }
+ if ( emptyV1 ) {
+ yMin = isModeVerLinear() ? 0. : 1.;
+ yMax = isModeVerLinear() ? 1000. : 1e5;
+ }
+ if ( emptyV2 ) {
+ y2Min = isModeVerLinear() ? 0. : 1.;
+ y2Max = isModeVerLinear() ? 1000. : 1e5;
}
}
*/
void Plot2d_Plot2d::replot()
{
+ // the following code is intended to enable only axes
+ // that are really used by displayed curves
+ bool enableXBottom = false, enableXTop = false;
+ bool enableYLeft = false, enableYRight = false;
+ CurveDict::iterator it = myCurves.begin();
+ for( ; it != myCurves.end(); it++ ) {
+ QwtPlotCurve* aCurve = it.key();
+ if( aCurve ) {
+ enableXBottom |= aCurve->xAxis() == QwtPlot::xBottom;
+ enableXTop |= aCurve->xAxis() == QwtPlot::xTop;
+ enableYLeft |= aCurve->yAxis() == QwtPlot::yLeft;
+ enableYRight |= aCurve->yAxis() == QwtPlot::yRight;
+ }
+ }
+ enableAxis( QwtPlot::xBottom, enableXBottom );
+ enableAxis( QwtPlot::xTop, enableXTop );
+ enableAxis( QwtPlot::yLeft, enableYLeft );
+ enableAxis( QwtPlot::yRight, enableYRight );
+
updateLayout(); // to fix bug(?) of Qwt - view is not updated when title is changed
QwtPlot::replot();
}
}
}
+/*!
+ Updates identifiers of Y axis type in the legend.
+*/
+void Plot2d_Plot2d::updateYAxisIdentifiers()
+{
+ bool enableYLeft = false, enableYRight = false;
+ CurveDict::iterator it = myCurves.begin();
+ for( ; it != myCurves.end(); it++ ) {
+ QwtPlotCurve* aCurve = it.key();
+ if( aCurve ) {
+ enableYLeft |= aCurve->yAxis() == QwtPlot::yLeft;
+ enableYRight |= aCurve->yAxis() == QwtPlot::yRight;
+ }
+ }
+
+ // if several curves are attached to different axes
+ // display corresponding identifiers in the legend,
+ // otherwise hide them
+ for( it = myCurves.begin(); it != myCurves.end(); it++ )
+ if( Plot2d_QwtPlotCurve* aPCurve = dynamic_cast<Plot2d_QwtPlotCurve*>( it.key() ) )
+ aPCurve->setYAxisIdentifierEnabled( enableYLeft && enableYRight );
+
+ const QwtPlotItemList& anItemList = itemList();
+ for( QwtPlotItemIterator anItemIter = anItemList.begin(); anItemIter != anItemList.end(); ++anItemIter ) {
+ QwtPlotItem* anItem = *anItemIter;
+ if( anItem && anItem->isVisible() )
+ anItem->updateLegend( legend() );
+ }
+}
+
/*!
Sets the flag saying that QwtPlot geometry has been fully defined.
*/
//QIntDictIterator<Plot2d_Curve> it( myCurves );
QStringList aXTitles;
QStringList aYTitles;
+ QStringList aY2Titles;
QStringList aXUnits;
QStringList aYUnits;
+ QStringList aY2Units;
QStringList aTables;
int i = 0;
QString yTitle = aCurve->getVerTitle().trimmed();
QString xUnits = aCurve->getHorUnits().trimmed();
QString yUnits = aCurve->getVerUnits().trimmed();
+ bool isY2 = aCurve->getYAxis() == QwtPlot::yRight;
- aYTitles.append( yTitle );
if ( !aXTitles.contains( xTitle ) )
aXTitles.append( xTitle );
if ( !aXUnits.contains( xUnits ) )
aXUnits.append( xUnits );
- if ( !aYUnits.contains( yUnits ) )
- aYUnits.append( yUnits );
+ if ( isY2 ) {
+ aY2Titles.append( yTitle );
+ if ( !aY2Units.contains( yUnits ) )
+ aY2Units.append( yUnits );
+ }
+ else {
+ aYTitles.append( yTitle );
+ if ( !aYUnits.contains( yUnits ) )
+ aYUnits.append( yUnits );
+ }
QString aName = aCurve->getTableTitle();
if( !aName.isEmpty() && !aTables.contains( aName ) )
++i;
}
// ... and update plot 2d view
- QString xUnits, yUnits;
+ QString xUnits, yUnits, y2Units;
if ( aXUnits.count() == 1 && !aXUnits[0].isEmpty() )
xUnits = BRACKETIZE( aXUnits[0] );
if ( aYUnits.count() == 1 && !aYUnits[0].isEmpty())
yUnits = BRACKETIZE( aYUnits[0] );
- QString xTitle, yTitle;
+ if ( aY2Units.count() == 1 && !aY2Units[0].isEmpty())
+ y2Units = BRACKETIZE( aY2Units[0] );
+ QString xTitle, yTitle, y2Title;
if ( aXTitles.count() == 1 && aXUnits.count() == 1 )
xTitle = aXTitles[0];
if ( aYTitles.count() == 1 )
yTitle = aYTitles[0];
+ if ( aY2Titles.count() == 1 )
+ y2Title = aY2Titles[0];
if ( !xTitle.isEmpty() && !xUnits.isEmpty() )
xTitle += " ";
if ( !yTitle.isEmpty() && !yUnits.isEmpty() )
yTitle += " ";
+ if ( !y2Title.isEmpty() && !y2Units.isEmpty() )
+ y2Title += " ";
setTitle( myXTitleEnabled, xTitle + xUnits, XTitle, true );
setTitle( myYTitleEnabled, yTitle + yUnits, YTitle, true );
+ if ( mySecondY )
+ setTitle( myY2TitleEnabled, y2Title + y2Units, Y2Title, true );
setTitle( true, aTables.join("; "), MainTitle, true );
}
return QwtScaleDraw::label( value );
}
+
+/*!
+ Constructor of Plot2d_QwtLegendItem
+*/
+Plot2d_QwtLegendItem::Plot2d_QwtLegendItem( QWidget* parent ) :
+ QwtLegendItem( parent ),
+ myYAxisIdentifierMode( IM_None )
+{
+ myYAxisLeftIcon = yAxisLeft;
+ myYAxisRightIcon = yAxisRight;
+ int anIconWidth = qMax( myYAxisLeftIcon.width(), myYAxisRightIcon.width() );
+
+ mySpacingCollapsed = spacing();
+ mySpacingExpanded = anIconWidth - mySpacingCollapsed;
+}
+
+/*!
+ Destructor of Plot2d_QwtLegendItem
+*/
+Plot2d_QwtLegendItem::~Plot2d_QwtLegendItem()
+{
+}
+
+/*!
+ Set Y axis identifier displaying mode
+*/
+void Plot2d_QwtLegendItem::setYAxisIdentifierMode( const int theMode )
+{
+ myYAxisIdentifierMode = theMode;
+ setSpacing( theMode == IM_None ? mySpacingCollapsed : mySpacingExpanded );
+}
+
+/*!
+ Redefined method of drawing identifier of legend item
+*/
+void Plot2d_QwtLegendItem::drawIdentifier( QPainter* painter, const QRect& rect ) const
+{
+ QwtLegendItem::drawIdentifier( painter, rect );
+
+ if( myYAxisIdentifierMode != IM_None ) {
+ QPixmap aPixmap( myYAxisIdentifierMode == IM_Left ? yAxisLeft : yAxisRight );
+ painter->save();
+ painter->drawPixmap( rect.topRight() + QPoint( mySpacingExpanded/2, mySpacingExpanded/2 ), aPixmap );
+ painter->restore();
+ }
+}
+
+/*!
+ Constructor of Plot2d_QwtPlotCurve
+*/
+Plot2d_QwtPlotCurve::Plot2d_QwtPlotCurve( const QString& title,
+ QwtPlot::Axis yAxis /*const int index*/ ) :
+ QwtPlotCurve( title ),
+ myYAxis( yAxis ),
+ myYAxisIdentifierEnabled( false )
+{
+}
+
+/*!
+ Destructor of Plot2d_QwtPlotCurve
+*/
+Plot2d_QwtPlotCurve::~Plot2d_QwtPlotCurve()
+{
+}
+
+/*!
+ Enable / disable Y axis identifier
+*/
+void Plot2d_QwtPlotCurve::setYAxisIdentifierEnabled( const bool on )
+{
+ myYAxisIdentifierEnabled = on;
+}
+
+/*!
+ Redefined method, which updates legend of the curve
+*/
+void Plot2d_QwtPlotCurve::updateLegend( QwtLegend* legend ) const
+{
+ QwtPlotCurve::updateLegend( legend );
+
+ QWidget* widget = legend->find( this );
+ if( Plot2d_QwtLegendItem* anItem = dynamic_cast<Plot2d_QwtLegendItem*>( widget ) ) {
+ int aMode = Plot2d_QwtLegendItem::IM_None;
+ if( myYAxisIdentifierEnabled )
+ aMode = myYAxis == QwtPlot::yRight ?
+ Plot2d_QwtLegendItem::IM_Right :
+ Plot2d_QwtLegendItem::IM_Left;
+ anItem->setYAxisIdentifierMode( aMode );
+ }
+}
+
+/*!
+ Redefined method, which creates and returns legend item of the curve
+*/
+QWidget* Plot2d_QwtPlotCurve::legendItem() const
+{
+ return new Plot2d_QwtLegendItem;
+}
#include <QWidget>
#include <QMultiHash>
#include <QList>
+#include <qwt_legend_item.h>
+#include <qwt_plot_curve.h>
#include <qwt_symbol.h>
#include <qwt_scale_draw.h>
CurveDict& getCurves() { return myCurves; }
Plot2d_Curve* getClosestCurve( QPoint p, double& distance, int& index );
+ virtual void updateYAxisIdentifiers();
+
public slots:
virtual void polish();
int myPrecision;
};
+class Plot2d_QwtLegendItem : public QwtLegendItem
+{
+public:
+ enum YAxisIdentifierMode { IM_None = 0, IM_Left, IM_Right };
+
+public:
+ Plot2d_QwtLegendItem( QWidget* = 0 );
+ virtual ~Plot2d_QwtLegendItem();
+
+public:
+ void setYAxisIdentifierMode( const int );
+
+protected:
+ virtual void drawIdentifier( QPainter*, const QRect& ) const;
+
+private:
+ int myYAxisIdentifierMode;
+ QPixmap myYAxisLeftIcon;
+ QPixmap myYAxisRightIcon;
+ int mySpacingCollapsed;
+ int mySpacingExpanded;
+};
+
+class Plot2d_QwtPlotCurve : public QwtPlotCurve
+{
+public:
+ Plot2d_QwtPlotCurve( const QString&, QwtPlot::Axis = QwtPlot::yLeft );
+ virtual ~Plot2d_QwtPlotCurve();
+
+public:
+ virtual void setYAxisIdentifierEnabled( const bool );
+
+protected:
+ virtual void updateLegend( QwtLegend* ) const;
+ virtual QWidget* legendItem() const;
+
+private:
+ QwtPlot::Axis myYAxis;
+ bool myYAxisIdentifierEnabled;
+};
+
#endif
myUserIds = ids;
myUserNames = names;
- unitSystemChanged( "" );
+ //unitSystemChanged( "" );
}
/*!
if( labStr.isNull() )
labStr = toQString( myDicItem->GetId() );
}
- if( myTr )
+ if( myTr && labStr.length()>0 )
{
QString dest = QApplication::translate( "QDS", labStr.toLatin1().constData() );
if( labStr != dest )
delNodes.append( *it );
}
+ QWidget* mW = menuWidget( pNode );
for ( NodeList::iterator itr = delNodes.begin(); itr != delNodes.end(); ++itr )
+ {
+ int id = (*itr)->id;
+ if( mW && menuAction( id ) )
+ {
+ mW->removeAction( menuAction( id ) );
+ myMenus.remove( id );
+ }
+ else if( mW && itemAction( id ) )
+ mW->removeAction( itemAction( id ) );
pNode->children.removeAll( *itr );
+ }
triggerUpdate( pNode->id, false );
}
for ( NodeList::const_iterator iter = node->children.begin(); iter != node->children.end(); ++iter )
{
QAction* mya = itemAction( (*iter)->id );
- if ( !mya ) mya = menuAction( (*iter)->id );
- if ( mya && mya == a ) return true;
+ if ( !mya )
+ mya = menuAction( (*iter)->id );
+ if ( mya && mya == a )
+ return true;
}
return false;
}
: QComboBox( parent ),
myCleared( false )
{
- connect( this, SIGNAL( activated( int ) ), this, SLOT( onActivated( int ) ) );
connect( this, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onCurrentChanged( int ) ) );
setModel( new Model( this ) );
}
lineEdit()->setText( "" );
}
-/*!
- \brief Called when any item is activated by the user.
- \param idx activated item index
-*/
-void QtxComboBox::onActivated( int idx )
-{
- resetClear();
- emit activatedId( id( idx ) );
-}
-
/*!
\brief Called when current item is chaned (by the user or programmatically).
\param idx item being set current
void QtxComboBox::onCurrentChanged( int idx )
{
if ( idx != -1 )
+ {
resetClear();
+ emit activatedId( id( idx ) );
+ }
}
/*!
void activatedId( int );
private slots:
- void onActivated( int );
void onCurrentChanged( int );
protected:
\param wf dialog box flags (Qt::WindowFlags)
*/
QtxDialog::QtxDialog( QWidget* parent, bool modal, bool allowResize, const int f, Qt::WindowFlags wf )
-: QDialog( parent, (Qt::WindowFlags)( wf | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint | Qt::Dialog |
+: QDialog( parent, (Qt::WindowFlags)( wf | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::Dialog |
#ifdef WIN32
( allowResize ? 0 : Qt::FramelessWindowHint ) |
#endif
#include <QLineEdit>
#include <QDoubleValidator>
+#include <limits>
+
/*!
\class QtxDoubleSpinBox
\brief Enhanced version of the Qt's double spin box.
... // process entered value
}
\endcode
+
+ Another useful feature is possibility to use scientific notation (e.g. 1.234e+18)
+ for the widegt text. To enable this, negative precision should be specified either
+ through a constructor or using setPrecision() method.
+
+ Note that "decimals" property of QDoubleSpinBox is almost completely substituted
+ by "myPrecision" field of QtxDoubleSpinBox class. "decimals" is still used
+ for proper size hint calculation and for rounding minimum and maximum bounds of
+ the spin box range.
*/
/*!
\brief Constructor.
Constructs a spin box with specified minimum, maximum and step value.
- The precision is set to 2 decimal places.
+ The precision is set to <prec> decimal places.
The value is initially set to the minimum value.
\param min spin box minimum possible value
\param max spin box maximum possible value
\param step spin box increment/decrement value
+ \param prec non-negative values means the number of digits after the decimal point,
+ negative value means the maximum number of significant digits for the scientific notation
+ \param dec number of digits after the decimal point passed to base Qt class (used for correct control sizing only!)
\param parent parent object
*/
QtxDoubleSpinBox::QtxDoubleSpinBox( double min, double max, double step, int prec, int dec, QWidget* parent )
*/
QString QtxDoubleSpinBox::textFromValue( double val ) const
{
- QString s = QLocale().toString( val, myPrecision >= 0 ? 'f' : 'g', myPrecision == 0 ? 6 : qAbs( myPrecision ) );
+ QString s = QLocale().toString( val, myPrecision >= 0 ? 'f' : 'g', qAbs( myPrecision ) );
return removeTrailingZeroes( s );
}
*/
QValidator::State QtxDoubleSpinBox::validate( QString& str, int& pos ) const
{
- if (myPrecision >= 0)
- return QDoubleSpinBox::validate(str, pos);
-
QString pref = this->prefix();
QString suff = this->suffix();
uint overhead = pref.length() + suff.length();
QValidator::State state = QValidator::Invalid;
-
+
QDoubleValidator v (NULL);
- v.setDecimals( decimals() );
+
+ // If 'g' format is used (myPrecision < 0), then
+ // myPrecision - 1 digits are allowed after the decimal point.
+ // Otherwise, expect myPrecision digits after the decimal point.
+ int decs = myPrecision < 0 ? qAbs( myPrecision ) - 1 : myPrecision;
+
+ v.setDecimals( decs );
v.setBottom( minimum() );
v.setTop( maximum() );
- v.setNotation( QDoubleValidator::ScientificNotation );
+ v.setNotation( myPrecision >= 0 ? QDoubleValidator::StandardNotation :
+ QDoubleValidator::ScientificNotation );
if ( overhead == 0 )
state = v.validate( str, pos );
}
}
}
+
+ // Treat values ouside (min; max) range as Invalid
+ if ( state == QValidator::Intermediate ){
+ bool isOk;
+ double val = str.toDouble( &isOk );
+ if ( isOk ){
+ if ( val < minimum() || val > maximum() )
+ state = QValidator::Invalid;
+ }
+ else if ( myPrecision < 0 ){
+ // Consider too large negative exponent as Invalid
+ QChar e( QLocale().exponential() );
+ int epos = str.indexOf( e, 0, Qt::CaseInsensitive );
+ if ( epos != -1 ){
+ epos++; // Skip exponential symbol itself
+ QString exponent = str.right( str.length() - epos );
+ int expValue = exponent.toInt( &isOk );
+ if ( isOk && expValue < std::numeric_limits<double>::min_exponent10 )
+ state = QValidator::Invalid;
+ }
+ }
+ }
+
return state;
}
#include <QApplication>
#include <QDateTimeEdit>
#include <QStackedWidget>
+#include <QSlider>
#include <stdio.h>
myEditor->setValidator( val );
}
+/*!
+ \class QtxPagePrefSliderItem
+*/
+
+/*!
+ \brief Constructor.
+
+ Creates preference item with slider widget
+
+ \param title preference item title
+ \param parent parent preference item
+ \param sect resource file section associated with the preference item
+ \param param resource file parameter associated with the preference item
+*/
+QtxPagePrefSliderItem::QtxPagePrefSliderItem( const QString& title, QtxPreferenceItem* parent,
+ const QString& sect, const QString& param )
+: QtxPageNamedPrefItem( title, parent, sect, param )
+{
+ setControl( mySlider = new QSlider( Qt::Horizontal ) );
+ mySlider->setTickPosition( QSlider::TicksBothSides );
+
+ updateSlider();
+}
+
+/*!
+ \brief Destructor.
+*/
+QtxPagePrefSliderItem::~QtxPagePrefSliderItem()
+{
+}
+
+/*!
+ \brief Get slider preference item step value.
+ \return slider single step value
+ \sa setSingleStep()
+*/
+int QtxPagePrefSliderItem::singleStep() const
+{
+ return mySlider->singleStep();
+}
+
+/*!
+ \brief Get slider preference item step value.
+ \return slider page step value
+ \sa setPageStep()
+*/
+int QtxPagePrefSliderItem::pageStep() const
+{
+ return mySlider->pageStep();
+}
+
+/*!
+ \brief Get slider preference item minimum value.
+ \return slider minimum value
+ \sa setMinimum()
+*/
+int QtxPagePrefSliderItem::minimum() const
+{
+ return mySlider->minimum();
+}
+
+/*!
+ \brief Get slider preference item maximum value.
+ \return slider maximum value
+ \sa setMaximum()
+*/
+int QtxPagePrefSliderItem::maximum() const
+{
+ return mySlider->maximum();
+}
+
+/*!
+ \brief Set slider preference item step value.
+ \param step new slider single step value
+ \sa step()
+*/
+void QtxPagePrefSliderItem::setSingleStep( const int& step )
+{
+ mySlider->setSingleStep( step );
+}
+
+/*!
+ \brief Set slider preference item step value.
+ \param step new slider single step value
+ \sa step()
+*/
+void QtxPagePrefSliderItem::setPageStep( const int& step )
+{
+ mySlider->setPageStep( step );
+}
+
+/*!
+ \brief Set slider preference item minimum value.
+ \param min new slider minimum value
+ \sa minimum()
+*/
+void QtxPagePrefSliderItem::setMinimum( const int& min )
+{
+ mySlider->setMinimum( min );
+}
+
+/*!
+ \brief Set slider preference item maximum value.
+ \param min new slider maximum value
+ \sa maximum()
+*/
+void QtxPagePrefSliderItem::setMaximum( const int& max )
+{
+ mySlider->setMaximum( max );
+}
+
+/*!
+ \brief Store preference item to the resource manager.
+ \sa retrieve()
+*/
+void QtxPagePrefSliderItem::store()
+{
+ setInteger( mySlider->value() );
+}
+
+/*!
+ \brief Retrieve preference item from the resource manager.
+ \sa store()
+*/
+void QtxPagePrefSliderItem::retrieve()
+{
+ mySlider->setValue( getInteger( mySlider->value() ) );
+}
+
+/*!
+ \brief Get preference item option value.
+ \param name option name
+ \return property value or null integer if option is not set
+ \sa setOptionValue()
+*/
+QVariant QtxPagePrefSliderItem::optionValue( const QString& name ) const
+{
+ if ( name == "minimum" || name == "min" )
+ return minimum();
+ else if ( name == "maximum" || name == "max" )
+ return maximum();
+ else if ( name == "single_step" )
+ return singleStep();
+ else if ( name == "page_step" )
+ return pageStep();
+ else
+ return QtxPageNamedPrefItem::optionValue( name );
+}
+
+/*!
+ \brief Set preference item option value.
+ \param name option name
+ \param val new property value
+ \sa optionValue()
+*/
+void QtxPagePrefSliderItem::setOptionValue( const QString& name, const QVariant& val )
+{
+ if ( val.canConvert( QVariant::Int ) )
+ {
+ if ( name == "minimum" || name == "min" )
+ setMinimum( val.toInt() );
+ else if ( name == "maximum" || name == "max" )
+ setMaximum( val.toInt() );
+ else if ( name == "single_step" )
+ setSingleStep( val.toInt() );
+ else if ( name == "page_step" )
+ setPageStep( val.toInt() );
+ else
+ QtxPageNamedPrefItem::setOptionValue( name, val );
+ }
+ else
+ QtxPageNamedPrefItem::setOptionValue( name, val );
+}
+
+/*!
+ \brief Update slider widget.
+*/
+void QtxPagePrefSliderItem::updateSlider()
+{
+ int val = mySlider->value();
+ int stp = singleStep();
+ int ptp = pageStep();
+ int min = minimum();
+ int max = maximum();
+
+ control()->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+ mySlider->setFocusPolicy(Qt::StrongFocus);
+
+ mySlider->setValue( val );
+ setSingleStep( stp );
+ setPageStep( ptp );
+ setMinimum( min );
+ setMaximum( max );
+}
+
/*!
\class QtxPagePrefSelectItem
\brief GUI implementation of the resources selector item
class QFileDialog;
class QDateTimeEdit;
class QStackedWidget;
+class QSlider;
class QTX_EXPORT QtxPagePrefMgr : public QFrame, public QtxPreferenceMgr
{
QLineEdit* myEditor;
};
+class QTX_EXPORT QtxPagePrefSliderItem : public QtxPageNamedPrefItem
+{
+public:
+ QtxPagePrefSliderItem( const QString&, QtxPreferenceItem* = 0,
+ const QString& = QString(), const QString& = QString() );
+ virtual ~QtxPagePrefSliderItem();
+
+ int singleStep() const;
+ int pageStep() const;
+ int minimum() const;
+ int maximum() const;
+
+ void setSingleStep( const int& );
+ void setPageStep( const int& );
+ void setMinimum( const int& );
+ void setMaximum( const int& );
+
+ virtual void store();
+ virtual void retrieve();
+
+protected:
+ virtual QVariant optionValue( const QString& ) const;
+ virtual void setOptionValue( const QString&, const QVariant& );
+
+private:
+ void updateSlider();
+
+private:
+ QSlider* mySlider;
+};
+
class QTX_EXPORT QtxPagePrefSelectItem : public QtxPageNamedPrefItem
{
public:
case Integer:
item = new QtxPagePrefEditItem( QtxPagePrefEditItem::Integer, title, parent, sect, param );
break;
+ case Slider:
+ item = new QtxPagePrefSliderItem( title, parent, sect, param );
+ break;
case GroupBox:
item = new QtxPagePrefGroupItem( title, parent, sect, param );
break;
public:
typedef enum { Auto, Space, Bool, Color, String, Selector,
DblSpin, IntSpin, Double, Integer,
- GroupBox, Tab, Frame, Font, DirList, File } PrefItemType;
+ GroupBox, Tab, Frame, Font, DirList, File, Slider } PrefItemType;
public:
SUIT_PreferenceMgr( QtxResourceMgr*, QWidget* = 0 );
void SUIT_TreeModel::setAppropriate( const QString& name, const Qtx::Appropriate appr )
{
for( int i=0, n=myColumns.size(); i<n; i++ )
- if( myColumns[i].myName==name || myColumns[i].myAppropriate != appr )
+ if( myColumns[i].myName==name && myColumns[i].myAppropriate != appr )
{
myColumns[i].myAppropriate = appr;
emit headerDataChanged( Qt::Horizontal, i, i );
lib_LTLIBRARIES = libSUITApp.la
salomeinclude_HEADERS = \
- SUITApp_Application.h \
- SUITApp_init_python.hxx
+ SUITApp_Application.h
dist_libSUITApp_la_SOURCES = \
SUITApp.cxx \
- SUITApp_Application.cxx \
- SUITApp_init_python.cxx
+ SUITApp_Application.cxx
+
+if ENABLE_PYCONSOLE
+ salomeinclude_HEADERS += SUITApp_init_python.hxx
+ dist_libSUITApp_la_SOURCES += SUITApp_init_python.cxx
+endif
MOC_FILES = \
SUITApp_Application_moc.cxx
libSUITApp_la_LIBADD = ../Qtx/libqtx.la ../SUIT/libsuit.la ../Style/libSalomeStyle.la
if ENABLE_PYCONSOLE
-libSUITApp_la_LDFLAGS += -Xlinker -export-dynamic $(PYTHON_LIBS)
-AM_CPPFLAGS+=-DSUIT_ENABLE_PYTHON
+ libSUITApp_la_LDFLAGS += -Xlinker -export-dynamic $(PYTHON_LIBS)
endif
# Executable
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#if defined WIN32
+//#if defined WIN32
-#ifdef SUIT_ENABLE_PYTHON
-#undef SUIT_ENABLE_PYTHON
-#endif
+//#ifdef SUIT_ENABLE_PYTHON
+//#undef SUIT_ENABLE_PYTHON
+//#endif
-#else //#if defined WIN32
+//#else //#if defined WIN32
-#ifndef SUIT_ENABLE_PYTHON
+//#ifndef SUIT_ENABLE_PYTHON
// NOTE: DO NOT DELETE THIS DEFINITION ON LINUX
// or make sure Python is initialized in main() in any case
// Otherwise, application based on light SALOME and using Python
// are unlikely to work properly.
-#define SUIT_ENABLE_PYTHON
-#include <Python.h>
-#endif
+//#define SUIT_ENABLE_PYTHON
+//#include <Python.h>
+//#endif
#ifdef SUIT_ENABLE_PYTHON
#include "SUITApp_init_python.hxx"
#endif
-#endif //#if defined WIN32
+//#endif //#if defined WIN32
#include "SUITApp_Application.h"
PyEval_RestoreThread( SUIT_PYTHON::_gtstate );
if ( !SUIT_PYTHON::salome_shared_modules_module ) // import only once
- SUIT_PYTHON::salome_shared_modules_module = PyImport_ImportModule( "salome_shared_modules" );
+ SUIT_PYTHON::salome_shared_modules_module = PyImport_ImportModule( (char*)"salome_shared_modules" );
if ( !SUIT_PYTHON::salome_shared_modules_module )
PyErr_Print();
SALOME_Actor
::AddToRender(vtkRenderer* theRenderer)
{
- // these two actors have to be added first
- // for correct visualization of selection
- theRenderer->AddActor( myHighlightActor.GetPointer() );
- theRenderer->AddActor( myPreHighlightActor.GetPointer() );
-
Superclass::AddToRender(theRenderer);
myRenderer = theRenderer;
+ theRenderer->AddActor( myPreHighlightActor.GetPointer() );
+ theRenderer->AddActor( myHighlightActor.GetPointer() );
theRenderer->AddActor( myOutlineActor.GetPointer() );
theRenderer->AddActor( myNameActor.GetPointer() );
}
SALOME_Actor
::RemoveFromRender(vtkRenderer* theRenderer)
{
- theRenderer->RemoveActor( myHighlightActor.GetPointer() );
- theRenderer->RemoveActor( myPreHighlightActor.GetPointer() );
-
Superclass::RemoveFromRender(theRenderer);
+ theRenderer->RemoveActor( myPreHighlightActor.GetPointer() );
+ theRenderer->RemoveActor( myHighlightActor.GetPointer() );
theRenderer->RemoveActor( myOutlineActor.GetPointer() );
theRenderer->RemoveActor( myNameActor.GetPointer() );
}
#include <QKeyEvent>
#include <QLineEdit>
+#include <QToolTip>
+#include <QRegExp>
#include <string>
myDefaultValue( 0.0 ),
myIsRangeSet( false ),
myMinimum( 0.0 ),
- myMaximum( 99.99 )
+ myMaximum( 99.99 ),
+ myAcceptNames( true ),
+ myShowTip( true )
{
connectSignalsAndSlots();
}
myDefaultValue( 0.0 ),
myIsRangeSet( false ),
myMinimum( min ),
- myMaximum( max )
+ myMaximum( max ),
+ myAcceptNames( true ),
+ myShowTip( true )
{
connectSignalsAndSlots();
}
\param max spin box maximum possible value
\param step spin box increment/decrement value
\param parent parent object
+ \param acceptNames if true, enables variable names in the spin box
+ \param showTip if true, makes the widget show a tooltip when invalid text is entered by the user
*/
-SalomeApp_DoubleSpinBox::SalomeApp_DoubleSpinBox( double min, double max, double step, int prec, int dec, QWidget* parent )
+SalomeApp_DoubleSpinBox::SalomeApp_DoubleSpinBox( double min,
+ double max,
+ double step,
+ int prec,
+ int dec,
+ QWidget* parent,
+ bool acceptNames,
+ bool showTip )
: QtxDoubleSpinBox( min, max, step, prec, dec, parent ),
myDefaultValue( 0.0 ),
myIsRangeSet( false ),
myMinimum( min ),
- myMaximum( max )
+ myMaximum( max ),
+ myAcceptNames( acceptNames ),
+ myShowTip( showTip )
{
connectSignalsAndSlots();
}
{
}
+/*!
+ \brief Perform \a steps increment/decrement steps.
+
+ Re-implemented to handle cases when Notebook variable
+ name is specified by the user as the widget text.
+ Otherwise, simply calls the base implementation.
+
+ \param steps number of increment/decrement steps
+*/
+void SalomeApp_DoubleSpinBox::stepBy( int steps )
+{
+ QString str = text();
+ QString pref = prefix();
+ QString suff = suffix();
+
+ if ( pref.length() && str.startsWith( pref ) )
+ str = str.right( str.length() - pref.length() );
+ if ( suff.length() && str.endsWith( suff ) )
+ str = str.left( str.length() - suff.length() );
+
+ QRegExp varNameMask( "([a-z]|[A-Z]|_).*" );
+ if ( varNameMask.exactMatch( str ) )
+ return;
+
+ QtxDoubleSpinBox::stepBy( steps );
+}
+
/*!
\brief Connect signals and slots.
*/
*/
QValidator::State SalomeApp_DoubleSpinBox::validate( QString& str, int& pos ) const
{
- return QValidator::Acceptable;
+ QValidator::State res = QValidator::Invalid;
+
+ // Considering the input text as a variable name
+ // Applying Python identifier syntax:
+ // either a string starting with a letter, or a string starting with
+ // an underscore followed by at least one alphanumeric character
+ if ( isAcceptNames() ){
+ QRegExp varNameMask( "(([a-z]|[A-Z])([a-z]|[A-Z]|[0-9]|_)*)|(_([a-z]|[A-Z]|[0-9])+([a-z]|[A-Z]|[0-9]|_)*)" );
+ if ( varNameMask.exactMatch( str ) )
+ res = QValidator::Acceptable;
+
+ if ( res == QValidator::Invalid ){
+ varNameMask.setPattern( "_" );
+ if ( varNameMask.exactMatch( str ) )
+ res = QValidator::Intermediate;
+ }
+ }
+
+ // Trying to interpret the current input text as a numeric value
+ if ( res == QValidator::Invalid )
+ res = QtxDoubleSpinBox::validate( str, pos );
+
+ // Show tooltip in case of invalid manual input
+ if ( isShowTipOnValidate() && lineEdit()->hasFocus() ){
+ if ( res != QValidator::Acceptable ){ // san: do we need to warn the user in Intermediate state???
+ SalomeApp_DoubleSpinBox* that = const_cast<SalomeApp_DoubleSpinBox*>( this );
+ QPoint pos( size().width(), 0. );
+ QPoint globalPos = mapToGlobal( pos );
+ QString minVal = textFromValue( minimum() );
+ QString maxVal = textFromValue( maximum() );
+
+ // Same stuff as in QtxDoubleSpinBox::textFromValue()
+ int digits = getPrecision();
+
+ // For 'g' format, max. number of digits after the decimal point is getPrecision() - 1
+ // See also QtxDoubleSpinBox::validate()
+ if ( digits < 0 )
+ digits = qAbs( digits ) - 1;
+
+ QString templ( isAcceptNames() ? tr( "VALID_RANGE_VAR_MSG" ) : tr( "VALID_RANGE_NOVAR_MSG" ) );
+ QString msg( templ.arg( minVal ).arg( maxVal ).arg( digits ) );
+
+ // Add extra hints to the message (if any passed through dynamic properties)
+ QVariant propVal = property( "validity_tune_hint" );
+ if ( propVal.isValid() ){
+ QString extraInfo = propVal.toString();
+ if ( !extraInfo.isEmpty() ){
+ msg += "\n";
+ msg += extraInfo;
+ }
+ }
+
+ QToolTip::showText( globalPos,
+ msg,
+ that );
+ }
+ else
+ QToolTip::hideText();
+ }
+
+ return res;
}
/*!
{
setText( myTextValue );
}
+
+/*!
+ \brief Enables or disables variable names in the spin box.
+ By default, variable names are enabled.
+ \param flag If true, variable names are enabled.
+*/
+void SalomeApp_DoubleSpinBox::setAcceptNames( const bool flag )
+{
+ myAcceptNames = flag;
+}
+
+/*!
+ \brief Returns true if the spin box accepts variable names.
+*/
+bool SalomeApp_DoubleSpinBox::isAcceptNames() const
+{
+ return myAcceptNames;
+}
+
+/*!
+ \brief Enables or disables tooltips in case of invalid or intermediate-state input.
+ Tooltips are enabled by default.
+ \param flag If true, tooltips are enabled.
+*/
+void SalomeApp_DoubleSpinBox::setShowTipOnValidate( const bool flag )
+{
+ myShowTip = myShowTip;
+}
+
+/*!
+ \brief Returns true if tooltip should be shown in case of invalid or intermediate-state input.
+*/
+bool SalomeApp_DoubleSpinBox::isShowTipOnValidate() const
+{
+ return myShowTip;
+}
public:
SalomeApp_DoubleSpinBox( QWidget* = 0 );
SalomeApp_DoubleSpinBox( double, double, double = 1, QWidget* = 0 );
- SalomeApp_DoubleSpinBox( double, double, double, int, int, QWidget* = 0 );
+ SalomeApp_DoubleSpinBox( double, double, double, int, int, QWidget* = 0, bool = true, bool = true );
virtual ~SalomeApp_DoubleSpinBox();
+ virtual void stepBy( int );
+
virtual double valueFromText( const QString& ) const;
virtual QString textFromValue( double ) const;
virtual void setText(const QString& );
+ void setAcceptNames( const bool );
+ bool isAcceptNames() const;
+
+ void setShowTipOnValidate( const bool );
+ bool isShowTipOnValidate() const;
+
signals:
void textChanged( const QString& );
QString myCorrectValue;
QString myTextValue;
+
+ bool myAcceptNames;
+ bool myShowTip;
};
#endif
#include <QKeyEvent>
#include <QLineEdit>
+#include <QToolTip>
+#include <QRegExp>
#include <string>
*/
SalomeApp_IntSpinBox::SalomeApp_IntSpinBox( QWidget* parent )
: QtxIntSpinBox( parent ),
- myDefaultValue( 0 )
+ myDefaultValue( 0 ),
+ myAcceptNames( true ),
+ myShowTip( true )
{
connectSignalsAndSlots();
}
\param max spin box maximum possible value
\param step spin box increment/decrement value
\param parent parent object
+ \param acceptNames if true, enables variable names in the spin box
+ \param showTip if true, makes the widget show a tooltip when invalid text is entered by the user
*/
-SalomeApp_IntSpinBox::SalomeApp_IntSpinBox( int min, int max, int step, QWidget* parent )
+SalomeApp_IntSpinBox::SalomeApp_IntSpinBox( int min,
+ int max,
+ int step,
+ QWidget* parent,
+ bool acceptNames,
+ bool showTip )
: QtxIntSpinBox( min, max, step, parent ),
- myDefaultValue( 0 )
+ myDefaultValue( 0 ),
+ myAcceptNames( acceptNames ),
+ myShowTip( showTip )
{
connectSignalsAndSlots();
}
{
}
+
+/*!
+ \brief Perform \a steps increment/decrement steps.
+
+ Re-implemented to handle cases when Notebook variable
+ name is specified by the user as the widget text.
+ Otherwise, simply calls the base implementation.
+
+ \param steps number of increment/decrement steps
+*/
+void SalomeApp_IntSpinBox::stepBy( int steps )
+{
+ QString str = text();
+ QString pref = prefix();
+ QString suff = suffix();
+
+ if ( pref.length() && str.startsWith( pref ) )
+ str = str.right( str.length() - pref.length() );
+ if ( suff.length() && str.endsWith( suff ) )
+ str = str.left( str.length() - suff.length() );
+
+ QRegExp varNameMask( "([a-z]|[A-Z]|_).*" );
+ if ( varNameMask.exactMatch( str ) )
+ return;
+
+ QtxIntSpinBox::stepBy( steps );
+}
+
/*!
\brief Connect signals and slots.
*/
*/
QValidator::State SalomeApp_IntSpinBox::validate( QString& str, int& pos ) const
{
- return QValidator::Acceptable;
+ //return QValidator::Acceptable;
+ QValidator::State res = QValidator::Invalid;
+
+ // Considering the input text as a variable name
+ // Applying Python identifier syntax:
+ // either a string starting with a letter, or a string starting with
+ // an underscore followed by at least one alphanumeric character
+ if ( isAcceptNames() ){
+ QRegExp varNameMask( "(([a-z]|[A-Z])([a-z]|[A-Z]|[0-9]|_)*)|(_([a-z]|[A-Z]|[0-9])+([a-z]|[A-Z]|[0-9]|_)*)" );
+ if ( varNameMask.exactMatch( str ) )
+ res = QValidator::Acceptable;
+
+ if ( res == QValidator::Invalid ){
+ varNameMask.setPattern( "_" );
+ if ( varNameMask.exactMatch( str ) )
+ res = QValidator::Intermediate;
+ }
+ }
+
+ // Trying to interpret the current input text as a numeric value
+ if ( res == QValidator::Invalid )
+ res = QtxIntSpinBox::validate( str, pos );
+
+ // Show tooltip in case of invalid manual input
+ if ( isShowTipOnValidate() && lineEdit()->hasFocus() ){
+ if ( res != QValidator::Acceptable ){ // san: do we need to warn the user in Intermediate state???
+ SalomeApp_IntSpinBox* that = const_cast<SalomeApp_IntSpinBox*>( this );
+ QPoint pos( size().width(), 0. );
+ QPoint globalPos = mapToGlobal( pos );
+ QString minVal = textFromValue( minimum() );
+ QString maxVal = textFromValue( maximum() );
+
+ QString templ( isAcceptNames() ? tr( "VALID_RANGE_VAR_MSG" ) : tr( "VALID_RANGE_NOVAR_MSG" ) );
+ QString msg( templ.arg( minVal ).arg( maxVal ) );
+
+ // Add extra hints to the message (if any passed through dynamic properties)
+ QVariant propVal = property( "validity_tune_hint" );
+ if ( propVal.isValid() ){
+ QString extraInfo = propVal.toString();
+ if ( !extraInfo.isEmpty() ){
+ msg += "\n";
+ msg += extraInfo;
+ }
+ }
+
+ QToolTip::showText( globalPos,
+ msg,
+ that );
+ }
+ else
+ QToolTip::hideText();
+ }
+
+ return res;
}
/*!
{
setText( myTextValue );
}
+
+/*!
+ \brief Enables or disables variable names in the spin box.
+ By default, variable names are enabled.
+ \param flag If true, variable names are enabled.
+*/
+void SalomeApp_IntSpinBox::setAcceptNames( const bool flag )
+{
+ myAcceptNames = flag;
+}
+
+/*!
+ \brief Returns true if the spin box accepts variable names.
+*/
+bool SalomeApp_IntSpinBox::isAcceptNames() const
+{
+ return myAcceptNames;
+}
+
+/*!
+ \brief Enables or disables tooltips in case of invalid or intermediate-state input.
+ Tooltips are enabled by default.
+ \param flag If true, tooltips are enabled.
+*/
+void SalomeApp_IntSpinBox::setShowTipOnValidate( const bool flag )
+{
+ myShowTip = myShowTip;
+}
+
+/*!
+ \brief Returns true if tooltip should be shown in case of invalid or intermediate-state input.
+*/
+bool SalomeApp_IntSpinBox::isShowTipOnValidate() const
+{
+ return myShowTip;
+}
public:
SalomeApp_IntSpinBox( QWidget* = 0 );
- SalomeApp_IntSpinBox( int, int, int = 1, QWidget* = 0 );
+ SalomeApp_IntSpinBox( int, int, int = 1, QWidget* = 0, bool = true, bool = true );
virtual ~SalomeApp_IntSpinBox();
+ virtual void stepBy( int );
+
virtual int valueFromText( const QString& ) const;
virtual QString textFromValue( int ) const;
virtual void setText(const QString& );
+ void setAcceptNames( const bool );
+ bool isAcceptNames() const;
+
+ void setShowTipOnValidate( const bool );
+ bool isShowTipOnValidate() const;
+
signals:
void textChanged( const QString& );
QString myCorrectValue;
QString myTextValue;
+
+ bool myAcceptNames;
+ bool myShowTip;
};
#endif
<translation>Failed to update study!</translation>
</message>
</context>
+<context>
+ <name>SalomeApp_DoubleSpinBox</name>
+ <message>
+ <source>VALID_RANGE_VAR_MSG</source>
+ <translation>Specify either a variable name or
+a floating-point value in range ( %1; %2 )
+with %3-digit precision</translation>
+ </message>
+ <message>
+ <source>VALID_RANGE_NOVAR_MSG</source>
+ <translation>Specify a floating-point value in range ( %1; %2 )
+with %3-digit precision</translation>
+ </message>
+</context>
+<context>
+ <name>SalomeApp_IntSpinBox</name>
+ <message>
+ <source>VALID_RANGE_VAR_MSG</source>
+ <translation>Specify either a variable name or
+an integer value in range ( %1; %2 )</translation>
+ </message>
+ <message>
+ <source>VALID_RANGE_NOVAR_MSG</source>
+ <translation>Specify an integer value in range ( %1; %2 )</translation>
+ </message>
+</context>
</TS>
- sg : the SALOME Swig interface
- studyId : the SALOME studyId that must be used to execute the plugin
- study : the SALOME study object that must be used to execute the plugin
+
"""
import os,sys,traceback
for directory in pluginspath.split(SEP):
self.plugindirs.append(directory)
- self.menu=QtGui.QMenu("Plugins",sgPyQt.getPopupMenu(SalomePyQt.Tools))
+ basemenu=sgPyQt.getPopupMenu("Tools")
+ self.menu=QtGui.QMenu("Plugins",basemenu)
+ basemenu.addMenu(self.menu)
+
+ #a=QtGui.QAction("Plugins",basemenu)
+ #a.setMenu(self.menu)
+ #mid=sgPyQt.createMenu(a,"Tools")
+
self.menu.connect(self.menu,QtCore.SIGNAL("aboutToShow()"),self.importPlugins)
def AddFunction(self,name,description,script,script_type=None):
plugins_files=[]
for directory in self.plugindirs:
- salome_plugins_file = os.path.join(directory,"salome_plugins.py")
- if os.path.isfile(salome_plugins_file):
- plugins_files.append((directory,salome_plugins_file))
- lasttime=max(lasttime,os.path.getmtime(salome_plugins_file))
+ plugins_file = os.path.join(directory,"salome_plugins.py")
+ if os.path.isfile(plugins_file):
+ plugins_files.append((directory,plugins_file))
+ lasttime=max(lasttime,os.path.getmtime(plugins_file))
plugins_files.sort()
except:
print "Error while loading plugins from file:",salome_plugins_file
traceback.print_exc()
+
self.updateMenu()
def updateMenu(self):
"""Update the Plugins menu"""
self.menu.clear()
for name,handler in self.handlers.items():
- act=self.menu.addAction(name,handler)
+ act=self.menu.addAction(name,handler)
def activate(self):
"""Add the Plugins menu to the Tools menu"""
- tools_menu= sgPyQt.getPopupMenu(SalomePyQt.Tools)
- tools_menu.addMenu(self.menu)
+ #tools_menu= sgPyQt.getPopupMenu(SalomePyQt.Tools)
+ #tools_menu.addMenu(self.menu)
def deactivate(self):
"""Remove the Plugins menu from Tools menu (not implemented)"""
#include <SUIT_Desktop.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_ExceptionHandler.h>
+#ifndef WIN32
+#include <unistd.h>
+#endif
+
+#include <stdexcept>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+typedef void (*sighandler_t)(int);
+sighandler_t setsig(int sig, sighandler_t handler)
+{
+ struct sigaction context, ocontext;
+ context.sa_handler = handler;
+ sigemptyset(&context.sa_mask);
+ context.sa_flags = 0;
+ if (sigaction(sig, &context, &ocontext) == -1)
+ return SIG_ERR;
+ return ocontext.sa_handler;
+}
+
+void AttachDebugger()
+{
+ if(getenv ("DEBUGGER"))
+ {
+ std::stringstream exec;
+ exec << "$DEBUGGER SALOME_Session_Server " << getpid() << "&";
+ std::cerr << exec.str() << std::endl;
+ system(exec.str().c_str());
+ while(1);
+ }
+}
+
+void Handler(int theSigId)
+{
+ std::cerr << "SIGSEGV: " << std::endl;
+ AttachDebugger();
+ //to exit or not to exit
+ exit(1);
+}
+void terminateHandler(void)
+{
+ std::cerr << "Terminate: not managed exception !" << std::endl;
+ AttachDebugger();
+}
+
+void unexpectedHandler(void)
+{
+ std::cerr << "Unexpected: unexpected exception !" << std::endl;
+ AttachDebugger();
+}
+
#include <Standard_Version.hxx>
// ---------------------------- MAIN -----------------------
int main( int argc, char **argv )
{
+ if(getenv ("DEBUGGER"))
+ {
+ setsig(SIGSEGV,&Handler);
+ setsig(SIGBUS,&Handler);
+ set_terminate(&terminateHandler);
+ set_unexpected(&unexpectedHandler);
+ }
+
// Install Qt debug messages handler
qInstallMsgHandler( MessageOutput );
glPushAttrib( GL_COLOR_BUFFER_BIT | GL_CURRENT_BIT | GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT | GL_LIGHTING_BIT );
- glDepthFunc( GL_LESS );
+ glDepthFunc( GL_LEQUAL );
glEnable( GL_DEPTH_TEST );
- glEnable( GL_BLEND );
- glBlendFunc( GL_SRC_ALPHA, GL_ONE );
-
glEnable( GL_ALPHA_TEST );
glAlphaFunc( GL_GREATER, 0.0 );