Made more locale-related fixes, fixed issue 544 using codedread's help

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1550 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Alexis Deveria 2010-04-28 16:34:02 +00:00
parent 9be03c4746
commit 7d4978740e
4 changed files with 129 additions and 72 deletions

View File

@ -132,12 +132,13 @@
{"id": "zoom_panel", "title": "Change zoom level"},
{"id": "zoomLabel", "textContent": "zoom:"},
{"id": "sidepanel_handle", "textContent": "L a y e r s", "title": "Drag left/right to resize side panel"},
{"id": "main_icon", "title": "Main Menu"},
{"id": "tool_blur", "title": "Change gaussian blur value"},
{"id": "tool_position", "title": "Align Element to Page"},
{"id": "idLabel", "title": "Identify the element"},
{"id": "tool_openclose_path", "title": "Open/close sub-path"},
{"id": "tool_add_subpath", "title": "Add sub-path"},
{"id": "cur_linejoin", "title": "Add sub-path"},
{"id": "toggle_stroke_tools", "title": "Show/hide more stroke tools"},
{"id": "linejoin_miter", "title": "Linejoin: Miter"},
{"id": "linejoin_round", "title": "Linejoin: Round"},
{"id": "linejoin_bevel", "title": "Linejoin: Bevel"},
@ -150,6 +151,8 @@
{"id": "mode_connect", "title": "Connect two objects"},
{"id": "connector_no_arrow", "textContent": "No arrow"},
{
"js_strings": {
"QerrorsRevertToSource": "There were parsing errors in your SVG source.\nRevert back to original SVG source?",

View File

@ -450,7 +450,6 @@ script type="text/javascript" src="locale/locale.min.js"></script-->
</label>
<label class="stroke_tool">
<span>Dash:</span>
<select id="stroke_style" title="Change stroke dash style">
<option selected="selected" value="none">&mdash;</option>
<option value="2,2">...</option>

View File

@ -1354,10 +1354,16 @@
var changeBlur = function(ctl, val, noUndo) {
if(val == null) val = ctl.value;
$('#blur').val(val);
var complete = false;
if(!ctl || !ctl.handle) {
$('#blur_slider').slider('option', 'value', val);
complete = true;
}
if(noUndo) {
svgCanvas.setBlurNoUndo(val);
} else {
svgCanvas.setBlur(val, complete);
}
svgCanvas.setBlur(val, noUndo);
}
var operaRepaint = function() {
@ -1752,16 +1758,22 @@
addDropDown('#blur_dropdown', function() {
});
var slideStart = false;
$("#blur_slider").slider({
max: 10,
step: .1,
stop: function(evt, ui) {
slideStart = false;
changeBlur(ui);
$('#blur_dropdown li').show();
$(window).mouseup();
},
start: function() {
slideStart = true;
},
slide: function(evt, ui){
changeBlur(ui, null, true);
changeBlur(ui, null, slideStart);
}
});
@ -3528,15 +3540,19 @@
// Copy title for certain tool elements
var elems = {
'#stroke_color': '#tool_stroke .icon_label, #tool_stroke .color_block',
// '#group_opacity': '#tool_opacity', // Change lang file
// '#zoom': '#zoom_panel',
'#fill_color': '#tool_fill label, #tool_fill .color_block'
'#fill_color': '#tool_fill label, #tool_fill .color_block',
'#linejoin_miter': '#cur_linejoin',
'#linecap_butt': '#cur_linecap'
}
$.each(elems, function(source, dest) {
$(dest).attr('title', $(source).attr('title'));
$(dest).attr('title', $(source)[0].title);
});
// Copy alignment titles
$('#multiselected_panel div[id^=tool_align]').each(function() {
$('#tool_pos' + this.id.substr(10))[0].title = this.title;
});
}
};

View File

@ -7592,9 +7592,9 @@ function BatchCommand(text) {
this.changeSelectedAttribute("opacity", val);
};
this.getBlur = function() {
this.getBlur = function(elem) {
var val = 0;
var elem = selectedElements[0];
// var elem = selectedElements[0];
if(elem) {
var filter_url = elem.getAttribute('filter');
@ -7606,26 +7606,50 @@ function BatchCommand(text) {
}
}
return val;
};
(function() {
var cur_command = null;
var filter = null;
canvas.setBlurNoUndo = function(val) {
if(!filter) {
canvas.setBlur(val);
return;
}
canvas.changeSelectedAttributeNoUndo("stdDeviation", val, [filter.firstChild]);
}
function finishChange() {
var bCmd = canvas.finishUndoableChange();
cur_command.addSubCommand(bCmd);
addCommandToHistory(cur_command);
cur_command = null;
filter = null;
}
canvas.setBlur = function(val, complete) {
if(cur_command) {
finishChange();
return;
}
this.setBlur = function(val, noUndo) {
// Looks for associated blur, creates one if not found
var elem_id = selectedElements[0].id;
var filter = getElem(elem_id + '_blur');
var elem = selectedElements[0];
var elem_id = elem.id;
filter = getElem(elem_id + '_blur');
val -= 0;
var batchCmd = new BatchCommand();
// Blur found!
if(filter) {
if(val === 0) {
var parent = filter.parentNode;
$(filter).remove();
} else {
var elem = filter.firstChild;
if(noUndo) {
this.changeSelectedAttributeNoUndo('stdDeviation', val, [elem]);
} else {
this.changeSelectedAttribute('stdDeviation', val, [elem]);
}
RemoveElementCommand(filter, parent);
filter = null;
}
} else {
// Not found, so create
@ -7644,13 +7668,20 @@ function BatchCommand(text) {
filter.appendChild(newblur);
findDefs().appendChild(filter);
batchCmd.addSubCommand(new InsertElementCommand(filter));
}
var changes = {filter: elem.getAttribute('filter')};
if(val === 0) {
selectedElements[0].removeAttribute("filter");
elem.removeAttribute("filter");
batchCmd.addSubCommand(new ChangeElementCommand(elem, changes));
} else {
this.changeSelectedAttribute("filter", 'url(#' + elem_id + '_blur)');
batchCmd.addSubCommand(new ChangeElementCommand(elem, changes));
if(val > 3) {
// TODO: Create algorithm here where size is based on expected blur
assignAttributes(filter, {
@ -7666,7 +7697,15 @@ function BatchCommand(text) {
filter.removeAttribute('height');
}
}
cur_command = batchCmd;
canvas.beginUndoableChange("stdDeviation", [filter.firstChild]);
if(complete) {
canvas.setBlurNoUndo(val);
finishChange();
}
};
}());
this.getFillOpacity = function() {
return cur_shape.fill_opacity;