Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

Led plugin

<< < (2/3) > >>

Cryogen:
 Hey Jonas,


--- Quote from: ZinnJonas on September 21, 2010, 04:16:30 pm ---Cryogen i know the KWIC controls, but I can't compile your wxSmithKWIC, because there are to much
you have to change, to make it run.
;D


--- End quote ---

Err, it should build right out of the box. I've tested it and I know Morten runs it and others have, too. What do you think you have to change? What specific problems are you encountering and what are you running on? Also, I checked in some changes over the weekend. you might like to try the latest version and see if your mileage improves.

Thanks,

  Cryo.

ZinnJonas:
Hi,

My system is Win7 (64Bit), but i use Mingw 32 Bit with wxWidgets 2.8.11 and the newest svn of codeBlocks at the moment(  6620)

the changes are:

--- Code: ---Adding wxpropgrid library to wxSmithKWIC and change the path from 
..\wxSmith\propgrid\contrib\include
to
..\..\..\sdk\wxpropgrid\include

wxsangularmeter.cpp:

void wxsAngularMeter::OnAddExtraProperties(wxsPropertyGridManager *Grid)
{
    #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
    Grid->SelectPage(0);
    #else
    Grid->SetTargetPage(0);
    #endif

    #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
    m_SectorCountId = Grid->Insert(wxT("Needle Colour"), new wxIntProperty(_("Number Of Sectors"), wxPG_LABEL,
    #else
    m_SectorCountId = Grid->Insert(wxT("Needle Colour"), wxIntProperty(_("Number Of Sectors"), wxPG_LABEL,
    #endif
                                                                    (int)m_arrSectors.Count()));
    for(int i = 0; i < (int)m_arrSectors.Count(); i++)
    {
        InsertPropertyForSector(Grid, i);
    }
    wxsWidget::OnAddExtraProperties(Grid);
}

void wxsAngularMeter::OnExtraPropertyChanged(wxsPropertyGridManager *Grid, wxPGId id)
{
    #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
    Grid->SelectPage(0);
    #else
    Grid->SetTargetPage(0);
    #endif
   .....

   // We have to remove some entries
            for(int i = NewValue; i < OldValue; i++)
            {
                #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
                Grid->DeleteProperty(m_arrSectors[i]->id);
                #else
                Grid->Delete(m_arrSectors[i]->id);
                #endif
                delete m_arrSectors[i];
            }
    ....
}

void wxsAngularMeter::InsertPropertyForSector(wxsPropertyGridManager *Grid, int Position)
{
    SectorDesc *Desc = m_arrSectors[Position];
    wxString SectorName = wxString::Format(_("Sector %d Colour"), Position + 1);
    wxString SectorDataName = wxString::Format(_("sector_%d_colour"), Position + 1);

    #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
    Desc->id = Grid->Insert(wxT("Needle Colour"), new wxSystemColourProperty(SectorName, wxPG_LABEL, Desc->colour));
    #else
    Desc->id = Grid->Insert(wxT("Needle Colour"), wxSystemColourProperty(SectorName, wxPG_LABEL, Desc->colour));
    #endif
}

bool wxsAngularMeter::HandleChangeInSector(wxsPropertyGridManager *Grid, wxPGId id, int Position)
{

......
if( Grid->GetPropertyValueType( id) == _T("wxColourPropertyValue"))
{
wxColourPropertyValue* pcolval = wxDynamicCast(Grid->GetPropertyValueAsWxObjectPtr(id), wxColourPropertyValue);
Desc->colour = pcolval->m_colour;
}
Changed = true;
....

wxsangularregulator.cpp:

void wxsAngularRegulator::OnAddExtraProperties(wxsPropertyGridManager *Grid)
{
    #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
    Grid->SelectPage(0);
    #else
    Grid->SetTargetPage(0);
    #endif

    #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
    m_TagCountId = Grid->Insert(wxT("External Circle Colour"), new wxIntProperty(_("Number Of Tags"), wxPG_LABEL,
    #else
    m_TagCountId = Grid->Insert(wxT("External Circle Colour"), wxIntProperty(_("Number Of Tags"), wxPG_LABEL,
    #endif
                                                                    (int)m_arrTags.Count()));
....
}

void wxsAngularRegulator::OnExtraPropertyChanged(wxsPropertyGridManager *Grid, wxPGId id)
{
    #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
    Grid->SelectPage(0);
    #else
    Grid->SetTargetPage(0);
    #endif
.....
            // We have to remove some entries
            for(int i = NewValue;i < OldValue;i++)
            {
                #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
                Grid->DeleteProperty(m_arrTags[i]->id);
                #else
                Grid->Delete(m_arrTags[i]->id);
                #endif
                delete m_arrTags[i];
            }
...
}

void wxsAngularRegulator::InsertPropertyForTag(wxsPropertyGridManager *Grid, int Position)
{
    TagDesc *Desc = m_arrTags[Position];
    wxString sTagName = wxString::Format(_("Tag %d Value"), Position + 1);

    #if wxCHECK_VERSION(2, 9, 0) || wxCHECK_PROPGRID_VERSION(1, 4, 0)
    Desc->id = Grid->Insert(wxT("External Circle Colour"), new wxIntProperty(sTagName, wxPG_LABEL, Desc->val));
    #else
    Desc->id = Grid->Insert(wxT("External Circle Colour"), wxIntProperty(sTagName, wxPG_LABEL, Desc->val));
    #endif
}


--- End code ---

This change nearly by all the Files.

lcdclock and lcddisplay runs without changes but the bmpswitch won't work until today,
i will look at your source later;D

One Problem i can't change, at the moment, if you select one ctrl and put it in your window it isn't drawn until you resize it.
Some of the contrlos don't like to be resized like the Linearregulator and the AngularRegulator.

Br
Jonas

MortenMacFly:
...some additional stuff for wxLed:
This:

--- Code: ---    if( LedMatrixSize.X = -1)
        LedMatrixSize.X = 4;
    if( LedMatrixSize.Y = -1)
        LedMatrixSize.Y = 4;
    if( LedMatrix.X = -1)
        LedMatrix.X = 65;
    if( LedMatrix.Y = -1)
        LedMatrix.Y = 9;

--- End code ---
Doesn't look good to me. It should read:

--- Code: ---    if( LedMatrixSize.X [b]==[/b] -1)
        LedMatrixSize.X = 4;
    if( LedMatrixSize.Y [b]==[/b] -1)
        LedMatrixSize.Y = 4;
    if( LedMatrix.X [b]==[/b] -1)
        LedMatrix.X = 65;
    if( LedMatrix.Y [b]==[/b] -1)
        LedMatrix.Y = 9;

--- End code ---
I found this at least at two positions. Be careful not to mix C++ with another language's syntax!

ZinnJonas:
Hi Morten,

Thank you, yes i forgot the == and you need this only at one position ;D

ZinnJonas:
I've added SVN support:


--- Code: ---svn co https://wxledplugin.svn.sourceforge.net/svnroot/wxledplugin/trunk/wxSmithLed

--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version