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

preferencesAboutTextFull
Anatoly Mihalchenko 13 years ago
commit 4b7b891730
  1. 109
      resources/forms/mainWindow.ui
  2. BIN
      resources/images/cursors/magnifier.png
  3. BIN
      resources/images/stylusPalette/magnifier.png
  4. BIN
      resources/images/stylusPalette/magnifierOn.png
  5. BIN
      resources/images/toolbar/largeMagnifierSize.png
  6. BIN
      resources/images/toolbar/largeMagnifierZoom.png
  7. BIN
      resources/images/toolbar/mediumMagnifierSize.png
  8. BIN
      resources/images/toolbar/mediumMagnifierZoom.png
  9. BIN
      resources/images/toolbar/smallMagnifierSize.png
  10. BIN
      resources/images/toolbar/smallMagnifierZoom.png
  11. 2
      resources/library/interactive/Anyembed.wgt/config.xml
  12. 2
      resources/library/interactive/GeoInfo.wgt/config.xml
  13. 11
      resources/library/interactive/GeoInfo.wgt/css/GeoInfo.css
  14. BIN
      resources/library/interactive/GeoInfo.wgt/images/cursor.png
  15. 7
      resources/library/interactive/GeoInfo.wgt/js/GeoInfo.js
  16. 5
      resources/library/interactive/Graphme.wgt/Grapheur.xhtml
  17. 2
      resources/library/interactive/Graphme.wgt/JavaScript/.directory
  18. 472
      resources/library/interactive/Graphme.wgt/JavaScript/jQuery/DD_roundies_0.0.2a.js
  19. 74
      resources/library/interactive/Graphme.wgt/JavaScript/jQuery/calculate.js
  20. 19
      resources/library/interactive/Graphme.wgt/JavaScript/jQuery/jquery-1.3.2.min.js
  21. 298
      resources/library/interactive/Graphme.wgt/JavaScript/jQuery/jquery-ui-1.7.2.custom.min.js
  22. 56
      resources/library/interactive/Graphme.wgt/JavaScript/jQuery/jquery.center.js
  23. 62
      resources/library/interactive/Graphme.wgt/JavaScript/jQuery/jquery.disable.text.select.js
  24. 140
      resources/library/interactive/Graphme.wgt/JavaScript/jQuery/jquery.easing.1.2.js
  25. 259
      resources/library/interactive/Graphme.wgt/JavaScript/jQuery/jquery.ubwidget.js
  26. 526
      resources/library/interactive/Graphme.wgt/JavaScript/jQuery/ubw-main.js
  27. 2
      resources/library/interactive/Html.wgt/markitup/templates/preview.css
  28. 2
      resources/library/interactive/VideoPicker.wgt/config.xml
  29. 9
      resources/sankore.qrc
  30. 46
      src/board/UBBoardController.cpp
  31. 3
      src/board/UBBoardView.cpp
  32. 22
      src/board/UBDrawingController.cpp
  33. 3
      src/board/UBDrawingController.h
  34. 21
      src/core/UB.h
  35. 8
      src/core/UBApplication.cpp
  36. 2
      src/core/UBApplication.h
  37. 173
      src/core/UBSettings.cpp
  38. 24
      src/core/UBSettings.h
  39. 69
      src/domain/UBGraphicsScene.cpp
  40. 7
      src/domain/UBGraphicsScene.h
  41. 155
      src/gui/UBMagnifer.cpp
  42. 60
      src/gui/UBMagnifer.h
  43. 7
      src/gui/UBMainWindow.cpp
  44. 4
      src/gui/UBMainWindow.h
  45. 1
      src/gui/UBResources.cpp
  46. 1
      src/gui/UBResources.h
  47. 1
      src/gui/UBStylusPalette.cpp
  48. 6
      src/gui/gui.pri
  49. 2
      src/tools/UBGraphicsCompass.cpp
  50. 2
      src/tools/UBGraphicsProtractor.cpp

@ -1638,6 +1638,115 @@
<string>Ctrl+H</string>
</property>
</action>
<action name="actionMagnifier">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../sankore.qrc">
<normaloff>:/images/stylusPalette/magnifier.png</normaloff>
<normalon>:/images/stylusPalette/magnifierOn.png</normalon>:/images/stylusPalette/magnifier.png</iconset>
</property>
<property name="text">
<string>Magnifier</string>
</property>
<property name="toolTip">
<string>Magnifier</string>
</property>
</action>
<action name="actionMagnifierZoomSmall">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../sankore.qrc">
<normaloff>:/images/toolbar/smallMagnifierZoom.png</normaloff>:/images/toolbar/smallMagnifierZoom.png</iconset>
</property>
<property name="text">
<string>Zoom</string>
</property>
<property name="toolTip">
<string>x2 Zoom</string>
</property>
</action>
<action name="actionMagnifierZoomMedium">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../sankore.qrc">
<normaloff>:/images/toolbar/mediumMagnifierZoom.png</normaloff>:/images/toolbar/mediumMagnifierZoom.png</iconset>
</property>
<property name="text">
<string>Zoom</string>
</property>
<property name="toolTip">
<string>x3 Zoom</string>
</property>
</action>
<action name="actionMagnifierZoomLarge">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../sankore.qrc">
<normaloff>:/images/toolbar/largeMagnifierZoom.png</normaloff>:/images/toolbar/largeMagnifierZoom.png</iconset>
</property>
<property name="text">
<string>Zoom</string>
</property>
<property name="toolTip">
<string>x4 Zoom</string>
</property>
</action>
<action name="actionMagnifierSizeSmall">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../sankore.qrc">
<normaloff>:/images/toolbar/smallMagnifierSize.png</normaloff>:/images/toolbar/smallMagnifierSize.png</iconset>
</property>
<property name="text">
<string>Size</string>
</property>
<property name="toolTip">
<string>10% from scene size</string>
</property>
</action>
<action name="actionMagnifierSizeMedium">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../sankore.qrc">
<normaloff>:/images/toolbar/mediumMagnifierSize.png</normaloff>:/images/toolbar/mediumMagnifierSize.png</iconset>
</property>
<property name="text">
<string>Size</string>
</property>
<property name="toolTip">
<string>20% from scene size</string>
</property>
</action>
<action name="actionMagnifierSizeLarge">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../sankore.qrc">
<normaloff>:/images/toolbar/largeMagnifierSize.png</normaloff>:/images/toolbar/largeMagnifierSize.png</iconset>
</property>
<property name="text">
<string>Size</string>
</property>
<property name="toolTip">
<string>30% from scene size</string>
</property>
</action>
</widget>
<resources>
<include location="../sankore.qrc"/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 476 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

@ -5,7 +5,7 @@
version="1.1"
width="477"
height="85"
ub:resizable="true">
ub:resizable="false">
<name>AnyEmbed</name>
<content src="index.html"/>
</widget>

@ -3,7 +3,7 @@
version="1.0"
width="680"
height="400"
ub:resizable="true">
ub:resizable="false">
<name>GeoInfo</name>
<content src="GeoInfo.html"/>
</widget>

@ -145,3 +145,14 @@ body {
{
height:40px;
}
.customCursor{
position: absolute;
top: -3px;
left: -38px;
border: none;
width: 20px;
height: 20px;
background-image: url(../images/cursor.png);
background-repeat: no-repeat;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

@ -1,4 +1,4 @@
/*
/*
Script utilisé par GeoInfo.
Copyright (C) 2010 Baptiste Sottas Tous droits réservés.
@ -222,7 +222,8 @@ function fondu(carte)
// permet de faire apparaître les infos du pays dans la petite fenêtre
function afficheInfoPays(pays)
{
document.getElementById("infoPays").innerHTML = document.getElementById(pays).innerHTML;
//$("area[alt=" + pays + "]").css("z-index","9999");
document.getElementById("infoPays").innerHTML = "<div id='customCursor' class='customCursor'></div>" + document.getElementById(pays).innerHTML;
}
// permet de cacher la petite fenêtre
@ -236,5 +237,5 @@ function deplacerInfo(event)
{
document.getElementById("infoPays").style.display = 'block';
document.getElementById("infoPays").style.top = event.clientY;
document.getElementById ("infoPays").style.left = event.clientX+20;
document.getElementById("infoPays").style.left = event.clientX+40;
}

@ -18,11 +18,12 @@
<script type="text/javascript" src="JavaScript/AffichageUniboard.js"></script>
<script type="text/javascript" src="JavaScript/AffichageXPM.js"></script>
<script src="JavaScript/jQuery/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="JavaScript/jQuery/jquery.disable.text.select.js" type="text/javascript"></script>
<script src="JavaScript/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="JavaScript/jquery.disable.text.select.js" type="text/javascript"></script>
<script type="text/javascript">
// <![CDATA[
// --- Variables nécessaires au fonctionnement du widget ---
var loadingFlag = false
var largeur = 500
var hauteur = 400

@ -1,2 +0,0 @@
[Dolphin]
Timestamp=2010,7,5,14,3,51

@ -1,472 +0,0 @@
/**
* DD_roundies, this adds rounded-corner CSS in standard browsers and VML sublayers in IE that accomplish a similar appearance when comparing said browsers.
* Author: Drew Diller
* Email: drew.diller@gmail.com
* URL: http://www.dillerdesign.com/experiment/DD_roundies/
* Version: 0.0.2a
* Licensed under the MIT License: http://dillerdesign.com/experiment/DD_roundies/#license
*
* Usage:
* DD_roundies.addRule('#doc .container', '10px 5px'); // selector and multiple radii
* DD_roundies.addRule('.box', 5, true); // selector, radius, and optional addition of border-radius code for standard browsers.
*
* Just want the PNG fixing effect for IE6, and don't want to also use the DD_belatedPNG library? Don't give any additional arguments after the CSS selector.
* DD_roundies.addRule('.your .example img');
**/
var DD_roundies = {
ns: 'DD_roundies',
IE6: false,
IE7: false,
IE8: false,
IEversion: function() {
if (document.documentMode != 8 && document.namespaces && !document.namespaces[this.ns]) {
this.IE6 = true;
this.IE7 = true;
}
else if (document.documentMode == 8) {
this.IE8 = true;
}
},
querySelector: document.querySelectorAll,
selectorsToProcess: [],
imgSize: {},
createVmlNameSpace: function() { /* enable VML */
if (this.IE6 || this.IE7) {
document.namespaces.add(this.ns, 'urn:schemas-microsoft-com:vml');
}
if (this.IE8) {
document.writeln('<?import namespace="' + this.ns + '" implementation="#default#VML" ?>');
}
},
createVmlStyleSheet: function() { /* style VML, enable behaviors */
/*
Just in case lots of other developers have added
lots of other stylesheets using document.createStyleSheet
and hit the 31-limit mark, let's not use that method!
further reading: http://msdn.microsoft.com/en-us/library/ms531194(VS.85).aspx
*/
var style = document.createElement('style');
document.documentElement.firstChild.insertBefore(style, document.documentElement.firstChild.firstChild);
if (style.styleSheet) { /* IE */
try {
var styleSheet = style.styleSheet;
styleSheet.addRule(this.ns + '\\:*', '{behavior:url(#default#VML)}');
this.styleSheet = styleSheet;
} catch(err) {}
}
else {
this.styleSheet = style;
}
},
/**
* Method to use from afar - refer to it whenever.
* Example for IE only: DD_roundies.addRule('div.boxy_box', '10px 5px');
* Example for IE, Firefox, and WebKit: DD_roundies.addRule('div.boxy_box', '10px 5px', true);
* @param {String} selector - REQUIRED - a CSS selector, such as '#doc .container'
* @param {Integer} radius - REQUIRED - the desired radius for the box corners
* @param {Boolean} standards - OPTIONAL - true if you also wish to output -moz-border-radius/-webkit-border-radius/border-radius declarations
**/
addRule: function(selector, rad, standards) {
if (typeof rad == 'undefined' || rad === null) {
rad = 0;
}
if (rad.constructor.toString().search('Array') == -1) {
rad = rad.toString().replace(/[^0-9 ]/g, '').split(' ');
}
for (var i=0; i<4; i++) {
rad[i] = (!rad[i] && rad[i] !== 0) ? rad[Math.max((i-2), 0)] : rad[i];
}
if (this.styleSheet) {
if (this.styleSheet.addRule) { /* IE */
var selectors = selector.split(','); /* multiple selectors supported, no need for multiple calls to this anymore */
for (var i=0; i<selectors.length; i++) {
this.styleSheet.addRule(selectors[i], 'behavior:expression(DD_roundies.roundify.call(this, [' + rad.join(',') + ']))'); /* seems to execute the function without adding it to the stylesheet - interesting... */
}
}
else if (standards) {
var moz_implementation = rad.join('px ') + 'px';
this.styleSheet.appendChild(document.createTextNode(selector + ' {border-radius:' + moz_implementation + '; -moz-border-radius:' + moz_implementation + ';}'));
this.styleSheet.appendChild(document.createTextNode(selector + ' {-webkit-border-top-left-radius:' + rad[0] + 'px ' + rad[0] + 'px; -webkit-border-top-right-radius:' + rad[1] + 'px ' + rad[1] + 'px; -webkit-border-bottom-right-radius:' + rad[2] + 'px ' + rad[2] + 'px; -webkit-border-bottom-left-radius:' + rad[3] + 'px ' + rad[3] + 'px;}'));
}
}
else if (this.IE8) {
this.selectorsToProcess.push({'selector':selector, 'radii':rad});
}
},
readPropertyChanges: function(el) {
switch (event.propertyName) {
case 'style.border':
case 'style.borderWidth':
case 'style.padding':
this.applyVML(el);
break;
case 'style.borderColor':
this.vmlStrokeColor(el);
break;
case 'style.backgroundColor':
case 'style.backgroundPosition':
case 'style.backgroundRepeat':
this.applyVML(el);
break;
case 'style.display':
el.vmlBox.style.display = (el.style.display == 'none') ? 'none' : 'block';
break;
case 'style.filter':
this.vmlOpacity(el);
break;
case 'style.zIndex':
el.vmlBox.style.zIndex = el.style.zIndex;
break;
}
},
applyVML: function(el) {
el.runtimeStyle.cssText = '';
this.vmlFill(el);
this.vmlStrokeColor(el);
this.vmlStrokeWeight(el);
this.vmlOffsets(el);
this.vmlPath(el);
this.nixBorder(el);
this.vmlOpacity(el);
},
vmlOpacity: function(el) {
if (el.currentStyle.filter.search('lpha') != -1) {
var trans = el.currentStyle.filter;
trans = parseInt(trans.substring(trans.lastIndexOf('=')+1, trans.lastIndexOf(')')), 10)/100;
for (var v in el.vml) {
el.vml[v].filler.opacity = trans;
}
}
},
vmlFill: function(el) {
if (!el.currentStyle) {
return;
} else {
var elStyle = el.currentStyle;
}
el.runtimeStyle.backgroundColor = '';
el.runtimeStyle.backgroundImage = '';
var noColor = (elStyle.backgroundColor == 'transparent');
var noImg = true;
if (elStyle.backgroundImage != 'none' || el.isImg) {
if (!el.isImg) {
el.vmlBg = elStyle.backgroundImage;
el.vmlBg = el.vmlBg.substr(5, el.vmlBg.lastIndexOf('")')-5);
}
else {
el.vmlBg = el.src;
}
var lib = this;
if (!lib.imgSize[el.vmlBg]) { /* determine size of loaded image */
var img = document.createElement('img');
img.attachEvent('onload', function() {
this.width = this.offsetWidth; /* weird cache-busting requirement! */
this.height = this.offsetHeight;
lib.vmlOffsets(el);
});
img.className = lib.ns + '_sizeFinder';
img.runtimeStyle.cssText = 'behavior:none; position:absolute; top:-10000px; left:-10000px; border:none;'; /* make sure to set behavior to none to prevent accidental matching of the helper elements! */
img.src = el.vmlBg;
img.removeAttribute('width');
img.removeAttribute('height');
document.body.insertBefore(img, document.body.firstChild);
lib.imgSize[el.vmlBg] = img;
}
el.vml.image.filler.src = el.vmlBg;
noImg = false;
}
el.vml.image.filled = !noImg;
el.vml.image.fillcolor = 'none';
el.vml.color.filled = !noColor;
el.vml.color.fillcolor = elStyle.backgroundColor;
el.runtimeStyle.backgroundImage = 'none';
el.runtimeStyle.backgroundColor = 'transparent';
},
vmlStrokeColor: function(el) {
el.vml.stroke.fillcolor = el.currentStyle.borderColor;
},
vmlStrokeWeight: function(el) {
var borders = ['Top', 'Right', 'Bottom', 'Left'];
el.bW = {};
for (var b=0; b<4; b++) {
el.bW[borders[b]] = parseInt(el.currentStyle['border' + borders[b] + 'Width'], 10) || 0;
}
},
vmlOffsets: function(el) {
var dims = ['Left', 'Top', 'Width', 'Height'];
for (var d=0; d<4; d++) {
el.dim[dims[d]] = el['offset'+dims[d]];
}
var assign = function(obj, topLeft) {
obj.style.left = (topLeft ? 0 : el.dim.Left) + 'px';
obj.style.top = (topLeft ? 0 : el.dim.Top) + 'px';
obj.style.width = el.dim.Width + 'px';
obj.style.height = el.dim.Height + 'px';
};
for (var v in el.vml) {
var mult = (v == 'image') ? 1 : 2;
el.vml[v].coordsize = (el.dim.Width*mult) + ', ' + (el.dim.Height*mult);
assign(el.vml[v], true);
}
assign(el.vmlBox, false);
if (DD_roundies.IE8) {
el.vml.stroke.style.margin = '-1px';
if (typeof el.bW == 'undefined') {
this.vmlStrokeWeight(el);
}
el.vml.color.style.margin = (el.bW.Top-1) + 'px ' + (el.bW.Left-1) + 'px';
}
},
vmlPath: function(el) {
var coords = function(direction, w, h, r, aL, aT, mult) {
var cmd = direction ? ['m', 'qy', 'l', 'qx', 'l', 'qy', 'l', 'qx', 'l'] : ['qx', 'l', 'qy', 'l', 'qx', 'l', 'qy', 'l', 'm']; /* whoa */
aL *= mult;
aT *= mult;
w *= mult;
h *= mult;
var R = r.slice(); /* do not affect original array */
for (var i=0; i<4; i++) {
R[i] *= mult;
R[i] = Math.min(w/2, h/2, R[i]); /* make sure you do not get funky shapes - pick the smallest: half of the width, half of the height, or current value */
}
var coords = [
cmd[0] + Math.floor(0+aL) +','+ Math.floor(R[0]+aT),
cmd[1] + Math.floor(R[0]+aL) +','+ Math.floor(0+aT),
cmd[2] + Math.ceil(w-R[1]+aL) +','+ Math.floor(0+aT),
cmd[3] + Math.ceil(w+aL) +','+ Math.floor(R[1]+aT),
cmd[4] + Math.ceil(w+aL) +','+ Math.ceil(h-R[2]+aT),
cmd[5] + Math.ceil(w-R[2]+aL) +','+ Math.ceil(h+aT),
cmd[6] + Math.floor(R[3]+aL) +','+ Math.ceil(h+aT),
cmd[7] + Math.floor(0+aL) +','+ Math.ceil(h-R[3]+aT),
cmd[8] + Math.floor(0+aL) +','+ Math.floor(R[0]+aT)
];
if (!direction) {
coords.reverse();
}
var path = coords.join('');
return path;
};
if (typeof el.bW == 'undefined') {
this.vmlStrokeWeight(el);
}
var bW = el.bW;
var rad = el.DD_radii.slice();
/* determine outer curves */
var outer = coords(true, el.dim.Width, el.dim.Height, rad, 0, 0, 2);
/* determine inner curves */
rad[0] -= Math.max(bW.Left, bW.Top);
rad[1] -= Math.max(bW.Top, bW.Right);
rad[2] -= Math.max(bW.Right, bW.Bottom);
rad[3] -= Math.max(bW.Bottom, bW.Left);
for (var i=0; i<4; i++) {
rad[i] = Math.max(rad[i], 0);
}
var inner = coords(false, el.dim.Width-bW.Left-bW.Right, el.dim.Height-bW.Top-bW.Bottom, rad, bW.Left, bW.Top, 2);
var image = coords(true, el.dim.Width-bW.Left-bW.Right+1, el.dim.Height-bW.Top-bW.Bottom+1, rad, bW.Left, bW.Top, 1);
/* apply huge path string */
el.vml.color.path = inner;
el.vml.image.path = image;
el.vml.stroke.path = outer + inner;
this.clipImage(el);
},
nixBorder: function(el) {
var s = el.currentStyle;
var sides = ['Top', 'Left', 'Right', 'Bottom'];
for (var i=0; i<4; i++) {
el.runtimeStyle['padding' + sides[i]] = (parseInt(s['padding' + sides[i]], 10) || 0) + (parseInt(s['border' + sides[i] + 'Width'], 10) || 0) + 'px';
}
el.runtimeStyle.border = 'none';
},
clipImage: function(el) {
var lib = DD_roundies;
if (!el.vmlBg || !lib.imgSize[el.vmlBg]) {
return;
}
var thisStyle = el.currentStyle;
var bg = {'X':0, 'Y':0};
var figurePercentage = function(axis, position) {
var fraction = true;
switch(position) {
case 'left':
case 'top':
bg[axis] = 0;
break;
case 'center':
bg[axis] = 0.5;
break;
case 'right':
case 'bottom':
bg[axis] = 1;
break;
default:
if (position.search('%') != -1) {
bg[axis] = parseInt(position, 10) * 0.01;
}
else {
fraction = false;
}
}
var horz = (axis == 'X');
bg[axis] = Math.ceil(fraction ? (( el.dim[horz ? 'Width' : 'Height'] - (el.bW[horz ? 'Left' : 'Top'] + el.bW[horz ? 'Right' : 'Bottom']) ) * bg[axis]) - (lib.imgSize[el.vmlBg][horz ? 'width' : 'height'] * bg[axis]) : parseInt(position, 10));
bg[axis] += 1;
};
for (var b in bg) {
figurePercentage(b, thisStyle['backgroundPosition'+b]);
}
el.vml.image.filler.position = (bg.X/(el.dim.Width-el.bW.Left-el.bW.Right+1)) + ',' + (bg.Y/(el.dim.Height-el.bW.Top-el.bW.Bottom+1));
var bgR = thisStyle.backgroundRepeat;
var c = {'T':1, 'R':el.dim.Width+1, 'B':el.dim.Height+1, 'L':1}; /* these are defaults for repeat of any kind */
var altC = { 'X': {'b1': 'L', 'b2': 'R', 'd': 'Width'}, 'Y': {'b1': 'T', 'b2': 'B', 'd': 'Height'} };
if (bgR != 'repeat') {
c = {'T':(bg.Y), 'R':(bg.X+lib.imgSize[el.vmlBg].width), 'B':(bg.Y+lib.imgSize[el.vmlBg].height), 'L':(bg.X)}; /* these are defaults for no-repeat - clips down to the image location */
if (bgR.search('repeat-') != -1) { /* now let's revert to dC for repeat-x or repeat-y */
var v = bgR.split('repeat-')[1].toUpperCase();
c[altC[v].b1] = 1;
c[altC[v].b2] = el.dim[altC[v].d]+1;
}
if (c.B > el.dim.Height) {
c.B = el.dim.Height+1;
}
}
el.vml.image.style.clip = 'rect('+c.T+'px '+c.R+'px '+c.B+'px '+c.L+'px)';
},
pseudoClass: function(el) {
var self = this;
setTimeout(function() { /* would not work as intended without setTimeout */
self.applyVML(el);
}, 1);
},
reposition: function(el) {
this.vmlOffsets(el);
this.vmlPath(el);
},
roundify: function(rad) {
this.style.behavior = 'none';
if (!this.currentStyle) {
return;
}
else {
var thisStyle = this.currentStyle;
}
var allowed = {BODY: false, TABLE: false, TR: false, TD: false, SELECT: false, OPTION: false, TEXTAREA: false};
if (allowed[this.nodeName] === false) { /* elements not supported yet */
return;
}
var self = this; /* who knows when you might need a setTimeout */
var lib = DD_roundies;
this.DD_radii = rad;
this.dim = {};
/* attach handlers */
var handlers = {resize: 'reposition', move: 'reposition'};
if (this.nodeName == 'A') {
var moreForAs = {mouseleave: 'pseudoClass', mouseenter: 'pseudoClass', focus: 'pseudoClass', blur: 'pseudoClass'};
for (var a in moreForAs) {
handlers[a] = moreForAs[a];
}
}
for (var h in handlers) {
this.attachEvent('on' + h, function() {
lib[handlers[h]](self);
});
}
this.attachEvent('onpropertychange', function() {
lib.readPropertyChanges(self);
});
/* ensure that this elent and its parent is given hasLayout (needed for accurate positioning) */
var giveLayout = function(el) {
el.style.zoom = 1;
if (el.currentStyle.position == 'static') {
el.style.position = 'relative';
}
};
giveLayout(this.offsetParent);
giveLayout(this);
/* create vml elements */
this.vmlBox = document.createElement('ignore'); /* IE8 really wants to be encased in a wrapper element for the VML to work, and I don't want to disturb getElementsByTagName('div') - open to suggestion on how to do this differently */
this.vmlBox.runtimeStyle.cssText = 'behavior:none; position:absolute; margin:0; padding:0; border:0; background:none;'; /* super important - if something accidentally matches this (you yourseld did this once, Drew), you'll get infinitely-created elements and a frozen browser! */
this.vmlBox.style.zIndex = thisStyle.zIndex;
this.vml = {'color':true, 'image':true, 'stroke':true};
for (var v in this.vml) {
this.vml[v] = document.createElement(lib.ns + ':shape');
this.vml[v].filler = document.createElement(lib.ns + ':fill');
this.vml[v].appendChild(this.vml[v].filler);
this.vml[v].stroked = false;
this.vml[v].style.position = 'absolute';
this.vml[v].style.zIndex = thisStyle.zIndex;
this.vml[v].coordorigin = '1,1';
this.vmlBox.appendChild(this.vml[v]);
}
this.vml.image.fillcolor = 'none';
this.vml.image.filler.type = 'tile';
this.parentNode.insertBefore(this.vmlBox, this);
this.isImg = false;
if (this.nodeName == 'IMG') {
this.isImg = true;
this.style.visibility = 'hidden';
}
setTimeout(function() {
lib.applyVML(self);
}, 1);
}
};
try {
document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}
DD_roundies.IEversion();
DD_roundies.createVmlNameSpace();
DD_roundies.createVmlStyleSheet();
if (DD_roundies.IE8 && document.attachEvent && DD_roundies.querySelector) {
document.attachEvent('onreadystatechange', function() {
if (document.readyState == 'complete') {
var selectors = DD_roundies.selectorsToProcess;
var length = selectors.length;
var delayedCall = function(node, radii, index) {
setTimeout(function() {
DD_roundies.roundify.call(node, radii);
}, index*100);
};
for (var i=0; i<length; i++) {
var results = document.querySelectorAll(selectors[i].selector);
var rLength = results.length;
for (var r=0; r<rLength; r++) {
if (results[r].nodeName != 'INPUT') { /* IE8 doesn't like to do this to inputs yet */
delayedCall(results[r], selectors[i].radii, r);
}
}
}
}
});
}

@ -1,74 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function addChar(input, character) {
if(input.value == null || input.value == "0")
input.value = character
else
input.value += character
}
function cos(form) {
form.display.value = Math.cos(form.display.value);
}
function sin(form) {
form.display.value = Math.sin(form.display.value);
}
function tan(form) {
form.display.value = Math.tan(form.display.value);
}
function sqrt(form) {
form.display.value = Math.sqrt(form.display.value);
}
function ln(form) {
form.display.value = Math.log(form.display.value);
}
function exp(form) {
form.display.value = Math.exp(form.display.value);
}
function deleteChar(input) {
input.value = input.value.substring(0, input.value.length - 1)
}
function changeSign(input) {
if(input.value.substring(0, 1) == "-")
input.value = input.value.substring(1, input.value.length)
else
input.value = "-" + input.value
}
function square(form) {
form.display.value = eval(form.display.value) * eval(form.display.value)
}
function checkNum(str) {
for (var i = 0; i < str.length; i++) {
var ch = str.substring(i, i+1)
if (ch < "0" || ch > "9") {
if (ch != "/" && ch != "*" && ch != "+" && ch != "-" && ch != "."
&& ch != "(" && ch!= ")") {
$("#display").text("ERROR");
return false
}
}
}
return true
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,56 +0,0 @@
jQuery.fn.center = function(params) {
var options = {
vertical: true,
horizontal: true
}
op = jQuery.extend(options, params);
this.each(function(){
//initializing variables
var $self = jQuery(this);
//get the dimensions using dimensions plugin
var width = $self.width();
var height = $self.height();
//get the paddings
var paddingTop = parseInt($self.css("padding-top"));
var paddingBottom = parseInt($self.css("padding-bottom"));
//get the borders
var borderTop = parseInt($self.css("border-top-width"));
var borderBottom = parseInt($self.css("border-bottom-width"));
//get the media of padding and borders
var mediaBorder = (borderTop+borderBottom)/2;
var mediaPadding = (paddingTop+paddingBottom)/2;
//get the type of positioning
var positionType = $self.parent().css("position");
// get the half minus of width and height
var halfWidth = (width/2)*(-1);
var halfHeight = ((height/2)*(-1))-mediaPadding-mediaBorder;
// initializing the css properties
var cssProp = {
position: 'absolute'
};
if(op.vertical) {
cssProp.height = height;
cssProp.top = '50%';
cssProp.marginTop = halfHeight;
}
if(op.horizontal) {
cssProp.width = width;
cssProp.left = '50%';
cssProp.marginLeft = halfWidth;
}
//check the current position
if(positionType == 'static') {
$self.parent().css("position","relative");
}
//aplying the css
$self.css(cssProp);
});
};

@ -1,62 +0,0 @@
/**
* .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);

@ -1,140 +0,0 @@
/*
* jQuery EasIng v1.1.2 - http://gsgd.co.uk/sandbox/jquery.easIng.php
*
* Uses the built In easIng capabilities added In jQuery 1.1
* to offer multiple easIng options
*
* Copyright (c) 2007 George Smith
* Licensed under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*/
// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.extend( jQuery.easing,
{
easeInQuad: function (x, t, b, c, d) {
return c*(t/=d)*t + b;
},
easeOutQuad: function (x, t, b, c, d) {
return -c *(t/=d)*(t-2) + b;
},
easeInOutQuad: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t + b;
return -c/2 * ((--t)*(t-2) - 1) + b;
},
easeInCubic: function (x, t, b, c, d) {
return c*(t/=d)*t*t + b;
},
easeOutCubic: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t + 1) + b;
},
easeInOutCubic: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t + b;
return c/2*((t-=2)*t*t + 2) + b;
},
easeInQuart: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t + b;
},
easeOutQuart: function (x, t, b, c, d) {
return -c * ((t=t/d-1)*t*t*t - 1) + b;
},
easeInOutQuart: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
return -c/2 * ((t-=2)*t*t*t - 2) + b;
},
easeInQuint: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t*t + b;
},
easeOutQuint: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t*t*t + 1) + b;
},
easeInOutQuint: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
return c/2*((t-=2)*t*t*t*t + 2) + b;
},
easeInSine: function (x, t, b, c, d) {
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
},
easeOutSine: function (x, t, b, c, d) {
return c * Math.sin(t/d * (Math.PI/2)) + b;
},
easeInOutSine: function (x, t, b, c, d) {
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
},
easeInExpo: function (x, t, b, c, d) {
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
},
easeOutExpo: function (x, t, b, c, d) {
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
},
easeInOutExpo: function (x, t, b, c, d) {
if (t==0) return b;
if (t==d) return b+c;
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
},
easeInCirc: function (x, t, b, c, d) {
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
},
easeOutCirc: function (x, t, b, c, d) {
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
},
easeInOutCirc: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
},
easeInElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
},
easeOutElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
},
easeInOutElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
},
easeInBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*(t/=d)*t*((s+1)*t - s) + b;
},
easeOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
},
easeInOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
},
easeInBounce: function (x, t, b, c, d) {
return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
},
easeOutBounce: function (x, t, b, c, d) {
if ((t/=d) < (1/2.75)) {
return c*(7.5625*t*t) + b;
} else if (t < (2/2.75)) {
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
} else if (t < (2.5/2.75)) {
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
} else {
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
}
},
easeInOutBounce: function (x, t, b, c, d) {
if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
}
});

@ -1,259 +0,0 @@
(function($) {
jQuery.fn.ubwidget = function(options) {
var settings = jQuery.extend({}, jQuery.fn.ubwidget.defaults, options);
DD_roundies.addRule('.ubw-standard-corners', '5px', true);
DD_roundies.addRule('.ubw-button-corners', '4px', true);
DD_roundies.addRule('.ubw-i-corners', '4px', true);
$(window)
.bind("blur", function(event){
})
.trigger("focus");
return this.each(function() {
var ubwbody = $(this)
.addClass("ubw-body");
var ubwcontainer = $("<div></div>")
.append(ubwbody)
.addClass("ubw-container")
.css({
width:settings.width,
height:settings.height
})
.disableTextSelect();
$('body').append(ubwcontainer);
});
};
// Default options
jQuery.fn.ubwidget.defaults = {
width:200,
height:250
};
// Shadows
jQuery.fn.ubwshadows = function(settings){
var shadow = $("<div class='ubw-shadow'></div>")
.addClass("ubw-standard-corners")
.css({
backgroundColor:"#333377",
opacity:".1",
filter: "alpha(opacity = 10)",
position:"absolute",
top:settings.t,
left:settings.l,
width:settings.w,
height:settings.h
});
$(this).before(shadow);
};
jQuery.fn.ubwbutton = function(size, arrows) {
var arrows = typeof(arrows) != "undefined" ? arrows = arrows : arrows = {top:0, right:0, bottom:0, left:0};
var button = null;
var scale = 0.20;
var url = "";
var buttonbody;
return this.each(function() {
button = $(this)
.addClass("ubw-button-wrapper")
.css({zIndex:0});
url = $(this).find("img").attr("src");
url = url.split(".");
var buttonContent = $("<table cellpadding='0' cellspacing='0' border='0' width='auto' height='100%'><tr><td height='auto' width='auto' valign='middle' align='center'></td></tr></table>")
.addClass("ubw-button-content");
buttonContent.find("td").html($(this).html());
$(this).empty();
var buttonCanvas = $("<div></div>")
.addClass("ubw-button-canvas")
.appendTo(button)
.html('<table width="auto" height="auto" cellpadding="0" cellspacing="0"><tr><td class="ubw-button-arrowTop" align="center"><img style="visibility:hidden; margin-bottom:-1px" src="images/arrows_out/top.png"></td></tr><tr><td><table width="auto" height="auto" border="0" cellpadding="0" cellspacing="0"><tr><td class="ubw-button-arrowLeft"><img style="visibility:hidden; margin-right:-1px" src="images/arrows_out/left.png"></td><td class="ubw-button-body"></td><td class="ubw-button-arrowRight"><img style="visibility:hidden; margin-left:-1px" src="images/arrows_out/right.png"></td></tr></table></td></tr><tr><td class="ubw-button-arrowBottom" align="center"><img style="visibility:hidden; margin-top:-1px" src="images/arrows_out/bottom.png"></td></tr></table>');
if(arrows.top)buttonCanvas.find(".ubw-button-arrowTop").children("img").css({visibility:"visible"});
if(arrows.right)buttonCanvas.find(".ubw-button-arrowRight").children("img").css({visibility:"visible"});
if(arrows.bottom)buttonCanvas.find(".ubw-button-arrowBottom").children("img").css({visibility:"visible"});
if(arrows.left)buttonCanvas.find(".ubw-button-arrowLeft").children("img").css({visibility:"visible"});
var buttonBody = buttonCanvas.find(".ubw-button-body")
.addClass("ubw-button-out")
.append(buttonContent)
.bind("mouseenter", buttonOverHandler)
.bind("mouseleave", buttonOutHandler)
.bind("mousedown", buttonDownHandler)
.bind("mouseup", buttonUpHandler)
.css({
width:size.w,
height:size.h
});
button.width(size.w+9).height(size.h+2);
buttonbody = buttonBody.find(".ubw-button-content");
});
function buttonOverHandler(e) {
buttonbody.find("img").attr("src", url[0]+"_over.png");
button.css({
zIndex:1
});
};
function buttonOutHandler(e){
buttonbody.find("img").attr("src", url[0]+".png");
button.css({
zIndex:0
});
};
function buttonDownHandler(e){
buttonbody.find("img").attr("src", url[0]+"_over_down.png");
};
function buttonUpHandler(e){
url[0] = url[0].replace("_down", "");
buttonbody.find("img").attr("src", url[0]+"_over.png");
};
};
jQuery.fn.ubwtoggle = function(activated, _firstFunc, _secondFunc) {
var activated = typeof(activated) != "undefined" ? activated = 1 : activated = 0;
return this.each(function(){
var button = $(this);
var buttonBody = button.find(".ubw-button-body");
var img = buttonBody.find("img");
var imgsrc = img.attr("src");
var firstFunc = _firstFunc;
var secondFunc = _secondFunc;
buttonBody
.toggle(
function(){
img.css({visibility:"hidden"});
firstFunc();
},
function(){
img.css({visibility:"visible"});
secondFunc();
}
);
if(activated){
buttonBody.trigger("click");
};
});
};
jQuery.fn.ubwidget.sliderbutton = function() {
};
jQuery.fn.ubwidget.inspector = function(_position, content, button){
var position = {x:_position.x, y:_position.y};
var catcher = $("<div id='ubw-catcher'></div>")
.css({
position:"absolute",
width:"100%",
height:"100%"
})
.mousedown(function(){
inspector.hide();
removeDropShadow();
catcher.hide();
//resizeubcanvas()
});
$("body").append(catcher);
catcher.hide();
var inspector = $("<div class='ubw-inspector'></div>")
.css({
left:position.x,
top:position.y
})
.append(content)
.appendTo($("body"))
.hide()
.disableTextSelect();
var inspectorWidth = inspector.width();
var inspectorHeight = inspector.height();
var windowWidth = $(window).width();
var windowHeight = $(window).height();
$("body").prepend(button);
button.addClass("ubw-rounded")
.click(function(){
catcher.show();
inspector.show();
dropShadow();
resizeubcanvas()
});
function dropShadow (){
inspector.ubwshadows({w:inspectorWidth+23,h:inspectorHeight+22,l:55,t:55})}
function removeDropShadow (){
$(".ubw-shadow").remove()}
// !!
$(".ubw-shadow")
.mousedown(function(){
inspector.hide();
removeDropShadow();
catcher.hide();
resizeubcanvas()
});
function resizeWidget(w, h){
window.resizeTo(w+2, h+2);
$("#indicator").remove();
var indicator = $("<div id='indicator'></div>")
.css({
width:w,
height:h,
position:"absolute",
left:0,
top:0,
border:"1px solid #ff0000"
});
//$("body").prepend(indicator);
}
function resizeubcanvas(){
if(inspector.css("display")=="none"){
resizeWidget(windowWidth, windowHeight);
return 0;
};
var inspectorbottom = inspector.position().top+inspector.height()+40;
var inspectorright = inspector.position().left+inspector.width()+40;
if($(window).height()<inspectorbottom){
resizeWidget($(window).width(), inspectorbottom)};
if($(window).width()<inspectorright){
resizeWidget(inspectorright, $(window).height())};
}
};
})(jQuery);

@ -1,526 +0,0 @@
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function init(){
var h = 292;
var w = 160;
var wh = h+6;
var ww = w+6;
var clickFlag = false;
var ubwidget = $("#ubwidget").ubwidget({
width:w,
height:h
});
var historyTab = $("<div></div>")
.css({
height:h,
marginRight:0,
width:20,
float:"left",
backgroundImage:"url(images/historytab.png)",
backgroundRepeat:"no-repeat"
})
.toggle(
function(){
resizeWidget(370, 294);
historyPanel.show();
$(".ubw-container").css({
backgroundImage:"url(images/back.png)",
width:328
});
if(window.sankore){
window.sankore.setPreference('historyTab', "visible");
};
},
function(){
resizeWidget(200, 294);
historyPanel.hide();
$(".ubw-container").css({
backgroundImage:"url(images/back_small.png)",
width:160
});
if(window.sankore){
window.sankore.setPreference('historyTab', "hidden");
};
}
)
.hover(
function(){
$(this).css({
backgroundImage:"url(images/historytabOver.png)"
});
},
function(){
$(this).css({
backgroundImage:"url(images/historytab.png)"
});
}
)
.appendTo($("body"));
var space = $("<div></div>");
space.css({
width:5,
height:1,
float:"left"
});
var keysPanel = $("<div id='keysPanel'></div>").css({
float:"left"
});
var mode = "standard";
var calc = "";
var displayTrunk = "";
var historyTrunk = "";
var lastHistory = "";
var subtrunk = 0;
var itrunk = 0;
var trunkpos = 0;
var lastchar = {
type:"NaN",
value:"null"
};
var inparenthesis = false;
var erase = false;
var abtn;
var readyToCompute = false;
var lastResult = "0";
var gDecimalSeparator = "";
var gThousandsSeparator = "";
var gDecimalCode = 0;
var gDecimalString = "";
var gError = false;
var historyTxt = "0";
var display = $("<div id='display'>0</div>")
.addClass("ubw-inputbox")
.css({
padding:"12px",
marginLeft:"2px",
marginBottom:"9px",
marginTop:7,
backgroundImage:"url(images/display.png)",
fontSize:"22px",
fontFamily:"Arial, Helvetica, Sans-serif",
color:"#777788",
width:118,
height:28,
overflow:"hidden",
textAlign:"right",
});
var standardPanel = $("<div></div>").css({
float:"left"
});
var cKeySize = {
w:33,
h:36
};
var btn7 = $("<div><img src='images/touche7.png'/></div>").ubwbutton({
w:cKeySize.w,
h:cKeySize.h
})
.mousedown(function(){
appendToDisplay("7", 1)
});
var btn8 = $("<div><img src='images/touche8.png'/></div>").ubwbutton({
w:cKeySize.w,
h:cKeySize.h
})
.mousedown(function(){
appendToDisplay("8", 1)
});
var btn9 = $("<div><img src='images/touche9.png'/></div>").ubwbutton({
w:cKeySize.w,
h:cKeySize.h
})
.mousedown(function(){
appendToDisplay("9", 1)
});
var btnDiv = $("<div><img src='images/touchediv.png'/></div>").ubwbutton({
w:cKeySize.w,
h:cKeySize.h
})
.mousedown(function(){
appendToDisplay("/", 0)
});
var btn4 = $("<div><img src='images/touche4.png'/></div>").ubwbutton({
w:cKeySize.w,
h:cKeySize.h
})
.mousedown(function(){
appendToDisplay("4", 1)
});
var btn5 = $("<div><img src='images/touche5.png'/></div>").ubwbutton({
w:cKeySize.w,
h:cKeySize.h
})
.mousedown(function(){
appendToDisplay("5", 1)
});
var btn6 = $("<div><img src='images/touche6.png'/></div>").ubwbutton({
w:cKeySize.w,
h:cKeySize.h
})
.mousedown(function(){
appendToDisplay("6", 1)
});
var btnMul = $("<div><img src='images/touchef.png'/></div>").ubwbutton({
w:cKeySize.w,
h:cKeySize.h
})
.mousedown(function(){
appendToDisplay("*", 0)
});
var btn1 = $("<div><img src='images/touche1.png'/></div>").ubwbutton({
w:cKeySize.w,
h:cKeySize.h
})
.mousedown(function(){
appendToDisplay("1", 1)
});
var btn2 = $("<div><img src='images/touche2.png'/></div>").ubwbutton({
w:cKeySize.w,
h:cKeySize.h
})
.mousedown(function(){
appendToDisplay("2", 1)
});
var btn3 = $("<div><img src='images/touche3.png'/></div>").ubwbutton({
w:cKeySize.w,
h:cKeySize.h
})
.mousedown(function(){
appendToDisplay("3", 1)
});
var btnSou = $("<div><img src='images/touchem.png'/></div>").ubwbutton({
w:68,
h:34
})
.mousedown(function(){
appendToDisplay("-", 0)
});
var btn0 = $("<div><img src='images/touche0.png'/></div>").ubwbutton({
w:cKeySize.w,
h:cKeySize.h
})
.mousedown(function(){
appendToDisplay("0", 1)
});
var btnDot = $("<div><img src='images/touchedot.png'/></div>").ubwbutton({
w:cKeySize.w,
h:cKeySize.h
})
.mousedown(function(){
appendToDisplay(".", 1)
});
var btnC = $("<div><img src='images/touchec.png'/></div>").ubwbutton({
w:cKeySize.w,
h:cKeySize.h
})
.mousedown(function(){
reset()
});
var btnAdd = $("<div><img src='images/touchep.png'/></div>").ubwbutton({
w:68,
h:34
})
.mousedown(function(){
appendToDisplay("+", 0)
});
var btnPaL = $("<div><img src='images/touchepg.png'/></div>").ubwbutton({
w:cKeySize.w,
h:cKeySize.h
})
.mousedown(function(){
appendToDisplay("(", 1)
});
var btnPaR = $("<div><img src='images/touchepd.png'/></div>").ubwbutton({
w:cKeySize.w,
h:cKeySize.h
})
.mousedown(function(){
appendToDisplay(")", 1)
});
var btnEqu = $("<div><img src='images/toucheeq.png'/></div>").ubwbutton({
w:cKeySize.w,
h:cKeySize.h
})
.mousedown(function(){
compute()
});
var historyPanel = $("<div id='historyPanel'></div>")
.css({
backgroundImage:"url(images/historyback.png)",
width:"auto",
height:"auto",
float:"left",
marginLeft:3,
marginRight:2,
marginTop:6
})
.hide();
var historyBox = $("<textarea id='historyBox'></textarea>")
.css({
padding:10,
fontSize:"20px",
fontFamily:"Arial, Helvetica, Sans-serif",
width:143,
height:236,
backgroundColor:"transparent",
resize:"none",
border:"none",
overlay:"none",
color:"#eeeeee"
})
.val("0");
historyPanel.append(historyBox);
var stop = $("<div></div>");
var sleft = $("<div></div>");
var sright = $("<div></div>");
stop.css({
width:140
})
.append(btnAdd).append(btnSou)
.append(btn7).append(btn8).append(btn9).append(btnMul)
.append(btn4).append(btn5).append(btn6).append(btnDiv);
sleft.css({
width:105,
float:"left"
})
.append(btn1).append(btn2).append(btn3)
.append(btn0).append(btnDot).append(btnC);
sright.css({
width:45,
float:"left"
})
.append(btnEqu);
standardPanel.css({
width:150
})
.append(stop)
.append(sleft).append(sright);
keysPanel
.append(display)
.append(standardPanel);
ubwidget
.append(historyPanel)
.append(keysPanel);
if(window.sankore){
historyTxt = window.sankore.preference('historyTxt', historyTxt);
var ht = window.sankore.preference('historyTab', "hidden");
$("#historyBox").val(historyTxt);
if(ht === "visible"){
historyTab.trigger("click");
};
}
function resizeWidget(w, h){
window.sankore.resize(w+2, h+2);
}
function compute(){
var result = eval(calc)
$("#display").text(updateDisplay(result));
lastResult = result;
lastchar.type = "Nan";
lastchar.value = "";
calc = "";
$("#historyBox").val($("#historyBox").val()+historyTrunk+"\n= "+updateDisplay(result)+"\n\n");
$("#historyBox").scrollTop(99999);
displayTrunk = "";
historyTrunk = "";
if(window.sankore){
window.sankore.setPreference('historyTxt', $("#historyBox").val());
};
lastHistory = $("#historyBox").val();
}
function reset(){
$("#display").text("0");
calc="";
displayTrunk="";
historyTrunk="";
$("#historyBox").val(lastHistory);
$("#historyBox").scrollTop(99999);
}
function formatNumberWithDelimiters(number) {
var delimiter = gThousandsSeparator;
var numString = number.toString();
if (!numString)
return "0";
var dot = numString.indexOf(gDecimalSeparator);
if (dot == -1)
dot = numString.length;
var stop = numString.length-dot;
var characteristic = numString.substr(0, dot);
if (!parseInt(characteristic))
return numString;
// see if it's a negative number
var numIsNegative = (parseInt(characteristic) < 0)
var newNumber = "";
var delimiterCount = Math.floor((characteristic.length-1) / 3);
var extras = characteristic.length % 3;
if (!extras && characteristic.length > 2)
extras = 3;
if (extras)
newNumber = newNumber + characteristic.substr(0, extras);
for (var i=0;i< delimiterCount; i++) {
if ( (0 == i) && numIsNegative && (extras == 1))
newNumber = newNumber + characteristic.substr(extras + (i * 3), 3);
else
newNumber = newNumber + delimiter + characteristic.substr(extras + (i * 3), 3);
}
return (dot ? (newNumber + numString.substr(dot, stop)) : newNumber);
}
function formatNumberWithScientificNotation(number) {
if (number == 0)
return number;
var numString = number.toString();
if (!numString)
return "0";
var num = new Number(numString);
var sci = num.toExponential(5);
if (sci == "NaN")
sci = formatNumberWithDelimiters(numString);
if (!sci)
return "0";
return sci;
}
function updateDisplay(number){
if(String(number).length > 8){
number = formatNumberWithScientificNotation(number);
}
else{
number = number;
}
return number;
}
function appendToDisplay(_char, v){
var char = _char;
// Display
if($("#historyBox").val() === "0"){
$("#historyBox").val("");
};
if(char == "-" && lastchar.type == "NaN"){
char = "m";
};
// char is a number
if(char <= 0 || char > 0 || char == "." || char == "m" || char == "(" || char == ")"){
if(char == "m"){
char = "-";
};
if(lastchar.type == "NaN"){
displayTrunk = "";
};
if(lastchar.value == "." && char == "."){
calc = calc.substr(0, calc.length-1);
displayTrunk = displayTrunk.substr(0, displayTrunk.length-1);
};
calc += String(char);
displayTrunk += String(char);
historyTrunk += String(char);
lastchar.type = "Number";
}
// char is an operator
else {
if(calc.length === 0){
var endCalc = calc;
calc = lastResult + endCalc;
historyTrunk = updateDisplay(lastResult);
}
if(lastchar.type == "NaN"){
calc = calc.substr(0, calc.length-1);
calc += char;
$("#historyBox").val($("#historyBox").val().substr(0, $("#historyBox").val().length-1));
}
else{
try{
calc = eval(calc) + String(char);
}catch(e){}
}
lastchar.type = "NaN";
try{
displayTrunk = eval(calc.substr(0, calc.length-1));
}catch(e){}
$("#historyBox").val($("#historyBox").val()+historyTrunk+char);
$("#historyBox").scrollTop(99999);
historyTrunk = "";
}
lastchar.value = char;
$("#display").text(updateDisplay(displayTrunk));
}
$("#historyBox").click(function(){
if(!clickFlag){
$(this).select();
clickFlag = true;
}
else{
clickFlag = false;
$(this).blur();
}
});
$(document).disableTextSelect();
};

@ -1,4 +1,4 @@
body {
font:70% Verdana, Arial, Helvetica, sans-serif;
color: orange;
color: black;
}

@ -5,7 +5,7 @@
version="1.1"
width="426"
height="630"
ub:resizable="true">
ub:resizable="false">
<name>Video Picker</name>
<author href="http://www.getuniboard.com"

@ -121,6 +121,12 @@
<file>images/toolbar/eraserTool.png</file>
<file>images/toolbar/lineTool.png</file>
<file>images/toolbar/tools.png</file>
<file>images/toolbar/largeMagnifierSize.png</file>
<file>images/toolbar/mediumMagnifierSize.png</file>
<file>images/toolbar/smallMagnifierSize.png</file>
<file>images/toolbar/largeMagnifierZoom.png</file>
<file>images/toolbar/mediumMagnifierZoom.png</file>
<file>images/toolbar/smallMagnifierZoom.png</file>
<file>images/stylusPalette/arrow.png</file>
<file>images/stylusPalette/arrowOn.png</file>
<file>images/stylusPalette/eraser.png</file>
@ -144,6 +150,8 @@
<file>images/stylusPalette/textOn.png</file>
<file>images/stylusPalette/captureArea.png</file>
<file>images/stylusPalette/captureAreaOn.png</file>
<file>images/stylusPalette/magnifier.png</file>
<file>images/stylusPalette/magnifierOn.png</file>
<file>images/backgroundPalette/background1.svg</file>
<file>images/backgroundPalette/background1On.svg</file>
<file>images/backgroundPalette/background2.svg</file>
@ -177,6 +185,7 @@
<file>images/cursors/resize.png</file>
<file>images/cursors/drawCompass.png</file>
<file>images/cursors/drawRulerLine.png</file>
<file>images/cursors/magnifier.png</file>
<file>images/print/onepage.png</file>
<file>images/print/thumbnails.png</file>
<file>images/print/twopages.png</file>

@ -289,7 +289,9 @@ void UBBoardController::setupToolbar()
mMainWindow->boardToolBar->insertWidget(mMainWindow->actionBackgrounds, lineWidthChoice);
//-----------------------------------------------------------//
// Setup eraser width choice widget
QList<QAction *> eraserWidthActions;
eraserWidthActions.append(mMainWindow->actionEraserSmall);
eraserWidthActions.append(mMainWindow->actionEraserMedium);
@ -307,6 +309,45 @@ void UBBoardController::setupToolbar()
eraserWidthChoice->setCurrentIndex(settings->eraserWidthIndex());
mMainWindow->boardToolBar->insertSeparator(mMainWindow->actionBackgrounds);
//-----------------------------------------------------------//
QList<QAction *> magnifierZoomActions;
magnifierZoomActions.append(mMainWindow->actionMagnifierZoomSmall);
magnifierZoomActions.append(mMainWindow->actionMagnifierZoomMedium);
magnifierZoomActions.append(mMainWindow->actionMagnifierZoomLarge);
UBToolbarButtonGroup *magnifierZoomChoice =
new UBToolbarButtonGroup(mMainWindow->boardToolBar, magnifierZoomActions);
mMainWindow->boardToolBar->insertWidget(mMainWindow->actionBackgrounds, magnifierZoomChoice);
connect(settings->appToolBarDisplayText, SIGNAL(changed(QVariant)), magnifierZoomChoice, SLOT(displayText(QVariant)));
connect(magnifierZoomChoice, SIGNAL(activated(int)), UBDrawingController::drawingController(), SLOT(setMagnifierZoomIndex(int)));
magnifierZoomChoice->displayText(QVariant(settings->appToolBarDisplayText->get().toBool()));
magnifierZoomChoice->setCurrentIndex(settings->magnifierZoomIndex());
QList<QAction *> magnifierSizeActions;
magnifierSizeActions.append(mMainWindow->actionMagnifierSizeSmall);
magnifierSizeActions.append(mMainWindow->actionMagnifierSizeMedium);
magnifierSizeActions.append(mMainWindow->actionMagnifierSizeLarge);
UBToolbarButtonGroup *magnifierSizeChoice =
new UBToolbarButtonGroup(mMainWindow->boardToolBar, magnifierSizeActions);
mMainWindow->boardToolBar->insertWidget(mMainWindow->actionBackgrounds, magnifierSizeChoice);
connect(settings->appToolBarDisplayText, SIGNAL(changed(QVariant)), magnifierSizeChoice, SLOT(displayText(QVariant)));
connect(magnifierSizeChoice, SIGNAL(activated(int)), UBDrawingController::drawingController(), SLOT(setMagnifierSizeIndex(int)));
magnifierSizeChoice->displayText(QVariant(settings->appToolBarDisplayText->get().toBool()));
magnifierSizeChoice->setCurrentIndex(settings->magnifierSizeIndex());
mMainWindow->boardToolBar->insertSeparator(mMainWindow->actionBackgrounds);
//-----------------------------------------------------------//
UBApplication::app()->insertSpaceToToolbarBeforeAction(mMainWindow->boardToolBar, mMainWindow->actionBoard);
UBApplication::app()->insertSpaceToToolbarBeforeAction(mMainWindow->tutorialToolBar, mMainWindow->actionBoard);
@ -646,8 +687,9 @@ void UBBoardController::zoom(const qreal ratio, QPointF scenePoint)
void UBBoardController::handScroll(qreal dx, qreal dy)
{
mControlView->horizontalScrollBar()->setValue(mControlView->horizontalScrollBar()->value() - dx);
mControlView->verticalScrollBar()->setValue(mControlView->verticalScrollBar()->value() - dy);
// mControlView->horizontalScrollBar()->setValue(mControlView->horizontalScrollBar()->value() - dx);
// mControlView->verticalScrollBar()->setValue(mControlView->verticalScrollBar()->value() - dy);
mControlView->translate(dx, dy);
UBApplication::applicationController->adjustDisplayView();

@ -857,6 +857,9 @@ UBBoardView::setToolCursor (int tool)
case UBStylusTool::Eraser:
controlViewport->setCursor (UBResources::resources ()->eraserCursor);
break;
case UBStylusTool::Magnifier:
controlViewport->setCursor (UBResources::resources ()->magnifierCursor);
break;
case UBStylusTool::Marker:
controlViewport->setCursor (UBResources::resources ()->markerCursor);
break;

@ -44,6 +44,7 @@ UBDrawingController::UBDrawingController(QObject * parent)
connect(UBApplication::mainWindow->actionPen, SIGNAL(triggered(bool)), this, SLOT(penToolSelected(bool)));
connect(UBApplication::mainWindow->actionEraser, SIGNAL(triggered(bool)), this, SLOT(eraserToolSelected(bool)));
connect(UBApplication::mainWindow->actionMagnifier, SIGNAL(triggered(bool)), this, SLOT(magnifierToolSelected(bool)));
connect(UBApplication::mainWindow->actionMarker, SIGNAL(triggered(bool)), this, SLOT(markerToolSelected(bool)));
connect(UBApplication::mainWindow->actionSelector, SIGNAL(triggered(bool)), this, SLOT(selectorToolSelected(bool)));
connect(UBApplication::mainWindow->actionHand, SIGNAL(triggered(bool)), this, SLOT(handToolSelected(bool)));
@ -102,6 +103,8 @@ void UBDrawingController::setStylusTool(int tool)
UBApplication::mainWindow->actionPen->setChecked(true);
else if (mStylusTool == UBStylusTool::Eraser)
UBApplication::mainWindow->actionEraser->setChecked(true);
else if (mStylusTool == UBStylusTool::Magnifier)
UBApplication::mainWindow->actionMagnifier->setChecked(true);
else if (mStylusTool == UBStylusTool::Marker)
UBApplication::mainWindow->actionMarker->setChecked(true);
else if (mStylusTool == UBStylusTool::Selector)
@ -263,6 +266,20 @@ void UBDrawingController::setEraserWidthIndex(int index)
}
void UBDrawingController::setMagnifierZoomIndex(int index)
{
setStylusTool(UBStylusTool::Magnifier);
UBSettings::settings()->setMagnifierZoomIndex(index);
}
void UBDrawingController::setMagnifierSizeIndex(int index)
{
setStylusTool(UBStylusTool::Magnifier);
UBSettings::settings()->setMagnifierSizeIndex(index);
}
void UBDrawingController::setPenColor(bool onDarkBackground, const QColor& color, int pIndex)
{
if (onDarkBackground)
@ -323,6 +340,11 @@ void UBDrawingController::eraserToolSelected(bool checked)
setStylusTool(UBStylusTool::Eraser);
}
void UBDrawingController::magnifierToolSelected(bool checked)
{
if (checked)
setStylusTool(UBStylusTool::Magnifier);
}
void UBDrawingController::markerToolSelected(bool checked)
{

@ -57,6 +57,8 @@ class UBDrawingController : public QObject
void setLineWidthIndex(int index);
void setColorIndex(int index);
void setEraserWidthIndex(int index);
void setMagnifierZoomIndex(int index);
void setMagnifierSizeIndex(int index);
signals:
void stylusToolChanged(int tool);
@ -75,6 +77,7 @@ class UBDrawingController : public QObject
void penToolSelected(bool checked);
void eraserToolSelected(bool checked);
void magnifierToolSelected(bool checked);
void markerToolSelected(bool checked);
void selectorToolSelected(bool checked);
void handToolSelected(bool checked);

@ -26,6 +26,7 @@ struct UBStylusTool
{
Pen = 0,
Eraser,
Magnifier,
Marker,
Selector,
Hand,
@ -46,6 +47,23 @@ struct UBWidth
};
};
struct UBZoom
{
enum Enum
{
Small = 0, Medium, Large
};
};
struct UBSize
{
enum Enum
{
Small = 0, Medium, Large
};
};
struct UBItemLayerType
{
enum Enum
@ -80,7 +98,8 @@ struct UBGraphicsItemType
CompassItemType,
ProtractorItemType,
StrokeItemType,
TriangleItemType
TriangleItemType,
MagnifierItemType,
};
};

@ -233,6 +233,7 @@ int UBApplication::exec(const QString& pFileToImport)
connect(mainWindow->actionWeb, SIGNAL(triggered()), this, SLOT(showInternet()));
connect(mainWindow->actionDocument, SIGNAL(triggered()), this, SLOT(showDocument()));
connect(mainWindow->actionQuit, SIGNAL(triggered()), this, SLOT(closing()));
connect(mainWindow, SIGNAL(closeEvent_Signal(QCloseEvent*)), this, SLOT(closeEvent(QCloseEvent*)));
boardController = new UBBoardController(mainWindow);
boardController->init();
@ -379,6 +380,13 @@ void UBApplication::toolBarDisplayTextChanged(QVariant display)
}
void UBApplication::closeEvent(QCloseEvent *event)
{
Q_UNUSED(event);
closing();
}
void UBApplication::closing()
{

@ -99,6 +99,8 @@ class UBApplication : public QtSingleApplication
void toolBarPositionChanged(QVariant topOrBottom);
void toolBarDisplayTextChanged(QVariant display);
void closeEvent(QCloseEvent *event);
/**
* Used on Windows platform to open file in running application. On MacOS X opening file is done through the
* FileOpen event that is handle in eventFilter method.

@ -556,55 +556,49 @@ QList<QColor> UBSettings::markerColors(bool onDarkBackground)
}
}
//----------------------------------------//
// eraser
int UBSettings::eraserWidthIndex()
{
return value("Board/EraserCircleWidthIndex", 1).toInt();
}
void UBSettings::setEraserWidthIndex(int index)
{
setValue("Board/EraserCircleWidthIndex", index);
}
qreal UBSettings::eraserFineWidth()
{
return value("Board/EraserFineWidth", 16).toDouble();
}
void UBSettings::setEraserFineWidth(qreal width)
{
setValue("Board/EraserFineWidth", width);
}
qreal UBSettings::eraserMediumWidth()
{
return value("Board/EraserMediumWidth", 64).toDouble();
}
void UBSettings::setEraserMediumWidth(qreal width)
{
setValue("Board/EraserMediumWidth", width);
}
qreal UBSettings::eraserStrongWidth()
{
return value("Board/EraserStrongWidth", 128).toDouble();
}
void UBSettings::setEraserStrongWidth(qreal width)
{
setValue("Board/EraserStrongWidth", width);
}
qreal UBSettings::currentEraserWidth()
{
qreal width = 0;
@ -630,6 +624,169 @@ qreal UBSettings::currentEraserWidth()
return width;
}
//----------------------------------------//
// magnifier
//-------------//
// zoom index
int UBSettings::magnifierZoomIndex()
{
return value("Board/MagnifierZoomIndex", 1).toInt();
}
void UBSettings::setMagnifierZoomIndex(int index)
{
setValue("Board/MagnifierZoomIndex", index);
}
//-------------//
// small zoom
qreal UBSettings::magnifierSmallZoom()
{
return value("Board/MagnifierSmallZoom", 2).toDouble();
}
void UBSettings::setMagnifierSmallZoom(qreal xZoom)
{
setValue("Board/MagnifierSmallZoom", xZoom);
}
//-------------//
// medium zoom
qreal UBSettings::magnifierMediumZoom()
{
return value("Board/MagnifierMediumZoom", 3).toDouble();
}
void UBSettings::setMagnifierMediumZoom(qreal xZoom)
{
setValue("Board/MagnifierMediumZoom", xZoom);
}
//-------------//
// large zoom
qreal UBSettings::magnifierLargeZoom()
{
return value("Board/MagnifierLargeZoom", 4).toDouble();
}
void UBSettings::setMagnifierLargeZoom(qreal xZoom)
{
setValue("Board/MagnifierLargeZoom", xZoom);
}
//-------------//
qreal UBSettings::currentMagnifierZoom()
{
qreal zoom = 0;
switch (magnifierZoomIndex())
{
case UBZoom::Small:
zoom = magnifierSmallZoom();
break;
case UBZoom::Medium:
zoom = magnifierMediumZoom();
break;
case UBZoom::Large:
zoom = magnifierLargeZoom();
break;
default:
Q_ASSERT(false);
//failsafe
zoom = magnifierSmallZoom();
break;
}
return zoom;
}
//-------------//
// size index
int UBSettings::magnifierSizeIndex()
{
return value("Board/MagnifierSizeIndex", 1).toInt();
}
void UBSettings::setMagnifierSizeIndex(int index)
{
setValue("Board/MagnifierSizeIndex", index);
}
//-------------//
// small zoom
qreal UBSettings::magnifierSmallSize()
{
return value("Board/MagnifierSmallSize", 10).toDouble();
}
void UBSettings::setMagnifierSmallSize(qreal xSize)
{
setValue("Board/MagnifierSmallSize", xSize);
}
//-------------//
// medium zoom
qreal UBSettings::magnifierMediumSize()
{
return value("Board/MagnifierMediumSize", 20).toDouble();
}
void UBSettings::setMagnifierMediumSize(qreal xSize)
{
setValue("Board/MagnifierMediumSize", xSize);
}
//-------------//
// large zoom
qreal UBSettings::magnifierLargeSize()
{
return value("Board/MagnifierLargeSize", 30).toDouble();
}
void UBSettings::setMagnifierLargeSize(qreal xSize)
{
setValue("Board/MagnifierLargeSize", xSize);
}
//-------------//
qreal UBSettings::currentMagnifierSize()
{
qreal size = 0;
switch (magnifierSizeIndex())
{
case UBSize::Small:
size = magnifierSmallSize();
break;
case UBSize::Medium:
size = magnifierMediumSize();
break;
case UBSize::Large:
size = magnifierLargeSize();
break;
default:
Q_ASSERT(false);
//failsafe
size = magnifierSmallSize();
break;
}
return size;
}
//----------------------------------------//
bool UBSettings::isDarkBackground()
{

@ -66,6 +66,19 @@ class UBSettings : public QObject
qreal eraserStrongWidth();
qreal currentEraserWidth();
// Magnifier related
int magnifierZoomIndex();
qreal magnifierSmallZoom();
qreal magnifierMediumZoom();
qreal magnifierLargeZoom();
qreal currentMagnifierZoom();
int magnifierSizeIndex();
qreal magnifierSmallSize();
qreal magnifierMediumSize();
qreal magnifierLargeSize();
qreal currentMagnifierSize();
// Background related
bool isDarkBackground();
bool isCrossedBackground();
@ -347,6 +360,17 @@ class UBSettings : public QObject
void setEraserMediumWidth(qreal width);
void setEraserStrongWidth(qreal width);
void setMagnifierZoomIndex(int index);
void setMagnifierSmallZoom(qreal xZoom);
void setMagnifierMediumZoom(qreal xZoom);
void setMagnifierLargeZoom(qreal xZoom);
void setMagnifierSizeIndex(int index);
void setMagnifierSmallSize(qreal xSize);
void setMagnifierMediumSize(qreal xSize);
void setMagnifierLargeSize(qreal xSize);
void setStylusPaletteVisible(bool visible);
void setPenPressureSensitive(bool sensitive);

@ -29,6 +29,8 @@
#include "core/UBDisplayManager.h"
#include "core/UBPersistenceManager.h"
#include "gui/UBMagnifer.h"
#include "tools/UBGraphicsRuler.h"
#include "tools/UBGraphicsProtractor.h"
#include "tools/UBGraphicsCompass.h"
@ -88,6 +90,8 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent)
, mCurrentStroke(0)
, mShouldUseOMP(true)
, mItemCount(0)
, magniferControlViewWidget(0)
, magniferDisplayViewWidget(0)
{
#ifdef __ppc__
@ -232,6 +236,15 @@ bool UBGraphicsScene::inputDevicePress(const QPointF& scenePos, const qreal& pre
drawPointer(scenePos);
accepted = true;
}
else if (currentTool == UBStylusTool::Magnifier)
{
CreateMagnifierQWidgets();
magniferControlViewWidget->grabNMove(QCursor::pos(), true);
magniferDisplayViewWidget->grabNMove(scenePos, true);
magniferControlViewWidget->show();
magniferDisplayViewWidget->show();
accepted = true;
}
}
return accepted;
@ -305,6 +318,11 @@ bool UBGraphicsScene::inputDeviceMove(const QPointF& scenePos, const qreal& pres
{
drawPointer(position);
}
else if (currentTool == UBStylusTool::Magnifier)
{
magniferControlViewWidget->grabNMove(QCursor::pos(), false);
magniferDisplayViewWidget->grabNMove(position, false);
}
accepted = true;
}
@ -329,16 +347,26 @@ bool UBGraphicsScene::inputDeviceRelease()
bool accepted = false;
if (mPointer)
{
mPointer->hide();
accepted = true;
}
if (UBDrawingController::drawingController()->isDrawingTool())
UBDrawingController *dc = UBDrawingController::drawingController();
UBStylusTool::Enum currentTool = (UBStylusTool::Enum)dc->stylusTool();
if (dc->isDrawingTool())
{
mCurrentStroke = 0;
}
else
if (currentTool == UBStylusTool::Magnifier)
{
DisposeMagnifierQWidgets();
//qDebug() << "deleted";
}
if (mRemovedItems.size() > 0 || mAddedItems.size() > 0)
{
@ -395,6 +423,45 @@ void UBGraphicsScene::drawPointer(const QPointF &pPoint)
}
}
// call this function when user press mouse button in Magnifier mode
void UBGraphicsScene::CreateMagnifierQWidgets()
{
UBApplication::app()->setOverrideCursor( QCursor( Qt::BlankCursor ) );
magniferControlViewWidget = new UBMagnifer((QWidget*)(UBApplication::boardController->controlContainer()));
magniferControlViewWidget->setGrabView((QGraphicsView*)UBApplication::boardController->controlView());
magniferControlViewWidget->setMoveView((QGraphicsView*)UBApplication::boardController->controlContainer());
magniferControlViewWidget->setSize(UBSettings::settings()->currentMagnifierSize());
magniferControlViewWidget->setZoom(UBSettings::settings()->currentMagnifierZoom());
magniferDisplayViewWidget = new UBMagnifer((QWidget*)(UBApplication::boardController->displayView()));
magniferDisplayViewWidget->setGrabView((QGraphicsView*)UBApplication::boardController->controlView());
magniferDisplayViewWidget->setMoveView((QGraphicsView*)UBApplication::boardController->displayView());
magniferDisplayViewWidget->setSize(UBSettings::settings()->currentMagnifierSize());
magniferDisplayViewWidget->setZoom(UBSettings::settings()->currentMagnifierZoom());
}
// call this function when user release mouse button in Magnifier mode
void UBGraphicsScene::DisposeMagnifierQWidgets()
{
if(magniferControlViewWidget)
{
magniferControlViewWidget->hide();
magniferControlViewWidget->setParent(0);
delete magniferControlViewWidget;
magniferControlViewWidget = NULL;
}
if(magniferDisplayViewWidget)
{
magniferDisplayViewWidget->hide();
magniferDisplayViewWidget->setParent(0);
delete magniferDisplayViewWidget;
magniferDisplayViewWidget = NULL;
}
UBApplication::app()->restoreOverrideCursor();
}
void UBGraphicsScene::moveTo(const QPointF &pPoint)
{

@ -44,6 +44,7 @@ class UBAbstractWidget;
class UBDocumentProxy;
class UBGraphicsCurtainItem;
class UBGraphicsStroke;
class UBMagnifer;
const double PI = 4.0 * atan(1.0);
@ -288,6 +289,9 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
void drawEraser(const QPointF& pEndPoint);
void drawPointer(const QPointF& pEndPoint);
void CreateMagnifierQWidgets();
void DisposeMagnifierQWidgets();
virtual void keyReleaseEvent(QKeyEvent * keyEvent);
@ -347,6 +351,9 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
QList<QGraphicsItem*> mFastAccessItems; // a local copy as QGraphicsScene::items() is very slow in Qt 4.6
//int mMesure1Ms, mMesure2Ms;
UBMagnifer *magniferControlViewWidget;
UBMagnifer *magniferDisplayViewWidget;
};
#endif /* UBGRAPHICSSCENE_H_ */

@ -0,0 +1,155 @@
#include "UBMagnifer.h"
#include <QPainter>
#include <QPixmap>
#include <QDebug>
#include <QWidget>
#include <QGraphicsView>
#include <QTimerEvent>
#include <QBitmap>
#include <QPen>
UBMagnifer::UBMagnifer(QWidget *parent)
: QWidget(parent)
, gView(0)
, mView(0)
, sizePercentFromScene(20)
, inTimer(false)
, borderPen(Qt::darkGray)
{
borderPen.setWidth(2);
}
UBMagnifer::~UBMagnifer()
{
if (timerUpdate != 0)
{
killTimer(timerUpdate);
timerUpdate = 0;
}
}
void UBMagnifer::setSize(int percentFromScene)
{
if(gView == NULL) return;
// calculate object size
sizePercentFromScene = percentFromScene;
QSize sceneSize = gView->size();
int size = sizePercentFromScene * sceneSize.width() / 100;
setGeometry(0, 0, size, size);
// prepare transparent bit mask
QImage mask_img(width(), height(), QImage::Format_Mono);
mask_img.fill(0xff);
QPainter mask_ptr(&mask_img);
mask_ptr.setBrush( QBrush( QColor(0, 0, 0) ) );
mask_ptr.drawEllipse(QPoint(size/2, size/2), size/2, size/2);
bmpMask = QBitmap::fromImage(mask_img);
// prepare general image
pMap = QPixmap(width(), height());
pMap.fill(Qt::transparent);
pMap.setMask(bmpMask);
}
void UBMagnifer::setZoom(int z)
{
zoom = z;
zWidth = size().width() / zoom;
zWidthHalf = zWidth / 2;
zHeight = size().height() / zoom;
zHeightHalf = zHeight / 2;
}
void UBMagnifer::paintEvent(QPaintEvent *)
{
QPainter p(this);
p.drawPixmap(0, 0, pMap);
// in future replace to image border
QPen pen(Qt::darkGray);
pen.setWidth(2);
p.setPen(borderPen);
p.drawEllipse(QPoint( size().width() / 2, size().height() / 2), size().width() / 2, size().height() / 2);
}
void UBMagnifer::timerEvent(QTimerEvent *e)
{
if(inTimer) return;
if (e->timerId() == timerUpdate)
{
inTimer = true;
if(!(updPoint.isNull())) grabPoint(updPoint);
if(!(updPointF.isNull()))grabPoint(updPointF);
inTimer = false;
}
}
void UBMagnifer::grabPoint(const QPoint &point)
{
QPointF itemPos = gView->mapFromGlobal(point);
int x = itemPos.x() - zWidthHalf;
int y = itemPos.y() - zHeightHalf;
QPixmap newPixMap(QSize(zWidth,zHeight));
((QWidget*)gView)->render(&newPixMap, QPoint(0, 0), QRegion(x, y, zWidth, zHeight));
pMap.fill(Qt::transparent);
pMap = newPixMap.scaled(QSize(width(), height()));
pMap.setMask(bmpMask);
update();
}
void UBMagnifer::grabPoint(const QPointF &point)
{
QPoint itemPos = gView->mapFromScene(point);
int x = itemPos.x() - zWidthHalf;
int y = itemPos.y() - zHeightHalf;
QPixmap newPixMap(QSize(zWidth,zHeight));
((QWidget*)gView)->render(&newPixMap, QPoint(0, 0), QRegion(x, y, zWidth, zHeight));
pMap.fill(Qt::transparent);
pMap = newPixMap.scaled(QSize(width(), height()));
pMap.setMask(bmpMask);
update();
}
// from global
void UBMagnifer::grabNMove(const QPoint &point, bool needGrab = true)
{
updPoint = point;
if(needGrab)
grabPoint(point);
QPoint itemPos = mView->mapFromGlobal(point);
move(itemPos.x() - width()/2, itemPos.y() - height()/2);
// move(itemPos.x(), itemPos.y());
}
// from scene
void UBMagnifer::grabNMove(const QPointF &point, bool needGrab = true)
{
updPointF = point;
if(needGrab)
grabPoint(point);
QPoint itemPos = mView->mapFromScene(point);
move(itemPos.x() - width()/2, itemPos.y() - height()/2);
// move(itemPos.x(), itemPos.y());
}
void UBMagnifer::setGrabView(QGraphicsView *view)
{
if (timerUpdate != 0)
killTimer(timerUpdate);
gView = view;
timerUpdate = startTimer(200);
}

@ -0,0 +1,60 @@
#ifndef UBMAGNIFER_H
#define UBMAGNIFER_H
#include <QWidget>
#include <QBitmap>
#include <QPen>
class QPixmap;
class QBitmap;
class QPen;
class QGraphicsView;
class UBMagnifer : public QWidget
{
Q_OBJECT
public:
UBMagnifer(QWidget *parent = 0);
~UBMagnifer();
void setSize(int percentFromScene);
void setZoom(int z);
void setGrabView(QGraphicsView *view);
void setMoveView(QGraphicsView *view) {mView = view;}
void grabPoint(const QPoint &point);
void grabPoint(const QPointF &point);
void grabNMove(const QPoint &point, bool needGrab);
void grabNMove(const QPointF &point, bool needGrab);
protected:
void paintEvent(QPaintEvent *);
void timerEvent(QTimerEvent *);
int sizePercentFromScene;
private:
int zoom;
int zWidth;
int zHeight;
int zWidthHalf;
int zHeightHalf;
bool inTimer;
int timerUpdate;
QPoint updPoint;
QPointF updPointF;
QPixmap pMap;
QBitmap bmpMask;
QPen borderPen;
QGraphicsView *gView;
QGraphicsView *mView;
};
#endif // UBMAGNIFER_H

@ -40,6 +40,7 @@ UBMainWindow::UBMainWindow(QWidget *parent, Qt::WindowFlags flags)
actionQuit->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
#elif defined(Q_WS_WIN)
actionPreferences->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Return));
// this code, because it unusable, system key combination can`t be triggered, even we add it manually
actionQuit->setShortcut(QKeySequence(Qt::ALT + Qt::Key_F4));
#else
actionQuit->setShortcut(QKeySequence(Qt::ALT + Qt::Key_F4));
@ -118,6 +119,12 @@ void UBMainWindow::keyPressEvent(QKeyEvent *event)
*/
}
void UBMainWindow::closeEvent(QCloseEvent *event)
{
event->ignore();
emit closeEvent_Signal(event);
}
void UBMainWindow::onExportDone()
{
// HACK : When opening the file save dialog during the document exportation,

@ -42,12 +42,16 @@ class UBMainWindow : public QMainWindow, public Ui::MainWindow
void addDocumentsWidget(QWidget *pWidget);
void switchToDocumentsWidget();
signals:
void closeEvent_Signal( QCloseEvent *event );
public slots:
void onExportDone();
protected:
virtual void keyPressEvent(QKeyEvent *event);
virtual void closeEvent (QCloseEvent *event);
virtual QMenu* createPopupMenu ()
{

@ -51,6 +51,7 @@ void UBResources::init()
// Cursors
penCursor = QCursor(Qt::CrossCursor);
eraserCursor = QCursor(QPixmap(":/images/cursors/eraser.png"), 21, 21);
magnifierCursor = QCursor(QPixmap(":/images/cursors/magnifier.png"), 9, 9);
markerCursor = QCursor(QPixmap(":/images/cursors/marker.png"), 3, 30);
pointerCursor = QCursor(QPixmap(":/images/cursors/laser.png"), 2, 1);
handCursor = QCursor(Qt::OpenHandCursor);

@ -37,6 +37,7 @@ class UBResources : public QObject
QCursor penCursor;
QCursor eraserCursor;
QCursor magnifierCursor;
QCursor markerCursor;
QCursor pointerCursor;
QCursor handCursor;

@ -37,6 +37,7 @@ UBStylusPalette::UBStylusPalette(QWidget *parent, Qt::Orientation orient)
actions << UBApplication::mainWindow->actionPen;
actions << UBApplication::mainWindow->actionEraser;
actions << UBApplication::mainWindow->actionMagnifier;
actions << UBApplication::mainWindow->actionMarker;
actions << UBApplication::mainWindow->actionSelector;

@ -38,7 +38,8 @@ HEADERS += src/gui/UBThumbnailView.h \
src/gui/UBLibActionBar.h \
src/gui/UBLibraryWidget.h \
src/gui/UBLibPathViewer.h \
src/gui/UBUpdateDlg.h
src/gui/UBUpdateDlg.h \
src/gui/UBMagnifer.h
SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBFloatingPalette.cpp \
@ -79,7 +80,8 @@ SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBLibActionBar.cpp \
src/gui/UBLibraryWidget.cpp \
src/gui/UBLibPathViewer.cpp \
src/gui/UBUpdateDlg.cpp
src/gui/UBUpdateDlg.cpp \
src/gui/UBMagnifer.cpp
win32 {

@ -361,7 +361,7 @@ void UBGraphicsCompass::paintAngleDisplay(QPainter *painter)
qreal angle = angleInDegrees();
qreal angleValue = mDrawing ? - mSpanAngleInDegrees : angle;
QString angleText = QString("%1").arg(angleValue, 0, 'f', 1) + "°";
QString angleText = QString("%1").arg(angleValue, 0, 'f', 1) + "°";
painter->save();
painter->setFont(font());

@ -508,7 +508,7 @@ void UBGraphicsProtractor::paintAngleMarker(QPainter *painter)
if (angle != 0)
{
QString ang = QString("%1°").arg(angle,0, 'f', 1);
QString ang = QString("%1?°").arg(angle,0, 'f', 1);
QFont font2 = painter->font();
font2.setBold(true);
QFontMetricsF fm2(font2);

Loading…
Cancel
Save