Qt plugin fixes for windows, renamed interface to df_interface in Gui.

develop
Petr Mrázek 2011-07-16 18:10:08 +02:00
parent 3f42479e77
commit d6d108dd34
7 changed files with 27 additions and 23 deletions

@ -390,10 +390,10 @@ int Core::SDL_Event(SDL::Event* ev, int orig_return)
{ {
hotkey_states[idx] = 1; hotkey_states[idx] = 1;
Gui * g = getGui(); Gui * g = getGui();
if(g->hotkeys && g->interface && g->menu_state) if(g->hotkeys && g->df_interface && g->df_menu_state)
{ {
t_viewscreen * ws = g->GetCurrentScreen(); t_viewscreen * ws = g->GetCurrentScreen();
if(ws->getClassName() == "viewscreen_dwarfmodest" && *g->menu_state == 0x23) if(ws->getClassName() == "viewscreen_dwarfmodest" && *g->df_menu_state == 0x23)
return orig_return; return orig_return;
else else
{ {

@ -114,11 +114,11 @@ namespace DFHack
* Gui screens * Gui screens
*/ */
/// handle to the interface object /// handle to the interface object
t_interface * interface; t_interface * df_interface;
/// Get the current top-level view-screen /// Get the current top-level view-screen
t_viewscreen * GetCurrentScreen(); t_viewscreen * GetCurrentScreen();
/// The DF menu state (designation menu ect) /// The DF menu state (designation menu ect)
uint32_t * menu_state; uint32_t * df_menu_state;
/* /*
* Hotkeys (DF's zoom locations) * Hotkeys (DF's zoom locations)

@ -86,21 +86,21 @@ Gui::Gui()
// Setting up menu state // Setting up menu state
try try
{ {
menu_state = (uint32_t *) OG_Gui->getAddress("current_menu_state"); df_menu_state = (uint32_t *) OG_Gui->getAddress("current_menu_state");
} }
catch(Error::All &) catch(Error::All &)
{ {
menu_state = 0; df_menu_state = 0;
}; };
// Setting up the view screen stuff // Setting up the view screen stuff
try try
{ {
interface = (t_interface *) OG_Gui->getAddress ("interface"); df_interface = (t_interface *) OG_Gui->getAddress ("interface");
} }
catch(exception &) catch(exception &)
{ {
interface = 0; df_interface = 0;
}; };
OffsetGroup * OG_Position; OffsetGroup * OG_Position;
@ -140,9 +140,9 @@ bool Gui::Finish()
t_viewscreen * Gui::GetCurrentScreen() t_viewscreen * Gui::GetCurrentScreen()
{ {
if(!interface) if(!df_interface)
return 0; return 0;
t_viewscreen * ws = &interface->view; t_viewscreen * ws = &df_interface->view;
while(ws) while(ws)
{ {
if(ws->child) if(ws->child)

@ -96,20 +96,16 @@ ENDMACRO(DFHACK_PLUGIN)
#endmacro() #endmacro()
#RECURSE_DIRS() #RECURSE_DIRS()
IF(UNIX)
OPTION(BUILD_QTPLUG "Build the experimental Qt plugin." OFF)
if(BUILD_QTPLUG)
add_subdirectory (qtplug) add_subdirectory (qtplug)
ENDIF() endif()
DFHACK_PLUGIN(reveal reveal.cpp)
OPTION(BUILD_KITTENS "Build the kittens plugin." OFF) OPTION(BUILD_KITTENS "Build the kittens plugin." OFF)
if(BUILD_KITTENS) if(BUILD_KITTENS)
DFHACK_PLUGIN(kittens kittens.cpp) DFHACK_PLUGIN(kittens kittens.cpp)
endif() endif()
DFHACK_PLUGIN(prospector prospector.cpp)
DFHACK_PLUGIN(cleanmap cleanmap.cpp)
DFHACK_PLUGIN(weather weather.cpp)
DFHACK_PLUGIN(vdig vdig.cpp)
DFHACK_PLUGIN(colonies colonies.cpp)
IF(UNIX) IF(UNIX)
OPTION(BUILD_KILL_GAME "Build the kill gmae plugin." OFF) OPTION(BUILD_KILL_GAME "Build the kill gmae plugin." OFF)
@ -117,3 +113,10 @@ IF(UNIX)
DFHACK_PLUGIN(die die.cpp) DFHACK_PLUGIN(die die.cpp)
endif() endif()
endif() endif()
DFHACK_PLUGIN(reveal reveal.cpp)
DFHACK_PLUGIN(prospector prospector.cpp)
DFHACK_PLUGIN(cleanmap cleanmap.cpp)
DFHACK_PLUGIN(weather weather.cpp)
DFHACK_PLUGIN(vdig vdig.cpp)
DFHACK_PLUGIN(colonies colonies.cpp)

@ -12,7 +12,7 @@ if(QT4_FOUND AND OPENGL_FOUND AND OPENGL_GLU_FOUND)
set ( qtplug_SRCS set ( qtplug_SRCS
qtplug.cpp qtplug.cpp
blankslade.cpp blankslade.cpp
glwidget.cpp #glwidget.cpp
) )
SET ( qtplug_UI SET ( qtplug_UI

@ -6,13 +6,13 @@
#include "blankslade.h" #include "blankslade.h"
#include <QFileDialog> #include <QFileDialog>
#include <QDebug> #include <QDebug>
#include "glwidget.h" //#include "glwidget.h"
blankslade::blankslade(QWidget *parent): QMainWindow(parent) blankslade::blankslade(QWidget *parent): QMainWindow(parent)
{ {
ui.setupUi(this); ui.setupUi(this);
GLWidget * glw = new GLWidget(); //GLWidget * glw = new GLWidget();
ui.gridding->addWidget(glw); //ui.gridding->addWidget(glw);
connect(ui.actionOpen,SIGNAL(triggered(bool)),this,SLOT(slotOpen(bool))); connect(ui.actionOpen,SIGNAL(triggered(bool)),this,SLOT(slotOpen(bool)));
connect(ui.actionQuit,SIGNAL(triggered(bool)),this,SLOT(slotQuit(bool))); connect(ui.actionQuit,SIGNAL(triggered(bool)),this,SLOT(slotQuit(bool)));
connect(ui.actionSave,SIGNAL(triggered(bool)),this,SLOT(slotSave(bool))); connect(ui.actionSave,SIGNAL(triggered(bool)),this,SLOT(slotSave(bool)));

@ -60,7 +60,8 @@ DFhackCExport command_result runqt (Core * c, vector <string> & parameters)
static int runnable(void *) static int runnable(void *)
{ {
QApplication app(0, 0); int zero = 0;
QApplication app(zero, 0);
blankslade appGui; blankslade appGui;
appGui.show(); appGui.show();
int ret = app.exec(); int ret = app.exec();