Skip to content

Commit

Permalink
Begin work on Embedded toolbox chapter.
Browse files Browse the repository at this point in the history
  • Loading branch information
steve-fryatt committed Nov 6, 2022
1 parent a8f0089 commit dfb1c11
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Chapters/ch03-a-top-toolbar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ ENDPROC</code>
</section>


<section>
<section id="sect-top-bar-work-area">
<title>Missing work area</title>

<p>Although it works, there are a few rough edges with our new pane&rsquo;s implementation as it stands. The first should be obvious as soon as the main window opens: the toolbar slices the top of the work area off, and obscures part of the first row of squares.</p>
Expand Down
2 changes: 1 addition & 1 deletion Chapters/ch07-responsive-nesting.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ SYS &quot;Wimp_OpenWindow&quot;,,toolbar%, &amp;4B534154, !main%, &amp;09A90000<

<p>There&rsquo;s one nicety missing from this version of the toolbar, however. Back in <reference id="sect-top-bar-crop"/> we had arranged for the writeable icon to be cropped to fill the width of the toolbar, which gave a better visual appearance and ensured that the text was always visible. If we could implement that again, then it would make this Nested Wimp version complete.</p>

<p>Fortunately, it&rsquo;s a similar process with the Nested Wimp as it was when we were doing things manually &ndash; although there is one optimisation that we can make this time around. Last time, we checked for the presence of the <swi>Wimp_ResizeIcon</swi> SWI when the application initialised, and omitted the resizing on systems where it wasn&rsquo;t available. Since this time we know that we&rsquo;re using the Nested Wimp, because we test for it in the <file>!Run</file> file, we also <em>know</em> that the SWI we need will be present &ndash; and so we can use it without any further checks.</p>
<p>Fortunately, it&rsquo;s a similar process with the Nested Wimp as it was when we were doing things manually &ndash; although there is one optimisation that we can make this time around. Last time, we checked for the presence of the <swi>Wimp_ResizeIcon</swi> SWI when the application initialised, and omitted the resizing on systems where it wasn&rsquo;t available. Since this time we know that we&rsquo;re using the Nested Wimp, because we test for it in the <file>!Run</file> file, we also <em>know</em> that the SWI we need will be present &ndash; and so we can safely use it without any further checks.</p>

<p>The actual process of moving the icon as the toolbar grows and shrinks is very similar under the Nested Wimp to how it was when we were handling the panes manually. We simply look out for <name>Open_Window_Request</name> events for the toolbar, and adjust the icon once we know the new position of its parent window. To this end, we will start by reinstating a call to <function>PROCopen_window_request()</function> in our <swi>Wimp_Poll</swi> routine from <function>PROCpoll</function>.</p>

Expand Down
1 change: 1 addition & 0 deletions Chapters/ch08-moving-the-furniture.xml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ ENDPROC</code>

<download id="dl-move-furniture-bar" file="NestedFurniture" title="A fixed toolbar as a furniture window" compatibility="armv7"/>

<p>Whilst we&rsquo;ve now covered what the Nested Wimp can do for &lsquo;standard&rsquo; toolbars, there&rsquo;s a lot more on offer. In the <reference id="chap-embed-tool">next chapter</reference>, we will investigate how to embed our toolbar into the scroll bar of our window.</p>
</section>
</chapter>
</manual>
80 changes: 80 additions & 0 deletions Chapters/ch09-an-embedded-toolbox.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version='1.0' encoding='UTF-8' standalone='no'?>

<!DOCTYPE xmlmanual SYSTEM "../panes.dtd">

<!-- Copyright 2021-2022, Stephen Fryatt (info@stevefryatt.org.uk)
-
- This file is part of Pane Tutorial:
-
- http://www.stevefryatt.org.uk/software/
-
- Licensed under the EUPL, Version 1.2 only (the "Licence");
- You may not use this work except in compliance with the
- Licence.
-
- You may obtain a copy of the Licence at:
-
- http://joinup.ec.europa.eu/software/page/eupl
-
- Unless required by applicable law or agreed to in
- writing, software distributed under the Licence is
- distributed on an "AS IS" basis, WITHOUT WARRANTIES
- OR CONDITIONS OF ANY KIND, either express or implied.
-
- See the Licence for the specific language governing
- permissions and limitations under the Licence.
-->

<manual xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xmldoc.xsd" version="1.8.6">

<!-- Chapter 9
-
- An Embedded Toolbox
-->

<chapter id="chap-embed-tool">
<resources>
<images>Chapter09</images>
<downloads>Chapter09</downloads>
</resources>
<filename>an-embedded-toolbox.php</filename>
<uri>an-embedded-toolbox</uri>
<title>An Embedded Toolbox</title>

<summary>For a truly minimalist look, we can embed a toolbox into one of our window&rsquo;s scroll bars.</summary>

<section>
<p>Back in the late 1980s, when RISC&nbsp;OS was a new system, space on the screens of the day was limited and there was a trend for using minimalist toolboxes embedded into the space used by the scrollbars of a window. Of the numerous applications which used the technique, the original Ovation is still well-known &ndash; its take on the idea can be seen in <reference id="fig-embed-tool-ovation" />.</p>

<image id="fig-embed-tool-ovation" file="embed-tool-ovation.png" title="The original Ovation put its toolbar where its scroll bar should have been"/>

<p>Back then, Ovation&rsquo;s author achieved this effect using three windows all interleaved carefully. These days, the effect can be achieved more easily using the Nested Wimp, and in previous chapters we have already seen examples from Paint (<reference id="fig-nest-wimp-paint" />) and NetSurf (<reference id="fig-move-furniture-netsurf" />) in passing.</p>

<p>As with the full-width toolbar that we created in <reference id="chap-move-furniture" />, such toolboxes can be created using Furniture Windows. In this chapter, we will create ourselves a simple embedded toolbox in the bottom scroll bar of our window.</p>
</section>

<section>
<title>Updating the templates</title>

<p>Since we will be losing the toolbar at the top of our window, the first step to creating an embedded toolbox will be to reset our main window template back to the one that we created in <reference id="chap-example-app"/>: this will undo the changes to the work area that we made in <reference id="sect-top-bar-work-area" />. We will also delete the existing Toolbar template, leaving us with just the Main and ProgInfo window definitions as seen in <reference id="fig-embed-tool-clean-templates" />.</p>

<image id="fig-embed-tool-clean-templates" file="embed-tool-clean-templates.png" title="The clean set of templates from the original demo application"/>

<p>The next step is to create ourselves a new window for the embedded toolbox. We&rsquo;ll call this &ldquo;Embedded&rdquo;, and it can be seen being edited by <cite>WinEd</cite> in <reference id="fig-embed-tool-template" />. Since we will be sizing and positioning it to fit into the scroll bar of our main window, there is no point adjusting its dimensions for now. The title has been set to &ldquo;Toolbox&rdquo;, but it doesn&rsquo;t matter as it won&rsquo;t be seen.</p>

<image id="fig-embed-tool-template" file="embed-tool-template.png" title="The new window template for the embedded toolbox"/>

<p>The window flags need to be set in a similar manner to our previous toolbars: turn off all of the window furniture (title bar, scroll bars and so on), and turn on the furniture flag. The settings in <cite>WinEd</cite> can be seen in <reference id="fig-embed-tool-flags" />.</p>

<image id="fig-embed-tool-flags" file="embed-tool-flags.png" title="The original Ovation put its toolbar where its scroll bar should have been"/>

<p>With these changes in place, we can now close the templates and move on to updating the program itself.</p>
</section>

<section>
<title>Positioning the furniture</title>


</section>
</chapter>
</manual>
Binary file added Images/Chapter09/embed-tool-clean-templates.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/Chapter09/embed-tool-flags.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/Chapter09/embed-tool-ovation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/Chapter09/embed-tool-template.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions panes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,6 @@
<chapter file="ch06-the-nested-wimp.xml"/>
<chapter file="ch07-responsive-nesting.xml"/>
<chapter file="ch08-moving-the-furniture.xml"/>
<chapter file="ch09-an-embedded-toolbox.xml"/>

</manual>

0 comments on commit dfb1c11

Please sign in to comment.