Example #1
0
void IRC::handle_msg(const string& chan, const string& nick, const string& login, const string& host, const string& omsg) {
    string msg = omsg;
    if(chan.find_first_of("#&+!") == 0) {
        //Channel Message
        onMessage(chan, nick, login, host, msg);
    } else {
        //Private Messages
        if(msg.find("\x001") == 0 && msg.rfind("\x001") == msg.length() - 1) {
            //CTCP
            msg = msg.substr(1, msg.length() - 2);
            if(msg.compare("TIME") == 0) {
                onTime(nick,login,host,chan);
            } else if(msg.compare("VERSION") == 0) {
                onVersion(nick,login,host,chan);
            } else if(msg.substr(0, 4).compare("PING") == 0) {
                onPing(nick,login,host,chan,msg.substr(5));
            } else if(msg.compare("FINGER") == 0) {
                onFinger(nick,login,host,chan);
            } else if(msg.substr(0, 6).compare("ACTION") == 0) {
                onAction(nick,login,host,chan,msg.substr(7));
            }

            return;
        }
        onPrivateMessage(nick, login, host, msg);
    }
}
Example #2
0
void GuiGradientCtrl::onRender(Point2I offset, const RectI& updateRect)
{
   if (mStateBlock.isNull())
   {
      GFXStateBlockDesc desc;
      desc.setBlend(true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
      desc.setZReadWrite(false);
      desc.zWriteEnable = false;
      desc.setCullMode(GFXCullNone);
      mStateBlock = GFX->createStateBlock( desc );
   }

   RectI boundsRect(offset, getExtent()); 
   renderColorBox(boundsRect);

   if (mPositionChanged) 
   {
      mPositionChanged = false;

      // Now do onAction() if we are allowed
      if (mActionOnMove) 
			onAction();  
   }
   
   //render the children
   renderChildControls( offset, updateRect);
}
void TextEdit::onKeyUp(const Event &event)
{
   event;
   setVariable(text);
   setUpdate();
   onAction();
}
	void PropertyFieldColour::setColour(const MyGUI::Colour& _color, bool _final)
	{
		std::string value = MyGUI::utility::toString(_color.red, " ", _color.green, " ", _color.blue);
		mField->setOnlyText(value);
		onCheckValue();
		onAction(value, _final);
	}
Example #5
0
Juff::ActionList PythonPlugin::getActions() const {
	Juff::ActionList list;
	PyObject* func = getFunction("getAction");
	
	if ( func != NULL ) {
		int index = 0;
		PyObject* arg = PyTuple_New(1);
		PyObject* res;
		while ( true ) {
			addArgument(arg, 0, index);
			res = PyObject_CallObject(func, arg);
			
			QString str = QString::fromUtf8(PyString_AsString(res));
//			qDebug() << str;
			if ( str.isEmpty() ) {
				break;
			}
			
			QStringList fields = str.split('|');
			if ( fields.count() >= 3 ) {
				QAction* action = new QAction(fields[0], NULL);
				action->setShortcut(QKeySequence(fields[1]));
				action->setData(fields[2]);
				connect(action, SIGNAL(triggered()), SLOT(onAction()));
				list << action;
			}
			
			++index;
			Py_DECREF(res);
		}
		Py_DECREF(arg);
	}
	return list;
}
Example #6
0
void GuiGradientCtrl::onMouseDown(const GuiEvent &event)
{
   if (!mActive)
      return;
   
   mouseLock(this);
   
   if (mProfile->mCanKeyFocus)
      setFirstResponder();
	
	if (mActive) 
      onAction();

	Point2I extent = getRoot()->getExtent();
   Point2I resolution = getRoot()->getExtent();
   GFXTexHandle bb( resolution.x, 
                    resolution.y, 
                    GFXFormatR8G8B8A8, &GFXDefaultRenderTargetProfile, avar("%s() - bb (line %d)", __FUNCTION__, __LINE__) );
   
   Point2I tmpPt( event.mousePoint.x, event.mousePoint.y );
   GFXTarget *targ = GFX->getActiveRenderTarget();
   targ->resolveTo( bb );
   GBitmap bmp( bb.getWidth(), bb.getHeight() );
   bb.copyToBmp( &bmp );
   ColorI tmp;
   bmp.getColor( event.mousePoint.x, event.mousePoint.y, tmp );
	
	addColorRange( globalToLocalCoord(event.mousePoint), ColorF(tmp) );
   
   mMouseDown = true;
}
void GuiColorPickerCtrl::onRender(Point2I offset, const RectI& updateRect)
{
   if (mStateBlock.isNull())
   {
      GFXStateBlockDesc desc;
      desc.setBlend(true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
      desc.setZReadWrite(false);
      desc.zWriteEnable = false;
      desc.setCullMode(GFXCullNone);
      mStateBlock = GFX->createStateBlock( desc );
   }

   RectI boundsRect(offset, getExtent()); 
   renderColorBox(boundsRect);

   if (mPositionChanged) 
   {
      mPositionChanged = false;
      Point2I extent = getRoot()->getExtent();
      // If we are anything but a pallete, change the pick color
      if (mDisplayMode != pPallet)
      {
         Point2I resolution = getRoot()->getExtent();

         U32 buf_x = offset.x + mSelectorPos.x + 1;
         U32 buf_y = ( extent.y - ( offset.y + mSelectorPos.y + 1 ) );
         if(GFX->getAdapterType() != OpenGL)
            buf_y = resolution.y - buf_y;

         GFXTexHandle bb( resolution.x, 
                          resolution.y, 
                          GFXFormatR8G8B8A8, &GFXDefaultRenderTargetProfile, avar("%s() - bb (line %d)", __FUNCTION__, __LINE__) );
         
         Point2I tmpPt( buf_x, buf_y );

         GFXTarget *targ = GFX->getActiveRenderTarget();
         targ->resolveTo( bb );
         
         GBitmap bmp( bb.getWidth(), bb.getHeight() );

         bb.copyToBmp( &bmp );
         
         //bmp.writePNGDebug( "foo.png" );

         ColorI tmp;
         bmp.getColor( buf_x, buf_y, tmp );

         mPickColor = (ColorF)tmp;

         // Now do onAction() if we are allowed
         if (mActionOnMove) 
            onAction();
      }
      
   }
   
   //render the children
   renderChildControls( offset, updateRect);
}
Example #8
0
	void PropertyFieldComboBox::notifyApplyProperties(MyGUI::Widget* _sender)
	{
		std::string DEFAULT_VALUE = replaceTags("ColourDefault") + DEFAULT_STRING;
		std::string value = mField->getOnlyText();

		if (value == DEFAULT_STRING && mField->getCaption() == DEFAULT_VALUE)
			value = "";

		onAction(value, true);
	}
  void PropertyFieldPosition::notifyApplyProperties(MyGUI::Widget* _sender, bool _force)
  {
    std::string DEFAULT_VALUE = replaceTags("ColourDefault") + DEFAULT_STRING;

    std::string value = mField->getOnlyText();
    if (value == DEFAULT_STRING && mField->getCaption() == DEFAULT_VALUE)
      value = "";

    onAction(value, _force);

    UndoManager::getInstance().addValue(PR_PROPERTIES);
  }
void ArrayCtrl::onKeyDown(const Event &event)
{
   if(!active)
   {
      Parent::onKeyDown(event);
      return;
   }

   Point2I delta(0,0);

   switch(event.diKeyCode)
   {
      case DIK_LEFT:
         delta.set(-1, 0);
         break;
      case DIK_RIGHT:
         delta.set(1, 0);
         break;
      case DIK_UP:
         delta.set(0, -1);
         break;
      case DIK_DOWN:
         delta.set(0, 1);
         break;
      default:
         Parent::onKeyDown(event);
         return;
   }
   if(size.x < 1 || size.y < 1)
      return;

   if(selectedCell.x == -1 || selectedCell.y == -1)
   {
      cellSelected(Point2I(0,0));
      return;
   }
   Point2I cell = selectedCell;
   cell += delta;

   while(cell.x >= 0 && cell.x < size.x && cell.y >= 0 && cell.y < size.y)
   {
      if(cellSelected(cell))
      {
         onAction();
         break;
      }
      cell += delta;
   }
}
	void PropertyFieldEditBox::notifyApplyProperties(MyGUI::Widget* _sender, bool _force)
	{
		std::string DEFAULT_VALUE = replaceTags("ColourDefault") + DEFAULT_STRING;

		std::string value = mField->getOnlyText();
		if (value == DEFAULT_STRING && mField->getCaption() == DEFAULT_VALUE)
			value = "";

		bool goodData = onCheckValue();

		if (goodData || _force)
		{
			onAction(value, true);
		}
	}
void GuiButtonBaseCtrl::acceleratorKeyRelease(U32)
{
   if (! mActive)
      return;

   if (mDepressed)
   {
      //set the bool
      mDepressed = false;
      //perform the action
      onAction();
   }

   //update
   setUpdate();
}
bool GuiButtonBaseCtrl::onKeyUp(const GuiEvent &event)
{
   //if the control is a dead end, kill the event
   if (!mActive)
      return true;

   //see if the key down is a return or space or not
   if (mDepressed &&
      (event.keyCode == KEY_RETURN || event.keyCode == KEY_SPACE) &&
      event.modifier == 0)
   {
      onAction();
      return true;
   }

   //otherwise, pass the event to it's parent
   return Parent::onKeyUp(event);
}
void GuiButtonBaseCtrl::onMouseUp(const GuiEvent &event)
{
   mouseUnlock();

   if( !mActive )
      return;
   
   setUpdate();

   if( mUseMouseEvents )
      onMouseUp_callback();

   //if we released the mouse within this control, perform the action
   if( mDepressed )
      onAction();

   mDepressed = false;
   mMouseDragged = false;
}
Example #15
0
static PDDebugState update(void* userData, PDAction action, PDReader* reader, PDWriter* writer)
{
    PluginData* plugin = (PluginData*)userData;

    plugin->hasUpdatedRegistes = false;
    plugin->hasUpdatedExceptionLocation = false;

    onAction(plugin, action);

    processEvents(plugin, reader, writer);

	updateEvents(plugin, writer);

    if (plugin->hasUpdatedRegistes)
    {
        PDWrite_eventBegin(writer, PDEventType_setRegisters);
        PDWrite_arrayBegin(writer, "registers");

        writeStatusRegister(writer, "flags", plugin->regs.flags);
        writeRegister(writer, "pc", 2, plugin->regs.pc, 1);
        writeRegister(writer, "sp", 1, plugin->regs.sp, 0);
        writeRegister(writer, "a", 1, plugin->regs.a, 0);
        writeRegister(writer, "x", 1, plugin->regs.x, 0);
        writeRegister(writer, "y", 1, plugin->regs.y, 0);

        PDWrite_arrayEnd(writer);
        PDWrite_eventEnd(writer);
    }

    if (plugin->hasUpdatedExceptionLocation)
    {
        PDWrite_eventBegin(writer, PDEventType_setExceptionLocation);
        PDWrite_u64(writer, "address", plugin->regs.pc);
        PDWrite_u8(writer, "address_size", 2);
        PDWrite_eventEnd(writer);
    }

    return plugin->state;
}
Example #16
0
//--------------------------------------------------------------------------
void GuiColorPickerCtrl::onMouseDown(const GuiEvent &event)
{
   if (!mActive)
      return;
   
   if (mDisplayMode == pDropperBackground)
      return;

   mouseLock(this);
   
   if (mProfile->mCanKeyFocus)
      setFirstResponder();
	
	if (mActive && (mDisplayMode != pDropperBackground)) 
      onAction();

   // Update the picker cross position
   if (mDisplayMode != pPallet)
      setSelectorPos(globalToLocalCoord(event.mousePoint)); 
   
   mMouseDown = true;
}
	void PropertyFieldColour::notifyEndDialog(Dialog* _sender, bool _result)
	{
		mColourPanel->endModal();

		if (_result)
		{
			setColour(mColourPanel->getColour(), true);
		}
		else
		{
			if (mGoodData)
			{
				setColour(mPreviewColour, true);
			}
			else
			{
				std::string DEFAULT_VALUE = replaceTags("ColourDefault") + DEFAULT_STRING;
				mField->setCaption(DEFAULT_VALUE);
				updateColourPlace(false);
				onAction("", true);
			}
		}
	}
Example #18
0
void GuiColorPickerCtrl::onRender(Point2I offset, const RectI& updateRect)
{
   if (mStateBlock.isNull())
   {
      GFXStateBlockDesc desc;
      desc.setBlend(true, GFXBlendSrcAlpha, GFXBlendInvSrcAlpha);
      desc.setZReadWrite(false);
      desc.zWriteEnable = false;
      desc.setCullMode(GFXCullNone);
      mStateBlock = GFX->createStateBlock(desc);
   }

   RectI boundsRect(offset, getExtent());
   renderColorBox(boundsRect);

   if (mPositionChanged || mBitmap == NULL)
   {
      bool nullBitmap = false;

      if (mPositionChanged == false && mBitmap == NULL)
         nullBitmap = true;

      mPositionChanged = false;
      Point2I extent = getRoot()->getExtent();

      // If we are anything but a pallete, change the pick color
      if (mDisplayMode != pPallet)
      {
         Point2I resolution = getRoot()->getExtent();

         U32 buf_x = offset.x + mSelectorPos.x + 1;
         U32 buf_y = resolution.y - (extent.y - (offset.y + mSelectorPos.y + 1));

         GFXTexHandle bb( resolution.x, resolution.y, GFXFormatR8G8B8A8, &GFXDefaultRenderTargetProfile, avar("%s() - bb (line %d)", __FUNCTION__, __LINE__) );

         Point2I tmpPt(buf_x, buf_y);

         GFXTarget *targ = GFX->getActiveRenderTarget();
         targ->resolveTo(bb);

         if (mBitmap)
         {
            delete mBitmap;
            mBitmap = NULL;
         }

         mBitmap = new GBitmap(bb.getWidth(), bb.getHeight());

         bb.copyToBmp(mBitmap);

         if (!nullBitmap)
         {
            if (mSelectColor)
            {
               Point2I pos = findColor(mSetColor, offset, resolution, *mBitmap);
               mSetColor = mSetColor.BLACK;
               mSelectColor = false;
               setSelectorPos(pos);
            }
            else
            {
               ColorI tmp;
               mBitmap->getColor(buf_x, buf_y, tmp);

               mPickColor = (ColorF)tmp;

               // Now do onAction() if we are allowed
               if (mActionOnMove)
                  onAction();
            }
         }
      }
   }

   //render the children
   renderChildControls(offset, updateRect);
}