Commit Graph

164 Commits

Author SHA1 Message Date
Nathan Sobo
873818ee52 Deprecate string-based event subscriptions 2014-09-03 16:21:42 -06:00
Nathan Sobo
877fa40a49 Activate next pane on before invoking onDidDestroy observers 2014-08-28 17:23:49 -06:00
Nathan Sobo
cee7539e35 Add PaneContainer::observePanes and ::onDidAddPane 2014-08-28 17:22:28 -06:00
Nathan Sobo
5471e9bccc Add PaneContainer::onDidDestroyPaneItem 2014-08-28 16:58:38 -06:00
Nathan Sobo
b60b9f3e3a Add Pane::observeItems 2014-08-28 16:40:54 -06:00
Nathan Sobo
12f78dd957 💄 2014-08-28 16:27:20 -06:00
Nathan Sobo
cea4db5381 Break pane API into sections 2014-08-28 16:24:53 -06:00
Nathan Sobo
345617e0f3 Clean up existing pane API docs 2014-08-28 15:57:30 -06:00
Nathan Sobo
78c24fb737 Remove legacy event documentation 2014-08-28 15:54:16 -06:00
Nathan Sobo
e88eb3012e Document Pane event subscription methods 2014-08-28 15:32:02 -06:00
Nathan Sobo
d7063c0932 Add Pane::onDidDestroy 2014-08-28 15:21:35 -06:00
Nathan Sobo
34cb5d6012 Don’t implement ::isActive in terms of the theorist model behavior 2014-08-28 15:21:10 -06:00
Nathan Sobo
4f826a70f8 Use Array instead of Sequence for Pane::items 2014-08-28 11:43:08 -06:00
Nathan Sobo
475dc6074c 💄 2014-08-28 11:43:08 -06:00
Nathan Sobo
40d93cd0cf Use Pane::setActiveItem internally so observers are invoked 2014-08-28 11:43:08 -06:00
Nathan Sobo
99d70b4a4e Don’t emit ::onDidChangeActiveItem events unless it really changes 2014-08-28 11:43:08 -06:00
Nathan Sobo
e7a7e86dea Add Pane::observeActive and ::observeActiveItem
These have behavior semantics, invoking the observer immediately with
the current value of the observed property.
2014-08-28 11:43:07 -06:00
Nathan Sobo
44d70aaa5b Add Pane::onDidChangeActive() 2014-08-28 11:43:07 -06:00
Nathan Sobo
2b63f8a4ee Add PaneContainer::onDidChangeActivePane 2014-08-28 11:43:07 -06:00
Nathan Sobo
8225f759bf Add Pane::onWillDestroyItem() 2014-08-28 11:43:07 -06:00
Nathan Sobo
2d58d9c8b5 Add Pane::onDidActivate 2014-08-28 11:43:07 -06:00
Nathan Sobo
548018e9b2 Add spec for onDidRemoveItem observers when moving items to other panes 2014-08-28 11:43:07 -06:00
Nathan Sobo
9bd2eec4bc Add Pane::onDidMoveItem() 2014-08-28 11:43:07 -06:00
Nathan Sobo
b8fcbe9451 Start adding event subscription methods to pane
This branch uses EventKit, an ultra-simple library for implementing
events. The object implementing the methods maintains its own emitter
object rather than doing a mixin like Emissary encourages. This will
make it easier for us to deprecate ::on on the object itself. Unlike
emissary, the EventKit Emitter implements a super minimalistic API that
only allows one value to be emitted and always returns a Disposable
from subscriptions.
2014-08-28 11:43:06 -06:00
Ben Ogle
c294208f87 📝 Convert PaneView docs 2014-08-25 15:13:45 -07:00
Ben Ogle
d7f3add250 📝 Convert Pane docs 2014-08-25 15:13:45 -07:00
Nathan Sobo
b2c70f9e69 Move serialization of active pane from Pane to PaneContainer
Fixes #2694
Fixel #2853

Previously, we were storing an `active` boolean for each pane. We've
had some strange bugs where every pane is serializing `active: false`,
which causes exceptions when loading up the stored data.

This new approach serializes the activePaneId on the PaneContainer
itself. Since the PaneContainer is the source of truth regarding the
active pane, it makes more sense to handle it here.

This unfortunately changes the serialization version for the
PaneContainer, so people won't have their state persisted after
upgrading. But it seems better than leaving cruft to handle the old
serialization situation.
2014-07-07 16:36:10 -06:00
Nathan Sobo
43b5a9cfd0 Don't set focused: true on new pane when splitting
This causes the active item to change in the model before the associated
view can be added, which causes problems with the ReactEditorView having
methods called on it before its afterAttach hook creates the component.

We call Pane::activate subsequently unless activation is suppressed,
which will focus the pane anyway, so this was redundant.
2014-06-09 16:48:51 +09:00
Nathan Sobo
b1563fdfc0 Destroy item's of last pane even if the pane itself is not destroyed
We always want to preserve at least one pane, so we don't call destroy
on the pane if it is the last pane. However, we still want to destroy
its items. This was previously relying on the view to destroy the
underlying item, which isn't as reliable as doing it in the model.
2014-06-09 15:04:51 +09:00
Kevin Sawicki
8b5fd64dd4 Guard against PaneAxis as first child
Pane::findLeftmostSibling expected to return a Pane, not a PaneAxis
2014-05-05 11:28:36 -07:00
Kevin Sawicki
1c514bdc6b Split right when rightmost sibling is an axis
This was previously throwing an error when Workspace::open was called
with a split: right option and the rightmost sibling was a PaneAxis
since it was assuming findOrCreateRightmostSibling was always returning
a Pane, not a PaneAxis.
2014-05-05 11:28:36 -07:00
Kevin Sawicki
864ab0c095 Use file path in save as dialog
Previously the dirname of the file path was used which caused the
save dialog to not be filled in with the current file name

Closes #1748
2014-03-12 18:41:50 -07:00
probablycorey
57e7335907 Merge branch 'cj-update-markdown-preview'
Conflicts:
	src/pane.coffee
2014-02-11 11:33:46 -08:00
probablycorey
a2fcc7aa7a Add Workspace::getActiveEditor and Pane::getActiveEditor 2014-02-11 10:58:24 -08:00
probablycorey
4b529ae167 Make methods private 2014-02-11 09:33:12 -08:00
probablycorey
51fbb1be07 Add Pane::getActiveItem 2014-02-11 08:59:34 -08:00
probablycorey
af1f57048b Add Pane::getActiveItem 2014-02-11 08:55:45 -08:00
Kevin Sawicki
e5c31495cb 📝 doc parameters in pane.coffee 2014-02-06 16:55:19 -08:00
Kevin Sawicki
967db1f7b8 Remove more empty Private: comment blocks 2014-02-06 11:21:03 -08:00
Kevin Sawicki
932a792289 Remove Private: prefix 2014-02-06 10:02:53 -08:00
Kevin Sawicki
0a62277cfa 📝 doc Pane::getItems 2014-02-04 11:47:04 -08:00
Nathan Sobo
726b546004 Handle the 'split' option directly in Workspace::openSingletonSync 2014-01-21 16:44:06 -07:00
Brandon Tilley
8bba4d8add Intelligently activate new items when the active item is closed
If the active item was the pane's first item, the second item (which is
the new first item) is activated. Otherwise, the item to the left of the
closed item is activated.
2014-01-20 14:34:02 -08:00
Kevin Sawicki
e0cf20cda9 Don't throw error when saving empty pane
Closes #1440
2014-01-17 15:24:55 -08:00
Nathan Sobo
926493f05c Emit 'item-added' before setting the ::activeItem when adding first item
Fixes atom/tabs#11
2014-01-17 11:10:17 -07:00
Nathan Sobo
5e14d44d6a Destroy all pane models when workspace view is removed 2014-01-15 16:07:47 -07:00
Nathan Sobo
9af4b14716 Never allow PaneContainer::root to be null 2014-01-15 16:07:47 -07:00
Nathan Sobo
aed9f18457 Accivate the first added pane item 2014-01-15 16:07:47 -07:00
Nathan Sobo
012363a785 Null guard item in ::destroyActiveItem 2014-01-15 16:07:47 -07:00
Nathan Sobo
44331d0ba6 Fix issues splitting panes with DOM events
* ::copyActiveItem guards against not having an active item
* The Pane constructor removes undefined items from params.items
2014-01-15 16:07:47 -07:00