コード例 #1
0
ファイル: object.cpp プロジェクト: Garfield-Chen/tng
	void Object::SaveToJson(JsonObject& json)const
	{
		for (PropertySet::PropertyMap::iterator it = GetPropertySet()->Begin();
			it != GetPropertySet()->End();
			it++)
		{
			json[it->first.c_str()] = Get(it->first).c_str();
		}

	}
コード例 #2
0
ファイル: object.cpp プロジェクト: Garfield-Chen/tng
	void Object::LoadFromJson(const JsonObject& obj)
	{
		for (PropertySet::PropertyMap::iterator it = GetPropertySet()->Begin();
			it != GetPropertySet()->End();
			it++)
		{
			if (obj.HasMember(it->first.c_str()))
			{
				Set(it->first, obj[it->first.c_str()].GetString());
			}
		}
	}
コード例 #3
0
ファイル: coled.cpp プロジェクト: BackupTheBerlios/bvr20983
    STDMETHODIMP COLED::put_FillColor(OLE_COLOR color)
    { HRESULT hr = NOERROR;

      if( NULL!=m_pWnd )
      { try
        { GetPropertySet().Add(_T("fillcolor"),color);

          if( NULL!=m_pWnd )
          { COLORREF c;

            ::OleTranslateColor(color,NULL,&c);
            ((LEDWnd*)m_pWnd)->SetForegroundColor1(c,true); 
          } // of if
        }
        catch(const BVR20983Exception& e)
        { LOGGER_ERROR<<e<<endl;
          
          hr = e.GetErrorCode();
        }
        catch(...)
        { hr = Exception(BVR_SOURCE_LED,E_FAIL); }
      } // of else

      return hr;
    } // of COLED::put_FillColor()
コード例 #4
0
ファイル: coled.cpp プロジェクト: BackupTheBerlios/bvr20983
    STDMETHODIMP COLED::get_Text(BSTR *pText)
    { HRESULT hr = NOERROR;

      if( NULL==pText )
        hr = Exception(BVR_SOURCE_LED,E_POINTER);
      else 
      { try
        { TString s;

          if( NULL!=m_pWnd )
          { ((LEDWnd*)m_pWnd)->GetText(s); 
            
            *pText = ::SysAllocString(s.c_str());
          } // of if
          else
            GetPropertySet().Get(_T("text"),pText); 
        }
        catch(const BVR20983Exception& e)
        { LOGGER_ERROR<<e<<endl;
          
          hr = e.GetErrorCode();
        }
        catch(...)
        { hr = Exception(BVR_SOURCE_LED,E_FAIL); }
      } // of else

      return hr;
    } // of COLED::get_Text()
コード例 #5
0
ファイル: coled.cpp プロジェクト: BackupTheBerlios/bvr20983
    STDMETHODIMP COLED::get_Display16Segment(VARIANT_BOOL *pDisplay16Segment)
    { HRESULT hr = NOERROR;

      if( NULL==pDisplay16Segment )
        hr = Exception(BVR_SOURCE_LED,E_POINTER);
      else 
        hr = GetPropertySet().Get(_T("16segment"),pDisplay16Segment) ? NOERROR : E_FAIL;

      return hr;
    } // of COLED::get_Display16Segment()
コード例 #6
0
ファイル: coled.cpp プロジェクト: BackupTheBerlios/bvr20983
    STDMETHODIMP COLED::get_Display24Hour(VARIANT_BOOL *pDisplay24Hour)
    { HRESULT hr = NOERROR;

      if( NULL==pDisplay24Hour )
        hr = Exception(BVR_SOURCE_LED,E_POINTER);
      else
        hr = GetPropertySet().Get(_T("24hour"),pDisplay24Hour) ? NOERROR : E_FAIL;

      return hr;
    } // of COLED::get_Display24Hour()
コード例 #7
0
ファイル: coled.cpp プロジェクト: BackupTheBerlios/bvr20983
    STDMETHODIMP COLED::get_Suppress0(VARIANT_BOOL *pSuppress0)
    { HRESULT hr = NOERROR;

      if( NULL==pSuppress0 )
        hr = Exception(BVR_SOURCE_LED,E_POINTER);
      else
        hr = GetPropertySet().Get(_T("suppress0"),pSuppress0) ? NOERROR : E_FAIL;

      return hr;
    } // of COLED::get_Suppress0()
コード例 #8
0
ファイル: coled.cpp プロジェクト: BackupTheBerlios/bvr20983
    STDMETHODIMP COLED::get_Clock(VARIANT_BOOL *pClock)
    { HRESULT hr = NOERROR;

      if( NULL==pClock )
        hr = Exception(BVR_SOURCE_LED,E_POINTER);
      else
        hr = GetPropertySet().Get(_T("clock"),pClock) ? NOERROR : E_FAIL;

      return hr;
    } // of COLED::get_Clock()
コード例 #9
0
ファイル: coled.cpp プロジェクト: BackupTheBerlios/bvr20983
    STDMETHODIMP COLED::get_FillColor(OLE_COLOR* pColor)
    { HRESULT hr = NOERROR;

      if( NULL==pColor )
        hr = Exception(BVR_SOURCE_LED,E_POINTER);
      else 
        hr = GetPropertySet().Get(_T("fillcolor"),*pColor) ? NOERROR : E_FAIL;

      return hr;
    } // of COLED::get_FillColor()
コード例 #10
0
ファイル: coled.cpp プロジェクト: BackupTheBerlios/bvr20983
    STDMETHODIMP COLED::put_Display16Segment(VARIANT_BOOL display16Segment)
    { HRESULT hr = NOERROR;

      try
      { GetPropertySet().Add(_T("16segment"),display16Segment==VARIANT_TRUE);

        if( NULL!=m_pWnd )
          ((LEDWnd*)m_pWnd)->Set16Segment( display16Segment==VARIANT_TRUE );
      } 
      catch(const BVR20983Exception& e)
      { LOGGER_ERROR<<e<<endl;
        
        hr = e.GetErrorCode();
      }
      catch(...)
      { hr = Exception(BVR_SOURCE_LED,E_FAIL); }

      return hr;
    } // of COLED::put_Display16Segment()
コード例 #11
0
ファイル: coled.cpp プロジェクト: BackupTheBerlios/bvr20983
    STDMETHODIMP COLED::put_Suppress0(VARIANT_BOOL suppress0)
    { HRESULT hr = NOERROR;

      try
      { GetPropertySet().Add(_T("suppress0"),suppress0==VARIANT_TRUE);
        
        if( NULL!=m_pWnd )
          ((LEDWnd*)m_pWnd)->SetZeroSuppress( suppress0==VARIANT_TRUE ); 
      }
      catch(const BVR20983Exception& e)
      { LOGGER_ERROR<<e<<endl;
        
        hr = e.GetErrorCode();
      }
      catch(...)
      { hr = Exception(BVR_SOURCE_LED,E_FAIL); }

      return hr;
    } // of COLED::put_Suppress0()
コード例 #12
0
ファイル: coled.cpp プロジェクト: BackupTheBerlios/bvr20983
    STDMETHODIMP COLED::put_Clock(VARIANT_BOOL clock)
    { HRESULT hr = NOERROR;

      try
      { GetPropertySet().Add(_T("clock"),clock==VARIANT_TRUE);
        
        if( NULL!=m_pWnd )
          ((LEDWnd*)m_pWnd)->SetClock( clock==VARIANT_TRUE ); 

        PropertyNotifyOnChanged(DISPID_LED_CLOCK);
      }
      catch(const BVR20983Exception& e)
      { LOGGER_ERROR<<e<<endl;
        
        hr = e.GetErrorCode();
      }
      catch(...)
      { hr = Exception(BVR_SOURCE_LED,E_FAIL); }

      return hr;
    } // of COLED::put_Clock()
コード例 #13
0
ファイル: coled.cpp プロジェクト: BackupTheBerlios/bvr20983
    STDMETHODIMP COLED::put_Text(BSTR text)
    { HRESULT hr = NOERROR;

      try
      { GetPropertySet().Add(_T("text"),text);

        if( NULL!=m_pWnd )
          ((LEDWnd*)m_pWnd)->SetText(text); 

        PropertyNotifyOnChanged(DISPID_TEXT);
      }
      catch(const BVR20983Exception& e)
      { LOGGER_ERROR<<e<<endl;
        
        hr = e.GetErrorCode();
      }
      catch(...)
      { hr = Exception(BVR_SOURCE_LED,E_FAIL); }

      return hr;
    } // of COLED::put_Text()
コード例 #14
0
ファイル: coled.cpp プロジェクト: BackupTheBerlios/bvr20983
     COLED::COLED(IUnknown* pUnkOuter) 
      : COControl(_T("LEDCOControl"),
                  pUnkOuter,
                  (ILED*)this,
                  LIBID_BVR20983_0_CC,
                  IID_ILED,
                  CLSID_LED,DIID_DLEDEvent
                 )
    { 
      GetPropertySet().AddPropertyName(_T("16segment"));
      GetPropertySet().AddPropertyName(_T("clock"));
      GetPropertySet().AddPropertyName(_T("24hour"));
      GetPropertySet().AddPropertyName(_T("suppress0"));
      GetPropertySet().AddPropertyName(_T("text"));
      GetPropertySet().AddPropertyName(_T("fgcolor"));
      GetPropertySet().AddPropertyName(_T("bgcolor"));
      GetPropertySet().AddPropertyName(_T("fillcolor"));

      GetPropertySet().AddPropertyName(_T("transparent"));
      GetPropertySet().AddPropertyName(_T("windowless"));
      GetPropertySet().AddPropertyName(_T("usethread"));
      GetPropertySet().AddPropertyName(_T("drawdirectinthread"));

      InitializeControl();
    } // of COLED::COLED()
コード例 #15
0
ファイル: coled.cpp プロジェクト: BackupTheBerlios/bvr20983
    HRESULT COLED::InitializeControl()
    { GetPropertySet().Add(_T("16segment"),false);
      GetPropertySet().Add(_T("24hour"),true);
      GetPropertySet().Add(_T("clock"),true);
      GetPropertySet().Add(_T("suppress0"),false);
      GetPropertySet().Add(_T("transparent"),false);
      GetPropertySet().Add(_T("windowless"),false);
      GetPropertySet().Add(_T("usethread"),false);
      GetPropertySet().Add(_T("drawdirectinthread"),false);

      GetPropertySet().Add(_T("text"),_T("LED"));
      GetPropertySet().Add(_T("fgcolor"),RGB(255,0,0));
      GetPropertySet().Add(_T("bgcolor"),RGB(0,0,0));
      GetPropertySet().Add(_T("fillcolor"),WND_NULLCOLOR);
      
      return S_OK; 
    } // of COLED::InitializeControl()
コード例 #16
0
ファイル: coled.cpp プロジェクト: BackupTheBerlios/bvr20983
    bool COLED::CreateInPlaceWindow(HWND hWndParent,const RECT& rcPos)
    { bool            result      = true;
      bool            clock       = false;
      bool            _24hour     = false;
      bool            suppress0   = false;
      bool            _16segment  = false;
      bool            windowless  = false;
      bool            usethread   = false;
      bool            directdraw  = false;
      bool            transparent = false;
      OLE_COLOR       bgColor     = WND_NULLCOLOR;
      OLE_COLOR       fgColor     = RGB(0,128,0);
      OLE_COLOR       fillColor   = WND_NULLCOLOR;
      int             wndStyle    = WS_VISIBLE | WS_CHILD | WS_TABSTOP;

      GetPropertySet().Get(_T("windowless"),windowless);
      GetPropertySet().Get(_T("transparent"),transparent);
      GetPropertySet().Get(_T("usethread"),usethread);
      GetPropertySet().Get(_T("drawdirectinthread"),directdraw);
      GetPropertySet().Get(_T("clock"),clock);
      GetPropertySet().Get(_T("24hour"),_24hour);
      GetPropertySet().Get(_T("suppress0"),suppress0);
      GetPropertySet().Get(_T("16segment"),_16segment);

      if( clock      ) wndStyle |= LEDS_CLOCK;
      if( _24hour    ) wndStyle |= LEDS_24HOUR;
      if( suppress0  ) wndStyle |= LEDS_SUPPRESS;
      if( _16segment ) wndStyle |= LEDS_16SEGEGMENT;

      windowless = m_myControlClass->m_isWindowless && windowless;

      LEDCREATESTRUCT ledCS;

      ::memset(&ledCS,'\0',sizeof(ledCS));
      ledCS.magic              = LEDWNDMAGIC;
      ledCS.dwSize             = sizeof(LEDCREATESTRUCT);

      ledCS.bgColor            = WND_NULLCOLOR;
      ledCS.fgColor            = WND_NULLCOLOR;
      ledCS.fgColor1           = WND_NULLCOLOR;

      if( bgColor!=bgColor )   ::OleTranslateColor(bgColor,NULL,&ledCS.bgColor);
      if( fgColor!=bgColor )   ::OleTranslateColor(fgColor,NULL,&ledCS.fgColor);
      if( fillColor!=bgColor ) ::OleTranslateColor(fillColor,NULL,&ledCS.fgColor1);

      ledCS.initialStart       = false;
      ledCS.useThread          = usethread;
      ledCS.drawDirectInThread = directdraw;

      m_size.cx = rcPos.right  - rcPos.left;
      m_size.cy = rcPos.bottom - rcPos.top;

      OLE_COLOR    olecolor;

      if( transparent && windowless )
        ledCS.bgColor = WND_NULLCOLOR;
      else if( ledCS.bgColor==WND_NULLCOLOR && GetAmbientProperty(DISPID_AMBIENT_BACKCOLOR,VT_I4,&olecolor) )
        ::OleTranslateColor(olecolor,NULL,&ledCS.bgColor);

      if( ledCS.fgColor==WND_NULLCOLOR && GetAmbientProperty(DISPID_AMBIENT_FORECOLOR,VT_I4,&olecolor) )
        ::OleTranslateColor(olecolor,NULL,&ledCS.fgColor);

      ledCS.pStatusCB = (ILEDStatus*)this;

      m_pWnd = Wnd::Construct(LEDWNDCLS,_T("coled"),0,
                              wndStyle,
                              rcPos.left,rcPos.top,
                              m_size.cx, m_size.cy,
                              hWndParent,
                              &ledCS,
                              NULL,
                              COMServer::GetInstanceHandle(),
                              m_pClientSite,
                              windowless
                             );

      result = m_pWnd!=NULL;

      if( NULL!=m_pWnd )
      { LEDWnd* pWnd = (LEDWnd*)m_pWnd;

        if( pWnd->IsWindowless() && !usethread )
          pWnd->SetUseThread(true);
      } // of if

      if( result && NULL!=m_pClientSite )
        m_pClientSite->ShowObject();

      PropertyNotifyOnChanged(DISPID_READYSTATE);
      TriggerEvent(&m_eventInfo[Event_ReadyStateChange]);

      return result;
    } // of COLED::CreateInPlaceWindow()