2008-12-01 14:51:43 -05:00
|
|
|
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
|
2008-10-31 19:09:46 -04:00
|
|
|
|
2009-02-02 18:02:16 -05:00
|
|
|
const Big = imports.gi.Big;
|
2008-11-20 19:53:11 -05:00
|
|
|
const Clutter = imports.gi.Clutter;
|
|
|
|
const Gio = imports.gi.Gio;
|
|
|
|
const Gtk = imports.gi.Gtk;
|
2009-02-02 18:02:16 -05:00
|
|
|
const Mainloop = imports.mainloop;
|
2008-11-20 19:53:11 -05:00
|
|
|
const Shell = imports.gi.Shell;
|
2009-02-02 18:02:16 -05:00
|
|
|
const Signals = imports.signals;
|
2009-04-13 14:45:58 -04:00
|
|
|
const Lang = imports.lang;
|
2009-02-02 18:02:16 -05:00
|
|
|
|
2008-12-09 17:10:43 -05:00
|
|
|
const AppDisplay = imports.ui.appDisplay;
|
2008-12-19 23:27:57 -05:00
|
|
|
const DocDisplay = imports.ui.docDisplay;
|
2009-02-03 17:58:33 -05:00
|
|
|
const GenericDisplay = imports.ui.genericDisplay;
|
2009-02-26 17:05:35 -05:00
|
|
|
const Link = imports.ui.link;
|
2009-02-02 18:02:16 -05:00
|
|
|
const Main = imports.ui.main;
|
|
|
|
const Panel = imports.ui.panel;
|
2009-02-10 11:12:58 -05:00
|
|
|
const Tweener = imports.ui.tweener;
|
2009-02-02 18:02:16 -05:00
|
|
|
const Workspaces = imports.ui.workspaces;
|
2008-10-31 19:09:46 -04:00
|
|
|
|
2009-04-21 20:23:06 -04:00
|
|
|
const ROOT_OVERLAY_COLOR = new Clutter.Color();
|
|
|
|
ROOT_OVERLAY_COLOR.from_pixel(0x000000bb);
|
|
|
|
|
|
|
|
// The factor to scale the overlay wallpaper with. This should not be less
|
|
|
|
// than 3/2, because the rule of thirds is used for positioning (see below).
|
|
|
|
const BACKGROUND_SCALE = 2;
|
2008-10-31 19:09:46 -04:00
|
|
|
|
2009-02-03 17:58:33 -05:00
|
|
|
const LABEL_HEIGHT = 16;
|
2009-06-02 13:13:51 -04:00
|
|
|
const DASH_MIN_WIDTH = 250;
|
2009-07-03 22:32:23 -04:00
|
|
|
const DASH_OUTER_PADDING = 4;
|
2009-06-09 16:11:51 -04:00
|
|
|
const DASH_SECTION_PADDING = 6;
|
2009-06-02 13:13:51 -04:00
|
|
|
const DASH_SECTION_SPACING = 6;
|
2009-06-08 19:04:52 -04:00
|
|
|
const DASH_CORNER_RADIUS = 5;
|
2009-02-20 11:57:30 -05:00
|
|
|
// This is the height of section components other than the item display.
|
2009-06-09 16:11:51 -04:00
|
|
|
const DASH_SECTION_MISC_HEIGHT = (LABEL_HEIGHT + DASH_SECTION_SPACING) * 2 + DASH_SECTION_PADDING;
|
2009-06-02 13:13:51 -04:00
|
|
|
const DASH_SEARCH_BG_COLOR = new Clutter.Color();
|
|
|
|
DASH_SEARCH_BG_COLOR.from_pixel(0xffffffff);
|
|
|
|
const DASH_TEXT_COLOR = new Clutter.Color();
|
|
|
|
DASH_TEXT_COLOR.from_pixel(0xffffffff);
|
2008-11-20 19:53:11 -05:00
|
|
|
|
2008-12-01 14:51:43 -05:00
|
|
|
// Time for initial animation going into overlay mode
|
2009-06-02 13:43:34 -04:00
|
|
|
const ANIMATION_TIME = 0.25;
|
2008-11-06 09:00:14 -05:00
|
|
|
|
2009-02-10 17:38:06 -05:00
|
|
|
// We divide the screen into a grid of rows and columns, which we use
|
|
|
|
// to help us position the overlay components, such as the side panel
|
|
|
|
// that lists applications and documents, the workspaces display, and
|
|
|
|
// the button for adding additional workspaces.
|
|
|
|
// In the regular mode, the side panel takes up one column on the left,
|
|
|
|
// and the workspaces display takes up the remaining columns.
|
|
|
|
// In the expanded side panel display mode, the side panel takes up two
|
|
|
|
// columns, and the workspaces display slides all the way to the right,
|
|
|
|
// being visible only in the last quarter of the right-most column.
|
|
|
|
// In the future, this mode will have more components, such as a display
|
|
|
|
// of documents which were recently opened with a given application, which
|
|
|
|
// will take up the remaining sections of the display.
|
|
|
|
|
|
|
|
const WIDE_SCREEN_CUT_OFF_RATIO = 1.4;
|
|
|
|
|
|
|
|
const COLUMNS_REGULAR_SCREEN = 4;
|
|
|
|
const ROWS_REGULAR_SCREEN = 8;
|
|
|
|
const COLUMNS_WIDE_SCREEN = 5;
|
|
|
|
const ROWS_WIDE_SCREEN = 10;
|
2009-02-03 17:58:33 -05:00
|
|
|
|
2009-06-02 13:13:51 -04:00
|
|
|
// Padding around workspace grid / Spacing between Dash and Workspaces
|
2009-02-10 17:38:06 -05:00
|
|
|
const WORKSPACE_GRID_PADDING = 12;
|
|
|
|
|
|
|
|
const COLUMNS_FOR_WORKSPACES_REGULAR_SCREEN = 3;
|
|
|
|
const ROWS_FOR_WORKSPACES_REGULAR_SCREEN = 6;
|
|
|
|
|
|
|
|
const COLUMNS_FOR_WORKSPACES_WIDE_SCREEN = 4;
|
|
|
|
const ROWS_FOR_WORKSPACES_WIDE_SCREEN = 8;
|
|
|
|
|
2009-04-01 15:51:17 -04:00
|
|
|
// A multi-state; PENDING is used during animations
|
|
|
|
const STATE_ACTIVE = true;
|
|
|
|
const STATE_PENDING_INACTIVE = false;
|
|
|
|
const STATE_INACTIVE = false;
|
|
|
|
|
2009-06-08 19:04:52 -04:00
|
|
|
// The dash has a slightly transparent blue background with a gradient.
|
|
|
|
const DASH_LEFT_COLOR = new Clutter.Color();
|
2009-07-24 17:25:20 -04:00
|
|
|
DASH_LEFT_COLOR.from_pixel(0x0d131fbb);
|
2009-06-08 19:04:52 -04:00
|
|
|
const DASH_MIDDLE_COLOR = new Clutter.Color();
|
2009-07-24 17:25:20 -04:00
|
|
|
DASH_MIDDLE_COLOR.from_pixel(0x0d131faa);
|
2009-06-08 19:04:52 -04:00
|
|
|
const DASH_RIGHT_COLOR = new Clutter.Color();
|
2009-07-24 17:25:20 -04:00
|
|
|
DASH_RIGHT_COLOR.from_pixel(0x0d131fcc);
|
2009-06-08 19:04:52 -04:00
|
|
|
|
2009-06-16 14:50:38 -04:00
|
|
|
const DASH_BORDER_COLOR = new Clutter.Color();
|
2009-07-24 17:25:20 -04:00
|
|
|
DASH_BORDER_COLOR.from_pixel(0x213b5dfa);
|
2009-06-08 19:04:52 -04:00
|
|
|
|
2009-06-16 14:50:38 -04:00
|
|
|
const DASH_BORDER_WIDTH = 2;
|
2009-06-08 19:04:52 -04:00
|
|
|
|
2009-06-16 14:50:38 -04:00
|
|
|
// The results and details panes have a somewhat transparent blue background with a gradient.
|
|
|
|
const PANE_LEFT_COLOR = new Clutter.Color();
|
2009-07-24 17:25:20 -04:00
|
|
|
PANE_LEFT_COLOR.from_pixel(0x0d131ff4);
|
2009-06-16 14:50:38 -04:00
|
|
|
const PANE_MIDDLE_COLOR = new Clutter.Color();
|
2009-07-24 17:25:20 -04:00
|
|
|
PANE_MIDDLE_COLOR.from_pixel(0x0d131ffa);
|
2009-06-16 14:50:38 -04:00
|
|
|
const PANE_RIGHT_COLOR = new Clutter.Color();
|
2009-07-24 17:25:20 -04:00
|
|
|
PANE_RIGHT_COLOR.from_pixel(0x0d131ff4);
|
2009-06-08 19:04:52 -04:00
|
|
|
|
|
|
|
const SHADOW_COLOR = new Clutter.Color();
|
|
|
|
SHADOW_COLOR.from_pixel(0x00000033);
|
|
|
|
const TRANSPARENT_COLOR = new Clutter.Color();
|
|
|
|
TRANSPARENT_COLOR.from_pixel(0x00000000);
|
|
|
|
|
|
|
|
const SHADOW_WIDTH = 6;
|
|
|
|
|
2009-06-24 18:24:48 -04:00
|
|
|
const NUMBER_OF_SECTIONS_IN_SEARCH = 2;
|
|
|
|
|
2009-02-10 17:38:06 -05:00
|
|
|
let wideScreen = false;
|
|
|
|
let displayGridColumnWidth = null;
|
|
|
|
let displayGridRowHeight = null;
|
2008-12-22 16:50:23 -05:00
|
|
|
|
2009-04-13 14:45:58 -04:00
|
|
|
function SearchEntry(width) {
|
|
|
|
this._init(width);
|
|
|
|
}
|
|
|
|
|
|
|
|
SearchEntry.prototype = {
|
2009-07-03 22:32:23 -04:00
|
|
|
_init : function() {
|
2009-04-13 14:45:58 -04:00
|
|
|
this.actor = new Big.Box({ orientation: Big.BoxOrientation.HORIZONTAL,
|
|
|
|
y_align: Big.BoxAlignment.CENTER,
|
2009-06-02 13:13:51 -04:00
|
|
|
background_color: DASH_SEARCH_BG_COLOR,
|
2009-04-13 14:45:58 -04:00
|
|
|
corner_radius: 4,
|
|
|
|
spacing: 4,
|
|
|
|
padding_left: 4,
|
|
|
|
padding_right: 4,
|
|
|
|
height: 24
|
|
|
|
});
|
|
|
|
|
|
|
|
let icontheme = Gtk.IconTheme.get_default();
|
|
|
|
let searchIconTexture = new Clutter.Texture({});
|
|
|
|
let searchIconPath = icontheme.lookup_icon('gtk-find', 16, 0).get_filename();
|
|
|
|
searchIconTexture.set_from_file(searchIconPath);
|
|
|
|
this.actor.append(searchIconTexture, 0);
|
|
|
|
|
|
|
|
// We need to initialize the text for the entry to have the cursor displayed
|
|
|
|
// in it. See http://bugzilla.openedhand.com/show_bug.cgi?id=1365
|
|
|
|
this.entry = new Clutter.Text({ font_name: "Sans 14px",
|
|
|
|
editable: true,
|
|
|
|
activatable: true,
|
|
|
|
singleLineMode: true,
|
|
|
|
text: ""
|
|
|
|
});
|
|
|
|
this.entry.connect('text-changed', Lang.bind(this, function (e) {
|
|
|
|
let text = this.entry.text;
|
|
|
|
}));
|
|
|
|
this.actor.append(this.entry, Big.BoxPackFlags.EXPAND);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2009-06-25 19:14:29 -04:00
|
|
|
function ItemResults(resultsWidth, resultsHeight, displayClass, labelText) {
|
|
|
|
this._init(resultsWidth, resultsHeight, displayClass, labelText);
|
2009-06-17 13:25:07 -04:00
|
|
|
}
|
|
|
|
|
2009-06-25 19:14:29 -04:00
|
|
|
ItemResults.prototype = {
|
|
|
|
_init: function(resultsWidth, resultsHeight, displayClass, labelText) {
|
|
|
|
this._resultsWidth = resultsWidth;
|
2009-06-24 18:24:48 -04:00
|
|
|
this._resultsHeight = resultsHeight;
|
|
|
|
|
2009-07-04 12:46:35 -04:00
|
|
|
this.actor = new Big.Box({ orientation: Big.BoxOrientation.VERTICAL,
|
|
|
|
height: resultsHeight,
|
2009-06-17 13:25:07 -04:00
|
|
|
padding: DASH_SECTION_PADDING + DASH_BORDER_WIDTH,
|
|
|
|
spacing: DASH_SECTION_SPACING });
|
|
|
|
|
2009-06-24 18:24:48 -04:00
|
|
|
this._resultsText = new Clutter.Text({ color: DASH_TEXT_COLOR,
|
|
|
|
font_name: "Sans Bold 14px",
|
2009-06-25 19:14:29 -04:00
|
|
|
text: labelText });
|
2009-07-04 12:46:35 -04:00
|
|
|
|
|
|
|
this.resultsContainer = new Big.Box({ orientation: Big.BoxOrientation.HORIZONTAL,
|
|
|
|
spacing: 4 });
|
|
|
|
this.navContainer = new Big.Box({ orientation: Big.BoxOrientation.VERTICAL });
|
|
|
|
this.resultsContainer.append(this.navContainer, Big.BoxPackFlags.NONE);
|
2009-06-24 18:24:48 -04:00
|
|
|
|
|
|
|
// LABEL_HEIGHT is the height of this._resultsText and GenericDisplay.LABEL_HEIGHT is the height
|
|
|
|
// of the display controls.
|
|
|
|
this._displayHeight = resultsHeight - LABEL_HEIGHT - GenericDisplay.LABEL_HEIGHT - DASH_SECTION_SPACING * 2;
|
2009-07-04 15:30:12 -04:00
|
|
|
this.display = new displayClass(resultsWidth);
|
2009-06-17 13:25:07 -04:00
|
|
|
|
2009-07-04 12:46:35 -04:00
|
|
|
this.navArea = this.display.getNavigationArea();
|
|
|
|
if (this.navArea)
|
|
|
|
this.navContainer.append(this.navArea, Big.BoxPackFlags.EXPAND);
|
|
|
|
|
|
|
|
this.resultsContainer.append(this.display.actor, Big.BoxPackFlags.EXPAND);
|
2009-06-17 13:25:07 -04:00
|
|
|
|
2009-06-24 18:24:48 -04:00
|
|
|
this.controlBox = new Big.Box({ x_align: Big.BoxAlignment.CENTER });
|
|
|
|
this.controlBox.append(this.display.displayControl, Big.BoxPackFlags.NONE);
|
|
|
|
|
2009-07-04 12:46:35 -04:00
|
|
|
this._unsetSearchMode();
|
2009-06-24 18:24:48 -04:00
|
|
|
},
|
2009-06-17 13:25:07 -04:00
|
|
|
|
2009-06-24 18:24:48 -04:00
|
|
|
_setSearchMode: function() {
|
2009-07-04 12:46:35 -04:00
|
|
|
if (this.navArea)
|
|
|
|
this.navArea.hide();
|
2009-06-24 18:24:48 -04:00
|
|
|
this.actor.height = this._resultsHeight / NUMBER_OF_SECTIONS_IN_SEARCH;
|
|
|
|
let displayHeight = this._displayHeight - this._resultsHeight * (NUMBER_OF_SECTIONS_IN_SEARCH - 1) / NUMBER_OF_SECTIONS_IN_SEARCH;
|
|
|
|
this.actor.remove_all();
|
|
|
|
this.actor.append(this._resultsText, Big.BoxPackFlags.NONE);
|
2009-07-04 12:46:35 -04:00
|
|
|
this.actor.append(this.resultsContainer, Big.BoxPackFlags.EXPAND);
|
2009-06-24 18:24:48 -04:00
|
|
|
this.actor.append(this.controlBox, Big.BoxPackFlags.END);
|
|
|
|
},
|
|
|
|
|
|
|
|
_unsetSearchMode: function() {
|
2009-07-04 12:46:35 -04:00
|
|
|
if (this.navArea)
|
|
|
|
this.navArea.show();
|
2009-06-24 18:24:48 -04:00
|
|
|
this.actor.height = this._resultsHeight;
|
|
|
|
this.actor.remove_all();
|
|
|
|
this.actor.append(this._resultsText, Big.BoxPackFlags.NONE);
|
2009-07-04 12:46:35 -04:00
|
|
|
this.actor.append(this.resultsContainer, Big.BoxPackFlags.EXPAND);
|
2009-06-24 18:24:48 -04:00
|
|
|
this.actor.append(this.controlBox, Big.BoxPackFlags.END);
|
2009-06-17 13:25:07 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-02 13:13:51 -04:00
|
|
|
function Dash() {
|
2009-03-31 14:12:33 -04:00
|
|
|
this._init();
|
2008-11-20 19:53:11 -05:00
|
|
|
}
|
|
|
|
|
2009-06-02 13:13:51 -04:00
|
|
|
Dash.prototype = {
|
2009-03-31 14:12:33 -04:00
|
|
|
_init : function() {
|
2008-12-01 14:51:43 -05:00
|
|
|
let me = this;
|
|
|
|
|
2009-06-24 18:24:48 -04:00
|
|
|
this._moreAppsMode = false;
|
|
|
|
this._moreDocsMode = false;
|
2009-03-31 14:12:33 -04:00
|
|
|
|
2009-04-21 20:23:06 -04:00
|
|
|
this._width = displayGridColumnWidth;
|
2009-02-03 17:58:33 -05:00
|
|
|
|
2009-06-17 18:12:02 -04:00
|
|
|
this._displayWidth = displayGridColumnWidth - DASH_SECTION_PADDING * 2;
|
2009-07-04 12:46:35 -04:00
|
|
|
this._resultsWidth = displayGridColumnWidth;
|
|
|
|
this._detailsWidth = displayGridColumnWidth * 2;
|
2009-03-31 14:12:33 -04:00
|
|
|
|
2009-04-28 15:35:36 -04:00
|
|
|
let global = Shell.Global.get();
|
|
|
|
|
2009-07-24 17:25:20 -04:00
|
|
|
let dashHeight = global.screen_height - Panel.PANEL_HEIGHT;
|
|
|
|
let resultsHeight = global.screen_height - Panel.PANEL_HEIGHT;
|
|
|
|
let detailsHeight = global.screen_height - Panel.PANEL_HEIGHT;
|
2009-04-28 15:35:36 -04:00
|
|
|
|
2009-07-07 05:51:56 -04:00
|
|
|
// Size the actor to 0x0 so as not to interfere with DND
|
|
|
|
this.actor = new Clutter.Group({ width: 0, height: 0 });
|
2009-04-21 20:23:06 -04:00
|
|
|
this.actor.height = global.screen_height;
|
2008-12-01 14:51:43 -05:00
|
|
|
|
2009-07-03 22:32:23 -04:00
|
|
|
|
2009-06-30 19:45:56 -04:00
|
|
|
// dashPane, as well as results and details panes need to be reactive so that the clicks in unoccupied places on them
|
2009-07-03 22:32:23 -04:00
|
|
|
// are not passed to the transparent background underneath them. This background is used for the workspaces area when
|
2009-06-30 19:45:56 -04:00
|
|
|
// the additional dash panes are being shown and it handles clicks by closing the additional panes, so that the user
|
|
|
|
// can interact with the workspaces. However, this behavior is not desirable when the click is actually over a pane.
|
|
|
|
//
|
|
|
|
// We have to make the individual panes reactive instead of making the whole dash actor reactive because the width
|
|
|
|
// of the Group actor ends up including the width of its hidden children, so we were getting a reactive object as
|
|
|
|
// wide as the details pane that was blocking the clicks to the workspaces underneath it even when the details pane
|
|
|
|
// was actually hidden.
|
2009-06-08 19:04:52 -04:00
|
|
|
let dashPane = new Big.Box({ orientation: Big.BoxOrientation.HORIZONTAL,
|
|
|
|
x: 0,
|
2009-07-24 17:25:20 -04:00
|
|
|
y: Panel.PANEL_HEIGHT,
|
2009-06-08 19:04:52 -04:00
|
|
|
width: this._width + SHADOW_WIDTH,
|
2009-07-24 17:25:20 -04:00
|
|
|
height: dashHeight,
|
2009-06-30 19:45:56 -04:00
|
|
|
reactive: true});
|
2009-06-08 19:04:52 -04:00
|
|
|
|
|
|
|
let dashBackground = new Big.Box({ orientation: Big.BoxOrientation.HORIZONTAL,
|
|
|
|
width: this._width,
|
2009-07-24 17:25:20 -04:00
|
|
|
height: dashHeight });
|
2009-06-08 19:04:52 -04:00
|
|
|
|
|
|
|
dashPane.append(dashBackground, Big.BoxPackFlags.EXPAND);
|
|
|
|
|
|
|
|
let dashLeft = global.create_horizontal_gradient(DASH_LEFT_COLOR,
|
|
|
|
DASH_MIDDLE_COLOR);
|
|
|
|
let dashRight = global.create_horizontal_gradient(DASH_MIDDLE_COLOR,
|
|
|
|
DASH_RIGHT_COLOR);
|
|
|
|
let dashShadow = global.create_horizontal_gradient(SHADOW_COLOR,
|
|
|
|
TRANSPARENT_COLOR);
|
|
|
|
dashShadow.set_width(SHADOW_WIDTH);
|
|
|
|
|
|
|
|
dashBackground.append(dashLeft, Big.BoxPackFlags.EXPAND);
|
|
|
|
dashBackground.append(dashRight, Big.BoxPackFlags.EXPAND);
|
|
|
|
dashPane.append(dashShadow, Big.BoxPackFlags.NONE);
|
2009-07-03 22:32:23 -04:00
|
|
|
|
2009-06-08 19:04:52 -04:00
|
|
|
this.actor.add_actor(dashPane);
|
|
|
|
|
2009-07-03 22:32:23 -04:00
|
|
|
this.dashOuterContainer = new Big.Box({ orientation: Big.BoxOrientation.VERTICAL,
|
|
|
|
x: 0,
|
2009-07-24 17:25:20 -04:00
|
|
|
y: dashPane.y,
|
2009-07-03 22:32:23 -04:00
|
|
|
width: this._width,
|
2009-07-24 17:25:20 -04:00
|
|
|
height: dashHeight,
|
2009-07-03 22:32:23 -04:00
|
|
|
padding: DASH_OUTER_PADDING
|
|
|
|
});
|
|
|
|
this.actor.add_actor(this.dashOuterContainer);
|
|
|
|
this.dashContainer = new Big.Box({ orientation: Big.BoxOrientation.VERTICAL });
|
|
|
|
this.dashOuterContainer.append(this.dashContainer, Big.BoxPackFlags.EXPAND);
|
|
|
|
|
|
|
|
this._searchEntry = new SearchEntry();
|
|
|
|
this.dashContainer.append(this._searchEntry.actor, Big.BoxPackFlags.NONE);
|
2009-06-17 13:25:07 -04:00
|
|
|
|
2009-06-22 19:06:50 -04:00
|
|
|
this._searchQueued = false;
|
|
|
|
this._searchEntry.entry.connect('text-changed', function (se, prop) {
|
|
|
|
if (me._searchQueued)
|
|
|
|
return;
|
|
|
|
me._searchQueued = true;
|
|
|
|
Mainloop.timeout_add(250, function() {
|
|
|
|
// Strip leading and trailing whitespace
|
|
|
|
let text = me._searchEntry.entry.text.replace(/^\s+/g, "").replace(/\s+$/g, "");
|
|
|
|
me._searchQueued = false;
|
|
|
|
me._resultsAppsSection.display.setSearch(text);
|
|
|
|
me._resultsDocsSection.display.setSearch(text);
|
2009-06-24 18:24:48 -04:00
|
|
|
if (text == '')
|
|
|
|
me._unsetSearchMode();
|
|
|
|
else
|
|
|
|
me._setSearchMode();
|
|
|
|
|
2009-06-22 19:06:50 -04:00
|
|
|
return false;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
this._searchEntry.entry.connect('activate', function (se) {
|
|
|
|
// only one of the displays will have an item selected, so it's ok to
|
|
|
|
// call activateSelected() on all of them
|
|
|
|
me._docDisplay.activateSelected();
|
|
|
|
me._resultsAppsSection.display.activateSelected();
|
|
|
|
me._resultsDocsSection.display.activateSelected();
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
this._searchEntry.entry.connect('key-press-event', function (se, e) {
|
|
|
|
let symbol = Shell.get_event_key_symbol(e);
|
|
|
|
if (symbol == Clutter.Escape) {
|
|
|
|
// Escape will keep clearing things back to the desktop. First, if
|
|
|
|
// we have active text, we remove it.
|
|
|
|
if (me._searchEntry.entry.text != '')
|
|
|
|
me._searchEntry.entry.text = '';
|
|
|
|
// Next, if we're in one of the "more" modes or showing the details pane, close them
|
2009-07-11 12:33:57 -04:00
|
|
|
else if (me._resultsShowing())
|
2009-06-22 19:06:50 -04:00
|
|
|
me.unsetMoreMode();
|
|
|
|
// Finally, just close the overlay entirely
|
|
|
|
else
|
|
|
|
me.emit('activated');
|
|
|
|
return true;
|
|
|
|
} else if (symbol == Clutter.Up) {
|
2009-07-11 12:26:36 -04:00
|
|
|
if (!me._resultsShowing())
|
|
|
|
return true;
|
2009-06-22 19:06:50 -04:00
|
|
|
// selectUp and selectDown wrap around in their respective displays
|
|
|
|
// too, but there doesn't seem to be any flickering if we first select
|
|
|
|
// something in one display, but then unset the selection, and move
|
|
|
|
// it to the other display, so it's ok to do that.
|
2009-07-02 01:02:46 -04:00
|
|
|
if (me._resultsDocsSection.display.hasSelected())
|
|
|
|
me._resultsDocsSection.display.selectUp();
|
|
|
|
else if (me._resultsAppsSection.display.hasItems())
|
|
|
|
me._resultsAppsSection.display.selectUp();
|
|
|
|
else
|
|
|
|
me._resultsDocsSection.display.selectUp();
|
2009-07-11 12:26:36 -04:00
|
|
|
return true;
|
2009-06-22 19:06:50 -04:00
|
|
|
} else if (symbol == Clutter.Down) {
|
2009-07-11 12:26:36 -04:00
|
|
|
if (!me._resultsShowing())
|
|
|
|
return true;
|
2009-07-02 01:02:46 -04:00
|
|
|
if (me._resultsDocsSection.display.hasSelected())
|
|
|
|
me._resultsDocsSection.display.selectDown();
|
|
|
|
else if (me._resultsAppsSection.display.hasItems())
|
|
|
|
me._resultsAppsSection.display.selectDown();
|
|
|
|
else
|
|
|
|
me._resultsDocsSection.display.selectDown();
|
2009-07-11 12:26:36 -04:00
|
|
|
return true;
|
2009-06-22 19:06:50 -04:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
2009-06-17 13:25:07 -04:00
|
|
|
this._appsText = new Clutter.Text({ color: DASH_TEXT_COLOR,
|
|
|
|
font_name: "Sans Bold 14px",
|
|
|
|
text: "Applications",
|
|
|
|
height: LABEL_HEIGHT});
|
2009-07-03 22:32:23 -04:00
|
|
|
this._appsSection = new Big.Box({ padding_top: DASH_SECTION_PADDING,
|
2009-06-02 13:13:51 -04:00
|
|
|
spacing: DASH_SECTION_SPACING});
|
2009-07-04 09:10:53 -04:00
|
|
|
this._appsSection.append(this._appsText, Big.BoxPackFlags.NONE);
|
2009-02-20 11:57:30 -05:00
|
|
|
|
2009-07-24 17:25:20 -04:00
|
|
|
this._itemDisplayHeight = global.screen_height - this._appsSection.y - DASH_SECTION_MISC_HEIGHT * 2;
|
2009-02-20 11:57:30 -05:00
|
|
|
|
2009-04-01 15:51:17 -04:00
|
|
|
this._appsContent = new Big.Box({ orientation: Big.BoxOrientation.HORIZONTAL });
|
|
|
|
this._appsSection.append(this._appsContent, Big.BoxPackFlags.EXPAND);
|
2009-06-30 16:35:39 -04:00
|
|
|
this._appWell = new AppDisplay.AppWell(this._displayWidth);
|
|
|
|
this._appsContent.append(this._appWell.actor, Big.BoxPackFlags.EXPAND);
|
2008-12-01 14:51:43 -05:00
|
|
|
|
2009-02-20 11:57:30 -05:00
|
|
|
let moreAppsBox = new Big.Box({x_align: Big.BoxAlignment.END});
|
2009-06-02 13:13:51 -04:00
|
|
|
this._moreAppsLink = new Link.Link({ color: DASH_TEXT_COLOR,
|
2009-02-26 17:05:35 -05:00
|
|
|
font_name: "Sans Bold 14px",
|
|
|
|
text: "More...",
|
|
|
|
height: LABEL_HEIGHT });
|
|
|
|
moreAppsBox.append(this._moreAppsLink.actor, Big.BoxPackFlags.EXPAND);
|
2009-07-04 09:10:53 -04:00
|
|
|
this._appsSection.append(moreAppsBox, Big.BoxPackFlags.NONE);
|
2009-02-20 11:57:30 -05:00
|
|
|
|
2009-07-03 22:32:23 -04:00
|
|
|
this.dashContainer.append(this._appsSection, Big.BoxPackFlags.NONE);
|
|
|
|
|
2009-02-20 11:57:30 -05:00
|
|
|
this._appsSectionDefaultHeight = this._appsSection.height;
|
2009-03-09 16:52:11 -04:00
|
|
|
|
2009-07-03 22:32:23 -04:00
|
|
|
this._docsSection = new Big.Box({ padding_top: DASH_SECTION_PADDING,
|
2009-07-04 09:10:53 -04:00
|
|
|
padding_bottom: DASH_SECTION_PADDING,
|
2009-06-02 13:13:51 -04:00
|
|
|
spacing: DASH_SECTION_SPACING});
|
2009-02-03 17:58:33 -05:00
|
|
|
|
2009-06-02 13:13:51 -04:00
|
|
|
this._docsText = new Clutter.Text({ color: DASH_TEXT_COLOR,
|
2009-02-23 14:42:00 -05:00
|
|
|
font_name: "Sans Bold 14px",
|
|
|
|
text: "Recent Documents",
|
|
|
|
height: LABEL_HEIGHT});
|
2009-07-03 22:32:23 -04:00
|
|
|
this._docsSection.append(this._docsText, Big.BoxPackFlags.NONE);
|
2008-12-19 23:27:57 -05:00
|
|
|
|
2009-07-04 15:30:12 -04:00
|
|
|
this._docDisplay = new DocDisplay.DocDisplay(this._displayWidth);
|
2009-02-20 11:57:30 -05:00
|
|
|
this._docsSection.append(this._docDisplay.actor, Big.BoxPackFlags.EXPAND);
|
2008-12-19 23:27:57 -05:00
|
|
|
|
2009-02-20 11:57:30 -05:00
|
|
|
let moreDocsBox = new Big.Box({x_align: Big.BoxAlignment.END});
|
2009-06-02 13:13:51 -04:00
|
|
|
this._moreDocsLink = new Link.Link({ color: DASH_TEXT_COLOR,
|
2009-02-26 17:05:35 -05:00
|
|
|
font_name: "Sans Bold 14px",
|
|
|
|
text: "More...",
|
|
|
|
height: LABEL_HEIGHT });
|
|
|
|
moreDocsBox.append(this._moreDocsLink.actor, Big.BoxPackFlags.EXPAND);
|
2009-07-04 09:10:53 -04:00
|
|
|
this._docsSection.append(moreDocsBox, Big.BoxPackFlags.NONE);
|
2009-02-20 11:57:30 -05:00
|
|
|
|
2009-07-03 22:32:23 -04:00
|
|
|
this.dashContainer.append(this._docsSection, Big.BoxPackFlags.EXPAND);
|
2009-02-03 17:58:33 -05:00
|
|
|
|
2009-02-25 13:23:12 -05:00
|
|
|
this._docsSectionDefaultHeight = this._docsSection.height;
|
|
|
|
|
2009-06-25 19:14:29 -04:00
|
|
|
// The "More" or search results area
|
2009-07-04 12:46:35 -04:00
|
|
|
this._resultsAppsSection = new ItemResults(this._resultsWidth, resultsHeight, AppDisplay.AppDisplay, "Applications");
|
|
|
|
this._resultsDocsSection = new ItemResults(this._resultsWidth, resultsHeight, DocDisplay.DocDisplay, "Documents");
|
2009-03-09 16:52:11 -04:00
|
|
|
|
2009-07-04 12:46:35 -04:00
|
|
|
this._resultsPane = new Big.Box({ orientation: Big.BoxOrientation.VERTICAL,
|
2009-06-08 19:04:52 -04:00
|
|
|
x: this._width,
|
2009-07-24 17:25:20 -04:00
|
|
|
y: Panel.PANEL_HEIGHT,
|
2009-06-30 19:45:56 -04:00
|
|
|
height: resultsHeight,
|
|
|
|
reactive: true });
|
2009-06-08 19:04:52 -04:00
|
|
|
|
|
|
|
let resultsBackground = new Big.Box({ orientation: Big.BoxOrientation.HORIZONTAL,
|
|
|
|
height: resultsHeight,
|
|
|
|
corner_radius: DASH_CORNER_RADIUS,
|
2009-06-16 14:50:38 -04:00
|
|
|
border: DASH_BORDER_WIDTH,
|
|
|
|
border_color: DASH_BORDER_COLOR });
|
2009-07-04 12:46:35 -04:00
|
|
|
this._resultsPane.add_actor(resultsBackground);
|
2009-06-08 19:04:52 -04:00
|
|
|
|
2009-06-16 14:50:38 -04:00
|
|
|
let resultsLeft = global.create_horizontal_gradient(PANE_LEFT_COLOR,
|
|
|
|
PANE_MIDDLE_COLOR);
|
|
|
|
let resultsRight = global.create_horizontal_gradient(PANE_MIDDLE_COLOR,
|
|
|
|
PANE_RIGHT_COLOR);
|
2009-06-08 19:04:52 -04:00
|
|
|
let resultsShadow = global.create_horizontal_gradient(SHADOW_COLOR,
|
|
|
|
TRANSPARENT_COLOR);
|
|
|
|
resultsShadow.set_width(SHADOW_WIDTH);
|
2009-07-04 12:46:35 -04:00
|
|
|
|
2009-06-08 19:04:52 -04:00
|
|
|
resultsBackground.append(resultsLeft, Big.BoxPackFlags.EXPAND);
|
|
|
|
resultsBackground.append(resultsRight, Big.BoxPackFlags.EXPAND);
|
2009-07-04 12:46:35 -04:00
|
|
|
this._resultsPane.add_actor(resultsShadow);
|
|
|
|
this._resultsPane.connect('notify::allocation', Lang.bind(this, function (b, a) {
|
|
|
|
let width = this._resultsPane.width;
|
|
|
|
resultsBackground.width = width;
|
|
|
|
resultsShadow.width = width;
|
|
|
|
}));
|
2009-06-08 19:04:52 -04:00
|
|
|
|
2009-06-25 14:54:28 -04:00
|
|
|
this.actor.add_actor(this._resultsPane);
|
|
|
|
this._resultsPane.hide();
|
|
|
|
|
2009-06-16 14:50:38 -04:00
|
|
|
this._detailsPane = new Big.Box({ orientation: Big.BoxOrientation.HORIZONTAL,
|
2009-07-24 17:25:20 -04:00
|
|
|
y: Panel.PANEL_HEIGHT,
|
2009-06-16 14:50:38 -04:00
|
|
|
width: this._detailsWidth + SHADOW_WIDTH,
|
2009-06-30 19:45:56 -04:00
|
|
|
height: detailsHeight,
|
|
|
|
reactive: true });
|
2009-06-22 15:58:12 -04:00
|
|
|
this._firstSelectAfterOverlayShow = true;
|
2009-06-16 14:50:38 -04:00
|
|
|
|
|
|
|
let detailsBackground = new Big.Box({ orientation: Big.BoxOrientation.HORIZONTAL,
|
|
|
|
width: this._detailsWidth,
|
|
|
|
height: detailsHeight,
|
|
|
|
corner_radius: DASH_CORNER_RADIUS,
|
|
|
|
border: DASH_BORDER_WIDTH,
|
|
|
|
border_color: DASH_BORDER_COLOR });
|
|
|
|
|
|
|
|
this._detailsPane.append(detailsBackground, Big.BoxPackFlags.EXPAND);
|
|
|
|
|
|
|
|
let detailsLeft = global.create_horizontal_gradient(PANE_LEFT_COLOR,
|
|
|
|
PANE_MIDDLE_COLOR);
|
|
|
|
let detailsRight = global.create_horizontal_gradient(PANE_MIDDLE_COLOR,
|
|
|
|
PANE_RIGHT_COLOR);
|
|
|
|
let detailsShadow = global.create_horizontal_gradient(SHADOW_COLOR,
|
|
|
|
TRANSPARENT_COLOR);
|
|
|
|
detailsShadow.set_width(SHADOW_WIDTH);
|
|
|
|
|
|
|
|
detailsBackground.append(detailsLeft, Big.BoxPackFlags.EXPAND);
|
|
|
|
detailsBackground.append(detailsRight, Big.BoxPackFlags.EXPAND);
|
|
|
|
this._detailsPane.append(detailsShadow, Big.BoxPackFlags.NONE);
|
|
|
|
|
|
|
|
this._detailsContent = new Big.Box({ padding: DASH_SECTION_PADDING + DASH_BORDER_WIDTH });
|
|
|
|
this._detailsPane.add_actor(this._detailsContent);
|
|
|
|
|
2009-06-25 14:54:28 -04:00
|
|
|
this.actor.add_actor(this._detailsPane);
|
|
|
|
this._detailsPane.hide();
|
|
|
|
|
2009-06-16 14:50:38 -04:00
|
|
|
let itemDetailsAvailableWidth = this._detailsWidth - DASH_SECTION_PADDING * 2 - DASH_BORDER_WIDTH * 2;
|
|
|
|
let itemDetailsAvailableHeight = detailsHeight - DASH_SECTION_PADDING * 2 - DASH_BORDER_WIDTH * 2;
|
|
|
|
|
|
|
|
this._docDisplay.setAvailableDimensionsForItemDetails(itemDetailsAvailableWidth, itemDetailsAvailableHeight);
|
2009-06-17 13:25:07 -04:00
|
|
|
this._resultsAppsSection.display.setAvailableDimensionsForItemDetails(itemDetailsAvailableWidth, itemDetailsAvailableHeight);
|
|
|
|
this._resultsDocsSection.display.setAvailableDimensionsForItemDetails(itemDetailsAvailableWidth, itemDetailsAvailableHeight);
|
2009-06-16 14:50:38 -04:00
|
|
|
|
2008-12-19 23:27:57 -05:00
|
|
|
/* Proxy the activated signals */
|
2009-06-30 16:35:39 -04:00
|
|
|
this._appWell.connect('activated', function(well) {
|
2008-12-19 23:27:57 -05:00
|
|
|
me.emit('activated');
|
|
|
|
});
|
|
|
|
this._docDisplay.connect('activated', function(docDisplay) {
|
2009-03-31 14:12:33 -04:00
|
|
|
me.emit('activated');
|
|
|
|
});
|
2009-06-18 19:53:21 -04:00
|
|
|
this._resultsAppsSection.display.connect('activated', function(resultsAppsDisplay) {
|
|
|
|
me.emit('activated');
|
|
|
|
});
|
|
|
|
this._resultsDocsSection.display.connect('activated', function(resultsDocsDisplay) {
|
|
|
|
me.emit('activated');
|
|
|
|
});
|
2009-07-04 12:46:35 -04:00
|
|
|
this._docDisplay.connect('selected', Lang.bind(this, function(docDisplay) {
|
|
|
|
this._resultsDocsSection.display.unsetSelected();
|
|
|
|
this._resultsAppsSection.display.unsetSelected();
|
|
|
|
this._showDetails();
|
|
|
|
this._detailsContent.remove_all();
|
|
|
|
this._detailsContent.append(this._docDisplay.selectedItemDetails, Big.BoxPackFlags.NONE);
|
|
|
|
}));
|
2009-07-29 13:35:11 -04:00
|
|
|
this._docDisplay.connect('toggle-details', Lang.bind(this, function(docDisplay) {
|
|
|
|
this._toggleDetails();
|
|
|
|
}));
|
2009-07-04 12:46:35 -04:00
|
|
|
this._resultsDocsSection.display.connect('selected', Lang.bind(this, function(resultsDocDisplay) {
|
|
|
|
this._docDisplay.unsetSelected();
|
|
|
|
this._resultsAppsSection.display.unsetSelected();
|
|
|
|
this._showDetails();
|
|
|
|
this._detailsContent.remove_all();
|
|
|
|
this._detailsContent.append(this._resultsDocsSection.display.selectedItemDetails, Big.BoxPackFlags.NONE);
|
|
|
|
}));
|
2009-07-29 13:35:11 -04:00
|
|
|
this._resultsDocsSection.display.connect('toggle-details', Lang.bind(this, function(resultsDocDisplay) {
|
|
|
|
this._toggleDetails();
|
|
|
|
}));
|
2009-07-04 12:46:35 -04:00
|
|
|
this._resultsAppsSection.display.connect('selected', Lang.bind(this, function(resultsAppDisplay) {
|
|
|
|
this._docDisplay.unsetSelected();
|
|
|
|
this._resultsDocsSection.display.unsetSelected();
|
|
|
|
this._showDetails();
|
|
|
|
this._detailsContent.remove_all();
|
|
|
|
this._detailsContent.append(this._resultsAppsSection.display.selectedItemDetails, Big.BoxPackFlags.NONE);
|
|
|
|
}));
|
2009-02-03 17:58:33 -05:00
|
|
|
|
2009-02-26 17:05:35 -05:00
|
|
|
this._moreAppsLink.connect('clicked',
|
2009-02-03 17:58:33 -05:00
|
|
|
function(o, event) {
|
2009-02-20 11:57:30 -05:00
|
|
|
if (me._moreAppsMode) {
|
|
|
|
me._unsetMoreAppsMode();
|
|
|
|
} else {
|
|
|
|
me._setMoreAppsMode();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2009-02-26 17:05:35 -05:00
|
|
|
this._moreDocsLink.connect('clicked',
|
2009-02-20 11:57:30 -05:00
|
|
|
function(o, event) {
|
|
|
|
if (me._moreDocsMode) {
|
|
|
|
me._unsetMoreDocsMode();
|
2009-02-03 17:58:33 -05:00
|
|
|
} else {
|
2009-02-20 11:57:30 -05:00
|
|
|
me._setMoreDocsMode();
|
2009-02-03 17:58:33 -05:00
|
|
|
}
|
|
|
|
});
|
2008-12-01 14:51:43 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
show: function() {
|
2009-02-11 11:31:33 -05:00
|
|
|
let global = Shell.Global.get();
|
|
|
|
|
2009-04-01 15:51:17 -04:00
|
|
|
this._appsContent.show();
|
2009-02-03 17:58:33 -05:00
|
|
|
this._docDisplay.show();
|
2009-06-22 19:06:50 -04:00
|
|
|
global.stage.set_key_focus(this._searchEntry.entry);
|
2008-12-19 23:27:57 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
hide: function() {
|
2009-06-22 15:58:12 -04:00
|
|
|
this._firstSelectAfterOverlayShow = true;
|
2009-04-01 15:51:17 -04:00
|
|
|
this._appsContent.hide();
|
2009-06-24 18:24:48 -04:00
|
|
|
this._docDisplay.hide();
|
2009-06-22 19:06:50 -04:00
|
|
|
this._searchEntry.entry.text = '';
|
2009-06-08 19:04:52 -04:00
|
|
|
this.unsetMoreMode();
|
|
|
|
},
|
|
|
|
|
|
|
|
unsetMoreMode: function() {
|
|
|
|
this._unsetMoreAppsMode();
|
|
|
|
this._unsetMoreDocsMode();
|
2009-06-22 19:06:50 -04:00
|
|
|
if (this._detailsShowing()) {
|
2009-06-25 14:54:28 -04:00
|
|
|
this._detailsPane.hide();
|
2009-06-16 14:50:38 -04:00
|
|
|
this.emit('panes-removed');
|
|
|
|
}
|
2009-06-24 18:24:48 -04:00
|
|
|
this._unsetSearchMode();
|
2009-02-03 17:58:33 -05:00
|
|
|
},
|
|
|
|
|
2009-06-08 19:04:52 -04:00
|
|
|
// Sets the 'More' mode for browsing applications.
|
|
|
|
_setMoreAppsMode: function() {
|
|
|
|
if (this._moreAppsMode)
|
|
|
|
return;
|
|
|
|
|
|
|
|
this._unsetMoreDocsMode();
|
2009-06-24 18:24:48 -04:00
|
|
|
this._unsetSearchMode();
|
2009-06-08 19:04:52 -04:00
|
|
|
this._moreAppsMode = true;
|
|
|
|
|
2009-06-17 13:25:07 -04:00
|
|
|
this._resultsAppsSection.display.show();
|
2009-07-04 12:46:35 -04:00
|
|
|
this._resultsPane.append(this._resultsAppsSection.actor, Big.BoxPackFlags.EXPAND);
|
2009-06-25 14:54:28 -04:00
|
|
|
this._resultsPane.show();
|
2009-07-31 10:08:39 -04:00
|
|
|
this._repositionDetails();
|
2009-06-08 19:04:52 -04:00
|
|
|
|
|
|
|
this._moreAppsLink.setText("Less...");
|
2009-06-16 14:50:38 -04:00
|
|
|
this.emit('panes-displayed');
|
2009-06-08 19:04:52 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
// Unsets the 'More' mode for browsing applications.
|
|
|
|
_unsetMoreAppsMode: function() {
|
|
|
|
if (!this._moreAppsMode)
|
|
|
|
return;
|
|
|
|
|
|
|
|
this._moreAppsMode = false;
|
|
|
|
|
2009-06-17 13:25:07 -04:00
|
|
|
this._resultsPane.remove_actor(this._resultsAppsSection.actor);
|
|
|
|
this._resultsAppsSection.display.hide();
|
2009-06-25 14:54:28 -04:00
|
|
|
this._resultsPane.hide();
|
2009-06-08 19:04:52 -04:00
|
|
|
|
2009-07-04 12:46:35 -04:00
|
|
|
this._moreAppsLink.setText("More...");
|
2009-06-16 14:50:38 -04:00
|
|
|
|
2009-07-11 12:33:57 -04:00
|
|
|
this._hideDetails();
|
2009-06-08 19:04:52 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
// Sets the 'More' mode for browsing documents.
|
|
|
|
_setMoreDocsMode: function() {
|
|
|
|
if (this._moreDocsMode)
|
|
|
|
return;
|
|
|
|
|
|
|
|
this._unsetMoreAppsMode();
|
2009-06-24 18:24:48 -04:00
|
|
|
this._unsetSearchMode();
|
2009-06-08 19:04:52 -04:00
|
|
|
this._moreDocsMode = true;
|
|
|
|
|
2009-06-17 13:25:07 -04:00
|
|
|
this._resultsDocsSection.display.show();
|
2009-07-04 12:46:35 -04:00
|
|
|
this._resultsPane.append(this._resultsDocsSection.actor, Big.BoxPackFlags.EXPAND);
|
2009-06-25 14:54:28 -04:00
|
|
|
this._resultsPane.show();
|
2009-07-31 10:08:39 -04:00
|
|
|
this._repositionDetails();
|
2009-07-04 12:46:35 -04:00
|
|
|
|
2009-06-17 13:25:07 -04:00
|
|
|
this._moreDocsLink.setText("Less...");
|
2009-07-04 12:46:35 -04:00
|
|
|
|
2009-06-16 14:50:38 -04:00
|
|
|
this.emit('panes-displayed');
|
2009-06-08 19:04:52 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
// Unsets the 'More' mode for browsing documents.
|
|
|
|
_unsetMoreDocsMode: function() {
|
|
|
|
if (!this._moreDocsMode)
|
|
|
|
return;
|
|
|
|
|
|
|
|
this._moreDocsMode = false;
|
|
|
|
|
2009-06-25 14:54:28 -04:00
|
|
|
this._resultsPane.hide();
|
2009-06-17 13:25:07 -04:00
|
|
|
this._resultsPane.remove_actor(this._resultsDocsSection.actor);
|
|
|
|
this._resultsDocsSection.display.hide();
|
2009-07-04 12:46:35 -04:00
|
|
|
|
2009-06-08 19:04:52 -04:00
|
|
|
this._moreDocsLink.setText("More...");
|
2009-06-16 14:50:38 -04:00
|
|
|
|
2009-07-11 12:33:57 -04:00
|
|
|
this._hideDetails();
|
2009-06-22 19:06:50 -04:00
|
|
|
},
|
|
|
|
|
2009-06-24 18:24:48 -04:00
|
|
|
_setSearchMode: function() {
|
2009-07-04 12:46:35 -04:00
|
|
|
|
2009-06-24 18:24:48 -04:00
|
|
|
if (this._resultsShowing())
|
|
|
|
return;
|
|
|
|
|
|
|
|
this._resultsAppsSection._setSearchMode();
|
|
|
|
this._resultsAppsSection.display.show();
|
2009-07-04 12:46:35 -04:00
|
|
|
this._resultsPane.append(this._resultsAppsSection.actor, Big.BoxPackFlags.EXPAND);
|
2009-06-24 18:24:48 -04:00
|
|
|
|
2009-07-04 12:46:35 -04:00
|
|
|
this._resultsDocsSection._setSearchMode();
|
2009-06-24 18:24:48 -04:00
|
|
|
this._resultsDocsSection.display.show();
|
2009-07-04 12:46:35 -04:00
|
|
|
this._resultsPane.append(this._resultsDocsSection.actor, Big.BoxPackFlags.EXPAND);
|
2009-06-24 18:24:48 -04:00
|
|
|
|
2009-06-25 14:54:28 -04:00
|
|
|
this._resultsPane.show();
|
2009-07-31 10:08:39 -04:00
|
|
|
this._repositionDetails();
|
2009-06-24 18:24:48 -04:00
|
|
|
|
|
|
|
this.emit('panes-displayed');
|
|
|
|
},
|
|
|
|
|
|
|
|
_unsetSearchMode: function() {
|
2009-07-04 12:46:35 -04:00
|
|
|
|
2009-06-24 18:24:48 -04:00
|
|
|
if (this._moreDocsMode || this._moreAppsMode || !this._resultsShowing())
|
|
|
|
return;
|
|
|
|
|
2009-06-25 14:54:28 -04:00
|
|
|
this._resultsPane.hide();
|
2009-07-31 10:08:39 -04:00
|
|
|
this._repositionDetails();
|
2009-06-24 18:24:48 -04:00
|
|
|
|
|
|
|
this._resultsPane.remove_actor(this._resultsAppsSection.actor);
|
|
|
|
this._resultsAppsSection.display.hide();
|
|
|
|
this._resultsAppsSection._unsetSearchMode();
|
|
|
|
|
|
|
|
this._resultsPane.remove_actor(this._resultsDocsSection.actor);
|
|
|
|
this._resultsDocsSection.display.hide();
|
|
|
|
this._resultsDocsSection._unsetSearchMode();
|
|
|
|
this._resultsDocsSection.actor.set_y(0);
|
|
|
|
|
2009-07-11 12:33:57 -04:00
|
|
|
this._hideDetails();
|
2009-06-24 18:24:48 -04:00
|
|
|
},
|
|
|
|
|
2009-07-04 12:46:35 -04:00
|
|
|
_repositionDetails: function () {
|
|
|
|
let x;
|
|
|
|
if (this._resultsPane.visible)
|
|
|
|
x = this._resultsPane.x + this._resultsPane.width;
|
|
|
|
else
|
|
|
|
x = this._width;
|
|
|
|
this._detailsPane.x = x;
|
|
|
|
},
|
|
|
|
|
|
|
|
_showDetails: function () {
|
|
|
|
this._detailsPane.show();
|
|
|
|
this._repositionDetails();
|
|
|
|
this.emit('panes-displayed');
|
|
|
|
},
|
|
|
|
|
2009-07-11 12:33:57 -04:00
|
|
|
_hideDetails: function() {
|
|
|
|
if (!this._detailsShowing)
|
|
|
|
return;
|
|
|
|
this._detailsPane.hide();
|
|
|
|
this.emit('panes-removed');
|
|
|
|
},
|
|
|
|
|
2009-07-29 13:35:11 -04:00
|
|
|
_toggleDetails: function() {
|
|
|
|
if (this._detailsShowing())
|
|
|
|
this._hideDetails();
|
|
|
|
else
|
|
|
|
this._showDetails();
|
|
|
|
},
|
|
|
|
|
2009-06-22 19:06:50 -04:00
|
|
|
_detailsShowing: function() {
|
2009-06-25 14:54:28 -04:00
|
|
|
return this._detailsPane.visible;
|
2009-06-24 18:24:48 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
_resultsShowing: function() {
|
2009-06-25 14:54:28 -04:00
|
|
|
return this._resultsPane.visible;
|
2009-06-24 18:24:48 -04:00
|
|
|
}
|
2008-11-20 19:53:11 -05:00
|
|
|
};
|
2009-06-08 19:04:52 -04:00
|
|
|
|
2009-06-02 13:13:51 -04:00
|
|
|
Signals.addSignalMethods(Dash.prototype);
|
2008-11-20 19:53:11 -05:00
|
|
|
|
2008-10-31 19:09:46 -04:00
|
|
|
function Overlay() {
|
|
|
|
this._init();
|
2008-11-20 19:53:11 -05:00
|
|
|
}
|
2008-10-31 19:09:46 -04:00
|
|
|
|
|
|
|
Overlay.prototype = {
|
2008-12-01 14:51:43 -05:00
|
|
|
_init : function() {
|
|
|
|
let me = this;
|
2008-11-28 15:12:20 -05:00
|
|
|
|
2008-12-01 14:51:43 -05:00
|
|
|
let global = Shell.Global.get();
|
2008-11-28 15:12:20 -05:00
|
|
|
|
2009-02-10 17:38:06 -05:00
|
|
|
wideScreen = (global.screen_width/global.screen_height > WIDE_SCREEN_CUT_OFF_RATIO);
|
|
|
|
|
|
|
|
// We divide the screen into an imaginary grid which helps us determine the layout of
|
|
|
|
// different visual components.
|
|
|
|
if (wideScreen) {
|
|
|
|
displayGridColumnWidth = global.screen_width / COLUMNS_WIDE_SCREEN;
|
|
|
|
displayGridRowHeight = global.screen_height / ROWS_WIDE_SCREEN;
|
|
|
|
} else {
|
|
|
|
displayGridColumnWidth = global.screen_width / COLUMNS_REGULAR_SCREEN;
|
|
|
|
displayGridRowHeight = global.screen_height / ROWS_REGULAR_SCREEN;
|
|
|
|
}
|
|
|
|
|
2008-12-01 14:51:43 -05:00
|
|
|
this._group = new Clutter.Group();
|
2009-03-11 15:21:45 -04:00
|
|
|
this._group._delegate = this;
|
|
|
|
|
2008-12-01 14:51:43 -05:00
|
|
|
this.visible = false;
|
2009-03-20 12:06:34 -04:00
|
|
|
this._hideInProgress = false;
|
2008-11-28 15:12:20 -05:00
|
|
|
|
2009-04-21 20:23:06 -04:00
|
|
|
// A scaled root pixmap actor is used as a background. It is zoomed in
|
|
|
|
// to the lower right intersection of the lines that divide the image
|
|
|
|
// evenly in a 3x3 grid. This is based on the rule of thirds, a
|
|
|
|
// compositional rule of thumb in visual arts. The choice for the
|
|
|
|
// lower right point is based on a quick survey of GNOME wallpapers.
|
|
|
|
let background = global.create_root_pixmap_actor();
|
|
|
|
background.width = global.screen_width * BACKGROUND_SCALE;
|
|
|
|
background.height = global.screen_height * BACKGROUND_SCALE;
|
|
|
|
background.x = -global.screen_width * (4 * BACKGROUND_SCALE - 3) / 6;
|
|
|
|
background.y = -global.screen_height * (4 * BACKGROUND_SCALE - 3) / 6;
|
2008-12-01 14:51:43 -05:00
|
|
|
this._group.add_actor(background);
|
2008-11-28 15:12:20 -05:00
|
|
|
|
2009-06-25 14:33:24 -04:00
|
|
|
// Transparent background is used to catch clicks outside of the dash panes when the panes
|
|
|
|
// are being displayed and the workspaces area should not be reactive. Catching such a
|
|
|
|
// click results in the panes being closed and the workspaces area becoming reactive again.
|
|
|
|
this._transparentBackground = new Clutter.Rectangle({ opacity: 0,
|
2009-06-08 19:04:52 -04:00
|
|
|
width: global.screen_width,
|
|
|
|
height: global.screen_height - Panel.PANEL_HEIGHT,
|
|
|
|
y: Panel.PANEL_HEIGHT,
|
|
|
|
reactive: true });
|
|
|
|
this._group.add_actor(this._transparentBackground);
|
|
|
|
|
2009-04-21 20:23:06 -04:00
|
|
|
// Draw a semitransparent rectangle over the background for readability.
|
|
|
|
let backOver = new Clutter.Rectangle({ color: ROOT_OVERLAY_COLOR,
|
|
|
|
width: global.screen_width,
|
|
|
|
height: global.screen_height - Panel.PANEL_HEIGHT,
|
|
|
|
y: Panel.PANEL_HEIGHT });
|
|
|
|
this._group.add_actor(backOver);
|
|
|
|
|
2008-12-01 14:51:43 -05:00
|
|
|
this._group.hide();
|
|
|
|
global.overlay_group.add_actor(this._group);
|
2008-11-28 15:12:20 -05:00
|
|
|
|
2008-12-01 14:51:43 -05:00
|
|
|
// TODO - recalculate everything when desktop size changes
|
2009-06-02 13:13:51 -04:00
|
|
|
this._dash = new Dash();
|
|
|
|
this._group.add_actor(this._dash.actor);
|
2009-02-03 17:58:33 -05:00
|
|
|
this._workspaces = null;
|
2009-06-08 19:04:52 -04:00
|
|
|
this._buttonEventHandlerId = null;
|
2009-06-02 13:13:51 -04:00
|
|
|
this._dash.connect('activated', function(dash) {
|
2008-12-01 14:51:43 -05:00
|
|
|
// TODO - have some sort of animation/effect while
|
|
|
|
// transitioning to the new app. We definitely need
|
|
|
|
// startup-notification integration at least.
|
2009-05-07 09:47:48 -04:00
|
|
|
me.hide();
|
2008-12-01 14:51:43 -05:00
|
|
|
});
|
2009-06-16 14:50:38 -04:00
|
|
|
this._dash.connect('panes-displayed', function(dash) {
|
|
|
|
if (me._buttonEventHandlerId == null) {
|
2009-06-08 19:04:52 -04:00
|
|
|
me._transparentBackground.raise_top();
|
|
|
|
me._dash.actor.raise_top();
|
|
|
|
me._buttonEventHandlerId = me._transparentBackground.connect('button-release-event', function(background) {
|
|
|
|
me._dash.unsetMoreMode();
|
|
|
|
return true;
|
|
|
|
});
|
2009-02-10 17:38:06 -05:00
|
|
|
}
|
2009-02-03 17:58:33 -05:00
|
|
|
});
|
2009-06-16 14:50:38 -04:00
|
|
|
this._dash.connect('panes-removed', function(dash) {
|
|
|
|
if (me._buttonEventHandlerId != null) {
|
2009-06-08 19:04:52 -04:00
|
|
|
me._transparentBackground.lower_bottom();
|
|
|
|
me._transparentBackground.disconnect(me._buttonEventHandlerId);
|
2009-06-16 14:50:38 -04:00
|
|
|
me._buttonEventHandlerId = null;
|
2009-02-10 17:38:06 -05:00
|
|
|
}
|
2009-02-03 17:58:33 -05:00
|
|
|
});
|
2008-12-01 14:51:43 -05:00
|
|
|
},
|
|
|
|
|
2009-03-11 15:21:45 -04:00
|
|
|
//// Draggable target interface ////
|
|
|
|
|
2009-06-08 19:04:52 -04:00
|
|
|
// Unsets the expanded display mode if a GenericDisplayItem is being
|
|
|
|
// dragged over the overlay, i.e. as soon as it starts being dragged.
|
|
|
|
// This closes the additional panes and allows the user to place
|
|
|
|
// the item on any workspace.
|
2009-03-11 15:21:45 -04:00
|
|
|
handleDragOver : function(source, actor, x, y, time) {
|
2009-06-08 19:04:52 -04:00
|
|
|
if (source instanceof GenericDisplay.GenericDisplayItem) {
|
|
|
|
this._dash.unsetMoreMode();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2009-03-11 15:21:45 -04:00
|
|
|
return false;
|
|
|
|
},
|
|
|
|
|
|
|
|
//// Public methods ////
|
|
|
|
|
2008-12-01 14:51:43 -05:00
|
|
|
show : function() {
|
|
|
|
if (this.visible)
|
|
|
|
return;
|
2009-05-07 09:47:48 -04:00
|
|
|
if (!Main.startModal())
|
|
|
|
return;
|
2008-11-28 15:12:20 -05:00
|
|
|
|
2008-12-01 14:51:43 -05:00
|
|
|
this.visible = true;
|
2008-11-28 15:12:20 -05:00
|
|
|
|
2008-12-01 14:51:43 -05:00
|
|
|
let global = Shell.Global.get();
|
2009-02-10 17:38:06 -05:00
|
|
|
let screenWidth = global.screen_width;
|
|
|
|
let screenHeight = global.screen_height;
|
2008-11-28 15:12:20 -05:00
|
|
|
|
2009-06-02 13:13:51 -04:00
|
|
|
this._dash.show();
|
2009-02-20 11:57:30 -05:00
|
|
|
|
2009-02-10 17:38:06 -05:00
|
|
|
let columnsUsed = wideScreen ? COLUMNS_FOR_WORKSPACES_WIDE_SCREEN : COLUMNS_FOR_WORKSPACES_REGULAR_SCREEN;
|
|
|
|
let rowsUsed = wideScreen ? ROWS_FOR_WORKSPACES_WIDE_SCREEN : ROWS_FOR_WORKSPACES_REGULAR_SCREEN;
|
|
|
|
|
|
|
|
let workspacesWidth = displayGridColumnWidth * columnsUsed - WORKSPACE_GRID_PADDING * 2;
|
|
|
|
// We scale the vertical padding by (screenHeight / screenWidth) so that the workspace preserves its aspect ratio.
|
|
|
|
let workspacesHeight = displayGridRowHeight * rowsUsed - WORKSPACE_GRID_PADDING * (screenHeight / screenWidth) * 2;
|
|
|
|
|
|
|
|
let workspacesX = displayGridColumnWidth + WORKSPACE_GRID_PADDING;
|
|
|
|
let workspacesY = displayGridRowHeight + WORKSPACE_GRID_PADDING * (screenHeight / screenWidth);
|
|
|
|
|
|
|
|
// place the 'Add Workspace' button in the bottom row of the grid
|
|
|
|
let addButtonSize = Math.floor(displayGridRowHeight * 3/5);
|
|
|
|
let addButtonX = workspacesX + workspacesWidth - addButtonSize;
|
|
|
|
let addButtonY = screenHeight - Math.floor(displayGridRowHeight * 4/5);
|
|
|
|
|
|
|
|
this._workspaces = new Workspaces.Workspaces(workspacesWidth, workspacesHeight, workspacesX, workspacesY,
|
|
|
|
addButtonSize, addButtonX, addButtonY);
|
2008-12-15 15:48:59 -05:00
|
|
|
this._group.add_actor(this._workspaces.actor);
|
2008-12-01 14:51:43 -05:00
|
|
|
|
|
|
|
// All the the actors in the window group are completely obscured,
|
|
|
|
// hiding the group holding them while the overlay is displayed greatly
|
|
|
|
// increases performance of the overlay especially when there are many
|
|
|
|
// windows visible.
|
|
|
|
//
|
|
|
|
// If we switched to displaying the actors in the overlay rather than
|
|
|
|
// clones of them, this would obviously no longer be necessary.
|
2008-12-02 11:15:00 -05:00
|
|
|
global.window_group.hide();
|
2008-12-01 14:51:43 -05:00
|
|
|
this._group.show();
|
2009-03-20 12:06:34 -04:00
|
|
|
|
2009-04-21 20:23:06 -04:00
|
|
|
// Try to make the menu not too visible behind the empty space between
|
|
|
|
// the workspace previews by sliding in its clipping rectangle.
|
2009-06-02 13:13:51 -04:00
|
|
|
// We want to finish drawing the Dash just before the top workspace fully
|
2009-04-21 20:23:06 -04:00
|
|
|
// slides in on the top. Which means that we have more time to wait before
|
2009-06-02 13:13:51 -04:00
|
|
|
// drawing the dash if the active workspace is displayed on the bottom of
|
2009-04-21 20:23:06 -04:00
|
|
|
// the workspaces grid, and almost no time to wait if it is displayed in the top
|
|
|
|
// row of the workspaces grid. The calculations used below try to roughly
|
|
|
|
// capture the animation ratio for when workspaces are covering the top of the overlay
|
|
|
|
// vs. when workspaces are already below the top of the overlay, and apply it
|
2009-06-02 13:13:51 -04:00
|
|
|
// to clipping the dash. The clipping is removed in this._showDone().
|
|
|
|
this._dash.actor.set_clip(0, 0,
|
2009-04-21 20:23:06 -04:00
|
|
|
this._workspaces.getFullSizeX(),
|
2009-06-02 13:13:51 -04:00
|
|
|
this._dash.actor.height);
|
|
|
|
Tweener.addTween(this._dash.actor,
|
|
|
|
{ clipWidthRight: this._dash._width + WORKSPACE_GRID_PADDING + this._workspaces.getWidthToTopActiveWorkspace(),
|
2009-04-21 20:23:06 -04:00
|
|
|
time: ANIMATION_TIME,
|
|
|
|
transition: "easeOutQuad",
|
|
|
|
onComplete: this._showDone,
|
2009-03-20 12:06:34 -04:00
|
|
|
onCompleteScope: this
|
2009-04-21 20:23:06 -04:00
|
|
|
|
2009-03-20 12:06:34 -04:00
|
|
|
});
|
2009-05-07 09:47:48 -04:00
|
|
|
|
|
|
|
this.emit('showing');
|
2008-12-01 14:51:43 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
hide : function() {
|
2009-03-20 12:06:34 -04:00
|
|
|
if (!this.visible || this._hideInProgress)
|
2008-12-01 14:51:43 -05:00
|
|
|
return;
|
|
|
|
|
2009-04-21 20:23:06 -04:00
|
|
|
let global = Shell.Global.get();
|
|
|
|
|
2009-03-20 12:06:34 -04:00
|
|
|
this._hideInProgress = true;
|
2009-06-02 13:13:51 -04:00
|
|
|
// lower the Dash, so that workspaces display is on top and covers the Dash while it is sliding out
|
|
|
|
this._dash.actor.lower(this._workspaces.actor);
|
2008-12-04 10:20:37 -05:00
|
|
|
this._workspaces.hide();
|
2008-12-04 10:16:16 -05:00
|
|
|
|
2009-04-21 20:23:06 -04:00
|
|
|
// Try to make the menu not too visible behind the empty space between
|
|
|
|
// the workspace previews by sliding in its clipping rectangle.
|
|
|
|
// The logic used is the same as described in this.show(). If the active workspace
|
|
|
|
// is displayed in the top row, than almost full animation time is needed for it
|
2009-06-02 13:13:51 -04:00
|
|
|
// to reach the top of the overlay and cover the Dash fully, while if the
|
2009-04-21 20:23:06 -04:00
|
|
|
// active workspace is in the lower row, than the top left workspace reaches the
|
|
|
|
// top of the overlay sooner as it is moving out of the way.
|
|
|
|
// The clipping is removed in this._hideDone().
|
2009-06-02 13:13:51 -04:00
|
|
|
this._dash.actor.set_clip(0, 0,
|
|
|
|
this._dash.actor.width + WORKSPACE_GRID_PADDING + this._workspaces.getWidthToTopActiveWorkspace(),
|
|
|
|
this._dash.actor.height);
|
|
|
|
Tweener.addTween(this._dash.actor,
|
2009-04-21 20:23:06 -04:00
|
|
|
{ clipWidthRight: this._workspaces.getFullSizeX() + this._workspaces.getWidthToTopActiveWorkspace() - global.screen_width,
|
|
|
|
time: ANIMATION_TIME,
|
|
|
|
transition: "easeOutQuad",
|
2008-12-04 10:16:16 -05:00
|
|
|
onComplete: this._hideDone,
|
|
|
|
onCompleteScope: this
|
|
|
|
});
|
2009-05-07 09:47:48 -04:00
|
|
|
|
|
|
|
this.emit('hiding');
|
|
|
|
},
|
|
|
|
|
|
|
|
toggle: function() {
|
|
|
|
if (this.visible)
|
|
|
|
this.hide();
|
|
|
|
else
|
|
|
|
this.show();
|
2008-12-04 10:16:16 -05:00
|
|
|
},
|
2008-12-15 15:48:59 -05:00
|
|
|
|
2009-03-11 15:21:45 -04:00
|
|
|
//// Private methods ////
|
|
|
|
|
2009-06-02 13:13:51 -04:00
|
|
|
// Raises the Dash to the top, so that we can tell if the pointer is above one of its items.
|
2009-04-21 20:23:06 -04:00
|
|
|
// We need to do this once the workspaces are shown because the workspaces actor currently covers
|
|
|
|
// the whole screen, regardless of where the workspaces are actually displayed.
|
2009-03-20 12:06:34 -04:00
|
|
|
//
|
|
|
|
// Once we rework the workspaces actor to only cover the area it actually needs, we can
|
|
|
|
// remove this workaround. Also http://bugzilla.openedhand.com/show_bug.cgi?id=1513 requests being
|
|
|
|
// able to pick only a reactive actor at a certain position, rather than any actor. Being able
|
2009-06-02 13:13:51 -04:00
|
|
|
// to do that would allow us to not have to raise the Dash.
|
2009-04-21 20:23:06 -04:00
|
|
|
_showDone: function() {
|
2009-03-20 12:06:34 -04:00
|
|
|
if (this._hideInProgress)
|
|
|
|
return;
|
|
|
|
|
2009-06-02 13:13:51 -04:00
|
|
|
this._dash.actor.raise_top();
|
|
|
|
this._dash.actor.remove_clip();
|
2009-05-07 09:47:48 -04:00
|
|
|
|
|
|
|
this.emit('shown');
|
2009-04-21 20:23:06 -04:00
|
|
|
},
|
2009-03-20 12:06:34 -04:00
|
|
|
|
2008-12-04 10:16:16 -05:00
|
|
|
_hideDone: function() {
|
2008-12-01 14:51:43 -05:00
|
|
|
let global = Shell.Global.get();
|
|
|
|
|
2008-12-02 11:15:00 -05:00
|
|
|
global.window_group.show();
|
2008-12-15 15:48:59 -05:00
|
|
|
|
|
|
|
this._workspaces.destroy();
|
|
|
|
this._workspaces = null;
|
2009-02-03 17:58:33 -05:00
|
|
|
|
2009-06-02 13:13:51 -04:00
|
|
|
this._dash.actor.remove_clip();
|
|
|
|
this._dash.hide();
|
2009-02-03 17:58:33 -05:00
|
|
|
this._group.hide();
|
2009-03-20 12:06:34 -04:00
|
|
|
|
|
|
|
this.visible = false;
|
|
|
|
this._hideInProgress = false;
|
2008-12-01 14:51:43 -05:00
|
|
|
|
2009-05-07 09:47:48 -04:00
|
|
|
Main.endModal();
|
|
|
|
this.emit('hidden');
|
2008-12-01 14:51:43 -05:00
|
|
|
}
|
2008-10-31 19:09:46 -04:00
|
|
|
};
|
2009-05-07 09:47:48 -04:00
|
|
|
Signals.addSignalMethods(Overlay.prototype);
|
2009-02-03 17:58:33 -05:00
|
|
|
|
2009-02-20 11:57:30 -05:00
|
|
|
Tweener.registerSpecialProperty("clipHeightBottom", _clipHeightBottomGet, _clipHeightBottomSet);
|
2009-02-03 17:58:33 -05:00
|
|
|
|
2009-02-20 11:57:30 -05:00
|
|
|
function _clipHeightBottomGet(actor) {
|
|
|
|
let [xOffset, yOffset, clipWidth, clipHeight] = actor.get_clip();
|
2009-02-03 17:58:33 -05:00
|
|
|
return clipHeight;
|
|
|
|
}
|
|
|
|
|
2009-02-20 11:57:30 -05:00
|
|
|
function _clipHeightBottomSet(actor, clipHeight) {
|
2009-02-03 17:58:33 -05:00
|
|
|
actor.set_clip(0, 0, actor.width, clipHeight);
|
|
|
|
}
|
2009-02-20 11:57:30 -05:00
|
|
|
|
|
|
|
Tweener.registerSpecialProperty("clipHeightTop", _clipHeightTopGet, _clipHeightTopSet);
|
|
|
|
|
|
|
|
function _clipHeightTopGet(actor) {
|
|
|
|
let [xOffset, yOffset, clipWidth, clipHeight] = actor.get_clip();
|
|
|
|
return clipHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
function _clipHeightTopSet(actor, clipHeight) {
|
|
|
|
actor.set_clip(0, actor.height - clipHeight, actor.width, clipHeight);
|
|
|
|
}
|
2009-04-21 20:23:06 -04:00
|
|
|
|
|
|
|
Tweener.registerSpecialProperty("clipWidthRight", _clipWidthRightGet, _clipWidthRightSet);
|
|
|
|
|
|
|
|
function _clipWidthRightGet(actor) {
|
|
|
|
let [xOffset, yOffset, clipWidth, clipHeight] = actor.get_clip();
|
|
|
|
return clipWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
function _clipWidthRightSet(actor, clipWidth) {
|
|
|
|
actor.set_clip(0, 0, clipWidth, actor.height);
|
|
|
|
}
|