X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=include%2Fqerplugin.h;h=3c1db04679701ce62c878c4e530599930e515b6e;hb=32201f62a3b9d50fff9b18dfe3aa262b68e5381b;hp=7f2f9ca279743c207e345491530b83ec700123bc;hpb=0d98822b3c7232c4859c9605653685a7dab86ba8;p=xonotic%2Fnetradiant.git diff --git a/include/qerplugin.h b/include/qerplugin.h index 7f2f9ca2..3c1db046 100644 --- a/include/qerplugin.h +++ b/include/qerplugin.h @@ -1,23 +1,23 @@ /* -Copyright (C) 1999-2006 Id Software, Inc. and contributors. -For a list of contributors, see the accompanying CONTRIBUTORS file. + Copyright (C) 1999-2006 Id Software, Inc. and contributors. + For a list of contributors, see the accompanying CONTRIBUTORS file. -This file is part of GtkRadiant. + This file is part of GtkRadiant. -GtkRadiant is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + GtkRadiant is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -GtkRadiant is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + GtkRadiant is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with GtkRadiant; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ + You should have received a copy of the GNU General Public License + along with GtkRadiant; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ // QERadiant PlugIns // @@ -39,60 +39,60 @@ typedef struct _GtkWidget GtkWidget; enum EMessageBoxType { - eMB_OK, - eMB_OKCANCEL, - eMB_YESNO, - eMB_YESNOCANCEL, - eMB_NOYES, + eMB_OK, + eMB_OKCANCEL, + eMB_YESNO, + eMB_YESNOCANCEL, + eMB_NOYES, }; enum EMessageBoxIcon { - eMB_ICONDEFAULT, - eMB_ICONERROR, - eMB_ICONWARNING, - eMB_ICONQUESTION, - eMB_ICONASTERISK, + eMB_ICONDEFAULT, + eMB_ICONERROR, + eMB_ICONWARNING, + eMB_ICONQUESTION, + eMB_ICONASTERISK, }; enum EMessageBoxReturn { - eIDOK, - eIDCANCEL, - eIDYES, - eIDNO, + eIDOK, + eIDCANCEL, + eIDYES, + eIDNO, }; // simple Message Box, see above for the 'type' flags -typedef EMessageBoxReturn (* PFN_QERAPP_MESSAGEBOX) (GtkWidget *parent, const char* text, const char* caption/* = "GtkRadiant"*/, EMessageBoxType type/* = eMB_OK*/, EMessageBoxIcon icon/* = eMB_ICONDEFAULT*/); +typedef EMessageBoxReturn ( *PFN_QERAPP_MESSAGEBOX )( GtkWidget *parent, const char* text, const char* caption /* = "NetRadiant"*/, EMessageBoxType type /* = eMB_OK*/, EMessageBoxIcon icon /* = eMB_ICONDEFAULT*/ ); // file and directory selection functions return null if the user hits cancel // - 'title' is the dialog title (can be null) // - 'path' is used to set the initial directory (can be null) // - 'pattern': the first pattern is for the win32 mode, then comes the Gtk pattern list, see Radiant source for samples -typedef const char* (* PFN_QERAPP_FILEDIALOG) (GtkWidget *parent, bool open, const char* title, const char* path/* = 0*/, const char* pattern/* = 0*/); +typedef const char* ( *PFN_QERAPP_FILEDIALOG )( GtkWidget *parent, bool open, const char* title, const char* path /* = 0*/, const char* pattern /* = 0*/, bool want_load /* = false*/, bool want_import /* = false*/, bool want_save /* = false*/ ); // returns a gchar* string that must be g_free'd by the user -typedef char* (* PFN_QERAPP_DIRDIALOG) (GtkWidget *parent, const char* title/* = "Choose Directory"*/, const char* path/* = 0*/); +typedef char* ( *PFN_QERAPP_DIRDIALOG )( GtkWidget *parent, const char* title /* = "Choose Directory"*/, const char* path /* = 0*/ ); // return true if the user closed the dialog with 'Ok' // 'color' is used to set the initial value and store the selected value template class BasicVector3; typedef BasicVector3 Vector3; -typedef bool (* PFN_QERAPP_COLORDIALOG) (GtkWidget *parent, Vector3& color, - const char* title/* = "Choose Color"*/); +typedef bool ( *PFN_QERAPP_COLORDIALOG )( GtkWidget *parent, Vector3& color, + const char* title /* = "Choose Color"*/ ); // load a .bmp file and create a GtkImage widget from it // NOTE: 'filename' is relative to /plugins/bitmaps/ typedef struct _GtkImage GtkImage; -typedef GtkImage* (* PFN_QERAPP_NEWIMAGE) (const char* filename); +typedef GtkImage* ( *PFN_QERAPP_NEWIMAGE )( const char* filename ); // ======================================== namespace scene { - class Node; +class Node; } class ModuleObserver; @@ -106,56 +106,57 @@ typedef SignalFwd::handler_id_type MouseEventHandlerId; enum VIEWTYPE { - YZ = 0, - XZ = 1, - XY = 2 + YZ = 0, + XZ = 1, + XY = 2 }; // the radiant core API struct _QERFuncTable_1 { - INTEGER_CONSTANT(Version, 1); - STRING_CONSTANT(Name, "radiant"); - - const char* (*getEnginePath)(); - const char* (*getGameToolsPath)(); - const char* (*getAppPath)(); - const char* (*getSettingsPath)(); - const char* (*getMapsPath)(); - - const char* (*getGameName)(); - const char* (*getGameMode)(); - - const char* (*getMapName)(); - scene::Node& (*getMapWorldEntity)(); - float (*getGridSize)(); - - const char* (*getGameDescriptionKeyValue)(const char* key); - const char* (*getRequiredGameDescriptionKeyValue)(const char* key); - - void (*attachGameToolsPathObserver)(ModuleObserver& observer); - void (*detachGameToolsPathObserver)(ModuleObserver& observer); - void (*attachEnginePathObserver)(ModuleObserver& observer); - void (*detachEnginePathObserver)(ModuleObserver& observer); - void (*attachGameNameObserver)(ModuleObserver& observer); - void (*detachGameNameObserver)(ModuleObserver& observer); - void (*attachGameModeObserver)(ModuleObserver& observer); - void (*detachGameModeObserver)(ModuleObserver& observer); - - SignalHandlerId (*XYWindowDestroyed_connect)(const SignalHandler& handler); - void (*XYWindowDestroyed_disconnect)(SignalHandlerId id); - MouseEventHandlerId (*XYWindowMouseDown_connect)(const MouseEventHandler& handler); - void (*XYWindowMouseDown_disconnect)(MouseEventHandlerId id); - VIEWTYPE (*XYWindow_getViewType)(); - Vector3 (*XYWindow_windowToWorld)(const WindowVector& position); - const char* (*TextureBrowser_getSelectedShader)(); - - // GTK+ functions - PFN_QERAPP_MESSAGEBOX m_pfnMessageBox; - PFN_QERAPP_FILEDIALOG m_pfnFileDialog; - PFN_QERAPP_DIRDIALOG m_pfnDirDialog; - PFN_QERAPP_COLORDIALOG m_pfnColorDialog; - PFN_QERAPP_NEWIMAGE m_pfnNewImage; + INTEGER_CONSTANT( Version, 1 ); + STRING_CONSTANT( Name, "radiant" ); + + const char* ( *getEnginePath )( ); + const char* ( *getLocalRcPath )( ); + const char* ( *getGameToolsPath )( ); + const char* ( *getAppPath )( ); + const char* ( *getSettingsPath )( ); + const char* ( *getMapsPath )( ); + + const char* ( *getGameName )( ); + const char* ( *getGameMode )( ); + + const char* ( *getMapName )( ); + scene::Node& ( *getMapWorldEntity )( ); + float ( *getGridSize )(); + + const char* ( *getGameDescriptionKeyValue )(const char* key); + const char* ( *getRequiredGameDescriptionKeyValue )(const char* key); + + void ( *attachGameToolsPathObserver )( ModuleObserver& observer ); + void ( *detachGameToolsPathObserver )( ModuleObserver& observer ); + void ( *attachEnginePathObserver )( ModuleObserver& observer ); + void ( *detachEnginePathObserver )( ModuleObserver& observer ); + void ( *attachGameNameObserver )( ModuleObserver& observer ); + void ( *detachGameNameObserver )( ModuleObserver& observer ); + void ( *attachGameModeObserver )( ModuleObserver& observer ); + void ( *detachGameModeObserver )( ModuleObserver& observer ); + + SignalHandlerId ( *XYWindowDestroyed_connect )( const SignalHandler& handler ); + void ( *XYWindowDestroyed_disconnect )( SignalHandlerId id ); + MouseEventHandlerId ( *XYWindowMouseDown_connect )( const MouseEventHandler& handler ); + void ( *XYWindowMouseDown_disconnect )( MouseEventHandlerId id ); + VIEWTYPE ( *XYWindow_getViewType )(); + Vector3 ( *XYWindow_windowToWorld )( const WindowVector& position ); + const char* ( *TextureBrowser_getSelectedShader )( ); + + // GTK+ functions + PFN_QERAPP_MESSAGEBOX m_pfnMessageBox; + PFN_QERAPP_FILEDIALOG m_pfnFileDialog; + PFN_QERAPP_DIRDIALOG m_pfnDirDialog; + PFN_QERAPP_COLORDIALOG m_pfnColorDialog; + PFN_QERAPP_NEWIMAGE m_pfnNewImage; }; @@ -169,9 +170,8 @@ template class GlobalModuleRef; typedef GlobalModuleRef<_QERFuncTable_1> GlobalRadiantModuleRef; -inline _QERFuncTable_1& GlobalRadiant() -{ - return GlobalRadiantModule::getTable(); +inline _QERFuncTable_1& GlobalRadiant(){ + return GlobalRadiantModule::getTable(); } #endif