Commit a72a21c9 authored by shibakaneki's avatar shibakaneki

Resolved dependencides

parents 11f8c6b5 2cf7ca7e
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -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>
......@@ -31,8 +31,8 @@
<!-- Div contenant le point d'interrogation pour les satistiques-->
<div class="question">
<img src="images/question.jpg" onclick='recevoirStats()'/>
</div>
</div>
<!-- Div principale pour les pays du monde-->
<div id="carteMonde1" class="carteMonde1">
<img src="images/Cartes/Carte_Monde_1.png" id="monde" class="monde" usemap="#monde1"/>
......
......@@ -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>
body {
background-color: white;
background-color: white;
}
.styleDiv
{
height:250px;
overflow:auto;
display:none;
font-size:11px;
font-family:Arial, "Times New Roman", Sans-serif;
border-left:solid 2px grey;
-moz-border-radius-topright: 1em;
-moz-border-radius-bottomright:1em;
height:250px;
overflow:auto;
display:none;
font-size:11px;
font-family:Arial, "Times New Roman", Sans-serif;
border-left:solid 2px grey;
-moz-border-radius-topright: 1em;
-moz-border-radius-bottomright:1em;
}
.question
{
position:absolute;
top:320px;
left:13px;
z-index:4;
position:absolute;
top:320px;
left:13px;
z-index:4;
}
.comparer
{
margin:auto;
font-family:Arial, "Times New Roman", Sans-serif;
margin:auto;
font-family:Arial, "Times New Roman", Sans-serif;
}
#souris
{
display:none;
display:none;
}
#coords
{
display:none;
display:none;
}
.curseur
{
cursor:pointer;
cursor:pointer;
}
.carteMonde1
{
border-style:solid;
border-width:3px;
height:332px;
width:654px;
border-color: black;
border-style:solid;
border-width:3px;
height:332px;
width:654px;
border-color: black;
}
.carte
{
position:absolute;
top:11px;
left:11px;
height:332px;
width:654px;
display: none;
opacity:0;
z-index:1;
position:absolute;
top:11px;
left:11px;
height:332px;
width:654px;
display: none;
opacity:0;
z-index:1;
}
.retour
{
position:absolute;
top:13px;
left:13px;
width:100px;
height:50.5px;
opacity:0;
z-index:2;
border: 1px black solid;
display: none;
cursor:pointer;
position:absolute;
top:13px;
left:13px;
width:100px;
height:50.5px;
opacity:0;
z-index:2;
border: 1px black solid;
display: none;
cursor:pointer;
}
#carteRetour
{
width:100%;
height: 100%;
width:100%;
height: 100%;
}
.texte
{
position:absolute;
top:300px;
left:0px;
width:654px;
position:absolute;
top:300px;
left:0px;
width:654px;
}
#description
{
font-size:18px;
text-align:center;
font-size:18px;
text-align:center;
}
.infoPays
{
position:absolute;
border:1px black solid;
background-color:rgba(150,150,150,0.5);
display:none;
z-index:2;
padding:4px;
position:absolute;
border:1px black solid;
background-color:rgba(150,150,150,0.5);
display:none;
z-index:2;
padding:4px;
}
.infoSupp
{
position:absolute;
top:344px;
border:1px black solid;
width:300px;
height:0px;
overflow:scroll;
position:absolute;
top:344px;
border:1px black solid;
width:300px;
height:0px;
overflow:scroll;
}
#infoSupp2
{
position:absolute;
top:344px;
left:320px;
position:absolute;
top:344px;
left:320px;
}
.nomPays
{
font-weight:bold;
color:black;
font-weight:bold;
color:black;
}
.capitalePays
{
color:white;
color:white;
}
.cacher
{
display:none;
display:none;
}
.drapeaux
{
height:40px;
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;
}
\ No newline at end of file
......@@ -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
......
/*
* 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
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
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);
});
};
\ No newline at end of file
/**
* .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
/*
* 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;
}
});
\ No newline at end of file
(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);
\ No newline at end of file
body {
font:70% Verdana, Arial, Helvetica, sans-serif;
color: orange;
color: black;
}
\ No newline at end of file
......@@ -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>
......
......@@ -1913,7 +1913,7 @@ void UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsItemFromSvg(QGraphicsItem* g
{
if (!svgX.isNull() && !svgY.isNull())
{
#ifndef Q_WS_X11
#ifdef Q_WS_WIN
gItem->setPos(svgX.toString().toFloat(), svgY.toString().toFloat());
#endif
}
......
......@@ -635,7 +635,7 @@ void UBDocumentPublisher::sendUbw(QString username, QString password)
request.setHeader(QNetworkRequest::ContentLengthHeader,datatoSend.size());
QString b64Auth = getBase64Of(QString("%0:%1").arg(username).arg(password));
request.setRawHeader("Authorization", QString("Basic %0").arg(b64Auth).toAscii().constData());
request.setRawHeader("Host", "sankore.devxwiki.com");
request.setRawHeader("Host", "planete.sankore.org");
request.setRawHeader("Accept", "*/*");
request.setRawHeader("Accept-Language", "en-US,*");
......
......@@ -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,9 +687,10 @@ 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();
emit controlViewportChanged();
......
......@@ -855,7 +855,10 @@ UBBoardView::setToolCursor (int tool)
controlViewport->setCursor (UBResources::resources ()->penCursor);
break;
case UBStylusTool::Eraser:
controlViewport->setCursor (UBResources::resources ()->eraserCursor);
controlViewport->setCursor (UBResources::resources ()->eraserCursor);
break;
case UBStylusTool::Magnifier:
controlViewport->setCursor (UBResources::resources ()->magnifierCursor);
break;
case UBStylusTool::Marker:
controlViewport->setCursor (UBResources::resources ()->markerCursor);
......
......@@ -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,7 +233,8 @@ 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"
......@@ -90,6 +92,8 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent)
, mCurrentStroke(0)
, mShouldUseOMP(true)
, mItemCount(0)
, magniferControlViewWidget(0)
, magniferDisplayViewWidget(0)
{
#ifdef __ppc__
......@@ -234,6 +238,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;
......@@ -307,6 +320,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;
}
......@@ -331,15 +349,25 @@ 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)
......@@ -397,6 +425,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)
{
......
......@@ -45,6 +45,7 @@ class UBDocumentProxy;
class UBGraphicsCurtainItem;
class UBGraphicsStroke;
class UBGraphicsCache;
class UBMagnifer;
const double PI = 4.0 * atan(1.0);
......@@ -291,6 +292,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);
......@@ -352,6 +356,9 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
//int mMesure1Ms, mMesure2Ms;
bool mHasCache;
UBMagnifer *magniferControlViewWidget;
UBMagnifer *magniferDisplayViewWidget;
};
#endif /* UBGRAPHICSSCENE_H_ */
#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);
}
#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 ()
{
......
......@@ -49,15 +49,16 @@ UBResources* UBResources::resources()
void UBResources::init()
{
// Cursors
penCursor = QCursor(Qt::CrossCursor);
eraserCursor = QCursor(QPixmap(":/images/cursors/eraser.png"), 21, 21);
markerCursor = QCursor(QPixmap(":/images/cursors/marker.png"), 3, 30);
pointerCursor = QCursor(QPixmap(":/images/cursors/laser.png"), 2, 1);
handCursor = QCursor(Qt::OpenHandCursor);
zoomInCursor = QCursor(QPixmap(":/images/cursors/zoomIn.png"), 9, 9);
zoomOutCursor = QCursor(QPixmap(":/images/cursors/zoomOut.png"), 9, 9);
arrowCursor = QCursor(Qt::ArrowCursor);
textCursor = QCursor(Qt::ArrowCursor);
rotateCursor = QCursor(QPixmap(":/images/cursors/rotate.png"), 16, 16);
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);
zoomInCursor = QCursor(QPixmap(":/images/cursors/zoomIn.png"), 9, 9);
zoomOutCursor = QCursor(QPixmap(":/images/cursors/zoomOut.png"), 9, 9);
arrowCursor = QCursor(Qt::ArrowCursor);
textCursor = QCursor(Qt::ArrowCursor);
rotateCursor = QCursor(QPixmap(":/images/cursors/rotate.png"), 16, 16);
drawLineRulerCursor = QCursor(QPixmap(":/images/cursors/drawRulerLine.png"), 3, 12);
}
......@@ -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;
......
......@@ -44,6 +44,7 @@ HEADERS += src/gui/UBThumbnailView.h \
src/gui/UBRightPalette.h \
src/gui/UBPageNavigationWidget.h \
src/gui/UBLibWidget.h
src/gui/UBMagnifer.h
SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBFloatingPalette.cpp \
......@@ -90,6 +91,7 @@ SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBRightPalette.cpp \
src/gui/UBPageNavigationWidget.cpp \
src/gui/UBLibWidget.cpp
src/gui/UBMagnifer.cpp
win32 {
......
......@@ -25,6 +25,8 @@ QAtomicInt XPDFRenderer::sInstancesCount = 0;
XPDFRenderer::XPDFRenderer(const QString &filename, bool importingFile)
: mDocument(0)
, mpSplashBitmap(0)
, mSplash(0)
{
if (!globalParams)
{
......@@ -48,6 +50,17 @@ XPDFRenderer::XPDFRenderer(const QString &filename, bool importingFile)
XPDFRenderer::~XPDFRenderer()
{
qDeleteAll(mThumbs);
mThumbs.clear();
qDeleteAll(mNumPageToPageMap);
mNumPageToPageMap.clear();
if(mSplash){
delete mSplash;
mSplash = NULL;
}
if (mDocument)
{
delete mDocument;
......@@ -162,7 +175,7 @@ void XPDFRenderer::render(QPainter *p, int pageNumber, const QRectF &bounds)
{
// Generate the thumbnail
mThumbs << *createPDFImage(pageNumber, xscale, yscale, bounds);
mThumbs << createPDFImage(pageNumber, xscale, yscale, bounds);
mThumbMap[pageNumber - 1] = true;
if(pageNumber == mDocument->getNumPages())
{
......@@ -175,7 +188,7 @@ void XPDFRenderer::render(QPainter *p, int pageNumber, const QRectF &bounds)
if(!mPagesMap[pageNumber - 1] || bZoomChanged)
{
// Generate the page
mNumPageToPageMap[pageNumber] = *createPDFImage(pageNumber, xscale, yscale, bounds);
mNumPageToPageMap[pageNumber] = createPDFImage(pageNumber, xscale, yscale, bounds);
mPagesMap[pageNumber - 1] = true;
if(mPagesMap.size() == mDocument->getNumPages())
{
......@@ -184,7 +197,7 @@ void XPDFRenderer::render(QPainter *p, int pageNumber, const QRectF &bounds)
}
}
QImage pdfImage;
QImage *pdfImage;
if(!bThumbGenerated || bFirstThumbnail)
{
......@@ -197,10 +210,7 @@ void XPDFRenderer::render(QPainter *p, int pageNumber, const QRectF &bounds)
QTransform savedTransform = p->worldTransform();
p->resetTransform();
QTime t;
t.start();
p->drawImage(QPointF(savedTransform.dx() + mSliceX, savedTransform.dy() + mSliceY), pdfImage);
//qDebug() << "XPDFRenderer::render(...) execution time: " << t.elapsed() << "ms";
p->drawImage(QPointF(savedTransform.dx() + mSliceX, savedTransform.dy() + mSliceY), *pdfImage);
p->setWorldTransform(savedTransform);
}
}
......@@ -211,6 +221,8 @@ QImage* XPDFRenderer::createPDFImage(int pageNumber, const qreal xscale, const q
if (isValid())
{
SplashColor paperColor = {0xFF, 0xFF, 0xFF}; // white
if(mSplash)
delete mSplash;
mSplash = new SplashOutputDev(splashModeRGB8, 1, gFalse, paperColor);
mSplash->startDoc(mDocument->getXRef());
int hResolution = 72;
......@@ -241,6 +253,7 @@ QImage* XPDFRenderer::createPDFImage(int pageNumber, const qreal xscale, const q
}
mpSplashBitmap = mSplash->getBitmap();
delete img;
img = new QImage(mpSplashBitmap->getDataPtr(), mpSplashBitmap->getWidth(), mpSplashBitmap->getHeight(), mpSplashBitmap->getWidth() * 3, QImage::Format_RGB888);
}
return img;
......
......@@ -51,10 +51,10 @@ class XPDFRenderer : public PDFRenderer
QImage* createPDFImage(int pageNumber, const qreal xscale = 0.5, const qreal yscale = 0.5, const QRectF &bounds = QRectF());
PDFDoc *mDocument;
QList<QImage> mThumbs;
QList<QImage*> mThumbs;
QMap<int, bool> mPagesMap;
QMap<int, bool> mThumbMap;
QMap<int, QImage> mNumPageToPageMap;
QMap<int, QImage*> mNumPageToPageMap;
static QAtomicInt sInstancesCount;
qreal mSliceX;
qreal mSliceY;
......
......@@ -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);
......
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