Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 4c964c9

Browse files
BerndNlivecodeali
authored andcommitted
[Bug 20701] Make manual height in PI consistent (#2003)
* [Bug 20701] Make manual height in PI consistent Makes setting the height in PI consistent. PI will either use manual height or max height of tab if smaller than manual height. custom properties now have a field "value" that is larger and increases with increaing the height of PI. Furthermore it fixes the delay when vScrollbar is on or off for accomodating for vScrollbar regarding right side of controls.
1 parent 46e67e1 commit 4c964c9

File tree

5 files changed

+85
-14
lines changed

5 files changed

+85
-14
lines changed

Toolset/palettes/behaviors/revinspectorbehavior.livecodescript

Lines changed: 53 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,19 @@ private function inspectorCalculateLayout pGroupList, pLeft, pTop, pRowWidth, pS
176176
return tInspectorHeight
177177
end inspectorCalculateLayout
178178

179-
local sManualHeight
179+
local sManualHeightOfStack, sNewHeight, sOldHeight
180180
on inspectorLayoutGroups pGroupList, pForceHeight
181+
182+
# store height of stack when manually resizing
183+
if pForceHeight is not true and the mouse is "down" and sNewHeight is not sOldHeight then
184+
put the height of this stack into sManualHeightOfStack
185+
end if
186+
187+
# reset sManualHeightOfStack to empty if inspector was closed
188+
if not the visible of me then
189+
put empty into sManualHeightOfStack
190+
end if
191+
181192
lock screen
182193
# Get the margin, padding
183194
local tMargin, tPadding
@@ -277,33 +288,66 @@ on inspectorLayoutGroups pGroupList, pForceHeight
277288
set the maxheight of me to tStackHeight
278289
end if
279290

280-
if pForceHeight and not sManualHeight then
281-
-- Make stack smaller rather than go offscreen
282-
local tScreenRect
283-
put revIDEStackScreenRect(the long id of me, true) into tScreenRect
284-
set the height of me to min(tStackHeight, item 4 of tScreenRect - tStackTop)
291+
# reset manualHeight if user expands a non-expandable tab to full height
292+
if not pForceHeight and not tCanExpand and sManualHeightOfStack is tStackHeight then
293+
put empty into sManualHeightOfStack
294+
end if
295+
296+
-- Make stack smaller rather than go offscreen
297+
local tScreenRect, tNewStackHeight
298+
put revIDEStackScreenRect(the long id of me, true) into tScreenRect
299+
300+
if sManualHeightOfStack is not empty then
301+
put min(sManualHeightOfStack, tStackHeight) into tNewStackHeight
302+
set the height of this stack to min(tNewStackHeight, item 4 of tScreenRect - tStackTop)
303+
else
304+
set the height of this stack to min(tStackHeight, item 4 of tScreenRect - tStackTop)
285305
end if
286306
set the left of me to tStackLeft
287307
set the top of me to tStackTop
288308

309+
local tvScrollIsOn, tvScrollChanged
310+
put false into tvScrollChanged
311+
289312
if there is a group "inspector" of me then
290-
if the height of me < tStackHeight then
291-
put true into sManualHeight
313+
put the vScrollbar of group "inspector" of me into tvScrollIsOn
314+
if the height of me < tStackHeight - tMargin then
292315
set the vscrollbar of group "inspector" of me to true
316+
if not tvScrollIsOn then
317+
put true into tvScrollChanged
318+
end if
293319
else
294-
put false into sManualHeight
295320
set the vscrollbar of group "inspector" of me to false
321+
if tvScrollIsOn then
322+
put true into tvScrollChanged
323+
end if
296324
end if
325+
297326
set the rect of group "inspector" of me to \
298327
item 1 of tContentRect, \
299328
item 2 of tContentRect, \
300329
the right of this card of me, \
301330
the bottom of this card of me - tMargin
302331
end if
303332
unlock messages
333+
334+
# adapt right size of controls to vScrollbar on and off
335+
if tvScrollChanged then resizeInspector
336+
304337
unlock screen
305338
end inspectorLayoutGroups
306339

340+
before resizeStack pNewWidth, pNewHeight, pOldWidth, pOldHeight
341+
put pNewHeight into sNewHeight
342+
put pOldHeight into sOldHeight
343+
pass resizeStack
344+
end resizeStack
345+
346+
function getManualHeight
347+
return sManualHeightOfStack
348+
end getManualHeight
349+
350+
307351
local sSelectedSection, sSelectedSectionIndex
308352
private on inspectorSectionSet pSection
309353
if sDataA is empty then

Toolset/palettes/inspector/editors/com.livecode.pi.customprops.behavior.livecodescript

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
script "com.livecode.pi.customprops.behavior"
22
local sPropSet, sHilitePath
3+
constant kWidgetHeight = 150
34

45
on editorInitialize
56
put empty into sPropSet
@@ -112,8 +113,12 @@ on editorResize
112113
send "groupResize kLabelSize, kControlGap" to group "Set buttons" of me
113114

114115
# Use all space not taken by other elements for main array display
115-
local tWidgetHeight
116-
put the height of me - (4 * kControlGap + kLabelFieldHeight + kKeyFieldHeight + kValueFieldHeight + kSetButtonsHeight) into tWidgetHeight
116+
local tWidgetHeight, tValueHeight
117+
put kWidgetHeight into tWidgetHeight
118+
put max (the height of this card - ( 12 * kControlGap + kLabelFieldHeight \
119+
+ kKeyFieldHeight + kValueFieldHeight + kSetButtonsHeight \
120+
+ tWidgetHeight), kValueFieldHeight) into tValueHeight
121+
117122
set the height of widget 1 of me to tWidgetHeight
118123
set the width of widget 1 of me to the width of me
119124
set the left of widget 1 of me to the left of me
@@ -135,7 +140,7 @@ on editorResize
135140
set the left of field "value label" of me to the left of me
136141

137142
set the width of field "value" of me to the width of me - kLabelSize - kControlGap
138-
set the height of field "value" of me to kValueFieldHeight
143+
set the height of field "value" of me to kValueFieldHeight + tValueHeight
139144
set the top of field "value" of me to the bottom of field "key" of me + kControlGap
140145
set the left of field "value" of me to the right of field "value label" of me + kControlGap
141146

Toolset/palettes/inspector/editors/com.livecode.pi.stackfiles.behavior.livecodescript

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ on editorResize
4141
local tRect, tFieldRect
4242
put the rect of me into tRect
4343

44+
local tManualHeight, tManualGroupHeight
45+
put getManualHeight() into tManualHeight
46+
if tManualHeight is not empty then
47+
put tManualHeight - the height of group "background" - kControlGap - 2 into tManualGroupHeight
48+
set the height of me to tManualGroupHeight
49+
set the height of the owner of me to tManualGroupHeight
50+
end if
51+
4452
put tRect into tFieldRect
4553
put item 2 of tFieldRect + kButtonHeight + kColumnHeaderHeight + kControlGap into item 2 of tFieldRect
4654
set the effective rect of field "stackFilesField" of me to tFieldRect

Toolset/palettes/inspector/editors/com.livecode.pi.textcontents.behavior.livecodescript

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,28 @@ constant kMaxHeight = 800
4545
on editorResize
4646
lock screen
4747
lock messages
48+
local tManualHeight, tManualGroupHeight
49+
put getManualHeight() into tManualHeight
50+
if tManualHeight is not empty then
51+
put tManualHeight - the height of group "controls" of me - kControlGap - 1 - the height of group "background" into tManualGroupHeight
52+
set the height of me to tManualGroupHeight
53+
set the height of the owner of me to tManualGroupHeight
54+
end if
55+
4856
set the topleft of field "rowlabel" of me to the topleft of me
4957
set the topright of group "controls" of me to the topright of me
5058
local tRect
5159
put the effective rect of me into tRect
5260
put item 2 of tRect + the height of group "controls" of me + kControlGap into item 2 of tRect
5361

5462
local tHeight
55-
put the formattedHeight of field "htmltext" of me into tHeight
56-
put max(tHeight, item 4 of tRect - item 2 of tRect) into tHeight
63+
if tManualHeight is not empty then
64+
put tManualGroupHeight - kControlGap into tHeight
65+
else
66+
put the formattedHeight of field "htmltext" of me into tHeight
67+
put max(tHeight, item 4 of tRect - item 2 of tRect) into tHeight
68+
end if
69+
5770
put min(tHeight, kMaxHeight) into tHeight
5871
put item 2 of tRect + tHeight into item 4 of tRect
5972
set the rect of field "htmltext" of me to tRect

notes/bugfix-20701.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Make manual height of PI consitent, increase value field in Custom Props

0 commit comments

Comments
 (0)