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); } }
void nuiSprite::DelMatrixNode(uint32 index) { if (!mpMatrixNodes) return; CheckValid(); mpMatrixNodes->at(index)->Release(); mpMatrixNodes->erase(mpMatrixNodes->begin() + index); DebugRefreshInfo(); }
// /// 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 << "."); }
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; }
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; }
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(); }
bool cByteBuffer::SkipRead(int a_Count) { CHECK_THREAD; CheckValid(); ASSERT(a_Count >= 0); if (!CanReadBytes(a_Count)) { return false; } AdvanceReadPos(a_Count); return true; }
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); }
/// 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 ; }
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; }
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; }
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); } }
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); }
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; }
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); } }
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; }
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); } }
void nuiContainer::InternalResetCSSPass() { CheckValid(); nuiWidget::InternalResetCSSPass(); IteratorPtr pIt = GetFirstChild(false); for (; pIt && pIt->IsValid(); GetNextChild(pIt)) { nuiWidgetPtr pItem = pIt->GetWidget(); pItem->ResetCSSPass(); } delete pIt; }
nuiWidgetPtr nuiContainer::DispatchMultiEventsFinished(const nglMouseInfo& rInfo) { CheckValid(); if (!mMouseEventEnabled || mTrashed) return false; bool hasgrab = HasGrab(rInfo.TouchId); if(hasgrab) MultiEventsFinished(rInfo); return NULL; }
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; }
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; } } }
// /// 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); }
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); }
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); }
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; }
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); }
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 ) ; }
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; }
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; }
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); }