コード例 #1
0
ファイル: dlgRule.cpp プロジェクト: douglasresende/pgadmin3
void dlgRule::CheckChange()
{
    if (rule)
    {
        EnableOK(didChange() || txtSqlBox->GetText() != oldDefinition || txtComment->GetValue() != rule->GetComment());
    }
    else
    {
        wxString name = GetName();

        bool enable = true;

        CheckValid(enable, !name.IsEmpty(), _("Please specify name."));
        CheckValid(enable, rbxEvent->GetSelection() >= 0,
                   _("Please select at an event."));
        CheckValid(enable, !txtSqlBox->GetTextLength() || txtSqlBox->GetTextLength() > 6 , _("Please enter function definition."));

        EnableOK(enable);
    }
}
コード例 #2
0
ファイル: nuiSpriteView.cpp プロジェクト: jbl2024/nui3
void nuiSprite::DelMatrixNode(uint32 index)
{
  if (!mpMatrixNodes)
    return;
  
  CheckValid();
  mpMatrixNodes->at(index)->Release();
  mpMatrixNodes->erase(mpMatrixNodes->begin() + index);
  
  DebugRefreshInfo();
}
コード例 #3
0
ファイル: bitmap.cpp プロジェクト: Darkman-M59/Meridian59_115
//
/// Creates a bitmap object with the values found in the given bitmap structure.
/// This overload is deprecated. Use the overload that takes a reference instead.
//
TBitmap::TBitmap(const BITMAP * bitmap)
{
  PRECONDITION(bitmap);
  Handle = ::CreateBitmapIndirect((LPBITMAP)bitmap);  // API cast
  WARNX(OwlGDI, !Handle, 0, "Cannot create bitmap from BITMAP @" <<
        hex << (void*)bitmap);
  CheckValid();
  RefAdd(Handle, Bitmap);
  TRACEX(OwlGDI, OWL_CDLEVEL, "TBitmap constructed @" << (void*)this << " from BITMAP @" <<
         (void*)bitmap << ".");
}
コード例 #4
0
nuiContainer::Iterator* nuiSimpleContainer::GetFirstChild(bool DoRefCounting)
{
  CheckValid();
  IteratorPtr pIt;
  pIt = new nuiSimpleContainerIterator(this, DoRefCounting);
  bool valid = !mpChildren.empty();
  pIt->SetValid(valid);
  if (valid)
    ((nuiSimpleContainerIterator*)pIt)->SetIndex(0);
  return pIt;
}
コード例 #5
0
ファイル: nuiSpriteView.cpp プロジェクト: jbl2024/nui3
int32 nuiSpriteDef::GetAnimation(const nglString& rName) const
{
  CheckValid();
  for (int32 i = 0; i < GetAnimationCount(); i++)
  {
    const nuiSpriteAnimation* pAnim = GetAnimation(i);
    if (pAnim->GetName() == rName)
      return i;
  }
  return 0;
}
コード例 #6
0
ファイル: CBundle.cpp プロジェクト: Kubiria/SekaiFramework
	void CBundle::ForceUngetService(CServiceRegistration* service)
	{
		THREAD_ANY();
		VERBOSE("WARNING [%s] Stale service reference", m_location.c_str());

		/// \todo verify
		CheckValid();

		TServicesInUseContainer::iterator it = m_servicesInUse.find(service);
		ASSERT_STRICT(it != m_servicesInUse.end());
		it->second.Reset();
	}
コード例 #7
0
ファイル: ByteBuffer.cpp プロジェクト: Xury/MCServer
bool cByteBuffer::SkipRead(int a_Count)
{
	CHECK_THREAD;
	CheckValid();
	ASSERT(a_Count >= 0);
	if (!CanReadBytes(a_Count))
	{
		return false;
	}
	AdvanceReadPos(a_Count);
	return true;
}
コード例 #8
0
ファイル: dlgTablespace.cpp プロジェクト: xiul/pgadmin3
void dlgTablespace::CheckChange()
{
	bool enable = true;
	if (tablespace)
	{
		enable = txtComment->GetValue() != tablespace->GetComment()
		         || GetName() != tablespace->GetName()
		         || cbOwner->GetValue() != tablespace->GetOwner()
		         || dirtyVars;
		if (seclabelPage && connection->BackendMinimumVersion(9, 2))
			enable = enable || !(seclabelPage->GetSqlForSecLabels().IsEmpty());
	}
	else
	{
		wxString name = GetName();

		CheckValid(enable, !GetName().IsEmpty(), _("Please specify name."));
		CheckValid(enable, !txtLocation->GetValue().IsEmpty(), _("Please specify location."));
	}
	EnableOK(enable);
}
コード例 #9
0
ファイル: ByteBuffer.cpp プロジェクト: Xury/MCServer
/// Returns the number of bytes that are currently available for reading (may be less than UsedSpace due to some data having been read already)
int cByteBuffer::GetReadableSpace(void) const
{
	CHECK_THREAD;
	CheckValid();
	if (m_ReadPos > m_WritePos)
	{
		// Wrap around the buffer end:
		return m_BufferSize - m_ReadPos + m_WritePos;
	}
	// Single readable space partition:
	return m_WritePos - m_ReadPos ;
}
コード例 #10
0
ファイル: ByteBuffer.cpp プロジェクト: Xury/MCServer
int cByteBuffer::GetFreeSpace(void) const
{
	CHECK_THREAD;
	CheckValid();
	if (m_WritePos >= m_DataStart)
	{
		// Wrap around the buffer end:
		return m_BufferSize - m_WritePos + m_DataStart - 1;
	}
	// Single free space partition:
	return m_DataStart - m_WritePos - 1;
}
コード例 #11
0
ファイル: ByteBuffer.cpp プロジェクト: Xury/MCServer
bool cByteBuffer::WriteBEUTF16String16(const AString & a_Value)
{
	CHECK_THREAD;
	CheckValid();
	PUTBYTES(2);
	AString UTF16BE;
	UTF8ToRawBEUTF16(a_Value.data(), a_Value.size(), UTF16BE);
	WriteBEShort((short)(UTF16BE.size() / 2));
	PUTBYTES(UTF16BE.size());
	WriteBuf(UTF16BE.data(), UTF16BE.size());
	return true;
}
コード例 #12
0
void dlgTextSearchParser::CheckChange()
{
	if (parser)
	{
		EnableOK(txtName->GetValue() != parser->GetName()
		         || cbSchema->GetValue() != parser->GetSchema()->GetName()
		         || txtComment->GetValue() != parser->GetComment());
	}
	else
	{
		wxString name = GetName();
		bool enable = true;
		CheckValid(enable, !name.IsEmpty(), _("Please specify name."));
		CheckValid(enable, cbStart->GetValue().Length() > 0 , _("Please select a start function."));
		CheckValid(enable, cbGetToken->GetValue().Length() > 0 , _("Please select a gettoken function."));
		CheckValid(enable, cbEnd->GetValue().Length() > 0 , _("Please select an end function."));
		CheckValid(enable, cbLextypes->GetValue().Length() > 0 , _("Please select a lextypes function."));

		EnableOK(enable);
	}
}
コード例 #13
0
ファイル: dlgLanguage.cpp プロジェクト: SokilV/pgadmin3
void dlgLanguage::CheckChange()
{
	bool enable = true;
	wxString name = cbName->GetValue();
	if (language)
	{
		enable = name != language->GetName()
		         || txtComment->GetValue() != language->GetComment()
		         || (connection->BackendMinimumVersion(8, 3) && cbOwner->GetValue() != language->GetOwner());
		if (seclabelPage && connection->BackendMinimumVersion(9, 1))
			enable = enable || !(seclabelPage->GetSqlForSecLabels().IsEmpty());
	}
	else
	{
		bool useTemplate = (cbName->FindString(name) >= 0);

		CheckValid(enable, !name.IsEmpty(), _("Please specify name."));
		CheckValid(enable, useTemplate || !cbHandler->GetValue().IsEmpty(), _("Please specify language handler."));
	}
	EnableOK(enable);
}
コード例 #14
0
nuiWidgetPtr nuiContainer::GetChild(const nglString& rName, bool ResolveNameAsPath)
{
  CheckValid();
  IteratorPtr pIt;
  for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
  {
    nuiWidgetPtr pItem = pIt->GetWidget();
    if (pItem->GetObjectName() == rName)
    {
      delete pIt;
      return pItem;
    }
  }
  delete pIt;

  if (!ResolveNameAsPath) // Are we allowed to search the complete tree?
    return NULL;

  nuiWidgetPtr pNode = this;
  nglString name = rName;

  if (name[0] == '/')
  {
    // Get the root of the tree:
    pNode = GetRoot();

    name.DeleteLeft(1); // Remove the '/'
  }

  // Get all the nodes and remove the slashes:
  std::vector<nglString> tokens;
  name.Tokenize(tokens, _T('/'));

  size_t i;
  size_t count = tokens.size();
  for (i = 0; i < count; i++)
  {
    nglString& rTok = tokens[i];
    //Node* pOld = pNode;
    if (rTok == _T(".."))
      pNode = pNode->GetParent();
    else
      pNode = pNode->GetChild(rTok, false);

    if (!pNode)
    {
      //NUI_OUT("Tried to find %s on %s", rTok.GetChars(), pOld->GetParamCString(ParamIds::Name));
      return NULL;
    }
  }

  return pNode;
}
コード例 #15
0
ファイル: dlgRepPath.cpp プロジェクト: SokilV/pgadmin3
void dlgRepPath::CheckChange()
{
	if (path)
	{
		EnableOK(txtConnInfo->GetValue() != path->GetConnInfo()
		         ||   StrToLong(txtConnRetry->GetValue()) != path->GetConnRetry());
	}
	else
	{
		bool enable = true;
		CheckValid(enable, cbServer->GetCount() > 0, _("No provider node without path definition left."));
		CheckValid(enable, cbServer->GetCurrentSelection() >= 0, _("Please select provider node."));

		wxString connInfo = txtConnInfo->GetValue();
		CheckValid(enable, connInfo.Find(wxT("host=")) >= 0, _("Please provide host in connect info."));
		CheckValid(enable, connInfo.Find(wxT("dbname=")) >= 0, _("Please provide dbname in connect info."));
		CheckValid(enable, connInfo.Find(wxT("user="******"Please provide user in connect info."));

		EnableOK(enable);
	}
}
コード例 #16
0
void nuiContainer::ChildrenCallOnTrash()
{
  CheckValid();
  IteratorPtr pIt;
  for (pIt = GetFirstChild(false); pIt && pIt->IsValid(); GetNextChild(pIt))
  {
    nuiWidgetPtr pItem = pIt->GetWidget();
    if (pItem)
      pItem->CallOnTrash();
  }
  delete pIt;  
}
コード例 #17
0
void dlgRepCluster::CheckChange()
{
	if (cluster)
	{
		int sel = cbAdminNode->GetCurrentSelection();
		bool changed = (sel >= 0 && (long)cbAdminNode->wxEvtHandler::GetClientData() != cluster->GetAdminNodeID());

		EnableOK(changed || txtComment->GetValue() != cluster->GetComment());
	}
	else
	{
		size_t i;
		bool enable = true;

		CheckValid(enable, chkJoinCluster->GetValue() || (!createScript.IsEmpty()),
		           _("Slony-I creation scripts not available; only joining possible."));

		if (chkJoinCluster->GetValue())
			CheckValid(enable, !cbClusterName->GetValue().IsEmpty(), _("Please select a cluster name."));
		else
			CheckValid(enable, !txtClusterName->GetValue().IsEmpty(), _("Please specify name."));

		long nodeId = StrToLong(txtNodeID->GetValue());
		CheckValid(enable, nodeId > 0, _("Please specify local node ID."));
		for (i = 0 ; i < usedNodes.GetCount() && enable; i++)
			CheckValid(enable, nodeId != usedNodes[i], _("Node ID is already in use."));

		CheckValid(enable, !txtNodeName->GetValue().IsEmpty(), _("Please specify local node name."));

		txtAdminNodeName->Enable(nodeId != StrToLong(txtAdminNodeID->GetValue()));

		EnableOK(enable);
	}
}
コード例 #18
0
void nuiContainer::InternalResetCSSPass()
{
  CheckValid();
  nuiWidget::InternalResetCSSPass();
  
  IteratorPtr pIt = GetFirstChild(false);
  for (; pIt && pIt->IsValid(); GetNextChild(pIt))
  {
    nuiWidgetPtr pItem = pIt->GetWidget();
    pItem->ResetCSSPass();
  }
  delete pIt;
}
コード例 #19
0
nuiWidgetPtr nuiContainer::DispatchMultiEventsFinished(const nglMouseInfo& rInfo)
{
    CheckValid();
    if (!mMouseEventEnabled || mTrashed)
        return false;

    bool hasgrab = HasGrab(rInfo.TouchId);
    
    if(hasgrab)
        MultiEventsFinished(rInfo);
    
    return NULL;
}
コード例 #20
0
bool nuiContainer::DrawChildren(nuiDrawContext* pContext)
{
  CheckValid();
  IteratorPtr pIt;
  for (pIt = GetFirstChild(); pIt && pIt->IsValid(); GetNextChild(pIt))
  {
    nuiWidgetPtr pItem = pIt->GetWidget();
    if (pItem)
      DrawChild(pContext, pItem);
  }
  delete pIt;
  return true;
}
コード例 #21
0
ファイル: nuiSpriteView.cpp プロジェクト: jbl2024/nui3
void nuiSprite::DelChild(nuiSprite* pChild)
{
  CheckValid();
  for (size_t i = 0; i < mpChildren.size(); i++)
  {
    if (mpChildren[i] == pChild)
    {
      mpChildren.erase(mpChildren.begin() + i);
      pChild->Release();
      return;
    }
  }
}
コード例 #22
0
ファイル: cursor.cpp プロジェクト: Meridian59/Meridian59
//
/// Constructs a cursor object from the specified resource ID.
//
TCursor::TCursor(HINSTANCE instance, TResId resId)
{
  PRECONDITION(resId);
  Handle = ::LoadCursor(instance, resId);
  if(!Handle && instance != GetGlobalModule().GetHandle()){ // default load from OWL DLL
    Handle = GetGlobalModule().LoadCursor(resId);
    instance = GetGlobalModule().GetHandle();
  }
  ShouldDelete = (instance != 0);
  CheckValid();
  TRACEX(OwlGDI, OWL_CDLEVEL, "TCursor @" << (void*)this <<
    " loaded from resource " << resId);
}
コード例 #23
0
ファイル: dlgForeignTable.cpp プロジェクト: aiht/pgadmin3
void dlgForeignTable::CheckChange()
{
	bool enable = true;
	if (foreigntable)
	{
		enable = txtComment->GetValue() != foreigntable->GetComment()
		         || cbSchema->GetValue() != foreigntable->GetSchema()->GetName()
		         || cbOwner->GetValue() != foreigntable->GetOwner()
		         || GetSqlForTypes() != wxEmptyString
		         || GetSql().Length() > 0;
		if (seclabelPage && connection->BackendMinimumVersion(9, 1))
			enable = enable || !(seclabelPage->GetSqlForSecLabels().IsEmpty());
	}
	else
	{
		wxString name = GetName();

		CheckValid(enable, !name.IsEmpty(), _("Please specify name."));
		CheckValid(enable, cbForeignServer->GetCurrentSelection() >= 0, _("Please specify a foreign server."));
	}
	EnableOK(enable);
}
コード例 #24
0
ファイル: dlgSchedule.cpp プロジェクト: aiht/pgadmin3
void dlgSchedule::CheckChange()
{
	timEnd->Enable(calEnd->GetValue().IsValid());

	wxString name = GetName();
	bool enable = true;

	if (statusBar)
		statusBar->SetStatusText(wxEmptyString);

	InitSelectAll();

	CheckValid(enable, !name.IsEmpty(), _("Please specify name."));
	CheckValid(enable, calStart->GetValue().IsValid(), _("Please specify start date."));

	if (enable)
	{
		EnableOK(!GetSql().IsEmpty());
	}
	else
		EnableOK(false);
}
コード例 #25
0
bool nuiContainer::DispatchMouseUnclick(const nglMouseInfo& rInfo)
{
  CheckValid();
  nuiAutoRef;
  if (!mMouseEventEnabled || mTrashed)
    return false;

  bool hasgrab = HasGrab(rInfo.TouchId);
  if (IsDisabled() && !hasgrab)
    return false;

  nglMouseInfo info(rInfo);
  GlobalToLocal(info.X, info.Y);
  // Get a chance to preempt the mouse event before the children get it:
  if (PreMouseUnclicked(info))
    return true;
  
  if (IsInsideFromRoot(rInfo.X, rInfo.Y) || hasgrab)
  {
    if (!hasgrab)
    {
      IteratorPtr pIt;
      for (pIt = GetLastChild(false); pIt && pIt->IsValid(); GetPreviousChild(pIt))
      {
        nuiWidgetPtr pItem = pIt->GetWidget();
        if (pItem)
        {
          if (IsEnabled())
          {
            if ((pItem)->DispatchMouseUnclick(rInfo))
            {
              delete pIt;
              return true;
            }
          }
        }
      }
      delete pIt;
    }

    bool res = PreUnclicked(info);
    if (!res)
    {
      res = MouseUnclicked(info);
      res |= Unclicked(info);
    }

    return res | (!mClickThru);
  }
  return false;
}
コード例 #26
0
ファイル: dlgView.cpp プロジェクト: ubershmekel/pgadmin3
void dlgView::CheckChange()
{
    bool enable = true;
    wxString name = GetName();

    CheckValid(enable, !name.IsEmpty(), _("Please specify name."));
    CheckValid(enable, txtSqlBox->GetText().Trim(true).Trim(false).Length() > 0 , _("Please enter function definition."));

    if(enable)
    {
        if (view)
            enable = txtComment->GetValue() != view->GetComment()
                     || txtSqlBox->GetText().Trim(true).Trim(false) != oldDefinition.Trim(true).Trim(false)
                     || cbOwner->GetValue() != view->GetOwner()
                     || cbSchema->GetValue() != view->GetSchema()->GetName()
                     || name != view->GetName();

        if (seclabelPage && connection->BackendMinimumVersion(9, 1))
            enable = enable || !(seclabelPage->GetSqlForSecLabels().IsEmpty());

        if (connection->BackendMinimumVersion(9, 2))
        {
            if (view)
            {
                if (chkSecurityBarrier->GetValue())
                    enable = enable || !(view->GetSecurityBarrier() == wxT("true"));
                else
                    enable = enable || (view->GetSecurityBarrier() == wxT("true"));
            }
            else
            {
                enable = enable || (chkSecurityBarrier->GetValue());
            }
        }
    }

    EnableOK(enable);
}
コード例 #27
0
ファイル: HEXDUMP.C プロジェクト: daemqn/Atari_ST_Sources
static int SetupNbLines(HEX_DUMP *hex_dump, int h)
{
  int htline, h_result ;

  htline                       = hex_dump->h_char + hex_dump->interline ;
  hex_dump->nb_lines_on_window = h / htline ;
  if ( hex_dump->nb_lines_on_window > hex_dump->total_nb_lines )
    hex_dump->nb_lines_on_window = hex_dump->total_nb_lines ;
  h_result = (int) (hex_dump->nb_lines_on_window * htline) ;

  CheckValid( hex_dump ) ;

  return( h_result ) ;
}
コード例 #28
0
ファイル: ByteBuffer.cpp プロジェクト: Xury/MCServer
bool cByteBuffer::ReadUTF16String(AString & a_String, int a_NumChars)
{
	// Reads 2 * a_NumChars bytes and interprets it as a UTF16 string, converting it into UTF8 string a_String
	CHECK_THREAD;
	CheckValid();
	ASSERT(a_NumChars >= 0);
	AString RawData;
	if (!ReadString(RawData, a_NumChars * 2))
	{
		return false;
	}
	RawBEToUTF8((short *)(RawData.data()), a_NumChars, a_String);
	return true;
}
コード例 #29
0
CQuickBuildString& CQuickBuildString::operator=(char c)
{
	m_iLength = 1;
	realloc(iBlockSize); // Use iBlocksize instead of 2 as this will, in all probability, grow
	
	((int*)(m_szContent))[0] = c;
	// Above is Quick assignment cheat assigns word instead of this:
	//m_szContent[0] = c;
	//m_szContent[1] = 0;

	CheckValid();

	return *this;
}
コード例 #30
0
ファイル: dlgSynonym.cpp プロジェクト: KrisShannon/pgadmin3
void dlgSynonym::CheckChange()
{
	bool enable = true;
	CheckValid(enable, !txtName->GetValue().IsEmpty(), _("Please specify name."));
	CheckValid(enable, !cbTargetType->GetValue().IsEmpty(), _("Please select target type."));
	// Public Synonyms does supported in public only
	if (!synonymSchema && cbTargetType->GetValue() != _("Public synonym"))
		CheckValid(enable, !cbTargetSchema->GetValue().IsEmpty(), _("Please select target schema."));
	CheckValid(enable, !cbTargetObject->GetValue().IsEmpty(), _("Please select target object."));

	if (!enable)
	{
		EnableOK(enable);
		return;
	}

	if (synonym)
		EnableOK(synonym->GetTargetObject() != cbTargetObject->GetValue());
	else if (privSynonym)
		EnableOK(privSynonym->GetTargetObject() != cbTargetObject->GetValue());
	else
		EnableOK(txtName->GetValue() != wxEmptyString && cbTargetObject->GetValue() != wxEmptyString);
}