* latest changes

* all files except studio, map and maindialog should compile
* did some code cleanup
dev-ui
erihel 2012-09-11 12:49:41 +02:00
parent 5903e400d4
commit 01cc0fbc49
24 changed files with 433 additions and 471 deletions

View File

@ -33,7 +33,7 @@
// Seeking the name of an object. // Seeking the name of an object.
char* RetObjectName(ObjectType type) char* GetObjectName(ObjectType type)
{ {
if ( type == OBJECT_PORTICO ) return "Portico"; if ( type == OBJECT_PORTICO ) return "Portico";
if ( type == OBJECT_BASE ) return "SpaceShip"; if ( type == OBJECT_BASE ) return "SpaceShip";
@ -126,7 +126,7 @@ char* RetObjectName(ObjectType type)
// Seeking the name of a secondary object. // Seeking the name of a secondary object.
// (because Otto thinks that Germans do not like nuclear power) // (because Otto thinks that Germans do not like nuclear power)
char* RetObjectAlias(ObjectType type) char* GetObjectAlias(ObjectType type)
{ {
if ( type == OBJECT_NUCLEAR ) return "FuelCellPlant"; if ( type == OBJECT_NUCLEAR ) return "FuelCellPlant";
if ( type == OBJECT_URANIUM ) return "PlatinumOre"; if ( type == OBJECT_URANIUM ) return "PlatinumOre";
@ -139,7 +139,7 @@ char* RetObjectAlias(ObjectType type)
// Returns the help file to use for the object. // Returns the help file to use for the object.
char* RetHelpFilename(ObjectType type) char* GetHelpFilename(ObjectType type)
{ {
if ( type == OBJECT_BASE ) return "help\\object\\base.txt"; if ( type == OBJECT_BASE ) return "help\\object\\base.txt";
if ( type == OBJECT_DERRICK ) return "help\\object\\derrick.txt"; if ( type == OBJECT_DERRICK ) return "help\\object\\derrick.txt";
@ -224,7 +224,7 @@ char* RetHelpFilename(ObjectType type)
// Returns the help file to use for instruction. // Returns the help file to use for instruction.
char* RetHelpFilename(const char *token) char* GetHelpFilename(const char *token)
{ {
if ( strcmp(token, "if" ) == 0 ) return "help\\cbot\\if.txt"; if ( strcmp(token, "if" ) == 0 ) return "help\\cbot\\if.txt";
if ( strcmp(token, "else" ) == 0 ) return "help\\cbot\\if.txt"; if ( strcmp(token, "else" ) == 0 ) return "help\\cbot\\if.txt";
@ -436,7 +436,7 @@ bool IsFunction(const char *token)
// Returns using a compact instruction. // Returns using a compact instruction.
char* RetHelpText(const char *token) char* GetHelpText(const char *token)
{ {
if ( strcmp(token, "if" ) == 0 ) return "if ( condition ) { bloc }"; if ( strcmp(token, "if" ) == 0 ) return "if ( condition ) { bloc }";
if ( strcmp(token, "else" ) == 0 ) return "else { bloc }"; if ( strcmp(token, "else" ) == 0 ) return "else { bloc }";

View File

@ -25,12 +25,12 @@
// Procedures. // Procedures.
extern char* RetObjectName(ObjectType type); extern char* GetObjectName(ObjectType type);
extern char* RetObjectAlias(ObjectType type); extern char* GetObjectAlias(ObjectType type);
extern char* RetHelpFilename(ObjectType type); extern char* GetHelpFilename(ObjectType type);
extern char* RetHelpFilename(const char *token); extern char* GetHelpFilename(const char *token);
extern bool IsType(const char *token); extern bool IsType(const char *token);
extern bool IsFunction(const char *token); extern bool IsFunction(const char *token);
extern char* RetHelpText(const char *token); extern char* GetHelpText(const char *token);

View File

@ -17,7 +17,13 @@
#include <ui/button.h> #include "button.h"
#include <common/event.h>
#include <common/misc.h>
#include <common/restext.h>
#include <graphics/engine/engine.h>
namespace Ui { namespace Ui {

View File

@ -19,43 +19,36 @@
#pragma once #pragma once
#include "control.h"
#include <ui/control.h>
#include <graphics/engine/engine.h>
#include <common/event.h>
#include <common/misc.h>
#include <common/restext.h>
namespace Ui { namespace Ui {
class CButton : public CControl
{
public:
CButton();
virtual ~CButton();
bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType); class CButton : public CControl
{
public:
CButton();
virtual ~CButton();
bool EventProcess(const Event &event); bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
void Draw(); bool EventProcess(const Event &event);
void SetImmediat(bool bRepeat); void Draw();
bool GetImmediat();
void SetRepeat(bool bRepeat); void SetImmediat(bool bRepeat);
bool GetRepeat(); bool GetImmediat();
protected: void SetRepeat(bool bRepeat);
bool GetRepeat();
protected: protected:
bool m_bCapture;
bool m_bImmediat; protected:
bool m_bRepeat; bool m_bCapture;
float m_repeat; bool m_bImmediat;
}; bool m_bRepeat;
float m_repeat;
};
} }

View File

@ -16,21 +16,16 @@
// * along with this program. If not, see http://www.gnu.org/licenses/. // * along with this program. If not, see http://www.gnu.org/licenses/.
//#include <windows.h> #include "check.h"
//#include <stdio.h>
//#include <d3d.h> #include <common/event.h>
#include <common/iman.h>
#include <common/misc.h>
#include <common/restext.h>
#include <graphics/engine/engine.h>
#include <graphics/engine/text.h>
//#include "common/struct.h"
//#include "old/d3dengine.h"
#include "graphics/engine/engine.h"
//#include "old/math3d.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
#include "common/restext.h"
//#include "old/text.h"
#include "graphics/engine/text.h"
#include "ui/check.h"
namespace Ui { namespace Ui {

View File

@ -19,30 +19,30 @@
#pragma once #pragma once
#include "control.h"
#include "ui/control.h"
namespace Gfx{ namespace Gfx{
class CEngine; class CEngine;
} }
namespace Ui { namespace Ui {
class CCheck : public CControl class CCheck : public CControl
{ {
public: public:
CCheck(); CCheck();
virtual ~CCheck(); virtual ~CCheck();
bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType); bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
bool EventProcess(const Event &event); bool EventProcess(const Event &event);
void Draw(); void Draw();
protected: protected:
protected: protected:
}; };
} }

View File

@ -16,21 +16,15 @@
// * along with this program. If not, see http://www.gnu.org/licenses/. // * along with this program. If not, see http://www.gnu.org/licenses/.
//#include <windows.h> #include "color.h"
//#include <stdio.h>
//#include <d3d.h>
//#include "common/struct.h"
//#include "old/d3dengine.h"
#include "graphics/engine/engine.h"
#include "graphics/core/device.h"
//#include "common/language.h"
//#include "old/math3d.h"
#include "common/event.h" #include "common/event.h"
#include "common/misc.h"
#include "common/iman.h" #include "common/iman.h"
#include "common/misc.h"
#include "common/restext.h" #include "common/restext.h"
#include "ui/color.h"
#include "graphics/core/device.h"
#include "graphics/engine/engine.h"
namespace Ui { namespace Ui {

View File

@ -20,41 +20,40 @@
#pragma once #pragma once
#include "ui/control.h" #include "control.h"
//#include "graphics/engine/engine.h"
namespace Gfx{ namespace Gfx{
class CEngine; class CEngine;
struct Color; struct Color;
} }
namespace Ui { namespace Ui {
class CColor : public CControl class CColor : public CControl
{ {
public: public:
// CColor(CInstanceManager* iMan); // CColor(CInstanceManager* iMan);
CColor(); CColor();
virtual ~CColor(); virtual ~CColor();
bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType); bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
bool EventProcess(const Event &event); bool EventProcess(const Event &event);
void Draw(); void Draw();
void SetRepeat(bool bRepeat); void SetRepeat(bool bRepeat);
bool GetRepeat(); bool GetRepeat();
void SetColor(Gfx::Color color); void SetColor(Gfx::Color color);
Gfx::Color GetColor(); Gfx::Color GetColor();
protected: protected:
protected: protected:
bool m_bRepeat; bool m_bRepeat;
float m_repeat; float m_repeat;
Gfx::Color m_color; Gfx::Color m_color;
}; };
} }

View File

@ -15,23 +15,16 @@
// * You should have received a copy of the GNU General Public License // * You should have received a copy of the GNU General Public License
// * along with this program. If not, see http://www.gnu.org/licenses/. // * along with this program. If not, see http://www.gnu.org/licenses/.
#include "compass.h"
//#include <windows.h>
//#include <stdio.h>
//#include <d3d.h>
//#include "common/struct.h"
#include "math/geometry.h"
//#include "old/d3dengine.h"
#include "graphics/engine/engine.h"
#include "graphics/core/device.h"
//#include "old/math3d.h"
#include "common/event.h" #include "common/event.h"
#include "common/misc.h"
#include "common/iman.h" #include "common/iman.h"
#include "ui/compass.h" #include "common/misc.h"
#include "graphics/core/device.h"
#include "graphics/engine/engine.h"
#include "math/geometry.h"
namespace Ui { namespace Ui {
// Object's constructor. // Object's constructor.

View File

@ -20,34 +20,35 @@
#pragma once #pragma once
#include "ui/control.h" #include "control.h"
namespace Gfx { namespace Gfx {
class CEngine; class CEngine;
} }
namespace Ui { namespace Ui {
class CCompass : public CControl
{
public:
// CCompass(CInstanceManager* iMan);
CCompass();
virtual ~CCompass();
bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType); class CCompass : public CControl
{
public:
// CCompass(CInstanceManager* iMan);
CCompass();
virtual ~CCompass();
bool EventProcess(const Event &event); bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
void Draw(); bool EventProcess(const Event &event);
void SetDirection(float dir); void Draw();
float GetDirection();
protected: void SetDirection(float dir);
float GetDirection();
protected: protected:
float m_dir;
}; protected:
float m_dir;
};
} }

View File

@ -16,8 +16,7 @@
// * along with this program. If not, see http://www.gnu.org/licenses/. // * along with this program. If not, see http://www.gnu.org/licenses/.
#include <ui/control.h> #include "control.h"
namespace Ui { namespace Ui {

View File

@ -21,17 +21,17 @@
#include <string> #include <string>
#include <common/event.h>
#include <common/iman.h>
#include <common/language.h>
#include <common/misc.h>
#include <common/restext.h>
#include <graphics/core/device.h> #include <graphics/core/device.h>
#include <graphics/engine/engine.h> #include <graphics/engine/engine.h>
#include <graphics/engine/particle.h> #include <graphics/engine/particle.h>
#include <graphics/engine/text.h> #include <graphics/engine/text.h>
#include <common/language.h>
#include <common/restext.h>
#include <common/event.h>
#include <common/misc.h>
#include <common/iman.h>
#include <object/robotmain.h> #include <object/robotmain.h>
#include <sound/sound.h> #include <sound/sound.h>
@ -40,111 +40,109 @@
namespace Ui { namespace Ui {
enum ControlState
enum ControlState {
{ STATE_ENABLE = (1<<0), // active
STATE_ENABLE = (1<<0), // active STATE_CHECK = (1<<1), // pressed
STATE_CHECK = (1<<1), // pressed STATE_HILIGHT = (1<<2), // overflown by mouse
STATE_HILIGHT = (1<<2), // overflown by mouse STATE_PRESS = (1<<3), // pressed by mouse
STATE_PRESS = (1<<3), // pressed by mouse STATE_VISIBLE = (1<<4), // visible
STATE_VISIBLE = (1<<4), // visible STATE_DEAD = (1<<5), // inaccessible (x)
STATE_DEAD = (1<<5), // inaccessible (x) STATE_DEFAULT = (1<<6), // actuated by RETURN
STATE_DEFAULT = (1<<6), // actuated by RETURN STATE_OKAY = (1<<7), // green point at the bottom right
STATE_OKAY = (1<<7), // green point at the bottom right STATE_SHADOW = (1<<8), // shadow
STATE_SHADOW = (1<<8), // shadow STATE_GLINT = (1<<9), // dynamic reflection
STATE_GLINT = (1<<9), // dynamic reflection STATE_CARD = (1<<10), // tab
STATE_CARD = (1<<10), // tab STATE_EXTEND = (1<<11), // extended mode
STATE_EXTEND = (1<<11), // extended mode STATE_SIMPLY = (1<<12), // undecorated
STATE_SIMPLY = (1<<12), // undecorated STATE_FRAME = (1<<13), // framework highlighting
STATE_FRAME = (1<<13), // framework highlighting STATE_WARNING = (1<<14), // framework hatched yellow / black
STATE_WARNING = (1<<14), // framework hatched yellow / black STATE_VALUE = (1<<15), // displays the value
STATE_VALUE = (1<<15), // displays the value STATE_RUN = (1<<16) // running program
STATE_RUN = (1<<16) // running program };
};
class CControl class CControl
{ {
public: public:
// CControl(CInstanceManager* iMan); // CControl(CInstanceManager* iMan);
CControl (); CControl ();
virtual ~CControl(); virtual ~CControl();
virtual bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType); virtual bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
virtual bool EventProcess(const Event &event); virtual bool EventProcess(const Event &event);
virtual void SetPos(Math::Point pos); virtual void SetPos(Math::Point pos);
virtual Math::Point GetPos(); virtual Math::Point GetPos();
virtual void SetDim(Math::Point dim); virtual void SetDim(Math::Point dim);
virtual Math::Point GetDim(); virtual Math::Point GetDim();
virtual bool SetState(int state, bool bState); virtual bool SetState(int state, bool bState);
virtual bool SetState(int state); virtual bool SetState(int state);
virtual bool ClearState(int state); virtual bool ClearState(int state);
virtual bool TestState(int state); virtual bool TestState(int state);
virtual int GetState(); virtual int GetState();
virtual void SetIcon(int icon); virtual void SetIcon(int icon);
virtual int GetIcon(); virtual int GetIcon();
virtual void SetName(std::string name, bool bTooltip=true); virtual void SetName(std::string name, bool bTooltip=true);
virtual std::string GetName(); virtual std::string GetName();
virtual void SetTextAlign(Gfx::TextAlign mode); virtual void SetTextAlign(Gfx::TextAlign mode);
virtual int GetTextAlign(); virtual int GetTextAlign();
virtual void SetFontSize(float size); virtual void SetFontSize(float size);
virtual float GetFontSize(); virtual float GetFontSize();
virtual void SetFontStretch(float stretch); virtual void SetFontStretch(float stretch);
virtual float GetFontStretch(); virtual float GetFontStretch();
virtual void SetFontType(Gfx::FontType font); virtual void SetFontType(Gfx::FontType font);
virtual Gfx::FontType GetFontType(); virtual Gfx::FontType GetFontType();
virtual bool SetTooltip(std::string name); virtual bool SetTooltip(std::string name);
virtual bool GetTooltip(Math::Point pos, std::string &name); virtual bool GetTooltip(Math::Point pos, std::string &name);
virtual void SetFocus(bool bFocus); virtual void SetFocus(bool bFocus);
virtual bool GetFocus(); virtual bool GetFocus();
virtual EventType GetEventType(); virtual EventType GetEventType();
virtual void Draw(); virtual void Draw();
protected: protected:
void GlintDelete(); void GlintDelete();
void GlintCreate(Math::Point ref, bool bLeft=true, bool bUp=true); void GlintCreate(Math::Point ref, bool bLeft=true, bool bUp=true);
void GlintFrame(const Event &event); void GlintFrame(const Event &event);
void DrawPart(int icon, float zoom, float ex); void DrawPart(int icon, float zoom, float ex);
void DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math::Point uv2, float ex=0.0f); void DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math::Point uv2, float ex=0.0f);
void DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math::Point uv2, Math::Point corner, float ex); void DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math::Point uv2, Math::Point corner, float ex);
void DrawWarning(Math::Point pos, Math::Point dim); void DrawWarning(Math::Point pos, Math::Point dim);
void DrawShadow(Math::Point pos, Math::Point dim, float deep=1.0f); void DrawShadow(Math::Point pos, Math::Point dim, float deep=1.0f);
virtual bool Detect(Math::Point pos); virtual bool Detect(Math::Point pos);
protected: protected:
CInstanceManager* m_iMan; CInstanceManager* m_iMan;
Gfx::CEngine* m_engine; Gfx::CEngine* m_engine;
CEventQueue* m_event; CEventQueue* m_event;
CRobotMain* m_main; CRobotMain* m_main;
Gfx::CParticle* m_particle; Gfx::CParticle* m_particle;
CSoundInterface* m_sound; CSoundInterface* m_sound;
Math::Point m_pos; // corner upper / left Math::Point m_pos; // corner upper / left
Math::Point m_dim; // dimensions Math::Point m_dim; // dimensions
int m_icon; int m_icon;
EventType m_eventType; // message to send when clicking EventType m_eventType; // message to send when clicking
int m_state; // states (STATE_ *) int m_state; // states (STATE_ *)
float m_fontSize; // size of the button name float m_fontSize; // size of the button name
float m_fontStretch; // stretch of the font float m_fontStretch; // stretch of the font
Gfx::FontType m_fontType; // type of font Gfx::FontType m_fontType; // type of font
Gfx::TextAlign m_textAlign; //type of alignment //comes in the place of m_justif Gfx::TextAlign m_textAlign; //type of alignment //comes in the place of m_justif
// int m_justif; // type of justification (-1,0,1) // int m_justif; // type of justification (-1,0,1)
std::string m_name; // name of the button std::string m_name; // name of the button
std::string m_tooltip; // name of tooltip std::string m_tooltip; // name of tooltip
bool m_bFocus; bool m_bFocus;
bool m_bCapture; bool m_bCapture;
bool m_bGlint;
Math::Point m_glintCorner1;
Math::Point m_glintCorner2;
float m_glintProgress;
Math::Point m_glintMouse;
};
bool m_bGlint;
Math::Point m_glintCorner1;
Math::Point m_glintCorner2;
float m_glintProgress;
Math::Point m_glintMouse;
};
} }

View File

@ -18,37 +18,32 @@
// displayinfo.cpp // displayinfo.cpp
//#include <windows.h> #include "displayinfo.h"
//#include <stdio.h>
//#include <d3d.h> #include "interface.h"
#include "button.h"
#include "slider.h"
#include "edit.h"
#include "group.h"
#include "window.h"
//#include "common/struct.h"
//#include "old/d3dengine.h"
//#include "old/d3dmath.h"
#include "graphics/engine/engine.h"
#include "common/language.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h" #include "common/iman.h"
#include "common/language.h"
#include "common/misc.h"
#include "common/restext.h" #include "common/restext.h"
//#include "old/math3d.h"
#include "object/robotmain.h" #include "graphics/core/light.h"
//#include "old/camera.h" #include "graphics/engine/engine.h"
#include "graphics/engine/lightman.h"
#include "graphics/engine/particle.h"
#include "object/object.h" #include "object/object.h"
#include "object/robotmain.h"
#include "object/motion/motion.h" #include "object/motion/motion.h"
#include "object/motion/motiontoto.h" #include "object/motion/motiontoto.h"
#include "ui/interface.h"
#include "ui/button.h"
#include "ui/slider.h"
#include "ui/edit.h"
#include "ui/group.h"
#include "ui/window.h"
//#include "old/particule.h"
#include "graphics/engine/particle.h"
//#include "old/light.h"
//#include "old/text.h"
#include "script/cbottoken.h" #include "script/cbottoken.h"
#include "ui/displayinfo.h"
@ -67,7 +62,7 @@ CDisplayInfo::CDisplayInfo()
m_main = static_cast <CRobotMain*> (m_iMan->SearchInstance(CLASS_MAIN)); m_main = static_cast <CRobotMain*> (m_iMan->SearchInstance(CLASS_MAIN));
m_camera = static_cast <Gfx::CCamera*> (m_iMan->SearchInstance(CLASS_CAMERA)); m_camera = static_cast <Gfx::CCamera*> (m_iMan->SearchInstance(CLASS_CAMERA));
m_particle = static_cast <Gfx::CParticle*> (m_iMan->SearchInstance(CLASS_PARTICULE)); m_particle = static_cast <Gfx::CParticle*> (m_iMan->SearchInstance(CLASS_PARTICULE));
m_light = static_cast <Gfx::CLight*> (m_iMan->SearchInstance(CLASS_LIGHT)); m_light = static_cast <Gfx::CLightManager*> (m_iMan->SearchInstance(CLASS_LIGHT));
m_bInfoMaximized = true; m_bInfoMaximized = true;
m_bInfoMinimized = false; m_bInfoMinimized = false;
@ -338,9 +333,9 @@ void CDisplayInfo::HyperUpdate()
// Beginning of the display of information. // Beginning of the display of information.
void CDisplayInfo::StartDisplayInfo(char *filename, int index, bool bSoluce) void CDisplayInfo::StartDisplayInfo(std::string filename, int index, bool bSoluce)
{ {
Gfx::CLight light; Gfx::Light light;
Math::Point pos, dim; Math::Point pos, dim;
Ui::CWindow* pw; Ui::CWindow* pw;
Ui::CEdit* edit; Ui::CEdit* edit;
@ -389,8 +384,8 @@ void CDisplayInfo::StartDisplayInfo(char *filename, int index, bool bSoluce)
edit->SetMaxChar(10000); edit->SetMaxChar(10000);
edit->SetFontType(Gfx::FONT_COLOBOT); edit->SetFontType(Gfx::FONT_COLOBOT);
edit->SetSoluceMode(bSoluce); edit->SetSoluceMode(bSoluce);
edit->ReadText(filename); edit->ReadText(filename.c_str());
edit->HyperHome(filename); edit->HyperHome(filename.c_str());
edit->SetEditCap(false); // just to see! edit->SetEditCap(false); // just to see!
edit->SetHiliteCap(false); edit->SetHiliteCap(false);
edit->SetFocus(true); edit->SetFocus(true);
@ -435,7 +430,7 @@ void CDisplayInfo::StartDisplayInfo(char *filename, int index, bool bSoluce)
button->SetState(STATE_SHADOW); button->SetState(STATE_SHADOW);
slider = pw->CreateSlider(pos, dim, 0, EVENT_STUDIO_SIZE); slider = pw->CreateSlider(pos, dim, 0, EVENT_STUDIO_SIZE);
slider->SetState(STATE_SHADOW); slider->SetState(STATE_SHADOW);
slider->SetVisibleValue((m_main->RetFontSize()-9.0f)/6.0f); slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/6.0f);
button = pw->CreateButton(pos, dim, 61, EVENT_HYPER_COPY); button = pw->CreateButton(pos, dim, 61, EVENT_HYPER_COPY);
button->SetState(STATE_SHADOW); button->SetState(STATE_SHADOW);
HyperUpdate(); HyperUpdate();
@ -464,16 +459,14 @@ void CDisplayInfo::StartDisplayInfo(char *filename, int index, bool bSoluce)
toto->StartDisplayInfo(); toto->StartDisplayInfo();
} }
} }
// TODO
ZeroMemory(&light, sizeof(light)); light.type = Gfx::LIGHT_DIRECTIONAL;
light.dltType = D3DLIGHT_DIRECTIONAL; light.diffuse = Gfx::Color(1.0f, 0.1f, 0.1f);
light.dcvDiffuse.r = 1.0f; light.direction = Math::Vector(1.0f, 0.0f, 1.0f);
light.dcvDiffuse.g = 1.0f;
light.dcvDiffuse.b = 1.0f;
light.dvDirection = D3DVECTOR(1.0f, 0.0f, 1.0f);
m_lightSuppl = m_light->CreateLight(); m_lightSuppl = m_light->CreateLight();
m_light->SetLight(m_lightSuppl, light); m_light->SetLight(m_lightSuppl, light);
m_light->SetLightExcluType(m_lightSuppl, TYPETERRAIN); m_light->SetLightExcludeType(m_lightSuppl, Gfx::ENG_OBJTYPE_TERRAIN);
} }
// Repositions all controls editing. // Repositions all controls editing.
@ -719,7 +712,7 @@ void CDisplayInfo::UpdateIndexButton()
if ( button != 0 ) if ( button != 0 )
{ {
button->SetState(STATE_CHECK, m_index==SATCOM_HUSTON); button->SetState(STATE_CHECK, m_index==SATCOM_HUSTON);
filename = m_main->RetDisplayInfoName(SATCOM_HUSTON); filename = m_main->GetDisplayInfoName(SATCOM_HUSTON);
button->SetState(STATE_VISIBLE, filename[0]!=0); button->SetState(STATE_VISIBLE, filename[0]!=0);
} }
@ -727,7 +720,7 @@ void CDisplayInfo::UpdateIndexButton()
if ( button != 0 ) if ( button != 0 )
{ {
button->SetState(STATE_CHECK, m_index==SATCOM_SAT); button->SetState(STATE_CHECK, m_index==SATCOM_SAT);
filename = m_main->RetDisplayInfoName(SATCOM_SAT); filename = m_main->GetDisplayInfoName(SATCOM_SAT);
button->SetState(STATE_VISIBLE, filename[0]!=0); button->SetState(STATE_VISIBLE, filename[0]!=0);
} }
@ -735,7 +728,7 @@ void CDisplayInfo::UpdateIndexButton()
//? if ( button != 0 ) //? if ( button != 0 )
//? { //? {
//? button->SetState(STATE_CHECK, m_index==SATCOM_OBJECT); //? button->SetState(STATE_CHECK, m_index==SATCOM_OBJECT);
//? filename = m_main->RetDisplayInfoName(SATCOM_OBJECT); //? filename = m_main->GetDisplayInfoName(SATCOM_OBJECT);
//? button->SetState(STATE_VISIBLE, filename[0]!=0); //? button->SetState(STATE_VISIBLE, filename[0]!=0);
//? } //? }
@ -744,7 +737,7 @@ void CDisplayInfo::UpdateIndexButton()
if ( button != 0 ) if ( button != 0 )
{ {
button->SetState(STATE_CHECK, m_index==SATCOM_LOADING); button->SetState(STATE_CHECK, m_index==SATCOM_LOADING);
loading = m_main->RetDisplayInfoName(SATCOM_LOADING); loading = m_main->GetDisplayInfoName(SATCOM_LOADING);
button->SetState(STATE_VISIBLE, loading[0]!=0); button->SetState(STATE_VISIBLE, loading[0]!=0);
} }
@ -752,7 +745,7 @@ void CDisplayInfo::UpdateIndexButton()
if ( button != 0 ) if ( button != 0 )
{ {
button->SetState(STATE_CHECK, m_index==SATCOM_PROG); button->SetState(STATE_CHECK, m_index==SATCOM_PROG);
filename = m_main->RetDisplayInfoName(SATCOM_PROG); filename = m_main->GetDisplayInfoName(SATCOM_PROG);
button->SetState(STATE_VISIBLE, filename[0]!=0 && (m_index==SATCOM_LOADING||m_index==SATCOM_PROG||(loading!=0&&loading[0]==0))); button->SetState(STATE_VISIBLE, filename[0]!=0 && (m_index==SATCOM_LOADING||m_index==SATCOM_PROG||(loading!=0&&loading[0]==0)));
} }
@ -760,7 +753,7 @@ void CDisplayInfo::UpdateIndexButton()
if ( button != 0 ) if ( button != 0 )
{ {
button->SetState(STATE_CHECK, m_index==SATCOM_SOLUCE); button->SetState(STATE_CHECK, m_index==SATCOM_SOLUCE);
filename = m_main->RetDisplayInfoName(SATCOM_SOLUCE); filename = m_main->GetDisplayInfoName(SATCOM_SOLUCE);
button->SetState(STATE_VISIBLE, filename[0]!=0 && m_bSoluce); button->SetState(STATE_VISIBLE, filename[0]!=0 && m_bSoluce);
} }
@ -858,12 +851,12 @@ void CDisplayInfo::StopDisplayInfo()
m_engine->SetDrawWorld(true); // draws all on the interface m_engine->SetDrawWorld(true); // draws all on the interface
m_engine->SetDrawFront(false); // draws nothing on the interface m_engine->SetDrawFront(false); // draws nothing on the interface
m_particle->SetFrameUpdate(Gfx::SH_WORLD, true); m_particle->SetFrameUpdate(Gfx::SH_WORLD, true);
m_particle->FlushParticule(Gfx::SH_FRONT); m_particle->FlushParticle(Gfx::SH_FRONT);
m_particle->FlushParticule(Gfx::SH_INTERFACE); m_particle->FlushParticle(Gfx::SH_INTERFACE);
if ( m_toto != 0 ) if ( m_toto != 0 )
{ {
toto = (CMotionToto*)m_toto->GetMotion(); toto = static_cast<CMotionToto*>(m_toto->GetMotion());
if ( toto != 0 ) if ( toto != 0 )
{ {
toto->StopDisplayInfo(); toto->StopDisplayInfo();
@ -915,7 +908,7 @@ void CDisplayInfo::ViewDisplayInfo()
{ {
Ui::CWindow* pw; Ui::CWindow* pw;
Ui::CEdit* edit; Ui::CEdit* edit;
Math::Point dim; Math::IntPoint dim;
pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4)); pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw == 0 ) return; if ( pw == 0 ) return;
@ -923,7 +916,7 @@ void CDisplayInfo::ViewDisplayInfo()
edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1)); edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit == 0 ) return; if ( edit == 0 ) return;
dim = m_engine->GetDim(); dim = m_engine->GetWindowSize();
edit->SetFontSize(m_main->GetFontSize()/(dim.x / 640.0f)); edit->SetFontSize(m_main->GetFontSize()/(dim.x / 640.0f));
} }

View File

@ -19,83 +19,81 @@
#pragma once #pragma once
#include <string>
#include "common/struct.h" #include "common/event.h"
#include "old/camera.h"
#include "graphics/engine/camera.h"
class CInstanceManager; class CInstanceManager;
//class CD3DEngine;
class CEvent;
class CRobotMain; class CRobotMain;
//class CCamera;
class CObject; class CObject;
//class CLight; class CEventQueue;
struct Event;
namespace Gfx { namespace Gfx {
class CEngine; class CEngine;
class Camera; class CParticle;
class Particle; class CLightManager;
class CLight;
} }
namespace Ui { namespace Ui {
class CInterface; class CInterface;
class CDisplayInfo class CDisplayInfo
{ {
public: public:
// CDisplayInfo(CInstanceManager* iMan); // CDisplayInfo(CInstanceManager* iMan);
CDisplayInfo(); CDisplayInfo();
~CDisplayInfo(); ~CDisplayInfo();
bool EventProcess(const Event &event); bool EventProcess(const Event &event);
void StartDisplayInfo(char *filename, int index, bool bSoluce); void StartDisplayInfo(std::string filename, int index, bool bSoluce);
void StopDisplayInfo(); void StopDisplayInfo();
void SetPosition(int pos); void SetPosition(int pos);
int GetPosition(); int GetPosition();
protected: protected:
bool EventFrame(const Event &event); bool EventFrame(const Event &event);
void HyperUpdate(); void HyperUpdate();
void AdjustDisplayInfo(Math::Point wpos, Math::Point wdim); void AdjustDisplayInfo(Math::Point wpos, Math::Point wdim);
void ChangeIndexButton(int index); void ChangeIndexButton(int index);
void UpdateIndexButton(); void UpdateIndexButton();
void UpdateCopyButton(); void UpdateCopyButton();
void ViewDisplayInfo(); void ViewDisplayInfo();
CObject* SearchToto(); CObject* SearchToto();
void CreateObjectsFile(); void CreateObjectsFile();
protected: protected:
CInstanceManager* m_iMan; CInstanceManager* m_iMan;
Gfx::CEngine* m_engine; Gfx::CEngine* m_engine;
CEventQueue* m_event; CEventQueue* m_event;
CRobotMain* m_main; CRobotMain* m_main;
Gfx::CCamera* m_camera; Gfx::CCamera* m_camera;
CInterface* m_interface; CInterface* m_interface;
Gfx::CParticle* m_particle; Gfx::CParticle* m_particle;
Gfx::CLight* m_light; Gfx::CLightManager* m_light;
bool m_bInfoMaximized; bool m_bInfoMaximized;
bool m_bInfoMinimized; bool m_bInfoMinimized;
int m_index; int m_index;
Gfx::CameraType m_infoCamera; Gfx::CameraType m_infoCamera;
Math::Point m_infoNormalPos; Math::Point m_infoNormalPos;
Math::Point m_infoNormalDim; Math::Point m_infoNormalDim;
Math::Point m_infoActualPos; Math::Point m_infoActualPos;
Math::Point m_infoActualDim; Math::Point m_infoActualDim;
Math::Point m_infoFinalPos; Math::Point m_infoFinalPos;
Math::Point m_infoFinalDim; Math::Point m_infoFinalDim;
int m_lightSuppl; int m_lightSuppl;
bool m_bEditLock; bool m_bEditLock;
bool m_bInitPause; bool m_bInitPause;
bool m_bSoluce; bool m_bSoluce;
CObject* m_toto; CObject* m_toto;
}; };
} }

View File

@ -18,29 +18,26 @@
// displaytext.cpp // displaytext.cpp
//#include <windows.h> #include "displaytext.h"
//#include <stdio.h>
//#include <d3d.h> #include "interface.h"
#include "button.h"
#include "label.h"
#include "window.h"
#include "group.h"
//#include "common/struct.h"
//#include "old/d3dengine.h"
#include "graphics/engine/engine.h"
#include "common/event.h" #include "common/event.h"
#include "common/iman.h"
#include "common/misc.h" #include "common/misc.h"
#include "common/restext.h" #include "common/restext.h"
#include "common/iman.h"
#include "graphics/engine/engine.h"
#include "object/object.h" #include "object/object.h"
#include "object/motion/motion.h" #include "object/motion/motion.h"
#include "object/motion/motiontoto.h" #include "object/motion/motiontoto.h"
#include "ui/interface.h"
#include "ui/button.h"
#include "ui/label.h"
#include "ui/window.h"
#include "ui/group.h"
//#include "old/text.h"
//#include "old/sound.h"
//#include "sound/sound.h"
#include "ui/displaytext.h"
namespace Ui { namespace Ui {

View File

@ -22,8 +22,9 @@
#include "common/event.h" #include "common/event.h"
#include "common/misc.h" #include "common/misc.h"
#include "sound/sound.h" #include "sound/sound.h"
//#include "old/d3dengine.h"
class CInstanceManager; class CInstanceManager;
@ -31,6 +32,10 @@ class CInstanceManager;
class CObject; class CObject;
class CSound; class CSound;
namespace Gfx {
class CEngine;
}
namespace Ui {; namespace Ui {;
class CInterface; class CInterface;

View File

@ -18,7 +18,7 @@
// edit.cpp // edit.cpp
#include <ui/edit.h> #include "edit.h"
namespace Ui { namespace Ui {

View File

@ -17,16 +17,7 @@
// maindialog.cpp // maindialog.cpp
#include <windows.h>
#include <stdio.h>
#include <time.h>
#include <direct.h>
#include <io.h>
#include <d3d.h>
#include "common/struct.h" #include "common/struct.h"
#include "old/d3dengine.h"
#include "old/d3dmath.h"
#include "common/global.h" #include "common/global.h"
#include "common/language.h" #include "common/language.h"
#include "common/event.h" #include "common/event.h"
@ -34,8 +25,6 @@
#include "common/profile.h" #include "common/profile.h"
#include "common/iman.h" #include "common/iman.h"
#include "common/restext.h" #include "common/restext.h"
#include "old/math3d.h"
#include "old/particule.h"
#include "ui/interface.h" #include "ui/interface.h"
#include "ui/button.h" #include "ui/button.h"
#include "ui/color.h" #include "ui/color.h"
@ -50,9 +39,6 @@
#include "ui/window.h" #include "ui/window.h"
#include "ui/edit.h" #include "ui/edit.h"
#include "ui/editvalue.h" #include "ui/editvalue.h"
#include "old/text.h"
#include "old/camera.h"
#include "old/sound.h"
#include "script/cmdtoken.h" #include "script/cmdtoken.h"
#include "object/robotmain.h" #include "object/robotmain.h"
#include "ui/maindialog.h" #include "ui/maindialog.h"

View File

@ -20,7 +20,6 @@
#include "common/struct.h" #include "common/struct.h"
#include "old/camera.h"
#include "object/robotmain.h" #include "object/robotmain.h"

View File

@ -18,7 +18,9 @@
// map.cpp // map.cpp
#include <ui/map.h> #include "map.h"
namespace Ui { namespace Ui {

View File

@ -18,7 +18,9 @@
// studio.cpp // studio.cpp
#include <ui/studio.h> #include "studio.h"
#include <script/cbottoken.h>
namespace Ui { namespace Ui {
@ -36,6 +38,7 @@ CStudio::CStudio()
m_main = static_cast<CRobotMain*>(m_iMan->SearchInstance(CLASS_MAIN)); m_main = static_cast<CRobotMain*>(m_iMan->SearchInstance(CLASS_MAIN));
m_camera = static_cast<CCamera*>(m_iMan->SearchInstance(CLASS_CAMERA)); m_camera = static_cast<CCamera*>(m_iMan->SearchInstance(CLASS_CAMERA));
m_sound = static_cast<CSoundInterface*>(m_iMan->SearchInstance(CLASS_SOUND)); m_sound = static_cast<CSoundInterface*>(m_iMan->SearchInstance(CLASS_SOUND));
m_app = CApplication::GetInstancePointer();
m_bEditMaximized = false; m_bEditMaximized = false;
m_bEditMinimized = false; m_bEditMinimized = false;
@ -76,15 +79,15 @@ bool CStudio::EventProcess(const Event &event)
} }
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
if ( pw == 0 ) return false; if ( pw == nullptr ) return false;
edit = (CEdit*)pw->SearchControl(EVENT_STUDIO_EDIT); edit = static_cast<CEdit*>(pw->SearchControl(EVENT_STUDIO_EDIT));
if ( edit == 0 ) return false; if ( edit == 0 ) return false;
if ( event.type == pw->GetEventTypeClose() ) if ( event.type == pw->GetEventTypeClose() )
{ {
Event newEvent = event; Event newEvent = event;
newEvent.event = EVENT_STUDIO_OK; newEvent.type = EVENT_STUDIO_OK;
m_event->AddEvent(newEvent); m_event->AddEvent(newEvent);
} }
@ -95,7 +98,7 @@ bool CStudio::EventProcess(const Event &event)
if ( event.type == EVENT_STUDIO_LIST ) // list clicked? if ( event.type == EVENT_STUDIO_LIST ) // list clicked?
{ {
m_main->StartDisplayInfo(m_helpFilename, -1); m_main->StartDisplayInfo(const_cast<char *>(m_helpFilename.c_str()), -1); // TODO change to std::string when RobotMain changes
} }
if ( event.type == EVENT_STUDIO_NEW ) // new? if ( event.type == EVENT_STUDIO_NEW ) // new?
@ -169,7 +172,7 @@ bool CStudio::EventProcess(const Event &event)
if ( m_script->IsRunning() ) if ( m_script->IsRunning() )
{ {
Event newEvent = event; Event newEvent = event;
newEvent.event = EVENT_OBJECT_PROGSTOP; newEvent.type = EVENT_OBJECT_PROGSTOP;
m_event->AddEvent(newEvent); // stop m_event->AddEvent(newEvent); // stop
} }
else else
@ -179,7 +182,7 @@ bool CStudio::EventProcess(const Event &event)
SetInfoText("", false); SetInfoText("", false);
Event newEvent = event; Event newEvent = event;
newEvent.event = EVENT_OBJECT_PROGSTART; newEvent.type = EVENT_OBJECT_PROGSTART;
m_event->AddEvent(newEvent); // start m_event->AddEvent(newEvent); // start
} }
else else
@ -204,14 +207,14 @@ bool CStudio::EventProcess(const Event &event)
m_script->Step(event); m_script->Step(event);
} }
if ( event.type == EVENT_KEYDOWN ) if ( event.type == EVENT_KEY_DOWN )
{ {
if ( event.param == m_engine->GetKey(KEYRANK_CBOT, 0) || if ( event.param == m_app->GetKey(KEYRANK_CBOT, 0) ||
event.param == m_engine->GetKey(KEYRANK_CBOT, 1) ) event.param == m_app->GetKey(KEYRANK_CBOT, 1) )
{ {
if ( m_helpFilename[0] != 0 ) if ( m_helpFilename.length() > 0 )
{ {
m_main->StartDisplayInfo(m_helpFilename, -1); m_main->StartDisplayInfo(const_cast<char *>(m_helpFilename.c_str()), -1); // TODO change to std::string when RobotMain changes
} }
} }
} }
@ -244,7 +247,7 @@ bool CStudio::EventProcess(const Event &event)
} }
m_main->SetEditFull(m_bEditMaximized); m_main->SetEditFull(m_bEditMaximized);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
if ( pw != 0 ) if ( pw != nullptr )
{ {
pw->SetMaximized(m_bEditMaximized); pw->SetMaximized(m_bEditMaximized);
pw->SetMinimized(m_bEditMinimized); pw->SetMinimized(m_bEditMinimized);
@ -270,7 +273,7 @@ bool CStudio::EventProcess(const Event &event)
} }
m_main->SetEditFull(m_bEditMaximized); m_main->SetEditFull(m_bEditMaximized);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
if ( pw != 0 ) if ( pw != nullptr )
{ {
pw->SetMaximized(m_bEditMaximized); pw->SetMaximized(m_bEditMaximized);
pw->SetMinimized(m_bEditMinimized); pw->SetMinimized(m_bEditMinimized);
@ -316,7 +319,7 @@ bool CStudio::EventFrame(const Event &event)
m_fixInfoTextTime -= event.rTime; m_fixInfoTextTime -= event.rTime;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
if ( pw == 0 ) return false; if ( pw == nullptr ) return false;
edit = (CEdit*)pw->SearchControl(EVENT_STUDIO_EDIT); edit = (CEdit*)pw->SearchControl(EVENT_STUDIO_EDIT);
if ( edit == 0 ) return false; if ( edit == 0 ) return false;
@ -330,10 +333,10 @@ bool CStudio::EventFrame(const Event &event)
UpdateFlux(); // stop UpdateFlux(); // stop
AdjustEditScript(); AdjustEditScript();
GetResource(RES_TEXT, RT_STUDIO_PROGSTOP, res); GetResource(RES_TEXT, RT_STUDIO_PROGSTOP, res);
SetInfoText(res, false); SetInfoText(std::string(res), false);
Event newEvent = event; Event newEvent = event;
newEvent.event = EVENT_OBJECT_PROGSTOP; newEvent.type = EVENT_OBJECT_PROGSTOP;
m_event->AddEvent(newEvent); // stop m_event->AddEvent(newEvent); // stop
} }
@ -386,7 +389,7 @@ bool IsToken(int character)
{ {
char c; char c;
c = tolower(RetNoAccent(character)); c = tolower(GetNoAccent(character));
return ( (c >= 'a' && c <= 'z') || return ( (c >= 'a' && c <= 'z') ||
(c >= '0' && c <= '9') || (c >= '0' && c <= '9') ||
@ -466,8 +469,8 @@ void CStudio::SearchToken(CEdit* edit)
} }
token[i] = 0; token[i] = 0;
strcpy(m_helpFilename, GetHelpFilename(token)); m_helpFilename = std::string(GetHelpFilename(token));
if ( m_helpFilename[0] == 0 ) if ( m_helpFilename.length() == 0 )
{ {
for ( i=0 ; i<OBJECT_MAX ; i++ ) for ( i=0 ; i<OBJECT_MAX ; i++ )
{ {
@ -477,28 +480,28 @@ void CStudio::SearchToken(CEdit* edit)
{ {
if ( strcmp(token, text) == 0 ) if ( strcmp(token, text) == 0 )
{ {
strcpy(m_helpFilename, GetHelpFilename(type)); m_helpFilename = GetHelpFilename(type);
SetInfoText(token, true); SetInfoText(std::string(token), true);
return; return;
} }
} }
text = RetObjectAlias(type); text = GetObjectAlias(type);
if ( text[0] != 0 ) if ( text[0] != 0 )
{ {
if ( strcmp(token, text) == 0 ) if ( strcmp(token, text) == 0 )
{ {
strcpy(m_helpFilename, GetHelpFilename(type)); m_helpFilename = GetHelpFilename(type);
SetInfoText(token, true); SetInfoText(std::string(token), true);
return; return;
} }
} }
} }
} }
text = RetHelpText(token); text = GetHelpText(token);
if ( text[0] == 0 && m_helpFilename[0] != 0 ) if ( text[0] == 0 && m_helpFilename.length() > 0 )
{ {
SetInfoText(token, true); SetInfoText(std::string(token), true);
} }
else else
{ {
@ -516,7 +519,7 @@ void CStudio::ColorizeScript(CEdit* edit)
// Starts editing a program. // Starts editing a program.
void CStudio::StartEditScript(CScript *script, char* name, int rank) void CStudio::StartEditScript(CScript *script, std::string name, int rank)
{ {
Math::Point pos, dim; Math::Point pos, dim;
CWindow* pw; CWindow* pw;
@ -534,7 +537,7 @@ void CStudio::StartEditScript(CScript *script, char* name, int rank)
m_bInitPause = m_engine->GetPause(); m_bInitPause = m_engine->GetPause();
m_main->SetSpeed(1.0f); m_main->SetSpeed(1.0f);
m_editCamera = m_camera->GetType(); m_editCamera = m_camera->GetType();
m_camera->SetType(CAMERA_EDIT); m_camera->SetType(CAM_TYPE_EDIT);
m_bRunning = m_script->IsRunning(); m_bRunning = m_script->IsRunning();
m_bRealTime = m_bRunning; m_bRealTime = m_bRunning;
@ -549,7 +552,7 @@ void CStudio::StartEditScript(CScript *script, char* name, int rank)
pos = m_editFinalPos = m_editActualPos = m_main->GetWindowPos(); pos = m_editFinalPos = m_editActualPos = m_main->GetWindowPos();
dim = m_editFinalDim = m_editActualDim = m_main->GetWindowDim(); dim = m_editFinalDim = m_editActualDim = m_main->GetWindowDim();
pw = m_interface->CreateWindows(pos, dim, 8, EVENT_WINDOW3); pw = m_interface->CreateWindows(pos, dim, 8, EVENT_WINDOW3);
if ( pw == 0 ) return; if ( pw == nullptr ) return;
pw->SetState(STATE_SHADOW); pw->SetState(STATE_SHADOW);
pw->SetRedim(true); // before SetName! pw->SetRedim(true); // before SetName!
pw->SetMovable(true); pw->SetMovable(true);
@ -567,7 +570,7 @@ void CStudio::StartEditScript(CScript *script, char* name, int rank)
edit->SetInsideScroll(false); edit->SetInsideScroll(false);
//? if ( m_bRunning ) edit->SetEdit(false); //? if ( m_bRunning ) edit->SetEdit(false);
edit->SetMaxChar(EDITSTUDIOMAX); edit->SetMaxChar(EDITSTUDIOMAX);
edit->SetFontType(FONT_COURIER); edit->SetFontType(Gfx::FONT_COURIER);
edit->SetFontStretch(0.7f); edit->SetFontStretch(0.7f);
edit->SetDisplaySpec(true); edit->SetDisplaySpec(true);
edit->SetAutoIndent(m_engine->GetEditIndentMode()); edit->SetAutoIndent(m_engine->GetEditIndentMode());
@ -578,7 +581,7 @@ void CStudio::StartEditScript(CScript *script, char* name, int rank)
list = pw->CreateList(pos, dim, 1, EVENT_STUDIO_LIST, 1.2f); list = pw->CreateList(pos, dim, 1, EVENT_STUDIO_LIST, 1.2f);
list->SetState(STATE_SHADOW); list->SetState(STATE_SHADOW);
list->SetFontType(FONT_COURIER); list->SetFontType(Gfx::FONT_COURIER);
list->SetSelectCap(false); list->SetSelectCap(false);
list->SetFontSize(SMALLFONT*0.85f); list->SetFontSize(SMALLFONT*0.85f);
//? list->SetFontStretch(1.0f); //? list->SetFontStretch(1.0f);
@ -641,7 +644,7 @@ void CStudio::AdjustEditScript()
wdim = m_editActualDim; wdim = m_editActualDim;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
if ( pw != 0 ) if ( pw != nullptr )
{ {
pw->SetPos(wpos); pw->SetPos(wpos);
pw->SetDim(wdim); pw->SetDim(wdim);
@ -819,7 +822,7 @@ bool CStudio::StopEditScript(bool bCancel)
char buffer[100]; char buffer[100];
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
if ( pw == 0 ) return false; if ( pw == nullptr ) return false;
if ( !bCancel && !m_script->IsRunning() ) if ( !bCancel && !m_script->IsRunning() )
{ {
@ -865,7 +868,7 @@ void CStudio::SetInfoText(char *text, bool bClickable)
if ( !bClickable ) m_fixInfoTextTime = 8.0f; if ( !bClickable ) m_fixInfoTextTime = 8.0f;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
if ( pw == 0 ) return; if ( pw == nullptr ) return;
list = (CList*)pw->SearchControl(EVENT_STUDIO_LIST); list = (CList*)pw->SearchControl(EVENT_STUDIO_LIST);
if ( list == 0 ) return; if ( list == 0 ) return;
@ -900,7 +903,7 @@ void CStudio::ViewEditScript()
POINT dim; POINT dim;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
if ( pw == 0 ) return; if ( pw == nullptr ) return;
edit = (CEdit*)pw->SearchControl(EVENT_STUDIO_EDIT); edit = (CEdit*)pw->SearchControl(EVENT_STUDIO_EDIT);
if ( edit == 0 ) return; if ( edit == 0 ) return;
@ -948,7 +951,7 @@ void CStudio::UpdateButtons()
CButton* button; CButton* button;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
if ( pw == 0 ) return; if ( pw == nullptr ) return;
edit = (CEdit*)pw->SearchControl(EVENT_STUDIO_EDIT); edit = (CEdit*)pw->SearchControl(EVENT_STUDIO_EDIT);
if ( edit == 0 ) return; if ( edit == 0 ) return;
@ -1001,31 +1004,31 @@ void CStudio::StartDialog(StudioDialog type)
m_dialog = type; m_dialog = type;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
if ( pw != 0 ) pw->ClearState(STATE_ENABLE); if ( pw != nullptr ) pw->ClearState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW1); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW1);
if ( pw != 0 ) pw->ClearState(STATE_ENABLE); if ( pw != nullptr ) pw->ClearState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
if ( pw != 0 ) pw->ClearState(STATE_ENABLE); if ( pw != nullptr ) pw->ClearState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
if ( pw != 0 ) pw->ClearState(STATE_ENABLE); if ( pw != nullptr ) pw->ClearState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
if ( pw != 0 ) pw->ClearState(STATE_ENABLE); if ( pw != nullptr ) pw->ClearState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
if ( pw != 0 ) pw->ClearState(STATE_ENABLE); if ( pw != nullptr ) pw->ClearState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW6); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW6);
if ( pw != 0 ) pw->ClearState(STATE_ENABLE); if ( pw != nullptr ) pw->ClearState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW7); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW7);
if ( pw != 0 ) pw->ClearState(STATE_ENABLE); if ( pw != nullptr ) pw->ClearState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW8); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW8);
if ( pw != 0 ) pw->ClearState(STATE_ENABLE); if ( pw != nullptr ) pw->ClearState(STATE_ENABLE);
if ( m_dialog == SD_OPEN || if ( m_dialog == SD_OPEN ||
m_dialog == SD_SAVE ) m_dialog == SD_SAVE )
@ -1051,14 +1054,14 @@ void CStudio::StartDialog(StudioDialog type)
{ {
GetResource(RES_TEXT, RT_IO_LIST, name); GetResource(RES_TEXT, RT_IO_LIST, name);
pla = pw->CreateLabel(pos, dim, 0, EVENT_DIALOG_LABEL1, name); pla = pw->CreateLabel(pos, dim, 0, EVENT_DIALOG_LABEL1, name);
pla->SetJustif(1); pla->SetTextAlign(1);
pli = pw->CreateList(pos, dim, 0, EVENT_DIALOG_LIST); pli = pw->CreateList(pos, dim, 0, EVENT_DIALOG_LIST);
pli->SetState(STATE_SHADOW); pli->SetState(STATE_SHADOW);
GetResource(RES_TEXT, RT_IO_NAME, name); GetResource(RES_TEXT, RT_IO_NAME, name);
pla = pw->CreateLabel(pos, dim, 0, EVENT_DIALOG_LABEL2, name); pla = pw->CreateLabel(pos, dim, 0, EVENT_DIALOG_LABEL2, name);
pla->SetJustif(1); pla->SetTextAlign(1);
pe = pw->CreateEdit(pos, dim, 0, EVENT_DIALOG_EDIT); pe = pw->CreateEdit(pos, dim, 0, EVENT_DIALOG_EDIT);
pe->SetState(STATE_SHADOW); pe->SetState(STATE_SHADOW);
@ -1069,7 +1072,7 @@ void CStudio::StartDialog(StudioDialog type)
GetResource(RES_TEXT, RT_IO_DIR, name); GetResource(RES_TEXT, RT_IO_DIR, name);
pla = pw->CreateLabel(pos, dim, 0, EVENT_DIALOG_LABEL3, name); pla = pw->CreateLabel(pos, dim, 0, EVENT_DIALOG_LABEL3, name);
pla->SetJustif(1); pla->SetTextAlign(1);
pc = pw->CreateCheck(pos, dim, 0, EVENT_DIALOG_CHECK1); pc = pw->CreateCheck(pos, dim, 0, EVENT_DIALOG_CHECK1);
GetResource(RES_TEXT, RT_IO_PRIVATE, name); GetResource(RES_TEXT, RT_IO_PRIVATE, name);
@ -1120,31 +1123,31 @@ void CStudio::StopDialog()
m_dialog = SD_NULL; m_dialog = SD_NULL;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
if ( pw != 0 ) pw->SetState(STATE_ENABLE); if ( pw != nullptr ) pw->SetState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW1); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW1);
if ( pw != 0 ) pw->SetState(STATE_ENABLE); if ( pw != nullptr ) pw->SetState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
if ( pw != 0 ) pw->SetState(STATE_ENABLE); if ( pw != nullptr ) pw->SetState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
if ( pw != 0 ) pw->SetState(STATE_ENABLE); if ( pw != nullptr ) pw->SetState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
if ( pw != 0 ) pw->SetState(STATE_ENABLE); if ( pw != nullptr ) pw->SetState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
if ( pw != 0 ) pw->SetState(STATE_ENABLE); if ( pw != nullptr ) pw->SetState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW6); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW6);
if ( pw != 0 ) pw->SetState(STATE_ENABLE); if ( pw != nullptr ) pw->SetState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW7); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW7);
if ( pw != 0 ) pw->SetState(STATE_ENABLE); if ( pw != nullptr ) pw->SetState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW8); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW8);
if ( pw != 0 ) pw->SetState(STATE_ENABLE); if ( pw != nullptr ) pw->SetState(STATE_ENABLE);
m_interface->DeleteControl(EVENT_WINDOW9); m_interface->DeleteControl(EVENT_WINDOW9);
m_main->SetSatComLock(false); // possible to use the SatCom m_main->SetSatComLock(false); // possible to use the SatCom
@ -1165,7 +1168,7 @@ void CStudio::AdjustDialog()
char name[100]; char name[100];
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9);
if ( pw == 0 ) return; if ( pw == nullptr ) return;
wpos = pw->GetPos(); wpos = pw->GetPos();
wdim = pw->GetDim(); wdim = pw->GetDim();
@ -1283,7 +1286,7 @@ bool CStudio::EventDialog(const Event &event)
Math::Point wpos, wdim; Math::Point wpos, wdim;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9);
if ( pw == 0 ) return false; if ( pw == nullptr ) return false;
if ( event.type == EVENT_WINDOW9 ) // window is moved? if ( event.type == EVENT_WINDOW9 ) // window is moved?
{ {
@ -1358,11 +1361,11 @@ void CStudio::UpdateChangeList()
char* p; char* p;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9);
if ( pw == 0 ) return; if ( pw == nullptr ) return;
pl = (CList*)pw->SearchControl(EVENT_DIALOG_LIST); pl = (CList*)pw->SearchControl(EVENT_DIALOG_LIST);
if ( pl == 0 ) return; if ( pl == 0 ) return;
pe = (CEdit*)pw->SearchControl(EVENT_DIALOG_EDIT); pe = (CEdit*)pw->SearchControl(EVENT_DIALOG_EDIT);
if ( pe == 0 ) return; if ( pe == nullptr ) return;
strcpy(name, pl->GetName(pl->GetSelect())); strcpy(name, pl->GetName(pl->GetSelect()));
name[pe->GetMaxChar()] = 0; // truncates according lg max editable name[pe->GetMaxChar()] = 0; // truncates according lg max editable
@ -1383,7 +1386,7 @@ void CStudio::UpdateChangeEdit()
CList* pl; CList* pl;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9);
if ( pw == 0 ) return; if ( pw == nullptr ) return;
pl = (CList*)pw->SearchControl(EVENT_DIALOG_LIST); pl = (CList*)pw->SearchControl(EVENT_DIALOG_LIST);
if ( pl == 0 ) return; if ( pl == 0 ) return;
@ -1404,9 +1407,9 @@ void CStudio::UpdateDialogAction()
bool bError; bool bError;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9);
if ( pw == 0 ) return; if ( pw == nullptr ) return;
pe = (CEdit*)pw->SearchControl(EVENT_DIALOG_EDIT); pe = (CEdit*)pw->SearchControl(EVENT_DIALOG_EDIT);
if ( pe == 0 ) return; if ( pe == nullptr ) return;
pb = (CButton*)pw->SearchControl(EVENT_DIALOG_OK); pb = (CButton*)pw->SearchControl(EVENT_DIALOG_OK);
if ( pb == 0 ) return; if ( pb == 0 ) return;
@ -1448,7 +1451,7 @@ void CStudio::UpdateDialogPublic()
char text[_MAX_FNAME+100]; char text[_MAX_FNAME+100];
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9);
if ( pw == 0 ) return; if ( pw == nullptr ) return;
pc = (CCheck*)pw->SearchControl(EVENT_DIALOG_CHECK1); pc = (CCheck*)pw->SearchControl(EVENT_DIALOG_CHECK1);
if ( pc != 0 ) if ( pc != 0 )
@ -1476,7 +1479,8 @@ void CStudio::UpdateDialogPublic()
void CStudio::UpdateDialogList() void CStudio::UpdateDialogList()
{ {
CWindow* pw; // TODO rewrite to multiplatform
/*CWindow* pw;
CList* pl; CList* pl;
long hFile; long hFile;
struct _finddata_t fileBuffer; struct _finddata_t fileBuffer;
@ -1487,7 +1491,7 @@ void CStudio::UpdateDialogList()
int nbFilenames, i; int nbFilenames, i;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9);
if ( pw == 0 ) return; if ( pw == nullptr ) return;
pl = (CList*)pw->SearchControl(EVENT_DIALOG_LIST); pl = (CList*)pw->SearchControl(EVENT_DIALOG_LIST);
if ( pl == 0 ) return; if ( pl == 0 ) return;
pl->Flush(); pl->Flush();
@ -1532,7 +1536,7 @@ void CStudio::UpdateDialogList()
pl->SetName(i, temp); pl->SetName(i, temp);
} }
free(listBuffer); free(listBuffer);*/
} }
// Constructs the name of the folder or open/save. // Constructs the name of the folder or open/save.
@ -1566,10 +1570,10 @@ bool CStudio::ReadProgram()
char* p; char* p;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9);
if ( pw == 0 ) return false; if ( pw == nullptr ) return false;
pe = (CEdit*)pw->SearchControl(EVENT_DIALOG_EDIT); pe = (CEdit*)pw->SearchControl(EVENT_DIALOG_EDIT);
if ( pe == 0 ) return false; if ( pe == nullptr ) return false;
pe->GetText(filename, 100); pe->GetText(filename, 100);
if ( filename[0] == 0 ) return false; if ( filename[0] == 0 ) return false;
@ -1582,9 +1586,9 @@ bool CStudio::ReadProgram()
strcat(dir, filename); strcat(dir, filename);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
if ( pw == 0 ) return false; if ( pw == nullptr ) return false;
pe = (CEdit*)pw->SearchControl(EVENT_STUDIO_EDIT); pe = (CEdit*)pw->SearchControl(EVENT_STUDIO_EDIT);
if ( pe == 0 ) return false; if ( pe == nullptr ) return false;
if ( !pe->ReadText(dir) ) return false; if ( !pe->ReadText(dir) ) return false;
@ -1604,10 +1608,10 @@ bool CStudio::WriteProgram()
char* p; char* p;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9);
if ( pw == 0 ) return false; if ( pw == nullptr ) return false;
pe = (CEdit*)pw->SearchControl(EVENT_DIALOG_EDIT); pe = (CEdit*)pw->SearchControl(EVENT_DIALOG_EDIT);
if ( pe == 0 ) return false; if ( pe == nullptr ) return false;
pe->GetText(filename, 100); pe->GetText(filename, 100);
if ( filename[0] == 0 ) return false; if ( filename[0] == 0 ) return false;
@ -1620,9 +1624,9 @@ bool CStudio::WriteProgram()
strcat(dir, filename); strcat(dir, filename);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3); pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
if ( pw == 0 ) return false; if ( pw == nullptr ) return false;
pe = (CEdit*)pw->SearchControl(EVENT_STUDIO_EDIT); pe = (CEdit*)pw->SearchControl(EVENT_STUDIO_EDIT);
if ( pe == 0 ) return false; if ( pe == nullptr ) return false;
if ( !pe->WriteText(dir) ) return false; if ( !pe->WriteText(dir) ) return false;

View File

@ -19,6 +19,7 @@
#pragma once #pragma once
#include <string>
#include <object/object.h> #include <object/object.h>
@ -54,6 +55,8 @@
#include <ui/window.h> #include <ui/window.h>
#include <ui/interface.h> #include <ui/interface.h>
#include <app/app.h>
namespace Ui { namespace Ui {
@ -76,7 +79,7 @@ class CStudio
bool EventProcess(const Event &event); bool EventProcess(const Event &event);
void StartEditScript(CScript *script, char* name, int rank); void StartEditScript(CScript *script, std::string name, int rank);
bool StopEditScript(bool bCancel); bool StopEditScript(bool bCancel);
protected: protected:
@ -84,7 +87,7 @@ class CStudio
void SearchToken(CEdit* edit); void SearchToken(CEdit* edit);
void ColorizeScript(CEdit* edit); void ColorizeScript(CEdit* edit);
void AdjustEditScript(); void AdjustEditScript();
void SetInfoText(char *text, bool bClickable); void SetInfoText(std::string text, bool bClickable);
void ViewEditScript(); void ViewEditScript();
void UpdateFlux(); void UpdateFlux();
void UpdateButtons(); void UpdateButtons();
@ -98,7 +101,7 @@ class CStudio
void UpdateDialogAction(); void UpdateDialogAction();
void UpdateDialogPublic(); void UpdateDialogPublic();
void UpdateDialogList(); void UpdateDialogList();
void SearchDirectory(char *dir, bool bCreate); void SearchDirectory(std::string dir, bool bCreate);
bool ReadProgram(); bool ReadProgram();
bool WriteProgram(); bool WriteProgram();
@ -110,9 +113,11 @@ class CStudio
CCamera* m_camera; CCamera* m_camera;
CSoundInterface* m_sound; CSoundInterface* m_sound;
CInterface* m_interface; CInterface* m_interface;
CApplication *m_app;
int m_rank; int m_rank;
CScript* m_script; CScript* m_script;
Gfx::CameraType m_editCamera;
bool m_bEditMaximized; bool m_bEditMaximized;
bool m_bEditMinimized; bool m_bEditMinimized;
@ -128,7 +133,7 @@ class CStudio
bool m_bRunning; bool m_bRunning;
bool m_bRealTime; bool m_bRealTime;
bool m_bInitPause; bool m_bInitPause;
char m_helpFilename[100]; std::string m_helpFilename;
StudioDialog m_dialog; StudioDialog m_dialog;
}; };

View File

@ -17,21 +17,7 @@
// target.cpp // target.cpp
//#include <windows.h> #include <ui/target.h>
//#include <stdio.h>
//#include <d3d.h>
//#include "common/struct.h"
//#include "old/d3dengine.h"
//#include "old/math3d.h"
#include "graphics/engine/engine.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
#include "object/robotmain.h"
#include "object/object.h"
#include "common/restext.h"
#include "ui/target.h"
@ -162,7 +148,7 @@ void CTarget::Draw()
// Returns the tooltip. // Returns the tooltip.
bool CTarget::GetTooltip(Math::Point pos, char* name) bool CTarget::GetTooltip(Math::Point pos, std::string &name)
{ {
#if 0 #if 0
if ( (m_state&STATE_VISIBLE) && Detect(pos) ) // in the window? if ( (m_state&STATE_VISIBLE) && Detect(pos) ) // in the window?
@ -183,7 +169,7 @@ bool CTarget::GetTooltip(Math::Point pos, char* name)
//? if ( pObj == 0 ) //? if ( pObj == 0 )
if ( !m_main->GetFriendAim() ) if ( !m_main->GetFriendAim() )
{ {
strcpy(name, m_tooltip); m_tooltip = name;
return true; // does not detect objects below! return true; // does not detect objects below!
} }
} }

View File

@ -22,8 +22,17 @@
#include <ui/control.h> #include <ui/control.h>
#include <common/misc.h>
#include <common/iman.h>
#include <common/restext.h>
#include <common/event.h> #include <common/event.h>
#include <graphics/engine/engine.h>
#include <object/robotmain.h>
#include <object/object.h>
namespace Ui { namespace Ui {
class CTarget : public CControl class CTarget : public CControl