本文整理汇总了C++中KateView::setIconBorder方法的典型用法代码示例。如果您正苦于以下问题:C++ KateView::setIconBorder方法的具体用法?C++ KateView::setIconBorder怎么用?C++ KateView::setIconBorder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KateView
的用法示例。
在下文中一共展示了KateView::setIconBorder方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: args
//.........这里部分代码省略.........
bool ok;
int val ( args.first().toInt( &ok ) );
if ( !ok )
KCC_ERR( i18n("Failed to convert argument '%1' to integer.")
.arg( args.first() ) );
if ( cmd == "set-tab-width" )
{
if ( val < 1 )
KCC_ERR( i18n("Width must be at least 1.") );
v->setTabWidth( val );
}
else if ( cmd == "set-indent-width" )
{
if ( val < 1 )
KCC_ERR( i18n("Width must be at least 1.") );
v->doc()->config()->setIndentationWidth( val );
}
else if ( cmd == "set-word-wrap-column" )
{
if ( val < 2 )
KCC_ERR( i18n("Column must be at least 1.") );
v->doc()->setWordWrapAt( val );
}
else if ( cmd == "goto" )
{
if ( val < 1 )
KCC_ERR( i18n("Line must be at least 1") );
if ( (uint)val > v->doc()->numLines() )
KCC_ERR( i18n("There is not that many lines in this document") );
v->gotoLineNumber( val - 1 );
}
return true;
}
// ALL commands that takes 1 boolean argument.
else if ( cmd == "set-icon-border" ||
cmd == "set-folding-markers" ||
cmd == "set-line-numbers" ||
cmd == "set-replace-tabs" ||
cmd == "set-remove-trailing-space" ||
cmd == "set-show-tabs" ||
cmd == "set-indent-spaces" ||
cmd == "set-mixed-indent" ||
cmd == "set-word-wrap" ||
cmd == "set-wrap-cursor" ||
cmd == "set-replace-tabs-save" ||
cmd == "set-remove-trailing-space-save" ||
cmd == "set-show-indent" )
{
if ( ! args.count() )
KCC_ERR( i18n("Usage: %1 on|off|1|0|true|false").arg( cmd ) );
bool enable;
if ( getBoolArg( args.first(), &enable ) )
{
if ( cmd == "set-icon-border" )
v->setIconBorder( enable );
else if (cmd == "set-folding-markers")
v->setFoldingMarkersOn( enable );
else if ( cmd == "set-line-numbers" )
v->setLineNumbersOn( enable );
else if ( cmd == "set-show-indent" )
v->renderer()->setShowIndentLines( enable );
else if ( cmd == "set-replace-tabs" )
setDocFlag( KateDocumentConfig::cfReplaceTabsDyn, enable, v->doc() );
else if ( cmd == "set-remove-trailing-space" )
setDocFlag( KateDocumentConfig::cfRemoveTrailingDyn, enable, v->doc() );
else if ( cmd == "set-show-tabs" )
setDocFlag( KateDocumentConfig::cfShowTabs, enable, v->doc() );
else if ( cmd == "set-indent-spaces" )
setDocFlag( KateDocumentConfig::cfSpaceIndent, enable, v->doc() );
else if ( cmd == "set-mixed-indent" )
{
// this is special, in that everything is set up -- space-indent is enabled,
// and a indent-width is set if it is 0 (to tabwidth/2)
setDocFlag( KateDocumentConfig::cfMixedIndent, enable, v->doc() );
if ( enable )
{
setDocFlag( KateDocumentConfig::cfSpaceIndent, enable, v->doc() );
if ( ! v->doc()->config()->indentationWidth() )
v->doc()->config()->setIndentationWidth( v->tabWidth()/2 );
}
}
else if ( cmd == "set-word-wrap" )
v->doc()->setWordWrap( enable );
else if ( cmd == "set-remove-trailing-space-save" )
setDocFlag( KateDocumentConfig::cfRemoveSpaces, enable, v->doc() );
else if ( cmd == "set-wrap-cursor" )
setDocFlag( KateDocumentConfig::cfWrapCursor, enable, v->doc() );
return true;
}
else
KCC_ERR( i18n("Bad argument '%1'. Usage: %2 on|off|1|0|true|false")
.arg( args.first() ).arg( cmd ) );
}
// unlikely..
KCC_ERR( i18n("Unknown command '%1'").arg(cmd) );
}
示例2: args
//.........这里部分代码省略.........
args.first() ) );
if ( cmd == "set-tab-width" )
{
if ( val < 1 )
KCC_ERR( i18n("Width must be at least 1.") );
v->doc()->config()->setTabWidth( val );
}
else if ( cmd == "set-indent-width" )
{
if ( val < 1 )
KCC_ERR( i18n("Width must be at least 1.") );
v->doc()->config()->setIndentationWidth( val );
}
else if ( cmd == "set-word-wrap-column" )
{
if ( val < 2 )
KCC_ERR( i18n("Column must be at least 1.") );
v->doc()->setWordWrapAt( val );
}
else if ( cmd == "goto" )
{
if ( args.first().at(0) == '-' || args.first().at(0) == '+' ) {
// if the number starts with a minus or plus sign, add/subract the number
val = v->cursorPosition().line() + val;
} else {
val--; // convert given line number to the internal representation of line numbers
}
// constrain cursor to the range [0, number of lines]
if ( val < 0 ) {
val = 0;
} else if ( val > v->doc()->lines()-1 ) {
val = v->doc()->lines()-1;
}
v->setCursorPosition( KTextEditor::Cursor( val, 0 ) );
return true;
}
return true;
}
// ALL commands that takes 1 boolean argument.
else if ( cmd == "set-icon-border" ||
cmd == "set-folding-markers" ||
cmd == "set-line-numbers" ||
cmd == "set-replace-tabs" ||
cmd == "set-show-tabs" ||
cmd == "set-word-wrap" ||
cmd == "set-wrap-cursor" ||
cmd == "set-replace-tabs-save" ||
cmd == "set-show-indent" )
{
if ( ! args.count() )
KCC_ERR( i18n("Usage: %1 on|off|1|0|true|false", cmd ) );
bool enable = false;
KateDocumentConfig * const config = v->doc()->config();
if ( getBoolArg( args.first(), &enable ) )
{
if ( cmd == "set-icon-border" )
v->setIconBorder( enable );
else if (cmd == "set-folding-markers")
v->setFoldingMarkersOn( enable );
else if ( cmd == "set-line-numbers" )
v->setLineNumbersOn( enable );
else if ( cmd == "set-show-indent" )
v->renderer()->setShowIndentLines( enable );
else if ( cmd == "set-replace-tabs" )
config->setReplaceTabsDyn( enable );
else if ( cmd == "set-show-tabs" )
config->setShowTabs( enable );
else if ( cmd == "set-show-trailing-spaces" )
config->setShowSpaces( enable );
else if ( cmd == "set-word-wrap" )
v->doc()->setWordWrap( enable );
return true;
}
else
KCC_ERR( i18n("Bad argument '%1'. Usage: %2 on|off|1|0|true|false",
args.first() , cmd ) );
}
else if ( cmd == "set-remove-trailing-spaces" ) {
// need at least one item, otherwise args.first() crashes
if ( args.count() != 1 )
KCC_ERR( i18n("Usage: set-remove-trailing-spaces 0|-|none or 1|+|mod|modified or 2|*|all") );
QString tmp = args.first().toLower().trimmed();
if (tmp == "1" || tmp == "modified" || tmp == "mod" || tmp == "+") {
v->doc()->config()->setRemoveSpaces(1);
} else if (tmp == "2" || tmp == "all" || tmp == "*") {
v->doc()->config()->setRemoveSpaces(2);
} else {
v->doc()->config()->setRemoveSpaces(0);
}
}
// unlikely..
KCC_ERR( i18n("Unknown command '%1'", cmd) );
}