Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
2df27d95
Commit
2df27d95
authored
Sep 02, 2007
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Image slicer spin boxes can now always be changed (within bounds), without being constrained back.
parent
1d8a9e6f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
src/gui/image_slice_window.cpp
src/gui/image_slice_window.cpp
+7
-7
src/gui/image_slice_window.hpp
src/gui/image_slice_window.hpp
+9
-2
No files found.
src/gui/image_slice_window.cpp
View file @
2df27d95
...
...
@@ -23,7 +23,7 @@ ImageSlice::ImageSlice(const Image& source, const wxSize& target_size)
,
sharpen
(
true
),
sharpen_amount
(
25
)
{}
void
ImageSlice
::
constrain
()
{
void
ImageSlice
::
constrain
(
PreferedProperty
prefer
)
{
sharpen_amount
=
min
(
100
,
max
(
0
,
sharpen_amount
));
// minimum size
selection
.
width
=
max
(
1
,
selection
.
width
);
...
...
@@ -40,7 +40,7 @@ void ImageSlice::constrain() {
// fix aspect ratio
if
(
aspect_fixed
)
{
int
diff
=
selection
.
width
*
target_size
.
GetHeight
()
-
selection
.
height
*
target_size
.
GetWidth
();
if
(
diff
>
0
)
{
if
(
(
diff
>
0
&&
prefer
!=
PREFER_WIDTH
)
||
prefer
==
PREFER_HEIGHT
)
{
// too wide
selection
.
width
-=
int
(
diff
/
target_size
.
GetHeight
());
}
else
{
...
...
@@ -217,11 +217,11 @@ void ImageSliceWindow::onChangeTop(wxCommandEvent&) {
}
void
ImageSliceWindow
::
onChangeWidth
(
wxCommandEvent
&
)
{
slice
.
selection
.
width
=
width
->
GetValue
();
onUpdateFromControl
();
onUpdateFromControl
(
PREFER_WIDTH
);
}
void
ImageSliceWindow
::
onChangeHeight
(
wxCommandEvent
&
)
{
slice
.
selection
.
height
=
height
->
GetValue
();
onUpdateFromControl
();
onUpdateFromControl
(
PREFER_HEIGHT
);
}
void
ImageSliceWindow
::
onChangeFixAspect
(
wxCommandEvent
&
)
{
...
...
@@ -239,7 +239,7 @@ void ImageSliceWindow::onChangeZoomX(wxSpinEvent&) {
onUpdateFromControl
();
}
void
ImageSliceWindow
::
onChangeZoomY
(
wxSpinEvent
&
)
{
slice
.
zoomY
(
zoom_
x
->
GetValue
()
/
100.0
);
slice
.
zoomY
(
zoom_
y
->
GetValue
()
/
100.0
);
onUpdateFromControl
();
}
...
...
@@ -261,8 +261,8 @@ void ImageSliceWindow::onSliceChange(wxCommandEvent&) {
updateControls
();
}
void
ImageSliceWindow
::
onUpdateFromControl
()
{
slice
.
constrain
();
void
ImageSliceWindow
::
onUpdateFromControl
(
PreferedProperty
prefer
)
{
slice
.
constrain
(
prefer
);
preview
->
update
();
selector
->
update
();
updateControls
();
...
...
src/gui/image_slice_window.hpp
View file @
2df27d95
...
...
@@ -19,6 +19,13 @@ DECLARE_POINTER_TYPE(AlphaMask);
// ----------------------------------------------------------------------------- : ImageSlice
/// Which option is just changed, and therefore more important?
enum
PreferedProperty
{
PREFER_NONE
,
PREFER_WIDTH
,
PREFER_HEIGHT
};
/// A slice of an image, i.e. a selected rectangle
class
ImageSlice
{
public:
...
...
@@ -35,7 +42,7 @@ class ImageSlice {
int
sharpen_amount
;
/// Enforce relations between values
void
constrain
();
void
constrain
(
PreferedProperty
prefer
=
PREFER_NONE
);
/// Get the sliced image
Image
getSlice
()
const
;
...
...
@@ -97,7 +104,7 @@ class ImageSliceWindow : public wxDialog {
// --------------------------------------------------- : Updating
// The manual controls were changed
void
onUpdateFromControl
();
void
onUpdateFromControl
(
PreferedProperty
prefer
=
PREFER_NONE
);
// Update the values in the controls
void
updateControls
();
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment