Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

New projects "Custom Vars" tab

<< < (3/5) > >>

oBFusCATed:
I don't see anything which prevents this from being merged, but it will have to wait for after the release.

BTW why are you using dataviewlistctrl? Why don't you use listctrl with checkboxes?

earlgrey:

--- Quote from: oBFusCATed on November 20, 2019, 10:19:38 pm ---I don't see anything which prevents this from being merged, but it will have to wait for after the release.

--- End quote ---
So I have time to fit the codestyle compliance. And will use wxSmith to modify the xrc file.

--- Quote ---BTW why are you using dataviewlistctrl? Why don't you use listctrl with checkboxes?

--- End quote ---
Was the same as with GTK : widget, model, renderers.

earlgrey:

--- Quote from: BlueHazzard on November 18, 2019, 08:39:46 pm ---This was on my todo list for a long time.... Project specific global variables with notes...

--- End quote ---
I got this working :


( Maybe should I have written demonstrates ? )

 I think it is complete now.

Should I merge this feature in my master dev branch ?

oBFusCATed:
No, merges please. SVN doesn't support them. Just post a branch for review (just post the link to the branch here). If you don't want this to be forgotten open a ticket on sf.net about this, too.

earlgrey:
Hello C::B devs. It is my intention to replace the old code for looping among CompileOptionsBase vars :

--- Code: ---const CustomVarHash& v = object->GetAllVars();
for (CustomVarHash::const_iterator it = v.begin(); it != v.end(); ++it)

--- End code ---
with a loop like this :

--- Code: ---for ( CustomVarHash::const_iterator * it = object->VarEnumGetFirst(properties_flags) ; it != nullptr ; it = object->VarEnumGetNext() )

--- End code ---
Motivation : adding active / inactive ( or any other ) property to vars leads to select the vars you want to enumerate by their properties. I want to keep this selection in CompileOptionsBase.
Would the following piece of code be accepted in C::B, because it has static vars in cpp module and it is not STL container enum. Thanx.
N.B. I am aware that m_Vars and m_ActiveVars can be merged.

--- Code: ---~ in compileoptionsbase.cpp ~
//  these variables because in CB code, GetAllVars() is assumed const. So we cant define these vars as class members, since we modify them during the enumeration
static  int                                 m_VarEnumFlags;
static  CustomVarHash const             *   m_VarEnumHash;
static  CustomVarHash::const_iterator       m_VarEnumIterator;

--- End code ---


--- Code: ---~ Little helper ~
void CompileOptionsBase::VarEnumInit(CustomVarHash const * _i_hash) const
{
    m_VarEnumHash       =   _i_hash;
    m_VarEnumIterator   =   m_VarEnumHash->begin();
}

--- End code ---


--- Code: ---~ main search ~
CustomVarHash::const_iterator* CompileOptionsBase::VarEnumFind() const
{
    while ( m_VarEnumIterator != m_VarEnumHash->end() )
    {
        if ( m_VarEnumIterator->second.flags & m_VarEnumFlags )   ~ this is the test I want to keep in CompileOptionsBase ~
            return &m_VarEnumIterator;

        m_VarEnumIterator++;
    }

    if ( m_VarEnumHash == &m_InactiveVars )
        return nullptr;

    VarEnumInit(&m_InactiveVars);
    return VarEnumFind();
}

--- End code ---


--- Code: ---~ for(...) impl ~
CustomVarHash::const_iterator* CompileOptionsBase::VarEnumGetFirst(int _i_flags) const
{
    m_VarEnumFlags = _i_flags;

    VarEnumInit(&m_ActiveVars);
    return VarEnumFind();
 }

CustomVarHash::const_iterator* CompileOptionsBase::VarEnumGetNext() const
{
    m_VarEnumIterator++;
    return VarEnumFind();
}

--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version