-// NetHack 3.6 qt_win.cpp $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$
+// NetHack 3.6 qt_win.cpp $NHDT-Date: 1524684508 2018/04/25 19:28:28 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.77 $
// Copyright (c) Warwick Allison, 1999.
// NetHack may be freely redistributed. See license for details.
{
input.setText(d);
}
+
bool NetHackQtStringRequestor::Get(char* buffer, int maxchar)
{
input.setMaxLength(maxchar);
NetHackQtWindow::NetHackQtWindow()
{
}
+
NetHackQtWindow::~NetHackQtWindow()
{
}
messages += "\n";
messages += text;
QFontMetrics fm = fontMetrics();
- messages_rect = fm.boundingRect(viewport.contentsX(),viewport.contentsY(),viewport.width(),0, WordBreak|AlignTop|AlignLeft|DontClip, messages);
+ messages_rect = fm.boundingRect(viewport.contentsX(), viewport.contentsY(),
+ viewport.width(), 0,
+ WordBreak|AlignTop|AlignLeft|DontClip,
+ messages);
update(messages_rect);
}
&& ::iflags.hilite_pet
#endif
) {
- painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(), j*qt_settings->glyphs().height()), pet_annotation);
+ painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(),
+ j*qt_settings->glyphs().height()),
+ pet_annotation);
}
}
}
&& ::iflags.hilite_pet
#endif
) {
- painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(), j*qt_settings->glyphs().height()), pet_annotation);
+ painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(),
+ j*qt_settings->glyphs().height()),
+ pet_annotation);
}
}
}
invert->setGeometry(x,0,butw,buth); x+=butw; butw=(dialog->width()-x)/1;
search->setGeometry(x,0,butw,buth);
}
+
int NetHackQtMenuWindow::SelectMenu(int h, MENU_ITEM_P **menu_list)
{
setFont(str_fixed ?
return -1;
}
}
+
void NetHackQtMenuWindow::keyPressEvent(QKeyEvent* event)
{
if (viewHeight() < totalHeight() && !(event->state()&ShiftButton)) {
if (item[i].selected) ToggleSelect(i);
}
}
+
void NetHackQtMenuWindow::Invert()
{
for (int i=0; i<itemcount; i++) {
ToggleSelect(i);
}
}
+
void NetHackQtMenuWindow::Search()
{
NetHackQtStringRequestor requestor(keysource,"Search for:");
}
}
}
+
void NetHackQtMenuWindow::ToggleSelect(int i)
{
if (item[i].Selectable()) {
}
}
}
+
void NetHackQtMenuWindow::mouseReleaseEvent(QMouseEvent* event)
{
if (pressed>=0) {
updateCell(p,3);
}
}
+
void NetHackQtMenuWindow::mouseMoveEvent(QMouseEvent* event)
{
if (pressed>=0) {
Sprintf(rip_line[GOLD_LINE], "%ld Au", done_money);
/* Put together death description */
- formatkiller(buf, sizeof buf, how);
+ formatkiller(buf, sizeof buf, how, FALSE);
/* Put death type on stone */
for (line=DEATH_LINE, dpx = buf; line<YEAR_LINE; line++) {
if (dosave0()) {
u.uhp = -1;
NetHackQtBind::qt_exit_nhwindows(0);
- terminate(EXIT_SUCCESS);
+ nh_terminate(EXIT_SUCCESS);
}
break;
case 1:
} else {
tiles_per_row = TILES_PER_ROW;
if (img.width()%tiles_per_row) {
- impossible("Tile file \"%s\" has %d columns, not multiple of row count (%d)",
- tile_file, img.width(), tiles_per_row);
+ impossible(
+ "Tile file \"%s\" has %d columns, not multiple of row count (%d)",
+ tile_file, img.width(), tiles_per_row);
}
}
} else {
// Text
void NetHackQtMenuOrTextWindow::Clear()
{
- if (!actual) impossible("Clear called before we know if Menu or Text");
- actual->Clear();
+ if (!actual)
+ impossible("Clear called before we know if Menu or Text");
+ else
+ actual->Clear();
}
+
void NetHackQtMenuOrTextWindow::Display(bool block)
{
- if (!actual) impossible("Display called before we know if Menu or Text");
- actual->Display(block);
+ if (!actual)
+ impossible("Display called before we know if Menu or Text");
+ else
+ actual->Display(block);
}
+
bool NetHackQtMenuOrTextWindow::Destroy()
{
- if (!actual) impossible("Destroy called before we know if Menu or Text");
- return actual->Destroy();
+ bool res = FALSE;
+
+ if (!actual)
+ impossible("Destroy called before we know if Menu or Text");
+ else
+ res = actual->Destroy();
+
+ return res;
}
void NetHackQtMenuOrTextWindow::PutStr(int attr, const char* text)
if (!actual) actual=new NetHackQtMenuWindow(keysource);
actual->StartMenu();
}
+
void NetHackQtMenuOrTextWindow::AddMenu(int glyph, const ANY_P* identifier, char ch, char gch, int attr,
const char* str, bool presel)
{
if (!actual) impossible("AddMenu called before we know if Menu or Text");
actual->AddMenu(glyph,identifier,ch,gch,attr,str,presel);
}
+
void NetHackQtMenuOrTextWindow::EndMenu(const char* prompt)
{
if (!actual) impossible("EndMenu called before we know if Menu or Text");
actual->EndMenu(prompt);
}
+
int NetHackQtMenuOrTextWindow::SelectMenu(int how, MENU_ITEM_P **menu_list)
{
if (!actual) impossible("SelectMenu called before we know if Menu or Text");
// Quit
clearlocks();
qt_exit_nhwindows(0);
- terminate(0);
+ nh_terminate(0);
}
void NetHackQtBind::qt_get_nh_event()
genl_preference_update,
genl_getmsghistory,
genl_putmsghistory,
-#ifdef STATUS_VIA_WINDOWPORT
genl_status_init,
genl_status_finish,
genl_status_enablefield,
genl_status_update,
-# ifdef STATUS_HILITES
- genl_status_threshold,
-# endif
-#endif
+ genl_can_suspend_yes,
};
extern "C" void play_usersound(const char* filename, int volume)