<div dir="ltr"><div><div><div><div><div>Hi, Stefano!<br><br></div>Yeah, the code in the PaintOpBox is rather messy. And yes, we use widgets as a data model for paintop presets. That is not too nice, and I also had to spend a bit of time because of it when doing LoD switches.<br><br></div>If I were your I would not try to follow the order of calls by KisPaintopBox, but just started from a blank page:<br><br></div>1) Cut off external interfaces and define them strictly. E.g. though "widgets as a data model" is not a beautiful solution, it can be used without much changes E.g. KisPaintOpSettingsWidget has quite a usable read/write interface, which can be reused.<br><br></div>2) After you decided what you are going to reuse, you can easily combine them in some new class/classes. You can use UML for graphical representation of it. I usually go to <a href="http://creately.com">creately.com</a> and do UML drafts there.<br><br></div>We can organize a skype session next week if you like :)<br><div><div><div><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 3, 2015 at 5:21 PM, Stefano Bonicatti <span dir="ltr"><<a href="mailto:smjert@gmail.com" target="_blank">smjert@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Ah, i get why there's this coupling then.<div>I also realized some things like, preset settings that store a reference to the option widget. I didn't look then what it does with it, but it looks suspicious to me, i would actually expect that the option widget reads and does things to the settings, not the opposite.</div><div><br></div><div>Anyway i'm using an etherpad -> <a href="https://notes.kde.org/p/preset-widget-refactoring" target="_blank">https://notes.kde.org/p/preset-widget-refactoring</a> to make an "analysis" of all the classes (and especially parts of them involved with presets), noting down also comments and things i think about how to change some of the code etc.</div><div>Currently it's in his infancy because i did it yesterday very late..</div><div>I've found that i cannot remember things day by day otherwise (since i started working :P), was used to keep everything into my mind eheh.</div><div><br></div><div>So anyway if you want to know "what" i'm doing you could keep an eye there. No promises about crazy stuff written there (kidding :P).</div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2015-09-03 10:47 GMT+02:00 Boudewijn Rempt <span dir="ltr"><<a href="mailto:boud@valdyas.org" target="_blank">boud@valdyas.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><br>
On Sun, 30 Aug 2015, Stefano Bonicatti wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
So in the end, as i said, back to the drawing board, listing all the classes involved, what they are supposed<br>
to do and have to do, drawing the interactions and unravel them since there are a lot of things that have to be<br>
streamlined and should have a somewhat fixed order of execution (especially needed with GUI interaction).<br>
I think that the bigger refactoring cannot be avoided.<br>
</blockquote>
<br></span>
I do agree with that... The thing is, a preset is two things at the moments: it's a loadable,<br>
savable, editable aggregate of brush settings, but it's _also_ the current state of the active<br>
brush engine. And that gets changed through all the controls the user has over current opacity,<br>
current brush size and so on.<br>
<br>
Then there is the widget/data model confusion. We have this all over Calligra, actually, where<br>
around 2006 we decided to to couple the gui for a plugin with its data model. You find that in tools, in filters, in brush engines.<div><div><br>
<br>
Boudewijn<br>
_______________________________________________<br>
Krita mailing list<br>
<a href="mailto:kimageshop@kde.org" target="_blank">kimageshop@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/kimageshop" rel="noreferrer" target="_blank">https://mail.kde.org/mailman/listinfo/kimageshop</a><br>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Krita mailing list<br>
<a href="mailto:kimageshop@kde.org">kimageshop@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/kimageshop" rel="noreferrer" target="_blank">https://mail.kde.org/mailman/listinfo/kimageshop</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">Dmitry Kazakov</div>
</div>