This commit is contained in:
aquiles 2010-12-19 16:52:13 +01:00
commit a9d294fc96
11 changed files with 177 additions and 14 deletions

View file

@ -307,7 +307,7 @@ MACRO(NL_SETUP_BUILD)
SET(NL_DEBUG_LINKFLAGS "/NODEFAULTLIB:msvcrt /INCREMENTAL:YES")
SET(NL_RELEASE_LINKFLAGS "/OPT:REF /OPT:ICF /INCREMENTAL:NO")
ELSE(WIN32)
SET(PLATFORM_CFLAGS "-g -ftemplate-depth-48 -D_REENTRANT -Wall -ansi -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-unused -fno-strict-aliasing")
SET(PLATFORM_CFLAGS "-g -pipe -ftemplate-depth-48 -D_REENTRANT -Wall -ansi -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-unused -fno-strict-aliasing")
IF(WITH_COVERAGE)
SET(PLATFORM_CFLAGS "-fprofile-arcs -ftest-coverage ${PLATFORM_CFLAGS}")
ENDIF(WITH_COVERAGE)

View file

@ -116,6 +116,39 @@ void CGraphicsViewport::resizeEvent(QResizeEvent *resizeEvent)
Modules::objView().setSizeViewport(resizeEvent->size().width(), resizeEvent->size().height());
}
#if defined(NL_OS_WINDOWS) || defined(NL_OS_MAC)
// Qt does not provide wheel events through winEvent() and macEvent() (but it
// does through x11Event(), which is inconsistent...)
// Workaround is to handle wheel events like implemented below.
//
// TODO: this is not a clean solution, because all but wheel events are
// handled using winEvent(), x11Event(), macEvent(). But this seems to be a
// limitation of current (4.7.1) Qt versions. (see e.g. qapplication_mac.mm)
void CGraphicsViewport::wheelEvent(QWheelEvent *event)
{
// Get relative positions.
float fX = 1.0f - (float)event->pos().x() / this->width();
float fY = 1.0f - (float)event->pos().y() / this->height();
// Get the buttons currently pressed.
uint32 buttons = NLMISC::noButton;
if(event->buttons() & Qt::LeftButton) buttons |= NLMISC::leftButton;
if(event->buttons() & Qt::RightButton) buttons |= NLMISC::rightButton;
if(event->buttons() & Qt::MidButton) buttons |= NLMISC::middleButton;
if(event->modifiers() & Qt::ControlModifier) buttons |= NLMISC::ctrlButton;
if(event->modifiers() & Qt::ShiftModifier) buttons |= NLMISC::shiftButton;
if(event->modifiers() & Qt::AltModifier) buttons |= NLMISC::altButton;
if(event->delta() > 0)
Modules::objView().getDriver()->EventServer.postEvent(
new NLMISC::CEventMouseWheel(-fX, fY, (NLMISC::TMouseButton)buttons, true, NULL));
else
Modules::objView().getDriver()->EventServer.postEvent(
new NLMISC::CEventMouseWheel(-fX, fY, (NLMISC::TMouseButton)buttons, false, NULL));
}
#endif // defined(NL_OS_WINDOWS) || defined(NL_OS_MAC)
#if defined(NL_OS_WINDOWS)
typedef bool (*winProc)(NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);

View file

@ -80,6 +80,10 @@ private Q_SLOTS:
protected:
virtual void resizeEvent(QResizeEvent *resizeEvent);
#if defined(NL_OS_WINDOWS) || defined(NL_OS_MAC)
virtual void wheelEvent(QWheelEvent *event);
#endif
#if defined(NL_OS_WINDOWS)
virtual bool winEvent(MSG *message, long *result);
#elif defined(NL_OS_MAC)

View file

@ -0,0 +1,107 @@
/*
Object Viewer Qt
Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CORE_CONSTANTS_H
#define CORE_CONSTANTS_H
namespace Core {
namespace Constants {
const char * const OVQT_VERSION_LONG = "0.0.1";
const char * const OVQT_VENDOR = "Dzmitry Kamiahin";
const char * const OVQT_YEAR = "2010";
//mainwindow
const char * const MAIN_WINDOW = "ObjectViewerQt.MainWindow";
//menubar
const char * const MENU_BAR = "ObjectViewerQt.MenuBar";
//menus
const char * const M_FILE = "ObjectViewerQt.Menu.File";
const char * const M_EDIT = "ObjectViewerQt.Menu.Edit";
const char * const M_SCENE = "ObjectViewerQt.Menu.Scene";
const char * const M_TOOLS = "ObjectViewerQt.Menu.Tools";
const char * const M_WINDOW = "ObjectViewerQt.Menu.Window";
const char * const M_HELP = "ObjectViewerQt.Menu.Help";
//actions
const char * const UNDO = "ObjectViewerQt.Undo";
const char * const REDO = "ObjectViewerQt.Redo";
const char * const NEW = "ObjectViewerQt.New";
const char * const OPEN = "ObjectViewerQt.Open";
const char * const SAVE = "ObjectViewerQt.Save";
const char * const SAVEAS = "ObjectViewerQt.SaveAs";
const char * const SAVEALL = "ObjectViewerQt.SaveAll";
const char * const EXIT = "ObjectViewerQt.Exit";
const char * const SETTINGS = "ObjectViewerQt.Settings";
const char * const TOGGLE_FULLSCREEN = "ObjectViewerQt.ToggleFullScreen";
const char * const MINIMIZE_WINDOW = "ObjectViewerQt.MinimizeWindow";
const char * const ZOOM_WINDOW = "ObjectViewerQt.ZoomWindow";
const char * const CLOSE = "ObjectViewerQt.Close";
const char * const CLOSEALL = "ObjectViewerQt.CloseAll";
const char * const CLOSEOTHERS = "ObjectViewerQt.CloseOthers";
const char * const ABOUT = "ObjectViewerQt.About";
const char * const ABOUT_PLUGINS = "ObjectViewerQt.AboutPlugins";
const char * const ABOUT_QT = "ObjectViewerQt.AboutQt";
const char * const ICON_NEL = ":/images/nel.png";
const char * const ICON_NEL_IDE = ":/images/nel_ide_load.png</file>
const char * const ICON_OPENFILE = ":/images/open-file.png";
const char * const ICON_GO_DOWN = ":/images/go-down.png</file>
const char * const ICON_GO_UP = ":/images/go-up.png</file>
const char * const ICON_LIST_ADD = ":/images/list-add.png</file>
const char * const ICON_LIST_REMOVE = ":/images/list-remove.png</file>
const char * const ICON_PLAY = ":/images/play.png</file>
const char * const ICON_PAUSE = ":/images/pause.png</file>
const char * const ICON_STOP = ":/images/stop.png</file>
const char * const ICON_SEEK_BACKWARD = ":/images/seek-backward.png</file>
const char * const ICON_SEEK_FORWARD = ":/images/seek-forward.png</file>
const char * const ICON_SKIP_BACKWARD = ":/images/skip-backward.png</file>
const char * const ICON_SKIP_FORWARD = ":/images/skip-forward.png</file>
const char * const ICON_SETTINGS = ":/images/preferences.png</file>
const char * const ICON_TIME = ":/images/time.png</file>
const char * const ICON_ANIM = ":/images/anim.png</file>
const char * const ICON_ANIMSET = ":/images/animset.png</file>
const char * const ICON_DAY_NIGHT = ":/images/dqynight.png</file>
const char * const ICON_MIXER = ":/images/mixer.png</file>
const char * const ICON_PARTICLES = ":/images/pqrticles.png</file>
const char * const ICON_SOUND = ":/images/sound.png</file>
const char * const ICON_VEGETABLE = ":/images/veget.png</file>
const char * const ICON_WATER = ":/images/water.png</file>
const char * const ICON_WIND = ":/images/wind.png</file>
const char * const ICON_BACKGROUNDCOLOR = ":/images/ico_bgcolor.png</file>
const char * const ICON_FRAMEDELAY = ":/images/ico_framedelay.png</file>
const char * const ICON_SKELSCALE = ":/images/ico_skelscale.png</file>
const char * const ICON_CLEAR = ":/images/clear.png</file>
const char * const ICON_INSERT = ":/images/insert.png</file>
const char * const ICON_NEW = ":/images/new.png</file>
const char * const ICON_REFRESH = ":/images/refresh.png</file>
const char * const ICON_SAVE_AS = ":/images/save-as.png</file>
const char * const ICON_SAVE = ":/images/save.png</file>
const char * const ICON_INSERT_HORIZONTAL = ":/images/insert-horizontal.png</file>
} // namespace Constants
} // namespace Core
#endif // CORE_CONSTANTS_H

View file

@ -25,7 +25,18 @@ bool MyPlugin::initialize(NLQT::IPluginManager *pluginManager, QString *errorStr
str += plugSpec->name();
nlinfo(str.toStdString().c_str());
QMainWindow *wnd = qobject_cast<QMainWindow *>(objectByName("CMainWindow"));
if (!wnd)
{
*errorString = tr("Not found QMainWindow Object Viewer Qt.");
return false;
}
QMenu *helpMenu = qobject_cast<QMenu *>(objectByName("ovqt.Menu.Tools"));
if (!helpMenu)
{
*errorString = tr("Not found QMenu Help.");
return false;
}
return true;
}

View file

@ -59,15 +59,6 @@ bool CLogPlugin::initialize(NLQT::IPluginManager *pluginManager, QString *errorS
{
Q_UNUSED(errorString);
_plugMan = pluginManager;
QString str;
QList<NLQT::IPluginSpec *> listPlug = pluginManager->plugins();
Q_FOREACH (NLQT::IPluginSpec *plugSpec, listPlug)
str += plugSpec->name();
nlinfo(str.toStdString().c_str());
return true;
}

View file

@ -23,6 +23,10 @@ ADD_LIBRARY(ovqt_plugin_sheet_builder MODULE ${SRC} ${OVQT_PLUG_SHEET_BUILDER_MO
TARGET_LINK_LIBRARIES(ovqt_plugin_sheet_builder nelmisc ${QT_LIBRARIES})
IF(WITH_STLPORT)
TARGET_LINK_LIBRARIES(ovqt_plugin_sheet_builder ${CMAKE_THREAD_LIBS_INIT})
ENDIF(WITH_STLPORT)
NL_DEFAULT_PROPS(ovqt_plugin_sheet_builder "NeL, Tools, 3D: Object Viewer Qt Plugin: Sheet builder")
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_sheet_builder)
NL_ADD_LIB_SUFFIX(ovqt_plugin_sheet_builder)

View file

@ -35,6 +35,18 @@ bool SheetBuilderPlugin::initialize(NLQT::IPluginManager *pluginManager, QString
{
Q_UNUSED(errorString);
_plugMan = pluginManager;
QMainWindow *wnd = qobject_cast<QMainWindow *>(objectByName("CMainWindow"));
if (!wnd)
{
*errorString = tr("Not found MainWindow Object Viewer Qt.");
return false;
}
QMenu *toolsMenu = qobject_cast<QMenu *>(objectByName("ovqt.Menu.Tools"));
if (!toolsMenu)
{
*errorString = tr("Not found QMenu Tools.");
return false;
}
return true;
}

View file

@ -18,6 +18,7 @@
#include <map>
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include "tree.h"
#include "cond_node.h"

Binary file not shown.

After

Width:  |  Height:  |  Size: 779 KiB