Home | History | Annotate | Download | only in image_editor

Lines Matching defs:Mode

15  * @param {Array.<ImageEditor.Mode>} modes Available editor modes.
50 DOMContainers.mode, displayStringFunction,
97 var mode = this.modes_[i];
98 ImageUtil.setAttribute(mode.button_, 'disabled', !mode.isApplicable());
264 * ImageEditor.Mode represents a modal state dedicated to a specific operation.
265 * Inherits from ImageBuffer. Overlay to simplify the drawing of mode-specific
268 * @param {string} name The mode name.
269 * @param {string} title The mode title.
273 ImageEditor.Mode = function(name, title) {
279 ImageEditor.Mode.prototype = {__proto__: ImageBuffer.Overlay.prototype };
284 ImageEditor.Mode.prototype.getViewport = function() { return this.viewport_; };
289 ImageEditor.Mode.prototype.getImageView = function() {
294 * @return {string} The mode-specific message to be displayed when entering.
296 ImageEditor.Mode.prototype.getMessage = function() { return this.message_; };
299 * @return {boolean} True if the mode is applicable in the current context.
301 ImageEditor.Mode.prototype.isApplicable = function() { return true; };
304 * Called once after creating the mode button.
307 * @param {HTMLElement} button The mode button.
310 ImageEditor.Mode.prototype.bind = function(editor, button) {
319 * Called before entering the mode.
321 ImageEditor.Mode.prototype.setUp = function() {
327 * Create mode-specific controls here.
330 ImageEditor.Mode.prototype.createTools = function(toolbar) {};
333 * Called before exiting the mode.
335 ImageEditor.Mode.prototype.cleanUpUI = function() {
340 * Called after exiting the mode.
342 ImageEditor.Mode.prototype.cleanUpCaches = function() {};
348 ImageEditor.Mode.prototype.update = function(options) {
353 * Mark the editor mode as updated.
355 ImageEditor.Mode.prototype.markUpdated = function() {
360 * @return {boolean} True if the mode controls changed.
362 ImageEditor.Mode.prototype.isUpdated = function() { return this.updated_; };
365 * Resets the mode to a clean state.
367 ImageEditor.Mode.prototype.reset = function() {
375 * @param {string} name The mode name.
376 * @param {string} title The mode title.
380 ImageEditor.Mode.OneClick = function(name, title, command) {
381 ImageEditor.Mode.call(this, name, title);
386 ImageEditor.Mode.OneClick.prototype = {__proto__: ImageEditor.Mode.prototype};
391 ImageEditor.Mode.OneClick.prototype.getCommand = function() {
420 var mode = this.modes_[i];
421 mode.bind(this, createButton(mode.name,
422 mode.title,
423 this.enterMode.bind(this, mode)));
438 * @return {ImageEditor.Mode} The current mode.
443 * The user clicked on the mode button.
445 * @param {ImageEditor.Mode} mode The new mode.
447 ImageEditor.prototype.enterMode = function(mode) {
450 if (this.currentMode_ == mode) {
456 this.recordToolUse(mode.name);
461 // with the mode set up.
462 this.commandQueue_.executeWhenReady(this.setUpMode_.bind(this, mode));
466 * Set up the new editing mode.
468 * @param {ImageEditor.Mode} mode The mode.
471 ImageEditor.prototype.setUpMode_ = function(mode) {
472 this.currentTool_ = mode.button_;
476 this.currentMode_ = mode;
492 * The user clicked on 'OK' or 'Cancel' or on a different mode button.
521 * Leave the mode, commit only if required by the current mode.
530 * Enter the editor mode with the given name.
532 * @param {string} name Mode name.
537 var mode = this.modes_[i];
538 if (mode.name == name) {
539 if (!mode.button_.hasAttribute('disabled'))
540 this.enterMode(mode);
544 console.error('Mode "' + name + '" not found.');