mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-14 16:40:46 +00:00
KenBuild: Astyle and Uncrustify all source.
git-svn-id: https://svn.eduke32.com/eduke32@5327 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
8fb903a83a
commit
8f82bc5239
9 changed files with 6777 additions and 6592 deletions
|
@ -4,7 +4,8 @@
|
|||
#include "baselayer.h"
|
||||
#include "build.h"
|
||||
|
||||
static struct {
|
||||
static struct
|
||||
{
|
||||
int fullscreen;
|
||||
int xdim3d, ydim3d, bpp3d;
|
||||
int forcesetup;
|
||||
|
@ -53,13 +54,17 @@ static struct {
|
|||
int idx3d = -1;
|
||||
int xdim, ydim, bpp;
|
||||
|
||||
if (firstTime) {
|
||||
if (firstTime)
|
||||
{
|
||||
xdim = settings.xdim3d;
|
||||
ydim = settings.ydim3d;
|
||||
bpp = settings.bpp3d;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
mode3d = [[modeslist3d objectAtIndex:[videoMode3DPUButton indexOfSelectedItem]] intValue];
|
||||
if (mode3d >= 0) {
|
||||
if (mode3d >= 0)
|
||||
{
|
||||
xdim = validmode[mode3d].xdim;
|
||||
ydim = validmode[mode3d].ydim;
|
||||
bpp = validmode[mode3d].bpp;
|
||||
|
@ -67,10 +72,12 @@ static struct {
|
|||
|
||||
}
|
||||
mode3d = checkvideomode(&xdim, &ydim, bpp, fullscreen, 1);
|
||||
if (mode3d < 0) {
|
||||
if (mode3d < 0)
|
||||
{
|
||||
int i, cd[] = { 32, 24, 16, 15, 8, 0 };
|
||||
for (i=0; cd[i]; ) { if (cd[i] >= bpp) i++; else break; }
|
||||
for ( ; cd[i]; i++) {
|
||||
for (; cd[i]; i++)
|
||||
{
|
||||
mode3d = checkvideomode(&xdim, &ydim, cd[i], fullscreen, 1);
|
||||
if (mode3d < 0) continue;
|
||||
break;
|
||||
|
@ -82,12 +89,14 @@ static struct {
|
|||
|
||||
modeslist3d = [[NSMutableArray alloc] init];
|
||||
|
||||
for (i = 0; i < validmodecnt; i++) {
|
||||
if (fullscreen == validmode[i].fs) {
|
||||
for (i = 0; i < validmodecnt; i++)
|
||||
{
|
||||
if (fullscreen == validmode[i].fs)
|
||||
{
|
||||
if (i == mode3d) idx3d = [modeslist3d count];
|
||||
[modeslist3d addObject:[NSNumber numberWithInt:i]];
|
||||
[videoMode3DPUButton addItemWithTitle:[NSString stringWithFormat:@"%d %C %d %d-bpp",
|
||||
validmode[i].xdim, 0xd7, validmode[i].ydim, validmode[i].bpp]];
|
||||
validmode[i].xdim, 0xd7, validmode[i].ydim, validmode[i].bpp]];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,7 +120,8 @@ static struct {
|
|||
- (IBAction)start:(id)sender
|
||||
{
|
||||
int mode = [[modeslist3d objectAtIndex:[videoMode3DPUButton indexOfSelectedItem]] intValue];
|
||||
if (mode >= 0) {
|
||||
if (mode >= 0)
|
||||
{
|
||||
settings.xdim3d = validmode[mode].xdim;
|
||||
settings.ydim3d = validmode[mode].ydim;
|
||||
settings.bpp3d = validmode[mode].bpp;
|
||||
|
@ -151,7 +161,8 @@ static struct {
|
|||
// user can enable it if they want to while waiting for something else to happen
|
||||
NSEnumerator *enumerator = [[[[tabView tabViewItemAtIndex:0] view] subviews] objectEnumerator];
|
||||
NSControl *control;
|
||||
while (control = [enumerator nextObject]) {
|
||||
while (control = [enumerator nextObject])
|
||||
{
|
||||
if (control == alwaysShowButton) continue;
|
||||
[control setEnabled:false];
|
||||
}
|
||||
|
@ -175,7 +186,8 @@ static struct {
|
|||
[messagesView replaceCharactersInRange:end withString:str];
|
||||
[text endEditing];
|
||||
|
||||
if (shouldAutoScroll) {
|
||||
if (shouldAutoScroll)
|
||||
{
|
||||
end.location = [text length];
|
||||
end.length = 0;
|
||||
[messagesView scrollRangeToVisible:end];
|
||||
|
@ -265,15 +277,17 @@ int startwin_run(void)
|
|||
|
||||
[startwin setupRunMode];
|
||||
|
||||
switch ([NSApp runModalForWindow:[startwin window]]) {
|
||||
case NSRunStoppedResponse: retval = 1; break;
|
||||
case NSRunAbortedResponse: retval = 0; break;
|
||||
default: retval = -1;
|
||||
switch ([NSApp runModalForWindow:[startwin window]])
|
||||
{
|
||||
case NSRunStoppedResponse: retval = 1; break;
|
||||
case NSRunAbortedResponse: retval = 0; break;
|
||||
default: retval = -1;
|
||||
}
|
||||
|
||||
[startwin setupMessagesMode];
|
||||
|
||||
if (retval) {
|
||||
if (retval)
|
||||
{
|
||||
fullscreen = settings.fullscreen;
|
||||
xdimgame = settings.xdim3d;
|
||||
ydimgame = settings.ydim3d;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,51 +1,52 @@
|
|||
|
||||
#include "compat.h"
|
||||
#include "build.h"
|
||||
|
||||
#include "names.h"
|
||||
#include "common_game.h"
|
||||
|
||||
static const char *defaultgrpfilename = "stuff.dat";
|
||||
static const char *defaultdeffilename = "kenbuild.def";
|
||||
|
||||
const char *G_DefaultGrpFile(void)
|
||||
{
|
||||
return defaultgrpfilename;
|
||||
}
|
||||
const char *G_GrpFile(void)
|
||||
{
|
||||
return defaultgrpfilename;
|
||||
}
|
||||
|
||||
const char *G_DefaultDefFile(void)
|
||||
{
|
||||
return defaultdeffilename;
|
||||
}
|
||||
const char *G_DefFile(void)
|
||||
{
|
||||
return defaultdeffilename;
|
||||
}
|
||||
|
||||
uint8_t *basepaltable[1] = {
|
||||
palette
|
||||
};
|
||||
|
||||
uint32_t PaletteIndexFullbrights[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
void Ken_InitMultiPsky(void)
|
||||
{
|
||||
// default
|
||||
psky * const defaultsky = E_DefinePsky(DEFAULTPSKY);
|
||||
defaultsky->lognumtiles = 1;
|
||||
defaultsky->horizfrac = 65536;
|
||||
|
||||
// DAYSKY
|
||||
psky * const daysky = E_DefinePsky(DAYSKY);
|
||||
daysky->lognumtiles = 1;
|
||||
daysky->horizfrac = 65536;
|
||||
|
||||
// NIGHTSKY
|
||||
psky * const nightsky = E_DefinePsky(NIGHTSKY);
|
||||
nightsky->lognumtiles = 3;
|
||||
nightsky->horizfrac = 65536;
|
||||
}
|
||||
|
||||
#include "compat.h"
|
||||
#include "build.h"
|
||||
|
||||
#include "names.h"
|
||||
#include "common_game.h"
|
||||
|
||||
static const char *defaultgrpfilename = "stuff.dat";
|
||||
static const char *defaultdeffilename = "kenbuild.def";
|
||||
|
||||
const char *G_DefaultGrpFile(void)
|
||||
{
|
||||
return defaultgrpfilename;
|
||||
}
|
||||
const char *G_GrpFile(void)
|
||||
{
|
||||
return defaultgrpfilename;
|
||||
}
|
||||
|
||||
const char *G_DefaultDefFile(void)
|
||||
{
|
||||
return defaultdeffilename;
|
||||
}
|
||||
const char *G_DefFile(void)
|
||||
{
|
||||
return defaultdeffilename;
|
||||
}
|
||||
|
||||
uint8_t *basepaltable[1] =
|
||||
{
|
||||
palette
|
||||
};
|
||||
|
||||
uint32_t PaletteIndexFullbrights[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
void Ken_InitMultiPsky(void)
|
||||
{
|
||||
// default
|
||||
psky *const defaultsky = E_DefinePsky(DEFAULTPSKY);
|
||||
defaultsky->lognumtiles = 1;
|
||||
defaultsky->horizfrac = 65536;
|
||||
|
||||
// DAYSKY
|
||||
psky *const daysky = E_DefinePsky(DAYSKY);
|
||||
daysky->lognumtiles = 1;
|
||||
daysky->horizfrac = 65536;
|
||||
|
||||
// NIGHTSKY
|
||||
psky *const nightsky = E_DefinePsky(NIGHTSKY);
|
||||
nightsky->lognumtiles = 3;
|
||||
nightsky->horizfrac = 65536;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
#include "compat.h"
|
||||
|
||||
extern const char *G_DefaultGrpFile(void);
|
||||
extern const char *G_GrpFile(void);
|
||||
|
||||
extern uint8_t *basepaltable[1];
|
||||
|
||||
extern void Ken_InitMultiPsky(void);
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
extern const char *G_DefaultGrpFile(void);
|
||||
extern const char *G_GrpFile(void);
|
||||
|
||||
extern uint8_t *basepaltable[1];
|
||||
|
||||
extern void Ken_InitMultiPsky(void);
|
||||
|
|
|
@ -1,286 +1,288 @@
|
|||
// Evil and Nasty Configuration File Reader for KenBuild
|
||||
// by Jonathon Fowler
|
||||
|
||||
#include "compat.h"
|
||||
#include "build.h"
|
||||
#include "editor.h"
|
||||
#include "osd.h"
|
||||
|
||||
#ifdef RENDERTYPEWIN
|
||||
#include "winlayer.h"
|
||||
#endif
|
||||
#include "baselayer.h"
|
||||
|
||||
static int vesares[13][2] = {{320,200},{360,200},{320,240},{360,240},{320,400},
|
||||
{360,400},{640,350},{640,400},{640,480},{800,600},
|
||||
{1024,768},{1280,1024},{1600,1200}};
|
||||
|
||||
static int readconfig(BFILE *fp, const char *key, char *value, unsigned len)
|
||||
{
|
||||
char buf[1000], *k, *v, *eq;
|
||||
int x=0;
|
||||
|
||||
if (len < 1) return 0;
|
||||
|
||||
Brewind(fp);
|
||||
|
||||
while (1) {
|
||||
if (!Bfgets(buf, 1000, fp)) return 0;
|
||||
|
||||
if (buf[0] == ';') continue;
|
||||
|
||||
eq = Bstrchr(buf, '=');
|
||||
if (!eq) continue;
|
||||
|
||||
k = buf;
|
||||
v = eq+1;
|
||||
|
||||
while (*k == ' ' || *k == '\t') k++;
|
||||
*(eq--) = 0;
|
||||
while ((*eq == ' ' || *eq == '\t') && eq>=k) *(eq--) = 0;
|
||||
|
||||
if (Bstrcasecmp(k, key)) continue;
|
||||
|
||||
while (*v == ' ' || *k == '\t') v++;
|
||||
eq = v + Bstrlen(v)-1;
|
||||
|
||||
while ((*eq == ' ' || *eq == '\t' || *eq == '\r' || *eq == '\n') && eq>=v) *(eq--) = 0;
|
||||
|
||||
value[--len] = 0;
|
||||
do value[x] = v[x]; while (v[x++] != 0 && len-- > 0);
|
||||
|
||||
return x-1;
|
||||
}
|
||||
}
|
||||
|
||||
extern short brightness;
|
||||
extern int fullscreen;
|
||||
extern unsigned char option[8];
|
||||
extern unsigned char keys[NUMBUILDKEYS];
|
||||
extern double msens;
|
||||
|
||||
/*
|
||||
* SETUP.DAT
|
||||
* 0 = video mode (0:chained 1:vesa 2:screen buffered 3/4/5:tseng/paradise/s3 6:red-blue)
|
||||
* 1 = sound (0:none)
|
||||
* 2 = music (0:none)
|
||||
* 3 = input (0:keyboard 1:+mouse)
|
||||
* 4 = multiplayer (0:single 1-4:com 5-11:ipx)
|
||||
* 5&0xf0 = com speed
|
||||
* 5&0x0f = com irq
|
||||
* 6&0xf0 = chained y-res
|
||||
* 6&0x0f = chained x-res or vesa mode
|
||||
* 7&0xf0 = sound samplerate
|
||||
* 7&0x01 = sound quality
|
||||
* 7&0x02 = 8/16 bit
|
||||
* 7&0x04 = mono/stereo
|
||||
*
|
||||
* bytes 8 to 26 are key settings:
|
||||
* 0 = Forward (0xc8)
|
||||
* 1 = Backward (0xd0)
|
||||
* 2 = Turn left (0xcb)
|
||||
* 3 = Turn right (0xcd)
|
||||
* 4 = Run (0x2a)
|
||||
* 5 = Strafe (0x9d)
|
||||
* 6 = Fire (0x1d)
|
||||
* 7 = Use (0x39)
|
||||
* 8 = Stand high (0x1e)
|
||||
* 9 = Stand low (0x2c)
|
||||
* 10 = Look up (0xd1)
|
||||
* 11 = Look down (0xc9)
|
||||
* 12 = Strafe left (0x33)
|
||||
* 13 = Strafe right (0x34)
|
||||
* 14 = 2D/3D switch (0x9c)
|
||||
* 15 = View cycle (0x1c)
|
||||
* 16 = 2D Zoom in (0xd)
|
||||
* 17 = 2D Zoom out (0xc)
|
||||
* 18 = Chat (0xf)
|
||||
*/
|
||||
|
||||
int loadsetup(const char *fn)
|
||||
{
|
||||
BFILE *fp;
|
||||
#define VL 32
|
||||
char val[VL];
|
||||
int i;
|
||||
|
||||
if ((fp = Bfopen(fn, "rt")) == NULL) return -1;
|
||||
|
||||
if (readconfig(fp, "forcesetup", val, VL) > 0) { if (Batoi(val) != 0) forcesetup = 1; else forcesetup = 0; }
|
||||
if (readconfig(fp, "fullscreen", val, VL) > 0) { if (Batoi(val) != 0) fullscreen = 1; else fullscreen = 0; }
|
||||
if (readconfig(fp, "resolution", val, VL) > 0) {
|
||||
i = Batoi(val) & 0x0f;
|
||||
if ((unsigned)i<13) { xdimgame = xdim2d = vesares[i][0]; ydimgame = ydim2d = vesares[i][1]; }
|
||||
}
|
||||
if (readconfig(fp, "xdim", val, VL) > 0) xdimgame = xdim2d = Batoi(val);
|
||||
if (readconfig(fp, "ydim", val, VL) > 0) ydimgame = xdim2d = Batoi(val);
|
||||
if (readconfig(fp, "samplerate", val, VL) > 0) option[7] = (Batoi(val) & 0x0f) << 4;
|
||||
if (readconfig(fp, "music", val, VL) > 0) { if (Batoi(val) != 0) option[2] = 1; else option[2] = 0; }
|
||||
if (readconfig(fp, "mouse", val, VL) > 0) { if (Batoi(val) != 0) option[3] = 1; else option[3] = 0; }
|
||||
if (readconfig(fp, "bpp", val, VL) > 0) bppgame = Batoi(val);
|
||||
if (readconfig(fp, "renderer", val, VL) > 0) { i = Batoi(val); setrendermode(i); }
|
||||
if (readconfig(fp, "brightness", val, VL) > 0) brightness = min(max(Batoi(val),0),15);
|
||||
|
||||
#ifdef RENDERTYPEWIN
|
||||
if (readconfig(fp, "maxrefreshfreq", val, VL) > 0) maxrefreshfreq = Batoi(val);
|
||||
#endif
|
||||
|
||||
option[0] = 1; // vesa all the way...
|
||||
option[1] = 1; // sound all the way...
|
||||
option[4] = 0; // no multiplayer
|
||||
option[5] = 0;
|
||||
|
||||
if (readconfig(fp, "keyforward", val, VL) > 0) keys[0] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keybackward", val, VL) > 0) keys[1] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keyturnleft", val, VL) > 0) keys[2] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keyturnright", val, VL) > 0) keys[3] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keyrun", val, VL) > 0) keys[4] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keystrafe", val, VL) > 0) keys[5] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keyfire", val, VL) > 0) keys[6] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keyuse", val, VL) > 0) keys[7] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keystandhigh", val, VL) > 0) keys[8] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keystandlow", val, VL) > 0) keys[9] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keylookup", val, VL) > 0) keys[10] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keylookdown", val, VL) > 0) keys[11] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keystrafeleft", val, VL) > 0) keys[12] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keystraferight", val, VL) > 0) keys[13] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "key2dmode", val, VL) > 0) keys[14] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keyviewcycle", val, VL) > 0) keys[15] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "key2dzoomin", val, VL) > 0) keys[16] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "key2dzoomout", val, VL) > 0) keys[17] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keychat", val, VL) > 0) keys[18] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keyconsole", val, VL) > 0) { keys[19] = Bstrtol(val, NULL, 16); OSD_CaptureKey(keys[19]); }
|
||||
|
||||
if (readconfig(fp, "mousesensitivity", val, VL) > 0) msens = Bstrtod(val, NULL);
|
||||
|
||||
Bfclose(fp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int writesetup(const char *fn)
|
||||
{
|
||||
BFILE *fp;
|
||||
|
||||
fp = Bfopen(fn,"wt");
|
||||
if (!fp) return -1;
|
||||
|
||||
Bfprintf(fp,
|
||||
"; Always show configuration options on startup\n"
|
||||
"; 0 - No\n"
|
||||
"; 1 - Yes\n"
|
||||
"forcesetup = %d\n"
|
||||
"\n"
|
||||
"; Video mode selection\n"
|
||||
"; 0 - Windowed\n"
|
||||
"; 1 - Fullscreen\n"
|
||||
"fullscreen = %d\n"
|
||||
"\n"
|
||||
"; Video resolution\n"
|
||||
"xdim = %d\n"
|
||||
"ydim = %d\n"
|
||||
"\n"
|
||||
"; 3D-mode colour depth\n"
|
||||
"bpp = %d\n"
|
||||
"\n"
|
||||
#ifdef USE_OPENGL
|
||||
"; OpenGL mode options\n"
|
||||
"glusetexcache = %d\n"
|
||||
"\n"
|
||||
#endif
|
||||
#ifdef RENDERTYPEWIN
|
||||
"; Maximum OpenGL mode refresh rate (Windows only, in Hertz)\n"
|
||||
"maxrefreshfreq = %d\n"
|
||||
"\n"
|
||||
#endif
|
||||
"; 3D mode brightness setting\n"
|
||||
"; 0 - lowest\n"
|
||||
"; 15 - highest\n"
|
||||
"brightness = %d\n"
|
||||
"\n"
|
||||
"; Sound sample frequency\n"
|
||||
"; 0 - 6 KHz\n"
|
||||
"; 1 - 8 KHz\n"
|
||||
"; 2 - 11.025 KHz\n"
|
||||
"; 3 - 16 KHz\n"
|
||||
"; 4 - 22.05 KHz\n"
|
||||
"; 5 - 32 KHz\n"
|
||||
"; 6 - 44.1 KHz\n"
|
||||
"samplerate = %d\n"
|
||||
"\n"
|
||||
"; Music playback\n"
|
||||
"; 0 - Off\n"
|
||||
"; 1 - On\n"
|
||||
"music = %d\n"
|
||||
"\n"
|
||||
"; Enable mouse\n"
|
||||
"; 0 - No\n"
|
||||
"; 1 - Yes\n"
|
||||
"mouse = %d\n"
|
||||
"\n"
|
||||
"; Mouse sensitivity\n"
|
||||
"mousesensitivity = %g\n"
|
||||
"\n"
|
||||
"; Key Settings\n"
|
||||
"; Here's a map of all the keyboard scan codes: NOTE: values are listed in hex!\n"
|
||||
"; +---------------------------------------------------------------------------------------------+\n"
|
||||
"; | 01 3B 3C 3D 3E 3F 40 41 42 43 44 57 58 46 |\n"
|
||||
"; |ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 SCROLL |\n"
|
||||
"; | |\n"
|
||||
"; |29 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E D2 C7 C9 45 B5 37 4A |\n"
|
||||
"; | ` '1' '2' '3' '4' '5' '6' '7' '8' '9' '0' - = BACK INS HOME PGUP NUMLK KP/ KP* KP- |\n"
|
||||
"; | |\n"
|
||||
"; | 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 2B D3 CF D1 47 48 49 4E |\n"
|
||||
"; |TAB Q W E R T Y U I O P [ ] \\ DEL END PGDN KP7 KP8 KP9 KP+ |\n"
|
||||
"; | |\n"
|
||||
"; | 3A 1E 1F 20 21 22 23 24 25 26 27 28 1C 4B 4C 4D |\n"
|
||||
"; |CAPS A S D F G H J K L ; ' ENTER KP4 KP5 KP6 9C |\n"
|
||||
"; | KPENTER|\n"
|
||||
"; | 2A 2C 2D 2E 2F 30 31 32 33 34 35 36 C8 4F 50 51 |\n"
|
||||
"; |LSHIFT Z X C V B N M , . / RSHIFT UP KP1 KP2 KP3 |\n"
|
||||
"; | |\n"
|
||||
"; | 1D 38 39 B8 9D CB D0 CD 52 53 |\n"
|
||||
"; |LCTRL LALT SPACE RALT RCTRL LEFT DOWN RIGHT KP0 KP. |\n"
|
||||
"; +---------------------------------------------------------------------------------------------+\n"
|
||||
"\n"
|
||||
"keyforward = %X\n"
|
||||
"keybackward = %X\n"
|
||||
"keyturnleft = %X\n"
|
||||
"keyturnright = %X\n"
|
||||
"keyrun = %X\n"
|
||||
"keystrafe = %X\n"
|
||||
"keyfire = %X\n"
|
||||
"keyuse = %X\n"
|
||||
"keystandhigh = %X\n"
|
||||
"keystandlow = %X\n"
|
||||
"keylookup = %X\n"
|
||||
"keylookdown = %X\n"
|
||||
"keystrafeleft = %X\n"
|
||||
"keystraferight = %X\n"
|
||||
"key2dmode = %X\n"
|
||||
"keyviewcycle = %X\n"
|
||||
"key2dzoomin = %X\n"
|
||||
"key2dzoomout = %X\n"
|
||||
"keychat = %X\n"
|
||||
"keyconsole = %X\n"
|
||||
"\n",
|
||||
|
||||
forcesetup, fullscreen, xdimgame, ydimgame, bppgame,
|
||||
#ifdef USE_OPENGL
|
||||
glusetexcache,
|
||||
#endif
|
||||
#ifdef RENDERTYPEWIN
|
||||
maxrefreshfreq,
|
||||
#endif
|
||||
brightness, option[7]>>4, option[2],
|
||||
option[3], msens,
|
||||
keys[0], keys[1], keys[2], keys[3], keys[4], keys[5],
|
||||
keys[6], keys[7], keys[8], keys[9], keys[10], keys[11],
|
||||
keys[12], keys[13], keys[14], keys[15], keys[16], keys[17],
|
||||
keys[18], keys[19]
|
||||
);
|
||||
|
||||
Bfclose(fp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
// Evil and Nasty Configuration File Reader for KenBuild
|
||||
// by Jonathon Fowler
|
||||
|
||||
#include "compat.h"
|
||||
#include "build.h"
|
||||
#include "editor.h"
|
||||
#include "osd.h"
|
||||
|
||||
#ifdef RENDERTYPEWIN
|
||||
#include "winlayer.h"
|
||||
#endif
|
||||
#include "baselayer.h"
|
||||
|
||||
static int vesares[13][2] = {{320,200},{360,200},{320,240},{360,240},{320,400},
|
||||
{360,400},{640,350},{640,400},{640,480},{800,600},
|
||||
{1024,768},{1280,1024},{1600,1200}};
|
||||
|
||||
static int readconfig(BFILE *fp, const char *key, char *value, unsigned len)
|
||||
{
|
||||
char buf[1000], *k, *v, *eq;
|
||||
int x=0;
|
||||
|
||||
if (len < 1) return 0;
|
||||
|
||||
Brewind(fp);
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (!Bfgets(buf, 1000, fp)) return 0;
|
||||
|
||||
if (buf[0] == ';') continue;
|
||||
|
||||
eq = Bstrchr(buf, '=');
|
||||
if (!eq) continue;
|
||||
|
||||
k = buf;
|
||||
v = eq+1;
|
||||
|
||||
while (*k == ' ' || *k == '\t') k++;
|
||||
*(eq--) = 0;
|
||||
while ((*eq == ' ' || *eq == '\t') && eq>=k) *(eq--) = 0;
|
||||
|
||||
if (Bstrcasecmp(k, key)) continue;
|
||||
|
||||
while (*v == ' ' || *k == '\t') v++;
|
||||
eq = v + Bstrlen(v)-1;
|
||||
|
||||
while ((*eq == ' ' || *eq == '\t' || *eq == '\r' || *eq == '\n') && eq>=v) *(eq--) = 0;
|
||||
|
||||
value[--len] = 0;
|
||||
do value[x] = v[x]; while (v[x++] != 0 && len-- > 0);
|
||||
|
||||
return x-1;
|
||||
}
|
||||
}
|
||||
|
||||
extern short brightness;
|
||||
extern int fullscreen;
|
||||
extern unsigned char option[8];
|
||||
extern unsigned char keys[NUMBUILDKEYS];
|
||||
extern double msens;
|
||||
|
||||
/*
|
||||
* SETUP.DAT
|
||||
* 0 = video mode (0:chained 1:vesa 2:screen buffered 3/4/5:tseng/paradise/s3 6:red-blue)
|
||||
* 1 = sound (0:none)
|
||||
* 2 = music (0:none)
|
||||
* 3 = input (0:keyboard 1:+mouse)
|
||||
* 4 = multiplayer (0:single 1-4:com 5-11:ipx)
|
||||
* 5&0xf0 = com speed
|
||||
* 5&0x0f = com irq
|
||||
* 6&0xf0 = chained y-res
|
||||
* 6&0x0f = chained x-res or vesa mode
|
||||
* 7&0xf0 = sound samplerate
|
||||
* 7&0x01 = sound quality
|
||||
* 7&0x02 = 8/16 bit
|
||||
* 7&0x04 = mono/stereo
|
||||
*
|
||||
* bytes 8 to 26 are key settings:
|
||||
* 0 = Forward (0xc8)
|
||||
* 1 = Backward (0xd0)
|
||||
* 2 = Turn left (0xcb)
|
||||
* 3 = Turn right (0xcd)
|
||||
* 4 = Run (0x2a)
|
||||
* 5 = Strafe (0x9d)
|
||||
* 6 = Fire (0x1d)
|
||||
* 7 = Use (0x39)
|
||||
* 8 = Stand high (0x1e)
|
||||
* 9 = Stand low (0x2c)
|
||||
* 10 = Look up (0xd1)
|
||||
* 11 = Look down (0xc9)
|
||||
* 12 = Strafe left (0x33)
|
||||
* 13 = Strafe right (0x34)
|
||||
* 14 = 2D/3D switch (0x9c)
|
||||
* 15 = View cycle (0x1c)
|
||||
* 16 = 2D Zoom in (0xd)
|
||||
* 17 = 2D Zoom out (0xc)
|
||||
* 18 = Chat (0xf)
|
||||
*/
|
||||
|
||||
int loadsetup(const char *fn)
|
||||
{
|
||||
BFILE *fp;
|
||||
#define VL 32
|
||||
char val[VL];
|
||||
int i;
|
||||
|
||||
if ((fp = Bfopen(fn, "rt")) == NULL) return -1;
|
||||
|
||||
if (readconfig(fp, "forcesetup", val, VL) > 0) { if (Batoi(val) != 0) forcesetup = 1; else forcesetup = 0; }
|
||||
if (readconfig(fp, "fullscreen", val, VL) > 0) { if (Batoi(val) != 0) fullscreen = 1; else fullscreen = 0; }
|
||||
if (readconfig(fp, "resolution", val, VL) > 0)
|
||||
{
|
||||
i = Batoi(val) & 0x0f;
|
||||
if ((unsigned)i<13) { xdimgame = xdim2d = vesares[i][0]; ydimgame = ydim2d = vesares[i][1]; }
|
||||
}
|
||||
if (readconfig(fp, "xdim", val, VL) > 0) xdimgame = xdim2d = Batoi(val);
|
||||
if (readconfig(fp, "ydim", val, VL) > 0) ydimgame = xdim2d = Batoi(val);
|
||||
if (readconfig(fp, "samplerate", val, VL) > 0) option[7] = (Batoi(val) & 0x0f) << 4;
|
||||
if (readconfig(fp, "music", val, VL) > 0) { if (Batoi(val) != 0) option[2] = 1; else option[2] = 0; }
|
||||
if (readconfig(fp, "mouse", val, VL) > 0) { if (Batoi(val) != 0) option[3] = 1; else option[3] = 0; }
|
||||
if (readconfig(fp, "bpp", val, VL) > 0) bppgame = Batoi(val);
|
||||
if (readconfig(fp, "renderer", val, VL) > 0) { i = Batoi(val); setrendermode(i); }
|
||||
if (readconfig(fp, "brightness", val, VL) > 0) brightness = min(max(Batoi(val),0),15);
|
||||
|
||||
#ifdef RENDERTYPEWIN
|
||||
if (readconfig(fp, "maxrefreshfreq", val, VL) > 0) maxrefreshfreq = Batoi(val);
|
||||
#endif
|
||||
|
||||
option[0] = 1; // vesa all the way...
|
||||
option[1] = 1; // sound all the way...
|
||||
option[4] = 0; // no multiplayer
|
||||
option[5] = 0;
|
||||
|
||||
if (readconfig(fp, "keyforward", val, VL) > 0) keys[0] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keybackward", val, VL) > 0) keys[1] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keyturnleft", val, VL) > 0) keys[2] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keyturnright", val, VL) > 0) keys[3] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keyrun", val, VL) > 0) keys[4] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keystrafe", val, VL) > 0) keys[5] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keyfire", val, VL) > 0) keys[6] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keyuse", val, VL) > 0) keys[7] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keystandhigh", val, VL) > 0) keys[8] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keystandlow", val, VL) > 0) keys[9] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keylookup", val, VL) > 0) keys[10] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keylookdown", val, VL) > 0) keys[11] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keystrafeleft", val, VL) > 0) keys[12] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keystraferight", val, VL) > 0) keys[13] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "key2dmode", val, VL) > 0) keys[14] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keyviewcycle", val, VL) > 0) keys[15] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "key2dzoomin", val, VL) > 0) keys[16] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "key2dzoomout", val, VL) > 0) keys[17] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keychat", val, VL) > 0) keys[18] = Bstrtol(val, NULL, 16);
|
||||
if (readconfig(fp, "keyconsole", val, VL) > 0) { keys[19] = Bstrtol(val, NULL, 16); OSD_CaptureKey(keys[19]); }
|
||||
|
||||
if (readconfig(fp, "mousesensitivity", val, VL) > 0) msens = Bstrtod(val, NULL);
|
||||
|
||||
Bfclose(fp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int writesetup(const char *fn)
|
||||
{
|
||||
BFILE *fp;
|
||||
|
||||
fp = Bfopen(fn,"wt");
|
||||
if (!fp) return -1;
|
||||
|
||||
Bfprintf(fp,
|
||||
"; Always show configuration options on startup\n"
|
||||
"; 0 - No\n"
|
||||
"; 1 - Yes\n"
|
||||
"forcesetup = %d\n"
|
||||
"\n"
|
||||
"; Video mode selection\n"
|
||||
"; 0 - Windowed\n"
|
||||
"; 1 - Fullscreen\n"
|
||||
"fullscreen = %d\n"
|
||||
"\n"
|
||||
"; Video resolution\n"
|
||||
"xdim = %d\n"
|
||||
"ydim = %d\n"
|
||||
"\n"
|
||||
"; 3D-mode colour depth\n"
|
||||
"bpp = %d\n"
|
||||
"\n"
|
||||
#ifdef USE_OPENGL
|
||||
"; OpenGL mode options\n"
|
||||
"glusetexcache = %d\n"
|
||||
"\n"
|
||||
#endif
|
||||
#ifdef RENDERTYPEWIN
|
||||
"; Maximum OpenGL mode refresh rate (Windows only, in Hertz)\n"
|
||||
"maxrefreshfreq = %d\n"
|
||||
"\n"
|
||||
#endif
|
||||
"; 3D mode brightness setting\n"
|
||||
"; 0 - lowest\n"
|
||||
"; 15 - highest\n"
|
||||
"brightness = %d\n"
|
||||
"\n"
|
||||
"; Sound sample frequency\n"
|
||||
"; 0 - 6 KHz\n"
|
||||
"; 1 - 8 KHz\n"
|
||||
"; 2 - 11.025 KHz\n"
|
||||
"; 3 - 16 KHz\n"
|
||||
"; 4 - 22.05 KHz\n"
|
||||
"; 5 - 32 KHz\n"
|
||||
"; 6 - 44.1 KHz\n"
|
||||
"samplerate = %d\n"
|
||||
"\n"
|
||||
"; Music playback\n"
|
||||
"; 0 - Off\n"
|
||||
"; 1 - On\n"
|
||||
"music = %d\n"
|
||||
"\n"
|
||||
"; Enable mouse\n"
|
||||
"; 0 - No\n"
|
||||
"; 1 - Yes\n"
|
||||
"mouse = %d\n"
|
||||
"\n"
|
||||
"; Mouse sensitivity\n"
|
||||
"mousesensitivity = %g\n"
|
||||
"\n"
|
||||
"; Key Settings\n"
|
||||
"; Here's a map of all the keyboard scan codes: NOTE: values are listed in hex!\n"
|
||||
"; +---------------------------------------------------------------------------------------------+\n"
|
||||
"; | 01 3B 3C 3D 3E 3F 40 41 42 43 44 57 58 46 |\n"
|
||||
"; |ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 SCROLL |\n"
|
||||
"; | |\n"
|
||||
"; |29 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E D2 C7 C9 45 B5 37 4A |\n"
|
||||
"; | ` '1' '2' '3' '4' '5' '6' '7' '8' '9' '0' - = BACK INS HOME PGUP NUMLK KP/ KP* KP- |\n"
|
||||
"; | |\n"
|
||||
"; | 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 2B D3 CF D1 47 48 49 4E |\n"
|
||||
"; |TAB Q W E R T Y U I O P [ ] \\ DEL END PGDN KP7 KP8 KP9 KP+ |\n"
|
||||
"; | |\n"
|
||||
"; | 3A 1E 1F 20 21 22 23 24 25 26 27 28 1C 4B 4C 4D |\n"
|
||||
"; |CAPS A S D F G H J K L ; ' ENTER KP4 KP5 KP6 9C |\n"
|
||||
"; | KPENTER|\n"
|
||||
"; | 2A 2C 2D 2E 2F 30 31 32 33 34 35 36 C8 4F 50 51 |\n"
|
||||
"; |LSHIFT Z X C V B N M , . / RSHIFT UP KP1 KP2 KP3 |\n"
|
||||
"; | |\n"
|
||||
"; | 1D 38 39 B8 9D CB D0 CD 52 53 |\n"
|
||||
"; |LCTRL LALT SPACE RALT RCTRL LEFT DOWN RIGHT KP0 KP. |\n"
|
||||
"; +---------------------------------------------------------------------------------------------+\n"
|
||||
"\n"
|
||||
"keyforward = %X\n"
|
||||
"keybackward = %X\n"
|
||||
"keyturnleft = %X\n"
|
||||
"keyturnright = %X\n"
|
||||
"keyrun = %X\n"
|
||||
"keystrafe = %X\n"
|
||||
"keyfire = %X\n"
|
||||
"keyuse = %X\n"
|
||||
"keystandhigh = %X\n"
|
||||
"keystandlow = %X\n"
|
||||
"keylookup = %X\n"
|
||||
"keylookdown = %X\n"
|
||||
"keystrafeleft = %X\n"
|
||||
"keystraferight = %X\n"
|
||||
"key2dmode = %X\n"
|
||||
"keyviewcycle = %X\n"
|
||||
"key2dzoomin = %X\n"
|
||||
"key2dzoomout = %X\n"
|
||||
"keychat = %X\n"
|
||||
"keyconsole = %X\n"
|
||||
"\n",
|
||||
|
||||
forcesetup, fullscreen, xdimgame, ydimgame, bppgame,
|
||||
#ifdef USE_OPENGL
|
||||
glusetexcache,
|
||||
#endif
|
||||
#ifdef RENDERTYPEWIN
|
||||
maxrefreshfreq,
|
||||
#endif
|
||||
brightness, option[7]>>4, option[2],
|
||||
option[3], msens,
|
||||
keys[0], keys[1], keys[2], keys[3], keys[4], keys[5],
|
||||
keys[6], keys[7], keys[8], keys[9], keys[10], keys[11],
|
||||
keys[12], keys[13], keys[14], keys[15], keys[16], keys[17],
|
||||
keys[18], keys[19]
|
||||
);
|
||||
|
||||
Bfclose(fp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -52,4 +52,4 @@ void updateinterpolations(void);
|
|||
void dointerpolations(void);
|
||||
void restoreinterpolations(void);
|
||||
void printext(int x, int y, char *buffer, short tilenum /*, char invisiblecol*/);
|
||||
void drawtilebackground (/*int thex, int they,*/ short tilenum, signed char shade, int cx1, int cy1, int cx2, int cy2, char dapalnum);
|
||||
void drawtilebackground(/*int thex, int they,*/ short tilenum, signed char shade, int cx1, int cy1, int cx2, int cy2, char dapalnum);
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
#define TAB_CONFIG 0
|
||||
#define TAB_MESSAGES 1
|
||||
|
||||
static struct {
|
||||
static struct
|
||||
{
|
||||
int fullscreen;
|
||||
int xdim3d, ydim3d, bpp3d;
|
||||
int forcesetup;
|
||||
|
@ -41,18 +42,18 @@ static int retval = -1, mode = TAB_MESSAGES;
|
|||
// -- SUPPORT FUNCTIONS -------------------------------------------------------
|
||||
|
||||
#define GLADE_HOOKUP_OBJECT(component,widget,name) \
|
||||
g_object_set_data_full (G_OBJECT (component), name, \
|
||||
gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
|
||||
g_object_set_data_full (G_OBJECT (component), name, \
|
||||
gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
|
||||
|
||||
#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
|
||||
g_object_set_data (G_OBJECT (component), name, widget)
|
||||
g_object_set_data (G_OBJECT (component), name, widget)
|
||||
|
||||
#define lookup_widget(x,w) \
|
||||
(GtkWidget*) g_object_get_data(G_OBJECT(x), w)
|
||||
|
||||
static GdkPixbuf *load_banner(void)
|
||||
{
|
||||
return gdk_pixbuf_from_pixdata((GdkPixdata*)&startbanner_pixdata, FALSE, NULL);
|
||||
return gdk_pixbuf_from_pixdata((GdkPixdata *)&startbanner_pixdata, FALSE, NULL);
|
||||
}
|
||||
|
||||
static void SetPage(int n)
|
||||
|
@ -65,7 +66,7 @@ static void SetPage(int n)
|
|||
if (n == TAB_CONFIG) n = TRUE; else n = FALSE;
|
||||
gtk_widget_set_sensitive(lookup_widget(startwin,"startbutton"), n);
|
||||
gtk_container_foreach(GTK_CONTAINER(lookup_widget(startwin,"configvlayout")),
|
||||
(GtkCallback)gtk_widget_set_sensitive, (gpointer)n);
|
||||
(GtkCallback)gtk_widget_set_sensitive, (gpointer)n);
|
||||
}
|
||||
|
||||
static void on_vmode3dcombo_changed(GtkComboBox *, gpointer);
|
||||
|
@ -78,10 +79,12 @@ static void PopulateForm(void)
|
|||
char buf[64];
|
||||
|
||||
mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1);
|
||||
if (mode3d < 0) {
|
||||
if (mode3d < 0)
|
||||
{
|
||||
int i, cd[] = { 32, 24, 16, 15, 8, 0 };
|
||||
for (i=0; cd[i]; ) { if (cd[i] >= settings.bpp3d) i++; else break; }
|
||||
for ( ; cd[i]; i++) {
|
||||
for (; cd[i]; i++)
|
||||
{
|
||||
mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1);
|
||||
if (mode3d < 0) continue;
|
||||
settings.bpp3d = cd[i];
|
||||
|
@ -96,14 +99,16 @@ static void PopulateForm(void)
|
|||
modes3d = GTK_LIST_STORE(gtk_combo_box_get_model(box3d));
|
||||
gtk_list_store_clear(modes3d);
|
||||
|
||||
for (i=0; i<validmodecnt; i++) {
|
||||
for (i=0; i<validmodecnt; i++)
|
||||
{
|
||||
if (validmode[i].fs != settings.fullscreen) continue;
|
||||
|
||||
// all modes get added to the 3D mode list
|
||||
Bsprintf(buf, "%ld x %ld %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp);
|
||||
gtk_list_store_append(modes3d, &iter);
|
||||
gtk_list_store_set(modes3d, &iter, 0,buf, 1,i, -1);
|
||||
if (i == mode3d) {
|
||||
if (i == mode3d)
|
||||
{
|
||||
g_signal_handlers_block_by_func(box3d, on_vmode3dcombo_changed, NULL);
|
||||
gtk_combo_box_set_active_iter(box3d, &iter);
|
||||
g_signal_handlers_unblock_by_func(box3d, on_vmode3dcombo_changed, NULL);
|
||||
|
@ -158,266 +163,266 @@ static gboolean on_startwin_delete_event(GtkWidget *widget, GdkEvent *event, gpo
|
|||
|
||||
static GtkWidget *create_window(void)
|
||||
{
|
||||
GtkWidget *startwin;
|
||||
GtkWidget *hlayout;
|
||||
GtkWidget *banner;
|
||||
GtkWidget *vlayout;
|
||||
GtkWidget *tabs;
|
||||
GtkWidget *configvlayout;
|
||||
GtkWidget *configlayout;
|
||||
GtkWidget *vmode3dlabel;
|
||||
GtkWidget *vmode3dcombo;
|
||||
GtkWidget *fullscreencheck;
|
||||
GtkWidget *alwaysshowcheck;
|
||||
GtkWidget *configtab;
|
||||
GtkWidget *messagesscroll;
|
||||
GtkWidget *messagestext;
|
||||
GtkWidget *messagestab;
|
||||
GtkWidget *buttons;
|
||||
GtkWidget *cancelbutton;
|
||||
GtkWidget *cancelbuttonalign;
|
||||
GtkWidget *cancelbuttonlayout;
|
||||
GtkWidget *cancelbuttonicon;
|
||||
GtkWidget *cancelbuttonlabel;
|
||||
GtkWidget *startbutton;
|
||||
GtkWidget *startbuttonalign;
|
||||
GtkWidget *startbuttonlayout;
|
||||
GtkWidget *startbuttonicon;
|
||||
GtkWidget *startbuttonlabel;
|
||||
GtkAccelGroup *accel_group;
|
||||
GtkWidget *startwin;
|
||||
GtkWidget *hlayout;
|
||||
GtkWidget *banner;
|
||||
GtkWidget *vlayout;
|
||||
GtkWidget *tabs;
|
||||
GtkWidget *configvlayout;
|
||||
GtkWidget *configlayout;
|
||||
GtkWidget *vmode3dlabel;
|
||||
GtkWidget *vmode3dcombo;
|
||||
GtkWidget *fullscreencheck;
|
||||
GtkWidget *alwaysshowcheck;
|
||||
GtkWidget *configtab;
|
||||
GtkWidget *messagesscroll;
|
||||
GtkWidget *messagestext;
|
||||
GtkWidget *messagestab;
|
||||
GtkWidget *buttons;
|
||||
GtkWidget *cancelbutton;
|
||||
GtkWidget *cancelbuttonalign;
|
||||
GtkWidget *cancelbuttonlayout;
|
||||
GtkWidget *cancelbuttonicon;
|
||||
GtkWidget *cancelbuttonlabel;
|
||||
GtkWidget *startbutton;
|
||||
GtkWidget *startbuttonalign;
|
||||
GtkWidget *startbuttonlayout;
|
||||
GtkWidget *startbuttonicon;
|
||||
GtkWidget *startbuttonlabel;
|
||||
GtkAccelGroup *accel_group;
|
||||
|
||||
accel_group = gtk_accel_group_new ();
|
||||
accel_group = gtk_accel_group_new();
|
||||
|
||||
// Basic window
|
||||
startwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (startwin), apptitle); // NOTE: use global app title
|
||||
gtk_window_set_position (GTK_WINDOW (startwin), GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_resizable (GTK_WINDOW (startwin), FALSE);
|
||||
gtk_window_set_type_hint (GTK_WINDOW (startwin), GDK_WINDOW_TYPE_HINT_DIALOG);
|
||||
// Basic window
|
||||
startwin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title(GTK_WINDOW(startwin), apptitle); // NOTE: use global app title
|
||||
gtk_window_set_position(GTK_WINDOW(startwin), GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_resizable(GTK_WINDOW(startwin), FALSE);
|
||||
gtk_window_set_type_hint(GTK_WINDOW(startwin), GDK_WINDOW_TYPE_HINT_DIALOG);
|
||||
|
||||
// Horizontal layout of banner and controls
|
||||
hlayout = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_show (hlayout);
|
||||
gtk_container_add (GTK_CONTAINER (startwin), hlayout);
|
||||
// Horizontal layout of banner and controls
|
||||
hlayout = gtk_hbox_new(FALSE, 0);
|
||||
gtk_widget_show(hlayout);
|
||||
gtk_container_add(GTK_CONTAINER(startwin), hlayout);
|
||||
|
||||
// Banner
|
||||
{
|
||||
GdkPixbuf *pixbuf = load_banner();
|
||||
banner = gtk_image_new_from_pixbuf(pixbuf);
|
||||
g_object_unref((gpointer)pixbuf);
|
||||
}
|
||||
gtk_widget_show (banner);
|
||||
gtk_box_pack_start (GTK_BOX (hlayout), banner, FALSE, FALSE, 0);
|
||||
gtk_misc_set_alignment (GTK_MISC (banner), 0.5, 0);
|
||||
// Banner
|
||||
{
|
||||
GdkPixbuf *pixbuf = load_banner();
|
||||
banner = gtk_image_new_from_pixbuf(pixbuf);
|
||||
g_object_unref((gpointer)pixbuf);
|
||||
}
|
||||
gtk_widget_show(banner);
|
||||
gtk_box_pack_start(GTK_BOX(hlayout), banner, FALSE, FALSE, 0);
|
||||
gtk_misc_set_alignment(GTK_MISC(banner), 0.5, 0);
|
||||
|
||||
// Vertical layout of tab control and start+cancel buttons
|
||||
vlayout = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_show (vlayout);
|
||||
gtk_box_pack_start (GTK_BOX (hlayout), vlayout, TRUE, TRUE, 0);
|
||||
// Vertical layout of tab control and start+cancel buttons
|
||||
vlayout = gtk_vbox_new(FALSE, 0);
|
||||
gtk_widget_show(vlayout);
|
||||
gtk_box_pack_start(GTK_BOX(hlayout), vlayout, TRUE, TRUE, 0);
|
||||
|
||||
// Tab control
|
||||
tabs = gtk_notebook_new ();
|
||||
gtk_widget_show (tabs);
|
||||
gtk_box_pack_start (GTK_BOX (vlayout), tabs, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (tabs), 4);
|
||||
// Tab control
|
||||
tabs = gtk_notebook_new();
|
||||
gtk_widget_show(tabs);
|
||||
gtk_box_pack_start(GTK_BOX(vlayout), tabs, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(tabs), 4);
|
||||
|
||||
// Vertical layout of config page main body
|
||||
configvlayout = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_show (configvlayout);
|
||||
gtk_container_add (GTK_CONTAINER (tabs), configvlayout);
|
||||
// Vertical layout of config page main body
|
||||
configvlayout = gtk_vbox_new(FALSE, 0);
|
||||
gtk_widget_show(configvlayout);
|
||||
gtk_container_add(GTK_CONTAINER(tabs), configvlayout);
|
||||
|
||||
// Fixed-position layout of config page controls
|
||||
configlayout = gtk_fixed_new ();
|
||||
gtk_widget_show (configlayout);
|
||||
gtk_box_pack_start (GTK_BOX (configvlayout), configlayout, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (configlayout), 6);
|
||||
// Fixed-position layout of config page controls
|
||||
configlayout = gtk_fixed_new();
|
||||
gtk_widget_show(configlayout);
|
||||
gtk_box_pack_start(GTK_BOX(configvlayout), configlayout, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(configlayout), 6);
|
||||
|
||||
// 3D video mode label
|
||||
vmode3dlabel = gtk_label_new_with_mnemonic ("_Video mode:");
|
||||
gtk_widget_show (vmode3dlabel);
|
||||
gtk_fixed_put (GTK_FIXED (configlayout), vmode3dlabel, 0, 0);
|
||||
gtk_widget_set_size_request (vmode3dlabel, 88, 29);
|
||||
gtk_misc_set_alignment (GTK_MISC (vmode3dlabel), 0, 0.5);
|
||||
// 3D video mode label
|
||||
vmode3dlabel = gtk_label_new_with_mnemonic("_Video mode:");
|
||||
gtk_widget_show(vmode3dlabel);
|
||||
gtk_fixed_put(GTK_FIXED(configlayout), vmode3dlabel, 0, 0);
|
||||
gtk_widget_set_size_request(vmode3dlabel, 88, 29);
|
||||
gtk_misc_set_alignment(GTK_MISC(vmode3dlabel), 0, 0.5);
|
||||
|
||||
// 3D video mode combo
|
||||
{
|
||||
GtkListStore *list = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
|
||||
GtkCellRenderer *cell;
|
||||
// 3D video mode combo
|
||||
{
|
||||
GtkListStore *list = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
|
||||
GtkCellRenderer *cell;
|
||||
|
||||
vmode3dcombo = gtk_combo_box_new_with_model (GTK_TREE_MODEL(list));
|
||||
g_object_unref(G_OBJECT(list));
|
||||
vmode3dcombo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(list));
|
||||
g_object_unref(G_OBJECT(list));
|
||||
|
||||
cell = gtk_cell_renderer_text_new();
|
||||
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(vmode3dcombo), cell, FALSE);
|
||||
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(vmode3dcombo), cell, "text", 0, NULL);
|
||||
}
|
||||
gtk_widget_show (vmode3dcombo);
|
||||
gtk_fixed_put (GTK_FIXED (configlayout), vmode3dcombo, 88, 0);
|
||||
gtk_widget_set_size_request (vmode3dcombo, 150, 29);
|
||||
gtk_widget_add_accelerator (vmode3dcombo, "grab_focus", accel_group,
|
||||
GDK_V, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
cell = gtk_cell_renderer_text_new();
|
||||
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(vmode3dcombo), cell, FALSE);
|
||||
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(vmode3dcombo), cell, "text", 0, NULL);
|
||||
}
|
||||
gtk_widget_show(vmode3dcombo);
|
||||
gtk_fixed_put(GTK_FIXED(configlayout), vmode3dcombo, 88, 0);
|
||||
gtk_widget_set_size_request(vmode3dcombo, 150, 29);
|
||||
gtk_widget_add_accelerator(vmode3dcombo, "grab_focus", accel_group,
|
||||
GDK_V, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
// Fullscreen checkbox
|
||||
fullscreencheck = gtk_check_button_new_with_mnemonic ("_Fullscreen");
|
||||
gtk_widget_show (fullscreencheck);
|
||||
gtk_fixed_put (GTK_FIXED (configlayout), fullscreencheck, 248, 0);
|
||||
gtk_widget_set_size_request (fullscreencheck, 85, 29);
|
||||
gtk_widget_add_accelerator (fullscreencheck, "grab_focus", accel_group,
|
||||
GDK_F, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
// Fullscreen checkbox
|
||||
fullscreencheck = gtk_check_button_new_with_mnemonic("_Fullscreen");
|
||||
gtk_widget_show(fullscreencheck);
|
||||
gtk_fixed_put(GTK_FIXED(configlayout), fullscreencheck, 248, 0);
|
||||
gtk_widget_set_size_request(fullscreencheck, 85, 29);
|
||||
gtk_widget_add_accelerator(fullscreencheck, "grab_focus", accel_group,
|
||||
GDK_F, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
// Always show config checkbox
|
||||
alwaysshowcheck = gtk_check_button_new_with_mnemonic ("_Always show configuration on start");
|
||||
gtk_widget_show (alwaysshowcheck);
|
||||
gtk_box_pack_start (GTK_BOX (configvlayout), alwaysshowcheck, FALSE, FALSE, 0);
|
||||
gtk_widget_add_accelerator (alwaysshowcheck, "grab_focus", accel_group,
|
||||
GDK_A, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
// Always show config checkbox
|
||||
alwaysshowcheck = gtk_check_button_new_with_mnemonic("_Always show configuration on start");
|
||||
gtk_widget_show(alwaysshowcheck);
|
||||
gtk_box_pack_start(GTK_BOX(configvlayout), alwaysshowcheck, FALSE, FALSE, 0);
|
||||
gtk_widget_add_accelerator(alwaysshowcheck, "grab_focus", accel_group,
|
||||
GDK_A, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
// Configuration tab
|
||||
configtab = gtk_label_new ("Configuration");
|
||||
gtk_widget_show (configtab);
|
||||
gtk_notebook_set_tab_label (GTK_NOTEBOOK (tabs), gtk_notebook_get_nth_page (GTK_NOTEBOOK (tabs), 0), configtab);
|
||||
// Configuration tab
|
||||
configtab = gtk_label_new("Configuration");
|
||||
gtk_widget_show(configtab);
|
||||
gtk_notebook_set_tab_label(GTK_NOTEBOOK(tabs), gtk_notebook_get_nth_page(GTK_NOTEBOOK(tabs), 0), configtab);
|
||||
|
||||
// Messages scrollable area
|
||||
messagesscroll = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (messagesscroll);
|
||||
gtk_container_add (GTK_CONTAINER (tabs), messagesscroll);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (messagesscroll), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
|
||||
// Messages scrollable area
|
||||
messagesscroll = gtk_scrolled_window_new(NULL, NULL);
|
||||
gtk_widget_show(messagesscroll);
|
||||
gtk_container_add(GTK_CONTAINER(tabs), messagesscroll);
|
||||
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(messagesscroll), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
|
||||
|
||||
// Messages text area
|
||||
messagestext = gtk_text_view_new ();
|
||||
gtk_widget_show (messagestext);
|
||||
gtk_container_add (GTK_CONTAINER (messagesscroll), messagestext);
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (messagestext), FALSE);
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (messagestext), GTK_WRAP_WORD);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (messagestext), FALSE);
|
||||
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (messagestext), 2);
|
||||
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (messagestext), 2);
|
||||
// Messages text area
|
||||
messagestext = gtk_text_view_new();
|
||||
gtk_widget_show(messagestext);
|
||||
gtk_container_add(GTK_CONTAINER(messagesscroll), messagestext);
|
||||
gtk_text_view_set_editable(GTK_TEXT_VIEW(messagestext), FALSE);
|
||||
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(messagestext), GTK_WRAP_WORD);
|
||||
gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(messagestext), FALSE);
|
||||
gtk_text_view_set_left_margin(GTK_TEXT_VIEW(messagestext), 2);
|
||||
gtk_text_view_set_right_margin(GTK_TEXT_VIEW(messagestext), 2);
|
||||
|
||||
// Messages tab
|
||||
messagestab = gtk_label_new ("Messages");
|
||||
gtk_widget_show (messagestab);
|
||||
gtk_notebook_set_tab_label (GTK_NOTEBOOK (tabs), gtk_notebook_get_nth_page (GTK_NOTEBOOK (tabs), 1), messagestab);
|
||||
// Messages tab
|
||||
messagestab = gtk_label_new("Messages");
|
||||
gtk_widget_show(messagestab);
|
||||
gtk_notebook_set_tab_label(GTK_NOTEBOOK(tabs), gtk_notebook_get_nth_page(GTK_NOTEBOOK(tabs), 1), messagestab);
|
||||
|
||||
// Dialogue box buttons layout
|
||||
buttons = gtk_hbutton_box_new ();
|
||||
gtk_widget_show (buttons);
|
||||
gtk_box_pack_start (GTK_BOX (vlayout), buttons, FALSE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (buttons), 3);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (buttons), GTK_BUTTONBOX_END);
|
||||
// Dialogue box buttons layout
|
||||
buttons = gtk_hbutton_box_new();
|
||||
gtk_widget_show(buttons);
|
||||
gtk_box_pack_start(GTK_BOX(vlayout), buttons, FALSE, TRUE, 0);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(buttons), 3);
|
||||
gtk_button_box_set_layout(GTK_BUTTON_BOX(buttons), GTK_BUTTONBOX_END);
|
||||
|
||||
// Cancel button
|
||||
cancelbutton = gtk_button_new ();
|
||||
gtk_widget_show (cancelbutton);
|
||||
gtk_container_add (GTK_CONTAINER (buttons), cancelbutton);
|
||||
GTK_WIDGET_SET_FLAGS (cancelbutton, GTK_CAN_DEFAULT);
|
||||
gtk_widget_add_accelerator (cancelbutton, "grab_focus", accel_group,
|
||||
GDK_C, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
gtk_widget_add_accelerator (cancelbutton, "clicked", accel_group,
|
||||
GDK_Escape, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
// Cancel button
|
||||
cancelbutton = gtk_button_new();
|
||||
gtk_widget_show(cancelbutton);
|
||||
gtk_container_add(GTK_CONTAINER(buttons), cancelbutton);
|
||||
GTK_WIDGET_SET_FLAGS(cancelbutton, GTK_CAN_DEFAULT);
|
||||
gtk_widget_add_accelerator(cancelbutton, "grab_focus", accel_group,
|
||||
GDK_C, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
gtk_widget_add_accelerator(cancelbutton, "clicked", accel_group,
|
||||
GDK_Escape, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
cancelbuttonalign = gtk_alignment_new (0.5, 0.5, 0, 0);
|
||||
gtk_widget_show (cancelbuttonalign);
|
||||
gtk_container_add (GTK_CONTAINER (cancelbutton), cancelbuttonalign);
|
||||
cancelbuttonalign = gtk_alignment_new(0.5, 0.5, 0, 0);
|
||||
gtk_widget_show(cancelbuttonalign);
|
||||
gtk_container_add(GTK_CONTAINER(cancelbutton), cancelbuttonalign);
|
||||
|
||||
cancelbuttonlayout = gtk_hbox_new (FALSE, 2);
|
||||
gtk_widget_show (cancelbuttonlayout);
|
||||
gtk_container_add (GTK_CONTAINER (cancelbuttonalign), cancelbuttonlayout);
|
||||
cancelbuttonlayout = gtk_hbox_new(FALSE, 2);
|
||||
gtk_widget_show(cancelbuttonlayout);
|
||||
gtk_container_add(GTK_CONTAINER(cancelbuttonalign), cancelbuttonlayout);
|
||||
|
||||
cancelbuttonicon = gtk_image_new_from_stock ("gtk-cancel", GTK_ICON_SIZE_BUTTON);
|
||||
gtk_widget_show (cancelbuttonicon);
|
||||
gtk_box_pack_start (GTK_BOX (cancelbuttonlayout), cancelbuttonicon, FALSE, FALSE, 0);
|
||||
cancelbuttonicon = gtk_image_new_from_stock("gtk-cancel", GTK_ICON_SIZE_BUTTON);
|
||||
gtk_widget_show(cancelbuttonicon);
|
||||
gtk_box_pack_start(GTK_BOX(cancelbuttonlayout), cancelbuttonicon, FALSE, FALSE, 0);
|
||||
|
||||
cancelbuttonlabel = gtk_label_new_with_mnemonic ("_Cancel");
|
||||
gtk_widget_show (cancelbuttonlabel);
|
||||
gtk_box_pack_start (GTK_BOX (cancelbuttonlayout), cancelbuttonlabel, FALSE, FALSE, 0);
|
||||
cancelbuttonlabel = gtk_label_new_with_mnemonic("_Cancel");
|
||||
gtk_widget_show(cancelbuttonlabel);
|
||||
gtk_box_pack_start(GTK_BOX(cancelbuttonlayout), cancelbuttonlabel, FALSE, FALSE, 0);
|
||||
|
||||
// Start button
|
||||
startbutton = gtk_button_new ();
|
||||
gtk_widget_show (startbutton);
|
||||
gtk_container_add (GTK_CONTAINER (buttons), startbutton);
|
||||
GTK_WIDGET_SET_FLAGS (startbutton, GTK_CAN_DEFAULT);
|
||||
gtk_widget_add_accelerator (startbutton, "grab_focus", accel_group,
|
||||
GDK_S, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
gtk_widget_add_accelerator (startbutton, "clicked", accel_group,
|
||||
GDK_Return, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
// Start button
|
||||
startbutton = gtk_button_new();
|
||||
gtk_widget_show(startbutton);
|
||||
gtk_container_add(GTK_CONTAINER(buttons), startbutton);
|
||||
GTK_WIDGET_SET_FLAGS(startbutton, GTK_CAN_DEFAULT);
|
||||
gtk_widget_add_accelerator(startbutton, "grab_focus", accel_group,
|
||||
GDK_S, GDK_MOD1_MASK,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
gtk_widget_add_accelerator(startbutton, "clicked", accel_group,
|
||||
GDK_Return, 0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
|
||||
startbuttonalign = gtk_alignment_new (0.5, 0.5, 0, 0);
|
||||
gtk_widget_show (startbuttonalign);
|
||||
gtk_container_add (GTK_CONTAINER (startbutton), startbuttonalign);
|
||||
startbuttonalign = gtk_alignment_new(0.5, 0.5, 0, 0);
|
||||
gtk_widget_show(startbuttonalign);
|
||||
gtk_container_add(GTK_CONTAINER(startbutton), startbuttonalign);
|
||||
|
||||
startbuttonlayout = gtk_hbox_new (FALSE, 2);
|
||||
gtk_widget_show (startbuttonlayout);
|
||||
gtk_container_add (GTK_CONTAINER (startbuttonalign), startbuttonlayout);
|
||||
startbuttonlayout = gtk_hbox_new(FALSE, 2);
|
||||
gtk_widget_show(startbuttonlayout);
|
||||
gtk_container_add(GTK_CONTAINER(startbuttonalign), startbuttonlayout);
|
||||
|
||||
startbuttonicon = gtk_image_new_from_stock ("gtk-execute", GTK_ICON_SIZE_BUTTON);
|
||||
gtk_widget_show (startbuttonicon);
|
||||
gtk_box_pack_start (GTK_BOX (startbuttonlayout), startbuttonicon, FALSE, FALSE, 0);
|
||||
startbuttonicon = gtk_image_new_from_stock("gtk-execute", GTK_ICON_SIZE_BUTTON);
|
||||
gtk_widget_show(startbuttonicon);
|
||||
gtk_box_pack_start(GTK_BOX(startbuttonlayout), startbuttonicon, FALSE, FALSE, 0);
|
||||
|
||||
startbuttonlabel = gtk_label_new_with_mnemonic ("_Start");
|
||||
gtk_widget_show (startbuttonlabel);
|
||||
gtk_box_pack_start (GTK_BOX (startbuttonlayout), startbuttonlabel, FALSE, FALSE, 0);
|
||||
startbuttonlabel = gtk_label_new_with_mnemonic("_Start");
|
||||
gtk_widget_show(startbuttonlabel);
|
||||
gtk_box_pack_start(GTK_BOX(startbuttonlayout), startbuttonlabel, FALSE, FALSE, 0);
|
||||
|
||||
// Wire up the signals
|
||||
g_signal_connect ((gpointer) startwin, "delete_event",
|
||||
G_CALLBACK (on_startwin_delete_event),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) vmode3dcombo, "changed",
|
||||
G_CALLBACK (on_vmode3dcombo_changed),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) fullscreencheck, "toggled",
|
||||
G_CALLBACK (on_fullscreencheck_toggled),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) alwaysshowcheck, "toggled",
|
||||
G_CALLBACK (on_alwaysshowcheck_toggled),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) cancelbutton, "clicked",
|
||||
G_CALLBACK (on_cancelbutton_clicked),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) startbutton, "clicked",
|
||||
G_CALLBACK (on_startbutton_clicked),
|
||||
NULL);
|
||||
// Wire up the signals
|
||||
g_signal_connect((gpointer) startwin, "delete_event",
|
||||
G_CALLBACK(on_startwin_delete_event),
|
||||
NULL);
|
||||
g_signal_connect((gpointer) vmode3dcombo, "changed",
|
||||
G_CALLBACK(on_vmode3dcombo_changed),
|
||||
NULL);
|
||||
g_signal_connect((gpointer) fullscreencheck, "toggled",
|
||||
G_CALLBACK(on_fullscreencheck_toggled),
|
||||
NULL);
|
||||
g_signal_connect((gpointer) alwaysshowcheck, "toggled",
|
||||
G_CALLBACK(on_alwaysshowcheck_toggled),
|
||||
NULL);
|
||||
g_signal_connect((gpointer) cancelbutton, "clicked",
|
||||
G_CALLBACK(on_cancelbutton_clicked),
|
||||
NULL);
|
||||
g_signal_connect((gpointer) startbutton, "clicked",
|
||||
G_CALLBACK(on_startbutton_clicked),
|
||||
NULL);
|
||||
|
||||
// Associate labels with their controls
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (vmode3dlabel), vmode3dcombo);
|
||||
// Associate labels with their controls
|
||||
gtk_label_set_mnemonic_widget(GTK_LABEL(vmode3dlabel), vmode3dcombo);
|
||||
|
||||
/* Store pointers to all widgets, for use by lookup_widget(). */
|
||||
GLADE_HOOKUP_OBJECT_NO_REF (startwin, startwin, "startwin");
|
||||
GLADE_HOOKUP_OBJECT (startwin, hlayout, "hlayout");
|
||||
GLADE_HOOKUP_OBJECT (startwin, banner, "banner");
|
||||
GLADE_HOOKUP_OBJECT (startwin, vlayout, "vlayout");
|
||||
GLADE_HOOKUP_OBJECT (startwin, tabs, "tabs");
|
||||
GLADE_HOOKUP_OBJECT (startwin, configvlayout, "configvlayout");
|
||||
GLADE_HOOKUP_OBJECT (startwin, configlayout, "configlayout");
|
||||
GLADE_HOOKUP_OBJECT (startwin, vmode3dlabel, "vmode3dlabel");
|
||||
GLADE_HOOKUP_OBJECT (startwin, vmode3dcombo, "vmode3dcombo");
|
||||
GLADE_HOOKUP_OBJECT (startwin, fullscreencheck, "fullscreencheck");
|
||||
GLADE_HOOKUP_OBJECT (startwin, alwaysshowcheck, "alwaysshowcheck");
|
||||
GLADE_HOOKUP_OBJECT (startwin, configtab, "configtab");
|
||||
GLADE_HOOKUP_OBJECT (startwin, messagesscroll, "messagesscroll");
|
||||
GLADE_HOOKUP_OBJECT (startwin, messagestext, "messagestext");
|
||||
GLADE_HOOKUP_OBJECT (startwin, messagestab, "messagestab");
|
||||
GLADE_HOOKUP_OBJECT (startwin, buttons, "buttons");
|
||||
GLADE_HOOKUP_OBJECT (startwin, cancelbutton, "cancelbutton");
|
||||
GLADE_HOOKUP_OBJECT (startwin, cancelbuttonalign, "cancelbuttonalign");
|
||||
GLADE_HOOKUP_OBJECT (startwin, cancelbuttonlayout, "cancelbuttonlayout");
|
||||
GLADE_HOOKUP_OBJECT (startwin, cancelbuttonicon, "cancelbuttonicon");
|
||||
GLADE_HOOKUP_OBJECT (startwin, cancelbuttonlabel, "cancelbuttonlabel");
|
||||
GLADE_HOOKUP_OBJECT (startwin, startbutton, "startbutton");
|
||||
GLADE_HOOKUP_OBJECT (startwin, startbuttonalign, "startbuttonalign");
|
||||
GLADE_HOOKUP_OBJECT (startwin, startbuttonlayout, "startbuttonlayout");
|
||||
GLADE_HOOKUP_OBJECT (startwin, startbuttonicon, "startbuttonicon");
|
||||
GLADE_HOOKUP_OBJECT (startwin, startbuttonlabel, "startbuttonlabel");
|
||||
/* Store pointers to all widgets, for use by lookup_widget(). */
|
||||
GLADE_HOOKUP_OBJECT_NO_REF(startwin, startwin, "startwin");
|
||||
GLADE_HOOKUP_OBJECT(startwin, hlayout, "hlayout");
|
||||
GLADE_HOOKUP_OBJECT(startwin, banner, "banner");
|
||||
GLADE_HOOKUP_OBJECT(startwin, vlayout, "vlayout");
|
||||
GLADE_HOOKUP_OBJECT(startwin, tabs, "tabs");
|
||||
GLADE_HOOKUP_OBJECT(startwin, configvlayout, "configvlayout");
|
||||
GLADE_HOOKUP_OBJECT(startwin, configlayout, "configlayout");
|
||||
GLADE_HOOKUP_OBJECT(startwin, vmode3dlabel, "vmode3dlabel");
|
||||
GLADE_HOOKUP_OBJECT(startwin, vmode3dcombo, "vmode3dcombo");
|
||||
GLADE_HOOKUP_OBJECT(startwin, fullscreencheck, "fullscreencheck");
|
||||
GLADE_HOOKUP_OBJECT(startwin, alwaysshowcheck, "alwaysshowcheck");
|
||||
GLADE_HOOKUP_OBJECT(startwin, configtab, "configtab");
|
||||
GLADE_HOOKUP_OBJECT(startwin, messagesscroll, "messagesscroll");
|
||||
GLADE_HOOKUP_OBJECT(startwin, messagestext, "messagestext");
|
||||
GLADE_HOOKUP_OBJECT(startwin, messagestab, "messagestab");
|
||||
GLADE_HOOKUP_OBJECT(startwin, buttons, "buttons");
|
||||
GLADE_HOOKUP_OBJECT(startwin, cancelbutton, "cancelbutton");
|
||||
GLADE_HOOKUP_OBJECT(startwin, cancelbuttonalign, "cancelbuttonalign");
|
||||
GLADE_HOOKUP_OBJECT(startwin, cancelbuttonlayout, "cancelbuttonlayout");
|
||||
GLADE_HOOKUP_OBJECT(startwin, cancelbuttonicon, "cancelbuttonicon");
|
||||
GLADE_HOOKUP_OBJECT(startwin, cancelbuttonlabel, "cancelbuttonlabel");
|
||||
GLADE_HOOKUP_OBJECT(startwin, startbutton, "startbutton");
|
||||
GLADE_HOOKUP_OBJECT(startwin, startbuttonalign, "startbuttonalign");
|
||||
GLADE_HOOKUP_OBJECT(startwin, startbuttonlayout, "startbuttonlayout");
|
||||
GLADE_HOOKUP_OBJECT(startwin, startbuttonicon, "startbuttonicon");
|
||||
GLADE_HOOKUP_OBJECT(startwin, startbuttonlabel, "startbuttonlabel");
|
||||
|
||||
gtk_window_add_accel_group (GTK_WINDOW (startwin), accel_group);
|
||||
gtk_window_add_accel_group(GTK_WINDOW(startwin), accel_group);
|
||||
|
||||
return startwin;
|
||||
return startwin;
|
||||
}
|
||||
|
||||
// -- BUILD ENTRY POINTS ------------------------------------------------------
|
||||
|
@ -428,7 +433,8 @@ int startwin_open(void)
|
|||
if (startwin) return 1;
|
||||
|
||||
startwin = create_window();
|
||||
if (startwin) {
|
||||
if (startwin)
|
||||
{
|
||||
SetPage(TAB_MESSAGES);
|
||||
gtk_widget_show(startwin);
|
||||
gtk_main_iteration_do(FALSE);
|
||||
|
@ -441,7 +447,7 @@ int startwin_close(void)
|
|||
{
|
||||
if (!gtkenabled) return 0;
|
||||
if (!startwin) return 1;
|
||||
gtk_widget_destroy (startwin);
|
||||
gtk_widget_destroy(startwin);
|
||||
startwin = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
@ -460,33 +466,35 @@ int startwin_puts(const char *str)
|
|||
textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
|
||||
|
||||
gtk_text_buffer_get_end_iter(textbuffer, &enditer);
|
||||
for (aptr = bptr = str; *aptr != 0; ) {
|
||||
switch (*bptr) {
|
||||
case '\b':
|
||||
if (bptr > aptr)
|
||||
gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)-1);
|
||||
for (aptr = bptr = str; *aptr != 0; )
|
||||
{
|
||||
switch (*bptr)
|
||||
{
|
||||
case '\b':
|
||||
if (bptr > aptr)
|
||||
gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)-1);
|
||||
#if GTK_CHECK_VERSION(2,6,0)
|
||||
gtk_text_buffer_backspace(textbuffer, &enditer, FALSE, TRUE);
|
||||
gtk_text_buffer_backspace(textbuffer, &enditer, FALSE, TRUE);
|
||||
#else
|
||||
{
|
||||
{
|
||||
GtkTextIter iter2 = enditer;
|
||||
gtk_text_iter_backward_cursor_position(&iter2);
|
||||
//FIXME: this seems be deleting one too many chars somewhere!
|
||||
if (!gtk_text_iter_equal(&iter2, &enditer))
|
||||
gtk_text_buffer_delete_interactive(textbuffer, &iter2, &enditer, TRUE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
aptr = ++bptr;
|
||||
break;
|
||||
case 0:
|
||||
if (bptr > aptr)
|
||||
gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr));
|
||||
aptr = bptr;
|
||||
break;
|
||||
case '\r': // FIXME
|
||||
default:
|
||||
bptr++;
|
||||
break;
|
||||
aptr = ++bptr;
|
||||
break;
|
||||
case 0:
|
||||
if (bptr > aptr)
|
||||
gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr));
|
||||
aptr = bptr;
|
||||
break;
|
||||
case '\r': // FIXME
|
||||
default:
|
||||
bptr++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -501,7 +509,7 @@ int startwin_settitle(const char *title)
|
|||
{
|
||||
if (!gtkenabled) return 0;
|
||||
if (!startwin) return 1;
|
||||
gtk_window_set_title (GTK_WINDOW (startwin), title);
|
||||
gtk_window_set_title(GTK_WINDOW(startwin), title);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -509,7 +517,7 @@ int startwin_idle(void *s)
|
|||
{
|
||||
if (!gtkenabled) return 0;
|
||||
//if (!startwin) return 1;
|
||||
gtk_main_iteration_do (FALSE);
|
||||
gtk_main_iteration_do(FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -532,7 +540,8 @@ int startwin_run(void)
|
|||
gtk_main();
|
||||
|
||||
SetPage(TAB_MESSAGES);
|
||||
if (retval) {
|
||||
if (retval)
|
||||
{
|
||||
fullscreen = settings.fullscreen;
|
||||
xdimgame = settings.xdim3d;
|
||||
ydimgame = settings.ydim3d;
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
#define TAB_CONFIG 0
|
||||
#define TAB_MESSAGES 1
|
||||
|
||||
static struct {
|
||||
static struct
|
||||
{
|
||||
int fullscreen;
|
||||
int xdim3d, ydim3d, bpp3d;
|
||||
int forcesetup;
|
||||
|
@ -38,10 +39,12 @@ static void PopulateForm(void)
|
|||
hwnd3d = GetDlgItem(pages[TAB_CONFIG], IDC3DVMODE);
|
||||
|
||||
mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1);
|
||||
if (mode3d < 0) {
|
||||
if (mode3d < 0)
|
||||
{
|
||||
int cd[] = { 32, 24, 16, 15, 8, 0 };
|
||||
for (i=0; cd[i]; ) { if (cd[i] >= settings.bpp3d) i++; else break; }
|
||||
for ( ; cd[i]; i++) {
|
||||
for (; cd[i]; i++)
|
||||
{
|
||||
mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1);
|
||||
if (mode3d < 0) continue;
|
||||
settings.bpp3d = cd[i];
|
||||
|
@ -53,7 +56,8 @@ static void PopulateForm(void)
|
|||
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCALWAYSSHOW), (settings.forcesetup ? BST_CHECKED : BST_UNCHECKED));
|
||||
|
||||
ComboBox_ResetContent(hwnd3d);
|
||||
for (i=0; i<validmodecnt; i++) {
|
||||
for (i=0; i<validmodecnt; i++)
|
||||
{
|
||||
if (validmode[i].fs != settings.fullscreen) continue;
|
||||
|
||||
// all modes get added to the 3D mode list
|
||||
|
@ -66,32 +70,36 @@ static void PopulateForm(void)
|
|||
|
||||
static INT_PTR CALLBACK ConfigPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (uMsg) {
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDCFULLSCREEN:
|
||||
settings.fullscreen = !settings.fullscreen;
|
||||
PopulateForm();
|
||||
return TRUE;
|
||||
case IDC3DVMODE:
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE) {
|
||||
int i;
|
||||
i = ComboBox_GetCurSel((HWND)lParam);
|
||||
if (i != CB_ERR) i = ComboBox_GetItemData((HWND)lParam, i);
|
||||
if (i != CB_ERR) {
|
||||
settings.xdim3d = validmode[i].xdim;
|
||||
settings.ydim3d = validmode[i].ydim;
|
||||
settings.bpp3d = validmode[i].bpp;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
case IDCALWAYSSHOW:
|
||||
settings.forcesetup = IsDlgButtonChecked(hwndDlg, IDCALWAYSSHOW) == BST_CHECKED;
|
||||
return TRUE;
|
||||
default: break;
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDCFULLSCREEN:
|
||||
settings.fullscreen = !settings.fullscreen;
|
||||
PopulateForm();
|
||||
return TRUE;
|
||||
case IDC3DVMODE:
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE)
|
||||
{
|
||||
int i;
|
||||
i = ComboBox_GetCurSel((HWND)lParam);
|
||||
if (i != CB_ERR) i = ComboBox_GetItemData((HWND)lParam, i);
|
||||
if (i != CB_ERR)
|
||||
{
|
||||
settings.xdim3d = validmode[i].xdim;
|
||||
settings.ydim3d = validmode[i].ydim;
|
||||
settings.bpp3d = validmode[i].bpp;
|
||||
}
|
||||
}
|
||||
break;
|
||||
return TRUE;
|
||||
case IDCALWAYSSHOW:
|
||||
settings.forcesetup = IsDlgButtonChecked(hwndDlg, IDCALWAYSSHOW) == BST_CHECKED;
|
||||
return TRUE;
|
||||
default: break;
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -125,162 +133,171 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
|
|||
static HBITMAP hbmp = NULL;
|
||||
HDC hdc;
|
||||
|
||||
switch (uMsg) {
|
||||
case WM_INITDIALOG: {
|
||||
HWND hwnd;
|
||||
RECT r, rdlg, chrome, rtab, rcancel, rstart;
|
||||
int xoffset = 0, yoffset = 0;
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
HWND hwnd;
|
||||
RECT r, rdlg, chrome, rtab, rcancel, rstart;
|
||||
int xoffset = 0, yoffset = 0;
|
||||
|
||||
// Fetch the positions (in screen coordinates) of all the windows we need to tweak
|
||||
ZeroMemory(&chrome, sizeof(chrome));
|
||||
AdjustWindowRect(&chrome, GetWindowLong(hwndDlg, GWL_STYLE), FALSE);
|
||||
GetWindowRect(hwndDlg, &rdlg);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), &rtab);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), &rcancel);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_START), &rstart);
|
||||
// Fetch the positions (in screen coordinates) of all the windows we need to tweak
|
||||
ZeroMemory(&chrome, sizeof(chrome));
|
||||
AdjustWindowRect(&chrome, GetWindowLong(hwndDlg, GWL_STYLE), FALSE);
|
||||
GetWindowRect(hwndDlg, &rdlg);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), &rtab);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), &rcancel);
|
||||
GetWindowRect(GetDlgItem(hwndDlg, WIN_STARTWIN_START), &rstart);
|
||||
|
||||
// Knock off the non-client area of the main dialogue to give just the client area
|
||||
rdlg.left -= chrome.left; rdlg.top -= chrome.top;
|
||||
rdlg.right -= chrome.right; rdlg.bottom -= chrome.bottom;
|
||||
// Knock off the non-client area of the main dialogue to give just the client area
|
||||
rdlg.left -= chrome.left; rdlg.top -= chrome.top;
|
||||
rdlg.right -= chrome.right; rdlg.bottom -= chrome.bottom;
|
||||
|
||||
// Translate them to client-relative coordinates wrt the main dialogue window
|
||||
rtab.right -= rtab.left - 1; rtab.bottom -= rtab.top - 1;
|
||||
rtab.left -= rdlg.left; rtab.top -= rdlg.top;
|
||||
// Translate them to client-relative coordinates wrt the main dialogue window
|
||||
rtab.right -= rtab.left - 1; rtab.bottom -= rtab.top - 1;
|
||||
rtab.left -= rdlg.left; rtab.top -= rdlg.top;
|
||||
|
||||
rcancel.right -= rcancel.left - 1; rcancel.bottom -= rcancel.top - 1;
|
||||
rcancel.left -= rdlg.left; rcancel.top -= rdlg.top;
|
||||
rcancel.right -= rcancel.left - 1; rcancel.bottom -= rcancel.top - 1;
|
||||
rcancel.left -= rdlg.left; rcancel.top -= rdlg.top;
|
||||
|
||||
rstart.right -= rstart.left - 1; rstart.bottom -= rstart.top - 1;
|
||||
rstart.left -= rdlg.left; rstart.top -= rdlg.top;
|
||||
rstart.right -= rstart.left - 1; rstart.bottom -= rstart.top - 1;
|
||||
rstart.left -= rdlg.left; rstart.top -= rdlg.top;
|
||||
|
||||
// And then convert the main dialogue coordinates to just width/length
|
||||
rdlg.right -= rdlg.left - 1; rdlg.bottom -= rdlg.top - 1;
|
||||
rdlg.left = 0; rdlg.top = 0;
|
||||
// And then convert the main dialogue coordinates to just width/length
|
||||
rdlg.right -= rdlg.left - 1; rdlg.bottom -= rdlg.top - 1;
|
||||
rdlg.left = 0; rdlg.top = 0;
|
||||
|
||||
// Load the bitmap into the bitmap control and fetch its dimensions
|
||||
hbmp = LoadBitmap((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(RSRC_BMP));
|
||||
hwnd = GetDlgItem(hwndDlg,WIN_STARTWIN_BITMAP);
|
||||
SendMessage(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbmp);
|
||||
// Load the bitmap into the bitmap control and fetch its dimensions
|
||||
hbmp = LoadBitmap((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(RSRC_BMP));
|
||||
hwnd = GetDlgItem(hwndDlg,WIN_STARTWIN_BITMAP);
|
||||
SendMessage(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbmp);
|
||||
GetClientRect(hwnd, &r);
|
||||
xoffset = r.right;
|
||||
yoffset = r.bottom - rdlg.bottom;
|
||||
|
||||
// Shift and resize the controls that require it
|
||||
rtab.left += xoffset; rtab.bottom += yoffset;
|
||||
rcancel.left += xoffset; rcancel.top += yoffset;
|
||||
rstart.left += xoffset; rstart.top += yoffset;
|
||||
rdlg.right += xoffset;
|
||||
rdlg.bottom += yoffset;
|
||||
|
||||
// Move the controls to their new positions
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), rtab.left, rtab.top, rtab.right, rtab.bottom, FALSE);
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), rcancel.left, rcancel.top, rcancel.right, rcancel.bottom, FALSE);
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_START), rstart.left, rstart.top, rstart.right, rstart.bottom, FALSE);
|
||||
|
||||
// Move the main dialogue to the centre of the screen
|
||||
hdc = GetDC(NULL);
|
||||
rdlg.left = (GetDeviceCaps(hdc, HORZRES) - rdlg.right) / 2;
|
||||
rdlg.top = (GetDeviceCaps(hdc, VERTRES) - rdlg.bottom) / 2;
|
||||
ReleaseDC(NULL, hdc);
|
||||
MoveWindow(hwndDlg, rdlg.left + chrome.left, rdlg.top + chrome.left,
|
||||
rdlg.right + (-chrome.left+chrome.right), rdlg.bottom + (-chrome.top+chrome.bottom), TRUE);
|
||||
|
||||
// Add tabs to the tab control
|
||||
{
|
||||
TCITEM tab;
|
||||
|
||||
hwnd = GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL);
|
||||
|
||||
ZeroMemory(&tab, sizeof(tab));
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = TEXT("Configuration");
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)0, (LPARAM)&tab);
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = TEXT("Messages");
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)1, (LPARAM)&tab);
|
||||
|
||||
// Work out the position and size of the area inside the tab control for the pages
|
||||
ZeroMemory(&r, sizeof(r));
|
||||
GetClientRect(hwnd, &r);
|
||||
xoffset = r.right;
|
||||
yoffset = r.bottom - rdlg.bottom;
|
||||
SendMessage(hwnd, TCM_ADJUSTRECT, FALSE, (LPARAM)&r);
|
||||
r.right -= r.left-1;
|
||||
r.bottom -= r.top-1;
|
||||
r.top += rtab.top;
|
||||
r.left += rtab.left;
|
||||
|
||||
// Shift and resize the controls that require it
|
||||
rtab.left += xoffset; rtab.bottom += yoffset;
|
||||
rcancel.left += xoffset; rcancel.top += yoffset;
|
||||
rstart.left += xoffset; rstart.top += yoffset;
|
||||
rdlg.right += xoffset;
|
||||
rdlg.bottom += yoffset;
|
||||
// Create the pages and position them in the tab control, but hide them
|
||||
pages[TAB_CONFIG] = CreateDialog((HINSTANCE)win_gethinstance(),
|
||||
MAKEINTRESOURCE(WIN_STARTWINPAGE_CONFIG), hwndDlg, ConfigPageProc);
|
||||
pages[TAB_MESSAGES] = GetDlgItem(hwndDlg, WIN_STARTWIN_MESSAGES);
|
||||
SetWindowPos(pages[TAB_CONFIG], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);
|
||||
SetWindowPos(pages[TAB_MESSAGES], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);
|
||||
|
||||
// Move the controls to their new positions
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL), rtab.left, rtab.top, rtab.right, rtab.bottom, FALSE);
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_CANCEL), rcancel.left, rcancel.top, rcancel.right, rcancel.bottom, FALSE);
|
||||
MoveWindow(GetDlgItem(hwndDlg, WIN_STARTWIN_START), rstart.left, rstart.top, rstart.right, rstart.bottom, FALSE);
|
||||
// Tell the editfield acting as the console to exclude the width of the scrollbar
|
||||
GetClientRect(pages[TAB_MESSAGES],&r);
|
||||
r.right -= GetSystemMetrics(SM_CXVSCROLL)+4;
|
||||
r.left = r.top = 0;
|
||||
SendMessage(pages[TAB_MESSAGES], EM_SETRECTNP,0,(LPARAM)&r);
|
||||
|
||||
// Move the main dialogue to the centre of the screen
|
||||
hdc = GetDC(NULL);
|
||||
rdlg.left = (GetDeviceCaps(hdc, HORZRES) - rdlg.right) / 2;
|
||||
rdlg.top = (GetDeviceCaps(hdc, VERTRES) - rdlg.bottom) / 2;
|
||||
ReleaseDC(NULL, hdc);
|
||||
MoveWindow(hwndDlg, rdlg.left + chrome.left, rdlg.top + chrome.left,
|
||||
rdlg.right + (-chrome.left+chrome.right), rdlg.bottom + (-chrome.top+chrome.bottom), TRUE);
|
||||
SetFocus(GetDlgItem(hwndDlg, WIN_STARTWIN_START));
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Add tabs to the tab control
|
||||
{
|
||||
TCITEM tab;
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
LPNMHDR nmhdr = (LPNMHDR)lParam;
|
||||
int cur;
|
||||
if (nmhdr->idFrom != WIN_STARTWIN_TABCTL) break;
|
||||
cur = (int)SendMessage(nmhdr->hwndFrom, TCM_GETCURSEL,0,0);
|
||||
switch (nmhdr->code)
|
||||
{
|
||||
case TCN_SELCHANGING:
|
||||
{
|
||||
if (cur < 0 || !pages[cur]) break;
|
||||
ShowWindow(pages[cur],SW_HIDE);
|
||||
return TRUE;
|
||||
}
|
||||
case TCN_SELCHANGE:
|
||||
{
|
||||
if (cur < 0 || !pages[cur]) break;
|
||||
ShowWindow(pages[cur],SW_SHOW);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
hwnd = GetDlgItem(hwndDlg, WIN_STARTWIN_TABCTL);
|
||||
case WM_CLOSE:
|
||||
if (mode == TAB_CONFIG) done = 0;
|
||||
else quitevent++;
|
||||
return TRUE;
|
||||
|
||||
ZeroMemory(&tab, sizeof(tab));
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = TEXT("Configuration");
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)0, (LPARAM)&tab);
|
||||
tab.mask = TCIF_TEXT;
|
||||
tab.pszText = TEXT("Messages");
|
||||
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)1, (LPARAM)&tab);
|
||||
|
||||
// Work out the position and size of the area inside the tab control for the pages
|
||||
ZeroMemory(&r, sizeof(r));
|
||||
GetClientRect(hwnd, &r);
|
||||
SendMessage(hwnd, TCM_ADJUSTRECT, FALSE, (LPARAM)&r);
|
||||
r.right -= r.left-1;
|
||||
r.bottom -= r.top-1;
|
||||
r.top += rtab.top;
|
||||
r.left += rtab.left;
|
||||
|
||||
// Create the pages and position them in the tab control, but hide them
|
||||
pages[TAB_CONFIG] = CreateDialog((HINSTANCE)win_gethinstance(),
|
||||
MAKEINTRESOURCE(WIN_STARTWINPAGE_CONFIG), hwndDlg, ConfigPageProc);
|
||||
pages[TAB_MESSAGES] = GetDlgItem(hwndDlg, WIN_STARTWIN_MESSAGES);
|
||||
SetWindowPos(pages[TAB_CONFIG], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);
|
||||
SetWindowPos(pages[TAB_MESSAGES], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);
|
||||
|
||||
// Tell the editfield acting as the console to exclude the width of the scrollbar
|
||||
GetClientRect(pages[TAB_MESSAGES],&r);
|
||||
r.right -= GetSystemMetrics(SM_CXVSCROLL)+4;
|
||||
r.left = r.top = 0;
|
||||
SendMessage(pages[TAB_MESSAGES], EM_SETRECTNP,0,(LPARAM)&r);
|
||||
|
||||
SetFocus(GetDlgItem(hwndDlg, WIN_STARTWIN_START));
|
||||
}
|
||||
return FALSE;
|
||||
case WM_DESTROY:
|
||||
if (hbmp)
|
||||
{
|
||||
DeleteObject(hbmp);
|
||||
hbmp = NULL;
|
||||
}
|
||||
|
||||
case WM_NOTIFY: {
|
||||
LPNMHDR nmhdr = (LPNMHDR)lParam;
|
||||
int cur;
|
||||
if (nmhdr->idFrom != WIN_STARTWIN_TABCTL) break;
|
||||
cur = (int)SendMessage(nmhdr->hwndFrom, TCM_GETCURSEL,0,0);
|
||||
switch (nmhdr->code) {
|
||||
case TCN_SELCHANGING: {
|
||||
if (cur < 0 || !pages[cur]) break;
|
||||
ShowWindow(pages[cur],SW_HIDE);
|
||||
return TRUE;
|
||||
}
|
||||
case TCN_SELCHANGE: {
|
||||
if (cur < 0 || !pages[cur]) break;
|
||||
ShowWindow(pages[cur],SW_SHOW);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
if (pages[TAB_CONFIG])
|
||||
{
|
||||
DestroyWindow(pages[TAB_CONFIG]);
|
||||
pages[TAB_CONFIG] = NULL;
|
||||
}
|
||||
|
||||
case WM_CLOSE:
|
||||
startupdlg = NULL;
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case WIN_STARTWIN_CANCEL:
|
||||
if (mode == TAB_CONFIG) done = 0;
|
||||
else quitevent++;
|
||||
return TRUE;
|
||||
case WIN_STARTWIN_START: done = 1; return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
case WM_DESTROY:
|
||||
if (hbmp) {
|
||||
DeleteObject(hbmp);
|
||||
hbmp = NULL;
|
||||
}
|
||||
case WM_CTLCOLORSTATIC:
|
||||
if ((HWND)lParam == pages[TAB_MESSAGES])
|
||||
return (BOOL)GetSysColorBrush(COLOR_WINDOW);
|
||||
break;
|
||||
|
||||
if (pages[TAB_CONFIG]) {
|
||||
DestroyWindow(pages[TAB_CONFIG]);
|
||||
pages[TAB_CONFIG] = NULL;
|
||||
}
|
||||
|
||||
startupdlg = NULL;
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case WIN_STARTWIN_CANCEL:
|
||||
if (mode == TAB_CONFIG) done = 0;
|
||||
else quitevent++;
|
||||
return TRUE;
|
||||
case WIN_STARTWIN_START: done = 1; return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
case WM_CTLCOLORSTATIC:
|
||||
if ((HWND)lParam == pages[TAB_MESSAGES])
|
||||
return (BOOL)GetSysColorBrush(COLOR_WINDOW);
|
||||
break;
|
||||
|
||||
default: break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
@ -295,7 +312,8 @@ int startwin_open(void)
|
|||
icc.dwICC = ICC_TAB_CLASSES;
|
||||
InitCommonControlsEx(&icc);
|
||||
startupdlg = CreateDialog((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(WIN_STARTWIN), NULL, startup_dlgproc);
|
||||
if (startupdlg) {
|
||||
if (startupdlg)
|
||||
{
|
||||
SetPage(TAB_MESSAGES);
|
||||
EnableConfig(0);
|
||||
return 0;
|
||||
|
@ -332,25 +350,33 @@ int startwin_puts(const char *buf)
|
|||
SendMessage(edctl, EM_SETSEL, (WPARAM)curlen, (LPARAM)curlen);
|
||||
linesbefore = SendMessage(edctl, EM_GETLINECOUNT, 0,0);
|
||||
p = buf;
|
||||
while (*p) {
|
||||
if (newline) {
|
||||
while (*p)
|
||||
{
|
||||
if (newline)
|
||||
{
|
||||
SendMessage(edctl, EM_REPLACESEL, 0, (LPARAM)"\r\n");
|
||||
newline = 0;
|
||||
}
|
||||
q = p;
|
||||
while (*q && *q != '\n') q++;
|
||||
memcpy(workbuf, p, q-p);
|
||||
if (*q == '\n') {
|
||||
if (!q[1]) {
|
||||
if (*q == '\n')
|
||||
{
|
||||
if (!q[1])
|
||||
{
|
||||
newline = 1;
|
||||
workbuf[q-p] = 0;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
workbuf[q-p] = '\r';
|
||||
workbuf[q-p+1] = '\n';
|
||||
workbuf[q-p+2] = 0;
|
||||
}
|
||||
p = q+1;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
workbuf[q-p] = 0;
|
||||
p = q;
|
||||
}
|
||||
|
@ -372,7 +398,7 @@ int startwin_settitle(const char *str)
|
|||
int startwin_idle(void *v)
|
||||
{
|
||||
if (!startupdlg || !IsWindow(startupdlg)) return 0;
|
||||
if (IsDialogMessage(startupdlg, (MSG*)v)) return 1;
|
||||
if (IsDialogMessage(startupdlg, (MSG *)v)) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -395,21 +421,24 @@ int startwin_run(void)
|
|||
settings.forcesetup = forcesetup;
|
||||
PopulateForm();
|
||||
|
||||
while (done < 0) {
|
||||
switch (GetMessage(&msg, NULL, 0,0)) {
|
||||
case 0: done = 1; break;
|
||||
case -1: return -1;
|
||||
default:
|
||||
if (IsWindow(startupdlg) && IsDialogMessage(startupdlg, &msg)) break;
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
break;
|
||||
while (done < 0)
|
||||
{
|
||||
switch (GetMessage(&msg, NULL, 0,0))
|
||||
{
|
||||
case 0: done = 1; break;
|
||||
case -1: return -1;
|
||||
default:
|
||||
if (IsWindow(startupdlg) && IsDialogMessage(startupdlg, &msg)) break;
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SetPage(TAB_MESSAGES);
|
||||
EnableConfig(0);
|
||||
if (done) {
|
||||
if (done)
|
||||
{
|
||||
fullscreen = settings.fullscreen;
|
||||
xdimgame = settings.xdim3d;
|
||||
ydimgame = settings.ydim3d;
|
||||
|
|
Loading…
Reference in a new issue