- added "Go to line" action, renamed the config classes to proper camelcase

Tue, 20 Aug 2013 14:47:21 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Tue, 20 Aug 2013 14:47:21 +0300
changeset 461
fbcc91ae1dd2
parent 460
b230ae09c8e5
child 462
55173a35eea5

- added "Go to line" action, renamed the config classes to proper camelcase

changelog.txt file | annotate | diff | comparison | revisions
src/actions.h file | annotate | diff | comparison | revisions
src/colorSelectDialog.cpp file | annotate | diff | comparison | revisions
src/config.cpp file | annotate | diff | comparison | revisions
src/config.h file | annotate | diff | comparison | revisions
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/download.cpp file | annotate | diff | comparison | revisions
src/extprogs.cpp file | annotate | diff | comparison | revisions
src/file.cpp file | annotate | diff | comparison | revisions
src/gldraw.cpp 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/main.cpp file | annotate | diff | comparison | revisions
src/misc.cpp file | annotate | diff | comparison | revisions
src/misc.h file | annotate | diff | comparison | revisions
src/primitives.cpp file | annotate | diff | comparison | revisions
src/types.cpp file | annotate | diff | comparison | revisions
src/types.h file | annotate | diff | comparison | revisions
src/ui/ldforge.ui file | annotate | diff | comparison | revisions
--- a/changelog.txt	Sun Aug 18 17:53:23 2013 +0300
+++ b/changelog.txt	Tue Aug 20 14:47:21 2013 +0300
@@ -13,6 +13,7 @@
 	- Fixed: Checking the Hi-Res option would not allow segment values over 16.
 	- Added support for multiple spaces before the ring number.
 - Added new action "Add History Line" for quickly inserting 0 !HISTORY lines to headers
+- Added new action "Go to line", default shortcut Ctrl-G. It should be obvious what it does.
 - Added support for logoed studs, this should satisfy Steffen. :p
 - Added support for '0 BFC CLIP' and '0 BFC NOCLIP' and added auto-correction from errorneous MLCAD
 	syntax ('0 BFC CERTIFY CLIP').
--- a/src/actions.h	Sun Aug 18 17:53:23 2013 +0300
+++ b/src/actions.h	Tue Aug 20 14:47:21 2013 +0300
@@ -104,5 +104,6 @@
 act (RotateZPos)
 act (RotationPoint)
 act (AddHistoryLine)
+act (JumpTo)
 
 #undef act
\ No newline at end of file
--- a/src/colorSelectDialog.cpp	Sun Aug 18 17:53:23 2013 +0300
+++ b/src/colorSelectDialog.cpp	Tue Aug 20 14:47:21 2013 +0300
@@ -33,8 +33,8 @@
 static const int g_numColumns = 16;
 static const short g_squareSize = 32;
 
-extern_cfg (str, gl_maincolor);
-extern_cfg (float, gl_maincolor_alpha);
+extern_cfg (String, gl_maincolor);
+extern_cfg (Float, gl_maincolor_alpha);
 
 // =============================================================================
 // -----------------------------------------------------------------------------
--- a/src/config.cpp	Sun Aug 18 17:53:23 2013 +0300
+++ b/src/config.cpp	Tue Aug 20 14:47:21 2013 +0300
@@ -26,7 +26,7 @@
 #include "gui.h"
 #include "file.h"
 
-config* g_configPointers[MAX_CONFIG];
+Config* g_configPointers[MAX_CONFIG];
 static ushort g_cfgPointerCursor = 0;
 
 // =============================================================================
@@ -47,11 +47,11 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 // Load the configuration from file
-bool config::load() {
+bool Config::load() {
 	QSettings* settings = getSettingsObject();
 	print ("config::load: Loading configuration file from %1...\n", settings->fileName());
 	
-	for (config* cfg : g_configPointers) {
+	for (Config* cfg : g_configPointers) {
 		if (!cfg)
 			break;
 		
@@ -64,62 +64,62 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void intconfig::loadFromConfig (const QSettings* cfg) {
+void IntConfig::loadFromConfig (const QSettings* cfg) {
 	QVariant val = cfg->value (name, str::number (defval));
 	value = val.toInt();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void floatconfig::loadFromConfig (const QSettings* cfg) {
+void FloatConfig::loadFromConfig (const QSettings* cfg) {
 	QVariant val = cfg->value (name, str::number (defval));
 	value = val.toFloat();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void strconfig::loadFromConfig (const QSettings* cfg) {
+void StringConfig::loadFromConfig (const QSettings* cfg) {
 	QVariant val = cfg->value (name, defval);
 	value = val.toString();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void boolconfig::loadFromConfig (const QSettings* cfg) {
+void BoolConfig::loadFromConfig (const QSettings* cfg) {
 	QVariant val = cfg->value (name, str::number (defval));
 	value = val.toBool();
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void keyseqconfig::loadFromConfig (const QSettings* cfg) {
+void KeySequenceConfig::loadFromConfig (const QSettings* cfg) {
 	QVariant val = cfg->value (name, defval.toString());
-	value = keyseq (val.toString());
+	value = QKeySequence (val.toString());
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
 // TODO: make virtual
-str config::toString() const {
+str Config::toString() const {
 	switch (getType()) {
-	case Type_int:
-		return fmt ("%1", static_cast<const intconfig*> (this)->value);
+	case Int:
+		return fmt ("%1", static_cast<const IntConfig*> (this)->value);
 		break;
 	
-	case Type_str:
-		return static_cast<const strconfig*> (this)->value;
+	case String:
+		return static_cast<const StringConfig*> (this)->value;
 		break;
 	
-	case Type_float:
-		return fmt ("%1", static_cast<const floatconfig*> (this)->value);
+	case Float:
+		return fmt ("%1", static_cast<const FloatConfig*> (this)->value);
 		break;
 	
-	case Type_bool:
-		return (static_cast<const boolconfig*> (this)->value) ? "true" : "false";
+	case Bool:
+		return (static_cast<const BoolConfig*> (this)->value) ? "true" : "false";
 		break;
 	
-	case Type_keyseq:
-		return static_cast<const keyseqconfig*> (this)->value.toString();
+	case KeySequence:
+		return static_cast<const KeySequenceConfig*> (this)->value.toString();
 		break;
 	
 	default:
@@ -132,11 +132,11 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 // Save the configuration to disk
-bool config::save() {
+bool Config::save() {
 	QSettings* settings = getSettingsObject();
 	print ("Saving configuration to %1...\n", settings->fileName());
 	
-	for (config* cfg : g_configPointers) {
+	for (Config* cfg : g_configPointers) {
 		if (!cfg)
 			break;
 		
@@ -150,8 +150,8 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void config::reset() {
-	for (config* cfg : g_configPointers) {
+void Config::reset() {
+	for (Config* cfg : g_configPointers) {
 		if (!cfg)
 			break;
 		
@@ -161,25 +161,25 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-str config::filepath (str file) {
-	return config::dirpath() + DIRSLASH + file;
+str Config::filepath (str file) {
+	return Config::dirpath() + DIRSLASH + file;
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-str config::dirpath() {
+str Config::dirpath() {
 	QSettings* cfg = getSettingsObject();
 	return dirname (cfg->fileName());
 }
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-str config::defaultString() const {
+str Config::defaultString() const {
 	str defstring = m_defstring;
 	
 	// String types inevitably get extra quotes in their default string due to
 	// preprocessing stuff. We can only remove them now...
-	if (getType() == Type_str) {
+	if (getType() == String) {
 		defstring.remove (0, 1);
 		defstring.chop (1);
 	}
@@ -189,7 +189,7 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void addConfig (config* ptr) {
+void addConfig (Config* ptr) {
 	if (g_cfgPointerCursor == 0)
 		memset (g_configPointers, 0, sizeof g_configPointers);
 	
--- a/src/config.h	Sun Aug 18 17:53:23 2013 +0300
+++ b/src/config.h	Tue Aug 20 14:47:21 2013 +0300
@@ -32,26 +32,27 @@
 #define MAX_INI_LINE 512
 #define MAX_CONFIG 512
 
-#define cfg(T, NAME, DEFAULT) T##config NAME (DEFAULT, #NAME, #DEFAULT)
-#define extern_cfg(T, NAME)   extern T##config NAME
+#define cfg(T, NAME, DEFAULT) T##Config NAME (DEFAULT, #NAME, #DEFAULT)
+#define extern_cfg(T, NAME)   extern T##Config NAME
 
 // =========================================================
-class config {
+class Config {
 public:
 	enum Type {
-		Type_none,
-		Type_int,
-		Type_str,
-		Type_float,
-		Type_bool,
-		Type_keyseq,
+		None,
+		Int,
+		String,
+		Float,
+		Bool,
+		KeySequence,
 	};
 
-	config (const char* defstring) : m_defstring (defstring) {}
+	Config (const char* name, const char* defstring) :
+		name (name), m_defstring (defstring) {}
 	const char* name;
 
 	virtual Type getType() const {
-		return Type_none;
+		return None;
 	}
 	
 	str toString() const;
@@ -71,34 +72,34 @@
 	const char* m_defstring;
 };
 
-void addConfig (config* ptr);
+void addConfig (Config* ptr);
 
 // =============================================================================
 #define DEFINE_UNARY_OPERATOR(T, OP) \
 	T operator OP() { \
 		return OP value; \
-	} \
-	 
+	}
+	
 #define DEFINE_BINARY_OPERATOR(T, OP) \
 	T operator OP (const T other) { \
 		return value OP other; \
-	} \
-	 
+	}
+	
 #define DEFINE_ASSIGN_OPERATOR(T, OP) \
 	T& operator OP (const T other) { \
 		return value OP other; \
-	} \
-	 
+	}
+	
 #define DEFINE_COMPARE_OPERATOR(T, OP) \
 	bool operator OP (const T other) { \
 		return value OP other; \
-	} \
-	 
+	}
+	
 #define DEFINE_CAST_OPERATOR(T) \
 	operator T() { \
 		return (T) value; \
-	} \
-	 
+	}
+	
 #define DEFINE_ALL_COMPARE_OPERATORS(T) \
 	DEFINE_COMPARE_OPERATOR (T, ==) \
 	DEFINE_COMPARE_OPERATOR (T, !=) \
@@ -114,34 +115,24 @@
 	T operator--(int) { return value--; }
 
 #define CONFIGTYPE(T) \
-	class T##config : public config
+	class T##Config : public Config
 
-#define IMPLEMENT_CONFIG(T) \
+#define IMPLEMENT_CONFIG(NAME, T) \
 	T value, defval; \
+	NAME##Config (T defval, const char* name, const char* defstring) : \
+		Config (name, defstring), value (defval), defval (defval) \
+		{ addConfig (this); } \
 	\
-	T##config (T _defval, const char* _name, const char* defstring) : config (defstring) { \
-		value = defval = _defval; \
-		name = _name; \
-		addConfig (this); \
-	} \
-	operator const T&() const { \
-		return value; \
-	} \
-	config::Type getType() const override { \
-		return config::Type_##T; \
-	} \
-	virtual void resetValue() { \
-		value = defval; \
-	} \
-	virtual bool isDefault() const { \
-		return value == defval; \
-	} \
+	operator const T&() const { return value; } \
+	Config::Type getType() const override { return Config::NAME; } \
+	virtual void resetValue() { value = defval; } \
+	virtual bool isDefault() const { return value == defval; } \
 	virtual void loadFromConfig (const QSettings* cfg) override;
 
 // =============================================================================
-CONFIGTYPE (int) {
+CONFIGTYPE (Int) {
 public:
-	IMPLEMENT_CONFIG (int)
+	IMPLEMENT_CONFIG (Int, int)
 	DEFINE_ALL_COMPARE_OPERATORS (int)
 	DEFINE_INCREMENT_OPERATORS (int)
 	DEFINE_BINARY_OPERATOR (int, +)
@@ -169,9 +160,9 @@
 };
 
 // =============================================================================
-CONFIGTYPE (str) {
+CONFIGTYPE (String) {
 public:
-	IMPLEMENT_CONFIG (str)
+	IMPLEMENT_CONFIG (String, str)
 
 	DEFINE_COMPARE_OPERATOR (str, ==)
 	DEFINE_COMPARE_OPERATOR (str, !=)
@@ -184,9 +175,9 @@
 };
 
 // =============================================================================
-CONFIGTYPE (float) {
+CONFIGTYPE (Float) {
 public:
-	IMPLEMENT_CONFIG (float)
+	IMPLEMENT_CONFIG (Float, float)
 	DEFINE_ALL_COMPARE_OPERATORS (float)
 	DEFINE_INCREMENT_OPERATORS (float)
 	DEFINE_BINARY_OPERATOR (float, +)
@@ -200,21 +191,19 @@
 };
 
 // =============================================================================
-CONFIGTYPE (bool) {
+CONFIGTYPE (Bool) {
 public:
-	IMPLEMENT_CONFIG (bool)
+	IMPLEMENT_CONFIG (Bool, bool)
 	DEFINE_ALL_COMPARE_OPERATORS (bool)
 	DEFINE_ASSIGN_OPERATOR (bool, =)
 };
 
 // =============================================================================
-typedef QKeySequence keyseq;
-
-CONFIGTYPE (keyseq) {
+CONFIGTYPE (KeySequence) {
 public:
-	IMPLEMENT_CONFIG (keyseq)
-	DEFINE_ALL_COMPARE_OPERATORS (keyseq)
-	DEFINE_ASSIGN_OPERATOR (keyseq, =)
+	IMPLEMENT_CONFIG (KeySequence, QKeySequence)
+	DEFINE_ALL_COMPARE_OPERATORS (QKeySequence)
+	DEFINE_ASSIGN_OPERATOR (QKeySequence, =)
 };
 
 #endif // CONFIG_H
\ No newline at end of file
--- a/src/configDialog.cpp	Sun Aug 18 17:53:23 2013 +0300
+++ b/src/configDialog.cpp	Tue Aug 20 14:47:21 2013 +0300
@@ -37,33 +37,33 @@
 #include "ui_config.h"
 #include "build/moc_configDialog.cpp"
 
-extern_cfg (str, gl_bgcolor);
-extern_cfg (str, gl_maincolor);
-extern_cfg (bool, lv_colorize);
-extern_cfg (bool, gl_colorbfc);
-extern_cfg (float, gl_maincolor_alpha);
-extern_cfg (int, gl_linethickness);
-extern_cfg (str, gui_colortoolbar);
-extern_cfg (bool, edit_schemanticinline);
-extern_cfg (bool, gl_blackedges);
-extern_cfg (bool, gui_implicitfiles);
-extern_cfg (str, net_downloadpath);
-extern_cfg (bool, net_guesspaths);
-extern_cfg (bool, net_autoclose);
-extern_cfg (bool, gl_logostuds);
+extern_cfg (String, gl_bgcolor);
+extern_cfg (String, gl_maincolor);
+extern_cfg (Bool, lv_colorize);
+extern_cfg (Bool, gl_colorbfc);
+extern_cfg (Float, gl_maincolor_alpha);
+extern_cfg (Int, gl_linethickness);
+extern_cfg (String, gui_colortoolbar);
+extern_cfg (Bool, edit_schemanticinline);
+extern_cfg (Bool, gl_blackedges);
+extern_cfg (Bool, gui_implicitfiles);
+extern_cfg (String, net_downloadpath);
+extern_cfg (Bool, net_guesspaths);
+extern_cfg (Bool, net_autoclose);
+extern_cfg (Bool, gl_logostuds);
 
-extern_cfg (str, prog_ytruder);
-extern_cfg (str, prog_rectifier);
-extern_cfg (str, prog_intersector);
-extern_cfg (str, prog_coverer);
-extern_cfg (str, prog_isecalc);
-extern_cfg (str, prog_edger2);
-extern_cfg (bool, prog_ytruder_wine);
-extern_cfg (bool, prog_rectifier_wine);
-extern_cfg (bool, prog_intersector_wine);
-extern_cfg (bool, prog_coverer_wine);
-extern_cfg (bool, prog_isecalc_wine);
-extern_cfg (bool, prog_edger2_wine);
+extern_cfg (String, prog_ytruder);
+extern_cfg (String, prog_rectifier);
+extern_cfg (String, prog_intersector);
+extern_cfg (String, prog_coverer);
+extern_cfg (String, prog_isecalc);
+extern_cfg (String, prog_edger2);
+extern_cfg (Bool, prog_ytruder_wine);
+extern_cfg (Bool, prog_rectifier_wine);
+extern_cfg (Bool, prog_intersector_wine);
+extern_cfg (Bool, prog_coverer_wine);
+extern_cfg (Bool, prog_isecalc_wine);
+extern_cfg (Bool, prog_edger2_wine);
 
 const char* g_extProgPathFilter =
 #ifdef _WIN32
@@ -72,7 +72,7 @@
 	"";
 #endif
 
-#define act(N) extern_cfg (keyseq, key_##N);
+#define act(N) extern_cfg (KeySequence, key_##N);
 #include "actions.h"
 
 // =============================================================================
@@ -140,7 +140,7 @@
 	connect (ui->shortcut_clear, SIGNAL (clicked()), this, SLOT (slot_clearShortcut()));
 }
 
-void ConfigDialog::addShortcut (keyseqconfig& cfg, QAction* act, ulong& i) {
+void ConfigDialog::addShortcut (KeySequenceConfig& cfg, QAction* act, ulong& i) {
 	ShortcutListItem* item = new ShortcutListItem;
 	item->setIcon (act->icon());
 	item->setKeyConfig (&cfg);
@@ -213,11 +213,11 @@
 // -----------------------------------------------------------------------------
 static const struct extProgInfo {
 	const str name, iconname;
-	strconfig* const path;
+	StringConfig* const path;
 	mutable QLineEdit* input;
 	mutable QPushButton* setPathButton;
 #ifndef _WIN32
-	boolconfig* const wine;
+	BoolConfig* const wine;
 	mutable QCheckBox* wineBox;
 #endif // _WIN32
 } g_extProgInfo[] = {
@@ -405,7 +405,7 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-void ConfigDialog::pickColor (strconfig& conf, QPushButton* button) {
+void ConfigDialog::pickColor (StringConfig& conf, QPushButton* button) {
 	QColor col = QColorDialog::getColor (QColor (conf));
 	
 	if (col.isValid()) {
@@ -618,7 +618,7 @@
 #endif // _WIN32
 		}
 		
-		config::save();
+		Config::save();
 		reloadAllSubfiles();
 		loadLogoedStuds();
 		g_win->R()->setBackground();
@@ -654,7 +654,7 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-bool KeySequenceDialog::staticDialog (keyseqconfig* cfg, QWidget* parent) {
+bool KeySequenceDialog::staticDialog (KeySequenceConfig* cfg, QWidget* parent) {
 	KeySequenceDialog dlg (cfg->value, parent);
 	
 	if (dlg.exec() == false)
--- a/src/configDialog.h	Sun Aug 18 17:53:23 2013 +0300
+++ b/src/configDialog.h	Tue Aug 20 14:47:21 2013 +0300
@@ -28,7 +28,7 @@
 
 // =============================================================================
 class ShortcutListItem : public QListWidgetItem {
-	PROPERTY (keyseqconfig*, keyConfig, setKeyConfig)
+	PROPERTY (KeySequenceConfig*, keyConfig, setKeyConfig)
 	PROPERTY (QAction*, action, setAction)
 	
 public:
@@ -61,9 +61,9 @@
 	void initQuickColorTab();
 	void initGridTab();
 	void initExtProgTab();
-	void addShortcut (keyseqconfig& cfg, QAction* act, ulong& i);
+	void addShortcut (KeySequenceConfig& cfg, QAction* act, ulong& i);
 	void setButtonBackground (QPushButton* button, str value);
-	void pickColor (strconfig& cfg, QPushButton* button);
+	void pickColor (StringConfig& cfg, QPushButton* button);
 	void updateQuickColorList (LDQuickColor* sel = null);
 	void setShortcutText (ShortcutListItem* item);
 	int getItemRow (QListWidgetItem* item, List<QListWidgetItem*>& haystack);
@@ -94,7 +94,7 @@
 
 public:
 	explicit KeySequenceDialog (QKeySequence seq, QWidget* parent = null, Qt::WindowFlags f = 0);
-	static bool staticDialog (keyseqconfig* cfg, QWidget* parent = null);
+	static bool staticDialog (KeySequenceConfig* cfg, QWidget* parent = null);
 	
 	QLabel* lb_output;
 	QDialogButtonBox* bbx_buttons;
--- a/src/dialogs.cpp	Sun Aug 18 17:53:23 2013 +0300
+++ b/src/dialogs.cpp	Tue Aug 20 14:47:21 2013 +0300
@@ -42,7 +42,7 @@
 #include "build/moc_dialogs.cpp"
 
 extern const char* g_extProgPathFilter;
-extern_cfg (str, io_ldpath);
+extern_cfg (String, io_ldpath);
 
 // =============================================================================
 // -----------------------------------------------------------------------------
@@ -224,7 +224,7 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 void LDrawPathDialog::slot_accept() {
-	config::save();
+	Config::save();
 	accept();
 }
 
--- a/src/download.cpp	Sun Aug 18 17:53:23 2013 +0300
+++ b/src/download.cpp	Tue Aug 20 14:47:21 2013 +0300
@@ -30,9 +30,9 @@
 #include "file.h"
 #include "gldraw.h"
 
-cfg (str, net_downloadpath, "");
-cfg (bool, net_guesspaths, true);
-cfg (bool, net_autoclose, false);
+cfg (String, net_downloadpath, "");
+cfg (Bool, net_guesspaths, true);
+cfg (Bool, net_autoclose, false);
 
 constexpr const char* PartDownloader::k_OfficialURL,
 	*PartDownloader::k_UnofficialURL;
--- a/src/extprogs.cpp	Sun Aug 18 17:53:23 2013 +0300
+++ b/src/extprogs.cpp	Tue Aug 20 14:47:21 2013 +0300
@@ -51,14 +51,14 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-cfg (str, prog_isecalc, "");
-cfg (str, prog_intersector, "");
-cfg (str, prog_coverer, "");
-cfg (str, prog_ytruder, "");
-cfg (str, prog_rectifier, "");
-cfg (str, prog_edger2, "");
+cfg (String, prog_isecalc, "");
+cfg (String, prog_intersector, "");
+cfg (String, prog_coverer, "");
+cfg (String, prog_ytruder, "");
+cfg (String, prog_rectifier, "");
+cfg (String, prog_edger2, "");
 
-strconfig* const g_extProgPaths[] = {
+StringConfig* const g_extProgPaths[] = {
 	&prog_isecalc,
 	&prog_intersector,
 	&prog_coverer,
@@ -68,14 +68,14 @@
 };
 
 #ifndef _WIN32
-cfg (bool, prog_isecalc_wine, false);
-cfg (bool, prog_intersector_wine, false);
-cfg (bool, prog_coverer_wine, false);
-cfg (bool, prog_ytruder_wine, false);
-cfg (bool, prog_rectifier_wine, false);
-cfg (bool, prog_edger2_wine, false);
+cfg (Bool, prog_isecalc_wine, false);
+cfg (Bool, prog_intersector_wine, false);
+cfg (Bool, prog_coverer_wine, false);
+cfg (Bool, prog_ytruder_wine, false);
+cfg (Bool, prog_rectifier_wine, false);
+cfg (Bool, prog_edger2_wine, false);
 
-boolconfig* const g_extProgWine[] = {
+BoolConfig* const g_extProgWine[] = {
 	&prog_isecalc_wine,
 	&prog_intersector_wine,
 	&prog_coverer_wine,
--- a/src/file.cpp	Sun Aug 18 17:53:23 2013 +0300
+++ b/src/file.cpp	Tue Aug 20 14:47:21 2013 +0300
@@ -32,10 +32,10 @@
 #include "gldraw.h"
 #include "build/moc_file.cpp"
 
-cfg (str, io_ldpath, "");
-cfg (str, io_recentfiles, "");
-extern_cfg (str, net_downloadpath);
-extern_cfg (bool, gl_logostuds);
+cfg (String, io_ldpath, "");
+cfg (String, io_recentfiles, "");
+extern_cfg (String, net_downloadpath);
+extern_cfg (Bool, gl_logostuds);
 
 static bool g_loadingMainFile = false;
 static const int g_MaxRecentFiles = 5;
@@ -495,7 +495,7 @@
 	// Rebuild the config string
 	io_recentfiles = rfiles.join ("@");
 	
-	config::save();
+	Config::save();
 	g_win->updateRecentFilesMenu();
 }
 
--- a/src/gldraw.cpp	Sun Aug 18 17:53:23 2013 +0300
+++ b/src/gldraw.cpp	Tue Aug 20 14:47:21 2013 +0300
@@ -51,16 +51,16 @@
 	{{  0, -1, 0 }, Z, Y, false,  true },
 };
 
-cfg (str, gl_bgcolor, "#CCCCD9");
-cfg (str, gl_maincolor, "#707078");
-cfg (float, gl_maincolor_alpha, 1.0);
-cfg (int, gl_linethickness, 2);
-cfg (bool, gl_colorbfc, true);
-cfg (int, gl_camera, GLRenderer::Free);
-cfg (bool, gl_blackedges, true);
-cfg (bool, gl_axes, false);
-cfg (bool, gl_wireframe, false);
-cfg (bool, gl_logostuds, false);
+cfg (String, gl_bgcolor, "#CCCCD9");
+cfg (String, gl_maincolor, "#707078");
+cfg (Float, gl_maincolor_alpha, 1.0);
+cfg (Int, gl_linethickness, 2);
+cfg (Bool, gl_colorbfc, true);
+cfg (Int, gl_camera, GLRenderer::Free);
+cfg (Bool, gl_blackedges, true);
+cfg (Bool, gl_axes, false);
+cfg (Bool, gl_wireframe, false);
+cfg (Bool, gl_logostuds, false);
 
 // argh
 const char* g_CameraNames[7] = {
--- a/src/gui.cpp	Sun Aug 18 17:53:23 2013 +0300
+++ b/src/gui.cpp	Tue Aug 20 14:47:21 2013 +0300
@@ -51,17 +51,17 @@
 
 static bool g_bSelectionLocked = false;
 
-cfg (bool, lv_colorize, true);
-cfg (str, gui_colortoolbar, "16:24:|:1:2:4:14:0:15:|:33:34:36:46");
-cfg (bool, gui_implicitfiles, false);
-extern_cfg (str, io_recentfiles);
-extern_cfg (bool, gl_axes);
-extern_cfg (str, gl_maincolor);
-extern_cfg (float, gl_maincolor_alpha);
-extern_cfg (bool, gl_wireframe);
-extern_cfg (bool, gl_colorbfc);
+cfg (Bool, lv_colorize, true);
+cfg (String, gui_colortoolbar, "16:24:|:1:2:4:14:0:15:|:33:34:36:46");
+cfg (Bool, gui_implicitfiles, false);
+extern_cfg (String, io_recentfiles);
+extern_cfg (Bool, gl_axes);
+extern_cfg (String, gl_maincolor);
+extern_cfg (Float, gl_maincolor_alpha);
+extern_cfg (Bool, gl_wireframe);
+extern_cfg (Bool, gl_colorbfc);
 
-#define act(N) extern_cfg (keyseq, key_##N);
+#define act(N) extern_cfg (KeySequence, key_##N);
 #include "actions.h"
 
 const char* g_modeActionNames[] = {
@@ -571,7 +571,7 @@
 	
 	// Save the configuration before leaving so that, for instance, grid choice
 	// is preserved across instances.
-	config::save();
+	Config::save();
 	
 	ev->accept();
 }
--- a/src/gui.h	Sun Aug 18 17:53:23 2013 +0300
+++ b/src/gui.h	Tue Aug 20 14:47:21 2013 +0300
@@ -46,7 +46,7 @@
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
 #define DEFINE_ACTION(NAME, DEFSHORTCUT) \
-	cfg (keyseq, key_##NAME, DEFSHORTCUT); \
+	cfg (KeySequence, key_##NAME, DEFSHORTCUT); \
 	void actiondef_##NAME()
 
 #define ACTION(N) g_win->action##N()
--- a/src/gui_actions.cpp	Sun Aug 18 17:53:23 2013 +0300
+++ b/src/gui_actions.cpp	Tue Aug 20 14:47:21 2013 +0300
@@ -37,8 +37,8 @@
 #include "ui_newpart.h"
 #include "widgets.h"
 
-extern_cfg (bool, gl_wireframe);
-extern_cfg (bool, gl_colorbfc);
+extern_cfg (Bool, gl_wireframe);
+extern_cfg (Bool, gl_colorbfc);
 
 // =============================================================================
 // -----------------------------------------------------------------------------
@@ -438,7 +438,7 @@
 
 // =============================================================================
 // -----------------------------------------------------------------------------
-extern_cfg (bool, gl_axes);
+extern_cfg (Bool, gl_axes);
 DEFINE_ACTION (Axes, 0) {
 	gl_axes = !gl_axes;
 	ACTION (Axes)->setChecked (gl_axes);
@@ -562,4 +562,25 @@
 	gl_colorbfc = !gl_colorbfc;
 	ACTION (BFCView)->setChecked (gl_colorbfc);
 	g_win->R()->refresh();
+}
+
+// =============================================================================
+// -----------------------------------------------------------------------------
+DEFINE_ACTION (JumpTo, CTRL (G)) {
+	bool ok;
+	int defval = 0;
+	LDObject* obj;
+	
+	if (g_win->sel().size() == 1)
+		defval = g_win->sel()[0]->getIndex();
+	
+	int idx = QInputDialog::getInt (null, "Go to line", "Go to line:", defval,
+		1, LDFile::current()->numObjs(), 1, &ok);
+	
+	if (!ok || (obj = LDFile::current()->object (idx - 1)) == null)
+		return;
+	
+	g_win->clearSelection();
+	g_win->sel() << obj;
+	g_win->updateSelection();
 }
\ No newline at end of file
--- a/src/gui_editactions.cpp	Sun Aug 18 17:53:23 2013 +0300
+++ b/src/gui_editactions.cpp	Tue Aug 20 14:47:21 2013 +0300
@@ -35,7 +35,7 @@
 #include "ui_flip.h"
 #include "ui_addhistoryline.h"
 
-cfg (bool, edit_schemanticinline, false);
+cfg (Bool, edit_schemanticinline, false);
 
 // =============================================================================
 // -----------------------------------------------------------------------------
--- a/src/main.cpp	Sun Aug 18 17:53:23 2013 +0300
+++ b/src/main.cpp	Tue Aug 20 14:47:21 2013 +0300
@@ -51,9 +51,9 @@
 	LDFile::setCurrent (null);
 	
 	// Load or create the configuration
-	if (!config::load()) {
+	if (!Config::load()) {
 		print ("Creating configuration file...\n");
-		if (config::save())
+		if (Config::save())
 			print ("Configuration file successfully created.\n");
 		else
 			print ("failed to create configuration file!\n");
--- a/src/misc.cpp	Sun Aug 18 17:53:23 2013 +0300
+++ b/src/misc.cpp	Tue Aug 20 14:47:21 2013 +0300
@@ -82,24 +82,24 @@
 // =============================================================================
 // -----------------------------------------------------------------------------
 // Grid stuff
-cfg (int, grid, Grid::Medium);
+cfg (Int, grid, Grid::Medium);
 
-cfg (float, grid_coarse_x,			5.0f);
-cfg (float, grid_coarse_y,			5.0f);
-cfg (float, grid_coarse_z,			5.0f);
-cfg (float, grid_coarse_angle,	45.0f);
-cfg (float, grid_medium_x,			1.0f);
-cfg (float, grid_medium_y,			1.0f);
-cfg (float, grid_medium_z,			1.0f);
-cfg (float, grid_medium_angle,	22.5f);
-cfg (float, grid_fine_x,			0.1f);
-cfg (float, grid_fine_y,			0.1f);
-cfg (float, grid_fine_z,			0.1f);
-cfg (float, grid_fine_angle,		7.5f);
-cfg (int, edit_rotpoint, 0);
-cfg (float, edit_rotpoint_x, 0.0f); // TODO: make a vertexconfig object and use it here
-cfg (float, edit_rotpoint_y, 0.0f);
-cfg (float, edit_rotpoint_z, 0.0f);
+cfg (Float, grid_coarse_x,			5.0f);
+cfg (Float, grid_coarse_y,			5.0f);
+cfg (Float, grid_coarse_z,			5.0f);
+cfg (Float, grid_coarse_angle,	45.0f);
+cfg (Float, grid_medium_x,			1.0f);
+cfg (Float, grid_medium_y,			1.0f);
+cfg (Float, grid_medium_z,			1.0f);
+cfg (Float, grid_medium_angle,	22.5f);
+cfg (Float, grid_fine_x,			0.1f);
+cfg (Float, grid_fine_y,			0.1f);
+cfg (Float, grid_fine_z,			0.1f);
+cfg (Float, grid_fine_angle,		7.5f);
+cfg (Int, edit_rotpoint, 0);
+cfg (Float, edit_rotpoint_x, 0.0f); // TODO: make a VertexConfig and use it here
+cfg (Float, edit_rotpoint_y, 0.0f);
+cfg (Float, edit_rotpoint_z, 0.0f);
 
 const gridinfo g_GridInfo[3] = {
 	{ "Coarse", { &grid_coarse_x, &grid_coarse_y, &grid_coarse_z, &grid_coarse_angle }},
--- a/src/misc.h	Sun Aug 18 17:53:23 2013 +0300
+++ b/src/misc.h	Tue Aug 20 14:47:21 2013 +0300
@@ -47,10 +47,10 @@
 // Grid stuff
 typedef struct {
 	const char* const name;
-	floatconfig* const confs[4];
+	FloatConfig* const confs[4];
 } gridinfo;
 
-extern_cfg (int, grid);
+extern_cfg (Int, grid);
 static const short g_NumGrids = 3;
 extern const gridinfo g_GridInfo[3];
 
--- a/src/primitives.cpp	Sun Aug 18 17:53:23 2013 +0300
+++ b/src/primitives.cpp	Tue Aug 20 14:47:21 2013 +0300
@@ -53,7 +53,7 @@
 	loadPrimitiveCatgories();
 	
 	// Try to load prims.cfg
-	File conf (config::filepath ("prims.cfg"), File::Read);
+	File conf (Config::filepath ("prims.cfg"), File::Read);
 	
 	if (!conf) {
 		// No prims.cfg, build it
@@ -130,7 +130,7 @@
 	}
 	
 	// Save to a config file
-	File conf (config::filepath ("prims.cfg"), File::Write);
+	File conf (Config::filepath ("prims.cfg"), File::Write);
 	
 	for (Primitive & info : m_prims)
 		fprint (conf, "%1 %2\n", info.name, info.title);
@@ -231,7 +231,7 @@
 // -----------------------------------------------------------------------------
 static void loadPrimitiveCatgories() {
 	g_PrimitiveCategories.clear();
-	File f (config::dirpath() + "primregexps.cfg", File::Read);
+	File f (Config::dirpath() + "primregexps.cfg", File::Read);
 	
 	if (!f)
 		f.open (":/data/primitive-categories.cfg", File::Read);
--- a/src/types.cpp	Sun Aug 18 17:53:23 2013 +0300
+++ b/src/types.cpp	Tue Aug 20 14:47:21 2013 +0300
@@ -300,15 +300,15 @@
 	m_val = v;
 }
 
-StringFormatArg::StringFormatArg (const strconfig& v) {
+StringFormatArg::StringFormatArg (const StringConfig& v) {
 	m_val = v.value;
 }
 
-StringFormatArg::StringFormatArg (const intconfig& v) {
+StringFormatArg::StringFormatArg (const IntConfig& v) {
 	m_val.number (v.value);
 }
 
-StringFormatArg::StringFormatArg (const floatconfig& v) {
+StringFormatArg::StringFormatArg (const FloatConfig& v) {
 	m_val.number (v.value);
 }
 
--- a/src/types.h	Sun Aug 18 17:53:23 2013 +0300
+++ b/src/types.h	Tue Aug 20 14:47:21 2013 +0300
@@ -30,9 +30,9 @@
 typedef QString str;
 template<class T> class ConstListReverser;
 template<class T> using c_rev = ConstListReverser<T>;
-class strconfig;
-class intconfig;
-class floatconfig;
+class StringConfig;
+class IntConfig;
+class FloatConfig;
 class QFile;
 class QTextStream;
 
@@ -370,9 +370,9 @@
 	StringFormatArg (const vertex& v);
 	StringFormatArg (const matrix& v);
 	StringFormatArg (const char* v);
-	StringFormatArg (const strconfig& v);
-	StringFormatArg (const intconfig& v);
-	StringFormatArg (const floatconfig& v);
+	StringFormatArg (const StringConfig& v);
+	StringFormatArg (const IntConfig& v);
+	StringFormatArg (const FloatConfig& v);
 	StringFormatArg (const void* v);
 	
 	template<class T> StringFormatArg (const List<T>& v) {
--- a/src/ui/ldforge.ui	Sun Aug 18 17:53:23 2013 +0300
+++ b/src/ui/ldforge.ui	Tue Aug 20 14:47:21 2013 +0300
@@ -159,6 +159,8 @@
     <addaction name="actionModeDraw"/>
     <addaction name="separator"/>
     <addaction name="actionSetDrawDepth"/>
+    <addaction name="separator"/>
+    <addaction name="actionJumpTo"/>
    </widget>
    <widget class="QMenu" name="menuTools">
     <property name="title">
@@ -1271,6 +1273,11 @@
     <string>Add History Line</string>
    </property>
   </action>
+  <action name="actionJumpTo">
+   <property name="text">
+    <string>Go to Line...</string>
+   </property>
+  </action>
  </widget>
  <resources>
   <include location="../../ldforge.qrc"/>

mercurial