Monthly Archives: January 2012

Modeler Tool : RC 1

Here is the new version of Modeler1 Tool. It helps to draw Infrastructure diagrams. The next version will allow to design application diagrams.

C++ 11 – Everything you can read

Available on ATT web site and Bjarne Stroustrup (inventor of C++) space, here a FAQ for C++ 11:  FAQ C++ 11 : http://www2.research.att.com/~bs/C++0xFAQ.html

Why C++ is so important at Microsoft what is Microsoft commitment to C++. Windows 8 and C++ means:
New programming model for Windows 8 | Get the full power of your CPU and GPU | Use Windows 8 hardware capabilities to the fullest | Build for ARM | Visual C++ is The power and performance tool for Windows.

C++ is the ultimate object oriented programming approach. C++ programmers care about details.

C++ 11 is the new ISO standard for C++ language. What’s new in C++ 11 ? Check-out this Herb Sutter image from “Why C++” talk: http://ecn.channel9.msdn.com/content/WhyCPPCB2011.pdf
To read (for free) a 1334 PDf document about the C++ language, you can drownload the draft of the C++ Programming Language Specifications:  ISO/IEC 14882:2011 Programming Language C++ – draft

From Bjarne Stroustrup, “What is the new C++” : C++ is a language for building software infrastructure | C++ is a language for applications with large systems programming parts | C++ is a language for building and using libraries | C++ is a language for resource-constrained systems | C++ is a language for efficiently expressing abstractions | C++ is a language for general and efficient algorithms | C++ is a language for general and compact data structures | C++ is a lightweight abstraction language. The C++ document to read: BS-what-is-c++0x.pdf

To find advanced STL topics, check out Advanced STL channel9 sessions :

See Part 1 -> shared_ptr and friends | See Part 2 -> Algorithm optimization | See Part 3 -> STL’s comprehensive correctness checks | See Part 4 -> rvalue references, perfect forwarding, associative containers  | See part 5 -> http://channel9.msdn.com/Shows/Going+Deep/C9-Lectures-Stephan-T-Lavavej-Advanced-STL-5-of-n | From the presentation : vis-1.1.pptx

Windows 8 Essentials (UI and Internals)

This is a very lightweight version of “Windows 8 Best-Of” of a previous post.
It contains the Metro UI style inspiration and essentials native controls (XAML) and the complete list of API namespaces.
Inspiration of the Metro UI design comes from the transport area.

Windows 8 is powered with C++.

WinRT design comes with modern C++ and use advances technique like template meta programming. See Channel9 video about Windows Runtime Library: http://channel9.msdn.com/Shows/C9-GoingNative/GoingNative-2-C-at-BUILD-Windows-Runtime-LibraryWRL-Meet-Tarek-and-Sridhar

BUILD_Windows8_Essentials_Pichaud.pptx

Modeling Tool – alpha version

Here I am, with a preview alpha version of my Modeler tool.
It contains a basic Ribbon UI feature to draw simple shapes and a Infrastructure shapes.
In next version, I will allow application architecture shapes and custom n-tiers layer models.

ChristopheP | Why Visual C++ ? Power and Performance Tool for Windows.

Modeling and Ribbon UI

For the Microsoft TechDays in Paris and my C++ 11 session, I have prepared a real coding demo.
It’s like a simple drawing tool, and it allows to draw simple shapes. To a quick and dirty but cool user experience demo, I have switch some gdiplus drawing to directly loading pictures with transparency (png format).

Handling a property grid window

In my modeler tool, I can now handle Color and Text properties on objects.
Each property is handled by the CMFCPropertyGridProperty class and the default value type is COleVariant.
Enjoy the drawing stuff !

Drawing UI handlers – h file

Here are the prototyped rewritten classes. Will move from C++ MFC to C++ 11 modern code with STL sooner.

Element_h.docx

Here is the CElement class which contains basic and generic drawing objects:

class CElement : public CObject
{
public:
DECLARE_SERIAL(CElement);
CElement();
CElement(ElementType type);
virtual ~CElement(void);

// Operations
public:
virtual void Serialize(CArchive& ar);   // overridden for document i/o
CString ToString();
CString ToString(ElementType type);
static bool IsDrawable(ElementType type);
BOOL Intersects(const CRect& rect);
void InvalidateObj(void);
void Draw(CModeler1View * pView, CDC* pDC);

// Attributes
public:
CString m_name;
ElementType m_type;
CString m_objectId;
CString m_caption;
CString m_text;
CRect m_rect;
CPoint m_point;
CPoint m_last;
CElementManager * m_pManager;

CElementManager * GetManager() const
{
return m_pManager;
}
};

The CElementManager class contains the code for the UI handlers and some others stuff.

class CElementManager : public CObject
{
public:
DECLARE_SERIAL(CElementManager);
CElementManager();
virtual ~CElementManager(void);

// Attributes
public:
CTypedPtrList<CObList, CElement*> m_objects;
CTypedPtrList<CObList, CElement*> m_selection;
COLORREF m_paperColor;
// Page size in logical coordinates
CSize m_size;
CPoint m_lastPoint;
// Current working object
CString m_objectId;

// Operations
public:
virtual void Serialize(CArchive& ar);   // overridden for document i/o
CElement * FindElement(ElementType type);
CElement * FindElement(CString objectId);
CElement * ObjectAt(const CPoint & point);
static void ViewToManager(CModeler1View * pView, CPoint & point);
static void ViewToManager(CModeler1View * pView, CRect & rect);
static void ManagerToView(CModeler1View * pView, CPoint & point);
static void ManagerToView(CModeler1View * pView, CRect & rect);
COLORREF GetPaperColor() const { return m_paperColor; }
void Invalidate(CModeler1View * pView, CElement * pElement);
void InvalObj(CModeler1View * pView, CElement * pElement);
CSize GetSize() const { return m_size; }
void UpdatePropertyGrid(CModeler1View * pView, CElement * pElement);
void UpdateFromPropertyGrid(CString objectId, CString name, CString value);

// Managing Object Selection
public:
BOOL HasSelection();
BOOL IsSelected(CElement * pElement);
BOOL Select(CElement * pElement);
BOOL Deselect(CElement * pElement);
void SelectNone();

// Managing/Viewing Object Selection & Tracker helpers
public:
int GetHandleCount();
CPoint GetHandle(CElement * pElement, int nHandle);
void DrawTracker(CElement *pElement, CDC* pDC, TrackerState state);
HCURSOR GetHandleCursor(int nHandle);

// Overridables
public:
virtual void Draw(CModeler1View * pView, CDC * pDC);
virtual void DrawEx(CModeler1View * pView, CDC * pDC);
virtual void Update(CModeler1View * pView, LPARAM lHint, CObject* pHint);

// UI Handlers
public:
virtual void OnLButtonDown(CModeler1View* pView, UINT nFlags, const CPoint& cpoint);
virtual void OnLButtonDblClk(CModeler1View* pView, UINT nFlags, const CPoint& cpoint);
virtual void OnLButtonUp(CModeler1View* pView, UINT nFlags, const CPoint& cpoint);
virtual void OnMouseMove(CModeler1View* pView, UINT nFlags, const CPoint& cpoint);
};