Code Monkey home page Code Monkey logo

Comments (3)

raygit83 avatar raygit83 commented on June 2, 2024

Here's a minimal example:

class AGainEditor : public VSTGUIEditor, public IControlListener
{
        enum
        {
            kWidth = 400,
            kHeight = 400,
            kButton1 = 'btn1',
            kButton2 = 'btn2'
        };
            
        public:
            AGainEditor (void* controller) :
                VSTGUIEditor(controller)
            {
                ViewRect vr(0, 0, kWidth, kHeight);
                setRect(vr);
            }
            
            virtual ~AGainEditor () {}
            
            virtual bool PLUGIN_API open (void* parent, const VSTGUI::PlatformType& platformType) SMTG_OVERRIDE
            {
                auto r = getRect();
                CRect size(r.left, r.top, r.right, r.bottom);
                
                auto oldFrame = frame;
                frame = new CFrame(size, this);
                if(oldFrame)
                    oldFrame->forget();
                
                if(frame->open(parent, platformType))
                {
                    frame->setBackgroundColor(kBlueCColor);
                    
                    CRect buttonSize(0, 0, 120, 20);
                    
                    buttonSize.centerInside(size);
                    buttonSize.offset(CPoint(-buttonSize.getWidth() / 2 - 2, 0));
                    auto button1 = new CTextButton(buttonSize, this, kButton1, "zoomFactor = 1", CTextButton::Style::kKickStyle);
                    frame->addView(button1);
                    
                    buttonSize.centerInside(size);
                    buttonSize.offset(CPoint(+buttonSize.getWidth() / 2 + 2, 0));
                    auto button2 = new CTextButton(buttonSize, this, kButton2, "zoomFactor = 2");
                    frame->addView(button2);
                    
                    return true;
                }
                
                return false;
            }
            
            virtual void PLUGIN_API close () SMTG_OVERRIDE
            {
                if(frame)
                {
                    frame->close();
                    frame = nullptr;
                }
            }
            
            virtual void valueChanged (CControl* pControl) SMTG_OVERRIDE
            {
                int tag = pControl->getTag();
                float value = pControl->getValue();
                if(value > 0.5f)
                {
                    if(tag == kButton1)
                    {
                        frame->setZoom(1.0);
                    }
                    
                    else if(tag == kButton2)
                    {
                        frame->setZoom(2.0);
                    }
                }
            }
            
            bool beforeSizeChange(const CRect& newSize, const CRect& oldSize) SMTG_OVERRIDE
            {
                static bool resizeGuard = false;
                bool result = resizeGuard;

                if(plugFrame && !result)
                {
                    resizeGuard = true;
                    ViewRect vr;
                    vr.right = int32(newSize.getWidth());
                    vr.bottom = int32(newSize.getHeight());
                    result = (plugFrame->resizeView(this, &vr) == kResultTrue);
                    resizeGuard = false;
                }

                return result;
            }
};

from vst3sdk.

scheffle avatar scheffle commented on June 2, 2024

Will be fixed with the next SDK update.

from vst3sdk.

raygit83 avatar raygit83 commented on June 2, 2024

Okay, that's great news. Out of curiosity: Any hints on how you fixed this? Can I review the respective commit somewhere? Thanks.

from vst3sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.