本文整理汇总了C++中StyleSet类的典型用法代码示例。如果您正苦于以下问题:C++ StyleSet类的具体用法?C++ StyleSet怎么用?C++ StyleSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StyleSet类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setParaStyleAttributes
void gtAction::updateParagraphStyle(int pstyleIndex, gtParagraphStyle* pstyle)
{
gtFont* font = pstyle->getFont();
ParagraphStyle vg;
setParaStyleAttributes(pstyle, vg);
setCharStyleAttributes(font, vg.charStyle());
// Maybe set those attributes when target is the frame
/*vg.charStyle().setShadowXOffset(50);
vg.charStyle().setShadowYOffset(-50);
vg.charStyle().setOutlineWidth(10);
vg.charStyle().setScaleH(1000);
vg.charStyle().setScaleV(1000);
vg.charStyle().setBaselineOffset(0);
vg.charStyle().setTracking(0);
vg.charStyle().setUnderlineOffset(textFrame->doc()->typographicSettings.valueUnderlinePos);
vg.charStyle().setUnderlineWidth(textFrame->doc()->typographicSettings.valueUnderlineWidth);
vg.charStyle().setStrikethruOffset(textFrame->doc()->typographicSettings.valueStrikeThruPos);
vg.charStyle().setStrikethruWidth(textFrame->doc()->typographicSettings.valueStrikeThruPos);*/
StyleSet<ParagraphStyle> tmp;
tmp.create(vg);
textFrame->doc()->redefineStyles(tmp, false);
if (vg.name() != textFrame->doc()->paragraphStyles()[pstyleIndex].name())
{
QMap<QString, QString> map;
map[textFrame->doc()->paragraphStyles()[pstyleIndex].name()] = vg.name();
textFrame->doc()->replaceStyles(map);
}
}
示例2: wxMkdir
/* StyleSet::loadCustomStyles
* Loads all text styles from the user text style directory
*******************************************************************/
bool StyleSet::loadCustomStyles()
{
// If the custom stylesets directory doesn't exist, create it
if (!wxDirExists(appPath("text_styles", DIR_USER)))
wxMkdir(appPath("text_styles", DIR_USER));
// Open the custom stylesets directory
wxDir res_dir;
res_dir.Open(appPath("text_styles", DIR_USER));
// Go through each file in the directory
string filename = wxEmptyString;
bool files = res_dir.GetFirst(&filename, wxEmptyString, wxDIR_FILES);
while (files)
{
// Read file into tokenizer
Tokenizer tz;
tz.openFile(res_dir.GetName() + "/" + filename);
// Parse it
ParseTreeNode root;
root.allowDup(true);
root.parse(tz);
// Read any styleset definitions
vector<STreeNode*> nodes = root.getChildren("styleset");
for (unsigned b = 0; b < nodes.size(); b++)
{
StyleSet* newset = new StyleSet();
if (newset->parseSet((ParseTreeNode*)nodes[b]))
style_sets.push_back(newset);
else
delete newset;
}
// Next file
files = res_dir.GetNext(&filename);
}
return true;
}
示例3: wxLogMessage
/* StyleSet::loadResourceStyles
* Loads all text styles from the slade resource archive (slade.pk3)
*******************************************************************/
bool StyleSet::loadResourceStyles()
{
// Get 'config/text_styles' directory in slade.pk3
ArchiveTreeNode* dir = theArchiveManager->programResourceArchive()->getDir("config/text_styles");
// Check it exists
if (!dir)
{
wxLogMessage("Warning: No 'config/text_styles' directory exists in slade.pk3");
return false;
}
// Read default style set first
ArchiveEntry* default_style = dir->getEntry("default.sss");
if (default_style)
{
// Read entry data into tokenizer
Tokenizer tz;
tz.openMem(&default_style->getMCData(), default_style->getName());
// Parse it
ParseTreeNode root;
root.allowDup(true);
root.parse(tz);
// Read any styleset definitions
vector<STreeNode*> nodes = root.getChildren("styleset");
for (unsigned b = 0; b < nodes.size(); b++)
{
StyleSet* newset = new StyleSet();
if (newset->parseSet((ParseTreeNode*)nodes[b]))
style_sets.push_back(newset);
else
delete newset;
}
}
// Go through all entries within it
for (unsigned a = 0; a < dir->numEntries(); a++)
{
ArchiveEntry* entry = dir->getEntry(a);
// Skip default
if (entry->getName(true) == "default")
continue;
// Read entry data into tokenizer
Tokenizer tz;
tz.openMem(&entry->getMCData(), entry->getName());
// Parse it
ParseTreeNode root;
root.allowDup(true);
root.parse(tz);
// Read any styleset definitions
vector<STreeNode*> nodes = root.getChildren("styleset");
for (unsigned b = 0; b < nodes.size(); b++)
{
StyleSet* newset = new StyleSet();
if (newset->parseSet((ParseTreeNode*)nodes[b]))
style_sets.push_back(newset);
else
delete newset;
}
}
return true;
}
示例4: collectCharStyle
void collectCharStyle(CharStyle* style) { if (style && !style->name().isEmpty()) cstyles.append(style); }
示例5: collectStyle
void collectStyle(ParagraphStyle* style) { if (style && !style->name().isEmpty()) pstyles.append(style); }