Keyboard shortcuts to move dual display divider

Hi Guys,

On the BitsDuJour website, there is a user comment at the bottom of the discount page which I am having problems with.

http://www.bitsdujour.com/software/directory-opus-10

How is this achieved? I can't find a command so I guess they are perhaps separate layouts.

Regards

Blueroly

Have a look at the Set DUALSIZE command.

Awesome! Thanks Leo.

Would it be possible to add a Set DUALSIZE +5 argument in a similar way Set FONTSCALE +5 works?

I would also find it useful to have the commands:
Set DualSize +n (or -n) and Set ViewPaneSize = +n (or -n)
where n is a percentage (and where the +5 and -5 arguments mentioned by blueroly would generally be the most useful). Apologies if we are missing something already there.

  • In a dual display, I often use buttons to add columns, then fiddle with the mouse to adjust the divider and the view pane size so that I can see the new columns.
  • In a single display of pictures, keyboard increasing of the viewer pane size would be convenient after navigating to the desired group of pictures.

. . . or, what about allowing an indefinite sequence of percentages in the parameters of Set DualSize, so that one could write two buttons to cover everything:
Set DualSize 55,60,65,70,75,80 and Set DualSize 45,40,35,30,25,20
Similarly with Set ViewPaneSize.

By the way, 50 does not necessarily restore the previous layout, nor does it seem to be exactly 50%. A completely accurate toggle may be to add Set Layout=Remember as the first line, then write another button Set Layout=Restore. (But this approach seems to require the toolbars to be the default toolbars.)

What about scripting this functionality? I've created two buttons to de/increase viewpane size.

The only drawback is, that the current viewpane size cannot be determined (at least I don't know how - pls tell me if I'm wrong), so on first use, it assumes the viewpane is set to 50% (you may change that initial value). In case you resize the viewpane manually, the "buttons" will not know either, so the panesize might "jump" after manual resizing and using the button again.

Maybe the DO team supports getting the viewer pane size by script in the future, then this scripting solution would work as smooth as possible.

You need to set your hotkeys for the buttons of course, to make these work by keyboard.

Increase Viewpane:

<?xml version="1.0"?> <button backcol="none" display="both" textcol="none"> <label>Increase Viewpane</label> <tip>Increase Viewpane</tip> <icon1>#newcommand</icon1> <function type="script"> <instruction>@script jscript</instruction> <instruction>///////////////////////////////////////////////////////////////////////////////</instruction> <instruction>// increase viewpane size by 5%</instruction> <instruction>///////////////////////////////////////////////////////////////////////////////</instruction> <instruction>function OnClick(data){</instruction> <instruction> var size = 50;</instruction> <instruction> var max = 100;</instruction> <instruction> var dec = 5;</instruction> <instruction> if (data.func.sourcetab.lister.vars.exists(&quot;ViewPaneSize&quot;)){</instruction> <instruction> size = data.func.sourcetab.lister.vars.get(&quot;ViewPaneSize&quot;);</instruction> <instruction> } </instruction> <instruction> if ((size+dec) &lt; max){</instruction> <instruction> size += dec;</instruction> <instruction> }</instruction> <instruction> data.func.sourcetab.lister.vars.set(&quot;ViewPaneSize&quot;, size);</instruction> <instruction> data.func.command.Clearfiles();</instruction> <instruction> var cmd = DOpus.NewCommand();</instruction> <instruction> cmd.RunCommand(&quot;Set ViewPaneSize &quot;+size);</instruction> <instruction>}</instruction> </function> </button>
Decrease Viewpane:

<?xml version="1.0"?> <button backcol="none" display="both" textcol="none"> <label>Decrease Viewpane</label> <tip>Decrease Viewpane</tip> <icon1>#newcommand</icon1> <function type="script"> <instruction>@script jscript</instruction> <instruction>///////////////////////////////////////////////////////////////////////////////</instruction> <instruction>// decrease viewpane size by 5%</instruction> <instruction>///////////////////////////////////////////////////////////////////////////////</instruction> <instruction>function OnClick(data){</instruction> <instruction> var size = 50;</instruction> <instruction> var min = 10;</instruction> <instruction> var dec = -5;</instruction> <instruction> if (data.func.sourcetab.lister.vars.exists(&quot;ViewPaneSize&quot;)){</instruction> <instruction> size = data.func.sourcetab.lister.vars.get(&quot;ViewPaneSize&quot;);</instruction> <instruction> } </instruction> <instruction> if ((size+dec) &gt; min){</instruction> <instruction> size += dec;</instruction> <instruction> }</instruction> <instruction> data.func.sourcetab.lister.vars.set(&quot;ViewPaneSize&quot;, size);</instruction> <instruction> data.func.command.Clearfiles();</instruction> <instruction> var cmd = DOpus.NewCommand();</instruction> <instruction> cmd.RunCommand(&quot;Set ViewPaneSize &quot;+size);</instruction> <instruction>}</instruction> </function> </button>

In case you would like to have 2 more of these to control the dual display divider, let me know or try to edit the scripts for yourself.
You only need to replace the variable name "ViewPaneSize" with something like "DualSize" and alter the command at the bottom to run "Set DualSize".., instead of "Set ViewPaneSize"..

[quote="tbone"]In case you would like to have 2 more of these to control the dual display divider, let me know or try to edit the scripts for yourself.
You only need to replace the variable name "ViewPaneSize" with something like "DualSize" and alter the command at the bottom to run "Set DualSize".., instead of "Set ViewPaneSize"..[/quote]
Looks good tbone, I'll play around with the scripts first before asking for more help :slight_smile:

Nice work indeed, tbone. I succeeded in editing "ViewPaneSize" to "DualSize", plus a couple of other tweaks with the numbers, and I now have all four buttons up and running. It makes things much more convenient. Thank you very much for your expertise.

I've now implemented the Set Layout=Remember command in a separate button. I wonder, however, it there is a way to implement this Remember command at the top of each of the four buttons in such a way that the layout is remembered the first time any one of the four buttons is run, but not afterwards (unless Set Layout=Restore has been run). Presumably some variable within DOpus is set by the Remember command, and one could check to see whether or not this variable is empty, along the lines of the @Ifset: test in the DOpus language. But all that is a very fussy and minor detail — I have what I want.

Don't know if I got exactly what you aim for, but to save the current layout, before any button changes the layout, add this at the very top of each button (right below the "function OnClick(data)" thing and pay attention to the variable names, in case you used your own (valid for the last button shown here as well):

	if (!data.func.sourcetab.lister.vars.exists("ViewPaneSize") && !data.func.sourcetab.lister.vars.exists("DualSize"))
      		DOpus.NewCommand.RunCommand("Set Layout=Remember");

Not the most beautiful solution, but saves the current layout for later re-use with "Set Layout=Restore", if none of the buttons were used before.
Here the two buttons posted before, with the above change already done:

<?xml version="1.0"?> <button backcol="none" display="both" textcol="none"> <label>Increase Viewpane</label> <tip>Increase Viewpane</tip> <icon1>#newcommand</icon1> <function type="script"> <instruction>@script jscript</instruction> <instruction>///////////////////////////////////////////////////////////////////////////////</instruction> <instruction>// increase viewpane size by 5%</instruction> <instruction>///////////////////////////////////////////////////////////////////////////////</instruction> <instruction>function OnClick(data){</instruction> <instruction> if (!data.func.sourcetab.lister.vars.exists(&quot;ViewPaneSize&quot;) &amp;&amp; !data.func.sourcetab.lister.vars.exists(&quot;ViewPaneSize&quot;))</instruction> <instruction> DOpus.NewCommand.RunCommand(&quot;Set Layout=Remember&quot;);</instruction> <instruction> var size = 50;</instruction> <instruction> var max = 100;</instruction> <instruction> var dec = 5;</instruction> <instruction> if (data.func.sourcetab.lister.vars.exists(&quot;ViewPaneSize&quot;)){</instruction> <instruction> size = data.func.sourcetab.lister.vars.get(&quot;ViewPaneSize&quot;);</instruction> <instruction> } </instruction> <instruction> if ((size+dec) &lt; max){</instruction> <instruction> size += dec;</instruction> <instruction> }</instruction> <instruction> data.func.sourcetab.lister.vars.set(&quot;ViewPaneSize&quot;, size);</instruction> <instruction> data.func.command.Clearfiles();</instruction> <instruction> var cmd = DOpus.NewCommand();</instruction> <instruction> cmd.RunCommand(&quot;Set ViewPaneSize &quot;+size);</instruction> <instruction>}</instruction> </function> </button>

<?xml version="1.0"?> <button backcol="none" display="both" textcol="none"> <label>Decrease Viewpane</label> <tip>Decrease Viewpane</tip> <icon1>#newcommand</icon1> <function type="script"> <instruction>@script jscript</instruction> <instruction>///////////////////////////////////////////////////////////////////////////////</instruction> <instruction>// decrease viewpane size by 5%</instruction> <instruction>///////////////////////////////////////////////////////////////////////////////</instruction> <instruction>function OnClick(data){</instruction> <instruction> if (!data.func.sourcetab.lister.vars.exists(&quot;ViewPaneSize&quot;) &amp;&amp; !data.func.sourcetab.lister.vars.exists(&quot;ViewPaneSize&quot;))</instruction> <instruction> DOpus.NewCommand.RunCommand(&quot;Set Layout=Remember&quot;);</instruction> <instruction> var size = 50;</instruction> <instruction> var min = 10;</instruction> <instruction> var dec = -5;</instruction> <instruction> if (data.func.sourcetab.lister.vars.exists(&quot;ViewPaneSize&quot;)){</instruction> <instruction> size = data.func.sourcetab.lister.vars.get(&quot;ViewPaneSize&quot;);</instruction> <instruction> } </instruction> <instruction> if ((size+dec) &gt; min){</instruction> <instruction> size += dec;</instruction> <instruction> }</instruction> <instruction> data.func.sourcetab.lister.vars.set(&quot;ViewPaneSize&quot;, size);</instruction> <instruction> data.func.command.Clearfiles();</instruction> <instruction> var cmd = DOpus.NewCommand();</instruction> <instruction> cmd.RunCommand(&quot;Set ViewPaneSize &quot;+size);</instruction> <instruction>}</instruction> </function> </button>

Another button which clears/removes the variables when calling "Set Layout=Restore".
Caution: On my setup, it hides some toolbars as well, don't know if that's the same for you (I think my toolbars are bound to the layout I use, not to the default lister and that's why?).

<?xml version="1.0"?> <button backcol="none" display="both" textcol="none"> <label>Restore Layout</label> <tip>Restore Layout</tip> <icon1>#newcommand</icon1> <function type="normal"> <instruction>@set lst:ViewPaneSize</instruction> <instruction>@set lst:DualSize</instruction> <instruction>Set Layout=Restore</instruction> </function> </button>

tbone, you are a perfectionist! All four buttons work exactly as desired on my configuration: the extra two conditional lines, and the deletion of the variables before restoration. Thank you very much indeed, and hopefully your codes may prove generally useful for people.

The problem with the missing toolbars occurred before, simply from running the Set Layout=Restore command alone. Because I use the same two non-floating toolbars all the time, I converted them to default toolbars, and this solved the problem. Your extra two lines deleting the variables didn't change anything.

I'm glad you like it, thanks for your feedback.. o)

Thanks for adding this feature to v11.3 Beta 1. Opus gets better every day :smiley:

. . . except that the new Set DUALSIZE +5 doesn't work as well as the solutions that tbone produced above, for three reasons:

  • Set DUALSIZE +5 and Set DUALSIZE -5 are not inverse functions. By experiment on my full-size desktop screen with two columns plus viewer pane, I have found that Set DUALSIZE -3 seems approximately to reverse the command Set DUALSIZE +5. I have no idea why this would happen.
  • Even then the divider doesn't return to exactly its original position, presumably because all percentages are rounded correct to the nearest 1%.
  • The delta value can't be used with Set VIEWPANESIZE (but perhaps this is coming in a subsequent beta).

tbone's perfectionist solution above of remembering, and then restoring, the divider (or viewpane) to its original position gives a precise solution to the restoration problem, and neatly avoids the rounding problem. Restoration is important when you just want to peek at an extra column that you have added, and then go back to where you were.

You can also script the same setting now if you want something different.

I can't reproduce that. If I start with the divider in the middle, and put the mouse over it as a reference point, running +5 followed by -5 ends up with the mouse still positioned over the divider.

Well, that is a puzzle.

  • If I start with a two-equal panel plus Viewer pane display, then each successive iteration of (Set DUALSIZE +5 followed by Set DUALSIZE -5) walks the divider off to the left by 17–18 pixels.
  • Same result if I get rid of the viewer pane and start with the divider in the middle of the screen.
  • Same result if I perform (low) equal numbers of each command, in any order.

As I reported, Set DUALSIZE -3 seems a pretty good inverse function of Set DUALSIZE +5.

Here is what Piriform Speccy reports on the specs of my monitor:
Name Acer V233H on AMD Radeon HD 7450
Current Resolution 1920x1080 pixels
Work Resolution 1920x1080 pixels
State Enabled, Primary, Output devices support
Monitor Width 1920
Monitor Height 1080
Monitor BPP 32 bits per pixel
Monitor Frequency 60 Hz
Device \.\DISPLAY1\Monitor0

By the way, in answer to Leo's post, I have indeed set up hotkey sequences with tbone's four commands, plus another hotkey for the restoration command, and I have very quickly found myself using them all the time. I find the ability to do things in different ways a really attractive feature of DOpus.