* fixed a lot of compiler warnings (mostly const char * stuff and use of uninitialized data)

* add support for translating radiant (just marked three strings, more to come)


git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/trunk@264 8a3a26a2-13c4-0310-b231-cf6edde360e5
This commit is contained in:
mattn 2008-06-26 07:52:02 +00:00
parent 5efe3f31db
commit e4b1c1a55c
47 changed files with 1713 additions and 1685 deletions

View File

@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include "bkgrnd2d.h"
#include "dialog.h"
@ -104,12 +105,12 @@ void CBackgroundDialogPage::Browse()
const char *ct;
const char *newfile;
char *t;
//TODO GetMapName saves the map. eeep!
//also with no map, returns unnamed.map, otherwise returns full path
// Syn_Printf(MSG_PREFIX "GetMapName() %s\n",
// g_FuncTable.m_pfnGetMapName());
ct = g_FuncTable.m_pfnReadProjectKey("basepath");
// TODO shouldn't need this stuff
if(!ct || !strlen(ct)) {
@ -123,7 +124,7 @@ void CBackgroundDialogPage::Browse()
}
strcpy(browsedir,ct);
// make sure we have a trailing /
// make sure we have a trailing /
if(browsedir[strlen(browsedir) - 1] != '/')
strcat(browsedir,"/");
@ -136,12 +137,12 @@ void CBackgroundDialogPage::Browse()
// lop off the file part
t = browsedir + strlen(browsedir) - 1;
while (t != browsedir && *t != '/')
while (t != browsedir && *t != '/')
t--;
*t = 0;
}
Syn_Printf(MSG_PREFIX "browse directory %s\n",browsedir);
//does NOT need freeing contrary to include/qerplugin.h comments
//TODO bug/patch for comments
//TODO patern gets fucked up sometimes if empty
@ -202,7 +203,7 @@ CBackgroundDialogPage::CBackgroundDialogPage(VIEWTYPE vt )
break;
}
// A vbox to hold everything
m_pWidget = gtk_vbox_new(FALSE,0);
m_pWidget = gtk_vbox_new(FALSE,0);
// Frame for file row
frame = gtk_frame_new("File");
gtk_box_pack_start (GTK_BOX (m_pWidget),frame, FALSE, FALSE, 2);
@ -226,7 +227,7 @@ CBackgroundDialogPage::CBackgroundDialogPage(VIEWTYPE vt )
gtk_box_pack_start (GTK_BOX (hbox),w, FALSE, FALSE, 5);
gtk_tooltips_set_tip (pTooltips, w, "Select a file", NULL);
gtk_widget_show (w);
w = gtk_button_new_with_label ("Reload");
g_signal_connect (G_OBJECT (w), "clicked", G_CALLBACK (reload_callback),
(gpointer)this);
@ -348,7 +349,7 @@ void InitBackgroundDialog()
gtk_box_pack_start (GTK_BOX (GTK_DIALOG(pDialogWnd)->vbox), pNotebook, TRUE, TRUE, 0);
gtk_widget_show ( pNotebook );
gtk_widget_realize( pDialogWnd );
}

View File

@ -30,6 +30,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <stdio.h>
#include <stdlib.h>
@ -53,25 +54,25 @@ typedef char* LPCSTR;
#define MB_YESNOCANCEL 0x00000003L
#define MB_YESNO 0x00000004L
#define MB_RETRYCANCEL 0x00000005L
#define MB_ICONHAND 0x00000010L
#define MB_ICONQUESTION 0x00000020L
#define MB_ICONEXCLAMATION 0x00000030L
#define MB_ICONASTERISK 0x00000040L
#define MB_USERICON 0x00000080L
#define MB_ICONWARNING MB_ICONEXCLAMATION
#define MB_ICONERROR MB_ICONHAND
#define MB_ICONINFORMATION MB_ICONASTERISK
#define MB_ICONSTOP MB_ICONHAND
#define MB_TYPEMASK 0x0000000FL
#define MB_ICONMASK 0x000000F0L
#define MB_DEFMASK 0x00000F00L
#define MB_MODEMASK 0x00003000L
#define MB_MISCMASK 0x0000C000L
#define IDOK 1
#define IDCANCEL 2
#define IDABORT 3
@ -98,7 +99,7 @@ typedef struct _GUID
#define stricmp strcasecmp
#endif
#if defined(__cplusplus)
#ifndef _REFGUID_DEFINED
#define _REFGUID_DEFINED

View File

@ -36,6 +36,7 @@ Copyright (C) 2002 Splash Damage Ltd.
class CCamera;
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include "str.h"

View File

@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -1169,7 +1170,7 @@ void create_tooltips ()
gtk_tooltips_set_tip(GTK_TOOLTIPS (tooltips),
GTK_WIDGET (g_object_get_data (G_OBJECT (g_pWnd), "main_antialiasing")),
"The lines in the preview window are antialiased for better quality",
"");
"");
// General tab
gtk_tooltips_set_tip(GTK_TOOLTIPS (tooltips),
@ -1191,7 +1192,7 @@ void create_tooltips ()
"tab to select the image. GenSurf only supports 256-color (8 bit) "
"bitmaps. GenSurf will work with any 256-color bitmap, but gray scale bitmaps are a bit "
"more intuitive.",
"" );
"" );
gtk_tooltips_set_tip(GTK_TOOLTIPS (tooltips),
GTK_WIDGET (wave_radios[4]),
"Builds a random surface using the Plasma Cloud technique. Variance is controlled "
@ -1396,7 +1397,7 @@ GtkWidget* create_main_dialog ()
char *waveforms[] = { "Alternating hill/valley", "Cylindrical left-to-right", "Cylindrical top-to-bottom",
"From bitmap", "Fractal" };
char *orientations[] = { "Ground surface", "Ceiling", "Wall facing 0", "Wall facing 90",
"Wall facing 180","Wall facing 270" };
"Wall facing 180","Wall facing 270" };
g_pWnd = dlg = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (dlg), gszCaption);
@ -2351,7 +2352,7 @@ qboolean CALLBACK AboutDlgProc( HWND hwnd, unsigned msg, UINT wparam, LONG lpara
return FALSE;
}
return FALSE;
} /* AboutDlgProc */
void About()
@ -2364,4 +2365,4 @@ void About()
}
}
#endif
#endif

View File

@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <stdio.h>
#include <stdlib.h>
/*
@ -330,7 +331,7 @@ char *va (char *format, ...)
vsprintf (string, format,argptr);
va_end (argptr);
return string;
return string;
}
@ -401,7 +402,7 @@ void SaveSetup (GtkWidget *parent)
if (name != NULL)
{
char key[32], text[32];
char key[32], text[32];
int i, j;
WriteIniFile (name);

View File

@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#define _GENSURF_H_
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include "qerplugin.h"
//#include "qertypes.h"

View File

@ -55,7 +55,7 @@ static char INIfn[NAME_MAX];
#define CLIP_RANGE "ClipRange"
#define CLIP "Clip"
void InitInstance ()
void InitInstance ()
{
#ifdef _WIN32
char fn[_MAX_PATH];
@ -128,7 +128,7 @@ void InitInstance ()
portals.FixColors();
}
void SaveConfig ()
void SaveConfig ()
{
INISetInt(RENDER_2D, portals.show_2d, "Draw in 2D windows");
INISetInt(WIDTH_2D, (int)portals.width_2d, "Width of lines in 2D windows (in units of 1/2)");
@ -162,27 +162,27 @@ static bool read_var (const char *filename, const char *section, const char *key
{
char line[1024], *ptr;
FILE *rc;
rc = fopen (filename, "rt");
if (rc == NULL)
return false;
while (fgets (line, 1024, rc) != 0)
{
// First we find the section
if (line[0] != '[')
continue;
ptr = strchr (line, ']');
*ptr = '\0';
if (strcmp (&line[1], section) == 0)
{
while (fgets (line, 1024, rc) != 0)
{
ptr = strchr (line, '=');
if (ptr == NULL)
{
// reached the end of the section
@ -190,16 +190,16 @@ static bool read_var (const char *filename, const char *section, const char *key
return false;
}
*ptr = '\0';
if (strcmp (line, key) == 0)
{
strcpy (value, ptr+1);
fclose (rc);
while (value[strlen (value)-1] == 10 ||
while (value[strlen (value)-1] == 10 ||
value[strlen (value)-1] == 13 ||
value[strlen (value)-1] == 32)
value[strlen (value)-1] = 0;
value[strlen (value)-1] = 0;
return true;
}
}
@ -261,7 +261,7 @@ static bool save_var (const char *filename, const char *section, const char *key
break;
}
}
}
}
if (!found)
{
@ -283,7 +283,7 @@ static bool save_var (const char *filename, const char *section, const char *key
if (strcmp (line, key) == 0)
break;
*ptr = '=';
fputs (line, rc);
}
@ -296,7 +296,7 @@ static bool save_var (const char *filename, const char *section, const char *key
while (fgets (line, 1024, old_rc) != NULL)
fputs (line, rc);
fclose (old_rc);
char *tmpname = g_strdup_printf ("%s.tmp", filename);
@ -311,7 +311,7 @@ static bool save_var (const char *filename, const char *section, const char *key
#endif
int INIGetInt(char *key, int def)
int INIGetInt(const char *key, int def)
{
#if defined(__linux__) || defined(__APPLE__)
char value[1024];
@ -325,7 +325,7 @@ int INIGetInt(char *key, int def)
#endif
}
void INISetInt(char *key, int val, char *comment /* = NULL */)
void INISetInt(const char *key, int val, const char *comment /* = NULL */)
{
char s[1000];
@ -363,10 +363,10 @@ extern "C" LPVOID WINAPI QERPlug_GetFuncTable()
//extern "C" LPCSTR WINAPI QERPlug_Init (HMODULE hApp, GtkWidget* hwndMain)
extern "C" const char* QERPlug_Init (void *hApp, void* pMainWidget)
{
{
// Setup defaults & load config
InitInstance();
return "Portal Viewer for Q3Radiant";
}
@ -487,7 +487,7 @@ public:
// CSynapseClient API
bool RequestAPI(APIDescriptor_t *pAPI);
const char* GetInfo();
CSynapseClientPrtView() { }
virtual ~CSynapseClientPrtView() { }
};
@ -511,7 +511,7 @@ extern "C" CSynapseClient* SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces( const
g_pSynapseServer = pServer;
g_pSynapseServer->IncRef();
Set_Syn_Printf(g_pSynapseServer->Get_Syn_Printf());
g_SynapseClient.AddAPI(PLUGIN_MAJOR, PRTVIEW_MINOR, sizeof(_QERPluginTable));
g_SynapseClient.AddAPI(RADIANT_MAJOR, NULL, sizeof(g_FuncTable), SYN_REQUIRE, &g_FuncTable);

View File

@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#define __PRTVIEW_AFX_H__
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#if defined(__linux__) || defined(__APPLE__)
#include <GL/glx.h>
@ -69,8 +70,8 @@ typedef int BOOL;
#define UPDATE_3D (W_CAMERA)
#define UPDATE_ALL (UPDATE_2D | UPDATE_3D)
int INIGetInt(char *key, int def);
void INISetInt(char *key, int val, char *comment = NULL);
int INIGetInt(const char *key, int def);
void INISetInt(const char *key, int val, const char *comment = NULL);
extern bool interfaces_started;

View File

@ -50,9 +50,9 @@ static const char *PLUGIN_ABOUT = "UFO: Alien Invasion plugin " PLUGIN_VERSION "
#define NUM_TOOLBAR_BUTTONS FILTER_MAX
typedef struct toolbar_button_info_s
{
char *image;
char *text;
char *tip;
const char *image;
const char *text;
const char *tip;
void (*func)();
IToolbarButton::EType type;
} toolbar_button_info_t;
@ -61,29 +61,29 @@ static const toolbar_button_info_t toolbar_buttons[NUM_TOOLBAR_BUTTONS] =
{
{
"ufoai_actorclip.bmp",
"Filter actorclip",
"Actorclip",
_("Filter actorclip"),
_("Actorclip"),
DoActorClipFiltering,
IToolbarButton::eToggleButton
},
{
"ufoai_weaponclip.bmp",
"Filter weaponclip",
"Weaponclip",
_("Filter weaponclip"),
_("Weaponclip"),
DoWeaponClipFiltering,
IToolbarButton::eToggleButton
},
{
"ufoai_nodraw.bmp",
"Filter nodraw",
"NoDraw",
_("Filter nodraw"),
_("NoDraw"),
DoNoDrawFiltering,
IToolbarButton::eToggleButton
},
{
"ufoai_stepon.bmp",
"Filter stepon",
"Stepon",
_("Filter stepon"),
_("Stepon"),
DoSteponFiltering,
IToolbarButton::eToggleButton
},

View File

@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define FILTER_MAJOR "filter"
// adds a new filter
typedef bfilter_t* (* PFN_QERPLUG_FILTERADD) (int type, int bmask, char *str, int exclude);
typedef bfilter_t* (* PFN_QERPLUG_FILTERADD) (int type, int bmask, const char *str, int exclude);
// performs the filtering
typedef void (* PFN_QERPLUG_FILTERACTIVATE) (void);

View File

@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define UNDO_MAJOR "undo"
//start operation
typedef void (*PFN_UNDOSTART) (char *operation);
typedef void (*PFN_UNDOSTART) (const char *operation);
//end operation
typedef void (*PFN_UNDOEND) (void);
//add brush to the undo

View File

@ -50,19 +50,19 @@ some portability related code should be moved to synapse (such as the GUID stuff
#include "misc_def.h"
#endif
// the editor will look for plugins in two places, the plugins path
// the editor will look for plugins in two places, the plugins path
// under the application path, and the path under the basepath as defined
// in the project (.qe4) file.
//
// you can drop any number of new texture, model format DLL's in the standard plugin path
// but only one plugin that overrides map loading/saving, surface dialog, surface flags, etc..
// should be used at one time.. if multiples are loaded then the last one loaded will be the
// but only one plugin that overrides map loading/saving, surface dialog, surface flags, etc..
// should be used at one time.. if multiples are loaded then the last one loaded will be the
// active one
//
// type of services the plugin supplies, pass any combo of these flags
// it is assumed the plugin will have a matching function as defined below
// to correlate to the implied functionality
//
//
#define RADIANT_MAJOR "radiant"
@ -82,9 +82,9 @@ some portability related code should be moved to synapse (such as the GUID stuff
struct _QERTextureInfo
{
char m_TextureExtension[QER_MAX_NAMELEN]; // the extension these textures have
qboolean m_bHiColor; // if textures are NOT high color, the default
qboolean m_bHiColor; // if textures are NOT high color, the default
// palette (as described inthe qe4 file will be used for gamma correction)
// if they are high color, gamma and shading are computed on the fly
// if they are high color, gamma and shading are computed on the fly
// based on the rgba data
//--bool m_bIsShader; // will probably do q3 shaders this way when i merge
qboolean m_bWadStyle; // if this is true, the plugin will be presented with the texture path
@ -95,7 +95,7 @@ struct _QERTextureInfo
struct _QERTextureLoad // returned by a plugin
{
_QERTextureLoad()
{
{
memset(reinterpret_cast<void*>(this), 0, sizeof(_QERTextureLoad));
};
@ -164,7 +164,7 @@ typedef void* (WINAPI *PFN_QERPLUG_GETTEXTUREINFO)();
// transparency (for water, fog, lava, etc.. ) can be emulated in the editor
// by passing in appropriate alpha data or by setting the appropriate surface flags
// expected by q2 (which the editor will use.. )
typedef void (WINAPI *PFN_QERPLUG_LOADTEXTURE)(const char* pFilename);
typedef void (WINAPI *PFN_QERPLUG_LOADTEXTURE)(const char* pFilename);
// v1.6
typedef void* (WINAPI *PFN_QERPLUG_GETSURFACEFLAGS)();
@ -206,7 +206,7 @@ typedef void (* PFN_QERAPP_LOADIMAGE) (const char *name, unsigned char **pic, in
typedef struct moduleentry_s {
const GUID *interface_GUID;
const char* interface_name;
const char* version_name;
const char* version_name;
} moduleentry_t;
#define QERPLUG_LISTINTERFACES "QERPlug_ListInterfaces"
@ -268,16 +268,16 @@ typedef char* (WINAPI* PFN_QERAPP_PROFILE_LOADSTR) (const char *filename, const
// 1. the list that contains brushes a plugin creates using CreateBrushHandle
// 2. the selected brush list (brushes the user has selected)
// 3. the active brush list (brushes in the map that are not selected)
//
//
// In general, the same things can be done to brush handles (face manip, delete brushhandle, etc.. ) in each
// list. There are a few exceptions.
// 1. You cannot commit a selected or active brush handle to the map. This is because it is already in the map.
// list. There are a few exceptions.
// 1. You cannot commit a selected or active brush handle to the map. This is because it is already in the map.
// 2. You cannot bind brush handles from the selected or active brush list to an entity. As of v1.0 of the plugins
// the only way for a plugin to create entities is to create a brush handles (or a list of handles) and then bind
// them to an entity. This will commit the brush(s) and/or the entities to the map as well.
//
//
// To use the active or selected brush lists, you must first allocate them (which returns a count) and then
// release them when you are finish manipulating brushes in one of those lists.
// release them when you are finish manipulating brushes in one of those lists.
//++timo NOTE : the #defines here are never used, but can help finding where things are done in the editor
#if 0
@ -311,7 +311,7 @@ typedef char* (WINAPI* PFN_QERAPP_PROFILE_LOADSTR) (const char *filename, const
#define QERAPP_GETCURRENTTEXTURE "QERApp_GetCurrentTexture"
#define QERAPP_SETCURRENTTEXTURE "QERApp_SetCurrentTexture"
// selection
// selection
#define QERAPP_DELETESELECTION "QERApp_DeleteSelection"
#define QERAPP_SELECTBRUSH "QERApp_SelectBrush" // PGM
#define QERAPP_DESELECTBRUSH "QERApp_DeselectBrush" // PGM
@ -347,8 +347,8 @@ typedef char* (WINAPI* PFN_QERAPP_PROFILE_LOADSTR) (const char *filename, const
// FIXME: new primtives do not work in v1.00
// primitives are new types of things in the map
// for instance, the Q3 curves could have been done as
// primitives instead of being built in
// for instance, the Q3 curves could have been done as
// primitives instead of being built in
// it will be a plugins responsibility to hook the map load and save funcs to load
// and/or save any additional data (like new primitives of some type)
// the editor will call each registered renderer during the rendering process to repaint
@ -356,10 +356,10 @@ typedef char* (WINAPI* PFN_QERAPP_PROFILE_LOADSTR) (const char *filename, const
// each primitive object has a temporary sibling brush that lives in the map
// FIXME: go backwards on this a bit.. orient it more towards the temp brush mode as it will be cleaner
// basically a plugin will hook the map load and save and will add the primitives to the map.. this will
// produce a temporary 'primitive' brush and the appropriate renderer will be called as well as the
// produce a temporary 'primitive' brush and the appropriate renderer will be called as well as the
// edit handler (for edge drags, sizes, rotates, etc.. ) and the vertex maker will be called when vertex
// mode is attemped on the brush.. there will need to be a GetPrimitiveBounds callback in the edit handler
// so the brush can resize appropriately as needed.. this might be the plugins responsibility to set the
// so the brush can resize appropriately as needed.. this might be the plugins responsibility to set the
// sibling brushes size.. it will then be the plugins responsibility to hook map save to save the primitives
// as the editor will discard any temp primitive brushes.. (there probably needs to be some kind of sanity check
// here as far as keeping the brushes and the plugin in sync.. i suppose the edit handler can deal with all of that
@ -495,7 +495,7 @@ typedef void (WINAPI * PFN_QERAPP_GETDISPATCHPARAMS)(vec3_t vMin, vec3_t vMax, b
typedef int (WINAPI * PFN_QERAPP_REQUESTINTERFACE)( REFGUID, void* );
// use this one for errors, Radiant will stop after the "edit preferences" dialog
typedef void (WINAPI * PFN_QERAPP_ERROR)(char* pMsg, ...);
typedef void (WINAPI * PFN_QERAPP_ERROR)(const char* pMsg, ...);
// use to gain read access to the project epairs
// FIXME: removed, accessed through QERPlug_RegisterPluginEntities with the IEpair interface
// typedef void (WINAPI* PFN_QERAPP_GETPROJECTEPAIR)(epair_t **);
@ -610,7 +610,7 @@ typedef const char* (* PFN_QERAPP_READPROJECTKEY)(const char* key);
typedef char* (* PFN_GETMAPFILENAME)();
typedef bfilter_t* (* PFN_QERPLUG_FILTERADD)(int type, int bmask, char *str, int exclude);
typedef bfilter_t* (* PFN_QERPLUG_FILTERADD)(int type, int bmask, const char *str, int exclude);
typedef void (* PFN_QERPLUG_FILTERACTIVATE) (void);

View File

@ -322,7 +322,7 @@ typedef struct face_s
vec3_t planepts[3];
texdef_t texdef;
plane_t plane;
// Nurail: Face Undo
int undoId;
int redoId;
@ -385,9 +385,9 @@ typedef struct {
#define PATCH_BEZIER 0x00000000 // default bezier
#define PATCH_BSPLINE 0x10000000 // bspline
#define PATCH_TYPEMASK 0x00000fff //
#define PATCH_BTYPEMASK 0x0000f000 //
#define PATCH_STYLEMASK 0xffff0000 //
#define PATCH_TYPEMASK 0x00000fff //
#define PATCH_BTYPEMASK 0x0000f000 //
#define PATCH_STYLEMASK 0xffff0000 //
typedef struct {
vec3_t xyz;
@ -468,7 +468,7 @@ typedef struct brush_s
// all are derived from brush_faces
qboolean patchBrush;
qboolean hiddenBrush;
//int nPatchID;
patchMesh_t *pPatch;
@ -575,8 +575,8 @@ extern eclass_t *eclass;
#define W_CAMERA_IFON 0x0100
#define W_XZ 0x0200 //--| only used for patch vertex manip stuff
#define W_YZ 0x0400 //--|
#define W_GROUP 0x0800
#define W_MEDIA 0x1000
#define W_GROUP 0x0800
#define W_MEDIA 0x1000
#define W_ALL 0xFFFFFFFF
// used in some Drawing routines
@ -693,7 +693,7 @@ struct entity_interfaces_t
IEdit *pEdit;
};
// MODEL END
typedef struct entity_s
{
struct entity_s *prev, *next;
@ -756,7 +756,7 @@ struct bfilter_t //c++ style
// 5=brush->face->texdef.flags (q2)
// 6=brush->face->texdef.contents (q2)
int mask;
char *string;
const char *string;
bool active;
};
@ -807,9 +807,9 @@ typedef struct
qboolean d_showgrid;
float d_gridsize;
qboolean d_bSmallGrid; // we use this flag to hack our way into editing of <1 grids
int d_num_entities;
entity_t *d_project_entity;
// defines the boundaries of the current work area
@ -839,24 +839,24 @@ typedef struct
xy_t d_xyOld;
SavedInfo_t d_savedinfo;
int d_workcount;
// connect entities uses the last two brushes selected
int d_select_count;
brush_t *d_select_order[2];
vec3_t d_select_translate; // for dragging w/o making new display lists
select_t d_select_mode;
int d_parsed_brushes;
qboolean show_blocks;
int blockSize;
// NOTE TTimo
// a lot of this data should be in a property bag and available to the other modules through an API
// this is generated from game configuration and the project settings, and should be still be part of it
// tells if we are internally using brush primitive (texture coordinates and map format)
// this is a shortcut for IntForKey( g_qeglobals.d_project_entity, "brush_primit" )
// NOTE: must keep the two ones in sync
@ -877,17 +877,17 @@ typedef struct
qboolean bNeedConvert;
qboolean bOldBrushes;
qboolean bPrimitBrushes;
vec3_t d_vAreaTL;
vec3_t d_vAreaBR;
// tells if we are using .INI files for prefs instead of registry
qboolean use_ini;
// even in .INI mode we use the registry for all void* prefs
char use_ini_registry[64];
// disabled all INI / registry read write .. used when shutting down after registry cleanup
qboolean disable_ini;
// tells we are using a BSP frontend plugin
qboolean bBSPFrontendPlugin;
@ -904,7 +904,7 @@ typedef struct
// http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=623
bool m_bOpenGLCompressionSupported;
bool m_bS3CompressionSupported;
// set to true after OpenGL has been initialized and extensions have been tested
bool m_bOpenGLReady;

View File

@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
#include "surfdlg_plugin.h"
@ -318,7 +319,7 @@ static void PopulateTextureComboList()
int num_of_list_items = 0;
blank[0] = 0;
if (texdef_face_list_empty())
{
items = g_list_append (items, (gpointer) blank);
@ -327,7 +328,7 @@ static void PopulateTextureComboList()
}
else if ( !is_TextureName_conflicting )
{
temp_texdef_face_list = get_texdef_face_list();
temp_texdef_face_list = get_texdef_face_list();
tmp_texdef = (texdef_t *) &get_texdef_face_list()->texdef;
items = g_list_append( items, (gpointer) tmp_texdef->GetName() );
// For Texture Entry, activate only on entry change
@ -353,7 +354,7 @@ static void PopulateTextureComboList()
// For Texture Entry, activate only on entry change
strcpy (old_texture_entry, blank);
}
gtk_combo_set_popdown_strings (GTK_COMBO (texture_combo), items);
g_list_free(items);
@ -375,7 +376,7 @@ static void GetTexdefInfo_from_Radiant()
unsigned int count = GetSelectedFaceCountfromBrushes();
if(count == 0)
count = GetSelectedFaceCount();
g_texdef_face_vector.resize(count);
if (!texdef_face_list_empty())
@ -383,9 +384,9 @@ static void GetTexdefInfo_from_Radiant()
texdef_to_face_t* p = get_texdef_face_list();
GetSelFacesTexdef( get_texdef_face_list() );
}
IsFaceConflicting();
PopulateTextureComboList();
PopulateTextureComboList();
ZeroOffsetValues();
}
@ -431,14 +432,14 @@ void UpdateSurfaceDialog()
{
if (!g_bListenUpdate)
return;
if (!SurfaceInspector)
return;
// avoid long delays on slow computers
while (gtk_events_pending ())
gtk_main_iteration ();
if (g_surfwin)
{
#ifdef DBG_SI
@ -459,7 +460,7 @@ void DoSurface (void)
#endif
if (!SurfaceInspector)
create_SurfaceInspector ();
ShowDlg();
SetTexMods ();
}
@ -546,7 +547,7 @@ void SetTexMods()
if (!g_surfwin)
return;
pt = &texturewin->texdef;
g_bListenChanged = false;
@ -554,24 +555,24 @@ void SetTexMods()
if(strncmp(pt->GetName(), "textures/", 9) != 0)
texdef_offset.SetName(SHADER_NOT_FOUND);
spin = GTK_SPIN_BUTTON (hshift_offset_spinbutton);
gtk_spin_button_set_value (spin, texdef_offset.shift[0]);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->shift[0];
gtk_spin_button_set_value (GTK_SPIN_BUTTON(hshift_step_spinbutton), l_pIncrement->shift[0]);
spin = GTK_SPIN_BUTTON (hshift_value_spinbutton);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->shift[0];
spin = GTK_SPIN_BUTTON (vshift_offset_spinbutton);
gtk_spin_button_set_value (spin, texdef_offset.shift[1]);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->shift[1];
gtk_spin_button_set_value (GTK_SPIN_BUTTON(vshift_step_spinbutton), l_pIncrement->shift[1]);
spin = GTK_SPIN_BUTTON (vshift_value_spinbutton);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->shift[1];
@ -587,29 +588,29 @@ void SetTexMods()
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->scale[0];
spin = GTK_SPIN_BUTTON (vscale_offset_spinbutton);
gtk_spin_button_set_value (spin, texdef_offset.scale[1]);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->scale[1];
gtk_spin_button_set_value (GTK_SPIN_BUTTON(vscale_step_spinbutton), l_pIncrement->scale[1]);
spin = GTK_SPIN_BUTTON (vscale_value_spinbutton);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->scale[1];
spin = GTK_SPIN_BUTTON (rotate_offset_spinbutton);
gtk_spin_button_set_value (spin, texdef_offset.rotate);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->rotate;
gtk_spin_button_set_value (GTK_SPIN_BUTTON(rotate_step_spinbutton), l_pIncrement->rotate);
spin = GTK_SPIN_BUTTON (rotate_value_spinbutton);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->rotate;
g_bListenChanged = true;
// store the current texdef as our escape route if user hits OnCancel
@ -655,7 +656,7 @@ void FitAll()
GtkWidget* create_SurfaceInspector (void)
{
GtkWidget *label;
GtkWidget *hseparator;
GtkWidget *eventbox;
@ -693,7 +694,7 @@ GtkWidget* create_SurfaceInspector (void)
SurfaceInspector = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width (GTK_CONTAINER (SurfaceInspector), 4);
gtk_window_set_title (GTK_WINDOW (SurfaceInspector), "Surface Inspector");
SetWinPos_from_Prefs(SurfaceInspector);
viewport8 = gtk_viewport_new (NULL, NULL);
@ -724,7 +725,7 @@ GtkWidget* create_SurfaceInspector (void)
texture_combo = gtk_combo_new ();
g_object_set_data (G_OBJECT (GTK_COMBO (texture_combo)->popwin),
"KeepMeAround", texture_combo);
gtk_combo_disable_activate ( (GtkCombo*) texture_combo);
gtk_combo_disable_activate ( (GtkCombo*) texture_combo);
gtk_widget_show (texture_combo);
gtk_box_pack_start (GTK_BOX (hbox1), texture_combo, TRUE, TRUE, 0);
@ -1025,7 +1026,7 @@ GtkWidget* create_SurfaceInspector (void)
gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (vscale_value_spinbutton), GTK_UPDATE_IF_VALID);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (vscale_value_spinbutton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET( vscale_value_spinbutton ), FALSE );
rotate_value_spinbutton_adj = gtk_adjustment_new (0.0, -360.0, 360.0, 1.0, 10.0, 10.0);
rotate_value_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (rotate_value_spinbutton_adj), 1, 0);
gtk_widget_show (rotate_value_spinbutton);
@ -1036,7 +1037,7 @@ GtkWidget* create_SurfaceInspector (void)
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (rotate_value_spinbutton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET( rotate_value_spinbutton ), FALSE );
// Offset Spins
// Offset Spins
hshift_offset_spinbutton_adj = gtk_adjustment_new (0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0);
hshift_offset_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (hshift_offset_spinbutton_adj), 0, 2);
gtk_widget_show (hshift_offset_spinbutton);
@ -1323,22 +1324,22 @@ GtkWidget* create_SurfaceInspector (void)
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
g_signal_connect ( (gpointer) SurfaceInspector,
"delete_event",
G_CALLBACK (delete_event_callback),
g_signal_connect ( (gpointer) SurfaceInspector,
"delete_event",
G_CALLBACK (delete_event_callback),
NULL );
g_signal_connect ((gpointer) SurfaceInspector, "destroy",
G_CALLBACK (gtk_widget_destroy),
NULL);
g_signal_connect ((gpointer) texture_combo_entry, "key_press_event",
G_CALLBACK (on_texture_combo_entry_key_press_event),
NULL);
g_signal_connect ((gpointer) texture_combo_entry, "activate",
G_CALLBACK (on_texture_combo_entry_activate),
NULL);
g_signal_connect ((gpointer) hshift_offset_spinbutton, "value_changed",
G_CALLBACK (on_hshift_offset_spinbutton_value_changed),
NULL);
@ -1354,7 +1355,7 @@ GtkWidget* create_SurfaceInspector (void)
g_signal_connect ((gpointer) rotate_offset_spinbutton, "value_changed",
G_CALLBACK (on_rotate_offset_spinbutton_value_changed),
NULL);
g_signal_connect ((gpointer) hshift_value_spinbutton, "value_changed",
G_CALLBACK (on_hshift_value_spinbutton_value_changed),
NULL);
@ -1370,7 +1371,7 @@ GtkWidget* create_SurfaceInspector (void)
g_signal_connect ((gpointer) rotate_value_spinbutton, "value_changed",
G_CALLBACK (on_rotate_value_spinbutton_value_changed),
NULL);
g_signal_connect ((gpointer) hshift_step_spinbutton, "value_changed",
G_CALLBACK (on_hshift_step_spinbutton_value_changed),
NULL);
@ -1386,14 +1387,14 @@ GtkWidget* create_SurfaceInspector (void)
g_signal_connect ((gpointer) rotate_step_spinbutton, "value_changed",
G_CALLBACK (on_rotate_step_spinbutton_value_changed),
NULL);
g_signal_connect ((gpointer) match_grid_button, "clicked",
G_CALLBACK (on_match_grid_button_clicked),
NULL);
g_signal_connect ((gpointer) lock_valuechange_togglebutton, "toggled",
G_CALLBACK (on_lock_valuechange_togglebutton_toggled),
NULL);
g_signal_connect ((gpointer) fit_width_spinbutton, "value_changed",
G_CALLBACK (on_fit_width_spinbutton_value_changed),
NULL);
@ -1403,11 +1404,11 @@ GtkWidget* create_SurfaceInspector (void)
g_signal_connect ((gpointer) fit_button, "clicked",
G_CALLBACK (on_fit_button_clicked),
NULL);
g_signal_connect ((gpointer) axial_button, "clicked",
G_CALLBACK (on_axial_button_clicked),
NULL);
g_signal_connect ((gpointer) done_button, "clicked",
G_CALLBACK (on_done_button_clicked),
NULL);
@ -1417,8 +1418,8 @@ GtkWidget* create_SurfaceInspector (void)
g_signal_connect ((gpointer) cancel_button, "clicked",
G_CALLBACK (on_cancel_button_clicked),
NULL);
return SurfaceInspector;
}
@ -1440,7 +1441,7 @@ void on_texture_combo_entry_activate (GtkEntry *entry, gpointer user_data)
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
char text[128] = { 0 };
if (!texdef_face_list_empty() && g_bListenChanged)
{
// activate only on entry change
@ -1451,7 +1452,7 @@ void on_texture_combo_entry_activate (GtkEntry *entry, gpointer user_data)
if (text[0] <= ' ' || strchr(text, ' '))
Sys_FPrintf(SYS_WRN, "WARNING: spaces in shader names are not allowed, ignoring '%s'\n", text);
else
{
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
{
tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
@ -1471,9 +1472,9 @@ static void on_hshift_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_offset.shift[0] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(hshift_offset_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@ -1494,9 +1495,9 @@ static void on_vshift_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_offset.shift[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vshift_offset_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@ -1510,7 +1511,7 @@ static void on_vshift_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
}
GetTexMods();
}
}
static void on_hscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data)
@ -1518,9 +1519,9 @@ static void on_hscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_offset.scale[0] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(hscale_offset_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@ -1534,8 +1535,8 @@ static void on_hscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
}
GetTexMods();
}
}
static void on_vscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data)
@ -1543,9 +1544,9 @@ static void on_vscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_offset.scale[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vscale_offset_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@ -1559,7 +1560,7 @@ static void on_vscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
}
GetTexMods();
}
}
static void on_rotate_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data)
@ -1567,9 +1568,9 @@ static void on_rotate_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_offset.rotate = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(rotate_offset_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@ -1583,7 +1584,7 @@ static void on_rotate_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
}
GetTexMods();
}
}
@ -1647,9 +1648,9 @@ static void on_vshift_value_spinbutton_value_changed (GtkSpinButton *spinbutton,
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_SI_values.shift[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vshift_value_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@ -1668,9 +1669,9 @@ static void on_hscale_value_spinbutton_value_changed (GtkSpinButton *spinbutton,
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_SI_values.scale[0] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(hscale_value_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@ -1689,9 +1690,9 @@ static void on_vscale_value_spinbutton_value_changed (GtkSpinButton *spinbutton,
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_SI_values.scale[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vscale_value_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@ -1710,9 +1711,9 @@ static void on_rotate_value_spinbutton_value_changed (GtkSpinButton *spinbutton,
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_SI_values.rotate = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(rotate_value_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)

View File

@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
#include "surfdlg_plugin.h"
@ -323,7 +324,7 @@ static void PopulateTextureComboList()
int num_of_list_items = 0;
blank[0] = 0;
if (texdef_face_list_empty())
{
items = g_list_append (items, (gpointer) blank);
@ -332,7 +333,7 @@ static void PopulateTextureComboList()
}
else if ( !is_TextureName_conflicting )
{
temp_texdef_face_list = get_texdef_face_list();
temp_texdef_face_list = get_texdef_face_list();
tmp_texdef = (texdef_t *) &get_texdef_face_list()->texdef;
items = g_list_append( items, (gpointer) tmp_texdef->GetName() );
// For Texture Entry, activate only on entry change
@ -358,7 +359,7 @@ static void PopulateTextureComboList()
// For Texture Entry, activate only on entry change
strcpy (old_texture_entry, blank);
}
gtk_combo_set_popdown_strings (GTK_COMBO (texture_combo), items);
g_list_free(items);
@ -380,7 +381,7 @@ static void GetTexdefInfo_from_Radiant()
unsigned int count = GetSelectedFaceCountfromBrushes();
if(count == 0)
count = GetSelectedFaceCount();
g_texdef_face_vector.resize(count);
if (!texdef_face_list_empty())
@ -388,9 +389,9 @@ static void GetTexdefInfo_from_Radiant()
texdef_to_face_t* p = get_texdef_face_list();
GetSelFacesTexdef( get_texdef_face_list() );
}
IsFaceConflicting();
PopulateTextureComboList();
PopulateTextureComboList();
ZeroOffsetValues();
if ( texdef_face_list_empty() )
SetFlagButtons_Heretic2( get_texdef_face_list() , TRUE);
@ -441,14 +442,14 @@ void UpdateSurfaceDialog()
{
if (!g_bListenUpdate)
return;
if (!SurfaceInspector)
return;
// avoid long delays on slow computers
while (gtk_events_pending ())
gtk_main_iteration ();
if (g_surfwin)
{
#ifdef DBG_SI
@ -469,7 +470,7 @@ void DoSurface (void)
#endif
if (!SurfaceInspector)
create_SurfaceInspector ();
ShowDlg();
SetTexMods ();
}
@ -556,7 +557,7 @@ void SetTexMods()
if (!g_surfwin)
return;
pt = &texturewin->texdef;
g_bListenChanged = false;
@ -564,24 +565,24 @@ void SetTexMods()
if(strncmp(pt->GetName(), "textures/", 9) != 0)
texdef_offset.SetName(SHADER_NOT_FOUND);
spin = GTK_SPIN_BUTTON (hshift_offset_spinbutton);
gtk_spin_button_set_value (spin, texdef_offset.shift[0]);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->shift[0];
gtk_spin_button_set_value (GTK_SPIN_BUTTON(hshift_step_spinbutton), l_pIncrement->shift[0]);
spin = GTK_SPIN_BUTTON (hshift_value_spinbutton);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->shift[0];
spin = GTK_SPIN_BUTTON (vshift_offset_spinbutton);
gtk_spin_button_set_value (spin, texdef_offset.shift[1]);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->shift[1];
gtk_spin_button_set_value (GTK_SPIN_BUTTON(vshift_step_spinbutton), l_pIncrement->shift[1]);
spin = GTK_SPIN_BUTTON (vshift_value_spinbutton);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->shift[1];
@ -597,29 +598,29 @@ void SetTexMods()
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->scale[0];
spin = GTK_SPIN_BUTTON (vscale_offset_spinbutton);
gtk_spin_button_set_value (spin, texdef_offset.scale[1]);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->scale[1];
gtk_spin_button_set_value (GTK_SPIN_BUTTON(vscale_step_spinbutton), l_pIncrement->scale[1]);
spin = GTK_SPIN_BUTTON (vscale_value_spinbutton);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->scale[1];
spin = GTK_SPIN_BUTTON (rotate_offset_spinbutton);
gtk_spin_button_set_value (spin, texdef_offset.rotate);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->rotate;
gtk_spin_button_set_value (GTK_SPIN_BUTTON(rotate_step_spinbutton), l_pIncrement->rotate);
spin = GTK_SPIN_BUTTON (rotate_value_spinbutton);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->rotate;
g_bListenChanged = true;
// store the current texdef as our escape route if user hits OnCancel
@ -666,7 +667,7 @@ void FitAll()
GtkWidget* create_SurfaceInspector (void)
{
GtkWidget *label;
GtkWidget *hseparator;
GtkWidget *eventbox;
@ -704,7 +705,7 @@ GtkWidget* create_SurfaceInspector (void)
SurfaceInspector = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width (GTK_CONTAINER (SurfaceInspector), 4);
gtk_window_set_title (GTK_WINDOW (SurfaceInspector), "Surface Inspector");
SetWinPos_from_Prefs(SurfaceInspector);
viewport8 = gtk_viewport_new (NULL, NULL);
@ -735,7 +736,7 @@ GtkWidget* create_SurfaceInspector (void)
texture_combo = gtk_combo_new ();
g_object_set_data (G_OBJECT (GTK_COMBO (texture_combo)->popwin),
"KeepMeAround", texture_combo);
gtk_combo_disable_activate ( (GtkCombo*) texture_combo);
gtk_combo_disable_activate ( (GtkCombo*) texture_combo);
gtk_widget_show (texture_combo);
gtk_box_pack_start (GTK_BOX (hbox1), texture_combo, TRUE, TRUE, 0);
@ -1036,7 +1037,7 @@ GtkWidget* create_SurfaceInspector (void)
gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (vscale_value_spinbutton), GTK_UPDATE_IF_VALID);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (vscale_value_spinbutton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET( vscale_value_spinbutton ), FALSE );
rotate_value_spinbutton_adj = gtk_adjustment_new (0.0, -360.0, 360.0, 1.0, 10.0, 10.0);
rotate_value_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (rotate_value_spinbutton_adj), 1, 0);
gtk_widget_show (rotate_value_spinbutton);
@ -1047,7 +1048,7 @@ GtkWidget* create_SurfaceInspector (void)
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (rotate_value_spinbutton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET( rotate_value_spinbutton ), FALSE );
// Offset Spins
// Offset Spins
hshift_offset_spinbutton_adj = gtk_adjustment_new (0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0);
hshift_offset_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (hshift_offset_spinbutton_adj), 0, 2);
gtk_widget_show (hshift_offset_spinbutton);
@ -1337,22 +1338,22 @@ GtkWidget* create_SurfaceInspector (void)
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
g_signal_connect ( (gpointer) SurfaceInspector,
"delete_event",
G_CALLBACK (delete_event_callback),
g_signal_connect ( (gpointer) SurfaceInspector,
"delete_event",
G_CALLBACK (delete_event_callback),
NULL );
g_signal_connect ((gpointer) SurfaceInspector, "destroy",
G_CALLBACK (gtk_widget_destroy),
NULL);
g_signal_connect ((gpointer) texture_combo_entry, "key_press_event",
G_CALLBACK (on_texture_combo_entry_key_press_event),
NULL);
g_signal_connect ((gpointer) texture_combo_entry, "activate",
G_CALLBACK (on_texture_combo_entry_activate),
NULL);
g_signal_connect ((gpointer) hshift_offset_spinbutton, "value_changed",
G_CALLBACK (on_hshift_offset_spinbutton_value_changed),
NULL);
@ -1368,7 +1369,7 @@ GtkWidget* create_SurfaceInspector (void)
g_signal_connect ((gpointer) rotate_offset_spinbutton, "value_changed",
G_CALLBACK (on_rotate_offset_spinbutton_value_changed),
NULL);
g_signal_connect ((gpointer) hshift_value_spinbutton, "value_changed",
G_CALLBACK (on_hshift_value_spinbutton_value_changed),
NULL);
@ -1384,7 +1385,7 @@ GtkWidget* create_SurfaceInspector (void)
g_signal_connect ((gpointer) rotate_value_spinbutton, "value_changed",
G_CALLBACK (on_rotate_value_spinbutton_value_changed),
NULL);
g_signal_connect ((gpointer) hshift_step_spinbutton, "value_changed",
G_CALLBACK (on_hshift_step_spinbutton_value_changed),
NULL);
@ -1400,14 +1401,14 @@ GtkWidget* create_SurfaceInspector (void)
g_signal_connect ((gpointer) rotate_step_spinbutton, "value_changed",
G_CALLBACK (on_rotate_step_spinbutton_value_changed),
NULL);
g_signal_connect ((gpointer) match_grid_button, "clicked",
G_CALLBACK (on_match_grid_button_clicked),
NULL);
g_signal_connect ((gpointer) lock_valuechange_togglebutton, "toggled",
G_CALLBACK (on_lock_valuechange_togglebutton_toggled),
NULL);
g_signal_connect ((gpointer) fit_width_spinbutton, "value_changed",
G_CALLBACK (on_fit_width_spinbutton_value_changed),
NULL);
@ -1417,11 +1418,11 @@ GtkWidget* create_SurfaceInspector (void)
g_signal_connect ((gpointer) fit_button, "clicked",
G_CALLBACK (on_fit_button_clicked),
NULL);
g_signal_connect ((gpointer) axial_button, "clicked",
G_CALLBACK (on_axial_button_clicked),
NULL);
g_signal_connect ((gpointer) done_button, "clicked",
G_CALLBACK (on_done_button_clicked),
NULL);
@ -1431,8 +1432,8 @@ GtkWidget* create_SurfaceInspector (void)
g_signal_connect ((gpointer) cancel_button, "clicked",
G_CALLBACK (on_cancel_button_clicked),
NULL);
return SurfaceInspector;
}
@ -1454,7 +1455,7 @@ void on_texture_combo_entry_activate (GtkEntry *entry, gpointer user_data)
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
char text[128] = { 0 };
if (!texdef_face_list_empty() && g_bListenChanged)
{
// activate only on entry change
@ -1465,7 +1466,7 @@ void on_texture_combo_entry_activate (GtkEntry *entry, gpointer user_data)
if (text[0] <= ' ' || strchr(text, ' '))
Sys_FPrintf(SYS_WRN, "WARNING: spaces in shader names are not allowed, ignoring '%s'\n", text);
else
{
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
{
tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
@ -1485,9 +1486,9 @@ static void on_hshift_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_offset.shift[0] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(hshift_offset_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@ -1508,9 +1509,9 @@ static void on_vshift_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_offset.shift[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vshift_offset_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@ -1524,7 +1525,7 @@ static void on_vshift_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
}
GetTexMods();
}
}
static void on_hscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data)
@ -1532,9 +1533,9 @@ static void on_hscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_offset.scale[0] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(hscale_offset_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@ -1548,8 +1549,8 @@ static void on_hscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
}
GetTexMods();
}
}
static void on_vscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data)
@ -1557,9 +1558,9 @@ static void on_vscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_offset.scale[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vscale_offset_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@ -1573,7 +1574,7 @@ static void on_vscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
}
GetTexMods();
}
}
static void on_rotate_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data)
@ -1581,9 +1582,9 @@ static void on_rotate_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_offset.rotate = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(rotate_offset_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@ -1597,7 +1598,7 @@ static void on_rotate_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
}
GetTexMods();
}
}
@ -1661,9 +1662,9 @@ static void on_vshift_value_spinbutton_value_changed (GtkSpinButton *spinbutton,
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_SI_values.shift[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vshift_value_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@ -1682,9 +1683,9 @@ static void on_hscale_value_spinbutton_value_changed (GtkSpinButton *spinbutton,
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_SI_values.scale[0] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(hscale_value_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@ -1703,9 +1704,9 @@ static void on_vscale_value_spinbutton_value_changed (GtkSpinButton *spinbutton,
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_SI_values.scale[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vscale_value_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@ -1724,9 +1725,9 @@ static void on_rotate_value_spinbutton_value_changed (GtkSpinButton *spinbutton,
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_SI_values.rotate = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(rotate_value_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)

View File

@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
#include "surfdlg_plugin.h"
@ -983,7 +984,7 @@ on_surf_value_entry_insert_text (GtkEditable *editable,
user_data);
}
gtk_signal_emit_stop_by_name (GTK_OBJECT (editable), "insert_text");
g_free (result);
}

View File

@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
#include "surfdlg_plugin.h"
@ -323,7 +324,7 @@ static void PopulateTextureComboList()
int num_of_list_items = 0;
blank[0] = 0;
if (texdef_face_list_empty())
{
items = g_list_append (items, (gpointer) blank);
@ -332,7 +333,7 @@ static void PopulateTextureComboList()
}
else if ( !is_TextureName_conflicting )
{
temp_texdef_face_list = get_texdef_face_list();
temp_texdef_face_list = get_texdef_face_list();
tmp_texdef = (texdef_t *) &get_texdef_face_list()->texdef;
items = g_list_append( items, (gpointer) tmp_texdef->GetName() );
// For Texture Entry, activate only on entry change
@ -358,7 +359,7 @@ static void PopulateTextureComboList()
// For Texture Entry, activate only on entry change
strcpy (old_texture_entry, blank);
}
gtk_combo_set_popdown_strings (GTK_COMBO (texture_combo), items);
g_list_free(items);
@ -380,7 +381,7 @@ static void GetTexdefInfo_from_Radiant()
unsigned int count = GetSelectedFaceCountfromBrushes();
if(count == 0)
count = GetSelectedFaceCount();
g_texdef_face_vector.resize(count);
if (!texdef_face_list_empty())
@ -388,9 +389,9 @@ static void GetTexdefInfo_from_Radiant()
texdef_to_face_t* p = get_texdef_face_list();
GetSelFacesTexdef( get_texdef_face_list() );
}
IsFaceConflicting();
PopulateTextureComboList();
PopulateTextureComboList();
ZeroOffsetValues();
if ( texdef_face_list_empty() )
SetFlagButtons_Quake2( get_texdef_face_list() , TRUE);
@ -440,14 +441,14 @@ void UpdateSurfaceDialog()
{
if (!g_bListenUpdate)
return;
if (!SurfaceInspector)
return;
// avoid long delays on slow computers
while (gtk_events_pending ())
gtk_main_iteration ();
if (g_surfwin)
{
#ifdef DBG_SI
@ -468,7 +469,7 @@ void DoSurface (void)
#endif
if (!SurfaceInspector)
create_SurfaceInspector ();
ShowDlg();
SetTexMods ();
}
@ -555,7 +556,7 @@ void SetTexMods()
if (!g_surfwin)
return;
pt = &texturewin->texdef;
g_bListenChanged = false;
@ -563,24 +564,24 @@ void SetTexMods()
if(strncmp(pt->GetName(), "textures/", 9) != 0)
texdef_offset.SetName(SHADER_NOT_FOUND);
spin = GTK_SPIN_BUTTON (hshift_offset_spinbutton);
gtk_spin_button_set_value (spin, texdef_offset.shift[0]);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->shift[0];
gtk_spin_button_set_value (GTK_SPIN_BUTTON(hshift_step_spinbutton), l_pIncrement->shift[0]);
spin = GTK_SPIN_BUTTON (hshift_value_spinbutton);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->shift[0];
spin = GTK_SPIN_BUTTON (vshift_offset_spinbutton);
gtk_spin_button_set_value (spin, texdef_offset.shift[1]);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->shift[1];
gtk_spin_button_set_value (GTK_SPIN_BUTTON(vshift_step_spinbutton), l_pIncrement->shift[1]);
spin = GTK_SPIN_BUTTON (vshift_value_spinbutton);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->shift[1];
@ -596,24 +597,24 @@ void SetTexMods()
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->scale[0];
spin = GTK_SPIN_BUTTON (vscale_offset_spinbutton);
gtk_spin_button_set_value (spin, texdef_offset.scale[1]);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->scale[1];
gtk_spin_button_set_value (GTK_SPIN_BUTTON(vscale_step_spinbutton), l_pIncrement->scale[1]);
spin = GTK_SPIN_BUTTON (vscale_value_spinbutton);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->scale[1];
spin = GTK_SPIN_BUTTON (rotate_offset_spinbutton);
gtk_spin_button_set_value (spin, texdef_offset.rotate);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->rotate;
gtk_spin_button_set_value (GTK_SPIN_BUTTON(rotate_step_spinbutton), l_pIncrement->rotate);
spin = GTK_SPIN_BUTTON (rotate_value_spinbutton);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->rotate;
@ -665,7 +666,7 @@ void FitAll()
GtkWidget* create_SurfaceInspector (void)
{
GtkWidget *label;
GtkWidget *hseparator;
GtkWidget *eventbox;
@ -703,7 +704,7 @@ GtkWidget* create_SurfaceInspector (void)
SurfaceInspector = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width (GTK_CONTAINER (SurfaceInspector), 4);
gtk_window_set_title (GTK_WINDOW (SurfaceInspector), "Surface Inspector");
SetWinPos_from_Prefs(SurfaceInspector);
viewport8 = gtk_viewport_new (NULL, NULL);
@ -734,7 +735,7 @@ GtkWidget* create_SurfaceInspector (void)
texture_combo = gtk_combo_new ();
g_object_set_data (G_OBJECT (GTK_COMBO (texture_combo)->popwin),
"KeepMeAround", texture_combo);
gtk_combo_disable_activate ( (GtkCombo*) texture_combo);
gtk_combo_disable_activate ( (GtkCombo*) texture_combo);
gtk_widget_show (texture_combo);
gtk_box_pack_start (GTK_BOX (hbox1), texture_combo, TRUE, TRUE, 0);
@ -1035,7 +1036,7 @@ GtkWidget* create_SurfaceInspector (void)
gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (vscale_value_spinbutton), GTK_UPDATE_IF_VALID);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (vscale_value_spinbutton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET( vscale_value_spinbutton ), FALSE );
rotate_value_spinbutton_adj = gtk_adjustment_new (0.0, -360.0, 360.0, 1.0, 10.0, 10.0);
rotate_value_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (rotate_value_spinbutton_adj), 1, 0);
gtk_widget_show (rotate_value_spinbutton);
@ -1046,7 +1047,7 @@ GtkWidget* create_SurfaceInspector (void)
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (rotate_value_spinbutton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET( rotate_value_spinbutton ), FALSE );
// Offset Spins
// Offset Spins
hshift_offset_spinbutton_adj = gtk_adjustment_new (0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0);
hshift_offset_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (hshift_offset_spinbutton_adj), 0, 2);
gtk_widget_show (hshift_offset_spinbutton);
@ -1336,22 +1337,22 @@ GtkWidget* create_SurfaceInspector (void)
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
g_signal_connect ( (gpointer) SurfaceInspector,
"delete_event",
G_CALLBACK (delete_event_callback),
g_signal_connect ( (gpointer) SurfaceInspector,
"delete_event",
G_CALLBACK (delete_event_callback),
NULL );
g_signal_connect ((gpointer) SurfaceInspector, "destroy",
G_CALLBACK (gtk_widget_destroy),
NULL);
g_signal_connect ((gpointer) texture_combo_entry, "key_press_event",
G_CALLBACK (on_texture_combo_entry_key_press_event),
NULL);
g_signal_connect ((gpointer) texture_combo_entry, "activate",
G_CALLBACK (on_texture_combo_entry_activate),
NULL);
g_signal_connect ((gpointer) hshift_offset_spinbutton, "value_changed",
G_CALLBACK (on_hshift_offset_spinbutton_value_changed),
NULL);
@ -1367,7 +1368,7 @@ GtkWidget* create_SurfaceInspector (void)
g_signal_connect ((gpointer) rotate_offset_spinbutton, "value_changed",
G_CALLBACK (on_rotate_offset_spinbutton_value_changed),
NULL);
g_signal_connect ((gpointer) hshift_value_spinbutton, "value_changed",
G_CALLBACK (on_hshift_value_spinbutton_value_changed),
NULL);
@ -1383,7 +1384,7 @@ GtkWidget* create_SurfaceInspector (void)
g_signal_connect ((gpointer) rotate_value_spinbutton, "value_changed",
G_CALLBACK (on_rotate_value_spinbutton_value_changed),
NULL);
g_signal_connect ((gpointer) hshift_step_spinbutton, "value_changed",
G_CALLBACK (on_hshift_step_spinbutton_value_changed),
NULL);
@ -1399,14 +1400,14 @@ GtkWidget* create_SurfaceInspector (void)
g_signal_connect ((gpointer) rotate_step_spinbutton, "value_changed",
G_CALLBACK (on_rotate_step_spinbutton_value_changed),
NULL);
g_signal_connect ((gpointer) match_grid_button, "clicked",
G_CALLBACK (on_match_grid_button_clicked),
NULL);
g_signal_connect ((gpointer) lock_valuechange_togglebutton, "toggled",
G_CALLBACK (on_lock_valuechange_togglebutton_toggled),
NULL);
g_signal_connect ((gpointer) fit_width_spinbutton, "value_changed",
G_CALLBACK (on_fit_width_spinbutton_value_changed),
NULL);
@ -1416,11 +1417,11 @@ GtkWidget* create_SurfaceInspector (void)
g_signal_connect ((gpointer) fit_button, "clicked",
G_CALLBACK (on_fit_button_clicked),
NULL);
g_signal_connect ((gpointer) axial_button, "clicked",
G_CALLBACK (on_axial_button_clicked),
NULL);
g_signal_connect ((gpointer) done_button, "clicked",
G_CALLBACK (on_done_button_clicked),
NULL);
@ -1430,8 +1431,8 @@ GtkWidget* create_SurfaceInspector (void)
g_signal_connect ((gpointer) cancel_button, "clicked",
G_CALLBACK (on_cancel_button_clicked),
NULL);
return SurfaceInspector;
}
@ -1453,7 +1454,7 @@ void on_texture_combo_entry_activate (GtkEntry *entry, gpointer user_data)
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
char text[128] = { 0 };
if (!texdef_face_list_empty() && g_bListenChanged)
{
// activate only on entry change
@ -1464,7 +1465,7 @@ void on_texture_combo_entry_activate (GtkEntry *entry, gpointer user_data)
if (text[0] <= ' ' || strchr(text, ' '))
Sys_FPrintf(SYS_WRN, "WARNING: spaces in shader names are not allowed, ignoring '%s'\n", text);
else
{
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
{
tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
@ -1484,9 +1485,9 @@ static void on_hshift_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_offset.shift[0] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(hshift_offset_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@ -1507,9 +1508,9 @@ static void on_vshift_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_offset.shift[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vshift_offset_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@ -1523,7 +1524,7 @@ static void on_vshift_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
}
GetTexMods();
}
}
static void on_hscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data)
@ -1531,9 +1532,9 @@ static void on_hscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_offset.scale[0] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(hscale_offset_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@ -1547,8 +1548,8 @@ static void on_hscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
}
GetTexMods();
}
}
static void on_vscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data)
@ -1556,9 +1557,9 @@ static void on_vscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_offset.scale[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vscale_offset_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@ -1572,7 +1573,7 @@ static void on_vscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
}
GetTexMods();
}
}
static void on_rotate_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data)
@ -1580,9 +1581,9 @@ static void on_rotate_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_offset.rotate = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(rotate_offset_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@ -1596,7 +1597,7 @@ static void on_rotate_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
}
GetTexMods();
}
}
@ -1660,9 +1661,9 @@ static void on_vshift_value_spinbutton_value_changed (GtkSpinButton *spinbutton,
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_SI_values.shift[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vshift_value_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@ -1681,9 +1682,9 @@ static void on_hscale_value_spinbutton_value_changed (GtkSpinButton *spinbutton,
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_SI_values.scale[0] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(hscale_value_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@ -1702,9 +1703,9 @@ static void on_vscale_value_spinbutton_value_changed (GtkSpinButton *spinbutton,
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_SI_values.scale[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vscale_value_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@ -1723,9 +1724,9 @@ static void on_rotate_value_spinbutton_value_changed (GtkSpinButton *spinbutton,
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_SI_values.rotate = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(rotate_value_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)

View File

@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
#include "surfdlg_plugin.h"

View File

@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
#include "surfdlg_plugin.h"

View File

@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
#include "surfdlg_plugin.h"

View File

@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// standard headers
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <stdio.h>
#include <stdlib.h>
@ -43,25 +44,25 @@ typedef char* LPCSTR;
#define MB_YESNOCANCEL 0x00000003L
#define MB_YESNO 0x00000004L
#define MB_RETRYCANCEL 0x00000005L
#define MB_ICONHAND 0x00000010L
#define MB_ICONQUESTION 0x00000020L
#define MB_ICONEXCLAMATION 0x00000030L
#define MB_ICONASTERISK 0x00000040L
#define MB_USERICON 0x00000080L
#define MB_ICONWARNING MB_ICONEXCLAMATION
#define MB_ICONERROR MB_ICONHAND
#define MB_ICONINFORMATION MB_ICONASTERISK
#define MB_ICONSTOP MB_ICONHAND
#define MB_TYPEMASK 0x0000000FL
#define MB_ICONMASK 0x000000F0L
#define MB_DEFMASK 0x00000F00L
#define MB_MODEMASK 0x00003000L
#define MB_MISCMASK 0x0000C000L
#define IDOK 1
#define IDCANCEL 2
#define IDABORT 3
@ -146,7 +147,7 @@ public:
// CSynapseClient API
bool RequestAPI(APIDescriptor_t *pAPI);
const char* GetInfo();
CSynapseClientTexTool() { }
virtual ~CSynapseClientTexTool() { }
};

View File

@ -69,7 +69,7 @@ void PrintWinding (winding_t *w)
void PrintPlane (plane_t *p)
{
Sys_Printf ("(%5.2f, %5.2f, %5.2f) : %5.2f\n", p->normal[0], p->normal[1],
Sys_Printf ("(%5.2f, %5.2f, %5.2f) : %5.2f\n", p->normal[0], p->normal[1],
p->normal[2], p->dist);
}
@ -108,10 +108,10 @@ void TextureAxisFromPlane(plane_t *pln, vec3_t xv, vec3_t yv)
int bestaxis;
float dot,best;
int i;
best = 0;
bestaxis = 0;
for (i=0 ; i<6 ; i++)
{
dot = DotProduct (pln->normal, baseaxis[i*3]);
@ -121,7 +121,7 @@ void TextureAxisFromPlane(plane_t *pln, vec3_t xv, vec3_t yv)
bestaxis = i;
}
}
VectorCopy (baseaxis[bestaxis*3+1], xv);
VectorCopy (baseaxis[bestaxis*3+2], yv);
}
@ -143,7 +143,7 @@ float SetShadeForPlane (plane_t *p)
{
//return ShadeForNormal(p->normal);
int i;
float f;
@ -166,7 +166,7 @@ float SetShadeForPlane (plane_t *p)
// other
f= (lightaxis[0] + lightaxis[1] + lightaxis[2]) / 3;
return f;
}
vec3_t vecs[2];
@ -315,7 +315,7 @@ void Face_MoveTexture(face_t *f, vec3_t delta)
f->texdef.shift[0] -= vShift[0] / f->texdef.scale[0];
f->texdef.shift[1] -= vShift[1] / f->texdef.scale[1];
// clamp the shifts
Clamp(f->texdef.shift[0], f->d_texture->width);
Clamp(f->texdef.shift[1], f->d_texture->height);
@ -328,7 +328,7 @@ Face_SetColor
================
*/
/*!\todo Replace all face_t::d_texture access with face_t::pShader::GetTexture.*/
void Face_SetColor (brush_t *b, face_t *f, float fCurveColor)
void Face_SetColor (brush_t *b, face_t *f, float fCurveColor)
{
// set shading for face
f->d_shade = SetShadeForPlane (&f->plane);
@ -381,7 +381,7 @@ void Face_TextureVectors (face_t *f, float STfromXYZ[2][4])
else if (td->rotate == 270)
{ sinv = -1 ; cosv = 0; }
else
{
{
ang = td->rotate / 180 * Q_PI;
sinv = sin(ang);
cosv = cos(ang);
@ -393,14 +393,14 @@ void Face_TextureVectors (face_t *f, float STfromXYZ[2][4])
sv = 1;
else
sv = 2;
if (pvecs[1][0])
tv = 0;
else if (pvecs[1][1])
tv = 1;
else
tv = 2;
for (i=0 ; i<2 ; i++) {
ns = cosv * pvecs[i][sv] - sinv * pvecs[i][tv];
nt = sinv * pvecs[i][sv] + cosv * pvecs[i][tv];
@ -440,7 +440,7 @@ void Face_MakePlane (face_t *f)
t2[j] = f->planepts[2][j] - f->planepts[1][j];
t3[j] = f->planepts[1][j];
}
CrossProduct(t1,t2, f->plane.normal);
if (VectorCompare (f->plane.normal, vec3_origin))
Sys_FPrintf (SYS_WRN, "WARNING: brush plane with no normal\n");
@ -510,7 +510,7 @@ void DrawBrushEntityName (brush_t *b)
s = sin (a/180*Q_PI);
c = cos (a/180*Q_PI);
for (i=0 ; i<3 ; i++)
mid[i] = (b->mins[i] + b->maxs[i])*0.5;
mid[i] = (b->mins[i] + b->maxs[i])*0.5;
qglBegin (GL_LINE_STRIP);
qglVertex3fv (mid);
@ -590,12 +590,12 @@ winding_t *Brush_MakeFaceWinding (brush_t *b, face_t *face)
// flip the plane, because we want to keep the back side
VectorSubtract (vec3_origin,clip->plane.normal, plane.normal);
plane.dist = -clip->plane.dist;
w = Winding_Clip (w, &plane, false);
if (!w)
return w;
}
if (w->numpoints < 3)
{
free(w);
@ -636,7 +636,7 @@ void Brush_SnapPlanepts (brush_t *b)
f->planepts[i][j] = floor (f->planepts[i][j] + 0.5);
}
}
/*
** Brush_Build
**
@ -650,7 +650,7 @@ void Brush_Build( brush_t *b, bool bSnap, bool bMarkMap, bool bConvert, bool bFi
{
bool bLocalConvert;
#ifdef _DEBUG
if (!g_qeglobals.m_bBrushPrimitMode && bConvert)
Sys_Printf("Warning : conversion from brush primitive to old brush format not implemented\n");
@ -679,7 +679,7 @@ void Brush_Build( brush_t *b, bool bSnap, bool bMarkMap, bool bConvert, bool bFi
const aabb_t *aabb = b->owner->model.pRender->GetAABB();
VectorAdd(aabb->origin, aabb->extents, b->maxs);
VectorSubtract(aabb->origin, aabb->extents, b->mins);
}
}
//Patch_BuildPoints (b); // does nothing but set b->patchBrush true if the texdef contains SURF_PATCH !
@ -1277,7 +1277,7 @@ void Brush_SetEpair(brush_t *b, const char *pKey, const char *pValue)
}
}
/*
/*
=================
Brush_GetKeyValue
=================
@ -1324,9 +1324,9 @@ void CheckName( face_t *fa, char *pname )
if (strchr( fa->texdef.GetName(), ' ' ))
{
char Msg1[1024];
sprintf( Msg1, "Can't save texture with spaces in name. Rename %s\nNOTE: This message may popup several times .. once for each buggy face detected.", fa->texdef.GetName() );
Sys_Printf("%s\n", Msg1 );
gtk_MessageBox(g_pParentWnd->m_pWidget, Msg1, "Error saving map", MB_OK );
strcpy( pname, SHADER_NOT_FOUND );
@ -1337,7 +1337,7 @@ void CheckName( face_t *fa, char *pname )
// TODO: clean this detection part when bug will have disappeared
if (fa->texdef.GetName()[0] == '(')
{
char *text = "Bug #103494 detected, dropping texture. Please report to timo@qeradiant.com if you have a way to reproduce!\nNOTE: this message may popup several times .. once for each buggy face detected.";
const char *text = "Bug #103494 detected, dropping texture. Please report to timo@qeradiant.com if you have a way to reproduce!\nNOTE: this message may popup several times .. once for each buggy face detected.";
Sys_Printf("%s\n", text);
gtk_MessageBox(g_pParentWnd->m_pWidget, text, "Error saving map", MB_OK );
// need to cleanup this dead face name or we may loop endlessly
@ -1381,19 +1381,19 @@ brush_t *Brush_Create (vec3_t mins, vec3_t maxs, texdef_t *texdef)
}
b = Brush_Alloc();
pts[0][0][0] = mins[0];
pts[0][0][1] = mins[1];
pts[1][0][0] = mins[0];
pts[1][0][1] = maxs[1];
pts[2][0][0] = maxs[0];
pts[2][0][1] = maxs[1];
pts[3][0][0] = maxs[0];
pts[3][0][1] = mins[1];
for (i=0 ; i<4 ; i++)
{
pts[i][0][2] = mins[2];
@ -1416,7 +1416,7 @@ brush_t *Brush_Create (vec3_t mins, vec3_t maxs, texdef_t *texdef)
VectorCopy (pts[i][1], f->planepts[1]);
VectorCopy (pts[i][0], f->planepts[2]);
}
f = Face_Alloc();
f->texdef = *texdef;
f->texdef.flags &= ~SURF_KEEP;
@ -1593,7 +1593,7 @@ void Brush_MakeSided (int sides)
}
b = Brush_Alloc();
// create top face
f = Face_Alloc();
f->texdef = *texdef;
@ -1872,7 +1872,7 @@ bool Triangle_Ray(vec3_t origin, vec3_t dir, vec3_t p1, vec3_t p2, vec3_t p3)
//Sys_Printf("p2: %f %f %f\n",p2[0],p2[1],p2[2]);
//Sys_Printf("p3: %f %f %f\n",p3[0],p3[1],p3[2]);
//Sys_Printf("origin: %f %f %f\n",origin[0],origin[1],origin[2]);
// test ray against triangle
// get triangle plane normal
//VectorSubtract(p1, p2, v1);
@ -1906,7 +1906,7 @@ bool Triangle_Ray(vec3_t origin, vec3_t dir, vec3_t p1, vec3_t p2, vec3_t p3)
// VectorSubtract(origin, p1, v2);
// CrossProduct(v1, v2, normal[2]);
//}
for (i=0; i<3; i++)
{
VectorNormalize(normal[i]);
@ -1935,7 +1935,7 @@ bool Model_Ray(brush_t *b, vec3_t origin, vec3_t dir, double *t, double *u, doub
vec3_t vRay[2];
float angle = FloatForKey (b->owner, "angle"); // FIXME: should be set when this entity key is set
VectorSubtract (origin, b->owner->origin, vRay[0]);
VectorCopy (dir, vRay[1]);
@ -1965,7 +1965,7 @@ bool Model_Ray(brush_t *b, vec3_t origin, vec3_t dir, double *t, double *u, doub
{
for (j = 0; j < 3; j++)
VectorCopy(model->pVertList[model->pTriList[i].indexes[j]].v, xyz[j]);
if (Triangle_Ray(vRay[0], vRay[1], true, xyz[0], xyz[2], xyz[1], t, u, v))
{
bIntersect = true;
@ -2062,7 +2062,7 @@ face_t *Brush_Ray (vec3_t origin, vec3_t dir, brush_t *b, float *dist, int nFlag
d1 = DotProduct (p1, dir);
*dist = d1;
// new test stuff for patches
if (!g_PrefsDlg.m_bPatchBBoxSelect && b->patchBrush)
{
@ -2081,8 +2081,8 @@ face_t *Brush_Ray (vec3_t origin, vec3_t dir, brush_t *b, float *dist, int nFlag
// IMPORTANT NOTE:
// modifications to the discarding code here should be matched in the selection code
// see Brush_Draw
// see Brush_Draw
// do some last minute filtering
if (firstface && nFlags & SF_CAMERA)
{
@ -2101,7 +2101,7 @@ face_t *Brush_Ray (vec3_t origin, vec3_t dir, brush_t *b, float *dist, int nFlag
*dist = 0;
return NULL;
}
}
}
if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_CLIP)
{
if (strstr(firstface->texdef.GetName(), "clip"))
@ -2139,7 +2139,7 @@ void Brush_AddToList (brush_t *b, brush_t *blist)
{
if (b->next || b->prev)
Error ("Brush_AddToList: already linked");
if (blist == &selected_brushes || blist == &active_brushes)
{
if (b->patchBrush && blist == &selected_brushes)
@ -2151,16 +2151,16 @@ void Brush_AddToList (brush_t *b, brush_t *blist)
blist->next->prev = b;
blist->next = b;
b->prev = blist;
// TTimo messaging
DispatchRadiantMsg( RADIANT_SELECTION );
DispatchRadiantMsg( RADIANT_SELECTION );
}
void Brush_RemoveFromList (brush_t *b)
{
if (!b->next || !b->prev)
Error ("Brush_RemoveFromList: not linked");
if (b->patchBrush)
{
Patch_Deselect(b->pPatch);
@ -2244,12 +2244,12 @@ void SetFaceTexdef2 (brush_t *b, face_t *f, IShader *pShader, texdef_t *texdef,
SetFaceTexdef
Doesn't set the curve flags
NOTE : ( TTimo )
never trust f->d_texture here, f->texdef and f->d_texture are out of sync when called by Brush_SetTexture
use Texture_ForName() to find the right shader
FIXME : send the right shader ( qtexture_t * ) in the parameters ?
TTimo: surface plugin, added an IPluginTexdef* parameter
if not NULL, get ->Copy() of it into the face ( and remember to hook )
if NULL, ask for a default
@ -2258,7 +2258,7 @@ NOTE : ( TTimo )
void SetFaceTexdef (face_t *f, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, IPluginTexdef* pPlugTexdef) {
int oldFlags;
int oldContents;
oldFlags = f->texdef.flags;
oldContents = f->texdef.contents;
@ -2271,7 +2271,7 @@ void SetFaceTexdef (face_t *f, texdef_t *texdef, brushprimit_texdef_t *brushprim
ConvertTexMatWithQTexture( brushprimit_texdef, NULL, &f->brushprimit_texdef, QERApp_Shader_ForName( f->texdef.GetName() )->getTexture() );
}
else
{
{
if (bFitScale)
{
f->texdef = *texdef;
@ -2301,11 +2301,11 @@ void SetFaceTexdef (face_t *f, texdef_t *texdef, brushprimit_texdef_t *brushprim
f->texdef.flags = (f->texdef.flags & ~SURF_KEEP) | (oldFlags & SURF_KEEP);
f->texdef.contents = (f->texdef.contents & ~CONTENTS_KEEP) | (oldContents & CONTENTS_KEEP);
}
#ifdef _DEBUG
void Brush_SetTexture2 (brush_t *b, IShader *pShader, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, IPluginTexdef* pTexdef)
{
for (face_t* f = b->brush_faces ; f ; f = f->next)
for (face_t* f = b->brush_faces ; f ; f = f->next)
SetFaceTexdef2 (b, f, pShader, texdef, brushprimit_texdef, bFitScale, pTexdef);
Brush_Build( b );
if (b->patchBrush)
@ -2318,7 +2318,7 @@ void Brush_SetTexture2 (brush_t *b, IShader *pShader, texdef_t *texdef, brushpri
void Brush_SetTexture (brush_t *b, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale, IPluginTexdef* pTexdef)
{
for (face_t* f = b->brush_faces ; f ; f = f->next)
for (face_t* f = b->brush_faces ; f ; f = f->next)
SetFaceTexdef (f, texdef, brushprimit_texdef, bFitScale, pTexdef);
Brush_Build( b );
if (b->patchBrush)
@ -2414,7 +2414,7 @@ void Brush_SelectFaceForDragging (brush_t *b, face_t *f, qboolean shear)
}
// if shearing, take all the planes adjacent to
// if shearing, take all the planes adjacent to
// selected faces and rotate their points so the
// edge clipped by a selcted face has two of the points
if (!shear)
@ -2431,7 +2431,7 @@ void Brush_SelectFaceForDragging (brush_t *b, face_t *f, qboolean shear)
// any points on f will become new control points
for (i=0 ; i<w->numpoints ; i++)
{
d = DotProduct (w->points[i], f->plane.normal)
d = DotProduct (w->points[i], f->plane.normal)
- f->plane.dist;
if (d > -ON_EPSILON && d < ON_EPSILON)
break;
@ -2457,7 +2457,7 @@ void Brush_SelectFaceForDragging (brush_t *b, face_t *f, qboolean shear)
VectorCopy (w->points[i], f2->planepts[0]);
if (++i == w->numpoints)
i = 0;
// see if the next point is also on the plane
d = DotProduct (w->points[i]
, f->plane.normal) - f->plane.dist;
@ -2512,7 +2512,7 @@ void Brush_SideSelect (brush_t *b, vec3_t origin, vec3_t dir
continue;
Brush_SelectFaceForDragging (b, f, shear);
}
}
}
bool g_bBuildWindingsNoTexBuild = false;
@ -2577,7 +2577,7 @@ void Brush_BuildWindings( brush_t *b, bool bSnap )
if (!w)
continue;
for (i=0 ; i<w->numpoints ; i++)
{
// add to bounding box
@ -2706,7 +2706,7 @@ void Brush_SnapToGrid(brush_t *pb)
else // multiplier = gridsize / component difference, rounded up
mult[i] = (int)ceil(fabs(g_qeglobals.d_gridsize / diff[j][i]));
}
if (mult[0] > 1 && mult[1] > 1 && mult[2] > 1) // if all multipliers are greater than 1
{
n = (mult[0] >= mult[1] && mult[0] >= mult[2]) ? 0 : (mult[1] >= mult[0] && mult[1] >= mult[2]) ? 1 : 2;
@ -2879,7 +2879,7 @@ void Brush_FaceDraw(face_t *face, int nGLState)
qglBegin(GL_TRIANGLE_FAN);
else
qglBegin(GL_POLYGON);
for (int i=0 ; i<w->numpoints ; i++)
{
if (nGLState & DRAW_GL_TEXTURE_2D)
@ -2937,7 +2937,7 @@ void Brush_Draw(brush_t *b)
continue;
if (!bTrans && nGLState & DRAW_GL_BLEND)
continue;
// IMPORTANT NOTE:
// modifications to the discarding code here should be matched in the selection code
// see Brush_Ray
@ -2971,7 +2971,7 @@ void Brush_Draw(brush_t *b)
prev = face->d_texture;
qglBindTexture( GL_TEXTURE_2D, face->d_texture->texture_number );
}
if (nGLState & DRAW_GL_LIGHTING && !g_PrefsDlg.m_bGLLighting)
{
if (!b->owner->eclass->fixedsize)
@ -2996,7 +2996,7 @@ void Brush_Draw(brush_t *b)
else
qglColor4fv(material);
}
// draw the polygon
Brush_FaceDraw(face, nGLState);
@ -3019,9 +3019,9 @@ void Face_Draw( face_t *f )
entity_t *FindEntity(const char *pszKey, const char *pszValue)
{
entity_t *pe;
pe = entities.next;
for (; pe != NULL && pe != &entities ; pe = pe->next)
{
if (!strcmp(ValueForKey(pe, pszKey), pszValue))
@ -3043,7 +3043,7 @@ void Brush_DrawXY(brush_t *b, int nViewType)
Patch_DrawXY(b->pPatch);
if (!g_bPatchShowBounds)
return;
}
}
if (b->owner->eclass->fixedsize)
{
@ -3144,7 +3144,7 @@ void Brush_DrawXY(brush_t *b, int nViewType)
if (face->plane.normal[1] >= 0) // stop axes being mirrored
continue;
}
else
else
{
if (face->plane.normal[0] <= 0)
continue;
@ -3430,14 +3430,14 @@ void Face_FitTexture( face_t * face, int nHeight, int nWidth )
vec3_t vecs[2];
vec3_t coords[4];
texdef_t *td;
if (nHeight < 1)
nHeight = 1;
if (nWidth < 1)
nWidth = 1;
ClearBounds (mins, maxs);
w = face->face_winding;
if (!w)
{
@ -3447,12 +3447,12 @@ void Face_FitTexture( face_t * face, int nHeight, int nWidth )
{
AddPointToBounds( w->points[i], mins, maxs );
}
if (g_qeglobals.m_bBrushPrimitMode)
Face_FitTexture_BrushPrimit( face, mins, maxs, nHeight, nWidth );
else
{
td = &face->texdef;
//
// get the current angle
@ -3460,10 +3460,10 @@ void Face_FitTexture( face_t * face, int nHeight, int nWidth )
ang = td->rotate / 180 * Q_PI;
sinv = sin(ang);
cosv = cos(ang);
// get natural texture axis
TextureAxisFromPlane(&face->plane, vecs[0], vecs[1]);
min_s = DotProduct( mins, vecs[0] );
min_t = DotProduct( mins, vecs[1] );
max_s = DotProduct( maxs, vecs[0] );
@ -3517,22 +3517,22 @@ void Face_FitTexture( face_t * face, int nHeight, int nWidth )
rot_height = (max_t - min_t);
td->scale[0] = -(rot_width/((float)(face->d_texture->width*nWidth)));
td->scale[1] = -(rot_height/((float)(face->d_texture->height*nHeight)));
td->shift[0] = min_s/td->scale[0];
temp = (int)(td->shift[0] / (face->d_texture->width*nWidth));
temp = (temp+1)*face->d_texture->width*nWidth;
td->shift[0] = (int)(temp - td->shift[0])%(face->d_texture->width*nWidth);
td->shift[1] = min_t/td->scale[1];
temp = (int)(td->shift[1] / (face->d_texture->height*nHeight));
temp = (temp+1)*(face->d_texture->height*nHeight);
td->shift[1] = (int)(temp - td->shift[1])%(face->d_texture->height*nHeight);
td->shift[1] = min_t/td->scale[1];
temp = (int)(td->shift[1] / (face->d_texture->height*nHeight));
temp = (temp+1)*(face->d_texture->height*nHeight);
td->shift[1] = (int)(temp - td->shift[1])%(face->d_texture->height*nHeight);
}
}
@ -3627,7 +3627,7 @@ void aabb_draw(const aabb_t *aabb, int mode)
{ 0, 1, 0 },
{ 1, 0, 0 },
{ 0,-1, 0 } };
unsigned short Indices[24] = { 2, 1, 5, 6,
1, 0, 4, 5,
0, 1, 2, 3,
@ -3637,11 +3637,11 @@ void aabb_draw(const aabb_t *aabb, int mode)
qglVertexPointer(3, GL_FLOAT, 0, Coords); // filling the arrays
qglNormalPointer(GL_FLOAT, 0, Normals);
//glLockArraysEXT(0, count); // extension GL_EXT_compiled_vertex_array
qglDrawElements(GL_QUADS, 24, GL_UNSIGNED_SHORT, Indices);
//glUnlockArraysEXT; // extension GL_EXT_compiled_vertex_array
*/
}

View File

@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "stdafx.h"
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <GL/gl.h>
extern void DrawPathLines();
@ -81,11 +82,11 @@ void CamWnd::OnCreate ()
// I Split this up so as to add support for extension and user-friendly
// compression format selection.
// ADD new globals for your new format so as to minimise
// calls to Sys_QGL_ExtensionSupported
// calls to Sys_QGL_ExtensionSupported
// NOTE TTimo: I don't really like this approach with globals. Frequent calls to Sys_QGL_ExtensionSupported don't sound like
// a problem to me. If there is some caching to be done, then I think it should be inside Sys_QGL_ExtensionSupported
///////////////////////////////////////////
// Check for default OpenGL
// Check for default OpenGL
if (Sys_QGL_ExtensionSupported ("GL_ARB_texture_compression"))
{
g_qeglobals.bTextureCompressionSupported = 1;
@ -100,9 +101,9 @@ void CamWnd::OnCreate ()
g_qeglobals.bTextureCompressionSupported = 1;
g_qeglobals.m_bS3CompressionSupported = 1;
}
g_qeglobals.m_bOpenGLReady = true;
g_PrefsDlg.UpdateTextureCompression();
#ifdef ATIHACK_812
@ -124,7 +125,7 @@ void CamWnd::Cam_Init ()
m_nCambuttonstate = 0;
}
void CamWnd::OnSize(int cx, int cy)
void CamWnd::OnSize(int cx, int cy)
{
m_Camera.width = cx;
m_Camera.height = cy;
@ -148,7 +149,7 @@ void update_xor_rectangle(XORRectangle& xor_rectangle)
xor_rectangle.set(rectangle);
}
void CamWnd::OnMouseMove(guint32 flags, int pointx, int pointy)
void CamWnd::OnMouseMove(guint32 flags, int pointx, int pointy)
{
int height = m_pWidget->allocation.height;
// NOTE RR2DO2 this hasn't got any use anymore really. It is an old qeradiant feature
@ -188,34 +189,34 @@ void CamWnd::OnMouseWheel(bool bUp)
g_pParentWnd->OnTimer ();
}
void CamWnd::OnLButtonDown(guint32 nFlags, int pointx, int pointy)
void CamWnd::OnLButtonDown(guint32 nFlags, int pointx, int pointy)
{
m_ptLastCursorX = pointx;
m_ptLastCursorY = pointy;
OriginalMouseDown(nFlags, pointx, pointy);
}
void CamWnd::OnLButtonUp(guint32 nFlags, int pointx, int pointy)
void CamWnd::OnLButtonUp(guint32 nFlags, int pointx, int pointy)
{
OriginalMouseUp(nFlags, pointx, pointy);
}
void CamWnd::OnMButtonDown(guint32 nFlags, int pointx, int pointy)
void CamWnd::OnMButtonDown(guint32 nFlags, int pointx, int pointy)
{
OriginalMouseDown(nFlags, pointx, pointy);
}
void CamWnd::OnMButtonUp(guint32 nFlags, int pointx, int pointy)
void CamWnd::OnMButtonUp(guint32 nFlags, int pointx, int pointy)
{
OriginalMouseUp(nFlags, pointx, pointy);
}
void CamWnd::OnRButtonDown(guint32 nFlags, int pointx, int pointy)
void CamWnd::OnRButtonDown(guint32 nFlags, int pointx, int pointy)
{
OriginalMouseDown(nFlags, pointx, pointy);
}
void CamWnd::OnRButtonUp(guint32 nFlags, int pointx, int pointy)
void CamWnd::OnRButtonUp(guint32 nFlags, int pointx, int pointy)
{
OriginalMouseUp(nFlags, pointx, pointy);
}
@ -362,7 +363,7 @@ void CamWnd::Cam_MouseControl (float dtime)
Sys_SetCursorPos(m_ptLastCamCursorX, m_ptLastCamCursorY);
// Don't use pitch
// Don't use pitch
if(!g_PrefsDlg.m_bCamFreeLookStrafe) {
if (g_PrefsDlg.m_bCamInverseMouse)
m_Camera.angles[PITCH] -= dy * dtime * g_PrefsDlg.m_nAngleSpeed;
@ -415,7 +416,7 @@ void CamWnd::Cam_MouseControl (float dtime)
xh = xl*2;
yl = m_Camera.height/3;
yh = yl*2;
xf *= 1.0 - fabs(yf);
if (xf < 0)
{
@ -429,10 +430,10 @@ void CamWnd::Cam_MouseControl (float dtime)
if (xf < 0)
xf = 0;
}
VectorMA (m_Camera.origin, yf*dtime*g_PrefsDlg.m_nMoveSpeed, m_Camera.forward, m_Camera.origin);
m_Camera.angles[YAW] += xf*-dtime*g_PrefsDlg.m_nAngleSpeed;
int nUpdate = (g_PrefsDlg.m_bCamXYUpdate) ? (W_CAMERA | W_XY) : (W_CAMERA);
Sys_UpdateWindows (nUpdate);
g_pParentWnd->OnTimer ();
@ -494,7 +495,7 @@ void CamWnd::ToggleFreeMove()
widget = g_pParentWnd->m_pWidget;
window = widget->window;
}
if (m_bFreeMove)
{
@ -511,7 +512,7 @@ void CamWnd::ToggleFreeMove()
pixmap = gdk_bitmap_create_from_data (NULL, buffer, 32, 32);
mask = gdk_bitmap_create_from_data (NULL, buffer, 32, 32);
GdkCursor *cursor = gdk_cursor_new_from_pixmap (pixmap, mask, &white, &black, 1, 1);
gdk_window_set_cursor (window, cursor);
gdk_cursor_unref (cursor);
gdk_drawable_unref (pixmap);
@ -523,7 +524,7 @@ void CamWnd::ToggleFreeMove()
// mode seems to work fine though...)
m_FocusOutHandler_id = gtk_signal_connect (GTK_OBJECT (widget), "focus_out_event",
GTK_SIGNAL_FUNC (camwindow_focusout), g_pParentWnd);
{
GdkEventMask mask = (GdkEventMask)(GDK_POINTER_MOTION_MASK
| GDK_POINTER_MOTION_HINT_MASK
@ -533,7 +534,7 @@ void CamWnd::ToggleFreeMove()
| GDK_BUTTON3_MOTION_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK);
gdk_pointer_grab(widget->window, TRUE, mask, widget->window, NULL, GDK_CURRENT_TIME);
}
}
@ -665,7 +666,7 @@ void CamWnd::Cam_MouseMoved (int x, int y, int buttons)
case sel_brush_on:
Select_Ray( m_Camera.origin, dir, (SF_DRAG_ON|SF_CAMERA) );
break;
case sel_brush_off:
Select_Ray( m_Camera.origin, dir, (SF_DRAG_OFF|SF_CAMERA) );
break;
@ -818,7 +819,7 @@ void CamWnd::ProjectCamera(const vec3_t A, vec_t B[2])
// vec defines a direction in geometric space and P an origin point
// the user is interacting from the camera view
// (for example with texture adjustment shortcuts)
// and intuitively if he hits left / right / up / down
// and intuitively if he hits left / right / up / down
// what happens in geometric space should match the left/right/up/down move in camera space
// axis = 0: vec is along left/right
// axis = 1: vec is along up/down
@ -891,7 +892,6 @@ extern void DrawModelBBox(brush_t *b);
void CamWnd::Cam_DrawBrush(brush_t *b, int mode)
{
int nGLState = m_Camera.draw_glstate;
int nDrawMode = m_Camera.draw_mode;
int nModelMode = g_PrefsDlg.m_nEntityShowState;
GLfloat material[4], identity[4];
@ -909,7 +909,7 @@ void CamWnd::Cam_DrawBrush(brush_t *b, int mode)
material[3] = 1.0f;
qglColor4fv(material);
if (g_PrefsDlg.m_bNewLightDraw)
DrawLight(b->owner, nGLState, (IsBrushSelected(b)) ? g_PrefsDlg.m_nLightRadiuses : 0, 0);
@ -934,7 +934,7 @@ void CamWnd::Cam_DrawBrush(brush_t *b, int mode)
if(!(nGLState & DRAW_GL_TEXTURE_2D)) qglColor4fv(material);
else qglColor4fv(identity);
if(nGLState & DRAW_GL_LIGHTING) qglShadeModel(GL_SMOOTH);
b->owner->model.pRender->Draw(nGLState, DRAW_RF_CAM);
}
break;
@ -1025,7 +1025,7 @@ void CamWnd::Cam_DrawBrush(brush_t *b, int mode)
&& (b->owner->eclass->nShowFlags & ECLASS_ANGLE))
Brush_DrawFacingAngle(b, b->owner);
}
}
}
// brushes
else
@ -1037,14 +1037,14 @@ void CamWnd::Cam_DrawBrush(brush_t *b, int mode)
qglShadeModel(GL_FLAT);
Brush_Draw(b);
}
}
}
}
void CamWnd::Cam_DrawBrushes(int mode)
{
brush_t *b;
brush_t *pList = (g_bClipMode && g_pSplitList) ? g_pSplitList : &selected_brushes;
for(b = active_brushes.next; b != &active_brushes; b=b->next)
if (!b->bFiltered && !b->bCamCulled) Cam_DrawBrush(b, mode);
for(b = pList->next; b != pList; b=b->next)
@ -1179,7 +1179,7 @@ void CamWnd::Cam_DrawStuff()
break;
default: Sys_Printf("CamWnd::Cam_DrawStuff:invalid render mode\n");
}
qglDisable(GL_CULL_FACE);
Cam_DrawBrushes(DRAW_WIRE);
@ -1213,7 +1213,7 @@ void CamWnd::Cam_DrawStuff()
m_Camera.draw_glstate = DRAW_GL_WIRE;
break;
default: Sys_Printf("CamWnd::Cam_DrawStuff:invalid render mode\n");
}
}
qglEnable(GL_BLEND);
@ -1294,7 +1294,7 @@ void CamWnd::Cam_Draw()
//
// set up viewpoint
//
qglMatrixMode(GL_PROJECTION);
qglLoadIdentity ();
@ -1326,7 +1326,7 @@ void CamWnd::Cam_Draw()
qglLoadIdentity();
qglMultMatrixf(&m_Camera.modelview[0][0]);
// grab the GL_PROJECTION and GL_MODELVIEW matrixes
// used in GetRelativeAxes
//qglGetFloatv (GL_PROJECTION_MATRIX, &m_Camera.projection[0][0]);
@ -1348,14 +1348,14 @@ void CamWnd::Cam_Draw()
diffuse[3] = 1.0f;
//material[0] = material[1] = material[2] = 0.8f;
//material[3] = 1.0f;
vec3_t vCam, vRotate;
VectorSet(vCam, -1, 0, 0); //default cam pos
VectorSet(vRotate, 0, -m_Camera.angles[0], 0);
VectorRotate(vCam, vRotate, vCam);
VectorSet(vRotate, 0, 0, m_Camera.angles[1]);
VectorRotate(vCam, vRotate, vCam);
inverse_cam_dir[0] = vCam[0];
inverse_cam_dir[1] = vCam[1];
inverse_cam_dir[2] = vCam[2];
@ -1378,7 +1378,7 @@ void CamWnd::Cam_Draw()
//
Cam_DrawStuff();
qglEnableClientState(GL_VERTEX_ARRAY);
qglDisableClientState(GL_NORMAL_ARRAY);
qglDisableClientState(GL_TEXTURE_COORD_ARRAY);
@ -1418,7 +1418,7 @@ void CamWnd::Cam_Draw()
Brush_FaceDraw(face, DRAW_GL_FLAT);
}
}
int nCount = g_ptrSelectedFaces.GetSize();
if (nCount > 0)
@ -1433,7 +1433,7 @@ void CamWnd::Cam_Draw()
qglDisableClientState(GL_NORMAL_ARRAY);
qglDepthFunc (GL_LESS);
}
if (g_qeglobals.d_savedinfo.iSelectedOutlinesStyle & OUTLINE_ZBUF)
{
// non-zbuffered outline
@ -1469,7 +1469,7 @@ void CamWnd::Cam_Draw()
if (g_qeglobals.d_select_mode == sel_vertex)
{
// GL_POINTS on Kyro Workaround
if(!g_PrefsDlg.m_bGlPtWorkaround)
if(!g_PrefsDlg.m_bGlPtWorkaround)
{
// brush verts
qglPointSize (4);
@ -1478,7 +1478,7 @@ void CamWnd::Cam_Draw()
for (i=0 ; i<g_qeglobals.d_numpoints ; i++)
qglVertex3fv (g_qeglobals.d_points[i]);
qglEnd ();
if(g_qeglobals.d_num_move_points)
{
// selected brush verts
@ -1489,7 +1489,7 @@ void CamWnd::Cam_Draw()
qglVertex3fv (g_qeglobals.d_move_points[i]);
qglEnd();
}
qglPointSize (1);
}
else
@ -1501,7 +1501,7 @@ void CamWnd::Cam_Draw()
for (i=0; i < g_qeglobals.d_numpoints; i++)
DrawAlternatePoint(g_qeglobals.d_points[i], 1.5);
qglEnd();
if(g_qeglobals.d_num_move_points)
{
// selected brush verts
@ -1519,7 +1519,7 @@ void CamWnd::Cam_Draw()
{
float *v1, *v2;
// GL_POINTS on Kyro Workaround
if(!g_PrefsDlg.m_bGlPtWorkaround)
if(!g_PrefsDlg.m_bGlPtWorkaround)
{
qglPointSize (4);
qglColor3f (0,0,1);
@ -1651,7 +1651,7 @@ void CamWnd::Cam_Draw()
brush->bCamCulled = false;
}
void CamWnd::OnExpose ()
void CamWnd::OnExpose ()
{
if (!MakeCurrent ())
{
@ -1666,12 +1666,12 @@ void CamWnd::OnExpose ()
{
if (g_Clip1.Set() && g_Clip2.Set())
{
g_pSplitList = (g_bSwitch) ?
g_pSplitList = (g_bSwitch) ?
&g_brBackSplits : &g_brFrontSplits;
}
}
Patch_LODMatchAll(); // spog
Patch_LODMatchAll(); // spog
Cam_Draw ();
QE_CheckOpenGLForErrors ();
@ -1685,7 +1685,7 @@ void CamWnd::BenchMark()
{
if (!MakeCurrent ())
Error ("glXMakeCurrent failed in Benchmark");
qglDrawBuffer (GL_FRONT);
double dStart = Sys_DoubleTime ();
for (int i=0 ; i < 100 ; i++)

View File

@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "stdafx.h"
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <stdlib.h>
#include <stdio.h>
@ -130,13 +131,13 @@ void Dialog::UpdateData (bool retrieve)
DLG_DATA *data;
GSList *lst;
char buf[32];
if (retrieve)
{
for (lst = m_pDataList; lst != NULL; lst = g_slist_next (lst))
{
data = (DLG_DATA*)lst->data;
switch (data->type)
{
case DLG_CHECK_BOOL:
@ -181,14 +182,14 @@ void Dialog::UpdateData (bool retrieve)
char *label;
const char *entry;
int i;
*(int*)data->buffer = -1;
entry = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (data->object)->entry));
for (i = 0; lst != NULL; lst = g_list_next (lst))
{
gtk_label_get (GTK_LABEL (GTK_BIN (lst->data)->child), &label);
if (strcmp (label, entry) == 0)
{
*(int*)data->buffer = i;
@ -249,16 +250,18 @@ void Dialog::UpdateData (bool retrieve)
break;
case DLG_COMBO_INT: {
GList *lst = GTK_LIST (GTK_COMBO (data->object)->list)->children;
char *entry = "";
char *entry = NULL;
if (*(int*)data->buffer != -1)
{
lst = g_list_nth (lst, *(int*)data->buffer);
if (lst != NULL)
gtk_label_get (GTK_LABEL (GTK_BIN (lst->data)->child), &entry);
}
gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (data->object)->entry), entry);
if (entry)
gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (data->object)->entry), entry);
else
gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (data->object)->entry), "");
}
break;
case DLG_COMBO_BOX_INT: {

View File

@ -23,6 +23,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define _DIALOG_H_
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include "str.h"
#include "gtkmisc.h"
@ -46,7 +47,7 @@ class Dialog
Dialog ();
virtual ~Dialog ();
/*!
/*!
start modal dialog box
you need to use AddModalButton to select IDOK IDCANCEL buttons
*/

View File

@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "stdafx.h"
#include <gtk/gtk.h>
#include <glib/gi18n.h>
//#include "qe3.h"
GtkWidget *g_dlgInfo;

View File

@ -35,8 +35,8 @@ For abnormal program terminations
*/
/*!
\todo
FIXME the prompt wether to do prefs dialog, may not even be possible
\todo
FIXME the prompt wether to do prefs dialog, may not even be possible
if the crash happens before the game is loaded
*/
@ -64,16 +64,16 @@ void Error (const char *error, ...)
if (GetLastError() != 0)
{
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL
NULL
);
strcat( text, "GetLastError: " );
/*
@ -146,6 +146,6 @@ void WINAPI Error (char *error, ...)
va_start (argptr,error);
vsprintf (text, error,argptr);
va_end (argptr);
Error((const char *)text);
}

View File

@ -2,30 +2,30 @@
Copyright (c) 2001, Loki software, inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
Neither the name of Loki software nor the names of its contributors may be used
to endorse or promote products derived from this software without specific prior
written permission.
Neither the name of Loki software nor the names of its contributors may be used
to endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "stdafx.h"
@ -37,7 +37,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// type 5 = surface flags (q2)
// type 6 = content flags (q2)
// type 7 = content flags - no match (q2)
bfilter_t *FilterAdd(bfilter_t *pFilter, int type, int bmask, char *str, int exclude)
bfilter_t *FilterAdd(bfilter_t *pFilter, int type, int bmask, const char *str, int exclude)
{
bfilter_t *pNew = new bfilter_t;
pNew->next = pFilter;
@ -51,7 +51,7 @@ bfilter_t *FilterAdd(bfilter_t *pFilter, int type, int bmask, char *str, int exc
return pNew;
}
bfilter_t *FilterCreate (int type, int bmask, char *str, int exclude)
bfilter_t *FilterCreate (int type, int bmask, const char *str, int exclude)
{
g_qeglobals.d_savedinfo.filters = FilterAdd(g_qeglobals.d_savedinfo.filters, type, bmask, str, exclude);
Syn_Printf("Added filter %s (type: %i, bmask: %i, exclude: %i)\n", str, type, bmask, exclude);
@ -107,13 +107,13 @@ FilterBrush
bool FilterBrush(brush_t *pb)
{
if (!pb->owner)
return FALSE; // during construction
if (pb->hiddenBrush)
return TRUE;
if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_WORLD)
{
if (strcmp(pb->owner->eclass->name, "worldspawn") == 0 || !strcmp(pb->owner->eclass->name,"func_group")) // hack, treating func_group as world
@ -121,7 +121,7 @@ bool FilterBrush(brush_t *pb)
return TRUE;
}
}
if (g_qeglobals.d_savedinfo.exclude & EXCLUDE_ENT)
{
if (strcmp(pb->owner->eclass->name, "worldspawn") != 0 && strcmp(pb->owner->eclass->name,"func_group")) // hack, treating func_group as world
@ -129,7 +129,7 @@ bool FilterBrush(brush_t *pb)
return TRUE;
}
}
if ( g_qeglobals.d_savedinfo.exclude & EXCLUDE_CURVES )
{
if (pb->patchBrush)
@ -137,8 +137,8 @@ bool FilterBrush(brush_t *pb)
return TRUE;
}
}
if ( g_qeglobals.d_savedinfo.exclude & EXCLUDE_DETAILS )
{
if (!pb->patchBrush && pb->brush_faces->texdef.contents & CONTENTS_DETAIL )
@ -153,7 +153,7 @@ bool FilterBrush(brush_t *pb)
return TRUE;
}
}
// if brush belongs to world entity or a brushmodel entity and is not a patch
if ( ( strcmp(pb->owner->eclass->name, "worldspawn") == 0
|| !strncmp( pb->owner->eclass->name, "func", 4)
@ -186,7 +186,7 @@ bool FilterBrush(brush_t *pb)
filterbrush=true;
break;
}
// quake2 - 5 == surface flags, 6 == content flags
// quake2 - 5 == surface flags, 6 == content flags
}
else if (filters->attribute == 5)
{
@ -238,7 +238,7 @@ bool FilterBrush(brush_t *pb)
break;
}
}
// exclude by attribute 2 (for patch) brush->pPatch->pShader->getFlags()
if (filters->active
&& filters->attribute == 2)
@ -253,7 +253,7 @@ bool FilterBrush(brush_t *pb)
if (!drawpatch) // if a shader is found that should be excluded
return TRUE; // exclude this patch
}
if (strcmp(pb->owner->eclass->name, "worldspawn") != 0) // if brush does not belong to world entity
{
bool drawentity=true;
@ -271,7 +271,7 @@ bool FilterBrush(brush_t *pb)
break;
}
}
// exclude by attribute 4 brush->owner->eclass->nShowFlags
else if (filters->active
&& filters->attribute == 4)

View File

@ -23,8 +23,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define _FILTERS_H_
void FiltersActivate(void);
bfilter_t *FilterCreate(int type, int bmask, char *str, int exclude);
bfilter_t *FilterAdd(bfilter_t *pFilter, int type, int bmask, char *str, int exclude);
bfilter_t *FilterCreate(int type, int bmask, const char *str, int exclude);
bfilter_t *FilterAdd(bfilter_t *pFilter, int type, int bmask, const char *str, int exclude);
bfilter_t *FilterListDelete(bfilter_t *pFilter);
bfilter_t *FilterUpdate(bfilter_t *pFilter);
bool FilterBrush(brush_t *pb);

View File

@ -2,30 +2,30 @@
Copyright (c) 2001, Loki software, inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
Neither the name of Loki software nor the names of its contributors may be used
to endorse or promote products derived from this software without specific prior
written permission.
Neither the name of Loki software nor the names of its contributors may be used
to endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// OpenGL widget based on GtkGLExt
@ -147,7 +147,7 @@ int config_rgba_depth[] = {
GDK_GL_ATTRIB_LIST_NONE,
};
const attribs_t configs_with_depth[] =
const attribs_t configs_with_depth[] =
{
config_rgba32_depth32,
config_rgba32_depth24,
@ -212,9 +212,6 @@ static gint font_height;
void gtk_glwidget_create_font (GtkWidget *widget)
{
GdkGLContext *glcontext = gtk_widget_get_gl_context (widget);
GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget);
PangoFontDescription *font_desc;
PangoFont *font;
PangoFontMetrics *font_metrics;

View File

@ -100,12 +100,12 @@ void FillClassList ()
GtkTreeIter iter;
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter, 0, e->name, 1, e, -1);
}
}
}
// SetKeyValuePairs
//
// Reset the key/value (aka property) listbox and fill it with the
// Reset the key/value (aka property) listbox and fill it with the
// k/v pairs from the entity being edited.
//
@ -142,7 +142,7 @@ void SetKeyValuePairs (bool bClearMD3)
}
// SetSpawnFlags
//
//
// Update the checkboxes to reflect the flag state of the entity
//
void SetSpawnFlags(void)
@ -167,7 +167,7 @@ void SetSpawnFlags(void)
}
// GetSpawnFlags
//
//
// Update the entity flags to reflect the state of the checkboxes
//
// NOTE: this function had a tendency to add "spawnflags" "0" on most entities
@ -191,7 +191,7 @@ void GetSpawnFlags(void)
if (multiple_entities)
{
brush_t *b;
for (b=selected_brushes.next ; b != &selected_brushes ; b=b->next)
DeleteKey (b->owner, "spawnflags");
}
@ -199,12 +199,12 @@ void GetSpawnFlags(void)
DeleteKey (edit_entity, "spawnflags");
}
else
{
sprintf (sz, "%i", f);
{
sprintf (sz, "%i", f);
if (multiple_entities)
{
brush_t *b;
for (b=selected_brushes.next ; b != &selected_brushes ; b=b->next)
SetKeyValue(b->owner, "spawnflags", sz);
}
@ -225,7 +225,7 @@ bool UpdateSel(int iIndex, eclass_t *pec)
int i, next_state;
brush_t *b;
// syndrom of crappy code, we may get into stack overflowing crap with this function and Gtk
// syndrom of crappy code, we may get into stack overflowing crap with this function and Gtk
// if we play with the list of entity classes
// using a static flag to prevent recursion
static bool bBlockUpdate = false;
@ -453,7 +453,7 @@ void AddProp()
SetKeyValue(edit_entity, key, value);
// refresh the prop listbox
SetKeyValuePairs();
SetKeyValuePairs();
#ifdef USEPLUGINENTITIES
@ -599,7 +599,7 @@ void AssignSound()
str = filename;
}
gtk_entry_set_text (GTK_ENTRY (EntWidgets[EntValueField]), str.GetBuffer());
gtk_entry_set_text (GTK_ENTRY (EntWidgets[EntValueField]), str.GetBuffer());
AddProp();
}
}
@ -633,7 +633,7 @@ void AssignModel()
str = filename;
}
gtk_entry_set_text (GTK_ENTRY (EntWidgets[EntValueField]), str.GetBuffer());
gtk_entry_set_text (GTK_ENTRY (EntWidgets[EntValueField]), str.GetBuffer());
AddProp();
edit_entity->brushes.onext->bModelFailed = false;
}
@ -664,7 +664,7 @@ void SetInspectorMode(int iType)
iType = W_GROUP;
else
iType = W_ENTITY;
}
}
switch(iType)
{
@ -745,28 +745,28 @@ void Group_AddToItem(brush_t *b, GtkCTreeNode* item)
}
const char *pName = NULL;
// const char *pNamed = Brush_GetKeyValue(b, "name");
if (!b->owner || (b->owner == world_entity))
{
if (b->patchBrush)
if (b->patchBrush)
{
pName = "Generic Patch";
nImage = IMG_PATCH;
}
else
}
else
{
pName = "Generic Brush";
nImage = IMG_BRUSH;
}
}
else
}
else
{
pName = b->owner->eclass->name;
if (b->owner->eclass->fixedsize)
if (b->owner->eclass->fixedsize)
{
nImage = IMG_ENTITY;
}
else
}
else
{
nImage = IMG_ENTITYGROUP;
}
@ -989,7 +989,7 @@ static void eclasslist_selection_changed(GtkTreeSelection* selection, gpointer d
// no world entity, we are not ready yet
// http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=917
if( !world_entity ) {
return;
return;
}
if(gtk_tree_selection_get_selected(selection, &model, &selected))
{
@ -1133,7 +1133,7 @@ static void groupdlg_add (GtkWidget *widget, gpointer data)
if (name != NULL)
{
// create a new group node
// create a new group node
GtkCTreeNode *item;
item = gtk_ctree_insert_node (GTK_CTREE (g_wndGroup.m_pTree), g_pGroupDlg->m_hWorld, NULL, &name, 0,
tree_pixmaps[IMG_GROUP], tree_masks[IMG_GROUP],
@ -1178,7 +1178,7 @@ static void switch_page (GtkNotebook *notebook, GtkNotebookPage *page, guint pag
else
inspector_mode = W_GROUP;
}
if (inspector_mode == W_ENTITY)
gtk_widget_set_sensitive (GTK_WIDGET (item), TRUE);
else
@ -1259,7 +1259,7 @@ void GroupDlg::Create ()
GtkWidget* split1 = gtk_vpaned_new ();
gtk_box_pack_start (GTK_BOX (vbox), split1, TRUE, TRUE, 0);
gtk_widget_show (split1);
{
GtkWidget* split2 = gtk_vpaned_new ();
gtk_paned_add1 (GTK_PANED (split1), split2);
@ -1302,7 +1302,7 @@ void GroupDlg::Create ()
gtk_widget_show(view);
gtk_container_add(GTK_CONTAINER (scr), view);
g_object_unref(G_OBJECT(store));
EntWidgets[EntList] = view;
g_entlist_store = store;
@ -1329,7 +1329,7 @@ void GroupDlg::Create ()
{
// Spawnflags (4 colums wide max, or window gets too wide.)
GtkWidget* table = LayoutTable = gtk_table_new (4, 4, FALSE);
GtkWidget* LayoutTable = gtk_table_new (4, 4, FALSE);
gtk_box_pack_start (GTK_BOX (vbox2), LayoutTable, FALSE, TRUE, 0);
gtk_widget_show(LayoutTable);
@ -1410,7 +1410,7 @@ void GroupDlg::Create ()
gtk_widget_show(view);
gtk_container_add(GTK_CONTAINER (scr), view);
g_object_unref(G_OBJECT(store));
EntWidgets[EntProps] = view;

View File

@ -2,30 +2,30 @@
Copyright (c) 2001, Loki software, inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
Neither the name of Loki software nor the names of its contributors may be used
to endorse or promote products derived from this software without specific prior
written permission.
Neither the name of Loki software nor the names of its contributors may be used
to endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//
@ -37,6 +37,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "stdafx.h"
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#ifdef _WIN32
#include <gdk/gdkwin32.h>
@ -52,19 +53,19 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
qboolean DoColor (int iIndex)
{
static bool bColorOpen = false;
if(bColorOpen)
{
Sys_FPrintf(SYS_WRN, "DoColor dialog is already open\n");
return false;
}
bColorOpen = true;
bColorOpen = true;
if (color_dialog (g_pParentWnd->m_pWidget, g_qeglobals.d_savedinfo.colors[iIndex]))
{
/*
** scale colors so that at least one component is at 1.0F
/*
** scale colors so that at least one component is at 1.0F
** if this is meant to select an entity color
*/
if (iIndex == COLOR_ENTITY)
@ -604,7 +605,7 @@ void DoProjectSettings ()
g_object_set_data(G_OBJECT (project), "view", view);
g_object_set_data(G_OBJECT (project), "bsp_commands", store);
gtk_container_add(GTK_CONTAINER (scr), view);
g_object_unref(G_OBJECT(store));
}
@ -617,7 +618,7 @@ void DoProjectSettings ()
// HACK: hardcoded game stuff
if (g_pGameDescription->mGameFile == "wolf.game" ||
g_pGameDescription->mGameFile == "et.game" ||
g_pGameDescription->mGameFile == "jk2.game" ||
g_pGameDescription->mGameFile == "jk2.game" ||
g_pGameDescription->mGameFile == "stvef.game" ||
g_pGameDescription->mGameFile == "sof2.game" ||
g_pGameDescription->mGameFile == "ja.game" )
@ -709,7 +710,7 @@ void DoProjectSettings ()
gtk_table_attach(GTK_TABLE(table2), game, 1, 2, 7, 8,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
/*
wolf specific: select MP or SP mode
*/
@ -718,7 +719,7 @@ void DoProjectSettings ()
combo_list = NULL;
combo_list = g_list_append (combo_list, (void *)sWolfSPCombo);
combo_list = g_list_append (combo_list, (void *)sWolfMPCombo);
gamemode_combo = gtk_combo_new ();
gtk_combo_set_popdown_strings (GTK_COMBO (gamemode_combo), combo_list);
gtk_widget_show(gamemode_combo);
@ -744,7 +745,7 @@ void DoProjectSettings ()
combo_list = NULL;
combo_list = g_list_append (combo_list, (void *)sJK2SPCombo);
combo_list = g_list_append (combo_list, (void *)sJK2MPCombo);
gamemode_combo = gtk_combo_new ();
gtk_combo_set_popdown_strings (GTK_COMBO (gamemode_combo), combo_list);
gtk_widget_show(gamemode_combo);
@ -769,7 +770,7 @@ void DoProjectSettings ()
combo_list = NULL;
combo_list = g_list_append (combo_list, (void *)sJASPCombo);
combo_list = g_list_append (combo_list, (void *)sJAMPCombo);
gamemode_combo = gtk_combo_new ();
gtk_combo_set_popdown_strings (GTK_COMBO (gamemode_combo), combo_list);
gtk_widget_show(gamemode_combo);
@ -794,7 +795,7 @@ void DoProjectSettings ()
combo_list = NULL;
combo_list = g_list_append (combo_list, (void *)sSTVEFSPCombo);
combo_list = g_list_append (combo_list, (void *)sSTVEFMPCombo);
gamemode_combo = gtk_combo_new ();
gtk_combo_set_popdown_strings (GTK_COMBO (gamemode_combo), combo_list);
gtk_widget_show(gamemode_combo);
@ -819,7 +820,7 @@ void DoProjectSettings ()
combo_list = NULL;
combo_list = g_list_append (combo_list, (void *)sSOF2SPCombo);
combo_list = g_list_append (combo_list, (void *)sSOF2MPCombo);
gamemode_combo = gtk_combo_new ();
gtk_combo_set_popdown_strings (GTK_COMBO (gamemode_combo), combo_list);
gtk_widget_show(gamemode_combo);
@ -1117,7 +1118,7 @@ void DoProjectSettings ()
char buf[1024];
const char *r;
char *w;
// convert path to unix format
for(r = gtk_entry_get_text (GTK_ENTRY (base)), w=buf; *r != '\0'; r++, w++)
*w = (*r == '\\') ? '/' : *r;
@ -1199,7 +1200,7 @@ void DoProjectSettings ()
SetKeyValue (g_qeglobals.d_project_entity, "gamename", dir);
}
}
// HACK: hardcoded wolf stuff
if (g_pGameDescription->mGameFile == "wolf.game")
{
@ -1245,7 +1246,7 @@ void DoProjectSettings ()
SetKeyValue (g_qeglobals.d_project_entity, "gamemode", "mp");
}
}
// RIANT
// STVEF HACK
if (g_pGameDescription->mGameFile == "stvef.game")
@ -1682,7 +1683,7 @@ void DoEntityList ()
entitymap = g_slist_remove (entitymap, entitymap->data);
}
}
g_object_unref(G_OBJECT(store));
}
@ -1717,14 +1718,14 @@ void DoEntityList ()
g_object_set_data(G_OBJECT(dlg), "keyvalues", store);
gtk_container_add(GTK_CONTAINER (scr), view);
g_object_unref(G_OBJECT(store));
}
hbox2 = gtk_hbox_new (FALSE, 5);
gtk_widget_show (hbox2);
gtk_box_pack_start (GTK_BOX (vbox), hbox2, TRUE, TRUE, 0);
button = gtk_button_new_with_label ("Select");
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0);
@ -1766,13 +1767,13 @@ static void rotatedlg_apply (GtkWidget *widget, gpointer data)
if (f != 0.0)
Select_RotateAxis(0,f);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), 0.0f); // reset to 0 on Apply
spin = GTK_SPIN_BUTTON (g_object_get_data (G_OBJECT (data), "y"));
f = gtk_spin_button_get_value_as_float (spin);
if (f != 0.0)
Select_RotateAxis(1,f);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), 0.0f);
spin = GTK_SPIN_BUTTON (g_object_get_data (G_OBJECT (data), "z"));
f = gtk_spin_button_get_value_as_float (spin);
if (f != 0.0)
@ -1800,13 +1801,13 @@ void DoRotateDlg ()
gtk_widget_show (hbox);
gtk_container_add (GTK_CONTAINER (dlg), hbox);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
table = gtk_table_new (3, 2, FALSE);
gtk_widget_show (table);
gtk_box_pack_start (GTK_BOX (hbox), table, TRUE, TRUE, 0);
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
label = gtk_label_new (" X ");
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
@ -1818,14 +1819,14 @@ void DoRotateDlg ()
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
(GtkAttachOptions) (0),
(GtkAttachOptions) (0), 0, 0);
label = gtk_label_new (" Z ");
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
(GtkAttachOptions) (0),
(GtkAttachOptions) (0), 0, 0);
adj = gtk_adjustment_new (0, -359, 359, 1, 10, 10);
x = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 1, 0);
g_object_set_data (G_OBJECT (dlg), "x", x);
@ -1835,7 +1836,7 @@ void DoRotateDlg ()
(GtkAttachOptions) (0), 0, 0);
gtk_widget_set_usize (x, 60, -2);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (x), TRUE);
adj = gtk_adjustment_new (0, -359, 359, 1, 10, 10);
y = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 1, 0);
g_object_set_data (G_OBJECT (dlg), "y", y);
@ -1844,7 +1845,7 @@ void DoRotateDlg ()
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (y), TRUE);
adj = gtk_adjustment_new (0, -359, 359, 1, 10, 10);
z = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 1, 0);
g_object_set_data (G_OBJECT (dlg), "z", z);
@ -1853,24 +1854,24 @@ void DoRotateDlg ()
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (z), TRUE);
vbox = gtk_vbox_new (FALSE, 5);
gtk_widget_show (vbox);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
button = gtk_button_new_with_label ("OK");
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDOK));
gtk_widget_set_usize (button, 60, -2);
button = gtk_button_new_with_label ("Cancel");
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDCANCEL));
button = gtk_button_new_with_label ("Apply");
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
@ -1938,7 +1939,7 @@ void DoGamma ()
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDOK));
gtk_widget_set_usize (button, 60, -2);
button = gtk_button_new_with_label ("Cancel");
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
@ -2027,7 +2028,7 @@ void SelectBrush (int entitynum, int brushnum)
if (b==&active_brushes)
{
// this is a regioned out entity
e = e->next;
e = e->next;
// don't walk past the end either
if (e == &entities)
{
@ -2078,7 +2079,7 @@ void SelectBrush (int entitynum, int brushnum)
if (g_pParentWnd->GetXZWnd())
g_pParentWnd->GetXZWnd()->GetOrigin()[i] = (b->mins[i] + b->maxs[i])/2;
if (g_pParentWnd->GetYZWnd())
g_pParentWnd->GetYZWnd()->GetOrigin()[i] = (b->mins[i] + b->maxs[i])/2;
}
@ -2134,7 +2135,7 @@ void DoFind ()
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
label = gtk_label_new ("Entity number");
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
@ -2169,7 +2170,7 @@ void DoFind ()
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDOK));
gtk_widget_set_usize (button, 60, -2);
button = gtk_button_new_with_label ("Cancel");
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
@ -2243,7 +2244,7 @@ void DoSides (bool bCone, bool bSphere, bool bTorus)
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDOK));
gtk_widget_set_usize (button, 60, -2);
button = gtk_button_new_with_label ("Cancel");
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
@ -2301,7 +2302,7 @@ void DoNewPatchDlg ()
gtk_box_pack_start (GTK_BOX (hbox), table, TRUE, TRUE, 0);
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
label = gtk_label_new ("Width:");
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
@ -2350,7 +2351,7 @@ void DoNewPatchDlg ()
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDOK));
gtk_widget_set_usize (button, 60, -2);
button = gtk_button_new_with_label ("Cancel");
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
@ -2411,7 +2412,7 @@ void DoScaleDlg ()
gtk_box_pack_start (GTK_BOX (hbox), table, TRUE, TRUE, 0);
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
label = gtk_label_new ("X:");
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
@ -2461,7 +2462,7 @@ void DoScaleDlg ()
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDOK));
gtk_widget_set_usize (button, 60, -2);
button = gtk_button_new_with_label ("Cancel");
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
@ -2543,7 +2544,7 @@ void DoThickenDlg ()
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDOK));
gtk_widget_set_usize (button, 60, -2);
button = gtk_button_new_with_label ("Cancel");
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
@ -2565,13 +2566,13 @@ void DoThickenDlg ()
seams = gtk_check_button_new_with_label ("Seams");
gtk_widget_show (seams);
gtk_box_pack_start (GTK_BOX (hbox), seams, FALSE, FALSE, 0);
// bGroupResult
group = gtk_check_button_new_with_label("Result to func_group");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(group), bGroupResult);
gtk_box_pack_start(GTK_BOX(vbox), group, FALSE, FALSE, 0);
gtk_widget_show(group);
// Initialize dialog
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (seams), TRUE);
@ -2664,7 +2665,7 @@ void DoAbout ()
"you may report your problems at\n"
"http://zerowing.idsoftware.com/bugzilla"
);
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
@ -2702,7 +2703,7 @@ void DoAbout ()
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
gtk_container_set_border_width (GTK_CONTAINER (table), 5);
label = gtk_label_new ("Vendor:");
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
@ -2759,15 +2760,15 @@ void DoAbout ()
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sc_extensions), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sc_extensions), GTK_SHADOW_IN);
gtk_widget_show(sc_extensions);
text_extensions = gtk_text_view_new();
gtk_text_view_set_editable(GTK_TEXT_VIEW(text_extensions), FALSE);
gtk_container_add (GTK_CONTAINER (sc_extensions), text_extensions);
GtkTextBuffer* buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_extensions));
gtk_text_buffer_set_text(buffer, (char *)qglGetString(GL_EXTENSIONS), -1);
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text_extensions), GTK_WRAP_WORD);;
gtk_widget_show(text_extensions);
gtk_widget_show(text_extensions);
gtk_grab_add (dlg);
gtk_widget_show (dlg);
@ -2779,7 +2780,7 @@ void DoAbout ()
}
// =============================================================================
// Command List dialog
// Command List dialog
void DoCommandListDlg ()
{
@ -2876,7 +2877,7 @@ void DoCommandListDlg ()
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter, 0, g_Commands[n].m_strCommand, 1, strMod.GetBuffer (), -1);
}
if (fileout != NULL)
{
strLine.Format("%-25s %s\r\n", g_Commands[n].m_strCommand, strMod.GetBuffer ());
@ -2889,7 +2890,7 @@ void DoCommandListDlg ()
if (fileout != NULL)
fclose (fileout);
}
g_object_unref(G_OBJECT(store));
}
@ -2915,7 +2916,7 @@ void DoCommandListDlg ()
}
// =============================================================================
// Texture List dialog
// Texture List dialog
void DoTextureListDlg ()
{
@ -2949,7 +2950,7 @@ void DoTextureListDlg ()
GtkListStore* store = gtk_list_store_new(1, G_TYPE_STRING);
GtkWidget* view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE);
{
GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
@ -2975,7 +2976,7 @@ void DoTextureListDlg ()
textures = g_slist_remove (textures, textures->data);
}
}
g_object_unref(G_OBJECT(store));
texture_list = view;
@ -3025,7 +3026,7 @@ void DoTextureListDlg ()
}
// =============================================================================
// Cap dialog
// Cap dialog
int DoCapDlg (int *type, bool *b_GroupResult)
{
@ -3033,7 +3034,7 @@ int DoCapDlg (int *type, bool *b_GroupResult)
GtkWidget *bevel, *endcap, *ibevel, *iendcap;
GSList *group = (GSList*)NULL;
int loop = 1, ret = IDCANCEL;
dlg = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (dlg), "Cap");
gtk_signal_connect (GTK_OBJECT (dlg), "delete_event",
@ -3052,13 +3053,13 @@ int DoCapDlg (int *type, bool *b_GroupResult)
radio_vbox = gtk_vbox_new(FALSE, 4);
gtk_container_add(GTK_CONTAINER(hbox), radio_vbox);
gtk_widget_show(radio_vbox);
table = gtk_table_new (4, 2, FALSE);
gtk_widget_show (table);
gtk_box_pack_start (GTK_BOX (radio_vbox), table, TRUE, TRUE, 0);
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
pixmap = new_pixmap (g_pParentWnd->m_pWidget, "cap_bevel.bmp");
gtk_widget_show (pixmap);
gtk_table_attach (GTK_TABLE (table), pixmap, 0, 1, 0, 1,
@ -3115,7 +3116,7 @@ int DoCapDlg (int *type, bool *b_GroupResult)
group_toggle = gtk_check_button_new_with_label("Result to func_group");
gtk_container_add(GTK_CONTAINER(radio_vbox), group_toggle);
gtk_widget_show(group_toggle);
vbox = gtk_vbox_new (FALSE, 5);
gtk_widget_show (vbox);
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
@ -3136,7 +3137,7 @@ int DoCapDlg (int *type, bool *b_GroupResult)
// Gef: Set the state of the func_group toggle
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (group_toggle), *b_GroupResult);
// Initialize dialog
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bevel), TRUE);
@ -3168,7 +3169,7 @@ int DoCapDlg (int *type, bool *b_GroupResult)
}
// =============================================================================
// Scripts dialog
// Scripts dialog
void DoScriptsDlg ()
{
@ -3214,7 +3215,7 @@ void DoScriptsDlg ()
GtkListStore* store = gtk_list_store_new(1, G_TYPE_STRING);
GtkWidget* view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE);
{
GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
@ -3255,7 +3256,7 @@ void DoScriptsDlg ()
fclose (f);
}
}
g_object_unref(G_OBJECT(store));
scripts_list = view;
@ -3317,7 +3318,7 @@ void DoScriptsDlg ()
}
// =============================================================================
// dialog
// dialog
int DoBSInputDlg (const char *fields[5], float values[5])
{
@ -3403,7 +3404,7 @@ int DoBSInputDlg (const char *fields[5], float values[5])
}
// =============================================================================
// TextureLayout dialog
// TextureLayout dialog
int DoTextureLayout (float *fx, float *fy)
{
@ -3442,7 +3443,7 @@ int DoTextureLayout (float *fx, float *fy)
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
label = gtk_label_new ("Texture x:");
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
@ -3510,7 +3511,7 @@ int DoTextureLayout (float *fx, float *fy)
}
// =============================================================================
// Name dialog
// Name dialog
char* DoNameDlg (const char* title)
{
@ -3576,7 +3577,7 @@ char* DoNameDlg (const char* title)
}
// =============================================================================
// NewProject dialog
// NewProject dialog
char* DoNewProjectDlg ()
{
@ -3670,7 +3671,7 @@ char* DoNewProjectDlg ()
}
// =============================================================================
// Text Editor dialog
// Text Editor dialog
// master window widget
static GtkWidget *text_editor = NULL;
@ -3916,7 +3917,7 @@ void DoTextEditor (const char* filename, int cursorpos)
strEditCommand += " \"";
strEditCommand += filename;
strEditCommand += "\"";
Sys_Printf("Launching: %s\n", strEditCommand.GetBuffer());
// note: linux does not return false if the command failed so it will assume success
if (Q_Exec(NULL, (char *)strEditCommand.GetBuffer(), NULL, true) == false)
@ -3930,7 +3931,7 @@ void DoTextEditor (const char* filename, int cursorpos)
}
}
#endif
DoGtkTextEditor (filename, cursorpos);
// old win32 code with EditPad bindings, broken
@ -3965,7 +3966,7 @@ void DoTextEditor (const char* filename, int cursorpos)
}
// =============================================================================
// Light Intensity dialog
// Light Intensity dialog
int DoLightIntensityDlg (int *intensity)
{

View File

@ -2,30 +2,30 @@
Copyright (c) 2001, Loki software, inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
Neither the name of Loki software nor the names of its contributors may be used
to endorse or promote products derived from this software without specific prior
written permission.
Neither the name of Loki software nor the names of its contributors may be used
to endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//
@ -39,7 +39,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endif
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#ifdef _WIN32
#include <gdk/gdkwin32.h>
@ -106,7 +106,7 @@ void win32_get_window_pos(GtkWidget *widget, gint *x, gint *y)
}
#ifdef DBG_WINDOWPOS
Sys_Printf("win32_get_window_pos %p %d,%d\n",widget,*x,*y);
#endif
#endif
}
#endif
@ -318,7 +318,7 @@ unsigned char *load_bitmap_file (const char* filename, guint16 *width, guint16 *
return NULL;
}
rc = fread(&g, 1, 1, fp);
rc = fread(&g, 1, 1, fp);
m_bytesRead++;
if (rc!=1)
{
@ -327,7 +327,7 @@ unsigned char *load_bitmap_file (const char* filename, guint16 *width, guint16 *
return NULL;
}
rc = fread(&r, 1, 1, fp);
rc = fread(&r, 1, 1, fp);
m_bytesRead++;
if (rc != 1)
{
@ -336,7 +336,7 @@ unsigned char *load_bitmap_file (const char* filename, guint16 *width, guint16 *
return NULL;
}
rc = fread(&dummy, 1, 1, fp);
rc = fread(&dummy, 1, 1, fp);
m_bytesRead++;
if (rc != 1)
{
@ -372,7 +372,7 @@ unsigned char *load_bitmap_file (const char* filename, guint16 *width, guint16 *
imagebits = (unsigned char *)malloc(w * h * 3);
long row_size = w * 3;
if (imagebits != NULL)
if (imagebits != NULL)
{
*width = w;
*height = h;
@ -386,7 +386,7 @@ unsigned char *load_bitmap_file (const char* filename, guint16 *width, guint16 *
for (row = bmHeight - 1; row >= 0; row--)
{
// which row are we working on?
rowOffset = (long unsigned)row * row_size;
rowOffset = (long unsigned)row * row_size;
if (bmBitsPixel == 24)
{
@ -477,13 +477,13 @@ unsigned char *load_bitmap_file (const char* filename, guint16 *width, guint16 *
unsigned char c, c1 = 0, *pp;
row = 0;
pp = outbuf + (bmHeight - 1) * bmWidth * 3;
if (bmBitsPixel == 8)
{
while (row < bmHeight)
{
c = getc(fp);
if (c)
{
// encoded mode
@ -524,7 +524,7 @@ unsigned char *load_bitmap_file (const char* filename, guint16 *width, guint16 *
*pp = colormap[c1].rgbGreen; pp++;
*pp = colormap[c1].rgbBlue; pp++;
}
if (c & 1)
getc(fp); // odd length run: read an extra pad byte
}
@ -536,7 +536,7 @@ unsigned char *load_bitmap_file (const char* filename, guint16 *width, guint16 *
while (row < bmHeight)
{
c = getc(fp);
if (c)
{
// encoded mode
@ -552,7 +552,7 @@ unsigned char *load_bitmap_file (const char* filename, guint16 *width, guint16 *
{
// c==0x00, escape codes
c = getc(fp);
if (c == 0x00) // end of line
{
row++;
@ -579,7 +579,7 @@ unsigned char *load_bitmap_file (const char* filename, guint16 *width, guint16 *
*pp = colormap[(i&1) ? (c1 & 0x0f) : ((c1>>4)&0x0f)].rgbGreen; pp++;
*pp = colormap[(i&1) ? (c1 & 0x0f) : ((c1>>4)&0x0f)].rgbBlue; pp++;
}
if (((c & 3) == 1) || ((c & 3) == 2))
getc(fp); // odd length run: read an extra pad byte
}
@ -589,7 +589,7 @@ unsigned char *load_bitmap_file (const char* filename, guint16 *width, guint16 *
}
if (colormap)
delete [] colormap;
fclose(fp);
}
return imagebits;
@ -686,7 +686,7 @@ void load_pixmap (const char* filename, GtkWidget* widget, GdkPixmap **gdkpixmap
if (*gdkpixmap == NULL)
{
printf("gdkpixmap was null\n");
char *dummy[] = { "1 1 1 1", " c None", " " };
gchar *dummy[] = { "1 1 1 1", " c None", " " };
printf("calling gdk_pixmap_create_from_xpm_d\n");
*gdkpixmap = gdk_pixmap_create_from_xpm_d (gdk_get_default_root_window(), mask, NULL, dummy);
}
@ -715,17 +715,17 @@ bool WINAPI load_plugin_bitmap (const char* filename, void **gdkpixmap, void **m
if (*gdkpixmap == NULL)
{
// look in core modules
str = g_strAppPath;
str += g_strModulesDir;
str += "bitmaps/";
str += filename;
bmp_to_pixmap (str.GetBuffer (), (GdkPixmap **)gdkpixmap, (GdkBitmap **)mask);
if (*gdkpixmap == NULL)
{
char *dummy[] = { "1 1 1 1", " c None", " " };
gchar *dummy[] = { "1 1 1 1", " c None", " " };
*gdkpixmap = gdk_pixmap_create_from_xpm_d (gdk_get_default_root_window(), (GdkBitmap **)mask, NULL, dummy);
return false;
}
@ -735,7 +735,7 @@ bool WINAPI load_plugin_bitmap (const char* filename, void **gdkpixmap, void **m
}
// Load a xpm file and return a pixmap widget.
GtkWidget* new_pixmap (GtkWidget* widget, char* filename)
GtkWidget* new_pixmap (GtkWidget* widget, const char* filename)
{
GdkPixmap *gdkpixmap;
GdkBitmap *mask;
@ -748,7 +748,7 @@ GtkWidget* new_pixmap (GtkWidget* widget, char* filename)
gdk_drawable_unref (mask);
return pixmap;
}
}
// =============================================================================
// Menu stuff
@ -770,8 +770,8 @@ GtkWidget* menu_tearoff (GtkWidget *menu)
gtk_widget_show (menu_item);
return menu_item;
}
GtkWidget* create_sub_menu_with_mnemonic (GtkWidget *bar, gchar *mnemonic)
GtkWidget* create_sub_menu_with_mnemonic (GtkWidget *bar, const gchar *mnemonic)
{
GtkWidget *item, *sub_menu;
@ -787,7 +787,7 @@ GtkWidget* create_sub_menu_with_mnemonic (GtkWidget *bar, gchar *mnemonic)
extern void AddMenuItem (GtkWidget* menu, unsigned int id);
GtkWidget* create_menu_item_with_mnemonic (GtkWidget *menu, gchar *mnemonic, GtkSignalFunc func, int id)
GtkWidget* create_menu_item_with_mnemonic (GtkWidget *menu, const gchar *mnemonic, GtkSignalFunc func, int id)
{
GtkWidget *item;
@ -801,7 +801,7 @@ GtkWidget* create_menu_item_with_mnemonic (GtkWidget *menu, gchar *mnemonic, Gtk
return item;
}
GtkWidget* create_check_menu_item_with_mnemonic (GtkWidget *menu, gchar *mnemonic, GtkSignalFunc func, int id, gboolean active)
GtkWidget* create_check_menu_item_with_mnemonic (GtkWidget *menu, const gchar *mnemonic, GtkSignalFunc func, int id, gboolean active)
{
GtkWidget *item;
@ -816,7 +816,7 @@ GtkWidget* create_check_menu_item_with_mnemonic (GtkWidget *menu, gchar *mnemoni
return item;
}
GtkWidget* create_radio_menu_item_with_mnemonic (GtkWidget *menu, GtkWidget *last, gchar *mnemonic, GtkSignalFunc func, int id, gboolean state)
GtkWidget* create_radio_menu_item_with_mnemonic (GtkWidget *menu, GtkWidget *last, const gchar *mnemonic, GtkSignalFunc func, int id, gboolean state)
{
GtkWidget *item;
GSList *group = (GSList*)NULL;
@ -922,7 +922,7 @@ int WINAPI gtk_MessageBox (void *parent, const char* lpText, const char* lpCapti
hbox = gtk_hbox_new (FALSE, 10);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 2);
gtk_widget_show (hbox);
if (mode == MB_OK)
{
w = gtk_button_new_with_label ("Ok");
@ -964,13 +964,13 @@ int WINAPI gtk_MessageBox (void *parent, const char* lpText, const char* lpCapti
GTK_WIDGET_SET_FLAGS (w, GTK_CAN_DEFAULT);
gtk_widget_grab_default (w);
gtk_widget_show (w);
w = gtk_button_new_with_label ("No");
gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT (w), "clicked",
GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDNO));
gtk_widget_show (w);
w = gtk_button_new_with_label ("Cancel");
gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT (w), "clicked",
@ -987,7 +987,7 @@ int WINAPI gtk_MessageBox (void *parent, const char* lpText, const char* lpCapti
GTK_WIDGET_SET_FLAGS (w, GTK_CAN_DEFAULT);
gtk_widget_grab_default (w);
gtk_widget_show (w);
w = gtk_button_new_with_label ("No");
gtk_box_pack_start (GTK_BOX (hbox), w, TRUE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT (w), "clicked",
@ -1037,7 +1037,7 @@ static void file_sel_callback (GtkWidget *widget, gpointer data)
parent = gtk_widget_get_toplevel (widget);
loop = (int*)g_object_get_data (G_OBJECT (parent), "loop");
success = (bool*)g_object_get_data (G_OBJECT (parent), "success");
if ((int)data == IDOK)
*success = true;
@ -1045,18 +1045,18 @@ static void file_sel_callback (GtkWidget *widget, gpointer data)
else
Sys_Printf("file_sel_callback != IDOK\n");
#endif
*loop = 0;
}
#ifdef _WIN32
#include <commdlg.h>
static OPENFILENAME ofn; /* common dialog box structure */
static char szDirName[MAX_PATH]; /* directory string */
static char szFile[MAX_PATH]; /* filename string */
static char szFileTitle[MAX_PATH]; /* file title string */
static int i, cbString; /* integer count variables */
static HANDLE hf; /* file handle */
static OPENFILENAME ofn; /* common dialog box structure */
static char szDirName[MAX_PATH]; /* directory string */
static char szFile[MAX_PATH]; /* filename string */
static char szFileTitle[MAX_PATH]; /* file title string */
static int i, cbString; /* integer count variables */
static HANDLE hf; /* file handle */
#else
static char szFile[QER_MAX_NAMELEN];
#endif
@ -1107,7 +1107,7 @@ public:
ConstructGTKMasks();
ConstructWin32Filters();
}
filetype_t GetTypeForWin32Filter(const char *filter) const
{
for(int i=0; i<m_nTypes; i++)
@ -1169,7 +1169,7 @@ private:
delete[] *p;
delete[] m_pstrGTKMasks;
}
void ConstructGTKMasks()
{
const char *r;
@ -1234,12 +1234,12 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c
Sys_Printf("Doing win32 file dialog...");
#endif
// do that the native way
/* Place the terminating null character in the szFile. */
/* Place the terminating null character in the szFile. */
szFile[0] = '\0';
customfilter[0] = customfilter[1] = customfilter[2] = '\0';
/* Set the members of the OPENFILENAME structure. */
ofn.lStructSize = sizeof(OPENFILENAME);
/* Set the members of the OPENFILENAME structure. */
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = (HWND)GDK_WINDOW_HWND (g_pParentWnd->m_pWidget->window);
if (pattern)
{
@ -1250,7 +1250,7 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c
ofn.lpstrCustomFilter = customfilter;
ofn.nMaxCustFilter = sizeof(customfilter);
ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile);
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFileTitle = NULL; // we don't need to get the name of the file
if(path)
{
@ -1265,7 +1265,7 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c
}
else ofn.lpstrInitialDir = NULL;
ofn.lpstrTitle = title;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
/* Display the Open dialog box. */
// it's open or close depending on 'open' parameter
@ -1282,7 +1282,7 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c
if(pattern != NULL)
type = typelist.GetTypeForWin32Filter(customfilter+1);
#ifdef FILEDLG_DBG
Sys_Printf("Done.\n");
#endif
@ -1293,7 +1293,7 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c
// do that the Gtk way
if (title == NULL)
title = open ? "Open File" : "Save File";
#ifdef FILEDLG_DBG
Sys_Printf("Doing Gtk file dialog:\nBuilding new_path..");
#endif
@ -1351,10 +1351,10 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c
gtk_signal_connect (GTK_OBJECT (file_sel), "delete_event",
GTK_SIGNAL_FUNC (dialog_delete_callback), NULL);
gtk_file_selection_hide_fileop_buttons (GTK_FILE_SELECTION (file_sel));
if (parent != NULL)
gtk_window_set_transient_for (GTK_WINDOW (file_sel), GTK_WINDOW (parent));
#ifdef FILEDLG_DBG
Sys_Printf("set_data...");
#endif
@ -1364,7 +1364,7 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c
#ifdef FILEDLG_DBG
Sys_Printf("Done.\n");
#endif
if (!open)
{
#ifdef FILEDLG_DBG
@ -1375,11 +1375,11 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c
Sys_Printf("Done.\n");
#endif
}
if (new_path != NULL)
{
#ifdef FILEDLG_DBG
Sys_Printf("gtk_file_selection_set_filename... %p", file_sel);
Sys_Printf("gtk_file_selection_set_filename... %p", file_sel);
#endif
gtk_file_selection_set_filename (GTK_FILE_SELECTION (file_sel), new_path);
delete[] new_path;
@ -1390,15 +1390,15 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c
gtk_grab_add (file_sel);
#ifdef FILEDLG_DBG
Sys_Printf("gtk_widget_show... %p", file_sel);
Sys_Printf("gtk_widget_show... %p", file_sel);
#endif
gtk_widget_show (file_sel);
#ifdef FILEDLG_DBG
Sys_Printf("Done.\n");
Sys_Printf("Done.\n");
#endif
#ifdef FILEDLG_DBG
Sys_Printf("gtk_main_iteration...");
Sys_Printf("gtk_main_iteration...");
#endif
while (loop)
gtk_main_iteration ();
@ -1413,7 +1413,7 @@ const char* file_dialog (void *parent, gboolean open, const char* title, const c
#ifdef FILEDLG_DBG
Sys_Printf("Done.\n");
#endif
gtk_grab_remove (file_sel);
gtk_widget_destroy (file_sel);
#ifdef _WIN32

View File

@ -2,30 +2,30 @@
Copyright (c) 2001, Loki software, inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
Neither the name of Loki software nor the names of its contributors may be used
to endorse or promote products derived from this software without specific prior
written permission.
Neither the name of Loki software nor the names of its contributors may be used
to endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _GTK_MISC_H_
@ -62,14 +62,14 @@ gint widget_delete_hide (GtkWidget *widget);
// GdkPixmap **gdkpixmap, GdkBitmap **mask
bool WINAPI load_plugin_bitmap (const char* filename, void **gdkpixmap, void **mask);
void load_pixmap (const char* filename, GtkWidget* widget, GdkPixmap **gdkpixmap, GdkBitmap **mask);
GtkWidget* new_pixmap (GtkWidget* widget, char* filename);
GtkWidget* new_pixmap (GtkWidget* widget, const char* filename);
GtkWidget* menu_separator (GtkWidget *menu);
GtkWidget* menu_tearoff (GtkWidget *menu);
GtkWidget* create_sub_menu_with_mnemonic (GtkWidget *bar, char *mnemonic);
GtkWidget* create_menu_item_with_mnemonic (GtkWidget *menu, gchar *mnemonic, GtkSignalFunc func, int id);
GtkWidget* create_check_menu_item_with_mnemonic (GtkWidget *menu, gchar *mnemonic, GtkSignalFunc func, int id, gboolean active);
GtkWidget* create_radio_menu_item_with_mnemonic (GtkWidget *menu, GtkWidget *last, gchar *mnemonic, GtkSignalFunc func, int id, gboolean state);
GtkWidget* create_sub_menu_with_mnemonic (GtkWidget *bar, const gchar *mnemonic);
GtkWidget* create_menu_item_with_mnemonic (GtkWidget *menu, const gchar *mnemonic, GtkSignalFunc func, int id);
GtkWidget* create_check_menu_item_with_mnemonic (GtkWidget *menu, const gchar *mnemonic, GtkSignalFunc func, int id, gboolean active);
GtkWidget* create_radio_menu_item_with_mnemonic (GtkWidget *menu, GtkWidget *last, const gchar *mnemonic, GtkSignalFunc func, int id, gboolean state);
GtkWidget* create_menu_in_menu_with_mnemonic (GtkWidget *menu, const gchar *mnemonic);

View File

@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#if defined (__linux__) || defined (__APPLE__)
#include <gdk/gdkx.h>
#include <pwd.h>
#include <unistd.h>
#include <unistd.h>
#ifdef __linux__
#include <mntent.h>
#endif
@ -34,6 +34,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#endif
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include "stdafx.h"
#include <assert.h>
#include <sys/types.h>
@ -231,10 +232,10 @@ int loki_getmountpoint(const char *device, char *mntpt, int max_size)
endmntent( mountfp );
}
return(mounted);
}
}
#endif
/*
/*
This function gets the directory containing the running program.
argv0 - the 0'th argument to the program
*/
@ -563,7 +564,7 @@ int main( int argc, char* argv[] ) {
// (for now I had to create symlinks)
g_strBitmapsPath = g_strAppPath;
g_strBitmapsPath += "bitmaps/";
// we will set this right after the game selection is done
g_strGameToolsPath = g_strAppPath;
@ -631,7 +632,7 @@ int main( int argc, char* argv[] ) {
if ( pid ) {
fclose( pid );
}
// a safe check to avoid people running broken installations
// (otherwise, they run it, crash it, and blame us for not forcing them hard enough to pay attention while installing)
// make something idiot proof and someone will make better idiots, this may be overkill
@ -640,7 +641,7 @@ int main( int argc, char* argv[] ) {
#ifndef _DEBUG
//#define CHECK_VERSION
#endif
#ifdef CHECK_VERSION
#ifdef CHECK_VERSION
// locate and open RADIANT_MAJOR and RADIANT_MINOR
qboolean bVerIsGood = true;
Str ver_file_name;
@ -703,7 +704,7 @@ int main( int argc, char* argv[] ) {
_exit(-1);
}
#endif
g_qeglobals.disable_ini = false;
g_PrefsDlg.Init();
@ -713,7 +714,7 @@ int main( int argc, char* argv[] ) {
msg = "WARNING: Could not delete "; msg += g_pidGameFile;
gtk_MessageBox (NULL, msg, "Radiant", MB_OK | MB_ICONERROR );
}
/*!
now the secondary game dependant .pid file
http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=297
@ -867,7 +868,7 @@ int main( int argc, char* argv[] ) {
gtk_window_set_transient_for( GTK_WINDOW( splash_screen ), GTK_WINDOW( g_pParentWnd->m_pWidget ) );
gtk_timeout_add( 1000, try_destroy_splash, NULL );
#endif
g_pParentWnd->GetSynapseServer().DumpActiveClients();
//++timo: temporary debug
@ -935,7 +936,7 @@ void QE_ExpandBspString (char *bspaction, GPtrArray *out_array, char *mapname)
// HACK: halflife compiler tools don't support -fs_game
// HACK: neither does JKII/SoF2/ etc..
// do we use & have fs_game?
if (g_pGameDescription->mGameFile != "hl.game" &&
*ValueForKey(g_qeglobals.d_project_entity,"gamename") != '\0')
{
@ -1090,9 +1091,9 @@ void RunBsp (char *command)
{
strSys += (char *)g_ptr_array_index( sys, i);
#ifdef _WIN32 // write temp\junk.txt in win32... NOTE: stops output to shell prompt window
if (i==0)
if (i==0)
strSys += " >";
else
else
strSys += " >>";
strSys += "\"";
strSys += temppath;
@ -1124,7 +1125,7 @@ void RunBsp (char *command)
if (!hFile)
Error ("Can't write to %s", batpath);
fprintf (hFile, strSys.GetBuffer());
fclose (hFile);
fclose (hFile);
#endif
Pointfile_Delete ();
@ -1188,7 +1189,7 @@ int WINAPI QEW_SetupPixelFormat(HDC hDC, qboolean zbuffer )
0, // reserved
0, 0, 0 // layer masks ignored
}; //
int pixelformat = 0;
int pixelformat = 0;
zbuffer = true;
if ( !zbuffer )
@ -1198,15 +1199,15 @@ int WINAPI QEW_SetupPixelFormat(HDC hDC, qboolean zbuffer )
{
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL
NULL
);
Sys_FPrintf (SYS_WRN, "GetLastError: %s", lpMsgBuf);
Error ("ChoosePixelFormat failed");

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "gtkr_vector.h"
#ifdef __APPLE__
#define __toascii(c) ((c) & 0x7f)
#define __toascii(c) ((c) & 0x7f)
#endif
const int RAD_SHIFT = 0x01;
@ -44,16 +44,16 @@ const int RAD_PRESS = 0x08;
struct SCommandInfo
{
char* m_strCommand;
const char* m_strCommand;
unsigned int m_nKey;
unsigned int m_nModifiers;
unsigned int m_nCommand;
char* m_strMenu;
const char* m_strMenu;
};
struct SKeyInfo
{
char* m_strName;
const char* m_strName;
unsigned int m_nVKKey;
};
@ -431,13 +431,13 @@ public:
bool RequestAPI(APIDescriptor_t *pAPI);
const char* GetInfo();
const char* GetName();
void ImportMap(IDataStream *in, CPtrArray *ents, const char *type);
void ExportMap(CPtrArray *ents, IDataStream *out, const char *type);
CSynapseClientRadiant() { }
virtual ~CSynapseClientRadiant() { }
};
};
class MainFrame
{
@ -475,7 +475,7 @@ protected:
/*!
build the menu once the filename is found
*/
void process_xlink (Str &FileName, char *menu_name, const char *base_url, GtkWidget *menu, GtkAccelGroup *accel);
void process_xlink (Str &FileName, const char *menu_name, const char *base_url, GtkWidget *menu, GtkAccelGroup *accel);
void Create ();
void create_main_menu (GtkWidget *window, GtkWidget *vbox);
@ -542,7 +542,7 @@ public:
void ReleaseContexts ();
void CreateContexts ();
void SetActiveXY(XYWnd* p)
void SetActiveXY(XYWnd* p)
{
if (m_pActiveXY)
m_pActiveXY->SetActive(false);

View File

@ -32,7 +32,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
extern MainFrame* g_pParentWnd;
int modified; // for quit confirmation (0 = clean, 1 = unsaved,
// 2 = autosaved, but not regular saved)
// 2 = autosaved, but not regular saved)
char currentmap[1024];
@ -136,7 +136,7 @@ void Map_BuildBrushData(void)
Sys_EndWait();
}
entity_t *Map_FindClass (char *cname)
entity_t *Map_FindClass (const char *cname)
{
entity_t *ent;
@ -335,7 +335,7 @@ void Map_ImportEntities(CPtrArray *ents, bool bAddSelected = false)
num_brushes = 0;
e = (entity_t*)ents->GetAt(i);
brushes = (CPtrArray*)e->pData;
num_brushes = brushes->GetSize();
// link brushes into entity
for(j=0; j<num_brushes; j++)
@ -374,22 +374,22 @@ void Map_ImportEntities(CPtrArray *ents, bool bAddSelected = false)
#ifdef TERRAIN_HACK
if ((strcmp(ValueForKey(e, "terrain"),"1") == 0 && strcmp(e->eclass->name,"func_group") == 0))
{
// two aux pointers to the shaders used in the terrain entity
// we don't keep refcount on them since they are only temporary
// this avoids doing expensive lookups by name for all faces
IShader *pTerrainShader, *pCaulk;
pTerrainShader = NULL;
pCaulk = QERApp_Shader_ForName(SHADER_CAULK);
for(b = e->brushes.onext; b!=&e->brushes; b=b->onext)
{
if (pTerrainShader == NULL)
for(f = b->brush_faces; f != NULL; f = f->next)
if (strcmp(f->texdef.GetName(), SHADER_CAULK)!=0)
pTerrainShader = f->pShader;
if (pTerrainShader)
{
for(f = b->brush_faces; f != NULL; f = f->next)
@ -473,7 +473,7 @@ void Map_ImportEntities(CPtrArray *ents, bool bAddSelected = false)
entity_t *e_target;
const char *target = ValueForKey(e, "target");
qboolean bCollision=FALSE;
// check the current map entities for an actual collision
for (e_target = entities.next; e_target != &entities; e_target = e_target->next)
{
@ -488,7 +488,7 @@ void Map_ImportEntities(CPtrArray *ents, bool bAddSelected = false)
}
}
}
// find the matching targeted entity(s)
if(bCollision)
{
@ -513,17 +513,17 @@ void Map_ImportEntities(CPtrArray *ents, bool bAddSelected = false)
g_ptr_array_free(t_ents, FALSE);
}
}
// add the entity to the end of the entity list
Entity_AddToList(e, &entities);
g_qeglobals.d_num_entities++;
// keep a list of ents added to avoid testing collisions against them
g_ptr_array_add(new_ents, (gpointer)e);
}
}
g_ptr_array_free(new_ents, FALSE);
ents->RemoveAll();
g_qeglobals.bNeedConvert = false;
@ -551,7 +551,7 @@ void Map_LoadFile (const char *filename)
Sys_BeginWait ();
Select_Deselect();
/*!
\todo FIXME TTimo why is this commented out?
\todo FIXME TTimo why is this commented out?
stability issues maybe? or duplicate feature?
forcing to show the console during map load was a good thing IMO
*/
@ -609,15 +609,15 @@ void Map_LoadFile (const char *filename)
Sys_Printf ("--- LoadMapFile ---\n");
Sys_Printf ("%s\n", filename );
Sys_Printf ("%5i brushes\n", g_qeglobals.d_parsed_brushes );
Sys_Printf ("%5i entities\n", g_qeglobals.d_num_entities);
Sys_Printf ("%5.2f second(s) load time\n", elapsed_time );
Sys_EndWait();
Map_RestoreBetween ();
//
// move the view to a start position
//
@ -707,11 +707,11 @@ void Map_ExportEntities(CPtrArray* ents, bool bRegionOnly = false, bool bSelecte
/*!
\todo the entity_t needs to be reworked and asbtracted some more
keeping the entity_t as the struct providing access to a list of map objects, a list of epairs and various other info?
but separating some more the data that belongs to the entity_t and the 'sons' data
on a side note, I don't think that doing that with linked list would be a good thing
for now, we use the blind void* in entity_t casted to a CPtrArray of brush_t* to hand out a list of the brushes for map write
the next step is very likely to be a change of the brush_t* to a more abstract object?
*/
@ -747,7 +747,7 @@ void Map_Export(IDataStream *out, const char *type, bool bRegionOnly, bool bSele
entity_t *e;
CPtrArray ents;
if (bRegionOnly && region_active)
AddRegionBrushes();
@ -855,7 +855,7 @@ void Map_New (void)
Sys_SetTitle (currentmap);
world_entity = (entity_s*)qmalloc(sizeof(*world_entity));
world_entity->brushes.onext =
world_entity->brushes.onext =
world_entity->brushes.oprev = &world_entity->brushes;
SetKeyValue (world_entity, "classname", "worldspawn");
world_entity->eclass = Eclass_ForName ("worldspawn", true);
@ -935,13 +935,13 @@ void AddRegionBrushes (void)
region_sides[i+3] = Brush_Create (mins, maxs, &td);
}
// http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=503
// this is a safe check, but it should not really happen anymore
// this is a safe check, but it should not really happen anymore
vec3_t vOrig;
VectorSet(vOrig,
(int)g_pParentWnd->GetCamWnd()->Camera()->origin[0],
(int)g_pParentWnd->GetCamWnd()->Camera()->origin[1],
(int)g_pParentWnd->GetCamWnd()->Camera()->origin[1],
(int)g_pParentWnd->GetCamWnd()->Camera()->origin[2]);
for (i=0 ; i<3 ; i++)
@ -951,7 +951,7 @@ void AddRegionBrushes (void)
Sys_FPrintf(SYS_ERR, "Camera is NOT in the region, it's likely that the region won't compile correctly\n");
}
}
// write the info_playerstart
region_startpoint = Entity_Alloc();
SetKeyValue(region_startpoint, "classname", "info_player_start");
@ -1010,7 +1010,7 @@ void Map_RegionOff (void)
region_maxs[i] = g_MaxWorldCoord-64;
region_mins[i] = g_MinWorldCoord+64;
}
for (b=filtered_brushes.next ; b != &filtered_brushes ; b=next)
{
next = b->next;
@ -1193,7 +1193,7 @@ GList *find_string(GList *glist, const char *buf)
void Map_ImportBuffer(char *buf)
{
Select_Deselect();
Undo_Start("import buffer");
MemStream stream;
@ -1201,10 +1201,10 @@ void Map_ImportBuffer(char *buf)
stream.Write(buf, strlen(buf));
Map_Import(&stream, "xmap");
stream.Close();
Sys_UpdateWindows (W_ALL);
Sys_MarkMapModified();
Undo_End();
}
@ -1313,9 +1313,9 @@ void Region_SpawnPoint(FILE *f)
// write the info_player_start, we use the camera position
fprintf (f, "{\n");
fprintf (f, "\"classname\" \"info_player_start\"\n");
fprintf (f, "\"origin\" \"%i %i %i\"\n",
fprintf (f, "\"origin\" \"%i %i %i\"\n",
(int)g_pParentWnd->GetCamWnd()->Camera()->origin[0],
(int)g_pParentWnd->GetCamWnd()->Camera()->origin[1],
(int)g_pParentWnd->GetCamWnd()->Camera()->origin[1],
(int)g_pParentWnd->GetCamWnd()->Camera()->origin[2]);
fprintf (f, "\"angle\" \"%i\"\n", (int)g_pParentWnd->GetCamWnd()->Camera()->angles[YAW]);
fprintf (f, "}\n");

File diff suppressed because it is too large Load Diff

View File

@ -231,7 +231,7 @@ CXMLPropertyBag::CXMLPropertyBag() {
// generic preference functions
void CXMLPropertyBag::PushAssignment(char *name, PrefTypes_t type, void *pV)
void CXMLPropertyBag::PushAssignment(const char *name, PrefTypes_t type, void *pV)
{
list<CPrefAssignment>::iterator iAssign;
for(iAssign=mPrefAssignments.begin(); iAssign!=mPrefAssignments.end(); iAssign++)
@ -274,7 +274,7 @@ xmlNodePtr CXMLPropertyBag::EpairForName(const char *name)
return ret;
}
void CXMLPropertyBag::GetPref(char *name, Str *pV, char *V)
void CXMLPropertyBag::GetPref(const char *name, Str *pV, const char *V)
{
xmlNodePtr pNode = EpairForName( name );
if ( pNode )
@ -296,9 +296,9 @@ void CXMLPropertyBag::GetPref(char *name, Str *pV, char *V)
PushAssignment(name, PREF_STR, pV);
}
void CXMLPropertyBag::GetPref(char *name, int *pV, int V)
void CXMLPropertyBag::GetPref(const char *name, int *pV, int V)
{
xmlNodePtr pNode;
xmlNodePtr pNode;
if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
{
*pV = atoi((char *)pNode->children->content);
@ -312,12 +312,12 @@ void CXMLPropertyBag::GetPref(char *name, int *pV, int V)
*pV=V;
}
// push the pref assignment if needed
PushAssignment(name, PREF_INT, pV);
PushAssignment(name, PREF_INT, pV);
}
void CXMLPropertyBag::GetPref(char *name, bool *pV, bool V)
void CXMLPropertyBag::GetPref(const char *name, bool *pV, bool V)
{
xmlNodePtr pNode;
xmlNodePtr pNode;
if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
{
if (!strcmp((char *)pNode->children->content, "true"))
@ -338,12 +338,12 @@ void CXMLPropertyBag::GetPref(char *name, bool *pV, bool V)
*pV=V;
}
// push the pref assignment
PushAssignment(name, PREF_BOOL, pV);
PushAssignment(name, PREF_BOOL, pV);
}
void CXMLPropertyBag::GetPref(char *name, float *pV, float V)
void CXMLPropertyBag::GetPref(const char *name, float *pV, float V)
{
xmlNodePtr pNode;
xmlNodePtr pNode;
if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
{
*pV = atof((char *)pNode->children->content);
@ -357,12 +357,12 @@ void CXMLPropertyBag::GetPref(char *name, float *pV, float V)
*pV=V;
}
// push the pref assignment if needed
PushAssignment(name, PREF_FLOAT, pV);
PushAssignment(name, PREF_FLOAT, pV);
}
void CXMLPropertyBag::GetPref(char *name, float* pV, float* V)
void CXMLPropertyBag::GetPref(const char *name, float* pV, float* V)
{
xmlNodePtr pNode;
xmlNodePtr pNode;
if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
{
sscanf((char *)pNode->children->content, "%f %f %f", &pV[0], &pV[1], &pV[2]);
@ -378,12 +378,12 @@ void CXMLPropertyBag::GetPref(char *name, float* pV, float* V)
pV[2] = V[2];
}
// push the pref assignment if needed
PushAssignment(name, PREF_VEC3, pV);
PushAssignment(name, PREF_VEC3, pV);
}
void CXMLPropertyBag::GetPref(char *name, window_position_t* pV, window_position_t V)
void CXMLPropertyBag::GetPref(const char *name, window_position_t* pV, window_position_t V)
{
xmlNodePtr pNode;
xmlNodePtr pNode;
if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
{
WindowPosition_Parse(*pV, CString((xmlChar *)pNode->children->content));
@ -397,7 +397,7 @@ void CXMLPropertyBag::GetPref(char *name, window_position_t* pV, window_position
*pV = V;
}
// push the pref assignment if needed
PushAssignment(name, PREF_WNDPOS, pV);
PushAssignment(name, PREF_WNDPOS, pV);
}
void CXMLPropertyBag::UpdatePrefTree()
@ -485,7 +485,7 @@ void CXMLPropertyBag::ReadXMLFile(const char* pFilename)
Sys_FPrintf(SYS_ERR, "Wrong version '%s' in <qpref> node for '%s'\n", (char*)tmp_attr_ptr->children->content, mpDoc->URL);
xmlFreeDoc(mpDoc);
mpDoc = NULL;
}
}
Sys_Printf("Opened XML property file: '%s'\n", pFilename);
}
@ -504,7 +504,7 @@ void CXMLPropertyBag::ReadXMLFile(const char* pFilename)
qboolean CXMLPropertyBag::WriteXMLFile(const char* pFilename)
{
int res = xmlSaveFormatFile(pFilename, mpDoc, 1);
if(res == -1)
return false;
@ -520,9 +520,9 @@ qboolean CXMLPropertyBag::WriteXMLFile(const char* pFilename)
static void OnBtnBrowseEditor (GtkWidget *widget, gpointer data)
{
PrefsDlg *dlg = (PrefsDlg*)data;
const char *filename = file_dialog(g_PrefsDlg.GetWidget(), TRUE, "Executable for Custom Editor");
if(filename != NULL)
{
dlg->m_strEditorCommand = filename;
@ -568,7 +568,7 @@ static void OnBtnBrowseuserini (GtkWidget *widget, gpointer data)
}
}
static void OnButtonClean (GtkWidget *widget, gpointer data)
static void OnButtonClean (GtkWidget *widget, gpointer data)
{
// make sure this is what the user wants
if (gtk_MessageBox (g_PrefsDlg.GetWidget (), "This will close Radiant and clean the corresponding registry entries.\n"
@ -698,7 +698,7 @@ CGameDescription::CGameDescription(xmlDocPtr pDoc, const Str &GameFile)
{
char *p, *prop;
mpDoc = pDoc;
// read the user-friendly game name
// read the user-friendly game name
xmlNodePtr pNode = mpDoc->children;
while (strcmp((const char*)pNode->name, "game") && pNode != NULL) pNode=pNode->next;
@ -918,8 +918,6 @@ CPrefAssignment::CPrefAssignment(const CPrefAssignment& ass)
void CGameDialog::LoadPrefs()
{
bool bEmpty = false;
// if we already have a document loaded, we will free and reload from file
if (mGlobalPrefs.InUse())
{
@ -962,10 +960,10 @@ void CGameDialog::SavePrefs()
{
// update the tree and save it
mGlobalPrefs.UpdatePrefTree();
CString strGlobalPref = g_PrefsDlg.m_global_rc_path->str;
strGlobalPref += "global.pref";
if ( !mGlobalPrefs.WriteXMLFile( strGlobalPref.GetBuffer() ) ) {
Sys_FPrintf(SYS_ERR, "Error occured while saving global prefs file '%s'\n", strGlobalPref.GetBuffer());
}
@ -981,14 +979,14 @@ void CGameDialog::DoGameInstall() {
void CGameDialog::DoGameDialog() {
// allow looping the game selection dialog with calls to the game configure dialog in between
while ( m_bDoGameInstall ) {
m_bDoGameInstall = false;
if ( DoModal() == IDCANCEL ) {
Error( "game selection dialog canceled, cannot continue" );
return;
}
if ( m_bDoGameInstall ) {
DoGameInstall();
ScanForGames();
@ -1037,7 +1035,7 @@ GtkWidget* CGameDialog::GetGlobalFrame()
gtk_widget_show(check);
gtk_box_pack_start (GTK_BOX(vbox), check, FALSE, FALSE, 0);
AddDialogData (check, &m_bAutoLoadGame, DLG_CHECK_BOOL);
text = gtk_label_new("(this frame is available in the prefs menu if you set auto-select)");
gtk_widget_show(text);
gtk_box_pack_start (GTK_BOX(vbox), text, FALSE, FALSE, 0);
@ -1104,7 +1102,7 @@ void CGameDialog::SInstallCallback( GtkWidget *widget, gpointer data ) {
void CGameDialog::BuildDialog() {
GtkWidget *dlg, *vbox1, *button, *setup_button;
dlg = m_pWidget;
gtk_window_set_title( GTK_WINDOW( dlg ), "Select Game" );
@ -1130,7 +1128,7 @@ void CGameDialog::BuildDialog() {
gtk_widget_show( button );
gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 );
AddModalButton( button, IDCANCEL );
gtk_widget_set_usize( button, 60, -2 );
}
@ -1144,13 +1142,13 @@ void CGameDialog::UpdateGameCombo() {
}
// clear whatever is in - wtf no way to know how many text entries?
// use set/get active to track
// use set/get active to track
gtk_combo_box_set_active( mGameCombo, 0 );
while ( gtk_combo_box_get_active( mGameCombo ) == 0 ) {
gtk_combo_box_remove_text( mGameCombo, 0 );
gtk_combo_box_set_active( mGameCombo, 0 );
}
for ( iGame = mGames.begin(); iGame != mGames.end(); iGame++ ) {
gtk_combo_box_append_text( mGameCombo, (*iGame)->mGameName.GetBuffer() );
}
@ -1304,7 +1302,7 @@ void CGameDialog::Init()
#else
g_qeglobals.m_strHomeGame = g_pGameDescription->mEnginePath.GetBuffer();
#endif
g_pGameDescription->Dump();
}
@ -1330,8 +1328,8 @@ void CGameDialog::AddPacksURL(Str &URL)
// FIXME: this is kinda hardcoded for now..
list<CGameDescription *>::iterator iGame;
for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++)
{
if ((*iGame)->mGameFile == "q3.game")
{
if ((*iGame)->mGameFile == "q3.game")
URL += "&Games_dlup%5B%5D=1";
else if ((*iGame)->mGameFile == "wolf.game")
URL += "&Games_dlup%5B%5D=2";
@ -1448,16 +1446,16 @@ void PrefsDlg::Init()
#endif
// this is common to win32 and Linux init now
m_rc_path = g_string_new (m_global_rc_path->str);
// game sub-dir
g_string_append (m_rc_path, g_pGameDescription->mGameFile.GetBuffer());
g_string_append (m_rc_path, "/");
Q_mkdir (m_rc_path->str, 0775);
// then the ini file
m_inipath = g_string_new (m_rc_path->str);
g_string_append (m_inipath, PREFS_LOCAL_FILENAME);
}
void PrefsDlg::UpdateData (bool retrieve)
@ -1494,7 +1492,7 @@ void PrefsDlg::showPrefPage(int prefpage)
{
if(gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook)) != prefpage)
gtk_notebook_set_page(GTK_NOTEBOOK(notebook), prefpage);
return;
}
@ -1521,20 +1519,20 @@ void PrefsDlg::BuildDialog ()
GtkWidget *check, *label, *scale, *hbox2, *combo,
*table, *spin, *entry, *pixmap,
*radio, *button, *pageframe, *vbox;
GList *combo_list = (GList*)NULL;
GtkObject *adj;
dialog = m_pWidget;
gtk_window_set_title(GTK_WINDOW(dialog), "GtkRadiant Preferences");
gtk_widget_realize(dialog);
mainvbox = gtk_vbox_new(FALSE, 5);
gtk_container_add(GTK_CONTAINER(dialog), mainvbox);
gtk_container_set_border_width(GTK_CONTAINER(mainvbox), 5);
gtk_widget_show(mainvbox);
hbox = gtk_hbox_new(FALSE, 5);
gtk_widget_show(hbox);
gtk_box_pack_end(GTK_BOX(mainvbox), hbox, FALSE, TRUE, 0);
@ -1556,11 +1554,11 @@ void PrefsDlg::BuildDialog ()
gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(OnButtonClean), this);
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
gtk_widget_set_usize (button, 60, -2);
hbox = gtk_hbox_new(FALSE, 5);
gtk_box_pack_start(GTK_BOX(mainvbox), hbox, TRUE, TRUE, 0);
gtk_widget_show(hbox);
sc_win = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sc_win), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_box_pack_start(GTK_BOX(hbox), sc_win, FALSE, FALSE, 0);
@ -1631,7 +1629,7 @@ void PrefsDlg::BuildDialog ()
gtk_tree_store_set(store, &tab, 0, "Texture Settings", 1, (gpointer)PTAB_TEXTURE, -1);
}
}
{
GtkTreeIter group;
gtk_tree_store_append(store, &group, NULL);
@ -1652,7 +1650,7 @@ void PrefsDlg::BuildDialog ()
gtk_tree_store_set(store, &tab, 0, "Editing", 1, (gpointer)PTAB_EDITING, -1);
}
}
{
GtkTreeIter group;
gtk_tree_store_append(store, &group, NULL);
@ -1682,14 +1680,14 @@ void PrefsDlg::BuildDialog ()
}
gtk_tree_view_expand_all(GTK_TREE_VIEW(view));
g_object_unref(G_OBJECT(store));
}
/**********************************************************************/
/* build the prefs pages */
/**********************************************************************/
// Front page...
// todo : add something interesting here
// NOTE TTimo: tip of the day? or a logo?
@ -1703,7 +1701,7 @@ void PrefsDlg::BuildDialog ()
gtk_widget_set_usize(GTK_WIDGET(vbox), 350, -2);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
gtk_container_add(GTK_CONTAINER(pageframe), vbox);
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
/******** global preferences group ****************************/
@ -1712,7 +1710,7 @@ void PrefsDlg::BuildDialog ()
pageframe = mGamesDialog.GetGlobalFrame();
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
/******** 2D prefs group (xy views/rendering options) *********/
preflabel = gtk_label_new("2D Display");
gtk_widget_show(preflabel);
@ -1723,26 +1721,26 @@ void PrefsDlg::BuildDialog ()
gtk_widget_show(vbox);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
gtk_container_add(GTK_CONTAINER(pageframe), vbox);
// OpenGL Display Lists
check = gtk_check_button_new_with_label("OpenGL Display Lists");
gtk_widget_show(check);
gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
AddDialogData(check, &m_bDisplayLists, DLG_CHECK_BOOL);
// Antialiased points & lines
// Fishman - Add antialiazed points and lines support. 09/03/00
check = gtk_check_button_new_with_label ("OpenGL antialiased points and lines");
gtk_widget_show (check);
gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
AddDialogData (check, &m_bAntialiasedPointsAndLines, DLG_CHECK_BOOL);
// Solid selection boxes
check = gtk_check_button_new_with_label ("Solid selection boxes");
gtk_widget_show (check);
gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
AddDialogData (check, &m_bNoStipple, DLG_CHECK_BOOL);
// Display size info
check = gtk_check_button_new_with_label ("Display size info");
gtk_widget_show (check);
@ -1766,10 +1764,10 @@ void PrefsDlg::BuildDialog ()
gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
AddDialogData(check, &m_bGlATIHack, DLG_CHECK_BOOL);
#endif
// Add the page to the notebook
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
/******** 3D Camera view group *********/
preflabel = gtk_label_new("3D View");
gtk_widget_show(preflabel);
@ -1786,62 +1784,62 @@ void PrefsDlg::BuildDialog ()
hbox2 = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox2);
gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
// label
label = gtk_label_new("Movement Velocity");
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
gtk_widget_show(label);
gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
// adjustment
adj = gtk_adjustment_new(100, 50, 300, 1, 10, 10);
AddDialogData(adj, &m_nMoveSpeed, DLG_ADJ_INT);
// scale
scale = gtk_hscale_new(GTK_ADJUSTMENT(adj));
gtk_widget_show(scale);
gtk_box_pack_start(GTK_BOX (vbox), scale, FALSE, TRUE, 2);
gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
// Angular velocity (Rotational Velocity)
// label container
hbox2 = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox2);
gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
// label
label = gtk_label_new ("Rotational Velocity");
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
gtk_widget_show (label);
gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
// adjustment
adj = gtk_adjustment_new (3, 1, 180, 1, 10, 10); // value, low, high, step, page_step, page_size
AddDialogData (adj, &m_nAngleSpeed, DLG_ADJ_INT);
// scale
scale = gtk_hscale_new (GTK_ADJUSTMENT (adj));
gtk_widget_show (scale);
gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, TRUE, 2);
gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
// Text under the velocity sliders
// container
hbox2 = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox2);
gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
// label
label = gtk_label_new ("slow");
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
// label
label = gtk_label_new ("fast");
gtk_widget_show (label);
gtk_box_pack_end (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
// Allow drag to select multiple faces/brushes
// container
table = gtk_table_new(2, 1, FALSE);
@ -1869,7 +1867,7 @@ void PrefsDlg::BuildDialog ()
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
AddDialogData (combo, &m_nCamDragMultiSelect, DLG_COMBO_INT);
AddDialogData (combo, &m_nCamDragMultiSelect, DLG_COMBO_INT);
// Freelook in Camera view
check = gtk_check_button_new_with_label ("Freelook in Camera view");
@ -1919,7 +1917,7 @@ void PrefsDlg::BuildDialog ()
gtk_widget_show(vbox);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
gtk_container_add(GTK_CONTAINER(pageframe), vbox);
// Texture quality slider
// label
label = gtk_label_new ("Texture quality");
@ -1927,11 +1925,11 @@ void PrefsDlg::BuildDialog ()
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
// adjustment
adj = gtk_adjustment_new (0, 0, 4, 1, 1, 1);
AddDialogData (adj, &m_nLatchedTextureQuality, DLG_ADJ_INT);
// scale
scale = gtk_hscale_new (GTK_ADJUSTMENT (adj));
gtk_widget_show (scale);
@ -1954,7 +1952,7 @@ void PrefsDlg::BuildDialog ()
gtk_widget_show (check);
gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
AddDialogData (check, &m_bTextureWindow, DLG_CHECK_BOOL);
// texture scrollbar
check = gtk_check_button_new_with_label ("Texture scrollbar");
gtk_widget_show (check);
@ -2030,7 +2028,7 @@ void PrefsDlg::BuildDialog ()
(GtkAttachOptions) (0),
(GtkAttachOptions) (0), 0, 0);
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
// combo list
combo_list = NULL;
combo_list = g_list_append (combo_list, (void *)"None");
@ -2050,10 +2048,10 @@ void PrefsDlg::BuildDialog ()
gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
AddDialogData (combo, &m_nLatchedShader, DLG_COMBO_INT);
g_list_free (combo_list);
// Add the page to the notebook
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
/******** Layout group *********/
preflabel = gtk_label_new("Layout");
gtk_widget_show(preflabel);
@ -2129,13 +2127,13 @@ void PrefsDlg::BuildDialog ()
(GtkAttachOptions) (0),
(GtkAttachOptions) (0), 0, 0);
AddDialogData (radio, &m_nLatchedView, DLG_RADIO_INT);
// Floating Z window
check = gtk_check_button_new_with_label ("Floating Z Window");
gtk_widget_show (check);
gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
AddDialogData (check, &m_bLatchedFloatingZ, DLG_CHECK_BOOL);
// show menu tear-off seperators
check = gtk_check_button_new_with_label ("Detachable Menus");
gtk_widget_show (check);
@ -2179,11 +2177,11 @@ void PrefsDlg::BuildDialog ()
g_object_set_data (G_OBJECT (dialog), "check_startonprimary", check);
gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateSensitivity), this );
AddDialogData (check, &m_bStartOnPrimMon, DLG_CHECK_BOOL);
#endif
#endif
// Add the page to the notebook
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
/******** Mouse group *********/
preflabel = gtk_label_new("Mouse");
gtk_widget_show(preflabel);
@ -2194,7 +2192,7 @@ void PrefsDlg::BuildDialog ()
gtk_widget_show(vbox);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
gtk_container_add(GTK_CONTAINER(pageframe), vbox);
// Buttons
// container
hbox2 = gtk_hbox_new (FALSE, 5);
@ -2235,22 +2233,22 @@ void PrefsDlg::BuildDialog ()
hbox2 = gtk_hbox_new (FALSE, 5);
gtk_widget_show (hbox2);
gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0);
// label
label = gtk_label_new ("Wheel Mouse inc:");
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
// entry
entry = gtk_entry_new ();
gtk_widget_show (entry);
gtk_widget_set_usize (entry, 40, -2);
gtk_box_pack_start (GTK_BOX (hbox2), entry, FALSE, FALSE, 0);
AddDialogData (entry, &m_nWheelInc, DLG_ENTRY_INT);
AddDialogData (entry, &m_nWheelInc, DLG_ENTRY_INT);
// Add the page to the notebook
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
/******** Editing group *********/
preflabel = gtk_label_new("Editing");
gtk_widget_show(preflabel);
@ -2261,7 +2259,7 @@ void PrefsDlg::BuildDialog ()
gtk_widget_show(vbox);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
gtk_container_add(GTK_CONTAINER(pageframe), vbox);
// Vertex editing splits faces
check = gtk_check_button_new_with_label ("Vertex editing splits face");
gtk_widget_show (check);
@ -2273,7 +2271,7 @@ void PrefsDlg::BuildDialog ()
gtk_widget_show (check);
gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
AddDialogData (check, &m_bDoTargetFix, DLG_CHECK_BOOL);
// Clipper tool uses caulk
check = gtk_check_button_new_with_label ("Clipper tool uses caulk");
gtk_widget_show (check);
@ -2290,8 +2288,8 @@ void PrefsDlg::BuildDialog ()
check = gtk_check_button_new_with_label ("Select patches by bounding box");
gtk_widget_show (check);
gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
AddDialogData (check, &m_bPatchBBoxSelect, DLG_CHECK_BOOL);
AddDialogData (check, &m_bPatchBBoxSelect, DLG_CHECK_BOOL);
// Rotation increment
// container
table = gtk_table_new (2, 3, FALSE);
@ -2299,14 +2297,14 @@ void PrefsDlg::BuildDialog ()
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
// label
label = gtk_label_new ("Rotation increment:");
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
(GtkAttachOptions) (0),
(GtkAttachOptions) (0), 0, 0);
// entry
entry = gtk_entry_new ();
gtk_widget_show (entry);
@ -2315,7 +2313,7 @@ void PrefsDlg::BuildDialog ()
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
AddDialogData (entry, &m_nRotation, DLG_ENTRY_INT);
// Undo levels
// label
label = gtk_label_new ("Undo Levels:");
@ -2323,9 +2321,9 @@ void PrefsDlg::BuildDialog ()
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
(GtkAttachOptions) (0),
(GtkAttachOptions) (0), 0, 0);
// spinner (allows undo levels to be set to zero)
spin = gtk_spin_button_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0, 64, 1, 10, 10)), 1, 0);
spin = gtk_spin_button_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0, 64, 1, 10, 10)), 1, 0);
gtk_widget_show (spin);
gtk_table_attach (GTK_TABLE (table), spin, 1, 2, 1, 2,
(GtkAttachOptions) (GTK_FILL),
@ -2340,7 +2338,7 @@ void PrefsDlg::BuildDialog ()
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
(GtkAttachOptions) (0),
(GtkAttachOptions) (0), 0, 0);
// entry (spinner perhaps? [2-16])
entry = gtk_entry_new ();
gtk_widget_show (entry);
@ -2352,7 +2350,7 @@ void PrefsDlg::BuildDialog ()
// Add the page to the notebook
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
/******** Save/Load group *********/
preflabel = gtk_label_new("Startup/Auto save");
gtk_widget_show(preflabel);
@ -2369,7 +2367,7 @@ void PrefsDlg::BuildDialog ()
gtk_widget_show (check);
gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
AddDialogData (check, &m_bSnapShots, DLG_CHECK_BOOL);
// load last project on open
check = gtk_check_button_new_with_label ("Load last project on open");
gtk_widget_show (check);
@ -2388,28 +2386,28 @@ void PrefsDlg::BuildDialog ()
gtk_widget_show (hbox2);
gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (hbox2), 0);
// label
check = gtk_check_button_new_with_label ("Auto save every");
gtk_widget_show (check);
gtk_box_pack_start (GTK_BOX (hbox2), check, FALSE, FALSE, 0);
AddDialogData (check, &m_bAutoSave, DLG_CHECK_BOOL);
// spinner
spin = gtk_spin_button_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 1, 60, 1, 10, 10)), 1, 0);
gtk_widget_show (spin);
gtk_box_pack_start (GTK_BOX (hbox2), spin, FALSE, FALSE, 0);
gtk_widget_set_usize (spin, 60, -2);
AddDialogData (spin, &m_nAutoSave, DLG_SPIN_INT);
// label
label = gtk_label_new ("minutes");
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
// Add the page to the notebook
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
/******** Paths group *********/
preflabel = gtk_label_new("Paths");
gtk_widget_show(preflabel);
@ -2428,7 +2426,7 @@ void PrefsDlg::BuildDialog ()
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
// label
label = gtk_label_new ("Prefab path:");
gtk_widget_show (label);
@ -2436,7 +2434,7 @@ void PrefsDlg::BuildDialog ()
(GtkAttachOptions) (0),
(GtkAttachOptions) (0), 0, 0);
gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
// path entry
entry = gtk_entry_new ();
gtk_widget_show (entry);
@ -2447,7 +2445,7 @@ void PrefsDlg::BuildDialog ()
AddDialogData (entry, &m_strPrefabPath, DLG_ENTRY_TEXT);
// http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=805
#if 0
#if 0
// browse button
button = gtk_button_new_with_label ("...");
gtk_widget_show (button);
@ -2465,7 +2463,7 @@ void PrefsDlg::BuildDialog ()
(GtkAttachOptions) (0),
(GtkAttachOptions) (0), 0, 0);
gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
// user ini path entry
entry = gtk_entry_new ();
gtk_widget_show (entry);
@ -2473,7 +2471,7 @@ void PrefsDlg::BuildDialog ()
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 1, 0);
AddDialogData (entry, &m_strUserPath, DLG_ENTRY_TEXT);
// user ini browse button
button = gtk_button_new_with_label ("...");
gtk_widget_show (button);
@ -2484,7 +2482,7 @@ void PrefsDlg::BuildDialog ()
// Add the page to the notebook
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
/******** Misc group *********/
preflabel = gtk_label_new("Misc");
gtk_widget_show(preflabel);
@ -2495,7 +2493,7 @@ void PrefsDlg::BuildDialog ()
gtk_widget_show(vbox);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
gtk_container_add(GTK_CONTAINER(pageframe), vbox);
// Light drawing
check = gtk_check_button_new_with_label ("Light drawing");
gtk_widget_show (check);
@ -2544,7 +2542,7 @@ void PrefsDlg::BuildDialog ()
gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateEditorSensitivity), this);
g_object_set_data (G_OBJECT(dialog), "check_customeditor", check);
AddDialogData (check, &g_PrefsDlg.m_bUseCustomEditor, DLG_CHECK_BOOL);
// custom shader editor executable
// table
table = gtk_table_new (3, 1, FALSE);
@ -2552,7 +2550,7 @@ void PrefsDlg::BuildDialog ()
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
// label
label = gtk_label_new("Custom Editor Command");
gtk_widget_show(label);
@ -2562,7 +2560,7 @@ void PrefsDlg::BuildDialog ()
gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
g_object_set_data (G_OBJECT(dialog), "label_customeditor", label);
gtk_widget_set_sensitive (label, g_PrefsDlg.m_bUseCustomEditor);
// custom editor command entry
entry = gtk_entry_new ();
gtk_widget_show (entry);
@ -2573,7 +2571,7 @@ void PrefsDlg::BuildDialog ()
AddDialogData (entry, &m_strEditorCommand, DLG_ENTRY_TEXT);
gtk_widget_set_sensitive (entry, g_PrefsDlg.m_bUseCustomEditor);
g_object_set_data (G_OBJECT(dialog), "entry_customeditor", entry);
// browse button
button = gtk_button_new_with_label ("...");
gtk_widget_show (button);
@ -2621,15 +2619,15 @@ void PrefsDlg::BuildDialog ()
gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
g_object_set_data (G_OBJECT (dialog), "check_runengine", check);
gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateSensitivity), this );
AddDialogData( check, &g_PrefsDlg.m_bRunQuake, DLG_CHECK_BOOL );
AddDialogData( check, &g_PrefsDlg.m_bRunQuake, DLG_CHECK_BOOL );
// sleep mode when running engine
check = gtk_check_button_new_with_label ("Activate sleep mode when running the engine");
gtk_widget_show (check);
gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
g_object_set_data (G_OBJECT (dialog), "check_sleep", check);
AddDialogData( check, &g_PrefsDlg.m_bDoSleep, DLG_CHECK_BOOL );
// use q3map2's texture projection
check = gtk_check_button_new_with_label ("Texturing compatible with q3map2");
gtk_widget_show (check);
@ -2654,7 +2652,7 @@ void PrefsDlg::LoadTexdefPref(texdef_t* pTexdef, char* pName)
memset(pTexdef, 0, sizeof(texdef_t));
sprintf(buffer, "%s%s", pName, TD_SCALE1_KEY);
mLocalPrefs.GetPref(buffer, &pTexdef->scale[0], 0.5f);
mLocalPrefs.GetPref(buffer, &pTexdef->scale[0], 0.5f);
sprintf(buffer, "%s%s", pName, TD_SCALE2_KEY);
mLocalPrefs.GetPref(buffer, &pTexdef->scale[1], 0.5f);
@ -2676,7 +2674,7 @@ void PrefsDlg::UpdateTextureCompression()
Sys_Printf("OpenGL not ready - postpone texture compression capability check\n");
return;
}
if (g_qeglobals.bTextureCompressionSupported)
{
if (m_nTextureCompressionFormat >= 2 && !g_qeglobals.m_bS3CompressionSupported)
@ -2755,7 +2753,7 @@ void PrefsDlg::UpdateATIHack() {
}
#endif
// TTimo: m_strEnginePath has a special status, if not found in registry we need to
// TTimo: m_strEnginePath has a special status, if not found in registry we need to
// initiliaze it for sure. It is not totally failsafe but we can use the same
// code than in q3map, expecting to find some "quake" above us. If not, we prompt
// for the engine executable path
@ -2777,7 +2775,7 @@ void PrefsDlg::LoadPrefs ()
mLocalPrefs.GetPref(PATCHSHOWBOUNDS_KEY, &g_bPatchShowBounds, FALSE);
mLocalPrefs.GetPref(MOUSE_KEY, &m_nMouse, MOUSE_DEF);
m_nMouseButtons = m_nMouse ? 3 : 2;
// project file
// if it's not found here, mainframe.cpp will take care of finding one
mLocalPrefs.GetPref(LASTPROJ_KEY, &m_strLastProject, "");
@ -2827,7 +2825,7 @@ void PrefsDlg::LoadPrefs ()
mLocalPrefs.GetPref(DETACHABLEMENUS_KEY, &m_bLatchedDetachableMenus, TRUE);
m_bDetachableMenus = m_bLatchedDetachableMenus;
if (g_pGameDescription->mNoPatch)
{
m_bPatchToolbar = false;
@ -2840,7 +2838,7 @@ void PrefsDlg::LoadPrefs ()
mLocalPrefs.GetPref(WIDETOOLBAR_KEY, &m_bLatchedWideToolbar, TRUE);
m_bWideToolbar = m_bLatchedWideToolbar;
mLocalPrefs.GetPref(PLUGINTOOLBAR_KEY, &m_bLatchedPluginToolbar, TRUE);
m_bPluginToolbar = m_bLatchedPluginToolbar;
@ -2911,7 +2909,7 @@ void PrefsDlg::LoadPrefs ()
mLocalPrefs.GetPref(TARGETFIX_KEY, &m_bDoTargetFix, TRUE);
mLocalPrefs.GetPref(WHEELINC_KEY, &m_nWheelInc, 64);
mLocalPrefs.GetPref(PATCHBBOXSEL_KEY, &m_bPatchBBoxSelect, FALSE);
// Gef: Kyro GL_POINT workaround
mLocalPrefs.GetPref(GLPOINTWORKAROUND_KEY, &m_bGlPtWorkaround, FALSE);
@ -2949,11 +2947,11 @@ void PrefsDlg::LoadPrefs ()
// menu stuff
mLocalPrefs.GetPref(COUNT_KEY, &m_nMRUCount, 0);
for(i = 0; i < 4; i++)
for(i = 0; i < 4; i++)
{
char buf[64];
sprintf (buf, "%s%d", FILE_KEY, i);
mLocalPrefs.GetPref(buf, &m_strMRUFiles[i], "");
mLocalPrefs.GetPref(buf, &m_strMRUFiles[i], "");
}
// some platform specific prefs
@ -3126,7 +3124,7 @@ void PrefsDlg::DoSensitivity()
Msg += g_PrefsDlg.m_strLastProject;
Msg += ") is not at least version 2.\nI need version 2 or above to setup BSP monitoring correctly.";
gtk_MessageBox(m_pWidget, Msg.GetBuffer(), MB_OK );
m_bWarn = false;
}
@ -3186,14 +3184,14 @@ void CGameInstall::OnGameSelectChanged( GtkWidget *widget, gpointer data ) {
Sys_Printf( "OnGameSelectChanged\n" );
CGameInstall* i = static_cast<CGameInstall*>( data );
i->UpdateData( TRUE );
i->UpdateData( TRUE );
i->m_strName = gtk_combo_box_get_active_text( GTK_COMBO_BOX( widget ) );
i->UpdateData( FALSE );
}
void CGameInstall::BuildDialog() {
GtkWidget *dlg, *vbox1, *button, *text, *combo, *entry, *hbox;
dlg = m_pWidget;
gtk_window_set_title( GTK_WINDOW( dlg ), "Configure games" );
@ -3244,7 +3242,7 @@ void CGameInstall::BuildDialog() {
text = gtk_label_new( "Name:" );
gtk_widget_show( text );
gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 );
entry = gtk_entry_new();
gtk_widget_show( entry );
gtk_box_pack_start( GTK_BOX( vbox1 ), entry, FALSE, FALSE, 0 );
@ -3257,7 +3255,7 @@ void CGameInstall::BuildDialog() {
hbox = gtk_hbox_new( FALSE, 0 );
gtk_widget_show( hbox );
gtk_box_pack_start( GTK_BOX( vbox1 ), hbox, FALSE, FALSE, 0 );
entry = gtk_entry_new();
gtk_widget_show( entry );
gtk_box_pack_start( GTK_BOX( hbox ), entry, FALSE, FALSE, 0 );
@ -3408,7 +3406,7 @@ void CGameInstall::Run() {
/*
===============
CGameInstall::ScanGames
scan for active games that can be installed, based on the presence
scan for active games that can be installed, based on the presence
===============
*/
void CGameInstall::ScanGames() {

View File

@ -50,7 +50,7 @@ public:
PrefTypes_t mType;
void *mVal;
CPrefAssignment(char *name, PrefTypes_t Type, void *Val)
CPrefAssignment(const char *name, PrefTypes_t Type, void *Val)
{
mName = name; mType = Type; mVal = Val;
}
@ -86,7 +86,7 @@ private:
/*!
store assignment in the property list if not already there
*/
void PushAssignment(char *name, PrefTypes_t type, void *pV);
void PushAssignment(const char *name, PrefTypes_t type, void *pV);
/*!
find the xmlnode relating to the epair name
@ -95,7 +95,7 @@ private:
public:
CXMLPropertyBag();
virtual ~CXMLPropertyBag()
virtual ~CXMLPropertyBag()
{
if (InUse())
Clear();
@ -110,12 +110,12 @@ public:
(name, type and pointer to value)
this is used in UpdatePrefTree
*/
void GetPref(char *name, Str *pV, char *V);
void GetPref(char *name, int *pV, int V);
void GetPref(char *name, bool *pV, bool V);
void GetPref(char *name, float *pV, float V);
void GetPref(char *name, float *pV, float* V);
void GetPref(char *name, window_position_t* pV, window_position_t V);
void GetPref(const char *name, Str *pV, const char *V);
void GetPref(const char *name, int *pV, int V);
void GetPref(const char *name, bool *pV, bool V);
void GetPref(const char *name, float *pV, float V);
void GetPref(const char *name, float *pV, float* V);
void GetPref(const char *name, window_position_t* pV, window_position_t V);
/*!
returns whether or not the property bag is already open
@ -268,13 +268,13 @@ class CGameDialog : public Dialog
CGameInstall mGameInstall;
protected:
int m_nComboSelect; ///< intermediate int value for combo in dialog box
public:
/*!
those settings are saved in the global prefs file
/*!
those settings are saved in the global prefs file
I'm too lazy to wrap behind protected access, not sure this needs to be public
NOTE: those are preference settings. if you change them it is likely that you would
have to restart the editor for them to take effect
@ -316,10 +316,10 @@ public:
m_bDoGameInstall = true; // go through DoModal at least once
mGameCombo = NULL;
}
virtual ~CGameDialog();
virtual ~CGameDialog();
void AddPacksURL( Str &s );
/*!
intialize the game dialog, called at CPrefsDlg::Init
will scan for games, load prefs, and do game selection dialog if needed
@ -332,7 +332,7 @@ public:
void Reset();
/*!
run the dialog UI for the list of games
run the dialog UI for the list of games
*/
void DoGameDialog();
@ -371,7 +371,7 @@ public:
/*!
read or set netrun (check file)
\param retrieve
\param retrieve
if false, will check if netrun file is present and will set m_bNetRun
if true, will create/erase the netrun file depending on m_bNetRun
NOTE: this is not backwards, 'retrieve' means 'retrieve from settings dialog' - in terms of UI
@ -409,7 +409,7 @@ private:
typedef struct {
int nEntitySplit1;
int nEntitySplit2;
window_position_t position;
window_position_t posEntityWnd;
@ -434,7 +434,7 @@ typedef struct {
class PrefsDlg : public Dialog
{
public:
/*!
local prefs file
@ -444,10 +444,10 @@ public:
// will enable/disable stuff according to the situation
void DoSensitivity();
void PreModal() { DoSensitivity(); }
// enable/disable custom editor entry
void DoEditorSensitivity();
/*!
this holds global level preferences
*/
@ -456,7 +456,7 @@ protected:
// warning about old project files
bool m_bWarn;
list<CGameDescription *> mGames;
public:
// last light intensity used in the CLightPrompt dialog, stored in registry
int m_iLastLightIntensity;
@ -468,15 +468,15 @@ public:
/*! Preference notebook page numbers */
enum {PTAB_FRONT = 0, PTAB_GAME_SETTINGS, PTAB_2D, PTAB_CAMERA, PTAB_TEXTURE, PTAB_LAYOUT, PTAB_MOUSE,
PTAB_EDITING, PTAB_STARTUP, PTAB_PATHS, PTAB_MISC, PTAB_BSPMONITOR} pref_tabs;
GtkWidget *notebook;
void UpdateTextureCompression();
#ifdef ATIHACK_812
void UpdateATIHack();
#endif
void LoadPrefs();
void SavePrefs();
void LoadTexdefPref(texdef_t* pTexdef, char* pName);
@ -533,7 +533,7 @@ public:
// path to the project loaded at startup
// if g_PrefsDlg can't find the information in the ini file
// it will try to guess and eventually ask the user
Str m_strLastProject;
Str m_strLastProject;
/*!
version of last loaded project file
says -1 if there's no version loaded
@ -624,7 +624,7 @@ public:
bool m_bRunQuake;
// store prefs setting for automatic sleep mode activation
bool m_bDoSleep;
bool m_bClipCaulk;
// make the texture increments match the grid changes
@ -673,7 +673,7 @@ public:
int m_nTextureCompressionFormat;
int m_nLightRadiuses;
bool m_bQ3Map2Texturing;
#ifdef ATIHACK_812

View File

@ -27,7 +27,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "stdafx.h"
#include <gtk/gtk.h>
#include <sys/stat.h>
#include <glib/gi18n.h>
#include <sys/stat.h>
#include "gtkmisc.h"
#if defined (__linux__) || defined (__APPLE__)
#include <unistd.h>
@ -103,7 +104,7 @@ void WINAPI QE_CheckOpenGLForErrors(void)
if (i != GL_NO_ERROR)
{
if (i == GL_OUT_OF_MEMORY)
{
{
sprintf(strMsg, "OpenGL out of memory error %s\nDo you wish to save before exiting?", qgluErrorString((GLenum)i));
if (gtk_MessageBox(g_pParentWnd->m_pWidget, strMsg, "Radiant Error", MB_YESNO) == IDYES)
{
@ -441,7 +442,7 @@ xmlDocPtr ParseXMLFile(const char* filename, bool validate = false)
FileStream stream;
if (stream.Open(filename, "r"))
return ParseXMLStream(&stream, validate);
Sys_FPrintf(SYS_ERR, "Failed to open file: %s\n",filename);
return NULL;
}
@ -493,7 +494,7 @@ void ReplaceTemplates(char* w, const char* r)
r++;
p = "$";
}
while(*p!='\0') *w++ = *p++;
}
else *w++ = *r++;
@ -548,7 +549,7 @@ bool QE_LoadProject (const char *projectfile)
}
xmlFreeDoc(doc);
// project file version checking
// add a version checking to avoid people loading later versions of the project file and bitching
int ver = IntForKey( g_qeglobals.d_project_entity, "version" );
@ -563,7 +564,7 @@ bool QE_LoadProject (const char *projectfile)
g_PrefsDlg.SavePrefs();
return false;
}
// set here some default project settings you need
if ( strlen( ValueForKey( g_qeglobals.d_project_entity, "brush_primit" ) ) == 0 )
{
@ -581,7 +582,7 @@ bool QE_LoadProject (const char *projectfile)
// don't forget to create the dirs
Q_mkdir(g_qeglobals.m_strHomeGame.GetBuffer(), 0775);
Q_mkdir(g_qeglobals.m_strHomeMaps.GetBuffer(), 0775);
// usefull for the log file and debuggin fucked up configurations from users:
// output the basic information of the .qe4 project file
// SPoG
@ -596,22 +597,22 @@ bool QE_LoadProject (const char *projectfile)
if (ValueForKey(g_qeglobals.d_project_entity, "user_project")[0] == '\0')
{
Sys_Printf("Loaded a template project file\n");
// create the user_project key
SetKeyValue( g_qeglobals.d_project_entity, "user_project", "1" );
// http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=672
if (IntForKey( g_qeglobals.d_project_entity, "version" ) != PROJECT_VERSION)
{
char strMsg[2048];
sprintf(strMsg,
sprintf(strMsg,
"The template project '%s' has version %d. The editor binary is configured for version %d.\n"
"This indicates a problem in your setup. See http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=672\n"
"I will keep going with this project till you fix this",
projectfile, IntForKey( g_qeglobals.d_project_entity, "version" ), PROJECT_VERSION);
gtk_MessageBox (g_pParentWnd->m_pWidget, strMsg, "Can't load project file", MB_ICONERROR | MB_OK);
}
// create the writable project file path
strcpy(buf, g_qeglobals.m_strHomeGame.GetBuffer());
strcat(buf, g_pGameDescription->mBaseGame.GetBuffer());
@ -620,7 +621,7 @@ bool QE_LoadProject (const char *projectfile)
int counter = 0;
char pUser[PATH_MAX];
while (1)
{
{
sprintf( pUser, "%suser%d." PROJECT_FILETYPE, buf, counter );
counter++;
if (access( pUser, R_OK) != 0)
@ -632,7 +633,7 @@ bool QE_LoadProject (const char *projectfile)
}
// saving project will cause a save prefs
g_PrefsDlg.m_strLastProject = buf;
g_PrefsDlg.m_nLastProjectVer = IntForKey( g_qeglobals.d_project_entity, "version" );
g_PrefsDlg.m_nLastProjectVer = IntForKey( g_qeglobals.d_project_entity, "version" );
QE_SaveProject(buf);
}
else
@ -736,7 +737,7 @@ void ConnectEntities (void)
Sys_Beep ();
return;
}
target = ValueForKey (e1, "target");
if (target && target[0])
newtarg = g_strdup(target);
@ -755,7 +756,7 @@ void ConnectEntities (void)
SetKeyValue(e2, "targetname", newtarg);
g_free(newtarg);
}
Sys_UpdateWindows (W_XY | W_CAMERA);
Select_Deselect();
@ -804,7 +805,7 @@ void QE_InitVFS (void)
// plugins, scripts and config files.
// it also helps when testing maps, as you'll know your files won't/can't be used
// by the game engine itself.
// <gametools>
directory = g_pGameDescription->mGameToolsPath;
vfsInitDirectory(directory.GetBuffer());
@ -904,13 +905,13 @@ void QE_CountBrushesAndUpdateStatusBar( void )
{
static int s_lastbrushcount, s_lastentitycount;
static qboolean s_didonce;
//entity_t *e;
brush_t *b, *next;
g_numbrushes = 0;
g_numentities = 0;
if ( active_brushes.next != NULL )
{
for ( b = active_brushes.next ; b != NULL && b != &active_brushes ; b=next)
@ -955,9 +956,9 @@ I_FloatTime
double I_FloatTime (void)
{
time_t t;
time (&t);
return t;
#if 0
// more precise, less portable
@ -966,13 +967,13 @@ double I_FloatTime (void)
static int secbase;
gettimeofday(&tp, &tzp);
if (!secbase)
{
secbase = tp.tv_sec;
return tp.tv_usec/1000000.0;
}
return (tp.tv_sec - secbase) + tp.tv_usec/1000000.0;
#endif
}
@ -992,10 +993,10 @@ char *COM_Parse (char *data)
len = 0;
com_token[0] = 0;
if (!data)
return NULL;
// skip whitespace
skipwhite:
while ( (c = *data) <= ' ')
@ -1007,7 +1008,7 @@ skipwhite:
}
data++;
}
// skip // comments
if (c=='/' && data[1] == '/')
{
@ -1015,7 +1016,7 @@ skipwhite:
data++;
goto skipwhite;
}
// handle quoted strings specially
if (c == '\"')
@ -1053,7 +1054,7 @@ skipwhite:
if (c=='{' || c=='}'|| c==')'|| c=='(' || c=='\'' || c==':')
break;
} while (c>32);
com_token[len] = 0;
return data;
}
@ -1103,7 +1104,7 @@ void ParseCommandLine (char *lpCmdLine)
*lpCmdLine = 0;
lpCmdLine++;
}
}
}
}
@ -1118,7 +1119,7 @@ Checks for the given parameter in the program's command line arguments
Returns the argument number (1 to argc-1) or 0 if not present
=================
*/
int CheckParm (char *check)
int CheckParm (const char *check)
{
int i;
@ -1139,7 +1140,7 @@ int CheckParm (char *check)
ParseNum / ParseHex
==============
*/
int ParseHex (char *hex)
int ParseHex (const char *hex)
{
char *str;
int num;
@ -1165,7 +1166,7 @@ int ParseHex (char *hex)
}
int ParseNum (char *str)
int ParseNum (const char *str)
{
if (str[0] == '$')
return ParseHex (str+1);
@ -1292,7 +1293,7 @@ void Sys_Beep (void)
#if defined (__linux__) || defined (__APPLE__)
gdk_beep ();
#else
MessageBeep (MB_ICONASTERISK);
MessageBeep (MB_ICONASTERISK);
#endif
}
@ -1462,7 +1463,7 @@ FILE DIALOGS
======================================================================
*/
qboolean ConfirmModified ()
{
if (!modified)
@ -1478,10 +1479,10 @@ void ProjectDialog ()
const char *filename;
char buffer[NAME_MAX];
/*
* Obtain the system directory name and
* store it in buffer.
*/
/*
* Obtain the system directory name and
* store it in buffer.
*/
strcpy(buffer, g_qeglobals.m_strHomeGame.GetBuffer());
strcat(buffer, g_pGameDescription->mBaseGame.GetBuffer());
@ -1498,7 +1499,7 @@ void ProjectDialog ()
if (!QE_LoadProject(filename))
Sys_Printf ("Failed to load project from file: %s\n", filename);
else
// FIXME TTimo QE_Init is probably broken if you don't call it during startup right now ..
// FIXME TTimo QE_Init is probably broken if you don't call it during startup right now ..
QE_Init();
}
@ -1574,7 +1575,7 @@ void FillBSPMenu ()
{
if (strncmp(ep->key, "bsp_", 4)==0)
{
bsp_commands[i] = ep->key;
bsp_commands[i] = ep->key;
item = gtk_menu_item_new_with_label (ep->key+4);
gtk_widget_show (item);
gtk_container_add (GTK_CONTAINER (menu), item);
@ -1653,7 +1654,7 @@ void Sys_LogFile (void)
// the file handle is g_qeglobals.hLogFile
// the log file is erased
Str name;
name = g_strTempPath;
name = g_strTempPath;
name += "radiant.log";
#if defined (__linux__) || defined (__APPLE__)
g_qeglobals.hLogFile = open( name.GetBuffer(), O_TRUNC | O_CREAT | O_WRONLY, S_IREAD | S_IWRITE );
@ -1701,7 +1702,7 @@ void Sys_ClearPrintf (void)
extern "C" void Sys_FPrintf_VA( int level, const char *text, va_list args ) {
char buf[BUFFER_SIZE];
buf[0] = 0;
vsnprintf( buf, BUFFER_SIZE, text, args );
buf[BUFFER_SIZE-1] = 0;
@ -1721,7 +1722,7 @@ extern "C" void Sys_FPrintf_VA( int level, const char *text, va_list args ) {
// TTimo: FIXME: killed the console to avoid GDI leak fuckup
if ( g_qeglobals_gui.d_edit != NULL ) {
GtkTextBuffer* buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(g_qeglobals_gui.d_edit));
GtkTextIter iter;
gtk_text_buffer_get_end_iter(buffer, &iter);
@ -1764,7 +1765,7 @@ extern "C" void Sys_FPrintf_VA( int level, const char *text, va_list args ) {
gtk_grab_remove(g_qeglobals_gui.d_edit);
}
}
}
}
}
// NOTE: this is the handler sent to synapse

View File

@ -43,6 +43,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "qgl.h"
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <math.h>
#include <stdlib.h>
@ -141,11 +142,11 @@ vec_t Rad_rint (vec_t in);
double I_FloatTime (void);
void Error (char *error, ...);
int CheckParm (char *check);
void Error (const char *error, ...);
int CheckParm (const char *check);
void ParseCommandLine (char *lpCmdLine);
int ParseNum (char *str);
int ParseNum (const char *str);
char* COM_Parse (char *data);
char* Get_COM_Token();
@ -273,7 +274,7 @@ bool read_var (const char *filename, const char *section, const char *key, char
// entityw.c
//
void FillClassList (void);
bool UpdateEntitySel(eclass_t *pec);
bool UpdateEntitySel(eclass_t *pec);
void SetInspectorMode(int iType);
void SetSpawnFlags(void);
void GetSpawnFlags(void);
@ -367,7 +368,7 @@ qboolean IsBrushSelected(brush_t* bSel);
// curve brushes
void Curve_MakeCurvedBrush (qboolean negative, qboolean top, qboolean bottom,
void Curve_MakeCurvedBrush (qboolean negative, qboolean top, qboolean bottom,
qboolean s1, qboolean s2, qboolean s3, qboolean s4);
void Curve_Invert (void);
@ -387,7 +388,7 @@ patchMesh_t* MakeNewPatch();
brush_t* AddBrushForPatch(patchMesh_t *pm, bool bLinkToWorld = true);
brush_t* Patch_GenericMesh(int nWidth, int nHeight, int nOrientation = 2, bool bDeleteSource = true, bool bOverride = false);
//void Patch_ReadFile (char *name);
//void Patch_WriteFile (char *name);
//void Patch_WriteFile (char *name);
void Patch_BuildPoints (brush_t *b);
void Patch_Move(patchMesh_t *p, const vec3_t vMove, bool bRebuild = false);
//++timo had to add a default value for bSnap (see Patch_ApplyMatrix call from Select_ApplyMatrix in select.cpp)
@ -571,7 +572,7 @@ qboolean IsBrushPrimitMode();
//
// eclass.cpp
//
#include "ieclass.h"
#include "ieclass.h"
/*!
\todo those are at the eclass manager level, but some documentation about what they do will be helpful
@ -589,7 +590,7 @@ eclass_t** Get_EClass_E();
void Set_Eclass_Found(qboolean);
qboolean Get_Parsing_Single();
// .def loading, builtin module
// .def loading, builtin module
#include "eclass_def.h"
extern CSynapseBuiltinClientDef eclass_def;
@ -605,7 +606,7 @@ support for one additional/optional entity format
extern bool g_bHaveEClassExt;
extern _EClassTable g_EClassExtTable;
#include "iplugin.h"
// for interfaces, we require main plugin header included
#include "qerplugin.h"

View File

@ -33,14 +33,15 @@ Clean up texture menu.
*/
#ifdef _WIN32
//#include <gdk/win32/gdkwin32.h>
#include <gdk/gdkwin32.h>
//#include <gdk/win32/gdkwin32.h>
#include <gdk/gdkwin32.h>
#endif
#if defined (__linux__) || defined (__APPLE__)
#include <gdk/gdkx.h>
#include <dirent.h>
#endif
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <assert.h>
#include <sys/stat.h>
#include "stdafx.h"
@ -521,10 +522,10 @@ void BuildShaderList()
{
GSList *tmp;
bool found = false;
// each token should be a shader filename
sprintf(dirstring, "%s.shader", token);
for (tmp = l_shaderfiles; tmp != NULL; tmp = tmp->next)
{
if (!strcmp (dirstring, (char*)tmp->data))
@ -534,7 +535,7 @@ void BuildShaderList()
break;
}
}
if (!found)
{
l_shaderfiles = g_slist_append (l_shaderfiles, strdup (dirstring));
@ -570,9 +571,6 @@ void FillTextureMenu (GSList** pArray)
GSList *texdirs_tmp = NULL;
GSList *p;
char dirRoot[NAME_MAX];
// this is an index used to count the number of texture items (for splitting/avoiding to get out of window)
// we start with a != 0 value to compensate for the initial number of items in the texture menu
int nMenuCount = 12;
// delete everything
menu = GTK_WIDGET (g_object_get_data (G_OBJECT (g_qeglobals_gui.d_main_window), "menu_textures"));
@ -763,11 +761,11 @@ void Texture_ShowDirectory ()
// if a texture is already in use to represent a shader, ignore it
// need this function "GSList *lst SynapseServer::GetMinorList(char *major_name);"
sprintf (dirstring, "textures/%s", texture_directory);
g_ImageManager.BeginExtensionsScan();
const char* ext;
while(ext=g_ImageManager.GetNextExtension())
while((ext=g_ImageManager.GetNextExtension()) != NULL)
{
files = g_slist_concat(files, vfsGetFileList (dirstring, ext));
}
@ -863,9 +861,9 @@ void Texture_ResetPosition()
q = current_texture;
// if the current texture never found (because // 'show shaders' is off,
// for example), do nothing
if (!q)
if (!q)
break;
int nHeight = (int)(q->height * ((float)g_PrefsDlg.m_nTextureScale / 100));
// we have found when texdef->name and the shader name match
// NOTE: as everywhere else for our comparisons, we are not case sensitive
@ -877,7 +875,7 @@ void Texture_ResetPosition()
break;
}
// if the bottom of our selected texture will fit with origin 0, use that
// to prevent scrolling uglyness (stuff scrolled off screen when
// to prevent scrolling uglyness (stuff scrolled off screen when
// everything would fit)
if ( -(y -nHeight-2*FONT_HEIGHT) < g_qeglobals.d_texturewin.height) {
g_qeglobals.d_texturewin.originy = 0;
@ -1372,7 +1370,7 @@ void SelectTexture (int mx, int my, bool bShift, bool bFitScale)
return;
}
}
Sys_Status("Did not select a texture", 0);
}

View File

@ -239,7 +239,7 @@ void Undo_GeneralStart(char *operation)
}
undo = (undo_t *) malloc(sizeof(undo_t));
if (!undo)
if (!undo)
return;
memset(undo, 0, sizeof(undo_t));
undo->brushlist.next = &undo->brushlist;
@ -253,7 +253,7 @@ void Undo_GeneralStart(char *operation)
undo->prev = g_lastundo;
undo->next = NULL;
g_lastundo = undo;
undo->time = Sys_DoubleTime();
//
if (g_undoId > g_undoMaxSize * 2) g_undoId = 1;
@ -335,7 +335,7 @@ int Undo_EntityInUndo(undo_t *undo, entity_t *ent)
Undo_Start
=============
*/
void Undo_Start(char *operation)
void Undo_Start(const char *operation)
{
// spog - disable undo if undo levels = 0
if (g_PrefsDlg.m_nUndoLevels == 0)
@ -345,7 +345,7 @@ void Undo_Start(char *operation)
#endif
return;
}
Undo_ClearRedo();
Undo_GeneralStart(operation);
}
@ -365,7 +365,7 @@ void Undo_AddBrush(brush_t *pBrush)
#endif
return;
}
if (!g_lastundo)
{
Sys_Printf("Undo_AddBrushList: no last undo.\n");
@ -409,7 +409,7 @@ void Undo_AddBrushList(brush_t *brushlist)
#endif
return;
}
brush_t *pBrush;
if (!g_lastundo)
@ -461,7 +461,7 @@ void Undo_EndBrush(brush_t *pBrush)
#endif
return;
}
if (!g_lastundo)
{
@ -491,7 +491,7 @@ void Undo_EndBrushList(brush_t *brushlist)
#endif
return;
}
if (!g_lastundo)
{
@ -524,7 +524,7 @@ void Undo_AddEntity(entity_t *entity)
#endif
return;
}
entity_t* pClone;
@ -604,7 +604,7 @@ void Undo_End(void)
#endif
return;
}
if (!g_lastundo)
{
@ -642,7 +642,7 @@ void Undo_Undo(boolean bSilent)
Sys_Printf("Undo_Undo: undo is disabled.\n");
return;
}
undo_t *undo, *redo;
brush_t *pBrush, *pNextBrush;
entity_t *pEntity, *pNextEntity, *pUndoEntity;
@ -802,7 +802,7 @@ void Undo_Undo(boolean bSilent)
g_undoId--;
if (g_undoId <= 0) g_undoId = 2 * g_undoMaxSize;
//
g_bScreenUpdates = true;
g_bScreenUpdates = true;
UpdateSurfaceDialog();
Sys_UpdateWindows(W_ALL);
}
@ -934,7 +934,7 @@ void Undo_Redo(void)
// free the undo
free(redo);
//
g_bScreenUpdates = true;
g_bScreenUpdates = true;
UpdateSurfaceDialog();
Sys_UpdateWindows(W_ALL);
}

View File

@ -23,10 +23,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
// QERadiant Multilevel Undo/Redo
//
//
//
//start operation
void Undo_Start(char *operation);
void Undo_Start(const char *operation);
//end operation
void Undo_End(void);
//add brush to the undo

View File

@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "stdafx.h"
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <assert.h>
#include <GL/gl.h>
@ -140,7 +141,7 @@ void WXY_Print ()
img = (unsigned char*)malloc (width*height*3);
qglReadPixels (0,0,width,height,GL_RGB,GL_UNSIGNED_BYTE,img);
FILE *fp;
FILE *fp;
fp = fopen(filename, "wb");
if (fp)
{
@ -179,7 +180,7 @@ void WXY_Print ()
unsigned long widthDW = (((width*24) + 31) / 32 * 4);
long row, row_size = width*3;
for (row = 0; row < height; row++)
for (row = 0; row < height; row++)
{
unsigned char* buf = img+row*row_size;
@ -191,7 +192,7 @@ void WXY_Print ()
putc(buf[col+1], fp);
putc(buf[col], fp);
}
byteswritten += row_size;
byteswritten += row_size;
unsigned long count;
for (count = row_size; count < widthDW; count++)
@ -223,7 +224,7 @@ float Betwixt(float f1, float f2)
void CleanList(brush_t* pList)
{
brush_t* pBrush = pList->next;
brush_t* pBrush = pList->next;
while (pBrush != NULL && pBrush != pList)
{
brush_t* pNext = pBrush->next;
@ -234,7 +235,7 @@ void CleanList(brush_t* pList)
void Brush_CopyList (brush_t* pFrom, brush_t* pTo)
{
brush_t* pBrush = pFrom->next;
brush_t* pBrush = pFrom->next;
while (pBrush != NULL && pBrush != pFrom)
{
brush_t* pNext = pBrush->next;
@ -288,7 +289,7 @@ void DrawPathLines (void)
{
return;
}
num_entities = 0;
for (te = entities.next ; te != &entities && num_entities != MAX_MAP_ENTITIES ; te = te->next)
{
@ -299,53 +300,53 @@ void DrawPathLines (void)
num_entities++;
}
}
for (se = entities.next ; se != &entities ; se = se->next)
{
psz = ValueForKey(se, "targetname");
if (psz == NULL || psz[0] == '\0')
continue;
sb = se->brushes.onext;
if (sb == &se->brushes)
continue;
for (k=0 ; k<num_entities ; k++)
{
if (strcmp (ent_target[k], psz))
continue;
te = ent_entity[k];
tb = te->brushes.onext;
if (tb == &te->brushes)
continue;
for (i=0 ; i<3 ; i++)
mid[i] = (sb->mins[i] + sb->maxs[i])*0.5;
mid[i] = (sb->mins[i] + sb->maxs[i])*0.5;
for (i=0 ; i<3 ; i++)
mid1[i] = (tb->mins[i] + tb->maxs[i])*0.5;
mid1[i] = (tb->mins[i] + tb->maxs[i])*0.5;
VectorSubtract (mid1, mid, dir);
len = VectorNormalize (dir, dir);
s1[0] = -dir[1]*8 + dir[0]*8;
s2[0] = dir[1]*8 + dir[0]*8;
s1[1] = dir[0]*8 + dir[1]*8;
s2[1] = -dir[0]*8 + dir[1]*8;
qglColor3f (se->eclass->color[0], se->eclass->color[1], se->eclass->color[2]);
qglBegin(GL_LINES);
qglVertex3fv(mid);
qglVertex3fv(mid1);
arrows = (int)(len / 256) + 1;
for (i=0 ; i<arrows ; i++)
{
f = len * (i + 0.5) / arrows;
for (j=0 ; j<3 ; j++)
mid1[j] = mid[j] + f*dir[j];
qglVertex3fv (mid1);
@ -353,7 +354,7 @@ void DrawPathLines (void)
qglVertex3fv (mid1);
qglVertex3f (mid1[0] + s2[0], mid1[1] + s2[1], mid1[2]);
}
qglEnd();
}
}
@ -765,7 +766,7 @@ void XYWnd::SetOrigin(vec3_t org)
m_vOrigin[2] = org[2];
}
void XYWnd::OnSize(int cx, int cy)
void XYWnd::OnSize(int cx, int cy)
{
m_nWidth = cx;
m_nHeight = cy;
@ -784,7 +785,7 @@ void XYWnd::Clip()
pList = (!g_bSwitch) ? &g_brFrontSplits : &g_brBackSplits;
else
pList = (g_bSwitch) ? &g_brFrontSplits : &g_brBackSplits;
if (pList->next != pList)
{
Brush_CopyList(pList, &hold_brushes);
@ -893,7 +894,7 @@ void XYWnd::SetClipMode(bool bMode)
CleanList(&g_brBackSplits);
g_brFrontSplits.next = &g_brFrontSplits;
g_brBackSplits.next = &g_brBackSplits;
// ydnar: set clipper points based on first selected patch mesh
if( selected_brushes.next != &selected_brushes )
{
@ -912,7 +913,7 @@ void XYWnd::SetClipMode(bool bMode)
break;
}
}
if( found )
{
// SetClipMode( true );
@ -962,9 +963,9 @@ void XYWnd::SetPointMode(bool b)
g_nPointCount = 0;
}
void XYWnd::SetViewType(int n)
{
m_nViewType = n;
void XYWnd::SetViewType(int n)
{
m_nViewType = n;
if (g_pParentWnd->CurrentStyle() == MainFrame::eFloating)
{
char* str = "YZ Side";
@ -1003,7 +1004,7 @@ bool XYWnd::SetRotateMode(bool bMode)
Select_GetTrueMid(g_vRotateOrigin);
g_vRotation[0] = g_vRotation[1] = g_vRotation[2] = 0.0;
}
else
else
{
if (bMode)
Sys_Printf("Need a brush selected to turn on Mouse Rotation mode\n");
@ -1045,7 +1046,7 @@ void update_xor_rectangle_xy(XORRectangle& xor_rectangle)
xor_rectangle.set(rectangle);
}
void XYWnd::OnMouseMove(guint32 nFlags, int pointx, int pointy)
void XYWnd::OnMouseMove(guint32 nFlags, int pointx, int pointy)
{
// plugin entities
// TODO TTimo handle return code
@ -1108,9 +1109,9 @@ void XYWnd::OnMouseMove(guint32 nFlags, int pointx, int pointy)
g_strStatus.Format("x:: %.1f y:: %.1f z:: %.1f", tdp[0], tdp[1], tdp[2]);
g_pParentWnd->SetStatusText(1, g_strStatus);
// i need to generalize the point code.. having 3 flavors pretty much sucks..
// once the new curve stuff looks like it is going to stick i will
// rationalize this down to a single interface..
// i need to generalize the point code.. having 3 flavors pretty much sucks..
// once the new curve stuff looks like it is going to stick i will
// rationalize this down to a single interface..
if (PointMode())
{
if (g_pMovingPoint && HasCapture ())
@ -1209,7 +1210,7 @@ void XYWnd::OnMouseMove(guint32 nFlags, int pointx, int pointy)
XY_MouseMoved (pointx, m_nHeight - 1 - pointy , nFlags);
}
}
else
else
{
XY_MouseMoved (pointx, m_nHeight - 1 - pointy , nFlags);
}
@ -1244,7 +1245,7 @@ void XYWnd::OnMouseWheel(bool bUp)
g_pParentWnd->OnTimer ();
}
void XYWnd::OnTimer ()
void XYWnd::OnTimer ()
{
int nDim1 = (m_nViewType == YZ) ? 1 : 0;
int nDim2 = (m_nViewType == XY) ? 1 : 2;
@ -1258,7 +1259,7 @@ void XYWnd::OnTimer ()
XY_MouseMoved (m_ptDragX, m_nHeight - 1 - m_ptDragY , m_nScrollFlags);
}
void XYWnd::OnLButtonDown(guint32 flags, int pointx, int pointy)
void XYWnd::OnLButtonDown(guint32 flags, int pointx, int pointy)
{
g_pParentWnd->SetActiveXY(this);
UndoCopy();
@ -1283,14 +1284,14 @@ void XYWnd::OnMButtonDown(guint32 flags, int pointx, int pointy)
OriginalButtonDown(flags, pointx, pointy);
}
void XYWnd::OnRButtonDown(guint32 flags, int pointx, int pointy)
void XYWnd::OnRButtonDown(guint32 flags, int pointx, int pointy)
{
g_pParentWnd->SetActiveXY(this);
m_ptDownX = pointx;
m_ptDownY = pointy;
m_bRButtonDown = true;
if (g_PrefsDlg.m_nMouseButtons == 3) // 3 button mouse
if (g_PrefsDlg.m_nMouseButtons == 3) // 3 button mouse
{
if (flags & MK_CONTROL)
{
@ -1360,7 +1361,7 @@ void XYWnd::XY_MouseDown (int x, int y, int buttons)
VectorClear(point);
XY_ToPoint (x, y, point);
VectorCopy (point, origin);
VectorClear (dir);
@ -1368,20 +1369,20 @@ void XYWnd::XY_MouseDown (int x, int y, int buttons)
{
origin[2] = g_MaxWorldCoord;
dir[2] = -1;
right[0] = 1 / m_fScale;
right[1] = 0;
right[0] = 1 / m_fScale;
right[1] = 0;
right[2] = 0;
up[0] = 0;
up[0] = 0;
up[1] = 1 / m_fScale;
up[2] = 0;
}
else if (m_nViewType == XZ)
else if (m_nViewType == XZ)
{
origin[1] = g_MinWorldCoord; // view facing dir = positive Y
dir[1] = 1;
right[0] = 1 / m_fScale;
right[1] = 0;
right[2] = 0;
right[2] = 0;
up[0] = 0;
up[1] = 0;
up[2] = 1 / m_fScale;
@ -1391,8 +1392,8 @@ void XYWnd::XY_MouseDown (int x, int y, int buttons)
origin[0] = g_MaxWorldCoord;
dir[0] = -1;
right[0] = 0;
right[1] = 1 / m_fScale;
right[2] = 0;
right[1] = 1 / m_fScale;
right[2] = 0;
up[0] = 0;
up[1] = 0;
up[2] = 1 / m_fScale;
@ -1408,7 +1409,7 @@ void XYWnd::XY_MouseDown (int x, int y, int buttons)
|| (buttons == (MK_LBUTTON | MK_SHIFT))
|| (buttons == (MK_LBUTTON | MK_CONTROL))
|| (buttons == (MK_LBUTTON | MK_CONTROL | MK_SHIFT)) )
{
{
Patch_SetView( (m_nViewType == XY) ? W_XY : (m_nViewType == YZ) ? W_YZ : W_XZ);
Drag_Begin (x, y, buttons, right, up, origin, dir);
return;
@ -1418,7 +1419,7 @@ void XYWnd::XY_MouseDown (int x, int y, int buttons)
// control mbutton = move camera
if (m_nButtonstate == (MK_CONTROL|nMouseButton) )
{
{
VectorCopyXY(point, g_pParentWnd->GetCamWnd()->Camera()->origin);
Sys_UpdateWindows (W_CAMERA|W_XY_OVERLAY);
}
@ -1426,7 +1427,7 @@ void XYWnd::XY_MouseDown (int x, int y, int buttons)
// mbutton = angle camera
if ((g_PrefsDlg.m_nMouseButtons == 3 && m_nButtonstate == MK_MBUTTON) ||
(g_PrefsDlg.m_nMouseButtons == 2 && m_nButtonstate == (MK_SHIFT|MK_CONTROL|MK_RBUTTON)))
{
{
VectorSubtract (point, g_pParentWnd->GetCamWnd()->Camera()->origin, point);
int n1 = (m_nViewType == XY) ? 1 : 2;
@ -1554,7 +1555,7 @@ void XYWnd::HandleDrop()
*/
create_menu_item_with_mnemonic (menu, "Ungroup Entity",
GTK_SIGNAL_FUNC (HandleCommand), ID_SELECTION_UNGROUPENTITY);
create_menu_item_with_mnemonic (menu, "Move into entity",
GTK_SIGNAL_FUNC (HandleCommand), ID_SELECTION_MERGE);
create_menu_item_with_mnemonic (menu, "Move into worldspawn",
@ -1611,7 +1612,7 @@ void XYWnd::HandleDrop()
submenu_root = NULL;
}
strActive = strLeft;
submenu = gtk_menu_new ();
submenu_root = submenu;
item = gtk_menu_item_new_with_label (strName);
@ -1636,7 +1637,7 @@ void XYWnd::HandleDrop()
submenu_root = NULL;
}
strActive = "";
item = gtk_menu_item_new_with_label (strName);
gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC (HandleCommand),
GINT_TO_POINTER (nID++));
@ -1667,7 +1668,7 @@ void XYWnd::NewBrushDrag (int x, int y)
// delete the current selection
if (selected_brushes.next != &selected_brushes)
Brush_Free (selected_brushes.next);
SnapToPoint (m_nPressx, m_nPressy, mins);
int nDim = (m_nViewType == XY) ? 2 : (m_nViewType == YZ) ? 0 : 1;
@ -1861,7 +1862,7 @@ void XYWnd::XY_MouseMoved (int x, int y, int buttons)
g_pParentWnd->OnViewZoomout ();
else
g_pParentWnd->OnViewZoomin ();
Sys_SetCursorPos (m_ptCursorX, m_ptCursorY);
}
}
@ -1900,7 +1901,7 @@ void XYWnd::DropClipPoint(guint32 nFlags, int pointx, int pointy)
g_Clip1.m_ptScreenX = pointx;
g_Clip1.m_ptScreenY = pointy;
}
else
else
if (g_Clip2.Set() == false)
{
pPt = g_Clip2;
@ -1908,7 +1909,7 @@ void XYWnd::DropClipPoint(guint32 nFlags, int pointx, int pointy)
g_Clip2.m_ptScreenX = pointx;
g_Clip2.m_ptScreenY = pointy;
}
else
else
if (g_Clip3.Set() == false)
{
pPt = g_Clip3;
@ -1916,7 +1917,7 @@ void XYWnd::DropClipPoint(guint32 nFlags, int pointx, int pointy)
g_Clip3.m_ptScreenX = pointx;
g_Clip3.m_ptScreenY = pointy;
}
else
else
{
RetainClipMode(true);
pPt = g_Clip1;
@ -2045,7 +2046,7 @@ void XYWnd::PlanePointsFromClipPoints(vec3_t planepts[3], brush_t *pBrush)
int n = (g_pParentWnd->ActiveXY()->GetViewType() == XY) ? 2 : (g_pParentWnd->ActiveXY()->GetViewType() == YZ) ? 0 : 1;
int x = (n == 0) ? 1 : 0;
int y = (n == 2) ? 1 : 2;
if (n == 1) // on viewtype XZ, flip clip points
{
planepts[0][n] = pBrush->maxs[n];
@ -2069,7 +2070,7 @@ void XYWnd::ProduceSplitLists()
{
bool bCaulk = false;
int nFlags;
if (AnyPatchesSelected())
{
Sys_Printf("Deselecting patches for clip operation.\n");
@ -2087,7 +2088,7 @@ void XYWnd::ProduceSplitLists()
// ydnar: update the window if any patches are selected
Sys_UpdateWindows( XY | W_CAMERA_IFON );
}
CleanList(&g_brFrontSplits);
CleanList(&g_brBackSplits);
g_brFrontSplits.next = &g_brFrontSplits;
@ -2099,7 +2100,7 @@ void XYWnd::ProduceSplitLists()
{
brush_t* pFront = NULL;
brush_t* pBack = NULL;
face_t face;
memset(&face,0,sizeof(face_t));
PlanePointsFromClipPoints(face.planepts, pBrush);
@ -2123,7 +2124,7 @@ void XYWnd::ProduceSplitLists()
Brush_AddToList(pBack, &g_brBackSplits);
if (pFront)
Brush_AddToList(pFront, &g_brFrontSplits);
}
}
}
@ -2358,16 +2359,16 @@ void XYWnd::XY_DrawGrid()
if (!g_qeglobals.d_savedinfo.show_axis)
{
qglRasterPos2f ( m_vOrigin[nDim1] - w + 35 / m_fScale, m_vOrigin[nDim2] + h - 20 / m_fScale );
char cView[20];
if (m_nViewType == XY)
strcpy(cView, "XY Top");
else
else
if (m_nViewType == XZ)
strcpy(cView, "XZ Front");
else
strcpy(cView, "YZ Side");
gtk_glwidget_print_string(cView);
}
}
@ -2478,7 +2479,7 @@ void XYWnd::XY_DrawBlockGrid()
qglLineWidth (2);
qglBegin (GL_LINES);
for (x=xb ; x<=xe ; x+=g_qeglobals.blockSize)
{
qglVertex2f (x, yb);
@ -2493,7 +2494,7 @@ void XYWnd::XY_DrawBlockGrid()
qglVertex2f (xe, y);
}
}
qglEnd ();
qglLineWidth (1);
@ -2602,7 +2603,7 @@ void XYWnd::DrawCameraIcon()
qglVertex3f (x-box,y,0);
qglVertex3f (x+box,y,0);
qglEnd ();
qglBegin(GL_LINE_STRIP);
qglVertex3f (x+fov*cos(a+Q_PI/4), y+fov*sin(a+Q_PI/4), 0);
qglVertex3f (x, y, 0);
@ -2650,7 +2651,7 @@ void XYWnd::DrawZIcon (void)
}
}
// can be greatly simplified but per usual i am in a hurry
// can be greatly simplified but per usual i am in a hurry
// which is not an excuse, just a fact
void XYWnd::PaintSizeInfo(int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxBounds)
{
@ -2662,7 +2663,7 @@ void XYWnd::PaintSizeInfo(int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxBo
vec3_t vSize;
VectorSubtract(vMaxBounds, vMinBounds, vSize);
qglColor3f(g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][0] * .65,
qglColor3f(g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][0] * .65,
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][1] * .65,
g_qeglobals.d_savedinfo.colors[COLOR_SELBRUSHES][2] * .65);
@ -2678,14 +2679,14 @@ void XYWnd::PaintSizeInfo(int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxBo
qglVertex3f(vMaxBounds[nDim1], vMinBounds[nDim2] - 6.0f / m_fScale, 0.0f);
qglVertex3f(vMaxBounds[nDim1], vMinBounds[nDim2] - 10.0f / m_fScale, 0.0f);
qglVertex3f(vMaxBounds[nDim1] + 6.0f / m_fScale, vMinBounds[nDim2], 0.0f);
qglVertex3f(vMaxBounds[nDim1] + 10.0f / m_fScale, vMinBounds[nDim2], 0.0f);
qglVertex3f(vMaxBounds[nDim1] + 10.0f / m_fScale, vMinBounds[nDim2], 0.0f);
qglVertex3f(vMaxBounds[nDim1] + 10.0f / m_fScale, vMaxBounds[nDim2], 0.0f);
qglVertex3f(vMaxBounds[nDim1] + 6.0f / m_fScale, vMaxBounds[nDim2], 0.0f);
qglVertex3f(vMaxBounds[nDim1] + 10.0f / m_fScale, vMaxBounds[nDim2], 0.0f);
@ -2694,7 +2695,7 @@ void XYWnd::PaintSizeInfo(int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxBo
qglRasterPos3f (Betwixt(vMinBounds[nDim1], vMaxBounds[nDim1]), vMinBounds[nDim2] - 20.0 / m_fScale, 0.0f);
g_strDim.Format(g_pDimStrings[nDim1], vSize[nDim1]);
gtk_glwidget_print_string((char *) g_strDim.GetBuffer());
qglRasterPos3f (vMaxBounds[nDim1] + 16.0 / m_fScale, Betwixt(vMinBounds[nDim2], vMaxBounds[nDim2]), 0.0f);
g_strDim.Format(g_pDimStrings[nDim2], vSize[nDim2]);
gtk_glwidget_print_string((char *) g_strDim.GetBuffer());
@ -2715,14 +2716,14 @@ void XYWnd::PaintSizeInfo(int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxBo
qglVertex3f(vMaxBounds[nDim1], 0,vMinBounds[nDim2] - 6.0f / m_fScale);
qglVertex3f(vMaxBounds[nDim1], 0,vMinBounds[nDim2] - 10.0f / m_fScale);
qglVertex3f(vMaxBounds[nDim1] + 6.0f / m_fScale, 0,vMinBounds[nDim2]);
qglVertex3f(vMaxBounds[nDim1] + 10.0f / m_fScale, 0,vMinBounds[nDim2]);
qglVertex3f(vMaxBounds[nDim1] + 10.0f / m_fScale, 0,vMinBounds[nDim2]);
qglVertex3f(vMaxBounds[nDim1] + 10.0f / m_fScale, 0,vMaxBounds[nDim2]);
qglVertex3f(vMaxBounds[nDim1] + 6.0f / m_fScale, 0,vMaxBounds[nDim2]);
qglVertex3f(vMaxBounds[nDim1] + 10.0f / m_fScale, 0,vMaxBounds[nDim2]);
@ -2731,7 +2732,7 @@ void XYWnd::PaintSizeInfo(int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxBo
qglRasterPos3f (Betwixt(vMinBounds[nDim1], vMaxBounds[nDim1]), 0, vMinBounds[nDim2] - 20.0 / m_fScale);
g_strDim.Format(g_pDimStrings[nDim1], vSize[nDim1]);
gtk_glwidget_print_string((char *) g_strDim.GetBuffer());
qglRasterPos3f (vMaxBounds[nDim1] + 16.0 / m_fScale, 0, Betwixt(vMinBounds[nDim2], vMaxBounds[nDim2]));
g_strDim.Format(g_pDimStrings[nDim2], vSize[nDim2]);
gtk_glwidget_print_string((char *) g_strDim.GetBuffer());
@ -2752,14 +2753,14 @@ void XYWnd::PaintSizeInfo(int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxBo
qglVertex3f(0, vMaxBounds[nDim1], vMinBounds[nDim2] - 6.0f / m_fScale);
qglVertex3f(0, vMaxBounds[nDim1], vMinBounds[nDim2] - 10.0f / m_fScale);
qglVertex3f(0, vMaxBounds[nDim1] + 6.0f / m_fScale, vMinBounds[nDim2]);
qglVertex3f(0, vMaxBounds[nDim1] + 10.0f / m_fScale, vMinBounds[nDim2]);
qglVertex3f(0, vMaxBounds[nDim1] + 10.0f / m_fScale, vMinBounds[nDim2]);
qglVertex3f(0, vMaxBounds[nDim1] + 10.0f / m_fScale, vMaxBounds[nDim2]);
qglVertex3f(0, vMaxBounds[nDim1] + 6.0f / m_fScale, vMaxBounds[nDim2]);
qglVertex3f(0, vMaxBounds[nDim1] + 10.0f / m_fScale, vMaxBounds[nDim2]);
@ -2768,7 +2769,7 @@ void XYWnd::PaintSizeInfo(int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxBo
qglRasterPos3f (0, Betwixt(vMinBounds[nDim1], vMaxBounds[nDim1]), vMinBounds[nDim2] - 20.0 / m_fScale);
g_strDim.Format(g_pDimStrings[nDim1], vSize[nDim1]);
gtk_glwidget_print_string((char *) g_strDim.GetBuffer());
qglRasterPos3f (0, vMaxBounds[nDim1] + 16.0 / m_fScale, Betwixt(vMinBounds[nDim2], vMaxBounds[nDim2]));
g_strDim.Format(g_pDimStrings[nDim2], vSize[nDim2]);
gtk_glwidget_print_string((char *) g_strDim.GetBuffer());
@ -2839,7 +2840,7 @@ void XYWnd::XY_Draw()
if (!active_brushes.next)
return; // not valid yet
Patch_LODMatchAll(); // spog
Patch_LODMatchAll(); // spog
if (m_bTiming)
start = Sys_DoubleTime();
@ -2924,7 +2925,7 @@ void XYWnd::XY_Draw()
drawn = culled = 0;
e = world_entity;
if (m_bTiming)
start2 = Sys_DoubleTime();
@ -2933,9 +2934,9 @@ void XYWnd::XY_Draw()
if (brush->bFiltered)
continue;
if (brush->mins[nDim1] > maxs[0] ||
brush->mins[nDim2] > maxs[1] ||
brush->maxs[nDim1] < mins[0] ||
if (brush->mins[nDim1] > maxs[0] ||
brush->mins[nDim2] > maxs[1] ||
brush->maxs[nDim1] < mins[0] ||
brush->maxs[nDim2] < mins[1])
{
culled++;
@ -2963,7 +2964,7 @@ void XYWnd::XY_Draw()
Brush_DrawXY(brush, m_nViewType);
}
if (m_bTiming)
end2 = Sys_DoubleTime();
@ -3006,9 +3007,9 @@ void XYWnd::XY_Draw()
for (brush = selected_brushes.next ; brush != &selected_brushes ; brush=brush->next)
{
// spog - added culling of selected brushes in XY window
if (brush->mins[nDim1] > maxs[0] ||
brush->mins[nDim2] > maxs[1] ||
brush->maxs[nDim1] < mins[0] ||
if (brush->mins[nDim1] > maxs[0] ||
brush->mins[nDim2] > maxs[1] ||
brush->maxs[nDim1] < mins[0] ||
brush->maxs[nDim2] < mins[1])
{
culled++;
@ -3053,7 +3054,7 @@ void XYWnd::XY_Draw()
// edge / vertex flags
if (g_qeglobals.d_select_mode == sel_vertex)
{
if(!g_PrefsDlg.m_bGlPtWorkaround)
if(!g_PrefsDlg.m_bGlPtWorkaround)
{
// brush verts
qglPointSize (4);
@ -3062,7 +3063,7 @@ void XYWnd::XY_Draw()
for (i=0 ; i<g_qeglobals.d_numpoints ; i++)
qglVertex3fv (g_qeglobals.d_points[i]);
qglEnd ();
if(g_qeglobals.d_num_move_points)
{
// selected brush verts
@ -3084,7 +3085,7 @@ void XYWnd::XY_Draw()
for (i=0; i < g_qeglobals.d_numpoints; i++)
DrawAlternatePoint(g_qeglobals.d_points[i], m_fScale);
qglEnd();
if(g_qeglobals.d_num_move_points)
{
// selected brush verts
@ -3101,7 +3102,7 @@ void XYWnd::XY_Draw()
else if (g_qeglobals.d_select_mode == sel_edge)
{
float *v1, *v2;
if(!g_PrefsDlg.m_bGlPtWorkaround)
if(!g_PrefsDlg.m_bGlPtWorkaround)
{
qglPointSize (4);
qglColor3f (0,0,1);
@ -3250,7 +3251,7 @@ bool XYWnd::AreaSelectOK()
return RotateMode() ? false : ScaleMode() ? false : true;
}
void XYWnd::OnCreate ()
void XYWnd::OnCreate ()
{
if (!MakeCurrent ())
Error ("glXMakeCurrent failed");
@ -3281,7 +3282,7 @@ void XYWnd::OnExpose ()
qglRotatef (-90, 0, 1, 0); // put Z going up
qglRotatef (-90, 1, 0, 0); // put Z going up
}
if (g_bCrossHairs)
{
qglColor4f(0.2f, 0.9f, 0.2f, 0.8f);
@ -3343,7 +3344,7 @@ void XYWnd::OnExpose ()
}
}
}
if (PathMode())
{
int n;
@ -3393,7 +3394,7 @@ void XYWnd::OnEntityCreate (const char* item)
brush_t *b;
for( b = selected_brushes.next; b != &selected_brushes; b = b->next )
{
}
}
@ -3406,7 +3407,7 @@ void XYWnd::OnEntityCreate (const char* item)
Sys_Printf("TODO: hook drop down group menu\n");
return;
}
if (strItem.Find("Smart_") >= 0)
{
CreateSmartEntity(this, m_ptDownX, m_ptDownY, strItem);
@ -3415,7 +3416,7 @@ void XYWnd::OnEntityCreate (const char* item)
{
CreateRightClickEntity(this, m_ptDownX, m_ptDownY, (char*)strItem.GetBuffer());
}
Sys_UpdateWindows(W_ALL);
//OnLButtonDown((MK_LBUTTON | MK_SHIFT), CPoint(m_ptDown.x+2, m_ptDown.y+2));
}