Moved transform type to main window.

This commit is contained in:
leo 2014-08-27 16:17:09 +00:00
parent 0a66fbeb82
commit 73952870fd
8 changed files with 27 additions and 26 deletions

View file

@ -10,6 +10,7 @@ lcMainWindow::lcMainWindow()
{
mActiveView = NULL;
mPreviewWidget = NULL;
mTransformType = LC_TRANSFORM_RELATIVE_TRANSLATION;
mAddKeys = false;

View file

@ -21,6 +21,11 @@ class lcMainWindow : public lcBaseWindow
return mTool;
}
lcTransformType GetTransformType() const
{
return mTransformType;
}
bool GetAddKeys() const
{
return mAddKeys;
@ -42,6 +47,7 @@ class lcMainWindow : public lcBaseWindow
void UpdateAllViews();
void SetTool(lcTool Tool);
void SetTransformType(lcTransformType TransformType);
void SetColorIndex(int ColorIndex);
void Close();
@ -65,7 +71,6 @@ class lcMainWindow : public lcBaseWindow
void UpdateLockSnap(lcuint32 Snap);
void UpdateSnap();
void UpdateUndoRedo(const char* UndoText, const char* RedoText);
void UpdateTransformType(int NewType);
void UpdateCurrentCamera(int CameraIndex);
void UpdatePerspective();
void UpdateCameraMenu();
@ -87,6 +92,7 @@ protected:
bool mAddKeys;
lcTool mTool;
lcTransformType mTransformType;
};
extern class lcMainWindow* gMainWindow;

View file

@ -15,6 +15,14 @@
#define LC_SEL_FOCUS_GROUPED 0x40 // Focused piece is grouped
#define LC_SEL_CAN_GROUP 0x80 // Can make a new group
enum lcTransformType
{
LC_TRANSFORM_ABSOLUTE_TRANSLATION,
LC_TRANSFORM_RELATIVE_TRANSLATION,
LC_TRANSFORM_ABSOLUTE_ROTATION,
LC_TRANSFORM_RELATIVE_ROTATION
};
enum lcBackgroundType
{
LC_BACKGROUND_SOLID,

View file

@ -31,7 +31,6 @@
Project::Project()
{
mTransformType = LC_TRANSFORM_RELATIVE_TRANSLATION;
m_pTerrain = new Terrain();
m_pBackground = new lcTexture();
memset(&mSearchOptions, 0, sizeof(mSearchOptions));
@ -55,7 +54,7 @@ void Project::UpdateInterface()
gMainWindow->SetTool(gMainWindow->GetTool());
gMainWindow->UpdateFocusObject(GetFocusObject());
gMainWindow->UpdateTransformType(mTransformType);
gMainWindow->SetTransformType(gMainWindow->GetTransformType());
gMainWindow->UpdateLockSnap(m_nSnap);
gMainWindow->UpdateSnap();
gMainWindow->UpdateCameraMenu();
@ -5043,15 +5042,14 @@ void Project::HandleCommand(LC_COMMANDS id)
} break;
case LC_EDIT_TRANSFORM:
TransformSelectedObjects((LC_TRANSFORM_TYPE)mTransformType, gMainWindow->GetTransformAmount());
TransformSelectedObjects(gMainWindow->GetTransformType(), gMainWindow->GetTransformAmount());
break;
case LC_EDIT_TRANSFORM_ABSOLUTE_TRANSLATION:
case LC_EDIT_TRANSFORM_RELATIVE_TRANSLATION:
case LC_EDIT_TRANSFORM_ABSOLUTE_ROTATION:
case LC_EDIT_TRANSFORM_RELATIVE_ROTATION:
mTransformType = id - LC_EDIT_TRANSFORM_ABSOLUTE_TRANSLATION;
gMainWindow->UpdateTransformType(mTransformType);
gMainWindow->SetTransformType((lcTransformType)(id - LC_EDIT_TRANSFORM_ABSOLUTE_TRANSLATION));
break;
case LC_EDIT_ACTION_SELECT:
@ -5761,7 +5759,7 @@ bool Project::RotateSelectedObjects(lcVector3& Delta, lcVector3& Remainder, bool
return true;
}
void Project::TransformSelectedObjects(LC_TRANSFORM_TYPE Type, const lcVector3& Transform)
void Project::TransformSelectedObjects(lcTransformType Type, const lcVector3& Transform)
{
switch (Type)
{
@ -6388,11 +6386,6 @@ void Project::ZoomRegionToolClicked(lcCamera* Camera, const lcVector3* Points, f
CheckPoint("Zoom");
}
void Project::OnMouseWheel(View* view, float Direction)
{
ZoomActiveView((int)((view->mInputState.Control ? 100 : 10) * Direction));
}
// Indicates if the existing string represents an instance of the candidate
// string in the form "<basename> (#<instance>)".
//

View file

@ -38,14 +38,6 @@
//#define LC_HTML_HTMLEXT 0x40
//#define LC_HTML_LISTID 0x80
enum LC_TRANSFORM_TYPE
{
LC_TRANSFORM_ABSOLUTE_TRANSLATION,
LC_TRANSFORM_RELATIVE_TRANSLATION,
LC_TRANSFORM_ABSOLUTE_ROTATION,
LC_TRANSFORM_RELATIVE_ROTATION
};
enum LC_MOUSE_TRACK
{
LC_TRACK_NONE,
@ -183,7 +175,7 @@ public:
bool GetFocusPosition(lcVector3& Position) const;
bool AnyObjectsSelected(bool PiecesOnly) const;
lcGroup* AddGroup(lcGroup* Parent);
void TransformSelectedObjects(LC_TRANSFORM_TYPE Type, const lcVector3& Transform);
void TransformSelectedObjects(lcTransformType Type, const lcVector3& Transform);
void ModifyObject(lcObject* Object, lcObjectProperty Property, void* Value);
void ZoomActiveView(int Amount);
@ -230,13 +222,11 @@ protected:
void RemoveEmptyGroups();
public:
void OnMouseWheel(View* view, float Direction);
void HandleCommand(LC_COMMANDS id);
lcuint32 m_nSnap;
protected:
int mTransformType;
PieceInfo* m_pCurPiece;
lcuint16 m_nMoveSnap;

View file

@ -2142,5 +2142,5 @@ void View::OnMouseMove()
void View::OnMouseWheel(float Direction)
{
mProject->OnMouseWheel(this, Direction);
mProject->ZoomActiveView((int)((mInputState.Control ? 100 : 10) * Direction));
}

View file

@ -397,6 +397,7 @@ void lcQMainWindow::createToolBars()
((QToolButton*)standardToolBar->widgetForAction(actions[LC_EDIT_LOCK_TOGGLE]))->setPopupMode(QToolButton::InstantPopup);
((QToolButton*)standardToolBar->widgetForAction(actions[LC_EDIT_SNAP_TOGGLE]))->setPopupMode(QToolButton::InstantPopup);
((QToolButton*)standardToolBar->widgetForAction(actions[LC_EDIT_SNAP_ANGLE]))->setPopupMode(QToolButton::InstantPopup);
((QToolButton*)standardToolBar->widgetForAction(actions[LC_EDIT_TRANSFORM]))->setPopupMode(QToolButton::InstantPopup);
QHBoxLayout *transformLayout = new QHBoxLayout;
QWidget *transformWidget = new QWidget();

View file

@ -542,12 +542,14 @@ void lcMainWindow::UpdateUndoRedo(const char* UndoText, const char* RedoText)
window->updateUndoRedo(UndoText, RedoText);
}
void lcMainWindow::UpdateTransformType(int NewType)
void lcMainWindow::SetTransformType(lcTransformType TransformType)
{
lcQMainWindow* window = (lcQMainWindow*)mHandle;
mTransformType = TransformType;
if (window)
window->updateTransformType(NewType);
window->updateTransformType(TransformType);
}
void lcMainWindow::UpdateCameraMenu()