COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :

Go Back   Cockos Incorporated Forums > Other Software Discussion > WDL users forum

Reply
 
Thread Tools Display Modes
Old 01-05-2017, 05:20 AM   #1
SaschArt
Human being with feelings
 
SaschArt's Avatar
 
Join Date: Aug 2013
Posts: 236
Default Check if OnParamChange was made by GUI

Can to check if changed parameter on OnParamChange() was made by GUI, mean knob or userPrompt ?
__________________
Audio plugins | BrainWaveProducer | EmRysRa
SaschArt is offline   Reply With Quote
Old 01-06-2017, 12:21 AM   #2
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,652
Default

I guess you could set a flag from your GUI control, and check and clear it in OnParamChange().
Tale is offline   Reply With Quote
Old 01-09-2017, 05:32 AM   #3
SaschArt
Human being with feelings
 
SaschArt's Avatar
 
Join Date: Aug 2013
Posts: 236
Default

Thanks,

How can I get the value of the mDown flag in OnParamChange()

Code:
class IButton : public IControl {
protected:
	IBitmap mBitmap;

public:
	bool mDown;

public:
	IButton(IPlugBase* pPlug, int paramIdx, int x, int y, IBitmap* pBitmap)
	: IControl(pPlug, &IRECT(x, y, pBitmap), paramIdx), mBitmap(*pBitmap) {}
	~IButton() {}

	bool Draw(IGraphics* pGraphics) {	
		if (mValue > 0.5)
			return pGraphics->DrawBitmap(&mBitmap, &mRECT);
		else return true;
	}
	void OnMouseDown(int x, int y, IMouseMod* pMod) {
		if (!pMod->R) {
			mValue=mValue>0.5 ? 0. : 1.;
		}
		mDown=true;
		SetDirty();
	}
};
__________________
Audio plugins | BrainWaveProducer | EmRysRa
SaschArt is offline   Reply With Quote
Old 01-09-2017, 10:46 AM   #4
stw
Human being with feelings
 
stw's Avatar
 
Join Date: Apr 2012
Posts: 279
Default

I wouldn't recommend to direct access a public variable of your class. If you really need mDown of every object you should do it with a simple setter/getter functions like:

Code:
bool GetIsClicked()  {return mDown;}
void UnClick()  {mDown = false;}
else you could rather do it like this:

Quote:
Originally Posted by SaschArt View Post
Code:
class IButton : public IControl {
protected:
	IBitmap mBitmap;

private:
	bool* mDown;

public:
	IButton(IPlugBase* pPlug, int paramIdx, int x, int y, IBitmap* pBitmap, bool* pIsClicked)
	: IControl(pPlug, &IRECT(x, y, pBitmap), paramIdx), mBitmap(*pBitmap), mDown(pIsClicked) {}
	~IButton() {}

	bool Draw(IGraphics* pGraphics) {	
		if (mValue > 0.5)
			return pGraphics->DrawBitmap(&mBitmap, &mRECT);
		else return true;
	}
	void OnMouseDown(int x, int y, IMouseMod* pMod) {
		if (!pMod->R) {
			mValue=mValue>0.5 ? 0. : 1.;
		}
		*mDown=true;
		SetDirty();
	}
};
Now you have to add the address of a bool variable of your plug to the constructor list when instantiating a control. This will contain the value of mDown. You have to set it to false again after doing your stuff in onParamChange()
...not tested but should work.
stw is offline   Reply With Quote
Old 01-09-2017, 03:26 PM   #5
SaschArt
Human being with feelings
 
SaschArt's Avatar
 
Join Date: Aug 2013
Posts: 236
Default

Thanks, working
__________________
Audio plugins | BrainWaveProducer | EmRysRa
SaschArt is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 11:11 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.