コード例 #1
0
ファイル: TsWriter.cpp プロジェクト: hkjensen/MediaPortal-1
void LogDebug(const wchar_t *fmt, ...) 
{
  CAutoLock logLock(&m_logLock);
  
  if (!m_hLogger) {
    m_bLoggerRunning = true;
    StartLogger();
  }

  wchar_t buffer[2000]; 
  int tmp;
  va_list ap;
  va_start(ap,fmt);
  tmp = vswprintf_s(buffer, fmt, ap);
  va_end(ap); 

  SYSTEMTIME systemTime;
  GetLocalTime(&systemTime);
  wchar_t msg[5000];
  swprintf_s(msg, 5000,L"[%04.4d-%02.2d-%02.2d %02.2d:%02.2d:%02.2d,%03.3d] [%x] [%x] - %s\n",
    systemTime.wYear, systemTime.wMonth, systemTime.wDay,
    systemTime.wHour, systemTime.wMinute, systemTime.wSecond, systemTime.wMilliseconds,
    (unsigned int)instanceID,
    GetCurrentThreadId(),
    buffer);
  CAutoLock l(&m_qLock);
  if (m_logQueue.size() < 2000) 
  {
    m_logQueue.push((wstring)msg);
  }
};
コード例 #2
0
NS_IMETHODIMP
nsHTMLEditorLog::RemoveInlineProperty(nsIAtom *aProperty, const nsAString &aAttribute)
{
  nsAutoHTMLEditorLogLock logLock(this);

  if (!mLocked && mFileStream)
  {
    nsAutoString propStr;

    aProperty->ToString(propStr);

    PrintSelection();
    Write("atomService = Components.classes[\"@mozilla.org/atom-service;1\"].getService(Components.interfaces.nsIAtomService);\n");
    Write("propAtom = atomService.getAtom(\"");
    PrintUnicode(propStr);
    Write("\");\n");
    Write("GetCurrentEditor().removeInlineProperty(propAtom, \"");
    if (aAttribute.Length())
      PrintUnicode(aAttribute);
    Write("\");\n");

    Flush();
  }

  return nsHTMLEditor::RemoveInlineProperty(aProperty, aAttribute);
}
コード例 #3
0
NS_IMETHODIMP
nsHTMLEditorLog::EndOfDocument()
{
  nsAutoHTMLEditorLogLock logLock(this);

  if (!mLocked && mFileStream)
  {
    Write("GetCurrentEditor().endOfDocument();\n");
    Flush();
  }

  return nsHTMLEditor::EndOfDocument();
}
コード例 #4
0
NS_IMETHODIMP
nsHTMLEditorLog::BeginTransaction()
{
  nsAutoHTMLEditorLogLock logLock(this);

  if (!mLocked && mFileStream)
  {
    Write("GetCurrentEditor().beginTransaction();\n");
    Flush();
  }

  return nsHTMLEditor::BeginTransaction();
}
コード例 #5
0
NS_IMETHODIMP
nsHTMLEditorLog:: SplitTableCell()
{
  nsAutoHTMLEditorLogLock logLock(this);

  if (!mLocked && mFileStream)
  {
    Write("GetCurrentEditor().splitTableCell();\n");
    Flush();
  }

  return nsHTMLEditor::SplitTableCell();
}
コード例 #6
0
NS_IMETHODIMP
nsHTMLEditorLog::Copy()
{
  nsAutoHTMLEditorLogLock logLock(this);

  if (!mLocked && mFileStream)
  {
    PrintSelection();
    Write("GetCurrentEditor().copy();\n");
    Flush();
  }

  return nsHTMLEditor::Copy();
}
コード例 #7
0
NS_IMETHODIMP
nsHTMLEditorLog::SetBackgroundColor(const nsAString& aColor)
{
  nsAutoHTMLEditorLogLock logLock(this);

  if (!mLocked && mFileStream)
  {
    Write("GetCurrentEditor().setBackgroundColor(\"");
    PrintUnicode(aColor);
    Write("\");\n");
    Flush();
  }

  return nsHTMLEditor::SetBackgroundColor(aColor);
}
コード例 #8
0
NS_IMETHODIMP
nsHTMLEditorLog:: DeleteTableRow(int32_t aNumber)
{
  nsAutoHTMLEditorLogLock logLock(this);

  if (!mLocked && mFileStream)
  {
    Write("GetCurrentEditor().deleteTableRow(");
    WriteInt(aNumber);
    Write(");\n");
    Flush();
  }

  return nsHTMLEditor::DeleteTableRow(aNumber);
}
コード例 #9
0
NS_IMETHODIMP
nsHTMLEditorLog::Redo(uint32_t aCount)
{
  nsAutoHTMLEditorLogLock logLock(this);

  if (!mLocked && mFileStream)
  {
    Write("GetCurrentEditor().redo(");
    WriteInt(aCount);
    Write(");\n");
    Flush();
  }

  return nsHTMLEditor::Redo(aCount);
}
コード例 #10
0
NS_IMETHODIMP
nsHTMLEditorLog:: JoinTableCells(bool aMergeNonContiguousContents)
{
  nsAutoHTMLEditorLogLock logLock(this);

  if (!mLocked && mFileStream)
  {
    Write("GetCurrentEditor().joinTableCells(");
    Write(aMergeNonContiguousContents ? "true" : "false");
    Write(");\n");
    Flush();
  }

  return nsHTMLEditor::JoinTableCells(aMergeNonContiguousContents);
}
コード例 #11
0
NS_IMETHODIMP
nsHTMLEditorLog::PasteAsPlaintextQuotation(int32_t aClipboardType)
{
  nsAutoHTMLEditorLogLock logLock(this);

  if (!mLocked && mFileStream)
  {
    PrintSelection();
    Write("GetCurrentEditor().pasteAsQuotation(");
    WriteInt(aClipboardType);
    Write(");\n");
    Flush();
  }

  return nsHTMLEditor::PasteAsPlaintextQuotation(aClipboardType);
}
コード例 #12
0
NS_IMETHODIMP
nsHTMLEditorLog::SetBodyAttribute(const nsAString& aAttr, const nsAString& aValue)
{
  nsAutoHTMLEditorLogLock logLock(this);

  if (!mLocked && mFileStream)
  {
    Write("GetCurrentEditor().setBodyAttribute(\"");
    PrintUnicode(aAttr);
    Write("\", \"");
    PrintUnicode(aValue);
    Write("\");\n");
    Flush();
  }

  return nsHTMLEditor::SetBodyAttribute(aAttr, aValue);
}
コード例 #13
0
NS_IMETHODIMP
nsHTMLEditorLog::InsertAsQuotation(const nsAString& aQuotedText,
                                   nsIDOMNode **aNodeInserted)
{
  nsAutoHTMLEditorLogLock logLock(this);

  if (!mLocked && mFileStream)
  {
    PrintSelection();
    Write("GetCurrentEditor().insertAsQuotation(\"");
    PrintUnicode(aQuotedText);
    Write("\");\n");
    Flush();
  }

  return nsHTMLEditor::InsertAsQuotation(aQuotedText, aNodeInserted);
}
コード例 #14
0
NS_IMETHODIMP
nsHTMLEditorLog:: InsertTableRow(int32_t aNumber, bool aAfter)
{
  nsAutoHTMLEditorLogLock logLock(this);

  if (!mLocked && mFileStream)
  {
    Write("GetCurrentEditor().insertTableRow(");
    WriteInt(aNumber);
    Write(", ");
    Write(aAfter ? "true" : "false");
    Write(");\n");
    Flush();
  }

  return nsHTMLEditor::InsertTableRow(aNumber, aAfter);
}
コード例 #15
0
NS_IMETHODIMP
nsHTMLEditorLog::Align(const nsAString& aAlign)
{
  nsAutoHTMLEditorLogLock logLock(this);

  if (!mLocked && mFileStream)
  {
    PrintSelection();

    Write("GetCurrentEditor().align(\"");
    PrintUnicode(aAlign);
    Write("\");\n");
    Flush();
  }

  return nsHTMLEditor::Align(aAlign);
}
コード例 #16
0
NS_IMETHODIMP
nsHTMLEditorLog::SwitchTableCellHeaderType(nsIDOMElement *aSourceCell, nsIDOMElement **aNewCell)
{
  nsAutoHTMLEditorLogLock logLock(this);

  if (!mLocked && mFileStream)
  {
    nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aSourceCell);
    NS_ENSURE_TRUE(node, NS_ERROR_NULL_POINTER);

    PrintNode(node, 0);
    Write("GetCurrentEditor().switchTableCellHeaderType(n0);\n");
    Flush();
  }

  return nsHTMLEditor::SwitchTableCellHeaderType(aSourceCell, aNewCell);
}
コード例 #17
0
NS_IMETHODIMP
nsHTMLEditorLog::SetParagraphFormat(const nsAString& aParagraphFormat)
{
  nsAutoHTMLEditorLogLock logLock(this);

  if (!mLocked && mFileStream)
  {
    PrintSelection();
    Write("GetCurrentEditor().setParagraphFormat(\"");
    PrintUnicode(aParagraphFormat);
    Write("\");\n");

    Flush();
  }

  return nsHTMLEditor::SetParagraphFormat(aParagraphFormat);
}
コード例 #18
0
NS_IMETHODIMP
nsHTMLEditorLog:: NormalizeTable(nsIDOMElement *aTable)
{
  nsAutoHTMLEditorLogLock logLock(this);

  if (!mLocked && mFileStream)
  {
    nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aTable);
    NS_ENSURE_TRUE(node, NS_ERROR_NULL_POINTER);

    PrintNode(node, 0);
    Write("GetCurrentEditor().normalizeTable(n0);\n");
    Flush();
  }

  return nsHTMLEditor::NormalizeTable(aTable);
}
コード例 #19
0
ファイル: TsWriter.cpp プロジェクト: hkjensen/MediaPortal-1
void StopLogger()
{
  CAutoLock logLock(&m_logLock);
  if (m_hLogger)
  {
    //Make sure the thread runs soon so it can finish processing
    SetThreadPriority(m_hLogger, THREAD_PRIORITY_NORMAL);
    m_bLoggerRunning = FALSE;
    m_EndLoggingEvent.Set();
    WaitForSingleObject(m_hLogger, INFINITE);	
    m_EndLoggingEvent.Reset();
    CloseHandle(m_hLogger);
    m_hLogger = NULL;
    logFileParsed = -1;
    logFileDate = -1;
    instanceID = 0;
  }
}
コード例 #20
0
NS_IMETHODIMP
nsHTMLEditorLog::SetDocumentTitle(const nsAString& aTitle)
{
  nsAutoHTMLEditorLogLock logLock(this);

  if (!mLocked && mFileStream)
  {
    PrintSelection();

    Write("GetCurrentEditor().setDocumentTitle(\"");
    nsAutoString str(aTitle);
    PrintUnicode(str);
    Write("\");\n");
    Flush();
  }

  return nsHTMLEditor::SetDocumentTitle(aTitle);
}
コード例 #21
0
NS_IMETHODIMP
nsHTMLEditorLog::DeleteSelection(nsIEditor::EDirection aAction,
                                 nsIEditor::EStripWrappers aStripWrappers)
{
  nsAutoHTMLEditorLogLock logLock(this);

  if (!mLocked && mFileStream)
  {
    PrintSelection();
    Write("GetCurrentEditor().deleteSelection(");
    WriteInt(aAction);
    Write(");\n");

    Flush();
  }

  return nsHTMLEditor::DeleteSelection(aAction, aStripWrappers);
}
コード例 #22
0
NS_IMETHODIMP
nsHTMLEditorLog::InsertText(const nsAString& aStringToInsert)
{
  nsAutoHTMLEditorLogLock logLock(this);

  if (!mLocked && mFileStream)
  {
    PrintSelection();

    Write("GetCurrentEditor().insertText(\"");
    nsAutoString str(aStringToInsert);
    PrintUnicode(str);
    Write("\");\n");

    Flush();
  }

  return nsHTMLEditor::InsertText(aStringToInsert);
}
コード例 #23
0
NS_IMETHODIMP
nsHTMLEditorLog::PasteAsCitedQuotation(const nsAString& aCitation,
                                       int32_t aClipboardType)
{
  nsAutoHTMLEditorLogLock logLock(this);

  if (!mLocked && mFileStream)
  {
    PrintSelection();
    Write("GetCurrentEditor().pasteAsCitedQuotation(\"");
    PrintUnicode(aCitation);
    Write("\", ");
    WriteInt(aClipboardType);
    Write(");\n");
    Flush();
  }

  return nsHTMLEditor::PasteAsCitedQuotation(aCitation, aClipboardType);
}
コード例 #24
0
NS_IMETHODIMP
nsHTMLEditorLog::InsertLinkAroundSelection(nsIDOMElement* aAnchorElement)
{
  nsAutoHTMLEditorLogLock logLock(this);

  if (!mLocked && mFileStream)
  {
    NS_ENSURE_TRUE(aAnchorElement, NS_ERROR_NULL_POINTER);

    nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aAnchorElement);

    NS_ENSURE_TRUE(node, NS_ERROR_NULL_POINTER);

    PrintSelection();
    PrintNode(node, 0);
    Write("GetCurrentEditor().insertLinkAroundSelection(n0);\n");
    Flush();
  }

  return nsHTMLEditor::InsertLinkAroundSelection(aAnchorElement);
}
コード例 #25
0
NS_IMETHODIMP
nsHTMLEditorLog::MakeOrChangeList(const nsAString& aListType, bool entireList, const nsAString& aBulletType)
{
  nsAutoHTMLEditorLogLock logLock(this);

  if (!mLocked && mFileStream)
  {
    PrintSelection();

    Write("GetCurrentEditor().makeOrChangeList(\"");
    PrintUnicode(aListType);
    Write("\", ");
    Write(entireList ? "true" : "false");
    Write(", \"");
    PrintUnicode(aBulletType);
    Write("\");\n");
    Flush();
  }

  return nsHTMLEditor::MakeOrChangeList(aListType, entireList, aBulletType);
}
コード例 #26
0
NS_IMETHODIMP
nsHTMLEditorLog::InsertElementAtSelection(nsIDOMElement* aElement, bool aDeleteSelection)
{
  nsAutoHTMLEditorLogLock logLock(this);

  if (!mLocked && mFileStream)
  {
    NS_ENSURE_TRUE(aElement, NS_ERROR_NULL_POINTER);

    nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aElement);

    NS_ENSURE_TRUE(node, NS_ERROR_NULL_POINTER);

    PrintSelection();
    PrintNode(node, 0);
    Write("GetCurrentEditor().insertElementAtSelection(n0, ");
    Write(aDeleteSelection ? "true" : "false");
    Write(");\n");
    Flush();
  }

  return nsHTMLEditor::InsertElementAtSelection(aElement, aDeleteSelection);
}