Commit Graph

2251 Commits

Author SHA1 Message Date
Corey Johnson & Nathan Sobo
c1d19c4c5c Rename restoreItem to reopenItem on pane container 2013-03-07 09:30:29 -08:00
Corey Johnson & Nathan Sobo
5ad53bb32c Add restoreItem to Pane container 2013-03-07 09:30:29 -08:00
Nathan Sobo
96fefe94f0 Fix broken specs after rebase 2013-03-07 09:30:29 -08:00
Nathan Sobo
f2e5fcc902 Move autosave from editor into panes 2013-03-07 09:30:29 -08:00
Nathan Sobo
d97e91bdcb Make meta-# bindings work with new panes 2013-03-07 09:30:29 -08:00
Nathan Sobo
f23d9091f2 Add pane:close-other-items 2013-03-07 09:30:29 -08:00
Nathan Sobo
4b8d786d2a 💄 2013-03-07 09:30:29 -08:00
Nathan Sobo
7ebce683c6 Move saveAll and specs to PaneContainer
And simplify the specs… we don't *really* need to save. We can just
ensure that save is called on everything.
2013-03-07 09:30:29 -08:00
Nathan Sobo
e4bf73b41c Give the view a chance to update before presenting next dialog 2013-03-07 09:30:28 -08:00
Nathan Sobo
f0398f2331 Ensure modal dialogs are presented in a coherent order
Modal dialogs can be presented while other modal dialogs are already
being displayed. Previously, dialogs were always displayed in the order
they were requested. But say you have two untitled buffers in a
pane and you close all items… You'll display prompt dialogs for both
buffers asking the user if they want to save. If the user answers yes
to the first dialog, they should see the path selection dialog before
they see the save prompt for the second buffer.

This commit uses a stack of queues to store deferred dialogs and allow
dialogs presented by the dismissal of another dialog to take precedence
over other pending dialogs.
2013-03-07 09:30:28 -08:00
Nathan Sobo
48c693d756 Add 'pane:close' event, which destroys all pane items.
Still have some issues with the presentation order of dialogs with
multiple unsaved buffers and no paths. But for the 99% case this works
as is.
2013-03-07 09:30:28 -08:00
Nathan Sobo
da986b6a6c Fix RootView.saveAll() 2013-03-07 09:30:28 -08:00
Nathan Sobo
685df18a3a Fix breakages due to save method moving to Pane (except saveAll specs) 2013-03-07 09:30:28 -08:00
Nathan Sobo
3f9ee08e76 Handle save-as on pane. Replace 'editor:save-as' w/ 'core:save-as'
Pane will only show the saveAs dialog if the item has a `saveAs` method.
2013-03-07 09:30:28 -08:00
Nathan Sobo
59a06acc0b Fire 'modified-status-changed' events on changes after save/reload
Buffer keeps state about the value with which it fired the last
modified-status-changed event so that it doesn't fire it twice with the
same boolean value. Every piece of code that triggers the event also
needs to set this state, so now everything goes through the
`triggerModifiedStatusChanged` method.
2013-03-07 09:30:28 -08:00
Nathan Sobo
699e780e99 Handle save in panes with new 'core:save' event 2013-03-07 09:30:28 -08:00
Nathan Sobo
6ae684d609 Kill commented specs that were used as a reminder 2013-03-07 09:30:28 -08:00
Nathan Sobo
54fc9efdcb Eliminate fixturesProject global. Use project global instead. 2013-03-07 09:30:27 -08:00
Nathan Sobo
9f7b804a6c Panes prompt to save modified items before destroying them 2013-03-07 09:30:27 -08:00
Nathan Sobo
d5654cf0df 💄 2013-03-07 09:30:27 -08:00
Nathan Sobo
298a963148 Rework Buffer's 'contents-modified' event
This event now fires whenever the content of the buffer changes (after 
a rate-limiting delay) with a single boolean indicating the modified
status of the buffer. There's now a separate event called
'modified-status-changed' to indicate events that change the boolean
value of the isModified method, so we don't need to fire
'contents-modified' when the underlying file is deleted for instance.
2013-03-07 09:30:27 -08:00
Nathan Sobo
24c9f11cc9 Trigger modified-status-changed on buffers/edit sessions 2013-03-07 09:30:27 -08:00
Corey Johnson & Nathan Sobo
ae95c04bbc Focus next pane when removing the last pane item of a focused pane
Previously, removing the last pane item also ruined our ability to 
determine if the pane had focus. Now, if we're removing the last item,
we instead just go ahead and remove the entire pane. Remove contains
logic to switch focus to the next pane if its active view is focused,
which works as intended if we leave the active view in place.
2013-03-07 09:30:26 -08:00
Corey Johnson & Nathan Sobo
52b649dca5 Preserve focus when switching between pane items
If the pane is currently focused, when showing a view associated with
a new item, focus that view.
2013-03-07 09:30:26 -08:00
Corey Johnson & Nathan Sobo
6157a75868 Spec changeFocus option of RootView.open and default it to true 2013-03-07 09:30:26 -08:00
Corey Johnson & Nathan Sobo
5291924bcc Set the project path when its first edit session is saved 2013-03-07 09:30:26 -08:00
Corey Johnson & Nathan Sobo
9a93694a4c 💄 2013-03-07 09:30:26 -08:00
Nathan Sobo
31f7d6669f Use project global in project spec 2013-03-07 09:30:26 -08:00
Nathan Sobo
2bfc73afaa These should have been renamed w/ currentView/Item -> activeView/Item 2013-03-07 09:30:25 -08:00
Nathan Sobo
fab3b4564e Add Pane.moveItemToPane specs. Fix bug moving the last edit session. 2013-03-07 09:30:25 -08:00
Nathan Sobo
fe0d3cad36 Remove multiple edit session handling from Editor 2013-03-07 09:30:25 -08:00
Nathan Sobo
2e2ff3a1d0 Add Pane.destroyItem and rename removeActiveItem -> destroyActiveItem
Pane.removeItem removes an item, but no longer tries to call destroy
on it. This will facilitate moving items between panes.
2013-03-07 09:30:24 -08:00
Nathan Sobo
887b5ea007 Add Pane.moveItem(item, index)
This is the precursor to supporting drag/drop of tabs within and
between panes.
2013-03-07 09:30:24 -08:00
Nathan Sobo
21990cf986 Add EditSession.getLongTitle 2013-03-07 09:30:24 -08:00
Nathan Sobo
de8198084c EditSession emits 'title-changed' events when its buffer path changes 2013-03-07 09:30:24 -08:00
Nathan Sobo
5240d9989f Pane emits 'pane:item-removed' events 2013-03-07 09:30:23 -08:00
Nathan Sobo
dd120663b7 Pane emits 'pane:item-added' events 2013-03-07 09:30:23 -08:00
Nathan Sobo
a40d05f6ee Rename Pane.currentItem/View to activeItem/View 2013-03-07 09:30:23 -08:00
Nathan Sobo
15d8a6cada Simplify pane:active-item-changed events
Panes now trigger an event every time their active item changes,
regardless of whether the pane itself is active. Panes also trigger
events when the become active and when they are removed. The rootView
now scopes its active-item-changed event listener only to active panes,
and also listens to listens to pane activation and removal events to
update the title when switching active panes and removing the last
pane.
2013-03-07 09:30:23 -08:00
Nathan Sobo
892ff0c51f Add PaneContainer.eachPane
It calls the given callback with all current and future panes
2013-03-07 09:30:23 -08:00
Nathan Sobo
20590f590e Make window specs pass without getActiveEditor/getEditors 2013-03-07 09:30:23 -08:00
Kevin Sawicki
a6bf7f876d Replace RootView.getActiveEditor() with getActiveView() 2013-03-07 09:30:23 -08:00
Kevin Sawicki
ff899e9c1b Replace RootView.getActiveEditor() with getActiveView() 2013-03-07 09:30:23 -08:00
Kevin Sawicki & Nathan Sobo
062adae714 Return the new pane's currentView when splitting the editor 2013-03-07 09:30:23 -08:00
Kevin Sawicki & Nathan Sobo
6304bac233 Remove RootView.getActiveEditor / getActiveEditSession
There's a bunch broken because of this… to be continued.
2013-03-07 09:30:22 -08:00
Kevin Sawicki & Nathan Sobo
2bf5163798 Kill pane specs on root view 2013-03-07 09:30:22 -08:00
Kevin Sawicki & Nathan Sobo
26c63edf33 Assert against config for font-size changing events instead of editor 2013-03-07 09:30:22 -08:00
Kevin Sawicki & Nathan Sobo
d6b85cf7e8 Base title updates on pane:active-item-changed events 2013-03-07 09:30:22 -08:00
Kevin Sawicki & Nathan Sobo
3ae9c10ff5 Trigger 'pane:active-item-changed' w/ null when last pane is removed 2013-03-07 09:30:22 -08:00
Kevin Sawicki & Nathan Sobo
161ed69ef0 When a pane is removed, focus/activate the next pane 2013-03-07 09:30:22 -08:00