1 | <!doctype html>
|
---|
2 | <html>
|
---|
3 | <head>
|
---|
4 | <title>/home/haiku/haiku/haiku/src/servers/app/decorator/TabDecorator.cpp</title>
|
---|
5 | <style type="text/css">
|
---|
6 | body { color:#000000; background-color:#ffffff }
|
---|
7 | body { font-family:Helvetica, sans-serif; font-size:10pt }
|
---|
8 | h1 { font-size:14pt }
|
---|
9 | .code { border-collapse:collapse; width:100%; }
|
---|
10 | .code { font-family: "Monospace", monospace; font-size:10pt }
|
---|
11 | .code { line-height: 1.2em }
|
---|
12 | .comment { color: green; font-style: oblique }
|
---|
13 | .keyword { color: blue }
|
---|
14 | .string_literal { color: red }
|
---|
15 | .directive { color: darkmagenta }
|
---|
16 | .expansion { display: none; }
|
---|
17 | .macro:hover .expansion { display: block; border: 2px solid #FF0000; padding: 2px; background-color:#FFF0F0; font-weight: normal; -webkit-border-radius:5px; -webkit-box-shadow:1px 1px 7px #000; border-radius:5px; box-shadow:1px 1px 7px #000; position: absolute; top: -1em; left:10em; z-index: 1 }
|
---|
18 | .macro { color: darkmagenta; background-color:LemonChiffon; position: relative }
|
---|
19 | .num { width:2.5em; padding-right:2ex; background-color:#eeeeee }
|
---|
20 | .num { text-align:right; font-size:8pt }
|
---|
21 | .num { color:#444444 }
|
---|
22 | .line { padding-left: 1ex; border-left: 3px solid #ccc }
|
---|
23 | .line { white-space: pre }
|
---|
24 | .msg { -webkit-box-shadow:1px 1px 7px #000 }
|
---|
25 | .msg { box-shadow:1px 1px 7px #000 }
|
---|
26 | .msg { -webkit-border-radius:5px }
|
---|
27 | .msg { border-radius:5px }
|
---|
28 | .msg { font-family:Helvetica, sans-serif; font-size:8pt }
|
---|
29 | .msg { float:left }
|
---|
30 | .msg { padding:0.25em 1ex 0.25em 1ex }
|
---|
31 | .msg { margin-top:10px; margin-bottom:10px }
|
---|
32 | .msg { font-weight:bold }
|
---|
33 | .msg { max-width:60em; word-wrap: break-word; white-space: pre-wrap }
|
---|
34 | .msgT { padding:0x; spacing:0x }
|
---|
35 | .msgEvent { background-color:#fff8b4; color:#000000 }
|
---|
36 | .msgControl { background-color:#bbbbbb; color:#000000 }
|
---|
37 | .msgNote { background-color:#ddeeff; color:#000000 }
|
---|
38 | .mrange { background-color:#dfddf3 }
|
---|
39 | .mrange { border-bottom:1px solid #6F9DBE }
|
---|
40 | .PathIndex { font-weight: bold; padding:0px 5px; margin-right:5px; }
|
---|
41 | .PathIndex { -webkit-border-radius:8px }
|
---|
42 | .PathIndex { border-radius:8px }
|
---|
43 | .PathIndexEvent { background-color:#bfba87 }
|
---|
44 | .PathIndexControl { background-color:#8c8c8c }
|
---|
45 | .PathNav a { text-decoration:none; font-size: larger }
|
---|
46 | .CodeInsertionHint { font-weight: bold; background-color: #10dd10 }
|
---|
47 | .CodeRemovalHint { background-color:#de1010 }
|
---|
48 | .CodeRemovalHint { border-bottom:1px solid #6F9DBE }
|
---|
49 | table.simpletable {
|
---|
50 | padding: 5px;
|
---|
51 | font-size:12pt;
|
---|
52 | margin:20px;
|
---|
53 | border-collapse: collapse; border-spacing: 0px;
|
---|
54 | }
|
---|
55 | td.rowname {
|
---|
56 | text-align: right;
|
---|
57 | vertical-align: top;
|
---|
58 | font-weight: bold;
|
---|
59 | color:#444444;
|
---|
60 | padding-right:2ex;
|
---|
61 | }
|
---|
62 | </style>
|
---|
63 | </head>
|
---|
64 | <body>
|
---|
65 | <!-- BUGDESC Dereference of null pointer -->
|
---|
66 |
|
---|
67 | <!-- BUGTYPE Dereference of null pointer -->
|
---|
68 |
|
---|
69 | <!-- BUGCATEGORY Logic error -->
|
---|
70 |
|
---|
71 | <!-- BUGFILE /home/haiku/haiku/haiku/src/servers/app/decorator/TabDecorator.cpp -->
|
---|
72 |
|
---|
73 | <!-- FILENAME TabDecorator.cpp -->
|
---|
74 |
|
---|
75 | <!-- FUNCTIONNAME _DistributeTabSize -->
|
---|
76 |
|
---|
77 | <!-- ISSUEHASHCONTENTOFLINEINCONTEXT ae4052b92c375958814c98a1b31447ea -->
|
---|
78 |
|
---|
79 | <!-- BUGLINE 468 -->
|
---|
80 |
|
---|
81 | <!-- BUGCOLUMN 29 -->
|
---|
82 |
|
---|
83 | <!-- BUGPATHLENGTH 20 -->
|
---|
84 |
|
---|
85 | <!-- BUGMETAEND -->
|
---|
86 | <!-- REPORTHEADER -->
|
---|
87 | <h3>Bug Summary</h3>
|
---|
88 | <table class="simpletable">
|
---|
89 | <tr><td class="rowname">File:</td><td>src/servers/app/decorator/TabDecorator.cpp</td></tr>
|
---|
90 | <tr><td class="rowname">Warning:</td><td><a href="#EndPath">line 468, column 29</a><br />Dereference of null pointer</td></tr>
|
---|
91 | </table>
|
---|
92 | <!-- REPORTSUMMARYEXTRA -->
|
---|
93 | <h3>Annotated Source Code</h3>
|
---|
94 | <table class="code">
|
---|
95 | <tr><td class="num" id="LN1">1</td><td class="line"><span class='comment'>/*</span></td></tr>
|
---|
96 | <tr><td class="num" id="LN2">2</td><td class="line"> <span class='comment'>* Copyright 2001-2015 Haiku, Inc.</span></td></tr>
|
---|
97 | <tr><td class="num" id="LN3">3</td><td class="line"> <span class='comment'>* Distributed under the terms of the MIT License.</span></td></tr>
|
---|
98 | <tr><td class="num" id="LN4">4</td><td class="line"> <span class='comment'>*</span></td></tr>
|
---|
99 | <tr><td class="num" id="LN5">5</td><td class="line"> <span class='comment'>* Authors:</span></td></tr>
|
---|
100 | <tr><td class="num" id="LN6">6</td><td class="line"> <span class='comment'>* Stephan Aßmus, superstippi@gmx.de</span></td></tr>
|
---|
101 | <tr><td class="num" id="LN7">7</td><td class="line"> <span class='comment'>* DarkWyrm, bpmagic@columbus.rr.com</span></td></tr>
|
---|
102 | <tr><td class="num" id="LN8">8</td><td class="line"> <span class='comment'>* Ryan Leavengood, leavengood@gmail.com</span></td></tr>
|
---|
103 | <tr><td class="num" id="LN9">9</td><td class="line"> <span class='comment'>* Philippe Saint-Pierre, stpere@gmail.com</span></td></tr>
|
---|
104 | <tr><td class="num" id="LN10">10</td><td class="line"> <span class='comment'>* John Scipione, jscipione@gmail.com</span></td></tr>
|
---|
105 | <tr><td class="num" id="LN11">11</td><td class="line"> <span class='comment'>* Ingo Weinhold, ingo_weinhold@gmx.de</span></td></tr>
|
---|
106 | <tr><td class="num" id="LN12">12</td><td class="line"> <span class='comment'>* Clemens Zeidler, haiku@clemens-zeidler.de</span></td></tr>
|
---|
107 | <tr><td class="num" id="LN13">13</td><td class="line"> <span class='comment'>* Joseph Groover <looncraz@looncraz.net></span></td></tr>
|
---|
108 | <tr><td class="num" id="LN14">14</td><td class="line"> <span class='comment'>*/</span></td></tr>
|
---|
109 | <tr><td class="num" id="LN15">15</td><td class="line"> </td></tr>
|
---|
110 | <tr><td class="num" id="LN16">16</td><td class="line"> </td></tr>
|
---|
111 | <tr><td class="num" id="LN17">17</td><td class="line"><span class='comment'>/*! Decorator made up of tabs */</span></td></tr>
|
---|
112 | <tr><td class="num" id="LN18">18</td><td class="line"> </td></tr>
|
---|
113 | <tr><td class="num" id="LN19">19</td><td class="line"> </td></tr>
|
---|
114 | <tr><td class="num" id="LN20">20</td><td class="line"><span class='directive'>#include "TabDecorator.h"</span></td></tr>
|
---|
115 | <tr><td class="num" id="LN21">21</td><td class="line"> </td></tr>
|
---|
116 | <tr><td class="num" id="LN22">22</td><td class="line"><span class='directive'>#include <algorithm></span></td></tr>
|
---|
117 | <tr><td class="num" id="LN23">23</td><td class="line"><span class='directive'>#include <cmath></span></td></tr>
|
---|
118 | <tr><td class="num" id="LN24">24</td><td class="line"><span class='directive'>#include <new></span></td></tr>
|
---|
119 | <tr><td class="num" id="LN25">25</td><td class="line"><span class='directive'>#include <stdio.h></span></td></tr>
|
---|
120 | <tr><td class="num" id="LN26">26</td><td class="line"> </td></tr>
|
---|
121 | <tr><td class="num" id="LN27">27</td><td class="line"><span class='directive'>#include <Autolock.h></span></td></tr>
|
---|
122 | <tr><td class="num" id="LN28">28</td><td class="line"><span class='directive'>#include <Debug.h></span></td></tr>
|
---|
123 | <tr><td class="num" id="LN29">29</td><td class="line"><span class='directive'>#include <GradientLinear.h></span></td></tr>
|
---|
124 | <tr><td class="num" id="LN30">30</td><td class="line"><span class='directive'>#include <Rect.h></span></td></tr>
|
---|
125 | <tr><td class="num" id="LN31">31</td><td class="line"><span class='directive'>#include <View.h></span></td></tr>
|
---|
126 | <tr><td class="num" id="LN32">32</td><td class="line"> </td></tr>
|
---|
127 | <tr><td class="num" id="LN33">33</td><td class="line"><span class='directive'>#include <WindowPrivate.h></span></td></tr>
|
---|
128 | <tr><td class="num" id="LN34">34</td><td class="line"> </td></tr>
|
---|
129 | <tr><td class="num" id="LN35">35</td><td class="line"><span class='directive'>#include "BitmapDrawingEngine.h"</span></td></tr>
|
---|
130 | <tr><td class="num" id="LN36">36</td><td class="line"><span class='directive'>#include "DesktopSettings.h"</span></td></tr>
|
---|
131 | <tr><td class="num" id="LN37">37</td><td class="line"><span class='directive'>#include "DrawingEngine.h"</span></td></tr>
|
---|
132 | <tr><td class="num" id="LN38">38</td><td class="line"><span class='directive'>#include "DrawState.h"</span></td></tr>
|
---|
133 | <tr><td class="num" id="LN39">39</td><td class="line"><span class='directive'>#include "FontManager.h"</span></td></tr>
|
---|
134 | <tr><td class="num" id="LN40">40</td><td class="line"><span class='directive'>#include "PatternHandler.h"</span></td></tr>
|
---|
135 | <tr><td class="num" id="LN41">41</td><td class="line"> </td></tr>
|
---|
136 | <tr><td class="num" id="LN42">42</td><td class="line"> </td></tr>
|
---|
137 | <tr><td class="num" id="LN43">43</td><td class="line"><span class='comment'>//#define DEBUG_DECORATOR</span></td></tr>
|
---|
138 | <tr><td class="num" id="LN44">44</td><td class="line"><span class='directive'>#ifdef DEBUG_DECORATOR</span></td></tr>
|
---|
139 | <tr><td class="num" id="LN45">45</td><td class="line"><span class='directive'># define <span class='macro'>STRACE(x)<span class='expansion'>;</span></span> printf x</span></td></tr>
|
---|
140 | <tr><td class="num" id="LN46">46</td><td class="line"><span class='directive'>#else</span></td></tr>
|
---|
141 | <tr><td class="num" id="LN47">47</td><td class="line"><span class='directive'># define <span class='macro'>STRACE(x)<span class='expansion'>;</span></span> ;</span></td></tr>
|
---|
142 | <tr><td class="num" id="LN48">48</td><td class="line"><span class='directive'>#endif</span></td></tr>
|
---|
143 | <tr><td class="num" id="LN49">49</td><td class="line"> </td></tr>
|
---|
144 | <tr><td class="num" id="LN50">50</td><td class="line"> </td></tr>
|
---|
145 | <tr><td class="num" id="LN51">51</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>bool</span></td></tr>
|
---|
146 | <tr><td class="num" id="LN52">52</td><td class="line">int_equal(<span class='keyword'>float</span> x, <span class='keyword'>float</span> y)</td></tr>
|
---|
147 | <tr><td class="num" id="LN53">53</td><td class="line">{</td></tr>
|
---|
148 | <tr><td class="num" id="LN54">54</td><td class="line"> <span class='keyword'>return</span> abs(x - y) <= 1;</td></tr>
|
---|
149 | <tr><td class="num" id="LN55">55</td><td class="line">}</td></tr>
|
---|
150 | <tr><td class="num" id="LN56">56</td><td class="line"> </td></tr>
|
---|
151 | <tr><td class="num" id="LN57">57</td><td class="line"> </td></tr>
|
---|
152 | <tr><td class="num" id="LN58">58</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>const</span> <span class='keyword'>float</span> kBorderResizeLength = 22.0;</td></tr>
|
---|
153 | <tr><td class="num" id="LN59">59</td><td class="line"><span class='keyword'>static</span> <span class='keyword'>const</span> <span class='keyword'>float</span> kResizeKnobSize = 18.0;</td></tr>
|
---|
154 | <tr><td class="num" id="LN60">60</td><td class="line"> </td></tr>
|
---|
155 | <tr><td class="num" id="LN61">61</td><td class="line"> </td></tr>
|
---|
156 | <tr><td class="num" id="LN62">62</td><td class="line"><span class='comment'>// #pragma mark -</span></td></tr>
|
---|
157 | <tr><td class="num" id="LN63">63</td><td class="line"> </td></tr>
|
---|
158 | <tr><td class="num" id="LN64">64</td><td class="line"> </td></tr>
|
---|
159 | <tr><td class="num" id="LN65">65</td><td class="line"><span class='comment'>// TODO: get rid of DesktopSettings here, and introduce private accessor</span></td></tr>
|
---|
160 | <tr><td class="num" id="LN66">66</td><td class="line"><span class='comment'>// methods to the Decorator base class</span></td></tr>
|
---|
161 | <tr><td class="num" id="LN67">67</td><td class="line">TabDecorator::TabDecorator(DesktopSettings& settings, BRect frame,</td></tr>
|
---|
162 | <tr><td class="num" id="LN68">68</td><td class="line"> Desktop* desktop)</td></tr>
|
---|
163 | <tr><td class="num" id="LN69">69</td><td class="line"> :</td></tr>
|
---|
164 | <tr><td class="num" id="LN70">70</td><td class="line"> Decorator(settings, frame, desktop),</td></tr>
|
---|
165 | <tr><td class="num" id="LN71">71</td><td class="line"> fOldMovingTab(0, 0, -1, -1)</td></tr>
|
---|
166 | <tr><td class="num" id="LN72">72</td><td class="line">{</td></tr>
|
---|
167 | <tr><td class="num" id="LN73">73</td><td class="line"> <span class='macro'>STRACE((<span class='string_literal'>"TabDecorator:\n"</span>))<span class='expansion'>;</span></span>;</td></tr>
|
---|
168 | <tr><td class="num" id="LN74">74</td><td class="line"> <span class='macro'>STRACE((<span class='string_literal'>"\tFrame (%.1f,%.1f,%.1f,%.1f)\n"</span>,<span class='expansion'>;</span></span></td></tr>
|
---|
169 | <tr><td class="num" id="LN75">75</td><td class="line"> <span class='macro'>frame.left, frame.top, frame.right, frame.bottom))<span class='expansion'>;</span></span>;</td></tr>
|
---|
170 | <tr><td class="num" id="LN76">76</td><td class="line"> </td></tr>
|
---|
171 | <tr><td class="num" id="LN77">77</td><td class="line"> <span class='comment'>// TODO: If the decorator was created with a frame too small, it should</span></td></tr>
|
---|
172 | <tr><td class="num" id="LN78">78</td><td class="line"> <span class='comment'>// resize itself!</span></td></tr>
|
---|
173 | <tr><td class="num" id="LN79">79</td><td class="line">}</td></tr>
|
---|
174 | <tr><td class="num" id="LN80">80</td><td class="line"> </td></tr>
|
---|
175 | <tr><td class="num" id="LN81">81</td><td class="line"> </td></tr>
|
---|
176 | <tr><td class="num" id="LN82">82</td><td class="line">TabDecorator::~TabDecorator()</td></tr>
|
---|
177 | <tr><td class="num" id="LN83">83</td><td class="line">{</td></tr>
|
---|
178 | <tr><td class="num" id="LN84">84</td><td class="line"> <span class='macro'>STRACE((<span class='string_literal'>"TabDecorator: ~TabDecorator()\n"</span>))<span class='expansion'>;</span></span>;</td></tr>
|
---|
179 | <tr><td class="num" id="LN85">85</td><td class="line">}</td></tr>
|
---|
180 | <tr><td class="num" id="LN86">86</td><td class="line"> </td></tr>
|
---|
181 | <tr><td class="num" id="LN87">87</td><td class="line"> </td></tr>
|
---|
182 | <tr><td class="num" id="LN88">88</td><td class="line"><span class='comment'>// #pragma mark - Public methods</span></td></tr>
|
---|
183 | <tr><td class="num" id="LN89">89</td><td class="line"> </td></tr>
|
---|
184 | <tr><td class="num" id="LN90">90</td><td class="line"> </td></tr>
|
---|
185 | <tr><td class="num" id="LN91">91</td><td class="line"><span class='comment'>/*! \brief Updates the decorator in the rectangular area \a updateRect.</span></td></tr>
|
---|
186 | <tr><td class="num" id="LN92">92</td><td class="line"> </td></tr>
|
---|
187 | <tr><td class="num" id="LN93">93</td><td class="line"> <span class='comment'>Updates all areas which intersect the frame and tab.</span></td></tr>
|
---|
188 | <tr><td class="num" id="LN94">94</td><td class="line"> </td></tr>
|
---|
189 | <tr><td class="num" id="LN95">95</td><td class="line"> <span class='comment'>\param updateRect The rectangular area to update.</span></td></tr>
|
---|
190 | <tr><td class="num" id="LN96">96</td><td class="line"><span class='comment'>*/</span></td></tr>
|
---|
191 | <tr><td class="num" id="LN97">97</td><td class="line"><span class='keyword'>void</span></td></tr>
|
---|
192 | <tr><td class="num" id="LN98">98</td><td class="line">TabDecorator::Draw(BRect updateRect)</td></tr>
|
---|
193 | <tr><td class="num" id="LN99">99</td><td class="line">{</td></tr>
|
---|
194 | <tr><td class="num" id="LN100">100</td><td class="line"> <span class='macro'>STRACE((<span class='string_literal'>"TabDecorator::Draw(BRect "<span class='expansion'>;</span></span></span></td></tr>
|
---|
195 | <tr><td class="num" id="LN101">101</td><td class="line"> <span class='string_literal'><span class='macro'>"updateRect(l:%.1f, t:%.1f, r:%.1f, b:%.1f))\n"</span>,<span class='expansion'>;</span></span></td></tr>
|
---|
196 | <tr><td class="num" id="LN102">102</td><td class="line"> <span class='macro'>updateRect.left, updateRect.top, updateRect.right, updateRect.bottom))<span class='expansion'>;</span></span>;</td></tr>
|
---|
197 | <tr><td class="num" id="LN103">103</td><td class="line"> </td></tr>
|
---|
198 | <tr><td class="num" id="LN104">104</td><td class="line"> fDrawingEngine->SetDrawState(&fDrawState);</td></tr>
|
---|
199 | <tr><td class="num" id="LN105">105</td><td class="line"> </td></tr>
|
---|
200 | <tr><td class="num" id="LN106">106</td><td class="line"> _DrawFrame(updateRect & fBorderRect);</td></tr>
|
---|
201 | <tr><td class="num" id="LN107">107</td><td class="line"> _DrawTabs(updateRect & fTitleBarRect);</td></tr>
|
---|
202 | <tr><td class="num" id="LN108">108</td><td class="line">}</td></tr>
|
---|
203 | <tr><td class="num" id="LN109">109</td><td class="line"> </td></tr>
|
---|
204 | <tr><td class="num" id="LN110">110</td><td class="line"> </td></tr>
|
---|
205 | <tr><td class="num" id="LN111">111</td><td class="line"><span class='comment'>//! Forces a complete decorator update</span></td></tr>
|
---|
206 | <tr><td class="num" id="LN112">112</td><td class="line"><span class='keyword'>void</span></td></tr>
|
---|
207 | <tr><td class="num" id="LN113">113</td><td class="line">TabDecorator::Draw()</td></tr>
|
---|
208 | <tr><td class="num" id="LN114">114</td><td class="line">{</td></tr>
|
---|
209 | <tr><td class="num" id="LN115">115</td><td class="line"> <span class='macro'>STRACE((<span class='string_literal'>"TabDecorator: Draw()"</span>))<span class='expansion'>;</span></span>;</td></tr>
|
---|
210 | <tr><td class="num" id="LN116">116</td><td class="line"> </td></tr>
|
---|
211 | <tr><td class="num" id="LN117">117</td><td class="line"> fDrawingEngine->SetDrawState(&fDrawState);</td></tr>
|
---|
212 | <tr><td class="num" id="LN118">118</td><td class="line"> </td></tr>
|
---|
213 | <tr><td class="num" id="LN119">119</td><td class="line"> _DrawFrame(fBorderRect);</td></tr>
|
---|
214 | <tr><td class="num" id="LN120">120</td><td class="line"> _DrawTabs(fTitleBarRect);</td></tr>
|
---|
215 | <tr><td class="num" id="LN121">121</td><td class="line">}</td></tr>
|
---|
216 | <tr><td class="num" id="LN122">122</td><td class="line"> </td></tr>
|
---|
217 | <tr><td class="num" id="LN123">123</td><td class="line"> </td></tr>
|
---|
218 | <tr><td class="num" id="LN124">124</td><td class="line">Decorator::Region</td></tr>
|
---|
219 | <tr><td class="num" id="LN125">125</td><td class="line">TabDecorator::RegionAt(BPoint where, int32& tab) <span class='keyword'>const</span></td></tr>
|
---|
220 | <tr><td class="num" id="LN126">126</td><td class="line">{</td></tr>
|
---|
221 | <tr><td class="num" id="LN127">127</td><td class="line"> <span class='comment'>// Let the base class version identify hits of the buttons and the tab.</span></td></tr>
|
---|
222 | <tr><td class="num" id="LN128">128</td><td class="line"> Region region = Decorator::RegionAt(where, tab);</td></tr>
|
---|
223 | <tr><td class="num" id="LN129">129</td><td class="line"> <span class='keyword'>if</span> (region != REGION_NONE)</td></tr>
|
---|
224 | <tr><td class="num" id="LN130">130</td><td class="line"> <span class='keyword'>return</span> region;</td></tr>
|
---|
225 | <tr><td class="num" id="LN131">131</td><td class="line"> </td></tr>
|
---|
226 | <tr><td class="num" id="LN132">132</td><td class="line"> <span class='comment'>// check the resize corner</span></td></tr>
|
---|
227 | <tr><td class="num" id="LN133">133</td><td class="line"> <span class='keyword'>if</span> (fTopTab->look == B_DOCUMENT_WINDOW_LOOK && fResizeRect.Contains(where))</td></tr>
|
---|
228 | <tr><td class="num" id="LN134">134</td><td class="line"> <span class='keyword'>return</span> REGION_RIGHT_BOTTOM_CORNER;</td></tr>
|
---|
229 | <tr><td class="num" id="LN135">135</td><td class="line"> </td></tr>
|
---|
230 | <tr><td class="num" id="LN136">136</td><td class="line"> <span class='comment'>// hit-test the borders</span></td></tr>
|
---|
231 | <tr><td class="num" id="LN137">137</td><td class="line"> <span class='keyword'>if</span> (fLeftBorder.Contains(where))</td></tr>
|
---|
232 | <tr><td class="num" id="LN138">138</td><td class="line"> <span class='keyword'>return</span> REGION_LEFT_BORDER;</td></tr>
|
---|
233 | <tr><td class="num" id="LN139">139</td><td class="line"> <span class='keyword'>if</span> (fTopBorder.Contains(where))</td></tr>
|
---|
234 | <tr><td class="num" id="LN140">140</td><td class="line"> <span class='keyword'>return</span> REGION_TOP_BORDER;</td></tr>
|
---|
235 | <tr><td class="num" id="LN141">141</td><td class="line"> </td></tr>
|
---|
236 | <tr><td class="num" id="LN142">142</td><td class="line"> <span class='comment'>// Part of the bottom and right borders may be a resize-region, so we have</span></td></tr>
|
---|
237 | <tr><td class="num" id="LN143">143</td><td class="line"> <span class='comment'>// to check explicitly, if it has been it.</span></td></tr>
|
---|
238 | <tr><td class="num" id="LN144">144</td><td class="line"> <span class='keyword'>if</span> (fRightBorder.Contains(where))</td></tr>
|
---|
239 | <tr><td class="num" id="LN145">145</td><td class="line"> region = REGION_RIGHT_BORDER;</td></tr>
|
---|
240 | <tr><td class="num" id="LN146">146</td><td class="line"> <span class='keyword'>else</span> <span class='keyword'>if</span> (fBottomBorder.Contains(where))</td></tr>
|
---|
241 | <tr><td class="num" id="LN147">147</td><td class="line"> region = REGION_BOTTOM_BORDER;</td></tr>
|
---|
242 | <tr><td class="num" id="LN148">148</td><td class="line"> <span class='keyword'>else</span></td></tr>
|
---|
243 | <tr><td class="num" id="LN149">149</td><td class="line"> <span class='keyword'>return</span> REGION_NONE;</td></tr>
|
---|
244 | <tr><td class="num" id="LN150">150</td><td class="line"> </td></tr>
|
---|
245 | <tr><td class="num" id="LN151">151</td><td class="line"> <span class='comment'>// check resize area</span></td></tr>
|
---|
246 | <tr><td class="num" id="LN152">152</td><td class="line"> <span class='keyword'>if</span> ((fTopTab->flags & B_NOT_RESIZABLE) == 0</td></tr>
|
---|
247 | <tr><td class="num" id="LN153">153</td><td class="line"> && (fTopTab->look == B_TITLED_WINDOW_LOOK</td></tr>
|
---|
248 | <tr><td class="num" id="LN154">154</td><td class="line"> || fTopTab->look == B_FLOATING_WINDOW_LOOK</td></tr>
|
---|
249 | <tr><td class="num" id="LN155">155</td><td class="line"> || fTopTab->look == B_MODAL_WINDOW_LOOK</td></tr>
|
---|
250 | <tr><td class="num" id="LN156">156</td><td class="line"> || fTopTab->look == kLeftTitledWindowLook)) {</td></tr>
|
---|
251 | <tr><td class="num" id="LN157">157</td><td class="line"> BRect resizeRect(BPoint(fBottomBorder.right - kBorderResizeLength,</td></tr>
|
---|
252 | <tr><td class="num" id="LN158">158</td><td class="line"> fBottomBorder.bottom - kBorderResizeLength),</td></tr>
|
---|
253 | <tr><td class="num" id="LN159">159</td><td class="line"> fBottomBorder.RightBottom());</td></tr>
|
---|
254 | <tr><td class="num" id="LN160">160</td><td class="line"> <span class='keyword'>if</span> (resizeRect.Contains(where))</td></tr>
|
---|
255 | <tr><td class="num" id="LN161">161</td><td class="line"> <span class='keyword'>return</span> REGION_RIGHT_BOTTOM_CORNER;</td></tr>
|
---|
256 | <tr><td class="num" id="LN162">162</td><td class="line"> }</td></tr>
|
---|
257 | <tr><td class="num" id="LN163">163</td><td class="line"> </td></tr>
|
---|
258 | <tr><td class="num" id="LN164">164</td><td class="line"> <span class='keyword'>return</span> region;</td></tr>
|
---|
259 | <tr><td class="num" id="LN165">165</td><td class="line">}</td></tr>
|
---|
260 | <tr><td class="num" id="LN166">166</td><td class="line"> </td></tr>
|
---|
261 | <tr><td class="num" id="LN167">167</td><td class="line"> </td></tr>
|
---|
262 | <tr><td class="num" id="LN168">168</td><td class="line"><span class='keyword'>bool</span></td></tr>
|
---|
263 | <tr><td class="num" id="LN169">169</td><td class="line">TabDecorator::SetRegionHighlight(Region region, uint8 highlight,</td></tr>
|
---|
264 | <tr><td class="num" id="LN170">170</td><td class="line"> BRegion* dirty, int32 tabIndex)</td></tr>
|
---|
265 | <tr><td class="num" id="LN171">171</td><td class="line">{</td></tr>
|
---|
266 | <tr><td class="num" id="LN172">172</td><td class="line"> Decorator::Tab* tab</td></tr>
|
---|
267 | <tr><td class="num" id="LN173">173</td><td class="line"> = <span class='keyword'>static_cast</span><Decorator::Tab*>(_TabAt(tabIndex));</td></tr>
|
---|
268 | <tr><td class="num" id="LN174">174</td><td class="line"> <span class='keyword'>if</span> (tab != <span class='macro'>NULL<span class='expansion'>__null</span></span>) {</td></tr>
|
---|
269 | <tr><td class="num" id="LN175">175</td><td class="line"> tab->isHighlighted = highlight != 0;</td></tr>
|
---|
270 | <tr><td class="num" id="LN176">176</td><td class="line"> <span class='comment'>// Invalidate the bitmap caches for the close/zoom button, when the</span></td></tr>
|
---|
271 | <tr><td class="num" id="LN177">177</td><td class="line"> <span class='comment'>// highlight changes.</span></td></tr>
|
---|
272 | <tr><td class="num" id="LN178">178</td><td class="line"> <span class='keyword'>switch</span> (region) {</td></tr>
|
---|
273 | <tr><td class="num" id="LN179">179</td><td class="line"> <span class='keyword'>case</span> REGION_CLOSE_BUTTON:</td></tr>
|
---|
274 | <tr><td class="num" id="LN180">180</td><td class="line"> <span class='keyword'>if</span> (highlight != RegionHighlight(region))</td></tr>
|
---|
275 | <tr><td class="num" id="LN181">181</td><td class="line"> memset(&tab->closeBitmaps, 0, <span class='keyword'>sizeof</span>(tab->closeBitmaps));</td></tr>
|
---|
276 | <tr><td class="num" id="LN182">182</td><td class="line"> <span class='keyword'>break</span>;</td></tr>
|
---|
277 | <tr><td class="num" id="LN183">183</td><td class="line"> <span class='keyword'>case</span> REGION_ZOOM_BUTTON:</td></tr>
|
---|
278 | <tr><td class="num" id="LN184">184</td><td class="line"> <span class='keyword'>if</span> (highlight != RegionHighlight(region))</td></tr>
|
---|
279 | <tr><td class="num" id="LN185">185</td><td class="line"> memset(&tab->zoomBitmaps, 0, <span class='keyword'>sizeof</span>(tab->zoomBitmaps));</td></tr>
|
---|
280 | <tr><td class="num" id="LN186">186</td><td class="line"> <span class='keyword'>break</span>;</td></tr>
|
---|
281 | <tr><td class="num" id="LN187">187</td><td class="line"> <span class='keyword'>default</span>:</td></tr>
|
---|
282 | <tr><td class="num" id="LN188">188</td><td class="line"> <span class='keyword'>break</span>;</td></tr>
|
---|
283 | <tr><td class="num" id="LN189">189</td><td class="line"> }</td></tr>
|
---|
284 | <tr><td class="num" id="LN190">190</td><td class="line"> }</td></tr>
|
---|
285 | <tr><td class="num" id="LN191">191</td><td class="line"> </td></tr>
|
---|
286 | <tr><td class="num" id="LN192">192</td><td class="line"> <span class='keyword'>return</span> Decorator::SetRegionHighlight(region, highlight, dirty, tabIndex);</td></tr>
|
---|
287 | <tr><td class="num" id="LN193">193</td><td class="line">}</td></tr>
|
---|
288 | <tr><td class="num" id="LN194">194</td><td class="line"> </td></tr>
|
---|
289 | <tr><td class="num" id="LN195">195</td><td class="line"> </td></tr>
|
---|
290 | <tr><td class="num" id="LN196">196</td><td class="line"><span class='keyword'>void</span></td></tr>
|
---|
291 | <tr><td class="num" id="LN197">197</td><td class="line">TabDecorator::UpdateColors(DesktopSettings& settings)</td></tr>
|
---|
292 | <tr><td class="num" id="LN198">198</td><td class="line">{</td></tr>
|
---|
293 | <tr><td class="num" id="LN199">199</td><td class="line"> <span class='comment'>// Desktop is write locked, so be quick about it.</span></td></tr>
|
---|
294 | <tr><td class="num" id="LN200">200</td><td class="line"> fFocusFrameColor = settings.UIColor(B_WINDOW_BORDER_COLOR);</td></tr>
|
---|
295 | <tr><td class="num" id="LN201">201</td><td class="line"> fFocusTabColor = settings.UIColor(B_WINDOW_TAB_COLOR);</td></tr>
|
---|
296 | <tr><td class="num" id="LN202">202</td><td class="line"> fFocusTabColorLight = tint_color(fFocusTabColor,</td></tr>
|
---|
297 | <tr><td class="num" id="LN203">203</td><td class="line"> (B_LIGHTEN_MAX_TINT + B_LIGHTEN_2_TINT) / 2);</td></tr>
|
---|
298 | <tr><td class="num" id="LN204">204</td><td class="line"> fFocusTabColorBevel = tint_color(fFocusTabColor, B_LIGHTEN_2_TINT);</td></tr>
|
---|
299 | <tr><td class="num" id="LN205">205</td><td class="line"> fFocusTabColorShadow = tint_color(fFocusTabColor,</td></tr>
|
---|
300 | <tr><td class="num" id="LN206">206</td><td class="line"> (B_DARKEN_1_TINT + B_NO_TINT) / 2);</td></tr>
|
---|
301 | <tr><td class="num" id="LN207">207</td><td class="line"> fFocusTextColor = settings.UIColor(B_WINDOW_TEXT_COLOR);</td></tr>
|
---|
302 | <tr><td class="num" id="LN208">208</td><td class="line"> </td></tr>
|
---|
303 | <tr><td class="num" id="LN209">209</td><td class="line"> fNonFocusFrameColor = settings.UIColor(B_WINDOW_INACTIVE_BORDER_COLOR);</td></tr>
|
---|
304 | <tr><td class="num" id="LN210">210</td><td class="line"> fNonFocusTabColor = settings.UIColor(B_WINDOW_INACTIVE_TAB_COLOR);</td></tr>
|
---|
305 | <tr><td class="num" id="LN211">211</td><td class="line"> fNonFocusTabColorLight = tint_color(fNonFocusTabColor,</td></tr>
|
---|
306 | <tr><td class="num" id="LN212">212</td><td class="line"> (B_LIGHTEN_MAX_TINT + B_LIGHTEN_2_TINT) / 2);</td></tr>
|
---|
307 | <tr><td class="num" id="LN213">213</td><td class="line"> fNonFocusTabColorBevel = tint_color(fNonFocusTabColor, B_LIGHTEN_2_TINT);</td></tr>
|
---|
308 | <tr><td class="num" id="LN214">214</td><td class="line"> fNonFocusTabColorShadow = tint_color(fNonFocusTabColor,</td></tr>
|
---|
309 | <tr><td class="num" id="LN215">215</td><td class="line"> (B_DARKEN_1_TINT + B_NO_TINT) / 2);</td></tr>
|
---|
310 | <tr><td class="num" id="LN216">216</td><td class="line"> fNonFocusTextColor = settings.UIColor(B_WINDOW_INACTIVE_TEXT_COLOR);</td></tr>
|
---|
311 | <tr><td class="num" id="LN217">217</td><td class="line">}</td></tr>
|
---|
312 | <tr><td class="num" id="LN218">218</td><td class="line"> </td></tr>
|
---|
313 | <tr><td class="num" id="LN219">219</td><td class="line"> </td></tr>
|
---|
314 | <tr><td class="num" id="LN220">220</td><td class="line"><span class='keyword'>void</span></td></tr>
|
---|
315 | <tr><td class="num" id="LN221">221</td><td class="line">TabDecorator::_DoLayout()</td></tr>
|
---|
316 | <tr><td class="num" id="LN222">222</td><td class="line">{</td></tr>
|
---|
317 | <tr><td class="num" id="LN223">223</td><td class="line"> <span class='macro'>STRACE((<span class='string_literal'>"TabDecorator: Do Layout\n"</span>))<span class='expansion'>;</span></span>;</td></tr>
|
---|
318 | <tr><td class="num" id="LN224">224</td><td class="line"> <span class='comment'>// Here we determine the size of every rectangle that we use</span></td></tr>
|
---|
319 | <tr><td class="num" id="LN225">225</td><td class="line"> <span class='comment'>// internally when we are given the size of the client rectangle.</span></td></tr>
|
---|
320 | <tr><td class="num" id="LN226">226</td><td class="line"> </td></tr>
|
---|
321 | <tr><td class="num" id="LN227">227</td><td class="line"> <span class='keyword'>bool</span> hasTab = <span class='keyword'>false</span>;</td></tr>
|
---|
322 | <tr><td class="num" id="LN228">228</td><td class="line"> </td></tr>
|
---|
323 | <tr><td class="num" id="LN229">229</td><td class="line"> <span class='keyword'>switch</span> ((<span class='keyword'>int</span>)fTopTab->look) {</td></tr>
|
---|
324 | <tr><td class="num"></td><td class="line"><div id="Path2" class="msg msgControl" style="margin-left:9ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">2</div></td><td><div class="PathNav"><a href="#Path1" title="Previous event (1)">←</a></div></td></td><td>Control jumps to 'case B_FLOATING_WINDOW_LOOK:' at line 239</td><td><div class="PathNav"><a href="#Path3" title="Next event (3)">→</a></div></td></tr></table></div></td></tr>
|
---|
325 | <tr><td class="num" id="LN230">230</td><td class="line"> <span class='keyword'>case</span> B_MODAL_WINDOW_LOOK:</td></tr>
|
---|
326 | <tr><td class="num" id="LN231">231</td><td class="line"> fBorderWidth = 5;</td></tr>
|
---|
327 | <tr><td class="num" id="LN232">232</td><td class="line"> <span class='keyword'>break</span>;</td></tr>
|
---|
328 | <tr><td class="num" id="LN233">233</td><td class="line"> </td></tr>
|
---|
329 | <tr><td class="num" id="LN234">234</td><td class="line"> <span class='keyword'>case</span> B_TITLED_WINDOW_LOOK:</td></tr>
|
---|
330 | <tr><td class="num" id="LN235">235</td><td class="line"> <span class='keyword'>case</span> B_DOCUMENT_WINDOW_LOOK:</td></tr>
|
---|
331 | <tr><td class="num" id="LN236">236</td><td class="line"> hasTab = <span class='keyword'>true</span>;</td></tr>
|
---|
332 | <tr><td class="num" id="LN237">237</td><td class="line"> fBorderWidth = 5;</td></tr>
|
---|
333 | <tr><td class="num" id="LN238">238</td><td class="line"> <span class='keyword'>break</span>;</td></tr>
|
---|
334 | <tr><td class="num" id="LN239">239</td><td class="line"> <span class='keyword'>case</span> B_FLOATING_WINDOW_LOOK:</td></tr>
|
---|
335 | <tr><td class="num" id="LN240">240</td><td class="line"> <span class='keyword'>case</span> kLeftTitledWindowLook:</td></tr>
|
---|
336 | <tr><td class="num" id="LN241">241</td><td class="line"> hasTab = <span class='keyword'>true</span>;</td></tr>
|
---|
337 | <tr><td class="num" id="LN242">242</td><td class="line"> fBorderWidth = 3;</td></tr>
|
---|
338 | <tr><td class="num" id="LN243">243</td><td class="line"> <span class='keyword'>break</span>;</td></tr>
|
---|
339 | <tr><td class="num"></td><td class="line"><div id="Path3" class="msg msgControl" style="margin-left:25ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">3</div></td><td><div class="PathNav"><a href="#Path2" title="Previous event (2)">←</a></div></td></td><td> Execution continues on line 254</td><td><div class="PathNav"><a href="#Path4" title="Next event (4)">→</a></div></td></tr></table></div></td></tr>
|
---|
340 | <tr><td class="num" id="LN244">244</td><td class="line"> </td></tr>
|
---|
341 | <tr><td class="num" id="LN245">245</td><td class="line"> <span class='keyword'>case</span> B_BORDERED_WINDOW_LOOK:</td></tr>
|
---|
342 | <tr><td class="num" id="LN246">246</td><td class="line"> fBorderWidth = 1;</td></tr>
|
---|
343 | <tr><td class="num" id="LN247">247</td><td class="line"> <span class='keyword'>break</span>;</td></tr>
|
---|
344 | <tr><td class="num" id="LN248">248</td><td class="line"> </td></tr>
|
---|
345 | <tr><td class="num" id="LN249">249</td><td class="line"> <span class='keyword'>default</span>:</td></tr>
|
---|
346 | <tr><td class="num" id="LN250">250</td><td class="line"> fBorderWidth = 0;</td></tr>
|
---|
347 | <tr><td class="num" id="LN251">251</td><td class="line"> }</td></tr>
|
---|
348 | <tr><td class="num" id="LN252">252</td><td class="line"> </td></tr>
|
---|
349 | <tr><td class="num" id="LN253">253</td><td class="line"> <span class='comment'>// calculate left/top/right/bottom borders</span></td></tr>
|
---|
350 | <tr><td class="num" id="LN254">254</td><td class="line"> <span class='keyword'>if</span> (fBorderWidth > 0) {</td></tr>
|
---|
351 | <tr><td class="num"></td><td class="line"><div id="Path4" class="msg msgControl" style="margin-left:9ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">4</div></td><td><div class="PathNav"><a href="#Path3" title="Previous event (3)">←</a></div></td></td><td>Taking true branch</td><td><div class="PathNav"><a href="#Path5" title="Next event (5)">→</a></div></td></tr></table></div></td></tr>
|
---|
352 | <tr><td class="num" id="LN255">255</td><td class="line"> <span class='comment'>// NOTE: no overlapping, the left and right border rects</span></td></tr>
|
---|
353 | <tr><td class="num" id="LN256">256</td><td class="line"> <span class='comment'>// don't include the corners!</span></td></tr>
|
---|
354 | <tr><td class="num" id="LN257">257</td><td class="line"> fLeftBorder.Set(fFrame.left - fBorderWidth, fFrame.top,</td></tr>
|
---|
355 | <tr><td class="num" id="LN258">258</td><td class="line"> fFrame.left - 1, fFrame.bottom);</td></tr>
|
---|
356 | <tr><td class="num" id="LN259">259</td><td class="line"> </td></tr>
|
---|
357 | <tr><td class="num" id="LN260">260</td><td class="line"> fRightBorder.Set(fFrame.right + 1, fFrame.top ,</td></tr>
|
---|
358 | <tr><td class="num" id="LN261">261</td><td class="line"> fFrame.right + fBorderWidth, fFrame.bottom);</td></tr>
|
---|
359 | <tr><td class="num" id="LN262">262</td><td class="line"> </td></tr>
|
---|
360 | <tr><td class="num" id="LN263">263</td><td class="line"> fTopBorder.Set(fFrame.left - fBorderWidth, fFrame.top - fBorderWidth,</td></tr>
|
---|
361 | <tr><td class="num" id="LN264">264</td><td class="line"> fFrame.right + fBorderWidth, fFrame.top - 1);</td></tr>
|
---|
362 | <tr><td class="num" id="LN265">265</td><td class="line"> </td></tr>
|
---|
363 | <tr><td class="num" id="LN266">266</td><td class="line"> fBottomBorder.Set(fFrame.left - fBorderWidth, fFrame.bottom + 1,</td></tr>
|
---|
364 | <tr><td class="num" id="LN267">267</td><td class="line"> fFrame.right + fBorderWidth, fFrame.bottom + fBorderWidth);</td></tr>
|
---|
365 | <tr><td class="num" id="LN268">268</td><td class="line"> } <span class='keyword'>else</span> {</td></tr>
|
---|
366 | <tr><td class="num" id="LN269">269</td><td class="line"> <span class='comment'>// no border</span></td></tr>
|
---|
367 | <tr><td class="num" id="LN270">270</td><td class="line"> fLeftBorder.Set(0.0, 0.0, -1.0, -1.0);</td></tr>
|
---|
368 | <tr><td class="num" id="LN271">271</td><td class="line"> fRightBorder.Set(0.0, 0.0, -1.0, -1.0);</td></tr>
|
---|
369 | <tr><td class="num" id="LN272">272</td><td class="line"> fTopBorder.Set(0.0, 0.0, -1.0, -1.0);</td></tr>
|
---|
370 | <tr><td class="num" id="LN273">273</td><td class="line"> fBottomBorder.Set(0.0, 0.0, -1.0, -1.0);</td></tr>
|
---|
371 | <tr><td class="num" id="LN274">274</td><td class="line"> }</td></tr>
|
---|
372 | <tr><td class="num" id="LN275">275</td><td class="line"> </td></tr>
|
---|
373 | <tr><td class="num" id="LN276">276</td><td class="line"> fBorderRect = BRect(fTopBorder.LeftTop(), fBottomBorder.RightBottom());</td></tr>
|
---|
374 | <tr><td class="num" id="LN277">277</td><td class="line"> </td></tr>
|
---|
375 | <tr><td class="num" id="LN278">278</td><td class="line"> <span class='comment'>// calculate resize rect</span></td></tr>
|
---|
376 | <tr><td class="num" id="LN279">279</td><td class="line"> <span class='keyword'>if</span> (fBorderWidth > 1) {</td></tr>
|
---|
377 | <tr><td class="num"></td><td class="line"><div id="Path5" class="msg msgControl" style="margin-left:9ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">5</div></td><td><div class="PathNav"><a href="#Path4" title="Previous event (4)">←</a></div></td></td><td>Taking true branch</td><td><div class="PathNav"><a href="#Path6" title="Next event (6)">→</a></div></td></tr></table></div></td></tr>
|
---|
378 | <tr><td class="num" id="LN280">280</td><td class="line"> fResizeRect.Set(fBottomBorder.right - kResizeKnobSize,</td></tr>
|
---|
379 | <tr><td class="num" id="LN281">281</td><td class="line"> fBottomBorder.bottom - kResizeKnobSize, fBottomBorder.right,</td></tr>
|
---|
380 | <tr><td class="num" id="LN282">282</td><td class="line"> fBottomBorder.bottom);</td></tr>
|
---|
381 | <tr><td class="num" id="LN283">283</td><td class="line"> } <span class='keyword'>else</span> {</td></tr>
|
---|
382 | <tr><td class="num" id="LN284">284</td><td class="line"> <span class='comment'>// no border or one pixel border (menus and such)</span></td></tr>
|
---|
383 | <tr><td class="num" id="LN285">285</td><td class="line"> fResizeRect.Set(0, 0, -1, -1);</td></tr>
|
---|
384 | <tr><td class="num" id="LN286">286</td><td class="line"> }</td></tr>
|
---|
385 | <tr><td class="num" id="LN287">287</td><td class="line"> </td></tr>
|
---|
386 | <tr><td class="num" id="LN288">288</td><td class="line"> <span class='keyword'>if</span> (hasTab) {</td></tr>
|
---|
387 | <tr><td class="num"></td><td class="line"><div id="Path6" class="msg msgControl" style="margin-left:9ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">6</div></td><td><div class="PathNav"><a href="#Path5" title="Previous event (5)">←</a></div></td></td><td>Taking true branch</td><td><div class="PathNav"><a href="#Path7" title="Next event (7)">→</a></div></td></tr></table></div></td></tr>
|
---|
388 | <tr><td class="num" id="LN289">289</td><td class="line"> <span class="mrange">_DoTabLayout()</span>;</td></tr>
|
---|
389 | <tr><td class="num"></td><td class="line"><div id="Path7" class="msg msgEvent" style="margin-left:17ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">7</div></td><td><div class="PathNav"><a href="#Path6" title="Previous event (6)">←</a></div></td></td><td>Calling 'TabDecorator::_DoTabLayout'</td><td><div class="PathNav"><a href="#Path8" title="Next event (8)">→</a></div></td></tr></table></div></td></tr>
|
---|
390 | <tr><td class="num" id="LN290">290</td><td class="line"> <span class='keyword'>return</span>;</td></tr>
|
---|
391 | <tr><td class="num" id="LN291">291</td><td class="line"> } <span class='keyword'>else</span> {</td></tr>
|
---|
392 | <tr><td class="num" id="LN292">292</td><td class="line"> <span class='comment'>// no tab</span></td></tr>
|
---|
393 | <tr><td class="num" id="LN293">293</td><td class="line"> <span class='keyword'>for</span> (int32 i = 0; i < fTabList.CountItems(); i++) {</td></tr>
|
---|
394 | <tr><td class="num" id="LN294">294</td><td class="line"> Decorator::Tab* tab = fTabList.ItemAt(i);</td></tr>
|
---|
395 | <tr><td class="num" id="LN295">295</td><td class="line"> tab->tabRect.Set(0.0, 0.0, -1.0, -1.0);</td></tr>
|
---|
396 | <tr><td class="num" id="LN296">296</td><td class="line"> }</td></tr>
|
---|
397 | <tr><td class="num" id="LN297">297</td><td class="line"> fTabsRegion.MakeEmpty();</td></tr>
|
---|
398 | <tr><td class="num" id="LN298">298</td><td class="line"> fTitleBarRect.Set(0.0, 0.0, -1.0, -1.0);</td></tr>
|
---|
399 | <tr><td class="num" id="LN299">299</td><td class="line"> }</td></tr>
|
---|
400 | <tr><td class="num" id="LN300">300</td><td class="line">}</td></tr>
|
---|
401 | <tr><td class="num" id="LN301">301</td><td class="line"> </td></tr>
|
---|
402 | <tr><td class="num" id="LN302">302</td><td class="line"> </td></tr>
|
---|
403 | <tr><td class="num" id="LN303">303</td><td class="line"><span class='keyword'>void</span></td></tr>
|
---|
404 | <tr><td class="num" id="LN304">304</td><td class="line">TabDecorator::_DoTabLayout()</td></tr>
|
---|
405 | <tr><td class="num" id="LN305">305</td><td class="line">{</td></tr>
|
---|
406 | <tr><td class="num" id="LN306">306</td><td class="line"> <span class='keyword'>float</span> tabOffset = 0;</td></tr>
|
---|
407 | <tr><td class="num" id="LN307">307</td><td class="line"> <span class='keyword'>if</span> (<span class="mrange">fTabList.CountItems() == 1</span>) {</td></tr>
|
---|
408 | <tr><td class="num"></td><td class="line"><div id="Path8" class="msg msgEvent" style="margin-left:13ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">8</div></td><td><div class="PathNav"><a href="#Path7" title="Previous event (7)">←</a></div></td></td><td>Assuming the condition is false</td><td><div class="PathNav"><a href="#Path9" title="Next event (9)">→</a></div></td></tr></table></div></td></tr>
|
---|
409 | <tr><td class="num"></td><td class="line"><div id="Path9" class="msg msgControl" style="margin-left:9ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">9</div></td><td><div class="PathNav"><a href="#Path8" title="Previous event (8)">←</a></div></td></td><td>Taking false branch</td><td><div class="PathNav"><a href="#Path10" title="Next event (10)">→</a></div></td></tr></table></div></td></tr>
|
---|
410 | <tr><td class="num" id="LN308">308</td><td class="line"> <span class='keyword'>float</span> tabSize;</td></tr>
|
---|
411 | <tr><td class="num" id="LN309">309</td><td class="line"> tabOffset = _SingleTabOffsetAndSize(tabSize);</td></tr>
|
---|
412 | <tr><td class="num" id="LN310">310</td><td class="line"> }</td></tr>
|
---|
413 | <tr><td class="num" id="LN311">311</td><td class="line"> </td></tr>
|
---|
414 | <tr><td class="num" id="LN312">312</td><td class="line"> <span class='keyword'>float</span> sumTabWidth = 0;</td></tr>
|
---|
415 | <tr><td class="num" id="LN313">313</td><td class="line"> <span class='comment'>// calculate our tab rect</span></td></tr>
|
---|
416 | <tr><td class="num" id="LN314">314</td><td class="line"> <span class='keyword'>for</span> (int32 i = 0; <span class="mrange">i < fTabList.CountItems()</span>; i++) {</td></tr>
|
---|
417 | <tr><td class="num"></td><td class="line"><div id="Path10" class="msg msgEvent" style="margin-left:27ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">10</div></td><td><div class="PathNav"><a href="#Path9" title="Previous event (9)">←</a></div></td></td><td>Assuming the condition is false</td><td><div class="PathNav"><a href="#Path11" title="Next event (11)">→</a></div></td></tr></table></div></td></tr>
|
---|
418 | <tr><td class="num"></td><td class="line"><div id="Path11" class="msg msgControl" style="margin-left:9ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">11</div></td><td><div class="PathNav"><a href="#Path10" title="Previous event (10)">←</a></div></td></td><td>Loop condition is false. Execution continues on line 394</td><td><div class="PathNav"><a href="#Path12" title="Next event (12)">→</a></div></td></tr></table></div></td></tr>
|
---|
419 | <tr><td class="num" id="LN315">315</td><td class="line"> Decorator::Tab* tab = _TabAt(i);</td></tr>
|
---|
420 | <tr><td class="num" id="LN316">316</td><td class="line"> </td></tr>
|
---|
421 | <tr><td class="num" id="LN317">317</td><td class="line"> BRect& tabRect = tab->tabRect;</td></tr>
|
---|
422 | <tr><td class="num" id="LN318">318</td><td class="line"> <span class='comment'>// distance from one item of the tab bar to another.</span></td></tr>
|
---|
423 | <tr><td class="num" id="LN319">319</td><td class="line"> <span class='comment'>// In this case the text and close/zoom rects</span></td></tr>
|
---|
424 | <tr><td class="num" id="LN320">320</td><td class="line"> tab->textOffset = _DefaultTextOffset();</td></tr>
|
---|
425 | <tr><td class="num" id="LN321">321</td><td class="line"> </td></tr>
|
---|
426 | <tr><td class="num" id="LN322">322</td><td class="line"> font_height fontHeight;</td></tr>
|
---|
427 | <tr><td class="num" id="LN323">323</td><td class="line"> fDrawState.Font().GetHeight(fontHeight);</td></tr>
|
---|
428 | <tr><td class="num" id="LN324">324</td><td class="line"> </td></tr>
|
---|
429 | <tr><td class="num" id="LN325">325</td><td class="line"> <span class='keyword'>if</span> (tab->look != kLeftTitledWindowLook) {</td></tr>
|
---|
430 | <tr><td class="num" id="LN326">326</td><td class="line"> tabRect.Set(fFrame.left - fBorderWidth,</td></tr>
|
---|
431 | <tr><td class="num" id="LN327">327</td><td class="line"> fFrame.top - fBorderWidth</td></tr>
|
---|
432 | <tr><td class="num" id="LN328">328</td><td class="line"> - ceilf(fontHeight.ascent + fontHeight.descent + 7.0),</td></tr>
|
---|
433 | <tr><td class="num" id="LN329">329</td><td class="line"> ((fFrame.right - fFrame.left) < 35.0 ?</td></tr>
|
---|
434 | <tr><td class="num" id="LN330">330</td><td class="line"> fFrame.left + 35.0 : fFrame.right) + fBorderWidth,</td></tr>
|
---|
435 | <tr><td class="num" id="LN331">331</td><td class="line"> fFrame.top - fBorderWidth);</td></tr>
|
---|
436 | <tr><td class="num" id="LN332">332</td><td class="line"> } <span class='keyword'>else</span> {</td></tr>
|
---|
437 | <tr><td class="num" id="LN333">333</td><td class="line"> tabRect.Set(fFrame.left - fBorderWidth</td></tr>
|
---|
438 | <tr><td class="num" id="LN334">334</td><td class="line"> - ceilf(fontHeight.ascent + fontHeight.descent + 5.0),</td></tr>
|
---|
439 | <tr><td class="num" id="LN335">335</td><td class="line"> fFrame.top - fBorderWidth, fFrame.left - fBorderWidth,</td></tr>
|
---|
440 | <tr><td class="num" id="LN336">336</td><td class="line"> fFrame.bottom + fBorderWidth);</td></tr>
|
---|
441 | <tr><td class="num" id="LN337">337</td><td class="line"> }</td></tr>
|
---|
442 | <tr><td class="num" id="LN338">338</td><td class="line"> </td></tr>
|
---|
443 | <tr><td class="num" id="LN339">339</td><td class="line"> <span class='comment'>// format tab rect for a floating window - make the rect smaller</span></td></tr>
|
---|
444 | <tr><td class="num" id="LN340">340</td><td class="line"> <span class='keyword'>if</span> (tab->look == B_FLOATING_WINDOW_LOOK) {</td></tr>
|
---|
445 | <tr><td class="num" id="LN341">341</td><td class="line"> tabRect.InsetBy(0, 2);</td></tr>
|
---|
446 | <tr><td class="num" id="LN342">342</td><td class="line"> tabRect.OffsetBy(0, 2);</td></tr>
|
---|
447 | <tr><td class="num" id="LN343">343</td><td class="line"> }</td></tr>
|
---|
448 | <tr><td class="num" id="LN344">344</td><td class="line"> </td></tr>
|
---|
449 | <tr><td class="num" id="LN345">345</td><td class="line"> <span class='keyword'>float</span> offset;</td></tr>
|
---|
450 | <tr><td class="num" id="LN346">346</td><td class="line"> <span class='keyword'>float</span> size;</td></tr>
|
---|
451 | <tr><td class="num" id="LN347">347</td><td class="line"> <span class='keyword'>float</span> inset;</td></tr>
|
---|
452 | <tr><td class="num" id="LN348">348</td><td class="line"> _GetButtonSizeAndOffset(tabRect, &offset, &size, &inset);</td></tr>
|
---|
453 | <tr><td class="num" id="LN349">349</td><td class="line"> </td></tr>
|
---|
454 | <tr><td class="num" id="LN350">350</td><td class="line"> <span class='comment'>// tab->minTabSize contains just the room for the buttons</span></td></tr>
|
---|
455 | <tr><td class="num" id="LN351">351</td><td class="line"> tab->minTabSize = inset * 2 + tab->textOffset;</td></tr>
|
---|
456 | <tr><td class="num" id="LN352">352</td><td class="line"> <span class='keyword'>if</span> ((tab->flags & B_NOT_CLOSABLE) == 0)</td></tr>
|
---|
457 | <tr><td class="num" id="LN353">353</td><td class="line"> tab->minTabSize += offset + size;</td></tr>
|
---|
458 | <tr><td class="num" id="LN354">354</td><td class="line"> <span class='keyword'>if</span> ((tab->flags & B_NOT_ZOOMABLE) == 0)</td></tr>
|
---|
459 | <tr><td class="num" id="LN355">355</td><td class="line"> tab->minTabSize += offset + size;</td></tr>
|
---|
460 | <tr><td class="num" id="LN356">356</td><td class="line"> </td></tr>
|
---|
461 | <tr><td class="num" id="LN357">357</td><td class="line"> <span class='comment'>// tab->maxTabSize contains tab->minTabSize + the width required for the</span></td></tr>
|
---|
462 | <tr><td class="num" id="LN358">358</td><td class="line"> <span class='comment'>// title</span></td></tr>
|
---|
463 | <tr><td class="num" id="LN359">359</td><td class="line"> tab->maxTabSize = fDrawingEngine</td></tr>
|
---|
464 | <tr><td class="num" id="LN360">360</td><td class="line"> ? ceilf(fDrawingEngine->StringWidth(Title(tab), strlen(Title(tab)),</td></tr>
|
---|
465 | <tr><td class="num" id="LN361">361</td><td class="line"> fDrawState.Font())) : 0.0;</td></tr>
|
---|
466 | <tr><td class="num" id="LN362">362</td><td class="line"> <span class='keyword'>if</span> (tab->maxTabSize > 0.0)</td></tr>
|
---|
467 | <tr><td class="num" id="LN363">363</td><td class="line"> tab->maxTabSize += tab->textOffset;</td></tr>
|
---|
468 | <tr><td class="num" id="LN364">364</td><td class="line"> tab->maxTabSize += tab->minTabSize;</td></tr>
|
---|
469 | <tr><td class="num" id="LN365">365</td><td class="line"> </td></tr>
|
---|
470 | <tr><td class="num" id="LN366">366</td><td class="line"> <span class='keyword'>float</span> tabSize = (tab->look != kLeftTitledWindowLook</td></tr>
|
---|
471 | <tr><td class="num" id="LN367">367</td><td class="line"> ? fFrame.Width() : fFrame.Height()) + fBorderWidth * 2;</td></tr>
|
---|
472 | <tr><td class="num" id="LN368">368</td><td class="line"> <span class='keyword'>if</span> (tabSize < tab->minTabSize)</td></tr>
|
---|
473 | <tr><td class="num" id="LN369">369</td><td class="line"> tabSize = tab->minTabSize;</td></tr>
|
---|
474 | <tr><td class="num" id="LN370">370</td><td class="line"> <span class='keyword'>if</span> (tabSize > tab->maxTabSize)</td></tr>
|
---|
475 | <tr><td class="num" id="LN371">371</td><td class="line"> tabSize = tab->maxTabSize;</td></tr>
|
---|
476 | <tr><td class="num" id="LN372">372</td><td class="line"> </td></tr>
|
---|
477 | <tr><td class="num" id="LN373">373</td><td class="line"> <span class='comment'>// layout buttons and truncate text</span></td></tr>
|
---|
478 | <tr><td class="num" id="LN374">374</td><td class="line"> <span class='keyword'>if</span> (tab->look != kLeftTitledWindowLook)</td></tr>
|
---|
479 | <tr><td class="num" id="LN375">375</td><td class="line"> tabRect.right = tabRect.left + tabSize;</td></tr>
|
---|
480 | <tr><td class="num" id="LN376">376</td><td class="line"> <span class='keyword'>else</span></td></tr>
|
---|
481 | <tr><td class="num" id="LN377">377</td><td class="line"> tabRect.bottom = tabRect.top + tabSize;</td></tr>
|
---|
482 | <tr><td class="num" id="LN378">378</td><td class="line"> </td></tr>
|
---|
483 | <tr><td class="num" id="LN379">379</td><td class="line"> <span class='comment'>// make sure fTabOffset is within limits and apply it to</span></td></tr>
|
---|
484 | <tr><td class="num" id="LN380">380</td><td class="line"> <span class='comment'>// the tabRect</span></td></tr>
|
---|
485 | <tr><td class="num" id="LN381">381</td><td class="line"> tab->tabOffset = (uint32)tabOffset;</td></tr>
|
---|
486 | <tr><td class="num" id="LN382">382</td><td class="line"> <span class='keyword'>if</span> (tab->tabLocation != 0.0 && fTabList.CountItems() == 1</td></tr>
|
---|
487 | <tr><td class="num" id="LN383">383</td><td class="line"> && tab->tabOffset > (fRightBorder.right - fLeftBorder.left</td></tr>
|
---|
488 | <tr><td class="num" id="LN384">384</td><td class="line"> - tabRect.Width())) {</td></tr>
|
---|
489 | <tr><td class="num" id="LN385">385</td><td class="line"> tab->tabOffset = uint32(fRightBorder.right - fLeftBorder.left</td></tr>
|
---|
490 | <tr><td class="num" id="LN386">386</td><td class="line"> - tabRect.Width());</td></tr>
|
---|
491 | <tr><td class="num" id="LN387">387</td><td class="line"> }</td></tr>
|
---|
492 | <tr><td class="num" id="LN388">388</td><td class="line"> tabRect.OffsetBy(tab->tabOffset, 0);</td></tr>
|
---|
493 | <tr><td class="num" id="LN389">389</td><td class="line"> tabOffset += tabRect.Width();</td></tr>
|
---|
494 | <tr><td class="num" id="LN390">390</td><td class="line"> </td></tr>
|
---|
495 | <tr><td class="num" id="LN391">391</td><td class="line"> sumTabWidth += tabRect.Width();</td></tr>
|
---|
496 | <tr><td class="num" id="LN392">392</td><td class="line"> }</td></tr>
|
---|
497 | <tr><td class="num" id="LN393">393</td><td class="line"> </td></tr>
|
---|
498 | <tr><td class="num" id="LN394">394</td><td class="line"> <span class='keyword'>float</span> windowWidth = fFrame.Width() + 2 * fBorderWidth;</td></tr>
|
---|
499 | <tr><td class="num" id="LN395">395</td><td class="line"> <span class='keyword'>if</span> (<span class="mrange">CountTabs() > 1</span> && sumTabWidth > windowWidth)</td></tr>
|
---|
500 | <tr><td class="num"></td><td class="line"><div id="Path12" class="msg msgEvent" style="margin-left:13ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">12</div></td><td><div class="PathNav"><a href="#Path11" title="Previous event (11)">←</a></div></td></td><td>Assuming the condition is true</td><td><div class="PathNav"><a href="#Path13" title="Next event (13)">→</a></div></td></tr></table></div></td></tr>
|
---|
501 | <tr><td class="num"></td><td class="line"><div id="Path13" class="msg msgControl" style="margin-left:9ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">13</div></td><td><div class="PathNav"><a href="#Path12" title="Previous event (12)">←</a></div></td></td><td>Taking true branch</td><td><div class="PathNav"><a href="#Path14" title="Next event (14)">→</a></div></td></tr></table></div></td></tr>
|
---|
502 | <tr><td class="num" id="LN396">396</td><td class="line"> <span class="mrange">_DistributeTabSize(sumTabWidth - windowWidth)</span>;</td></tr>
|
---|
503 | <tr><td class="num"></td><td class="line"><div id="Path14" class="msg msgEvent" style="margin-left:17ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">14</div></td><td><div class="PathNav"><a href="#Path13" title="Previous event (13)">←</a></div></td></td><td>Calling 'TabDecorator::_DistributeTabSize'</td><td><div class="PathNav"><a href="#Path15" title="Next event (15)">→</a></div></td></tr></table></div></td></tr>
|
---|
504 | <tr><td class="num" id="LN397">397</td><td class="line"> </td></tr>
|
---|
505 | <tr><td class="num" id="LN398">398</td><td class="line"> <span class='comment'>// finally, layout the buttons and text within the tab rect</span></td></tr>
|
---|
506 | <tr><td class="num" id="LN399">399</td><td class="line"> <span class='keyword'>for</span> (int32 i = 0; i < fTabList.CountItems(); i++) {</td></tr>
|
---|
507 | <tr><td class="num" id="LN400">400</td><td class="line"> Decorator::Tab* tab = fTabList.ItemAt(i);</td></tr>
|
---|
508 | <tr><td class="num" id="LN401">401</td><td class="line"> </td></tr>
|
---|
509 | <tr><td class="num" id="LN402">402</td><td class="line"> <span class='keyword'>if</span> (i == 0)</td></tr>
|
---|
510 | <tr><td class="num" id="LN403">403</td><td class="line"> fTitleBarRect = tab->tabRect;</td></tr>
|
---|
511 | <tr><td class="num" id="LN404">404</td><td class="line"> <span class='keyword'>else</span></td></tr>
|
---|
512 | <tr><td class="num" id="LN405">405</td><td class="line"> fTitleBarRect = fTitleBarRect | tab->tabRect;</td></tr>
|
---|
513 | <tr><td class="num" id="LN406">406</td><td class="line"> </td></tr>
|
---|
514 | <tr><td class="num" id="LN407">407</td><td class="line"> _LayoutTabItems(tab, tab->tabRect);</td></tr>
|
---|
515 | <tr><td class="num" id="LN408">408</td><td class="line"> }</td></tr>
|
---|
516 | <tr><td class="num" id="LN409">409</td><td class="line"> </td></tr>
|
---|
517 | <tr><td class="num" id="LN410">410</td><td class="line"> fTabsRegion = fTitleBarRect;</td></tr>
|
---|
518 | <tr><td class="num" id="LN411">411</td><td class="line">}</td></tr>
|
---|
519 | <tr><td class="num" id="LN412">412</td><td class="line"> </td></tr>
|
---|
520 | <tr><td class="num" id="LN413">413</td><td class="line"> </td></tr>
|
---|
521 | <tr><td class="num" id="LN414">414</td><td class="line"><span class='keyword'>void</span></td></tr>
|
---|
522 | <tr><td class="num" id="LN415">415</td><td class="line">TabDecorator::_DistributeTabSize(<span class='keyword'>float</span> delta)</td></tr>
|
---|
523 | <tr><td class="num" id="LN416">416</td><td class="line">{</td></tr>
|
---|
524 | <tr><td class="num" id="LN417">417</td><td class="line"> int32 tabCount = fTabList.CountItems();</td></tr>
|
---|
525 | <tr><td class="num" id="LN418">418</td><td class="line"> <span class='macro'>ASSERT(tabCount > 1)<span class='expansion'>(!(tabCount > 1) ? _debuggerAssert("/home/haiku/haiku/haiku/src/servers/app/decorator/TabDecorator.cpp"<br>,418, "tabCount > 1") : (int)0)</span></span>;</td></tr>
|
---|
526 | <tr><td class="num" id="LN419">419</td><td class="line"> </td></tr>
|
---|
527 | <tr><td class="num" id="LN420">420</td><td class="line"> <span class='keyword'>float</span> maxTabSize = 0;</td></tr>
|
---|
528 | <tr><td class="num" id="LN421">421</td><td class="line"> <span class='keyword'>float</span> secMaxTabSize = 0;</td></tr>
|
---|
529 | <tr><td class="num" id="LN422">422</td><td class="line"> int32 nTabsWithMaxSize = 0;</td></tr>
|
---|
530 | <tr><td class="num" id="LN423">423</td><td class="line"> <span class='keyword'>for</span> (int32 i = 0; <span class="mrange">i < tabCount</span>; i++) {</td></tr>
|
---|
531 | <tr><td class="num"></td><td class="line"><div id="Path15" class="msg msgEvent" style="margin-left:27ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">15</div></td><td><div class="PathNav"><a href="#Path14" title="Previous event (14)">←</a></div></td></td><td>Assuming 'i' is >= 'tabCount'</td><td><div class="PathNav"><a href="#Path16" title="Next event (16)">→</a></div></td></tr></table></div></td></tr>
|
---|
532 | <tr><td class="num"></td><td class="line"><div id="Path16" class="msg msgControl" style="margin-left:9ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">16</div></td><td><div class="PathNav"><a href="#Path15" title="Previous event (15)">←</a></div></td></td><td>Loop condition is false. Execution continues on line 441</td><td><div class="PathNav"><a href="#Path17" title="Next event (17)">→</a></div></td></tr></table></div></td></tr>
|
---|
533 | <tr><td class="num" id="LN424">424</td><td class="line"> Decorator::Tab* tab = fTabList.ItemAt(i);</td></tr>
|
---|
534 | <tr><td class="num" id="LN425">425</td><td class="line"> <span class='keyword'>if</span> (tab == <span class='macro'>NULL<span class='expansion'>__null</span></span>)</td></tr>
|
---|
535 | <tr><td class="num" id="LN426">426</td><td class="line"> <span class='keyword'>continue</span>;</td></tr>
|
---|
536 | <tr><td class="num" id="LN427">427</td><td class="line"> </td></tr>
|
---|
537 | <tr><td class="num" id="LN428">428</td><td class="line"> <span class='keyword'>float</span> tabWidth = tab->tabRect.Width();</td></tr>
|
---|
538 | <tr><td class="num" id="LN429">429</td><td class="line"> <span class='keyword'>if</span> (int_equal(maxTabSize, tabWidth)) {</td></tr>
|
---|
539 | <tr><td class="num" id="LN430">430</td><td class="line"> nTabsWithMaxSize++;</td></tr>
|
---|
540 | <tr><td class="num" id="LN431">431</td><td class="line"> <span class='keyword'>continue</span>;</td></tr>
|
---|
541 | <tr><td class="num" id="LN432">432</td><td class="line"> }</td></tr>
|
---|
542 | <tr><td class="num" id="LN433">433</td><td class="line"> <span class='keyword'>if</span> (maxTabSize < tabWidth) {</td></tr>
|
---|
543 | <tr><td class="num" id="LN434">434</td><td class="line"> secMaxTabSize = maxTabSize;</td></tr>
|
---|
544 | <tr><td class="num" id="LN435">435</td><td class="line"> maxTabSize = tabWidth;</td></tr>
|
---|
545 | <tr><td class="num" id="LN436">436</td><td class="line"> nTabsWithMaxSize = 1;</td></tr>
|
---|
546 | <tr><td class="num" id="LN437">437</td><td class="line"> } <span class='keyword'>else</span> <span class='keyword'>if</span> (secMaxTabSize <= tabWidth)</td></tr>
|
---|
547 | <tr><td class="num" id="LN438">438</td><td class="line"> secMaxTabSize = tabWidth;</td></tr>
|
---|
548 | <tr><td class="num" id="LN439">439</td><td class="line"> }</td></tr>
|
---|
549 | <tr><td class="num" id="LN440">440</td><td class="line"> </td></tr>
|
---|
550 | <tr><td class="num" id="LN441">441</td><td class="line"> <span class='keyword'>float</span> minus = ceilf(std::min(maxTabSize - secMaxTabSize, delta));</td></tr>
|
---|
551 | <tr><td class="num" id="LN442">442</td><td class="line"> delta -= minus;</td></tr>
|
---|
552 | <tr><td class="num" id="LN443">443</td><td class="line"> minus /= nTabsWithMaxSize;</td></tr>
|
---|
553 | <tr><td class="num" id="LN444">444</td><td class="line"> </td></tr>
|
---|
554 | <tr><td class="num" id="LN445">445</td><td class="line"> <span class="mrange">Decorator::Tab* previousTab</span> = <span class='macro'>NULL<span class='expansion'>__null</span></span>;</td></tr>
|
---|
555 | <tr><td class="num"></td><td class="line"><div id="Path17" class="msg msgEvent" style="margin-left:9ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">17</div></td><td><div class="PathNav"><a href="#Path16" title="Previous event (16)">←</a></div></td></td><td>'previousTab' initialized to a null pointer value</td><td><div class="PathNav"><a href="#Path18" title="Next event (18)">→</a></div></td></tr></table></div></td></tr>
|
---|
556 | <tr><td class="num" id="LN446">446</td><td class="line"> <span class='keyword'>for</span> (int32 i = 0; i < tabCount; i++) {</td></tr>
|
---|
557 | <tr><td class="num"></td><td class="line"><div id="Path18" class="msg msgControl" style="margin-left:9ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">18</div></td><td><div class="PathNav"><a href="#Path17" title="Previous event (17)">←</a></div></td></td><td>Loop condition is false. Execution continues on line 462</td><td><div class="PathNav"><a href="#Path19" title="Next event (19)">→</a></div></td></tr></table></div></td></tr>
|
---|
558 | <tr><td class="num" id="LN447">447</td><td class="line"> Decorator::Tab* tab = fTabList.ItemAt(i);</td></tr>
|
---|
559 | <tr><td class="num" id="LN448">448</td><td class="line"> <span class='keyword'>if</span> (tab == <span class='macro'>NULL<span class='expansion'>__null</span></span>)</td></tr>
|
---|
560 | <tr><td class="num" id="LN449">449</td><td class="line"> <span class='keyword'>continue</span>;</td></tr>
|
---|
561 | <tr><td class="num" id="LN450">450</td><td class="line"> </td></tr>
|
---|
562 | <tr><td class="num" id="LN451">451</td><td class="line"> <span class='keyword'>if</span> (int_equal(maxTabSize, tab->tabRect.Width()))</td></tr>
|
---|
563 | <tr><td class="num" id="LN452">452</td><td class="line"> tab->tabRect.right -= minus;</td></tr>
|
---|
564 | <tr><td class="num" id="LN453">453</td><td class="line"> </td></tr>
|
---|
565 | <tr><td class="num" id="LN454">454</td><td class="line"> <span class='keyword'>if</span> (previousTab != <span class='macro'>NULL<span class='expansion'>__null</span></span>) {</td></tr>
|
---|
566 | <tr><td class="num" id="LN455">455</td><td class="line"> <span class='keyword'>float</span> offsetX = previousTab->tabRect.right - tab->tabRect.left;</td></tr>
|
---|
567 | <tr><td class="num" id="LN456">456</td><td class="line"> tab->tabRect.OffsetBy(offsetX, 0);</td></tr>
|
---|
568 | <tr><td class="num" id="LN457">457</td><td class="line"> }</td></tr>
|
---|
569 | <tr><td class="num" id="LN458">458</td><td class="line"> </td></tr>
|
---|
570 | <tr><td class="num" id="LN459">459</td><td class="line"> previousTab = tab;</td></tr>
|
---|
571 | <tr><td class="num" id="LN460">460</td><td class="line"> }</td></tr>
|
---|
572 | <tr><td class="num" id="LN461">461</td><td class="line"> </td></tr>
|
---|
573 | <tr><td class="num" id="LN462">462</td><td class="line"> <span class='keyword'>if</span> (delta > 0) {</td></tr>
|
---|
574 | <tr><td class="num"></td><td class="line"><div id="Path19" class="msg msgControl" style="margin-left:9ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexControl">19</div></td><td><div class="PathNav"><a href="#Path18" title="Previous event (18)">←</a></div></td></td><td>Taking false branch</td><td><div class="PathNav"><a href="#EndPath" title="Next event (20)">→</a></div></td></tr></table></div></td></tr>
|
---|
575 | <tr><td class="num" id="LN463">463</td><td class="line"> _DistributeTabSize(delta);</td></tr>
|
---|
576 | <tr><td class="num" id="LN464">464</td><td class="line"> <span class='keyword'>return</span>;</td></tr>
|
---|
577 | <tr><td class="num" id="LN465">465</td><td class="line"> }</td></tr>
|
---|
578 | <tr><td class="num" id="LN466">466</td><td class="line"> </td></tr>
|
---|
579 | <tr><td class="num" id="LN467">467</td><td class="line"> <span class='comment'>// done</span></td></tr>
|
---|
580 | <tr><td class="num" id="LN468">468</td><td class="line"> <span class="mrange">previousTab->tabRect.right = floorf(fFrame.right + fBorderWidth)</span>;</td></tr>
|
---|
581 | <tr><td class="num"></td><td class="line"><div id="EndPath" class="msg msgEvent" style="margin-left:36ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">20</div></td><td><div class="PathNav"><a href="#Path19" title="Previous event (19)">←</a></div></td></td><td>Dereference of null pointer</td></tr></table></div></td></tr>
|
---|
582 | <tr><td class="num" id="LN469">469</td><td class="line"> </td></tr>
|
---|
583 | <tr><td class="num" id="LN470">470</td><td class="line"> <span class='keyword'>for</span> (int32 i = 0; i < tabCount; i++) {</td></tr>
|
---|
584 | <tr><td class="num" id="LN471">471</td><td class="line"> Decorator::Tab* tab = fTabList.ItemAt(i);</td></tr>
|
---|
585 | <tr><td class="num" id="LN472">472</td><td class="line"> <span class='keyword'>if</span> (tab == <span class='macro'>NULL<span class='expansion'>__null</span></span>)</td></tr>
|
---|
586 | <tr><td class="num" id="LN473">473</td><td class="line"> <span class='keyword'>continue</span>;</td></tr>
|
---|
587 | <tr><td class="num" id="LN474">474</td><td class="line"> </td></tr>
|
---|
588 | <tr><td class="num" id="LN475">475</td><td class="line"> tab->tabOffset = uint32(tab->tabRect.left - fLeftBorder.left);</td></tr>
|
---|
589 | <tr><td class="num" id="LN476">476</td><td class="line"> }</td></tr>
|
---|
590 | <tr><td class="num" id="LN477">477</td><td class="line">}</td></tr>
|
---|
591 | <tr><td class="num" id="LN478">478</td><td class="line"> </td></tr>
|
---|
592 | <tr><td class="num" id="LN479">479</td><td class="line"> </td></tr>
|
---|
593 | <tr><td class="num" id="LN480">480</td><td class="line"><span class='keyword'>void</span></td></tr>
|
---|
594 | <tr><td class="num" id="LN481">481</td><td class="line">TabDecorator::_SetTitle(Decorator::Tab* tab, <span class='keyword'>const</span> <span class='keyword'>char</span>* string,</td></tr>
|
---|
595 | <tr><td class="num" id="LN482">482</td><td class="line"> BRegion* updateRegion)</td></tr>
|
---|
596 | <tr><td class="num" id="LN483">483</td><td class="line">{</td></tr>
|
---|
597 | <tr><td class="num" id="LN484">484</td><td class="line"> <span class='comment'>// TODO: we could be much smarter about the update region</span></td></tr>
|
---|
598 | <tr><td class="num" id="LN485">485</td><td class="line"> </td></tr>
|
---|
599 | <tr><td class="num" id="LN486">486</td><td class="line"> BRect rect = TabRect((int32) 0) | TabRect(CountTabs() - 1);</td></tr>
|
---|
600 | <tr><td class="num" id="LN487">487</td><td class="line"> <span class='comment'>// Get a rect of all the tabs</span></td></tr>
|
---|
601 | <tr><td class="num" id="LN488">488</td><td class="line"> </td></tr>
|
---|
602 | <tr><td class="num" id="LN489">489</td><td class="line"> _DoLayout();</td></tr>
|
---|
603 | <tr><td class="num" id="LN490">490</td><td class="line"> </td></tr>
|
---|
604 | <tr><td class="num" id="LN491">491</td><td class="line"> <span class='keyword'>if</span> (updateRegion == <span class='macro'>NULL<span class='expansion'>__null</span></span>)</td></tr>
|
---|
605 | <tr><td class="num" id="LN492">492</td><td class="line"> <span class='keyword'>return</span>;</td></tr>
|
---|
606 | <tr><td class="num" id="LN493">493</td><td class="line"> </td></tr>
|
---|
607 | <tr><td class="num" id="LN494">494</td><td class="line"> rect = rect | TabRect(CountTabs() - 1);</td></tr>
|
---|
608 | <tr><td class="num" id="LN495">495</td><td class="line"> <span class='comment'>// Update the rect to guarantee it updates all the tabs</span></td></tr>
|
---|
609 | <tr><td class="num" id="LN496">496</td><td class="line"> </td></tr>
|
---|
610 | <tr><td class="num" id="LN497">497</td><td class="line"> rect.bottom++;</td></tr>
|
---|
611 | <tr><td class="num" id="LN498">498</td><td class="line"> <span class='comment'>// the border will look differently when the title is adjacent</span></td></tr>
|
---|
612 | <tr><td class="num" id="LN499">499</td><td class="line"> </td></tr>
|
---|
613 | <tr><td class="num" id="LN500">500</td><td class="line"> updateRegion->Include(rect);</td></tr>
|
---|
614 | <tr><td class="num" id="LN501">501</td><td class="line">}</td></tr>
|
---|
615 | <tr><td class="num" id="LN502">502</td><td class="line"> </td></tr>
|
---|
616 | <tr><td class="num" id="LN503">503</td><td class="line"> </td></tr>
|
---|
617 | <tr><td class="num" id="LN504">504</td><td class="line"><span class='keyword'>void</span></td></tr>
|
---|
618 | <tr><td class="num" id="LN505">505</td><td class="line">TabDecorator::_MoveBy(BPoint offset)</td></tr>
|
---|
619 | <tr><td class="num" id="LN506">506</td><td class="line">{</td></tr>
|
---|
620 | <tr><td class="num" id="LN507">507</td><td class="line"> <span class='macro'>STRACE((<span class='string_literal'>"TabDecorator: Move By (%.1f, %.1f)\n"</span>, offset.x, offset.y))<span class='expansion'>;</span></span>;</td></tr>
|
---|
621 | <tr><td class="num" id="LN508">508</td><td class="line"> </td></tr>
|
---|
622 | <tr><td class="num" id="LN509">509</td><td class="line"> <span class='comment'>// Move all internal rectangles the appropriate amount</span></td></tr>
|
---|
623 | <tr><td class="num" id="LN510">510</td><td class="line"> <span class='keyword'>for</span> (int32 i = 0; i < fTabList.CountItems(); i++) {</td></tr>
|
---|
624 | <tr><td class="num" id="LN511">511</td><td class="line"> Decorator::Tab* tab = fTabList.ItemAt(i);</td></tr>
|
---|
625 | <tr><td class="num" id="LN512">512</td><td class="line"> tab->zoomRect.OffsetBy(offset);</td></tr>
|
---|
626 | <tr><td class="num" id="LN513">513</td><td class="line"> tab->closeRect.OffsetBy(offset);</td></tr>
|
---|
627 | <tr><td class="num" id="LN514">514</td><td class="line"> tab->tabRect.OffsetBy(offset);</td></tr>
|
---|
628 | <tr><td class="num" id="LN515">515</td><td class="line"> }</td></tr>
|
---|
629 | <tr><td class="num" id="LN516">516</td><td class="line"> </td></tr>
|
---|
630 | <tr><td class="num" id="LN517">517</td><td class="line"> fFrame.OffsetBy(offset);</td></tr>
|
---|
631 | <tr><td class="num" id="LN518">518</td><td class="line"> fTitleBarRect.OffsetBy(offset);</td></tr>
|
---|
632 | <tr><td class="num" id="LN519">519</td><td class="line"> fTabsRegion.OffsetBy(offset);</td></tr>
|
---|
633 | <tr><td class="num" id="LN520">520</td><td class="line"> fResizeRect.OffsetBy(offset);</td></tr>
|
---|
634 | <tr><td class="num" id="LN521">521</td><td class="line"> fBorderRect.OffsetBy(offset);</td></tr>
|
---|
635 | <tr><td class="num" id="LN522">522</td><td class="line"> </td></tr>
|
---|
636 | <tr><td class="num" id="LN523">523</td><td class="line"> fLeftBorder.OffsetBy(offset);</td></tr>
|
---|
637 | <tr><td class="num" id="LN524">524</td><td class="line"> fRightBorder.OffsetBy(offset);</td></tr>
|
---|
638 | <tr><td class="num" id="LN525">525</td><td class="line"> fTopBorder.OffsetBy(offset);</td></tr>
|
---|
639 | <tr><td class="num" id="LN526">526</td><td class="line"> fBottomBorder.OffsetBy(offset);</td></tr>
|
---|
640 | <tr><td class="num" id="LN527">527</td><td class="line">}</td></tr>
|
---|
641 | <tr><td class="num" id="LN528">528</td><td class="line"> </td></tr>
|
---|
642 | <tr><td class="num" id="LN529">529</td><td class="line"> </td></tr>
|
---|
643 | <tr><td class="num" id="LN530">530</td><td class="line"><span class='keyword'>void</span></td></tr>
|
---|
644 | <tr><td class="num" id="LN531">531</td><td class="line">TabDecorator::_ResizeBy(BPoint offset, BRegion* dirty)</td></tr>
|
---|
645 | <tr><td class="num" id="LN532">532</td><td class="line">{</td></tr>
|
---|
646 | <tr><td class="num" id="LN533">533</td><td class="line"> <span class='macro'>STRACE((<span class='string_literal'>"TabDecorator: Resize By (%.1f, %.1f)\n"</span>, offset.x, offset.y))<span class='expansion'>;</span></span>;</td></tr>
|
---|
647 | <tr><td class="num" id="LN534">534</td><td class="line"> </td></tr>
|
---|
648 | <tr><td class="num" id="LN535">535</td><td class="line"> <span class='comment'>// Move all internal rectangles the appropriate amount</span></td></tr>
|
---|
649 | <tr><td class="num" id="LN536">536</td><td class="line"> fFrame.right += offset.x;</td></tr>
|
---|
650 | <tr><td class="num" id="LN537">537</td><td class="line"> fFrame.bottom += offset.y;</td></tr>
|
---|
651 | <tr><td class="num" id="LN538">538</td><td class="line"> </td></tr>
|
---|
652 | <tr><td class="num" id="LN539">539</td><td class="line"> <span class='comment'>// Handle invalidation of resize rect</span></td></tr>
|
---|
653 | <tr><td class="num" id="LN540">540</td><td class="line"> <span class='keyword'>if</span> (dirty != <span class='macro'>NULL<span class='expansion'>__null</span></span> && !(fTopTab->flags & B_NOT_RESIZABLE)) {</td></tr>
|
---|
654 | <tr><td class="num" id="LN541">541</td><td class="line"> BRect realResizeRect;</td></tr>
|
---|
655 | <tr><td class="num" id="LN542">542</td><td class="line"> <span class='keyword'>switch</span> ((<span class='keyword'>int</span>)fTopTab->look) {</td></tr>
|
---|
656 | <tr><td class="num" id="LN543">543</td><td class="line"> <span class='keyword'>case</span> B_DOCUMENT_WINDOW_LOOK:</td></tr>
|
---|
657 | <tr><td class="num" id="LN544">544</td><td class="line"> realResizeRect = fResizeRect;</td></tr>
|
---|
658 | <tr><td class="num" id="LN545">545</td><td class="line"> <span class='comment'>// Resize rect at old location</span></td></tr>
|
---|
659 | <tr><td class="num" id="LN546">546</td><td class="line"> dirty->Include(realResizeRect);</td></tr>
|
---|
660 | <tr><td class="num" id="LN547">547</td><td class="line"> realResizeRect.OffsetBy(offset);</td></tr>
|
---|
661 | <tr><td class="num" id="LN548">548</td><td class="line"> <span class='comment'>// Resize rect at new location</span></td></tr>
|
---|
662 | <tr><td class="num" id="LN549">549</td><td class="line"> dirty->Include(realResizeRect);</td></tr>
|
---|
663 | <tr><td class="num" id="LN550">550</td><td class="line"> <span class='keyword'>break</span>;</td></tr>
|
---|
664 | <tr><td class="num" id="LN551">551</td><td class="line"> </td></tr>
|
---|
665 | <tr><td class="num" id="LN552">552</td><td class="line"> <span class='keyword'>case</span> B_TITLED_WINDOW_LOOK:</td></tr>
|
---|
666 | <tr><td class="num" id="LN553">553</td><td class="line"> <span class='keyword'>case</span> B_FLOATING_WINDOW_LOOK:</td></tr>
|
---|
667 | <tr><td class="num" id="LN554">554</td><td class="line"> <span class='keyword'>case</span> B_MODAL_WINDOW_LOOK:</td></tr>
|
---|
668 | <tr><td class="num" id="LN555">555</td><td class="line"> <span class='keyword'>case</span> kLeftTitledWindowLook:</td></tr>
|
---|
669 | <tr><td class="num" id="LN556">556</td><td class="line"> <span class='comment'>// The bottom border resize line</span></td></tr>
|
---|
670 | <tr><td class="num" id="LN557">557</td><td class="line"> realResizeRect.Set(fRightBorder.right - kBorderResizeLength,</td></tr>
|
---|
671 | <tr><td class="num" id="LN558">558</td><td class="line"> fBottomBorder.top,</td></tr>
|
---|
672 | <tr><td class="num" id="LN559">559</td><td class="line"> fRightBorder.right - kBorderResizeLength,</td></tr>
|
---|
673 | <tr><td class="num" id="LN560">560</td><td class="line"> fBottomBorder.bottom - 1);</td></tr>
|
---|
674 | <tr><td class="num" id="LN561">561</td><td class="line"> <span class='comment'>// Old location</span></td></tr>
|
---|
675 | <tr><td class="num" id="LN562">562</td><td class="line"> dirty->Include(realResizeRect);</td></tr>
|
---|
676 | <tr><td class="num" id="LN563">563</td><td class="line"> realResizeRect.OffsetBy(offset);</td></tr>
|
---|
677 | <tr><td class="num" id="LN564">564</td><td class="line"> <span class='comment'>// New location</span></td></tr>
|
---|
678 | <tr><td class="num" id="LN565">565</td><td class="line"> dirty->Include(realResizeRect);</td></tr>
|
---|
679 | <tr><td class="num" id="LN566">566</td><td class="line"> </td></tr>
|
---|
680 | <tr><td class="num" id="LN567">567</td><td class="line"> <span class='comment'>// The right border resize line</span></td></tr>
|
---|
681 | <tr><td class="num" id="LN568">568</td><td class="line"> realResizeRect.Set(fRightBorder.left,</td></tr>
|
---|
682 | <tr><td class="num" id="LN569">569</td><td class="line"> fBottomBorder.bottom - kBorderResizeLength,</td></tr>
|
---|
683 | <tr><td class="num" id="LN570">570</td><td class="line"> fRightBorder.right - 1,</td></tr>
|
---|
684 | <tr><td class="num" id="LN571">571</td><td class="line"> fBottomBorder.bottom - kBorderResizeLength);</td></tr>
|
---|
685 | <tr><td class="num" id="LN572">572</td><td class="line"> <span class='comment'>// Old location</span></td></tr>
|
---|
686 | <tr><td class="num" id="LN573">573</td><td class="line"> dirty->Include(realResizeRect);</td></tr>
|
---|
687 | <tr><td class="num" id="LN574">574</td><td class="line"> realResizeRect.OffsetBy(offset);</td></tr>
|
---|
688 | <tr><td class="num" id="LN575">575</td><td class="line"> <span class='comment'>// New location</span></td></tr>
|
---|
689 | <tr><td class="num" id="LN576">576</td><td class="line"> dirty->Include(realResizeRect);</td></tr>
|
---|
690 | <tr><td class="num" id="LN577">577</td><td class="line"> <span class='keyword'>break</span>;</td></tr>
|
---|
691 | <tr><td class="num" id="LN578">578</td><td class="line"> </td></tr>
|
---|
692 | <tr><td class="num" id="LN579">579</td><td class="line"> <span class='keyword'>default</span>:</td></tr>
|
---|
693 | <tr><td class="num" id="LN580">580</td><td class="line"> <span class='keyword'>break</span>;</td></tr>
|
---|
694 | <tr><td class="num" id="LN581">581</td><td class="line"> }</td></tr>
|
---|
695 | <tr><td class="num" id="LN582">582</td><td class="line"> }</td></tr>
|
---|
696 | <tr><td class="num" id="LN583">583</td><td class="line"> </td></tr>
|
---|
697 | <tr><td class="num" id="LN584">584</td><td class="line"> fResizeRect.OffsetBy(offset);</td></tr>
|
---|
698 | <tr><td class="num" id="LN585">585</td><td class="line"> </td></tr>
|
---|
699 | <tr><td class="num" id="LN586">586</td><td class="line"> fBorderRect.right += offset.x;</td></tr>
|
---|
700 | <tr><td class="num" id="LN587">587</td><td class="line"> fBorderRect.bottom += offset.y;</td></tr>
|
---|
701 | <tr><td class="num" id="LN588">588</td><td class="line"> </td></tr>
|
---|
702 | <tr><td class="num" id="LN589">589</td><td class="line"> fLeftBorder.bottom += offset.y;</td></tr>
|
---|
703 | <tr><td class="num" id="LN590">590</td><td class="line"> fTopBorder.right += offset.x;</td></tr>
|
---|
704 | <tr><td class="num" id="LN591">591</td><td class="line"> </td></tr>
|
---|
705 | <tr><td class="num" id="LN592">592</td><td class="line"> fRightBorder.OffsetBy(offset.x, 0.0);</td></tr>
|
---|
706 | <tr><td class="num" id="LN593">593</td><td class="line"> fRightBorder.bottom += offset.y;</td></tr>
|
---|
707 | <tr><td class="num" id="LN594">594</td><td class="line"> </td></tr>
|
---|
708 | <tr><td class="num" id="LN595">595</td><td class="line"> fBottomBorder.OffsetBy(0.0, offset.y);</td></tr>
|
---|
709 | <tr><td class="num" id="LN596">596</td><td class="line"> fBottomBorder.right += offset.x;</td></tr>
|
---|
710 | <tr><td class="num" id="LN597">597</td><td class="line"> </td></tr>
|
---|
711 | <tr><td class="num" id="LN598">598</td><td class="line"> <span class='keyword'>if</span> (dirty) {</td></tr>
|
---|
712 | <tr><td class="num" id="LN599">599</td><td class="line"> <span class='keyword'>if</span> (offset.x > 0.0) {</td></tr>
|
---|
713 | <tr><td class="num" id="LN600">600</td><td class="line"> BRect t(fRightBorder.left - offset.x, fTopBorder.top,</td></tr>
|
---|
714 | <tr><td class="num" id="LN601">601</td><td class="line"> fRightBorder.right, fTopBorder.bottom);</td></tr>
|
---|
715 | <tr><td class="num" id="LN602">602</td><td class="line"> dirty->Include(t);</td></tr>
|
---|
716 | <tr><td class="num" id="LN603">603</td><td class="line"> t.Set(fRightBorder.left - offset.x, fBottomBorder.top,</td></tr>
|
---|
717 | <tr><td class="num" id="LN604">604</td><td class="line"> fRightBorder.right, fBottomBorder.bottom);</td></tr>
|
---|
718 | <tr><td class="num" id="LN605">605</td><td class="line"> dirty->Include(t);</td></tr>
|
---|
719 | <tr><td class="num" id="LN606">606</td><td class="line"> dirty->Include(fRightBorder);</td></tr>
|
---|
720 | <tr><td class="num" id="LN607">607</td><td class="line"> } <span class='keyword'>else</span> <span class='keyword'>if</span> (offset.x < 0.0) {</td></tr>
|
---|
721 | <tr><td class="num" id="LN608">608</td><td class="line"> dirty->Include(BRect(fRightBorder.left, fTopBorder.top,</td></tr>
|
---|
722 | <tr><td class="num" id="LN609">609</td><td class="line"> fRightBorder.right, fBottomBorder.bottom));</td></tr>
|
---|
723 | <tr><td class="num" id="LN610">610</td><td class="line"> }</td></tr>
|
---|
724 | <tr><td class="num" id="LN611">611</td><td class="line"> <span class='keyword'>if</span> (offset.y > 0.0) {</td></tr>
|
---|
725 | <tr><td class="num" id="LN612">612</td><td class="line"> BRect t(fLeftBorder.left, fLeftBorder.bottom - offset.y,</td></tr>
|
---|
726 | <tr><td class="num" id="LN613">613</td><td class="line"> fLeftBorder.right, fLeftBorder.bottom);</td></tr>
|
---|
727 | <tr><td class="num" id="LN614">614</td><td class="line"> dirty->Include(t);</td></tr>
|
---|
728 | <tr><td class="num" id="LN615">615</td><td class="line"> t.Set(fRightBorder.left, fRightBorder.bottom - offset.y,</td></tr>
|
---|
729 | <tr><td class="num" id="LN616">616</td><td class="line"> fRightBorder.right, fRightBorder.bottom);</td></tr>
|
---|
730 | <tr><td class="num" id="LN617">617</td><td class="line"> dirty->Include(t);</td></tr>
|
---|
731 | <tr><td class="num" id="LN618">618</td><td class="line"> dirty->Include(fBottomBorder);</td></tr>
|
---|
732 | <tr><td class="num" id="LN619">619</td><td class="line"> } <span class='keyword'>else</span> <span class='keyword'>if</span> (offset.y < 0.0) {</td></tr>
|
---|
733 | <tr><td class="num" id="LN620">620</td><td class="line"> dirty->Include(fBottomBorder);</td></tr>
|
---|
734 | <tr><td class="num" id="LN621">621</td><td class="line"> }</td></tr>
|
---|
735 | <tr><td class="num" id="LN622">622</td><td class="line"> }</td></tr>
|
---|
736 | <tr><td class="num" id="LN623">623</td><td class="line"> </td></tr>
|
---|
737 | <tr><td class="num" id="LN624">624</td><td class="line"> <span class='comment'>// resize tab and layout tab items</span></td></tr>
|
---|
738 | <tr><td class="num" id="LN625">625</td><td class="line"> <span class='keyword'>if</span> (fTitleBarRect.IsValid()) {</td></tr>
|
---|
739 | <tr><td class="num" id="LN626">626</td><td class="line"> <span class='keyword'>if</span> (fTabList.CountItems() > 1) {</td></tr>
|
---|
740 | <tr><td class="num" id="LN627">627</td><td class="line"> _DoTabLayout();</td></tr>
|
---|
741 | <tr><td class="num" id="LN628">628</td><td class="line"> <span class='keyword'>if</span> (dirty != <span class='macro'>NULL<span class='expansion'>__null</span></span>)</td></tr>
|
---|
742 | <tr><td class="num" id="LN629">629</td><td class="line"> dirty->Include(fTitleBarRect);</td></tr>
|
---|
743 | <tr><td class="num" id="LN630">630</td><td class="line"> <span class='keyword'>return</span>;</td></tr>
|
---|
744 | <tr><td class="num" id="LN631">631</td><td class="line"> }</td></tr>
|
---|
745 | <tr><td class="num" id="LN632">632</td><td class="line"> </td></tr>
|
---|
746 | <tr><td class="num" id="LN633">633</td><td class="line"> Decorator::Tab* tab = _TabAt(0);</td></tr>
|
---|
747 | <tr><td class="num" id="LN634">634</td><td class="line"> BRect& tabRect = tab->tabRect;</td></tr>
|
---|
748 | <tr><td class="num" id="LN635">635</td><td class="line"> BRect oldTabRect(tabRect);</td></tr>
|
---|
749 | <tr><td class="num" id="LN636">636</td><td class="line"> </td></tr>
|
---|
750 | <tr><td class="num" id="LN637">637</td><td class="line"> <span class='keyword'>float</span> tabSize;</td></tr>
|
---|
751 | <tr><td class="num" id="LN638">638</td><td class="line"> <span class='keyword'>float</span> tabOffset = _SingleTabOffsetAndSize(tabSize);</td></tr>
|
---|
752 | <tr><td class="num" id="LN639">639</td><td class="line"> </td></tr>
|
---|
753 | <tr><td class="num" id="LN640">640</td><td class="line"> <span class='keyword'>float</span> delta = tabOffset - tab->tabOffset;</td></tr>
|
---|
754 | <tr><td class="num" id="LN641">641</td><td class="line"> tab->tabOffset = (uint32)tabOffset;</td></tr>
|
---|
755 | <tr><td class="num" id="LN642">642</td><td class="line"> <span class='keyword'>if</span> (fTopTab->look != kLeftTitledWindowLook)</td></tr>
|
---|
756 | <tr><td class="num" id="LN643">643</td><td class="line"> tabRect.OffsetBy(delta, 0.0);</td></tr>
|
---|
757 | <tr><td class="num" id="LN644">644</td><td class="line"> <span class='keyword'>else</span></td></tr>
|
---|
758 | <tr><td class="num" id="LN645">645</td><td class="line"> tabRect.OffsetBy(0.0, delta);</td></tr>
|
---|
759 | <tr><td class="num" id="LN646">646</td><td class="line"> </td></tr>
|
---|
760 | <tr><td class="num" id="LN647">647</td><td class="line"> <span class='keyword'>if</span> (tabSize < tab->minTabSize)</td></tr>
|
---|
761 | <tr><td class="num" id="LN648">648</td><td class="line"> tabSize = tab->minTabSize;</td></tr>
|
---|
762 | <tr><td class="num" id="LN649">649</td><td class="line"> <span class='keyword'>if</span> (tabSize > tab->maxTabSize)</td></tr>
|
---|
763 | <tr><td class="num" id="LN650">650</td><td class="line"> tabSize = tab->maxTabSize;</td></tr>
|
---|
764 | <tr><td class="num" id="LN651">651</td><td class="line"> </td></tr>
|
---|
765 | <tr><td class="num" id="LN652">652</td><td class="line"> <span class='keyword'>if</span> (fTopTab->look != kLeftTitledWindowLook</td></tr>
|
---|
766 | <tr><td class="num" id="LN653">653</td><td class="line"> && tabSize != tabRect.Width()) {</td></tr>
|
---|
767 | <tr><td class="num" id="LN654">654</td><td class="line"> tabRect.right = tabRect.left + tabSize;</td></tr>
|
---|
768 | <tr><td class="num" id="LN655">655</td><td class="line"> } <span class='keyword'>else</span> <span class='keyword'>if</span> (fTopTab->look == kLeftTitledWindowLook</td></tr>
|
---|
769 | <tr><td class="num" id="LN656">656</td><td class="line"> && tabSize != tabRect.Height()) {</td></tr>
|
---|
770 | <tr><td class="num" id="LN657">657</td><td class="line"> tabRect.bottom = tabRect.top + tabSize;</td></tr>
|
---|
771 | <tr><td class="num" id="LN658">658</td><td class="line"> }</td></tr>
|
---|
772 | <tr><td class="num" id="LN659">659</td><td class="line"> </td></tr>
|
---|
773 | <tr><td class="num" id="LN660">660</td><td class="line"> <span class='keyword'>if</span> (oldTabRect != tabRect) {</td></tr>
|
---|
774 | <tr><td class="num" id="LN661">661</td><td class="line"> _LayoutTabItems(tab, tabRect);</td></tr>
|
---|
775 | <tr><td class="num" id="LN662">662</td><td class="line"> </td></tr>
|
---|
776 | <tr><td class="num" id="LN663">663</td><td class="line"> <span class='keyword'>if</span> (dirty) {</td></tr>
|
---|
777 | <tr><td class="num" id="LN664">664</td><td class="line"> <span class='comment'>// NOTE: the tab rect becoming smaller only would</span></td></tr>
|
---|
778 | <tr><td class="num" id="LN665">665</td><td class="line"> <span class='comment'>// handled be the Desktop anyways, so it is sufficient</span></td></tr>
|
---|
779 | <tr><td class="num" id="LN666">666</td><td class="line"> <span class='comment'>// to include it into the dirty region in it's</span></td></tr>
|
---|
780 | <tr><td class="num" id="LN667">667</td><td class="line"> <span class='comment'>// final state</span></td></tr>
|
---|
781 | <tr><td class="num" id="LN668">668</td><td class="line"> BRect redraw(tabRect);</td></tr>
|
---|
782 | <tr><td class="num" id="LN669">669</td><td class="line"> <span class='keyword'>if</span> (delta != 0.0) {</td></tr>
|
---|
783 | <tr><td class="num" id="LN670">670</td><td class="line"> redraw = redraw | oldTabRect;</td></tr>
|
---|
784 | <tr><td class="num" id="LN671">671</td><td class="line"> <span class='keyword'>if</span> (fTopTab->look != kLeftTitledWindowLook)</td></tr>
|
---|
785 | <tr><td class="num" id="LN672">672</td><td class="line"> redraw.bottom++;</td></tr>
|
---|
786 | <tr><td class="num" id="LN673">673</td><td class="line"> <span class='keyword'>else</span></td></tr>
|
---|
787 | <tr><td class="num" id="LN674">674</td><td class="line"> redraw.right++;</td></tr>
|
---|
788 | <tr><td class="num" id="LN675">675</td><td class="line"> }</td></tr>
|
---|
789 | <tr><td class="num" id="LN676">676</td><td class="line"> dirty->Include(redraw);</td></tr>
|
---|
790 | <tr><td class="num" id="LN677">677</td><td class="line"> }</td></tr>
|
---|
791 | <tr><td class="num" id="LN678">678</td><td class="line"> }</td></tr>
|
---|
792 | <tr><td class="num" id="LN679">679</td><td class="line"> fTitleBarRect = tabRect;</td></tr>
|
---|
793 | <tr><td class="num" id="LN680">680</td><td class="line"> fTabsRegion = fTitleBarRect;</td></tr>
|
---|
794 | <tr><td class="num" id="LN681">681</td><td class="line"> }</td></tr>
|
---|
795 | <tr><td class="num" id="LN682">682</td><td class="line">}</td></tr>
|
---|
796 | <tr><td class="num" id="LN683">683</td><td class="line"> </td></tr>
|
---|
797 | <tr><td class="num" id="LN684">684</td><td class="line"> </td></tr>
|
---|
798 | <tr><td class="num" id="LN685">685</td><td class="line"><span class='keyword'>void</span></td></tr>
|
---|
799 | <tr><td class="num" id="LN686">686</td><td class="line">TabDecorator::_SetFocus(Decorator::Tab* tab)</td></tr>
|
---|
800 | <tr><td class="num" id="LN687">687</td><td class="line">{</td></tr>
|
---|
801 | <tr><td class="num" id="LN688">688</td><td class="line"> Decorator::Tab* decoratorTab = <span class='keyword'>static_cast</span><Decorator::Tab*>(tab);</td></tr>
|
---|
802 | <tr><td class="num" id="LN689">689</td><td class="line"> </td></tr>
|
---|
803 | <tr><td class="num" id="LN690">690</td><td class="line"> decoratorTab->buttonFocus = IsFocus(tab)</td></tr>
|
---|
804 | <tr><td class="num" id="LN691">691</td><td class="line"> || ((decoratorTab->look == B_FLOATING_WINDOW_LOOK</td></tr>
|
---|
805 | <tr><td class="num" id="LN692">692</td><td class="line"> || decoratorTab->look == kLeftTitledWindowLook)</td></tr>
|
---|
806 | <tr><td class="num" id="LN693">693</td><td class="line"> && (decoratorTab->flags & B_AVOID_FOCUS) != 0);</td></tr>
|
---|
807 | <tr><td class="num" id="LN694">694</td><td class="line"> <span class='keyword'>if</span> (CountTabs() > 1)</td></tr>
|
---|
808 | <tr><td class="num" id="LN695">695</td><td class="line"> _LayoutTabItems(decoratorTab, decoratorTab->tabRect);</td></tr>
|
---|
809 | <tr><td class="num" id="LN696">696</td><td class="line">}</td></tr>
|
---|
810 | <tr><td class="num" id="LN697">697</td><td class="line"> </td></tr>
|
---|
811 | <tr><td class="num" id="LN698">698</td><td class="line"> </td></tr>
|
---|
812 | <tr><td class="num" id="LN699">699</td><td class="line"><span class='keyword'>bool</span></td></tr>
|
---|
813 | <tr><td class="num" id="LN700">700</td><td class="line">TabDecorator::_SetTabLocation(Decorator::Tab* _tab, <span class='keyword'>float</span> location,</td></tr>
|
---|
814 | <tr><td class="num" id="LN701">701</td><td class="line"> <span class='keyword'>bool</span> isShifting, BRegion* updateRegion)</td></tr>
|
---|
815 | <tr><td class="num" id="LN702">702</td><td class="line">{</td></tr>
|
---|
816 | <tr><td class="num" id="LN703">703</td><td class="line"> <span class='macro'>STRACE((<span class='string_literal'>"TabDecorator: Set Tab Location(%.1f)\n"</span>, location))<span class='expansion'>;</span></span>;</td></tr>
|
---|
817 | <tr><td class="num" id="LN704">704</td><td class="line"> </td></tr>
|
---|
818 | <tr><td class="num" id="LN705">705</td><td class="line"> <span class='keyword'>if</span> (CountTabs() > 1) {</td></tr>
|
---|
819 | <tr><td class="num" id="LN706">706</td><td class="line"> <span class='keyword'>if</span> (isShifting == <span class='keyword'>false</span>) {</td></tr>
|
---|
820 | <tr><td class="num" id="LN707">707</td><td class="line"> _DoTabLayout();</td></tr>
|
---|
821 | <tr><td class="num" id="LN708">708</td><td class="line"> <span class='keyword'>if</span> (updateRegion != <span class='macro'>NULL<span class='expansion'>__null</span></span>)</td></tr>
|
---|
822 | <tr><td class="num" id="LN709">709</td><td class="line"> updateRegion->Include(fTitleBarRect);</td></tr>
|
---|
823 | <tr><td class="num" id="LN710">710</td><td class="line"> </td></tr>
|
---|
824 | <tr><td class="num" id="LN711">711</td><td class="line"> fOldMovingTab = BRect(0, 0, -1, -1);</td></tr>
|
---|
825 | <tr><td class="num" id="LN712">712</td><td class="line"> <span class='keyword'>return</span> <span class='keyword'>true</span>;</td></tr>
|
---|
826 | <tr><td class="num" id="LN713">713</td><td class="line"> } <span class='keyword'>else</span> {</td></tr>
|
---|
827 | <tr><td class="num" id="LN714">714</td><td class="line"> <span class='keyword'>if</span> (fOldMovingTab.IsValid() == <span class='keyword'>false</span>)</td></tr>
|
---|
828 | <tr><td class="num" id="LN715">715</td><td class="line"> fOldMovingTab = _tab->tabRect;</td></tr>
|
---|
829 | <tr><td class="num" id="LN716">716</td><td class="line"> }</td></tr>
|
---|
830 | <tr><td class="num" id="LN717">717</td><td class="line"> }</td></tr>
|
---|
831 | <tr><td class="num" id="LN718">718</td><td class="line"> </td></tr>
|
---|
832 | <tr><td class="num" id="LN719">719</td><td class="line"> Decorator::Tab* tab = <span class='keyword'>static_cast</span><Decorator::Tab*>(_tab);</td></tr>
|
---|
833 | <tr><td class="num" id="LN720">720</td><td class="line"> BRect& tabRect = tab->tabRect;</td></tr>
|
---|
834 | <tr><td class="num" id="LN721">721</td><td class="line"> <span class='keyword'>if</span> (tabRect.IsValid() == <span class='keyword'>false</span>)</td></tr>
|
---|
835 | <tr><td class="num" id="LN722">722</td><td class="line"> <span class='keyword'>return</span> <span class='keyword'>false</span>;</td></tr>
|
---|
836 | <tr><td class="num" id="LN723">723</td><td class="line"> </td></tr>
|
---|
837 | <tr><td class="num" id="LN724">724</td><td class="line"> <span class='keyword'>if</span> (location < 0)</td></tr>
|
---|
838 | <tr><td class="num" id="LN725">725</td><td class="line"> location = 0;</td></tr>
|
---|
839 | <tr><td class="num" id="LN726">726</td><td class="line"> </td></tr>
|
---|
840 | <tr><td class="num" id="LN727">727</td><td class="line"> <span class='keyword'>float</span> maxLocation</td></tr>
|
---|
841 | <tr><td class="num" id="LN728">728</td><td class="line"> = fRightBorder.right - fLeftBorder.left - tabRect.Width();</td></tr>
|
---|
842 | <tr><td class="num" id="LN729">729</td><td class="line"> <span class='keyword'>if</span> (CountTabs() > 1)</td></tr>
|
---|
843 | <tr><td class="num" id="LN730">730</td><td class="line"> maxLocation = fTitleBarRect.right - fLeftBorder.left - tabRect.Width();</td></tr>
|
---|
844 | <tr><td class="num" id="LN731">731</td><td class="line"> </td></tr>
|
---|
845 | <tr><td class="num" id="LN732">732</td><td class="line"> <span class='keyword'>if</span> (location > maxLocation)</td></tr>
|
---|
846 | <tr><td class="num" id="LN733">733</td><td class="line"> location = maxLocation;</td></tr>
|
---|
847 | <tr><td class="num" id="LN734">734</td><td class="line"> </td></tr>
|
---|
848 | <tr><td class="num" id="LN735">735</td><td class="line"> <span class='keyword'>float</span> delta = floor(location - tab->tabOffset);</td></tr>
|
---|
849 | <tr><td class="num" id="LN736">736</td><td class="line"> <span class='keyword'>if</span> (delta == 0.0)</td></tr>
|
---|
850 | <tr><td class="num" id="LN737">737</td><td class="line"> <span class='keyword'>return</span> <span class='keyword'>false</span>;</td></tr>
|
---|
851 | <tr><td class="num" id="LN738">738</td><td class="line"> </td></tr>
|
---|
852 | <tr><td class="num" id="LN739">739</td><td class="line"> <span class='comment'>// redraw old rect (1 pixel on the border must also be updated)</span></td></tr>
|
---|
853 | <tr><td class="num" id="LN740">740</td><td class="line"> BRect rect(tabRect);</td></tr>
|
---|
854 | <tr><td class="num" id="LN741">741</td><td class="line"> rect.bottom++;</td></tr>
|
---|
855 | <tr><td class="num" id="LN742">742</td><td class="line"> <span class='keyword'>if</span> (updateRegion != <span class='macro'>NULL<span class='expansion'>__null</span></span>)</td></tr>
|
---|
856 | <tr><td class="num" id="LN743">743</td><td class="line"> updateRegion->Include(rect);</td></tr>
|
---|
857 | <tr><td class="num" id="LN744">744</td><td class="line"> </td></tr>
|
---|
858 | <tr><td class="num" id="LN745">745</td><td class="line"> tabRect.OffsetBy(delta, 0);</td></tr>
|
---|
859 | <tr><td class="num" id="LN746">746</td><td class="line"> tab->tabOffset = (int32)location;</td></tr>
|
---|
860 | <tr><td class="num" id="LN747">747</td><td class="line"> _LayoutTabItems(_tab, tabRect);</td></tr>
|
---|
861 | <tr><td class="num" id="LN748">748</td><td class="line"> tab->tabLocation = maxLocation > 0.0 ? tab->tabOffset / maxLocation : 0.0;</td></tr>
|
---|
862 | <tr><td class="num" id="LN749">749</td><td class="line"> </td></tr>
|
---|
863 | <tr><td class="num" id="LN750">750</td><td class="line"> <span class='keyword'>if</span> (fTabList.CountItems() == 1)</td></tr>
|
---|
864 | <tr><td class="num" id="LN751">751</td><td class="line"> fTitleBarRect = tabRect;</td></tr>
|
---|
865 | <tr><td class="num" id="LN752">752</td><td class="line"> </td></tr>
|
---|
866 | <tr><td class="num" id="LN753">753</td><td class="line"> _CalculateTabsRegion();</td></tr>
|
---|
867 | <tr><td class="num" id="LN754">754</td><td class="line"> </td></tr>
|
---|
868 | <tr><td class="num" id="LN755">755</td><td class="line"> <span class='comment'>// redraw new rect as well</span></td></tr>
|
---|
869 | <tr><td class="num" id="LN756">756</td><td class="line"> rect = tabRect;</td></tr>
|
---|
870 | <tr><td class="num" id="LN757">757</td><td class="line"> rect.bottom++;</td></tr>
|
---|
871 | <tr><td class="num" id="LN758">758</td><td class="line"> <span class='keyword'>if</span> (updateRegion != <span class='macro'>NULL<span class='expansion'>__null</span></span>)</td></tr>
|
---|
872 | <tr><td class="num" id="LN759">759</td><td class="line"> updateRegion->Include(rect);</td></tr>
|
---|
873 | <tr><td class="num" id="LN760">760</td><td class="line"> </td></tr>
|
---|
874 | <tr><td class="num" id="LN761">761</td><td class="line"> <span class='keyword'>return</span> <span class='keyword'>true</span>;</td></tr>
|
---|
875 | <tr><td class="num" id="LN762">762</td><td class="line">}</td></tr>
|
---|
876 | <tr><td class="num" id="LN763">763</td><td class="line"> </td></tr>
|
---|
877 | <tr><td class="num" id="LN764">764</td><td class="line"> </td></tr>
|
---|
878 | <tr><td class="num" id="LN765">765</td><td class="line"><span class='keyword'>bool</span></td></tr>
|
---|
879 | <tr><td class="num" id="LN766">766</td><td class="line">TabDecorator::_SetSettings(<span class='keyword'>const</span> BMessage& settings, BRegion* updateRegion)</td></tr>
|
---|
880 | <tr><td class="num" id="LN767">767</td><td class="line">{</td></tr>
|
---|
881 | <tr><td class="num" id="LN768">768</td><td class="line"> <span class='keyword'>float</span> tabLocation;</td></tr>
|
---|
882 | <tr><td class="num" id="LN769">769</td><td class="line"> <span class='keyword'>bool</span> modified = <span class='keyword'>false</span>;</td></tr>
|
---|
883 | <tr><td class="num" id="LN770">770</td><td class="line"> <span class='keyword'>for</span> (int32 i = 0; i < fTabList.CountItems(); i++) {</td></tr>
|
---|
884 | <tr><td class="num" id="LN771">771</td><td class="line"> <span class='keyword'>if</span> (settings.FindFloat(<span class='string_literal'>"tab location"</span>, i, &tabLocation) != <span class='macro'>B_OK<span class='expansion'>((int)0)</span></span>)</td></tr>
|
---|
885 | <tr><td class="num" id="LN772">772</td><td class="line"> <span class='keyword'>return</span> <span class='keyword'>false</span>;</td></tr>
|
---|
886 | <tr><td class="num" id="LN773">773</td><td class="line"> modified |= SetTabLocation(i, tabLocation, updateRegion);</td></tr>
|
---|
887 | <tr><td class="num" id="LN774">774</td><td class="line"> }</td></tr>
|
---|
888 | <tr><td class="num" id="LN775">775</td><td class="line"> <span class='keyword'>return</span> modified;</td></tr>
|
---|
889 | <tr><td class="num" id="LN776">776</td><td class="line">}</td></tr>
|
---|
890 | <tr><td class="num" id="LN777">777</td><td class="line"> </td></tr>
|
---|
891 | <tr><td class="num" id="LN778">778</td><td class="line"> </td></tr>
|
---|
892 | <tr><td class="num" id="LN779">779</td><td class="line"><span class='keyword'>bool</span></td></tr>
|
---|
893 | <tr><td class="num" id="LN780">780</td><td class="line">TabDecorator::_AddTab(DesktopSettings& settings, int32 index,</td></tr>
|
---|
894 | <tr><td class="num" id="LN781">781</td><td class="line"> BRegion* updateRegion)</td></tr>
|
---|
895 | <tr><td class="num" id="LN782">782</td><td class="line">{</td></tr>
|
---|
896 | <tr><td class="num" id="LN783">783</td><td class="line"> _UpdateFont(settings);</td></tr>
|
---|
897 | <tr><td class="num" id="LN784">784</td><td class="line"> </td></tr>
|
---|
898 | <tr><td class="num" id="LN785">785</td><td class="line"> _DoLayout();</td></tr>
|
---|
899 | <tr><td class="num" id="LN786">786</td><td class="line"> <span class='keyword'>if</span> (updateRegion != <span class='macro'>NULL<span class='expansion'>__null</span></span>)</td></tr>
|
---|
900 | <tr><td class="num" id="LN787">787</td><td class="line"> updateRegion->Include(fTitleBarRect);</td></tr>
|
---|
901 | <tr><td class="num" id="LN788">788</td><td class="line"> <span class='keyword'>return</span> <span class='keyword'>true</span>;</td></tr>
|
---|
902 | <tr><td class="num" id="LN789">789</td><td class="line">}</td></tr>
|
---|
903 | <tr><td class="num" id="LN790">790</td><td class="line"> </td></tr>
|
---|
904 | <tr><td class="num" id="LN791">791</td><td class="line"> </td></tr>
|
---|
905 | <tr><td class="num" id="LN792">792</td><td class="line"><span class='keyword'>bool</span></td></tr>
|
---|
906 | <tr><td class="num" id="LN793">793</td><td class="line">TabDecorator::_RemoveTab(int32 index, BRegion* updateRegion)</td></tr>
|
---|
907 | <tr><td class="num" id="LN794">794</td><td class="line">{</td></tr>
|
---|
908 | <tr><td class="num" id="LN795">795</td><td class="line"> BRect oldTitle = fTitleBarRect;</td></tr>
|
---|
909 | <tr><td class="num" id="LN796">796</td><td class="line"> <span class="mrange">_DoLayout()</span>;</td></tr>
|
---|
910 | <tr><td class="num"></td><td class="line"><div id="Path1" class="msg msgEvent" style="margin-left:9ex"><table class="msgT"><tr><td valign="top"><div class="PathIndex PathIndexEvent">1</div></td><td>Calling 'TabDecorator::_DoLayout'</td><td><div class="PathNav"><a href="#Path2" title="Next event (2)">→</a></div></td></tr></table></div></td></tr>
|
---|
911 | <tr><td class="num" id="LN797">797</td><td class="line"> <span class='keyword'>if</span> (updateRegion != <span class='macro'>NULL<span class='expansion'>__null</span></span>) {</td></tr>
|
---|
912 | <tr><td class="num" id="LN798">798</td><td class="line"> updateRegion->Include(oldTitle);</td></tr>
|
---|
913 | <tr><td class="num" id="LN799">799</td><td class="line"> updateRegion->Include(fTitleBarRect);</td></tr>
|
---|
914 | <tr><td class="num" id="LN800">800</td><td class="line"> }</td></tr>
|
---|
915 | <tr><td class="num" id="LN801">801</td><td class="line"> <span class='keyword'>return</span> <span class='keyword'>true</span>;</td></tr>
|
---|
916 | <tr><td class="num" id="LN802">802</td><td class="line">}</td></tr>
|
---|
917 | <tr><td class="num" id="LN803">803</td><td class="line"> </td></tr>
|
---|
918 | <tr><td class="num" id="LN804">804</td><td class="line"> </td></tr>
|
---|
919 | <tr><td class="num" id="LN805">805</td><td class="line"><span class='keyword'>bool</span></td></tr>
|
---|
920 | <tr><td class="num" id="LN806">806</td><td class="line">TabDecorator::_MoveTab(int32 from, int32 to, <span class='keyword'>bool</span> isMoving,</td></tr>
|
---|
921 | <tr><td class="num" id="LN807">807</td><td class="line"> BRegion* updateRegion)</td></tr>
|
---|
922 | <tr><td class="num" id="LN808">808</td><td class="line">{</td></tr>
|
---|
923 | <tr><td class="num" id="LN809">809</td><td class="line"> Decorator::Tab* toTab = _TabAt(to);</td></tr>
|
---|
924 | <tr><td class="num" id="LN810">810</td><td class="line"> <span class='keyword'>if</span> (toTab == <span class='macro'>NULL<span class='expansion'>__null</span></span>)</td></tr>
|
---|
925 | <tr><td class="num" id="LN811">811</td><td class="line"> <span class='keyword'>return</span> <span class='keyword'>false</span>;</td></tr>
|
---|
926 | <tr><td class="num" id="LN812">812</td><td class="line"> </td></tr>
|
---|
927 | <tr><td class="num" id="LN813">813</td><td class="line"> <span class='keyword'>if</span> (from < to) {</td></tr>
|
---|
928 | <tr><td class="num" id="LN814">814</td><td class="line"> fOldMovingTab.OffsetBy(toTab->tabRect.Width(), 0);</td></tr>
|
---|
929 | <tr><td class="num" id="LN815">815</td><td class="line"> toTab->tabRect.OffsetBy(-fOldMovingTab.Width(), 0);</td></tr>
|
---|
930 | <tr><td class="num" id="LN816">816</td><td class="line"> } <span class='keyword'>else</span> {</td></tr>
|
---|
931 | <tr><td class="num" id="LN817">817</td><td class="line"> fOldMovingTab.OffsetBy(-toTab->tabRect.Width(), 0);</td></tr>
|
---|
932 | <tr><td class="num" id="LN818">818</td><td class="line"> toTab->tabRect.OffsetBy(fOldMovingTab.Width(), 0);</td></tr>
|
---|
933 | <tr><td class="num" id="LN819">819</td><td class="line"> }</td></tr>
|
---|
934 | <tr><td class="num" id="LN820">820</td><td class="line"> </td></tr>
|
---|
935 | <tr><td class="num" id="LN821">821</td><td class="line"> toTab->tabOffset = uint32(toTab->tabRect.left - fLeftBorder.left);</td></tr>
|
---|
936 | <tr><td class="num" id="LN822">822</td><td class="line"> _LayoutTabItems(toTab, toTab->tabRect);</td></tr>
|
---|
937 | <tr><td class="num" id="LN823">823</td><td class="line"> </td></tr>
|
---|
938 | <tr><td class="num" id="LN824">824</td><td class="line"> _CalculateTabsRegion();</td></tr>
|
---|
939 | <tr><td class="num" id="LN825">825</td><td class="line"> </td></tr>
|
---|
940 | <tr><td class="num" id="LN826">826</td><td class="line"> <span class='keyword'>if</span> (updateRegion != <span class='macro'>NULL<span class='expansion'>__null</span></span>)</td></tr>
|
---|
941 | <tr><td class="num" id="LN827">827</td><td class="line"> updateRegion->Include(fTitleBarRect);</td></tr>
|
---|
942 | <tr><td class="num" id="LN828">828</td><td class="line"> <span class='keyword'>return</span> <span class='keyword'>true</span>;</td></tr>
|
---|
943 | <tr><td class="num" id="LN829">829</td><td class="line">}</td></tr>
|
---|
944 | <tr><td class="num" id="LN830">830</td><td class="line"> </td></tr>
|
---|
945 | <tr><td class="num" id="LN831">831</td><td class="line"> </td></tr>
|
---|
946 | <tr><td class="num" id="LN832">832</td><td class="line"><span class='keyword'>void</span></td></tr>
|
---|
947 | <tr><td class="num" id="LN833">833</td><td class="line">TabDecorator::_GetFootprint(BRegion *region)</td></tr>
|
---|
948 | <tr><td class="num" id="LN834">834</td><td class="line">{</td></tr>
|
---|
949 | <tr><td class="num" id="LN835">835</td><td class="line"> <span class='macro'>STRACE((<span class='string_literal'>"TabDecorator: GetFootprint\n"</span>))<span class='expansion'>;</span></span>;</td></tr>
|
---|
950 | <tr><td class="num" id="LN836">836</td><td class="line"> </td></tr>
|
---|
951 | <tr><td class="num" id="LN837">837</td><td class="line"> <span class='comment'>// This function calculates the decorator's footprint in coordinates</span></td></tr>
|
---|
952 | <tr><td class="num" id="LN838">838</td><td class="line"> <span class='comment'>// relative to the view. This is most often used to set a Window</span></td></tr>
|
---|
953 | <tr><td class="num" id="LN839">839</td><td class="line"> <span class='comment'>// object's visible region.</span></td></tr>
|
---|
954 | <tr><td class="num" id="LN840">840</td><td class="line"> <span class='keyword'>if</span> (region == <span class='macro'>NULL<span class='expansion'>__null</span></span>)</td></tr>
|
---|
955 | <tr><td class="num" id="LN841">841</td><td class="line"> <span class='keyword'>return</span>;</td></tr>
|
---|
956 | <tr><td class="num" id="LN842">842</td><td class="line"> </td></tr>
|
---|
957 | <tr><td class="num" id="LN843">843</td><td class="line"> region->MakeEmpty();</td></tr>
|
---|
958 | <tr><td class="num" id="LN844">844</td><td class="line"> </td></tr>
|
---|
959 | <tr><td class="num" id="LN845">845</td><td class="line"> <span class='keyword'>if</span> (fTopTab->look == B_NO_BORDER_WINDOW_LOOK)</td></tr>
|
---|
960 | <tr><td class="num" id="LN846">846</td><td class="line"> <span class='keyword'>return</span>;</td></tr>
|
---|
961 | <tr><td class="num" id="LN847">847</td><td class="line"> </td></tr>
|
---|
962 | <tr><td class="num" id="LN848">848</td><td class="line"> region->Include(fTopBorder);</td></tr>
|
---|
963 | <tr><td class="num" id="LN849">849</td><td class="line"> region->Include(fLeftBorder);</td></tr>
|
---|
964 | <tr><td class="num" id="LN850">850</td><td class="line"> region->Include(fRightBorder);</td></tr>
|
---|
965 | <tr><td class="num" id="LN851">851</td><td class="line"> region->Include(fBottomBorder);</td></tr>
|
---|
966 | <tr><td class="num" id="LN852">852</td><td class="line"> </td></tr>
|
---|
967 | <tr><td class="num" id="LN853">853</td><td class="line"> <span class='keyword'>if</span> (fTopTab->look == B_BORDERED_WINDOW_LOOK)</td></tr>
|
---|
968 | <tr><td class="num" id="LN854">854</td><td class="line"> <span class='keyword'>return</span>;</td></tr>
|
---|
969 | <tr><td class="num" id="LN855">855</td><td class="line"> </td></tr>
|
---|
970 | <tr><td class="num" id="LN856">856</td><td class="line"> region->Include(&fTabsRegion);</td></tr>
|
---|
971 | <tr><td class="num" id="LN857">857</td><td class="line"> </td></tr>
|
---|
972 | <tr><td class="num" id="LN858">858</td><td class="line"> <span class='keyword'>if</span> (fTopTab->look == B_DOCUMENT_WINDOW_LOOK) {</td></tr>
|
---|
973 | <tr><td class="num" id="LN859">859</td><td class="line"> <span class='comment'>// include the rectangular resize knob on the bottom right</span></td></tr>
|
---|
974 | <tr><td class="num" id="LN860">860</td><td class="line"> <span class='keyword'>float</span> knobSize = kResizeKnobSize - fBorderWidth;</td></tr>
|
---|
975 | <tr><td class="num" id="LN861">861</td><td class="line"> region->Include(BRect(fFrame.right - knobSize, fFrame.bottom - knobSize,</td></tr>
|
---|
976 | <tr><td class="num" id="LN862">862</td><td class="line"> fFrame.right, fFrame.bottom));</td></tr>
|
---|
977 | <tr><td class="num" id="LN863">863</td><td class="line"> }</td></tr>
|
---|
978 | <tr><td class="num" id="LN864">864</td><td class="line">}</td></tr>
|
---|
979 | <tr><td class="num" id="LN865">865</td><td class="line"> </td></tr>
|
---|
980 | <tr><td class="num" id="LN866">866</td><td class="line"> </td></tr>
|
---|
981 | <tr><td class="num" id="LN867">867</td><td class="line"><span class='keyword'>void</span></td></tr>
|
---|
982 | <tr><td class="num" id="LN868">868</td><td class="line">TabDecorator::_DrawButtons(Decorator::Tab* tab, <span class='keyword'>const</span> BRect& invalid)</td></tr>
|
---|
983 | <tr><td class="num" id="LN869">869</td><td class="line">{</td></tr>
|
---|
984 | <tr><td class="num" id="LN870">870</td><td class="line"> <span class='macro'>STRACE((<span class='string_literal'>"TabDecorator: _DrawButtons\n"</span>))<span class='expansion'>;</span></span>;</td></tr>
|
---|
985 | <tr><td class="num" id="LN871">871</td><td class="line"> </td></tr>
|
---|
986 | <tr><td class="num" id="LN872">872</td><td class="line"> <span class='comment'>// Draw the buttons if we're supposed to</span></td></tr>
|
---|
987 | <tr><td class="num" id="LN873">873</td><td class="line"> <span class='keyword'>if</span> (!(tab->flags & B_NOT_CLOSABLE) && invalid.Intersects(tab->closeRect))</td></tr>
|
---|
988 | <tr><td class="num" id="LN874">874</td><td class="line"> _DrawClose(tab, <span class='keyword'>false</span>, tab->closeRect);</td></tr>
|
---|
989 | <tr><td class="num" id="LN875">875</td><td class="line"> <span class='keyword'>if</span> (!(tab->flags & B_NOT_ZOOMABLE) && invalid.Intersects(tab->zoomRect))</td></tr>
|
---|
990 | <tr><td class="num" id="LN876">876</td><td class="line"> _DrawZoom(tab, <span class='keyword'>false</span>, tab->zoomRect);</td></tr>
|
---|
991 | <tr><td class="num" id="LN877">877</td><td class="line">}</td></tr>
|
---|
992 | <tr><td class="num" id="LN878">878</td><td class="line"> </td></tr>
|
---|
993 | <tr><td class="num" id="LN879">879</td><td class="line"> </td></tr>
|
---|
994 | <tr><td class="num" id="LN880">880</td><td class="line"><span class='keyword'>void</span></td></tr>
|
---|
995 | <tr><td class="num" id="LN881">881</td><td class="line">TabDecorator::_UpdateFont(DesktopSettings& settings)</td></tr>
|
---|
996 | <tr><td class="num" id="LN882">882</td><td class="line">{</td></tr>
|
---|
997 | <tr><td class="num" id="LN883">883</td><td class="line"> ServerFont font;</td></tr>
|
---|
998 | <tr><td class="num" id="LN884">884</td><td class="line"> <span class='keyword'>if</span> (fTopTab->look == B_FLOATING_WINDOW_LOOK</td></tr>
|
---|
999 | <tr><td class="num" id="LN885">885</td><td class="line"> || fTopTab->look == kLeftTitledWindowLook) {</td></tr>
|
---|
1000 | <tr><td class="num" id="LN886">886</td><td class="line"> settings.GetDefaultPlainFont(font);</td></tr>
|
---|
1001 | <tr><td class="num" id="LN887">887</td><td class="line"> <span class='keyword'>if</span> (fTopTab->look == kLeftTitledWindowLook)</td></tr>
|
---|
1002 | <tr><td class="num" id="LN888">888</td><td class="line"> font.SetRotation(90.0f);</td></tr>
|
---|
1003 | <tr><td class="num" id="LN889">889</td><td class="line"> } <span class='keyword'>else</span></td></tr>
|
---|
1004 | <tr><td class="num" id="LN890">890</td><td class="line"> settings.GetDefaultBoldFont(font);</td></tr>
|
---|
1005 | <tr><td class="num" id="LN891">891</td><td class="line"> </td></tr>
|
---|
1006 | <tr><td class="num" id="LN892">892</td><td class="line"> font.SetFlags(B_FORCE_ANTIALIASING);</td></tr>
|
---|
1007 | <tr><td class="num" id="LN893">893</td><td class="line"> font.SetSpacing(B_STRING_SPACING);</td></tr>
|
---|
1008 | <tr><td class="num" id="LN894">894</td><td class="line"> fDrawState.SetFont(font);</td></tr>
|
---|
1009 | <tr><td class="num" id="LN895">895</td><td class="line">}</td></tr>
|
---|
1010 | <tr><td class="num" id="LN896">896</td><td class="line"> </td></tr>
|
---|
1011 | <tr><td class="num" id="LN897">897</td><td class="line"> </td></tr>
|
---|
1012 | <tr><td class="num" id="LN898">898</td><td class="line"><span class='keyword'>void</span></td></tr>
|
---|
1013 | <tr><td class="num" id="LN899">899</td><td class="line">TabDecorator::_GetButtonSizeAndOffset(<span class='keyword'>const</span> BRect& tabRect, <span class='keyword'>float</span>* _offset,</td></tr>
|
---|
1014 | <tr><td class="num" id="LN900">900</td><td class="line"> <span class='keyword'>float</span>* _size, <span class='keyword'>float</span>* _inset) <span class='keyword'>const</span></td></tr>
|
---|
1015 | <tr><td class="num" id="LN901">901</td><td class="line">{</td></tr>
|
---|
1016 | <tr><td class="num" id="LN902">902</td><td class="line"> <span class='keyword'>float</span> tabSize = fTopTab->look == kLeftTitledWindowLook ?</td></tr>
|
---|
1017 | <tr><td class="num" id="LN903">903</td><td class="line"> tabRect.Width() : tabRect.Height();</td></tr>
|
---|
1018 | <tr><td class="num" id="LN904">904</td><td class="line"> </td></tr>
|
---|
1019 | <tr><td class="num" id="LN905">905</td><td class="line"> <span class='keyword'>bool</span> smallTab = fTopTab->look == B_FLOATING_WINDOW_LOOK</td></tr>
|
---|
1020 | <tr><td class="num" id="LN906">906</td><td class="line"> || fTopTab->look == kLeftTitledWindowLook;</td></tr>
|
---|
1021 | <tr><td class="num" id="LN907">907</td><td class="line"> </td></tr>
|
---|
1022 | <tr><td class="num" id="LN908">908</td><td class="line"> *_offset = smallTab ? floorf(fDrawState.Font().Size() / 2.6)</td></tr>
|
---|
1023 | <tr><td class="num" id="LN909">909</td><td class="line"> : floorf(fDrawState.Font().Size() / 2.3);</td></tr>
|
---|
1024 | <tr><td class="num" id="LN910">910</td><td class="line"> *_inset = smallTab ? floorf(fDrawState.Font().Size() / 5.0)</td></tr>
|
---|
1025 | <tr><td class="num" id="LN911">911</td><td class="line"> : floorf(fDrawState.Font().Size() / 6.0);</td></tr>
|
---|
1026 | <tr><td class="num" id="LN912">912</td><td class="line"> </td></tr>
|
---|
1027 | <tr><td class="num" id="LN913">913</td><td class="line"> <span class='comment'>// "+ 2" so that the rects are centered within the solid area</span></td></tr>
|
---|
1028 | <tr><td class="num" id="LN914">914</td><td class="line"> <span class='comment'>// (without the 2 pixels for the top border)</span></td></tr>
|
---|
1029 | <tr><td class="num" id="LN915">915</td><td class="line"> *_size = tabSize - 2 * *_offset + *_inset;</td></tr>
|
---|
1030 | <tr><td class="num" id="LN916">916</td><td class="line">}</td></tr>
|
---|
1031 | <tr><td class="num" id="LN917">917</td><td class="line"> </td></tr>
|
---|
1032 | <tr><td class="num" id="LN918">918</td><td class="line"> </td></tr>
|
---|
1033 | <tr><td class="num" id="LN919">919</td><td class="line"><span class='keyword'>void</span></td></tr>
|
---|
1034 | <tr><td class="num" id="LN920">920</td><td class="line">TabDecorator::_LayoutTabItems(Decorator::Tab* _tab, <span class='keyword'>const</span> BRect& tabRect)</td></tr>
|
---|
1035 | <tr><td class="num" id="LN921">921</td><td class="line">{</td></tr>
|
---|
1036 | <tr><td class="num" id="LN922">922</td><td class="line"> Decorator::Tab* tab = <span class='keyword'>static_cast</span><Decorator::Tab*>(_tab);</td></tr>
|
---|
1037 | <tr><td class="num" id="LN923">923</td><td class="line"> </td></tr>
|
---|
1038 | <tr><td class="num" id="LN924">924</td><td class="line"> <span class='keyword'>float</span> offset;</td></tr>
|
---|
1039 | <tr><td class="num" id="LN925">925</td><td class="line"> <span class='keyword'>float</span> size;</td></tr>
|
---|
1040 | <tr><td class="num" id="LN926">926</td><td class="line"> <span class='keyword'>float</span> inset;</td></tr>
|
---|
1041 | <tr><td class="num" id="LN927">927</td><td class="line"> _GetButtonSizeAndOffset(tabRect, &offset, &size, &inset);</td></tr>
|
---|
1042 | <tr><td class="num" id="LN928">928</td><td class="line"> </td></tr>
|
---|
1043 | <tr><td class="num" id="LN929">929</td><td class="line"> <span class='comment'>// default textOffset</span></td></tr>
|
---|
1044 | <tr><td class="num" id="LN930">930</td><td class="line"> tab->textOffset = _DefaultTextOffset();</td></tr>
|
---|
1045 | <tr><td class="num" id="LN931">931</td><td class="line"> </td></tr>
|
---|
1046 | <tr><td class="num" id="LN932">932</td><td class="line"> BRect& closeRect = tab->closeRect;</td></tr>
|
---|
1047 | <tr><td class="num" id="LN933">933</td><td class="line"> BRect& zoomRect = tab->zoomRect;</td></tr>
|
---|
1048 | <tr><td class="num" id="LN934">934</td><td class="line"> </td></tr>
|
---|
1049 | <tr><td class="num" id="LN935">935</td><td class="line"> <span class='comment'>// calulate close rect based on the tab rectangle</span></td></tr>
|
---|
1050 | <tr><td class="num" id="LN936">936</td><td class="line"> <span class='keyword'>if</span> (tab->look != kLeftTitledWindowLook) {</td></tr>
|
---|
1051 | <tr><td class="num" id="LN937">937</td><td class="line"> closeRect.Set(tabRect.left + offset, tabRect.top + offset,</td></tr>
|
---|
1052 | <tr><td class="num" id="LN938">938</td><td class="line"> tabRect.left + offset + size, tabRect.top + offset + size);</td></tr>
|
---|
1053 | <tr><td class="num" id="LN939">939</td><td class="line"> </td></tr>
|
---|
1054 | <tr><td class="num" id="LN940">940</td><td class="line"> zoomRect.Set(tabRect.right - offset - size, tabRect.top + offset,</td></tr>
|
---|
1055 | <tr><td class="num" id="LN941">941</td><td class="line"> tabRect.right - offset, tabRect.top + offset + size);</td></tr>
|
---|
1056 | <tr><td class="num" id="LN942">942</td><td class="line"> </td></tr>
|
---|
1057 | <tr><td class="num" id="LN943">943</td><td class="line"> <span class='comment'>// hidden buttons have no width</span></td></tr>
|
---|
1058 | <tr><td class="num" id="LN944">944</td><td class="line"> <span class='keyword'>if</span> ((tab->flags & B_NOT_CLOSABLE) != 0)</td></tr>
|
---|
1059 | <tr><td class="num" id="LN945">945</td><td class="line"> closeRect.right = closeRect.left - offset;</td></tr>
|
---|
1060 | <tr><td class="num" id="LN946">946</td><td class="line"> <span class='keyword'>if</span> ((tab->flags & B_NOT_ZOOMABLE) != 0)</td></tr>
|
---|
1061 | <tr><td class="num" id="LN947">947</td><td class="line"> zoomRect.left = zoomRect.right + offset;</td></tr>
|
---|
1062 | <tr><td class="num" id="LN948">948</td><td class="line"> } <span class='keyword'>else</span> {</td></tr>
|
---|
1063 | <tr><td class="num" id="LN949">949</td><td class="line"> closeRect.Set(tabRect.left + offset, tabRect.top + offset,</td></tr>
|
---|
1064 | <tr><td class="num" id="LN950">950</td><td class="line"> tabRect.left + offset + size, tabRect.top + offset + size);</td></tr>
|
---|
1065 | <tr><td class="num" id="LN951">951</td><td class="line"> </td></tr>
|
---|
1066 | <tr><td class="num" id="LN952">952</td><td class="line"> zoomRect.Set(tabRect.left + offset, tabRect.bottom - offset - size,</td></tr>
|
---|
1067 | <tr><td class="num" id="LN953">953</td><td class="line"> tabRect.left + size + offset, tabRect.bottom - offset);</td></tr>
|
---|
1068 | <tr><td class="num" id="LN954">954</td><td class="line"> </td></tr>
|
---|
1069 | <tr><td class="num" id="LN955">955</td><td class="line"> <span class='comment'>// hidden buttons have no height</span></td></tr>
|
---|
1070 | <tr><td class="num" id="LN956">956</td><td class="line"> <span class='keyword'>if</span> ((tab->flags & B_NOT_CLOSABLE) != 0)</td></tr>
|
---|
1071 | <tr><td class="num" id="LN957">957</td><td class="line"> closeRect.bottom = closeRect.top - offset;</td></tr>
|
---|
1072 | <tr><td class="num" id="LN958">958</td><td class="line"> <span class='keyword'>if</span> ((tab->flags & B_NOT_ZOOMABLE) != 0)</td></tr>
|
---|
1073 | <tr><td class="num" id="LN959">959</td><td class="line"> zoomRect.top = zoomRect.bottom + offset;</td></tr>
|
---|
1074 | <tr><td class="num" id="LN960">960</td><td class="line"> }</td></tr>
|
---|
1075 | <tr><td class="num" id="LN961">961</td><td class="line"> </td></tr>
|
---|
1076 | <tr><td class="num" id="LN962">962</td><td class="line"> <span class='comment'>// calculate room for title</span></td></tr>
|
---|
1077 | <tr><td class="num" id="LN963">963</td><td class="line"> <span class='comment'>// TODO: the +2 is there because the title often appeared</span></td></tr>
|
---|
1078 | <tr><td class="num" id="LN964">964</td><td class="line"> <span class='comment'>// truncated for no apparent reason - OTOH the title does</span></td></tr>
|
---|
1079 | <tr><td class="num" id="LN965">965</td><td class="line"> <span class='comment'>// also not appear perfectly in the middle</span></td></tr>
|
---|
1080 | <tr><td class="num" id="LN966">966</td><td class="line"> <span class='keyword'>if</span> (tab->look != kLeftTitledWindowLook)</td></tr>
|
---|
1081 | <tr><td class="num" id="LN967">967</td><td class="line"> size = (zoomRect.left - closeRect.right) - tab->textOffset * 2 + inset;</td></tr>
|
---|
1082 | <tr><td class="num" id="LN968">968</td><td class="line"> <span class='keyword'>else</span></td></tr>
|
---|
1083 | <tr><td class="num" id="LN969">969</td><td class="line"> size = (zoomRect.top - closeRect.bottom) - tab->textOffset * 2 + inset;</td></tr>
|
---|
1084 | <tr><td class="num" id="LN970">970</td><td class="line"> </td></tr>
|
---|
1085 | <tr><td class="num" id="LN971">971</td><td class="line"> <span class='keyword'>bool</span> stackMode = fTabList.CountItems() > 1;</td></tr>
|
---|
1086 | <tr><td class="num" id="LN972">972</td><td class="line"> <span class='keyword'>if</span> (stackMode && IsFocus(tab) == <span class='keyword'>false</span>) {</td></tr>
|
---|
1087 | <tr><td class="num" id="LN973">973</td><td class="line"> zoomRect.Set(0, 0, 0, 0);</td></tr>
|
---|
1088 | <tr><td class="num" id="LN974">974</td><td class="line"> size = (tab->tabRect.right - closeRect.right) - tab->textOffset * 2</td></tr>
|
---|
1089 | <tr><td class="num" id="LN975">975</td><td class="line"> + inset;</td></tr>
|
---|
1090 | <tr><td class="num" id="LN976">976</td><td class="line"> }</td></tr>
|
---|
1091 | <tr><td class="num" id="LN977">977</td><td class="line"> uint8 truncateMode = B_TRUNCATE_MIDDLE;</td></tr>
|
---|
1092 | <tr><td class="num" id="LN978">978</td><td class="line"> <span class='keyword'>if</span> (stackMode) {</td></tr>
|
---|
1093 | <tr><td class="num" id="LN979">979</td><td class="line"> <span class='keyword'>if</span> (tab->tabRect.Width() < 100)</td></tr>
|
---|
1094 | <tr><td class="num" id="LN980">980</td><td class="line"> truncateMode = B_TRUNCATE_END;</td></tr>
|
---|
1095 | <tr><td class="num" id="LN981">981</td><td class="line"> <span class='keyword'>float</span> titleWidth = fDrawState.Font().StringWidth(Title(tab),</td></tr>
|
---|
1096 | <tr><td class="num" id="LN982">982</td><td class="line"> BString(Title(tab)).Length());</td></tr>
|
---|
1097 | <tr><td class="num" id="LN983">983</td><td class="line"> <span class='keyword'>if</span> (size < titleWidth) {</td></tr>
|
---|
1098 | <tr><td class="num" id="LN984">984</td><td class="line"> <span class='keyword'>float</span> oldTextOffset = tab->textOffset;</td></tr>
|
---|
1099 | <tr><td class="num" id="LN985">985</td><td class="line"> tab->textOffset -= (titleWidth - size) / 2;</td></tr>
|
---|
1100 | <tr><td class="num" id="LN986">986</td><td class="line"> <span class='keyword'>const</span> <span class='keyword'>float</span> kMinTextOffset = 5.;</td></tr>
|
---|
1101 | <tr><td class="num" id="LN987">987</td><td class="line"> <span class='keyword'>if</span> (tab->textOffset < kMinTextOffset)</td></tr>
|
---|
1102 | <tr><td class="num" id="LN988">988</td><td class="line"> tab->textOffset = kMinTextOffset;</td></tr>
|
---|
1103 | <tr><td class="num" id="LN989">989</td><td class="line"> size += oldTextOffset * 2;</td></tr>
|
---|
1104 | <tr><td class="num" id="LN990">990</td><td class="line"> size -= tab->textOffset * 2;</td></tr>
|
---|
1105 | <tr><td class="num" id="LN991">991</td><td class="line"> }</td></tr>
|
---|
1106 | <tr><td class="num" id="LN992">992</td><td class="line"> }</td></tr>
|
---|
1107 | <tr><td class="num" id="LN993">993</td><td class="line"> tab->truncatedTitle = Title(tab);</td></tr>
|
---|
1108 | <tr><td class="num" id="LN994">994</td><td class="line"> fDrawState.Font().TruncateString(&tab->truncatedTitle, truncateMode, size);</td></tr>
|
---|
1109 | <tr><td class="num" id="LN995">995</td><td class="line"> tab->truncatedTitleLength = tab->truncatedTitle.Length();</td></tr>
|
---|
1110 | <tr><td class="num" id="LN996">996</td><td class="line">}</td></tr>
|
---|
1111 | <tr><td class="num" id="LN997">997</td><td class="line"> </td></tr>
|
---|
1112 | <tr><td class="num" id="LN998">998</td><td class="line"> </td></tr>
|
---|
1113 | <tr><td class="num" id="LN999">999</td><td class="line"><span class='keyword'>float</span></td></tr>
|
---|
1114 | <tr><td class="num" id="LN1000">1000</td><td class="line">TabDecorator::_DefaultTextOffset() <span class='keyword'>const</span></td></tr>
|
---|
1115 | <tr><td class="num" id="LN1001">1001</td><td class="line">{</td></tr>
|
---|
1116 | <tr><td class="num" id="LN1002">1002</td><td class="line"> <span class='keyword'>return</span> (fTopTab->look == B_FLOATING_WINDOW_LOOK</td></tr>
|
---|
1117 | <tr><td class="num" id="LN1003">1003</td><td class="line"> || fTopTab->look == kLeftTitledWindowLook) ? 10 : 18;</td></tr>
|
---|
1118 | <tr><td class="num" id="LN1004">1004</td><td class="line">}</td></tr>
|
---|
1119 | <tr><td class="num" id="LN1005">1005</td><td class="line"> </td></tr>
|
---|
1120 | <tr><td class="num" id="LN1006">1006</td><td class="line"> </td></tr>
|
---|
1121 | <tr><td class="num" id="LN1007">1007</td><td class="line"><span class='keyword'>float</span></td></tr>
|
---|
1122 | <tr><td class="num" id="LN1008">1008</td><td class="line">TabDecorator::_SingleTabOffsetAndSize(<span class='keyword'>float</span>& tabSize)</td></tr>
|
---|
1123 | <tr><td class="num" id="LN1009">1009</td><td class="line">{</td></tr>
|
---|
1124 | <tr><td class="num" id="LN1010">1010</td><td class="line"> <span class='keyword'>float</span> maxLocation;</td></tr>
|
---|
1125 | <tr><td class="num" id="LN1011">1011</td><td class="line"> <span class='keyword'>if</span> (fTopTab->look != kLeftTitledWindowLook) {</td></tr>
|
---|
1126 | <tr><td class="num" id="LN1012">1012</td><td class="line"> tabSize = fRightBorder.right - fLeftBorder.left;</td></tr>
|
---|
1127 | <tr><td class="num" id="LN1013">1013</td><td class="line"> } <span class='keyword'>else</span> {</td></tr>
|
---|
1128 | <tr><td class="num" id="LN1014">1014</td><td class="line"> tabSize = fBottomBorder.bottom - fTopBorder.top;</td></tr>
|
---|
1129 | <tr><td class="num" id="LN1015">1015</td><td class="line"> }</td></tr>
|
---|
1130 | <tr><td class="num" id="LN1016">1016</td><td class="line"> Decorator::Tab* tab = _TabAt(0);</td></tr>
|
---|
1131 | <tr><td class="num" id="LN1017">1017</td><td class="line"> maxLocation = tabSize - tab->maxTabSize;</td></tr>
|
---|
1132 | <tr><td class="num" id="LN1018">1018</td><td class="line"> <span class='keyword'>if</span> (maxLocation < 0)</td></tr>
|
---|
1133 | <tr><td class="num" id="LN1019">1019</td><td class="line"> maxLocation = 0;</td></tr>
|
---|
1134 | <tr><td class="num" id="LN1020">1020</td><td class="line"> </td></tr>
|
---|
1135 | <tr><td class="num" id="LN1021">1021</td><td class="line"> <span class='keyword'>return</span> floorf(tab->tabLocation * maxLocation);</td></tr>
|
---|
1136 | <tr><td class="num" id="LN1022">1022</td><td class="line">}</td></tr>
|
---|
1137 | <tr><td class="num" id="LN1023">1023</td><td class="line"> </td></tr>
|
---|
1138 | <tr><td class="num" id="LN1024">1024</td><td class="line"> </td></tr>
|
---|
1139 | <tr><td class="num" id="LN1025">1025</td><td class="line"><span class='keyword'>void</span></td></tr>
|
---|
1140 | <tr><td class="num" id="LN1026">1026</td><td class="line">TabDecorator::_CalculateTabsRegion()</td></tr>
|
---|
1141 | <tr><td class="num" id="LN1027">1027</td><td class="line">{</td></tr>
|
---|
1142 | <tr><td class="num" id="LN1028">1028</td><td class="line"> fTabsRegion.MakeEmpty();</td></tr>
|
---|
1143 | <tr><td class="num" id="LN1029">1029</td><td class="line"> <span class='keyword'>for</span> (int32 i = 0; i < fTabList.CountItems(); i++)</td></tr>
|
---|
1144 | <tr><td class="num" id="LN1030">1030</td><td class="line"> fTabsRegion.Include(fTabList.ItemAt(i)->tabRect);</td></tr>
|
---|
1145 | <tr><td class="num" id="LN1031">1031</td><td class="line">}</td></tr>
|
---|
1146 | </table></body></html>
|
---|