예제 #1
0
DocumentIstream& DrawingDocument::LoadObject(DocumentIstream& istream)
{
#if wxUSE_STD_IOSTREAM
    DocumentIstream& stream = istream;
#else
    wxTextInputStream stream(istream);
#endif

    wxDocument::LoadObject(istream);

    wxInt32 count = 0;
    stream >> count;
    if ( count < 0 )
    {
        wxLogWarning("Drawing document corrupted: invalid segments count.");
#if wxUSE_STD_IOSTREAM
        istream.clear(std::ios::badbit);
#else
        istream.Reset(wxSTREAM_READ_ERROR);
#endif
        return istream;
    }

    for ( int n = 0; n < count; n++ )
    {
        DoodleSegment segment;
        segment.LoadObject(istream);
        m_doodleSegments.push_back(segment);
    }

    return istream;
}
예제 #2
0
파일: view.cpp 프로젝트: Bluehorn/wxPython
// Sneakily gets used for default print/preview
// as well as drawing on the screen.
void DrawingView::OnDraw(wxDC *dc)
{
  dc->SetFont(*wxNORMAL_FONT);
  dc->SetPen(*wxBLACK_PEN);

  wxList::compatibility_iterator node = ((DrawingDocument *)GetDocument())->GetDoodleSegments().GetFirst();
  while (node)
  {
    DoodleSegment *seg = (DoodleSegment *)node->GetData();
    seg->Draw(dc);
    node = node->GetNext();
  }
}
예제 #3
0
파일: doc.cpp 프로젝트: EdgarTx/wx
wxSTD istream& DrawingDocument::LoadObject(wxSTD istream& stream)
{
    wxDocument::LoadObject(stream);

    wxInt32 n = 0;
    stream >> n;

    for (int i = 0; i < n; i++)
    {
        DoodleSegment *segment = new DoodleSegment;
        segment->LoadObject(stream);
        doodleSegments.Append(segment);
    }

    return stream;
}
예제 #4
0
파일: doc.cpp 프로젝트: EdgarTx/wx
wxSTD ostream& DrawingDocument::SaveObject(wxSTD ostream& stream)
{
    wxDocument::SaveObject(stream);

    wxInt32 n = doodleSegments.GetCount();
    stream << n << _T('\n');

    wxList::compatibility_iterator node = doodleSegments.GetFirst();
    while (node)
    {
        DoodleSegment *segment = (DoodleSegment *)node->GetData();
        segment->SaveObject(stream);
        stream << _T('\n');

        node = node->GetNext();
    }

    return stream;
}
예제 #5
0
DocumentIstream& DrawingDocument::LoadObject(DocumentIstream& istream)
{
#if wxUSE_STD_IOSTREAM
    DocumentIstream& stream = istream;
#else
    wxTextInputStream stream(istream);
#endif

    wxDocument::LoadObject(istream);

    wxInt32 count = 0;
    stream >> count;

    for ( int n = 0; n < count; n++ )
    {
        DoodleSegment segment;
        segment.LoadObject(istream);
        m_doodleSegments.push_back(segment);
    }

    return istream;
}