Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.

Fri, 24 May 2013 15:23:56 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Fri, 24 May 2013 15:23:56 +0300
changeset 251
c4b96bc41298
parent 250
6e80f038e8df
child 252
3f9067022d74

Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.

src/configDialog.cpp file | annotate | diff | comparison | revisions
src/configDialog.h file | annotate | diff | comparison | revisions
src/dialogs.cpp file | annotate | diff | comparison | revisions
src/dialogs.h file | annotate | diff | comparison | revisions
src/extprogs.cpp file | annotate | diff | comparison | revisions
src/file.cpp file | annotate | diff | comparison | revisions
src/file.h file | annotate | diff | comparison | revisions
src/gldraw.cpp file | annotate | diff | comparison | revisions
src/gldraw.h file | annotate | diff | comparison | revisions
src/gui.cpp file | annotate | diff | comparison | revisions
src/gui.h file | annotate | diff | comparison | revisions
src/gui_actions.cpp file | annotate | diff | comparison | revisions
src/gui_editactions.cpp file | annotate | diff | comparison | revisions
src/history.cpp file | annotate | diff | comparison | revisions
src/history.h file | annotate | diff | comparison | revisions
src/ldtypes.cpp file | annotate | diff | comparison | revisions
src/ldtypes.h file | annotate | diff | comparison | revisions
src/misc.h file | annotate | diff | comparison | revisions
src/string.cpp file | annotate | diff | comparison | revisions
src/string.h file | annotate | diff | comparison | revisions
src/types.h file | annotate | diff | comparison | revisions
src/widgets.cpp file | annotate | diff | comparison | revisions
src/widgets.h file | annotate | diff | comparison | revisions
--- a/src/configDialog.cpp	Fri May 24 04:34:20 2013 +0300
+++ b/src/configDialog.cpp	Fri May 24 15:23:56 2013 +0300
@@ -442,7 +442,7 @@
 		else
 			idx = quickColorItems.size();
 		
-		quickColorMeta.insert (quickColorMeta.begin() + idx, entry);
+		quickColorMeta.insert (idx, entry);
 		entry = quickColorMeta[idx];
 	}
 	
@@ -456,9 +456,8 @@
 	if (lw_quickColors->selectedItems().size() == 0)
 		return;
 	
-	QListWidgetItem* qItem = lw_quickColors->selectedItems ()[0];
-	ulong ulIdx = getItemRow (qItem, quickColorItems);
-	quickColorMeta.erase (quickColorMeta.begin () + ulIdx);
+	QListWidgetItem* item = lw_quickColors->selectedItems ()[0];
+	quickColorMeta.erase (getItemRow (item, quickColorItems));
 	updateQuickColorList ();
 }
 
@@ -543,7 +542,7 @@
 }
 
 // =============================================================================
-long ConfigDialog::getItemRow (QListWidgetItem* qItem, std::vector<QListWidgetItem*>& haystack) {
+long ConfigDialog::getItemRow (QListWidgetItem* qItem, vector<QListWidgetItem*>& haystack) {
 	long i = 0;
 	
 	for (QListWidgetItem* it : haystack) {
--- a/src/configDialog.h	Fri May 24 04:34:20 2013 +0300
+++ b/src/configDialog.h	Fri May 24 15:23:56 2013 +0300
@@ -68,8 +68,8 @@
 	QListWidget* lw_quickColors;
 	QPushButton* pb_addColor, *pb_delColor, *pb_changeColor, *pb_addColorSeparator,
 		*pb_moveColorUp, *pb_moveColorDown, *pb_clearColors;
-	std::vector<QListWidgetItem*> quickColorItems;
-	std::vector<quickColorMetaEntry> quickColorMeta;
+	vector<QListWidgetItem*> quickColorItems;
+	vector<quickColorMetaEntry> quickColorMeta;
 	
 	// =========================================================================
 	// Grid tab
@@ -95,7 +95,7 @@
 	void pickColor (strconfig& cfg, QPushButton* qButton);
 	void updateQuickColorList (quickColorMetaEntry* pSel = null);
 	void setShortcutText (QListWidgetItem* qItem, actionmeta meta);
-	long getItemRow (QListWidgetItem* qItem, std::vector<QListWidgetItem*>& haystack);
+	long getItemRow (QListWidgetItem* qItem, vector<QListWidgetItem*>& haystack);
 	str makeColorToolBarString ();
 	QListWidgetItem* getSelectedQuickColor ();
 	QList<ShortcutListItem*> getShortcutSelection ();
--- a/src/dialogs.cpp	Fri May 24 04:34:20 2013 +0300
+++ b/src/dialogs.cpp	Fri May 24 15:23:56 2013 +0300
@@ -115,7 +115,7 @@
 }
 
 void OverlayDialog::fillDefaults (int newcam) {
-	overlayMeta& info = g_overlays[newcam];
+	overlayMeta& info = g_win->R ()->getOverlay (newcam);
 	
 	if (info.img != null) {
 		le_fpath->setText (info.fname);
@@ -409,17 +409,17 @@
 		(idx == NonCA) ? "Not redistributable : see NonCAreadme.txt" :
 		null;
 	
-	objs.push_back (new LDComment (dlg.le_name->text ()));
-	objs.push_back (new LDComment ("Name: <untitled>.dat"));
-	objs.push_back (new LDComment (fmt ("Author: %s", author.chars())));
-	objs.push_back (new LDComment (fmt ("!LDRAW_ORG Unofficial_Part")));
+	objs << new LDComment (dlg.le_name->text ());
+	objs << new LDComment ("Name: <untitled>.dat");
+	objs << new LDComment (fmt ("Author: %s", author.chars()));
+	objs << new LDComment (fmt ("!LDRAW_ORG Unofficial_Part"));
 	
 	if (license != null)
-		objs.push_back (new LDComment (fmt ("!LICENSE %s", license)));
+		objs << new LDComment (fmt ("!LICENSE %s", license));
 	
-	objs.push_back (new LDEmpty);
-	objs.push_back (new LDBFC (BFCType));
-	objs.push_back (new LDEmpty);
+	objs << new LDEmpty;
+	objs << new LDBFC (BFCType);
+	objs << new LDEmpty;
 	
 	g_win->fullRefresh ();
 }
--- a/src/dialogs.h	Fri May 24 04:34:20 2013 +0300
+++ b/src/dialogs.h	Fri May 24 15:23:56 2013 +0300
@@ -66,7 +66,7 @@
 public:
 	explicit ReplaceCoordsDialog (QWidget* parent = null, Qt::WindowFlags f = 0);
 	
-	std::vector< int > axes () const;
+	vector< int > axes () const;
 	double searchValue () const;
 	double replacementValue () const;
 	
--- a/src/extprogs.cpp	Fri May 24 04:34:20 2013 +0300
+++ b/src/extprogs.cpp	Fri May 24 15:23:56 2013 +0300
@@ -106,7 +106,7 @@
 }
 
 // =============================================================================
-void writeObjects (std::vector<LDObject*>& objects, FILE* fp) {
+void writeObjects (vector<LDObject*>& objects, FILE* fp) {
 	for (LDObject* obj : objects) {
 		if (obj->getType () == LDObject::Subfile) {
 			vector<LDObject*> objs = static_cast<LDSubfile*> (obj)->inlineContents (true, false);
@@ -127,7 +127,7 @@
 	}
 }
 
-void writeObjects (std::vector<LDObject*>& objects, str fname) {
+void writeObjects (vector<LDObject*>& objects, str fname) {
 	// Write the input file
 	FILE* fp = fopen (fname, "w");
 	if (!fp) {
@@ -153,7 +153,7 @@
 
 // =============================================================================
 void writeColorGroup (const short colnum, str fname) {
-	std::vector<LDObject*> objects;
+	vector<LDObject*> objects;
 	for (LDObject*& obj : g_curfile->objs ()) {
 		if (obj->isColored () == false || obj->color != colnum)
 			continue;
@@ -217,9 +217,9 @@
 	}
 	
 	ComboHistory* cmb = new ComboHistory ();
-	std::vector<LDObject*> objs = loadFileContents (fp, null),
+	vector<LDObject*> objs = loadFileContents (fp, null),
 		copies;
-	std::vector<ulong> indices;
+	vector<ulong> indices;
 	
 	// If we replace the objects, delete the selection now.
 	if (replace)
--- a/src/file.cpp	Fri May 24 04:34:20 2013 +0300
+++ b/src/file.cpp	Fri May 24 15:23:56 2013 +0300
@@ -237,7 +237,7 @@
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-std::vector<LDObject*> loadFileContents (FILE* fp, ulong* numWarnings, bool* ok) {
+vector<LDObject*> loadFileContents (FILE* fp, ulong* numWarnings, bool* ok) {
 	vector<str> lines;
 	vector<LDObject*> objs;
 	
@@ -323,7 +323,7 @@
 	
 	ulong numWarnings;
 	bool ok;
-	std::vector<LDObject*> objs = loadFileContents (fp, &numWarnings, &ok);
+	vector<LDObject*> objs = loadFileContents (fp, &numWarnings, &ok);
 	
 	if (!ok) {
 		load = oldLoad;
@@ -831,7 +831,7 @@
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
 void LDOpenFile::insertObj (const ulong pos, LDObject* obj) {
-	m_objs.insert (m_objs.begin () + pos, obj);
+	m_objs.insert (pos, obj);
 	
 	if (this == g_curfile)
 		g_BBox.calcObject (obj);
@@ -842,16 +842,16 @@
 // =============================================================================
 void LDOpenFile::forgetObject (LDObject* obj) {
 	// Find the index for the given object
-	ulong ulIndex;
-	for (ulIndex = 0; ulIndex < (ulong)m_objs.size(); ++ulIndex)
-		if (m_objs[ulIndex] == obj)
+	ulong idx;
+	for (idx = 0; idx < (ulong)m_objs.size(); ++idx)
+		if (m_objs[idx] == obj)
 			break; // found it
 	
-	if (ulIndex >= m_objs.size ())
+	if (idx >= m_objs.size ())
 		return; // was not found
 	
 	// Erase it from memory
-	m_objs.erase (m_objs.begin() + ulIndex);
+	m_objs.erase (idx);
 	
 	// Update the bounding box
 	if (this == g_curfile)
@@ -861,7 +861,7 @@
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-std::vector<partListEntry> g_PartList;
+vector<partListEntry> g_PartList;
 
 void initPartList () {
 	logf ("%s: initializing parts.lst\n", __func__);
--- a/src/file.h	Fri May 24 04:34:20 2013 +0300
+++ b/src/file.h	Fri May 24 15:23:56 2013 +0300
@@ -51,9 +51,6 @@
 	PROPERTY (long, savePos, setSavePos)
 	
 public:
-	typedef std::vector<LDObject*>::iterator it;
-	typedef std::vector<LDObject*>::const_iterator c_it;
-	
 	LDOpenFile ();
 	~LDOpenFile ();
 	
@@ -75,11 +72,6 @@
 	void insertObj (const ulong pos, LDObject* obj);
 	ulong numObjs () const { return m_objs.size (); }
 	void setObject (ulong idx, LDObject* obj);
-	
-	it begin () { return m_objs.begin (); }
-	it end () { return m_objs.end (); }
-	c_it cbegin () const { return m_objs.cbegin (); }
-	c_it cend () const { return m_objs.cend (); }
 };
 
 // Close all current loaded files and start off blank.
@@ -120,7 +112,7 @@
 // Init and parse parts.lst
 void initPartList ();
 
-std::vector<LDObject*> loadFileContents (FILE* fp, ulong* numWarnings, bool* ok = null);
+vector<LDObject*> loadFileContents (FILE* fp, ulong* numWarnings, bool* ok = null);
 
 extern vector<LDOpenFile*> g_loadedFiles;
 extern vector<partListEntry> g_PartList;
@@ -131,7 +123,7 @@
 class FileLoader : public QObject {
 	Q_OBJECT
 	
-	READ_PROPERTY (std::vector<LDObject*>, objs)
+	READ_PROPERTY (vector<LDObject*>, objs)
 	READ_PROPERTY (bool, done)
 	READ_PROPERTY (ulong, progress)
 	PROPERTY (FILE*, filePointer, setFilePointer)
--- a/src/gldraw.cpp	Fri May 24 04:34:20 2013 +0300
+++ b/src/gldraw.cpp	Fri May 24 15:23:56 2013 +0300
@@ -47,9 +47,6 @@
 	{ { 0, -1, 0 }, Z, Y, false, true },
 };
 
-overlayMeta g_overlays[6];
-double g_depthValues[6];
-
 cfg (str, gl_bgcolor, "#CCCCD9");
 cfg (str, gl_maincolor, "#707078");
 cfg (float, gl_maincolor_alpha, 1.0);
@@ -120,8 +117,8 @@
 	}
 	
 	for (int i = 0; i < 6; ++i) {
-		g_overlays[i].img = null;
-		g_depthValues[i] = 0.0f;
+		m_overlays[i].img = null;
+		m_depthValues[i] = 0.0f;
 	}
 	
 	calcCameraIcons ();
@@ -133,7 +130,7 @@
 		delete info.img;
 	
 	for (int i = 0; i < 6; ++i)
-		delete g_overlays[i].img;
+		delete m_overlays[i].img;
 }
 
 // =============================================================================
@@ -491,10 +488,10 @@
 	
 	if (m_camera != Free) {
 		// Paint the overlay image if we have one
-		const overlayMeta& overlay = g_overlays[m_camera];
+		const overlayMeta& overlay = m_overlays[m_camera];
 		if (overlay.img != null) {
-			QPoint v0 = coordconv3_2 (g_overlays[m_camera].v0),
-				v1 = coordconv3_2 (g_overlays[m_camera].v1);
+			QPoint v0 = coordconv3_2 (m_overlays[m_camera].v0),
+				v1 = coordconv3_2 (m_overlays[m_camera].v1);
 			
 			QRect targRect (v0.x (), v0.y (), abs (v1.x () - v0.x ()), abs (v1.y () - v0.y ())),
 				srcRect (0, 0, overlay.img->width (), overlay.img->height ());
@@ -516,7 +513,7 @@
 			textSize.height (), Qt::AlignCenter, text);
 		
 		// If we're drawing, draw the vertices onto the screen.
-		if (m_editMode == Draw) {
+		if (editMode () == Draw) {
 			ushort numverts;
 			
 			if (!m_rectdraw)
@@ -761,7 +758,7 @@
 	case LDObject::Radial:
 		{
 			LDRadial* rad = static_cast<LDRadial*> (obj);
-			std::vector<LDObject*> objs = rad->decompose (true);
+			vector<LDObject*> objs = rad->decompose (true);
 			
 			bool oldinvert = g_glInvert;
 			if (rad->transform.determinant () < 0)
@@ -901,7 +898,7 @@
 	
 	if (wasRight && m_drawedVerts.size () > 0) {
 		// Remove the last vertex
-		m_drawedVerts.erase (m_drawedVerts.end () - 1);
+		m_drawedVerts.erase (m_drawedVerts.size () - 1);
 		
 		if (m_drawedVerts.size () == 0)
 			m_rectdraw = false;
@@ -1011,7 +1008,7 @@
 	
 	// Clear the selection if we do not wish to add to it.
 	if (!m_addpick) {
-		std::vector<LDObject*> oldsel = g_win->sel ();
+		vector<LDObject*> oldsel = g_win->sel ();
 		g_win->sel ().clear ();
 		
 		for (LDObject* obj : oldsel) {
@@ -1092,7 +1089,7 @@
 			
 			for (ulong i = 0; i < g_win->sel ().size(); ++i) {
 				if (g_win->sel ()[i] == obj) {
-					g_win->sel ().erase (g_win->sel ().begin () + i);
+					g_win->sel ().erase (i);
 					obj->setSelected (false);
 					removed = true;
 					removedObj = obj;
@@ -1110,11 +1107,10 @@
 	
 	// Remove duplicate entries. For this to be effective, the vector must be
 	// sorted first.
-	std::vector<LDObject*>& sel = g_win->sel ();
-	std::sort (sel.begin(), sel.end ());
-	std::vector<LDObject*>::iterator pos = std::unique (sel.begin (), sel.end ());
+	vector<LDObject*>& sel = g_win->sel ();
+	std::sort (sel.begin (), sel.end ());
+	vector<LDObject*>::it pos = std::unique (sel.begin (), sel.end ());
 	sel.resize (std::distance (sel.begin (), pos));
-	
 	// Update everything now.
 	g_win->updateSelection ();
 	
@@ -1137,8 +1133,8 @@
 }
 
 // =============================================================================
-void GLRenderer::setEditMode (EditMode mode) {
-	switch (mode) {
+void GLRenderer::callback_setEditMode () {
+	switch (editMode ()) {
 	case Select:
 		unsetCursor ();
 		setContextMenuPolicy (Qt::DefaultContextMenu);
@@ -1164,8 +1160,6 @@
 		break;
 	}
 	
-	m_editMode = mode;
-	
 	g_win->updateEditModeActions ();
 	update ();
 }
@@ -1320,7 +1314,7 @@
 		return;
 	
 	QImage* img = new QImage (dlg.fpath ().chars ());
-	overlayMeta& info = g_overlays[camera ()];
+	overlayMeta& info = getOverlay (camera ());
 	
 	if (img->isNull ()) {
 		critical ("Failed to load overlay image!");
@@ -1329,7 +1323,7 @@
 	}
 	
 	delete info.img; // delete the old image
-		
+	
 	info.fname = dlg.fpath ();
 	info.lw = dlg.lwidth ();
 	info.lh = dlg.lheight ();
@@ -1367,21 +1361,25 @@
 	if (camera () == Free)
 		return;
 	
-	overlayMeta& info = g_overlays[camera ()];
+	overlayMeta& info = m_overlays[camera ()];
 	delete info.img;
 	info.img = null;
 }
 
 void GLRenderer::setDepthValue (double depth) {
 	assert (camera () < Free);
-	g_depthValues[camera ()] = depth;
+	m_depthValues[camera ()] = depth;
 }
 
 double GLRenderer::depthValue () const {
 	assert (camera () < Free);
-	return g_depthValues[camera ()];
+	return m_depthValues[camera ()];
 }
 
 const char* GLRenderer::cameraName () const {
 	return g_CameraNames[camera ()];
+}
+
+overlayMeta& GLRenderer::getOverlay (int newcam) {
+	 return m_overlays[newcam];
 }
\ No newline at end of file
--- a/src/gldraw.h	Fri May 24 04:34:20 2013 +0300
+++ b/src/gldraw.h	Fri May 24 15:23:56 2013 +0300
@@ -31,6 +31,20 @@
 class QSpinBox;
 class QLineEdit;
 
+enum EditMode {
+	Select,
+	Draw
+};
+
+// Meta for overlays
+struct overlayMeta {
+	vertex v0, v1;
+	ushort ox, oy;
+	double lw, lh;
+	str fname;
+	QImage* img;
+};
+
 // =============================================================================
 // GLRenderer
 // 
@@ -43,49 +57,48 @@
 	
 	PROPERTY (double, zoom, setZoom)
 	READ_PROPERTY (bool, picking)
+	CALLBACK_PROPERTY (EditMode, editMode, setEditMode)
 	
 public:
 	enum Camera { Top, Front, Left, Bottom, Back, Right, Free };
-	enum EditMode { Select, Draw };
 	enum ListType { NormalList, PickList, BFCFrontList, BFCBackList };
 	
 	GLRenderer (QWidget* parent = null);
 	~GLRenderer ();
 	
-	Camera		camera				() const { return m_camera; }
-	Axis		cameraAxis			(bool y);
-	const char*	cameraName			() const;
-	void		clearOverlay		();
-	void		compileObject		(LDObject* obj);
-	void		compileAllObjects	();
-	double		depthValue			() const;
-	EditMode	editMode			() const { return m_editMode; }
-	void		endDraw				(bool accept);
-	QColor		getMainColor		();
-	void		hardRefresh		();
-	void		refresh			();
-	void		resetAngles		();
-	uchar*		screencap			(ushort& w, ushort& h);
-	void		setBackground		();
-	void		setCamera			(const Camera cam);
-	void		setDepthValue		(double depth);
-	void		setEditMode		(const EditMode mode);
-	void		setupOverlay		();
+	Camera         camera              () const { return m_camera; }
+	Axis           cameraAxis          (bool y);
+	const char*    cameraName          () const;
+	void           clearOverlay        ();
+	void           compileObject       (LDObject* obj);
+	void           compileAllObjects   ();
+	double         depthValue          () const;
+	void           endDraw             (bool accept);
+	QColor         getMainColor        ();
+	overlayMeta&   getOverlay          (int newcam);
+	void           hardRefresh         ();
+	void           refresh             ();
+	void           resetAngles         ();
+	uchar*         screencap           (ushort& w, ushort& h);
+	void           setBackground       ();
+	void           setCamera           (const Camera cam);
+	void           setDepthValue       (double depth);
+	void           setupOverlay        ();
 	
-	static void	deleteLists			(LDObject* obj);
+	static void    deleteLists         (LDObject* obj);
 
 protected:
-	void	contextMenuEvent	(QContextMenuEvent* ev);
-	void	initializeGL		();
-	void	keyPressEvent		(QKeyEvent* ev);
-	void	keyReleaseEvent	(QKeyEvent* ev);
-	void	leaveEvent			(QEvent* ev);
-	void	mousePressEvent	(QMouseEvent* ev);
-	void	mouseMoveEvent		(QMouseEvent* ev);
-	void	mouseReleaseEvent	(QMouseEvent* ev);
-	void	paintEvent			(QPaintEvent* ev);
-	void	resizeGL			(int w, int h);
-	void	wheelEvent			(QWheelEvent* ev);
+	void           contextMenuEvent    (QContextMenuEvent* ev);
+	void           initializeGL        ();
+	void           keyPressEvent       (QKeyEvent* ev);
+	void           keyReleaseEvent     (QKeyEvent* ev);
+	void           leaveEvent          (QEvent* ev);
+	void           mousePressEvent     (QMouseEvent* ev);
+	void           mouseMoveEvent      (QMouseEvent* ev);
+	void           mouseReleaseEvent   (QMouseEvent* ev);
+	void           paintEvent          (QPaintEvent* ev);
+	void           resizeGL            (int w, int h);
+	void           wheelEvent          (QWheelEvent* ev);
 
 private:
 	QTimer* m_toolTipTimer;
@@ -100,21 +113,22 @@
 	Camera m_camera, m_toolTipCamera;
 	uint m_axeslist;
 	ushort m_width, m_height;
-	std::vector<vertex> m_drawedVerts;
-	EditMode m_editMode;
+	vector<vertex> m_drawedVerts;
 	bool m_rectdraw;
 	QColor m_bgcolor;
+	double m_depthValues[6];
+	overlayMeta m_overlays[6];
 	
-	void	calcCameraIcons	();												// Compute geometry for camera icons
-	void	clampAngle			(double& angle) const;							// Clamps an angle to [0, 360]
-	void	compileList			(LDObject* obj, const ListType list);			// Compile one of the lists of an object
-	void	compileSubObject	(LDObject* obj, const GLenum gltype);			// Sub-routine for object compiling
-	void	compileVertex		(const vertex& vrt);							// Compile a single vertex to a list
-	vertex	coordconv2_3		(const QPoint& pos2d, bool snap) const;		// Convert a 2D point to a 3D point
-	QPoint	coordconv3_2		(const vertex& pos3d) const;					// Convert a 3D point to a 2D point
-	void	drawGLScene		() const;										// Paint the GL scene
-	void	pick				(uint mouseX, uint mouseY);					// Perform object selection
-	void	setObjectColor		(LDObject* obj, const ListType list);			// Set the color to an object list
+	void           calcCameraIcons     ();                                      // Compute geometry for camera icons
+	void           clampAngle          (double& angle) const;                   // Clamps an angle to [0, 360]
+	void           compileList         (LDObject* obj, const ListType list);    // Compile one of the lists of an object
+	void           compileSubObject    (LDObject* obj, const GLenum gltype);    // Sub-routine for object compiling
+	void           compileVertex       (const vertex& vrt);                     // Compile a single vertex to a list
+	vertex         coordconv2_3        (const QPoint& pos2d, bool snap) const;  // Convert a 2D point to a 3D point
+	QPoint         coordconv3_2        (const vertex& pos3d) const;             // Convert a 3D point to a 2D point
+	void           drawGLScene         () const;                                // Paint the GL scene
+	void           pick                (uint mouseX, uint mouseY);              // Perform object selection
+	void           setObjectColor      (LDObject* obj, const ListType list);    // Set the color to an object list
 	
 private slots:
 	void	slot_toolTipTimer	();
@@ -131,17 +145,7 @@
 	GL::BFCBackList,
 };
 
-// Meta for overlays
-struct overlayMeta {
-	vertex v0, v1;
-	ushort ox, oy;
-	double lw, lh;
-	str fname;
-	QImage* img;
-};
-
 extern const GL::Camera g_Cameras[7];
 extern const char* g_CameraNames[7];
-extern overlayMeta g_overlays[6];
 
 #endif // GLDRAW_H
\ No newline at end of file
--- a/src/gui.cpp	Fri May 24 04:34:20 2013 +0300
+++ b/src/gui.cpp	Fri May 24 15:23:56 2013 +0300
@@ -285,7 +285,7 @@
 		delete recent;
 	m_recentFiles.clear ();
 	
-	std::vector<str> files = io_recentfiles.value / "@";
+	vector<str> files = io_recentfiles.value / "@";
 	for (long i = files.size() - 1; i >= 0; --i) {
 		str file = files[i];
 		
@@ -428,8 +428,8 @@
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-std::vector<quickColorMetaEntry> parseQuickColorMeta () {
-	std::vector<quickColorMetaEntry> meta;
+vector<quickColorMetaEntry> parseQuickColorMeta () {
+	vector<quickColorMetaEntry> meta;
 	
 	for (str colorname : gui_colortoolbar.value / ":") {
 		if (colorname == "|") {
@@ -552,11 +552,11 @@
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-void ForgeWindow::deleteSelection (vector<ulong>* ulapIndices, std::vector<LDObject*>* papObjects) {
+void ForgeWindow::deleteSelection (vector<ulong>* ulapIndices, vector<LDObject*>* papObjects) {
 	if (m_sel.size () == 0)
 		return;
 	
-	std::vector<LDObject*> selCopy = m_sel;
+	vector<LDObject*> selCopy = m_sel;
 	
 	// Delete the objects that were being selected
 	for (LDObject* obj : selCopy) {
@@ -726,7 +726,7 @@
 	if (m_renderer->picking ())
 		return;
 	
-	std::vector<LDObject*> priorSelection = m_sel;
+	vector<LDObject*> priorSelection = m_sel;
 	
 	// Get the objects from the object list selection
 	m_sel.clear ();	
@@ -777,8 +777,8 @@
 	if (col == null)
 		return;
 	
-	std::vector<ulong> indices;
-	std::vector<short> colors;
+	vector<ulong> indices;
+	vector<short> colors;
 	short newColor = col->index;
 	
 	for (LDObject* obj : m_sel) {
@@ -944,7 +944,7 @@
 }
 
 // ========================================================================================================================================
-DelHistory* ForgeWindow::deleteObjVector (const std::vector<LDObject*> objs) {
+DelHistory* ForgeWindow::deleteObjVector (vector<LDObject*> objs) {
 	vector<ulong> indices;
 	vector<LDObject*> cache;
 	
@@ -982,7 +982,7 @@
 
 // ========================================================================================================================================
 void ForgeWindow::updateEditModeActions () {
-	const GL::EditMode mode = R ()->editMode ();
+	const EditMode mode = R ()->editMode ();
 	const size_t numModeActions = (sizeof g_modeActionNames / sizeof *g_modeActionNames);
 	assert ((size_t) mode < numModeActions);
 	
@@ -992,7 +992,7 @@
 		act->setCheckable (true);
 		act->setChecked (i == (size_t) mode);
 		
-		if (i != GL::Select)
+		if (i != Select)
 			act->setEnabled (R ()->camera () != GL::Free);
 	}
 }
--- a/src/gui.h	Fri May 24 04:34:20 2013 +0300
+++ b/src/gui.h	Fri May 24 15:23:56 2013 +0300
@@ -109,7 +109,7 @@
 	void fullRefresh ();
 	void refresh ();
 	ulong getInsertionPoint ();
-	void deleteSelection (vector<ulong>* ulapIndices, std::vector<LDObject*>* papObjects);
+	void deleteSelection (vector<ulong>* ulapIndices, vector<LDObject*>* papObjects);
 	void updateToolBars ();
 	void updateRecentFilesMenu ();
 	void updateSelection ();
@@ -120,12 +120,12 @@
 	LDObject::Type uniformSelectedType ();
 	void scrollToSelection ();
 	void spawnContextMenu (const QPoint pos);
-	DelHistory* deleteObjVector (const std::vector<LDObject*> objs);
+	DelHistory* deleteObjVector (vector<LDObject*> objs);
 	DelHistory* deleteSelection ();
 	DelHistory* deleteByColor (const short colnum);
 	GLRenderer* R () { return m_renderer; }
-	std::vector<LDObject*>& sel () { return m_sel; }
-	void setQuickColorMeta (std::vector<quickColorMetaEntry>& quickColorMeta) {
+	vector<LDObject*>& sel () { return m_sel; }
+	void setQuickColorMeta (vector<quickColorMetaEntry>& quickColorMeta) {
 		m_colorMeta = quickColorMeta;
 	}
 	void setStatusBarText (str text);
@@ -145,11 +145,11 @@
 	QSplitter* m_splitter;
 	str m_msglogHTML;
 	QToolBar* m_colorToolBar;
-	std::vector<QToolBar*> m_toolBars;
-	std::vector<LDObject*> m_sel;
-	std::vector<quickColorMetaEntry> m_colorMeta;
-	std::vector<QToolButton*> m_colorButtons;
-	std::vector<QAction*> m_recentFiles;
+	vector<QToolBar*> m_toolBars;
+	vector<LDObject*> m_sel;
+	vector<quickColorMetaEntry> m_colorMeta;
+	vector<QToolButton*> m_colorButtons;
+	vector<QAction*> m_recentFiles;
 	
 	void createMenuActions ();
 	void createMenus ();
@@ -171,7 +171,7 @@
 // -----------------------------------------------------------------------------
 // Other GUI-related stuff not directly part of ForgeWindow:
 QPixmap getIcon (const char* sIconName);
-std::vector<quickColorMetaEntry> parseQuickColorMeta ();
+vector<quickColorMetaEntry> parseQuickColorMeta ();
 bool confirm (str title, str msg);
 bool confirm (str msg);
 void critical (str msg);
--- a/src/gui_actions.cpp	Fri May 24 04:34:20 2013 +0300
+++ b/src/gui_actions.cpp	Fri May 24 15:23:56 2013 +0300
@@ -310,9 +310,9 @@
 		return;
 	}
 	
-	std::vector<LDObject*> historyCopies;
-	std::vector<ulong> historyIndices;
-	std::vector<LDObject*> objs = loadFileContents (fp, null);
+	vector<LDObject*> historyCopies;
+	vector<ulong> historyIndices;
+	vector<LDObject*> objs = loadFileContents (fp, null);
 	
 	g_win->sel ().clear ();
 	
@@ -342,8 +342,8 @@
 	QVBoxLayout* const layout = new QVBoxLayout;
 	QTextEdit* const te_edit = new QTextEdit;
 	QDialogButtonBox* const bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
-	std::vector<LDObject*> historyCopies;
-	std::vector<ulong> historyIndices;
+	vector<LDObject*> historyCopies;
+	vector<ulong> historyIndices;
 	
 	layout->addWidget (te_edit);
 	layout->addWidget (bbx_buttons);
@@ -430,11 +430,11 @@
 
 // =========================================================================================================================================
 MAKE_ACTION (modeSelect, "Select Mode", "mode-select", "Select objects from the camera view.", CTRL (1)) {
-	g_win->R ()->setEditMode (GL::Select);
+	g_win->R ()->setEditMode (Select);
 }
 
 MAKE_ACTION (modeDraw, "Draw Mode", "mode-draw", "Draw objects into the camera view.", CTRL (2)) {
-	g_win->R ()->setEditMode (GL::Draw);
+	g_win->R ()->setEditMode (Draw);
 }
 
 // =========================================================================================================================================
--- a/src/gui_editactions.cpp	Fri May 24 04:34:20 2013 +0300
+++ b/src/gui_editactions.cpp	Fri May 24 15:23:56 2013 +0300
@@ -261,7 +261,7 @@
 		if (lIndex == -1)
 			return;
 		
-		std::vector<LDTriangle*> triangles = static_cast<LDQuad*> (obj)->splitToTriangles ();
+		vector<LDTriangle*> triangles = static_cast<LDQuad*> (obj)->splitToTriangles ();
 		
 		// Replace the quad with the first triangle and add the second triangle
 		// after the first one.
@@ -317,7 +317,7 @@
 	short colnum;
 	short defcol = -1;
 	
-	std::vector<LDObject*> objs = g_win->sel ();
+	vector<LDObject*> objs = g_win->sel ();
 	
 	// If all selected objects have the same color, said color is our default
 	// value to the color selection dialog.
@@ -325,8 +325,8 @@
 	
 	// Show the dialog to the user now and ask for a color.
 	if (ColorSelectDialog::staticDialog (colnum, defcol, g_win)) {
-		std::vector<ulong> indices;
-		std::vector<short> colornums;
+		vector<ulong> indices;
+		vector<short> colornums;
 		
 		for (LDObject* obj : objs) {
 			if (obj->isColored () == false)
@@ -522,7 +522,7 @@
 // History.
 // =============================================================================
 MAKE_ACTION (invert, "Invert", "invert", "Reverse the winding of given objects.", CTRL_SHIFT (W)) {
-	std::vector<LDObject*> sel = g_win->sel ();
+	vector<LDObject*> sel = g_win->sel ();
 	ComboHistory* history = new ComboHistory;
 	
 	for (LDObject* obj : sel) {
@@ -541,9 +541,9 @@
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
 static void doRotate (const short l, const short m, const short n) {
-	std::vector<LDObject*> sel = g_win->sel ();
+	vector<LDObject*> sel = g_win->sel ();
 	vertex origin;
-	std::vector<vertex*> queue;
+	vector<vertex*> queue;
 	const double angle = (pi * currentGrid ().confs[Grid::Angle]->value) / 180;
 	
 	// ref: http://en.wikipedia.org/wiki/Transformation_matrix#Rotation_2
--- a/src/history.cpp	Fri May 24 04:34:20 2013 +0300
+++ b/src/history.cpp	Fri May 24 15:23:56 2013 +0300
@@ -29,7 +29,7 @@
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
 namespace History {
-	std::vector<HistoryEntry*> s_entries;
+	vector<HistoryEntry*> s_entries;
 	static long s_pos = -1;
 	
 	// =========================================================================
@@ -38,7 +38,7 @@
 		// remove them now
 		for (ulong i = s_pos + 1; i < s_entries.size(); ++i) {
 			delete s_entries[i];
-			s_entries.erase (s_entries.begin() + i);
+			s_entries.erase (i);
 		}
 		
 		s_entries.push_back (entry);
@@ -96,7 +96,7 @@
 	}
 	
 	// =========================================================================
-	std::vector<HistoryEntry*>& entries () {
+	vector<HistoryEntry*>& entries () {
 		return s_entries;
 	}
 }
@@ -191,8 +191,8 @@
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-std::vector<LDObject*> ListMoveHistory::getObjects (short ofs) {
-	std::vector<LDObject*> objs;
+vector<LDObject*> ListMoveHistory::getObjects (short ofs) {
+	vector<LDObject*> objs;
 	
 	for (ulong idx : ulaIndices)
 		objs.push_back (g_curfile->object (idx + ofs));
@@ -201,13 +201,13 @@
 }
 
 void ListMoveHistory::undo () {
-	std::vector<LDObject*> objs = getObjects (bUp ? -1 : 1);
+	vector<LDObject*> objs = getObjects (bUp ? -1 : 1);
 	LDObject::moveObjects (objs, !bUp);
 	g_win->buildObjList ();
 }
 
 void ListMoveHistory::redo () {
-	std::vector<LDObject*> objs = getObjects (0);
+	vector<LDObject*> objs = getObjects (0);
 	LDObject::moveObjects (objs, bUp);
 	g_win->buildObjList ();
 }
@@ -277,7 +277,7 @@
 		ulong idx = ulaIndices[i];
 		
 		LDQuad* pQuad = static_cast<LDQuad*> (g_curfile->object (idx));
-		std::vector<LDTriangle*> paTriangles = pQuad->splitToTriangles ();
+		vector<LDTriangle*> paTriangles = pQuad->splitToTriangles ();
 		
 		g_curfile->setObject (idx, paTriangles[0]);
 		g_curfile->insertObj (idx + 1, paTriangles[1]);
@@ -324,7 +324,7 @@
 }
 
 InlineHistory::~InlineHistory () {
-	for (LDSubfile* ref : paRefs)
+	for (LDSubfile* const ref : paRefs)
 		delete ref;
 }
 
@@ -336,13 +336,13 @@
 void MoveHistory::undo () {
 	const vertex vInverse = -vVector;
 	
-	for (ulong i : ulaIndices)
+	for (const ulong& i : ulaIndices)
 		g_curfile->object (i)->move (vInverse);
 	g_win->fullRefresh ();
 }
 
 void MoveHistory::redo () {
-	for (ulong i : ulaIndices)
+	for (const ulong& i : ulaIndices)
 		g_curfile->object (i)->move (vVector);
 	g_win->fullRefresh ();
 }
--- a/src/history.h	Fri May 24 04:34:20 2013 +0300
+++ b/src/history.h	Fri May 24 15:23:56 2013 +0300
@@ -94,12 +94,12 @@
 public:
 	IMPLEMENT_HISTORY_TYPE (Edit)
 	
-	std::vector<ulong> ulaIndices;
-	std::vector<LDObject*> paOldObjs, paNewObjs;
+	vector<ulong> ulaIndices;
+	vector<LDObject*> paOldObjs, paNewObjs;
 	
 	EditHistory () {}
-	EditHistory (std::vector<ulong> ulaIndices, std::vector<LDObject*> paOldObjs,
-		std::vector<LDObject*> paNewObjs) :
+	EditHistory (vector<ulong> ulaIndices, vector<LDObject*> paOldObjs,
+		vector<LDObject*> paNewObjs) :
 		ulaIndices (ulaIndices), paOldObjs (paOldObjs), paNewObjs (paNewObjs) {}
 	
 	void	addEntry		(LDObject* const oldObj, LDObject* const newObj);
@@ -114,10 +114,10 @@
 public:
 	IMPLEMENT_HISTORY_TYPE (ListMove)
 	
-	std::vector<ulong> ulaIndices;
+	vector<ulong> ulaIndices;
 	bool bUp;
 	
-	std::vector<LDObject*> getObjects (short ofs);
+	vector<LDObject*> getObjects (short ofs);
 	ListMoveHistory (vector<ulong> ulaIndices, const bool bUp) :
 		ulaIndices (ulaIndices), bUp (bUp) {}
 };
@@ -134,11 +134,11 @@
 	
 	IMPLEMENT_HISTORY_TYPE (Add)
 	
-	std::vector<ulong> ulaIndices;
-	std::vector<LDObject*> paObjs;
+	vector<ulong> ulaIndices;
+	vector<LDObject*> paObjs;
 	const Type eType;
 	
-	AddHistory (std::vector<ulong> ulaIndices, std::vector<LDObject*> paObjs,
+	AddHistory (vector<ulong> ulaIndices, vector<LDObject*> paObjs,
 		const Type eType = Other) :
 		ulaIndices (ulaIndices), paObjs (paObjs), eType (eType) {}
 };
@@ -150,10 +150,10 @@
 public:
 	IMPLEMENT_HISTORY_TYPE (QuadSplit)
 	
-	std::vector<ulong> ulaIndices;
-	std::vector<LDQuad*> paQuads;
+	vector<ulong> ulaIndices;
+	vector<LDQuad*> paQuads;
 	
-	QuadSplitHistory (std::vector<ulong> ulaIndices, std::vector<LDQuad*> paQuads) :
+	QuadSplitHistory (vector<ulong> ulaIndices, vector<LDQuad*> paQuads) :
 		ulaIndices (ulaIndices), paQuads (paQuads) {}
 };
 
@@ -164,12 +164,12 @@
 public:
 	IMPLEMENT_HISTORY_TYPE (Inline)
 	
-	const std::vector<ulong> ulaBitIndices, ulaRefIndices;
-	const std::vector<LDSubfile*> paRefs;
+	const vector<ulong> ulaBitIndices, ulaRefIndices;
+	const vector<LDSubfile*> paRefs;
 	const bool bDeep;
 	
-	InlineHistory (const std::vector<ulong> ulaBitIndices, const std::vector<ulong> ulaRefIndices,
-		const std::vector<LDSubfile*> paRefs, const bool bDeep) :
+	InlineHistory (const vector<ulong> ulaBitIndices, const vector<ulong> ulaRefIndices,
+		const vector<LDSubfile*> paRefs, const bool bDeep) :
 		ulaBitIndices (ulaBitIndices), ulaRefIndices (ulaRefIndices), paRefs (paRefs), bDeep (bDeep) {}
 };
 
@@ -180,10 +180,10 @@
 public:
 	IMPLEMENT_HISTORY_TYPE (Move)
 	
-	const std::vector<ulong> ulaIndices;
+	const vector<ulong> ulaIndices;
 	const vertex vVector;
 	
-	MoveHistory (const std::vector<ulong> ulaIndices, const vertex vVector) :
+	MoveHistory (const vector<ulong> ulaIndices, const vertex vVector) :
 		ulaIndices (ulaIndices), vVector (vVector) {}
 };
 
@@ -194,12 +194,12 @@
 public:
 	IMPLEMENT_HISTORY_TYPE (Combo)
 	
-	std::vector<HistoryEntry*> paEntries;
+	vector<HistoryEntry*> paEntries;
 	
 	ComboHistory () {}
-	ComboHistory (std::vector<HistoryEntry*> paEntries) : paEntries (paEntries) {}
+	ComboHistory (vector<HistoryEntry*> paEntries) : paEntries (paEntries) {}
 	
-	void			addEntry		(HistoryEntry* entry) { if (entry) paEntries.push_back (entry); }
+	void			addEntry		(HistoryEntry* entry) { if (entry) paEntries << entry; }
 	ulong			numEntries		() const { return paEntries.size (); }
 	ComboHistory&	operator<<		(HistoryEntry* entry) { addEntry (entry); return *this;}
 };
@@ -214,7 +214,7 @@
 	void clear ();
 	void updateActions ();
 	long pos ();
-	std::vector<HistoryEntry*>& entries ();
+	vector<HistoryEntry*>& entries ();
 };
 
 #endif // HISTORY_H
\ No newline at end of file
--- a/src/ldtypes.cpp	Fri May 24 04:34:20 2013 +0300
+++ b/src/ldtypes.cpp	Fri May 24 15:23:56 2013 +0300
@@ -216,7 +216,7 @@
 	// Remove this object from the selection array if it is there.
 	for (ulong i = 0; i < g_win->sel ().size(); ++i)
 		if (g_win->sel ()[i] == this)
-			g_win->sel ().erase (g_win->sel ().begin() + i);
+			g_win->sel ().erase (i);
 	
 	// Delete the GL lists
 	GL::deleteLists (this);
@@ -339,7 +339,7 @@
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-void LDObject::moveObjects (std::vector<LDObject*> objs, const bool bUp) {
+void LDObject::moveObjects (vector<LDObject*> objs, const bool bUp) {
 	// If we move down, we need to iterate the array in reverse order.
 	const long start = bUp ? 0 : (objs.size() - 1);
 	const long end = bUp ? objs.size() : -1;
@@ -378,7 +378,7 @@
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-str LDObject::objectListContents (const std::vector<LDObject*>& objs) {
+str LDObject::objectListContents (const vector<LDObject*>& objs) {
 	bool firstDetails = true;
 	str text = "";
 	
@@ -512,8 +512,8 @@
 // =============================================================================
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
-std::vector<LDObject*> LDRadial::decompose (bool applyTransform) {
-	std::vector<LDObject*> paObjects;
+vector<LDObject*> LDRadial::decompose (bool applyTransform) {
+	vector<LDObject*> paObjects;
 	
 	for (short i = 0; i < segs; ++i) {
 		double x0 = cos ((i * 2 * pi) / divs),
--- a/src/ldtypes.h	Fri May 24 04:34:20 2013 +0300
+++ b/src/ldtypes.h	Fri May 24 15:23:56 2013 +0300
@@ -157,8 +157,8 @@
 	// Returns a sample object by the given value
 	static LDObject* getDefault (const LDObject::Type type);
 	
-	static void moveObjects (std::vector<LDObject*> objs, const bool bUp);
-	static str objectListContents (const std::vector<LDObject*>& objs);
+	static void moveObjects (vector<LDObject*> objs, const bool bUp);
+	static str objectListContents (const vector<LDObject*>& objs);
 	
 	// Object list entry for this object
 	QListWidgetItem* qObjListEntry;
@@ -273,7 +273,7 @@
 	
 	// Inlines this subfile. Note that return type is an array of heap-allocated
 	// LDObject-clones, they must be deleted one way or another.
-	std::vector<LDObject*> inlineContents (bool deep, bool cache);
+	vector<LDObject*> inlineContents (bool deep, bool cache);
 };
 
 // =============================================================================
@@ -405,7 +405,7 @@
 	
 	// Returns a set of objects that provide the equivalent of this radial.
 	// Note: objects are heap-allocated.
-	std::vector<LDObject*> decompose (bool applyTransform);
+	vector<LDObject*> decompose (bool applyTransform);
 	
 	// Compose a file name for this radial.
 	str makeFileName ();
--- a/src/misc.h	Fri May 24 04:34:20 2013 +0300
+++ b/src/misc.h	Fri May 24 15:23:56 2013 +0300
@@ -108,7 +108,7 @@
 	}
 	
 private:
-	std::vector<str> m_tokens;
+	vector<str> m_tokens;
 	short m_pos;
 };
 
--- a/src/string.cpp	Fri May 24 04:34:20 2013 +0300
+++ b/src/string.cpp	Fri May 24 15:23:56 2013 +0300
@@ -107,7 +107,7 @@
 }
 
 vector<String> String::split (String del) const {
-	std::vector<String> res;
+	vector<String> res;
 	size_t a = 0;
 	
 	// Find all separators and store the text left to them.
--- a/src/string.h	Fri May 24 04:34:20 2013 +0300
+++ b/src/string.h	Fri May 24 15:23:56 2013 +0300
@@ -22,8 +22,7 @@
 #include <string>
 #include <stdarg.h>
 #include <QString>
-
-using std::vector;
+#include "types.h"
 
 // =========================================================================================================================================
 char* dynafmt (const char* fmtstr, va_list va, ulong size);
--- a/src/types.h	Fri May 24 04:34:20 2013 +0300
+++ b/src/types.h	Fri May 24 15:23:56 2013 +0300
@@ -19,8 +19,11 @@
 #ifndef TYPES_H
 #define TYPES_H
 
+#include <vector>
 #include "common.h"
 
+class String;
+typedef String str;
 typedef unsigned int uint;
 typedef unsigned short ushort;
 typedef unsigned long ulong;
@@ -36,7 +39,6 @@
 typedef uint64_t uint64;
 
 template<class T> using initlist = std::initializer_list<T>;
-using std::vector;
 
 enum Axis { X, Y, Z };
 static const Axis g_Axes[3] = {X, Y, Z};
@@ -113,4 +115,104 @@
 	double m_coords[3];
 };
 
+
+// =============================================================================
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+// =============================================================================
+// vector
+// 
+// Array class that wraps around vector
+// =============================================================================
+template<class T> class vector {
+public:
+	typedef typename std::vector<T>::iterator it;
+	typedef typename std::vector<T>::const_iterator c_it;
+	
+	vector () {}
+	vector (initlist<T> vals) {
+		m_vect = vals;
+	}
+	
+	it begin () {
+		return m_vect.begin ();
+	}
+	
+	c_it begin () const {
+		return m_vect.cbegin ();
+	}
+	
+	it end () {
+		return m_vect.end ();
+	}
+	
+	c_it end () const {
+		return m_vect.cend ();
+	}
+	
+	void erase (ulong pos) {
+		assert (pos < size ());
+		m_vect.erase (m_vect.begin () + pos);
+	}
+	
+	void push_back (const T& value) {
+		m_vect.push_back (value);
+	}
+	
+	bool pop (T& val) {
+		if (size () == 0)
+			return false;
+		
+		val = m_vect[size () - 1];
+		erase (size () - 1);
+		return true;
+	}
+	
+	vector<T>& operator<< (const T& value) {
+		push_back (value);
+		return *this;
+	}
+	
+	bool operator>> (T& value) {
+		return pop (value);
+	}
+	
+	vector<T> reverse () const {
+		vector<T> rev;
+		
+		for (const T& val : m_vect)
+			rev << val;
+		
+		return rev;
+	}
+	
+	void clear () {
+		m_vect.clear ();
+	}
+	
+	void insert (ulong pos, const T& value) {
+		m_vect.insert (m_vect.begin () + pos, value);
+	}
+	
+	ulong size () const {
+		return m_vect.size ();
+	}
+	
+	T& operator[] (ulong n) {
+		assert (n < size ());
+		return m_vect[n];
+	}
+	
+	const T& operator[] (ulong n) const {
+		assert (n < size ());
+		return m_vect[n];
+	}
+	
+	void resize (std::ptrdiff_t size) {
+		m_vect.resize (size);
+	}
+	
+private:
+	std::vector<T> m_vect;
+};
+
 #endif // TYPES_H
\ No newline at end of file
--- a/src/widgets.cpp	Fri May 24 04:34:20 2013 +0300
+++ b/src/widgets.cpp	Fri May 24 15:23:56 2013 +0300
@@ -127,11 +127,11 @@
 		emit valueChanged (newid);
 }
 
-RadioBox::iter RadioBox::begin() {
+RadioBox::it RadioBox::begin() {
 	 return m_objects.begin ();
 }
 
-RadioBox::iter RadioBox::end() {
+RadioBox::it RadioBox::end() {
 	return m_objects.end ();
 }
 
@@ -154,8 +154,8 @@
 	connect (box, SIGNAL (stateChanged (int)), this, SLOT (buttonChanged ()));
 }
 
-std::vector<int> CheckBoxGroup::checkedValues () const {
-	std::vector<int> vals;
+vector<int> CheckBoxGroup::checkedValues () const {
+	vector<int> vals;
 	
 	for (const auto& kv : m_vals)
 		if (kv.second->isChecked ())
--- a/src/widgets.h	Fri May 24 04:34:20 2013 +0300
+++ b/src/widgets.h	Fri May 24 15:23:56 2013 +0300
@@ -38,7 +38,7 @@
 	Q_OBJECT
 	
 public:
-	typedef std::vector<QRadioButton*>::iterator iter;
+	typedef vector<QRadioButton*>::it it;
 	
 	explicit RadioBox (QWidget* parent = null) : QGroupBox (parent) { init (Qt::Vertical); }
 	explicit RadioBox () { init (Qt::Vertical); }
@@ -48,8 +48,8 @@
 	
 	void			addButton		(const char* entry);
 	void			addButton		(QRadioButton* button);
-	iter			begin			();
-	iter			end				();
+	it				begin			();
+	it				end				();
 	void			init			(Qt::Orientation orient);
 	bool			isChecked		(int n) const;
 	void			rowBreak		();
@@ -67,8 +67,8 @@
 	void valueChanged (int val);
 
 private:
-	std::vector<QRadioButton*> m_objects;
-	std::vector<QBoxLayout*> m_layouts;
+	vector<QRadioButton*> m_objects;
+	vector<QBoxLayout*> m_layouts;
 	QBoxLayout* m_coreLayout;
 	QBoxLayout* m_currentLayout;
 	bool m_vert;

mercurial