[Pkg-nethack-devel] nethack/win/Qt qt_win.cpp,1.1.1.1,1.2
Joshua Kwan
joshk-guest@quantz.debian.org
Tue, 09 Dec 2003 16:14:47 +0000
- Previous message: [Pkg-nethack-devel] nethack/sys/winnt Install.nt,1.1.1.1,1.2 Makefile.bcc,1.1.1.1,1.2 Makefile.gcc,1.1.1.1,1.2 Makefile.msc,1.1.1.1,1.2 console.rc,1.1.1.1,1.2 defaults.nh,1.1.1.1,1.2 nh340key.c,1.1.1.1,1.2 nhdefkey.c,1.1.1.1,1.2 nhraykey.c,1.1.1.1,1.2 nttty.c,1.1.1.1,1.2 porthelp,1.1.1.1,1.2 winnt.c,1.1.1.1,1.2
- Next message: [Pkg-nethack-devel] nethack/win/X11 winX.c,1.1.1.1,1.2 winmap.c,1.1.1.1,1.2 winmisc.c,1.1.1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/pkg-nethack/nethack/win/Qt
In directory quantz:/tmp/cvs-serv9687/win/Qt
Modified Files:
qt_win.cpp
Log Message:
Merge Nethack 3.4.3 upstream source.
Index: qt_win.cpp
===================================================================
RCS file: /cvsroot/pkg-nethack/nethack/win/Qt/qt_win.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- qt_win.cpp 7 Oct 2003 19:00:41 -0000 1.1.1.1
+++ qt_win.cpp 9 Dec 2003 16:14:45 -0000 1.2
@@ -57,6 +57,7 @@
#include "dlb.h"
#include "patchlevel.h"
#include "tile2x11.h"
+#undef Invisible
#undef Warning
#undef red
#undef green
@@ -69,11 +70,9 @@
#undef max
#undef alloc
#undef lock
+#undef yn
}
-#ifdef yn
-#undef yn
-#endif
#include "qt_win.h"
#include <qregexp.h>
@@ -979,7 +978,7 @@
};
NetHackQtPlayerSelector::NetHackQtPlayerSelector(NetHackQtKeyBuffer& ks) :
- QDialog(0,"plsel",TRUE),
+ QDialog(qApp->mainWidget(),"plsel",TRUE),
keysource(ks),
fully_specified_role(TRUE)
{
@@ -1148,7 +1147,7 @@
a = rn2(ROLE_ALIGNS);
}
alignment[a]->setChecked(TRUE);
- selectAlignment(g);
+ selectAlignment(a);
QListViewItem* li;
@@ -1159,6 +1158,9 @@
li = race->firstChild();
while (ra--) li=li->nextSibling();
race->setSelected(li,TRUE);
+
+ flags.initrace = race->selectedItemNumber();
+ flags.initrole = role->selectedItemNumber();
}
@@ -1329,7 +1331,7 @@
NetHackQtStringRequestor::NetHackQtStringRequestor(NetHackQtKeyBuffer& ks, const char* p, const char* cancelstr) :
- QDialog(0,"string",FALSE),
+ QDialog(qApp->mainWidget(),"string",FALSE),
prompt(p,this,"prompt"),
input(this,"input"),
keysource(ks)
@@ -1640,8 +1642,6 @@
painter.setClipRect( event->rect() ); // (normally we don't clip)
painter.fillRect( event->rect(), black );
- int offset;
-
if ( !rogue_font ) {
// Find font...
int pts = 5;
@@ -1829,10 +1829,10 @@
int uncleared;
NetHackQtScrollText(int maxlength) :
+ uncleared(0),
maxitems(maxlength),
first(0),
count(0),
- uncleared(0),
item_cycle(maxlength)
{
setNumCols(1);
@@ -2030,21 +2030,21 @@
NetHackQtLabelledIcon::NetHackQtLabelledIcon(QWidget* parent, const char* l) :
QWidget(parent),
+ low_is_good(FALSE),
+ prev_value(-123),
turn_count(-1),
label(new QLabel(l,this)),
- icon(0),
- low_is_good(FALSE),
- prev_value(-123)
+ icon(0)
{
initHighlight();
}
NetHackQtLabelledIcon::NetHackQtLabelledIcon(QWidget* parent, const char* l, const QPixmap& i) :
QWidget(parent),
low_is_good(FALSE),
+ prev_value(-123),
turn_count(-1),
label(new QLabel(l,this)),
- icon(new QLabel(this)),
- prev_value(-123)
+ icon(new QLabel(this))
{
setIcon(i);
initHighlight();
@@ -2177,7 +2177,7 @@
if (!pm.load(fn)) {
QString msg;
msg.sprintf("Cannot load \"%s\"", fn);
- QMessageBox::warning(0, "IO Error", msg);
+ QMessageBox::warning(qApp->mainWidget(), "IO Error", msg);
}
}
@@ -2186,14 +2186,14 @@
// Alignment needs -2 init value, because -1 is an alignment.
// Armor Class is an schar, so 256 is out of range.
// Blank value is 0 and should never change.
+ name(this,"(name)"),
+ dlevel(this,"(dlevel)"),
str(this,"STR"),
dex(this,"DEX"),
con(this,"CON"),
intel(this,"INT"),
wis(this,"WIS"),
cha(this,"CHA"),
- name(this,"(name)"),
- dlevel(this,"(dlevel)"),
gold(this,"Gold"),
hp(this,"Hit Points"),
power(this,"Power"),
@@ -2340,7 +2340,6 @@
int h=height();
int x=0,y=0;
- double space=1.0;
int iw; // Width of an item across line
int lh; // Height of a line of values
@@ -2538,7 +2537,7 @@
name.setLabel(buf,NetHackQtLabelledIcon::NoNum,u.ulevel);
if (describe_level(buf)) {
- dlevel.setLabel(buf,TRUE);
+ dlevel.setLabel(buf,(bool)TRUE);
} else {
Sprintf(buf, "%s, level ", dungeons[u.uz.dnum].dname);
dlevel.setLabel(buf,(long)depth(&u.uz));
@@ -2641,7 +2640,7 @@
NetHackQtMenuDialog::NetHackQtMenuDialog() :
- QDialog(0,0,FALSE)
+ QDialog(qApp->mainWidget(),0,FALSE)
{
}
@@ -2684,8 +2683,8 @@
QTableView(),
keysource(ks),
dialog(new NetHackQtMenuDialog()),
- pressed(-1),
- prompt(0)
+ prompt(0),
+ pressed(-1)
{
setNumCols(4);
setCellHeight(QMAX(qt_settings->glyphs().height()+1,fontMetrics().height()));
@@ -2693,8 +2692,6 @@
setFrameStyle(Panel|Sunken);
setLineWidth(2);
- int x=0;
-
ok=new QPushButton("Ok",dialog);
connect(ok,SIGNAL(clicked()),dialog,SLOT(accept()));
@@ -2792,7 +2789,7 @@
}
}
- if (item.size()<itemcount+1) {
+ if ((int)item.size() < itemcount+1) {
item.resize(itemcount*4+10);
}
item[itemcount].glyph=glyph;
@@ -3094,7 +3091,7 @@
if (item[row].count>0)
Sprintf(buf,"%d", item[row].count);
else
- Sprintf(buf,"");
+ Strcpy(buf, "");
requestor.SetDefault(buf);
if (requestor.Get(buf)) {
@@ -3218,7 +3215,7 @@
}
NetHackQtTextWindow::NetHackQtTextWindow(NetHackQtKeyBuffer& ks) :
- QDialog(0,0,FALSE),
+ QDialog(qApp->mainWidget(),0,FALSE),
keysource(ks),
use_rip(FALSE),
str_fixed(FALSE),
@@ -3420,7 +3417,7 @@
requestor.SetDefault(line);
if (requestor.Get(line)) {
int current=lines->currentItem();
- for (int i=1; i<lines->count(); i++) {
+ for (uint i=1; i<lines->count(); i++) {
int lnum=(i+current)%lines->count();
QString str=lines->text(lnum);
if (str.contains(line)) {
@@ -3628,6 +3625,7 @@
{ act2, "Search\ts", "s", 3},
{ act2, "Sit\tAlt+S", "\363", 3},
{ act2, "Throw\tt", "t", 2},
+ { act2, "Untrap\t#u", "#u", 3},
{ act2, "Up\t<", "<", 3},
{ act2, "Wipe face\tAlt+W", "\367", 3},
@@ -4078,9 +4076,9 @@
NetHackQtYnDialog::NetHackQtYnDialog(NetHackQtKeyBuffer& keysrc,const char* q,const char* ch,char df) :
- QDialog(0,0,FALSE),
- keysource(keysrc),
- question(q), choices(ch), def(df)
+ QDialog(qApp->mainWidget(),0,FALSE),
+ question(q), choices(ch), def(df),
+ keysource(keysrc)
{
setCaption("NetHack: Question");
}
@@ -4167,7 +4165,6 @@
const int margin=8;
const int gutter=8;
const int extra=fontMetrics().height(); // Extra for group
- int row=0;
int x=margin, y=extra+margin;
int butsize=fontMetrics().height()*2+5;
@@ -4205,7 +4202,7 @@
show();
char choice=0;
char ch_esc=0;
- for (int i=0; i<ch.length(); i++) {
+ for (uint i=0; i<ch.length(); i++) {
if (ch[i].latin1()=='q') ch_esc='q';
else if (!ch_esc && ch[i].latin1()=='n') ch_esc='n';
}
@@ -4214,7 +4211,7 @@
if (!keysource.Empty()) {
char k=keysource.GetAscii();
char ch_esc=0;
- for (int i=0; i<ch.length(); i++)
+ for (uint i=0; i<ch.length(); i++)
if (ch[i].latin1()==k)
choice=k;
if (!choice) {
@@ -4301,7 +4298,7 @@
} else {
tiles_per_row = 40;
}
- int rows = ((total_tiles_used+tiles_per_row-1) / tiles_per_row);
+
if ( iflags.wc_tile_width )
tilefile_tile_W = iflags.wc_tile_width;
else
@@ -4374,8 +4371,8 @@
NetHackQtMenuOrTextWindow::NetHackQtMenuOrTextWindow(NetHackQtKeyBuffer& ks) :
- keysource(ks),
- actual(0)
+ actual(0),
+ keysource(ks)
{
}
@@ -4549,7 +4546,7 @@
}
NetHackQtSavedGameSelector::NetHackQtSavedGameSelector(const char** saved) :
- QDialog(0,"sgsel",TRUE)
+ QDialog(qApp->mainWidget(),"sgsel",TRUE)
{
QVBoxLayout *vbl = new QVBoxLayout(this,6);
QHBox* hb;
@@ -4667,11 +4664,11 @@
winid NetHackQtBind::qt_create_nhwindow(int type)
{
winid id;
- for (id = 0; id < id_to_window.size(); id++) {
+ for (id = 0; id < (winid) id_to_window.size(); id++) {
if ( !id_to_window[id] )
break;
}
- if ( id == id_to_window.size() )
+ if ( id == (winid) id_to_window.size() )
id_to_window.resize(id+1);
NetHackQtWindow* window=0;
@@ -5001,7 +4998,7 @@
}
NetHackQtExtCmdRequestor::NetHackQtExtCmdRequestor(NetHackQtKeyBuffer& ks) :
- QDialog(0, "ext-cmd", FALSE),
+ QDialog(qApp->mainWidget(), "ext-cmd", FALSE),
keysource(ks)
{
int marg=4;
@@ -5155,8 +5152,12 @@
}
}
char ch=key_event->ascii();
+ if ( !ch && (key_event->state() & Qt::ControlButton) ) {
+ // On Mac, ascii control codes are not sent, force them.
+ if ( k>=Qt::Key_A && k<=Qt::Key_Z )
+ ch = k - Qt::Key_A + 1;
+ }
if (!macro && ch) {
- int k = key_event->key();
bool alt = (key_event->state()&AltButton) ||
(k >= Key_0 && k <= Key_9 && (key_event->state()&ControlButton));
keybuffer.Put(key_event->key(),ch + (alt ? 128 : 0),
- Previous message: [Pkg-nethack-devel] nethack/sys/winnt Install.nt,1.1.1.1,1.2 Makefile.bcc,1.1.1.1,1.2 Makefile.gcc,1.1.1.1,1.2 Makefile.msc,1.1.1.1,1.2 console.rc,1.1.1.1,1.2 defaults.nh,1.1.1.1,1.2 nh340key.c,1.1.1.1,1.2 nhdefkey.c,1.1.1.1,1.2 nhraykey.c,1.1.1.1,1.2 nttty.c,1.1.1.1,1.2 porthelp,1.1.1.1,1.2 winnt.c,1.1.1.1,1.2
- Next message: [Pkg-nethack-devel] nethack/win/X11 winX.c,1.1.1.1,1.2 winmap.c,1.1.1.1,1.2 winmisc.c,1.1.1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]