2012-03-20 01:57:42 +01:00
# include "lc_global.h"
2013-08-16 03:25:51 +02:00
# include "lc_mainwindow.h"
2015-02-01 03:33:42 +01:00
# include <QPrintDialog>
# include <QPrintPreviewDialog>
2016-12-16 18:14:19 +01:00
# include "lc_partselectionwidget.h"
2015-03-04 21:37:09 +01:00
# include "lc_timelinewidget.h"
2015-01-26 00:04:39 +01:00
# include "lc_qglwidget.h"
# include "lc_qcolorlist.h"
# include "lc_qpropertiestree.h"
# include "lc_qutils.h"
2016-08-01 05:44:15 +02:00
# include "lc_qupdatedialog.h"
# include "lc_qaboutdialog.h"
2013-08-09 06:57:18 +02:00
# include "lc_profile.h"
2014-05-03 23:16:48 +02:00
# include "view.h"
2014-12-08 08:32:39 +01:00
# include "project.h"
2015-01-26 00:04:39 +01:00
# include "piece.h"
# include "group.h"
# include "pieceinf.h"
# include "lc_library.h"
2014-12-08 08:32:39 +01:00
# include "lc_colors.h"
2011-09-07 23:06:51 +02:00
2013-08-09 06:57:18 +02:00
lcMainWindow * gMainWindow ;
2011-09-07 23:06:51 +02:00
2017-03-26 19:28:58 +02:00
void lcModelTabWidget : : ResetLayout ( )
{
QLayout * TabLayout = layout ( ) ;
QWidget * TopWidget = TabLayout - > itemAt ( 0 ) - > widget ( ) ;
if ( TopWidget - > metaObject ( ) = = & lcQGLWidget : : staticMetaObject )
return ;
QWidget * Widget = GetAnyViewWidget ( ) ;
TabLayout - > addWidget ( Widget ) ;
TabLayout - > removeWidget ( TopWidget ) ;
TopWidget - > deleteLater ( ) ;
Widget - > setFocus ( ) ;
SetActiveView ( ( View * ) ( ( lcQGLWidget * ) Widget ) - > widget ) ;
}
2017-03-27 03:14:08 +02:00
void lcModelTabWidget : : Clear ( )
{
ResetLayout ( ) ;
2017-04-14 02:26:40 +02:00
mModel = nullptr ;
2017-03-27 03:14:08 +02:00
mViews . RemoveAll ( ) ;
2017-04-14 02:26:40 +02:00
mActiveView = nullptr ;
2017-03-27 03:14:08 +02:00
lcQGLWidget * Widget = ( lcQGLWidget * ) layout ( ) - > itemAt ( 0 ) - > widget ( ) ;
delete Widget - > widget ;
2017-04-14 02:26:40 +02:00
Widget - > widget = nullptr ;
2017-03-27 03:14:08 +02:00
}
2013-08-09 06:57:18 +02:00
lcMainWindow : : lcMainWindow ( )
2014-05-03 23:16:48 +02:00
{
2015-01-26 00:04:39 +01:00
memset ( mActions , 0 , sizeof ( mActions ) ) ;
2014-08-27 18:17:09 +02:00
mTransformType = LC_TRANSFORM_RELATIVE_TRANSLATION ;
2011-09-07 23:06:51 +02:00
2014-12-08 08:32:39 +01:00
mColorIndex = lcGetColorIndex ( 4 ) ;
mTool = LC_TOOL_SELECT ;
2014-05-21 00:15:42 +02:00
mAddKeys = false ;
2015-04-25 00:11:50 +02:00
mMoveSnapEnabled = true ;
mAngleSnapEnabled = true ;
2014-10-05 07:21:51 +02:00
mMoveXYSnapIndex = 4 ;
mMoveZSnapIndex = 3 ;
mAngleSnapIndex = 5 ;
mLockX = false ;
mLockY = false ;
mLockZ = false ;
2015-01-18 06:36:14 +01:00
mRelativeTransform = true ;
2017-04-14 02:26:40 +02:00
mCurrentPieceInfo = nullptr ;
2014-10-05 07:21:51 +02:00
2014-09-21 03:31:01 +02:00
memset ( & mSearchOptions , 0 , sizeof ( mSearchOptions ) ) ;
2014-05-21 00:15:42 +02:00
2013-08-09 06:57:18 +02:00
for ( int FileIdx = 0 ; FileIdx < LC_MAX_RECENT_FILES ; FileIdx + + )
2014-10-12 19:34:18 +02:00
mRecentFiles [ FileIdx ] = lcGetProfileString ( ( LC_PROFILE_KEY ) ( LC_PROFILE_RECENT_FILE1 + FileIdx ) ) ;
2011-09-07 23:06:51 +02:00
2013-08-09 06:57:18 +02:00
gMainWindow = this ;
2011-09-07 23:06:51 +02:00
}
2013-08-09 06:57:18 +02:00
lcMainWindow : : ~ lcMainWindow ( )
2011-09-07 23:06:51 +02:00
{
2016-12-16 18:14:19 +01:00
if ( mCurrentPieceInfo )
{
2017-01-23 04:28:05 +01:00
lcPiecesLibrary * Library = lcGetPiecesLibrary ( ) ;
Library - > ReleasePieceInfo ( mCurrentPieceInfo ) ;
2017-04-14 02:26:40 +02:00
mCurrentPieceInfo = nullptr ;
2016-12-16 18:14:19 +01:00
}
2013-08-09 06:57:18 +02:00
for ( int FileIdx = 0 ; FileIdx < LC_MAX_RECENT_FILES ; FileIdx + + )
lcSetProfileString ( ( LC_PROFILE_KEY ) ( LC_PROFILE_RECENT_FILE1 + FileIdx ) , mRecentFiles [ FileIdx ] ) ;
2011-09-07 23:06:51 +02:00
2017-04-14 02:26:40 +02:00
gMainWindow = nullptr ;
2013-08-09 06:57:18 +02:00
}
2011-09-07 23:06:51 +02:00
2015-01-26 00:04:39 +01:00
void lcMainWindow : : CreateWidgets ( )
{
2016-10-15 21:13:31 +02:00
setAcceptDrops ( true ) ;
2017-03-29 20:04:04 +02:00
setWindowIcon ( QIcon ( " :/resources/leocad.png " ) ) ;
2015-01-26 00:04:39 +01:00
setWindowFilePath ( QString ( ) ) ;
CreateActions ( ) ;
CreateToolBars ( ) ;
CreateMenus ( ) ;
CreateStatusBar ( ) ;
2017-03-27 08:12:05 +02:00
int AASamples = lcGetProfileInt ( LC_PROFILE_ANTIALIASING_SAMPLES ) ;
if ( AASamples > 1 )
{
QGLFormat format ;
format . setSampleBuffers ( true ) ;
format . setSamples ( AASamples ) ;
QGLFormat : : setDefaultFormat ( format ) ;
}
2016-03-06 02:47:00 +01:00
mModelTabWidget = new QTabWidget ( ) ;
2016-03-06 21:07:39 +01:00
# if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
mModelTabWidget - > tabBar ( ) - > setMovable ( true ) ;
2016-03-06 02:47:00 +01:00
mModelTabWidget - > tabBar ( ) - > setTabsClosable ( true ) ;
2016-03-06 21:07:39 +01:00
connect ( mModelTabWidget - > tabBar ( ) , SIGNAL ( tabCloseRequested ( int ) ) , this , SLOT ( ModelTabClosed ( int ) ) ) ;
# else
mModelTabWidget - > setMovable ( true ) ;
mModelTabWidget - > setTabsClosable ( true ) ;
connect ( mModelTabWidget , SIGNAL ( tabCloseRequested ( int ) ) , this , SLOT ( ModelTabClosed ( int ) ) ) ;
# endif
2016-03-06 02:47:00 +01:00
setCentralWidget ( mModelTabWidget ) ;
connect ( mModelTabWidget , SIGNAL ( currentChanged ( int ) ) , this , SLOT ( ModelTabChanged ( int ) ) ) ;
2015-01-26 00:04:39 +01:00
connect ( QApplication : : clipboard ( ) , SIGNAL ( dataChanged ( ) ) , this , SLOT ( ClipboardChanged ( ) ) ) ;
ClipboardChanged ( ) ;
QSettings Settings ;
Settings . beginGroup ( " MainWindow " ) ;
resize ( QSize ( 800 , 600 ) ) ;
move ( QPoint ( 200 , 200 ) ) ;
restoreGeometry ( Settings . value ( " Geometry " ) . toByteArray ( ) ) ;
restoreState ( Settings . value ( " State " ) . toByteArray ( ) ) ;
2017-02-06 18:06:52 +01:00
mPartSelectionWidget - > LoadState ( Settings ) ;
2015-01-26 00:04:39 +01:00
Settings . endGroup ( ) ;
}
void lcMainWindow : : CreateActions ( )
{
for ( int CommandIdx = 0 ; CommandIdx < LC_NUM_COMMANDS ; CommandIdx + + )
{
2015-09-25 08:03:30 +02:00
QAction * Action = new QAction ( qApp - > translate ( " Menu " , gCommands [ CommandIdx ] . MenuName ) , this ) ;
Action - > setStatusTip ( qApp - > translate ( " Status " , gCommands [ CommandIdx ] . StatusText ) ) ;
2015-01-26 00:04:39 +01:00
connect ( Action , SIGNAL ( triggered ( ) ) , this , SLOT ( ActionTriggered ( ) ) ) ;
addAction ( Action ) ;
mActions [ CommandIdx ] = Action ;
}
mActions [ LC_FILE_NEW ] - > setToolTip ( tr ( " New Project " ) ) ;
mActions [ LC_FILE_OPEN ] - > setToolTip ( tr ( " Open Project " ) ) ;
mActions [ LC_FILE_SAVE ] - > setToolTip ( tr ( " Save Project " ) ) ;
2015-10-03 20:57:59 +02:00
QIcon FileNewIcon ;
FileNewIcon . addFile ( " :/resources/file_new.png " ) ;
FileNewIcon . addFile ( " :/resources/file_new_16.png " ) ;
mActions [ LC_FILE_NEW ] - > setIcon ( FileNewIcon ) ;
QIcon FileSaveIcon ;
FileSaveIcon . addFile ( " :/resources/file_save.png " ) ;
FileSaveIcon . addFile ( " :/resources/file_save_16.png " ) ;
mActions [ LC_FILE_SAVE ] - > setIcon ( FileSaveIcon ) ;
QIcon FileOpenIcon ;
FileOpenIcon . addFile ( " :/resources/file_open.png " ) ;
FileOpenIcon . addFile ( " :/resources/file_open_16.png " ) ;
mActions [ LC_FILE_OPEN ] - > setIcon ( FileOpenIcon ) ;
QIcon FilePrintIcon ;
FilePrintIcon . addFile ( " :/resources/file_print.png " ) ;
FilePrintIcon . addFile ( " :/resources/file_print_16.png " ) ;
mActions [ LC_FILE_PRINT ] - > setIcon ( FilePrintIcon ) ;
QIcon FilePrintPreviewIcon ;
FilePrintPreviewIcon . addFile ( " :/resources/file_print_preview.png " ) ;
FilePrintPreviewIcon . addFile ( " :/resources/file_print_preview_16.png " ) ;
mActions [ LC_FILE_PRINT_PREVIEW ] - > setIcon ( FilePrintPreviewIcon ) ;
QIcon EditUndoIcon ;
EditUndoIcon . addFile ( " :/resources/edit_undo.png " ) ;
EditUndoIcon . addFile ( " :/resources/edit_undo_16.png " ) ;
mActions [ LC_EDIT_UNDO ] - > setIcon ( EditUndoIcon ) ;
QIcon EditRedoIcon ;
EditRedoIcon . addFile ( " :/resources/edit_redo.png " ) ;
EditRedoIcon . addFile ( " :/resources/edit_redo_16.png " ) ;
mActions [ LC_EDIT_REDO ] - > setIcon ( EditRedoIcon ) ;
QIcon EditCutIcon ;
EditCutIcon . addFile ( " :/resources/edit_cut.png " ) ;
EditCutIcon . addFile ( " :/resources/edit_cut_16.png " ) ;
mActions [ LC_EDIT_CUT ] - > setIcon ( EditCutIcon ) ;
QIcon EditCopyIcon ;
EditCopyIcon . addFile ( " :/resources/edit_copy.png " ) ;
EditCopyIcon . addFile ( " :/resources/edit_copy_16.png " ) ;
mActions [ LC_EDIT_COPY ] - > setIcon ( EditCopyIcon ) ;
QIcon EditPasteIcon ;
EditPasteIcon . addFile ( " :/resources/edit_paste.png " ) ;
EditPasteIcon . addFile ( " :/resources/edit_paste_16.png " ) ;
mActions [ LC_EDIT_PASTE ] - > setIcon ( EditPasteIcon ) ;
QIcon EditActionInsertIcon ;
EditActionInsertIcon . addFile ( " :/resources/action_insert.png " ) ;
EditActionInsertIcon . addFile ( " :/resources/action_insert_16.png " ) ;
mActions [ LC_EDIT_ACTION_INSERT ] - > setIcon ( EditActionInsertIcon ) ;
QIcon EditActionLightIcon ;
EditActionLightIcon . addFile ( " :/resources/action_light.png " ) ;
EditActionLightIcon . addFile ( " :/resources/action_light_16.png " ) ;
mActions [ LC_EDIT_ACTION_LIGHT ] - > setIcon ( EditActionLightIcon ) ;
QIcon EditActionSpotLightIcon ;
EditActionSpotLightIcon . addFile ( " :/resources/action_spotlight.png " ) ;
EditActionSpotLightIcon . addFile ( " :/resources/action_spotlight_16.png " ) ;
mActions [ LC_EDIT_ACTION_SPOTLIGHT ] - > setIcon ( EditActionSpotLightIcon ) ;
QIcon EditActionSelectIcon ;
EditActionSelectIcon . addFile ( " :/resources/action_select.png " ) ;
EditActionSelectIcon . addFile ( " :/resources/action_select_16.png " ) ;
mActions [ LC_EDIT_ACTION_SELECT ] - > setIcon ( EditActionSelectIcon ) ;
QIcon EditActionMoveIcon ;
EditActionMoveIcon . addFile ( " :/resources/action_move.png " ) ;
EditActionMoveIcon . addFile ( " :/resources/action_move_16.png " ) ;
mActions [ LC_EDIT_ACTION_MOVE ] - > setIcon ( EditActionMoveIcon ) ;
QIcon EditActionRotateIcon ;
EditActionRotateIcon . addFile ( " :/resources/action_rotate.png " ) ;
EditActionRotateIcon . addFile ( " :/resources/action_rotate_16.png " ) ;
mActions [ LC_EDIT_ACTION_ROTATE ] - > setIcon ( EditActionRotateIcon ) ;
QIcon EditActionDeleteIcon ;
EditActionDeleteIcon . addFile ( " :/resources/action_delete.png " ) ;
EditActionDeleteIcon . addFile ( " :/resources/action_delete_16.png " ) ;
mActions [ LC_EDIT_ACTION_DELETE ] - > setIcon ( EditActionDeleteIcon ) ;
QIcon EditActionPaintIcon ;
EditActionPaintIcon . addFile ( " :/resources/action_paint.png " ) ;
EditActionPaintIcon . addFile ( " :/resources/action_paint_16.png " ) ;
mActions [ LC_EDIT_ACTION_PAINT ] - > setIcon ( EditActionPaintIcon ) ;
QIcon EditActionZoomIcon ;
EditActionZoomIcon . addFile ( " :/resources/action_zoom.png " ) ;
EditActionZoomIcon . addFile ( " :/resources/action_zoom_16.png " ) ;
mActions [ LC_EDIT_ACTION_ZOOM ] - > setIcon ( EditActionZoomIcon ) ;
QIcon EditActionPanIcon ;
EditActionPanIcon . addFile ( " :/resources/action_pan.png " ) ;
EditActionPanIcon . addFile ( " :/resources/action_pan_16.png " ) ;
mActions [ LC_EDIT_ACTION_PAN ] - > setIcon ( EditActionPanIcon ) ;
2015-01-26 00:04:39 +01:00
mActions [ LC_EDIT_ACTION_CAMERA ] - > setIcon ( QIcon ( " :/resources/action_camera.png " ) ) ;
mActions [ LC_EDIT_ACTION_ROTATE_VIEW ] - > setIcon ( QIcon ( " :/resources/action_rotate_view.png " ) ) ;
mActions [ LC_EDIT_ACTION_ROLL ] - > setIcon ( QIcon ( " :/resources/action_roll.png " ) ) ;
mActions [ LC_EDIT_ACTION_ZOOM_REGION ] - > setIcon ( QIcon ( " :/resources/action_zoom_region.png " ) ) ;
mActions [ LC_EDIT_TRANSFORM_RELATIVE ] - > setIcon ( QIcon ( " :/resources/edit_transform_relative.png " ) ) ;
mActions [ LC_PIECE_SHOW_EARLIER ] - > setIcon ( QIcon ( " :/resources/piece_show_earlier.png " ) ) ;
mActions [ LC_PIECE_SHOW_LATER ] - > setIcon ( QIcon ( " :/resources/piece_show_later.png " ) ) ;
mActions [ LC_VIEW_SPLIT_HORIZONTAL ] - > setIcon ( QIcon ( " :/resources/view_split_horizontal.png " ) ) ;
mActions [ LC_VIEW_SPLIT_VERTICAL ] - > setIcon ( QIcon ( " :/resources/view_split_vertical.png " ) ) ;
mActions [ LC_VIEW_ZOOM_IN ] - > setIcon ( QIcon ( " :/resources/view_zoomin.png " ) ) ;
mActions [ LC_VIEW_ZOOM_OUT ] - > setIcon ( QIcon ( " :/resources/view_zoomout.png " ) ) ;
mActions [ LC_VIEW_ZOOM_EXTENTS ] - > setIcon ( QIcon ( " :/resources/view_zoomextents.png " ) ) ;
mActions [ LC_VIEW_TIME_FIRST ] - > setIcon ( QIcon ( " :/resources/time_first.png " ) ) ;
mActions [ LC_VIEW_TIME_PREVIOUS ] - > setIcon ( QIcon ( " :/resources/time_previous.png " ) ) ;
mActions [ LC_VIEW_TIME_NEXT ] - > setIcon ( QIcon ( " :/resources/time_next.png " ) ) ;
mActions [ LC_VIEW_TIME_LAST ] - > setIcon ( QIcon ( " :/resources/time_last.png " ) ) ;
mActions [ LC_VIEW_TIME_ADD_KEYS ] - > setIcon ( QIcon ( " :/resources/time_add_keys.png " ) ) ;
mActions [ LC_HELP_HOMEPAGE ] - > setIcon ( QIcon ( " :/resources/help_homepage.png " ) ) ;
mActions [ LC_HELP_EMAIL ] - > setIcon ( QIcon ( " :/resources/help_email.png " ) ) ;
mActions [ LC_EDIT_LOCK_X ] - > setCheckable ( true ) ;
mActions [ LC_EDIT_LOCK_Y ] - > setCheckable ( true ) ;
mActions [ LC_EDIT_LOCK_Z ] - > setCheckable ( true ) ;
mActions [ LC_EDIT_TRANSFORM_RELATIVE ] - > setCheckable ( true ) ;
2015-04-25 00:11:50 +02:00
mActions [ LC_EDIT_SNAP_MOVE_TOGGLE ] - > setCheckable ( true ) ;
mActions [ LC_EDIT_SNAP_ANGLE_TOGGLE ] - > setCheckable ( true ) ;
2015-01-26 00:04:39 +01:00
mActions [ LC_VIEW_CAMERA_NONE ] - > setCheckable ( true ) ;
mActions [ LC_VIEW_TIME_ADD_KEYS ] - > setCheckable ( true ) ;
QActionGroup * ActionSnapXYGroup = new QActionGroup ( this ) ;
for ( int ActionIdx = LC_EDIT_SNAP_MOVE_XY0 ; ActionIdx < = LC_EDIT_SNAP_MOVE_XY9 ; ActionIdx + + )
{
mActions [ ActionIdx ] - > setCheckable ( true ) ;
ActionSnapXYGroup - > addAction ( mActions [ ActionIdx ] ) ;
}
QActionGroup * ActionSnapZGroup = new QActionGroup ( this ) ;
for ( int ActionIdx = LC_EDIT_SNAP_MOVE_Z0 ; ActionIdx < = LC_EDIT_SNAP_MOVE_Z9 ; ActionIdx + + )
{
mActions [ ActionIdx ] - > setCheckable ( true ) ;
ActionSnapZGroup - > addAction ( mActions [ ActionIdx ] ) ;
}
QActionGroup * ActionSnapAngleGroup = new QActionGroup ( this ) ;
for ( int ActionIdx = LC_EDIT_SNAP_ANGLE0 ; ActionIdx < = LC_EDIT_SNAP_ANGLE9 ; ActionIdx + + )
{
mActions [ ActionIdx ] - > setCheckable ( true ) ;
ActionSnapAngleGroup - > addAction ( mActions [ ActionIdx ] ) ;
}
QActionGroup * ActionTransformTypeGroup = new QActionGroup ( this ) ;
for ( int ActionIdx = LC_EDIT_TRANSFORM_ABSOLUTE_TRANSLATION ; ActionIdx < = LC_EDIT_TRANSFORM_RELATIVE_ROTATION ; ActionIdx + + )
{
mActions [ ActionIdx ] - > setCheckable ( true ) ;
ActionTransformTypeGroup - > addAction ( mActions [ ActionIdx ] ) ;
}
QActionGroup * ActionToolGroup = new QActionGroup ( this ) ;
for ( int ActionIdx = LC_EDIT_ACTION_FIRST ; ActionIdx < = LC_EDIT_ACTION_LAST ; ActionIdx + + )
{
mActions [ ActionIdx ] - > setCheckable ( true ) ;
ActionToolGroup - > addAction ( mActions [ ActionIdx ] ) ;
}
QActionGroup * ActionCameraGroup = new QActionGroup ( this ) ;
ActionCameraGroup - > addAction ( mActions [ LC_VIEW_CAMERA_NONE ] ) ;
for ( int ActionIdx = LC_VIEW_CAMERA_FIRST ; ActionIdx < = LC_VIEW_CAMERA_LAST ; ActionIdx + + )
{
mActions [ ActionIdx ] - > setCheckable ( true ) ;
ActionCameraGroup - > addAction ( mActions [ ActionIdx ] ) ;
}
QActionGroup * ActionPerspectiveGroup = new QActionGroup ( this ) ;
for ( int ActionIdx = LC_VIEW_PROJECTION_FIRST ; ActionIdx < = LC_VIEW_PROJECTION_LAST ; ActionIdx + + )
{
mActions [ ActionIdx ] - > setCheckable ( true ) ;
ActionPerspectiveGroup - > addAction ( mActions [ ActionIdx ] ) ;
}
QActionGroup * ModelGroup = new QActionGroup ( this ) ;
for ( int ActionIdx = LC_MODEL_FIRST ; ActionIdx < = LC_MODEL_LAST ; ActionIdx + + )
{
mActions [ ActionIdx ] - > setCheckable ( true ) ;
ModelGroup - > addAction ( mActions [ ActionIdx ] ) ;
}
UpdateShortcuts ( ) ;
}
void lcMainWindow : : CreateMenus ( )
{
QMenu * TransformMenu = new QMenu ( tr ( " Transform " ) , this ) ;
TransformMenu - > addAction ( mActions [ LC_EDIT_TRANSFORM_RELATIVE_TRANSLATION ] ) ;
TransformMenu - > addAction ( mActions [ LC_EDIT_TRANSFORM_ABSOLUTE_TRANSLATION ] ) ;
TransformMenu - > addAction ( mActions [ LC_EDIT_TRANSFORM_RELATIVE_ROTATION ] ) ;
TransformMenu - > addAction ( mActions [ LC_EDIT_TRANSFORM_ABSOLUTE_ROTATION ] ) ;
mActions [ LC_EDIT_TRANSFORM ] - > setMenu ( TransformMenu ) ;
2015-12-04 21:32:10 +01:00
mCameraMenu = new QMenu ( tr ( " C&ameras " ) , this ) ;
mCameraMenu - > addAction ( mActions [ LC_VIEW_CAMERA_NONE ] ) ;
2015-01-26 00:04:39 +01:00
for ( int actionIdx = LC_VIEW_CAMERA_FIRST ; actionIdx < = LC_VIEW_CAMERA_LAST ; actionIdx + + )
2015-12-04 21:32:10 +01:00
mCameraMenu - > addAction ( mActions [ actionIdx ] ) ;
2015-01-26 00:04:39 +01:00
2015-12-04 21:32:10 +01:00
mCameraMenu - > addSeparator ( ) ;
mCameraMenu - > addAction ( mActions [ LC_VIEW_CAMERA_RESET ] ) ;
mViewpointMenu = new QMenu ( tr ( " &Viewpoints " ) , this ) ;
mViewpointMenu - > addAction ( mActions [ LC_VIEW_VIEWPOINT_FRONT ] ) ;
mViewpointMenu - > addAction ( mActions [ LC_VIEW_VIEWPOINT_BACK ] ) ;
mViewpointMenu - > addAction ( mActions [ LC_VIEW_VIEWPOINT_LEFT ] ) ;
mViewpointMenu - > addAction ( mActions [ LC_VIEW_VIEWPOINT_RIGHT ] ) ;
mViewpointMenu - > addAction ( mActions [ LC_VIEW_VIEWPOINT_TOP ] ) ;
mViewpointMenu - > addAction ( mActions [ LC_VIEW_VIEWPOINT_BOTTOM ] ) ;
mViewpointMenu - > addAction ( mActions [ LC_VIEW_VIEWPOINT_HOME ] ) ;
2015-01-26 00:04:39 +01:00
QMenu * FileMenu = menuBar ( ) - > addMenu ( tr ( " &File " ) ) ;
FileMenu - > addAction ( mActions [ LC_FILE_NEW ] ) ;
FileMenu - > addAction ( mActions [ LC_FILE_OPEN ] ) ;
FileMenu - > addAction ( mActions [ LC_FILE_MERGE ] ) ;
FileMenu - > addSeparator ( ) ;
FileMenu - > addAction ( mActions [ LC_FILE_SAVE ] ) ;
FileMenu - > addAction ( mActions [ LC_FILE_SAVEAS ] ) ;
FileMenu - > addAction ( mActions [ LC_FILE_SAVE_IMAGE ] ) ;
2017-06-26 03:20:34 +02:00
QMenu * ImportMenu = FileMenu - > addMenu ( tr ( " &Import " ) ) ;
ImportMenu - > addAction ( mActions [ LC_FILE_IMPORT_LDD ] ) ;
2015-01-26 00:04:39 +01:00
QMenu * ExportMenu = FileMenu - > addMenu ( tr ( " &Export " ) ) ;
ExportMenu - > addAction ( mActions [ LC_FILE_EXPORT_3DS ] ) ;
ExportMenu - > addAction ( mActions [ LC_FILE_EXPORT_BRICKLINK ] ) ;
ExportMenu - > addAction ( mActions [ LC_FILE_EXPORT_CSV ] ) ;
ExportMenu - > addAction ( mActions [ LC_FILE_EXPORT_HTML ] ) ;
ExportMenu - > addAction ( mActions [ LC_FILE_EXPORT_POVRAY ] ) ;
ExportMenu - > addAction ( mActions [ LC_FILE_EXPORT_WAVEFRONT ] ) ;
FileMenu - > addSeparator ( ) ;
FileMenu - > addAction ( mActions [ LC_FILE_PRINT ] ) ;
FileMenu - > addAction ( mActions [ LC_FILE_PRINT_PREVIEW ] ) ;
// FileMenu->addAction(mActions[LC_FILE_PRINT_BOM]);
FileMenu - > addSeparator ( ) ;
FileMenu - > addAction ( mActions [ LC_FILE_RECENT1 ] ) ;
FileMenu - > addAction ( mActions [ LC_FILE_RECENT2 ] ) ;
FileMenu - > addAction ( mActions [ LC_FILE_RECENT3 ] ) ;
FileMenu - > addAction ( mActions [ LC_FILE_RECENT4 ] ) ;
mActionFileRecentSeparator = FileMenu - > addSeparator ( ) ;
FileMenu - > addAction ( mActions [ LC_FILE_EXIT ] ) ;
QMenu * EditMenu = menuBar ( ) - > addMenu ( tr ( " &Edit " ) ) ;
EditMenu - > addAction ( mActions [ LC_EDIT_UNDO ] ) ;
EditMenu - > addAction ( mActions [ LC_EDIT_REDO ] ) ;
EditMenu - > addSeparator ( ) ;
EditMenu - > addAction ( mActions [ LC_EDIT_CUT ] ) ;
EditMenu - > addAction ( mActions [ LC_EDIT_COPY ] ) ;
EditMenu - > addAction ( mActions [ LC_EDIT_PASTE ] ) ;
EditMenu - > addSeparator ( ) ;
EditMenu - > addAction ( mActions [ LC_EDIT_FIND ] ) ;
2015-10-03 20:57:59 +02:00
mActions [ LC_EDIT_FIND ] - > setIcon ( QIcon ( " :/resources/edit_find.png " ) ) ;
2015-01-26 00:04:39 +01:00
EditMenu - > addAction ( mActions [ LC_EDIT_FIND_NEXT ] ) ;
EditMenu - > addAction ( mActions [ LC_EDIT_FIND_PREVIOUS ] ) ;
EditMenu - > addSeparator ( ) ;
EditMenu - > addAction ( mActions [ LC_EDIT_SELECT_ALL ] ) ;
EditMenu - > addAction ( mActions [ LC_EDIT_SELECT_NONE ] ) ;
EditMenu - > addAction ( mActions [ LC_EDIT_SELECT_INVERT ] ) ;
EditMenu - > addAction ( mActions [ LC_EDIT_SELECT_BY_NAME ] ) ;
2017-02-17 07:57:11 +01:00
EditMenu - > addAction ( mActions [ LC_EDIT_SELECT_BY_COLOR ] ) ;
2015-01-26 00:04:39 +01:00
QMenu * ViewMenu = menuBar ( ) - > addMenu ( tr ( " &View " ) ) ;
ViewMenu - > addAction ( mActions [ LC_VIEW_PREFERENCES ] ) ;
ViewMenu - > addSeparator ( ) ;
ViewMenu - > addAction ( mActions [ LC_VIEW_ZOOM_EXTENTS ] ) ;
ViewMenu - > addAction ( mActions [ LC_VIEW_LOOK_AT ] ) ;
2015-12-04 21:32:10 +01:00
ViewMenu - > addMenu ( mViewpointMenu ) ;
ViewMenu - > addMenu ( mCameraMenu ) ;
2015-01-26 00:04:39 +01:00
QMenu * PerspectiveMenu = ViewMenu - > addMenu ( tr ( " Projection " ) ) ;
PerspectiveMenu - > addAction ( mActions [ LC_VIEW_PROJECTION_PERSPECTIVE ] ) ;
PerspectiveMenu - > addAction ( mActions [ LC_VIEW_PROJECTION_ORTHO ] ) ;
QMenu * StepMenu = ViewMenu - > addMenu ( tr ( " Ste&p " ) ) ;
StepMenu - > addAction ( mActions [ LC_VIEW_TIME_FIRST ] ) ;
StepMenu - > addAction ( mActions [ LC_VIEW_TIME_PREVIOUS ] ) ;
StepMenu - > addAction ( mActions [ LC_VIEW_TIME_NEXT ] ) ;
StepMenu - > addAction ( mActions [ LC_VIEW_TIME_LAST ] ) ;
StepMenu - > addSeparator ( ) ;
StepMenu - > addAction ( mActions [ LC_VIEW_TIME_INSERT ] ) ;
StepMenu - > addAction ( mActions [ LC_VIEW_TIME_DELETE ] ) ;
ViewMenu - > addSeparator ( ) ;
ViewMenu - > addAction ( mActions [ LC_VIEW_SPLIT_HORIZONTAL ] ) ;
ViewMenu - > addAction ( mActions [ LC_VIEW_SPLIT_VERTICAL ] ) ;
ViewMenu - > addAction ( mActions [ LC_VIEW_REMOVE_VIEW ] ) ;
ViewMenu - > addAction ( mActions [ LC_VIEW_RESET_VIEWS ] ) ;
ViewMenu - > addSeparator ( ) ;
QMenu * ToolBarsMenu = ViewMenu - > addMenu ( tr ( " T&oolbars " ) ) ;
ToolBarsMenu - > addAction ( mPartsToolBar - > toggleViewAction ( ) ) ;
2016-12-20 23:11:19 +01:00
ToolBarsMenu - > addAction ( mColorsToolBar - > toggleViewAction ( ) ) ;
2015-01-26 00:04:39 +01:00
ToolBarsMenu - > addAction ( mPropertiesToolBar - > toggleViewAction ( ) ) ;
2015-03-04 21:37:09 +01:00
ToolBarsMenu - > addAction ( mTimelineToolBar - > toggleViewAction ( ) ) ;
2015-01-26 00:04:39 +01:00
ToolBarsMenu - > addSeparator ( ) ;
ToolBarsMenu - > addAction ( mStandardToolBar - > toggleViewAction ( ) ) ;
ToolBarsMenu - > addAction ( mToolsToolBar - > toggleViewAction ( ) ) ;
ToolBarsMenu - > addAction ( mTimeToolBar - > toggleViewAction ( ) ) ;
ViewMenu - > addAction ( mActions [ LC_VIEW_FULLSCREEN ] ) ;
QMenu * PieceMenu = menuBar ( ) - > addMenu ( tr ( " &Piece " ) ) ;
PieceMenu - > addAction ( mActions [ LC_PIECE_INSERT ] ) ;
PieceMenu - > addAction ( mActions [ LC_PIECE_DELETE ] ) ;
2017-03-09 00:55:38 +01:00
PieceMenu - > addAction ( mActions [ LC_PIECE_DUPLICATE ] ) ;
2015-12-14 19:01:17 +01:00
PieceMenu - > addAction ( mActions [ LC_PIECE_RESET_PIVOT_POINT ] ) ;
2015-01-26 00:04:39 +01:00
PieceMenu - > addAction ( mActions [ LC_PIECE_ARRAY ] ) ;
PieceMenu - > addAction ( mActions [ LC_PIECE_MINIFIG_WIZARD ] ) ;
PieceMenu - > addSeparator ( ) ;
2015-12-04 23:41:08 +01:00
PieceMenu - > addAction ( mActions [ LC_PIECE_VIEW_SELECTED_MODEL ] ) ;
2015-12-02 00:31:28 +01:00
PieceMenu - > addAction ( mActions [ LC_PIECE_INLINE_SELECTED_MODELS ] ) ;
2015-12-04 23:41:08 +01:00
PieceMenu - > addAction ( mActions [ LC_PIECE_MOVE_SELECTION_TO_MODEL ] ) ;
2015-12-02 00:31:28 +01:00
PieceMenu - > addSeparator ( ) ;
2015-01-26 00:04:39 +01:00
PieceMenu - > addAction ( mActions [ LC_PIECE_GROUP ] ) ;
PieceMenu - > addAction ( mActions [ LC_PIECE_UNGROUP ] ) ;
PieceMenu - > addAction ( mActions [ LC_PIECE_GROUP_REMOVE ] ) ;
PieceMenu - > addAction ( mActions [ LC_PIECE_GROUP_ADD ] ) ;
PieceMenu - > addAction ( mActions [ LC_PIECE_GROUP_EDIT ] ) ;
// LC_PIECE_SHOW_EARLIER,
// LC_PIECE_SHOW_LATER,
PieceMenu - > addSeparator ( ) ;
PieceMenu - > addAction ( mActions [ LC_PIECE_HIDE_SELECTED ] ) ;
PieceMenu - > addAction ( mActions [ LC_PIECE_HIDE_UNSELECTED ] ) ;
PieceMenu - > addAction ( mActions [ LC_PIECE_UNHIDE_ALL ] ) ;
QMenu * ModelMenu = menuBar ( ) - > addMenu ( tr ( " &Model " ) ) ;
ModelMenu - > addAction ( mActions [ LC_MODEL_PROPERTIES ] ) ;
ModelMenu - > addAction ( mActions [ LC_MODEL_NEW ] ) ;
ModelMenu - > addSeparator ( ) ;
2016-02-25 02:44:12 +01:00
for ( int ModelIdx = LC_MODEL_FIRST ; ModelIdx < = LC_MODEL_LAST ; ModelIdx + + )
ModelMenu - > addAction ( mActions [ ModelIdx ] ) ;
2015-01-26 00:04:39 +01:00
ModelMenu - > addAction ( mActions [ LC_MODEL_LIST ] ) ;
QMenu * HelpMenu = menuBar ( ) - > addMenu ( tr ( " &Help " ) ) ;
HelpMenu - > addAction ( mActions [ LC_HELP_HOMEPAGE ] ) ;
HelpMenu - > addAction ( mActions [ LC_HELP_EMAIL ] ) ;
# if !LC_DISABLE_UPDATE_CHECK
HelpMenu - > addAction ( mActions [ LC_HELP_UPDATES ] ) ;
# endif
HelpMenu - > addSeparator ( ) ;
HelpMenu - > addAction ( mActions [ LC_HELP_ABOUT ] ) ;
}
void lcMainWindow : : CreateToolBars ( )
{
QMenu * LockMenu = new QMenu ( tr ( " Lock Menu " ) , this ) ;
LockMenu - > addAction ( mActions [ LC_EDIT_LOCK_X ] ) ;
LockMenu - > addAction ( mActions [ LC_EDIT_LOCK_Y ] ) ;
LockMenu - > addAction ( mActions [ LC_EDIT_LOCK_Z ] ) ;
LockMenu - > addAction ( mActions [ LC_EDIT_LOCK_NONE ] ) ;
QAction * LockAction = new QAction ( tr ( " Lock Menu " ) , this ) ;
LockAction - > setStatusTip ( tr ( " Toggle mouse movement on specific axes " ) ) ;
LockAction - > setIcon ( QIcon ( " :/resources/edit_lock.png " ) ) ;
LockAction - > setMenu ( LockMenu ) ;
QMenu * SnapXYMenu = new QMenu ( tr ( " Snap XY " ) , this ) ;
for ( int actionIdx = LC_EDIT_SNAP_MOVE_XY0 ; actionIdx < = LC_EDIT_SNAP_MOVE_XY9 ; actionIdx + + )
SnapXYMenu - > addAction ( mActions [ actionIdx ] ) ;
QMenu * SnapZMenu = new QMenu ( tr ( " Snap Z " ) , this ) ;
for ( int actionIdx = LC_EDIT_SNAP_MOVE_Z0 ; actionIdx < = LC_EDIT_SNAP_MOVE_Z9 ; actionIdx + + )
SnapZMenu - > addAction ( mActions [ actionIdx ] ) ;
QMenu * SnapMenu = new QMenu ( tr ( " Snap Menu " ) , this ) ;
2015-04-25 00:11:50 +02:00
SnapMenu - > addAction ( mActions [ LC_EDIT_SNAP_MOVE_TOGGLE ] ) ;
SnapMenu - > addSeparator ( ) ;
2015-01-26 00:04:39 +01:00
SnapMenu - > addMenu ( SnapXYMenu ) ;
SnapMenu - > addMenu ( SnapZMenu ) ;
2015-04-25 00:11:50 +02:00
QAction * MoveAction = new QAction ( tr ( " Movement Snap " ) , this ) ;
2015-01-26 00:04:39 +01:00
MoveAction - > setStatusTip ( tr ( " Snap translations to fixed intervals " ) ) ;
MoveAction - > setIcon ( QIcon ( " :/resources/edit_snap_move.png " ) ) ;
MoveAction - > setMenu ( SnapMenu ) ;
QMenu * SnapAngleMenu = new QMenu ( tr ( " Snap Angle Menu " ) , this ) ;
2015-04-25 00:11:50 +02:00
SnapAngleMenu - > addAction ( mActions [ LC_EDIT_SNAP_ANGLE_TOGGLE ] ) ;
SnapAngleMenu - > addSeparator ( ) ;
2015-01-26 00:04:39 +01:00
for ( int actionIdx = LC_EDIT_SNAP_ANGLE0 ; actionIdx < = LC_EDIT_SNAP_ANGLE9 ; actionIdx + + )
SnapAngleMenu - > addAction ( mActions [ actionIdx ] ) ;
2015-04-25 00:11:50 +02:00
QAction * AngleAction = new QAction ( tr ( " Rotation Snap " ) , this ) ;
2015-01-26 00:04:39 +01:00
AngleAction - > setStatusTip ( tr ( " Snap rotations to fixed intervals " ) ) ;
AngleAction - > setIcon ( QIcon ( " :/resources/edit_snap_angle.png " ) ) ;
AngleAction - > setMenu ( SnapAngleMenu ) ;
mStandardToolBar = addToolBar ( tr ( " Standard " ) ) ;
mStandardToolBar - > setObjectName ( " StandardToolbar " ) ;
mStandardToolBar - > addAction ( mActions [ LC_FILE_NEW ] ) ;
mStandardToolBar - > addAction ( mActions [ LC_FILE_OPEN ] ) ;
mStandardToolBar - > addAction ( mActions [ LC_FILE_SAVE ] ) ;
mStandardToolBar - > addAction ( mActions [ LC_FILE_PRINT ] ) ;
mStandardToolBar - > addAction ( mActions [ LC_FILE_PRINT_PREVIEW ] ) ;
mStandardToolBar - > addSeparator ( ) ;
mStandardToolBar - > addAction ( mActions [ LC_EDIT_UNDO ] ) ;
mStandardToolBar - > addAction ( mActions [ LC_EDIT_REDO ] ) ;
mStandardToolBar - > addAction ( mActions [ LC_EDIT_CUT ] ) ;
mStandardToolBar - > addAction ( mActions [ LC_EDIT_COPY ] ) ;
mStandardToolBar - > addAction ( mActions [ LC_EDIT_PASTE ] ) ;
mStandardToolBar - > addSeparator ( ) ;
mStandardToolBar - > addAction ( mActions [ LC_EDIT_TRANSFORM_RELATIVE ] ) ;
mStandardToolBar - > addAction ( LockAction ) ;
mStandardToolBar - > addAction ( MoveAction ) ;
mStandardToolBar - > addAction ( AngleAction ) ;
mStandardToolBar - > addSeparator ( ) ;
mStandardToolBar - > addAction ( mActions [ LC_EDIT_TRANSFORM ] ) ;
( ( QToolButton * ) mStandardToolBar - > widgetForAction ( LockAction ) ) - > setPopupMode ( QToolButton : : InstantPopup ) ;
( ( QToolButton * ) mStandardToolBar - > widgetForAction ( MoveAction ) ) - > setPopupMode ( QToolButton : : InstantPopup ) ;
( ( QToolButton * ) mStandardToolBar - > widgetForAction ( AngleAction ) ) - > setPopupMode ( QToolButton : : InstantPopup ) ;
( ( QToolButton * ) mStandardToolBar - > widgetForAction ( mActions [ LC_EDIT_TRANSFORM ] ) ) - > setPopupMode ( QToolButton : : InstantPopup ) ;
QHBoxLayout * TransformLayout = new QHBoxLayout ;
QWidget * TransformWidget = new QWidget ( ) ;
TransformWidget - > setLayout ( TransformLayout ) ;
2015-10-03 20:57:59 +02:00
TransformLayout - > setContentsMargins ( 5 , 0 , 5 , 0 ) ;
2015-01-26 00:04:39 +01:00
mTransformXEdit = new QLineEdit ( ) ;
mTransformXEdit - > setMaximumWidth ( 75 ) ;
TransformLayout - > addWidget ( mTransformXEdit ) ;
mTransformYEdit = new QLineEdit ( ) ;
mTransformYEdit - > setMaximumWidth ( 75 ) ;
TransformLayout - > addWidget ( mTransformYEdit ) ;
mTransformZEdit = new QLineEdit ( ) ;
mTransformZEdit - > setMaximumWidth ( 75 ) ;
TransformLayout - > addWidget ( mTransformZEdit ) ;
TransformLayout - > addItem ( new QSpacerItem ( 0 , 0 , QSizePolicy : : Expanding , QSizePolicy : : Minimum ) ) ;
mStandardToolBar - > addWidget ( TransformWidget ) ;
connect ( mTransformXEdit , SIGNAL ( returnPressed ( ) ) , mActions [ LC_EDIT_TRANSFORM ] , SIGNAL ( triggered ( ) ) ) ;
connect ( mTransformYEdit , SIGNAL ( returnPressed ( ) ) , mActions [ LC_EDIT_TRANSFORM ] , SIGNAL ( triggered ( ) ) ) ;
connect ( mTransformZEdit , SIGNAL ( returnPressed ( ) ) , mActions [ LC_EDIT_TRANSFORM ] , SIGNAL ( triggered ( ) ) ) ;
mToolsToolBar = addToolBar ( tr ( " Tools " ) ) ;
mToolsToolBar - > setObjectName ( " ToolsToolbar " ) ;
insertToolBarBreak ( mToolsToolBar ) ;
mToolsToolBar - > addAction ( mActions [ LC_EDIT_ACTION_INSERT ] ) ;
mToolsToolBar - > addAction ( mActions [ LC_EDIT_ACTION_LIGHT ] ) ;
mToolsToolBar - > addAction ( mActions [ LC_EDIT_ACTION_SPOTLIGHT ] ) ;
mToolsToolBar - > addAction ( mActions [ LC_EDIT_ACTION_CAMERA ] ) ;
mToolsToolBar - > addSeparator ( ) ;
mToolsToolBar - > addAction ( mActions [ LC_EDIT_ACTION_SELECT ] ) ;
mToolsToolBar - > addAction ( mActions [ LC_EDIT_ACTION_MOVE ] ) ;
mToolsToolBar - > addAction ( mActions [ LC_EDIT_ACTION_ROTATE ] ) ;
mToolsToolBar - > addAction ( mActions [ LC_EDIT_ACTION_DELETE ] ) ;
mToolsToolBar - > addAction ( mActions [ LC_EDIT_ACTION_PAINT ] ) ;
mToolsToolBar - > addSeparator ( ) ;
mToolsToolBar - > addAction ( mActions [ LC_EDIT_ACTION_ZOOM ] ) ;
mToolsToolBar - > addAction ( mActions [ LC_EDIT_ACTION_PAN ] ) ;
mToolsToolBar - > addAction ( mActions [ LC_EDIT_ACTION_ROTATE_VIEW ] ) ;
mToolsToolBar - > addAction ( mActions [ LC_EDIT_ACTION_ROLL ] ) ;
mToolsToolBar - > addAction ( mActions [ LC_EDIT_ACTION_ZOOM_REGION ] ) ;
mTimeToolBar = addToolBar ( tr ( " Time " ) ) ;
mTimeToolBar - > setObjectName ( " TimeToolbar " ) ;
mTimeToolBar - > addAction ( mActions [ LC_VIEW_TIME_FIRST ] ) ;
mTimeToolBar - > addAction ( mActions [ LC_VIEW_TIME_PREVIOUS ] ) ;
mTimeToolBar - > addAction ( mActions [ LC_VIEW_TIME_NEXT ] ) ;
mTimeToolBar - > addAction ( mActions [ LC_VIEW_TIME_LAST ] ) ;
mTimeToolBar - > addAction ( mActions [ LC_PIECE_SHOW_EARLIER ] ) ;
mTimeToolBar - > addAction ( mActions [ LC_PIECE_SHOW_LATER ] ) ;
mTimeToolBar - > addAction ( mActions [ LC_VIEW_TIME_ADD_KEYS ] ) ;
// TODO: add missing menu items
mPartsToolBar = new QDockWidget ( tr ( " Parts " ) , this ) ;
mPartsToolBar - > setObjectName ( " PartsToolbar " ) ;
2017-02-06 18:06:52 +01:00
mPartSelectionWidget = new lcPartSelectionWidget ( mPartsToolBar ) ;
2016-12-20 23:11:19 +01:00
mPartsToolBar - > setWidget ( mPartSelectionWidget ) ;
addDockWidget ( Qt : : RightDockWidgetArea , mPartsToolBar ) ;
mColorsToolBar = new QDockWidget ( tr ( " Colors " ) , this ) ;
mColorsToolBar - > setObjectName ( " ColorsToolbar " ) ;
2017-03-19 02:31:04 +01:00
mColorsToolBar - > setSizePolicy ( QSizePolicy : : Maximum , QSizePolicy : : Maximum ) ;
2015-01-26 00:04:39 +01:00
2016-12-29 16:37:24 +01:00
QFrame * ColorFrame = new QFrame ( mColorsToolBar ) ;
ColorFrame - > setFrameShape ( QFrame : : StyledPanel ) ;
ColorFrame - > setFrameShadow ( QFrame : : Sunken ) ;
QGridLayout * ColorLayout = new QGridLayout ( ColorFrame ) ;
ColorLayout - > setContentsMargins ( 0 , 0 , 0 , 0 ) ;
mColorList = new lcQColorList ( ColorFrame ) ;
ColorLayout - > addWidget ( mColorList ) ;
2015-01-26 00:04:39 +01:00
connect ( mColorList , SIGNAL ( colorChanged ( int ) ) , this , SLOT ( ColorChanged ( int ) ) ) ;
2016-12-29 16:37:24 +01:00
mColorsToolBar - > setWidget ( ColorFrame ) ;
2016-12-20 23:11:19 +01:00
addDockWidget ( Qt : : RightDockWidgetArea , mColorsToolBar ) ;
2015-01-26 00:04:39 +01:00
mPropertiesToolBar = new QDockWidget ( tr ( " Properties " ) , this ) ;
mPropertiesToolBar - > setObjectName ( " PropertiesToolbar " ) ;
mPropertiesWidget = new lcQPropertiesTree ( mPropertiesToolBar ) ;
mPropertiesToolBar - > setWidget ( mPropertiesWidget ) ;
addDockWidget ( Qt : : RightDockWidgetArea , mPropertiesToolBar ) ;
2015-03-04 21:37:09 +01:00
mTimelineToolBar = new QDockWidget ( tr ( " Timeline " ) , this ) ;
mTimelineToolBar - > setObjectName ( " TimelineToolbar " ) ;
2015-03-08 01:27:11 +01:00
mTimelineToolBar - > setAcceptDrops ( true ) ;
2015-03-04 21:37:09 +01:00
mTimelineWidget = new lcTimelineWidget ( mTimelineToolBar ) ;
mTimelineToolBar - > setWidget ( mTimelineWidget ) ;
addDockWidget ( Qt : : RightDockWidgetArea , mTimelineToolBar ) ;
2017-02-06 18:06:52 +01:00
tabifyDockWidget ( mPartsToolBar , mPropertiesToolBar ) ;
2015-03-04 21:37:09 +01:00
tabifyDockWidget ( mPropertiesToolBar , mTimelineToolBar ) ;
2017-02-06 18:06:52 +01:00
mPartsToolBar - > raise ( ) ;
2015-01-26 00:04:39 +01:00
}
void lcMainWindow : : CreateStatusBar ( )
{
QStatusBar * StatusBar = new QStatusBar ( this ) ;
setStatusBar ( StatusBar ) ;
mStatusBarLabel = new QLabel ( ) ;
StatusBar - > addWidget ( mStatusBarLabel ) ;
mStatusPositionLabel = new QLabel ( ) ;
StatusBar - > addPermanentWidget ( mStatusPositionLabel ) ;
mStatusSnapLabel = new QLabel ( ) ;
StatusBar - > addPermanentWidget ( mStatusSnapLabel ) ;
mStatusTimeLabel = new QLabel ( ) ;
StatusBar - > addPermanentWidget ( mStatusTimeLabel ) ;
}
2017-02-06 18:06:52 +01:00
void lcMainWindow : : closeEvent ( QCloseEvent * Event )
2015-01-26 00:04:39 +01:00
{
if ( SaveProjectIfModified ( ) )
{
2017-02-06 18:06:52 +01:00
Event - > accept ( ) ;
QSettings Settings ;
Settings . beginGroup ( " MainWindow " ) ;
Settings . setValue ( " Geometry " , saveGeometry ( ) ) ;
Settings . setValue ( " State " , saveState ( ) ) ;
mPartSelectionWidget - > SaveState ( Settings ) ;
Settings . endGroup ( ) ;
2015-01-26 00:04:39 +01:00
}
else
2017-02-06 18:06:52 +01:00
Event - > ignore ( ) ;
2015-01-26 00:04:39 +01:00
}
2016-10-15 21:13:31 +02:00
void lcMainWindow : : dragEnterEvent ( QDragEnterEvent * Event )
{
if ( Event - > mimeData ( ) - > hasUrls ( ) )
Event - > acceptProposedAction ( ) ;
}
void lcMainWindow : : dropEvent ( QDropEvent * Event )
{
const QMimeData * MimeData = Event - > mimeData ( ) ;
foreach ( const QUrl & Url , MimeData - > urls ( ) )
if ( OpenProject ( Url . toLocalFile ( ) ) )
break ;
}
2015-01-26 00:04:39 +01:00
QMenu * lcMainWindow : : createPopupMenu ( )
{
QMenu * Menu = new QMenu ( this ) ;
Menu - > addAction ( mPartsToolBar - > toggleViewAction ( ) ) ;
2016-12-20 23:11:19 +01:00
Menu - > addAction ( mColorsToolBar - > toggleViewAction ( ) ) ;
2015-01-26 00:04:39 +01:00
Menu - > addAction ( mPropertiesToolBar - > toggleViewAction ( ) ) ;
2015-03-04 21:37:09 +01:00
Menu - > addAction ( mTimelineToolBar - > toggleViewAction ( ) ) ;
2015-01-26 00:04:39 +01:00
Menu - > addSeparator ( ) ;
Menu - > addAction ( mStandardToolBar - > toggleViewAction ( ) ) ;
Menu - > addAction ( mToolsToolBar - > toggleViewAction ( ) ) ;
Menu - > addAction ( mTimeToolBar - > toggleViewAction ( ) ) ;
return Menu ;
}
2016-03-06 02:47:00 +01:00
void lcMainWindow : : ModelTabClosed ( int Index )
{
2016-12-28 22:30:31 +01:00
if ( mModelTabWidget - > count ( ) ! = 1 )
delete mModelTabWidget - > widget ( Index ) ;
2016-03-06 02:47:00 +01:00
}
void lcMainWindow : : ModelTabChanged ( int Index )
{
Project * Project = lcGetActiveProject ( ) ;
lcModelTabWidget * CurrentTab = ( lcModelTabWidget * ) mModelTabWidget - > widget ( Index ) ;
2017-04-14 02:26:40 +02:00
Project - > SetActiveModel ( Project - > GetModels ( ) . FindIndex ( CurrentTab ? CurrentTab - > GetModel ( ) : nullptr ) ) ;
2016-03-06 02:47:00 +01:00
}
2015-01-26 00:04:39 +01:00
void lcMainWindow : : ClipboardChanged ( )
{
const QString MimeType = QLatin1String ( " application/vnd.leocad-clipboard " ) ;
const QMimeData * MimeData = QApplication : : clipboard ( ) - > mimeData ( ) ;
QByteArray ClipboardData ;
if ( MimeData - > hasFormat ( MimeType ) )
ClipboardData = MimeData - > data ( MimeType ) ;
g_App - > SetClipboard ( ClipboardData ) ;
}
void lcMainWindow : : ActionTriggered ( )
{
QObject * Action = sender ( ) ;
for ( int CommandIdx = 0 ; CommandIdx < LC_NUM_COMMANDS ; CommandIdx + + )
{
if ( Action = = mActions [ CommandIdx ] )
{
HandleCommand ( ( lcCommandId ) CommandIdx ) ;
break ;
}
}
}
void lcMainWindow : : ColorChanged ( int ColorIndex )
{
SetColorIndex ( ColorIndex ) ;
}
void lcMainWindow : : Print ( QPrinter * Printer )
{
2017-02-11 21:41:00 +01:00
# ifndef QT_NO_PRINTER
2015-01-26 00:04:39 +01:00
lcModel * Model = lcGetActiveModel ( ) ;
int DocCopies ;
int PageCopies ;
int Rows = lcGetProfileInt ( LC_PROFILE_PRINT_ROWS ) ;
int Columns = lcGetProfileInt ( LC_PROFILE_PRINT_COLUMNS ) ;
int StepsPerPage = Rows * Columns ;
int PageCount = ( Model - > GetLastStep ( ) + StepsPerPage - 1 ) / StepsPerPage ;
if ( Printer - > collateCopies ( ) )
{
DocCopies = 1 ;
2016-09-22 17:04:51 +02:00
# if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
2015-01-26 00:04:39 +01:00
PageCopies = Printer - > supportsMultipleCopies ( ) ? 1 : Printer - > copyCount ( ) ;
2016-09-22 17:04:51 +02:00
# endif
2015-01-26 00:04:39 +01:00
}
else
{
2016-09-22 17:04:51 +02:00
# if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
2015-01-26 00:04:39 +01:00
DocCopies = Printer - > supportsMultipleCopies ( ) ? 1 : Printer - > copyCount ( ) ;
2016-09-22 17:04:51 +02:00
# endif
2015-01-26 00:04:39 +01:00
PageCopies = 1 ;
}
int FromPage = Printer - > fromPage ( ) ;
int ToPage = Printer - > toPage ( ) ;
bool Ascending = true ;
if ( FromPage = = 0 & & ToPage = = 0 )
{
FromPage = 1 ;
ToPage = PageCount ;
}
FromPage = qMax ( 1 , FromPage ) ;
ToPage = qMin ( PageCount , ToPage ) ;
if ( ToPage < FromPage )
return ;
if ( Printer - > pageOrder ( ) = = QPrinter : : LastPageFirst )
{
int Tmp = FromPage ;
FromPage = ToPage ;
ToPage = Tmp ;
Ascending = false ;
}
2016-12-28 22:30:31 +01:00
GetActiveView ( ) - > MakeCurrent ( ) ;
lcContext * Context = GetActiveView ( ) - > mContext ;
2015-01-26 00:04:39 +01:00
QRect PageRect = Printer - > pageRect ( ) ;
int StepWidth = PageRect . width ( ) / Columns ;
int StepHeight = PageRect . height ( ) / Rows ;
GLint MaxTexture ;
glGetIntegerv ( GL_MAX_TEXTURE_SIZE , & MaxTexture ) ;
MaxTexture = qMin ( MaxTexture , 2048 ) ;
int TileWidth = qMin ( StepWidth , MaxTexture ) ;
int TileHeight = qMin ( StepHeight , MaxTexture ) ;
float AspectRatio = ( float ) StepWidth / ( float ) StepHeight ;
View View ( Model ) ;
View . SetCamera ( GetActiveView ( ) - > mCamera , false ) ;
View . mWidth = TileWidth ;
View . mHeight = TileHeight ;
View . SetContext ( Context ) ;
Context - > BeginRenderToTexture ( TileWidth , TileHeight ) ;
lcStep PreviousTime = Model - > GetCurrentStep ( ) ;
QPainter Painter ( Printer ) ;
lcuint8 * Buffer = ( lcuint8 * ) malloc ( TileWidth * TileHeight * 4 ) ;
// TODO: option to print background
for ( int DocCopy = 0 ; DocCopy < DocCopies ; DocCopy + + )
{
int Page = FromPage ;
for ( ; ; )
{
for ( int PageCopy = 0 ; PageCopy < PageCopies ; PageCopy + + )
{
if ( Printer - > printerState ( ) = = QPrinter : : Aborted | | Printer - > printerState ( ) = = QPrinter : : Error )
{
free ( Buffer ) ;
2015-03-15 20:42:11 +01:00
Model - > SetTemporaryStep ( PreviousTime ) ;
2015-01-26 00:04:39 +01:00
Context - > EndRenderToTexture ( ) ;
2017-03-25 20:29:28 +01:00
Context - > ClearResources ( ) ;
2015-01-26 00:04:39 +01:00
return ;
}
lcStep CurrentStep = 1 + ( ( Page - 1 ) * Rows * Columns ) ;
for ( int Row = 0 ; Row < Rows ; Row + + )
{
for ( int Column = 0 ; Column < Columns ; Column + + )
{
if ( CurrentStep > Model - > GetLastStep ( ) )
break ;
2015-03-15 20:42:11 +01:00
Model - > SetTemporaryStep ( CurrentStep ) ;
2015-01-26 00:04:39 +01:00
if ( StepWidth > TileWidth | | StepHeight > TileHeight )
{
lcuint8 * ImageBuffer = ( lcuint8 * ) malloc ( StepWidth * StepHeight * 4 ) ;
lcCamera * Camera = View . mCamera ;
Camera - > StartTiledRendering ( TileWidth , TileHeight , StepWidth , StepHeight , AspectRatio ) ;
do
{
View . OnDraw ( ) ;
int TileRow , TileColumn , CurrentTileWidth , CurrentTileHeight ;
Camera - > GetTileInfo ( & TileRow , & TileColumn , & CurrentTileWidth , & CurrentTileHeight ) ;
glFinish ( ) ;
glReadPixels ( 0 , 0 , CurrentTileWidth , CurrentTileHeight , GL_RGBA , GL_UNSIGNED_BYTE , Buffer ) ;
lcuint32 TileY = 0 ;
if ( TileRow ! = 0 )
TileY = TileRow * TileHeight - ( TileHeight - StepHeight % TileHeight ) ;
lcuint32 tileStart = ( ( TileColumn * TileWidth ) + ( TileY * StepWidth ) ) * 4 ;
for ( int y = 0 ; y < CurrentTileHeight ; y + + )
{
lcuint8 * src = Buffer + ( CurrentTileHeight - y - 1 ) * CurrentTileWidth * 4 ;
lcuint8 * dst = ImageBuffer + tileStart + y * StepWidth * 4 ;
for ( int x = 0 ; x < CurrentTileWidth ; x + + )
{
* dst + + = src [ 2 ] ;
* dst + + = src [ 1 ] ;
* dst + + = src [ 0 ] ;
* dst + + = 255 ;
src + = 4 ;
}
}
} while ( Camera - > EndTile ( ) ) ;
QImage Image = QImage ( ( const lcuint8 * ) ImageBuffer , StepWidth , StepHeight , QImage : : Format_ARGB32_Premultiplied ) ;
QRect Rect = Painter . viewport ( ) ;
int Left = Rect . x ( ) + ( StepWidth * Column ) ;
int Bottom = Rect . y ( ) + ( StepHeight * Row ) ;
Painter . drawImage ( Left , Bottom , Image ) ;
free ( ImageBuffer ) ;
}
else
{
View . OnDraw ( ) ;
glFinish ( ) ;
glReadPixels ( 0 , 0 , TileWidth , TileHeight , GL_RGBA , GL_UNSIGNED_BYTE , Buffer ) ;
for ( int y = 0 ; y < ( TileHeight + 1 ) / 2 ; y + + )
{
lcuint8 * Top = ( lcuint8 * ) Buffer + ( ( TileHeight - y - 1 ) * TileWidth * 4 ) ;
lcuint8 * Bottom = ( lcuint8 * ) Buffer + y * TileWidth * 4 ;
for ( int x = 0 ; x < TileWidth ; x + + )
{
lcuint8 Red = Top [ 0 ] ;
lcuint8 Green = Top [ 1 ] ;
lcuint8 Blue = Top [ 2 ] ;
lcuint8 Alpha = 255 ; //top[3];
Top [ 0 ] = Bottom [ 2 ] ;
Top [ 1 ] = Bottom [ 1 ] ;
Top [ 2 ] = Bottom [ 0 ] ;
Top [ 3 ] = 255 ; //Bottom[3];
Bottom [ 0 ] = Blue ;
Bottom [ 1 ] = Green ;
Bottom [ 2 ] = Red ;
Bottom [ 3 ] = Alpha ;
Top + = 4 ;
Bottom + = 4 ;
}
}
QImage image = QImage ( ( const lcuint8 * ) Buffer , TileWidth , TileHeight , QImage : : Format_ARGB32 ) ;
QRect rect = Painter . viewport ( ) ;
int left = rect . x ( ) + ( StepWidth * Column ) ;
int bottom = rect . y ( ) + ( StepHeight * Row ) ;
Painter . drawImage ( left , bottom , image ) ;
}
// TODO: add print options somewhere but Qt doesn't allow changes to the page setup dialog
// DWORD dwPrint = theApp.GetProfileInt("Settings","Print", PRINT_NUMBERS|PRINT_BORDER);
QRect Rect = Painter . viewport ( ) ;
int Left = Rect . x ( ) + ( StepWidth * Column ) ;
int Right = Rect . x ( ) + ( StepWidth * ( Column + 1 ) ) ;
int Top = Rect . y ( ) + ( StepHeight * Row ) ;
int Bottom = Rect . y ( ) + ( StepHeight * ( Row + 1 ) ) ;
// if (print text)
{
QFont Font ( " Helvetica " , Printer - > resolution ( ) ) ;
Painter . setFont ( Font ) ;
QFontMetrics FontMetrics ( Font ) ;
int TextTop = Top + Printer - > resolution ( ) / 2 + FontMetrics . ascent ( ) ;
int TextLeft = Left + Printer - > resolution ( ) / 2 ;
Painter . drawText ( TextLeft , TextTop , QString : : number ( CurrentStep ) ) ;
}
// if (print border)
{
QPen BlackPen ( Qt : : black , 2 ) ;
Painter . setPen ( BlackPen ) ;
if ( Row = = 0 )
Painter . drawLine ( Left , Top , Right , Top ) ;
if ( Column = = 0 )
Painter . drawLine ( Left , Top , Left , Bottom ) ;
Painter . drawLine ( Left , Bottom , Right , Bottom ) ;
Painter . drawLine ( Right , Top , Right , Bottom ) ;
}
CurrentStep + + ;
}
}
// TODO: print header and footer
if ( PageCopy < PageCopies - 1 )
Printer - > newPage ( ) ;
}
if ( Page = = ToPage )
break ;
if ( Ascending )
Page + + ;
else
Page - - ;
Printer - > newPage ( ) ;
}
if ( DocCopy < DocCopies - 1 )
Printer - > newPage ( ) ;
}
free ( Buffer ) ;
2015-03-15 20:42:11 +01:00
Model - > SetTemporaryStep ( PreviousTime ) ;
2015-01-26 00:04:39 +01:00
Context - > EndRenderToTexture ( ) ;
2017-03-25 20:29:28 +01:00
Context - > ClearResources ( ) ;
2017-02-11 21:41:00 +01:00
# endif
2015-01-26 00:04:39 +01:00
}
2016-08-01 05:44:15 +02:00
void lcMainWindow : : ShowUpdatesDialog ( )
{
lcQUpdateDialog Dialog ( this , false ) ;
Dialog . exec ( ) ;
}
void lcMainWindow : : ShowAboutDialog ( )
{
lcQAboutDialog Dialog ( this ) ;
Dialog . exec ( ) ;
}
2015-01-26 00:04:39 +01:00
void lcMainWindow : : ShowPrintDialog ( )
{
2017-02-11 21:41:00 +01:00
# ifndef QT_NO_PRINTER
2015-01-26 00:04:39 +01:00
lcModel * Model = lcGetActiveModel ( ) ;
int Rows = lcGetProfileInt ( LC_PROFILE_PRINT_ROWS ) ;
int Columns = lcGetProfileInt ( LC_PROFILE_PRINT_COLUMNS ) ;
int StepsPerPage = Rows * Columns ;
int PageCount = ( Model - > GetLastStep ( ) + StepsPerPage - 1 ) / StepsPerPage ;
QPrinter Printer ( QPrinter : : HighResolution ) ;
Printer . setFromTo ( 1 , PageCount + 1 ) ;
QPrintDialog PrintDialog ( & Printer , this ) ;
if ( PrintDialog . exec ( ) = = QDialog : : Accepted )
Print ( & Printer ) ;
2017-02-11 21:41:00 +01:00
# endif
2015-01-26 00:04:39 +01:00
}
// todo: call dialogs directly
# include "lc_qhtmldialog.h"
# include "lc_qpropertiesdialog.h"
# include "lc_qfinddialog.h"
# include "lc_qpreferencesdialog.h"
2015-01-25 02:34:13 +01:00
bool lcMainWindow : : DoDialog ( LC_DIALOG_TYPE Type , void * Data )
{
switch ( Type )
{
case LC_DIALOG_EXPORT_HTML :
{
2015-01-26 00:04:39 +01:00
lcQHTMLDialog Dialog ( this , Data ) ;
2015-01-25 02:34:13 +01:00
return Dialog . exec ( ) = = QDialog : : Accepted ;
} break ;
case LC_DIALOG_PROPERTIES :
{
2015-01-26 00:04:39 +01:00
lcQPropertiesDialog Dialog ( this , Data ) ;
2015-01-25 02:34:13 +01:00
return Dialog . exec ( ) = = QDialog : : Accepted ;
} break ;
case LC_DIALOG_FIND :
{
2015-01-26 00:04:39 +01:00
lcQFindDialog Dialog ( this , Data ) ;
2015-01-25 02:34:13 +01:00
return Dialog . exec ( ) = = QDialog : : Accepted ;
} break ;
case LC_DIALOG_PREFERENCES :
{
2015-01-26 00:04:39 +01:00
lcQPreferencesDialog Dialog ( this , Data ) ;
2015-01-25 02:34:13 +01:00
return Dialog . exec ( ) = = QDialog : : Accepted ;
} break ;
}
return false ;
}
2016-03-06 02:47:00 +01:00
void lcMainWindow : : RemoveAllModelTabs ( )
{
2017-03-27 03:14:08 +02:00
while ( mModelTabWidget - > count ( ) > 1 )
2016-03-06 02:47:00 +01:00
{
QWidget * TabWidget = mModelTabWidget - > widget ( 0 ) ;
delete TabWidget ;
}
2017-03-27 03:14:08 +02:00
if ( mModelTabWidget - > count ( ) )
{
lcModelTabWidget * TabWidget = ( lcModelTabWidget * ) mModelTabWidget - > widget ( 0 ) ;
TabWidget - > Clear ( ) ;
}
2016-03-06 02:47:00 +01:00
}
void lcMainWindow : : SetCurrentModelTab ( lcModel * Model )
{
2017-04-14 02:26:40 +02:00
lcModelTabWidget * EmptyWidget = nullptr ;
2017-03-27 03:14:08 +02:00
2016-03-06 02:47:00 +01:00
for ( int TabIdx = 0 ; TabIdx < mModelTabWidget - > count ( ) ; TabIdx + + )
{
lcModelTabWidget * TabWidget = ( lcModelTabWidget * ) mModelTabWidget - > widget ( TabIdx ) ;
if ( TabWidget - > GetModel ( ) = = Model )
{
mModelTabWidget - > setCurrentIndex ( TabIdx ) ;
return ;
}
2017-03-27 03:14:08 +02:00
if ( ! TabWidget - > GetModel ( ) )
EmptyWidget = TabWidget ;
2016-03-06 02:47:00 +01:00
}
2017-03-27 03:14:08 +02:00
lcModelTabWidget * TabWidget ;
lcQGLWidget * ViewWidget ;
View * NewView ;
2016-03-06 02:47:00 +01:00
2017-03-27 03:14:08 +02:00
if ( ! EmptyWidget )
{
TabWidget = new lcModelTabWidget ( Model ) ;
mModelTabWidget - > addTab ( TabWidget , Model - > GetProperties ( ) . mName ) ;
mModelTabWidget - > setCurrentWidget ( TabWidget ) ;
QGridLayout * CentralLayout = new QGridLayout ( TabWidget ) ;
CentralLayout - > setContentsMargins ( 0 , 0 , 0 , 0 ) ;
NewView = new View ( Model ) ;
ViewWidget = new lcQGLWidget ( TabWidget , NewView , true ) ;
CentralLayout - > addWidget ( ViewWidget , 0 , 0 , 1 , 1 ) ;
}
else
{
TabWidget = EmptyWidget ;
TabWidget - > SetModel ( Model ) ;
mModelTabWidget - > setCurrentWidget ( TabWidget ) ;
NewView = new View ( Model ) ;
ViewWidget = ( lcQGLWidget * ) TabWidget - > layout ( ) - > itemAt ( 0 ) - > widget ( ) ;
ViewWidget - > widget = NewView ;
NewView - > mWidget = ViewWidget ;
NewView - > mWidth = ViewWidget - > width ( ) ;
NewView - > mHeight = ViewWidget - > height ( ) ;
AddView ( NewView ) ;
}
2016-03-06 02:47:00 +01:00
2016-03-08 01:30:00 +01:00
ViewWidget - > show ( ) ;
2016-03-06 02:47:00 +01:00
ViewWidget - > setFocus ( ) ;
NewView - > ZoomExtents ( ) ;
SetActiveView ( NewView ) ;
}
2015-01-16 03:07:31 +01:00
void lcMainWindow : : ResetCameras ( )
{
2016-03-06 02:47:00 +01:00
lcModelTabWidget * CurrentTab = ( lcModelTabWidget * ) mModelTabWidget - > currentWidget ( ) ;
if ( ! CurrentTab )
return ;
const lcArray < View * > * Views = CurrentTab - > GetViews ( ) ;
for ( int ViewIdx = 0 ; ViewIdx < Views - > GetSize ( ) ; ViewIdx + + )
( * Views ) [ ViewIdx ] - > SetDefaultCamera ( ) ;
2015-01-16 03:07:31 +01:00
lcGetActiveModel ( ) - > DeleteAllCameras ( ) ;
}
2014-05-03 23:16:48 +02:00
void lcMainWindow : : AddView ( View * View )
{
2016-03-06 02:47:00 +01:00
lcModelTabWidget * TabWidget = GetTabWidgetForModel ( View - > mModel ) ;
if ( ! TabWidget )
return ;
TabWidget - > AddView ( View ) ;
2014-05-03 23:16:48 +02:00
View - > MakeCurrent ( ) ;
2016-03-06 02:47:00 +01:00
if ( ! TabWidget - > GetActiveView ( ) )
2014-05-03 23:16:48 +02:00
{
2016-03-06 02:47:00 +01:00
TabWidget - > SetActiveView ( View ) ;
2014-05-03 23:16:48 +02:00
UpdatePerspective ( ) ;
}
}
void lcMainWindow : : RemoveView ( View * View )
{
2016-03-06 02:47:00 +01:00
lcModelTabWidget * TabWidget = GetTabForView ( View ) ;
2014-05-03 23:16:48 +02:00
2016-03-06 02:47:00 +01:00
if ( TabWidget )
TabWidget - > RemoveView ( View ) ;
2014-05-03 23:16:48 +02:00
}
void lcMainWindow : : SetActiveView ( View * ActiveView )
{
2016-03-06 02:47:00 +01:00
lcModelTabWidget * TabWidget = GetTabForView ( ActiveView ) ;
if ( ! TabWidget | | TabWidget - > GetActiveView ( ) = = ActiveView )
2014-05-03 23:16:48 +02:00
return ;
2016-03-06 02:47:00 +01:00
TabWidget - > SetActiveView ( ActiveView ) ;
2014-05-03 23:16:48 +02:00
UpdateCameraMenu ( ) ;
UpdatePerspective ( ) ;
}
void lcMainWindow : : UpdateAllViews ( )
{
2016-03-06 02:47:00 +01:00
lcModelTabWidget * CurrentTab = ( lcModelTabWidget * ) mModelTabWidget - > currentWidget ( ) ;
if ( CurrentTab )
{
const lcArray < View * > * Views = CurrentTab - > GetViews ( ) ;
for ( int ViewIdx = 0 ; ViewIdx < Views - > GetSize ( ) ; ViewIdx + + )
( * Views ) [ ViewIdx ] - > Redraw ( ) ;
}
2014-05-03 23:16:48 +02:00
}
2014-05-23 02:02:21 +02:00
void lcMainWindow : : SetTool ( lcTool Tool )
{
mTool = Tool ;
2015-01-26 00:04:39 +01:00
QAction * Action = mActions [ LC_EDIT_ACTION_FIRST + mTool ] ;
if ( Action )
Action - > setChecked ( true ) ;
2014-05-23 02:02:21 +02:00
UpdateAllViews ( ) ;
}
2013-08-09 06:57:18 +02:00
void lcMainWindow : : SetColorIndex ( int ColorIndex )
2014-05-03 23:16:48 +02:00
{
2013-08-09 06:57:18 +02:00
mColorIndex = ColorIndex ;
2016-12-28 22:30:31 +01:00
if ( mPartSelectionWidget )
2017-02-04 22:14:41 +01:00
mPartSelectionWidget - > SetColorIndex ( ColorIndex ) ;
2015-01-17 03:02:30 +01:00
UpdateColor ( ) ;
2011-09-07 23:06:51 +02:00
}
2015-04-25 00:11:50 +02:00
void lcMainWindow : : SetMoveSnapEnabled ( bool Enabled )
{
mMoveSnapEnabled = Enabled ;
UpdateSnap ( ) ;
}
void lcMainWindow : : SetAngleSnapEnabled ( bool Enabled )
{
mAngleSnapEnabled = Enabled ;
UpdateSnap ( ) ;
}
2014-10-05 07:21:51 +02:00
void lcMainWindow : : SetMoveXYSnapIndex ( int Index )
{
mMoveXYSnapIndex = Index ;
UpdateSnap ( ) ;
}
void lcMainWindow : : SetMoveZSnapIndex ( int Index )
{
mMoveZSnapIndex = Index ;
UpdateSnap ( ) ;
}
void lcMainWindow : : SetAngleSnapIndex ( int Index )
{
mAngleSnapIndex = Index ;
UpdateSnap ( ) ;
}
void lcMainWindow : : SetLockX ( bool LockX )
{
mLockX = LockX ;
UpdateLockSnap ( ) ;
}
void lcMainWindow : : SetLockY ( bool LockY )
{
mLockY = LockY ;
UpdateLockSnap ( ) ;
}
void lcMainWindow : : SetLockZ ( bool LockZ )
{
mLockZ = LockZ ;
UpdateLockSnap ( ) ;
}
2015-01-18 06:36:14 +01:00
void lcMainWindow : : SetRelativeTransform ( bool RelativeTransform )
{
mRelativeTransform = RelativeTransform ;
UpdateLockSnap ( ) ;
UpdateAllViews ( ) ;
}
2015-01-26 00:04:39 +01:00
void lcMainWindow : : SetTransformType ( lcTransformType TransformType )
{
mTransformType = TransformType ;
const char * IconNames [ ] =
{
" :/resources/edit_transform_absolute_translation.png " ,
" :/resources/edit_transform_relative_translation.png " ,
" :/resources/edit_transform_absolute_rotation.png " ,
" :/resources/edit_transform_relative_rotation.png "
} ;
if ( TransformType > = 0 & & TransformType < = 3 )
{
mActions [ LC_EDIT_TRANSFORM_ABSOLUTE_TRANSLATION + TransformType ] - > setChecked ( true ) ;
mActions [ LC_EDIT_TRANSFORM ] - > setIcon ( QIcon ( IconNames [ TransformType ] ) ) ;
}
}
2016-12-16 18:14:19 +01:00
void lcMainWindow : : SetCurrentPieceInfo ( PieceInfo * Info )
{
2017-01-23 04:28:05 +01:00
lcPiecesLibrary * Library = lcGetPiecesLibrary ( ) ;
2016-12-16 18:14:19 +01:00
if ( mCurrentPieceInfo )
2017-01-23 04:28:05 +01:00
Library - > ReleasePieceInfo ( mCurrentPieceInfo ) ;
2016-12-16 18:14:19 +01:00
mCurrentPieceInfo = Info ;
if ( mCurrentPieceInfo )
2017-01-23 04:28:05 +01:00
Library - > LoadPieceInfo ( mCurrentPieceInfo , true , true ) ;
2016-12-16 18:14:19 +01:00
}
2015-01-26 00:04:39 +01:00
lcVector3 lcMainWindow : : GetTransformAmount ( )
{
lcVector3 Transform ;
2016-06-14 01:57:31 +02:00
Transform . x = lcParseValueLocalized ( mTransformXEdit - > text ( ) ) ;
Transform . y = lcParseValueLocalized ( mTransformYEdit - > text ( ) ) ;
Transform . z = lcParseValueLocalized ( mTransformZEdit - > text ( ) ) ;
2015-01-26 00:04:39 +01:00
return Transform ;
}
void lcMainWindow : : SplitView ( Qt : : Orientation Orientation )
{
QWidget * Focus = focusWidget ( ) ;
2015-02-02 07:00:21 +01:00
if ( Focus - > metaObject ( ) ! = & lcQGLWidget : : staticMetaObject )
2015-01-26 00:04:39 +01:00
return ;
QWidget * Parent = Focus - > parentWidget ( ) ;
QSplitter * Splitter ;
QList < int > Sizes ;
2016-03-07 19:30:25 +01:00
if ( Parent - > metaObject ( ) = = & lcModelTabWidget : : staticMetaObject )
2015-01-26 00:04:39 +01:00
{
Splitter = new QSplitter ( Orientation , Parent ) ;
Parent - > layout ( ) - > addWidget ( Splitter ) ;
Splitter - > addWidget ( Focus ) ;
2016-12-28 22:30:31 +01:00
Splitter - > addWidget ( new lcQGLWidget ( mModelTabWidget - > currentWidget ( ) , new View ( lcGetActiveModel ( ) ) , true ) ) ;
2015-01-26 00:04:39 +01:00
}
else
{
QSplitter * ParentSplitter = ( QSplitter * ) Parent ;
Sizes = ParentSplitter - > sizes ( ) ;
int FocusIndex = ParentSplitter - > indexOf ( Focus ) ;
Splitter = new QSplitter ( Orientation , Parent ) ;
ParentSplitter - > insertWidget ( FocusIndex , Splitter ) ;
Splitter - > addWidget ( Focus ) ;
2016-12-28 22:30:31 +01:00
Splitter - > addWidget ( new lcQGLWidget ( mModelTabWidget - > currentWidget ( ) , new View ( lcGetActiveModel ( ) ) , true ) ) ;
2015-01-26 00:04:39 +01:00
ParentSplitter - > setSizes ( Sizes ) ;
}
Sizes . clear ( ) ;
Sizes . append ( 10 ) ;
Sizes . append ( 10 ) ;
Splitter - > setSizes ( Sizes ) ;
2017-03-26 19:28:58 +02:00
Focus - > setFocus ( ) ;
2015-01-26 00:04:39 +01:00
}
void lcMainWindow : : SplitHorizontal ( )
{
SplitView ( Qt : : Vertical ) ;
}
void lcMainWindow : : SplitVertical ( )
{
SplitView ( Qt : : Horizontal ) ;
}
void lcMainWindow : : RemoveActiveView ( )
{
QWidget * Focus = focusWidget ( ) ;
2015-02-02 07:00:21 +01:00
if ( Focus - > metaObject ( ) ! = & lcQGLWidget : : staticMetaObject )
2015-01-26 00:04:39 +01:00
return ;
QWidget * Parent = Focus - > parentWidget ( ) ;
2016-03-07 19:30:25 +01:00
if ( Parent - > metaObject ( ) = = & lcModelTabWidget : : staticMetaObject )
2015-01-26 00:04:39 +01:00
return ;
QWidget * ParentParentWidget = Parent - > parentWidget ( ) ;
QSplitter * ParentSplitter = ( QSplitter * ) Parent ;
int FocusIndex = ParentSplitter - > indexOf ( Focus ) ;
2017-03-26 19:28:58 +02:00
QWidget * OtherWidget = ParentSplitter - > widget ( ! FocusIndex ) ;
2015-01-26 00:04:39 +01:00
2016-03-07 19:30:25 +01:00
if ( ParentParentWidget - > metaObject ( ) = = & lcModelTabWidget : : staticMetaObject )
2015-01-26 00:04:39 +01:00
{
QLayout * CentralLayout = ParentParentWidget - > layout ( ) ;
2017-03-26 19:28:58 +02:00
CentralLayout - > addWidget ( OtherWidget ) ;
2015-01-26 00:04:39 +01:00
CentralLayout - > removeWidget ( Parent ) ;
2017-03-26 19:28:58 +02:00
}
else
{
QSplitter * ParentParentSplitter = ( QSplitter * ) ParentParentWidget ;
QList < int > Sizes = ParentParentSplitter - > sizes ( ) ;
2015-01-26 00:04:39 +01:00
2017-03-26 19:28:58 +02:00
int ParentIndex = ParentParentSplitter - > indexOf ( Parent ) ;
ParentParentSplitter - > insertWidget ( ParentIndex , OtherWidget ) ;
ParentParentSplitter - > setSizes ( Sizes ) ;
2015-01-26 00:04:39 +01:00
}
2017-03-26 19:28:58 +02:00
Parent - > deleteLater ( ) ;
2015-01-26 00:04:39 +01:00
2017-03-26 19:28:58 +02:00
if ( OtherWidget - > metaObject ( ) ! = & lcQGLWidget : : staticMetaObject )
{
lcModelTabWidget * TabWidget = ( lcModelTabWidget * ) mModelTabWidget - > currentWidget ( ) ;
2015-01-26 00:04:39 +01:00
2017-03-26 19:28:58 +02:00
if ( TabWidget )
OtherWidget = TabWidget - > GetAnyViewWidget ( ) ;
}
2015-01-26 00:04:39 +01:00
2017-03-26 19:28:58 +02:00
OtherWidget - > setFocus ( ) ;
SetActiveView ( ( View * ) ( ( lcQGLWidget * ) OtherWidget ) - > widget ) ;
2015-01-26 00:04:39 +01:00
}
void lcMainWindow : : ResetViews ( )
{
2017-03-26 19:28:58 +02:00
lcModelTabWidget * TabWidget = ( lcModelTabWidget * ) mModelTabWidget - > currentWidget ( ) ;
2016-03-07 19:30:25 +01:00
if ( ! TabWidget )
return ;
2017-03-26 19:28:58 +02:00
TabWidget - > ResetLayout ( ) ;
TabWidget - > GetActiveView ( ) - > SetViewpoint ( LC_VIEWPOINT_HOME ) ;
2015-01-26 00:04:39 +01:00
}
void lcMainWindow : : TogglePrintPreview ( )
{
2017-02-11 21:41:00 +01:00
# ifndef QT_NO_PRINTER
2015-01-26 00:04:39 +01:00
// todo: print preview inside main window
lcModel * Model = lcGetActiveModel ( ) ;
int Rows = lcGetProfileInt ( LC_PROFILE_PRINT_ROWS ) ;
int Columns = lcGetProfileInt ( LC_PROFILE_PRINT_COLUMNS ) ;
int StepsPerPage = Rows * Columns ;
int PageCount = ( Model - > GetLastStep ( ) + StepsPerPage - 1 ) / StepsPerPage ;
QPrinter Printer ( QPrinter : : ScreenResolution ) ;
Printer . setFromTo ( 1 , PageCount + 1 ) ;
QPrintPreviewDialog Preview ( & Printer , this ) ;
connect ( & Preview , SIGNAL ( paintRequested ( QPrinter * ) ) , SLOT ( Print ( QPrinter * ) ) ) ;
Preview . exec ( ) ;
2017-02-11 21:41:00 +01:00
# endif
2015-01-26 00:04:39 +01:00
}
void lcMainWindow : : ToggleFullScreen ( )
{
// todo: hide toolbars and menu
// todo: create fullscreen toolbar or support esc key to go back
if ( isFullScreen ( ) )
showNormal ( ) ;
else
showFullScreen ( ) ;
}
2014-10-12 19:34:18 +02:00
void lcMainWindow : : AddRecentFile ( const QString & FileName )
2011-09-07 23:06:51 +02:00
{
2014-10-12 19:34:18 +02:00
QString SavedName = FileName ;
2013-08-09 06:57:18 +02:00
int FileIdx ;
2011-09-07 23:06:51 +02:00
2014-12-31 17:38:30 +01:00
QFileInfo FileInfo ( FileName ) ;
2013-08-09 06:57:18 +02:00
for ( FileIdx = 0 ; FileIdx < LC_MAX_RECENT_FILES ; FileIdx + + )
2014-12-31 17:38:30 +01:00
if ( QFileInfo ( mRecentFiles [ FileIdx ] ) = = FileInfo )
2011-09-07 23:06:51 +02:00
break ;
2013-08-09 06:57:18 +02:00
for ( FileIdx = lcMin ( FileIdx , LC_MAX_RECENT_FILES - 1 ) ; FileIdx > 0 ; FileIdx - - )
2014-10-12 19:34:18 +02:00
mRecentFiles [ FileIdx ] = mRecentFiles [ FileIdx - 1 ] ;
2011-09-07 23:06:51 +02:00
2014-10-12 19:34:18 +02:00
mRecentFiles [ 0 ] = SavedName ;
2011-09-07 23:06:51 +02:00
2013-08-09 06:57:18 +02:00
UpdateRecentFiles ( ) ;
2011-09-07 23:06:51 +02:00
}
2013-08-09 06:57:18 +02:00
void lcMainWindow : : RemoveRecentFile ( int FileIndex )
2011-09-07 23:06:51 +02:00
{
2013-08-09 06:57:18 +02:00
for ( int FileIdx = FileIndex ; FileIdx < LC_MAX_RECENT_FILES - 1 ; FileIdx + + )
2014-10-12 19:34:18 +02:00
mRecentFiles [ FileIdx ] = mRecentFiles [ FileIdx + 1 ] ;
2011-09-07 23:06:51 +02:00
2014-10-12 19:34:18 +02:00
mRecentFiles [ LC_MAX_RECENT_FILES - 1 ] . clear ( ) ;
2013-08-09 06:57:18 +02:00
UpdateRecentFiles ( ) ;
2011-09-07 23:06:51 +02:00
}
2013-08-09 06:57:18 +02:00
2015-12-22 23:44:46 +01:00
void lcMainWindow : : UpdateSelectedObjects ( bool SelectionChanged )
2015-01-26 00:04:39 +01:00
{
2015-12-22 23:44:46 +01:00
int Flags ;
lcArray < lcObject * > Selection ;
lcObject * Focus ;
2015-01-26 00:04:39 +01:00
2015-12-22 23:44:46 +01:00
lcGetActiveModel ( ) - > GetSelectionInformation ( & Flags , Selection , & Focus ) ;
2015-01-26 00:04:39 +01:00
2015-12-22 23:44:46 +01:00
if ( SelectionChanged )
{
mTimelineWidget - > UpdateSelection ( ) ;
mActions [ LC_EDIT_CUT ] - > setEnabled ( Flags & LC_SEL_SELECTED ) ;
mActions [ LC_EDIT_COPY ] - > setEnabled ( Flags & LC_SEL_SELECTED ) ;
mActions [ LC_EDIT_FIND ] - > setEnabled ( ( Flags & LC_SEL_NO_PIECES ) = = 0 ) ;
mActions [ LC_EDIT_FIND_NEXT ] - > setEnabled ( ( Flags & LC_SEL_NO_PIECES ) = = 0 ) ;
mActions [ LC_EDIT_FIND_PREVIOUS ] - > setEnabled ( ( Flags & LC_SEL_NO_PIECES ) = = 0 ) ;
mActions [ LC_EDIT_SELECT_INVERT ] - > setEnabled ( ( Flags & LC_SEL_NO_PIECES ) = = 0 ) ;
mActions [ LC_EDIT_SELECT_BY_NAME ] - > setEnabled ( ( Flags & LC_SEL_NO_PIECES ) = = 0 ) ;
2017-02-17 07:57:11 +01:00
mActions [ LC_EDIT_SELECT_BY_COLOR ] - > setEnabled ( ( Flags & LC_SEL_NO_PIECES ) = = 0 ) ;
2015-12-22 23:44:46 +01:00
mActions [ LC_EDIT_SELECT_NONE ] - > setEnabled ( Flags & LC_SEL_SELECTED ) ;
mActions [ LC_EDIT_SELECT_ALL ] - > setEnabled ( Flags & LC_SEL_UNSELECTED ) ;
mActions [ LC_PIECE_DELETE ] - > setEnabled ( Flags & LC_SEL_SELECTED ) ;
2017-03-09 00:55:38 +01:00
mActions [ LC_PIECE_DUPLICATE ] - > setEnabled ( Flags & LC_SEL_SELECTED ) ;
2015-12-22 23:44:46 +01:00
mActions [ LC_PIECE_RESET_PIVOT_POINT ] - > setEnabled ( Flags & LC_SEL_SELECTED ) ;
mActions [ LC_PIECE_ARRAY ] - > setEnabled ( Flags & LC_SEL_PIECE ) ;
2016-03-03 01:04:49 +01:00
mActions [ LC_PIECE_CONTROL_POINT_INSERT ] - > setEnabled ( Flags & LC_SEL_CAN_ADD_CONTROL_POINT ) ;
mActions [ LC_PIECE_CONTROL_POINT_REMOVE ] - > setEnabled ( Flags & LC_SEL_CAN_REMOVE_CONTROL_POINT ) ;
2015-12-22 23:44:46 +01:00
mActions [ LC_PIECE_HIDE_SELECTED ] - > setEnabled ( Flags & LC_SEL_VISIBLE_SELECTED ) ;
mActions [ LC_PIECE_HIDE_UNSELECTED ] - > setEnabled ( Flags & LC_SEL_UNSELECTED ) ;
mActions [ LC_PIECE_UNHIDE_SELECTED ] - > setEnabled ( Flags & LC_SEL_HIDDEN_SELECTED ) ;
mActions [ LC_PIECE_UNHIDE_ALL ] - > setEnabled ( Flags & LC_SEL_HIDDEN ) ;
mActions [ LC_PIECE_VIEW_SELECTED_MODEL ] - > setEnabled ( Flags & LC_SEL_MODEL_SELECTED ) ;
mActions [ LC_PIECE_MOVE_SELECTION_TO_MODEL ] - > setEnabled ( Flags & LC_SEL_PIECE ) ;
mActions [ LC_PIECE_INLINE_SELECTED_MODELS ] - > setEnabled ( Flags & LC_SEL_MODEL_SELECTED ) ;
mActions [ LC_PIECE_GROUP ] - > setEnabled ( Flags & LC_SEL_CAN_GROUP ) ;
mActions [ LC_PIECE_UNGROUP ] - > setEnabled ( Flags & LC_SEL_GROUPED ) ;
mActions [ LC_PIECE_GROUP_ADD ] - > setEnabled ( ( Flags & ( LC_SEL_GROUPED | LC_SEL_FOCUS_GROUPED ) ) = = LC_SEL_GROUPED ) ;
mActions [ LC_PIECE_GROUP_REMOVE ] - > setEnabled ( Flags & LC_SEL_FOCUS_GROUPED ) ;
mActions [ LC_PIECE_GROUP_EDIT ] - > setEnabled ( ( Flags & LC_SEL_NO_PIECES ) = = 0 ) ;
mActions [ LC_PIECE_SHOW_EARLIER ] - > setEnabled ( Flags & LC_SEL_PIECE ) ; // FIXME: disable if current step is 1
mActions [ LC_PIECE_SHOW_LATER ] - > setEnabled ( Flags & LC_SEL_PIECE ) ;
2017-02-05 03:40:46 +01:00
mActions [ LC_TIMELINE_MOVE_SELECTION ] - > setEnabled ( Flags & LC_SEL_PIECE ) ;
2015-12-22 23:44:46 +01:00
}
2015-01-26 00:04:39 +01:00
2015-12-22 23:44:46 +01:00
mPropertiesWidget - > Update ( Selection , Focus ) ;
2015-01-26 00:04:39 +01:00
QString Message ;
2015-12-22 23:44:46 +01:00
if ( ( Selection . GetSize ( ) = = 1 ) & & Focus )
2015-01-26 00:04:39 +01:00
{
if ( Focus - > IsPiece ( ) )
2015-12-22 23:44:46 +01:00
Message = tr ( " %1 (ID: %2) " ) . arg ( Focus - > GetName ( ) , ( ( lcPiece * ) Focus ) - > mPieceInfo - > m_strName ) ;
2015-01-26 00:04:39 +01:00
else
Message = Focus - > GetName ( ) ;
}
2015-12-22 23:44:46 +01:00
else if ( Selection . GetSize ( ) > 0 )
2015-01-26 00:04:39 +01:00
{
2016-06-13 01:05:26 +02:00
Message = tr ( " %n Object(s) selected " , " " , Selection . GetSize ( ) ) ;
2015-01-26 00:04:39 +01:00
if ( Focus & & Focus - > IsPiece ( ) )
{
2015-12-22 23:44:46 +01:00
Message . append ( tr ( " - %1 (ID: %2) " ) . arg ( Focus - > GetName ( ) , ( ( lcPiece * ) Focus ) - > mPieceInfo - > m_strName ) ) ;
2015-01-26 00:04:39 +01:00
const lcGroup * Group = ( ( lcPiece * ) Focus ) - > GetGroup ( ) ;
2015-10-21 17:03:45 +02:00
if ( Group & & ! Group - > mName . isEmpty ( ) )
2015-12-22 23:44:46 +01:00
Message . append ( tr ( " in group '%1' " ) . arg ( Group - > mName ) ) ;
2015-01-26 00:04:39 +01:00
}
}
mStatusBarLabel - > setText ( Message ) ;
2015-12-22 23:44:46 +01:00
lcVector3 Position ;
lcGetActiveModel ( ) - > GetFocusPosition ( Position ) ;
QString Label ( " X: %1 Y: %2 Z: %3 " ) ;
2016-06-14 01:57:31 +02:00
Label = Label . arg ( QLocale : : system ( ) . toString ( Position [ 0 ] , ' f ' , 2 ) , QLocale : : system ( ) . toString ( Position [ 1 ] , ' f ' , 2 ) , QLocale : : system ( ) . toString ( Position [ 2 ] , ' f ' , 2 ) ) ;
2015-12-22 23:44:46 +01:00
mStatusPositionLabel - > setText ( Label ) ;
2015-01-26 00:04:39 +01:00
}
2015-07-05 03:04:27 +02:00
void lcMainWindow : : UpdateTimeline ( bool Clear , bool UpdateItems )
2015-03-04 21:37:09 +01:00
{
2015-07-05 03:04:27 +02:00
mTimelineWidget - > Update ( Clear , UpdateItems ) ;
2015-03-04 21:37:09 +01:00
}
2015-01-26 00:04:39 +01:00
void lcMainWindow : : UpdatePaste ( bool Enabled )
{
QAction * Action = mActions [ LC_EDIT_PASTE ] ;
if ( Action )
Action - > setEnabled ( Enabled ) ;
}
void lcMainWindow : : UpdateCurrentStep ( )
{
lcModel * Model = lcGetActiveModel ( ) ;
lcStep CurrentStep = Model - > GetCurrentStep ( ) ;
lcStep LastStep = Model - > GetLastStep ( ) ;
mActions [ LC_VIEW_TIME_FIRST ] - > setEnabled ( CurrentStep ! = 1 ) ;
mActions [ LC_VIEW_TIME_PREVIOUS ] - > setEnabled ( CurrentStep > 1 ) ;
mActions [ LC_VIEW_TIME_NEXT ] - > setEnabled ( CurrentStep < LC_STEP_MAX ) ;
mActions [ LC_VIEW_TIME_LAST ] - > setEnabled ( CurrentStep ! = LastStep ) ;
mStatusTimeLabel - > setText ( QString ( tr ( " Step %1 " ) ) . arg ( QString : : number ( CurrentStep ) ) ) ;
}
void lcMainWindow : : SetAddKeys ( bool AddKeys )
{
QAction * Action = mActions [ LC_VIEW_TIME_ADD_KEYS ] ;
if ( Action )
Action - > setChecked ( AddKeys ) ;
mAddKeys = AddKeys ;
}
void lcMainWindow : : UpdateLockSnap ( )
{
mActions [ LC_EDIT_TRANSFORM_RELATIVE ] - > setChecked ( GetRelativeTransform ( ) ) ;
mActions [ LC_EDIT_LOCK_X ] - > setChecked ( GetLockX ( ) ) ;
mActions [ LC_EDIT_LOCK_Y ] - > setChecked ( GetLockY ( ) ) ;
mActions [ LC_EDIT_LOCK_Z ] - > setChecked ( GetLockZ ( ) ) ;
}
void lcMainWindow : : UpdateSnap ( )
{
2015-04-25 00:11:50 +02:00
mActions [ LC_EDIT_SNAP_MOVE_TOGGLE ] - > setChecked ( mMoveSnapEnabled ) ;
mActions [ LC_EDIT_SNAP_ANGLE_TOGGLE ] - > setChecked ( mAngleSnapEnabled ) ;
mActions [ LC_EDIT_SNAP_MOVE_XY0 + mMoveXYSnapIndex ] - > setChecked ( true ) ;
mActions [ LC_EDIT_SNAP_MOVE_Z0 + mMoveZSnapIndex ] - > setChecked ( true ) ;
mActions [ LC_EDIT_SNAP_ANGLE0 + mAngleSnapIndex ] - > setChecked ( true ) ;
2015-01-26 00:04:39 +01:00
2015-04-25 00:11:50 +02:00
mStatusSnapLabel - > setText ( QString ( tr ( " M: %1 %2 R: %3 " ) ) . arg ( GetMoveXYSnapText ( ) , GetMoveZSnapText ( ) , GetAngleSnapText ( ) ) ) ;
2015-01-26 00:04:39 +01:00
}
void lcMainWindow : : UpdateColor ( )
{
mColorList - > setCurrentColor ( mColorIndex ) ;
}
void lcMainWindow : : UpdateUndoRedo ( const QString & UndoText , const QString & RedoText )
{
QAction * UndoAction = mActions [ LC_EDIT_UNDO ] ;
QAction * RedoAction = mActions [ LC_EDIT_REDO ] ;
if ( ! UndoText . isEmpty ( ) )
{
UndoAction - > setEnabled ( true ) ;
UndoAction - > setText ( QString ( tr ( " &Undo %1 " ) ) . arg ( UndoText ) ) ;
}
else
{
UndoAction - > setEnabled ( false ) ;
UndoAction - > setText ( tr ( " &Undo " ) ) ;
}
if ( ! RedoText . isEmpty ( ) )
{
RedoAction - > setEnabled ( true ) ;
RedoAction - > setText ( QString ( tr ( " &Redo %1 " ) ) . arg ( RedoText ) ) ;
}
else
{
RedoAction - > setEnabled ( false ) ;
RedoAction - > setText ( tr ( " &Redo " ) ) ;
}
}
void lcMainWindow : : UpdateCameraMenu ( )
{
const lcArray < lcCamera * > & Cameras = lcGetActiveModel ( ) - > GetCameras ( ) ;
2016-03-06 02:47:00 +01:00
View * ActiveView = GetActiveView ( ) ;
2017-04-14 02:26:40 +02:00
lcCamera * CurrentCamera = ActiveView ? ActiveView - > mCamera : nullptr ;
2015-01-26 00:04:39 +01:00
int CurrentIndex = - 1 ;
for ( int ActionIdx = LC_VIEW_CAMERA_FIRST ; ActionIdx < = LC_VIEW_CAMERA_LAST ; ActionIdx + + )
{
QAction * Action = mActions [ ActionIdx ] ;
int CameraIdx = ActionIdx - LC_VIEW_CAMERA_FIRST ;
if ( CameraIdx < Cameras . GetSize ( ) )
{
if ( CurrentCamera = = Cameras [ CameraIdx ] )
CurrentIndex = CameraIdx ;
Action - > setText ( Cameras [ CameraIdx ] - > GetName ( ) ) ;
Action - > setVisible ( true ) ;
}
else
Action - > setVisible ( false ) ;
}
UpdateCurrentCamera ( CurrentIndex ) ;
}
void lcMainWindow : : UpdateCurrentCamera ( int CameraIndex )
{
int ActionIndex = LC_VIEW_CAMERA_FIRST + CameraIndex ;
if ( ActionIndex < LC_VIEW_CAMERA_FIRST | | ActionIndex > LC_VIEW_CAMERA_LAST )
ActionIndex = LC_VIEW_CAMERA_NONE ;
mActions [ ActionIndex ] - > setChecked ( true ) ;
}
void lcMainWindow : : UpdatePerspective ( )
{
2016-03-06 02:47:00 +01:00
View * ActiveView = GetActiveView ( ) ;
if ( ActiveView )
{
if ( ActiveView - > mCamera - > IsOrtho ( ) )
mActions [ LC_VIEW_PROJECTION_ORTHO ] - > setChecked ( true ) ;
else
mActions [ LC_VIEW_PROJECTION_PERSPECTIVE ] - > setChecked ( true ) ;
}
2015-01-26 00:04:39 +01:00
}
void lcMainWindow : : UpdateModels ( )
{
const lcArray < lcModel * > & Models = lcGetActiveProject ( ) - > GetModels ( ) ;
lcModel * CurrentModel = lcGetActiveModel ( ) ;
for ( int ActionIdx = LC_MODEL_FIRST ; ActionIdx < = LC_MODEL_LAST ; ActionIdx + + )
{
QAction * Action = mActions [ ActionIdx ] ;
int ModelIdx = ActionIdx - LC_MODEL_FIRST ;
if ( ModelIdx < Models . GetSize ( ) )
{
Action - > setChecked ( CurrentModel = = Models [ ModelIdx ] ) ;
Action - > setText ( QString : : fromLatin1 ( " &%1 %2 " ) . arg ( QString : : number ( ModelIdx + 1 ) , Models [ ModelIdx ] - > GetProperties ( ) . mName ) ) ;
Action - > setVisible ( true ) ;
}
else
Action - > setVisible ( false ) ;
}
2016-03-06 02:47:00 +01:00
for ( int TabIdx = 0 ; TabIdx < mModelTabWidget - > count ( ) ; )
{
lcModelTabWidget * TabWidget = ( lcModelTabWidget * ) mModelTabWidget - > widget ( TabIdx ) ;
lcModel * Model = TabWidget - > GetModel ( ) ;
2017-03-27 03:14:08 +02:00
if ( ! Model )
TabIdx + + ;
else if ( Models . FindIndex ( Model ) ! = - 1 )
2016-03-06 02:47:00 +01:00
{
mModelTabWidget - > setTabText ( TabIdx , Model - > GetProperties ( ) . mName ) ;
TabIdx + + ;
}
else
delete TabWidget ;
}
2016-12-19 03:53:25 +01:00
mPartSelectionWidget - > UpdateModels ( ) ;
2015-02-22 03:54:43 +01:00
2016-12-28 22:30:31 +01:00
if ( mCurrentPieceInfo & & mCurrentPieceInfo - > IsModel ( ) )
2017-04-14 02:26:40 +02:00
SetCurrentPieceInfo ( nullptr ) ;
2015-01-26 00:04:39 +01:00
}
void lcMainWindow : : UpdateCategories ( )
{
2016-12-20 23:11:19 +01:00
mPartSelectionWidget - > UpdateCategories ( ) ;
2015-01-26 00:04:39 +01:00
}
void lcMainWindow : : UpdateTitle ( )
{
setWindowModified ( lcGetActiveProject ( ) - > IsModified ( ) ) ;
setWindowFilePath ( lcGetActiveProject ( ) - > GetTitle ( ) ) ;
}
void lcMainWindow : : UpdateModified ( bool Modified )
{
setWindowModified ( Modified ) ;
}
void lcMainWindow : : UpdateRecentFiles ( )
{
for ( int ActionIdx = LC_FILE_RECENT_FIRST ; ActionIdx < = LC_FILE_RECENT_LAST ; ActionIdx + + )
{
int FileIdx = ActionIdx - LC_FILE_RECENT_FIRST ;
QAction * Action = mActions [ ActionIdx ] ;
if ( ! mRecentFiles [ FileIdx ] . isEmpty ( ) )
{
Action - > setText ( QString ( " &%1 %2 " ) . arg ( QString : : number ( FileIdx + 1 ) , QDir : : toNativeSeparators ( mRecentFiles [ FileIdx ] ) ) ) ;
Action - > setVisible ( true ) ;
}
else
Action - > setVisible ( false ) ;
}
mActionFileRecentSeparator - > setVisible ( ! mRecentFiles [ 0 ] . isEmpty ( ) ) ;
}
void lcMainWindow : : UpdateShortcuts ( )
{
for ( int ActionIdx = 0 ; ActionIdx < LC_NUM_COMMANDS ; ActionIdx + + )
2015-09-27 09:02:57 +02:00
mActions [ ActionIdx ] - > setShortcut ( QKeySequence ( gKeyboardShortcuts . mShortcuts [ ActionIdx ] ) ) ;
2015-01-26 00:04:39 +01:00
}
2014-12-04 02:47:28 +01:00
void lcMainWindow : : NewProject ( )
{
if ( ! SaveProjectIfModified ( ) )
return ;
Project * NewProject = new Project ( ) ;
g_App - > SetProject ( NewProject ) ;
2015-11-16 03:41:16 +01:00
lcGetPiecesLibrary ( ) - > UnloadUnusedParts ( ) ;
2014-12-04 02:47:28 +01:00
}
bool lcMainWindow : : OpenProject ( const QString & FileName )
{
if ( ! SaveProjectIfModified ( ) )
return false ;
QString LoadFileName = FileName ;
if ( LoadFileName . isEmpty ( ) )
{
LoadFileName = lcGetActiveProject ( ) - > GetFileName ( ) ;
if ( LoadFileName . isEmpty ( ) )
LoadFileName = lcGetProfileString ( LC_PROFILE_PROJECTS_PATH ) ;
2015-01-26 00:04:39 +01:00
LoadFileName = QFileDialog : : getOpenFileName ( this , tr ( " Open Project " ) , LoadFileName , tr ( " Supported Files (*.lcd *.ldr *.dat *.mpd);;All Files (*.*) " ) ) ;
2014-12-04 02:47:28 +01:00
if ( LoadFileName . isEmpty ( ) )
return false ;
2016-10-15 22:00:26 +02:00
lcSetProfileString ( LC_PROFILE_PROJECTS_PATH , QFileInfo ( LoadFileName ) . absolutePath ( ) ) ;
2014-12-04 02:47:28 +01:00
}
Project * NewProject = new Project ( ) ;
if ( NewProject - > Load ( LoadFileName ) )
{
g_App - > SetProject ( NewProject ) ;
AddRecentFile ( LoadFileName ) ;
2015-01-26 00:04:39 +01:00
UpdateAllViews ( ) ;
2014-12-31 00:45:27 +01:00
2014-12-04 02:47:28 +01:00
return true ;
}
2015-01-26 00:04:39 +01:00
QMessageBox : : information ( this , tr ( " LeoCAD " ) , tr ( " Error loading '%1'. " ) . arg ( LoadFileName ) ) ;
2014-12-04 02:47:28 +01:00
delete NewProject ;
return false ;
}
2014-12-16 00:55:17 +01:00
void lcMainWindow : : MergeProject ( )
{
2014-12-23 18:02:23 +01:00
QString LoadFileName = lcGetActiveProject ( ) - > GetFileName ( ) ;
2014-12-16 00:55:17 +01:00
if ( LoadFileName . isEmpty ( ) )
2014-12-23 18:02:23 +01:00
LoadFileName = lcGetProfileString ( LC_PROFILE_PROJECTS_PATH ) ;
2014-12-16 00:55:17 +01:00
2015-02-22 03:39:15 +01:00
LoadFileName = QFileDialog : : getOpenFileName ( this , tr ( " Merge Project " ) , LoadFileName , tr ( " Supported Files (*.lcd *.ldr *.dat *.mpd);;All Files (*.*) " ) ) ;
2014-12-16 00:55:17 +01:00
2014-12-23 18:02:23 +01:00
if ( LoadFileName . isEmpty ( ) )
return ;
2014-12-16 00:55:17 +01:00
2016-10-15 22:00:26 +02:00
lcSetProfileString ( LC_PROFILE_PROJECTS_PATH , QFileInfo ( LoadFileName ) . absolutePath ( ) ) ;
2014-12-16 00:55:17 +01:00
Project * NewProject = new Project ( ) ;
if ( NewProject - > Load ( LoadFileName ) )
{
2014-12-23 18:02:23 +01:00
int NumModels = NewProject - > GetModels ( ) . GetSize ( ) ;
2014-12-16 00:55:17 +01:00
2014-12-23 18:02:23 +01:00
lcGetActiveProject ( ) - > Merge ( NewProject ) ;
2014-12-16 00:55:17 +01:00
2014-12-23 18:02:23 +01:00
if ( NumModels = = 1 )
2015-01-26 00:04:39 +01:00
QMessageBox : : information ( this , tr ( " LeoCAD " ) , tr ( " Merged 1 model. " ) ) ;
2014-12-23 18:02:23 +01:00
else
2015-01-26 00:04:39 +01:00
QMessageBox : : information ( this , tr ( " LeoCAD " ) , tr ( " Merged %1 models. " ) . arg ( NumModels ) ) ;
2015-02-09 02:36:25 +01:00
UpdateModels ( ) ;
2014-12-23 18:02:23 +01:00
}
else
{
2015-01-26 00:04:39 +01:00
QMessageBox : : information ( this , tr ( " LeoCAD " ) , tr ( " Error loading '%1'. " ) . arg ( LoadFileName ) ) ;
2014-12-23 18:02:23 +01:00
delete NewProject ;
}
2014-12-16 00:55:17 +01:00
}
2017-06-26 03:20:34 +02:00
void lcMainWindow : : ImportLDD ( )
{
if ( ! SaveProjectIfModified ( ) )
return ;
QString LoadFileName = QFileDialog : : getOpenFileName ( this , tr ( " Import " ) , QString ( ) , tr ( " LEGO Diginal Designer Files (*.lxf);;All Files (*.*) " ) ) ;
if ( LoadFileName . isEmpty ( ) )
return ;
Project * NewProject = new Project ( ) ;
if ( NewProject - > ImportLDD ( LoadFileName ) )
{
g_App - > SetProject ( NewProject ) ;
UpdateAllViews ( ) ;
}
else
delete NewProject ;
}
2014-12-04 02:47:28 +01:00
bool lcMainWindow : : SaveProject ( const QString & FileName )
{
QString SaveFileName ;
Project * Project = lcGetActiveProject ( ) ;
if ( ! FileName . isEmpty ( ) )
SaveFileName = FileName ;
else
{
2014-12-08 20:30:53 +01:00
SaveFileName = Project - > GetFileName ( ) ;
2014-12-04 02:47:28 +01:00
if ( SaveFileName . isEmpty ( ) )
SaveFileName = QFileInfo ( QDir ( lcGetProfileString ( LC_PROFILE_PROJECTS_PATH ) ) , Project - > GetTitle ( ) ) . absoluteFilePath ( ) ;
2015-02-08 04:29:42 +01:00
QString Filter = ( Project - > GetModels ( ) . GetSize ( ) > 1 ) ? tr ( " Supported Files (*.mpd);;All Files (*.*) " ) : tr ( " Supported Files (*.ldr *.dat *.mpd);;All Files (*.*) " ) ;
SaveFileName = QFileDialog : : getSaveFileName ( this , tr ( " Save Project " ) , SaveFileName , Filter ) ;
2014-12-04 02:47:28 +01:00
if ( SaveFileName . isEmpty ( ) )
return false ;
2016-10-15 22:00:26 +02:00
lcSetProfileString ( LC_PROFILE_PROJECTS_PATH , QFileInfo ( SaveFileName ) . absolutePath ( ) ) ;
2014-12-04 02:47:28 +01:00
}
if ( QFileInfo ( SaveFileName ) . suffix ( ) . toLower ( ) = = QLatin1String ( " lcd " ) )
{
2015-02-08 04:29:42 +01:00
QMessageBox : : warning ( this , tr ( " Error " ) , tr ( " Saving files in LCD format is no longer supported, please use the LDR or MPD formats instead. " ) ) ;
2014-12-04 02:47:28 +01:00
return false ;
}
2014-12-08 08:32:39 +01:00
if ( ! Project - > Save ( SaveFileName ) )
2014-12-04 02:47:28 +01:00
return false ;
AddRecentFile ( SaveFileName ) ;
2014-12-08 08:32:39 +01:00
UpdateTitle ( ) ;
2014-12-04 02:47:28 +01:00
return true ;
}
bool lcMainWindow : : SaveProjectIfModified ( )
{
Project * Project = lcGetActiveProject ( ) ;
if ( ! Project - > IsModified ( ) )
return true ;
2015-01-26 00:04:39 +01:00
switch ( QMessageBox : : question ( this , tr ( " Save Project " ) , tr ( " Save changes to '%1'? " ) . arg ( Project - > GetTitle ( ) ) , QMessageBox : : Yes | QMessageBox : : No | QMessageBox : : Cancel ) )
2014-12-04 02:47:28 +01:00
{
default :
case QMessageBox : : Cancel :
return false ;
case QMessageBox : : Yes :
if ( ! SaveProject ( Project - > GetFileName ( ) ) )
return false ;
break ;
case QMessageBox : : No :
break ;
}
return true ;
}
2015-12-04 23:41:08 +01:00
bool lcMainWindow : : SetModelFromFocus ( )
2015-03-17 05:18:28 +01:00
{
lcObject * FocusObject = lcGetActiveModel ( ) - > GetFocusObject ( ) ;
if ( ! FocusObject | | ! FocusObject - > IsPiece ( ) )
2015-12-04 23:41:08 +01:00
return false ;
2015-03-17 05:18:28 +01:00
lcModel * Model = ( ( lcPiece * ) FocusObject ) - > mPieceInfo - > GetModel ( ) ;
2015-12-04 23:41:08 +01:00
if ( Model )
{
Project * Project = lcGetActiveProject ( ) ;
Project - > SetActiveModel ( Project - > GetModels ( ) . FindIndex ( Model ) ) ;
return true ;
}
return false ;
}
void lcMainWindow : : SetModelFromSelection ( )
{
if ( SetModelFromFocus ( ) )
return ;
lcModel * Model = lcGetActiveModel ( ) - > GetFirstSelectedSubmodel ( ) ;
2015-03-17 05:18:28 +01:00
if ( Model )
{
Project * Project = lcGetActiveProject ( ) ;
Project - > SetActiveModel ( Project - > GetModels ( ) . FindIndex ( Model ) ) ;
}
}
2014-12-04 02:47:28 +01:00
void lcMainWindow : : HandleCommand ( lcCommandId CommandId )
{
2016-03-06 02:47:00 +01:00
View * ActiveView = GetActiveView ( ) ;
2014-12-04 02:47:28 +01:00
switch ( CommandId )
{
case LC_FILE_NEW :
NewProject ( ) ;
break ;
case LC_FILE_OPEN :
OpenProject ( QString ( ) ) ;
break ;
2014-12-16 00:55:17 +01:00
case LC_FILE_MERGE :
MergeProject ( ) ;
break ;
2014-12-04 02:47:28 +01:00
case LC_FILE_SAVE :
SaveProject ( lcGetActiveProject ( ) - > GetFileName ( ) ) ;
break ;
case LC_FILE_SAVEAS :
SaveProject ( QString ( ) ) ;
break ;
case LC_FILE_SAVE_IMAGE :
lcGetActiveProject ( ) - > SaveImage ( ) ;
break ;
2014-12-30 17:30:12 +01:00
2017-06-26 03:20:34 +02:00
case LC_FILE_IMPORT_LDD :
ImportLDD ( ) ;
break ;
2014-12-04 02:47:28 +01:00
case LC_FILE_EXPORT_3DS :
2015-03-27 21:20:12 +01:00
lcGetActiveProject ( ) - > Export3DStudio ( QString ( ) ) ;
2014-12-04 02:47:28 +01:00
break ;
2015-01-12 05:49:30 +01:00
2014-12-04 02:47:28 +01:00
case LC_FILE_EXPORT_HTML :
lcGetActiveProject ( ) - > ExportHTML ( ) ;
break ;
2015-01-12 05:49:30 +01:00
2014-12-04 02:47:28 +01:00
case LC_FILE_EXPORT_BRICKLINK :
lcGetActiveProject ( ) - > ExportBrickLink ( ) ;
break ;
case LC_FILE_EXPORT_CSV :
lcGetActiveProject ( ) - > ExportCSV ( ) ;
break ;
case LC_FILE_EXPORT_POVRAY :
lcGetActiveProject ( ) - > ExportPOVRay ( ) ;
break ;
case LC_FILE_EXPORT_WAVEFRONT :
2015-01-23 02:58:33 +01:00
lcGetActiveProject ( ) - > ExportWavefront ( QString ( ) ) ;
2014-12-04 02:47:28 +01:00
break ;
2014-12-30 17:30:12 +01:00
2014-12-04 02:47:28 +01:00
case LC_FILE_PRINT_PREVIEW :
TogglePrintPreview ( ) ;
break ;
case LC_FILE_PRINT :
2015-01-30 17:30:13 +01:00
ShowPrintDialog ( ) ;
2014-12-04 02:47:28 +01:00
break ;
// TODO: printing
case LC_FILE_PRINT_BOM :
break ;
case LC_FILE_RECENT1 :
case LC_FILE_RECENT2 :
case LC_FILE_RECENT3 :
case LC_FILE_RECENT4 :
if ( ! OpenProject ( mRecentFiles [ CommandId - LC_FILE_RECENT1 ] ) )
RemoveRecentFile ( CommandId - LC_FILE_RECENT1 ) ;
break ;
case LC_FILE_EXIT :
2015-01-26 00:04:39 +01:00
close ( ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_EDIT_UNDO :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > UndoAction ( ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_EDIT_REDO :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > RedoAction ( ) ;
2014-12-04 02:47:28 +01:00
break ;
2014-12-16 00:55:17 +01:00
case LC_EDIT_CUT :
lcGetActiveModel ( ) - > Cut ( ) ;
break ;
2014-12-04 02:47:28 +01:00
2014-12-16 00:55:17 +01:00
case LC_EDIT_COPY :
lcGetActiveModel ( ) - > Copy ( ) ;
break ;
2014-12-04 02:47:28 +01:00
2014-12-16 00:55:17 +01:00
case LC_EDIT_PASTE :
lcGetActiveModel ( ) - > Paste ( ) ;
break ;
2014-12-04 02:47:28 +01:00
case LC_EDIT_FIND :
2015-01-26 00:04:39 +01:00
if ( DoDialog ( LC_DIALOG_FIND , & mSearchOptions ) )
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > FindPiece ( true , true ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_EDIT_FIND_NEXT :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > FindPiece ( false , true ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_EDIT_FIND_PREVIOUS :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > FindPiece ( false , false ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_EDIT_SELECT_ALL :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > SelectAllPieces ( ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_EDIT_SELECT_NONE :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > ClearSelection ( true ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_EDIT_SELECT_INVERT :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > InvertSelection ( ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_EDIT_SELECT_BY_NAME :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > ShowSelectByNameDialog ( ) ;
2014-12-04 02:47:28 +01:00
break ;
2017-02-17 07:57:11 +01:00
case LC_EDIT_SELECT_BY_COLOR :
lcGetActiveModel ( ) - > ShowSelectByColorDialog ( ) ;
break ;
2014-12-04 02:47:28 +01:00
case LC_VIEW_SPLIT_HORIZONTAL :
SplitHorizontal ( ) ;
break ;
case LC_VIEW_SPLIT_VERTICAL :
SplitVertical ( ) ;
break ;
case LC_VIEW_REMOVE_VIEW :
2015-01-26 00:04:39 +01:00
RemoveActiveView ( ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_VIEW_RESET_VIEWS :
ResetViews ( ) ;
break ;
case LC_VIEW_FULLSCREEN :
ToggleFullScreen ( ) ;
break ;
case LC_VIEW_PROJECTION_PERSPECTIVE :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
ActiveView - > SetProjection ( false ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_VIEW_PROJECTION_ORTHO :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
ActiveView - > SetProjection ( true ) ;
2014-12-04 02:47:28 +01:00
break ;
2015-01-17 19:36:09 +01:00
2014-12-04 02:47:28 +01:00
case LC_PIECE_INSERT :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > AddPiece ( ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_PIECE_DELETE :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > DeleteSelectedObjects ( ) ;
2014-12-04 02:47:28 +01:00
break ;
2017-03-09 00:55:38 +01:00
case LC_PIECE_DUPLICATE :
lcGetActiveModel ( ) - > DuplicateSelectedPieces ( ) ;
break ;
2015-12-14 19:01:17 +01:00
case LC_PIECE_RESET_PIVOT_POINT :
lcGetActiveModel ( ) - > ResetSelectedPiecesPivotPoint ( ) ;
break ;
2016-03-03 01:04:49 +01:00
case LC_PIECE_CONTROL_POINT_INSERT :
lcGetActiveModel ( ) - > InsertControlPoint ( ) ;
break ;
case LC_PIECE_CONTROL_POINT_REMOVE :
lcGetActiveModel ( ) - > RemoveFocusedControlPoint ( ) ;
break ;
2014-12-04 02:47:28 +01:00
case LC_PIECE_MOVE_PLUSX :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
lcGetActiveModel ( ) - > MoveSelectedObjects ( ActiveView - > GetMoveDirection ( lcVector3 ( lcMax ( GetMoveXYSnap ( ) , 0.1f ) , 0.0f , 0.0f ) ) , true , false , true , true ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_PIECE_MOVE_MINUSX :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
lcGetActiveModel ( ) - > MoveSelectedObjects ( ActiveView - > GetMoveDirection ( lcVector3 ( - lcMax ( GetMoveXYSnap ( ) , 0.1f ) , 0.0f , 0.0f ) ) , true , false , true , true ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_PIECE_MOVE_PLUSY :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
lcGetActiveModel ( ) - > MoveSelectedObjects ( ActiveView - > GetMoveDirection ( lcVector3 ( 0.0f , lcMax ( GetMoveXYSnap ( ) , 0.1f ) , 0.0f ) ) , true , false , true , true ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_PIECE_MOVE_MINUSY :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
lcGetActiveModel ( ) - > MoveSelectedObjects ( ActiveView - > GetMoveDirection ( lcVector3 ( 0.0f , - lcMax ( GetMoveXYSnap ( ) , 0.1f ) , 0.0f ) ) , true , false , true , true ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_PIECE_MOVE_PLUSZ :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
lcGetActiveModel ( ) - > MoveSelectedObjects ( ActiveView - > GetMoveDirection ( lcVector3 ( 0.0f , 0.0f , lcMax ( GetMoveZSnap ( ) , 0.1f ) ) ) , true , false , true , true ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_PIECE_MOVE_MINUSZ :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
lcGetActiveModel ( ) - > MoveSelectedObjects ( ActiveView - > GetMoveDirection ( lcVector3 ( 0.0f , 0.0f , - lcMax ( GetMoveZSnap ( ) , 0.1f ) ) ) , true , false , true , true ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_PIECE_ROTATE_PLUSX :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
lcGetActiveModel ( ) - > RotateSelectedPieces ( ActiveView - > GetMoveDirection ( lcVector3 ( lcMax ( ( float ) GetAngleSnap ( ) , 1.0f ) , 0.0f , 0.0f ) ) , true , false , true , true ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_PIECE_ROTATE_MINUSX :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
lcGetActiveModel ( ) - > RotateSelectedPieces ( ActiveView - > GetMoveDirection ( - lcVector3 ( lcMax ( ( float ) GetAngleSnap ( ) , 1.0f ) , 0.0f , 0.0f ) ) , true , false , true , true ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_PIECE_ROTATE_PLUSY :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
lcGetActiveModel ( ) - > RotateSelectedPieces ( ActiveView - > GetMoveDirection ( lcVector3 ( 0.0f , lcMax ( ( float ) GetAngleSnap ( ) , 1.0f ) , 0.0f ) ) , true , false , true , true ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_PIECE_ROTATE_MINUSY :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
lcGetActiveModel ( ) - > RotateSelectedPieces ( ActiveView - > GetMoveDirection ( lcVector3 ( 0.0f , - lcMax ( ( float ) GetAngleSnap ( ) , 1.0f ) , 0.0f ) ) , true , false , true , true ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_PIECE_ROTATE_PLUSZ :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
lcGetActiveModel ( ) - > RotateSelectedPieces ( ActiveView - > GetMoveDirection ( lcVector3 ( 0.0f , 0.0f , lcMax ( ( float ) GetAngleSnap ( ) , 1.0f ) ) ) , true , false , true , true ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_PIECE_ROTATE_MINUSZ :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
lcGetActiveModel ( ) - > RotateSelectedPieces ( ActiveView - > GetMoveDirection ( lcVector3 ( 0.0f , 0.0f , - lcMax ( ( float ) GetAngleSnap ( ) , 1.0f ) ) ) , true , false , true , true ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_PIECE_MINIFIG_WIZARD :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > ShowMinifigDialog ( ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_PIECE_ARRAY :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > ShowArrayDialog ( ) ;
2014-12-04 02:47:28 +01:00
break ;
2015-12-04 23:41:08 +01:00
case LC_PIECE_VIEW_SELECTED_MODEL :
SetModelFromSelection ( ) ;
break ;
2015-12-02 00:31:28 +01:00
case LC_PIECE_MOVE_SELECTION_TO_MODEL :
2015-12-02 02:16:12 +01:00
lcGetActiveModel ( ) - > MoveSelectionToModel ( lcGetActiveProject ( ) - > CreateNewModel ( false ) ) ;
2015-12-02 00:31:28 +01:00
break ;
case LC_PIECE_INLINE_SELECTED_MODELS :
lcGetActiveModel ( ) - > InlineSelectedModels ( ) ;
break ;
2014-12-04 02:47:28 +01:00
case LC_PIECE_GROUP :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > GroupSelection ( ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_PIECE_UNGROUP :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > UngroupSelection ( ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_PIECE_GROUP_ADD :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > AddSelectedPiecesToGroup ( ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_PIECE_GROUP_REMOVE :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > RemoveFocusPieceFromGroup ( ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_PIECE_GROUP_EDIT :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > ShowEditGroupsDialog ( ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_PIECE_HIDE_SELECTED :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > HideSelectedPieces ( ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_PIECE_HIDE_UNSELECTED :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > HideUnselectedPieces ( ) ;
2014-12-04 02:47:28 +01:00
break ;
2015-03-15 21:01:07 +01:00
case LC_PIECE_UNHIDE_SELECTED :
lcGetActiveModel ( ) - > UnhideSelectedPieces ( ) ;
break ;
2014-12-04 02:47:28 +01:00
case LC_PIECE_UNHIDE_ALL :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > UnhideAllPieces ( ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_PIECE_SHOW_EARLIER :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > ShowSelectedPiecesEarlier ( ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_PIECE_SHOW_LATER :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > ShowSelectedPiecesLater ( ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_VIEW_PREFERENCES :
g_App - > ShowPreferencesDialog ( ) ;
break ;
case LC_VIEW_ZOOM_IN :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
lcGetActiveModel ( ) - > Zoom ( ActiveView - > mCamera , 10.0f ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_VIEW_ZOOM_OUT :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
lcGetActiveModel ( ) - > Zoom ( ActiveView - > mCamera , - 10.0f ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_VIEW_ZOOM_EXTENTS :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
ActiveView - > ZoomExtents ( ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_VIEW_LOOK_AT :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
ActiveView - > LookAt ( ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_VIEW_TIME_NEXT :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > ShowNextStep ( ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_VIEW_TIME_PREVIOUS :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > ShowPreviousStep ( ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_VIEW_TIME_FIRST :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > ShowFirstStep ( ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_VIEW_TIME_LAST :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > ShowLastStep ( ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_VIEW_TIME_INSERT :
2015-03-15 20:42:11 +01:00
lcGetActiveModel ( ) - > InsertStep ( lcGetActiveModel ( ) - > GetCurrentStep ( ) ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_VIEW_TIME_DELETE :
2015-03-15 20:42:11 +01:00
lcGetActiveModel ( ) - > RemoveStep ( lcGetActiveModel ( ) - > GetCurrentStep ( ) ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_VIEW_VIEWPOINT_FRONT :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
ActiveView - > SetViewpoint ( LC_VIEWPOINT_FRONT ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_VIEW_VIEWPOINT_BACK :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
ActiveView - > SetViewpoint ( LC_VIEWPOINT_BACK ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_VIEW_VIEWPOINT_TOP :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
ActiveView - > SetViewpoint ( LC_VIEWPOINT_TOP ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_VIEW_VIEWPOINT_BOTTOM :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
ActiveView - > SetViewpoint ( LC_VIEWPOINT_BOTTOM ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_VIEW_VIEWPOINT_LEFT :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
ActiveView - > SetViewpoint ( LC_VIEWPOINT_LEFT ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_VIEW_VIEWPOINT_RIGHT :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
ActiveView - > SetViewpoint ( LC_VIEWPOINT_RIGHT ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_VIEW_VIEWPOINT_HOME :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
ActiveView - > SetViewpoint ( LC_VIEWPOINT_HOME ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_VIEW_CAMERA_NONE :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
ActiveView - > RemoveCamera ( ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_VIEW_CAMERA1 :
case LC_VIEW_CAMERA2 :
case LC_VIEW_CAMERA3 :
case LC_VIEW_CAMERA4 :
case LC_VIEW_CAMERA5 :
case LC_VIEW_CAMERA6 :
case LC_VIEW_CAMERA7 :
case LC_VIEW_CAMERA8 :
case LC_VIEW_CAMERA9 :
case LC_VIEW_CAMERA10 :
case LC_VIEW_CAMERA11 :
case LC_VIEW_CAMERA12 :
case LC_VIEW_CAMERA13 :
case LC_VIEW_CAMERA14 :
case LC_VIEW_CAMERA15 :
case LC_VIEW_CAMERA16 :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
ActiveView - > SetCameraIndex ( CommandId - LC_VIEW_CAMERA1 ) ;
2014-12-04 02:47:28 +01:00
break ;
2015-01-16 03:07:31 +01:00
case LC_VIEW_CAMERA_RESET :
ResetCameras ( ) ;
break ;
2014-12-04 02:47:28 +01:00
2014-12-13 00:42:09 +01:00
case LC_MODEL_NEW :
2015-12-02 02:16:12 +01:00
lcGetActiveProject ( ) - > CreateNewModel ( true ) ;
2014-12-13 00:42:09 +01:00
break ;
2014-12-31 18:05:23 +01:00
case LC_MODEL_PROPERTIES :
lcGetActiveModel ( ) - > ShowPropertiesDialog ( ) ;
break ;
2015-03-17 05:18:28 +01:00
case LC_MODEL_EDIT_FOCUS :
SetModelFromFocus ( ) ;
break ;
2014-12-13 00:42:09 +01:00
case LC_MODEL_LIST :
lcGetActiveProject ( ) - > ShowModelListDialog ( ) ;
break ;
case LC_MODEL_01 :
case LC_MODEL_02 :
case LC_MODEL_03 :
case LC_MODEL_04 :
case LC_MODEL_05 :
case LC_MODEL_06 :
case LC_MODEL_07 :
case LC_MODEL_08 :
case LC_MODEL_09 :
case LC_MODEL_10 :
case LC_MODEL_11 :
case LC_MODEL_12 :
case LC_MODEL_13 :
case LC_MODEL_14 :
case LC_MODEL_15 :
case LC_MODEL_16 :
2016-02-21 07:57:36 +01:00
case LC_MODEL_17 :
case LC_MODEL_18 :
case LC_MODEL_19 :
case LC_MODEL_20 :
case LC_MODEL_21 :
case LC_MODEL_22 :
case LC_MODEL_23 :
case LC_MODEL_24 :
2014-12-13 00:42:09 +01:00
lcGetActiveProject ( ) - > SetActiveModel ( CommandId - LC_MODEL_01 ) ;
break ;
2014-12-04 02:47:28 +01:00
case LC_HELP_HOMEPAGE :
2015-01-31 21:38:53 +01:00
QDesktopServices : : openUrl ( QUrl ( " http://www.leocad.org/ " ) ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_HELP_EMAIL :
2015-01-31 21:38:53 +01:00
QDesktopServices : : openUrl ( QUrl ( " mailto:leozide@gmail.com?subject=LeoCAD " ) ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_HELP_UPDATES :
2016-08-01 05:44:15 +02:00
ShowUpdatesDialog ( ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_HELP_ABOUT :
2016-08-01 05:44:15 +02:00
ShowAboutDialog ( ) ;
break ;
2014-12-04 02:47:28 +01:00
case LC_VIEW_TIME_ADD_KEYS :
SetAddKeys ( ! GetAddKeys ( ) ) ;
break ;
2015-01-18 06:36:14 +01:00
case LC_EDIT_TRANSFORM_RELATIVE :
SetRelativeTransform ( ! GetRelativeTransform ( ) ) ;
2014-12-04 02:47:28 +01:00
break ;
case LC_EDIT_LOCK_X :
SetLockX ( ! GetLockX ( ) ) ;
break ;
case LC_EDIT_LOCK_Y :
SetLockY ( ! GetLockY ( ) ) ;
break ;
case LC_EDIT_LOCK_Z :
SetLockZ ( ! GetLockZ ( ) ) ;
break ;
case LC_EDIT_LOCK_NONE :
SetLockX ( false ) ;
SetLockY ( false ) ;
SetLockZ ( false ) ;
break ;
2015-04-25 00:11:50 +02:00
case LC_EDIT_SNAP_MOVE_TOGGLE :
SetMoveSnapEnabled ( ! mMoveSnapEnabled ) ;
break ;
2014-12-04 02:47:28 +01:00
case LC_EDIT_SNAP_MOVE_XY0 :
case LC_EDIT_SNAP_MOVE_XY1 :
case LC_EDIT_SNAP_MOVE_XY2 :
case LC_EDIT_SNAP_MOVE_XY3 :
case LC_EDIT_SNAP_MOVE_XY4 :
case LC_EDIT_SNAP_MOVE_XY5 :
case LC_EDIT_SNAP_MOVE_XY6 :
case LC_EDIT_SNAP_MOVE_XY7 :
case LC_EDIT_SNAP_MOVE_XY8 :
case LC_EDIT_SNAP_MOVE_XY9 :
SetMoveXYSnapIndex ( CommandId - LC_EDIT_SNAP_MOVE_XY0 ) ;
break ;
case LC_EDIT_SNAP_MOVE_Z0 :
case LC_EDIT_SNAP_MOVE_Z1 :
case LC_EDIT_SNAP_MOVE_Z2 :
case LC_EDIT_SNAP_MOVE_Z3 :
case LC_EDIT_SNAP_MOVE_Z4 :
case LC_EDIT_SNAP_MOVE_Z5 :
case LC_EDIT_SNAP_MOVE_Z6 :
case LC_EDIT_SNAP_MOVE_Z7 :
case LC_EDIT_SNAP_MOVE_Z8 :
case LC_EDIT_SNAP_MOVE_Z9 :
SetMoveZSnapIndex ( CommandId - LC_EDIT_SNAP_MOVE_Z0 ) ;
break ;
2015-04-25 00:11:50 +02:00
case LC_EDIT_SNAP_ANGLE_TOGGLE :
SetAngleSnapEnabled ( ! mAngleSnapEnabled ) ;
break ;
2014-12-04 02:47:28 +01:00
case LC_EDIT_SNAP_ANGLE0 :
case LC_EDIT_SNAP_ANGLE1 :
case LC_EDIT_SNAP_ANGLE2 :
case LC_EDIT_SNAP_ANGLE3 :
case LC_EDIT_SNAP_ANGLE4 :
case LC_EDIT_SNAP_ANGLE5 :
case LC_EDIT_SNAP_ANGLE6 :
case LC_EDIT_SNAP_ANGLE7 :
case LC_EDIT_SNAP_ANGLE8 :
case LC_EDIT_SNAP_ANGLE9 :
SetAngleSnapIndex ( CommandId - LC_EDIT_SNAP_ANGLE0 ) ;
break ;
case LC_EDIT_TRANSFORM :
2014-12-08 08:32:39 +01:00
lcGetActiveModel ( ) - > TransformSelectedObjects ( GetTransformType ( ) , GetTransformAmount ( ) ) ;
2014-12-04 02:47:28 +01:00
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 :
SetTransformType ( ( lcTransformType ) ( CommandId - LC_EDIT_TRANSFORM_ABSOLUTE_TRANSLATION ) ) ;
break ;
case LC_EDIT_ACTION_SELECT :
SetTool ( LC_TOOL_SELECT ) ;
break ;
case LC_EDIT_ACTION_INSERT :
SetTool ( LC_TOOL_INSERT ) ;
break ;
case LC_EDIT_ACTION_LIGHT :
SetTool ( LC_TOOL_LIGHT ) ;
break ;
case LC_EDIT_ACTION_SPOTLIGHT :
SetTool ( LC_TOOL_SPOTLIGHT ) ;
break ;
case LC_EDIT_ACTION_CAMERA :
SetTool ( LC_TOOL_CAMERA ) ;
break ;
case LC_EDIT_ACTION_MOVE :
SetTool ( LC_TOOL_MOVE ) ;
break ;
case LC_EDIT_ACTION_ROTATE :
SetTool ( LC_TOOL_ROTATE ) ;
break ;
case LC_EDIT_ACTION_DELETE :
SetTool ( LC_TOOL_ERASER ) ;
break ;
case LC_EDIT_ACTION_PAINT :
SetTool ( LC_TOOL_PAINT ) ;
break ;
case LC_EDIT_ACTION_ZOOM :
SetTool ( LC_TOOL_ZOOM ) ;
break ;
case LC_EDIT_ACTION_ZOOM_REGION :
SetTool ( LC_TOOL_ZOOM_REGION ) ;
break ;
case LC_EDIT_ACTION_PAN :
SetTool ( LC_TOOL_PAN ) ;
break ;
case LC_EDIT_ACTION_ROTATE_VIEW :
SetTool ( LC_TOOL_ROTATE_VIEW ) ;
break ;
case LC_EDIT_ACTION_ROLL :
SetTool ( LC_TOOL_ROLL ) ;
break ;
case LC_EDIT_CANCEL :
2016-03-06 02:47:00 +01:00
if ( ActiveView )
ActiveView - > CancelTrackingOrClearSelection ( ) ;
2014-12-04 02:47:28 +01:00
break ;
2017-02-05 03:40:46 +01:00
case LC_TIMELINE_INSERT :
mTimelineWidget - > InsertStep ( ) ;
break ;
case LC_TIMELINE_DELETE :
mTimelineWidget - > RemoveStep ( ) ;
break ;
case LC_TIMELINE_MOVE_SELECTION :
mTimelineWidget - > MoveSelection ( ) ;
break ;
case LC_TIMELINE_SET_CURRENT :
mTimelineWidget - > SetCurrentStep ( ) ;
break ;
2014-12-04 02:47:28 +01:00
case LC_NUM_COMMANDS :
break ;
}
}