当前位置: 首页>>代码示例>>C++>>正文


C++ ColorList::begin方法代码示例

本文整理汇总了C++中ColorList::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ ColorList::begin方法的具体用法?C++ ColorList::begin怎么用?C++ ColorList::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ColorList的用法示例。


在下文中一共展示了ColorList::begin方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Colorize

void CFulEditCtrl::Colorize(const tstring& aLine, int begin) {
	CHARFORMAT2 cf;
	cf.cbSize = sizeof(CHARFORMAT2);
	
	ColorList *cList = HighlightManager::getInstance()->getList();

	int end = GetTextLengthEx(GTL_NUMCHARS);
	
	SetSel(begin, end);
	//otroligt fulhack, måste lagas riktigt nån gång
	SetSelectionCharFormat(selFormat);

	logged = false;

	//compare the last line against all strings in the vector
	for(ColorIter i = cList->begin(); i != cList->end(); ++i) {
		ColorSettings* cs = &(*i);
		int pos;
		
		//set start position for find
		if( cs->getIncludeNick() ) {
			pos = 0;
		} else {
			pos = aLine.find(_T(">"));
			if(pos == tstring::npos)
				pos = aLine.find(_T("**")) + nick.length();
		}

		//prepare the charformat
		cf.dwMask = CFM_BOLD | CFM_UNDERLINE | CFM_STRIKEOUT | CFM_ITALIC;
		cf.dwEffects = 0;
		if(cs->getBold())		cf.dwEffects |= CFE_BOLD;
		if(cs->getItalic())		cf.dwEffects |= CFE_ITALIC;
		if(cs->getUnderline())	cf.dwEffects |= CFE_UNDERLINE;
		if(cs->getStrikeout())	cf.dwEffects |= CFE_STRIKEOUT;
		
		if(cs->getHasBgColor()){
			cf.dwMask |= CFM_BACKCOLOR;
			cf.crBackColor = cs->getBgColor();
		}
		if(cs->getHasFgColor()){
			cf.dwMask |= CFM_COLOR;
			cf.crTextColor = cs->getFgColor();
		}
		
		while( pos != string::npos ){
			if(cs->usingRegexp()) 
				pos = RegExpMatch(cs, cf, aLine, begin);
			else 
				pos = FullTextMatch(cs, cf, aLine, pos, begin);
		}

		matchedPopup = false;
		matchedSound = false;
		
	}//end for

}//end Colorize
开发者ID:BackupTheBerlios,项目名称:fuldc-svn,代码行数:58,代码来源:FulEditCtrl.cpp

示例2: addColors

void ColorList::addColors(const ColorList& colorList, bool overwrite)
{
	ColorList::ConstIterator it;
	ColorList::ConstIterator itend;
	itend = colorList.end();
	for (it = colorList.begin(); it != itend; ++it)
	{
		if (overwrite || !contains(it.key()))
			insert(it.key(), it.value());
	}
}
开发者ID:Fahad-Alsaidi,项目名称:scribus-svn,代码行数:11,代码来源:sccolor.cpp

示例3: fillFillColorCombo

void SMCellStyleWidget::fillFillColorCombo(ColorList &colors)
{
	fillColor->clear();

	fillColor->addItem(CommonStrings::tr_NoneColor);
	ColorList::Iterator itEnd = colors.end();
	ScribusDoc* doc = colors.document();
	for (ColorList::Iterator it = colors.begin(); it != itEnd; ++it)
	{
		fillColor->insertFancyItem(it.value(), doc, it.key());
	}
	fillColor->view()->setMinimumWidth(fillColor->view()->maximumViewportSize().width()+24);
}
开发者ID:JLuc,项目名称:scribus,代码行数:13,代码来源:smcellstylewidget.cpp

示例4: insertFancyPixmapItems

void ColorListBox::insertFancyPixmapItems(ColorList& list)
{
    ColorList::Iterator it;
    ScribusDoc* doc = list.document();
    for (it = list.begin(); it != list.end(); ++it)
    {
        if (it.key() == CommonStrings::None || it.key() == CommonStrings::tr_NoneColor)
            continue;
        addItem( new ColorPixmapItem(it.value(), doc, it.key()) );
    }
    if (itemDelegate())
        delete itemDelegate();
    setItemDelegate(new ColorFancyItemDelegate());
}
开发者ID:pvanek,项目名称:scribus-cuba-1.5.0,代码行数:14,代码来源:colorlistbox.cpp

示例5: ColorAPI

/**
 * Scripter.colors
 * Property
 * returns a color object
 */
QList<QVariant> ScripterImpl::colors()
{
	QList<QVariant> l;

	ColorList names = PrefsManager::instance()->colorSet();
	ColorList::Iterator it;
	for (it = names.begin(); it != names.end(); ++it)
	{
		ScColor *value = &(names[it.key()]);
		ColorAPI *color = new ColorAPI(value, it.key());
		l.append(qVariantFromValue((QObject *)(color)));
	}
	return l;
}
开发者ID:QuLogic,项目名称:scribus-plugin-scripter,代码行数:19,代码来源:scripterimpl.cpp

示例6: ColorAPI

/**
 * Scripter.activeDocument.colors
 * Property
 * Colors of activeDocument
 */
QList<QVariant> DocumentAPI::colors()
{
	QList<QVariant> l;

	ColorList names = ScCore->primaryMainWindow()->doc->PageColors;
	ColorList::Iterator it;
	for (it = names.begin(); it != names.end(); ++it)
	{
		ScColor *value = &(names[it.key()]);
		ColorAPI *color = new ColorAPI(value, it.key());
		l.append(qVariantFromValue((QObject *)(color)));
	}
	return l;
}
开发者ID:JLuc,项目名称:scribus,代码行数:19,代码来源:api_document.cpp

示例7: mergePixelIntoColorCounts

void ColorFilter::mergePixelIntoColorCounts (QRgb pixel,
                                             ColorList &colorCounts) const
{
  ColorFilterEntry entry;
  entry.color = pixel;
  entry.count = 0;

  // Look for previous entry
  bool found = false;
  for (ColorList::iterator itr = colorCounts.begin (); itr != colorCounts.end (); itr++) {
    if (colorCompare (entry.color.rgb(),
                      (*itr).color.rgb())) {
      found = true;
      ++(*itr).count;
      break;
    }
  }

  if (!found) {
    colorCounts.append (entry);
  }
}
开发者ID:m2pathan,项目名称:engauge-digitizer,代码行数:22,代码来源:ColorFilter.cpp

示例8: marginColor

QRgb ColorFilter::marginColor(const QImage *image) const
{
  // Add unique colors to colors list
  ColorList colorCounts;
  for (int x = 0; x < image->width (); x++) {
    mergePixelIntoColorCounts (image->pixel (x, 0), colorCounts);
    mergePixelIntoColorCounts (image->pixel (x, image->height () - 1), colorCounts);
  }
  for (int y = 0; y < image->height (); y++) {
    mergePixelIntoColorCounts (image->pixel (0, y), colorCounts);
    mergePixelIntoColorCounts (image->pixel (image->width () - 1, y), colorCounts);
  }

  // Margin color is the most frequent color
  ColorFilterEntry entryMax;
  entryMax.count = 0;
  for (ColorList::const_iterator itr = colorCounts.begin (); itr != colorCounts.end (); itr++) {
    if ((*itr).count > entryMax.count) {
      entryMax = *itr;
    }
  }

  return entryMax.color.rgb();
}
开发者ID:m2pathan,项目名称:engauge-digitizer,代码行数:24,代码来源:ColorFilter.cpp

示例9: commitIdChanges

//=============================================================================
//commits the changes of the ID session
//
void EntertainerManager::commitIdChanges(PlayerObject* customer,PlayerObject* designer, BString hair, uint32 amount,uint8 statMigration, BString holoEmote,uint8 flagHair)
{
    Ham* ham = designer->getHam();
    if(ham->checkMainPools(0,0,66))
    {
        //int32 mindCost = 66;
        designer->getHam()->updatePropertyValue(HamBar_Mind,HamProperty_CurrentHitpoints,-(66));
    }


    const PlayerObjectSet* const inRangePlayers	= customer->getKnownPlayers();
    PlayerObjectSet::const_iterator	itiR			= inRangePlayers->begin();

    int8 sql[1024];
    EntertainerManagerAsyncContainer* asyncContainer;

    //money
    if(amount >0)
        applyMoney(customer,designer,amount);


    ////////
    //Hair//
    ///////
    if(flagHair)
        applyHair(customer,hair);



    ////////////
    //attributes
    ///////////
    int8						mySQL[2048];
    AttributesList*				aList			 = customer->getIdAttributesList();
    AttributesList::iterator	it				 = aList->begin();
    BString						data;
    bool						firstUpdate		 = true;

    sprintf(mySQL,"UPDATE character_appearance set ");

    while(it != aList->end())
    {
        gLogger->log(LogManager::DEBUG,"ID apply changes : attribute : %s crc : %u", it->first.getAnsi(),it->first.getCrc());
        //apply the attributes and retrieve the data to update the db
        if(it->first.getCrc() != BString("height").getCrc())
        {
            data = commitIdAttribute(customer, it->first, it->second);
        }
        else
        {
            data = commitIdheight(customer, it->second);
        }


        if (firstUpdate)
        {
            sprintf(mySQL,"%s %s",mySQL,data.getAnsi());
            firstUpdate = false;
        }
        else
            sprintf(mySQL,"%s, %s",mySQL,data.getAnsi());

        ++it;
    }

    //colors
    ColorList* cList = customer->getIdColorList();
    ColorList::iterator cIt = cList->begin();
    while(cIt != cList->end())
    {
        gLogger->log(LogManager::DEBUG,"ID apply changes : attribute : %s crc : %u",cIt->first.getAnsi(),cIt->first.getCrc());
        data = commitIdColor(customer, cIt->first, cIt->second);
        if(data.getLength())
        {
            if (firstUpdate)
            {
                sprintf(mySQL,"%s %s",mySQL,data.getAnsi());
                firstUpdate = false;
            }
            else
                sprintf(mySQL,"%s, %s",mySQL,data.getAnsi());
        }


        ++cIt;
    }

    //do we have actual data or only the primer ??? "UPDATE character_appearance set "
    if(strlen(mySQL) > 33)
    {
        sprintf(sql,"%s where character_id = '%"PRIu64"'",mySQL,customer->getId());
        gLogger->log(LogManager::DEBUG,"ID apply changes : sql: %s ",sql);
        asyncContainer = new EntertainerManagerAsyncContainer(EMQuery_NULL,0);
        mDatabase->ExecuteSqlAsync(this,asyncContainer,sql);
        
    }

//.........这里部分代码省略.........
开发者ID:jason83,项目名称:mmoserver,代码行数:101,代码来源:ImageDesignManager.cpp

示例10: serializeObjects

void Serializer::serializeObjects(const Selection& selection, SaxHandler& outputhandler)
{
	Xml_attr attr;
	UniqueID handler( & outputhandler );
	handler.beginDoc();
	handler.begin("SCRIBUSFRAGMENT", attr);
	ScribusDoc* doc = selection.itemAt(0)->doc();
	
	
	QMap<QString,int>::Iterator itf;
	for (itf = doc->UsedFonts.begin(); itf != doc->UsedFonts.end(); ++itf)
	{
		attr["name"] = itf.key();
		handler.beginEnd("font", attr);
	}
	
	ColorList usedColors;
	doc->getUsedColors(usedColors, false);
	ColorList::Iterator itc;
	for (itc = usedColors.begin(); itc != usedColors.end(); ++itc)
	{
		Xml_attr cattr;
		cattr["name"] = itc.key();
		if (doc->PageColors[itc.key()].getColorModel() == colorModelRGB)
			cattr["RGB"] = doc->PageColors[itc.key()].nameRGB();
		else
			cattr["CMYK"] = doc->PageColors[itc.key()].nameCMYK();
		cattr["Spot"] = toXMLString(doc->PageColors[itc.key()].isSpotColor());
		cattr["Register"] = toXMLString(doc->PageColors[itc.key()].isRegistrationColor());
		handler.beginEnd("color", cattr);
	}
	
	ResourceCollection lists;
	for (int i=0; i < doc->Items->count(); ++i)
		doc->Items->at(i)->getNamedResources(lists);
	
	QList<QString>::Iterator it;
	QList<QString> names = lists.styleNames();
	for (it = names.begin(); it != names.end(); ++it)
		doc->paragraphStyles().get(*it).saxx(handler);

	names = lists.charStyleNames();
	for (it = names.begin(); it != names.end(); ++it)
		doc->charStyles().get(*it).saxx(handler);
	
	names = lists.lineStyleNames();
	for (it = names.begin(); it != names.end(); ++it)
	{
		Xml_attr multiattr;
		multiattr["Name"] = *it;
		handler.begin("MultiLine", multiattr);		
		multiLine ml = doc->MLineStyles[*it];
		
		multiLine::Iterator itMU2;
		for (itMU2 = ml.begin(); itMU2 != ml.end(); ++itMU2)
		{
			Xml_attr lineattr;
			lineattr["Color"] = (*itMU2).Color;
			lineattr["Shade"] = toXMLString((*itMU2).Shade);
			lineattr["Dash"] = toXMLString((*itMU2).Dash);
			lineattr["LineEnd"] = toXMLString((*itMU2).LineEnd);
			lineattr["LineJoin"] = toXMLString((*itMU2).LineJoin);
			lineattr["Width"] = toXMLString((*itMU2).Width);
			handler.beginEnd("SubLine", lineattr);
		}
		handler.end("MultiLine");
	}

	/*	names = lists.patterns();
	for (it = names.begin(); it != names.end(); ++it)
		doc->patterns[*it].saxx(handler);
*/
/*
	QStringList patterns = doc->getUsedPatternsSelection((Selection*)&selection);
	for (int c = 0; c < patterns.count(); ++c)
	{
		ScPattern& pa = doc->docPatterns[patterns[c]];
		Xml_attr cattr;
		cattr["Name"] = patterns[c];
		cattr["scaleX"] = toXMLString(pa.scaleX);
		cattr["scaleY"] = toXMLString(pa.scaleY);
		cattr["width"] = toXMLString(pa.width);
		cattr["height"] = toXMLString(pa.height);
		cattr["xoffset"] = toXMLString(pa.xoffset);
		cattr["yoffset"] = toXMLString(pa.yoffset);
		handler.begin("Pattern", cattr);
		for (int o = 0; o < pa.items.count(); o++)
		{
			pa.items.at(o)->saxx(handler);
		}
		handler.end("Pattern");
	}
*/
	for (int i=0; i < doc->Items->count(); ++i)
	{
		int k = selection.findItem(doc->Items->at(i));
		if (k >=0)
			doc->Items->at(i)->saxx(handler);
	}

//.........这里部分代码省略.........
开发者ID:moceap,项目名称:scribus,代码行数:101,代码来源:serializer.cpp

示例11: importColorsFromFile

bool importColorsFromFile(QString fileName, ColorList &EditColors, QHash<QString, VGradient> *dialogGradients, bool merge)
{
	if (fileName.isEmpty())
		return false;
	int oldCount = EditColors.count();

	QFileInfo fi = QFileInfo(fileName);
	QString ext = fi.suffix().toLower();
	if (extensionIndicatesEPSorPS(ext))
	{
		PaletteLoader_PS psPalLoader;
		psPalLoader.setupTargets(&EditColors, dialogGradients);
		return psPalLoader.importFile(fileName, merge);
	}
	else
	{
		QStringList allFormatsV = LoadSavePlugin::getExtensionsForColors();
		if (allFormatsV.contains(ext))
		{
			FileLoader fl(fileName);
			int testResult = fl.testFile();
			if (testResult != -1)
			{
				ColorList LColors;
				if (fl.readColors(LColors))
				{
					ColorList::Iterator it;
					for (it = LColors.begin(); it != LColors.end(); ++it)
					{
						EditColors.tryAddColor(it.key(), it.value());
					}
					return (EditColors.count() != oldCount);
				}
			}
		}
		if (ext == "acb")			// Adobe color book format
		{
			PaletteLoader_Adobe_acb adobePalLoader;
			if (adobePalLoader.isFileSupported(fileName))
			{
				adobePalLoader.setupTargets(&EditColors, dialogGradients);
				return adobePalLoader.importFile(fileName, merge);
			}

			PaletteLoader_Autocad_acb autocadPalLoder;
			if (autocadPalLoder.isFileSupported(fileName))
			{
				autocadPalLoder.setupTargets(&EditColors, dialogGradients);
				return autocadPalLoder.importFile(fileName, merge);
			}
			return false;
		}
		else if (ext == "aco")			// Adobe color swatch format
		{
			PaletteLoader_Adobe_aco adobePalLoader;
			if (adobePalLoader.isFileSupported(fileName))
			{
				adobePalLoader.setupTargets(&EditColors, dialogGradients);
				return adobePalLoader.importFile(fileName, merge);
			}
			return false;
		}
		else if (ext == "ase")			// Adobe swatch exchange format
		{
			PaletteLoader_Adobe_ase adobePalLoader;
			if (adobePalLoader.isFileSupported(fileName))
			{
				adobePalLoader.setupTargets(&EditColors, dialogGradients);
				return adobePalLoader.importFile(fileName, merge);
			}
			return false;
		}
		else if (ext == "cxf")			// Adobe swatch exchange format
		{
			PaletteLoader_CxF cxfLoader;
			if (cxfLoader.isFileSupported(fileName))
			{
				cxfLoader.setupTargets(&EditColors, dialogGradients);
				return cxfLoader.importFile(fileName, merge);
			}
			return false;
		}
		else if (ext == "skp")			// Sk1 palette
		{
			PaletteLoader_sK1 sk1PalLoader;
			if (sk1PalLoader.isFileSupported(fileName))
			{
				sk1PalLoader.setupTargets(&EditColors, dialogGradients);
				return sk1PalLoader.importFile(fileName, merge);
			}
			return false;
		}
		else if (ext == "sbz")
		{
			PaletteLoader_Swatchbook swatchbookLoader;
			if (swatchbookLoader.isFileSupported(fileName))
			{
				swatchbookLoader.setupTargets(&EditColors, dialogGradients);
				return swatchbookLoader.importFile(fileName, merge);
			}
//.........这里部分代码省略.........
开发者ID:HOST-Oman,项目名称:scribus,代码行数:101,代码来源:util_color.cpp


注:本文中的ColorList::begin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。