#include "stream/stringstream.h"
#include "portals.h"
-#include "AboutDialog.h"
#include "ConfigDialog.h"
#include "LoadPortalFileDialog.h"
#define Q3R_CMD_SPLITTER "-"
-#define Q3R_CMD_ABOUT "About Portal Viewer"
+#define Q3R_CMD_ABOUT "About..."
#define Q3R_CMD_LOAD "Load .prt file"
#define Q3R_CMD_RELEASE "Unload .prt file"
#define Q3R_CMD_SHOW_3D "Toggle portals (3D)"
#define Q3R_CMD_SHOW_2D "Toggle portals (2D)"
-#define Q3R_CMD_OPTIONS "Configure Portal Viewer"
+#define Q3R_CMD_OPTIONS "Configure..."
CopiedString INIfn;
/////////////////////////////////////////////////////////////////////////////
// CPrtViewApp construction
-#define RENDER_2D "Render2D"
-#define WIDTH_2D "Width2D"
-#define AA_2D "AntiAlias2D"
-#define COLOR_2D "Color2D"
-
-#define RENDER_3D "Render3D"
-#define WIDTH_3D "Width3D"
-#define AA_3D "AntiAlias3D"
-#define COLOR_3D "Color3D"
-#define COLOR_FOG "ColorFog"
-#define FOG "Fog"
-#define ZBUFFER "ZBuffer"
-#define POLYGON "Polygons"
-#define LINE "Lines"
-#define TRANS_3D "Transparency"
-#define CLIP_RANGE "ClipRange"
-#define CLIP "Clip"
-
+const char *RENDER_2D = "Render2D";
+const char *WIDTH_2D = "Width2D";
+const char *AA_2D = "AntiAlias2D";
+const char *COLOR_2D = "Color2D";
+
+const char *RENDER_3D = "Render3D";
+const char *WIDTH_3D = "Width3D";
+const char *AA_3D = "AntiAlias3D";
+const char *COLOR_3D = "Color3D";
+const char *COLOR_FOG = "ColorFog";
+const char *FOG = "Fog";
+const char *ZBUFFER = "ZBuffer";
+const char *POLYGON = "Polygons";
+const char *LINE = "Lines";
+const char *TRANS_3D = "Transparency";
+const char *CLIP_RANGE = "ClipRange";
+const char *CLIP = "Clip";
+
+static ui::Window main_window{ui::null};
void PrtView_construct(){
StringOutputStream tmp( 64 );
}
-#define CONFIG_SECTION "Configuration"
+const char *CONFIG_SECTION = "Configuration";
-int INIGetInt( char *key, int def ){
+int INIGetInt( const char *key, int def ){
char value[1024];
if ( read_var( INIfn.c_str(), CONFIG_SECTION, key, value ) ) {
}
}
-void INISetInt( char *key, int val, char *comment /* = NULL */ ){
+void INISetInt( const char *key, int val, const char *comment /* = NULL */ ){
char s[1000];
if ( comment ) {
save_var( INIfn.c_str(), CONFIG_SECTION, key, s );
}
-
-// plugin name
-static const char *PLUGIN_NAME = "Portal Viewer";
// commands in the menu
static const char *PLUGIN_COMMANDS =
Q3R_CMD_ABOUT ";"
const char* QERPlug_Init( void *hApp, void* pMainWidget ){
- return "Portal Viewer for Q3Radiant";
+ main_window = ui::Window::from(pMainWidget);
+ ASSERT_TRUE( main_window );
+
+ return PLUGIN_NAME " for " RADIANT_NAME;
}
const char* QERPlug_GetName(){
globalOutputStream() << MSG_PREFIX "Command \"" << p << "\"\n";
if ( !strcmp( p,Q3R_CMD_ABOUT ) ) {
- DoAboutDlg();
+ const char *label_text =
+ PLUGIN_NAME " " PLUGIN_VERSION " for "
+ RADIANT_NAME " " RADIANT_VERSION "\n\n"
+ "Gtk port by Leonardo Zide <leo@lokigames.com>\n"
+ "Written by Geoffrey DeWan <gdewan@prairienet.org>\n\n"
+ "Built against "
+ RADIANT_NAME " " RADIANT_VERSION_STRING "\n"
+ __DATE__;
+
+ GlobalRadiant().m_pfnMessageBox( main_window, label_text,
+ "About " PLUGIN_NAME,
+ eMB_OK,
+ eMB_ICONDEFAULT );
}
else if ( !strcmp( p,Q3R_CMD_LOAD ) ) {
if ( DoLoadPortalFileDialog() == IDOK ) {
}
}
else if ( !strcmp( p,Q3R_CMD_OPTIONS ) ) {
- DoConfigDialog();
+ DoConfigDialog( main_window );
SaveConfig();
SceneChangeNotify();
_QERPluginTable m_plugin;
public:
typedef _QERPluginTable Type;
-STRING_CONSTANT( Name, "prtview" );
+STRING_CONSTANT( Name, PLUGIN_NAME );
PrtViewPluginModule(){
m_plugin.m_pfnQERPlug_Init = QERPlug_Init;