Fixed compiler warnings.

This commit is contained in:
leo
2013-01-06 19:24:25 +00:00
parent c10dd63bd8
commit ee6dae8249
14 changed files with 104 additions and 117 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ MODULES := $(OSDIR) common
### Look for include files in each of the modules
CPPFLAGS += $(patsubst %,-I%,$(MODULES))
CPPFLAGS += -g -W -Wall -Wno-unused-parameter
CPPFLAGS += -g -Wextra -Wall -Wno-unused-parameter
### Extra libraries if required
LIBS :=
+4 -4
View File
@@ -172,7 +172,7 @@ void Camera::CreateName(const PtrArray<Camera>& Cameras)
for (int CameraIdx = 0; CameraIdx < Cameras.GetSize(); CameraIdx++)
if (strncmp(Cameras[CameraIdx]->m_strName, Prefix, strlen(Prefix)) == 0)
if (sscanf(Cameras[CameraIdx]->m_strName + strlen(Prefix), " %d", &i) == 1)
if (i > max)
if (i > max)
max = i;
sprintf(m_strName, "%s %d", Prefix, max+1);
@@ -335,9 +335,9 @@ bool Camera::FileLoad(lcFile& file)
lcuint32 show;
lcint32 user;
show = file.ReadU32();
file.ReadU32(&show, 1);
// if (version > 2)
user = file.ReadS32();
file.ReadS32(&user, 1);
if (show == 0)
m_nState |= LC_CAMERA_HIDDEN;
}
@@ -543,7 +543,7 @@ void Camera::Render(float fLineWidth)
glEnableClientState(GL_VERTEX_ARRAY);
float box[24][3] =
{
{
{ 0.2f, 0.2f, 0.2f }, { -0.2f, 0.2f, 0.2f },
{ -0.2f, 0.2f, 0.2f }, { -0.2f, -0.2f, 0.2f },
{ -0.2f, -0.2f, 0.2f }, { 0.2f, -0.2f, 0.2f },
+5 -4
View File
@@ -1,7 +1,6 @@
// Curve class, used to represent all flexible objects
//
#include "lc_global.h"
#if 0
#include "lc_math.h"
#include "lc_colors.h"
#include <stdlib.h>
@@ -88,7 +87,7 @@ void CurvePoint::Initialize ()
// draw +Z end as a triangle fan
glBegin(GL_TRIANGLE_FAN);
glVertex3f(0.0, 0.0, radius);
for (j = 0; j <= slices; j++)
for (j = 0; j <= slices; j++)
{
theta = (j == slices) ? 0.0f : j * dtheta;
x = (float)(-sin(theta) * sin(drho));
@@ -856,3 +855,5 @@ void Curve::SetFocus (bool bFocus, void *pParam)
#endif
#endif // 0
+1 -1
View File
@@ -54,7 +54,7 @@ void Group::FileLoad(lcFile* file)
file->ReadBuffer(m_strName, 65);
file->ReadFloats(m_fCenter, 3);
file->ReadS32(&i, 1);
m_pGroup = (Group*)i;
m_pGroup = (Group*)(long)i;
}
void Group::FileSave(lcFile* file, Group* pGroups)
+2 -3
View File
@@ -521,20 +521,19 @@ bool lcZipFile::ReadCentralDir()
return false;
}
if (FileInfo.offset_curfile == (lcuint64)(unsigned long)-1)
if (FileInfo.offset_curfile == (lcuint64)-1)
{
// Relative Header offset.
if (mFile->ReadU64(&FileInfo.offset_curfile, 1) != 1)
return false;
}
if (FileInfo.disk_num_start == (unsigned long)-1)
if (FileInfo.disk_num_start == (lcuint16)-1)
{
// Disk Start Number.
if (mFile->ReadU32(&Number32, 1) != 1)
return false;
}
}
else
{
+4 -4
View File
@@ -18,8 +18,8 @@ enum LC_OBJECT_TYPE
LC_OBJECT_CAMERA_TARGET,
LC_OBJECT_LIGHT,
LC_OBJECT_LIGHT_TARGET,
LC_OBJECT_CURVE,
LC_OBJECT_CURVE_POINT,
// LC_OBJECT_CURVE,
// LC_OBJECT_CURVE_POINT,
// LC_OBJECT_GROUP,
// LC_OBJECT_GROUP_PIVOT,
};
@@ -121,8 +121,8 @@ public:
{ return m_nObjectType == LC_OBJECT_CAMERA; }
bool IsLight() const
{ return m_nObjectType == LC_OBJECT_LIGHT; }
bool IsCurve() const
{ return m_nObjectType == LC_OBJECT_CURVE; }
// bool IsCurve() const
// { return m_nObjectType == LC_OBJECT_CURVE; }
LC_OBJECT_TYPE GetType() const
{ return m_nObjectType; }
+4 -4
View File
@@ -229,7 +229,7 @@ bool Piece::FileLoad(lcFile& file, char* name)
lcint32 i = -1;
if (version > 6)
file.ReadS32(&i, 1);
m_pGroup = (Group*)i;
m_pGroup = (Group*)(long)i;
}
else
{
@@ -240,7 +240,7 @@ bool Piece::FileLoad(lcFile& file, char* name)
if (ch == 0)
m_pGroup = (Group*)-1;
else
m_pGroup = (Group*)(lcuint32)ch;
m_pGroup = (Group*)(long)ch;
file.ReadU8(&ch, 1);
if (ch & 0x01)
@@ -309,7 +309,7 @@ void Piece::CreateName(Piece* pPiece)
for (; pPiece; pPiece = pPiece->m_pNext)
if (strncmp (pPiece->m_strName, mPieceInfo->m_strDescription, strlen(mPieceInfo->m_strDescription)) == 0)
if (sscanf(pPiece->m_strName + strlen(mPieceInfo->m_strDescription), " #%d", &i) == 1)
if (i > max)
if (i > max)
max = i;
sprintf (m_strName, "%s #%.2d", mPieceInfo->m_strDescription, max+1);
@@ -330,7 +330,7 @@ void Piece::Select (bool bSelecting, bool bFocus, bool bMultiple)
m_nState &= ~(LC_PIECE_FOCUSED);
else
m_nState &= ~(LC_PIECE_SELECTED|LC_PIECE_FOCUSED);
}
}
}
void Piece::InsertTime (unsigned short start, bool animation, unsigned short time)
+5 -5
View File
@@ -76,19 +76,19 @@ public:
{ return m_strName; }
void SetStepShow(unsigned char step)
{ m_nStepShow = step; }
const unsigned char GetStepShow()
unsigned char GetStepShow()
{ return m_nStepShow; }
void SetStepHide(unsigned char step)
{ m_nStepHide = step; }
const unsigned char GetStepHide()
{ return m_nStepHide; }
unsigned char GetStepHide()
{ return (unsigned char)m_nStepHide; }
void SetFrameShow(unsigned short frame)
{ m_nFrameShow = frame; }
const unsigned short GetFrameShow()
unsigned short GetFrameShow()
{ return m_nFrameShow; }
void SetFrameHide(unsigned short frame)
{ m_nFrameHide = frame; }
const unsigned short GetFrameHide()
unsigned short GetFrameHide()
{ return m_nFrameHide; }
void Render(bool bLighting, bool bEdges);
+66 -64
View File
@@ -427,7 +427,7 @@ bool Project::FileLoad(lcFile* file, bool bUndo, bool bMerge)
Library->OpenCache();
while (count--)
{
{
if (fv > 0.4f)
{
char name[LC_PIECE_NAME_LEN];
@@ -456,7 +456,7 @@ bool Project::FileLoad(lcFile* file, bool bUndo, bool bMerge)
char name[LC_PIECE_NAME_LEN];
float pos[3], rot[3];
lcuint8 color, step, group;
file->ReadFloats(pos, 3);
file->ReadFloats(rot, 3);
file->ReadU8(&color, 1);
@@ -471,7 +471,7 @@ bool Project::FileLoad(lcFile* file, bool bUndo, bool bMerge)
pPiece->SetColorCode(lcGetColorCodeFromOriginalColor(color));
pPiece->CreateName(m_pPieces);
AddPiece(pPiece);
lcMatrix44 ModelWorld = lcMul(lcMatrix44RotationZ(rot[2] * LC_DTOR), lcMul(lcMatrix44RotationY(rot[1] * LC_DTOR), lcMatrix44RotationX(rot[0] * LC_DTOR)));
lcVector4 AxisAngle = lcMatrix44ToAxisAngle(ModelWorld);
AxisAngle[3] *= LC_RTOD;
@@ -727,7 +727,7 @@ bool Project::FileLoad(lcFile* file, bool bUndo, bool bMerge)
m_nMoveSnap = sh;
}
}
if (fv > 1.0f)
{
file->ReadU32(&rgb, 1);
@@ -738,7 +738,7 @@ bool Project::FileLoad(lcFile* file, bool bUndo, bool bMerge)
m_fGradient2[0] = (float)((unsigned char) (rgb))/255;
m_fGradient2[1] = (float)((unsigned char) (((unsigned short) (rgb)) >> 8))/255;
m_fGradient2[2] = (float)((unsigned char) ((rgb) >> 16))/255;
if (fv > 1.1f)
m_pTerrain->FileLoad (file);
else
@@ -908,7 +908,7 @@ void Project::FileSave(lcFile* file, bool bUndo)
lcuint32 pos = 0;
i = Sys_ProfileLoadInt ("Default", "Save Preview", 0);
if (i != 0)
if (i != 0)
{
pos = file->GetPosition();
@@ -1000,7 +1000,7 @@ void Project::FileReadLDraw(lcFile* file, const lcMatrix44& CurrentTransform, in
float fmat[12];
if (sscanf(buf, "%d %i %g %g %g %g %g %g %g %g %g %g %g %g %s[12]",
&cmd, &color, &fmat[0], &fmat[1], &fmat[2], &fmat[3], &fmat[4], &fmat[5], &fmat[6],
&cmd, &color, &fmat[0], &fmat[1], &fmat[2], &fmat[3], &fmat[4], &fmat[5], &fmat[6],
&fmat[7], &fmat[8], &fmat[9], &fmat[10], &fmat[11], &tmp[0]) != 15)
continue;
@@ -1012,7 +1012,7 @@ void Project::FileReadLDraw(lcFile* file, const lcMatrix44& CurrentTransform, in
if (cmd == 1)
{
int cl = color;
if (color == 16)
if (color == 16)
cl = DefColor;
strcpy(pn, tmp);
@@ -1322,7 +1322,7 @@ bool Project::OnNewDocument()
// if (pFrame != NULL)
// pFrame->PostMessage (WM_LC_UPDATE_LIST, 1, m_nCurColor+1);
// set cur group to 0
return true;
}
@@ -1685,7 +1685,7 @@ void Project::RenderBackground(View* view)
Verts[0][0] = 0; Verts[0][1] = ViewHeight;
Coords[1][0] = tw; Coords[1][1] = 0;
Verts[1][0] = ViewWidth; Verts[1][1] = ViewHeight;
Coords[2][0] = tw; Coords[2][1] = th;
Coords[2][0] = tw; Coords[2][1] = th;
Verts[2][0] = ViewWidth; Verts[2][1] = 0;
Coords[3][0] = 0; Coords[3][1] = th;
Verts[3][0] = 0; Verts[3][1] = 0;
@@ -2071,11 +2071,11 @@ void Project::RenderSceneObjects(View* view)
glDisable (GL_LIGHTING);
int index = 0;
Light *pLight;
for (pLight = m_pLights; pLight; pLight = pLight->m_pNext, index++)
glDisable ((GLenum)(GL_LIGHT0+index));
}
for (int CameraIdx = 0; CameraIdx < mCameras.GetSize(); CameraIdx++)
{
Camera* pCamera = mCameras[CameraIdx];
@@ -2101,7 +2101,7 @@ void Project::RenderSceneObjects(View* view)
Mats[1] = lcMul(lcMatrix44(lcVector4(0, 1, 0, 0), lcVector4(1, 0, 0, 0), lcVector4(0, 0, 1, 0), lcVector4(0, 0, 0, 1)), Mats[0]);
Mats[2] = lcMul(lcMatrix44(lcVector4(0, 0, 1, 0), lcVector4(0, 1, 0, 0), lcVector4(1, 0, 0, 0), lcVector4(0, 0, 0, 1)), Mats[0]);
lcVector3 pts[3] =
lcVector3 pts[3] =
{
lcMul30(lcVector3(20, 0, 0), Mats[0]),
lcMul30(lcVector3(0, 20, 0), Mats[0]),
@@ -2412,7 +2412,7 @@ void Project::RenderOverlays(View* view)
glEnable(GL_DEPTH_TEST);
}
if (m_nCurAction == LC_ACTION_ROTATE || (m_nCurAction == LC_ACTION_SELECT && m_nTracking != LC_TRACK_NONE && m_OverlayMode >= LC_OVERLAY_ROTATE_X && m_OverlayMode <= LC_OVERLAY_ROTATE_XYZ))
{
const float OverlayRotateRadius = 2.0f;
@@ -2874,7 +2874,7 @@ void Project::RenderViewports(View* view)
glBegin(GL_QUADS);
m_pScreenFont->PrintText(3.0f, (float)view->GetHeight() - 1.0f - 6.0f, 0.0f, view->mCamera->GetName());
glEnd();
glDisable(GL_ALPHA_TEST);
glDisable(GL_TEXTURE_2D);
@@ -3120,7 +3120,7 @@ bool Project::RemoveSelectedObjects()
mCameras.RemoveIndex(CameraIdx);
CameraIdx--;
delete pCamera;
removed = true;
SystemUpdateCameraMenu(mCameras);
@@ -3278,7 +3278,7 @@ void Project::CheckAutoSave()
m_bUndo = TRUE;
file.SeekToBegin();
CArchive ar(&file, CArchive::store);
Serialize(ar);
Serialize(ar);
ar.Close();
m_bUndo = FALSE;
*/ }
@@ -3590,7 +3590,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
OnNewDocument();
UpdateAllViews ();
} break;
case LC_FILE_OPEN:
{
char filename[LC_MAXPATH];
@@ -3601,7 +3601,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
OpenProject(filename);
}
} break;
case LC_FILE_MERGE:
{
char filename[LC_MAXPATH];
@@ -3697,15 +3697,17 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
if (!opts.filename[0])
strcpy(opts.filename, "Image");
char* ext = strrchr(opts.filename, '.');
if (ext)
char* Ext = strrchr(opts.filename, '.');
if (Ext)
{
if (!strcmp(ext, ".jpg") || !strcmp(ext, ".jpeg") || !strcmp(ext, ".bmp") || !strcmp(ext, ".gif") || !strcmp(ext, ".png") || !strcmp(ext, ".avi"))
*ext = 0;
if (!strcmp(Ext, ".jpg") || !strcmp(Ext, ".jpeg") || !strcmp(Ext, ".bmp") || !strcmp(Ext, ".gif") || !strcmp(Ext, ".png") || !strcmp(Ext, ".avi"))
*Ext = 0;
}
const char* ext;
switch (opts.imopts.format)
{
default:
case LC_IMAGE_BMP: ext = ".bmp"; break;
case LC_IMAGE_GIF: ext = ".gif"; break;
case LC_IMAGE_JPG: ext = ".jpg"; break;
@@ -3895,9 +3897,9 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
for (i = 1; i <= last; i++)
{
fprintf(f, "<IMG SRC=\"%s-%02d%s\" ALT=\"Step %02d\" WIDTH=%d HEIGHT=%d><BR><BR>\n",
fprintf(f, "<IMG SRC=\"%s-%02d%s\" ALT=\"Step %02d\" WIDTH=%d HEIGHT=%d><BR><BR>\n",
m_strTitle, i, ext, i, opts.imdlg.width, opts.imdlg.height);
if (opts.liststep)
CreateHTMLPieceList(f, i, opts.images, ext);
}
@@ -3937,9 +3939,9 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
f = fopen(fn, "wt");
fprintf(f, "<HTML>\n<HEAD>\n<TITLE>%s - Step %02d</TITLE>\n</HEAD>\n<BR>\n<CENTER>\n", m_strTitle, i);
fprintf(f, "<IMG SRC=\"%s-%02d%s\" ALT=\"Step %02d\" WIDTH=%d HEIGHT=%d><BR><BR>\n",
fprintf(f, "<IMG SRC=\"%s-%02d%s\" ALT=\"Step %02d\" WIDTH=%d HEIGHT=%d><BR><BR>\n",
m_strTitle, i, ext, i, opts.imdlg.width, opts.imdlg.height);
if (opts.liststep)
CreateHTMLPieceList(f, i, opts.images, ext);
@@ -3968,7 +3970,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
strcat (fn, htmlext);
f = fopen (fn, "wt");
fprintf (f, "<HTML>\n<HEAD>\n<TITLE>Pieces used by %s</TITLE>\n</HEAD>\n<BR>\n<CENTER>\n", m_strTitle);
CreateHTMLPieceList(f, 0, opts.images, ext);
fputs("</CENTER>\n<BR><HR><BR>", f);
@@ -4024,7 +4026,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
continue;
glDepthFunc(GL_LEQUAL);
glClearColor(1,1,1,1);
glClearColor(1,1,1,1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
glEnable(GL_COLOR_MATERIAL);
@@ -4320,7 +4322,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
sprintf(CmdLine, "\"+L%slg\\\" \"+L%sar\\\" \"+I%s\"", opts.libpath, opts.libpath, opts.outpath);
else
sprintf(CmdLine, "\"+I%s\"", opts.outpath);
ShellExecute(::GetDesktopWindow(), "open", opts.povpath, CmdLine, NULL, SW_SHOWNORMAL);
#endif
@@ -4455,7 +4457,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
sprintf(Line, "g %s\n", buf);
OBJFile.WriteLine(Line);
Info->mMesh->ExportWavefrontIndices(OBJFile, pPiece->mColorCode, vert);
vert += Info->mMesh->mNumVertices;
}
@@ -4556,12 +4558,12 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
pUndo->pNext = m_pRedoList;
m_pRedoList = pUndo;
pUndo = m_pUndoList;
DeleteContents(true);
FileLoad(&pUndo->file, true, false);
}
if (m_bUndoOriginal && (m_pUndoList != NULL) && (m_pUndoList->pNext == NULL))
SetModifiedFlag(false);
}
@@ -4572,7 +4574,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
// Remove the first element from the redo list.
pUndo = m_pRedoList;
m_pRedoList = pUndo->pNext;
// Check if we can delete the last undo info.
for (pTmp = m_pUndoList, i = 0; pTmp; pTmp = pTmp->pNext, i++)
if ((i == 30) && (pTmp->pNext != NULL))
@@ -4680,7 +4682,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
pPiece->m_pNext = pPasted;
pPasted = pPiece;
}
else
else
delete pPiece;
}
@@ -4740,7 +4742,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
for (pGroup = m_pGroups; pGroup; pGroup = pGroup->m_pNext)
if (strncmp("Pasted Group #", pGroup->m_strName, 14) == 0)
if (sscanf(pGroup->m_strName + 14, "%d", &a) == 1)
if (a > max)
if (a > max)
max = a;
sprintf(groups[j]->m_strName, "Pasted Group #%.2d", max+1);
@@ -4750,7 +4752,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
else
delete groups[j];
}
free(groups);
file->ReadBuffer(&i, sizeof(i));
@@ -4785,7 +4787,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
UpdateSelection();
UpdateAllViews ();
} break;
case LC_EDIT_SELECT_NONE:
{
SelectAndFocusNone(false);
@@ -4793,7 +4795,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
UpdateSelection();
UpdateAllViews();
} break;
case LC_EDIT_SELECT_INVERT:
{
Piece* pPiece;
@@ -5067,7 +5069,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
if (SystemDoDialog(LC_DLG_ARRAY, &opts))
{
int total;
total = opts.n1DCount;
if (opts.nArrayDimension > 0)
total *= opts.n2DCount;
@@ -5158,7 +5160,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
if (opts.nArrayDimension == 0)
continue;
for (j = 0; j < opts.n2DCount; j++)
{
if (j != 0)
@@ -5264,7 +5266,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
pPiece->DoGroup(pGroup);
pPiece->CompareBoundingBox(bs);
}
pGroup->m_fCenter[0] = (bs[0]+bs[3])/2;
pGroup->m_fCenter[1] = (bs[1]+bs[4])/2;
pGroup->m_fCenter[2] = (bs[2]+bs[5])/2;
@@ -5649,7 +5651,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
else
SystemUpdateTime(m_bAnimation, m_nCurStep, 255);
} break;
case LC_VIEW_STEP_PREVIOUS:
{
if (m_bAnimation)
@@ -5667,7 +5669,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
else
SystemUpdateTime(m_bAnimation, m_nCurStep, 255);
} break;
case LC_VIEW_STEP_FIRST:
{
if (m_bAnimation)
@@ -5779,7 +5781,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
} break;
case LC_VIEW_PLAY:
{
{
SelectAndFocusNone(false);
UpdateSelection();
m_bStopRender = false;
@@ -5911,7 +5913,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
else
SystemUpdateTime(m_bAnimation, m_nCurStep, 255);
} break;
case LC_TOOLBAR_ADDKEYS:
{
m_bAddKeys = !m_bAddKeys;
@@ -6000,10 +6002,10 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
case LC_TOOLBAR_FASTRENDER:
{
if (m_nDetail & LC_DET_FAST)
m_nDetail &= ~LC_DET_FAST;
if (m_nDetail & LC_DET_FAST)
m_nDetail &= ~LC_DET_FAST;
else
m_nDetail |= LC_DET_FAST;
m_nDetail |= LC_DET_FAST;
UpdateAllViews();
SystemUpdateRenderingMode((m_nDetail & LC_DET_FAST) != 0);
@@ -7421,7 +7423,7 @@ bool Project::OnKeyDown(char nKey, bool bControl, bool bShift)
ret = true;
} break;
case KEY_MINUS: // case '-': case '_':
{
if (bShift)
@@ -7543,7 +7545,7 @@ bool Project::OnKeyDown(char nKey, bool bControl, bool bShift)
ret = true;
} break;
case KEY_UP: case KEY_DOWN: case KEY_LEFT:
case KEY_UP: case KEY_DOWN: case KEY_LEFT:
case KEY_RIGHT: case KEY_NEXT: case KEY_PRIOR:
// if (AnyObjectSelected(FALSE))
{
@@ -7785,7 +7787,7 @@ void Project::OnLeftButtonDown(View* view, int x, int y, bool bControl, bool bSh
{
Object* Closest = FindObjectFromPoint(view, x, y);
if (Action == LC_ACTION_SELECT)
if (Action == LC_ACTION_SELECT)
{
if (Closest != NULL)
{
@@ -8085,7 +8087,7 @@ void Project::OnLeftButtonDoubleClick(View* view, int x, int y, bool bControl, b
Object* Closest = FindObjectFromPoint(view, x, y);
// if (m_nCurAction == LC_ACTION_SELECT)
// if (m_nCurAction == LC_ACTION_SELECT)
{
SelectAndFocusNone(bControl);
@@ -8357,7 +8359,7 @@ void Project::OnMouseMove(View* view, int x, int y, bool bControl, bool bShift)
m_fTrack[0] = ptx;
m_fTrack[1] = pty;
m_fTrack[2] = ptz;
Light* pLight = m_pLights;
pLight->Move (1, m_bAnimation, false, delta[0], delta[1], delta[2]);
@@ -8376,7 +8378,7 @@ void Project::OnMouseMove(View* view, int x, int y, bool bControl, bool bShift)
m_fTrack[0] = ptx;
m_fTrack[1] = pty;
m_fTrack[2] = ptz;
Camera* pCamera = mCameras[mCameras.GetSize() - 1];
pCamera->Move(1, m_bAnimation, false, delta[0], delta[1], delta[2]);
@@ -8567,7 +8569,7 @@ void Project::OnMouseMove(View* view, int x, int y, bool bControl, bool bShift)
if (Redraw)
UpdateAllViews();
} break;
case LC_ACTION_ROTATE:
{
Camera* Camera = m_ActiveView->mCamera;
@@ -8761,7 +8763,7 @@ void Project::OnMouseMove(View* view, int x, int y, bool bControl, bool bShift)
SystemUpdateFocus(NULL);
UpdateAllViews();
} break;
case LC_ACTION_ROTATE_VIEW:
{
if ((m_nDownY == y) && (m_nDownX == x))
@@ -8799,7 +8801,7 @@ void Project::OnMouseMove(View* view, int x, int y, bool bControl, bool bShift)
SystemUpdateFocus(NULL);
UpdateAllViews();
} break;
case LC_ACTION_ROLL:
{
if (m_nDownX == x)
@@ -8990,16 +8992,16 @@ void Project::MouseUpdateOverlays(View* view, int x, int y)
Mode = LC_OVERLAY_ROTATE_XYZ;
// Point P on a line defined by two points P1 and P2 is described by P = P1 + u (P2 - P1)
// A sphere centered at P3 with radius r is described by (x - x3)^2 + (y - y3)^2 + (z - z3)^2 = r^2
// A sphere centered at P3 with radius r is described by (x - x3)^2 + (y - y3)^2 + (z - z3)^2 = r^2
// Substituting the equation of the line into the sphere gives a quadratic equation where:
// a = (x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2
// b = 2[ (x2 - x1) (x1 - x3) + (y2 - y1) (y1 - y3) + (z2 - z1) (z1 - z3) ]
// c = x32 + y32 + z32 + x12 + y12 + z12 - 2[x3 x1 + y3 y1 + z3 z1] - r2
// a = (x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2
// b = 2[ (x2 - x1) (x1 - x3) + (y2 - y1) (y1 - y3) + (z2 - z1) (z1 - z3) ]
// c = x32 + y32 + z32 + x12 + y12 + z12 - 2[x3 x1 + y3 y1 + z3 z1] - r2
// The solutions to this quadratic are described by: (-b +- sqrt(b^2 - 4 a c) / 2 a
// The exact behavior is determined by b^2 - 4 a c:
// If this is less than 0 then the line does not intersect the sphere.
// If this is less than 0 then the line does not intersect the sphere.
// If it equals 0 then the line is a tangent to the sphere intersecting it at one point
// If it is greater then 0 the line intersects the sphere at two points.
// If it is greater then 0 the line intersects the sphere at two points.
float x1 = SegStart[0], y1 = SegStart[1], z1 = SegStart[2];
float x2 = SegEnd[0], y2 = SegEnd[1], z2 = SegEnd[2];
+2 -2
View File
@@ -198,7 +198,7 @@ bool String::Match(const String& Expression) const
}
else if (*p == '(')
{
const char* Start = p;
// const char* Start = p;
int c = 0;
// Skip what's inside the parenthesis.
@@ -339,7 +339,7 @@ int String::CompareNoCase(const char *string, int count) const
{
c1 = tolower (*ch);
c2 = tolower (*string);
if (c1 != c2)
return (c1 - c2);
+4 -19
View File
@@ -2282,8 +2282,8 @@ int groupeditdlg_execute(void* param)
GtkWidget *dlg;
GtkWidget *vbox;
GtkWidget *ctree, *scr;
LC_GROUPEDITDLG_STRUCT s;
s.data = param;
// LC_GROUPEDITDLG_STRUCT s;
// s.data = param;
int ret;
dlg = gtk_dialog_new_with_buttons("Edit Groups", GTK_WINDOW(((GtkWidget*)(*main_window))),
@@ -2291,7 +2291,7 @@ int groupeditdlg_execute(void* param)
GTK_STOCK_OK, GTK_RESPONSE_OK, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL);
gtk_container_set_border_width(GTK_CONTAINER(dlg), 5);
gtk_widget_set_usize(dlg, 450, 280);
s.dlg = dlg;
// s.dlg = dlg;
vbox = GTK_DIALOG(dlg)->vbox;
gtk_box_set_spacing(GTK_BOX(vbox), 10);
@@ -2482,22 +2482,9 @@ static void librarydlg_treefocus (GtkCTree *ctree, GtkCTreeNode *row, gint colum
librarydlg_update_list (GTK_WIDGET (data));
}
static GtkWidget *last_dlg = NULL;
static void librarydlg_command (GtkWidget *widget, gpointer data)
{
GtkWidget *parent = gtk_widget_get_toplevel (widget);
LibraryDialog *dlg = (LibraryDialog*) gtk_object_get_data (GTK_OBJECT (parent), "menu_file_import_piece");
int id = GPOINTER_TO_INT (data);
dlg = (LibraryDialog *)last_dlg;
dlg->HandleCommand (id);
}
int librarydlg_execute (void *param)
{
GtkWidget *dlg, *vbox, *clist, *scr, *ctree, *hsplit, *item, *menu, *menubar, *handle;
GtkWidget *dlg, *vbox, *clist, *scr, *ctree, *hsplit, *menu, *menubar, *handle;
GtkAccelGroup *accel;
int loop = 1, ret = LC_CANCEL;
lcPiecesLibrary *lib = g_App->GetPiecesLibrary();
@@ -2620,8 +2607,6 @@ int librarydlg_execute (void *param)
gtk_grab_add (dlg);
gtk_widget_show (dlg);
last_dlg = dlg;
while (loop)
gtk_main_iteration ();
+1 -1
View File
@@ -23,7 +23,7 @@ static void openprojectdlg_preview(GtkFileChooser* dlg, GtkPreview* preview)
if (filename)
p = strrchr(filename, '.');
if ((p != NULL) && (g_strcasecmp(p+1, "lcd") == 0))
if ((p != NULL) && (g_ascii_strcasecmp(p+1, "lcd") == 0))
{
float fv;
char id[32];
+1 -1
View File
@@ -75,7 +75,7 @@ static void minifigdlg_color_clicked(GtkWidget *widget, gpointer data)
gtk_menu_append(GTK_MENU(menu), menuitem);
gtk_object_set_data(GTK_OBJECT(menuitem), "button", widget);
gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(minifigdlg_color_response), (void*)i);
gtk_signal_connect(GTK_OBJECT(menuitem), "activate", GTK_SIGNAL_FUNC(minifigdlg_color_response), GINT_TO_POINTER(i));
}
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, 0);
+4 -4
View File
@@ -53,10 +53,10 @@ static bool read_var (const char *section, const char *key, char *value)
strcpy (value, ptr+1);
fclose (rc);
while (value[strlen (value)-1] == 10 ||
while (value[strlen (value)-1] == 10 ||
value[strlen (value)-1] == 13 ||
value[strlen (value)-1] == 32)
value[strlen (value)-1] = 0;
value[strlen (value)-1] = 0;
return true;
}
}
@@ -86,7 +86,7 @@ static bool save_var (const char *section, const char *key, const char *value)
len = ftell (rc);
rewind (rc);
buf = g_malloc (len);
fread (buf, len, 1, rc);
len = fread (buf, len, 1, rc);
old_rc.WriteBuffer (buf, len);
g_free (buf);
fclose (rc);
@@ -114,7 +114,7 @@ static bool save_var (const char *section, const char *key, const char *value)
break;
}
}
}
}
if (!found)
{