mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
ui: add button for slice selection centering
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
|
||||||
project(magicseteditor VERSION 2.1.2)
|
project(magicseteditor VERSION 2.1.3)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||||
|
|||||||
@@ -517,6 +517,7 @@ label:
|
|||||||
selection top: &Top
|
selection top: &Top
|
||||||
selection width: &Width
|
selection width: &Width
|
||||||
selection height: &Height
|
selection height: &Height
|
||||||
|
selection center: Recenter
|
||||||
#zoom: Zoom
|
#zoom: Zoom
|
||||||
fix aspect ratio: Fix aspect ratio (width/height)
|
fix aspect ratio: Fix aspect ratio (width/height)
|
||||||
zoom amount: Zoom
|
zoom amount: Zoom
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ ImageSliceWindow::ImageSliceWindow(Window* parent, const Image& source, const wx
|
|||||||
s5->Add(size, 0, wxEXPAND | wxALL, 4);
|
s5->Add(size, 0, wxEXPAND | wxALL, 4);
|
||||||
s5->AddStretchSpacer(1);
|
s5->AddStretchSpacer(1);
|
||||||
wxSizer* s6 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("selection"));
|
wxSizer* s6 = new wxStaticBoxSizer(wxVERTICAL, this, _LABEL_("selection"));
|
||||||
wxSizer* s7 = new wxFlexGridSizer(0, 2, 4, 5);
|
wxSizer* s7 = new wxFlexGridSizer(0, 2, 5, 5);
|
||||||
s7->Add(new wxStaticText(this, wxID_ANY, _LABEL_("selection left")), 0, wxALIGN_CENTER_VERTICAL);
|
s7->Add(new wxStaticText(this, wxID_ANY, _LABEL_("selection left")), 0, wxALIGN_CENTER_VERTICAL);
|
||||||
s7->Add(left, 0, wxEXPAND);
|
s7->Add(left, 0, wxEXPAND);
|
||||||
s7->Add(new wxStaticText(this, wxID_ANY, _LABEL_("selection top")), 0, wxALIGN_CENTER_VERTICAL);
|
s7->Add(new wxStaticText(this, wxID_ANY, _LABEL_("selection top")), 0, wxALIGN_CENTER_VERTICAL);
|
||||||
@@ -156,6 +156,7 @@ ImageSliceWindow::ImageSliceWindow(Window* parent, const Image& source, const wx
|
|||||||
s7->Add(width, 0, wxEXPAND);
|
s7->Add(width, 0, wxEXPAND);
|
||||||
s7->Add(new wxStaticText(this, wxID_ANY, _LABEL_("selection height")), 0, wxALIGN_CENTER_VERTICAL);
|
s7->Add(new wxStaticText(this, wxID_ANY, _LABEL_("selection height")), 0, wxALIGN_CENTER_VERTICAL);
|
||||||
s7->Add(height, 0, wxEXPAND);
|
s7->Add(height, 0, wxEXPAND);
|
||||||
|
s7->Add(new wxButton(this, ID_SELECTION_CENTER, _LABEL_("selection center")), 0, wxALIGN_CENTER, 2);
|
||||||
s6->Add(s7, 1, wxEXPAND | wxALL, 4);
|
s6->Add(s7, 1, wxEXPAND | wxALL, 4);
|
||||||
s5->Add(s6, 0, wxEXPAND | wxALL, 4);
|
s5->Add(s6, 0, wxEXPAND | wxALL, 4);
|
||||||
s5->AddStretchSpacer(1);
|
s5->AddStretchSpacer(1);
|
||||||
@@ -297,6 +298,13 @@ void ImageSliceWindow::onUpdateFromControl(PreferedProperty prefer) {
|
|||||||
updateControls();
|
updateControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ImageSliceWindow::onSelectionCenter(wxCommandEvent&) {
|
||||||
|
slice.centerSelection();
|
||||||
|
preview->update();
|
||||||
|
selector->update();
|
||||||
|
updateControls();
|
||||||
|
}
|
||||||
|
|
||||||
void ImageSliceWindow::updateControls() {
|
void ImageSliceWindow::updateControls() {
|
||||||
if (slice.selection.width == slice.target_size.GetWidth() && slice.selection.height == slice.target_size.GetHeight()) {
|
if (slice.selection.width == slice.target_size.GetWidth() && slice.selection.height == slice.target_size.GetHeight()) {
|
||||||
size->SetSelection(0); // original size
|
size->SetSelection(0); // original size
|
||||||
@@ -347,6 +355,7 @@ BEGIN_EVENT_TABLE(ImageSliceWindow, wxDialog)
|
|||||||
EVT_TEXT (ID_TOP, ImageSliceWindow::onChangeTop)
|
EVT_TEXT (ID_TOP, ImageSliceWindow::onChangeTop)
|
||||||
EVT_TEXT (ID_WIDTH, ImageSliceWindow::onChangeWidth)
|
EVT_TEXT (ID_WIDTH, ImageSliceWindow::onChangeWidth)
|
||||||
EVT_TEXT (ID_HEIGHT, ImageSliceWindow::onChangeHeight)
|
EVT_TEXT (ID_HEIGHT, ImageSliceWindow::onChangeHeight)
|
||||||
|
EVT_BUTTON (ID_SELECTION_CENTER, ImageSliceWindow::onSelectionCenter)
|
||||||
EVT_CHECKBOX (ID_FIX_ASPECT, ImageSliceWindow::onChangeFixAspect)
|
EVT_CHECKBOX (ID_FIX_ASPECT, ImageSliceWindow::onChangeFixAspect)
|
||||||
EVT_SPINCTRL (ID_ZOOM, ImageSliceWindow::onChangeZoom)
|
EVT_SPINCTRL (ID_ZOOM, ImageSliceWindow::onChangeZoom)
|
||||||
EVT_SPINCTRL (ID_ZOOM_X, ImageSliceWindow::onChangeZoomX)
|
EVT_SPINCTRL (ID_ZOOM_X, ImageSliceWindow::onChangeZoomX)
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ private:
|
|||||||
void onChangeTop (wxCommandEvent&);
|
void onChangeTop (wxCommandEvent&);
|
||||||
void onChangeWidth (wxCommandEvent&);
|
void onChangeWidth (wxCommandEvent&);
|
||||||
void onChangeHeight (wxCommandEvent&);
|
void onChangeHeight (wxCommandEvent&);
|
||||||
|
void onSelectionCenter(wxCommandEvent&);
|
||||||
void onChangeFixAspect (wxCommandEvent&);
|
void onChangeFixAspect (wxCommandEvent&);
|
||||||
void onChangeZoom (wxSpinEvent&);
|
void onChangeZoom (wxSpinEvent&);
|
||||||
void onChangeZoomX (wxSpinEvent&);
|
void onChangeZoomX (wxSpinEvent&);
|
||||||
|
|||||||
@@ -267,6 +267,7 @@ enum ControlID {
|
|||||||
ID_TOP,
|
ID_TOP,
|
||||||
ID_WIDTH,
|
ID_WIDTH,
|
||||||
ID_HEIGHT,
|
ID_HEIGHT,
|
||||||
|
ID_SELECTION_CENTER,
|
||||||
ID_FIX_ASPECT,
|
ID_FIX_ASPECT,
|
||||||
ID_ZOOM,
|
ID_ZOOM,
|
||||||
ID_ZOOM_X,
|
ID_ZOOM_X,
|
||||||
|
|||||||
Reference in New Issue
Block a user