Skip to content

Commit

Permalink
Remove dead ipic.su mentioned in #362; ImageEditor: make sizing handl…
Browse files Browse the repository at this point in the history
…es respect DPI scale, closes #370

Fix compilation warning in MainDlg
  • Loading branch information
zenden2k committed Apr 10, 2024
1 parent 9f197d8 commit b0e1d9b
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
Binary file removed Data/Favicons/ipic.su.ico
Binary file not shown.
6 changes: 0 additions & 6 deletions Data/servers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,6 @@
</Actions>
<Result DownloadUrlTemplate="http://sendfile.su/$(FileId)"/>
</Server>
<Server Name="ipic.su">
<Actions>
<Action Type="upload" Url="http://ipic.su/api/index.php" PostParams="link=/;action=loadimg;origin=checked;quality=100;client=KISS075;tnsize=$(ThumbWidth);showall=1;image=%filename%" RegExp="(.+?)\r\n(.+?)\r\n(.+)" AssignVars="Line0:0;Line1:1;Line2:2;"/>
</Actions>
<Result ImageUrlTemplate="http://ipic.su$(Line2)/fs/$(Line0)" ThumbUrlTemplate="http://ipic.su$(Line2)/tn/$(Line0)"/>
</Server>
<Server Name="flickr.com" NeedPassword="0" Authorize="2" Debug="0" Type="image" Plugin="flickr" SupportsFolders="1">
<Actions>
</Actions>
Expand Down
2 changes: 1 addition & 1 deletion Source/Gui/Dialogs/MainDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam
UpdateStatusLabel();

ACCEL accels[] = {
{ FCONTROL | FSHIFT | FVIRTKEY, VkKeyScan('c'), MENUITEM_COPYFILEPATH},
{ FCONTROL | FSHIFT | FVIRTKEY, static_cast<WORD>(VkKeyScan('c')), MENUITEM_COPYFILEPATH},
{ FALT | FVIRTKEY, VK_RETURN, MENUITEM_PROPERTIES},
};

Expand Down
2 changes: 1 addition & 1 deletion Source/ImageEditor/DrawingTools/MoveAndResizeTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ MovableElement::Grip MoveAndResizeTool::checkElementsBoundaries( int x, int y, M
MovableElement::Grip MoveAndResizeTool::checkElementBoundaries(MovableElement* element, int x, int y)
{
for (size_t i = 0; i < element->grips_.size(); i++) {
if ( abs (x - element->grips_[i].pt.x) <= MovableElement::kGripSize+2 && abs (y - element->grips_[i].pt.y) <= MovableElement::kGripSize+2 ) {
if ( abs (x - element->grips_[i].pt.x) <= element->gripWidth_ + 2 && abs (y - element->grips_[i].pt.y) <= element->gripHeight_ + 2 ) {
return element->grips_[i];
}
}
Expand Down
16 changes: 10 additions & 6 deletions Source/ImageEditor/MovableElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ MovableElement::MovableElement(Canvas* canvas){
color_ = Gdiplus::Color( 0, 0, 0 );
penSize_ = 1;
isSelected_ = false;

auto [dpiX, dpiY] = canvas->getDpi();
gripWidth_ = dpiX * kGripSize;
gripHeight_ = dpiY * kGripSize;
grips_.resize(8);
canvas_ = canvas;
isMoving_ = false;
Expand Down Expand Up @@ -71,8 +73,10 @@ void MovableElement::renderGrips(Painter* gr)
}

if ( (isSelected_ || getType() == ElementType::etCrop) && isResizable() ) {
int rectSize = kGripSize;
int halfSize = rectSize /2 ;
int rectSizeX = gripWidth_;
int rectSizeY = gripHeight_;
int halfSizeX = rectSizeX /2 ;
int halfSizeY = rectSizeY / 2;
Gdiplus::Pen pen2( Color( 255,255, 255) );
//pen.SetDashStyle(DashStyleDash);
/*int x = getX();
Expand All @@ -87,8 +91,8 @@ void MovableElement::renderGrips(Painter* gr)
for (size_t i = 0; i < grips_.size(); i++) {
int x = grips_[i].pt.x;
int y = grips_[i].pt.y;
gr->FillRectangle( &brush, x-halfSize, y-halfSize, rectSize, rectSize );
gr->DrawRectangle( &pen2, x-halfSize-1, y-halfSize-1, rectSize+1, rectSize+1 );
gr->FillRectangle( &brush, x-halfSizeX, y-halfSizeY, rectSizeX, rectSizeY );
gr->DrawRectangle( &pen2, x-halfSizeX-1, y-halfSizeY-1, rectSizeX+1, rectSizeY+1 );
}

}
Expand Down Expand Up @@ -146,7 +150,7 @@ int MovableElement::getY()

RECT MovableElement::getPaintBoundingRect()
{
int radius = (std::max<int>)(penSize_, kGripSize);
int radius = (std::max<int>)(penSize_, gripWidth_);
if ( canvas_->hasBlurRectangles() ) {
radius += static_cast<int>(canvas_->getBlurRadius());
}
Expand Down
8 changes: 5 additions & 3 deletions Source/ImageEditor/MovableElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ class AffectedSegments;

class MovableElement: public DrawingElement {
public:

enum { kGripSize = 6 ,kSelectRadius = 5};

// This is sizing handle dimension when DPI scale is 100%
enum { kGripSize = 6, kSelectRadius = 5};

enum class GripPointType {gptNone, gptStartPoint, gptEndPoint};

Expand Down Expand Up @@ -61,6 +62,7 @@ class MovableElement: public DrawingElement {
bool drawDashedRectangle_;
bool drawDashedRectangleWhenSelected_;
std::vector<Grip> grips_;
int gripWidth_, gripHeight_;

POINT* getMaxPoint(Axis axis);
POINT* getMinPoint(Axis axis);
Expand All @@ -72,4 +74,4 @@ class MovableElement: public DrawingElement {

}

#endif
#endif

0 comments on commit b0e1d9b

Please sign in to comment.