mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-25 07:37:37 +08:00
ENABLE_GCODE_VIEWER -> KBShortcutsDialog shows only related tabs when gcode viewer state is active
This commit is contained in:
parent
99a15af03d
commit
5ff6f3045e
@ -7,6 +7,9 @@
|
|||||||
#include <wx/display.h>
|
#include <wx/display.h>
|
||||||
#include "GUI_App.hpp"
|
#include "GUI_App.hpp"
|
||||||
#include "wxExtensions.hpp"
|
#include "wxExtensions.hpp"
|
||||||
|
#if ENABLE_GCODE_VIEWER
|
||||||
|
#include "MainFrame.hpp"
|
||||||
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
#define NOTEBOOK_TOP 1
|
#define NOTEBOOK_TOP 1
|
||||||
#define NOTEBOOK_LEFT 2
|
#define NOTEBOOK_LEFT 2
|
||||||
@ -31,11 +34,7 @@ namespace GUI {
|
|||||||
|
|
||||||
KBShortcutsDialog::KBShortcutsDialog()
|
KBShortcutsDialog::KBShortcutsDialog()
|
||||||
: DPIDialog(NULL, wxID_ANY, wxString(SLIC3R_APP_NAME) + " - " + _L("Keyboard Shortcuts"),
|
: DPIDialog(NULL, wxID_ANY, wxString(SLIC3R_APP_NAME) + " - " + _L("Keyboard Shortcuts"),
|
||||||
#if ENABLE_SCROLLABLE
|
|
||||||
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||||
#else
|
|
||||||
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
|
|
||||||
#endif // ENABLE_SCROLLABLE
|
|
||||||
{
|
{
|
||||||
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
||||||
|
|
||||||
@ -66,13 +65,9 @@ main_sizer->Add(book, 1, wxEXPAND | wxALL, 10);
|
|||||||
fill_shortcuts();
|
fill_shortcuts();
|
||||||
for (size_t i = 0; i < m_full_shortcuts.size(); ++i)
|
for (size_t i = 0; i < m_full_shortcuts.size(); ++i)
|
||||||
{
|
{
|
||||||
#if ENABLE_SCROLLABLE
|
|
||||||
wxPanel* page = create_page(book, m_full_shortcuts[i], font, bold_font);
|
wxPanel* page = create_page(book, m_full_shortcuts[i], font, bold_font);
|
||||||
m_pages.push_back(page);
|
m_pages.push_back(page);
|
||||||
book->AddPage(page, m_full_shortcuts[i].first, i == 0);
|
book->AddPage(page, m_full_shortcuts[i].first, i == 0);
|
||||||
#else
|
|
||||||
book->AddPage(create_page(book, m_full_shortcuts[i], font, bold_font), m_full_shortcuts[i].first, i == 0);
|
|
||||||
#endif // ENABLE_SCROLLABLE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxStdDialogButtonSizer* buttons = this->CreateStdDialogButtonSizer(wxOK);
|
wxStdDialogButtonSizer* buttons = this->CreateStdDialogButtonSizer(wxOK);
|
||||||
@ -99,104 +94,112 @@ void KBShortcutsDialog::fill_shortcuts()
|
|||||||
const std::string& ctrl = GUI::shortkey_ctrl_prefix();
|
const std::string& ctrl = GUI::shortkey_ctrl_prefix();
|
||||||
const std::string& alt = GUI::shortkey_alt_prefix();
|
const std::string& alt = GUI::shortkey_alt_prefix();
|
||||||
|
|
||||||
Shortcuts commands_shortcuts = {
|
#if ENABLE_GCODE_VIEWER
|
||||||
// File
|
bool is_gcode_viewer = wxGetApp().mainframe->get_mode() == MainFrame::EMode::GCodeViewer;
|
||||||
{ ctrl + "N", L("New project, clear plater") },
|
|
||||||
{ ctrl + "O", L("Open project STL/OBJ/AMF/3MF with config, clear plater") },
|
if (!is_gcode_viewer) {
|
||||||
{ ctrl + "S", L("Save project (3mf)") },
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
{ ctrl + alt + "S", L("Save project as (3mf)") },
|
Shortcuts commands_shortcuts = {
|
||||||
{ ctrl + "R", L("(Re)slice") },
|
// File
|
||||||
// File>Import
|
{ ctrl + "N", L("New project, clear plater") },
|
||||||
{ ctrl + "I", L("Import STL/OBJ/AMF/3MF without config, keep plater") },
|
{ ctrl + "O", L("Open project STL/OBJ/AMF/3MF with config, clear plater") },
|
||||||
{ ctrl + "L", L("Import Config from ini/amf/3mf/gcode") },
|
{ ctrl + "S", L("Save project (3mf)") },
|
||||||
{ ctrl + alt + "L", L("Load Config from ini/amf/3mf/gcode and merge") },
|
{ ctrl + alt + "S", L("Save project as (3mf)") },
|
||||||
// File>Export
|
{ ctrl + "R", L("(Re)slice") },
|
||||||
{ ctrl + "G", L("Export G-code") },
|
// File>Import
|
||||||
{ ctrl + "Shift+" + "G", L("Send G-code") },
|
{ ctrl + "I", L("Import STL/OBJ/AMF/3MF without config, keep plater") },
|
||||||
{ ctrl + "E", L("Export config") },
|
{ ctrl + "L", L("Import Config from ini/amf/3mf/gcode") },
|
||||||
{ ctrl + "U", L("Export to SD card / Flash drive") },
|
{ ctrl + alt + "L", L("Load Config from ini/amf/3mf/gcode and merge") },
|
||||||
{ ctrl + "T", L("Eject SD card / Flash drive") },
|
// File>Export
|
||||||
// Edit
|
{ ctrl + "G", L("Export G-code") },
|
||||||
{ ctrl + "A", L("Select all objects") },
|
{ ctrl + "Shift+" + "G", L("Send G-code") },
|
||||||
{ "Esc", L("Deselect all") },
|
{ ctrl + "E", L("Export config") },
|
||||||
{ "Del", L("Delete selected") },
|
{ ctrl + "U", L("Export to SD card / Flash drive") },
|
||||||
{ ctrl + "Del", L("Delete all") },
|
{ ctrl + "T", L("Eject SD card / Flash drive") },
|
||||||
{ ctrl + "Z", L("Undo") },
|
// Edit
|
||||||
{ ctrl + "Y", L("Redo") },
|
{ ctrl + "A", L("Select all objects") },
|
||||||
{ ctrl + "C", L("Copy to clipboard") },
|
{ "Esc", L("Deselect all") },
|
||||||
{ ctrl + "V", L("Paste from clipboard") },
|
{ "Del", L("Delete selected") },
|
||||||
{ "F5", L("Reload plater from disk") },
|
{ ctrl + "Del", L("Delete all") },
|
||||||
{ ctrl + "F", L("Search") },
|
{ ctrl + "Z", L("Undo") },
|
||||||
// Window
|
{ ctrl + "Y", L("Redo") },
|
||||||
{ ctrl + "1", L("Select Plater Tab") },
|
{ ctrl + "C", L("Copy to clipboard") },
|
||||||
{ ctrl + "2", L("Select Print Settings Tab") },
|
{ ctrl + "V", L("Paste from clipboard") },
|
||||||
{ ctrl + "3", L("Select Filament Settings Tab") },
|
{ "F5", L("Reload plater from disk") },
|
||||||
{ ctrl + "4", L("Select Printer Settings Tab") },
|
{ ctrl + "F", L("Search") },
|
||||||
{ ctrl + "5", L("Switch to 3D") },
|
// Window
|
||||||
{ ctrl + "6", L("Switch to Preview") },
|
{ ctrl + "1", L("Select Plater Tab") },
|
||||||
{ ctrl + "J", L("Print host upload queue") },
|
{ ctrl + "2", L("Select Print Settings Tab") },
|
||||||
// View
|
{ ctrl + "3", L("Select Filament Settings Tab") },
|
||||||
{ "0-6", L("Camera view") },
|
{ ctrl + "4", L("Select Printer Settings Tab") },
|
||||||
{ "E", L("Show/Hide object/instance labels") },
|
{ ctrl + "5", L("Switch to 3D") },
|
||||||
|
{ ctrl + "6", L("Switch to Preview") },
|
||||||
|
{ ctrl + "J", L("Print host upload queue") },
|
||||||
|
// View
|
||||||
|
{ "0-6", L("Camera view") },
|
||||||
|
{ "E", L("Show/Hide object/instance labels") },
|
||||||
#if ENABLE_SLOPE_RENDERING
|
#if ENABLE_SLOPE_RENDERING
|
||||||
{ "D", L("Turn On/Off facets' slope rendering") },
|
{ "D", L("Turn On/Off facets' slope rendering") },
|
||||||
#endif // ENABLE_SLOPE_RENDERING
|
#endif // ENABLE_SLOPE_RENDERING
|
||||||
// Configuration
|
// Configuration
|
||||||
{ ctrl + "P", L("Preferences") },
|
{ ctrl + "P", L("Preferences") },
|
||||||
// Help
|
// Help
|
||||||
{ "?", L("Show keyboard shortcuts list") }
|
{ "?", L("Show keyboard shortcuts list") }
|
||||||
};
|
};
|
||||||
|
|
||||||
m_full_shortcuts.push_back(std::make_pair(_L("Commands"), commands_shortcuts));
|
m_full_shortcuts.push_back(std::make_pair(_L("Commands"), commands_shortcuts));
|
||||||
|
|
||||||
Shortcuts plater_shortcuts = {
|
Shortcuts plater_shortcuts = {
|
||||||
{ "A", L("Arrange") },
|
{ "A", L("Arrange") },
|
||||||
{ "Shift+A", L("Arrange selection") },
|
{ "Shift+A", L("Arrange selection") },
|
||||||
{ "+", L("Add Instance of the selected object") },
|
{ "+", L("Add Instance of the selected object") },
|
||||||
{ "-", L("Remove Instance of the selected object") },
|
{ "-", L("Remove Instance of the selected object") },
|
||||||
{ ctrl, L("Press to select multiple objects\nor move multiple objects with mouse") },
|
{ ctrl, L("Press to select multiple objects\nor move multiple objects with mouse") },
|
||||||
{ "Shift+", L("Press to activate selection rectangle") },
|
{ "Shift+", L("Press to activate selection rectangle") },
|
||||||
{ alt, L("Press to activate deselection rectangle") },
|
{ alt, L("Press to activate deselection rectangle") },
|
||||||
{ L("Arrow Up"), L("Move selection 10 mm in positive Y direction") },
|
{ L("Arrow Up"), L("Move selection 10 mm in positive Y direction") },
|
||||||
{ L("Arrow Down"), L("Move selection 10 mm in negative Y direction") },
|
{ L("Arrow Down"), L("Move selection 10 mm in negative Y direction") },
|
||||||
{ L("Arrow Left"), L("Move selection 10 mm in negative X direction") },
|
{ L("Arrow Left"), L("Move selection 10 mm in negative X direction") },
|
||||||
{ L("Arrow Right"), L("Move selection 10 mm in positive X direction") },
|
{ L("Arrow Right"), L("Move selection 10 mm in positive X direction") },
|
||||||
{ std::string("Shift+") + L("Any arrow"), L("Movement step set to 1 mm") },
|
{ std::string("Shift+") + L("Any arrow"), L("Movement step set to 1 mm") },
|
||||||
{ ctrl + L("Any arrow"), L("Movement in camera space") },
|
{ ctrl + L("Any arrow"), L("Movement in camera space") },
|
||||||
{ L("Page Up"), L("Rotate selection 45 degrees CCW") },
|
{ L("Page Up"), L("Rotate selection 45 degrees CCW") },
|
||||||
{ L("Page Down"), L("Rotate selection 45 degrees CW") },
|
{ L("Page Down"), L("Rotate selection 45 degrees CW") },
|
||||||
{ "M", L("Gizmo move") },
|
{ "M", L("Gizmo move") },
|
||||||
{ "S", L("Gizmo scale") },
|
{ "S", L("Gizmo scale") },
|
||||||
{ "R", L("Gizmo rotate") },
|
{ "R", L("Gizmo rotate") },
|
||||||
{ "C", L("Gizmo cut") },
|
{ "C", L("Gizmo cut") },
|
||||||
{ "F", L("Gizmo Place face on bed") },
|
{ "F", L("Gizmo Place face on bed") },
|
||||||
{ "H", L("Gizmo SLA hollow") },
|
{ "H", L("Gizmo SLA hollow") },
|
||||||
{ "L", L("Gizmo SLA support points") },
|
{ "L", L("Gizmo SLA support points") },
|
||||||
{ "Esc", L("Unselect gizmo or clear selection") },
|
{ "Esc", L("Unselect gizmo or clear selection") },
|
||||||
{ "K", L("Change camera type (perspective, orthographic)") },
|
{ "K", L("Change camera type (perspective, orthographic)") },
|
||||||
{ "B", L("Zoom to Bed") },
|
{ "B", L("Zoom to Bed") },
|
||||||
{ "Z", L("Zoom to selected object\nor all objects in scene, if none selected") },
|
{ "Z", L("Zoom to selected object\nor all objects in scene, if none selected") },
|
||||||
{ "I", L("Zoom in") },
|
{ "I", L("Zoom in") },
|
||||||
{ "O", L("Zoom out") },
|
{ "O", L("Zoom out") },
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
{ ctrl + "M", L("Show/Hide 3Dconnexion devices settings dialog") },
|
{ ctrl + "M", L("Show/Hide 3Dconnexion devices settings dialog") },
|
||||||
#endif // __linux__
|
#endif // __linux__
|
||||||
#if ENABLE_RENDER_PICKING_PASS
|
#if ENABLE_RENDER_PICKING_PASS
|
||||||
// Don't localize debugging texts.
|
// Don't localize debugging texts.
|
||||||
{ "P", "Toggle picking pass texture rendering on/off" },
|
{ "P", "Toggle picking pass texture rendering on/off" },
|
||||||
#endif // ENABLE_RENDER_PICKING_PASS
|
#endif // ENABLE_RENDER_PICKING_PASS
|
||||||
};
|
};
|
||||||
|
|
||||||
m_full_shortcuts.push_back(std::make_pair(_L("Plater"), plater_shortcuts));
|
m_full_shortcuts.push_back(std::make_pair(_L("Plater"), plater_shortcuts));
|
||||||
|
|
||||||
Shortcuts gizmos_shortcuts = {
|
Shortcuts gizmos_shortcuts = {
|
||||||
{ "Shift+", L("Press to snap by 5% in Gizmo scale\nor to snap by 1mm in Gizmo move") },
|
{ "Shift+", L("Press to snap by 5% in Gizmo scale\nor to snap by 1mm in Gizmo move") },
|
||||||
{ "F", L("Scale selection to fit print volume\nin Gizmo scale") },
|
{ "F", L("Scale selection to fit print volume\nin Gizmo scale") },
|
||||||
{ ctrl, L("Press to activate one direction scaling in Gizmo scale") },
|
{ ctrl, L("Press to activate one direction scaling in Gizmo scale") },
|
||||||
{ alt, L("Press to scale (in Gizmo scale) or rotate (in Gizmo rotate)\nselected objects around their own center") },
|
{ alt, L("Press to scale (in Gizmo scale) or rotate (in Gizmo rotate)\nselected objects around their own center") },
|
||||||
};
|
};
|
||||||
|
|
||||||
m_full_shortcuts.push_back(std::make_pair(_L("Gizmos"), gizmos_shortcuts));
|
m_full_shortcuts.push_back(std::make_pair(_L("Gizmos"), gizmos_shortcuts));
|
||||||
|
#if ENABLE_GCODE_VIEWER
|
||||||
|
}
|
||||||
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
Shortcuts preview_shortcuts = {
|
Shortcuts preview_shortcuts = {
|
||||||
{ L("Arrow Up"), L("Upper Layer") },
|
{ L("Arrow Up"), L("Upper Layer") },
|
||||||
@ -277,13 +280,9 @@ wxPanel* KBShortcutsDialog::create_page(wxWindow* parent, const std::pair<wxStri
|
|||||||
static const int max_items_per_column = 20;
|
static const int max_items_per_column = 20;
|
||||||
int columns_count = 1 + (int)shortcuts.second.size() / max_items_per_column;
|
int columns_count = 1 + (int)shortcuts.second.size() / max_items_per_column;
|
||||||
|
|
||||||
#if ENABLE_SCROLLABLE
|
|
||||||
wxScrolledWindow* page = new wxScrolledWindow(parent);
|
wxScrolledWindow* page = new wxScrolledWindow(parent);
|
||||||
page->SetScrollbars(20, 20, 50, 50);
|
page->SetScrollbars(20, 20, 50, 50);
|
||||||
page->SetInitialSize(wxSize(850, 450));
|
page->SetInitialSize(wxSize(850, 450));
|
||||||
#else
|
|
||||||
wxPanel* page = new wxPanel(parent);
|
|
||||||
#endif // ENABLE_SCROLLABLE
|
|
||||||
|
|
||||||
#if (BOOK_TYPE == LISTBOOK_TOP) || (BOOK_TYPE == LISTBOOK_LEFT)
|
#if (BOOK_TYPE == LISTBOOK_TOP) || (BOOK_TYPE == LISTBOOK_LEFT)
|
||||||
wxStaticBoxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, page, " " + shortcuts.first + " ");
|
wxStaticBoxSizer* sizer = new wxStaticBoxSizer(wxVERTICAL, page, " " + shortcuts.first + " ");
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
#include "GUI_Utils.hpp"
|
#include "GUI_Utils.hpp"
|
||||||
#include "wxExtensions.hpp"
|
#include "wxExtensions.hpp"
|
||||||
|
|
||||||
#define ENABLE_SCROLLABLE 1
|
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
@ -22,9 +20,7 @@ class KBShortcutsDialog : public DPIDialog
|
|||||||
ShortcutsVec m_full_shortcuts;
|
ShortcutsVec m_full_shortcuts;
|
||||||
ScalableBitmap m_logo_bmp;
|
ScalableBitmap m_logo_bmp;
|
||||||
wxStaticBitmap* m_header_bitmap;
|
wxStaticBitmap* m_header_bitmap;
|
||||||
#if ENABLE_SCROLLABLE
|
|
||||||
std::vector<wxPanel*> m_pages;
|
std::vector<wxPanel*> m_pages;
|
||||||
#endif // ENABLE_SCROLLABLE
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
KBShortcutsDialog();
|
KBShortcutsDialog();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user