Answered by:
SimpleTextRenderer syntax error

Question
-
Does anyone know what is wrong with SimpleTextRenderer ?
It is defined in its header file ok
#pragma once #include "SimpleTextRenderer.h" #include <DirectXBase.h> #include <printpreview.h> #include "SampleOverlay.h" enum class DrawTypes { Rendering, Preview, Printing }; // RAII (Resource Acquisition Is Initialization) class for manually // acquiring/releasing the D2D lock. class D2DFactoryLock { public: D2DFactoryLock(_In_ ID2D1Factory* d2dFactory) { DX::ThrowIfFailed( d2dFactory->QueryInterface(IID_PPV_ARGS(&m_d2dMultithread)) ); m_d2dMultithread->Enter(); } ~D2DFactoryLock() { m_d2dMultithread->Leave(); } private: Microsoft::WRL::ComPtr<ID2D1Multithread> m_d2dMultithread; }; // This class is in charge of rendering the contents of the page to an // arbitrary device context (which may be backed by a D2D bitmap in the case of // display or print-preview, or a D2D command list in the case of print). // // Note: unlike the PageRender class, this class is thread-specific, and hence // can hold on to both mutable and immutable resources. // // To conserve memory, it is preferable to store heavy-weight resources in the // PageRenderer, and take only a reference to those resources inside // PageRendererContext. ref class PageRendererContext { internal: PageRendererContext( _In_ D2D1_RECT_F targetBox, _In_ ID2D1DeviceContext* d2dContext, _In_ DrawTypes type, _In_ SimpleTextRenderer^ pageRenderer );
n.Wright
Monday, August 26, 2013 4:03 PM
Answers
-
I finally fixed the problem.
The line "SimpleTextRenderer^ xxx" should be ref class "SimpleTextRenderer ^ xxx"
n.Wright
- Marked as answer by nigelwright7557 Friday, August 30, 2013 2:04 AM
Friday, August 30, 2013 2:04 AM
All replies
-
Is there anyone who could have a look at my c++ program ?
I have a program with around 50,000 lines.
I am down to two errors and I am unable to fix them.
IS there anyone who could have a look at it and point me in the right direction ?
n.Wright
- Merged by Prashant H PhadkeMicrosoft employee, Moderator Monday, August 26, 2013 11:56 PM same question, different threads
Monday, August 26, 2013 6:53 PM -
I don't see any problems. Perhaps I misunderstood the question, what was the question?
Jeff Sanders (MSFT)
@jsandersrocks - Windows Store Developer Solutions @WSDevSol
Getting Started With Windows Azure Mobile Services development? Click here
Getting Started With Windows Phone or Store app development? Click here
My Team Blog: Windows Store & Phone Developer Solutions
My Blog: Http Client Protocol Issues (and other fun stuff I support)Monday, August 26, 2013 7:18 PMModerator -
The compiler says SimpleTextRenderer has a syntax error.
If I put in an extra line with SimpleTextRenderer^ ff = ref new SimpleTextRenderer();
this works fine so SimpleTextRenderer must be in scope.
n.Wright
Monday, August 26, 2013 8:00 PM -
There is also another compiler error which says that PageRendererContext does not have 4 overloaded variables.
However intelisense says that 4 variables is correct.
Is this a bug in the compiler ?
n.Wright
- Edited by nigelwright7557 Monday, August 26, 2013 9:55 PM
Monday, August 26, 2013 9:55 PM -
OK, and what are those two errors?
Windows Store Developer Solutions #WSDevSol || Want more solutions? See our blog, http://aka.ms/t4vuvz
Monday, August 26, 2013 11:27 PMModerator -
I have a class that is created by another.
However when the compiler compiles it the compiler says that it cant have 4 variables.
But the class does have 4 variables in it and intelisense says it is OK.
///////////////////////////////////////////////////// //.cpp code PageRendererContext^ printPageRendererContext = ref new PageRendererContext( imageableArea, d2dContext.Get(), DrawTypes::Printing, this ); //////////////////////////////////////////////////// //header code of other class PageRendererContext( _In_ D2D1_RECT_F targetBox, _In_ ID2D1DeviceContext* d2dContext, _In_ DrawTypes type,
_In_ SimpleTextRenderer^ pageRenderer
);
n.Wright
Monday, August 26, 2013 11:38 PM -
What is the exact compile error, can you post that from the output window here?
Windows Store Developer Solutions #WSDevSol || Want more solutions? See our blog, http://aka.ms/t4vuvz
Monday, August 26, 2013 11:51 PMModerator -
Error 1 error C2061: syntax error : identifier 'SimpleTextRenderer' (D2DPageRendererContext.cpp) c:\merge\simple_pcbcad\simple_pcbcad\simple_pcbcad\D2DPageRendererContext.h 56 1 Simple_PCBCAD
n.Wright
Monday, August 26, 2013 11:55 PM -
This is an interesting error as intelisense says 4 variables are fine but the compiler says it is wrong:
Error 94 error C2661: 'PageRendererContext::PageRendererContext' : no overloaded function takes 4 arguments C:\merge\Simple_PCBCAD\Simple_PCBCAD\Simple_PCBCAD\SimpleTextRenderer.cpp 57215 1 Simple_PCBCAD
n.Wright
Monday, August 26, 2013 11:58 PM -
How have you defined the constructor of your class? Can you share the definition of your class as you see it in your header file?
Windows Store Developer Solutions #WSDevSol || Want more solutions? See our blog, http://aka.ms/t4vuvz
Tuesday, August 27, 2013 12:54 AMModerator -
Here is the header file:
//// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF //// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO //// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A //// PARTICULAR PURPOSE. //// //// Copyright (c) Microsoft Corporation. All rights reserved #pragma once #include <DirectXBase.h> #include <printpreview.h> #include "SampleOverlay.h" #include "SimpleTextRenderer.h" enum class DrawTypes { Rendering, Preview, Printing }; // RAII (Resource Acquisition Is Initialization) class for manually // acquiring/releasing the D2D lock. class D2DFactoryLock { public: D2DFactoryLock(_In_ ID2D1Factory* d2dFactory) { DX::ThrowIfFailed( d2dFactory->QueryInterface(IID_PPV_ARGS(&m_d2dMultithread)) ); m_d2dMultithread->Enter(); } ~D2DFactoryLock() { m_d2dMultithread->Leave(); } private: Microsoft::WRL::ComPtr<ID2D1Multithread> m_d2dMultithread; }; // This class is in charge of rendering the contents of the page to an // arbitrary device context (which may be backed by a D2D bitmap in the case of // display or print-preview, or a D2D command list in the case of print). // // Note: unlike the PageRender class, this class is thread-specific, and hence // can hold on to both mutable and immutable resources. // // To conserve memory, it is preferable to store heavy-weight resources in the // PageRenderer, and take only a reference to those resources inside // PageRendererContext. ref class PageRendererContext { internal: PageRendererContext( _In_ D2D1_RECT_F targetBox, _In_ ID2D1DeviceContext* d2dContext, _In_ DrawTypes type, _In_ SimpleTextRenderer^ pageRenderer ); void UpdateTargetBox(_In_ D2D1_RECT_F& targetBox); void Draw(_In_ float scale); void DrawMessage(_In_ Platform::String^ string); private: Microsoft::WRL::ComPtr<ID2D1DeviceContext> m_d2dContext; Microsoft::WRL::ComPtr<IDWriteTextFormat> m_textFormat; Microsoft::WRL::ComPtr<IDWriteTextFormat> m_messageFormat; Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> m_blackBrush; float m_margin; // The margin size is in DIPs. D2D1_RECT_F m_targetBox; // The region that the page contents should be formatted for. DrawTypes m_type; };
and .cpp file
//// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF //// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO //// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A //// PARTICULAR PURPOSE. //// //// Copyright (c) Microsoft Corporation. All rights reserved #include "pch.h" #include <math.h> #include "SimpleTextRenderer.h" #include "D2DPageRendererContext.h" using namespace Microsoft::WRL; using namespace Microsoft::WRL::Wrappers; using namespace Windows::Foundation; using namespace Windows::UI::Core; using namespace Windows::Graphics::Display; PageRendererContext::PageRendererContext( _In_ D2D1_RECT_F targetBox, _In_ ID2D1DeviceContext* d2dContext, _In_ DrawTypes type, _In_ SimpleTextRenderer^ pageRenderer ) { pageRenderer->testdata[1]=65535; m_margin = 96.0f; m_d2dContext = d2dContext; m_type = type; UpdateTargetBox(targetBox); DX::ThrowIfFailed( d2dContext->CreateSolidColorBrush( D2D1::ColorF(D2D1::ColorF::Black), &m_blackBrush ) ); // Pull out all the immutable resources from the PageRenderer that we will need. m_textFormat = pageRenderer->GetTextFormatNoRef(); m_messageFormat = pageRenderer->GetMessageFormatNoRef(); } void PageRendererContext::UpdateTargetBox(_In_ D2D1_RECT_F& targetBox) { m_targetBox = targetBox; } // Draws the scene to a rendering device context or a printing device context. void PageRendererContext::Draw(_In_ float scale) { // Clear rendering background with CornflowerBlue and clear preview // background with white color. For the printing case (command list), it // is recommended not to clear because the surface is clean when created. if (m_type == DrawTypes::Rendering) { m_d2dContext->Clear(D2D1::ColorF(D2D1::ColorF::CornflowerBlue)); } else if (m_type == DrawTypes::Preview) { m_d2dContext->Clear(D2D1::ColorF(D2D1::ColorF::White)); } // We use scale matrix to shrink the text size and scale is only available // for preview. For on-screen rendering or printing, scale is 1.f, that // is, the Identity is the transform matrix. m_d2dContext->SetTransform(D2D1::Matrix3x2F(1/scale, 0, 0, 1/scale, 0, 0)); D2D1_RECT_F textBox = D2D1::RectF( m_targetBox.left + m_margin, m_targetBox.top + m_margin, m_targetBox.right - m_margin, m_targetBox.bottom - m_margin ); const char16 textString[] = L"\ Lorem ipsum dolor sit amet, consectetur adipisicing elit, \ sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. \ Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris \ nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in \ reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla\ pariatur. Excepteur sint occaecat cupidatat non proident, sunt in \ culpa qui officia deserunt mollit anim id est laborum."; m_d2dContext->DrawText( textString, ARRAYSIZE(textString) - 1, m_textFormat.Get(), textBox, m_blackBrush.Get() ); } // Draws a string to a rendering device context or a printing device context. void PageRendererContext::DrawMessage(_In_ Platform::String^ string) { // Clear rendering background with CornflowerBlue. m_d2dContext->Clear(D2D1::ColorF(D2D1::ColorF::CornflowerBlue)); m_d2dContext->DrawText( string->Data(), string->Length(), m_messageFormat.Get(), m_targetBox, m_blackBrush.Get() ); }
and this is part of otehr class that creates it.
// Create and initialize the page renderer context for print. // In this case, we want to use the bitmap source that already has // the color context embedded in it. Thus, we pass NULL for the // color context parameter. PageRendererContext^ printPageRendererContext = ref new PageRendererContext( imageableArea, d2dContext.Get(), DrawTypes::Printing, this );
n.Wright
Tuesday, August 27, 2013 1:02 AM -
//// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF //// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO //// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A //// PARTICULAR PURPOSE. //// //// Copyright (c) Microsoft Corporation. All rights reserved #include "pch.h" #include <math.h> #include "SimpleTextRenderer.h" #include "D2DPageRendererContext.h" using namespace Microsoft::WRL; using namespace Microsoft::WRL::Wrappers; using namespace Windows::Foundation; using namespace Windows::UI::Core; using namespace Windows::Graphics::Display; PageRendererContext::PageRendererContext( _In_ D2D1_RECT_F targetBox, _In_ ID2D1DeviceContext* d2dContext, _In_ DrawTypes type, _In_ SimpleTextRenderer^ pageRenderer ) { pageRenderer->testdata[1]=65535; m_margin = 96.0f; m_d2dContext = d2dContext; m_type = type; UpdateTargetBox(targetBox); DX::ThrowIfFailed( d2dContext->CreateSolidColorBrush( D2D1::ColorF(D2D1::ColorF::Black), &m_blackBrush ) ); // Pull out all the immutable resources from the PageRenderer that we will need. m_textFormat = pageRenderer->GetTextFormatNoRef(); m_messageFormat = pageRenderer->GetMessageFormatNoRef(); } void PageRendererContext::UpdateTargetBox(_In_ D2D1_RECT_F& targetBox) { m_targetBox = targetBox; } // Draws the scene to a rendering device context or a printing device context. void PageRendererContext::Draw(_In_ float scale) { // Clear rendering background with CornflowerBlue and clear preview // background with white color. For the printing case (command list), it // is recommended not to clear because the surface is clean when created. if (m_type == DrawTypes::Rendering) { m_d2dContext->Clear(D2D1::ColorF(D2D1::ColorF::CornflowerBlue)); } else if (m_type == DrawTypes::Preview) { m_d2dContext->Clear(D2D1::ColorF(D2D1::ColorF::White)); } // We use scale matrix to shrink the text size and scale is only available // for preview. For on-screen rendering or printing, scale is 1.f, that // is, the Identity is the transform matrix. m_d2dContext->SetTransform(D2D1::Matrix3x2F(1/scale, 0, 0, 1/scale, 0, 0)); D2D1_RECT_F textBox = D2D1::RectF( m_targetBox.left + m_margin, m_targetBox.top + m_margin, m_targetBox.right - m_margin, m_targetBox.bottom - m_margin ); const char16 textString[] = L"\ Lorem ipsum dolor sit amet, consectetur adipisicing elit, \ sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. \ Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris \ nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in \ reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla\ pariatur. Excepteur sint occaecat cupidatat non proident, sunt in \ culpa qui officia deserunt mollit anim id est laborum."; m_d2dContext->DrawText( textString, ARRAYSIZE(textString) - 1, m_textFormat.Get(), textBox, m_blackBrush.Get() ); } // Draws a string to a rendering device context or a printing device context. void PageRendererContext::DrawMessage(_In_ Platform::String^ string) { // Clear rendering background with CornflowerBlue. m_d2dContext->Clear(D2D1::ColorF(D2D1::ColorF::CornflowerBlue)); m_d2dContext->DrawText( string->Data(), string->Length(), m_messageFormat.Get(), m_targetBox, m_blackBrush.Get() ); }
//// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF //// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO //// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A //// PARTICULAR PURPOSE. //// //// Copyright (c) Microsoft Corporation. All rights reserved #pragma once #include <DirectXBase.h> #include <printpreview.h> #include "SampleOverlay.h" #include "SimpleTextRenderer.h" enum class DrawTypes { Rendering, Preview, Printing }; // RAII (Resource Acquisition Is Initialization) class for manually // acquiring/releasing the D2D lock. class D2DFactoryLock { public: D2DFactoryLock(_In_ ID2D1Factory* d2dFactory) { DX::ThrowIfFailed( d2dFactory->QueryInterface(IID_PPV_ARGS(&m_d2dMultithread)) ); m_d2dMultithread->Enter(); } ~D2DFactoryLock() { m_d2dMultithread->Leave(); } private: Microsoft::WRL::ComPtr<ID2D1Multithread> m_d2dMultithread; }; // This class is in charge of rendering the contents of the page to an // arbitrary device context (which may be backed by a D2D bitmap in the case of // display or print-preview, or a D2D command list in the case of print). // // Note: unlike the PageRender class, this class is thread-specific, and hence // can hold on to both mutable and immutable resources. // // To conserve memory, it is preferable to store heavy-weight resources in the // PageRenderer, and take only a reference to those resources inside // PageRendererContext. ref class PageRendererContext { internal: PageRendererContext( _In_ D2D1_RECT_F targetBox, _In_ ID2D1DeviceContext* d2dContext, _In_ DrawTypes type, _In_ SimpleTextRenderer^ pageRenderer ); void UpdateTargetBox(_In_ D2D1_RECT_F& targetBox); void Draw(_In_ float scale); void DrawMessage(_In_ Platform::String^ string); private: Microsoft::WRL::ComPtr<ID2D1DeviceContext> m_d2dContext; Microsoft::WRL::ComPtr<IDWriteTextFormat> m_textFormat; Microsoft::WRL::ComPtr<IDWriteTextFormat> m_messageFormat; Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> m_blackBrush; float m_margin; // The margin size is in DIPs. D2D1_RECT_F m_targetBox; // The region that the page contents should be formatted for. DrawTypes m_type; };
#pragma once #include "D2DPageRendererContext.h" #include "PrintPreview.h" #include <Shcore.h> #include <shcore.h> #include <wrl.h> #include "DirectXBase.h" #include <string> #include "pch.h" #include "SimpleTextRenderer.h" #include "DirectXBase.h" #include <DirectXMath.h> #include <iostream> #include <string> // Windows Header Files: #include <windows.h> // C RunTime Header Files: #include <stdlib.h> #include <malloc.h> #include <memory.h> #include <wchar.h> #include <math.h> #include <d2d1.h> #include <d2d1helper.h> #include <dwrite.h> #include <wincodec.h> ////////////////////////////////// #include <iostream> #include <string> // Windows Header Files: #include <windows.h> // C RunTime Header Files: #include <stdlib.h> #include <malloc.h> #include <memory.h> #include <wchar.h> #include <math.h> #include <d2d1.h> #include <d2d1helper.h> #include <dwrite.h> #include <wincodec.h> using namespace std; using namespace Microsoft::WRL; using namespace Windows::Foundation; using namespace Windows::UI::Core; using namespace DirectX; using namespace Windows::UI::Popups; using namespace Windows::Storage; using namespace Windows::Storage::Streams; using namespace Windows::System; using namespace Windows::Foundation; using namespace Windows::Foundation::Collections; using namespace Windows::UI::Xaml::Input; using namespace Windows::UI::Popups; using namespace Windows::Storage; using namespace Windows::Storage::Streams; using namespace Windows::System; using namespace Windows::Storage::Pickers; using namespace Platform; using namespace Windows::Storage::Streams; using namespace Windows::UI::Xaml; using namespace Windows::UI::Xaml::Controls; using namespace Windows::UI::Xaml::Navigation; #include <ppltasks.h> using namespace concurrency; using namespace Windows::Devices::Enumeration; using namespace std; using namespace Microsoft::WRL; using namespace Windows::Foundation; using namespace Windows::UI::Core; using namespace DirectX; using namespace Windows::UI::Popups; ref class SimpleTextRenderer sealed : public DirectXBase { ~SimpleTextRenderer(); public: internal: int testdata[100]; internal: Microsoft::WRL::ComPtr<ID2D1PrintControl> m_d2dPrintControl; ; void SimpleTextRenderer::PrintPage( _In_ uint32 /*pageNumber*/, _In_ D2D1_RECT_F imageableArea, _In_ D2D1_SIZE_F pageSize, _In_opt_ IStream* pagePrintTicketStream ); void SimpleTextRenderer::DrawPreviewSurface( _In_ float width, _In_ float height, _In_ float scale, _In_ D2D1_RECT_F contentBox, _In_ uint32 desiredJobPage, _In_ IPrintPreviewDxgiPackageTarget* previewTarget ); HRESULT SimpleTextRenderer::ClosePrintControl(); void SimpleTextRenderer::CreatePrintControl( _In_ IPrintDocumentPackageTarget* docPackageTarget, _In_ D2D1_PRINT_CONTROL_PROPERTIES* printControlProperties ); void SimpleTextRenderer::HandleDeviceLost(); Microsoft::WRL::ComPtr<IDWriteTextFormat> m_textFormat; Microsoft::WRL::ComPtr<IDWriteTextFormat> m_messageFormat; internal: IDWriteTextFormat* GetTextFormatNoRef(); IDWriteTextFormat* GetMessageFormatNoRef(); public: SimpleTextRenderer(); void SimpleTextRenderer::mergepcb(); void SimpleTextRenderer::onebox(int x,int y); void SimpleTextRenderer::box8(int numberofboxes); void SimpleTextRenderer::box8_2(int numberofboxes); void SimpleTextRenderer::fmessn(int sodx, int sody); void SimpleTextRenderer::oldonebox(int x,int y); void SimpleTextRenderer::SaveBitmapToFile(); void SimpleTextRenderer::blockprintclick(); void SimpleTextRenderer::blockprintclick2(); void SimpleTextRenderer::PrintRender(); void SimpleTextRenderer::writer(); void SimpleTextRenderer::zz_autoroute(); void SimpleTextRenderer::zz_ROUTEBOARD_2(); void SimpleTextRenderer::gridlessclick(); void SimpleTextRenderer::createlibrary(); void SimpleTextRenderer::createrefstringold(); void SimpleTextRenderer::resistonoffclick(); void SimpleTextRenderer::plist(); void SimpleTextRenderer::sortsymbols(); void SimpleTextRenderer::reannotate(); void SimpleTextRenderer::symbolclrerrorclick(); void SimpleTextRenderer::symboloverrideclick(); void SimpleTextRenderer::blank(int x, int y, int width, int height); void MyKeyDown(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs ^); //{} void SimpleTextRenderer::contcheckclick (); void SimpleTextRenderer::help(); void SimpleTextRenderer::writecopperlayer(); void SimpleTextRenderer:: nswritepowerplanelayer(); void SimpleTextRenderer::nswritecopperlayer(); void SimpleTextRenderer::nswriteresistlayer(); void SimpleTextRenderer::writeresistlayer2(Platform::String^ fname); void SimpleTextRenderer:: writepowerplanelayer2(); void SimpleTextRenderer::nswritesilkscreenlayer(); void SimpleTextRenderer::writecopperlayer2(Platform::String^ fname); void SimpleTextRenderer::writesilkscreenlayer2(Platform::String^ fname); void SimpleTextRenderer:: writepowerplanelayer(); void SimpleTextRenderer::writesilkscreenlayer(Platform::String^ fname); void SimpleTextRenderer::writeresistlayer(Platform::String^ fname); void SimpleTextRenderer:: nsdrill(); void SimpleTextRenderer::appendsilk127file(Platform::String^ fname, int cx); void SimpleTextRenderer::appendsilk0file(Platform::String^ fname, int cx); void SimpleTextRenderer::appendresistfile(Platform::String^ fname, int cx); void SimpleTextRenderer:: appendinvcopperfile(Platform::String^ fname, int cx); void SimpleTextRenderer:: appenddrillfile(Platform::String^ fname, int cx); void SimpleTextRenderer::translate2(); void SimpleTextRenderer::appendcopperfile(Platform::String^ fname, int cx); void SimpleTextRenderer::loadzbuffer(Platform::String^ fname); void SimpleTextRenderer::createrefstring(); void SimpleTextRenderer::createsupportfiles(); void SimpleTextRenderer::createschemdotplb(); void SimpleTextRenderer::orientate(); void SimpleTextRenderer::forwardannotate(); int SimpleTextRenderer::addnewnets2(int startadd); int SimpleTextRenderer::addnewnets(); int SimpleTextRenderer::fecker(int startadd); void SimpleTextRenderer::shortredraw(); int SimpleTextRenderer::samepointsamelayer(); void SimpleTextRenderer::ShortRender(); void SimpleTextRenderer::routeboard_2(); void SimpleTextRenderer::fastp(); void SimpleTextRenderer::autoplacecorner2(); void SimpleTextRenderer::autoplacecornerclick(); void SimpleTextRenderer::autoroute2(); void SimpleTextRenderer::autoroute(); void SimpleTextRenderer::viasizeclick(); void SimpleTextRenderer::allviasizeclick(); void SimpleTextRenderer::optimisenet(); void SimpleTextRenderer::eclearonesymbol(int di); void SimpleTextRenderer::spadclr2(); void SimpleTextRenderer::spadclr(); void SimpleTextRenderer::fclearonesymbol(int di); void SimpleTextRenderer::strkclr2(); void SimpleTextRenderer::strkclr(); void SimpleTextRenderer::viaclr(); void SimpleTextRenderer::twolines(); void SimpleTextRenderer::trkclr(); void SimpleTextRenderer::trk_trk(); void SimpleTextRenderer::savefile(); void SimpleTextRenderer::clearstartclick(); void SimpleTextRenderer::newschematic(); void SimpleTextRenderer::optionsgrid(); void SimpleTextRenderer::gridpart2(IUICommand^ grid); void SimpleTextRenderer::gridquit(IUICommand^ grid); void SimpleTextRenderer::grid0(IUICommand^ grid); void SimpleTextRenderer::grid1(IUICommand^ grid); void SimpleTextRenderer::grid2(IUICommand^ grid); void SimpleTextRenderer::grid3(IUICommand^ grid); void SimpleTextRenderer::grid4(IUICommand^ grid); void SimpleTextRenderer::grid5(IUICommand^ grid); void SimpleTextRenderer::grid6(IUICommand^ grid); void SimpleTextRenderer::impmet(); void SimpleTextRenderer::relorg(); void SimpleTextRenderer::relcoords(); void SimpleTextRenderer::abscoords(); void SimpleTextRenderer::zoomin(); void SimpleTextRenderer::zoomout(); void SimpleTextRenderer::focusoncontent(); void SimpleTextRenderer:: symbolupdateclick(); void SimpleTextRenderer::textcurrclick(); void SimpleTextRenderer:: blockrepeatclick(); void SimpleTextRenderer:: blockshiftclick(); void SimpleTextRenderer:: symbolangleclick(); void SimpleTextRenderer:: symbolcurrclick(); void SimpleTextRenderer:: symboldelclick(); void SimpleTextRenderer:: symbolmoverefclick(); void SimpleTextRenderer:: symbolflipclick(); void SimpleTextRenderer:: symbolmoveclick(); void SimpleTextRenderer:: symbolrefnumberclick (); void SimpleTextRenderer:: symbolrepeatclick(); void SimpleTextRenderer::textflipclick(); void SimpleTextRenderer::textmoveclick(); void SimpleTextRenderer::textrepeatclick(); void SimpleTextRenderer:: blockanticlick (); void SimpleTextRenderer:: blockcurrclick(); void SimpleTextRenderer:: blockeraseclick(); void SimpleTextRenderer:: blockclockclick(); void SimpleTextRenderer:: blockorgclick (); void SimpleTextRenderer::textdelclick(); void SimpleTextRenderer::tracknetnameclick (); void SimpleTextRenderer::textattrclick (); void SimpleTextRenderer::trackwidthclick (); void SimpleTextRenderer::tracksegwidthclick (); void SimpleTextRenderer::trackrepeatclick(); void SimpleTextRenderer::tracknextclick(); void SimpleTextRenderer::trackclrclick (); void SimpleTextRenderer::trackseglayerclick(); void SimpleTextRenderer::tracknextrouteclick (); void SimpleTextRenderer::trackendclick(); void SimpleTextRenderer::trackinvertclick(); void SimpleTextRenderer::trackhomeclick (); void SimpleTextRenderer::trackkillclick(); void SimpleTextRenderer::trackwholelayerclick(); void SimpleTextRenderer::trackbackclick(); void SimpleTextRenderer::trackdelclick(); void SimpleTextRenderer::trackcurrclick (); void SimpleTextRenderer::newsymbol2(); void SimpleTextRenderer::blockmodeclick(); void SimpleTextRenderer::f6newsymbolclick(); void SimpleTextRenderer::f5editsymbolclick(); void SimpleTextRenderer::f3edittextclick(); void SimpleTextRenderer::f4newtextclick(); void SimpleTextRenderer::f2newtrackclick(); void SimpleTextRenderer::loadrefstring(); void SimpleTextRenderer::loadfile(); int SimpleTextRenderer::rev(int ax); void SimpleTextRenderer::f1edittrackclick(); void SimpleTextRenderer::sb1update(); void SimpleTextRenderer::branchmenu(int x,int y); void SimpleTextRenderer::drawrubber(); void SimpleTextRenderer::onkeydown(Windows::UI::Xaml::Input::KeyRoutedEventArgs^ args ); void SimpleTextRenderer::redraw(); void SimpleTextRenderer::changefunction0(); void SimpleTextRenderer::mousemoved(float x, float y); void SimpleTextRenderer::mousedown(float fx, float fy); void SimpleTextRenderer::Render2(); void SimpleTextRenderer::messn(int sodx, int sody); void SimpleTextRenderer::clearnewtextstrings(); virtual void CreateDeviceIndependentResources() override; virtual void CreateDeviceResources() override; virtual void CreateWindowSizeDependentResources() override; virtual void Render() override; void Update(float timeTotal, float timeDelta); void OnManipulationUpdated(Windows::UI::Input::GestureRecognizer^ sender, Windows::UI::Input::ManipulationUpdatedEventArgs^ args); void OnManipulationCompleted(Windows::UI::Input::GestureRecognizer^ sender, Windows::UI::Input::ManipulationCompletedEventArgs^ args); void OnTapped(Windows::UI::Input::GestureRecognizer^ sender, Windows::UI::Input::TappedEventArgs^ args); void UpdateView(Windows::Foundation::Point deltaViewPosition); void SetRenderFast(bool value); void BackgroundColorNext(); void BackgroundColorPrevious(); private: Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> m_blackBrush; Microsoft::WRL::ComPtr<ID2D1Bitmap1> m_opacityBitmap; DWRITE_TEXT_METRICS m_textMetrics; Windows::Foundation::Point m_viewPosition; bool m_animating; bool m_renderNeeded; int m_bgColorIndex; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text0Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_textLayout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_textaLayout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text2Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text3Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text4Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text5Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text6Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text6aLayout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text6bLayout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text6cLayout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text6dLayout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text6eLayout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text6fLayout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text6gLayout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text6hLayout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text6iLayout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text6jLayout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text6kLayout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text6lLayout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text7Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text7aLayout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text8Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text9Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text10Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text11Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text12Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text13Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text14Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text15Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text16Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text17Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text18Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text19Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text20Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text21Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text22Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text23Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text24Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text25Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text26Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text26aLayout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text27Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text28Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text29Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text30Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text31Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text32Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text33Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text33aLayout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text34Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text34aLayout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text34bLayout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text35Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text36Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text37Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text38Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text39Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text40Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text40aLayout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text41Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text42Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text43Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text44Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text45Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text46Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text47Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text48Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text49Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text50Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text51Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text52Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text53Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text54Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text55Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text55aLayout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text56Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text57Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text58Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text59Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text60Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text61Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text62Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text63Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text64Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text66Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text67Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text68Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text69Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text70Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text71Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text72Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text73Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text74Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text75Layout; Microsoft::WRL::ComPtr<IDWriteTextLayout> m_text76Layout; };
// Print out one page, with the given print ticket. // This sample has only one page and we ignore pageNumber below. void SimpleTextRenderer::PrintPage( _In_ uint32 /*pageNumber*/, _In_ D2D1_RECT_F imageableArea, _In_ D2D1_SIZE_F pageSize, _In_opt_ IStream* pagePrintTicketStream ) { // Create a new D2D device context for generating the print command list. // D2D device contexts are stateful, and hence a unique device context must // be used on each thread. ComPtr<ID2D1DeviceContext> d2dContext; DX::ThrowIfFailed( m_d2dDevice->CreateDeviceContext( D2D1_DEVICE_CONTEXT_OPTIONS_NONE, &d2dContext ) ); ComPtr<ID2D1CommandList> printCommandList; DX::ThrowIfFailed( d2dContext->CreateCommandList(&printCommandList) ); d2dContext->SetTarget(printCommandList.Get()); // Create and initialize the page renderer context for print. // In this case, we want to use the bitmap source that already has // the color context embedded in it. Thus, we pass NULL for the // color context parameter. PageRendererContext^ printPageRendererContext = ref new PageRendererContext( imageableArea, d2dContext.Get(), DrawTypes::Printing, this ); d2dContext->BeginDraw(); // Draw page content on a command list. // 1.0f below indicates that the printing content does not scale. // "DrawTypes::Printing" below indicates it is a printing case. printPageRendererContext->Draw(1.0f); // The document source handles D2DERR_RECREATETARGET, so it is okay to throw this error // here. DX::ThrowIfFailed( d2dContext->EndDraw() ); DX::ThrowIfFailed( printCommandList->Close() ); DX::ThrowIfFailed( m_d2dPrintControl->AddPage(printCommandList.Get(), pageSize, pagePrintTicketStream) ); } /////////////////////////////////////////////////////// SimpleTextRenderer::SimpleTextRenderer() : m_animating(false), m_renderNeeded(true), m_bgColorIndex(0), m_viewPosition(0.0f, 0.0f) { previousfname=""; clearlot(); zoom=4; setupcol(); menuonq=1; createlibrary(); fred(); }
n.Wright
Tuesday, August 27, 2013 9:15 PM -
-
- Merged by Rob Caplan [MSFT]Microsoft employee, Moderator Thursday, August 29, 2013 9:14 PM duplicate
Thursday, August 29, 2013 8:13 PM -
Please provide more of a description of what you are doing, what the error is, and what the code around the error looks like. Posting a link to a repro project is helpful, but not sufficient. In this case, your link doesn't appear to be correct.
--Rob
Thursday, August 29, 2013 8:36 PMModerator -
The compiler says SimpleTextRenderer is a syntax error.
The compiler also says PageRenderContext does not have 4 parameters which it clearly does.
The link is now fixed to the source code:
http://www.ckp-railways.talktalk.net/newzip.htm
#pragma once #include <DirectXBase.h> #include <printpreview.h> #include "SampleOverlay.h" #include "SimpleTextRenderer.h" enum class DrawTypes { Rendering, Preview, Printing }; // RAII (Resource Acquisition Is Initialization) class for manually // acquiring/releasing the D2D lock. class D2DFactoryLock { public: D2DFactoryLock(_In_ ID2D1Factory* d2dFactory) { DX::ThrowIfFailed( d2dFactory->QueryInterface(IID_PPV_ARGS(&m_d2dMultithread)) ); m_d2dMultithread->Enter(); } ~D2DFactoryLock() { m_d2dMultithread->Leave(); } private: Microsoft::WRL::ComPtr<ID2D1Multithread> m_d2dMultithread; }; // This class is in charge of rendering the contents of the page to an // arbitrary device context (which may be backed by a D2D bitmap in the case of // display or print-preview, or a D2D command list in the case of print). // // Note: unlike the PageRender class, this class is thread-specific, and hence // can hold on to both mutable and immutable resources. // // To conserve memory, it is preferable to store heavy-weight resources in the // PageRenderer, and take only a reference to those resources inside // PageRendererContext. ref class PageRendererContext { internal: PageRendererContext( _In_ D2D1_RECT_F targetBox, _In_ ID2D1DeviceContext* d2dContext, _In_ DrawTypes type, _In_ SimpleTextRenderer^ pageRenderer );
n.Wright
Thursday, August 29, 2013 9:00 PM -
Please post one thread for a given question, in the appropriate forum.
Posting duplicate threads is not helpful and will not give a quicker or more accurate answer.
--Rob
Thursday, August 29, 2013 9:13 PMModerator -
The errors become obvious if you use the source code as the compiler immediately highlights the errors.
The code is >50,000 lines so I will never be able to explain that in a short message.
Basically I had a working PCB design program and then wanted to add printing to it.
So I merged the direct2d printing code with my code.
After about 2 weeks I got it to merge sort of OK.
I just down to the last 7 errors which really are just one error causing them all.
I would really like to get this software working after spending so much time on it.
MS have been little use saying they cant reproduce the problem !
If they had bothered to turn my source files into a project then problem jumps out as 7 errors.
n.Wright
Thursday, August 29, 2013 9:22 PM -
I finally fixed the problem.
The line "SimpleTextRenderer^ xxx" should be ref class "SimpleTextRenderer ^ xxx"
n.Wright
- Marked as answer by nigelwright7557 Friday, August 30, 2013 2:04 AM
Friday, August 30, 2013 2:04 AM