Project

General

Profile

Suggestion #141

Add in a subclass layer to an entire, mature, project

Added by Wil van Antwerpen almost 5 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Start date:
05/06/2019
Due date:
% Done:

0%


Description

Snippet from discord:

mwpmullan Last Saturday at 1:51 PM
Not sure if this is a re-factor question, or a thing for one of the other parsers, but how would one go about adding in a sub_class layer to an entire, mature, project. If I go down the rabbit hole of changing the default size for all of my apps, I'm going to have to sub-class all of the ui components.

starzen Last Saturday at 2:04 PM
you would need a list of all class names and the subclass names and then replace the class name with the subclass name and add the use statement. you could of course use simply multi file search and replace for the class name but you also need to insert the use statement

mwpmullan Last Saturday at 2:06 PM
so which tool is the best to get the starting list of classes? I'd guess your parser Michael.

starzen Last Saturday at 2:10 PM
the list of classes you want to subclass is really up to you. The list of occurrences of that class you could use a parser but i think for what you want to do a multi file search and replace should work pretty well.

Another thing i do in cases like this is to force the compiler to throw an error in case someone tries to use it by defining a replacement for the class name that throws an error

mwpmullan Last Saturday at 2:11 PM
#warning works for that in 19.1 :smiley:
I want to start by seeing just how many classes there are in use, then culling out the non UI ones, and building the sub-classes I need, so step one is to ask the parser for a class list. Or global search for " is a"

starzen Last Saturday at 2:14 PM
not sure how you would use #warning for that.

mwpmullan Last Saturday at 2:15 PM
you put a warning in the original class definition.. o wait, that will bite because the sub class calls it.. D'oh!

starzen Last Saturday at 2:15 PM
and the warning would only show one time at the definition. With the replace you will get a compiler error on every line that tries to create an instance of the class
my parser does create a list of classes but i am not sure if i make the list available at this point. Also of course you would end up with a lot of classes to cull through. probably better off just doing it manually. The Studio has a list of the most used ui classes in the workspace config. Wasnt there a create subclass layer feature in the studio once?

mwpmullan Last Saturday at 2:21 PM
There is / was, but IIRC it only helped before you started coding. I'm trying to back-fill font handling into a big app, at least until I realize the level of futility, and just buy the client two new screens. Might be cheaper for me.

Wil Last Saturday at 5:59 PM
Interesting idea. I think it would not be too hard to add for dfrefactor. It would not get you a list of classes though.
As long as you are talking about replacing DAWs base classes that is.

starzen Last Saturday at 6:08 PM
yes you can easily create a function to replace a class. then add a frontend that can ran a loop over a list of classes

Wil Last Saturday at 6:08 PM
Probably only takes a couple of hours to implement a rough first version.

mwpmullan Last Saturday at 6:09 PM
I think I'm going to buy the client new monitors. Globally increasing the size of the font used in the app is giving me a migraine.

Wil Last Saturday at 6:10 PM
Yep, dfrefactor already has most of the logic. The moe diffucult bit is inserting the correct use statement. If class naming is consistent then that helps, otherwise it will be more complex soon.
@mwpmullan yes that sounds better.

Also available in: Atom PDF