Logo Search packages:      
Sourcecode: codeblocks version File versions  Download package

void wxsCoder::AddCode ( const wxString &  FileName,
const wxString &  Header,
const wxString &  End,
const wxString &  Code,
bool  Immediately = true,
bool  CodeHasHeader = false,
bool  CodeHasEnd = false 

Function notifying about change of block of code in file.

Code should use tabs for indentation and will be automatically indented relatively to code header.

FileName Full path for processed file
Header Header beginning code block
End Sequence ending code block
Code new code
Immediately flag forcing immediate apply (currently not used but may be aded in future when updates will be sheduled)
CodeHasHeader if true, heder will also be recreated (new hwader should be placed at the beginning of Code)
CodeHasEnd if true, ending sequence will also be recreated (new ending sequence should be placed at the end of Code)

Definition at line 70 of file wxscoder.cpp.

References wxsCoder::CodeChange::Code, CodeChanges, CodeChangesFiles, wxsCoder::CodeChange::CodeHasEnd, wxsCoder::CodeChange::CodeHasHeader, DataMutex, wxsCoder::CodeChange::End, FlushFile(), wxsCoder::CodeChange::Header, wxsCoder::CodeChange::Next, and NormalizeFileName().

Referenced by wxsEventsEditor::CreateNewFunction(), wxWidgetsGUI::OnRebuildApplicationCode(), and wxsItemResData::RebuildSourceCode().

    wxMutexLocker Lock(DataMutex);

    wxString FixedFileName = NormalizeFileName(FileName);
    if ( FixedFileName.IsEmpty() )

    // Find changing file
    int Index = CodeChangesFiles.Index(FileName);
    if ( Index==wxNOT_FOUND )
        Index = CodeChangesFiles.Count();

    // Add entry to list of waiting changes
    CodeChange* Change = new CodeChange;
    Change->Header = Header;
    Change->End = End;
    Change->Code = Code;
    Change->CodeHasHeader = CodeHasHeader;
    Change->CodeHasEnd = CodeHasEnd;
    Change->Next = CodeChanges[Index];
    CodeChanges[Index] = Change;

    // If the change has already been put onto queue, delete it
    for ( CodeChange *Prev=Change, *This=Prev->Next; This; Prev=This, This=This->Next )
        if ( This->Header==Header && This->End==End )
            Prev->Next = This->Next;
            delete This;
            This = Prev;

    if ( Immediately )

Generated by  Doxygen 1.6.0   Back to index