mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +01:00
Fixed decimal point when saving text files.
This commit is contained in:
parent
9bf9fc45b5
commit
5ffe86ae21
4 changed files with 62 additions and 32 deletions
|
@ -101,8 +101,6 @@ protected:
|
|||
|
||||
int m_nMovedCount; // number of moved pieces
|
||||
char* m_pMovedReference; // moved pieces list
|
||||
int m_nPieceCount; // number of pieces
|
||||
PieceInfo* m_pPieceIdx; // pieces array
|
||||
int m_nTextureCount; // number of textures
|
||||
Texture* m_pTextures; // textures array
|
||||
|
||||
|
|
|
@ -862,6 +862,27 @@ MinifigWizard::MinifigWizard (GLWindow *share)
|
|||
Sys_MessageBox ("Unknown Minifig Preferences.");
|
||||
}
|
||||
|
||||
void MinifigWizard::OnInitialUpdate()
|
||||
{
|
||||
const unsigned char colors[LC_MFW_NUMITEMS] = { 0, 6, 4, 22, 0, 0, 6, 6, 22, 22, 9, 9, 9, 22, 22 };
|
||||
const char *pieces[LC_MFW_NUMITEMS] = { "3624", "3626BP01", "973", "None", "3819", "3818", "3820", "3820",
|
||||
"None", "None", "3815", "3817", "3816", "None", "None" };
|
||||
|
||||
MakeCurrent();
|
||||
|
||||
for (int i = 0; i < LC_MFW_NUMITEMS; i++)
|
||||
{
|
||||
m_Colors[i] = colors[i];
|
||||
m_Angles[i] = 0;
|
||||
|
||||
m_Info[i] = lcGetPiecesLibrary()->FindPieceInfo(pieces[i]);
|
||||
if (m_Info[i] != NULL)
|
||||
m_Info[i]->AddRef();
|
||||
}
|
||||
|
||||
Calculate();
|
||||
}
|
||||
|
||||
MinifigWizard::~MinifigWizard ()
|
||||
{
|
||||
char *ptr, buf[32];
|
||||
|
@ -905,6 +926,10 @@ MinifigWizard::~MinifigWizard ()
|
|||
|
||||
free (m_MinifigNames);
|
||||
free (m_MinifigTemplates);
|
||||
|
||||
for (i = 0; i < LC_MFW_NUMITEMS; i++)
|
||||
if (m_Info[i])
|
||||
m_Info[i]->DeRef();
|
||||
}
|
||||
|
||||
void MinifigWizard::ParseSettings(File& Settings)
|
||||
|
|
|
@ -30,7 +30,7 @@ enum LC_MFW_TYPES
|
|||
|
||||
struct lcMinifigPieceInfo
|
||||
{
|
||||
char Description[80];
|
||||
char Description[128];
|
||||
PieceInfo* Info;
|
||||
Matrix44 Offset;
|
||||
};
|
||||
|
@ -42,6 +42,7 @@ public:
|
|||
~MinifigWizard ();
|
||||
|
||||
void OnDraw ();
|
||||
void OnInitialUpdate();
|
||||
|
||||
void Calculate();
|
||||
int GetSelectionIndex(int Type) const;
|
||||
|
|
|
@ -1276,6 +1276,8 @@ bool Project::DoSave(char* lpszPathName, bool bReplace)
|
|||
strcat(buf, "\r\n");
|
||||
file.Write(buf, strlen(buf));
|
||||
|
||||
const char* OldLocale = setlocale(LC_NUMERIC, "C");
|
||||
|
||||
for (i = 1; i <= steps; i++)
|
||||
{
|
||||
for (pPiece = m_pPieces; pPiece; pPiece = pPiece->m_pNext)
|
||||
|
@ -1297,9 +1299,12 @@ bool Project::DoSave(char* lpszPathName, bool bReplace)
|
|||
file.Write("0 STEP\r\n", 8);
|
||||
}
|
||||
file.Write("0\r\n", 3);
|
||||
|
||||
setlocale(LC_NUMERIC, OldLocale);
|
||||
}
|
||||
else
|
||||
FileSave(&file, false); // save me
|
||||
|
||||
file.Close();
|
||||
|
||||
SetModifiedFlag(false); // back to unmodified
|
||||
|
@ -3955,6 +3960,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
|
|||
break;
|
||||
}
|
||||
|
||||
const char* OldLocale = setlocale(LC_NUMERIC, "C");
|
||||
fputs("// Stuff that doesn't need to be changed\n\n", f);
|
||||
|
||||
if (strlen(opts.libpath))
|
||||
|
@ -4147,6 +4153,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
|
|||
if (!f)
|
||||
{
|
||||
SystemDoMessageBox("Could not open file for writing.", LC_MB_OK|LC_MB_ICONERROR);
|
||||
setlocale(LC_NUMERIC, OldLocale);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -4212,6 +4219,7 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
|
|||
fclose (f);
|
||||
free (conv);
|
||||
free (flags);
|
||||
setlocale(LC_NUMERIC, OldLocale);
|
||||
|
||||
if (opts.render)
|
||||
{
|
||||
|
@ -4847,36 +4855,36 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
|
|||
|
||||
case LC_PIECE_MINIFIG:
|
||||
{
|
||||
MinifigWizard *wiz = new MinifigWizard (m_ViewList[0]);
|
||||
int i;
|
||||
MinifigWizard Wizard(m_ActiveView);
|
||||
int i;
|
||||
|
||||
if (SystemDoDialog (LC_DLG_MINIFIG, wiz))
|
||||
{
|
||||
SelectAndFocusNone(false);
|
||||
if (SystemDoDialog(LC_DLG_MINIFIG, &Wizard))
|
||||
{
|
||||
SelectAndFocusNone(false);
|
||||
|
||||
for (i = 0; i < LC_MFW_NUMITEMS; i++)
|
||||
{
|
||||
if (wiz->m_Info[i] == NULL)
|
||||
continue;
|
||||
for (i = 0; i < LC_MFW_NUMITEMS; i++)
|
||||
{
|
||||
if (Wizard.m_Info[i] == NULL)
|
||||
continue;
|
||||
|
||||
Matrix mat;
|
||||
Piece* pPiece = new Piece(wiz->m_Info[i]);
|
||||
Matrix mat;
|
||||
Piece* pPiece = new Piece(Wizard.m_Info[i]);
|
||||
|
||||
Vector4& Position = wiz->m_Matrices[i][3];
|
||||
Vector4 Rotation = wiz->m_Matrices[i].ToAxisAngle();
|
||||
Rotation[3] *= LC_RTOD;
|
||||
pPiece->Initialize(Position[0], Position[1], Position[2], m_nCurStep, m_nCurFrame, wiz->m_Colors[i]);
|
||||
pPiece->CreateName(m_pPieces);
|
||||
AddPiece(pPiece);
|
||||
pPiece->Select(true, false, false);
|
||||
Vector4& Position = Wizard.m_Matrices[i][3];
|
||||
Vector4 Rotation = Wizard.m_Matrices[i].ToAxisAngle();
|
||||
Rotation[3] *= LC_RTOD;
|
||||
pPiece->Initialize(Position[0], Position[1], Position[2], m_nCurStep, m_nCurFrame, Wizard.m_Colors[i]);
|
||||
pPiece->CreateName(m_pPieces);
|
||||
AddPiece(pPiece);
|
||||
pPiece->Select(true, false, false);
|
||||
|
||||
pPiece->ChangeKey(1, false, false, Rotation, LC_PK_ROTATION);
|
||||
pPiece->ChangeKey(1, true, false, Rotation, LC_PK_ROTATION);
|
||||
pPiece->UpdatePosition(m_bAnimation ? m_nCurFrame : m_nCurStep, m_bAnimation);
|
||||
pPiece->CalculateConnections(m_pConnections, m_bAnimation ? m_nCurFrame : m_nCurStep, m_bAnimation, false, true);
|
||||
pPiece->ChangeKey(1, false, false, Rotation, LC_PK_ROTATION);
|
||||
pPiece->ChangeKey(1, true, false, Rotation, LC_PK_ROTATION);
|
||||
pPiece->UpdatePosition(m_bAnimation ? m_nCurFrame : m_nCurStep, m_bAnimation);
|
||||
pPiece->CalculateConnections(m_pConnections, m_bAnimation ? m_nCurFrame : m_nCurStep, m_bAnimation, false, true);
|
||||
|
||||
SystemPieceComboAdd(wiz->m_Info[i]->m_strDescription);
|
||||
}
|
||||
SystemPieceComboAdd(Wizard.m_Info[i]->m_strDescription);
|
||||
}
|
||||
|
||||
float bs[6] = { 10000, 10000, 10000, -10000, -10000, -10000 };
|
||||
int max = 0;
|
||||
|
@ -4904,16 +4912,12 @@ void Project::HandleCommand(LC_COMMANDS id, unsigned long nParam)
|
|||
pGroup->m_fCenter[1] = (bs[1]+bs[4])/2;
|
||||
pGroup->m_fCenter[2] = (bs[2]+bs[5])/2;
|
||||
|
||||
messenger->Dispatch (LC_MSG_FOCUS_CHANGED, NULL);
|
||||
messenger->Dispatch (LC_MSG_FOCUS_CHANGED, NULL);
|
||||
UpdateSelection();
|
||||
UpdateAllViews();
|
||||
SetModifiedFlag(true);
|
||||
CheckPoint("Minifig");
|
||||
}
|
||||
|
||||
for (i = 0; i < LC_MFW_NUMITEMS; i++)
|
||||
if (wiz->m_Info[i])
|
||||
wiz->m_Info[i]->DeRef();
|
||||
} break;
|
||||
|
||||
case LC_PIECE_ARRAY:
|
||||
|
@ -7502,6 +7506,8 @@ void Project::OnLeftButtonDown(View* view, int x, int y, bool bControl, bool bSh
|
|||
SetAction(LC_ACTION_ROTATE_VIEW);
|
||||
m_RestoreAction = true;
|
||||
}
|
||||
else
|
||||
m_RestoreAction = false;
|
||||
|
||||
switch (m_nCurAction)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue