mirror of
https://github.com/leozide/leocad.git
synced 2026-07-28 04:07:11 +00:00
Moved properties and preferences into their own classes.
This commit is contained in:
+128
-11
@@ -13,11 +13,41 @@
|
||||
|
||||
lcApplication* g_App;
|
||||
|
||||
void lcPreferences::LoadDefaults()
|
||||
{
|
||||
mMouseSensitivity = lcGetProfileInt(LC_PROFILE_MOUSE_SENSITIVITY);
|
||||
mLightingMode = (lcLightingMode)lcGetProfileInt(LC_PROFILE_LIGHTING_MODE);
|
||||
mDrawAxes = lcGetProfileInt(LC_PROFILE_DRAW_AXES);
|
||||
mDrawEdgeLines = lcGetProfileInt(LC_PROFILE_DRAW_EDGE_LINES);
|
||||
mLineWidth = lcGetProfileFloat(LC_PROFILE_LINE_WIDTH);
|
||||
mDrawGridStuds = lcGetProfileInt(LC_PROFILE_GRID_STUDS);
|
||||
mGridStudColor = lcGetProfileInt(LC_PROFILE_GRID_STUD_COLOR);
|
||||
mDrawGridLines = lcGetProfileInt(LC_PROFILE_GRID_LINES);
|
||||
mGridLineSpacing = lcGetProfileInt(LC_PROFILE_GRID_LINE_SPACING);
|
||||
mGridLineColor = lcGetProfileInt(LC_PROFILE_GRID_LINE_COLOR);
|
||||
}
|
||||
|
||||
void lcPreferences::SaveDefaults()
|
||||
{
|
||||
lcSetProfileInt(LC_PROFILE_MOUSE_SENSITIVITY, mMouseSensitivity);
|
||||
lcSetProfileInt(LC_PROFILE_LIGHTING_MODE, mLightingMode);
|
||||
lcSetProfileInt(LC_PROFILE_DRAW_AXES, mDrawAxes);
|
||||
lcSetProfileInt(LC_PROFILE_DRAW_EDGE_LINES, mDrawEdgeLines);
|
||||
lcSetProfileFloat(LC_PROFILE_LINE_WIDTH, mLineWidth);
|
||||
lcSetProfileInt(LC_PROFILE_GRID_STUDS, mDrawGridStuds);
|
||||
lcSetProfileInt(LC_PROFILE_GRID_STUD_COLOR, mGridStudColor);
|
||||
lcSetProfileInt(LC_PROFILE_GRID_LINES, mDrawGridLines);
|
||||
lcSetProfileInt(LC_PROFILE_GRID_LINE_SPACING, mGridLineSpacing);
|
||||
lcSetProfileInt(LC_PROFILE_GRID_LINE_COLOR, mGridLineColor);
|
||||
}
|
||||
|
||||
lcApplication::lcApplication()
|
||||
{
|
||||
mProject = NULL;
|
||||
m_Library = NULL;
|
||||
mLibrary = NULL;
|
||||
mClipboard = NULL;
|
||||
|
||||
mPreferences.LoadDefaults();
|
||||
}
|
||||
|
||||
lcApplication::~lcApplication()
|
||||
@@ -35,12 +65,12 @@ void lcApplication::SetClipboard(lcFile* Clipboard)
|
||||
|
||||
bool lcApplication::LoadPiecesLibrary(const char* LibPath, const char* LibraryInstallPath, const char* LibraryCachePath)
|
||||
{
|
||||
if (m_Library == NULL)
|
||||
m_Library = new lcPiecesLibrary();
|
||||
if (mLibrary == NULL)
|
||||
mLibrary = new lcPiecesLibrary();
|
||||
|
||||
if (LibPath && LibPath[0])
|
||||
{
|
||||
if (m_Library->Load(LibPath, LibraryCachePath))
|
||||
if (mLibrary->Load(LibPath, LibraryCachePath))
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -49,7 +79,7 @@ bool lcApplication::LoadPiecesLibrary(const char* LibPath, const char* LibraryIn
|
||||
|
||||
if (EnvPath && EnvPath[0])
|
||||
{
|
||||
if (m_Library->Load(EnvPath, LibraryCachePath))
|
||||
if (mLibrary->Load(EnvPath, LibraryCachePath))
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -60,7 +90,7 @@ bool lcApplication::LoadPiecesLibrary(const char* LibPath, const char* LibraryIn
|
||||
|
||||
if (CustomPath[0])
|
||||
{
|
||||
if (m_Library->Load(CustomPath, LibraryCachePath))
|
||||
if (mLibrary->Load(CustomPath, LibraryCachePath))
|
||||
return true;
|
||||
}
|
||||
else if (LibraryInstallPath && LibraryInstallPath[0])
|
||||
@@ -75,9 +105,9 @@ bool lcApplication::LoadPiecesLibrary(const char* LibPath, const char* LibraryIn
|
||||
|
||||
strcat(LibraryPath, "library.bin");
|
||||
|
||||
if (m_Library->Load(LibraryPath, LibraryCachePath))
|
||||
if (mLibrary->Load(LibraryPath, LibraryCachePath))
|
||||
{
|
||||
m_Library->mNumOfficialPieces = m_Library->mPieces.GetSize();
|
||||
mLibrary->mNumOfficialPieces = mLibrary->mPieces.GetSize();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -212,7 +242,7 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Library->CreateBuiltinPieces();
|
||||
mLibrary->CreateBuiltinPieces();
|
||||
|
||||
gMainWindow->DoMessageBox("LeoCAD could not find a compatible Pieces Library so only a small number of pieces will be available.\n\n"
|
||||
"Please visit http://www.leocad.org for information on how to download and install a library.", LC_MB_OK | LC_MB_ICONERROR);
|
||||
@@ -349,6 +379,93 @@ bool lcApplication::Initialize(int argc, char* argv[], const char* LibraryInstal
|
||||
|
||||
void lcApplication::Shutdown()
|
||||
{
|
||||
delete m_Library;
|
||||
m_Library = NULL;
|
||||
delete mLibrary;
|
||||
mLibrary = NULL;
|
||||
}
|
||||
|
||||
void lcApplication::ShowPreferencesDialog()
|
||||
{
|
||||
lcPreferencesDialogOptions Options;
|
||||
int CurrentAASamples = lcGetProfileInt(LC_PROFILE_ANTIALIASING_SAMPLES);
|
||||
|
||||
Options.Preferences = mPreferences;
|
||||
|
||||
strcpy(Options.DefaultAuthor, lcGetProfileString(LC_PROFILE_DEFAULT_AUTHOR_NAME));
|
||||
strcpy(Options.ProjectsPath, lcGetProfileString(LC_PROFILE_PROJECTS_PATH));
|
||||
strcpy(Options.LibraryPath, lcGetProfileString(LC_PROFILE_PARTS_LIBRARY));
|
||||
strcpy(Options.POVRayPath, lcGetProfileString(LC_PROFILE_POVRAY_PATH));
|
||||
strcpy(Options.LGEOPath, lcGetProfileString(LC_PROFILE_POVRAY_LGEO_PATH));
|
||||
Options.CheckForUpdates = lcGetProfileInt(LC_PROFILE_CHECK_UPDATES);
|
||||
|
||||
Options.Snap = lcGetActiveProject()->m_nSnap;
|
||||
Options.AASamples = CurrentAASamples;
|
||||
|
||||
Options.Categories = gCategories;
|
||||
Options.CategoriesModified = false;
|
||||
Options.CategoriesDefault = false;
|
||||
|
||||
Options.KeyboardShortcuts = gKeyboardShortcuts;
|
||||
Options.ShortcutsModified = false;
|
||||
Options.ShortcutsDefault = false;
|
||||
|
||||
if (!gMainWindow->DoDialog(LC_DIALOG_PREFERENCES, &Options))
|
||||
return;
|
||||
|
||||
bool LibraryChanged = strcmp(Options.LibraryPath, lcGetProfileString(LC_PROFILE_PARTS_LIBRARY));
|
||||
bool AAChanged = CurrentAASamples != Options.AASamples;
|
||||
|
||||
mPreferences = Options.Preferences;
|
||||
lcGetActiveProject()->m_nSnap = Options.Snap;
|
||||
|
||||
mPreferences.SaveDefaults();
|
||||
|
||||
lcSetProfileString(LC_PROFILE_DEFAULT_AUTHOR_NAME, Options.DefaultAuthor);
|
||||
lcSetProfileString(LC_PROFILE_PROJECTS_PATH, Options.ProjectsPath);
|
||||
lcSetProfileString(LC_PROFILE_PARTS_LIBRARY, Options.LibraryPath);
|
||||
lcSetProfileString(LC_PROFILE_POVRAY_PATH, Options.POVRayPath);
|
||||
lcSetProfileString(LC_PROFILE_POVRAY_LGEO_PATH, Options.LGEOPath);
|
||||
lcSetProfileInt(LC_PROFILE_CHECK_UPDATES, Options.CheckForUpdates);
|
||||
lcSetProfileInt(LC_PROFILE_SNAP, Options.Snap);
|
||||
lcSetProfileInt(LC_PROFILE_ANTIALIASING_SAMPLES, Options.AASamples);
|
||||
|
||||
if (LibraryChanged && AAChanged)
|
||||
gMainWindow->DoMessageBox("Parts library and Anti-aliasing changes will only take effect the next time you start LeoCAD.", LC_MB_OK);
|
||||
else if (LibraryChanged)
|
||||
gMainWindow->DoMessageBox("Parts library changes will only take effect the next time you start LeoCAD.", LC_MB_OK);
|
||||
else if (AAChanged)
|
||||
gMainWindow->DoMessageBox("Anti-aliasing changes will only take effect the next time you start LeoCAD.", LC_MB_OK);
|
||||
|
||||
if (Options.CategoriesModified)
|
||||
{
|
||||
if (Options.CategoriesDefault)
|
||||
lcResetDefaultCategories();
|
||||
else
|
||||
{
|
||||
gCategories = Options.Categories;
|
||||
lcSaveDefaultCategories();
|
||||
}
|
||||
|
||||
gMainWindow->UpdateCategories();
|
||||
}
|
||||
|
||||
if (Options.ShortcutsModified)
|
||||
{
|
||||
if (Options.ShortcutsDefault)
|
||||
lcResetDefaultKeyboardShortcuts();
|
||||
else
|
||||
{
|
||||
gKeyboardShortcuts = Options.KeyboardShortcuts;
|
||||
lcSaveDefaultKeyboardShortcuts();
|
||||
}
|
||||
|
||||
gMainWindow->UpdateShortcuts();
|
||||
}
|
||||
|
||||
// TODO: printing preferences
|
||||
/*
|
||||
strcpy(opts.strFooter, m_strFooter);
|
||||
strcpy(opts.strHeader, m_strHeader);
|
||||
*/
|
||||
|
||||
lcGetActiveProject()->UpdateAllViews();
|
||||
}
|
||||
+34
-2
@@ -7,6 +7,31 @@
|
||||
class Project;
|
||||
class lcPiecesLibrary;
|
||||
|
||||
enum lcLightingMode
|
||||
{
|
||||
LC_LIGHTING_FLAT,
|
||||
LC_LIGHTING_FAKE,
|
||||
LC_LIGHTING_FULL
|
||||
};
|
||||
|
||||
class lcPreferences
|
||||
{
|
||||
public:
|
||||
void LoadDefaults();
|
||||
void SaveDefaults();
|
||||
|
||||
int mMouseSensitivity;
|
||||
lcLightingMode mLightingMode;
|
||||
bool mDrawAxes;
|
||||
bool mDrawEdgeLines;
|
||||
float mLineWidth;
|
||||
bool mDrawGridStuds;
|
||||
lcuint32 mGridStudColor;
|
||||
bool mDrawGridLines;
|
||||
int mGridLineSpacing;
|
||||
lcuint32 mGridLineColor;
|
||||
};
|
||||
|
||||
class lcApplication
|
||||
{
|
||||
public:
|
||||
@@ -15,6 +40,7 @@ public:
|
||||
|
||||
bool Initialize(int argc, char *argv[], const char* LibraryInstallPath, const char* LibraryCachePath);
|
||||
void Shutdown();
|
||||
void ShowPreferencesDialog();
|
||||
|
||||
bool LoadPiecesLibrary(const char* LibPath, const char* LibraryInstallPath, const char* LibraryCachePath);
|
||||
|
||||
@@ -25,7 +51,8 @@ public:
|
||||
void ExportClipboard(lcMemFile* Clipboard);
|
||||
|
||||
Project* mProject;
|
||||
lcPiecesLibrary* m_Library;
|
||||
lcPiecesLibrary* mLibrary;
|
||||
lcPreferences mPreferences;
|
||||
lcFile* mClipboard;
|
||||
|
||||
protected:
|
||||
@@ -37,7 +64,7 @@ extern lcApplication* g_App;
|
||||
|
||||
inline lcPiecesLibrary* lcGetPiecesLibrary()
|
||||
{
|
||||
return g_App->m_Library;
|
||||
return g_App->mLibrary;
|
||||
}
|
||||
|
||||
inline Project* lcGetActiveProject()
|
||||
@@ -45,4 +72,9 @@ inline Project* lcGetActiveProject()
|
||||
return g_App->mProject;
|
||||
}
|
||||
|
||||
inline const lcPreferences& lcGetPreferences()
|
||||
{
|
||||
return g_App->mPreferences;
|
||||
}
|
||||
|
||||
#endif // _LC_APPLICATION_H_
|
||||
|
||||
+6
-26
@@ -3,10 +3,11 @@
|
||||
|
||||
#include "lc_math.h"
|
||||
#include "lc_array.h"
|
||||
#include "lc_application.h"
|
||||
#include "project.h"
|
||||
#include "lc_category.h"
|
||||
#include "image.h"
|
||||
#include "lc_shortcuts.h"
|
||||
#include "image.h"
|
||||
|
||||
class Group;
|
||||
|
||||
@@ -97,23 +98,8 @@ struct lcPOVRayDialogOptions
|
||||
|
||||
struct lcPropertiesDialogOptions
|
||||
{
|
||||
const char* Title;
|
||||
|
||||
char Author[101];
|
||||
char Description[101];
|
||||
char Comments[256];
|
||||
|
||||
int BackgroundType;
|
||||
lcVector3 SolidColor;
|
||||
lcVector3 GradientColor1;
|
||||
lcVector3 GradientColor2;
|
||||
char BackgroundFileName[LC_MAXPATH];
|
||||
bool BackgroundTile;
|
||||
bool FogEnabled;
|
||||
float FogDensity;
|
||||
lcVector3 FogColor;
|
||||
lcVector3 AmbientColor;
|
||||
bool DrawFloor;
|
||||
lcModelProperties Properties;
|
||||
String Title;
|
||||
bool SetDefault;
|
||||
|
||||
lcArray<lcPiecesUsedEntry> PartsUsed;
|
||||
@@ -139,23 +125,17 @@ struct lcSelectDialogOptions
|
||||
|
||||
struct lcPreferencesDialogOptions
|
||||
{
|
||||
lcPreferences Preferences;
|
||||
|
||||
char DefaultAuthor[101];
|
||||
char ProjectsPath[LC_MAXPATH];
|
||||
char LibraryPath[LC_MAXPATH];
|
||||
char POVRayPath[LC_MAXPATH];
|
||||
char LGEOPath[LC_MAXPATH];
|
||||
int MouseSensitivity;
|
||||
int CheckForUpdates;
|
||||
|
||||
lcuint32 Snap;
|
||||
lcuint32 Detail;
|
||||
float LineWidth;
|
||||
int AASamples;
|
||||
bool GridStuds;
|
||||
lcuint32 GridStudColor;
|
||||
bool GridLines;
|
||||
int GridLineSpacing;
|
||||
lcuint32 GridLineColor;
|
||||
|
||||
lcArray<lcLibraryCategory> Categories;
|
||||
bool CategoriesModified;
|
||||
|
||||
@@ -455,6 +455,13 @@ inline lcVector4& operator/=(lcVector4& a, float b)
|
||||
return a;
|
||||
}
|
||||
|
||||
inline lcVector3 lcVector3FromColor(lcuint32 Color)
|
||||
{
|
||||
lcVector3 v(LC_RGBA_RED(Color), LC_RGBA_GREEN(Color), LC_RGBA_BLUE(Color));
|
||||
v /= 255.0f;
|
||||
return v;
|
||||
}
|
||||
|
||||
inline lcVector4 lcVector4FromColor(lcuint32 Color)
|
||||
{
|
||||
lcVector4 v(LC_RGBA_RED(Color), LC_RGBA_GREEN(Color), LC_RGBA_BLUE(Color), LC_RGBA_ALPHA(Color));
|
||||
@@ -462,6 +469,11 @@ inline lcVector4 lcVector4FromColor(lcuint32 Color)
|
||||
return v;
|
||||
}
|
||||
|
||||
inline lcuint32 lcColorFromVector3(const lcVector3& Color)
|
||||
{
|
||||
return LC_RGB(Color[0] * 255, Color[1] * 255, Color[2] * 255);
|
||||
}
|
||||
|
||||
inline lcVector3 lcMul31(const lcVector3& a, const lcMatrix44& b)
|
||||
{
|
||||
lcVector4 v = b.r[0] * a[0] + b.r[1] * a[1] + b.r[2] * a[2] + b.r[3];
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "lc_global.h"
|
||||
#include "lc_profile.h"
|
||||
#include "lc_application.h"
|
||||
#include "image.h"
|
||||
#include "project.h"
|
||||
|
||||
@@ -45,10 +46,12 @@ lcProfileEntry::lcProfileEntry(const char* Section, const char* Key)
|
||||
|
||||
lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
|
||||
{
|
||||
lcProfileEntry("Settings", "Detail", LC_DET_BRICKEDGES), // LC_PROFILE_DETAIL
|
||||
lcProfileEntry("Settings", "Snap", LC_DRAW_SNAP_A | LC_DRAW_SNAP_XYZ), // LC_PROFILE_SNAP
|
||||
lcProfileEntry("Settings", "AngleSnap", 30), // LC_PROFILE_ANGLE_SNAP
|
||||
lcProfileEntry("Settings", "LineWidth", 1.0f), // LC_PROFILE_LINE_WIDTH
|
||||
lcProfileEntry("Settings", "LightingMode", LC_LIGHTING_FLAT), // LC_PROFILE_LIGHTING_MODE
|
||||
lcProfileEntry("Settings", "DrawAxes", 0), // LC_PROFILE_DRAW_AXES
|
||||
lcProfileEntry("Settings", "DrawEdgeLines", 1), // LC_PROFILE_DRAW_EDGE_LINES
|
||||
lcProfileEntry("Settings", "GridStuds", 1), // LC_PROFILE_GRID_STUDS
|
||||
lcProfileEntry("Settings", "GridStudColor", LC_RGBA(64, 64, 64, 192)), // LC_PROFILE_GRID_STUD_COLOR
|
||||
lcProfileEntry("Settings", "GridLines", 1), // LC_PROFILE_GRID_LINES
|
||||
@@ -74,16 +77,18 @@ lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
|
||||
lcProfileEntry("Settings", "PrintColumns", 1), // LC_PROFILE_PRINT_COLUMNS
|
||||
|
||||
lcProfileEntry("Defaults", "Author", ""), // LC_PROFILE_DEFAULT_AUTHOR_NAME
|
||||
lcProfileEntry("Defaults", "Scene", 0), // LC_PROFILE_DEFAULT_SCENE
|
||||
lcProfileEntry("Defaults", "FloorColor", LC_RGB(0, 191, 0)), // LC_PROFILE_DEFAULT_FLOOR_COLOR
|
||||
lcProfileEntry("Defaults", "FloorTexture", ""), // LC_PROFILE_DEFAULT_FLOOR_TEXTURE
|
||||
lcProfileEntry("Defaults", "FogEnabled", 0), // LC_PROFILE_DEFAULT_FOG_ENABLED
|
||||
lcProfileEntry("Defaults", "FogDensity", 0.1f), // LC_PROFILE_DEFAULT_FOG_DENSITY
|
||||
lcProfileEntry("Defaults", "FogColor", LC_RGB(255, 255, 255)), // LC_PROFILE_DEFAULT_FOG_COLOR
|
||||
lcProfileEntry("Defaults", "AmbientColor", LC_RGB(75, 75, 75)), // LC_PROFILE_DEFAULT_AMBIENT_COLOR
|
||||
lcProfileEntry("Defaults", "BackgroundType", LC_BACKGROUND_SOLID), // LC_PROFILE_DEFAULT_BACKGROUND_TYPE
|
||||
lcProfileEntry("Defaults", "BackgroundColor", LC_RGB(255, 255, 255)), // LC_PROFILE_DEFAULT_BACKGROUND_COLOR
|
||||
lcProfileEntry("Defaults", "GradientColor1", LC_RGB(0, 0, 191)), // LC_PROFILE_DEFAULT_GRADIENT_COLOR1
|
||||
lcProfileEntry("Defaults", "GradientColor2", LC_RGB(255, 255, 255)), // LC_PROFILE_DEFAULT_GRADIENT_COLOR2
|
||||
lcProfileEntry("Defaults", "BackgroundTeture", ""), // LC_PROFILE_DEFAULT_BACKGROUND_TEXTURE
|
||||
lcProfileEntry("Defaults", "BackgroundTexture", ""), // LC_PROFILE_DEFAULT_BACKGROUND_TEXTURE
|
||||
lcProfileEntry("Defaults", "BackgroundTile", 0), // LC_PROFILE_DEFAULT_BACKGROUND_TILE
|
||||
|
||||
lcProfileEntry("HTML", "Options", LC_HTML_SINGLEPAGE), // LC_PROFILE_HTML_OPTIONS
|
||||
lcProfileEntry("HTML", "ImageOptions", LC_IMAGE_PNG | LC_IMAGE_TRANSPARENT), // LC_PROFILE_HTML_IMAGE_OPTIONS
|
||||
|
||||
+6
-2
@@ -4,10 +4,12 @@
|
||||
enum LC_PROFILE_KEY
|
||||
{
|
||||
// Settings.
|
||||
LC_PROFILE_DETAIL,
|
||||
LC_PROFILE_SNAP,
|
||||
LC_PROFILE_ANGLE_SNAP,
|
||||
LC_PROFILE_LINE_WIDTH,
|
||||
LC_PROFILE_LIGHTING_MODE,
|
||||
LC_PROFILE_DRAW_AXES,
|
||||
LC_PROFILE_DRAW_EDGE_LINES,
|
||||
LC_PROFILE_GRID_STUDS,
|
||||
LC_PROFILE_GRID_STUD_COLOR,
|
||||
LC_PROFILE_GRID_LINES,
|
||||
@@ -34,16 +36,18 @@ enum LC_PROFILE_KEY
|
||||
|
||||
// Defaults for new projects.
|
||||
LC_PROFILE_DEFAULT_AUTHOR_NAME,
|
||||
LC_PROFILE_DEFAULT_SCENE,
|
||||
LC_PROFILE_DEFAULT_FLOOR_COLOR,
|
||||
LC_PROFILE_DEFAULT_FLOOR_TEXTURE,
|
||||
LC_PROFILE_DEFAULT_FOG_ENABLED,
|
||||
LC_PROFILE_DEFAULT_FOG_DENSITY,
|
||||
LC_PROFILE_DEFAULT_FOG_COLOR,
|
||||
LC_PROFILE_DEFAULT_AMBIENT_COLOR,
|
||||
LC_PROFILE_DEFAULT_BACKGROUND_TYPE,
|
||||
LC_PROFILE_DEFAULT_BACKGROUND_COLOR,
|
||||
LC_PROFILE_DEFAULT_GRADIENT_COLOR1,
|
||||
LC_PROFILE_DEFAULT_GRADIENT_COLOR2,
|
||||
LC_PROFILE_DEFAULT_BACKGROUND_TEXTURE,
|
||||
LC_PROFILE_DEFAULT_BACKGROUND_TILE,
|
||||
|
||||
// Exporters.
|
||||
LC_PROFILE_HTML_OPTIONS,
|
||||
|
||||
+168
-435
File diff suppressed because it is too large
Load Diff
+57
-58
@@ -6,34 +6,14 @@
|
||||
#include "lc_array.h"
|
||||
#include "lc_math.h"
|
||||
#include "lc_commands.h"
|
||||
#include "str.h"
|
||||
|
||||
//#define DET_BACKFACES 0x00001 // Draw backfaces
|
||||
//#define DET_DEPTH 0x00002 // Enable depth test
|
||||
//#define DET_CLEAR 0x00004 // Use clear colors
|
||||
#define LC_DET_LIGHTING 0x00008 // Lighting
|
||||
//#define LC_DET_SMOOTH 0x00010 // Smooth shading
|
||||
//#define DET_STUDS 0x00020 // Draw studs
|
||||
//#define DET_WIREFRAME 0x00040 // Wireframe
|
||||
//#define LC_DET_ANTIALIAS 0x00080 // Turn on anti-aliasing
|
||||
#define LC_DET_BRICKEDGES 0x00100 // Draw lines
|
||||
//#define LC_DET_DITHER 0x00200 // Enable dithering
|
||||
//#define LC_DET_BOX_FILL 0x00400 // Filled boxes
|
||||
//#define LC_DET_HIDDEN_LINE 0x00800 // Remove hidden lines
|
||||
//#define DET_STUDS_BOX 0x01000 // Draw studs as boxes
|
||||
//#define LC_DET_LINEAR 0x02000 // Linear filtering
|
||||
#define LC_DET_FAST 0x04000 // Fast rendering (boxes)
|
||||
//#define LC_DET_BACKGROUND 0x08000 // Background rendering
|
||||
//#define LC_DET_SCREENDOOR 0x10000 // No alpha blending
|
||||
|
||||
#define LC_DRAW_AXIS 0x0001 // Orientation icon
|
||||
#define LC_DRAW_GRID 0x0002 // Grid
|
||||
#define LC_DRAW_SNAP_A 0x0004 // Snap Angle
|
||||
#define LC_DRAW_SNAP_X 0x0008 // Snap X
|
||||
#define LC_DRAW_SNAP_Y 0x0010 // Snap Y
|
||||
#define LC_DRAW_SNAP_Z 0x0020 // Snap Z
|
||||
#define LC_DRAW_SNAP_XYZ (LC_DRAW_SNAP_X | LC_DRAW_SNAP_Y | LC_DRAW_SNAP_Z)
|
||||
#define LC_DRAW_GLOBAL_SNAP 0x0040 // Don't allow relative snap.
|
||||
//#define LC_DRAW_MOVE 0x0080 // Switch to move after insert
|
||||
#define LC_DRAW_LOCK_X 0x0100 // Lock X
|
||||
#define LC_DRAW_LOCK_Y 0x0200 // Lock Y
|
||||
#define LC_DRAW_LOCK_Z 0x0400 // Lock Z
|
||||
@@ -43,12 +23,8 @@
|
||||
#define LC_DRAW_CM_UNITS 0x2000 // Use centimeters
|
||||
//#define LC_DRAW_3DMOUSE 0x4000 // Mouse moves in all directions
|
||||
|
||||
// #define RENDER_FAST 0x001
|
||||
// #define RENDER_BACKGROUND 0x002
|
||||
#define LC_SCENE_FOG 0x004 // Enable fog
|
||||
// #define RENDER_FOG_BG 0x008 // Use bg color for fog
|
||||
#define LC_SCENE_BG 0x010 // Draw bg image
|
||||
// #define RENDER_BG_FAST 0x020
|
||||
#define LC_SCENE_BG_TILE 0x040 // Tile bg image
|
||||
#define LC_SCENE_FLOOR 0x080 // Render floor
|
||||
#define LC_SCENE_GRADIENT 0x100 // Draw gradient
|
||||
@@ -78,6 +54,55 @@ enum LC_NOTIFY
|
||||
LC_CAPTURE_LOST
|
||||
};
|
||||
|
||||
enum lcBackgroundType
|
||||
{
|
||||
LC_BACKGROUND_SOLID,
|
||||
LC_BACKGROUND_GRADIENT,
|
||||
LC_BACKGROUND_IMAGE
|
||||
};
|
||||
|
||||
class lcModelProperties
|
||||
{
|
||||
public:
|
||||
void LoadDefaults();
|
||||
void SaveDefaults();
|
||||
|
||||
bool operator==(const lcModelProperties& Properties)
|
||||
{
|
||||
if (mName != Properties.mName || mAuthor != Properties.mAuthor ||
|
||||
mDescription != Properties.mDescription || mComments != Properties.mComments)
|
||||
return false;
|
||||
|
||||
if (mBackgroundType != Properties.mBackgroundType || mBackgroundSolidColor != Properties.mBackgroundSolidColor ||
|
||||
mBackgroundGradientColor1 != Properties.mBackgroundGradientColor1 || mBackgroundGradientColor2 != Properties.mBackgroundGradientColor2 ||
|
||||
mBackgroundImage != Properties.mBackgroundImage || mBackgroundImageTile != Properties.mBackgroundImageTile)
|
||||
return false;
|
||||
|
||||
if (mFogEnabled != Properties.mFogEnabled || mFogDensity != Properties.mFogDensity ||
|
||||
mFogColor != Properties.mFogColor || mAmbientColor != Properties.mAmbientColor)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
String mName;
|
||||
String mAuthor;
|
||||
String mDescription;
|
||||
String mComments;
|
||||
|
||||
lcBackgroundType mBackgroundType;
|
||||
lcVector3 mBackgroundSolidColor;
|
||||
lcVector3 mBackgroundGradientColor1;
|
||||
lcVector3 mBackgroundGradientColor2;
|
||||
String mBackgroundImage;
|
||||
bool mBackgroundImageTile;
|
||||
|
||||
bool mFogEnabled;
|
||||
float mFogDensity;
|
||||
lcVector3 mFogColor;
|
||||
lcVector3 mAmbientColor;
|
||||
};
|
||||
|
||||
enum LC_TRANSFORM_TYPE
|
||||
{
|
||||
LC_TRANSFORM_ABSOLUTE_TRANSLATION,
|
||||
@@ -204,16 +229,13 @@ enum LC_ACTIONS
|
||||
class Project
|
||||
{
|
||||
public:
|
||||
// Constructors
|
||||
Project();
|
||||
~Project();
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
bool IsModified()
|
||||
{ return m_bModified; }
|
||||
|
||||
// Access to protected members
|
||||
unsigned char GetLastStep();
|
||||
unsigned short GetCurrentTime ()
|
||||
{ return m_nCurStep; }
|
||||
@@ -224,8 +246,8 @@ public:
|
||||
}
|
||||
void SetCurrentPiece(PieceInfo* pInfo)
|
||||
{ m_pCurPiece = pInfo; }
|
||||
float* GetBackgroundColor()
|
||||
{ return m_fBackground; }
|
||||
float* GetBackgroundColor() // todo: remove
|
||||
{ return mProperties.mBackgroundSolidColor; }
|
||||
unsigned long GetSnap() const
|
||||
{ return m_nSnap; }
|
||||
int GetOverlayMode() const
|
||||
@@ -247,8 +269,7 @@ public:
|
||||
void SetTitle (const char* lpszTitle);
|
||||
|
||||
public:
|
||||
// Special notifications
|
||||
void DeleteContents(bool bUndo); // delete doc items etc
|
||||
void DeleteContents(bool bUndo);
|
||||
void LoadDefaults(bool cameras);
|
||||
void BeginPieceDrop(PieceInfo* Info);
|
||||
void OnPieceDropMove(int x, int y);
|
||||
@@ -287,15 +308,10 @@ public:
|
||||
char m_strPathName[LC_MAXPATH];
|
||||
bool m_bModified;
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
View* m_ActiveView;
|
||||
lcArray<View*> m_ViewList;
|
||||
|
||||
char m_strAuthor[101];
|
||||
char m_strDescription[101];
|
||||
char m_strComments[256];
|
||||
|
||||
// Piece library
|
||||
TexFont* m_pScreenFont;
|
||||
|
||||
@@ -333,7 +349,6 @@ protected:
|
||||
// Rendering functions.
|
||||
void RenderBackground(View* view);
|
||||
void RenderScenePieces(View* view);
|
||||
void RenderSceneBoxes(View* view);
|
||||
void RenderSceneObjects(View* view);
|
||||
void RenderViewports(View* view);
|
||||
void RenderOverlays(View* view);
|
||||
@@ -389,6 +404,8 @@ public:
|
||||
void HandleNotify(LC_NOTIFY id, unsigned long param);
|
||||
void HandleCommand(LC_COMMANDS id);
|
||||
|
||||
lcuint32 m_nSnap;
|
||||
|
||||
protected:
|
||||
// State variables
|
||||
int mTransformType;
|
||||
@@ -398,35 +415,18 @@ protected:
|
||||
bool m_bAddKeys;
|
||||
unsigned char m_nCurStep;
|
||||
|
||||
bool mGridStuds;
|
||||
lcuint32 mGridStudColor;
|
||||
bool mGridLines;
|
||||
int mGridLineSpacing;
|
||||
lcuint32 mGridLineColor;
|
||||
|
||||
lcuint32 m_nScene;
|
||||
lcuint32 m_nDetail;
|
||||
lcuint32 m_nSnap;
|
||||
lcuint16 m_nMoveSnap;
|
||||
lcuint16 m_nAngleSnap;
|
||||
float m_fLineWidth;
|
||||
float m_fFogDensity;
|
||||
float m_fFogColor[4];
|
||||
float m_fAmbient[4];
|
||||
float m_fBackground[4];
|
||||
float m_fGradient1[3];
|
||||
float m_fGradient2[3];
|
||||
char m_strFooter[256];
|
||||
char m_strHeader[256];
|
||||
|
||||
unsigned long m_nAutosave;
|
||||
unsigned long m_nSaveTimer;
|
||||
lcModelProperties mProperties;
|
||||
|
||||
char m_strBackground[LC_MAXPATH];
|
||||
lcTexture* m_pBackground;
|
||||
lcTexture* mGridTexture;
|
||||
|
||||
protected:
|
||||
// File load/save implementation.
|
||||
bool DoSave(const char* FileName);
|
||||
bool FileLoad(lcFile* file, bool bUndo, bool bMerge);
|
||||
void FileSave(lcFile* file, bool bUndo);
|
||||
@@ -434,7 +434,6 @@ protected:
|
||||
void FileReadMPD(lcFile& MPD, lcArray<LC_FILEENTRY*>& FileArray) const;
|
||||
|
||||
public:
|
||||
// File helpers
|
||||
bool OnNewDocument();
|
||||
bool OnOpenDocument(const char* FileName);
|
||||
bool OpenProject(const char* FileName);
|
||||
|
||||
@@ -87,6 +87,11 @@ public:
|
||||
return (pf) ? (pf - m_pData) : -1;
|
||||
}
|
||||
|
||||
char* Buffer()
|
||||
{
|
||||
return m_pData;
|
||||
}
|
||||
|
||||
char* GetBuffer(int len)
|
||||
{
|
||||
if (len > (int)strlen(m_pData))
|
||||
|
||||
@@ -28,7 +28,7 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget *parent, void *data) :
|
||||
ui->partsLibrary->setText(options->LibraryPath);
|
||||
ui->povrayExecutable->setText(options->POVRayPath);
|
||||
ui->lgeoPath->setText(options->LGEOPath);
|
||||
ui->mouseSensitivity->setValue(options->MouseSensitivity);
|
||||
ui->mouseSensitivity->setValue(options->Preferences.mMouseSensitivity);
|
||||
ui->checkForUpdates->setCurrentIndex(options->CheckForUpdates);
|
||||
ui->centimeterUnits->setChecked((options->Snap & LC_DRAW_CM_UNITS) != 0);
|
||||
ui->noRelativeSnap->setChecked((options->Snap & LC_DRAW_GLOBAL_SNAP) != 0);
|
||||
@@ -41,21 +41,20 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget *parent, void *data) :
|
||||
ui->antiAliasingSamples->setCurrentIndex(1);
|
||||
else
|
||||
ui->antiAliasingSamples->setCurrentIndex(0);
|
||||
ui->edgeLines->setChecked((options->Detail & LC_DET_BRICKEDGES) != 0);
|
||||
ui->lineWidth->setText(QString::number(options->LineWidth));
|
||||
ui->gridStuds->setChecked(options->GridStuds);
|
||||
ui->gridLines->setChecked(options->GridLines);
|
||||
ui->gridLineSpacing->setText(QString::number(options->GridLineSpacing));
|
||||
ui->axisIcon->setChecked((options->Snap & LC_DRAW_AXIS) != 0);
|
||||
ui->enableLighting->setChecked((options->Detail & LC_DET_LIGHTING) != 0);
|
||||
ui->fastRendering->setChecked((options->Detail & LC_DET_FAST) != 0);
|
||||
ui->edgeLines->setChecked(options->Preferences.mDrawEdgeLines);
|
||||
ui->lineWidth->setText(QString::number(options->Preferences.mLineWidth));
|
||||
ui->gridStuds->setChecked(options->Preferences.mDrawGridStuds);
|
||||
ui->gridLines->setChecked(options->Preferences.mDrawGridLines);
|
||||
ui->gridLineSpacing->setText(QString::number(options->Preferences.mGridLineSpacing));
|
||||
ui->axisIcon->setChecked(options->Preferences.mDrawAxes);
|
||||
ui->enableLighting->setChecked(options->Preferences.mLightingMode != LC_LIGHTING_FLAT);
|
||||
|
||||
QPixmap pix(12, 12);
|
||||
|
||||
pix.fill(QColor(LC_RGBA_RED(options->GridStudColor), LC_RGBA_GREEN(options->GridStudColor), LC_RGBA_BLUE(options->GridStudColor)));
|
||||
pix.fill(QColor(LC_RGBA_RED(options->Preferences.mGridStudColor), LC_RGBA_GREEN(options->Preferences.mGridStudColor), LC_RGBA_BLUE(options->Preferences.mGridStudColor)));
|
||||
ui->gridStudColor->setIcon(pix);
|
||||
|
||||
pix.fill(QColor(LC_RGBA_RED(options->GridLineColor), LC_RGBA_GREEN(options->GridLineColor), LC_RGBA_BLUE(options->GridLineColor)));
|
||||
pix.fill(QColor(LC_RGBA_RED(options->Preferences.mGridLineColor), LC_RGBA_GREEN(options->Preferences.mGridLineColor), LC_RGBA_BLUE(options->Preferences.mGridLineColor)));
|
||||
ui->gridLineColor->setIcon(pix);
|
||||
|
||||
on_antiAliasing_toggled();
|
||||
@@ -86,15 +85,14 @@ void lcQPreferencesDialog::accept()
|
||||
return;
|
||||
}
|
||||
|
||||
options->Detail &= ~(LC_DET_BRICKEDGES | LC_DET_LIGHTING | LC_DET_FAST);
|
||||
options->Snap &= ~(LC_DRAW_CM_UNITS | LC_DRAW_GLOBAL_SNAP | LC_DRAW_MOVEAXIS | LC_DRAW_GRID | LC_DRAW_AXIS);
|
||||
options->Snap &= ~(LC_DRAW_CM_UNITS | LC_DRAW_GLOBAL_SNAP | LC_DRAW_MOVEAXIS);
|
||||
|
||||
strcpy(options->DefaultAuthor, ui->authorName->text().toLocal8Bit().data());
|
||||
strcpy(options->ProjectsPath, ui->projectsFolder->text().toLocal8Bit().data());
|
||||
strcpy(options->LibraryPath, ui->partsLibrary->text().toLocal8Bit().data());
|
||||
strcpy(options->POVRayPath, ui->povrayExecutable->text().toLocal8Bit().data());
|
||||
strcpy(options->LGEOPath, ui->lgeoPath->text().toLocal8Bit().data());
|
||||
options->MouseSensitivity = ui->mouseSensitivity->value();
|
||||
options->Preferences.mMouseSensitivity = ui->mouseSensitivity->value();
|
||||
options->CheckForUpdates = ui->checkForUpdates->currentIndex();
|
||||
|
||||
if (ui->centimeterUnits->isChecked())
|
||||
@@ -115,24 +113,15 @@ void lcQPreferencesDialog::accept()
|
||||
else
|
||||
options->AASamples = 2;
|
||||
|
||||
if (ui->edgeLines->isChecked())
|
||||
{
|
||||
options->Detail |= LC_DET_BRICKEDGES;
|
||||
options->LineWidth = ui->lineWidth->text().toFloat();
|
||||
}
|
||||
options->Preferences.mDrawEdgeLines = ui->edgeLines->isChecked();
|
||||
options->Preferences.mLineWidth = ui->lineWidth->text().toFloat();
|
||||
|
||||
options->GridStuds = ui->gridStuds->isChecked();
|
||||
options->GridLines = ui->gridLines->isChecked();
|
||||
options->GridLineSpacing = gridLineSpacing;
|
||||
options->Preferences.mDrawGridStuds = ui->gridStuds->isChecked();
|
||||
options->Preferences.mDrawGridLines = ui->gridLines->isChecked();
|
||||
options->Preferences.mGridLineSpacing = gridLineSpacing;
|
||||
|
||||
if (ui->axisIcon->isChecked())
|
||||
options->Snap |= LC_DRAW_AXIS;
|
||||
|
||||
if (ui->enableLighting->isChecked())
|
||||
options->Detail |= LC_DET_LIGHTING;
|
||||
|
||||
if (ui->fastRendering->isChecked())
|
||||
options->Detail |= LC_DET_FAST;
|
||||
options->Preferences.mDrawAxes = ui->axisIcon->isChecked();
|
||||
options->Preferences.mLightingMode = ui->enableLighting->isChecked() ? LC_LIGHTING_FULL : LC_LIGHTING_FLAT;
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
@@ -184,13 +173,13 @@ void lcQPreferencesDialog::colorClicked()
|
||||
|
||||
if (button == ui->gridStudColor)
|
||||
{
|
||||
color = &options->GridStudColor;
|
||||
color = &options->Preferences.mGridStudColor;
|
||||
title = tr("Select Grid Stud Color");
|
||||
dialogOptions = QColorDialog::ShowAlphaChannel;
|
||||
}
|
||||
else if (button == ui->gridLineColor)
|
||||
{
|
||||
color = &options->GridLineColor;
|
||||
color = &options->Preferences.mGridLineColor;
|
||||
title = tr("Select Grid Line Color");
|
||||
dialogOptions = 0;
|
||||
}
|
||||
|
||||
@@ -222,13 +222,6 @@
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="fastRendering">
|
||||
<property name="text">
|
||||
<string>Fast rendering</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineWidth">
|
||||
<property name="maximumSize">
|
||||
@@ -740,7 +733,6 @@
|
||||
<tabstop>lineWidth</tabstop>
|
||||
<tabstop>axisIcon</tabstop>
|
||||
<tabstop>enableLighting</tabstop>
|
||||
<tabstop>fastRendering</tabstop>
|
||||
<tabstop>gridStuds</tabstop>
|
||||
<tabstop>gridStudColor</tabstop>
|
||||
<tabstop>gridLines</tabstop>
|
||||
|
||||
+30
-35
@@ -23,36 +23,35 @@ lcQPropertiesDialog::lcQPropertiesDialog(QWidget *parent, void *data) :
|
||||
|
||||
options = (lcPropertiesDialogOptions*)data;
|
||||
|
||||
setWindowTitle(QString(tr("%1 Properties")).arg(options->Title));
|
||||
setWindowTitle(QString(tr("%1 Properties")).arg(options->Title.Buffer()));
|
||||
|
||||
ui->descriptionEdit->setText(QString::fromUtf8(options->Description));
|
||||
ui->authorEdit->setText(QString::fromUtf8(options->Author));
|
||||
ui->commentsEdit->setText(QString::fromUtf8(options->Comments));
|
||||
ui->descriptionEdit->setText(QString::fromUtf8(options->Properties.mDescription.Buffer()));
|
||||
ui->authorEdit->setText(QString::fromUtf8(options->Properties.mAuthor.Buffer()));
|
||||
ui->commentsEdit->setText(QString::fromUtf8(options->Properties.mComments.Buffer()));
|
||||
|
||||
if (options->BackgroundType == 2)
|
||||
if (options->Properties.mBackgroundType == LC_BACKGROUND_IMAGE)
|
||||
ui->imageRadio->setChecked(true);
|
||||
else if (options->BackgroundType == 1)
|
||||
else if (options->Properties.mBackgroundType == LC_BACKGROUND_GRADIENT)
|
||||
ui->gradientRadio->setChecked(true);
|
||||
else
|
||||
ui->solidRadio->setChecked(true);
|
||||
|
||||
ui->imageNameEdit->setText(options->BackgroundFileName);
|
||||
ui->imageTileCheckBox->setChecked(options->BackgroundTile);
|
||||
ui->fogCheckBox->setChecked(options->FogEnabled);
|
||||
ui->fogDensityEdit->setText(QString::number(options->FogDensity));
|
||||
ui->floorCheckBox->setChecked(options->DrawFloor);
|
||||
ui->imageNameEdit->setText(options->Properties.mBackgroundImage.Buffer());
|
||||
ui->imageTileCheckBox->setChecked(options->Properties.mBackgroundImageTile);
|
||||
ui->fogCheckBox->setChecked(options->Properties.mFogEnabled);
|
||||
ui->fogDensityEdit->setText(QString::number(options->Properties.mFogDensity));
|
||||
|
||||
QPixmap pix(12, 12);
|
||||
|
||||
pix.fill(QColor(options->SolidColor[0] * 255, options->SolidColor[1] * 255, options->SolidColor[2] * 255));
|
||||
pix.fill(QColor(options->Properties.mBackgroundSolidColor[0] * 255, options->Properties.mBackgroundSolidColor[1] * 255, options->Properties.mBackgroundSolidColor[2] * 255));
|
||||
ui->solidColorButton->setIcon(pix);
|
||||
pix.fill(QColor(options->GradientColor1[0] * 255, options->GradientColor1[1] * 255, options->GradientColor1[2] * 255));
|
||||
pix.fill(QColor(options->Properties.mBackgroundGradientColor1[0] * 255, options->Properties.mBackgroundGradientColor1[1] * 255, options->Properties.mBackgroundGradientColor1[2] * 255));
|
||||
ui->gradient1ColorButton->setIcon(pix);
|
||||
pix.fill(QColor(options->GradientColor2[0] * 255, options->GradientColor2[1] * 255, options->GradientColor2[2] * 255));
|
||||
pix.fill(QColor(options->Properties.mBackgroundGradientColor2[0] * 255, options->Properties.mBackgroundGradientColor2[1] * 255, options->Properties.mBackgroundGradientColor2[2] * 255));
|
||||
ui->gradient2ColorButton->setIcon(pix);
|
||||
pix.fill(QColor(options->FogColor[0] * 255, options->FogColor[1] * 255, options->FogColor[2] * 255));
|
||||
pix.fill(QColor(options->Properties.mFogColor[0] * 255, options->Properties.mFogColor[1] * 255, options->Properties.mFogColor[2] * 255));
|
||||
ui->fogColorButton->setIcon(pix);
|
||||
pix.fill(QColor(options->AmbientColor[0] * 255, options->AmbientColor[1] * 255, options->AmbientColor[2] * 255));
|
||||
pix.fill(QColor(options->Properties.mAmbientColor[0] * 255, options->Properties.mAmbientColor[1] * 255, options->Properties.mAmbientColor[2] * 255));
|
||||
ui->ambientColorButton->setIcon(pix);
|
||||
|
||||
lcPiecesLibrary *library = lcGetPiecesLibrary();
|
||||
@@ -128,25 +127,21 @@ lcQPropertiesDialog::~lcQPropertiesDialog()
|
||||
|
||||
void lcQPropertiesDialog::accept()
|
||||
{
|
||||
strncpy(options->Description, ui->descriptionEdit->text().toUtf8().data(), sizeof(options->Description));
|
||||
options->Description[sizeof(options->Description) - 1] = 0;
|
||||
strncpy(options->Author, ui->authorEdit->text().toUtf8().data(), sizeof(options->Author));
|
||||
options->Author[sizeof(options->Author) - 1] = 0;
|
||||
strncpy(options->Comments, ui->commentsEdit->toPlainText().toUtf8().data(), sizeof(options->Comments));
|
||||
options->Comments[sizeof(options->Comments) - 1] = 0;
|
||||
options->Properties.mDescription = ui->descriptionEdit->text().toUtf8().data();
|
||||
options->Properties.mAuthor = ui->authorEdit->text().toUtf8().data();
|
||||
options->Properties.mComments = ui->commentsEdit->toPlainText().toUtf8().data();
|
||||
|
||||
if (ui->imageRadio->isChecked())
|
||||
options->BackgroundType = 2;
|
||||
options->Properties.mBackgroundType = LC_BACKGROUND_IMAGE;
|
||||
else if (ui->gradientRadio->isChecked())
|
||||
options->BackgroundType = 1;
|
||||
options->Properties.mBackgroundType = LC_BACKGROUND_GRADIENT;
|
||||
else
|
||||
options->BackgroundType = 0;
|
||||
options->Properties.mBackgroundType = LC_BACKGROUND_SOLID;
|
||||
|
||||
strcpy(options->BackgroundFileName, ui->imageNameEdit->text().toLocal8Bit().data());
|
||||
options->BackgroundTile = ui->imageTileCheckBox->isChecked();
|
||||
options->FogEnabled = ui->fogCheckBox->isChecked();
|
||||
options->FogDensity = ui->fogDensityEdit->text().toFloat();
|
||||
options->DrawFloor = ui->floorCheckBox->isChecked();
|
||||
options->Properties.mBackgroundImage = ui->imageNameEdit->text().toLocal8Bit().data();
|
||||
options->Properties.mBackgroundImageTile = ui->imageTileCheckBox->isChecked();
|
||||
options->Properties.mFogEnabled = ui->fogCheckBox->isChecked();
|
||||
options->Properties.mFogDensity = ui->fogDensityEdit->text().toFloat();
|
||||
options->SetDefault = ui->setDefaultCheckBox->isChecked();
|
||||
|
||||
QDialog::accept();
|
||||
@@ -160,27 +155,27 @@ void lcQPropertiesDialog::colorClicked()
|
||||
|
||||
if (button == ui->solidColorButton)
|
||||
{
|
||||
color = options->SolidColor;
|
||||
color = options->Properties.mBackgroundSolidColor;
|
||||
title = tr("Select Background Color");
|
||||
}
|
||||
else if (button == ui->gradient1ColorButton)
|
||||
{
|
||||
color = options->GradientColor1;
|
||||
color = options->Properties.mBackgroundGradientColor1;
|
||||
title = tr("Select Background Top Color");
|
||||
}
|
||||
else if (button == ui->gradient2ColorButton)
|
||||
{
|
||||
color = options->GradientColor2;
|
||||
color = options->Properties.mBackgroundGradientColor2;
|
||||
title = tr("Select Background Bottom Color");
|
||||
}
|
||||
else if (button == ui->fogColorButton)
|
||||
{
|
||||
color = options->FogColor;
|
||||
color = options->Properties.mFogColor;
|
||||
title = tr("Select Fog Color");
|
||||
}
|
||||
else if (button == ui->ambientColorButton)
|
||||
{
|
||||
color = options->AmbientColor;
|
||||
color = options->Properties.mAmbientColor;
|
||||
title = tr("Select Ambient Light Color");
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>500</width>
|
||||
<height>389</height>
|
||||
<height>362</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -256,15 +256,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="floorCheckBox">
|
||||
<property name="text">
|
||||
<string>Draw Floor</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>floorCheckBox</zorder>
|
||||
<zorder>label_20</zorder>
|
||||
<zorder>fogCheckBox</zorder>
|
||||
</widget>
|
||||
@@ -347,7 +339,7 @@
|
||||
<tabstop>fogColorButton</tabstop>
|
||||
<tabstop>fogDensityEdit</tabstop>
|
||||
<tabstop>ambientColorButton</tabstop>
|
||||
<tabstop>floorCheckBox</tabstop>
|
||||
<tabstop>setDefaultCheckBox</tabstop>
|
||||
<tabstop>partsTable</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
@@ -359,8 +351,8 @@
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
<x>257</x>
|
||||
<y>352</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
@@ -375,8 +367,8 @@
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
<x>325</x>
|
||||
<y>352</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
|
||||
Reference in New Issue
Block a user