2007-09-15 03:08:25 +02:00
|
|
|
/**
|
|
|
|
* @author Mateusz
|
|
|
|
*/
|
2007-10-03 01:26:35 +02:00
|
|
|
ImageEditor.Main = {
|
2007-09-15 03:08:25 +02:00
|
|
|
initialize: function(imageFile) {
|
2007-09-15 03:19:43 +02:00
|
|
|
imageFile += '1234';
|
2007-10-03 01:26:35 +02:00
|
|
|
ImageEditor.crop = null;
|
2008-11-06 03:04:03 +01:00
|
|
|
ImageEditor.history = new ImageEditor.History.initialize();
|
2007-10-03 01:26:35 +02:00
|
|
|
ImageEditor.environment = new ImageEditor.Environment.initialize(imageFile);
|
2008-11-06 03:04:03 +01:00
|
|
|
ImageEditor.transformation = new ImageEditor.Transformation.initialize();
|
2007-10-03 01:26:35 +02:00
|
|
|
ImageEditor.resize = new ImageEditor.Resize.initialize($('imageContainer'));
|
2008-11-06 03:04:03 +01:00
|
|
|
ImageEditor.effects = new ImageEditor.Effects.Main.initialize();
|
2007-10-03 01:26:35 +02:00
|
|
|
ImageEditor.crop = new ImageEditor.Crop.initialize();
|
|
|
|
ImageEditor.documentBody = new ImageEditor.DocumentBody.initialize();
|
2008-11-06 03:04:03 +01:00
|
|
|
ImageEditor.adjust = new ImageEditor.Adjust.initialize();
|
2007-09-15 03:08:25 +02:00
|
|
|
this.originalImageFile = imageFile;
|
|
|
|
this.tottalyOriginalImageFile = imageFile;
|
2007-10-03 01:26:35 +02:00
|
|
|
this.onSaveClick = ImageEditor.Main.onSaveClick.bind(this);
|
|
|
|
this.onCloseClick = ImageEditor.Main.onCloseClick.bind(this);
|
2008-11-06 03:04:03 +01:00
|
|
|
this.enableFunctionality = ImageEditor.Main.enableFunctionality.bind(this);
|
|
|
|
this.disableFunctionality = ImageEditor.Main.disableFunctionality.bind(this);
|
2007-09-16 04:23:10 +02:00
|
|
|
Event.observe($('SaveButton'),'click',this.onSaveClick);
|
|
|
|
Event.observe($('ExitButton'),'click',this.onCloseClick);
|
|
|
|
Element.hide($('CurrentAction'));
|
2007-09-15 03:08:25 +02:00
|
|
|
},
|
2007-10-03 01:26:35 +02:00
|
|
|
|
2007-09-15 22:53:26 +02:00
|
|
|
onSaveClick: function() {
|
2007-09-15 03:08:25 +02:00
|
|
|
if(this.tottalyOriginalImageFile != $('image').src) {
|
2008-11-06 03:04:03 +01:00
|
|
|
ImageEditor.transformation.save(this.tottalyOriginalImageFile,$('image').src,this.onCloseClick);
|
2007-09-15 03:08:25 +02:00
|
|
|
} else {
|
2007-09-15 22:53:26 +02:00
|
|
|
this.onCloseClick();
|
2007-09-15 03:08:25 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2007-09-15 22:53:26 +02:00
|
|
|
onCloseClick: function() {
|
2007-11-07 05:50:09 +01:00
|
|
|
window.parent.imageEditorClosed();
|
2008-11-06 03:04:03 +01:00
|
|
|
ImageEditor.transformation.close(ImageEditor.Main.onCloseCallback.bind(this));
|
2007-09-15 22:53:26 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
onCloseCallback: function() {
|
|
|
|
Element.hide(window.frameElement);
|
2008-11-06 03:04:03 +01:00
|
|
|
},
|
2007-09-15 22:53:26 +02:00
|
|
|
|
2008-11-06 03:04:03 +01:00
|
|
|
enableFunctionality: function() {
|
|
|
|
ImageEditor.effects.enable();
|
|
|
|
ImageEditor.crop.enable();
|
|
|
|
ImageEditor.resize.enable();
|
|
|
|
ImageEditor.history.enable();
|
|
|
|
},
|
|
|
|
|
|
|
|
disableFunctionality: function() {
|
|
|
|
ImageEditor.effects.disable();
|
|
|
|
ImageEditor.crop.disable();
|
|
|
|
ImageEditor.resize.disable();
|
|
|
|
ImageEditor.history.disable();
|
|
|
|
}
|
|
|
|
}
|