NODESIZE CNodeWord::Draw( const PVIEWINFO View, int x, int y ) { int tx; NODESIZE DrawSize; WORD *Data; if (m_bHidden) return DrawHidden( View, x, y ); Data = (WORD*)(View->Data + m_Offset); AddSelection( View, 0, y, g_FontHeight ); AddDelete( View, x, y ); AddTypeDrop( View, x, y ); //AddAdd(View,x,y); tx = x + TXOFFSET; tx = AddIcon( View, tx, y, ICON_UNSIGNED, HS_NONE, HS_NONE ); tx = AddAddressOffset( View, tx, y ); tx = AddText( View, tx, y, g_clrType, HS_NONE, _T( "WORD " ) ); tx = AddText( View, tx, y, g_clrName, HS_NAME, _T( "%s" ), m_strName ); tx = AddText( View, tx, y, g_clrName, HS_NONE, _T( " = " ) ); tx = AddText( View, tx, y, g_clrValue, HS_EDIT, g_bUnsignedHex ? _T( "0x%X" ) : _T( "%u" ), *Data ) + g_FontWidth; tx = AddComment( View, tx, y ); DrawSize.x = tx; DrawSize.y = y + g_FontHeight; return DrawSize; }
void ASNLexer::SkipComment(void) { CComment& comment = AddComment(); while ( true ) { // wait for end of comments char c = Char(); switch ( c ) { case '\n': SkipChar(); NextLine(); return; case 0: if ( Eof() ) return; break; case '-': if ( Char(1) == '-' ) { SkipChars(2); return; } break; case '*': if ( Char(1) == '/' ) { SkipChars(2); return; } break; } comment.AddChar(c); SkipChar(); } }
NODESIZE CNodeFloat::Draw( const PVIEWINFO View, int x, int y ) { int tx; NODESIZE DrawSize; float* Data; if (m_bHidden) return DrawHidden( View, x, y ); Data = (float*)(View->Data + m_Offset); AddSelection( View, 0, y, g_FontHeight ); AddDelete( View, x, y ); AddTypeDrop( View, x, y ); //AddAdd(View,x,y); tx = x + TXOFFSET; tx = AddIcon( View, tx, y, ICON_FLOAT, HS_NONE, HS_NONE ); tx = AddAddressOffset( View, tx, y ); tx = AddText( View, tx, y, g_clrType, HS_NONE, _T( "float " ) ); tx = AddText( View, tx, y, g_clrName, HS_NAME, _T( "%s" ), m_strName ); tx = AddText( View, tx, y, g_clrName, HS_NONE, _T( " = " ) ); //tx = AddText(View,tx,y,g_clrValue,0,"%.4f",pMemory[0]) + FontWidth; //if ( *pMemory > -99999.0f && *pMemory < 99999.0f ) // *pMemory = 0; tx = AddText( View, tx, y, g_clrValue, HS_EDIT, _T( "%4.3f" ), *Data ) + g_FontWidth; tx = AddComment( View, tx, y ); DrawSize.x = tx; DrawSize.y = y + g_FontHeight; return DrawSize; }
void UMaterialGraph::RebuildGraph() { check(Material); Modify(); RemoveAllNodes(); if (!MaterialFunction) { // Initialize the material input list. MaterialInputs.Add( FMaterialInputInfo( GetBaseColorPinName(), MP_BaseColor, LOCTEXT( "BaseColorToolTip", "Defines the overall color of the Material. Each channel is automatically clamped between 0 and 1" ) ) ); MaterialInputs.Add( FMaterialInputInfo( GetMetallicPinName(), MP_Metallic, LOCTEXT( "MetallicToolTip", "Controls how \"metal-like\" your surface looks like") ) ); MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("Specular", "Specular"), MP_Specular, LOCTEXT("SpecularToolTip", "Used to scale the current amount of specularity on non-metallic surfaces and is a value between 0 and 1, default at 0.5") ) ); MaterialInputs.Add( FMaterialInputInfo( LOCTEXT( "Roughness", "Roughness" ), MP_Roughness, LOCTEXT( "RoughnessToolTip", "Controls how rough the Material is. Roughness of 0 (smooth) is a mirror reflection and 1 (rough) is completely matte or diffuse" ) ) ); MaterialInputs.Add( FMaterialInputInfo( GetEmissivePinName(), MP_EmissiveColor, LOCTEXT( "EmissiveToolTip", "Controls which parts of your Material will appear to glow" ) ) ); MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("Opacity", "Opacity"), MP_Opacity, LOCTEXT( "OpacityToolTip", "Controls the transluecency of the Material" ) ) ); MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("OpacityMask", "Opacity Mask"), MP_OpacityMask, LOCTEXT( "OpacityMaskToolTip", "When in Masked mode, a Material is either completely visible or completely invisible" ) ) ); MaterialInputs.Add( FMaterialInputInfo( GetNormalPinName(), MP_Normal, LOCTEXT( "NormalToolTip", "Takes the input of a normal map" ) ) ); MaterialInputs.Add( FMaterialInputInfo( GetWorldPositionOffsetPinName(), MP_WorldPositionOffset, LOCTEXT( "WorldPositionOffsetToolTip", "Allows for the vertices of a mesh to be manipulated in world space by the Material" ) ) ); MaterialInputs.Add( FMaterialInputInfo( LOCTEXT( "WorldDisplacement", "World Displacement" ), MP_WorldDisplacement, LOCTEXT( "WorldDisplacementToolTip", "Allows for the tessellation vertices to be manipulated in world space by the Material" ) ) ); MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("TessellationMultiplier", "Tessellation Multiplier"), MP_TessellationMultiplier, LOCTEXT( "TessllationMultiplierToolTip", "Controls the amount tessellation along the surface" ) ) ); MaterialInputs.Add( FMaterialInputInfo( GetSubsurfacePinName(), MP_SubsurfaceColor, LOCTEXT( "SubsurfaceToolTip", "Allows you to add a color to your Material to simulate shifts in color when light passes through the surface" ) ) ); MaterialInputs.Add( FMaterialInputInfo( GetCustomDataPinName(0), MP_CustomData0, GetCustomDataPinName( 0 ) ) ); MaterialInputs.Add( FMaterialInputInfo( GetCustomDataPinName(1), MP_CustomData1, GetCustomDataPinName( 1 ) ) ); MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("AmbientOcclusion", "Ambient Occlusion"), MP_AmbientOcclusion, LOCTEXT( "AmbientOcclusionToolTip", "Simulate the self-shadowing that happens within crevices of a surface" ) ) ); MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("Refraction", "Refraction"), MP_Refraction, LOCTEXT( "RefractionToolTip", "Takes in a texture or value that simulates the index of refraction of the surface" ) ) ); for (int32 UVIndex = 0; UVIndex < ARRAY_COUNT(Material->CustomizedUVs); UVIndex++) { //@todo - localize MaterialInputs.Add( FMaterialInputInfo( FText::FromString(FString::Printf(TEXT("Customized UV%u"), UVIndex)), (EMaterialProperty)(MP_CustomizedUVs0 + UVIndex), FText::FromString(FString::Printf( TEXT( "CustomizedUV%uToolTip" ), UVIndex ) ) ) ); } MaterialInputs.Add(FMaterialInputInfo(LOCTEXT("PixelDepthOffset", "Pixel Depth Offset"), MP_PixelDepthOffset, LOCTEXT( "PixelDepthOffsetToolTip", "Pixel Depth Offset" ) )); //^^^ New material properties go above here. ^^^^ MaterialInputs.Add(FMaterialInputInfo(LOCTEXT("MaterialAttributes", "Material Attributes"), MP_MaterialAttributes, LOCTEXT( "MaterialAttributesToolTip", "Material Attributes" ) )); // Add Root Node FGraphNodeCreator<UMaterialGraphNode_Root> NodeCreator(*this); RootNode = NodeCreator.CreateNode(); RootNode->Material = Material; NodeCreator.Finalize(); } for (int32 Index = 0; Index < Material->Expressions.Num(); Index++) { AddExpression(Material->Expressions[Index]); } for (int32 Index = 0; Index < Material->EditorComments.Num(); Index++) { AddComment(Material->EditorComments[Index]); } LinkGraphNodesFromMaterial(); }
void UMaterialGraph::RebuildGraph() { check(Material); Modify(); RemoveAllNodes(); if (!MaterialFunction) { // Initialize the material input list. MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("BaseColor", "Base Color"), MP_BaseColor ) ); MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("Metallic", "Metallic"), MP_Metallic ) ); MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("Specular", "Specular"), MP_Specular ) ); MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("Roughness", "Roughness"), MP_Roughness ) ); MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("EmissiveColor", "Emissive Color"), MP_EmissiveColor ) ); MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("Opacity", "Opacity"), MP_Opacity ) ); MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("OpacityMask", "Opacity Mask"), MP_OpacityMask ) ); MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("Normal", "Normal"), MP_Normal ) ); MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("WorldPositionOffset", "World Position Offset"), MP_WorldPositionOffset ) ); MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("WorldDisplacement", "World Displacement"), MP_WorldDisplacement ) ); MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("TessellationMultiplier", "Tessellation Multiplier"), MP_TessellationMultiplier ) ); MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("SubsurfaceColor", "Subsurface Color"), MP_SubsurfaceColor ) ); MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("ClearCoat", "Clear Coat"), MP_ClearCoat ) ); MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("ClearCoatRoughness", "Clear Coat Roughness"), MP_ClearCoatRoughness ) ); MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("AmbientOcclusion", "Ambient Occlusion"), MP_AmbientOcclusion ) ); MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("Refraction", "Refraction"), MP_Refraction) ); for (int32 UVIndex = 0; UVIndex < ARRAY_COUNT(Material->CustomizedUVs); UVIndex++) { //@todo - localize MaterialInputs.Add( FMaterialInputInfo( FText::FromString(FString::Printf(TEXT("Customized UV%u"), UVIndex)), (EMaterialProperty)(MP_CustomizedUVs0 + UVIndex)) ); } MaterialInputs.Add( FMaterialInputInfo( LOCTEXT("MaterialAttributes", "Material Attributes"), MP_MaterialAttributes) ); // Add Root Node FGraphNodeCreator<UMaterialGraphNode_Root> NodeCreator(*this); RootNode = NodeCreator.CreateNode(); RootNode->Material = Material; NodeCreator.Finalize(); } for (int32 Index = 0; Index < Material->Expressions.Num(); Index++) { AddExpression(Material->Expressions[Index]); } for (int32 Index = 0; Index < Material->EditorComments.Num(); Index++) { AddComment(Material->EditorComments[Index]); } LinkGraphNodesFromMaterial(); }
bool XMLInOut::SetupDoc(void) { DeleteDoc(); /* Create a new XML buffer, to which the XML document will be * written */ buf = xmlBufferCreate(); if (buf == NULL) { cout << "testXmlwriterMemory: Error creating the xml buffer\n" << endl; return false; } /* Create a new XmlWriter for memory, with no compression. * Remark: there is no compression for this kind of xmlTextWriter */ writer = xmlNewTextWriterMemory(buf, 0); if (writer == NULL) { cout << "testXmlwriterMemory: Error creating the xml writer\n" << endl; return false; } if (xmlTextWriterSetIndent(writer, 1) < 0) return false; /* Start the document with the xml default for the version, * encoding ISO 8859-1 and the default for the standalone * declaration. */ /* rc = xmlTextWriterStartDocument(writer, NULL, "ISO-8859-1", NULL); if (rc < 0) { printf ("testXmlwriterMemory: Error at xmlTextWriterStartDocument\n"); return false; } */ if (AddElement("neuron-brain") < 0) return false; if (AddElement("MACROGROUP") < 0) return false; // Important addition. When doing a MarkSection(), the # bytes wont be valid for what your // intuition tells you. The above <MACROGROUP> at this stage isn't closed due to possible // content and attributes. The comment forces things to "end" making the buffer ok for marking. if (AddComment("The Real Group of commands starts here.") < 0) return false; MarkSection(); return true; }
OP_STATUS External_SSL_CommCertificateDisplayContext::CreateComments(int errors) { const ServerName *server = m_comm_object->GetRealServerName(); const uni_char *server_name; OpSSLListener::SSLCertificate *certificate; uni_char *comment_temp; if (!server || !(server_name = server->UniName()) || !(certificate = m_display_certificates.Get(0)) || !(comment_temp = (uni_char *) g_memory_manager->GetTempBufUni())) return OpStatus::ERR; unsigned int comment_temp_len = g_memory_manager->GetTempBufUniLenUniChar(); if (errors & OpSocket::CERT_NO_CHAIN) { // FIXME: not sure this is the correct comment RETURN_IF_ERROR(AddComment(Str::S_CERT_UNKNOWN_CA, comment_temp, comment_temp_len, certificate->GetFullName(), certificate->GetIssuer())); } if (errors & OpSocket::CERT_INCOMPLETE_CHAIN) { // FIXME: not sure this is the correct comment RETURN_IF_ERROR(AddComment(Str::S_CERT_UNKNOWN_CA, comment_temp, comment_temp_len, certificate->GetFullName(), certificate->GetIssuer())); } if (errors & OpSocket::CERT_DIFFERENT_CERTIFICATE) { RETURN_IF_ERROR(AddComment(Str::S_CERT_MISMATCH_SERVERNAME, comment_temp, comment_temp_len, server_name, certificate->GetFullName())); } if (errors & OpSocket::CERT_EXPIRED) { RETURN_IF_ERROR(AddComment(Str::S_CERTIFICATE_EXPIRED, comment_temp, comment_temp_len, certificate->GetFullName(), certificate->GetValidTo())); } return OpStatus::OK; }
NODESIZE CNodeHex64::Draw( const PVIEWINFO View, int x, int y ) { int tx; NODESIZE DrawSize; const UCHAR* Data; if (m_bHidden) return DrawHidden( View, x, y ); Data = (const UCHAR*)(View->Data + m_Offset); AddSelection( View, 0, y, g_FontHeight ); AddDelete( View, x, y ); AddTypeDrop( View, x, y ); //AddAdd(View,x,y); tx = x + TXOFFSET + 16; tx = AddAddressOffset( View, tx, y ); if (g_bText) { CStringA AsciiMemory = GetStringFromMemoryA( (const char*)Data, 8 ) + " "; tx = AddText( View, tx, y, g_clrChar, HS_NONE, "%s", AsciiMemory.GetBuffer( ) ); } tx = AddText( View, tx, y, g_clrHex, 0, _T( "%0.2X" ), Data[0] ) + g_FontWidth; tx = AddText( View, tx, y, g_clrHex, 1, _T( "%0.2X" ), Data[1] ) + g_FontWidth; tx = AddText( View, tx, y, g_clrHex, 2, _T( "%0.2X" ), Data[2] ) + g_FontWidth; tx = AddText( View, tx, y, g_clrHex, 3, _T( "%0.2X" ), Data[3] ) + g_FontWidth; tx = AddText( View, tx, y, g_clrHex, 4, _T( "%0.2X" ), Data[4] ) + g_FontWidth; tx = AddText( View, tx, y, g_clrHex, 5, _T( "%0.2X" ), Data[5] ) + g_FontWidth; tx = AddText( View, tx, y, g_clrHex, 6, _T( "%0.2X" ), Data[6] ) + g_FontWidth; tx = AddText( View, tx, y, g_clrHex, 7, _T( "%0.2X" ), Data[7] ) + g_FontWidth; tx = AddComment( View, tx, y ); DrawSize.x = tx; DrawSize.y = y + g_FontHeight; return DrawSize; }
token_t Parser::NextToken() // ---------------------------------------------------------------------------- // Return the next token, skipping comments and gathering long text // ---------------------------------------------------------------------------- { text opening, closing; while (true) { token_t pend = pending; if (pend != tokNONE && pend != tokNEWLINE) { pending = tokNONE; beginningLine = false; return pend; } // Here, there's nothing pending or only a newline token_t result = scanner.NextToken(); hadSpaceBefore = scanner.HadSpaceBefore(); hadSpaceAfter = scanner.HadSpaceAfter(); switch(result) { case tokNAME: case tokSYMBOL: opening = scanner.NameValue(); if (opening == "syntax") { syntax.ReadSyntaxFile(scanner, 0); continue; } else if (syntax.IsComment(opening, closing)) { // Skip comments, keep looking to get the right indentation text comment = opening + scanner.Comment(closing); AddComment(comment); if (closing == "\n" && pend == tokNONE) { // If we had comments after a token, add them to that token if (!beginningLine && comments.size() && commented) { AddComments(commented, false); commented = NULL; } pending = tokNEWLINE; beginningLine = true; } else { // Don't change beginningLine in: /* ... */ /* ... */ } continue; } else if (syntax.IsTextDelimiter(opening, closing)) { text longText = scanner.Comment(closing, false); ulong cLen = closing.length(); longText.erase(longText.length() - cLen, cLen); scanner.SetTextValue(longText); openquote = opening; closequote = closing; if (pend == tokNEWLINE) { pending = tokLONGSTRING; return tokNEWLINE; } if (closing == "\n" && pend == tokNONE) { pending = tokNEWLINE; beginningLine = true; } else { beginningLine = false; } return tokLONGSTRING; } // If the next token has a substatement infix priority, // this takes over any pending newline. Example: else if (pend == tokNEWLINE) { int prefixPrio = syntax.PrefixPriority(opening); if (prefixPrio == syntax.default_priority) { int infixPrio = syntax.InfixPriority(opening); if (infixPrio < syntax.statement_priority) pending = pend = tokNONE; } } // All comments after this will be following the token beginningLine = false; break; case tokNEWLINE: // Record actual new-lines and preceding comment opening = scanner.TextValue(); if (!opening.empty()) { AddComment(opening); // If we had comments after a token, add them to that token if (!beginningLine && comments.size() && commented) { AddComments(commented, false); commented = NULL; } } // Combine newline with any previous pending indent pending = tokNEWLINE; beginningLine = true; continue; case tokUNINDENT: opening = scanner.TextValue(); if (!opening.empty()) { AddComment(opening); // If we had comments after a token, add them to that token if (!beginningLine && comments.size() && commented) { AddComments(commented, false); commented = NULL; } } // Add newline if what comes next isn't an infix like 'else' pending = tokNEWLINE; beginningLine = true; return result; case tokINDENT: // If we had a new-line followed by indent, ignore the new line pending = tokNONE; beginningLine = true; return result; default: beginningLine = false; break; } // switch (result) // If we have another token here and a pending newline, push // the other token back. if (pend != tokNONE) { pending = result; beginningLine = true; return pend; } return result; } // While loop }
QString toSQLParse::indentStatement(statement &stat, int level/*SQLITEMAN, toSyntaxAnalyzer &syntax*/) { QString ret; switch (stat.Type) { default: { QMessageBox::warning(QApplication::activeWindow(), "Sqliteman", "toSQLparse: Internal error in toSQLParse, should never get here"); } case statement::Block: { ret = IndentComment(level, 0, stat.Comment, false); int exc = 0; for (std::list<toSQLParse::statement>::iterator i = stat.subTokens().begin(); i != stat.subTokens().end(); i++) { int add = 0; std::list<toSQLParse::statement>::iterator j = i; j++; if (i != stat.subTokens().begin() && j != stat.subTokens().end()) add = Settings.IndentLevel; else exc = 0; QString t; if ((*i).subTokens().begin() != (*i).subTokens(). end()) t = (*(*i).subTokens().begin()).String.toUpper(); if (t == ("BEGIN") || t == ("WHEN") || t == ("ELSE") || t == ("ELSIF")) add = 0; if ((*i).Type == statement::List) ret += indentString(level + add + exc); ret += indentStatement(*i, level + add + exc/*SQLITEMAN , syntax*/); if ((*i).Type == statement::List) { int i; for (i = ret.length() - 1;i >= 0 && ret[i].isSpace();i--) ; ret = ret.mid(0, std::max(i + 1, 0)); ret += ("\n"); ret += indentString(level + exc); } if (t == ("EXCEPTION")) exc = Settings.IndentLevel * 2; } if (Settings.EndBlockNewline && level != 0) ret += ("\n"); } break; case statement::List: case statement::Statement: int maxlev = 0; int maxlevorig = 0; bool useMaxLev = false; bool any = true; int current; bool first; bool noKeyBreak = false; bool lineList = false; QString comment; if (stat.Type == statement::Statement) { ret = IndentComment(level, 0, stat.Comment, false); useMaxLev = true; first = true; current = 0; } else { for (std::list<toSQLParse::statement>::iterator i = stat.subTokens().begin(); i != stat.subTokens().end();) { if ((*i).Type != statement::Keyword) noKeyBreak = true; else useMaxLev = true; break; } current = level; first = true; } if (useMaxLev) { int count = 0; for (std::list<toSQLParse::statement>::iterator i = stat.subTokens().begin(); i != stat.subTokens().end(); i++) { if (any) { QString upp = (*i).String.toUpper(); if ((*i).Type == statement::Keyword && upp != ("LOOP") && upp != ("DO") && upp != ("THEN") && upp != ("AS") && upp != ("IS")) { if (int((*i).String.length()) + 1 > maxlev) maxlev = (*i).String.length() + 1; count++; any = false; } else if (i == stat.subTokens().begin()) { noKeyBreak = true; break; } } else if ((*i).Type == statement::Token) any = true; if ((*i).Type == statement::List) count++; } if (count <= 1 && maxlev > 0) maxlev--; maxlevorig = maxlev; any = true; } for (std::list<toSQLParse::statement>::iterator i = stat.subTokens().begin(); i != stat.subTokens().end(); i++) { comment = AddComment(comment, (*i).Comment); QString upp = (*i).String.toUpper(); #ifdef TOPARSE_DEBUG printf("%s\n", (const char*)(*i).String.toUtf8()); #endif if ((*i).Type == statement::List) { if (Settings.OperatorSpace) { ret += (" "); current++; } QString t = indentStatement(*i, current/*SQLITEMAN, syntax*/); if (t.indexOf(("\n")) >= 0) current = CurrentColumn(t); else current += CurrentColumn(t); ret += t; any = true; } else if ((*i).String == (",")) { if (Settings.CommaBefore) { ret += IndentComment(Settings.CommentColumn, current, comment, true); comment = QString::null; ret += indentString(level + maxlev - (Settings.OperatorSpace ? 2 : 1)); ret += (","); } else { ret += (","); ret += IndentComment(Settings.CommentColumn, current + 1, comment, true); comment = QString::null; ret += indentString(level + maxlev); } current = level + maxlev; any = false; lineList = true; } else if ((*i).Type == statement::Keyword && (upp == ("LOOP") || upp == ("DO") || upp == ("THEN") || upp == ("AS") || upp == ("IS"))) { if (!Settings.BlockOpenLine) { if (ret.length() > 0) { if (toIsIdent(ret.at(ret.length() - 1)) || ret.at(ret.length() - 1) == QUOTE_CHARACTER /*SQLITEMAN syntax.quoteCharacter()*/ || ret.at(ret.length() - 1) == '\'' || Settings.OperatorSpace) { ret += (" "); current++; } } ret += Settings.KeywordUpper ? (*i).String.toUpper() : (*i).String; current += (*i).String.length(); } else { ret += IndentComment(Settings.CommentColumn, current, comment, true); comment = QString::null; ret += indentString(level); ret += Settings.KeywordUpper ? (*i).String.toUpper() : (*i).String; current = level + (*i).String.length(); } any = false; } else if (any && (*i).Type == statement::Keyword && !noKeyBreak) { if (first) first = false; else { ret += IndentComment(Settings.CommentColumn, current, comment, true); current = 0; comment = QString::null; } if (current == 0) { ret += indentString(level); current = level; } else while (current < level) { ret += (" "); current++; } maxlev = maxlevorig; QString word = Settings.KeywordUpper ? (*i).String.toUpper() : (*i).String; if (ret.length()) { ret += QString("%1").arg(word, Settings.RightSeparator ? maxlev - 1 : 1 - maxlev); current = level + std::max(int(word.length()), maxlev - 1); } else { ret += word; current = level + word.length(); } any = false; lineList = false; } else { QString t = (*i).String; bool add = false; if ((*i).Type == statement::Keyword) { if (!lineList && !any && (*i).Type == statement::Keyword && !noKeyBreak && upp == ("BY")) add = true; } else { any = true; } if (isKeyword(upp) /*SQLITEMAN syntax.reservedWord(upp)*/ && Settings.KeywordUpper) t = upp; int extra; if (first) { first = false; any = false; extra = 0; } else { if (ret.length() > 0 && !ret.at(ret.length() - 1).isSpace() && (Settings.OperatorSpace || ((toIsIdent(t[0]) || t[0] == QUOTE_CHARACTER /*SQLITEMAN syntax.quoteCharacter()*/ || t[0] == '\'') && (toIsIdent(ret.at(ret.length() - 1)) || ret.at(ret.length() - 1) == QUOTE_CHARACTER /*SQLITEMAN syntax.quoteCharacter()*/ || ret.at(ret.length() - 1) == '\'') ) ) ) { if (t != (";") && t != (".") && ret.at(ret.length() - 1) != '.' && current != 0) { current++; ret += (" "); } } else if (ret.length() > 2 && ret.at(ret.length() - 2) == '*' && ret.at(ret.length() - 1) == '/') { current++; ret += (" "); } extra = maxlev; } if (current < level + maxlev) { if (current == 0) ret += indentString(level + maxlev); else while (current < level + maxlev) { ret += (" "); current++; } current = level + maxlev; } ret += t; current += t.length(); if (t.startsWith(("<<"))) { ret += ("\n"); current = 0; } if (add ) maxlev += t.length() + 1; } } if (stat.Type == statement::Statement) { ret += IndentComment(Settings.CommentColumn, current, comment, true); comment = QString::null; if (Settings.EndBlockNewline && level == 0 && stat.subTokens().begin() != stat.subTokens().end() && (*stat.subTokens().rbegin()).String == (";")) ret += ("\n"); } else if (!comment.isEmpty()) { ret += IndentComment(Settings.CommentColumn, current, comment, true); comment = QString::null; ret += indentString(level - (Settings.OperatorSpace ? 2 : 1)); } break; } return ret; }
void SaveConfigFile () { CSPList liste (512); liste.Add ("# ------------------------------------------------------------------"); liste.Add ("# The first group of params can be adjusted "); liste.Add ("# on the configuration screen, too"); liste.Add ("# ------------------------------------------------------------------"); liste.Add (""); AddComment (liste, "Full-screen mode [0...1]"); AddIntItem (liste, "fullscreen", param.fullscreen); liste.Add (""); AddComment (liste, "Screen resolution [0...9]"); AddComment (liste, "0 = auto, 1 = 800x600, 2 = 1024x768"); AddComment (liste, "3 = 1152x864, 4 = 1280x960, 5 = 1280x1024"); AddComment (liste, "6 = 1360x768, 7 = 1400x1050, 8 = 1440x900, 9=1680x1050"); AddIntItem (liste, "res_type", (int)param.res_type); liste.Add (""); AddComment (liste, "Level of details [1...3]"); AddComment (liste, "1 = best performance, 3 = best appearance"); AddIntItem (liste, "detail_level", param.perf_level); liste.Add (""); AddComment (liste, "Language code [0...]"); AddComment (liste, "0 = English etc."); AddIntItem (liste, "language", (int)param.language); liste.Add (""); AddComment (liste, "Sound volume [0...120]"); AddComment (liste, "Sounds are the terrain effects or the pickup noise."); AddIntItem (liste, "sound_volume", param.sound_volume); liste.Add (""); AddComment (liste, "Volume of the background music [0...120]"); AddIntItem (liste, "music_volume", param.music_volume); liste.Add (""); liste.Add ("# ------------------------------------------------------------------"); liste.Add ("# The second group of params must be adjusted in this file."); liste.Add ("# ------------------------------------------------------------------"); liste.Add (""); AddComment (liste, "Forward clipping distance"); AddComment (liste, "Controls how far ahead of the camera the course"); AddComment (liste, "is rendered. Larger values mean that more of the course is"); AddComment (liste, "rendered, resulting in slower performance. Decreasing this "); AddComment (liste, "value is an effective way to improve framerates."); AddIntItem (liste, "forward_clip_distance", param.forward_clip_distance); liste.Add (""); AddComment (liste, "Backward clipping distance"); AddComment (liste, "Some objects aren't yet clipped to the view frustum, "); AddComment (liste, "so this value is used to control how far up the course these "); AddComment (liste, "objects are drawn."); AddIntItem (liste, "backward_clip_distance", param.backward_clip_distance); liste.Add (""); AddComment (liste, "Field of View of the camera"); AddIntItem (liste, "fov", param.fov); liste.Add (""); AddComment (liste, "Bpp mode - bits per pixel [0...2]"); AddComment (liste, "Controls the color depth of the OpenGL window"); AddComment (liste, "0 = use current bpp setting of operating system,"); AddComment (liste, "1 = 16 bpp, 2 = 32 bpp"); AddIntItem (liste, "bpp_mode", param.bpp_mode); liste.Add (""); AddComment (liste, "Tree detail distance"); AddComment (liste, "Controls how far up the course the trees are drawn crosswise."); AddIntItem (liste, "tree_detail_distance", param.tree_detail_distance); liste.Add (""); AddComment (liste, "Tux sphere divisions"); AddComment (liste, "Controls how detailled the character is drawn"); AddIntItem (liste, "tux_sphere_divisions", param.tux_sphere_divisions); liste.Add (""); AddComment (liste, "Tux shadow sphere divisions"); AddComment (liste, "The same but for the shadow of the character"); AddIntItem (liste, "tux_shadow_sphere_div", param.tux_shadow_sphere_divisions); liste.Add (""); AddComment (liste, "Detail level of the course"); AddComment (liste, "This param is used for the quadtree and controls the"); AddComment (liste, "LOD of the algorithm. "); AddIntItem (liste, "course_detail_level", param.course_detail_level); liste.Add (""); AddComment (liste, "Font type [0...2]"); AddComment (liste, "0 = always arial-like font,"); AddComment (liste, "1 = papercut font on the menu screens"); AddComment (liste, "2 = papercut font for the hud display, too"); AddIntItem (liste, "use_papercut_font", param.use_papercut_font); liste.Add (""); AddComment (liste, "Cursor type [0...1]"); AddComment (liste, "0 = normal cursor (arrow), 1 = icicle"); AddIntItem (liste, "ice_cursor", param.ice_cursor); liste.Add (""); AddComment (liste, "Draw full skybox [0...1]"); AddComment (liste, "A normal skybox consists of 6 textures. In Tuxracer"); AddComment (liste, "3 textures are invisible (top, bottom and back)."); AddComment (liste, "These textures needn't be drawn."); AddIntItem (liste, "full_skybox", param.full_skybox); liste.Add (""); AddComment (liste, "Audio frequency"); AddComment (liste, "Typical values are 11025, 22050 ..."); AddIntItem (liste, "audio_freq", param.audio_freq); liste.Add (""); AddComment (liste, "Size of audio buffer"); AddComment (liste, "Typical values are 512, 1024, 2048 ..."); AddIntItem (liste, "audio_buffer_size", param.audio_buffer_size); liste.Add (""); AddComment (liste, "Select the music:"); AddComment (liste, "(the racing music is defined by a music theme)"); AddItem (liste, "menu_music", param.menu_music); AddItem (liste, "credits_music", param.credits_music); AddItem (liste, "config_music", param.config_music); liste.Add (""); AddComment (liste, "Use sqare root of scale factors for menu screens [0...1]"); AddComment (liste, "Exprimental: these factors reduce the effect of screen scaling."); AddComment (liste, "The widgets are closer to their default sizes."); AddIntItem (liste, "use_quad_scale", param.use_quad_scale); liste.Add (""); // --------------------------------------- liste.Save (param.configfile); }
NODESIZE CNodePtrArray::Draw( const PVIEWINFO View, int x, int y ) { int tx; NODESIZE DrawSize; NODESIZE ChildDrawSize; ULONG ClassSize; if (m_bHidden) return DrawHidden( View, x, y ); DrawSize.x = 0; DrawSize.y = 0; AddSelection( View, 0, y, g_FontHeight ); AddDelete( View, x, y ); AddTypeDrop( View, x, y ); x = AddOpenClose( View, x, y ); x = AddIcon( View, x, y, ICON_ARRAY, -1, -1 ); tx = x; tx = AddAddressOffset( View, tx, y ); tx = AddText( View, tx, y, g_clrType, HS_NONE, _T( "ArrayOfPointers " ) ); tx = AddText( View, tx, y, g_clrName, HS_NAME, _T( "%s" ), m_strName ); tx = AddText( View, tx, y, g_clrIndex, HS_NONE, _T( "[" ) ); tx = AddText( View, tx, y, g_clrIndex, HS_EDIT, _T( "%u" ), m_ulPtrCount ); tx = AddText( View, tx, y, g_clrIndex, HS_NONE, _T( "]" ) ); tx = AddIcon( View, tx, y, ICON_LEFT, HS_SELECT, HS_CLICK ); tx = AddText( View, tx, y, g_clrIndex, HS_NONE, _T( "(" ) ); tx = AddText( View, tx, y, g_clrIndex, 1, _T( "%i" ), m_iCurrentIndex ); tx = AddText( View, tx, y, g_clrIndex, HS_NONE, _T( ")" ) ); tx = AddIcon( View, tx, y, ICON_RIGHT, HS_DROP, HS_CLICK ); tx = AddText( View, tx, y, g_clrValue, HS_NONE, _T( "<%s* Size=%u>" ), m_pNodePtr->GetClass( )->GetName( ), GetMemorySize( ) ); tx = AddIcon( View, tx, y, ICON_CHANGE, HS_CLICK, HS_CHANGE_X ); tx += g_FontWidth; tx = AddComment( View, tx, y ); y += g_FontHeight; if (m_LevelsOpen[View->Level]) { if (IsMemory( View->Address + m_Offset + (sizeof( ULONG_PTR ) * m_iCurrentIndex) )) { ClassSize = m_pNodePtr->GetClass( )->GetMemorySize( ); m_pNodePtr->Memory( )->SetSize( ClassSize ); VIEWINFO NewView; memcpy( &NewView, View, sizeof( NewView ) ); NewView.Data = m_pNodePtr->Memory( )->Data( ); NewView.Address = *(ULONG_PTR*)(View->Data + m_Offset + (sizeof( ULONG_PTR ) * m_iCurrentIndex)); ReClassReadMemory( (LPVOID)NewView.Address, (LPVOID)NewView.Data, ClassSize ); ChildDrawSize = m_pNodePtr->GetClass( )->Draw( &NewView, x, y ); y = ChildDrawSize.y; if (ChildDrawSize.x > DrawSize.x) DrawSize.x = ChildDrawSize.x; } } DrawSize.y = y; return DrawSize; }
void AXMLElement::AddComment(const char* pComment) { VString comment; comment.FromCString(pComment); AddComment(comment); }