Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
25bf9810
Commit
25bf9810
authored
Aug 16, 2011
by
Anatoly Mihalchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JVM in widgets under Windows + Geogebra widget
parent
b4b5ecd8
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
186 additions
and
29 deletions
+186
-29
config.xml
resources/library/interactive/Geogebra.wgt/config.xml
+12
-0
icon.png
resources/library/interactive/Geogebra.wgt/icon.png
+0
-0
loading.gif
...urces/library/interactive/Geogebra.wgt/images/loading.gif
+0
-0
index.html
resources/library/interactive/Geogebra.wgt/index.html
+71
-0
UBAbstractWidget.cpp
src/domain/UBAbstractWidget.cpp
+41
-2
UBAbstractWidget.h
src/domain/UBAbstractWidget.h
+14
-11
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+2
-11
UBW3CWidget.cpp
src/domain/UBW3CWidget.cpp
+45
-5
UBToolWidget.cpp
src/gui/UBToolWidget.cpp
+1
-0
No files found.
resources/library/interactive/Geogebra.wgt/config.xml
0 → 100644
View file @
25bf9810
<?xml version="1.0" encoding="UTF-8"?>
<widget
xmlns=
"http://www.w3.org/ns/widgets"
xmlns:ub=
"http://uniboard.mnemis.com/widgets"
id=
"http://uniboard.mnemis.com/widgets/geogebra"
version=
"1.0"
width=
"800"
height=
"500"
ub:resizable=
"true"
ub:roles=
"tool cMAC cUNIX"
>
<name>
Geogebra
</name>
<content
src=
"index.html"
/>
</widget>
resources/library/interactive/Geogebra.wgt/icon.png
0 → 100644
View file @
25bf9810
2.51 KB
resources/library/interactive/Geogebra.wgt/images/loading.gif
0 → 100644
View file @
25bf9810
1.99 KB
resources/library/interactive/Geogebra.wgt/index.html
0 → 100644
View file @
25bf9810
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META
http-equiv=
Content-Type
content=
"text/html; charset=windows-1252"
>
<BODY>
<DIV
id=
applet1
></DIV>
<SCRIPT
type=
text/javascript
>
function ggbOnInit()
{
alert("Geogebra applet is initialized");
}
var width=0;
var height=0;
setWidthHeight();
if (height
<
500
)
height=
500;
if
(
width
<
800
)
width=
800;
var
applet1=
document.getElementById('applet1');
applet1
.
innerHTML=
geogebra_applet(0.95*width,height*0.95,"",true,true,true,false,true,true,true,true,true,true,true,true);
function
geogebra_applet
(
width
,
height
,
filename
,
framePossible
,
enableRightClick
,
enableShiftDragZoom
,
showResetIcon
,
showMenuBar
,
showToolBar
,
showToolBarHelp
,
showAlgebraInput
,
enableLabelDrags
,
showSpreadsheet
,
showAlgebraView
)
{
ret =
'<applet name="ggbApplet" code="geogebra.GeoGebraApplet" codebase="./bin/" archive="geogebra.jar" height="'
+
height
+'"
width=
"'+width+'"
>
';
ret +='
<param
name=
"image"
value=
"./images/loading.gif"
/><param
name=
"boxborder"
value=
"false"
/><param
name=
"centerimage"
value=
"true"
>
';
ret +='
<param
name=
"java_arguments"
value=
"-Xmx512m"
>
';
if (filename != "") ret+='
<param
name=
"filename"
value=
"'+filename+'"
>
';
ret+='
<param
name=
"framePossible"
value=
"'+framePossible+'"
>
';
ret+='
<param
name=
"enableRightClick"
value=
"'+enableRightClick+'"
>
';
ret+='
<param
name=
"enableShiftDragZoom"
value=
"'+enableShiftDragZoom+'"
>
';
ret+='
<param
name=
"enableLabelDrags"
value=
"'+enableLabelDrags+'"
>
';
ret+='
<param
name=
"showSpreadsheet"
value=
"'+showSpreadsheet+'"
>
';
ret+='
<param
name=
"showAlgebraView"
value=
"'+showAlgebraView+'"
>
';
ret+='
<param
name=
"showResetIcon"
value=
"'+showResetIcon+'"
>
';
ret+='
<param
name=
"showMenuBar"
value=
"'+showMenuBar+'"
>
';
ret+='
<param
name=
"showToolBar"
value=
"'+showToolBar+'"
>
';
ret+='
<param
name=
"showToolBarHelp"
value=
"'+showToolBarHelp+'"
>
';
ret+='
<param
name=
"showAlgebraInput"
value=
"'+showAlgebraInput+'"
>
';
ret+='Sorry, the GeoGebra Applet could not be started. Please make sure that Java 1.4.2 (or later) is installed and activated.';
ret+='(
<a
href=
"http://java.sun.com/getjava"
>
click here to install Java now
</a>
)';
ret+='
</applet>
';
return ret;
}
function setWidthHeight() {
var myWidth = 0, myHeight = 0;
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else if( document.documentElement
&&
( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
} else if( document.body
&&
( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight;
}
//window.alert( 'Width = ' + myWidth );
//window.alert( 'Height = ' + myHeight );
width=myWidth;
height=myHeight;
}
</SCRIPT>
</BODY></HTML>
src/domain/UBAbstractWidget.cpp
View file @
25bf9810
...
...
@@ -44,8 +44,8 @@ UBAbstractWidget::UBAbstractWidget(const QUrl& pWidgetUrl, QWidget *parent)
,
mInitialLoadDone
(
false
)
,
mLoadIsErronous
(
false
)
,
mIsFreezable
(
true
)
,
mCanBeContent
(
true
)
,
mCanBeTool
(
true
)
,
mCanBeContent
(
0
)
,
mCanBeTool
(
0
)
,
mIsFrozen
(
false
)
,
mIsTakingSnapshot
(
false
)
{
...
...
@@ -74,12 +74,51 @@ UBAbstractWidget::UBAbstractWidget(const QUrl& pWidgetUrl, QWidget *parent)
setMouseTracking
(
true
);
}
bool
UBAbstractWidget
::
canBeContent
()
{
// if we under MAC OS
#if defined(Q_OS_MAC)
return
mCanBeContent
&
OSType
::
type_MAC
;
#endif
// if we under UNIX OS
#if defined(Q_OS_UNIX)
return
mCanBeContent
&
OSType
::
type_UNIX
;
#endif
// if we under WINDOWS OS
#if defined(Q_OS_WIN)
return
mCanBeContent
&
OSType
::
type_WIN
;
#endif
}
bool
UBAbstractWidget
::
canBeTool
()
{
// if we under MAC OS
#if defined(Q_OS_MAC)
return
mCanBeTool
&
OSType
::
type_MAC
;
#endif
// if we under UNIX OS
#if defined(Q_OS_UNIX)
return
mCanBeTool
&
OSType
::
type_UNIX
;
#endif
// if we under WINDOWS OS
#if defined(Q_OS_WIN)
return
mCanBeTool
&
OSType
::
type_WIN
;
#endif
}
UBAbstractWidget
::~
UBAbstractWidget
()
{
// NOOP
}
void
UBAbstractWidget
::
loadMainHtml
()
{
QWebView
::
load
(
mMainHtmlUrl
);
}
bool
UBAbstractWidget
::
event
(
QEvent
*
event
)
{
...
...
src/domain/UBAbstractWidget.h
View file @
25bf9810
...
...
@@ -39,6 +39,8 @@ class UBAbstractWidget : public UBRoutedMouseEventWebView
UBAbstractWidget
(
const
QUrl
&
pWidgetUrl
,
QWidget
*
parent
=
0
);
virtual
~
UBAbstractWidget
();
void
loadMainHtml
();
QUrl
mainHtml
()
{
return
mMainHtmlUrl
;
...
...
@@ -64,15 +66,8 @@ class UBAbstractWidget : public UBRoutedMouseEventWebView
return
mNominalSize
;
}
bool
canBeContent
()
const
{
return
mCanBeContent
;
}
bool
canBeTool
()
const
{
return
mCanBeTool
;
}
bool
canBeContent
();
bool
canBeTool
();
bool
hasLoadedSuccessfully
()
const
{
...
...
@@ -123,8 +118,16 @@ class UBAbstractWidget : public UBRoutedMouseEventWebView
bool
mLoadIsErronous
;
bool
mIsFreezable
;
bool
mCanBeContent
;
bool
mCanBeTool
;
int
mCanBeContent
;
int
mCanBeTool
;
enum
OSType
{
type_NONE
=
0
,
// 0000
type_WIN
=
1
,
// 0001
type_MAC
=
2
,
// 0010
type_UNIX
=
4
,
// 0100
type_ALL
=
7
,
// 0111
};
virtual
void
injectInlineJavaScript
();
virtual
void
paintEvent
(
QPaintEvent
*
event
);
...
...
src/domain/UBGraphicsScene.cpp
View file @
25bf9810
...
...
@@ -1091,7 +1091,6 @@ void UBGraphicsScene::addGraphicsWidget(UBGraphicsWidgetItem* graphicsWidget, co
graphicsWidget
->
setFlag
(
QGraphicsItem
::
ItemIsSelectable
,
true
);
graphicsWidget
->
setZValue
(
getNextObjectZIndex
());
// QGraphicsScene::addWidget(graphicsWidget->widgetWebView());
addItem
(
graphicsWidget
);
qreal
ssf
=
1
/
UBApplication
::
boardController
->
systemScaleFactor
();
...
...
@@ -1103,21 +1102,13 @@ void UBGraphicsScene::addGraphicsWidget(UBGraphicsWidgetItem* graphicsWidget, co
if
(
graphicsWidget
->
widgetWebView
()
->
canBeContent
())
{
graphicsWidget
->
widgetWebView
()
->
loadMainHtml
();
graphicsWidget
->
setSelected
(
true
);
UBGraphicsItemUndoCommand
*
uc
=
new
UBGraphicsItemUndoCommand
(
this
,
0
,
graphicsWidget
);
UBApplication
::
undoStack
->
push
(
uc
);
setDocumentUpdated
();
// graphicsWidget->widgetWebView()->setParent(graphicsWidget->v));
// QObject *zz1= graphicsWidget->widgetWebView()->parent();
// QWidget *zz2= graphicsWidget->widgetWebView()->parentWidget();
//
// QObject *zz3= graphicsWidget->parent();
// QGraphicsWidget *zz4= graphicsWidget->parentWidget();
// graphicsWidget->widgetWebView()->loadUrl();
}
else
{
...
...
src/domain/UBW3CWidget.cpp
View file @
25bf9810
...
...
@@ -86,8 +86,51 @@ UBW3CWidget::UBW3CWidget(const QUrl& pWidgetUrl, QWidget *parent)
QString
roles
=
widgetElement
.
attribute
(
"ub:roles"
,
"content tool"
).
trimmed
().
toLower
();
mCanBeTool
=
roles
==
""
||
roles
.
contains
(
"tool"
);
mCanBeContent
=
roles
==
""
||
roles
.
contains
(
"content"
);
//------------------------------//
if
(
roles
==
""
||
roles
.
contains
(
"tool"
)
)
{
mCanBeTool
=
UBAbstractWidget
::
OSType
::
type_ALL
;
}
if
(
roles
.
contains
(
"twin"
)
)
{
mCanBeTool
|=
UBAbstractWidget
::
OSType
::
type_WIN
;
}
if
(
roles
.
contains
(
"tmac"
)
)
{
mCanBeTool
|=
UBAbstractWidget
::
OSType
::
type_MAC
;
}
if
(
roles
.
contains
(
"tunix"
)
)
{
mCanBeTool
|=
UBAbstractWidget
::
OSType
::
type_UNIX
;
}
//---------//
if
(
roles
==
""
||
roles
.
contains
(
"content"
)
)
{
mCanBeContent
=
UBAbstractWidget
::
OSType
::
type_ALL
;
}
if
(
roles
.
contains
(
"cwin"
)
)
{
mCanBeContent
|=
UBAbstractWidget
::
OSType
::
type_WIN
;
}
if
(
roles
.
contains
(
"cmac"
)
)
{
mCanBeContent
|=
UBAbstractWidget
::
OSType
::
type_MAC
;
}
if
(
roles
.
contains
(
"cunix"
)
)
{
mCanBeContent
|=
UBAbstractWidget
::
OSType
::
type_UNIX
;
}
//------------------------------//
QDomNodeList
contentDomList
=
widgetElement
.
elementsByTagName
(
"content"
);
...
...
@@ -159,8 +202,6 @@ UBW3CWidget::UBW3CWidget(const QUrl& pWidgetUrl, QWidget *parent)
connect
(
page
()
->
mainFrame
(),
SIGNAL
(
javaScriptWindowObjectCleared
()),
this
,
SLOT
(
javaScriptWindowObjectCleared
()));
connect
(
UBApplication
::
boardController
,
SIGNAL
(
activeSceneChanged
()),
this
,
SLOT
(
javaScriptWindowObjectCleared
()));
QWebView
::
load
(
mMainHtmlUrl
);
setFixedSize
(
QSize
(
width
,
height
));
mNominalSize
=
QSize
(
width
,
height
);
...
...
@@ -171,7 +212,6 @@ UBW3CWidget::~UBW3CWidget()
// NOOP
}
void
UBW3CWidget
::
javaScriptWindowObjectCleared
()
{
UBWidgetUniboardAPI
*
uniboardAPI
=
new
UBWidgetUniboardAPI
(
UBApplication
::
boardController
->
activeScene
(),
0
);
...
...
src/gui/UBToolWidget.cpp
View file @
25bf9810
...
...
@@ -72,6 +72,7 @@ UBToolWidget::UBToolWidget(UBAbstractWidget* pWidget, QWidget* pParent)
,
mShouldMoveWidget
(
false
)
{
mToolWidget
->
setParent
(
this
);
mToolWidget
->
loadMainHtml
();
initialize
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment