Commit Graph

71 Commits

Author SHA1 Message Date
czeidler
04b1c44b89 Use a tab BReference as argument in Area::Set{Left, Top, Right, Bottom}.
Using a normal pointer is dangerous when creating a new tab directly in the method call because the tab gets deleted to early.
2012-10-17 07:33:54 +00:00
czeidler
6c4a44e36b Add a list of constraints which can be associated with a BALMLayout.
- Add Get{X,Y}Tabs methods.
- Remove SaveLayout and RestoreLayout. These can be implemented outside of BALMLayout.
2012-09-01 16:31:13 +12:00
Alex Wilson
5f4e71ba4c Replace BALMLayoutBuilder::Snake class with a stack.
The interface to BALMLayoutBuilder is still pretty much the same, but
this simplifies the class a bit.
2012-05-03 08:45:43 +12:00
Alex Wilson
0a5e130725 Make SharedSolver BArchivable to save extra user constraints. 2012-05-03 08:45:36 +12:00
Alex Wilson
015e5f06d8 Make BALMLayout::BadLayoutPolicy archivable. 2012-05-03 08:45:34 +12:00
Alex Wilson
35bf0b5c1c Add initial support for archiving a BALMLayout.
What's supported:
* basic archive/instantiate
* friend layouts
coming soon:
* saving of custom restraints
* archiving of BadLayoutPolicy
2012-05-03 08:45:32 +12:00
Alex Wilson
bc7956c7cf Use const overloading on BALMLayout::{X|Y}TabAt(). 2012-05-03 08:45:26 +12:00
czeidler
d7568eabd2 Add IndexOf methods. 2012-05-03 08:45:25 +12:00
Alex Wilson
681f48fcbc Replace BALMLayout::Ordered*Tabs() method with *TabAt(int, bool sorted). 2012-05-03 08:45:17 +12:00
Alex Wilson
09e87fa352 Pass more information to BadLayoutPolicy.
Also, re-add BadLayoutPolicy invocations, which were lost while creating
SharedSolver.
2012-05-03 08:45:06 +12:00
Alex Wilson
419fe0b8ae Introduce SharedSolver class to improve BALMLayout's friend feature. 2012-05-03 08:45:02 +12:00
Alex Wilson
708a298e22 Refactor XTab and YTab to share a common base, TabBase.
TabBase takes care of layout tracking etc..
2012-05-03 08:45:01 +12:00
Alex Wilson
a9761aedbf Refactor BALMLayout::AddItem to reduce repitition. 2012-05-03 08:45:00 +12:00
Alex Wilson
c761a8a6d4 Let BALM::{X|Y}Tabs be in multiple BALMLayouts, if they are friendly. 2012-05-03 08:44:55 +12:00
Alex Wilson
f9cabdd009 Use BReferenceable properties of LinearSpec in BALMLayout.
This saves us from a potential use-afte-free bug.
2012-05-03 08:44:54 +12:00
Alex Wilson
f6db102e47 Make BALMLayout respect its position when nested. 2012-05-03 08:44:50 +12:00
Alex Wilson
2bbf8b1fbc Add the ability to handle bad layouts to BALMLayout. 2012-05-03 08:44:45 +12:00
Alex Wilson
20cc993ab5 Remove BALM::Area::fConstraints field, which is not needed.
It's easier to just delete all the constraints in the dtor, the ones that
wouldn't have been in fConstraints are NULL at this point anyway.
2012-05-03 08:44:39 +12:00
Alex Wilson
895414da9d In BALM::Area rename fTopLeftInset to fLeftTopInset.
This is consistent with for instance, the BSize ctor.
2012-05-03 08:44:38 +12:00
Alex Wilson
f0307e765e Fix spacing before first header in src/libs/alm.
Also add copyright header in ALMGroup.cpp.
2012-05-03 08:44:36 +12:00
Alex Wilson
324ce2851d Add FBC padding to ALM classes. 2012-05-03 08:44:35 +12:00
Alex Wilson
7e021d45da Make BALM::InsetForTab() methods const. 2012-05-03 08:44:34 +12:00
Alex Wilson
0da6f2e916 Rename BALM::GroupItem to BALM::ALMGroup, and move it to its own files.
Also make ALMGroup totally self-contained, i.e. BALMLayout no longer
does the parsing, and is completely unaware of ALMGroup. A small touch
of refactoring as well.
2012-05-03 08:44:32 +12:00
Alex Wilson
a25ffa4f04 Style cleanup in alm: mostly clean includes. 2012-05-03 08:44:31 +12:00
Alex Wilson
7dd17203c8 Make Area insets more consistent with other HAIKU inset APIs. 2012-05-03 08:44:29 +12:00
Alex Wilson
d814593064 Remove BALMLayout::Add*To* methods, which are availabe in the builder. 2012-05-03 08:44:26 +12:00
Alex Wilson
50cc24b3f9 Add a Builder for BALMLayout. 2012-05-03 08:44:23 +12:00
Alex Wilson
b50d4ed8bd Add new methods to BALMLayout for adding multiple x/y tabs at once. 2012-05-03 08:44:22 +12:00
Alex Wilson
8b52747974 In Area, remove unused ItemFrame() method.
Also modify Frame() method to return a rect with rounded coordinates.
2012-05-03 08:44:21 +12:00
Alex Wilson
574533ef12 In BALMLayout, make AddView(...) consistent with other layouts.
If a BView is added which has a BLayout, use the layout as a BLayoutItem
to represent that view, as other layouts do.
2012-05-03 08:44:19 +12:00
Alex Wilson
75e2dcf8fe In BALMLayout, allow for more flexibility in spacing and insets.
* allow for independent left, top, right and bottom insets
* allow for independent vertical and horizontal spacing between tabs
* allow for the usage of Haiku's spacing constants such as B_USE_WINDOW_INSETS
2012-05-03 08:44:17 +12:00
Alex Wilson
fefa17f47e Remove unused 'PerformancePath' stuff. 2012-05-03 08:44:14 +12:00
czeidler
c3e57dc36d Give the area an id. 2012-05-03 08:44:13 +12:00
czeidler
b7630c4c98 Save and restore layout. 2012-05-03 08:44:11 +12:00
Alex Wilson
a84e14ca84 Merge branch 'master' of git://github.com/haiku/haiku 2011-12-15 20:50:28 -07:00
czeidler
57014d1ff7 Make tabs BReferenceable. Maintain a list of tabs. 2011-11-30 17:55:36 +13:00
Alex Wilson
17499672a0 Bring BALMLayout in line with changes to BLayout. 2011-10-28 14:16:46 -06:00
Clemens Zeidler
ef93b55df4 - Areas with same tabs are put in a column/row automtically. Move preferred size constraint from Area to the column/row. This avoids a "spring" effect of the
quadratic solver if multiple Areas are in the same column/row.
- Replace GetString by ToString.
- some clean up



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40941 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-03-14 00:24:12 +00:00
Clemens Zeidler
8286779101 Make kp_solve interface work again.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40384 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-02-08 09:01:11 +00:00
Clemens Zeidler
7583db5a1e Add an alternative solver to lp_solve. The solver based on Ingo's active set solver but is able to handle arbitrary hard and soft constraints. The advantage to lp_solve is that the active set solver can optimize variable in respect to a quadratic objective function. This makes it possible to minimise the quadratic derivation to a desired value e.g. \Sum_i(x_i - x_{i,pref})^2 -> min.
The solver part has been refactored in this way that both solver can be used with the same layout specifications. The active set solver is default now; the performance is not as good as lp_solve, though.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40285 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-01-25 04:59:40 +00:00
Clemens Zeidler
c97cd0f4da Also update the preferred size constraints correctly when replacing the tabs.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39644 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-11-26 04:33:06 +00:00
Clemens Zeidler
8fa4fd37b7 Keep the preferred size ratio into account. This make layout behaviour much more intuitive when resizing a window. Thanks Christof.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39641 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-11-26 04:20:38 +00:00
Clemens Zeidler
b23e9af5b5 Thanks to anevilyak, the previous approach was not thread safe. You can specify a friend layout now if you want to connect tabs of different BALMLayout's.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39041 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-21 11:19:18 +00:00
Clemens Zeidler
56187df6eb Use a global solver per application. This make it possible to wire different BALMLayout's.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39040 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-21 11:05:38 +00:00
Clemens Zeidler
fc691d7de2 - Remove lp_solve dependencies form Variable class and put everything into LinearSpec. As a side effect Variable management is a bit more consistence now. We want to replace lp_solve soon so it will be easier to replace it just in LinearSpec.
- Update copyrights.
- Lot of small things related to the Variable refactoring.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38892 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-05 20:15:55 +00:00
Clemens Zeidler
6751b48834 Fix gcc2 build + warnings.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38885 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-04 19:10:22 +00:00
Clemens Zeidler
37344020ef - Add a alternative method to setup a group layout. BLayoutItem / BView are wrapped into a GroupItem. GroupItem overloads the | (horizontal tiling) and / (vertical tiling) operators. In this manner you can create a group layout using these operators, e.g. GroupItem item = GroupItem(button1) | (GroupItem(button2) / GroupItem(button3)); would layout button1 at the left and button2 and button3 at the right in a vertical layout. All the layout information is stored in the GroupItem item, to setup the final layout you have to call BuildLayout(item). If you like it it could also be added to the BGroupLayout.
- Add operator test app.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38877 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-03 20:05:52 +00:00
Clemens Zeidler
70e2076135 - Add helper functions to get the tabs of a view or a layout item.
- AddView only require the top, left tabs now.
- Remove the TwoViews test and replace it with a slightly more complex test.
- Merge XTab and YTab files into one header file.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38860 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-30 01:32:48 +00:00
Clemens Zeidler
5b6fca0639 - Rework the ALM layout api. The AddItemTo* function are now related to the current Area. On default the current Area is the last added Area.
- Add some more const where appreciated.
- Fix some style issues and a leak in Row and Column.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38842 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-29 03:30:47 +00:00
Clemens Zeidler
19ddd4f1cb SetDefaultBehavior is not needed since all views handled in this function have min and max size equal the pref size (despite of the status bar length, which is ok). As a result they don't grow or shrink undesirable as assumed previously. As a result also the AutoPreferredContentSize is not needed.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38795 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-09-23 07:57:40 +00:00