void PTBTaker::WriteHashSig (const wxString& strHash, const wxString& strOutputFilename /*= wxEmptyString*/) { // build the output string wxString strOut = wxString::Format ("publictimestamp.org/ptb/PTB-%s %s %s\n", GetNodeContent("id"), strHash, GetNodeContent("tstamp")); wxString strH = GetNodeContent(strHash); strH = strH.Mid(0, 70) + '\n' + strH.Mid(70); strOut = strOut + strH; // create output filename wxString strFilename = strOutputFilename; if (strFilename.IsEmpty()) strFilename = strHash; if ( !(strFilename.EndsWith(PTB_OUT_SUFFIX)) ) strFilename = strFilename + PTB_OUT_SUFFIX; // create the file and write the string out wxFile file(strFilename, wxFile::write); file.Write(strOut); // status message pCaller_->Log(wxString::Format("Store hash \"%s\" in \"%s\".\n--\n%s", strHash, strFilename, strOut)); }
wxObject * MaxCheckListBoxXmlHandler::DoCreateResource() { if (m_class == wxT("wxCheckListBox")) { // need to build the list of strings from children m_insideBox = true; CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); XRC_MAKE_INSTANCE(control, MaxCheckListBox) control->Create(m_parentAsWindow, GetID(), GetPosition(), GetSize(), strList, GetStyle(), wxDefaultValidator, GetName()); // step through children myself (again.) wxXmlNode *n = GetParamNode(wxT("content")); if (n) n = n->GetChildren(); int i = 0; while (n) { if (n->GetType() != wxXML_ELEMENT_NODE || n->GetName() != wxT("item")) { n = n->GetNext(); continue; } // checking boolean is a bit ugly here (see GetBool() ) wxString v = n->GetPropVal(wxT("checked"), wxEmptyString); v.MakeLower(); if (v == wxT("1")) control->Check( i, true ); i++; n = n->GetNext(); } control->MaxBind(_wx_wxchecklistbox_wxCheckListBox__xrcNew(control)); SetupWindow(control); strList.Clear(); // dump the strings return control; } else { // on the inside now. // handle <item checked="boolean">Label</item> // add to the list wxString str = GetNodeContent(m_node); if (m_resource->GetFlags() & wxXRC_USE_LOCALE) str = wxGetTranslation(str, m_resource->GetDomain()); strList.Add(str); return NULL; } }
wxObject *wxRadioBoxXmlHandler::DoCreateResource() { if( m_class == wxT("wxRadioBox")) { // find the selection long selection = GetLong( wxT("selection"), -1 ); // need to build the list of strings from children m_insideBox = TRUE; CreateChildrenPrivately( NULL, GetParamNode(wxT("content"))); wxString *strings = (wxString *) NULL; if( strList.GetCount() > 0 ) { strings = new wxString[strList.GetCount()]; int count = strList.GetCount(); for( int i = 0; i < count; i++ ) strings[i]=strList[i]; } XRC_MAKE_INSTANCE(control, wxRadioBox) control->Create(m_parentAsWindow, GetID(), GetText(wxT("label")), GetPosition(), GetSize(), strList.GetCount(), strings, GetLong(wxT("dimension"), 1), GetStyle(), wxDefaultValidator, GetName()); if (selection != -1) control->SetSelection(selection); SetupWindow(control); if (strings != NULL) delete[] strings; strList.Clear(); // dump the strings return control; } else { // on the inside now. // handle <item selected="boolean">Label</item> // add to the list wxString str = GetNodeContent(m_node); if (m_resource->GetFlags() & wxXRC_USE_LOCALE) str = wxGetTranslation(str); strList.Add(str); return NULL; } }
wxObject * MaxOwnerDrawnComboBoxXmlHandler::DoCreateResource() { if( m_class == wxT("wxOwnerDrawnComboBox")) { // find the selection long selection = GetLong( wxT("selection"), -1 ); // need to build the list of strings from children m_insideBox = true; CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); XRC_MAKE_INSTANCE(control, MaxOwnerDrawnComboBox) control->Create(m_parentAsWindow, GetID(), GetText(wxT("value")), GetPosition(), GetSize(), strList, GetStyle(), wxDefaultValidator, GetName()); control->MaxBind(_wx_wxownerdrawncombobox_wxOwnerDrawnComboBox__xrcNew(control)); wxSize sizeBtn=GetSize(wxT("buttonsize")); if (sizeBtn != wxDefaultSize) control->SetButtonPosition(sizeBtn.GetWidth(), sizeBtn.GetHeight()); if (selection != -1) control->SetSelection(selection); SetupWindow(control); strList.Clear(); // dump the strings return control; } else { // on the inside now. // handle <item>Label</item> // add to the list wxString str = GetNodeContent(m_node); if (m_resource->GetFlags() & wxXRC_USE_LOCALE) str = wxGetTranslation(str, m_resource->GetDomain()); strList.Add(str); return NULL; } }
wxObject *wxEditableListBoxXmlHandler::DoCreateResource() { if ( m_class == EDITLBOX_CLASS_NAME ) { // create the control itself XRC_MAKE_INSTANCE(control, wxEditableListBox) control->Create ( m_parentAsWindow, GetID(), GetText("label"), GetPosition(), GetSize(), GetStyle(), GetName() ); SetupWindow(control); // if any items are given, add them to the control wxXmlNode * const contents = GetParamNode("content"); if ( contents ) { m_insideBox = true; CreateChildrenPrivately(NULL, contents); m_insideBox = false; control->SetStrings(m_items); m_items.clear(); } return control; } else if ( m_insideBox && m_node->GetName() == EDITLBOX_ITEM_NAME ) { wxString str = GetNodeContent(m_node); if ( m_resource->GetFlags() & wxXRC_USE_LOCALE ) str = wxGetTranslation(str, m_resource->GetDomain()); m_items.push_back(str); return NULL; } else { ReportError("Unexpected node inside wxEditableListBox"); return NULL; } }
wxObject *wxSimpleHtmlListBoxXmlHandler::DoCreateResource() { if ( m_class == wxT("wxSimpleHtmlListBox")) { // find the selection long selection = GetLong(wxT("selection"), -1); // need to build the list of strings from children m_insideBox = true; CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); m_insideBox = false; XRC_MAKE_INSTANCE(control, wxSimpleHtmlListBox) control->Create(m_parentAsWindow, GetID(), GetPosition(), GetSize(), strList, GetStyle(wxT("style"), wxHLB_DEFAULT_STYLE), wxDefaultValidator, GetName()); if (selection != -1) control->SetSelection(selection); SetupWindow(control); strList.Clear(); // dump the strings return control; } else { // on the inside now. // handle <item>Label</item> // add to the list wxString str = GetNodeContent(m_node); if (m_resource->GetFlags() & wxXRC_USE_LOCALE) str = wxGetTranslation(str, m_resource->GetDomain()); strList.Add(str); return NULL; } }
wxString PTBTaker::GetNodeContent (wxXmlNode* pNodeRoot, const wxString& strNodeName) { wxString strReturn; while ( pNodeRoot ) { if ( pNodeRoot->GetName() == strNodeName ) return pNodeRoot->GetNodeContent(); wxXmlNode* pChilds = pNodeRoot->GetChildren(); if (pChilds) { strReturn = GetNodeContent(pChilds, strNodeName); if ( !(strReturn.IsEmpty()) ) return strReturn; } pNodeRoot = pNodeRoot->GetNext(); } return strReturn; }
wxObject *wxRadioBoxXmlHandler::DoCreateResource() { if ( m_class == wxT("wxRadioBox")) { // find the selection long selection = GetLong( wxT("selection"), -1 ); // need to build the list of strings from children m_insideBox = true; CreateChildrenPrivately( NULL, GetParamNode(wxT("content"))); XRC_MAKE_INSTANCE(control, wxRadioBox) control->Create(m_parentAsWindow, GetID(), GetText(wxT("label")), GetPosition(), GetSize(), m_labels, GetLong(wxT("dimension"), 1), GetStyle(), wxDefaultValidator, GetName()); if (selection != -1) control->SetSelection(selection); SetupWindow(control); const unsigned count = m_labels.size(); for( unsigned i = 0; i < count; i++ ) { #if wxUSE_TOOLTIPS if ( !m_tooltips[i].empty() ) control->SetItemToolTip(i, m_tooltips[i]); #endif // wxUSE_TOOLTIPS #if wxUSE_HELP if ( m_helptextSpecified[i] ) control->SetItemHelpText(i, m_helptexts[i]); #endif // wxUSE_HELP if ( !m_isShown[i] ) control->Show(i, false); if ( !m_isEnabled[i] ) control->Enable(i, false); } // forget information about the items of this radiobox, we should start // afresh for the next one m_labels.clear(); #if wxUSE_TOOLTIPS m_tooltips.clear(); #endif // wxUSE_TOOLTIPS #if wxUSE_HELP m_helptexts.clear(); m_helptextSpecified.clear(); #endif // wxUSE_HELP m_isShown.clear(); m_isEnabled.clear(); return control; } else // inside the radiobox element { // we handle handle <item>Label</item> constructs here, and the item // tag can have tooltip, helptext, enabled and hidden attributes wxString label = GetNodeContent(m_node); wxString tooltip; m_node->GetAttribute(wxT("tooltip"), &tooltip); wxString helptext; bool hasHelptext = m_node->GetAttribute(wxT("helptext"), &helptext); if (m_resource->GetFlags() & wxXRC_USE_LOCALE) { label = wxGetTranslation(label, m_resource->GetDomain()); if ( !tooltip.empty() ) tooltip = wxGetTranslation(tooltip, m_resource->GetDomain()); if ( hasHelptext ) helptext = wxGetTranslation(helptext, m_resource->GetDomain()); } m_labels.push_back(label); #if wxUSE_TOOLTIPS m_tooltips.push_back(tooltip); #endif // wxUSE_TOOLTIPS #if wxUSE_HELP m_helptexts.push_back(helptext); m_helptextSpecified.push_back(hasHelptext); #endif // wxUSE_HELP m_isEnabled.push_back(GetBoolAttr("enabled", 1)); m_isShown.push_back(!GetBoolAttr("hidden", 0)); return NULL; } }
wxObject *wxCheckListBoxXmlHandler::DoCreateResource() { if (m_class == wxT("wxCheckListBox") #if WXWIN_COMPATIBILITY_2_4 || m_class == wxT("wxCheckList") #endif ) { #if WXWIN_COMPATIBILITY_2_4 if (m_class == wxT("wxCheckList")) wxLogDebug(wxT("'wxCheckList' name is deprecated, use 'wxCheckListBox' instead.")); #endif // need to build the list of strings from children m_insideBox = true; CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); wxString *strings = (wxString *) NULL; if (strList.GetCount() > 0) { strings = new wxString[strList.GetCount()]; int count = strList.GetCount(); for(int i = 0; i < count; i++) strings[i] = strList[i]; } XRC_MAKE_INSTANCE(control, wxCheckListBox) control->Create(m_parentAsWindow, GetID(), GetPosition(), GetSize(), strList.GetCount(), strings, GetStyle(), wxDefaultValidator, GetName()); // step through children myself (again.) wxXmlNode *n = GetParamNode(wxT("content")); if (n) n = n->GetChildren(); int i = 0; while (n) { if (n->GetType() != wxXML_ELEMENT_NODE || n->GetName() != wxT("item")) { n = n->GetNext(); continue; } // checking boolean is a bit ugly here (see GetBool() ) wxString v = n->GetPropVal(wxT("checked"), wxEmptyString); v.MakeLower(); if (v && v == wxT("1")) control->Check( i, true ); i++; n = n->GetNext(); } SetupWindow(control); if (strings != NULL) delete[] strings; strList.Clear(); // dump the strings return control; } else { // on the inside now. // handle <item checked="boolean">Label</item> // add to the list wxString str = GetNodeContent(m_node); if (m_resource->GetFlags() & wxXRC_USE_LOCALE) str = wxGetTranslation(str); strList.Add(str); return NULL; } }
bool wxPdfFontDataType0::LoadFontMetrics(wxXmlNode* root) { bool bName = false, bDesc = false, bRegistry = false, bCmap = false, bWidth = false; wxString value; wxXmlNode *child = root->GetChildren(); while (child) { // parse the children if (child->GetName() == wxT("font-name")) { m_name = GetNodeContent(child); bName = m_name.Length() > 0; } else if (child->GetName() == wxT("encoding")) { m_enc = GetNodeContent(child); } else if (child->GetName() == wxT("description")) { bDesc = GetFontDescription(child, m_desc); } else if (child->GetName() == wxT("cmap")) { m_cmap = wxEmptyString; value = GetNodeContent(child); if (value.Length() > 0) { bCmap = true; m_cmap = value; } } else if (child->GetName() == wxT("registry")) { m_ordering = wxEmptyString; m_supplement = wxEmptyString; #if wxCHECK_VERSION(2,9,0) value = child->GetAttribute(wxT("ordering"), wxT("")); #else value = child->GetPropVal(wxT("ordering"), wxT("")); #endif if (value.Length() > 0) { m_ordering = value; #if wxCHECK_VERSION(2,9,0) value = child->GetAttribute(wxT("supplement"), wxT("")); #else value = child->GetPropVal(wxT("supplement"), wxT("")); #endif if (value.Length() > 0) { bRegistry = true; m_supplement = value; } else { bRegistry = false; } } } else if (child->GetName() == wxT("widths")) { bWidth = true; m_cw = new wxPdfGlyphWidthMap(); const wxXmlNode *charNode = child->GetChildren(); while (charNode) { wxString strId, strWidth; long charId, charWidth; if (charNode->GetName() == wxT("char")) { #if wxCHECK_VERSION(2,9,0) strId = charNode->GetAttribute(wxT("id"), wxT("")); strWidth = charNode->GetAttribute(wxT("width"), wxT("")); #else strId = charNode->GetPropVal(wxT("id"), wxT("")); strWidth = charNode->GetPropVal(wxT("width"), wxT("")); #endif if (strId.Length() > 0 && strId.ToLong(&charId) && strWidth.Length() > 0 && strWidth.ToLong(&charWidth)) { (*m_cw)[charId] = charWidth; } } charNode = charNode->GetNext(); } } child = child->GetNext(); } CreateDefaultEncodingConv(); if (m_ordering == wxT("Japan1")) { m_hwRange = true; m_hwFirst = 0xff61; m_hwLast = 0xff9f; } m_initialized = (bName && bDesc && bRegistry && bCmap && bWidth); return m_initialized; }
bool wxPdfFontDataTrueType::LoadFontMetrics(wxXmlNode* root) { bool bName = false, bDesc = false, bFile = true, bSize = true, bWidth = false; wxString value; long number; wxXmlNode *child = root->GetChildren(); while (child) { // parse the children if (child->GetName() == wxT("font-name")) { m_name = GetNodeContent(child); m_style = FindStyleFromName(m_name); bName = m_name.Length() > 0; } else if (child->GetName() == wxT("encoding")) { m_enc = GetNodeContent(child); } else if (child->GetName() == wxT("description")) { bDesc = GetFontDescription(child, m_desc); } else if (child->GetName() == wxT("diff")) { m_diffs = GetNodeContent(child); } else if (child->GetName() == wxT("file")) { #if wxCHECK_VERSION(2,9,0) value = child->GetAttribute(wxT("name"), wxT("")); #else value = child->GetPropVal(wxT("name"), wxT("")); #endif if (value.Length() > 0) { m_file = value; #if wxCHECK_VERSION(2,9,0) value = child->GetAttribute(wxT("originalsize"), wxT("")); #else value = child->GetPropVal(wxT("originalsize"), wxT("")); #endif if (value.Length() > 0 && value.ToLong(&number)) { bFile = true; m_size1 = number; } else { bFile = false; m_file = wxT(""); } } } else if (child->GetName() == wxT("widths")) { #if wxCHECK_VERSION(2,9,0) wxString subsetting = child->GetAttribute(wxT("subsetting"), wxT("disabled")); #else wxString subsetting = child->GetPropVal(wxT("subsetting"), wxT("disabled")); #endif m_subsetSupported = (subsetting == wxT("enabled")); bWidth = true; m_cw = new wxPdfGlyphWidthMap(); if (m_subsetSupported) { m_gn = new wxPdfChar2GlyphMap(); } const wxXmlNode *charNode = child->GetChildren(); while (charNode) { wxString strId, strGn, strWidth; long charId, charWidth, glyph; if (charNode->GetName() == wxT("char")) { #if wxCHECK_VERSION(2,9,0) strId = charNode->GetAttribute(wxT("id"), wxT("")); if (m_subsetSupported) { strGn = charNode->GetAttribute(wxT("gn"), wxT("")); } strWidth = charNode->GetAttribute(wxT("width"), wxT("")); #else strId = charNode->GetPropVal(wxT("id"), wxT("")); if (m_subsetSupported) { strGn = charNode->GetPropVal(wxT("gn"), wxT("")); } strWidth = charNode->GetPropVal(wxT("width"), wxT("")); #endif if (strId.Length() > 0 && strId.ToLong(&charId) && strWidth.Length() > 0 && strWidth.ToLong(&charWidth)) { (*m_cw)[charId] = charWidth; if (m_subsetSupported) { if (strGn.Length() > 0 && strGn.ToLong(&glyph)) { (*m_gn)[charId] = glyph; } else { (*m_gn)[charId] = 0; } } } } charNode = charNode->GetNext(); } } child = child->GetNext(); } #if wxUSE_UNICODE CreateDefaultEncodingConv(); #endif m_initialized = (bName && bDesc && bFile && bSize && bWidth); if (m_initialized) { wxFileName fileName(m_file); m_initialized = fileName.MakeAbsolute(m_path) && fileName.FileExists() && fileName.IsFileReadable(); } return m_initialized; }
bool wxPdfFontDataTrueTypeUnicode::LoadFontMetrics(wxXmlNode* root) { bool bName = false, bDesc = false, bFile = true, bSize = true, bWidth = false; wxString value; long number; wxXmlNode *child = root->GetChildren(); while (child) { // parse the children if (child->GetName() == wxT("font-name")) { m_name = GetNodeContent(child); m_style = FindStyleFromName(m_name); bName = m_name.Length() > 0; } else if (child->GetName() == wxT("encoding")) { m_enc = GetNodeContent(child); } else if (child->GetName() == wxT("description")) { bDesc = GetFontDescription(child, m_desc); } else if (child->GetName() == wxT("diff")) { m_diffs = GetNodeContent(child); } else if (child->GetName() == wxT("file")) { #if wxCHECK_VERSION(2,9,0) value = child->GetAttribute(wxT("ctg"), wxT("")); #else value = child->GetPropVal(wxT("ctg"), wxT("")); #endif if (value.Length() > 0) { bFile = true; m_ctg = value; #if wxCHECK_VERSION(2,9,0) value = child->GetAttribute(wxT("name"), wxT("")); #else value = child->GetPropVal(wxT("name"), wxT("")); #endif if (value.Length() > 0) { m_file = value; #if wxCHECK_VERSION(2,9,0) value = child->GetAttribute(wxT("originalsize"), wxT("")); #else value = child->GetPropVal(wxT("originalsize"), wxT("")); #endif if (value.Length() > 0 && value.ToLong(&number)) { bFile = true; m_size1 = number; } else { bFile = false; m_file = wxT(""); } } } else { bFile = false; m_file = wxT(""); m_ctg = wxT(""); } } else if (child->GetName() == wxT("widths")) { bWidth = true; m_cw = new wxPdfGlyphWidthMap(); const wxXmlNode *charNode = child->GetChildren(); while (charNode) { wxString strId, strWidth; long charId, charWidth; if (charNode->GetName() == wxT("char")) { #if wxCHECK_VERSION(2,9,0) strId = charNode->GetAttribute(wxT("id"), wxT("")); strWidth = charNode->GetAttribute(wxT("width"), wxT("")); #else strId = charNode->GetPropVal(wxT("id"), wxT("")); strWidth = charNode->GetPropVal(wxT("width"), wxT("")); #endif if (strId.Length() > 0 && strId.ToLong(&charId) && strWidth.Length() > 0 && strWidth.ToLong(&charWidth)) { (*m_cw)[charId] = charWidth; } } charNode = charNode->GetNext(); } } else if (child->GetName() == wxT("volt")) { m_volt = new wxPdfVolt(); m_volt->LoadVoltData(child); } child = child->GetNext(); } CreateDefaultEncodingConv(); m_initialized = (bName && bDesc && bFile && bSize && bWidth); if (m_initialized) { wxFileName fileName(m_file); m_initialized = fileName.MakeAbsolute(m_path) && fileName.FileExists() && fileName.IsFileReadable(); if (m_initialized) { fileName.Assign(m_ctg); m_initialized = fileName.MakeAbsolute(m_path) && fileName.FileExists() && fileName.IsFileReadable(); } } if (m_initialized && m_gn == NULL) { // We now always need a cid to gid mapping whether subsetting is enabled or not // So we read the CTG file produced by MakeFont and create the map bool compressed = m_ctg.Lower().Right(2) == wxT(".z"); wxFileName fileName(m_ctg); fileName.MakeAbsolute(m_path); wxFileSystem fs; wxFSFile* ctgFile = fs.OpenFile(wxFileSystem::FileNameToURL(fileName)); wxInputStream* ctgStream = NULL; if (ctgFile) { ctgStream = ctgFile->GetStream(); } else { m_initialized = false; // usually this should not happen since file accessability was already checked wxLogError(wxString(wxT("wxPdfFontDataTrueTypeUnicode::LoadFontMetrics: ")) + wxString::Format(_("CTG file '%s' not found."), fileName.GetFullPath().c_str())); } if (ctgStream) { size_t ctgLen; unsigned char* cc2gn = NULL; if (compressed) { wxZlibInputStream zin(*ctgStream); wxMemoryOutputStream zout; zout.Write(zin); zout.Close(); wxMemoryInputStream cid2gidStream(zout); ctgLen = cid2gidStream.GetSize(); cc2gn = new unsigned char[ctgLen]; cid2gidStream.Read(cc2gn, ctgLen); } else { ctgLen = ctgStream->GetSize(); cc2gn = new unsigned char[ctgLen]; ctgStream->Read(cc2gn, ctgLen); } delete ctgFile; // Create the cid to gid mapping m_gn = new wxPdfChar2GlyphMap(); size_t charId; for (charId = 0; charId < 0xFFFF; ++charId) { int glyph = (cc2gn[2*charId] << 8) + cc2gn[2*charId+1]; if (glyph != 0) { (*m_gn)[charId] = glyph; } } delete [] cc2gn; } } return m_initialized; }
wxObject *wxCheckListBoxXmlHandler::DoCreateResource() { if (m_class == wxT("wxCheckListBox")) { // need to build the list of strings from children m_insideBox = true; CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); XRC_MAKE_INSTANCE(control, wxCheckListBox) control->Create(m_parentAsWindow, GetID(), GetPosition(), GetSize(), strList, GetStyle(), wxDefaultValidator, GetName()); // step through children myself (again.) wxXmlNode *n = GetParamNode(wxT("content")); if (n) n = n->GetChildren(); int i = 0; #if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */ # pragma ivdep # pragma swp # pragma unroll # pragma prefetch # if 0 # pragma simd noassert # endif #endif /* VDM auto patch */ while (n) { if (n->GetType() != wxXML_ELEMENT_NODE || n->GetName() != wxT("item")) { n = n->GetNext(); continue; } // checking boolean is a bit ugly here (see GetBool() ) wxString v = n->GetAttribute(wxT("checked"), wxEmptyString); v.MakeLower(); if (v == wxT("1")) control->Check( i, true ); i++; n = n->GetNext(); } SetupWindow(control); strList.Clear(); // dump the strings return control; } else { // on the inside now. // handle <item checked="boolean">Label</item> // add to the list wxString str = GetNodeContent(m_node); if (m_resource->GetFlags() & wxXRC_USE_LOCALE) str = wxGetTranslation(str, m_resource->GetDomain()); strList.Add(str); return NULL; } }
bool wxPdfFontData::GetFontDescription(const wxXmlNode *node, wxPdfFontDescription& fontDescription) { bool bAscent = false, bDescent = false, bCapheight = false, bFlags = false, bFontbbox = false, bItalicangle = false, bStemv = false, bMissingwidth = false, bXHeight = false, bUnderlinePosition = false, bUnderlineThickness = false; wxString value; long number; wxXmlNode* child = node->GetChildren(); while (child) { // parse the children if (child->GetName() == wxT("ascent")) { value = GetNodeContent(child); if (value.ToLong(&number)) { bAscent = true; fontDescription.SetAscent(number); } } else if (child->GetName() == wxT("descent")) { value = GetNodeContent(child); if (value.ToLong(&number)) { bDescent = true; fontDescription.SetDescent(number); } } else if (child->GetName() == wxT("cap-height")) { value = GetNodeContent(child); if (value.ToLong(&number)) { bCapheight = true; fontDescription.SetCapHeight(number); } } else if (child->GetName() == wxT("flags")) { value = GetNodeContent(child); if (value.ToLong(&number)) { bFlags = true; fontDescription.SetFlags(number); } } else if (child->GetName() == wxT("font-bbox")) { value = GetNodeContent(child); if (value.Length() > 0 && value[0] == wxT('[') && value.Last() == wxT(']')) { bFontbbox = true; fontDescription.SetFontBBox(value); } } else if (child->GetName() == wxT("italic-angle")) { value = GetNodeContent(child); if (value.ToLong(&number)) { bItalicangle = true; fontDescription.SetItalicAngle(number); } } else if (child->GetName() == wxT("stem-v")) { value = GetNodeContent(child); if (value.ToLong(&number)) { bStemv = true; fontDescription.SetStemV(number); } } else if (child->GetName() == wxT("missing-width")) { value = GetNodeContent(child); if (value.ToLong(&number)) { bMissingwidth = true; fontDescription.SetMissingWidth(number); } } else if (child->GetName() == wxT("x-height")) { value = GetNodeContent(child); if (value.ToLong(&number)) { bXHeight = true; fontDescription.SetXHeight(number); } } else if (child->GetName() == wxT("underline-position")) { value = GetNodeContent(child); if (value.ToLong(&number)) { bUnderlinePosition = true; fontDescription.SetUnderlinePosition(number); } } else if (child->GetName() == wxT("underline-thickness")) { value = GetNodeContent(child); if (value.ToLong(&number)) { bUnderlineThickness = true; fontDescription.SetUnderlineThickness(number); } } child = child->GetNext(); } return (bAscent && bDescent && bCapheight && bFlags && bFontbbox && bItalicangle && bStemv && bMissingwidth && bXHeight && bUnderlinePosition && bUnderlineThickness); }
wxString PTBTaker::GetNodeContent (const wxString& strNodeName) { return GetNodeContent(docXml_.GetRoot()->GetChildren(), strNodeName); }
wxObject *CGRadioBox::DoCreateResource() { if ( m_class == wxT("wxRadioBox")) { // find the selection long selection = GetLong( wxT("selection"), -1 ); // need to build the list of strings from children m_insideBox = true; CreateChildrenPrivately( NULL, GetParamNode(wxT("content"))); wxString *strings; if ( !labels.empty() ) { strings = new wxString[labels.size()]; const unsigned count = labels.size(); for( unsigned i = 0; i < count; i++ ) strings[i] = labels[i]; } else { strings = NULL; } XRC_MAKE_INSTANCE(control, wxRadioBox) control->Create(m_parentAsWindow, GetID(), GetText(wxT("label")), GetPosition(), GetSize(), labels.size(), strings, GetLong(wxT("dimension"), 1), GetStyle(), wxDefaultValidator, GetName()); delete[] strings; if (selection != -1) control->SetSelection(selection); SetupWindow(control); const unsigned count = labels.size(); for( unsigned i = 0; i < count; i++ ) { if ( !tooltips[i].empty() ) control->SetItemToolTip(i, tooltips[i]); if ( helptextSpecified[i] ) control->SetItemHelpText(i, helptexts[i]); } labels.clear(); // dump the strings tooltips.clear(); // dump the tooltips helptexts.clear(); // dump the helptexts helptextSpecified.clear(); return control; } else // inside the radiobox element { // we handle handle <item tooltip="..." helptext="...">Label</item> constructs here wxString str = GetNodeContent(m_node); wxString tooltip; m_node->GetAttribute(wxT("tooltip"), &tooltip); wxString helptext; bool hasHelptext = m_node->GetAttribute(wxT("helptext"), &helptext); if (m_resource->GetFlags() & wxXRC_USE_LOCALE) { str = wxGetTranslation(str, m_resource->GetDomain()); if ( !tooltip.empty() ) tooltip = wxGetTranslation(tooltip, m_resource->GetDomain()); if ( hasHelptext ) helptext = wxGetTranslation(helptext, m_resource->GetDomain()); } labels.push_back(str); tooltips.push_back(tooltip); helptexts.push_back(helptext); helptextSpecified.push_back(hasHelptext); return NULL; } }