Jump to content

OptionBasedLibrary Development


midora

Recommended Posts

18 hours ago, midora said:

Could you provide the two simple dlls with the new Bitmap and the source surface?

 

Here you go. I've named the files as OblTestBitmap.dll and OblTestSurface.dll.

 

 

OblTest.zip

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

For future reference:

 

I want to ask though, and I think the answer is no, but does OptionBasedLibrary supports dynamic gui? As in I'm able to hide UI elements or based on variables equation? It's the hiding part I want, not unselect-able.

 

For example:

 

Spoiler

u "{$1}"\
"{$2}"\
"{$3}"\
"{$4}"\
"{$5}"\
"{$6}"\
"{$7}"\
"{$8}"\
"{$9}"\
"{$10}"\
"{$11}"\
"{$12}_"{$10==1?2:0}\
"{$13}_"{$10==2?2:0}\
"{$14}_"{(($10==3)||($10==4))?2:0}\
"{$15}_"{(($10==3)||($10==4))?2:0}

 

 

From $1 to $15 brackets (inside brackets are variables used by a filter.) are individual gui elements, and the _{$expression} is the conditions to hide elements. This, but in OptionBasedLibrary C# form. 0 means hidden, 1 means unselectable (not hidden), and 2 means visible and selectable.

Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

6 hours ago, toe_head2001 said:

Here you go. I've named the files as OblTestBitmap.dll and OblTestSurface.dll.

You missed the .dlcs but empty ones are working fine. 😉

I'm getting exactly the same issues. No idea in the moment but I will check...

midoras signature.gif

Link to comment
Share on other sites

23 minutes ago, Reptillian said:

For future reference:

I take it as this. We will discuss it later.

 

In the moment you can just enable/disable OptionControls via the UI but you can not hide them. Hiding would require to update the layout.

You may derive your own Optioncontrols and maybe a PerformLayout of the dialog works. No idea in the moment.

midoras signature.gif

Link to comment
Share on other sites

On 2/15/2021 at 12:19 AM, toe_head2001 said:

Here you go. I've named the files as OblTestBitmap.dll and OblTestSurface.dll.

 

I recreated the first one and it works. No idea what's the issue. I would expect that all these bitmap calls return null. Maybe an issue with the pdn dlls? I'm still referencing 3.5.11.

I attached the solution. The referenced dlls are in the Release folder. Maybe just try TestEffect.dll first if you like.

Edited by midora

midoras signature.gif

Link to comment
Share on other sites

@NSDYou are right (at least I'm getting this quite tiny rectangle).

I have a rough idea about the intention of this flag but I'm sure it's more than these 5 years that I tested if it works).

In the moment I would say just don't set it to true.

I'm not sure that I will support it in the future. Maybe it would be better to remove it completely from the code,

Just no time to run tests for all these cases. difficult enough to test if it works on Win7 with and without Aero.

Will add a warning on the first page. Thanks all for looking in this issue.

 

 

 

 

midoras signature.gif

Link to comment
Share on other sites

  • 3 weeks later...

Related to the topic  PropertyBased UI: All PropertyBased Controls, I like to show the differences between PropertyBased and OptionBased Controls. Just focused on the same set of controls.

 

Enabled  122326491_PdnUiBasicOptionBasedControls-Enabled.thumb.png.e75a3cb41fcee6ea17540cd359184d38.png     Disabled  1099388493_PdnUiBasicOptionBasedControls-Disabled.thumb.png.ca69a3ac631c38ed58baa317e81fc06e.png

 

              1114184837_PdnUiBasicOptionBasedControls-Help.png.506b1b167d043a6dec6d8c84fe0b5849.png

The main differences between OptionBased and ProperyBased are (in Dark Theme)

  • the focus rectangle is white and not black
  • the background of disabled textboxes and numeric boxes stays dark

 

  • Like 1

midoras signature.gif

Link to comment
Share on other sites

I worked a bit on the HelpButton implementation. Beside of the possibilities to show an alert or a help window I decided to add the classic balloon help support.

This works in the way that you are clicking the help button and the cursor changes to an arrow with an question mark. Clicking an options shows the balloon help.

 

image.png.4c8171c550a51b648dcb62dec736d95c.png

As always in OBL dll the help text is defined (and can be translated) in the dlc file.

You will also getting the help ballon by pressing F1 if one element in an OptionControl has the focus.

The title of the Balloon is the DisplayName

The implementation was easy. You just have to override the OnHelpRequest method and show the balloon there.

I tried HelpProvider class first but it is buggy and somehow clamped to the mainscreen.

midoras signature.gif

Link to comment
Share on other sites

I remember discussions why it is not a good idea to save and restore the position of the effect dialogs.

The main argument was that it may happen that the dialog is no longer visible after a reconfiguration of the screens.

This would raise support issues.

 

OBL dialogs are saving/restoring the position but there is a mechanism implemented which checks that the caption of the dialog is always visible on a screen.

The following snippet shows how it works

 

form.Location = CatchBoundsToScreens(rememberedBounds).Location;

 

        /// <summary>
        /// Catches the location of the rectangle to the screen containing the
        /// largest portion of the rectangle. If no screen contains the rectangle
        /// the main screen will be used.
        /// </summary>
        /// <param name="bounds">Typically the bounds of a Form.</param>
        /// <returns>The catched rectangle.</returns>
        private Rectangle CatchBoundsToScreens(Rectangle bounds)
        {
            // Retrieves a Screen for the display that contains the largest portion of the rectangle.
            var screen = Screen.FromRectangle(bounds);
            // we catch first bottom/right and after top/left
            if (bounds.Right > screen.Bounds.Right) bounds.X = screen.Bounds.Right - bounds.Width;
            if (bounds.Bottom > screen.Bounds.Bottom) bounds.Y = screen.Bounds.Bottom - bounds.Height;
            if (bounds.Left < screen.Bounds.Left) bounds.X = screen.Bounds.Left;
            if (bounds.Top < screen.Bounds.Left) bounds.Y = screen.Bounds.Top;
            return bounds;
        }

 

midoras signature.gif

Link to comment
Share on other sites

  • 5 weeks later...

Still working on refactoring of OBL to get a consistent interface for users an developers...

 

There is a new OptionControl flag 'ReverseControlOrder' (and the same for the default UI configuration) to change the order of the sub controls.

This is mostly useful if 'DisplayLabel' (old name 'Label') is used for an Optioncontrol because the NUD value is then next to the DisplayLabel (like for all the other OptionControls not showing NUDs).

 

2021-04-08-Callout-Selection-Nuds-left-a

The screenshot on the right uses 'ReverseControlOrder'.

 

What I really don't like are the blue thumbs on the sliders (which turns to black on hovering the thumb). It should be vice versa (especially in dark mode).

But I'm not sure that I can change this.

 

I also changed the default formatting if NUDs to use

(ThousandsSeparator ? "#,##0." : "0.") + new string('#', DecimalPlaces), CultureInfo.CurrentCulture

which allows the ThousandsSeparator and suppresses trailing zeros (not visible in the screenshot because I just changed it).

I'm not sure if I should add a flag for this formatting.

 

 

 

 

 

 

 

midoras signature.gif

Link to comment
Share on other sites

Thanks to the Native TrackBar control it wasn't too difficult to change the appearance of the sliders in the different states.

 

2012-04-10-paint-net-Option-Based-Slider

Hope you like it more than the old blue one provided from .net TrackBar. 'Hot' means the mouse hovers the slider thumb, 'Pressed' the user moves the thumb with the mouse. In 'normal' mode the thumb shows always the BackColor.

If the controls shows tick marks then the thumb outline will be .pointing to the ticks bar.

Also added the default value marker.

 

 

  • Upvote 1
  • You're a Smart Cookie! 1

midoras signature.gif

Link to comment
Share on other sites

  • 1 month later...

If people like @BoltBait and @Ego Eram Reputo think it is a mess to use OBL then there is the general question whether it makes sense to continue the development or not.

It's not a big loss for me to stop the paint.net variant because I'm using most components of the lib for other applications.

I just don't like to spend time if I have to fight against others in the forum.

So what do you think?

 

  • Hugs 1

midoras signature.gif

Link to comment
Share on other sites

I did wanted to completely convert gmic thorn fractal as a gmic-pdn obl plugin. Particularly the problem of dynamic gui would be solved with tabs. I'm not going to stop you, but there are others that see a use in this.

 

Does anyone else have a suggestion to this problem? That filter use dynamic gui, and it is apparent when using custom formula. The current pdn thorn fractal lacks it because of inherent limitations of static gui.

Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

9 hours ago, midora said:

... then there is the general question whether it makes sense to continue the development or not.

 

Yes, continue to develop it.  There are plenty of other people who are willing to use it.

 

9 hours ago, midora said:

I just don't like to spend time if I have to fight against others in the forum.

 

You don't need to fight anyone. Everyone is entitled to have their own personal opinion.  No one is saying you have to agree with someone else's opinion.

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

Please continue development. 
 

I would actually like to see some of the capabilities built-in to Paint.NET, like tabs. 
 

Perhaps you could work with Rick to port some of your code directly into Paint.NET so people like me could enjoy tabs and other things. 

  • Upvote 1
Link to comment
Share on other sites

12 hours ago, midora said:

If people like @BoltBait and @Ego Eram Reputo think it is a mess to use OBL

 

Wait. What? I'm all for you continuing to develop OBL.

 

My one wish is that the support files are integrated in a single DLL for publication. That would standardize installation and we wouldn't have the whole versioning nightmare we seem to be rushing towards.

Link to comment
Share on other sites

There is most likely a way to ensure that the OBL can be placed not in the paint.net root. 

 

6 hours ago, Ego Eram Reputo said:

My one wish is that the support files are integrated in a single DLL for publication. That would standardize installation and we wouldn't have the whole versioning nightmare we seem to be rushing towards.

 

This may be more feasible with the migration to .NET Core. I'll be able to look into this ... later :) Linking and trimming are part of what .NET Core provides support for, at least for the app/exe, I'm just not sure if DLLs (libraries) can also do it. I don't see why not though ...

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...