Commit c70fc664 authored by Anatoly Mihalchenko's avatar Anatoly Mihalchenko

Merge branch 'master' of github.com:Sankore/Sankore-3.1

parents 7cd7d93c 93424100
<?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/webbrowser"
version="1.1"
width="700"
height="400"
ub:resizable="false">
<name>Choisir</name>
<author href="http://www.getuniboard.com"
email="info@mnemis.com">Mnemis SA</author>
<description>Choisir widget</description>
<content src="index.html"/>
</widget>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="css/basic.css"/>
<script type="text/javascript" src="scripts/jquery-1.6.2.min.js"></script>
<script src="scripts/jquery.disable.text.select.js" type="text/javascript"></script>
<script src="scripts/languages.js" type="text/javascript"></script>
<script type="text/javascript" src="scripts/blackYellow.js"></script>
<script type="text/javascript">
$(document).ready(function(){
init();
});
</script>
</head>
<body>
</body>
</html>
/**
* .disableTextSelect - Disable Text Select Plugin
*
* Version: 1.1
* Updated: 2007-11-28
*
* Used to stop users from selecting text
*
* Copyright (c) 2007 James Dempster (letssurf@gmail.com, http://www.jdempster.com/category/jquery/disabletextselect/)
*
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
**/
/**
* Requirements:
* - jQuery (John Resig, http://www.jquery.com/)
**/
(function($) {
if ($.browser.mozilla) {
$.fn.disableTextSelect = function() {
return this.each(function() {
$(this).css({
'MozUserSelect' : 'none'
});
});
};
$.fn.enableTextSelect = function() {
return this.each(function() {
$(this).css({
'MozUserSelect' : ''
});
});
};
} else if ($.browser.msie) {
$.fn.disableTextSelect = function() {
return this.each(function() {
$(this).bind('selectstart.disableTextSelect', function() {
return false;
});
});
};
$.fn.enableTextSelect = function() {
return this.each(function() {
$(this).unbind('selectstart.disableTextSelect');
});
};
} else {
$.fn.disableTextSelect = function() {
return this.each(function() {
$(this).bind('mousedown.disableTextSelect', function() {
return false;
});
});
};
$.fn.enableTextSelect = function() {
return this.each(function() {
$(this).unbind('mousedown.disableTextSelect');
});
};
}
})(jQuery);
\ No newline at end of file
var sankoreLang = {
"en":{
"edit": "Edit",
"display":"Display",
"add":"Add",
"enter_data":"Enter data:",
"enter_result":"Enter result:",
"ok":"Ok",
"cancel":"Cancel"
},
"ru":{
"edit": "Изменить",
"display":"Показать",
"add":"Добавить",
"enter_data":"Введите вопрос:",
"enter_result":"Введите ответ:",
"ok":"Ок",
"cancel":"Отмена"
},
"fr":{
"edit": "Modifier",
"display":"Afficher",
"add":"Ajouter",
"enter_data":"Entrer les données:",
"enter_result":"Entrez le résultat:",
"ok":"Ok",
"cancel":"Annuler"
}
};
...@@ -208,7 +208,7 @@ function modeEdit() ...@@ -208,7 +208,7 @@ function modeEdit()
// if no sankore api, insert ok button // if no sankore api, insert ok button
if( !isSankore ) if( !isSankore )
{ {
$( "#mp_setup" ).empty().append( '<input type="button" value="OK">' ); $( "#mp_setup" ).empty().append( '<input type="button" value="View">' );
$( "#mp_setup input:button" ).click( function(){ $( "#mp_setup input:button" ).click( function(){
modeView(); modeView();
}); });
......
...@@ -236,7 +236,7 @@ function modeEdit() ...@@ -236,7 +236,7 @@ function modeEdit()
// if no sankore api, insert ok button // if no sankore api, insert ok button
if( !isSankore ) if( !isSankore )
{ {
$( "#mp_setup" ).empty().append( '<input type="button" value="OK">' ); $( "#mp_setup" ).empty().append( '<input type="button" value="View">' );
$( "#mp_setup input:button" ).click( function(){ $( "#mp_setup input:button" ).click( function(){
modeView(); modeView();
}); });
...@@ -249,9 +249,11 @@ $(window).mouseout(function(){ ...@@ -249,9 +249,11 @@ $(window).mouseout(function(){
if(window.sankore){ if(window.sankore){
var str = ""; var str = "";
$( "#mp_word .letter" ).each( function(){ $( "#mp_word .letter" ).each( function(){
str += $(this).text(); str += $(this).text() + "*";
}); });
str = str.substr(0, str.length - 1);
sankore.setPreference("currentOrdWords", str); sankore.setPreference("currentOrdWords", str);
sankore.setPreference("rightOrdWords", word); sankore.setPreference("rightOrdWords", word);
} }
......
...@@ -1002,6 +1002,7 @@ void UBCFFSubsetAdaptor::UBCFFSubsetReader::repositionSvgItem(QGraphicsItem *ite ...@@ -1002,6 +1002,7 @@ void UBCFFSubsetAdaptor::UBCFFSubsetReader::repositionSvgItem(QGraphicsItem *ite
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::createNewScene() bool UBCFFSubsetAdaptor::UBCFFSubsetReader::createNewScene()
{ {
mCurrentScene = UBPersistenceManager::persistenceManager()->createDocumentSceneAt(mProxy, mProxy->pageCount()); mCurrentScene = UBPersistenceManager::persistenceManager()->createDocumentSceneAt(mProxy, mProxy->pageCount());
mCurrentScene->setURStackEnable(false);
mCurrentSceneRect = mCurrentScene->normalizedSceneRect(); mCurrentSceneRect = mCurrentScene->normalizedSceneRect();
mVBTransFactor = qMin(mCurrentSceneRect.width() / mViewPort.width(), mVBTransFactor = qMin(mCurrentSceneRect.width() / mViewPort.width(),
mCurrentSceneRect.height() / mViewPort.height()); mCurrentSceneRect.height() / mViewPort.height());
......
...@@ -25,17 +25,17 @@ class UBAbstractUndoCommand : public QUndoCommand ...@@ -25,17 +25,17 @@ class UBAbstractUndoCommand : public QUndoCommand
UBAbstractUndoCommand(); UBAbstractUndoCommand();
~UBAbstractUndoCommand(); ~UBAbstractUndoCommand();
enum UndoType : int enum UndoType
{ {
undotype_UNKNOWN = 0, undotype_UNKNOWN = 0,
undotype_DOCUMENT = 1, undotype_DOCUMENT = 1,
undotype_GRAPHICITEMTRANSFORM = 2, undotype_GRAPHICITEMTRANSFORM = 2,
undotype_GRAPHICITEM = 3, undotype_GRAPHICITEM = 3,
undotype_GRAPHICTEXTITEM = 4, undotype_GRAPHICTEXTITEM = 4,
undotype_PAGESIZE = 5, undotype_PAGESIZE = 5
}; };
virtual UndoType getType() { return undotype_UNKNOWN; }; virtual UndoType getType() { return undotype_UNKNOWN; }
protected: protected:
virtual void undo(); virtual void undo();
......
...@@ -93,8 +93,10 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent) ...@@ -93,8 +93,10 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent)
, mCurrentStroke(0) , mCurrentStroke(0)
, mShouldUseOMP(true) , mShouldUseOMP(true)
, mItemCount(0) , mItemCount(0)
, enableUndoRedoStack(true)
, magniferControlViewWidget(0) , magniferControlViewWidget(0)
, magniferDisplayViewWidget(0) , magniferDisplayViewWidget(0)
{ {
#ifdef __ppc__ #ifdef __ppc__
...@@ -139,6 +141,8 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent) ...@@ -139,6 +141,8 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent)
} }
connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChangedProcessing())); connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChangedProcessing()));
} }
UBGraphicsScene::~UBGraphicsScene() UBGraphicsScene::~UBGraphicsScene()
...@@ -371,10 +375,13 @@ bool UBGraphicsScene::inputDeviceRelease() ...@@ -371,10 +375,13 @@ bool UBGraphicsScene::inputDeviceRelease()
if (mRemovedItems.size() > 0 || mAddedItems.size() > 0) if (mRemovedItems.size() > 0 || mAddedItems.size() > 0)
{ {
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
UBGraphicsItemUndoCommand* udcmd = new UBGraphicsItemUndoCommand(this, mRemovedItems, mAddedItems); //deleted by the undoStack UBGraphicsItemUndoCommand* udcmd = new UBGraphicsItemUndoCommand(this, mRemovedItems, mAddedItems); //deleted by the undoStack
if(UBApplication::undoStack) if(UBApplication::undoStack)
UBApplication::undoStack->push(udcmd); UBApplication::undoStack->push(udcmd);
}
mRemovedItems.clear(); mRemovedItems.clear();
mAddedItems.clear(); mAddedItems.clear();
...@@ -961,8 +968,11 @@ void UBGraphicsScene::clearItemsAndAnnotations() ...@@ -961,8 +968,11 @@ void UBGraphicsScene::clearItemsAndAnnotations()
// force refresh, QT is a bit lazy and take a lot of time (nb item ^2 ?) to trigger repaint // force refresh, QT is a bit lazy and take a lot of time (nb item ^2 ?) to trigger repaint
update(sceneRect()); update(sceneRect());
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, removedItems, emptyList); UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, removedItems, emptyList);
UBApplication::undoStack->push(uc); UBApplication::undoStack->push(uc);
}
setDocumentUpdated(); setDocumentUpdated();
} }
...@@ -995,8 +1005,12 @@ void UBGraphicsScene::clearItems() ...@@ -995,8 +1005,12 @@ void UBGraphicsScene::clearItems()
// force refresh, QT is a bit lazy and take a lot of time (nb item ^2 ?) to trigger repaint // force refresh, QT is a bit lazy and take a lot of time (nb item ^2 ?) to trigger repaint
update(sceneRect()); update(sceneRect());
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, removedItems, emptyList); UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, removedItems, emptyList);
UBApplication::undoStack->push(uc); UBApplication::undoStack->push(uc);
}
setDocumentUpdated(); setDocumentUpdated();
} }
...@@ -1022,8 +1036,12 @@ void UBGraphicsScene::clearAnnotations() ...@@ -1022,8 +1036,12 @@ void UBGraphicsScene::clearAnnotations()
// force refresh, QT is a bit lazy and take a lot of time (nb item ^2 ?) to trigger repaint // force refresh, QT is a bit lazy and take a lot of time (nb item ^2 ?) to trigger repaint
update(sceneRect()); update(sceneRect());
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, removedItems, emptyList); UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, removedItems, emptyList);
UBApplication::undoStack->push(uc); UBApplication::undoStack->push(uc);
}
setDocumentUpdated(); setDocumentUpdated();
} }
...@@ -1044,8 +1062,10 @@ UBGraphicsPixmapItem* UBGraphicsScene::addPixmap(const QPixmap& pPixmap, const Q ...@@ -1044,8 +1062,10 @@ UBGraphicsPixmapItem* UBGraphicsScene::addPixmap(const QPixmap& pPixmap, const Q
addItem(pixmapItem); addItem(pixmapItem);
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, pixmapItem); UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, pixmapItem);
UBApplication::undoStack->push(uc); UBApplication::undoStack->push(uc);
}
pixmapItem->scale(pScaleFactor, pScaleFactor); pixmapItem->scale(pScaleFactor, pScaleFactor);
...@@ -1070,8 +1090,10 @@ UBGraphicsPixmapItem* UBGraphicsScene::addPixmap(const QPixmap& pPixmap, const Q ...@@ -1070,8 +1090,10 @@ UBGraphicsPixmapItem* UBGraphicsScene::addPixmap(const QPixmap& pPixmap, const Q
void UBGraphicsScene::textUndoCommandAdded(UBGraphicsTextItem *textItem) void UBGraphicsScene::textUndoCommandAdded(UBGraphicsTextItem *textItem)
{ {
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
UBGraphicsTextItemUndoCommand* uc = new UBGraphicsTextItemUndoCommand(textItem); UBGraphicsTextItemUndoCommand* uc = new UBGraphicsTextItemUndoCommand(textItem);
UBApplication::undoStack->push(uc); UBApplication::undoStack->push(uc);
}
} }
...@@ -1090,8 +1112,10 @@ UBGraphicsVideoItem* UBGraphicsScene::addVideo(const QUrl& pVideoFileUrl, bool s ...@@ -1090,8 +1112,10 @@ UBGraphicsVideoItem* UBGraphicsScene::addVideo(const QUrl& pVideoFileUrl, bool s
videoItem->show(); videoItem->show();
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, videoItem); UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, videoItem);
UBApplication::undoStack->push(uc); UBApplication::undoStack->push(uc);
}
videoItem->mediaObject()->play(); videoItem->mediaObject()->play();
...@@ -1121,8 +1145,10 @@ UBGraphicsAudioItem* UBGraphicsScene::addAudio(const QUrl& pAudioFileUrl, bool s ...@@ -1121,8 +1145,10 @@ UBGraphicsAudioItem* UBGraphicsScene::addAudio(const QUrl& pAudioFileUrl, bool s
audioItem->show(); audioItem->show();
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, audioItem); UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, audioItem);
UBApplication::undoStack->push(uc); UBApplication::undoStack->push(uc);
}
audioItem->mediaObject()->play(); audioItem->mediaObject()->play();
...@@ -1197,8 +1223,10 @@ void UBGraphicsScene::addGraphicsWidget(UBGraphicsWidgetItem* graphicsWidget, co ...@@ -1197,8 +1223,10 @@ void UBGraphicsScene::addGraphicsWidget(UBGraphicsWidgetItem* graphicsWidget, co
// graphicsWidget->widgetWebView()->loadMainHtml(); // graphicsWidget->widgetWebView()->loadMainHtml();
graphicsWidget->setSelected(true); graphicsWidget->setSelected(true);
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, graphicsWidget); UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, graphicsWidget);
UBApplication::undoStack->push(uc); UBApplication::undoStack->push(uc);
}
setDocumentUpdated(); setDocumentUpdated();
} }
...@@ -1253,8 +1281,10 @@ UBGraphicsSvgItem* UBGraphicsScene::addSvg(const QUrl& pSvgFileUrl, const QPoint ...@@ -1253,8 +1281,10 @@ UBGraphicsSvgItem* UBGraphicsScene::addSvg(const QUrl& pSvgFileUrl, const QPoint
addItem(svgItem); addItem(svgItem);
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, svgItem); UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, svgItem);
UBApplication::undoStack->push(uc); UBApplication::undoStack->push(uc);
}
setDocumentUpdated(); setDocumentUpdated();
...@@ -1314,8 +1344,10 @@ UBGraphicsTextItem* UBGraphicsScene::addTextWithFont(const QString& pString, con ...@@ -1314,8 +1344,10 @@ UBGraphicsTextItem* UBGraphicsScene::addTextWithFont(const QString& pString, con
textItem->show(); textItem->show();
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, textItem); UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, textItem);
UBApplication::undoStack->push(uc); UBApplication::undoStack->push(uc);
}
connect(textItem, SIGNAL(textUndoCommandAdded(UBGraphicsTextItem *)), this, SLOT(textUndoCommandAdded(UBGraphicsTextItem *))); connect(textItem, SIGNAL(textUndoCommandAdded(UBGraphicsTextItem *)), this, SLOT(textUndoCommandAdded(UBGraphicsTextItem *)));
...@@ -1337,8 +1369,10 @@ UBGraphicsTextItem *UBGraphicsScene::addTextHtml(const QString &pString, const Q ...@@ -1337,8 +1369,10 @@ UBGraphicsTextItem *UBGraphicsScene::addTextHtml(const QString &pString, const Q
addItem(textItem); addItem(textItem);
textItem->show(); textItem->show();
if (enableUndoRedoStack) { //should be deleted after scene own undo stack implemented
UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, textItem); UBGraphicsItemUndoCommand* uc = new UBGraphicsItemUndoCommand(this, 0, textItem);
UBApplication::undoStack->push(uc); UBApplication::undoStack->push(uc);
}
connect(textItem, SIGNAL(textUndoCommandAdded(UBGraphicsTextItem *)), connect(textItem, SIGNAL(textUndoCommandAdded(UBGraphicsTextItem *)),
this, SLOT(textUndoCommandAdded(UBGraphicsTextItem *))); this, SLOT(textUndoCommandAdded(UBGraphicsTextItem *)));
......
...@@ -55,6 +55,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem ...@@ -55,6 +55,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
Q_OBJECT Q_OBJECT
public: public:
// tmp stub for divide addings scene objects from undo mechanism implementation
void setURStackEnable(bool set = true) {enableUndoRedoStack = set;}
UBGraphicsScene(UBDocumentProxy *parent); UBGraphicsScene(UBDocumentProxy *parent);
virtual ~UBGraphicsScene(); virtual ~UBGraphicsScene();
...@@ -363,8 +365,13 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem ...@@ -363,8 +365,13 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
//int mMesure1Ms, mMesure2Ms; //int mMesure1Ms, mMesure2Ms;
bool mHasCache; bool mHasCache;
// tmp stub for divide addings scene objects from undo mechanism implementation
bool enableUndoRedoStack;
UBMagnifier *magniferControlViewWidget; UBMagnifier *magniferControlViewWidget;
UBMagnifier *magniferDisplayViewWidget; UBMagnifier *magniferDisplayViewWidget;
}; };
#endif /* UBGRAPHICSSCENE_H_ */ #endif /* UBGRAPHICSSCENE_H_ */
...@@ -21,7 +21,8 @@ HEADERS += src/domain/UBGraphicsScene.h \ ...@@ -21,7 +21,8 @@ HEADERS += src/domain/UBGraphicsScene.h \
src/domain/UBGraphicsStroke.h \ src/domain/UBGraphicsStroke.h \
src/domain/UBGraphicsMediaItem.h \ src/domain/UBGraphicsMediaItem.h \
src/domain/UBGraphicsAudioItem.h \ src/domain/UBGraphicsAudioItem.h \
src/domain/UBGraphicsAudioItemDelegate.h src/domain/UBGraphicsAudioItemDelegate.h \
src/domain/UBAbstractUndoCommand.h
HEADERS += src/domain/UBGraphicsItemDelegate.h \ HEADERS += src/domain/UBGraphicsItemDelegate.h \
src/domain/UBGraphicsVideoItemDelegate.h \ src/domain/UBGraphicsVideoItemDelegate.h \
...@@ -52,7 +53,8 @@ SOURCES += src/domain/UBGraphicsScene.cpp \ ...@@ -52,7 +53,8 @@ SOURCES += src/domain/UBGraphicsScene.cpp \
src/domain/UBGraphicsStroke.cpp \ src/domain/UBGraphicsStroke.cpp \
src/domain/UBGraphicsMediaItem.cpp \ src/domain/UBGraphicsMediaItem.cpp \
src/domain/UBGraphicsAudioItem.cpp \ src/domain/UBGraphicsAudioItem.cpp \
src/domain/UBGraphicsAudioItemDelegate.cpp src/domain/UBGraphicsAudioItemDelegate.cpp \
src/domain/UBAbstractUndoCommand.cpp
SOURCES += src/domain/UBGraphicsItemDelegate.cpp \ SOURCES += src/domain/UBGraphicsItemDelegate.cpp \
src/domain/UBGraphicsVideoItemDelegate.cpp \ src/domain/UBGraphicsVideoItemDelegate.cpp \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment