Removed Windows-style line breaks (^M) from all .cc and .h source files.
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
/*
|
||||
* This file is part of RawTherapee.
|
||||
*
|
||||
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
|
||||
*
|
||||
* RawTherapee is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* RawTherapee is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*
|
||||
* This file is part of RawTherapee.
|
||||
*
|
||||
* Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
|
||||
*
|
||||
* RawTherapee is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* RawTherapee is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <cropwindow.h>
|
||||
#include <options.h>
|
||||
#include <iomanip>
|
||||
@@ -250,37 +250,37 @@ void CropWindow::buttonPress (int button, int type, int bstate, int x, int y) {
|
||||
}
|
||||
else if (button==1 && type==GDK_BUTTON_PRESS && state==SNormal && onArea (CropImage, x, y)) {
|
||||
if (onArea (CropTop, x, y)) {
|
||||
state = SResizeH1;
|
||||
press_y = y;
|
||||
action_y = cropHandler.cropParams.y;
|
||||
state = SResizeH1;
|
||||
press_y = y;
|
||||
action_y = cropHandler.cropParams.y;
|
||||
}
|
||||
else if (onArea (CropBottom, x, y)) {
|
||||
state = SResizeH2;
|
||||
press_y = y;
|
||||
action_y = cropHandler.cropParams.h;
|
||||
state = SResizeH2;
|
||||
press_y = y;
|
||||
action_y = cropHandler.cropParams.h;
|
||||
}
|
||||
else if (onArea (CropLeft, x, y)) {
|
||||
state = SResizeW1;
|
||||
press_x = x;
|
||||
action_x = cropHandler.cropParams.x;
|
||||
state = SResizeW1;
|
||||
press_x = x;
|
||||
action_x = cropHandler.cropParams.x;
|
||||
}
|
||||
else if (onArea (CropRight, x, y)) {
|
||||
state = SResizeW2;
|
||||
press_x = x;
|
||||
action_x = cropHandler.cropParams.w;
|
||||
state = SResizeW2;
|
||||
press_x = x;
|
||||
action_x = cropHandler.cropParams.w;
|
||||
}
|
||||
else if (onArea (CropObserved, x, y)) {
|
||||
state = SObservedMove;
|
||||
press_x = x;
|
||||
press_y = y;
|
||||
}
|
||||
else if ((bstate & GDK_SHIFT_MASK) && onArea (CropInside, x, y)) {
|
||||
state = SCropMove;
|
||||
press_x = x;
|
||||
press_y = y;
|
||||
action_x = cropHandler.cropParams.x;
|
||||
action_y = cropHandler.cropParams.y;
|
||||
}
|
||||
else if ((bstate & GDK_SHIFT_MASK) && onArea (CropInside, x, y)) {
|
||||
state = SCropMove;
|
||||
press_x = x;
|
||||
press_y = y;
|
||||
action_x = cropHandler.cropParams.x;
|
||||
action_y = cropHandler.cropParams.y;
|
||||
}
|
||||
else if (iarea->getToolMode () == TMHand) {
|
||||
state = SCropImgMove;
|
||||
action_x = 0;
|
||||
@@ -289,25 +289,25 @@ void CropWindow::buttonPress (int button, int type, int bstate, int x, int y) {
|
||||
press_y = y;
|
||||
}
|
||||
else if (iarea->getToolMode () == TMStraighten) {
|
||||
state = SRotateSelecting;
|
||||
press_x = x;
|
||||
press_y = y;
|
||||
action_x = x;
|
||||
state = SRotateSelecting;
|
||||
press_x = x;
|
||||
press_y = y;
|
||||
action_x = x;
|
||||
action_y = y;
|
||||
rot_deg = 0;
|
||||
rot_deg = 0;
|
||||
}
|
||||
else if (iarea->getToolMode () == TMSpotWB) {
|
||||
translateCoord (x, y, action_x, action_y);
|
||||
iarea->spotWBSelected (action_x, action_y);
|
||||
}
|
||||
else if (iarea->getToolMode () == TMCropSelect && cropgl) {
|
||||
state = SCropSelecting;
|
||||
else if (iarea->getToolMode () == TMCropSelect && cropgl) {
|
||||
state = SCropSelecting;
|
||||
translateCoord (x, y, press_x, press_y);
|
||||
cropHandler.cropParams.x = press_x;
|
||||
cropHandler.cropParams.y = press_y;
|
||||
cropHandler.cropParams.w = cropHandler.cropParams.h = 1;
|
||||
cropgl->cropInit (cropHandler.cropParams.x, cropHandler.cropParams.y, cropHandler.cropParams.w, cropHandler.cropParams.h);
|
||||
}
|
||||
cropHandler.cropParams.w = cropHandler.cropParams.h = 1;
|
||||
cropgl->cropInit (cropHandler.cropParams.x, cropHandler.cropParams.y, cropHandler.cropParams.w, cropHandler.cropParams.h);
|
||||
}
|
||||
}
|
||||
if (button==3) {
|
||||
state = SNormal;
|
||||
@@ -342,8 +342,8 @@ void CropWindow::buttonRelease (int button, int num, int bstate, int x, int y) {
|
||||
observedCropWin->remoteMoveReady ();
|
||||
state = SNormal;
|
||||
}
|
||||
if (cropgl && (state==SCropSelecting || state==SResizeH1 || state==SResizeH2 || state==SResizeW1 || state==SResizeW2 || state==SCropMove)) {
|
||||
cropgl->cropManipReady ();
|
||||
if (cropgl && (state==SCropSelecting || state==SResizeH1 || state==SResizeH2 || state==SResizeW1 || state==SResizeW2 || state==SCropMove)) {
|
||||
cropgl->cropManipReady ();
|
||||
iarea->setToolHand ();
|
||||
}
|
||||
|
||||
@@ -388,40 +388,40 @@ void CropWindow::pointerMoved (int x, int y) {
|
||||
iarea->redraw ();
|
||||
}
|
||||
else if (state==SResizeH1 && cropgl) {
|
||||
int oy = cropHandler.cropParams.y;
|
||||
int oy = cropHandler.cropParams.y;
|
||||
cropHandler.cropParams.y = action_y + (y-press_y) / zoomSteps[cropZoom].zoom;
|
||||
cropHandler.cropParams.h += oy - cropHandler.cropParams.y;
|
||||
cropgl->cropHeight1Resized (cropHandler.cropParams.x, cropHandler.cropParams.y, cropHandler.cropParams.w, cropHandler.cropParams.h);
|
||||
cropHandler.cropParams.h += oy - cropHandler.cropParams.y;
|
||||
cropgl->cropHeight1Resized (cropHandler.cropParams.x, cropHandler.cropParams.y, cropHandler.cropParams.w, cropHandler.cropParams.h);
|
||||
iarea->redraw ();
|
||||
}
|
||||
}
|
||||
else if (state==SResizeH2 && cropgl) {
|
||||
cropHandler.cropParams.h = action_y + (y-press_y) / zoomSteps[cropZoom].zoom;
|
||||
cropgl->cropHeight2Resized (cropHandler.cropParams.x, cropHandler.cropParams.y, cropHandler.cropParams.w, cropHandler.cropParams.h);
|
||||
cropgl->cropHeight2Resized (cropHandler.cropParams.x, cropHandler.cropParams.y, cropHandler.cropParams.w, cropHandler.cropParams.h);
|
||||
iarea->redraw ();
|
||||
}
|
||||
}
|
||||
else if (state==SResizeW1 && cropgl) {
|
||||
int ox = cropHandler.cropParams.x;
|
||||
int ox = cropHandler.cropParams.x;
|
||||
cropHandler.cropParams.x = action_x + (x-press_x) / zoomSteps[cropZoom].zoom;
|
||||
cropHandler.cropParams.w += ox - cropHandler.cropParams.x;
|
||||
cropgl->cropWidth1Resized (cropHandler.cropParams.x, cropHandler.cropParams.y, cropHandler.cropParams.w, cropHandler.cropParams.h);
|
||||
cropHandler.cropParams.w += ox - cropHandler.cropParams.x;
|
||||
cropgl->cropWidth1Resized (cropHandler.cropParams.x, cropHandler.cropParams.y, cropHandler.cropParams.w, cropHandler.cropParams.h);
|
||||
iarea->redraw ();
|
||||
}
|
||||
}
|
||||
else if (state==SResizeW2 && cropgl) {
|
||||
cropHandler.cropParams.w = action_x + (x-press_x) / zoomSteps[cropZoom].zoom;
|
||||
cropgl->cropWidth2Resized (cropHandler.cropParams.x, cropHandler.cropParams.y, cropHandler.cropParams.w, cropHandler.cropParams.h);
|
||||
cropgl->cropWidth2Resized (cropHandler.cropParams.x, cropHandler.cropParams.y, cropHandler.cropParams.w, cropHandler.cropParams.h);
|
||||
iarea->redraw ();
|
||||
}
|
||||
else if (state==SCropMove && cropgl) {
|
||||
cropHandler.cropParams.x = action_x + (x-press_x) / zoomSteps[cropZoom].zoom;
|
||||
cropHandler.cropParams.y = action_y + (y-press_y) / zoomSteps[cropZoom].zoom;
|
||||
cropgl->cropMoved (cropHandler.cropParams.x, cropHandler.cropParams.y, cropHandler.cropParams.w, cropHandler.cropParams.h);
|
||||
iarea->redraw ();
|
||||
}
|
||||
else if (state==SCropMove && cropgl) {
|
||||
cropHandler.cropParams.x = action_x + (x-press_x) / zoomSteps[cropZoom].zoom;
|
||||
cropHandler.cropParams.y = action_y + (y-press_y) / zoomSteps[cropZoom].zoom;
|
||||
cropgl->cropMoved (cropHandler.cropParams.x, cropHandler.cropParams.y, cropHandler.cropParams.w, cropHandler.cropParams.h);
|
||||
iarea->redraw ();
|
||||
}
|
||||
else if (state==SCropSelecting && cropgl) {
|
||||
translateCoord (x, y, action_x, action_y);
|
||||
int cx1 = press_x, cy1 = press_y;
|
||||
int cx2 = action_x, cy2 = action_y;
|
||||
cropgl->cropResized (cx1, cy1, cx2, cy2);
|
||||
cropgl->cropResized (cx1, cy1, cx2, cy2);
|
||||
if (cx2 > cx1) {
|
||||
cropHandler.cropParams.x = cx1;
|
||||
cropHandler.cropParams.w = cx2 - cx1 + 1;
|
||||
@@ -438,12 +438,12 @@ void CropWindow::pointerMoved (int x, int y) {
|
||||
cropHandler.cropParams.y = cy2;
|
||||
cropHandler.cropParams.h = cy1 - cy2 + 1;
|
||||
}
|
||||
iarea->redraw ();
|
||||
iarea->redraw ();
|
||||
}
|
||||
else if (state==SObservedMove) {
|
||||
observedCropWin->remoteMove ((x - press_x)/zoomSteps[cropZoom].zoom, (y - press_y)/zoomSteps[cropZoom].zoom);
|
||||
iarea->redraw ();
|
||||
}
|
||||
}
|
||||
updateCursor (x, y);
|
||||
|
||||
bool oRA = onArea (CropResize, x, y);
|
||||
@@ -852,66 +852,66 @@ void CropWindow::drawDecoration (Cairo::RefPtr<Cairo::Context> cr) {
|
||||
|
||||
void CropWindow::drawStraightenGuide (Cairo::RefPtr<Cairo::Context> cr) {
|
||||
|
||||
if (action_x!=press_x || action_y!=press_y) {
|
||||
double arg = (press_x-action_x) / sqrt(double((press_x-action_x)*(press_x-action_x)+(press_y-action_y)*(press_y-action_y)));
|
||||
double sol1, sol2;
|
||||
double pi = M_PI;
|
||||
if (press_y>action_y) {
|
||||
sol1 = acos(arg)*180/pi;
|
||||
sol2 = -acos(-arg)*180/pi;
|
||||
}
|
||||
else {
|
||||
sol1 = acos(-arg)*180/pi;
|
||||
sol2 = -acos(arg)*180/pi;
|
||||
}
|
||||
if (fabs(sol1)<fabs(sol2))
|
||||
rot_deg = sol1;
|
||||
else
|
||||
rot_deg = sol2;
|
||||
|
||||
if (rot_deg<-45)
|
||||
rot_deg = 90.0 + rot_deg;
|
||||
else if (rot_deg>45)
|
||||
rot_deg = - 90.0 + rot_deg;
|
||||
}
|
||||
else
|
||||
rot_deg = 0;
|
||||
|
||||
Glib::RefPtr<Pango::Context> context = iarea->get_pango_context () ;
|
||||
Pango::FontDescription fontd = context->get_font_description ();
|
||||
fontd.set_weight (Pango::WEIGHT_BOLD);
|
||||
fontd.set_size (8*Pango::SCALE);
|
||||
context->set_font_description (fontd);
|
||||
Glib::RefPtr<Pango::Layout> deglayout = iarea->create_pango_layout(Glib::ustring::compose ("%1 deg", Glib::ustring::format(std::setprecision(2), rot_deg)));
|
||||
if (action_x!=press_x || action_y!=press_y) {
|
||||
double arg = (press_x-action_x) / sqrt(double((press_x-action_x)*(press_x-action_x)+(press_y-action_y)*(press_y-action_y)));
|
||||
double sol1, sol2;
|
||||
double pi = M_PI;
|
||||
if (press_y>action_y) {
|
||||
sol1 = acos(arg)*180/pi;
|
||||
sol2 = -acos(-arg)*180/pi;
|
||||
}
|
||||
else {
|
||||
sol1 = acos(-arg)*180/pi;
|
||||
sol2 = -acos(arg)*180/pi;
|
||||
}
|
||||
if (fabs(sol1)<fabs(sol2))
|
||||
rot_deg = sol1;
|
||||
else
|
||||
rot_deg = sol2;
|
||||
|
||||
int x1 = press_x;
|
||||
int y1 = press_y;
|
||||
int y2 = action_y;
|
||||
int x2 = action_x;
|
||||
/* if (x1<0) x1 = 0;
|
||||
if (y1<0) y1 = 0;
|
||||
if (x2<0) x2 = 0;
|
||||
if (y2<0) y2 = 0;
|
||||
if (x2>=image->getWidth()) x2 = image->getWidth()-1;
|
||||
if (y2>=image->getHeight()) y2 = image->getHeight()-1;
|
||||
if (x1>=image->getWidth()) x1 = image->getWidth()-1;
|
||||
if (y1>=image->getHeight()) y1 = image->getHeight()-1;
|
||||
*/
|
||||
if (rot_deg<-45)
|
||||
rot_deg = 90.0 + rot_deg;
|
||||
else if (rot_deg>45)
|
||||
rot_deg = - 90.0 + rot_deg;
|
||||
}
|
||||
else
|
||||
rot_deg = 0;
|
||||
|
||||
cr->set_line_width (1.5);
|
||||
cr->set_source_rgb (1.0, 1.0, 1.0);
|
||||
cr->move_to (x1, y1);
|
||||
cr->line_to (x2, y2);
|
||||
cr->stroke ();
|
||||
cr->set_source_rgb (0.0, 0.0, 0.0);
|
||||
std::valarray<double> ds (1);
|
||||
ds[0] = 4;
|
||||
cr->set_dash (ds, 0);
|
||||
cr->move_to (x1, y1);
|
||||
cr->line_to (x2, y2);
|
||||
cr->stroke ();
|
||||
|
||||
if (press_x!=action_x && press_y!=action_y) {
|
||||
Glib::RefPtr<Pango::Context> context = iarea->get_pango_context () ;
|
||||
Pango::FontDescription fontd = context->get_font_description ();
|
||||
fontd.set_weight (Pango::WEIGHT_BOLD);
|
||||
fontd.set_size (8*Pango::SCALE);
|
||||
context->set_font_description (fontd);
|
||||
Glib::RefPtr<Pango::Layout> deglayout = iarea->create_pango_layout(Glib::ustring::compose ("%1 deg", Glib::ustring::format(std::setprecision(2), rot_deg)));
|
||||
|
||||
int x1 = press_x;
|
||||
int y1 = press_y;
|
||||
int y2 = action_y;
|
||||
int x2 = action_x;
|
||||
/* if (x1<0) x1 = 0;
|
||||
if (y1<0) y1 = 0;
|
||||
if (x2<0) x2 = 0;
|
||||
if (y2<0) y2 = 0;
|
||||
if (x2>=image->getWidth()) x2 = image->getWidth()-1;
|
||||
if (y2>=image->getHeight()) y2 = image->getHeight()-1;
|
||||
if (x1>=image->getWidth()) x1 = image->getWidth()-1;
|
||||
if (y1>=image->getHeight()) y1 = image->getHeight()-1;
|
||||
*/
|
||||
|
||||
cr->set_line_width (1.5);
|
||||
cr->set_source_rgb (1.0, 1.0, 1.0);
|
||||
cr->move_to (x1, y1);
|
||||
cr->line_to (x2, y2);
|
||||
cr->stroke ();
|
||||
cr->set_source_rgb (0.0, 0.0, 0.0);
|
||||
std::valarray<double> ds (1);
|
||||
ds[0] = 4;
|
||||
cr->set_dash (ds, 0);
|
||||
cr->move_to (x1, y1);
|
||||
cr->line_to (x2, y2);
|
||||
cr->stroke ();
|
||||
|
||||
if (press_x!=action_x && press_y!=action_y) {
|
||||
cr->set_source_rgb (0.0, 0.0, 0.0);
|
||||
cr->move_to ((x1+x2)/2+1, (y1+y2)/2+1);
|
||||
deglayout->add_to_cairo_context (cr);
|
||||
@@ -926,16 +926,16 @@ void CropWindow::drawStraightenGuide (Cairo::RefPtr<Cairo::Context> cr) {
|
||||
cr->move_to ((x1+x2)/2, (y1+y2)/2);
|
||||
deglayout->add_to_cairo_context (cr);
|
||||
cr->fill ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CropWindow::drawSpotWBRectangle (Cairo::RefPtr<Cairo::Context> cr) {
|
||||
|
||||
int rectsize = iarea->getSpotWBRectSize ();
|
||||
int x1 = action_x/zoomSteps[cropZoom].zoom - rectsize;
|
||||
int y1 = action_y/zoomSteps[cropZoom].zoom - rectsize;
|
||||
int y2 = action_y/zoomSteps[cropZoom].zoom + rectsize;
|
||||
int x2 = action_x/zoomSteps[cropZoom].zoom + rectsize;
|
||||
int x1 = action_x/zoomSteps[cropZoom].zoom - rectsize;
|
||||
int y1 = action_y/zoomSteps[cropZoom].zoom - rectsize;
|
||||
int y2 = action_y/zoomSteps[cropZoom].zoom + rectsize;
|
||||
int x2 = action_x/zoomSteps[cropZoom].zoom + rectsize;
|
||||
|
||||
cr->set_line_width (1.0);
|
||||
cr->rectangle (xpos+imgX-0.5, ypos+imgY-0.5, imgW, imgH);
|
||||
|
Reference in New Issue
Block a user