Second batch of correction to lower the number of GCC warnings

This commit is contained in:
Hombre 2010-08-30 01:07:43 +02:00
parent 02dac0425d
commit 76285ea74d
20 changed files with 288 additions and 282 deletions

View File

@ -106,8 +106,8 @@ void RawImageSource::CA_correct_RT() {
#define PIX_SORT(a,b) { if ((a)>(b)) {temp=(a);(a)=(b);(b)=temp;} }
#define SQR(x) ((x)*(x))
//static const float pre_mul[3] = {MIN(ri->red_multiplier,ri->green_multiplier), ri->green_multiplier, \
MIN(ri->blue_multiplier,ri->green_multiplier)};
/*static const float pre_mul[3] = {MIN(ri->red_multiplier,ri->green_multiplier), ri->green_multiplier, \
MIN(ri->blue_multiplier,ri->green_multiplier)};*/
static const float clip_pt = ri->defgain;

View File

@ -793,15 +793,15 @@ void RawImageSource::amaze_demosaic_RT() {
rbvarp = epssq + (gausseven[0]*(Dgrbpsq1[indx-v1]+Dgrbpsq1[indx-1]+Dgrbpsq1[indx+1]+Dgrbpsq1[indx+v1]) + \
gausseven[1]*(Dgrbpsq1[indx-v2-1]+Dgrbpsq1[indx-v2+1]+Dgrbpsq1[indx-2-v1]+Dgrbpsq1[indx+2-v1]+ \
Dgrbpsq1[indx-2+v1]+Dgrbpsq1[indx+2+v1]+Dgrbpsq1[indx+v2-1]+Dgrbpsq1[indx+v2+1]));
//rbvarp -= SQR( (gausseven[0]*(Dgrbp1[indx-v1]+Dgrbp1[indx-1]+Dgrbp1[indx+1]+Dgrbp1[indx+v1]) + \
gausseven[1]*(Dgrbp1[indx-v2-1]+Dgrbp1[indx-v2+1]+Dgrbp1[indx-2-v1]+Dgrbp1[indx+2-v1]+ \
Dgrbp1[indx-2+v1]+Dgrbp1[indx+2+v1]+Dgrbp1[indx+v2-1]+Dgrbp1[indx+v2+1])));
/*rbvarp -= SQR( (gausseven[0]*(Dgrbp1[indx-v1]+Dgrbp1[indx-1]+Dgrbp1[indx+1]+Dgrbp1[indx+v1]) + \
gausseven[1]*(Dgrbp1[indx-v2-1]+Dgrbp1[indx-v2+1]+Dgrbp1[indx-2-v1]+Dgrbp1[indx+2-v1]+ \
Dgrbp1[indx-2+v1]+Dgrbp1[indx+2+v1]+Dgrbp1[indx+v2-1]+Dgrbp1[indx+v2+1])));*/
rbvarm = epssq + (gausseven[0]*(Dgrbmsq1[indx-v1]+Dgrbmsq1[indx-1]+Dgrbmsq1[indx+1]+Dgrbmsq1[indx+v1]) + \
gausseven[1]*(Dgrbmsq1[indx-v2-1]+Dgrbmsq1[indx-v2+1]+Dgrbmsq1[indx-2-v1]+Dgrbmsq1[indx+2-v1]+ \
Dgrbmsq1[indx-2+v1]+Dgrbmsq1[indx+2+v1]+Dgrbmsq1[indx+v2-1]+Dgrbmsq1[indx+v2+1]));
//rbvarm -= SQR( (gausseven[0]*(Dgrbm1[indx-v1]+Dgrbm1[indx-1]+Dgrbm1[indx+1]+Dgrbm1[indx+v1]) + \
gausseven[1]*(Dgrbm1[indx-v2-1]+Dgrbm1[indx-v2+1]+Dgrbm1[indx-2-v1]+Dgrbm1[indx+2-v1]+ \
Dgrbm1[indx-2+v1]+Dgrbm1[indx+2+v1]+Dgrbm1[indx+v2-1]+Dgrbm1[indx+v2+1])));
/*rbvarm -= SQR( (gausseven[0]*(Dgrbm1[indx-v1]+Dgrbm1[indx-1]+Dgrbm1[indx+1]+Dgrbm1[indx+v1]) + \
gausseven[1]*(Dgrbm1[indx-v2-1]+Dgrbm1[indx-v2+1]+Dgrbm1[indx-2-v1]+Dgrbm1[indx+2-v1]+ \
Dgrbm1[indx-2+v1]+Dgrbm1[indx+2+v1]+Dgrbm1[indx+v2-1]+Dgrbm1[indx+v2+1])));*/

View File

@ -751,6 +751,7 @@ bool Thumbnail::readImage (const Glib::ustring& fname) {
}
return true;
}
return false;
}
bool Thumbnail::readData (const Glib::ustring& fname) {

View File

@ -222,42 +222,42 @@ FAPictureModeInterpreter faPictureModeInterpreter;
const TagAttrib fujiAttribs[] = {
0, 1, 0, 0, 0x0000, "Version", &stdInterpreter,
0, 1, 0, 0, 0x0010, "InternalSerialNumber", &stdInterpreter,
0, 1, 0, 0, 0x1000, "Quality", &stdInterpreter,
0, 1, 0, 0, 0x1001, "Sharpness", &faSharpnessInterpreter,
0, 1, 0, 0, 0x1002, "WhiteBalance", &faWhiteBalanceInterpreter,
0, 1, 0, 0, 0x1003, "Saturation", &faSaturationInterpreter,
0, 1, 0, 0, 0x1004, "Contrast", &faContrastInterpreter,
0, 1, 0, 0, 0x1005, "ColorTemperature", &stdInterpreter,
0, 1, 0, 0, 0x1006, "Contrast2", &faContrast2Interpreter,
0, 1, 0, 0, 0x100a, "WhiteBalanceFineTune", &stdInterpreter,
0, 1, 0, 0, 0x100b, "NoiseReduction", &faNoiseReductionInterpreter,
0, 1, 0, 0, 0x100b, "FujiFlashMode", &faFlashInterpreter,
0, 1, 0, 0, 0x1011, "FlashExposureComp", &stdInterpreter,
0, 1, 0, 0, 0x1020, "Macro", &faOnOffInterpreter,
0, 1, 0, 0, 0x1021, "FocusMode", &faFocusModeInterpreter,
0, 1, 0, 0, 0x1023, "FocusPixel", &stdInterpreter,
0, 1, 0, 0, 0x1030, "SlowSync", &faOnOffInterpreter,
0, 1, 0, 0, 0x1031, "PictureMode", &faPictureModeInterpreter,
0, 1, 0, 0, 0x1100, "AutoBracketing", &faOnOffInterpreter,
0, 1, 0, 0, 0x1101, "SequenceNumber", &stdInterpreter,
0, 1, 0, 0, 0x1210, "ColorMode", &faColorModeInterpreter,
0, 1, 0, 0, 0x1300, "BlurWarning", &faOnOffInterpreter,
0, 1, 0, 0, 0x1301, "FocusWarning", &faOnOffInterpreter,
0, 1, 0, 0, 0x1302, "ExposureWarning", &faOnOffInterpreter,
0, 1, 0, 0, 0x1400, "DynamicRange", &faDynamicRangeInterpreter,
0, 1, 0, 0, 0x1401, "FilmMode", &faFilmModeInterpreter,
0, 1, 0, 0, 0x1402, "DynamicRangeSetting", &faDRSettingInterpreter,
0, 1, 0, 0, 0x1403, "DevelopmentDynamicRange", &stdInterpreter,
0, 1, 0, 0, 0x1404, "MinFocalLength", &stdInterpreter,
0, 1, 0, 0, 0x1405, "MaxFocalLength", &stdInterpreter,
0, 1, 0, 0, 0x1406, "MaxApertureAtMinFocal", &stdInterpreter,
0, 1, 0, 0, 0x1407, "MaxApertureAtMaxFocal", &stdInterpreter,
0, 1, 0, 0, 0x8000, "FileSource", &stdInterpreter,
0, 1, 0, 0, 0x8002, "OrderNumber", &stdInterpreter,
0, 1, 0, 0, 0x8003, "FrameNumber", &stdInterpreter,
-1, 0, 0, 0, 0, "", NULL};
{0, 1, 0, 0, 0x0000, "Version", &stdInterpreter},
{0, 1, 0, 0, 0x0010, "InternalSerialNumber", &stdInterpreter},
{0, 1, 0, 0, 0x1000, "Quality", &stdInterpreter},
{0, 1, 0, 0, 0x1001, "Sharpness", &faSharpnessInterpreter},
{0, 1, 0, 0, 0x1002, "WhiteBalance", &faWhiteBalanceInterpreter},
{0, 1, 0, 0, 0x1003, "Saturation", &faSaturationInterpreter},
{0, 1, 0, 0, 0x1004, "Contrast", &faContrastInterpreter},
{0, 1, 0, 0, 0x1005, "ColorTemperature", &stdInterpreter},
{0, 1, 0, 0, 0x1006, "Contrast2", &faContrast2Interpreter},
{0, 1, 0, 0, 0x100a, "WhiteBalanceFineTune", &stdInterpreter},
{0, 1, 0, 0, 0x100b, "NoiseReduction", &faNoiseReductionInterpreter},
{0, 1, 0, 0, 0x100b, "FujiFlashMode", &faFlashInterpreter},
{0, 1, 0, 0, 0x1011, "FlashExposureComp", &stdInterpreter},
{0, 1, 0, 0, 0x1020, "Macro", &faOnOffInterpreter},
{0, 1, 0, 0, 0x1021, "FocusMode", &faFocusModeInterpreter},
{0, 1, 0, 0, 0x1023, "FocusPixel", &stdInterpreter},
{0, 1, 0, 0, 0x1030, "SlowSync", &faOnOffInterpreter},
{0, 1, 0, 0, 0x1031, "PictureMode", &faPictureModeInterpreter},
{0, 1, 0, 0, 0x1100, "AutoBracketing", &faOnOffInterpreter},
{0, 1, 0, 0, 0x1101, "SequenceNumber", &stdInterpreter},
{0, 1, 0, 0, 0x1210, "ColorMode", &faColorModeInterpreter},
{0, 1, 0, 0, 0x1300, "BlurWarning", &faOnOffInterpreter},
{0, 1, 0, 0, 0x1301, "FocusWarning", &faOnOffInterpreter},
{0, 1, 0, 0, 0x1302, "ExposureWarning", &faOnOffInterpreter},
{0, 1, 0, 0, 0x1400, "DynamicRange", &faDynamicRangeInterpreter},
{0, 1, 0, 0, 0x1401, "FilmMode", &faFilmModeInterpreter},
{0, 1, 0, 0, 0x1402, "DynamicRangeSetting", &faDRSettingInterpreter},
{0, 1, 0, 0, 0x1403, "DevelopmentDynamicRange", &stdInterpreter},
{0, 1, 0, 0, 0x1404, "MinFocalLength", &stdInterpreter},
{0, 1, 0, 0, 0x1405, "MaxFocalLength", &stdInterpreter},
{0, 1, 0, 0, 0x1406, "MaxApertureAtMinFocal", &stdInterpreter},
{0, 1, 0, 0, 0x1407, "MaxApertureAtMaxFocal", &stdInterpreter},
{0, 1, 0, 0, 0x8000, "FileSource", &stdInterpreter},
{0, 1, 0, 0, 0x8002, "OrderNumber", &stdInterpreter},
{0, 1, 0, 0, 0x8003, "FrameNumber", &stdInterpreter},
{-1, 0, 0, 0, 0, "", NULL}};
};
#endif

View File

@ -158,9 +158,10 @@ class NAAFInfoInterpreter : public Interpreter {
else if (aff&512)
if (af.str()=="") af << "Far Left";
else af << ", Far Left";
else if (aff&1024)
else if (aff&1024) {
if (af.str()=="") af << "Far Right";
else af << ", Far Right";
}
str << "AFPointsInFocus = " << af.str();
return str.str();

View File

@ -946,7 +946,7 @@ public:
case 2: str << "AF-C";break;
case 3: str << "AF-A";break;
}
if( c & 0xF0 == 0) str << ", Point Selection Auto";
if( (c & 0xF0) == 0) str << ", Point Selection Auto";
else if( c & 0x20 ) str << ", Fixed Center Point Selected";
else if( c & 0x10 ) str << ", Point Selected";
return str.str();

View File

@ -85,7 +85,7 @@ void CACorrection::adjusterChanged (Adjuster* a, double newval) {
void CACorrection::setAdjusterBehavior (bool badd) {
if (!vAdd && badd || vAdd && !badd) {
if ((!vAdd && badd) || (vAdd && !badd)) {
red->setLimits (-0.005, 0.005, 0.0001, 0);
blue->setLimits (-0.005, 0.005, 0.0001, 0);
}

View File

@ -177,7 +177,7 @@ void ColorBoost::adjusterChanged (Adjuster* a, double newval) {
void ColorBoost::setAdjusterBehavior (bool bcbadd) {
if (!cbAdd && bcbadd || cbAdd && !bcbadd)
if ((!cbAdd && bcbadd) || (cbAdd && !bcbadd))
colorboost->setLimits (-100, 100, 1, 0);
cbAdd = bcbadd;

View File

@ -90,10 +90,10 @@ void ColorShift::adjusterChanged (Adjuster* a, double newval) {
void ColorShift::setAdjusterBehavior (bool baadd, bool bbadd) {
if (!aAdd && baadd || aAdd && !baadd)
if ((!aAdd && baadd) || (aAdd && !baadd))
ashift->setLimits (-25, 25, 0.1, 0);
if (!bAdd && bbadd || bAdd && !bbadd)
if ((!bAdd && bbadd) || (bAdd && !bbadd))
bshift->setLimits (-25, 25, 0.1, 0);
aAdd = baadd;

View File

@ -31,21 +31,21 @@ struct ZoomStep {
int czoom;
};
ZoomStep zoomSteps[] = {"10%", 0.1, 10,
"12.5%", 0.125, 8,
"16.6%", 1.0/6.0, 6,
"20%", 0.2, 5,
"25%", 0.25, 4,
"33%", 1.0/3.0, 3,
"50%", 0.5, 2,
"100%", 1.0, 1000,
"200%", 2.0, 2000,
"300%", 3.0, 3000,
"400%", 4.0, 4000,
"500%", 5.0, 5000,
"600%", 6.0, 6000,
"700%", 7.0, 7000,
"800%", 8.0, 8000};
ZoomStep zoomSteps[] = {{"10%", 0.1, 10},
{"12.5%", 0.125, 8},
{"16.6%", 1.0/6.0, 6},
{"20%", 0.2, 5},
{"25%", 0.25, 4},
{"33%", 1.0/3.0, 3},
{"50%", 0.5, 2},
{"100%", 1.0, 1000},
{"200%", 2.0, 2000},
{"300%", 3.0, 3000},
{"400%", 4.0, 4000},
{"500%", 5.0, 5000},
{"600%", 6.0, 6000},
{"700%", 7.0, 7000},
{"800%", 8.0, 8000}};
#define MAXZOOMSTEPS 14
#define ZOOM11INDEX 7

View File

@ -69,7 +69,7 @@ void Distortion::adjusterChanged (Adjuster* a, double newval) {
void Distortion::setAdjusterBehavior (bool bvadd) {
if (!distAdd && bvadd || distAdd && !bvadd)
if ((!distAdd && bvadd) || (distAdd && !bvadd))
distor->setLimits (-0.5, 0.5, 0.001, 0);
distAdd = bvadd;

View File

@ -260,9 +260,9 @@ void FileCatalog::dirSelected (const Glib::ustring& dirname, const Glib::ustring
selectedDirectory = dir->get_parse_name();
fileNameList = getFileList ();
for (int i=0; i<fileNameList.size(); i++) {
for (unsigned int i=0; i<fileNameList.size(); i++) {
Glib::RefPtr<Gio::File> f = Gio::File::create_for_path(fileNameList[i]);
if (f->get_parse_name() != openfile) // if we opened a file at the beginning dont add it again
if (f->get_parse_name() != openfile) // if we opened a file at the beginning don't add it again
checkAndAddFile (f);
}
@ -326,10 +326,10 @@ void FileCatalog::previewReady (FileBrowserEntry* fdn) {
dirEFS.shutterFrom = cfs->shutter;
if (cfs->shutter > dirEFS.shutterTo)
dirEFS.shutterTo = cfs->shutter;
if (cfs->iso>0 && cfs->iso < dirEFS.isoFrom)
dirEFS.isoFrom = cfs->iso;
if (cfs->iso>0 && cfs->iso > dirEFS.isoTo)
dirEFS.isoTo = cfs->iso;
if (cfs->iso>0 && (int)cfs->iso < dirEFS.isoFrom)
dirEFS.isoFrom = (int)cfs->iso;
if (cfs->iso>0 && (int)cfs->iso > dirEFS.isoTo)
dirEFS.isoTo = (int)cfs->iso;
if (cfs->focalLen < dirEFS.focalFrom)
dirEFS.focalFrom = cfs->focalLen;
if (cfs->focalLen > dirEFS.focalTo)
@ -423,7 +423,7 @@ void FileCatalog::_openImage (std::vector<Thumbnail*> tmb) {
if (enabled && listener!=NULL) {
previewLoader.stop ();
thumbImageUpdater.stop ();
for (int i=0; i<tmb.size(); i++) {
for (unsigned int i=0; i<tmb.size(); i++) {
if (editedFiles.find (tmb[i]->getFileName())==editedFiles.end())
listener->fileSelected (tmb[i]);
tmb[i]->decreaseRef ();
@ -453,7 +453,7 @@ void FileCatalog::openRequested (std::vector<Thumbnail*> tmb) {
FCOIParams* params = new FCOIParams;
params->catalog = this;
params->tmb = tmb;
for (int i=0; i<tmb.size(); i++)
for (unsigned int i=0; i<tmb.size(); i++)
tmb[i]->increaseRef ();
g_idle_add (fcopenimg, params);
}
@ -467,7 +467,7 @@ void FileCatalog::deleteRequested (std::vector<FileBrowserEntry*> tbe) {
msd.set_secondary_text(Glib::ustring::compose (M("FILEBROWSER_DELETEDLGMSG"), tbe.size()));
if (msd.run()==Gtk::RESPONSE_YES) {
for (int i=0; i<tbe.size(); i++) {
for (unsigned int i=0; i<tbe.size(); i++) {
Glib::ustring fname = tbe[i]->filename;
// remove from browser
FileBrowserEntry* t = fileBrowser->delEntry (fname);
@ -492,7 +492,7 @@ void FileCatalog::developRequested (std::vector<FileBrowserEntry*> tbe) {
if (listener) {
thumbImageUpdater.stop ();
for (int i=0; i<tbe.size(); i++) {
for (unsigned int i=0; i<tbe.size(); i++) {
rtengine::procparams::ProcParams params = tbe[i]->thumbnail->getProcParams();
rtengine::ProcessingJob* pjob = rtengine::ProcessingJob::create (tbe[i]->filename, tbe[i]->thumbnail->getType()==FT_Raw, params);
double tmpscale;
@ -519,7 +519,7 @@ void FileCatalog::renameRequested (std::vector<FileBrowserEntry*> tbe) {
RenameDialog* renameDlg = new RenameDialog ((Gtk::Window*)get_toplevel());
for (int i=0; i<tbe.size(); i++) {
for (unsigned int i=0; i<tbe.size(); i++) {
renameDlg->initName (Glib::path_get_basename (tbe[i]->filename), tbe[i]->thumbnail->getCacheImageData());
Glib::ustring ofname = tbe[i]->filename;
@ -683,7 +683,7 @@ void FileCatalog::categoryButtonToggled (Gtk::ToggleButton* b) {
for (int i=0; i<5; i++) {
bool active_now, active_before;
active_now = bRank[i]->get_active();
active_before = buttons & (1 << i+2);
active_before = buttons & (1 << (i+2));
if ( active_now && !active_before) bRank[i]->set_image (*iranked[i]);
else if (!active_now && active_before) bRank[i]->set_image (*igranked[i]);
}
@ -743,16 +743,16 @@ int FileCatalog::reparseDirectory () {
// check if a thumbnailed file has been deleted
const std::vector<ThumbBrowserEntryBase*>& t = fileBrowser->getEntries ();
std::vector<Glib::ustring> fileNamesToDel;
for (int i=0; i<t.size(); i++)
for (unsigned int i=0; i<t.size(); i++)
if (!Glib::file_test (t[i]->filename, Glib::FILE_TEST_EXISTS))
fileNamesToDel.push_back (t[i]->filename);
for (int i=0; i<fileNamesToDel.size(); i++) {
for (unsigned int i=0; i<fileNamesToDel.size(); i++) {
delete fileBrowser->delEntry (fileNamesToDel[i]);
cacheMgr.deleteEntry (fileNamesToDel[i]);
}
// check if a new file has been added
for (int i=0; i<nfileNameList.size(); i++) {
for (unsigned int i=0; i<nfileNameList.size(); i++) {
bool found = false;
for (int j=0; j<fileNameList.size(); j++)
if (nfileNameList[i]==fileNameList[j]) {
@ -799,7 +799,7 @@ void FileCatalog::checkAndAddFile (Glib::RefPtr<Gio::File> file) {
Glib::RefPtr<Gio::FileInfo> info = safe_query_file_info(file);
if (info && info->get_file_type() != Gio::FILE_TYPE_DIRECTORY && (!info->is_hidden() || !options.fbShowHidden)) {
int lastdot = info->get_name().find_last_of ('.');
if (options.is_extention_enabled(lastdot!=Glib::ustring::npos ? info->get_name().substr (lastdot+1) : "")){
if (options.is_extention_enabled(lastdot!=(int)Glib::ustring::npos ? info->get_name().substr (lastdot+1) : "")){
previewLoader.add (DirEntry (file->get_parse_name()));
previewsToLoad++;
}
@ -817,7 +817,7 @@ void FileCatalog::addAndOpenFile (const Glib::ustring& fname) {
if( !info )
return;
int lastdot = info->get_name().find_last_of ('.');
if (options.is_extention_enabled(lastdot!=Glib::ustring::npos ? info->get_name().substr (lastdot+1) : "")){
if (options.is_extention_enabled(lastdot!=(int)Glib::ustring::npos ? info->get_name().substr (lastdot+1) : "")){
// if supported, load thumbnail first
Thumbnail* tmb = cacheMgr.getEntry (file->get_parse_name());
if (tmb) {
@ -837,7 +837,7 @@ void FileCatalog::emptyTrash () {
const std::vector<ThumbBrowserEntryBase*> t = fileBrowser->getEntries ();
std::vector<FileBrowserEntry*> toDel;
for (int i=0; i<t.size(); i++)
for (unsigned int i=0; i<t.size(); i++)
if (((FileBrowserEntry*)t[i])->thumbnail->getStage()==1)
toDel.push_back (((FileBrowserEntry*)t[i]));
deleteRequested (toDel);
@ -846,7 +846,7 @@ void FileCatalog::emptyTrash () {
bool FileCatalog::trashIsEmpty () {
const std::vector<ThumbBrowserEntryBase*> t = fileBrowser->getEntries ();
for (int i=0; i<t.size(); i++)
for (unsigned int i=0; i<t.size(); i++)
if (((FileBrowserEntry*)t[i])->thumbnail->getStage()==1)
return false;

View File

@ -129,9 +129,9 @@ void LCurve::setBatchMode (bool batchMode) {
void LCurve::setAdjusterBehavior (bool bradd, bool contradd) {
if (!brAdd && bradd || brAdd && !bradd)
if ((!brAdd && bradd) || (brAdd && !bradd))
brightness->setLimits (-100, 100, 1, 0);
if (!contrAdd && contradd || contrAdd && !contradd)
if ((!contrAdd && contradd) || (contrAdd && !contradd))
contrast->setLimits (-100, 100, 1, 0);
brAdd = bradd;

View File

@ -38,7 +38,7 @@ bool MultiLangMgr::load (Glib::ustring fname, MultiLangMgr* fb) {
char* buffer = new char[2048];
while (buffer = fgets (buffer, 2048, f)) {
while ((buffer = fgets (buffer, 2048, f))) {
// find separator
int seppos = 0;
while (buffer[seppos]!=0 && buffer[seppos]!=';')

View File

@ -68,7 +68,7 @@ std::vector<double> MyCurve::get_vector (int veclen) {
double prev =- 1.0;
int active = 0;
int firstact = -1;
for (int i = 0; i < curve.x.size(); ++i)
for (int i = 0; i < (int)curve.x.size(); ++i)
if (curve.x[i] > prev) {
if (firstact < 0)
firstact = i;
@ -154,8 +154,8 @@ void MyCurve::draw (int handle) {
// histogram in the background
if (bghistvalid) {
// find heighest bin
int histheight = 0;
// find highest bin
unsigned int histheight = 0;
for (int i=0; i<256; i++)
if (bghist[i]>histheight)
histheight = bghist[i];
@ -165,7 +165,7 @@ void MyCurve::draw (int handle) {
cr->move_to (RADIUS, innerHeight-1+RADIUS);
cr->set_source_rgb (0.75, 0.75, 0.75);
for (int i=0; i<256; i++) {
double val = bghist[i] * (double)(innerHeight-2) / histheight;
double val = bghist[i] * (double)(innerHeight-2) / (double)histheight;
if (val>innerHeight-1)
val = innerHeight-1;
if (i>0)
@ -275,204 +275,206 @@ bool MyCurve::handleEvents (GdkEvent* event) {
return false;
switch (event->type) {
case Gdk::CONFIGURE:
if (pixmap)
pixmap.clear ();
case Gdk::CONFIGURE:
if (pixmap)
pixmap.clear ();
retval = true;
break;
case Gdk::EXPOSE:
if (!pixmap) {
pixmap = Gdk::Pixmap::create (get_window(), get_allocation().get_width(), get_allocation().get_height());
interpolate ();
}
draw (lit_point);
break;
case Gdk::EXPOSE:
if (!pixmap) {
pixmap = Gdk::Pixmap::create (get_window(), get_allocation().get_width(), get_allocation().get_height());
interpolate ();
}
draw (lit_point);
retval = true;
break;
case Gdk::BUTTON_PRESS:
if (curve.type!=Parametric) {
if (event->button.button == 1) {
buttonPressed = true;
add_modal_grab ();
case Gdk::BUTTON_PRESS:
if (curve.type!=Parametric) {
if (event->button.button == 1) {
buttonPressed = true;
add_modal_grab ();
// get the pointer position
getCursorPosition(event);
findClosestPoint();
// get the pointer position
getCursorPosition(event);
findClosestPoint();
new_type = CSMove;
if (distanceX > minDistanceX) {
/* insert a new control point */
if (num > 0) {
if (clampedX > curve.x[closest_point])
++closest_point;
}
itx = curve.x.begin();
ity = curve.y.begin();
for (int i=0; i<closest_point; i++) { itx++; ity++; }
curve.x.insert (itx, 0);
curve.y.insert (ity, 0);
num++;
// the graph is refreshed only if a new point is created (snaped to a pixel)
curve.x[closest_point] = clampedX;
curve.y[closest_point] = clampedY;
interpolate ();
draw (closest_point);
notifyListener ();
new_type = CSMove;
if (distanceX > minDistanceX) {
/* insert a new control point */
if (num > 0) {
if (clampedX > curve.x[closest_point])
++closest_point;
}
grab_point = closest_point;
lit_point = closest_point;
ugpX = curve.x[closest_point];
ugpY = curve.y[closest_point];
}
}
retval = true;
break;
case Gdk::BUTTON_RELEASE:
if (curve.type!=Parametric) {
if (event->button.button == 1) {
buttonPressed = false;
}
if (!buttonPressed) {
/* get the pointer position */
getCursorPosition(event);
findClosestPoint();
remove_modal_grab ();
int previous_lit_point = lit_point;
/* delete inactive points: */
itx = curve.x.begin();
ity = curve.y.begin();
for (src = dst = 0; src < num; ++src)
if (curve.x[src] >= 0.0) {
curve.x[dst] = curve.x[src];
curve.y[dst] = curve.y[src];
++dst;
++itx;
++ity;
}
if (dst < src) {
curve.x.erase (itx, curve.x.end());
curve.y.erase (ity, curve.y.end());
if (!curve.x.size()) {
curve.x.push_back (0);
curve.y.push_back (0);
interpolate ();
draw (lit_point);
}
for (int i=0; i<closest_point; i++) { itx++; ity++; }
curve.x.insert (itx, 0);
curve.y.insert (ity, 0);
num++;
// the graph is refreshed only if a new point is created (snaped to a pixel)
curve.x[closest_point] = clampedX;
curve.y[closest_point] = clampedY;
interpolate ();
draw (closest_point);
notifyListener ();
}
grab_point = closest_point;
lit_point = closest_point;
ugpX = curve.x[closest_point];
ugpY = curve.y[closest_point];
}
if (buttonPressed) retval = true;
}
break;
case Gdk::BUTTON_RELEASE:
if (curve.type!=Parametric) {
if (buttonPressed && event->button.button == 1) {
buttonPressed = false;
/* get the pointer position */
getCursorPosition(event);
findClosestPoint();
remove_modal_grab ();
int previous_lit_point = lit_point;
/* delete inactive points: */
itx = curve.x.begin();
ity = curve.y.begin();
for (src = dst = 0; src < num; ++src)
if (curve.x[src] >= 0.0) {
curve.x[dst] = curve.x[src];
curve.y[dst] = curve.y[src];
++dst;
++itx;
++ity;
}
if (distanceX <= minDistanceX) {
new_type = CSMove;
lit_point = closest_point;
}
else {
new_type = CSPlus;
lit_point = -1;
}
if (lit_point != previous_lit_point)
if (dst < src) {
curve.x.erase (itx, curve.x.end());
curve.y.erase (ity, curve.y.end());
if (!curve.x.size()) {
curve.x.push_back (0);
curve.y.push_back (0);
interpolate ();
draw (lit_point);
grab_point = -1;
retval = true;
}
}
if (distanceX <= minDistanceX) {
new_type = CSMove;
lit_point = closest_point;
}
else {
new_type = CSPlus;
lit_point = -1;
}
if (lit_point != previous_lit_point)
draw (lit_point);
grab_point = -1;
retval = true;
notifyListener ();
}
}
break;
case Gdk::LEAVE_NOTIFY:
// Pointer can LEAVE even when dragging the point, so we don't modify the cursor in this case
// The cursor will have to LEAVE another time after the drag...
if (!buttonPressed)
if (grab_point == -1) {
new_type = CSArrow;
lit_point = -1;
draw (lit_point);
}
retval = true;
break;
case Gdk::MOTION_NOTIFY:
if (curve.type == Linear || curve.type == Spline || curve.type == NURBS) {
// get the pointer position
getCursorPosition(event);
if (grab_point == -1) {
// there's no point currently being moved
int previous_lit_point = lit_point;
findClosestPoint();
if (distanceX <= minDistanceX) {
new_type = CSMove;
lit_point = closest_point;
}
else {
new_type = CSPlus;
lit_point = -1;
}
if (lit_point != previous_lit_point)
draw (lit_point);
}
else {
// a point is being moved
// bounds of the grabbed point
double leftBound = (grab_point == 0 ) ? 0. : curve.x[grab_point-1];
double rightBound = (grab_point == num-1) ? 1. : curve.x[grab_point+1];
double const bottomBound = 0.;
double const topBound = 1.;
double leftDeletionBound = leftBound - minDistanceX;
double rightDeletionBound = rightBound + minDistanceX;
double bottomDeletionBound = bottomBound - minDistanceY;
double topDeletionBound = topBound + minDistanceY;
// we memorize the previous position of the point, for optimization purpose
double prevPosX = curve.x[grab_point];
double prevPosY = curve.y[grab_point];
// we memorize the previous position of the point, for optimization purpose
ugpX += deltaX;
ugpY += deltaY;
// handling limitations along X axis
if (ugpX >= rightDeletionBound && (grab_point > 0 && grab_point < (num-1))) {
curve.x[grab_point] = -1.;
}
else if (ugpX <= leftDeletionBound && (grab_point > 0 && grab_point < (num-1))) {
curve.x[grab_point] = -1.;
}
else
// nextPosX is in bounds
curve.x[grab_point] = CLAMP(ugpX, leftBound, rightBound);
// Handling limitations along Y axis
if (ugpY >= topDeletionBound && grab_point != 0 && grab_point != num-1) {
curve.x[grab_point] = -1.;
}
else if (ugpY <= bottomDeletionBound && grab_point != 0 && grab_point != num-1) {
curve.x[grab_point] = -1.;
}
else
// nextPosY is in the bounds
curve.y[grab_point] = CLAMP(ugpY, 0.0, 1.0);
if (curve.x[grab_point] != prevPosX || curve.y[grab_point] != prevPosY) {
// we recalculate the curve only if we have to
interpolate ();
draw (lit_point);
notifyListener ();
}
}
break;
}
case Gdk::LEAVE_NOTIFY:
// Pointer can LEAVE even when dragging the point, so we don't modify the cursor in this case
// The cursor will have to LEAVE another time after the drag...
if (!buttonPressed)
if (grab_point == -1) {
new_type = CSArrow;
lit_point = -1;
draw (lit_point);
}
break;
retval = true;
break;
case Gdk::MOTION_NOTIFY:
if (curve.type == Linear || curve.type == Spline || curve.type == NURBS) {
// get the pointer position
getCursorPosition(event);
if (grab_point == -1) {
// there's no point currently being moved
int previous_lit_point = lit_point;
findClosestPoint();
if (distanceX <= minDistanceX) {
new_type = CSMove;
lit_point = closest_point;
}
else {
new_type = CSPlus;
lit_point = -1;
}
if (lit_point != previous_lit_point)
draw (lit_point);
}
else {
// a point is being moved
// bounds of the grabbed point
double leftBound = (grab_point == 0 ) ? 0. : curve.x[grab_point-1];
double rightBound = (grab_point == num-1) ? 1. : curve.x[grab_point+1];
double const bottomBound = 0.;
double const topBound = 1.;
double leftDeletionBound = leftBound - minDistanceX;
double rightDeletionBound = rightBound + minDistanceX;
double bottomDeletionBound = bottomBound - minDistanceY;
double topDeletionBound = topBound + minDistanceY;
// we memorize the previous position of the point, for optimization purpose
double prevPosX = curve.x[grab_point];
double prevPosY = curve.y[grab_point];
// we memorize the previous position of the point, for optimization purpose
ugpX += deltaX;
ugpY += deltaY;
// handling limitations along X axis
if (ugpX >= rightDeletionBound && (grab_point > 0 && grab_point < (num-1))) {
curve.x[grab_point] = -1.;
}
else if (ugpX <= leftDeletionBound && (grab_point > 0 && grab_point < (num-1))) {
curve.x[grab_point] = -1.;
}
else
// nextPosX is in bounds
curve.x[grab_point] = CLAMP(ugpX, leftBound, rightBound);
// Handling limitations along Y axis
if (ugpY >= topDeletionBound && grab_point != 0 && grab_point != num-1) {
curve.x[grab_point] = -1.;
}
else if (ugpY <= bottomDeletionBound && grab_point != 0 && grab_point != num-1) {
curve.x[grab_point] = -1.;
}
else
// nextPosY is in the bounds
curve.y[grab_point] = CLAMP(ugpY, 0.0, 1.0);
if (curve.x[grab_point] != prevPosX || curve.y[grab_point] != prevPosY) {
// we recalculate the curve only if we have to
interpolate ();
draw (lit_point);
notifyListener ();
}
}
}
retval = true;
break;
default:
break;
}
if (new_type != cursor_type) {
cursor_type = new_type;
cursorManager.setCursor(cursor_type);
}
return retval;
default:
break;
}
if (new_type != cursor_type) {
cursor_type = new_type;
cursorManager.setCursor(cursor_type);
}
return retval;
}
void MyCurve::getCursorPosition(GdkEvent* event) {

View File

@ -84,7 +84,7 @@ void PerspCorrection::adjusterChanged (Adjuster* a, double newval) {
void PerspCorrection::setAdjusterBehavior (bool badd) {
if (!vAdd && badd || vAdd && !badd) {
if ((!vAdd && badd) || (vAdd && !badd)) {
// horiz->setLimits (-0.005, 0.005, 0.0001, 0);
// vert->setLimits (-0.005, 0.005, 0.0001, 0);
}

View File

@ -175,7 +175,7 @@ bool PreviewWindow::on_motion_notify_event (GdkEventMotion* event) {
get_window()->set_cursor (*cCropMoving);
else
get_window()->set_cursor (*cNormal);
return true;
}
bool PreviewWindow::on_button_press_event (GdkEventButton* event) {
@ -201,6 +201,7 @@ bool PreviewWindow::on_button_press_event (GdkEventButton* event) {
}
get_window()->set_cursor (*cCropMoving);
}
return true;
}
bool PreviewWindow::on_button_release_event (GdkEventButton* event) {
@ -213,4 +214,5 @@ bool PreviewWindow::on_button_release_event (GdkEventButton* event) {
get_window()->set_cursor (*cNormal);
mainCropWin->remoteMoveReady ();
}
return true;
}

View File

@ -101,7 +101,7 @@ void Rotate::setBatchMode (bool batchMode) {
void Rotate::setAdjusterBehavior (bool brotadd) {
if (!degAdd && brotadd || degAdd && !brotadd)
if ((!degAdd && brotadd) || (degAdd && !brotadd))
degree->setLimits (-45, 45, 0.01, 0);
degAdd = brotadd;

View File

@ -347,9 +347,9 @@ void ToneCurve::setAdjusterBehavior (bool expadd, bool bradd, bool blackadd, boo
black->setLimits (0, 16384, 1, 0);
else if (blackAdd && !blackadd)
black->setLimits (0, 32768, 1, 0);
if (!brAdd && bradd || brAdd && !bradd)
if ((!brAdd && bradd) || (brAdd && !bradd))
brightness->setLimits (-100, 100, 1, 0);
if (!contrAdd && contradd || contrAdd && !contradd)
if ((!contrAdd && contradd) || (contrAdd && !contradd))
contrast->setLimits (-100, 100, 1, 0);
expAdd = expadd;

View File

@ -77,7 +77,7 @@ void Vignetting::adjusterChanged (Adjuster* a, double newval) {
void Vignetting::setAdjusterBehavior (bool bvadd) {
if (!vigAdd && bvadd || vigAdd && !bvadd)
if ((!vigAdd && bvadd) || (vigAdd && !bvadd))
amount->setLimits (-100, 100, 1, 0);
vigAdd = bvadd;