issue-#173 adding new modifiers in Controllers

Merged to the master branch
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

issue-#173 adding new modifiers in Controllers

Post by Josef Templ »

I have created https://redmine.blackboxframework.org/issues/173 for cleaning up the modifiers docu and adding the 'context' modifier.
This is a mixture of bug fix, feature, and documentation issue.

When looking at the details of the ALT key modifier, I found ugly code in Containers.
This module duplicates the definition of some platform specific modifiers from HostPorts without importing HostPorts.

Code: Select all

		left = 16; middle = 17; right = 18; alt = 28;	(* same as in HostPorts! *)
left is unused, middle and alt are used, right could be replaced by Controllers.context.

I don't know how to deal with middle and alt, though.

- Josef
Last edited by Josef Templ on Wed Sep 06, 2017 6:43 pm, edited 1 time in total.
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#173 adding a new modifier for showing a context m

Post by Josef Templ »

I just found out that also StdLinks uses platform specific modifiers:

Code: Select all

			IF ~(Containers.noCaret IN c.opts) & (mod * {17, 27, 28} # {}) THEN RETURN FALSE END;
It gets uglier every day:-(

I also found out that there are some undocumented usages of the ALT key in Containers
(at least I haven't found any docu).
For example:
If you press SHIFT + ALT + (MOUSE-LEFT or MOUSE-RIGHT) then you see the borders of all views in the focus window.

- Josef
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#173 adding new modifiers in Controllers

Post by Josef Templ »

A first proposal for cleaning up the usage of platform specific modifiers in platform independent modules is available now.
See diffs at https://redmine.blackboxframework.org/p ... 77f9e8c151.

It looks more complicated than it is. Part of it is just adapted docu.

There are 2 new modifiers in Controllers:
1. popup = 3
2. pick = 4

popup is for showing a popup menu when pressing the right mouse button.
I named it popup now because it turned out that this name was already used inside module Containers and it fits better with the other verbs.

pick is triggered by pressing the Alt key or, alternatively, by pressing the middle mouse button.
This is used for drag & pick.
The behavior is as it was before with a very slight regularization.
Alt and mouse middle are now treated the same not only for drag & pick but also for other situations where the
Alt key is used. An example is showing the viewer hierarchy by pressing Shift + Alt + mouse. This can be done
now also (and simpler) with Shift + mouse middle.

- Josef
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: issue-#173 adding new modifiers in Controllers

Post by Robert »

This is a wide-rangeing cleanup, and I may have several comments. But a few initial thoughts ...

1 - Docu/Tut-6. " For the mapping of platform specific keys see platform specific modifiers." An active link to the PSI section would be good. I would like to see a "Target" View in the PSI so I can easily link to it in my own Docus.

2 - Docu/User-Man. "different sizes, hold down the alt key (or, alternatively, use the middle mouse button), and then" If this is platform independent should it not talk about the "pick" modifier and not mention the "alt" key? BUT, as a Windows user, I find it much easier to understand references to the alt key. I don't know the best solution. Maybe a good compromise is to say "hold the pick modifier (on Windows this is the alt key or middle mouse button), and then".
Ideally every reference to alt or ctrl would be replaced by a similar expression?

3 - Is it a good idea to merge the alt key and middle mouse ideas? This means the programmer does not have the option (in a platform independent way) to handle them differently.
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: issue-#173 adding new modifiers in Controllers

Post by Robert »

I would like to see the mapping table in PSI even more explicit; something like:

Code: Select all

The mapping between Windows and BlackBox modifiers is given in the table below:

  HostPorts  HostPorts      Controllers  Controllers
    name       value           name        value

                            doubleClick      0
   left          16
  middle         17           pick           4
  right          18          popup           3
  shift          24         extend           1
  ctrl           25         modify           2
   alt           28          pick            4

But even this is confusing. Is "left" a modifier or not?
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: issue-#173 adding new modifiers in Controllers

Post by Robert »

In Std/Mod/Links " (* ignore 'pick' (alt, cmd, and middle clicks) in edit mode *)" seems wrong.
Should it be " (* ignore 'pick' (alt or middle click) and "cmd" in edit mode *)"?

Is "cmd" adequately explained - I don't know what it (or "opt") are!
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#173 adding new modifiers in Controllers

Post by Josef Templ »

Robert wrote:In Std/Mod/Links " (* ignore 'pick' (alt, cmd, and middle clicks) in edit mode *)" seems wrong.
Should it be " (* ignore 'pick' (alt or middle click) and "cmd" in edit mode *)"?

Is "cmd" adequately explained - I don't know what it (or "opt") are!
cmd and opt are unused as far as I have seen.
They may have been used for the MacOS version.
I didn't want to remove them because I tried to keep the changes small.

- Josef
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#173 adding new modifiers in Controllers

Post by Josef Templ »

Robert wrote:I would like to see the mapping table in PSI even more explicit; something like:

But even this is confusing. Is "left" a modifier or not?
This is a difficult topic.
A table of mouse buttons and modifiers may better fit into Text/Docu/User-Man.odc, which already has a table of keyboard shortcuts.
The existing Text/Docu/User-Man.odc is already Windows specific. For a user it would be confusing to see a table with HostPorts names and values.
This is low-level info for developers.

'left' is a modifier, but a platform specific modifier.
That's why it is defined in HostPorts and not in Controllers.

On a system with a one button mouse, such as the Mac, every modifier needs to be
done with the keyboard. I think this was the reason for not exporting mouse buttons in Controllers
but to use an abstraction in between. Unfortunately this has not been done in a clean way
and this issue is about cleaning it up.

> 1 - Docu/Tut-6. " For the mapping of platform specific keys see platform specific modifiers." An active link to the PSI section would be good. I would like to see a "Target" View in the PSI so I can easily link to it in my own Docus.
This is an active link, Isn't it?

> 2 - Docu/User-Man. "different sizes, hold down the alt key (or, alternatively, use the middle mouse button), and the ...
What do you mean with 'different sizes'?

> Ideally every reference to alt or ctrl would be replaced by a similar expression?
I didn't want to rewrite the complete text docu. In 1.6 it had alternating subsections for Windows and Mac, in 1.7 it has been made Windows only.

> 3 - Is it a good idea to merge the alt key and middle mouse ideas? This means the programmer does not have the option (in a platform independent way) to handle them differently.
This is true. Abstraction is always a limitation. On the other side it has the advantage of regularization or standardization. If you use 'pick' you get
the same pattern everywhere. It was taken from drag & pick. This was possible because there were no contradictions with different usages of the middle mouse button.
Furthermore, I cannot see any alternative except giving up the abstraction.

- Josef
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#173 adding new modifiers in Controllers

Post by Josef Templ »

I could imagine a table of Mouse/Key combinations like the keyboard shortcuts table in Text/Doku/User-Man.odc like below.

Code: Select all

Function             Mouse/Key combination   Constraint
set caret            ML                      outside selection
select word          ML double click
show popup menu      MR
move selection       ML                      start inside selection
copy selection       ctrl + ML               start inside selection
                     ML + MR
drop selection       MR                      start inside selection
drag & pick          alt + ML                start inside selection
                     MM
show views           shift + alt + ML        outside selection
                     shift + MM
select embedded view alt + ML                inside embedded view
                     MM

It is probably not complete.

- Josef
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: issue-#173 adding new modifiers in Controllers

Post by Robert »

Josef Templ wrote:
Robert wrote:In Std/Mod/Links " (* ignore 'pick' (alt, cmd, and middle clicks) in edit mode *)" seems wrong.
Should it be " (* ignore 'pick' (alt or middle click) and "cmd" in edit mode *)"?

Is "cmd" adequately explained - I don't know what it (or "opt") are!
cmd and opt are unused as far as I have seen.
They may have been used for the MacOS version.
I didn't want to remove them because I tried to keep the changes small.

- Josef
I was only making the very minor point that with your wording it looks like "alt", "cmd", & "middle" are alternative names for "pick" which is being ignored. With my wording the intention is to say that both "pick" & "cmd" are ignored.
Post Reply