这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/src/mainwindow2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,9 @@ void MainWindow2::createMenus()
connect(ui->actionZoom_Out, &QAction::triggered, mCommands, &ActionCommands::ZoomOut);
connect(ui->actionRotate_Clockwise, &QAction::triggered, mCommands, &ActionCommands::rotateClockwise);
connect(ui->actionRotate_Anticlockwise, &QAction::triggered, mCommands, &ActionCommands::rotateCounterClockwise);
connect(ui->actionReset_Rotation, &QAction::triggered, mEditor->view(), &ViewManager::resetRotation);
connect(ui->actionReset_View, &QAction::triggered, mEditor->view(), &ViewManager::resetView);
connect(ui->actionCenter_View, &QAction::triggered, mEditor->view(), &ViewManager::centerView);
connect(ui->actionZoom400, &QAction::triggered, mEditor->view(), &ViewManager::scale400);
connect(ui->actionZoom300, &QAction::triggered, mEditor->view(), &ViewManager::scale300);
connect(ui->actionZoom200, &QAction::triggered, mEditor->view(), &ViewManager::scale200);
Expand Down Expand Up @@ -1211,6 +1213,7 @@ void MainWindow2::setupKeyboardShortcuts()
// View menu
ui->actionResetWindows->setShortcut(cmdKeySeq(CMD_RESET_WINDOWS));
ui->actionReset_View->setShortcut(cmdKeySeq(CMD_RESET_ZOOM_ROTATE));
ui->actionCenter_View->setShortcut(cmdKeySeq(CMD_CENTER_VIEW));
ui->actionZoom_In->setShortcut(cmdKeySeq(CMD_ZOOM_IN));
ui->actionZoom_Out->setShortcut(cmdKeySeq(CMD_ZOOM_OUT));
ui->actionZoom400->setShortcut(cmdKeySeq(CMD_ZOOM_400));
Expand All @@ -1222,6 +1225,7 @@ void MainWindow2::setupKeyboardShortcuts()
ui->actionZoom25->setShortcut(cmdKeySeq(CMD_ZOOM_25));
ui->actionRotate_Clockwise->setShortcut(cmdKeySeq(CMD_ROTATE_CLOCK));
ui->actionRotate_Anticlockwise->setShortcut(cmdKeySeq(CMD_ROTATE_ANTI_CLOCK));
ui->actionReset_Rotation->setShortcut(cmdKeySeq(CMD_RESET_ROTATION));
ui->actionHorizontal_Flip->setShortcut(cmdKeySeq(CMD_FLIP_HORIZONTAL));
ui->actionVertical_Flip->setShortcut(cmdKeySeq(CMD_FLIP_VERTICAL));
ui->actionPreview->setShortcut(cmdKeySeq(CMD_PREVIEW));
Expand Down
4 changes: 3 additions & 1 deletion app/src/shortcutspage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,11 @@ static QString getHumanReadableShortcutName(const QString& cmdName)
{CMD_REDO, QObject::tr("Redo", "Shortcut")},
{CMD_REMOVE_FRAME, QObject::tr("Remove Frame", "Shortcut")},
{CMD_RESET_WINDOWS, QObject::tr("Reset Windows", "Shortcut")},
{CMD_RESET_ZOOM_ROTATE, QObject::tr("Reset Zoom/Rotate", "Shortcut")},
{CMD_RESET_ZOOM_ROTATE, QObject::tr("Reset View", "Shortcut")},
{CMD_CENTER_VIEW, QObject::tr("Center View", "Shortcut")},
{CMD_ROTATE_ANTI_CLOCK, QObject::tr("Rotate Anticlockwise", "Shortcut")},
{CMD_ROTATE_CLOCK, QObject::tr("Rotate Clockwise", "Shortcut")},
{CMD_RESET_ROTATION, QObject::tr("Reset Rotation", "Shortcut")},
{CMD_SAVE_AS, QObject::tr("Save File As", "Shortcut")},
{CMD_SAVE_FILE, QObject::tr("Save File", "Shortcut")},
{CMD_SELECT_ALL, QObject::tr("Select All", "Shortcut")},
Expand Down
14 changes: 13 additions & 1 deletion app/ui/mainwindow2.ui
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,15 @@
<addaction name="actionVisibilityAll"/>
</widget>
<addaction name="actionReset_View"/>
<addaction name="actionCenter_View"/>
<addaction name="separator"/>
<addaction name="actionZoom_In"/>
<addaction name="actionZoom_Out"/>
<addaction name="menuZoom"/>
<addaction name="separator"/>
<addaction name="actionRotate_Clockwise"/>
<addaction name="actionRotate_Anticlockwise"/>
<addaction name="actionReset_Rotation"/>
<addaction name="separator"/>
<addaction name="actionHorizontal_Flip"/>
<addaction name="actionVertical_Flip"/>
Expand Down Expand Up @@ -487,7 +489,7 @@
</action>
<action name="actionReset_View">
<property name="text">
<string>Reset Zoom/Rotate</string>
<string>Reset</string>
</property>
</action>
<action name="actionHorizontal_Flip">
Expand Down Expand Up @@ -1105,6 +1107,16 @@
<string>Lock Windows</string>
</property>
</action>
<action name="actionCenter_View">
<property name="text">
<string>Center</string>
</property>
</action>
<action name="actionReset_Rotation">
<property name="text">
<string>Reset Rotation</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
Expand Down
2 changes: 2 additions & 0 deletions core_lib/data/resources/kb.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ CmdZoom33=Shift+3
CmdZoom25=Shift+4
CmdRotateClockwise=R
CmdRotateAntiClockwise=Z
CmdResetRotation=Alt+H
CmdResetZoomRotate=Ctrl+H
CmdCenterView=Ctrl+Shift+H
CmdFlipHorizontal=Shift+H
CmdFlipVertical=Shift+V
CmdPreview=Alt+P
Expand Down
10 changes: 10 additions & 0 deletions core_lib/src/managers/viewmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ void ViewManager::translate(QPointF offset)
translate(static_cast<float>(offset.x()), static_cast<float>(offset.y()));
}

void ViewManager::centerView()
{
translate(0, 0);
}

float ViewManager::rotation()
{
if (mCurrentCamera)
Expand All @@ -203,6 +208,11 @@ void ViewManager::rotate(float degree)
}
}

void ViewManager::resetRotation()
{
rotate(0);
}

qreal ViewManager::scaling()
{
if (mCurrentCamera)
Expand Down
4 changes: 3 additions & 1 deletion core_lib/src/managers/viewmanager.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*

Pencil2D - Traditional Animation Software
Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
Expand Down Expand Up @@ -58,9 +58,11 @@ class ViewManager : public BaseManager
QPointF translation() const;
void translate(float dx, float dy);
void translate(QPointF offset);
void centerView();

float rotation();
void rotate(float degree);
void resetRotation();

qreal scaling();
void scale(qreal scaleValue);
Expand Down
5 changes: 1 addition & 4 deletions core_lib/src/structure/camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,7 @@ void Camera::scale(qreal scaleValue)
void Camera::scaleWithOffset(qreal scaleValue, QPointF offset)
{
mTranslate = (mTranslate + offset) * mScale / scaleValue - offset;
mScale = scaleValue;

mNeedUpdateView = true;
modification();
scale(scaleValue);
}

bool Camera::operator==(const Camera& rhs) const
Expand Down
2 changes: 2 additions & 0 deletions core_lib/src/util/pencildef.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ const static int MaxFramesBound = 9999;
#define CMD_ZOOM_OUT "CmdZoomOut"
#define CMD_ROTATE_CLOCK "CmdRotateClockwise"
#define CMD_ROTATE_ANTI_CLOCK "CmdRotateAntiClockwise"
#define CMD_RESET_ROTATION "CmdResetRotation"
#define CMD_RESET_ZOOM_ROTATE "CmdResetZoomRotate"
#define CMD_CENTER_VIEW "CmdCenterView"
#define CMD_ZOOM_400 "CmdZoom400"
#define CMD_ZOOM_300 "CmdZoom300"
#define CMD_ZOOM_200 "CmdZoom200"
Expand Down