void CPDF_VariableText::SetText(const FX_WCHAR* text,
                                int32_t charset,
                                const CPVT_SecProps* pSecProps,
                                const CPVT_WordProps* pWordProps) {
  DeleteWords(CPVT_WordRange(GetBeginWordPlace(), GetEndWordPlace()));
  CFX_WideString swText = text;
  CPVT_WordPlace wp(0, 0, -1);
  CPVT_SectionInfo secinfo;
  if (m_bRichText) {
    if (pSecProps)
      secinfo.pSecProps = new CPVT_SecProps(*pSecProps);
    if (pWordProps)
      secinfo.pWordProps = new CPVT_WordProps(*pWordProps);
  }
  if (CSection* pSection = m_SectionArray.GetAt(0))
    pSection->m_SecInfo = secinfo;

  int32_t nCharCount = 0;
  for (int32_t i = 0, sz = swText.GetLength(); i < sz; i++) {
    if (m_nLimitChar > 0 && nCharCount >= m_nLimitChar)
      break;
    if (m_nCharArray > 0 && nCharCount >= m_nCharArray)
      break;

    uint16_t word = swText.GetAt(i);
    switch (word) {
      case 0x0D:
        if (m_bMultiLine) {
          if (swText.GetAt(i + 1) == 0x0A)
            i += 1;

          wp.nSecIndex++;
          wp.nLineIndex = 0;
          wp.nWordIndex = -1;
          AddSection(wp, secinfo);
        }
        break;
      case 0x0A:
        if (m_bMultiLine) {
          if (swText.GetAt(i + 1) == 0x0D)
            i += 1;

          wp.nSecIndex++;
          wp.nLineIndex = 0;
          wp.nWordIndex = -1;
          AddSection(wp, secinfo);
        }
        break;
      case 0x09:
        word = 0x20;
      default:
        wp = InsertWord(wp, word, charset, pWordProps);
        break;
    }
    nCharCount++;
  }
}
Beispiel #2
0
Panel *InitMouseSettings(WMWidget *parent)
{
	_Panel *panel;

	modifierNames[0] = wstrdup(_("Shift"));
	modifierNames[1] = wstrdup(_("Lock"));
	modifierNames[2] = wstrdup(_("Control"));
	modifierNames[3] = wstrdup(_("Mod1"));
	modifierNames[4] = wstrdup(_("Mod2"));
	modifierNames[5] = wstrdup(_("Mod3"));
	modifierNames[6] = wstrdup(_("Mod4"));
	modifierNames[7] = wstrdup(_("Mod5"));

	panel = wmalloc(sizeof(_Panel));

	panel->sectionName = _("Mouse Preferences");

	panel->description = _("Mouse speed/acceleration, double click delay,\n" "mouse button bindings etc.");

	panel->parent = parent;

	panel->callbacks.createWidgets = createPanel;
	panel->callbacks.updateDomain = storeData;

	AddSection(panel, ICON_FILE);

	return panel;
}
CPVT_WordPlace CPDF_VariableText::InsertSection(
    const CPVT_WordPlace& place,
    const CPVT_SecProps* pSecProps,
    const CPVT_WordProps* pWordProps) {
  int32_t nTotlaWords = GetTotalWords();
  if (m_nLimitChar > 0 && nTotlaWords >= m_nLimitChar)
    return place;
  if (m_nCharArray > 0 && nTotlaWords >= m_nCharArray)
    return place;
  if (!m_bMultiLine)
    return place;

  CPVT_WordPlace wordplace = place;
  UpdateWordPlace(wordplace);
  CPVT_WordPlace newplace = place;
  if (CSection* pSection = m_SectionArray.GetAt(wordplace.nSecIndex)) {
    CPVT_WordPlace NewPlace(wordplace.nSecIndex + 1, 0, -1);
    CPVT_SectionInfo secinfo;
    AddSection(NewPlace, secinfo);
    newplace = NewPlace;
    if (CSection* pNewSection = m_SectionArray.GetAt(NewPlace.nSecIndex)) {
      for (int32_t w = wordplace.nWordIndex + 1,
                   sz = pSection->m_WordArray.GetSize();
           w < sz; w++) {
        if (CPVT_WordInfo* pWord = pSection->m_WordArray.GetAt(w)) {
          NewPlace.nWordIndex++;
          pNewSection->AddWord(NewPlace, *pWord);
        }
      }
    }
    ClearSectionRightWords(wordplace);
  }
  return newplace;
}
// Writes the name for a segment (each segment name must be unique).
void TrackGen::AddSegmentName()
{
	std::stringstream s;
	s << _sectionNumber;
	AddSection(s.str());
	s.str("");
}
Beispiel #5
0
int MIniFile::SetSectionName(const char *sectionName)
{
	IniSection* pSection = GetSection(sectionName);
	if(0 == pSection)
	{
		pSection = new IniSection;

		LineInfo* pSectionLineInfo = new LineInfo;

		pSection->SetSectionName(sectionName);

		pSection->m_nLineNo = m_nLineCount;

		pSectionLineInfo->nLineNo = pSection->m_nLineNo;
		pSectionLineInfo->strMainData = "[";
		pSectionLineInfo->strMainData += sectionName;
		pSectionLineInfo->strMainData += "]";

		AdjustAllLineInfo(pSectionLineInfo);

		AddSection(pSection);
	}
	else
	{
		pSection->SetSectionName(sectionName);
	}

	m_bChange = true;

	return 0;
}
Beispiel #6
0
//设置配置项的值(字符串)
void CIniFile::SetString(const char* sSectionName, const char* sKeyName, const char* sKeyValue)
{
	int i = GetSectionIndex(0,sSectionName);
	int j;
	if(i < 0)
		i = AddSection(sSectionName);
	if(i >= 0)
		j = GetKeyIndex(i, sKeyName);
	else 
		return;
	
	struct LINE_ITEM *pItem;
	if(j >= 0)
	{
		pItem = (struct LINE_ITEM *)m_arrayOfLine.GetAt(j);
		pItem->sValue = sKeyValue;
	}
	else
	{
		pItem = new struct LINE_ITEM;
		pItem->nType = LINE_TYPE_KEY;
		pItem->sName = sKeyName;
		pItem->sValue = sKeyValue;
		m_arrayOfLine.InsertAt(i + 1, pItem);
		j = i+1;
	}
	if(j >= 0)
		m_bModified = true;
	if(m_bAutoFlush)
		FlushToFile();
}
void ArtistInfoView::InfoResultReady(int id,
                                     const CollapsibleInfoPane::Data& data) {
  if (id != current_request_id_) return;

  AddSection(new CollapsibleInfoPane(data, this));
  CollapseSections();
}
Beispiel #8
0
void wxGenericDirCtrl::SetupSections()
{
    wxArrayString paths, names;
    wxArrayInt icons;

    size_t n, count = wxGetAvailableDrives(paths, names, icons);

#ifdef __WXGTK20__
    wxString home = wxGetHomeDir();
    AddSection( home, _("Home directory"), 1);
    home += wxT("/Desktop");
    AddSection( home, _("Desktop"), 1);
#endif

    for (n = 0; n < count; n++)
        AddSection(paths[n], names[n], icons[n]);
}
void UFaceFXAnimationTrack::AddSection(float KeyTime, const FFaceFXAnimComponentSet& AnimCompSet)
{
	UFaceFXAnimationSection* NewSection = Cast<UFaceFXAnimationSection>(CreateNewSection());
	{
		NewSection->SetData(AnimCompSet);
		NewSection->InitialPlacement(AnimationSections, KeyTime, KeyTime + NewSection->GetAnimationDuration(), SupportsMultipleRows());
	}
	AddSection(*NewSection);
}
void CVariablesGrid::BuildWatch()
{
	m_gridType = WATCH;

	m_titleList.RemoveAll();
	m_treeLevelArray.RemoveAll();
	m_treeForcePlusArray.RemoveAll();
	AddSection("Name", "Value");
	SetFixedRowCount(1);
	SetRowCount(2);
}
Beispiel #11
0
// append list
void 
wyIni::Append(const wyChar *sec,const wyChar *key,const wyChar *value)
{
	struct tagSection *tmp_sec;
	struct tagRecord *temp;	
	
	// find section
	tmp_sec = GetSection(sec);

	if(tmp_sec != NULL)
	{
		temp = GetRecord(tmp_sec,key);
		if(temp == NULL)
		{
			//temp = (struct record *)malloc(sizeof(struct record));
            temp = new  tagRecord;
			if(temp == NULL)
			{
				m_errormsg = "cannot malloc memory !";
				return;
			}
			temp->m_next = NULL;	
			
            if(key)
                temp->m_key.SetAs(key);
            if(value)
                temp->m_value.SetAs(value);			

			tmp_sec->m_datasize++;

			if (tmp_sec->m_datafirst == NULL)
			{
				tmp_sec->m_datafirst = temp;
				tmp_sec->m_datalast  = temp;
			}
			else
			{
				tmp_sec->m_datalast->m_next = temp;
				tmp_sec->m_datalast = temp;
			}			
		}
		else if(m_flag == REPLACE)
		{
            temp->m_key.SetAs(key);
            temp->m_value.SetAs(value);
		}
		
	}
	else
	{
		AddSection(sec,"");
		Append(sec,key,value);
	}
}
void ElfSectionManager::EnsureSectionStringTableSectionAdded(){
	if (iSectionStringTableSectionAdded) return;
	
	// set iSectionStringTableSectionAdded true now so we don't do the next bit twice;
	iSectionStringTableSectionAdded = true;

	// first create the UNDEF section
	ElfSectionNoData * aUndefData = new ElfSectionNoData();
	
	Elf32_Shdr undef;
	undef.sh_name = 0; 
	undef.sh_type = SHT_NULL;
	undef.sh_flags = 0;
	undef.sh_addr = 0;
	undef.sh_offset = 0; 
	undef.sh_size = 0; 
	undef.sh_link = 0;
	undef.sh_info = 0;
	undef.sh_addralign = 0;
	undef.sh_entsize = 0;
	
	ElfSection aUndefSection(aUndefData, "", undef);
	AddSection(aUndefSection);
	
	ElfSectionElfData * aSectionStringTableSectionData = new ElfSectionElfData(iStringTable);
	Elf32_Shdr shdr;
	shdr.sh_name = 0; // for now.
	shdr.sh_type = SHT_STRTAB;
	shdr.sh_flags = 0;
	shdr.sh_addr = 0;
	shdr.sh_offset = 0; // for now
	shdr.sh_size = 0; // for now.
	shdr.sh_link = SHN_UNDEF;
	shdr.sh_info = 0;
	shdr.sh_addralign = 0;
	shdr.sh_entsize = 0;

	ElfSection aSectionStringTableSection(aSectionStringTableSectionData, ".shstrtab", shdr);
	AddSection(aSectionStringTableSection);
	iElf32Header.SetSectionStringNdx(iSections.size() - 1);
}
Beispiel #13
0
    void Test_Variant::test_float()
    {
        AddSection("Test float");
        Core::Variant variant(10.0f);

        ASSERTERROR(!(variant==10),"Comparison to int failed");
        ASSERTERROR(variant==float(10),"Comparison to float failed");
        ASSERTERROR(!(variant==float(10.1)),"Comparison to float failed");
        ASSERTERROR(!(variant==double(10)),"Comparison to double failed");
        ASSERTERROR(!(variant=="" || variant=="10"),"Comparison to string failed");
        ASSERTERROR(variant.toString()=="[Variant:Float]10","toString failed");
    }
Beispiel #14
0
	CSection *CItem::GetOrAddSection(BYTE byID)
	{
		CSection *pSection = GetSection(byID);
		if (pSection)
		{
			return pSection;
		}
		else
		{
			return AddSection(byID);
		}
	}
Beispiel #15
0
    void Test_Variant::test_string()
    {
        AddSection("Test string");
        Core::Variant variant("TestString");

        ASSERTERROR(!(variant==10),"Comparison to int failed");
        ASSERTERROR(!(variant==float(10.0)),"Comparison to float failed");
        ASSERTERROR(!(variant==double(10.0)),"Comparison to double failed");
        ASSERTERROR(variant=="TestString","Comparison to string failed");
        ASSERTERROR(!(variant=="TestString_"),"Comparison to string failed");
        ASSERTERROR(variant.toString()=="[Variant:String]TestString","toString failed");
    }
Beispiel #16
0
    void Test_Variant::test_int()
    {
        AddSection("Test int");
        Core::Variant variant(10);

        ASSERTERROR(variant==10,"Comparison to int failed");
        ASSERTERROR(!(variant==11),"Comparison to int failed");
        ASSERTERROR(!(variant==float(10.0)),"Comparison to float failed");
        ASSERTERROR(!(variant==double(10.0)),"Comparison to double failed");
        ASSERTERROR(!(variant=="" || variant=="10"),"Comparsion to string failed");
        ASSERTERROR(variant.toString()=="[Variant:Int]10","toString failed");
        ASSERTERROR(variant.isType(10),"isType failed");
    }
Beispiel #17
0
int MIniFile::SetSection(IniSection *pSection)
{
	IniSection* pTempSection = GetSection(pSection->GetSectionName());

	if(0 == pTempSection)
	{
		AddSection(pSection);
	}

	m_bChange = true;

	return 0;
}
Beispiel #18
0
void IniFile::ParseFromString(const std::string& str)
{
	_settings.clear();

	std::string sectionName;
	std::string sRead;

	typedef enum { KEY , SECTION , COMMENT , OTHER } RR;
	std::istringstream iss(str);
	while( std::getline( iss, sRead ) )
	{
		sRead = StringHelper::trim( sRead );
		sRead = StringHelper::replace( sRead, "\r", "");
		sRead = StringHelper::replace( sRead, "\n", "");
		if( !sRead.empty() )
		{
			RR nType = ( sRead.find_first_of("[") == 0 && ( sRead[sRead.find_last_not_of(" \t\r\n")] == ']' ) ) ? SECTION : OTHER ;
			std::string::size_type equaleSymbolPos = sRead.find_first_of("=");
			nType = ( (nType == OTHER) && ( equaleSymbolPos > 0 && equaleSymbolPos != std::string::npos ) ) ? KEY : nType ;
			nType = ( (nType == OTHER) && ( sRead.find_first_of("#") == 0) ) ? COMMENT : nType ;
			switch( nType )
			{
				case SECTION:
					sectionName = StringHelper::trim( sRead.substr( 1 , sRead.size() - 2 ) );
					AddSection( sectionName );
				break;

				case KEY:
				{
					// Check to ensure valid section... or drop the keys listed
					if( !sectionName.empty() )
					{
						size_t iFind = sRead.find_first_of("=");
						std::string sKey = StringHelper::trim( sRead.substr(0,iFind) );
						std::string sValue = StringHelper::trim( sRead.substr(iFind + 1) );
						SetValue( sectionName, sKey, sValue );
					}
				}
				break;

				case COMMENT:
				break;

				case OTHER:
				break;
			}
		}
	}
}
Beispiel #19
0
Panel *InitThemes(WMWidget *parent)
{
	_Panel *panel;

	panel = wmalloc(sizeof(_Panel));

	panel->sectionName = _("Themes");

	panel->parent = parent;

	panel->callbacks.createWidgets = createPanel;
	panel->callbacks.updateDomain = storeData;

	AddSection(panel, ICON_FILE);

	return panel;
}
Beispiel #20
0
Panel *InitFocus(WMWidget *parent)
{
	_Panel *panel;

	panel = wmalloc(sizeof(_Panel));

	panel->sectionName = _("Window Focus Preferences");
	panel->description = _("Keyboard focus switching policy and related options.");
	panel->parent = parent;

	panel->callbacks.createWidgets = createPanel;
	panel->callbacks.updateDomain = storeData;

	AddSection(panel, ICON_FILE);

	return panel;
}
Beispiel #21
0
void CPDF_VariableText::Initialize() {
  if (!m_bInitial) {
    CPVT_SectionInfo secinfo;
    CPVT_WordPlace place;
    place.nSecIndex = 0;
    AddSection(place, secinfo);
    CPVT_LineInfo lineinfo;
    lineinfo.fLineAscent = GetFontAscent(GetDefaultFontIndex(), GetFontSize());
    lineinfo.fLineDescent =
        GetFontDescent(GetDefaultFontIndex(), GetFontSize());
    AddLine(place, lineinfo);
    if (CSection* pSection = m_SectionArray.GetAt(0))
      pSection->ResetLinePlace();

    m_bInitial = TRUE;
  }
}
Beispiel #22
0
    PIMAGE_SECTION_HEADER MemPEFile::AddPESection( const char* szName, ULONG cbSizeOfRawData, ULONG Characteristics )
    {
        // get file alignment value
        ULONG dwFileAlignment = GetOptionalHead32()->FileAlignment;

        // closing old file;
        CloseMemFile();

        ULONG cbAdditionalBytes = AlignUp( cbSizeOfRawData, dwFileAlignment );

        // reload file using old AccessMask, with allocating additional bytes
        if ( !LoadFile( m_strFileName.c_str(), cbAdditionalBytes, m_Access ) )
        {
            throw std::runtime_error( "error reloading file" );
        }

        return AddSection( szName, cbAdditionalBytes, Characteristics );
    }
Beispiel #23
0
Panel *InitKeyboardSettings(WMWidget *parent)
{
	_Panel *panel;

	panel = wmalloc(sizeof(_Panel));

	panel->sectionName = _("Keyboard Preferences");

	panel->description = _("Not done");

	panel->parent = parent;

	panel->callbacks.createWidgets = createPanel;

	AddSection(panel, ICON_FILE);

	return panel;
}
Beispiel #24
0
Panel *InitConfigurations(WMWidget *parent)
{
	_Panel *panel;

	panel = wmalloc(sizeof(_Panel));

	panel->sectionName = _("Other Configurations");
	panel->description = _("Animation speeds, titlebar styles, various option\n"
			       "toggling and number of colors to reserve for\n" "Window Maker on 8bit displays.");

	panel->parent = parent;
	panel->callbacks.createWidgets = createPanel;
	panel->callbacks.updateDomain = storeData;

	AddSection(panel, ICON_FILE);

	return panel;
}
Beispiel #25
0
bool CSettingsManager::Initialize(const TiXmlElement *root)
{
  CExclusiveLock lock(m_critical);
  CExclusiveLock settingsLock(m_settingsCritical);
  if (m_initialized || root == NULL)
    return false;

  if (!StringUtils::EqualsNoCase(root->ValueStr(), SETTING_XML_ROOT))
  {
    CLog::Log(LOGERROR, "CSettingsManager: error reading settings definition: doesn't contain <settings> tag");
    return false;
  }

  const TiXmlNode *sectionNode = root->FirstChild(SETTING_XML_ELM_SECTION);
  while (sectionNode != NULL)
  {
    std::string sectionId;
    if (CSettingSection::DeserializeIdentification(sectionNode, sectionId))
    {
      CSettingSection *section = NULL;
      SettingSectionMap::iterator itSection = m_sections.find(sectionId);
      bool update = (itSection != m_sections.end());
      if (!update)
        section = new CSettingSection(sectionId, this);
      else
        section = itSection->second;

      if (section->Deserialize(sectionNode, update))
        AddSection(section);
      else
      {
        CLog::Log(LOGWARNING, "CSettingsManager: unable to read section \"%s\"", sectionId.c_str());
        if (!update)
          delete section;
      }
    }
      
    sectionNode = sectionNode->NextSibling(SETTING_XML_ELM_SECTION);
  }

  return true;
}
Beispiel #26
0
Panel *InitDocks(WMWidget *parent)
{
	_Panel *panel;

	panel = wmalloc(sizeof(_Panel));
	memset(panel, 0, sizeof(_Panel));

	panel->sectionName = _("Dock Preferences");

	panel->description = _("Dock and clip features.\n"
			       "Enable/disable the Dock and Clip, and tune some delays.");

	panel->parent = parent;

	panel->callbacks.createWidgets = createPanel;
	panel->callbacks.updateDomain = storeData;

	AddSection(panel, ICON_FILE);

	return panel;
}
Beispiel #27
0
Panel *InitMenu(WMWidget *parent)
{
	_Panel *panel;

	panel = wmalloc(sizeof(_Panel));

	panel->sectionName = _("Applications Menu Definition");

	panel->description = _("Edit the menu for launching applications.");

	panel->parent = parent;

	panel->callbacks.createWidgets = createPanel;
	panel->callbacks.updateDomain = storeData;
	panel->callbacks.showPanel = showMenus;
	panel->callbacks.hidePanel = hideMenus;

	AddSection(panel, ICON_FILE);

	return panel;
}
void CPDF_VariableText::Initialize() {
  if (!m_bInitial) {
    CPVT_SectionInfo secinfo;
    if (m_bRichText) {
      secinfo.pSecProps = new CPVT_SecProps(0.0f, 0.0f, 0);
      secinfo.pWordProps = new CPVT_WordProps(
          GetDefaultFontIndex(), kDefaultFontSize, 0, ScriptType::Normal, 0);
    }
    CPVT_WordPlace place;
    place.nSecIndex = 0;
    AddSection(place, secinfo);
    CPVT_LineInfo lineinfo;
    lineinfo.fLineAscent = GetFontAscent(GetDefaultFontIndex(), GetFontSize());
    lineinfo.fLineDescent =
        GetFontDescent(GetDefaultFontIndex(), GetFontSize());
    AddLine(place, lineinfo);
    if (CSection* pSection = m_SectionArray.GetAt(0))
      pSection->ResetLinePlace();

    m_bInitial = TRUE;
  }
}
Beispiel #29
0
void IniFile::SetValue(const std::string& section, const std::string& key, const std::string& value)
{
	Sections::iterator i = _settings.find(section);

	if (i == _settings.end() )// section not found
	{
		AddSection( section );
	}

	i = _settings.find(section);
	for( Options::iterator kv=i->second.begin(); kv!=i->second.end(); kv++ )
	{
		if( kv->key == key )
		{
			kv->value = value;
			return;
		}
	}

	Option op = { key, value };
	i->second.push_back( op );
}
Beispiel #30
0
Panel*
InitMenuPreferences(WMScreen *scr, WMWidget *parent)
{
    _Panel *panel;

    panel = wmalloc(sizeof(_Panel));
    memset(panel, 0, sizeof(_Panel));

    panel->sectionName = _("Menu Preferences");

    panel->description = _("Menu usability related options. Scrolling speed,\n"
                           "alignment of submenus etc.");

    panel->parent = parent;

    panel->callbacks.createWidgets = createPanel;
    panel->callbacks.updateDomain = storeData;

    AddSection(panel, ICON_FILE);

    return panel;
}